// (c)2007 Mapstraction Team- http://mapstraction.com
function $m(){var C=new Array();for(var B=0;B<arguments.length;B++){var A=arguments[B];if(typeof A=="string"){A=document.getElementById(A);}if(arguments.length==1){return A;}C.push(A);}return C;}function loadScript(C,D){var A=document.createElement("script");A.type="text/javascript";A.src=C;if(D){var B=new Object();B.handleEvent=function(E){D();};A.addEventListener("load",B,true);}document.getElementsByTagName("head")[0].appendChild(A);return ;}function convertLatLonXY_Yahoo(A,H){var D=1<<(26-H);var F=D/360;var G=D/(2*Math.PI);var C=new YCoordPoint(D/2,D/2);var E=new YCoordPoint();E.x=Math.floor(C.x+A.lon*F);var B=Math.sin(A.lat*Math.PI/180);E.y=Math.floor(C.y+0.5*Math.log((1+B)/(1-B))*-G);return E;}function loadStyle(A){var B=document.createElement("link");B.type="text/css";B.rel="stylesheet";B.href=A;document.getElementsByTagName("head")[0].appendChild(B);return ;}function getStyle(A,C){var B;if(A.currentStyle){B=A.currentStyle[C];}else{if(window.getComputedStyle){B=window.getComputedStyle(A,"").getPropertyValue(C);}}return B;}function lonToMetres(B,A){return B*111200*Math.cos(A*(Math.PI/180));}function metresToLon(A,B){return A/(111200*Math.cos(B*(Math.PI/180)));}function getDegreesFromGoogleZoomLevel(B,A){return(360*B)/(Math.pow(2,A+8));}function getGoogleZoomLevelFromDegrees(B,A){return logN((360*B)/A,2)-8;}function logN(A,B){return Math.log(A)/Math.log(B);}function Mapstraction(B,C,A){this.api=C;this.maps=new Object();this.currentElement=$m(B);this.eventListeners=new Array();this.markers=new Array();this.layers=new Array();this.polylines=new Array();this.images=new Array();this.loaded=new Object();this.onload=new Object();if(A==true){this.debug=true;}else{this.debug=false;}this.svn_revision_string="$Revision$";this.addControlsArgs=new Object();if(this.currentElement){this.addAPI($m(B),C);}}Mapstraction.prototype.swap=function(C,D){if(this.api==D){return ;}var A=this.getCenter();var E=this.getZoom();this.currentElement.style.visibility="hidden";this.currentElement.style.display="none";this.currentElement=$m(C);this.currentElement.style.visibility="visible";this.currentElement.style.display="block";this.api=D;if(this.maps[this.api]==undefined){this.addAPI($m(C),D);this.setCenterAndZoom(A,E);for(var B=0;B<this.markers.length;B++){this.addMarker(this.markers[B],true);}for(var B=0;B<this.polylines.length;B++){this.addPolyline(this.polylines[B],true);}}else{this.setCenterAndZoom(A,E);}this.addControls(this.addControlsArgs);};Mapstraction.prototype.addAPI=function(A,E){var G=this;this.loaded[E]=false;this.onload[E]=new Array();switch(E){case"yahoo":if(YMap){this.maps[E]=new YMap(A);YEvent.Capture(this.maps[E],EventsList.MouseClick,function(P,O){G.clickHandler(O.Lat,O.Lon,O,G);});YEvent.Capture(this.maps[E],EventsList.changeZoom,function(){G.moveendHandler(G);});YEvent.Capture(this.maps[E],EventsList.endPan,function(){G.moveendHandler(G);});this.loaded[E]=true;}else{alert("Yahoo map script not imported");}break;case"google":if(GMap2){if(GBrowserIsCompatible()){this.maps[E]=new GMap2(A);GEvent.addListener(this.maps[E],"click",function(P,O){if(O){G.clickHandler(O.y,O.x,O,G);}});GEvent.addListener(this.maps[E],"moveend",function(){G.moveendHandler(G);});this.loaded[E]=true;}else{alert("browser not compatible with Google Maps");}}else{alert("Google map script not imported");}break;case"microsoft":if(VEMap){A.style.position="relative";var B=parseFloat(getStyle($m(A),"width"));var C=parseFloat(getStyle($m(A),"height"));var D=0;var N="Firefox/";var L=navigator.userAgent.indexOf(N);if(L!=-1){D=parseFloat(navigator.userAgent.substring(L+N.length));}if(D>=1.5){Msn.Drawing.Graphic.CreateGraphic=function(P,O){return new Msn.Drawing.SVGGraphic(P,O);};}this.maps[E]=new VEMap(A.id);this.maps[E].LoadMap();this.maps[E].AttachEvent("onclick",function(O){G.clickHandler(O.view.LatLong.Latitude,O.view.LatLong.Longitude,G);});this.maps[E].AttachEvent("onchangeview",function(O){G.moveendHandler(G);});this.resizeTo(B,C);this.loaded[E]=true;}else{alert("Virtual Earth script not imported");}break;case"openlayers":this.maps[E]=new OpenLayers.Map(A.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://tile.openstreetmap.org/",{type:"png",getURL:function(S){var R=this.map.getResolution();var O=Math.round((S.left-this.maxExtent.left)/(R*this.tileSize.w));var V=Math.round((this.maxExtent.top-S.top)/(R*this.tileSize.h));var U=this.map.getZoom();var P=Math.pow(2,U);if(V<0||V>=P){return null;}else{O=((O%P)+P)%P;var T=U+"/"+O+"/"+V+"."+this.type;var Q=this.url;if(Q instanceof Array){Q=this.selectUrl(T,Q);}return Q+T;}},displayOutsideMaxExtent:true});this.layers["osm"]=new OpenLayers.Layer.TMS("OSM",["http://osm-tah-cache.firefishy.com/~ojw/Tiles/tile.php/","http://osm.mitago.net/Tiles/tile.php/","http://osm.terantula.com/Tiles/tile.php/","http://osm.glasgownet.com/Tiles/tile.php/"],{type:"png",getURL:function(S){var R=this.map.getResolution();var O=Math.round((S.left-this.maxExtent.left)/(R*this.tileSize.w));var V=Math.round((this.maxExtent.top-S.top)/(R*this.tileSize.h));var U=this.map.getZoom();var P=Math.pow(2,U);if(V<0||V>=P){return null;}else{O=((O%P)+P)%P;var T=U+"/"+O+"/"+V+"."+this.type;var Q=this.url;if(Q instanceof Array){Q=this.selectUrl(T,Q);}return Q+T;}},displayOutsideMaxExtent:true});this.maps[E].addLayer(this.layers["osmmapnik"]);this.maps[E].addLayer(this.layers["osm"]);this.loaded[E]=true;break;case"openstreetmap":if(GMap2){if(GBrowserIsCompatible()){this.maps[E]=new GMap2(A);GEvent.addListener(this.maps[E],"click",function(P,O){if(O){G.clickHandler(O.y,O.x,O,G);}});GEvent.addListener(this.maps[E],"moveend",function(){G.moveendHandler(G);});var F=new GCopyright(1,new GLatLngBounds(new GLatLng(-90,-180),new GLatLng(90,180)),0,"copyleft");var I=new GCopyrightCollection("OSM");I.addCopyright(F);var K=new Array();K[0]=new GTileLayer(I,1,18);K[0].getTileUrl=function(P,O){return"http://tile.openstreetmap.org/"+O+"/"+P.x+"/"+P.y+".png";};K[0].isPng=function(){return true;};K[0].getOpacity=function(){return 1;};var H=new GMapType(K,new GMercatorProjection(19),"OSM",{errorMessage:"More OSM coming soon"});this.maps[E].addMapType(H);this.loaded[E]=true;var J=new LatLonPoint(50.6805,-1.4062505);this.setCenterAndZoom(J,11);this.maps[E].setMapType(H);}else{alert("browser not compatible with Google Maps");}}else{alert("Google map script not imported");}break;case"multimap":this.maps[E]=new MultimapViewer(A);this.maps[E].addEventHandler("click",function(R,S,Q,P,O){if(Q){G.clickHandler(Q.lat,Q.lon,G);}});this.maps[E].addEventHandler("changeZoom",function(R,S,Q,P,O){G.moveendHandler(G);});this.maps[E].addEventHandler("endPan",function(R,S,Q,P,O){G.moveendHandler(G);});this.loaded[E]=true;break;case"map24":if(Map24){Map24.loadApi(["core_api","wrapper_api"],function(){Map24.MapApplication.init({NodeName:A.id,MapType:"Static"});G.maps[E]=Map24.MapApplication.Map;Map24.MapApplication.Map.addListener("Map24.Event.MapClick",function(Q){G.clickHandler(Q.Coordinate.Latitude/60,Q.Coordinate.Longitude/60,G);Q.stop();});Map24.MapApplication.Map.addListener("MapPanStop",function(Q){G.moveendHandler(G);});var O=Map24.MapApplication.Map.MapClient["Static"];G.loaded[E]=true;for(var P=0;P<G.onload[E].length;P++){G.onload[E][P]();}},"2.0.1247");}else{alert("map24 api not loaded");}break;case"mapquest":var M=this;MQInitOverlays(function(){M.loaded[E]=true;M.maps[E]=new MQTileMap(A);for(var O=0;O<M.onload[E].length;O++){M.onload[E][O]();}});break;case"freeearth":this.maps[E]=new FE.Map($m(A));var M=this;this.maps[E].onLoad=function(){M.freeEarthLoaded=true;M.loaded[E]=true;for(var O=0;O<M.onload[E].length;O++){M.onload[E][O]();}};this.maps[E].load();break;default:if(this.debug){alert(E+" not supported by mapstraction");}}};Mapstraction.prototype.isLoaded=function(A){if(A==null){A=this.api;}return this.loaded[A];};Mapstraction.prototype.setDebug=function(A){if(A!=null){return this.debug=A;}else{return this.debug;}};Mapstraction.prototype.resizeTo=function(C,A){if(this.loaded[this.api]==false){var B=this;this.onload[this.api].push(function(){B.resizeTo(C,A);});return ;}switch(this.api){case"yahoo":this.maps[this.api].resizeTo(new YSize(C,A));break;case"google":case"openstreetmap":this.currentElement.style.width=C;this.currentElement.style.height=A;this.maps[this.api].checkResize();break;case"openlayers":this.currentElement.style.width=C;this.currentElement.style.height=A;this.maps[this.api].updateSize();break;case"microsoft":this.maps[this.api].Resize(C,A);break;case"multimap":this.currentElement.style.width=C;this.currentElement.style.height=A;this.maps[this.api].resize();break;case"mapquest":this.currentElement.style.width=C;this.currentElement.style.height=A;this.maps[this.api].setSize(new MQSize(C,A));break;case"map24":Map24.MapApplication.Map.Canvas["c"].resizeTo(C,A);break;}};Mapstraction.prototype.clickHandler=function(C,D,B){for(var A=0;A<this.eventListeners.length;A++){if(this.eventListeners[A][1]=="click"){this.eventListeners[A][0](new LatLonPoint(C,D));}}};Mapstraction.prototype.moveendHandler=function(B){for(var A=0;A<this.eventListeners.length;A++){if(this.eventListeners[A][1]=="moveend"){this.eventListeners[A][0]();}}};Mapstraction.prototype.addEventListener=function(A,B){var C=new Array();C.push(B);C.push(A);this.eventListeners.push(C);switch(this.api){case"openlayers":this.maps[this.api].events.register(A,this,B);break;}};Mapstraction.prototype.addControls=function(args){if(this.loaded[this.api]==false){var myself=this;this.onload[this.api].push(function(){myself.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=new Array();}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"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=new Array();}c=this.controls;if(args.pan){c.unshift(new MQPanControl());map.addControl(c[0],new MQMapCornerPlacement(MQMapCorner.TOP_LEFT,new MQSize(0,0)));}if(args.zoom=="large"){c.unshift(new MQLargeZoomControl());map.addControl(c[0],new MQMapCornerPlacement(MQMapCorner.TOP_LEFT,new MQSize(0,0)));}else{if(args.zoom=="small"){c.unshift(new MQZoomControl());map.addControl(c[0],new MQMapCornerPlacement(MQMapCorner.BOTTOM_LEFT,new MQSize(0,0)));}}if(args.map_type){c.unshift(new MQViewControl());map.addControl(c[0],new MQMapCornerPlacement(MQMapCorner.TOP_RIGHT,new MQSize(0,0)));}break;}};Mapstraction.prototype.addSmallControls=function(){if(this.loaded[this.api]==false){var A=this;this.onload[this.api].push(function(){A.addSmallControls();});return ;}var B=this.maps[this.api];switch(this.api){case"yahoo":B.addPanControl();B.addZoomShort();this.addControlsArgs.pan=true;this.addControlsArgs.zoom="small";break;case"google":case"openstreetmap":B.addControl(new GSmallMapControl());this.addControlsArgs.zoom="small";break;case"openlayers":B.addControl(new OpenLayers.Control.ZoomBox());B.addControl(new OpenLayers.Control.LayerSwitcher({"ascending":false}));break;case"multimap":smallPanzoomWidget=new MMSmallPanZoomWidget();B.addWidget(smallPanzoomWidget);this.addControlsArgs.pan=true;this.addControlsArgs.zoom="small";break;case"mapquest":B.addControl(new MQZoomControl(B));B.addControl(new PanControl(B));this.addControlsArgs.pan=true;this.addControlsArgs.zoom="small";break;}};Mapstraction.prototype.addLargeControls=function(){if(this.loaded[this.api]==false){var A=this;this.onload[this.api].push(function(){A.addLargeControls();});return ;}var B=this.maps[this.api];switch(this.api){case"yahoo":B.addPanControl();B.addZoomLong();this.addControlsArgs.pan=true;this.addControlsArgs.zoom="large";break;case"openlayers":B.addControl(new OpenLayers.Control.PanZoomBar());break;case"google":B.addControl(new GMapTypeControl());B.addControl(new GOverviewMapControl());this.addControlsArgs.overview=true;this.addControlsArgs.map_type=true;case"openstreetmap":B.addControl(new GLargeMapControl());B.addControl(new GScaleControl());this.addControlsArgs.pan=true;this.addControlsArgs.zoom="large";this.addControlsArgs.scale=true;break;case"multimap":panzoomWidget=new MMPanZoomWidget();B.addWidget(panzoomWidget);this.addControlsArgs.pan=true;this.addControlsArgs.zoom="large";break;case"mapquest":B.addControl(new MQLargeZoomControl(B));B.addControl(new PanControl(B));B.addControl(new MQViewControl(B));this.addControlsArgs.pan=true;this.addControlsArgs.zoom="large";this.addControlsArgs.map_type=true;break;}};Mapstraction.prototype.addMapTypeControls=function(){if(this.loaded[this.api]==false){var A=this;this.onload[this.api].push(function(){A.addMapTypeControls();});return ;}var B=this.maps[this.api];switch(this.api){case"yahoo":B.addTypeControl();break;case"google":case"openstreetmap":B.addControl(new GMapTypeControl());break;case"multimap":B.addWidget(new MMMapTypeWidget());break;case"mapquest":B.addControl(new MQViewControl(B));break;case"openlayers":B.addControl(new OpenLayers.Control.LayerSwitcher({"ascending":false}));break;}};Mapstraction.prototype.dragging=function(A){if(this.loaded[this.api]==false){var B=this;this.onload[this.api].push(function(){B.dragging(A);});return ;}var C=this.maps[this.api];switch(this.api){case"google":case"openstreetmap":if(A){C.enableDragging();}else{C.disableDragging();}break;case"yahoo":if(A){C.enableDragMap();}else{C.disableDragMap();}break;case"multimap":if(A){C.setOption("drag","dragmap");}else{C.setOption("drag","");}break;case"mapquest":C.enableDragging(A);break;}};Mapstraction.prototype.setCenterAndZoom=function(B,G){if(this.loaded[this.api]==false){var E=this;this.onload[this.api].push(function(){E.setCenterAndZoom(B,G);});return ;}var H=this.maps[this.api];switch(this.api){case"yahoo":var F=18-G;H.drawZoomAndCenter(B.toYahoo(),F);break;case"google":case"openstreetmap":H.setCenter(B.toGoogle(),G);break;case"microsoft":H.SetCenterAndZoom(B.toMicrosoft(),G);break;case"openlayers":H.setCenter(B.toOpenLayers(),G);break;case"multimap":H.goToPosition(new MMLatLon(B.lat,B.lng));H.setZoomFactor(G);break;case"map24":var A=new Object();A.Latitude=B.lat*60;A.Longitude=B.lon*60;var C=H.MapClient["Static"];var D=getDegreesFromGoogleZoomLevel(C.getCanvasSize().Width,G);A.MinimumWidth=lonToMetres(D,B.lat);Map24.MapApplication.center(A);break;case"mapquest":H.setCenter(new MQLatLng(B.lat,B.lng),G-3);break;case"freeearth":if(this.freeEarthLoaded){H.setTargetLatLng(B.toFreeEarth());}else{var E=this;this.freeEarthOnLoad.push(function(){E.setCenterAndZoom(B);});}break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.setCenterAndZoom");}}};Mapstraction.prototype.addMarker=function(G,F){if(this.loaded[this.api]==false){var L=this;this.onload[this.api].push(function(){L.addMarker(G,F);});return ;}var B=this.maps[this.api];G.api=this.api;G.map=this.maps[this.api];switch(this.api){case"yahoo":var H=G.toYahoo();G.setChild(H);B.addOverlay(H);if(!F){this.markers.push(G);}break;case"google":case"openstreetmap":var D=G.toGoogle();G.setChild(D);B.addOverlay(D);if(!F){this.markers.push(G);}break;case"microsoft":var J=G.toMicrosoft();G.setChild(J);B.AddPushpin(J);if(!F){this.markers.push(G);}break;case"openlayers":if(!this.layers["markers"]){this.layers["markers"]=new OpenLayers.Layer.Markers("markers");B.addLayer(this.layers["markers"]);}var E=G.toOpenLayers();G.setChild(E);this.layers["markers"].addMarker(E);if(!F){this.markers.push(G);}break;case"multimap":var C=G.toMultiMap();G.setChild(C);B.addOverlay(C);if(!F){this.markers.push(G);}break;case"map24":var I=G.toMap24();G.setChild(I);I.commit();if(!F){this.markers.push(G);}break;case"mapquest":var A=G.toMapQuest();G.setChild(A);B.addPoi(A);if(!F){this.markers.push(G);}break;case"freeearth":var K=G.toFreeEarth();G.setChild(K);B.addOverlay(K);if(!F){this.markers.push(G);}break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.addMarker");}}};Mapstraction.prototype.addMarkerWithData=function(A,B){A.addData(B);this.addMarker(A);};Mapstraction.prototype.addPolylineWithData=function(A,B){A.addData(B);this.addPolyline(A);};Mapstraction.prototype.removeMarker=function(A){if(this.loaded[this.api]==false){var B=this;this.onload[this.api].push(function(){B.removeMarker(A);});return ;}var C=this.maps[this.api];var D=new Array();while(this.markers.length>0){current_marker=this.markers.pop();if(A==current_marker){switch(this.api){case"google":case"openstreetmap":C.removeOverlay(A.proprietary_marker);break;case"yahoo":C.removeOverlay(A.proprietary_marker);break;case"microsoft":C.DeletePushpin(A.pinID);break;case"multimap":C.removeOverlay(A.proprietary_marker);break;case"mapquest":C.removePoi(A.proprietary_marker);break;case"map24":A.proprietary_marker.remove();break;case"openlayers":this.layers["markers"].removeMarker(A.proprietary_marker);A.proprietary_marker.destroy();break;}A.onmap=false;break;}else{D.push(current_marker);}}this.markers=this.markers.concat(D);};Mapstraction.prototype.removeAllMarkers=function(){if(this.loaded[this.api]==false){var A=this;this.onload[this.api].push(function(){A.removeAllMarkers();});return ;}var C=this.maps[this.api];switch(this.api){case"yahoo":C.removeMarkersAll();break;case"google":case"openstreetmap":C.clearOverlays();break;case"microsoft":C.DeleteAllPushpins();break;case"multimap":C.removeAllOverlays();break;case"mapquest":C.removeAllPois();break;case"map24":var B;while(this.markers.length>0){B=this.markers.pop();B.proprietary_marker.remove();}break;case"openlayers":this.layers["markers"].clearMarkers();break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.removeAllMarkers");}}this.markers=new Array();};Mapstraction.prototype.addPolyline=function(B,A){if(this.loaded[this.api]==false){var C=this;this.onload[this.api].push(function(){C.addPolyline(B,A);});return ;}var E=this.maps[this.api];switch(this.api){case"yahoo":ypolyline=B.toYahoo();B.setChild(ypolyline);E.addOverlay(ypolyline);if(!A){this.polylines.push(B);}break;case"google":case"openstreetmap":gpolyline=B.toGoogle();B.setChild(gpolyline);E.addOverlay(gpolyline);if(!A){this.polylines.push(B);}break;case"microsoft":mpolyline=B.toMicrosoft();B.setChild(mpolyline);E.AddPolyline(mpolyline);if(!A){this.polylines.push(B);}break;case"openlayers":if(this.debug){alert(this.api+" not supported by Mapstraction.addPolyline");}break;case"multimap":mmpolyline=B.toMultiMap();B.setChild(mmpolyline);E.addOverlay(mmpolyline);if(!A){this.polylines.push(B);}break;case"mapquest":mqpolyline=B.toMapQuest();B.setChild(mqpolyline);E.addOverlay(mqpolyline);if(!A){this.polylines.push(B);}break;case"map24":var D=B.toMap24();B.setChild(D);D.commit();if(!A){this.polylines.push(B);}break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.addPolyline");}}};Mapstraction.prototype.removePolyline=function(A){if(this.loaded[this.api]==false){var B=this;this.onload[this.api].push(function(){B.removePolyline(A);});return ;}var C=this.maps[this.api];var D=new Array();while(this.polylines.length>0){current_polyline=this.polylines.pop();if(A==current_polyline){switch(this.api){case"google":case"openstreetmap":C.removeOverlay(A.proprietary_polyline);break;case"yahoo":C.removeOverlay(A.proprietary_polyline);break;case"microsoft":C.DeletePolyline(A.pllID);break;case"multimap":A.proprietary_polyline.remove();break;case"mapquest":C.removeOverlay(A.proprietary_polyline);break;case"map24":A.proprietary_polyline.remove();break;}A.onmap=false;break;}else{D.push(current_polyline);}}this.polylines=this.polylines.concat(D);};Mapstraction.prototype.removeAllPolylines=function(){if(this.loaded[this.api]==false){var C=this;this.onload[this.api].push(function(){C.removeAllPolylines();});return ;}var E=this.maps[this.api];switch(this.api){case"yahoo":for(var B=0,D=this.polylines.length;B<D;B++){E.removeOverlay(this.polylines[B].proprietary_polyline);}break;case"google":case"openstreetmap":for(var B=0,D=this.polylines.length;B<D;B++){E.removeOverlay(this.polylines[B].proprietary_polyline);}break;case"microsoft":E.DeleteAllPolylines();break;case"multimap":for(var B=0,D=this.polylines.length;B<D;B++){this.polylines[B].proprietary_polyline.remove();}break;case"mapquest":E.removeAllOverlays();break;case"map24":var A;while(this.polylines.length>0){A=this.polylines.pop();A.proprietary_polyline.remove();}break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.removeAllPolylines");}}this.polylines=new Array();};Mapstraction.prototype.getCenter=function(){if(this.loaded[this.api]==false){return null;}var C=this.maps[this.api];var A=undefined;switch(this.api){case"yahoo":var B=C.getCenterLatLon();A=new LatLonPoint(B.Lat,B.Lon);break;case"google":case"openstreetmap":var B=C.getCenter();A=new LatLonPoint(B.lat(),B.lng());break;case"openlayers":var B=C.getCenter();A=new LatLonPoint(B.lat,B.lon);break;case"microsoft":var B=C.GetCenter();A=new LatLonPoint(B.Latitude,B.Longitude);break;case"multimap":var B=C.getCurrentPosition();A=new LatLonPoint(B.y,B.x);break;case"mapquest":var B=C.getCenter();A=new LatLonPoint(B.getLatitude(),B.getLongitude());break;case"map24":var B=C.MapClient["Static"].getCurrentMapView().getCenter();A=new LatLonPoint(B.Y/60,B.X/60);break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.getCenter");}}return A;};Mapstraction.prototype.setCenter=function(C){if(this.loaded[this.api]==false){var D=this;this.onload[this.api].push(function(){D.setCenter(C);});return ;}var E=this.maps[this.api];switch(this.api){case"yahoo":E.panToLatLon(C.toYahoo());break;case"google":case"openstreetmap":E.setCenter(C.toGoogle());break;case"openlayers":E.setCenter(C.toOpenLayers());break;case"microsoft":E.SetCenter(C.toMicrosoft());break;case"multimap":E.goToPosition(C.toMultiMap());break;case"mapquest":E.setCenter(C.toMapQuest());break;case"freeearth":if(this.freeEarthLoaded){E.setTargetLatLng(C.toFreeEarth());}else{var D=this;this.freeEarthOnLoad.push(function(){D.setCenterAndZoom(C);});}break;case"map24":var B=E.MapClient["Static"].getCurrentMapView();var A=new Object();A.MinimumWidth=lonToMetres(B.LowerRight.Longitude-B.TopLeft.Longitude,(B.LowerRight.Latitude+B.TopLeft.Latitude)/2);A.Latitude=C.lat*60;A.Longitude=C.lon*60;Map24.MapApplication.center(A);break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.setCenter");}}};Mapstraction.prototype.setZoom=function(G){if(this.loaded[this.api]==false){var E=this;this.onload[this.api].push(function(){E.setZoom(G);});return ;}var H=this.maps[this.api];switch(this.api){case"yahoo":var F=18-G;H.setZoomLevel(F);break;case"google":case"openstreetmap":H.setZoom(G);break;case"openlayers":H.zoomTo(G);break;case"microsoft":H.SetZoomLevel(G);break;case"multimap":H.setZoomFactor(G);break;case"mapquest":H.setZoomLevel(G-3);break;case"map24":var B=this.getCenter();var A=new Object();A.Latitude=B.lat*60;A.Longitude=B.lon*60;var C=H.MapClient["Static"];var D=getDegreesFromGoogleZoomLevel(C.getCanvasSize().Width,G);A.MinimumWidth=lonToMetres(D,B.lat);Map24.MapApplication.center(A);break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.setZoom");}}};Mapstraction.prototype.autoCenterAndZoom=function(){if(this.loaded[this.api]==false){var E=this;this.onload[this.api].push(function(){E.autoCenterAndZoom();});return ;}var D=-90;var F=90;var A=-180;var C=180;for(var B=0;B<this.markers.length;B++){lat=this.markers[B].location.lat;lon=this.markers[B].location.lon;if(lat>D){D=lat;}if(lat<F){F=lat;}if(lon>A){A=lon;}if(lon<C){C=lon;}}for(B=0;B<this.polylines.length;B++){for(j=0;j<this.polylines[B].points.length;j++){lat=this.polylines[B].points[j].lat;lon=this.polylines[B].points[j].lon;if(lat>D){D=lat;}if(lat<F){F=lat;}if(lon>A){A=lon;}if(lon<C){C=lon;}}}this.setBounds(new BoundingBox(F,C,D,A));};Mapstraction.prototype.centerAndZoomOnPoints=function(C){var D=new BoundingBox(C[0].lat,C[0].lon,C[0].lat,C[0].lon);for(var B=1,A=C.length;B<A;B++){D.extend(C[B]);}this.setBounds(D);};Mapstraction.prototype.getZoom=function(){if(this.loaded[this.api]==false){var D=this;return -1;}var F=this.maps[this.api];switch(this.api){case"yahoo":return 18-F.getZoomLevel();case"google":case"openstreetmap":return F.getZoom();case"openlayers":return F.zoom;case"microsoft":return F.GetZoomLevel();case"multimap":return F.getZoomFactor();case"mapquest":return F.getZoomLevel()+3;case"map24":var A=F.MapClient["Static"].getCurrentMapView();var B=(A.LowerRight.Longitude-A.TopLeft.Longitude)/60;var C=F.MapClient["Static"].getCanvasSize().Width;var E=getGoogleZoomLevelFromDegrees(C,B);return Math.round(E);default:if(this.debug){alert(this.api+" not supported by Mapstraction.getZoom");}}};Mapstraction.prototype.getZoomLevelForBoundingBox=function(I){if(this.loaded[this.api]==false){var H=this;return -1;}var B=this.maps[this.api];var D=I.getNorthEast();var G=I.getSouthWest();switch(this.api){case"google":case"openstreetmap":var E=new GLatLngBounds(G.toGoogle(),D.toGoogle());var K=B.getBoundsZoomLevel(E);return K;break;case"openlayers":var F=I.toOpenLayers();var K=B.getZoomForExtent(F);break;case"multimap":var J=B.getBoundsZoomFactor(G.toMultiMap(),D.toMultiMap());var K=J.zoom_factor();return K;break;case"map24":var A=D.lon-G.lon;var C=B.MapClient["Static"].getCanvasSize().Width;var K=getGoogleZoomLevelFromDegrees(C,A);return Math.round(K);break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.getZoomLevelForBoundingBox");}}};Mapstraction.ROAD=1;Mapstraction.SATELLITE=2;Mapstraction.HYBRID=3;Mapstraction.prototype.setMapType=function(C){if(this.loaded[this.api]==false){var B=this;this.onload[this.api].push(function(){B.setMapType(C);});return ;}var D=this.maps[this.api];switch(this.api){case"yahoo":switch(C){case Mapstraction.ROAD:D.setMapType(YAHOO_MAP_REG);break;case Mapstraction.SATELLITE:D.setMapType(YAHOO_MAP_SAT);break;case Mapstraction.HYBRID:D.setMapType(YAHOO_MAP_HYB);break;default:D.setMapType(YAHOO_MAP_REG);}break;case"google":case"openstreetmap":switch(C){case Mapstraction.ROAD:D.setMapType(G_NORMAL_MAP);break;case Mapstraction.SATELLITE:D.setMapType(G_SATELLITE_MAP);break;case Mapstraction.HYBRID:D.setMapType(G_HYBRID_MAP);break;default:D.setMapType(G_NORMAL_MAP);}break;case"microsoft":switch(C){case Mapstraction.ROAD:D.SetMapStyle(Msn.VE.MapStyle.Road);break;case Mapstraction.SATELLITE:D.SetMapStyle(Msn.VE.MapStyle.Aerial);break;case Mapstraction.HYBRID:D.SetMapStyle(Msn.VE.MapStyle.Hybrid);break;default:D.SetMapStyle(Msn.VE.MapStyle.Road);}break;case"multimap":maptypes=D.getAvailableMapTypes();maptype=-1;for(var A=0;A<maptypes.length;A++){switch(maptypes[A]){case MM_WORLD_MAP:if(C==Mapstraction.ROAD){maptype=maptypes[A];}default_type=maptypes[A];break;case MM_WORLD_AERIAL:if(C==Mapstraction.SATELLITE){maptype=maptypes[A];}break;case MM_WORLD_HYBRID:if(C==Mapstraction.HYBRID){maptype=maptypes[A];}break;}}if(maptype==-1){maptype=default_type;}D.setMapType(maptype);break;case"mapquest":switch(C){case Mapstraction.ROAD:D.setMapType("map");break;case Mapstraction.SATELLITE:D.setMapType("sat");break;case Mapstraction.HYBRID:D.setMapType("hyb");break;}break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.setMapType");}}};Mapstraction.prototype.getMapType=function(){if(this.loaded[this.api]==false){var B=this;return -1;}var C=this.maps[this.api];var A;switch(this.api){case"yahoo":A=C.getCurrentMapType();switch(A){case YAHOO_MAP_REG:return Mapstraction.ROAD;break;case YAHOO_MAP_SAT:return Mapstraction.SATELLITE;break;case YAHOO_MAP_HYB:return Mapstraction.HYBRID;break;default:return null;}break;case"google":case"openstreetmap":A=C.getCurrentMapType();switch(A){case G_NORMAL_MAP:return Mapstraction.ROAD;break;case G_SATELLITE_MAP:return Mapstraction.SATELLITE;break;case G_HYBRID_MAP:return Mapstraction.HYBRID;break;default:return null;}break;case"microsoft":A=C.GetMapStyle();switch(A){case Msn.VE.MapStyle.Road:return Mapstraction.ROAD;break;case Msn.VE.MapStyle.Aerial:return Mapstraction.SATELLITE;break;case Msn.VE.MapStyle.Hybrid:return Mapstraction.HYBRID;break;default:return null;}break;case"multimap":maptypes=C.getAvailableMapTypes();A=C.getMapType();switch(A){case MM_WORLD_MAP:return Mapstraction.ROAD;break;case MM_WORLD_AERIAL:return Mapstraction.SATELLITE;break;case MM_WORLD_HYBRID:return Mapstraction.HYBRID;break;default:return null;}break;case"mapquest":A=C.getMapType();switch(A){case"map":return Mapstraction.ROAD;break;case"sat":return Mapstraction.SATELLITE;break;case"hyb":return Mapstraction.HYBRID;break;default:return null;}break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.getMapType");}}};Mapstraction.prototype.getBounds=function(){if(this.loaded[this.api]==false){return null;}var B=this.maps[this.api];switch(this.api){case"google":case"openstreetmap":var H=B.getBounds();var J=H.getSouthWest();var C=H.getNorthEast();return new BoundingBox(J.lat(),J.lng(),C.lat(),C.lng());break;case"openlayers":var I=B.calculateBounds();break;case"yahoo":var K=B.getBoundsLatLon();return new BoundingBox(K.LatMin,K.LonMin,K.LatMax,K.LonMax);break;case"microsoft":var A=B.GetMapView();var F=A.TopLeftLatLong;var G=A.BottomRightLatLong;return new BoundingBox(G.Latitude,F.Longitude,F.Latitude,G.Longitude);break;case"multimap":var E=B.getMapBounds();var J=E.getSouthWest();var C=E.getNorthEast();return new BoundingBox(J.lat,J.lon,C.lat,C.lon);break;case"mapquest":var D=B.getMapBounds();var G=D.getLowerRightLatLng();var F=D.getUpperLeftLatLng();return new BoundingBox(G.lat,F.lon,F.lat,G.lon);break;case"map24":var L=B.MapClient["Static"].getCurrentMapView();var G=L.LowerRight;var F=L.TopLeft;return new BoundingBox(G.Latitude/60,F.Longitude/60,F.Latitude/60,G.Longitude/60);break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.getBounds");}}};Mapstraction.prototype.setBounds=function(A){if(this.loaded[this.api]==false){var K=this;this.onload[this.api].push(function(){K.setBounds(A);});return ;}var C=this.maps[this.api];var J=A.getSouthWest();var F=A.getNorthEast();switch(this.api){case"google":case"openstreetmap":var I=new GLatLngBounds(new GLatLng(J.lat,J.lon),new GLatLng(F.lat,F.lon));C.setCenter(I.getCenter(),C.getBoundsZoomLevel(I));break;case"openlayers":var A=new OpenLayers.Bounds();A.extend(new LatLonPoint(J.lat,J.lon).toOpenLayers());A.extend(new LatLonPoint(F.lat,F.lon).toOpenLayers());C.zoomToExtent(A);break;case"yahoo":if(J.lon>F.lon){J.lon-=360;}var B=new YGeoPoint((J.lat+F.lat)/2,(F.lon+J.lon)/2);var D=C.getContainerSize();for(var M=1;M<=17;M++){var G=convertLatLonXY_Yahoo(J,M);var H=convertLatLonXY_Yahoo(F,M);if(G.x>H.x){G.x-=(1<<(26-M));}if(Math.abs(H.x-G.x)<=D.width&&Math.abs(H.y-G.y)<=D.height){C.drawZoomAndCenter(B,M);break;}}break;case"microsoft":C.SetMapView([new VELatLong(J.lat,J.lon),new VELatLong(F.lat,F.lon)]);break;case"multimap":var L=C.getBoundsZoomFactor(J.toMultiMap(),F.toMultiMap());var B=new LatLonPoint(L.coords.lat,L.coords.lon);this.setCenterAndZoom(B,L.zoom_factor);break;case"mapquest":if(this.debug){alert(this.api+" not supported by Mapstraction.setBounds");}break;case"freeearth":var B=new LatLonPoint((J.lat+F.lat)/2,(F.lon+J.lon)/2);this.setCenter(B);break;case"map24":var E=new Object();E.Latitude=((J.lat+F.lat)/2)*60;E.Longitude=((J.lon+F.lon)/2)*60;E.MinimumWidth=lonToMetres(F.lon-J.lon,(F.lat+J.lat)/2);Map24.MapApplication.center(E);break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.setBounds");}}};Mapstraction.prototype.addImageOverlay=function(C,A,E,K,F,H,D){if(this.loaded[this.api]==false){var J=this;this.onload[this.api].push(function(){J.addImageOverlay(C,A,E,K,F,H,D);});return ;}var B=this.maps[this.api];var I=document.createElement("img");I.style.display="block";I.setAttribute("id",C);I.setAttribute("src",A);I.style.position="absolute";I.style.zIndex=1;I.setAttribute("west",K);I.setAttribute("south",F);I.setAttribute("east",H);I.setAttribute("north",D);switch(this.api){case"google":case"openstreetmap":B.getPane(G_MAP_MAP_PANE).appendChild(I);this.setImageOpacity(C,E);this.setImagePosition(C);GEvent.bind(B,"zoomend",this,function(){this.setImagePosition(C);});GEvent.bind(B,"moveend",this,function(){this.setImagePosition(C);});break;case"multimap":B.getContainer().appendChild(I);this.setImageOpacity(C,E);this.setImagePosition(C);var G=this;B.addEventHandler("changeZoom",function(O,P,N,M,L){G.setImagePosition(C);});B.addEventHandler("drag",function(O,P,N,M,L){G.setImagePosition(C);});B.addEventHandler("endPan",function(O,P,N,M,L){G.setImagePosition(C);});break;default:I.style.display="none";if(this.debug){alert(this.api+"not supported by Mapstraction.addImageOverlay not supported");}break;}};Mapstraction.prototype.setImageOpacity=function(D,A){if(A<0){A=0;}if(A>=100){A=100;}var C=A/100;var B=document.getElementById(D);if(typeof (B.style.filter)=="string"){B.style.filter="alpha(opacity:"+A+")";}if(typeof (B.style.KHTMLOpacity)=="string"){B.style.KHTMLOpacity=C;}if(typeof (B.style.MozOpacity)=="string"){B.style.MozOpacity=C;}if(typeof (B.style.opacity)=="string"){B.style.opacity=C;}};Mapstraction.prototype.setImagePosition=function(F){if(this.loaded[this.api]==false){var B=this;this.onload[this.api].push(function(){B.setImagePosition(F);});return ;}var D=this.maps[this.api];var A=document.getElementById(F);var E;var C;switch(this.api){case"google":case"openstreetmap":E=D.fromLatLngToDivPixel(new GLatLng(A.getAttribute("north"),A.getAttribute("west")));C=D.fromLatLngToDivPixel(new GLatLng(A.getAttribute("south"),A.getAttribute("east")));break;case"multimap":E=D.geoPosToContainerPixels(new MMLatLon(A.getAttribute("north"),A.getAttribute("west")));C=D.geoPosToContainerPixels(new MMLatLon(A.getAttribute("south"),A.getAttribute("east")));break;}A.style.top=E.y+"px";A.style.left=E.x+"px";A.style.width=C.x-E.x+"px";A.style.height=C.y-E.y+"px";};Mapstraction.prototype.addOverlay=function(B,E){if(this.loaded[this.api]==false){var D=this;this.onload[this.api].push(function(){D.addOverlay(B);});return ;}var G=this.maps[this.api];switch(this.api){case"yahoo":G.addOverlay(new YGeoRSS(B));break;case"google":var F=new GGeoXml(B);G.addOverlay(F,function(){if(E){F.gotoDefaultViewport(G);}});break;case"microsoft":var C=new VELayerSpecification();C.Type=VELayerType.GeoRSS;C.ID=1;C.LayerSource=B;C.Method="get";G.AddLayer(C);break;case"multimap":break;case"freeearth":if(this.freeEarthLoaded){var A=new FE.GeoRSS(B);G.addOverlay(A);}else{var D=this;this.freeEarthOnLoad.push(function(){D.addOverlay(B);});}break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.addGeoRSSOverlay");}}};Mapstraction.prototype.addFilter=function(C,A,B){if(!this.filters){this.filters=[];}this.filters.push([C,A,B]);};Mapstraction.prototype.removeFilter=function(E,B,D){if(!this.filters){return ;}var A;for(var C=0;C<this.filters.length;C++){if(this.filters[C][0]==E&&(!B||(this.filters[C][1]==B&&this.filters[C][2]==D))){this.filters.splice(C,1);C--;}}};Mapstraction.prototype.toggleFilter=function(E,A,D){if(!this.filters){this.filters=[];}var C=false;for(var B=0;B<this.filters.length;B++){if(this.filters[B][0]==E&&this.filters[B][1]==A&&this.filters[B][2]==D){this.filters.splice(B,1);B--;C=true;}}if(!C){this.addFilter(E,A,D);}};Mapstraction.prototype.removeAllFilters=function(){this.filters=[];};Mapstraction.prototype.doFilter=function(){if(this.loaded[this.api]==false){var C=this;this.onload[this.api].push(function(){C.doFilter();});return ;}var F=this.maps[this.api];if(this.filters){switch(this.api){case"multimap":var B=[];for(var E=0;E<this.filters.length;E++){B.push(new MMSearchFilter(this.filters[E][0],this.filters[E][1],this.filters[E][2]));}F.setMarkerFilters(B);F.redrawMap();break;default:var D;for(var A=0;A<this.markers.length;A++){D=true;for(var E=0;E<this.filters.length;E++){if(!this.applyFilter(this.markers[A],this.filters[E])){D=false;}}if(D){this.markers[A].show();}else{this.markers[A].hide();}}break;}}};Mapstraction.prototype.applyFilter=function(C,B){var A=true;switch(B[1]){case"ge":if(C.getAttribute(B[0])<B[2]){A=false;}break;case"le":if(C.getAttribute(B[0])>B[2]){A=false;}break;case"eq":if(C.getAttribute(B[0])!=B[2]){A=false;}break;}return A;};Mapstraction.prototype.getAttributeExtremes=function(E){var C;var B;for(var A=0;A<this.markers.length;A++){if(!C||C>this.markers[A].getAttribute(E)){C=this.markers[A].getAttribute(E);}if(!B||B<this.markers[A].getAttribute(E)){B=this.markers[A].getAttribute(E);}}for(var D=0;A<this.polylines.length;A++){if(!C||C>this.polylines[D].getAttribute(E)){C=this.polylines[D].getAttribute(E);}if(!B||B<this.polylines[D].getAttribute(E)){B=this.polylines[D].getAttribute(E);}}return[C,B];};Mapstraction.prototype.getMap=function(){return this.maps[this.api];};function LatLonPoint(A,B){this.lat=A;this.lon=B;this.lng=B;}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 B=this.lon*20037508.34/180;var A=Math.log(Math.tan((90+this.lat)*Math.PI/360))/(Math.PI/180);A=A*20037508.34/180;return new OpenLayers.LonLat(B,A);};LatLonPoint.prototype.fromOpenLayers=function(){var B=(this.lon/20037508.34)*180;var A=(this.lat/20037508.34)*180;A=180/Math.PI*(2*Math.atan(Math.exp(A*Math.PI/180))-Math.PI/2);this.lon=B;this.lat=A;};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 MQLatLng(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.toString=function(){return this.lat+", "+this.lon;};LatLonPoint.prototype.distance=function(otherPoint){var d,dr;with(Math){dr=0.017453292519943295;d=cos(otherPoint.lon*dr-this.lon*dr)*cos(otherPoint.lat*dr-this.lat*dr);return acos(d)*6378.137;}return -1;};LatLonPoint.prototype.equals=function(A){return this.lat==A.lat&&this.lon==A.lon;};function BoundingBox(A,B,C,D){this.sw=new LatLonPoint(A,B);this.ne=new LatLonPoint(C,D);}BoundingBox.prototype.getSouthWest=function(){return this.sw;};BoundingBox.prototype.getNorthEast=function(){return this.ne;};BoundingBox.prototype.isEmpty=function(){return this.ne==this.sw;};BoundingBox.prototype.contains=function(A){return A.lat>=this.sw.lat&&A.lat<=this.ne.lat&&A.lon>=this.sw.lon&&A.lon<=this.ne.lon;};BoundingBox.prototype.toSpan=function(){return new LatLonPoint(Math.abs(this.sw.lat-this.ne.lat),Math.abs(this.sw.lon-this.ne.lon));};BoundingBox.prototype.extend=function(A){if(this.sw.lat>A.lat){this.sw.setLat(A.lat);}if(this.sw.lon>A.lon){this.sw.setLon(A.lon);}if(this.ne.lat<A.lat){this.ne.setLat(A.lat);}if(this.ne.lon<A.lon){this.ne.setLon(A.lon);}return ;};function Marker(A){this.location=A;this.onmap=false;this.proprietary_marker=false;this.attributes=new Array();this.pinID="mspin-"+new Date().getTime()+"-"+(Math.floor(Math.random()*Math.pow(2,16)));}Marker.prototype.setChild=function(A){this.proprietary_marker=A;this.onmap=true;};Marker.prototype.setLabel=function(A){this.labelText=A;};Marker.prototype.addData=function(options){if(options.label){this.setLabel(options.label);}if(options.infoBubble){this.setInfoBubble(options.infoBubble);}if(options.icon){if(options.iconSize){this.setIcon(options.icon,new Array(options.iconSize[0],options.iconSize[1]));}else{this.setIcon(options.icon);}if(options.iconAnchor){this.setIconAnchor(new Array(options.iconAnchor[0],options.iconAnchor[1]));}}if(options.iconShadow){if(options.iconShadowSize){this.setShadowIcon(options.iconShadow,new Array(options.iconShadowSize[0],options.iconShadowSize[1]));}else{this.setIcon(options.iconShadow);}}if(options.infoDiv){this.setInfoDiv(options.infoDiv[0],options.infoDiv[1]);}if(options.draggable){this.setDraggable(options.draggable);}if(options.hover){this.setHover(options.hover);}if(options.hoverIcon){this.setHoverIcon(options.hoverIcon);}if(options.openBubble){this.openBubble();}if(options.date){this.setAttribute("date",eval(options.date));}if(options.category){this.setAttribute("category",options.category);}};Marker.prototype.setInfoBubble=function(A){this.infoBubble=A;};Marker.prototype.setInfoDiv=function(A,B){this.infoDiv=A;this.div=B;};Marker.prototype.setIcon=function(C,A,B){this.iconUrl=C;if(A){this.iconSize=A;}if(B){this.iconAnchor=B;}};Marker.prototype.setIconSize=function(A){if(A){this.iconSize=A;}};Marker.prototype.setIconAnchor=function(A){if(A){this.iconAnchor=A;}};Marker.prototype.setShadowIcon=function(B,A){this.iconShadowUrl=B;if(A){this.iconShadowSize=A;}};Marker.prototype.setHoverIcon=function(A){this.hoverIconUrl=A;};Marker.prototype.setDraggable=function(A){this.draggable=A;};Marker.prototype.setHover=function(A){this.hover=A;};Marker.prototype.changeIcon=function(A){if(this.proprietary_marker){this.proprietary_marker.setImage(A);}};Marker.prototype.revertIcon=function(){this.changeIcon(this.iconUrl);};Marker.prototype.toYahoo=function(){var C;if(this.iconUrl){C=new YMarker(this.location.toYahoo(),new YImage(this.iconUrl));}else{C=new YMarker(this.location.toYahoo());}if(this.iconSize){C.size=new YSize(this.iconSize[0],this.iconSize[1]);}if(this.labelText){C.addLabel(this.labelText);}if(this.infoBubble){var A=this.infoBubble;var D;if(this.hover){D=EventsList.MouseOver;}else{D=EventsList.MouseClick;}YEvent.Capture(C,D,function(){C.openSmartWindow(A);});}if(this.infoDiv){var A=this.infoDiv;var E=this.div;var B;if(this.hover){D=EventsList.MouseOver;}else{D=EventsList.MouseClick;}YEvent.Capture(C,D,function(){document.getElementById(E).innerHTML=A;});}return C;};Marker.prototype.toGoogle=function(){var D=new Object();if(this.labelText){D.title=this.labelText;}if(this.iconUrl){var E=new GIcon(G_DEFAULT_ICON,this.iconUrl);if(this.iconSize){E.iconSize=new GSize(this.iconSize[0],this.iconSize[1]);var C;if(this.iconAnchor){C=new GPoint(this.iconAnchor[0],this.iconAnchor[1]);}else{C=new GPoint(this.iconSize[0]/2,this.iconSize[1]/2);}E.iconAnchor=C;}if(this.iconShadowUrl){E.shadow=this.iconShadowUrl;if(this.iconShadowSize){E.shadowSize=new GSize(this.iconShadowSize[0],this.iconShadowSize[1]);}}D.icon=E;}if(this.draggable){D.draggable=this.draggable;}var F=new GMarker(this.location.toGoogle(),D);if(this.infoBubble){var A=this.infoBubble;var B;if(this.hover){B="mouseover";}else{B="click";}GEvent.addListener(F,B,function(){F.openInfoWindowHtml(A,{maxWidth:100});});}if(this.hoverIconUrl){GEvent.addListener(F,"mouseover",function(){F.setImage(this.hoverIconUrl);});GEvent.addListener(F,"mouseout",function(){F.setImage(this.iconUrl);});}if(this.infoDiv){var A=this.infoDiv;var G=this.div;var B;if(this.hover){B="mouseover";}else{B="click";}GEvent.addListener(F,B,function(){document.getElementById(G).innerHTML=A;});}return F;};Marker.prototype.toOpenLayers=function(){if(this.iconSize){var C=new OpenLayers.Size(this.iconSize[0],this.iconSize[1]);}else{var C=new OpenLayers.Size(15,20);}if(this.iconAnchor){var B=new OpenLayers.Pixel(this.iconAnchor[0],this.iconAnchor[1]);}else{B=new OpenLayers.Pixel(-(C.w/2),-C.h);}if(this.iconUrl){var D=new OpenLayers.Icon(this.iconUrl,C,B);}else{var D=new OpenLayers.Icon("http://boston.openguides.org/markers/AQUA.png",C,B);}var A=new OpenLayers.Marker(this.location.toOpenLayers(),D);return A;};Marker.prototype.toMicrosoft=function(){var A=new VEPushpin(this.pinID,this.location.toMicrosoft(),this.iconUrl,this.labelText,this.infoBubble);return A;};Marker.prototype.toMap24=function(){var A=new Object();A.Longitude=this.location.lon*60;A.Latitude=this.location.lat*60;if(this.infoBubble){A.TooltipContent=this.infoBubble;}if(this.labelText){}A.LogoURL=this.iconUrl?this.iconUrl:"http://www.free-map.org.uk/images/marker.png";A.TooltipLayout=Map24.MapObject.LAYOUT_BUBBLE;if(this.hover){A.TooltipOpen="OnMouseOver";}else{A.TooltipOpen="OnClick";}var B=new Map24.Location(A);return B;};Marker.prototype.toMultiMap=function(){if(this.iconUrl){var C=new MMIcon(this.iconUrl);C.iconSize=new MMDimensions(32,32);var B=new MMMarkerOverlay(this.location.toMultiMap(),{"icon":C});}else{var B=new MMMarkerOverlay(this.location.toMultiMap());}if(this.labelText){}if(this.infoBubble){B.setInfoBoxContent(this.infoBubble);}if(this.infoDiv){}for(var A in this.attributes){B.setAttribute(A,this.attributes[A]);}return B;};Marker.prototype.toMapQuest=function(){var C=new MQPoi(this.location.toMapQuest());if(this.iconUrl){var B=new MQMapIcon();B.setImage(this.iconUrl,32,32,true,false);C.setIcon(B);}if(this.labelText){C.setInfoTitleHTML(this.labelText);}if(this.infoBubble){C.setInfoContentHTML(this.infoBubble);}if(this.infoDiv){var A=this.infoDiv;var D=this.div;MQEventManager.addListener(C,"click",function(){document.getElementById(D).innerHTML=A;});}return C;};Marker.prototype.toFreeEarth=function(){var C;if(this.iconUrl){C=new FE.Icon(this.iconUrl);}else{C=new FE.Icon("http://freeearth.poly9.com/images/bullmarker.png");}var D=new FE.Pushpin(this.location.toFreeEarth(),C);if(this.infoBubble){var B=this.infoBubble;FE.Event.addListener(D,"click",function(){D.openInfoWindowHtml(B,200,100);});}if(this.infoDiv){var A=this.infoDiv;var E=this.div;FE.Event.addListener(D,"click",function(){document.getElementById(E).innerHTML=A;});}return D;};Marker.prototype.setAttribute=function(A,B){this.attributes[A]=B;};Marker.prototype.getAttribute=function(A){return this.attributes[A];};Marker.prototype.openBubble=function(){if(this.api){switch(this.api){case"yahoo":var C=this.proprietary_marker;C.openSmartWindow(this.infoBubble);break;case"google":case"openstreetmap":var A=this.proprietary_marker;A.openInfoWindowHtml(this.infoBubble);break;case"microsoft":var B=this.proprietary_marker;var D=$m(this.pinID+"_"+this.maps[this.api].GUID).onmouseover;setTimeout(D,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{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":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;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":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;default:if(this.debug){alert(this.api+"not supported by Marker.show");}}}};function Polyline(A){this.points=A;this.attributes=new Array();this.onmap=false;this.proprietary_polyline=false;this.pllID="mspll-"+new Date().getTime()+"-"+(Math.floor(Math.random()*Math.pow(2,16)));}Polyline.prototype.addData=function(options){if(options.color){this.setColor(options.color);}if(options.width){this.setWidth(options.width);}if(options.opacity){this.setIcon(options.opacity);}if(options.date){this.setAttribute("date",eval(options.date));}if(options.category){this.setAttribute("category",options.category);}};Polyline.prototype.setChild=function(A){this.proprietary_polyline=A;this.onmap=true;};Polyline.prototype.setColor=function(A){this.color=(A.length==7&&A[0]=="#")?A.toUpperCase():A;};Polyline.prototype.setWidth=function(A){this.width=A;};Polyline.prototype.setOpacity=function(A){this.opacity=A;};Polyline.prototype.toYahoo=function(){var D;var C=[];for(var A=0,B=this.points.length;A<B;A++){C.push(this.points[A].toYahoo());}D=new YPolyline(C,this.color,this.width,this.opacity);return D;};Polyline.prototype.toGoogle=function(){var D;var A=[];for(var B=0,C=this.points.length;B<C;B++){A.push(this.points[B].toGoogle());}D=new GPolyline(A,this.color,this.width,this.opacity);return D;};Polyline.prototype.toMap24=function(){var C;var A="";var D="";for(var B=0;B<this.points.length;B++){if(B){A+="|";D+="|";}A+=(this.points[B].lon*60);D+=(this.points[B].lat*60);}C=new Map24.Polyline({Longitudes:A,Latitudes:D,Color:this.color||"black",Width:this.width||3});return C;};Polyline.prototype.toMicrosoft=function(){var D;var E=[];for(var C=0,F=this.points.length;C<F;C++){E.push(this.points[C].toMicrosoft());}var A;var B=this.opacity||1;if(this.color){A=new VEColor(parseInt(this.color.substr(1,2),16),parseInt(this.color.substr(3,2),16),parseInt(this.color.substr(5,2),16),B);}else{A=new VEColor(0,255,0,B);}D=new VEPolyline(this.pllID,E,A,this.width);return D;};Polyline.prototype.toMultiMap=function(){var B;var D=[];for(var A=0,C=this.points.length;A<C;A++){D.push(this.points[A].toMultiMap());}B=new MMPolyLineOverlay(D,this.color,this.opacity,this.width,false,undefined);return B;};Polyline.prototype.toMapQuest=function(){var A=new MQLineOverlay();A.setColor(this.color||"red");A.setBorderWidth(this.width||3);A.setKey("Line");A.setColorAlpha(this.opacity);var D=new MQLatLngCollection();for(var B=0,C=this.points.length;B<C;B++){D.add(this.points[B].toMapQuest());}A.setShapePoints(D);return A;};Polyline.prototype.toFreeEarth=function(){var A=new Array();for(var C=0,D=this.points.length;C<D;C++){A.push(this.points[C].toFreeEarth());}var B=new FE.Polyline(A,this.color||"0xff0000",this.width||1,this.opacity||1);return B;};Polyline.prototype.setAttribute=function(A,B){this.attributes[A]=B;};Polyline.prototype.getAttribute=function(A){return this.attributes[A];};Polyline.prototype.show=function(){if(this.api){}};Polyline.prototype.hide=function(){if(this.api){}};Mapstraction.prototype.showRoute=function(A){if(this.loaded[this.api]==false){var B=this;this.onload[this.api].push(function(){B.showRoute(A);});return ;}var C=this.maps[this.api];switch(this.api){case"mapquest":C.addRouteHighlight(A["bounding_box"],"http://map.access.mapquest.com",A["session_id"],true);break;default:if(this.debug){alert(api+" not supported by Mapstration.showRoute");}break;}};