function encode(uri){if(encodeURIComponent){return encodeURIComponent(uri);}
if(escape){return escape(uri);}}
function decode(uri){uri=uri.replace(/\+/g,' ');if(decodeURIComponent){return decodeURIComponent(uri);}
if(unescape){return unescape(uri);}
return uri;}
function Navigate(source){State=document.LocationSearchForm.StateNav.value;Country=document.LocationSearchForm.CountryNav.value;if(State.indexOf('Default')>=0&&Country.indexOf('Default')>=0)return;var NavigateInfo=document.getElementById('NavigateInfo');if((source=='State')&&(State.indexOf('Default')==-1)){request.open("GET","/Service/geonavigate.php?value="+encode(State)+"&source=State&tmp=<?= urlencode(md5(time())); ?>",true);NavigateInfo.innerHTML='Requesting Data...';}
else if((source=='Country')&&(Country.indexOf('Default')==-1)){request.open("GET","/Service/geonavigate.php?value="+encode(Country)+"&source=Country&tmp=<?= urlencode(md5(time())); ?>",true);NavigateInfo.innerHTML='Requesting Data...';}
else{return;}
request.onreadystatechange=function(){if(request.readyState==4){NavigateInfo.innerHTML='';var xmlDoc=request.responseXML;var markers=xmlDoc.documentElement.getElementsByTagName("marker");if(markers.length==0){NavigateInfo.innerHTML='Navigation info not found';}
else{for(var i=0;i<markers.length;i++){var point=new GLatLng(markers[i].getAttribute("lat"),markers[i].getAttribute("long"));markerforremove=new GMarker(point,iconpointer);map.addOverlay(new GMarker(point,iconpointer));document.F.latitude.value=point.y;document.F.longitude.value=point.x;map.setCenter(point,10);}}}}
request.send(null);}
function createExtraButtons(){document.getElementById("map").appendChild(document.getElementById("extrabuttons1"));document.getElementById("map").appendChild(document.getElementById("extrabuttons2"));document.getElementById("map").appendChild(document.getElementById("extrabuttons3"));}
function ZoomMapToSelLocation(){currentZoom=map.getZoom();newzoom=((currentZoom>=17)?17:(currentZoom+1));map.setCenter(new GLatLng(document.getElementById("latitude").value,document.getElementById("longitude").value),newzoom);}
function delay(milisec){var then,now;then=new Date().getTime();now=then;while((now-then)<milisec){now=new Date().getTime();}}
function MBShowUserMarker(num){aMarkerInfo=aMarkers[num];GEvent.trigger(map,"click",aMarkerInfo[0],aMarkerInfo[0].point);map.setCenter(aMarkerInfo[0].getPoint());aMarkerInfo[0].openInfoWindowHtml("Here I am!");}
function BindMarkers(selectobj){if(aMarkers.length==0){selectobj.style.disabled='false';}
else{for(i=0;i<aMarkers.length;i++){aMarkerInfo=aMarkers[i];selectobj.options[i]=new Option(aMarkerInfo[1],i);}
selectobj.style.disabled='true';}}