var fromAKS="";var gbCommonPresent=true;jsPlace="parent.MapFrame";var queryTool=0;var legendImage="";var modeBlurb="Vergr&ouml;ssern";var chkUnits=false;var legendTemp=false;var ovIsVisible=false;var showBuffer=false;var theImagePath="";var theImageURLPath="";var theServiceName="";var theVersion=navigator.appVersion;var theVersNum=parseFloat(theVersion);var theBrowser=navigator.appName;var noOverlay=true;var isMac=false;if(navigator.appVersion.indexOf("Mac")>0)isMac=true;function startUp(){if(imsURL!=""){iWidth=document.theImage.width;iHeight=document.theImage.height;if(parent.PostFrame.document.forms[0]!=null){startMapRequest("PostFrame");}else{alert("Start nicht möglich. Das benötigte Formular ist nicht vorhanden. Drücken sie <F5>.\nFalls Sie den GIS-Browser direkt aus den Favoriten starten wollen, beachten Sie bitte die Hinweise in Hilfe->Diverses->FAQ.");}}}function setFromAKS(url){fromAKS = url;}function runden(Zahl,Stellen){var u=Math.pow(10,Stellen);return parseInt(Zahl*u+0.5)/u;}function getMapWidth(){var mapFrameWidth=thePageWin.innerWidth;if(mapFrameWidth==null){mapFrameWidth=thePageDoc.body.clientWidth;}return mapFrameWidth;}function getMapHeight(){var mapFrameHeight=thePageWin.innerHeight;if(mapFrameHeight==null){mapFrameHeight=thePageDoc.body.clientHeight;}return mapFrameHeight;}function checkCurrentExtent(){var msg="Current Extent:\nLeft: "+left+"\nBottom: "+bottom+"\nRight: "+right+"\nTop: "+top;var ratio1=xDistance/fullWidth;msg+="\n\nRatio to Full Extent: "+ratio1;alert(msg);}function writeModeFrame(currentMode){parent.ModeFrame.document.location=appDir+"ModeFrame.htm";}function writeModeLayers(currentMode){var content='<font face="'+modeLayerFont+'"color="'+modeLayerShadowColor+'"size='+modeLayerSize+'><b>'+currentMode+'</b></font>';replaceLayerContent("theMode1",content);content='<font face="'+modeLayerFont+'"color="'+modeLayerColor+'"size='+modeLayerSize+'><b>'+currentMode+'</b></font>';replaceLayerContent("theMode2",content);}gbNavigationPresent=true;function getMapXY(xIn,yIn){mouseX=xIn;pixelX=xDistance/iWidth;mapX=pixelX*mouseX+left;mouseY=iHeight-yIn;pixelY=yDistance/iHeight;mapY=pixelY*mouseY+bottom;}function getImageXY(e){if(isNav){mouseX=e.pageX;mouseY=e.pageY;}else{mouseX=event.clientX+document.body.scrollLeft;mouseY=event.clientY+document.body.scrollTop;}mouseX=mouseX-hspc;mouseY=mouseY-vspc;}function zoomin(e){setInputValue("Karte.x",mouseX);setInputValue("Karte.y",mouseY);setInputValue("Factor",2);setInputValue("Cmd","ZOOMIN");hideLayer("zoomBoxTop");hideLayer("zoomBoxLeft");hideLayer("zoomBoxRight");hideLayer("zoomBoxBottom");window.scrollTo(0,0);sendMapRequest("_self");}function zoomout(e){setInputValue("Karte.x",mouseX);setInputValue("Karte.y",mouseY);setInputValue("Factor",2);setInputValue("Cmd","ZOOMOUT");hideLayer("zoomBoxTop");hideLayer("zoomBoxLeft");hideLayer("zoomBoxRight");hideLayer("zoomBoxBottom");window.scrollTo(0,0);sendMapRequest("_self");}function getMouse(e){window.status="";getImageXY(e);if(isIE){document.all.theTop.style.cursor="default";}if((mouseX>iWidth)||(mouseY>iHeight)||(mouseX<=0)||(mouseY<=0)){chkMouseUp(e);}else{if((zooming)||(selectBox)){x2=mouseX;y2=mouseY;setClip();}else if(panning){x2=mouseX;y2=mouseY;panMouse();}pixelX=xDistance/iWidth;mapX=(pixelX*mouseX)+left;var theY=iHeight-mouseY;pixelY=yDistance/iHeight;mapY=(pixelY*theY)+bottom;if(toolMode==20){calcDistance(mapX,mapY);moveRub1Layers(mouseX,mouseY);}if(toolMode==21){moveRub1Layers(mouseX,mouseY);moveRub2Layers(mouseX,mouseY);}else if(showXYs){var u=Math.pow(10,numDecimals);var uX=parseInt(mapX*u+0.5)/u;var uY=parseInt(mapY*u+0.5)/u;var mouseString="Koordinaten: "+uX+" , "+uY;window.status=mouseString;}}return false;}function startZoomBox(e){moveLayer("theMap",hspc,vspc);getImageXY(e);if((mouseX<iWidth)&&(mouseY<iHeight)){if(zooming){stopZoomBox(e);}else{x1=mouseX;y1=mouseY;x2=x1+1;y2=y1+1;zleft=x1;ztop=y1;zbottom=y1;zright=x1;boxIt(x1,y1,x2,y2);zooming=true;showLayer("zoomBoxTop");showLayer("zoomBoxLeft");showLayer("zoomBoxRight");showLayer("zoomBoxBottom");}}return false;}function stopZoomBox(e){zooming=false;if((zright<zleft+2)&&(zbottom<ztop+2)){zoomin(e);}else{var tempX=(zleft+zright)/2;var tempY=(zbottom+ztop)/2;var tempFactW=iWidth/(zright-zleft);var tempFactH=iHeight/(zbottom-ztop);var tempFact=tempFactW;if(tempFactH<tempFactW){tempFact=tempFactH;}setInputValue("Karte.x",tempX);setInputValue("Karte.y",tempY);setInputValue("Factor",tempFact);setInputValue("Cmd","ZOOMIN");window.scrollTo(0,0);sendMapRequest("_self");hideLayer("zoomBoxTop");hideLayer("zoomBoxLeft");hideLayer("zoomBoxRight");hideLayer("zoomBoxBottom");}return true;}function startZoomOutBox(e){moveLayer("theMap",hspc,vspc);getImageXY(e);if((mouseX<iWidth)&&(mouseY<iHeight)){if(zooming){stopZoomOutBox(e);}else{x1=mouseX;y1=mouseY;x2=x1+1;y2=y1+1;zleft=x1;ztop=y1;zbottom=y1;zright=x1;boxIt(x1,y1,x2,y2);zooming=true;showLayer("zoomBoxTop");showLayer("zoomBoxLeft");showLayer("zoomBoxRight");showLayer("zoomBoxBottom");}}return false;}function stopZoomOutBox(e){zooming=false;if((zright<zleft+2)&&(zbottom<ztop+2)){zoomout(e);}else{var tempX=(zleft+zright)/2;var tempY=(zbottom+ztop)/2;var tempFactW=iWidth/(zright-zleft);var tempFactH=iHeight/(zbottom-ztop);var tempFact=tempFactW;if(tempFactH<tempFactW){tempFact=tempFactH;}setInputValue("Karte.x",tempX);setInputValue("Karte.y",tempY);setInputValue("Factor",tempFact);setInputValue("Cmd","ZOOMOUT");window.scrollTo(0,0);sendMapRequest("_self");hideLayer("zoomBoxTop");hideLayer("zoomBoxLeft");hideLayer("zoomBoxRight");hideLayer("zoomBoxBottom");}return true;}function setClip(){var tempX=x1;var tempY=y1;if(x1>x2){zright=x1;zleft=x2;}else{zleft=x1;zright=x2;}if(y1>y2){zbottom=y1;ztop=y2;}else{ztop=y1;zbottom=y2;}if((x1!=x2)&&(y1!=y2)){boxIt(zleft,ztop,zright,zbottom);}}function startPan(e){moveLayer("theMap",hspc,vspc);getImageXY(e);if((mouseX<iWidth)&&(mouseY<iHeight)){if(panning){stopPan(e);}else{x1=mouseX;y1=mouseY;x2=x1+1;y2=y1+1;panning=true;}}return false;}function stopPan(e){panning=false;var ixOffset=x2-x1;var iyOffset=y1-y2;if((Math.abs(ixOffset)<3)&&(Math.abs(iyOffset)<3)){pan(e);}else{var ixCenter=iWidth/2;var iyCenter=iHeight/2;var tempX=ixCenter-ixOffset;var tempY=iyCenter+iyOffset;setInputValue("Karte.x",tempX);setInputValue("Karte.y",tempY);setInputValue("Cmd","PAN");window.scrollTo(0,0);hideLayer("theMap");if(hasLayer("theMapClicks")){document.theClickImage.src=blankImage;}sendMapRequest("_self");return true;}}function panMouse(){var xMove=x2-x1;var yMove=y2-y1;var cLeft=-xMove;var cTop=-yMove;var cRight=iWidth;var cBottom=iHeight;if(xMove>0){cLeft=0;cRight=iWidth-xMove;}if(yMove>0){cTop=0;cBottom=iHeight-yMove;}clipLayer("theMap",cLeft,cTop,cRight,cBottom);moveLayer("theMap",xMove+hspc,yMove+vspc);if(hasLayer("theMapClicks")){clipLayer("theMapClicks",cLeft,cTop,cRight,cBottom);moveLayer("theMapClicks",xMove+hspc,yMove+vspc);}}function pan(e){setInputValue("Karte.x",mouseX);setInputValue("Karte.y",mouseY);setInputValue("Cmd","PAN");window.scrollTo(0,0);sendMapRequest("_self");}function setZoomColor(){setLayerBackgroundColor("zoomBoxTop",zoomBoxColor);setLayerBackgroundColor("zoomBoxLeft",zoomBoxColor);setLayerBackgroundColor("zoomBoxRight",zoomBoxColor);setLayerBackgroundColor("zoomBoxBottom",zoomBoxColor);}var gbMapPresent=true;var left=662000;var right=723000;var mytop=285000;var bottom=220000;var fullLeft=left;var fullRight=right;var fullTop=mytop;var fullBottom=bottom;var iWidth=301;var iHeight=260;var appDir="";var xDistance=Math.abs(right-left);var yDistance=Math.abs(mytop-bottom);var pixelX=xDistance/iWidth;var pixelY=yDistance/iHeight;var theCursor="crosshair";var toolMode=1;MapUnits=MapUnits.toUpperCase();ScaleBarUnits=ScaleBarUnits.toUpperCase();function getPath(theFullPath){var theSlash=theFullPath.lastIndexOf("/");var theDir=theFullPath.substring(0,theSlash);if(theDir==null)theDir="";theDir=theDir+"/";return theDir;}function hasLayer(name){var result=false;if(isNav4){if(document.layers[name]!=null)result=true;}else if(isIE){if(eval('document.all.'+name)!=null)result=true;}else if(isNav){var theElements=document.getElementsByTagName("DIV");var theObj;var j=-1;for(i=0;i<theElements.length;i++){if(theElements[i].id==name)result=true;}}return result;}function showRetrieveData(){if(hasLayer("LoadData")){var imgW=getMapWidth();var imgH=getMapHeight();var bannerLeft=parseInt((imgW-bannerWidth)/2);var bannerTop=parseInt((imgH-bannerHeight)/2);moveLayer("LoadData",bannerLeft,bannerTop);showLayer("LoadData");}}function hideRetrieveData(){if(hasLayer("LoadData")){hideLayer("LoadData");}}function showRetrieveMap(){if(hasLayer("LoadMap")){var imgW=getMapWidth();var imgH=getMapHeight();var bannerLeft=parseInt((imgW-bannerWidth)/2);var bannerTop=parseInt((imgH-bannerHeight)/2);moveLayer("LoadMap",bannerLeft,bannerTop);showLayer("LoadMap");}}function hideRetrieveMap(){if(hasLayer("LoadMap")){hideLayer("LoadMap");}}function calcDistance(mX,mY){if(clickCount>0){var mDistance=0;var p=clickCount-1;var xD=runden((mX-clickPointX[p]),3);var yD=runden((mY-clickPointY[p]),3);mDistance=Math.sqrt(Math.pow(xD,2)+Math.pow(yD,2));var u=Math.pow(10,numDecimals);currentMeasure=parseInt(mDistance*u+0.5)/u;updateMeasureBox();}}function beforeMapRefresh(){}function afterMapRefresh(){}function panButton(panType){switch(panType){case 1:var panX=Math.round(iWidth/2-panFactor*iWidth);var panY=Math.round(iHeight/2);setInputValue("Karte.x",panX);setInputValue("Karte.y",panY);break;case 2:var panX=Math.round(iWidth/2);var panY=Math.round(iHeight/2-panFactor*iHeight);setInputValue("Karte.x",panX);setInputValue("Karte.y",panY);break;case 3:var panX=Math.round(iWidth/2+panFactor*iWidth);var panY=Math.round(iHeight/2);setInputValue("Karte.x",panX);setInputValue("Karte.y",panY);break;case 4:var panX=Math.round(iWidth/2);var panY=Math.round(iHeight/2+panFactor*iHeight);setInputValue("Karte.x",panX);setInputValue("Karte.y",panY);break;case 5:var panX=Math.round(iWidth/2-panFactor*iWidth);var panY=Math.round(iHeight/2+panFactor*iHeight);setInputValue("Karte.x",panX);setInputValue("Karte.y",panY);break;case 6:var panX=Math.round(iWidth/2-panFactor*iWidth);var panY=Math.round(iHeight/2-panFactor*iHeight);setInputValue("Karte.x",panX);setInputValue("Karte.y",panY);break;case 7:var panX=Math.round(iWidth/2+panFactor*iWidth);var panY=Math.round(iHeight/2-panFactor*iHeight);setInputValue("Karte.x",panX);setInputValue("Karte.y",panY);break;case 8:var panX=Math.round(iWidth/2+panFactor*iWidth);var panY=Math.round(iHeight/2+panFactor*iHeight);setInputValue("Karte.x",panX);setInputValue("Karte.y",panY);}setInputValue("Cmd","PAN");window.scrollTo(0,0);sendMapRequest("_self");}gbIdentifyPresent=true;function identify(e){showRetrieveData();var theX=mouseX;var theY=mouseY;boxIt(theX,theY,(theX+1),(theY+1));showLayer("zoomBoxTop");showLayer("zoomBoxLeft");showLayer("zoomBoxRight");showLayer("zoomBoxBottom");moveLayer("InfoImage",(theX+2),(theY-18));showLayer("InfoImage");setInputValue("Karte.x",theX);setInputValue("Karte.y",theY);setInputValue("Cmd","IDENTIFY");window.scrollTo(0,0);sendMapRequest("InfoWindow","","info");}function dblink(e){showRetrieveData();var theX=mouseX;var theY=mouseY;boxIt(theX,theY,(theX+1),(theY+1));showLayer("zoomBoxTop");showLayer("zoomBoxLeft");showLayer("zoomBoxRight");showLayer("zoomBoxBottom");moveLayer("InfoImage",(theX+2),(theY-18));showLayer("InfoImage");setInputValue("Karte.x",theX);setInputValue("Karte.y",theY);setInputValue("Cmd","LINK");window.scrollTo(0,0);sendMapRequest("InfoWindow","","info");}var gbDHTMLPresent=true;function createLayer(name,left,top,width,height,visible,content){var layer;if(isNav4){document.writeln('<layer name="'+name+'" left='+left+' top='+top+' width='+width+' height='+height+' visibility='+(visible?'"show"':'"hide"')+'>');document.writeln(content);document.writeln('</layer>');}else{document.writeln('<div id="'+name+'" style="position:absolute; overflow:hidden; left:'+left+'px; top:'+top+'px; width:'+width+'px; height:'+height+'px;'+' visibility:'+(visible?'visible;':'hidden;')+'">');document.writeln(content);document.writeln('</div>');}}function getLayer(name){if(isNav4)return(document.layers[name]);else if(isIE){layer=eval('document.all.'+name+'.style');return(layer);}else if(isNav){var theElements=document.getElementsByTagName("DIV");var theObj;var j=-1;for(i=0;i<theElements.length;i++){if(theElements[i].id==name)theObj=theElements[i].style;}return theObj}else return(null);}function isVisible(name){var layer=getLayer(name);if(isNav&&layer.visibility=="show")return(true);if(isIE&&layer.visibility=="visible")return(true);return(false);}function moveLayer(name,x,y){var layer=getLayer(name);if(isNav4)layer.moveTo(x,y);else{layer.left=x;layer.top=y;}}function setLayerBackgroundColor(name,color){var layer=getLayer(name);if(isNav4)layer.bgColor=color;else layer.backgroundColor=color;}function hideLayer(name){var layer=getLayer(name);if(isNav4){layer.visibility="hide";}else{layer.visibility="hidden";}}function showLayer(name){var layer=getLayer(name);if(isNav4)layer.visibility="show";else layer.visibility="visible";}function clipLayer(name,clipleft,cliptop,clipright,clipbottom){var layer=getLayer(name);if(isNav4){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){if(isNav4){var layer=getLayer(name);layer.document.open();layer.document.writeln(content);layer.document.close();}else if(isIE){var str="document.all."+name+".innerHTML = '"+content+"'";eval(str);}else{var Element = document.getElementById(name);Element.firstChild.nodeValue = content;}}function boxIt(theLeft,theTop,theRight,theBottom){if(isNav5up){moveLayer("zoomBoxTop",theLeft,theTop);moveLayer("zoomBoxBottom",theRight-cornerOffset,theBottom-cornerOffset);moveLayer("zoomBoxLeft",theLeft,theBottom-cornerOffset);moveLayer("zoomBoxRight",theRight-cornerOffset,theTop);}else{clipLayer("zoomBoxTop",theLeft,theTop,theRight,theTop+ovBoxSize);clipLayer("zoomBoxLeft",theLeft,theTop,theLeft+ovBoxSize,theBottom);clipLayer("zoomBoxRight",theRight-ovBoxSize,theTop,theRight,theBottom);clipLayer("zoomBoxBottom",theLeft,theBottom-ovBoxSize,theRight,theBottom);}}var gbTalkPresent=true;function setInputValue(InputName,InputValue){if(parent.PostFrame.document.forms[0]!=null){var theForm=parent.PostFrame.document.forms[0];for(var i=0;i<theForm.elements.length;i++)if(theForm.elements[i].name==InputName){theForm.elements[i].value=InputValue;break;}}}function getInputValue(InputName){if(parent.PostFrame.document.forms[0]!=null){var theForm=parent.PostFrame.document.forms[0];for(var i=0;i<theForm.elements.length;i++)if(theForm.elements[i].name==InputName){return theForm.elements[i].value;break;}}else{return false;}}function startMapRequest(responseTarget){beforeMapRefresh();showRetrieveMap();if(parent.PostFrame.document.forms[0]!=null){var iw=getMapWidth();var ih=getMapHeight();setInputValue("IMGWIDTHOLD",iw);setInputValue("IMGWIDTHNEW",iw);setInputValue("IMGHEIGHTOLD",ih);setInputValue("IMGHEIGHTNEW",ih);setInputValue("TOC","");setInputValue("LEGEND","NO");setInputValue("SetScale","1");var theForm=parent.PostFrame.document.forms[0];theForm.target=responseTarget;theForm.submit();}else{alert("Response from previous request(s) not received.");hideRetrieveMap();hideRetrieveData();}}function sendMapRequest(responseTarget,requestAction,requestCaller){beforeMapRefresh();setInputValue("ORT","");setInputValue("STRASSE","");setInputValue("ImgURL","");if(!requestAction)requestAction=parent.hostURL+"scripts/esrimap.dll";if(parent.PostFrame.document.forms[0]!=null){if(okToSend){okToSend=false;switch(requestCaller){case "themes":refreshLayers();showRetrieveMap();for(var i=0;i<54;i++)setInputValue("V"+i,i);for(var i=1;i<15;i++)setInputValue("R"+i,i);setInputValue("Cmd","ZoomIn");setInputValue("Refresh","INI");setInputValue("IMGWIDTHNEW",getMapWidth());setInputValue("IMGHEIGHTNEW",getMapHeight());break;case "print":showRetrieveMap();if(parent.TOCFrame!=null){theTOCForm=parent.TOCFrame.document.forms[0];}if(parent.TextFrame!=null){if(parent.TextFrame.document.TOCForm!=null){theTOCForm=parent.TextFrame.document.TOCForm;}}if(theTOCForm!=null){for(var i=0;i<theTOCForm.elements.length;i++)if(theTOCForm.elements[i].checked){setInputValue(theTOCForm.elements[i].name,theTOCForm.elements[i].value);}else{setInputValue(theTOCForm.elements[i].name,"");}}setInputValue("Cmd","Print");hideRetrieveMap();okToSend=true;window.open('','PrintWindow','toolbar=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=650,height=550');break;case "showlegend":if(!(hasInfoWindow)&&(parent.TextFrame!=null)){TOCWindow=parent.TextFrame;}else{TOCWindow=window.open('','InfoWindow','toolbar=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=450,height=400','dependent=yes');}okToSend=true;break;case "info":if(fromAKS == ""){if(!(hasInfoWindow)&&(parent.TextFrame!=null)){InfoWindow=parent.TextFrame;responseTarget=InfoWindow.name;}else{window.open('','InfoWindow','toolbar=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=450,height=400','dependent=yes');}hideRetrieveMap();hideRetrieveData();okToSend=true;}else{var xkoord=Math.round(mapX);var ykoord=Math.round(mapY);window.open(fromAKS+'?Koord='+xkoord+'$'+ykoord+'&Massstab='+getInputValue("Scale"),'DLGAKS');hideRetrieveMap();hideRetrieveData();okToSend=true;return;}break;default:showRetrieveMap();var theTOCForm;if(parent.TOCFrame!=null){theTOCForm=parent.TOCFrame.document.forms[0];}if(parent.TextFrame!=null){if(parent.TextFrame.document!=null){if(parent.TextFrame.document.TOCForm!=null){theTOCForm=parent.TextFrame.document.TOCForm;}}}if(window.TOCWindow!=null){if(window.TOCWindow.closed==false){if(window.TOCWindow.document.TOCForm!=null){theTOCForm=window.TOCWindow.document.TOCForm;}}}if(theTOCForm!=null){for(var i=0;i<theTOCForm.elements.length;i++)if(theTOCForm.elements[i].checked){setInputValue(theTOCForm.elements[i].name,theTOCForm.elements[i].value);}else{setInputValue(theTOCForm.elements[i].name,"");}}setInputValue("IMGWIDTHNEW",getMapWidth());setInputValue("IMGHEIGHTNEW",getMapHeight());}setInputValue("TOC","");setInputValue("LEGEND","NO");var theForm=parent.PostFrame.document.forms[0];theForm.action=requestAction;theForm.target=responseTarget;parent.PostFrame.beforeSend();theForm.submit();}else{alert("Response from previous request(s) not received.");hideRetrieveMap();hideRetrieveData();okToSend=true;}}else{alert("Form for posting request not found. Unable to communicate with server.");hideRetrieveMap();hideRetrieveData();}}function processResponse(){okToSend=true;if(parent.PostFrame.document.forms[0]!=null){left=Math.round(getInputValue("LEFT")*1000)/1000;right=Math.round(getInputValue("RIGHT")*1000)/1000;bottom=Math.round(getInputValue("BOTTOM")*1000)/1000;mytop=Math.round(getInputValue("TOP")*1000)/1000;iWidth=getInputValue("IMGWIDTHNEW");iHeight=getInputValue("IMGHEIGHTNEW");xDistance=Math.abs(right-left);yDistance=Math.abs(mytop-bottom);pixelX=xDistance/iWidth;pixelY=yDistance/iHeight;document.theImage.src=getInputValue("ImgURL");if(!isNav4){document.theImage.width=iWidth;document.theImage.height=iHeight;}if(parent.TOCFrame!=null){parent.TOCFrame.document.location=appDir+"TOCFrame.htm";}if(parent.ModeFrame!=null){var theForm=parent.ModeFrame.document.form1;theForm.Massstab.value=getInputValue("Scale");}afterMapRefresh();if(toolMode==3){moveLayer("theMap",hspc,vspc);clipLayer("theMap",0,0,iWidth,iHeight);window.setTimeout('showLayer("theMap");',1000);if(hasLayer("theMapClicks")){moveLayer("theMapClicks",hspc,vspc);clipLayer("theMapClicks",0,0,iWidth,iHeight);}}}hideRetrieveMap();hideRetrieveData();}var gbClickPresent=true;var mouseX=0;var mouseY=0;var x1=0;var y1=0;var x2=0;var y2=0;var zleft=0;var zright=0;var ztop=0;var zbottom=0;var totalMeasure=0;var currentMeasure=0;var lastTotMeasure=0;var totalArea=0;var currentArea=0;var clickCount=0;var clickPointX=new Array();var clickPointY=new Array();var clickMeasure=new Array();var clickType=1;var arrClicksx=new Array();var arrClicksy=new Array();var arrClicksName=new Array();var arrRub1Name=new Array();var arrRub2Name=new Array();var anzRubDots=5;var anzClicks=0;var clickImage="../img/dot.gif";var arrDotsx=new Array();var arrDotsy=new Array();var arrDotsName=new Array();var sumDots=0;var dotImage="../img/dotkl.gif";var panning=false;var zooming=false;var selectBox=false;var blankImage="../img/pixel.gif";var leftButton=1;var rightButton=2;if(isNav){leftButton=1;rightButton=3;}function clickAddPoint(){var theX=mouseX;var theY=mouseY;if(clickCount==0){resetClick();}addClickToArray(theX,theY);getMapXY(theX,theY);clickPointX[clickCount]=mapX;clickPointY[clickCount]=mapY;clickCount+=1;selectCount=0;if(toolMode==20){totalMeasure=totalMeasure+currentMeasure;var u=Math.pow(10,numDecimals);if(totalMeasure!=0)totalMeasure=parseInt(totalMeasure*u+0.5)/u;clickMeasure[clickCount]=totalMeasure;}if(toolMode==21){if(clickCount>1){totalArea=totalArea-currentArea;xAlt=clickPointX[clickCount-2];yAlt=clickPointY[clickCount-2];dx=xAlt-mapX;dy=mapY-yAlt;currentArea=dx*yAlt+dx*dy/2;totalArea=totalArea+currentArea;xFirst=clickPointX[0];yFirst=clickPointY[0];dx=mapX-xFirst;dy=yFirst-mapY;currentArea=dx*mapY+dx*dy/2;totalArea=totalArea+currentArea;var u=Math.pow(10,numDecimals);if(totalArea!=0)totalArea=parseInt(totalArea*u+0.5)/u;updateAreaBox();}}}function addClickToArray(x,y){arrClicksx[anzClicks]=x;arrClicksy[anzClicks]=y;if(isIE||isNav5up){arrClicksName[anzClicks]="click_"+anzClicks;if(!hasLayer(arrClicksName[anzClicks])){if(isNav5up){var content=clickImage;}else{var content='<img name="click" border=0 src="'+clickImage+'" width=11 height=11 hspace=0 vspace=0>';}var newLayerName=createDynaLayer("click_"+anzClicks,0,0,11,11,true,content);}}else{var content='<img name="click" border=0 src="'+clickImage+'" width=11 height=11 hspace=0 vspace=0>';var newLayerName=createDynaLayer("click_"+anzClicks,0,0,11,11,false,content);arrClicksName[anzClicks]=newLayerName}showLayer(arrClicksName[anzClicks]);moveLayer(arrClicksName[anzClicks],x-6,y-6);anzClicks=anzClicks+1;if(anzClicks>0){createRubDotLayers(anzRubDots);}if(anzClicks>1){showDots(x,y,arrClicksx[anzClicks-2],arrClicksy[anzClicks-2]);}}function showDots(xNeu,yNeu,xAlt,yAlt){var dotkl_width=6;var dx=0;var dy=0;dx=xNeu-xAlt;dy=yNeu-yAlt;var dist=Math.sqrt(dx*dx+dy*dy);var anzDots=Math.round(dist/(2.5*dotkl_width))-1;var dotGapx=Math.round(dx/(anzDots+1));var dotGapy=Math.round(dy/(anzDots+1));var dotStartx=xAlt+Math.round((dx-(anzDots+1)*dotGapx)/2);var dotStarty=yAlt+Math.round((dy-(anzDots+1)*dotGapy)/2);for(var i=sumDots;i<(anzDots+sumDots);i++){arrDotsx[i]=dotStartx+dotGapx*(i-sumDots+1);arrDotsy[i]=dotStarty+dotGapy*(i-sumDots+1);if(isIE||isNav5up){arrDotsName[i]="dot_"+i;if(!hasLayer(arrDotsName[i])){if(isNav5up){var content=dotImage;}else{var content='<img name="dot" border=0 src="'+dotImage+'" width=6 height=6 hspace=0 vspace=0>';}var newLayerName=createDynaLayer("dot_"+i,0,0,6,6,true,content);}}else{var content='<img name="dot" border=0 src="'+dotImage+'" width=6 height=6 hspace=0 vspace=0>';var newLayerName=createDynaLayer("dot_"+i,0,0,6,6,true,content);arrDotsName[i]=newLayerName;}showLayer(arrDotsName[i]);moveLayer(arrDotsName[i],arrDotsx[i]-dotkl_width/2,arrDotsy[i]-dotkl_width/2);}sumDots=sumDots+anzDots;}function createDynaLayer(name,left,top,width,height,visible,content){if(isNav4){var newLayer=new Layer(width);var txt='<div id="'+newLayer.name+'" style="position:absolute; overflow:hidden; left:'+left+'px; top:'+top+'px; width:'+width+'px; height:'+height+'px;'+' visibility:'+(visible?'show;':'hide;')+'">';txt=txt+content;txt=txt+"</div>";newLayer.document.write("<HTML>"+txt+"</HTML>");newLayer.document.close();return newLayer.name;}if(isNav5up){var newLyr=document.createElement("div");newLyr.id=name;newLyr.style.position="absolute";newLyr.style.overflow="hidden";newLyr.style.left=left+"px";newLyr.style.top=top+"px";newLyr.style.width=width+"px";newLyr.style.height=height+"px";newLyr.style.visibility=(visible?'visible;':'hidden;');var imgLyr=document.createElement("img");imgLyr.setAttribute("src",content);newLyr.appendChild(imgLyr);var lastLayer=document.getElementById("xxx");lastLayer.parentNode.insertBefore(newLyr,lastLayer);return name;}else{var txt='<div id="'+name+'" style="position:absolute; overflow:hidden; left:'+left+'px; top:'+top+'px; width:'+width+'px; height:'+height+'px;'+' visibility:'+(visible?'visible;':'hidden;')+'">';txt=txt+content;txt=txt+"</div>";ScriptDiv.insertAdjacentHTML("beforeEnd",txt);return name;}}function resetClick(){resetLayers();var c1=clickCount;clickCount=0;clickPointX.length=1;clickPointY.length=1;currentMeasure=0;totalMeasure=0;currentArea=0;totalArea=0;lastTotMeasure=0;clickMeasure.length=1;selectCount=0;if(toolMode==20)updateMeasureBox();if(toolMode==21)updateAreaBox();}function resetLayers(){for(var i=0;i<(arrClicksName.length);i++){if(hasLayer(arrClicksName[i])){hideLayer(arrClicksName[i]);}}for(var i=0;i<(arrDotsName.length);i++){if(hasLayer(arrDotsName[i])){hideLayer(arrDotsName[i]);}}for(var i=0;i<(arrRub1Name.length);i++){if(hasLayer(arrRub1Name[i])){hideLayer(arrRub1Name[i]);}}for(var i=0;i<(arrRub2Name.length);i++){if(hasLayer(arrRub2Name[i])){hideLayer(arrRub2Name[i]);}}arrClicksx.length=1;arrClicksy.length=1;arrClicksName.length=1;anzClicks=0;arrDotsx.length=1;arrDotsy.length=1;arrDotsName.length=1;sumDots=0;}function refreshLayers(){if(hasLayer("measureBox"))resetClick();hideLayer("measureBox");if(hasLayer("InfoImage"))hideLayer("InfoImage");hideLayer("zoomBoxTop");hideLayer("zoomBoxLeft");hideLayer("zoomBoxRight");hideLayer("zoomBoxBottom");}function clickFunction(toolName,gdeName){refreshLayers();switch(toolName){case "zoomin":toolMode=1;panning=false;selectBox=false;if(isIE){document.all.theTop.style.cursor="crosshair";theCursor=document.all.theTop.style.cursor;}modeBlurb="Vergr&ouml;ssern";break;case "zoomout":toolMode=2;panning=false;selectBox=false;if(isIE){document.all.theTop.style.cursor="crosshair";theCursor=document.all.theTop.style.cursor;}modeBlurb="Verkleinern";break;case "pan":toolMode=3;zooming=false;selectBox=false;if(isIE){document.all.theTop.style.cursor="move";theCursor=document.all.theTop.style.cursor;}modeBlurb="Verschieben";break;case "identify":panning=false;zooming=false;selectBox=false;if(canQuery){toolMode=4;if(isIE){document.all.theTop.style.cursor="crosshair";theCursor=document.all.theTop.style.cursor;}modeBlurb="Informationen anzeigen";}else{alert("Cannot query Service\nIdentify, Select, and Query functions are disabled.");}hideLayer("measureBox");break;case "dblink":panning=false;zooming=false;selectBox=false;if(canQuery){toolMode=5;if(isIE){document.all.theTop.style.cursor="crosshair";theCursor=document.all.theTop.style.cursor;}modeBlurb="Link zur Datenbank";}else{alert("Cannot query Service\nIdentify, Select, and Query functions are disabled.");}hideLayer("measureBox");break;case "measure":panning=false;zooming=false;selectBox=false;if(clickCount>0){if(totalMeasure==0)resetClick();}toolMode=20;if(isIE){document.all.theTop.style.cursor="crosshair";theCursor=document.all.theTop.style.cursor;}modeBlurb="Distanz messen";if(clickType==1){showLayer("measureBox");moveLayer("measureBox",getMapWidth()-130,0);updateMeasureBox();}showGeocode=false;break;case "area":panning=false;zooming=false;selectBox=false;if(clickCount>0){}toolMode=21;if(isIE){document.all.theTop.style.cursor="crosshair";theCursor=document.all.theTop.style.cursor;}modeBlurb="Fl&auml;che messen";if(clickType==1){showLayer("measureBox");moveLayer("measureBox",getMapWidth()-130,0);updateAreaBox();}showGeocode=false;break;case "showhome":setInputValue("Cmd","ZoomIn");setInputValue("selExpr","Gemeinden$Name$=$"+gdeName+"$");setInputValue("Sel","LYR");sendMapRequest("_self");break;case "print":var theAction=appDir+printForm;parent.MapFrame.sendMapRequest("PrintWindow",theAction,"print");break;case "showtoc":setInputValue("Cmd","ShowTOC");if(hasInfoWindow){parent.MapFrame.sendMapRequest("InfoWindow","","showlegend");}else{parent.MapFrame.sendMapRequest("TextFrame","","showlegend");}break;case "showlegend":setInputValue("Cmd","ShowLegend");if(hasInfoWindow){parent.MapFrame.sendMapRequest("InfoWindow","","showlegend");}else{parent.MapFrame.sendMapRequest("TextFrame","","showlegend");}break;case "refresh":setInputValue("Cmd","ZoomIn");setInputValue("Refresh","1");sendMapRequest("_self");break;default:alert("Function not enabled.");}modeName=modeBlurb;if(useModeFrame){writeModeFrame(modeBlurb);}else if((drawFloatingMode)&&(modeLayerOn)){writeModeLayers(modeBlurb);}}function chkMouseUp(e){if((toolMode==1)&&(zooming)){stopZoomBox(e);}if((toolMode==2)&&(zooming)){stopZoomOutBox(e);}if((toolMode==3)&&(panning)){stopPan(e);}if((toolMode==10)&&(selectBox)){stopSelectBox(e);}return false;}function mapTool(e){var theButton=0;if(isNav){theButton=e.which;}else{theButton=window.event.button;}if(theButton==leftButton){getImageXY(e);if((mouseX>=0)&&(mouseX<iWidth)&&(mouseY>=0)&&(mouseY<iHeight)){if((hasOVMap)&&(ovIsVisible)&&(mouseX<i2Width+ovBoxSize)&&(mouseY<i2Height)&&(ovMapIsLayer)){}else{switch(toolMode){case 1:startZoomBox(e);return false;break;case 2:startZoomOutBox(e);return false;break;case 3:startPan(e);return false;break;case 4:identify(e);break;case 5:dblink(e);break;case 20:clickType=1;clickAddPoint();break;case 21:clickType=1;clickAddPoint();break;default:if(toolMode>=1000){customMapTool(e);}}}}}else{if(toolMode>=20){switch(toolMode){case 20:clickType=1;clickAddPoint();currentMeasure=0;updateMeasureBox();break;case 21:clickType=1;clickAddPoint();showDots(arrClicksx[0],arrClicksy[0],arrClicksx[anzClicks-1],arrClicksy[anzClicks-1]);currentArea=0;updateAreaBox();break;default:break;}for(var i=0;i<anzRubDots;i++){hideLayer(arrRub1Name[i]);hideLayer(arrRub2Name[i]);clickCount=0;}}}return false;}function updateMeasureBox(){if(isNav4){var theForm=document.layers["measureBox"].document.forms[0];}else{var theForm=document.forms[0];}theForm.theMeasTotal.value=totalMeasure+" [m]";theForm.theMeasSegment.value=currentMeasure+" [m]";showLayer("measureBox");if(isMac&&isIE){moveLayer("measureBox",getMapWidth()-140,0);}else{moveLayer("measureBox",getMapWidth()-150,0);}}function updateAreaBox(){if(isNav4){var theForm=document.layers["measureBox"].document.forms[0];}else{var theForm=document.forms[0];}if(totalArea>0){vorzeichen=1;}else{vorzeichen=-1;}theForm.theMeasTotal.value=vorzeichen*Math.round(totalArea)+" [m2]";showLayer("measureBox");if(isMac&&isIE){moveLayer("measureBox",getMapWidth()-140,-20);}else{moveLayer("measureBox",getMapWidth()-150,-25);}}function createRubDotLayers(anz){if(isNav5up){var content=clickImage;}else{var content='<img name="click" border=0 src="'+clickImage+'" width=11 height=11 hspace=0 vspace=0>';}for(var i=0;i<anz;i++){if(isIE||isNav5up){arrRub1Name[i]="rub1_"+i;arrRub2Name[i]="rub2_"+i;if(!hasLayer(arrRub1Name[i])){var newLayerName=createDynaLayer("rub1_"+i,0,0,11,11,true,content);}if(!hasLayer(arrRub2Name[i])){var newLayerName=createDynaLayer("rub2_"+i,0,0,11,11,true,content);}}else{if(!hasLayer(arrRub1Name[i])){var newLayerName=createDynaLayer("rub1_"+i,0,0,11,11,false,content);arrRub1Name[i]=newLayerName;}if(!hasLayer(arrRub2Name[i])){var newLayerName=createDynaLayer("rub2_"+i,0,0,11,11,false,content);arrRub2Name[i]=newLayerName;}}hideLayer(arrRub1Name[i]);hideLayer(arrRub2Name[i]);}}function moveRub1Layers(x,y){var anz=anzRubDots;var dotkl_width=12;if(clickCount>0){for(var i=0;i<anz;i++){showLayer(arrRub1Name[i]);moveLayer(arrRub1Name[i],(arrClicksx[anzClicks-1]+i*((x-arrClicksx[anzClicks-1])/anz))-dotkl_width/2,(arrClicksy[anzClicks-1]+i*((y-arrClicksy[anzClicks-1])/anz))-dotkl_width/2);}}}function moveRub2Layers(x,y){var anz=anzRubDots;var dotkl_width=12;if(clickCount>0){for(var i=0;i<anz;i++){showLayer(arrRub2Name[i]);moveLayer(arrRub2Name[i],(arrClicksx[0]+i*((x-arrClicksx[0])/anz))-dotkl_width/2,(arrClicksy[0]+i*((y-arrClicksy[0])/anz))-dotkl_width/2);}}}function chkDblClick(e){if(toolMode>=20){switch(toolMode){case 20:currentMeasure=0;updateMeasureBox();break;case 21:showDots(arrClicksx[0],arrClicksy[0],arrClicksx[anzClicks-1],arrClicksy[anzClicks-1]);currentArea=0;updateAreaBox();break;}for(var i=0;i<anzRubDots;i++){hideLayer(arrRub1Name[i]);hideLayer(arrRub2Name[i]);clickCount=0;}}}
