var geocoder;function centerGMap(o){if(!window.curGMap)return;if(!$(o))return;var cp=$(o).val();$.getJSON("/ajax/ajax.getcoordscityoncp.php",{id:cp},function(j){window.curGMap.setCenter(new GLatLng(j.rlat,j.rlon),13);});}
function getGBaseIcon(){var baseIcon=new GIcon();baseIcon.shadow=PATH_TO_STATIC+"/images/g_icon_shad.png";baseIcon.iconSize=new GSize(41,36);baseIcon.shadowSize=new GSize(41,36);baseIcon.iconAnchor=new GPoint(21,41);baseIcon.infoWindowAnchor=new GPoint(9,2);baseIcon.infoShadowAnchor=new GPoint(18,25);return baseIcon;}
function loadMap(lat,lon,bloc){if(!GBrowserIsCompatible())return;var bounds=new GLatLngBounds();geocoder=new GClientGeocoder();this.map=new GMap2($("#"+bloc).get(0));window.curGMap=this.map;this.map.addControl(new GSmallMapControl());this.map.addControl(new GMapTypeControl());this.map.setCenter(new GLatLng(lat,lon),17);var baseIcon=getGBaseIcon();this.icOn=new GIcon(baseIcon);this.icOn.image=PATH_TO_STATIC+"/images/g_icon_on.png";this.icOff=new GIcon(baseIcon);this.icOff.image=PATH_TO_STATIC+"/images/g_icon_off.png";this.prOn={icon:this.icOn};this.prOff={icon:this.icOff};}
function loadShopMap(lat,lon,withoutProx){var myMap=new loadMap(lat,lon,"map");var bounds=new GLatLngBounds();var map=myMap.map;if(lat!=0&&lon!=0){var mainPoint=new GLatLng(lat,lon);bounds.extend(mainPoint);var zoom=(withoutProx?12:14);map.setCenter(mainPoint,zoom);marker=new GMarker(mainPoint,myMap.prOn);if(!withoutProx){$("#proxiShops").find('li').each(function(i,n){var infos=$(n).attr("id").split("_");var id=infos[0];var dotLat=infos[1];var dotLon=infos[2];var point=new GLatLng(dotLat,dotLon);bounds.extend(point);var zePoint=new GMarker(point,myMap.prOff);map.addOverlay(zePoint);$(n).hover(function(){zePoint.setImage(PATH_TO_STATIC+'/images/g_icon_on.png');},function(){zePoint.setImage(PATH_TO_STATIC+'/images/g_icon_off.png');});GEvent.clearListeners(zePoint);GEvent.addListener(zePoint,"mouseover",function(){this.setImage(PATH_TO_STATIC+'/images/g_icon_on.png');$(n).addClass("active");});GEvent.addListener(zePoint,"mouseout",function(){this.setImage(PATH_TO_STATIC+'/images/g_icon_off.png');$(n).removeClass("active");});});}
map.addOverlay(marker);if(!withoutProx)
map.setZoom(map.getBoundsZoomLevel(bounds)-1);}else{$("#map").html('<img src="'+PATH_TO_STATIC+'/images/map.jpg" alt="Impossible de localiser le commerce"/>');}}