var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(c){var a="";var k,h,f,j,g,e,d;var b=0;c=Base64._utf8_encode(c);while(b<c.length){k=c.charCodeAt(b++);h=c.charCodeAt(b++);f=c.charCodeAt(b++);j=k>>2;g=((k&3)<<4)|(h>>4);e=((h&15)<<2)|(f>>6);d=f&63;if(isNaN(h)){e=d=64;}else{if(isNaN(f)){d=64;}}a=a+this._keyStr.charAt(j)+this._keyStr.charAt(g)+this._keyStr.charAt(e)+this._keyStr.charAt(d);}return a;},decode:function(c){var a="";var k,h,f;var j,g,e,d;var b=0;c=c.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(b<c.length){j=this._keyStr.indexOf(c.charAt(b++));g=this._keyStr.indexOf(c.charAt(b++));e=this._keyStr.indexOf(c.charAt(b++));d=this._keyStr.indexOf(c.charAt(b++));k=(j<<2)|(g>>4);h=((g&15)<<4)|(e>>2);f=((e&3)<<6)|d;a=a+String.fromCharCode(k);if(e!=64){a=a+String.fromCharCode(h);}if(d!=64){a=a+String.fromCharCode(f);}}a=Base64._utf8_decode(a);return a;},_utf8_encode:function(b){b=b.replace(/\r\n/g,"\n");var a="";for(var e=0;e<b.length;e++){var d=b.charCodeAt(e);if(d<128){a+=String.fromCharCode(d);}else{if((d>127)&&(d<2048)){a+=String.fromCharCode((d>>6)|192);a+=String.fromCharCode((d&63)|128);}else{a+=String.fromCharCode((d>>12)|224);a+=String.fromCharCode(((d>>6)&63)|128);a+=String.fromCharCode((d&63)|128);}}}return a;},_utf8_decode:function(a){var b="";var d=0;var e=c1=c2=0;while(d<a.length){e=a.charCodeAt(d);if(e<128){b+=String.fromCharCode(e);d++;}else{if((e>191)&&(e<224)){c2=a.charCodeAt(d+1);b+=String.fromCharCode(((e&31)<<6)|(c2&63));d+=2;}else{c2=a.charCodeAt(d+1);c3=a.charCodeAt(d+2);b+=String.fromCharCode(((e&15)<<12)|((c2&63)<<6)|(c3&63));d+=3;}}}return b;}};var GoogleMapViewer=Class.create();GoogleMapViewer.prototype={initialize:function(a){this.mapcontainer=$(a);this.fitAvailableHeight();Event.observe(window,"resize",function(){this.fitAvailableHeight();}.bind(this));if(GBrowserIsCompatible()){this.map=new GMap2(this.mapcontainer);this.map.addControl(new GLargeMapControl());this.map.addControl(new GMapTypeControl());this.map.addControl(new GOverviewMapControl());this.map.setCenter(new GLatLng(0,0),0);this.bounds=new GLatLngBounds();this.marker=new Array();Event.observe(window,"unload",function(){GUnload();});return this;}else{alert("Google Maps not supported on this browser.");return false;}},addMarker:function(g,a,e,h,f,j){var i=new GLatLng(g,a);this.marker[e]=new GMarker(i,this.getIcon(e));this.marker[e]._contact=Base64.decode(f);this.marker[e]._title=Base64.decode(h);this.marker[e]._links=Base64.decode(j);var b=$("Matches");var c=Builder.node("a",{className:"marker"+e},this.marker[e]._title);Event.observe(c,"click",this.infoWindow.bind(this,e));var d=Builder.node("li",c);b.appendChild(d);GEvent.addListener(this.marker[e],"click",this.infoWindow.bind(this,e));this.map.addOverlay(this.marker[e]);this.bounds.extend(this.marker[e].getPoint());},centreAndZoom:function(){this.map.setZoom(this.map.getBoundsZoomLevel(this.bounds));this.map.setCenter(this.bounds.getCenter());this.map.savePosition();},getIcon:function(a){var b=new GIcon();b.image="/_asset/image/icon/marker/"+a+".png";b.shadow="/_asset/image/icon/marker/shadow.png";b.iconSize=new GSize(14,19);b.shadowSize=new GSize(30,20);b.iconAnchor=new GPoint(7,19);b.infoWindowAnchor=new GPoint(14,0);return b;},infoWindow:function(b){var a=this.marker[b];GEvent.addListener(a,"infowindowopen",function(){var c=new GMap(document.getElementById("map_mini"+b));var d=new GMarker(a.getLatLng(),this.getIcon("marker"));c.centerAndZoom(d.getLatLng(),1);c.addOverlay(d);}.bind(this));a.openInfoWindowHtml('<div class="details"><h3>'+a._title+"</h3>"+a._contact+a._links+'</div><div class="map_mini" id="map_mini'+b+'" style="width:125px; height:148px"></div>',{maxWidth:350});},infoWindowMap:function(){alert("open");},maximize:function(a){this.marker[a].maximize();},setCenter:function(a,b){this.map.setCenter(a,b);},fitAvailableHeight:function(){var a=$("Header").getHeight()+$("Footer").getHeight()+$("User").getHeight()+56;this.mapcontainer.setStyle("height: "+(document.viewport.getHeight()-a)+"px");$("SearchResult").setStyle("height: "+(document.viewport.getHeight()-a-30)+"px");}};
