 function createLayer(name,left,top,width,height,visible,content,pos){var layer;if(document.layers){document.writeln('<layer name="'+name+'" left='+left+' top='+top+' width='+width+' height='+height+' visibility='+(visible ? '"show"' : '"hide"')+'>');document.writeln(content);document.writeln('</layer>');layer=getLayer(name);layer.width=width;layer.height=height;}else{document.writeln('<div id="'+name+'" style="position:absolute;overflow:none;left:'+left+'px;top:'+top+'px;width:'+width+'px;height:'+height+'px;'+' visibility:'+(visible ? 'visible;' : 'hidden;')+' z-index: '+pos+'">');document.writeln(content);document.writeln('</div>');}clipLayer(name,0,0,width,height);}function appendLayer(name,left,top,width,height,visible,content,pos){var layer;var neuerlayer="";if(document.layers){this.layer=new Layer(name);this.layer.document.open();this.layer.document.write(content);this.layer.document.close();this.layer.moveTo(left,top);}else if(document.all){var txt="<DIV ID='"+name+"' STYLE='position:absolute;"+"left:1;"+"top:1;"+"width:25;"+"visibility:hidden'>"+content+"</DIV>";document.body.insertAdjacentHTML("BeforeEnd",txt);this.content=document.all[name];this.layer=document.all[name].style;}else if(document.getElementById){var newDiv;var txt=""+"position:absolute;"+"left:"+left+"px;"+"top:"+top+"px;"+"width:"+width+"px;"+"visibility:hidden";var newRange=document.createRange();newDiv=document.createElement("DIV");newDiv.setAttribute("style",txt);newDiv.setAttribute("id",name);document.body.appendChild(newDiv);newRange.setStartBefore(newDiv);strFrag=newRange.createContextualFragment(content);newDiv.appendChild(strFrag);this.content=newDiv;this.layer=newDiv.style;}clipLayer(name,0,0,width,height);}function createSrcLayer(name,left,top,width,height,visible,source,p_scroll){if(document.all){if(p_scroll==true){f_scroll="yes";}else{f_scroll="no";}document.writeln('<div id="'+name+'" style="position:absolute;overflow:none;left:'+left+'px;top:'+top+'px;width:'+width+'px;height:'+height+'px;'+' visibility:'+(visible ? 'visible;' : 'hidden;')+'">');document.writeln('<iframe name="'+name+'_" src="'+source+'" border=0 scrolling="'+f_scroll+'" style="left:1px;top:1px;width:'+width+'px;height:'+height+'px;'+'"></iframe></div>');}}function getSrcLayer(p_name){var f_frame;f_frame=eval('document.getElementById(["'+p_name+'_"])');return f_frame;}function setLayerSrc(p_name,p_src){var f_frame;f_frame=getSrcLayer(p_name);f_frame.src=p_src;}function getLayer(name){if(document.layers)return(document.layers[name]);else if(document.getElementById){if(eval('document.getElementById(["'+name+'"])')!=null){layer=eval('document.getElementById(["'+name+'"]).style');return(layer);}else return null;}else if(document.all){if(eval('document.all.'+name)!=null){layer=eval('document.all.'+name+'.style');return(layer);}else return(null);}else return(null);}function moveLayer(name,x,y){var layer=getLayer(name);if(layer!=null){if(document.layers){layer.moveTo(x,y);}else if(document.all){layer.left=x;layer.top=y;}else{layer.left=x+"px";layer.top=y+"px";}}}function setLayerBackgroundImage(name,image){var layer=getLayer(name);if(layer!=null){if(document.layers)layer.background=image;else layer.style.background=image;}}function setLayerBackgroundColor(name,color){var layer=getLayer(name);if(layer!=null){if(document.layers)layer.bgColor=color;else layer.backgroundColor=color;}}function hideLayer(name){var layer=getLayer(name);if(layer!=null){if(document.layers)layer.visibility="hide";else layer.visibility="hidden";}}function showLayer(name){var layer=getLayer(name);if(layer!=null){if(document.layers)layer.visibility="show";else layer.visibility="visible";}}function clipLayer(name,clipleft,cliptop,clipright,clipbottom){var layer=getLayer(name);if(layer!=null){if(document.layers){layer.clip.left=clipleft;layer.clip.top=cliptop;layer.clip.right=clipright;layer.clip.bottom=clipbottom;}else{layer.clip='rect('+cliptop+' '+clipright+' '+clipbottom+' '+clipleft+')';}}}function replaceLayerContent(name,content){var layer=getLayer(name);if(layer!=null){if(document.layers){layer.document.open();layer.document.writeln(content);layer.document.close();}else if(document.all){if(eval("document.all."+name)!=null){content=content.replace(/\'/g,"\\'");var str="document.all."+name+".innerHTML='"+content+"'";eval(str);}}else if(document.getElementById){if(document.getElementById([name])!=null){document.getElementById([name]).innerHTML=content;}}}}function isLayerVisible(name){var layer=getLayer(name);if(layer!=null){if(document.layers){if(layer.visibility=="show"){return true;}else{return false;}}else{if(layer.visibility=="visible"){return true;}else{return false;}}}}
var debug=false;var message_window=null;if(debug){message_window=window.open("_blank","message_window");debugMessage("Debug window opened!");}function debugMessage(message){if(debug && message_window){now=new Date();timeString=now.toGMTString();ms=now.getMilliseconds();if(ms<10){msString="00"+ms;}else if(ms<100){msString="0"+ms;}else{msString=ms;}timeString=timeString.substring(0,timeString.indexOf("GMT")-1)+"."+msString+timeString.substring(timeString.indexOf("GMT")-1,timeString.length);message_window.document.write("<span=\"font-family:Arial,sans-serif;font-size:8pt\">");message_window.document.write("[ "+msString+" ] "+message+"</span><BR>");}}function debugXML(response){if(debug){processed_response=response.replace(/</g,"&lt;");processed_response=processed_response.replace(/>/g,"&gt;");message="XML Response\n<span style=\"font-family:Arial,sans-serif;"+"font-size:8pt\">\n"+processed_response+"</span>";debugMessage(message);}}
 var isCSS,isW3C,isIE4,isNN4;function initDHTMLAPI(){if(document.images){isCSS=(document.body && document.body.style)? true : false;isW3C=(isCSS && document.getElementById)? true : false;isIE4=(isCSS && document.all)? true : false;isNN4=(document.layers)? true : false;isIE6CSS=(document.compatMode && document.compatMode.indexOf("CSS1")>=0)? true : false;}}function seekLayer(doc,name){var theObj;for(var i=0;i<doc.layers.length;i++){if(doc.layers[i].name==name){theObj=doc.layers[i];break;}if(doc.layers[i].document.layers.length>0){theObj=seekLayer(document.layers[i].document,name);}}return theObj;}function getRawObject(obj){var theObj;if(typeof obj=="string"){if(isW3C){theObj=document.getElementById(obj);}else if(isIE4){theObj=document.all(obj);}else if(isNN4){theObj=seekLayer(document,obj);}}else{theObj=obj;}return theObj;}function getObject(obj){var theObj=getRawObject(obj);if(theObj && isCSS){theObj=theObj.style;}return theObj;}function shiftTo(obj,x,y){var theObj=getObject(obj);if(theObj){if(isCSS){var units=(typeof theObj.left=="string")? "px" : 0;theObj.left=x+units;theObj.top=y+units;}else if(isNN4){theObj.moveTo(x,y)}}}function shiftBy(obj,deltaX,deltaY){var theObj=getObject(obj);if(theObj){if(isCSS){var units=(typeof theObj.left=="string")? "px" : 0;theObj.left=getObjectLeft(obj)+deltaX+units;theObj.top=getObjectTop(obj)+deltaY+units;}else if(isNN4){theObj.moveBy(deltaX,deltaY);}}}function setZIndex(obj,zOrder){var theObj=getObject(obj);if(theObj){theObj.zIndex=zOrder;}}function setBGColor(obj,color){var theObj=getObject(obj);if(theObj){if(isNN4){theObj.bgColor=color;}else if(isCSS){theObj.backgroundColor=color;}}}function show(obj){var theObj=getObject(obj);if(theObj){theObj.visibility="visible";}}function hide(obj){var theObj=getObject(obj);if(theObj){theObj.visibility="hidden";}}function getObjectLeft(obj){var elem=getRawObject(obj);var result=0;if(document.defaultView){var style=document.defaultView;var cssDecl=style.getComputedStyle(elem,"");result=cssDecl.getPropertyValue("left");}else if(elem.currentStyle){result=elem.currentStyle.left;}else if(elem.style){result=elem.style.left;}else if(isNN4){result=elem.left;}return parseInt(result);}function getObjectTop(obj){var elem=getRawObject(obj);var result=0;if(document.defaultView){var style=document.defaultView;var cssDecl=style.getComputedStyle(elem,"");result=cssDecl.getPropertyValue("top");}else if(elem.currentStyle){result=elem.currentStyle.top;}else if(elem.style){result=elem.style.top;}else if(isNN4){result=elem.top;}return parseInt(result);}function getObjectWidth(obj){var elem=getRawObject(obj);var result=0;if(elem.offsetWidth){result=elem.offsetWidth;}else if(elem.clip && elem.clip.width){result=elem.clip.width;}else if(elem.style && elem.style.pixelWidth){result=elem.style.pixelWidth;}return parseInt(result);}function getObjectHeight(obj){var elem=getRawObject(obj);var result=0;if(elem.offsetHeight){result=elem.offsetHeight;}else if(elem.clip && elem.clip.height){result=elem.clip.height;}else if(elem.style && elem.style.pixelHeight){result=elem.style.pixelHeight;}return parseInt(result);}function getInsideWindowWidth(){if(window.innerWidth){return window.innerWidth;}else if(isIE6CSS){return document.body.parentElement.clientWidth;}else if(document.body && document.body.clientWidth){return document.body.clientWidth;}return 0;}function getInsideWindowHeight(){if(window.innerHeight){return window.innerHeight;}else if(isIE6CSS){return document.body.parentElement.clientHeight;}else if(document.body && document.body.clientHeight){return document.body.clientHeight;}return 0;}
 var aXmlHttp=new Array();var aXmlResponse=new Array();function xmlResult(){for(var i=0;i<aXmlHttp.length;i++){if(aXmlHttp[i] && aXmlHttp[i][0] && aXmlHttp[i][0].readyState==4&&aXmlHttp[i][0].responseText){var f=aXmlHttp[i][2];var o=aXmlHttp[i][1];var s=aXmlHttp[i][0].responseText;aXmlHttp[i][0]=null;aXmlHttp[i][1]=null;aXmlHttp[i]=null;f.apply(o,new Array(s));}}}function httpRequest(u,o,f){call(u,o,f);}function call(u,o,f){var method="GET";var dat;if(arguments.length==4){method="POST";tmp=u.split(/\?/);u=tmp[0];dat=tmp[1];}var idx=aXmlHttp.length;for(var i=0;i<idx;i++)if(aXmlHttp[i]==null){idx=i;break;}aXmlHttp[idx]=new Array(2);aXmlHttp[idx][0]=getXMLHTTP();aXmlHttp[idx][1]=o;aXmlHttp[idx][2]=f;if(aXmlHttp[idx]){aXmlHttp[idx][0].open(method,u,true);if(method=="POST"){aXmlHttp[idx][0].setRequestHeader("Content-Type","application/x-www-form-urlencoded");aXmlHttp[idx][0].send(dat);}aXmlHttp[idx][0].onreadystatechange=xmlResult;if(method=="GET"){aXmlHttp[idx][0].send(null);}}}function getXMLHTTP(){var A=null;if(!A && typeof XMLHttpRequest !="undefined"){A=new XMLHttpRequest();}if(!A){try{A=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{A=new ActiveXObject("Microsoft.XMLHTTP");}catch(oc){A=null}}}return A;}
 var gnLastEventId=0;var MAP_ERROR=gnLastEventId++;var MAP_WARNING=gnLastEventId++;var MAP_NOTICE=gnLastEventId++;var MAP_INITIALIZED=gnLastEventId++;var MAP_MAP_INITIALIZED=gnLastEventId++;var MAP_EXTENTS_CHANGED=gnLastEventId++;var MAP_EXTENTS_MOVED=gnLastEventId++;var MAP_SCALE_CHANGED=gnLastEventId++;var MAP_LAYERS_CHANGED=gnLastEventId++;var MAP_LAYER_STATUS_CHANGED=gnLastEventId++;var MAP_CONTEXT_MENU=gnLastEventId++;var MAP_METAEXTENTS_CHANGED=gnLastEventId++;var MAP_MAP_CLICKED=gnLastEventId++;function Map(szID){debugMessage("Map("+szID+')');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(szID);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.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.aObjects=[];this.aCanvases=[];this.layersHidden=false;this.aTools=[];this.aInfoTools=[];for(var i=0;i<gnLastEventId;i++){this.registerEventID(i);}this.createLayers();};Map.prototype.seekLayer=function(doc,name){var theObj;for(var i=0;i<doc.layers.length;i++){if(doc.layers[i].name==name){theObj=doc.layers[i];break;}if(doc.layers[i].document.layers.length>0){theObj=this.seekLayer(document.layers[i].document,name);}}return theObj;};Map.prototype.getRawObject=function(obj){var theObj;if(typeof obj=="string"){if(this.isW3C){theObj=document.getElementById(obj);}else if(this.isIE4){theObj=document.all(obj);}else if(this.isNN4){theObj=seekLayer(document,obj);}}else{theObj=obj;}return theObj;};Map.prototype.getObject=function(obj){var theObj=this.getRawObject(obj);if(theObj && this.isCSS){theObj=theObj.style;}return theObj;};Map.prototype.getObjectWidth=function(obj){var elem=this.getRawObject(obj);var result=0;if(elem.offsetWidth){result=elem.offsetWidth;}else if(elem.clip && elem.clip.width){result=elem.clip.width;}else if(elem.style && elem.style.pixelWidth){result=elem.style.pixelWidth;}return parseInt(result);};Map.prototype.getObjectHeight=function(obj){var elem=this.getRawObject(obj);var result=0;if(elem.offsetHeight){result=elem.offsetHeight;}else if(elem.clip && elem.clip.height){result=elem.clip.height;}else if(elem.style && elem.style.pixelHeight){result=elem.style.pixelHeight;}return parseInt(result);};Map.prototype.zoomTo=function(cgX,cgY){var oMap=this.getCurrentMap();var inchesPerUnit=new Array(1,12,63360.0,39.3701,39370.1,4374754);var newScale;var bScaleChanged=false;if(arguments.length==3){newScale=arguments[2];if(newScale==0)newScale=this.getCurrentScale();bScaleChanged=(newScale !=this.getCurrentScale())}else{newScale=this.getCurrentScale();}var bZoomTo=true;if(!bScaleChanged){var extents=this.getGeoExtents();if(cgX>=extents[0] && cgX<=extents[2] && cgY>=extents[1] && cgY<=extents[3]){var cx=(extents[0]+extents[2])/2;var cy=(extents[1]+extents[3])/2;var dx=(cx-cgX)/this.cellSize;var dy=(cgY-cy)/this.cellSize;this.slideBy(dx,dy);bZoomTo=false;}}if(bZoomTo){this.cellSize=newScale/(oMap.resolution*inchesPerUnit[oMap.units]);var nFactor=oMap.zoomToScale(newScale);this.setMapLayers();var cpX=cgX/this.cellSize;var cpY=cgY/this.cellSize;var vpLeft=Math.round(cpX-this.viewportWidth/2);var vpTop=Math.round(cpY+this.viewportHeight/2);var cTileX=Math.floor(cpX/this.tileWidth)*this.tileWidth;var cTileY=Math.floor(cpY/this.tileHeight)*this.tileHeight;var nTilesLeft=Math.ceil(this.viewportWidth/(2*this.tileWidth))*this.tileWidth;var nTilesUp=Math.ceil(this.viewportHeight/(2*this.tileHeight))*this.tileHeight;this.nCurrentLeft=cTileX-nTilesLeft;this.nCurrentTop=-1*(cTileY+nTilesUp);this.xOrigin=this.nCurrentLeft;this.yOrigin=this.nCurrentTop;this.theInsideLayer.style.left=-1*(vpLeft-this.xOrigin)+"px";this.theInsideLayer.style.top=(vpTop+this.yOrigin)+"px";var layers=oMap.getLayers();for(var k=0;k<layers.length;k++){var d=layers[k].domObj;for(var j=0;j<this.nHigh;j++){for(var i=0;i<this.nWide;i++){var img=d.childNodes[(j*this.nWide)+i];img.src=this.aPixel.src;img.style.top=(this.nCurrentTop+j*this.tileHeight-this.yOrigin)+"px";img.style.left=(this.nCurrentLeft+i*this.tileWidth-this.xOrigin)+"px";layers[k].setTile(img);}}}this.checkWrap();this.updateObjects();}if(bScaleChanged){this.triggerEvent(MAP_SCALE_CHANGED,this.getCurrentScale());}this.triggerEvent(MAP_EXTENTS_CHANGED,this.getGeoExtents());};Map.prototype.zoomToExtents=function(minx,miny,maxx,maxy){var inchesPerUnit=new Array(1,12,63360.0,39.3701,39370.1,4374754);var oMap=this.getCurrentMap();var cgX=(maxx+minx)/2;var cgY=(maxy+miny)/2;var tmpCellSizeX=Math.abs((maxx-minx)/this.viewportWidth);var tmpCellSizeY=Math.abs((maxy-miny)/this.viewportHeight);var tmpCellSize=Math.max(tmpCellSizeX,tmpCellSizeY);var tmpScale=tmpCellSize*oMap.resolution*inchesPerUnit[oMap.units];var newScale=oMap.aScales[0];for(var i=1;i<oMap.aScales.length;i++){if(tmpScale>=oMap.aScales[i]){break;}newScale=oMap.aScales[i];}this.cellSize=newScale/(oMap.resolution*inchesPerUnit[oMap.units]);var nFactor=oMap.zoomToScale(newScale);this.setMapLayers();var cpX=cgX/this.cellSize;var cpY=cgY/this.cellSize;var vpLeft=Math.round(cpX-this.viewportWidth/2);var vpTop=Math.round(cpY+this.viewportHeight/2);var cTileX=Math.floor(cpX/this.tileWidth)*this.tileWidth;var cTileY=Math.floor(cpY/this.tileHeight)*this.tileHeight;var nTilesLeft=Math.ceil(this.viewportWidth/(2*this.tileWidth))*this.tileWidth;var nTilesUp=Math.ceil(this.viewportHeight/(2*this.tileHeight))*this.tileHeight;this.nCurrentLeft=cTileX-nTilesLeft;this.nCurrentTop=-1*(cTileY+nTilesUp);this.xOrigin=this.nCurrentLeft;this.yOrigin=this.nCurrentTop;this.theInsideLayer.style.left=-1*(vpLeft-this.xOrigin)+"px";this.theInsideLayer.style.top=(vpTop+this.yOrigin)+"px";var layers=oMap.getLayers();for(var k=0;k<layers.length;k++){var d=layers[k].domObj;for(var j=0;j<this.nHigh;j++){for(var i=0;i<this.nWide;i++){var img=d.childNodes[(j*this.nWide)+i];img.src=this.aPixel.src;img.style.top=(this.nCurrentTop+j*this.tileHeight-this.yOrigin)+"px";img.style.left=(this.nCurrentLeft+i*this.tileWidth-this.xOrigin)+"px";layers[k].setTile(img);}}}this.checkWrap();this.updateObjects();this.triggerEvent(MAP_SCALE_CHANGED,this.getCurrentScale());this.triggerEvent(MAP_EXTENTS_CHANGED,this.getGeoExtents());};Map.prototype.createDrawingCanvas=function(idx){var d=document.createElement('div');d.style.position='absolute';d.style.left='0px';d.style.top='0px';d.style.width='3000px';d.style.height='3000px';d.style.zIndex=idx;this.theInsideLayer.appendChild(d);this.aCanvases.push(d);d.Map=this;return d;};Map.prototype.removeDrawingCanvas=function(canvas){for(var i=0;i<this.aCanvases.length;i++){if(this.aCanvases[i]==canvas){this.aCanvases.splice(i,1);}}this.theInsideLayer.removeChild(canvas);canvas.Map=null;return true;};Map.prototype.addObjectGeo=function(canvas,lon,lat,obj){obj.lon=lon;obj.lat=lat;var aPix=this.geoToPix(lon,lat);return this.addObjectPix(canvas,aPix[0],aPix[1],obj);};Map.prototype.addObjectPix=function(canvas,x,y,obj){var xOffset=(obj.xOffset)? obj.xOffset : 0;var yOffset=(obj.yOffset)? obj.yOffset : 0;var top=(y-this.yOrigin+yOffset);var left=(x-this.xOrigin+xOffset);obj.style.position='absolute';obj.style.top=top+"px";obj.style.left=left+"px";this.addObject(canvas,obj);return true;};Map.prototype.addObject=function(canvas,obj){obj.canvas=canvas;canvas.appendChild(obj);this.aObjects.push(obj);return true;};Map.prototype.shiftObject=function(x,y,obj){var top=safeParseInt(obj.style.top);var left=safeParseInt(obj.style.left);obj.style.top=(top+y)+"px";obj.style.left=(left+x)+"px";return true;};Map.prototype.removeObject=function(obj){if(obj==null){for(var i=0;i<this.aObjects.length;i++){obj=this.aObjects[i];if(obj.canvas){obj.canvas.removeChild(obj);}}this.aObjects=[];return true;}else{for(var i=0;i<this.aObjects.length;i++){if(this.aObjects[i]==obj){obj=this.aObjects[i];if(obj.canvas){obj.canvas.removeChild(obj);obj.canvas=null;}this.aObjects.splice(i,1);return true;}}return false;}};Map.prototype.removeAllObjects=function(canvas){for(var i=0;i<this.aObjects.length;i++){obj=this.aObjects[i];if(obj.canvas && obj.canvas==canvas){obj.canvas.removeChild(obj);obj.canvas=null;this.aObjects.splice(i--,1);}}return true;};Map.prototype.centerObject=function(obj){var vpX=-safeParseInt(this.theInsideLayer.style.left)+this.viewportWidth/2;var vpY=-safeParseInt(this.theInsideLayer.style.top)+this.viewportHeight/2;var xOffset=(obj.xOffset)?obj.xOffset:0;var yOffset=(obj.yOffset)?obj.yOffset:0;var dx=safeParseInt(obj.style.left)-xOffset-vpX;var dy=safeParseInt(obj.style.top)-yOffset-vpY;this.slideBy(-dx,-dy);return true;};Map.prototype.geoToPix=function(gX,gY){var pX=gX/this.cellSize;var pY=-1*gY/this.cellSize;debugMessage("Map.prototype.geoToPix():cellZize="+this.cellSize+" gX="+gX+" gY="+gY+" pX="+Math.floor(pX)+" pY="+Math.floor(pY));return [Math.floor(pX),Math.floor(pY)];};Map.prototype.pixToGeo=function(pX,pY){var bAdjust=(arguments.length==3 && arguments[2])? true : false;if(bAdjust){pX=pX+this.xOrigin;pY=pY+this.yOrigin;}var gX=-1*pX*this.cellSize;var gY=pY*this.cellSize;return [gX,gY];};Map.prototype.initialize=function(){if(this.initializationState==2){this.triggerEvent(MAP_ERROR,'ERROR: Map! is already initialized!');return false;}else if(this.intializationState==1){this.triggerEvent(MAP_WARNING,'WARNING: Map! is currently initializing ... wait for the MAP_INITIALIZED event to be triggered.');return false;}this.initializationState=1;var szURL=this.server+this.init;var sep=(this.init.indexOf("?")==-1)? "?" : "&";if(arguments.length>0 && arguments[0] !=''){szURL=szURL+sep+"map="+arguments[0];sep="&";}if(arguments.length>1 && arguments[1] !=''){szURL=szURL+sep+"extents="+arguments[1];sep="&";}if(arguments.length>2 && arguments[2] !=''){szURL=szURL+sep+"centerPoint="+arguments[2];sep="&";}call(szURL,this,this.initializeCallback);return true;};Map.prototype.initializeCallback=function(szInit){if(szInit.substr(0,1)!="/"){this.triggerEvent(MAP_ERROR,'ERROR: ka-Map! initialization '+'failed on the server. Message returned was:\n'+szInit);return false;}eval(szInit);this.triggerEvent(MAP_INITIALIZED);this.initializationState=2;};Map.prototype.setBackgroundColor=function(color){this.domObj.style.backgroundColor=color;return true;};Map.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.Map=this;if(this.currentTool){this.theInsideLayer.style.cursor=this.currentTool.cursor;}this.domObj.appendChild(this.theInsideLayer);this.domObj.Map=this;this.theInsideLayer.onmousedown=Map_onmousedown;this.theInsideLayer.onmouseup=Map_onmouseup;this.theInsideLayer.onmousemove=Map_onmousemove;this.theInsideLayer.onmouseover=Map_onmouseover;this.domObj.onmouseout=Map_onmouseout;this.theInsideLayer.onkeypress=Map_onkeypress;this.theInsideLayer.ondblclick=Map_ondblclick;this.theInsideLayer.oncontextmenu=Map_oncontextmenu;this.theInsideLayer.onmousewheel=Map_onmousewheel;if(window.addEventListener && navigator.product && navigator.product=="Gecko"){this.domObj.addEventListener("DOMMouseScroll",Map_onmousewheel,false);}this.theInsideLayer.ondragstart=new Function([],'var e=e?e:event;e.cancelBubble=true;e.returnValue=false;return false;');};Map.prototype.initializeLayers=function(nFactor){var deltaMouseX=this.nCurrentLeft+safeParseInt(this.theInsideLayer.style.left)-this.xOrigin;var deltaMouseY=this.nCurrentTop+safeParseInt(this.theInsideLayer.style.top)-this.yOrigin;var vpTop=this.nCurrentTop-deltaMouseY;var vpLeft=this.nCurrentLeft-deltaMouseX;var vpCenterX=vpLeft+this.viewportWidth/2;var vpCenterY=vpTop+this.viewportHeight/2;var currentTileX=Math.floor(vpCenterX/this.tileWidth)*this.tileWidth;var currentTileY=Math.floor(vpCenterY/this.tileHeight)*this.tileHeight;var tileDeltaX=currentTileX-this.nCurrentLeft;var tileDeltaY=currentTileY-this.nCurrentTop;var newVpCenterX=vpCenterX*nFactor;var newVpCenterY=vpCenterY*nFactor;var newTileX=Math.floor(newVpCenterX/this.tileWidth)*this.tileWidth;var newTileY=Math.floor(newVpCenterY/this.tileHeight)*this.tileHeight;var newCurrentLeft=newTileX-tileDeltaX;var newCurrentTop=newTileY-tileDeltaY;this.nCurrentLeft=newCurrentLeft;this.nCurrentTop=newCurrentTop;var newTilLeft=-newVpCenterX+this.viewportWidth/2;var newTilTop=-newVpCenterY+this.viewportHeight/2;var xOldOrigin=this.xOrigin;var yOldOrigin=this.yOrigin;this.xOrigin=this.nCurrentLeft;this.yOrigin=this.nCurrentTop;this.theInsideLayer.style.left=(newTilLeft+this.xOrigin)+"px";this.theInsideLayer.style.top=(newTilTop+this.yOrigin)+"px";var layers=this.aMaps[this.currentMap].getLayers();for(var k=0;k<layers.length;k++){var d=layers[k].domObj;for(var j=0;j<this.nHigh;j++){for(var i=0;i<this.nWide;i++){var img=d.childNodes[(j*this.nWide)+i];img.src=this.aPixel.src;img.style.top=(this.nCurrentTop+j*this.tileHeight-this.yOrigin)+"px";img.style.left=(this.nCurrentLeft+i*this.tileWidth-this.xOrigin)+"px";layers[k].setTile(img);}}}this.checkWrap();this.updateObjects();};Map.prototype.paintLayer=function(l){var d=l.domObj;for(var j=0;j<this.nHigh;j++){for(var i=0;i<this.nWide;i++){var img=d.childNodes[(j*this.nWide)+i];img.style.top=(this.nCurrentTop+j*this.tileHeight-this.yOrigin)+"px";img.style.left=(this.nCurrentLeft+i*this.tileWidth-this.xOrigin)+"px";l.setTile(img);}}this.checkWrap();};Map.prototype.updateObjects=function(){for(var i=0;i<this.aObjects.length;i++){var obj=this.aObjects[i];var xOffset=(obj.xOffset)? obj.xOffset : 0;var yOffset=(obj.yOffset)? obj.yOffset : 0;var aPix=this.geoToPix(obj.lon,obj.lat);var top=(aPix[1]-this.yOrigin+yOffset);var left=(aPix[0]-this.xOrigin+xOffset);obj.style.top=top+"px";obj.style.left=left+"px";}};Map.prototype.resize=function(){if(this.initializationState !=2){return false;}var newViewportWidth=this.getObjectWidth(this.domObj);var newViewportHeight=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=newViewportWidth;this.viewportHeight=newViewportHeight;}var newWide=Math.ceil((newViewportWidth/this.tileWidth)+2*this.nBuffer);var newHigh=Math.ceil((newViewportHeight/this.tileHeight)+2*this.nBuffer);this.viewportWidth=newViewportWidth;this.viewportHeight=newViewportHeight;if(this.nHigh==0 && this.nWide==0){this.nWide=newWide;}while(this.nHigh<newHigh){this.appendRow();}while(this.nHigh>newHigh && newHigh>3){this.removeRow();}while(this.nWide<newWide){this.appendColumn();}while(this.nWide>newWide && newWide>3){this.removeColumn();}var map=this.getCurrentMap();var layers=map.getLayers();for(i=0;i<layers.length;i++){layers[i].setTileLayer();}this.triggerEvent(MAP_EXTENTS_CHANGED,this.getGeoExtents());this.triggerEvent(MAP_EXTENTS_CHANGED,this.getGeoExtents());};Map.prototype.createImage=function(top,left,obj){var img=document.createElement('img');img.src=this.aPixel.src;img.width=this.tileWidth;img.height=this.tileHeight;img.setAttribute('style','position:absolute;top:'+top+'px;left:'+left+'px;');img.style.position='absolute';img.style.top=(top-this.yOrigin)+'px';img.style.left=(left-this.xOrigin)+'px';img.style.width=this.tileWidth+"px";img.style.height=this.tileHeight+"px";img.style.visibility='hidden';img.galleryimg="no";img.onerror=Map_imgOnError;img.onload=Map_imgOnLoad;img.errorCount=0;img.id="i"+this.gImageID;img.layer=obj;img.Map=this;this.gImageID=this.gImageID+1;img.ie_hack=false;if(this.isIE4){if(obj.imageformat &&(obj.imageformat.toLowerCase()=="alpha")){img.ie_hack=true;}}return img;};Map.prototype.resetTile=function(id,bForce){var img=this.DHTMLapi.getRawObject(id);if(img.layer){img.layer.setTile(this,bForce);}};Map.prototype.reloadImage=function(id){};Map.prototype.resetImage=function(id){};Map_imgOnError=function(e){if(this.layer){this.layer.setTile(this,true);}};Map_imgOnLoad=function(e){if((this.ie_hack)&&(this.src !=this.Map.aPixel.src)){var src=this.src;this.src=this.Map.aPixel.src;this.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"')";}this.style.visibility='visible';};Map.prototype.appendRow=function(layer){if(this.nWide==0){return;}var layers=null;if(arguments.length==1){layers=Array(layer);}else{layers=this.aMaps[this.currentMap].getLayers();}for(var i=0;i<layers.length;i++){var obj=layers[i].domObj;for(var j=0;j<this.nWide;j++){var top=this.nCurrentTop+(this.nHigh*this.tileHeight);var left=this.nCurrentLeft+(j*this.tileWidth);var img=this.createImage(top,left,layers[i]);if(this.isIE4){img.style.filter="Alpha(opacity="+layers[i].opacity+")";}obj.appendChild(img);}}this.nHigh=this.nHigh+1;};Map.prototype.appendColumn=function(layer){if(this.nHigh==0){return;}var layers=null;if(arguments.length==1){layers=Array(layer);}else{layers=this.aMaps[this.currentMap].getLayers();}for(var i=0;i<layers.length;i++){var obj=layers[i].domObj;for(var j=this.nHigh-1;j>=0;j--){var top=this.nCurrentTop+(j*this.tileHeight);var left=this.nCurrentLeft+(this.nWide*this.tileWidth);var img=this.createImage(top,left,layers[i]);if(this.isIE4){img.style.filter="Alpha(opacity="+layers[i].opacity+")";}if(j<this.nHigh-1){obj.insertBefore(img,obj.childNodes[((j+1)*this.nWide)]);}else{obj.appendChild(img);}}}this.nWide=this.nWide+1;};Map.prototype.removeColumn=function(layer){if(this.nWide<3){return;}var layers=null;if(arguments.length==1){layers=Array(layer);}else{layers=this.aMaps[this.currentMap].getLayers();}for(var i=0;i<layers.length;i++){var d=layers[i].domObj;for(var j=this.nHigh-1;j>=0;j--){var img=d.childNodes[((j+1)*this.nWide)-1];d.removeChild(img);img.onload=null;img.onerror=null;}}this.nWide=this.nWide-1;};Map.prototype.removeRow=function(layer){if(this.nHigh<3){return;}var layers=null;if(arguments.length==1){layers=Array(layer);}else{layers=this.aMaps[this.currentMap].getLayers();}for(var i=0;i<layers.length;i++){var d=layers[i].domObj;for(var j=this.nWide-1;j>=0;j--){var img=d.childNodes[((this.nHigh-1)*this.nWide)+j];d.removeChild(img);img.onload=null;img.onerror=null;}}this.nHigh=this.nHigh-1;};Map.prototype.hideLayers=function(){if(!this.hideLayersOnMove){return;}if(this.layersHidden){return;}var layers=this.aMaps[this.currentMap].getLayers();for(var i=0;i<layers.length;i++){layers[i]._visible=layers[i].visible;if(layers[i].name !='__base__'){layers[i].setVisibility(false);}}for(var i=0;i<this.aCanvases.length;i++){this.aCanvases[i].style.visibility='hidden';this.aCanvases[i].style.display='none';}this.layersHidden=true;};Map.prototype.showLayers=function(){if(!this.hideLayersOnMove){return;}if(!this.layersHidden){return;}var layers=this.aMaps[this.currentMap].getLayers();for(var i=0;i<layers.length;i++){layers[i].setVisibility(layers[i]._visible);}for(var i=0;i<this.aCanvases.length;i++){this.aCanvases[i].style.visibility='visible';this.aCanvases[i].style.display='block';}this.layersHidden=false;};Map.prototype.moveBy=function(x,y){var til=this.theInsideLayer;til.style.top=(safeParseInt(til.style.top)+y)+'px';til.style.left=(safeParseInt(til.style.left)+x)+'px';this.checkWrap();};Map.prototype.slideBy=function(x,y){if(this.slideid!=null){goQueueManager.dequeue(this.slideid);}this.as=[];var absX=Math.abs(x);var absY=Math.abs(y);var signX=x/absX;var signY=y/absY;var distance=absX>absY?absX:absY;var steps=Math.floor(distance/this.pixelsPerStep);var dx=dy=0;if(steps>0){dx=(x)/(steps*this.pixelsPerStep);dy=(y)/(steps*this.pixelsPerStep);}var remainderX=x-dx*steps*this.pixelsPerStep;var remainderY=y-dy*steps*this.pixelsPerStep;var px=py=0;var curspeed=this.accelerationFactor;var i=0;while(i<steps){if(i>0){px+=this.as[i-1][0];py+=this.as[i-1][1];}var cx=px+Math.round(dx*this.pixelsPerStep);var cy=py+Math.round(dy*this.pixelsPerStep);this.as[i]=new Array(cx-px,cy-py);i++;}if(remainderX !=0 || remainderY !=0){this.as[i]=[remainderX,remainderY];}this.hideLayers();this.slideid=goQueueManager.enqueue(this.timePerStep,this,this.slide,[0]);};Map.prototype.slide=function(pos){if(pos>=this.as.length){this.as=slideid=null;this.showLayers();this.triggerEvent(MAP_EXTENTS_CHANGED,this.getGeoExtents());return;}this.moveBy(this.as[pos][0],this.as[pos][1]);this.triggerEvent(MAP_EXTENTS_MOVED,this.getGeoExtents());pos++;this.slideid=goQueueManager.enqueue(this.timePerStep,this,this.slide,[ pos]);};Map_onkeypress=function(e){if(this.Map.currentTool){this.Map.currentTool.onkeypress(e);}if(this.Map.aInfoTools.length>0){for(var i=0;i<this.Map.aInfoTools.length;i++){this.Map.aInfoTools[i].onkeypress(e);}}};Map_onmousemove=function(e){e=(e)?e:((event)?event:null);if(e.button==2){this.Map.triggerEvent(MAP_CONTEXT_MENU);}if(this.Map.currentTool){this.Map.currentTool.onmousemove(e);}if(this.Map.aInfoTools.length>0){for(var i=0;i<this.Map.aInfoTools.length;i++){this.Map.aInfoTools[i].onmousemove(e);}}};Map_onmousedown=function(e){if(this.Map.currentTool){this.Map.currentTool.onmousedown(e);}if(this.Map.aInfoTools.length>0){for(var i=0;i<this.Map.aInfoTools.length;i++){this.Map.aInfoTools[i].onmousedown(e);}}};Map_onmouseup=function(e){if(this.Map.currentTool){this.Map.currentTool.onmouseup(e);}if(this.Map.aInfoTools.length>0){for(var i=0;i<this.Map.aInfoTools.length;i++){this.Map.aInfoTools[i].onmouseup(e);}}};Map_onmouseover=function(e){};Map_onmouseout=function(e){if(this.Map.currentTool){this.Map.currentTool.onmouseout(e);}if(this.Map.aInfoTools.length>0){for(var i=0;i<this.Map.aInfoTools.length;i++){this.Map.aInfoTools[i].onmouseout(e);}}};Map_oncontextmenu=function(e){e=e?e:event;if(e.preventDefault){e.preventDefault();}return false;};Map_ondblclick=function(e){if(this.Map.currentTool){this.Map.currentTool.ondblclick(e);}if(this.Map.aInfoTools.length>0){for(var i=0;i<this.Map.aInfoTools.length;i++){this.Map.aInfoTools[i].ondblclick(e);}}};Map_onmousewheel=function(e){if(this.Map.currentTool){this.Map.currentTool.onmousewheel(e);}};Map.prototype.cancelEvent=function(e){e=(e)?e:((event)?event:null);e.returnValue=false;if(e.preventDefault){e.preventDefault();}return false;};Map.prototype.registerTool=function(toolObj){this.aTools.push(toolObj);};Map.prototype.activateTool=function(toolObj){if(toolObj.isInfoTool()){this.aInfoTools.push(toolObj);}else{if(this.currentTool){this.currentTool.deactivate();}this.currentTool=toolObj;if(this.theInsideLayer){this.setCursor(this.currentTool.cursor);}}};Map.prototype.deactivateTool=function(toolObj){if(toolObj.isInfoTool()){for(var i=0;i<this.aInfoTools.length;i++){if(this.aInfoTools[i]==toolObj){this.aInfoTools.splice(i,1);break;}}}else{if(this.currentTool==toolObj){this.currentTool=null;}if(this.theInsideLayer){this.theInsideLayer.style.cursor='auto';}}};Map.prototype.setCursor=function(cursor){if(cursor && cursor.length && typeof cursor=='object'){for(var i=0;i<cursor.length;i++){this.theInsideLayer.style.cursor=cursor[i];if(this.theInsideLayer.style.cursor==cursor[i]){break;}}}else if(typeof cursor=='string'){this.theInsideLayer.style.cursor=cursor;}else{this.theInsideLayer.style.cursor='auto';}};Map.prototype.checkWrap=function(){var bWrapped=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();bWrapped=true;}while(this.xOffset<-(this.nBuffer*this.tileWidth)){this.wrapL2R();bWrapped=true;}while(this.yOffset>-(this.nBuffer*this.tileHeight)){this.wrapB2T();bWrapped=true;}while(this.yOffset<-(2*this.nBuffer*this.tileHeight)){this.wrapT2B();bWrapped=true;}var layer=this.aMaps[this.currentMap].getLayers()[0];if(layer){var img=layer.domObj.childNodes[0].style;this.nCurrentTop=safeParseInt(img.top)+this.yOrigin;this.nCurrentLeft=safeParseInt(img.left)+this.xOrigin;}if(bWrapped){this.triggerEvent(MAP_METAEXTENTS_CHANGED,this.getMetaExtents());}};Map.prototype.checkMaxExtents=function(){var maxExtents=this.getCurrentMap().maxExtents;if(maxExtents.length==4){if((maxExtents[0]>=maxExtents[2])||(maxExtents[1]>=maxExtents[3])){return false;}var geoExtents=this.getGeoExtents();var hPixelAdjustment=0;var vPixelAdjustment=0;if(geoExtents[0]<maxExtents[0]){hPixelAdjustment=Math.round((maxExtents[0]-geoExtents[0])/this.cellSize);}if(geoExtents[2]>maxExtents[2]){if(hPixelAdjustment !=0){hPixelAdjustment+=Math.round((maxExtents[2]-geoExtents[2])/this.cellSize);hPixelAdjustment/=2;}else{hPixelAdjustment+=Math.round((maxExtents[2]-geoExtents[2])/this.cellSize);}}if(hPixelAdjustment !=0){this.theInsideLayer.style.left=(safeParseInt(this.theInsideLayer.style.left)-hPixelAdjustment)+'px';}if(geoExtents[1]<maxExtents[1]){vPixelAdjustment=Math.round((maxExtents[1]-geoExtents[1])/this.cellSize);}if(geoExtents[3]>maxExtents[3]){if(vPixelAdjustment !=0){vPixelAdjustment+=Math.round((maxExtents[3]-geoExtents[3])/this.cellSize);vPixelAdjustment/=2;}else{vPixelAdjustment=Math.round((maxExtents[3]-geoExtents[3])/this.cellSize);}}if(vPixelAdjustment !=0){this.theInsideLayer.style.top=(safeParseInt(this.theInsideLayer.style.top)+vPixelAdjustment)+'px';}}};Map.prototype.wrapR2L=function(){this.xOffset=this.xOffset-(this.nBuffer*this.tileWidth);var layers=this.aMaps[this.currentMap].getLayers();for(var k=0;k<layers.length;k++){var d=layers[k].domObj;var refLeft=safeParseInt(d.childNodes[0].style.left);for(var j=0;j<this.nHigh;j++){var imgLast=d.childNodes[((j+1)*this.nWide)-1];var imgNext=d.childNodes[j*this.nWide];imgLast.style.left=(refLeft-this.tileWidth)+'px';imgLast.src=this.aPixel.src;d.removeChild(imgLast);d.insertBefore(imgLast,imgNext);if(layers[k].visible){layers[k].setTile(imgLast);}}}};Map.prototype.wrapL2R=function(){this.xOffset=this.xOffset+(this.nBuffer*this.tileWidth);var layers=this.aMaps[this.currentMap].getLayers();for(var k=0;k<layers.length;k++){var d=layers[k].domObj;var refLeft=safeParseInt(d.childNodes[this.nWide-1].style.left);for(var j=0;j<this.nHigh;j++){var imgFirst=d.childNodes[j*this.nWide];var imgNext;if(j<this.nHigh-1){imgNext=d.childNodes[((j+1)*this.nWide)];}else{imgNext=null;}imgFirst.style.left=(refLeft+this.tileWidth)+'px';imgFirst.src=this.aPixel.src;d.removeChild(imgFirst);if(imgNext){d.insertBefore(imgFirst,imgNext);}else{d.appendChild(imgFirst);}if(layers[k].visible){layers[k].setTile(imgFirst);}}}};Map.prototype.wrapT2B=function(){this.yOffset=this.yOffset+(this.nBuffer*this.tileHeight);var layers=this.aMaps[this.currentMap].getLayers();for(var k=0;k<layers.length;k++){var d=layers[k].domObj;var refTop=safeParseInt(d.childNodes[(this.nHigh*this.nWide)-1].style.top);for(var i=0;i<this.nWide;i++){var imgBottom=d.childNodes[0];imgBottom.style.top=(refTop+this.tileHeight)+'px';imgBottom.src=this.aPixel.src;d.removeChild(imgBottom);d.appendChild(imgBottom);if(layers[k].visible){layers[k].setTile(imgBottom);}}}};Map.prototype.wrapB2T=function(){this.yOffset=this.yOffset-(this.nBuffer*this.tileHeight);var layers=this.aMaps[this.currentMap].getLayers();for(var k=0;k<layers.length;k++){var d=layers[k].domObj;var refTop=safeParseInt(d.childNodes[0].style.top);for(var i=0;i<this.nWide;i++){var imgTop=d.childNodes[(this.nHigh*this.nWide)-1];imgTop.style.top=(refTop-this.tileHeight)+'px';imgTop.src=this.aPixel.src;d.removeChild(imgTop);d.insertBefore(imgTop,d.childNodes[0]);if(layers[k].visible){layers[k].setTile(imgTop);}}}};Map.prototype.addMap=function(oMap){oMap.Map=this;this.aMaps[oMap.name]=oMap;};Map.prototype.getMaps=function(){return this.aMaps;};Map.prototype.getCurrentMap=function(){return this.aMaps[this.currentMap];};Map.prototype.selectMap=function(name){if(!this.aMaps[name]){return false;}else{this.currentMap=name;var oMap=this.getCurrentMap();this.setBackgroundColor(oMap.backgroundColor);this.setMapLayers();if(arguments[1] && arguments[1].length==3){this.zoomTo(arguments[1][0],arguments[1][1],arguments[1][2]);oMap.aZoomTo.length=0;}else if(oMap.aZoomTo.length !=0){this.zoomTo(oMap.aZoomTo[0],oMap.aZoomTo[1],oMap.aZoomTo[2]);oMap.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(oMap.currentExtents[0],oMap.currentExtents[1],oMap.currentExtents[2],oMap.currentExtents[3]);}this.triggerEvent(MAP_MAP_INITIALIZED,this.currentMap);return true;}};Map.prototype.setMapLayers=function(){var oMap=this.getCurrentMap();for(var i=this.theInsideLayer.childNodes.length-1;i>=0;i--){if(this.theInsideLayer.childNodes[i].className=='mapLayer'){this.theInsideLayer.childNodes[i].appended=false;this.theInsideLayer.removeChild(this.theInsideLayer.childNodes[i]);}}layers=oMap.getLayers();for(var i=0;i<layers.length;i++){if(!layers[i].domObj){var d=this.createMapLayer(layers[i].name);this.theInsideLayer.appendChild(d);d.appended=true;layers[i].domObj=d;layers[i].setOpacity(layers[i].opacity);layers[i].setZIndex(layers[i].zIndex);layers[i].setVisibility(layers[i].visible);this.nWide=0;this.nHigh=0;this.drawGroup(layers[i]);}else if(!layers[i].domObj.appended){this.theInsideLayer.appendChild(layers[i].domObj);layers[i].domObj.appended=true;layers[i].setZIndex(layers[i].zIndex);}}return true;};Map.prototype.drawGroup=function(group){var newViewportWidth=this.getObjectWidth(this.domObj);var newViewportHeight=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=newViewportWidth;this.viewportHeight=newViewportHeight;}var newWide=Math.ceil((newViewportWidth/this.tileWidth)+2*this.nBuffer);var newHigh=Math.ceil((newViewportHeight/this.tileHeight)+2*this.nBuffer);this.viewportWidth=newViewportWidth;this.viewportHeight=newViewportHeight;if(this.nHigh==0 && this.nWide==0){this.nWide=newWide;}while(this.nHigh<newHigh){this.appendRow(group);}while(this.nHigh>newHigh){this.removeRow(group);}while(this.nWide<newWide){this.appendColumn(group);}while(this.nWide>newWide){this.removeColumn(group);}return true;};Map.prototype.createMapLayer=function(id){var d=document.createElement('div');d.id=id;d.className='mapLayer';d.style.position='absolute';d.style.visibility='visible';d.style.left='0px';d.style.top='0px';d.style.width='3000px';d.style.height='3000px';d.appended=false;return d;};Map.prototype.addMapLayer=function(l){var map=this.getCurrentMap();map.addLayer(l);this.setMapLayers();this.paintLayer(l);this.triggerEvent(MAP_LAYERS_CHANGED,this.currentMap);};Map.prototype.removeMapLayer=function(id){var map=this.getCurrentMap();var layer=map.getLayer(id);if(!layer){return false;}if(map.removeLayer(map.getLayer(id))){this.setMapLayers();this.triggerEvent(MAP_LAYERS_CHANGED,this.currentMap);}};Map.prototype.getCenter=function(){var deltaMouseX=this.nCurrentLeft-this.xOrigin+safeParseInt(this.theInsideLayer.style.left);var deltaMouseY=this.nCurrentTop-this.yOrigin+safeParseInt(this.theInsideLayer.style.top);var vpTop=this.nCurrentTop-deltaMouseY;var vpLeft=this.nCurrentLeft-deltaMouseX;var vpCenterX=vpLeft+this.viewportWidth/2;var vpCenterY=vpTop+this.viewportHeight/2;return new Array(vpCenterX,vpCenterY);};Map.prototype.getGeoExtents=function(){var minx=-1*(safeParseInt(this.theInsideLayer.style.left)-this.xOrigin)*this.cellSize;var maxx=minx+this.viewportWidth*this.cellSize;var maxy=(safeParseInt(this.theInsideLayer.style.top)-this.yOrigin)*this.cellSize;var miny=maxy-this.viewportHeight*this.cellSize;return [minx,miny,maxx,maxy];};Map.prototype.getMetaExtents=function(){var result=this.getGeoExtents();var oMap=this.getCurrentMap();layers=oMap.getLayers();for(var i=0;i<layers.length;i++){if(layers[i].domObj){var d=layers[i].domObj;var pl=safeParseInt(d.childNodes[0].style.left);var pt=safeParseInt(d.childNodes[0].style.top);var glt=this.pixToGeo(pl,pt,true);var left=-1*glt[0];var top=-1*glt[1];var right=left+this.nWide*this.tileWidth*this.cellSize;var bottom=top-this.nHigh*this.tileHeight*this.cellSize;result=[left,bottom,right,top];break;}}return result;};Map.prototype.zoomIn=function(){this.zoomByFactor(this.aMaps[this.currentMap].zoomIn());};Map.prototype.zoomOut=function(){this.zoomByFactor(this.aMaps[this.currentMap].zoomOut());};Map.prototype.zoomToScale=function(scale){this.zoomByFactor(this.aMaps[this.currentMap].zoomToScale(scale));};Map.prototype.zoomByFactor=function(nZoomFactor){if(nZoomFactor==1){this.triggerEvent(MAP_NOTICE,"NOTICE: changing to current scale aborted");return;}this.cellSize=this.cellSize/nZoomFactor;this.setMapLayers();this.initializeLayers(nZoomFactor);this.triggerEvent(MAP_SCALE_CHANGED,this.getCurrentScale());this.triggerEvent(MAP_EXTENTS_CHANGED,this.getGeoExtents());};Map.prototype.getCurrentScale=function(){return this.aMaps[this.currentMap].aScales[this.aMaps[this.currentMap].currentScale];};Map.prototype.setLayerQueryable=function(name,bQueryable){this.aMaps[this.currentMap].setLayerQueryable(name,bQueryable);};Map.prototype.setLayerVisibility=function(name,bVisible){if(!this.loadUnchecked && bVisible){layer=this.aMaps[this.currentMap].getLayer(name);layer.visible=true;this.setMapLayers();this.aMaps[this.currentMap].setLayerVisibility(name,bVisible);this.paintLayer(layer);}else{this.aMaps[this.currentMap].setLayerVisibility(name,bVisible);}};Map.prototype.setLayerOpacity=function(name,opacity){this.aMaps[this.currentMap].setLayerOpacity(name,opacity);};Map.prototype.registerEventID=function(eventID){return this.eventManager.registerEventID(eventID);};Map.prototype.registerForEvent=function(eventID,obj,func){return this.eventManager.registerForEvent(eventID,obj,func);};Map.prototype.deregisterForEvent=function(eventID,obj,func){return this.eventManager.deregisterForEvent(eventID,obj,func);};Map.prototype.triggerEvent=function(eventID){return this.eventManager.triggerEvent.apply(this.eventManager,arguments);};function safeParseInt(val){return Math.round(parseFloat(val));};function _map(o){this.aLayers=[];this.aZoomTo=[];this.Map=null;this.name=(typeof(o.name)!='undefined')? o.name : 'noname';this.title=(typeof(o.title)!='undefined')? o.title : 'no title';this.aScales=(typeof(o.scales)!='undefined')? o.scales : [1];this.currentScale=(typeof(o.currentScale)!='undefined')? parseFloat(o.currentScale): 0;this.units=(typeof(o.units)!='undefined')? o.units : 5;this.resolution=(typeof(o.resolution)!='undefined')? o.resolution:72;this.defaultExtents=(typeof(o.defaultExtents)!='undefined')? o.defaultExtents:[];this.currentExtents=(typeof(o.currentExtents)!='undefined')? o.currentExtents:[];this.maxExtents=(typeof(o.maxExtents)!='undefined')? o.maxExtents : [];this.backgroundColor=(typeof(o.backgroundColor)!='undefined')? o.backgroundColor : '#ffffff';this.version=(typeof(o.version)!='undefined')? o.version : "";};_map.prototype.addLayer=function(layer){layer._map=this;layer.zIndex=this.aLayers.length;this.aLayers.push(layer);};_map.prototype.removeLayer=function(l){var alayer=Array();for(i=0,a=0;i<this.aLayers.length;i++){if(this.aLayers[i]!=l){alayer[a]=this.aLayers[i];a++;}}this.aLayers=alayer;return true;};_map.prototype.getQueryableLayers=function(){var r=[];var l=this.getLayers();for(var i=0;i<l.length;i++){if(l[i].isQueryable()){r.push(l[i]);}}return r;};_map.prototype.getLayers=function(){var r=[];for(var i=0;i<this.aLayers.length;i++){if(this.aLayers[i].isVisible()&&(this.aLayers[i].visible || this.Map.loadUnchecked)){r.push(this.aLayers[i]);}}return r;};_map.prototype.getAllQueryableLayers=function(){var r=[];for(var i=0;i<this.aLayers.length;i++){if(this.aLayers[i].isQueryable()){r.push(this.aLayers[i]);}}return r;};_map.prototype.getAllLayers=function(){return this.aLayers;};_map.prototype.getLayer=function(name){for(var i=0;i<this.aLayers.length;i++){if(this.aLayers[i].name==name){return this.aLayers[i];}}};_map.prototype.getScales=function(){return this.aScales;};_map.prototype.zoomIn=function(){var nZoomFactor=1;if(this.currentScale<this.aScales.length-1){nZoomFactor=this.aScales[this.currentScale]/this.aScales[this.currentScale+1];this.currentScale=this.currentScale+1;}return nZoomFactor;};_map.prototype.zoomOut=function(){var nZoomFactor=1;if(this.currentScale>0){nZoomFactor=this.aScales[this.currentScale]/this.aScales[this.currentScale-1];this.currentScale=this.currentScale-1;}return nZoomFactor;};_map.prototype.zoomToScale=function(scale){var nZoomFactor=1;for(var i=0;i<this.aScales.length;i++){if(this.aScales[i]==scale){nZoomFactor=this.aScales[this.currentScale]/scale;this.currentScale=parseInt(i);}}return nZoomFactor;};_map.prototype.setLayerQueryable=function(name,bQueryable){var layer=this.getLayer(name);if(typeof(layer)!='undefined'){layer.setQueryable(bQueryable);}};_map.prototype.setLayerVisibility=function(name,bVisible){var layer=this.getLayer(name);if(typeof(layer)!='undefined'){layer.setVisibility(bVisible);}};_map.prototype.setLayerOpacity=function(name,opacity){var layer=this.getLayer(name);if(typeof(layer)!='undefined'){layer.setOpacity(opacity);}};_map.prototype.setDefaultExtents=function(minx,miny,maxx,maxy){this.defaultExtents=[minx,miny,maxx,maxy];if(this.currentExtents.length==0)this.setCurrentExtents(minx,miny,maxx,maxy);};_map.prototype.setCurrentExtents=function(minx,miny,maxx,maxy){this.currentExtents=[minx,miny,maxx,maxy];};_map.prototype.setMaxExtents=function(minx,miny,maxx,maxy){this.maxExtents=[minx,miny,maxx,maxy];};_map.prototype.setBackgroundColor=function(szBgColor){this.backgroundColor=szBgColor;};function _layer(o){this.domObj=null;this._map=null;this.name=(typeof(o.name)!='undefined')? o.name : 'unnamed';this.visible=(typeof(o.visible)!='undefined')? o.visible : true;this.opacity=(typeof(o.opacity)!='undefined')? o.opacity : 100;this.imageformat=(typeof(o.imageformat)!='undefined')? o.imageformat : null;this.queryable=(typeof(o.queryable)!='undefined')? o.queryable : false;this.queryState=(typeof(o.queryable)!='undefined')? o.queryable : false;this.tileSource=(typeof(o.tileSource)!='undefined')? o.tileSource : 'auto';this.scales=(typeof(o.scales)!='undefined')? o.scales : new Array(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);this.toLoad=0;var ts=new Date();this.timeStamp=Math.round(ts.getTime()/1000)+ts.getTimezoneOffset()*60;this.redrawInterval=(typeof(o.redrawInterval)!='undefined')? o.redrawInterval :-1;this.refreshInterval=(typeof(o.refreshInterval)!='undefined')? o.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(bQueryable){if(this.queryable){this.queryState=bQueryable;}};_layer.prototype.isVisible=function(){return(this.scales[this._map.currentScale]==1)? true:false;};_layer.prototype.setOpacity=function(amount){this.opacity=amount;if(this.domObj){this.domObj.style.opacity=amount/100;this.domObj.style.mozOpacity=amount/100;for(var i=0;i<this.domObj.childNodes.length;i++){this.domObj.childNodes[i].style.filter="Alpha(opacity="+amount+")";}}};_layer.prototype.setTile=function(img){var l=safeParseInt(img.style.left)+this._map.Map.xOrigin;var t=safeParseInt(img.style.top)+this._map.Map.yOrigin;var szImageformat='';var src;var image_format='';if(this.imageformat && this.imageformat !=''){image_format=this.imageformat;szImageformat='&i='+image_format;}if(this.tileSource=='cache'){var metaLeft=Math.floor(l/(this._map.Map.tileWidth*this._map.Map.metaWidth))*this._map.Map.tileWidth*this._map.Map.metaWidth;var metaTop=Math.floor(t/(this._map.Map.tileHeight*this._map.Map.metaHeight))*this._map.Map.tileHeight*this._map.Map.metaHeight;var metaTileId='t'+metaTop+'l'+metaLeft;var groupsDir=(this.name !='')? this.name.replace(/\W/g,'_'): 'def';var cacheDir=this._map.Map.webCache+this._map.name+'/'+this._map.aScales[this._map.currentScale]+'/'+groupsDir+'/def/'+metaTileId;var tileId="t"+t+"l"+l;var imageExtension=this.imageformat.toLowerCase().replace(/[\de]/g,'');src=cacheDir+"/"+tileId+"."+imageExtension;}else{var szVersion='';if(this._map.version !=''){szVersion='&version='+this._map.version;}var szForce='';var szLayers='';if(arguments[1]){szForce='&force=true';}var szTimestamp='';if(this.tileSource=='redraw' || this.tileSource=="refresh"){szTimestamp='&ts='+this.timeStamp;if(this.redrawInterval){szTimestamp=szTimestamp+'&interval='+this.redrawInterval;}}var szGroup='&g='+img.layer.domObj.id;var szScale='&s='+this._map.aScales[this._map.currentScale];var q='?';if(this._map.Map.tileURL.indexOf('?')!=-1){if(this._map.Map.tileURL.slice(-1)!='&'){q='&';}else{q='';}}if(this.tileSource=='nocache'){src=this._map.Map.server+this._map.Map.tileURL.replace('tile.php','tile_nocache.php')+q+'map='+this._map.name+'&t='+t+'&l='+l+szScale+szForce+szGroup+szImageformat;if(typeof(this.replacementVariables)!='undefined'){for(var key in this.replacementVariables){src+='&'+encodeURIComponent(key)+'='+encodeURIComponent(this.replacementVariables[key]);}}}else{src=this._map.Map.server+this._map.Map.tileURL+q+'map='+this._map.name+'&t='+t+'&l='+l+szScale+szGroup+szImageformat+szTimestamp+szVersion;}}if(img.src !=src){img.style.visibility='hidden';img.src=src;}};_layer.prototype.setVisibility=function(bVisible){this.visible=bVisible;if(this.domObj){this.domObj.style.visibility=bVisible?'visible':'hidden';this.domObj.style.display=bVisible?'block':'none';for(var i=0;i<this.domObj.childNodes.length;i++){this.setTile(this.domObj.childNodes[i]);}this._map.Map.triggerEvent(MAP_LAYER_STATUS_CHANGED,this);}};_layer.prototype.setZIndex=function(zIndex){this.zIndex=zIndex;if(this.domObj){this.domObj.style.zIndex=zIndex;}};_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 ts=new Date();this.timeStamp=Math.round(ts.getTime()/1000)+ts.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(eventID){var ev=new String(eventID);if(!this.events[eventID]){this.events[eventID]=[];}};_eventManager.prototype.registerForEvent=function(eventID,obj,func){var ev=new String(eventID);this.events[eventID].push([obj,func]);};_eventManager.prototype.deregisterForEvent=function(eventID,obj,func){var ev=new String(eventID);var bResult=false;if(!this.events[eventID]){return false;}for(var i=0;i<this.events[eventID].length;i++){if(this.events[eventID][i][0]==obj && this.events[eventID][i][1]==func){this.events[eventID].splice(i,1);bResult=true;}}return bResult;};_eventManager.prototype.triggerEvent=function(eventID){var ev=new String(eventID);if(!this.events[eventID]){return false;}var args=new Array();for(i=1;i<arguments.length;i++){args[args.length]=arguments[i];}for(var i=0;i<this.events[eventID].length;i++){this.events[eventID][i][1].apply(this.events[eventID][i][0],arguments);}return true;};var goQueueManager=new _queueManager();function _queueManager(){this.queue=new Array();}_queueManager.prototype.enqueue=function(timeout,obj,func,args){var pos=this.queue.length;for(var i=0;i<this.queue.length;i++){if(this.queue[i]==null){pos=i;break;}}var id=window.setTimeout("_queueManager_execute("+pos+")",timeout);this.queue[pos]=new Array(id,obj,func,args);return pos;};_queueManager.prototype.dequeue=function(pos){if(this.queue[pos] !=null){window.clearTimeout(this.queue[pos][0]);this.queue[pos]=null;}};function _queueManager_execute(pos){if(goQueueManager.queue[pos] !=null){var obj=goQueueManager.queue[pos][1];var func=goQueueManager.queue[pos][2];if(goQueueManager.queue[pos][3] !=null){func.apply(obj,goQueueManager.queue[pos][3]);}else{func.apply(obj);}goQueueManager.queue[pos]=null;}};
 function Legend(oMap,szID,bStatic,options){this.Map=oMap;this.domObj=this.Map.getRawObject(szID);this.type=(bStatic)?'static':'dynamic';this.expanders=[];this.queryCBs=[];this.urlBase=this.Map.server;this.urlBase+=(this.urlBase!=''&&this.urlBase.substring(-1)!='/')?'':'/';this.showQueryCBs=true;if(this.type=='static'){this.domImg=document.createElement('img');this.domImg.src=this.Map.aPixel.src;this.domObj.appendChild(this.domImg);}else{this.domObj.innerHTML='&nbsp;';}this.showVisibilityControl=true;this.showQueryControl=true;this.showOpacityControl=true;this.showOrderControl=true;if(typeof options !='undefined'){this.showVisibilityControl=typeof options.visibility !='undefined' ? options.visibility : true;this.showQueryControl=typeof options.query !='undefined' ? options.query : true;this.showOpacityControl=typeof options.opacity !='undefined' ? options.opacity : true;this.showOrderControl=typeof options.order !='undefined' ? options.order : true;}this.Map.registerForEvent(MAP_SCALE_CHANGED,this,this.update);this.Map.registerForEvent(MAP_MAP_INITIALIZED,this,this.update);this.Map.registerForEvent(MAP_LAYERS_CHANGED,this,this.draw);this.Map.registerForEvent(MAP_LAYER_STATUS_CHANGED,this,this.update);};Legend.prototype.update=function(eventID){var url='';if(this.type=='static'){this.domImg.src='legend.php?map='+this.Map.currentMap+'&scale='+this.Map.getCurrentScale();}else{if(eventID==MAP_MAP_INITIALIZED){while(this.domObj.childNodes.length>0){this.domObj.removeChild(this.domObj.childNodes[0]);}this.draw();}else if(eventID==MAP_SCALE_CHANGED){var oMap=this.Map.getCurrentMap();var aLayers=oMap.getAllLayers();var s=this.Map.getCurrentScale();for(var i in aLayers){var oLayer=aLayers[i];var oImg=this.Map.getRawObject('legendImg_'+oLayer.name);if(oImg){var oParent=oImg.parentNode;var tId=oImg.id;var tVisibility=oImg.visibility;oParent.removeChild(oImg);oImg=document.createElement('img');oImg.id=tId;oImg.title=tId;oImg.visibility=tVisibility;oImg.src='legend.php?map='+this.Map.currentMap+'&scale='+s+'&g='+oLayer.name;oParent.appendChild(oImg);expander=getRawObject('expander_'+oLayer.name);expander.expandable=oImg;expander.expanded=true;Legend_expander.apply(expander);}this.setOnOffLayer(oLayer);}}else if(eventID==MAP_LAYER_STATUS_CHANGED){var layer=arguments[1];for(var i=0;i<this.queryCBs.length;i++){if(this.queryCBs[i].oLayer==layer){this.queryCBs[i].checked=layer.visible;}}}}};Legend.prototype.draw=function(){this.urlBase=this.Map.server;this.urlBase+=(this.urlBase!=''&&this.urlBase.substring(-1)!='/')?'':'/';var oMap=this.Map.getCurrentMap();this.expanders=[];this.queryCBs=[];if(this.domObj.childNodes.length==0){this.domObj.appendChild(this.createHeaderHTML());}var aLayers=oMap.getAllLayers();for(var i=(aLayers.length-1);i>=0;i--){if(aLayers[i].LegendObj==null){this.createLayerHTML(aLayers[i]);}else{try{this.domObj.removeChild(aLayers[i].LegendObj);}catch(e){};}}for(var i=(aLayers.length-1);i>=0;i--){this.domObj.appendChild(aLayers[i].LegendObj);}if(this.Map.isIE4){for(var i=0;i<this.queryCBs.length;i++){this.queryCBs[i].checked=this.queryCBs[i].oLayer.visible;}}return;};Legend.prototype.createHeaderHTML=function(){var d,t,tb,tr,td,img;d=document.createElement('div');d.className='LegendTitle';t=document.createElement('table');t.setAttribute('width','226px');t.setAttribute('cellPadding',"0");t.setAttribute('cellSpacing',"0");t.setAttribute('border',"0");tb=document.createElement("tbody");tr=document.createElement('tr');td=document.createElement('td');td.style.width='26px';img=document.createElement('img');img.src='images/expand.png';img.alt='expand all';img.title='expand all';img.Legend=this;img.onclick=Legend_expandAll;td.appendChild(img);img=document.createElement('img');img.src='images/collapse.png';img.alt='collapse all';img.title='collapse all';img.Legend=this;img.onclick=Legend_collapseAll;td.appendChild(img);tr.appendChild(td);td=document.createElement('td');td.appendChild(document.createTextNode('Layers'));tr.appendChild(td);tb.appendChild(tr);t.appendChild(tb);d.appendChild(t);return d;};Legend.prototype.createLayerHTML=function(oLayer){var d,t,tb,tr,td,expander,cb,img,name;d=document.createElement('div');d.id='group_'+oLayer.name;d.className="LegendLayer";d.oLayer=oLayer;name=oLayer.name;if(name=='__base__'){name='Base';}t=document.createElement('table');t.setAttribute('width','226');t.setAttribute('cellPadding',"0");t.setAttribute('cellSpacing',"0");t.setAttribute('border',"0");tb=document.createElement('tbody');tr=document.createElement('tr');td=document.createElement('td');td.setAttribute("width","9");expander=document.createElement('img');expander.src='images/collapse.png';expander.layerName=oLayer.name;expander.id='expander_'+oLayer.name;expander.onclick=Legend_expander;expander.expanded=true;this.expanders.push(expander);td.appendChild(expander);tr.appendChild(td);if(this.showVisibilityControl){td=document.createElement('td');td.width='22';if(oLayer.name !='__base__'){cb=document.createElement('input');cb.type='checkbox';cb.name='layerVisCB';cb.value=oLayer.name;cb.checked=oLayer.visible;cb.Legend=this;cb.oLayer=oLayer;cb.onclick=Legend_toggleLayerVisibility;this.queryCBs.push(cb);td.appendChild(cb);}else{td.innerHTML='&nbsp;';}tr.appendChild(td);}var oMap=this.Map.getCurrentMap();var aLayers=oMap.getAllLayers();if(aLayers.length>1){if(this.showOpacityControl){td=document.createElement('td');td.width='19';img=document.createElement('img');img.src='images/sun_white.png';img.width='7';img.alt="Decrease layer opacity";img.title="Decrease layer opacity";img.style.cursor='crosshair';img.Legend=this;img.oLayer=oLayer;img.onclick=Legend_opacityDown;td.appendChild(img);img=document.createElement('img');img.src='images/sun_grey.png';img.width='7';img.style.marginLeft='2px';img.alt="Increase layer opacity";img.title="Increase layer opacity";img.style.cursor='crosshair';img.Legend=this;img.oLayer=oLayer;img.onclick=Legend_opacityUp;td.appendChild(img);tr.appendChild(td);}if(this.showOrderControl){td=document.createElement('td');td.width='10';td.style.padding='1px';img=document.createElement('img');img.src='images/arrow_up.png';img.width='10';img.height='8';img.style.marginBottom='2px';img.alt="Shift Layer Up";img.title="Shift Layer Up";img.style.cursor='crosshair';img.Legend=this;img.oLayer=oLayer;img.myDiv=d;img.onclick=Legend_moveLayerUp;td.appendChild(img);img=document.createElement('img');img.src='images/arrow_down.png';img.width='10';img.height='8';img.alt="Shift Layer Down";img.title="Shift Layer Down";img.style.cursor='crosshair';img.Legend=this;img.oLayer=oLayer;img.myDiv=d;img.onclick=Legend_moveLayerDown;td.appendChild(img);tr.appendChild(td);}}if(this.showQueryControl){td=document.createElement('td');td.width='14';img=document.createElement('img');img.width='14';img.height='14';if(oLayer.queryable){if(oLayer.isQueryable()){img.src='images/icon_query_on.png';}else{img.src='images/icon_query_off.png';}img.onmouseover=Legend_queryOnMouseOver;img.onmouseout=Legend_queryOnMouseOut;img.onclick=Legend_queryOnClick;img.oLayer=oLayer;}else{img.src='images/icon_query_x.png';}td=document.createElement('td');td.appendChild(img);td.width='16';tr.appendChild(td);}td=document.createElement('td');td.innerHTML=name;tr.appendChild(td);tb.appendChild(tr);t.appendChild(tb);d.appendChild(t);img=document.createElement('img');img.id='legendImg_'+oLayer.name;img.src=this.urlBase+'legend.php?map='+this.Map.currentMap+'&scale='+this.Map.getCurrentScale()+'&g='+oLayer.name;d.appendChild(img);expander.expandable=img;oLayer.LegendObj=d;Legend_expander.apply(expander);this.setOnOffLayer(oLayer,oLayer.isVisible);};function Legend_toggleLayerQueryable(){this.Legend.Map.setLayerQueryable(this.value,this.checked);};function Legend_queryOnMouseOver(){if(this.oLayer.queryable){this.src='images/icon_query_over.png';}};function Legend_queryOnMouseOut(){if(this.oLayer.queryable){if(this.oLayer.isQueryable()){this.src='images/icon_query_on.png';}else{this.src='images/icon_query_off.png';}}};function Legend_queryOnClick(){if(this.oLayer.queryable){if(this.oLayer.isQueryable()){this.oLayer.setQueryable(false);this.src='images/icon_query_off.png';}else{this.oLayer.setQueryable(true);this.src='images/icon_query_on.png';}}};function Legend_toggleLayerVisibility(){this.Legend.Map.setLayerVisibility(this.value,this.checked);};function Legend_expander(){this.expanded=!this.expanded;this.src=(this.expanded)?'images/collapse.png':'images/expand.png';this.expandable.style.display=(this.expanded)?'block':'none';};function Legend_expandAll(){var Leg=this.Legend;for(var i=0;i<Leg.expanders.length;i++){Leg.expanders[i].expanded=false;Legend_expander.apply(Leg.expanders[i]);}};function Legend_collapseAll(){var Leg=this.Legend;if(Leg.expanders){for(var i=0;i<Leg.expanders.length;i++){Leg.expanders[i].expanded=true;Legend_expander.apply(Leg.expanders[i]);}}};function Legend_opacityDown(){var opc;opc=this.oLayer.opacity-10;this.Legend.Map.setLayerOpacity(this.oLayer.name,opc);};function Legend_opacityUp(){var opc;opc=this.oLayer.opacity+10;this.Legend.Map.setLayerOpacity(this.oLayer.name,opc);};Legend.prototype.setOnOffLayer=function(l){if(l.isVisible()){if(l.LegendObj){l.LegendObj.style.display='block';}}else{if(l.LegendObj){l.LegendObj.style.display='none';}}};function Legend_moveLayerDown(){var myLayer=this.oLayer;var leg=this.myDiv.parentNode;var myDiv=this.myDiv;var lowerDiv=findLowerDiv(myDiv);if(lowerDiv && lowerDiv.className=='LegendLayer'){var aCheckbox=document.getElementsByTagName('input');var checkboxStatusUp=null;var checkboxStatusDown=null;var checkboxUp=null;var checkboxDown=null;for(var i=0;i<aCheckbox.length;i++){var inputTag=aCheckbox[i];if(inputTag.value==myDiv.id.replace(/\bgroup_/,'')){checkboxUp=inputTag;checkboxStatusUp=checkboxUp.checked;}if(inputTag.value==lowerDiv.id.replace(/\bgroup_/,'')){checkboxDown=inputTag;checkboxStatusDown=inputTag.checked;}}var proxyMy=myDiv.cloneNode(true);var proxyLower=lowerDiv.cloneNode(true);myDiv.parentNode.insertBefore(proxyMy,myDiv);myDiv.parentNode.insertBefore(proxyLower,lowerDiv);myDiv.parentNode.replaceChild(lowerDiv,proxyMy);myDiv.parentNode.replaceChild(myDiv,proxyLower);if(checkboxUp)checkboxUp.checked=checkboxStatusUp;if(checkboxDown)checkboxDown.checked=checkboxStatusDown;for(i=0,n=leg.childNodes.length;i<leg.childNodes.length;i++){var child=leg.childNodes[i];if(child && child.className=='LegendLayer'){child.oLayer.zIndex=(n);n--;}}this.Legend.Map.setMapLayers();}else{alert('this layer can\'t go farther down');}};function Legend_moveLayerUp(){var myLayer=this.oLayer;var leg=this.myDiv.parentNode;var myDiv=this.myDiv;var upperDiv=findUpperDiv(myDiv);if(upperDiv && upperDiv.className=='LegendLayer'){var aCheckbox=document.getElementsByTagName('input');var checkboxStatusUp=null;var checkboxStatusDown=null;var checkboxUp=null;var checkboxDown=null;for(var i=0;i<aCheckbox.length;i++){var inputTag=aCheckbox[i];if(inputTag.value==upperDiv.id.replace(/\bgroup_/,'')){checkboxUp=inputTag;checkboxStatusUp=checkboxUp.checked;}if(inputTag.value==myDiv.id.replace(/\bgroup_/,'')){checkboxDown=inputTag;checkboxStatusDown=inputTag.checked;}}var proxyMy=myDiv.cloneNode(true);var proxyUpper=upperDiv.cloneNode(true);myDiv.parentNode.insertBefore(proxyMy,myDiv);myDiv.parentNode.insertBefore(proxyUpper,upperDiv);myDiv.parentNode.replaceChild(upperDiv,proxyMy);myDiv.parentNode.replaceChild(myDiv,proxyUpper);if(checkboxUp)checkboxUp.checked=checkboxStatusUp;if(checkboxDown)checkboxDown.checked=checkboxStatusDown;for(i=0,n=leg.childNodes.length;i<leg.childNodes.length;i++){var child=leg.childNodes[i];if(child && child.className=='LegendLayer'){child.oLayer.zIndex=(n);n--;}}this.Legend.Map.setMapLayers();}else{alert('this layer can\'t go farther up');}};function findLowerDiv(div){lDiv=div.nextSibling;if(lDiv && lDiv.className=='LegendLayer' && lDiv.style.display=='none'){findLowerDiv(lDiv);}return lDiv;};function findUpperDiv(div){uDiv=div.previousSibling;if(uDiv && uDiv.className=='LegendLayer' && uDiv.style.display=='none'){findUpperDiv(uDiv);}return uDiv;}
 var CurrentTool=null;var cross=0;function Tool(oMap){this.Map=oMap;this.name='Tool';this.bInfoTool=false;this.wheelPlus=new Array(oMap,oMap.zoomOut,null);this.wheelMinus=new Array(oMap,oMap.zoomIn,null);this.Map.registerTool(this);};Tool.prototype.isInfoTool=function(){return this.bInfoTool;};Tool.prototype.activate=function(){this.Map.activateTool(this);document.CurrentTool=this;};Tool.prototype.deactivate=function(){this.Map.deactivateTool(this);document.CurrentTool=null;};Tool.prototype.onmousemove=function(e){return false;};Tool.prototype.onmousedown=function(e){return false;};Tool.prototype.onmouseup=function(e){return false;};Tool.prototype.ondblclick=function(e){return false;};Tool.prototype.setMouseWheel=function(minusSet,plusSet){this.wheelMinus=minusSet;this.wheelPlus=plusSet;};Tool.prototype.onmousewheel=function(e){e=(e)?e:((event)?event:null);var wheelDelta=e.wheelDelta ? e.wheelDelta : e.detail*-1;var wheelSet=null;if(wheelDelta>0)wheelSet=this.wheelPlus;else wheelSet=this.wheelMinus;if(wheelSet){obj=(wheelSet[0])? wheelSet[0] : null;func=(wheelSet[1])? wheelSet[1] : null;args=(wheelSet[2])? wheelSet[2] : null;if(func){if(args){func.apply(obj,args);}else{func.apply(obj);}}}};Tool.prototype.adjustPixPosition=function(x,y){var obj=this.Map.domObj;var offsetLeft=0;var offsetTop=0;while(obj){offsetLeft+=parseInt(obj.offsetLeft);offsetTop+=parseInt(obj.offsetTop);obj=obj.offsetParent;}debugMessage("Tool.prototype.adjustPixPosition():offsetLeft="+offsetLeft+" offsetTop="+offsetTop);debugMessage("Tool.prototype.adjustPixPosition():theInsideLayer.left="+this.Map.theInsideLayer.style.left+" theInsideLayer.top="+this.Map.theInsideLayer.style.top);debugMessage("Tool.prototype.adjustPixPosition():this.Map.xOrigin="+this.Map.xOrigin+" this.Map.yOrigin="+this.Map.yOrigin);var pX=parseInt(this.Map.theInsideLayer.style.left)+offsetLeft-this.Map.xOrigin-x;var pY=parseInt(this.Map.theInsideLayer.style.top)+offsetTop-this.Map.yOrigin-y;debugMessage("Tool.prototype.adjustPixPosition():X="+x+" Y="+y+" pX="+pX+" pY="+pY);return [pX,pY];};function Tool_redirect_onkeypress(e){if(document.CurrentTool){document.CurrentTool.onkeypress(e);}};Tool.prototype.onkeypress=function(e){return;e=(e)?e:((event)?event:null);if(e){var charCode=(e.charCode)?e.charCode:e.keyCode;var b=true;var nStep=16;switch(charCode){case 38: this.Map.moveBy(0,nStep);this.Map.triggerEvent(MAP_EXTENTS_CHANGED,this.Map.getGeoExtents());break;case 40: this.Map.moveBy(0,-nStep);this.Map.triggerEvent(MAP_EXTENTS_CHANGED,this.Map.getGeoExtents());break;case 37: this.Map.moveBy(nStep,0);this.Map.triggerEvent(MAP_EXTENTS_CHANGED,this.Map.getGeoExtents());break;case 39: this.Map.moveBy(-nStep,0);this.Map.triggerEvent(MAP_EXTENTS_CHANGED,this.Map.getGeoExtents());break;case 33: this.Map.slideBy(0,this.Map.viewportHeight/2);break;case 34: this.Map.slideBy(0,-this.Map.viewportHeight/2);break;case 36: this.Map.slideBy(this.Map.viewportWidth/2,0);break;case 35: this.Map.slideBy(-this.Map.viewportWidth/2,0);break;case 43: case 61: this.Map.zoomIn();break;case 45: this.Map.zoomOut();break;case 108: break;case 109: break;case 112: break;case 113: break;case 114: break;case 115: break;case 32: break;default: b=false;}if(b){return this.cancelEvent(e);}return true;}};Tool.prototype.onmouseover=function(e){return false;};Tool.prototype.onmouseout=function(e){if(this.Map.isIE4){document.onkeydown=null;}document.onkeypress=null;return false;};Tool.prototype.cancelEvent=function(e){e=(e)?e:((event)?event:null);e.cancelBubble=true;e.returnValue=false;if(e.stopPropogation){e.stopPropogation();}if(e.preventDefault){e.preventDefault();}return false;};function Navigator(oMap){Tool.apply(this,[oMap]);this.name='Navigator';this.cursorNormal=["url('images/grab.cur'),move",'-moz-grab','grab','move'];this.cursorDrag=["url('images/grabbing.cur'),move",'-moz-grabbing','grabbing','move'];this.cursor=this.cursorNormal;this.activeImage=this.Map.server+'images/button_pan_3.png';this.disabledImage=this.Map.server+'images/button_pan_2.png';this.lastx=null;this.lasty=null;this.bMouseDown=false;for(var p in Tool.prototype){if(!Navigator.prototype[p])Navigator.prototype[p]=Tool.prototype[p];}};Navigator.prototype.onmouseout=function(e){e=(e)?e:((event)?event:null);if(!e.target)e.target=e.srcElement;if(e.target.parentNode.parentNode.parentNode.id==this.Map.domObj.id){this.bMouseDown=false;return Tool.prototype.onmouseout.apply(this,[e]);}};Navigator.prototype.onmouseover=function(e){e=(e)?e:((event)?event:null);if(!e.target)e.target=e.srcElement;if(e.target.parentNode.parentNode.parentNode.id==this.Map.domObj.id){this.Map.domObj.focus();return Tool.prototype.onmouseover.apply(this,[e]);}};Navigator.prototype.onmousemove=function(e){e=(e)?e:((event)?event:null);if(!this.bMouseDown){return false;}if(!this.Map.layersHidden){this.Map.hideLayers();}var newTop=safeParseInt(this.Map.theInsideLayer.style.top);var newLeft=safeParseInt(this.Map.theInsideLayer.style.left);var x=e.pageX ||(e.clientX+(document.documentElement.scrollLeft || document.body.scrollLeft));var y=e.pageY ||(e.clientY+(document.documentElement.scrollTop || document.body.scrollTop));newTop=newTop-this.lasty+y;newLeft=newLeft-this.lastx+x;this.Map.theInsideLayer.style.top=newTop+'px';this.Map.theInsideLayer.style.left=newLeft+'px';this.Map.checkWrap.apply(this.Map,[]);this.lastx=x;this.lasty=y;this.Map.triggerEvent(MAP_EXTENTS_MOVED,this.Map.getGeoExtents());return false;};Navigator.prototype.onmousedown=function(e){e=(e)?e:((event)?event:null);if(e.button==2){return this.cancelEvent(e);}else{this.cursor=this.cursorDrag;this.Map.setCursor(this.cursorDrag);if(this.Map.isIE4){document.onkeydown=Tool_redirect_onkeypress;}document.onkeypress=Tool_redirect_onkeypress;this.bMouseDown=true;var x=e.pageX ||(e.clientX+(document.documentElement.scrollLeft || document.body.scrollLeft));var y=e.pageY ||(e.clientY+(document.documentElement.scrollTop || document.body.scrollTop));this.lastx=x;this.lasty=y;this.startx=this.lastx;this.starty=this.lasty;e.cancelBubble=true;e.returnValue=false;if(e.stopPropogation)e.stopPropogation();if(e.preventDefault)e.preventDefault();return false;}};var gDblClickTimer=null;Navigator.prototype.onmouseup=function(e){this.cursor=this.cursorNormal;this.Map.setCursor(this.cursorNormal);e=(e)?e:((event)?event:null);this.bMouseDown=false;var x=e.pageX ||(e.clientX+(document.documentElement.scrollLeft || document.body.scrollLeft));var y=e.pageY ||(e.clientY+(document.documentElement.scrollTop || document.body.scrollTop));if(Math.abs(x-this.startx)<2 && Math.abs(y-this.starty)<2){if(!gDblClickTimer){gDblClickTimer=window.setTimeout(bind(this.dispatchMapClicked,this,x,y),500);}}else{gDblClickTimer=null;this.Map.showLayers();this.Map.triggerEvent(MAP_EXTENTS_CHANGED,this.Map.getGeoExtents());}return false;};Navigator.prototype.dispatchMapClicked=function(px,py){var a=this.adjustPixPosition(px,py);var p=this.Map.pixToGeo(a[0],a[1]);gDblClickTimer=null;};Navigator.prototype.ondblclick=function(e){if(gDblClickTimer){window.clearTimeout(gDblClickTimer);gDblClickTimer=null;}e=(e)?e:((event)?event:null);var x=e.pageX ||(e.clientX+(document.documentElement.scrollLeft || document.body.scrollLeft));var y=e.pageY ||(e.clientY+(document.documentElement.scrollTop || document.body.scrollTop));var a=this.adjustPixPosition(x,y);var p=this.Map.pixToGeo(a[0],a[1]);this.Map.zoomTo(p[0],p[1]);};function bind(m,o){var __method=arguments[0];var __object=arguments[1];var args=[];for(var i=2;i<arguments.length;i++){args.push(arguments[i])}return function(){return __method.apply(__object,args);}}
 function RubberZoom(oMap){Tool.apply(this,[oMap]);this.name='RubberZoom';this.cursor='help';this.domObj=document.createElement('div');this.domObj.style.position='absolute';this.domObj.style.top='0px';this.domObj.style.left='0px';this.domObj.style.width='1px';this.domObj.style.height='1px';this.domObj.style.zIndex=100;this.domObj.style.visibility='hidden';this.domObj.style.border='1px solid blue';this.domObj.style.backgroundColor='white';this.domObj.style.opacity=0.50;this.domObj.style.mozOpacity=0.50;this.domObj.style.filter='Alpha(opacity=50)';this.Map.theInsideLayer.appendChild(this.domObj);this.startx=null;this.starty=null;this.endx=null;this.endy=null;this.bMouseDown=false;for(var p in Tool.prototype){if(!RubberZoom.prototype[p])RubberZoom.prototype[p]=Tool.prototype[p];}};RubberZoom.prototype.drawZoomBox=function(){if(this.startx==null || this.starty==null || this.endx==null || this.endy==null){this.domObj.style.visibility='hidden';this.domObj.style.top='0px';this.domObj.style.left='0px';this.domObj.style.width='1px';this.domObj.style.height='1px';return;}this.domObj.style.visibility='visible';if(this.endx<this.startx){this.domObj.style.left=(this.endx-this.Map.xOrigin)+'px';this.domObj.style.width=(this.startx-this.endx)+"px";}else{this.domObj.style.left=(this.startx-this.Map.xOrigin)+'px';this.domObj.style.width=(this.endx-this.startx)+"px";}if(this.endy<this.starty){this.domObj.style.top=(this.endy-this.Map.yOrigin)+'px';this.domObj.style.height=(this.starty-this.endy)+"px";}else{this.domObj.style.top=(this.starty-this.Map.yOrigin)+'px';this.domObj.style.height=(this.endy-this.starty)+"px";}};RubberZoom.prototype.onmouseout=function(e){e=(e)?e:((event)?event:null);if(!e.target)e.target=e.srcElement;if(e.target.id==this.Map.domObj.id){this.bMouseDown=false;this.startx=this.endx=this.starty=this.endy=null;this.drawZoomBox();return Tool.prototype.onmouseout.apply(this,[e]);}};RubberZoom.prototype.onmousemove=function(e){e=(e)?e:((event)?event:null);if(!this.bMouseDown){return false;}var x=e.pageX ||(e.clientX+(document.documentElement.scrollLeft || document.body.scrollLeft));var y=e.pageY ||(e.clientY+(document.documentElement.scrollTop || document.body.scrollTop));var aPixPos=this.adjustPixPosition(x,y);this.endx=-aPixPos[0];this.endy=-aPixPos[1];this.drawZoomBox();return false;};RubberZoom.prototype.onmousedown=function(e){e=(e)?e:((event)?event:null);if(e.button==2){return this.cancelEvent(e);}else{if(this.Map.isIE4)document.onkeydown=Tool_redirect_onkeypress;document.onkeypress=Tool_redirect_onkeypress;this.bMouseDown=true;var x=e.pageX ||(e.clientX+(document.documentElement.scrollLeft || document.body.scrollLeft));var y=e.pageY ||(e.clientY+(document.documentElement.scrollTop || document.body.scrollTop));var aPixPos=this.adjustPixPosition(x,y);this.startx=this.endx=-aPixPos[0];this.starty=this.endy=-aPixPos[1];this.drawZoomBox();e.cancelBubble=true;e.returnValue=false;if(e.stopPropogation)e.stopPropogation();if(e.preventDefault)e.preventDefault();return false;}};RubberZoom.prototype.onmouseup=function(e){e=(e)?e:((event)?event:null);var start=this.Map.pixToGeo(-this.startx,-this.starty);var coords=start;if(this.startx!=this.endx&&this.starty!=this.endy){coords=start.concat(this.Map.pixToGeo(-this.endx,-this.endy));if(coords[2]<coords[0]){var minx=coords[2];var maxx=coords[0];coords[0]=minx;coords[2]=maxx;}if(coords[1]<coords[3]){var miny=coords[1];var maxy=coords[3];coords[3]=miny;coords[1]=maxy;}}this.startx=this.endx=this.starty=this.endy=null;this.drawZoomBox();if(coords[2] && coords[0] && coords[3] && coords[1]){this.Map.zoomToExtents(coords[0],coords[1],coords[2],coords[3]);}else if(coords[0] && coords[1]){this.Map.zoomIn();this.Map.zoomTo(coords[0],coords[1]);}return false;};
 var xOp7Up,xOp6Dn,xIE4Up,xIE4,xIE5,xNN4,xUA=navigator.userAgent.toLowerCase();if(window.opera){var i=xUA.indexOf('opera');if(i!=-1){var v=parseInt(xUA.charAt(i+6));xOp7Up=v>=7;xOp6Dn=v<7;}}else if(navigator.vendor!='KDE' && document.all && xUA.indexOf('msie')!=-1){xIE4Up=parseFloat(navigator.appVersion)>=4;xIE4=xUA.indexOf('msie 4')!=-1;xIE5=xUA.indexOf('msie 5')!=-1;}else if(document.layers){xNN4=true;}xMac=xUA.indexOf('mac')!=-1;function xBackground(e,c,i){if(!(e=xGetElementById(e)))return '';var bg='';if(e.style){if(xStr(c)){if(!xOp6Dn)e.style.backgroundColor=c;else e.style.background=c;}if(xStr(i))e.style.backgroundImage=(i!='')? 'url('+i+')' : null;if(!xOp6Dn)bg=e.style.backgroundColor;else bg=e.style.background;}return bg;}function xClientHeight(){var h=0;if(xOp6Dn)h=window.innerHeight;else if(document.compatMode=='CSS1Compat' && !window.opera && document.documentElement && document.documentElement.clientHeight)h=document.documentElement.clientHeight;else if(document.body && document.body.clientHeight)h=document.body.clientHeight;else if(xDef(window.innerWidth,window.innerHeight,document.width)){h=window.innerHeight;if(document.width>window.innerWidth)h-=16;}return h;}function xClientWidth(){var w=0;if(xOp6Dn)w=window.innerWidth;else if(document.compatMode=='CSS1Compat' && !window.opera && document.documentElement && document.documentElement.clientWidth)w=document.documentElement.clientWidth;else if(document.body && document.body.clientWidth)w=document.body.clientWidth;else if(xDef(window.innerWidth,window.innerHeight,document.height)){w=window.innerWidth;if(document.height>window.innerHeight)w-=16;}return w;}function xClip(e,t,r,b,l){if(!(e=xGetElementById(e)))return;if(e.style){if(xNum(l))e.style.clip='rect('+t+'px '+r+'px '+b+'px '+l+'px)';else e.style.clip='rect(0 '+parseInt(e.style.width)+'px '+parseInt(e.style.height)+'px 0)';}}function xColor(e,s){if(!(e=xGetElementById(e)))return '';var c='';if(e.style && xDef(e.style.color)){if(xStr(s))e.style.color=s;c=e.style.color;}return c;}function xDef(){for(var i=0;i<arguments.length;++i){if(typeof(arguments[i])=='undefined')return false;}return true;}function xDisplay(e,s){if(!(e=xGetElementById(e)))return null;if(e.style && xDef(e.style.display)){if(xStr(s))e.style.display=s;return e.style.display;}return null;}function xGetComputedStyle(oEle,sProp,bInt){var s,p='undefined';var dv=document.defaultView;if(dv && dv.getComputedStyle){s=dv.getComputedStyle(oEle,'');if(s)p=s.getPropertyValue(sProp);}else if(oEle.currentStyle){var a=sProp.split('-');sProp=a[0];for(var i=1;i<a.length;++i){c=a[i].charAt(0);sProp+=a[i].replace(c,c.toUpperCase());}p=oEle.currentStyle[sProp];}else return null;return bInt ?(parseInt(p)|| 0): p;}function xGetElementById(e){if(typeof(e)!='string')return e;if(document.getElementById)e=document.getElementById(e);else if(document.all)e=document.all[e];else e=null;return e;}function xHasPoint(e,x,y,t,r,b,l){if(!xNum(t)){t=r=b=l=0;}else if(!xNum(r)){r=b=l=t;}else if(!xNum(b)){l=r;b=t;}var eX=xPageX(e),eY=xPageY(e);return(x>=eX+l && x<=eX+xWidth(e)-r &&y>=eY+t && y<=eY+xHeight(e)-b);}function xHeight(e,h){if(!(e=xGetElementById(e)))return 0;if(xNum(h)){if(h<0)h=0;else h=Math.round(h);}else h=-1;var css=xDef(e.style);if(e==document || e.tagName.toLowerCase()=='html' || e.tagName.toLowerCase()=='body'){h=xClientHeight();}else if(css && xDef(e.offsetHeight)&& xStr(e.style.height)){if(h>=0){var pt=0,pb=0,bt=0,bb=0;if(document.compatMode=='CSS1Compat'){var gcs=xGetComputedStyle;pt=gcs(e,'padding-top',1);if(pt !==null){pb=gcs(e,'padding-bottom',1);bt=gcs(e,'border-top-width',1);bb=gcs(e,'border-bottom-width',1);}else if(xDef(e.offsetHeight,e.style.height)){e.style.height=h+'px';pt=e.offsetHeight-h;}}h-=(pt+pb+bt+bb);if(isNaN(h)||h<0)return;else e.style.height=h+'px';}h=e.offsetHeight;}else if(css && xDef(e.style.pixelHeight)){if(h>=0)e.style.pixelHeight=h;h=e.style.pixelHeight;}return h;}function xHide(e){return xVisibility(e,0);}function xLeft(e,iX){if(!(e=xGetElementById(e)))return 0;var css=xDef(e.style);if(css && xStr(e.style.left)){if(xNum(iX))e.style.left=iX+'px';else{iX=parseInt(e.style.left);if(isNaN(iX))iX=0;}}else if(css && xDef(e.style.pixelLeft)){if(xNum(iX))e.style.pixelLeft=iX;else iX=e.style.pixelLeft;}return iX;}function xMoveTo(e,x,y){xLeft(e,x);xTop(e,y);}function xNum(){for(var i=0;i<arguments.length;++i){if(isNaN(arguments[i])|| typeof(arguments[i])!='number')return false;}return true;}function xOffsetLeft(e){if(!(e=xGetElementById(e)))return 0;if(xDef(e.offsetLeft))return e.offsetLeft;else return 0;}function xOffsetTop(e){if(!(e=xGetElementById(e)))return 0;if(xDef(e.offsetTop))return e.offsetTop;else return 0;}function xPageX(e){if(!(e=xGetElementById(e)))return 0;var x=0;while(e){if(xDef(e.offsetLeft))x+=e.offsetLeft;e=xDef(e.offsetParent)? e.offsetParent : null;}return x;}function xPageY(e){if(!(e=xGetElementById(e)))return 0;var y=0;while(e){if(xDef(e.offsetTop))y+=e.offsetTop;e=xDef(e.offsetParent)? e.offsetParent : null;}return y;}function xParent(e,bNode){if(!(e=xGetElementById(e)))return null;var p=null;if(!bNode && xDef(e.offsetParent))p=e.offsetParent;else if(xDef(e.parentNode))p=e.parentNode;else if(xDef(e.parentElement))p=e.parentElement;return p;}function xResizeTo(e,w,h){xWidth(e,w);xHeight(e,h);}function xScrollLeft(e,bWin){var offset=0;if(!xDef(e)|| bWin || e==document || e.tagName.toLowerCase()=='html' || e.tagName.toLowerCase()=='body'){var w=window;if(bWin && e)w=e;if(w.document.documentElement && w.document.documentElement.scrollLeft)offset=w.document.documentElement.scrollLeft;else if(w.document.body && xDef(w.document.body.scrollLeft))offset=w.document.body.scrollLeft;}else{e=xGetElementById(e);if(e && xNum(e.scrollLeft))offset=e.scrollLeft;}return offset;}function xScrollTop(e,bWin){var offset=0;if(!xDef(e)|| bWin || e==document || e.tagName.toLowerCase()=='html' || e.tagName.toLowerCase()=='body'){var w=window;if(bWin && e)w=e;if(w.document.documentElement && w.document.documentElement.scrollTop)offset=w.document.documentElement.scrollTop;else if(w.document.body && xDef(w.document.body.scrollTop))offset=w.document.body.scrollTop;}else{e=xGetElementById(e);if(e && xNum(e.scrollTop))offset=e.scrollTop;}return offset;}function xShow(e){return xVisibility(e,1);}function xStr(s){for(var i=0;i<arguments.length;++i){if(typeof(arguments[i])!='string')return false;}return true;}function xTop(e,iY){if(!(e=xGetElementById(e)))return 0;var css=xDef(e.style);if(css && xStr(e.style.top)){if(xNum(iY))e.style.top=iY+'px';else{iY=parseInt(e.style.top);if(isNaN(iY))iY=0;}}else if(css && xDef(e.style.pixelTop)){if(xNum(iY))e.style.pixelTop=iY;else iY=e.style.pixelTop;}return iY;}function xVisibility(e,bShow){if(!(e=xGetElementById(e)))return null;if(e.style && xDef(e.style.visibility)){if(xDef(bShow))e.style.visibility=bShow ? 'visible' : 'hidden';return e.style.visibility;}return null;}function xWidth(e,w){if(!(e=xGetElementById(e)))return 0;if(xNum(w)){if(w<0)w=0;else w=Math.round(w);}else w=-1;var css=xDef(e.style);if(e==document || e.tagName.toLowerCase()=='html' || e.tagName.toLowerCase()=='body'){w=xClientWidth();}else if(css && xDef(e.offsetWidth)&& xStr(e.style.width)){if(w>=0){var pl=0,pr=0,bl=0,br=0;if(document.compatMode=='CSS1Compat'){var gcs=xGetComputedStyle;pl=gcs(e,'padding-left',1);if(pl !==null){pr=gcs(e,'padding-right',1);bl=gcs(e,'border-left-width',1);br=gcs(e,'border-right-width',1);}else if(xDef(e.offsetWidth,e.style.width)){e.style.width=w+'px';pl=e.offsetWidth-w;}}w-=(pl+pr+bl+br);if(isNaN(w)||w<0)return;else e.style.width=w+'px';}w=e.offsetWidth;}else if(css && xDef(e.style.pixelWidth)){if(w>=0)e.style.pixelWidth=w;w=e.style.pixelWidth;}return w;}function xZIndex(e,uZ){if(!(e=xGetElementById(e)))return 0;if(e.style && xDef(e.style.zIndex)){if(xNum(uZ))e.style.zIndex=uZ;uZ=parseInt(e.style.zIndex);}return uZ;}
 function xAddEventListener(e,eT,eL,cap){if(!(e=xGetElementById(e)))return;eT=eT.toLowerCase();if((!xIE4Up && !xOp7Up)&& e==window){if(eT=='resize'){window.xPCW=xClientWidth();window.xPCH=xClientHeight();window.xREL=eL;xResizeEvent();return;}if(eT=='scroll'){window.xPSL=xScrollLeft();window.xPST=xScrollTop();window.xSEL=eL;xScrollEvent();return;}}var eh='e.on'+eT+'=eL';if(e.addEventListener)e.addEventListener(eT,eL,cap);else if(e.attachEvent)e.attachEvent('on'+eT,eL);else eval(eh);}function xResizeEvent(){if(window.xREL)setTimeout('xResizeEvent()',250);var cw=xClientWidth(),ch=xClientHeight();if(window.xPCW !=cw || window.xPCH !=ch){window.xPCW=cw;window.xPCH=ch;if(window.xREL)window.xREL();}}function xScrollEvent(){if(window.xSEL)setTimeout('xScrollEvent()',250);var sl=xScrollLeft(),st=xScrollTop();if(window.xPSL !=sl || window.xPST !=st){window.xPSL=sl;window.xPST=st;if(window.xSEL)window.xSEL();}}function xEvent(evt){var e=evt || window.event;if(!e)return;if(e.type)this.type=e.type;if(e.target)this.target=e.target;else if(e.srcElement)this.target=e.srcElement;if(e.relatedTarget)this.relatedTarget=e.relatedTarget;else if(e.type=='mouseover' && e.fromElement)this.relatedTarget=e.fromElement;else if(e.type=='mouseout')this.relatedTarget=e.toElement;if(xOp6Dn){this.pageX=e.clientX;this.pageY=e.clientY;}else if(xDef(e.pageX,e.pageY)){this.pageX=e.pageX;this.pageY=e.pageY;}else if(xDef(e.clientX,e.clientY)){this.pageX=e.clientX+xScrollLeft();this.pageY=e.clientY+xScrollTop();}if(xDef(e.offsetX,e.offsetY)){this.offsetX=e.offsetX;this.offsetY=e.offsetY;}else if(xDef(e.layerX,e.layerY)){this.offsetX=e.layerX;this.offsetY=e.layerY;}else{this.offsetX=this.pageX-xPageX(this.target);this.offsetY=this.pageY-xPageY(this.target);}if(e.keyCode){this.keyCode=e.keyCode;}else if(xDef(e.which)&& e.type.indexOf('key')!=-1){this.keyCode=e.which;}this.shiftKey=e.shiftKey;this.ctrlKey=e.ctrlKey;this.altKey=e.altKey;}function xPreventDefault(e){if(e && e.preventDefault)e.preventDefault();else if(window.event)window.event.returnValue=false;}function xRemoveEventListener(e,eT,eL,cap){if(!(e=xGetElementById(e)))return;eT=eT.toLowerCase();if((!xIE4Up && !xOp7Up)&& e==window){if(eT=='resize'){window.xREL=null;return;}if(eT=='scroll'){window.xSEL=null;return;}}var eh='e.on'+eT+'=null';if(e.removeEventListener)e.removeEventListener(eT,eL,cap);else if(e.detachEvent)e.detachEvent('on'+eT,eL);else eval(eh);}function xStopPropagation(evt){if(evt && evt.stopPropagation)evt.stopPropagation();else if(window.event)window.event.cancelBubble=true;}
 function xEnableDrag(id,fS,fD,fE){var mx=0,my=0,el=xGetElementById(id);if(el){el.xDragEnabled=true;xAddEventListener(el,'mousedown',dragStart,false);}function dragStart(e){if(el.xDragEnabled){var ev=new xEvent(e);xPreventDefault(e);mx=ev.pageX;my=ev.pageY;xAddEventListener(document,'mousemove',drag,false);xAddEventListener(document,'mouseup',dragEnd,false);if(fS){fS(el,ev.pageX,ev.pageY,ev);}}}function drag(e){var ev,dx,dy;xPreventDefault(e);ev=new xEvent(e);dx=ev.pageX-mx;dy=ev.pageY-my;mx=ev.pageX;my=ev.pageY;if(fD){fD(el,dx,dy,ev);}else{xMoveTo(el,el.offsetLeft+dx,el.offsetTop+dy);}}function dragEnd(e){var ev=new xEvent(e);xPreventDefault(e);xRemoveEventListener(document,'mouseup',dragEnd,false);xRemoveEventListener(document,'mousemove',drag,false);if(fE){fE(el,ev.pageX,ev.pageY,ev);}if(xEnableDrag.drop){xEnableDrag.drop(el,ev);}}}xEnableDrag.drops=[];
 function toolTip(oMap){this.Map=oMap;this.image=null;this.domObj=null;this.viewport=this.Map.domObj;this.visible=false;this.init();};toolTip.prototype.init=function(){this.domObj=document.createElement('div');this.domObj.setAttribute('id','toolTip');this.minZindex=1;this.coordX=null;this.coordY=null;this.viewport.appendChild(this.domObj);this.domObj.style.position='absolute';this.move();this.domObj.toolTip=this;this.domObj.style.zIndex=this.minZindex;this.domObj.onclick=this.onclick;this.setText('Wait a moment please!');this.Map.registerForEvent(MAP_MAP_CLICKED,this,this.onclick);this.Map.registerForEvent(MAP_EXTENTS_CHANGED,this,this.extentChanged);};toolTip.prototype.onclick=function(e){hideTooltip();};toolTip.prototype.setText=function(text){this.domObj.innerHTML=text;};toolTip.prototype.setTipImage=function(url,offsetX,offsetY){offsetX=(offsetX)?offsetX:0;offsetY=(offsetX)?offsetY:0;image=document.createElement('img');image.src=url;image.setAttribute('id','toolTipImage');image.style.position='absolute';image.style.zIndex=this.minZindex++;image.style.top='-20px';image.style.left='-20px';image.offsetX=offsetX;image.offsetY=offsetY;this.image=image;this.viewport.appendChild(image);};toolTip.prototype.moveGeo=function(pX,pY){var pixPos=this.Map.geoToPix(pX,pY);var nPixPos=this.Map.currentTool.adjustPixPosition(pixPos[0]*(-1),pixPos[1]*(-1));var newX=nPixPos[0];var newY=nPixPos[1];this.move(newX,newY,true);};toolTip.prototype.move=function(){var x=0;var y=0;var aPixPos=0;var geoPix=0;var noRecenter=false;if(arguments.length<2){this.visible=false;this.domObj.style.top='-10000px';this.domObj.style.left='-10000px';aPixPos=this.Map.currentTool.adjustPixPosition(parseInt(x),parseInt(y));var geoCoords=this.Map.pixToGeo(aPixPos[0],aPixPos[1]);this.coordX=geoCoords[0];this.coordY=geoCoords[1];if(this.image)this.image.style.top='-100000px';if(this.image)this.image.style.left='-100000px';}else{x=parseInt(arguments[0]);y=parseInt(arguments[1]);this.visible=true;aPixPos=this.Map.currentTool.adjustPixPosition(parseInt(x),parseInt(y));var geoCoords=this.Map.pixToGeo(aPixPos[0],aPixPos[1]);this.coordX=geoCoords[0];this.coordY=geoCoords[1];x+=15;var ph=getObjectHeight(this.domObj);var vh=this.Map.viewportHeight;var pw=getObjectWidth(this.domObj);var vw=this.Map.viewportWidth;this.domObj.style.left=vw/2-pw/2+'px';this.domObj.style.top='105px';if((arguments[2])&& arguments[2]==true)noRecenter=true;if(!noRecenter)this.recenter(this.domObj);}};toolTip.prototype.adjustPosition=function(x,y){var ny=parseInt(this.domObj.style.top)+y;var nx=parseInt(this.domObj.style.left)+x;this.domObj.style.top=ny+'px';this.domObj.style.left=nx+'px';if(this.image)this.image.style.top=(parseInt(this.image.style.top)+y)+'px';if(this.image)this.image.style.left=(parseInt(this.image.style.left)+x)+'px';};toolTip.prototype.recenter=function(tip){var tipWidth=getObjectWidth(tip);var tipHeight=getObjectHeight(tip);var tipTop=parseInt(tip.style.top);var tipLeft=parseInt(tip.style.left);var viewportWheight=tip.toolTip.Map.viewportHeight;var viewportWidth=tip.toolTip.Map.viewportWidth;var topSlide=1;var leftSlide=1;if((tipTop+tipHeight)>viewportWheight)topSlide=(tipTop+tipHeight)-viewportWheight;if((tipLeft+tipWidth)>viewportWidth)leftSlide=(tipLeft+tipWidth)-viewportWidth;if(tipLeft<0)leftSlide=tipLeft-20;if(tipTop<0)topSlide=tipTop-20;if(topSlide!=1 || leftSlide!=1){tip.toolTip.Map.slideBy(-(leftSlide+10),-(topSlide+10));tip.toolTip.adjustPosition(-(leftSlide+10),-(topSlide+10));}};toolTip.prototype.extentChanged=function(){var pixPos=this.Map.geoToPix(this.coordX,this.coordY);var nPixPos=this.Map.currentTool.adjustPixPosition(pixPos[0]*(-1),pixPos[1]*(-1));var newX=nPixPos[0];var newY=nPixPos[1];if(this.visible)this.move(newX,newY,true);};
function ScaleBar(scaleDenominator){this.scaleDenominator=(scaleDenominator==null)? 1 : scaleDenominator;this.displaySystem='metric';this.minWidth=100;this.maxWidth=200;this.divisions=2;this.subdivisions=2;this.showMinorMeasures=false;this.abbreviateLabel=false;this.singleLine=false;this.resolution=72;this.align='center';this.container=document.createElement('div');this.container.className='sbWrapper';this.labelContainer=document.createElement('div');this.labelContainer.className='sbUnitsContainer';this.labelContainer.style.position='absolute';this.graphicsContainer=document.createElement('div');this.graphicsContainer.style.position='absolute';this.graphicsContainer.className='sbGraphicsContainer';this.numbersContainer=document.createElement('div');this.numbersContainer.style.position='absolute';this.numbersContainer.className='sbNumbersContainer';var markerMajor=document.createElement('div');markerMajor.className='sbMarkerMajor';this.graphicsContainer.appendChild(markerMajor);var markerMinor=document.createElement('div');markerMinor.className='sbMarkerMinor';this.graphicsContainer.appendChild(markerMinor);var barPiece=document.createElement('div');barPiece.className='sbBar';this.graphicsContainer.appendChild(barPiece);var barPieceAlt=document.createElement('div');barPieceAlt.className='sbBarAlt';this.graphicsContainer.appendChild(barPieceAlt);}ScaleBar.prototype.update=function(scaleDenominator){if(scaleDenominator !=null){this.scaleDenominator=scaleDenominator;};function HandsomeNumber(smallUglyNumber,bigUglyNumber,sigFigs){var sigFigs=(sigFigs==null)? 10 : sigFigs;var bestScore=Number.POSITIVE_INFINITY;var bestTieBreaker=Number.POSITIVE_INFINITY;var handsomeValue=smallUglyNumber;var handsomeNumDec=3;for(var halvingExp=0;halvingExp<3;++halvingExp){var comelyMultiplicand=Math.pow(2,(-1*halvingExp));var maxTensExp=Math.floor(Math.log(bigUglyNumber/comelyMultiplicand)/Math.LN10);for(var tensExp=maxTensExp;tensExp>(maxTensExp-sigFigs+1);--tensExp){var numDec=Math.max(halvingExp-tensExp,0);var testMultiplicand=comelyMultiplicand*Math.pow(10,tensExp);if((testMultiplicand*Math.floor(bigUglyNumber/testMultiplicand))>=smallUglyNumber){if(smallUglyNumber % testMultiplicand==0){var testMultiplier=smallUglyNumber/testMultiplicand;}else{var testMultiplier=Math.floor(smallUglyNumber/testMultiplicand)+1;}var testScore=testMultiplier+(2*halvingExp);var testTieBreaker=(tensExp<0)?(Math.abs(tensExp)+1): tensExp;if((testScore<bestScore)||((testScore==bestScore)&&(testTieBreaker<bestTieBreaker))){bestScore=testScore;bestTieBreaker=testTieBreaker;handsomeValue=(testMultiplicand*testMultiplier).toFixed(numDec);handsomeNumDec=numDec;}}}}this.value=handsomeValue;this.score=bestScore;this.tieBreaker=bestTieBreaker;this.numDec=handsomeNumDec;};HandsomeNumber.prototype.toString=function(){return this.value.toString();};HandsomeNumber.prototype.valueOf=function(){return this.value;};function styleValue(aSelector,styleKey){var aValue=0;if(document.styleSheets){for(var sheetIndex=document.styleSheets.length-1;sheetIndex>=0;--sheetIndex){var aSheet=document.styleSheets[sheetIndex];if(!aSheet.disabled){return 0;}}}return aValue ? aValue : 0;};function formatNumber(aNumber,numDecimals){numDecimals=(numDecimals)? numDecimals : 0;var formattedInteger=''+Math.round(aNumber);var thousandsPattern=/(-?[0-9]+)([0-9]{3})/;while(thousandsPattern.test(formattedInteger)){formattedInteger=formattedInteger.replace(thousandsPattern,'$1,$2');}if(numDecimals>0){var formattedDecimal=Math.floor(Math.pow(10,numDecimals)*(aNumber-Math.round(aNumber)));if(formattedDecimal==0){return formattedInteger;}else{return formattedInteger+'.'+formattedDecimal;}}else{return formattedInteger;}};var measurementProperties=new Object();measurementProperties.english={units: ['miles','feet','inches'],abbr: ['mi','ft','in'],inches: [63360,12,1]};measurementProperties.metric={units: ['kilometer'],abbr: ['km'],inches: [39370.07874]};var comparisonArray=new Array();for(var unitIndex=0;unitIndex<measurementProperties[this.displaySystem].units.length;++unitIndex){comparisonArray[unitIndex]=new Object();var pixelsPerDisplayUnit=this.resolution*measurementProperties[this.displaySystem].inches[unitIndex]/this.scaleDenominator;var minSDDisplayLength=(this.minWidth/pixelsPerDisplayUnit)/(this.divisions*this.subdivisions);var maxSDDisplayLength=(this.maxWidth/pixelsPerDisplayUnit)/(this.divisions*this.subdivisions);for(var valueIndex=0;valueIndex<(this.divisions*this.subdivisions);++valueIndex){var minNumber=minSDDisplayLength*(valueIndex+1);var maxNumber=maxSDDisplayLength*(valueIndex+1);var niceNumber=new HandsomeNumber(minNumber,maxNumber);comparisonArray[unitIndex][valueIndex]={value:(niceNumber.value/(valueIndex+1)),score: 0,tieBreaker: 0,numDec: 0,displayed: 0};for(var valueIndex2=0;valueIndex2<(this.divisions*this.subdivisions);++valueIndex2){displayedValuePosition=niceNumber.value*(valueIndex2+1)/(valueIndex+1);niceNumber2=new HandsomeNumber(displayedValuePosition,displayedValuePosition);var isMajorMeasurement=((valueIndex2+1)% this.subdivisions==0);var isLastMeasurement=((valueIndex2+1)==(this.divisions*this.subdivisions));if((this.singleLine && isLastMeasurement)||(!this.singleLine &&(isMajorMeasurement || this.showMinorMeasures))){comparisonArray[unitIndex][valueIndex].score+=niceNumber2.score;comparisonArray[unitIndex][valueIndex].tieBreaker+=niceNumber2.tieBreaker;comparisonArray[unitIndex][valueIndex].numDec=Math.max(comparisonArray[unitIndex][valueIndex].numDec,niceNumber2.numDec);comparisonArray[unitIndex][valueIndex].displayed+=1;}else{comparisonArray[unitIndex][valueIndex].score+=niceNumber2.score/this.subdivisions;comparisonArray[unitIndex][valueIndex].tieBreaker+=niceNumber2.tieBreaker/this.subdivisions;}}var scoreAdjustment=(unitIndex+1)*comparisonArray[unitIndex][valueIndex].tieBreaker/comparisonArray[unitIndex][valueIndex].displayed;comparisonArray[unitIndex][valueIndex].score*=scoreAdjustment;}}var subdivisionDisplayLength=null;var displayUnits=null;var displayUnitsAbbr=null;var subdivisionPixelLength=null;var bestScore=Number.POSITIVE_INFINITY;var bestTieBreaker=Number.POSITIVE_INFINITY;var numDec=0;for(var unitIndex=0;unitIndex<comparisonArray.length;++unitIndex){for(valueIndex in comparisonArray[unitIndex]){if((comparisonArray[unitIndex][valueIndex].score<bestScore)||((comparisonArray[unitIndex][valueIndex].score==bestScore)&&(comparisonArray[unitIndex][valueIndex].tieBreaker<bestTieBreaker))){bestScore=comparisonArray[unitIndex][valueIndex].score;bestTieBreaker=comparisonArray[unitIndex][valueIndex].tieBreaker;subdivisionDisplayLength=comparisonArray[unitIndex][valueIndex].value;numDec=comparisonArray[unitIndex][valueIndex].numDec;displayUnits=measurementProperties[this.displaySystem].units[unitIndex];displayUnitsAbbr=measurementProperties[this.displaySystem].abbr[unitIndex];pixelsPerDisplayUnit=this.resolution*measurementProperties[this.displaySystem].inches[unitIndex]/this.scaleDenominator;subdivisionPixelLength=pixelsPerDisplayUnit*subdivisionDisplayLength;}}}var xOffsetMarkerMajor=(styleValue('.sbMarkerMajor','borderLeftWidth')+styleValue('.sbMarkerMajor','width')+styleValue('.sbMarkerMajor','borderRightWidth'))/2;var xOffsetMarkerMinor=(styleValue('.sbMarkerMinor','borderLeftWidth')+styleValue('.sbMarkerMinor','width')+styleValue('.sbMarkerMinor','borderRightWidth'))/2;var xOffsetBar=(styleValue('.sbBar','borderLeftWidth')+styleValue('.sbBar','borderRightWidth'))/2;var xOffsetBarAlt=(styleValue('.sbBarAlt','borderLeftWidth')+styleValue('.sbBarAlt','borderRightWidth'))/2;if(!document.styleSheets){xOffsetMarkerMajor=0.5;xOffsetMarkerMinor=0.5;}while(this.labelContainer.hasChildNodes()){this.labelContainer.removeChild(this.labelContainer.firstChild);}while(this.graphicsContainer.hasChildNodes()){this.graphicsContainer.removeChild(this.graphicsContainer.firstChild);}while(this.numbersContainer.hasChildNodes()){this.numbersContainer.removeChild(this.numbersContainer.firstChild);}var aMarker,aBarPiece,numbersBox,xOffset;var alignmentOffset={left: 0,center:(-1*this.divisions*this.subdivisions*subdivisionPixelLength/2),right:(-1*this.divisions*this.subdivisions*subdivisionPixelLength)};var xPosition=0+alignmentOffset[this.align];var markerMeasure=0;for(var divisionIndex=0;divisionIndex<this.divisions;++divisionIndex){xPosition=divisionIndex*this.subdivisions*subdivisionPixelLength;xPosition+=alignmentOffset[this.align];markerMeasure=(divisionIndex==0)? 0 :((divisionIndex*this.subdivisions)*subdivisionDisplayLength).toFixed(numDec);aMarker=document.createElement('div');aMarker.className='sbMarkerMajor';aMarker.style.position='absolute';aMarker.style.overflow='hidden';aMarker.style.left=Math.round(xPosition-xOffsetMarkerMajor)+'px';aMarker.appendChild(document.createTextNode(' '));this.graphicsContainer.appendChild(aMarker);if(!this.singleLine){numbersBox=document.createElement('div');numbersBox.className='sbNumbersBox';numbersBox.style.position='absolute';numbersBox.style.overflow='hidden';numbersBox.style.textAlign='center';if(this.showMinorMeasures){numbersBox.style.width=Math.round(subdivisionPixelLength*2)+'px';numbersBox.style.left=Math.round(xPosition-subdivisionPixelLength)+'px';}else{numbersBox.style.width=Math.round(this.subdivisions*subdivisionPixelLength*2)+'px';numbersBox.style.left=Math.round(xPosition-(this.subdivisions*subdivisionPixelLength))+'px';}numbersBox.appendChild(document.createTextNode(markerMeasure));this.numbersContainer.appendChild(numbersBox);}for(var subdivisionIndex=0;subdivisionIndex<this.subdivisions;++subdivisionIndex){aBarPiece=document.createElement('div');aBarPiece.style.position='absolute';aBarPiece.style.overflow='hidden';aBarPiece.style.width=Math.round(subdivisionPixelLength)+'px';if((subdivisionIndex % 2)==0){aBarPiece.className='sbBar';aBarPiece.style.left=Math.round(xPosition-xOffsetBar)+'px';}else{aBarPiece.className='sbBarAlt';aBarPiece.style.left=Math.round(xPosition-xOffsetBarAlt)+'px';}aBarPiece.appendChild(document.createTextNode(' '));this.graphicsContainer.appendChild(aBarPiece);if(subdivisionIndex<(this.subdivisions-1)){xPosition=((divisionIndex*this.subdivisions)+(subdivisionIndex+1))*subdivisionPixelLength;xPosition+=alignmentOffset[this.align];markerMeasure=(divisionIndex*this.subdivisions+subdivisionIndex+1)*subdivisionDisplayLength;aMarker=document.createElement('div');aMarker.className='sbMarkerMinor';aMarker.style.position='absolute';aMarker.style.overflow='hidden';aMarker.style.left=Math.round(xPosition-xOffsetMarkerMinor)+'px';aMarker.appendChild(document.createTextNode(' '));this.graphicsContainer.appendChild(aMarker);if(this.showMinorMeasures && !this.singleLine){numbersBox=document.createElement('div');numbersBox.className='sbNumbersBox';numbersBox.style.position='absolute';numbersBox.style.overflow='hidden';numbersBox.style.textAlign='center';numbersBox.style.width=Math.round(subdivisionPixelLength*2)+'px';numbersBox.style.left=Math.round(xPosition-subdivisionPixelLength)+'px';numbersBox.appendChild(document.createTextNode(markerMeasure));this.numbersContainer.appendChild(numbersBox);}}}}xPosition=(this.divisions*this.subdivisions)*subdivisionPixelLength;xPosition+=alignmentOffset[this.align];markerMeasure=((this.divisions*this.subdivisions)*subdivisionDisplayLength).toFixed(numDec);aMarker=document.createElement('div');aMarker.className='sbMarkerMajor';aMarker.style.position='absolute';aMarker.style.overflow='hidden';aMarker.style.left=Math.round(xPosition-xOffsetMarkerMajor)+'px';aMarker.appendChild(document.createTextNode(' '));this.graphicsContainer.appendChild(aMarker);if(!this.singleLine){numbersBox=document.createElement('div');numbersBox.className='sbNumbersBox';numbersBox.style.position='absolute';numbersBox.style.overflow='hidden';numbersBox.style.textAlign='center';if(this.showMinorMeasures){numbersBox.style.width=Math.round(subdivisionPixelLength*2)+'px';numbersBox.style.left=Math.round(xPosition-subdivisionPixelLength)+'px';}else{numbersBox.style.width=Math.round(this.subdivisions*subdivisionPixelLength*2)+'px';numbersBox.style.left=Math.round(xPosition-(this.subdivisions*subdivisionPixelLength))+'px';}numbersBox.appendChild(document.createTextNode(markerMeasure));this.numbersContainer.appendChild(numbersBox);}var labelBox=document.createElement('div');labelBox.style.position='absolute';var labelText;if(this.singleLine){labelText=markerMeasure;labelBox.className='sbLabelBoxSingleLine';labelBox.style.top='-0.6em';labelBox.style.left=(xPosition+10)+'px';}else{labelText='';labelBox.className='sbLabelBox';labelBox.style.textAlign='center';labelBox.style.width=Math.round(this.divisions*this.subdivisions*subdivisionPixelLength)+'px';labelBox.style.left=Math.round(alignmentOffset[this.align])+'px';labelBox.style.overflow='hidden';}if(this.abbreviateLabel){labelText+=' '+displayUnitsAbbr;}else{labelText+=' '+displayUnits;}labelBox.appendChild(document.createTextNode(labelText));this.labelContainer.appendChild(labelBox);if(!document.styleSheets){var defaultStyle=document.createElement('style');defaultStyle.type='text/css';var styleText='.sbBar{top: 0px;background: #666666;height: 1px;border: 0;}';styleText+='.sbBarAlt{top: 0px;background: #666666;height: 1px;border: 0;}';styleText+='.sbMarkerMajor{height: 7px;width: 1px;background: #666666;border: 0;}';styleText+='.sbMarkerMinor{height: 5px;width: 1px;background: #666666;border: 0;}';styleText+='.sbLabelBox{top:-16px;}';styleText+='.sbNumbersBox{top: 7px;}';defaultStyle.appendChild(document.createTextNode(styleText));document.getElementsByTagName('head').item(0).appendChild(defaultStyle);}this.container.appendChild(this.graphicsContainer);this.container.appendChild(this.labelContainer);this.container.appendChild(this.numbersContainer);};ScaleBar.prototype.place=function(elementId){if(elementId==null){document.body.appendChild(this.container);}else{var anElement=document.getElementById(elementId);if(anElement !=null){anElement.appendChild(this.container);}}this.update();};
 var myMap=myNavigator=myCanvas=myToolTip=myScalebar=null;var queryParams=null;function parseQueryString(){queryParams={};var s=window.location.search;if(s!=''){s=s.substring(1);var p=s.split('&');for(var i=0;i<p.length;i++){var q=p[i].split('=');queryParams[q[0]]=q[1];}}}function getQueryParam(p){if(!queryParams){parseQueryString();}if(queryParams[p]){return queryParams[p];}else{return '';}}function myInitialized(){}function myMapInitialized(eventID,mapName){var aMaps=myMap.getMaps();var layers=getQueryParam('layers');if(layers !=''){var map=myMap.getCurrentMap();var allLayers=map.getAllLayers();for(var i=0;i<allLayers.length;i++){allLayers[i].setVisibility(false);}aLayers=layers.split(',');for(var i=0;i<aLayers.length;i++){map.setLayerVisibility(unescape(aLayers[i]),true);}}setCurrentMap();if(document.formSearch.plz.value!="" || document.formSearch.ort.value!="" || document.formSearch.str.value!=""){adrSearch('','','');}else if(adrXCoord!="" && adrYCoord!=""){zoomTo(adrXCoord,adrYCoord,600000,"");}}function myExtentChanged(eventID,extents){shopSearch();}function myLayersChanged(eventID,map){}function myScaleChanged(eventID,scale){var stufe;switch(scale){case "16000000": stufe=6;break;case "3000000": stufe=5;break;case "1000000": stufe=4;break;case "400000": stufe=3;break;case "80000": stufe=2;break;case "55000": stufe=1;break;default:alert("zoom: unknown Scale="+scale);break;}if(stufe>6)stufe=6;if(stufe<1)stufe=1;var i;for(i=1;i<=6;i++){document.images['zoom'+i].src="images/zoomlevel.png";}var drO=document.getElementById(_zoomSelectorName);if(drO){var mypos=draggableZoomGetPosition(document.getElementById('zoom'+stufe));drO.style.top=mypos.y+"px";drO.style.left=mypos.x+"px";}xEnableDrag(_zoomSelectorName,null,draggableZoomStart,null);g_zoomLevel=stufe;if(document.formSearch.shop.checked){myMap.removeObject(null);aShop=new Array();shopSearch();}var d=document.getElementById('scaleReference');d.style.visibility='visible';myScalebar.update(scale/4);}function mySetScale(scale){myMap.zoomToScale(scale);}function mySetMap(name){myMap.selectMap(name);}function myMapClicked(eventID,coords,pix){myMap.zoomIn(coords[0],coords[1]);}function myZoomIn(){myMap.zoomIn();}function myZoomOut(){myMap.zoomOut();}function drawPage(){}function getFullExtent(){var exStr=myMap.getCurrentMap().defaultExtents.toString();var ex=myMap.getCurrentMap().defaultExtents;myMap.zoomToExtents(ex[0],ex[1],ex[2],ex[3]);}function switchMode(id){if(id=='toolPan'){myNavigator.activate();getRawObject('toolPan').style.backgroundImage='url(images/tool_pan_2.png)';getRawObject('toolZoomRubber').style.backgroundImage='url(images/tool_rubberzoom_1.png)';}else if(id=='toolZoomRubber'){myRubberZoom.activate();getRawObject('toolPan').style.backgroundImage='url(images/tool_pan_1.png)';getRawObject('toolZoomRubber').style.backgroundImage='url(images/tool_rubberzoom_2.png)';}else{myNavigator.activate();}}function applyPNGFilter(o){var t="images/a_pixel.gif";if(o.src !=t){var s=o.src;o.src=t;o.runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+s+"',sizingMethod='scale')";}}function WOFocusWin(nn){eval("if(this."+name+")this."+name+".moveTo(50,50);this."+name+".focus();");}function WOOpenWin(name,url,ctrl){eval("this."+name+"=window.open('"+url+"','"+name+"','"+ctrl+"');");}function WinOpener(){this.openWin=WOOpenWin;this.focusWin=WOFocusWin;}function myUrlEncode(string){encodedHtml=escape(string);encodedHtml=encodedHtml.replace("/","%2F");encodedHtml=encodedHtml.replace(/\?/g,"%3F");encodedHtml=encodedHtml.replace(/=/g,"%3D");encodedHtml=encodedHtml.replace(/&/g,"%26");encodedHtml=encodedHtml.replace(/@/g,"%40");return encodedHtml;};function myUrlDecode(sz){return unescape(sz).replace(/\+/g," ");};function roundIt(number,decimals){var base10=10;for(var i=0;i<decimals-1;i++)base10=base10*10;return Math.round(number*base10)/base10;}function getWindowParameter(width,height){var sw=screen.width/2;var sh=screen.height/2;var left=sw-width/2;var top=sh-height/2;return "width="+width+",height="+height+",resizable=0,left="+left+",top="+top+",location=0,menubar=0,scrollbars=1";}
function updateZoomBar(selectedZoomLevel){var selectedZoom=document.getElementById(selectedZoomLevel);if(selectedZoom !=null){var dragObject=document.getElementById(_zoomSelectorName);if(dragObject){var mypos=draggableZoomGetPosition(selectedZoom);dragObject.style.top=mypos.y;dragObject.style.left=mypos.x;}}}function draggableZoomGetMouseCoords(ev){if(ev.pageX || ev.pageY){return{x:ev.pageX,y:ev.pageY};}return{x:ev.clientX+document.body.scrollLeft-document.body.clientLeft,y:ev.clientY+document.body.scrollTop-document.body.clientTop};}function draggableZoomGetPosition(e){var left=0;var top=0;if(e!=null){while(e.offsetParent){left+=e.offsetLeft;top+=e.offsetTop;e=e.offsetParent;}left+=e.offsetLeft;top+=e.offsetTop;}return{x:left,y:top};}function draggableZoomMoveSelector(ev){if(_dO){ev=ev || window.event;var mousePos=draggableZoomGetMouseCoords(ev);if((mousePos.y-4)>=_dragMin &&(mousePos.y-4)<=_dragMax){_dO.style.position='absolute';_dO.style.top=mousePos.y-4+"px";return false;}}}function draggableZoomStart(){_dO=document.getElementById(_zoomSelectorName);_dO.onmousemove=draggableZoomMoveSelector;var min=document.getElementById('zoom1');var max=document.getElementById('zoom6');if(min && max){_dragMin=draggableZoomGetPosition(min).y;_dragMax=draggableZoomGetPosition(max).y;}return false;}function draggableZoomEnd(){if(_dO){var diff=parseInt(_dO.style.top)-_dragMin;_dO.onmousemove=null;_dO=null;var level=parseInt(diff/11)+1;zoom(level);}}
