
(function($){$.fn.extend({nmap:function(settings){var version="1.0";var settings=jQuery.extend({initialized:0,provider:"google",width:"100%",height:400,mapType:"map",mapView:1,currentMapType:"map",currentMapView:1,lat:48.85861640881589,lon:2.3466110229492188,zoom:12,currentZoom:0,polygonZoom:0,maxZoom:17,minZoom:1,box:"",radius:8,anchor:false,layers:new Array(),argsList:new Array(),markers:new Array(),customTags:new Array(),getURLparams:true,defaultPins:false,smallPins:false,simpleControls:false,controlSize:"small",showPanControls:true,onPanClick:"",showMapViewControls:true,showZoomControls:true,showFullScreen:false,showStreetView:false,fullMapTitle:"Nomao",typeMenu:false,showOverview:0,showScale:false,showReturnToStart:false,dragging:true,scrollZoom:false,doubleClickZoom:true,smoothZoom:true,onMapClick:"",onViewClick:"",onDragEnd:"",onZoomEnd:"",searchField:"#Address",searchButton:"#findaddress",directionsTo:"#to",directionsFrom:"#from",directionsFind:"#getDirections",directionsPanel:"myDirections"},settings);return this.each(function(){var html="";var idNmap=this.id;settings=jQuery.extend({id:idNmap},settings);this.mapSettings=settings;$("#preload").empty().append('<div class="mk_highlight"></div><div class="mk_bubble">');html='<div id="'+settings.id+'_over" class="map_over">';$(this).before(html).removeClass("map_init").addClass("map");$("#"+settings.id+"_over").css({width:settings.width,height:settings.height,position:"relative"}).append($(this));var cssHide="";if(settings.simpleControls){cssHide="map_over_controls_hide";}
html='<div id="'+settings.id+'_over_controls" class="map_over_controls '+cssHide+'">';html+='  <div id="'+settings.id+'_map_controls" class="map_controls"></div>';html+='</div>';$("#"+settings.id+"_over").before(html);if(settings.getURLparams){if(document.location.toString().match(new RegExp("#"))&&!document.location.toString().match(new RegExp("#[0-9]+"))){settings.anchor=true;var customSettings=1;var customUrl=document.location.toString();var CoordRegExp=new RegExp("c=([\-0-9.\s]+),([\-0-9.-\s]+)");var customCoord=CoordRegExp.exec(customUrl);var ZoomRegExp=new RegExp("z=([0-9]+)+");var customZoom=ZoomRegExp.exec(customUrl);var ViewRegExp=new RegExp("t=([0-9]+)");var customView=ViewRegExp.exec(customUrl);var TagsRegExp=new RegExp("tags=([0-9,]+)");var customTags=TagsRegExp.exec(customUrl);if(customTags!=null&&customTags[1]!=""&&typeof(customTags[1])!="undefined"){var arrayTmp=customTags[1].split(',');for(var i in arrayTmp){if(typeof(arrayTmp[i])=='string'){settings.customTags[arrayTmp[i]]='undefined';}}}
if(customCoord){settings.lat=$.trim(customCoord[1]);settings.lon=$.trim(customCoord[2]);}
if(customView){settings.mapView=settings.currentMapView=parseInt($.trim(customView[1]));settings.mapType=settings.currentMapType=translateMapType(settings,settings.mapView,"toString");}
if(customZoom)settings.zoom=settings.currentZoom=parseInt($.trim(customZoom[1]));customCoord={"lat":settings.lat,"lon":settings.lon};customZoom=settings.zoom;customView=settings.mapView;}}
var loadmap=translateMapType(settings,settings.mapType,"toAPI");switch(settings.provider){case"yahoo":var nmap=this.nMap=new YMap(this);if(customSettings){if(typeof(customCoord["lat"])!="undefined"&&typeof(customCoord["lon"])!="undefined"&&typeof(customZoom)!="undefined")nmap.setCenter(new YGeoPoint(customCoord["lat"],customCoord["lon"]),customZoom);if(typeof(customView)!="undefined")nmap.setMapType(eval(translateMapType(settings,customView,"toAPI")));}else{nmap.setMapType(eval(loadmap));nmap.drawZoomAndCenter(new YGeoPoint(settings.lat,settings.lon),settings.zoom);}
var bounds=this.Bounds=nmap.getBounds();if(settings.showMapViewControls==true){if(settings.simpleControls){nmap.addTypeControl();}}
if(settings.showZoomControls==true){if(settings.simpleControls){if(settings.controlSize=="small"){nmap.addZoomShort();}else if(settings.controlSize=="large"){nmap.addZoomLong();}}}
if(settings.showPanControls==true){nmap.addPanControl();}
if(settings.showScale==false){nmap.removeZoomScale();}
if(settings.dragging==false){nmap.disableDragMap();}
if(settings.scrollZoom==false){nmap.disableKeyControls();}
YEvent.Capture(nmap,EventsList.changeZoom,function(e){$("#"+settings.id).setZoom(nmap.getZoomLevel());if(settings.initialized){eval(settings.onZoomEnd);}});YEvent.Capture(nmap,EventsList.endMapDraw,function(e){if(settings.initialized){eval(settings.onDragEnd);}});YEvent.Capture(nmap,EventsList.MouseClick,function(e){if(settings.initialized){eval(settings.onMapClick);}});break;case"microsoft":var nmap=this.nMap=new VEMap(settings.id);$(this).css({position:"relative"});if(customSettings){nmap.LoadMap();if(typeof(customCoord["lat"])!="undefined"&&typeof(customCoord["lon"])!="undefined"&&typeof(customZoom)!="undefined"){nmap.SetCenter(new VELatLong(customCoord["lat"],customCoord["lon"]));nmap.SetZoomLevel(customZoom);}
if(typeof(customView)!="undefined")nmap.SetMapStyle(translateMapType(settings,customView,"toAPI"));}else{nmap.LoadMap(new VELatLong(settings.lat,settings.lon),settings.zoom,loadmap,false);}
var bounds=this.Bounds;if(settings.showPanControls==true){if(settings.simpleControls){nmap.SetDashboardSize(VEDashboardSize.Normal);}else{}}
if(settings.showMapViewControls==false){if(settings.simpleControls){nmap.SetDashboardSize(VEDashboardSize.Tiny);}}
if(settings.showZoomControls==true){if(settings.simpleControls){nmap.SetDashboardSize(VEDashboardSize.Small);}}
if(settings.showOverview){nmap.ShowMiniMap(parseInt($(this).width()-150),parseInt($(this).height()-150));}
if(!settings.simpleControls){nmap.HideDashboard();}
nmap.AttachEvent("onendzoom",function(){$("#"+settings.id).setZoom(nmap.GetZoomLevel());if(settings.initialized){eval(settings.onZoomEnd);}});nmap.AttachEvent("onendpan",function(){if(settings.initialized){eval(settings.onDragEnd);}});nmap.AttachEvent("onclick",function(){if(settings.initialized){eval(settings.onMapClick);}});nmap.AttachEvent("onmouseover",function(e){if(e.elementID)$("#"+settings.id).highlightMarker(e.elementID);});nmap.AttachEvent("onmouseout",function(e){$("#"+settings.id).removeHighlight();});break;default:var nmap=this.nMap=new GMap2(this);if(customSettings){if(typeof(customCoord["lat"])!="undefined"&&typeof(customCoord["lon"])!="undefined"&&typeof(customZoom)!="undefined")nmap.setCenter(new GLatLng(customCoord["lat"],customCoord["lon"]),customZoom);if(typeof(customView)!="undefined")nmap.setMapType(eval(translateMapType(settings,customView,"toAPI")));}else{nmap.setCenter(new GLatLng(settings.lat,settings.lon),settings.zoom,eval(loadmap));}
var bounds=this.Bounds=nmap.getBounds();switch(settings.controlSize){case"small":this.mapControl=new GSmallMapControl();break;case"large":this.mapControl=new GLargeMapControl();break;case"none":this.mapControl=null;break;default:this.mapControl=new GSmallMapControl();}
this.nMapControl=new NmMapControl(settings.onPanClick);if(settings.showPanControls==true){if(settings.simpleControls){nmap.addControl(this.mapControl);}else{nmap.addControl(this.nMapControl);}}
this.mapTypeControl=new GMapTypeControl();nmap.addMapType(G_PHYSICAL_MAP);if(settings.showMapViewControls==true){if(settings.simpleControls){nmap.addControl(this.mapTypeControl);}}
this.smallZoomControl=new GSmallZoomControl();if(settings.showZoomControls==true){if(settings.simpleControls){nmap.addControl(this.smallZoomControl);}}
if(settings.showOverview){this.overControl=new GOverviewMapControl();nmap.addControl(this.overControl);if(settings.showOverview==2){this.overControl.hide();}}
if(settings.doubleClickZoom==true){nmap.enableDoubleClickZoom();}
if(settings.scrollZoom==true){nmap.enableScrollWheelZoom();}
if(settings.smoothZoom==true){nmap.enableContinuousZoom();}
if(settings.dragging==false){nmap.disableDragging();}
GEvent.addListener(nmap,"zoomend",function(){$("#"+settings.id).setZoom(nmap.getZoom());if(settings.initialized){eval(settings.onZoomEnd);}});GEvent.addListener(nmap,"dragend",function(){if(settings.initialized){eval(settings.onDragEnd);}});GEvent.addListener(nmap,"click",function(aMarker,point){if(settings.initialized){eval(settings.onMapClick);}});GLatLng.fromText=function(text){var result=[];if(text.match(/^\s*\(\s*\(\s*(?:0|[1-9\-][0-9]*)(?:\.[0-9]+)?\s*,\s*(?:0|[1-9\-][0-9]*)(?:\.[0-9]+)?\s*\)\s*(?:,\s*\(\s*(?:0|[1-9\-][0-9]*)(?:\.[0-9]+)?\s*,\s*(?:0|[1-9\-][0-9]*)(?:\.[0-9]+)?\s*\)\s*)*\)\s*$/)){result=text.replace(/^\s*(?:\(\s*){2}(.*)(?:\s*\)){2}\s*$/,'$1').split(/\s*\)\s*,\s*\(\s*/);for(var index=result.length-1;index>=0;index=index-1){var plot=result[index].split(/\s*,\s*/);result[index]=new GLatLng(plot[1],plot[0]);}
if(result.length>2&&!(result[0].lat()==result[result.length-1].lat()&&result[0].lng()==result[result.length-1].lng()))
result[result.length]=result[0];}
return result};GLatLng.listToString=function(list){var result="(";var virgule="";for(var index=0;index<list.length;index++){var latlng=list[index];result+=virgule+"("+latlng.lng()+","+latlng.lat()+")";virgule=",";}
return result.replace(/\s+/g,'')+")";};GPolygon.prototype.getVertices=function(){var result=[];for(var index=0;index<this.getVertexCount();index++){result[index]=this.getVertex(index);}
return result;};}
if(settings.showReturnToStart==true){html='<div id="'+settings.id+'_pan_center" class="panCenter"></div>';$("#"+settings.id+"_map_controls").append(html);$("#"+settings.id+"_pan_center").hover(function(){$(this).addClass("panCenterover");},function(){$(this).removeClass("panCenterover");}).click(function(){$("#"+settings.id).setCenter(settings.lat,settings.lon,settings.zoom);urlUpdate(nmap,settings);});}
if(settings.showFullScreen==true){html='<div id="'+settings.id+'_full_screen" class="fullScreen"></div>';$("#"+settings.id+"_map_controls").append(html);$("#"+settings.id+"_full_screen").hover(function(){$(this).addClass("fullScreenover");},function(){$(this).removeClass("fullScreenover");}).click(function(){$("#"+settings.id).showFullScreenMap();});}
if(settings.showZoomControls==true){if(!settings.simpleControls){html='<div id="'+settings.id+'_map_zoombar" class="zoombar">';html+='<div id="'+settings.id+'_map_zoomout" class="zoomout"></div>';html+='<div id="'+settings.id+'_map_slider" class="slider loading"><div id="'+settings.id+'_map_marker" class="zoomMarker"></div></div>';html+='<div id="'+settings.id+'_map_zoomin" class="zoomin"></div>';html+='</div>';$("#"+settings.id+"_map_controls").append(html);$("#"+settings.id+"_map_slider").slider({axis:"horizontal",minValue:0,maxValue:128,stepping:8,handle:$('#'+settings.id+'_map_marker'),zIndex:1000,opacity:0.7,stop:function(){var new_zoom=parseInt(Math.ceil($('#'+settings.id+'_map_marker').css("left").replace("px","").replace('pt','')/settings.radius))+1;$('#'+settings.id+'_map_marker').css("left",((new_zoom-1)*settings.radius)+'px');$("#"+settings.id).setZoom(new_zoom);}});$("#"+settings.id+"_map_marker").hover(function(){$(this).addClass("zoomMarkerover");},function(){$(this).removeClass("zoomMarkerover");});$("#"+settings.id+"_map_zoomout").hover(function(){$(this).addClass("zoomoutover");},function(){$(this).removeClass("zoomoutover");}).click(function(){if(settings.currentZoom>settings.minZoom){$("#"+settings.id).setZoom(settings.currentZoom-1);return false;}});$("#"+settings.id+"_map_zoomin").hover(function(){$(this).addClass("zoominover");},function(){$(this).removeClass("zoominover");}).click(function(){if(settings.currentZoom<settings.maxZoom){$("#"+settings.id).setZoom(settings.currentZoom+1);return false;}});}}
if(settings.showMapViewControls==true){if(!settings.simpleControls){html='<div id="'+settings.id+'_map_choice" class="map_choice">';if(settings.typeMenu){html+='<strong class="font14">'+T_LABEL_MAP_MENU+'</strong>';}
html+='<ul>';html+='<li class="map_type map_type_border" id="'+settings.id+'_nmap_map">'+T_LABEL_MAP_NORMAL+'</li>';html+='<li class="map_type map_type_border" id="'+settings.id+'_nmap_sat">'+T_LABEL_MAP_SAT+'</li>';html+='<li class="map_type map_type_border" id="'+settings.id+'_nmap_hybrid">'+T_LABEL_MAP_HYBRID+'</li>';if(settings.provider=="google"){html+='<li class="map_type" id="'+settings.id+'_nmap_relief">'+T_LABEL_MAP_RELIEF+'</li>';if(settings.showStreetView==true){html+='<li class="map_type streetViewButton" id="'+settings.id+'_nmap_streetView">Street View</li>';var obj='<div id="'+settings.id+'_streetView" style="width: 100%; height: 100%;" class="none"></div>';$("#"+settings.id).before(obj);this.streetControl=new GStreetviewPanorama(document.getElementById(settings.id+"_streetView"));}}
html+='</ul>';html+='</div>';$("#"+settings.id+"_map_controls").append(html);if(settings.typeMenu){$('#'+settings.id+'_map_choice').removeClass('map_choice').addClass('map_choice_vertical').hover(function(){$(this).css({height:'120px'});},function(){$(this).css({height:'25px'});}).find('li').removeClass("map_type_border");}
$("#"+settings.id+"_map_choice .map_type").click(function(){if($(this).hasClass("streetViewButton")){var center=$("#"+settings.id).getCenter();$("#"+settings.id).streetViewControl().setLocationAndPOV(new GLatLng(center["lat"],center["lon"]),{yaw:180,pitch:0,zoom:0});$("#"+settings.id+"_streetView").show();$("#"+settings.id).hide();}else{$("#"+settings.id+"_streetView").hide();$("#"+settings.id).show();$("#"+settings.id+"_map_choice .map_type_highlight").removeClass("map_type_highlight");$(this).addClass("map_type_highlight");settings.mapType=$(this).attr("id").replace(settings.id+"_nmap_","");$("#"+settings.id+"_map_choice .map_type").each(function(i){if($(this).attr("id").replace(settings.id+"_nmap_","")==settings.mapType){$("#"+settings.id).setMapView(i+1);return false;}});eval(settings.onViewClick);}});}}
$(settings.searchButton).bind("click",function(){$("#"+settings.id).searchAddress($(settings.searchField).val());return false;});$(settings.directionsFind).bind("click",function(){var from=$(settings.directionsFrom).val();var to=$(settings.directionsTo).val();$("#"+settings.id).searchDirections("from: "+from+" to: "+to);$(settings.directionsFrom).val(to);$(settings.directionsTo).val('');return false;});$(document).unload(function(){GUnload();});$("#"+settings.id).setZoom(settings.zoom);$("#"+settings.id).setMapView(settings.mapView);settings.initialized=1;});},myMap:function(){return this[0].nMap;},mapConf:function(){return this[0].mapSettings;},smallZoomControl:function(){return this[0].smallZoomControl;},enableZoomControl:function(mode){var nmap=this[0].nMap;var settings=this[0].mapSettings;switch(settings.provider){case"yahoo":if(mode)nmap.addZoomControl();else nmap.removeZoomControl();break;case"microsoft":if(mode)nmap.ShowDashboard();else nmap.HideDashboard();break;default:if(mode)nmap.addControl(this.smallZoomControl());else nmap.removeControl(this.smallZoomControl());break;}
return this;},mapControl:function(){return this[0].mapControl;},currentPolygons:function(){return this[0].currentPolygons;},enableMapControl:function(mode){var nmap=this[0].nMap;var settings=this[0].mapSettings;switch(settings.provider){case"yahoo":break;case"microsoft":if(mode)nmap.ShowDashboard();else nmap.HideDashboard();break;default:if(mode)nmap.addControl(this.mapControl());else nmap.removeControl(this.mapControl());break;}
return this;},mapTypeControl:function(){return this[0].mapTypeControl;},enableMapTypewControl:function(mode){var nmap=this[0].nMap;var settings=this[0].mapSettings;switch(settings.provider){case"yahoo":break;case"microsoft":if(mode)nmap.ShowDashboard();else nmap.HideDashboard();break;default:if(mode)nmap.addControl(this.mapTypeControl());else nmap.removeControl(this.mapTypeControl());break;}
return this;},overviewControl:function(){return this[0].overControl;},streetViewControl:function(){return this[0].streetControl;},enableOverviewControl:function(mode){var nmap=this[0].nMap;var settings=this[0].mapSettings;switch(settings.provider){case"yahoo":break;case"microsoft":if(mode)nmap.ShowMiniMap();else nmap.HideMiniMap();break;default:if(mode)nmap.addControl(this.overviewControl());else nmap.removeControl(this.overviewControl());break;}
return this;},panControl:function(){return this[0].nMapControl;},enablePanControl:function(mode){var nmap=this[0].nMap;var settings=this[0].mapSettings;switch(settings.provider){case"yahoo":if(mode)nmap.addPanControl();else nmap.removePanControl();break;case"microsoft":if(mode)nmap.ShowDashboard();else nmap.HideDashboard();break;default:if(mode)nmap.addControl(this.panControl());else nmap.removeControl(this.panControl());break;}
return this;},setMapView:function(mapView){var nmap=this[0].nMap;var settings=this[0].mapSettings;var nmapType=translateMapType(settings,mapView,"toAPI");switch(settings.provider){case"yahoo":if(mapView&&settings.currentMapView!=mapView)nmap.setMapType(eval(nmapType));break;case"microsoft":if(mapView&&settings.currentMapView!=mapView)nmap.SetMapStyle(nmapType);break;default:if(mapView&&settings.currentMapView!=mapView)nmap.setMapType(eval(nmapType));break;}
if(mapView&&settings.currentMapView!=mapView){settings.currentMapView=mapView;settings.currentMapType=translateMapType(settings,mapView,"toString");}
if($("#"+settings.id+"_map_choice").length){$("#"+settings.id+"_map_choice #"+settings.id+"_nmap_"+settings.currentMapType).addClass("map_type_highlight");}
return this;},getMapView:function(){var nmap=this[0].nMap;var settings=this[0].mapSettings;var type;switch(settings.provider){case"yahoo":type=nmap.getCurrentMapType().getName();break;case"microsoft":type=nmap.GetMapStyle();break;default:type=nmap.getCurrentMapType().getName();break;}
type=translateMapType(settings,type);return type;},setZoom:function(zoom){var nmap=this[0].nMap;var settings=this[0].mapSettings;var mapZoom=this.getZoom();zoom=parseInt(zoom);if(mapZoom!=zoom){switch(settings.provider){case"yahoo":nmap.setZoomLevel(zoom);break;case"microsoft":nmap.SetZoomLevel(zoom);break;default:nmap.setZoom(zoom);break;}}
if(zoom&&settings.currentZoom!=zoom){settings.currentZoom=zoom;if(settings.showZoomControls==true){if((settings.currentZoom>=settings.minZoom)&&(settings.currentZoom<=settings.maxZoom)){var posx=parseInt((zoom-1)*settings.radius);$("#"+settings.id+"_map_marker").css({left:posx});}}}
$("#"+settings.id+"_map_slider").removeClass("loading");return this;},getZoom:function(){var nmap=this[0].nMap;var settings=this[0].mapSettings;var zoom;switch(settings.provider){case"yahoo":zoom=nmap.getZoomLevel();break;case"microsoft":zoom=nmap.GetZoomLevel();break;default:zoom=nmap.getZoom();break;}
return zoom;},setLatLng:function(marker,lat,lon){var nmap=this[0].nMap;var settings=this[0].mapSettings;var point;switch(settings.provider){case"yahoo":break;case"microsoft":break;default:if(!lat){point=nmap.getCenter();}else{point=new GLatLng(lat,lon);}
marker.setLatLng(point);break;}
return this;},setCenter:function(lat,lon,zoom){var nmap=this[0].nMap;var settings=this[0].mapSettings;var point;if(!zoom)zoom=this.getZoom();switch(settings.provider){case"yahoo":if(!lat){point=nmap.getCenterLatLon();}else{point=new YGeoPoint(lat,lon);}
nmap.setCenter(point,zoom);break;case"microsoft":if(!lat){point=nmap.GetCenter();}else{point=new VELatLong(lat,lon);}
nmap.SetCenter(point);break;default:if(!lat){point=nmap.getCenter();}else{point=new GLatLng(lat,lon);}
nmap.setCenter(point);break;}
this.setZoom(zoom);return this;},getCenter:function(){var nmap=this[0].nMap;var settings=this[0].mapSettings;var coord=new Array();var point;switch(settings.provider){case"yahoo":point=nmap.getCenterLatLon();coord["lat"]=point.Lat;coord["lon"]=point.Lon;break;case"microsoft":point=nmap.GetCenter();coord["lat"]=point.Latitude;coord["lon"]=point.Longitude;break;default:point=nmap.getCenter();coord["lat"]=point.lat();coord["lon"]=point.lng();break;}
return coord;},clearMap:function(){var nmap=this[0].nMap;var settings=this[0].mapSettings;switch(settings.provider){case"yahoo":nmap.removeAllOverlays();break;case"microsoft":nmap.Clear();break;default:nmap.clearOverlays();this[0].currentPolygons=new Array();break;}
$("svg, shape").remove();return this;},showList:function(args){var nmap=this[0].nMap;var bounds=this[0].Bounds;var settings=this[0].mapSettings;var i=0;var arr_args=new Array("autoLoadReviews","listID","noSetZoom","noClear","noExtend","noBubble","highlight","mouseover","mouseout","click","blank","isBeeHover","beePosX","beePosY","isExtendedBubble");while(i<arr_args.length){eval('if (typeof(args["'+arr_args[i]+'"])!="undefined") { var '+arr_args[i]+' = args["'+arr_args[i]+'"]; }');i++;}
var reviews;var j=0;if(settings.layers[listID]!=null){if(typeof(settings.layers[listID]["reviews"])=="object"){reviews=settings.layers[listID]["reviews"];if(reviews.length>0){settings.lat=settings.layers[listID]["map"][1];settings.lon=settings.layers[listID]["map"][0];if(typeof(settings.lat=="undefined"))settings.lat=0;if(typeof(settings.lon=="undefined"))settings.lon=0;customCoord={"lat":settings.lat,"lon":settings.lon};if(!noClear)this.clearMap();switch(settings.provider){case"yahoo":break;case"microsoft":var markerManager=new VEShapeLayer();this[0].markerManager=markerManager;break;default:if(!noExtend){bounds=new GLatLngBounds();this[0].Bounds=bounds;}
break;}
for(var i in reviews){var review=reviews[i];if(typeof(review)=="object"){var argsM=new Array();argsM["review"]=review;argsM["noExtend"]=noExtend;argsM["noBubble"]=noBubble;argsM["highlight"]=highlight;argsM["mouseover"]=mouseover;argsM["mouseout"]=mouseout;argsM["click"]=click;argsM["blank"]=blank;argsM["isBeeHover"]=isBeeHover;argsM["beePosX"]=beePosX;argsM["beePosY"]=beePosY;argsM["isExtendedBubble"]=isExtendedBubble;argsM["autoLoadReviews"]=autoLoadReviews;var marker=this.addMarker(argsM);settings.markers[review["id"]]=marker;j++;}}
switch(settings.provider){case"yahoo":break;case"microsoft":nmap.AddShapeLayer(markerManager);if(!noExtend){bounds=markerManager.GetBoundingRectangle();nmap.SetMapView(bounds);this[0].Bounds=bounds;}
break;default:$("#"+settings.id+" img[id*='mtgt_unnamed_']").parent().attr("id",settings.id+"_pinsContainer");break;}
if(!noSetZoom){this.setZoomCenter();if(j==1){review=reviews[0];if(typeof(review["map.zoom"])!="undefined")this.setZoom(review["map.zoom"]);if(typeof(review["map.view"])!="undefined")this.setMapView(review["map.view"]);}}}}}
return this;},newMarker:function(lat,lon){var settings=this[0].mapSettings;var point;switch(settings.provider){case"yahoo":point=new YGeoPoint(lat,lon);break;case"microsoft":point=new VELatLong(lat,lon);break;default:point=new GLatLng(lat,lon);break;}
return point;},addMarker:function(args){var nmap=this[0].nMap;var bounds=this[0].Bounds;var settings=this[0].mapSettings;var point;var marker;var i=0;var arr_args=new Array("autoLoadReviews","review","noExtend","noBubble","highlight","blank","center","mouseover","mouseout","click","drag","isDraggable","isRemovable","isBeeHover","beePosX","beePosY","isExtendedBubble");while(i<arr_args.length){eval('if (typeof(args["'+arr_args[i]+'"])!="undefined") { var '+arr_args[i]+' = args["'+arr_args[i]+'"]; } else var '+arr_args[i]+' = false;');i++;}
var title=review["name"];var icon=this.setIcon(review);switch(settings.provider){case"yahoo":point=new YGeoPoint(review["coord"][1],review["coord"][0]);marker=new YMarker(point);if(!noBubble){YEvent.Capture(marker,EventsList.MouseClick,function(){var argsMB=new Array();argsMB["settings"]=settings;argsMB["marker"]=marker;argsMB["review"]=review;argsMB["isExtendedBubble"]=isExtendedBubble;clickMarker(argsMB);});}
if(isRemovable){YEvent.Capture(marker,EventsList.MouseDoubleClick,function(e){nmap.removeOverlay(marker);});}
nmap.addOverlay(marker);break;case"microsoft":point=new VELatLong(review["coord"][1],review["coord"][0]);marker=new VEShape(VEShapeType.Pushpin,point);if(!noBubble){marker.SetDescription(getReviewBubble(review,blank));}
marker.SetIconAnchor(point);marker.SetCustomIcon(icon);var markerManager=this[0].markerManager;if(!markerManager){nmap.AddShape(marker);}else{markerManager.AddShape(marker);this[0].markerManager=markerManager;}
break;default:point=new GLatLng(review["coord"][1],review["coord"][0]);marker=new GMarker(point,{title:title,icon:icon,draggable:isDraggable});if((!noBubble)||click){GEvent.addListener(marker,"click",function(){if(isBeeHover&&!isExtendedBubble){var link;if(review["type"]==0)
link=review["spot_link"];else link=review["event_link"];if(blank)window.open(link);else document.location=link;}else if(!noBubble){var argsMB=new Array();argsMB["settings"]=settings;argsMB["marker"]=marker;argsMB["review"]=review;argsMB["blank"]=blank;argsMB["isExtendedBubble"]=isExtendedBubble;argsMB["autoLoadReviews"]=autoLoadReviews;clickMarker(argsMB);}
if(click)eval(click);});}
if(isDraggable||drag){GEvent.addListener(marker,"dragend",function(){changeBeeMarker(marker.getPoint());if(drag)eval(drag);});}
if(isRemovable){GEvent.addListener(marker,"dblclick",function(){nmap.removeOverlay(marker);});}
if(highlight||mouseover){GEvent.addListener(marker,"mouseover",function(){if(highlight)$("#"+settings.id).highlightMarker(this);if(mouseover)eval(mouseover);if(isBeeHover){$(".navbar").addClass("nozindex");var posX=(beePosX)?beePosX:84;var posY=(beePosY)?beePosY:202;var offset=nmap.fromLatLngToContainerPixel(marker.getPoint(),nmap.getZoom());var adjustY=(!settings.smallPins)?13:0;var left=offset.x-posX;var top=offset.y-posY-adjustY;var more;var html_phone='';var isPicture=false;var spot_name='';var content_bubble='';var media='';var target='';var name='';more=T_MAP_BUBBLE_SEEMORE;if(typeof(review["pictures"])!="undefined"){if(review["pictures"][0]){isPicture=true;media+='<img class="media" src="'+review["pictures"][0]["small_url"]+'" width="30" /> ';}}
if(typeof(review["videos"])!="undefined"){if(review["videos"][0]&&!isPicture){media+='<img class="media" src="'+review["videos"][0]["small_thumb"]+'" width="30" /> ';}}
html_phone=(review["spot_tel"])?'<div class="review_phone"><span class="block floatL icon_phone"></span>'+review['spot_tel']+'</div>':'';spot_name=(review["spot_name"].toString().length>27)?review["spot_name"].toString().substring(0,27)+'...':review["spot_name"];name=(review["name"].toString().length>24)?review["name"].toString().substring(0,24)+'...':review["name"];if(!name)name=review["content"].toString().substring(0,24)+'...';if(review["type"]==1){content_bubble+='<div class="title"><a href="#">'+name+'</a></div>';content_bubble+='<div class="spot">';content_bubble+='<span class="bold" style="font-size: 12px;">'+spot_name+'</span>';content_bubble+='</div>';content_bubble+='<div class="event">';content_bubble+='<span class="event_dates">'+review["date_start"]+', '+review["date_start_h"]+'</span>';content_bubble+='</div>';}
else content_bubble='<a href="#" class="bold" style="font-size: 14px;">'+spot_name+'</a><br /><div>'+media+'<div class="info"><span style="font-size: 11px;">'+review["address_bubble"]+'</span>'+html_phone+'</div><div class="clear"></div></div>';$("#marker_bubble").remove();$("#"+settings.id).parent().append('<div id="marker_bubble"><div class="content">'+content_bubble+'</div><span class="more">'+more+'</span></div>').css({position:'relative'});$("#marker_bubble").css({left:left,top:top}).show();}});}
if(highlight||mouseout){GEvent.addListener(marker,"mouseout",function(){if(highlight)$("#"+settings.id).removeHighlight();if(mouseout)eval(mouseout);if(isBeeHover){$("#marker_bubble").remove();$(".navbar").removeClass("nozindex");}});}
if(!noExtend){bounds.extend(point);this[0].Bounds=bounds;}
if(center){nmap.checkResize();nmap.setCenter(point,16);}
nmap.addOverlay(marker);break;}
return marker;},removeHighlight:function(){var nmap=this[0].nMap;var settings=this[0].mapSettings;$("#"+settings.id+"_marker_highlight").remove();},highlightMarker:function(marker){var nmap=this[0].nMap;var settings=this[0].mapSettings;var mapZoom=this.getZoom();var offset;var left;var top;this.removeHighlight();if(marker){switch(settings.provider){case"yahoo":break;case"microsoft":var markerObj;if(typeof(marker)=="object"){markerObj=marker;}else{markerObj=nmap.GetShapeByID(marker);}
var markerPoints=markerObj.GetPoints();var markerPoint=markerPoints[0];offset=nmap.LatLongToPixel(markerPoint);break;default:offset=nmap.fromLatLngToContainerPixel(marker.getPoint(),mapZoom);left=offset.x-12-parseInt($("#"+settings.id+"_pinsContainer").parent().css("left"));top=offset.y-12-parseInt($("#"+settings.id+"_pinsContainer").parent().css("top"));$("#"+settings.id+"_pinsContainer").after('<div id="'+settings.id+'_marker_highlight" class="marker_highlight"></div>');break;}
$("#"+settings.id+"_marker_highlight").css({position:'relative',left:left,top:top}).show();}
return marker;},setIcon:function(review){var nmap=this[0].nMap;var settings=this[0].mapSettings;var icon;if(review["letter"]){pinUrl=_URL_CDATA+"/img/pinsets/itinerary/"+review["letter"]+".png";shadowUrl=_URL_CDATA+"/img/pinsets/itinerary/shadow-s.png";width=20;height=24;shadowWidth=44;shadowHeight=28;}else if(review["start"]){pinUrl=_URL_CDATA+"/img/pinsets/itinerary/start.png";shadowUrl=_URL_CDATA+"/img/pinsets/itinerary/shadow-s.png";width=30;height=36;shadowWidth=64;shadowHeight=36;}else if(review["end"]){pinUrl=_URL_CDATA+"/img/pinsets/itinerary/end.png";shadowUrl=_URL_CDATA+"/img/pinsets/itinerary/shadow-s.png";width=30;height=36;shadowWidth=64;shadowHeight=36;}else if(review["main"]){pinUrl=_URL_CDATA+"/img/maps/pin_bee_2.png";shadowUrl=_URL_CDATA+"/img/maps/pin_bee_2_shadow.png";width=51;height=80;shadowWidth=109;shadowHeight=80;}else if(!settings.defaultPins){var width;var height;var shadowWidth;var shadowHeight;if(settings.smallPins==true){pinUrl=review["pin_small_url"];shadowUrl=_URL_CDATA+"/img/pin/shadow-s.png";height=24;shadowWidth=42;shadowHeight=26;}else{pinUrl=review["pin_url"];shadowUrl=_URL_CDATA+"/img/pin/shadow.png";height=36;shadowWidth=64;shadowHeight=36;}
width=height*(5/6);}else{pinUrl="http://labs.google.com/ridefinder/images/mm_20_red.png";shadowUrl="http://labs.google.com/ridefinder/images/mm_20_shadow.png";width=12;height=20;shadowWidth=22;shadowHeight=20;}
var tmp=new preload(pinUrl,shadowUrl);switch(settings.provider){case"yahoo":break;case"microsoft":icon=new VECustomIconSpecification();icon.Image=pinUrl;icon.CustomHTML='<img style="position:absolute; z-index:1000; margin: -'+Math.round(height-13)+'px 0 0 -13px;" src="'+pinUrl+'" /><img style="position:absolute; z-index:900; margin: -'+Math.round(shadowHeight-13)+'px 0 0 -13px;" src="'+shadowUrl+'" />';break;default:icon=new GIcon();icon.image=pinUrl;icon.shadow=shadowUrl;icon.iconSize=new GSize(width,height);icon.shadowSize=new GSize(shadowWidth,shadowHeight);icon.iconAnchor=new GPoint(Math.round(width/2),height);if(!settings.defaultPins)
icon.infoWindowAnchor=new GPoint(20,1);else icon.infoWindowAnchor=new GPoint(5,1);break;}
return icon;},setZoomCenter:function(zoom){var nmap=this[0].nMap;var settings=this[0].mapSettings;var bounds=this[0].Bounds;switch(settings.provider){case"yahoo":break;case"microsoft":this.setZoom(this.getZoom());break;default:if(!zoom)zoom=nmap.getBoundsZoomLevel(bounds);if(!zoom)zoom=1;this.setZoom(zoom);var center=bounds.getCenter();if(center)nmap.setCenter(center);break;}},centerToSpot:function(listID,reviewID,resize){var nmap=this[0].nMap;var bounds=this[0].Bounds;var settings=this[0].mapSettings;var reviewZoom=15;var reviewView=1;var mapType;var nmapType;switch(settings.provider){case"yahoo":break;case"microsoft":break;default:if(listID){nmap.clearOverlays();bounds=new GLatLngBounds();this[0].Bounds=bounds;var review=getReviewById(settings.layers,listID,reviewID);var argsM=new Array();argsM["review"]=review;argsM["isBeeHover"]=true;argsM["highlight"]=true;argsM["blank"]=true;var marker=this.addMarker(argsM);if(review["map.zoom"])reviewZoom=parseInt(review["map.zoom"]);if(review["map.view"])reviewView=parseInt(review["map.view"]);mapType=translateMapType(settings,reviewView,"toString");nmapType=translateMapType(settings,reviewView,"toAPI");nmap.setMapType(eval(nmapType));$("#"+settings.id+"_map_choice .map_type_highlight").removeClass("map_type_highlight");$("#"+settings.id+"_map_choice #"+settings.id+"_nmap_"+mapType).addClass("map_type_highlight");if(resize&&navigator.appVersion.toString().indexOf("MSIE 6")==-1){this.parent().css({"height":resize});nmap.checkResize();this.enablePanControl(0);}
this.setZoomCenter(reviewZoom);}
break;}
return false;},showFullScreenMap:function(){var nmap=this[0].nMap;var settings=this[0].mapSettings;var layers=settings.layers;$("#supercontainer").hide();displayFlash(0);$("#"+settings.id+"_full_screen").hide().removeClass("fullScreenover");$("body").append('<div id="'+settings.id+'_full_map" class="full_map"></div>');$("#"+settings.id+"_full_map").append($("#"+settings.id));var fmap;fmap='<div id="'+settings.id+'_full_map_controls" class="full_map_controls"></div>';fmap+='<div id="'+settings.id+'_full_map_container" class="full_map_container">';fmap+='  <div id="'+settings.id+'_full_map_lists" class="full_map_lists">';for(var i in layers){if(typeof(layers[i])=="object"){fmap+='<div id="'+settings.id+'_full_map_list_'+i+'" class="full_map_list">';fmap+='  <div class="full_map_list_title"><img src="'+_URL_CDATA+'/img/icons/icon_9_expand.png" class="full_map_list_expand" /> '+layers[i]['liste']+'</div>';fmap+='  <ul id="'+settings.id+'_full_map_ul_'+i+'" class="full_map_list_ul">';for(var j in layers[i]["reviews"]){var review=layers[i]["reviews"][j];if(typeof(review["name"])=='string'){fmap+='<li id="'+settings.id+'_full_map_spot_'+review["id"]+'" class="full_map_list_spot">- '+review["name"]+'</li>';}}
fmap+='  </ul>';fmap+='</div>';}}
fmap+='  </div>';fmap+='</div>';$("#"+settings.id+"_full_map").append(fmap);$("#"+settings.id+"_full_map_controls").append($("#"+settings.id+"_map_controls")).append('<div id="'+settings.id+'_full_map_close"" class="icon_close2"></div>').find(".icon_close2").css({top:7,right:15}).bind("click",function(){$("#"+settings.id).hideFullMap();});$("#"+settings.id+"_full_map").show();$(".full_map_list_spot").click(function(){var reviewID=$(this).attr("id").replace(settings.id+"_full_map_spot_","");var listID=$(this).parent().attr("id").replace(settings.id+"_full_map_ul_","");var review=getReviewById(layers,listID,reviewID);var argsMB=new Array();argsMB["settings"]=settings;argsMB["marker"]=settings.markers[review["id"]];argsMB["review"]=review;argsMB["isExtendedBubble"]=true;clickMarker(argsMB);})
$(".full_map_list_expand").click(function(){var listID=$(this).parent().parent().attr("id").replace(settings.id+"_full_map_list_","");if($("#"+settings.id+"_full_map_ul_"+listID).css("display")=="none"){$(".full_map_list_ul").hide();$(".full_map_list_expand").attr("src",_URL_CDATA+'/img/icons/icon_9_expand.png');$("#"+settings.id+"_full_map_ul_"+listID).slideDown();$(this).attr("src",_URL_CDATA+'/img/icons/icon_9_collapse.png');}else{$("#"+settings.id+"_full_map_ul_"+listID).slideUp();$(this).attr("src",_URL_CDATA+'/img/icons/icon_9_expand.png');}});$(".full_map_list_ul li").hover(function(){$(this).css("color","#118fd7");},function(){$(this).css("color","#fff");})
$(".full_map_list_title").click(function(){settings.argsList["listID"]=parseInt($(this).parent().attr("id").replace(settings.id+"_full_map_list_",""));$("#"+settings.id).showList(settings.argsList);$(this).find(".full_map_list_expand").click();});if($(".full_map_list_title").size()==1)
$(".full_map_list_title .full_map_list_expand").click();this.enableOverviewControl(1);switch(settings.provider){case"yahoo":break;case"microsoft":nmap.Resize($("#"+settings.id).parent().width(),$("#"+settings.id).parent().height());$("#"+settings.id+"_map_controls").hide();var w=$("#"+settings.id).parent().width()-45;$("#"+settings.id+"_full_map_controls").css({width:"45px",left:w+"px"});this.enablePanControl(1);break;default:this.enablePanControl(0);nmap.enableScrollWheelZoom();nmap.checkResize();break;}
this.setZoomCenter();},hideFullMap:function(){var nmap=this[0].nMap;var settings=this[0].mapSettings;$("#"+settings.id+"_over").append($("#"+settings.id));$("#"+settings.id+"_over_controls").append($("#"+settings.id+"_map_controls"));$("#"+settings.id+"_full_map").remove();$("#"+settings.id+"_full_screen").show();$("#supercontainer").show();displayFlash(1);switch(settings.provider){case"yahoo":break;case"microsoft":$("#"+settings.id+"_map_controls").show();nmap.Resize($("#"+settings.id).parent().width(),$("#"+settings.id).parent().height());this.enablePanControl(0);break;default:nmap.checkResize();nmap.disableScrollWheelZoom();this.enablePanControl(1);break;}
this.enableOverviewControl(0);this.setZoomCenter();},isAnchor:function(){var settings=this[0].mapSettings;return settings.anchor;},setBoxCoordinates:function(){var nmap=this[0].nMap;var settings=this[0].mapSettings;var bounds;switch(settings.provider){case"yahoo":break;case"microsoft":bounds=nmap.GetMapView();settings.box='('+bounds.TopLeftLatLong.Longitude+','+bounds.TopLeftLatLong.Latitude+'),('+bounds.BottomRightLatLong.Longitude+','+bounds.BottomRightLatLong.Latitude+')';break;default:bounds=nmap.getBounds();settings.box='('+bounds.getNorthEast().lng()+','+bounds.getNorthEast().lat()+'),('+bounds.getSouthWest().lng()+','+bounds.getSouthWest().lat()+')';break;}
this[0].Bounds=bounds;},addPoly:function(args){var nmap=this[0].nMap;var settings=this[0].mapSettings;var poly;var i=0;var arr_args=new Array("polyPoints","polyline","color","width","alpha");while(i<arr_args.length){eval('if (typeof(args["'+arr_args[i]+'"])!="undefined") { var '+arr_args[i]+' = args["'+arr_args[i]+'"]; } else var '+arr_args[i]+' = false;');i++;}
if(polyPoints)var points=polyPoints.shift();switch(settings.provider){case"yahoo":break;default:if(polyPoints){poly=new GPolyline(points,color,width,alpha);}else if(polyline){poly=polyline;}
nmap.addOverlay(poly);break;}
return this;},addPolygon:function(args){var nmap=this[0].nMap;var settings=this[0].mapSettings;var i=0;var arr_args=new Array("input","init","hoverEdit","enableEdit","enableDraw","autoZoom");while(i<arr_args.length){eval('if (typeof(args["'+arr_args[i]+'"])!="undefined") { var '+arr_args[i]+' = args["'+arr_args[i]+'"]; } else var '+arr_args[i]+' = false;');i++;}
switch(settings.provider){case"yahoo":break;default:var plots;if(input&&init)
plots=GLatLng.fromText(input.val());else plots=[];var polygon=new GPolygon(plots,"#f33f00",1,1,"#ff0000",0.2);nmap.addOverlay(polygon);if(hoverEdit){polygon.enableEditing({onEvent:'mouseover'});polygon.disableEditing({onEvent:'mouseout'});}
if(enableEdit)
polygon.enableEditing();if(plots){if(enableDraw){if(plots.length<4)
polygon.enableDrawing();}
if(plots.length>0&&autoZoom){var bounds=polygon.getBounds();nmap.setCenter(bounds.getCenter());if(plots.length>1){nmap.setZoom(nmap.getBoundsZoomLevel(bounds));}}}
if(!this[0].currentPolygons)
this[0].currentPolygons=new Array();this[0].currentPolygons.push(polygon);if(input){GEvent.addListener(polygon,'lineupdated',function(){var polyStr="";var polys=$("#"+settings.id).currentPolygons();for(i in polys){if(i>0)polyStr+=","
poly=polys[i];polyStr+=GLatLng.listToString(poly.getVertices());}
input.val(polyStr);});if(bounds){GEvent.addListener(nmap,'click',function(){settings.polygonZoom=nmap.getZoom(nmap.getBoundsZoomLevel(bounds));});}}
if(bounds)
settings.polygonZoom=nmap.getZoom(nmap.getBoundsZoomLevel(bounds));break;}
return this;},getPolygonZoom:function(){var settings=this[0].mapSettings;return settings.polygonZoom;},addKml:function(kmlfile){var nmap=this[0].nMap;var settings=this[0].mapSettings;var geoXml;switch(settings.provider){case"yahoo":geoXml=new YGeoRSS(kmlfile);nmap.addOverlay(geoXml);break;default:geoXml=new GGeoXml(kmlfile);nmap.addOverlay(geoXml);break;}},searchDirections:function(directions,locale){var nmap=this[0].nMap;var settings=this[0].mapSettings;switch(settings.provider){case"yahoo":break;case"microsoft":var options=new VERouteOptions();nmap.GetDirections(directions,options);break;default:var query;route=new GDirections(nmap,$("#"+settings.directionsPanel)[0]);GEvent.addListener(route,"error",function(){var dirMess;if(route.getStatus().code==G_GEO_UNKNOWN_ADDRESS)
dirMess=T_G_GEO_UNKNOWN_ADDRESS_MESSAGE;else if(route.getStatus().code==G_GEO_SERVER_ERROR)
dirMess=T_G_GEO_SERVER_ERROR_MESSAGE;else if(route.getStatus().code==G_GEO_MISSING_QUERY)
dirMess=T_G_GEO_SERVER_ERROR_MESSAGE;else if(route.getStatus().code==G_GEO_BAD_KEY)
dirMess=T_G_GEO_SERVER_ERROR_MESSAGE;else if(route.getStatus().code==G_GEO_BAD_REQUEST)
dirMess=T_G_GEO_SERVER_ERROR_MESSAGE;else if(route.getStatus().code==G_GEO_UNKNOWN_DIRECTIONS)
dirMess=T_G_GEO_SERVER_ERROR_MESSAGE;else dirMess=T_LABEL_MESSAGE_INTERNAL_ERROR+"\n Error code: "+route.getStatus().code;setOverlay('<h2 class="font20"><img src="'+_URL_CDATA+'/img/icons/icon_32_alert.gif" width="32" height="32" alt="" class="floatL" /> '+dirMess+'</h2>');setTimeout(resetOverlay,2000);$("#"+settings.id).unblock();});var newMarkers=[];var latLngs=[];var icons=[];GEvent.addListener(route,"addoverlay",function(){for(var i=0;i<newMarkers.length;i++)
nmap.removeOverlay(newMarkers[i]);for(var i=0;i<=route.getNumRoutes();i++){var originalMarker=route.getMarker(i);var gIcon=originalMarker.getIcon();var letterRegExp=new RegExp("mapfiles/marker_green([A-Z]+)\.png");var letterCode=letterRegExp.exec(gIcon.image);var letterCode=letterCode[1].toLowerCase().charCodeAt();var markerLetter=String.fromCharCode(letterCode-1);latLngs[i]=originalMarker.getLatLng();if(!i)
icons[i]=$("#"+settings.id).setIcon({"start":true});else if(i==route.getNumRoutes())
icons[i]=$("#"+settings.id).setIcon({"end":true});else
icons[i]=$("#"+settings.id).setIcon({"letter":markerLetter});var marker=new GMarker(latLngs[i],{icon:icons[i],draggable:true});newMarkers[i]=marker
nmap.addOverlay(newMarkers[i]);GEvent.addListener(newMarkers[i],"dragend",function(){mapBlock();var dPoint=this.getPoint();var dIcon=this.getIcon();var dLetterCode=dIcon.image.replace(_URL_CDATA+'/img/pinsets/itinerary/','').replace(".png","").toUpperCase();var currentCheckpoint=$("#etape_"+dLetterCode).find("input").val();$("#etape_"+dLetterCode).find(".backToCheckpoint").html(currentCheckpoint);$("#etape_"+dLetterCode).find(".direction").addClass("example").val(dPoint.toString().replace("(","").replace(")",""));var points=[];for(var i=0;i<newMarkers.length;i++)
points[i]=newMarkers[i].getLatLng();route.loadFromWaypoints(points,{locale:locale});});copyClick(newMarkers[i],originalMarker);nmap.removeOverlay(originalMarker);}
function copyClick(newMarker,oldMarker){GEvent.addListener(newMarker,'click',function()
{GEvent.trigger(oldMarker,'click');});}
nomaoIcons=true;afterDir();});route.loadFromWaypoints(directions,{locale:locale});break;}
return route;},searchAddress:function(address,options){var nmap=this[0].nMap;var settings=this[0].mapSettings;var marker;if(options){if(options.callback)var callback=options.callback;}
switch(settings.provider){case"yahoo":nmap.geoCodeAddress(address);YEvent.Capture(nmap,EventsList.onEndGeoCode,function(e){if(e.success==0){alert(address+" not found");}else{point=new YGeoPoint(e.GeoPoint.Lat,e.GeoPoint.Lon);nmap.drawZoomAndCenter(point,settings.zoom);marker=new YMarker(point);marker.openSmartWindow("Latitude: "+point.Lat+"<br />Longitude: "+point.Lon);nmap.addOverlay(marker);}});break;default:GGeocoder=new GClientGeocoder();GGeocoder.getLatLng(address,function(point){if(!point){alert(address+" not found");}else{nmap.setCenter(point,settings.zoom);if(options.marker){options.marker.setLatLng(point);if(callback)callback(options.marker);}else{marker=new GMarker(point,{draggable:true});nmap.addOverlay(marker);pointlocation=marker.getPoint();marker.openInfoWindowHtml("Latitude: "+pointlocation.lat()+"<br />Longitude: "+pointlocation.lng());GEvent.addListener(marker,"dragend",function(){mylocation=marker.getPoint();marker.openInfoWindowHtml("Latitude: "+mylocation.lat()+"<br />Longitude: "+mylocation.lng());if(callback)callback(marker);});if(callback)callback(marker);}}});break;}}});})(jQuery);if(typeof(G_NORMAL_MAP)!="undefined"){function NmMapControl(functions){this.functions=functions;};NmMapControl.prototype=new GControl();NmMapControl.prototype.initialize=function(nmap){var container=document.createElement("div");var functions=this.functions
var size_of_direction_label=25;var width=nmap.getSize().width;var middle_w=0;if(width>0)middle_w=width/2-size_of_direction_label;var height=nmap.getSize().height;var middle_height=0;if(height>0)middle_height=height/2;var panRight=document.createElement("div");this.setButtonStyle(panRight,middle_height-22,width-30,"panRight");container.appendChild(panRight);GEvent.addDomListener(panRight,"click",function(){nmap.panDirection(-1,0);eval(functions)});var panLeft=document.createElement("div");this.setButtonStyle(panLeft,middle_height-22,0,"panLeft");container.appendChild(panLeft);GEvent.addDomListener(panLeft,"click",function(){nmap.panDirection(1,0);eval(functions)});var panUp=document.createElement("div");this.setButtonStyle(panUp,0,middle_w+3,"panUp");container.appendChild(panUp);GEvent.addDomListener(panUp,"click",function(){nmap.panDirection(0,1);eval(functions)});var panDown=document.createElement("div");this.setButtonStyle(panDown,height-30,middle_w+3,"panDown");container.appendChild(panDown);GEvent.addDomListener(panDown,"click",function(){nmap.panDirection(0,-1);eval(functions)});nmap.getContainer().appendChild(container);return container;};NmMapControl.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(0,0));};NmMapControl.prototype.setButtonStyle=function(button,top,left,classname){button.style.top=top+"px";button.style.left=left+"px";button.className=classname;};}
function translateMapType(settings,mapType,mode){var tmapType;var m=mapType.toString().toLowerCase();switch(mode){case"toAPI":switch(settings.provider){case"yahoo":if(m=="1"||m=="map"){tmapType="YAHOO_MAP_REG";}
else if(m=="2"||m=="sat"){tmapType="YAHOO_MAP_SAT";}
else if(m=="3"||m=="hybrid"){tmapType="YAHOO_MAP_HYB";}
else{tmapType="YAHOO_MAP_REG";}
break;case"microsoft":if(m=="1"||m=="map"){tmapType="r";}
else if(m=="2"||m=="sat"){tmapType="a";}
else if(m=="3"||m=="hybrid"){tmapType="h";}
else{tmapType="r";}
break;default:if(m=="1"||m=="map"){tmapType="G_NORMAL_MAP";}
else if(m=="2"||m=="sat"){tmapType="G_SATELLITE_MAP";}
else if(m=="3"||m=="hybrid"){tmapType="G_HYBRID_MAP";}
else if(m=="4"||m=="terrain"){tmapType="G_PHYSICAL_MAP";}
else{tmapType="G_NORMAL_MAP";}
break;}
break;case"toString":if(m=="1"||m=="r"||m=="plan"||m=="yahoo_map_reg"){tmapType="map";}
else if(m=="2"||m=="a"||m=="satellite"||m=="yahoo_map_sat"){tmapType="sat";}
else if(m=="3"||m=="h"||m=="mixte"||m=="yahoo_map_hyb"){tmapType="hybrid";}
else if(m=="4"||m=="p"||m=="relief"){tmapType="terrain";}
else{tmapType="map";}
break;default:if(m=="map"||m=="r"||m=="plan"||m=="yahoo_map_reg"){tmapType=1;}
else if(m=="sat"||m=="a"||m=="satellite"||m=="yahoo_map_sat"){tmapType=2;}
else if(m=="hybrid"||m=="h"||m=="mixte"||m=="yahoo_map_hyb"){tmapType=3;}
else if(m=="terrain"||m=="p"||m=="relief"){tmapType=4;}
else{tmapType=1;}
break;}
return tmapType;};function urlUpdate(nmap,settings,withTags){var url;var coord;var zoom;var type;var tags=settings.customTags;var matchTags="";switch(settings.provider){case"yahoo":zoom=nmap.getZoomLevel();coord=nmap.getCenter();type=nmap.getCurrentMapType().getName();break;case"microsoft":zoom=nmap.GetZoomLevel();coord=nmap.GetCenter();type=nmap.GetMapStyle();break;default:zoom=nmap.getZoom();coord=nmap.getCenter();type=nmap.getCurrentMapType().getName();break;}
coord=coord.toString().replace(/\s/,"").replace("(","").replace(")","");url='#c='+coord+'&z='+zoom+'&t='+translateMapType(settings,type);if((tags.length>0)&&(withTags==true)){for(var i in tags){if(typeof(tags[i])=='string'){if(tags[i]!='')matchTags+=parseInt(i)+",";}}
matchTags=matchTags.slice(0,parseInt((matchTags.length-1)));url+='&tags='+matchTags;}
settings.customTagsString=matchTags;if(coord.toString().indexOf("NaN")==-1)
document.location=url;};function getReviewById(layers,listID,reviewID){var reviews=layers[listID]["reviews"];for(var i in reviews){var review=reviews[i];if(typeof(review)=="object"){if(parseInt(review["id"])==parseInt(reviewID)){return review;}}}};function getReviewBubble(review,blank){var html="";var link="";var slink="";var more="";var target="";var isPicture=false;if(blank)target=' target="blank"';if(!review["noBubble"]){if(review["type"]=="1"){link=review["event_link"];slink=review["spot_link"];}else{link=review["spot_link"];}
html='<div id="wb_map_bubble" class="map_bubble">';if($("#nomao_fdm_logo").size())
html+='  <div class="title"><span>'+review["name"]+'</span></div>';else html+='  <div class="title"><a href="'+link+'"'+target+'>'+review["name"]+'</a></div>';if(typeof(review["pictures"])!="undefined"){if(review["pictures"][0]){isPicture=true;html+='<div class="picture"><a class="thickbox2 wlink" title="'+review["pictures"][0]["title"]+'" href="'+review["pictures"][0]["url"]+'" rel="gallery_'+review["id"]+'"><div class="inner"><img class="media" src="'+review["pictures"][0]["small_url"]+'"'+review["pictures"][0]["img_style"]+' /></div></a></div>';}}
if(typeof(review["videos"])!="undefined"){if(review["videos"][0]&&!isPicture){html+='<div class="video"><a class="thickbox_video wlink" title="'+review["videos"][0]["title"]+'" rel="'+review["videos"][0]["swf_url"]+'"><div class="inner"><img class="media" src="'+review["videos"][0]["small_thumb"]+'"'+review["videos"][0]["img_style"]+' /></div></a></div>';}}
html+='  <div class="infos">';if(review["type"]==1){html+='  <div class="spot">';if($("#nomao_fdm_logo").size())
html+='    <b>'+review["spot_name"]+'</b>';else html+='    <a href="'+slink+'"'+target+'>'+review["spot_name"]+'</a>';html+='    <span class="event_address">'+review["address_bubble"]+'</span>';html+='  </div>';html+='  <div class="event" style="margin-top: 20px;">';html+='    <span class="event_dates">'+review["date_start"]+' '+review["date_start_h"]+'</span>';html+='  </div>';}else{html+='<span class="address">'+review["address_bubble"]+'</span>';}
html+='  </div>';if(review["type"]=="1"){more=T_MAP_USERLIST_ABOUTEVENT;}else{more=T_MAP_USERLIST_ABOUTSPOT;}
html+='  <div id="wb_clear" class="clear"></div>';if($("#nomao_fdm_logo").size())
html+='  <span id="wb_seemore" class="seemore"><a href="http://fr.nomao.com/#search?q='+encodeURI(review["address_bubble"].replace("<br />"," "))+'" target="_blank" style="font-size: 13px;">Rechercher &agrave; proximit&eacute; &gt;&gt;</a></span>';else html+='  <span id="wb_seemore" class="seemore"><a href="'+link+'"'+target+'>'+more+' &gt;&gt;</a></span>';html+='</div>';}
return html;};function clickMarker(args){var html="";var i=0;var arr_args=new Array("autoLoadReviews","settings","marker","lat","lon","review","blank","isExtendedBubble","newHTML","map","eid");while(i<arr_args.length){eval('if (typeof(args["'+arr_args[i]+'"])!="undefined") { var '+arr_args[i]+' = args["'+arr_args[i]+'"]; } else var '+arr_args[i]+' = false;');i++;}
var rDomID="#bubble_review_content_"+review["id"];if(autoLoadReviews&&!$(rDomID).size()&&$('#reviews').size()){setPopup('<div id="bee_load">Beezzzzzz...</div>',{popupId:'marker_popup',callback:'$(".jPopupReview").remove();'});$.ajax({type:"POST",url:"/html/ui/get_review.html",data:{'t':review['type'],'rid':review['id'],'eid':eid,},dataType:'html',success:function(html){if(args['storeInContext']){$('#reviews').find('.new-box:last').after(html);$(rDomID).attr('width',$(rDomID).width());$(rDomID).attr('height',$(rDomID).height());$('#reviews').find('.new-box:last').hide().addClass("jPopupReview");}else{args['newHTML']=html;}
args['autoLoadReviews']=false;clickMarker(args);}});return false;}
if(!review['coord']){var map_hd=$("#review_"+review['id']+'_map_hd').text().split('|');args['review']['coord']=review['coord']=new Array(map_hd[0],map_hd[1]);args['review']['map.view']=review['map.view']=map_hd[3];args['review']['map.zoom']=review['map.zoom']=map_hd[2];}
if(isExtendedBubble){if(!newHTML){html=$(rDomID).html();$(rDomID).empty();if($(rDomID).attr('width')){var pH=parseInt($(rDomID).attr('height'))+60;var pW=parseInt($(rDomID).attr('width'))+60;}else{var pH=$(rDomID).height()+60;var pW=$(rDomID).width()+60;}}else{html=newHTML;}}else if(newHTML){html=newHTML;}else html=getReviewBubble(review,blank);if(html!=""){switch(settings.provider){case"yahoo":if(marker)marker.openSmartWindow(html);else if(map&&lat&&lon){point=new VELatLong(lat,lon);map.openSmartWindow(point,html);}
break;case"microsoft":break;default:if(isExtendedBubble){setPopupReview(html,{'review':review,'width':pW,"height":pH,"provider":settings.provider});}else{if(marker)marker.openInfoWindowHtml(html);else if(map&&lat&&lon){var point=new GLatLng(lat,lon);map.openInfoWindowHtml(point,html);}}
break;}
if(!blank&&!isExtendedBubble)bind_review_dom();}};function setPopupReview(html,options){var pW=options.width>925?options.width:925;var pH=options.height>330?options.height:330;var review=options.review;var popupOptions={popupId:'marker_popup',callback:'$("#bubble_review_content_'+review["id"]+'").append(options.html); bind_bookmark_button(); bind_review_dom(); if (typeof(bind_bubble_review)=="function") { bind_bubble_review("id_'+review["id"]+'"); }',html:html,zIndex:7};var popupHTML='';popupHTML='<div id="popup_map_location"><div id="popup_map" class="map_init"></div></div>';popupHTML+='<div id="popup_review_content">'+html+'</div>';if($('#marker_popup').size())
$('#marker_popup').find('.feeds').html(popupHTML);else
setPopup(popupHTML,popupOptions);setPopupWH(pW,pH,popupOptions);var mainReview={"coord":review['coord'],"main":true,"noBubble":true};var argsM=new Array();argsM["review"]=mainReview;window.setTimeout(function(){var realRH=$("#popup_review_content").height()+30;if(realRH>pH)setPopupWH(pW,realRH,popupOptions);$("#popup_map").nmap({provider:options.provider,lat:review['coord'][1],lon:review['coord'][0],width:300,height:250,getURLparams:false,zoom:review['map.zoom'],mapView:review['map.view'],typeMenu:true}).addMarker(argsM);bind_bookmark_button("marker_popup");bind_review_dom("marker_popup");setPopupSlideshow();},1000);stop_scroll();if(pH>parseInt($(window).height())){var is_scroll=1;var argsSM=new Array();argsSM["id"]="popup_map_location";argsSM["minY"]=parseInt(getCurrentYPos())+100;argsSM["maxY"]=pH-100;argsSM["startY"]=15;argsSM["correctY"]=parseInt(getCurrentYPos());function scroll_move(){layerScrollMove(argsSM);}
function start_scroll(){stop_scroll();if($.browser.msie)
window.onscroll=scroll_move;else $(document).scroll(scroll_move);}
start_scroll();}}
var geoPlacemarks;function geocode(query,callbackFunction,first){var places;var district;var geocoder=new GClientGeocoder();var ZIPCities={"paris":"750","lyon":"690","marseille":"130"};var regZIP=new RegExp("(paris|lyon|marseille) ([0-9]{1,2})");var tabZIP=regZIP.exec(query.toLowerCase());if(typeof(tabZIP)=='Array'){if(tabZIP[2]<10)
district="0"+tabZIP[2];else district=tabZIP[2];query=tabZIP[1]+" "+ZIPCities[tabZIP[1]]+district;}
if(callbackFunction&&typeof(callbackFunction)=='function')
geocoder.getLocations(query,callbackFunction);else
geocoder.getLocations(query,checkGeoResult);function checkGeoResult(response){if(response&&response.Status.code==200){getPlacemarks(response);}}}
function getPlacemarks(response){var count=0;var html='<div id="search_locations">';geoPlacemarks=new Array();$.each(response.Placemark,function(i,item){geoPlacemarks[i]=getPlacemark(item);if(geoPlacemarks[i]["coordinates"]){html+='<div class="result"><span class="p_location">'+buildPlacemarkAddress(geoPlacemarks[i])+'</span></div>';count++;}});html+='</div>';geoPlacemarks["count"]=count;geoPlacemarks["html"]=html;}
function buildPlacemarkAddress(pm){var address='';if(pm["country"]){if(pm["street"])address=pm["street"];if(pm["zip"]){address+=(address)?', ':'';address+=pm["zip"];}
if(pm["city"]){address+=(address)?' ':'';address+=pm["city"];}
if(pm["area"]){address+=(address)?', ':'';address+=pm["area"];}
address+=(address)?', ':'';address+=pm["country"];}else{address=pm["address"];}
return address;}
function getPlacemark(pm){var geoPlacemark=new Array();var regCoord=new RegExp("([0-9.\-]+,[0-9.\-]+),[0-9.]+");var tabCoordinates=regCoord.exec(pm.Point.coordinates);geoPlacemark["accuracy"]=pm.AddressDetails.Accuracy;geoPlacemark["coordinates"]=tabCoordinates[1];if(typeof(pm.address)!="undefined")
geoPlacemark["address"]=pm.address;if(typeof(pm.AddressDetails.Country)!="undefined"){geoPlacemark["country"]=pm.AddressDetails.Country.CountryNameCode;if(typeof(pm.AddressDetails.Country.AdministrativeArea)!="undefined"){if(typeof(pm.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName)!="undefined")
geoPlacemark["area"]=pm.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName;if(typeof(pm.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea)!="undefined"&&typeof(pm.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality)!="undefined"){var loc=pm.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality;geoPlacemark["department"]=pm.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.SubAdministrativeAreaName;}else if(typeof(pm.AddressDetails.Country.SubAdministrativeArea)!="undefined"&&typeof(pm.AddressDetails.Country.SubAdministrativeArea.Locality)!="undefined"){var loc=pm.AddressDetails.Country.SubAdministrativeArea.Locality;geoPlacemark["department"]=pm.AddressDetails.Country.SubAdministrativeArea.SubAdministrativeAreaName;}else if(typeof(pm.AddressDetails.Country.AdministrativeArea.Locality)!="undefined"){var loc=pm.AddressDetails.Country.AdministrativeArea.Locality;}
if(typeof(loc)!='undefined'){geoPlacemark["city"]=loc.LocalityName;if(typeof(loc.DependentLocality)!="undefined"){if(typeof(loc.DependentLocality.DependentLocalityName)!="undefined")geoPlacemark["district"]=loc.DependentLocality.DependentLocalityName;if(typeof(loc.DependentLocality.Thoroughfare)!="undefined")geoPlacemark["street"]=loc.DependentLocality.Thoroughfare.ThoroughfareName;if(typeof(loc.DependentLocality.PostalCode)!="undefined")geoPlacemark["zip"]=loc.DependentLocality.PostalCode.PostalCodeNumber;}else{if(typeof(loc.Thoroughfare)!="undefined")geoPlacemark["street"]=loc.Thoroughfare.ThoroughfareName;if(typeof(loc.PostalCode)!="undefined")geoPlacemark["zip"]=loc.PostalCode.PostalCodeNumber;}}}}
return geoPlacemark;}
function get_placemark_zoom(pm){var zoom;if(pm["street"])zoom=16;else if(pm["district"])zoom=15;else if(pm["zip"])zoom=14;else if(pm["city"])zoom=12;else if(pm["department"])zoom=11;else if(pm["area"])zoom=10;else zoom=get_country_zoom(pm["country"]);return zoom;}
function get_map_box(pm){var coordinates;var zoom;if(typeof(pm)=='object'){coordinates=pm["coordinates"];zoom=pm["zoom"];}else{coordinates=pm["coordinates"];zoom=get_placemark_zoom(pm);}
if(!coordinates)
return 0;return get_box_bounds(coordinates,zoom);}
function get_country_zoom(countryCode){var countries_zoom={"US":4,"CA":4,"AU":4,"RU":3,"NL":8,"MC":13};var zoom=countries_zoom[countryCode];if(!zoom)zoom=5;return zoom;}
function get_box_bounds(coordinates,zoom){var lng;var lat;var box;if(typeof(coordinates)=='string')
coordinates=getCoordinates(coordinates)
else if(typeof(coordinates)=='object')
coordinates=new Array(coordinates["lon"],coordinates["lat"]);if(zoom==17){lng=0.0064373016357421875/2;lat=0.002821934022463779/2;}
else if(zoom==16){lng=0.012874603271484375/2;lat=0.005643868045432043/2;}
else if(zoom==15){lng=0.02574920654296875/2;lat=0.01128799088707666/2;}
else if(zoom==14){lng=0.0514984130859375/2;lat=0.02257599454804904/2;}
else if(zoom==13){lng=0.102996826171875/2;lat=0.045151989370069145/2;}
else if(zoom==12){lng=0.20599365234375/2;lat=0.09030377709787274/2;}
else if(zoom==11){lng=0.4119873046875/2;lat=0.18060757173022068/2;}
else if(zoom==10){lng=0.823974609375/2;lat=0.3612185450607228/2;}
else if(zoom==9){lng=1.64794921875/2;lat=0.7224382120669262/2;}
else if(zoom==8){lng=3.2958984374999996/2;lat=1.4448332197794755/2;}
else if(zoom==7){lng=6.591796875/2;lat=2.889738130005945/2;}
else if(zoom==6){lng=13.18359375/2;lat=5.78087969130825/2;}
else if(zoom==5){lng=26.3671875/2;lat=11.562873504241509/2;}
else if(zoom==4){lng=52.734375/2;lat=23.17064012795923/2;}
else if(zoom==3){lng=105.46875/2;lat=46.434649100694955/2;}
else if(zoom==2){lng=210.9375/2;lat=91.38943237459662/2;}
else if(zoom==1){lng=360/2;lat=150.4807424942311/2;}
else{lng=0.02574920654296875/2;lat=0.01128799088707666/2;}
lng=lng*0.95;lat=lat*0.95;var northEastLng=parseFloat(parseFloat(coordinates[0])+lng);var northEastLat=parseFloat(parseFloat(coordinates[1])+lat);var southWestLng=parseFloat(parseFloat(coordinates[0])-lng);var southWestLat=parseFloat(parseFloat(coordinates[1])-lat);var box='('+northEastLng.toString()+','+northEastLat.toString()+'),('+southWestLng.toString()+','+southWestLat.toString()+')';return box;}