var O0,D0,OD,QO;var DQ=new Array;O0=0;OD=0;D0=0;QO=0;function getPostcodeLatLong(QD,D){var OO;localSearch.setSearchCompleteCallback(null,function(){if(localSearch.results[0]){var Q=localSearch.results[0].lat;var DD=localSearch.results[0].lng;var point=new GLatLng(Q,DD);assignLatLng(Q,DD,D);}else{}});localSearch.execute(QD+", UK");}function assignLatLng(lat,lng,D){if(D=="1"){O0=lat;D0=lng;}else if(D=="2"){OD=lat;QO=lng;}else if(D=="3"){var ODO=lat;var O0Q=lng;DOD="";var OO0="";var n;n=DQ.length;DQ[n]={lat:ODO,lng:O0Q};for(var i=0;i<DQ.length;i++){OO0=OO0+" to: "+DQ[i].lat+","+DQ[i].lng;}OO="from: "+O0+","+D0+OO0+" to: "+OD+","+QO;getDistance(OO);}if(O0!=0&&OD!=0){OO=O0+","+D0+" to "+OD+","+QO;getDistance(OO);}}function writeGeos(ODQ,OQ0,OQQ,OQD){document.getElementById(ODQ).innerHTML=OQ0;document.getElementById(OQQ).innerHTML=OQD;}function writeRoute(pcd){var OOQ,O0O;OOQ=document.getElementById("waypoints");O0O=OOQ.innerHTML;OOQ.innerHTML=O0O+","+pcd;}function getDistance(OO){var DO0,DOQ;if(GBrowserIsCompatible()){map=new GMap2(document.getElementById("map"));OQO=document.getElementById("dirdiv");map.setCenter(new GLatLng(O0,D0),3);directions=new GDirections(map,OQO);GEvent.addListener(directions,"load",function(){DOO=directions.getDuration();ODD=directions.getDistance();document.getElementById("hidDistance").value=ODD.meters;document.getElementById("hidTime").value=DOO.seconds;});directions.load(OO);}}function getPostcodes(QD,D){var xmlHttpReq;var OQ,results,Q,DD;var OOO,OOD,QQ;OQ="http://www.whichtable.com/utdsxmlgetpcs.asp?pc="+QD;QQ=parseInt(Math.random()*99999999999999);OQ=OQ+"&mr="+QQ;if(window.XMLHttpRequest){xmlHttpReq=new XMLHttpRequest;xmlHttpReq.overrideMimeType("text/xml");}else if(window.ActiveXObject){xmlHttpReq=new ActiveXObject("Microsoft.XMLHTTP");}xmlHttpReq.open("GET",OQ,true);xmlHttpReq.onreadystatechange=function(){if(xmlHttpReq.readyState==4){if(xmlHttpReq.status==200){OOO=xmlHttpReq.responseXML.getElementsByTagName("lat")[0];OOD=xmlHttpReq.responseXML.getElementsByTagName("lng")[0];Q=OOO.childNodes[0].nodeValue;DD=OOD.childNodes[0].nodeValue;if(Q==0){getPostcodeLatLong(QD,D);}else{assignLatLng(Q,DD,D);}}else{}}};xmlHttpReq.send(null);}function createMarker(point,Q0,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>"+Q0+"</b><br />"+vt+"<br /><a href='assign.asp'>Assign Job</a>");});return marker;}function loadmapNr(pid){var xmlHttpReq;var OQ,results,Q,resultLong;var lng,lat,OOD,OOO,QQ;var lon,lat,O00,O0D,map,point,marker,Q0,vt,OD0;O00=51.49408266;O0D=-0.17295341;if(GBrowserIsCompatible()){map=new GMap2(document.getElementById("map"));map.setCenter(new GLatLng(O00,O0D),15);map.addControl(new GSmallMapControl);OD0=47;Q0="Jafar";lng=-0.18342;lat=51.49888999999999;vt="Estate";point=new GLatLng(lat,lng);map.addOverlay(createMarker(point,Q0,vt));}}
