ajaxRequest=function(r,u,f,m,b,h,s)
{this.ref=r;this.url=u;this.wState=f||function(){};this.method=m||"GET";this.body=b||null;this.headers=h||false;this.sync=s||true;this.abortReq=false;this.req=(window.XMLHttpRequest)?new XMLHttpRequest():((window.ActiveXObject)?new ActiveXObject("Microsoft.XMLHTTP"):false);this.doRequest=function()
{this.req.open(this.method,this.url,this.sync);if(this.headers)
{for(var i=0;i<this.headers.length;i+=2)
{this.req.setRequestHeader(this.headers[i],this.headers[i+1]);}}
this.req.onreadystatechange=this.wState;(!this.abortReq)?this.req.send(null):this.req.abort();}};var path_skin="/quickWMS/gs_like/";var empty_IMG=path_skin+"empty.gif";var waiting_IMG=path_skin+"waiting.gif";var white_IMG=path_skin+"white.gif";var picSize=28;var mouseGrid=5;var TXT_OnRequestingData="Requesting data ...";var TXT_Updated=" updated ...";var TXT_WaitingFor=" Waiting for ";var TXT_Requests=" requests ";var TXT_Layer="Layer";var TXT_ReceivedLayer="was correctly downloaded";var TXT_Request=" request ";var TXT_LayerUpdated="All layers retrieved.<BR> Updating ...";var TXT_QueryDataReceived="Query information was received...";var TXT_UserCancel="Request was canceled by user";var TXT_onChange="onChange";var TXT_OnRequestingData="Anfrage wird bearbeitet ...";var TXT_Updated=" aktualisiere ...";var TXT_WaitingFor=" Warte auf ";var TXT_Requests=" Anfragen ";var TXT_Layer="Layer";var TXT_ReceivedLayer="wurde korrekt geladen";var TXT_Request=" Anfrage ";var TXT_LayerUpdated="Alle Layer geladen.<BR> Akualisierung ...";var TXT_QueryDataReceived="Abfrage Information erhalten...";var TXT_UserCancel="Anfrage durch den Benutzer abgebrochen";var TXT_onChange="onChange";var highLightThreshold=40;var statusThreshold=60;var WMS_selectBorder="border-style:dashed;border-width:5;border-color:#C0C0C0";var WMS_zoomBorder="border-style:dashed;border-width:2;border-color:#C0C0C0";var browser=new Object("browser");browser.isIE70=(navigator.userAgent.indexOf("MSIE 7.0")>=0);browser.isIE60=(navigator.userAgent.indexOf("MSIE 6.0")>=0);browser.isIE55=(navigator.userAgent.indexOf("MSIE 5.5")>=0);browser.isIE50=(navigator.userAgent.indexOf("MSIE 5.0")>=0);if(browser.isIE70){browser.isIE60=true}
browser.isMoz09=((navigator.userAgent.indexOf("Mozilla/5.0")>=0)&&(navigator.userAgent.indexOf("Netscape")<0)&&(navigator.userAgent.indexOf("rv:0.9")>=0));browser.isMoz10=((navigator.userAgent.indexOf("Mozilla/5.0")>=0)&&(navigator.userAgent.indexOf("Netscape")<0)&&(navigator.userAgent.indexOf("rv:1.0")>=0));browser.isMoz50=((navigator.userAgent.indexOf("Mozilla/5.0")>=0)&&(navigator.userAgent.indexOf("Netscape")<0)&&(navigator.userAgent.indexOf("Gecko")>0));if(browser.isMoz50){browser.isMoz10=true}
browser.isNS6=(navigator.userAgent.indexOf("Netscape6")>=0);browser.isNS7=(navigator.userAgent.indexOf("Netscape/7.")>=0);browser.isNS8=((navigator.userAgent.indexOf("Netscape/8.")>=0)&&(navigator.userAgent.indexOf("MSIE 6.0")<0));browser.isNS47x=document.layers;browser.isDOM=(browser.isNS8||browser.isNS7||browser.isNS6||browser.isMoz09||browser.isMoz10||browser.isMoz50||browser.isIE60)&&document.getElementById;browser.isOldNS=(browser.isNS47x);browser.isOldIE=(browser.isIE55||browser.isIE50)&&document.all;browser.name="Unknown";if(browser.isIE60)
browser.name="Internet Explorer 6.0";if(browser.isIE55)
browser.name="Internet Explorer 5.5";if(browser.isIE50)
browser.name="Internet Explorer 5.0";if(browser.isNS7)
browser.name="Netscape 7.x";if(browser.isNS8)
browser.name="Netscape 8.x";if(browser.isNS6)
browser.name="Netscape 6.0";if(browser.isNS47x)
browser.name="Netscape Navigator 4.7x";if(browser.isMoz09)
browser.name="Mozilla 0.9x";if(browser.isMoz10)
browser.name="Mozilla 1.0x";function openLayer(name,parentClass,addStyle,left,top,width,height,visible)
{var layer;if(browser.isOldNS)
{if(addStyle.indexOf('inherit')>0)document.writeln('<layer name="'+name+'" left="'+left+'" top="'+top+'" width="'+width+'" height="'+height+'" visibility="inherit" class="'+parentClass+'">');else document.writeln('<layer name="'+name+'" left="'+left+'" top="'+top+'" width="'+width+'" height="'+height+'" visibility="'+(visible?'"show"':'"hide"')+' class="'+parentClass+'">');}
else
{document.write('<div id="'+name+'" class="'+parentClass+'" style="position:absolute;  left:'+left+'px; top:'+top+'px; width:'+width+'px; height:'+height+'px;'+' visibility:'+(visible?'visible;':'hidden;')+';'+addStyle+'">');if(browser.isIE55||browser.isIE60)setLayerPos(name,left,top,width,height);}}
function getLayerHtml(name,parentClass,addStyle,left,top,width,height,visible)
{var layer;var content="";if(browser.isOldNS)
{if(addStyle.indexOf('inherit')>0)content+=('<layer name="'+name+'" left="'+left+'" top="'+top+'" width="'+width+'" height="'+height+'" visibility="inherit" class="'+parentClass+'">');else content+=('<layer name="'+name+'" left="'+left+'" top="'+top+'" width="'+width+'" height="'+height+'" visibility="'+(visible?'"show"':'"hide"')+' class="'+parentClass+'">');}
else
{content+=('<div id="'+name+'" class="'+parentClass+'" style="position:absolute;  left:'+left+'px; top:'+top+'px; width:'+width+'px; height:'+height+'px;'+' visibility:'+(visible?'visible;':'hidden;')+';'+addStyle+'">');}
return content;}
function writeIMG(name,src,left,top,width,height,styles){if(browser.isOldNS){var contentIMG='<layer id="p'+name+'" left="'+left+'" top="'+top+'" width="'+width+'" height="'+height+'" visibility="inherit">';contentIMG+='<img border="1" name="'+name+'" width="'+width+'" height="'+height+'" src="'+src+'" style="">';contentIMG+='</layer>';document.write(contentIMG);return(findLayer('p'+name,document).document.images[0]);}
else{document.write("<img name='"+name+"' style='"+styles+";position:absolute;top:"+top+";left:"+left+"' width="+width+" height="+height+" src='"+src+"'>");return document.images[name];}}
function GetImgHTML(name,src,left,top,width,height,styles){if(browser.isOldNS){var contentIMG='<layer id="p'+name+'" left="'+left+'" top="'+top+'" width="'+width+'" height="'+height+'" visibility="inherit">';contentIMG+='<img border="1" name="'+name+'" width="'+width+'" height="'+height+'" src="'+src+'" style="">';contentIMG+='</layer>';return contentIMG;}
else{var contentIMG="<img name='"+name+"' style='"+styles+";position:absolute;top:"+top+";left:"+left+"' width="+width+" height="+height+" src='"+src+"'>";return contentIMG;}}
function getCloseLayerHTML()
{if(browser.isOldNS){return'</layer>';}
else{return'</div>';}}
function closeLayer()
{if(browser.isOldNS){document.writeln('</layer>');}
else{document.write('</div>');}}
function createLayer(name,left,top,width,height,visible,content)
{var layer;if(browser.isOldNS)
{document.write('<layer bgcolor="#CC00EE" name="'+name+'" left='+left+' top='+top+' width='+width+' height='+height+' visibility='+(visible?'"show"':'"hide"')+'>');document.write(content);document.write('</layer>');layer=getLayer(name);layer.width=width;layer.height=height;}
else
{document.write('<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.write(content);document.write('</div>');if(browser.isIE55||browser.isIE60){setLayerPos(name,left,top,width,height);}}}
function getLayer(name)
{var layer=null;if(browser.isOldNS)
layer=findLayer(name,parent.document);if(browser.isOldIE)
layer=eval('document.all.'+name);if(browser.isDOM)
layer=document.getElementById(name);if(!layer)
{layer=document.getElementById(name);}
return layer;}
function findLayer(name,doc)
{var i,layer;for(i=0;i<doc.layers.length;i++)
{layer=doc.layers[i];if(layer.name==name)
return layer;if(layer.document.layers.length>0)
{layer=findLayer(name,layer.document);if(layer!=null)
return layer;}}
return null;}
function hideLayer(layerName)
{var layer=getLayer(layerName);if(browser.isOldNS)
layer.visibility="hide";if(browser.isOldIE||browser.isDOM)
layer.style.visibility="hidden";}
function showLayer(layerName)
{var layer=getLayer(layerName);if(browser.isOldNS)
layer.visibility="show";if(browser.isOldIE||browser.isDOM)
layer.style.visibility="visible";}
function getVisibility(layerName)
{var layer=getLayer(layerName);var visStatus="visible";if(browser.isOldNS)
{if(layer.visibility=="show")
visStatus="visible";if(layer.visibility=="hide")
visStatus="hidden";}
if(browser.isOldIE||browser.isDOM)
visStatus=layer.style.visibility;return visStatus;}
function isVisible(layerName)
{return(getVisibility(layerName)=="visible");}
function setLayerPos(layerName,left,top,width,height)
{if(browser.isOldNS){}
else{layer=getLayer(layerName).style;if(left)layer.left=left;if(top)layer.top=top;if(width)layer.width=width;if(height)layer.height=height;if(browser.isIE55||browser.isIE60){if(layer.borderWidth){layer.width=width+parseInt(layer.borderWidth)*2+0;layer.height=height+parseInt(layer.borderWidth)*2+0;}else{layer.width=width+0;layer.height=height+0;}}}}
function setLayerHTML(layerName,content)
{var layer=getLayer(layerName);if(browser.isOldNS)
{layer.document.open();layer.document.write(content);layer.document.close();}
if(browser.isOldIE||browser.isDOM)
{layer.innerHTML=content;}};OpenLayers.Control.WMSGetFeatureInfo=OpenLayers.Class(OpenLayers.Control,{drawMode:null,queryablelayertypes:["OpenLayers.Layer.WMS","OpenLayers.Layer.WMS.Untiled","OpenLayers.Layer.MapServer"],div:null,renderform:true,proxy:null,layers:null,tables:null,layerstoquery:null,tablestoquery:null,result:null,anchored:false,form:null,queries:0,errors:0,features:null,popup:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.layers=[];this.tables=[];this.layerstoquery=[];this.tablestoquery=[];this.features=[];var callbacks={click:this.onClick};var options={delay:0};this.handler=new OpenLayers.Handler.Click(this,callbacks,options);this.waitoptions={msg:'Abfrage wird durchgef&uuml;hrt, bitte warten oder abrechen mit Esc',progressText:'Loading...',width:400,wait:true,waitConfig:{interval:200}};},addLayer:function(layer,tables,options){options=options||{};this.layers.push(layer);this.tables.push(tables);},onClick:function(evt){this.loc=map.getLonLatFromViewPortPx(evt.xy);for(var i=0,len=this.layers.length;i<len;i++){aTable=this.tables[i];var possibleLayers=map.getLayersByName(this.layers[i]);if(possibleLayers.length!=1){var msg=' GetfeatureInfo Fehler bei layer '+this.layers[i];alert(msg);}
else{aLayer=possibleLayers[0];}
if(!aLayer.visibility){continue;}
this.layerstoquery.push(aLayer);this.tablestoquery.push(aTable);}
if(this.layerstoquery.length==0){this.showPopup("<br>Alle abfragbaren Layer sind ausgeschaltet. Gehen und Sie auf die Themanauswahl und schalten Sie den Layer ein, den Sie abfragen m&ouml;chten.");return;}
this.showWaitMessageBox();for(var i=0;i<this.layerstoquery.length;i++){var aLayer=this.layerstoquery[i];var aTable=this.tablestoquery[i];if(aLayer.CLASS_NAME=="OpenLayers.Layer.GeoShop"){var featureinfo_url=aLayer.url.replace('webclient','wms/getFeatureInfoOL.igs')+'?';var testurl='http://localhost:3501/webclient'
featureinfo_url+=testurl+'?reqid=link1&user=openlayers&password=openlayers&layers='+aTable;if(aLayer.params.view){featureinfo_url+='&view='+aLayer.params.view;}
var bounds=map.getMaxExtent();var size=map.getSize();featureinfo_url+='&res='+size.w+'x'+size.h;var left_top=map.getLonLatFromPixel(new OpenLayers.Pixel(0,0));var right_bottom=map.getLonLatFromPixel(new OpenLayers.Pixel(size.w,size.h));var point=map.getLonLatFromPixel(new OpenLayers.Pixel(evt.xy.x,evt.xy.y));featureinfo_url+='&p1='+left_top.lon+'/'+right_bottom.lat;featureinfo_url+='&p2='+right_bottom.lon+'/'+left_top.lat;featureinfo_url+='&p='+point.lon+'/'+point.lat;featureinfo_url+='&oclass=*&all';}
else{var featureinfo_url=aLayer.url+"?SERVICE=WMS&REQUEST=GetFeatureInfo";featureinfo_url=featureinfo_url
+"&VERSION=1.1.1"
+"&SRS="+aLayer.projection.projCode
+"&BBOX="+map.getExtent().toBBOX()
+"&X="+evt.xy.x+"&Y="+evt.xy.y
+"&INFO_FORMAT=text/html"
+"&LAYERS="+aTable
+"&QUERY_LAYERS="+aTable
+"&WIDTH="+map.size.w+"&HEIGHT="+map.size.h;}
if(this.proxy){var featureinfo_url=featureinfo_url.replace('?','&')
featureinfo_url=this.proxy+featureinfo_url;}
OpenLayers.loadURL(featureinfo_url,'',this,this.getFeatures,this.onError);}},getFeatures:function(response){var aFeature=response.responseText;this.queries++;aFeature=aFeature.replace(/^\s+/g,'').replace(/\s+$/g,'')
aFeature=aFeature.replace(/<\/td>/gim,'\n').replace(/(ftp|http|https|file):\/\/[\S]+(\b|$)/gim,'<a href="$&" class="my_link" target="_blank">$&</a>').replace(/([^\/])(www[\S]+(\b|$))/gim,'$1<a href="http://$2" class="my_link" target="_blank">$2</a>').replace(/\n/gim,'</td>');if(aFeature==""||aFeature=="\n"){}
else{this.features.push(aFeature);}
if(this.queries==this.layerstoquery.length){this.showResult();}},resetQueryData:function(){this.layerstoquery=[];this.tablestoquery=[];this.features=[];this.queries=0;this.errors=0;},showResult:function(){errMsg="";result="";if(this.errors>0){errMsg+=this.errors+" error detected";}
if(this.features.length==0){var errMsg='<br><b>Die Kartenabfrage lieferte kein Resultat. </b><br><br> Dies kann verschiedene Ursachen haben:<br>';errMsg+='<div style="padding-left:10px; class="text_legende""><br><ul style="margin-left: 12px;   list-style-position: outside; list-style-type: disc; ">';errMsg+='<li>die abfragbaren Layer sind ausgeschaltet</li>';errMsg+='<li>es befindet sich kein abfragebares Objekt in der N&auml;he des Mouse-Klicks</li>';errMsg+='<li>der Mouse-Klick ist zu ungenau, um das Objekt zu identifizieren</li>';errMsg+='</ul></div>';}
this.hideWaitMessageBox();result=errMsg;for(i=0;i<this.features.length;i++){result+=this.features[i];}
this.showPopup(result);this.resetQueryData();},onError:function(response){this.queries++;this.errors++;if(this.queries==this.layerstoquery.length){this.showResult();}},setMap:function(map){this.handler.setMap(map);OpenLayers.Control.prototype.setMap.apply(this,arguments);},activate:function(){if(this.active){return false;}
this.handler.activate();this.active=true;this.events.triggerEvent("activate");return true;},showPopup:function(text){if(text==""){return;}
if(!this.anchored){if(!this.popup){this.popup=new Ext.Window({id:'featureInfoResult',title:'Abfrageresultate',width:600,height:400,y:160,collapsible:true,expandOnShow:true,layout:'fit',html:'<div id="result">Hier stehen die Ergebnisse</div>',plain:true,animCollapse:true,autoScroll:true,expandOnShow:true,closeAction:'hide'});}}
else{if(!this.popup){this.popup=new GeoExt.Popup({id:'featureInfoResult',title:'Abfrageresultate',width:400,height:300,maximizable:true,collapsible:true,expandOnShow:true,html:'<div id="featureInfoResult">Hier stehen die Ergebnisse</div>',map:map,anchored:true,animCollapse:true,autoScroll:true,plain:true,listeners:{close:function(){this.caller.popup=null;}}});}}
this.popup.caller=this;this.popup.doLayout();this.popup.location=this.loc;this.popup.show();Ext.getCmp('featureInfoResult').body.dom.innerHTML=text;},deactivate:function(){if(this.active){this.handler.deactivate();this.active=false;this.events.triggerEvent("deactivate");return true;}
return false;},CLASS_NAME:"OpenLayers.Control.WMSGetFeatureInfo"});;OpenLayers.Layer.GeoShop=OpenLayers.Class(OpenLayers.Layer.Grid,{default_params:{user:"openlayers",password:"openlayers",view:"public",image_format:"gif"},reproject:false,isBaseLayer:true,encodeBBOX:false,queryString:"",initialize:function(name,url,params,options){var newArguments=[];newArguments.push(name,url,params,options);OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);OpenLayers.Util.applyDefaults(this.params,this.default_params);if(this.params.image_format&&this.params.image_format.toString().toLowerCase()=="png"&&this.params.background_color&&this.params.background_color=="transparent"){if(OpenLayers.Util.alphaHack()){this.params.image_format='gif'}}},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.GeoShop(this.name,this.url,this.params,this.options);}
obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj;},getURL:function(bounds){bounds=this.adjustBounds(bounds);var imageSize=this.getImageSize();var res=imageSize.w+"x"+imageSize.h;var p1=bounds.left+"/"+bounds.bottom;var p2=bounds.right+"/"+bounds.top;if(this.queryString==""){var requestString=this.getFullRequestString({reqid:"image1",'res':res,'p1':p1,'p2':p2});requestString+='&no_annotations';}
else{var requestString=this.getFullRequestString({'reqid':"image2",'res':res,'p1':p1,'p2':p2});requestString+=this.queryString+'&no_annotations';}
return requestString;},addTile:function(bounds,position){return new OpenLayers.Tile.Image(this,position,bounds,null,this.tileSize);},mergeNewParams:function(newParams){var upperParams=OpenLayers.Util.upperCaseObject(newParams);var newArguments=[upperParams];return OpenLayers.Layer.Grid.prototype.mergeNewParams.apply(this,newArguments);},setQuerString:function(myString){this.queryString=myString;},clearQuerString:function(){this.queryString="";},getFullRequestString:function(newParams,altUrl){var projectionCode=this.map.getProjection();return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments);},CLASS_NAME:"OpenLayers.Layer.GeoShop"});;var llvtools=new Object("llvtools");llvtools.writellvheader=function(width,AmtsStelle,AmtsStelle_ref,Thema,Thema_ref){var widthm=width-178-809;document.write('<table bgcolor="#FFFFFF" height="117" width="')
document.write(width);document.write('" border="0" cellspacing="0" cellpadding="0">');document.write('<tr background="#FFFFFF"> ');document.write('<td align="left"><a target="_blank" href="http://www.llv.li"><img src="http://geodaten.llv.li/geoshop/img/logo-landesverwaltung1.gif" width="160" height="116" alt="" border="0"></td> ');document.write('<td width="');document.write(widthm);document.write('" align="right"  ></td> ');document.write('<td style="background-image:url(http://geodaten.llv.li/geoshop/img/hintergrund_breit.gif); background-repeat:repeat-y; " height="117"  width="809" align="right"  >');document.write('<p style=" top:30px; font-family: Verdana, Arial, Helvetica, Sans-Serif; font-size: 28px; color:#FFFFFF; font-weight:normal; text-align:right; margin-top:0; margin-bottom:0"  >');document.write('<a target="_blank" style="color: #FFFFFF; text-decoration: none" href="');document.write(Thema_ref);document.write('">');document.write(Thema);document.write('</a> &nbsp; </p> ');document.write('<p style="  left:620px; top:60px;  font-family: Verdana, Arial, Helvetica, Sans-Serif;   font-size: 14px;   color:#FFFFFF;  font-weight:bold;  text-align:right; margin-top:8; margin-bottom:0" >');document.write('<a target="_blank" href="');document.write(AmtsStelle_ref)
document.write('" style="text-decoration: none"> <font color="#FFFFFF">');document.write(AmtsStelle);document.write(' </font></a>&nbsp; &nbsp;</p>');document.write('</td> ');document.write('<td align="right" width="18" height="117" ><a target="_blank" href="http://www.liechtenstein.li"><img height="117" src="http://geodaten.llv.li/geoshop/img/fl-logo.jpg"  alt="" border="0"></td> ');document.write('</tr>');document.write('</table>');}
llvtools.dragwin=function dragwin(divID,x,y,wi,hi,title,titleHeight,content,className,OnClosefunktion){this.imagedir="/geoportal/OpenLayers-2.8/user/win/image/"
this.left=x+'px';this.top=y+'px';this.OnCloseFunction=OnClosefunktion||'{ }';var div=document.createElement('div');var d=divID+'Parent';div.setAttribute('id',d);div.style.visibility='visible';div.className="DragwinWindow ";div.style.left=x+'px';div.style.top=y+'px';div.style.width=wi+'px';div.style.height=titleHeight+'px';div.style.position='absolute';this.titleDiv=document.createElement('div');this.titleDiv.style.visibility='visible';this.titleDiv.className='DragwinTitle';this.titleDiv.innerHTML=title;this.titleDiv.style.top='0px';this.titleDiv.style.left='0px';this.titleDiv.style.width='100%';this.titleDiv.style.height=titleHeight+'px';this.titleDiv.style.cursor='move';this.titleDiv.style.zIndex=2;var img=document.createElement('img');img.src=this.imagedir+"delete.gif";img.style.cursor='pointer';img.style.position='absolute';img.style.right='0px';img.parentDiv=div;img.reference=this;img.style.zIndex=5;img.style.visibility='visible';img.onclick=function(){if(this.reference.titleDiv.style.visibility=='visible'){this.reference.hide();eval(this.reference.OnCloseFunction);}
else{this.reference.show();}}
div.appendChild(img);this.clickimg=img;this.contentDiv=document.createElement('div');this.contentDiv.setAttribute('id',divID);this.contentDiv.className='DragwinContent';this.contentDiv.innerHTML=content;this.contentDiv.style.position='absolute';this.contentDiv.style.top=titleHeight+'px';this.contentDiv.style.height=hi-titleHeight+'px';this.contentDiv.style.bottom='0px';this.contentDiv.style.zIndex=1;this.contentDiv.style.overflow='auto';this.contentDiv.style.width='100%';div.className=className||'DragwinWindow';this.div=div;div.appendChild(this.titleDiv);div.appendChild(this.contentDiv);document.body.appendChild(div);var test="#"+d
this.show=function(){this.div.style.visibility='visible';this.clickimg.src=this.imagedir+'delete.gif';this.clickimg.style.visibility='visible';this.titleDiv.style.visibility='visible';this.contentDiv.style.visibility='visible';}
this.hide=function(){this.div.style.visibility='hidden';this.clickimg.style.visibility='hidden';this.titleDiv.style.visibility='hidden';this.contentDiv.style.visibility='hidden';}
this.reset=function(){this.div.style.top=this.top;this.div.style.left=this.left;}
this.moveto=function(x,y){this.div.style.top=x+'px';this.div.style.left=y+'px';}};var printform='      <div style="padding-left:5px; font-size:12px;">';printform+='            <form name="drucken">';printform+='            <br><b>Plantitel:</b><br>';printform+='            <input style="width: 180px; font-size:11px;" name="titel" type="text" size="26" maxlength="30" value="Situationsplan"><br><br>'
printform+='            <b>Papierformat:</b><br>';printform+='              <select name="format" onchange="showRahmen()" style="width: 180px;font-size:12px;">';printform+='                <option value="0000">Format wählen...</option>';printform+='                <option value="A4">A4</option>';printform+='                <option value="A3">A3</option>';printform+='              </select>';printform+='              <br> <br>';printform+='              <b>Ausrichtung:</b> <br>';printform+='              <select style="width: 180px; font-size:11px;" name="ausrichtung" onchange="showRahmen()">';printform+='                <option value="0000">Ausrichtung wählen...</option>';printform+='                <option value="portrait">Hochformat</option>';printform+='                <option value="landscape">Querformat</option>';printform+='              </select>';printform+='              <br> <br>';printform+='              <b>Massstab:</b> <br> <br>';printform+='              <select style="font-size:11px;width: 180px;" name="massstab" onchange="showRahmen()" >';printform+='                <option value="0000">Massstab wählen...</option>';printform+='                <option value="100">1:100</option>';printform+='                <option value="200">1:200</option>';printform+='                <option value="250">1:250</option>';printform+='                <option value="500">1:500</option>';printform+='                <option value="1000">1:1000</option>';printform+='                <option value="2000">1:2000</option>';printform+='                <option value="2500">1:2500</option>';printform+='                <option value="5000">1:5000</option>';printform+='                <!--<option value="10000">1:10000</option>-->';printform+='              </select>';printform+='              <br> <br>';printform+='            <table>';printform+='              <tbody><tr>';printform+='                <td style="width: 2px;">';printform+='                  ';printform+='                </td>';printform+='                <td>';printform+='                  <input class="btn" value="Plan drucken" onclick="printRahmen()" type="button" style="font-size:11px;text-align:left;width: 180px;">';printform+='                </td>';printform+='              </tr>';printform+='              <tr>';printform+='                <td>';printform+='                  ';printform+='                </td>';printform+='                <td>';printform+='                  <input class="btn" value="Rahmen neu erstellen" onclick="centerRahmen()" type="button" style="font-size:11px;text-align:left;width: 180px;">';printform+='                </td>';printform+='              </tr>';printform+='              <tr>';printform+='                <td>';printform+='                  ';printform+='                </td>';printform+='                <td>';printform+='                  <input class="btn" value="Rahmen löschen" onclick="deleteRahmen()" type="button" style="font-size:11px; text-align:left;width: 180px;">';printform+='                </td>';printform+='              </tr>';printform+='            </tbody></table>';printform+='          </form></div>';var frameWidth;var frameHeight;var frameScale;var marginX=0.02;var marginY=0.02;var marginTitle=0.03;var format;var ausrichtung;var massstab;function printRahmen(){format=document.drucken.format.value;ausrichtung=document.drucken.ausrichtung.value;massstab=document.drucken.massstab.value;titel=document.drucken.titel.value;if(titel==""){titel="Situationsplan Geodatenportal";}
if(format=="0000"||ausrichtung=="0000"||massstab=="0000"){return;}
var frameLayer=map.getLayersByName("rahmen");var bbox=frameLayer[0].features[0].geometry.getBounds();var left=bbox.left;var top=bbox.top;var bottom=bbox.bottom;var right=bbox.right;var url='/geoportal/print/plot.html?format='+format+'&orientation='+ausrichtung+'&scale='+massstab;url+='&top='+top+'&left='+left+'&right='+right+'&bottom='+bottom+'&titel='+titel;url+='&frameWidth='+frameWidth+'&frameHeight='+frameHeight;window.open(url,'Plot_preview','width=970,height=860,toolbar=0,menubar=1,location=0,personalbar=0,navigation=0,resizable=1');}
function showRahmen(){format=document.drucken.format.value;ausrichtung=document.drucken.ausrichtung.value;massstab=document.drucken.massstab.value;if(format=="0000"||ausrichtung=="0000"||massstab=="0000"){return;}
frameScale=massstab;setFrameSize(format,ausrichtung);var layer_style=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style['default']);layer_style.fillOpacity=0.4;layer_style.fillColor="#FFFFFF";layer_style.strokeColor="#FFFF00";layer_style.strokeWidth=2;layer_style.graphicOpacity=1;mapRes=this.map.getResolution();if(map.getLayersByName("rahmen").length==0){var xl=map.getCenter().lon;var yl=map.getCenter().lat;var frameGeom=new OpenLayers.Bounds(xl-(frameWidth*frameScale)/2,yl-(frameHeight*frameScale)/2,xl+(frameWidth*frameScale)/2,yl+(frameHeight*frameScale)/2).toGeometry();var frameFeat=new OpenLayers.Feature.Vector(frameGeom,null,null);var frameLayer=new OpenLayers.Layer.Vector("rahmen",{style:layer_style,displayInLayerSwitcher:false});frameLayer.addFeatures([frameFeat]);map.addLayer(frameLayer);var dragControl=new OpenLayers.Control.DragFeature(frameLayer);map.addControl(dragControl);dragControl.activate();}
else{var frameLayer=map.getLayersByName("rahmen");var xl=frameLayer[0].features[0].geometry.getBounds().toArray()[0];var yl=frameLayer[0].features[0].geometry.getBounds().toArray()[1];var frameGeom=new OpenLayers.Bounds(xl,yl,xl+(frameWidth*frameScale),yl+(frameHeight*frameScale)).toGeometry();var frameFeat=new OpenLayers.Feature.Vector(frameGeom,null,null);frameLayer[0].removeFeatures(frameLayer[0].features);frameLayer[0].addFeatures([frameFeat]);frameLayer[0].setVisibility(true);}}
function deleteRahmen(){var frameLayer=this.map.getLayersByName("rahmen");frameLayer[0].setVisibility(false);}
function centerRahmen(){var frameLayer=this.map.getLayersByName("rahmen");frameLayer[0].setVisibility(true);if(map.getLayersByName("rahmen").length==0){return;}
var xl=map.getCenter().lon;var yl=map.getCenter().lat;var frameGeom=new OpenLayers.Bounds(xl-(frameWidth*frameScale)/2,yl-(frameHeight*frameScale)/2,xl+(frameWidth*frameScale)/2,yl+(frameHeight*frameScale)/2).toGeometry();var frameFeat=new OpenLayers.Feature.Vector(frameGeom,null,null);var frameLayer=map.getLayersByName("rahmen");frameLayer[0].removeFeatures(frameLayer[0].features);frameLayer[0].addFeatures([frameFeat]);}
function setFrameSize(paperformat,paperorientation){if(paperformat=="A4"){if(paperorientation=="landscape"){frameWidth=0.297-2*marginX-marginTitle;frameHeight=0.210-2*marginY;}
if(paperorientation=="portrait"){frameWidth=0.210-2*marginX;frameHeight=0.297-2*marginY-marginTitle;}}
if(paperformat=="A3"){if(paperorientation=="landscape"){frameWidth=0.420-2*marginX-marginTitle;frameHeight=0.297-2*marginY;}
if(paperorientation=="portrait"){frameWidth=0.297-2*marginX;frameHeight=0.420-2*marginY-marginTitle;}}
if(paperformat=="A2"){if(paperorientation=="landscape"){frameWidth=0.594-2*marginX-marginTitle;frameHeight=0.420-2*marginY;}
if(paperorientation=="portrait"){frameWidth=0.420-2*marginX;frameHeight=0.594-2*marginY-marginTitle;}}
if(paperformat=="A1"){if(paperorientation=="landscape"){frameWidth=0.841-2*marginX-marginTitle;frameHeight=0.594-2*marginY;}
if(paperorientation=="portrait"){frameWidth=0.594-2*marginX;frameHeight=0.841-2*marginY-marginTitle;}}
if(paperformat=="A0"){if(paperorientation=="landscape"){frameWidth=1.189-2*marginX-marginTitle;frameHeight=0.841-2*marginY;}
if(paperorientation=="portrait"){frameWidth=0.841-2*marginX;frameHeight=1.189-2*marginY-marginTitle;}}};OpenLayers.Control.prototype.showWaitMessage=function(){var drawMode=(this.drawMode)?this.drawMode:null;if(!drawMode&&Ext){drawMode="extjs";}
switch(drawMode){case"extjs":case"mapfish":case"geoext":this.waitmessage=Ext.MessageBox.show(this.waitoptions);break;case"html":break;default:}};OpenLayers.Control.prototype.waitmessagebox=null;OpenLayers.Control.prototype.waitoptions={msg:'Action in progress, please wait...',progressText:'Loading...',width:300,wait:true,waitConfig:{interval:200}};OpenLayers.Control.prototype.showWaitMessageBox=function(){var drawMode=(this.drawMode)?this.drawMode:null;if(!drawMode&&Ext){drawMode="extjs";}
switch(drawMode){case"extjs":case"mapfish":case"geoext":this.waitmessagebox=Ext.MessageBox.show(this.waitoptions);break;case"html":break;default:}};OpenLayers.Control.prototype.hideWaitMessageBox=function(){var drawMode=(this.drawMode)?this.drawMode:null;if(!drawMode&&Ext){drawMode="extjs";}
switch(drawMode){case"extjs":case"mapfish":case"geoext":this.waitmessagebox.hide();break;case"html":break;default:}};;var suchform_adr='<div style="padding-left:10px; padding-top:15px; font-size:12px;" >';suchform_adr+='<form name="sucheadr" action="" onSubmit="return false;" >';suchform_adr+='     <span class="text_legende" style="font-weight:bold;">Ortschaft:</span> <br><br>';suchform_adr+='     <select name="gemeinde" onchange="getStrasse(this.value)" style="width: 180px; font-size:11px;">';suchform_adr+='        <option value="0000">Ortschaft wählen...</option>';suchform_adr+='        <option value="9496">Balzers</option>';suchform_adr+='        <option value="9492">Eschen</option>';suchform_adr+='        <option value="9487">Gamprin-Bendern</option>';suchform_adr+='        <option value="9493">Mauren</option>';suchform_adr+='        <option value="9485">Nendeln</option>';suchform_adr+='        <option value="9498">Planken</option>';suchform_adr+='        <option value="9491">Ruggell</option>';suchform_adr+='        <option value="9494">Schaan</option>';suchform_adr+='        <option value="9486">Schaanwald</option>';suchform_adr+='        <option value="9488">Schellenberg</option>';suchform_adr+='        <option value="9495">Triesen</option>';suchform_adr+='        <option value="9497">Triesenberg</option>';suchform_adr+='        <option value="9490">Vaduz</option>';suchform_adr+='      </select>';suchform_adr+='      <br> <br>';suchform_adr+='      <span class="text_legende" style="font-weight:bold;">Strasse:</span><br><br>';suchform_adr+='      <select name="strasse" onchange="getHausnummer()" style="width: 180px;font-size:11px;">';suchform_adr+='        <option value="0000">Strasse wählen...</option>';suchform_adr+='      </select>';suchform_adr+='      <br> <br>';suchform_adr+='      <span class="text_legende" style="font-weight:bold;">Hausnummer:</span> <br> <br>';suchform_adr+='      <div>';suchform_adr+='        <span style="float:left;"> ';suchform_adr+='           <select name="hausnummer" style="width: 180px;font-size:11px;">';suchform_adr+='               <option value="0000">Nummer wählen...</option>';suchform_adr+='           </select>';suchform_adr+='       </span>';suchform_adr+='      <span id="suchbutton1"></span>';suchform_adr+='     </div>';suchform_adr+='     <br>';suchform_adr+='  </form>';suchform_adr+='  </div>';suchform_adr+=' <div class="text_legende" style="height: 50px; font-size:12px; padding-top:10px; padding-left: 10px;" id="message_adr"><p>Wählen Sie zuerst die Ortschaft<p></div>';var suchform_grst='<div style="padding-left:10px; padding-top: 15px; font-size:12px;" > ';suchform_grst+='<form name="suchegrst" action="" onSubmit="return false;">';suchform_grst+='      <span class="text_legende" style="font-weight:bold;">Gemeinde:</span> <br> <br>';suchform_grst+='      <select name="gemeinde" style="width: 180px; font-size:11px;">';suchform_grst+='        <option value="0000">Gemeinde wählen...</option>';suchform_grst+='        <option value="7003">Balzers</option>';suchform_grst+='        <option value="7007">Eschen-Nendeln</option>';suchform_grst+='        <option value="7009">Gamprin-Bendern</option>';suchform_grst+='        <option value="7008">Mauren-Schaanwald</option>';suchform_grst+='        <option value="7006">Planken</option>'
suchform_grst+='        <option value="7010">Ruggell</option>';suchform_grst+='        <option value="7005">Schaan</option>';suchform_grst+='        <option value="7011">Schellenberg</option>';suchform_grst+='        <option value="7002">Triesen</option>';suchform_grst+='        <option value="7004">Triesenberg</option>';suchform_grst+='        <option value="7001">Vaduz</option>';suchform_grst+='     </select>';suchform_grst+='     <br><br>';suchform_grst+='     <span class="text_legende" style="font-weight:bold;">Grundstück:</span> <br> <br>';suchform_grst+='    <div><input style="float:left;" name="grundstueck" type="text" size="26" maxlength="30" action="">';suchform_grst+='       <span id="suchbutton2"></span>';suchform_grst+='     </div>';suchform_grst+='   </form>';suchform_grst+='</div>';suchform_grst+='<div class="text_legende" style="height: 50px; font-size:12px; padding-top:20px; padding-left: 10px;" id="message_grst"><p>Wählen Sie zuerst die Gemeinde<p></div>';var suchform_poi='<div style="padding-left:10px; padding-top: 15px; font-size:12px;" > ';suchform_poi+='<form name="suchepoi" action="" onSubmit="return false;">';suchform_poi+='      <span class="text_legende" style="font-weight:bold;">Gemeinde:</span> <br> <br>';suchform_poi+='      <select name="gemeinde" onchange="getPoi(this.value)" style="width: 180px; font-size:11px;">';suchform_poi+='        <option value="0000">Gemeinde wählen...</option>';suchform_poi+='        <option value="7003">Balzers</option>';suchform_poi+='        <option value="7007">Eschen-Nendeln</option>';suchform_poi+='        <option value="7009">Gamprin-Bendern</option>';suchform_poi+='        <option value="7008">Mauren-Schaanwald</option>';suchform_poi+='        <option value="7006">Planken</option>'
suchform_poi+='        <option value="7010">Ruggell</option>';suchform_poi+='        <option value="7005">Schaan</option>';suchform_poi+='        <option value="7011">Schellenberg</option>';suchform_poi+='        <option value="7002">Triesen</option>';suchform_poi+='        <option value="7004">Triesenberg</option>';suchform_poi+='        <option value="7001">Vaduz</option>';suchform_poi+='     </select>';suchform_poi+='     <br><br>';suchform_poi+='     <span class="text_legende" style="font-weight:bold;">Typ:</span> <br> <br>';suchform_poi+='      <select name="poityp" onchange="getPoi(this.value)" style="width: 180px; font-size:11px;">';suchform_poi+='        <option value="0001">Objektname</option>';suchform_poi+='        <option value="0002">Flurname</option>';suchform_poi+='     </select>';suchform_poi+='     <br><br>';suchform_poi+='      <span class="text_legende" style="font-weight:bold;">Name:</span> <br> <br>';suchform_poi+='      <div>';suchform_poi+='        <span style="float:left;"> ';suchform_poi+='           <select name="poiname" style="width: 180px;font-size:11px;">';suchform_poi+='               <option value="0000">Name wählen...</option>';suchform_poi+='           </select>';suchform_poi+='       </span>';suchform_poi+='      <span id="suchbutton3"></span>';suchform_poi+='     </div>';suchform_poi+='   </form>';suchform_poi+='</div>';suchform_poi+='<div class="text_legende" style="height: 50px; font-size:12px; padding-top:20px; padding-left: 10px;" id="message_poi"><p>Wählen Sie zuerst die Gemeinde und den Typ<p></div>';var suchform_koo='<div style="padding-left:10px; padding-top: 15px; font-size:12px;" > ';suchform_koo+='<form name="suchekoo" action="" onSubmit="return false;">';suchform_koo+='    <span class="text_legende" style="font-weight:bold;">Ostwert:</span> <br> <br>';suchform_koo+='   <input style="float:left;" name="ostwert" type="text" size="26" maxlength="30" action=""><br><br>';suchform_koo+='    <span class="text_legende" style="font-weight:bold;">Nordwert:</span> <br> <br>';suchform_koo+='  <input style="float:left;" name="nordwert" type="text" size="26" maxlength="30" action="">';suchform_koo+='   <br><br><span id="suchbuttonkoo"></span>';suchform_koo+='   </form>';suchform_koo+='</div>';suchform_koo+='<div class="text_legende" style="height: 50px; font-size:12px; padding-top:20px; padding-left: 10px;" id="message_koo"><p>Landeskoordinaten in Meter eingeben<p></div>';var suchform_flie='<div style="padding-left:10px; padding-top: 15px; font-size:12px;" > ';suchform_flie+='<form name="sucheflie" action="" onSubmit="return false;">';suchform_flie+='      <span class="text_legende" style="font-weight:bold;">Fliessgewässer:</span> <br> <br>';suchform_flie+='      <select name="name"  style="width: 180px; font-size:11px;">';suchform_flie+='        <option value="0000">Gewässer wählen...</option>';suchform_flie+='     </select>';suchform_flie+='     <br><br>';suchform_flie+='      <span style="padding-left:10px;" id="suchbuttonflie"></span>';suchform_flie+=' </form>';suchform_flie+='</div>';suchform_flie+='<div class="text_legende" style="height: 50px; font-size:12px; padding-top:20px; padding-left: 10px;" id="message_flie"><p>Wählen Sie zuerst die Gemeinde und den Typ<p></div>';function getbfsnr(plz){var bfsnr=0;if(plz=="9490"){bfsnr=7001}
if(plz=="9495"){bfsnr=7002}
if(plz=="9496"){bfsnr=7003}
if(plz=="9497"){bfsnr=7004}
if(plz=="9494"){bfsnr=7005}
if(plz=="9498"){bfsnr=7006}
if(plz=="9492"){bfsnr=7007}
if(plz=="9485"){bfsnr=7007}
if(plz=="9493"){bfsnr=7008}
if(plz=="9486"){bfsnr=7008}
if(plz=="9487"){bfsnr=7009}
if(plz=="9491"){bfsnr=7010}
if(plz=="9488"){bfsnr=7011}
return bfsnr;}
function StringToXML(string){if(document.implementation&&document.implementation.createDocument){var xmlparser=new DOMParser();return xmlparser.parseFromString(string,"text/xml");}else if(window.ActiveXObject){var xmldoc=new ActiveXObject("microsoft.xmldom");xmldoc.async="false";var status=xmldoc.loadXML(string);if(status){return xmldoc;}
else{return null;}}
return null;}
function suche_messagebox(el,htmlcontent){if(el=='adr'){document.getElementById('message_adr').innerHTML=htmlcontent;}
else if(el=='grst'){document.getElementById('message_grst').innerHTML=htmlcontent;}
else if(el=='poi'){document.getElementById('message_poi').innerHTML=htmlcontent;}
else if(el=='koo'){document.getElementById('message_koo').innerHTML=htmlcontent;}
else if(el=='flie'){document.getElementById('message_flie').innerHTML=htmlcontent;}
else if(el=='fln'){document.getElementById('message_fln').innerHTML=htmlcontent;}
else{alert('fehler');}}
function sucheLayerClear(){if(map.getLayersByName("suchen").length>0){var suchLayers=map.getLayersByName("suchen");suchLayers[0].removeFeatures(suchLayers[0].features);}}
function get_sucheMapLayer(){if(map.getLayersByName("suchen").length==0){var myStyles=new OpenLayers.StyleMap({"default":new OpenLayers.Style({pointRadius:30,fillColor:"#8C00C6",strokeColor:"#8C00C6",strokeWidth:2,fillOpacity:0.1}),"select":new OpenLayers.Style({fillColor:"#66ccff",strokeColor:"#3399ff"})});var suchenLayer=new OpenLayers.Layer.Vector("suchen",{styleMap:myStyles,displayInLayerSwitcher:false});map.addLayer(suchenLayer);}
else{var suchLayers=map.getLayersByName("suchen");suchLayers[0].removeFeatures(suchLayers[0].features);suchenLayer=suchLayers[0];}
return suchenLayer;}
function getStrasse(gem_bfs){var suchlayer=get_sucheMapLayer();if(document.sucheadr.gemeinde.selectedIndex==0){document.sucheadr.strasse.options.length=1;document.sucheadr.hausnummer.options.length=1;return;}
document.sucheadr.strasse[0].text='Daten werden geladen...';document.sucheadr.strasse.options.length=1;document.sucheadr.hausnummer.options.length=1;url="/cgi-bin/mapserv.exe?map=/ms4w/apps/llv/service/geoportal.map&service=wfs&version=1.0.0&request=getfeature&propertyname=(plz,strassenname,strassennummer)&typename=PLZ_STR&maxfeatures=200&";url+='Filter=<Filter><PropertyIsEqualTo><PropertyName>plz</PropertyName><Literal>'+gem_bfs+'</Literal></PropertyIsEqualTo></Filter>';OpenLayers.loadURL(url,'',this,setStrasse,setStrasse);suche_messagebox('adr','');};function setStrasse(response){response.ContentType="application/xml";var doc=response.responseXML;var gml=new OpenLayers.Format.GML({'extractAttributes':true});var features=[];features=gml.read(doc);var strassen=[];for(var i=0;i<features.length;i++){strassen[i]=features[i].attributes['strassenname']+';'+features[i].attributes['strassennummer'];}
strassen.sort(stringComparison);for(var i=0;i<strassen.length;i++){var temp=strassen[i].split(";");document.sucheadr.strasse[i+1]=new Option(temp[0],temp[1]);}
suche_messagebox('adr','');document.sucheadr.strasse[0].text='Strasse wählen...';};function getHausnummer(){if(document.sucheadr.strasse.selectedIndex==0){document.sucheadr.hausnummer.options.length=1;return;}
document.sucheadr.hausnummer[0].text='Daten werden geladen...';document.sucheadr.hausnummer.options.length=1;var gem_bfs=document.sucheadr.gemeinde.value;var strasse_id=document.sucheadr.strasse.value;url="/cgi-bin/AVWMS?service=wfs&version=1.0.0&request=getfeature&typename=HADR&maxfeatures=1000&propertyname=(strassennummer,plz,hausnummer)&";url+='filter=<Filter><AND><PropertyIsEqualTo><PropertyName>plz</PropertyName><Literal>'+gem_bfs+'</Literal></PropertyIsEqualTo>';url+='<PropertyIsEqualTo><PropertyName>strassennummer</PropertyName><Literal>'+strasse_id+'</Literal></PropertyIsEqualTo></AND></Filter>';suche_messagebox('adr','');OpenLayers.loadURL(url,'',this,setHausnummer,setHausnummer);}
function setHausnummer(response){response.ContentType="application/xml";var doc=response.responseXML;var gml=new OpenLayers.Format.GML({'extractAttributes':true});var features=[];features=gml.read(doc);hausnummern=new Array(features.length);for(var i=0;i<features.length;i++){if(features[i].attributes['hausnummer'].length){}
hausnummern[i]=features[i].attributes['hausnummer'];}
hausnummern.sort(hnrSort);for(var i=0;i<features.length;i++){document.sucheadr.hausnummer[i+1]=new Option(hausnummern[i],hausnummern[i]);}
suche_messagebox('adr','');document.sucheadr.hausnummer[0].text='Nummer wählen...';};function showHausnummer(){sucheLayerClear();var strasse_id=document.sucheadr.strasse.value;var hausnummer=document.sucheadr.hausnummer.value;if(strasse_id=='0000'||hausnummer=='0000'){suche_messagebox('adr',"Bitte zuerst die Ortschaft, Strasse und Hausnummer wählen");return}
url="/cgi-bin/AVWMS?service=wfs&version=1.0.0&request=getfeature&typename=HADR&maxfeatures=1&";url+='filter=<Filter><AND><PropertyIsEqualTo><PropertyName>strassennummer</PropertyName><Literal>'+strasse_id+'</Literal></PropertyIsEqualTo>';url+='<PropertyIsEqualTo><PropertyName>hausnummer</PropertyName><Literal>'+hausnummer+'</Literal></PropertyIsEqualTo></AND></Filter>';OpenLayers.loadURL(url,'',this,zoomToHausnummer,zoomToHausnummer);};function zoomToHausnummer(response){response.ContentType="application/xml";var doc=response.responseXML;var gml=new OpenLayers.Format.GML({'extractAttributes':true});suche_messagebox('adr',"");var features=[];features=gml.read(doc);suchLayer=get_sucheMapLayer();console.log(suchLayer);suchLayer.addFeatures(features);map.setCenter(new OpenLayers.LonLat(features[0].geometry.x,features[0].geometry.y),(map.scales.length-3));};function showGrundstueck(){var suchlayer=get_sucheMapLayer();sucheLayerClear();var gem_bfs=document.suchegrst.gemeinde.value;var nummer=document.suchegrst.grundstueck.value;if(!nummer||gem_bfs=='0000'){suche_messagebox('grst',"Bitte Gemeinde und Grundstücksnummer angeben");return};url="/cgi-bin/AVWMS?service=wfs&version=1.0.0&request=getfeature&typename=RESF&maxfeatures=1&";url+='filter=<Filter><AND><PropertyIsEqualTo><PropertyName>bfsnr</PropertyName><Literal>'+gem_bfs+'</Literal></PropertyIsEqualTo>';url+='<PropertyIsEqualTo><PropertyName>nummer</PropertyName><Literal>'+nummer+'</Literal></PropertyIsEqualTo></AND></Filter>';OpenLayers.loadURL(url,'',this,zoomToGrundstueck,zoomToGrundstueck);};function zoomToGrundstueck(response){response.ContentType="application/xml";var doc=response.responseXML;var gml=new OpenLayers.Format.GML({'extractAttributes':true});var features=[];features=gml.read(doc);if(features.length>0){suche_messagebox('grst',"");suchLayer=get_sucheMapLayer();console.log(suchLayer);suchLayer.addFeatures(features);map.zoomToExtent(features[0].geometry.getBounds().scale(2.0));}
else{suche_messagebox('grst',"Grundstueck nicht gefunden");}};function getPoi(){var suchlayer=get_sucheMapLayer();if(document.suchepoi.gemeinde.selectedIndex==0){document.suchepoi.poiname.options.length=1;return;}
document.suchepoi.poiname[0].text='Daten werden geladen...';document.suchepoi.poiname.options.length=1;var bfsnr=document.suchepoi.gemeinde.value;var typ=document.suchepoi.poityp.value;if(typ=='0001'){url="/cgi-bin/mapserv.exe?map=/ms4w/apps/llv/service/geoportal.map&service=wfs&version=1.0.0&request=getfeature&propertyname=(gid,name_nummer,bfsnr,kategorie)&typename=LCOBJ&maxfeatures=200&";url+='Filter=<Filter><PropertyIsEqualTo><PropertyName>bfsnr</PropertyName><Literal>'+bfsnr+'</Literal></PropertyIsEqualTo></Filter>';}
else{url="/cgi-bin/mapserv.exe?map=/ms4w/apps/llv/service/geoportal.map&service=wfs&version=1.0.0&request=getfeature&propertyname=(gid,name,bfsnr,kategorie)&typename=LNNA&maxfeatures=200&";url+='Filter=<Filter><PropertyIsEqualTo><PropertyName>bfsnr</PropertyName><Literal>'+bfsnr+'</Literal></PropertyIsEqualTo></Filter>';}
OpenLayers.loadURL(url,'',this,setPoi,setPoi);suche_messagebox('poi','');};function setPoi(response){response.ContentType="application/xml";var typ=document.suchepoi.poityp.value;var doc=response.responseXML;var gml=new OpenLayers.Format.GML({'extractAttributes':true});var features=[];features=gml.read(doc);var pois=[];for(var i=0;i<features.length;i++){if(typ=='0001'){pois[i]=features[i].attributes['name_nummer']+';'+features[i].attributes['gid'];}
else{pois[i]=features[i].attributes['name']+';'+features[i].attributes['gid'];}}
pois.sort();var poiselim=[];var lastname='';for(var i=0;i<pois.length;i++){var temp=pois[i].split(";");if(lastname!=temp[0]){poiselim.push(pois[i]);}
lastname=temp[0];}
for(var i=0;i<poiselim.length;i++){var temp=poiselim[i].split(";");document.suchepoi.poiname[i+1]=new Option(temp[0],temp[1]);}
suche_messagebox('adr','');document.suchepoi.poiname[0].text='Name wählen...';};function showPoi(){sucheLayerClear();var bfsnr=document.suchepoi.gemeinde.value;var gid=document.suchepoi.poiname.value;var typ=document.suchepoi.poityp.value;if(bfsnr=='0000'||gid=='0000'){suche_messagebox('poi',"Bitte zuerst die Gemeinde und Typ wählen");return}
if(typ=='0001'){url="/cgi-bin/mapserv.exe?map=/ms4w/apps/llv/service/geoportal.map&service=wfs&version=1.0.0&request=getfeature&typename=LCOBJ&maxfeatures=200&";url+='Filter=<Filter><PropertyIsEqualTo><PropertyName>gid</PropertyName><Literal>'+gid+'</Literal></PropertyIsEqualTo></Filter>';}
else{url="/cgi-bin/mapserv.exe?map=/ms4w/apps/llv/service/geoportal.map&service=wfs&version=1.0.0&request=getfeature&typename=LNNA&maxfeatures=200&";url+='Filter=<Filter><PropertyIsEqualTo><PropertyName>gid</PropertyName><Literal>'+gid+'</Literal></PropertyIsEqualTo></Filter>';}
OpenLayers.loadURL(url,'',this,zoomToPoi,zoomToPoi);};function zoomToPoi(response){response.ContentType="application/xml";var doc=response.responseXML;var gml=new OpenLayers.Format.GML({'extractAttributes':true});suche_messagebox('poi',"");var features=[];features=gml.read(doc);suchLayer=get_sucheMapLayer();console.log(suchLayer);suchLayer.addFeatures(features);map.setCenter(new OpenLayers.LonLat(features[0].geometry.x,features[0].geometry.y),(map.scales.length-4));};function showKoord(){var suchLayer=get_sucheMapLayer();sucheLayerClear();suche_messagebox('koo',"");var ost=document.suchekoo.ostwert.value;var nord=document.suchekoo.nordwert.value;if(!nord||!ost){suche_messagebox('koo',"Bitte zuerst beide Koordinatenwerte eingeben");return};if(ost<150000||ost>190000||nord<5000||nord>60000){suche_messagebox('koo',"ungültige Koordinate");return}
var features=[];features[0]=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(ost,nord));suchLayer.addFeatures(features);map.setCenter(new OpenLayers.LonLat(features[0].geometry.x,features[0].geometry.y),(map.scales.length-4));};function getFlie(){var suchlayer=get_sucheMapLayer();document.sucheflie.name[0].text='Daten werden geladen...';document.sucheflie.name.options.length=1;url="/cgi-bin/GWS?service=wfs&version=1.0.0&request=getfeature&typename=FLIEROUTE&maxfeatures=3000&propertyname=(name,gid)";suche_messagebox('flie','');OpenLayers.loadURL(url,'',this,setFlie,setFlie);}
function setFlie(response){response.ContentType="application/xml";var doc=response.responseXML;var gml=new OpenLayers.Format.GML({'extractAttributes':true});var features=[];features=gml.read(doc);var flies=[];for(var i=0;i<features.length;i++){flies[i]=features[i].attributes['name']+';'+features[i].attributes['gid'];}
flies.sort();var fliesel=[];var lastname="";for(var i=0;i<flies.length;i++){var temp=flies[i].split(";");if(lastname!=temp[0]){fliesel.push(flies[i]);}
lastname=temp[0];}
for(var i=0;i<fliesel.length;i++){var temp=fliesel[i].split(";");document.sucheflie.name[i+1]=new Option(temp[0],temp[1]);}
suche_messagebox('flie','');document.sucheflie.name[0].text='Gewässer wählen...';};function showFlie(){sucheLayerClear();var gid=document.sucheflie.name.value;var name=document.sucheflie.name[document.sucheflie.name.selectedIndex].text;name=escape(name);url="/cgi-bin/GWS?service=wfs&version=1.0.0&request=getfeature&typename=FLIEROUTE&maxfeatures=30&";url+='Filter=<Filter><PropertyIsEqualTo><PropertyName>name</PropertyName><Literal>'+name+'</Literal></PropertyIsEqualTo></Filter>';OpenLayers.loadURL(url,'',this,zoomToFlie,zoomToFlie);};function zoomToFlie(response){response.ContentType="application/xml";var doc=response.responseXML;var gml=new OpenLayers.Format.GML({'extractAttributes':true});suche_messagebox('flie',"");var features=[];features=gml.read(doc);suchLayer=get_sucheMapLayer();console.log(suchLayer);suchLayer.addFeatures(features);map.zoomToExtent(features[0].geometry.getBounds());};function showGemeinde(){var gem_bfs=document.suchegrst.gemeinde.value;if(gem_bfs=='0000'){suche_messagebox('grst',"Bitte zuerst die Gemeinde wählen");return}
url="/cgi-bin/AVWMS?service=wfs&version=1.1.0&request=getfeature&typename=MBSF&maxfeatures=1&";url+='filter=<Filter><PropertyIsEqualTo><PropertyName>bfsnr</PropertyName><Literal>'+gem_bfs+'</Literal></PropertyIsEqualTo></Filter>';OpenLayers.loadURL(url,'',this,zoomToGemeinde,zoomToGemeinde);}
function zoomToGemeinde(response){response.ContentType="application/xml";var doc=response.responseXML;alert(response.responseText);var gml=new OpenLayers.Format.GML({'extractAttributes':true});var features=[];features=gml.read(doc);alert(features[0].attributes);alert(features[0].geometry.toString());features[0].geometry.calculateBounds();map.zoomToExtent(features[0].geometry.bounds());};function hnrSort(a,b){if(a.match(/[a-zA-Z]/g)!=null){a=a.substring(0,a.length-1);}
if(b.match(/[a-zA-Z]/g)!=null){b=b.substring(0,b.length-1);}
return(a-b);}
function stringComparison(a,b){a=a.toLowerCase();a=a.replace(/ä/g,"a");a=a.replace(/ö/g,"o");a=a.replace(/ü/g,"u");a=a.replace(/ß/g,"s");b=b.toLowerCase();b=b.replace(/ä/g,"a");b=b.replace(/ö/g,"o");b=b.replace(/ü/g,"u");b=b.replace(/ß/g,"s");return(a==b)?0:(a>b)?1:-1;}
