var DestinationMap={MAP_CANVAS_ID:"destinationSubRegionMap",map:null,startingpoint:"",data:{center:{lat:0,lng:0},minZoom:5,maxZoom:14,zoom:6,markers:[]},overlays:[],mapLoad:function(){if(GBrowserIsCompatible()){DestinationMap.localSearch=new GlocalSearch();DestinationMap.map=new GMap2(document.getElementById(this.MAP_CANVAS_ID));GEvent.addListener(DestinationMap.map,"load",DestinationMap.addLoadingReport);DestinationMap.map.addControl(new GMapTypeControl());DestinationMap.map.addControl(new GLargeMapControl());DestinationMap.map.addControl(new GScaleControl());G_PHYSICAL_MAP.getMinimumResolution=function(){return DestinationMap.data.minZoom;};G_NORMAL_MAP.getMinimumResolution=function(){return DestinationMap.data.minZoom;};G_SATELLITE_MAP.getMinimumResolution=function(){return DestinationMap.data.minZoom;};G_HYBRID_MAP.getMinimumResolution=function(){return DestinationMap.data.minZoom;};G_PHYSICAL_MAP.getMaximumResolution=function(){return DestinationMap.data.maxZoom;};G_NORMAL_MAP.getMaximumResolution=function(){return DestinationMap.data.maxZoom;};G_SATELLITE_MAP.getMaximumResolution=function(){return DestinationMap.data.maxZoom;};G_HYBRID_MAP.getMaximumResolution=function(){return DestinationMap.data.maxZoom;};DestinationMap.PlotPointOnMap();}GEvent.addListener(DestinationMap.map,"zoomend",DestinationMap.mapOnZoomEnd);GEvent.addListener(DestinationMap.map,"dragend",DestinationMap.mapOnDragEnd);},addLoadingReport:function(){var a="Loading Map...";var b=document.createElement("div");b.appendChild(document.createTextNode(a));b.setAttribute("id","mapLoading");b.style.position="relative";b.style.padding="2em";b.style.fontWeight="bold";b.style.fontSize="12px";b.style.color="#333";this.getContainer().insertBefore(b,this.getContainer().firstChild);},mapOnZoomEnd:function(b,a){DestinationMap.zoom=a;DestinationMap.drawOverlays();},mapOnDragEnd:function(){DestinationMap.drawOverlays();},PlotPointOnMap:function(){DestinationMap.startingpoint=new GLatLng(DestinationMap.data.center.lat,DestinationMap.data.center.lng);DestinationMap.map.setCenter(DestinationMap.startingpoint,parseInt(DestinationMap.data.zoom));DestinationMap.CallSuccess();},CallSuccess:function(){for(var a=0;a<DestinationMap.data.markers.length;a++){DestinationMap.data.markers[a].marker=DestinationMap.createMarker(parseFloat(DestinationMap.data.markers[a].lat),parseFloat(DestinationMap.data.markers[a].lng),a+1);var b=DestinationMap.createMarkerClickHandler(DestinationMap.data.markers[a]);GEvent.addListener(DestinationMap.data.markers[a].marker,"click",b);DestinationMap.data.markers[a].clickHandler=b;}DestinationMap.drawOverlays();},drawOverlays:function(){try{for(var e=0;e<DestinationMap.overlays.length;e++){DestinationMap.overlays[e].overlayOn=false;DestinationMap.map.removeOverlay(DestinationMap.overlays[e]);}DestinationMap.overlays=[];var h=0;var a=0;var d=DestinationMap.map.getBounds();var b=d.getSouthWest();var c=d.getNorthEast();var i=DestinationMap.map.getZoom();var g={};for(var e=0;e<DestinationMap.data.markers.length;e++){g=DestinationMap.data.markers[e];if(g.lng>b.lng()&&g.lng<c.lng()&&g.lat>b.lat()&&g.lat<c.lat()){DestinationMap.drawSingleOverlay(g);}}}catch(f){}},drawSingleOverlay:function(a){DestinationMap.map.addOverlay(a.marker);a.marker.overlayOn=true;DestinationMap.overlays.push(a.marker);},createMarker:function(d,c,b){var a=new GLatLng(d,c);return new GMarker(a,DestinationMap.GetIcon(b));},createMarkerClickHandler:function(a){return function(){if(!a.marker.overlayOn){DestinationMap.map.addOverlay(site.marker);a.marker.overlayOn=true;DestinationMap.map.setCenter(site.marker.getLatLng(),DestinationMap.viewOnMapZoom);}a.marker.openInfoWindowHtml('<table id="balloon" >          <tr>            <td>              <h1>'+a.name+'</h1>              <br/>              <a href="'+a.moreInfoURL+'">More info &gt;&gt;</a><br />              <a href="'+a.viewVillasURL+'">View villas &gt;&gt;</a>            </td>            <td>              <img src="'+a.imageURL+'">            </td>          </tr>        </table>');return false;};},GetIcon:function(a){var b=new GIcon();b.image="../../Images/EUVilla/GoogleMapIcons/Region"+a+".png";b.iconAnchor=new GPoint(10,34);b.infoWindowAnchor=new GPoint(17,0);b.iconSize=new GSize(20,34);return b;}};
