var VU,UV,VW,UY;var UW=new Array;VU=0;VW=0;UV=0;UY=0;function getPostcodeLatLong(WU,U){var VV;localSearch.setSearchCompleteCallback(null,function(){if(localSearch.results[0]){var W=localSearch.results[0].lat;var UU=localSearch.results[0].lng;var point=new GLatLng(W,UU);assignLatLng(W,UU,U);}else{}});localSearch.execute(WU+", UK");}function assignLatLng(lat,lng,U){if(U=="1"){VU=lat;UV=lng;}else if(U=="2"){VW=lat;UY=lng;}else if(U=="3"){var VVY=lat;var VVW=lng;VYU="";var YV="";var n;n=UW.length;UW[n]={lat:VVY,lng:VVW};for(var i=0;i<UW.length;i++){YV=YV+" to: "+UW[i].lat+","+UW[i].lng;}VV="from: "+VU+","+UV+YV+" to: "+VW+","+UY;getDistance(VV);}if(VU!=0&&VW!=0){VV=VU+","+UV+" to "+VW+","+UY;getDistance(VV);}}function writeGeos(VUW,VWV,VWW,VWU){document.getElementById(VUW).innerHTML=VWV;document.getElementById(VWW).innerHTML=VWU;}function writeRoute(pcd){var YW,YY;YW=document.getElementById("waypoints");YY=YW.innerHTML;YW.innerHTML=YY+","+pcd;}function getDistance(VV){var VYV,VYW;if(GBrowserIsCompatible()){map=new GMap2(document.getElementById("map"));VUY=document.getElementById("dirdiv");map.setCenter(new GLatLng(VU,UV),3);directions=new GDirections(map,VUY);GEvent.addListener(directions,"load",function(){VWY=directions.getDuration();VUU=directions.getDistance();document.getElementById("hidDistance").value=VUU.meters;document.getElementById("hidTime").value=VWY.seconds;});directions.load(VV);}}function getPostcodes(WU,U){var xmlHttpReq;var VY,results,W,UU;var WY,YU,WW;VY="http://www.whichtable.com/utdsxmlgetpcs.asp?pc="+WU;WW=parseInt(Math.random()*99999999999999);VY=VY+"&mr="+WW;if(window.XMLHttpRequest){xmlHttpReq=new XMLHttpRequest;xmlHttpReq.overrideMimeType("text/xml");}else if(window.ActiveXObject){xmlHttpReq=new ActiveXObject("Microsoft.XMLHTTP");}xmlHttpReq.open("GET",VY,true);xmlHttpReq.onreadystatechange=function(){if(xmlHttpReq.readyState==4){if(xmlHttpReq.status==200){WY=xmlHttpReq.responseXML.getElementsByTagName("lat")[0];YU=xmlHttpReq.responseXML.getElementsByTagName("lng")[0];W=WY.childNodes[0].nodeValue;UU=YU.childNodes[0].nodeValue;if(W==0){getPostcodeLatLong(WU,U);}else{assignLatLng(W,UU,U);}}else{}}};xmlHttpReq.send(null);}function createMarker(point,WV,vt){var icon=new GIcon;icon.image="http://maps.google.com/mapfiles/ms/micons/cabs.png";icon.shadow="http://maps.google.com/mapfiles/ms/micons/cabs.shadow.png";icon.iconAnchor=new GPoint(10,34);icon.infoWindowAnchor=new GPoint(6,1);icon.infoShadowAnchor=new GPoint(13,13);var marker=new GMarker(point,icon);GEvent.addListener(marker,"mouseover",function(){marker.openInfoWindowHtml("<b>"+WV+"</b><br />"+vt+"<br /><a href='assign.asp'>Assign Job</a>");});return marker;}function loadmapNr(pid){var xmlHttpReq;var VY,results,W,resultLong;var lng,lat,YU,WY,WW;var lon,lat,VVV,VVU,map,point,marker,WV,vt,VUV;VVV=51.49408266;VVU=-0.17295341;if(GBrowserIsCompatible()){map=new GMap2(document.getElementById("map"));map.setCenter(new GLatLng(VVV,VVU),15);map.addControl(new GSmallMapControl);VUV=47;WV="Jafar";lng=-0.18342;lat=51.49888999999999;vt="Estate";point=new GLatLng(lat,lng);map.addOverlay(createMarker(point,WV,vt));}}