(function(){function $m(){var elements=[];for(var i=0;i<arguments.length;i++){var element=arguments[i];if(typeof(element)=='string'){element=document.getElementById(element);}
if(arguments.length==1){return element;}
elements.push(element);}
return elements;}
function loadScript(src,callback){var script=document.createElement('script');script.type='text/javascript';script.src=src;if(callback){var evl={};evl.handleEvent=function(e){callback();};script.addEventListener('load',evl,true);}
document.getElementsByTagName('head')[0].appendChild(script);return;}
function convertLatLonXY_Yahoo(point,level){var size=1<<(26-level);var pixel_per_degree=size/360.0;var pixel_per_radian=size/(2*Math.PI);var origin=new YCoordPoint(size/2,size/2);var answer=new YCoordPoint();answer.x=Math.floor(origin.x+point.lon*pixel_per_degree);var sin=Math.sin(point.lat*Math.PI/180.0);answer.y=Math.floor(origin.y+0.5*Math.log((1+sin)/(1-sin))*-pixel_per_radian);return answer;}
function loadStyle(href){var link=document.createElement('link');link.type='text/css';link.rel='stylesheet';link.href=href;document.getElementsByTagName('head')[0].appendChild(link);return;}
function getStyle(el,prop){var y;if(el.currentStyle){y=el.currentStyle[prop];}
else if(window.getComputedStyle){y=window.getComputedStyle(el,'').getPropertyValue(prop);}
return y;}
function lonToMetres(lon,lat){return lon*(111200*Math.cos(lat*(Math.PI/180)));}
function metresToLon(m,lat){return m/(111200*Math.cos(lat*(Math.PI/180)));}
function getDegreesFromGoogleZoomLevel(pixels,zoom){return(360*pixels)/(Math.pow(2,zoom+8));}
function getGoogleZoomLevelFromDegrees(pixels,degrees){return logN((360*pixels)/degrees,2)-8;}
function logN(number,base){return Math.log(number)/Math.log(base);}
function Mapstraction(element,api,debug){this.api=api;this.maps={};this.currentElement=$m(element);this.eventListeners=[];this.markers=[];this.layers=[];this.polylines=[];this.images=[];this.loaded={};this.onload={};if(debug===true){this.debug=true;}
else{this.debug=false;}
this.svn_revision_string='$Revision$';this.addControlsArgs={};this.addAPI($m(element),api);}
Mapstraction.prototype.addAPI=function(element,api){this.loaded[api]=false;this.onload[api]=[];var me=this;switch(api){case'yahoo':if(YMap){this.maps[api]=new YMap(element);YEvent.Capture(this.maps[api],EventsList.MouseClick,function(event,location){me.clickHandler(location.Lat,location.Lon,location,me);});YEvent.Capture(this.maps[api],EventsList.changeZoom,function(){me.moveendHandler(me);});YEvent.Capture(this.maps[api],EventsList.endPan,function(){me.moveendHandler(me);});this.loaded[api]=true;}
else{alert(api+' map script not imported');}
break;case'google':if(GMap2){if(GBrowserIsCompatible()){this.maps[api]=new GMap2(element);GEvent.addListener(this.maps[api],'click',function(marker,location){if(location){me.clickHandler(location.y,location.x,location,me);}});GEvent.addListener(this.maps[api],'moveend',function(){me.moveendHandler(me);});this.loaded[api]=true;}
else{alert('browser not compatible with Google Maps');}}
else{alert(api+' map script not imported');}
break;case'microsoft':if(VEMap){element.style.position='relative';var msft_width=parseFloat(getStyle($m(element),'width'));var msft_height=parseFloat(getStyle($m(element),'height'));var ffv=0;var ffn="Firefox/";var ffp=navigator.userAgent.indexOf(ffn);if(ffp!=-1){ffv=parseFloat(navigator.userAgent.substring(ffp+ffn.length));}
if(ffv>=1.5){Msn.Drawing.Graphic.CreateGraphic=function(f,b){return new Msn.Drawing.SVGGraphic(f,b);};}
this.maps[api]=new VEMap(element.id);this.maps[api].LoadMap();this.maps[api].AttachEvent("onclick",function(e){me.clickHandler(e.view.LatLong.Latitude,e.view.LatLong.Longitude,me);});this.maps[api].AttachEvent("onchangeview",function(e){me.moveendHandler(me);});this.resizeTo(msft_width,msft_height);this.loaded[api]=true;}
else{alert(api+' map script not imported');}
break;case'openlayers':this.maps[api]=new OpenLayers.Map(element.id,{maxExtent:new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),maxResolution:156543,numZoomLevels:18,units:'meters',projection:"EPSG:41001"});this.layers['osmmapnik']=new OpenLayers.Layer.TMS('OSM Mapnik',["http://a.tile.openstreetmap.org/","http://b.tile.openstreetmap.org/","http://c.tile.openstreetmap.org/"],{type:'png',getURL:function(bounds){var res=this.map.getResolution();var x=Math.round((bounds.left-this.maxExtent.left)/(res*this.tileSize.w));var y=Math.round((this.maxExtent.top-bounds.top)/(res*this.tileSize.h));var z=this.map.getZoom();var limit=Math.pow(2,z);if(y<0||y>=limit){return null;}else{x=((x%limit)+limit)%limit;var path=z+"/"+x+"/"+y+"."+this.type;var url=this.url;if(url instanceof Array){url=this.selectUrl(path,url);}
return url+path;}},displayOutsideMaxExtent:true});this.layers['osm']=new OpenLayers.Layer.TMS('OSM',["http://a.tah.openstreetmap.org/Tiles/tile.php/","http://b.tah.openstreetmap.org/Tiles/tile.php/","http://c.tah.openstreetmap.org/Tiles/tile.php/"],{type:'png',getURL:function(bounds){var res=this.map.getResolution();var x=Math.round((bounds.left-this.maxExtent.left)/(res*this.tileSize.w));var y=Math.round((this.maxExtent.top-bounds.top)/(res*this.tileSize.h));var z=this.map.getZoom();var limit=Math.pow(2,z);if(y<0||y>=limit){return null;}else{x=((x%limit)+limit)%limit;var path=z+"/"+x+"/"+y+"."+this.type;var url=this.url;if(url instanceof Array){url=this.selectUrl(path,url);}
return url+path;}},displayOutsideMaxExtent:true});this.maps[api].addLayer(this.layers['osmmapnik']);this.maps[api].addLayer(this.layers['osm']);this.loaded[api]=true;break;case'openstreetmap':if(GMap2){if(GBrowserIsCompatible()){this.maps[api]=new GMap2(element);GEvent.addListener(this.maps[api],'click',function(marker,location){if(location){me.clickHandler(location.y,location.x,location,me);}});GEvent.addListener(this.maps[api],'moveend',function(){me.moveendHandler(me);});var copyright=new GCopyright(1,new GLatLngBounds(new GLatLng(-90,-180),new GLatLng(90,180)),0,"copyleft");var copyrightCollection=new GCopyrightCollection('OSM');copyrightCollection.addCopyright(copyright);var tilelayers=[];tilelayers[0]=new GTileLayer(copyrightCollection,1,18);tilelayers[0].getTileUrl=function(a,b){return"http://tile.openstreetmap.org/"+b+"/"+a.x+"/"+a.y+".png";};tilelayers[0].isPng=function(){return true;};tilelayers[0].getOpacity=function(){return 1.0;};var custommap=new GMapType(tilelayers,new GMercatorProjection(19),"OSM",{errorMessage:"More OSM coming soon"});this.maps[api].addMapType(custommap);this.loaded[api]=true;var myPoint=new LatLonPoint(50.6805,-1.4062505);this.setCenterAndZoom(myPoint,11);this.maps[api].setMapType(custommap);}
else{alert('browser not compatible with Google Maps');}}
else{alert(api+' map script not imported');}
break;case'multimap':if(MultimapViewer){if(this.debug){window.print_debug=function(strMessage){var dbg=document.getElementById('debug');if(dbg){dbg.innerHTML+='<p>MUlTIMAP: '+strMessage+'</p>';}
else{alert(strMessage);}};}
this.maps[api]=new MultimapViewer(element);this.maps[api].addEventHandler('click',function(eventType,eventTarget,arg1,arg2,arg3){if(arg1){me.clickHandler(arg1.lat,arg1.lon,me);}});this.maps[api].addEventHandler('changeZoom',function(eventType,eventTarget,arg1,arg2,arg3){me.moveendHandler(me);});this.maps[api].addEventHandler('endPan',function(eventType,eventTarget,arg1,arg2,arg3){me.moveendHandler(me);});this.loaded[api]=true;}
else{alert(api+' map script not imported');}
break;case'map24':if(Map24){Map24.loadApi(["core_api","wrapper_api"],function(){Map24.MapApplication.init
({NodeName:element.id,MapType:"Static"});me.maps[api]=Map24.MapApplication.Map;Map24.MapApplication.Map.addListener('Map24.Event.MapClick',function(e){me.clickHandler(e.Coordinate.Latitude/60,e.Coordinate.Longitude/60,me);e.stop();});Map24.MapApplication.Map.addListener("MapPanStop",function(e){me.moveendHandler(me);});var client=Map24.MapApplication.Map.MapClient['Static'];me.loaded[api]=true;for(var i=0;i<me.onload[api].length;i++){me.onload[api][i]();}},"2.0.1247");}else{alert(api+' api not loaded');}
break;case'mapquest':if(MQA.TileMap){this.maps[api]=new MQA.TileMap(element);this.loaded[api]=true;MQA.EventManager.addListener(this.maps[api],"click",function(eventType,eventTarget,arg1,arg2,arg3){if(arg1){me.clickHandler(arg1.lat,arg1.lon,me);}});MQA.EventManager.addListener(this.maps[api],"zoomend",function(){me.moveendHandler(me)});MQA.EventManager.addListener(this.maps[api],"moveend",function(){me.moveendHandler(me)});}
else{alert(api+' map script not imported');}
break;case'freeearth':this.maps[api]=new FE.Map($m(element));this.maps[api].onLoad=function(){me.freeEarthLoaded=true;me.loaded[api]=true;for(var i=0;i<me.onload[api].length;i++){me.onload[api][i]();}};this.maps[api].load();break;case'openspace':this.maps[api]=new OpenSpace.Map(element,{controls:[],centreInfoWindow:false});this.maps[api].addControl(new OpenLayers.Control.Navigation());this.maps[api].addControl(new OpenLayers.Control.KeyboardDefaults());this.maps[api].addControl(new OpenSpace.Control.CopyrightCollection());this.maps[api].events.register("click",this.maps[api],function(evt){var point=this.getLonLatFromViewPortPx(evt.xy);var llPoint=new LatLonPoint;llPoint.fromOpenSpace(point);me.clickHandler(llPoint.lat,llPoint.lon);return false;});this.loaded[api]=true;break;case'viamichelin':if(VMMap){this.maps[api]=new VMMap(element);this.maps[api].addEventHandler('onClick',function(eventType,eventTarget,arg1,arg2,arg3){if(arg1){me.clickHandler(arg1.lat,arg1.lon,me);}});this.maps[api].addEventHandler('onZoomIn',function(eventType,eventTarget,arg1,arg2,arg3){me.moveendHandler(me);});this.maps[api].addEventHandler('onZoomOut',function(eventType,eventTarget,arg1,arg2,arg3){me.moveendHandler(me);});this.maps[api].addEventHandler('onStopPan',function(eventType,eventTarget,arg1,arg2,arg3){me.moveendHandler(me);});this.loaded[api]=true;}
else{alert(api+' map script not imported');}
break;default:if(this.debug){alert(api+' not supported by mapstraction');}}};Mapstraction.prototype.isLoaded=function(api){if(api===null){api=this.api;}
return this.loaded[api];};Mapstraction.prototype.setDebug=function(debug){if(debug!==null){this.debug=debug;}
return this.debug;};Mapstraction.prototype.clickHandler=function(lat,lon,me){this.callEventListeners('click',{location:new LatLonPoint(lat,lon)});};Mapstraction.prototype.moveendHandler=function(me){this.callEventListeners('moveend',{});};Mapstraction.prototype.addEventListener=function(){var listener={};listener.event_type=arguments[0];listener.callback_function=arguments[1];if(arguments.length==3){listener.back_compat_mode=false;listener.callback_object=arguments[2];}
else{listener.back_compat_mode=true;listener.callback_object=null;}
this.eventListeners.push(listener);};Mapstraction.prototype.callEventListeners=function(sEventType,oEventArgs){oEventArgs.source=this;for(var i=0;i<this.eventListeners.length;i++){var evLi=this.eventListeners[i];if(evLi.event_type==sEventType){if(evLi.back_compat_mode){if(evLi.event_type=='click'){evLi.callback_function(oEventArgs.location);}
else{evLi.callback_function();}}
else{var scope=evLi.callback_object||this;evLi.callback_function.call(scope,oEventArgs);}}}};Mapstraction.prototype.addControls=function(args){if(this.loaded[this.api]===false){var me=this;this.onload[this.api].push(function(){me.addControls(args);});return;}
var map=this.maps[this.api];this.addControlsArgs=args;switch(this.api){case'google':case'openstreetmap':if(this.controls){while((ctl=this.controls.pop())){map.removeControl(ctl);}}
else{this.controls=[];}
c=this.controls;if(args.zoom||args.pan){if(args.zoom=='large'){c.unshift(new GLargeMapControl());map.addControl(c[0]);}else{c.unshift(new GSmallMapControl());map.addControl(c[0]);}}
if(args.scale){c.unshift(new GScaleControl());map.addControl(c[0]);}
if(this.api!="openstreetmap"){if(args.overview){c.unshift(new GOverviewMapControl());map.addControl(c[0]);}
if(args.map_type){c.unshift(new GMapTypeControl());map.addControl(c[0]);}}
break;case'yahoo':if(args.pan){map.addPanControl();}
else{map.removePanControl();}
if(args.zoom=='large'){map.addZoomLong();}
else if(args.zoom=='small'){map.addZoomShort();}
else{map.removeZoomScale();}
break;case'openlayers':for(var i=map.controls.length;i>1;i--){map.controls[i-1].deactivate();map.removeControl(map.controls[i-1]);}
if(args.pan){map.addControl(new OpenLayers.Control.PanZoomBar());}
else{}
if(args.zoom=='large'){map.addControl(new OpenLayers.Control.PanZoomBar());}
else if(args.zoom=='small'){map.addControl(new OpenLayers.Control.ZoomBox());}
else{map.addControl(new OpenLayers.Control.ZoomBox());}
if(args.overview){map.addControl(new OpenLayers.Control.OverviewMap());}
if(args.map_type){map.addControl(new OpenLayers.Control.LayerSwitcher());}
break;case'openspace':for(var i=map.controls.length;i>3;i--){map.controls[i-1].deactivate();map.removeControl(map.controls[i-1]);}
if(args.zoom=='large'){map.addControl(new OpenSpace.Control.LargeMapControl());}
else if(args.zoom=='small'||args.pan){map.addControl(new OpenSpace.Control.SmallMapControl());}
if(args.overview){var osOverviewControl=new OpenSpace.Control.OverviewMap();map.addControl(osOverviewControl);osOverviewControl.maximizeControl();}
if(args.map_type){map.addControl(new OpenLayers.Control.LayerSwitcher());}
break;case'multimap':pan_zoom_widget='MM';if(args.zoom&&args.zoom=="small"){pan_zoom_widget=pan_zoom_widget+"Small";}
if(args.pan){pan_zoom_widget=pan_zoom_widget+"Pan";}
if(args.zoom){pan_zoom_widget=pan_zoom_widget+"Zoom";}
pan_zoom_widget=pan_zoom_widget+"Widget";if(pan_zoom_widget!="MMWidget"){eval(' map.addWidget( new '+pan_zoom_widget+'() );');}
if(args.map_type){map.addWidget(new MMMapTypeWidget());}
if(args.overview){map.addWidget(new MMOverviewWidget());}
break;case'mapquest':if(this.controls){while((ctl=this.controls.pop())){map.removeControl(ctl);}}
else{this.controls=[];}
c=this.controls;if(args.pan){c.unshift(new MQA.PanControl());map.addControl(c[0],new MQA.MapCornerPlacement(MQA.MapCorner.TOP_LEFT,new MQA.Size(0,0)));}
if(args.zoom=='large'){c.unshift(new MQA.LargeZoomControl());map.addControl(c[0],new MQA.MapCornerPlacement(MQA.MapCorner.TOP_LEFT,new MQA.Size(0,0)));}
else if(args.zoom=='small'){c.unshift(new MQA.ZoomControl());map.addControl(c[0],new MQA.MapCornerPlacement(MQA.MapCorner.BOTTOM_LEFT,new MQA.Size(0,0)));}
if(args.map_type){c.unshift(new MQA.ViewControl());map.addControl(c[0],new MQA.MapCornerPlacement(MQA.MapCorner.TOP_RIGHT,new MQA.Size(0,0)));}
break;case'viamichelin':if(args.zoom=='large'){map.activateZoom(true);map.showMapTools();}
else if(args.zoom=='small'){map.activateMiniZoom(true);map.showMapTools();}
else{map.hideMapTools();}
break;}};Mapstraction.prototype.setCenterAndZoom=function(point,zoom){if(this.loaded[this.api]===false){var me=this;this.onload[this.api].push(function(){me.setCenterAndZoom(point,zoom);});return;}
var map=this.maps[this.api];switch(this.api){case'yahoo':var yzoom=18-zoom;map.drawZoomAndCenter(point.toYahoo(),yzoom);break;case'google':case'openstreetmap':map.setCenter(point.toGoogle(),zoom);break;case'microsoft':map.SetCenterAndZoom(point.toMicrosoft(),zoom);break;case'openlayers':map.setCenter(point.toOpenLayers(),zoom);break;case'multimap':map.goToPosition(new MMLatLon(point.lat,point.lng),zoom);break;case'map24':var newSettings={};newSettings.Latitude=point.lat*60;newSettings.Longitude=point.lon*60;var client=map.MapClient['Static'];var dLon=getDegreesFromGoogleZoomLevel(client.getCanvasSize().Width,zoom);newSettings.MinimumWidth=lonToMetres(dLon,point.lat);Map24.MapApplication.center(newSettings);break;case'mapquest':map.setCenter(new MQLatLng(point.lat,point.lng),zoom-3);break;case'freeearth':if(this.freeEarthLoaded){map.setTargetLatLng(point.toFreeEarth());}
else{var me=this;this.freeEarthOnLoad.push(function(){me.setCenterAndZoom(point);});}
break;case'openspace':var oszoom=zoom-6;if(oszoom<0){oszoom=0;}
else if(oszoom>10){oszoom=10;}
map.setCenter(point.toOpenSpace(),oszoom);break;case'viamichelin':map.drawMap(new VMLonLat(point.lng,point.lat),Math.floor(zoom/19*16));break;default:if(this.debug){alert(this.api+' not supported by Mapstraction.setCenterAndZoom');}}};Mapstraction.prototype.addMarker=function(marker,old){var map=this.maps[this.api];marker.mapstraction=this;marker.api=this.api;marker.map=this.maps[this.api];if(this.loaded[this.api]===false){var me=this;this.onload[this.api].push(function(){me.addMarker(marker,old);});return;}
switch(this.api){case'yahoo':var ypin=marker.toYahoo();marker.setChild(ypin);map.addOverlay(ypin);if(!old){this.markers.push(marker);}
break;case'google':case'openstreetmap':var gpin=marker.toGoogle();marker.setChild(gpin);map.addOverlay(gpin);if(!old){this.markers.push(marker);}
break;case'microsoft':var mpin=marker.toMicrosoft();marker.setChild(mpin);map.AddPushpin(mpin);if(!old){this.markers.push(marker);}
break;case'openlayers':if(!this.layers['markers']){this.layers['markers']=new OpenLayers.Layer.Markers('markers');map.addLayer(this.layers['markers']);}
var olmarker=marker.toOpenLayers();marker.setChild(olmarker);this.layers['markers'].addMarker(olmarker);if(!old){this.markers.push(marker);}
break;case'openspace':if(!this.layers['markers']){this.layers['markers']=map.getMarkerLayer();}
var osmarker=marker.toOpenSpace();marker.setChild(osmarker);if(marker.infoBubble){if(marker.hover){osmarker.events.register('mouseover',{marker:osmarker,html:marker.infoBubble},function(evt){this.marker.map.closeInfoWindow();this.marker.map.openInfoWindow(this.marker.icon,this.marker.lonlat,this.html);OpenLayers.Event.stop(evt);});osmarker.events.register('mouseout',{marker:osmarker},function(evt){this.marker.map.closeInfoWindow();OpenLayers.Event.stop(evt);});}
else{osmarker.events.register('mousedown',{marker:osmarker,html:marker.infoBubble},function(evt){this.marker.map.closeInfoWindow();this.marker.map.openInfoWindow(this.marker.icon,this.marker.lonlat,this.html);OpenLayers.Event.stop(evt);});}}
this.layers['markers'].addMarker(osmarker);if(!old){this.markers.push(marker);}
break;case'multimap':var mmpin=marker.toMultiMap();marker.setChild(mmpin);map.addOverlay(mmpin);if(!old){this.markers.push(marker);}
break;case'map24':var m24pin=marker.toMap24();marker.setChild(m24pin);m24pin.commit();if(!old){this.markers.push(marker);}
break;case'mapquest':var mqpin=marker.toMapQuest();marker.setChild(mqpin);map.addPoi(mqpin);if(!old){this.markers.push(marker);}
break;case'freeearth':var fepin=marker.toFreeEarth();marker.setChild(fepin);map.addOverlay(fepin);if(!old){this.markers.push(marker);}
break;case'viamichelin':var vmpin=marker.toViaMichelin();marker.setChild(vmpin);map.addLayer(vmpin);if(!old){this.markers.push(marker);}
break;default:if(this.debug){alert(this.api+' not supported by Mapstraction.addMarker');}}};Mapstraction.prototype.removeMarker=function(marker){if(this.loaded[this.api]===false){var me=this;this.onload[this.api].push(function(){me.removeMarker(marker);});return;}
var map=this.maps[this.api];var tmparray=[];while(this.markers.length>0){current_marker=this.markers.pop();if(marker==current_marker){switch(this.api){case'google':case'openstreetmap':map.removeOverlay(marker.proprietary_marker);break;case'yahoo':map.removeOverlay(marker.proprietary_marker);break;case'microsoft':map.DeletePushpin(marker.pinID);break;case'multimap':map.removeOverlay(marker.proprietary_marker);break;case'mapquest':map.removeShape(marker.proprietary_marker);break;case'map24':marker.proprietary_marker.remove();break;case'openlayers':case'openspace':this.layers['markers'].removeMarker(marker.proprietary_marker);marker.proprietary_marker.destroy();break;case'viamichelin':map.removeLayer(marker.proprietary_marker);break;}
marker.onmap=false;break;}else{tmparray.push(current_marker);}}
this.markers=this.markers.concat(tmparray);};Mapstraction.prototype.removeAllMarkers=function(){if(this.loaded[this.api]===false){var me=this;this.onload[this.api].push(function(){me.removeAllMarkers();});return;}
var map=this.maps[this.api];switch(this.api){case'yahoo':map.removeMarkersAll();break;case'google':case'openstreetmap':map.clearOverlays();break;case'microsoft':map.DeleteAllPushpins();break;case'multimap':map.removeAllOverlays();break;case'mapquest':map.removeAllShapes();break;case'map24':var current_marker;while(this.markers.length>0){current_marker=this.markers.pop();current_marker.proprietary_marker.remove();}
break;case'openlayers':case'openspace':if(this.layers['markers'])this.layers['markers'].clearMarkers();break;case'viamichelin':map.removeAllLayers();break;default:if(this.debug){alert(this.api+' not supported by Mapstraction.removeAllMarkers');}}
this.markers=[];};Mapstraction.prototype.getCenter=function(){if(this.loaded[this.api]===false){return null;}
var map=this.maps[this.api];var point=undefined;var pt;switch(this.api){case'openspace':pt=map.getCenter();point=new LatLonPoint();point.fromOpenSpace(pt);break;case'yahoo':pt=map.getCenterLatLon();point=new LatLonPoint(pt.Lat,pt.Lon);break;case'google':case'openstreetmap':pt=map.getCenter();point=new LatLonPoint(pt.lat(),pt.lng());break;case'openlayers':pt=map.getCenter();point=new LatLonPoint(pt.lat,pt.lon);break;case'microsoft':pt=map.GetCenter();point=new LatLonPoint(pt.Latitude,pt.Longitude);break;case'multimap':pt=map.getMapBounds().getCenter();point=new LatLonPoint(pt.lat,pt.lon);break;case'mapquest':pt=map.getCenter();point=new LatLonPoint(pt.getLatitude(),pt.getLongitude());break;case'map24':pt=map.MapClient['Static'].getCurrentMapView().getCenter();point=new LatLonPoint(pt.Y/60,pt.X/60);break;case'viamichelin':pt=map.GetCenter();point=new LatLonPoint(pt.lat,pt.lon);break;default:if(this.debug){alert(this.api+' not supported by Mapstraction.getCenter');}}
return point;};Mapstraction.prototype.setCenter=function(point){if(this.loaded[this.api]===false){var me=this;this.onload[this.api].push(function(){me.setCenter(point);});return;}
var map=this.maps[this.api];switch(this.api){case'openspace':map.setCenter(point.toOpenSpace());break;case'yahoo':map.panToLatLon(point.toYahoo());break;case'google':case'openstreetmap':map.setCenter(point.toGoogle());break;case'openlayers':map.setCenter(point.toOpenLayers());break;case'microsoft':map.SetCenter(point.toMicrosoft());break;case'multimap':map.goToPosition(point.toMultiMap());break;case'mapquest':map.setCenter(point.toMapQuest());break;case'freeearth':if(this.freeEarthLoaded){map.setTargetLatLng(point.toFreeEarth());}
else{var me=this;this.freeEarthOnLoad.push(function(){me.setCenterAndZoom(point);});}
break;case'map24':var mv=map.MapClient['Static'].getCurrentMapView();var newSettings={};newSettings.MinimumWidth=lonToMetres
(mv.LowerRight.Longitude-mv.TopLeft.Longitude,(mv.LowerRight.Latitude+mv.TopLeft.Latitude)/2);newSettings.Latitude=point.lat*60;newSettings.Longitude=point.lon*60;Map24.MapApplication.center(newSettings);break;case'viamichelin':map.panTo(point.toViaMichelin());break;default:if(this.debug){alert(this.api+' not supported by Mapstraction.setCenter');}}};Mapstraction.prototype.setZoom=function(zoom){if(this.loaded[this.api]===false){var me=this;this.onload[this.api].push(function(){me.setZoom(zoom);});return;}
var map=this.maps[this.api];switch(this.api){case'openspace':var oszoom=zoom-6;if(oszoom<0){oszoom=0;}
else if(oszoom>10){oszoom=10;}
map.zoomTo(oszoom);break;case'yahoo':var yzoom=18-zoom;map.setZoomLevel(yzoom);break;case'google':case'openstreetmap':map.setZoom(zoom);break;case'openlayers':map.zoomTo(zoom);break;case'microsoft':map.SetZoomLevel(zoom);break;case'multimap':map.setZoomFactor(zoom);break;case'mapquest':map.setZoomLevel(zoom-3);break;case'map24':var point=this.getCenter();var newSettings={};newSettings.Latitude=point.lat*60;newSettings.Longitude=point.lon*60;var client=map.MapClient['Static'];var dLon=getDegreesFromGoogleZoomLevel(client.getCanvasSize().Width,zoom);newSettings.MinimumWidth=lonToMetres(dLon,point.lat);Map24.MapApplication.center(newSettings);break;case'viamichelin':map.changeMapScale(Math.floor(zoom/19*16));break;default:if(this.debug){alert(this.api+' not supported by Mapstraction.setZoom');}}};Mapstraction.prototype.autoCenterAndZoom=function(){if(this.loaded[this.api]===false){var me=this;this.onload[this.api].push(function(){me.autoCenterAndZoom();});return;}
var lat_max=-90;var lat_min=90;var lon_max=-180;var lon_min=180;for(var i=0;i<this.markers.length;i++){lat=this.markers[i].location.lat;lon=this.markers[i].location.lon;if(lat>lat_max){lat_max=lat;}
if(lat<lat_min){lat_min=lat;}
if(lon>lon_max){lon_max=lon;}
if(lon<lon_min){lon_min=lon;}}
for(var i=0;i<this.polylines.length;i++){for(var j=0;j<this.polylines[i].points.length;j++){lat=this.polylines[i].points[j].lat;lon=this.polylines[i].points[j].lon;if(lat>lat_max){lat_max=lat;}
if(lat<lat_min){lat_min=lat;}
if(lon>lon_max){lon_max=lon;}
if(lon<lon_min){lon_min=lon;}}}
this.setBounds(new BoundingBox(lat_min,lon_min,lat_max,lon_max));};Mapstraction.prototype.centerAndZoomOnPoints=function(points){var bounds=new BoundingBox(points[0].lat,points[0].lon,points[0].lat,points[0].lon);for(var i=1,len=points.length;i<len;i++){bounds.extend(points[i]);}
this.setBounds(bounds);};Mapstraction.prototype.getZoom=function(){if(this.loaded[this.api]===false){var me=this;return-1;}
var map=this.maps[this.api];switch(this.api){case'openspace':return map.zoom+6;case'yahoo':return 18-map.getZoomLevel();case'google':case'openstreetmap':return map.getZoom();case'openlayers':return map.zoom;case'microsoft':return map.GetZoomLevel();case'multimap':return map.getZoomFactor();case'mapquest':return map.getZoomLevel()+3;case'map24':var mv=map.MapClient['Static'].getCurrentMapView();var dLon=(mv.LowerRight.Longitude-mv.TopLeft.Longitude)/60;var width=map.MapClient['Static'].getCanvasSize().Width;var zoom=getGoogleZoomLevelFromDegrees(width,dLon);return Math.round(zoom);case'viamichelin':return Math.floor(map.getMapScale()/16*19);break;default:if(this.debug){alert(this.api+' not supported by Mapstraction.getZoom');}}};Mapstraction.ROAD=1;Mapstraction.SATELLITE=2;Mapstraction.HYBRID=3;Mapstraction.prototype.setBounds=function(bounds){if(this.loaded[this.api]===false){var me=this;this.onload[this.api].push(function(){me.setBounds(bounds);});return;}
var map=this.maps[this.api];var sw=bounds.getSouthWest();var ne=bounds.getNorthEast();switch(this.api){case'openspace':var obounds=new OpenSpace.MapBounds();obounds.extend(new LatLonPoint(sw.lat,sw.lon).toOpenSpace());obounds.extend(new LatLonPoint(ne.lat,ne.lon).toOpenSpace());map.zoomToExtent(obounds);break;case'google':case'openstreetmap':var gbounds=new GLatLngBounds(new GLatLng(sw.lat,sw.lon),new GLatLng(ne.lat,ne.lon));map.setCenter(gbounds.getCenter(),map.getBoundsZoomLevel(gbounds));break;case'openlayers':var obounds=new OpenLayers.Bounds();obounds.extend(new LatLonPoint(sw.lat,sw.lon).toOpenLayers());obounds.extend(new LatLonPoint(ne.lat,ne.lon).toOpenLayers());map.zoomToExtent(obounds);break;case'yahoo':if(sw.lon>ne.lon){sw.lon-=360;}
var center=new YGeoPoint((sw.lat+ne.lat)/2,(ne.lon+sw.lon)/2);var container=map.getContainerSize();for(var zoom=1;zoom<=17;zoom++){var sw_pix=convertLatLonXY_Yahoo(sw,zoom);var ne_pix=convertLatLonXY_Yahoo(ne,zoom);if(sw_pix.x>ne_pix.x){sw_pix.x-=(1<<(26-zoom));}
if(Math.abs(ne_pix.x-sw_pix.x)<=container.width&&Math.abs(ne_pix.y-sw_pix.y)<=container.height){map.drawZoomAndCenter(center,zoom);break;}}
break;case'microsoft':map.SetMapView([new VELatLong(sw.lat,sw.lon),new VELatLong(ne.lat,ne.lon)]);break;case'multimap':var mmlocation=map.getAutoScaleLocation([sw.toMultiMap(),ne.toMultiMap()]);map.goToPosition(mmlocation.coords,mmlocation.zoom_factor);break;case'mapquest':var mqcenter=new LatLonPoint((sw.lat+ne.lat)/2,(ne.lon+sw.lon)/2);var dLon=ne.lon-sw.lon;var mqsize=map.getSize();var zoom=getGoogleZoomLevelFromDegrees(mqsize.getWidth(),dLon);this.setCenterAndZoom(mqcenter,Math.floor(zoom));break;case'freeearth':var center=new LatLonPoint((sw.lat+ne.lat)/2,(ne.lon+sw.lon)/2);this.setCenter(center);break;case'map24':var settings={};settings.Latitude=((sw.lat+ne.lat)/2)*60;settings.Longitude=((sw.lon+ne.lon)/2)*60;settings.MinimumWidth=lonToMetres(ne.lon-sw.lon,(ne.lat+sw.lat)/2);settings.MinimumWidth*=2.4;Map24.MapApplication.center(settings);break;case'viamichelin':var vmpoints=new Array(new LatLonPoint(sw.lat,sw.lon),new LatLonPoint(ne.lat,ne.lon));var vmpoly=new VMPolyLine(vmpoints);map.addLayer(vmpoly);map.drawMapFromLayers();break;default:if(this.debug){alert(this.api+' not supported by Mapstraction.setBounds');}}};Mapstraction.prototype.setMapType=function(type){if(this.loaded[this.api]===false){var me=this;this.onload[this.api].push(function(){me.setMapType(type);});return;}
var map=this.maps[this.api];switch(this.api){case'yahoo':switch(type){case Mapstraction.ROAD:map.setMapType(YAHOO_MAP_REG);break;case Mapstraction.SATELLITE:map.setMapType(YAHOO_MAP_SAT);break;case Mapstraction.HYBRID:map.setMapType(YAHOO_MAP_HYB);break;default:map.setMapType(YAHOO_MAP_REG);}
break;case'google':case'openstreetmap':switch(type){case Mapstraction.ROAD:map.setMapType(G_NORMAL_MAP);break;case Mapstraction.SATELLITE:map.setMapType(G_SATELLITE_MAP);break;case Mapstraction.HYBRID:map.setMapType(G_HYBRID_MAP);break;default:map.setMapType(G_NORMAL_MAP);}
break;case'microsoft':switch(type){case Mapstraction.ROAD:map.SetMapStyle(Msn.VE.MapStyle.Road);break;case Mapstraction.SATELLITE:map.SetMapStyle(Msn.VE.MapStyle.Aerial);break;case Mapstraction.HYBRID:map.SetMapStyle(Msn.VE.MapStyle.Hybrid);break;default:map.SetMapStyle(Msn.VE.MapStyle.Road);}
break;case'multimap':maptypes=map.getAvailableMapTypes();maptype=-1;for(var i=0;i<maptypes.length;i++){switch(maptypes[i]){case MM_WORLD_MAP:if(type==Mapstraction.ROAD){maptype=maptypes[i];}
default_type=maptypes[i];break;case MM_WORLD_AERIAL:if(type==Mapstraction.SATELLITE){maptype=maptypes[i];}
break;case MM_WORLD_HYBRID:if(type==Mapstraction.HYBRID){maptype=maptypes[i];}
break;}}
if(maptype==-1){maptype=default_type;}
map.setMapType(maptype);break;case'mapquest':switch(type){case Mapstraction.ROAD:map.setMapType("map");break;case Mapstraction.SATELLITE:map.setMapType("sat");break;case Mapstraction.HYBRID:map.setMapType("hyb");break;}
break;case'viamichelin':map.activateSatelliteHybrid(true);break;default:if(this.debug){alert(this.api+' not supported by Mapstraction.setMapType');}}};Mapstraction.prototype.addJSON=function(json){var features;if(typeof(json)=="string"){features=eval('('+json+')');}else{features=json;}
features=features.features;var map=this.maps[this.api];var html="";var item;var polyline;var marker;var markers=[];if(features.type=="FeatureCollection"){this.addJSON(features.features);}
for(var i=0;i<features.length;i++){item=features[i];switch(item.geometry.type){case"Point":html="<strong>"+item.title+"</strong><p>"+item.description+"</p>";marker=new Marker(new LatLonPoint(item.geometry.coordinates[1],item.geometry.coordinates[0]));markers.push(marker);this.addMarkerWithData(marker,{infoBubble:html,label:item.title,date:"new Date(\""+item.date+"\")",iconShadow:item.icon_shadow,marker:item.id,date:"new Date(\""+item.date+"\")",iconShadowSize:item.icon_shadow_size,icon:"http://boston.openguides.org/markers/AQUA.png",iconSize:item.icon_size,category:item.source_id,draggable:false,hover:false});break;case"Polygon":var points=[];polyline=new Polyline(points);mapstraction.addPolylineWithData(polyline,{fillColor:item.poly_color,date:"new Date(\""+item.date+"\")",category:item.source_id,width:item.line_width,opacity:item.line_opacity,color:item.line_color,polygon:true});markers.push(polyline);default:}}
return markers;};Mapstraction.prototype.getMap=function(){return this.maps[this.api];};function LatLonPoint(lat,lon){this.lat=lat;this.lon=lon;this.lng=lon;}
LatLonPoint.prototype.toYahoo=function(){return new YGeoPoint(this.lat,this.lon);};LatLonPoint.prototype.toGoogle=function(){return new GLatLng(this.lat,this.lon);};LatLonPoint.prototype.toOpenLayers=function(){var ollon=this.lon*20037508.34/180;var ollat=Math.log(Math.tan((90+this.lat)*Math.PI/360))/(Math.PI/180);ollat=ollat*20037508.34/180;return new OpenLayers.LonLat(ollon,ollat);};LatLonPoint.prototype.fromOpenLayers=function(){var lon=(this.lon/20037508.34)*180;var lat=(this.lat/20037508.34)*180;lat=180/Math.PI*(2*Math.atan(Math.exp(lat*Math.PI/180))-Math.PI/2);this.lon=lon;this.lat=lat;};LatLonPoint.prototype.toMicrosoft=function(){return new VELatLong(this.lat,this.lon);};LatLonPoint.prototype.toMultiMap=function(){return new MMLatLon(this.lat,this.lon);};LatLonPoint.prototype.toMapQuest=function(){return new MQA.LatLng(this.lat,this.lon);};LatLonPoint.prototype.toFreeEarth=function(){return new FE.LatLng(this.lat,this.lon);};LatLonPoint.prototype.toMap24=function(){return new Map24.Point(this.lon,this.lat);};LatLonPoint.prototype.toOpenSpace=function(){var lonlat=new OpenLayers.LonLat(this.lon,this.lat);var gridProjection=new OpenSpace.GridProjection();return gridProjection.getMapPointFromLonLat(lonlat);};LatLonPoint.prototype.fromOpenSpace=function(osPoint){var gridProjection=new OpenSpace.GridProjection();olpt=gridProjection.getLonLatFromMapPoint(osPoint);this.lon=olpt.lon;this.lat=olpt.lat;};LatLonPoint.prototype.toViaMichelin=function(){return new VMLonLat(this.lon,this.lat);};LatLonPoint.prototype.toString=function(){return this.lat+', '+this.lon;};LatLonPoint.prototype.distance=function(otherPoint){var d,dr;dr=0.017453292519943295;d=Math.cos(otherPoint.lon*dr-this.lon*dr)*Math.cos(otherPoint.lat*dr-this.lat*dr);return Math.acos(d)*6378.137;};LatLonPoint.prototype.equals=function(otherPoint){return this.lat==otherPoint.lat&&this.lon==otherPoint.lon;};function BoundingBox(swlat,swlon,nelat,nelon){this.sw=new LatLonPoint(swlat,swlon);this.ne=new LatLonPoint(nelat,nelon);}
BoundingBox.prototype.getSouthWest=function(){return this.sw;};BoundingBox.prototype.getNorthEast=function(){return this.ne;};function Marker(point){this.location=point;this.onmap=false;this.proprietary_marker=false;this.attributes=[];this.pinID="mspin-"+new Date().getTime()+'-'+(Math.floor(Math.random()*Math.pow(2,16)));}
Marker.prototype.setChild=function(some_proprietary_marker){this.proprietary_marker=some_proprietary_marker;this.onmap=true;};Marker.prototype.setLabel=function(labelText){this.labelText=labelText;};Marker.prototype.setInfoBubble=function(infoBubble){this.infoBubble=infoBubble;};Marker.prototype.setInfoDiv=function(infoDiv,div){this.infoDiv=infoDiv;this.div=div;};Marker.prototype.setIcon=function(iconUrl,iconSize,iconAnchor){this.iconUrl=iconUrl;if(iconSize){this.iconSize=iconSize;}
if(iconAnchor){this.iconAnchor=iconAnchor;}};Marker.prototype.setIconSize=function(iconSize){if(iconSize){this.iconSize=iconSize;}};Marker.prototype.setIconAnchor=function(iconAnchor){if(iconAnchor){this.iconAnchor=iconAnchor;}};Marker.prototype.setShadowIcon=function(iconShadowUrl,iconShadowSize){this.iconShadowUrl=iconShadowUrl;if(iconShadowSize){this.iconShadowSize=iconShadowSize;}};Marker.prototype.setHoverIcon=function(hoverIconUrl){this.hoverIconUrl=hoverIconUrl;};Marker.prototype.setDraggable=function(draggable){this.draggable=draggable;};Marker.prototype.setHover=function(hover){this.hover=hover;};Marker.prototype.setGroupName=function(sGrpName){this.groupName=sGrpName;};Marker.prototype.toYahoo=function(){var ymarker;var size;if(this.iconSize){size=new YSize(this.iconSize[0],this.iconSize[1]);}
if(this.iconUrl){if(this.iconSize)
ymarker=new YMarker(this.location.toYahoo(),new YImage(this.iconUrl,size));else
ymarker=new YMarker(this.location.toYahoo(),new YImage(this.iconUrl));}
else{if(this.iconSize)
ymarker=new YMarker(this.location.toYahoo(),null,size);else
ymarker=new YMarker(this.location.toYahoo());}
if(this.labelText){ymarker.addLabel(this.labelText);}
if(this.infoBubble){var theInfo=this.infoBubble;var event_action;if(this.hover){event_action=EventsList.MouseOver;}
else{event_action=EventsList.MouseClick;}
YEvent.Capture(ymarker,event_action,function(){ymarker.openSmartWindow(theInfo);});}
if(this.infoDiv){var theInfo=this.infoDiv;var div=this.div;var event_div;if(this.hover){event_action=EventsList.MouseOver;}
else{event_action=EventsList.MouseClick;}
YEvent.Capture(ymarker,event_action,function(){document.getElementById(div).innerHTML=theInfo;});}
return ymarker;};Marker.prototype.toGoogle=function(){var options={};if(this.labelText){options.title=this.labelText;}
if(this.iconUrl){var icon=new GIcon(G_DEFAULT_ICON,this.iconUrl);if(this.iconSize){icon.iconSize=new GSize(this.iconSize[0],this.iconSize[1]);var anchor;if(this.iconAnchor){anchor=new GPoint(this.iconAnchor[0],this.iconAnchor[1]);}
else{anchor=new GPoint(this.iconSize[0]/2,this.iconSize[1]/2);}
icon.iconAnchor=anchor;}
if(this.iconShadowUrl){icon.shadow=this.iconShadowUrl;if(this.iconShadowSize){icon.shadowSize=new GSize(this.iconShadowSize[0],this.iconShadowSize[1]);}}
options.icon=icon;}
if(this.draggable){options.draggable=this.draggable;}
var gmarker=new GMarker(this.location.toGoogle(),options);if(this.infoBubble){var theInfo=this.infoBubble;var event_action;if(this.hover){event_action="mouseover";}
else{event_action="click";}
GEvent.addListener(gmarker,event_action,function(){gmarker.openInfoWindowHtml(theInfo,{maxWidth:100});});}
if(this.hoverIconUrl){GEvent.addListener(gmarker,"mouseover",function(){gmarker.setImage(this.hoverIconUrl);});GEvent.addListener(gmarker,"mouseout",function(){gmarker.setImage(this.iconUrl);});}
if(this.infoDiv){var theInfo=this.infoDiv;var div=this.div;var event_action;if(this.hover){event_action="mouseover";}
else{event_action="click";}
GEvent.addListener(gmarker,event_action,function(){document.getElementById(div).innerHTML=theInfo;});}
return gmarker;};Marker.prototype.toOpenLayers=function(){var size,anchor,icon;if(this.iconSize){size=new OpenLayers.Size(this.iconSize[0],this.iconSize[1]);}
else{size=new OpenLayers.Size(21,25);}
if(this.iconAnchor){anchor=new OpenLayers.Pixel(this.iconAnchor[0],this.iconAnchor[1]);}
else{anchor=new OpenLayers.Pixel(-(size.w/2),-size.h);}
if(this.iconUrl){icon=new OpenLayers.Icon(this.iconUrl,size,anchor);}
else{icon=new OpenLayers.Icon('http://openlayers.org/dev/img/marker-gold.png',size,anchor);}
var marker=new OpenLayers.Marker(this.location.toOpenLayers(),icon);if(this.infoBubble){var popup=new OpenLayers.Popup(null,this.location.toOpenLayers(),new OpenLayers.Size(100,100),this.infoBubble,true);popup.autoSize=true;var theMap=this.map;if(this.hover){marker.events.register("mouseover",marker,function(event){theMap.addPopup(popup);popup.show();});marker.events.register("mouseout",marker,function(event){popup.hide();theMap.removePopup(popup);});}
else{var shown=false;marker.events.register("mousedown",marker,function(event){if(shown){popup.hide();theMap.removePopup(popup);shown=false;}else{theMap.addPopup(popup);popup.show();shown=true;}});}}
if(this.hoverIconUrl){}
if(this.infoDiv){}
return marker;};Marker.prototype.toOpenSpace=function(){var size,anchor,icon;if(this.iconSize){size=new OpenLayers.Size(this.iconSize[0],this.iconSize[1]);}
else{size=new OpenLayers.Size(20,25);}
if(this.iconAnchor){anchor=new OpenLayers.Pixel(this.iconAnchor[0],this.iconAnchor[1]);}
else{anchor=new OpenLayers.Pixel(-(size.w/2),-size.h);}
if(this.iconUrl){icon=new OpenSpace.Icon(this.iconUrl,size,anchor);}
else{}
var marker=new OpenLayers.Marker(this.location.toOpenSpace(),icon);return marker;};Marker.prototype.toMicrosoft=function(){var pin=new VEPushpin(this.pinID,this.location.toMicrosoft(),this.iconUrl,this.labelText,this.infoBubble);return pin;};Marker.prototype.toMap24=function(){var ops={};ops.Longitude=this.location.lon*60;ops.Latitude=this.location.lat*60;if(this.infoBubble){ops.TooltipContent=this.infoBubble;}
if(this.labelText){}
ops.LogoURL=this.iconUrl;ops.SymbolId=20947;ops.TooltipLayout=Map24.MapObject.LAYOUT_BUBBLE;if(this.hover){ops.TooltipOpen="OnMouseOver";}else{ops.TooltipOpen="OnClick";}
var m24Location=new Map24.Location(ops);return m24Location;};Marker.prototype.toMultiMap=function(){var mmmarkeropts={};if(this.iconUrl){mmmarkeropts.icon=new MMIcon(this.iconUrl);if(this.iconSize){mmmarkeropts.icon.iconSize=new MMDimensions(this.iconSize[0],this.iconSize[1]);}
else{}
if(this.iconAnchor){mmmarkeropts.icon.iconAnchor=new MMPoint(this.iconAnchor[0],this.iconAnchor[1]);}
if(this.groupName){mmmarkeropts.icon.groupName=this.groupName;}}
if(this.labelText){mmmarkeropts.label=this.labelText;}
var mmmarker=new MMMarkerOverlay(this.location.toMultiMap(),mmmarkeropts);if(this.infoBubble){mmmarker.setInfoBoxContent(this.infoBubble);}
if(this.infoDiv){}
for(var key in this.attributes){mmmarker.setAttribute(key,this.attributes[key]);}
return mmmarker;};Marker.prototype.toMapQuest=function(){var mqmarker=new MQA.Poi(this.location.toMapQuest());if(this.iconUrl){var mqicon=new MQA.MapIcon();mqicon.setImage(this.iconUrl,32,32,true,false);mqmarker.setIcon(mqicon);}
if(this.labelText){mqmarker.setInfoTitleHTML(this.labelText);}
if(this.infoBubble){mqmarker.setInfoContentHTML(this.infoBubble);}
if(this.infoDiv){var theInfo=this.infoDiv;var div=this.div;MQA.EventManager.addListener(mqmarker,"click",function(){document.getElementById(div).innerHTML=theInfo;});}
return mqmarker;};Marker.prototype.toFreeEarth=function(){var feicon;if(this.iconUrl){feicon=new FE.Icon(this.iconUrl);}else{feicon=new FE.Icon("http://freeearth.poly9.com/images/bullmarker.png");}
var femarker=new FE.Pushpin(this.location.toFreeEarth(),feicon);if(this.infoBubble){var theBubble=this.infoBubble;FE.Event.addListener(femarker,'click',function(){femarker.openInfoWindowHtml(theBubble,200,100);});}
if(this.infoDiv){var theInfo=this.infoDiv;var div=this.div;FE.Event.addListener(femarker,'click',function(){document.getElementById(div).innerHTML=theInfo;});}
return femarker;};Marker.prototype.toViaMichelin=function(){var vmicon=null;if(this.iconUrl){if(this.iconSize)
vmicon=new VMIcon(this.iconUrl,this.iconSize[0],this.iconSize[1]);else
vmicon=new VMIcon(this.iconUrl);}
var vmmarker=new VMIconLayer(this.location.toViaMichelin(),vmicon,this.infoBubble);return vmmarker;}
Marker.prototype.setAttribute=function(key,value){this.attributes[key]=value;};Marker.prototype.getAttribute=function(key){return this.attributes[key];};Marker.prototype.openBubble=function(){if(this.mapstraction.loaded[this.api]===false){var my_marker=this;this.mapstraction.onload[this.api].push(function(){my_marker.openBubble();});return;}
if(this.api){switch(this.api){case'yahoo':var ypin=this.proprietary_marker;ypin.openSmartWindow(this.infoBubble);break;case'google':case'openstreetmap':var gpin=this.proprietary_marker;gpin.openInfoWindowHtml(this.infoBubble);break;case'microsoft':var pin=this.proprietary_marker;var el=$m(this.pinID+"_"+this.maps[this.api].GUID).onmouseover;setTimeout(el,1000);break;case'multimap':this.proprietary_marker.openInfoBox();break;case'mapquest':this.proprietary_marker.setRolloverEnabled(false);this.proprietary_marker.showInfoWindow();this.proprietary_marker.setRolloverEnabled(true);break;}}else{if(this.debug){alert('You need to add the marker before opening it');}}};Marker.prototype.hide=function(){if(this.api){switch(this.api){case'google':case'openstreetmap':this.proprietary_marker.hide();break;case'openlayers':case'openspace':this.proprietary_marker.display(false);break;case'yahoo':this.proprietary_marker.hide();break;case'map24':this.proprietary_marker.hide();break;case'multimap':this.proprietary_marker.setVisibility(false);break;case'mapquest':this.proprietary_marker.setVisible(false);break;case'viamichelin':default:if(this.debug){alert(this.api+"not supported by Marker.hide");}}}};Marker.prototype.show=function(){if(this.api){switch(this.api){case'google':case'openstreetmap':this.proprietary_marker.show();break;case'openlayers':case'openspace':this.proprietary_marker.display(true);break;case'map24':this.proprietary_marker.show();break;case'yahoo':this.proprietary_marker.unhide();break;case'multimap':this.proprietary_marker.setVisibility(true);break;case'mapquest':this.proprietary_marker.setVisible(true);break;case'viamichelin':default:if(this.debug){alert(this.api+"not supported by Marker.show");}}}};window.mxn={'LatLonPoint':LatLonPoint,'Mapstraction':Mapstraction,'Marker':Marker,'fn':{'metresToLon':metresToLon,'lonToMetres':lonToMetres,'loadScript':loadScript},activatePolluteMode:function(){if(window.LatLonPoint||window.Mapstraction||window.Marker){alert('Warning: Mapstraction pollute mode naming clash.');}
window['LatLonPoint']=LatLonPoint;window['Mapstraction']=Mapstraction;window['Marker']=Marker;}};})();mxn.activatePolluteMode();