var mdvLib;if(!mdvLib){mdvLib={}}mdvLib.$=function(){var C=[];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};mdvLib.getElementPosition=function(D){var B=D.offsetLeft;var A=D.offsetTop;var C=D.offsetParent;while(C!==null){B+=C.offsetLeft;A+=C.offsetTop;C=C.offsetParent}return{left:B,top:A}};mdvLib.getMousePosition=function(B){var A=0;var C=0;var B=B||window.event;if(B.pageX||B.pageY){A=B.pageX;C=B.pageY}else{if(B.clientX||B.clientY){A=B.clientX+(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft);C=B.clientY+(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop)}}return{left:A,top:C}};mdvLib.style=function(A,D){if(mdvLib.typeOf(A)!=="array"){return false}for(var B=0;B<A.length;B++){for(var C in D){mdvLib.$(A[B]).style[C]=D[C]}}return true};mdvLib.typeOf=function(B){var A=typeof B;if(A==="object"){if(B){if(B instanceof Array){A="array"}}else{A="null"}}return A};mdvLib.createImg=function(B,D){var A=document.createElement("img");if(mdvLib.typeOf(D)==="object"){for(var C in D){A[C]=D[C]}}if(mdvLib.typeOf(B)==="object"){mdvLib.style([A],B)}return A};mdvLib.correctPNG=function(D,A){if(!document.body.filters||!A||!D){return }if(A.src==D.transparent.src){return true}if(mdvLib.typeOf(A)==="array"){for(var B=0;B<A.length;B++){C(A[B])}}else{C(A)}function C(F){var G=F.src;var E=F.runtimeStyle;E.width=F.offsetWidth+"px";E.height=F.offsetHeight+"px";E.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+G+"'), sizingMethod='crop'";F.src=D.transparent.src}};mdvLib.ajax=function(C){var J,G,A,F,B,I,H={};var D={host:"url",method:"type",asynchronous:"async",contentType:"contentType",encoding:"scriptCharset",parameters:"data",onComplete:"complete",onFailure:"error",onSuccess:"success"};var E={host:"url",method:"method",asynchronous:"async",contentType:"urlEncoded",encoding:"encoding",parameters:"data",onComplete:"onComplete",onFailure:"onFailure",onSuccess:"onSuccess",request:null};J=C||null;if(!J||J.host===undefined){return null}G=(typeof Prototype!=="undefined"&&Prototype.Version)?"PROTOTYPE":(typeof jQuery!=="undefined"&&jQuery.fn)?"JQUERY":(typeof MooTools!=="undefined"&&MooTools.version)?"MOOTOOLS":null;A=J.method||"post";A=A.toLowerCase();F=J.parameters||"";I=function(N,K){var M,L;for(M in N){if(N.hasOwnProperty(M)&&(!K||K[M]!==true)){L=G==="PROTOTYPE"?M:G==="JQUERY"?D[M]||M:G==="MOOTOOLS"?E[M]:M;H[L]=N[M]}}};B=function(){switch(G){case"PROTOTYPE":F=$H(F);F=F.toQueryString();H.parameters=F;H.method=A;I(J,{host:true,parameters:true});return new Ajax.Request(J.host,H);case"JQUERY":I(J);if(H.method===undefined){H.type=A}return jQuery.ajax(H);case"MOOTOOLS":I(J,{parameters:true});if(F!==""&&!F.length){F=new Hash(F);F=F.toQueryString()}E.request=new Request(H);return E.request.send(F);default:return null}};return B()};mdvLib.removeEvent=function(C,B,A){if(C.removeEventListener){C.removeEventListener(B,A,false)}else{if(C.detachEvent){C.detachEvent("on"+B,A)}}};function attachEventListener(E,C,D,B){var A;if(typeof E.addEventListener!="undefined"){E.addEventListener(C,D,B)}else{if(typeof E.attachEvent!="undefined"){E.attachEvent("on"+C,D)}else{C="on"+C;if(typeof E[C]=="function"){A=E[C];E[C]=function(){A();return D()}}else{E[C]=D}}}return true}if(typeof Function.prototype.bind!=="function"){Function.prototype.bind=function(B){var C=this,A=function(){return C.apply(B,arguments)};return A}}if(typeof String.prototype.trim!=="function"){String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}}function MDVMapCooTraPro(){this.ellipsoidParams=[];this.ellipsoidParams["AIRY_1830"]={a:6377563.396,divf:299.3249646};this.ellipsoidParams["AIRY_1830_GREAT_BRITAIN"]={a:6377563.396,divf:299.3249753};this.ellipsoidParams["MODIFIED_AIRY"]={a:6377340.189,divf:299.3249646};this.ellipsoidParams["AUSTRALIAN_1984"]={a:6378160,divf:298.25};this.ellipsoidParams["BESSEL_1841_NAMIBIA"]={a:6377483.865,divf:299.15281282};this.ellipsoidParams["BESSEL_1841"]={a:6377397.155,divf:299.15281282};this.ellipsoidParams["CLARKE_1866"]={a:6378206.4,divf:294.9786982};this.ellipsoidParams["CLARKE_1880"]={a:6378249.145,divf:293.465};this.ellipsoidParams["EVEREST_INDIA_1830"]={a:6377276.345,divf:300.8017};this.ellipsoidParams["EVEREST_SABAH_SARAWAK"]={a:6377298.556,divf:300.8017};this.ellipsoidParams["EVEREST_INDIA_1956"]={a:6377301.243,divf:300.8017};this.ellipsoidParams["EVEREST_MALAYSIA_1969"]={a:6377295.664,divf:300.8017};this.ellipsoidParams["EVEREST_MALAY_SING"]={a:6377304.063,divf:300.8017};this.ellipsoidParams["EVEREST_PAKISTAN"]={a:6377309.613,divf:300.8017};this.ellipsoidParams["MODIFIED_FISCHER_1960"]={a:6378155,divf:298.3};this.ellipsoidParams["HELMERT_1906"]={a:6378200,divf:298.3};this.ellipsoidParams["HOUGH_1960"]={a:6378270,divf:297};this.ellipsoidParams["IERS_1996"]={a:6378136.49,divf:298.25645};this.ellipsoidParams["INDONESIA_1974"]={a:6378160,divf:298.247};this.ellipsoidParams["HAYFORD_1924"]={a:6378388,divf:297};this.ellipsoidParams["KRASSOWSKIJ_1940"]={a:6378245,divf:298.3};this.ellipsoidParams["GRS_1980"]={a:6378137,divf:298.257222101};this.ellipsoidParams["WGS_1972"]={a:6378135,divf:298.26};this.ellipsoidParams["WGS_1984"]={a:6378137,divf:298.257223563};this.ellipsoidParams["SOUTH_AMERICAN_1969"]={a:6378160,divf:298.25};this.ellipsoidParams["UNKNOWN"]={a:0,divf:0};this.offset=new MDVPoint(0,5000000)}MDVMapCooTraPro.prototype.transform=function(B){var D=new MDVEllipsoid(this.ellipsoidParams["WGS_1984"]);var F=new MDVEllipsoid(this.ellipsoidParams["WGS_1984"]);var A=10;var E="NORTH";B.hemisphere=E;B.zone=A;if(D.params!=F.params){var C=null}if(B.mapName.indexOf("WGS")>=0){return this.toInternal(B,F)}else{return this.toWGS84(B,F)}};MDVMapCooTraPro.prototype.toInternal=function(A,E){var D=A.clone();if(!D||D.mapName.indexOf("WGS")<0){return null}var C=null;var B=new MDVProjectionUTM(E,D.zone);C=B.convertGeographicalToUTMCoordinate(D);if(this.offset.x>0){C.x=this.offset.x-C.x}if(this.offset.y>0){C.y=this.offset.y-C.y}return C};MDVMapCooTraPro.prototype.toWGS84=function(A,E){var D=A.clone();if(!D){return null}var C=null;if(this.offset.x>0){D.x=this.offset.x-D.x}if(this.offset.y>0){D.y=this.offset.y-D.y}var B=new MDVProjectionUTM(E,D.zone);C=B.convertUTMToGeographicalCoordinate(D);return C};function MDVEllipsoid(A){this.params=A}MDVEllipsoid.prototype.getEquatorialRadiusA=function(){return this.params.a};MDVEllipsoid.prototype.getPolarRadiusB=function(){var A=this.getEquatorialRadiusA();var B=this.getFlatteningF();return(A-B*A)};MDVEllipsoid.prototype.getFlatteningF=function(){return(1/this.params.divf)};MDVEllipsoid.prototype.getSecondEccentricityESquare=function(){var B=this.params.a;var A=this.getPolarRadiusB();return((B*B-A*A)/(A*A))};MDVEllipsoid.prototype.getPrimeVerticalRadiusN=function(C){var A=this.getEquatorialRadiusA();var B=this.getFirstEccentricityESquare();return(A/Math.sqrt(1-B*Math.pow(Math.sin(C),2)))};MDVEllipsoid.prototype.getFirstEccentricityESquare=function(){var B=this.params.a;var A=this.getPolarRadiusB();return((B*B-A*A)/(B*B))};function MDVProjectionUTM(B,A){this.MIN_LAT=-80.5;this.MAX_LAT=84.5;this.MIN_RAD_LAT=((this.MIN_LAT*Math.PI)/180);this.MAX_RAD_LAT=((this.MAX_LAT*Math.PI)/180);this.MIN_EASTING=-500000;this.MAX_EASTING=1500000;this.MIN_NORTHING=0;this.MAX_NORTHING=10000000;this.zone=A;this.ellipsoid=B}MDVProjectionUTM.prototype.convertUTMToGeographicalCoordinate=function(F){var B=0;var A=0;var I=500000;var D=0;var G=0.9996;var H=F.clone();H.mapName="WGS84[DD.ddddd]";if(F.zone>=31){A=(6*F.zone-183)}else{A=(6*F.zone+177)}if(F.hemisphere=="SOUTH"){D=10000000}var C=new MDVProjectionTransverseMercator(this.ellipsoid,B,A,I,D,G);var E=C.convertTransverseMercatorToGeographicalCoordinate(F);H.x=Math.floor(0.5+(E.x*100000))/100000;H.y=Math.floor(0.5+(E.y*100000))/100000;return H};MDVProjectionUTM.prototype.convertGeographicalToUTMCoordinate=function(K){var A=(K.y*Math.PI)/180;var C=(K.x*Math.PI)/180;var D=0;var B=0;var N=500000;var G=0;var L=0.9996;var F=-1;var M=K.clone();M.mapName="MTCV";if(C<0){C+=(2*Math.PI)+1e-10}if(C<Math.PI){F=(31+Math.floor(((C-1e-10)*180/Math.PI)/6))}else{F=(Math.floor(((C-1e-10)*180/Math.PI)/6)-29)}if(F>60){F=1}var J=parseInt(K.y);var I=parseInt(K.x);if((J>55)&&(J<64)&&(I>-1)&&(I<3)){F=31}if((J>55)&&(J<64)&&(I>2)&&(I<12)){F=32}if((J>71)&&(I>-1)&&(I<9)){F=31}if((J>71)&&(I>8)&&(I<21)){F=33}if((J>71)&&(I>20)&&(I<33)){F=35}if((J>71)&&(I>32)&&(I<42)){F=37}if((F==1)&&(this.zone==60)){F=this.zone}else{if((F==60)&&(this.zone==1)){F=this.zone}else{if(((F-1)<=this.zone)&&(this.zone<=(F+1))){F=this.zone}else{F=-1}}}if(this.zone<0){return null}if(F>=31){B=6*F-183}else{B=6*F+177}M.zone=F;if(A<0){G=10000000;M.hemisphere="SOUTH"}else{M.hemisphere="NORTH"}var E=new MDVProjectionTransverseMercator(this.ellipsoid,D,B,N,G,L);var H=E.convertGeographicalToTransverseMercatorCoordinate(K);M.x=Math.floor(0.5+H.x);M.y=Math.floor(0.5+H.y);return M};function MDVProjectionTransverseMercator(C,E,A,P,G,L){this.ellipsoid=C;this.radCentralMeridianLongitude=0;this.radOriginLatitude=0;this.falseEasting=0;this.falseNorthing=0;this.scaleFactor=1;this.ap=6367449.1458008;this.bp=16038.508696861;this.cp=16.832613334334;this.dp=0.021984404273757;this.ep=0.000031148371319283;this.radMaxDeltaLongitude=1.5707963267948966;this.radMaxLatitude=1.5706217938696971;this.deltaEasting=40000000;this.deltaNorthing=40000000;var M=(Math.PI*E)/180;var J=(Math.PI*A)/180;this.ellipsoid=C;var N=(this.ellipsoid.getEquatorialRadiusA()-this.ellipsoid.getPolarRadiusB())/(this.ellipsoid.getEquatorialRadiusA()+this.ellipsoid.getPolarRadiusB());var K=N*N;var I=K*N;var F=I*N;var D=F*N;this.ap=this.ellipsoid.getEquatorialRadiusA()*(1-N+5*(K-I)/4+81*(F-D)/64);this.bp=3*this.ellipsoid.getEquatorialRadiusA()*(N-K+7*(I-F)/8+55*D/64)/2;this.cp=15*this.ellipsoid.getEquatorialRadiusA()*(K-I+3*(F-D)/4)/16;this.dp=35*this.ellipsoid.getEquatorialRadiusA()*(I-F+11*D/16)/48;this.ep=315*this.ellipsoid.getEquatorialRadiusA()*(F-D)/512;var O=new MDVCoordinates("",90,89.99);var H=this.convertGeographicalToTransverseMercatorCoordinate(O);this.deltaNorthing=H.y;this.deltaEasting=H.x;var B=new MDVCoordinates("",90,0);var H=this.convertGeographicalToTransverseMercatorCoordinate(B);this.deltaEasting=H.x;this.deltaNorthing=0;this.radOriginLatitude=M;if(J>Math.PI){J-=(2*Math.PI)}this.radCentralMeridianLongitude=J;this.falseNorthing=G;this.falseEasting=P;this.scaleFactor=L}MDVProjectionTransverseMercator.prototype.convertTransverseMercatorToGeographicalCoordinate=function(Z){var Y=new MDVCoordinates("",0,0);var d;var b;var I;var G;var D;var C;var A;var J;var T;var L;var W;var P;var K;var H;var F;var X;var V;var U;var S;var Q;var O;var N;var M;var B;var E;E=this.SPHTMD(this.ap,this.bp,this.cp,this.dp,this.ep,this.radOriginLatitude);B=E+(Z.y-this.falseNorthing)/this.scaleFactor;P=this.SPHSR(this.ellipsoid.getEquatorialRadiusA(),this.ellipsoid.getFirstEccentricityESquare(),0);J=B/P;for(T=0;T<5;T++){X=this.SPHTMD(this.ap,this.bp,this.cp,this.dp,this.ep,J);P=this.SPHSR(this.ellipsoid.getEquatorialRadiusA(),this.ellipsoid.getFirstEccentricityESquare(),J);J=J+(B-X)/P}P=this.SPHSR(this.ellipsoid.getEquatorialRadiusA(),this.ellipsoid.getFirstEccentricityESquare(),J);W=this.ellipsoid.getPrimeVerticalRadiusN(J);L=Math.sin(J);d=Math.cos(J);K=Math.tan(J);H=K*K;F=H*H;G=this.ellipsoid.getSecondEccentricityESquare()*Math.pow(d,2);D=G*G;C=D*G;A=C*G;b=Z.x-this.falseEasting;if(Math.abs(b)<0.0001){b=0}X=K/(2*P*W*Math.pow(this.scaleFactor,2));V=K*(5+3*H+G-4*Math.pow(G,2)-9*H*G)/(24*P*Math.pow(W,3)*Math.pow(this.scaleFactor,4));U=K*(61+90*H+46*G+45*F-252*H*G-3*D+100*C-66*H*D-90*F*G+88*A+225*F*D+84*H*C-192*H*A)/(720*P*Math.pow(W,5)*Math.pow(this.scaleFactor,6));S=K*(1385+3633*H+4095*F+1575*Math.pow(K,6))/(40320*P*Math.pow(W,7)*Math.pow(this.scaleFactor,8));var R=J-Math.pow(b,2)*X+Math.pow(b,4)*V-Math.pow(b,6)*U+Math.pow(b,8)*S;Q=1/(W*d*this.scaleFactor);O=(1+2*H+G)/(6*Math.pow(W,3)*d*Math.pow(this.scaleFactor,3));N=(5+6*G+28*H-3*D+8*H*G+24*F-4*C+4*H*D+24*H*C)/(120*Math.pow(W,5)*d*Math.pow(this.scaleFactor,5));M=(61+662*H+1320*F+720*Math.pow(K,6))/(5040*Math.pow(W,7)*d*Math.pow(this.scaleFactor,7));I=b*Q-Math.pow(b,3)*O+Math.pow(b,5)*N-Math.pow(b,7)*M;var a=this.radCentralMeridianLongitude+I;while(R>(90*Math.PI/180)){R=Math.PI-R;a+=Math.PI;if(a>Math.PI){a-=(2*Math.PI)}}while(R<(-90*Math.PI/180)){R=-(R+Math.PI);a+=Math.PI;if(a>Math.PI){a-=(2*Math.PI)}}if(a>(2*Math.PI)){a-=(2*Math.PI)}if(a<-Math.PI){a+=(2*Math.PI)}Y.x=(a*180)/Math.PI;Y.y=(R*180)/Math.PI;Y.height=Z.height;return Y};MDVProjectionTransverseMercator.prototype.convertGeographicalToTransverseMercatorCoordinate=function(f){var g=new MDVCoordinates("",0,0);var j;var b;var Z;var Y;var W;var P;var K;var D;var C;var A;var X;var e;var V;var N;var L;var I;var G;var E;var U;var T;var S;var R;var Q;var O;var M;var J;var H;var B;var F;var i=(Math.PI*f.x)/180;var d=(Math.PI*f.y)/180;if(i>Math.PI){i-=(2*Math.PI)}if((i<(this.radCentralMeridianLongitude-this.radMaxDeltaLongitude))||(i>(this.radCentralMeridianLongitude+this.radMaxDeltaLongitude))){var h=i;if(i<0){h=i+2*Math.PI}var a=this.radCentralMeridianLongitude;if(this.radCentralMeridianLongitude<0){a=this.radCentralMeridianLongitude+2*Math.PI}}P=i-this.radCentralMeridianLongitude;if(Math.abs(P)>(9*Math.PI/180)){}if(P>Math.PI){P-=(2*Math.PI)}if(P<-Math.PI){P+=(2*Math.PI)}if(Math.abs(P)<2e-10){P=0}X=Math.sin(d);j=Math.cos(d);b=j*j;Z=b*j;Y=Z*b;W=Y*b;V=Math.tan(d);N=V*V;L=N*V;I=L*V;G=I*V;E=G*V;K=this.ellipsoid.getSecondEccentricityESquare()*b;D=K*K;C=D*K;A=C*K;e=this.ellipsoid.getPrimeVerticalRadiusN(d);B=this.SPHTMD(this.ap,this.bp,this.cp,this.dp,this.ep,d);F=this.SPHTMD(this.ap,this.bp,this.cp,this.dp,this.ep,this.radOriginLatitude);U=(B-F)*this.scaleFactor;T=e*X*j*this.scaleFactor/2;S=e*X*Z*this.scaleFactor*(5-N+9*K+4*D)/24;R=e*X*Y*this.scaleFactor*(61-58*N+I+270*K-330*N*K+445*D+324*C-680*N*D+88*A-600*N*C-192*N*A)/720;Q=e*X*W*this.scaleFactor*(1385-3111*N+543*I-E)/40320;g.y=this.falseNorthing+U+Math.pow(P,2)*T+Math.pow(P,4)*S+Math.pow(P,6)*R+Math.pow(P,8)*Q;O=e*j*this.scaleFactor;M=e*Z*this.scaleFactor*(1-N+K)/6;J=e*Y*this.scaleFactor*(5-18*N+I+14*K-58*N*K+13*D+4*C-64*N*D-24*N*C)/120;H=e*W*this.scaleFactor*(61-479*N+179*I-E)/5040;g.x=this.falseEasting+P*O+Math.pow(P,3)*M+Math.pow(P,5)*J+Math.pow(P,7)*H;g.height=f.s_height;return g};MDVProjectionTransverseMercator.prototype.SPHTMD=function(B,C,D,F,A,E){return(B*E-C*Math.sin(2*E)+D*Math.sin(4*E)-F*Math.sin(6*E)+A*Math.sin(8*E))};MDVProjectionTransverseMercator.prototype.SPHSR=function(A,B,C){return(A*(1-B)/Math.pow(this.DENOM(B,C),3))};MDVProjectionTransverseMercator.prototype.DENOM=function(A,B){return(Math.sqrt(1-A*Math.pow(Math.sin(B),2)))};var MDVEventID=0;var MDVEvent_ERROR=MDVEventID++;var MDVEvent_DEBUG=MDVEventID++;var MDVEvent_WARNING=MDVEventID++;var MDVEvent_INITIALISED=MDVEventID++;var MDVEvent_MAP_INITIALISED=MDVEventID++;var MDVEvent_ZOOM_CHANGED=MDVEventID++;var MDVEvent_CENTRE_CHANGED=MDVEventID++;var MDVEvent_CONTEXT_MENU=MDVEventID++;var MDVEvent_GADGET_REGISTERED=MDVEventID++;var MDVEvent_LAYER_ADDED=MDVEventID++;var MDVEvent_LAYER_UPDATED=MDVEventID++;var MDVEvent_AJAX_CALLBACK=MDVEventID++;var MDVEvent_MOUSE_MOVED=MDVEventID++;var MDVEvent_TOOLTIP=MDVEventID++;var MDVEvent_OBJECT_CLICKED=MDVEventID++;var MDVEvent_OBJECT_DBLCLICKED=MDVEventID++;var MDVEvent_OBJECT_LOADED=MDVEventID++;var MDVEvent_ROUTE_TRACE_FINISHED=MDVEventID++;var MDVEvent_MOUSE_UP=MDVEventID++;var MDVEvent_MOUSE_DOWN=MDVEventID++;function MDVEvents(){this.events=[];this.lastEventID=0}MDVEvents.prototype.addEventID=function(A){if(!this.events[A]){this.events[A]=[]}};MDVEvents.prototype.registerEvent=function(C,B,A){if(this.events[C]){this.events[C].push([B,A])}};MDVEvents.prototype.deregisterEvent=function(E,D,B){var C=false;if(!this.events[E]){return false}for(var A=0;A<this.events[E].length;A++){if(this.events[E][A][0]==D&&this.events[E][A][1]==B){this.events[E].splice(A,1);C=true}}return C};MDVEvents.prototype.triggerEvent=function(H){if(!this.events[H]){return false}var D=new Array();for(var E=0;E<arguments.length;E++){D[D.length]=arguments[E]}if(document.getElementById&&document.getElementById("MDVMap_Console")&&D.length>=2){var B=new Date();var C=B.getHours();var F=B.getMinutes();var G=B.getSeconds();if(C<=9){C="0"+C}if(F<=9){F="0"+F}if(G<=9){G="0"+G}var A=C+":"+F+":"+G;document.getElementById("MDVMap_Console").value=A+" "+D[1]+" (id: "+H+")\n"+document.getElementById("MDVMap_Console").value}for(var E=0;E<this.events[H].length;E++){this.events[H][E][1].apply(this.events[H][E][0],arguments)}return true};function MDVMap(A,B){this.config=null;if(B==null){B={}}this.options=B;this.viewport=A;this.viewport.mdvMap=this;this.markerObjects=null;this.markerLayer=null;this.tileRealWidth=-1;this.tileRealHeight=-1;this.tileCountWidth=-1;this.tileCountHeight=-1;this.startTileWidth=-1;this.startTileHeight=-1;this.imgCountWidth=0;this.imgCountHeight=0;this.viewportRealWidth=-1;this.viewportRealHeight=-1;this.tlReal=null;this.tlTileReal=null;this.offset=null;this.wrapOffset=null;this.real=new MDVCoordinates();this.viewport.style.overflow="hidden";this.viewport.style.position="relative";this.viewportHeight=-1;this.viewportWidth=-1;this.state=-1;this.lastTileLayerID=0;this.lastImageID=0;this.lastMarkerID=0;this.lastLayerID=0;this.lastToolTipID=0;this.lastContainerID=0;this.lastPolylineID=0;this.maxFailCount=3;this.transparent=new Image(1,1);this.mapper=null;this.mappers=new Array();this.events=new MDVEvents();this.gadgets=new Array();this.layers=new Array();this.overlays=new Array();this.renderer=null;this.toolTips=new MDVToolTipManager(this);this.cootrapro=new MDVMapCooTraPro();this.hotspots=null;this.speed=1;this.stepTime=40;this.stepPx=4;this.steps=null;this.moveJobID=null;this.crossHairSrc=new Image();this.crossHair=null;for(var C=0;C<MDVEventID;C++){this.events.addEventID(C)}}MDVMap.prototype.cleanMagnifyMapper=function(){var C=this.getMagnifyMapper();var B=C.childNodes.length;for(var A=0;A<B;A++){C.childNodes[B-A-1].mdvMap=null;if(C.childNodes[B-A-1].className!="mdvLayer"){C.removeChild(C.childNodes[B-A-1])}}return true};MDVMap.prototype.getMapper=function(){return this.mapper};MDVMap.prototype.getMagnifyMapper=function(){var B=null;for(var A=0;A<this.mappers.length;A++){if(this.mappers[A].id!=this.mapper.id){B=this.mappers[A];break}}return B};MDVMap.prototype.switchMapper=function(){var E=null;var B=null;for(var A=0;A<this.mappers.length;A++){if(this.mappers[A].id==this.mapper.id){E=this.mappers[A]}else{B=this.mappers[A]}}var C=E.childNodes.length;var D=null;for(var F=0;F<C;F++){if(E.childNodes[F].id==this.getName()+"_mdvMarkers"){D=E.childNodes[F];E.removeChild(D);B.appendChild(D);break}}E.style.zIndex=1;B.style.zIndex=30;this.mapper=B;this._removeImages();this.update();if(D){D.style.display="block"}return true};MDVMap.prototype.getToolTipManager=function(){return this.toolTips};MDVMap.prototype.getViewportExtends=function(){return{width:this.viewportWidth,height:this.viewportHeight}};MDVMap.prototype.getViewportRealExtends=function(){return{width:this.viewportRealWidth,height:this.viewportRealHeight}};MDVMap.prototype.getPoint=function(C){if(C==null){return null}this._updateMapValues();var G=this.config.getZoomLevel(this.config.currentZoomLevelIndex);var A=parseInt(G.get("tileSizeX"))*parseInt(G.get("numberOfTilesX"));var D=A/parseInt(G.get("realWidth"));var F=parseInt(G.get("tileSizeY"))*parseInt(G.get("numberOfTilesY"));var E=F/parseInt(G.get("realHeight"));var B=new MDVPoint(Math.floor(0.5+(C.x-this.tlTileReal.x)*D),Math.floor(0.5+(C.y-this.tlTileReal.y)*E));B.x=B.x-this.wrapOffset.x;B.y=B.y-this.wrapOffset.y;return B};MDVMap.prototype.getCoordinates=function(B){if(B==null){return null}this._updateMapValues();var G=this.config.getZoomLevel(this.config.currentZoomLevelIndex);var A=parseInt(G.get("tileSizeX"))*parseInt(G.get("numberOfTilesX"));var E=parseInt(G.get("realWidth"))/A;var F=parseInt(G.get("tileSizeY"))*parseInt(G.get("numberOfTilesY"));var D=parseInt(G.get("realHeight"))/F;var C=new MDVCoordinates(this.config.get("mapName"),Math.floor(0.5+this.tlReal.x+(B.x*E)),Math.floor(0.5+this.tlReal.y+(B.y*D)));return C};MDVMap.prototype.getWGS84=function(A){if(A.mapName==this.config.get("mapName")){return this.cootrapro.transform(A)}else{return A}};MDVMap.prototype.getInternalCoordinates=function(A){if(A){if(A.mapName==this.config.get("mapName")){return A}else{if(this.config.get("mapName")=="MTCV"){return this.cootrapro.transform(A)}else{return this.getInternalCoordinatesViaAjax(A)}}}};MDVMap.prototype.getInternalCoordinatesViaAjax=function(coords){if(!coords){return null}if(coords.mapName==this.config.get("mapName")){return coords}if(this.config.get("sfURL")==null){return coords}var host=this.config.get("sfURL");var efa=null;var txt=null;var mapName=coords.mapName;switch(mapName){case"WGS84":mapName="WGS84[DD.ddddd]";break}var _params={type_sf:"coord",name_sf:coords.x+":"+coords.y+":"+mapName};var _ajax=mdvLib.ajax({host:host,parameters:_params,asynchronous:false});if(typeof _ajax.responseIsFailure==="function"&&_ajax.responseIsFailure()===true){return null}txt=_ajax.transport!==undefined?_ajax.transport.responseText:_ajax.responseText;try{eval("efa = "+txt)}catch(e){this.events.triggerEvent(MDVEvent_ERROR,"MDVMap encountered an error (JSON). "+e.message);return null}if(efa&&efa.stopFinder&&efa.stopFinder.point&&efa.stopFinder.point.ref&&efa.stopFinder.point.ref.coords){var n=efa.stopFinder.point.ref.coords.split(",");return new MDVCoordinates(this.config.get("mapName"),n[0],n[1])}return null};MDVMap.prototype.createMarker=function(C,A,B){if(B!=""){return new MDVMarker(this,C,B,A)}else{return null}};MDVMap.prototype.createToolTip=function(B){if(arguments.length==2){var A=new MDVToolTip(this,arguments[1],"bubble");A.setSize(arguments[0]);return A}else{return new MDVToolTip(this,B,"simple")}};MDVMap.prototype._updateLayers=function(){for(var A=0;A<this.layers.length;A++){this.layers[A].update()}return true};MDVMap.prototype.release=function(C){for(var A=0;A<this.gadgets.length;A++){var B=this.gadgets[A];if(B.name=="MapNavigator"){B.onmouseup(C);return true}}return false};MDVMap.prototype.addMarker=function(A){return this.markerLayer.addMarker(A)};MDVMap.prototype.removeMarker=function(A){return this.markerLayer.removeMarker(A)};MDVMap.prototype.addLayer=function(B){var C=false;for(var A=0;A<this.layers.length;A++){if(this.layers[A].id==B.id){C=true}}if(!C){this.layers.push(B);this.events.triggerEvent(MDVEvent_LAYER_ADDED,"MDVMap has added a new layer ("+this.layers[A].name+")",this.layers[A]);this.layers.append=true;B.update()}};MDVMap.prototype.getLayer=function(B){for(var A=0;A<this.layers.length;A++){if(this.layers[A].name==B){return this.layers[A]}}return null};MDVMap.prototype.getLayers=function(){return this.layers};MDVMap.prototype.registerGadget=function(C){var B=false;for(var A=0;A<this.gadgets.length;A++){if(this.gadgets[A].name==C.name){B=true}}if(C.name=="GadgetBase"){B=true}if(!B){this.gadgets.push(C);this.events.triggerEvent(MDVEvent_GADGET_REGISTERED,"MDVMap registered a new gadget ("+C.name+")",C)}};MDVMap.prototype.getCentre=function(){if(this.real.x>0&&this.real.y>0){return this.real}else{return null}};MDVMap.prototype.setCentre=function(B){if(B){B=this.getInternalCoordinates(B)}if(B&&(!this.getCentre()||B.x!=this.getCentre().x||B.y!=this.getCentre().y)){var A=false;if(this._checkBoundariesX(B)){this.real.x=B.x;this.real.mapName=B.mapName;A=true}if(this._checkBoundariesY(B)){this.real.y=B.y;this.real.mapName=B.mapName;A=true}if(A){this.events.triggerEvent(MDVEvent_CENTRE_CHANGED,"MDVMap centre has been changed",B)}return A}else{return false}};MDVMap.prototype._checkBoundariesX=function(F){var E=this.config.getZoomLevel(this.config.getZoomLevelIndex());var B=parseInt(E.get("realOffsetX"));var D=parseInt(E.get("realWidth"));var A=parseInt(E.get("tileSizeX"))*parseInt(E.get("numberOfTilesX"));var C=D/A;if(((F.x-B)*(F.x-(B+D)))<=0){return true}else{return false}};MDVMap.prototype._checkBoundariesY=function(F){var D=this.config.getZoomLevel(this.config.getZoomLevelIndex());var E=parseInt(D.get("realOffsetY"));var B=parseInt(D.get("realHeight"));var C=parseInt(D.get("tileSizeY"))*parseInt(D.get("numberOfTilesY"));var A=B/C;if(((F.y-E)*(F.y-(E+B)))<=0){return true}else{return false}};MDVMap.prototype.setZoomLevel=function(A){var B=this.config.getZoomLevel(A);if(this.config.getZoomLevelIndex()!=A&&B){this.config.setZoomLevelIndex(A);if(this.config.get("showHotspotLevel")&&(A>=parseInt(this.config.get("showHotspotLevel")))&&this.hotspots.json==null){this.hotspots.retrieve()}this.events.triggerEvent(MDVEvent_ZOOM_CHANGED,"MDVMap zoom level has been changed",A);return true}else{if(!B){this.events.triggerEvent(MDVEvent_ERROR,"MDVMap wasn't able to set new zoom level.")}return false}};MDVMap.prototype.getObjWidth=function(D){var A=0;if(D.offsetWidth){A=D.offsetWidth}else{if(D.clip&&D.clip.width){A=D.clip.width}else{if(D.style&&D.style.pixelWidth){A=D.style.pixelWidth}}}var B=parseInt(D.style.borderLeftWidth);var C=parseInt(D.style.borderRightWidth);if(B>0){A-=B}if(C>0){A-=C}return parseInt(A)};MDVMap.prototype.getObjHeight=function(D){var B=0;if(D.offsetHeight){B=D.offsetHeight}else{if(D.clip&&D.clip.height){B=D.clip.height}else{if(D.style&&D.style.pixelHeight){B=D.style.pixelHeight}}}var C=parseInt(D.style.borderTopWidth);var A=parseInt(D.style.borderBottomWidth);if(C>0){B-=C}if(A>0){B-=A}return parseInt(B)};MDVMap.prototype._setBackgroundColour=function(A){this.viewport.style.backgroundColor=A};MDVMap.prototype.getName=function(){return this.name};MDVMap.prototype.resize=function(){this.viewportHeight=this.getObjHeight(this.viewport);this.viewportWidth=this.getObjWidth(this.viewport);if(this.viewportHeight<=2||this.viewportWidth<=2){this.events.triggerEvent(MDVEvent_ERROR,"MDVMap couldn't get size from target map object ("+this.viewport.id+").")}if(this.state==1){this.update()}};MDVMap.prototype.execute=function(B){this.resize();this.wrapOffset=new MDVPoint(0,0);if(B&&this.config==null){this.config=B}else{this.events.triggerEvent(MDVEvent_ERROR,"MDVMap couldn't find an appropriate configuration or already has one.");this.state=-1;return false}this.name=this.viewport.id;if(!document.mdvMaps){document.mdvMaps=new Array()}document.mdvMaps["mdvMap_"+this.name]=this;if(this.config.get("defaultScale")>=0){this.setZoomLevel(parseInt(this.config.get("defaultScale")))}else{this.setZoomLevel(3)}if(!this.getCentre()){var C=new MDVCoordinates(this.config.get("mapName"),parseInt(this.config.get("xCenterReal")),parseInt(this.config.get("yCenterReal")));this.setCentre(C)}this._updateMapValues();if(this.config.get("enableHotspots")){new MDVHotspots(this)}this.mappers[0]=document.createElement("div");this.mappers[0].id=this.name+"_mapper0";this.mappers[0].style.position="absolute";this.mappers[0].style.left="0px";this.mappers[0].style.top="0px";this.mappers[0].style.zIndex="30";this.mappers[0].mdvMap=this;this.mappers[0].tiles=new Array();this.mappers[1]=document.createElement("div");this.mappers[1].id=this.name+"_mapper1";this.mappers[1].style.position="absolute";this.mappers[1].style.left="0px";this.mappers[1].style.top="0px";this.mappers[1].style.zIndex="1";this.mappers[1].mdvMap=this;this.mappers[1].tiles=new Array();this.mapper=this.mappers[0];this.viewport.appendChild(this.mappers[0]);this.viewport.appendChild(this.mappers[1]);this.mappers[0].onmousemove=MDVMap_onmousemove;this.mappers[0].onmouseover=MDVMap_onmouseover;this.mappers[0].onmousedown=MDVMap_onmousedown;this.mappers[0].onmouseup=MDVMap_onmouseup;this.mappers[0].onkeypress=MDVMap_onkeypress;this.mappers[0].ondblclick=MDVMap_ondblclick;this.mappers[0].oncontextmenu=MDVMap_oncontextmenu;this.mappers[0].onmousewheel=MDVMap_onmousewheel;this.mappers[0].onclick=MDVMap_onclick;this.mappers[1].onmousemove=MDVMap_onmousemove;this.mappers[1].onmouseover=MDVMap_onmouseover;this.mappers[1].onmousedown=MDVMap_onmousedown;this.mappers[1].onmouseup=MDVMap_onmouseup;this.mappers[1].onkeypress=MDVMap_onkeypress;this.mappers[1].ondblclick=MDVMap_ondblclick;this.mappers[1].oncontextmenu=MDVMap_oncontextmenu;this.mappers[1].onmousewheel=MDVMap_onmousewheel;this.mappers[1].onclick=MDVMap_onclick;this.viewport.onmouseout=MDVMap_onmouseout;if(window.addEventListener&&navigator.product&&navigator.product=="Gecko"){this.viewport.addEventListener("DOMMouseScroll",MDVMap_onmousewheel,false)}if(this.config.get("maxFailCount")){this.maxFailCount=parseInt(this.config.get("maxFailCount"))}if(this.config.get("crosshair")){var A="images/";if(this.config.get("imagePath")){A=this.config.get("imagePath")}this.crossHairSrc.src=A+this.config.get("crosshair")}this.mappers[0].ondragstart=new Function([],"var e=e?e:event;e.cancelBubble=true;e.returnValue=false;return false;");this.mappers[1].ondragstart=new Function([],"var e=e?e:event;e.cancelBubble=true;e.returnValue=false;return false;");this.transparent.src=this.config.get("transparentImg");if(this.config.get("cursorIdle")){this.mappers[0].style.cursor=this.config.get("cursorIdle");this.mappers[1].style.cursor=this.config.get("cursorIdle")}this._viewMap();this.renderer=(this.config.get("useCanvasRenderer")=="true"&&document.createElement("canvas").getContext)?new MDVCanvasRenderer(this,this.markerObjects):((document.createElementNS)?new MDVSVGRenderer(this,this.markerObjects):new MDVVMLRenderer(this,this.markerObjects))};MDVMap.prototype.assignTooltipHandler=function(B){if(this.config.get("tooltipHandler")){var A=this.config.get("tooltipHandler");if(A.indexOf("click")!==-1){B.onclick=MDVMarker_displayToolTip}else{if(A.indexOf("mouseover")!==-1){B.onmouseover=MDVMarker_displayToolTip;B.onmouseout=MDVMarker_hideToolTip}}return true}B.onmouseover=MDVMarker_displayToolTip;B.onmouseout=MDVMarker_hideToolTip};MDVMap.prototype.destroy=function(){if(this.state==-1){return }var A=this.gadgets.length;for(var E=0;E<A;E++){var B=this.gadgets.pop();if(B){B.destroy()}}var H=this.layers.length;for(var C=0;C<H;C++){var F=this.layers.pop();if(F){F.destroy()}}for(var I=0;I<this.getMapper().tiles.length;I++){var G=this.getMapper().tiles[I];for(var D=0;D<G.div.childNodes.length;D++){if(G.div.childNodes[D].mdvMap){G.div.childNodes[D].mdvMap=null}}}if(this.mapper){this.mapper.onmousemove=null;this.mapper.onmouseover=null;this.mapper.onmousedown=null;this.mapper.onmouseup=null;this.viewport.onmouseout=null;this.mapper.onkeypress=null;this.mapper.ondblclick=null;this.mapper.oncontextmenu=null;this.mapper.onmousewheel=null;this.mapper.onclick=null;this.mapper.mdvMap=null}if(this.markerObjects&&this.markerObjects.mdvMap){this.markerObjects.mdvMap=null}if(this.viewport&&this.viewport.mdvMap){this.viewport.mdvMap=null}if(this.crossHair){this.crossHair=null}if(this.crossHairSrc){this.crossHairSrc=null}this.transparent=null;document.mdvMaps["mdvMap_"+this.name]=null};MDVMap.prototype._updateVisibleMap=function(){var D=this.config.getZoomLevel(this.config.currentZoomLevelIndex);this._updateMapValues();var E=parseInt((this.tlReal.x-parseInt(D.get("realOffsetX")))/this.tileRealWidth);if(E<0){E=0}var G=parseInt((this.tlReal.x+this.viewportRealWidth-D.get("realOffsetX"))/this.tileRealWidth);if(G>=parseInt(D.get("numberOfTilesX"))){G=parseInt(D.get("numberOfTilesX"))-1}var M=parseInt((this.tlReal.y-parseInt(D.get("realOffsetY")))/this.tileRealHeight);if(M<0){M=0}var F=parseInt((this.tlReal.y+this.viewportRealHeight-parseInt(D.get("realOffsetY")))/this.tileRealHeight);if(F>=parseInt(D.get("numberOfTilesY"))){F=parseInt(D.get("numberOfTilesY"))-1}this.tileVisibleWidth=G-E+2;this.tileVisibleHeight=F-M+2;this.startTileWidth=E;this.startTileHeight=M;if(D.get("numberOfTilesX")<=1){this.tileVisibleWidth--}if(D.get("numberOfTilesY")<=1){this.tileVisibleHeight--}var I=parseInt(D.get("tileSizeX"))*parseInt(D.get("numberOfTilesX"));var K=I/parseInt(D.get("realWidth"));var B=parseInt(D.get("tileSizeY"))*parseInt(D.get("numberOfTilesY"));var J=B/parseInt(D.get("realHeight"));var H=new MDVPoint((this.getCentre().x-parseInt(D.get("realOffsetX")))*K,(this.getCentre().y-parseInt(D.get("realOffsetY")))*J);var L=new MDVPoint((this.tlReal.x-parseInt(D.get("realOffsetX")))*K,(this.tlReal.y-parseInt(D.get("realOffsetY")))*J);var A=new MDVPoint();A.x=(this.tlTileReal.x-parseInt(D.get("realOffsetX")))*K;A.y=(this.tlTileReal.y-parseInt(D.get("realOffsetY")))*J;A.x=Math.floor(A.x+0.5);A.y=Math.floor(A.y+0.5);var C=new MDVPoint(A.x-parseInt(L.x),A.y-parseInt(L.y));this.getMapper().style.left=C.x+"px";this.getMapper().style.top=C.y+"px";this.getCentre().x=Math.floor(this.getCentre().x+0.5);this.getCentre().y=Math.floor(this.getCentre().y+0.5);this.wrapOffset=new MDVPoint(0,0)};MDVMap.prototype._updateMapValues=function(){var H=this.config.getZoomLevel(this.config.currentZoomLevelIndex);if(!H){this.events.triggerEvent(MDVEvent_ERROR,"MDVMap has an invalid zoom level.");return false}var A=parseInt(H.get("tileSizeX"))*parseInt(H.get("numberOfTilesX"));var E=A/parseInt(H.get("realWidth"));var G=parseInt(H.get("tileSizeY"))*parseInt(H.get("numberOfTilesY"));var F=G/parseInt(H.get("realHeight"));this.tileRealWidth=parseInt(H.get("realWidth"))/parseInt(H.get("numberOfTilesX"));this.tileRealHeight=parseInt(H.get("realHeight"))/parseInt(H.get("numberOfTilesY"));this.tileCountWidth=parseInt(this.viewportWidth)/parseInt(H.get("tileSizeX"));this.tileCountHeight=parseInt(this.viewportHeight)/parseInt(H.get("tileSizeY"));this.viewportRealWidth=parseInt(this.tileRealWidth*this.tileCountWidth);this.viewportRealHeight=parseInt(this.tileRealHeight*this.tileCountHeight);this.tlReal=new MDVCoordinates(this.config.get("mapName"),parseInt(this.getCentre().x-(this.viewportRealWidth/2)),parseInt(this.getCentre().y-(this.viewportRealHeight/2)));var B=new MDVPoint((this.tlReal.x-parseInt(H.get("realOffsetX")))*E,(this.tlReal.y-parseInt(H.get("realOffsetY")))*F);var D=parseInt(B.x/parseInt(H.get("tileSizeX")));var C=parseInt(B.y/parseInt(H.get("tileSizeY")));this.tlTileReal=new MDVCoordinates(this.config.get("mapName"),D*this.tileRealWidth+parseInt(H.get("realOffsetX")),C*this.tileRealHeight+parseInt(H.get("realOffsetY")));this.tlTileReal.x=Math.floor(this.tlTileReal.x+0.5);this.tlTileReal.y=Math.floor(this.tlTileReal.y+0.5);return true};MDVMap.prototype.getTopLeftTileReal=function(){return this.tlTileReal};MDVMap.prototype._checkWrap=function(){var F=this.config.getZoomLevel(this.config.getZoomLevelIndex());var C=new MDVPoint(F.get("tileSizeX"),F.get("tileSizeY"));var B=this.viewportWidth-parseInt(F.get("numberOfTilesX"))*parseInt(F.get("tileSizeX"));var A=this.viewportWidth-parseInt(F.get("numberOfTilesY"))*parseInt(F.get("tileSizeY"));var E=F.get("numberOfTilesX")<=1|B>0;var D=F.get("numberOfTilesY")<=1|A>0;this.offset=new MDVPoint(parseInt(this.getMapper().style.left)-this.wrapOffset.x,parseInt(this.getMapper().style.top)-this.wrapOffset.y);if(this.offset.x>0){if(E){return false}this._applyWrapR2L()}if(this.offset.x<-(C.x)){if(E){return false}this._applyWrapL2R()}if(this.offset.y>0){if(D){return false}this._applyWrapB2T()}if(this.offset.y<-(C.y)){if(D){return false}this._applyWrapT2B()}return true};MDVMap.prototype._applyWrapT2B=function(){for(var D=0;D<this.getMapper().tiles.length;D++){var B=this.getMapper().tiles[D];var G=this.config.getZoomLevel(this.config.getZoomLevelIndex());var F=new MDVPoint(G.get("tileSizeX"),G.get("tileSizeY"));var E=parseInt(B.div.childNodes[this.imgCountHeight*this.imgCountWidth-1].style.top);for(var A=0;A<this.imgCountWidth;A++){var C=B.div.childNodes[0];C.style.filter="";C.src=this.transparent.src;C.style.top=(parseInt(E)+parseInt(F.y))+"px";C.src=this.transparent.src;B.div.removeChild(C);B.div.appendChild(C)}}this.wrapOffset.y-=parseInt(F.y);this.startTileHeight++;this._setMapTiles(false)};MDVMap.prototype._applyWrapB2T=function(){for(var D=0;D<this.getMapper().tiles.length;D++){var B=this.getMapper().tiles[D];var G=this.config.getZoomLevel(this.config.getZoomLevelIndex());var F=new MDVPoint(G.get("tileSizeX"),G.get("tileSizeY"));var C=parseInt(B.div.childNodes[0].style.top);for(var A=0;A<this.imgCountWidth;A++){var E=B.div.childNodes[(this.imgCountHeight*this.imgCountWidth)-1];E.style.filter="";E.src=this.transparent.src;E.style.top=(parseInt(C)-parseInt(F.y))+"px";E.src=this.transparent.src;B.div.removeChild(E);B.div.insertBefore(E,B.div.childNodes[0])}}this.wrapOffset.y+=parseInt(F.y);this.startTileHeight--;this._setMapTiles(false)};MDVMap.prototype._applyWrapL2R=function(){for(var D=0;D<this.getMapper().tiles.length;D++){var A=this.getMapper().tiles[D];var G=this.config.getZoomLevel(this.config.getZoomLevelIndex());var F=new MDVPoint(G.get("tileSizeX"),G.get("tileSizeY"));var E=parseInt(A.div.childNodes[this.imgCountWidth-1].style.left);for(var H=0;H<this.imgCountHeight;H++){var B=A.div.childNodes[H*this.imgCountWidth];var C;if(H<(this.imgCountHeight-1)){C=A.div.childNodes[(H+1)*this.imgCountWidth]}else{C=null}B.style.filter="";B.src=this.transparent.src;B.style.left=(parseInt(E)+parseInt(F.x))+"px";B.src=this.transparent.src;A.div.removeChild(B);if(C){A.div.insertBefore(B,C)}else{A.div.appendChild(B)}}}this.wrapOffset.x-=parseInt(F.x);this.startTileWidth++;this._setMapTiles(false)};MDVMap.prototype._applyWrapR2L=function(){for(var B=0;B<this.getMapper().tiles.length;B++){var A=this.getMapper().tiles[B];var F=this.config.getZoomLevel(this.config.getZoomLevelIndex());var C=new MDVPoint(F.get("tileSizeX"),F.get("tileSizeY"));var D=parseInt(A.div.childNodes[0].style.left);for(var H=0;H<this.imgCountHeight;H++){var G=A.div.childNodes[((H+1)*this.imgCountWidth)-1];var E=A.div.childNodes[H*this.imgCountWidth];G.style.filter="";G.src=this.transparent.src;G.style.left=(D-C.x)+"px";G.src=this.transparent.src;A.div.removeChild(G);A.div.insertBefore(G,E)}}this.wrapOffset.x+=parseInt(C.x);this.startTileWidth--;this._setMapTiles(false)};MDVMap.prototype.update=function(){this._updateVisibleMap();this._setLayers();this._updateLayers();if(this._setImages()){this._setOptimisedMapTiles()}else{var C=this.config.getZoomLevel(this.config.getZoomLevelIndex());var D=parseInt(C.get("realOffsetX"))+parseInt(C.get("realWidth"))/2;var B=parseInt(C.get("realOffsetY"))+parseInt(C.get("realHeight"))/2;var A=new MDVCoordinates(this.config.get("mapName"),parseInt(D),parseInt(B));this.events.triggerEvent(MDVEvent_ERROR,"MDVMap has determined that the given coordinates are out of bounds. Setting zoom level centre.",A);this.setCentre(A);this.update()}this.events.triggerEvent(MDVEvent_MAP_INITIALISED,"MDVMap tiles have been initialised",this)};MDVMap.prototype._viewMap=function(){this.state=0;if(this.config.get("backgroundColour")){this._setBackgroundColour(this.config.get("backgroundColour"))}else{this._setBackgroundColour("#E5E5E5")}this.events.triggerEvent(MDVEvent_INITIALISED,"MDVMap has been initialised",this);this._setLayers();this.update();this.state=1};MDVMap.prototype._setMapTiles=function(H){for(var I=0;I<this.getMapper().tiles.length;I++){var B=this.getMapper().tiles[I];B.display();var C=this.config.getZoomLevel(this.config.getZoomLevelIndex());if(!(this.imgCountWidth*this.imgCountHeight==B.div.childNodes.length)){this.events.triggerEvent(MDVEvent_ERROR,"MDVMap noticed an inconsistency within the tile layer.");this._removeImages();this.update();return }var J=B.getFileType();for(var F=0;F<this.imgCountHeight;F++){for(var G=0;G<this.imgCountWidth;G++){var D=B.div.childNodes[(F*this.imgCountWidth)+G];if(!D){this.events.triggerEvent(MDVEvent_ERROR,"Error accessing tile within DOM.");return false}var E=new MDVPoint(G*parseInt(C.get("tileSizeX")),F*parseInt(C.get("tileSizeY")));var A=B.getImageURL(G,F);if(D.src!=A&&D.style.filter!="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+A+"');"){D.style.filter="";if(B.isActive()){D.src=A}else{D.src=this.transparent.src}if(H&&!document.all){D.style.visibility="hidden"}}else{if(!H){continue}}if(B.isOverlay()){D.overlay=true}else{D.overlay=false}D.style.width=C.get("tileSizeX");D.style.height=C.get("tileSizeY");D.width=C.get("tileSizeX");D.height=C.get("tileSizeY");if(this.config.get("debug")){D.alt=A;D.title=A}D.failCount=0;if(H){D.style.left=E.x+"px";D.style.top=E.y+"px"}}}}};MDVMap.prototype._setOptimisedMapTiles=function(){var D=this.config.getZoomLevel(this.config.getZoomLevelIndex());for(var K=0;K<this.getMapper().tiles.length;K++){var C=this.getMapper().tiles[K];C.display();var B=new Array();if(!(this.imgCountWidth*this.imgCountHeight==C.div.childNodes.length)){this.events.triggerEvent(MDVEvent_ERROR,"MDVMap noticed an inconsistency within the tile layer.");this._removeImages();this.update();return }var L=C.getFileType();for(var H=0;H<this.imgCountHeight;H++){for(var I=0;I<this.imgCountWidth;I++){var F=C.div.childNodes[(H*this.imgCountWidth)+I];if(!F){this.events.triggerEvent(MDVEvent_ERROR,"Error accessing tile within DOM.");return false}var G=new MDVPoint(I*parseInt(D.get("tileSizeX")),H*parseInt(D.get("tileSizeY")));var A=C.getImageURL(I,H);if(C.isOverlay()){F.overlay=true}else{F.overlay=false}B.push({priority:C.quantifier(G),img:F,src:A,pos:G,size:new MDVPoint(D.get("tileSizeX"),D.get("tileSizeY"))})}}B.sort(C.sorter);for(var E=0;E<B.length;E++){var J=B[E];if(J.img.src!=J.src||C.isActive()==false){J.img.style.filter="";if(C.isActive()){J.img.src=J.src}else{J.img.src=this.transparent.src}if(!document.all){J.img.style.visibility="hidden"}}J.img.style.width=J.size.x+"px";J.img.style.height=J.size.y+"px";J.img.width=J.size.x;J.img.height=J.size.y;if(this.config.get("debug")){J.img.alt=A;J.img.title=A}J.img.failCount=0;J.img.style.left=J.pos.x+"px";J.img.style.top=J.pos.y+"px"}}};MDVMap.prototype.createOverlay=function(C,B){var A=null;A={mdvMap:this,name:C,url:B,imgURL:arguments.length>=3?arguments[2]:null,quantifier:arguments.length>=3?arguments[3]:null,sorter:arguments.length>=3?arguments[4]:null,fileType:null,tiles:null};A.setFileType=function(D){this.fileType=D};A.setActive=function(D){if(this.tiles){this.tiles.setActive(D)}};A.getName=function(){return this.name};return A};MDVMap.prototype.addOverlay=function(A){for(var B=0;B<this.overlays.length;B++){if(this.overlays[B].getName()==A.getName()){return false}}this.overlays.push(A);return true};MDVMap.prototype._setLayers=function(){if(this.getMapper().tiles.length<=0&&this.getMapper()){var B=new MDVTiles(this,this.getMapper().id+"_mapTiles");if(this.options["getImageURL"]!=null&&typeof this.options["getImageURL"]=="function"){B.getImageURL=this.options["getImageURL"]}this.getMapper().tiles.push(B);var A=null;for(var C=0;C<this.overlays.length;C++){if(this.overlays[C].imgURL){A=new MDVTiles(this.overlays[C].mdvMap,this.getMapper().id+"_overlay_"+this.overlays[C].name,this.overlays[C].imgURL);A.setOverlay(true);A.setSrcPath(this.overlays[C].url);if(this.overlays[C].fileType){A.setFileType(this.overlays[C].fileType)}if(this.overlays[C].quantifier){A.setQuantifier(this.overlays[C].quantifier)}if(this.overlays[C].sorter){A.setSorter(this.overlays[C].sorter)}}else{A=new MDVTiles(this.overlays[C].mdvMap,this.getMapper().id+"_overlay_"+this.overlays[C].name);A.setOverlay(true);if(this.overlays[C].url){A.setSrcPath(this.overlays[C].url)}if(this.overlays[C].fileType){A.setFileType(this.overlays[C].fileType)}}this.overlays[C].tiles=A;this.getMapper().tiles.push(A)}}if(!this.markerObjects&&this.getMapper()){this.markerObjects=document.createElement("div");this.markerObjects.className="mdvLayer";this.markerObjects.style.zIndex="55";this.markerObjects.id=this.getName()+"_mdvMarkers";this.markerObjects.style.position="absolute";this.markerObjects.style.visibility="visible";this.markerObjects.style.left="0px";this.markerObjects.style.top="0px";this.markerObjects.style.width="3000px";this.markerObjects.style.height="3000px";this.markerObjects.mdvMap=this;this.getMapper().appendChild(this.markerObjects);this.markerObjects.append=true}if(!this.markerLayer){this.markerLayer=this.createLayer("mdvMarkers");this.addLayer(this.markerLayer)}};MDVMap.prototype._setImages=function(){if(this.tileVisibleWidth<=0||this.tileVisibleHeight<=0){return false}while(this.imgCountWidth<this.tileVisibleWidth){this._addColumn()}while(this.imgCountHeight<this.tileVisibleHeight){this._addRow()}while(this.imgCountHeight>this.tileVisibleHeight){this._removeRow()}while(this.imgCountWidth>this.tileVisibleWidth){this._removeColumn()}return true};MDVMap.prototype._removeImages=function(){for(var D=0;D<this.getMapper().tiles.length;D++){var B=this.getMapper().tiles[D];var E=B.div.childNodes.length;for(var C=0;C<E;C++){var A=B.div.childNodes[E-C-1];A.onmousedown=null;A.onmousemove=null;A.onmouseout=null;A.onmouseover=null;A.onmouseup=null;A.onmousewheel=null;A.onclick=null;A.onload=null;A.onerror=null;if(A.mdvMap){A.mdvMap=null}B.div.removeChild(A)}this.imgCountWidth=0;this.imgCountHeight=0}if(this.getMapper().tiles.length==0){this.imgCountWidth=0;this.imgCountHeight=0}};MDVMap.prototype._addColumn=function(){if(this.tileVisibleWidth==0){return }for(var D=0;D<this.getMapper().tiles.length;D++){var A=this.getMapper().tiles[D];var E=this.config.getZoomLevel(this.config.getZoomLevelIndex());for(var C=0;C<this.imgCountHeight;C++){var F=new MDVPoint((this.imgCountWidth+1)*parseInt(E.get("tileSizeX")),C*parseInt(E.get("tileSizeY")));var B=this._createImage(F);A.div.appendChild(B)}}this.imgCountWidth++};MDVMap.prototype._removeColumn=function(){if(this.imgCountWidth<=1){return }for(var E=0;E<this.getMapper().tiles.length;E++){var A=this.getMapper().tiles[E];var D=A.div.childNodes.length+this.imgCountWidth-2;for(var F=0;F<this.imgCountHeight;F++){var C=(this.imgCountHeight*F)+(this.imgCountWidth-1);var B=A.div.childNodes[(D-C)];if(!B){this.events.triggerEvent(MDVEvent_ERROR,"Error accessing tile.");return false}B.onmousedown=null;B.onmousemove=null;B.onmouseout=null;B.onmouseover=null;B.onmouseup=null;B.onmousewheel=null;B.onclick=null;if(B.mdvMap){B.mdvMap=null}B.onload=null;B.onerror=null;A.div.removeChild(B)}}this.imgCountWidth--};MDVMap.prototype._addRow=function(){if(this.tileVisibleWidth==0){return }for(var D=0;D<this.getMapper().tiles.length;D++){var A=this.getMapper().tiles[D];var E=this.config.getZoomLevel(this.config.getZoomLevelIndex());var C;for(C=0;C<this.tileVisibleWidth;C++){var F=new MDVPoint(C*parseInt(E.get("tileSizeX")),this.imgCountHeight*parseInt(E.get("tileSizeY")));var B=this._createImage(F);A.div.appendChild(B);this.imgCountWidth++}}this.imgCountWidth=C;this.imgCountHeight++};MDVMap.prototype._removeRow=function(){if(this.imgCountHeight<=1){return }for(var E=0;E<this.getMapper().tiles.length;E++){var A=this.getMapper().tiles[E];var F=this.config.getZoomLevel(this.config.getZoomLevelIndex());for(var D=0;D<this.imgCountWidth;D++){var C=(this.imgCountHeight*this.imgCountWidth)-D-1;var B=A.div.childNodes[C];if(!B){this.events.triggerEvent(MDVEvent_ERROR,"MDVMap has problems while accessing tile.");return false}B.onload=null;B.onerror=null;A.div.removeChild(B)}}this.imgCountHeight--};MDVMap.prototype._createImage=function(C){var B=this.config.getZoomLevel(this.config.getZoomLevelIndex());var A=document.createElement("img");A.src=this.transparent.src;A.width=parseInt(B.get("tileSizeX"));A.height=parseInt(B.get("tileSizeY"));A.setAttribute("style","position:absolute; top:"+C.y+"px; left:"+C.x+"px;");A.style.position="absolute";A.style.width=parseInt(B.get("tileSizeX"))+"px";A.style.height=parseInt(B.get("tileSizeY"))+"px";A.style.top=C.y;A.style.left=C.x;A.galleryimg="no";A.onerror=MDVMap_imgOnError;A.onload=MDVMap_imgOnLoad;A.mdvMap=this;A.id="t"+this.lastImageID++;A.failCount=0;return A};MDVMap.prototype.getPolylinePoints=function(){var F=new Array();var D=new Array();for(var B=0;B<this.layers.length;B++){var C=this.layers[B].getPolylineCoords();for(var E=0;E<C.length;E++){var A=this.getPoint(C[E]);F.push(A.x);D.push(A.y)}}return[F,D]};MDVMap.prototype.getPolylineCoords=function(){var E=new Array();var C=new Array();for(var A=0;A<this.layers.length;A++){var B=this.layers[A].getPolylineCoords();for(var D=0;D<B.length;D++){E.push(B[D].x);C.push(B[D].y)}}return[E,C]};MDVMap.prototype.createLayer=function(A){var B=new MDVLayer(this,A);return B};MDVMap.prototype.hideToolTips=function(){var C=this.getLayers();var B=false;for(var A=0;A<C.length;A++){B=C[A].hideToolTips()}return B};MDVMap.prototype.createPolyline=function(B){var A=null;if(arguments.length==2){A=new MDVPolyline(this,B,arguments[1])}else{A=new MDVPolyline(this,B)}return A};MDVMap.prototype.wizardSetMotIcon=function(C){var B,A,D=this;if(!C){return }A=function(){var E=this.wizardMotIcon,F=this.getViewportExtends();if(E){E.src=C;E.style.top=parseInt(F.height/2-B.height/2)+"px";E.style.left=parseInt(F.width/2-B.width/2)+"px";return }B.id="wizardMotIcon";B.style.display="block";B.style.position="absolute";B.style.top=parseInt(F.height/2-B.height/2)+"px";B.style.left=parseInt(F.width/2-B.width/2)+"px";B.style.zIndex=999;this.wizardMotIcon=B;this.viewport.appendChild(B)};B=new Image();B.onload=function(){A.apply(D,[])};B.src=C};MDVMap.prototype.wizardRemoveMotIcon=function(){if(!this.wizardMotIcon){return }this.viewport.removeChild(this.wizardMotIcon);this.wizardMotIcon=null};MDVMap.prototype.moveBySeq=function(E){var D=true;if(this.moveJobID){mdvTimer.remove(this.moveJobID)}this.cleanMagnifyMapper();var A=this.getMoveSeq(E);var C=null;if(arguments.length>=2){if(arguments[1]){C=arguments[1]}if(arguments.length==3){D=arguments[2]}}if(A.length>0&&D){var B=A[0].clone();this.setCentre(B);this.update()}this.moveJobID=mdvTimer.add(this.stepTime,this,this.move,[A,0]);return true};MDVMap.prototype.getMoveSeq=function(G){if(G.length<=0){return null}var D=this.config.getZoomLevel(this.config.currentZoomLevelIndex);var K=parseInt(D.get("tileSizeX"))*parseInt(D.get("numberOfTilesX"));var E=parseInt(D.get("realWidth"))/K;var L=new Array();var I=G[0].clone();var B=0;var F=null;var M=null;var H=this.stepPx*E;for(var J=1;J<G.length;J++){M=G[J];var C=new MDVPoint(M.x-I.x,M.y-I.y);if(C.x==0&&C.y==0){continue}B=Math.sqrt(Math.pow(C.x,2)+Math.pow(C.y,2));var A=H/B;F=new MDVPoint(C.x*A,C.y*A);while(B>H){I.x=(I.x+F.x);I.y=(I.y+F.y);L.push(I.clone());B=B-H}if(B>0){F=new MDVPoint(M.x-I.x,M.y-I.y);I.x=(I.x+F.x);I.y=(I.y+F.y);L.push(I.clone())}B=0}return L};MDVMap.prototype.move=function(A,B){if(B>=A.length){if(this.moveJobID){mdvTimer.remove(this.moveJobID)}this.moveJobID=null;this.wizardRemoveMotIcon();this.removeMarker(this.crossHair);if(this.crossHair){this.crossHair.destroy()}this.crossHair=null;this.events.triggerEvent(MDVEvent_ROUTE_TRACE_FINISHED,"MDVMap has finished moving...",A);this.update();return false}this.moveTo(A[B]);B++;this.moveJobID=mdvTimer.add(this.stepTime,this,this.move,[A,B])};MDVMap.prototype.cancelMoveBySeq=function(){var A=false;if(mdvTimer){A=mdvTimer.remove(this.moveJobID)}this.moveJobID=null;this.wizardRemoveMotIcon();if(this.crossHair){this.removeMarker(this.crossHair);this.crossHair.destroy();this.crossHair=null}return A};MDVMap.prototype.moveTo=function(C){var B=this.getPoint(this.getCentre());var D=this.getPoint(C);if(this.crossHair){this.crossHair.setCoords(C.clone())}var A=new MDVPoint(parseInt(this.getMapper().style.left),parseInt(this.getMapper().style.top));if(B==null||D==null){return false}var E=new MDVPoint(D.x-B.x,D.y-B.y);this.getMapper().style.left=(A.x-E.x)+"px";this.getMapper().style.top=(A.y-E.y)+"px";if(this.getMagnifyMapper()){this.getMagnifyMapper().style.left=(parseInt(this.getMagnifyMapper().style.left)-E.x)+"px";this.getMagnifyMapper().style.top=(parseInt(this.getMagnifyMapper().style.top)-E.y)+"px"}this.setCentre(C);this._checkWrap();return true};MDVMap.prototype.magnify=function(D){var I=this.config.getZoomLevel(this.config.getZoomLevelIndex());var J=this.config.getZoomLevel(D);if(I==null||J==null||I.level==J.level){return false}var H=parseInt(I.get("realWidth"))/parseInt(I.get("numberOfTilesX"));var A=parseInt(J.get("realWidth"))/parseInt(J.get("numberOfTilesX"));var K=H/A;var B=null;for(var P=0;P<this.getMapper().tiles.length;P++){if(!this.getMapper().tiles[P].isOverlay()){B=this.getMapper().tiles[P]}else{this.getMapper().tiles[P].hide()}}if(B==null){return false}this.markerObjects.style.display="none";var M=this.getCentre();var C=new MDVPoint(0,0);if(arguments.length==2&&arguments[1]&&arguments[1].x>0&&arguments[1].y>0){var L=this.getPoint(M);M=arguments[1];var G=this.getPoint(M);C.x=L.x-G.x;C.y=L.y-G.y}var N=this.getPoint(M);var O=new MDVPoint(N.x*(1-K),N.y*(1-K));for(var F=0;F<B.div.childNodes.length;F++){var E=B.div.childNodes[F];E.style.width=Math.floor(0.5+(parseInt(E.style.width)*K))+"px";E.style.height=Math.floor(0.5+(parseInt(E.style.height)*K))+"px";E.style.top=(parseInt(E.style.top)*K)+"px";E.style.left=(parseInt(E.style.left)*K)+"px"}this.getMapper().style.left=(parseInt(this.getMapper().style.left)+C.x+O.x)+"px";this.getMapper().style.top=(parseInt(this.getMapper().style.top)+C.y+O.y)+"px";this.setZoomLevel(D);this.setCentre(M);return true};MDVMap.prototype.setDefaultCursor=function(){if(this.config.get("cursorIdle")){if(document.all){this.getMapper().style.cursor="url('"+this.config.get("cursorIdle")+"')"}else{this.getMapper().style.cursor="-moz-grab"}}};function MDVTiles(A,B){this.mdvMap=A;this.name=B;this.id=this.mdvMap.lastTileLayerID++;this.zIndex=this.id;this.srcPath=this.mdvMap.config.get("serverURL");this.block=parseInt(this.mdvMap.config.get("block"));this.fileType=".png";this.active=true;this.overlay=false;if(this.mdvMap.config.get("fileType")){this.fileType=this.mdvMap.config.get("fileType")}this.div=document.createElement("div");this.div.className="mdvLayer";this.div.style.zIndex=this.zIndex;this.div.id=this.mdvMap.getName()+"_"+this.name;this.div.style.position="absolute";this.div.style.visibility="visible";this.div.style.left="0px";this.div.style.top="0px";this.div.style.width="3000px";this.div.style.height="3000px";this.div.mdvMap=this;if(arguments.length==3&&arguments[2]){this.getImageURL=arguments[2]}this.mdvMap.getMapper().appendChild(this.div);this.div.append=true}MDVTiles.prototype.hide=function(A){this.div.style.display="none"};MDVTiles.prototype.display=function(){this.div.style.display="block"};MDVTiles.prototype.getName=function(){return this.name};MDVTiles.prototype.isOverlay=function(){return this.overlay};MDVTiles.prototype.setOverlay=function(A){this.overlay=A};MDVTiles.prototype.getSrcPath=function(B,C){if(typeof this.srcPath==="string"){return this.srcPath}if(this.srcPath.constructor!==Array){this.mdvMap.events.triggerEvent(MDVEvent_ERROR,"Invalid format for config.serverURL.\nArray or String expected.");return }var A=this.srcPath.length;if(A>0){return this.srcPath[(B&&C)?((B^C)%A):0]}};MDVTiles.prototype.setSrcPath=function(A){this.srcPath=A};MDVTiles.prototype.getBlock=function(){return this.block};MDVTiles.prototype.setBlock=function(A){this.block=A};MDVTiles.prototype.getFileType=function(){return this.fileType};MDVTiles.prototype.setFileType=function(A){this.fileType=A};MDVTiles.prototype.setActive=function(A){this.active=A};MDVTiles.prototype.isActive=function(){return this.active};MDVTiles.prototype.setQuantifier=function(A){this.quantifier=A};MDVTiles.prototype.setSorter=function(A){this.sorter=A};MDVTiles.prototype.getImageURL=function(J,H){var E=this.mdvMap.config.getZoomLevel(this.mdvMap.config.getZoomLevelIndex());var B=this.getSrcPath(J,H);var C=this.mdvMap.config.getZoomLevelIndex();if(E.get("zoomLevel")){C=E.get("zoomLevel")}if(this.getBlock()){var F=this.getBlock();var I=Math.floor((this.mdvMap.startTileWidth+J)/F)*F;var D=I+F-1;var G=Math.floor((this.mdvMap.startTileHeight+H)/F)*F;var A=G+F-1;B+="zoomlevel";B+=C;B+="/columns"+I+"-"+D;B+="/column";B+=(this.mdvMap.startTileWidth+J);B+="/rows"+G+"-"+A+"/";B+=(this.mdvMap.startTileHeight+H);B+="_";B+=(this.mdvMap.startTileWidth+J);B+="_";B+=C;B+=this.getFileType()}else{B+="zoomlevel";B+=C;B+="/column";B+=(this.mdvMap.startTileWidth+J);B+="/"+this.mdvMap.config.get("network")+"_";B+=(this.mdvMap.startTileHeight+H);B+="_";B+=(this.mdvMap.startTileWidth+J);B+=this.getFileType()}return B};MDVTiles.prototype.sorter=function(B,A){return B.priority-A.priority};MDVTiles.prototype.quantifier=function(D){var B=this.mdvMap.config.getZoomLevel(this.mdvMap.config.getZoomLevelIndex());var C=this.mdvMap.getPoint(this.mdvMap.getCentre());var A=new MDVPoint((D.x+parseInt(B.get("tileSizeX"))/2)-C.x,(D.y+parseInt(B.get("tileSizeY"))/2)-C.y);return Math.floor(0.5+(Math.pow(A.x,2)+Math.pow(A.y,2)))};function MDVMapConfig(){this.zoomLevels=new Array();this.currentZoomLevelIndex=null;this.params=new Array()}MDVMapConfig.prototype.clone=function(){var B=new MDVMapConfig();for(var D=0;D<=100;D++){if(this.zoomLevels[D]==null){continue}var A=new MDVMapConfigZoomLevel(this.zoomLevels[D].getLevel());A.setScale(this.zoomLevels[D].getScale());for(var C in this.zoomLevels[D].params){if(this.zoomLevels[D].params[C]){A.add(C,this.zoomLevels[D].params[C])}}B.registerZoomLevel(A)}return B};MDVMapConfig.prototype.registerZoomLevel=function(A){this.zoomLevels[A.level]=A};MDVMapConfig.prototype.getZoomLevels=function(){return this.zoomLevels};MDVMapConfig.prototype.getZoomLevel=function(A){if(this.zoomLevels[A]){return this.zoomLevels[A]}else{return null}};MDVMapConfig.prototype.add=function(A,B){this.params[A]=B};MDVMapConfig.prototype.get=function(A){return this.params[A]};MDVMapConfig.prototype.setZoomLevelIndex=function(A){this.currentZoomLevelIndex=A};MDVMapConfig.prototype.getZoomLevelIndex=function(){return this.currentZoomLevelIndex};function MDVMapConfigZoomLevel(A){this.level=A;this.scale=null;this.params=new Array()}MDVMapConfigZoomLevel.prototype.add=function(A,B){this.params[A]=B};MDVMapConfigZoomLevel.prototype.get=function(A){return this.params[A]};MDVMapConfigZoomLevel.prototype.setScale=function(A){this.scale=A};MDVMapConfigZoomLevel.prototype.getScale=function(){return this.scale};MDVMapConfigZoomLevel.prototype.getLevel=function(){return this.level};MDVMap_onmousemove=function(C){C=C?C:window.event;var A=true;if(C.button==2){this.mdvMap.events.triggerEvent(MDVEvent_CONTEXT_MENU)}for(var B=0;B<this.mdvMap.gadgets.length;B++){if(!this.mdvMap.gadgets[B].onmousemove(C)){A=false;break}}return A};MDVMap_onmouseover=function(C){C=C?C:window.event;var A=true;for(var B=0;B<this.mdvMap.gadgets.length;B++){if(!this.mdvMap.gadgets[B].onmouseover(C)){A=false}}return A};MDVMap_onmousedown=function(C){C=C?C:window.event;var A=true;this.mdvMap.events.triggerEvent(MDVEvent_MOUSE_DOWN,"MDVMap noticed a mouse down event.",C);for(var B=0;B<this.mdvMap.gadgets.length;B++){if(!this.mdvMap.gadgets[B].onmousedown(C)){A=false;break}}return A};MDVMap_onmouseup=function(B){B=B?B:window.event;this.mdvMap.events.triggerEvent(MDVEvent_MOUSE_UP,"MDVMap noticed a mouse up event.",B);for(var A=0;A<this.mdvMap.gadgets.length;A++){if(!this.mdvMap.gadgets[A].onmouseup(B)){ret=false;break}}return true};MDVMap_onmouseout=function(B){B=B?B:window.event;for(var A=0;A<this.mdvMap.gadgets.length;A++){if(!this.mdvMap.gadgets[A].onmouseout(B)){return false}}return true};MDVMap_onkeypress=function(B){B=B?B:window.event;for(var A=0;A<this.mdvMap.gadgets.length;A++){if(!this.mdvMap.gadgets[A].onkeypress(B)){return false}}return true};MDVMap_ondblclick=function(B){B=B?B:window.event;for(var A=0;A<this.mdvMap.gadgets.length;A++){if(!this.mdvMap.gadgets[A].ondblclick(B)){return false}}return true};MDVMap_oncontextmenu=function(B){B=B?B:window.event;for(var A=0;A<this.mdvMap.gadgets.length;A++){if(!this.mdvMap.gadgets[A].oncontextmenu(B)){return false}}return true};MDVMap_onmousewheel=function(B){B=B?B:window.event;for(var A=0;A<this.mdvMap.gadgets.length;A++){if(!this.mdvMap.gadgets[A].onmousewheel(B)){return false}}return true};MDVMap_onclick=function(A){A=A?A:window.event;if(!(this.mdvMap.config.get("enableHotspots"))){return }if(this.mdvMap.hotspots.current==null){return true}this.mdvMap.events.triggerEvent(MDVEvent_OBJECT_CLICKED,"MDVMap Object clicked....",this.mdvMap.hotspots.current);return true};MDVMap_imgOnError=function(A){A=A?A:window.event;if(this.mdvMap){this.mdvMap.events.triggerEvent(MDVEvent_WARNING,"MDVMap couldn't load tile "+this.id+" (failCount: "+this.failCount+")");this.failCount++;var B=this.src;this.src=this.mdvMap.transparent.src;if(this.failCount<=this.mdvMap.maxFailCount){this.src=B}else{this.src=this.mdvMap.transparent.src}}};MDVMap_imgOnLoad=function(B){B=B?B:window.event;this.style.visibility="visible";var A=navigator.userAgent;if(this.src==this.mdvMap.transparent.src){return true}if(document.all&&A.indexOf("Opera")<0&&this.overlay){var C=this.src;this.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+C+"');";this.src=this.mdvMap.transparent.src}if(this.failCount>0&&this.src!=this.mdvMap.transparent.src){this.mdvMap.events.triggerEvent(MDVEvent_WARNING,"MDVMap recovered tile "+this.id+" (failCount: "+this.failCount+")")}};function MDVCoordinates(B,A,C){this.x=A;this.y=C;if(typeof A=="string"&&B.indexOf("WGS")<0){this.x=parseInt(this.x)}else{if(typeof A=="string"&&B.indexOf("WGS")>=0){this.x=parseFloat(this.x)}}if(typeof C=="string"&&B.indexOf("WGS")<0){this.y=parseInt(this.y)}else{if(typeof C=="string"&&B.indexOf("WGS")>=0){this.y=parseFloat(this.y)}}this.mapName=B;this.zone=-1;this.height=0;this.hemisphere=""}MDVCoordinates.prototype.toString=function(){return this.mapName+", x: "+this.x+", y: "+this.y};MDVCoordinates.prototype.equals=function(D){if(!D||!D.x||!D.y){return false}var A=this.x;var E=this.y;var C=D.x;var B=D.y;if(A%1>0){A=parseInt(Math.floor(A+0.5))}if(E%1>0){E=parseInt(Math.floor(E+0.5))}if(C%1>0){C=parseInt(Math.floor(C+0.5))}if(B%1>0){B=parseInt(Math.floor(B+0.5))}return(A==C&&E==B&&this.mapName==D.mapName)};MDVCoordinates.prototype.clone=function(){var A=new MDVCoordinates(this.mapName,this.x,this.y);if(this.zone>=0){A.zone=this.zone}if(this.hemisphere!=""){A.hemisphere=this.hemisphere}if(this.height>0){A.height=this.height}return A};function MDVPoint(A,B){this.x=A;this.y=B;if(typeof A=="string"){this.x=parseInt(this.x)}if(typeof B=="string"){this.y=parseInt(this.y)}}MDVPoint.prototype.toString=function(){return"x: "+this.x+", y: "+this.y};MDVPoint.prototype.equals=function(B){if(!B||!B.x||!B.y){return false}var A=this.x;var E=this.y;var D=B.x;var C=B.y;if(A%1>0){A=parseInt(Math.floor(A+0.5))}if(E%1>0){E=parseInt(Math.floor(E+0.5))}if(D%1>0){D=parseInt(Math.floor(D+0.5))}if(C%1>0){C=parseInt(Math.floor(C+0.5))}return(A==D&&E==C)};MDVPoint.prototype.clone=function(){return new MDVPoint(this.x,this.y)};function MDVMarker(A,D,C,B){if(!A){return }this.mdvMap=A;this.img=new Image();this.img.marker=this;this.img.mdvMap=A;this.img.onload=MDVMarker_onload;this.img.onerror=MDVMarker_onerror;this.img.onclick=MDVMarker_onclick;this.img.oncontextmenu=MDVMarker_oncontextmenu;this.img.ondblclick=MDVMarker_ondblclick;this.imgSrc=C;this.marker=this;this.id=A.lastMarkerID++;this.coords=this.mdvMap.getInternalCoordinates(D);this.toolTip=null;this.visible=true;this.objectId={type:"coord",desc:"",id:this.getCoords().x+":"+this.getCoords().y+":"+this.getCoords().mapName,omc:"",marker:this};this.append=false;if(typeof B=="object"&&B&&B.x>=0&&B.y>=0){this.xFactor=B.x;this.yFactor=B.y}else{this.xFactor=B;this.yFactor=1}}MDVMarker.prototype.setVisibility=function(B){var A=B?"visible":"hidden";this.img.style.visibility=A;this.visible=B;return true};MDVMarker.prototype.isVisible=function(){return this.visible};MDVMarker.prototype.equals=function(A){return this.id==A.id};MDVMarker.prototype.intersects=function(C){if(C==null){return false}var A=this.getRectangle();var B=C.getRectangle();return B.width>0&&B.height>0&&A.width>0&&A.height>0&&B.x<A.x+A.width&&B.x+B.width>A.x&&B.y<A.y+A.height&&B.y+B.height>A.y};MDVMarker.prototype.getRectangle=function(){var C=this.mdvMap.getPoint(this.getCoords());var F=this.img.width;var B=this.img.height;var A=this.getXFactor();var D=this.getYFactor();var E=new MDVPoint(C.x-F*A,C.y-B*D);return{x:E.x,y:E.y,width:F,height:B}};MDVMarker.prototype.update=function(){var C=this.mdvMap.getPoint(this.getCoords());var G=true;if(!C){this.mdvMap.events.triggerEvent(MDVEvent_ERROR,"MDVMap wasn't able to get px coordinates for marker.");return false}if(arguments.length>0){G=arguments[0]}var E=this.img.width;var B=this.img.height;var A=this.getXFactor();var D=this.getYFactor();this.img.style.position="absolute";this.img.style.left=(C.x-E*A)+"px";this.img.style.top=(C.y-B*D)+"px";if(this.layer&&this.layer.zIndex){this.img.style.zIndex=this.layer.zIndex}var F=this.visible?"visible":"hidden";if(this.img.style.visibility!=F){this.img.style.visibility=F}if(this.toolTip&&this.toolTip.isVisible()&&G){this.toolTip.update()}return true};MDVMarker.prototype.destroy=function(){this.img.marker=null;this.img.mdvMap=null;if(this.toolTip){this.toolTip.destroy()}if(this.marker.layer){this.marker.layer=null}this.toolTip=null;this.objectId=null;this.coords=null;this.marker=null;this.img.onload=null;this.img=null};MDVMarker.prototype.getCoords=function(){if(this.coords&&this.coords.x>0&&this.coords.y>0){return this.coords}return null};MDVMarker.prototype.setCoords=function(A){this.coords=this.mdvMap.getInternalCoordinates(A);this.update()};MDVMarker.prototype.getXFactor=function(){return this.xFactor};MDVMarker.prototype.getYFactor=function(){return this.yFactor};MDVMarker.prototype.setTitle=function(A){this.img.title=A;this.img.alt=A};MDVMarker.prototype.setToolTip=function(B){if(!B){return false}var C=false;if(arguments.length==2){C=arguments[1]}var A=this.coords.clone();this.toolTip=B;this.toolTip.setParent(this);this.img.toolTip=B;this.toolTip.setCoords(A);if(C&&this.toolTip.isVisible()){this.toolTip.update()}this.mdvMap.assignTooltipHandler(this.img);return true};MDVMarker.prototype.setObjectId=function(A){this.objectId=A};MDVMarker.prototype.getObjectId=function(){return this.objectId};MDVMarker.prototype.getImage=function(){return this.img};function MDVMarker_onload(C){C=C?C:window.event;if(this.marker){this.marker.update();if(!this.marker.append&&this.marker.layer){this.mdvMap.markerObjects.appendChild(this);this.marker.append=true;if(document.all&&this.src!=this.marker.mdvMap.transparent.src&&this.src.substring(this.src.length,this.src.length-4).toLowerCase()==".png"){var B=this.width;var A=this.height;var D=this.src;this.style.width=B+"px";this.style.height=A+"px";this.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+D+"');";this.marker.img.src=this.marker.mdvMap.transparent.src}this.mdvMap.events.triggerEvent(MDVEvent_OBJECT_LOADED,"MDVMap noticed that a marker finished loading.",this.marker)}}}function MDVMarker_onerror(A){A=A?A:window.event}function MDVMarker_displayToolTip(F){F=F?F:window.event;var E=this.marker||this;if(E){E.mdvMap.cancelMoveBySeq();if(E.toolTip.isFixed()){return }if(E.toolTip){E.toolTip.cancelHide()}if(this.parentPolyline){var B=F.pageX||(F.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));var A=F.pageY||(F.clientY+(document.documentElement.scrollTop||document.body.scrollTop));var I=0;var G=0;var D=this.mdvMap.viewport;while(D){I+=D.offsetLeft;G+=D.offsetTop;D=D.offsetParent}var H=new MDVPoint(B-I-1,A-G-1);var C=this.mdvMap.getCoordinates(H);if(E.toolTip&&!E.toolTip.isVisible()){this.parentPolyline.setMouse(C)}}if(E.toolTip){E.toolTip.triggerDisplay()}}}function MDVMarker_hideToolTip(B){B=B?B:window.event;var A=this.marker||this;if(A&&A.toolTip){A.toolTip.cancelDisplay();A.toolTip.triggerHide()}}function MDVMarker_onclick(A){if(this.marker){this.marker.objectId.right=false;this.mdvMap.events.triggerEvent(MDVEvent_OBJECT_CLICKED,"MDVMap Object clicked....",this.marker.objectId)}return false}function MDVMarker_oncontextmenu(A){A=A?A:window.event;if(this.marker){this.marker.objectId.right=true;this.mdvMap.events.triggerEvent(MDVEvent_OBJECT_CLICKED,"MDVMap Object clicked....",this.marker.objectId)}A.cancelBubble=true;A.returnValue=false;if(A.stopPropagation){A.stopPropagation()}if(A.preventDefault){A.preventDefault()}return false}function MDVMarker_ondblclick(A){A=A?A:window.event;this.mdvMap.events.triggerEvent(MDVEvent_OBJECT_DBLCLICKED,"MDVMap Object dblclicked....",this.marker.objectId);A.cancelBubble=true;A.returnValue=false;if(A.stopPropagation){A.stopPropagation()}if(A.preventDefault){A.preventDefault()}return false}function MDVToolTip(A,C,B){this.mdvMap=A;this.innerHTML=C;this.id=this.mdvMap.lastToolTipID++;this.slidable=false;this.parentMarker=null;this.type=B;this.coords=null;this.container=null;this.size=null;this.fixed=false;this.jobs=new Array();this.overflow=false;this.pin=false;this.disabled=false;this.jobs["display"]=null;this.jobs["hide"]=null;this.mdvMap.events.registerEvent(MDVEvent_TOOLTIP,this,this.scrollToFit)}MDVToolTip.prototype.setDisabled=function(A){this.disabled=A};MDVToolTip.prototype.isDisabled=function(){return this.disabled};MDVToolTip.prototype.setPin=function(A){this.pin=A};MDVToolTip.prototype.hasPin=function(){return this.pin};MDVToolTip.prototype.setOverflow=function(A){this.overflow=A};MDVToolTip.prototype.isOverflow=function(){return this.overflow};MDVToolTip.prototype.setSlidable=function(A){this.slidable=A};MDVToolTip.prototype.isSlidable=function(){return this.slidable};MDVToolTip.prototype.setInnerHTML=function(A){this.innerHTML=A;if(this.container){this.container.setInnerHTML(A)}};MDVToolTip.prototype.getInnerHTML=function(){return this.innerHTML};MDVToolTip.prototype.setContainer=function(A){this.container=A};MDVToolTip.prototype.getContainer=function(){return this.container};MDVToolTip.prototype.getManager=function(){return this.manager};MDVToolTip.prototype.setCoords=function(A){A=this.mdvMap.getInternalCoordinates(A);this.coords=A};MDVToolTip.prototype.getCoords=function(){return this.coords};MDVToolTip.prototype.setType=function(A){this.type=A};MDVToolTip.prototype.getType=function(){return this.type};MDVToolTip.prototype.setParent=function(A){this.parentMarker=A};MDVToolTip.prototype.getParent=function(){return this.parentMarker};MDVToolTip.prototype.setSize=function(A){this.size=A};MDVToolTip.prototype.getSize=function(){return this.size};MDVToolTip.prototype.setFixed=function(A){this.fixed=A};MDVToolTip.prototype.isFixed=function(){return this.fixed};MDVToolTip.prototype.scrollToFit=function(){if(!this.mdvMap||this.mdvMap.config.get("useToolTipScrollToFit")==null||this.mdvMap.config.get("useToolTipScrollToFit")!="true"){return }if(!this.isVisible()){return }var P=this.getSize().clone();P.x/=2;P.y/=2;var E=this.mdvMap.config.getZoomLevel(this.mdvMap.config.currentZoomLevelIndex);var L=parseInt(E.get("tileSizeX"))*parseInt(E.get("numberOfTilesX"));var G=parseInt(E.get("realWidth"))/L;var C=parseInt(E.get("tileSizeY"))*parseInt(E.get("numberOfTilesY"));var F=parseInt(E.get("realHeight"))/C;var K=this.mdvMap.getPoint(this.getCoords());var J=this.getCoords().clone();var B=this.getContainer().getPosition();B.x+=Math.floor(0.5+P.x)-this.mdvMap.wrapOffset.x;B.y+=Math.floor(0.5+P.y)-this.mdvMap.wrapOffset.y;var M=new MDVPoint(B.x-K.x,B.y-K.y);M.x*=G;M.y*=F;J.x+=M.x;J.y+=M.y;var A=this.mdvMap.getCentre().clone();var O=[A,J];var H=new MDVPoint(J.x-A.x,J.y-A.y);var D=this.mdvMap.getViewportRealExtends();var N=Math.max(D.width,D.height);var I=Math.floor(0.5+Math.sqrt(Math.pow(H.x,2)+Math.pow(H.y,2)));if(I<(N)){this.mdvMap.cancelMoveBySeq();this.mdvMap.stepPx=document.all?3:6;this.mdvMap.stepTime=document.all?10:1;this.mdvMap.moveBySeq(O,null,false)}else{this.mdvMap.setCentre(J);this.mdvMap.update()}};MDVToolTip.prototype.display=function(){if(this.isDisabled()){return false}if(this.mdvMap){this.mdvMap.hideToolTips()}if(!this.getContainer()){this.require()}if(!this.getContainer()){return false}var A=this.update();this.getContainer().setInnerHTML(this.getInnerHTML());this.setVisibility(true);this.mdvMap.events.triggerEvent(MDVEvent_TOOLTIP,"MDVMap Tool Tip...",this);return A};MDVToolTip.prototype.hide=function(){if(this.isFixed()){return false}this.setVisibility(false);if(this.mdvMap&&this.mdvMap.events){this.mdvMap.events.triggerEvent(MDVEvent_TOOLTIP,"MDVMap Tool Tip...",this)}if(this.getParent()&&this.getParent().layer&&(this.getParent().layer.name=="efa_stops"||this.getParent().layer.name=="efa_poi")){var A=this.mdvMap.config.getZoomLevel(this.mdvMap.config.getZoomLevelIndex());if(this.getParent().objectId.type=="stop"&&A.get("showSTOP")&&A.get("showSTOP")=="false"){this.getParent().layer.removeMarker(this.getParent())}if(this.getParent().objectId.type=="poi"&&A.get("showPOI")&&A.get("showPOI")=="false"){this.getParent().layer.removeMarker(this.getParent())}}return this.free()};MDVToolTip.prototype.require=function(){if(this.container){this.free(this.container)}if(this.mdvMap==null){return }var A=null;if(this.getSize()){A=this.mdvMap.getToolTipManager().require(this.getType(),this.getSize())}else{A=this.mdvMap.getToolTipManager().require(this.getType())}if(A){A.setParent(this.getParent());A.setToolTip(this);A.setInnerHTML(this.getInnerHTML())}this.setContainer(A)};MDVToolTip.prototype.free=function(){if(this.container){if(this.mdvMap.getToolTipManager().free(this.container)){this.container.setParent(null);this.container.setToolTip(null);this.setContainer(null);return true}}return false};MDVToolTip.prototype.destroy=function(){if(this.container){this.hide()}this.parentMarker=null;this.mdvMap=null};MDVToolTip.prototype.isVisible=function(){if(this.container){return this.container.isVisible()}return false};MDVToolTip.prototype.setVisibility=function(A){if(this.container){return this.container.setVisibility(A)}return false};MDVToolTip.prototype.update=function(){if(this.container){return this.container.update()}};MDVToolTip.prototype.triggerDisplay=function(){var A=250;this.jobs["display"]=mdvTimer.add(A,this,this.display,[])};MDVToolTip.prototype.triggerHide=function(){var A=100;this.jobs["hide"]=mdvTimer.add(A,this,this.hide,[])};MDVToolTip.prototype.cancelDisplay=function(){if(this.jobs["display"]!=null){if(mdvTimer.remove(this.jobs["display"])){this.jobs["display"]=null;return true}}return false};MDVToolTip.prototype.cancelHide=function(){if(this.jobs["hide"]!=null){if(mdvTimer.remove(this.jobs["hide"])){this.jobs["hide"]=null;return true}}return false};function MDVToolTipContainer(A){this.mdvMap=A;this.id=this.mdvMap.lastContainerID++;this.div=null;this.point=null;this.append=false;this.visibility=false;this.mousePos=null;this.parentMarker=null;this.vacant=true;this.type="simple";this.init()}MDVToolTipContainer.prototype.isVacant=function(){return this.vacant};MDVToolTipContainer.prototype.setVacant=function(A){this.vacant=A};MDVToolTipContainer.prototype.setParent=function(A){this.parentMarker=A};MDVToolTipContainer.prototype.getParent=function(){return this.parentMarker};MDVToolTipContainer.prototype.setVisibility=function(A){this.visibility=A;this.div.style.visibility=A?"visible":"hidden"};MDVToolTipContainer.prototype.isVisible=function(){return this.visibility};MDVToolTipContainer.prototype.getInnerHTML=function(){return this.div.innerHTML};MDVToolTipContainer.prototype.setInnerHTML=function(A){this.div.innerHTML=A};MDVToolTipContainer.prototype.setAppend=function(A){this.append=A};MDVToolTipContainer.prototype.isAppend=function(){this.append};MDVToolTipContainer.prototype.getType=function(){return this.type};MDVToolTipContainer.prototype.update=function(){return false};MDVToolTipContainer.prototype.setToolTip=function(A){if(this.div){this.div.toolTip=A}};MDVToolTipContainer.prototype.getPosition=function(){if(this.div){var A=new MDVPoint(parseInt(this.div.style.left),parseInt(this.div.style.top));A.x+=this.mdvMap.wrapOffset.x;A.y+=this.mdvMap.wrapOffset.y;return A}return(new MDVPoint(0,0))};MDVToolTipContainer.prototype.init=function(){var A=this;this.div=document.createElement("div");this.div.style.zIndex=100;this.div.style.position="absolute";this.div.style.top="0px";this.div.style.left="0px";this.div.toolTip=null;if(!this.isAppend()){this.mdvMap.markerObjects.appendChild(this.div);this.setAppend(true)}this.div.onmouseover=MDVToolTipContainer_cancelHide;this.div.onmousemove=MDVToolTipContainer_cancelHide;this.div.onmouseout=function(){if(!A.mdvMap.config.get("tooltipHandler")){MDVToolTipContainer_triggerHide.bind(this)()}};this.div.onmousedown=MDVToolTipContainer_onMouseDown;this.div.ondblclick=MDVToolTipContainer_onMouseDown;this.setVisibility(false);return this.div!=null};function MDVToolTipContainer_triggerHide(A){A=A?A:window.event;if(this.toolTip){this.toolTip.triggerHide()}}function MDVToolTipContainer_cancelHide(A){A=A?A:window.event;if(this.toolTip){this.toolTip.cancelHide()}}function MDVToolTipContainer_onMouseDown(A){A=A?A:window.event;if(!this.toolTip.isSlidable()){A.cancelBubble=true;A.returnValue=false;if(A.stopPropagation){A.stopPropagation()}if(A.preventDefault){A.preventDefault()}return false}return true}function MDVToolTipBubble(A,B){this.mdvMap=A;this.id=this.mdvMap.lastContainerID++;this.div=null;this.point=null;this.append=false;this.visibility=false;this.complex=new Array();this.mousePos=null;this.parentMarker=null;this.margins=null;this.vacant=true;this.innerHTML="";this.type="bubble";this.lastParent=null;this.pointerSize=new MDVPoint(63,15);this.pointerBorder=new MDVPoint(34,34);this.pointerState=3;this.innerOffset=new MDVPoint(0,this.pointerSize.y-1);this.offset=null;this.size=B;this.delta=new MDVPoint(0,0);for(var C in MDVToolTipContainer.prototype){if(!MDVToolTipBubble.prototype[C]){MDVToolTipBubble.prototype[C]=MDVToolTipContainer.prototype[C]}}this.init();this.createBubble();this.updateBubble();this.setVisibility(false)}MDVToolTipBubble.prototype.setVisibility=function(C){this.visibility=C;var A=false;var B=this.getParent();if(B&&B.toolTip&&B.toolTip.isOverflow()){A=true}if(this.complex["body"]&&A){this.complex["body"].style.overflow=C?"auto":"hidden"}this.div.style.visibility=C?"visible":"hidden"};MDVToolTipBubble.prototype.setLastParent=function(A){this.lastParent=A};MDVToolTipBubble.prototype.getLastParent=function(){return this.lastParent};MDVToolTipBubble.prototype.getInnerHTML=function(){return this.complex["body"].innerHTML};MDVToolTipBubble.prototype.setInnerHTML=function(A){this.complex["body"].innerHTML=A};MDVToolTipBubble.prototype.setSize=function(A){if(this.size){switch(this.pointerState){case 0:this.delta.x=0;this.delta.y=this.size.y-A.y;break;case 1:this.delta.x=0;this.delta.y=this.size.y-A.y;break;case 2:this.delta.x=0;this.delta.y=0;break;case 3:this.delta.x=0;this.delta.y=0;break}}this.size=A};MDVToolTipBubble.prototype.getSize=function(){return this.size};MDVToolTipBubble.prototype.createBubble=function(){var A="images/";if(this.mdvMap.config.get("imagePath")){A=this.mdvMap.config.get("imagePath")}var B=document.createElement("img");B.src=A+"bubble.png";B.style.position="relative";B.style.left=0+"px";B.style.top=0+"px";B.galleryimg="no";B.unselectable="no";this.complex["upperLeftCorner"]=document.createElement("div");this.complex["upperLeftCorner"].appendChild(B);this.div.appendChild(this.complex["upperLeftCorner"]);var B=document.createElement("img");B.src=A+"bubble.png";B.style.position="relative";B.style.left=-30+"px";B.style.top=0+"px";B.galleryimg="no";B.unselectable="no";this.complex["upperBorder"]=document.createElement("div");this.complex["upperBorder"].appendChild(B);this.div.appendChild(this.complex["upperBorder"]);var B=document.createElement("img");B.src=A+"bubble.png";B.style.position="relative";B.style.left=-672+"px";B.style.top=0+"px";B.galleryimg="no";B.unselectable="no";this.complex["upperRightCorner"]=document.createElement("div");this.complex["upperRightCorner"].appendChild(B);this.div.appendChild(this.complex["upperRightCorner"]);var B=document.createElement("img");B.src=A+"bubble.png";B.style.position="relative";B.style.left=0+"px";B.style.top=-30+"px";B.galleryimg="no";B.unselectable="no";this.complex["leftBorderBody"]=document.createElement("div");this.complex["leftBorderBody"].appendChild(B);this.div.appendChild(this.complex["leftBorderBody"]);var B=document.createElement("img");B.src=A+"bubble.png";B.style.position="relative";B.style.left=-670+"px";B.style.top=-670+"px";B.galleryimg="no";B.unselectable="no";this.complex["lowerRightCorner"]=document.createElement("div");this.complex["lowerRightCorner"].appendChild(B);this.div.appendChild(this.complex["lowerRightCorner"]);var B=document.createElement("img");B.src=A+"bubble.png";B.style.position="relative";B.style.left=-698+"px";B.style.top=0+"px";B.galleryimg="no";B.unselectable="no";this.complex["rightBorder"]=document.createElement("div");this.complex["rightBorder"].appendChild(B);this.div.appendChild(this.complex["rightBorder"]);var B=document.createElement("img");B.src=A+"bubble.png";B.style.position="relative";B.style.left=0+"px";B.style.top=-670+"px";B.galleryimg="no";B.unselectable="no";this.complex["lowerLeftCorner"]=document.createElement("div");this.complex["lowerLeftCorner"].appendChild(B);this.div.appendChild(this.complex["lowerLeftCorner"]);var B=document.createElement("img");B.src=A+"bubble.png";B.style.position="relative";B.style.left=-30+"px";B.style.top=-670+"px";B.galleryimg="no";B.unselectable="no";this.complex["lowerBorder"]=document.createElement("div");this.complex["lowerBorder"].appendChild(B);this.div.appendChild(this.complex["lowerBorder"]);this.complex["body"]=document.createElement("div");this.complex["body"].className="MDVToolTipBubble_Body";this.div.appendChild(this.complex["body"]);var B=document.createElement("img");B.src=A+"bubble.png";B.style.position="relative";B.style.left=this.pointerState*-64+"px";B.style.top=-704+"px";B.galleryimg="no";B.unselectable="no";this.complex["pointer"]=document.createElement("div");this.complex["pointer"].appendChild(B);this.div.appendChild(this.complex["pointer"]);var B=document.createElement("img");B.src=A+"bubble.png";B.style.position="relative";B.style.left=-662+"px";B.style.top=-701+"px";B.galleryimg="no";B.unselectable="no";B.onclick=MDVToolTipBubble_OnPinClick;B.bubble=this;this.complex["pin"]=document.createElement("div");this.complex["pin"].mdvMap=this.mdvMap;this.complex["pin"].appendChild(B);this.div.appendChild(this.complex["pin"])};MDVToolTipBubble.prototype.updateBubble=function(){var E=this.size;var A="images/";if(this.mdvMap.config.get("imagePath")){A=this.mdvMap.config.get("imagePath")}this.complex["upperLeftCorner"].style.position="absolute";this.complex["upperLeftCorner"].style.overflow="hidden";this.complex["upperLeftCorner"].style.width=30+"px";this.complex["upperLeftCorner"].style.height=30+"px";this.complex["upperLeftCorner"].style.left=0+"px";this.complex["upperLeftCorner"].style.top=(0+this.innerOffset.y)+"px";this.complex["upperBorder"].style.position="absolute";this.complex["upperBorder"].style.overflow="hidden";this.complex["upperBorder"].style.width=(E.x-2*28)+"px";this.complex["upperBorder"].style.height=30+"px";this.complex["upperBorder"].style.left=30+"px";this.complex["upperBorder"].style.top=(0+this.innerOffset.y)+"px";this.complex["upperRightCorner"].style.position="absolute";this.complex["upperRightCorner"].style.overflow="hidden";this.complex["upperRightCorner"].style.width=30+"px";this.complex["upperRightCorner"].style.height=30+"px";this.complex["upperRightCorner"].style.left=(E.x-26)+"px";this.complex["upperRightCorner"].style.top=(0+this.innerOffset.y)+"px";this.complex["leftBorderBody"].style.position="absolute";this.complex["leftBorderBody"].style.overflow="hidden";this.complex["leftBorderBody"].style.width=E.x+"px";this.complex["leftBorderBody"].style.height=(E.y-(this.pointerSize.y-1-this.innerOffset.y)-2*30)+"px";this.complex["leftBorderBody"].style.left=0+"px";this.complex["leftBorderBody"].style.top=(30+this.innerOffset.y)+"px";this.complex["lowerRightCorner"].style.position="absolute";this.complex["lowerRightCorner"].style.overflow="hidden";this.complex["lowerRightCorner"].style.width=30+"px";this.complex["lowerRightCorner"].style.height=30+"px";this.complex["lowerRightCorner"].style.left=(E.x-28)+"px";this.complex["lowerRightCorner"].style.top=(E.y-(this.pointerSize.y-1-this.innerOffset.y)-30)+"px";this.complex["rightBorder"].style.position="absolute";this.complex["rightBorder"].style.overflow="hidden";this.complex["rightBorder"].style.width=2+"px";this.complex["rightBorder"].style.height=(E.y-(this.pointerSize.y-1-this.innerOffset.y)-30)+"px";this.complex["rightBorder"].style.left=(E.x)+"px";this.complex["rightBorder"].style.top=(0+this.innerOffset.y)+"px";this.complex["lowerLeftCorner"].style.position="absolute";this.complex["lowerLeftCorner"].style.overflow="hidden";this.complex["lowerLeftCorner"].style.width=30+"px";this.complex["lowerLeftCorner"].style.height=30+"px";this.complex["lowerLeftCorner"].style.left=0+"px";this.complex["lowerLeftCorner"].style.top=(E.y-(this.pointerSize.y-1-this.innerOffset.y)-30)+"px";this.complex["lowerBorder"].style.position="absolute";this.complex["lowerBorder"].style.overflow="hidden";this.complex["lowerBorder"].style.width=(E.x-2*28)+"px";this.complex["lowerBorder"].style.height=30+"px";this.complex["lowerBorder"].style.left=30+"px";this.complex["lowerBorder"].style.top=(E.y-(this.pointerSize.y-1-this.innerOffset.y)-30)+"px";var D=0;if(this.getParent()&&this.getParent().toolTip&&this.getParent().toolTip.hasPin()){D=-18}this.complex["body"].style.position="absolute";this.complex["body"].style.width=(E.x-30+D)+"px";this.complex["body"].style.height=(E.y-35)+"px";this.complex["body"].style.left=15+"px";this.complex["body"].style.top=(10+this.innerOffset.y)+"px";this.innerOffset.y>=this.pointerSize.y-1;var B=this.innerOffset.y>=this.pointerSize.y-1?0:this.size.y-this.pointerSize.y;this.complex["pointer"].style.position="absolute";this.complex["pointer"].style.overflow="hidden";this.complex["pointer"].style.width=this.pointerSize.x+"px";this.complex["pointer"].style.height=this.pointerSize.y+"px";this.complex["pointer"].style.left=this.pointerBorder.x+"px";this.complex["pointer"].style.top=B+"px";if(this.complex["pointer"].firstChild){this.complex["pointer"].firstChild.style.left=this.pointerState*-64+"px"}var C=(this.getParent()&&this.getParent().toolTip&&this.getParent().toolTip.hasPin());if(this.complex["pin"].firstChild){this.complex["pin"].firstChild.src=C?(A+"bubble.png"):this.mdvMap.transparent.src;this.complex["pin"].firstChild.onclick=C?MDVToolTipBubble_OnPinClick:null;this.complex["pin"].firstChild.style.top=-701+"px"}this.complex["pin"].style.position="absolute";this.complex["pin"].style.overflow="hidden";this.complex["pin"].style.width="19px";this.complex["pin"].style.height="18px";this.complex["pin"].style.left=(E.x-29)+"px";this.complex["pin"].style.top=(10+this.innerOffset.y)+"px"};MDVToolTipBubble.prototype.update=function(){var L=this.mdvMap.getPoint(this.getParent().getCoords());if(!L){this.mdvMap.events.triggerEvent(MDVEvent_ERROR,"MDVMap wasn't able to get px coordinates for marker.");return false}var K=this.getParent();var D=new MDVPoint(0,0);var E=0;var J=0;if(K&&K.img){D.x=K.img.width*K.getXFactor();D.y=K.img.height*K.getYFactor();E=K.img.width;J=K.img.height}if(K.img&&(this.margins==null||(this.getLastParent()&&this.getLastParent().id!=this.getParent().id))){var A=new MDVPoint(parseInt(this.div.style.left),parseInt(this.div.style.top));if(this.margins){this.div.style.left=(A.x-this.margins.x)+"px";this.div.style.top=(A.y-this.margins.y)+"px"}switch(this.pointerState){case 0:this.margins=new MDVPoint(E-D.x,0-D.y);break;case 1:this.margins=new MDVPoint(0-D.x,0-D.y);break;case 2:this.margins=new MDVPoint(0-D.x,J-D.y);break;case 3:this.margins=new MDVPoint(E-D.x,J-D.y);break}this.setLastParent(this.getParent())}else{if(K.img==null){this.margins=null;this.setLastParent(null)}}var H=this.mdvMap.getViewportExtends();if(!this.offset){this.offset=new MDVPoint(0+this.delta.x-this.pointerBorder.x,0)}else{this.offset.x+=this.delta.x;this.offset.y+=this.delta.y}this.delta.x=0;this.delta.y=0;var G=this.margins?this.margins.x:0;var C=this.margins?this.margins.y:0;this.div.style.left=(L.x+this.offset.x+G)+"px";this.div.style.top=(L.y+this.offset.y+C)+"px";var I=new MDVPoint(parseInt(this.div.style.left)+parseInt(this.mdvMap.mapper.style.left),parseInt(this.div.style.top)+parseInt(this.mdvMap.mapper.style.top));var F=false;var B={upper:true,lower:false,left:true,right:false};if(I.y<=0){this.innerOffset.y=this.pointerSize.y-1;this.offset.y=0;if(this.margins){this.margins.y=(J-D.y)}B.upper=true;F=true}else{B.upper=false}if(I.y+this.size.y+2*2>=H.height){this.innerOffset.y=0;this.offset.y=this.size.y*-1;if(this.margins){this.margins.y=0-D.y}B.lower=true;F=true}else{B.lower=false}if(I.x<0){this.pointerBorder.x=34;this.offset.x=0-34;if(this.margins){this.margins.x=E-D.x}B.left=true;F=true}else{B.left=false}if(I.x+this.size.x+2*2+D.x>H.width){this.offset.x=this.size.x*-1+34;this.pointerBorder.x=this.size.x-this.pointerSize.x-34;if(this.margins){this.margins.x=0-D.x}B.right=true;F=true}else{B.right=false}if(F){var G=this.margins?this.margins.x:0;var C=this.margins?this.margins.y:0;this.div.style.left=(L.x+this.offset.x+G)+"px";this.div.style.top=(L.y+this.offset.y+C)+"px"}this.pointerState=this.wrapPointer(B);this.updateBubble();return true};MDVToolTipBubble.prototype.wrapPointer=function(A){var B=this.pointerState;switch(this.pointerState){case 0:if(A.upper&&A.right){B=2}else{if(A.right){B=1}else{if(A.upper){B=3}}}break;case 1:if(A.upper&&A.left){B=3}else{if(A.left){B=0}else{if(A.upper){B=2}}}break;case 2:if(A.lower&&A.left){B=0}else{if(A.left){B=3}else{if(A.lower){B=1}}}break;case 3:if(A.lower&&A.right){B=1}else{if(A.right){B=2}else{if(A.lower){B=0}}}break}return B};function MDVToolTipBubble_OnPinClick(B){if(this.bubble&&this.bubble.getParent()&&this.bubble.getParent().toolTip){var A=this.bubble.getParent().toolTip.isFixed();this.bubble.complex["pin"].firstChild.style.left=(A?-662:-681)+"px";this.bubble.getParent().toolTip.setFixed(!A)}}function MDVToolTipSimple(A){this.mdvMap=A;this.id=this.mdvMap.lastContainerID++;this.div=null;this.point=null;this.append=false;this.visibility=false;this.mousePos=null;this.parentMarker=null;this.vacant=true;this.type="simple";for(var B in MDVToolTipContainer.prototype){if(!MDVToolTipSimple.prototype[B]){MDVToolTipSimple.prototype[B]=MDVToolTipContainer.prototype[B]}}this.init();this.div.className="MDVToolTip"}MDVToolTipSimple.prototype.update=function(){var I=this.mdvMap.getPoint(this.getParent().getCoords());var F=4;if(!I){this.mdvMap.events.triggerEvent(MDVEvent_ERROR,"MDVMap wasn't able to get px coordinates for marker.");return false}var H=this.getParent();var J=0;var B=0;var G=0;if(H.img){J=H.img.width*H.getXFactor();B=H.img.width;G=H.img.height}this.div.style.position="absolute";this.div.style.left=(I.x+J+F)+"px";this.div.style.top=(I.y+F)+"px";var A=this.mdvMap.getObjWidth(this.div);var K=this.mdvMap.getObjHeight(this.div);var D=new MDVPoint(parseInt(this.mdvMap.mapper.style.left),parseInt(this.mdvMap.mapper.style.top));if(I.x+D.x+A+J+F>(this.mdvMap.viewportWidth-2)){this.div.style.left=(I.x-A-B+J-F)+"px";if(I.x-A-B+J-(F*2)+D.x<=0){var E=I.x-A-B+J-(F*2)+D.x;this.div.style.left=parseInt(this.div.style.left)-E+"px"}}if(I.y+D.y+K+F>(this.mdvMap.viewportHeight-2)){var C=(I.y-K-G-(F*2)+D.y);if(C>0){C=0}this.div.style.top=(I.y-K-G-F-C)+"px"}return true};function MDVToolTipManager(A){this.mdvMap=A;this.growBy=1;this.containers=new Array()}MDVToolTipManager.prototype.require=function(D){var C=null;if(arguments.length==2){C=arguments[1]}if(this.containers[D]==null){this.containers[D]=new Array()}for(var B=0;B<this.containers[D].length;B++){if(this.containers[D][B].isVacant()){var E=this.containers[D][B];E.setVacant(false);if(C&&E.setSize){E.setSize(C)}return E}}var A=null;for(var B=0;B<this.growBy;B++){switch(D){case"bubble":var E=new MDVToolTipBubble(this.mdvMap,C);this.containers[D].push(E);if(!A){A=E;A.setVacant(false)}break;default:var E=new MDVToolTipSimple(this.mdvMap);this.containers[D].push(E);if(!A){A=E;A.setVacant(false)}break}}return A};MDVToolTipManager.prototype.free=function(A){var C=A.getType();if(!this.containers[C]){return false}for(var B=0;B<this.containers[C].length;B++){if(this.containers[C][B].id==A.id){this.containers[C][B].setVacant(true);return true}}return false};function MDVToolTipConsumer(){this.toolTip=null;this.coords=null}MDVToolTipConsumer.prototype.getCoords=function(){return this.coords};MDVToolTipConsumer.prototype.hide=function(){if(this.getToolTip()){this.getToolTip().hide()}};MDVToolTipConsumer.prototype.setCoords=function(A){this.coords=this.toolTip.mdvMap.getInternalCoordinates(A)};MDVToolTipConsumer.prototype.getToolTip=function(){return this.toolTip};MDVToolTipConsumer.prototype.setToolTip=function(A){this.toolTip=A;this.toolTip.setParent(this);this.toolTip.setCoords(this.coords)};function MDVLayer(A,B){if(!A||B==""){return }this.name=B;this.mdvMap=A;this.zIndex=0;this.id=A.lastLayerID++;this.visible=true;this.append=false;this.markers=new Array();this.polylines=new Array()}MDVLayer.prototype.getPolylineCoords=function(){var A=new Array();for(var B=0;B<this.polylines.length;B++){if(this.polylines[B]==null){continue}for(var C=0;C<this.polylines[B].coords.length;C++){A.push(this.polylines[B].coords[C])}}return A};MDVLayer.prototype.getName=function(){return this.name};MDVLayer.prototype.destroy=function(){var B=this.polylines.length;for(var C=0;C<B;C++){var A=this.polylines.pop();if(A){A.destroy()}}this.mdvMap=null;this.layer=null;this.renderer=null};MDVLayer.prototype.addPolyline=function(A){if(!A){return false}var C=true;for(var B=0;B<this.polylines.length;B++){if(this.polylines[B]&&this.polylines[B].id==A.id){return false}}if(arguments.length==2){C=arguments[1]}A.layer=this;this.polylines.push(A);if(C){this.update()}return true};MDVLayer.prototype.removePolyline=function(A){if(!A){return false}for(var B=0;B<this.polylines.length;B++){if(this.polylines[B]&&this.polylines[B].id==A.id){if(this.mdvMap.renderer.removePolyline(this.polylines[B])){this.polylines.splice(B,1)}return true}}return false};MDVLayer.prototype.hideToolTips=function(){var B=false;for(var A=0;A<this.markers.length;A++){if(this.markers[A].toolTip){mdvTimer.remove(this.markers[A].toolTip.job);if(this.markers[A].toolTip.isVisible()){this.markers[A].toolTip.hide();B=true}}}for(var C=0;C<this.polylines.length;C++){if(this.polylines[C]&&this.polylines[C].toolTip){mdvTimer.remove(this.polylines[C].toolTip.job);if(this.polylines[C].toolTip.isVisible()){this.polylines[C].toolTip.hide()}B=true}}return B};MDVLayer.prototype.setVisibility=function(B){if(this.visible!=B){this.visible=B;for(var A=0;A<this.markers.length;A++){this.markers[A].setVisibility(this.visible)}}};MDVLayer.prototype.update=function(){for(var A=0;A<this.markers.length;A++){if(this.name!="efa_trip"){this.markers[A].setVisibility(this.visible)}this.markers[A].update()}if(this.mdvMap.renderer){this.mdvMap.renderer.update()}for(var B=0;B<this.polylines.length;B++){if(this.polylines[B]&&this.polylines[B].append){this.mdvMap.renderer.removePolyline(this.polylines[B])}this.mdvMap.renderer.drawPolyline(this.polylines[B])}this.mdvMap.events.triggerEvent(MDVEvent_LAYER_UPDATED,"MDVMap has updated layer ("+this.name+")",this)};MDVLayer.prototype.addMarker=function(B){var C=true;for(var A=0;A<this.markers.length;A++){if(this.markers[A].id==B.id){return false}}if(arguments.length==2){C=arguments[1]}B.layer=this;this.markers.push(B);B.img.src=B.imgSrc;return true};MDVLayer.prototype.removeMarker=function(C){if(C==null){return false}var E=new Array();var F=false;var B=this.markers.length;for(var A=0;A<B;A++){var D=this.markers.shift();if(D.id==C.id&&C.append&&(C.img.parentElement||C.img.parentNode)){this.mdvMap.markerObjects.removeChild(D.img);D.append=false;F=true;break}E.push(D)}this.markers=E.concat(this.markers);return F};MDVLayer.prototype.getMarkers=function(){return this.markers};MDVLayer.prototype.getPolylines=function(){return this.polylines};MDVLayer.prototype.removeAll=function(){var B=this.removeAllMarkers();var A=this.removeAllPolylines();return B&&A};MDVLayer.prototype.removeAllPolylines=function(){var B=null;var A=false;while(B=this.polylines.pop()){if(this.mdvMap.renderer.removePolyline(B)){A=true}}return A};MDVLayer.prototype.removeAllMarkers=function(){var B=this.markers.length;var D=new Array();for(var A=0;A<B;A++){var C=this.markers.pop();if(C.toolTip&&C.toolTip.isVisible()&&C.toolTip.isFixed()){D.push(C);continue}if(C.append){this.mdvMap.markerObjects.removeChild(C.img);C.append=false}C.destroy()}this.markers=D;return true};MDVLayer.prototype.setZIndex=function(A){this.zIndex=A*this.id};function MDVTimer(){this.jobs=new Array()}MDVTimer.prototype.add=function(D,E,C,A){var G=this.jobs.length;for(var B=0;B<this.jobs.length;B++){if(this.jobs[B]==null){G=B;break}}var F=window.setTimeout("MDVTimer_execute("+G+")",D);this.jobs[G]=new MDVTimerJob(F,E,C,A);return G};MDVTimer.prototype.remove=function(A){if(this.jobs[A]!=null){window.clearTimeout(this.jobs[A].id);this.jobs[A]=null;return true}return false};var mdvTimer=new MDVTimer();function MDVTimerJob(D,C,B,A){this.id=D;this.target=C;this.func=B;this.arg=A}function MDVTimer_execute(C){if(mdvTimer.jobs[C]!=null){var B=mdvTimer.jobs[C].target;var A=mdvTimer.jobs[C].func;if(mdvTimer.jobs[C].arg!=null&&B!=null){A.apply(B,mdvTimer.jobs[C].arg)}else{A.apply(B)}mdvTimer.jobs[C]=null}}function MDVRenderer(A,B){this.mdvMap=A;this.container=B;this.max=null;this.min=null;this.border=10;this.offset=new MDVPoint(0,0);this.boundingBox=null}MDVRenderer.prototype.drawPolyline=function(A){this.mdvMap.events.triggerEvent(MDVEvent_ERROR,"MDVMap: Not implemented.");return false};MDVRenderer.prototype.removePolyline=function(A){this.mdvMap.events.triggerEvent(MDVEvent_ERROR,"MDVMap: Not implemented.");return false};MDVRenderer.prototype.setBoundingBox=function(){this.mdvMap.events.triggerEvent(MDVEvent_ERROR,"MDVMap: Not implemented.");return false};MDVRenderer.prototype.update=function(){var C=this.mdvMap.getPolylinePoints();if(C.length!=2||C[0].length<=0||C[1].length<=0){return false}var A=C[0];var E=C[1];A.sort(MDVMap_NumSort);E.sort(MDVMap_NumSort);this.max=new MDVPoint(A[A.length-1],E[E.length-1]);this.min=new MDVPoint(A[0],E[0]);var D=this.max.clone();var B=this.min.clone();D.x+=this.getBorder();D.y+=this.getBorder();B.x-=this.getBorder();B.y-=this.getBorder();this.boundingBox=[B.clone(),D.clone()];this.setBoundingBox();return true};MDVRenderer.prototype.getBorder=function(){return this.border};function MDVVMLRenderer(A,B){this.mdvMap=A;this.container=B;this.max=null;this.min=null;this.border=50;this.offset=new MDVPoint(0,0);this.boundingBox=null;this.group=null;document.namespaces.add("v","urn:schemas-microsoft-com:vml");var C=document.createStyleSheet();C.addRule("v\\: *","behavior: url(#default#VML);");C.addRule("v\\:shape","behavior: url(#default#VML);");C.addRule("v\\:stroke","behavior: url(#default#VML);");this.group=document.createElement("v:group");this.container.appendChild(this.group);for(var D in MDVRenderer.prototype){if(!MDVVMLRenderer.prototype[D]){MDVVMLRenderer.prototype[D]=MDVRenderer.prototype[D]}}}MDVVMLRenderer.prototype.drawPolyline=function(K){if(!K){return false}var P="m";var J=K.getAllCoords();for(var D=0;D<J.length;D++){var M=this.mdvMap.getPoint(J[D]);var L=M.x-this.offset.x;var I=M.y-this.offset.y;P+=L+","+I;if(D<J.length-1){P+=" "}if(D==0){P+="l"}}P+=" e";var B=this.boundingBox[1].x-this.boundingBox[0].x;var N=this.boundingBox[1].y-this.boundingBox[0].y;var C=this.boundingBox[0].x;var H=this.boundingBox[0].y;var A=K.get("colour");if(!A){A="red"}var E=K.get("weight");if(!E){E="4px"}var F=K.get("opacity");if(!F){F="0.5"}if(!K.append){var G=document.createElement("v:shape");G.style.position="relative";G.style.top="0px";G.style.left="0px";G.style.width=B;G.style.height=N;G.setAttribute("filled","false");G.setAttribute("stroked","true");G.setAttribute("strokecolor",A);G.setAttribute("strokeweight",E);G.setAttribute("path",P);var O=document.createElement("v:stroke");O.setAttribute("opacity",F);O.setAttribute("joinstyle","round");O.setAttribute("endcap","round");G.appendChild(O);this.group.appendChild(G);G.parentPolyline=K;K.element=G;K.element.mdvMap=this.mdvMap;K.append=true}else{if(K.element.path.value!=P){K.element.path.value=P}}if(K.toolTip){K.setToolTip(K.toolTip)}return true};MDVVMLRenderer.prototype.removePolyline=function(A){if(!A||!A.append||A.element==null){return false}this.group.removeChild(A.element);A.element.onmousedown=null;A.element.onmousemove=null;A.element.onmouseout=null;A.element.onmouseover=null;A.element.onmouseup=null;if(A.element.toolTip){A.element.toolTip=null}if(A.element.mdvMap){A.element.mdvMap=null}A.element=null;A.append=false;return true};MDVVMLRenderer.prototype.setBoundingBox=function(){var B=this.boundingBox[1].x-this.boundingBox[0].x;var A=this.boundingBox[1].y-this.boundingBox[0].y;var D=this.boundingBox[0].x;var C=this.boundingBox[0].y;this.offset=new MDVPoint(D,C);this.group.style.behavior="url(#default#VML)";this.group.style.width=B+"px";this.group.style.height=A+"px";this.group.style.position="absolute";this.group.style.left=D+"px";this.group.style.top=C+"px";this.group.setAttribute("coordsize",B+","+A);this.group.coordsize.value=B+","+A;return true};function MDVSVGRenderer(A,B){this.mdvMap=A;this.container=B;this.max=null;this.min=null;this.border=10;this.offset=new MDVPoint(0,0);this.boundingBox=null;this.svgNS="http://www.w3.org/2000/svg";this.svg=document.createElementNS(this.svgNS,"svg");this.svg.setAttributeNS(null,"overflow","visible");this.container.appendChild(this.svg);for(var C in MDVRenderer.prototype){if(!MDVSVGRenderer.prototype[C]){MDVSVGRenderer.prototype[C]=MDVRenderer.prototype[C]}}}MDVSVGRenderer.prototype.drawPolyline=function(G){if(!G){return false}var K="M";var F=G.getAllCoords();for(var B=0;B<F.length;B++){var I=this.mdvMap.getPoint(F[B]);var H=I.x-this.offset.x;var E=I.y-this.offset.y;K+=H+","+E;if(B<F.length-1){K+=" "}if(B==0){K+="L"}}if(!G.append){var A=G.get("colour");if(!A){A="red"}var C=G.get("weight");if(!C){C="4px"}var D=G.get("opacity");if(!D){D="0.50"}var J=document.createElementNS(this.svgNS,"path");J.setAttributeNS(null,"d",K);J.setAttributeNS(null,"stroke-linejoin","round");J.setAttributeNS(null,"stroke-linecap","round");J.setAttributeNS(null,"stroke-opacity",D);J.setAttributeNS(null,"stroke-width",C);J.setAttributeNS(null,"stroke",A);J.setAttributeNS(null,"fill","none");this.svg.appendChild(J);J.parentPolyline=G;G.element=J;G.element.mdvMap=this.mdvMap;G.append=true}else{if(G.element){G.element.setAttributeNS(null,"d",K)}}if(G.toolTip){G.setToolTip(G.toolTip)}return true};MDVSVGRenderer.prototype.removePolyline=function(A){if(!A||!A.append||A.element==null){return false}this.svg.removeChild(A.element);A.element.onmousedown=null;A.element.onmousemove=null;A.element.onmouseout=null;A.element.onmouseover=null;A.element.onmouseup=null;if(A.element.toolTip){A.element.toolTip=null}if(A.element.mdvMap){A.element.mdvMap=null}A.element=null;A.append=false;return true};MDVSVGRenderer.prototype.setBoundingBox=function(){var B=this.boundingBox[1].x-this.boundingBox[0].x;var A=this.boundingBox[1].y-this.boundingBox[0].y;var D=this.boundingBox[0].x;var C=this.boundingBox[0].y;this.offset=new MDVPoint(D,C);this.svg.setAttributeNS(null,"width",B+"px");this.svg.setAttributeNS(null,"height",A+"px");this.svg.setAttributeNS(null,"style","position: absolute; left: "+D+"px; top: "+C+"px;");return true};function MDVCanvasRenderer(A,B){this.mdvMap=A;this.container=B;this.max=null;this.min=null;this.border=10;this.offset=new MDVPoint(0,0);this.boundingBox=null;this.widh=null;this.height=null;this.top=null;this.left=null;this.addSpace=300;this.clipping=false;this.centreOld=null;this.stepX=0;this.stepY=0;this.removeCanvas=true;if(this.mdvMap.config.get("canvasAddSpace")){this.addSpace=this.mdvMap.config.get("canvasAddSpace")}for(var C in MDVRenderer.prototype){if(!MDVCanvasRenderer.prototype[C]){MDVCanvasRenderer.prototype[C]=MDVRenderer.prototype[C]}}this.canvas=document.getElementById("canvas");this.ctx=this.canvas.getContext("2d");this.mdvMap.events.registerEvent(MDVEvent_MOUSE_UP,null,function(){this.removeCanvas=true;if(!this.centreOld){this.centreOld=this.mdvMap.getCentre().clone()}var D;for(var E=0;E<this.mdvMap.layers.length;E++){if(this.mdvMap.layers[E].name==="efa_trip"&&this.mdvMap.layers[E].polylines.length>0){D=this.mdvMap.layers[E].polylines}}if(D){this.setBoundingBox();for(var F=0;F<D.length;F++){if(D[F]&&D[F].append){this.mdvMap.renderer.removePolyline(D[F])}this.mdvMap.renderer.drawPolyline(D[F])}this.centreOld=this.mdvMap.getCentre().clone()}return true}.bind(this));this.mdvMap.events.registerEvent(MDVEvent_ZOOM_CHANGED,null,function(){this.removeCanvas=true;this.stepX=0;this.stepY=0;return true}.bind(this))}MDVCanvasRenderer.prototype.drawPolyline=function(I){var B,H,A,K,E,J,D,G,F;if(!I){return false}if(!I.append){if(!this.container.hasChild("canvas")){this.canvas.setProperty("width",this.width);this.canvas.setProperty("height",this.height);this.canvas.setProperty("style","z-index: 1; position: absolute; left: "+this.left+"px; top: "+this.top+"px;");this.container.appendChild(this.canvas)}A=I.get("colour");if(!A){A="red"}D=I.get("weight");if(!D){D="4"}E=I.get("opacity");if(!E){E="0.50"}this.ctx.strokeStyle=A;this.ctx.lineWidth=D;this.ctx.globalAlpha=E;this.ctx.lineJoin="round";this.ctx.lineCap="round";this.ctx.beginPath();H=I.getAllCoords();for(var C=0;C<H.length;C++){J=this.mdvMap.getPoint(H[C]);G=J.x-this.offset.x;F=J.y-this.offset.y;if(D%2==1){G+=0.5;F+=0.5}if(C==0){this.ctx.moveTo(G,F)}else{this.ctx.lineTo(G,F)}}this.ctx.stroke();this.ctx.closePath();I.element=this.canvas;I.append=true}return true};MDVCanvasRenderer.prototype.removePolyline=function(A){if(!A||!A.append||A.element==null){return false}if(this.removeCanvas==false){A.append=false;return true}this.container.removeChild(document.getElementById("canvas"));A.element.onmousedown=null;A.element.onmousemove=null;A.element.onmouseout=null;A.element.onmouseover=null;A.element.onmouseup=null;A.element=null;A.append=false;this.removeCanvas=false;return true};MDVCanvasRenderer.prototype.setBoundingBox=function(){if(!this.centreOld){this.centreOld=this.mdvMap.getCentre()}var B=this.mdvMap.getCentre();var E=(this.boundingBox[1].x-this.boundingBox[0].x)>(this.mdvMap.viewportWidth+2*this.addSpace)?true:false;var A=(this.boundingBox[1].y-this.boundingBox[0].y)>(this.mdvMap.viewportHeight+2*this.addSpace)?true:false;var C=this.mdvMap.config.currentZoomLevelIndex;var D=(this.mdvMap.config.zoomLevels[C].params.tileSizeX*100)/(this.mdvMap.config.zoomLevels[C].params.realWidth/this.mdvMap.config.zoomLevels[C].params.numberOfTilesX);this.stepX+=((parseInt(this.centreOld.x)-parseInt(B.x))*D)/100;this.stepY+=((parseInt(this.centreOld.y)-parseInt(B.y))*D)/100;if(E||A){this.clipping=true}else{this.clipping=false}this.width=E?Math.ceil(this.mdvMap.viewportWidth+2*this.addSpace):(this.boundingBox[1].x-this.boundingBox[0].x);this.height=A?Math.ceil(this.mdvMap.viewportHeight+2*this.addSpace):(this.boundingBox[1].y-this.boundingBox[0].y);this.left=E?Math.ceil(-1*this.addSpace-this.stepX):this.boundingBox[0].x;this.top=A?Math.ceil(-1*this.addSpace-this.stepY):this.boundingBox[0].y;this.offset=new MDVPoint(this.left,this.top);return true};function MDVPolyline(A,C){if(!A){return }this.mdvMap=A;this.id=A.lastPolylineID++;this.coords=null;this.toolTip=null;this.attributes=new Array();this.element=null;this.renderer=this.mdvMap.renderer;this.layer=null;this.append=false;this.markers=new Array();this.mouse=null;this.arrows=new Array();this.directions=new Array();this.options=[];if(typeof C=="string"){this.coords=this.parseString(C)}else{if(typeof C=="object"){this.coords=C}}if(arguments.length==3){for(var B in arguments[2]){this.options[B]=arguments[2][B]}}}MDVPolyline.prototype.setMouse=function(A){this.mouse=A};MDVPolyline.prototype.destroy=function(){this.mdvMap=null;this.coords=null;if(this.toolTip){this.toolTip.destroy()}this.coords=null;this.mdvMap=null;if(this.element){if(this.element.mdvMap){this.element.mdvMap=null}this.element.onmouseover=null;this.element.onmouseout=null;this.element.onclick=null;this.element=null}};MDVPolyline.prototype.parseString=function(D){var C=D.split(" ");var F=new Array();for(var A=0;A<C.length;A++){var B=C[A].split(",");if(B[0]&&B[1]){var E=new MDVCoordinates(this.mdvMap.config.get("mapName"),B[0],B[1]);F.push(E)}}return F};MDVPolyline.prototype.add=function(B,C){for(var A=0;A<this.attributes.length;A++){if(this.attributes[A].key==B){return false}}this.attributes[B]=C;return true};MDVPolyline.prototype.get=function(A){if(this.attributes[A]){return this.attributes[A]}else{return false}};MDVPolyline.prototype.getAllCoords=function(){if(this.options["reductionList"]==null||this.coords.length===2){return this.coords}var A=this.mdvMap.config.getZoomLevel(this.mdvMap.config.getZoomLevelIndex());var E=parseInt(A.getScale());var C=null;for(var B=0;B<this.options["reductionList"].length;B++){C=this.options["reductionList"][B];if(C.maxScale>=E){break}}var D=[];for(var B=0;B<C.mask.length;B++){D.push(this.coords[parseInt(C.mask[B])])}return D};MDVPolyline.prototype.getCoords=function(){if(this.mouse){return this.mouse}var B=new Array();B["x"]=new Array();B["y"]=new Array();var C=this.getAllCoords();for(var A=0;A<C.length;A++){B["x"].push(C[A].x);B["y"].push(C[A].y)}B["x"].sort(MDVMap_NumSort);B["y"].sort(MDVMap_NumSort);return new MDVCoordinates(C[0].mapName,Math.floor(0.5+(B["x"][B["x"].length-1]+B["x"][0])/2),Math.floor(0.5+(B["y"][B["y"].length-1]+B["y"][0])/2))};MDVPolyline.prototype.setToolTip=function(B){if(!B){return false}var C=true;if(arguments.length==2){C=arguments[1]}var A=this.coords[0].clone();A.x=Math.floor(0.5+(parseInt(A.x)+parseInt(this.coords[this.coords.length-1].x))/2);A.y=Math.floor(0.5+(parseInt(A.y)+parseInt(this.coords[this.coords.length-1].y))/2);this.toolTip=B;this.toolTip.setParent(this);this.toolTip.setCoords(A);if(C){this.toolTip.update()}if(this.element){this.element.toolTip=B;this.mdvMap.assignTooltipHandler(this.element)}return true};MDVPolyline.prototype.getDirection=function(G,F){var I=F.x-G.x;var H=F.y-G.y;var D=Math.atan2(H,I);var B=D*180/Math.PI;var K=B;if(B<0){B=360+B}B=Math.floor(0.5+B);B+=90;while(B>=120){B-=120}var E="";switch(B%3){case 0:E=B+".png";break;case 1:E=(B-1)+".png";break;case 2:if(B+1==120){B=-1}E=(B+1)+".png";break}var A="FF0000";if(this.attributes["colour"]&&this.attributes["colour"].indexOf("#")>-1){A=this.attributes["colour"].substring(this.attributes["colour"].indexOf("#")+1)}var J="images/";if(this.mdvMap.config.get("imagePath")){J=this.mdvMap.config.get("imagePath")}var C=this.mdvMap.createMarker(G,new MDVPoint(0.5,0.5),J+"dir/"+A+"/"+E);return C};MDVPolyline.prototype.getDirections=function(){var D=this.getAllCoords();var J=20;var K=new Array();var A=0;var I=0;if(this.mdvMap.config.get("trips.polyline.arrows.max")){J=parseInt(this.mdvMap.config.get("trips.polyline.arrows.max"))}var C=this.mdvMap.config.getZoomLevel(this.mdvMap.config.currentZoomLevelIndex);var H=parseInt(C.get("tileSizeX"))*parseInt(C.get("numberOfTilesX"));var E=H/parseInt(C.get("realWidth"));while(A<=0&&I<3){for(var G=0;G<D.length-1;G++){if(!D[G]||!D[G+1]){return null}var B=new MDVPoint(D[G+1].x-D[G].x,D[G+1].y-D[G].y);var F=Math.sqrt(Math.pow(B.x,2)+Math.pow(B.y,2));F*=E;if(F>J){K.push(this.getDirection(new MDVCoordinates(D[G].mapName,D[G].x+B.x/2,D[G].y+B.y/2),D[G+1].clone()));A++}}J-=4;I++}return K};MDVPolyline.prototype.getArrow=function(K,H){var B=this;var E=this.mdvMap.config.getZoomLevel(this.mdvMap.config.currentZoomLevelIndex);var I=parseInt(E.get("tileSizeX"))*parseInt(E.get("numberOfTilesX"));var O=parseInt(E.get("realWidth"))/I;var A=parseInt(E.get("tileSizeY"))*parseInt(E.get("numberOfTilesY"));var L=parseInt(E.get("realHeight"))/A;var M=H.x-K.x;var J=H.y-K.y;var D=Math.atan2(J,M);var N=new Array();var G=null;N.push([new MDVCoordinates(K.mapName,K.x-5*O,K.y-6*L),new MDVCoordinates(K.mapName,K.x,K.y)]);N.push([new MDVCoordinates(K.mapName,K.x-5*O,K.y+6*L),new MDVCoordinates(K.mapName,K.x,K.y)]);for(var F=0;F<N.length;F++){var P=new MDVPoint(N[F][0].x-N[F][1].x,N[F][0].y-N[F][1].y);var C=new MDVPoint(0,0);C.x=P.x*Math.cos(D)-P.y*Math.sin(D);C.y=P.x*Math.sin(D)+P.y*Math.cos(D);N[F][0].x=N[F][1].x+C.x;N[F][0].y=N[F][1].y+C.y}G=this.mdvMap.createPolyline(N[0][0].x+","+N[0][0].y+" "+N[0][1].x+","+N[0][1].y+" "+N[1][0].x+","+N[1][0].y+" "+N[1][1].x+","+N[1][1].y);if(B.get("weight")){G.add("weight",B.get("weight"))}else{G.add("weight","3")}if(B.get("colour")){G.add("colour",B.get("colour"))}if(B.get("opacity")){G.add("opacity",B.get("opacity"))}else{G.add("opacity","0.5")}return G};MDVPolyline.prototype.getArrows=function(){var D=this.getAllCoords();var J=20;var K=new Array();var A=0;var I=0;if(this.mdvMap.config.get("trips.polyline.arrows.max")){J=parseInt(this.mdvMap.config.get("trips.polyline.arrows.max"))}var C=this.mdvMap.config.getZoomLevel(this.mdvMap.config.currentZoomLevelIndex);var H=parseInt(C.get("tileSizeX"))*parseInt(C.get("numberOfTilesX"));var E=H/parseInt(C.get("realWidth"));while(A<=0&&I<3){for(var G=0;G<D.length-1;G++){if(!D[G]||!D[G+1]){return null}var B=new MDVPoint(D[G+1].x-D[G].x,D[G+1].y-D[G].y);var F=Math.sqrt(Math.pow(B.x,2)+Math.pow(B.y,2));F*=E;if(F>J){K.push(this.getArrow(new MDVCoordinates(D[G].mapName,D[G].x+B.x/2,D[G].y+B.y/2),D[G+1].clone()));A++}}J-=4;I++}return K};function MDVMap_NumSort(B,A){return B-A}function MDVHotspots(A){if(!A){return }this.mdvMap=A;this.name="MDVHotspots";this.data=[];this.current=null;this.json=null;this.viewportRealTl=new MDVCoordinates(this.mdvMap.name,parseInt(this.mdvMap.config.get("xCenterReal")-(this.mdvMap.viewportRealWidth*0.5)),parseInt(this.mdvMap.config.get("xCenterReal")-(this.mdvMap.viewportRealHeight*0.5)));this.viewportRealBr=new MDVCoordinates(this.mdvMap.name,parseInt(this.mdvMap.config.get("xCenterReal")+(this.mdvMap.viewportRealWidth*0.5)),parseInt(this.mdvMap.config.get("xCenterReal")+(this.mdvMap.viewportRealHeight*0.5)));this.level=null;this.mapNavigator=null;this.tooltip=new MDVToolTipConsumer();var B=this.mdvMap.createToolTip();this.tooltip.setToolTip(B);this.mdvMap.hotspots=this;this.mdvMap.events.registerEvent(MDVEvent_CENTRE_CHANGED,this,this.onCentreChanged);this.mdvMap.events.registerEvent(MDVEvent_MOUSE_MOVED,this,this.check);this.mdvMap.events.registerEvent(MDVEvent_MOUSE_UP,this,this.appendExec);this.mdvMap.events.registerEvent(MDVEvent_MAP_INITIALISED,this,this.onLevelChanged)}MDVHotspots.prototype.onCentreChanged=function(C,B,A){if(this.json===null){return }if(this.mdvMap.config.getZoomLevelIndex()<this.mdvMap.config.get("showHotspotLevel")){return true}this.viewportRealTl=new MDVCoordinates(this.mdvMap.name,parseInt(A.x-(this.mdvMap.viewportRealWidth*0.5)),parseInt(A.y-(this.mdvMap.viewportRealHeight*0.5)));this.viewportRealBr=new MDVCoordinates(this.mdvMap.name,parseInt(A.x+(this.mdvMap.viewportRealWidth*0.5)),parseInt(A.y+(this.mdvMap.viewportRealHeight*0.5)))};MDVHotspots.prototype.onLevelChanged=function(){if(this.json===null){return }var B=this.mdvMap.config.getZoomLevelIndex();if(B<this.mdvMap.config.get("showHotspotLevel")||B===this.level){return true}var A=this.mdvMap.getCentre();this.viewportRealTl=new MDVCoordinates(this.mdvMap.name,parseInt(A.x-(this.mdvMap.viewportRealWidth*0.5)),parseInt(A.y-(this.mdvMap.viewportRealHeight*0.5)));this.viewportRealBr=new MDVCoordinates(this.mdvMap.name,parseInt(A.x+(this.mdvMap.viewportRealWidth*0.5)),parseInt(A.y+(this.mdvMap.viewportRealHeight*0.5)));this.appendExec()};MDVHotspots.prototype.isInArea=function(B,A,C){if(!B.x||!B.y||!A.x||!A.y||!A.x||!C.y){return }if(B.x>A.x==false){return false}if(B.x<C.x==false){return false}if(B.y>A.y==false){return false}if(B.y<C.y==false){return false}return true};MDVHotspots.prototype.appendExec=function(){if(this.json===null){return }if(this.mdvMap.config.getZoomLevelIndex()<this.mdvMap.config.get("showHotspotLevel")){return true}var B=this.mdvMap;this.data.length=0;function E(H){var K=B.config.get("mapName");var G=new MDVCoordinates(K,parseInt(H[0]),parseInt(H[1]));var J=new MDVCoordinates(K,parseInt(H[2]),parseInt(H[3]));var F=this.viewportRealTl;var I=this.viewportRealBr;if(this.isInArea(G,F,I)||this.isInArea(J,F,I)){return true}else{return false}}var C=this.json||[];for(var A=0,D=C.length;A<D;A++){if(E.bind(this)(C[A][2])){this.data.push(C[A])}}};MDVHotspots.prototype.retrieve=function(){if(!this.mdvMap.config.get("hotspotURL")){return }for(var i=0;i<this.mdvMap.gadgets.length;i++){if(this.mdvMap.gadgets[i].name==="MapNavigator"){this.mapNavigator=this.mdvMap.gadgets[i];break}}if(this.json==null){mdvLib.ajax({host:this.mdvMap.config.get("hotspotURL"),method:"get",onComplete:assignAjaxResponse.bind(this)})}function assignAjaxResponse(response){var _response=typeof response!=="string"?(response.responseText||response):response.trim();this.json=eval(_response);this.onLevelChanged()}};MDVHotspots.prototype.check=function(A,B,E){if(this.mdvMap.config.getZoomLevelIndex()<this.mdvMap.config.get("showHotspotLevel")){return true}if(!E||!this.data||this.data.length==0){return }var G=this.mdvMap;var C=G.config.get("mapName");for(var F=0,D=this.data.length;F<D;F++){var H=this.data[F][2];var J=new MDVCoordinates(C,parseInt(H[0]),parseInt(H[1]));var I=new MDVCoordinates(C,parseInt(H[2]),parseInt(H[3]));if(this.isInArea(E,J,I)){G.getMapper().style.cursor="pointer";this.current=this.data[F];this.triggerTooltip(A,B,E);break}else{G.setDefaultCursor();this.tooltip.getToolTip().hide();this.current=null}}};MDVHotspots.prototype.triggerTooltip=function(E,D,C){var B=C.x+10;var A=C.y+10;this.tooltip.setCoords(new MDVCoordinates(this.mdvMap.name,B,A));this.tooltip.getToolTip().setInnerHTML(this.current[1]);this.tooltip.getToolTip().display()};function MDVGadgetBase(A){if(!A){return }this.name="GadgetBase";this.mdvMap=A;this.active=true;this.mdvMap.registerGadget(this)}MDVGadgetBase.prototype.stopEvent=function(A){if(!A){return true}A.cancelBubble=true;A.returnValue=false;if(A.stopPropagation){A.stopPropagation()}if(A.preventDefault){A.preventDefault()}return false};MDVGadgetBase.prototype.destroy=function(){if(this.mdvMap){this.mdvMap=null}this.ondblclick=null;this.onkeypress=null;this.onmousedown=null;this.onmousemove=null;this.onmouseout=null;this.onmouseover=null;this.onmouseup=null;this.onmousewheel=null;this.oncontextmenu=null};MDVGadgetBase.prototype.setActive=function(A){this.active=A};MDVGadgetBase.prototype.isActive=function(){return this.active};MDVGadgetBase.prototype.ondblclick=function(A){return true};MDVGadgetBase.prototype.onkeypress=function(A){return true};MDVGadgetBase.prototype.onmousedown=function(A){return true};MDVGadgetBase.prototype.onmousemove=function(A){return true};MDVGadgetBase.prototype.onmouseout=function(A){return true};MDVGadgetBase.prototype.onmouseover=function(A){return true};MDVGadgetBase.prototype.onmouseup=function(A){return true};MDVGadgetBase.prototype.onmousewheel=function(A){return true};MDVGadgetBase.prototype.oncontextmenu=function(A){return true};function MDVMapNavigator(A){if(!A){return }this.name="MapNavigator";this.mdvMap=A;this.mouseDown=false;this.centre;this.mouseLast=new MDVPoint(-1,-1);this.mouseStart=new MDVPoint(-1,-1);this.mwHotSpot=null;this.mdvMap.registerGadget(this);for(var B in MDVGadgetBase.prototype){if(!MDVMapNavigator.prototype[B]){MDVMapNavigator.prototype[B]=MDVGadgetBase.prototype[B]}}this.mdvMap.events.registerEvent(MDVEvent_MAP_INITIALISED,this,this.setDefaultCursor);this.mdvMap.events.registerEvent(MDVEvent_MOUSE_MOVED,this,this.updateMWHotSpot)}MDVMapNavigator.prototype.destroy=function(){if(this.mdvMap){this.mdvMap=null}this.ondblclick=null;this.onkeypress=null;this.onmousedown=null;this.onmousemove=null;this.onmouseout=null;this.onmouseover=null;this.onmouseup=null;this.onmousewheel=null;this.oncontextmenu=null};MDVMapNavigator.prototype.updateMWHotSpot=function(C,B,A){if(this.mdvMap.config.get("centreOnMouseWheel")&&this.mdvMap.config.get("centreOnMouseWheel")=="true"){this.mwHotSpot=A.clone()}else{if(this.mdvMap.config.get("hotspotOnMouseWheel")&&this.mdvMap.config.get("hotspotOnMouseWheel")=="true"){this.mwHotSpot=A.clone()}}};MDVMapNavigator.prototype.setDefaultCursor=function(){if(this.mdvMap.config.get("cursorIdle")){if(document.all){this.mdvMap.getMapper().style.cursor="url('"+this.mdvMap.config.get("cursorIdle")+"')"}else{this.mdvMap.getMapper().style.cursor="-moz-grab"}}};MDVMapNavigator.prototype.oncontextmenu=function(A){return false};MDVMapNavigator.prototype.ondblclick=function(G){G=G?G:window.event;if(this.mdvMap.config.get("omitDoubleClick")&&this.mdvMap.config.get("omitDoubleClick")=="true"){this.stopEvent(G);return false}var D=G.pageX||(G.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));var A=G.pageY||(G.clientY+(document.documentElement.scrollTop||document.body.scrollTop));var M=0;var H=0;var F=this.mdvMap.viewport;while(F){M+=F.offsetLeft;H+=F.offsetTop;F=F.offsetParent}D=D-(M);A=A-(H);var E=(this.mdvMap.config.get("useMagnifyGlass")&&this.mdvMap.config.get("useMagnifyGlass")=="true");var I=new MDVPoint(D,A);var L=this.mdvMap.getCoordinates(I);var C=this.mdvMap.getPoint(this.mdvMap.getCentre());C.x+=parseInt(this.mdvMap.getMapper().style.left);C.y+=parseInt(this.mdvMap.getMapper().style.top);var J=new MDVPoint(C.x-I.x,C.y-I.y);if(this.mdvMap.config.get("zoomOnDoubleClick")&&this.mdvMap.config.get("zoomOnDoubleClick")=="true"){this.mdvMap.setCentre(L);this.mdvMap.getMapper().style.left=parseInt(this.mdvMap.getMapper().style.left)+J.x+"px";this.mdvMap.getMapper().style.top=parseInt(this.mdvMap.getMapper().style.top)+J.y+"px";var B=this.mdvMap.config.getZoomLevel(parseInt(this.mdvMap.config.getZoomLevelIndex())+1);if(B!=null&&E){this.mdvMap._checkWrap();this.mdvMap.magnify(parseInt(this.mdvMap.config.getZoomLevelIndex())+1);this.mdvMap.switchMapper()}else{if(B!=null&&!E){this.mdvMap.setZoomLevel(parseInt(this.mdvMap.config.getZoomLevelIndex())+1);this.mdvMap.update()}else{this.mdvMap.update()}}}else{if(this.mdvMap.config.get("moveOnDoubleClick")&&this.mdvMap.config.get("moveOnDoubleClick")=="true"){var K=[this.mdvMap.getCentre().clone(),L.clone()];this.mdvMap.moveBySeq(K)}else{this.mdvMap.setCentre(L);this.mdvMap.update();this.mdvMap.events.triggerEvent(MDVEvent_MAP_INITIALISED,"MDVMap tiles have been initialised",this.mdvMap)}}this.stopEvent(G);return false};MDVMapNavigator.prototype.onmousewheel=function(C){C=C?C:window.event;var F=null;var B=null;if(this.mdvMap.config.get("centreOnMouseWheel")&&this.mdvMap.config.get("centreOnMouseWheel")=="true"){F=this.mwHotSpot}else{if(this.mdvMap.config.get("hotspotOnMouseWheel")&&this.mdvMap.config.get("hotspotOnMouseWheel")=="true"){B=this.mwHotSpot}}var A=C.detail?(C.detail*-1):C.wheelDelta;if(A>0){var D=this.mdvMap.config.getZoomLevel(this.mdvMap.config.getZoomLevelIndex()+1);if(D!=null){var E=this.mdvMap.getCentre();if(F){this.mdvMap.setCentre(F)}else{if(B){E=this.getNewHotspotCentre(B,this.mdvMap.config.getZoomLevelIndex()+1)}}F=null;B=null;if(this.mdvMap.config.get("useMagnifyGlass")&&this.mdvMap.config.get("useMagnifyGlass")=="true"){this.mdvMap.magnify(this.mdvMap.config.getZoomLevelIndex()+1,E);this.mdvMap.switchMapper()}else{this.mdvMap.setZoomLevel(this.mdvMap.config.getZoomLevelIndex()+1);this.mdvMap.setCentre(E);this.mdvMap.update()}}}else{var D=this.mdvMap.config.getZoomLevel(this.mdvMap.config.getZoomLevelIndex()-1);if(D!=null){var E=this.mdvMap.getCentre();if(B&&!F){E=this.getNewHotspotCentre(B,this.mdvMap.config.getZoomLevelIndex()-1)}F=null;B=null;if(this.mdvMap.config.get("useMagnifyGlass")&&this.mdvMap.config.get("useMagnifyGlass")=="true"){this.mdvMap.magnify(this.mdvMap.config.getZoomLevelIndex()-1,E);this.mdvMap.switchMapper()}else{this.mdvMap.setZoomLevel(this.mdvMap.config.getZoomLevelIndex()-1);this.mdvMap.setCentre(E);this.mdvMap.update()}}}this.mouseDown=false;this.stopEvent(C);return false};MDVMapNavigator.prototype.getNewHotspotCentre=function(G,L){var F=G.clone();var B=this.mdvMap.getPoint(F);var A=this.mdvMap.getPoint(this.mdvMap.getCentre());var D=new MDVPoint(A.x-B.x,A.y-B.y);var K=this.mdvMap.config.getZoomLevel(L);var E=this.mdvMap.config.getZoomLevel(L);var H=parseInt(E.get("tileSizeX"))*parseInt(E.get("numberOfTilesX"));var J=parseInt(E.get("realWidth"))/H;var C=parseInt(E.get("tileSizeY"))*parseInt(E.get("numberOfTilesY"));var I=parseInt(E.get("realHeight"))/C;D.x*=J;D.y*=I;F.x+=D.x;F.y+=D.y;return F};MDVMapNavigator.prototype.onmousedown=function(D){D=D?D:window.event;var A=navigator.userAgent;if((D.button==0&&!window.event)||(D.button==1&&window.event)||(D.button==0&&A.indexOf("Opera")>=0)||(D.button==0&&A.indexOf("Safari")>=0)){var C=D.pageX||(D.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));var B=D.pageY||(D.clientY+(document.documentElement.scrollTop||document.body.scrollTop));this.mouseLast.x=C;this.mouseLast.y=B;this.mouseStart.x=this.mouseLast.x;this.mouseStart.y=this.mouseLast.y;if(!this.mouseDown){if(this.mdvMap.config.get("cursorMove")){if(document.all){this.mdvMap.getMapper().style.cursor="url('"+this.mdvMap.config.get("cursorMove")+"')"}else{this.mdvMap.getMapper().style.cursor="-moz-grabbing"}}else{this.mdvMap.getMapper().style.cursor="auto"}}this.centre=new MDVCoordinates(this.mdvMap.getCentre().mapName,this.mdvMap.getCentre().x,this.mdvMap.getCentre().y);this.mouseDown=true;return this.stopEvent(D)}else{this.mouseDown=false;return true}};MDVMapNavigator.prototype.onmouseup=function(B){B=B?B:window.event;if(this.mouseDown){if(document.all&&B.type=="mouseout"){return true}if(this.mdvMap.config.get("cursorIdle")){if(document.all){this.mdvMap.getMapper().style.cursor="url('"+this.mdvMap.config.get("cursorIdle")+"')"}else{this.mdvMap.getMapper().style.cursor="-moz-grab"}}else{this.mdvMap.getMapper().style.cursor="auto"}var A=this.mdvMap.getCentre();if(this.centre&&(this.centre.x!=A.x||this.centre.y!=A.y)){this.mdvMap.events.triggerEvent(MDVEvent_MAP_INITIALISED,"MDVMap tiles have been initialised",this.mdvMap)}}this.mouseDown=false;return false};MDVMapNavigator.prototype.onmouseout=function(B){B=B?B:window.event;var C=B.srcElement?B.srcElement:B.target;var A=B.srcElement?C.parentElement:C.parentNode;while(A){if(A.className=="mdvLayer"){return true}A=B.srcElement?A.parentElement:A.parentNode}return this.onmouseup(B)};MDVMapNavigator.prototype.onmousemove=function(N){N=N?N:window.event;var G=N.pageX||(N.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));var F=N.pageY||(N.clientY+(document.documentElement.scrollTop||document.body.scrollTop));var A=0;var R=0;var H=this.mdvMap.viewport;while(H){A+=H.offsetLeft;R+=H.offsetTop;H=H.offsetParent}G=G-(A);F=F-(R);var K=new MDVPoint(G,F);var Q=this.mdvMap.getCoordinates(K);this.mdvMap.events.triggerEvent(MDVEvent_MOUSE_MOVED,"MDVMap noticed a mouse movement.",Q);if(this.mouseDown){if(this.mdvMap.config.get("cursorMove")){if(document.all){this.mdvMap.getMapper().style.cursor="url('"+this.mdvMap.config.get("cursorMove")+"')"}else{this.mdvMap.getMapper().style.cursor="-moz-grabbing"}}else{this.mdvMap.getMapper().style.cursor="auto"}var E=N.pageX||(N.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));var D=N.pageY||(N.clientY+(document.documentElement.scrollTop||document.body.scrollTop));var B=new MDVPoint(parseInt(this.mdvMap.getMapper().style.left),parseInt(this.mdvMap.getMapper().style.top));var I=this.mdvMap.config.getZoomLevel(this.mdvMap.config.currentZoomLevelIndex);var P=parseInt(I.get("tileSizeX"))*parseInt(I.get("numberOfTilesX"));var C=parseInt(I.get("realWidth"))/P;var M=parseInt(I.get("tileSizeY"))*parseInt(I.get("numberOfTilesY"));var L=parseInt(I.get("realHeight"))/M;var O=new MDVPoint(((E-this.mouseLast.x)*C),(D-this.mouseLast.y)*L);var J=new MDVCoordinates(this.mdvMap.config.get("mapName"),this.mdvMap.real.x-O.x,this.mdvMap.real.y-O.y);this.mdvMap.setCentre(J);if(this.mdvMap.getCentre().x==J.x){this.mdvMap.getMapper().style.left=(B.x+(E-this.mouseLast.x))+"px";this.mdvMap.getMagnifyMapper().style.left=(parseInt(this.mdvMap.getMagnifyMapper().style.left)+(E-this.mouseLast.x))+"px"}if(this.mdvMap.getCentre().y==J.y){this.mdvMap.getMapper().style.top=(B.y+(D-this.mouseLast.y))+"px";this.mdvMap.getMagnifyMapper().style.top=(parseInt(this.mdvMap.getMagnifyMapper().style.top)+(D-this.mouseLast.y))+"px"}this.mouseLast.x=E;this.mouseLast.y=D;this.mdvMap._checkWrap()}};function MDVMapCrosshair(A){if(!A){return }this.name="MapCrosshair";this.mdvMap=A;this.mdvMap.registerGadget(this);for(var B in MDVGadgetBase.prototype){if(!MDVMapCrosshair.prototype[B]){MDVMapCrosshair.prototype[B]=MDVGadgetBase.prototype[B]}}this.mdvMap.events.registerEvent(MDVEvent_MAP_INITIALISED,this,this.execute)}MDVMapCrosshair.prototype.execute=function(){if(this.mdvMap.config.get("crosshair")){var D=this.mdvMap.config.get("crosshair");var B=this.mdvMap.getMapper();if(!document.getElementById("crosshairLayer")){var C=document.createElement("div");C.id="crosshairLayer";C.style.position="absolute";C.style.top=(this.mdvMap.viewportHeight)/2-parseInt(B.style.top);C.style.left=(this.mdvMap.viewportWidth)/2-parseInt(B.style.left);C.style.zIndex=10;var A=new Image();A.src=D;C.appendChild(A);this.mdvMap.getMapper().appendChild(C)}else{var C=document.getElementById("crosshairLayer");if(C){C.style.position="absolute";C.style.top=(this.mdvMap.viewportHeight)/2-parseInt(B.style.top)+"px";C.style.left=(this.mdvMap.viewportWidth)/2-parseInt(B.style.left)+"px";C.style.zIndex=10}}}};function MDVMapEFAInfo(A){this.mdvMap=A;this.name="MapEFAInfo";this.stops=null;this.poi=null;this.centre=null;this.id=null;this.lastCentre=null;this.stopImg=new Image();this.mot1Img=new Image();this.mot2Img=new Image();this.mot3Img=new Image();this.mot4Img=new Image();this.mot5Img=new Image();this.mot6Img=new Image();this.mot7Img=new Image();this.mot8Img=new Image();this.mot9Img=new Image();this.mot10Img=new Image();this.mot11Img=new Image();this.mot12Img=new Image();this.poiImg=new Image();this.imgsLoaded=false;this.comparator=null;if(arguments.length>=2&&arguments[1]!=null){this.comparator=arguments[1]}if(arguments.length>=2&&arguments[2]!=null){this.getMOTImage=arguments[2]}for(var B in MDVGadgetBase.prototype){if(!MDVMapEFAInfo.prototype[B]){MDVMapEFAInfo.prototype[B]=MDVGadgetBase.prototype[B]}}this.mdvMap.registerGadget(this);this.mdvMap.events.registerEvent(MDVEvent_MAP_INITIALISED,this,this.trigger);this.mdvMap.events.registerEvent(MDVEvent_AJAX_CALLBACK,this,this.processPins)}MDVMapEFAInfo.prototype.destroy=function(){this.stopImg.onclick=null;this.stopImg=null;this.mot1Img.onclick=null;this.mot1Img=null;this.mot2Img.onclick=null;this.mot2Img=null;this.mot3Img.onclick=null;this.mot3Img=null;this.mot4Img.onclick=null;this.mot4Img=null;this.mot5Img.onclick=null;this.mot5Img=null;this.mot6Img.onclick=null;this.mot6Img=null;this.mot7Img.onclick=null;this.mot7Img=null;this.mot8Img.onclick=null;this.mot8Img=null;this.mot9Img.onclick=null;this.mot9Img=null;this.mot10Img.onclick=null;this.mot10Img=null;this.mot11Img.onclick=null;this.mot11Img=null;this.mot12Img.onclick=null;this.mot12Img=null;this.poiImg.onclick=null;this.poiImg=null;if(this.stops){this.stops.removeAll()}if(this.poi){this.poi.removeAll()}};MDVMapEFAInfo.prototype.createLayers=function(){if(!this.stops){this.stops=this.mdvMap.createLayer("efa_stops");this.stops.setZIndex(2);this.mdvMap.addLayer(this.stops)}if(!this.poi){this.poi=this.mdvMap.createLayer("efa_poi");this.poi.setZIndex(1);this.mdvMap.addLayer(this.poi)}};MDVMapEFAInfo.prototype.trigger=function(){var A="images/";if(this.mdvMap.config.get("imagePath")){A=this.mdvMap.config.get("imagePath")}if(!this.imgsLoaded){this.stopImg.src=A+"stop.gif";this.mot1Img.src=A+"mot1.gif";this.mot2Img.src=A+"mot2.gif";this.mot3Img.src=A+"mot3.gif";this.mot4Img.src=A+"mot4.gif";this.mot5Img.src=A+"mot5.gif";this.mot6Img.src=A+"mot6.gif";this.mot7Img.src=A+"mot7.gif";this.mot8Img.src=A+"mot8.gif";this.mot9Img.src=A+"mot9.gif";this.mot10Img.src=A+"mot10.gif";this.mot11Img.src=A+"mot11.gif";this.mot12Img.src=A+"mot12.gif";this.poiImg.src=A+"pin.gif";this.imgsLoaded=true}if(this.id){mdvTimer.remove(this.id);this.id=null}this.id=mdvTimer.add(700,this,this.execute,[])};MDVMapEFAInfo.prototype.execute=function(){mdvTimer.remove(this.id);this.id=null;this.createLayers();var C=this.mdvMap.config.getZoomLevel(this.mdvMap.config.getZoomLevelIndex());var A=C.get("showSTOP")=="true";var B=C.get("showPOI")=="true";if(A||B){this.fetchPins()}else{this.stops.removeAll();this.poi.removeAll()}};MDVMapEFAInfo.prototype.getMOTImage=function(D,B,A,C){switch(parseInt(D)){case 1:return this.mot1Img.src;break;case 2:return this.mot2Img.src;break;case 3:return this.mot3Img.src;break;case 4:return this.mot4Img.src;break;case 5:return this.mot5Img.src;break;case 6:return this.mot6Img.src;break;case 7:return this.mot7Img.src;break;case 8:return this.mot8Img.src;break;case 9:return this.mot9Img.src;break;case 10:return this.mot10Img.src;break;case 11:return this.mot11Img.src;break;case 12:return this.mot12Img.src;break;default:if(B.toUpperCase()=="POI"){return this.poiImg.src}else{return this.stopImg.src}break}return null};MDVMapEFAInfo.prototype.processPins=function(R,B,D){if(B!="MapEFAInfo"){return false}mdvTimer.remove(this.id);this.id=null;var Q=this.mdvMap.config.getZoomLevel(this.mdvMap.config.getZoomLevelIndex());var W=Q.get("showSTOP")=="true"?true:false;var S=Q.get("showPOI")=="true"?true:false;var Y=D.getElementsByTagName("itdPinElem");var b=D.getElementsByTagName("itdMapRequest");this.stops.removeAll();this.poi.removeAll();if(b&&b.length>0){var E=new MDVCoordinates(b[0].getAttribute("mapName"),b[0].getAttribute("xCenterReal"),b[0].getAttribute("yCenterReal"));if(!E.equals(this.mdvMap.getCentre())){return false}}var C=false;var F=false;if(Y.length<=0||b.length<=0){this.mdvMap.events.triggerEvent(MDVEvent_ERROR,"MDVMap wasn't able to get pins from map request.");return false}for(var X=0;X<Y.length;X++){var U=Y[X].getAttribute("desc");var H=Y[X].getAttribute("id");var c=Y[X].getAttribute("type");var P=Y[X].getAttribute("omc");var O=new Array();var L=new Image();var J=Y[X].getElementsByTagName("genAttrElem");if(J.length>0){var A="";var a=J[0];while(a){if(a.nodeType!=1||!a.firstChild){a=a.nextSibling;continue}if(a.firstChild&&a.firstChild.firstChild&&a.firstChild.firstChild.nodeValue=="STOP_MAJOR_MEANS"&&a.firstChild.nextSibling&&a.firstChild.nextSibling.firstChild){A=a.firstChild.nextSibling.firstChild.nodeValue}if(a.firstChild&&a.firstChild.firstChild&&a.firstChild.nextSibling&&a.firstChild.nextSibling.firstChild){O.push({name:a.firstChild.firstChild.nodeValue,value:a.firstChild.nextSibling.firstChild.nodeValue})}a=a.nextSibling}L.src=this.getMOTImage(A,c,Y[X],O)}else{if(c.toUpperCase()=="POI"){L.src=this.poiImg.src}else{L.src=this.stopImg.src}}var I=new Array();I["poi"]=new MDVPoint(284,190);I["stop"]=new MDVPoint(284,190);if(this.mdvMap.config.get("info.stop.size.width")&&this.mdvMap.config.get("info.stop.size.height")){I["stop"]=new MDVPoint(this.mdvMap.config.get("info.stop.size.width"),this.mdvMap.config.get("info.stop.size.height"))}if(this.mdvMap.config.get("info.poi.size.width")&&this.mdvMap.config.get("info.poi.size.height")){I["poi"]=new MDVPoint(this.mdvMap.config.get("info.poi.size.width"),this.mdvMap.config.get("info.poi.size.height"))}var V=new MDVCoordinates(b[0].getAttribute("mapName"),parseInt(Y[X].firstChild.getAttribute("x")),parseInt(Y[X].firstChild.getAttribute("y")));var M=this.mdvMap.createMarker(V,0.5,L.src);M.objectId={type:c,desc:U,id:H,omc:P,marker:M};if(M.objectId){M.objectId.attrs=O}if(this.comparator){if(!this.comparator(M.objectId)){continue}}switch(c){case"stop":var Z=null;if(this.mdvMap.config.get("useBubbleForEFAInfo")&&this.mdvMap.config.get("useBubbleForEFAInfo")=="true"){Z=this.mdvMap.createToolTip(I["stop"],"<b>"+U+"</b>");if(this.mdvMap.config.get("useBubbleOverflowForEFAInfo")&&this.mdvMap.config.get("useBubbleOverflowForEFAInfo")=="true"){Z.setOverflow(true)}if(this.mdvMap.config.get("useBubblePinForEFAInfo")&&this.mdvMap.config.get("useBubblePinForEFAInfo")=="true"){Z.setPin(true)}M.setToolTip(Z,false)}else{Z=this.mdvMap.createToolTip("Stop: <b>"+U+"</b>");M.setToolTip(Z,false)}break;case"poi":var Z=null;if(this.mdvMap.config.get("useBubbleForEFAInfo")&&this.mdvMap.config.get("useBubbleForEFAInfo")=="true"){Z=this.mdvMap.createToolTip(I["poi"],"<b>"+U+"</b>");if(this.mdvMap.config.get("useBubbleOverflowForEFAInfo")&&this.mdvMap.config.get("useBubbleOverflowForEFAInfo")=="true"){Z.setOverflow(true)}if(this.mdvMap.config.get("useBubblePinForEFAInfo")&&this.mdvMap.config.get("useBubblePinForEFAInfo")=="true"){Z.setPin(true)}M.setToolTip(Z,false)}else{Z=this.mdvMap.createToolTip("Landmark: <b>"+U+"</b>");M.setToolTip(Z,false)}break}switch(c){case"poi":if(S){for(var T=0;T<this.poi.getMarkers().length;T++){var K=this.poi.getMarkers();if(K[T].objectId.id==M.objectId.id&&K[T].objectId.omc==M.objectId.omc){N=true;break}}if(N){continue}this.poi.addMarker(M,false);F=true}break;default:if(W){var N=false;for(var T=0;T<this.stops.getMarkers().length;T++){var G=this.stops.getMarkers();if(G[T].objectId.id==M.objectId.id){N=true;break}}if(N){continue}this.stops.addMarker(M,false);C=true}break}}if(C){this.stops.update()}if(F){this.poi.update()}this.centre=new MDVCoordinates(this.mdvMap.getCentre().mapName,this.mdvMap.getCentre().x,this.mdvMap.getCentre().y);return true};MDVMapEFAInfo.prototype.fetchPins=function(){if(this.mdvMap.config.get("efaURL")){var E=this.mdvMap.config.get("efaURL");var D=this.mdvMap.getCentre();var G=this.mdvMap.config.getZoomLevel(this.mdvMap.config.getZoomLevelIndex());var B=G.get("showSTOP")=="true"?1:0;var F=G.get("showPOI")=="true"?1:0;var H=this.mdvMap.config.get("language")!=null?this.mdvMap.config.get("language"):"en";var A={language:H,xCenterReal:Math.floor(D.x+0.5),yCenterReal:Math.floor(D.y+0.5),mapName:D.mapName,pinTypePOI:F,pinTypeStop:B,createImage:"0",realHeight:this.mdvMap.viewportRealHeight,realWidth:this.mdvMap.viewportRealWidth,screenWidth:this.mdvMap.viewportWidth,screenHeight:this.mdvMap.viewportHeight,command:"mapData",hideBannerInfo:"1",itdLPxx_mdvMapName:"mdvMap_"+this.mdvMap.getName(),itdLPxx_mdvMap:this.name};var C=mdvLib.ajax({host:E,parameters:A,onComplete:MDVMapEFAInfo_onAjaxComplete})}};MDVMapEFAInfo.prototype.onmousedown=function(A){mdvTimer.remove(this.id);this.id=null;this.lastCentre=this.mdvMap.getCentre().clone();return true};MDVMapEFAInfo.prototype.onmouseup=function(A){if(this.lastCentre&&this.lastCentre.equals(this.mdvMap.getCentre())){this.trigger()}return true};function MDVMapEFAInfo_onAjaxComplete(D){var B=null;if(D&&D.responseXML){B=D.responseXML}else{if(D){B=D}}var A=B.getElementsByTagName("itdLayoutParam");for(var C=0;C<A.length;C++){if(A[C].getAttribute("name")=="mdvMapName"){if(document.mdvMaps[A[C].getAttribute("value")]){document.mdvMaps[A[C].getAttribute("value")].events.triggerEvent(MDVEvent_AJAX_CALLBACK,"MapEFAInfo",B)}return }}}function MDVMapEFATrips(A){this.mdvMap=A;this.name="MDVMapEFATrips";this.layer=null;this.options=[];this.wizardJobID=null;this.wizardIndex=null;this.wizardScreenPlay=new Array();this.response=null;this.responseJson=null;this.tripParams={};this.polylines=new Array();this.zoomLevel=null;this.doBeautify=true;this.imgs=new Array();this.imgs["stop"]=new Image();this.imgs["1"]=new Image();this.imgs["1_follow"]=new Image();this.imgs["2"]=new Image();this.imgs["2_follow"]=new Image();this.imgs["3"]=new Image();this.imgs["3_follow"]=new Image();this.imgs["4"]=new Image();this.imgs["4_follow"]=new Image();this.imgs["5"]=new Image();this.imgs["5_follow"]=new Image();this.imgs["6"]=new Image();this.imgs["6_follow"]=new Image();this.imgs["7"]=new Image();this.imgs["7_follow"]=new Image();this.imgs["8"]=new Image();this.imgs["8_follow"]=new Image();this.imgs["9"]=new Image();this.imgs["9_follow"]=new Image();this.imgs["10"]=new Image();this.imgs["10_follow"]=new Image();this.imgs["11"]=new Image();this.imgs["11_follow"]=new Image();this.imgs["12"]=new Image();this.imgs["12_follow"]=new Image();this.imgs["13"]=new Image();this.imgs["13_follow"]=new Image();this.imgs["99"]=new Image();this.imgs["99_follow"]=new Image();this.imgs["100"]=new Image();this.imgs["100_follow"]=new Image();this.imgs["100_arrival"]=new Image();this.imgs["100_departure"]=new Image();this.imgs["101"]=new Image();this.imgs["101_follow"]=new Image();this.imgs["101_arrival"]=new Image();this.imgs["101_departure"]=new Image();this.imgs["102"]=new Image();this.imgs["102_follow"]=new Image();this.imgs["102_arrival"]=new Image();this.imgs["102_departure"]=new Image();this.imgs["103"]=new Image();this.imgs["103_follow"]=new Image();this.imgs["103_arrival"]=new Image();this.imgs["103_departure"]=new Image();this.imgs["104"]=new Image();this.imgs["104_follow"]=new Image();this.imgs["104_arrival"]=new Image();this.imgs["104_departure"]=new Image();this.imgs["105"]=new Image();this.imgs["105_follow"]=new Image();this.imgs["105_arrival"]=new Image();this.imgs["105_departure"]=new Image();this.imgs["106"]=new Image();this.imgs["106_follow"]=new Image();this.imgs["106_arrival"]=new Image();this.imgs["106_departure"]=new Image();this.imgs["107"]=new Image();this.imgs["107_follow"]=new Image();this.imgs["107_arrival"]=new Image();this.imgs["107_departure"]=new Image();this.imgs["poi"]=new Image();for(var C in MDVGadgetBase.prototype){if(!MDVMapEFATrips.prototype[C]){MDVMapEFATrips.prototype[C]=MDVGadgetBase.prototype[C]}}if(arguments.length==2){for(var B in arguments[1]){this.options[B]=arguments[1][B]}if(this.options["getMarker"]){this.getMarker=this.options["getMarker"]}}this.mdvMap.registerGadget(this);this.mdvMap.events.registerEvent(MDVEvent_MAP_INITIALISED,this,this.execute);this.mdvMap.events.registerEvent(MDVEvent_MAP_INITIALISED,this,this.update);this.mdvMap.events.registerEvent(MDVEvent_AJAX_CALLBACK,this,this.processTrip)}MDVMapEFATrips.prototype.prefetchImgs=function(){var A="images/";if(this.mdvMap.config.get("imagePath")){A=this.mdvMap.config.get("imagePath")}this.imgs["stop"].src=A+"stop.gif";this.imgs["1"].src=A+"mot1.gif";this.imgs["1_follow"].src=A+"mot1_follow.gif";this.imgs["2"].src=A+"mot2.gif";this.imgs["2_follow"].src=A+"mot2_follow.gif";this.imgs["3"].src=A+"mot3.gif";this.imgs["3_follow"].src=A+"mot3_follow.gif";this.imgs["4"].src=A+"mot4.gif";this.imgs["4_follow"].src=A+"mot4_follow.gif";this.imgs["5"].src=A+"mot5.gif";this.imgs["5_follow"].src=A+"mot5_follow.gif";this.imgs["6"].src=A+"mot6.gif";this.imgs["6_follow"].src=A+"mot6_follow.gif";this.imgs["7"].src=A+"mot7.gif";this.imgs["7_follow"].src=A+"mot7_follow.gif";this.imgs["8"].src=A+"mot8.gif";this.imgs["8_follow"].src=A+"mot8_follow.gif";this.imgs["9"].src=A+"mot9.gif";this.imgs["9_follow"].src=A+"mot9_follow.gif";this.imgs["10"].src=A+"mot10.gif";this.imgs["10_follow"].src=A+"mot10_follow.gif";this.imgs["11"].src=A+"mot11.gif";this.imgs["11_follow"].src=A+"mot11_follow.gif";this.imgs["12"].src=A+"mot12.gif";this.imgs["12_follow"].src=A+"mot12_follow.gif";this.imgs["13"].src=A+"mot13.gif";this.imgs["13_follow"].src=A+"mot13_follow.gif";this.imgs["99"].src=A+"mot99.gif";this.imgs["99_follow"].src=A+"mot99_follow.gif";this.imgs["100"].src=A+"mot100.gif";this.imgs["100_follow"].src=A+"mot100_follow.gif";this.imgs["100_arrival"].src=A+"mot100_arrival.gif";this.imgs["100_departure"].src=A+"mot100.gif";this.imgs["101"].src=A+"mot101.gif";this.imgs["101_follow"].src=A+"mot101_follow.gif";this.imgs["101_arrival"].src=A+"mot101_arrival.gif";this.imgs["101_departure"].src=A+"mot101_departure.gif";this.imgs["102"].src=A+"mot102.gif";this.imgs["102_follow"].src=A+"mot102_follow.gif";this.imgs["102_arrival"].src=A+"mot102_arrival.gif";this.imgs["102_departure"].src=A+"mot102_departure.gif";this.imgs["103"].src=A+"mot103.gif";this.imgs["103_follow"].src=A+"mot103_follow.gif";this.imgs["103_arrival"].src=A+"mot103_arrival.gif";this.imgs["103_departure"].src=A+"mot103_departure.gif";this.imgs["104"].src=A+"mot104.gif";this.imgs["104_follow"].src=A+"mot104_follow.gif";this.imgs["104_arrival"].src=A+"mot104_arrival.gif";this.imgs["104_departure"].src=A+"mot104_departure.gif";this.imgs["105"].src=A+"mot105.gif";this.imgs["105_follow"].src=A+"mot105_follow.gif";this.imgs["105_arrival"].src=A+"mot105_arrival.gif";this.imgs["105_departure"].src=A+"mot105_departure.gif";this.imgs["106"].src=A+"mot106.gif";this.imgs["106_follow"].src=A+"mot106_follow.gif";this.imgs["106_arrival"].src=A+"mot106_arrival.gif";this.imgs["106_departure"].src=A+"mot106_departure.gif";this.imgs["107"].src=A+"mot107.gif";this.imgs["107_follow"].src=A+"mot107_follow.gif";this.imgs["107_arrival"].src=A+"mot107_arrival.gif";this.imgs["107_departure"].src=A+"mot107_departure.gif";this.imgs["poi"].src=A+"pin.gif"};MDVMapEFATrips.prototype.onmousedown=function(B){mdvTimer.remove(this.wizardJobID);this.mdvMap.cancelMoveBySeq();this.wizardJobID=null;for(var A=0;A<this.wizardScreenPlay.length;A++){if(this.wizardScreenPlay[A].type=="marker"&&this.wizardScreenPlay[A].object.toolTip){this.wizardScreenPlay[A].object.toolTip.hide()}}return true};MDVMapEFATrips.prototype.execute=function(){if(this.layer==null){this.prefetchImgs();this.layer=this.mdvMap.createLayer("efa_trip");this.mdvMap.addLayer(this.layer)}};MDVMapEFATrips.prototype.clear=function(){if(this.mdvMap){mdvTimer.remove(this.wizardJobID);this.mdvMap.cancelMoveBySeq();this.wizardJobID=null;this.mdvMap.hideToolTips()}this.layer.removeAll();while(this.polylines.pop()){}while(this.wizardScreenPlay.pop()){}this.wizardJobID=null;this.wizardIndex=null};MDVMapEFATrips.prototype.loadTrip=function(J,H,C){if(!this.mdvMap.config.get("tripURL")){this.mdvMap.events.triggerEvent(MDVEvent_ERROR,"No tripURL specified.");return false}this.tripParams={sessionId:J,requestId:H,tripIndex:C};if(arguments.length==4){this.doBeautify=arguments[3]}this.tripParams.reductionList="";if(this.options["reductionList"]){for(var A=0;A<this.options["reductionList"].length;A++){if(this.options["reductionList"][A].maxScale){this.tripParams.reductionList+=this.options["reductionList"][A].epsilon+":"}}}var F=this.mdvMap.config.get("language")!=null?this.mdvMap.config.get("language"):"en";var K=this.mdvMap.config.get("tripURL");var D=this.mdvMap.config.get("mapName");var E=("tripSelector"+C);var B=this.mdvMap.config.get("trips.useJsonEx");var I={};if(B=="true"){I={language:F,sessionID:J,requestID:H,coordListOutputFormat:"STRING",command:"tripCoordSeq:"+this.tripParams.tripIndex,output:"JSON",itdLPxx_mdvMapName:this.mdvMap.getName(),filterEpsilon:this.tripParams.reductionList}}else{I={language:F,sessionID:J,requestID:H,coordListOutputFormat:"STRING",command:"formatToXSLT",tripSelection:"on",coordOutputFormat:D,itdLPxx_mdvMap:"MDVMapEFATrips",itdLPxx_mdvMapName:this.mdvMap.getName(),showItdPathCoordinates:"1",filterEpsilon:this.tripParams.reductionList,itdLPxx_hideNotes:"1"};I[E]="on"}var G=mdvLib.ajax({host:K,parameters:I,onComplete:MDVMapEFATrips_onAjaxComplete});return true};MDVMapEFATrips.prototype.getReductionList=function(F){var E=[];if(this.options["reductionList"]&&F.reductionList){for(var C=0;C<this.options["reductionList"].length;C++){var H=parseFloat(this.options["reductionList"][C].epsilon);var A=0;var D=F.reductionList.epsilon?F.reductionList:F.reductionList[A];do{var G=parseFloat(D.epsilon);if(G==H){this.options["reductionList"][C].mask=D.mask;var B={maxScale:this.options["reductionList"][C].maxScale,epsilon:G,mask:this.options["reductionList"][C].mask.split(" ")};E.push(B);break}A++}while(D=F.reductionList[A])}}return E};function MDVMapEFATrips_ScaleSort(B,A){return B.maxScale-A.maxScale}MDVMapEFATrips.prototype.processTrip=function(id,gName,efa){if(gName!="MDVMapEFATrips"){return false}var hostUrl,_params,createPath,process,alignment=0.5,leg=null;var jsonServerURL=this.mdvMap.config.get("trips.jsonServerURL");if(this.options["alignment"]){alignment=this.options["alignment"]}this.response=efa;this.clear();createPath=function(mode){var l=0,tripIsArr;var _response=mode==="lite"?this.response:this.responseJson;while(leg){if(mode==="json"){tripIsArr=mdvLib.typeOf(this.response.trips.trip.legs)==="array";leg.points=tripIsArr?this.response.trips.trip.legs[l].points:this.response.trips.trip.legs.leg.points;leg.mode=tripIsArr?this.response.trips.trip.legs[l].mode:this.response.trips.trip.legs.leg.mode}var type=leg.mode.type;var line="";if(leg.mode.diva){line=leg.mode.diva.line}var points=leg.points;var colour=this.getLegColour(type,line);var opacity="0.5";var weight=3;var p=null;var list=this.getReductionList(leg);list.sort(MDVMapEFATrips_ScaleSort);if(this.mdvMap.config.get("trips.polyline.opacity")){opacity=this.mdvMap.config.get("trips.polyline.opacity")}if(this.mdvMap.config.get("trips.polyline.weight")){weight=this.mdvMap.config.get("trips.polyline.weight")}if(!leg.path){if(leg.turnInst&&leg.turnInst.length>0){var pathStr="";for(var i=0;i<leg.turnInst.length;i++){for(var p in leg.turnInst[i]){if(p==="coords"){pathStr+=leg.turnInst[i][p]+" "}}}pathStr=pathStr.substring(0,pathStr.length-1)}else{var pathStr="";for(var i=0;i<leg.points.length;i++){if(leg.points[i].ref){for(var p in leg.points[i].ref){if(p==="coords"){pathStr+=leg.points[i].ref[p]+" "}}}}pathStr=pathStr.substring(0,pathStr.length-1)}}else{var pathStr=leg.path.replace(/\.00000/gi,"")}if(list.length>0){p=this.mdvMap.createPolyline(pathStr,{reductionList:list});this.polylines.push(p)}else{p=this.mdvMap.createPolyline(pathStr);this.polylines.push(p)}p.add("colour",colour);p.add("opacity",opacity);p.add("weight",weight);if(!p.markers["departure"]){var coords=p.getAllCoords();var m=this.getMarker(type,"departure",coords[0],alignment,l);p.markers["departure"]=m;p.markers["departure"].mode=type;p.markers["departure"].point=points[0]}if(!p.markers["arrival"]){var coords=p.getAllCoords();var m=this.getMarker(type,"arrival",coords[coords.length-1],alignment,l);p.markers["arrival"]=m;p.markers["arrival"].mode=type;p.markers["arrival"].point=points[1]}p.leg=leg;this.layer.addPolyline(p,false);if(leg.interchange){var next=_response.trips.trip.legs[(l+1)];var nextPoints=mode==="lite"?next.points:this.response.trips.trip.legs[l+1].points;var ic=this.mdvMap.createPolyline(leg.interchange.path);colour=this.getLegColour(99);ic.add("colour",colour);ic.add("opacity",opacity);ic.add("weight",weight);ic.leg=leg;ic.isInterchange=true;var m=this.getMarker(99,"departure",coords[coords.length-1],alignment,l);ic.markers["departure"]=m;ic.markers["departure"].mode=99;ic.markers["departure"].point=points[1];var nextCoords=next.path.split(" ");nextCoords=nextCoords[0].split(",");var c=new MDVCoordinates(coords[coords.length-1].mapName,nextCoords[0],nextCoords[1]);m=this.getMarker(99,"arrival",c,alignment,l);ic.markers["arrival"]=m;ic.markers["arrival"].mode=99;ic.markers["arrival"].point=nextPoints[0];this.layer.addPolyline(ic,false);this.polylines.push(ic)}l++;leg=_response.trips.trip.legs[l]}}.bind(this);process=function(mode){createPath(mode);if(this.doBeautify){this.beautify()}this.processMarkers();this.mdvMap.update();this.processPolylines()}.bind(this);if(this.mdvMap.config.get("trips.useJsonForPath")!=="true"){if(this.response.trips.trip.legs.leg&&!this.response.trips.trip.legs.length){leg=this.response.trips.trip.legs.leg}else{if(this.response.trips.trip.legs.length){leg=this.response.trips.trip.legs[0]}}process("lite");return true}if(typeof jsonServerURL!=="undefined"){hostUrl=jsonServerURL}else{hostUrl=/^\/(?:[\w\-%]+\/)*(\w+)\??/.exec(window.location.pathname);hostUrl=hostUrl&&hostUrl[1]}_params={sessionID:this.tripParams.sessionId,requestID:this.tripParams.requestId,command:"tripCoordSeq:"+this.tripParams.tripIndex,filterEpsilon:this.tripParams.reductionList,output:"JSON"};if(typeof hostUrl==="string"){mdvLib.ajax({host:hostUrl,parameters:_params,onComplete:function(r){var _response=r.responseText||r;_response=_response.replace(/\.00000/gi,"");eval("this.responseJson = "+_response+";");if(!this.responseJson){return false}if(this.responseJson.trips.trip.legs.leg&&!this.responseJson.trips.trip.legs.length){leg=this.responseJson.trips.trip.legs.leg}else{if(this.responseJson.trips.trip.legs.length){leg=this.responseJson.trips.trip.legs[0]}}process("json")}.bind(this)})}else{}};MDVMapEFATrips.prototype.getMarker=function(B,D,C,G,F){var E="";if(B>=100&&this.imgs[B+"_"+D]&&this.imgs[B+"_"+D].complete){E=this.imgs[B+"_"+D]}else{if(this.imgs[B]){E=this.imgs[B]}else{E=this.imgs["stop"]}}var A=this.mdvMap.createMarker(C,G,E.src);return A};MDVMapEFATrips.prototype.updateWizard=function(){var A=this.polylines[0];for(var B=this.wizardScreenPlay.length;B>0;B--){this.wizardScreenPlay.pop()}if(A.markers["departure"]&&A.markers["departure"].img&&A.markers["departure"].img.toolTip){this.wizardScreenPlay.push({object:A.markers["departure"],type:"marker",state:true,timeout:2200});this.wizardScreenPlay.push({object:A.markers["departure"],type:"marker",state:false,timeout:50});this.wizardScreenPlay.push({object:A,type:"polyline",state:true,timeout:10})}for(var C=1;C<this.polylines.length;C++){if(A.isInterchange==null&&A.markers["arrival"]&&A.markers["arrival"].img&&A.markers["arrival"].img.toolTip){this.wizardScreenPlay.push({object:A.markers["arrival"],type:"marker",state:true,timeout:2200});this.wizardScreenPlay.push({object:A.markers["arrival"],type:"marker",state:false,timeout:50});var D=""}A=this.polylines[C];if(A.isInterchange==null&&A.markers["departure"]&&A.markers["departure"].img&&A.markers["departure"].img.toolTip){this.wizardScreenPlay.push({object:A.markers["departure"],type:"marker",state:true,timeout:2200});this.wizardScreenPlay.push({object:A.markers["departure"],type:"marker",state:false,timeout:50});var D=""}this.wizardScreenPlay.push({object:A,type:"polyline",state:true,timeout:10})}if(A.isInterchange==null&&A.markers["arrival"]&&A.markers["arrival"].img&&A.markers["arrival"].img.toolTip){this.wizardScreenPlay.push({object:A.markers["arrival"],type:"marker",state:true,timeout:2200});this.wizardScreenPlay.push({object:A.markers["arrival"],type:"marker",state:false,timeout:50});var D=""}return true};MDVMapEFATrips.prototype.beautify=function(){var L=this.mdvMap.getPolylineCoords();var E=L[0];var D=L[1];E.sort(MDVMap_NumSort);D.sort(MDVMap_NumSort);var K=E[E.length-1]-E[0];var H=D[D.length-1]-D[0];var T=parseInt(E[0])+Math.floor(0.5+K/2);var Q=parseInt(D[0])+Math.floor(0.5+H/2);var J=new MDVCoordinates(this.mdvMap.config.get("mapName"),T,Q);var A=0;var O=this.mdvMap.getViewportExtends();var P=this.mdvMap.config.getZoomLevels();for(var M=P.length-1;M>=0;M--){var C=P[M];var R=false;var B=false;var N=new MDVPoint(O.width/parseInt(C.get("tileSizeX")),O.height/parseInt(C.get("tileSizeY")));var S=new MDVPoint(C.get("numberOfTilesX"),C.get("numberOfTilesY"));var I=new MDVPoint(C.get("realWidth"),C.get("realHeight"));var F=new MDVPoint(Math.floor(0.5+I.x/S.x),Math.floor(0.5+I.y/S.y));var G=new MDVPoint(F.x*N.x,F.y*N.y);if(G.x>(K*1.15)&&!R){A=M;R=true}if(G.y>(H*1.15)&&!B){A=M;B=true}if(R&&B){break}}this.mdvMap.setCentre(J);this.mdvMap.setZoomLevel(A)};MDVMapEFATrips.prototype.processMarkers=function(){var H=0;var F=0;for(var B=0;B<this.response.parameters.length;B++){if(this.response.parameters[B].name=="sessionID"){H=this.response.parameters[B].value}if(this.response.parameters[B].name=="requestID"){F=this.response.parameters[B].value}}var D=new Array();for(var B=0;B<this.polylines.length;B++){var G=this.polylines[B];D.push([B,"departure",G.markers["departure"]]);D.push([B,"arrival",G.markers["arrival"]])}var A="";var J=new MDVPoint(220,124);if(this.mdvMap.config.get("trips.marker.size.width")&&this.mdvMap.config.get("trips.marker.size.height")){J=new MDVPoint(this.mdvMap.config.get("trips.marker.size.width"),this.mdvMap.config.get("trips.marker.size.height"))}for(var C=D.length-1;C>=0;C--){var E=D[C];var I="";if(E[2].point&&E[2].point.desc){I=E[2].point.desc}else{if(E[2].point&&E[2].point.name){I=E[2].point.name}}if(this.mdvMap.config.get("useBubbleForEFATrips")&&this.mdvMap.config.get("useBubbleForEFATrips")=="false"){E[2].setToolTip(this.mdvMap.createToolTip(I))}else{E[2].setToolTip(this.mdvMap.createToolTip(J,I))}this.layer.addMarker(E[2],false)}};MDVMapEFATrips.prototype.update=function(C,E,I){if(this.polylines.length<=0||this.zoomLevel==I.config.getZoomLevelIndex()){return false}var N=this.options["skipBoundaryCheck"]&&this.options["skipBoundaryCheck"]==true;this.zoomLevel=I.config.getZoomLevelIndex();for(var D=0;D<this.polylines.length;D++){if(this.polylines[D]&&this.polylines[D].markers["departure"]){this.polylines[D].markers["departure"].visible=false}if(this.polylines[D]&&this.polylines[D].markers["arrival"]){this.polylines[D].markers["arrival"].visible=false}for(var M=0;M<this.polylines[D].arrows.length;M++){this.layer.removePolyline(this.polylines[D].arrows[M]);if(this.polylines[D].arrows[M]){this.polylines[D].arrows[M].destroy()}}for(var M=0;M<this.polylines[D].directions.length;M++){this.layer.removeMarker(this.polylines[D].directions[M])}var B=25000;if(this.mdvMap.config.get("trips.polyline.arrows.maxScale")){B=parseInt(this.mdvMap.config.get("trips.polyline.arrows.maxScale"))}var O=this.mdvMap.config.getZoomLevel(this.zoomLevel);var P=O.getScale()<=B;if(this.mdvMap.config.get("useArrowsForEFATrips")&&this.mdvMap.config.get("useArrowsForEFATrips")=="true"&&P){this.polylines[D].arrows=this.polylines[D].getArrows();for(var M=0;M<this.polylines[D].arrows.length;M++){var G=M==this.polylines[D].arrows.length-1?true:false;this.layer.addPolyline(this.polylines[D].arrows[M],G)}}else{if(this.mdvMap.config.get("useDirectionsForEFATrips")&&this.mdvMap.config.get("useDirectionsForEFATrips")=="true"&&P){var A=this.polylines[D].getDirections();for(var K=0;K<A.length;K++){var G=K==A.length-1?true:false;this.layer.addMarker(A[K],G)}this.polylines[D].directions=A}}}if(this.polylines[0].markers["departure"]){this.polylines[0].markers["departure"].setVisibility(true)}if(this.polylines[this.polylines.length-1].markers["arrival"]){this.polylines[this.polylines.length-1].markers["arrival"].setVisibility(true)}for(var H=this.polylines.length-1;H>0;H--){var J=this.polylines[H];var F=this.polylines[H-1];if(!J||!F){continue}var L=[[H,"departure",J.markers["departure"]],[H,"arrival",F.markers["arrival"]]];L.sort(MDVMapEFATrips_PrioritySort);L[0][2].setVisibility(true);if(!L[1][2].intersects(L[0][2])||!L[0][2].isVisible()||N){L[1][2].setVisibility(true)}else{L[1][2].setVisibility(false)}}this.updateWizard();return true};MDVMapEFATrips.prototype.processPolylines=function(){for(var A=0;A<this.polylines.length;A++){var B=this.polylines[A];var E=B.leg.mode.desc;if(B.leg.interchange&&B.isInterchange){E=B.leg.interchange.desc}else{if(B.leg.mode.desc==""){E=B.leg.mode.type}}var C=new MDVPoint(220,150);if(this.mdvMap.config.get("trips.polyline.size.width")&&this.mdvMap.config.get("trips.polyline.size.height")){C=new MDVPoint(this.mdvMap.config.get("trips.polyline.size.width"),this.mdvMap.config.get("trips.polyline.size.height"))}if(this.mdvMap.config.get("useCanvasRenderer")!="true"){var D=null;if(this.mdvMap.config.get("useBubbleForEFATrips")&&this.mdvMap.config.get("useBubbleForEFATrips")=="false"){D=this.mdvMap.createToolTip(E)}else{D=this.mdvMap.createToolTip(C,E)}B.setToolTip(D,false)}B.element.mdvMap=this.mdvMap}};MDVMapEFATrips.prototype.getLegColour=function(B,A){if(this.mdvMap.config.get("motColour_"+B+"_"+A)){return this.mdvMap.config.get("motColour_"+B+"_"+A)}else{if(this.mdvMap.config.get("motColour_"+B)){return this.mdvMap.config.get("motColour_"+B)}}return"#FF0000"};MDVMapEFATrips.prototype.launchWizard=function(B){mdvTimer.remove(this.wizardJobID);this.mdvMap.stepPx=4;this.mdvMap.stepTime=40;this.mdvMap.cancelMoveBySeq();this.wizardJobID=null;var A=this.mdvMap.config.getZoomLevel(B);if(A){if(A.get("trace.step.px")){this.mdvMap.stepPx=parseInt(A.get("trace.step.px"))}if(A.get("trace.step.time")){this.mdvMap.stepTime=parseInt(A.get("trace.step.time"))}}if(this.polylines.length>0){if(B>=0){this.mdvMap.setZoomLevel(B)}this.mdvMap.setCentre(this.polylines[0].getAllCoords()[0].clone());this.mdvMap.update()}this.wizardIndex=0;this.wizardJobID=mdvTimer.add(1,this,this.wizardRun,[null,null,null])};MDVMapEFATrips.prototype.wizardRun=function(F,E,C){var A=this.wizardScreenPlay[this.wizardIndex];this.wizardIndex++;if(F==MDVEvent_ROUTE_TRACE_FINISHED){this.mdvMap.events.deregisterEvent(MDVEvent_ROUTE_TRACE_FINISHED,this,this.wizardRun)}if(A){switch(A.type){case"marker":if(A.state){A.object.toolTip.display()}else{A.object.toolTip.hide()}this.wizardJobID=mdvTimer.add(A.timeout,this,this.wizardRun,[null,null,null]);break;default:this.mdvMap.events.registerEvent(MDVEvent_ROUTE_TRACE_FINISHED,this,this.wizardRun);var B=A.object.getAllCoords();var D=null;if(A.object&&A.object.isInterchange){D=this.imgs["99_follow"].src}else{if(A.object.leg.mode.type&&this.imgs[A.object.leg.mode.type+"_follow"]){D=this.imgs[A.object.leg.mode.type+"_follow"].src}}this.mdvMap.wizardSetMotIcon(D);this.wizardJobID=mdvTimer.add(A.timeout,this,this.wizardMoveBySeq,[B]);break}}};MDVMapEFATrips.prototype.wizardMoveBySeq=function(B,A){this.mdvMap.moveBySeq(B,A)};function MDVMapEFATrips_onAjaxComplete(request){var efa;var json=null;var mdvMapName="";if(request&&request.responseText){json=request.responseText}else{if(request){json=request}}eval("efa = "+json+";");if(efa&&efa.parameters){for(var i=0;i<efa.parameters.length;i++){if(efa.parameters[i].name=="mdvMapName"){mdvMapName=efa.parameters[i].value;break}}}if(document.mdvMaps["mdvMap_"+mdvMapName]){document.mdvMaps["mdvMap_"+mdvMapName].events.triggerEvent(MDVEvent_AJAX_CALLBACK,"MDVMapEFATrips",efa)}}function MDVMapEFATrips_PrioritySort(B,A){return MDVMapEFATrips_GetPrority(B)-MDVMapEFATrips_GetPrority(A)}function MDVMapEFATrips_GetPrority(A){if(A[1]=="departure"&&A[2].mode>0&&A[2].mode<96){return 10}else{if(A[1]=="arrival"&&A[2].mode>0&&A[2].mode<96){return 20}else{if(A[1]=="departure"&&A[2].mode>100){return 30}else{if(A[1]=="arrival"&&A[2].mode>100){return 40}else{if(A[1]=="departure"&&A[2].mode==100){return 50}else{if(A[1]=="arrival"&&A[2].mode==100){return 60}else{return 1000}}}}}}}function MDVMapContextMenu(A,B){if(!A){return }this.name="MapContextMenu";this.mdvMap=A;this.mdvMap.registerGadget(this);this.mdvMap.events.registerEvent(MDVEvent_ZOOM_CHANGED,this,this.zoomLevelChange);this.contextMenu=B;for(var C=0;C<this.contextMenu.div.childNodes.length;C++){if(this.contextMenu.div.childNodes[C]){this.contextMenu.div.childNodes[C].mdvMap=this.mdvMap}}var D=false;document.body.contextMenu=this;this.contextMenu.div.onmousedown=function(){D=true};document.body.onmousedown=function(F){F=F?F:window.event;if(!D){this.contextMenu.contextMenu.div.style.display="none"}D=false};this.contextMenu.div.oncontextmenu=function(){return false};for(var E in MDVGadgetBase.prototype){if(!MDVMapContextMenu.prototype[E]){MDVMapContextMenu.prototype[E]=MDVGadgetBase.prototype[E]}}}MDVMapContextMenu.prototype.destroy=function(){if(this.mdvMap){this.mdvMap=null}for(var A=0;A<this.contextMenu.div.childNodes.length;A++){if(this.contextMenu.div.childNodes[A]&&this.contextMenu.div.childNodes[A].mdvMap){this.contextMenu.div.childNodes[A].mdvMap=null}}this.ondblclick=null;this.onkeypress=null;this.onmousedown=null;this.onmousemove=null;this.onmouseout=null;this.onmouseover=null;this.onmouseup=null;this.onmousewheel=null;this.oncontextmenu=null};MDVMapContextMenu.prototype.oncontextmenu=function(H){H=H?H:window.event;var B=document.body.scrollTop?document.body.scrollTop:document.documentElement.scrollTop;var E=document.body.scrollLeft?document.body.scrollLeft:document.documentElement.scrollLeft;var L=H.clientX+E;var J=H.clientY+B;var D=H.pageX||(H.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));var C=H.pageY||(H.clientY+(document.documentElement.scrollTop||document.body.scrollTop));var N=0;var I=0;var F=this.mdvMap.viewport;while(F){N+=F.offsetLeft;I+=F.offsetTop;F=F.offsetParent}D=D-N-3;C=C-I-3;if(this.mdvMap.config.get("contextMenu.size.width")&&this.mdvMap.config.get("contextMenu.size.height")){var A=parseInt(this.mdvMap.config.get("contextMenu.size.width"));var M=parseInt(this.mdvMap.config.get("contextMenu.size.height"));if(C+M>this.mdvMap.viewport.offsetHeight&&D+A>this.mdvMap.viewport.offsetWidth){L=L-A;J=J-M}else{if(D+A>this.mdvMap.viewport.offsetWidth){L=L-A}else{if(C+M>this.mdvMap.viewport.offsetHeight){J=J-M}}}this.contextMenu.div.style.width=A+"px";this.contextMenu.div.style.height=M+"px"}this.contextMenu.div.style.display="none";this.contextMenu.div.style.left=L+"px";this.contextMenu.div.style.top=J+"px";this.contextMenu.div.style.display="block";var K=new MDVPoint(D,C);var G=this.mdvMap.getCoordinates(K);this.mdvMap.events.triggerEvent(MDVEvent_CONTEXT_MENU,true,G);return false};MDVMapContextMenu.prototype.hideContextMenu=function(){this.contextMenu.div.style.display="none";this.mdvMap.events.triggerEvent(MDVEvent_CONTEXT_MENU,false,null)};MDVMapContextMenu.prototype.onmousedown=function(A){A=A?A:window.event;if(A==null||A.button!=2){this.hideContextMenu()}this.stopEvent(A);return true};MDVMapContextMenu.prototype.zoomLevelChange=function(C,A,B){this.onmousedown(null)};function MDVMapMenu(D){this.menuItems=D;var F=document.createElement("div");F.className="mapContextMenu";document.body.appendChild(F);F.style.cursor="default";for(var C=0;C<this.menuItems.length;C++){if(this.menuItems[C].func){var E=document.createElement("div");E.className="mapContextMenuItem";E.onmouseover=function(){this.className="mapContextMenuItem_active";F.style.cursor="pointer"};E.onmouseout=function(){this.className="mapContextMenuItem";F.style.cursor="default"};E.onclick=this.menuItems[C].func;E.onmouseup=A;var B=document.createTextNode(" "+this.menuItems[C].description+" ");E.appendChild(B);F.appendChild(E)}else{var E=document.createElement("hr");F.appendChild(E)}}function A(){F.style.display="none"}this.div=F}function MDVMapMenuItem(B,A){this.description=B;if(A){this.func=A}}function MDVMapControl(A){if(!A){return }this.name="MapControl";this.mdvMap=A;this.origin=null;this.zoomLevel=null;this.images=new Array();this.images["top_normal"]=new Image();this.images["top_hover"]=new Image();this.images["left_normal"]=new Image();this.images["left_hover"]=new Image();this.images["centre_normal"]=new Image();this.images["centre_hover"]=new Image();this.images["right_normal"]=new Image();this.images["right_hover"]=new Image();this.images["bottom_normal"]=new Image();this.images["bottom_hover"]=new Image();this.images["zoomIn_normal"]=new Image();this.images["zoomIn_hover"]=new Image();this.images["zoomOut_normal"]=new Image();this.images["zoomOut_hover"]=new Image();this.images["zoomLevel_normal"]=new Image();this.images["zoomLevel_hover"]=new Image();this.images["zoomLevel_active"]=new Image();this.images["transparent"]=new Image();this.images["spacer"]=new Image();this.text=new Array();this.text["goNorth"]="Go north";this.text["goWest"]="Go west";this.text["goEast"]="Go east";this.text["goSouth"]="Go south";this.text["lastResult"]="Last result";this.text["zoomIn"]="Zoom in";this.text["zoomOut"]="Zoom out";if(arguments.length==2&&arguments[1]){this.text=arguments[1]}this.mapControl=null;this.arrowContainer=null;this.zoomContainer=null;this.mdvMap.registerGadget(this);for(var B in MDVGadgetBase.prototype){if(!MDVMapControl.prototype[B]){MDVMapControl.prototype[B]=MDVGadgetBase.prototype[B]}}this.mdvMap.events.registerEvent(MDVEvent_INITIALISED,this,this.execute);this.mdvMap.events.registerEvent(MDVEvent_ZOOM_CHANGED,this,this.update)}MDVMapControl.prototype.preloadImgs=function(){var A="images/";if(this.mdvMap.config.get("imagePath")){A=this.mdvMap.config.get("imagePath")}var B=A+"MDVMapControl/";if(this.mdvMap.config.get("imagePath.mapControl")){B=this.mdvMap.config.get("imagePath.mapControl")}this.images["top_normal"].src=B+"topNormal.gif";this.images["top_normal"].alt=this.text["goNorth"];this.images["top_normal"].title=this.images["top_normal"].alt;this.images["top_hover"].src=B+"topHover.gif";this.images["top_hover"].alt=this.images["top_normal"].alt;this.images["top_hover"].title=this.images["top_normal"].alt;this.images["left_normal"].src=B+"leftNormal.gif";this.images["left_normal"].alt=this.text["goWest"];this.images["left_normal"].title=this.images["left_normal"].alt;this.images["left_hover"].src=B+"leftHover.gif";this.images["left_hover"].alt=this.images["left_normal"].alt;this.images["left_hover"].title=this.images["left_normal"].alt;this.images["centre_normal"].src=B+"centreNormal.gif";this.images["centre_normal"].alt=this.text["lastResult"];this.images["centre_normal"].title=this.images["centre_normal"].alt;this.images["centre_hover"].src=B+"centreHover.gif";this.images["centre_hover"].alt=this.images["centre_normal"].alt;this.images["centre_hover"].title=this.images["centre_normal"].alt;this.images["right_normal"].src=B+"rightNormal.gif";this.images["right_normal"].alt=this.text["goEast"];this.images["right_normal"].title=this.images["right_normal"].alt;this.images["right_hover"].src=B+"rightHover.gif";this.images["right_hover"].alt=this.images["right_normal"].alt;this.images["right_hover"].title=this.images["right_normal"].alt;this.images["bottom_normal"].src=B+"bottomNormal.gif";this.images["bottom_normal"].alt=this.text["goSouth"];this.images["bottom_normal"].title=this.images["bottom_normal"].alt;this.images["bottom_hover"].src=B+"bottomHover.gif";this.images["bottom_hover"].alt=this.images["bottom_normal"].alt;this.images["bottom_hover"].title=this.images["bottom_normal"].alt;this.images["zoomIn_normal"].src=B+"zoomInNormal.gif";this.images["zoomIn_normal"].alt=this.text["zoomIn"];this.images["zoomIn_normal"].title=this.images["zoomIn_normal"].alt;this.images["zoomIn_hover"].src=B+"zoomInHover.gif";this.images["zoomIn_hover"].alt=this.images["zoomIn_normal"].alt;this.images["zoomIn_hover"].title=this.images["zoomIn_normal"].alt;this.images["zoomOut_normal"].src=B+"zoomOutNormal.gif";this.images["zoomOut_normal"].alt=this.text["zoomOut"];this.images["zoomOut_normal"].title=this.images["zoomOut_normal"].alt;this.images["zoomOut_hover"].src=B+"zoomOutHover.gif";this.images["zoomOut_hover"].alt=this.images["zoomOut_normal"].alt;this.images["zoomOut_hover"].title=this.images["zoomOut_normal"].alt;this.images["zoomLevel_normal"].src=B+"zoomLevelNormal.gif";this.images["zoomLevel_active"].src=B+"zoomLevelActive.gif";this.images["zoomLevel_hover"].src=B+"zoomLevelHover.gif";this.images["transparent"].src=B+"transparent.gif";this.images["spacer"].src=B+"spacer.gif"};MDVMapControl.prototype.createDiv=function(){var A=document.createElement("div");return A};MDVMapControl.prototype.execute=function(){this.preloadImgs();this.origin=new MDVCoordinates(this.mdvMap.config.get("mapName"),parseInt(this.mdvMap.config.get("xCenterReal")),parseInt(this.mdvMap.config.get("yCenterReal")));this.zoomLevel=this.mdvMap.config.get("defaultScale");this.mapControl=this.createDiv();this.mapControl.className="MDVMapControl";this.mdvMap.viewport.appendChild(this.mapControl);this.arrowContainer=this.createDiv();this.zoomContainer=this.createDiv();this.zoomContainer.className="MDVMapControl_ZoomLevels";this.zoomLevels=new Array();this.mapControl.appendChild(this.arrowContainer);this.mapControl.appendChild(this.zoomContainer);this.populateContainers();this.update()};MDVMapControl.prototype.destroy=function(){if(this.mdvMap){this.mdvMap=null}for(var C=0;C<this.arrowContainer.childNodes.length;C++){for(var D=0;D<this.arrowContainer.childNodes[C].childNodes.length;D++){for(var B=0;B<this.arrowContainer.childNodes[C].childNodes[D].childNodes.length;B++){if(this.arrowContainer.childNodes[C].childNodes[D].childNodes[B].mdvMap){this.arrowContainer.childNodes[C].childNodes[D].childNodes[B].mdvMap=null}if(this.arrowContainer.childNodes[C].childNodes[D].childNodes[B].normal){this.arrowContainer.childNodes[C].childNodes[D].childNodes[B].normal=null}if(this.arrowContainer.childNodes[C].childNodes[D].childNodes[B].hover){this.arrowContainer.childNodes[C].childNodes[D].childNodes[B].hover=null}}}}for(var C=0;C<this.zoomContainer.childNodes.length;C++){for(var B=0;B<this.zoomContainer.childNodes[C].childNodes.length;B++){var A=this.zoomContainer.childNodes[C].childNodes[B];A.onmouseover=null;A.onmouseout=null;A.onclick=null;A.hover=null;A.normal=null;if(A.mdvMap){A.mdvMap=null}}}this.ondblclick=null;this.onkeypress=null;this.onmousedown=null;this.onmousemove=null;this.onmouseout=null;this.onmouseover=null;this.onmouseup=null;this.onmousewheel=null;this.oncontextmenu=null;if(this.arrowContainer){this.arrowContainer.onmouseover=null;this.arrowContainer.onmouseout=null;this.arrowContainer.onclick=null;this.arrowContainer=null}if(this.zoomContainer){this.zoomContainer.onmouseover=null;this.zoomContainer.onmouseout=null;this.zoomContainer.onclick=null;this.zoomContainer=null}if(this.mapControl){this.mapControl.onmouseover=null;this.mapControl.onmouseout=null;this.mapControl.onclick=null;this.mapControl=null}};MDVMapControl.prototype.setZoomLevel=function(A){if(this.mdvMap.config.getZoomLevel(A)){this.zoomLevel=A;return true}return false};MDVMapControl.prototype.setOriginCoords=function(A){if(A&&A.x&&A.y&&A.mapName){this.origin=A;return true}return false};MDVMapControl.prototype.populateContainers=function(){if(!this.arrowContainer||!this.zoomContainer){return false}var A=this.createDiv();var H=this.createDiv();var L=this.createDiv();this.arrowContainer.appendChild(A);this.arrowContainer.appendChild(H);this.arrowContainer.appendChild(L);var G=this.createDiv();G.className="MDVMapControl_Arrow";arrowImg_1_1=this.createImage();arrowImg_1_1.src=this.images["transparent"].src;G.appendChild(arrowImg_1_1);var T=this.createDiv();T.className="MDVMapControl_Arrow";arrowImg_2_1=this.createImage();arrowImg_2_1.hover=this.images["top_hover"];arrowImg_2_1.normal=this.images["top_normal"];arrowImg_2_1.alt=this.images["top_normal"].alt;arrowImg_2_1.title=this.images["top_normal"].title;arrowImg_2_1.onclick=this.goNorth;arrowImg_2_1.src=this.images["top_normal"].src;T.appendChild(arrowImg_2_1);var M=this.createDiv();M.className="MDVMapControl_Arrow";arrowImg_3_1=this.createImage();arrowImg_3_1.src=this.images["transparent"].src;M.appendChild(arrowImg_3_1);A.appendChild(G);A.appendChild(T);A.appendChild(M);var F=this.createDiv();F.className="MDVMapControl_Arrow";arrowImg_1_2=this.createImage();arrowImg_1_2.hover=this.images["left_hover"];arrowImg_1_2.normal=this.images["left_normal"];arrowImg_1_2.alt=this.images["left_normal"].alt;arrowImg_1_2.title=this.images["left_normal"].title;arrowImg_1_2.onclick=this.goEast;arrowImg_1_2.src=this.images["left_normal"].src;F.appendChild(arrowImg_1_2);var R=this.createDiv();R.className="MDVMapControl_Arrow MDVMapControl_Arrow_LastResult";arrowImg_2_2=this.createImage();arrowImg_2_2.hover=this.images["centre_hover"];arrowImg_2_2.normal=this.images["centre_normal"];arrowImg_2_2.alt=this.images["centre_normal"].alt;arrowImg_2_2.title=this.images["centre_normal"].title;arrowImg_2_2.onclick=this.goBack;arrowImg_2_2.mapControl=this;arrowImg_2_2.src=this.images["centre_normal"].src;R.appendChild(arrowImg_2_2);var K=this.createDiv();K.className="MDVMapControl_Arrow";arrowImg_3_2=this.createImage();arrowImg_3_2.hover=this.images["right_hover"];arrowImg_3_2.normal=this.images["right_normal"];arrowImg_3_2.alt=this.images["right_normal"].alt;arrowImg_3_2.title=this.images["right_normal"].title;arrowImg_3_2.onclick=this.goWest;arrowImg_3_2.src=this.images["right_normal"].src;K.appendChild(arrowImg_3_2);H.appendChild(F);H.appendChild(R);H.appendChild(K);var E=this.createDiv();E.className="MDVMapControl_Arrow";arrowImg_1_3=this.createImage();arrowImg_1_3.src=this.images["transparent"].src;E.appendChild(arrowImg_1_3);var Q=this.createDiv();Q.className="MDVMapControl_Arrow";arrowImg_2_3=this.createImage();arrowImg_2_3.hover=this.images["bottom_hover"];arrowImg_2_3.normal=this.images["bottom_normal"];arrowImg_2_3.alt=this.images["bottom_normal"].alt;arrowImg_2_3.title=this.images["bottom_normal"].title;arrowImg_2_3.onclick=this.goSouth;arrowImg_2_3.src=this.images["bottom_normal"].src;Q.appendChild(arrowImg_2_3);var I=this.createDiv();I.className="MDVMapControl_Arrow";arrowImg_3_3=this.createImage();arrowImg_3_3.src=this.images["transparent"].src;I.appendChild(arrowImg_3_3);L.appendChild(E);L.appendChild(Q);L.appendChild(I);var D=this.createDiv();D.className="MDVMapControl_Arrow";arrowImg_spacer=this.createImage();arrowImg_spacer.style.height="20px";arrowImg_spacer.src=this.images["spacer"].src;D.appendChild(arrowImg_spacer);this.zoomContainer.appendChild(D);var S=this.createDiv();S.className="MDVMapControl_Zoom";zoomInImg=this.createImage();zoomInImg.hover=this.images["zoomIn_hover"];zoomInImg.normal=this.images["zoomIn_normal"];zoomInImg.alt=this.images["zoomIn_normal"].alt;zoomInImg.title=this.images["zoomIn_normal"].title;zoomInImg.src=this.images["zoomIn_normal"].src;zoomInImg.onclick=this.zoomIn;S.appendChild(zoomInImg);this.zoomContainer.appendChild(S);var O=10;if(this.mdvMap.config.get("control.spacer.height")){O=parseInt(this.mdvMap.config.get("control.spacer.height"))}var D=this.createDiv();D.className="MDVMapControl_Arrow";arrowImg_spacer=this.createImage();arrowImg_spacer.style.height=O+"px";arrowImg_spacer.src=this.images["spacer"].src;D.appendChild(arrowImg_spacer);this.zoomContainer.appendChild(D);var U=0;var C=this.mdvMap.config.getZoomLevels();if(C){U=C.length}for(var J=0;J<U;J++){var B=C[U-J-1];if(B){var P=this.createDiv();P.className="MDVMapControl_ZoomLevel";tmpZLImg=this.createImage();tmpZLImg.level=B.level;tmpZLImg.hover=this.images["zoomLevel_hover"];tmpZLImg.normal=this.images["zoomLevel_normal"];tmpZLImg.src=this.images["zoomLevel_normal"].src;tmpZLImg.alt="1:"+parseInt(B.getScale(),10);tmpZLImg.title=tmpZLImg.alt;tmpZLImg.onclick=MDVMapControl_onclick;P.appendChild(tmpZLImg);this.zoomContainer.appendChild(P);this.zoomLevels.push(tmpZLImg)}}var N=this.createDiv();N.className="MDVMapControl_Zoom";zoomOutImg=this.createImage();zoomOutImg.hover=this.images["zoomOut_hover"];zoomOutImg.normal=this.images["zoomOut_normal"];zoomOutImg.alt=this.images["zoomOut_normal"].alt;zoomOutImg.title=this.images["zoomOut_normal"].title;zoomOutImg.src=this.images["zoomOut_normal"].src;zoomOutImg.onclick=this.zoomOut;N.appendChild(zoomOutImg);this.zoomContainer.appendChild(N);return true};MDVMapControl.prototype.createImage=function(){var A=new Image();A.mdvMap=this.mdvMap;A.hover=null;A.normal=null;A.onmouseover=MDVMapControl_onmouseover;A.onmouseout=MDVMapControl_onmouseout;A.onclick=MDVMapControl_onclick;A.ondragstart=new Function([],"var e=e?e:event;e.cancelBubble=true;e.returnValue=false;return false;");return A};MDVMapControl.prototype.update=function(){if(!this.zoomLevels){return false}var C=this.mdvMap.config.getZoomLevelIndex();var A=this.zoomLevels.length;for(var B=0;B<A;B++){if(this.zoomLevels[B].level==C){this.zoomLevels[B].src=this.images["zoomLevel_active"].src;this.zoomLevels[B].hover=this.images["zoomLevel_active"];this.zoomLevels[B].normal=this.images["zoomLevel_active"]}else{this.zoomLevels[B].src=this.images["zoomLevel_normal"].src;this.zoomLevels[B].hover=this.images["zoomLevel_hover"];this.zoomLevels[B].normal=this.images["zoomLevel_normal"]}}return true};MDVMapControl.prototype.zoomIn=function(){var A=this.mdvMap.config.getZoomLevel(parseInt(this.mdvMap.config.getZoomLevelIndex())+1);if(A!=null){this.mdvMap.setZoomLevel(parseInt(this.mdvMap.config.getZoomLevelIndex())+1);this.mdvMap.update()}return true};MDVMapControl.prototype.zoomOut=function(){var A=this.mdvMap.config.getZoomLevel(parseInt(this.mdvMap.config.getZoomLevelIndex())-1);if(A!=null){this.mdvMap.setZoomLevel(parseInt(this.mdvMap.config.getZoomLevelIndex())-1);this.mdvMap.update()}return true};MDVMapControl.prototype.goEast=function(){var B=this.mdvMap.viewportRealWidth*0.6;var A=new MDVCoordinates(this.mdvMap.getCentre().mapName,this.mdvMap.getCentre().x,this.mdvMap.getCentre().y);A.x=A.x-Math.floor(B+0.5);this.mdvMap.setCentre(A);this.mdvMap.update();return true};MDVMapControl.prototype.goWest=function(){var B=this.mdvMap.viewportRealWidth*0.6;var A=new MDVCoordinates(this.mdvMap.getCentre().mapName,this.mdvMap.getCentre().x,this.mdvMap.getCentre().y);A.x=A.x+Math.floor(B+0.5);this.mdvMap.setCentre(A);this.mdvMap.update();return true};MDVMapControl.prototype.goNorth=function(){var A=this.mdvMap.viewportRealHeight*0.6;var B=new MDVCoordinates(this.mdvMap.getCentre().mapName,this.mdvMap.getCentre().x,this.mdvMap.getCentre().y);B.y=B.y-Math.floor(A+0.5);this.mdvMap.setCentre(B);this.mdvMap.update();return true};MDVMapControl.prototype.goSouth=function(){var A=this.mdvMap.viewportRealHeight*0.6;var B=new MDVCoordinates(this.mdvMap.getCentre().mapName,this.mdvMap.getCentre().x,this.mdvMap.getCentre().y);B.y=B.y+Math.floor(A+0.5);this.mdvMap.setCentre(B);this.mdvMap.update();return true};MDVMapControl.prototype.goBack=function(){this.mdvMap.setZoomLevel(this.mapControl.zoomLevel);this.mdvMap.setCentre(this.mapControl.origin);this.mdvMap.update()};function MDVMapControl_onmouseover(A){if(this.hover&&this.hover.src){this.src=this.hover.src;this.style.cursor="pointer"}return true}function MDVMapControl_onmouseout(A){if(this.normal&&this.normal.src){this.src=this.normal.src;this.style.cursor="auto"}return true}function MDVMapControl_onclick(A){if(this.level!==undefined){var B=this.mdvMap.config.getZoomLevel(this.level);if(B!=null){this.mdvMap.setZoomLevel(this.level);this.mdvMap.update()}}return true}function MDVMapZoomBar(A){this.mdvMap=A;this.zoomBars=new Array();this.zoomImg=null;for(var B in MDVGadgetBase.prototype){if(!MDVMapZoomBar.prototype[B]){MDVMapZoomBar.prototype[B]=MDVGadgetBase.prototype[B]}}this.mdvMap.events.registerEvent(MDVEvent_MAP_INITIALISED,this,this.preloadImgs);this.mdvMap.events.registerEvent(MDVEvent_MAP_INITIALISED,this,this.update)}MDVMapZoomBar.prototype.preloadImgs=function(){if(this.zoomImg){return false}var B=this.mdvMap.config.getZoomLevels();var A="";if(this.mdvMap.config.get("serverURL")){A=this.mdvMap.config.get("serverURL")}else{this.mdvMap.events.triggerEvent(MDVEvent_ERROR,"MDVMap wasn't able to find serverURL.");return false}for(var C=0;C<B.length;C++){this.zoomBars[B[C].level]=new Image();this.zoomBars[B[C].level].src=A+"zoomlevel"+B[C].level+"/ZoomBar_"+B[C].level+".gif"}this.zoomImg=document.createElement("img");this.zoomImg.className="MDVMap_ScaleBar";this.zoomImg.src=this.zoomBars[this.mdvMap.config.getZoomLevelIndex()].src;this.mdvMap.viewport.appendChild(this.zoomImg);return true};MDVMapZoomBar.prototype.update=function(){if(this.zoomBars[this.mdvMap.config.getZoomLevelIndex()]==null){this.mdvMap.events.triggerEvent(MDVEvent_WARNING,"MDVMap wasn't able to load appropriate zoom bar image.");this.zoomImg.style.visibility="hidden";return false}this.zoomImg.style.visibility="visible";this.zoomImg.src=this.zoomBars[this.mdvMap.config.getZoomLevelIndex()].src;return true};MDVMapZoomBar.prototype.destroy=function(){if(this.mdvMap){this.mdvMap=null}this.ondblclick=null;this.onkeypress=null;this.onmousedown=null;this.onmousemove=null;this.onmouseout=null;this.onmouseover=null;this.onmouseup=null;this.onmousewheel=null;this.oncontextmenu=null;for(var A=0;A<this.zoomBars.length;A++){this.zoomBars[A].onload=null;this.zoomBars[A].onerror=null;this.zoomBars[A].available=null}};function MDVMapSync(A,C){this.mdvMap=A;this.mdvMiniMap=C;this.active=true;this.lastMap=null;this.lastMiniMap=null;for(var B in MDVGadgetBase.prototype){if(!MDVMapSync.prototype[B]){MDVMapSync.prototype[B]=MDVGadgetBase.prototype[B]}}this.mdvMap.events.registerEvent(MDVEvent_MAP_INITIALISED,this,this.updateMiniMap);this.mdvMiniMap.events.registerEvent(MDVEvent_MAP_INITIALISED,this,this.updateMap)}MDVMapSync.prototype.updateMiniMap=function(C,B,A){if(this.mdvMap.state!=1||this.mdvMiniMap.state!=1||!this.isActive()){return false}if(this.lastMiniMap&&this.lastMiniMap.centre.equals(A.getCentre())&&this.lastMiniMap.zoomLevel==A.config.getZoomLevelIndex()){return false}this.mdvMiniMap.setCentre(A.getCentre().clone());this.mdvMiniMap.setZoomLevel(A.config.getZoomLevelIndex());this.lastMiniMap={centre:this.mdvMiniMap.getCentre(),zoomLevel:this.mdvMiniMap.config.getZoomLevelIndex()};return this.mdvMiniMap.update()};MDVMapSync.prototype.updateMap=function(C,A,B){if(this.mdvMap.state!=1||this.mdvMiniMap.state!=1||!this.isActive()){return false}if(this.lastMap&&this.lastMap.centre.equals(B.getCentre())&&this.lastMap.zoomLevel==B.config.getZoomLevelIndex()){return false}this.mdvMap.setCentre(B.getCentre().clone());this.mdvMap.setZoomLevel(B.config.getZoomLevelIndex());this.lastMap={centre:this.mdvMap.getCentre(),zoomLevel:this.mdvMap.config.getZoomLevelIndex()};return this.mdvMap.update()};function MDVMapSyncBound(A,C){for(var B in MDVGadgetBase.prototype){if(!MDVMapSync.prototype[B]){MDVMapSync.prototype[B]=MDVGadgetBase.prototype[B]}}for(var B in MDVMapSync.prototype){if(!MDVMapSyncBound.prototype[B]){MDVMapSyncBound.prototype[B]=MDVMapSync.prototype[B]}}this.mdvMap=A;this.mdvMiniMap=C;this.active=true;this.lastMap=null;this.lastMiniMap=null;this.border=null;this.inner=null;this.bounds=null;this.mouseDown=false;this.last=null;this.stepTime=40;this.stepPx=4;this.mdvMap.events.registerEvent(MDVEvent_MAP_INITIALISED,this,this.updateMiniMap);this.mdvMap.events.registerEvent(MDVEvent_ROUTE_TRACE_FINISHED,this,this.onTraceFinished);this.mdvMap.events.registerEvent(MDVEvent_CENTRE_CHANGED,this,this.onCentreChanged);this.mdvMiniMap.events.registerEvent(MDVEvent_MAP_INITIALISED,this,this.updateMap);this.mdvMiniMap.events.registerEvent(MDVEvent_MAP_INITIALISED,this,this.update);this.update()}MDVMapSyncBound.prototype.update=function(){if(this.mdvMap.state!=1||this.mdvMiniMap.state==-1){return false}if(!this.border){this.border=document.createElement("div");this.border.className="MDVMapSync_Outer";this.border.style.zIndex="150";this.border.style.position="absolute";this.border.setAttribute("unselectable","on");this.inner=document.createElement("div");this.inner.setAttribute("unselectable","on");this.inner.className="MDVMapSync_Inner";this.bounds=document.createElement("div");this.bounds.style.position="absolute";this.bounds.style.zIndex="140";this.bounds.className="MDVMapSync_Outer";this.bounds.setAttribute("unselectable","on");this.mdvMiniMap.viewport.appendChild(this.bounds);this.border.appendChild(this.inner);this.mdvMiniMap.viewport.appendChild(this.border);this.border.ondragstart=new Function([],"var e=e?e:event;e.cancelBubble=true;e.returnValue=false;return false;");this.inner.ondragstart=new Function([],"var e=e?e:event;e.cancelBubble=true;e.returnValue=false;return false;");this.bounds.ondragstart=new Function([],"var e=e?e:event;e.cancelBubble=true;e.returnValue=false;return false;");this.border.mdvMap=this.mdvMap;this.border.mdvSyncBound=this;this.border.onmousedown=MDVMapSyncBound_onmousedown;this.border.onmouseup=MDVMapSyncBound_onmouseup;this.border.onmousemove=MDVMapSyncBound_onmousemove;this.border.onmousewheel=MDVMap_onmousewheel;if(window.addEventListener&&navigator.product&&navigator.product=="Gecko"){this.border.addEventListener("DOMMouseScroll",MDVMap_onmousewheel,false)}}var A=this.mdvMiniMap.getPoint(this.mdvMap.tlReal);A=this.getAbsolutePoint(A);this.border.style.left=A.x+"px";this.border.style.top=A.y+"px";this.bounds.style.left=A.x+"px";this.bounds.style.top=A.y+"px";var B=this.mdvMap.getViewportRealExtends();B=this.getExtends(B);this.inner.style.width=B.width+"px";this.inner.style.height=B.height+"px";this.bounds.style.width=B.width+"px";this.bounds.style.height=B.height+"px";return true};MDVMapSyncBound.prototype.getAbsolutePoint=function(A){var B=new MDVPoint(parseInt(this.mdvMiniMap.getMapper().style.left),parseInt(this.mdvMiniMap.getMapper().style.top));A.x+=B.x;A.y+=B.y;return A};MDVMapSyncBound.prototype.getExtends=function(D){var F=this.mdvMiniMap.config.getZoomLevel(this.mdvMiniMap.config.getZoomLevelIndex());var A=parseInt(F.get("tileSizeX"))*parseInt(F.get("numberOfTilesX"));var C=A/parseInt(F.get("realWidth"));var E=parseInt(F.get("tileSizeY"))*parseInt(F.get("numberOfTilesY"));var B=E/parseInt(F.get("realHeight"));var D={width:Math.floor(0.5+(D.width*C)),height:Math.floor(0.5+(D.height*B))};return D};MDVMapSyncBound.prototype.setMouseDown=function(A){this.mouseDown=A};MDVMapSyncBound.prototype.isMouseDown=function(){return this.mouseDown};MDVMapSyncBound.prototype.apply=function(){var C=new MDVPoint(this.bounds.style.left,this.bounds.style.top);var K=new MDVPoint(this.border.style.left,this.border.style.top);var H=new MDVPoint(K.x-C.x,K.y-C.y);if(this.mdvMap.cancelMoveBySeq()){this.update()}this.setActive(false);this.centre=null;this.stepTime=this.mdvMap.stepTime;this.stepPx=this.mdvMap.stepPx;var B=this.mdvMiniMap.config.getZoomLevel(this.mdvMiniMap.config.getZoomLevelIndex());var F=parseInt(B.get("tileSizeX"))*parseInt(B.get("numberOfTilesX"));var E=parseInt(B.get("realWidth"))/F;var A=parseInt(B.get("tileSizeY"))*parseInt(B.get("numberOfTilesY"));var D=parseInt(B.get("realHeight"))/A;var I=this.mdvMiniMap.getCentre().clone();I.x+=Math.floor(0.5+H.x*E);I.y+=Math.floor(0.5+H.y*D);var G=this.mdvMap.getCentre().clone();var J=[G,I];this.mdvMap.stepTime=20;this.mdvMap.stepPx=15;this.mdvMap.moveBySeq(J,null,false);this.last=null;return true};MDVMapSyncBound.prototype.onTraceFinished=function(C,B,A){this.centre=null;this.mdvMap.stepTime=this.stepTime;this.mdvMap.stepPx=this.stepPx;this.setActive(true);this.updateMiniMap(-1,"",this.mdvMap)};MDVMapSyncBound.prototype.onCentreChanged=function(E,D,B){if(this.isActive()){return false}var C=new MDVPoint(parseInt(this.bounds.style.width)/2,parseInt(this.bounds.style.height)/2);var A=this.mdvMiniMap.getPoint(B);A=this.getAbsolutePoint(A);A.x-=C.x;A.y-=C.y;this.bounds.style.left=A.x+"px";this.bounds.style.top=A.y+"px";return true};function MDVMapSyncBound_onmousedown(A){this.mdvSyncBound.setMouseDown(true)}function MDVMapSyncBound_onmouseup(A){this.mdvSyncBound.setMouseDown(false);this.mdvSyncBound.apply();this.mdvMap.viewport.focus()}function MDVMapSyncBound_onmousemove(H){if(this.mdvSyncBound.isMouseDown()){H=H?H:window.event;var F=H.pageX||(H.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));var C=H.pageY||(H.clientY+(document.documentElement.scrollTop||document.body.scrollTop));var B=0;var E=0;var G=this.mdvMap.viewport;while(G){B+=G.offsetLeft;E+=G.offsetTop;G=G.offsetParent}F=F-(B);C=C-(E);var D=new MDVPoint(F,C);if(this.mdvSyncBound.last!=null){var A=new MDVPoint(D.x-this.mdvSyncBound.last.x,D.y-this.mdvSyncBound.last.y);this.mdvSyncBound.border.style.left=parseInt(this.mdvSyncBound.border.style.left)+A.x+"px";this.mdvSyncBound.border.style.top=parseInt(this.mdvSyncBound.border.style.top)+A.y+"px"}this.mdvSyncBound.last=D.clone()}return false}function MDVMapEFAInfoEx(A){this.mdvMap=A;this.name="MapEFAInfo";this.stops=null;this.poi=null;this.centre=null;this.id=null;this.options=[];this.lastCentre=null;this.boundLayers=[];this.stopImg=new Image();this.mot1Img=new Image();this.mot2Img=new Image();this.mot3Img=new Image();this.mot4Img=new Image();this.mot5Img=new Image();this.mot6Img=new Image();this.mot7Img=new Image();this.mot8Img=new Image();this.mot9Img=new Image();this.mot10Img=new Image();this.mot11Img=new Image();this.mot12Img=new Image();this.poiImg=new Image();this.entranceImg=new Image();this.pointImg=new Image();this.letters=new Array();this.letters["0"]=new Image();this.letters["1"]=new Image();this.letters["2"]=new Image();this.letters["3"]=new Image();this.letters["4"]=new Image();this.letters["5"]=new Image();this.letters["6"]=new Image();this.letters["7"]=new Image();this.letters["8"]=new Image();this.letters["9"]=new Image();this.letters["A"]=new Image();this.letters["B"]=new Image();this.letters["C"]=new Image();this.letters["D"]=new Image();this.letters["E"]=new Image();this.letters["F"]=new Image();this.letters["G"]=new Image();this.letters["H"]=new Image();this.letters["I"]=new Image();this.letters["J"]=new Image();this.letters["K"]=new Image();this.letters["L"]=new Image();this.letters["M"]=new Image();this.letters["N"]=new Image();this.letters["O"]=new Image();this.letters["P"]=new Image();this.letters["Q"]=new Image();this.letters["R"]=new Image();this.letters["S"]=new Image();this.letters["T"]=new Image();this.letters["U"]=new Image();this.letters["V"]=new Image();this.letters["W"]=new Image();this.letters["X"]=new Image();this.letters["Y"]=new Image();this.letters["Z"]=new Image();this.stopsOnly=false;this.imgsLoaded=false;this.comparator=null;if(arguments.length==2&&typeof arguments[1]=="object"){var B=arguments[1];for(var C in B){if(B[C]&&C=="comparator"){this.comparator=B["comparator"]}else{if(B[C]&&C=="getMOTImage"){this.getMOTImage=B["getMOTImage"]}else{if(B[C]&&C=="getBusPointImg"){this.getBusPointImg=B["getBusPointImg"]}else{this.options[C]=B[C]}}}}}else{if(arguments.length>=3&&arguments[1]!=null){this.comparator=arguments[1]}if(arguments.length>=3&&arguments[2]!=null){this.getMOTImage=arguments[2]}if(arguments.length>=3&&arguments[3]!=null){this.getBusPointImg=arguments[3]}}for(var D in MDVGadgetBase.prototype){if(!MDVMapEFAInfoEx.prototype[D]){MDVMapEFAInfoEx.prototype[D]=MDVGadgetBase.prototype[D]}}this.mdvMap.registerGadget(this);this.mdvMap.events.registerEvent(MDVEvent_MAP_INITIALISED,this,this.trigger);this.mdvMap.events.registerEvent(MDVEvent_AJAX_CALLBACK,this,this.processPins);this.mdvMap.events.registerEvent(MDVEvent_OBJECT_LOADED,this,this.intersects)}MDVMapEFAInfoEx.prototype.destroy=function(){this.stopImg.onclick=null;this.stopImg=null;this.mot1Img.onclick=null;this.mot1Img=null;this.mot2Img.onclick=null;this.mot2Img=null;this.mot3Img.onclick=null;this.mot3Img=null;this.mot4Img.onclick=null;this.mot4Img=null;this.mot5Img.onclick=null;this.mot5Img=null;this.mot6Img.onclick=null;this.mot6Img=null;this.mot7Img.onclick=null;this.mot7Img=null;this.mot8Img.onclick=null;this.mot8Img=null;this.mot9Img.onclick=null;this.mot9Img=null;this.mot10Img.onclick=null;this.mot10Img=null;this.mot11Img.onclick=null;this.mot11Img=null;this.mot12Img.onclick=null;this.mot12Img=null;this.poiImg.onclick=null;this.poiImg=null;this.entranceImg.onclick=null;this.entranceImg=null;this.pointImg.onclick=null;this.pointImg=null;if(this.stops){this.stops.removeAll()}if(this.poi){this.poi.removeAll()}while(this.boundLayers.pop()){}};MDVMapEFAInfoEx.prototype.addBoundaryLayer=function(B){for(var A=0;A<this.boundLayers.length;A++){if(this.boundLayers[A]&&this.boundLayers[A].id==B.id){return false}}this.boundLayers.push(B);return true};MDVMapEFAInfoEx.prototype.removeBoundaryLayer=function(B){for(var A=0;A<this.boundLayers.length;A++){if(this.boundLayers[A]&&this.boundLayers[A].id==B.id){this.boundLayers.splice(A,1);return true}}return false};MDVMapEFAInfoEx.prototype.createLayers=function(){if(!this.stops){this.stops=this.mdvMap.createLayer("efa_stops");this.stops.setZIndex(2);this.mdvMap.addLayer(this.stops)}if(!this.poi){this.poi=this.mdvMap.createLayer("efa_poi");this.poi.setZIndex(1);this.mdvMap.addLayer(this.poi)}};MDVMapEFAInfoEx.prototype.trigger=function(){var A="images/";if(this.mdvMap.config.get("imagePath")){A=this.mdvMap.config.get("imagePath")}if(this.options["imagePath"]){A=this.options["imagePath"]}if(!this.imgsLoaded){this.stopImg.src=A+"stop.gif";this.mot1Img.src=A+"mot1.gif";this.mot2Img.src=A+"mot2.gif";this.mot3Img.src=A+"mot3.gif";this.mot4Img.src=A+"mot4.gif";this.mot5Img.src=A+"mot5.gif";this.mot6Img.src=A+"mot6.gif";this.mot7Img.src=A+"mot7.gif";this.mot8Img.src=A+"mot8.gif";this.mot9Img.src=A+"mot9.gif";this.mot10Img.src=A+"mot10.gif";this.mot11Img.src=A+"mot11.gif";this.mot12Img.src=A+"mot12.gif";this.poiImg.src=A+"pin.gif";this.entranceImg.src=A+"entrance.gif";this.pointImg.src=A+"point.gif";if(this.mdvMap.config.get("info.stop.only")&&this.mdvMap.config.get("info.stop.only")=="true"){this.stopsOnly=true}this.imgsLoaded=true}if(this.id){mdvTimer.remove(this.id);this.id=null}this.id=mdvTimer.add(700,this,this.execute,[])};MDVMapEFAInfoEx.prototype.execute=function(){mdvTimer.remove(this.id);this.id=null;this.createLayers();var C=this.mdvMap.config.getZoomLevel(this.mdvMap.config.getZoomLevelIndex());var A=C.get("showSTOP")=="true";var B=C.get("showPOI")=="true";if(A||B){this.fetchPins()}else{this.stops.removeAll();this.poi.removeAll()}};MDVMapEFAInfoEx.prototype.getMOTImage=function(C,B,A){switch(parseInt(C)){case 1:return this.mot1Img.src;break;case 2:return this.mot2Img.src;break;case 3:return this.mot3Img.src;break;case 4:return this.mot4Img.src;break;case 5:return this.mot5Img.src;break;case 6:return this.mot6Img.src;break;case 7:return this.mot7Img.src;break;case 8:return this.mot8Img.src;break;case 9:return this.mot9Img.src;break;case 10:return this.mot10Img.src;break;case 11:return this.mot11Img.src;break;case 12:return this.mot12Img.src;break;default:if(B.toUpperCase()=="BUS_POINT"){return this.getBusPointImg(A)}else{if(B.toUpperCase()=="ENTRANCE"){return this.entranceImg.src}else{if(B.toUpperCase()=="POI_POINT"){return this.poiImg.src}else{if(B.toUpperCase()=="POI_AREA"){return this.poiImg.src}else{return this.stopImg.src}}}}break}};MDVMapEFAInfoEx.prototype.processPins=function(T,C,E){if(C!="MDVMapEFAInfoEx"){return false}mdvTimer.remove(this.id);this.id=null;var S=this.mdvMap.config.getZoomLevel(this.mdvMap.config.getZoomLevelIndex());var a=S.get("showSTOP")=="true"?true:false;var V=S.get("showPOI")=="true"?true:false;this.stops.removeAll();this.poi.removeAll();if(E.coordInfo&&E.coordInfo.request){var F=new MDVCoordinates(E.coordInfo.request.coords.mapName,E.coordInfo.request.coords.x,E.coordInfo.request.coords.y);if(!F.equals(this.mdvMap.getCentre())){return false}}var D=false;var G=false;if(!E.coordInfo.pins||E.coordInfo.pins.length<=0){this.mdvMap.events.triggerEvent(MDVEvent_ERROR,"MDVMap wasn't able to get pins from map request.");return false}var U=[];if(mdvLib.typeOf(E.coordInfo.pins)==="object"&&E.coordInfo.pins.pin){U.push(E.coordInfo.pins.pin)}else{U=E.coordInfo.pins}for(var b=0;b<U.length;b++){var Y=U[b].desc;var J=U[b].id;var e=U[b].type;var R=U[b].omc;var Q=U[b].identifier;var N=new Image();var L=U[b].attrs;if(L&&L.length>0){var B="";for(var X=0;X<L.length;X++){var d=L[X];if(d.name=="STOP_MAJOR_MEANS"){B=d.value;break}}N.src=this.getMOTImage(B,e,U[b])}else{if(e.toUpperCase()=="BUS_POINT"){N.src=this.getBusPointImg(U[b])}else{if(e.toUpperCase()=="ENTRANCE"){N.src=this.entranceImg.src}else{if(e.toUpperCase()=="GIS_POINT"){N.src=this.poiImg.src}else{if(e.toUpperCase()=="POI_POINT"){N.src=this.poiImg.src}else{if(e.toUpperCase()=="POI_AREA"){N.src=this.poiImg.src}else{N.src=this.stopImg.src}}}}}}var K=new Array();K["poi"]=new MDVPoint(284,190);K["stop"]=new MDVPoint(284,190);if(this.mdvMap.config.get("info.stop.size.width")&&this.mdvMap.config.get("info.stop.size.height")){K["stop"]=new MDVPoint(this.mdvMap.config.get("info.stop.size.width"),this.mdvMap.config.get("info.stop.size.height"))}if(this.mdvMap.config.get("info.poi.size.width")&&this.mdvMap.config.get("info.poi.size.height")){K["poi"]=new MDVPoint(this.mdvMap.config.get("info.poi.size.width"),this.mdvMap.config.get("info.poi.size.height"))}var A=U[b].coords.split(",");var Z=new MDVCoordinates(E.coordInfo.request.coords.mapName,A[0],A[1]);var H=0.5;switch(e.toUpperCase()){case"ENTRANCE":H=new MDVPoint(0.5,0.5);break;case"BUSPOINT":H=new MDVPoint(0.5,0.5);break;default:if(this.options["alignment"]){H=this.options["alignment"]}break}var O=this.mdvMap.createMarker(Z,H,N.src);var W=null;if(U[b].attrs){W=U[b].attrs}O.objectId={type:e,desc:Y,id:J,omc:R,identifier:Q,marker:O,attrs:W};if(this.comparator){if(!this.comparator(O.objectId)){continue}}switch(e.toUpperCase()){case"GIS_POINT":case"POI_POINT":case"POI_AREA":var c=null;if(this.mdvMap.config.get("useBubbleForEFAInfo")&&this.mdvMap.config.get("useBubbleForEFAInfo")=="true"){c=this.mdvMap.createToolTip(K["poi"],"<b>"+Y+"</b>");if(this.mdvMap.config.get("useBubbleOverflowForEFAInfo")&&this.mdvMap.config.get("useBubbleOverflowForEFAInfo")=="true"){c.setOverflow(true)}if(this.mdvMap.config.get("useBubblePinForEFAInfo")&&this.mdvMap.config.get("useBubblePinForEFAInfo")=="true"){c.setPin(true)}O.setToolTip(c,false)}else{c=this.mdvMap.createToolTip("Landmark: <b>"+Y+"</b>");O.setToolTip(c,false)}break;default:var c=null;if(this.mdvMap.config.get("useBubbleForEFAInfo")&&this.mdvMap.config.get("useBubbleForEFAInfo")=="true"){c=this.mdvMap.createToolTip(K["stop"],"<b>"+Y+"</b>");if(this.mdvMap.config.get("useBubbleOverflowForEFAInfo")&&this.mdvMap.config.get("useBubbleOverflowForEFAInfo")=="true"){c.setOverflow(true)}if(this.mdvMap.config.get("useBubblePinForEFAInfo")&&this.mdvMap.config.get("useBubblePinForEFAInfo")=="true"){c.setPin(true)}O.setToolTip(c,false)}else{c=this.mdvMap.createToolTip("Stop: <b>"+Y+"</b>");O.setToolTip(c,false)}break}switch(e.toUpperCase()){case"GIS_POINT":case"POI_POINT":case"POI_AREA":if(V){for(var X=0;X<this.poi.getMarkers().length;X++){var M=this.poi.getMarkers();if(M[X].objectId.id==O.objectId.id&&M[X].objectId.omc==O.objectId.omc){P=true;break}}if(P){continue}this.poi.addMarker(O,false);G=true}break;default:if(a){var P=false;for(var X=0;X<this.stops.getMarkers().length;X++){var I=this.stops.getMarkers();if(I[X].objectId.id==O.objectId.id){P=true;break}}if(P){continue}this.stops.addMarker(O,false);D=true}break}}if(D){this.stops.update()}if(G){this.poi.update()}this.centre=new MDVCoordinates(this.mdvMap.getCentre().mapName,this.mdvMap.getCentre().x,this.mdvMap.getCentre().y);return true};MDVMapEFAInfoEx.prototype.intersects=function(G,F,C){if(this.stops!=null&&this.stops.name!=null&&this.poi!=null&&this.poi.name!=null&&C.layer.name!=this.stops.name&&C.layer.name!=this.poi.name){return false}for(var D=0;D<this.boundLayers.length;D++){var E=this.boundLayers[D].getMarkers();for(var A=0;A<E.length;A++){var B=E[A];if(B.id!=C.id&&B.intersects(C)){C.layer.removeMarker(C)}}}return true};MDVMapEFAInfoEx.prototype.getBusPointImg=function(A){if(this.letters[A.identifier]&&this.letters[A.identifier].src){return this.letters[A.identifier].src}else{var B="images/";if(this.mdvMap.config.get("imagePath")){B=this.mdvMap.config.get("imagePath")}B+="point_"+A.identifier+".gif";return B}};MDVMapEFAInfoEx.prototype.fetchPins=function(){if(this.mdvMap.config.get("efaURL")){var O=this.mdvMap.config.get("efaURL");var B=this.mdvMap.getCentre();var E=this.mdvMap.config.get("language")!=null?this.mdvMap.config.get("language"):"en";var D=this.mdvMap.config.getZoomLevel(this.mdvMap.config.getZoomLevelIndex());var F=this.mdvMap.config.getZoomLevel(parseInt(this.mdvMap.config.getZoomLevelIndex())+1)==null;var J=this.mdvMap.config.getZoomLevel(parseInt(this.mdvMap.config.getZoomLevelIndex())+2)==null&&this.mdvMap.config.getZoomLevel(parseInt(this.mdvMap.config.getZoomLevelIndex())+1)!=null;var K=D.get("showSTOP")=="true"&&this.stops.visible?1:0;var C=D.get("showPOI")=="true"&&this.poi.visible?1:0;var A=this.mdvMap.config.get("poiArea")=="true";var Q=this.mdvMap.config.get("poiPoint")=="false";var I=this.mdvMap.getViewportRealExtends();var H=Math.floor(0.5+Math.sqrt((Math.pow(I.width/2,2)+Math.pow(I.height/2,2))));var L={language:E,coord:Math.floor(B.x+0.5)+":"+Math.floor(B.y+0.5)+":"+B.mapName,inclFilter:1,purpose:"",max:-1,coordListFormat:"STRING",language:"en",itdLPxx_mdvMapName:"mdvMap_"+this.mdvMap.getName(),coordListOutputFormat:"STRING"};var P=1;if(K){var N="";if(D.get("showSTOP.majorMeans")){N=D.get("showSTOP.majorMeans")}L["type_"+P]="STOP";L["radius_"+P]=H;L["inclDrawClasses_"+P]=N;P++;if((F||J)&&!this.stopsOnly){N="";if(F){L["type_"+P]="ENTRANCE";L["radius_"+P]=H;L["inclDrawClasses_"+P]=N;P++}N="";L["type_"+P]="BUS_POINT";L["radius_"+P]=H;L["inclDrawClasses_"+P]=N;P++}}if(C){var N="";for(var M=39;M<=80;M++){N+=M+":"}if(A){N="";L["type_"+P]="POI_AREA";L["radius_"+P]=H;L["inclDrawClasses_"+P]=N;P++}if(!Q){N="";L["type_"+P]="POI_POINT";L["radius_"+P]=H;L["inclDrawClasses_"+P]=N;P++}if(this.options&&this.options.pools){for(pl in this.options.pools){L["type_"+P]=pl;L["radius_"+P]=H;if(this.options.pools[pl].inclDrawClasses&&this.options.pools[pl].inclDrawClasses.length>0){L["inclDrawClasses_"+P]=this.options.pools[pl].inclDrawClasses}if(this.options.pools[pl].exclLayers&&this.options.pools[pl].exclLayers.length>0){L["exclLayers_"+P]=this.options.pools[pl].exclLayers}P++}}}var G=mdvLib.ajax({host:O,parameters:L,onComplete:MDVMapEFAInfoEx_onAjaxComplete})}};MDVMapEFAInfoEx.prototype.getOptions=function(){return this.options};MDVMapEFAInfoEx.prototype.onmousedown=function(A){mdvTimer.remove(this.id);this.id=null;this.lastCentre=this.mdvMap.getCentre().clone();return true};MDVMapEFAInfoEx.prototype.onmouseup=function(A){if(this.lastCentre&&this.lastCentre.equals(this.mdvMap.getCentre())){this.trigger()}return true};function MDVMapEFAInfoEx_onAjaxComplete(request){var json=null;var efa=null;if(request&&request.responseText){json=request.responseText}else{if(request){json=request}}eval("efa = "+json+";");for(var i=0;i<efa.parameters.length;i++){if(efa.parameters[i].name=="mdvMapName"){mdvMapName=efa.parameters[i].value;break}}if(document.mdvMaps[mdvMapName]){document.mdvMaps[mdvMapName].events.triggerEvent(MDVEvent_AJAX_CALLBACK,"MDVMapEFAInfoEx",efa)}}function MDVMapScale(A,B){if(!A){return }this.mdvMap=A;this.init=false;this.maxScaleWidth=100;this.minScaleWidth=60;this.levels=[];this.divScale=null;this.divScaleLeft=null;this.divScaleBar=null;this.divScaleTickTop=null;this.divScaleTickBottom=null;this.divScaleTextTop=null;this.divScaleTextBottom=null;this.displayMeters=true;this.displayYards=true;if(B){for(var C in B){this[C]=B[C]}}if(this.mdvMap.viewportRealWidth!==-1){this._execute()}else{this.mdvMap.events.registerEvent(MDVEvent_MAP_INITIALISED,this,this._execute)}}MDVMapScale.prototype._execute=function(){if(this.init){return true}this.calculateScales();var B=this;this.scaleImg=new Image();this.scaleImg.failCount=0;this.scaleImg.onload=this.createDivs.bind(this);this.scaleImg.onerror=function(){if(B.mdvMap){B.scaleImg.failCount++;var C=B.scaleImg.src;if(B.scaleImg.failCount<=10){B.scaleImg.src=C}else{return }}}.bind(B);var A="images/";if(this.mdvMap.config.get("imagePath")){A=this.mdvMap.config.get("imagePath")}this.scaleImg.src=A+"scale.gif"};MDVMapScale.prototype.calculateScales=function(){var G=this;var E=1604.134;var K=1754.302;var Q,A,T,O,H,D;for(var L=0,C=this.mdvMap.config.zoomLevels.length;L<C;L++){var J=this.mdvMap.config.getZoomLevel(L);var P=parseInt(J.get("tileSizeX"))*parseInt(J.get("numberOfTilesX"));var I=parseInt(J.get("realWidth"));var F=P/I;var B=R(this.maxScaleWidth/F);S(B);N();this.levels[L]={};this.levels[L].milesOut=Q;this.levels[L].meterOut=A;this.levels[L].milesUnit=T;this.levels[L].meterUnit=O;this.levels[L].pxMiles=H;this.levels[L].pxMeter=D}function S(X){var W=1;var V=X*1000;if(V>=1000){W=1000}else{if(V>=100){V=V*K/1000;W=100}else{if(V>=10){V=V*K/1000;W=10}}}if(W>100){var U=Math.floor(V/W);if(U>10){if(Math.round(U/10)<U/10){U=Math.round(U/10)*10}else{U=(Math.round(U/10)*10)-10}}Q=U}else{Q=Math.floor(V/W)*W}T=(W>100)?((Q===1)?"mile":"miles"):"yards";H=(W>100)?(Math.round(M(Q)*F)):(Math.round(M(Q/K)*F));while(H<G.minScaleWidth){S(X+0.1)}}function N(){var V=1;var W=(T.indexOf("mile")!==-1)?M(Q):M(Q/K);if(W>=1000){V=1000}else{if(W>=100){V=100}else{if(W>=10){V=10}}}if(V>100){var U=Math.floor(W/V);if(U>10){if(Math.round(U/10)<U/10){U=Math.round(U/10)*10}else{U=(Math.round(U/10)*10)-10}}A=U}else{A=Math.floor(W/V)*V}O=(V>100)?"km":"m";D=(V>100)?(Math.round(A*1000*F)):(Math.round(A*F))}function R(U){return U/E}function M(U){return U*E}};MDVMapScale.prototype.setScale=function(){var C=this.levels[this.mdvMap.config.getZoomLevelIndex()];var B=C.milesOut+" "+C.milesUnit;var A=C.meterOut+" "+C.meterUnit;if(this.divScaleTextTop){this.divScaleTextTop.innerHTML=B}if(this.divScaleTextBottom){this.divScaleTextBottom.innerHTML=A}mdvLib.style([this.divScaleBar],{width:C.pxMiles+"px",backgroundPosition:((this.scaleImg.width-C.pxMiles)*-1)+"px 0"});this.divScaleTickTop.style.left=C.pxMiles-1+"px";this.divScaleTickBottom.style.left=C.pxMeter-1+"px";return true};MDVMapScale.prototype.createDivs=function(){this.divScale=A("divScale");this.divScaleLeft=A("divScaleLeft");this.divScaleBar=A("divScaleBar");this.divScaleTickTop=A("divScaleTickTop");this.divScaleTickBottom=A("divScaleTickBottom");this.divScaleTextTop=A("divScaleTextTop");this.divScaleTextBottom=A("divScaleTextBottom");mdvLib.style([this.divScale],{position:"absolute",top:this.mdvMap.viewportHeight-40+"px",left:"15px",zIndex:999});mdvLib.style([this.divScaleBar,this.divScaleLeft,this.divScaleTextBottom,this.divScaleTextTop,this.divScaleTickBottom,this.divScaleTickTop],{position:"absolute",display:"inline"});mdvLib.style([this.divScaleBar,this.divScaleLeft,this.divScaleTickBottom,this.divScaleTickTop],{background:"transparent",backgroundImage:"url("+this.scaleImg.src+")",backgroundPosition:"0 0",backgroundRepeat:"no-repeat"});mdvLib.style([this.divScaleLeft],{width:"4px",height:"26px"});mdvLib.style([this.divScaleBar],{width:"100px",height:"4px",left:"3px",top:"11px"});mdvLib.style([this.divScaleTickTop],{width:"4px",height:"12px",backgroundPosition:"-4px 0",top:"0px"});mdvLib.style([this.divScaleTickBottom],{width:"4px",height:"12px",backgroundPosition:"-8px 0",top:"14px"});mdvLib.style([this.divScaleTextTop],{width:"60px",left:"8px",top:"-2px",fontSize:"10px"});mdvLib.style([this.divScaleTextBottom],{width:"60px",left:"8px",top:"15px",fontSize:"10px"});this.divScale.appendChild(this.divScaleLeft);this.divScale.appendChild(this.divScaleBar);this.divScale.appendChild(this.divScaleTickTop);this.divScale.appendChild(this.divScaleTickBottom);if(this.displayYards){this.divScale.appendChild(this.divScaleTextTop)}if(this.displayMeters){this.divScale.appendChild(this.divScaleTextBottom)}this.mdvMap.viewport.appendChild(this.divScale);this.mdvMap.events.registerEvent(MDVEvent_ZOOM_CHANGED,this,this.setScale);this.init=true;this.setScale();function A(C){var B=document.createElement("div");B.id=C;return B}};function MDVMapSlider(A,B){if(!A){return }this.mdvMap=A;this.mdvMap.registerGadget(this);for(var D in MDVGadgetBase.prototype){if(!MDVMapSlider.prototype[D]){MDVMapSlider.prototype[D]=MDVGadgetBase.prototype[D]}}this.name="MapSlider";this.imgs={plus:"zoom_Plus.png",minus:"zoom_Minus.png",tick:"tick.png",knob:"dragbar.png",indicator:"sizableBar_Large.png",bg:"zoomBG_separate.png"};this.sliderOffsetTop=50;this.sliderOffsetLeft=21;this.tickDiv=null;this.tickOffset=18;this.tickOffsetLeft=10;this.tickPositions=[];this.knob=null;this.knobDiv=null;this.knobActive=false;this.timer=null;this.timerDelay=20;this.currentLevel=0;this.zoomLevels=0;this.indicator=null;this.imagePath=this.mdvMap.config.get("imagePath");this.imagePath+="zoom/";this.imageRolloverPath="rollover/";this.plus=null;this.plusOver=null;this.minus=null;this.minusOver=null;this.bg=null;this.bgPos=0;this.garbage=[];this.init=false;if(B!==null){for(var C in B){if(this[C]){this[C]=B[C]}}}if(this.mdvMap.viewportRealWidth!==-1){this._execute()}else{this.mdvMap.events.registerEvent(MDVEvent_MAP_INITIALISED,this,this._execute)}}MDVMapSlider.prototype.destroy=function(){for(var C=0,A=this.garbage.length;C<A;C++){var E=this.garbage[C];switch(mdvLib.typeOf(E)){case"string":if(this[E]){this[E]=null}break;case"object":E=null;break;case"array":var D=this.garbage[C][0];var B=this.garbage[C][1];if(this[D][B]){this[D][B]=null}break;default:break}}};MDVMapSlider.prototype.createContainer=function(){var G=D("divSlider");var E=D("divSliderPlus");var C=D("divSliderBG");var F=D("divSliderKnob");var B=D("divSliderTicks");var A=D("divSliderMinus");mdvLib.style([G],{position:"absolute",top:this.sliderOffsetTop+"px",left:this.sliderOffsetLeft+"px",zIndex:999});mdvLib.style([E,A,C],{position:"relative"});mdvLib.style([E,A],{marginLeft:"3px",zIndex:6,height:"18px",width:"18px"});E.onclick=function(){if((this.currentLevel+1)<=(this.zoomLevels-1)){this.setZoomLevel(this.getZoomLevel()+1)}this.clearTimer();this.animate.bind(this)();return false}.bind(this);E.onmouseover=function(){this.plus.style.left="-2000px";this.plusOver.style.left="0px"}.bind(this);E.onmouseout=function(){this.plus.style.left="0px";this.plusOver.style.left="-2000px"}.bind(this);A.onclick=function(){if((this.currentLevel-1)>=0){this.setZoomLevel(this.getZoomLevel()-1)}this.clearTimer();this.animate.bind(this)();return false}.bind(this);A.onmouseover=function(){this.minus.style.left="-2000px";this.minusOver.style.left="0px"}.bind(this);A.onmouseout=function(){this.minus.style.left="0px";this.minusOver.style.left="-2000px"}.bind(this);B.style.zIndex=6;C.appendChild(F);C.appendChild(B);G.appendChild(E);G.appendChild(C);G.appendChild(A);this.mdvMap.viewport.appendChild(G);function D(I){var H=document.createElement("div");H.id=I;return H}};MDVMapSlider.prototype.loadImages=function(){for(var A in this.imgs){MDVMapSliderImages[A]=new Image();MDVMapSliderImages.over[A]=new Image();if(A==="bg"){MDVMapSliderImages[A].failCount=0;MDVMapSliderImages[A].onload=function(){this.setImages();this.drawTicks();this.createKnob();mdvLib.correctPNG(this.mdvMap,[this.plus,this.plusOver,this.minus,this.minusOver,this.bg,this.knob])}.bind(this);MDVMapSliderImages[A].onerror=function(){if(this.mdvMap){MDVMapSliderImages.bg.failCount++;var B=MDVMapSliderImages.bg.src;if(MDVMapSliderImages.bg.failCount<=10){MDVMapSliderImages.bg.src=B}else{return }}}.bind(this)}MDVMapSliderImages[A].src=this.imagePath+this.imgs[A];MDVMapSliderImages.over[A].src=this.imagePath+this.imageRolloverPath+this.imgs[A]}};MDVMapSlider.prototype.setImages=function(){var C=this;this.plus=mdvLib.createImg({position:"absolute",left:"0px"},{src:MDVMapSliderImages.plus.src,id:"MDVMapSliderPlus",title:"zoom in",alt:"zoom in"});this.plusOver=mdvLib.createImg({position:"absolute",left:"-2000px"},{src:MDVMapSliderImages.over.plus.src,id:"MDVMapSliderPlusOver",title:"zoom in",alt:"zoom in"});var A=mdvLib.$("divSliderPlus");A.appendChild(this.plus);A.appendChild(this.plusOver);this.bg=mdvLib.createImg({},{id:"MDVMapSliderBg",src:MDVMapSliderImages.bg.src,zIndex:2,onclick:C.setKnob.bind(C),onmousemove:C.onKnobMove.bind(C),onmouseup:C.onKnobUp.bind(C)});this.bgPos=mdvLib.getElementPosition(mdvLib.$("divSliderBG"));this.garbage.push(["bg","onclick"],["bg","onmousemove"],["bg","onmouseup"]);mdvLib.$("divSliderBG").appendChild(this.bg);this.minus=mdvLib.createImg({position:"absolute",left:"0"},{src:MDVMapSliderImages.minus.src,id:"MDVMapSliderMinus",title:"zoom out",alt:"zoom out"});this.minusOver=mdvLib.createImg({position:"absolute",left:"-2000px"},{src:MDVMapSliderImages.over.minus.src,id:"MDVMapSliderMinusOver",title:"zoom out",alt:"zoom out"});var B=mdvLib.$("divSliderMinus");B.appendChild(this.minus);B.appendChild(this.minusOver)};MDVMapSlider.prototype.drawTicks=function(){var D=Math.floor((MDVMapSliderImages.bg.height-this.tickOffset)/this.zoomLevels);var E=MDVMapSliderImages.bg.height-this.tickOffset;var C=this;this.tickDiv=mdvLib.$("divSliderTicks");this.tickDiv.appendChild(B(E));this.tickPositions.push(E);E=E-D;for(var A=2;A<=this.zoomLevels;A++){this.tickDiv.appendChild(B(E));this.tickPositions.push(E);E=E-D}function B(G){var F=document.createElement("img");F.src=MDVMapSliderImages.tick.src;F.style.position="absolute";F.style.top=G+"px";F.style.left=C.tickOffsetLeft+"px";F.id="tick"+G;return F}};MDVMapSlider.prototype.createKnob=function(){this.knobDiv=mdvLib.$("divSliderKnob");var A=this;mdvLib.style([this.knobDiv],{position:"absolute",top:(this.tickPositions[this.getZoomLevel()]-(Math.floor(MDVMapSliderImages.knob.height/2)))+"px",left:"1px",zIndex:5});this.knob=mdvLib.createImg({},{src:MDVMapSliderImages.knob.src,id:"MDVMapSliderKnob",onmousedown:function(){A.knobActive=true;A.clearTimer();return false},onmousemove:A.onKnobMove.bind(A),onmouseup:A.onKnobUp.bind(A)});this.garbage.push(["knob","onmousedown"],["knob","onmousemove"],["knob","onmouseup"]);this.indicator=mdvLib.createImg({position:"absolute",top:A.tickPositions[this.getZoomLevel()]+(Math.floor(MDVMapSliderImages.knob.height/2))-3+"px",left:"8px",zIndex:3},{id:"MDVMapSliderIndicator",src:MDVMapSliderImages.indicator.src,height:A.tickPositions[0]-A.tickPositions[this.getZoomLevel()]+7,width:MDVMapSliderImages.indicator.width,onclick:A.setKnob.bind(A),resize:function(B,C){this.height=(C)?this.height+1:this.height-1;this.style.top=B+(Math.floor(MDVMapSliderImages.knob.height/2))+"px";return true}});this.garbage.push(["indicator","onclick"]);this.knobDiv.appendChild(this.knob);mdvLib.$("divSliderBG").appendChild(this.indicator);this.mdvMap.events.registerEvent(MDVEvent_ZOOM_CHANGED,this,this.onZoomChanged);this.init=true;this.clearTimer()};MDVMapSlider.prototype.setKnob=function(D){var D=D||window.event;this.clearTimer();var A=mdvLib.getMousePosition(D);var E=MDVMapSliderImages.bg.height-(A.top-this.bgPos.top);var C=this.tickPositions.slice().reverse();for(var B=0;B<C.length;B++){if(E<=C[B+1]){var F=(E<=((C[B]+C[B+1])/2))?B:B+1;this.setZoomLevel(parseInt(F,10));break}}if(E>=C[this.zoomLevels-1]){this.setZoomLevel(this.zoomLevels-1)}this.animate();return true};MDVMapSlider.prototype.animate=function(){this.timer=window.setInterval(A.bind(this),this.timerDelay);var B=parseInt(this.knobDiv.style.top,10);var C=this.tickPositions[this.currentLevel]-Math.floor(MDVMapSliderImages.knob.height/2);function A(){if(C>B){B++;this.knobDiv.style.top=B+"px";this.indicator.resize(B,false);return }if(C<B){B--;this.knobDiv.style.top=B+"px";this.indicator.resize(B,true);return }this.clearTimer()}};MDVMapSlider.prototype.clearTimer=function(){window.clearInterval(this.timer);window.clearTimeout(this.timer);this.timer=null};MDVMapSlider.prototype.setZoomLevel=function(A){if(A===this.currentLevel){return true}var B=(this.mdvMap.config.get("useMagnifyGlass")&&this.mdvMap.config.get("useMagnifyGlass")=="true");if(B&&(this.currentLevel<A)){this.currentLevel=A;this.mdvMap._checkWrap();this.mdvMap.magnify(A);this.mdvMap.switchMapper()}else{this.currentLevel=A;this.mdvMap.setZoomLevel(A);this.mdvMap.update()}return true};MDVMapSlider.prototype.onZoomChanged=function(){if(this.currentLevel==this.getZoomLevel()){return }this.clearTimer();this.currentLevel=this.getZoomLevel();this.animate()};MDVMapSlider.prototype.getZoomLevel=function(){return(typeof this.mdvMap.config.getZoomLevelIndex()==="number")?this.mdvMap.config.getZoomLevelIndex():this.mdvMap.config.params.defaultScale};MDVMapSlider.prototype.onKnobMove=function(B){if(this.knobActive!==true){return true}var B=B||window.event;var A=mdvLib.getMousePosition(B);var C=(A.top-(this.bgPos.top+Math.floor(this.knob.height/2)));var D=parseInt(this.knobDiv.style.top,10);if((C<this.tickPositions[this.zoomLevels-1])||(C>this.tickPositions[0])){return true}if(D>C){this.indicator.style.top=C+(Math.floor(MDVMapSliderImages.knob.height/2))+"px";this.indicator.height=this.indicator.height+(D-C)}else{this.indicator.style.top=C+Math.floor((MDVMapSliderImages.knob.height/2))+"px";this.indicator.height=this.indicator.height-(C-D)}this.knobDiv.style.top=C+"px";return false};MDVMapSlider.prototype.onKnobUp=function(A){if(this.knobActive===true){this.knobActive=false;this.setKnob(A)}return false};MDVMapSlider.prototype._execute=function(){if(this.init===true){return }this.currentLevel=this.getZoomLevel();this.zoomLevels=this.mdvMap.config.zoomLevels.length;this.createContainer();this.loadImages()};var MDVMapSliderImages={over:{}};MDVMapSync.prototype.execute=function(B){if(!B){return false}this.container=B;var F=this;var A=parseInt(this.container.offsetHeight,10);var E=parseInt(this.container.offsetWidth,10);this.container.style.left=this.mdvMap.viewportWidth-E-2+"px";this.container.style.top=this.mdvMap.viewportHeight-A-2+"px";this.isVisible=true;this.timerDelay=10;this.timer=null;this.buttonN=null;this.buttonO=null;this.buttonA=null;this.buttonPos=null;this.normal=new Image();this.normal.src=this.mdvMap.config.get("imagePath")+"mapStretch.png";this.over=new Image();this.over.src=this.mdvMap.config.get("imagePath")+"mapStretch_rollover.png";this.active=new Image();this.active.failCount=0;this.active.onload=this.createImages.bind(this);this.active.onerror=function(){if(F.mdvMap){F.active.failCount++;var G=F.active.src;if(F.active.failCount<=10){F.active.src=G}else{return }}}.bind(F);this.active.src=this.mdvMap.config.get("imagePath")+"mapStretch_act.png";this.stepsX=[];this.stepsY=[];this.leftPos=parseInt(this.container.style.left,10);this.topPos=parseInt(this.container.style.top,10);this.topPosHidden=this.topPos+A;var D=Math.floor(E/A);var C=15;while(this.topPos<=this.topPosHidden+C){this.stepsX.push(this.leftPos);this.stepsY.push(this.topPos);this.topPos+=C;this.leftPos+=(C*D)}};MDVMapSync.prototype.createImages=function(){var A=this;var B=document.createElement("div");B.id="toggleImgDiv";mdvLib.style([B],{position:"absolute",top:this.mdvMap.viewportHeight-this.normal.height+"px",left:this.mdvMap.viewportWidth-this.normal.width+"px",zIndex:152});B.onclick=function(){A.clearTimer();A.animate.bind(A)();return false};B.onmouseover=function(){if(this.buttonA.style.left=="0px"){return true}this.buttonN.style.left="-2000px";this.buttonO.style.left="0px"}.bind(this);B.onmouseout=function(){if(this.buttonA.style.left=="0px"){return true}this.buttonN.style.left="0px";this.buttonO.style.left="-2000px"}.bind(this);this.buttonN=mdvLib.createImg({position:"absolute",left:"0px"},{src:A.normal.src,id:"togNormal",title:"hide MiniMap",alt:"hide MiniMap"});this.buttonO=mdvLib.createImg({position:"absolute",left:"-2000px"},{src:A.over.src,id:"togOver",title:"hide MiniMap",alt:"hide MiniMap"});this.buttonA=mdvLib.createImg({position:"absolute",left:"-2000px"},{src:A.active.src,id:"togActive",title:"show MiniMap",alt:" show MiniMap"});B.appendChild(this.buttonN);B.appendChild(this.buttonO);B.appendChild(this.buttonA);this.mdvMap.viewport.appendChild(B);mdvLib.correctPNG(this.mdvMap,[this.buttonN,this.buttonO,this.buttonA])};MDVMapSync.prototype.animate=function(){var D=parseInt(this.container.style.left,10);if(this.container.style.display==="none"){if(this.buttonA.style.left=="0px"){this.container.style.display="block";this.isVisible=false}else{return }}else{if((!this.isVisible)&&(D<=(this.mdvMap.viewportWidth-this.container.offsetWidth))){this.isVisible=true}}var C=this.stepsX.slice();var B=this.stepsY.slice();if(this.isVisible){C.reverse();B.reverse();this.setImgActive(true);this.isVisible=false}else{this.setImgActive(false);this.isVisible=true}this.timer=window.setInterval(A.bind(this),this.timerDelay);function A(){this.container.style.top=B.pop()+"px";this.container.style.left=C.pop()+"px";if(B.length==0){this.clearTimer()}}};MDVMapSync.prototype.clearTimer=function(){window.clearInterval(this.timer);this.timer=null};MDVMapSync.prototype.setImgActive=function(A){if(A===true){this.buttonN.style.left="-2000px";this.buttonO.style.left="-2000px";this.buttonA.style.left="0px"}else{this.buttonA.style.left="-2000px";this.buttonO.style.left="-2000px";this.buttonN.style.left="0px"}};MDVMapSync.prototype.hideButton=function(A){mdvLib.$("toggleImgDiv").style.display=(A)?"none":"block"};var resizeHandlerFunc=function(){};function MDVRectZoom(A,B){if(!A){return }this.mdvMap=A;this.mdvMap.registerGadget(this);this.name="RectZoom";this.init=false;this.bDragging=false;this.mc=null;this.mct=null;this.mcr=null;this.mcb=null;this.mcl=null;this.oOutline=null;this.mcOpacity=0.2;this.mcFilter="alpha(opacity=20)";this.gadgetBorder="1px solid #000";this.useButton=false;this.buttonN=null;this.buttonO=null;this.buttonA=null;this.buttonPosLeft="13px";this.buttonPosTop="280px";if(B){this.options=B}this.nBorderCorrect=this.gadgetBorder.split(" ")[0].replace(/px/,"")*2;this.oMapPos=null;this.nMapWidth=0;this.nMapHeight=0;this.nMapRatio=0;this.nStartX=0;this.nStartY=0;if(this.mdvMap.viewportRealWidth!==-1){this._execute()}else{this.mdvMap.events.registerEvent(MDVEvent_MAP_INITIALISED,this,this._execute)}}MDVRectZoom.prototype.onmousedown=function(A){if(this.useButton){return true}if(A.shiftKey){this._showCover();this._coverMousedown(A);return false}return true};MDVRectZoom.prototype.onmousemove=function(A){if(this.useButton){return true}if(A.shiftKey){this._coverDrag(A);return false}return true};MDVRectZoom.prototype.onmouseup=function(A){if(this.useButton){return true}if(this.bDragging){return false}return true};MDVRectZoom.prototype.onmouseover=function(A){return true};MDVRectZoom.prototype.onkeypress=function(A){return true};MDVRectZoom.prototype.onmouseout=function(A){return true};MDVRectZoom.prototype.oncontextmenu=function(A){return true};MDVRectZoom.prototype.ondblclick=function(A){return true};MDVRectZoom.prototype.onmousewheel=function(A){return true};MDVRectZoom.prototype.destroy=function(){var A;if(this.mdvMap){mdvLib.removeEvent(window,"resize",resizeHandlerFunc);A=document.getElementById("rz_MapCover");if(A){while(A.hasChildNodes()){A.removeChild(A.lastChild)}A.onmousemove=null;this.mdvMap.viewport.removeChild(A)}this.mdvMap=null}this.ondblclick=null;this.onkeypress=null;this.onmousedown=null;this.onmousemove=null;this.onmouseout=null;this.onmouseover=null;this.onmouseup=null;this.onmousewheel=null;this.oncontextmenu=null};MDVRectZoom.prototype._execute=function(){if(this.init===true){return }if(this.options){var B=this;if(typeof this.options.buttonPosLeft!=="undefined"){this.buttonPosLeft=this.options.buttonPosLeft}if(typeof this.options.buttonPosTop!=="undefined"){this.buttonPosTop=this.options.buttonPosTop}if(typeof this.options.opacity!=="undefined"){this.mcOpacity=this.options.opacity;this.mcFilter=this.mcFilter.replace(/20/,this.options.opacity*100)}if(typeof this.options.border!=="undefined"){var A=this.options.border.split(" ");if(A[0].indexOf("px")===-1){A.reverse()}this.gadgetBorder=A.join(" ");this.nBorderCorrect=this.gadgetBorder.split(" ")[0].replace(/px/,"")*2}if(typeof this.options.useButton!=="undefined"){if(this.options.useButton===true){this.useButton=true;this.normal=new Image();this.normal.src=B.mdvMap.config.get("imagePath")+this.options.buttonImg;this.over=new Image();this.over.src=B.mdvMap.config.get("imagePath")+this.options.buttonImgOver;this.active=new Image();this.active.failCount=0;this.active.onload=this._createButton.bind(this);this.active.onerror=function(){if(B.mdvMap){B.active.failCount++;var C=B.active.src;if(B.active.failCount<=10){B.active.src=C}else{B.active.src=B.mdvMap.transparent.src}}}.bind(B);this.active.src=B.mdvMap.config.get("imagePath")+this.options.buttonImgActive}}}this._createGadgetElements();this.oOutline=mdvLib.$("rz-outline");if(this.useButton){this.oButton=mdvLib.$("rz_Button")}this.mc=mdvLib.$("rz_MapCover");this.mct=mdvLib.$("rz-mct");this.mcr=mdvLib.$("rz-mcr");this.mcb=mdvLib.$("rz-mcb");this.mcl=mdvLib.$("rz-mcl");this.oMapPos=mdvLib.getElementPosition(this.mdvMap.viewport);this._setDimensions();this._initStyles();if(this.useButton){this.mc.onmousedown=this._coverMousedown.bind(this)}document.onmouseup=this._coverMouseup.bind(this);this.mdvMap.events.deregisterEvent(MDVEvent_MAP_INITIALISED,this,this._execute);if(!this.useButton){this.init=true}resizeHandlerFunc=function(){this.oMapPos=mdvLib.getElementPosition(this.mdvMap.viewport)}.bind(this);attachEventListener(window,"resize",resizeHandlerFunc,null)};MDVRectZoom.prototype._createGadgetElements=function(){var A=document.createElement("div");A.id="rz_MapCover";A.innerHTML='<div id="rz-outline"></div><div id="rz-mct"></div><div id="rz-mcl"></div><div id="rz-mcr"></div><div id="rz-mcb"></div>';A.onmousemove=this._coverDrag.bind(this);mdvLib.style([A],{position:"absolute",display:"none",overflow:"hidden",cursor:"crosshair",zIndex:101});this.mdvMap.viewport.appendChild(A);return true};MDVRectZoom.prototype._createButton=function(){var B=document.createElement("div");B.id="rz_Button";mdvLib.style([B],{position:"absolute",zIndex:102,left:this.buttonPosLeft,top:this.buttonPosTop});B.onclick=this._buttonClick.bind(this);B.onmouseover=function(){if(this.buttonA.style.left=="0px"){return true}this.buttonN.style.left="-2000px";this.buttonO.style.left="0px"}.bind(this);B.onmouseout=function(){if(this.buttonA.style.left=="0px"){return true}this.buttonN.style.left="0px";this.buttonO.style.left="-2000px"}.bind(this);var A=this;this.buttonN=mdvLib.createImg({position:"absolute",left:"0px"},{src:A.normal.src,id:"rzbNormal",title:A.options.title||"Click, and then drag a box with your cursor to zoom in",alt:A.options.alt||"Click, and then drag a box with your cursor to zoom in"});this.buttonO=mdvLib.createImg({position:"absolute",left:"-2000px"},{src:A.over.src,id:"rzbOver",title:A.options.title||"Click, and then drag a box with your cursor to zoom in",alt:A.options.alt||"Click, and then drag a box with your cursor to zoom in"});this.buttonA=mdvLib.createImg({position:"absolute",left:"-2000px"},{src:A.active.src,id:"rzbActive",title:A.options.titleActive||"draw a rectangle",alt:A.options.altActive||"draw a rectangle"});B.appendChild(this.buttonN);B.appendChild(this.buttonO);B.appendChild(this.buttonA);this.mdvMap.viewport.appendChild(B);mdvLib.correctPNG(this.mdvMap,[this.buttonN,this.buttonO,this.buttonA]);this.init=true;this._toggleButton()};MDVRectZoom.prototype._showCover=function(){mdvLib.style([this.mc],{display:"block",top:"0px",left:"0px",backgroundColor:"#000",width:this.mdvMap.viewportWidth+"px",height:this.mdvMap.viewportHeight+"px",opacity:this.mcOpacity,filter:this.mcFilter});if(this.useButton){this._toggleButton("zoom")}return true};MDVRectZoom.prototype._toggleButton=function(A){if(A=="zoom"){this.buttonN.style.left="-2000px";this.buttonO.style.left="-2000px";this.buttonA.style.left="0px"}else{this.buttonA.style.left="-2000px";this.buttonO.style.left="-2000px";this.buttonN.style.left="0px"}};MDVRectZoom.prototype._buttonClick=function(){(this.mc.style.display=="block")?this._resetDragZoom():this._showCover();return false};MDVRectZoom.prototype._coverMousedown=function(A){oPos=this._getRelPos(A);this.nStartX=oPos.left;this.nStartY=oPos.top;mdvLib.style([this.mc],{background:"transparent",opacity:1,filter:"alpha(opacity=100)"});mdvLib.style([this.oOutline],{left:this.nStartX+"px",top:this.nStartY+"px",display:"block",width:"1px",height:"1px"});this.bDragging=true;this.mct.style.top=(this.nStartY-this.nMapHeight)+"px";this.mct.style.display="block";this.mcl.style.left=(this.nStartX-this.nMapWidth)+"px";this.mcl.style.top=(this.nStartY)+"px";this.mcl.style.width=this.nMapWidth+"px";this.mcl.style.display="block";this.mcr.style.left=this.nStartX+"px";this.mcr.style.top=this.nStartY+"px";this.mcr.style.display="block";this.mcb.style.left=this.nStartX+"px";this.mcb.style.top=this.nStartY+"px";this.mcb.style.width="0px";this.mcb.style.display="block";return true};MDVRectZoom.prototype._coverDrag=function(C){if(this.bDragging){var B=this._getRelPos(C);var A=this._getRectangle(this.nStartX,this.nStartY,B,this.nMapRatio);this.oOutline.style.width=A.nWidth+"px";this.oOutline.style.height=A.nHeight+"px";this.mcb.style.width=(A.nWidth+this.nBorderCorrect)+"px";this.oOutline.style.left=this.nStartX+"px";this.oOutline.style.top=this.nStartY+"px";this.mcb.style.left=this.nStartX+"px";this.mcb.style.top=this.nStartY+"px";this.mcl.style.width=this.nMapWidth+"px";this.mcl.style.top=this.nStartY+"px";this.mct.style.height=this.nMapHeight+"px";this.mcr.style.top=this.nStartY+"px";this.mcr.style.left=this.nStartX+"px";if(A.xFactor===1){this.mcr.style.left=(A.nEndX+this.nBorderCorrect)+"px";if(A.yFactor===1){this.mcb.style.top=(A.nEndY+this.nBorderCorrect)+"px"}else{this.oOutline.style.top=(this.nStartY-(A.nHeight+this.nBorderCorrect))+"px";this.mct.style.height=(this.nMapHeight-(A.nHeight+this.nBorderCorrect))+"px";this.mcr.style.top=(this.nStartY-(A.nHeight+this.nBorderCorrect))+"px";this.mcl.style.top=(this.nStartY-(A.nHeight+this.nBorderCorrect))+"px"}}else{this.oOutline.style.left=(this.nStartX-(A.nWidth+this.nBorderCorrect))+"px";this.mcl.style.width=(this.nMapWidth-(A.nWidth+this.nBorderCorrect))+"px";this.mcb.style.left=(A.nStartX-(A.nWidth+this.nBorderCorrect))+"px";if(A.yFactor===1){this.mcb.style.top=(A.nEndY+this.nBorderCorrect)+"px"}else{this.oOutline.style.top=(this.nStartY-(A.nHeight+this.nBorderCorrect))+"px";this.mct.style.height=(this.nMapHeight-(A.nHeight+this.nBorderCorrect))+"px";this.mcr.style.top=(this.nStartY-(A.nHeight+this.nBorderCorrect))+"px";this.mcl.style.top=(this.nStartY-(A.nHeight+this.nBorderCorrect))+"px"}}return false}};MDVRectZoom.prototype._coverMouseup=function(Q){if(this.bDragging){var B=this._getRelPos(Q);this.bDragging=false;var C=this._getRectangle(this.nStartX,this.nStartY,B,this.nMapRatio);this._resetDragZoom();if(C.nStartX>C.nEndX){var G=C.nStartX;C.nStartX=C.nEndX;C.nEndX=G}if(C.yFactor===-1){C.nEndY=C.nStartY-C.nHeight;var O=new MDVPoint(C.nStartX,C.nEndY);var P=new MDVPoint(C.nEndX,C.nEndY);var J=new MDVPoint(C.nEndX,C.nStartY);var H=new MDVPoint(C.nStartX,C.nStartY)}else{var O=new MDVPoint(C.nStartX,C.nStartY);var P=new MDVPoint(C.nEndX,C.nStartY);var J=new MDVPoint(C.nEndX,C.nEndY);var H=new MDVPoint(C.nStartX,C.nEndY)}var R=this.mdvMap.getCoordinates(O);var E=this.mdvMap.getCoordinates(P);var T=this.mdvMap.getCoordinates(J);var L=this.mdvMap.getCoordinates(H);var K=R.x+","+R.y+" "+E.x+","+E.y+" "+T.x+","+T.y+" "+L.x+","+L.y+" "+R.x+","+R.y;var U=T.x-R.x;var S=T.y-R.y;var N=this.mdvMap.config.currentZoomLevelIndex;while(this.mdvMap.config.getZoomLevel(N)!==null){var M=this.mdvMap.config.getZoomLevel(N);var A=Math.floor(M.get("realWidth")/M.get("numberOfTilesX")*this.mdvMap.tileCountWidth);if(A<U){N--;break}N++}if(this.mdvMap.config.getZoomLevel(N)===null){N--}var D=new MDVCoordinates(this.mdvMap.config.get("mapName"),R.x+(U/2),R.y+(S/2));var F=this.mdvMap.createLayer("rect_zoom");this.mdvMap.addLayer(F);var I=this.mdvMap.createPolyline(K);I.add("weight",this.gadgetBorder.split(" ")[0].replace(/px/,""));I.add("colour",this.gadgetBorder.split(" ")[2]);I.add("opacity","1");F.addPolyline(I);this.mdvMap.renderer.update();this.mdvMap.setCentre(D);this.mdvMap.setZoomLevel(N);this.mdvMap.update();this.mdvMap.renderer.drawPolyline(I);window.setTimeout(function(){F.removePolyline(I)},1000)}};MDVRectZoom.prototype._getRelPos=function(B){var A=mdvLib.getMousePosition(B);return{top:(A.top-this.oMapPos.top),left:(A.left-this.oMapPos.left)}};MDVRectZoom.prototype._setDimensions=function(){this.nMapWidth=this.mdvMap.viewportWidth;this.nMapHeight=this.mdvMap.viewportHeight;this.nMapRatio=this.nMapHeight/this.nMapWidth;mdvLib.style([this.mc,this.mct,this.mcb],{width:this.nMapWidth+"px",height:this.nMapHeight+"px"});mdvLib.style([this.mcr,this.mcl],{width:2*this.nMapWidth+"px",height:2*this.nMapHeight+"px"});return true};MDVRectZoom.prototype._initStyles=function(){mdvLib.style([this.mc,this.mct,this.mcr,this.mcb,this.mcl],{position:"absolute",display:"none",background:"#000",opacity:this.mcOpacity,filter:this.mcFilter});mdvLib.style([this.oOutline],{position:"absolute",display:"none"});this.oOutline.style.border=this.gadgetBorder;return true};MDVRectZoom.prototype._getRectangle=function(C,B,G,A){var F=G.left-C;var E=G.top-B;var I=1;var D=1;if(F<0){F=F*-1;I=-1}if(E<0){E=E*-1;D=-1}var H=(F>E)?F:E;return{nStartX:C,nStartY:B,nEndX:(I===1)?C+H:C-H,nEndY:B+parseInt(H*A,10),nWidth:H,nHeight:parseInt(H*A,10),xFactor:I,yFactor:D}};MDVRectZoom.prototype._resetDragZoom=function(){mdvLib.style([this.oOutline,this.mc,this.mct,this.mcr,this.mcb,this.mcl],{display:"none"});this.mct.style.height=this.nMapHeight+"px";if(this.useButton){this._toggleButton()}return true}