var map,addMapTypeControl=true,showStreetViewOption=false,showStreetViewByDefault=false,controlDiv,streetmapDiv,satteliteDiv,hybridDiv,lastEnabledDiv,latitude="",longitude="",resultList={},zoomLevel=14;function LoadMap(b,f,g){var c=parseFloat(f.toString().replace(",",".")),d=parseFloat(g.toString().replace(",","."));if(c!=0&&d!=0){var a=new google.maps.LatLng(c,d),e={zoom:zoomLevel,center:a,mapTypeId:google.maps.MapTypeId.ROADMAP,mapTypeControl:false};map=new google.maps.Map(document.getElementById(b),e);if(showStreetViewByDefault)showStreetViewOption=true;if(addMapTypeControl){controlDiv=document.createElement("DIV");var h=new MapTypePlusControl(controlDiv)}AddMarker(map,a)}else{document.getElementById(b).style.display="none";document.getElementById("map_icons").style.display="none"}}function loadGoogleMap(a,b){LoadMap("map",a,b)}function AddMarker(c,a){var b=new google.maps.Marker({position:a});b.setMap(c)}function MapTypePlusControl(c){c.style.padding="5px";var a=document.createElement("DIV");a.style.marginRight="10px";a.style.marginTop="3px";a.style.backgroundColor="white";a.style.borderStyle="solid";a.style.borderWidth="1px";a.style.cursor="pointer";a.style.textAlign="center";a.style.fontFamily="Arial,sans-serif";a.style.fontSize="12px";c.appendChild(a);streetmapDiv=document.createElement("DIV");streetmapDiv.style.paddingLeft="6px";streetmapDiv.style.paddingRight="6px";streetmapDiv.style.display="inline";streetmapDiv.style.borderRightStyle="solid";streetmapDiv.style.borderRightWidth="1px";streetmapDiv.innerHTML="Map";streetmapDiv.title="View street map";a.appendChild(streetmapDiv);if(showStreetViewOption){var b=document.createElement("DIV");b.style.paddingLeft="6px";b.style.paddingRight="6px";b.style.display="inline";b.style.borderRightStyle="solid";b.style.borderRightWidth="1px";b.innerHTML="Street";b.title="View streetview";a.appendChild(b)}satteliteDiv=document.createElement("DIV");satteliteDiv.style.paddingLeft="6px";satteliteDiv.style.paddingRight="6px";satteliteDiv.style.display="inline";satteliteDiv.style.borderRightStyle="solid";satteliteDiv.style.borderRightWidth="1px";satteliteDiv.innerHTML="Satellite";satteliteDiv.title="View satellite map";a.appendChild(satteliteDiv);hybridDiv=document.createElement("DIV");hybridDiv.style.paddingLeft="6px";hybridDiv.style.paddingRight="6px";hybridDiv.style.display="inline";hybridDiv.innerHTML="Hybrid";hybridDiv.title="View hybrid map (satellite + streets)";a.appendChild(hybridDiv);lastEnabledDiv=streetmapDiv;google.maps.event.addDomListener(streetmapDiv,"click",function(){ChangeMapType(map,c,streetmapDiv,14,google.maps.MapTypeId.ROADMAP)});showStreetViewOption&&google.maps.event.addDomListener(b,"click",function(){ShowStreetView(map,c,b)});google.maps.event.addDomListener(satteliteDiv,"click",function(){ChangeMapType(map,c,satteliteDiv,18,google.maps.MapTypeId.SATELLITE)});google.maps.event.addDomListener(hybridDiv,"click",function(){ChangeMapType(map,c,hybridDiv,18,google.maps.MapTypeId.HYBRID)});if(showStreetViewByDefault)ShowStreetView(map,c,b);else ChangeMapType(map,c,streetmapDiv,14,google.maps.MapTypeId.ROADMAP)}var loadSatelliteView=function(){ChangeMapType(map,controlDiv,satteliteDiv,18,google.maps.MapTypeId.SATELLITE)},loadHybridView=function(){ChangeMapType(map,controlDiv,hybridDiv,18,google.maps.MapTypeId.HYBRID)},loadStreetView=function(){ChangeMapType(map,controlDiv,streetmapDiv,14,google.maps.MapTypeId.ROADMAP)};function ChangeMapType(a,c,b,e,d){lastEnabledDiv.style.fontWeight="normal";b.style.fontWeight="bold";lastEnabledDiv=b;a.getStreetView().setVisible(false);a.controls[google.maps.ControlPosition.TOP_RIGHT].getLength()>0&&a.controls[google.maps.ControlPosition.TOP_RIGHT].pop();a.controls[google.maps.ControlPosition.TOP_RIGHT].push(c);a.setZoom(e);a.setMapTypeId(d);if(document.getElementById("map_icons")!="undefined")document.getElementById("map_icons").style.display=""}function ShowStreetView(b,d,c){lastEnabledDiv.style.fontWeight="normal";c.style.fontWeight="bold";lastEnabledDiv=c;var a=new google.maps.StreetViewPanorama(b.getDiv(),{position:b.getCenter()});b.setStreetView(a);a.controls[google.maps.ControlPosition.TOP_RIGHT].getLength()>0&&a.controls[google.maps.ControlPosition.TOP_RIGHT].pop();a.controls[google.maps.ControlPosition.TOP_RIGHT].push(d);var e=new google.maps.StreetViewService;e.getPanoramaByLocation(b.getCenter(),50,processSVData);if(document.getElementById("map_icons")!="undefined")document.getElementById("map_icons").style.display="none"}function processSVData(c,b){if(b!=google.maps.StreetViewStatus.OK){var a=!showStreetViewByDefault;if(showStreetViewByDefault)showStreetViewByDefault=false;ChangeMapType(map,controlDiv,streetmapDiv,14,google.maps.MapTypeId.ROADMAP);a&&alert("Sorry, Street View is not available for this location.")}}function SetLocalSearch(a,b){latitude=a;longitude=b}function doLocalSearch(b,d){if(resultList[b]==null){var a=new GlocalSearch;a.setCenterPoint(new google.maps.LatLng(latitude,longitude));a.setAddressLookupMode(GlocalSearch.ADDRESS_LOOKUP_DISABLED);a.setSearchCompleteCallback(this,show_results,[a,b,d]);a.setResultSetSize(GSearch.LARGE_RESULTSET);a.execute(b)}else{for(var c=0;c<resultList[b].length;c++)resultList[b][c].setMap(null);resultList[b]=null}}function show_results(b,c,e){resultList[c]=[];for(var a=0;a<b.results.length;a++){var d=makeQueryMarker(new google.maps.LatLng(b.results[a].lat,b.results[a].lng),e,b.results[a].html.innerHTML);resultList[c][resultList[c].length]=d;d.setMap(map)}}var shadow=new google.maps.MarkerImage("http://www.google.com/mapfiles/shadow50.png",new google.maps.Size(37,34),null,new google.maps.Point(9,34));function makeQueryMarker(e,d,c){var f=new google.maps.MarkerImage(d,null,null,new google.maps.Point(9,34),new google.maps.Size(20,34)),a=new google.maps.Marker({position:e,shadow:shadow,icon:f}),b=new google.maps.InfoWindow({content:c});google.maps.event.addListener(a,"click",function(){b.open(map,a)});return a}
