var ab;var bb;var cb=null;var db=Array();var eb=Array();var fb;var gb;var bb;var hb=1609;var ib;var jb=null;var cb=new GClientGeocoder();function kb(lb,mb){return lb+","+mb;}
function nb(ob){return kb(ob.lat(),ob.lng());}
function pb(qb){var rb=document.getElementById('venueTable').getElementsByTagName("TBODY")[0];var sb=document.createElement("TR");var tb=document.createElement("TD");var ub=document.createElement("TD");tb.appendChild(document.createTextNode(eb[nb(db[qb])+".distance"]+" miles"));ub.appendChild(document.createTextNode(eb[nb(db[qb])+".venueName"]));sb.setAttribute("id",nb(db[qb]));sb.onclick=function(){setEnd(db[qb].lat(),db[qb].lng())}
;sb.appendChild(tb);sb.appendChild(ub);rb.appendChild(sb);}
function vb(){var rb=document.getElementById('venueTable').getElementsByTagName("TBODY")[0];var wb=document.getElementById('venueTable');while(wb.rows.length>0){wb.deleteRow(0);}
var sb=document.createElement("TR");var xb=document.createElement("TH");var yb=document.createElement("TH");xb.appendChild(document.createTextNode("Distance (as crow flies)"));yb.appendChild(document.createTextNode("Venue"));sb.appendChild(xb);sb.appendChild(yb);rb.appendChild(sb);}
function zb(ab){GDownloadUrl("venues.xml",function($b,_b){var ac=GXml.parse($b);var bc=ac.documentElement.getElementsByTagName("venue");for(var i=0;i<bc.length;i++){cc(ab,bc[i].getElementsByTagName("address")[0].childNodes[0].nodeValue,bc[i].getElementsByTagName("name")[0].childNodes[0].nodeValue,bc[i].getElementsByTagName("base")[0].childNodes[0].nodeValue,bc[i].getElementsByTagName("location")[0].getAttribute("lat"),bc[i].getElementsByTagName("location")[0].getAttribute("lng"));}
setStart(document.getElementById("fromAddress").value);}
);}
function dc(qb){var ec=document.getElementById('venueInfoTitle');ec.setAttribute("className","visible");ec.setAttribute("class","visible");var rb=document.getElementById('venueInfo');rb.innerHTML='<a href="'+eb[qb+".link"]+'"><img class="venueImage" src="'+eb[qb+".link"]+'pics/auto/venue_150.jpg" /></a>'+"<div class=\"venueInfoText\"><h5>"+eb[qb+".venueName"]+"</h5><pre>"+eb[qb+".address"]+"</pre></div><div align=\"center\">"+"<table class=\"linkbox\"><tr><td><a href=\""+eb[qb+".link"]+"\">&nbsp;Book now&nbsp;<img src=\"/pics/forward.png\""+" /></a></td></tr></table></div>";}
function cc(ab,fc,gc,hc,lb,mb){var ob=new GLatLng(lb,mb);db.push(ob);eb[nb(ob)+".address"]=fc;eb[nb(ob)+".venueName"]=gc;eb[nb(ob)+".link"]=hc;eb[nb(ob)+".lat"]=ob.lat();eb[nb(ob)+".lng"]=ob.lng();var ic=new GMarker(ob,ib);GEvent.addListener(ic,"click",function(){var jc="Venue: <b>"+gc+"</b><br><br>";if(gb!=null){jc=jc+'<a href="#" onclick="setEnd('+ob.lat()+','+ob.lng()+'); return false;">Get directions ></a>';}
else{jc=jc+'Enter your address above<br> to find nearest venue';dc([nb(ob)]);}
ic.openInfoWindowHtml(jc);}
);ab.addOverlay(ic);}
function kc(lc,mc){if(mc!=null){var sb=document.getElementById(mc);sb.setAttribute("className",lc);sb.setAttribute("class",lc);}
}
function setEnd(lb,mb){if(gb!=null){ab.closeInfoWindow();var qb=lb+","+mb;kc('',jb);kc('selected',qb);jb=qb;dc(qb);nc(gb+"@"+fb.lat()+","+fb.lng(),eb[qb+".venueName"]+"@"+eb[qb+".lat"]+","+eb[qb+".lng"],"en_GB");}
}
function setStart(fc){if(fc!=''){cb.getLatLng(fc+', uk',function(ob){if(!ob){alert(fc+" not found");}
else{fb=ob;gb=fc;ab.setCenter(fb,13);oc();}
}
);}
}
function pc(LatLonA,LatLonB){return fb.distanceFrom(LatLonA)-fb.distanceFrom(LatLonB);}
function load(){if(GBrowserIsCompatible()){ab=new GMap2(document.getElementById("map"));ab.setCenter(new GLatLng(54.5,-3.7),5);ab.addControl(new GSmallMapControl());ab.enableScrollWheelZoom();ab.addControl(new GMapTypeControl());bb=new GDirections(ab,document.getElementById("directions"));GEvent.addListener(bb,"load",onGDirectionsLoad);GEvent.addListener(bb,"error",qc);ib=new GIcon();ib.image="/pics/maps/venue.png";ib.shadow="/pics/maps/shadow.png";ib.iconSize=new GSize(29,35);ib.shadowSize=new GSize(29,35);ib.iconAnchor=new GPoint(9,34);ib.infoWindowAnchor=new GPoint(5,1);zb(ab);}
}
function oc(){if(GBrowserIsCompatible()){db.sort(pc);vb();for(var n=0;n<db.length;n++){eb[[nb(db[n])]+".distance"]=Math.round(fb.distanceFrom(db[n])/hb);pb(n);}
bb.clear();setEnd(db[0].lat(),db[0].lng());}
}
function nc(rc,sc,tc){var ec=document.getElementById('directionsTitle');ec.setAttribute("className","visible");ec.setAttribute("class","visible");bb.load(rc+" to "+sc,{"locale":tc}
);}
function qc(){if(bb.getStatus().code==G_GEO_UNKNOWN_ADDRESS)alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: "+bb.getStatus().code);else if(bb.getStatus().code==G_GEO_SERVER_ERROR)alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: "+bb.getStatus().code);else if(bb.getStatus().code==G_GEO_MISSING_QUERY)alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: "+bb.getStatus().code);else if(bb.getStatus().code==G_GEO_BAD_REQUEST)alert("A directions request could not be successfully parsed.\n Error code: "+bb.getStatus().code);else alert("An unknown error occurred.");}
function onGDirectionsLoad(){}

// version 200809051726_adam_kew

