google.load("maps", "2.x"); var localSearch = new GlocalSearch(); localSearch.setCenterPoint("New York, US"); var map, cl, d; var places = []; var GPSlat = 40.74569634433956; var GPSlng = -73.9848518371582; var zoom = 12; function initialize(){ if (GBrowserIsCompatible()) { /* initializing the API */ var initPoint = new GLatLng(GPSlat, GPSlng); map = new GMap2(document.getElementById("map")); cl = new ClusterMarker(map, {clusterMarkerTitle:'click to resolve %count placemarks'}); map.addMapType(G_NORMAL_MAP); map.addMapType(G_SATELLITE_MAP); map.addMapType(G_PHYSICAL_MAP); map.addControl(new GMapTypeControl()); map.addControl(new GLargeMapControl3D ()); map.addControl(new GOverviewMapControl()); map.enableScrollWheelZoom(); map.enableContinuousZoom(); //map.enableDoubleClickZoom(); setZoomLevels(); /* initializing the page's layout */ if($.wp!=0){getPage($.wp);$.loaded = true;} if($.iid!=0){ getSingle($.iid); $.loaded = true; /* add comments to the DOM */ $('div#main').append('
'); $.ds = "comments.php?mode=list&iid="+$.iid; $.ajax({ type:"GET", url:$.hostname+$.ds, dataType:"html", success: function(r){ $('div#c'+$.iid).html(r); $('div#submit_comment').unbind('click').bind('click', function(){ $.c_name = $('input#comment_name').val(); $.c_email = $('input#comment_email').val(); $.c_text = $('textarea#comment_text').val(); $.ds = "comments.php?mode=submit&iid="+$.iid+ '&name='+encodeURIComponent($.c_name)+ '&email='+encodeURIComponent($.c_email)+ '&comment='+encodeURIComponent($.c_text); $.ajax({ type:"GET", url:$.hostname+$.ds, dataType:"html", success: function(r){ $('div#new_comment').css({'height':'40px'}); $('div#new_comment').html(r); } }); }); } }); } if(!$.loaded){map.setCenter(initPoint,14,G_NORMAL_MAP);loadViewport();} /* syncing the actual viewport */ GEvent.addListener(map,"dragend",function(){localSearch.setCenterPoint(map);}); } } function createMarker(point, html, cat) { var icon = new GIcon(); icon.image = $.hostname+"images/markers/"+cat+".png"; icon.shadow = $.hostname+"images/markers/shadow.png"; icon.iconSize = new GSize(12, 20); icon.shadowSize = new GSize(22, 20); icon.iconAnchor = new GPoint(6, 20); icon.infoWindowAnchor = new GPoint(6, 1); icon.infoShadowAnchor = new GPoint(13, 13); var marker = new GMarker(point, {icon:icon}); GEvent.addListener(marker,"click",function(){marker.openInfoWindowHtml(html);}); return marker; } function getMarker(i){ map.setCenter(places[i].getLatLng()); cl.triggerClick(i); } function ZoomByBounds() { map.setCenter(markerBounds.getCenter()); map.setZoom(map.getBoundsZoomLevel(markerBounds)); } function setZoomLevels() { G_PHYSICAL_MAP.getMinimumResolution=function(){return 3}; G_NORMAL_MAP.getMinimumResolution=function(){return 3}; G_SATELLITE_MAP.getMinimumResolution=function(){return 3}; G_HYBRID_MAP.getMinimumResolution=function(){return 3}; G_PHYSICAL_MAP.getMaximumResolution=function(){return 15}; G_NORMAL_MAP.getMaximumResolution=function(){return 19}; G_SATELLITE_MAP.getMaximumResolution=function(){return 19}; G_HYBRID_MAP.getMaximumResolution=function(){return 19}; } function toggleClustering() { cl.clusteringEnabled=!cl.clusteringEnabled; cl.refresh(true); }