ADDITIONAL_INFO_MIN_ZOOM = 13; G_NORMAL_MAP.getTileLayers()[0].getOpacity = function () {return 0.6;}; G_SATELLITE_MAP.getTileLayers()[0].getOpacity = function () {return 0.7;}; G_HYBRID_MAP.getTileLayers()[0].getOpacity = function () {return 0.7;}; G_HYBRID_MAP.getTileLayers()[1].getOpacity = function () {return 0.6;}; G_PHYSICAL_MAP.getMinimumResolution = function () { return 4 }; G_NORMAL_MAP.getMinimumResolution = function () { return 4 }; G_SATELLITE_MAP.getMinimumResolution = function () { return 4 }; G_HYBRID_MAP.getMinimumResolution = function () { return 4 }; G_PHYSICAL_MAP.getMaximumResolution = function () { return 18 }; G_NORMAL_MAP.getMaximumResolution = function () { return 18 }; G_SATELLITE_MAP.getMaximumResolution = function () { return 18 }; G_HYBRID_MAP.getMaximumResolution = function () { return 18 }; var gmap; var geocoder; var mtIcons = []; var mtClusterIcons = []; function mtGetClusterIcon(count) { // get number of digits var digits = 0; var dv = count; while (dv !== 0) { dv = parseInt(dv / 10, 10); digits ++; } switch(digits) { case 1: if (!mtClusterIcons[0]) { var icon = new GIcon(); icon.image = "/img/marker/m1.png"; icon.iconSize = new GSize(53.0, 52.0); icon.iconAnchor = new GPoint(26.0, 26.0); icon.infoWindowAnchor = new GPoint(26.0, 26.0); mtClusterIcons[0] = icon; } return mtClusterIcons[0]; case 2: if (!mtClusterIcons[1]) { var icon = new GIcon(); icon.image = "/img/marker/m2.png"; icon.iconSize = new GSize(56.0, 55.0); icon.iconAnchor = new GPoint(28.0, 28.0); icon.infoWindowAnchor = new GPoint(28.0, 28.0); mtClusterIcons[1] = icon; } return mtClusterIcons[1]; default: if (!mtClusterIcons[2]) { var icon = new GIcon(); icon.image = "/img/marker/m3.png"; icon.iconSize = new GSize(66.0, 65.0); icon.iconAnchor = new GPoint(33.0, 33.0); icon.infoWindowAnchor = new GPoint(33.0, 33.0); mtClusterIcons[2] = icon; } return mtClusterIcons[2]; } } MAPICON_OWN_WAYPOINT = 0; MAPICON_FRIEND_WAYPOINT = 1; MAPICON_TIP = 2; MAPICON_WARNING = 3; MAPICON_QUESTION = 4; MAPICON_INFO = 5; MAPICON_PINNED_NOTE = 6; MAPICON_CROSSHAIR = 7; MAPICON_LONELY_PLANET = 8; function mtGetIcon(i) { if (!mtIcons[MAPICON_OWN_WAYPOINT]) { var icon = new GIcon(); icon.image = "/img/marker/blue-pushpin.png"; icon.shadow = "/img/marker/pushpin_shadow.png"; icon.iconSize = new GSize(32.0, 32.0); icon.shadowSize = new GSize(59.0, 32.0); icon.iconAnchor = new GPoint(10.0, 32.0); icon.infoWindowAnchor = new GPoint(6.0, 10.0); mtIcons[MAPICON_OWN_WAYPOINT] = icon; } if (!mtIcons[MAPICON_FRIEND_WAYPOINT]) { var icon = new GIcon(); icon.image = "/img/marker/red-pushpin.png"; icon.shadow = "/img/marker/pushpin_shadow.png"; icon.iconSize = new GSize(32.0, 32.0); icon.shadowSize = new GSize(59.0, 32.0); icon.iconAnchor = new GPoint(10.0, 32.0); icon.infoWindowAnchor = new GPoint(6.0, 10.0); mtIcons[MAPICON_FRIEND_WAYPOINT] = icon; } if (!mtIcons[MAPICON_TIP]) { var icon = new GIcon(); icon.image = "/img/marker/star.png"; icon.shadow = "/img/marker/star.shadow.png"; icon.iconSize = new GSize(32.0, 32.0); icon.shadowSize = new GSize(59.0, 32.0); icon.iconAnchor = new GPoint(16.0, 16.0); icon.infoWindowAnchor = new GPoint(16.0, 16.0); mtIcons[MAPICON_TIP] = icon; } if (!mtIcons[MAPICON_WARNING]) { var icon = new GIcon(); icon.image = "/img/marker/caution.png"; icon.shadow = "/img/marker/caution.shadow.png"; icon.iconSize = new GSize(32.0, 32.0); icon.shadowSize = new GSize(59.0, 32.0); icon.iconAnchor = new GPoint(16.0, 16.0); icon.infoWindowAnchor = new GPoint(16.0, 16.0); mtIcons[MAPICON_WARNING] = icon; } if (!mtIcons[MAPICON_QUESTION]) { var icon = new GIcon(); icon.image = "/img/marker/question.png"; icon.shadow = "/img/marker/question.shadow.png"; icon.iconSize = new GSize(32.0, 32.0); icon.shadowSize = new GSize(59.0, 32.0); icon.iconAnchor = new GPoint(16.0, 16.0); icon.infoWindowAnchor = new GPoint(16.0, 16.0); mtIcons[MAPICON_QUESTION] = icon; } if (!mtIcons[MAPICON_INFO]) { var icon = new GIcon(); icon.image = "/img/marker/info.png"; icon.shadow = "/img/marker/info.shadow.png"; icon.iconSize = new GSize(32.0, 32.0); icon.shadowSize = new GSize(59.0, 32.0); icon.iconAnchor = new GPoint(16.0, 16.0); icon.infoWindowAnchor = new GPoint(16.0, 16.0); mtIcons[MAPICON_INFO] = icon; } if (!mtIcons[MAPICON_PINNED_NOTE]) { var icon = new GIcon(); icon.image = "/img/marker/note_pinned.png"; icon.shadow = "/img/marker/note_pinned.shadow.png"; icon.iconSize = new GSize(32.0, 32.0); icon.shadowSize = new GSize(49.0, 32.0); icon.iconAnchor = new GPoint(16.0, 16.0); icon.infoWindowAnchor = new GPoint(16.0, 16.0); mtIcons[MAPICON_PINNED_NOTE] = icon; } if (!mtIcons[MAPICON_CROSSHAIR]) { var icon = new GIcon(); icon.image = "/img/marker/crosshair.png"; icon.iconSize = new GSize(41.0, 41.0); icon.iconAnchor = new GPoint(20.0, 20.0); icon.infoWindowAnchor = new GPoint(20.0, 20.0); mtIcons[MAPICON_CROSSHAIR] = icon; } if (!mtIcons[MAPICON_LONELY_PLANET]) { var icon = new GIcon(); icon.image = "/img/marker/lonely-planet-11.png"; icon.iconSize = new GSize(11.0, 11.0); icon.iconAnchor = new GPoint(5.0, 5.0); icon.infoWindowAnchor = new GPoint(11.0, 11.0); mtIcons[MAPICON_LONELY_PLANET] = icon; } return mtIcons[i]; } function showAddress(address, errorMessage) { geocoder.getLocations(address, function(response) { if (!response || response.Status.code != 200) { alert(errorMessage); } else { place = response.Placemark[0]; point = new GLatLng(place.Point.coordinates[1],place.Point.coordinates[0]); zoom = 5 + (2 * (place.AddressDetails.Accuracy-1)); if(zoom > 18) zoom=18; gmap.setCenter(point,zoom); document.getElementById("addr").value=""; } }); } function SearchControl() {}; SearchControl.prototype = new GControl(); SearchControl.prototype.initialize = function(gmap) { var sdiv = document.getElementById("searchdiv"); // Remove the whole div from its location and reinsert it to the map gmap.getContainer().appendChild(sdiv); sdiv.style.display = "block"; return sdiv; } SearchControl.prototype.getDefaultPosition = function() { return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(70, 7)); } function MarkerControl() {}; MarkerControl.prototype = new GControl(); MarkerControl.prototype.initialize = function(gmap) { var mdiv = document.getElementById("markerdiv"); // Remove the whole div from its location and reinsert it to the map gmap.getContainer().appendChild(mdiv); return mdiv; } MarkerControl.prototype.getDefaultPosition = function() { return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(70, 35)); } function InfoLayerControl() {}; InfoLayerControl.prototype = new GControl(); InfoLayerControl.prototype.initialize = function(gmap) { var ldiv = document.getElementById("layersdiv"); // Remove the whole div from its location and reinsert it to the map gmap.getContainer().appendChild(ldiv); return ldiv; } InfoLayerControl.prototype.getDefaultPosition = function() { return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(90, 7)); } var loading=false; function saveMapPosition(map) { if(loading) return; var mapzoom=map.getZoom(); var mapcenter=map.getCenter(); var maplat=mapcenter.lat(); var maplng=mapcenter.lng(); var maptype=0; if(G_NORMAL_MAP ==map.getCurrentMapType()) maptype=1; if(G_SATELLITE_MAP ==map.getCurrentMapType()) maptype=2; if(G_HYBRID_MAP ==map.getCurrentMapType()) maptype=3; if(G_PHYSICAL_MAP ==map.getCurrentMapType()) maptype=4; var cookiestring=maplat+"_"+maplng+"_"+mapzoom+"_"+maptype; var exp = new Date(); //set new date object exp.setTime(exp.getTime() + (1000 * 60 * 60 * 2 * 1)); //set it 2 hours ahead setCookie("lastMapViewport",cookiestring, exp); } function loadMapPosition(map) { var loadedstring=getCookie("lastMapViewport"); if(loadedstring=="") { return false; } else { loading = true; var splitstr = loadedstring.split("_"); if(splitstr.length >=4) { switch(parseInt(splitstr[3])) { case 1: map.setMapType(G_NORMAL_MAP); break; case 2: map.setMapType(G_SATELLITE_MAP); break; case 3: map.setMapType(G_HYBRID_MAP); break; case 4: map.setMapType(G_PHYSICAL_MAP); break; default: break; } } map.setCenter(new GLatLng(parseFloat(splitstr[0]), parseFloat(splitstr[1])), parseFloat(splitstr[2])); loading = false; return true; } } function setCookie(name, value, expires) { document.cookie = name + "=" + escape(value) + "; path=/" + ((expires == null) ? "" : "; expires=" + expires.toGMTString()); } function getCookie(c_name) { if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "="); if (c_start!=-1) { c_start=c_start + c_name.length+1; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); } } return ""; } $(function() { $('#mapTabs').find('li:not(.ui-tabs-selected)').hover(function(){$(this).addClass('ui-state-hover')},function(){$(this).removeClass('ui-state-hover')}); });