﻿      
	  google.load("maps", "2");
      //google.load("search", "1");
	  //google.load("language", "1", {"language": "el_GR"});
	  
	  var p, markLL, p1, map, mark, geocoder;
 
      // Call this function when the page has been loaded
      function initialize() {
		var mopts = {	draggable: false,
						bouncy: true,
						title: "Terracom Εθνικής Αντιστάσεως 51"
		}
		
		p = new google.maps.LatLng(39.64720957, 20.87978889);
		markLL = new google.maps.LatLng(39.6272426319, 20.8828371763);
		mark = new google.maps.Marker(markLL, mopts);
	  
		map = new google.maps.Map2(document.getElementById("map"));
        map.setCenter(p, 13);
		map.addControl(new GMapTypeControl());
		geocoder = new GClientGeocoder();
		map.addOverlay(mark);
		map.enableScrollWheelZoom();
		
		// ****************** EVENTS
		google.maps.Event.addListener(mark, "click", overMark);
		google.maps.Event.addListener(map, "click", mapClick);
      }
		
		
		google.setOnLoadCallback(initialize);
		
		function overMark(point){
			getGeoAddress(point, mark.getTitle());
		}
		
		function mapClick(ovr, latlng){
			//getGeoAddress(latlng, null);
			//map.openInfoWindow(latlng, latlng.toString());
		}
		
		function getGeoAddress(latlng, extraStr){
			if(latlng){
				geocoder.getLocations(latlng, function(addresses) {
				  if(addresses.Status.code != 200) {
					alert(addresses.Status.code.toString() + " - reverse geocoder failed to find an address for " + latlng.toUrlValue());
				  }
				  else {
					address = addresses.Placemark[0];
					var myHtml = address.address;
					if(extraStr == null)
						map.openInfoWindow(latlng, myHtml);
					else
						map.openInfoWindow(latlng, extraStr + " - " + myHtml);
				  }
				});
			}
		}
	  

