// JavaScript Document
 var geocoder = null;

		 var marker = null;
		 var map=null;
		function loadmap() 
		{
		  if (GBrowserIsCompatible())
		   {
			 map = new GMap2(document.getElementById("myMap"));
			// map.addControl(new GLargeMapControl());
			 map.addControl(new GSmallMapControl());
			 map.addControl(new GMapTypeControl());  
			 map.setCenter(new GLatLng(37.97918, 23.716647), 15);
			geocoder = new GClientGeocoder();
///////////// if you want to add marker when we click on map so u have to uncomment the multiline commented code
	/*  
		 GEvent.addListener(map, "click", function(overlay, point) 
						{
							map.clearOverlays();
							icon=createIcon1("images/Hmarker.gif");
						marker = new GMarker(point, {icon:icon,draggable: true}); 
						//marker = new GMarker(point, {draggable: true});  
						document.a.latitude.value = point.y;
						document.a.longitude.value = point.x;
						
							GEvent.addListener(marker, "dragend", function()
						{
						var pt = marker.getPoint();
						document.a.latitude.value = pt.y;
						document.a.longitude.value = pt.x;
						var str="<div><b>drag the marker on  map <br/>regarding latitude & longitude</b></div>";
						//this.openInfoWindowHtml(str);
						});map.addOverlay(marker);
						})
		
	*/
////////////////////////////////////////////End of code clik marker ///////////****************** ///////////////////////
		  
		  
		  }
		}
		
		function geo()
	{
			map.clearOverlays();
			var add = document.getElementById('txtcityname').value;
			geocoder.getLocations(add, addAddressToMap);
	}
	
	
	function addAddressToMap(response) 
			{
					
					if (!response || response.Status.code != 200) 
					{	document.a.latitude.value = "";
						document.a.longitude.value = "";
						alert("Geocode is not Possible");
						
					} 
					else 
					{
						place = response.Placemark[0];
						point = new GLatLng(place.Point.coordinates[1],
						place.Point.coordinates[0]);
						document.a.latitude.value = place.Point.coordinates[1];
						document.a.longitude.value = place.Point.coordinates[0];
						icon=createIcon1("images/Hmarker.gif");
						marker = new GMarker(point, {icon:icon,draggable: true});  //replace 13 augast
						
						GEvent.addListener(marker, "click", function()
						{
						var pt = marker.getPoint();
						document.a.latitude.value = pt.y;
						document.a.longitude.value = pt.x;
					var str="<div>drag the marker on  map <br/>regarding location.</div>";
							//this.openInfoWindowHtml(str);
							});
						
						GEvent.addListener(marker, "dragend", function()
						{
						var pt = marker.getPoint();
						document.a.latitude.value = pt.y;
						document.a.longitude.value = pt.x;
						});
						map.setCenter(point, 15);
						map.addOverlay(marker);
				}
		   }
		   
function createIcon1(src)
{
	
	
	var icon = new GIcon();
	icon.image = src;
	icon.shadow=null;
	icon.iconSize = new GSize(30, 27);
	icon.iconAnchor = new GPoint(6, 20);
	icon.infoWindowAnchor = new GPoint(10,5);
	
	return icon;
}

function previewcall()
	{
		 //alert("p");
		if(document.getElementById('latitude').value=="" || document.getElementById('longitude').value=="")
	 {
	 alert("Please search alocation.");
	 return false;
	 }
	 	 if(document.getElementById('txtcityname').value=="" )
	 {
	 alert("Please enter a city name.");
	 return false;
	 }
		 document.a.action ="prevhotels.php";
		 	document.a.submit();
			
	}
function addonmaphotel(area)
	{
		//alert("gdh"+area);
	if(document.getElementById('latitude').value=="" || document.getElementById('longitude').value=="")
	 {
	 alert("Please search alocation.");
	 return false;
	 }
	 	 if(document.getElementById('txtcityname').value=="" )
	 {
	 alert("Please enter a city name.");
	 return false;
	 }
		
		document.a.action ="addhotel.php";
		document.a.submit();
	}
 function  validation()
 {
 //alert("gdfg");
	 if(document.getElementById('latitude').value=="" || document.getElementById('longitude').value=="")
	 {
	 alert("Please search alocation.");
	 return false;
	 }
	 	 if(document.getElementById('txtcityname').value=="" )
	 {
	 alert("Please enter a city name.");
	 return false;
	 }


 }
