var a=1;function b(c,d){var f="",g=Math.floor(Math.abs(c)),h;while(true){h=g%d;f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789*-$_.+!'(),".charAt(h)+f;g=(g-h)/d;if(g===0){break;}}return((c<0)?"-"+f:f);}function i(url,j,k){var l=null;var m=j;if(!m)alert('no callback defined');if(!k)k=null;function n(){if(l.readyState==4){if(l.status==200){m(l);}else{alert('There was a problem fetching data:\n'+l.statusText);}}}l=GXmlHttp.create();l.onreadystatechange=n;l.open("POST",url,true);l.setRequestHeader('Content-Type','application/x-www-form-urlencoded');if(k)l.setRequestHeader('Content-Length','');l.setRequestHeader('Connection','close');l.send(k);}function GuideMap(o){var p={};var l;var q=false;var r=null;var s=null;var self=this;var t=new GMap2(o,[G_HYBRID_MAP,G_SATELLITE_MAP,G_NORMAL_MAP]);t.setCenter(new GLatLng(0,0),a,G_HYBRID_MAP);t.addControl(new GLargeMapControl());t.addControl(new GMapTypeControl());t.addControl(new GScaleControl());this.t=t;GEvent.addListener(self.t,"moveend",function(){var u=self.t.getCenter();document.getElementById("coords").innerHTML='<font size="-1">'+'('+u.x+' '+u.y+')'+'</font>';});if(window.attachEvent){window.attachEvent("onresize",function(){self.t.checkResize();});}else{window.addEventListener("resize",function(){self.t.checkResize();},false);}this.v=function(w,z,aa,ab,ac,ad){self.t.panTo(w);self.ae(w,z,aa,ab,ac,ad);};this.delMkr=function(ab){i('http://'+SERVER_NAME+'/go/'+LANG+'/gmap/delmarker',self.af,'placeid='+encodeURIComponent(ab));};this.ag=function(){ah='';for(var ai in p){if(p[ai]){if(ah.length===0){ah+='?';}else{ah+='&';}ah+='placeid[]='+ai;}}document.getElementById("bookmark").setAttribute("href","/go/"+LANG+"/gmap"+ah);};this.clrMkrs=function(){i("http://"+SERVER_NAME+"/go/"+LANG+"/gmap/clear",function(){self.t.closeInfoWindow();self.t.clearOverlays();p={};self.ag();});};this.af=function(l){var aj=p[l.responseText];if(aj){self.t.closeInfoWindow();self.t.removeOverlay(aj);p[l.responseText]=null;self.ag();}};this.ae=function(w,z,aa,ab,ac,ak){if(p[ab]){if(ak){r=p[ab];s=ac;}return false;}var al=new GIcon();al.image="http://labs.google.com/ridefinder/images/mm_20_red.png";al.image="http://"+SERVER_NAME+"/go/"+LANG+"/gmap/pnimg/"+ab;al.shadow="http://labs.google.com/ridefinder/images/mm_20_shadow.png";al.shadow="http://"+SERVER_NAME+"/i/dot.png";al.iconSize=new GSize(z,aa);al.shadowSize=new GSize(6,6);al.iconAnchor=new GPoint(3,3);al.infoWindowAnchor=new GPoint(3,3);var aj=new GMarker(w,al);self.t.addOverlay(aj);p[ab]=aj;self.ag();GEvent.addListener(aj,"click",function(){aj.openInfoWindowHtml(ac);});if(ak){r=aj;s=ac;}return true;};this.am=function(l){an=l.responseXML.documentElement;if(an){ao=an.getElementsByTagName("centroid")[0];lat=parseFloat(ao.getElementsByTagName("lat")[0].firstChild.data);ap=parseFloat(ao.getElementsByTagName("lon")[0].firstChild.data);if(!q){self.t.setCenter(new GLatLng(lat,ap),13);}else{self.t.panTo(new GLatLng(lat,ap));}minx=ap;maxx=ap;miny=lat;maxy=lat;aq=an.getElementsByTagName("row");for(ai=0;ai<aq.length;++ai){ar=aq[ai].getElementsByTagName("geo")[0].firstChild.data;as=ar.split(" ");ap=parseFloat(as[0].substring(6));lat=parseFloat(as[1].substring(0,as[1].length-1));if(ap<minx)minx=ap;if(ap>maxx)maxx=ap;if(lat<miny)miny=lat;if(lat>maxy)maxy=lat;ab=parseFloat(aq[ai].getElementsByTagName("placeid")[0].firstChild.data);at=aq[ai].getElementsByTagName("placeword")[0].firstChild;if(at)at=at.data;name=aq[ai].getElementsByTagName("name")[0].firstChild.data;z=parseFloat(aq[ai].getElementsByTagName("imgx")[0].firstChild.data);aa=parseFloat(aq[ai].getElementsByTagName("imgy")[0].firstChild.data);au=aq[ai].getElementsByTagName("pplaceid")[0].firstChild;if(au)au=parseFloat(au.data);av=aq[ai].getElementsByTagName("pplaceword")[0].firstChild;if(av)av=av.data;aw=aq[ai].getElementsByTagName("pname")[0].firstChild;if(aw)aw=aw.data;ax=aq[ai].getElementsByTagName("blurb")[0].firstChild;if(ax)ax=ax.data;selected=aq[ai].getElementsByTagName("sel")[0];if(selected){selected=selected.firstChild;}if(selected){selected=selected.data;}ay='<a target="_blank" href="/go/'+LANG+'/place/'+(at?at:ab)+'">'+name+'</a>';if(ax){ay+='<br>'+ax;}if(au&&parseFloat(au)!==ROOT_PLACEID){ay+='<br><a target="_blank" class="tablecitylink"'+' href="/go/'+LANG+'/place/'+(av?av:au)+'">'+aw+'</a>';az=aq[ai].getElementsByTagName("label");for(ba=0;ba<az.length;++ba){if(ba%4===0){ay+='<br>';}ay+=' <a target="_blank" href="/go/'+LANG+'/place/bylabel?label='+az[ba].getElementsByTagName("u")[0].firstChild.data+'&amp;place='+(av?av:au)+'">'+az[ba].getElementsByTagName("d")[0].firstChild.data+'</a>';}}ay+='<br><font size="-2"><a href="#" onclick="guideMap.delMkr('+ab+');return false;">'+REMOVE_TEXT+'</a></font>';self.ae(new GLatLng(lat,ap),z,aa,ab,ay,selected=='t');}if(aq.length===0){self.t.setZoom(a);}else if(!q){var bb=12;var bc=self.t.getBounds();while(bb>a&&(bc.getSouthWest().lng()>minx||bc.getSouthWest().lat()>miny||bc.getNorthEast().lng()<maxx||bc.getNorthEast().lat()<maxy)){self.t.setZoom(bb);--bb;bc=self.t.getBounds();}q=true;}if(r){r.openInfoWindowHtml(s);}document.getElementById("instructions").innerHTML='<font size="-1">Click a marker for more information.  Double click on a spot to see its coordinates here:</font>';}};this.bd=function(l){var be=document.getElementById('results');while(be.firstChild){be.removeChild(be.firstChild);}var an=l.responseXML.documentElement;if(an){an=an.childNodes;var bf,at,bg,bh,ax,bi,bj,bk,az,bl;function bm(bn){var x=bn.firstChild;if(x){x=x.data;}return x;}for(var ai=0;ai<an.length;++ai){var bo=an[ai].childNodes;bf=null;at=null;bg={};bh=null;ax=null;bi=null;bj=null;bk=null;az=null;bl=null;for(var ba=0;ba<bo.length;++ba){switch(bo[ba].nodeName){case 'pid':bi=bm(bo[ba]);break;case 'pword':bj=bm(bo[ba]);break;case 'pname':bk=bm(bo[ba]);break;case 'lab':az=bm(bo[ba]);break;case 'xlab':bl=bm(bo[ba]);break;case 'blurb':ax=bm(bo[ba]);break;case 'stars':bh=bo[ba].firstChild.data;break;case 'name':var bp=bo[ba].firstChild;if(bp){bp=bp.data;if(bp.length>2&&bp.charAt(2)=='='){bg[bp.substring(0,2)]=bp.substring(3);}else{bg['']=bp;}}break;case 'id':bf=bm(bo[ba]);break;case 'word':at=bm(bo[ba]);break;}}if(bf||at){var bq=document.createElement('p');var br=document.createElement('font');br.setAttribute('size','+1');var title=document.createElement('a');var href='placeid='+bf;if(at){href='placeword='+encodeURIComponent(at);}function bs(ab){return function(){i('http://'+SERVER_NAME+'/go/'+LANG+'/gmap/placeinfos?place='+ab,self.am);return false;};}title.onclick=bs(bf);title.setAttribute('href','http://'+SERVER_NAME+'/go/'+LANG+'/place/'+encodeURIComponent(at?at:bf));title.setAttribute('target','_blank');var bt='Untitled';if(bg[LANG]){bt=bg[LANG];}for(var bu in bg){if(bu!=LANG){bt+=' ('+bg[bu]+')';break;}}title.appendChild(document.createTextNode(bt));br.appendChild(title);bq.appendChild(br);if(bh){var bv=document.createElement('img');bh=parseFloat(bh)*2.0;bh=parseFloat(bh.toString())/2.0;bv.setAttribute('src','/guide/i/stars'+(bh*10).toString().substring(0,2)+".gif");bv.setAttribute('alt',bh+" stars");bq.appendChild(bv);}if(ax){bq.appendChild(document.createElement('br'));var bw=document.createElement('span');bw.innerHTML=ax;bq.appendChild(bw);}if(bi){bq.appendChild(document.createElement('br'));title=document.createElement('a');title.setAttribute('href','http://'+SERVER_NAME+'/go/'+LANG+'/place/'+encodeURIComponent(bj?bj:bi));title.setAttribute('target','_blank');title.className='tablecitylink';title.appendChild(document.createTextNode(bk?bk:'Untitled'));bq.appendChild(title);var bx=az?az.split(':'):{};var by=bl?bl.split(':'):{};if(bx.length>0){bq.appendChild(document.createTextNode(' -'));for(var bz=0;bz<bx.length;++bz){bq.appendChild(document.createTextNode(' '));ca=document.createElement('a');ca.setAttribute('href','http://'+SERVER_NAME+'/go/'+LANG+'/place/bylabel?label='+bx[bz]+'&place='+encodeURIComponent(bj?bj:bi));ca.setAttribute('target','_blank');ca.appendChild(document.createTextNode(by[bz]?by[bz]:bx[bz]));bq.appendChild(ca);}}}be.appendChild(bq);}}}};this.doSearch=function(ah){document.getElementById('results').innerHTML=SEARCHING;i('http://'+SERVER_NAME+'/go/'+LANG+'/gmap/searchx',self.bd,'s='+encodeURIComponent(ah));};document.getElementById("form").innerHTML='<form name="searchform" onSubmit="guideMap.doSearch(document.searchform.s.value);return false;" action="/go/'+LANG+'/viewsearch" target="_blank">'+ADDPLACE+'<br><input type="text" name="s"><input type="submit" value="'+SEARCH+'"></form>';var cb="";var ai=location.href.indexOf("?");if(ai>=0){cb=location.href.substring(ai);}i("http://"+SERVER_NAME+"/go/"+LANG+"/gmap/placeinfos"+cb,this.am);}$(document).ready(function(){guideMap=new GuideMap(document.getElementById('map'));});
