function mapp(a){if(a.pois){this.pois=a.pois}else{this.pois=new Array}this.editable=a.editable;this.size=a.size;this.width=parseInt(a.width);this.height=parseInt(a.height);this.zoom=parseInt(a.zoom);this.center=new GLatLng(parseFloat(a.centerLat),parseFloat(a.centerLng));this.addressFormat=a.addressFormat;this.defaultIcon=a.defaultIcon;this.mapname=a.mapname;this.mapDiv=document.getElementById(a.mapname);this.mapType=a.mapType;this.googlebar=a.googlebar;this.mapTypes=a.mapTypes;this.bigZoom=a.bigZoom;this.scrollWheelZoom=a.scrollWheelZoom;this.autoCenter=a.autoCenter;this.ui=new GMapUIOptions(new GSize(this.width,this.height));this.map;this.mapOptions={};var b=this;if(document.all&&window.attachEvent){window.attachEvent("onload",function(){b.display();b.init()});window.attachEvent("onunload",GUnload)}else{if(window.addEventListener){window.addEventListener("load",function(){b.display();b.init()},false);window.addEventListener("unload",GUnload,false)}}}mapp.prototype={display:function(){if(!GBrowserIsCompatible()||typeof(GMap2)=="undefined"){return}if(this.size&&this.size!="CUSTOM"){this.width=mapSizes[this.size].width;this.height=mapSizes[this.size].height}this.mapOptions.size=new GSize(this.width,this.height);this.map=new GMap2(this.mapDiv,this.mapOptions);this.map.setCenter(new GLatLng(0,0),0);this.ui.controls.maptypecontrol=false;if(this.mapTypes==true){this.ui.controls.menumaptypecontrol=true}else{this.ui.controls.menumaptypecontrol=false}if(this.bigZoom==true){this.ui.controls.largemapcontrol3d=true;this.ui.controls.smallzoomcontrol3d=false}else{this.ui.controls.largemapcontrol3d=false;this.ui.controls.smallzoomcontrol3d=true}if(this.scrollWheelZoom==true){this.ui.zoom.scrollwheel=true}else{this.ui.zoom.scrollwheel=false}this.map.setUI(this.ui);switch(this.mapType.toLowerCase()){case"map":this.map.setMapType(G_NORMAL_MAP);break;case"satellite":this.map.setMapType(G_SATELLITE_MAP);break;case"hybrid":this.map.setMapType(G_HYBRID_MAP);break;case"terrain":this.map.setMapType(G_PHYSICAL_MAP);break}len=this.pois.length;for(var a=0;a
'+this.pois[e].caption+'
'+a+"
";if(this.editable==true){var c=""+mappressl10n.edit+" | "+mappressl10n.del+"";d+='
'+c+"
"}if(this.directions==true){var f;switch(b){case"to":f=mappressl10n.directions+": "+mappressl10n.to_here+' - "+mappressl10n.from_here+'
';break;case"from":f=mappressl10n.directions+': "+mappressl10n.to_here+" - "+mappressl10n.from_here+'
';break;default:f='"+mappressl10n.directions+"";+'
';break}d+='
'+f+"
"}if(this.streetview==true){d+=''+mappressl10n.street_view+""}d+="";this.pois[e].marker.openInfoWindowHtml(d)},formatAddress:function(c){var a=this.pois[c].address;var b=this.pois[c].corrected_address;switch(this.addressFormat){case"ENTERED":return a;break;case"CORRECTED":if(b.lastIndexOf(", USA")>0){b=b.slice(0,b.lastIndexOf(", USA"))}var d=b.indexOf(",");if(d>0){return b.slice(0,d)+"
"+b.slice(d+2,b.length)}else{return b}break;default:return a;break}},reCenter:function(e,c){var b;var d;var f=new GLatLngBounds();this.map.closeInfoWindow();if(this.pois.length==1){e=0}if(e!=null){b=this.pois[e].marker.getLatLng();f.extend(b);if(this.pois[e].boundsbox!=undefined){var a=this.pois[e].boundsbox;if(a.north!=0&&a.south!=0&&a.west!=0&&a.east!=0){f=new GLatLngBounds(new GLatLng(a.south,a.west),new GLatLng(a.north,a.east))}}d=this.map.getBoundsZoomLevel(f)}else{for(j=0;j15){d=15}this.map.setZoom(d)}}};function mappEdit(a){mapp.call(this,a)}extendObject(mappEdit.prototype,mapp.prototype);extendObject(mappEdit.prototype,{init:function(){var a=this;GEvent.addListener(this.map,"moveend",function(){a.center=a.map.getCenter();jQuery("#mapp_center_lat").val(a.center.lat());jQuery("#mapp_center_lng").val(a.center.lng())});GEvent.addListener(this.map,"zoomend",function(){a.zoom=a.map.getZoom();jQuery("#mapp_zoom").val(a.zoom)});GEvent.addListener(this.map,"maptypechanged",function(){a.mapType=a.map.getCurrentMapType().getName();jQuery("#mapp_maptype").val(a.mapType)});this.automaticCenter();if(this.editable==true){this.listMarkers()}},addPOI:function(b){this.pois.push(b);var a=this.pois.length-1;this.pois[a].caption="";this.pois[a].body=this.formatAddress(a);this.addMarker(a);editMap.listMarkers();this.reCenter(a,true);this.renderMarker(a);return a},editMarker:function(b){var c=this.map.getSize().width*0.8;var a='
'+mappressl10n.title+':

";this.pois[b].marker.openInfoWindowHtml(a)},saveEditMarker:function(c){var b=jQuery("#markerCaption").val();var a=jQuery("#markerBody").val();this.pois[c].caption=b;this.pois[c].body=a;this.addMarkerEvents(c);this.renderMarker(c);this.listMarkers()},cancelEditMarker:function(a){this.renderMarker(a)},listMarkers:function(){var c,a;c=' \r\n';for(var b=0;b"}c+="
';if(this.pois[b].caption!=""){c+=this.pois[b].caption+": "+this.pois[b].corrected_address}else{c+=this.pois[b].corrected_address}c+="";if(!this.pois[b].boundsbox){this.pois[b].boundsbox={north:0,south:0,west:0,east:0}}c+='';c+='';c+='";c+='';c+='';c+='';c+='';c+='';c+='';c+='';c+="
";jQuery("#admin_poi_div").html(c)},escapeQuotes:function(a){return a.replace(/"/g,""");return a.replace(/'/g,"'")},deleteMarker:function(b){var a=confirm(mappressl10n.delete_this_marker);if(!a){return}this.map.closeInfoWindow();this.map.removeOverlay(this.pois[b].marker);this.pois.splice(b,1);this.listMarkers();for(var b=0;b1){var b=a.Placemark[0].address;d.innerHTML=mappressl10n.did_you_mean+""+b+"";e.className="mapp-address-error";return false}e.value=a.Placemark[0].address;d.innerHTML="";d.className="mapp-address";return true},addressAccept:function(b,a){if(b=="saddr"){this.saddr.value=a;this.saddrCorrected.innerHTML="";this.saddr.className="mapp-address"}else{this.daddr.value=a;this.daddrCorrected.innerHTML="";this.daddr.className="mapp-address"}this.directionsGet()},directionsPrint:function(){var c=document.getElementById(this.mapname+"_saddr");var b=document.getElementById(this.mapname+"_daddr");var a="http://maps.google.com";a+="?daddr="+b.value;a+="&saddr="+c.value;a+="&pw=2";window.open(a)},directionsClose:function(){if(this.GDirections){this.GDirections.clear()}this.directionsOuterDiv.style.display="none";for(var a=0;a