var gnLastEventId=0;var KAMAP_ERROR=gnLastEventId++;var KAMAP_WARNING=gnLastEventId++;var KAMAP_NOTICE=gnLastEventId++;var KAMAP_INITIALIZED=gnLastEventId++;var KAMAP_MAP_INITIALIZED=gnLastEventId++;var KAMAP_EXTENTS_CHANGED=gnLastEventId++;var KAMAP_SCALE_CHANGED=gnLastEventId++;var KAMAP_LAYERS_CHANGED=gnLastEventId++;var KAMAP_LAYER_STATUS_CHANGED=gnLastEventId++;var KAMAP_CONTEXT_MENU=gnLastEventId++;var KAMAP_METAEXTENTS_CHANGED=gnLastEventId++;var KAMAP_MAP_CLICKED=gnLastEventId++;function kaMap(A){this.isCSS=false;this.isW3C=false;this.isIE4=false;this.isNN4=false;this.isIE6CSS=false;if(document.images){this.isCSS=(document.body&&document.body.style)?true:false;this.isW3C=(this.isCSS&&document.getElementById)?true:false;this.isIE4=(this.isCSS&&document.all)?true:false;this.isNN4=(document.layers)?true:false;this.isIE6CSS=(document.compatMode&&document.compatMode.indexOf("CSS1")>=0)?true:false}this.domObj=this.getRawObject(A);this.domObj.style.overflow="hidden";this.hideLayersOnMove=false;this.loadUnchecked=false;this.initializationState=0;this.bMouseDown=false;this.lastx=0;this.lasty=0;this.theInsideLayer=null;this.viewportWidth=this.getObjectWidth(this.domObj);this.viewportHeight=this.getObjectHeight(this.domObj);this.xOffset=0;this.yOffset=0;this.xOrigin=0;this.yOrigin=0;this.currentMap="";this.nWide=0;this.nHigh=0;this.nCurrentTop=0;this.nCurrentLeft=0;this.aPixel2=new Image(1,1);this.aPixel2.src="images/a_pixel2.gif";this.aPixel=new Image(1,1);this.aPixel.src="images/a_pixel.gif";this.imgErrors=new Array();this.aMaps=new Array();this.tileWidth=null;this.tileHeight=null;this.nBuffer=1;this.baseURL="";this.cellSize=null;this.gImageID=0;this.eventManager=new _eventManager();this.as=slideid=null;this.accelerationFactor=1;this.pixelsPerStep=30;this.timePerStep=25;this.server="";this.init="init.php";this.tileURL=null;this.tileIDX=0;this.aObjects=[];this.aCanvases=[];this.layersHidden=false;this.aTools=[];this.aInfoTools=[];for(var B=0;B<gnLastEventId;B++){this.registerEventID(B)}this.createLayers()}kaMap.prototype.seekLayer=function(D,B){var A;for(var C=0;C<D.layers.length;C++){if(D.layers[C].name==B){A=D.layers[C];break}if(D.layers[C].document.layers.length>0){A=this.seekLayer(document.layers[C].document,B)}}return A};kaMap.prototype.getRawObject=function(B){var A;if(typeof B=="string"){if(this.isW3C){A=document.getElementById(B)}else{if(this.isIE4){A=document.all(B)}else{if(this.isNN4){A=seekLayer(document,B)}}}}else{A=B}return A};kaMap.prototype.getObject=function(B){var A=this.getRawObject(B);if(A&&this.isCSS){A=A.style}return A};kaMap.prototype.getObjectWidth=function(C){var B=this.getRawObject(C);var A=0;if(B.offsetWidth){A=B.offsetWidth}else{if(B.clip&&B.clip.width){A=B.clip.width}else{if(B.style&&B.style.pixelWidth){A=B.style.pixelWidth}}}return parseInt(A)};kaMap.prototype.getObjectHeight=function(C){var B=this.getRawObject(C);var A=0;if(B.offsetHeight){A=B.offsetHeight}else{if(B.clip&&B.clip.height){A=B.clip.height}else{if(B.style&&B.style.pixelHeight){A=B.style.pixelHeight}}}return parseInt(A)};kaMap.prototype.zoomTo=function(X,V){var Q=this.getCurrentMap();var Y=new Array(1,12,63360,39.3701,39370.1,4374754);var S;var P=false;if(arguments.length==3){S=arguments[2];P=(S!=this.getCurrentScale())}else{S=this.getCurrentScale()}var E=true;if(!P){var N=this.getGeoExtents();if(X>=N[0]&&X<=N[2]&&V>=N[1]&&V<=N[3]){var D=(N[0]+N[2])/2;var C=(N[1]+N[3])/2;var J=(D-X)/this.cellSize;var I=(V-C)/this.cellSize;this.slideBy(J,I);E=false}}if(E){this.cellSize=S/(Q.resolution*Y[Q.units]);var W=Q.zoomToScale(S);this.setMapLayers();var A=X/this.cellSize;var a=V/this.cellSize;var B=Math.round(A-this.viewportWidth/2);var H=Math.round(a+this.viewportHeight/2);var T=Math.floor(A/this.tileWidth)*this.tileWidth;var R=Math.floor(a/this.tileHeight)*this.tileHeight;var K=Math.ceil(this.viewportWidth/(2*this.tileWidth))*this.tileWidth;var F=Math.ceil(this.viewportHeight/(2*this.tileHeight))*this.tileHeight;this.nCurrentLeft=T-K;this.nCurrentTop=-1*(R+F);this.xOrigin=this.nCurrentLeft;this.yOrigin=this.nCurrentTop;this.theInsideLayer.style.left=-1*(B-this.xOrigin)+"px";this.theInsideLayer.style.top=(H+this.yOrigin)+"px";var G=Q.getLayers();for(var L=0;L<G.length;L++){var U=G[L].domObj;for(var M=0;M<this.nHigh;M++){for(var O=0;O<this.nWide;O++){var Z=U.childNodes[(M*this.nWide)+O];Z.src=this.aPixel.src;Z.style.top=(this.nCurrentTop+M*this.tileHeight-this.yOrigin)+"px";Z.style.left=(this.nCurrentLeft+O*this.tileWidth-this.xOrigin)+"px";G[L].setTile(Z)}}}this.checkWrap();this.updateObjects()}if(P){this.triggerEvent(KAMAP_SCALE_CHANGED,this.getCurrentScale())}this.triggerEvent(KAMAP_EXTENTS_CHANGED,this.getGeoExtents())};kaMap.prototype.zoomToExtents=function(G,D,E,C){var Z=new Array(1,12,63360,39.3701,39370.1,4374754);var R=this.getCurrentMap();var Y=(E+G)/2;var W=(C+D)/2;var L=Math.abs((E-G)/this.viewportWidth);var K=Math.abs((C-D)/this.viewportHeight);var H=Math.max(L,K);var M=H*R.resolution*Z[R.units];var T=R.aScales[0];for(var Q=1;Q<R.aScales.length;Q++){if(M>=R.aScales[Q]){break}T=R.aScales[Q]}this.cellSize=T/(R.resolution*Z[R.units]);var X=R.zoomToScale(T);this.setMapLayers();var A=Y/this.cellSize;var b=W/this.cellSize;var B=Math.round(A-this.viewportWidth/2);var J=Math.round(b+this.viewportHeight/2);var U=Math.floor(A/this.tileWidth)*this.tileWidth;var S=Math.floor(b/this.tileHeight)*this.tileHeight;var N=Math.ceil(this.viewportWidth/(2*this.tileWidth))*this.tileWidth;var F=Math.ceil(this.viewportHeight/(2*this.tileHeight))*this.tileHeight;this.nCurrentLeft=U-N;this.nCurrentTop=-1*(S+F);this.xOrigin=this.nCurrentLeft;this.yOrigin=this.nCurrentTop;this.theInsideLayer.style.left=-1*(B-this.xOrigin)+"px";this.theInsideLayer.style.top=(J+this.yOrigin)+"px";var I=R.getLayers();for(var O=0;O<I.length;O++){var V=I[O].domObj;for(var P=0;P<this.nHigh;P++){for(var Q=0;Q<this.nWide;Q++){var a=V.childNodes[(P*this.nWide)+Q];a.src=this.aPixel.src;a.style.top=(this.nCurrentTop+P*this.tileHeight-this.yOrigin)+"px";a.style.left=(this.nCurrentLeft+Q*this.tileWidth-this.xOrigin)+"px";I[O].setTile(a)}}}this.checkWrap();this.updateObjects();this.triggerEvent(KAMAP_SCALE_CHANGED,this.getCurrentScale());this.triggerEvent(KAMAP_EXTENTS_CHANGED,this.getGeoExtents())};kaMap.prototype.createDrawingCanvas=function(A){var B=document.createElement("div");B.style.position="absolute";B.style.left="0px";B.style.top="0px";B.style.width="1500px";B.style.height="1500px";B.style.zIndex=A;this.theInsideLayer.appendChild(B);this.aCanvases.push(B);B.kaMap=this;return B};kaMap.prototype.removeDrawingCanvas=function(A){for(var B=0;B<this.aCanvases.length;B++){if(this.aCanvases[B]==A){this.aCanvases.splice(B,1)}}this.theInsideLayer.removeChild(A);A.kaMap=null;return true};kaMap.prototype.addObjectGeo=function(A,E,D,C){C.lon=E;C.lat=D;var B=this.geoToPix(E,D);return this.addObjectPix(A,B[0],B[1],C)};kaMap.prototype.addObjectPix=function(B,A,H,F){var C=(F.xOffset)?F.xOffset:0;var G=(F.yOffset)?F.yOffset:0;var E=(H-this.yOrigin+G);var D=(A-this.xOrigin+C);F.style.position="absolute";F.style.top=E+"px";F.style.left=D+"px";F.canvas=B;B.appendChild(F);this.aObjects.push(F);return true};kaMap.prototype.shiftObject=function(A,E,D){var C=safeParseInt(D.style.top);var B=safeParseInt(D.style.left);D.style.top=(C+E)+"px";D.style.left=(B+A)+"px";return true};kaMap.prototype.removeObject=function(B){if(B==null){for(var A=0;A<this.aObjects.length;A++){B=this.aObjects[A];if(B.canvas){B.canvas.removeChild(B)}}this.aObjects=[];return true}else{for(var A=0;A<this.aObjects.length;A++){if(this.aObjects[A]==B){B=this.aObjects[A];if(B.canvas){B.canvas.removeChild(B);B.canvas=null}this.aObjects.splice(A,1);return true}}return false}};kaMap.prototype.removeAllObjects=function(A){for(var B=0;B<this.aObjects.length;B++){obj=this.aObjects[B];if(obj.canvas&&obj.canvas==A){obj.canvas.removeChild(obj);obj.canvas=null;this.aObjects.splice(B--,1)}}return true};kaMap.prototype.centerObject=function(F){var D=-safeParseInt(this.theInsideLayer.style.left)+this.viewportWidth/2;var C=-safeParseInt(this.theInsideLayer.style.top)+this.viewportHeight/2;var E=(F.xOffset)?F.xOffset:0;var G=(F.yOffset)?F.yOffset:0;var B=safeParseInt(F.style.left)-E-D;var A=safeParseInt(F.style.top)-G-C;this.slideBy(-B,-A);return true};kaMap.prototype.geoToPix=function(D,C){var B=D/this.cellSize;var A=-1*C/this.cellSize;return[Math.floor(B),Math.floor(A)]};kaMap.prototype.pixToGeo=function(B,A){var E=(arguments.length==3&&arguments[2])?true:false;if(E){B=B+this.xOrigin;A=A+this.yOrigin}var D=-1*B*this.cellSize;var C=A*this.cellSize;return[D,C]};kaMap.prototype.initialize=function(){if(this.initializationState==2){this.triggerEvent(KAMAP_ERROR,"ERROR: ka-Map! is already initialized!");return false}else{if(this.intializationState==1){this.triggerEvent(KAMAP_WARNING,"WARNING: ka-Map! is currently initializing ... wait for the KAMAP_INITIALIZED event to be triggered.");return false}}this.initializationState=1;var B=this.server+this.init;var A=(this.init.indexOf("?")==-1)?"?":"&";if(arguments.length>0&&arguments[0]!=""){B=B+A+"map="+arguments[0];A="&"}if(arguments.length>1&&arguments[1]!=""){B=B+A+"extents="+arguments[1];A="&"}if(arguments.length>2&&arguments[2]!=""){B=B+A+"centerPoint="+arguments[2];A="&"}call(B,this,this.initializeCallback);return true};kaMap.prototype.initializeCallback=function(szInit){if(szInit.substr(0,1)!="/"){this.triggerEvent(KAMAP_ERROR,"ERROR: ka-Map! initialization failed on the server.  Message returned was:\n"+szInit);return false}eval(szInit);this.triggerEvent(KAMAP_INITIALIZED);this.initializationState=2};kaMap.prototype.setBackgroundColor=function(A){this.domObj.style.backgroundColor=A;return true};kaMap.prototype.createLayers=function(){this.theInsideLayer=document.createElement("div");this.theInsideLayer.id="theInsideLayer";this.theInsideLayer.style.position="absolute";this.theInsideLayer.style.left="0px";this.theInsideLayer.style.top="0px";this.theInsideLayer.style.zIndex="1";this.theInsideLayer.kaMap=this;if(this.currentTool){this.theInsideLayer.style.cursor=this.currentTool.cursor}this.domObj.appendChild(this.theInsideLayer);this.domObj.kaMap=this;this.theInsideLayer.onmousedown=kaMap_onmousedown;this.theInsideLayer.onmouseup=kaMap_onmouseup;this.theInsideLayer.onmousemove=kaMap_onmousemove;this.theInsideLayer.onmouseover=kaMap_onmouseover;this.domObj.onmouseout=kaMap_onmouseout;this.theInsideLayer.onkeypress=kaMap_onkeypress;this.theInsideLayer.ondblclick=kaMap_ondblclick;this.theInsideLayer.oncontextmenu=kaMap_oncontextmenu;this.theInsideLayer.onmousewheel=kaMap_onmousewheel;if(window.addEventListener&&navigator.product&&navigator.product=="Gecko"){this.domObj.addEventListener("DOMMouseScroll",kaMap_onmousewheel,false)}this.theInsideLayer.ondragstart=new Function([],"var e=e?e:event;e.cancelBubble=true;e.returnValue=false;return false;")};kaMap.prototype.initializeLayers=function(Z){var N=this.nCurrentLeft+safeParseInt(this.theInsideLayer.style.left)-this.xOrigin;var M=this.nCurrentTop+safeParseInt(this.theInsideLayer.style.top)-this.yOrigin;var J=this.nCurrentTop-M;var A=this.nCurrentLeft-N;var D=A+this.viewportWidth/2;var C=J+this.viewportHeight/2;var F=Math.floor(D/this.tileWidth)*this.tileWidth;var E=Math.floor(C/this.tileHeight)*this.tileHeight;var R=F-this.nCurrentLeft;var P=E-this.nCurrentTop;var V=D*Z;var T=C*Z;var H=Math.floor(V/this.tileWidth)*this.tileWidth;var G=Math.floor(T/this.tileHeight)*this.tileHeight;var X=H-R;var U=G-P;this.nCurrentLeft=X;this.nCurrentTop=U;var L=-V+this.viewportWidth/2;var B=-T+this.viewportHeight/2;var K=this.xOrigin;var Y=this.yOrigin;this.xOrigin=this.nCurrentLeft;this.yOrigin=this.nCurrentTop;this.theInsideLayer.style.left=(L+this.xOrigin)+"px";this.theInsideLayer.style.top=(B+this.yOrigin)+"px";var I=this.aMaps[this.currentMap].getLayers();for(var O=0;O<I.length;O++){var W=I[O].domObj;for(var Q=0;Q<this.nHigh;Q++){for(var S=0;S<this.nWide;S++){var a=W.childNodes[(Q*this.nWide)+S];a.src=this.aPixel.src;a.style.top=(this.nCurrentTop+Q*this.tileHeight-this.yOrigin)+"px";a.style.left=(this.nCurrentLeft+S*this.tileWidth-this.xOrigin)+"px";I[O].setTile(a)}}}this.checkWrap();this.updateObjects()};kaMap.prototype.paintLayer=function(A){var E=A.domObj;for(var C=0;C<this.nHigh;C++){for(var D=0;D<this.nWide;D++){var B=E.childNodes[(C*this.nWide)+D];B.style.top=(this.nCurrentTop+C*this.tileHeight-this.yOrigin)+"px";B.style.left=(this.nCurrentLeft+D*this.tileWidth-this.xOrigin)+"px";A.setTile(B)}}this.checkWrap()};kaMap.prototype.updateObjects=function(){for(var A=0;A<this.aObjects.length;A++){var F=this.aObjects[A];var B=(F.xOffset)?F.xOffset:0;var G=(F.yOffset)?F.yOffset:0;var C=this.geoToPix(F.lon,F.lat);var E=(C[1]-this.yOrigin+G);var D=(C[0]-this.xOrigin+B);F.style.top=E+"px";F.style.left=D+"px"}};kaMap.prototype.resize=function(){if(this.initializationState!=2){return false}var E=this.getObjectWidth(this.domObj);var D=this.getObjectHeight(this.domObj);if(this.viewportWidth==null){this.theInsideLayer.style.top=(-1*this.nCurrentTop+this.yOrigin)+"px";this.theInsideLayer.style.left=(-1*this.nCurrentLeft+this.xOrigin)+"px";this.theInsideLayer.style.top=(safeParseInt(this.theInsideLayer.style.top)+(D-viewportHeight)/2)+"px";this.theInsideLayer.style.left=(safeParseInt(this.theInsideLayer.style.top)+(E-viewportWidth)/2)+"px";this.viewportWidth=E;this.viewportHeight=D}var A=Math.ceil((E/this.tileWidth)+2*this.nBuffer);var C=Math.ceil((D/this.tileHeight)+2*this.nBuffer);this.viewportWidth=E;this.viewportHeight=D;if(this.nHigh==0&&this.nWide==0){this.nWide=A}while(this.nHigh<C){this.appendRow()}while(this.nHigh>C&&C>3){this.removeRow()}while(this.nWide<A){this.appendColumn()}while(this.nWide>A&&A>3){this.removeColumn()}var G=this.getCurrentMap();var F=G.getLayers();for(var B=0;B<F.length;B++){F[B].setTileLayer()}this.triggerEvent(KAMAP_EXTENTS_CHANGED,this.getGeoExtents());this.triggerEvent(KAMAP_METAEXTENTS_CHANGED,this.getMetaExtents())};kaMap.prototype.createImage=function(D,C,B){var A=document.createElement("img");A.src=this.aPixel.src;A.width=this.tileWidth;A.height=this.tileHeight;A.setAttribute("style","position:absolute; top:"+D+"px; left:"+C+"px;");A.style.position="absolute";A.style.top=(D-this.yOrigin)+"px";A.style.left=(C-this.xOrigin)+"px";A.style.width=this.tileWidth+"px";A.style.height=this.tileHeight+"px";A.style.visibility="hidden";A.galleryimg="no";A.onerror=kaMap_imgOnError;A.onload=kaMap_imgOnLoad;A.errorCount=0;A.id="i"+this.gImageID;A.layer=B;A.kaMap=this;this.gImageID=this.gImageID+1;A.ie_hack=false;if(this.isIE4){if(B.imageformat&&(B.imageformat.toLowerCase()=="agga")){A.ie_hack=true}}return A};kaMap.prototype.resetTile=function(C,B){var A=this.DHTMLapi.getRawObject(C);if(A.layer){A.layer.setTile(this,B)}};kaMap.prototype.reloadImage=function(A){};kaMap.prototype.resetImage=function(A){};kaMap_imgOnError=function(A){if(this.layer){this.layer.setTile(this,true)}};kaMap_imgOnLoad=function(A){if((this.ie_hack)&&(this.src!=this.kaMap.aPixel2.src)){var B=this.src;this.src=this.kaMap.aPixel2.src;this.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+B+"')"}this.style.visibility="visible"};kaMap.prototype.appendRow=function(D){if(this.nWide==0){return }var H=null;if(arguments.length==1){H=Array(D)}else{H=this.aMaps[this.currentMap].getLayers()}for(var C=0;C<H.length;C++){var G=H[C].domObj;for(var B=0;B<this.nWide;B++){var F=this.nCurrentTop+(this.nHigh*this.tileHeight);var E=this.nCurrentLeft+(B*this.tileWidth);var A=this.createImage(F,E,H[C]);if(this.isIE4){A.style.filter="Alpha(opacity="+H[C].opacity+")"}G.appendChild(A)}}this.nHigh=this.nHigh+1};kaMap.prototype.appendColumn=function(D){if(this.nHigh==0){return }var H=null;if(arguments.length==1){H=Array(D)}else{H=this.aMaps[this.currentMap].getLayers()}for(var C=0;C<H.length;C++){var G=H[C].domObj;for(var B=this.nHigh-1;B>=0;B--){var F=this.nCurrentTop+(B*this.tileHeight);var E=this.nCurrentLeft+(this.nWide*this.tileWidth);var A=this.createImage(F,E,H[C]);if(this.isIE4){A.style.filter="Alpha(opacity="+H[C].opacity+")"}if(B<this.nHigh-1){G.insertBefore(A,G.childNodes[((B+1)*this.nWide)])}else{G.appendChild(A)}}}this.nWide=this.nWide+1};kaMap.prototype.removeColumn=function(D){if(this.nWide<3){return }var E=null;if(arguments.length==1){E=Array(D)}else{E=this.aMaps[this.currentMap].getLayers()}for(var C=0;C<E.length;C++){var F=E[C].domObj;for(var B=this.nHigh-1;B>=0;B--){var A=F.childNodes[((B+1)*this.nWide)-1];F.removeChild(A);A.onload=null;A.onerror=null}}this.nWide=this.nWide-1};kaMap.prototype.removeRow=function(D){if(this.nHigh<3){return }var E=null;if(arguments.length==1){E=Array(D)}else{E=this.aMaps[this.currentMap].getLayers()}for(var C=0;C<E.length;C++){var F=E[C].domObj;for(var B=this.nWide-1;B>=0;B--){var A=F.childNodes[((this.nHigh-1)*this.nWide)+B];F.removeChild(A);A.onload=null;A.onerror=null}}this.nHigh=this.nHigh-1};kaMap.prototype.hideLayers=function(){if(!this.hideLayersOnMove){return }if(this.layersHidden){return }var B=this.aMaps[this.currentMap].getLayers();for(var A=0;A<B.length;A++){B[A]._visible=B[A].visible;if(B[A].name!="__base__"){B[A].setVisibility(false)}}for(var A=0;A<this.aCanvases.length;A++){this.aCanvases[A].style.visibility="hidden";this.aCanvases[A].style.display="none"}this.layersHidden=true};kaMap.prototype.showLayers=function(){if(!this.hideLayersOnMove){return }if(!this.layersHidden){return }var B=this.aMaps[this.currentMap].getLayers();for(var A=0;A<B.length;A++){B[A].setVisibility(B[A]._visible)}for(var A=0;A<this.aCanvases.length;A++){this.aCanvases[A].style.visibility="visible";this.aCanvases[A].style.display="block"}this.layersHidden=false};kaMap.prototype.moveBy=function(B,C){var A=this.theInsideLayer;A.style.top=(safeParseInt(A.style.top)+C)+"px";A.style.left=(safeParseInt(A.style.left)+B)+"px";this.checkWrap()};kaMap.prototype.slideBy=function(K,I){if(this.slideid!=null){goQueueManager.dequeue(this.slideid)}this.as=[];var C=Math.abs(K);var B=Math.abs(I);var N=K/C;var M=I/B;var A=C>B?C:B;var J=Math.floor(A/this.pixelsPerStep);var P=dy=0;if(J>0){P=(K)/(J*this.pixelsPerStep);dy=(I)/(J*this.pixelsPerStep)}var H=K-P*J*this.pixelsPerStep;var G=I-dy*J*this.pixelsPerStep;var L=py=0;var O=this.accelerationFactor;var F=0;while(F<J){if(F>0){L+=this.as[F-1][0];py+=this.as[F-1][1]}var E=L+Math.round(P*this.pixelsPerStep);var D=py+Math.round(dy*this.pixelsPerStep);this.as[F]=new Array(E-L,D-py);F++}if(H!=0||G!=0){this.as[F]=[H,G]}this.hideLayers();this.slideid=goQueueManager.enqueue(this.timePerStep,this,this.slide,[0])};kaMap.prototype.slide=function(A){if(A>=this.as.length){this.as=slideid=null;this.showLayers();this.triggerEvent(KAMAP_EXTENTS_CHANGED,this.getGeoExtents());return }this.moveBy(this.as[A][0],this.as[A][1]);A++;this.slideid=goQueueManager.enqueue(this.timePerStep,this,this.slide,[A])};kaMap_onkeypress=function(B){if(this.kaMap.currentTool){this.kaMap.currentTool.onkeypress(B)}if(this.kaMap.aInfoTools.length>0){for(var A=0;A<this.kaMap.aInfoTools.length;A++){this.kaMap.aInfoTools[A].onkeypress(B)}}};kaMap_onmousemove=function(B){B=(B)?B:((event)?event:null);if(B.button==2){this.kaMap.triggerEvent(KAMAP_CONTEXT_MENU)}if(this.kaMap.currentTool){this.kaMap.currentTool.onmousemove(B)}if(this.kaMap.aInfoTools.length>0){for(var A=0;A<this.kaMap.aInfoTools.length;A++){this.kaMap.aInfoTools[A].onmousemove(B)}}};kaMap_onmousedown=function(B){if(this.kaMap.currentTool){this.kaMap.currentTool.onmousedown(B)}if(this.kaMap.aInfoTools.length>0){for(var A=0;A<this.kaMap.aInfoTools.length;A++){this.kaMap.aInfoTools[A].onmousedown(B)}}};kaMap_onmouseup=function(B){if(this.kaMap.currentTool){this.kaMap.currentTool.onmouseup(B)}if(this.kaMap.aInfoTools.length>0){for(var A=0;A<this.kaMap.aInfoTools.length;A++){this.kaMap.aInfoTools[A].onmouseup(B)}}};kaMap_onmouseover=function(B){if(this.kaMap.currentTool){this.kaMap.currentTool.onmouseover(B)}if(this.kaMap.aInfoTools.length>0){for(var A=0;A<this.kaMap.aInfoTools.length;A++){this.kaMap.aInfoTools[A].onmouseover(B)}}};kaMap_onmouseout=function(B){if(this.kaMap.currentTool){this.kaMap.currentTool.onmouseout(B)}if(this.kaMap.aInfoTools.length>0){for(var A=0;A<this.kaMap.aInfoTools.length;A++){this.kaMap.aInfoTools[A].onmouseout(B)}}};kaMap_oncontextmenu=function(A){A=A?A:event;if(A.preventDefault){A.preventDefault()}return false};kaMap_ondblclick=function(B){if(this.kaMap.currentTool){this.kaMap.currentTool.ondblclick(B)}if(this.kaMap.aInfoTools.length>0){for(var A=0;A<this.kaMap.aInfoTools.length;A++){this.kaMap.aInfoTools[A].ondblclick(B)}}};kaMap_onmousewheel=function(A){if(this.kaMap.currentTool){this.kaMap.currentTool.onmousewheel(A)}};kaMap.prototype.cancelEvent=function(A){A=(A)?A:((event)?event:null);A.returnValue=false;if(A.preventDefault){A.preventDefault()}return false};kaMap.prototype.registerTool=function(A){this.aTools.push(A)};kaMap.prototype.activateTool=function(A){if(A.isInfoTool()){this.aInfoTools.push(A)}else{if(this.currentTool){this.currentTool.deactivate()}this.currentTool=A;if(this.theInsideLayer){this.setCursor(this.currentTool.cursor)}}};kaMap.prototype.deactivateTool=function(B){if(B.isInfoTool()){for(var A=0;A<this.aInfoTools.length;A++){if(this.aInfoTools[A]==B){this.aInfoTools.splice(A,1);break}}}else{if(this.currentTool==B){this.currentTool=null}if(this.theInsideLayer){this.theInsideLayer.style.cursor="auto"}}};kaMap.prototype.setCursor=function(B){if(B&&B.length&&typeof B=="object"){for(var A=0;A<B.length;A++){this.theInsideLayer.style.cursor=B[A];if(this.theInsideLayer.style.cursor==B[A]){break}}}else{if(typeof B=="string"){this.theInsideLayer.style.cursor=B}else{this.theInsideLayer.style.cursor="auto"}}};kaMap.prototype.checkWrap=function(){var C=false;this.checkMaxExtents();this.xOffset=safeParseInt(this.theInsideLayer.style.left)+this.nCurrentLeft-this.xOrigin;this.yOffset=safeParseInt(this.theInsideLayer.style.top)+this.nCurrentTop-this.yOrigin;while(this.xOffset>0){this.wrapR2L();C=true}while(this.xOffset<-(this.nBuffer*this.tileWidth)){this.wrapL2R();C=true}while(this.yOffset>-(this.nBuffer*this.tileHeight)){this.wrapB2T();C=true}while(this.yOffset<-(2*this.nBuffer*this.tileHeight)){this.wrapT2B();C=true}var B=this.aMaps[this.currentMap].getLayers()[0];if(B){var A=B.domObj.childNodes[0].style;this.nCurrentTop=safeParseInt(A.top)+this.yOrigin;this.nCurrentLeft=safeParseInt(A.left)+this.xOrigin}if(C){this.triggerEvent(KAMAP_METAEXTENTS_CHANGED,this.getMetaExtents())}};kaMap.prototype.checkMaxExtents=function(){var B=this.getCurrentMap().maxExtents;if(B.length==4){if((B[0]>=B[2])||(B[1]>=B[3])){return false}var D=this.getGeoExtents();var A=0;var C=0;if(D[0]<B[0]){A=Math.round((B[0]-D[0])/this.cellSize)}if(D[2]>B[2]){if(A!=0){A+=Math.round((B[2]-D[2])/this.cellSize);A/=2}else{A+=Math.round((B[2]-D[2])/this.cellSize)}}if(A!=0){this.theInsideLayer.style.left=(safeParseInt(this.theInsideLayer.style.left)-A)+"px"}if(D[1]<B[1]){C=Math.round((B[1]-D[1])/this.cellSize)}if(D[3]>B[3]){if(C!=0){C+=Math.round((B[3]-D[3])/this.cellSize);C/=2}else{C=Math.round((B[3]-D[3])/this.cellSize)}}if(C!=0){this.theInsideLayer.style.top=(safeParseInt(this.theInsideLayer.style.top)+C)+"px"}}};kaMap.prototype.wrapR2L=function(){this.xOffset=this.xOffset-(this.nBuffer*this.tileWidth);var F=this.aMaps[this.currentMap].getLayers();for(var A=0;A<F.length;A++){var G=F[A].domObj;var C=safeParseInt(G.childNodes[0].style.left);for(var B=0;B<this.nHigh;B++){var E=G.childNodes[((B+1)*this.nWide)-1];var D=G.childNodes[B*this.nWide];E.style.left=(C-this.tileWidth)+"px";E.src=this.aPixel.src;G.removeChild(E);G.insertBefore(E,D);if(F[A].visible){F[A].setTile(E)}}}};kaMap.prototype.wrapL2R=function(){this.xOffset=this.xOffset+(this.nBuffer*this.tileWidth);var F=this.aMaps[this.currentMap].getLayers();for(var A=0;A<F.length;A++){var G=F[A].domObj;var C=safeParseInt(G.childNodes[this.nWide-1].style.left);for(var B=0;B<this.nHigh;B++){var E=G.childNodes[B*this.nWide];var D;if(B<this.nHigh-1){D=G.childNodes[((B+1)*this.nWide)]}else{D=null}E.style.left=(C+this.tileWidth)+"px";E.src=this.aPixel.src;G.removeChild(E);if(D){G.insertBefore(E,D)}else{G.appendChild(E)}if(F[A].visible){F[A].setTile(E)}}}};kaMap.prototype.wrapT2B=function(){this.yOffset=this.yOffset+(this.nBuffer*this.tileHeight);var E=this.aMaps[this.currentMap].getLayers();for(var B=0;B<E.length;B++){var F=E[B].domObj;var D=safeParseInt(F.childNodes[(this.nHigh*this.nWide)-1].style.top);for(var C=0;C<this.nWide;C++){var A=F.childNodes[0];A.style.top=(D+this.tileHeight)+"px";A.src=this.aPixel.src;F.removeChild(A);F.appendChild(A);if(E[B].visible){E[B].setTile(A)}}}};kaMap.prototype.wrapB2T=function(){this.yOffset=this.yOffset-(this.nBuffer*this.tileHeight);var E=this.aMaps[this.currentMap].getLayers();for(var A=0;A<E.length;A++){var F=E[A].domObj;var D=safeParseInt(F.childNodes[0].style.top);for(var C=0;C<this.nWide;C++){var B=F.childNodes[(this.nHigh*this.nWide)-1];B.style.top=(D-this.tileHeight)+"px";B.src=this.aPixel.src;F.removeChild(B);F.insertBefore(B,F.childNodes[0]);if(E[A].visible){E[A].setTile(B)}}}};kaMap.prototype.addMap=function(A){A.kaMap=this;this.aMaps[A.name]=A};kaMap.prototype.getMaps=function(){return this.aMaps};kaMap.prototype.getCurrentMap=function(){return this.aMaps[this.currentMap]};kaMap.prototype.selectMap=function(B){if(!this.aMaps[B]){return false}else{this.currentMap=B;var A=this.getCurrentMap();this.setBackgroundColor(A.backgroundColor);this.setMapLayers();if(arguments[1]&&arguments[1].length==3){this.zoomTo(arguments[1][0],arguments[1][1],arguments[1][2]);A.aZoomTo.length=0}else{if(A.aZoomTo.length!=0){this.zoomTo(A.aZoomTo[0],A.aZoomTo[1],A.aZoomTo[2]);A.aZoomTo.length=0}else{if(arguments[1]&&arguments[1].length==4){this.zoomToExtents(arguments[1][0],arguments[1][1],arguments[1][2],arguments[1][3])}else{this.zoomToExtents(A.currentExtents[0],A.currentExtents[1],A.currentExtents[2],A.currentExtents[3])}}}this.triggerEvent(KAMAP_MAP_INITIALIZED,this.currentMap);return true}};kaMap.prototype.setMapLayers=function(){var A=this.getCurrentMap();for(var B=this.theInsideLayer.childNodes.length-1;B>=0;B--){if(this.theInsideLayer.childNodes[B].className=="mapLayer"){this.theInsideLayer.childNodes[B].appended=false;this.theInsideLayer.removeChild(this.theInsideLayer.childNodes[B])}}layers=A.getLayers();for(var B=0;B<layers.length;B++){if(!layers[B].domObj){var C=this.createMapLayer(layers[B].name);this.theInsideLayer.appendChild(C);C.appended=true;layers[B].domObj=C;layers[B].setOpacity(layers[B].opacity);layers[B].setZIndex(layers[B].zIndex);layers[B].setVisibility(layers[B].visible);this.nWide=0;this.nHigh=0;this.drawGroup(layers[B])}else{if(!layers[B].domObj.appended){this.theInsideLayer.appendChild(layers[B].domObj);layers[B].domObj.appended=true;layers[B].setZIndex(layers[B].zIndex)}}}return true};kaMap.prototype.drawGroup=function(E){var D=this.getObjectWidth(this.domObj);var C=this.getObjectHeight(this.domObj);if(this.viewportWidth==null){this.theInsideLayer.style.top=(-1*this.nCurrentTop+this.yOrigin)+"px";this.theInsideLayer.style.left=(-1*this.nCurrentLeft+this.xOrigin)+"px";this.viewportWidth=D;this.viewportHeight=C}var A=Math.ceil((D/this.tileWidth)+2*this.nBuffer);var B=Math.ceil((C/this.tileHeight)+2*this.nBuffer);this.viewportWidth=D;this.viewportHeight=C;if(this.nHigh==0&&this.nWide==0){this.nWide=A}while(this.nHigh<B){this.appendRow(E)}while(this.nHigh>B){this.removeRow(E)}while(this.nWide<A){this.appendColumn(E)}while(this.nWide>A){this.removeColumn(E)}return true};kaMap.prototype.createMapLayer=function(B){var A=document.createElement("div");A.id=B;A.className="mapLayer";A.style.position="absolute";A.style.visibility="visible";A.style.left="0px";A.style.top="0px";A.style.width="1500px";A.style.height="1500px";A.appended=false;return A};kaMap.prototype.addMapLayer=function(A){var B=this.getCurrentMap();B.addLayer(A);this.setMapLayers();this.paintLayer(A);this.triggerEvent(KAMAP_LAYERS_CHANGED,this.currentMap)};kaMap.prototype.removeMapLayer=function(C){var B=this.getCurrentMap();var A=B.getLayer(C);if(!A){return false}if(B.removeLayer(B.getLayer(C))){this.setMapLayers();this.triggerEvent(KAMAP_LAYERS_CHANGED,this.currentMap)}};kaMap.prototype.getCenter=function(){var E=this.nCurrentLeft-this.xOrigin+safeParseInt(this.theInsideLayer.style.left);var B=this.nCurrentTop-this.yOrigin+safeParseInt(this.theInsideLayer.style.top);var D=this.nCurrentTop-B;var A=this.nCurrentLeft-E;var F=A+this.viewportWidth/2;var C=D+this.viewportHeight/2;return new Array(F,C)};kaMap.prototype.getGeoExtents=function(){var B=-1*(safeParseInt(this.theInsideLayer.style.left)-this.xOrigin)*this.cellSize;var D=B+this.viewportWidth*this.cellSize;var C=(safeParseInt(this.theInsideLayer.style.top)-this.yOrigin)*this.cellSize;var A=C-this.viewportHeight*this.cellSize;return[B,A,D,C]};kaMap.prototype.getMetaExtents=function(){var K=this.getGeoExtents();var B=this.getCurrentMap();layers=B.getLayers();for(var E=0;E<layers.length;E++){if(layers[E].domObj){var F=layers[E].domObj;var D=safeParseInt(F.childNodes[0].style.left);var J=safeParseInt(F.childNodes[0].style.top);var H=this.pixToGeo(D,J,true);var C=-1*H[0];var G=-1*H[1];var I=C+this.nWide*this.tileWidth*this.cellSize;var A=G-this.nHigh*this.tileHeight*this.cellSize;K=[C,A,I,G];break}}return K};kaMap.prototype.zoomIn=function(){this.zoomByFactor(this.aMaps[this.currentMap].zoomIn())};kaMap.prototype.zoomOut=function(){this.zoomByFactor(this.aMaps[this.currentMap].zoomOut())};kaMap.prototype.zoomToScale=function(A){this.zoomByFactor(this.aMaps[this.currentMap].zoomToScale(A))};kaMap.prototype.zoomByFactor=function(A){if(A==1){this.triggerEvent(KAMAP_NOTICE,"NOTICE: changing to current scale aborted");return }this.cellSize=this.cellSize/A;this.setMapLayers();this.initializeLayers(A);this.triggerEvent(KAMAP_SCALE_CHANGED,this.getCurrentScale());this.triggerEvent(KAMAP_EXTENTS_CHANGED,this.getGeoExtents())};kaMap.prototype.getCurrentScale=function(){return this.aMaps[this.currentMap].aScales[this.aMaps[this.currentMap].currentScale]};kaMap.prototype.setLayerQueryable=function(A,B){this.aMaps[this.currentMap].setLayerQueryable(A,B)};kaMap.prototype.setLayerVisibility=function(B,A){if(!this.loadUnchecked&&A){layer=this.aMaps[this.currentMap].getLayer(B);layer.visible=true;this.setMapLayers();this.aMaps[this.currentMap].setLayerVisibility(B,A);this.paintLayer(layer)}else{this.aMaps[this.currentMap].setLayerVisibility(B,A)}};kaMap.prototype.setLayerOpacity=function(B,A){this.aMaps[this.currentMap].setLayerOpacity(B,A)};kaMap.prototype.registerEventID=function(A){return this.eventManager.registerEventID(A)};kaMap.prototype.registerForEvent=function(A,C,B){return this.eventManager.registerForEvent(A,C,B)};kaMap.prototype.deregisterForEvent=function(A,C,B){return this.eventManager.deregisterForEvent(A,C,B)};kaMap.prototype.triggerEvent=function(A){return this.eventManager.triggerEvent.apply(this.eventManager,arguments)};function safeParseInt(A){return Math.round(parseFloat(A))}function _map(A){this.aLayers=[];this.aZoomTo=[];this.kaMap=null;this.name=(typeof (A.name)!="undefined")?A.name:"noname";this.title=(typeof (A.title)!="undefined")?A.title:"no title";this.aScales=(typeof (A.scales)!="undefined")?A.scales:[1];this.currentScale=(typeof (A.currentScale)!="undefined")?parseFloat(A.currentScale):0;this.units=(typeof (A.units)!="undefined")?A.units:5;this.resolution=(typeof (A.resolution)!="undefined")?A.resolution:72;this.defaultExtents=(typeof (A.defaultExtents)!="undefined")?A.defaultExtents:[];this.currentExtents=(typeof (A.currentExtents)!="undefined")?A.currentExtents:[];this.maxExtents=(typeof (A.maxExtents)!="undefined")?A.maxExtents:[];this.backgroundColor=(typeof (A.backgroundColor)!="undefined")?A.backgroundColor:"#ffffff";this.version=(typeof (A.version)!="undefined")?A.version:""}_map.prototype.addLayer=function(A){A._map=this;A.zIndex=this.aLayers.length;this.aLayers.push(A)};_map.prototype.removeLayer=function(B){var D=Array();for(var C=0,A=0;C<this.aLayers.length;C++){if(this.aLayers[C]!=B){D[A]=this.aLayers[C];A++}}this.aLayers=D;return true};_map.prototype.getQueryableLayers=function(){var C=[];var A=this.getLayers();for(var B=0;B<A.length;B++){if(A[B].isQueryable()){C.push(A[B])}}return C};_map.prototype.getLayers=function(){var B=[];for(var A=0;A<this.aLayers.length;A++){if(this.aLayers[A].isVisible()&&(this.aLayers[A].visible||this.kaMap.loadUnchecked)){B.push(this.aLayers[A])}}return B};_map.prototype.getAllQueryableLayers=function(){var B=[];for(var A=0;A<this.aLayers.length;A++){if(this.aLayers[A].isQueryable()){B.push(this.aLayers[A])}}return B};_map.prototype.getAllLayers=function(){return this.aLayers};_map.prototype.getLayer=function(A){for(var B=0;B<this.aLayers.length;B++){if(this.aLayers[B].name==A){return this.aLayers[B]}}};_map.prototype.getScales=function(){return this.aScales};_map.prototype.zoomIn=function(){var A=1;if(this.currentScale<this.aScales.length-1){A=this.aScales[this.currentScale]/this.aScales[this.currentScale+1];this.currentScale=this.currentScale+1}return A};_map.prototype.zoomOut=function(){var A=1;if(this.currentScale>0){A=this.aScales[this.currentScale]/this.aScales[this.currentScale-1];this.currentScale=this.currentScale-1}return A};_map.prototype.zoomToScale=function(C){var B=1;for(var A=0;A<this.aScales.length;A++){if(this.aScales[A]==C){B=this.aScales[this.currentScale]/C;this.currentScale=parseInt(A)}}return B};_map.prototype.setLayerQueryable=function(A,C){var B=this.getLayer(A);if(typeof (B)!="undefined"){B.setQueryable(C)}};_map.prototype.setLayerVisibility=function(B,A){var C=this.getLayer(B);if(typeof (C)!="undefined"){C.setVisibility(A)}};_map.prototype.setLayerOpacity=function(B,A){var C=this.getLayer(B);if(typeof (C)!="undefined"){C.setOpacity(A)}};_map.prototype.setDefaultExtents=function(B,A,D,C){this.defaultExtents=[B,A,D,C];if(this.currentExtents.length==0){this.setCurrentExtents(B,A,D,C)}};_map.prototype.setCurrentExtents=function(B,A,D,C){this.currentExtents=[B,A,D,C]};_map.prototype.setMaxExtents=function(B,A,D,C){this.maxExtents=[B,A,D,C]};_map.prototype.setBackgroundColor=function(A){this.backgroundColor=A};function _layer(B){this.domObj=null;this._map=null;this.name=(typeof (B.name)!="undefined")?B.name:"unnamed";this.visible=(typeof (B.visible)!="undefined")?B.visible:true;this.opacity=(typeof (B.opacity)!="undefined")?B.opacity:100;this.imageformat=(typeof (B.imageformat)!="undefined")?B.imageformat:null;this.queryable=(typeof (B.queryable)!="undefined")?B.queryable:false;this.queryState=(typeof (B.queryable)!="undefined")?B.queryable:false;this.tileSource=(typeof (B.tileSource)!="undefined")?B.tileSource:"auto";this.scales=(typeof (B.scales)!="undefined")?B.scales:new Array(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);this.toLoad=0;var A=new Date();this.timeStamp=Math.round(A.getTime()/1000)+A.getTimezoneOffset()*60;this.redrawInterval=(typeof (B.redrawInterval)!="undefined")?B.redrawInterval:-1;this.refreshInterval=(typeof (B.refreshInterval)!="undefined")?B.refreshInterval:-1;if(this.refreshInterval>0){goQueueManager.enqueue(this.refreshInterval*1000,this,this.redraw)}}_layer.prototype.isQueryable=function(){return this.queryState};_layer.prototype.setQueryable=function(A){if(this.queryable){this.queryState=A}};_layer.prototype.isVisible=function(){return(this.scales[this._map.currentScale]==1)?true:false};_layer.prototype.setOpacity=function(B){this.opacity=B;if(this.domObj){this.domObj.style.opacity=B/100;this.domObj.style.mozOpacity=B/100;for(var A=0;A<this.domObj.childNodes.length;A++){this.domObj.childNodes[A].style.filter="Alpha(opacity="+B+")"}}};_layer.prototype.setTile=function(U){var L=safeParseInt(U.style.left)+this._map.kaMap.xOrigin;var F=safeParseInt(U.style.top)+this._map.kaMap.yOrigin;var I="";var B;var N="";if(this.imageformat&&this.imageformat!=""){N=this.imageformat;I="&i="+N}if(this.tileSource=="cache"){var T=Math.floor(L/(this._map.kaMap.tileWidth*this._map.kaMap.metaWidth))*this._map.kaMap.tileWidth*this._map.kaMap.metaWidth;var K=Math.floor(F/(this._map.kaMap.tileHeight*this._map.kaMap.metaHeight))*this._map.kaMap.tileHeight*this._map.kaMap.metaHeight;var D="t"+K+"/l"+T;var C=(this.name!="")?this.name.replace(/\W/g,"_"):"def";var S=this._map.kaMap.webCache+this._map.name+"/"+this._map.aScales[this._map.currentScale]+"/"+C+"/def/"+D;var M="t"+F+"l"+L;var Q=this.imageformat.toLowerCase().replace(/[\de]/g,"");B=S+"/"+M+"."+Q}else{var E="";if(this._map.version!=""){E="&version="+this._map.version}var R="";var P="";if(arguments[1]){R="&force=true"}var J="";if(this.tileSource=="redraw"||this.tileSource=="refresh"){J="&ts="+this.timeStamp;if(this.redrawInterval){J=J+"&interval="+this.redrawInterval}}var A="&g="+U.layer.domObj.id;var O="&s="+this._map.aScales[this._map.currentScale];var H="?";var G=this._map.kaMap.tileIDX;if(this._map.kaMap.tileURL[G].indexOf("?")!=-1){if(this._map.kaMap.tileURL[G].slice(-1)!="&"){H="&"}else{H=""}}else{var B=this._map.kaMap.tileURL[G]+H+"map="+this._map.name+"&t="+F+"&l="+L+O+R+A+I+J+E}if(U.src!=B){U.style.visibility="hidden";U.src=B}G++;if(G==this._map.kaMap.tileURL.length){this._map.kaMap.tileIDX=0}else{this._map.kaMap.tileIDX=G}}};_layer.prototype.setVisibility=function(A){this.visible=A;if(this.domObj){this.domObj.style.visibility=A?"visible":"hidden";this.domObj.style.display=A?"block":"none";for(var B=0;B<this.domObj.childNodes.length;B++){this.setTile(this.domObj.childNodes[B])}this._map.kaMap.triggerEvent(KAMAP_LAYER_STATUS_CHANGED,this)}};_layer.prototype.setZIndex=function(A){this.zIndex=A;if(this.domObj){this.domObj.style.zIndex=A}};_layer.prototype.setTileLayer=function(){this.loaded=0;for(i=0;i<this.domObj.childNodes.length;i++){img=this.domObj.childNodes[i];if(arguments[0]){this.setTile(img,arguments[0])}else{this.setTile(img)}}};_layer.prototype.redraw=function(){if(arguments[0]){this.refreshInterval=arguments[0]}if(this.visible){var A=new Date();this.timeStamp=Math.round(A.getTime()/1000)+A.getTimezoneOffset()*60;this.setTileLayer()}if(this.refreshInterval>0){goQueueManager.enqueue(this.refreshInterval*1000,this,this.redraw)}};function _eventManager(){this.events=[];this.lastEventID=0}_eventManager.prototype.registerEventID=function(A){var B=new String(A);if(!this.events[A]){this.events[A]=[]}};_eventManager.prototype.registerForEvent=function(A,D,C){var B=new String(A);this.events[A].push([D,C])};_eventManager.prototype.deregisterForEvent=function(C,F,E){var D=new String(C);var A=false;if(!this.events[C]){return false}for(var B=0;B<this.events[C].length;B++){if(this.events[C][B][0]==F&&this.events[C][B][1]==E){this.events[C].splice(B,1);A=true}}return A};_eventManager.prototype.triggerEvent=function(C){var D=new String(C);if(!this.events[C]){return false}var A=new Array();for(B=1;B<arguments.length;B++){A[A.length]=arguments[B]}for(var B=0;B<this.events[C].length;B++){this.events[C][B][1].apply(this.events[C][B][0],arguments)}return true};var goQueueManager=new _queueManager();function _queueManager(){this.queue=new Array()}_queueManager.prototype.enqueue=function(D,E,C,A){var G=this.queue.length;for(var B=0;B<this.queue.length;B++){if(this.queue[B]==null){G=B;break}}var F=window.setTimeout("_queueManager_execute("+G+")",D);this.queue[G]=new Array(F,E,C,A);return G};_queueManager.prototype.dequeue=function(A){if(this.queue[A]!=null){window.clearTimeout(this.queue[A][0]);this.queue[A]=null}};function _queueManager_execute(C){if(goQueueManager.queue[C]!=null){var B=goQueueManager.queue[C][1];var A=goQueueManager.queue[C][2];if(goQueueManager.queue[C][3]!=null){A.apply(B,goQueueManager.queue[C][3])}else{A.apply(B)}goQueueManager.queue[C]=null}};