// JavaScript Document
var map = new GMap2(document.getElementById("map"));
		   var geoCode= new GClientGeocoder();
function login_submit(){
	if((document.admin_login.username.value!="")&&(document.admin_login.password.value!="")){
		document.admin_login.action="process.php?val=login";
		document.admin_login.submit();
	}
	else{alert("Username and Password cannot be empty. Please enter valid values");}	
}
var popupwindow;
function details(ne){
	popupwindow=window.open('sub/view.php?val='+ne,'popup','height=400,width=440,scrollbars,resizable');
	popupwindow.focus();
}
function picdetails(ne){
	popupwindow=window.open('view.php?val='+ne,'popup','height=400,width=440,scrollbars,resizable');
	popupwindow.focus();
}


	function showmap(ad){
	  if (GBrowserIsCompatible()) {
	
		 
		geoCode.getLatLng(ad,function(point) 
		                      {
							       if (!point) 
							        { 
								      alert(ad + " not found"); 
								   
								     } 
								   else 
								     { 
									   map.setCenter(point, 16)
									     //map.addOverlay(createMarker(point, 1));
		                               map.addControl(new GSmallMapControl());
									 }});
									 }
	
	}
	
		function addMark(ad){
	  if (GBrowserIsCompatible()) {
		
		 
		geoCode.getLatLng(ad,function(point) 
		                      {
							       if (!point) 
							        { 
								      alert(ad + " not found"); 
								   
								     } 
								   else 
								     { 
									   map.setCenter(point, 16)
									     map.addOverlay(createMarker(point, 1));
										  map.addOverlay(createMarker((40.000,-73.000), 1));
		                               map.addControl(new GSmallMapControl());
									 }});
									 }
									 
									 function createMarker(point, number) {
		  var marker = new GMarker(point);
		  marker.value = number;
		  GEvent.addListener(marker,"click", function() {
			var myHtml = "<b>" + nm + "</b><br/>" + ad;
			myHtml=myHtml+"<br/><a onClick='javascript:pass_directions(document.getElementById(\"di\").value)' style='color:00F;cursor:pointer'>Get directions</a>";			
			myHtml=myHtml+" From <input class='TextBox' type='text' id='di' size='20'></> <a onClick='javascript:pass_directions(document.getElementById(\"di\").value)' style='color:00F;cursor:pointer'>Go</a>";
			map.openInfoWindowHtml(point, myHtml);
		  });
		  return marker;
		}
	
	}
