var OpenLayers={VERSION_NUMBER:"$Revision$",singleFile:true,_getScriptLocation:(function(){var r=new RegExp("(^|(.*?\\/))(OpenLayers\.js)(\\?|$)"),s=document.getElementsByTagName('script'),src,m,l="";for(var i=0,len=s.length;i<len;i++){src=s[i].getAttribute('src');if(src){m=src.match(r);if(m){l=m[1];break;}}}
return(function(){return l;});})()};OpenLayers.Class=function(){var len=arguments.length;var P=arguments[0];var F=arguments[len-1];var C=typeof F.initialize=="function"?F.initialize:function(){P.prototype.initialize.apply(this,arguments);};if(len>1){var newArgs=[C,P].concat(Array.prototype.slice.call(arguments).slice(1,len-1),F);OpenLayers.inherit.apply(null,newArgs);}else{C.prototype=F;}
return C;};OpenLayers.inherit=function(C,P){var F=function(){};F.prototype=P.prototype;C.prototype=new F;var i,l,o;for(i=2,l=arguments.length;i<l;i++){o=arguments[i];if(typeof o==="function"){o=o.prototype;}
OpenLayers.Util.extend(C.prototype,o);}};OpenLayers.Util=OpenLayers.Util||{};OpenLayers.Util.extend=function(destination,source){destination=destination||{};if(source){for(var property in source){var value=source[property];if(value!==undefined){destination[property]=value;}}
var sourceIsEvt=typeof window.Event=="function"&&source instanceof window.Event;if(!sourceIsEvt&&source.hasOwnProperty&&source.hasOwnProperty("toString")){destination.toString=source.toString;}}
return destination;};OpenLayers.Util=OpenLayers.Util||{};OpenLayers.Util.getElement=function(){var elements=[];for(var i=0,len=arguments.length;i<len;i++){var element=arguments[i];if(typeof element=='string'){element=document.getElementById(element);}
if(arguments.length==1){return element;}
elements.push(element);}
return elements;};OpenLayers.Util.isElement=function(o){return!!(o&&o.nodeType===1);};OpenLayers.Util.isArray=function(a){return(Object.prototype.toString.call(a)==='[object Array]');};if(typeof window.$==="undefined"){window.$=OpenLayers.Util.getElement;}
OpenLayers.Util.removeItem=function(array,item){for(var i=array.length-1;i>=0;i--){if(array[i]==item){array.splice(i,1);}}
return array;};OpenLayers.Util.indexOf=function(array,obj){if(typeof array.indexOf=="function"){return array.indexOf(obj);}else{for(var i=0,len=array.length;i<len;i++){if(array[i]==obj){return i;}}
return-1;}};OpenLayers.Util.modifyDOMElement=function(element,id,px,sz,position,border,overflow,opacity){if(id){element.id=id;}
if(px){element.style.left=px.x+"px";element.style.top=px.y+"px";}
if(sz){element.style.width=sz.w+"px";element.style.height=sz.h+"px";}
if(position){element.style.position=position;}
if(border){element.style.border=border;}
if(overflow){element.style.overflow=overflow;}
if(parseFloat(opacity)>=0.0&&parseFloat(opacity)<1.0){element.style.filter='alpha(opacity='+(opacity*100)+')';element.style.opacity=opacity;}else if(parseFloat(opacity)==1.0){element.style.filter='';element.style.opacity='';}};OpenLayers.Util.createDiv=function(id,px,sz,imgURL,position,border,overflow,opacity){var dom=document.createElement('div');if(imgURL){dom.style.backgroundImage='url('+imgURL+')';}
if(!id){id=OpenLayers.Util.createUniqueID("OpenLayersDiv");}
if(!position){position="absolute";}
OpenLayers.Util.modifyDOMElement(dom,id,px,sz,position,border,overflow,opacity);return dom;};OpenLayers.Util.createImage=function(id,px,sz,imgURL,position,border,opacity,delayDisplay){var image=document.createElement("img");if(!id){id=OpenLayers.Util.createUniqueID("OpenLayersDiv");}
if(!position){position="relative";}
OpenLayers.Util.modifyDOMElement(image,id,px,sz,position,border,null,opacity);if(delayDisplay){image.style.display="none";function display(){image.style.display="";OpenLayers.Event.stopObservingElement(image);}
OpenLayers.Event.observe(image,"load",display);OpenLayers.Event.observe(image,"error",display);}
image.style.alt=id;image.galleryImg="no";if(imgURL){image.src=imgURL;}
return image;};OpenLayers.IMAGE_RELOAD_ATTEMPTS=0;OpenLayers.Util.alphaHackNeeded=null;OpenLayers.Util.alphaHack=function(){if(OpenLayers.Util.alphaHackNeeded==null){var arVersion=navigator.appVersion.split("MSIE");var version=parseFloat(arVersion[1]);var filter=false;try{filter=!!(document.body.filters);}catch(e){}
OpenLayers.Util.alphaHackNeeded=(filter&&(version>=5.5)&&(version<7));}
return OpenLayers.Util.alphaHackNeeded;};OpenLayers.Util.modifyAlphaImageDiv=function(div,id,px,sz,imgURL,position,border,sizing,opacity){OpenLayers.Util.modifyDOMElement(div,id,px,sz,position,null,null,opacity);var img=div.childNodes[0];if(imgURL){img.src=imgURL;}
OpenLayers.Util.modifyDOMElement(img,div.id+"_innerImage",null,sz,"relative",border);if(OpenLayers.Util.alphaHack()){if(div.style.display!="none"){div.style.display="inline-block";}
if(sizing==null){sizing="scale";}
div.style.filter="progid:DXImageTransform.Microsoft"+".AlphaImageLoader(src='"+img.src+"', "+"sizingMethod='"+sizing+"')";if(parseFloat(div.style.opacity)>=0.0&&parseFloat(div.style.opacity)<1.0){div.style.filter+=" alpha(opacity="+div.style.opacity*100+")";}
img.style.filter="alpha(opacity=0)";}};OpenLayers.Util.createAlphaImageDiv=function(id,px,sz,imgURL,position,border,sizing,opacity,delayDisplay){var div=OpenLayers.Util.createDiv();var img=OpenLayers.Util.createImage(null,null,null,null,null,null,null,delayDisplay);img.className="olAlphaImg";div.appendChild(img);OpenLayers.Util.modifyAlphaImageDiv(div,id,px,sz,imgURL,position,border,sizing,opacity);return div;};OpenLayers.Util.upperCaseObject=function(object){var uObject={};for(var key in object){uObject[key.toUpperCase()]=object[key];}
return uObject;};OpenLayers.Util.applyDefaults=function(to,from){to=to||{};var fromIsEvt=typeof window.Event=="function"&&from instanceof window.Event;for(var key in from){if(to[key]===undefined||(!fromIsEvt&&from.hasOwnProperty&&from.hasOwnProperty(key)&&!to.hasOwnProperty(key))){to[key]=from[key];}}
if(!fromIsEvt&&from&&from.hasOwnProperty&&from.hasOwnProperty('toString')&&!to.hasOwnProperty('toString')){to.toString=from.toString;}
return to;};OpenLayers.Util.getParameterString=function(params){var paramsArray=[];for(var key in params){var value=params[key];if((value!=null)&&(typeof value!='function')){var encodedValue;if(typeof value=='object'&&value.constructor==Array){var encodedItemArray=[];var item;for(var itemIndex=0,len=value.length;itemIndex<len;itemIndex++){item=value[itemIndex];encodedItemArray.push(encodeURIComponent((item===null||item===undefined)?"":item));}
encodedValue=encodedItemArray.join(",");}
else{encodedValue=encodeURIComponent(value);}
paramsArray.push(encodeURIComponent(key)+"="+encodedValue);}}
return paramsArray.join("&");};OpenLayers.Util.urlAppend=function(url,paramStr){var newUrl=url;if(paramStr){var parts=(url+" ").split(/[?&]/);newUrl+=(parts.pop()===" "?paramStr:parts.length?"&"+paramStr:"?"+paramStr);}
return newUrl;};OpenLayers.ImgPath='';OpenLayers.Util.getImagesLocation=function(){return OpenLayers.ImgPath||(OpenLayers._getScriptLocation()+"img/");};OpenLayers.Util.getImageLocation=function(image){return OpenLayers.Util.getImagesLocation()+image;};OpenLayers.Util.Try=function(){var returnValue=null;for(var i=0,len=arguments.length;i<len;i++){var lambda=arguments[i];try{returnValue=lambda();break;}catch(e){}}
return returnValue;};OpenLayers.Util.getXmlNodeValue=function(node){var val=null;OpenLayers.Util.Try(function(){val=node.text;if(!val){val=node.textContent;}
if(!val){val=node.firstChild.nodeValue;}},function(){val=node.textContent;});return val;};OpenLayers.Util.mouseLeft=function(evt,div){var target=(evt.relatedTarget)?evt.relatedTarget:evt.toElement;while(target!=div&&target!=null){target=target.parentNode;}
return(target!=div);};OpenLayers.Util.DEFAULT_PRECISION=14;OpenLayers.Util.toFloat=function(number,precision){if(precision==null){precision=OpenLayers.Util.DEFAULT_PRECISION;}
if(typeof number!=="number"){number=parseFloat(number);}
return precision===0?number:parseFloat(number.toPrecision(precision));};OpenLayers.Util.rad=function(x){return x*Math.PI/180;};OpenLayers.Util.deg=function(x){return x*180/Math.PI;};OpenLayers.Util.VincentyConstants={a:6378137,b:6356752.3142,f:1/298.257223563};OpenLayers.Util.distVincenty=function(p1,p2){var ct=OpenLayers.Util.VincentyConstants;var a=ct.a,b=ct.b,f=ct.f;var L=OpenLayers.Util.rad(p2.lon-p1.lon);var U1=Math.atan((1-f)*Math.tan(OpenLayers.Util.rad(p1.lat)));var U2=Math.atan((1-f)*Math.tan(OpenLayers.Util.rad(p2.lat)));var sinU1=Math.sin(U1),cosU1=Math.cos(U1);var sinU2=Math.sin(U2),cosU2=Math.cos(U2);var lambda=L,lambdaP=2*Math.PI;var iterLimit=20;while(Math.abs(lambda-lambdaP)>1e-12&&--iterLimit>0){var sinLambda=Math.sin(lambda),cosLambda=Math.cos(lambda);var sinSigma=Math.sqrt((cosU2*sinLambda)*(cosU2*sinLambda)+
(cosU1*sinU2-sinU1*cosU2*cosLambda)*(cosU1*sinU2-sinU1*cosU2*cosLambda));if(sinSigma==0){return 0;}
var cosSigma=sinU1*sinU2+cosU1*cosU2*cosLambda;var sigma=Math.atan2(sinSigma,cosSigma);var alpha=Math.asin(cosU1*cosU2*sinLambda/sinSigma);var cosSqAlpha=Math.cos(alpha)*Math.cos(alpha);var cos2SigmaM=cosSigma-2*sinU1*sinU2/cosSqAlpha;var C=f/16*cosSqAlpha*(4+f*(4-3*cosSqAlpha));lambdaP=lambda;lambda=L+(1-C)*f*Math.sin(alpha)*(sigma+C*sinSigma*(cos2SigmaM+C*cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)));}
if(iterLimit==0){return NaN;}
var uSq=cosSqAlpha*(a*a-b*b)/(b*b);var A=1+uSq/16384*(4096+uSq*(-768+uSq*(320-175*uSq)));var B=uSq/1024*(256+uSq*(-128+uSq*(74-47*uSq)));var deltaSigma=B*sinSigma*(cos2SigmaM+B/4*(cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)-
B/6*cos2SigmaM*(-3+4*sinSigma*sinSigma)*(-3+4*cos2SigmaM*cos2SigmaM)));var s=b*A*(sigma-deltaSigma);var d=s.toFixed(3)/1000;return d;};OpenLayers.Util.destinationVincenty=function(lonlat,brng,dist){var u=OpenLayers.Util;var ct=u.VincentyConstants;var a=ct.a,b=ct.b,f=ct.f;var lon1=lonlat.lon;var lat1=lonlat.lat;var s=dist;var alpha1=u.rad(brng);var sinAlpha1=Math.sin(alpha1);var cosAlpha1=Math.cos(alpha1);var tanU1=(1-f)*Math.tan(u.rad(lat1));var cosU1=1/Math.sqrt((1+tanU1*tanU1)),sinU1=tanU1*cosU1;var sigma1=Math.atan2(tanU1,cosAlpha1);var sinAlpha=cosU1*sinAlpha1;var cosSqAlpha=1-sinAlpha*sinAlpha;var uSq=cosSqAlpha*(a*a-b*b)/(b*b);var A=1+uSq/16384*(4096+uSq*(-768+uSq*(320-175*uSq)));var B=uSq/1024*(256+uSq*(-128+uSq*(74-47*uSq)));var sigma=s/(b*A),sigmaP=2*Math.PI;while(Math.abs(sigma-sigmaP)>1e-12){var cos2SigmaM=Math.cos(2*sigma1+sigma);var sinSigma=Math.sin(sigma);var cosSigma=Math.cos(sigma);var deltaSigma=B*sinSigma*(cos2SigmaM+B/4*(cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)-
B/6*cos2SigmaM*(-3+4*sinSigma*sinSigma)*(-3+4*cos2SigmaM*cos2SigmaM)));sigmaP=sigma;sigma=s/(b*A)+deltaSigma;}
var tmp=sinU1*sinSigma-cosU1*cosSigma*cosAlpha1;var lat2=Math.atan2(sinU1*cosSigma+cosU1*sinSigma*cosAlpha1,(1-f)*Math.sqrt(sinAlpha*sinAlpha+tmp*tmp));var lambda=Math.atan2(sinSigma*sinAlpha1,cosU1*cosSigma-sinU1*sinSigma*cosAlpha1);var C=f/16*cosSqAlpha*(4+f*(4-3*cosSqAlpha));var L=lambda-(1-C)*f*sinAlpha*(sigma+C*sinSigma*(cos2SigmaM+C*cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)));var revAz=Math.atan2(sinAlpha,-tmp);return new OpenLayers.LonLat(lon1+u.deg(L),u.deg(lat2));};OpenLayers.Util.getParameters=function(url){url=(url===null||url===undefined)?window.location.href:url;var paramsString="";if(OpenLayers.String.contains(url,'?')){var start=url.indexOf('?')+1;var end=OpenLayers.String.contains(url,"#")?url.indexOf('#'):url.length;paramsString=url.substring(start,end);}
var parameters={};var pairs=paramsString.split(/[&;]/);for(var i=0,len=pairs.length;i<len;++i){var keyValue=pairs[i].split('=');if(keyValue[0]){var key=keyValue[0];try{key=decodeURIComponent(key);}catch(err){key=unescape(key);}
var value=(keyValue[1]||'').replace(/\+/g," ");try{value=decodeURIComponent(value);}catch(err){value=unescape(value);}
value=value.split(",");if(value.length==1){value=value[0];}
parameters[key]=value;}}
return parameters;};OpenLayers.Util.lastSeqID=0;OpenLayers.Util.createUniqueID=function(prefix){if(prefix==null){prefix="id_";}
OpenLayers.Util.lastSeqID+=1;return prefix+OpenLayers.Util.lastSeqID;};OpenLayers.INCHES_PER_UNIT={'inches':1.0,'ft':12.0,'mi':63360.0,'m':39.3701,'km':39370.1,'dd':4374754,'yd':36};OpenLayers.INCHES_PER_UNIT["in"]=OpenLayers.INCHES_PER_UNIT.inches;OpenLayers.INCHES_PER_UNIT["degrees"]=OpenLayers.INCHES_PER_UNIT.dd;OpenLayers.INCHES_PER_UNIT["nmi"]=1852*OpenLayers.INCHES_PER_UNIT.m;OpenLayers.METERS_PER_INCH=0.02540005080010160020;OpenLayers.Util.extend(OpenLayers.INCHES_PER_UNIT,{"Inch":OpenLayers.INCHES_PER_UNIT.inches,"Meter":1.0/OpenLayers.METERS_PER_INCH,"Foot":0.30480060960121920243/OpenLayers.METERS_PER_INCH,"IFoot":0.30480000000000000000/OpenLayers.METERS_PER_INCH,"ClarkeFoot":0.3047972651151/OpenLayers.METERS_PER_INCH,"SearsFoot":0.30479947153867624624/OpenLayers.METERS_PER_INCH,"GoldCoastFoot":0.30479971018150881758/OpenLayers.METERS_PER_INCH,"IInch":0.02540000000000000000/OpenLayers.METERS_PER_INCH,"MicroInch":0.00002540000000000000/OpenLayers.METERS_PER_INCH,"Mil":0.00000002540000000000/OpenLayers.METERS_PER_INCH,"Centimeter":0.01000000000000000000/OpenLayers.METERS_PER_INCH,"Kilometer":1000.00000000000000000000/OpenLayers.METERS_PER_INCH,"Yard":0.91440182880365760731/OpenLayers.METERS_PER_INCH,"SearsYard":0.914398414616029/OpenLayers.METERS_PER_INCH,"IndianYard":0.91439853074444079983/OpenLayers.METERS_PER_INCH,"IndianYd37":0.91439523/OpenLayers.METERS_PER_INCH,"IndianYd62":0.9143988/OpenLayers.METERS_PER_INCH,"IndianYd75":0.9143985/OpenLayers.METERS_PER_INCH,"IndianFoot":0.30479951/OpenLayers.METERS_PER_INCH,"IndianFt37":0.30479841/OpenLayers.METERS_PER_INCH,"IndianFt62":0.3047996/OpenLayers.METERS_PER_INCH,"IndianFt75":0.3047995/OpenLayers.METERS_PER_INCH,"Mile":1609.34721869443738887477/OpenLayers.METERS_PER_INCH,"IYard":0.91440000000000000000/OpenLayers.METERS_PER_INCH,"IMile":1609.34400000000000000000/OpenLayers.METERS_PER_INCH,"NautM":1852.00000000000000000000/OpenLayers.METERS_PER_INCH,"Lat-66":110943.316488932731/OpenLayers.METERS_PER_INCH,"Lat-83":110946.25736872234125/OpenLayers.METERS_PER_INCH,"Decimeter":0.10000000000000000000/OpenLayers.METERS_PER_INCH,"Millimeter":0.00100000000000000000/OpenLayers.METERS_PER_INCH,"Dekameter":10.00000000000000000000/OpenLayers.METERS_PER_INCH,"Decameter":10.00000000000000000000/OpenLayers.METERS_PER_INCH,"Hectometer":100.00000000000000000000/OpenLayers.METERS_PER_INCH,"GermanMeter":1.0000135965/OpenLayers.METERS_PER_INCH,"CaGrid":0.999738/OpenLayers.METERS_PER_INCH,"ClarkeChain":20.1166194976/OpenLayers.METERS_PER_INCH,"GunterChain":20.11684023368047/OpenLayers.METERS_PER_INCH,"BenoitChain":20.116782494375872/OpenLayers.METERS_PER_INCH,"SearsChain":20.11676512155/OpenLayers.METERS_PER_INCH,"ClarkeLink":0.201166194976/OpenLayers.METERS_PER_INCH,"GunterLink":0.2011684023368047/OpenLayers.METERS_PER_INCH,"BenoitLink":0.20116782494375872/OpenLayers.METERS_PER_INCH,"SearsLink":0.2011676512155/OpenLayers.METERS_PER_INCH,"Rod":5.02921005842012/OpenLayers.METERS_PER_INCH,"IntnlChain":20.1168/OpenLayers.METERS_PER_INCH,"IntnlLink":0.201168/OpenLayers.METERS_PER_INCH,"Perch":5.02921005842012/OpenLayers.METERS_PER_INCH,"Pole":5.02921005842012/OpenLayers.METERS_PER_INCH,"Furlong":201.1684023368046/OpenLayers.METERS_PER_INCH,"Rood":3.778266898/OpenLayers.METERS_PER_INCH,"CapeFoot":0.3047972615/OpenLayers.METERS_PER_INCH,"Brealey":375.00000000000000000000/OpenLayers.METERS_PER_INCH,"ModAmFt":0.304812252984505969011938/OpenLayers.METERS_PER_INCH,"Fathom":1.8288/OpenLayers.METERS_PER_INCH,"NautM-UK":1853.184/OpenLayers.METERS_PER_INCH,"50kilometers":50000.0/OpenLayers.METERS_PER_INCH,"150kilometers":150000.0/OpenLayers.METERS_PER_INCH});OpenLayers.Util.extend(OpenLayers.INCHES_PER_UNIT,{"mm":OpenLayers.INCHES_PER_UNIT["Meter"]/1000.0,"cm":OpenLayers.INCHES_PER_UNIT["Meter"]/100.0,"dm":OpenLayers.INCHES_PER_UNIT["Meter"]*100.0,"km":OpenLayers.INCHES_PER_UNIT["Meter"]*1000.0,"kmi":OpenLayers.INCHES_PER_UNIT["nmi"],"fath":OpenLayers.INCHES_PER_UNIT["Fathom"],"ch":OpenLayers.INCHES_PER_UNIT["IntnlChain"],"link":OpenLayers.INCHES_PER_UNIT["IntnlLink"],"us-in":OpenLayers.INCHES_PER_UNIT["inches"],"us-ft":OpenLayers.INCHES_PER_UNIT["Foot"],"us-yd":OpenLayers.INCHES_PER_UNIT["Yard"],"us-ch":OpenLayers.INCHES_PER_UNIT["GunterChain"],"us-mi":OpenLayers.INCHES_PER_UNIT["Mile"],"ind-yd":OpenLayers.INCHES_PER_UNIT["IndianYd37"],"ind-ft":OpenLayers.INCHES_PER_UNIT["IndianFt37"],"ind-ch":20.11669506/OpenLayers.METERS_PER_INCH});OpenLayers.DOTS_PER_INCH=72;OpenLayers.Util.normalizeScale=function(scale){var normScale=(scale>1.0)?(1.0/scale):scale;return normScale;};OpenLayers.Util.getResolutionFromScale=function(scale,units){var resolution;if(scale){if(units==null){units="degrees";}
var normScale=OpenLayers.Util.normalizeScale(scale);resolution=1/(normScale*OpenLayers.INCHES_PER_UNIT[units]*OpenLayers.DOTS_PER_INCH);}
return resolution;};OpenLayers.Util.getScaleFromResolution=function(resolution,units){if(units==null){units="degrees";}
var scale=resolution*OpenLayers.INCHES_PER_UNIT[units]*OpenLayers.DOTS_PER_INCH;return scale;};OpenLayers.Util.pagePosition=function(forElement){var pos=[0,0];var viewportElement=OpenLayers.Util.getViewportElement();if(!forElement||forElement==window||forElement==viewportElement){return pos;}
var BUGGY_GECKO_BOX_OBJECT=OpenLayers.IS_GECKO&&document.getBoxObjectFor&&OpenLayers.Element.getStyle(forElement,'position')=='absolute'&&(forElement.style.top==''||forElement.style.left=='');var parent=null;var box;if(forElement.getBoundingClientRect){box=forElement.getBoundingClientRect();var scrollTop=viewportElement.scrollTop;var scrollLeft=viewportElement.scrollLeft;pos[0]=box.left+scrollLeft;pos[1]=box.top+scrollTop;}else if(document.getBoxObjectFor&&!BUGGY_GECKO_BOX_OBJECT){box=document.getBoxObjectFor(forElement);var vpBox=document.getBoxObjectFor(viewportElement);pos[0]=box.screenX-vpBox.screenX;pos[1]=box.screenY-vpBox.screenY;}else{pos[0]=forElement.offsetLeft;pos[1]=forElement.offsetTop;parent=forElement.offsetParent;if(parent!=forElement){while(parent){pos[0]+=parent.offsetLeft;pos[1]+=parent.offsetTop;parent=parent.offsetParent;}}
var browser=OpenLayers.BROWSER_NAME;if(browser=="opera"||(browser=="safari"&&OpenLayers.Element.getStyle(forElement,'position')=='absolute')){pos[1]-=document.body.offsetTop;}
parent=forElement.offsetParent;while(parent&&parent!=document.body){pos[0]-=parent.scrollLeft;if(browser!="opera"||parent.tagName!='TR'){pos[1]-=parent.scrollTop;}
parent=parent.offsetParent;}}
return pos;};OpenLayers.Util.getViewportElement=function(){var viewportElement=arguments.callee.viewportElement;if(viewportElement==undefined){viewportElement=(OpenLayers.BROWSER_NAME=="msie"&&document.compatMode!='CSS1Compat')?document.body:document.documentElement;arguments.callee.viewportElement=viewportElement;}
return viewportElement;};OpenLayers.Util.isEquivalentUrl=function(url1,url2,options){options=options||{};OpenLayers.Util.applyDefaults(options,{ignoreCase:true,ignorePort80:true,ignoreHash:true});var urlObj1=OpenLayers.Util.createUrlObject(url1,options);var urlObj2=OpenLayers.Util.createUrlObject(url2,options);for(var key in urlObj1){if(key!=="args"){if(urlObj1[key]!=urlObj2[key]){return false;}}}
for(var key in urlObj1.args){if(urlObj1.args[key]!=urlObj2.args[key]){return false;}
delete urlObj2.args[key];}
for(var key in urlObj2.args){return false;}
return true;};OpenLayers.Util.createUrlObject=function(url,options){options=options||{};if(!(/^\w+:\/\//).test(url)){var loc=window.location;var port=loc.port?":"+loc.port:"";var fullUrl=loc.protocol+"//"+loc.host.split(":").shift()+port;if(url.indexOf("/")===0){url=fullUrl+url;}else{var parts=loc.pathname.split("/");parts.pop();url=fullUrl+parts.join("/")+"/"+url;}}
if(options.ignoreCase){url=url.toLowerCase();}
var a=document.createElement('a');a.href=url;var urlObject={};urlObject.host=a.host.split(":").shift();urlObject.protocol=a.protocol;if(options.ignorePort80){urlObject.port=(a.port=="80"||a.port=="0")?"":a.port;}else{urlObject.port=(a.port==""||a.port=="0")?"80":a.port;}
urlObject.hash=(options.ignoreHash||a.hash==="#")?"":a.hash;var queryString=a.search;if(!queryString){var qMark=url.indexOf("?");queryString=(qMark!=-1)?url.substr(qMark):"";}
urlObject.args=OpenLayers.Util.getParameters(queryString);urlObject.pathname=(a.pathname.charAt(0)=="/")?a.pathname:"/"+a.pathname;return urlObject;};OpenLayers.Util.removeTail=function(url){var head=null;var qMark=url.indexOf("?");var hashMark=url.indexOf("#");if(qMark==-1){head=(hashMark!=-1)?url.substr(0,hashMark):url;}else{head=(hashMark!=-1)?url.substr(0,Math.min(qMark,hashMark)):url.substr(0,qMark);}
return head;};OpenLayers.IS_GECKO=(function(){var ua=navigator.userAgent.toLowerCase();return ua.indexOf("webkit")==-1&&ua.indexOf("gecko")!=-1;})();OpenLayers.BROWSER_NAME=(function(){var name="";var ua=navigator.userAgent.toLowerCase();if(ua.indexOf("opera")!=-1){name="opera";}else if(ua.indexOf("msie")!=-1){name="msie";}else if(ua.indexOf("safari")!=-1){name="safari";}else if(ua.indexOf("mozilla")!=-1){if(ua.indexOf("firefox")!=-1){name="firefox";}else{name="mozilla";}}
return name;})();OpenLayers.Util.getBrowserName=function(){return OpenLayers.BROWSER_NAME;};OpenLayers.Util.getRenderedDimensions=function(contentHTML,size,options){var w,h;var container=document.createElement("div");container.style.visibility="hidden";var containerElement=(options&&options.containerElement)?options.containerElement:document.body;if(size){if(size.w){w=size.w;container.style.width=w+"px";}else if(size.h){h=size.h;container.style.height=h+"px";}}
if(options&&options.displayClass){container.className=options.displayClass;}
var content=document.createElement("div");content.innerHTML=contentHTML;content.style.overflow="visible";if(content.childNodes){for(var i=0,l=content.childNodes.length;i<l;i++){if(!content.childNodes[i].style)continue;content.childNodes[i].style.overflow="visible";}}
container.appendChild(content);containerElement.appendChild(container);var parentHasPositionAbsolute=false;var parent=container.parentNode;while(parent&&parent.tagName.toLowerCase()!="body"){var parentPosition=OpenLayers.Element.getStyle(parent,"position");if(parentPosition=="absolute"){parentHasPositionAbsolute=true;break;}else if(parentPosition&&parentPosition!="static"){break;}
parent=parent.parentNode;}
if(!parentHasPositionAbsolute){container.style.position="absolute";}
if(!w){w=parseInt(content.scrollWidth);container.style.width=w+"px";}
if(!h){h=parseInt(content.scrollHeight);}
container.removeChild(content);containerElement.removeChild(container);return new OpenLayers.Size(w,h);};OpenLayers.Util.getScrollbarWidth=function(){var scrollbarWidth=OpenLayers.Util._scrollbarWidth;if(scrollbarWidth==null){var scr=null;var inn=null;var wNoScroll=0;var wScroll=0;scr=document.createElement('div');scr.style.position='absolute';scr.style.top='-1000px';scr.style.left='-1000px';scr.style.width='100px';scr.style.height='50px';scr.style.overflow='hidden';inn=document.createElement('div');inn.style.width='100%';inn.style.height='200px';scr.appendChild(inn);document.body.appendChild(scr);wNoScroll=inn.offsetWidth;scr.style.overflow='scroll';wScroll=inn.offsetWidth;document.body.removeChild(document.body.lastChild);OpenLayers.Util._scrollbarWidth=(wNoScroll-wScroll);scrollbarWidth=OpenLayers.Util._scrollbarWidth;}
return scrollbarWidth;};OpenLayers.Util.getFormattedLonLat=function(coordinate,axis,dmsOption){if(!dmsOption){dmsOption='dms';}
coordinate=(coordinate+540)%360-180;var abscoordinate=Math.abs(coordinate);var coordinatedegrees=Math.floor(abscoordinate);var coordinateminutes=(abscoordinate-coordinatedegrees)/(1/60);var tempcoordinateminutes=coordinateminutes;coordinateminutes=Math.floor(coordinateminutes);var coordinateseconds=(tempcoordinateminutes-coordinateminutes)/(1/60);coordinateseconds=Math.round(coordinateseconds*10);coordinateseconds/=10;if(coordinateseconds>=60){coordinateseconds-=60;coordinateminutes+=1;if(coordinateminutes>=60){coordinateminutes-=60;coordinatedegrees+=1;}}
if(coordinatedegrees<10){coordinatedegrees="0"+coordinatedegrees;}
var str=coordinatedegrees+"\u00B0";if(dmsOption.indexOf('dm')>=0){if(coordinateminutes<10){coordinateminutes="0"+coordinateminutes;}
str+=coordinateminutes+"'";if(dmsOption.indexOf('dms')>=0){if(coordinateseconds<10){coordinateseconds="0"+coordinateseconds;}
str+=coordinateseconds+'"';}}
if(axis=="lon"){str+=coordinate<0?OpenLayers.i18n("W"):OpenLayers.i18n("E");}else{str+=coordinate<0?OpenLayers.i18n("S"):OpenLayers.i18n("N");}
return str;};OpenLayers.Lang={code:null,defaultCode:"en",getCode:function(){if(!OpenLayers.Lang.code){OpenLayers.Lang.setCode();}
return OpenLayers.Lang.code;},setCode:function(code){var lang;if(!code){code=(OpenLayers.BROWSER_NAME=="msie")?navigator.userLanguage:navigator.language;}
var parts=code.split('-');parts[0]=parts[0].toLowerCase();if(typeof OpenLayers.Lang[parts[0]]=="object"){lang=parts[0];}
if(parts[1]){var testLang=parts[0]+'-'+parts[1].toUpperCase();if(typeof OpenLayers.Lang[testLang]=="object"){lang=testLang;}}
if(!lang){OpenLayers.Console.warn('Failed to find OpenLayers.Lang.'+parts.join("-")+' dictionary, falling back to default language');lang=OpenLayers.Lang.defaultCode;}
OpenLayers.Lang.code=lang;},translate:function(key,context){var dictionary=OpenLayers.Lang[OpenLayers.Lang.getCode()];var message=dictionary&&dictionary[key];if(!message){message=key;}
if(context){message=OpenLayers.String.format(message,context);}
return message;}};OpenLayers.i18n=OpenLayers.Lang.translate;OpenLayers.Lang.en={'unhandledRequest':"Unhandled request return ${statusText}",'Permalink':"Permalink",'Overlays':"Overlays",'Base Layer':"Base Layer",'noFID':"Can't update a feature for which there is no FID.",'browserNotSupported':"Your browser does not support vector rendering. Currently supported renderers are:\n${renderers}",'minZoomLevelError':"The minZoomLevel property is only intended for use "+"with the FixedZoomLevels-descendent layers. That this "+"wfs layer checks for minZoomLevel is a relic of the"+"past. We cannot, however, remove it without possibly "+"breaking OL based applications that may depend on it."+" Therefore we are deprecating it -- the minZoomLevel "+"check below will be removed at 3.0. Please instead "+"use min/max resolution setting as described here: "+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"WFS Transaction: SUCCESS ${response}",'commitFailed':"WFS Transaction: FAILED ${response}",'googleWarning':"The Google Layer was unable to load correctly.<br><br>"+"To get rid of this message, select a new BaseLayer "+"in the layer switcher in the upper-right corner.<br><br>"+"Most likely, this is because the Google Maps library "+"script was either not included, or does not contain the "+"correct API key for your site.<br><br>"+"Developers: For help getting this working correctly, "+"<a href='http://trac.openlayers.org/wiki/Google' "+"target='_blank'>click here</a>",'getLayerWarning':"The ${layerType} Layer was unable to load correctly.<br><br>"+"To get rid of this message, select a new BaseLayer "+"in the layer switcher in the upper-right corner.<br><br>"+"Most likely, this is because the ${layerLib} library "+"script was not correctly included.<br><br>"+"Developers: For help getting this working correctly, "+"<a href='http://trac.openlayers.org/wiki/${layerLib}' "+"target='_blank'>click here</a>",'Scale = 1 : ${scaleDenom}':"Scale = 1 : ${scaleDenom}",'W':'W','E':'E','N':'N','S':'S','Graticule':'Graticule','reprojectDeprecated':"You are using the 'reproject' option "+"on the ${layerName} layer. This option is deprecated: "+"its use was designed to support displaying data over commercial "+"basemaps, but that functionality should now be achieved by using "+"Spherical Mercator support. More information is available from "+"http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"This method has been deprecated and will be removed in 3.0. "+"Please use ${newMethod} instead.",'proxyNeeded':"You probably need to set OpenLayers.ProxyHost to access ${url}."+"See http://trac.osgeo.org/openlayers/wiki/FrequentlyAskedQuestions#ProxyHost",'end':''};OpenLayers.Lang["fr"]=OpenLayers.Util.applyDefaults({'unhandledRequest':"RequÃªte non gÃ©rÃ©e, retournant ${statusText}",'Permalink':"Permalien",'Overlays':"Calques",'Base Layer':"Calque de base",'noFID':"Impossible de mettre Ã  jour un objet sans identifiant (fid).",'browserNotSupported':"Votre navigateur ne supporte pas le rendu vectoriel. Les renderers actuellement supportÃ©s sont : \n${renderers}",'minZoomLevelError':"La propriÃ©tÃ© minZoomLevel doit seulement Ãªtre utilisÃ©e pour des couches FixedZoomLevels-descendent. Le fait que cette couche WFS vÃ©rifie la prÃ©sence de minZoomLevel est une relique du passÃ©. Nous ne pouvons toutefois la supprimer sans casser des applications qui pourraient en dÃ©pendre. C\'est pourquoi nous la dÃ©prÃ©cions -- la vÃ©rification du minZoomLevel sera supprimÃ©e en version 3.0. A la place, merci d\'utiliser les paramÃ¨tres de rÃ©solutions min/max tel que dÃ©crit sur : http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"Transaction WFS : SUCCES ${response}",'commitFailed':"Transaction WFS : ECHEC ${response}",'googleWarning':"La couche Google n\'a pas Ã©tÃ© en mesure de se charger correctement.\x3cbr\x3e\x3cbr\x3ePour supprimer ce message, choisissez une nouvelle BaseLayer dans le sÃ©lecteur de couche en haut Ã  droite.\x3cbr\x3e\x3cbr\x3eCela est possiblement causÃ© par la non-inclusion de la librairie Google Maps, ou alors parce que la clÃ© de l\'API ne correspond pas Ã  votre site.\x3cbr\x3e\x3cbr\x3eDÃ©veloppeurs : pour savoir comment corriger ceci, \x3ca href=\'http://trac.openlayers.org/wiki/Google\' target=\'_blank\'\x3ecliquez ici\x3c/a\x3e",'getLayerWarning':"La couche ${layerType} n\'est pas en mesure de se charger correctement.\x3cbr\x3e\x3cbr\x3ePour supprimer ce message, choisissez une nouvelle BaseLayer dans le sÃ©lecteur de couche en haut Ã  droite.\x3cbr\x3e\x3cbr\x3eCela est possiblement causÃ© par la non-inclusion de la librairie ${layerLib}.\x3cbr\x3e\x3cbr\x3eDÃ©veloppeurs : pour savoir comment corriger ceci, \x3ca href=\'http://trac.openlayers.org/wiki/${layerLib}\' target=\'_blank\'\x3ecliquez ici\x3c/a\x3e",'Scale = 1 : ${scaleDenom}':"Echelle ~ 1 : ${scaleDenom}",'W':"O",'E':"E",'N':"N",'S':"S",'reprojectDeprecated':"Vous utilisez l\'option \'reproject\' sur la couche ${layerName}. Cette option est dÃ©prÃ©ciÃ©e : Son usage permettait d\'afficher des donnÃ©es au dessus de couches raster commerciales.Cette fonctionalitÃ© est maintenant supportÃ©e en utilisant le support de la projection Mercator SphÃ©rique. Plus d\'information est disponible sur http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Cette mÃ©thode est dÃ©prÃ©ciÃ©e, et sera supprimÃ©e Ã  la version 3.0. Merci d\'utiliser ${newMethod} Ã  la place.",'proxyNeeded':"Vous avez trÃ¨s probablement besoin de renseigner OpenLayers.ProxyHost pour accÃ©der Ã  ${url}. Voir http://trac.osgeo.org/openlayers/wiki/FrequentlyAskedQuestions#ProxyHost"});OpenLayers.Lang["de"]=OpenLayers.Util.applyDefaults({'unhandledRequest':"Unbehandelte AnfragerÃ¼ckmeldung ${statusText}",'Permalink':"Permalink",'Overlays':"Overlays",'Base Layer':"Grundkarte",'noFID':"Ein Feature, fÃ¼r das keine FID existiert, kann nicht aktualisiert werden.",'browserNotSupported':"Ihr Browser unterstÃ¼tzt keine Vektordarstellung. Aktuell unterstÃ¼tzte Renderer:\n${renderers}",'minZoomLevelError':"Die \x3ccode\x3eminZoomLevel\x3c/code\x3e-Eigenschaft ist nur fÃ¼r die Verwendung mit \x3ccode\x3eFixedZoomLevels\x3c/code\x3e-untergeordneten Layers vorgesehen. Das dieser \x3ctt\x3ewfs\x3c/tt\x3e-Layer die \x3ccode\x3eminZoomLevel\x3c/code\x3e-Eigenschaft Ã¼berprÃ¼ft ist ein Relikt der Vergangenheit. Wir kÃ¶nnen diese ÃœberprÃ¼fung nicht entfernen, ohne das OL basierende Applikationen nicht mehr funktionieren. Daher markieren wir es als veraltet - die \x3ccode\x3eminZoomLevel\x3c/code\x3e-ÃœberprÃ¼fung wird in Version 3.0 entfernt werden. Bitte verwenden Sie stattdessen die Min-/Max-LÃ¶sung, wie sie unter http://trac.openlayers.org/wiki/SettingZoomLevels beschrieben ist.",'commitSuccess':"WFS-Transaktion: Erfolgreich ${response}",'commitFailed':"WFS-Transaktion: Fehlgeschlagen ${response}",'googleWarning':"Der Google-Layer konnte nicht korrekt geladen werden.\x3cbr\x3e\x3cbr\x3eUm diese Meldung nicht mehr zu erhalten, wÃ¤hlen Sie einen anderen Hintergrundlayer aus dem LayerSwitcher in der rechten oberen Ecke.\x3cbr\x3e\x3cbr\x3eSehr wahrscheinlich tritt dieser Fehler auf, weil das Skript der Google-Maps-Bibliothek nicht eingebunden wurde oder keinen gÃ¼ltigen API-SchlÃ¼ssel fÃ¼r Ihre URL enthÃ¤lt.\x3cbr\x3e\x3cbr\x3eEntwickler: Besuche \x3ca href=\'http://trac.openlayers.org/wiki/Google\' target=\'_blank\'\x3edas Wiki\x3c/a\x3e fÃ¼r Hilfe zum korrekten Einbinden des Google-Layers",'getLayerWarning':"Der ${layerType}-Layer konnte nicht korrekt geladen werden.\x3cbr\x3e\x3cbr\x3eUm diese Meldung nicht mehr zu erhalten, wÃ¤hlen Sie einen anderen Hintergrundlayer aus dem LayerSwitcher in der rechten oberen Ecke.\x3cbr\x3e\x3cbr\x3eSehr wahrscheinlich tritt dieser Fehler auf, weil das Skript der \'${layerLib}\'-Bibliothek nicht eingebunden wurde.\x3cbr\x3e\x3cbr\x3eEntwickler: Besuche \x3ca href=\'http://trac.openlayers.org/wiki/${layerLib}\' target=\'_blank\'\x3edas Wiki\x3c/a\x3e fÃ¼r Hilfe zum korrekten Einbinden von Layern",'Scale = 1 : ${scaleDenom}':"MaÃŸstab = 1 : ${scaleDenom}",'W':"W",'E':"O",'N':"N",'S':"S",'reprojectDeprecated':"Sie verwenden die â€žReprojectâ€œ-Option des Layers ${layerName}. Diese Option ist veraltet: Sie wurde entwickelt um die Anzeige von Daten auf kommerziellen Basiskarten zu unterstÃ¼tzen, aber diese Funktion sollte jetzt durch UnterstÃ¼tzung der â€žSpherical Mercatorâ€œ erreicht werden. Weitere Informationen sind unter http://trac.openlayers.org/wiki/SphericalMercator verfÃ¼gbar.",'methodDeprecated':"Die Methode ist veraltet und wird in 3.0 entfernt. Bitte verwende stattdessen ${newMethod}."});OpenLayers.Console={log:function(){},debug:function(){},info:function(){},warn:function(){},error:function(){},userError:function(error){alert(error);},assert:function(){},dir:function(){},dirxml:function(){},trace:function(){},group:function(){},groupEnd:function(){},time:function(){},timeEnd:function(){},profile:function(){},profileEnd:function(){},count:function(){},CLASS_NAME:"OpenLayers.Console"};(function(){var scripts=document.getElementsByTagName("script");for(var i=0,len=scripts.length;i<len;++i){if(scripts[i].src.indexOf("firebug.js")!=-1){if(console){OpenLayers.Util.extend(OpenLayers.Console,console);break;}}}})();OpenLayers.Pixel=OpenLayers.Class({x:0.0,y:0.0,initialize:function(x,y){this.x=parseFloat(x);this.y=parseFloat(y);},toString:function(){return("x="+this.x+",y="+this.y);},clone:function(){return new OpenLayers.Pixel(this.x,this.y);},equals:function(px){var equals=false;if(px!=null){equals=((this.x==px.x&&this.y==px.y)||(isNaN(this.x)&&isNaN(this.y)&&isNaN(px.x)&&isNaN(px.y)));}
return equals;},distanceTo:function(px){return Math.sqrt(Math.pow(this.x-px.x,2)+
Math.pow(this.y-px.y,2));},add:function(x,y){if((x==null)||(y==null)){throw new TypeError('Pixel.add cannot receive null values');}
return new OpenLayers.Pixel(this.x+x,this.y+y);},offset:function(px){var newPx=this.clone();if(px){newPx=this.add(px.x,px.y);}
return newPx;},CLASS_NAME:"OpenLayers.Pixel"});OpenLayers.Bounds=OpenLayers.Class({left:null,bottom:null,right:null,top:null,centerLonLat:null,initialize:function(left,bottom,right,top){if(OpenLayers.Util.isArray(left)){top=left[3];right=left[2];bottom=left[1];left=left[0];}
if(left!=null){this.left=OpenLayers.Util.toFloat(left);}
if(bottom!=null){this.bottom=OpenLayers.Util.toFloat(bottom);}
if(right!=null){this.right=OpenLayers.Util.toFloat(right);}
if(top!=null){this.top=OpenLayers.Util.toFloat(top);}},clone:function(){return new OpenLayers.Bounds(this.left,this.bottom,this.right,this.top);},equals:function(bounds){var equals=false;if(bounds!=null){equals=((this.left==bounds.left)&&(this.right==bounds.right)&&(this.top==bounds.top)&&(this.bottom==bounds.bottom));}
return equals;},toString:function(){return[this.left,this.bottom,this.right,this.top].join(",");},toArray:function(reverseAxisOrder){if(reverseAxisOrder===true){return[this.bottom,this.left,this.top,this.right];}else{return[this.left,this.bottom,this.right,this.top];}},toBBOX:function(decimal,reverseAxisOrder){if(decimal==null){decimal=6;}
var mult=Math.pow(10,decimal);var xmin=Math.round(this.left*mult)/mult;var ymin=Math.round(this.bottom*mult)/mult;var xmax=Math.round(this.right*mult)/mult;var ymax=Math.round(this.top*mult)/mult;if(reverseAxisOrder===true){return ymin+","+xmin+","+ymax+","+xmax;}else{return xmin+","+ymin+","+xmax+","+ymax;}},toGeometry:function(){return new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(this.left,this.bottom),new OpenLayers.Geometry.Point(this.right,this.bottom),new OpenLayers.Geometry.Point(this.right,this.top),new OpenLayers.Geometry.Point(this.left,this.top)])]);},getWidth:function(){return(this.right-this.left);},getHeight:function(){return(this.top-this.bottom);},getSize:function(){return new OpenLayers.Size(this.getWidth(),this.getHeight());},getCenterPixel:function(){return new OpenLayers.Pixel((this.left+this.right)/2,(this.bottom+this.top)/2);},getCenterLonLat:function(){if(!this.centerLonLat){this.centerLonLat=new OpenLayers.LonLat((this.left+this.right)/2,(this.bottom+this.top)/2);}
return this.centerLonLat;},scale:function(ratio,origin){if(origin==null){origin=this.getCenterLonLat();}
var origx,origy;if(origin.CLASS_NAME=="OpenLayers.LonLat"){origx=origin.lon;origy=origin.lat;}else{origx=origin.x;origy=origin.y;}
var left=(this.left-origx)*ratio+origx;var bottom=(this.bottom-origy)*ratio+origy;var right=(this.right-origx)*ratio+origx;var top=(this.top-origy)*ratio+origy;return new OpenLayers.Bounds(left,bottom,right,top);},add:function(x,y){if((x==null)||(y==null)){throw new TypeError('Bounds.add cannot receive null values');}
return new OpenLayers.Bounds(this.left+x,this.bottom+y,this.right+x,this.top+y);},extend:function(object){var bounds=null;if(object){switch(object.CLASS_NAME){case"OpenLayers.LonLat":bounds=new OpenLayers.Bounds(object.lon,object.lat,object.lon,object.lat);break;case"OpenLayers.Geometry.Point":bounds=new OpenLayers.Bounds(object.x,object.y,object.x,object.y);break;case"OpenLayers.Bounds":bounds=object;break;}
if(bounds){this.centerLonLat=null;if((this.left==null)||(bounds.left<this.left)){this.left=bounds.left;}
if((this.bottom==null)||(bounds.bottom<this.bottom)){this.bottom=bounds.bottom;}
if((this.right==null)||(bounds.right>this.right)){this.right=bounds.right;}
if((this.top==null)||(bounds.top>this.top)){this.top=bounds.top;}}}},containsLonLat:function(ll,options){if(typeof options==="boolean"){options={inclusive:options};}
options=options||{};var contains=this.contains(ll.lon,ll.lat,options.inclusive),worldBounds=options.worldBounds;if(worldBounds&&!contains){var worldWidth=worldBounds.getWidth();var worldCenterX=(worldBounds.left+worldBounds.right)/2;var worldsAway=Math.round((ll.lon-worldCenterX)/worldWidth);contains=this.containsLonLat({lon:ll.lon-worldsAway*worldWidth,lat:ll.lat},{inclusive:options.inclusive});}
return contains;},containsPixel:function(px,inclusive){return this.contains(px.x,px.y,inclusive);},contains:function(x,y,inclusive){if(inclusive==null){inclusive=true;}
if(x==null||y==null){return false;}
x=OpenLayers.Util.toFloat(x);y=OpenLayers.Util.toFloat(y);var contains=false;if(inclusive){contains=((x>=this.left)&&(x<=this.right)&&(y>=this.bottom)&&(y<=this.top));}else{contains=((x>this.left)&&(x<this.right)&&(y>this.bottom)&&(y<this.top));}
return contains;},intersectsBounds:function(bounds,options){if(typeof options==="boolean"){options={inclusive:options};}
options=options||{};if(options.worldBounds){var self=this.wrapDateLine(options.worldBounds);bounds=bounds.wrapDateLine(options.worldBounds);}else{self=this;}
if(options.inclusive==null){options.inclusive=true;}
var intersects=false;var mightTouch=(self.left==bounds.right||self.right==bounds.left||self.top==bounds.bottom||self.bottom==bounds.top);if(options.inclusive||!mightTouch){var inBottom=(((bounds.bottom>=self.bottom)&&(bounds.bottom<=self.top))||((self.bottom>=bounds.bottom)&&(self.bottom<=bounds.top)));var inTop=(((bounds.top>=self.bottom)&&(bounds.top<=self.top))||((self.top>bounds.bottom)&&(self.top<bounds.top)));var inLeft=(((bounds.left>=self.left)&&(bounds.left<=self.right))||((self.left>=bounds.left)&&(self.left<=bounds.right)));var inRight=(((bounds.right>=self.left)&&(bounds.right<=self.right))||((self.right>=bounds.left)&&(self.right<=bounds.right)));intersects=((inBottom||inTop)&&(inLeft||inRight));}
if(options.worldBounds&&!intersects){var world=options.worldBounds;var width=world.getWidth();var selfCrosses=!world.containsBounds(self);var boundsCrosses=!world.containsBounds(bounds);if(selfCrosses&&!boundsCrosses){bounds=bounds.add(-width,0);intersects=self.intersectsBounds(bounds,{inclusive:options.inclusive});}else if(boundsCrosses&&!selfCrosses){self=self.add(-width,0);intersects=bounds.intersectsBounds(self,{inclusive:options.inclusive});}}
return intersects;},containsBounds:function(bounds,partial,inclusive){if(partial==null){partial=false;}
if(inclusive==null){inclusive=true;}
var bottomLeft=this.contains(bounds.left,bounds.bottom,inclusive);var bottomRight=this.contains(bounds.right,bounds.bottom,inclusive);var topLeft=this.contains(bounds.left,bounds.top,inclusive);var topRight=this.contains(bounds.right,bounds.top,inclusive);return(partial)?(bottomLeft||bottomRight||topLeft||topRight):(bottomLeft&&bottomRight&&topLeft&&topRight);},determineQuadrant:function(lonlat){var quadrant="";var center=this.getCenterLonLat();quadrant+=(lonlat.lat<center.lat)?"b":"t";quadrant+=(lonlat.lon<center.lon)?"l":"r";return quadrant;},transform:function(source,dest){this.centerLonLat=null;var ll=OpenLayers.Projection.transform({'x':this.left,'y':this.bottom},source,dest);var lr=OpenLayers.Projection.transform({'x':this.right,'y':this.bottom},source,dest);var ul=OpenLayers.Projection.transform({'x':this.left,'y':this.top},source,dest);var ur=OpenLayers.Projection.transform({'x':this.right,'y':this.top},source,dest);this.left=Math.min(ll.x,ul.x);this.bottom=Math.min(ll.y,lr.y);this.right=Math.max(lr.x,ur.x);this.top=Math.max(ul.y,ur.y);return this;},wrapDateLine:function(maxExtent,options){options=options||{};var leftTolerance=options.leftTolerance||0;var rightTolerance=options.rightTolerance||0;var newBounds=this.clone();if(maxExtent){var width=maxExtent.getWidth();while(newBounds.left<maxExtent.left&&newBounds.right-rightTolerance<=maxExtent.left){newBounds=newBounds.add(width,0);}
while(newBounds.left+leftTolerance>=maxExtent.right&&newBounds.right>maxExtent.right){newBounds=newBounds.add(-width,0);}
var newLeft=newBounds.left+leftTolerance;if(newLeft<maxExtent.right&&newLeft>maxExtent.left&&newBounds.right-rightTolerance>maxExtent.right){newBounds=newBounds.add(-width,0);}}
return newBounds;},CLASS_NAME:"OpenLayers.Bounds"});OpenLayers.Bounds.fromString=function(str,reverseAxisOrder){var bounds=str.split(",");return OpenLayers.Bounds.fromArray(bounds,reverseAxisOrder);};OpenLayers.Bounds.fromArray=function(bbox,reverseAxisOrder){return reverseAxisOrder===true?new OpenLayers.Bounds(bbox[1],bbox[0],bbox[3],bbox[2]):new OpenLayers.Bounds(bbox[0],bbox[1],bbox[2],bbox[3]);};OpenLayers.Bounds.fromSize=function(size){return new OpenLayers.Bounds(0,size.h,size.w,0);};OpenLayers.Bounds.oppositeQuadrant=function(quadrant){var opp="";opp+=(quadrant.charAt(0)=='t')?'b':'t';opp+=(quadrant.charAt(1)=='l')?'r':'l';return opp;};OpenLayers.LonLat=OpenLayers.Class({lon:0.0,lat:0.0,initialize:function(lon,lat){if(OpenLayers.Util.isArray(lon)){lat=lon[1];lon=lon[0];}
this.lon=OpenLayers.Util.toFloat(lon);this.lat=OpenLayers.Util.toFloat(lat);},toString:function(){return("lon="+this.lon+",lat="+this.lat);},toShortString:function(){return(this.lon+", "+this.lat);},clone:function(){return new OpenLayers.LonLat(this.lon,this.lat);},add:function(lon,lat){if((lon==null)||(lat==null)){throw new TypeError('LonLat.add cannot receive null values');}
return new OpenLayers.LonLat(this.lon+OpenLayers.Util.toFloat(lon),this.lat+OpenLayers.Util.toFloat(lat));},equals:function(ll){var equals=false;if(ll!=null){equals=((this.lon==ll.lon&&this.lat==ll.lat)||(isNaN(this.lon)&&isNaN(this.lat)&&isNaN(ll.lon)&&isNaN(ll.lat)));}
return equals;},transform:function(source,dest){var point=OpenLayers.Projection.transform({'x':this.lon,'y':this.lat},source,dest);this.lon=point.x;this.lat=point.y;return this;},wrapDateLine:function(maxExtent){var newLonLat=this.clone();if(maxExtent){while(newLonLat.lon<maxExtent.left){newLonLat.lon+=maxExtent.getWidth();}
while(newLonLat.lon>maxExtent.right){newLonLat.lon-=maxExtent.getWidth();}}
return newLonLat;},CLASS_NAME:"OpenLayers.LonLat"});OpenLayers.LonLat.fromString=function(str){var pair=str.split(",");return new OpenLayers.LonLat(pair[0],pair[1]);};OpenLayers.LonLat.fromArray=function(arr){var gotArr=OpenLayers.Util.isArray(arr),lon=gotArr&&arr[0],lat=gotArr&&arr[1];return new OpenLayers.LonLat(lon,lat);};OpenLayers.Element={visible:function(element){return OpenLayers.Util.getElement(element).style.display!='none';},toggle:function(){for(var i=0,len=arguments.length;i<len;i++){var element=OpenLayers.Util.getElement(arguments[i]);var display=OpenLayers.Element.visible(element)?'none':'';element.style.display=display;}},remove:function(element){element=OpenLayers.Util.getElement(element);element.parentNode.removeChild(element);},getHeight:function(element){element=OpenLayers.Util.getElement(element);return element.offsetHeight;},hasClass:function(element,name){var names=element.className;return(!!names&&new RegExp("(^|\\s)"+name+"(\\s|$)").test(names));},addClass:function(element,name){if(!OpenLayers.Element.hasClass(element,name)){element.className+=(element.className?" ":"")+name;}
return element;},removeClass:function(element,name){var names=element.className;if(names){element.className=OpenLayers.String.trim(names.replace(new RegExp("(^|\\s+)"+name+"(\\s+|$)")," "));}
return element;},toggleClass:function(element,name){if(OpenLayers.Element.hasClass(element,name)){OpenLayers.Element.removeClass(element,name);}else{OpenLayers.Element.addClass(element,name);}
return element;},getStyle:function(element,style){element=OpenLayers.Util.getElement(element);var value=null;if(element&&element.style){value=element.style[OpenLayers.String.camelize(style)];if(!value){if(document.defaultView&&document.defaultView.getComputedStyle){var css=document.defaultView.getComputedStyle(element,null);value=css?css.getPropertyValue(style):null;}else if(element.currentStyle){value=element.currentStyle[OpenLayers.String.camelize(style)];}}
var positions=['left','top','right','bottom'];if(window.opera&&(OpenLayers.Util.indexOf(positions,style)!=-1)&&(OpenLayers.Element.getStyle(element,'position')=='static')){value='auto';}}
return value=='auto'?null:value;}};OpenLayers.Size=OpenLayers.Class({w:0.0,h:0.0,initialize:function(w,h){this.w=parseFloat(w);this.h=parseFloat(h);},toString:function(){return("w="+this.w+",h="+this.h);},clone:function(){return new OpenLayers.Size(this.w,this.h);},equals:function(sz){var equals=false;if(sz!=null){equals=((this.w==sz.w&&this.h==sz.h)||(isNaN(this.w)&&isNaN(this.h)&&isNaN(sz.w)&&isNaN(sz.h)));}
return equals;},CLASS_NAME:"OpenLayers.Size"});(function(){window.mapfish={singleFile:true};var foolOpenLayers=true;var scripts=document.getElementsByTagName('script');for(var i=0;i<scripts.length;i++){var src=scripts[i].getAttribute('src');if(src&&src.lastIndexOf("OpenLayers.js")>-1){foolOpenLayers=false;break;}}
if(foolOpenLayers){window.OpenLayers._getScriptLocation=function(){return mapfish._getScriptLocation()+"../openlayers/";};}})();(function(){var singleFile=(typeof window.mapfish=="object"&&window.mapfish.singleFile);window.mapfish={_scriptName:"MapFish.js",_getScriptLocation:function(){if(window.gMfLocation){return window.gMfLocation;}
var scriptLocation="";var scriptName=mapfish._scriptName;var scripts=document.getElementsByTagName('script');for(var i=0;i<scripts.length;i++){var src=scripts[i].getAttribute('src');if(src){var index=src.lastIndexOf(scriptName);if((index>-1)&&(index+scriptName.length==src.length)){scriptLocation=src.slice(0,-scriptName.length);break;}}}
return scriptLocation;}};if(!singleFile){var jsfiles=new Array("lang/en.js","core/Color.js","core/GeoStat.js","core/GeoStat/Choropleth.js","core/GeoStat/ProportionalSymbol.js","core/Routing.js","core/Util.js","core/Searcher.js","core/Searcher/Map.js","core/Searcher/Form.js","core/PrintProtocol.js","core/Offline.js","core/Protocol.js","core/Protocol/MapFish.js","core/Protocol/MergeFilterDecorator.js","core/Protocol/TriggerEventDecorator.js","core/Strategy.js","core/Strategy/ProtocolListener.js","widgets/MapComponent.js","widgets/Shortcuts.js","widgets/ComboBoxFactory.js","widgets/recenter/Base.js","widgets/recenter/Coords.js","widgets/recenter/DataField.js","widgets/data/FeatureReader.js","widgets/data/FeatureStore.js","widgets/data/FeatureStoreMediator.js","widgets/data/SearchStoreMediator.js","widgets/data/LayerStoreMediator.js","widgets/data/GridRowFeatureMediator.js","widgets/geostat/Choropleth.js","widgets/geostat/ProportionalSymbol.js","widgets/tree/LayerTree.js","widgets/tree/LayerTreeExtra.js","widgets/toolbar/Toolbar.js","widgets/toolbar/CheckItem.js","widgets/toolbar/MenuItem.js","widgets/editing/FeatureList.js","widgets/editing/FeatureProperties.js","widgets/editing/FeatureEditingPanel.js","widgets/print/Base.js","widgets/print/BaseWidget.js","widgets/print/SimpleForm.js","widgets/print/MultiPage.js","widgets/print/PrintAction.js","widgets/search/Form.js");var allScriptTags="";var host=mapfish._getScriptLocation();for(var i=0;i<jsfiles.length;i++){if(/MSIE/.test(navigator.userAgent)||/Safari/.test(navigator.userAgent)){var currentScriptTag="<script src='"+host+jsfiles[i]+"'></script>";allScriptTags+=currentScriptTag;}else{var s=document.createElement("script");s.src=host+jsfiles[i];var h=document.getElementsByTagName("head").length?document.getElementsByTagName("head")[0]:document.body;h.appendChild(s);}}
if(allScriptTags){document.write(allScriptTags);}}})();OpenLayers.Util.extend(OpenLayers.Lang.en,{'mf.tools':'Tools','mf.layertree':'Layer tree','mf.layertree.opacity':'Opacity','mf.layertree.remove':'Remove','mf.layertree.zoomToExtent':'Zoom to extent','mf.print.mapTitle':'Title','mf.print.comment':'Comments','mf.print.loadingConfig':'Loading the configuration...','mf.print.serverDown':'The print service is not working','mf.print.unableToPrint':"Unable to print",'mf.print.generatingPDF':"Generating PDF...",'mf.print.dpi':'DPI','mf.print.scale':'Scale','mf.print.rotation':'Rotation','mf.print.print':'Print','mf.print.resetPos':'Reset Pos.','mf.print.layout':'Layout','mf.print.addPage':'Add page','mf.print.remove':'Remove page','mf.print.clearAll':'Clear all','mf.print.pdfReady':'Your PDF document is ready.','mf.print.noPage':'No page selected, click on the "Add page" button to add one.','mf.print.print-tooltip':'Generate a PDF with at least the extent shown on the map','mf.error':'Error','mf.warning':'Warning','mf.information':'Information','mf.cancel':'Cancel','mf.recenter.x':'X','mf.recenter.y':'Y','mf.recenter.submit':'Recenter','mf.recenter.missingCoords':'Some coordinates are missing.','mf.recenter.outOfRangeCoords':'Submitted coordinates (${myX}, ${myY}) are not in the map area<br />'+'and must be within following ranges:<br/>'+'${coordX} between ${minCoordX} and ${maxCoordX},<br />'+'${coordY} between ${minCoordY} and ${maxCoordY}','mf.recenter.emptyText':'Text to search','mf.recenter.ws.error':'An error occured when accessing the distant webservice:','mf.recenter.ws.service':'Selected service','mf.control.previous':'Previous view','mf.control.next':'Next view','mf.control.pan':'Pan','mf.control.zoomIn':'Zoom in','mf.control.zoomOut':'Zoom out','mf.control.zoomAll':'Zoom all','mf.editing.comboNoneName':'None','mf.editing.import':'Import','mf.editing.importTooltip':'Import data','mf.editing.commit':'Commit','mf.editing.commitTooltip':'Commit data','mf.editing.delete':'Delete','mf.editing.deleteTooltip':'Delete selected feature','mf.editing.comboLabel':'Layer to edit','mf.editing.confirmMessageTitle':'Edited features','mf.editing.confirmMessage':'There are uncommitted features, are you sure '+'you want to switch layer?','mf.editing.selectModifyFeature':'Modify features','mf.editing.drawPointTitle':'Draw points','mf.editing.drawLineTitle':'Draw lines','mf.editing.drawPolygonTitle':'Draw polygons','mf.editing.formTitle':'Attributes','mf.editing.gridIdHeader':'Id','mf.editing.gridStateHeader':'State','mf.editing.gridTitle':'Edited features','mf.editing.onContextClickMessage':'Edit this feature','mf.editing.onBeforeUnloadMessage':'The feature editing panel has '+'uncommitted features'});OpenLayers.Util.extend(OpenLayers.Lang.fr,{'scale':"Echelle = 1 : ${scaleDenom}",'mf.tools':'Outils','mf.layertree':'Arbre des couches','mf.layertree.opacity':'OpacitÃ©','mf.layertree.remove':'Supprimer','mf.layertree.zoomToExtent':'Zoom sur l\'emprise','mf.print.mapTitle':'Titre','mf.print.comment':'Commentaires','mf.print.unableToPrint':"Impossible d'imprimer",'mf.print.generatingPDF':"GÃ©nÃ©ration du PDF...",'mf.print.dpi':'RÃ©solution','mf.print.scale':'Ã‰chelle','mf.print.rotation':'Rotation','mf.print.print':'Imprimer','mf.print.resetPos':'RÃ©init. pos.','mf.print.layout':'Format','mf.print.addPage':'Ajouter page','mf.print.remove':'Enlever page','mf.print.clearAll':'Supprimer toutes','mf.print.pdfReady':'Votre document PDF est prÃªt.','mf.print.noPage':'Pas de page sÃ©lectionnÃ©e, appuyez sur le bouton "Ajouter page" pour en crÃ©er une.','mf.print.print-tooltip':'GÃ©nÃ©rer un PDF contenant au moins l\'Ã©tendue de la carte','mf.print.serverDown':"Le service d'impression ne fonctionne pas",'mf.error':'Erreur','mf.warning':'Attention','mf.information':'Information','mf.cancel':'Annuler','mf.recenter.x':'X','mf.recenter.y':'Y','mf.recenter.submit':'Recentrer','mf.recenter.missingCoords':'Les coordonnÃ©es sont incomplÃ¨tes.','mf.recenter.outOfRangeCoords':'Les coordonnÃ©es fournies (${myX}, ${myY}) sont en dehors de la carte.<br />'+'Elles doivent Ãªtre comprises dans les limites suivantes :<br/>'+'${coordX} entre ${minCoordX} et ${maxCoordX},<br />'+'${coordY} entre ${minCoordY} et ${maxCoordY}','mf.recenter.emptyText':'Texte Ã  rechercher','mf.recenter.ws.error':'Une erreur est survenue lors de l\'accÃ¨s au webservice distant:','mf.recenter.ws.service':'Service sÃ©lectionnÃ©','mf.control.previous':'Vue prÃ©cÃ©dente','mf.control.next':'Vue suivante','mf.control.pan':'DÃ©placer','mf.control.zoomIn':'Zoom avant','mf.control.zoomOut':'Zoom arriÃ¨re','mf.control.zoomAll':'Vue globale','mf.editing.comboNoneName':'Aucun','mf.editing.import':'Importer','mf.editing.importTooltip':'Importer les donnÃ©es','mf.editing.commit':'Sauver','mf.editing.commitTooltip':'Sauvegarder les donnÃ©es','mf.editing.delete':'Supprimer','mf.editing.deleteTooltip':'Supprimer l\'Ã©lÃ©ment sÃ©lectionnÃ©','mf.editing.comboLabel':'Couche Ã  Ã©diter','mf.editing.confirmMessageTitle':'ElÃ©ments Ã©ditÃ©s','mf.editing.confirmMessage':'Certains Ã©lÃ©ments ne sont pas sauvegardÃ©s, '+'changer de couche?','mf.editing.selectModifyFeature':'Modifier des Ã©lÃ©ments','mf.editing.drawPointTitle':'Dessiner des points','mf.editing.drawLineTitle':'Dessiner des lignes','mf.editing.drawPolygonTitle':'Dessiner des polygones','mf.editing.formTitle':'Attributs','mf.editing.gridIdHeader':'Id','mf.editing.gridStateHeader':'Etat','mf.editing.gridTitle':'ElÃ©ments sÃ©lectionnÃ©s','mf.editing.onContextClickMessage':'Editer cet Ã©lÃ©ment','mf.editing.onBeforeUnloadMessage':'Le panneau d\'Ã©dition contient '+'des Ã©lÃ©ments non sauvegardÃ©s'});OpenLayers.Util.extend(OpenLayers.Lang.de,{'mf.tools':'Werkzeuge','mf.layertree':'Legendendarstellung','mf.layertree.opacity':'Transparenz','mf.layertree.remove':'Ausblenden','mf.layertree.zoomToExtent':'Auf die Ausdehnung zoomen','mf.print.mapTitle':'Titel','mf.print.comment':'Kommentar','mf.print.loadingConfig':'Laden der Konfiguration...','mf.print.serverDown':'Der Druck-Systemdienst funktioniert nicht','mf.print.unableToPrint':"Kann nicht drucken",'mf.print.generatingPDF':"Generierung des PDFs...",'mf.print.dpi':'DPI','mf.print.scale':'MaÃŸstab','mf.print.rotation':'Rotation','mf.print.print':'Drucken','mf.print.resetPos':'ZurÃ¼cksetzen','mf.print.layout':'Layout','mf.print.addPage':'Seite hinzufÃ¼gen','mf.print.remove':'Seite entfernen','mf.print.clearAll':'Alles lÃ¶schen','mf.print.pdfReady':'Das PDF-Dokument kann heruntergeladen werden.','mf.print.noPage':'Keine Seite ausgewÃ¤hlt, bitte auf "'+this['mf.print.addPage']+'"-'+'Button klicken um eine Seite hinzuzufÃ¼gen.','mf.print.print-tooltip':'Ein PDF generieren, dass mindestens die bounding box umfasst','mf.error':'Fehler','mf.warning':'Warnung','mf.information':'Information','mf.cancel':'Abbrechen','mf.recenter.x':'X','mf.recenter.y':'Y','mf.recenter.submit':'zentrieren','mf.recenter.missingCoords':'Fehlende Koordinaten.','mf.recenter.outOfRangeCoords':'Eingegebene Koordinaten (${myX}, ${myY}) sind auÃŸerhalb des Kartenperimeters<br />'+'und sollen in folgenden Auschnitt sein:<br/>'+'${coordX} zwischen ${minCoordX} und ${maxCoordX},<br />'+'${coordY} zwischen ${minCoordY} und ${maxCoordY}','mf.recenter.ws.error':'Ein Fehler ist beim Zugang zum Webdienst vorgekommen:','mf.recenter.ws.service':'AusgewÃ¤hlter Webdienst','mf.control.previous':'Vorherige Ansicht','mf.control.next':'NÃ¤chste Ansicht','mf.control.pan':'Verschieben','mf.control.zoomIn':'Hinein zoomen','mf.control.zoomOut':'Heraus zoomen','mf.control.zoomAll':'Globale Ansicht'});Ext.namespace("cdbund");cdbund.config={baseUrl:'http://map.geoportail.lu/',printUrl:'/print',tilecacheUrl:['http://tile1.geoportail.lu/tile/tilecache.cgi?','http://tile2.geoportail.lu/tile/tilecache.cgi?','http://tile3.geoportail.lu/tile/tilecache.cgi?','http://tile4.geoportail.lu/tile/tilecache.cgi?'],tilecacheDirectUrl:['http://tile1.geoportail.lu','http://tile2.geoportail.lu','http://tile3.geoportail.lu','http://tile4.geoportail.lu'],mymapsWmsUrl:'http://ws.geoportail.lu/mymaps',captchaPublicKey:'6Lc4icgSAAAAAOpxbvU9XazU7il7Eh7gySoxxvvh',maxExtent:[48000,57000,107000,139000],resolutions:[500.0,250.0,150.0,100.0,50.0,20.0,10.0,5.0,2.0,1.0,0.5],serverResolutions:[4000,3750,3500,3250,3000,2750,2500,2250,2000,1750,1500,1250,1000,750,650,500,250,100,50,20,10,5,2.5,2,1.5,1,0.5],pixelmapResolutions:[500,250,150,100,50,20,10,5,2.0,1.0,0.5],scales:[6500000,5000000,2500000,1000000,500000,200000,100000,50000,25000,20000,10000,5000]};OpenLayers.Util.extend(OpenLayers.Lang.en,{'Coordinates: ':'Coordinates : ','Elevation: ':'Elevation : ','N/A':'N/A','Print':'Print','Full extent':'Full extent','Distance measurement (double-click to terminate)':'Distance measurement (double-click to terminate)','Area measurement (double-click to terminate)':'Area measurement (double-click to terminate)','azimut_measurement_help':'Click on the map to get the azimut, distance and elevation offset between two points','Distance: ':'Distance : ','Azimut: ':'Azimut : ','Elevation offset: ':'Elevation offset : ','Previous view':'Previous view','Next view':'Next view','previous':'Previous','next':'Next','a_A4_landscape':'A4 Landscape','b_A4_portrait':'A4 Portrait','c_A3_landscape':'A3 Landscape','d_A3_portrait':'A3 Portrait','Gebiete mit naturbedingten Risiken':'Natural hazard areas','flood_risk':'Flood risks','cantons_labels':'Cantons (names)','districts_labels':'Districts (names)','Cities_labels':'Municipalities (names)','cantons':'Cantons','districts':'Districts','Cities':'Municipalities','natura2000':'Natura 2000','natura2000_oiseaux':'Bird protection zones Natura 2000','natura2000_habitats':'Habitats Natura 2000','rivers':'Rivers','roads':'Road Network','streets':'Road Network','roads_labels':'Road Names','ortho':'Orthophoto 2010','ortho_irc':'Orthophoto 2007 (infrared)','ortho_2001':'Orthophoto 2001','ortho_2004':'Orthophoto 2004','ortho_2007':'Orthophoto 2010','1907_CAHANSEN':'Topographical Map 1:50k 1907','1927_CAHANSEN':'Topographical Map 1:50k 1927','topo_carteshisto':'Historical topographical Maps','TOPO_CARTESHISTO_1952':'Topographical Map 1:20k 1952 B/W','TOPO_CARTESHISTO_1964':'Topographical Map 1:20k 1964 B/W','TOPO_CARTESHISTO_1964_RGB':'Topographical Map 1:20k 1964','TOPO_CARTESHISTO_1979_RGB':'Topographical Map 1:20k 1979','TOPO_CARTES_1944':'German War map 1:25k 1939','TOPO_CARTESHISTO_1966-74_50k':'Topographical Map 1:50k 1966','TOPO_CARTESHISTO_1979':'Topographical Map 1:20k 1979 B/W','TOPO_CARTESHISTO_1987':'Topographical Map 1:20k 1987 B/W','TOPO_CARTESHISTO_1989':'Topographical Map 1:20k 1989','TOPO_CARTESHISTO_1990_50k':'Topographical Map 1:50k 1990','TOPO_CARTESHISTO_1993_50k':'Topographical Map 1:50k 1993','TOPO_CARTESHISTO_2000_50k':'Topographical Map 1:50k 2000','TOPO_CARTESHISTO_2000':'Topographical Map 1:20k 2000','FERRARIS':'Ferraris Map 1:20k 1778','TOPO25K1954C24':'Topographical Map 1:25k 1954','topo':'Automatical Topographical Map','topo_5k':'Topographical Map 1:5000','topo_20k':'Topographical Map 1:20000','topo_tour_20k':'Regional tourist map 1:20000 R','topo_decoupage_r':'Regional Mapsheets','DÃ©coupage Orthophotos':'Orthophoto Grid','topo_50k':'Topographical Map 1:50000','topo_100k':'Topographical Map 1:100000','bdcarto_100k':'Topographical Map (BDCARTO) 1:100000','topo_250k':'Topographical Map 1:250000','Topographische Karten':'Topographical Maps','Parcelles FLIK viticoles 2010':'FLIK reference parcels for Vineyards 2010','Parcelles viticoles 2010':'Vineyards 2010','ivv_grosslagen':'Winegrowing Areas','ivv_kleinlagen':'Small Winegroving Areas','ivv_klimakarte':'Climate map','Asta':'Agricultural data','Zones de protection':'Protected sites','Cours d\'eau':'Watercourses','Sols':'Soil maps','Carte des sols':'Soil map 1:100\'000','Parcelles FLIK 2011':'FLIK parcels 2011','Topographie':'Topography','Luft- und Satellitenbilder':'Aerial and satellite photographs','Landnutzung nach Corine':'Land use after Corine','Grenzen':'Boundaries','Morphometrie':'Morphometric attributes','Messstationen':'Gauging stations','Hydrologische Messstationen':'Hydrological stations','Niederschlagsmessstationen':'Precipitation measurement','Weitere Messstationen':'Other meteorological stations','Messstationen WRRL':'Gauging stations (WFD)','GewÃ¤sser':'Watercourse','Stehende GewÃ¤sser':'Standing waterbodies','Biologie':'Biology','Grundwasser':'Groundwater','Trinkwasser':'Drinking water','GewÃ¤sserschutz':'Water protection','KlÃ¤ranlagen':'Waste water treatment plants','Bewirtschaftungsplan':'Management plan','Monitoring (WRRL)':'Monitoring','Hochwasser':'Floods','Ãœberschwemmungsgebiete':'Floodplains','Historische Ãœberschwemmungsgebiete':'Historic floodplains','Modellierte Ãœberschwemmungsgebiete nach TIMIS':'Modelled floodplains','JÃ¤hrlichkeiten':'Recurrence','Wassertiefe':'Water depth ','IntensitÃ¤t':'Intensity','country':'Country','Hochwasserrisikomanagementrichtlinie':'Floods directive','Projekt Hochwassergefahrenkarten':'Project flood hazard maps','Hochwassergefahrenkarten (10-jÃ¤hrlich)':'flood hazard maps (10 year flood)','Hochwassergefahrenkarten (100-jÃ¤hrlich)':'flood hazard maps (100 year flood)','Hochwassergefahrenkarten (extrem)':'flood hazard maps (extreme flood)','Projekt Hochwasserrisikokarten':'Project flood risk maps','Hochwasserrisikokarten (10-jÃ¤hrlich)':'flood risk maps (10 year flood)','Hochwasserrisikokarten (100-jÃ¤hrlich)':'flood risk maps (100 year flood)','Hochwasserrisikokarten (extrem)':'flood risk maps (extreme flood)','wg_wasserspiegel':'Water level','wg_einschrankung_warmepumpe':'Restrictions geothermal heat pumps','wg_ikonos_satellitendaten':'satellite photographs Ikonos','wg_kilometrierung_hauptgewasser':'Measurement main watercourses','wg_grundwasser_wrrl':'Groundwater','wg_kontrollpunkte':'Monitoring points','wg_messstationen_oberflachenwasser':'Surface water','wg_bodentemperatur':'Soil temperature','wg_trinkwassersyndikate':'Drinking water syndicates','wg_hangneigung_':'Slope','wg_exposition':'Exposition','wg_wrrl_oberflachenwasserkorper':'Surface water bodies','wg_timis_hochwasser_intensitaten_hq100':'100 year flood intensity','wg_bauwerke':'Buildings','wg_kunstliche_(bassin)':'Artificial basin','wg_schneehohe':'Snow height','wg_timis_hochwasser_intensitaten_hq10':'10 year flood intensity','wg_pumpstationen':'Pumping stations','wg_versiegelungsklassen':'Sealing','wg_querprofile':'Cross sections','wg_klaranlagen':'Waste water treatment plants','wg_uesg_sure_1995':'Floodplain Sauer 1995','wg_fischereiabschnitte':'Fishing sections','wg_landnutzung':'Land use','wg_feuchtgebiete':'Wetland','wg_kilometrierung_nebengewasser':'Measurement affluent watercourses','wg_timis_hochwasser_intensitaten_ehq':'Extreme flood intensity','wg_uesg_alzette_1995':'Floodplain Alzette 1995','wg_hohenlinien_10m':'Contour 10 m','wg_hauptgewasser':'Main watercourses','wg_oberflachenwasser_wrrl':'Surface water','wg_quellen':'Spring','wg_timis_wassertiefe_ehq':'Extreme flood event','wg_oberflachenwasserkorper':'Surface water bodies','wg_timis_ueberflutungsflachen_hq100':'Floodplain 100 year flood','wg_provisorische_trinkwasser_schutzzonen':'Provisional drinking water protection zones','wg_nitratbelastung':'Groundwater (Nitrate directive)','wg_nitrat_ober':'Surface water (Nitrate directive)','wg_badegewasser':'Bathing water','wg_sanitare_schutzzonen_stausee':'Sanitary protection zones reservoir','wg_trinkwasserbehalter':'Drinking water tanks','wg_naturliche_(bassin)':'Natural basin','wg_grundwasserleiter':'Aquifers','wg_einzugsgebiete':'Catchments','wg_niederschlag':'Precipitation','wg_timis_wassertiefe_hq100':'100 year flood depth','wg_relief':'Relief','wg_durchgangigkeit':'Continuity','wg_abwasser_syndikate':'Waste water syndicats','wg_kanal__muhlgraben':'Channel, Millchannel','wg_grundwasserkorper':'Groundwater bodies','wg_timis_ueberflutungsflachen_hq10':'Floodplain 10 year flood','wg_bohrungen':'Drill','wg_timis_ueberflutungsflachen_ehq':'Floodplain extreme depth','wg_timis_hochwasser_gefahrdungen':'Hazard classification','wg_hmwb_(stark_modifizierte_wasserkorper)':'Heavily modified water bodies','wg_uesg_1993_(ausser_mosel)':'Floodplain 1993 (without Mosel)','wg_gewasserentwicklungsfahigkeit':'Water course development capacity','wg_stausee_sauer':'Lake Haute SÃ»re','wg_nebengewasser':'Affluent watercourses','wg_grundwasser':'Alluvial groundwaterlevel','wg_timis_wassertiefe_hq10':'10 year flood depth','wg_relief_dhm_2m':'Relief DEM 2','wg_lufttemperatur':'Air temperature','wg_trinkwasserentnahmepunkte':'Drinking water abstraction points','wg_uesg_1983___mosel':'Floodplain 1983 - Mosel','Zoom to the max extent':'Zoom to the extent of the country','permalink action':'Link','print action':'Print','Search':'Search','Catalog':'Catalog','Layer Selection':'Layer Selection','Warning screen resolution':"Avertissement rÃ©solution d'Ã©cran",'Your screen resolution is smaller than 1024x768 pixels. map.geo.admin.ch is not optmized for small screen resolution.':"Your screen resolution is smaller than 1024x768 pixels. map.geoportail.lu is not optmized for small screen resolution.",'Full map':'Full map','Geo search...':'Search for address, parcel, place, coordinates...','searchQuicktip':'Here you can search for addresses, parcels, places, coordinates <p>Examples for search queries: <li><b>Addresses: </b>For "54, avenue Gaston Diderich" <i>type 54 Did</i><li><b>Parcels :</b> For "614/4236 in Luxembourg, Merl-Nord" <i>type 614/4236</i>','slidertip':'<center>Use this slider to <p> gradually switch between <p> the Areal Image and the Topographic Map<p>  <img src=\'http://map.geoportail.lu/gfx/slider_illustration.png\' width=90 height=30> </center>','show column':'Show the layer manager','hide column':'Hide the layer manager','Map URL':'Paste the following link into an email','URL':'URL ','Basisdaten':'Base data','Referenzsysteme':'Reference systems','Geografische Namen':'Geographical names','Administrative Einheiten':'Administrative units','Bodennutzung':'Land use','Biologie':'Biology','Versorgungswirtschaft und staatliche Dienste':'Utility and governmental services','Wasserrahmenrichtlinie':'Water framework directive (WFD)','Adressen':'Addresses','addresses':'Addresses','FlurstÃ¼cke / GrundstÃ¼cke':'Cadastral data','cadastre':'Cadastre plan','parcels':'Cadastral parcels','parcels_labels':'Cadastral parcels (numbers)','toponymes':'Cadastral region names','communes_cadastrales_labels':'Cadastral municipalities (names)','sections_cadastrales_labels':'Cadastral sections  (names)','communes_cadastrales':'Cadastral municipalities','sections_cadastrales':'Cadastral sections','feuilles_cadastrales':'Historical cadastral sheets','OberflÃ¤chendarstellung':'Land surface','GewÃ¤ssernetz':'Hydrography','HÃ¶he':'Height','Bodenbedeckung':'Land cover','Luft und Satellitenbilder':'Orthophoto-images','Raum und BevÃ¶lkerung':'Society and population','Gesundheit une Sicherheit':'Health and safety','BevÃ¶lkerungsdichte':'Population distribution','Raumplanung':'Urban and rural settlement','Infrastrucktur une Kommunikation':'Transport','Verkehrsnetze':'Transport networks','GebÃ¤ude':'Buildings','Ã–ffentliche Einrichtungen und Dienste':'Public services','Umwelt, Biologie und Geologie':'Environment, Biology and Geology','Schutzgebiete':'Protected sites','Geologie':'Geology','Boden':'Soils','UmweltÃ¼berwachung':'Environmental survey','NatÃ¼rliche Risikozonen':'Natural risk zones','AtmosphÃ¤rische Bedingungen':'Atmospheric conditions','Meteorologie':'Meteorolgy','Biogeografische Regionen':'Biogeogrphic regions','LebensrÃ¤ume une Biotope':'Habitats and biotopes','Artenvielfalt':'Species distribution','Mineralische BodenschÃ¤tze':'Mineral ressources','Energie und Wirtschaft':'Energy and economy','Statistische Einheiten':'Statistical units','Landnutzung':'Land use','Produktions- und Industrieanlagen':'Production facilities, industry','Land- und Wassertwirtschaft':'Agricultural facilities','Energiequellen':'Energy sources','Plan sÃ©cheresse':'Water scarcity plan','tour_rando':'Foot- and Cycletrails','tour_pistes_vtt':'Moutainbike Trails','tour_mullerthal_trail':'Mullerthal Trail','tour_saint_jacques':'Saint-Jacques Trail','tour_sentiers_nationaux':'National Footpaths','tour_sentiers_ajl':'AJL Footpaths','tour_sentiers_gr':'Long Distance Footpaths','tour_autopedestre':'Rambling routes','tour_pistes_velo':'Cycle paths','Meteo':'Weather data','Stations mÃ©tÃ©o':'Weather stations','PAG':'Land use plan','ac_wellenstein_pag_complet':'Complete plan','ac_wellenstein_pag_zones':'Zones','ac_wellenstein_pag_limites':'Limits','ac_wellenstein_pag_voies_acces':'Roads','ac_wellenstein_pag_perimetres_zones':'Zone contours','ac_wellenstein_pag_volumes_a_sauvegarder':'Spaces to be saved','ac_wellenstein_pag_alignements_a_preserver':'Alignments to be saved','ac_wellenstein_pag_volumes_batiments':'Buildings','show layer options':'Show layer options','hide layer options':'Hide layer options','Opacity:':'Opacity  :','about that layer':'About this layer','move layer up':'Move layer up','move layer down':'Move layer down','remove layer':'Remove layer','Feature tooltip':'Informations about the object','pixelmaps-color':'Topographic map','pixelmaps-gray':'Topographic map B/W','voidLayer':'White background','aerial attribution':'Aerial image: ACT 2010','pixelmap-color attribution':'Topographic map: ACT','pixelmap-gray attribution':'Topographic map B/W: ACT','loadingText':"Page is loading...",'Search data...':'Searching data...','Warning Internet Explorer 6':'Internet Explorer 6 Warning','You are using Internet Explorer 6.':'You are using Internet Explorer 6.','We recommend to upgrade to a newer release.':"We recommend that you use a newer version.",'You can add only 5 layers in the layer tree.':'You can add only 5 layers in the layer tree.','Layer metadata':'Metadata','Layer legend':'Legend','Position':'','redlining action':'Drawing','Direction':'Direction','Description':'Description','Distance':'Distance','Temps':'Time','Descriptif':'Description','Longitude':'Longitude','Latitude':'Latitude','Nom':'Name','Mode de transport':'Transport mode','PiÃ©ton':'Pedestrian','Voiture':'Car','Taxi':'Taxi','Camion':'Truck','VÃ©lo':'Bicycle','Ambulance':'Ambulance','Type d\'itinÃ©raire':'Type of way','Le plus rapide':'Fastest way','Pas de pÃ©age':'Without toll','Le plus court':'Shortest way','Rajouter point':'Add point','RÃ©initialiser':'Reinitialize','Calculer itinÃ©raire':'Calculate route','CritÃ¨res':'Criteria','ArrÃªts':'Waypoints','Chercher adresse':'Search for address','double clic pour enlever un point, cliquer-glisser pour changer l\'ordre':'Double clic to delete a point, drag&drop to modify the order','Rajoutez des points en cliquant dans la carte ou en cherchant des adresses':'Add points by entering an address in the search field below or by clicking into the map after having clicked the "Add point" button. <br><br>Once a point is drawn on the map, you can move it by clicking onto the point and by dragging it around with the mouse.','geoadmin.profile.exportCSV':'export as CSV','geoadmin.profile':'Elevation profile','geoadmin.profile.tooSmall':'Profile line too small','geoadmin.profile.tooLong':'Too many points for the profile line','PDF':'Print','mf.print.print':'PDF','mf.print.generatingPDF':'Print...','measure.text.button':'Measure','measure.text.panel':'Select a tool <br/>(double clic to terminate)','measure.tooltip.length':'Distance','measure.tooltip.area':'Area','measure.tooltip.azimut':'Azimut','measure.popup.azimut':'Azimut','measure.tooltip.profile':'Profile','redlining':'Drawing','mymaps.title':'My maps','mymaps.infomsg':'"My maps" allow you to create personalized maps (loaded layers and geographic extent) and to add information (points, lines, polygons and texts) to the map. Vous pouvez les enregistrer et les diffuser Ã  d\'autres personnes... <br /> Pour crÃ©er vos propres cartes, vous devez vous authentifier. Sie vous ne disposez pas d\'un compte gÃ©oportail, vous pouvez le crÃ©er <a href=http://shop.geoportail.lu/Portail/menuAction.do?dispatch=load&menuToLoad=newClient&keepMenu=false&lang=en target="_blank">ici</a>.','mymaps.export.txt':'Export','mymaps.export.msg':'Export map and all its elements','mymaps.export.feature.msg':'Exporter this object','mymaps.leavecomment':'Leave a comment','mymaps.comment':'Comment','mymaps.send':'Send','mymaps.sent':'Sent','mymaps.no_map':'No map available','mymaps.create_new':'Create a new map','mymaps.back_to_list':'List of maps','mymaps.save':'Save','mymaps.saved':'Saved','mymaps.form.title':'Title','mymaps.form.description':'Description','mymaps.public':'Public','mymaps.import':'Import','mymaps.importtip':'Import geographic objects from GPX or KML file','mymaps.copy_to_own_maps':'Create a copy of this map','mymaps.modify':'Edit','mymaps.defaulttitle':'Untitled','mymaps.advanced':'Advanced options','mymaps.zoom_to':'Zoom to','mymaps.show_profile':'Show profile graph','mymaps.length':'Length : ${length}','mymaps.area':'Area : ${area}','mymaps.unsupportedfiletitle':'Filetype not supported','mymaps.unsupportedfilemsg':'Only GPX and KML files are supported.','mymaps.unsupportedimagetypemsg':'Only files with the extension .gif, .png, .jpg or .jpeg are accepted.','mymaps.loading':'Loading','mymaps.name':'Name','mymaps.mail':'E-mail','mymaps.description':'Description','mymaps.deleteimage':'Delete','mymaps.image':'Image','mymaps.uploadimagetip':'Add or modifiy image','mymaps.delete':'Delete','mymaps.confirm_map_deletion':'Are you sure that you want to delete this map ?','mymaps.linkmsg':'Copy the following link and send it to your friends','mymaps.map_created_by':'Map created by ','mymaps.not_saved_modifications':'Edits not saved','mymaps.not_saved_modifications_msg':'You have not saved the edits that you made to the map.<br/>Do you want to save now ?','mymaps.comment.success':'Comment sent with success.','mymaps.comment.failure':'Failure sending your comment.','mymaps.comment.invalidCaptcha':'You have entered an invalid security code.','mymaps.category':'Category','mymaps.no_category':'-- No category --','mymaps.link_tip':'Click here to get a link to this map','mymaps.ratings':'rating(s)','mymaps.rating_ok':'Your rating has been taken into account. Thanks.','mymaps.color':'Color','mymaps.width':'Width'});OpenLayers.Util.extend(OpenLayers.Lang.fr,{'Coordinates: ':'Coordonn&eacute;es : ','Elevation: ':'Altitude : ','N/A':'N/A','Print':'Impression','Full extent':'Vue gÃ©nÃ©rale','Measure':'Mesure','Distance measurement (double-click to terminate)':'Mesure de distance (double-cliquer pour terminer)','Area measurement (double-click to terminate)':'Mesure de surface (double-cliquer pour terminer)','azimut_measurement_help':'Cliquez sur la carte pour obtenir l\'azimut, la distance et la diffÃ©rence d\'altitude entre deux points','Distance: ':'Distance : ','Azimut: ':'Azimut : ','Elevation offset: ':'Altitude diff. : ','Previous view':'Retour au cadrage prÃ©cÃ©dent','Next view':'Retour au cadrage suivant','previous':'Retour au cadrage prÃ©cÃ©dent','next':'Retour au cadrage suivant','a_A4_landscape':'A4 Paysage','b_A4_portrait':'A4 Portrait','c_A3_landscape':'A3 Paysage','d_A3_portrait':'A3 Portrait','Link here':'Lien vers cet endroit','Gebiete mit naturbedingten Risiken':'Zones Ã  risque naturel','flood_risk':'Risque de crue','natura2000':'Natura 2000','natura2000_oiseaux':'Zones de protection oiseaux Natura 2000','natura2000_habitats':'Habitats Natura 2000','rivers':'RiviÃ¨res','cantons_labels':'Cantons (Noms)','districts_labels':'Districts (Noms)','Cities_labels':'Communes (Noms)','cantons':'Cantons','districts':'Districts','Cities':'Communes','roads':'RÃ©seau routier','streets':'RÃ©seau routier','roads_labels':'Noms de rue','ortho':'Orthophoto 2010','ortho_irc':'Orthophoto 2007 (infrarouge)','ortho_2001':'Orthophoto 2001','ortho_2004':'Orthophoto 2004','ortho_2007':'Orthophoto 2007','1907_CAHANSEN':'Carte topographique 1:50k 1907','1927_CAHANSEN':'Carte topographique 1:50k 1927','TOPO25K1954C24':'Carte topographique 1:25k 1954','topo_carteshisto':'Cartes topographiques historiques','TOPO_CARTESHISTO_1952':'Carte topographique 1:20k 1952 N/B','TOPO_CARTESHISTO_1964':'Carte topographique 1:20k 1964 N/B','TOPO_CARTESHISTO_1964_RGB':'Carte topographique 1:20k 1964','TOPO_CARTESHISTO_1979_RGB':'Carte topographique 1:20k 1979','TOPO_CARTES_1944':'Carte de guerre allemande 1:25k 1939','TOPO_CARTESHISTO_1966-74_50k':'Carte topographique 1:50k 1966','TOPO_CARTESHISTO_1979':'Carte topographique 1:20k 1979 N/B','TOPO_CARTESHISTO_1987':'Carte topographique 1:20k 1987 N/B','TOPO_CARTESHISTO_1989':'Carte topographique 1:20k 1989','TOPO_CARTESHISTO_1990_50k':'Carte topographique 1:50k 1990','TOPO_CARTESHISTO_1993_50k':'Carte topographique 1:50k 1993','TOPO_CARTESHISTO_2000_50k':'Carte topographique 1:50k 2000','TOPO_CARTESHISTO_2000':'Carte topographique 1:20k 2000','FERRARIS':'Carte Ferraris 1:20k 1778','topo':'Carte topographique automatique','topo_5k':'Carte topographique 1:5000','topo_20k':'Carte topographique 1:20000','topo_tour_20k':'Carte rÃ©gionale touristique 1:20000 R','topo_decoupage_r':'DÃ©coupage Cartes RÃ©gionales','topo_50k':'Carte topographique 1:50000','topo_100k':'Carte topographique 1:100000','bdcarto_100k':'Carte topographique (BDCARTO) 1:100000','topo_250k':'Carte topographique 1:250000','Topographische Karten':'Cartes topographiques','ivv_grosslagen':'Lieux-dits du vignoble','ivv_kleinlagen':'Lieux-dits accessoires du vignoble','ivv_klimakarte':'Carte climatique du vignoble','Asta':'DonnÃ©es agricoles','Carte des sols':'Carte des sols 1:100\'000','Parcelles FLIK 2011':'Parcelles FLIK 2011','Topographie':'Topographie','Luft- und Satellitenbilder':'Photographies aÃ©riennes et spatiales','Landnutzung nach Corine':'Occupation du sol selon Corine','Grenzen':'Limites administratives','Morphometrie':'MorphomÃ©trie','Messstationen':'Stations de mesures','Hydrologische Messstationen':'Stations hydrologiques','Niederschlagsmessstationen':'Mesures des prÃ©cipitations','Weitere Messstationen':'Autres donnÃ©es mÃ©tÃ©orologiques','Messstationen WRRL':'Stations de mesures (DCE)','GewÃ¤sser':'Cours d\'eau','Stehende GewÃ¤sser':'Eaux stagnantes','Biologie':'Biologie','Grundwasser':'Eaux souterraines','Trinkwasser':'Eau potable','GewÃ¤sserschutz':'Protection des eaux','KlÃ¤ranlagen':'Stations d\'Ã©puration','Bewirtschaftungsplan':'Plan de gestion','Monitoring (WRRL)':'Monitoring','Hochwasser':'Crues','Ãœberschwemmungsgebiete':'Zones inondables','Historische Ãœberschwemmungsgebiete':'Zones inondables historiques','Modellierte Ãœberschwemmungsgebiete nach TIMIS':'Zones inondables modÃ©lisÃ©es','JÃ¤hrlichkeiten':'AnnualitÃ©s','Wassertiefe':'Profondeur d\'eau','IntensitÃ¤t':'IntensitÃ©','country':'FrontiÃ¨res','Hochwasserrisikomanagementrichtlinie':'Directive Inondation','Projekt Hochwassergefahrenkarten':'Projet de cartes des zones inondables','Hochwassergefahrenkarten (10-jÃ¤hrlich)':'cartes des zones inondables (10 ans)','Hochwassergefahrenkarten (100-jÃ¤hrlich)':'cartes des zones inondables (100 ans)','Hochwassergefahrenkarten (extrem)':'cartes des zones inondables (extrÃªme)','Projekt Hochwasserrisikokarten':'Projet de cartes des risques d\'inondation','Hochwasserrisikokarten (10-jÃ¤hrlich)':'cartes des risques d\'inondation (10 ans)','Hochwasserrisikokarten (100-jÃ¤hrlich)':'cartes des risques d\'inondation (100 ans)','Hochwasserrisikokarten (extrem)':'cartes des risques d\'inondation (extrÃªme)','wg_wasserspiegel':'Niveau d\'eau','wg_einschrankung_warmepumpe':'Restrictions pompes Ã  chaleur','wg_ikonos_satellitendaten':'DonnÃ©es spatiales Ikonos','wg_kilometrierung_hauptgewasser':'KilomÃ©trage cours d\'eau principaux','wg_grundwasser_wrrl':'Eaux souterraines','wg_kontrollpunkte':'Points de contrÃ´le','wg_messstationen_oberflachenwasser':'Eaux de surface','wg_bodentemperatur':'TempÃ©rature du sol','wg_trinkwassersyndikate':'Syndicats d\'eau potable','wg_hangneigung_':'Pente','wg_exposition':'Exposition','wg_wrrl_oberflachenwasserkorper':'Masses d\'eau de surface','wg_timis_hochwasser_intensitaten_hq100':'IntensitÃ© crue centennale','wg_bauwerke':'Ouvrages','wg_kunstliche_(bassin)':'Bassin artificiel','wg_schneehohe':'Hauteur de niege','wg_timis_hochwasser_intensitaten_hq10':'IntensitÃ© crue dÃ©cennale','wg_pumpstationen':'Stations de pompage','wg_versiegelungsklassen':'ImpermÃ©abilisation','wg_querprofile':'Profils en travers','wg_klaranlagen':'Stations d\'Ã©putration','wg_uesg_sure_1995':'Z.i. Sauer 1995','wg_fischereiabschnitte':'Sections de pÃªche','wg_nitratbelastung':'Eaux souterraines (Directive Nitrates)','wg_nitrat_ober':'Eaux de surface (Directive Nitrates)','wg_badegewasser':'Eaux de baignade','wg_landnutzung':'Occupation du sol','wg_feuchtgebiete':'Zones humides','wg_kilometrierung_nebengewasser':'KilomÃ©trage des cours d\'eau affluents','wg_timis_hochwasser_intensitaten_ehq':'IntensitÃ© crue extrÃ¨me','wg_uesg_alzette_1995':'Z.i. Alzette 1995','wg_hohenlinien_10m':'Courbes de niveau 10m','wg_hauptgewasser':'Cours d\'eau principaux','wg_oberflachenwasser_wrrl':'Eaux de surface','wg_quellen':'Sources','wg_timis_wassertiefe_ehq':'Profondeur crue extrÃ¨me','wg_oberflachenwasserkorper':'Masses d\'eau de surface','wg_timis_ueberflutungsflachen_hq100':'Z.i. crue centennale','wg_provisorische_trinkwasser_schutzzonen':'Zones de protection d\'eau potable provisoires','wg_sanitare_schutzzonen_stausee':'Zones de protection sanitaires du rÃ©servoir','wg_trinkwasserbehalter':'RÃ©servoir d\'eau potable','wg_naturliche_(bassin)':'Bassin naturel','wg_grundwasserleiter':'AquifÃ¨res','wg_einzugsgebiete':'Bassins versants','wg_niederschlag':'PrÃ©cipation','wg_timis_wassertiefe_hq100':'Profondeur crue centennale','wg_relief':'Relief','wg_durchgangigkeit':'ContinuitÃ©','wg_abwasser_syndikate':'Syndicats d\'eaux usÃ©es','wg_kanal__muhlgraben':'Canal, chenal de moulin','wg_grundwasserkorper':'Masses d\'eau souterraine','wg_timis_ueberflutungsflachen_hq10':'Z.i. crue dÃ©cennale','wg_bohrungen':'Forages','wg_timis_ueberflutungsflachen_ehq':'Z.i. crue extrÃ¨me','wg_timis_hochwasser_gefahrdungen':'Classes des dangers','wg_hmwb_(stark_modifizierte_wasserkorper)':'Masses d\'eau fortement modifiÃ©es','wg_uesg_1993_(ausser_mosel)':'Z.i. crue 1993 (hors Moselle)','wg_gewasserentwicklungsfahigkeit':'CapacitÃ© de dÃ©veloppement des cours dâ€™eau ','wg_stausee_sauer':'Lac de la Haute SÃ»re','wg_nebengewasser':'Cours d\'eau affluents','wg_grundwasser':'Niveau de la nappe alluviale','wg_timis_wassertiefe_hq10':'Profondeur crue dÃ©cennale','wg_relief_dhm_2m':'Relief MNT 2m','wg_lufttemperatur':'TempÃ©rature de l\'air','wg_trinkwasserentnahmepunkte':'Points de prÃ©lÃ¨vement d\'eau potable','wg_uesg_1983___mosel':'Z.i. crue 1983 - Moselle','Zoom to the max extent':'Voir tout le Luxembourg','permalink action':'Lien','print action':'Imprimer','Search':'Recherche','Catalog':'Catalogue','Layer Selection':'SÃ©lection de couches','Warning screen resolution':"Avertissement rÃ©solution d'Ã©cran",'Your screen resolution is smaller than 1024x768 pixels. map.geo.admin.ch is not optmized for small screen resolution.':"Votre rÃ©solution d'Ã©cran est infÃ©rieure Ã  1024x768 pixels. map.geoportail.lu n'est pas optimisÃ© pour de petites rÃ©solutions d'Ã©cran.",'Full map':'Carte plus grande','Geo search...':'Recherche adresse, parcelle, lieu, coordonnÃ©es...','searchQuicktip':'Ici vous pouvez chercher des adresses, parcelles, lieux (-dits) ou des coordonnÃ©es <p>Exemples de recherches: <li><b>Addresses: </b>Pour "54, avenue Gaston Diderich" <i>tapez 54 Did</i><li><b>Parcels :</b> Pour "614/4236 in Luxembourg, Merl-Nord" <i>tapez 614/4236</i>','slidertip':'<center>Utilisez ce curseur <p> pour passer graduellement <p> de l\'image aÃ©rienne Ã  la carte topo<p>  <img src=\'http://map.geoportail.lu/gfx/slider_illustration.png\' width=90 height=30> </center>','show column':'Afficher le gestionaire des couches','hide column':'Faire disparaÃ®tre le gestionnaire de couches','Map URL':'Collez le lien suivant dans un e-mail','URL':'URL ','Basisdaten':'DonnÃ©es de base','Referenzsysteme':'SystÃ¨me de rÃ©fÃ©rence','Geografische Namen':'Noms gÃ©ographiques','Administrative Einheiten':'UnitÃ©s administratives','Bodennutzung':'Usage des sols','Biologie':'Biologie','Versorgungswirtschaft und staatliche Dienste':'Services d\'utilitÃ© publique et services publics','Wasserrahmenrichtlinie':'Directive-cadre sur l\'eau (DCE)','Adressen':'Adresses','addresses':'Adresses','FlurstÃ¼cke / GrundstÃ¼cke':'DonnÃ©es cadastrales','cadastre':'Plan cadastral','parcels':'Parcelles cadastrales','parcels_labels':'Parcelles cadastrales (NumÃ©ros)','toponymes':'Toponymes cadastraux','communes_cadastrales_labels':'Communes cadastrales (Noms)','sections_cadastrales_labels':'Sections cadastrales (Noms)','communes_cadastrales':'Communes cadastrales','sections_cadastrales':'Sections cadastrales','feuilles_cadastrales':'Feuilles cadastrales historiques','OberflÃ¤chendarstellung':'Couverture du sol','GewÃ¤ssernetz':'Hydrographie','HÃ¶he':'Altitude','Bodenbedeckung':'Occupation des terres','Luft und Satellitenbilder':'Images aÃ©riennes et satelites','Raum und BevÃ¶lkerung':'Territoire et population','Gesundheit une Sicherheit':'SantÃ© et sÃ©curitÃ© des personnes','BevÃ¶lkerungsdichte':'RÃ©partition de la population','Raumplanung':'AmÃ©nagement et dÃ©veloppement du territoire','Infrastrucktur une Kommunikation':'Infrastructure et communication','Verkehrsnetze':'RÃ©seaux de transport','GebÃ¤ude':'BÃ¢timents','Ã–ffentliche Einrichtungen und Dienste':'Services publics','Umwelt, Biologie und Geologie':'Environnement, biologie et gÃ©ologie','Schutzgebiete':'Sites protÃ©gÃ©s','Geologie':'GÃ©ologie','Boden':'Sols','UmweltÃ¼berwachung':'Installations de suivi environnemental','NatÃ¼rliche Risikozonen':'Zones Ã  risque naturel','AtmosphÃ¤rische Bedingungen':'Conditions atmosphÃ©riques','Meteorologie':'MÃ©tÃ©orologie','Biogeografische Regionen':'RÃ©gions biogÃ©ographiques','LebensrÃ¤ume une Biotope':'Habitats et biotopes','Artenvielfalt':'RÃ©partition des espÃ¨ces','Mineralische BodenschÃ¤tze':'Ressources minÃ©rales','Energie und Wirtschaft':'Energie et Ã©conomie','Statistische Einheiten':'UnitÃ©s statistiques','Landnutzung':'Usage des sols','Produktions- und Industrieanlagen':'Lieux de production et sites industriels','Land- und Wassertwirtschaft':'Installations agricoles et aquacoles','Energiequellen':'Sources d\'Ã©nergie','tour_rando':'Chemins de randonnÃ©e','tour_pistes_vtt':'Circuits VTT','tour_mullerthal_trail':'Mullerthal Trail','tour_saint_jacques':'Sentier Saint-Jacques','tour_sentiers_nationaux':'Sentiers pÃ©destres nationaux','tour_sentiers_ajl':'Sentiers AJL','tour_sentiers_gr':'Chemins de Grandes RandonnÃ©es','tour_autopedestre':'Sentiers autopÃ©destres','tour_pistes_velo':'Pistes cyclables','Meteo':'DonnÃ©es mÃ©tÃ©orologiques','Stations mÃ©tÃ©o':'Stations mÃ©tÃ©orologiques','PAG':'PAG','ac_wellenstein_pag_complet':'Plan complet','ac_wellenstein_pag_zones':'Zones','ac_wellenstein_pag_limites':'Limites','ac_wellenstein_pag_voies_acces':'Voies d\'accÃ¨s','ac_wellenstein_pag_perimetres_zones':'PÃ©rimÃ¨tres zones','ac_wellenstein_pag_volumes_a_sauvegarder':'Volumes Ã  sauvegarder','ac_wellenstein_pag_alignements_a_preserver':'Alignements Ã  prÃ©server','ac_wellenstein_pag_volumes_batiments':'BÃ¢timents','show layer options':'Afficher les options de la couche','hide layer options':'Masquer les options de la couche','Opacity:':'Transparence  :','about that layer':'Informations sur la couche','move layer up':'Modifier l\'ordre des couches','move layer down':'Modifier l\'ordre des couches','remove layer':'Supprimer la couche','Feature tooltip':'Information sur l\'objet','Aerial Images':'Images aÃ©riennes','pixelmaps-color':'Carte topographique','pixelmaps-gray':'Cartes topographique N/B','voidLayer':'Fond blanc','aerial attribution':'Photo aÃ©rienne: ACT 2010','pixelmap-color attribution':'Carte nationale: ACT','pixelmap-gray attribution':'Carte nationale N/B: ACT','loadingText':"En cours de chargement...",'Search data...':'Recherche donnÃ©es...','Warning Internet Explorer 6':'Mise en garde Internet Explorer 6','You are using Internet Explorer 6.':'Vous utilisez Internet Explorer 6.','We recommend to upgrade to a newer release.':"Nous recommandons d'utiliser une version plus rÃ©cente.",'You can add only 5 layers in the layer tree.':'Vous ne pouvez ajouter que 5 couches dans l\'arbre des couches.','Layer metadata':'MÃ©tadonnÃ©es','Layer legend':'LÃ©gende','Position':'','redlining action':'Dessin','redlining':'Dessin','style':'Style','name':'Label','Close':'Fermer','Delete feature':'Supprimer','Attributes':'Attributs','Create point':'CrÃ©er point','Create line':'CrÃ©er ligne','Create polygon':'CrÃ©er polygone','Create label':'CrÃ©er Ã©tiquette','Edit Feature':'Editer','Delete all features':'Supprimer tous les objets','Do you really want to delete this feature ?':'Voulez-vous vraiment supprimer cet objet ?','Do you really want to delete all features ?':'Voulez-vous vraiment supprimer tous les objets ?','arial 12':'Arial 12','arial 16':'Arial 16','arial 24':'Arial 24','red':'Rouge','red 2':'Rouge 2','yellow':'Jaune','yellow 2':'Jaune 2','Rajoutez des points en cliquant dans la carte ou en cherchant des adresses':'Rajoutez des points en entrant des adresses dans le champ ci-dessous ou en cliquant dans la carte aprÃ¨s avoir cliquÃ© sur le bouton ci-dessus. <br><br>Une fois un point posÃ©, vous pouvez le dÃ©placer interactivement sur la carte en cliquant dessus et en le dÃ©plaÃ§ant avec la souris.','geoadmin.profile.exportCSV':'exporter CSV','geoadmin.profile':'Profil d\'Ã©lÃ©vation','geoadmin.profile.tooSmall':'Ligne de profil trop courte','geoadmin.profile.tooLong':'Trop de points pour la ligne de profil','PDF':'Imprimer','mf.print.print':'PDF','mf.print.generatingPDF':'Imprimer...','measure.text.button':'Mesurer','measure.text.panel':'Selectionner un outil <br/> (Terminer avec un double clic)','measure.tooltip.length':'Distance','measure.tooltip.area':'Surface','measure.tooltip.azimut':'Azimut','measure.popup.azimut':'Azimut','measure.tooltip.profile':'Profil altimÃ©trique','mymaps.title':'Mes cartes','mymaps.infomsg':'"Mes cartes" permet de crÃ©er des cartes personnalisÃ©es (couches chargÃ©es et Ã©tendue gÃ©ographique) et de rajouter des informations sur les cartes (points, lignes, polygones, et annotations). Vous pouvez les enregistrer et les diffuser Ã  d\'autres personnes... <br /> Pour crÃ©er vos propres cartes, vous devez vous authentifier (en haut Ã  droite). Si vous ne disposez pas d\'un compte gÃ©oportail, vous pouvez le crÃ©er <a href=http://shop.geoportail.lu/Portail/menuAction.do?dispatch=load&menuToLoad=newClient&keepMenu=false&lang=fr target="_blank">ici</a>.','mymaps.export.txt':'Exporter','mymaps.export.msg':'Exporter la carte et ses Ã©lÃ©ments','mymaps.export.feature.msg':'Exporter l\'objet','mymaps.leavecomment':'Laisser un commentaire','mymaps.comment':'Commentaire','mymaps.send':'Envoyer','mymaps.sent':'EnvoyÃ©','mymaps.no_map':'Aucune carte disponible','mymaps.create_new':'CrÃ©er une nouvelle carte','mymaps.back_to_list':'Liste des cartes','mymaps.save':'Enregistrer','mymaps.saved':'EnregistrÃ©','mymaps.form.title':'Titre','mymaps.form.description':'Description','mymaps.public':'Publique','mymaps.import':'Importer','mymaps.importtip':'Importer des entitÃ©s gÃ©ographiques depuis des fichiers GPX ou KML','mymaps.copy_to_own_maps':'CrÃ©er une copie de la carte','mymaps.modify':'Modifier','mymaps.defaulttitle':'Sans titre','mymaps.advanced':'Options avancÃ©es','mymaps.zoom_to':'Zoomer sur','mymaps.show_profile':'Afficher le profil','mymaps.length':'Longueur : ${length}','mymaps.area':'Surface : ${area}','mymaps.unsupportedfiletitle':'Type de fichier non supportÃ©','mymaps.unsupportedfilemsg':'Seuls des fichiers de type GPX ou KML peuvent Ãªtre importÃ©s.','mymaps.unsupportedimagetypemsg':'Seuls des fichiers avec une extension du type .gif, .png, .jpg ou .jpeg sont acceptÃ©s.','mymaps.loading':'Chargement','mymaps.name':'Nom','mymaps.mail':'E-mail','mymaps.description':'Description','mymaps.deleteimage':'Supprimer','mymaps.image':'Image','mymaps.uploadimagetip':'Ajouter ou modifier l\'image','mymaps.delete':'Suppression','mymaps.confirm_map_deletion':'Etes-vous certain de vouloir supprimer cette carte ?','mymaps.linkmsg':'Copiez le lien suivant pour l\'envoyer Ã  vos amis','mymaps.map_created_by':'Carte crÃ©Ã©e par ','mymaps.not_saved_modifications':'Modifications non sauvegardÃ©es','mymaps.not_saved_modifications_msg':'Vous n\'avez pas sauvegardÃ© les modifications apportÃ©es Ã  la carte.<br />Voulez-vous les enregistrer ?','mymaps.comment.success':'Commentaire envoyÃ© avec succÃ¨s.','mymaps.comment.failure':'Ã‰chec lors de l\'envoi du commentaire.','mymaps.comment.invalidCaptcha':'Vous avez rentrÃ© un code de sÃ©curitÃ© invalide.','mymaps.category':'CatÃ©gorie','mymaps.no_category':'-- Aucune catÃ©gorie --','mymaps.link_tip':'Cliquez ici pour obtenir un lien vers cette carte','mymaps.ratings':'avis','mymaps.rating_ok':'Votre avis a bien Ã©tÃ© pris en compte. Merci.','mymaps.color':'Couleur','mymaps.width':'Epaisseur du trait','User generated public maps':'Contenu gÃ©nÃ©rÃ© par des utilisateurs individuels'});OpenLayers.Util.extend(OpenLayers.Lang.de,{'Coordinates: ':'Koordinaten : ','Elevation: ':'Altitude : ','N/A':'N/A','Print':'Drucken','Measure':'Messen','Pan':'Karte verschieben','Full extent':'Ãœbersichtskarte','Distance measurement (double-click to terminate)':'EntfernungmessgerÃ¤te (Doppelklick zum beenden)','Area measurement (double-click to terminate)':'FlÃ¤chenmessgerÃ¤te (Doppelklick zum beenden)','azimut_measurement_help':'Klicken Sie in die Karte, um den Winkel, die Distanz und die HÃ¶hendifferenz zwischen 2 Punkten zu bestimmen','Distance: ':'Distanz : ','Azimut: ':'Azimut : ','Elevation offset: ':'HÃ¶hendifferenz : ','zoomin':'Hineinzoomen','zoomout':'Herauszoomen','Next view':'VorwÃ¤rts','Previous view':'RÃ¼ckwÃ¤rts','next':'VorwÃ¤rts','previous':'RÃ¼ckwÃ¤rts','Save context':'Kontext speichern','a_A4_landscape':'A4 Quer','b_A4_portrait':'A4 Hoch','c_A3_landscape':'A3 Quer','d_A3_portrait':'A3 Hoch','measure.text.button':'Messen','measure.text.panel':'Tool auswÃ¤hlen <br/>(mit Doppelklick beenden)','measure.tooltip.length':'Distanz','measure.tooltip.area':'FlÃ¤che','measure.tooltip.azimut':'Azimut','measure.popup.azimut':'Azimut','measure.tooltip.profile':'HÃ¶henprofil','redlining':'Zeichnen','Link here':'Hierher verlinken','Gebiete mit naturbedingten Risiken':'Gebiete mit naturbedingten Risiken','flood_risk':'Hochwasserrisiken','natura2000':'Natura 2000','natura2000_oiseaux':'Vogelschutzgebiete Natura 2000','natura2000_habitats':'Habitate Natura 2000','rivers':'FlusslÃ¤ufe','cantons_labels':'Kantone (Namen)','districts_labels':'Bezirke (Namen)','Cities_labels':'Gemeinden (Namen)','cantons':'Kantone','districts':'Bezirke','Cities':'Gemeinden','roads':'StraÃŸennetz','streets':'StraÃŸennetz','roads_labels':'StraÃŸennamen','ortho_irc':'Orthophoto 2007 (infrarot)','ortho':'Orthophoto 2010','ortho_2001':'Orthophoto 2001','ortho_2004':'Orthophoto 2004','ortho_2007':'Orthophoto 2007','1907_CAHANSEN':'Topographische Karte 1:50k 1907','1927_CAHANSEN':'Topographische Karte 1:50k 1927','TOPO25K1954C24':'Topographische Karte 1:25k 1954','topo_carteshisto':'Historische topographische Karten','TOPO_CARTESHISTO_1952':'Topographische Karte 1:20k 1952 S/W','TOPO_CARTESHISTO_1964':'Topographische Karte 1:20k 1964 S/W','TOPO_CARTESHISTO_1964_RGB':'Topographische Karte 1:20k 1964','TOPO_CARTESHISTO_1979_RGB':'Topographische Karte 1:20k 1979','TOPO_CARTES_1944':'Deutsche Kriegskarte 1:25k 1939','TOPO_CARTESHISTO_1966-74_50k':'Topographische Karte 1:50k 1966','TOPO_CARTESHISTO_1979':'Topographische Karte 1:20k 1979 S/W','TOPO_CARTESHISTO_1987':'Topographische Karte 1:20k 1987 S/W','TOPO_CARTESHISTO_1989':'Topographische Karte 1:20k 1989','TOPO_CARTESHISTO_1990_50k':'Topographische Karte 1:50k 1990','TOPO_CARTESHISTO_1993_50k':'Topographische Karte 1:50k 1993','TOPO_CARTESHISTO_2000_50k':'Topographische Karte 1:50k 2000','TOPO_CARTESHISTO_2000':'Topographische Karte 1:20k 2000','FERRARIS':'Ferraris Karte 1:20k 1778','topo':'Automatische topographische Karte','topo_5k':'Topographische Karte 1:5000','topo_20k':'Topographische Karte 1:20000','topo_tour_20k':'Regionale touristische Karte 1:20000 R','topo_decoupage_r':'Blattschnitt Regionale Karte','DÃ©coupage Orthophotos':'Blattschnitt Orthophotos','topo_50k':'Topographische Karte 1:50000','topo_100k':'Topographische Karte 1:100000','bdcarto_100k':'Topographische Karte 1:100000 (BDCARTO)','topo_250k':'Topographische Karte 1:250000','Topographische Karten':'Topographische Karten','Viticulture':'Weinbau','Parcelles FLIK viticoles 2010':' FLIK Referenzparzellen Weinbau 2010','Parcelles viticoles 2010':'Weinbergsparzellen 2010','ivv_grosslagen':'Lagen im Weinbau','ivv_kleinlagen':'Kleinlagen im Weinbau','ivv_klimakarte':'Klimakarte','Asta':'Agrikulturdaten','Zones de protection':'Schutzgebiete','Cours d\'eau':'WasserlÃ¤ufe','Sols':'Bodenkarten','Carte des sols':'Bodenkarte 1:100\'000','Parcelles FLIK 2011':'FLIK Parzellen 2011','Topographie':'Topographie','Luft- und Satellitenbilder':'Luft- und Satellitenbilder','Landnutzung nach Corine':'Landnutzung nach Corine','Grenzen':'Grenzen','Morphometrie':'Morphometrie','Messstationen':'Messstationen','Hydrologische Messtationen':'Hydrologische Messstationen','Niederschlagsmessstationen':'Niederschlagsmessstationen','Weitere Messtationen':'Weitere Messstationen','Messstationen WRRL':'Messstationen WRRL','GewÃ¤sser':'GewÃ¤sser','Stehende GewÃ¤sser':'Stehende GewÃ¤sser','Biologie':'Biologie','Grundwasser':'Grundwasser','Trinkwasser':'Trinkwasser','GewÃ¤sserschutz':'GewÃ¤sserschutz','KlÃ¤ranlagen':'KlÃ¤ranlagen','Bewirtschaftungsplan':'Bewirtschaftungsplan','Monitoring (WRRL)':'Monitoring (WRRL)','Hochwasser':'Hochwasser','Ãœberschwemmungsgebiete':'Ãœberschwemmungsgebiete','Historische Ãœberschwemmungsgebiete':'Historische Ãœberschwemmungsgebiete','Modellierte Ãœberschwemmungsgebiete nach TIMIS':'Modellierte Ãœberschwemmungsgebiete nach TIMIS','JÃ¤hrlichkeiten':'JÃ¤hrlichkeiten','Wassertiefe':'Wassertiefe','IntensitÃ¤t':'IntensitÃ¤t','country':'Landesgrenzen','wg_wasserspiegel':'Wasserspiegel','wg_einschrankung_warmepumpe':'EinschrÃ¤nkung WÃ¤rmepumpe','wg_ikonos_satellitendaten':'Ikonos Satellitendaten','wg_kilometrierung_hauptgewasser':'Kilometrierung HauptgewÃ¤sser','wg_grundwasser_wrrl':'Grundwasser','wg_kontrollpunkte':'Kontrollpunkte','wg_messstationen_oberflachenwasser':'OberflÃ¤chengewÃ¤sser','wg_bodentemperatur':'Bodentemperatur','wg_trinkwassersyndikate':'Trinkwassersyndikate','wg_hangneigung_':'Hangneigung Â°','wg_exposition':'Exposition','wg_wrrl_oberflachenwasserkorper':'OberflÃ¤chenwasserkÃ¶rper','wg_timis_hochwasser_intensitaten_hq100':'IntensitÃ¤t HQ 100','wg_bauwerke':'Bauwerke','wg_kunstliche_(bassin)':'KÃ¼nstliche (Bassin)','wg_schneehohe':'SchneehÃ¶he','wg_timis_hochwasser_intensitaten_hq10':'IntensitÃ¤t HQ10','wg_pumpstationen':'Pumpstationen','wg_versiegelungsklassen':'Versiegelungsklassen','wg_querprofile':'Querprofile','wg_klaranlagen':'KlÃ¤ranlagen','wg_uesg_sure_1995':'UESG Sure 1995','wg_fischereiabschnitte':'Fischereiabschnitte','wg_nitratbelastung':'Grundwasser (Nitratverordnung)','wg_nitrat_ober':'OberflÃ¤chengewÃ¤sser (Nitratverordnung)','wg_badegewasser':'BadegewÃ¤sser','wg_landnutzung':'Landnutzung','wg_feuchtgebiete':'Feuchtgebiete','wg_kilometrierung_nebengewasser':'Kilometrierung NebengewÃ¤sser','wg_timis_hochwasser_intensitaten_ehq':'IntensitÃ¤t HQ extrem','wg_uesg_alzette_1995':'UESG Alzette 1995','wg_hohenlinien_10m':'HÃ¶henlinien 10m','wg_hauptgewasser':'HauptgewÃ¤sser','wg_oberflachenwasser_wrrl':'OberflÃ¤chengewÃ¤sser','wg_quellen':'Quellen','wg_timis_wassertiefe_ehq':'Wasstiefe HQ extrem','wg_oberflachenwasserkorper':'OberflÃ¤chenwasserkÃ¶rper','wg_timis_ueberflutungsflachen_hq100':'ÃœSG 100-jÃ¤hrlich','wg_provisorische_trinkwasser_schutzzonen':'Provisorische Trinkwasser-Schutzzonen','wg_sanitare_schutzzonen_stausee':'SanitÃ¤re Schutzzonen Stausee','wg_trinkwasserbehalter':'TrinkwasserbehÃ¤lter','wg_naturliche_(bassin)':'NatÃ¼rliche (Bassin)','wg_grundwasserleiter':'Grundwasserleiter','wg_einzugsgebiete':'Einzugsgebiete','wg_niederschlag':'Niederschlag','wg_timis_wassertiefe_hq100':'Wasstiefe HQ 100','wg_relief':'Relief','wg_durchgangigkeit':'DurchgÃ¤ngigkeit','wg_abwasser_syndikate':'Abwassersyndikate','wg_kanal__muhlgraben':'Kanal, MÃ¼hlgraben','wg_grundwasserkorper':'GrundwasserkÃ¶rper','wg_timis_ueberflutungsflachen_hq10':'ÃœSG 10-jÃ¤hrlich','wg_bohrungen':'Bohrungen','wg_timis_ueberflutungsflachen_ehq':'ÃœSG extrem','wg_timis_hochwasser_gefahrdungen':'Gefahrenklassen','wg_hmwb_(stark_modifizierte_wasserkorper)':'Erheblich verÃ¤nderte WasserkÃ¶rper','wg_uesg_1993_(ausser_mosel)':'UESG 1993 (ausser Mosel)','wg_gewasserentwicklungsfahigkeit':'GewÃ¤sserentwicklungsfÃ¤higkeit','wg_stausee_sauer':'Stausee Sauer','wg_nebengewasser':'NebengewÃ¤sser','wg_grundwasser':'Alluvialer Grundwasserspiegel','wg_timis_wassertiefe_hq10':'Wasstiefe HQ 10','wg_relief_dhm_2m':'Relief DHM 2m','wg_lufttemperatur':'Lufttemperatur','wg_trinkwasserentnahmepunkte':'Trinkwasserentnahmepunkte','wg_uesg_1983___mosel':'UESG 1983 - Mosel','Zoom to the max extent':'Ganz Luxemburg','permalink action':'Link','print action':'Drucken','Search':'Suche','Catalog':'Katalog','Layer Selection':'Auswahl','Warning screen resolution':'Warnung BildschirmauflÃ¶sung','Ihre BildschirmauflÃ¶sung ist kleiner als 1024x768 pixels. map.geo.admin.ch is not optmized for small screen resolution.':'Your screen resolution is smaller than 1024x768 pixels. map.geoportail.lu ist nicht fÃ¼r kleine BildschirmauflÃ¶sung optimiert.','Full map':'GrÃ¶ssere Karte','Geo search...':'Suche Adresse, Parzelle, Ort, Koordinaten ...','searchQuicktip':'Hier kÃ¶nnen Sie nach Adressen, Parzellen, Orten, Flurnamen und Koordinaten suchen.<p>Suchbeispiele: <li><b>Adressen: </b>FÃ¼r "54, avenue Gaston Diderich" <i>tippen Sie 54 Did</i><li><b>Parzellen :</b> FÃ¼r "614/4236 in Luxembourg, Merl-Nord" <i>tippen Sie 614/4236</i>','slidertip':'<center>Benutzen Sie diesen Schieber <p> um stufenlos zwischen <p> Luftbild und Topokarte zu wechseln<p>  <img  src=\'http://map.geoportail.lu/gfx/slider_illustration.png\' width=90 height=30> </center>','show column':'Themen Ã¶ffnen','hide column':'Ausblenden der Themen','Map URL':'Untenstehenden Link in e-mail einbinden','URL':'URL','Basisdaten':'Basisdaten','Referenzsysteme':'Referenzsysteme','Geografische Namen':'Geografische Namen','Administrative Einheiten':'Verwaltungseinheiten','Bodennutzung':'Bodennutzung','Biologie':'Biologie','Versorgungswirtschaft und staatliche Dienste':'Versorgungswirtschaft und staatliche Dienste','Wasserrahmenrichtlinie':'Wasserrahmenrichtlinie (WRRL)','Adressen':'Adressen','addresses':'Adressen','FlurstÃ¼cke / GrundstÃ¼cke':'Katasterdaten','cadastre':'Katasterplan','parcels':'Katasterparzellen','parcels_labels':'Katasterparzellen (Nummern)','toponymes':'Katasterflurnamen','communes_cadastrales_labels':'Katastergemeinden (Namen)','sections_cadastrales_labels':'Katastersektionen (Namen)','communes_cadastrales':'Katastergemeinden','sections_cadastrales':'Katastersektionen','feuilles_cadastrales':'Kataster - UrplÃ¤ne','OberflÃ¤chendarstellung':'OberflÃ¤chendarstellung','GewÃ¤ssernetz':'GewÃ¤ssernetz','HÃ¶he':'HÃ¶he','Bodenbedeckung':'Bodenbedeckung','Luft und Satellitenbilder':'Luft und Satellitenbilder','Raum und BevÃ¶lkerung':'Raum und BevÃ¶lkerung','Gesundheit une Sicherheit':'Gesundheit und Sicherheit','BevÃ¶lkerungsdichte':'BevÃ¶lkerungsverteilung','Raumplanung':'Raumplanung und -entwicklung','Infrastrucktur une Kommunikation':'Infrastruktur und Kommunikation','Verkehrsnetze':'Verkehrsnetze','GebÃ¤ude':'GebÃ¤ude','Ã–ffentliche Einrichtungen und Dienste':'Ã–ffentliche Einrichtungen','Umwelt, Biologie und Geologie':'Umwelt, Biologie und Geologie','Schutzgebiete':'Schutzgebiete','Geologie':'Geologie','Boden':'Boden','UmweltÃ¼berwachung':'UmweltÃ¼berwachung','NatÃ¼rliche Risikozonen':'NatÃ¼rliche Risikozonen','AtmosphÃ¤rische Bedingungen':'AtmosphÃ¤rische Bedingungen','Meteorologie':'Meteorologie','Biogeografische Regionen':'Biogeografische Regionen','LebensrÃ¤ume une Biotope':'LebensrÃ¤ume und Biotope','Artenvielfalt':'Artenvielfalt','Mineralische BodenschÃ¤tze':'Mineralische BodenschÃ¤tze','Energie und Wirtschaft':'Energie und Wirtschaft','Statistische Einheiten':'Statistische Einheiten','Landnutzung':'Landnutzung','Produktions- und Industrieanlagen':'Produktions- und Industrieanlagen','Land- und Wassertwirtschaft':'Land- und Wassertwirtschaft','Energiequellen':'Energiequellen','Plan sÃ©cheresse':'Plan im Fall einer Trockenheit','tour_rando':'Wander- und Radwege','tour_pistes_vtt':'Mountainbike-Wege','tour_mullerthal_trail':'Mullerthal Trail','tour_saint_jacques':'St. Jakob Weg','tour_sentiers_nationaux':'Nationale Wangerwege','tour_sentiers_ajl':'AJL Wanderwege','tour_sentiers_gr':'GroÃŸe Wanderwege','tour_autopedestre':'Rundwanderwege','tour_pistes_velo':'Radwege','Meteo':'Wetterdaten','Stations mÃ©tÃ©o':'Wetterstationen','PAG':'FlÃ¤chennutzungsplan','ac_wellenstein_pag_complet':'KomplettÃ¼bersicht','ac_wellenstein_pag_zones':'Zonen','ac_wellenstein_pag_limites':'Grenzen','ac_wellenstein_pag_voies_acces':'Zufahrtswege','ac_wellenstein_pag_perimetres_zones':'Zonenumrisse','ac_wellenstein_pag_volumes_a_sauvegarder':'Zu erhaltende FlÃ¤chen','ac_wellenstein_pag_alignements_a_preserver':'Zu erhaltende Ausrichtungen','ac_wellenstein_pag_volumes_batiments':'GebÃ¤ude','show layer options':'Layeroptionen anzeigen','hide layer options':'Layeroptionen ausblenden','Opacity:':'Transparenz','about that layer':'Informationen zu diesem Datensatz','move layer up':'Layer-Reihenfolge Ã¤ndern','move layer down':'Layer-Reihenfolge Ã¤ndern','remove layer':'entfernen des Datensatzes','Feature tooltip':'Objektinformation','Aerial Images':'Luftbild','pixelmaps-color':'Topographische Karte','pixelmaps-gray':'Topographische Karte SW','voidLayer':'Kein Hintergrund','aerial attribution':'Luftbild: ACT 2010','pixelmap-color attribution':'Topographische Karte: ACT','pixelmap-gray attribution':'Topographische Karte S&W: ACT','loadingText':"Lade Daten ...",'Search data...':'Daten suchen...','Warning Internet Explorer 6':'Warnung Internet Explorer 6','You are using Internet Explorer 6.':'Sie benutzen Internet Explorer 6.','We recommend to upgrade to a newer release.':'Wir empfehlen eine neuere Version zu benutzen.','You can add only 5 layers in the layer tree.':'Sie kÃ¶nnen nur 5 Layer anzeigen.','Layer metadata':'','Layer legend':'','Position':'','geoadmin.profile.exportCSV':'CSV exportieren','geoadmin.profile':'HÃ¶henprofil','geoadmin.profile.tooSmall':'Profillinie zu kurz','geoadmin.profile.tooLong':'Zu viele Punkte fÃ¼r die Profillinie','PDF':'Drucken','mf.print.print':'PDF','mf.print.generatingPDF':'Drucken...','redlining action':'Zeichnen','Direction':'Richtung','Description':'Beschreibung','Distance':'Distanz','Temps':'Zeit','Descriptif':'Beschreibung','Longitude':'LÃ¤ngengrad','Latitude':'Breitengrad','Nom':'Name','Mode de transport':'Transportmodus','PiÃ©ton':'FussgÃ¤nger','Voiture':'PKW','Taxi':'Taxi','Camion':'LKW','VÃ©lo':'Fahrrad','Ambulance':'Krankenwagen','Type d\'itinÃ©raire':'Berechnungsart','Le plus rapide':'Schnellster Weg','Pas de pÃ©age':'Ohne Mautstrecken','Le plus court':'KÃ¼rzester Weg','Rajouter point':'Punkt hinzufÃ¼gen','RÃ©initialiser':'Reinitialisieren','Calculer itinÃ©raire':'Weg berechnen','CritÃ¨res':'Kriterien','ArrÃªts':'Wegpunkte','Chercher adresse':'Adresse suchen','double clic pour enlever un point, cliquer-glisser pour changer l\'ordre':'Doppelklick um einen Punkt zu lÃ¶schen, Drag&Drop um die Reihenfolge zu Ã¤ndern','Rajoutez des points en cliquant dans la carte ou en cherchant des adresses':'Sie kÃ¶nnen Punkte hinzufÃ¼gen, indem Sie eine Adresse in das Suchfeld eintippen oder indem Sie in die Karte klicken, nachdem Sie den Knopf oben links geklickt haben.<br><br>Nachdem ein Punkt auf der Karte eingefÃ¼gt wurde, kÃ¶nnen Sie ihn bewegen, indem Sie drauf klicken und ihn dann mit der Maus verschieben.','Edit Feature':'Objekt editieren','mymaps.title':'Meine Karten','mymaps.infomsg':'"Meine Karten" erlaubt es, personalisierte Karten (geladene Layer und geographische Ausdehnung) zu erstellen und eigene Informationen (Punkte, Linien, FlÃ¤chen, Texte) hinzuzufÃ¼gen. <br/> Sie kÃ¶nnen die Karten speichern und an Dritte weitergeben ... <br/> Um Ihre eigenen Karten zu erstellen, mÃ¼ssen Sie sich einloggen (oben rechts). Falls Sie noch nicht Ã¼ber ein Konto im Geoportal verfÃ¼gen, kÃ¶nnen Sie es <a href=http://shop.geoportail.lu/Portail/menuAction.do?dispatch=load&menuToLoad=newClient&keepMenu=false&lang=de target="_blank">hier</a> anlegen.','mymaps.export.txt':'Exportieren','mymaps.export.msg':'Karte mitsamt allen Objekten exportieren','mymaps.export.feature.msg':'Dieses Objekt exportieren','mymaps.leavecomment':'Kommentar verfassen','mymaps.comment':'Kommentar','mymaps.send':'Abschicken','mymaps.sent':'Abgeschickt','mymaps.no_map':'Keine Karte verfÃ¼gbar','mymaps.create_new':'Neue Karte erstellen','mymaps.back_to_list':'Liste der Karten','mymaps.save':'Speichern','mymaps.saved':'Gespeichert','mymaps.form.title':'Titel','mymaps.form.description':'Beschreibung','mymaps.public':'Ã–ffentlich','mymaps.import':'Importieren','mymaps.importtip':'Importieren von geografischen Informationen aus einer GPX oder KML Datei','mymaps.copy_to_own_maps':'Eine Kopie der Karte erstellen','mymaps.modify':'Editieren','mymaps.defaulttitle':'Ohne Titel','mymaps.advanced':'Erweiterte Optionen','mymaps.zoom_to':'Zoomen','mymaps.show_profile':'HÃ¶henprofil anzeigen','mymaps.length':'LÃ¤nge : ${length}','mymaps.area':'FlÃ¤che : ${area}','mymaps.unsupportedfiletitle':'Dateityp nicht unterstÃ¼tzt','mymaps.unsupportedfilemsg':'Nur GPX oder KML - Dateien kÃ¶nnen importiert werden.','mymaps.unsupportedimagetypemsg':'Nur Dateien mit der Erweiterung .gif, .png, .jpg oder .jpeg werden angenommen.','mymaps.loading':'Laden','mymaps.name':'Name','mymaps.mail':'E-mail','mymaps.description':'Beschreibung','mymaps.deleteimage':'LÃ¶schen','mymaps.image':'Bild','mymaps.uploadimagetip':'HinzufÃ¼gen oder Ã¤ndern eines Bildes','mymaps.delete':'LÃ¶schen','mymaps.confirm_map_deletion':'Sind Sie sicher, dass Sie diese Karte lÃ¶schen wollen ?','mymaps.linkmsg':'Kopieren Sie folgenden Link, um ihn an Ihre Freunde weiterzuleiten: ','mymaps.map_created_by':'Karte erstellt von ','mymaps.not_saved_modifications':'VerÃ¤nderungen nicht gespeichert','mymaps.not_saved_modifications_msg':'Sie haben die letzten Ã„nderungen noch nicht abgespeichert. <br/> Wollen Sie jetzt speichern?','mymaps.comment.success':'Kommentar erfolgreich abgeschickt.','mymaps.comment.failure':'Problem beim Verschicken des Kommentars.','mymaps.comment.invalidCaptcha':'Sie haben einen falschen Sicherheitscode eingegeben.','mymaps.category':'Kategorie','mymaps.no_category':'-- Keine Kategorie --','mymaps.link_tip':'Klicken Sie hier, um einen Link fÃ¼r diese Karte zu erhalten.','mymaps.ratings':'Meinung(en)','mymaps.rating_ok':'Ihre Meinung wurde berÃ¼cksichtigt. Danke.','mymaps.color':'Farbe','mymaps.width':'Breite','User generated public maps':'Von Benutzern publizierter Inhalt'});OpenLayers.Lang.lu={'Coordinates: ':'Koordinaten : ','Elevation: ':'HÃ©icht : ','N/A':'N/A','Print':'DrÃ«cken','Measure':'Moossen','Pan':'Kaart verschieben','Full extent':'Iwwersichtskaart','Distance measurement (double-click to terminate)':'Entfernung moossen (Doppelklick fier oofzeschlÃ©issen)','Area measurement (double-click to terminate)':'FlÃ¤ch moossen (Doppelklick fier oofzeschlÃ©issen)','azimut_measurement_help':'Klickt an d\'Kaart fir de WÃ«nkel, d\'Distanz an d\'HÃ©ichtendifferenz tÃ«schent zwee Punkten ze rechnen','Distance: ':'Distanz : ','Azimut: ':'Azimut : ','Elevation offset: ':'HÃ©ichtendifferenz : ','zoomin':'Razoomen','zoomout':'Rauszoomen','Next view':'No fier','Previous view':'No hannen','next':'No fier','previous':'No hannen','Save context':'Kontext speicheren','mf.print.layout':'Layout','a_A4_landscape':'A4 Landscape','b_A4_portrait':'A4 Portrait','c_A3_landscape':'A3 Landscape','d_A3_portrait':'A3 Portrait','measure.text.button':'Moossen','measure.text.panel':'Tool auswielen <br/> (mat Duebelklick oofschlÃ©issen)','measure.tooltip.length':'Distanz','measure.tooltip.area':'FlÃ¤ch','measure.tooltip.azimut':'Azimut','measure.popup.azimut':'Azimut','measure.tooltip.profile':'HÃ©ichteprofil','redlining':'Zeechnen','Link here':'Heihin verlinken','Gebiete mit naturbedingten Risiken':'Gebidder matt natierleche Risiken','flood_risk':'HÃ©ichwaasserrisiken','natura2000':'Natura 2000','natura2000_oiseaux':'Vulleschutzgebidder Natura 2000','natura2000_habitats':'Habitater Natura 2000','rivers':'FlÃ«ssleef','Cities_labels':'Gemengen (Nimm)','cantons_labels':'Kantoner (Nimm)','districts_labels':'Distrikter (Nimm)','Cities':'Gemengen','cantons':'Kantoner','districts':'Distrikter','roads':'Stroossennnetz','streets':'Stroossennnetz','roads_labels':'Stroossennimm','ortho':'Orthophoto 2010','ortho_irc':'Orthophoto 2007 (infrarout)','ortho_2001':'Orthophoto 2001','ortho_2004':'Orthophoto 2004','ortho_2007':'Orthophoto 2007','1907_CAHANSEN':'Topographesch Kaart 1:50k 1907','1927_CAHANSEN':'Topographesch Kaart 1:50k 1927','TOPO25K1954C24':'Topographesch Kaart 1:25k 1954','topo_carteshisto':'HistorÃ«sch topographesch Kaarten','TOPO_CARTESHISTO_1952':'Topographesch Kaart 1:20k 1952 S/W','TOPO_CARTESHISTO_1964':'Topographesch Kaart 1:20k 1964 S/W','TOPO_CARTESHISTO_1964_RGB':'Topographesch Kaart 1:20k 1964','TOPO_CARTESHISTO_1979_RGB':'Topographesch Kaart 1:20k 1979','TOPO_CARTES_1944':'DÃ¤itsch Krichskaart 1:25k 1939','TOPO_CARTESHISTO_1966-74_50k':'Topographesch Kaart 1:50k 1966','TOPO_CARTESHISTO_1979':'Topographesch Kaart 1:20k 1979 S/W','TOPO_CARTESHISTO_1987':'Topographesch Kaart 1:20k 1987 S/W','TOPO_CARTESHISTO_1989':'Topographesch Kaart 1:20k 1989','TOPO_CARTESHISTO_1990_50k':'Topographesch Kaart 1:50k 1990','TOPO_CARTESHISTO_1993_50k':'Topographesch Kaart 1:50k 1993','TOPO_CARTESHISTO_2000_50k':'Topographesch Kaart 1:50k 2000','TOPO_CARTESHISTO_2000':'Topographesch Kaart 1:20k 2000','FERRARIS':'Ferraris Kaart 1:20k 1778','topo':'Automatesch topographesch Kaart','topo_5k':'Topographesch Kaart 1:5000','topo_20k':'Topographesch Kaart 1:20000','topo_tour_20k':'Regional touristesch Kaart 1:20000 R','topo_decoupage_r':'BladschnÃ«tt Regional Kaart','DÃ©coupage Orthophotos':'BladschnÃ«tt Orthophotos','topo_50k':'Topographesch Kaart 1:50000','topo_100k':'Topographesch Kaart 1:100000','topo_250k':'Topographesch Kaart 1:250000','Topographische Karten':'Topographesch Kaarten','Viticulture':'Weibau','Parcelles FLIK viticoles 2010':'FLIK Referenzparzellen Wengerten 2010','Parcelles viticoles 2010':'Wengerten 2010','ivv_grosslagen':'Lagen am Weibau','ivv_kleinlagen':'Klenglagen am Weibau','ivv_klimakarte':'Klimakaart','Asta':'Agrikulturdaten','Zones de protection':'Schutzgebidder','Cours d\'eau':'Waasserleef','Sols':'Buedemkaarten','Carte des sols':'Buedemkaart 1:100\'000','Parcelles FLIK 2011':'FLIK Parzellen 2011','Topographie':'Topographie','Luft- und Satellitenbilder':'Loft- an Satellitebiller','Landnutzung nach Corine':'Landnotzung laut Corine','Grenzen':'Grenzen','Morphometrie':'Morphologie','Messstationen':'Miessstatiounen','Hydrologische Messstationen':'Hydrologesch Miessstatiounen','Niederschlagsmessstationen':'Nidderschlagsmiessstatiounen','Weitere Messstationen':'Weider mÃ©tÃ©orologesch Miesstatiounen','Messstationen WRRL':'Miessstatiounen (WRRL)','GewÃ¤sser':'GewÃ¤sser','Stehende GewÃ¤sser':'StagnÃ©ierend GewÃ¤sser','Biologie':'Biologie','Grundwasser':'Grondwaasser','Trinkwasser':'DrÃ©nkwaasser','KlÃ¤ranlagen':'KlÃ¤ranlagen','GewÃ¤sserschutz':'GewÃ¤sserschutz','Bewirtschaftungsplan':'Bewirtschaftungsplang','Monitoring (WRRL)':'Monitoring','Hochwasser':'HÃ©ichwaasser','Ãœberschwemmungsgebiete':'Iwwerschwemmungsgebieter','Historische Ãœberschwemmungsgebiete':'Historech Iwwerschwemmungsgebieter','Modellierte Ãœberschwemmungsgebiete nach TIMIS':'ModelÃ©iert Iwwerschwemmungsgebieter','JÃ¤hrlichkeiten':'JÃ¤hrlechkeeten','Wassertiefe':'WaasserdÃ©ift','IntensitÃ¤t':'IntensitÃ©it','country':'Landesgrenzen','Hochwasserrisikomanagementrichtlinie':'HÃ©ichwaasserrisikomanagementrichtlinn','Projekt Hochwassergefahrenkarten':'Projet HÃ©ichwaassergeforenkaarten','Hochwassergefahrenkarten (10-jÃ¤hrlich)':'HÃ©ichwaassergeforenkaarten (10-jÃ¤rleg)','Hochwassergefahrenkarten (100-jÃ¤hrlich)':'HÃ©ichwaassergeforenkaarten (100-jÃ¤rleg)','Hochwassergefahrenkarten (extrem)':'HÃ©ichwaassergeforenkaarten (extrem)','Projekt Hochwasserrisikokarten':'Projet HÃ©ichwaasserrisikokaarten','Hochwasserrisikokarten (10-jÃ¤hrlich)':'HÃ©ichwaasserrisikokaarten (10-jÃ¤rleg)','Hochwasserrisikokarten (100-jÃ¤hrlich)':'HÃ©ichwaasserrisikokaarten (100-jÃ¤rleg)','Hochwasserrisikokarten (extrem)':'HÃ©ichwaasserrisikokaarten (extrem)','wg_wasserspiegel':'Waasserspigel','wg_einschrankung_warmepumpe':'AschrÃ¤nkungen WÃ¤rmepompelen','wg_ikonos_satellitendaten':'SatellitendonnÃ©e Ikonos','wg_kilometrierung_hauptgewasser':'KilometrÃ©ierung HaaptgewÃ¤sser','wg_grundwasser_wrrl':'Grondwaasser','wg_kontrollpunkte':'Iwwerwaachungspunkten','wg_messstationen_oberflachenwasser':'IwwerflÃ¤chengewÃ¤sser','wg_bodentemperatur':'Buedemtemperatur','wg_trinkwassersyndikate':'DrÃ©nkwaassersyndikater','wg_hangneigung_':'Hangneigung','wg_exposition':'Expositioun','wg_wrrl_oberflachenwasserkorper':'IwwerflÃ¤chenwaasserkierper','wg_timis_hochwasser_intensitaten_hq100':'IntensitÃ©it 100 jÃ¤hrlecht HW','wg_bauwerke':'Bauwierker','wg_kunstliche_(bassin)':'KÃ«nstleche Baseng','wg_schneehohe':'SchnÃ©ihÃ©icht','wg_timis_hochwasser_intensitaten_hq10':'IntensitÃ©it 10 jÃ¤hrlecht HW','wg_pumpstationen':'Pompelstatiounen','wg_versiegelungsklassen':'Versichelung','wg_querprofile':'Querprofiler','wg_klaranlagen':'KlÃ¤ranlagen','wg_uesg_sure_1995':'ISG Sauer 1995','wg_fischereiabschnitte':'FÃ«schereiofschnÃ«tter','wg_nitratbelastung':'Grondwaasser (Nitratveruerdnung)','wg_nitrat_ober':'IwwerflÃ¤chengewÃ¤sser (Nitratveruerdnung)','wg_badegewasser':'BadegewÃ¤sser','wg_landnutzung':'Landnotzung','wg_feuchtgebiete':'Fiichtgebieter','wg_kilometrierung_nebengewasser':'KilometrÃ©ierung NiewengewÃ¤sser','wg_timis_hochwasser_intensitaten_ehq':'IntensitÃ©it Extremt HW','wg_uesg_alzette_1995':'ISG Uelzecht 1995','wg_hohenlinien_10m':'HÃ©ichtenlinien 10m','wg_hauptgewasser':'HaaptgewÃ¤sser','wg_oberflachenwasser_wrrl':'IwwerflÃ¤chengewÃ¤sser','wg_quellen':'Quell','wg_timis_wassertiefe_ehq':'DÃ©ift Extremt HW','wg_oberflachenwasserkorper':'IwwerflÃ¤chenwaasserkierper','wg_timis_ueberflutungsflachen_hq100':'ISG 100-jÃ¤hrlech','wg_provisorische_trinkwasser_schutzzonen':'Provisoresch DrÃ©nkwaasserschutzgebidder','wg_sanitare_schutzzonen_stausee':'SanitÃ¤r Schutzzone StausÃ©i','wg_trinkwasserbehalter':'DrÃ©nkwaasserbehÃ¤lter','wg_naturliche_(bassin)':'Natierleche Baseng','wg_grundwasserleiter':'Grondwasserleeder','wg_einzugsgebiete':'Anzuchsgebidder','wg_niederschlag':'Nidderschlag','wg_timis_wassertiefe_hq100':'DÃ©ift 100 jÃ¤hrlecht HW','wg_relief':'Relief','wg_durchgangigkeit':'DurchgÃ¤ngegkeet','wg_abwasser_syndikate':'Oofwaassersyndikater','wg_kanal__muhlgraben':'Kanal, Millekanal','wg_grundwasserkorper':'Grondwaasserkierper','wg_timis_ueberflutungsflachen_hq10':'ISG 10-jÃ¤hrlech','wg_bohrungen':'Buerung','wg_timis_ueberflutungsflachen_ehq':'ISG extrem','wg_timis_hochwasser_gefahrdungen':'Geforenklassen','wg_hmwb_(stark_modifizierte_wasserkorper)':'Staark modifizÃ©iert Waasserkierper','wg_uesg_1993_(ausser_mosel)':'ISG 1993 (ausser Musel)','wg_gewasserentwicklungsfahigkeit':'GewÃ¤sserentwÃ©cklungsfÃ¤hegkeet','wg_stausee_sauer':'StausÃ©i Sauer','wg_nebengewasser':'NiewengewÃ¤sser','wg_grundwasser':'Alluvialen Grondwaasserspigel','wg_timis_wassertiefe_hq10':'DÃ©ift 10 jÃ¤hrlecht HW','wg_relief_dhm_2m':'Relief DHM 2m','wg_lufttemperatur':'Lofttemperatur','wg_trinkwasserentnahmepunkte':'DrÃ©nkwaasserentnamepunkten','wg_uesg_1983___mosel':'ISG 1983  - Musel','Zoom to the max extent':'Ganz LÃ«tzebuerg','permalink action':'Link','print action':'DrÃ«cken','Search':'Sich','Catalog':'Katalog','Layer Selection':'Auswiel','Warning screen resolution':'Warnung BildschirmoplÃ©isung','Ihre BildschirmauflÃ¶sung ist kleiner als 1024x768 pixels. map.geo.admin.ch is not optmized for small screen resolution.':'Ã„er BildschirmoplÃ©isung ass mÃ©i kleng wÃ©i 1024x768 Pixel. map.geoportail.lu ass net fier eng kleng BildschirmauflÃ¶sung optimÃ©iert.','Full map':'Grouss Kaart','Geo search...':'Sich no Adress, Parzell, Uertschaft, Koordinaten ...','searchQuicktip':'Hei kÃ«nnt dir noch Adressen, Parzellen, Uertschaften, Flouernimm oder Koordinaten sichen.<p>E puer Beispiller: <li><b>Addressen: </b>Fir "54, avenue Gaston Diderich" <i>tippt der 54 Did</i><li><b>Parzellen :</b> Fir "614/4236 zu LÃ«tzebuerg, Merl-Nord" <i>tippt der 614/4236</i>','slidertip':'<center>Benotzt dÃ«se Schieber <p> fir stufelos tÃ«scht <p> Loftbild and Toposkaart ze wiesselen<p>  <img src=\'http://map.geoportail.lu/gfx/slider_illustration.png\' width=90 height=30> </center>','show column':'LayerlÃ«scht uweisen','hide column':'LayerlÃ«scht verstoppen','Map URL':'Deen Ã«nnestoende Link an eng Email abannen','URL':'URL','Basisdaten':'Basisdaten','Referenzsysteme':'Referenzsystemer','Geografische Namen':'GeographÃ«sch Nimm','Administrative Einheiten':'Administrativ Eenheeten','Bodennutzung':'Buedemnotzung','Biologie':'Biologie','Versorgungswirtschaft und staatliche Dienste':'Versuergungs- an Ã¶ffentlech DÃ«ngschter','Wasserrahmenrichtlinie':'Waasserramerichtlinn (WRRL)','Adressen':'Adressen','addresses':'Adressen','FlurstÃ¼cke / GrundstÃ¼cke':'Kadasterdaten','cadastre':'Kadasterplang','parcels':'Kadasterparzellen','parcels_labels':'Kadasterparzellen (Nummeren)','communes_cadastrales_labels':'Kadastergemengen (Nimm)','sections_cadastrales_labels':'Kadastersektiounen (Nimm)','communes_cadastrales':'Kadastergemengen','sections_cadastrales':'Kadastersektiounen','feuilles_cadastrales':'Kadaster UrplÃ¤ng','toponymes':'Kadaster-Flouernimm','OberflÃ¤chendarstellung':'UewerflÃ¤chenduerstellung','GewÃ¤ssernetz':'GewÃ¤ssernetz','HÃ¶he':'HÃ©icht','Bodenbedeckung':'Buedembedeckung','Luft und Satellitenbilder':'Loft a Satellitebilder','Raum und BevÃ¶lkerung':'Raum a BevÃ¶lkerung','Gesundheit une Sicherheit':'Gesondheet a SÃ«cherheet','BevÃ¶lkerungsdichte':'BevÃ¶lkerungsverdeelung','Raumplanung':'Raumplanung an -entwicklung','Infrastrucktur une Kommunikation':'Infrastruktur a Kommunikation','Verkehrsnetze':'VerkÃ©iersnetzer','GebÃ¤ude':'Gebeier','Ã–ffentliche Einrichtungen und Dienste':'Ã–ffentlech Ariichtungen','Umwelt, Biologie und Geologie':'Ã‹mwelt, Biologie a Geologie','Schutzgebiete':'Schutzgebidder','Geologie':'Geologie','Boden':'Buedem','UmweltÃ¼berwachung':'Ã‹mweltiwwerwaachung','NatÃ¼rliche Risikozonen':'Natierlech Risikozonen','AtmosphÃ¤rische Bedingungen':'AtmosphÃ¤resch Bedingungen','Meteorologie':'Meteorologie','Biogeografische Regionen':'BiogeographÃ«sch Regiounen','LebensrÃ¤ume une Biotope':'Liewensreim a Biotoper','Artenvielfalt':'Artevillfalt','Mineralische BodenschÃ¤tze':'MineralÃ«sch BuedemschÃ¤tz','Energie und Wirtschaft':'Energie a Wirtschaft','Statistische Einheiten':'Statistisch Eenheeten','Landnutzung':'Landnotzung','Produktions- und Industrieanlagen':'Produktiouns- an Industrieanlagen','Land- und Wassertwirtschaft':'Land- a Waassertwirtschaft','Energiequellen':'Energiequellen','Plan sÃ©cheresse':'Plang fir DrÃ©chent','tour_rando':'Wander- a VelosweeÃ«r','tour_pistes_vtt':'Mountainbike-WeeÃ«r','tour_mullerthal_trail':'Mullerthal Trail','tour_saint_jacques':'Saint-Jacques Wee','tour_sentiers_nationaux':'National WanderweeÃ«r','tour_sentiers_ajl':'AJL WeeÃ«r','tour_sentiers_gr':'Grouss WanderweeÃ«r','tour_autopedestre':'AutopÃ©destres','tour_pistes_velo':'VelosweeÃ«r','Meteo':'Wiederdaten','Stations mÃ©tÃ©o':'Wiederstatiounen','PAG':'PAG','ac_wellenstein_pag_complet':'Komplettiwersiicht','ac_wellenstein_pag_zones':'Zonen','ac_wellenstein_pag_limites':'Limitem','ac_wellenstein_pag_voies_acces':'ZougangsweeÃ«r','ac_wellenstein_pag_perimetres_zones':'Zoneperimeter','ac_wellenstein_pag_volumes_a_sauvegarder':'Ze erhale FlÃ¤chen','ac_wellenstein_pag_alignements_a_preserver':'Ze erhalen Alignementer','ac_wellenstein_pag_volumes_batiments':'Gebaier','show layer options':'Layeroptiounen uweisen','hide layer options':'Layeroptiounen ausblenden','Opacity:':'Transparenz','about that layer':'Informatiounen zu dÃ«sem Datesatz','move layer up':'Layer-Reihenfolg Ã¤nneren','move layer down':'Layer-Reihenfolg Ã¤nneren','remove layer':'Datesatz entfernen','Feature tooltip':'Objektinformatioun','Aerial Images':'Loftbild','pixelmaps-color':'Topographesch Kaart','pixelmaps-gray':'Topographesch Kaart S/W','voidLayer':'Keen Hannergrond','aerial attribution':'Loftild: ACT 2010','pixelmap-color attribution':'Topographesch Kaart: ACT','pixelmap-gray attribution':'Topographesch Kaart S/W: ACT','loadingText':"Lueden Daten ...",'Search data...':'Daten suihen...','Warning Internet Explorer 6':'Warnung Internet Explorer 6','You are using Internet Explorer 6.':'Dier benotzt Internet Explorer 6.','We recommend to upgrade to a newer release.':'Mir empfehlen, eng mÃ©i nei Versioun ze benotzen.','You can add only 5 layers in the layer tree.':'Dier kÃ«nnt nÃ«mmen 5 Layer auswielen.','Layer metadata':'','Layer legend':'','PDF':'DrÃ«cken','mf.print.scale':'Moossstab','mf.print.print':'PDF','mf.print.generatingPDF':'DrÃ«cken...','Position':'','redlining action':'Zeechnen','Direction':'Richtung','Description':'Beschreiwung','Distance':'Distanz','Temps':'ZÃ¤it','Descriptif':'Beschreiwung','Longitude':'LÃ¤ngegrad','Latitude':'Breetegrad','Nom':'Numm','Mode de transport':'Transportmodus','PiÃ©ton':'FoussgÃ¤nger','Voiture':'Auto','Taxi':'Taxi','Camion':'Camion','VÃ©lo':'Velo','Ambulance':'Ambulanz','Type d\'itinÃ©raire':'Berechnungsart','Le plus rapide':'Schnellste Wee','Pas de pÃ©age':'Ouni PÃ©age','Le plus court':'Kierzste Wew','Rajouter point':'Punkt bÃ¤ifÃ¼gen','RÃ©initialiser':'ReinitialisÃ©iren','Calculer itinÃ©raire':'Wee berechnen','CritÃ¨res':'KritÃ¨ren','ArrÃªts':'Weepunkten','Chercher adresse':'Adress sichen','double clic pour enlever un point, cliquer-glisser pour changer l\'ordre':'Duebelklick fir ee Punkt ze lÃ¤schen, Drag&Drop fir d\'Reihefolg ze Ã¤nneren','Rajoutez des points en cliquant dans la carte ou en cherchant des adresses':'Dir kÃ«nnt Punkten dÃ©finÃ©iren, andeems der eng Adress an dem Sichfeld Ã«nnendrÃ«nner antippt oder andeems der an d\'Kaart klickt, nodeems der op de KnÃ¤ppchen hei uewendriwwer geklickt hutt. <br><br>Wann ee Punkt op der Kaart ugewise gett, kÃ«nnt der en bewegen andeems der drop klickt an en dann matt der Maus verschiebt.','geoadmin.profile.exportCSV':'CSV exportÃ©iren','geoadmin.profile':'HÃ©ichteprofil','geoadmin.profile.tooSmall':'Profillinn ze kuerz','geoadmin.profile.tooLong':'Zevill Punkten fir d\'Profillinn','mf.print.print':'PDF','mf.print.generatingPDF':'Print...','Edit Feature':'Objekt editÃ©iren','mymaps.title':'MÃ«ng Kaarten','mymaps.infomsg':'"MÃ«ng Kaarten" erlaabt et, personalisÃ©iert Kaarten (gelueden Layer an geografesch Ausdehnung) ze erstellen an egen Informatiounen (Punkten, Linnen, FlÃ¤chen, Texter) derbÃ¤i ze setzen. <br/> Dir kÃ«nnt d\'Kaarten ofspeicheren an un anerer weidergin ...<br/> Fir Ã¤r egen Karten ze erstellen, musst dir Iech (uewe riets) aloggen. Falls der nach keen Kont am Geoportal hutt, kÃ«nnt dir <a href=http://shop.geoportail.lu/Portail/menuAction.do?dispatch=load&menuToLoad=newClient&keepMenu=false&lang=lu target="_blank">hei</a> een uleeÃ«n.','mymaps.export.txt':'ExportÃ©iren','mymaps.export.msg':'Kaart matt allen Objekter exportÃ©iren','mymaps.export.feature.msg':'DÃ«sen Objet exportÃ©iren','mymaps.leavecomment':'Kommentar verfaassen','mymaps.comment':'Kommentar','mymaps.send':'SchÃ«cken','mymaps.sent':'GeschÃ«ckt','mymaps.no_map':'Keng Kaart verfÃ¼gbar','mymaps.create_new':'Nei Kaart erstellen','mymaps.back_to_list':'LÃ«scht vun de Kaarten','mymaps.save':'SpÃ¤icheren','mymaps.saved':'GespÃ¤ichert','mymaps.form.title':'Titel','mymaps.form.description':'Beschreiwung','mymaps.public':'Ã–ffentlech','mymaps.import':'ImportÃ©iren','mymaps.importtip':'ImportÃ©iren vun geografÃ«schen Informatiounen aus enger GPX oder KML Datei','mymaps.copy_to_own_maps':'Eng Kopie vun der Kaart erstellen','mymaps.modify':'EditÃ©iren','mymaps.defaulttitle':'Ouni Titel','mymaps.advanced':'Erweidert Optiounen','mymaps.zoom_to':'Zoomen','mymaps.show_profile':'HÃ©ichteprofil uweisen','mymaps.length':'LÃ¤ngt : ${length}','mymaps.area':'FlÃ¤ch : ${area}','mymaps.unsupportedfiletitle':'Dateitipp net Ã«nnerstÃ«tzt','mymaps.unsupportedfilemsg':'NÃ«mme GPX oder KML - Dateien kÃ«nnen importÃ©iert ginn.','mymaps.unsupportedimagetypemsg':'NÃ«mmen Dateien mat der Erweiderung .gif, .png, .jpg oder .jpeg ginn ugeholl.','mymaps.loading':'Lueden','mymaps.name':'Numm','mymaps.mail':'E-mail','mymaps.description':'Beschreiwung','mymaps.deleteimage':'LÃ¤schen','mymaps.image':'Bild','mymaps.uploadimagetip':'Bild derbÃ¤isetzen oder Ã¤nneren','mymaps.delete':'LÃ¤schen','mymaps.confirm_map_deletion':'Sidd Dir sÃ«cher, datt dir des Kaart lÃ¤sche wÃ«llt ?','mymaps.linkmsg':'KopÃ©iert folgende Link, fir en un Ã¤er FrÃ«nn weiderzeleeden: ','mymaps.map_created_by':'Kaart erstellt vum ','mymaps.not_saved_modifications':'VerÃ¤nnerungen net gespÃ¤ichert','mymaps.not_saved_modifications_msg':'Dir hutt di lÃ¤scht Ã„nnerungen nach net ofgespÃ¤ichert.<br/> WÃ«llt Dir lo spÃ¤icheren ?','mymaps.comment.success':'Kommentar erfollÃ«greich fortgeschÃ«ckt.','mymaps.comment.failure':'Problem beim FortschÃ«cken vun aerem Kommentar.','mymaps.comment.invalidCaptcha':'Dir hutt ee falsche SÃ«cherheetscode agin.','mymaps.category':'Kategorie','mymaps.no_category':'-- Keng Kategorie --','mymaps.link_tip':'Klickt hier, fir ee Link ob dÃ«s Kaart ze krÃ©ien.','mymaps.ratings':'Meenung(en)','mymaps.rating_ok':'Ã„er Meenung guff berÃ¼cksichtegt. Merci.','mymaps.color':'Faarw','mymaps.width':'Breet','User generated public maps':'Vu Benotzer publizÃ©ierte Contenu'};Proj4js={defaultDatum:'WGS84',transform:function(source,dest,point){if(!source.readyToUse||!dest.readyToUse){this.reportError("Proj4js initialization for "+source.srsCode+" not yet complete");return point;}
if((source.srsProjNumber=="900913"&&dest.datumCode!="WGS84")||(dest.srsProjNumber=="900913"&&source.datumCode!="WGS84")){var wgs84=Proj4js.WGS84;this.transform(source,wgs84,point);source=wgs84;}
if(source.projName=="longlat"){point.x*=Proj4js.common.D2R;point.y*=Proj4js.common.D2R;}else{if(source.to_meter){point.x*=source.to_meter;point.y*=source.to_meter;}
source.inverse(point);}
if(source.from_greenwich){point.x+=source.from_greenwich;}
point=this.datum_transform(source.datum,dest.datum,point);if(dest.from_greenwich){point.x-=dest.from_greenwich;}
if(dest.projName=="longlat"){point.x*=Proj4js.common.R2D;point.y*=Proj4js.common.R2D;}else{dest.forward(point);if(dest.to_meter){point.x/=dest.to_meter;point.y/=dest.to_meter;}}
return point;},datum_transform:function(source,dest,point){if(source.compare_datums(dest)){return point;}
if(source.datum_type==Proj4js.common.PJD_NODATUM||dest.datum_type==Proj4js.common.PJD_NODATUM){return point;}
if(source.datum_type==Proj4js.common.PJD_GRIDSHIFT)
{alert("ERROR: Grid shift transformations are not implemented yet.");}
if(dest.datum_type==Proj4js.common.PJD_GRIDSHIFT)
{alert("ERROR: Grid shift transformations are not implemented yet.");}
if(source.es!=dest.es||source.a!=dest.a||source.datum_type==Proj4js.common.PJD_3PARAM||source.datum_type==Proj4js.common.PJD_7PARAM||dest.datum_type==Proj4js.common.PJD_3PARAM||dest.datum_type==Proj4js.common.PJD_7PARAM)
{source.geodetic_to_geocentric(point);if(source.datum_type==Proj4js.common.PJD_3PARAM||source.datum_type==Proj4js.common.PJD_7PARAM){source.geocentric_to_wgs84(point);}
if(dest.datum_type==Proj4js.common.PJD_3PARAM||dest.datum_type==Proj4js.common.PJD_7PARAM){dest.geocentric_from_wgs84(point);}
dest.geocentric_to_geodetic(point);}
if(dest.datum_type==Proj4js.common.PJD_GRIDSHIFT)
{alert("ERROR: Grid shift transformations are not implemented yet.");}
return point;},reportError:function(msg){},extend:function(destination,source){destination=destination||{};if(source){for(var property in source){var value=source[property];if(value!==undefined){destination[property]=value;}}}
return destination;},Class:function(){var Class=function(){this.initialize.apply(this,arguments);};var extended={};var parent;for(var i=0;i<arguments.length;++i){if(typeof arguments[i]=="function"){parent=arguments[i].prototype;}else{parent=arguments[i];}
Proj4js.extend(extended,parent);}
Class.prototype=extended;return Class;},bind:function(func,object){var args=Array.prototype.slice.apply(arguments,[2]);return function(){var newArgs=args.concat(Array.prototype.slice.apply(arguments,[0]));return func.apply(object,newArgs);};},scriptName:"proj4js-combined.js",defsLookupService:'http://spatialreference.org/ref',libPath:null,getScriptLocation:function(){if(this.libPath)return this.libPath;var scriptName=this.scriptName;var scriptNameLen=scriptName.length;var scripts=document.getElementsByTagName('script');for(var i=0;i<scripts.length;i++){var src=scripts[i].getAttribute('src');if(src){var index=src.lastIndexOf(scriptName);if((index>-1)&&(index+scriptNameLen==src.length)){this.libPath=src.slice(0,-scriptNameLen);break;}}}
return this.libPath||"";},loadScript:function(url,onload,onfail,loadCheck){var script=document.createElement('script');script.defer=false;script.type="text/javascript";script.id=url;script.src=url;script.onload=onload;script.onerror=onfail;script.loadCheck=loadCheck;if(/MSIE/.test(navigator.userAgent)){script.onreadystatechange=this.checkReadyState;}
document.getElementsByTagName('head')[0].appendChild(script);},checkReadyState:function(){if(this.readyState=='loaded'){if(!this.loadCheck()){this.onerror();}else{this.onload();}}}};Proj4js.Proj=Proj4js.Class({readyToUse:false,title:null,projName:null,units:null,datum:null,initialize:function(srsCode){this.srsCodeInput=srsCode;if(srsCode.indexOf('urn:')==0){var urn=srsCode.split(':');if((urn[1]=='ogc'||urn[1]=='x-ogc')&&(urn[2]=='def')&&(urn[3]=='crs')&&urn.length==7){srsCode=urn[4]+':'+urn[6];}}else if(srsCode.indexOf('http://')==0){var url=srsCode.split('#');if(url[0].match(/epsg.org/)){srsCode='EPSG:'+url[1];}else if(url[0].match(/RIG.xml/)){srsCode='IGNF:'+url[1];}}
this.srsCode=srsCode.toUpperCase();if(this.srsCode.indexOf("EPSG")==0){this.srsCode=this.srsCode;this.srsAuth='epsg';this.srsProjNumber=this.srsCode.substring(5);}else if(this.srsCode.indexOf("IGNF")==0){this.srsCode=this.srsCode;this.srsAuth='IGNF';this.srsProjNumber=this.srsCode.substring(5);}else if(this.srsCode.indexOf("CRS")==0){this.srsCode=this.srsCode;this.srsAuth='CRS';this.srsProjNumber=this.srsCode.substring(4);}else{this.srsAuth='';this.srsProjNumber=this.srsCode;}
this.loadProjDefinition();},loadProjDefinition:function(){if(Proj4js.defs[this.srsCode]){this.defsLoaded();return;}
var url=Proj4js.getScriptLocation()+'defs/'+this.srsAuth.toUpperCase()+this.srsProjNumber+'.js';Proj4js.loadScript(url,Proj4js.bind(this.defsLoaded,this),Proj4js.bind(this.loadFromService,this),Proj4js.bind(this.checkDefsLoaded,this));},loadFromService:function(){var url=Proj4js.defsLookupService+'/'+this.srsAuth+'/'+this.srsProjNumber+'/proj4js/';Proj4js.loadScript(url,Proj4js.bind(this.defsLoaded,this),Proj4js.bind(this.defsFailed,this),Proj4js.bind(this.checkDefsLoaded,this));},defsLoaded:function(){this.parseDefs();this.loadProjCode(this.projName);},checkDefsLoaded:function(){if(Proj4js.defs[this.srsCode]){return true;}else{return false;}},defsFailed:function(){Proj4js.reportError('failed to load projection definition for: '+this.srsCode);Proj4js.defs[this.srsCode]=Proj4js.defs['WGS84'];this.defsLoaded();},loadProjCode:function(projName){if(Proj4js.Proj[projName]){this.initTransforms();return;}
var url=Proj4js.getScriptLocation()+'projCode/'+projName+'.js';Proj4js.loadScript(url,Proj4js.bind(this.loadProjCodeSuccess,this,projName),Proj4js.bind(this.loadProjCodeFailure,this,projName),Proj4js.bind(this.checkCodeLoaded,this,projName));},loadProjCodeSuccess:function(projName){if(Proj4js.Proj[projName].dependsOn){this.loadProjCode(Proj4js.Proj[projName].dependsOn);}else{this.initTransforms();}},loadProjCodeFailure:function(projName){Proj4js.reportError("failed to find projection file for: "+projName);},checkCodeLoaded:function(projName){if(Proj4js.Proj[projName]){return true;}else{return false;}},initTransforms:function(){Proj4js.extend(this,Proj4js.Proj[this.projName]);this.init();this.readyToUse=true;},parseDefs:function(){this.defData=Proj4js.defs[this.srsCode];var paramName,paramVal;if(!this.defData){return;}
var paramArray=this.defData.split("+");for(var prop=0;prop<paramArray.length;prop++){var property=paramArray[prop].split("=");paramName=property[0].toLowerCase();paramVal=property[1];switch(paramName.replace(/\s/gi,"")){case"":break;case"title":this.title=paramVal;break;case"proj":this.projName=paramVal.replace(/\s/gi,"");break;case"units":this.units=paramVal.replace(/\s/gi,"");break;case"datum":this.datumCode=paramVal.replace(/\s/gi,"");break;case"nadgrids":this.nagrids=paramVal.replace(/\s/gi,"");break;case"ellps":this.ellps=paramVal.replace(/\s/gi,"");break;case"a":this.a=parseFloat(paramVal);break;case"b":this.b=parseFloat(paramVal);break;case"rf":this.rf=parseFloat(paramVal);break;case"lat_0":this.lat0=paramVal*Proj4js.common.D2R;break;case"lat_1":this.lat1=paramVal*Proj4js.common.D2R;break;case"lat_2":this.lat2=paramVal*Proj4js.common.D2R;break;case"lat_ts":this.lat_ts=paramVal*Proj4js.common.D2R;break;case"lon_0":this.long0=paramVal*Proj4js.common.D2R;break;case"alpha":this.alpha=parseFloat(paramVal)*Proj4js.common.D2R;break;case"lonc":this.longc=paramVal*Proj4js.common.D2R;break;case"x_0":this.x0=parseFloat(paramVal);break;case"y_0":this.y0=parseFloat(paramVal);break;case"k_0":this.k0=parseFloat(paramVal);break;case"k":this.k0=parseFloat(paramVal);break;case"r_a":this.R_A=true;break;case"zone":this.zone=parseInt(paramVal);break;case"south":this.utmSouth=true;break;case"towgs84":this.datum_params=paramVal.split(",");break;case"to_meter":this.to_meter=parseFloat(paramVal);break;case"from_greenwich":this.from_greenwich=paramVal*Proj4js.common.D2R;break;case"pm":paramVal=paramVal.replace(/\s/gi,"");this.from_greenwich=Proj4js.PrimeMeridian[paramVal]?Proj4js.PrimeMeridian[paramVal]:parseFloat(paramVal);this.from_greenwich*=Proj4js.common.D2R;break;case"no_defs":break;default:}}
this.deriveConstants();},deriveConstants:function(){if(this.nagrids=='@null')this.datumCode='none';if(this.datumCode&&this.datumCode!='none'){var datumDef=Proj4js.Datum[this.datumCode];if(datumDef){this.datum_params=datumDef.towgs84.split(',');this.ellps=datumDef.ellipse;this.datumName=datumDef.datumName?datumDef.datumName:this.datumCode;}}
if(!this.a){var ellipse=Proj4js.Ellipsoid[this.ellps]?Proj4js.Ellipsoid[this.ellps]:Proj4js.Ellipsoid['WGS84'];Proj4js.extend(this,ellipse);}
if(this.rf&&!this.b)this.b=(1.0-1.0/this.rf)*this.a;if(Math.abs(this.a-this.b)<Proj4js.common.EPSLN){this.sphere=true;this.b=this.a;}
this.a2=this.a*this.a;this.b2=this.b*this.b;this.es=(this.a2-this.b2)/this.a2;this.e=Math.sqrt(this.es);if(this.R_A){this.a*=1.-this.es*(Proj4js.common.SIXTH+this.es*(Proj4js.common.RA4+this.es*Proj4js.common.RA6));this.a2=this.a*this.a;this.b2=this.b*this.b;this.es=0.;}
this.ep2=(this.a2-this.b2)/this.b2;if(!this.k0)this.k0=1.0;this.datum=new Proj4js.datum(this);}});Proj4js.Proj.longlat={init:function(){},forward:function(pt){return pt;},inverse:function(pt){return pt;}};Proj4js.defs={'WGS84':"+title=long/lat:WGS84 +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees",'EPSG:4326':"+title=long/lat:WGS84 +proj=longlat +a=6378137.0 +b=6356752.31424518 +ellps=WGS84 +datum=WGS84 +units=degrees",'EPSG:4269':"+title=long/lat:NAD83 +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees",'EPSG:3785':"+title= Google Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"};Proj4js.defs['GOOGLE']=Proj4js.defs['EPSG:3785'];Proj4js.defs['EPSG:900913']=Proj4js.defs['EPSG:3785'];Proj4js.defs['EPSG:102113']=Proj4js.defs['EPSG:3785'];Proj4js.common={PI:3.141592653589793238,HALF_PI:1.570796326794896619,TWO_PI:6.283185307179586477,FORTPI:0.78539816339744833,R2D:57.29577951308232088,D2R:0.01745329251994329577,SEC_TO_RAD:4.84813681109535993589914102357e-6,EPSLN:1.0e-10,MAX_ITER:20,COS_67P5:0.38268343236508977,AD_C:1.0026000,PJD_UNKNOWN:0,PJD_3PARAM:1,PJD_7PARAM:2,PJD_GRIDSHIFT:3,PJD_WGS84:4,PJD_NODATUM:5,SRS_WGS84_SEMIMAJOR:6378137.0,SIXTH:.1666666666666666667,RA4:.04722222222222222222,RA6:.02215608465608465608,RV4:.06944444444444444444,RV6:.04243827160493827160,msfnz:function(eccent,sinphi,cosphi){var con=eccent*sinphi;return cosphi/(Math.sqrt(1.0-con*con));},tsfnz:function(eccent,phi,sinphi){var con=eccent*sinphi;var com=.5*eccent;con=Math.pow(((1.0-con)/(1.0+con)),com);return(Math.tan(.5*(this.HALF_PI-phi))/con);},phi2z:function(eccent,ts){var eccnth=.5*eccent;var con,dphi;var phi=this.HALF_PI-2*Math.atan(ts);for(i=0;i<=15;i++){con=eccent*Math.sin(phi);dphi=this.HALF_PI-2*Math.atan(ts*(Math.pow(((1.0-con)/(1.0+con)),eccnth)))-phi;phi+=dphi;if(Math.abs(dphi)<=.0000000001)return phi;}
alert("phi2z has NoConvergence");return(-9999);},qsfnz:function(eccent,sinphi,cosphi){var con;if(eccent>1.0e-7){con=eccent*sinphi;return((1.0-eccent*eccent)*(sinphi/(1.0-con*con)-(.5/eccent)*Math.log((1.0-con)/(1.0+con))));}else{return(2.0*sinphi);}},asinz:function(x){if(Math.abs(x)>1.0){x=(x>1.0)?1.0:-1.0;}
return Math.asin(x);},e0fn:function(x){return(1.0-0.25*x*(1.0+x/16.0*(3.0+1.25*x)));},e1fn:function(x){return(0.375*x*(1.0+0.25*x*(1.0+0.46875*x)));},e2fn:function(x){return(0.05859375*x*x*(1.0+0.75*x));},e3fn:function(x){return(x*x*x*(35.0/3072.0));},mlfn:function(e0,e1,e2,e3,phi){return(e0*phi-e1*Math.sin(2.0*phi)+e2*Math.sin(4.0*phi)-e3*Math.sin(6.0*phi));},srat:function(esinp,exp){return(Math.pow((1.0-esinp)/(1.0+esinp),exp));},sign:function(x){if(x<0.0)return(-1);else return(1);},adjust_lon:function(x){x=(Math.abs(x)<this.PI)?x:(x-(this.sign(x)*this.TWO_PI));return x;},adjust_lat:function(x){x=(Math.abs(x)<this.HALF_PI)?x:(x-(this.sign(x)*this.PI));return x;},latiso:function(eccent,phi,sinphi)
{if(Math.abs(phi)>this.HALF_PI)return+Number.NaN;if(phi==this.HALF_PI)return Number.POSITIVE_INFINITY;if(phi==-1.0*this.HALF_PI)return-1.0*Number.POSITIVE_INFINITY;var con=eccent*sinphi;return Math.log(Math.tan((this.HALF_PI+phi)/2.0))+eccent*Math.log((1.0-con)/(1.0+con))/2.0;},fL:function(x,L){return 2.0*Math.atan(x*Math.exp(L))-this.HALF_PI;},invlatiso:function(eccent,ts){var phi=this.fL(1.0,ts);var Iphi=0.0;var con=0.0;do{Iphi=phi;con=eccent*Math.sin(Iphi);phi=this.fL(Math.exp(eccent*Math.log((1.0+con)/(1.0-con))/2.0),ts)}while(Math.abs(phi-Iphi)>1.0e-12);return phi;},sinh:function(x)
{var r=Math.exp(x);r=(r-1.0/r)/2.0;return r;},cosh:function(x)
{var r=Math.exp(x);r=(r+1.0/r)/2.0;return r;},tanh:function(x)
{var r=Math.exp(x);r=(r-1.0/r)/(r+1.0/r);return r;},asinh:function(x)
{var s=(x>=0?1.0:-1.0);return s*(Math.log(Math.abs(x)+Math.sqrt(x*x+1.0)));},acosh:function(x)
{return 2.0*Math.log(Math.sqrt((x+1.0)/2.0)+Math.sqrt((x-1.0)/2.0));},atanh:function(x)
{return Math.log((x-1.0)/(x+1.0))/2.0;},gN:function(a,e,sinphi)
{var temp=e*sinphi;return a/Math.sqrt(1.0-temp*temp);}};Proj4js.datum=Proj4js.Class({initialize:function(proj){this.datum_type=Proj4js.common.PJD_WGS84;if(proj.datumCode&&proj.datumCode=='none'){this.datum_type=Proj4js.common.PJD_NODATUM;}
if(proj&&proj.datum_params){for(var i=0;i<proj.datum_params.length;i++){proj.datum_params[i]=parseFloat(proj.datum_params[i]);}
if(proj.datum_params[0]!=0||proj.datum_params[1]!=0||proj.datum_params[2]!=0){this.datum_type=Proj4js.common.PJD_3PARAM;}
if(proj.datum_params.length>3){if(proj.datum_params[3]!=0||proj.datum_params[4]!=0||proj.datum_params[5]!=0||proj.datum_params[6]!=0){this.datum_type=Proj4js.common.PJD_7PARAM;proj.datum_params[3]*=Proj4js.common.SEC_TO_RAD;proj.datum_params[4]*=Proj4js.common.SEC_TO_RAD;proj.datum_params[5]*=Proj4js.common.SEC_TO_RAD;proj.datum_params[6]=(proj.datum_params[6]/1000000.0)+1.0;}}}
if(proj){this.a=proj.a;this.b=proj.b;this.es=proj.es;this.ep2=proj.ep2;this.datum_params=proj.datum_params;}},compare_datums:function(dest){if(this.datum_type!=dest.datum_type){return false;}else if(this.a!=dest.a||Math.abs(this.es-dest.es)>0.000000000050){return false;}else if(this.datum_type==Proj4js.common.PJD_3PARAM){return(this.datum_params[0]==dest.datum_params[0]&&this.datum_params[1]==dest.datum_params[1]&&this.datum_params[2]==dest.datum_params[2]);}else if(this.datum_type==Proj4js.common.PJD_7PARAM){return(this.datum_params[0]==dest.datum_params[0]&&this.datum_params[1]==dest.datum_params[1]&&this.datum_params[2]==dest.datum_params[2]&&this.datum_params[3]==dest.datum_params[3]&&this.datum_params[4]==dest.datum_params[4]&&this.datum_params[5]==dest.datum_params[5]&&this.datum_params[6]==dest.datum_params[6]);}else if(this.datum_type==Proj4js.common.PJD_GRIDSHIFT){return strcmp(pj_param(this.params,"snadgrids").s,pj_param(dest.params,"snadgrids").s)==0;}else{return true;}},geodetic_to_geocentric:function(p){var Longitude=p.x;var Latitude=p.y;var Height=p.z?p.z:0;var X;var Y;var Z;var Error_Code=0;var Rn;var Sin_Lat;var Sin2_Lat;var Cos_Lat;if(Latitude<-Proj4js.common.HALF_PI&&Latitude>-1.001*Proj4js.common.HALF_PI){Latitude=-Proj4js.common.HALF_PI;}else if(Latitude>Proj4js.common.HALF_PI&&Latitude<1.001*Proj4js.common.HALF_PI){Latitude=Proj4js.common.HALF_PI;}else if((Latitude<-Proj4js.common.HALF_PI)||(Latitude>Proj4js.common.HALF_PI)){Proj4js.reportError('geocent:lat out of range:'+Latitude);return null;}
if(Longitude>Proj4js.common.PI)Longitude-=(2*Proj4js.common.PI);Sin_Lat=Math.sin(Latitude);Cos_Lat=Math.cos(Latitude);Sin2_Lat=Sin_Lat*Sin_Lat;Rn=this.a/(Math.sqrt(1.0e0-this.es*Sin2_Lat));X=(Rn+Height)*Cos_Lat*Math.cos(Longitude);Y=(Rn+Height)*Cos_Lat*Math.sin(Longitude);Z=((Rn*(1-this.es))+Height)*Sin_Lat;p.x=X;p.y=Y;p.z=Z;return Error_Code;},geocentric_to_geodetic:function(p){var genau=1.E-12;var genau2=(genau*genau);var maxiter=30;var P;var RR;var CT;var ST;var RX;var RK;var RN;var CPHI0;var SPHI0;var CPHI;var SPHI;var SDPHI;var At_Pole;var iter;var X=p.x;var Y=p.y;var Z=p.z?p.z:0.0;var Longitude;var Latitude;var Height;At_Pole=false;P=Math.sqrt(X*X+Y*Y);RR=Math.sqrt(X*X+Y*Y+Z*Z);if(P/this.a<genau){At_Pole=true;Longitude=0.0;if(RR/this.a<genau){Latitude=Proj4js.common.HALF_PI;Height=-this.b;return;}}else{Longitude=Math.atan2(Y,X);}
CT=Z/RR;ST=P/RR;RX=1.0/Math.sqrt(1.0-this.es*(2.0-this.es)*ST*ST);CPHI0=ST*(1.0-this.es)*RX;SPHI0=CT*RX;iter=0;do
{iter++;RN=this.a/Math.sqrt(1.0-this.es*SPHI0*SPHI0);Height=P*CPHI0+Z*SPHI0-RN*(1.0-this.es*SPHI0*SPHI0);RK=this.es*RN/(RN+Height);RX=1.0/Math.sqrt(1.0-RK*(2.0-RK)*ST*ST);CPHI=ST*(1.0-RK)*RX;SPHI=CT*RX;SDPHI=SPHI*CPHI0-CPHI*SPHI0;CPHI0=CPHI;SPHI0=SPHI;}
while(SDPHI*SDPHI>genau2&&iter<maxiter);Latitude=Math.atan(SPHI/Math.abs(CPHI));p.x=Longitude;p.y=Latitude;p.z=Height;return p;},geocentric_to_geodetic_noniter:function(p){var X=p.x;var Y=p.y;var Z=p.z?p.z:0;var Longitude;var Latitude;var Height;var W;var W2;var T0;var T1;var S0;var S1;var Sin_B0;var Sin3_B0;var Cos_B0;var Sin_p1;var Cos_p1;var Rn;var Sum;var At_Pole;X=parseFloat(X);Y=parseFloat(Y);Z=parseFloat(Z);At_Pole=false;if(X!=0.0)
{Longitude=Math.atan2(Y,X);}
else
{if(Y>0)
{Longitude=Proj4js.common.HALF_PI;}
else if(Y<0)
{Longitude=-Proj4js.common.HALF_PI;}
else
{At_Pole=true;Longitude=0.0;if(Z>0.0)
{Latitude=Proj4js.common.HALF_PI;}
else if(Z<0.0)
{Latitude=-Proj4js.common.HALF_PI;}
else
{Latitude=Proj4js.common.HALF_PI;Height=-this.b;return;}}}
W2=X*X+Y*Y;W=Math.sqrt(W2);T0=Z*Proj4js.common.AD_C;S0=Math.sqrt(T0*T0+W2);Sin_B0=T0/S0;Cos_B0=W/S0;Sin3_B0=Sin_B0*Sin_B0*Sin_B0;T1=Z+this.b*this.ep2*Sin3_B0;Sum=W-this.a*this.es*Cos_B0*Cos_B0*Cos_B0;S1=Math.sqrt(T1*T1+Sum*Sum);Sin_p1=T1/S1;Cos_p1=Sum/S1;Rn=this.a/Math.sqrt(1.0-this.es*Sin_p1*Sin_p1);if(Cos_p1>=Proj4js.common.COS_67P5)
{Height=W/Cos_p1-Rn;}
else if(Cos_p1<=-Proj4js.common.COS_67P5)
{Height=W/-Cos_p1-Rn;}
else
{Height=Z/Sin_p1+Rn*(this.es-1.0);}
if(At_Pole==false)
{Latitude=Math.atan(Sin_p1/Cos_p1);}
p.x=Longitude;p.y=Latitude;p.z=Height;return p;},geocentric_to_wgs84:function(p){if(this.datum_type==Proj4js.common.PJD_3PARAM)
{p.x+=this.datum_params[0];p.y+=this.datum_params[1];p.z+=this.datum_params[2];}
else if(this.datum_type==Proj4js.common.PJD_7PARAM)
{var Dx_BF=this.datum_params[0];var Dy_BF=this.datum_params[1];var Dz_BF=this.datum_params[2];var Rx_BF=this.datum_params[3];var Ry_BF=this.datum_params[4];var Rz_BF=this.datum_params[5];var M_BF=this.datum_params[6];var x_out=M_BF*(p.x-Rz_BF*p.y+Ry_BF*p.z)+Dx_BF;var y_out=M_BF*(Rz_BF*p.x+p.y-Rx_BF*p.z)+Dy_BF;var z_out=M_BF*(-Ry_BF*p.x+Rx_BF*p.y+p.z)+Dz_BF;p.x=x_out;p.y=y_out;p.z=z_out;}},geocentric_from_wgs84:function(p){if(this.datum_type==Proj4js.common.PJD_3PARAM)
{p.x-=this.datum_params[0];p.y-=this.datum_params[1];p.z-=this.datum_params[2];}
else if(this.datum_type==Proj4js.common.PJD_7PARAM)
{var Dx_BF=this.datum_params[0];var Dy_BF=this.datum_params[1];var Dz_BF=this.datum_params[2];var Rx_BF=this.datum_params[3];var Ry_BF=this.datum_params[4];var Rz_BF=this.datum_params[5];var M_BF=this.datum_params[6];var x_tmp=(p.x-Dx_BF)/M_BF;var y_tmp=(p.y-Dy_BF)/M_BF;var z_tmp=(p.z-Dz_BF)/M_BF;p.x=x_tmp+Rz_BF*y_tmp-Ry_BF*z_tmp;p.y=-Rz_BF*x_tmp+y_tmp+Rx_BF*z_tmp;p.z=Ry_BF*x_tmp-Rx_BF*y_tmp+z_tmp;}}});Proj4js.Point=Proj4js.Class({initialize:function(x,y,z){if(typeof x=='object'){this.x=x[0];this.y=x[1];this.z=x[2]||0.0;}else if(typeof x=='string'){var coords=x.split(',');this.x=parseFloat(coords[0]);this.y=parseFloat(coords[1]);this.z=parseFloat(coords[2])||0.0;}else{this.x=x;this.y=y;this.z=z||0.0;}},clone:function(){return new Proj4js.Point(this.x,this.y,this.z);},toString:function(){return("x="+this.x+",y="+this.y);},toShortString:function(){return(this.x+", "+this.y);}});Proj4js.PrimeMeridian={"greenwich":0.0,"lisbon":-9.131906111111,"paris":2.337229166667,"bogota":-74.080916666667,"madrid":-3.687938888889,"rome":12.452333333333,"bern":7.439583333333,"jakarta":106.807719444444,"ferro":-17.666666666667,"brussels":4.367975,"stockholm":18.058277777778,"athens":23.7163375,"oslo":10.722916666667};Proj4js.Ellipsoid={"MERIT":{a:6378137.0,rf:298.257,ellipseName:"MERIT 1983"},"SGS85":{a:6378136.0,rf:298.257,ellipseName:"Soviet Geodetic System 85"},"GRS80":{a:6378137.0,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},"IAU76":{a:6378140.0,rf:298.257,ellipseName:"IAU 1976"},"airy":{a:6377563.396,b:6356256.910,ellipseName:"Airy 1830"},"APL4.":{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},"NWL9D":{a:6378145.0,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},"mod_airy":{a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},"andrae":{a:6377104.43,rf:300.0,ellipseName:"Andrae 1876 (Den., Iclnd.)"},"aust_SA":{a:6378160.0,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},"GRS67":{a:6378160.0,rf:298.2471674270,ellipseName:"GRS 67(IUGG 1967)"},"bessel":{a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},"bess_nam":{a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},"clrk66":{a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},"clrk80":{a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},"CPM":{a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},"delmbr":{a:6376428.0,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},"engelis":{a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},"evrst30":{a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},"evrst48":{a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},"evrst56":{a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},"evrst69":{a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},"evrstSS":{a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},"fschr60":{a:6378166.0,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},"fschr60m":{a:6378155.0,rf:298.3,ellipseName:"Fischer 1960"},"fschr68":{a:6378150.0,rf:298.3,ellipseName:"Fischer 1968"},"helmert":{a:6378200.0,rf:298.3,ellipseName:"Helmert 1906"},"hough":{a:6378270.0,rf:297.0,ellipseName:"Hough"},"intl":{a:6378388.0,rf:297.0,ellipseName:"International 1909 (Hayford)"},"kaula":{a:6378163.0,rf:298.24,ellipseName:"Kaula 1961"},"lerch":{a:6378139.0,rf:298.257,ellipseName:"Lerch 1979"},"mprts":{a:6397300.0,rf:191.0,ellipseName:"Maupertius 1738"},"new_intl":{a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},"plessis":{a:6376523.0,rf:6355863.0,ellipseName:"Plessis 1817 (France)"},"krass":{a:6378245.0,rf:298.3,ellipseName:"Krassovsky, 1942"},"SEasia":{a:6378155.0,b:6356773.3205,ellipseName:"Southeast Asia"},"walbeck":{a:6376896.0,b:6355834.8467,ellipseName:"Walbeck"},"WGS60":{a:6378165.0,rf:298.3,ellipseName:"WGS 60"},"WGS66":{a:6378145.0,rf:298.25,ellipseName:"WGS 66"},"WGS72":{a:6378135.0,rf:298.26,ellipseName:"WGS 72"},"WGS84":{a:6378137.0,rf:298.257223563,ellipseName:"WGS 84"},"sphere":{a:6370997.0,b:6370997.0,ellipseName:"Normal Sphere (r=6370997)"}};Proj4js.Datum={"WGS84":{towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},"GGRS87":{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},"NAD83":{towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},"NAD27":{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},"potsdam":{towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},"carthage":{towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},"hermannskogel":{towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"},"ire65":{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},"nzgd49":{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},"OSGB36":{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"}};Proj4js.WGS84=new Proj4js.Proj('WGS84');Proj4js.Datum['OSB36']=Proj4js.Datum['OSGB36'];Proj4js.Proj.aea={init:function(){if(Math.abs(this.lat1+this.lat2)<Proj4js.common.EPSLN){Proj4js.reportError("aeaInitEqualLatitudes");return;}
this.temp=this.b/this.a;this.es=1.0-Math.pow(this.temp,2);this.e3=Math.sqrt(this.es);this.sin_po=Math.sin(this.lat1);this.cos_po=Math.cos(this.lat1);this.t1=this.sin_po;this.con=this.sin_po;this.ms1=Proj4js.common.msfnz(this.e3,this.sin_po,this.cos_po);this.qs1=Proj4js.common.qsfnz(this.e3,this.sin_po,this.cos_po);this.sin_po=Math.sin(this.lat2);this.cos_po=Math.cos(this.lat2);this.t2=this.sin_po;this.ms2=Proj4js.common.msfnz(this.e3,this.sin_po,this.cos_po);this.qs2=Proj4js.common.qsfnz(this.e3,this.sin_po,this.cos_po);this.sin_po=Math.sin(this.lat0);this.cos_po=Math.cos(this.lat0);this.t3=this.sin_po;this.qs0=Proj4js.common.qsfnz(this.e3,this.sin_po,this.cos_po);if(Math.abs(this.lat1-this.lat2)>Proj4js.common.EPSLN){this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1);}else{this.ns0=this.con;}
this.c=this.ms1*this.ms1+this.ns0*this.qs1;this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0;},forward:function(p){var lon=p.x;var lat=p.y;this.sin_phi=Math.sin(lat);this.cos_phi=Math.cos(lat);var qs=Proj4js.common.qsfnz(this.e3,this.sin_phi,this.cos_phi);var rh1=this.a*Math.sqrt(this.c-this.ns0*qs)/this.ns0;var theta=this.ns0*Proj4js.common.adjust_lon(lon-this.long0);var x=rh1*Math.sin(theta)+this.x0;var y=this.rh-rh1*Math.cos(theta)+this.y0;p.x=x;p.y=y;return p;},inverse:function(p){var rh1,qs,con,theta,lon,lat;p.x-=this.x0;p.y=this.rh-p.y+this.y0;if(this.ns0>=0){rh1=Math.sqrt(p.x*p.x+p.y*p.y);con=1.0;}else{rh1=-Math.sqrt(p.x*p.x+p.y*p.y);con=-1.0;}
theta=0.0;if(rh1!=0.0){theta=Math.atan2(con*p.x,con*p.y);}
con=rh1*this.ns0/this.a;qs=(this.c-con*con)/this.ns0;if(this.e3>=1e-10){con=1-.5*(1.0-this.es)*Math.log((1.0-this.e3)/(1.0+this.e3))/this.e3;if(Math.abs(Math.abs(con)-Math.abs(qs))>.0000000001){lat=this.phi1z(this.e3,qs);}else{if(qs>=0){lat=.5*PI;}else{lat=-.5*PI;}}}else{lat=this.phi1z(e3,qs);}
lon=Proj4js.common.adjust_lon(theta/this.ns0+this.long0);p.x=lon;p.y=lat;return p;},phi1z:function(eccent,qs){var con,com,dphi;var phi=Proj4js.common.asinz(.5*qs);if(eccent<Proj4js.common.EPSLN)return phi;var eccnts=eccent*eccent;for(var i=1;i<=25;i++){sinphi=Math.sin(phi);cosphi=Math.cos(phi);con=eccent*sinphi;com=1.0-con*con;dphi=.5*com*com/cosphi*(qs/(1.0-eccnts)-sinphi/com+.5/eccent*Math.log((1.0-con)/(1.0+con)));phi=phi+dphi;if(Math.abs(dphi)<=1e-7)return phi;}
Proj4js.reportError("aea:phi1z:Convergence error");return null;}};Proj4js.Proj.sterea={dependsOn:'gauss',init:function(){Proj4js.Proj['gauss'].init.apply(this);if(!this.rc){Proj4js.reportError("sterea:init:E_ERROR_0");return;}
this.sinc0=Math.sin(this.phic0);this.cosc0=Math.cos(this.phic0);this.R2=2.0*this.rc;if(!this.title)this.title="Oblique Stereographic Alternative";},forward:function(p){p.x=Proj4js.common.adjust_lon(p.x-this.long0);Proj4js.Proj['gauss'].forward.apply(this,[p]);sinc=Math.sin(p.y);cosc=Math.cos(p.y);cosl=Math.cos(p.x);k=this.k0*this.R2/(1.0+this.sinc0*sinc+this.cosc0*cosc*cosl);p.x=k*cosc*Math.sin(p.x);p.y=k*(this.cosc0*sinc-this.sinc0*cosc*cosl);p.x=this.a*p.x+this.x0;p.y=this.a*p.y+this.y0;return p;},inverse:function(p){var lon,lat;p.x=(p.x-this.x0)/this.a;p.y=(p.y-this.y0)/this.a;p.x/=this.k0;p.y/=this.k0;if((rho=Math.sqrt(p.x*p.x+p.y*p.y))){c=2.0*Math.atan2(rho,this.R2);sinc=Math.sin(c);cosc=Math.cos(c);lat=Math.asin(cosc*this.sinc0+p.y*sinc*this.cosc0/rho);lon=Math.atan2(p.x*sinc,rho*this.cosc0*cosc-p.y*this.sinc0*sinc);}else{lat=this.phic0;lon=0.;}
p.x=lon;p.y=lat;Proj4js.Proj['gauss'].inverse.apply(this,[p]);p.x=Proj4js.common.adjust_lon(p.x+this.long0);return p;}};function phi4z(eccent,e0,e1,e2,e3,a,b,c,phi){var sinphi,sin2ph,tanph,ml,mlp,con1,con2,con3,dphi,i;phi=a;for(i=1;i<=15;i++){sinphi=Math.sin(phi);tanphi=Math.tan(phi);c=tanphi*Math.sqrt(1.0-eccent*sinphi*sinphi);sin2ph=Math.sin(2.0*phi);ml=e0*phi-e1*sin2ph+e2*Math.sin(4.0*phi)-e3*Math.sin(6.0*phi);mlp=e0-2.0*e1*Math.cos(2.0*phi)+4.0*e2*Math.cos(4.0*phi)-6.0*e3*Math.cos(6.0*phi);con1=2.0*ml+c*(ml*ml+b)-2.0*a*(c*ml+1.0);con2=eccent*sin2ph*(ml*ml+b-2.0*a*ml)/(2.0*c);con3=2.0*(a-ml)*(c*mlp-2.0/sin2ph)-2.0*mlp;dphi=con1/(con2+con3);phi+=dphi;if(Math.abs(dphi)<=.0000000001)return(phi);}
Proj4js.reportError("phi4z: No convergence");return null;}
function e4fn(x){var con,com;con=1.0+x;com=1.0-x;return(Math.sqrt((Math.pow(con,con))*(Math.pow(com,com))));}
Proj4js.Proj.poly={init:function(){var temp;if(this.lat0=0)this.lat0=90;this.temp=this.b/this.a;this.es=1.0-Math.pow(this.temp,2);this.e=Math.sqrt(this.es);this.e0=Proj4js.common.e0fn(this.es);this.e1=Proj4js.common.e1fn(this.es);this.e2=Proj4js.common.e2fn(this.es);this.e3=Proj4js.common.e3fn(this.es);this.ml0=Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,this.lat0);},forward:function(p){var sinphi,cosphi;var al;var c;var con,ml;var ms;var x,y;var lon=p.x;var lat=p.y;con=Proj4js.common.adjust_lon(lon-this.long0);if(Math.abs(lat)<=.0000001){x=this.x0+this.a*con;y=this.y0-this.a*this.ml0;}else{sinphi=Math.sin(lat);cosphi=Math.cos(lat);ml=Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,lat);ms=Proj4js.common.msfnz(this.e,sinphi,cosphi);con=sinphi;x=this.x0+this.a*ms*Math.sin(con)/sinphi;y=this.y0+this.a*(ml-this.ml0+ms*(1.0-Math.cos(con))/sinphi);}
p.x=x;p.y=y;return p;},inverse:function(p){var sin_phi,cos_phi;var al;var b;var c;var con,ml;var iflg;var lon,lat;p.x-=this.x0;p.y-=this.y0;al=this.ml0+p.y/this.a;iflg=0;if(Math.abs(al)<=.0000001){lon=p.x/this.a+this.long0;lat=0.0;}else{b=al*al+(p.x/this.a)*(p.x/this.a);iflg=phi4z(this.es,this.e0,this.e1,this.e2,this.e3,this.al,b,c,lat);if(iflg!=1)return(iflg);lon=Proj4js.common.adjust_lon((Proj4js.common.asinz(p.x*c/this.a)/Math.sin(lat))+this.long0);}
p.x=lon;p.y=lat;return p;}};Proj4js.Proj.equi={init:function(){if(!this.x0)this.x0=0;if(!this.y0)this.y0=0;if(!this.lat0)this.lat0=0;if(!this.long0)this.long0=0;},forward:function(p){var lon=p.x;var lat=p.y;var dlon=Proj4js.common.adjust_lon(lon-this.long0);var x=this.x0+this.a*dlon*Math.cos(this.lat0);var y=this.y0+this.a*lat;this.t1=x;this.t2=Math.cos(this.lat0);p.x=x;p.y=y;return p;},inverse:function(p){p.x-=this.x0;p.y-=this.y0;var lat=p.y/this.a;if(Math.abs(lat)>Proj4js.common.HALF_PI){Proj4js.reportError("equi:Inv:DataError");}
var lon=Proj4js.common.adjust_lon(this.long0+p.x/(this.a*Math.cos(this.lat0)));p.x=lon;p.y=lat;}};Proj4js.Proj.merc={init:function(){if(this.lat_ts){if(this.sphere){this.k0=Math.cos(this.lat_ts);}else{this.k0=Proj4js.common.msfnz(this.es,Math.sin(this.lat_ts),Math.cos(this.lat_ts));}}},forward:function(p){var lon=p.x;var lat=p.y;if(lat*Proj4js.common.R2D>90.0&&lat*Proj4js.common.R2D<-90.0&&lon*Proj4js.common.R2D>180.0&&lon*Proj4js.common.R2D<-180.0){Proj4js.reportError("merc:forward: llInputOutOfRange: "+lon+" : "+lat);return null;}
var x,y;if(Math.abs(Math.abs(lat)-Proj4js.common.HALF_PI)<=Proj4js.common.EPSLN){Proj4js.reportError("merc:forward: ll2mAtPoles");return null;}else{if(this.sphere){x=this.x0+this.a*this.k0*Proj4js.common.adjust_lon(lon-this.long0);y=this.y0+this.a*this.k0*Math.log(Math.tan(Proj4js.common.FORTPI+0.5*lat));}else{var sinphi=Math.sin(lat);var ts=Proj4js.common.tsfnz(this.e,lat,sinphi);x=this.x0+this.a*this.k0*Proj4js.common.adjust_lon(lon-this.long0);y=this.y0-this.a*this.k0*Math.log(ts);}
p.x=x;p.y=y;return p;}},inverse:function(p){var x=p.x-this.x0;var y=p.y-this.y0;var lon,lat;if(this.sphere){lat=Proj4js.common.HALF_PI-2.0*Math.atan(Math.exp(-y/this.a*this.k0));}else{var ts=Math.exp(-y/(this.a*this.k0));lat=Proj4js.common.phi2z(this.e,ts);if(lat==-9999){Proj4js.reportError("merc:inverse: lat = -9999");return null;}}
lon=Proj4js.common.adjust_lon(this.long0+x/(this.a*this.k0));p.x=lon;p.y=lat;return p;}};Proj4js.Proj.utm={dependsOn:'tmerc',init:function(){if(!this.zone){Proj4js.reportError("utm:init: zone must be specified for UTM");return;}
this.lat0=0.0;this.long0=((6*Math.abs(this.zone))-183)*Proj4js.common.D2R;this.x0=500000.0;this.y0=this.utmSouth?10000000.0:0.0;this.k0=0.9996;Proj4js.Proj['tmerc'].init.apply(this);this.forward=Proj4js.Proj['tmerc'].forward;this.inverse=Proj4js.Proj['tmerc'].inverse;}};Proj4js.Proj.eqdc={init:function(){if(!this.mode)this.mode=0;this.temp=this.b/this.a;this.es=1.0-Math.pow(this.temp,2);this.e=Math.sqrt(this.es);this.e0=Proj4js.common.e0fn(this.es);this.e1=Proj4js.common.e1fn(this.es);this.e2=Proj4js.common.e2fn(this.es);this.e3=Proj4js.common.e3fn(this.es);this.sinphi=Math.sin(this.lat1);this.cosphi=Math.cos(this.lat1);this.ms1=Proj4js.common.msfnz(this.e,this.sinphi,this.cosphi);this.ml1=Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,this.lat1);if(this.mode!=0){if(Math.abs(this.lat1+this.lat2)<Proj4js.common.EPSLN){Proj4js.reportError("eqdc:Init:EqualLatitudes");}
this.sinphi=Math.sin(this.lat2);this.cosphi=Math.cos(this.lat2);this.ms2=Proj4js.common.msfnz(this.e,this.sinphi,this.cosphi);this.ml2=Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,this.lat2);if(Math.abs(this.lat1-this.lat2)>=Proj4js.common.EPSLN){this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1);}else{this.ns=this.sinphi;}}else{this.ns=this.sinphi;}
this.g=this.ml1+this.ms1/this.ns;this.ml0=Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,this.lat0);this.rh=this.a*(this.g-this.ml0);},forward:function(p){var lon=p.x;var lat=p.y;var ml=Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,lat);var rh1=this.a*(this.g-ml);var theta=this.ns*Proj4js.common.adjust_lon(lon-this.long0);var x=this.x0+rh1*Math.sin(theta);var y=this.y0+this.rh-rh1*Math.cos(theta);p.x=x;p.y=y;return p;},inverse:function(p){p.x-=this.x0;p.y=this.rh-p.y+this.y0;var con,rh1;if(this.ns>=0){var rh1=Math.sqrt(p.x*p.x+p.y*p.y);var con=1.0;}else{rh1=-Math.sqrt(p.x*p.x+p.y*p.y);con=-1.0;}
var theta=0.0;if(rh1!=0.0)theta=Math.atan2(con*p.x,con*p.y);var ml=this.g-rh1/this.a;var lat=this.phi3z(this.ml,this.e0,this.e1,this.e2,this.e3);var lon=Proj4js.common.adjust_lon(this.long0+theta/this.ns);p.x=lon;p.y=lat;return p;},phi3z:function(ml,e0,e1,e2,e3){var phi;var dphi;phi=ml;for(var i=0;i<15;i++){dphi=(ml+e1*Math.sin(2.0*phi)-e2*Math.sin(4.0*phi)+e3*Math.sin(6.0*phi))/e0-phi;phi+=dphi;if(Math.abs(dphi)<=.0000000001){return phi;}}
Proj4js.reportError("PHI3Z-CONV:Latitude failed to converge after 15 iterations");return null;}};Proj4js.Proj.tmerc={init:function(){this.e0=Proj4js.common.e0fn(this.es);this.e1=Proj4js.common.e1fn(this.es);this.e2=Proj4js.common.e2fn(this.es);this.e3=Proj4js.common.e3fn(this.es);this.ml0=this.a*Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,this.lat0);},forward:function(p){var lon=p.x;var lat=p.y;var delta_lon=Proj4js.common.adjust_lon(lon-this.long0);var con;var x,y;var sin_phi=Math.sin(lat);var cos_phi=Math.cos(lat);if(this.sphere){var b=cos_phi*Math.sin(delta_lon);if((Math.abs(Math.abs(b)-1.0))<.0000000001){Proj4js.reportError("tmerc:forward: Point projects into infinity");return(93);}else{x=.5*this.a*this.k0*Math.log((1.0+b)/(1.0-b));con=Math.acos(cos_phi*Math.cos(delta_lon)/Math.sqrt(1.0-b*b));if(lat<0)con=-con;y=this.a*this.k0*(con-this.lat0);}}else{var al=cos_phi*delta_lon;var als=Math.pow(al,2);var c=this.ep2*Math.pow(cos_phi,2);var tq=Math.tan(lat);var t=Math.pow(tq,2);con=1.0-this.es*Math.pow(sin_phi,2);var n=this.a/Math.sqrt(con);var ml=this.a*Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,lat);x=this.k0*n*al*(1.0+als/6.0*(1.0-t+c+als/20.0*(5.0-18.0*t+Math.pow(t,2)+72.0*c-58.0*this.ep2)))+this.x0;y=this.k0*(ml-this.ml0+n*tq*(als*(0.5+als/24.0*(5.0-t+9.0*c+4.0*Math.pow(c,2)+als/30.0*(61.0-58.0*t+Math.pow(t,2)+600.0*c-330.0*this.ep2)))))+this.y0;}
p.x=x;p.y=y;return p;},inverse:function(p){var con,phi;var delta_phi;var i;var max_iter=6;var lat,lon;if(this.sphere){var f=Math.exp(p.x/(this.a*this.k0));var g=.5*(f-1/f);var temp=this.lat0+p.y/(this.a*this.k0);var h=Math.cos(temp);con=Math.sqrt((1.0-h*h)/(1.0+g*g));lat=Proj4js.common.asinz(con);if(temp<0)
lat=-lat;if((g==0)&&(h==0)){lon=this.long0;}else{lon=Proj4js.common.adjust_lon(Math.atan2(g,h)+this.long0);}}else{var x=p.x-this.x0;var y=p.y-this.y0;con=(this.ml0+y/this.k0)/this.a;phi=con;for(i=0;true;i++){delta_phi=((con+this.e1*Math.sin(2.0*phi)-this.e2*Math.sin(4.0*phi)+this.e3*Math.sin(6.0*phi))/this.e0)-phi;phi+=delta_phi;if(Math.abs(delta_phi)<=Proj4js.common.EPSLN)break;if(i>=max_iter){Proj4js.reportError("tmerc:inverse: Latitude failed to converge");return(95);}}
if(Math.abs(phi)<Proj4js.common.HALF_PI){var sin_phi=Math.sin(phi);var cos_phi=Math.cos(phi);var tan_phi=Math.tan(phi);var c=this.ep2*Math.pow(cos_phi,2);var cs=Math.pow(c,2);var t=Math.pow(tan_phi,2);var ts=Math.pow(t,2);con=1.0-this.es*Math.pow(sin_phi,2);var n=this.a/Math.sqrt(con);var r=n*(1.0-this.es)/con;var d=x/(n*this.k0);var ds=Math.pow(d,2);lat=phi-(n*tan_phi*ds/r)*(0.5-ds/24.0*(5.0+3.0*t+10.0*c-4.0*cs-9.0*this.ep2-ds/30.0*(61.0+90.0*t+298.0*c+45.0*ts-252.0*this.ep2-3.0*cs)));lon=Proj4js.common.adjust_lon(this.long0+(d*(1.0-ds/6.0*(1.0+2.0*t+c-ds/20.0*(5.0-2.0*c+28.0*t-3.0*cs+8.0*this.ep2+24.0*ts)))/cos_phi));}else{lat=Proj4js.common.HALF_PI*Proj4js.common.sign(y);lon=this.long0;}}
p.x=lon;p.y=lat;return p;}};Proj4js.defs["GOOGLE"]="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs";Proj4js.defs["EPSG:900913"]=Proj4js.defs["GOOGLE"];Proj4js.Proj.gstmerc={init:function(){var temp=this.b/this.a;this.e=Math.sqrt(1.0-temp*temp);this.lc=this.long0;this.rs=Math.sqrt(1.0+this.e*this.e*Math.pow(Math.cos(this.lat0),4.0)/(1.0-this.e*this.e));var sinz=Math.sin(this.lat0);var pc=Math.asin(sinz/this.rs);var sinzpc=Math.sin(pc);this.cp=Proj4js.common.latiso(0.0,pc,sinzpc)-this.rs*Proj4js.common.latiso(this.e,this.lat0,sinz);this.n2=this.k0*this.a*Math.sqrt(1.0-this.e*this.e)/(1.0-this.e*this.e*sinz*sinz);this.xs=this.x0;this.ys=this.y0-this.n2*pc;if(!this.title)this.title="Gauss Schreiber transverse mercator";},forward:function(p){var lon=p.x;var lat=p.y;var L=this.rs*(lon-this.lc);var Ls=this.cp+(this.rs*Proj4js.common.latiso(this.e,lat,Math.sin(lat)));var lat1=Math.asin(Math.sin(L)/Proj4js.common.cosh(Ls));var Ls1=Proj4js.common.latiso(0.0,lat1,Math.sin(lat1));p.x=this.xs+(this.n2*Ls1);p.y=this.ys+(this.n2*Math.atan(Proj4js.common.sinh(Ls)/Math.cos(L)));return p;},inverse:function(p){var x=p.x;var y=p.y;var L=Math.atan(Proj4js.common.sinh((x-this.xs)/this.n2)/Math.cos((y-this.ys)/this.n2));var lat1=Math.asin(Math.sin((y-this.ys)/this.n2)/Proj4js.common.cosh((x-this.xs)/this.n2));var LC=Proj4js.common.latiso(0.0,lat1,Math.sin(lat1));p.x=this.lc+L/this.rs;p.y=Proj4js.common.invlatiso(this.e,(LC-this.cp)/this.rs);return p;}};Proj4js.Proj.ortho={init:function(def){;this.sin_p14=Math.sin(this.lat0);this.cos_p14=Math.cos(this.lat0);},forward:function(p){var sinphi,cosphi;var dlon;var coslon;var ksp;var g;var lon=p.x;var lat=p.y;dlon=Proj4js.common.adjust_lon(lon-this.long0);sinphi=Math.sin(lat);cosphi=Math.cos(lat);coslon=Math.cos(dlon);g=this.sin_p14*sinphi+this.cos_p14*cosphi*coslon;ksp=1.0;if((g>0)||(Math.abs(g)<=Proj4js.common.EPSLN)){var x=this.a*ksp*cosphi*Math.sin(dlon);var y=this.y0+this.a*ksp*(this.cos_p14*sinphi-this.sin_p14*cosphi*coslon);}else{Proj4js.reportError("orthoFwdPointError");}
p.x=x;p.y=y;return p;},inverse:function(p){var rh;var z;var sinz,cosz;var temp;var con;var lon,lat;p.x-=this.x0;p.y-=this.y0;rh=Math.sqrt(p.x*p.x+p.y*p.y);if(rh>this.a+.0000001){Proj4js.reportError("orthoInvDataError");}
z=Proj4js.common.asinz(rh/this.a);sinz=Math.sin(z);cosi=Math.cos(z);lon=this.long0;if(Math.abs(rh)<=Proj4js.common.EPSLN){lat=this.lat0;}
lat=Proj4js.common.asinz(cosz*this.sin_p14+(y*sinz*this.cos_p14)/rh);con=Math.abs(lat0)-Proj4js.common.HALF_PI;if(Math.abs(con)<=Proj4js.common.EPSLN){if(this.lat0>=0){lon=Proj4js.common.adjust_lon(this.long0+Math.atan2(p.x,-p.y));}else{lon=Proj4js.common.adjust_lon(this.long0-Math.atan2(-p.x,p.y));}}
con=cosz-this.sin_p14*Math.sin(lat);if((Math.abs(con)>=Proj4js.common.EPSLN)||(Math.abs(x)>=Proj4js.common.EPSLN)){lon=Proj4js.common.adjust_lon(this.long0+Math.atan2((p.x*sinz*this.cos_p14),(con*rh)));}
p.x=lon;p.y=lat;return p;}};Proj4js.Proj.somerc={init:function(){var phy0=this.lat0;this.lambda0=this.long0;var sinPhy0=Math.sin(phy0);var semiMajorAxis=this.a;var invF=this.rf;var flattening=1/invF;var e2=2*flattening-Math.pow(flattening,2);var e=this.e=Math.sqrt(e2);this.R=semiMajorAxis*Math.sqrt(1-e2)/(1-e2*Math.pow(sinPhy0,2.0));this.alpha=Math.sqrt(1+e2/(1-e2)*Math.pow(Math.cos(phy0),4.0));this.b0=Math.asin(sinPhy0/this.alpha);this.K=Math.log(Math.tan(Math.PI/4.0+this.b0/2.0))
-this.alpha*Math.log(Math.tan(Math.PI/4.0+phy0/2.0))
+this.alpha*e/2*Math.log((1+e*sinPhy0)/(1-e*sinPhy0));},forward:function(p){var Sa1=Math.log(Math.tan(Math.PI/4.0-p.y/2.0));var Sa2=this.e/2.0*Math.log((1+this.e*Math.sin(p.y))/(1-this.e*Math.sin(p.y)));var S=-this.alpha*(Sa1+Sa2)+this.K;var b=2.0*(Math.atan(Math.exp(S))-Math.PI/4.0);var I=this.alpha*(p.x-this.lambda0);var rotI=Math.atan(Math.sin(I)/(Math.sin(this.b0)*Math.tan(b)+
Math.cos(this.b0)*Math.cos(I)));var rotB=Math.asin(Math.cos(this.b0)*Math.sin(b)-
Math.sin(this.b0)*Math.cos(b)*Math.cos(I));p.y=this.R/2.0*Math.log((1+Math.sin(rotB))/(1-Math.sin(rotB)))
+this.y0;p.x=this.R*rotI+this.x0;return p;},inverse:function(p){var Y=p.x-this.x0;var X=p.y-this.y0;var rotI=Y/this.R;var rotB=2*(Math.atan(Math.exp(X/this.R))-Math.PI/4.0);var b=Math.asin(Math.cos(this.b0)*Math.sin(rotB)
+Math.sin(this.b0)*Math.cos(rotB)*Math.cos(rotI));var I=Math.atan(Math.sin(rotI)/(Math.cos(this.b0)*Math.cos(rotI)-Math.sin(this.b0)*Math.tan(rotB)));var lambda=this.lambda0+I/this.alpha;var S=0.0;var phy=b;var prevPhy=-1000.0;var iteration=0;while(Math.abs(phy-prevPhy)>0.0000001)
{if(++iteration>20)
{Proj4js.reportError("omercFwdInfinity");return;}
S=1.0/this.alpha*(Math.log(Math.tan(Math.PI/4.0+b/2.0))-this.K)
+this.e*Math.log(Math.tan(Math.PI/4.0
+Math.asin(this.e*Math.sin(phy))/2.0));prevPhy=phy;phy=2.0*Math.atan(Math.exp(S))-Math.PI/2.0;}
p.x=lambda;p.y=phy;return p;}};Proj4js.Proj.stere={ssfn_:function(phit,sinphi,eccen){sinphi*=eccen;return(Math.tan(.5*(Proj4js.common.HALF_PI+phit))*Math.pow((1.-sinphi)/(1.+sinphi),.5*eccen));},TOL:1.e-8,NITER:8,CONV:1.e-10,S_POLE:0,N_POLE:1,OBLIQ:2,EQUIT:3,init:function(){this.phits=this.lat_ts?this.lat_ts:Proj4js.common.HALF_PI;var t=Math.abs(this.lat0);if((Math.abs(t)-Proj4js.common.HALF_PI)<Proj4js.common.EPSLN){this.mode=this.lat0<0.?this.S_POLE:this.N_POLE;}else{this.mode=t>Proj4js.common.EPSLN?this.OBLIQ:this.EQUIT;}
this.phits=Math.abs(this.phits);if(this.es){var X;switch(this.mode){case this.N_POLE:case this.S_POLE:if(Math.abs(this.phits-Proj4js.common.HALF_PI)<Proj4js.common.EPSLN){this.akm1=2.*this.k0/Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e));}else{t=Math.sin(this.phits);this.akm1=Math.cos(this.phits)/Proj4js.common.tsfnz(this.e,this.phits,t);t*=this.e;this.akm1/=Math.sqrt(1.-t*t);}
break;case this.EQUIT:this.akm1=2.*this.k0;break;case this.OBLIQ:t=Math.sin(this.lat0);X=2.*Math.atan(this.ssfn_(this.lat0,t,this.e))-Proj4js.common.HALF_PI;t*=this.e;this.akm1=2.*this.k0*Math.cos(this.lat0)/Math.sqrt(1.-t*t);this.sinX1=Math.sin(X);this.cosX1=Math.cos(X);break;}}else{switch(this.mode){case this.OBLIQ:this.sinph0=Math.sin(this.lat0);this.cosph0=Math.cos(this.lat0);case this.EQUIT:this.akm1=2.*this.k0;break;case this.S_POLE:case this.N_POLE:this.akm1=Math.abs(this.phits-Proj4js.common.HALF_PI)>=Proj4js.common.EPSLN?Math.cos(this.phits)/Math.tan(Proj4js.common.FORTPI-.5*this.phits):2.*this.k0;break;}}},forward:function(p){var lon=p.x;lon=Proj4js.common.adjust_lon(lon-this.long0);var lat=p.y;var x,y;if(this.sphere){var sinphi,cosphi,coslam,sinlam;sinphi=Math.sin(lat);cosphi=Math.cos(lat);coslam=Math.cos(lon);sinlam=Math.sin(lon);switch(this.mode){case this.EQUIT:y=1.+cosphi*coslam;if(y<=Proj4js.common.EPSLN){F_ERROR;}
y=this.akm1/y;x=y*cosphi*sinlam;y*=sinphi;break;case this.OBLIQ:y=1.+this.sinph0*sinphi+this.cosph0*cosphi*coslam;if(y<=Proj4js.common.EPSLN){F_ERROR;}
y=this.akm1/y;x=y*cosphi*sinlam;y*=this.cosph0*sinphi-this.sinph0*cosphi*coslam;break;case this.N_POLE:coslam=-coslam;lat=-lat;case this.S_POLE:if(Math.abs(lat-Proj4js.common.HALF_PI)<this.TOL){F_ERROR;}
y=this.akm1*Math.tan(Proj4js.common.FORTPI+.5*lat);x=sinlam*y;y*=coslam;break;}}else{coslam=Math.cos(lon);sinlam=Math.sin(lon);sinphi=Math.sin(lat);if(this.mode==this.OBLIQ||this.mode==this.EQUIT){X=2.*Math.atan(this.ssfn_(lat,sinphi,this.e));sinX=Math.sin(X-Proj4js.common.HALF_PI);cosX=Math.cos(X);}
switch(this.mode){case this.OBLIQ:A=this.akm1/(this.cosX1*(1.+this.sinX1*sinX+this.cosX1*cosX*coslam));y=A*(this.cosX1*sinX-this.sinX1*cosX*coslam);x=A*cosX;break;case this.EQUIT:A=2.*this.akm1/(1.+cosX*coslam);y=A*sinX;x=A*cosX;break;case this.S_POLE:lat=-lat;coslam=-coslam;sinphi=-sinphi;case this.N_POLE:x=this.akm1*Proj4js.common.tsfnz(this.e,lat,sinphi);y=-x*coslam;break;}
x=x*sinlam;}
p.x=x*this.a+this.x0;p.y=y*this.a+this.y0;return p;},inverse:function(p){var x=(p.x-this.x0)/this.a;var y=(p.y-this.y0)/this.a;var lon,lat;var cosphi,sinphi,tp=0.0,phi_l=0.0,rho,halfe=0.0,pi2=0.0;var i;if(this.sphere){var c,rh,sinc,cosc;rh=Math.sqrt(x*x+y*y);c=2.*Math.atan(rh/this.akm1);sinc=Math.sin(c);cosc=Math.cos(c);lon=0.;switch(this.mode){case this.EQUIT:if(Math.abs(rh)<=Proj4js.common.EPSLN){lat=0.;}else{lat=Math.asin(y*sinc/rh);}
if(cosc!=0.||x!=0.)lon=Math.atan2(x*sinc,cosc*rh);break;case this.OBLIQ:if(Math.abs(rh)<=Proj4js.common.EPSLN){lat=this.phi0;}else{lat=Math.asin(cosc*sinph0+y*sinc*cosph0/rh);}
c=cosc-sinph0*Math.sin(lat);if(c!=0.||x!=0.){lon=Math.atan2(x*sinc*cosph0,c*rh);}
break;case this.N_POLE:y=-y;case this.S_POLE:if(Math.abs(rh)<=Proj4js.common.EPSLN){lat=this.phi0;}else{lat=Math.asin(this.mode==this.S_POLE?-cosc:cosc);}
lon=(x==0.&&y==0.)?0.:Math.atan2(x,y);break;}}else{rho=Math.sqrt(x*x+y*y);switch(this.mode){case this.OBLIQ:case this.EQUIT:tp=2.*Math.atan2(rho*this.cosX1,this.akm1);cosphi=Math.cos(tp);sinphi=Math.sin(tp);if(rho==0.0){phi_l=Math.asin(cosphi*this.sinX1);}else{phi_l=Math.asin(cosphi*this.sinX1+(y*sinphi*this.cosX1/rho));}
tp=Math.tan(.5*(Proj4js.common.HALF_PI+phi_l));x*=sinphi;y=rho*this.cosX1*cosphi-y*this.sinX1*sinphi;pi2=Proj4js.common.HALF_PI;halfe=.5*this.e;break;case this.N_POLE:y=-y;case this.S_POLE:tp=-rho/this.akm1;phi_l=Proj4js.common.HALF_PI-2.*Math.atan(tp);pi2=-Proj4js.common.HALF_PI;halfe=-.5*this.e;break;}
for(i=this.NITER;i--;phi_l=lat){sinphi=this.e*Math.sin(phi_l);lat=2.*Math.atan(tp*Math.pow((1.+sinphi)/(1.-sinphi),halfe))-pi2;if(Math.abs(phi_l-lat)<this.CONV){if(this.mode==this.S_POLE)lat=-lat;lon=(x==0.&&y==0.)?0.:Math.atan2(x,y);p.x=Proj4js.common.adjust_lon(lon+this.long0);p.y=lat;return p;}}}}};Proj4js.Proj.nzmg={iterations:1,init:function(){this.A=new Array();this.A[1]=+0.6399175073;this.A[2]=-0.1358797613;this.A[3]=+0.063294409;this.A[4]=-0.02526853;this.A[5]=+0.0117879;this.A[6]=-0.0055161;this.A[7]=+0.0026906;this.A[8]=-0.001333;this.A[9]=+0.00067;this.A[10]=-0.00034;this.B_re=new Array();this.B_im=new Array();this.B_re[1]=+0.7557853228;this.B_im[1]=0.0;this.B_re[2]=+0.249204646;this.B_im[2]=+0.003371507;this.B_re[3]=-0.001541739;this.B_im[3]=+0.041058560;this.B_re[4]=-0.10162907;this.B_im[4]=+0.01727609;this.B_re[5]=-0.26623489;this.B_im[5]=-0.36249218;this.B_re[6]=-0.6870983;this.B_im[6]=-1.1651967;this.C_re=new Array();this.C_im=new Array();this.C_re[1]=+1.3231270439;this.C_im[1]=0.0;this.C_re[2]=-0.577245789;this.C_im[2]=-0.007809598;this.C_re[3]=+0.508307513;this.C_im[3]=-0.112208952;this.C_re[4]=-0.15094762;this.C_im[4]=+0.18200602;this.C_re[5]=+1.01418179;this.C_im[5]=+1.64497696;this.C_re[6]=+1.9660549;this.C_im[6]=+2.5127645;this.D=new Array();this.D[1]=+1.5627014243;this.D[2]=+0.5185406398;this.D[3]=-0.03333098;this.D[4]=-0.1052906;this.D[5]=-0.0368594;this.D[6]=+0.007317;this.D[7]=+0.01220;this.D[8]=+0.00394;this.D[9]=-0.0013;},forward:function(p){var lon=p.x;var lat=p.y;var delta_lat=lat-this.lat0;var delta_lon=lon-this.long0;var d_phi=delta_lat/Proj4js.common.SEC_TO_RAD*1E-5;var d_lambda=delta_lon;var d_phi_n=1;var d_psi=0;for(n=1;n<=10;n++){d_phi_n=d_phi_n*d_phi;d_psi=d_psi+this.A[n]*d_phi_n;}
var th_re=d_psi;var th_im=d_lambda;var th_n_re=1;var th_n_im=0;var th_n_re1;var th_n_im1;var z_re=0;var z_im=0;for(n=1;n<=6;n++){th_n_re1=th_n_re*th_re-th_n_im*th_im;th_n_im1=th_n_im*th_re+th_n_re*th_im;th_n_re=th_n_re1;th_n_im=th_n_im1;z_re=z_re+this.B_re[n]*th_n_re-this.B_im[n]*th_n_im;z_im=z_im+this.B_im[n]*th_n_re+this.B_re[n]*th_n_im;}
x=(z_im*this.a)+this.x0;y=(z_re*this.a)+this.y0;p.x=x;p.y=y;return p;},inverse:function(p){var x=p.x;var y=p.y;var delta_x=x-this.x0;var delta_y=y-this.y0;var z_re=delta_y/this.a;var z_im=delta_x/this.a;var z_n_re=1;var z_n_im=0;var z_n_re1;var z_n_im1;var th_re=0;var th_im=0;for(n=1;n<=6;n++){z_n_re1=z_n_re*z_re-z_n_im*z_im;z_n_im1=z_n_im*z_re+z_n_re*z_im;z_n_re=z_n_re1;z_n_im=z_n_im1;th_re=th_re+this.C_re[n]*z_n_re-this.C_im[n]*z_n_im;th_im=th_im+this.C_im[n]*z_n_re+this.C_re[n]*z_n_im;}
for(i=0;i<this.iterations;i++){var th_n_re=th_re;var th_n_im=th_im;var th_n_re1;var th_n_im1;var num_re=z_re;var num_im=z_im;for(n=2;n<=6;n++){th_n_re1=th_n_re*th_re-th_n_im*th_im;th_n_im1=th_n_im*th_re+th_n_re*th_im;th_n_re=th_n_re1;th_n_im=th_n_im1;num_re=num_re+(n-1)*(this.B_re[n]*th_n_re-this.B_im[n]*th_n_im);num_im=num_im+(n-1)*(this.B_im[n]*th_n_re+this.B_re[n]*th_n_im);}
th_n_re=1;th_n_im=0;var den_re=this.B_re[1];var den_im=this.B_im[1];for(n=2;n<=6;n++){th_n_re1=th_n_re*th_re-th_n_im*th_im;th_n_im1=th_n_im*th_re+th_n_re*th_im;th_n_re=th_n_re1;th_n_im=th_n_im1;den_re=den_re+n*(this.B_re[n]*th_n_re-this.B_im[n]*th_n_im);den_im=den_im+n*(this.B_im[n]*th_n_re+this.B_re[n]*th_n_im);}
var den2=den_re*den_re+den_im*den_im;th_re=(num_re*den_re+num_im*den_im)/den2;th_im=(num_im*den_re-num_re*den_im)/den2;}
var d_psi=th_re;var d_lambda=th_im;var d_psi_n=1;var d_phi=0;for(n=1;n<=9;n++){d_psi_n=d_psi_n*d_psi;d_phi=d_phi+this.D[n]*d_psi_n;}
var lat=this.lat0+(d_phi*Proj4js.common.SEC_TO_RAD*1E5);var lon=this.long0+d_lambda;p.x=lon;p.y=lat;return p;}};Proj4js.Proj.mill={init:function(){},forward:function(p){var lon=p.x;var lat=p.y;var dlon=Proj4js.common.adjust_lon(lon-this.long0);var x=this.x0+this.a*dlon;var y=this.y0+this.a*Math.log(Math.tan((Proj4js.common.PI/4.0)+(lat/2.5)))*1.25;p.x=x;p.y=y;return p;},inverse:function(p){p.x-=this.x0;p.y-=this.y0;var lon=Proj4js.common.adjust_lon(this.long0+p.x/this.a);var lat=2.5*(Math.atan(Math.exp(0.8*p.y/this.a))-Proj4js.common.PI/4.0);p.x=lon;p.y=lat;return p;}};Proj4js.Proj.sinu={init:function(){this.R=6370997.0;},forward:function(p){var x,y,delta_lon;var lon=p.x;var lat=p.y;delta_lon=Proj4js.common.adjust_lon(lon-this.long0);x=this.R*delta_lon*Math.cos(lat)+this.x0;y=this.R*lat+this.y0;p.x=x;p.y=y;return p;},inverse:function(p){var lat,temp,lon;p.x-=this.x0;p.y-=this.y0;lat=p.y/this.R;if(Math.abs(lat)>Proj4js.common.HALF_PI){Proj4js.reportError("sinu:Inv:DataError");}
temp=Math.abs(lat)-Proj4js.common.HALF_PI;if(Math.abs(temp)>Proj4js.common.EPSLN){temp=this.long0+p.x/(this.R*Math.cos(lat));lon=Proj4js.common.adjust_lon(temp);}else{lon=this.long0;}
p.x=lon;p.y=lat;return p;}};Proj4js.Proj.vandg={init:function(){this.R=6370997.0;},forward:function(p){var lon=p.x;var lat=p.y;var dlon=Proj4js.common.adjust_lon(lon-this.long0);var x,y;if(Math.abs(lat)<=Proj4js.common.EPSLN){x=this.x0+this.R*dlon;y=this.y0;}
var theta=Proj4js.common.asinz(2.0*Math.abs(lat/Proj4js.common.PI));if((Math.abs(dlon)<=Proj4js.common.EPSLN)||(Math.abs(Math.abs(lat)-Proj4js.common.HALF_PI)<=Proj4js.common.EPSLN)){x=this.x0;if(lat>=0){y=this.y0+Proj4js.common.PI*this.R*Math.tan(.5*theta);}else{y=this.y0+Proj4js.common.PI*this.R*-Math.tan(.5*theta);}}
var al=.5*Math.abs((Proj4js.common.PI/dlon)-(dlon/Proj4js.common.PI));var asq=al*al;var sinth=Math.sin(theta);var costh=Math.cos(theta);var g=costh/(sinth+costh-1.0);var gsq=g*g;var m=g*(2.0/sinth-1.0);var msq=m*m;var con=Proj4js.common.PI*this.R*(al*(g-msq)+Math.sqrt(asq*(g-msq)*(g-msq)-(msq+asq)*(gsq-msq)))/(msq+asq);if(dlon<0){con=-con;}
x=this.x0+con;con=Math.abs(con/(Proj4js.common.PI*this.R));if(lat>=0){y=this.y0+Proj4js.common.PI*this.R*Math.sqrt(1.0-con*con-2.0*al*con);}else{y=this.y0-Proj4js.common.PI*this.R*Math.sqrt(1.0-con*con-2.0*al*con);}
p.x=x;p.y=y;return p;},inverse:function(p){var dlon;var xx,yy,xys,c1,c2,c3;var al,asq;var a1;var m1;var con;var th1;var d;p.x-=this.x0;p.y-=this.y0;con=Proj4js.common.PI*this.R;xx=p.x/con;yy=p.y/con;xys=xx*xx+yy*yy;c1=-Math.abs(yy)*(1.0+xys);c2=c1-2.0*yy*yy+xx*xx;c3=-2.0*c1+1.0+2.0*yy*yy+xys*xys;d=yy*yy/c3+(2.0*c2*c2*c2/c3/c3/c3-9.0*c1*c2/c3/c3)/27.0;a1=(c1-c2*c2/3.0/c3)/c3;m1=2.0*Math.sqrt(-a1/3.0);con=((3.0*d)/a1)/m1;if(Math.abs(con)>1.0){if(con>=0.0){con=1.0;}else{con=-1.0;}}
th1=Math.acos(con)/3.0;if(p.y>=0){lat=(-m1*Math.cos(th1+Proj4js.common.PI/3.0)-c2/3.0/c3)*Proj4js.common.PI;}else{lat=-(-m1*Math.cos(th1+PI/3.0)-c2/3.0/c3)*Proj4js.common.PI;}
if(Math.abs(xx)<Proj4js.common.EPSLN){lon=this.long0;}
lon=Proj4js.common.adjust_lon(this.long0+Proj4js.common.PI*(xys-1.0+Math.sqrt(1.0+2.0*(xx*xx-yy*yy)+xys*xys))/2.0/xx);p.x=lon;p.y=lat;return p;}};Proj4js.Proj.eqc={init:function(){if(!this.x0)this.x0=0;if(!this.y0)this.y0=0;if(!this.lat0)this.lat0=0;if(!this.long0)this.long0=0;if(!this.lat_ts)this.lat_ts=0;if(!this.title)this.title="Equidistant Cylindrical (Plate Carre)";this.rc=Math.cos(this.lat_ts);},forward:function(p){var lon=p.x;var lat=p.y;var dlon=Proj4js.common.adjust_lon(lon-this.long0);var dlat=Proj4js.common.adjust_lat(lat-this.lat0);p.x=this.x0+(this.a*dlon*this.rc);p.y=this.y0+(this.a*dlat);return p;},inverse:function(p){var x=p.x;var y=p.y;p.x=Proj4js.common.adjust_lon(this.long0+((x-this.x0)/(this.a*this.rc)));p.y=Proj4js.common.adjust_lat(this.lat0+((y-this.y0)/(this.a)));return p;}};Proj4js.Proj.gauss={init:function(){sphi=Math.sin(this.lat0);cphi=Math.cos(this.lat0);cphi*=cphi;this.rc=Math.sqrt(1.0-this.es)/(1.0-this.es*sphi*sphi);this.C=Math.sqrt(1.0+this.es*cphi*cphi/(1.0-this.es));this.phic0=Math.asin(sphi/this.C);this.ratexp=0.5*this.C*this.e;this.K=Math.tan(0.5*this.phic0+Proj4js.common.FORTPI)/(Math.pow(Math.tan(0.5*this.lat0+Proj4js.common.FORTPI),this.C)*Proj4js.common.srat(this.e*sphi,this.ratexp));},forward:function(p){var lon=p.x;var lat=p.y;p.y=2.0*Math.atan(this.K*Math.pow(Math.tan(0.5*lat+Proj4js.common.FORTPI),this.C)*Proj4js.common.srat(this.e*Math.sin(lat),this.ratexp))-Proj4js.common.HALF_PI;p.x=this.C*lon;return p;},inverse:function(p){var DEL_TOL=1e-14;var lon=p.x/this.C;var lat=p.y;num=Math.pow(Math.tan(0.5*lat+Proj4js.common.FORTPI)/this.K,1./this.C);for(var i=Proj4js.common.MAX_ITER;i>0;--i){lat=2.0*Math.atan(num*Proj4js.common.srat(this.e*Math.sin(p.y),-0.5*this.e))-Proj4js.common.HALF_PI;if(Math.abs(lat-p.y)<DEL_TOL)break;p.y=lat;}
if(!i){Proj4js.reportError("gauss:inverse:convergence failed");return null;}
p.x=lon;p.y=lat;return p;}};Proj4js.Proj.omerc={init:function(){if(!this.mode)this.mode=0;if(!this.lon1){this.lon1=0;this.mode=1;}
if(!this.lon2)this.lon2=0;if(!this.lat2)this.lat2=0;var temp=this.b/this.a;var es=1.0-Math.pow(temp,2);var e=Math.sqrt(es);this.sin_p20=Math.sin(this.lat0);this.cos_p20=Math.cos(this.lat0);this.con=1.0-this.es*this.sin_p20*this.sin_p20;this.com=Math.sqrt(1.0-es);this.bl=Math.sqrt(1.0+this.es*Math.pow(this.cos_p20,4.0)/(1.0-es));this.al=this.a*this.bl*this.k0*this.com/this.con;if(Math.abs(this.lat0)<Proj4js.common.EPSLN){this.ts=1.0;this.d=1.0;this.el=1.0;}else{this.ts=Proj4js.common.tsfnz(this.e,this.lat0,this.sin_p20);this.con=Math.sqrt(this.con);this.d=this.bl*this.com/(this.cos_p20*this.con);if((this.d*this.d-1.0)>0.0){if(this.lat0>=0.0){this.f=this.d+Math.sqrt(this.d*this.d-1.0);}else{this.f=this.d-Math.sqrt(this.d*this.d-1.0);}}else{this.f=this.d;}
this.el=this.f*Math.pow(this.ts,this.bl);}
if(this.mode!=0){this.g=.5*(this.f-1.0/this.f);this.gama=Proj4js.common.asinz(Math.sin(this.alpha)/this.d);this.longc=this.longc-Proj4js.common.asinz(this.g*Math.tan(this.gama))/this.bl;this.con=Math.abs(this.lat0);if((this.con>Proj4js.common.EPSLN)&&(Math.abs(this.con-Proj4js.common.HALF_PI)>Proj4js.common.EPSLN)){this.singam=Math.sin(this.gama);this.cosgam=Math.cos(this.gama);this.sinaz=Math.sin(this.alpha);this.cosaz=Math.cos(this.alpha);if(this.lat0>=0){this.u=(this.al/this.bl)*Math.atan(Math.sqrt(this.d*this.d-1.0)/this.cosaz);}else{this.u=-(this.al/this.bl)*Math.atan(Math.sqrt(this.d*this.d-1.0)/this.cosaz);}}else{Proj4js.reportError("omerc:Init:DataError");}}else{this.sinphi=Math.sin(this.at1);this.ts1=Proj4js.common.tsfnz(this.e,this.lat1,this.sinphi);this.sinphi=Math.sin(this.lat2);this.ts2=Proj4js.common.tsfnz(this.e,this.lat2,this.sinphi);this.h=Math.pow(this.ts1,this.bl);this.l=Math.pow(this.ts2,this.bl);this.f=this.el/this.h;this.g=.5*(this.f-1.0/this.f);this.j=(this.el*this.el-this.l*this.h)/(this.el*this.el+this.l*this.h);this.p=(this.l-this.h)/(this.l+this.h);this.dlon=this.lon1-this.lon2;if(this.dlon<-Proj4js.common.PI)this.lon2=this.lon2-2.0*Proj4js.common.PI;if(this.dlon>Proj4js.common.PI)this.lon2=this.lon2+2.0*Proj4js.common.PI;this.dlon=this.lon1-this.lon2;this.longc=.5*(this.lon1+this.lon2)-Math.atan(this.j*Math.tan(.5*this.bl*this.dlon)/this.p)/this.bl;this.dlon=Proj4js.common.adjust_lon(this.lon1-this.longc);this.gama=Math.atan(Math.sin(this.bl*this.dlon)/this.g);this.alpha=Proj4js.common.asinz(this.d*Math.sin(this.gama));if(Math.abs(this.lat1-this.lat2)<=Proj4js.common.EPSLN){Proj4js.reportError("omercInitDataError");}else{this.con=Math.abs(this.lat1);}
if((this.con<=Proj4js.common.EPSLN)||(Math.abs(this.con-HALF_PI)<=Proj4js.common.EPSLN)){Proj4js.reportError("omercInitDataError");}else{if(Math.abs(Math.abs(this.lat0)-Proj4js.common.HALF_PI)<=Proj4js.common.EPSLN){Proj4js.reportError("omercInitDataError");}}
this.singam=Math.sin(this.gam);this.cosgam=Math.cos(this.gam);this.sinaz=Math.sin(this.alpha);this.cosaz=Math.cos(this.alpha);if(this.lat0>=0){this.u=(this.al/this.bl)*Math.atan(Math.sqrt(this.d*this.d-1.0)/this.cosaz);}else{this.u=-(this.al/this.bl)*Math.atan(Math.sqrt(this.d*this.d-1.0)/this.cosaz);}}},forward:function(p){var theta;var sin_phi,cos_phi;var b;var c,t,tq;var con,n,ml;var q,us,vl;var ul,vs;var s;var dlon;var ts1;var lon=p.x;var lat=p.y;sin_phi=Math.sin(lat);dlon=Proj4js.common.adjust_lon(lon-this.longc);vl=Math.sin(this.bl*dlon);if(Math.abs(Math.abs(lat)-Proj4js.common.HALF_PI)>Proj4js.common.EPSLN){ts1=Proj4js.common.tsfnz(this.e,lat,sin_phi);q=this.el/(Math.pow(ts1,this.bl));s=.5*(q-1.0/q);t=.5*(q+1.0/q);ul=(s*this.singam-vl*this.cosgam)/t;con=Math.cos(this.bl*dlon);if(Math.abs(con)<.0000001){us=this.al*this.bl*dlon;}else{us=this.al*Math.atan((s*this.cosgam+vl*this.singam)/con)/this.bl;if(con<0)us=us+Proj4js.common.PI*this.al/this.bl;}}else{if(lat>=0){ul=this.singam;}else{ul=-this.singam;}
us=this.al*lat/this.bl;}
if(Math.abs(Math.abs(ul)-1.0)<=Proj4js.common.EPSLN){Proj4js.reportError("omercFwdInfinity");}
vs=.5*this.al*Math.log((1.0-ul)/(1.0+ul))/this.bl;us=us-this.u;var x=this.x0+vs*this.cosaz+us*this.sinaz;var y=this.y0+us*this.cosaz-vs*this.sinaz;p.x=x;p.y=y;return p;},inverse:function(p){var delta_lon;var theta;var delta_theta;var sin_phi,cos_phi;var b;var c,t,tq;var con,n,ml;var vs,us,q,s,ts1;var vl,ul,bs;var dlon;var flag;p.x-=this.x0;p.y-=this.y0;flag=0;vs=p.x*this.cosaz-p.y*this.sinaz;us=p.y*this.cosaz+p.x*this.sinaz;us=us+this.u;q=Math.exp(-this.bl*vs/this.al);s=.5*(q-1.0/q);t=.5*(q+1.0/q);vl=Math.sin(this.bl*us/this.al);ul=(vl*this.cosgam+s*this.singam)/t;if(Math.abs(Math.abs(ul)-1.0)<=Proj4js.common.EPSLN)
{lon=this.longc;if(ul>=0.0){lat=Proj4js.common.HALF_PI;}else{lat=-Proj4js.common.HALF_PI;}}else{con=1.0/this.bl;ts1=Math.pow((this.el/Math.sqrt((1.0+ul)/(1.0-ul))),con);lat=Proj4js.common.phi2z(this.e,ts1);theta=this.longc-Math.atan2((s*this.cosgam-vl*this.singam),con)/this.bl;lon=Proj4js.common.adjust_lon(theta);}
p.x=lon;p.y=lat;return p;}};Proj4js.Proj.lcc={init:function(){if(!this.lat2){this.lat2=this.lat0;}
if(!this.k0)this.k0=1.0;if(Math.abs(this.lat1+this.lat2)<Proj4js.common.EPSLN){Proj4js.reportError("lcc:init: Equal Latitudes");return;}
var temp=this.b/this.a;this.e=Math.sqrt(1.0-temp*temp);var sin1=Math.sin(this.lat1);var cos1=Math.cos(this.lat1);var ms1=Proj4js.common.msfnz(this.e,sin1,cos1);var ts1=Proj4js.common.tsfnz(this.e,this.lat1,sin1);var sin2=Math.sin(this.lat2);var cos2=Math.cos(this.lat2);var ms2=Proj4js.common.msfnz(this.e,sin2,cos2);var ts2=Proj4js.common.tsfnz(this.e,this.lat2,sin2);var ts0=Proj4js.common.tsfnz(this.e,this.lat0,Math.sin(this.lat0));if(Math.abs(this.lat1-this.lat2)>Proj4js.common.EPSLN){this.ns=Math.log(ms1/ms2)/Math.log(ts1/ts2);}else{this.ns=sin1;}
this.f0=ms1/(this.ns*Math.pow(ts1,this.ns));this.rh=this.a*this.f0*Math.pow(ts0,this.ns);if(!this.title)this.title="Lambert Conformal Conic";},forward:function(p){var lon=p.x;var lat=p.y;if(lat<=90.0&&lat>=-90.0&&lon<=180.0&&lon>=-180.0){}else{Proj4js.reportError("lcc:forward: llInputOutOfRange: "+lon+" : "+lat);return null;}
var con=Math.abs(Math.abs(lat)-Proj4js.common.HALF_PI);var ts,rh1;if(con>Proj4js.common.EPSLN){ts=Proj4js.common.tsfnz(this.e,lat,Math.sin(lat));rh1=this.a*this.f0*Math.pow(ts,this.ns);}else{con=lat*this.ns;if(con<=0){Proj4js.reportError("lcc:forward: No Projection");return null;}
rh1=0;}
var theta=this.ns*Proj4js.common.adjust_lon(lon-this.long0);p.x=this.k0*(rh1*Math.sin(theta))+this.x0;p.y=this.k0*(this.rh-rh1*Math.cos(theta))+this.y0;return p;},inverse:function(p){var rh1,con,ts;var lat,lon;x=(p.x-this.x0)/this.k0;y=(this.rh-(p.y-this.y0)/this.k0);if(this.ns>0){rh1=Math.sqrt(x*x+y*y);con=1.0;}else{rh1=-Math.sqrt(x*x+y*y);con=-1.0;}
var theta=0.0;if(rh1!=0){theta=Math.atan2((con*x),(con*y));}
if((rh1!=0)||(this.ns>0.0)){con=1.0/this.ns;ts=Math.pow((rh1/(this.a*this.f0)),con);lat=Proj4js.common.phi2z(this.e,ts);if(lat==-9999)return null;}else{lat=-Proj4js.common.HALF_PI;}
lon=Proj4js.common.adjust_lon(theta/this.ns+this.long0);p.x=lon;p.y=lat;return p;}};Proj4js.Proj.laea={init:function(){this.sin_lat_o=Math.sin(this.lat0);this.cos_lat_o=Math.cos(this.lat0);},forward:function(p){var lon=p.x;var lat=p.y;var delta_lon=Proj4js.common.adjust_lon(lon-this.long0);var sin_lat=Math.sin(lat);var cos_lat=Math.cos(lat);var sin_delta_lon=Math.sin(delta_lon);var cos_delta_lon=Math.cos(delta_lon);var g=this.sin_lat_o*sin_lat+this.cos_lat_o*cos_lat*cos_delta_lon;if(g==-1.0){Proj4js.reportError("laea:fwd:Point projects to a circle of radius "+2.0*R);return null;}
var ksp=this.a*Math.sqrt(2.0/(1.0+g));var x=ksp*cos_lat*sin_delta_lon+this.x0;var y=ksp*(this.cos_lat_o*sin_lat-this.sin_lat_o*cos_lat*cos_delta_lon)+this.y0;p.x=x;p.y=y;return p;},inverse:function(p){p.x-=this.x0;p.y-=this.y0;var Rh=Math.sqrt(p.x*p.x+p.y*p.y);var temp=Rh/(2.0*this.a);if(temp>1){Proj4js.reportError("laea:Inv:DataError");return null;}
var z=2.0*Proj4js.common.asinz(temp);var sin_z=Math.sin(z);var cos_z=Math.cos(z);var lon=this.long0;if(Math.abs(Rh)>Proj4js.common.EPSLN){var lat=Proj4js.common.asinz(this.sin_lat_o*cos_z+this.cos_lat_o*sin_z*p.y/Rh);var temp=Math.abs(this.lat0)-Proj4js.common.HALF_PI;if(Math.abs(temp)>Proj4js.common.EPSLN){temp=cos_z-this.sin_lat_o*Math.sin(lat);if(temp!=0.0)lon=Proj4js.common.adjust_lon(this.long0+Math.atan2(p.x*sin_z*this.cos_lat_o,temp*Rh));}else if(this.lat0<0.0){lon=Proj4js.common.adjust_lon(this.long0-Math.atan2(-p.x,p.y));}else{lon=Proj4js.common.adjust_lon(this.long0+Math.atan2(p.x,-p.y));}}else{lat=this.lat0;}
p.x=lon;p.y=lat;return p;}};Proj4js.Proj.aeqd={init:function(){this.sin_p12=Math.sin(this.lat0);this.cos_p12=Math.cos(this.lat0);},forward:function(p){var lon=p.x;var lat=p.y;var ksp;var sinphi=Math.sin(p.y);var cosphi=Math.cos(p.y);var dlon=Proj4js.common.adjust_lon(lon-this.long0);var coslon=Math.cos(dlon);var g=this.sin_p12*sinphi+this.cos_p12*cosphi*coslon;if(Math.abs(Math.abs(g)-1.0)<Proj4js.common.EPSLN){ksp=1.0;if(g<0.0){Proj4js.reportError("aeqd:Fwd:PointError");return;}}else{var z=Math.acos(g);ksp=z/Math.sin(z);}
p.x=this.x0+this.a*ksp*cosphi*Math.sin(dlon);p.y=this.y0+this.a*ksp*(this.cos_p12*sinphi-this.sin_p12*cosphi*coslon);return p;},inverse:function(p){p.x-=this.x0;p.y-=this.y0;var rh=Math.sqrt(p.x*p.x+p.y*p.y);if(rh>(2.0*Proj4js.common.HALF_PI*this.a)){Proj4js.reportError("aeqdInvDataError");return;}
var z=rh/this.a;var sinz=Math.sin(z);var cosz=Math.cos(z);var lon=this.long0;var lat;if(Math.abs(rh)<=Proj4js.common.EPSLN){lat=this.lat0;}else{lat=Proj4js.common.asinz(cosz*this.sin_p12+(p.y*sinz*this.cos_p12)/rh);var con=Math.abs(this.lat0)-Proj4js.common.HALF_PI;if(Math.abs(con)<=Proj4js.common.EPSLN){if(lat0>=0.0){lon=Proj4js.common.adjust_lon(this.long0+Math.atan2(p.x,-p.y));}else{lon=Proj4js.common.adjust_lon(this.long0-Math.atan2(-p.x,p.y));}}else{con=cosz-this.sin_p12*Math.sin(lat);if((Math.abs(con)<Proj4js.common.EPSLN)&&(Math.abs(p.x)<Proj4js.common.EPSLN)){}else{var temp=Math.atan2((p.x*sinz*this.cos_p12),(con*rh));lon=Proj4js.common.adjust_lon(this.long0+Math.atan2((p.x*sinz*this.cos_p12),(con*rh)));}}}
p.x=lon;p.y=lat;return p;}};Proj4js.Proj.moll={init:function(){},forward:function(p){var lon=p.x;var lat=p.y;var delta_lon=Proj4js.common.adjust_lon(lon-this.long0);var theta=lat;var con=Proj4js.common.PI*Math.sin(lat);for(var i=0;true;i++){var delta_theta=-(theta+Math.sin(theta)-con)/(1.0+Math.cos(theta));theta+=delta_theta;if(Math.abs(delta_theta)<Proj4js.common.EPSLN)break;if(i>=50){Proj4js.reportError("moll:Fwd:IterationError");}}
theta/=2.0;if(Proj4js.common.PI/2-Math.abs(lat)<Proj4js.common.EPSLN)delta_lon=0;var x=0.900316316158*this.a*delta_lon*Math.cos(theta)+this.x0;var y=1.4142135623731*this.a*Math.sin(theta)+this.y0;p.x=x;p.y=y;return p;},inverse:function(p){var theta;var arg;p.x-=this.x0;var arg=p.y/(1.4142135623731*this.a);if(Math.abs(arg)>0.999999999999)arg=0.999999999999;var theta=Math.asin(arg);var lon=Proj4js.common.adjust_lon(this.long0+(p.x/(0.900316316158*this.a*Math.cos(theta))));if(lon<(-Proj4js.common.PI))lon=-Proj4js.common.PI;if(lon>Proj4js.common.PI)lon=Proj4js.common.PI;arg=(2.0*theta+Math.sin(2.0*theta))/Proj4js.common.PI;if(Math.abs(arg)>1.0)arg=1.0;var lat=Math.asin(arg);p.x=lon;p.y=lat;return p;}};Ext.namespace("GeoExt.tree");GeoExt.tree.LayerNodeUI=Ext.extend(Ext.tree.TreeNodeUI,{constructor:function(config){GeoExt.tree.LayerNodeUI.superclass.constructor.apply(this,arguments);},render:function(bulkRender){var a=this.node.attributes;if(a.checked===undefined){a.checked=this.node.layer.getVisibility();}
GeoExt.tree.LayerNodeUI.superclass.render.apply(this,arguments);var cb=this.checkbox;if(a.checkedGroup){var radio=Ext.DomHelper.insertAfter(cb,['<input type="radio" name="',a.checkedGroup,'_checkbox" class="',cb.className,cb.checked?'" checked="checked"':'','"></input>'].join(""));radio.defaultChecked=cb.defaultChecked;Ext.get(cb).remove();this.checkbox=radio;}
this.enforceOneVisible();},onClick:function(e){if(e.getTarget('.x-tree-node-cb',1)){this.toggleCheck(this.isChecked());}else{GeoExt.tree.LayerNodeUI.superclass.onClick.apply(this,arguments);}},toggleCheck:function(value){value=(value===undefined?!this.isChecked():value);GeoExt.tree.LayerNodeUI.superclass.toggleCheck.call(this,value);this.enforceOneVisible();},enforceOneVisible:function(){var attributes=this.node.attributes;var group=attributes.checkedGroup;if(group&&group!=="gx_baselayer"){var layer=this.node.layer;var checkedNodes=this.node.getOwnerTree().getChecked();var checkedCount=0;Ext.each(checkedNodes,function(n){var l=n.layer
if(!n.hidden&&n.attributes.checkedGroup===group){checkedCount++;if(l!=layer&&attributes.checked){l.setVisibility(false);}}});if(checkedCount===0&&attributes.checked==false){layer.setVisibility(true);}}},appendDDGhost:function(ghostNode){var n=this.elNode.cloneNode(true);var radio=Ext.DomQuery.select("input[type='radio']",n);Ext.each(radio,function(r){r.name=r.name+"_clone";});ghostNode.appendChild(n);}});GeoExt.tree.LayerNode=Ext.extend(Ext.tree.AsyncTreeNode,{layer:null,layerStore:null,constructor:function(config){config.leaf=config.leaf||!(config.children||config.loader);if(!config.iconCls&&!config.children){config.iconCls="gx-tree-layer-icon";}
if(config.loader&&!(config.loader instanceof Ext.tree.TreeLoader)){config.loader=new GeoExt.tree.LayerParamLoader(config.loader);}
this.defaultUI=this.defaultUI||GeoExt.tree.LayerNodeUI;Ext.apply(this,{layer:config.layer,layerStore:config.layerStore});if(config.text){this.fixedText=true;}
GeoExt.tree.LayerNode.superclass.constructor.apply(this,arguments);},render:function(bulkRender){var layer=this.layer instanceof OpenLayers.Layer&&this.layer;if(!layer){if(!this.layerStore||this.layerStore=="auto"){this.layerStore=GeoExt.MapPanel.guess().layers;}
var i=this.layerStore.findBy(function(o){return o.get("title")==this.layer;},this);if(i!=-1){layer=this.layerStore.getAt(i).getLayer();}}
if(!this.rendered||!layer){var ui=this.getUI();if(layer){this.layer=layer;if(layer.isBaseLayer){this.draggable=false;Ext.applyIf(this.attributes,{checkedGroup:"gx_baselayer"});}
if(!this.text){this.text=layer.name;}
ui.show();this.addVisibilityEventHandlers();}else{ui.hide();}
if(this.layerStore instanceof GeoExt.data.LayerStore){this.addStoreEventHandlers(layer);}}
GeoExt.tree.LayerNode.superclass.render.apply(this,arguments);},addVisibilityEventHandlers:function(){this.layer.events.on({"visibilitychanged":this.onLayerVisibilityChanged,scope:this});this.on({"checkchange":this.onCheckChange,scope:this});},onLayerVisibilityChanged:function(){if(!this._visibilityChanging){this.getUI().toggleCheck(this.layer.getVisibility());}},onCheckChange:function(node,checked){if(checked!=this.layer.getVisibility()){this._visibilityChanging=true;var layer=this.layer;if(checked&&layer.isBaseLayer&&layer.map){layer.map.setBaseLayer(layer);}else{layer.setVisibility(checked);}
delete this._visibilityChanging;}},addStoreEventHandlers:function(){this.layerStore.on({"add":this.onStoreAdd,"remove":this.onStoreRemove,"update":this.onStoreUpdate,scope:this});},onStoreAdd:function(store,records,index){var l;for(var i=0;i<records.length;++i){l=records[i].getLayer();if(this.layer==l){this.getUI().show();break;}else if(this.layer==l.name){this.render();break;}}},onStoreRemove:function(store,record,index){if(this.layer==record.getLayer()){this.getUI().hide();}},onStoreUpdate:function(store,record,operation){var layer=record.getLayer();if(!this.fixedText&&(this.layer==layer&&this.text!==layer.name)){this.setText(layer.name);}},destroy:function(){var layer=this.layer;if(layer instanceof OpenLayers.Layer){layer.events.un({"visibilitychanged":this.onLayerVisibilityChanged,scope:this});}
delete this.layer;var layerStore=this.layerStore;if(layerStore){layerStore.un("add",this.onStoreAdd,this);layerStore.un("remove",this.onStoreRemove,this);layerStore.un("update",this.onStoreUpdate,this);}
delete this.layerStore;this.un("checkchange",this.onCheckChange,this);GeoExt.tree.LayerNode.superclass.destroy.apply(this,arguments);}});Ext.tree.TreePanel.nodeTypes.gx_layer=GeoExt.tree.LayerNode;Ext.namespace("GeoExt.ux");GeoExt.ux.ScaleSelectorCombo=Ext.extend(Ext.form.ComboBox,{map:null,tpl:'<tpl for="."><div class="x-combo-list-item">1 : {[values.formattedScale]} </div></tpl>',editable:false,triggerAction:'all',mode:'local',thousandSeparator:'\'',decimalNumber:0,fakeScaleValue:null,initComponent:function(){GeoExt.ux.ScaleSelectorCombo.superclass.initComponent.apply(this,arguments);this.store=new GeoExt.data.ScaleStore({map:this.map});if(this.getLocalDecimalSeparator()==this.thousandSeparator){this.thousandSeparator='\'';}
for(var i=0;i<this.store.getCount();i++){if(this.fakeScaleValue){this.store.getAt(i).data.formattedScale=this.addThousandSeparator(this.roundNumber(this.fakeScaleValue[i],this.decimalNumber),this.thousandSeparator);}else{this.store.getAt(i).data.formattedScale=this.addThousandSeparator(this.roundNumber(this.store.getAt(i).data.scale,this.decimalNumber),this.thousandSeparator);}}
this.on('select',function(combo,record,index){this.map.zoomTo(record.data.level);},this);this.map.events.register('zoomend',this,this.zoomendUpdate);this.map.events.triggerEvent("zoomend");},zoomendUpdate:function(record){var scale=this.store.queryBy(function(record){return this.map.getZoom()==record.data.level;});if(scale.length>0){scale=scale.items[0];this.setValue("1 : "+scale.data.formattedScale);}else{if(!this.rendered){return;}
this.clearValue();}},addThousandSeparator:function(value,separator){if(separator===null){return value;}
value=value.toString();var sRegExp=new RegExp('(-?[0-9]+)([0-9]{3})');while(sRegExp.test(value)){value=value.replace(sRegExp,'$1'+separator+'$2');}
if(this.decimalNumber>3){var decimalPosition=value.lastIndexOf(this.getLocalDecimalSeparator());if(decimalPosition>0){var postDecimalCharacter=value.substr(decimalPosition);value=value.substr(0,decimalPosition)+postDecimalCharacter.replace(separator,'');}}
return value;},roundNumber:function(value,decimals){return Math.round(value*Math.pow(10,decimals))/Math.pow(10,decimals);},getLocalDecimalSeparator:function(){var n=1.1;return n.toLocaleString().substring(1,2);},beforeDestroy:function(){this.map.events.unregister('zoomend',this,this.zoomendUpdate);GeoExt.ux.ScaleSelectorCombo.superclass.beforeDestroy.apply(this,arguments);}});Ext.reg('gxux_scaleselectorcombo',GeoExt.ux.ScaleSelectorCombo);OpenLayers.Control=OpenLayers.Class({id:null,map:null,div:null,type:null,allowSelection:false,displayClass:"",title:"",autoActivate:false,active:null,handler:null,eventListeners:null,events:null,initialize:function(options){this.displayClass=this.CLASS_NAME.replace("OpenLayers.","ol").replace(/\./g,"");OpenLayers.Util.extend(this,options);this.events=new OpenLayers.Events(this);if(this.eventListeners instanceof Object){this.events.on(this.eventListeners);}
if(this.id==null){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");}},destroy:function(){if(this.events){if(this.eventListeners){this.events.un(this.eventListeners);}
this.events.destroy();this.events=null;}
this.eventListeners=null;if(this.handler){this.handler.destroy();this.handler=null;}
if(this.handlers){for(var key in this.handlers){if(this.handlers.hasOwnProperty(key)&&typeof this.handlers[key].destroy=="function"){this.handlers[key].destroy();}}
this.handlers=null;}
if(this.map){this.map.removeControl(this);this.map=null;}
this.div=null;},setMap:function(map){this.map=map;if(this.handler){this.handler.setMap(map);}},draw:function(px){if(this.div==null){this.div=OpenLayers.Util.createDiv(this.id);this.div.className=this.displayClass;if(!this.allowSelection){this.div.className+=" olControlNoSelect";this.div.setAttribute("unselectable","on",0);this.div.onselectstart=OpenLayers.Function.False;}
if(this.title!=""){this.div.title=this.title;}}
if(px!=null){this.position=px.clone();}
this.moveTo(this.position);return this.div;},moveTo:function(px){if((px!=null)&&(this.div!=null)){this.div.style.left=px.x+"px";this.div.style.top=px.y+"px";}},activate:function(){if(this.active){return false;}
if(this.handler){this.handler.activate();}
this.active=true;if(this.map){OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active");}
this.events.triggerEvent("activate");return true;},deactivate:function(){if(this.active){if(this.handler){this.handler.deactivate();}
this.active=false;if(this.map){OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active");}
this.events.triggerEvent("deactivate");return true;}
return false;},CLASS_NAME:"OpenLayers.Control"});OpenLayers.Control.TYPE_BUTTON=1;OpenLayers.Control.TYPE_TOGGLE=2;OpenLayers.Control.TYPE_TOOL=3;OpenLayers.String={startsWith:function(str,sub){return(str.indexOf(sub)==0);},contains:function(str,sub){return(str.indexOf(sub)!=-1);},trim:function(str){return str.replace(/^\s\s*/,'').replace(/\s\s*$/,'');},camelize:function(str){var oStringList=str.split('-');var camelizedString=oStringList[0];for(var i=1,len=oStringList.length;i<len;i++){var s=oStringList[i];camelizedString+=s.charAt(0).toUpperCase()+s.substring(1);}
return camelizedString;},format:function(template,context,args){if(!context){context=window;}
var replacer=function(str,match){var replacement;var subs=match.split(/\.+/);for(var i=0;i<subs.length;i++){if(i==0){replacement=context;}
replacement=replacement[subs[i]];}
if(typeof replacement=="function"){replacement=args?replacement.apply(null,args):replacement();}
if(typeof replacement=='undefined'){return'undefined';}else{return replacement;}};return template.replace(OpenLayers.String.tokenRegEx,replacer);},tokenRegEx:/\$\{([\w.]+?)\}/g,numberRegEx:/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,isNumeric:function(value){return OpenLayers.String.numberRegEx.test(value);},numericIf:function(value){return OpenLayers.String.isNumeric(value)?parseFloat(value):value;}};OpenLayers.Number={decimalSeparator:".",thousandsSeparator:",",limitSigDigs:function(num,sig){var fig=0;if(sig>0){fig=parseFloat(num.toPrecision(sig));}
return fig;},format:function(num,dec,tsep,dsep){dec=(typeof dec!="undefined")?dec:0;tsep=(typeof tsep!="undefined")?tsep:OpenLayers.Number.thousandsSeparator;dsep=(typeof dsep!="undefined")?dsep:OpenLayers.Number.decimalSeparator;if(dec!=null){num=parseFloat(num.toFixed(dec));}
var parts=num.toString().split(".");if(parts.length==1&&dec==null){dec=0;}
var integer=parts[0];if(tsep){var thousands=/(-?[0-9]+)([0-9]{3})/;while(thousands.test(integer)){integer=integer.replace(thousands,"$1"+tsep+"$2");}}
var str;if(dec==0){str=integer;}else{var rem=parts.length>1?parts[1]:"0";if(dec!=null){rem=rem+new Array(dec-rem.length+1).join("0");}
str=integer+dsep+rem;}
return str;}};OpenLayers.Function={bind:function(func,object){var args=Array.prototype.slice.apply(arguments,[2]);return function(){var newArgs=args.concat(Array.prototype.slice.apply(arguments,[0]));return func.apply(object,newArgs);};},bindAsEventListener:function(func,object){return function(event){return func.call(object,event||window.event);};},False:function(){return false;},True:function(){return true;},Void:function(){}};OpenLayers.Array={filter:function(array,callback,caller){var selected=[];if(Array.prototype.filter){selected=array.filter(callback,caller);}else{var len=array.length;if(typeof callback!="function"){throw new TypeError();}
for(var i=0;i<len;i++){if(i in array){var val=array[i];if(callback.call(caller,val,i,array)){selected.push(val);}}}}
return selected;}};OpenLayers.Event={observers:false,KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(event){return event.target||event.srcElement;},isSingleTouch:function(event){return event.touches&&event.touches.length==1;},isMultiTouch:function(event){return event.touches&&event.touches.length>1;},isLeftClick:function(event){return(((event.which)&&(event.which==1))||((event.button)&&(event.button==1)));},isRightClick:function(event){return(((event.which)&&(event.which==3))||((event.button)&&(event.button==2)));},stop:function(event,allowDefault){if(!allowDefault){if(event.preventDefault){event.preventDefault();}else{event.returnValue=false;}}
if(event.stopPropagation){event.stopPropagation();}else{event.cancelBubble=true;}},findElement:function(event,tagName){var element=OpenLayers.Event.element(event);while(element.parentNode&&(!element.tagName||(element.tagName.toUpperCase()!=tagName.toUpperCase()))){element=element.parentNode;}
return element;},observe:function(elementParam,name,observer,useCapture){var element=OpenLayers.Util.getElement(elementParam);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.attachEvent)){name='keydown';}
if(!this.observers){this.observers={};}
if(!element._eventCacheID){var idPrefix="eventCacheID_";if(element.id){idPrefix=element.id+"_"+idPrefix;}
element._eventCacheID=OpenLayers.Util.createUniqueID(idPrefix);}
var cacheID=element._eventCacheID;if(!this.observers[cacheID]){this.observers[cacheID]=[];}
this.observers[cacheID].push({'element':element,'name':name,'observer':observer,'useCapture':useCapture});if(element.addEventListener){element.addEventListener(name,observer,useCapture);}else if(element.attachEvent){element.attachEvent('on'+name,observer);}},stopObservingElement:function(elementParam){var element=OpenLayers.Util.getElement(elementParam);var cacheID=element._eventCacheID;this._removeElementObservers(OpenLayers.Event.observers[cacheID]);},_removeElementObservers:function(elementObservers){if(elementObservers){for(var i=elementObservers.length-1;i>=0;i--){var entry=elementObservers[i];var args=new Array(entry.element,entry.name,entry.observer,entry.useCapture);var removed=OpenLayers.Event.stopObserving.apply(this,args);}}},stopObserving:function(elementParam,name,observer,useCapture){useCapture=useCapture||false;var element=OpenLayers.Util.getElement(elementParam);var cacheID=element._eventCacheID;if(name=='keypress'){if(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.detachEvent){name='keydown';}}
var foundEntry=false;var elementObservers=OpenLayers.Event.observers[cacheID];if(elementObservers){var i=0;while(!foundEntry&&i<elementObservers.length){var cacheEntry=elementObservers[i];if((cacheEntry.name==name)&&(cacheEntry.observer==observer)&&(cacheEntry.useCapture==useCapture)){elementObservers.splice(i,1);if(elementObservers.length==0){delete OpenLayers.Event.observers[cacheID];}
foundEntry=true;break;}
i++;}}
if(foundEntry){if(element.removeEventListener){element.removeEventListener(name,observer,useCapture);}else if(element&&element.detachEvent){element.detachEvent('on'+name,observer);}}
return foundEntry;},unloadCache:function(){if(OpenLayers.Event&&OpenLayers.Event.observers){for(var cacheID in OpenLayers.Event.observers){var elementObservers=OpenLayers.Event.observers[cacheID];OpenLayers.Event._removeElementObservers.apply(this,[elementObservers]);}
OpenLayers.Event.observers=false;}},CLASS_NAME:"OpenLayers.Event"};OpenLayers.Event.observe(window,'unload',OpenLayers.Event.unloadCache,false);OpenLayers.Events=OpenLayers.Class({BROWSER_EVENTS:["mouseover","mouseout","mousedown","mouseup","mousemove","click","dblclick","rightclick","dblrightclick","resize","focus","blur","touchstart","touchmove","touchend"],listeners:null,object:null,element:null,eventHandler:null,fallThrough:null,includeXY:false,extensions:null,extensionCount:null,clearMouseListener:null,initialize:function(object,element,eventTypes,fallThrough,options){OpenLayers.Util.extend(this,options);this.object=object;this.fallThrough=fallThrough;this.listeners={};this.extensions={};this.extensionCount={};if(element!=null){this.attachToElement(element);}},destroy:function(){for(var e in this.extensions){if(typeof this.extensions[e]!=="boolean"){this.extensions[e].destroy();}}
this.extensions=null;if(this.element){OpenLayers.Event.stopObservingElement(this.element);if(this.element.hasScrollEvent){OpenLayers.Event.stopObserving(window,"scroll",this.clearMouseListener);}}
this.element=null;this.listeners=null;this.object=null;this.fallThrough=null;this.eventHandler=null;},addEventType:function(eventName){},attachToElement:function(element){if(this.element){OpenLayers.Event.stopObservingElement(this.element);}else{this.eventHandler=OpenLayers.Function.bindAsEventListener(this.handleBrowserEvent,this);this.clearMouseListener=OpenLayers.Function.bind(this.clearMouseCache,this);}
this.element=element;for(var i=0,len=this.BROWSER_EVENTS.length;i<len;i++){OpenLayers.Event.observe(element,this.BROWSER_EVENTS[i],this.eventHandler);}
OpenLayers.Event.observe(element,"dragstart",OpenLayers.Event.stop);},on:function(object){for(var type in object){if(type!="scope"&&object.hasOwnProperty(type)){this.register(type,object.scope,object[type]);}}},register:function(type,obj,func,priority){if(type in OpenLayers.Events&&!this.extensions[type]){this.extensions[type]=new OpenLayers.Events[type](this);}
if(func!=null){if(obj==null){obj=this.object;}
var listeners=this.listeners[type];if(!listeners){listeners=[];this.listeners[type]=listeners;this.extensionCount[type]=0;}
var listener={obj:obj,func:func};if(priority){listeners.splice(this.extensionCount[type],0,listener);if(typeof priority==="object"&&priority.extension){this.extensionCount[type]++;}}else{listeners.push(listener);}}},registerPriority:function(type,obj,func){this.register(type,obj,func,true);},un:function(object){for(var type in object){if(type!="scope"&&object.hasOwnProperty(type)){this.unregister(type,object.scope,object[type]);}}},unregister:function(type,obj,func){if(obj==null){obj=this.object;}
var listeners=this.listeners[type];if(listeners!=null){for(var i=0,len=listeners.length;i<len;i++){if(listeners[i].obj==obj&&listeners[i].func==func){listeners.splice(i,1);break;}}}},remove:function(type){if(this.listeners[type]!=null){this.listeners[type]=[];}},triggerEvent:function(type,evt){var listeners=this.listeners[type];if(!listeners||listeners.length==0){return undefined;}
if(evt==null){evt={};}
evt.object=this.object;evt.element=this.element;if(!evt.type){evt.type=type;}
listeners=listeners.slice();var continueChain;for(var i=0,len=listeners.length;i<len;i++){var callback=listeners[i];continueChain=callback.func.apply(callback.obj,[evt]);if((continueChain!=undefined)&&(continueChain==false)){break;}}
if(!this.fallThrough){OpenLayers.Event.stop(evt,true);}
return continueChain;},handleBrowserEvent:function(evt){var type=evt.type,listeners=this.listeners[type];if(!listeners||listeners.length==0){return;}
var touches=evt.touches;if(touches&&touches[0]){var x=0;var y=0;var num=touches.length;var touch;for(var i=0;i<num;++i){touch=touches[i];x+=touch.clientX;y+=touch.clientY;}
evt.clientX=x/num;evt.clientY=y/num;}
if(this.includeXY){evt.xy=this.getMousePosition(evt);}
this.triggerEvent(type,evt);},clearMouseCache:function(){this.element.scrolls=null;this.element.lefttop=null;var body=document.body;if(body&&!((body.scrollTop!=0||body.scrollLeft!=0)&&navigator.userAgent.match(/iPhone/i))){this.element.offsets=null;}},getMousePosition:function(evt){if(!this.includeXY){this.clearMouseCache();}else if(!this.element.hasScrollEvent){OpenLayers.Event.observe(window,"scroll",this.clearMouseListener);this.element.hasScrollEvent=true;}
if(!this.element.scrolls){var viewportElement=OpenLayers.Util.getViewportElement();this.element.scrolls=[viewportElement.scrollLeft,viewportElement.scrollTop];}
if(!this.element.lefttop){this.element.lefttop=[(document.documentElement.clientLeft||0),(document.documentElement.clientTop||0)];}
if(!this.element.offsets){this.element.offsets=OpenLayers.Util.pagePosition(this.element);}
return new OpenLayers.Pixel((evt.clientX+this.element.scrolls[0])-this.element.offsets[0]
-this.element.lefttop[0],(evt.clientY+this.element.scrolls[1])-this.element.offsets[1]
-this.element.lefttop[1]);},CLASS_NAME:"OpenLayers.Events"});OpenLayers.Events.buttonclick=OpenLayers.Class({target:null,events:['mousedown','mouseup','click','dblclick','touchstart','touchmove','touchend'],startRegEx:/^mousedown|touchstart$/,cancelRegEx:/^touchmove$/,completeRegEx:/^mouseup|touchend$/,initialize:function(target){this.target=target;for(var i=this.events.length-1;i>=0;--i){this.target.register(this.events[i],this,this.buttonClick,{extension:true});}},destroy:function(){for(var i=this.events.length-1;i>=0;--i){this.target.unregister(this.events[i],this,this.buttonClick);}
delete this.target;},buttonClick:function(evt){var propagate=true,element=OpenLayers.Event.element(evt);if(element&&(OpenLayers.Event.isLeftClick(evt)||!~evt.type.indexOf("mouse"))){if(OpenLayers.Element.hasClass(element,"olAlphaImg")){element=element.parentNode;}
if(OpenLayers.Element.hasClass(element,"olButton")){if(this.startEvt){if(this.completeRegEx.test(evt.type)){var pos=OpenLayers.Util.pagePosition(element);this.target.triggerEvent("buttonclick",{buttonElement:element,buttonXY:{x:this.startEvt.clientX-pos[0],y:this.startEvt.clientY-pos[1]}});}
if(this.cancelRegEx.test(evt.type)){delete this.startEvt;}
OpenLayers.Event.stop(evt);propagate=false;}
if(this.startRegEx.test(evt.type)){this.startEvt=evt;OpenLayers.Event.stop(evt);propagate=false;}}else{delete this.startEvt;}}
return propagate;}});OpenLayers.Control.OverviewMap=OpenLayers.Class(OpenLayers.Control,{element:null,ovmap:null,size:{w:180,h:90},layers:null,minRectSize:15,minRectDisplayClass:"RectReplacement",minRatio:8,maxRatio:32,mapOptions:null,autoPan:false,handlers:null,resolutionFactor:1,maximized:false,initialize:function(options){this.layers=[];this.handlers={};OpenLayers.Control.prototype.initialize.apply(this,[options]);},destroy:function(){if(!this.mapDiv){return;}
if(this.handlers.click){this.handlers.click.destroy();}
if(this.handlers.drag){this.handlers.drag.destroy();}
this.ovmap&&this.ovmap.viewPortDiv.removeChild(this.extentRectangle);this.extentRectangle=null;if(this.rectEvents){this.rectEvents.destroy();this.rectEvents=null;}
if(this.ovmap){this.ovmap.destroy();this.ovmap=null;}
this.element.removeChild(this.mapDiv);this.mapDiv=null;this.div.removeChild(this.element);this.element=null;if(this.maximizeDiv){this.div.removeChild(this.maximizeDiv);this.maximizeDiv=null;}
if(this.minimizeDiv){this.div.removeChild(this.minimizeDiv);this.minimizeDiv=null;}
this.map.events.un({buttonclick:this.onButtonClick,moveend:this.update,changebaselayer:this.baseLayerDraw,scope:this});OpenLayers.Control.prototype.destroy.apply(this,arguments);},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!(this.layers.length>0)){if(this.map.baseLayer){var layer=this.map.baseLayer.clone();this.layers=[layer];}else{this.map.events.register("changebaselayer",this,this.baseLayerDraw);return this.div;}}
this.element=document.createElement('div');this.element.className=this.displayClass+'Element';this.element.style.display='none';this.mapDiv=document.createElement('div');this.mapDiv.style.width=this.size.w+'px';this.mapDiv.style.height=this.size.h+'px';this.mapDiv.style.position='relative';this.mapDiv.style.overflow='hidden';this.mapDiv.id=OpenLayers.Util.createUniqueID('overviewMap');this.extentRectangle=document.createElement('div');this.extentRectangle.style.position='absolute';this.extentRectangle.style.zIndex=1000;this.extentRectangle.className=this.displayClass+'ExtentRectangle';this.element.appendChild(this.mapDiv);this.div.appendChild(this.element);if(!this.outsideViewport){this.div.className+=" "+this.displayClass+'Container';var img=OpenLayers.Util.getImageLocation('layer-switcher-maximize.png');this.maximizeDiv=OpenLayers.Util.createAlphaImageDiv(this.displayClass+'MaximizeButton',null,null,img,'absolute');this.maximizeDiv.style.display='none';this.maximizeDiv.className=this.displayClass+'MaximizeButton olButton';this.div.appendChild(this.maximizeDiv);var img=OpenLayers.Util.getImageLocation('layer-switcher-minimize.png');this.minimizeDiv=OpenLayers.Util.createAlphaImageDiv('OpenLayers_Control_minimizeDiv',null,null,img,'absolute');this.minimizeDiv.style.display='none';this.minimizeDiv.className=this.displayClass+'MinimizeButton olButton';this.div.appendChild(this.minimizeDiv);this.minimizeControl();}else{this.element.style.display='';}
if(this.map.getExtent()){this.update();}
this.map.events.on({buttonclick:this.onButtonClick,moveend:this.update,scope:this});if(this.maximized){this.maximizeControl();}
return this.div;},baseLayerDraw:function(){this.draw();this.map.events.unregister("changebaselayer",this,this.baseLayerDraw);},rectDrag:function(px){var deltaX=this.handlers.drag.last.x-px.x;var deltaY=this.handlers.drag.last.y-px.y;if(deltaX!=0||deltaY!=0){var rectTop=this.rectPxBounds.top;var rectLeft=this.rectPxBounds.left;var rectHeight=Math.abs(this.rectPxBounds.getHeight());var rectWidth=this.rectPxBounds.getWidth();var newTop=Math.max(0,(rectTop-deltaY));newTop=Math.min(newTop,this.ovmap.size.h-this.hComp-rectHeight);var newLeft=Math.max(0,(rectLeft-deltaX));newLeft=Math.min(newLeft,this.ovmap.size.w-this.wComp-rectWidth);this.setRectPxBounds(new OpenLayers.Bounds(newLeft,newTop+rectHeight,newLeft+rectWidth,newTop));}},mapDivClick:function(evt){var pxCenter=this.rectPxBounds.getCenterPixel();var deltaX=evt.xy.x-pxCenter.x;var deltaY=evt.xy.y-pxCenter.y;var top=this.rectPxBounds.top;var left=this.rectPxBounds.left;var height=Math.abs(this.rectPxBounds.getHeight());var width=this.rectPxBounds.getWidth();var newTop=Math.max(0,(top+deltaY));newTop=Math.min(newTop,this.ovmap.size.h-height);var newLeft=Math.max(0,(left+deltaX));newLeft=Math.min(newLeft,this.ovmap.size.w-width);this.setRectPxBounds(new OpenLayers.Bounds(newLeft,newTop+height,newLeft+width,newTop));this.updateMapToRect();},onButtonClick:function(evt){if(evt.buttonElement===this.minimizeDiv){this.minimizeControl();}else if(evt.buttonElement===this.maximizeDiv){this.maximizeControl();};},maximizeControl:function(e){this.element.style.display='';this.showToggle(false);if(e!=null){OpenLayers.Event.stop(e);}},minimizeControl:function(e){this.element.style.display='none';this.showToggle(true);if(e!=null){OpenLayers.Event.stop(e);}},showToggle:function(minimize){this.maximizeDiv.style.display=minimize?'':'none';this.minimizeDiv.style.display=minimize?'none':'';},update:function(){if(this.ovmap==null){this.createMap();}
if(this.autoPan||!this.isSuitableOverview()){this.updateOverview();}
this.updateRectToMap();},isSuitableOverview:function(){var mapExtent=this.map.getExtent();var maxExtent=this.map.maxExtent;var testExtent=new OpenLayers.Bounds(Math.max(mapExtent.left,maxExtent.left),Math.max(mapExtent.bottom,maxExtent.bottom),Math.min(mapExtent.right,maxExtent.right),Math.min(mapExtent.top,maxExtent.top));if(this.ovmap.getProjection()!=this.map.getProjection()){testExtent=testExtent.transform(this.map.getProjectionObject(),this.ovmap.getProjectionObject());}
var resRatio=this.ovmap.getResolution()/this.map.getResolution();return((resRatio>this.minRatio)&&(resRatio<=this.maxRatio)&&(this.ovmap.getExtent().containsBounds(testExtent)));},updateOverview:function(){var mapRes=this.map.getResolution();var targetRes=this.ovmap.getResolution();var resRatio=targetRes/mapRes;if(resRatio>this.maxRatio){targetRes=this.minRatio*mapRes;}else if(resRatio<=this.minRatio){targetRes=this.maxRatio*mapRes;}
var center;if(this.ovmap.getProjection()!=this.map.getProjection()){center=this.map.center.clone();center.transform(this.map.getProjectionObject(),this.ovmap.getProjectionObject());}else{center=this.map.center;}
this.ovmap.setCenter(center,this.ovmap.getZoomForResolution(targetRes*this.resolutionFactor));this.updateRectToMap();},createMap:function(){var options=OpenLayers.Util.extend({controls:[],maxResolution:'auto',fallThrough:false},this.mapOptions);this.ovmap=new OpenLayers.Map(this.mapDiv,options);this.ovmap.viewPortDiv.appendChild(this.extentRectangle);OpenLayers.Event.stopObserving(window,'unload',this.ovmap.unloadDestroy);this.ovmap.addLayers(this.layers);this.ovmap.zoomToMaxExtent();this.wComp=parseInt(OpenLayers.Element.getStyle(this.extentRectangle,'border-left-width'))+
parseInt(OpenLayers.Element.getStyle(this.extentRectangle,'border-right-width'));this.wComp=(this.wComp)?this.wComp:2;this.hComp=parseInt(OpenLayers.Element.getStyle(this.extentRectangle,'border-top-width'))+
parseInt(OpenLayers.Element.getStyle(this.extentRectangle,'border-bottom-width'));this.hComp=(this.hComp)?this.hComp:2;this.handlers.drag=new OpenLayers.Handler.Drag(this,{move:this.rectDrag,done:this.updateMapToRect},{map:this.ovmap});this.handlers.click=new OpenLayers.Handler.Click(this,{"click":this.mapDivClick},{"single":true,"double":false,"stopSingle":true,"stopDouble":true,"pixelTolerance":1,map:this.ovmap});this.handlers.click.activate();this.rectEvents=new OpenLayers.Events(this,this.extentRectangle,null,true);this.rectEvents.register("mouseover",this,function(e){if(!this.handlers.drag.active&&!this.map.dragging){this.handlers.drag.activate();}});this.rectEvents.register("mouseout",this,function(e){if(!this.handlers.drag.dragging){this.handlers.drag.deactivate();}});if(this.ovmap.getProjection()!=this.map.getProjection()){var sourceUnits=this.map.getProjectionObject().getUnits()||this.map.units||this.map.baseLayer.units;var targetUnits=this.ovmap.getProjectionObject().getUnits()||this.ovmap.units||this.ovmap.baseLayer.units;this.resolutionFactor=sourceUnits&&targetUnits?OpenLayers.INCHES_PER_UNIT[sourceUnits]/OpenLayers.INCHES_PER_UNIT[targetUnits]:1;}},updateRectToMap:function(){var bounds;if(this.ovmap.getProjection()!=this.map.getProjection()){bounds=this.map.getExtent().transform(this.map.getProjectionObject(),this.ovmap.getProjectionObject());}else{bounds=this.map.getExtent();}
var pxBounds=this.getRectBoundsFromMapBounds(bounds);if(pxBounds){this.setRectPxBounds(pxBounds);}},updateMapToRect:function(){var lonLatBounds=this.getMapBoundsFromRectBounds(this.rectPxBounds);if(this.ovmap.getProjection()!=this.map.getProjection()){lonLatBounds=lonLatBounds.transform(this.ovmap.getProjectionObject(),this.map.getProjectionObject());}
this.map.panTo(lonLatBounds.getCenterLonLat());},setRectPxBounds:function(pxBounds){var top=Math.max(pxBounds.top,0);var left=Math.max(pxBounds.left,0);var bottom=Math.min(pxBounds.top+Math.abs(pxBounds.getHeight()),this.ovmap.size.h-this.hComp);var right=Math.min(pxBounds.left+pxBounds.getWidth(),this.ovmap.size.w-this.wComp);var width=Math.max(right-left,0);var height=Math.max(bottom-top,0);if(width<this.minRectSize||height<this.minRectSize){this.extentRectangle.className=this.displayClass+
this.minRectDisplayClass;var rLeft=left+(width/2)-(this.minRectSize/2);var rTop=top+(height/2)-(this.minRectSize/2);this.extentRectangle.style.top=Math.round(rTop)+'px';this.extentRectangle.style.left=Math.round(rLeft)+'px';this.extentRectangle.style.height=this.minRectSize+'px';this.extentRectangle.style.width=this.minRectSize+'px';}else{this.extentRectangle.className=this.displayClass+'ExtentRectangle';this.extentRectangle.style.top=Math.round(top)+'px';this.extentRectangle.style.left=Math.round(left)+'px';this.extentRectangle.style.height=Math.round(height)+'px';this.extentRectangle.style.width=Math.round(width)+'px';}
this.rectPxBounds=new OpenLayers.Bounds(Math.round(left),Math.round(bottom),Math.round(right),Math.round(top));},getRectBoundsFromMapBounds:function(lonLatBounds){var leftBottomPx=this.getOverviewPxFromLonLat({lon:lonLatBounds.left,lat:lonLatBounds.bottom});var rightTopPx=this.getOverviewPxFromLonLat({lon:lonLatBounds.right,lat:lonLatBounds.top});var bounds=null;if(leftBottomPx&&rightTopPx){bounds=new OpenLayers.Bounds(leftBottomPx.x,leftBottomPx.y,rightTopPx.x,rightTopPx.y);}
return bounds;},getMapBoundsFromRectBounds:function(pxBounds){var leftBottomLonLat=this.getLonLatFromOverviewPx({x:pxBounds.left,y:pxBounds.bottom});var rightTopLonLat=this.getLonLatFromOverviewPx({x:pxBounds.right,y:pxBounds.top});return new OpenLayers.Bounds(leftBottomLonLat.lon,leftBottomLonLat.lat,rightTopLonLat.lon,rightTopLonLat.lat);},getLonLatFromOverviewPx:function(overviewMapPx){var size=this.ovmap.size;var res=this.ovmap.getResolution();var center=this.ovmap.getExtent().getCenterLonLat();var deltaX=overviewMapPx.x-(size.w/2);var deltaY=overviewMapPx.y-(size.h/2);return{lon:center.lon+deltaX*res,lat:center.lat-deltaY*res};},getOverviewPxFromLonLat:function(lonlat){var res=this.ovmap.getResolution();var extent=this.ovmap.getExtent();if(extent){return{x:Math.round(1/res*(lonlat.lon-extent.left)),y:Math.round(1/res*(extent.top-lonlat.lat))};}},CLASS_NAME:'OpenLayers.Control.OverviewMap'});OpenLayers.Feature=OpenLayers.Class({layer:null,id:null,lonlat:null,data:null,marker:null,popupClass:null,popup:null,initialize:function(layer,lonlat,data){this.layer=layer;this.lonlat=lonlat;this.data=(data!=null)?data:{};this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");},destroy:function(){if((this.layer!=null)&&(this.layer.map!=null)){if(this.popup!=null){this.layer.map.removePopup(this.popup);}}
if(this.layer!=null&&this.marker!=null){this.layer.removeMarker(this.marker);}
this.layer=null;this.id=null;this.lonlat=null;this.data=null;if(this.marker!=null){this.destroyMarker(this.marker);this.marker=null;}
if(this.popup!=null){this.destroyPopup(this.popup);this.popup=null;}},onScreen:function(){var onScreen=false;if((this.layer!=null)&&(this.layer.map!=null)){var screenBounds=this.layer.map.getExtent();onScreen=screenBounds.containsLonLat(this.lonlat);}
return onScreen;},createMarker:function(){if(this.lonlat!=null){this.marker=new OpenLayers.Marker(this.lonlat,this.data.icon);}
return this.marker;},destroyMarker:function(){this.marker.destroy();},createPopup:function(closeBox){if(this.lonlat!=null){if(!this.popup){var anchor=(this.marker)?this.marker.icon:null;var popupClass=this.popupClass?this.popupClass:OpenLayers.Popup.Anchored;this.popup=new popupClass(this.id+"_popup",this.lonlat,this.data.popupSize,this.data.popupContentHTML,anchor,closeBox);}
if(this.data.overflow!=null){this.popup.contentDiv.style.overflow=this.data.overflow;}
this.popup.feature=this;}
return this.popup;},destroyPopup:function(){if(this.popup){this.popup.feature=null;this.popup.destroy();this.popup=null;}},CLASS_NAME:"OpenLayers.Feature"});OpenLayers.State={UNKNOWN:'Unknown',INSERT:'Insert',UPDATE:'Update',DELETE:'Delete'};OpenLayers.Feature.Vector=OpenLayers.Class(OpenLayers.Feature,{fid:null,geometry:null,attributes:null,bounds:null,state:null,style:null,url:null,renderIntent:"default",modified:null,initialize:function(geometry,attributes,style){OpenLayers.Feature.prototype.initialize.apply(this,[null,null,attributes]);this.lonlat=null;this.geometry=geometry?geometry:null;this.state=null;this.attributes={};if(attributes){this.attributes=OpenLayers.Util.extend(this.attributes,attributes);}
this.style=style?style:null;},destroy:function(){if(this.layer){this.layer.removeFeatures(this);this.layer=null;}
this.geometry=null;this.modified=null;OpenLayers.Feature.prototype.destroy.apply(this,arguments);},clone:function(){return new OpenLayers.Feature.Vector(this.geometry?this.geometry.clone():null,this.attributes,this.style);},onScreen:function(boundsOnly){var onScreen=false;if(this.layer&&this.layer.map){var screenBounds=this.layer.map.getExtent();if(boundsOnly){var featureBounds=this.geometry.getBounds();onScreen=screenBounds.intersectsBounds(featureBounds);}else{var screenPoly=screenBounds.toGeometry();onScreen=screenPoly.intersects(this.geometry);}}
return onScreen;},getVisibility:function(){return!(this.style&&this.style.display=='none'||!this.layer||this.layer&&this.layer.styleMap&&this.layer.styleMap.createSymbolizer(this,this.renderIntent).display=='none'||this.layer&&!this.layer.getVisibility());},createMarker:function(){return null;},destroyMarker:function(){},createPopup:function(){return null;},atPoint:function(lonlat,toleranceLon,toleranceLat){var atPoint=false;if(this.geometry){atPoint=this.geometry.atPoint(lonlat,toleranceLon,toleranceLat);}
return atPoint;},destroyPopup:function(){},move:function(location){if(!this.layer||!this.geometry.move){return undefined;}
var pixel;if(location.CLASS_NAME=="OpenLayers.LonLat"){pixel=this.layer.getViewPortPxFromLonLat(location);}else{pixel=location;}
var lastPixel=this.layer.getViewPortPxFromLonLat(this.geometry.getBounds().getCenterLonLat());var res=this.layer.map.getResolution();this.geometry.move(res*(pixel.x-lastPixel.x),res*(lastPixel.y-pixel.y));this.layer.drawFeature(this);return lastPixel;},toState:function(state){if(state==OpenLayers.State.UPDATE){switch(this.state){case OpenLayers.State.UNKNOWN:case OpenLayers.State.DELETE:this.state=state;break;case OpenLayers.State.UPDATE:case OpenLayers.State.INSERT:break;}}else if(state==OpenLayers.State.INSERT){switch(this.state){case OpenLayers.State.UNKNOWN:break;default:this.state=state;break;}}else if(state==OpenLayers.State.DELETE){switch(this.state){case OpenLayers.State.INSERT:break;case OpenLayers.State.DELETE:break;case OpenLayers.State.UNKNOWN:case OpenLayers.State.UPDATE:this.state=state;break;}}else if(state==OpenLayers.State.UNKNOWN){this.state=state;}},CLASS_NAME:"OpenLayers.Feature.Vector"});OpenLayers.Feature.Vector.style={'default':{fillColor:"#ee9900",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#ee9900",strokeOpacity:1,strokeWidth:1,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit",fontColor:"#000000",labelAlign:"cm",labelOutlineColor:"white",labelOutlineWidth:3},'select':{fillColor:"blue",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"blue",strokeOpacity:1,strokeWidth:2,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"pointer",fontColor:"#000000",labelAlign:"cm",labelOutlineColor:"white",labelOutlineWidth:3},'temporary':{fillColor:"#66cccc",fillOpacity:0.2,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#66cccc",strokeOpacity:1,strokeLinecap:"round",strokeWidth:2,strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit",fontColor:"#000000",labelAlign:"cm",labelOutlineColor:"white",labelOutlineWidth:3},'delete':{display:"none"}};OpenLayers.Control.Measure=OpenLayers.Class(OpenLayers.Control,{handlerOptions:null,callbacks:null,displaySystem:'metric',geodesic:false,displaySystemUnits:{geographic:['dd'],english:['mi','ft','in'],metric:['km','m']},partialDelay:300,delayedTrigger:null,persist:false,immediate:false,initialize:function(handler,options){OpenLayers.Control.prototype.initialize.apply(this,[options]);var callbacks={done:this.measureComplete,point:this.measurePartial};if(this.immediate){callbacks.modify=this.measureImmediate;}
this.callbacks=OpenLayers.Util.extend(callbacks,this.callbacks);this.handlerOptions=OpenLayers.Util.extend({persist:this.persist},this.handlerOptions);this.handler=new handler(this,this.callbacks,this.handlerOptions);},deactivate:function(){this.cancelDelay();return OpenLayers.Control.prototype.deactivate.apply(this,arguments);},cancel:function(){this.cancelDelay();this.handler.cancel();},setImmediate:function(immediate){this.immediate=immediate;if(this.immediate){this.callbacks.modify=this.measureImmediate;}else{delete this.callbacks.modify;}},updateHandler:function(handler,options){var active=this.active;if(active){this.deactivate();}
this.handler=new handler(this,this.callbacks,options);if(active){this.activate();}},measureComplete:function(geometry){this.cancelDelay();this.measure(geometry,"measure");},measurePartial:function(point,geometry){this.cancelDelay();geometry=geometry.clone();if(this.handler.freehandMode(this.handler.evt)){this.measure(geometry,"measurepartial");}else{this.delayedTrigger=window.setTimeout(OpenLayers.Function.bind(function(){this.delayedTrigger=null;this.measure(geometry,"measurepartial");},this),this.partialDelay);}},measureImmediate:function(point,feature,drawing){if(drawing&&this.delayedTrigger===null&&!this.handler.freehandMode(this.handler.evt)){this.measure(feature.geometry,"measurepartial");}},cancelDelay:function(){if(this.delayedTrigger!==null){window.clearTimeout(this.delayedTrigger);this.delayedTrigger=null;}},measure:function(geometry,eventType){var stat,order;if(geometry.CLASS_NAME.indexOf('LineString')>-1){stat=this.getBestLength(geometry);order=1;}else{stat=this.getBestArea(geometry);order=2;}
this.events.triggerEvent(eventType,{measure:stat[0],units:stat[1],order:order,geometry:geometry});},getBestArea:function(geometry){var units=this.displaySystemUnits[this.displaySystem];var unit,area;for(var i=0,len=units.length;i<len;++i){unit=units[i];area=this.getArea(geometry,unit);if(area>1){break;}}
return[area,unit];},getArea:function(geometry,units){var area,geomUnits;if(this.geodesic){area=geometry.getGeodesicArea(this.map.getProjectionObject());geomUnits="m";}else{area=geometry.getArea();geomUnits=this.map.getUnits();}
var inPerDisplayUnit=OpenLayers.INCHES_PER_UNIT[units];if(inPerDisplayUnit){var inPerMapUnit=OpenLayers.INCHES_PER_UNIT[geomUnits];area*=Math.pow((inPerMapUnit/inPerDisplayUnit),2);}
return area;},getBestLength:function(geometry){var units=this.displaySystemUnits[this.displaySystem];var unit,length;for(var i=0,len=units.length;i<len;++i){unit=units[i];length=this.getLength(geometry,unit);if(length>1){break;}}
return[length,unit];},getLength:function(geometry,units){var length,geomUnits;if(this.geodesic){length=geometry.getGeodesicLength(this.map.getProjectionObject());geomUnits="m";}else{length=geometry.getLength();geomUnits=this.map.getUnits();}
var inPerDisplayUnit=OpenLayers.INCHES_PER_UNIT[units];if(inPerDisplayUnit){var inPerMapUnit=OpenLayers.INCHES_PER_UNIT[geomUnits];length*=(inPerMapUnit/inPerDisplayUnit);}
return length;},CLASS_NAME:"OpenLayers.Control.Measure"});OpenLayers.Handler=OpenLayers.Class({id:null,control:null,map:null,keyMask:null,active:false,evt:null,initialize:function(control,callbacks,options){OpenLayers.Util.extend(this,options);this.control=control;this.callbacks=callbacks;var map=this.map||control.map;if(map){this.setMap(map);}
this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");},setMap:function(map){this.map=map;},checkModifiers:function(evt){if(this.keyMask==null){return true;}
var keyModifiers=(evt.shiftKey?OpenLayers.Handler.MOD_SHIFT:0)|(evt.ctrlKey?OpenLayers.Handler.MOD_CTRL:0)|(evt.altKey?OpenLayers.Handler.MOD_ALT:0);return(keyModifiers==this.keyMask);},activate:function(){if(this.active){return false;}
var events=OpenLayers.Events.prototype.BROWSER_EVENTS;for(var i=0,len=events.length;i<len;i++){if(this[events[i]]){this.register(events[i],this[events[i]]);}}
this.active=true;return true;},deactivate:function(){if(!this.active){return false;}
var events=OpenLayers.Events.prototype.BROWSER_EVENTS;for(var i=0,len=events.length;i<len;i++){if(this[events[i]]){this.unregister(events[i],this[events[i]]);}}
this.active=false;return true;},callback:function(name,args){if(name&&this.callbacks[name]){this.callbacks[name].apply(this.control,args);}},register:function(name,method){this.map.events.registerPriority(name,this,method);this.map.events.registerPriority(name,this,this.setEvent);},unregister:function(name,method){this.map.events.unregister(name,this,method);this.map.events.unregister(name,this,this.setEvent);},setEvent:function(evt){this.evt=evt;return true;},destroy:function(){this.deactivate();this.control=this.map=null;},CLASS_NAME:"OpenLayers.Handler"});OpenLayers.Handler.MOD_NONE=0;OpenLayers.Handler.MOD_SHIFT=1;OpenLayers.Handler.MOD_CTRL=2;OpenLayers.Handler.MOD_ALT=4;OpenLayers.Geometry=OpenLayers.Class({id:null,parent:null,bounds:null,initialize:function(){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");},destroy:function(){this.id=null;this.bounds=null;},clone:function(){return new OpenLayers.Geometry();},setBounds:function(bounds){if(bounds){this.bounds=bounds.clone();}},clearBounds:function(){this.bounds=null;if(this.parent){this.parent.clearBounds();}},extendBounds:function(newBounds){var bounds=this.getBounds();if(!bounds){this.setBounds(newBounds);}else{this.bounds.extend(newBounds);}},getBounds:function(){if(this.bounds==null){this.calculateBounds();}
return this.bounds;},calculateBounds:function(){},distanceTo:function(geometry,options){},getVertices:function(nodes){},atPoint:function(lonlat,toleranceLon,toleranceLat){var atPoint=false;var bounds=this.getBounds();if((bounds!=null)&&(lonlat!=null)){var dX=(toleranceLon!=null)?toleranceLon:0;var dY=(toleranceLat!=null)?toleranceLat:0;var toleranceBounds=new OpenLayers.Bounds(this.bounds.left-dX,this.bounds.bottom-dY,this.bounds.right+dX,this.bounds.top+dY);atPoint=toleranceBounds.containsLonLat(lonlat);}
return atPoint;},getLength:function(){return 0.0;},getArea:function(){return 0.0;},getCentroid:function(){return null;},toString:function(){var string;if(OpenLayers.Format&&OpenLayers.Format.WKT){string=OpenLayers.Format.WKT.prototype.write(new OpenLayers.Feature.Vector(this));}else{string=Object.prototype.toString.call(this);}
return string;},CLASS_NAME:"OpenLayers.Geometry"});OpenLayers.Geometry.fromWKT=function(wkt){var geom;if(OpenLayers.Format&&OpenLayers.Format.WKT){var format=OpenLayers.Geometry.fromWKT.format;if(!format){format=new OpenLayers.Format.WKT();OpenLayers.Geometry.fromWKT.format=format;}
var result=format.read(wkt);if(result instanceof OpenLayers.Feature.Vector){geom=result.geometry;}else if(OpenLayers.Util.isArray(result)){var len=result.length;var components=new Array(len);for(var i=0;i<len;++i){components[i]=result[i].geometry;}
geom=new OpenLayers.Geometry.Collection(components);}}
return geom;};OpenLayers.Geometry.segmentsIntersect=function(seg1,seg2,options){var point=options&&options.point;var tolerance=options&&options.tolerance;var intersection=false;var x11_21=seg1.x1-seg2.x1;var y11_21=seg1.y1-seg2.y1;var x12_11=seg1.x2-seg1.x1;var y12_11=seg1.y2-seg1.y1;var y22_21=seg2.y2-seg2.y1;var x22_21=seg2.x2-seg2.x1;var d=(y22_21*x12_11)-(x22_21*y12_11);var n1=(x22_21*y11_21)-(y22_21*x11_21);var n2=(x12_11*y11_21)-(y12_11*x11_21);if(d==0){if(n1==0&&n2==0){intersection=true;}}else{var along1=n1/d;var along2=n2/d;if(along1>=0&&along1<=1&&along2>=0&&along2<=1){if(!point){intersection=true;}else{var x=seg1.x1+(along1*x12_11);var y=seg1.y1+(along1*y12_11);intersection=new OpenLayers.Geometry.Point(x,y);}}}
if(tolerance){var dist;if(intersection){if(point){var segs=[seg1,seg2];var seg,x,y;outer:for(var i=0;i<2;++i){seg=segs[i];for(var j=1;j<3;++j){x=seg["x"+j];y=seg["y"+j];dist=Math.sqrt(Math.pow(x-intersection.x,2)+
Math.pow(y-intersection.y,2));if(dist<tolerance){intersection.x=x;intersection.y=y;break outer;}}}}}else{var segs=[seg1,seg2];var source,target,x,y,p,result;outer:for(var i=0;i<2;++i){source=segs[i];target=segs[(i+1)%2];for(var j=1;j<3;++j){p={x:source["x"+j],y:source["y"+j]};result=OpenLayers.Geometry.distanceToSegment(p,target);if(result.distance<tolerance){if(point){intersection=new OpenLayers.Geometry.Point(p.x,p.y);}else{intersection=true;}
break outer;}}}}}
return intersection;};OpenLayers.Geometry.distanceToSegment=function(point,segment){var x0=point.x;var y0=point.y;var x1=segment.x1;var y1=segment.y1;var x2=segment.x2;var y2=segment.y2;var dx=x2-x1;var dy=y2-y1;var along=((dx*(x0-x1))+(dy*(y0-y1)))/(Math.pow(dx,2)+Math.pow(dy,2));var x,y;if(along<=0.0){x=x1;y=y1;}else if(along>=1.0){x=x2;y=y2;}else{x=x1+along*dx;y=y1+along*dy;}
return{distance:Math.sqrt(Math.pow(x-x0,2)+Math.pow(y-y0,2)),x:x,y:y};};OpenLayers.Geometry.Point=OpenLayers.Class(OpenLayers.Geometry,{x:null,y:null,initialize:function(x,y){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.x=parseFloat(x);this.y=parseFloat(y);},clone:function(obj){if(obj==null){obj=new OpenLayers.Geometry.Point(this.x,this.y);}
OpenLayers.Util.applyDefaults(obj,this);return obj;},calculateBounds:function(){this.bounds=new OpenLayers.Bounds(this.x,this.y,this.x,this.y);},distanceTo:function(geometry,options){var edge=!(options&&options.edge===false);var details=edge&&options&&options.details;var distance,x0,y0,x1,y1,result;if(geometry instanceof OpenLayers.Geometry.Point){x0=this.x;y0=this.y;x1=geometry.x;y1=geometry.y;distance=Math.sqrt(Math.pow(x0-x1,2)+Math.pow(y0-y1,2));result=!details?distance:{x0:x0,y0:y0,x1:x1,y1:y1,distance:distance};}else{result=geometry.distanceTo(this,options);if(details){result={x0:result.x1,y0:result.y1,x1:result.x0,y1:result.y0,distance:result.distance};}}
return result;},equals:function(geom){var equals=false;if(geom!=null){equals=((this.x==geom.x&&this.y==geom.y)||(isNaN(this.x)&&isNaN(this.y)&&isNaN(geom.x)&&isNaN(geom.y)));}
return equals;},toShortString:function(){return(this.x+", "+this.y);},move:function(x,y){this.x=this.x+x;this.y=this.y+y;this.clearBounds();},rotate:function(angle,origin){angle*=Math.PI/180;var radius=this.distanceTo(origin);var theta=angle+Math.atan2(this.y-origin.y,this.x-origin.x);this.x=origin.x+(radius*Math.cos(theta));this.y=origin.y+(radius*Math.sin(theta));this.clearBounds();},getCentroid:function(){return new OpenLayers.Geometry.Point(this.x,this.y);},resize:function(scale,origin,ratio){ratio=(ratio==undefined)?1:ratio;this.x=origin.x+(scale*ratio*(this.x-origin.x));this.y=origin.y+(scale*(this.y-origin.y));this.clearBounds();return this;},intersects:function(geometry){var intersect=false;if(geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){intersect=this.equals(geometry);}else{intersect=geometry.intersects(this);}
return intersect;},transform:function(source,dest){if((source&&dest)){OpenLayers.Projection.transform(this,source,dest);this.bounds=null;}
return this;},getVertices:function(nodes){return[this];},CLASS_NAME:"OpenLayers.Geometry.Point"});OpenLayers.Handler.Point=OpenLayers.Class(OpenLayers.Handler,{point:null,layer:null,multi:false,citeCompliant:false,mouseDown:false,stoppedDown:null,lastDown:null,lastUp:null,persist:false,stopDown:false,stopUp:false,layerOptions:null,pixelTolerance:5,touch:false,lastTouchPx:null,initialize:function(control,callbacks,options){if(!(options&&options.layerOptions&&options.layerOptions.styleMap)){this.style=OpenLayers.Util.extend(OpenLayers.Feature.Vector.style['default'],{});}
OpenLayers.Handler.prototype.initialize.apply(this,arguments);},activate:function(){if(!OpenLayers.Handler.prototype.activate.apply(this,arguments)){return false;}
var options=OpenLayers.Util.extend({displayInLayerSwitcher:false,calculateInRange:OpenLayers.Function.True,wrapDateLine:this.citeCompliant},this.layerOptions);this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,options);this.map.addLayer(this.layer);return true;},createFeature:function(pixel){var lonlat=this.layer.getLonLatFromViewPortPx(pixel);var geometry=new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat);this.point=new OpenLayers.Feature.Vector(geometry);this.callback("create",[this.point.geometry,this.point]);this.point.geometry.clearBounds();this.layer.addFeatures([this.point],{silent:true});},deactivate:function(){if(!OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){return false;}
this.cancel();if(this.layer.map!=null){this.destroyFeature(true);this.layer.destroy(false);}
this.layer=null;this.touch=false;return true;},destroyFeature:function(force){if(this.layer&&(force||!this.persist)){this.layer.destroyFeatures();}
this.point=null;},destroyPersistedFeature:function(){var layer=this.layer;if(layer&&layer.features.length>1){this.layer.features[0].destroy();}},finalize:function(cancel){var key=cancel?"cancel":"done";this.mouseDown=false;this.lastDown=null;this.lastUp=null;this.lastTouchPx=null;this.callback(key,[this.geometryClone()]);this.destroyFeature(cancel);},cancel:function(){this.finalize(true);},click:function(evt){OpenLayers.Event.stop(evt);return false;},dblclick:function(evt){OpenLayers.Event.stop(evt);return false;},modifyFeature:function(pixel){if(!this.point){this.createFeature(pixel);}
var lonlat=this.layer.getLonLatFromViewPortPx(pixel);this.point.geometry.x=lonlat.lon;this.point.geometry.y=lonlat.lat;this.callback("modify",[this.point.geometry,this.point,false]);this.point.geometry.clearBounds();this.drawFeature();},drawFeature:function(){this.layer.drawFeature(this.point,this.style);},getGeometry:function(){var geometry=this.point&&this.point.geometry;if(geometry&&this.multi){geometry=new OpenLayers.Geometry.MultiPoint([geometry]);}
return geometry;},geometryClone:function(){var geom=this.getGeometry();return geom&&geom.clone();},mousedown:function(evt){return this.down(evt);},touchstart:function(evt){if(!this.touch){this.touch=true;this.map.events.un({mousedown:this.mousedown,mouseup:this.mouseup,mousemove:this.mousemove,click:this.click,dblclick:this.dblclick,scope:this});}
this.lastTouchPx=evt.xy;return this.down(evt);},mousemove:function(evt){return this.move(evt);},touchmove:function(evt){this.lastTouchPx=evt.xy;return this.move(evt);},mouseup:function(evt){return this.up(evt);},touchend:function(evt){evt.xy=this.lastTouchPx;return this.up(evt);},down:function(evt){this.mouseDown=true;this.lastDown=evt.xy;if(!this.touch){this.modifyFeature(evt.xy);}
this.stoppedDown=this.stopDown;return!this.stopDown;},move:function(evt){if(!this.touch&&(!this.mouseDown||this.stoppedDown)){this.modifyFeature(evt.xy);}
return true;},up:function(evt){this.mouseDown=false;this.stoppedDown=this.stopDown;if(!this.checkModifiers(evt)){return true;}
if(this.lastUp&&this.lastUp.equals(evt.xy)){return true;}
if(this.lastDown&&this.passesTolerance(this.lastDown,evt.xy,this.pixelTolerance)){if(this.touch){this.modifyFeature(evt.xy);}
if(this.persist){this.destroyPersistedFeature();}
this.lastUp=evt.xy;this.finalize();return!this.stopUp;}else{return true;}},mouseout:function(evt){if(OpenLayers.Util.mouseLeft(evt,this.map.viewPortDiv)){this.stoppedDown=this.stopDown;this.mouseDown=false;}},passesTolerance:function(pixel1,pixel2,tolerance){var passes=true;if(tolerance!=null&&pixel1&&pixel2){var dist=pixel1.distanceTo(pixel2);if(dist>tolerance){passes=false;}}
return passes;},CLASS_NAME:"OpenLayers.Handler.Point"});OpenLayers.Geometry.Collection=OpenLayers.Class(OpenLayers.Geometry,{components:null,componentTypes:null,initialize:function(components){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.components=[];if(components!=null){this.addComponents(components);}},destroy:function(){this.components.length=0;this.components=null;OpenLayers.Geometry.prototype.destroy.apply(this,arguments);},clone:function(){var geometry=eval("new "+this.CLASS_NAME+"()");for(var i=0,len=this.components.length;i<len;i++){geometry.addComponent(this.components[i].clone());}
OpenLayers.Util.applyDefaults(geometry,this);return geometry;},getComponentsString:function(){var strings=[];for(var i=0,len=this.components.length;i<len;i++){strings.push(this.components[i].toShortString());}
return strings.join(",");},calculateBounds:function(){this.bounds=null;var bounds=new OpenLayers.Bounds();var components=this.components;if(components){for(var i=0,len=components.length;i<len;i++){bounds.extend(components[i].getBounds());}}
if(bounds.left!=null&&bounds.bottom!=null&&bounds.right!=null&&bounds.top!=null){this.setBounds(bounds);}},addComponents:function(components){if(!(OpenLayers.Util.isArray(components))){components=[components];}
for(var i=0,len=components.length;i<len;i++){this.addComponent(components[i]);}},addComponent:function(component,index){var added=false;if(component){if(this.componentTypes==null||(OpenLayers.Util.indexOf(this.componentTypes,component.CLASS_NAME)>-1)){if(index!=null&&(index<this.components.length)){var components1=this.components.slice(0,index);var components2=this.components.slice(index,this.components.length);components1.push(component);this.components=components1.concat(components2);}else{this.components.push(component);}
component.parent=this;this.clearBounds();added=true;}}
return added;},removeComponents:function(components){var removed=false;if(!(OpenLayers.Util.isArray(components))){components=[components];}
for(var i=components.length-1;i>=0;--i){removed=this.removeComponent(components[i])||removed;}
return removed;},removeComponent:function(component){OpenLayers.Util.removeItem(this.components,component);this.clearBounds();return true;},getLength:function(){var length=0.0;for(var i=0,len=this.components.length;i<len;i++){length+=this.components[i].getLength();}
return length;},getArea:function(){var area=0.0;for(var i=0,len=this.components.length;i<len;i++){area+=this.components[i].getArea();}
return area;},getGeodesicArea:function(projection){var area=0.0;for(var i=0,len=this.components.length;i<len;i++){area+=this.components[i].getGeodesicArea(projection);}
return area;},getCentroid:function(weighted){if(!weighted){return this.components.length&&this.components[0].getCentroid();}
var len=this.components.length;if(!len){return false;}
var areas=[];var centroids=[];var areaSum=0;var minArea=Number.MAX_VALUE;var component;for(var i=0;i<len;++i){component=this.components[i];var area=component.getArea();var centroid=component.getCentroid(true);if(isNaN(area)||isNaN(centroid.x)||isNaN(centroid.y)){continue;}
areas.push(area);areaSum+=area;minArea=(area<minArea&&area>0)?area:minArea;centroids.push(centroid);}
len=areas.length;if(areaSum===0){for(var i=0;i<len;++i){areas[i]=1;}
areaSum=areas.length;}else{for(var i=0;i<len;++i){areas[i]/=minArea;}
areaSum/=minArea;}
var xSum=0,ySum=0,centroid,area;for(var i=0;i<len;++i){centroid=centroids[i];area=areas[i];xSum+=centroid.x*area;ySum+=centroid.y*area;}
return new OpenLayers.Geometry.Point(xSum/areaSum,ySum/areaSum);},getGeodesicLength:function(projection){var length=0.0;for(var i=0,len=this.components.length;i<len;i++){length+=this.components[i].getGeodesicLength(projection);}
return length;},move:function(x,y){for(var i=0,len=this.components.length;i<len;i++){this.components[i].move(x,y);}},rotate:function(angle,origin){for(var i=0,len=this.components.length;i<len;++i){this.components[i].rotate(angle,origin);}},resize:function(scale,origin,ratio){for(var i=0;i<this.components.length;++i){this.components[i].resize(scale,origin,ratio);}
return this;},distanceTo:function(geometry,options){var edge=!(options&&options.edge===false);var details=edge&&options&&options.details;var result,best,distance;var min=Number.POSITIVE_INFINITY;for(var i=0,len=this.components.length;i<len;++i){result=this.components[i].distanceTo(geometry,options);distance=details?result.distance:result;if(distance<min){min=distance;best=result;if(min==0){break;}}}
return best;},equals:function(geometry){var equivalent=true;if(!geometry||!geometry.CLASS_NAME||(this.CLASS_NAME!=geometry.CLASS_NAME)){equivalent=false;}else if(!(OpenLayers.Util.isArray(geometry.components))||(geometry.components.length!=this.components.length)){equivalent=false;}else{for(var i=0,len=this.components.length;i<len;++i){if(!this.components[i].equals(geometry.components[i])){equivalent=false;break;}}}
return equivalent;},transform:function(source,dest){if(source&&dest){for(var i=0,len=this.components.length;i<len;i++){var component=this.components[i];component.transform(source,dest);}
this.bounds=null;}
return this;},intersects:function(geometry){var intersect=false;for(var i=0,len=this.components.length;i<len;++i){intersect=geometry.intersects(this.components[i]);if(intersect){break;}}
return intersect;},getVertices:function(nodes){var vertices=[];for(var i=0,len=this.components.length;i<len;++i){Array.prototype.push.apply(vertices,this.components[i].getVertices(nodes));}
return vertices;},CLASS_NAME:"OpenLayers.Geometry.Collection"});OpenLayers.Geometry.MultiPoint=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.Point"],addPoint:function(point,index){this.addComponent(point,index);},removePoint:function(point){this.removeComponent(point);},CLASS_NAME:"OpenLayers.Geometry.MultiPoint"});OpenLayers.Geometry.Curve=OpenLayers.Class(OpenLayers.Geometry.MultiPoint,{componentTypes:["OpenLayers.Geometry.Point"],getLength:function(){var length=0.0;if(this.components&&(this.components.length>1)){for(var i=1,len=this.components.length;i<len;i++){length+=this.components[i-1].distanceTo(this.components[i]);}}
return length;},getGeodesicLength:function(projection){var geom=this;if(projection){var gg=new OpenLayers.Projection("EPSG:4326");if(!gg.equals(projection)){geom=this.clone().transform(projection,gg);}}
var length=0.0;if(geom.components&&(geom.components.length>1)){var p1,p2;for(var i=1,len=geom.components.length;i<len;i++){p1=geom.components[i-1];p2=geom.components[i];length+=OpenLayers.Util.distVincenty({lon:p1.x,lat:p1.y},{lon:p2.x,lat:p2.y});}}
return length*1000;},CLASS_NAME:"OpenLayers.Geometry.Curve"});OpenLayers.Geometry.LineString=OpenLayers.Class(OpenLayers.Geometry.Curve,{removeComponent:function(point){var removed=this.components&&(this.components.length>2);if(removed){OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);}
return removed;},intersects:function(geometry){var intersect=false;var type=geometry.CLASS_NAME;if(type=="OpenLayers.Geometry.LineString"||type=="OpenLayers.Geometry.LinearRing"||type=="OpenLayers.Geometry.Point"){var segs1=this.getSortedSegments();var segs2;if(type=="OpenLayers.Geometry.Point"){segs2=[{x1:geometry.x,y1:geometry.y,x2:geometry.x,y2:geometry.y}];}else{segs2=geometry.getSortedSegments();}
var seg1,seg1x1,seg1x2,seg1y1,seg1y2,seg2,seg2y1,seg2y2;outer:for(var i=0,len=segs1.length;i<len;++i){seg1=segs1[i];seg1x1=seg1.x1;seg1x2=seg1.x2;seg1y1=seg1.y1;seg1y2=seg1.y2;inner:for(var j=0,jlen=segs2.length;j<jlen;++j){seg2=segs2[j];if(seg2.x1>seg1x2){break;}
if(seg2.x2<seg1x1){continue;}
seg2y1=seg2.y1;seg2y2=seg2.y2;if(Math.min(seg2y1,seg2y2)>Math.max(seg1y1,seg1y2)){continue;}
if(Math.max(seg2y1,seg2y2)<Math.min(seg1y1,seg1y2)){continue;}
if(OpenLayers.Geometry.segmentsIntersect(seg1,seg2)){intersect=true;break outer;}}}}else{intersect=geometry.intersects(this);}
return intersect;},getSortedSegments:function(){var numSeg=this.components.length-1;var segments=new Array(numSeg),point1,point2;for(var i=0;i<numSeg;++i){point1=this.components[i];point2=this.components[i+1];if(point1.x<point2.x){segments[i]={x1:point1.x,y1:point1.y,x2:point2.x,y2:point2.y};}else{segments[i]={x1:point2.x,y1:point2.y,x2:point1.x,y2:point1.y};}}
function byX1(seg1,seg2){return seg1.x1-seg2.x1;}
return segments.sort(byX1);},splitWithSegment:function(seg,options){var edge=!(options&&options.edge===false);var tolerance=options&&options.tolerance;var lines=[];var verts=this.getVertices();var points=[];var intersections=[];var split=false;var vert1,vert2,point;var node,vertex,target;var interOptions={point:true,tolerance:tolerance};var result=null;for(var i=0,stop=verts.length-2;i<=stop;++i){vert1=verts[i];points.push(vert1.clone());vert2=verts[i+1];target={x1:vert1.x,y1:vert1.y,x2:vert2.x,y2:vert2.y};point=OpenLayers.Geometry.segmentsIntersect(seg,target,interOptions);if(point instanceof OpenLayers.Geometry.Point){if((point.x===seg.x1&&point.y===seg.y1)||(point.x===seg.x2&&point.y===seg.y2)||point.equals(vert1)||point.equals(vert2)){vertex=true;}else{vertex=false;}
if(vertex||edge){if(!point.equals(intersections[intersections.length-1])){intersections.push(point.clone());}
if(i===0){if(point.equals(vert1)){continue;}}
if(point.equals(vert2)){continue;}
split=true;if(!point.equals(vert1)){points.push(point);}
lines.push(new OpenLayers.Geometry.LineString(points));points=[point.clone()];}}}
if(split){points.push(vert2.clone());lines.push(new OpenLayers.Geometry.LineString(points));}
if(intersections.length>0){var xDir=seg.x1<seg.x2?1:-1;var yDir=seg.y1<seg.y2?1:-1;result={lines:lines,points:intersections.sort(function(p1,p2){return(xDir*p1.x-xDir*p2.x)||(yDir*p1.y-yDir*p2.y);})};}
return result;},split:function(target,options){var results=null;var mutual=options&&options.mutual;var sourceSplit,targetSplit,sourceParts,targetParts;if(target instanceof OpenLayers.Geometry.LineString){var verts=this.getVertices();var vert1,vert2,seg,splits,lines,point;var points=[];sourceParts=[];for(var i=0,stop=verts.length-2;i<=stop;++i){vert1=verts[i];vert2=verts[i+1];seg={x1:vert1.x,y1:vert1.y,x2:vert2.x,y2:vert2.y};targetParts=targetParts||[target];if(mutual){points.push(vert1.clone());}
for(var j=0;j<targetParts.length;++j){splits=targetParts[j].splitWithSegment(seg,options);if(splits){lines=splits.lines;if(lines.length>0){lines.unshift(j,1);Array.prototype.splice.apply(targetParts,lines);j+=lines.length-2;}
if(mutual){for(var k=0,len=splits.points.length;k<len;++k){point=splits.points[k];if(!point.equals(vert1)){points.push(point);sourceParts.push(new OpenLayers.Geometry.LineString(points));if(point.equals(vert2)){points=[];}else{points=[point.clone()];}}}}}}}
if(mutual&&sourceParts.length>0&&points.length>0){points.push(vert2.clone());sourceParts.push(new OpenLayers.Geometry.LineString(points));}}else{results=target.splitWith(this,options);}
if(targetParts&&targetParts.length>1){targetSplit=true;}else{targetParts=[];}
if(sourceParts&&sourceParts.length>1){sourceSplit=true;}else{sourceParts=[];}
if(targetSplit||sourceSplit){if(mutual){results=[sourceParts,targetParts];}else{results=targetParts;}}
return results;},splitWith:function(geometry,options){return geometry.split(this,options);},getVertices:function(nodes){var vertices;if(nodes===true){vertices=[this.components[0],this.components[this.components.length-1]];}else if(nodes===false){vertices=this.components.slice(1,this.components.length-1);}else{vertices=this.components.slice();}
return vertices;},distanceTo:function(geometry,options){var edge=!(options&&options.edge===false);var details=edge&&options&&options.details;var result,best={};var min=Number.POSITIVE_INFINITY;if(geometry instanceof OpenLayers.Geometry.Point){var segs=this.getSortedSegments();var x=geometry.x;var y=geometry.y;var seg;for(var i=0,len=segs.length;i<len;++i){seg=segs[i];result=OpenLayers.Geometry.distanceToSegment(geometry,seg);if(result.distance<min){min=result.distance;best=result;if(min===0){break;}}else{if(seg.x2>x&&((y>seg.y1&&y<seg.y2)||(y<seg.y1&&y>seg.y2))){break;}}}
if(details){best={distance:best.distance,x0:best.x,y0:best.y,x1:x,y1:y};}else{best=best.distance;}}else if(geometry instanceof OpenLayers.Geometry.LineString){var segs0=this.getSortedSegments();var segs1=geometry.getSortedSegments();var seg0,seg1,intersection,x0,y0;var len1=segs1.length;var interOptions={point:true};outer:for(var i=0,len=segs0.length;i<len;++i){seg0=segs0[i];x0=seg0.x1;y0=seg0.y1;for(var j=0;j<len1;++j){seg1=segs1[j];intersection=OpenLayers.Geometry.segmentsIntersect(seg0,seg1,interOptions);if(intersection){min=0;best={distance:0,x0:intersection.x,y0:intersection.y,x1:intersection.x,y1:intersection.y};break outer;}else{result=OpenLayers.Geometry.distanceToSegment({x:x0,y:y0},seg1);if(result.distance<min){min=result.distance;best={distance:min,x0:x0,y0:y0,x1:result.x,y1:result.y};}}}}
if(!details){best=best.distance;}
if(min!==0){if(seg0){result=geometry.distanceTo(new OpenLayers.Geometry.Point(seg0.x2,seg0.y2),options);var dist=details?result.distance:result;if(dist<min){if(details){best={distance:min,x0:result.x1,y0:result.y1,x1:result.x0,y1:result.y0};}else{best=dist;}}}}}else{best=geometry.distanceTo(this,options);if(details){best={distance:best.distance,x0:best.x1,y0:best.y1,x1:best.x0,y1:best.y0};}}
return best;},simplify:function(tolerance){if(this&&this!==null){var points=this.getVertices();if(points.length<3){return this;}
var compareNumbers=function(a,b){return(a-b);};var douglasPeuckerReduction=function(points,firstPoint,lastPoint,tolerance){var maxDistance=0;var indexFarthest=0;for(var index=firstPoint,distance;index<lastPoint;index++){distance=perpendicularDistance(points[firstPoint],points[lastPoint],points[index]);if(distance>maxDistance){maxDistance=distance;indexFarthest=index;}}
if(maxDistance>tolerance&&indexFarthest!=firstPoint){pointIndexsToKeep.push(indexFarthest);douglasPeuckerReduction(points,firstPoint,indexFarthest,tolerance);douglasPeuckerReduction(points,indexFarthest,lastPoint,tolerance);}};var perpendicularDistance=function(point1,point2,point){var area=Math.abs(0.5*(point1.x*point2.y+point2.x*point.y+point.x*point1.y-point2.x*point1.y-point.x*point2.y-point1.x*point.y));var bottom=Math.sqrt(Math.pow(point1.x-point2.x,2)+Math.pow(point1.y-point2.y,2));var height=area/bottom*2;return height;};var firstPoint=0;var lastPoint=points.length-1;var pointIndexsToKeep=[];pointIndexsToKeep.push(firstPoint);pointIndexsToKeep.push(lastPoint);while(points[firstPoint].equals(points[lastPoint])){lastPoint--;pointIndexsToKeep.push(lastPoint);}
douglasPeuckerReduction(points,firstPoint,lastPoint,tolerance);var returnPoints=[];pointIndexsToKeep.sort(compareNumbers);for(var index=0;index<pointIndexsToKeep.length;index++){returnPoints.push(points[pointIndexsToKeep[index]]);}
return new OpenLayers.Geometry.LineString(returnPoints);}
else{return this;}},CLASS_NAME:"OpenLayers.Geometry.LineString"});OpenLayers.Handler.Path=OpenLayers.Class(OpenLayers.Handler.Point,{line:null,maxVertices:null,doubleTouchTolerance:20,freehand:false,freehandToggle:'shiftKey',timerId:null,redoStack:null,createFeature:function(pixel){var lonlat=this.layer.getLonLatFromViewPortPx(pixel);var geometry=new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat);this.point=new OpenLayers.Feature.Vector(geometry);this.line=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString([this.point.geometry]));this.callback("create",[this.point.geometry,this.getSketch()]);this.point.geometry.clearBounds();this.layer.addFeatures([this.line,this.point],{silent:true});},destroyFeature:function(force){OpenLayers.Handler.Point.prototype.destroyFeature.call(this,force);this.line=null;},destroyPersistedFeature:function(){var layer=this.layer;if(layer&&layer.features.length>2){this.layer.features[0].destroy();}},removePoint:function(){if(this.point){this.layer.removeFeatures([this.point]);}},addPoint:function(pixel){this.layer.removeFeatures([this.point]);var lonlat=this.layer.getLonLatFromViewPortPx(pixel);this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat));this.line.geometry.addComponent(this.point.geometry,this.line.geometry.components.length);this.layer.addFeatures([this.point]);this.callback("point",[this.point.geometry,this.getGeometry()]);this.callback("modify",[this.point.geometry,this.getSketch()]);this.drawFeature();delete this.redoStack;},insertXY:function(x,y){this.line.geometry.addComponent(new OpenLayers.Geometry.Point(x,y),this.getCurrentPointIndex());this.drawFeature();delete this.redoStack;},insertDeltaXY:function(dx,dy){var previousIndex=this.getCurrentPointIndex()-1;var p0=this.line.geometry.components[previousIndex];if(p0&&!isNaN(p0.x)&&!isNaN(p0.y)){this.insertXY(p0.x+dx,p0.y+dy);}},insertDirectionLength:function(direction,length){direction*=Math.PI/180;var dx=length*Math.cos(direction);var dy=length*Math.sin(direction);this.insertDeltaXY(dx,dy);},insertDeflectionLength:function(deflection,length){var previousIndex=this.getCurrentPointIndex()-1;if(previousIndex>0){var p1=this.line.geometry.components[previousIndex];var p0=this.line.geometry.components[previousIndex-1];var theta=Math.atan2(p1.y-p0.y,p1.x-p0.x);this.insertDirectionLength((theta*180/Math.PI)+deflection,length);}},getCurrentPointIndex:function(){return this.line.geometry.components.length-1;},undo:function(){var geometry=this.line.geometry;var components=geometry.components;var index=this.getCurrentPointIndex()-1;var target=components[index];var undone=geometry.removeComponent(target);if(undone){if(!this.redoStack){this.redoStack=[];}
this.redoStack.push(target);this.drawFeature();}
return undone;},redo:function(){var target=this.redoStack&&this.redoStack.pop();if(target){this.line.geometry.addComponent(target,this.getCurrentPointIndex());this.drawFeature();}
return!!target;},freehandMode:function(evt){return(this.freehandToggle&&evt[this.freehandToggle])?!this.freehand:this.freehand;},modifyFeature:function(pixel,drawing){if(!this.line){this.createFeature(pixel);}
var lonlat=this.layer.getLonLatFromViewPortPx(pixel);this.point.geometry.x=lonlat.lon;this.point.geometry.y=lonlat.lat;this.callback("modify",[this.point.geometry,this.getSketch(),drawing]);this.point.geometry.clearBounds();this.drawFeature();},drawFeature:function(){this.layer.drawFeature(this.line,this.style);this.layer.drawFeature(this.point,this.style);},getSketch:function(){return this.line;},getGeometry:function(){var geometry=this.line&&this.line.geometry;if(geometry&&this.multi){geometry=new OpenLayers.Geometry.MultiLineString([geometry]);}
return geometry;},touchstart:function(evt){if(this.timerId&&this.passesTolerance(this.lastTouchPx,evt.xy,this.doubleTouchTolerance)){this.finishGeometry();window.clearTimeout(this.timerId);this.timerId=null;return false;}else{if(this.timerId){window.clearTimeout(this.timerId);this.timerId=null;}
this.timerId=window.setTimeout(OpenLayers.Function.bind(function(){this.timerId=null;},this),300);return OpenLayers.Handler.Point.prototype.touchstart.call(this,evt);}},down:function(evt){var stopDown=this.stopDown;if(this.freehandMode(evt)){stopDown=true;if(this.touch){this.modifyFeature(evt.xy,!!this.lastUp);OpenLayers.Event.stop(evt);}}
if(!this.touch&&(!this.lastDown||!this.passesTolerance(this.lastDown,evt.xy,this.pixelTolerance))){this.modifyFeature(evt.xy,!!this.lastUp);}
this.mouseDown=true;this.lastDown=evt.xy;this.stoppedDown=stopDown;return!stopDown;},move:function(evt){if(this.stoppedDown&&this.freehandMode(evt)){if(this.persist){this.destroyPersistedFeature();}
if(this.maxVertices&&this.line&&this.line.geometry.components.length===this.maxVertices){this.removePoint()
this.finalize();}else{this.addPoint(evt.xy);}
return false;}
if(!this.touch&&(!this.mouseDown||this.stoppedDown)){this.modifyFeature(evt.xy,!!this.lastUp);}
return true;},up:function(evt){if(this.mouseDown&&(!this.lastUp||!this.lastUp.equals(evt.xy))){if(this.stoppedDown&&this.freehandMode(evt)){if(this.persist){this.destroyPersistedFeature();}
this.removePoint();this.finalize();}else{if(this.passesTolerance(this.lastDown,evt.xy,this.pixelTolerance)){if(this.touch){this.modifyFeature(evt.xy);}
if(this.lastUp==null&&this.persist){this.destroyPersistedFeature();}
this.addPoint(evt.xy);this.lastUp=evt.xy;if(this.line.geometry.components.length===this.maxVertices+1){this.finishGeometry();}}}}
this.stoppedDown=this.stopDown;this.mouseDown=false;return!this.stopUp;},finishGeometry:function(){var index=this.line.geometry.components.length-1;this.line.geometry.removeComponent(this.line.geometry.components[index]);this.removePoint();this.finalize();},dblclick:function(evt){if(!this.freehandMode(evt)){this.finishGeometry();}
return false;},CLASS_NAME:"OpenLayers.Handler.Path"});Ext.namespace("geoadmin");geoadmin.Segment=OpenLayers.Class(OpenLayers.Handler.Path,{origin:null,target:null,circle:null,_drawing:false,initialize:function(control,callbacks,options){options=options||{};options.maxVertices=2;options.persist=true;options.freehandToggle=null;OpenLayers.Handler.Path.prototype.initialize.apply(this,[control,callbacks,options]);},addPoint:function(){OpenLayers.Handler.Path.prototype.addPoint.apply(this,arguments);var numVertices=this.line.geometry.components.length;if(numVertices==2){var feature=this.origin=new OpenLayers.Feature.Vector(this.line.geometry.components[0].clone());this.layer.addFeatures([feature],{silent:true});this._drawing=true;}},finishGeometry:function(){var components=this.line.geometry.components;this.target=new OpenLayers.Feature.Vector(components[components.length-2].clone());this.layer.addFeatures([this.target],{silent:true});this._drawing=false;OpenLayers.Handler.Path.prototype.finishGeometry.apply(this,arguments);},destroyPersistedFeature:function(){OpenLayers.Handler.Path.prototype.destroyPersistedFeature.apply(this,arguments);if(this.layer){if(this.origin){this.origin.destroy();this.origin=null;}
if(this.target){this.target.destroy();this.target=null;}
if(this.circle){this.circle.destroy();this.circle=null;}}},modifyFeature:function(){OpenLayers.Handler.Path.prototype.modifyFeature.apply(this,arguments);if(this._drawing){if(this.circle){this.layer.removeFeatures([this.circle]);}
var geometry=OpenLayers.Geometry.Polygon.createRegularPolygon(this.origin.geometry,this.line.geometry.getLength(),40);this.circle=new OpenLayers.Feature.Vector(geometry);this.layer.addFeatures([this.circle],{silent:true});}},deactivate:function(){if(OpenLayers.Handler.Path.prototype.deactivate.call(this)){this._drawing=false;return true;}
return false;},dblclick:function(){}});Ext.namespace("geoadmin");geoadmin.SegmentMeasure=OpenLayers.Class(OpenLayers.Control.Measure,{partialDelay:0,persist:true,elevationServiceUrl:null,elevations:null,measuring:false,initialize:function(options){var handler=geoadmin.Segment;this.callbacks={point:this.startMeasuring,modify:this.measureDrawing,done:this.measureDone,cancel:this.measureCancel};OpenLayers.Control.Measure.prototype.initialize.call(this,handler,options);},startMeasuring:function(){this.measuring=true;},measureDrawing:function(point,feature){if(this.measuring){var geometry=feature.geometry.clone();this.measure(geometry);this.elevations=new Array(2);}},measureDone:function(geometry){function onElevationResponse(index,response){this.elevations[index]=response.responseText;if(this.elevations[0]&&this.elevations[1]){var stat=this.getBestLength(geometry),azimut=this.getAzimut(geometry);this.events.triggerEvent('measure',{distance:stat[0],units:stat[1],azimut:azimut,elevations:this.elevations});}}
this.measuring=false;for(var i=0;i<=1;i++){OpenLayers.Request.GET({url:this.elevationServiceUrl,params:{lon:geometry.components[i].x,lat:geometry.components[i].y},callback:OpenLayers.Function.bind(onElevationResponse,this,i)});}},measureCancel:function(geometry){this.measuring=false;},measure:function(geometry){var stat=this.getBestLength(geometry),azimut=this.getAzimut(geometry);if(azimut!==undefined){this.events.triggerEvent('measurepartial',{distance:stat[0],units:stat[1],azimut:azimut});}},getAzimut:function(geometry){if(geometry.components.length<=1){return;}
var pt1=geometry.components[0];var pt2=geometry.components[1];var x=pt2.x-pt1.x;var y=pt2.y-pt1.y;var rad=Math.acos(y/Math.sqrt(x*x+y*y));var factor=x>0?1:-1;return Math.round(factor*rad*180/Math.PI);}});Ext.ns('Ext.ux.form');Ext.ux.form.FileUploadField=Ext.extend(Ext.form.TextField,{buttonText:'Browse...',buttonOnly:false,buttonOffset:3,readOnly:true,autoSize:Ext.emptyFn,initComponent:function(){Ext.ux.form.FileUploadField.superclass.initComponent.call(this);this.addEvents('fileselected');},onRender:function(ct,position){Ext.ux.form.FileUploadField.superclass.onRender.call(this,ct,position);this.wrap=this.el.wrap({cls:'x-form-field-wrap x-form-file-wrap'});this.el.addClass('x-form-file-text');this.el.dom.removeAttribute('name');this.createFileInput();var btnCfg=Ext.applyIf(this.buttonCfg||{},{text:this.buttonText});this.button=new Ext.Button(Ext.apply(btnCfg,{renderTo:this.wrap,cls:'x-form-file-btn'+(btnCfg.iconCls?' x-btn-icon':'')}));if(this.buttonOnly){this.el.hide();this.wrap.setWidth(this.button.getEl().getWidth());}
this.bindListeners();this.resizeEl=this.positionEl=this.wrap;},bindListeners:function(){this.fileInput.on({scope:this,mouseenter:function(){this.button.addClass(['x-btn-over','x-btn-focus'])},mouseleave:function(){this.button.removeClass(['x-btn-over','x-btn-focus','x-btn-click'])},mousedown:function(){this.button.addClass('x-btn-click')},mouseup:function(){this.button.removeClass(['x-btn-over','x-btn-focus','x-btn-click'])},change:function(){var v=this.fileInput.dom.value;this.setValue(v);this.fireEvent('fileselected',this,v);}});},createFileInput:function(){this.fileInput=this.wrap.createChild({id:this.getFileInputId(),name:this.name||this.getId(),cls:'x-form-file',tag:'input',type:'file',size:1});},reset:function(){this.fileInput.remove();this.createFileInput();this.bindListeners();Ext.ux.form.FileUploadField.superclass.reset.call(this);},getFileInputId:function(){return this.id+'-file';},onResize:function(w,h){Ext.ux.form.FileUploadField.superclass.onResize.call(this,w,h);this.wrap.setWidth(w);if(!this.buttonOnly){var w=this.wrap.getWidth()-this.button.getEl().getWidth()-this.buttonOffset;this.el.setWidth(w);}},onDestroy:function(){Ext.ux.form.FileUploadField.superclass.onDestroy.call(this);Ext.destroy(this.fileInput,this.button,this.wrap);},onDisable:function(){Ext.ux.form.FileUploadField.superclass.onDisable.call(this);this.doDisable(true);},onEnable:function(){Ext.ux.form.FileUploadField.superclass.onEnable.call(this);this.doDisable(false);},doDisable:function(disabled){this.fileInput.dom.disabled=disabled;this.button.setDisabled(disabled);},preFocus:Ext.emptyFn,alignErrorIcon:function(){this.errorIcon.alignTo(this.wrap,'tl-tr',[2,0]);}});Ext.reg('fileuploadfield',Ext.ux.form.FileUploadField);Ext.form.FileUploadField=Ext.ux.form.FileUploadField;Ext.namespace("GeoExt.data");GeoExt.data.LayerStoreMixin=function(){return{map:null,reader:null,constructor:function(config){config=config||{};config.reader=config.reader||new GeoExt.data.LayerReader({},config.fields);delete config.fields;var map=config.map instanceof GeoExt.MapPanel?config.map.map:config.map;delete config.map;if(config.layers){config.data=config.layers;}
delete config.layers;var options={initDir:config.initDir};delete config.initDir;arguments.callee.superclass.constructor.call(this,config);this.addEvents("bind");if(map){this.bind(map,options);}},bind:function(map,options){if(this.map){return;}
this.map=map;options=options||{};var initDir=options.initDir;if(options.initDir==undefined){initDir=GeoExt.data.LayerStore.MAP_TO_STORE|GeoExt.data.LayerStore.STORE_TO_MAP;}
var layers=map.layers.slice(0);if(initDir&GeoExt.data.LayerStore.STORE_TO_MAP){this.each(function(record){this.map.addLayer(record.getLayer());},this);}
if(initDir&GeoExt.data.LayerStore.MAP_TO_STORE){this.loadData(layers,true);}
map.events.on({"changelayer":this.onChangeLayer,"addlayer":this.onAddLayer,"removelayer":this.onRemoveLayer,scope:this});this.on({"load":this.onLoad,"clear":this.onClear,"add":this.onAdd,"remove":this.onRemove,"update":this.onUpdate,scope:this});this.data.on({"replace":this.onReplace,scope:this});this.fireEvent("bind",this,map);},unbind:function(){if(this.map){this.map.events.un({"changelayer":this.onChangeLayer,"addlayer":this.onAddLayer,"removelayer":this.onRemoveLayer,scope:this});this.un("load",this.onLoad,this);this.un("clear",this.onClear,this);this.un("add",this.onAdd,this);this.un("remove",this.onRemove,this);this.data.un("replace",this.onReplace,this);this.map=null;}},onChangeLayer:function(evt){var layer=evt.layer;var recordIndex=this.findBy(function(rec,id){return rec.getLayer()===layer;});if(recordIndex>-1){var record=this.getAt(recordIndex);if(evt.property==="order"){if(!this._adding&&!this._removing){var layerIndex=this.map.getLayerIndex(layer);if(layerIndex!==recordIndex){this._removing=true;this.remove(record);delete this._removing;this._adding=true;this.insert(layerIndex,[record]);delete this._adding;}}}else if(evt.property==="name"){record.set("title",layer.name);}else{this.fireEvent("update",this,record,Ext.data.Record.EDIT);}}},onAddLayer:function(evt){if(!this._adding){var layer=evt.layer;this._adding=true;this.loadData([layer],true);delete this._adding;}},onRemoveLayer:function(evt){if(this.map.unloadDestroy){if(!this._removing){var layer=evt.layer;this._removing=true;this.remove(this.getById(layer.id));delete this._removing;}}else{this.unbind();}},onLoad:function(store,records,options){if(!Ext.isArray(records)){records=[records];}
if(options&&!options.add){this._removing=true;for(var i=this.map.layers.length-1;i>=0;i--){this.map.removeLayer(this.map.layers[i]);}
delete this._removing;var len=records.length;if(len>0){var layers=new Array(len);for(var j=0;j<len;j++){layers[j]=records[j].getLayer();}
this._adding=true;this.map.addLayers(layers);delete this._adding;}}},onClear:function(store){this._removing=true;for(var i=this.map.layers.length-1;i>=0;i--){this.map.removeLayer(this.map.layers[i]);}
delete this._removing;},onAdd:function(store,records,index){if(!this._adding){this._adding=true;var layer;for(var i=records.length-1;i>=0;--i){layer=records[i].getLayer();this.map.addLayer(layer);if(index!==this.map.layers.length-1){this.map.setLayerIndex(layer,index);}}
delete this._adding;}},onRemove:function(store,record,index){if(!this._removing){var layer=record.getLayer();if(this.map.getLayer(layer.id)!=null){this._removing=true;this.removeMapLayer(record);delete this._removing;}}},onUpdate:function(store,record,operation){if(operation===Ext.data.Record.EDIT){if(record.modified&&record.modified.title){var layer=record.getLayer();var title=record.get("title");if(title!==layer.name){layer.setName(title);}}}},removeMapLayer:function(record){this.map.removeLayer(record.getLayer());},onReplace:function(key,oldRecord,newRecord){this.removeMapLayer(oldRecord);},getByLayer:function(layer){var index=this.findBy(function(r){return r.getLayer()===layer;});if(index>-1){return this.getAt(index);}},destroy:function(){this.unbind();GeoExt.data.LayerStore.superclass.destroy.call(this);}};};GeoExt.data.LayerStore=Ext.extend(Ext.data.Store,new GeoExt.data.LayerStoreMixin);GeoExt.data.LayerStore.MAP_TO_STORE=1;GeoExt.data.LayerStore.STORE_TO_MAP=2;OpenLayers.Handler.Click=OpenLayers.Class(OpenLayers.Handler,{delay:300,single:true,'double':false,pixelTolerance:0,dblclickTolerance:13,stopSingle:false,stopDouble:false,timerId:null,touch:false,down:null,last:null,first:null,rightclickTimerId:null,touchstart:function(evt){if(!this.touch){this.unregisterMouseListeners();this.touch=true;}
this.down=this.getEventInfo(evt);this.last=this.getEventInfo(evt);return true;},touchmove:function(evt){this.last=this.getEventInfo(evt);return true;},touchend:function(evt){if(this.down){evt.xy=this.last.xy;evt.lastTouches=this.last.touches;this.handleSingle(evt);this.down=null;}
return true;},unregisterMouseListeners:function(){this.map.events.un({mousedown:this.mousedown,mouseup:this.mouseup,click:this.click,dblclick:this.dblclick,scope:this});},mousedown:function(evt){this.down=this.getEventInfo(evt);this.last=this.getEventInfo(evt);return true;},mouseup:function(evt){var propagate=true;if(this.checkModifiers(evt)&&this.control.handleRightClicks&&OpenLayers.Event.isRightClick(evt)){propagate=this.rightclick(evt);}
return propagate;},rightclick:function(evt){if(this.passesTolerance(evt)){if(this.rightclickTimerId!=null){this.clearTimer();this.callback('dblrightclick',[evt]);return!this.stopDouble;}else{var clickEvent=this['double']?OpenLayers.Util.extend({},evt):this.callback('rightclick',[evt]);var delayedRightCall=OpenLayers.Function.bind(this.delayedRightCall,this,clickEvent);this.rightclickTimerId=window.setTimeout(delayedRightCall,this.delay);}}
return!this.stopSingle;},delayedRightCall:function(evt){this.rightclickTimerId=null;if(evt){this.callback('rightclick',[evt]);}},click:function(evt){if(!this.last){this.last=this.getEventInfo(evt);}
this.handleSingle(evt);return!this.stopSingle;},dblclick:function(evt){this.handleDouble(evt);return!this.stopDouble;},handleDouble:function(evt){if(this["double"]&&this.passesDblclickTolerance(evt)){this.callback("dblclick",[evt]);}},handleSingle:function(evt){if(this.passesTolerance(evt)){if(this.timerId!=null){if(this.last.touches&&this.last.touches.length===1){if(this["double"]){OpenLayers.Event.stop(evt);}
this.handleDouble(evt);}
if(!this.last.touches||this.last.touches.length!==2){this.clearTimer();}}else{this.first=this.getEventInfo(evt);var clickEvent=this.single?OpenLayers.Util.extend({},evt):null;this.queuePotentialClick(clickEvent);}}},queuePotentialClick:function(evt){this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,evt),this.delay);},passesTolerance:function(evt){var passes=true;if(this.pixelTolerance!=null&&this.down&&this.down.xy){passes=this.pixelTolerance>=this.down.xy.distanceTo(evt.xy);if(passes&&this.touch&&this.down.touches.length===this.last.touches.length){for(var i=0,ii=this.down.touches.length;i<ii;++i){if(this.getTouchDistance(this.down.touches[i],this.last.touches[i])>this.pixelTolerance){passes=false;break;}}}}
return passes;},getTouchDistance:function(from,to){return Math.sqrt(Math.pow(from.clientX-to.clientX,2)+
Math.pow(from.clientY-to.clientY,2));},passesDblclickTolerance:function(evt){var passes=true;if(this.down&&this.first){passes=this.down.xy.distanceTo(this.first.xy)<=this.dblclickTolerance;}
return passes;},clearTimer:function(){if(this.timerId!=null){window.clearTimeout(this.timerId);this.timerId=null;}
if(this.rightclickTimerId!=null){window.clearTimeout(this.rightclickTimerId);this.rightclickTimerId=null;}},delayedCall:function(evt){this.timerId=null;if(evt){this.callback("click",[evt]);}},getEventInfo:function(evt){var touches;if(evt.touches){var len=evt.touches.length;touches=new Array(len);var touch;for(var i=0;i<len;i++){touch=evt.touches[i];touches[i]={clientX:touch.clientX,clientY:touch.clientY};}}
return{xy:evt.xy,touches:touches};},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.clearTimer();this.down=null;this.first=null;this.last=null;this.touch=false;deactivated=true;}
return deactivated;},CLASS_NAME:"OpenLayers.Handler.Click"});OpenLayers.Handler.Drag=OpenLayers.Class(OpenLayers.Handler,{started:false,stopDown:true,dragging:false,touch:false,last:null,start:null,lastMoveEvt:null,oldOnselectstart:null,interval:0,timeoutId:null,documentDrag:false,documentEvents:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);if(this.documentDrag===true){var me=this;this._docMove=function(evt){me.mousemove({xy:{x:evt.clientX,y:evt.clientY},element:document});};this._docUp=function(evt){me.mouseup({xy:{x:evt.clientX,y:evt.clientY}});};}},dragstart:function(evt){var propagate=true;this.dragging=false;if(this.checkModifiers(evt)&&(OpenLayers.Event.isLeftClick(evt)||OpenLayers.Event.isSingleTouch(evt))){this.started=true;this.start=evt.xy;this.last=evt.xy;OpenLayers.Element.addClass(this.map.viewPortDiv,"olDragDown");this.down(evt);this.callback("down",[evt.xy]);OpenLayers.Event.stop(evt);if(!this.oldOnselectstart){this.oldOnselectstart=document.onselectstart?document.onselectstart:OpenLayers.Function.True;}
document.onselectstart=OpenLayers.Function.False;propagate=!this.stopDown;}else{this.started=false;this.start=null;this.last=null;}
return propagate;},dragmove:function(evt){this.lastMoveEvt=evt;if(this.started&&!this.timeoutId&&(evt.xy.x!=this.last.x||evt.xy.y!=this.last.y)){if(this.documentDrag===true&&this.documentEvents){if(evt.element===document){this.adjustXY(evt);this.setEvent(evt);}else{this.removeDocumentEvents();}}
if(this.interval>0){this.timeoutId=setTimeout(OpenLayers.Function.bind(this.removeTimeout,this),this.interval);}
this.dragging=true;this.move(evt);this.callback("move",[evt.xy]);if(!this.oldOnselectstart){this.oldOnselectstart=document.onselectstart;document.onselectstart=OpenLayers.Function.False;}
this.last=evt.xy;}
return true;},dragend:function(evt){if(this.started){if(this.documentDrag===true&&this.documentEvents){this.adjustXY(evt);this.removeDocumentEvents();}
var dragged=(this.start!=this.last);this.started=false;this.dragging=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.up(evt);this.callback("up",[evt.xy]);if(dragged){this.callback("done",[evt.xy]);}
document.onselectstart=this.oldOnselectstart;}
return true;},down:function(evt){},move:function(evt){},up:function(evt){},out:function(evt){},mousedown:function(evt){return this.dragstart(evt);},touchstart:function(evt){if(!this.touch){this.touch=true;this.map.events.un({mousedown:this.mousedown,mouseup:this.mouseup,mousemove:this.mousemove,click:this.click,scope:this});}
return this.dragstart(evt);},mousemove:function(evt){return this.dragmove(evt);},touchmove:function(evt){return this.dragmove(evt);},removeTimeout:function(){this.timeoutId=null;if(this.dragging){this.mousemove(this.lastMoveEvt);}},mouseup:function(evt){return this.dragend(evt);},touchend:function(evt){evt.xy=this.last;return this.dragend(evt);},mouseout:function(evt){if(this.started&&OpenLayers.Util.mouseLeft(evt,this.map.viewPortDiv)){if(this.documentDrag===true){this.addDocumentEvents();}else{var dragged=(this.start!=this.last);this.started=false;this.dragging=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.out(evt);this.callback("out",[]);if(dragged){this.callback("done",[evt.xy]);}
if(document.onselectstart){document.onselectstart=this.oldOnselectstart;}}}
return true;},click:function(evt){return(this.start==this.last);},activate:function(){var activated=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragging=false;activated=true;}
return activated;},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.touch=false;this.started=false;this.dragging=false;this.start=null;this.last=null;deactivated=true;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");}
return deactivated;},adjustXY:function(evt){var pos=OpenLayers.Util.pagePosition(this.map.viewPortDiv);evt.xy.x-=pos[0];evt.xy.y-=pos[1];},addDocumentEvents:function(){OpenLayers.Element.addClass(document.body,"olDragDown");this.documentEvents=true;OpenLayers.Event.observe(document,"mousemove",this._docMove);OpenLayers.Event.observe(document,"mouseup",this._docUp);},removeDocumentEvents:function(){OpenLayers.Element.removeClass(document.body,"olDragDown");this.documentEvents=false;OpenLayers.Event.stopObserving(document,"mousemove",this._docMove);OpenLayers.Event.stopObserving(document,"mouseup",this._docUp);},CLASS_NAME:"OpenLayers.Handler.Drag"});OpenLayers.Handler.Box=OpenLayers.Class(OpenLayers.Handler,{dragHandler:null,boxDivClassName:'olHandlerBoxZoomBox',boxOffsets:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.dragHandler=new OpenLayers.Handler.Drag(this,{down:this.startBox,move:this.moveBox,out:this.removeBox,up:this.endBox},{keyMask:this.keyMask});},destroy:function(){OpenLayers.Handler.prototype.destroy.apply(this,arguments);if(this.dragHandler){this.dragHandler.destroy();this.dragHandler=null;}},setMap:function(map){OpenLayers.Handler.prototype.setMap.apply(this,arguments);if(this.dragHandler){this.dragHandler.setMap(map);}},startBox:function(xy){this.callback("start",[]);this.zoomBox=OpenLayers.Util.createDiv('zoomBox',{x:-9999,y:-9999});this.zoomBox.className=this.boxDivClassName;this.zoomBox.style.zIndex=this.map.Z_INDEX_BASE["Popup"]-1;this.map.viewPortDiv.appendChild(this.zoomBox);OpenLayers.Element.addClass(this.map.viewPortDiv,"olDrawBox");},moveBox:function(xy){var startX=this.dragHandler.start.x;var startY=this.dragHandler.start.y;var deltaX=Math.abs(startX-xy.x);var deltaY=Math.abs(startY-xy.y);var offset=this.getBoxOffsets();this.zoomBox.style.width=(deltaX+offset.width+1)+"px";this.zoomBox.style.height=(deltaY+offset.height+1)+"px";this.zoomBox.style.left=(xy.x<startX?startX-deltaX-offset.left:startX-offset.left)+"px";this.zoomBox.style.top=(xy.y<startY?startY-deltaY-offset.top:startY-offset.top)+"px";},endBox:function(end){var result;if(Math.abs(this.dragHandler.start.x-end.x)>5||Math.abs(this.dragHandler.start.y-end.y)>5){var start=this.dragHandler.start;var top=Math.min(start.y,end.y);var bottom=Math.max(start.y,end.y);var left=Math.min(start.x,end.x);var right=Math.max(start.x,end.x);result=new OpenLayers.Bounds(left,bottom,right,top);}else{result=this.dragHandler.start.clone();}
this.removeBox();this.callback("done",[result]);},removeBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox);this.zoomBox=null;this.boxOffsets=null;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDrawBox");},activate:function(){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragHandler.activate();return true;}else{return false;}},deactivate:function(){if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){if(this.dragHandler.deactivate()){if(this.zoomBox){this.removeBox();}}
return true;}else{return false;}},getBoxOffsets:function(){if(!this.boxOffsets){var testDiv=document.createElement("div");testDiv.style.position="absolute";testDiv.style.border="1px solid black";testDiv.style.width="3px";document.body.appendChild(testDiv);var w3cBoxModel=testDiv.clientWidth==3;document.body.removeChild(testDiv);var left=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-left-width"));var right=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-right-width"));var top=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-top-width"));var bottom=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-bottom-width"));this.boxOffsets={left:left,right:right,top:top,bottom:bottom,width:w3cBoxModel===false?left+right:0,height:w3cBoxModel===false?top+bottom:0};}
return this.boxOffsets;},CLASS_NAME:"OpenLayers.Handler.Box"});OpenLayers.Handler.Hover=OpenLayers.Class(OpenLayers.Handler,{delay:500,pixelTolerance:null,stopMove:false,px:null,timerId:null,mousemove:function(evt){if(this.passesTolerance(evt.xy)){this.clearTimer();this.callback('move',[evt]);this.px=evt.xy;evt=OpenLayers.Util.extend({},evt);this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,evt),this.delay);}
return!this.stopMove;},mouseout:function(evt){if(OpenLayers.Util.mouseLeft(evt,this.map.viewPortDiv)){this.clearTimer();this.callback('move',[evt]);}
return true;},passesTolerance:function(px){var passes=true;if(this.pixelTolerance&&this.px){var dpx=Math.sqrt(Math.pow(this.px.x-px.x,2)+
Math.pow(this.px.y-px.y,2));if(dpx<this.pixelTolerance){passes=false;}}
return passes;},clearTimer:function(){if(this.timerId!=null){window.clearTimeout(this.timerId);this.timerId=null;}},delayedCall:function(evt){this.callback('pause',[evt]);},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.clearTimer();deactivated=true;}
return deactivated;},CLASS_NAME:"OpenLayers.Handler.Hover"});OpenLayers.Style=OpenLayers.Class({id:null,name:null,title:null,description:null,layerName:null,isDefault:false,rules:null,context:null,defaultStyle:null,defaultsPerSymbolizer:false,propertyStyles:null,initialize:function(style,options){OpenLayers.Util.extend(this,options);this.rules=[];if(options&&options.rules){this.addRules(options.rules);}
this.setDefaultStyle(style||OpenLayers.Feature.Vector.style["default"]);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");},destroy:function(){for(var i=0,len=this.rules.length;i<len;i++){this.rules[i].destroy();this.rules[i]=null;}
this.rules=null;this.defaultStyle=null;},createSymbolizer:function(feature){var style=this.defaultsPerSymbolizer?{}:this.createLiterals(OpenLayers.Util.extend({},this.defaultStyle),feature);var rules=this.rules;var rule,context;var elseRules=[];var appliedRules=false;for(var i=0,len=rules.length;i<len;i++){rule=rules[i];var applies=rule.evaluate(feature);if(applies){if(rule instanceof OpenLayers.Rule&&rule.elseFilter){elseRules.push(rule);}else{appliedRules=true;this.applySymbolizer(rule,style,feature);}}}
if(appliedRules==false&&elseRules.length>0){appliedRules=true;for(var i=0,len=elseRules.length;i<len;i++){this.applySymbolizer(elseRules[i],style,feature);}}
if(rules.length>0&&appliedRules==false){style.display="none";}
if(style.label!=null&&typeof style.label!=="string"){style.label=String(style.label);}
return style;},applySymbolizer:function(rule,style,feature){var symbolizerPrefix=feature.geometry?this.getSymbolizerPrefix(feature.geometry):OpenLayers.Style.SYMBOLIZER_PREFIXES[0];var symbolizer=rule.symbolizer[symbolizerPrefix]||rule.symbolizer;if(this.defaultsPerSymbolizer===true){var defaults=this.defaultStyle;OpenLayers.Util.applyDefaults(symbolizer,{pointRadius:defaults.pointRadius});if(symbolizer.stroke===true||symbolizer.graphic===true){OpenLayers.Util.applyDefaults(symbolizer,{strokeWidth:defaults.strokeWidth,strokeColor:defaults.strokeColor,strokeOpacity:defaults.strokeOpacity,strokeDashstyle:defaults.strokeDashstyle,strokeLinecap:defaults.strokeLinecap});}
if(symbolizer.fill===true||symbolizer.graphic===true){OpenLayers.Util.applyDefaults(symbolizer,{fillColor:defaults.fillColor,fillOpacity:defaults.fillOpacity});}
if(symbolizer.graphic===true){OpenLayers.Util.applyDefaults(symbolizer,{pointRadius:this.defaultStyle.pointRadius,externalGraphic:this.defaultStyle.externalGraphic,graphicName:this.defaultStyle.graphicName,graphicOpacity:this.defaultStyle.graphicOpacity,graphicWidth:this.defaultStyle.graphicWidth,graphicHeight:this.defaultStyle.graphicHeight,graphicXOffset:this.defaultStyle.graphicXOffset,graphicYOffset:this.defaultStyle.graphicYOffset});}}
return this.createLiterals(OpenLayers.Util.extend(style,symbolizer),feature);},createLiterals:function(style,feature){var context=OpenLayers.Util.extend({},feature.attributes||feature.data);OpenLayers.Util.extend(context,this.context);for(var i in this.propertyStyles){style[i]=OpenLayers.Style.createLiteral(style[i],context,feature,i);}
return style;},findPropertyStyles:function(){var propertyStyles={};var style=this.defaultStyle;this.addPropertyStyles(propertyStyles,style);var rules=this.rules;var symbolizer,value;for(var i=0,len=rules.length;i<len;i++){symbolizer=rules[i].symbolizer;for(var key in symbolizer){value=symbolizer[key];if(typeof value=="object"){this.addPropertyStyles(propertyStyles,value);}else{this.addPropertyStyles(propertyStyles,symbolizer);break;}}}
return propertyStyles;},addPropertyStyles:function(propertyStyles,symbolizer){var property;for(var key in symbolizer){property=symbolizer[key];if(typeof property=="string"&&property.match(/\$\{\w+\}/)){propertyStyles[key]=true;}}
return propertyStyles;},addRules:function(rules){Array.prototype.push.apply(this.rules,rules);this.propertyStyles=this.findPropertyStyles();},setDefaultStyle:function(style){this.defaultStyle=style;this.propertyStyles=this.findPropertyStyles();},getSymbolizerPrefix:function(geometry){var prefixes=OpenLayers.Style.SYMBOLIZER_PREFIXES;for(var i=0,len=prefixes.length;i<len;i++){if(geometry.CLASS_NAME.indexOf(prefixes[i])!=-1){return prefixes[i];}}},clone:function(){var options=OpenLayers.Util.extend({},this);if(this.rules){options.rules=[];for(var i=0,len=this.rules.length;i<len;++i){options.rules.push(this.rules[i].clone());}}
options.context=this.context&&OpenLayers.Util.extend({},this.context);var defaultStyle=OpenLayers.Util.extend({},this.defaultStyle);return new OpenLayers.Style(defaultStyle,options);},CLASS_NAME:"OpenLayers.Style"});OpenLayers.Style.createLiteral=function(value,context,feature,property){if(typeof value=="string"&&value.indexOf("${")!=-1){value=OpenLayers.String.format(value,context,[feature,property]);value=(isNaN(value)||!value)?value:parseFloat(value);}
return value;};OpenLayers.Style.SYMBOLIZER_PREFIXES=['Point','Line','Polygon','Text','Raster'];OpenLayers.Filter=OpenLayers.Class({initialize:function(options){OpenLayers.Util.extend(this,options);},destroy:function(){},evaluate:function(context){return true;},clone:function(){return null;},toString:function(){var string;if(OpenLayers.Format&&OpenLayers.Format.CQL){string=OpenLayers.Format.CQL.prototype.write(this);}else{string=Object.prototype.toString.call(this);}
return string;},CLASS_NAME:"OpenLayers.Filter"});OpenLayers.Filter.Spatial=OpenLayers.Class(OpenLayers.Filter,{type:null,property:null,value:null,distance:null,distanceUnits:null,evaluate:function(feature){var intersect=false;switch(this.type){case OpenLayers.Filter.Spatial.BBOX:case OpenLayers.Filter.Spatial.INTERSECTS:if(feature.geometry){var geom=this.value;if(this.value.CLASS_NAME=="OpenLayers.Bounds"){geom=this.value.toGeometry();}
if(feature.geometry.intersects(geom)){intersect=true;}}
break;default:throw new Error('evaluate is not implemented for this filter type.');}
return intersect;},clone:function(){var options=OpenLayers.Util.applyDefaults({value:this.value&&this.value.clone&&this.value.clone()},this);return new OpenLayers.Filter.Spatial(options);},CLASS_NAME:"OpenLayers.Filter.Spatial"});OpenLayers.Filter.Spatial.BBOX="BBOX";OpenLayers.Filter.Spatial.INTERSECTS="INTERSECTS";OpenLayers.Filter.Spatial.DWITHIN="DWITHIN";OpenLayers.Filter.Spatial.WITHIN="WITHIN";OpenLayers.Filter.Spatial.CONTAINS="CONTAINS";OpenLayers.Control.GetFeature=OpenLayers.Class(OpenLayers.Control,{protocol:null,multipleKey:null,toggleKey:null,modifiers:null,multiple:false,click:true,single:true,clickout:true,toggle:false,clickTolerance:5,hover:false,box:false,maxFeatures:10,features:null,hoverFeature:null,handlerOptions:null,handlers:null,hoverResponse:null,filterType:OpenLayers.Filter.Spatial.BBOX,initialize:function(options){options.handlerOptions=options.handlerOptions||{};OpenLayers.Control.prototype.initialize.apply(this,[options]);this.features={};this.handlers={};if(this.click){this.handlers.click=new OpenLayers.Handler.Click(this,{click:this.selectClick},this.handlerOptions.click||{});}
if(this.box){this.handlers.box=new OpenLayers.Handler.Box(this,{done:this.selectBox},OpenLayers.Util.extend(this.handlerOptions.box,{boxDivClassName:"olHandlerBoxSelectFeature"}));}
if(this.hover){this.handlers.hover=new OpenLayers.Handler.Hover(this,{'move':this.cancelHover,'pause':this.selectHover},OpenLayers.Util.extend(this.handlerOptions.hover,{'delay':250,'pixelTolerance':2}));}},activate:function(){if(!this.active){for(var i in this.handlers){this.handlers[i].activate();}}
return OpenLayers.Control.prototype.activate.apply(this,arguments);},deactivate:function(){if(this.active){for(var i in this.handlers){this.handlers[i].deactivate();}}
return OpenLayers.Control.prototype.deactivate.apply(this,arguments);},selectClick:function(evt){var bounds=this.pixelToBounds(evt.xy);this.setModifiers(evt);this.request(bounds,{single:this.single});},selectBox:function(position){var bounds;if(position instanceof OpenLayers.Bounds){var minXY=this.map.getLonLatFromPixel({x:position.left,y:position.bottom});var maxXY=this.map.getLonLatFromPixel({x:position.right,y:position.top});bounds=new OpenLayers.Bounds(minXY.lon,minXY.lat,maxXY.lon,maxXY.lat);}else{if(this.click){return;}
bounds=this.pixelToBounds(position);}
this.setModifiers(this.handlers.box.dragHandler.evt);this.request(bounds);},selectHover:function(evt){var bounds=this.pixelToBounds(evt.xy);this.request(bounds,{single:true,hover:true});},cancelHover:function(){if(this.hoverResponse){this.protocol.abort(this.hoverResponse);this.hoverResponse=null;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olCursorWait");}},request:function(bounds,options){options=options||{};var filter=new OpenLayers.Filter.Spatial({type:this.filterType,value:bounds});OpenLayers.Element.addClass(this.map.viewPortDiv,"olCursorWait");var response=this.protocol.read({maxFeatures:options.single==true?this.maxFeatures:undefined,filter:filter,callback:function(result){if(result.success()){if(result.features.length){if(options.single==true){this.selectBestFeature(result.features,bounds.getCenterLonLat(),options);}else{this.select(result.features);}}else if(options.hover){this.hoverSelect();}else{this.events.triggerEvent("clickout");if(this.clickout){this.unselectAll();}}}
OpenLayers.Element.removeClass(this.map.viewPortDiv,"olCursorWait");},scope:this});if(options.hover==true){this.hoverResponse=response;}},selectBestFeature:function(features,clickPosition,options){options=options||{};if(features.length){var point=new OpenLayers.Geometry.Point(clickPosition.lon,clickPosition.lat);var feature,resultFeature,dist;var minDist=Number.MAX_VALUE;for(var i=0;i<features.length;++i){feature=features[i];if(feature.geometry){dist=point.distanceTo(feature.geometry,{edge:false});if(dist<minDist){minDist=dist;resultFeature=feature;if(minDist==0){break;}}}}
if(options.hover==true){this.hoverSelect(resultFeature);}else{this.select(resultFeature||features);}}},setModifiers:function(evt){this.modifiers={multiple:this.multiple||(this.multipleKey&&evt[this.multipleKey]),toggle:this.toggle||(this.toggleKey&&evt[this.toggleKey])};},select:function(features){if(!this.modifiers.multiple&&!this.modifiers.toggle){this.unselectAll();}
if(!(OpenLayers.Util.isArray(features))){features=[features];}
var cont=this.events.triggerEvent("beforefeaturesselected",{features:features});if(cont!==false){var selectedFeatures=[];var feature;for(var i=0,len=features.length;i<len;++i){feature=features[i];if(this.features[feature.fid||feature.id]){if(this.modifiers.toggle){this.unselect(this.features[feature.fid||feature.id]);}}else{cont=this.events.triggerEvent("beforefeatureselected",{feature:feature});if(cont!==false){this.features[feature.fid||feature.id]=feature;selectedFeatures.push(feature);this.events.triggerEvent("featureselected",{feature:feature});}}}
this.events.triggerEvent("featuresselected",{features:selectedFeatures});}},hoverSelect:function(feature){var fid=feature?feature.fid||feature.id:null;var hfid=this.hoverFeature?this.hoverFeature.fid||this.hoverFeature.id:null;if(hfid&&hfid!=fid){this.events.triggerEvent("outfeature",{feature:this.hoverFeature});this.hoverFeature=null;}
if(fid&&fid!=hfid){this.events.triggerEvent("hoverfeature",{feature:feature});this.hoverFeature=feature;}},unselect:function(feature){delete this.features[feature.fid||feature.id];this.events.triggerEvent("featureunselected",{feature:feature});},unselectAll:function(){for(var fid in this.features){this.unselect(this.features[fid]);}},setMap:function(map){for(var i in this.handlers){this.handlers[i].setMap(map);}
OpenLayers.Control.prototype.setMap.apply(this,arguments);},pixelToBounds:function(pixel){var llPx=pixel.add(-this.clickTolerance/2,this.clickTolerance/2);var urPx=pixel.add(this.clickTolerance/2,-this.clickTolerance/2);var ll=this.map.getLonLatFromPixel(llPx);var ur=this.map.getLonLatFromPixel(urPx);return new OpenLayers.Bounds(ll.lon,ll.lat,ur.lon,ur.lat);},CLASS_NAME:"OpenLayers.Control.GetFeature"});OpenLayers.Format=OpenLayers.Class({options:null,externalProjection:null,internalProjection:null,data:null,keepData:false,initialize:function(options){OpenLayers.Util.extend(this,options);this.options=options;},destroy:function(){},read:function(data){throw new Error('Read not implemented.');},write:function(object){throw new Error('Write not implemented.');},CLASS_NAME:"OpenLayers.Format"});OpenLayers.Format.JSON=OpenLayers.Class(OpenLayers.Format,{indent:"    ",space:" ",newline:"\n",level:0,pretty:false,nativeJSON:(function(){return!!(window.JSON&&typeof JSON.parse=="function"&&typeof JSON.stringify=="function");})(),read:function(json,filter){var object;if(this.nativeJSON){object=JSON.parse(json,filter);}else try{if(/^[\],:{}\s]*$/.test(json.replace(/\\["\\\/bfnrtu]/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){object=eval('('+json+')');if(typeof filter==='function'){function walk(k,v){if(v&&typeof v==='object'){for(var i in v){if(v.hasOwnProperty(i)){v[i]=walk(i,v[i]);}}}
return filter(k,v);}
object=walk('',object);}}}catch(e){}
if(this.keepData){this.data=object;}
return object;},write:function(value,pretty){this.pretty=!!pretty;var json=null;var type=typeof value;if(this.serialize[type]){try{json=(!this.pretty&&this.nativeJSON)?JSON.stringify(value):this.serialize[type].apply(this,[value]);}catch(err){OpenLayers.Console.error("Trouble serializing: "+err);}}
return json;},writeIndent:function(){var pieces=[];if(this.pretty){for(var i=0;i<this.level;++i){pieces.push(this.indent);}}
return pieces.join('');},writeNewline:function(){return(this.pretty)?this.newline:'';},writeSpace:function(){return(this.pretty)?this.space:'';},serialize:{'object':function(object){if(object==null){return"null";}
if(object.constructor==Date){return this.serialize.date.apply(this,[object]);}
if(object.constructor==Array){return this.serialize.array.apply(this,[object]);}
var pieces=['{'];this.level+=1;var key,keyJSON,valueJSON;var addComma=false;for(key in object){if(object.hasOwnProperty(key)){keyJSON=OpenLayers.Format.JSON.prototype.write.apply(this,[key,this.pretty]);valueJSON=OpenLayers.Format.JSON.prototype.write.apply(this,[object[key],this.pretty]);if(keyJSON!=null&&valueJSON!=null){if(addComma){pieces.push(',');}
pieces.push(this.writeNewline(),this.writeIndent(),keyJSON,':',this.writeSpace(),valueJSON);addComma=true;}}}
this.level-=1;pieces.push(this.writeNewline(),this.writeIndent(),'}');return pieces.join('');},'array':function(array){var json;var pieces=['['];this.level+=1;for(var i=0,len=array.length;i<len;++i){json=OpenLayers.Format.JSON.prototype.write.apply(this,[array[i],this.pretty]);if(json!=null){if(i>0){pieces.push(',');}
pieces.push(this.writeNewline(),this.writeIndent(),json);}}
this.level-=1;pieces.push(this.writeNewline(),this.writeIndent(),']');return pieces.join('');},'string':function(string){var m={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};if(/["\\\x00-\x1f]/.test(string)){return'"'+string.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=m[b];if(c){return c;}
c=b.charCodeAt();return'\\u00'+
Math.floor(c/16).toString(16)+
(c%16).toString(16);})+'"';}
return'"'+string+'"';},'number':function(number){return isFinite(number)?String(number):"null";},'boolean':function(bool){return String(bool);},'date':function(date){function format(number){return(number<10)?'0'+number:number;}
return'"'+date.getFullYear()+'-'+
format(date.getMonth()+1)+'-'+
format(date.getDate())+'T'+
format(date.getHours())+':'+
format(date.getMinutes())+':'+
format(date.getSeconds())+'"';}},CLASS_NAME:"OpenLayers.Format.JSON"});OpenLayers.Geometry.MultiLineString=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LineString"],split:function(geometry,options){var results=null;var mutual=options&&options.mutual;var splits,sourceLine,sourceLines,sourceSplit,targetSplit;var sourceParts=[];var targetParts=[geometry];for(var i=0,len=this.components.length;i<len;++i){sourceLine=this.components[i];sourceSplit=false;for(var j=0;j<targetParts.length;++j){splits=sourceLine.split(targetParts[j],options);if(splits){if(mutual){sourceLines=splits[0];for(var k=0,klen=sourceLines.length;k<klen;++k){if(k===0&&sourceParts.length){sourceParts[sourceParts.length-1].addComponent(sourceLines[k]);}else{sourceParts.push(new OpenLayers.Geometry.MultiLineString([sourceLines[k]]));}}
sourceSplit=true;splits=splits[1];}
if(splits.length){splits.unshift(j,1);Array.prototype.splice.apply(targetParts,splits);break;}}}
if(!sourceSplit){if(sourceParts.length){sourceParts[sourceParts.length-1].addComponent(sourceLine.clone());}else{sourceParts=[new OpenLayers.Geometry.MultiLineString(sourceLine.clone())];}}}
if(sourceParts&&sourceParts.length>1){sourceSplit=true;}else{sourceParts=[];}
if(targetParts&&targetParts.length>1){targetSplit=true;}else{targetParts=[];}
if(sourceSplit||targetSplit){if(mutual){results=[sourceParts,targetParts];}else{results=targetParts;}}
return results;},splitWith:function(geometry,options){var results=null;var mutual=options&&options.mutual;var splits,targetLine,sourceLines,sourceSplit,targetSplit,sourceParts,targetParts;if(geometry instanceof OpenLayers.Geometry.LineString){targetParts=[];sourceParts=[geometry];for(var i=0,len=this.components.length;i<len;++i){targetSplit=false;targetLine=this.components[i];for(var j=0;j<sourceParts.length;++j){splits=sourceParts[j].split(targetLine,options);if(splits){if(mutual){sourceLines=splits[0];if(sourceLines.length){sourceLines.unshift(j,1);Array.prototype.splice.apply(sourceParts,sourceLines);j+=sourceLines.length-2;}
splits=splits[1];if(splits.length===0){splits=[targetLine.clone()];}}
for(var k=0,klen=splits.length;k<klen;++k){if(k===0&&targetParts.length){targetParts[targetParts.length-1].addComponent(splits[k]);}else{targetParts.push(new OpenLayers.Geometry.MultiLineString([splits[k]]));}}
targetSplit=true;}}
if(!targetSplit){if(targetParts.length){targetParts[targetParts.length-1].addComponent(targetLine.clone());}else{targetParts=[new OpenLayers.Geometry.MultiLineString([targetLine.clone()])];}}}}else{results=geometry.split(this);}
if(sourceParts&&sourceParts.length>1){sourceSplit=true;}else{sourceParts=[];}
if(targetParts&&targetParts.length>1){targetSplit=true;}else{targetParts=[];}
if(sourceSplit||targetSplit){if(mutual){results=[sourceParts,targetParts];}else{results=targetParts;}}
return results;},CLASS_NAME:"OpenLayers.Geometry.MultiLineString"});OpenLayers.Geometry.LinearRing=OpenLayers.Class(OpenLayers.Geometry.LineString,{componentTypes:["OpenLayers.Geometry.Point"],addComponent:function(point,index){var added=false;var lastPoint=this.components.pop();if(index!=null||!point.equals(lastPoint)){added=OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,arguments);}
var firstPoint=this.components[0];OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[firstPoint]);return added;},removeComponent:function(point){var removed=this.components&&(this.components.length>3);if(removed){this.components.pop();OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);var firstPoint=this.components[0];OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[firstPoint]);}
return removed;},move:function(x,y){for(var i=0,len=this.components.length;i<len-1;i++){this.components[i].move(x,y);}},rotate:function(angle,origin){for(var i=0,len=this.components.length;i<len-1;++i){this.components[i].rotate(angle,origin);}},resize:function(scale,origin,ratio){for(var i=0,len=this.components.length;i<len-1;++i){this.components[i].resize(scale,origin,ratio);}
return this;},transform:function(source,dest){if(source&&dest){for(var i=0,len=this.components.length;i<len-1;i++){var component=this.components[i];component.transform(source,dest);}
this.bounds=null;}
return this;},getCentroid:function(){if(this.components&&(this.components.length>2)){var sumX=0.0;var sumY=0.0;for(var i=0;i<this.components.length-1;i++){var b=this.components[i];var c=this.components[i+1];sumX+=(b.x+c.x)*(b.x*c.y-c.x*b.y);sumY+=(b.y+c.y)*(b.x*c.y-c.x*b.y);}
var area=-1*this.getArea();var x=sumX/(6*area);var y=sumY/(6*area);return new OpenLayers.Geometry.Point(x,y);}else{return null;}},getArea:function(){var area=0.0;if(this.components&&(this.components.length>2)){var sum=0.0;for(var i=0,len=this.components.length;i<len-1;i++){var b=this.components[i];var c=this.components[i+1];sum+=(b.x+c.x)*(c.y-b.y);}
area=-sum/2.0;}
return area;},getGeodesicArea:function(projection){var ring=this;if(projection){var gg=new OpenLayers.Projection("EPSG:4326");if(!gg.equals(projection)){ring=this.clone().transform(projection,gg);}}
var area=0.0;var len=ring.components&&ring.components.length;if(len>2){var p1,p2;for(var i=0;i<len-1;i++){p1=ring.components[i];p2=ring.components[i+1];area+=OpenLayers.Util.rad(p2.x-p1.x)*(2+Math.sin(OpenLayers.Util.rad(p1.y))+
Math.sin(OpenLayers.Util.rad(p2.y)));}
area=area*6378137.0*6378137.0/2.0;}
return area;},containsPoint:function(point){var approx=OpenLayers.Number.limitSigDigs;var digs=14;var px=approx(point.x,digs);var py=approx(point.y,digs);function getX(y,x1,y1,x2,y2){return(y-y2)*((x2-x1)/(y2-y1))+x2;}
var numSeg=this.components.length-1;var start,end,x1,y1,x2,y2,cx,cy;var crosses=0;for(var i=0;i<numSeg;++i){start=this.components[i];x1=approx(start.x,digs);y1=approx(start.y,digs);end=this.components[i+1];x2=approx(end.x,digs);y2=approx(end.y,digs);if(y1==y2){if(py==y1){if(x1<=x2&&(px>=x1&&px<=x2)||x1>=x2&&(px<=x1&&px>=x2)){crosses=-1;break;}}
continue;}
cx=approx(getX(py,x1,y1,x2,y2),digs);if(cx==px){if(y1<y2&&(py>=y1&&py<=y2)||y1>y2&&(py<=y1&&py>=y2)){crosses=-1;break;}}
if(cx<=px){continue;}
if(x1!=x2&&(cx<Math.min(x1,x2)||cx>Math.max(x1,x2))){continue;}
if(y1<y2&&(py>=y1&&py<y2)||y1>y2&&(py<y1&&py>=y2)){++crosses;}}
var contained=(crosses==-1)?1:!!(crosses&1);return contained;},intersects:function(geometry){var intersect=false;if(geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){intersect=this.containsPoint(geometry);}else if(geometry.CLASS_NAME=="OpenLayers.Geometry.LineString"){intersect=geometry.intersects(this);}else if(geometry.CLASS_NAME=="OpenLayers.Geometry.LinearRing"){intersect=OpenLayers.Geometry.LineString.prototype.intersects.apply(this,[geometry]);}else{for(var i=0,len=geometry.components.length;i<len;++i){intersect=geometry.components[i].intersects(this);if(intersect){break;}}}
return intersect;},getVertices:function(nodes){return(nodes===true)?[]:this.components.slice(0,this.components.length-1);},CLASS_NAME:"OpenLayers.Geometry.LinearRing"});OpenLayers.Geometry.Polygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LinearRing"],getArea:function(){var area=0.0;if(this.components&&(this.components.length>0)){area+=Math.abs(this.components[0].getArea());for(var i=1,len=this.components.length;i<len;i++){area-=Math.abs(this.components[i].getArea());}}
return area;},getGeodesicArea:function(projection){var area=0.0;if(this.components&&(this.components.length>0)){area+=Math.abs(this.components[0].getGeodesicArea(projection));for(var i=1,len=this.components.length;i<len;i++){area-=Math.abs(this.components[i].getGeodesicArea(projection));}}
return area;},containsPoint:function(point){var numRings=this.components.length;var contained=false;if(numRings>0){contained=this.components[0].containsPoint(point);if(contained!==1){if(contained&&numRings>1){var hole;for(var i=1;i<numRings;++i){hole=this.components[i].containsPoint(point);if(hole){if(hole===1){contained=1;}else{contained=false;}
break;}}}}}
return contained;},intersects:function(geometry){var intersect=false;var i,len;if(geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){intersect=this.containsPoint(geometry);}else if(geometry.CLASS_NAME=="OpenLayers.Geometry.LineString"||geometry.CLASS_NAME=="OpenLayers.Geometry.LinearRing"){for(i=0,len=this.components.length;i<len;++i){intersect=geometry.intersects(this.components[i]);if(intersect){break;}}
if(!intersect){for(i=0,len=geometry.components.length;i<len;++i){intersect=this.containsPoint(geometry.components[i]);if(intersect){break;}}}}else{for(i=0,len=geometry.components.length;i<len;++i){intersect=this.intersects(geometry.components[i]);if(intersect){break;}}}
if(!intersect&&geometry.CLASS_NAME=="OpenLayers.Geometry.Polygon"){var ring=this.components[0];for(i=0,len=ring.components.length;i<len;++i){intersect=geometry.containsPoint(ring.components[i]);if(intersect){break;}}}
return intersect;},distanceTo:function(geometry,options){var edge=!(options&&options.edge===false);var result;if(!edge&&this.intersects(geometry)){result=0;}else{result=OpenLayers.Geometry.Collection.prototype.distanceTo.apply(this,[geometry,options]);}
return result;},CLASS_NAME:"OpenLayers.Geometry.Polygon"});OpenLayers.Geometry.Polygon.createRegularPolygon=function(origin,radius,sides,rotation){var angle=Math.PI*((1/sides)-(1/2));if(rotation){angle+=(rotation/180)*Math.PI;}
var rotatedAngle,x,y;var points=[];for(var i=0;i<sides;++i){rotatedAngle=angle+(i*2*Math.PI/sides);x=origin.x+(radius*Math.cos(rotatedAngle));y=origin.y+(radius*Math.sin(rotatedAngle));points.push(new OpenLayers.Geometry.Point(x,y));}
var ring=new OpenLayers.Geometry.LinearRing(points);return new OpenLayers.Geometry.Polygon([ring]);};OpenLayers.Geometry.MultiPolygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.Polygon"],CLASS_NAME:"OpenLayers.Geometry.MultiPolygon"});OpenLayers.Format.GeoJSON=OpenLayers.Class(OpenLayers.Format.JSON,{ignoreExtraDims:false,read:function(json,type,filter){type=(type)?type:"FeatureCollection";var results=null;var obj=null;if(typeof json=="string"){obj=OpenLayers.Format.JSON.prototype.read.apply(this,[json,filter]);}else{obj=json;}
if(!obj){OpenLayers.Console.error("Bad JSON: "+json);}else if(typeof(obj.type)!="string"){OpenLayers.Console.error("Bad GeoJSON - no type: "+json);}else if(this.isValidType(obj,type)){switch(type){case"Geometry":try{results=this.parseGeometry(obj);}catch(err){OpenLayers.Console.error(err);}
break;case"Feature":try{results=this.parseFeature(obj);results.type="Feature";}catch(err){OpenLayers.Console.error(err);}
break;case"FeatureCollection":results=[];switch(obj.type){case"Feature":try{results.push(this.parseFeature(obj));}catch(err){results=null;OpenLayers.Console.error(err);}
break;case"FeatureCollection":for(var i=0,len=obj.features.length;i<len;++i){try{results.push(this.parseFeature(obj.features[i]));}catch(err){results=null;OpenLayers.Console.error(err);}}
break;default:try{var geom=this.parseGeometry(obj);results.push(new OpenLayers.Feature.Vector(geom));}catch(err){results=null;OpenLayers.Console.error(err);}}
break;}}
return results;},isValidType:function(obj,type){var valid=false;switch(type){case"Geometry":if(OpenLayers.Util.indexOf(["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon","Box","GeometryCollection"],obj.type)==-1){OpenLayers.Console.error("Unsupported geometry type: "+
obj.type);}else{valid=true;}
break;case"FeatureCollection":valid=true;break;default:if(obj.type==type){valid=true;}else{OpenLayers.Console.error("Cannot convert types from "+
obj.type+" to "+type);}}
return valid;},parseFeature:function(obj){var feature,geometry,attributes,bbox;attributes=(obj.properties)?obj.properties:{};bbox=(obj.geometry&&obj.geometry.bbox)||obj.bbox;try{geometry=this.parseGeometry(obj.geometry);}catch(err){throw err;}
feature=new OpenLayers.Feature.Vector(geometry,attributes);if(bbox){feature.bounds=OpenLayers.Bounds.fromArray(bbox);}
if(obj.id){feature.fid=obj.id;}
return feature;},parseGeometry:function(obj){if(obj==null){return null;}
var geometry,collection=false;if(obj.type=="GeometryCollection"){if(!(OpenLayers.Util.isArray(obj.geometries))){throw"GeometryCollection must have geometries array: "+obj;}
var numGeom=obj.geometries.length;var components=new Array(numGeom);for(var i=0;i<numGeom;++i){components[i]=this.parseGeometry.apply(this,[obj.geometries[i]]);}
geometry=new OpenLayers.Geometry.Collection(components);collection=true;}else{if(!(OpenLayers.Util.isArray(obj.coordinates))){throw"Geometry must have coordinates array: "+obj;}
if(!this.parseCoords[obj.type.toLowerCase()]){throw"Unsupported geometry type: "+obj.type;}
try{geometry=this.parseCoords[obj.type.toLowerCase()].apply(this,[obj.coordinates]);}catch(err){throw err;}}
if(this.internalProjection&&this.externalProjection&&!collection){geometry.transform(this.externalProjection,this.internalProjection);}
return geometry;},parseCoords:{"point":function(array){if(this.ignoreExtraDims==false&&array.length!=2){throw"Only 2D points are supported: "+array;}
return new OpenLayers.Geometry.Point(array[0],array[1]);},"multipoint":function(array){var points=[];var p=null;for(var i=0,len=array.length;i<len;++i){try{p=this.parseCoords["point"].apply(this,[array[i]]);}catch(err){throw err;}
points.push(p);}
return new OpenLayers.Geometry.MultiPoint(points);},"linestring":function(array){var points=[];var p=null;for(var i=0,len=array.length;i<len;++i){try{p=this.parseCoords["point"].apply(this,[array[i]]);}catch(err){throw err;}
points.push(p);}
return new OpenLayers.Geometry.LineString(points);},"multilinestring":function(array){var lines=[];var l=null;for(var i=0,len=array.length;i<len;++i){try{l=this.parseCoords["linestring"].apply(this,[array[i]]);}catch(err){throw err;}
lines.push(l);}
return new OpenLayers.Geometry.MultiLineString(lines);},"polygon":function(array){var rings=[];var r,l;for(var i=0,len=array.length;i<len;++i){try{l=this.parseCoords["linestring"].apply(this,[array[i]]);}catch(err){throw err;}
r=new OpenLayers.Geometry.LinearRing(l.components);rings.push(r);}
return new OpenLayers.Geometry.Polygon(rings);},"multipolygon":function(array){var polys=[];var p=null;for(var i=0,len=array.length;i<len;++i){try{p=this.parseCoords["polygon"].apply(this,[array[i]]);}catch(err){throw err;}
polys.push(p);}
return new OpenLayers.Geometry.MultiPolygon(polys);},"box":function(array){if(array.length!=2){throw"GeoJSON box coordinates must have 2 elements";}
return new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(array[0][0],array[0][1]),new OpenLayers.Geometry.Point(array[1][0],array[0][1]),new OpenLayers.Geometry.Point(array[1][0],array[1][1]),new OpenLayers.Geometry.Point(array[0][0],array[1][1]),new OpenLayers.Geometry.Point(array[0][0],array[0][1])])]);}},write:function(obj,pretty){var geojson={"type":null};if(OpenLayers.Util.isArray(obj)){geojson.type="FeatureCollection";var numFeatures=obj.length;geojson.features=new Array(numFeatures);for(var i=0;i<numFeatures;++i){var element=obj[i];if(!element instanceof OpenLayers.Feature.Vector){var msg="FeatureCollection only supports collections "+"of features: "+element;throw msg;}
geojson.features[i]=this.extract.feature.apply(this,[element]);}}else if(obj.CLASS_NAME.indexOf("OpenLayers.Geometry")==0){geojson=this.extract.geometry.apply(this,[obj]);}else if(obj instanceof OpenLayers.Feature.Vector){geojson=this.extract.feature.apply(this,[obj]);if(obj.layer&&obj.layer.projection){geojson.crs=this.createCRSObject(obj);}}
return OpenLayers.Format.JSON.prototype.write.apply(this,[geojson,pretty]);},createCRSObject:function(object){var proj=object.layer.projection.toString();var crs={};if(proj.match(/epsg:/i)){var code=parseInt(proj.substring(proj.indexOf(":")+1));if(code==4326){crs={"type":"name","properties":{"name":"urn:ogc:def:crs:OGC:1.3:CRS84"}};}else{crs={"type":"name","properties":{"name":"EPSG:"+code}};}}
return crs;},extract:{'feature':function(feature){var geom=this.extract.geometry.apply(this,[feature.geometry]);var json={"type":"Feature","properties":feature.attributes,"geometry":geom};if(feature.fid!=null){json.id=feature.fid;}
return json;},'geometry':function(geometry){if(geometry==null){return null;}
if(this.internalProjection&&this.externalProjection){geometry=geometry.clone();geometry.transform(this.internalProjection,this.externalProjection);}
var geometryType=geometry.CLASS_NAME.split('.')[2];var data=this.extract[geometryType.toLowerCase()].apply(this,[geometry]);var json;if(geometryType=="Collection"){json={"type":"GeometryCollection","geometries":data};}else{json={"type":geometryType,"coordinates":data};}
return json;},'point':function(point){return[point.x,point.y];},'multipoint':function(multipoint){var array=[];for(var i=0,len=multipoint.components.length;i<len;++i){array.push(this.extract.point.apply(this,[multipoint.components[i]]));}
return array;},'linestring':function(linestring){var array=[];for(var i=0,len=linestring.components.length;i<len;++i){array.push(this.extract.point.apply(this,[linestring.components[i]]));}
return array;},'multilinestring':function(multilinestring){var array=[];for(var i=0,len=multilinestring.components.length;i<len;++i){array.push(this.extract.linestring.apply(this,[multilinestring.components[i]]));}
return array;},'polygon':function(polygon){var array=[];for(var i=0,len=polygon.components.length;i<len;++i){array.push(this.extract.linestring.apply(this,[polygon.components[i]]));}
return array;},'multipolygon':function(multipolygon){var array=[];for(var i=0,len=multipolygon.components.length;i<len;++i){array.push(this.extract.polygon.apply(this,[multipolygon.components[i]]));}
return array;},'collection':function(collection){var len=collection.components.length;var array=new Array(len);for(var i=0;i<len;++i){array[i]=this.extract.geometry.apply(this,[collection.components[i]]);}
return array;}},CLASS_NAME:"OpenLayers.Format.GeoJSON"});OpenLayers.Protocol=OpenLayers.Class({format:null,options:null,autoDestroy:true,defaultFilter:null,initialize:function(options){options=options||{};OpenLayers.Util.extend(this,options);this.options=options;},mergeWithDefaultFilter:function(filter){var merged;if(filter&&this.defaultFilter){merged=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.AND,filters:[this.defaultFilter,filter]});}else{merged=filter||this.defaultFilter||undefined;}
return merged;},destroy:function(){this.options=null;this.format=null;},read:function(options){options=options||{};options.filter=this.mergeWithDefaultFilter(options.filter);},create:function(){},update:function(){},"delete":function(){},commit:function(){},abort:function(response){},createCallback:function(method,response,options){return OpenLayers.Function.bind(function(){method.apply(this,[response,options]);},this);},CLASS_NAME:"OpenLayers.Protocol"});OpenLayers.Protocol.Response=OpenLayers.Class({code:null,requestType:null,last:true,features:null,data:null,reqFeatures:null,priv:null,error:null,initialize:function(options){OpenLayers.Util.extend(this,options);},success:function(){return this.code>0;},CLASS_NAME:"OpenLayers.Protocol.Response"});OpenLayers.Protocol.Response.SUCCESS=1;OpenLayers.Protocol.Response.FAILURE=0;OpenLayers.ProxyHost="";OpenLayers.Request={DEFAULT_CONFIG:{method:"GET",url:window.location.href,async:true,user:undefined,password:undefined,params:null,proxy:OpenLayers.ProxyHost,headers:{},data:null,callback:function(){},success:null,failure:null,scope:null},URL_SPLIT_REGEX:/([^:]*:)\/\/([^:]*:?[^@]*@)?([^:\/\?]*):?([^\/\?]*)/,events:new OpenLayers.Events(this),issue:function(config){var defaultConfig=OpenLayers.Util.extend(this.DEFAULT_CONFIG,{proxy:OpenLayers.ProxyHost});config=OpenLayers.Util.applyDefaults(config,defaultConfig);var customRequestedWithHeader=false,headerKey;for(headerKey in config.headers){if(config.headers.hasOwnProperty(headerKey)){if(headerKey.toLowerCase()==='x-requested-with'){customRequestedWithHeader=true;}}}
if(customRequestedWithHeader===false){config.headers['X-Requested-With']='XMLHttpRequest';}
var request=new OpenLayers.Request.XMLHttpRequest();var url=OpenLayers.Util.urlAppend(config.url,OpenLayers.Util.getParameterString(config.params||{}));var sameOrigin=!(url.indexOf("http")==0);var urlParts=!sameOrigin&&url.match(this.URL_SPLIT_REGEX);if(urlParts){var location=window.location;sameOrigin=urlParts[1]==location.protocol&&urlParts[3]==location.hostname;var uPort=urlParts[4],lPort=location.port;if(uPort!=80&&uPort!=""||lPort!="80"&&lPort!=""){sameOrigin=sameOrigin&&uPort==lPort;}}
if(!sameOrigin){if(config.proxy){if(typeof config.proxy=="function"){url=config.proxy(url);}else{url=config.proxy+encodeURIComponent(url);}}else{OpenLayers.Console.warn(OpenLayers.i18n("proxyNeeded"),{url:url});}}
request.open(config.method,url,config.async,config.user,config.password);for(var header in config.headers){request.setRequestHeader(header,config.headers[header]);}
var events=this.events;var self=this;request.onreadystatechange=function(){if(request.readyState==OpenLayers.Request.XMLHttpRequest.DONE){var proceed=events.triggerEvent("complete",{request:request,config:config,requestUrl:url});if(proceed!==false){self.runCallbacks({request:request,config:config,requestUrl:url});}}};if(config.async===false){request.send(config.data);}else{window.setTimeout(function(){if(request.readyState!==0){request.send(config.data);}},0);}
return request;},runCallbacks:function(options){var request=options.request;var config=options.config;var complete=(config.scope)?OpenLayers.Function.bind(config.callback,config.scope):config.callback;var success;if(config.success){success=(config.scope)?OpenLayers.Function.bind(config.success,config.scope):config.success;}
var failure;if(config.failure){failure=(config.scope)?OpenLayers.Function.bind(config.failure,config.scope):config.failure;}
if(OpenLayers.Util.createUrlObject(config.url).protocol=="file:"&&request.responseText){request.status=200;}
complete(request);if(!request.status||(request.status>=200&&request.status<300)){this.events.triggerEvent("success",options);if(success){success(request);}}
if(request.status&&(request.status<200||request.status>=300)){this.events.triggerEvent("failure",options);if(failure){failure(request);}}},GET:function(config){config=OpenLayers.Util.extend(config,{method:"GET"});return OpenLayers.Request.issue(config);},POST:function(config){config=OpenLayers.Util.extend(config,{method:"POST"});config.headers=config.headers?config.headers:{};if(!("CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(config.headers))){config.headers["Content-Type"]="application/xml";}
return OpenLayers.Request.issue(config);},PUT:function(config){config=OpenLayers.Util.extend(config,{method:"PUT"});config.headers=config.headers?config.headers:{};if(!("CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(config.headers))){config.headers["Content-Type"]="application/xml";}
return OpenLayers.Request.issue(config);},DELETE:function(config){config=OpenLayers.Util.extend(config,{method:"DELETE"});return OpenLayers.Request.issue(config);},HEAD:function(config){config=OpenLayers.Util.extend(config,{method:"HEAD"});return OpenLayers.Request.issue(config);},OPTIONS:function(config){config=OpenLayers.Util.extend(config,{method:"OPTIONS"});return OpenLayers.Request.issue(config);}};(function(){var oXMLHttpRequest=window.XMLHttpRequest;var bGecko=!!window.controllers,bIE=window.document.all&&!window.opera,bIE7=bIE&&window.navigator.userAgent.match(/MSIE 7.0/);function fXMLHttpRequest(){this._object=oXMLHttpRequest&&!bIE7?new oXMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");this._listeners=[];};function cXMLHttpRequest(){return new fXMLHttpRequest;};cXMLHttpRequest.prototype=fXMLHttpRequest.prototype;if(bGecko&&oXMLHttpRequest.wrapped)
cXMLHttpRequest.wrapped=oXMLHttpRequest.wrapped;cXMLHttpRequest.UNSENT=0;cXMLHttpRequest.OPENED=1;cXMLHttpRequest.HEADERS_RECEIVED=2;cXMLHttpRequest.LOADING=3;cXMLHttpRequest.DONE=4;cXMLHttpRequest.prototype.readyState=cXMLHttpRequest.UNSENT;cXMLHttpRequest.prototype.responseText='';cXMLHttpRequest.prototype.responseXML=null;cXMLHttpRequest.prototype.status=0;cXMLHttpRequest.prototype.statusText='';cXMLHttpRequest.prototype.priority="NORMAL";cXMLHttpRequest.prototype.onreadystatechange=null;cXMLHttpRequest.onreadystatechange=null;cXMLHttpRequest.onopen=null;cXMLHttpRequest.onsend=null;cXMLHttpRequest.onabort=null;cXMLHttpRequest.prototype.open=function(sMethod,sUrl,bAsync,sUser,sPassword){delete this._headers;if(arguments.length<3)
bAsync=true;this._async=bAsync;var oRequest=this,nState=this.readyState,fOnUnload;if(bIE&&bAsync){fOnUnload=function(){if(nState!=cXMLHttpRequest.DONE){fCleanTransport(oRequest);oRequest.abort();}};window.attachEvent("onunload",fOnUnload);}
if(cXMLHttpRequest.onopen)
cXMLHttpRequest.onopen.apply(this,arguments);if(arguments.length>4)
this._object.open(sMethod,sUrl,bAsync,sUser,sPassword);else
if(arguments.length>3)
this._object.open(sMethod,sUrl,bAsync,sUser);else
this._object.open(sMethod,sUrl,bAsync);this.readyState=cXMLHttpRequest.OPENED;fReadyStateChange(this);this._object.onreadystatechange=function(){if(bGecko&&!bAsync)
return;oRequest.readyState=oRequest._object.readyState;fSynchronizeValues(oRequest);if(oRequest._aborted){oRequest.readyState=cXMLHttpRequest.UNSENT;return;}
if(oRequest.readyState==cXMLHttpRequest.DONE){delete oRequest._data;fCleanTransport(oRequest);if(bIE&&bAsync)
window.detachEvent("onunload",fOnUnload);}
if(nState!=oRequest.readyState)
fReadyStateChange(oRequest);nState=oRequest.readyState;}};function fXMLHttpRequest_send(oRequest){oRequest._object.send(oRequest._data);if(bGecko&&!oRequest._async){oRequest.readyState=cXMLHttpRequest.OPENED;fSynchronizeValues(oRequest);while(oRequest.readyState<cXMLHttpRequest.DONE){oRequest.readyState++;fReadyStateChange(oRequest);if(oRequest._aborted)
return;}}};cXMLHttpRequest.prototype.send=function(vData){if(cXMLHttpRequest.onsend)
cXMLHttpRequest.onsend.apply(this,arguments);if(!arguments.length)
vData=null;if(vData&&vData.nodeType){vData=window.XMLSerializer?new window.XMLSerializer().serializeToString(vData):vData.xml;if(!this._headers["Content-Type"])
this._object.setRequestHeader("Content-Type","application/xml");}
this._data=vData;fXMLHttpRequest_send(this);};cXMLHttpRequest.prototype.abort=function(){if(cXMLHttpRequest.onabort)
cXMLHttpRequest.onabort.apply(this,arguments);if(this.readyState>cXMLHttpRequest.UNSENT)
this._aborted=true;this._object.abort();fCleanTransport(this);this.readyState=cXMLHttpRequest.UNSENT;delete this._data;};cXMLHttpRequest.prototype.getAllResponseHeaders=function(){return this._object.getAllResponseHeaders();};cXMLHttpRequest.prototype.getResponseHeader=function(sName){return this._object.getResponseHeader(sName);};cXMLHttpRequest.prototype.setRequestHeader=function(sName,sValue){if(!this._headers)
this._headers={};this._headers[sName]=sValue;return this._object.setRequestHeader(sName,sValue);};cXMLHttpRequest.prototype.addEventListener=function(sName,fHandler,bUseCapture){for(var nIndex=0,oListener;oListener=this._listeners[nIndex];nIndex++)
if(oListener[0]==sName&&oListener[1]==fHandler&&oListener[2]==bUseCapture)
return;this._listeners.push([sName,fHandler,bUseCapture]);};cXMLHttpRequest.prototype.removeEventListener=function(sName,fHandler,bUseCapture){for(var nIndex=0,oListener;oListener=this._listeners[nIndex];nIndex++)
if(oListener[0]==sName&&oListener[1]==fHandler&&oListener[2]==bUseCapture)
break;if(oListener)
this._listeners.splice(nIndex,1);};cXMLHttpRequest.prototype.dispatchEvent=function(oEvent){var oEventPseudo={'type':oEvent.type,'target':this,'currentTarget':this,'eventPhase':2,'bubbles':oEvent.bubbles,'cancelable':oEvent.cancelable,'timeStamp':oEvent.timeStamp,'stopPropagation':function(){},'preventDefault':function(){},'initEvent':function(){}};if(oEventPseudo.type=="readystatechange"&&this.onreadystatechange)
(this.onreadystatechange.handleEvent||this.onreadystatechange).apply(this,[oEventPseudo]);for(var nIndex=0,oListener;oListener=this._listeners[nIndex];nIndex++)
if(oListener[0]==oEventPseudo.type&&!oListener[2])
(oListener[1].handleEvent||oListener[1]).apply(this,[oEventPseudo]);};cXMLHttpRequest.prototype.toString=function(){return'['+"object"+' '+"XMLHttpRequest"+']';};cXMLHttpRequest.toString=function(){return'['+"XMLHttpRequest"+']';};function fReadyStateChange(oRequest){if(cXMLHttpRequest.onreadystatechange)
cXMLHttpRequest.onreadystatechange.apply(oRequest);oRequest.dispatchEvent({'type':"readystatechange",'bubbles':false,'cancelable':false,'timeStamp':new Date+0});};function fGetDocument(oRequest){var oDocument=oRequest.responseXML,sResponse=oRequest.responseText;if(bIE&&sResponse&&oDocument&&!oDocument.documentElement&&oRequest.getResponseHeader("Content-Type").match(/[^\/]+\/[^\+]+\+xml/)){oDocument=new window.ActiveXObject("Microsoft.XMLDOM");oDocument.async=false;oDocument.validateOnParse=false;oDocument.loadXML(sResponse);}
if(oDocument)
if((bIE&&oDocument.parseError!=0)||!oDocument.documentElement||(oDocument.documentElement&&oDocument.documentElement.tagName=="parsererror"))
return null;return oDocument;};function fSynchronizeValues(oRequest){try{oRequest.responseText=oRequest._object.responseText;}catch(e){}
try{oRequest.responseXML=fGetDocument(oRequest._object);}catch(e){}
try{oRequest.status=oRequest._object.status;}catch(e){}
try{oRequest.statusText=oRequest._object.statusText;}catch(e){}};function fCleanTransport(oRequest){oRequest._object.onreadystatechange=new window.Function;};if(!window.Function.prototype.apply){window.Function.prototype.apply=function(oRequest,oArguments){if(!oArguments)
oArguments=[];oRequest.__func=this;oRequest.__func(oArguments[0],oArguments[1],oArguments[2],oArguments[3],oArguments[4]);delete oRequest.__func;};};OpenLayers.Request.XMLHttpRequest=cXMLHttpRequest;})();OpenLayers.Protocol.HTTP=OpenLayers.Class(OpenLayers.Protocol,{url:null,headers:null,params:null,callback:null,scope:null,readWithPOST:false,wildcarded:false,srsInBBOX:false,initialize:function(options){options=options||{};this.params={};this.headers={};OpenLayers.Protocol.prototype.initialize.apply(this,arguments);if(!this.filterToParams&&OpenLayers.Format.QueryStringFilter){var format=new OpenLayers.Format.QueryStringFilter({wildcarded:this.wildcarded,srsInBBOX:this.srsInBBOX});this.filterToParams=function(filter,params){return format.write(filter,params);}}},destroy:function(){this.params=null;this.headers=null;OpenLayers.Protocol.prototype.destroy.apply(this);},read:function(options){OpenLayers.Protocol.prototype.read.apply(this,arguments);options=options||{};options.params=OpenLayers.Util.applyDefaults(options.params,this.options.params);options=OpenLayers.Util.applyDefaults(options,this.options);if(options.filter&&this.filterToParams){options.params=this.filterToParams(options.filter,options.params);}
var readWithPOST=(options.readWithPOST!==undefined)?options.readWithPOST:this.readWithPOST;var resp=new OpenLayers.Protocol.Response({requestType:"read"});if(readWithPOST){var headers=options.headers||{};headers["Content-Type"]="application/x-www-form-urlencoded";resp.priv=OpenLayers.Request.POST({url:options.url,callback:this.createCallback(this.handleRead,resp,options),data:OpenLayers.Util.getParameterString(options.params),headers:headers});}else{resp.priv=OpenLayers.Request.GET({url:options.url,callback:this.createCallback(this.handleRead,resp,options),params:options.params,headers:options.headers});}
return resp;},handleRead:function(resp,options){this.handleResponse(resp,options);},create:function(features,options){options=OpenLayers.Util.applyDefaults(options,this.options);var resp=new OpenLayers.Protocol.Response({reqFeatures:features,requestType:"create"});resp.priv=OpenLayers.Request.POST({url:options.url,callback:this.createCallback(this.handleCreate,resp,options),headers:options.headers,data:this.format.write(features)});return resp;},handleCreate:function(resp,options){this.handleResponse(resp,options);},update:function(feature,options){options=options||{};var url=options.url||feature.url||this.options.url+"/"+feature.fid;options=OpenLayers.Util.applyDefaults(options,this.options);var resp=new OpenLayers.Protocol.Response({reqFeatures:feature,requestType:"update"});resp.priv=OpenLayers.Request.PUT({url:url,callback:this.createCallback(this.handleUpdate,resp,options),headers:options.headers,data:this.format.write(feature)});return resp;},handleUpdate:function(resp,options){this.handleResponse(resp,options);},"delete":function(feature,options){options=options||{};var url=options.url||feature.url||this.options.url+"/"+feature.fid;options=OpenLayers.Util.applyDefaults(options,this.options);var resp=new OpenLayers.Protocol.Response({reqFeatures:feature,requestType:"delete"});resp.priv=OpenLayers.Request.DELETE({url:url,callback:this.createCallback(this.handleDelete,resp,options),headers:options.headers});return resp;},handleDelete:function(resp,options){this.handleResponse(resp,options);},handleResponse:function(resp,options){var request=resp.priv;if(options.callback){if(request.status>=200&&request.status<300){if(resp.requestType!="delete"){resp.features=this.parseFeatures(request);}
resp.code=OpenLayers.Protocol.Response.SUCCESS;}else{resp.code=OpenLayers.Protocol.Response.FAILURE;}
options.callback.call(options.scope,resp);}},parseFeatures:function(request){var doc=request.responseXML;if(!doc||!doc.documentElement){doc=request.responseText;}
if(!doc||doc.length<=0){return null;}
return this.format.read(doc);},commit:function(features,options){options=OpenLayers.Util.applyDefaults(options,this.options);var resp=[],nResponses=0;var types={};types[OpenLayers.State.INSERT]=[];types[OpenLayers.State.UPDATE]=[];types[OpenLayers.State.DELETE]=[];var feature,list,requestFeatures=[];for(var i=0,len=features.length;i<len;++i){feature=features[i];list=types[feature.state];if(list){list.push(feature);requestFeatures.push(feature);}}
var nRequests=(types[OpenLayers.State.INSERT].length>0?1:0)+
types[OpenLayers.State.UPDATE].length+
types[OpenLayers.State.DELETE].length;var success=true;var finalResponse=new OpenLayers.Protocol.Response({reqFeatures:requestFeatures});function insertCallback(response){var len=response.features?response.features.length:0;var fids=new Array(len);for(var i=0;i<len;++i){fids[i]=response.features[i].fid;}
finalResponse.insertIds=fids;callback.apply(this,[response]);}
function callback(response){this.callUserCallback(response,options);success=success&&response.success();nResponses++;if(nResponses>=nRequests){if(options.callback){finalResponse.code=success?OpenLayers.Protocol.Response.SUCCESS:OpenLayers.Protocol.Response.FAILURE;options.callback.apply(options.scope,[finalResponse]);}}}
var queue=types[OpenLayers.State.INSERT];if(queue.length>0){resp.push(this.create(queue,OpenLayers.Util.applyDefaults({callback:insertCallback,scope:this},options.create)));}
queue=types[OpenLayers.State.UPDATE];for(var i=queue.length-1;i>=0;--i){resp.push(this.update(queue[i],OpenLayers.Util.applyDefaults({callback:callback,scope:this},options.update)));}
queue=types[OpenLayers.State.DELETE];for(var i=queue.length-1;i>=0;--i){resp.push(this["delete"](queue[i],OpenLayers.Util.applyDefaults({callback:callback,scope:this},options["delete"])));}
return resp;},abort:function(response){if(response){response.priv.abort();}},callUserCallback:function(resp,options){var opt=options[resp.requestType];if(opt&&opt.callback){opt.callback.call(opt.scope,resp);}},CLASS_NAME:"OpenLayers.Protocol.HTTP"});Ext.namespace("GeoExt");GeoExt.Popup=Ext.extend(Ext.Window,{anchored:true,map:null,panIn:true,unpinnable:true,location:null,animCollapse:false,draggable:false,shadow:false,popupCls:"gx-popup",ancCls:null,initComponent:function(){if(this.map instanceof GeoExt.MapPanel){this.map=this.map.map;}
if(!this.map&&this.location instanceof OpenLayers.Feature.Vector&&this.location.layer){this.map=this.location.layer.map;}
if(this.location instanceof OpenLayers.Feature.Vector){this.location=this.location.geometry;}
if(this.location instanceof OpenLayers.Geometry){if(typeof this.location.getCentroid=="function"){this.location=this.location.getCentroid();}
this.location=this.location.getBounds().getCenterLonLat();}else if(this.location instanceof OpenLayers.Pixel){this.location=this.map.getLonLatFromViewPortPx(this.location);}
if(this.anchored){this.addAnchorEvents();}
this.baseCls=this.popupCls+" "+this.baseCls;this.elements+=',anc';GeoExt.Popup.superclass.initComponent.call(this);},onRender:function(ct,position){GeoExt.Popup.superclass.onRender.call(this,ct,position);this.ancCls=this.popupCls+"-anc";this.createElement("anc",this.el.dom);},initTools:function(){if(this.unpinnable){this.addTool({id:'unpin',handler:this.unanchorPopup.createDelegate(this,[])});}
GeoExt.Popup.superclass.initTools.call(this);},show:function(){GeoExt.Popup.superclass.show.apply(this,arguments);if(this.anchored){this.position();if(this.panIn&&!this._mapMove){this.panIntoView();}}},maximize:function(){if(!this.maximized&&this.anc){this.unanchorPopup();}
GeoExt.Popup.superclass.maximize.apply(this,arguments);},setSize:function(w,h){if(this.anc){var ancSize=this.anc.getSize();if(typeof w=='object'){h=w.height-ancSize.height;w=w.width;}else if(!isNaN(h)){h=h-ancSize.height;}}
GeoExt.Popup.superclass.setSize.call(this,w,h);},position:function(){if(this._mapMove===true){var visible=this.map.getExtent().containsLonLat(this.location);if(visible!==this.isVisible()){this.setVisible(visible);}}
if(this.isVisible()){var centerPx=this.map.getViewPortPxFromLonLat(this.location);var mapBox=Ext.fly(this.map.div).getBox();var anc=this.anc;var dx=anc.getLeft(true)+anc.getWidth()/2;var dy=this.el.getHeight();this.setPosition(centerPx.x+mapBox.x-dx,centerPx.y+mapBox.y-dy);}},unanchorPopup:function(){this.removeAnchorEvents();this.draggable=true;this.header.addClass("x-window-draggable");this.dd=new Ext.Window.DD(this);this.anc.remove();this.anc=null;this.tools.unpin.hide();},panIntoView:function(){var mapBox=Ext.fly(this.map.div).getBox();var popupPos=this.getPosition(true);popupPos[0]-=mapBox.x;popupPos[1]-=mapBox.y;var panelSize=[mapBox.width,mapBox.height];var popupSize=this.getSize();var newPos=[popupPos[0],popupPos[1]];var padding=this.map.paddingForPopups;if(popupPos[0]<padding.left){newPos[0]=padding.left;}else if(popupPos[0]+popupSize.width>panelSize[0]-padding.right){newPos[0]=panelSize[0]-padding.right-popupSize.width;}
if(popupPos[1]<padding.top){newPos[1]=padding.top;}else if(popupPos[1]+popupSize.height>panelSize[1]-padding.bottom){newPos[1]=panelSize[1]-padding.bottom-popupSize.height;}
var dx=popupPos[0]-newPos[0];var dy=popupPos[1]-newPos[1];this.map.pan(dx,dy);},onMapMove:function(){this._mapMove=true;this.position();delete this._mapMove;},addAnchorEvents:function(){this.map.events.on({"move":this.onMapMove,scope:this});this.on({"resize":this.position,"collapse":this.position,"expand":this.position,scope:this});},removeAnchorEvents:function(){this.map.events.un({"move":this.onMapMove,scope:this});this.un("resize",this.position,this);this.un("collapse",this.position,this);this.un("expand",this.position,this);},beforeDestroy:function(){if(this.anchored){this.removeAnchorEvents();}
GeoExt.Popup.superclass.beforeDestroy.call(this);}});Ext.reg('gx_popup',GeoExt.Popup);Ext.namespace("geoadmin");geoadmin.TooltipFeature=OpenLayers.Class(OpenLayers.Control.GetFeature,{layer:null,popup:null,api:null,clickTolerance:10,initialize:function(options){options=options||{};OpenLayers.Util.extend(options,{protocol:new OpenLayers.Protocol.HTTP({url:'bodfeature/search',format:new OpenLayers.Format.GeoJSON(),params:{lang:OpenLayers.Lang.getCode()}})});OpenLayers.Control.GetFeature.prototype.initialize.apply(this,[options]);this.api=options.api;this.layer=api.drawLayer;this.single=false;this.hover=false;this.events.on({featureselected:function(evt){this.layer.addFeatures(evt.feature);},featureunselected:function(evt){this.layer.removeFeatures(evt.feature);if(this.popup){this.popup.close();}},scope:this});},getQueryableLayers:function(){var queryable=[];for(var i=0,len=this.map.layers.length;i<len;i++){var layer=this.map.layers[i];if(layer.bodid&&api.layers[layer.bodid]&&api.layers[layer.bodid].queryable===true){queryable.push(layer.bodid);}}
return queryable;},request:function(bounds,options){options=options||{};OpenLayers.Util.extend(this.protocol.params,{layers:this.getQueryableLayers(),scale:parseInt(this.map.getScale())});if(this.protocol.params.layers.length>0){OpenLayers.Control.GetFeature.prototype.request.apply(this,[bounds,options]);this.protocol.params.bbox=bounds;}else{OpenLayers.Element.removeClass(this.map.viewPortDiv,"olCursorWait");}},select:function(features){OpenLayers.Control.GetFeature.prototype.select.apply(this,arguments);this.show(this.features);},setMap:function(map){OpenLayers.Control.GetFeature.prototype.setMap.apply(this,arguments);this.map.addLayer(this.layer);},selectClick:function(evt){OpenLayers.Control.GetFeature.prototype.selectClick.apply(this,arguments);this.clickLonLat=this.map.getLonLatFromPixel(evt.xy);},show:function(features){var items=[],layername;for(var i in features){items.push({html:features[i].attributes.html,fid:i});}
if(this.popup){this.popup.close();}
this.popup=new GeoExt.Popup({protocol:this.protocol,map:this.map,location:this.clickLonLat,unpinnable:false,draggable:true,autoHeight:true,panIn:true,width:450,autoScroll:true,title:OpenLayers.i18n('Feature tooltip'),items:items,tools:[{id:'print',handler:function(event,toolEl,panel){var params=OpenLayers.Util.applyDefaults({print:true},panel.protocol.params);var url=panel.protocol.url;var separator=(url.indexOf('?')>-1)?'&':'?';url+=separator+OpenLayers.Util.getParameterString(params)+"&baseUrl="+cdbund.config.baseUrl;window.open(url,'','width=500, height=400, toolbar=no, location=no,'+'directories=no, status=no, menubar=no, scrollbars=yes,'+'copyhistory=no, resizable=no');}}],toolTemplate:new Ext.XTemplate('<tpl if="id==\'print\'">','<div class="x-tool x-tool-print">',OpenLayers.i18n('print action'),'</div>','</tpl>','<tpl if="id!=\'download\'">','<div class="x-tool x-tool-{id}">&#160;</div>','</tpl>'),listeners:{close:function(w){this.unselectAll();},scope:this}});this.popup.show();},CLASS_NAME:"geoadmin.TooltipFeature"});Proj4js.defs["EPSG:32632"]="+title=UTM 32U +proj=utm +zone=32 +ellps=WGS84 +datum=WGS84 +units=m +no_defs";OpenLayers.Control.PanZoom=OpenLayers.Class(OpenLayers.Control,{slideFactor:50,slideRatio:null,buttons:null,position:null,initialize:function(options){this.position=new OpenLayers.Pixel(OpenLayers.Control.PanZoom.X,OpenLayers.Control.PanZoom.Y);OpenLayers.Control.prototype.initialize.apply(this,arguments);},destroy:function(){if(this.map){this.map.events.unregister("buttonclick",this,this.onButtonClick);}
this.removeButtons();this.buttons=null;this.position=null;OpenLayers.Control.prototype.destroy.apply(this,arguments);},setMap:function(map){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.map.events.register("buttonclick",this,this.onButtonClick);},draw:function(px){OpenLayers.Control.prototype.draw.apply(this,arguments);px=this.position;this.buttons=[];var sz={w:18,h:18};var centered=new OpenLayers.Pixel(px.x+sz.w/2,px.y);this._addButton("panup","north-mini.png",centered,sz);px.y=centered.y+sz.h;this._addButton("panleft","west-mini.png",px,sz);this._addButton("panright","east-mini.png",px.add(sz.w,0),sz);this._addButton("pandown","south-mini.png",centered.add(0,sz.h*2),sz);this._addButton("zoomin","zoom-plus-mini.png",centered.add(0,sz.h*3+5),sz);this._addButton("zoomworld","zoom-world-mini.png",centered.add(0,sz.h*4+5),sz);this._addButton("zoomout","zoom-minus-mini.png",centered.add(0,sz.h*5+5),sz);return this.div;},_addButton:function(id,img,xy,sz){var imgLocation=OpenLayers.Util.getImageLocation(img);var btn=OpenLayers.Util.createAlphaImageDiv(this.id+"_"+id,xy,sz,imgLocation,"absolute");btn.style.cursor="pointer";this.div.appendChild(btn);btn.action=id;btn.className="olButton";this.buttons.push(btn);return btn;},_removeButton:function(btn){this.div.removeChild(btn);OpenLayers.Util.removeItem(this.buttons,btn);},removeButtons:function(){for(var i=this.buttons.length-1;i>=0;--i){this._removeButton(this.buttons[i]);}},onButtonClick:function(evt){var btn=evt.buttonElement;switch(btn.action){case"panup":this.map.pan(0,-this.getSlideFactor("h"));break;case"pandown":this.map.pan(0,this.getSlideFactor("h"));break;case"panleft":this.map.pan(-this.getSlideFactor("w"),0);break;case"panright":this.map.pan(this.getSlideFactor("w"),0);break;case"zoomin":this.map.zoomIn();break;case"zoomout":this.map.zoomOut();break;case"zoomworld":this.map.zoomToMaxExtent();break;}},getSlideFactor:function(dim){return this.slideRatio?this.map.getSize()[dim]*this.slideRatio:this.slideFactor;},CLASS_NAME:"OpenLayers.Control.PanZoom"});OpenLayers.Control.PanZoom.X=4;OpenLayers.Control.PanZoom.Y=4;OpenLayers.Control.PanZoomBar=OpenLayers.Class(OpenLayers.Control.PanZoom,{zoomStopWidth:18,zoomStopHeight:11,slider:null,sliderEvents:null,zoombarDiv:null,zoomWorldIcon:false,panIcons:true,forceFixedZoomLevel:false,mouseDragStart:null,deltaY:null,zoomStart:null,destroy:function(){this._removeZoomBar();this.map.events.un({"changebaselayer":this.redraw,scope:this});OpenLayers.Control.PanZoom.prototype.destroy.apply(this,arguments);delete this.mouseDragStart;delete this.zoomStart;},setMap:function(map){OpenLayers.Control.PanZoom.prototype.setMap.apply(this,arguments);this.map.events.register("changebaselayer",this,this.redraw);},redraw:function(){if(this.div!=null){this.removeButtons();this._removeZoomBar();}
this.draw();},draw:function(px){OpenLayers.Control.prototype.draw.apply(this,arguments);px=this.position.clone();this.buttons=[];var sz={w:18,h:18};if(this.panIcons){var centered=new OpenLayers.Pixel(px.x+sz.w/2,px.y);var wposition=sz.w;if(this.zoomWorldIcon){centered=new OpenLayers.Pixel(px.x+sz.w,px.y);}
this._addButton("panup","north-mini.png",centered,sz);px.y=centered.y+sz.h;this._addButton("panleft","west-mini.png",px,sz);if(this.zoomWorldIcon){this._addButton("zoomworld","zoom-world-mini.png",px.add(sz.w,0),sz);wposition*=2;}
this._addButton("panright","east-mini.png",px.add(wposition,0),sz);this._addButton("pandown","south-mini.png",centered.add(0,sz.h*2),sz);this._addButton("zoomin","zoom-plus-mini.png",centered.add(0,sz.h*3+5),sz);centered=this._addZoomBar(centered.add(0,sz.h*4+5));this._addButton("zoomout","zoom-minus-mini.png",centered,sz);}
else{this._addButton("zoomin","zoom-plus-mini.png",px,sz);centered=this._addZoomBar(px.add(0,sz.h));this._addButton("zoomout","zoom-minus-mini.png",centered,sz);if(this.zoomWorldIcon){centered=centered.add(0,sz.h+3);this._addButton("zoomworld","zoom-world-mini.png",centered,sz);}}
return this.div;},_addZoomBar:function(centered){var imgLocation=OpenLayers.Util.getImageLocation("slider.png");var id=this.id+"_"+this.map.id;var zoomsToEnd=this.map.getNumZoomLevels()-1-this.map.getZoom();var slider=OpenLayers.Util.createAlphaImageDiv(id,centered.add(-1,zoomsToEnd*this.zoomStopHeight),{w:20,h:9},imgLocation,"absolute");slider.style.cursor="move";this.slider=slider;this.sliderEvents=new OpenLayers.Events(this,slider,null,true,{includeXY:true});this.sliderEvents.on({"touchstart":this.zoomBarDown,"touchmove":this.zoomBarDrag,"touchend":this.zoomBarUp,"mousedown":this.zoomBarDown,"mousemove":this.zoomBarDrag,"mouseup":this.zoomBarUp});var sz={w:this.zoomStopWidth,h:this.zoomStopHeight*this.map.getNumZoomLevels()};var imgLocation=OpenLayers.Util.getImageLocation("zoombar.png");var div=null;if(OpenLayers.Util.alphaHack()){var id=this.id+"_"+this.map.id;div=OpenLayers.Util.createAlphaImageDiv(id,centered,{w:sz.w,h:this.zoomStopHeight},imgLocation,"absolute",null,"crop");div.style.height=sz.h+"px";}else{div=OpenLayers.Util.createDiv('OpenLayers_Control_PanZoomBar_Zoombar'+this.map.id,centered,sz,imgLocation);}
div.style.cursor="pointer";div.className="olButton";this.zoombarDiv=div;this.div.appendChild(div);this.startTop=parseInt(div.style.top);this.div.appendChild(slider);this.map.events.register("zoomend",this,this.moveZoomBar);centered=centered.add(0,this.zoomStopHeight*this.map.getNumZoomLevels());return centered;},_removeZoomBar:function(){this.sliderEvents.un({"touchstart":this.zoomBarDown,"touchmove":this.zoomBarDrag,"touchend":this.zoomBarUp,"mousedown":this.zoomBarDown,"mousemove":this.zoomBarDrag,"mouseup":this.zoomBarUp});this.sliderEvents.destroy();this.div.removeChild(this.zoombarDiv);this.zoombarDiv=null;this.div.removeChild(this.slider);this.slider=null;this.map.events.unregister("zoomend",this,this.moveZoomBar);},onButtonClick:function(evt){OpenLayers.Control.PanZoom.prototype.onButtonClick.apply(this,arguments);if(evt.buttonElement===this.zoombarDiv){var levels=evt.buttonXY.y/this.zoomStopHeight;if(this.forceFixedZoomLevel||!this.map.fractionalZoom){levels=Math.floor(levels);}
var zoom=(this.map.getNumZoomLevels()-1)-levels;zoom=Math.min(Math.max(zoom,0),this.map.getNumZoomLevels()-1);this.map.zoomTo(zoom);}},passEventToSlider:function(evt){this.sliderEvents.handleBrowserEvent(evt);},zoomBarDown:function(evt){if(!OpenLayers.Event.isLeftClick(evt)&&!OpenLayers.Event.isSingleTouch(evt)){return;}
this.map.events.on({"touchmove":this.passEventToSlider,"mousemove":this.passEventToSlider,"mouseup":this.passEventToSlider,scope:this});this.mouseDragStart=evt.xy.clone();this.zoomStart=evt.xy.clone();this.div.style.cursor="move";this.zoombarDiv.offsets=null;OpenLayers.Event.stop(evt);},zoomBarDrag:function(evt){if(this.mouseDragStart!=null){var deltaY=this.mouseDragStart.y-evt.xy.y;var offsets=OpenLayers.Util.pagePosition(this.zoombarDiv);if((evt.clientY-offsets[1])>0&&(evt.clientY-offsets[1])<parseInt(this.zoombarDiv.style.height)-2){var newTop=parseInt(this.slider.style.top)-deltaY;this.slider.style.top=newTop+"px";this.mouseDragStart=evt.xy.clone();}
this.deltaY=this.zoomStart.y-evt.xy.y;OpenLayers.Event.stop(evt);}},zoomBarUp:function(evt){if(!OpenLayers.Event.isLeftClick(evt)&&evt.type!=="touchend"){return;}
if(this.mouseDragStart){this.div.style.cursor="";this.map.events.un({"touchmove":this.passEventToSlider,"mouseup":this.passEventToSlider,"mousemove":this.passEventToSlider,scope:this});var zoomLevel=this.map.zoom;if(!this.forceFixedZoomLevel&&this.map.fractionalZoom){zoomLevel+=this.deltaY/this.zoomStopHeight;zoomLevel=Math.min(Math.max(zoomLevel,0),this.map.getNumZoomLevels()-1);}else{zoomLevel+=this.deltaY/this.zoomStopHeight;zoomLevel=Math.max(Math.round(zoomLevel),0);}
this.map.zoomTo(zoomLevel);this.mouseDragStart=null;this.zoomStart=null;this.deltaY=0;OpenLayers.Event.stop(evt);}},moveZoomBar:function(){var newTop=((this.map.getNumZoomLevels()-1)-this.map.getZoom())*this.zoomStopHeight+this.startTop+1;this.slider.style.top=newTop+"px";},CLASS_NAME:"OpenLayers.Control.PanZoomBar"});var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return}f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return}if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return}}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return}var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return}var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return}AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();OpenLayers.Control.DrawFeature=OpenLayers.Class(OpenLayers.Control,{layer:null,callbacks:null,multi:false,featureAdded:function(){},handlerOptions:null,initialize:function(layer,handler,options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.callbacks=OpenLayers.Util.extend({done:this.drawFeature,modify:function(vertex,feature){this.layer.events.triggerEvent("sketchmodified",{vertex:vertex,feature:feature});},create:function(vertex,feature){this.layer.events.triggerEvent("sketchstarted",{vertex:vertex,feature:feature});}},this.callbacks);this.layer=layer;this.handlerOptions=this.handlerOptions||{};this.handlerOptions.layerOptions=OpenLayers.Util.applyDefaults(this.handlerOptions.layerOptions,{renderers:layer.renderers,rendererOptions:layer.rendererOptions});if(!("multi"in this.handlerOptions)){this.handlerOptions.multi=this.multi;}
var sketchStyle=this.layer.styleMap&&this.layer.styleMap.styles.temporary;if(sketchStyle){this.handlerOptions.layerOptions=OpenLayers.Util.applyDefaults(this.handlerOptions.layerOptions,{styleMap:new OpenLayers.StyleMap({"default":sketchStyle})});}
this.handler=new handler(this,this.callbacks,this.handlerOptions);},drawFeature:function(geometry){var feature=new OpenLayers.Feature.Vector(geometry);var proceed=this.layer.events.triggerEvent("sketchcomplete",{feature:feature});if(proceed!==false){feature.state=OpenLayers.State.INSERT;this.layer.addFeatures([feature]);this.featureAdded(feature);this.events.triggerEvent("featureadded",{feature:feature});}},insertXY:function(x,y){if(this.handler&&this.handler.line){this.handler.insertXY(x,y);}},insertDeltaXY:function(dx,dy){if(this.handler&&this.handler.line){this.handler.insertDeltaXY(dx,dy);}},insertDirectionLength:function(direction,length){if(this.handler&&this.handler.line){this.handler.insertDirectionLength(direction,length);}},insertDeflectionLength:function(deflection,length){if(this.handler&&this.handler.line){this.handler.insertDeflectionLength(deflection,length);}},undo:function(){return this.handler.undo&&this.handler.undo();},redo:function(){return this.handler.redo&&this.handler.redo();},finishSketch:function(){this.handler.finishGeometry();},cancel:function(){this.handler.cancel();},CLASS_NAME:"OpenLayers.Control.DrawFeature"});OpenLayers.Control.Button=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){},CLASS_NAME:"OpenLayers.Control.Button"});OpenLayers.Control.NavigationHistory=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOGGLE,previous:null,previousOptions:null,next:null,nextOptions:null,limit:50,autoActivate:true,clearOnDeactivate:false,registry:null,nextStack:null,previousStack:null,listeners:null,restoring:false,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.registry=OpenLayers.Util.extend({"moveend":this.getState},this.registry);var previousOptions={trigger:OpenLayers.Function.bind(this.previousTrigger,this),displayClass:this.displayClass+" "+this.displayClass+"Previous"};OpenLayers.Util.extend(previousOptions,this.previousOptions);this.previous=new OpenLayers.Control.Button(previousOptions);var nextOptions={trigger:OpenLayers.Function.bind(this.nextTrigger,this),displayClass:this.displayClass+" "+this.displayClass+"Next"};OpenLayers.Util.extend(nextOptions,this.nextOptions);this.next=new OpenLayers.Control.Button(nextOptions);this.clear();},onPreviousChange:function(state,length){if(state&&!this.previous.active){this.previous.activate();}else if(!state&&this.previous.active){this.previous.deactivate();}},onNextChange:function(state,length){if(state&&!this.next.active){this.next.activate();}else if(!state&&this.next.active){this.next.deactivate();}},destroy:function(){OpenLayers.Control.prototype.destroy.apply(this);this.previous.destroy();this.next.destroy();this.deactivate();for(var prop in this){this[prop]=null;}},setMap:function(map){this.map=map;this.next.setMap(map);this.previous.setMap(map);},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.next.draw();this.previous.draw();},previousTrigger:function(){var current=this.previousStack.shift();var state=this.previousStack.shift();if(state!=undefined){this.nextStack.unshift(current);this.previousStack.unshift(state);this.restoring=true;this.restore(state);this.restoring=false;this.onNextChange(this.nextStack[0],this.nextStack.length);this.onPreviousChange(this.previousStack[1],this.previousStack.length-1);}else{this.previousStack.unshift(current);}
return state;},nextTrigger:function(){var state=this.nextStack.shift();if(state!=undefined){this.previousStack.unshift(state);this.restoring=true;this.restore(state);this.restoring=false;this.onNextChange(this.nextStack[0],this.nextStack.length);this.onPreviousChange(this.previousStack[1],this.previousStack.length-1);}
return state;},clear:function(){this.previousStack=[];this.previous.deactivate();this.nextStack=[];this.next.deactivate();},getState:function(){return{center:this.map.getCenter(),resolution:this.map.getResolution(),projection:this.map.getProjectionObject(),units:this.map.getProjectionObject().getUnits()||this.map.units||this.map.baseLayer.units};},restore:function(state){var center,zoom;if(this.map.getProjectionObject()==state.projection){zoom=this.map.getZoomForResolution(state.resolution);center=state.center;}else{center=state.center.clone();center.transform(state.projection,this.map.getProjectionObject());var sourceUnits=state.units;var targetUnits=this.map.getProjectionObject().getUnits()||this.map.units||this.map.baseLayer.units;var resolutionFactor=sourceUnits&&targetUnits?OpenLayers.INCHES_PER_UNIT[sourceUnits]/OpenLayers.INCHES_PER_UNIT[targetUnits]:1;zoom=this.map.getZoomForResolution(resolutionFactor*state.resolution);}
this.map.setCenter(center,zoom);},setListeners:function(){this.listeners={};for(var type in this.registry){this.listeners[type]=OpenLayers.Function.bind(function(){if(!this.restoring){var state=this.registry[type].apply(this,arguments);this.previousStack.unshift(state);if(this.previousStack.length>1){this.onPreviousChange(this.previousStack[1],this.previousStack.length-1);}
if(this.previousStack.length>(this.limit+1)){this.previousStack.pop();}
if(this.nextStack.length>0){this.nextStack=[];this.onNextChange(null,0);}}
return true;},this);}},activate:function(){var activated=false;if(this.map){if(OpenLayers.Control.prototype.activate.apply(this)){if(this.listeners==null){this.setListeners();}
for(var type in this.listeners){this.map.events.register(type,this,this.listeners[type]);}
activated=true;if(this.previousStack.length==0){this.initStack();}}}
return activated;},initStack:function(){if(this.map.getCenter()){this.listeners.moveend();}},deactivate:function(){var deactivated=false;if(this.map){if(OpenLayers.Control.prototype.deactivate.apply(this)){for(var type in this.listeners){this.map.events.unregister(type,this,this.listeners[type]);}
if(this.clearOnDeactivate){this.clear();}
deactivated=true;}}
return deactivated;},CLASS_NAME:"OpenLayers.Control.NavigationHistory"});OpenLayers.Handler.Feature=OpenLayers.Class(OpenLayers.Handler,{EVENTMAP:{'click':{'in':'click','out':'clickout'},'mousemove':{'in':'over','out':'out'},'dblclick':{'in':'dblclick','out':null},'mousedown':{'in':null,'out':null},'mouseup':{'in':null,'out':null},'touchstart':{'in':'click','out':'clickout'}},feature:null,lastFeature:null,down:null,up:null,touch:false,clickTolerance:4,geometryTypes:null,stopClick:true,stopDown:true,stopUp:false,initialize:function(control,layer,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,[control,callbacks,options]);this.layer=layer;},touchstart:function(evt){if(!this.touch){this.touch=true;this.map.events.un({mousedown:this.mousedown,mouseup:this.mouseup,mousemove:this.mousemove,click:this.click,dblclick:this.dblclick,scope:this});}
return OpenLayers.Event.isMultiTouch(evt)?true:this.mousedown(evt);},touchmove:function(evt){OpenLayers.Event.stop(evt);},mousedown:function(evt){if(OpenLayers.Event.isLeftClick(evt)||OpenLayers.Event.isSingleTouch(evt)){this.down=evt.xy;}
return this.handle(evt)?!this.stopDown:true;},mouseup:function(evt){this.up=evt.xy;return this.handle(evt)?!this.stopUp:true;},click:function(evt){return this.handle(evt)?!this.stopClick:true;},mousemove:function(evt){if(!this.callbacks['over']&&!this.callbacks['out']){return true;}
this.handle(evt);return true;},dblclick:function(evt){return!this.handle(evt);},geometryTypeMatches:function(feature){return this.geometryTypes==null||OpenLayers.Util.indexOf(this.geometryTypes,feature.geometry.CLASS_NAME)>-1;},handle:function(evt){if(this.feature&&!this.feature.layer){this.feature=null;}
var type=evt.type;var handled=false;var previouslyIn=!!(this.feature);var click=(type=="click"||type=="dblclick"||type=="touchstart");this.feature=this.layer.getFeatureFromEvent(evt);if(this.feature&&!this.feature.layer){this.feature=null;}
if(this.lastFeature&&!this.lastFeature.layer){this.lastFeature=null;}
if(this.feature){if(type==="touchstart"){OpenLayers.Event.stop(evt);}
var inNew=(this.feature!=this.lastFeature);if(this.geometryTypeMatches(this.feature)){if(previouslyIn&&inNew){if(this.lastFeature){this.triggerCallback(type,'out',[this.lastFeature]);}
this.triggerCallback(type,'in',[this.feature]);}else if(!previouslyIn||click){this.triggerCallback(type,'in',[this.feature]);}
this.lastFeature=this.feature;handled=true;}else{if(this.lastFeature&&(previouslyIn&&inNew||click)){this.triggerCallback(type,'out',[this.lastFeature]);}
this.feature=null;}}else{if(this.lastFeature&&(previouslyIn||click)){this.triggerCallback(type,'out',[this.lastFeature]);}}
return handled;},triggerCallback:function(type,mode,args){var key=this.EVENTMAP[type][mode];if(key){if(type=='click'&&this.up&&this.down){var dpx=Math.sqrt(Math.pow(this.up.x-this.down.x,2)+
Math.pow(this.up.y-this.down.y,2));if(dpx<=this.clickTolerance){this.callback(key,args);}}else{this.callback(key,args);}}},activate:function(){var activated=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.moveLayerToTop();this.map.events.on({"removelayer":this.handleMapEvents,"changelayer":this.handleMapEvents,scope:this});activated=true;}
return activated;},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.moveLayerBack();this.feature=null;this.lastFeature=null;this.down=null;this.up=null;this.touch=false;this.map.events.un({"removelayer":this.handleMapEvents,"changelayer":this.handleMapEvents,scope:this});deactivated=true;}
return deactivated;},handleMapEvents:function(evt){if(evt.type=="removelayer"||evt.property=="order"){this.moveLayerToTop();}},moveLayerToTop:function(){var index=Math.max(this.map.Z_INDEX_BASE['Feature']-1,this.layer.getZIndex())+1;this.layer.setZIndex(index);},moveLayerBack:function(){var index=this.layer.getZIndex()-1;if(index>=this.map.Z_INDEX_BASE['Feature']){this.layer.setZIndex(index);}else{this.map.setLayerZIndex(this.layer,this.map.getLayerIndex(this.layer));}},CLASS_NAME:"OpenLayers.Handler.Feature"});OpenLayers.Animation=(function(window){var requestFrame=(function(){var request=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(callback,element){window.setTimeout(callback,16);};return function(callback,element){request.apply(window,[callback,element]);};})();var counter=0;var loops={};function start(callback,duration,element){duration=duration>0?duration:Number.POSITIVE_INFINITY;var id=++counter;var start=+new Date;loops[id]=function(){if(loops[id]&&+new Date-start<=duration){callback();if(loops[id]){requestFrame(loops[id],element);}}else{delete loops[id];}}
requestFrame(loops[id],element);return id;}
function stop(id){delete loops[id];}
return{requestFrame:requestFrame,start:start,stop:stop};})(window);OpenLayers.Tween=OpenLayers.Class({easing:null,begin:null,finish:null,duration:null,callbacks:null,time:null,animationId:null,playing:false,initialize:function(easing){this.easing=(easing)?easing:OpenLayers.Easing.Expo.easeOut;},start:function(begin,finish,duration,options){this.playing=true;this.begin=begin;this.finish=finish;this.duration=duration;this.callbacks=options.callbacks;this.time=0;OpenLayers.Animation.stop(this.animationId);this.animationId=null;if(this.callbacks&&this.callbacks.start){this.callbacks.start.call(this,this.begin);}
this.animationId=OpenLayers.Animation.start(OpenLayers.Function.bind(this.play,this));},stop:function(){if(!this.playing){return;}
if(this.callbacks&&this.callbacks.done){this.callbacks.done.call(this,this.finish);}
OpenLayers.Animation.stop(this.animationId);this.animationId=null;this.playing=false;},play:function(){var value={};for(var i in this.begin){var b=this.begin[i];var f=this.finish[i];if(b==null||f==null||isNaN(b)||isNaN(f)){throw new TypeError('invalid value for Tween');}
var c=f-b;value[i]=this.easing.apply(this,[this.time,b,c,this.duration]);}
this.time++;if(this.callbacks&&this.callbacks.eachStep){this.callbacks.eachStep.call(this,value);}
if(this.time>this.duration){this.stop();}},CLASS_NAME:"OpenLayers.Tween"});OpenLayers.Easing={CLASS_NAME:"OpenLayers.Easing"};OpenLayers.Easing.Linear={easeIn:function(t,b,c,d){return c*t/d+b;},easeOut:function(t,b,c,d){return c*t/d+b;},easeInOut:function(t,b,c,d){return c*t/d+b;},CLASS_NAME:"OpenLayers.Easing.Linear"};OpenLayers.Easing.Expo={easeIn:function(t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b;},easeOut:function(t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b;},easeInOut:function(t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b;},CLASS_NAME:"OpenLayers.Easing.Expo"};OpenLayers.Easing.Quad={easeIn:function(t,b,c,d){return c*(t/=d)*t+b;},easeOut:function(t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeInOut:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;},CLASS_NAME:"OpenLayers.Easing.Quad"};OpenLayers.Map=OpenLayers.Class({Z_INDEX_BASE:{BaseLayer:100,Overlay:325,Feature:725,Popup:750,Control:1000},id:null,fractionalZoom:false,events:null,allOverlays:false,div:null,dragging:false,size:null,viewPortDiv:null,layerContainerOrigin:null,layerContainerDiv:null,layers:null,controls:null,popups:null,baseLayer:null,center:null,resolution:null,zoom:0,panRatio:1.5,tileSize:null,projection:"EPSG:4326",units:'degrees',resolutions:null,maxResolution:1.40625,minResolution:null,maxScale:null,minScale:null,maxExtent:null,minExtent:null,restrictedExtent:null,numZoomLevels:16,theme:null,displayProjection:null,fallThrough:true,panTween:null,eventListeners:null,panMethod:OpenLayers.Easing.Expo.easeOut,panDuration:50,paddingForPopups:null,minPx:null,maxPx:null,initialize:function(div,options){if(arguments.length===1&&typeof div==="object"){options=div;div=options&&options.div;}
this.tileSize=new OpenLayers.Size(OpenLayers.Map.TILE_WIDTH,OpenLayers.Map.TILE_HEIGHT);this.maxExtent=new OpenLayers.Bounds(-180,-90,180,90);this.paddingForPopups=new OpenLayers.Bounds(15,15,15,15);this.theme=OpenLayers._getScriptLocation()+'theme/default/style.css';OpenLayers.Util.extend(this,options);if(this.maxExtent&&!(this.maxExtent instanceof OpenLayers.Bounds)){this.maxExtent=new OpenLayers.Bounds(this.maxExtent);}
if(this.restrictedExtent&&!(this.restrictedExtent instanceof OpenLayers.Bounds)){this.restrictedExtent=new OpenLayers.Bounds(this.restrictedExtent);}
this.layers=[];this.id=OpenLayers.Util.createUniqueID("OpenLayers.Map_");this.div=OpenLayers.Util.getElement(div);if(!this.div){this.div=document.createElement("div");this.div.style.height="1px";this.div.style.width="1px";}
OpenLayers.Element.addClass(this.div,'olMap');var id=this.id+"_OpenLayers_ViewPort";this.viewPortDiv=OpenLayers.Util.createDiv(id,null,null,null,"relative",null,"hidden");this.viewPortDiv.style.width="100%";this.viewPortDiv.style.height="100%";this.viewPortDiv.className="olMapViewport";this.div.appendChild(this.viewPortDiv);this.events=new OpenLayers.Events(this,this.viewPortDiv,null,this.fallThrough,{includeXY:true});id=this.id+"_OpenLayers_Container";this.layerContainerDiv=OpenLayers.Util.createDiv(id);this.layerContainerDiv.style.width='100px';this.layerContainerDiv.style.height='100px';this.layerContainerDiv.style.zIndex=this.Z_INDEX_BASE['Popup']-1;this.viewPortDiv.appendChild(this.layerContainerDiv);this.updateSize();if(this.eventListeners instanceof Object){this.events.on(this.eventListeners);}
if(OpenLayers.String.contains(navigator.appName,"Microsoft")){this.events.register("resize",this,this.updateSize);}else{this.updateSizeDestroy=OpenLayers.Function.bind(this.updateSize,this);OpenLayers.Event.observe(window,'resize',this.updateSizeDestroy);}
if(this.theme){var addNode=true;var nodes=document.getElementsByTagName('link');for(var i=0,len=nodes.length;i<len;++i){if(OpenLayers.Util.isEquivalentUrl(nodes.item(i).href,this.theme)){addNode=false;break;}}
if(addNode){var cssNode=document.createElement('link');cssNode.setAttribute('rel','stylesheet');cssNode.setAttribute('type','text/css');cssNode.setAttribute('href',this.theme);document.getElementsByTagName('head')[0].appendChild(cssNode);}}
if(this.controls==null){if(OpenLayers.Control!=null){this.controls=[new OpenLayers.Control.Navigation(),new OpenLayers.Control.PanZoom(),new OpenLayers.Control.ArgParser(),new OpenLayers.Control.Attribution()];}else{this.controls=[];}}
for(var i=0,len=this.controls.length;i<len;i++){this.addControlToMap(this.controls[i]);}
this.popups=[];this.unloadDestroy=OpenLayers.Function.bind(this.destroy,this);OpenLayers.Event.observe(window,'unload',this.unloadDestroy);if(options&&options.layers){delete this.center;this.addLayers(options.layers);if(options.center){this.setCenter(options.center,options.zoom);}}},render:function(div){this.div=OpenLayers.Util.getElement(div);OpenLayers.Element.addClass(this.div,'olMap');this.viewPortDiv.parentNode.removeChild(this.viewPortDiv);this.div.appendChild(this.viewPortDiv);this.updateSize();},unloadDestroy:null,updateSizeDestroy:null,destroy:function(){if(!this.unloadDestroy){return false;}
if(this.panTween){this.panTween.stop();this.panTween=null;}
OpenLayers.Event.stopObserving(window,'unload',this.unloadDestroy);this.unloadDestroy=null;if(this.updateSizeDestroy){OpenLayers.Event.stopObserving(window,'resize',this.updateSizeDestroy);}else{this.events.unregister("resize",this,this.updateSize);}
this.paddingForPopups=null;if(this.controls!=null){for(var i=this.controls.length-1;i>=0;--i){this.controls[i].destroy();}
this.controls=null;}
if(this.layers!=null){for(var i=this.layers.length-1;i>=0;--i){this.layers[i].destroy(false);}
this.layers=null;}
if(this.viewPortDiv){this.div.removeChild(this.viewPortDiv);}
this.viewPortDiv=null;if(this.eventListeners){this.events.un(this.eventListeners);this.eventListeners=null;}
this.events.destroy();this.events=null;},setOptions:function(options){var updatePxExtent=this.minPx&&options.restrictedExtent!=this.restrictedExtent;OpenLayers.Util.extend(this,options);updatePxExtent&&this.moveTo(this.getCachedCenter(),this.zoom,{forceZoomChange:true});},getTileSize:function(){return this.tileSize;},getBy:function(array,property,match){var test=(typeof match.test=="function");var found=OpenLayers.Array.filter(this[array],function(item){return item[property]==match||(test&&match.test(item[property]));});return found;},getLayersBy:function(property,match){return this.getBy("layers",property,match);},getLayersByName:function(match){return this.getLayersBy("name",match);},getLayersByClass:function(match){return this.getLayersBy("CLASS_NAME",match);},getControlsBy:function(property,match){return this.getBy("controls",property,match);},getControlsByClass:function(match){return this.getControlsBy("CLASS_NAME",match);},getLayer:function(id){var foundLayer=null;for(var i=0,len=this.layers.length;i<len;i++){var layer=this.layers[i];if(layer.id==id){foundLayer=layer;break;}}
return foundLayer;},setLayerZIndex:function(layer,zIdx){layer.setZIndex(this.Z_INDEX_BASE[layer.isBaseLayer?'BaseLayer':'Overlay']
+zIdx*5);},resetLayersZIndex:function(){for(var i=0,len=this.layers.length;i<len;i++){var layer=this.layers[i];this.setLayerZIndex(layer,i);}},addLayer:function(layer){for(var i=0,len=this.layers.length;i<len;i++){if(this.layers[i]==layer){return false;}}
if(this.events.triggerEvent("preaddlayer",{layer:layer})===false){return false;}
if(this.allOverlays){layer.isBaseLayer=false;}
layer.div.className="olLayerDiv";layer.div.style.overflow="";this.setLayerZIndex(layer,this.layers.length);if(layer.isFixed){this.viewPortDiv.appendChild(layer.div);}else{this.layerContainerDiv.appendChild(layer.div);}
this.layers.push(layer);layer.setMap(this);if(layer.isBaseLayer||(this.allOverlays&&!this.baseLayer)){if(this.baseLayer==null){this.setBaseLayer(layer);}else{layer.setVisibility(false);}}else{layer.redraw();}
this.events.triggerEvent("addlayer",{layer:layer});layer.events.triggerEvent("added",{map:this,layer:layer});layer.afterAdd();return true;},addLayers:function(layers){for(var i=0,len=layers.length;i<len;i++){this.addLayer(layers[i]);}},removeLayer:function(layer,setNewBaseLayer){if(this.events.triggerEvent("preremovelayer",{layer:layer})===false){return;}
if(setNewBaseLayer==null){setNewBaseLayer=true;}
if(layer.isFixed){this.viewPortDiv.removeChild(layer.div);}else{this.layerContainerDiv.removeChild(layer.div);}
OpenLayers.Util.removeItem(this.layers,layer);layer.removeMap(this);layer.map=null;if(this.baseLayer==layer){this.baseLayer=null;if(setNewBaseLayer){for(var i=0,len=this.layers.length;i<len;i++){var iLayer=this.layers[i];if(iLayer.isBaseLayer||this.allOverlays){this.setBaseLayer(iLayer);break;}}}}
this.resetLayersZIndex();this.events.triggerEvent("removelayer",{layer:layer});layer.events.triggerEvent("removed",{map:this,layer:layer});},getNumLayers:function(){return this.layers.length;},getLayerIndex:function(layer){return OpenLayers.Util.indexOf(this.layers,layer);},setLayerIndex:function(layer,idx){var base=this.getLayerIndex(layer);if(idx<0){idx=0;}else if(idx>this.layers.length){idx=this.layers.length;}
if(base!=idx){this.layers.splice(base,1);this.layers.splice(idx,0,layer);for(var i=0,len=this.layers.length;i<len;i++){this.setLayerZIndex(this.layers[i],i);}
this.events.triggerEvent("changelayer",{layer:layer,property:"order"});if(this.allOverlays){if(idx===0){this.setBaseLayer(layer);}else if(this.baseLayer!==this.layers[0]){this.setBaseLayer(this.layers[0]);}}}},raiseLayer:function(layer,delta){var idx=this.getLayerIndex(layer)+delta;this.setLayerIndex(layer,idx);},setBaseLayer:function(newBaseLayer){if(newBaseLayer!=this.baseLayer){if(OpenLayers.Util.indexOf(this.layers,newBaseLayer)!=-1){var center=this.getCachedCenter();var newResolution=OpenLayers.Util.getResolutionFromScale(this.getScale(),newBaseLayer.units);if(this.baseLayer!=null&&!this.allOverlays){this.baseLayer.setVisibility(false);}
this.baseLayer=newBaseLayer;if(!this.allOverlays||this.baseLayer.visibility){this.baseLayer.setVisibility(true);if(this.baseLayer.inRange===false){this.baseLayer.redraw();}}
if(center!=null){var newZoom=this.getZoomForResolution(newResolution||this.resolution,true);this.setCenter(center,newZoom,false,true);}
this.events.triggerEvent("changebaselayer",{layer:this.baseLayer});}}},addControl:function(control,px){this.controls.push(control);this.addControlToMap(control,px);},addControls:function(controls,pixels){var pxs=(arguments.length===1)?[]:pixels;for(var i=0,len=controls.length;i<len;i++){var ctrl=controls[i];var px=(pxs[i])?pxs[i]:null;this.addControl(ctrl,px);}},addControlToMap:function(control,px){control.outsideViewport=(control.div!=null);if(this.displayProjection&&!control.displayProjection){control.displayProjection=this.displayProjection;}
control.setMap(this);var div=control.draw(px);if(div){if(!control.outsideViewport){div.style.zIndex=this.Z_INDEX_BASE['Control']+
this.controls.length;this.viewPortDiv.appendChild(div);}}
if(control.autoActivate){control.activate();}},getControl:function(id){var returnControl=null;for(var i=0,len=this.controls.length;i<len;i++){var control=this.controls[i];if(control.id==id){returnControl=control;break;}}
return returnControl;},removeControl:function(control){if((control)&&(control==this.getControl(control.id))){if(control.div&&(control.div.parentNode==this.viewPortDiv)){this.viewPortDiv.removeChild(control.div);}
OpenLayers.Util.removeItem(this.controls,control);}},addPopup:function(popup,exclusive){if(exclusive){for(var i=this.popups.length-1;i>=0;--i){this.removePopup(this.popups[i]);}}
popup.map=this;this.popups.push(popup);var popupDiv=popup.draw();if(popupDiv){popupDiv.style.zIndex=this.Z_INDEX_BASE['Popup']+
this.popups.length;this.layerContainerDiv.appendChild(popupDiv);}},removePopup:function(popup){OpenLayers.Util.removeItem(this.popups,popup);if(popup.div){try{this.layerContainerDiv.removeChild(popup.div);}
catch(e){}}
popup.map=null;},getSize:function(){var size=null;if(this.size!=null){size=this.size.clone();}
return size;},updateSize:function(){var newSize=this.getCurrentSize();if(newSize&&!isNaN(newSize.h)&&!isNaN(newSize.w)){this.events.clearMouseCache();var oldSize=this.getSize();if(oldSize==null){this.size=oldSize=newSize;}
if(!newSize.equals(oldSize)){this.size=newSize;for(var i=0,len=this.layers.length;i<len;i++){this.layers[i].onMapResize();}
var center=this.getCachedCenter();if(this.baseLayer!=null&&center!=null){var zoom=this.getZoom();this.zoom=null;this.setCenter(center,zoom);}}}},getCurrentSize:function(){var size=new OpenLayers.Size(this.div.clientWidth,this.div.clientHeight);if(size.w==0&&size.h==0||isNaN(size.w)&&isNaN(size.h)){size.w=this.div.offsetWidth;size.h=this.div.offsetHeight;}
if(size.w==0&&size.h==0||isNaN(size.w)&&isNaN(size.h)){size.w=parseInt(this.div.style.width);size.h=parseInt(this.div.style.height);}
return size;},calculateBounds:function(center,resolution){var extent=null;if(center==null){center=this.getCachedCenter();}
if(resolution==null){resolution=this.getResolution();}
if((center!=null)&&(resolution!=null)){var halfWDeg=(this.size.w*resolution)/2;var halfHDeg=(this.size.h*resolution)/2;extent=new OpenLayers.Bounds(center.lon-halfWDeg,center.lat-halfHDeg,center.lon+halfWDeg,center.lat+halfHDeg);}
return extent;},getCenter:function(){var center=null;var cachedCenter=this.getCachedCenter();if(cachedCenter){center=cachedCenter.clone();}
return center;},getCachedCenter:function(){if(!this.center&&this.size){this.center=this.getLonLatFromViewPortPx({x:this.size.w/2,y:this.size.h/2});}
return this.center;},getZoom:function(){return this.zoom;},pan:function(dx,dy,options){options=OpenLayers.Util.applyDefaults(options,{animate:true,dragging:false});if(options.dragging){if(dx!=0||dy!=0){this.moveByPx(dx,dy);}}else{var centerPx=this.getViewPortPxFromLonLat(this.getCachedCenter());var newCenterPx=centerPx.add(dx,dy);if(this.dragging||!newCenterPx.equals(centerPx)){var newCenterLonLat=this.getLonLatFromViewPortPx(newCenterPx);if(options.animate){this.panTo(newCenterLonLat);}else{this.moveTo(newCenterLonLat);this.dragging=false;this.events.triggerEvent("moveend");}}}},panTo:function(lonlat){if(this.panMethod&&this.getExtent().scale(this.panRatio).containsLonLat(lonlat)){if(!this.panTween){this.panTween=new OpenLayers.Tween(this.panMethod);}
var center=this.getCachedCenter();if(lonlat.equals(center)){return;}
var from=this.getPixelFromLonLat(center);var to=this.getPixelFromLonLat(lonlat);var vector={x:to.x-from.x,y:to.y-from.y};var last={x:0,y:0};this.panTween.start({x:0,y:0},vector,this.panDuration,{callbacks:{eachStep:OpenLayers.Function.bind(function(px){var x=px.x-last.x,y=px.y-last.y;this.moveByPx(x,y);last.x=Math.round(px.x);last.y=Math.round(px.y);},this),done:OpenLayers.Function.bind(function(px){this.moveTo(lonlat);this.dragging=false;this.events.triggerEvent("moveend");},this)}});}else{this.setCenter(lonlat);}},setCenter:function(lonlat,zoom,dragging,forceZoomChange){this.panTween&&this.panTween.stop();this.moveTo(lonlat,zoom,{'dragging':dragging,'forceZoomChange':forceZoomChange});},moveByPx:function(dx,dy){var hw=this.size.w/2;var hh=this.size.h/2;var x=hw+dx;var y=hh+dy;var wrapDateLine=this.baseLayer.wrapDateLine;var xRestriction=0;var yRestriction=0;if(this.restrictedExtent){xRestriction=hw;yRestriction=hh;wrapDateLine=false;}
dx=wrapDateLine||x<=this.maxPx.x-xRestriction&&x>=this.minPx.x+xRestriction?Math.round(dx):0;dy=y<=this.maxPx.y-yRestriction&&y>=this.minPx.y+yRestriction?Math.round(dy):0;if(dx||dy){if(!this.dragging){this.dragging=true;this.events.triggerEvent("movestart");}
this.center=null;if(dx){this.layerContainerDiv.style.left=parseInt(this.layerContainerDiv.style.left)-dx+"px";this.minPx.x-=dx;this.maxPx.x-=dx;}
if(dy){this.layerContainerDiv.style.top=parseInt(this.layerContainerDiv.style.top)-dy+"px";this.minPx.y-=dy;this.maxPx.y-=dy;}
var layer,i,len;for(i=0,len=this.layers.length;i<len;++i){layer=this.layers[i];if(layer.visibility&&(layer===this.baseLayer||layer.inRange)){layer.moveByPx(dx,dy);layer.events.triggerEvent("move");}}
this.events.triggerEvent("move");}},adjustZoom:function(zoom){var resolution,resolutions=this.baseLayer.resolutions,maxResolution=this.getMaxExtent().getWidth()/this.size.w;if(this.getResolutionForZoom(zoom)>maxResolution){for(var i=zoom|0,ii=resolutions.length;i<ii;++i){if(resolutions[i]<=maxResolution){zoom=i;break;}}}
return zoom;},moveTo:function(lonlat,zoom,options){if(!(lonlat instanceof OpenLayers.LonLat)){lonlat=new OpenLayers.LonLat(lonlat);}
if(!options){options={};}
if(zoom!=null){zoom=parseFloat(zoom);if(!this.fractionalZoom){zoom=Math.round(zoom);}}
if(this.baseLayer.wrapDateLine){var requestedZoom=zoom;zoom=this.adjustZoom(zoom);if(zoom!==requestedZoom){lonlat=this.getCenter();}}
var dragging=options.dragging||this.dragging;var forceZoomChange=options.forceZoomChange;if(!this.getCachedCenter()&&!this.isValidLonLat(lonlat)){lonlat=this.maxExtent.getCenterLonLat();this.center=lonlat.clone();}
if(this.restrictedExtent!=null){if(lonlat==null){lonlat=this.center;}
if(zoom==null){zoom=this.getZoom();}
var resolution=this.getResolutionForZoom(zoom);var extent=this.calculateBounds(lonlat,resolution);if(!this.restrictedExtent.containsBounds(extent)){var maxCenter=this.restrictedExtent.getCenterLonLat();if(extent.getWidth()>this.restrictedExtent.getWidth()){lonlat=new OpenLayers.LonLat(maxCenter.lon,lonlat.lat);}else if(extent.left<this.restrictedExtent.left){lonlat=lonlat.add(this.restrictedExtent.left-
extent.left,0);}else if(extent.right>this.restrictedExtent.right){lonlat=lonlat.add(this.restrictedExtent.right-
extent.right,0);}
if(extent.getHeight()>this.restrictedExtent.getHeight()){lonlat=new OpenLayers.LonLat(lonlat.lon,maxCenter.lat);}else if(extent.bottom<this.restrictedExtent.bottom){lonlat=lonlat.add(0,this.restrictedExtent.bottom-
extent.bottom);}
else if(extent.top>this.restrictedExtent.top){lonlat=lonlat.add(0,this.restrictedExtent.top-
extent.top);}}}
var zoomChanged=forceZoomChange||((this.isValidZoomLevel(zoom))&&(zoom!=this.getZoom()));var centerChanged=(this.isValidLonLat(lonlat))&&(!lonlat.equals(this.center));if(zoomChanged||centerChanged||dragging){dragging||this.events.triggerEvent("movestart");if(centerChanged){if(!zoomChanged&&this.center){this.centerLayerContainer(lonlat);}
this.center=lonlat.clone();}
var res=zoomChanged?this.getResolutionForZoom(zoom):this.getResolution();if(zoomChanged||this.layerContainerOrigin==null){this.layerContainerOrigin=this.getCachedCenter();this.layerContainerDiv.style.left="0px";this.layerContainerDiv.style.top="0px";var maxExtent=this.getMaxExtent({restricted:true});var maxExtentCenter=maxExtent.getCenterLonLat();var lonDelta=this.center.lon-maxExtentCenter.lon;var latDelta=maxExtentCenter.lat-this.center.lat;var extentWidth=Math.round(maxExtent.getWidth()/res);var extentHeight=Math.round(maxExtent.getHeight()/res);this.minPx={x:(this.size.w-extentWidth)/2-lonDelta/res,y:(this.size.h-extentHeight)/2-latDelta/res};this.maxPx={x:this.minPx.x+Math.round(maxExtent.getWidth()/res),y:this.minPx.y+Math.round(maxExtent.getHeight()/res)};}
if(zoomChanged){this.zoom=zoom;this.resolution=res;}
var bounds=this.getExtent();if(this.baseLayer.visibility){this.baseLayer.moveTo(bounds,zoomChanged,options.dragging);options.dragging||this.baseLayer.events.triggerEvent("moveend",{zoomChanged:zoomChanged});}
bounds=this.baseLayer.getExtent();for(var i=this.layers.length-1;i>=0;--i){var layer=this.layers[i];if(layer!==this.baseLayer&&!layer.isBaseLayer){var inRange=layer.calculateInRange();if(layer.inRange!=inRange){layer.inRange=inRange;if(!inRange){layer.display(false);}
this.events.triggerEvent("changelayer",{layer:layer,property:"visibility"});}
if(inRange&&layer.visibility){layer.moveTo(bounds,zoomChanged,options.dragging);options.dragging||layer.events.triggerEvent("moveend",{zoomChanged:zoomChanged});}}}
this.events.triggerEvent("move");dragging||this.events.triggerEvent("moveend");if(zoomChanged){for(var i=0,len=this.popups.length;i<len;i++){this.popups[i].updatePosition();}
this.events.triggerEvent("zoomend");}}},centerLayerContainer:function(lonlat){var originPx=this.getViewPortPxFromLonLat(this.layerContainerOrigin);var newPx=this.getViewPortPxFromLonLat(lonlat);if((originPx!=null)&&(newPx!=null)){var oldLeft=parseInt(this.layerContainerDiv.style.left);var oldTop=parseInt(this.layerContainerDiv.style.top);var newLeft=Math.round(originPx.x-newPx.x);var newTop=Math.round(originPx.y-newPx.y);this.layerContainerDiv.style.left=newLeft+"px";this.layerContainerDiv.style.top=newTop+"px";var dx=oldLeft-newLeft;var dy=oldTop-newTop;this.minPx.x-=dx;this.maxPx.x-=dx;this.minPx.y-=dy;this.maxPx.y-=dy;}},isValidZoomLevel:function(zoomLevel){return((zoomLevel!=null)&&(zoomLevel>=0)&&(zoomLevel<this.getNumZoomLevels()));},isValidLonLat:function(lonlat){var valid=false;if(lonlat!=null){var maxExtent=this.getMaxExtent();var worldBounds=this.baseLayer.wrapDateLine&&maxExtent;valid=maxExtent.containsLonLat(lonlat,{worldBounds:worldBounds});}
return valid;},getProjection:function(){var projection=this.getProjectionObject();return projection?projection.getCode():null;},getProjectionObject:function(){var projection=null;if(this.baseLayer!=null){projection=this.baseLayer.projection;}
return projection;},getMaxResolution:function(){var maxResolution=null;if(this.baseLayer!=null){maxResolution=this.baseLayer.maxResolution;}
return maxResolution;},getMaxExtent:function(options){var maxExtent=null;if(options&&options.restricted&&this.restrictedExtent){maxExtent=this.restrictedExtent;}else if(this.baseLayer!=null){maxExtent=this.baseLayer.maxExtent;}
return maxExtent;},getNumZoomLevels:function(){var numZoomLevels=null;if(this.baseLayer!=null){numZoomLevels=this.baseLayer.numZoomLevels;}
return numZoomLevels;},getExtent:function(){var extent=null;if(this.baseLayer!=null){extent=this.baseLayer.getExtent();}
return extent;},getResolution:function(){var resolution=null;if(this.baseLayer!=null){resolution=this.baseLayer.getResolution();}else if(this.allOverlays===true&&this.layers.length>0){resolution=this.layers[0].getResolution();}
return resolution;},getUnits:function(){var units=null;if(this.baseLayer!=null){units=this.baseLayer.units;}
return units;},getScale:function(){var scale=null;if(this.baseLayer!=null){var res=this.getResolution();var units=this.baseLayer.units;scale=OpenLayers.Util.getScaleFromResolution(res,units);}
return scale;},getZoomForExtent:function(bounds,closest){var zoom=null;if(this.baseLayer!=null){zoom=this.baseLayer.getZoomForExtent(bounds,closest);}
return zoom;},getResolutionForZoom:function(zoom){var resolution=null;if(this.baseLayer){resolution=this.baseLayer.getResolutionForZoom(zoom);}
return resolution;},getZoomForResolution:function(resolution,closest){var zoom=null;if(this.baseLayer!=null){zoom=this.baseLayer.getZoomForResolution(resolution,closest);}
return zoom;},zoomTo:function(zoom){if(this.isValidZoomLevel(zoom)){this.setCenter(null,zoom);}},zoomIn:function(){this.zoomTo(this.getZoom()+1);},zoomOut:function(){this.zoomTo(this.getZoom()-1);},zoomToExtent:function(bounds,closest){if(!(bounds instanceof OpenLayers.Bounds)){bounds=new OpenLayers.Bounds(bounds);}
var center=bounds.getCenterLonLat();if(this.baseLayer.wrapDateLine){var maxExtent=this.getMaxExtent();bounds=bounds.clone();while(bounds.right<bounds.left){bounds.right+=maxExtent.getWidth();}
center=bounds.getCenterLonLat().wrapDateLine(maxExtent);}
this.setCenter(center,this.getZoomForExtent(bounds,closest));},zoomToMaxExtent:function(options){var restricted=(options)?options.restricted:true;var maxExtent=this.getMaxExtent({'restricted':restricted});this.zoomToExtent(maxExtent);},zoomToScale:function(scale,closest){var res=OpenLayers.Util.getResolutionFromScale(scale,this.baseLayer.units);var halfWDeg=(this.size.w*res)/2;var halfHDeg=(this.size.h*res)/2;var center=this.getCachedCenter();var extent=new OpenLayers.Bounds(center.lon-halfWDeg,center.lat-halfHDeg,center.lon+halfWDeg,center.lat+halfHDeg);this.zoomToExtent(extent,closest);},getLonLatFromViewPortPx:function(viewPortPx){var lonlat=null;if(this.baseLayer!=null){lonlat=this.baseLayer.getLonLatFromViewPortPx(viewPortPx);}
return lonlat;},getViewPortPxFromLonLat:function(lonlat){var px=null;if(this.baseLayer!=null){px=this.baseLayer.getViewPortPxFromLonLat(lonlat);}
return px;},getLonLatFromPixel:function(px){return this.getLonLatFromViewPortPx(px);},getPixelFromLonLat:function(lonlat){var px=this.getViewPortPxFromLonLat(lonlat);px.x=Math.round(px.x);px.y=Math.round(px.y);return px;},getGeodesicPixelSize:function(px){var lonlat=px?this.getLonLatFromPixel(px):(this.getCachedCenter()||new OpenLayers.LonLat(0,0));var res=this.getResolution();var left=lonlat.add(-res/2,0);var right=lonlat.add(res/2,0);var bottom=lonlat.add(0,-res/2);var top=lonlat.add(0,res/2);var dest=new OpenLayers.Projection("EPSG:4326");var source=this.getProjectionObject()||dest;if(!source.equals(dest)){left.transform(source,dest);right.transform(source,dest);bottom.transform(source,dest);top.transform(source,dest);}
return new OpenLayers.Size(OpenLayers.Util.distVincenty(left,right),OpenLayers.Util.distVincenty(bottom,top));},getViewPortPxFromLayerPx:function(layerPx){var viewPortPx=null;if(layerPx!=null){var dX=parseInt(this.layerContainerDiv.style.left);var dY=parseInt(this.layerContainerDiv.style.top);viewPortPx=layerPx.add(dX,dY);}
return viewPortPx;},getLayerPxFromViewPortPx:function(viewPortPx){var layerPx=null;if(viewPortPx!=null){var dX=-parseInt(this.layerContainerDiv.style.left);var dY=-parseInt(this.layerContainerDiv.style.top);layerPx=viewPortPx.add(dX,dY);if(isNaN(layerPx.x)||isNaN(layerPx.y)){layerPx=null;}}
return layerPx;},getLonLatFromLayerPx:function(px){px=this.getViewPortPxFromLayerPx(px);return this.getLonLatFromViewPortPx(px);},getLayerPxFromLonLat:function(lonlat){var px=this.getPixelFromLonLat(lonlat);return this.getLayerPxFromViewPortPx(px);},CLASS_NAME:"OpenLayers.Map"});OpenLayers.Map.TILE_WIDTH=256;OpenLayers.Map.TILE_HEIGHT=256;OpenLayers.Projection=OpenLayers.Class({proj:null,projCode:null,titleRegEx:/\+title=[^\+]*/,initialize:function(projCode,options){OpenLayers.Util.extend(this,options);this.projCode=projCode;if(window.Proj4js){this.proj=new Proj4js.Proj(projCode);}},getCode:function(){return this.proj?this.proj.srsCode:this.projCode;},getUnits:function(){return this.proj?this.proj.units:null;},toString:function(){return this.getCode();},equals:function(projection){var p=projection,equals=false;if(p){if(!(p instanceof OpenLayers.Projection)){p=new OpenLayers.Projection(p);}
if(window.Proj4js&&this.proj.defData&&p.proj.defData){equals=this.proj.defData.replace(this.titleRegEx,"")==p.proj.defData.replace(this.titleRegEx,"");}else if(p.getCode){var source=this.getCode(),target=p.getCode();equals=source==target||!!OpenLayers.Projection.transforms[source]&&OpenLayers.Projection.transforms[source][target]===OpenLayers.Projection.nullTransform;}}
return equals;},destroy:function(){delete this.proj;delete this.projCode;},CLASS_NAME:"OpenLayers.Projection"});OpenLayers.Projection.transforms={};OpenLayers.Projection.addTransform=function(from,to,method){if(!OpenLayers.Projection.transforms[from]){OpenLayers.Projection.transforms[from]={};}
OpenLayers.Projection.transforms[from][to]=method;};OpenLayers.Projection.transform=function(point,source,dest){if(source&&dest){if(!(source instanceof OpenLayers.Projection)){source=new OpenLayers.Projection(source);}
if(!(dest instanceof OpenLayers.Projection)){dest=new OpenLayers.Projection(dest);}
if(source.proj&&dest.proj){point=Proj4js.transform(source.proj,dest.proj,point);}else{var sourceCode=source.getCode();var destCode=dest.getCode();var transforms=OpenLayers.Projection.transforms;if(transforms[sourceCode]&&transforms[sourceCode][destCode]){transforms[sourceCode][destCode](point);}}}
return point;};OpenLayers.Projection.nullTransform=function(point){return point;};(function(){var pole=20037508.34;function inverseMercator(xy){xy.x=180*xy.x/pole;xy.y=180/Math.PI*(2*Math.atan(Math.exp((xy.y/pole)*Math.PI))-Math.PI/2);return xy;}
function forwardMercator(xy){xy.x=xy.x*pole/180;xy.y=Math.log(Math.tan((90+xy.y)*Math.PI/360))/Math.PI*pole;return xy;}
var codes=["EPSG:900913","EPSG:3857","EPSG:102113","EPSG:102100"];var add=OpenLayers.Projection.addTransform;var same=OpenLayers.Projection.nullTransform;var i,len,code,other,j;for(i=0,len=codes.length;i<len;++i){code=codes[i];add("EPSG:4326",code,forwardMercator);add(code,"EPSG:4326",inverseMercator);for(j=i+1;j<len;++j){other=codes[j];add(code,other,same);add(other,code,same);}}})();OpenLayers.Layer=OpenLayers.Class({id:null,name:null,div:null,opacity:1,alwaysInRange:null,RESOLUTION_PROPERTIES:['scales','resolutions','maxScale','minScale','maxResolution','minResolution','numZoomLevels','maxZoomLevel'],events:null,map:null,isBaseLayer:false,alpha:false,displayInLayerSwitcher:true,visibility:true,attribution:null,inRange:false,imageSize:null,imageOffset:null,options:null,eventListeners:null,gutter:0,projection:null,units:null,scales:null,resolutions:null,maxExtent:null,minExtent:null,maxResolution:null,minResolution:null,resolution:null,numZoomLevels:null,minScale:null,maxScale:null,displayOutsideMaxExtent:false,wrapDateLine:false,transitionEffect:null,metadata:null,initialize:function(name,options){this.metadata={};this.addOptions(options);this.name=name;if(this.id==null){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");this.div=OpenLayers.Util.createDiv(this.id);this.div.style.width="100%";this.div.style.height="100%";this.div.dir="ltr";this.events=new OpenLayers.Events(this,this.div);if(this.eventListeners instanceof Object){this.events.on(this.eventListeners);}}
if(this.wrapDateLine){this.displayOutsideMaxExtent=true;}},destroy:function(setNewBaseLayer){if(setNewBaseLayer==null){setNewBaseLayer=true;}
if(this.map!=null){this.map.removeLayer(this,setNewBaseLayer);}
this.projection=null;this.map=null;this.name=null;this.div=null;this.options=null;if(this.events){if(this.eventListeners){this.events.un(this.eventListeners);}
this.events.destroy();}
this.eventListeners=null;this.events=null;},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer(this.name,this.getOptions());}
OpenLayers.Util.applyDefaults(obj,this);obj.map=null;return obj;},getOptions:function(){var options={};for(var o in this.options){options[o]=this[o];}
return options;},setName:function(newName){if(newName!=this.name){this.name=newName;if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"name"});}}},addOptions:function(newOptions,reinitialize){if(this.options==null){this.options={};}
if(newOptions){if(newOptions.maxExtent&&!(newOptions.maxExtent instanceof OpenLayers.Bounds)){newOptions.maxExtent=new OpenLayers.Bounds(newOptions.maxExtent);}
if(newOptions.minExtent&&!(newOptions.minExtent instanceof OpenLayers.Bounds)){newOptions.minExtent=new OpenLayers.Bounds(newOptions.minExtent);}}
OpenLayers.Util.extend(this.options,newOptions);OpenLayers.Util.extend(this,newOptions);if(typeof this.projection=="string"){this.projection=new OpenLayers.Projection(this.projection);}
if(this.projection&&this.projection.getUnits()){this.units=this.projection.getUnits();}
if(this.map){var resolution=this.map.getResolution();var properties=this.RESOLUTION_PROPERTIES.concat(["projection","units","minExtent","maxExtent"]);for(var o in newOptions){if(newOptions.hasOwnProperty(o)&&OpenLayers.Util.indexOf(properties,o)>=0){this.initResolutions();if(reinitialize&&this.map.baseLayer===this){this.map.setCenter(this.map.getCenter(),this.map.getZoomForResolution(resolution),false,true);this.map.events.triggerEvent("changebaselayer",{layer:this});}
break;}}}},onMapResize:function(){},redraw:function(){var redrawn=false;if(this.map){this.inRange=this.calculateInRange();var extent=this.getExtent();if(extent&&this.inRange&&this.visibility){var zoomChanged=this.resolution==null||this.resolution!==this.map.getResolution();this.moveTo(extent,zoomChanged,false);this.events.triggerEvent("moveend",{"zoomChanged":zoomChanged});redrawn=true;}}
return redrawn;},moveTo:function(bounds,zoomChanged,dragging){var display=this.visibility;if(!this.isBaseLayer){display=display&&this.inRange;}
this.display(display);this.resolution=this.map.getResolution();},moveByPx:function(dx,dy){},setMap:function(map){if(this.map==null){this.map=map;this.maxExtent=this.maxExtent||this.map.maxExtent;this.minExtent=this.minExtent||this.map.minExtent;this.projection=this.projection||this.map.projection;if(typeof this.projection=="string"){this.projection=new OpenLayers.Projection(this.projection);}
this.units=this.projection.getUnits()||this.units||this.map.units;this.initResolutions();if(!this.isBaseLayer){this.inRange=this.calculateInRange();var show=((this.visibility)&&(this.inRange));this.div.style.display=show?"":"none";}
this.setTileSize();this.resolution=null;}},afterAdd:function(){},removeMap:function(map){},getImageSize:function(bounds){return(this.imageSize||this.tileSize);},setTileSize:function(size){var tileSize=(size)?size:((this.tileSize)?this.tileSize:this.map.getTileSize());this.tileSize=tileSize;if(this.gutter){this.imageOffset=new OpenLayers.Pixel(-this.gutter,-this.gutter);this.imageSize=new OpenLayers.Size(tileSize.w+(2*this.gutter),tileSize.h+(2*this.gutter));}},getVisibility:function(){return this.visibility;},setVisibility:function(visibility){if(visibility!=this.visibility){this.visibility=visibility;this.display(visibility);this.redraw();if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"visibility"});}
this.events.triggerEvent("visibilitychanged");}},display:function(display){if(display!=(this.div.style.display!="none")){this.div.style.display=(display&&this.calculateInRange())?"block":"none";}},calculateInRange:function(){var inRange=false;if(this.alwaysInRange){inRange=true;}else{if(this.map){var resolution=this.map.getResolution();inRange=((resolution>=this.minResolution)&&(resolution<=this.maxResolution));}}
return inRange;},setIsBaseLayer:function(isBaseLayer){if(isBaseLayer!=this.isBaseLayer){this.isBaseLayer=isBaseLayer;if(this.map!=null){this.map.events.triggerEvent("changebaselayer",{layer:this});}}},initResolutions:function(){var i,len,p;var props={},alwaysInRange=true;for(i=0,len=this.RESOLUTION_PROPERTIES.length;i<len;i++){p=this.RESOLUTION_PROPERTIES[i];props[p]=this.options[p];if(alwaysInRange&&this.options[p]){alwaysInRange=false;}}
if(this.alwaysInRange==null){this.alwaysInRange=alwaysInRange;}
if(props.resolutions==null){props.resolutions=this.resolutionsFromScales(props.scales);}
if(props.resolutions==null){props.resolutions=this.calculateResolutions(props);}
if(props.resolutions==null){for(i=0,len=this.RESOLUTION_PROPERTIES.length;i<len;i++){p=this.RESOLUTION_PROPERTIES[i];props[p]=this.options[p]!=null?this.options[p]:this.map[p];}
if(props.resolutions==null){props.resolutions=this.resolutionsFromScales(props.scales);}
if(props.resolutions==null){props.resolutions=this.calculateResolutions(props);}}
var maxResolution;if(this.options.maxResolution&&this.options.maxResolution!=="auto"){maxResolution=this.options.maxResolution;}
if(this.options.minScale){maxResolution=OpenLayers.Util.getResolutionFromScale(this.options.minScale,this.units);}
var minResolution;if(this.options.minResolution&&this.options.minResolution!=="auto"){minResolution=this.options.minResolution;}
if(this.options.maxScale){minResolution=OpenLayers.Util.getResolutionFromScale(this.options.maxScale,this.units);}
if(props.resolutions){props.resolutions.sort(function(a,b){return(b-a);});if(!maxResolution){maxResolution=props.resolutions[0];}
if(!minResolution){var lastIdx=props.resolutions.length-1;minResolution=props.resolutions[lastIdx];}}
this.resolutions=props.resolutions;if(this.resolutions){len=this.resolutions.length;this.scales=new Array(len);for(i=0;i<len;i++){this.scales[i]=OpenLayers.Util.getScaleFromResolution(this.resolutions[i],this.units);}
this.numZoomLevels=len;}
this.minResolution=minResolution;if(minResolution){this.maxScale=OpenLayers.Util.getScaleFromResolution(minResolution,this.units);}
this.maxResolution=maxResolution;if(maxResolution){this.minScale=OpenLayers.Util.getScaleFromResolution(maxResolution,this.units);}},resolutionsFromScales:function(scales){if(scales==null){return;}
var resolutions,i,len;len=scales.length;resolutions=new Array(len);for(i=0;i<len;i++){resolutions[i]=OpenLayers.Util.getResolutionFromScale(scales[i],this.units);}
return resolutions;},calculateResolutions:function(props){var viewSize,wRes,hRes;var maxResolution=props.maxResolution;if(props.minScale!=null){maxResolution=OpenLayers.Util.getResolutionFromScale(props.minScale,this.units);}else if(maxResolution=="auto"&&this.maxExtent!=null){viewSize=this.map.getSize();wRes=this.maxExtent.getWidth()/viewSize.w;hRes=this.maxExtent.getHeight()/viewSize.h;maxResolution=Math.max(wRes,hRes);}
var minResolution=props.minResolution;if(props.maxScale!=null){minResolution=OpenLayers.Util.getResolutionFromScale(props.maxScale,this.units);}else if(props.minResolution=="auto"&&this.minExtent!=null){viewSize=this.map.getSize();wRes=this.minExtent.getWidth()/viewSize.w;hRes=this.minExtent.getHeight()/viewSize.h;minResolution=Math.max(wRes,hRes);}
var maxZoomLevel=props.maxZoomLevel;var numZoomLevels=props.numZoomLevels;if(typeof minResolution==="number"&&typeof maxResolution==="number"&&numZoomLevels===undefined){var ratio=maxResolution/minResolution;numZoomLevels=Math.floor(Math.log(ratio)/Math.log(2))+1;}else if(numZoomLevels===undefined&&maxZoomLevel!=null){numZoomLevels=maxZoomLevel+1;}
if(typeof numZoomLevels!=="number"||numZoomLevels<=0||(typeof maxResolution!=="number"&&typeof minResolution!=="number")){return;}
var resolutions=new Array(numZoomLevels);var base=2;if(typeof minResolution=="number"&&typeof maxResolution=="number"){base=Math.pow((maxResolution/minResolution),(1/(numZoomLevels-1)));}
var i;if(typeof maxResolution==="number"){for(i=0;i<numZoomLevels;i++){resolutions[i]=maxResolution/Math.pow(base,i);}}else{for(i=0;i<numZoomLevels;i++){resolutions[numZoomLevels-1-i]=minResolution*Math.pow(base,i);}}
return resolutions;},getResolution:function(){var zoom=this.map.getZoom();return this.getResolutionForZoom(zoom);},getExtent:function(){return this.map.calculateBounds();},getZoomForExtent:function(extent,closest){var viewSize=this.map.getSize();var idealResolution=Math.max(extent.getWidth()/viewSize.w,extent.getHeight()/viewSize.h);return this.getZoomForResolution(idealResolution,closest);},getDataExtent:function(){},getResolutionForZoom:function(zoom){zoom=Math.max(0,Math.min(zoom,this.resolutions.length-1));var resolution;if(this.map.fractionalZoom){var low=Math.floor(zoom);var high=Math.ceil(zoom);resolution=this.resolutions[low]-
((zoom-low)*(this.resolutions[low]-this.resolutions[high]));}else{resolution=this.resolutions[Math.round(zoom)];}
return resolution;},getZoomForResolution:function(resolution,closest){var zoom,i,len;if(this.map.fractionalZoom){var lowZoom=0;var highZoom=this.resolutions.length-1;var highRes=this.resolutions[lowZoom];var lowRes=this.resolutions[highZoom];var res;for(i=0,len=this.resolutions.length;i<len;++i){res=this.resolutions[i];if(res>=resolution){highRes=res;lowZoom=i;}
if(res<=resolution){lowRes=res;highZoom=i;break;}}
var dRes=highRes-lowRes;if(dRes>0){zoom=lowZoom+((highRes-resolution)/dRes);}else{zoom=lowZoom;}}else{var diff;var minDiff=Number.POSITIVE_INFINITY;for(i=0,len=this.resolutions.length;i<len;i++){if(closest){diff=Math.abs(this.resolutions[i]-resolution);if(diff>minDiff){break;}
minDiff=diff;}else{if(this.resolutions[i]<resolution){break;}}}
zoom=Math.max(0,i-1);}
return zoom;},getLonLatFromViewPortPx:function(viewPortPx){var lonlat=null;var map=this.map;if(viewPortPx!=null&&map.minPx){var res=map.getResolution();var maxExtent=map.getMaxExtent({restricted:true});var lon=(viewPortPx.x-map.minPx.x)*res+maxExtent.left;var lat=(map.minPx.y-viewPortPx.y)*res+maxExtent.top;lonlat=new OpenLayers.LonLat(lon,lat);if(this.wrapDateLine){lonlat=lonlat.wrapDateLine(this.maxExtent);}}
return lonlat;},getViewPortPxFromLonLat:function(lonlat,resolution){var px=null;if(lonlat!=null){resolution=resolution||this.map.getResolution();var extent=this.map.calculateBounds(null,resolution);px=new OpenLayers.Pixel((1/resolution*(lonlat.lon-extent.left)),(1/resolution*(extent.top-lonlat.lat)));}
return px;},setOpacity:function(opacity){if(opacity!=this.opacity){this.opacity=opacity;var childNodes=this.div.childNodes;for(var i=0,len=childNodes.length;i<len;++i){var element=childNodes[i].firstChild||childNodes[i];OpenLayers.Util.modifyDOMElement(element,null,null,null,null,null,null,opacity);}
if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"opacity"});}}},getZIndex:function(){return this.div.style.zIndex;},setZIndex:function(zIndex){this.div.style.zIndex=zIndex;},adjustBounds:function(bounds){if(this.gutter){var mapGutter=this.gutter*this.map.getResolution();bounds=new OpenLayers.Bounds(bounds.left-mapGutter,bounds.bottom-mapGutter,bounds.right+mapGutter,bounds.top+mapGutter);}
if(this.wrapDateLine){var wrappingOptions={'rightTolerance':this.getResolution(),'leftTolerance':this.getResolution()};bounds=bounds.wrapDateLine(this.maxExtent,wrappingOptions);}
return bounds;},CLASS_NAME:"OpenLayers.Layer"});OpenLayers.Renderer=OpenLayers.Class({container:null,root:null,extent:null,locked:false,size:null,resolution:null,map:null,featureDx:0,initialize:function(containerID,options){this.container=OpenLayers.Util.getElement(containerID);OpenLayers.Util.extend(this,options);},destroy:function(){this.container=null;this.extent=null;this.size=null;this.resolution=null;this.map=null;},supported:function(){return false;},setExtent:function(extent,resolutionChanged){this.extent=extent.clone();if(this.map.baseLayer&&this.map.baseLayer.wrapDateLine){var ratio=extent.getWidth()/this.map.getExtent().getWidth(),extent=extent.scale(1/ratio);this.extent=extent.wrapDateLine(this.map.getMaxExtent()).scale(ratio);}
if(resolutionChanged){this.resolution=null;}
return true;},setSize:function(size){this.size=size.clone();this.resolution=null;},getResolution:function(){this.resolution=this.resolution||this.map.getResolution();return this.resolution;},drawFeature:function(feature,style){if(style==null){style=feature.style;}
if(feature.geometry){var bounds=feature.geometry.getBounds();if(bounds){var worldBounds;if(this.map.baseLayer&&this.map.baseLayer.wrapDateLine){worldBounds=this.map.getMaxExtent();}
if(!bounds.intersectsBounds(this.extent,{worldBounds:worldBounds})){style={display:"none"};}else{this.calculateFeatureDx(bounds,worldBounds);}
var rendered=this.drawGeometry(feature.geometry,style,feature.id);if(style.display!="none"&&style.label&&rendered!==false){var location=feature.geometry.getCentroid();if(style.labelXOffset||style.labelYOffset){var xOffset=isNaN(style.labelXOffset)?0:style.labelXOffset;var yOffset=isNaN(style.labelYOffset)?0:style.labelYOffset;var res=this.getResolution();location.move(xOffset*res,yOffset*res);}
this.drawText(feature.id,style,location);}else{this.removeText(feature.id);}
return rendered;}}},calculateFeatureDx:function(bounds,worldBounds){this.featureDx=0;if(worldBounds){var worldWidth=worldBounds.getWidth(),rendererCenterX=(this.extent.left+this.extent.right)/2,featureCenterX=(bounds.left+bounds.right)/2,worldsAway=Math.round((featureCenterX-rendererCenterX)/worldWidth);this.featureDx=worldsAway*worldWidth;}},drawGeometry:function(geometry,style,featureId){},drawText:function(featureId,style,location){},removeText:function(featureId){},clear:function(){},getFeatureIdFromEvent:function(evt){},eraseFeatures:function(features){if(!(OpenLayers.Util.isArray(features))){features=[features];}
for(var i=0,len=features.length;i<len;++i){var feature=features[i];this.eraseGeometry(feature.geometry,feature.id);this.removeText(feature.id);}},eraseGeometry:function(geometry,featureId){},moveRoot:function(renderer){},getRenderLayerId:function(){return this.container.id;},applyDefaultSymbolizer:function(symbolizer){var result=OpenLayers.Util.extend({},OpenLayers.Renderer.defaultSymbolizer);if(symbolizer.stroke===false){delete result.strokeWidth;delete result.strokeColor;}
if(symbolizer.fill===false){delete result.fillColor;}
OpenLayers.Util.extend(result,symbolizer);return result;},CLASS_NAME:"OpenLayers.Renderer"});OpenLayers.Renderer.defaultSymbolizer={fillColor:"#000000",strokeColor:"#000000",strokeWidth:2,fillOpacity:1,strokeOpacity:1,pointRadius:0,labelAlign:'cm'};OpenLayers.StyleMap=OpenLayers.Class({styles:null,extendDefault:true,initialize:function(style,options){this.styles={"default":new OpenLayers.Style(OpenLayers.Feature.Vector.style["default"]),"select":new OpenLayers.Style(OpenLayers.Feature.Vector.style["select"]),"temporary":new OpenLayers.Style(OpenLayers.Feature.Vector.style["temporary"]),"delete":new OpenLayers.Style(OpenLayers.Feature.Vector.style["delete"])};if(style instanceof OpenLayers.Style){this.styles["default"]=style;this.styles["select"]=style;this.styles["temporary"]=style;this.styles["delete"]=style;}else if(typeof style=="object"){for(var key in style){if(style[key]instanceof OpenLayers.Style){this.styles[key]=style[key];}else if(typeof style[key]=="object"){this.styles[key]=new OpenLayers.Style(style[key]);}else{this.styles["default"]=new OpenLayers.Style(style);this.styles["select"]=new OpenLayers.Style(style);this.styles["temporary"]=new OpenLayers.Style(style);this.styles["delete"]=new OpenLayers.Style(style);break;}}}
OpenLayers.Util.extend(this,options);},destroy:function(){for(var key in this.styles){this.styles[key].destroy();}
this.styles=null;},createSymbolizer:function(feature,intent){if(!feature){feature=new OpenLayers.Feature.Vector();}
if(!this.styles[intent]){intent="default";}
feature.renderIntent=intent;var defaultSymbolizer={};if(this.extendDefault&&intent!="default"){defaultSymbolizer=this.styles["default"].createSymbolizer(feature);}
return OpenLayers.Util.extend(defaultSymbolizer,this.styles[intent].createSymbolizer(feature));},addUniqueValueRules:function(renderIntent,property,symbolizers,context){var rules=[];for(var value in symbolizers){rules.push(new OpenLayers.Rule({symbolizer:symbolizers[value],context:context,filter:new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.EQUAL_TO,property:property,value:value})}));}
this.styles[renderIntent].addRules(rules);},CLASS_NAME:"OpenLayers.StyleMap"});OpenLayers.Layer.Vector=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:false,isFixed:false,features:null,filter:null,selectedFeatures:null,unrenderedFeatures:null,reportError:true,style:null,styleMap:null,strategies:null,protocol:null,renderers:['SVG','VML','Canvas'],renderer:null,rendererOptions:null,geometryType:null,drawn:false,ratio:1,initialize:function(name,options){OpenLayers.Layer.prototype.initialize.apply(this,arguments);if(!this.renderer||!this.renderer.supported()){this.assignRenderer();}
if(!this.renderer||!this.renderer.supported()){this.renderer=null;this.displayError();}
if(!this.styleMap){this.styleMap=new OpenLayers.StyleMap();}
this.features=[];this.selectedFeatures=[];this.unrenderedFeatures={};if(this.strategies){for(var i=0,len=this.strategies.length;i<len;i++){this.strategies[i].setLayer(this);}}},destroy:function(){if(this.strategies){var strategy,i,len;for(i=0,len=this.strategies.length;i<len;i++){strategy=this.strategies[i];if(strategy.autoDestroy){strategy.destroy();}}
this.strategies=null;}
if(this.protocol){if(this.protocol.autoDestroy){this.protocol.destroy();}
this.protocol=null;}
this.destroyFeatures();this.features=null;this.selectedFeatures=null;this.unrenderedFeatures=null;if(this.renderer){this.renderer.destroy();}
this.renderer=null;this.geometryType=null;this.drawn=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.Vector(this.name,this.getOptions());}
obj=OpenLayers.Layer.prototype.clone.apply(this,[obj]);var features=this.features;var len=features.length;var clonedFeatures=new Array(len);for(var i=0;i<len;++i){clonedFeatures[i]=features[i].clone();}
obj.features=clonedFeatures;return obj;},refresh:function(obj){if(this.calculateInRange()&&this.visibility){this.events.triggerEvent("refresh",obj);}},assignRenderer:function(){for(var i=0,len=this.renderers.length;i<len;i++){var rendererClass=this.renderers[i];var renderer=(typeof rendererClass=="function")?rendererClass:OpenLayers.Renderer[rendererClass];if(renderer&&renderer.prototype.supported()){this.renderer=new renderer(this.div,this.rendererOptions);break;}}},displayError:function(){if(this.reportError){OpenLayers.Console.userError(OpenLayers.i18n("browserNotSupported",{renderers:this.renderers.join('\n')}));}},setMap:function(map){OpenLayers.Layer.prototype.setMap.apply(this,arguments);if(!this.renderer){this.map.removeLayer(this);}else{this.renderer.map=this.map;var newSize=this.map.getSize();newSize.w=newSize.w*this.ratio;newSize.h=newSize.h*this.ratio;this.renderer.setSize(newSize);}},afterAdd:function(){if(this.strategies){var strategy,i,len;for(i=0,len=this.strategies.length;i<len;i++){strategy=this.strategies[i];if(strategy.autoActivate){strategy.activate();}}}},removeMap:function(map){this.drawn=false;if(this.strategies){var strategy,i,len;for(i=0,len=this.strategies.length;i<len;i++){strategy=this.strategies[i];if(strategy.autoActivate){strategy.deactivate();}}}},onMapResize:function(){OpenLayers.Layer.prototype.onMapResize.apply(this,arguments);var newSize=this.map.getSize();newSize.w=newSize.w*this.ratio;newSize.h=newSize.h*this.ratio;this.renderer.setSize(newSize);},moveTo:function(bounds,zoomChanged,dragging){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);var ng=(OpenLayers.Renderer.NG&&this.renderer instanceof OpenLayers.Renderer.NG);if(ng){dragging||this.renderer.updateDimensions(zoomChanged);}else{var coordSysUnchanged=true;if(!dragging){this.renderer.root.style.visibility='hidden';var viewSize=this.map.getSize(),viewWidth=viewSize.w,viewHeight=viewSize.h,offsetLeft=(viewWidth/2*this.ratio)-viewWidth/2,offsetTop=(viewHeight/2*this.ratio)-viewHeight/2;offsetLeft+=parseInt(this.map.layerContainerDiv.style.left,10);offsetLeft=-Math.round(offsetLeft);offsetTop+=parseInt(this.map.layerContainerDiv.style.top,10);offsetTop=-Math.round(offsetTop);this.div.style.left=offsetLeft+'px';this.div.style.top=offsetTop+'px';var extent=this.map.getExtent().scale(this.ratio);coordSysUnchanged=this.renderer.setExtent(extent,zoomChanged);this.renderer.root.style.visibility='visible';if(OpenLayers.IS_GECKO===true){this.div.scrollLeft=this.div.scrollLeft;}
if(!zoomChanged&&coordSysUnchanged){for(var i in this.unrenderedFeatures){var feature=this.unrenderedFeatures[i];this.drawFeature(feature);}}}}
if(!this.drawn||(!ng&&(zoomChanged||!coordSysUnchanged))){this.drawn=true;var feature;for(var i=0,len=this.features.length;i<len;i++){this.renderer.locked=(i!==(len-1));feature=this.features[i];this.drawFeature(feature);}}},redraw:function(){if(OpenLayers.Renderer.NG&&this.renderer instanceof OpenLayers.Renderer.NG){this.drawn=false;}
return OpenLayers.Layer.prototype.redraw.apply(this,arguments);},display:function(display){OpenLayers.Layer.prototype.display.apply(this,arguments);var currentDisplay=this.div.style.display;if(currentDisplay!=this.renderer.root.style.display){this.renderer.root.style.display=currentDisplay;}},addFeatures:function(features,options){if(!(OpenLayers.Util.isArray(features))){features=[features];}
var notify=!options||!options.silent;if(notify){var event={features:features};var ret=this.events.triggerEvent("beforefeaturesadded",event);if(ret===false){return;}
features=event.features;}
var featuresAdded=[];for(var i=0,len=features.length;i<len;i++){if(i!=(features.length-1)){this.renderer.locked=true;}else{this.renderer.locked=false;}
var feature=features[i];if(this.geometryType&&!(feature.geometry instanceof this.geometryType)){throw new TypeError('addFeatures: component should be an '+
this.geometryType.prototype.CLASS_NAME);}
feature.layer=this;if(!feature.style&&this.style){feature.style=OpenLayers.Util.extend({},this.style);}
if(notify){if(this.events.triggerEvent("beforefeatureadded",{feature:feature})===false){continue;}
this.preFeatureInsert(feature);}
featuresAdded.push(feature);this.features.push(feature);this.drawFeature(feature);if(notify){this.events.triggerEvent("featureadded",{feature:feature});this.onFeatureInsert(feature);}}
if(notify){this.events.triggerEvent("featuresadded",{features:featuresAdded});}},removeFeatures:function(features,options){if(!features||features.length===0){return;}
if(features===this.features){return this.removeAllFeatures(options);}
if(!(OpenLayers.Util.isArray(features))){features=[features];}
if(features===this.selectedFeatures){features=features.slice();}
var notify=!options||!options.silent;if(notify){this.events.triggerEvent("beforefeaturesremoved",{features:features});}
for(var i=features.length-1;i>=0;i--){if(i!=0&&features[i-1].geometry){this.renderer.locked=true;}else{this.renderer.locked=false;}
var feature=features[i];delete this.unrenderedFeatures[feature.id];if(notify){this.events.triggerEvent("beforefeatureremoved",{feature:feature});}
this.features=OpenLayers.Util.removeItem(this.features,feature);feature.layer=null;if(feature.geometry){this.renderer.eraseFeatures(feature);}
if(OpenLayers.Util.indexOf(this.selectedFeatures,feature)!=-1){OpenLayers.Util.removeItem(this.selectedFeatures,feature);}
if(notify){this.events.triggerEvent("featureremoved",{feature:feature});}}
if(notify){this.events.triggerEvent("featuresremoved",{features:features});}},removeAllFeatures:function(options){var notify=!options||!options.silent;var features=this.features;if(notify){this.events.triggerEvent("beforefeaturesremoved",{features:features});}
var feature;for(var i=features.length-1;i>=0;i--){feature=features[i];if(notify){this.events.triggerEvent("beforefeatureremoved",{feature:feature});}
feature.layer=null;if(notify){this.events.triggerEvent("featureremoved",{feature:feature});}}
this.renderer.clear();this.features=[];this.unrenderedFeatures={};this.selectedFeatures=[];if(notify){this.events.triggerEvent("featuresremoved",{features:features});}},destroyFeatures:function(features,options){var all=(features==undefined);if(all){features=this.features;}
if(features){this.removeFeatures(features,options);for(var i=features.length-1;i>=0;i--){features[i].destroy();}}},drawFeature:function(feature,style){if(!this.drawn){return;}
if(typeof style!="object"){if(!style&&feature.state===OpenLayers.State.DELETE){style="delete";}
var renderIntent=style||feature.renderIntent;style=feature.style||this.style;if(!style){style=this.styleMap.createSymbolizer(feature,renderIntent);}}
var drawn=this.renderer.drawFeature(feature,style);if(drawn===false||drawn===null){this.unrenderedFeatures[feature.id]=feature;}else{delete this.unrenderedFeatures[feature.id];}},eraseFeatures:function(features){this.renderer.eraseFeatures(features);},getFeatureFromEvent:function(evt){if(!this.renderer){throw new Error('getFeatureFromEvent called on layer with no '+'renderer. This usually means you destroyed a '+'layer, but not some handler which is associated '+'with it.');}
var feature=null;var featureId=this.renderer.getFeatureIdFromEvent(evt);if(featureId){if(typeof featureId==="string"){feature=this.getFeatureById(featureId);}else{feature=featureId;}}
return feature;},getFeatureBy:function(property,value){var feature=null;for(var i=0,len=this.features.length;i<len;++i){if(this.features[i][property]==value){feature=this.features[i];break;}}
return feature;},getFeatureById:function(featureId){return this.getFeatureBy('id',featureId);},getFeatureByFid:function(featureFid){return this.getFeatureBy('fid',featureFid);},getFeaturesByAttribute:function(attrName,attrValue){var i,feature,len=this.features.length,foundFeatures=[];for(i=0;i<len;i++){feature=this.features[i];if(feature&&feature.attributes){if(feature.attributes[attrName]===attrValue){foundFeatures.push(feature);}}}
return foundFeatures;},onFeatureInsert:function(feature){},preFeatureInsert:function(feature){},getDataExtent:function(){var maxExtent=null;var features=this.features;if(features&&(features.length>0)){var geometry=null;for(var i=0,len=features.length;i<len;i++){geometry=features[i].geometry;if(geometry){if(maxExtent===null){maxExtent=new OpenLayers.Bounds();}
maxExtent.extend(geometry.getBounds());}}}
return maxExtent;},CLASS_NAME:"OpenLayers.Layer.Vector"});OpenLayers.Layer.Vector.RootContainer=OpenLayers.Class(OpenLayers.Layer.Vector,{displayInLayerSwitcher:false,layers:null,display:function(){},getFeatureFromEvent:function(evt){var layers=this.layers;var feature;for(var i=0;i<layers.length;i++){feature=layers[i].getFeatureFromEvent(evt);if(feature){return feature;}}},setMap:function(map){OpenLayers.Layer.Vector.prototype.setMap.apply(this,arguments);this.collectRoots();map.events.register("changelayer",this,this.handleChangeLayer);},removeMap:function(map){map.events.unregister("changelayer",this,this.handleChangeLayer);this.resetRoots();OpenLayers.Layer.Vector.prototype.removeMap.apply(this,arguments);},collectRoots:function(){var layer;for(var i=0;i<this.map.layers.length;++i){layer=this.map.layers[i];if(OpenLayers.Util.indexOf(this.layers,layer)!=-1){layer.renderer.moveRoot(this.renderer);}}},resetRoots:function(){var layer;for(var i=0;i<this.layers.length;++i){layer=this.layers[i];if(this.renderer&&layer.renderer.getRenderLayerId()==this.id){this.renderer.moveRoot(layer.renderer);}}},handleChangeLayer:function(evt){var layer=evt.layer;if(evt.property=="order"&&OpenLayers.Util.indexOf(this.layers,layer)!=-1){this.resetRoots();this.collectRoots();}},CLASS_NAME:"OpenLayers.Layer.Vector.RootContainer"});OpenLayers.Control.SelectFeature=OpenLayers.Class(OpenLayers.Control,{multipleKey:null,toggleKey:null,multiple:false,clickout:true,toggle:false,hover:false,highlightOnly:false,box:false,onBeforeSelect:function(){},onSelect:function(){},onUnselect:function(){},scope:null,geometryTypes:null,layer:null,layers:null,callbacks:null,selectStyle:null,renderIntent:"select",handlers:null,initialize:function(layers,options){OpenLayers.Control.prototype.initialize.apply(this,[options]);if(this.scope===null){this.scope=this;}
this.initLayer(layers);var callbacks={click:this.clickFeature,clickout:this.clickoutFeature};if(this.hover){callbacks.over=this.overFeature;callbacks.out=this.outFeature;}
this.callbacks=OpenLayers.Util.extend(callbacks,this.callbacks);this.handlers={feature:new OpenLayers.Handler.Feature(this,this.layer,this.callbacks,{geometryTypes:this.geometryTypes})};if(this.box){this.handlers.box=new OpenLayers.Handler.Box(this,{done:this.selectBox},{boxDivClassName:"olHandlerBoxSelectFeature"});}},initLayer:function(layers){if(OpenLayers.Util.isArray(layers)){this.layers=layers;this.layer=new OpenLayers.Layer.Vector.RootContainer(this.id+"_container",{layers:layers});}else{this.layer=layers;}},destroy:function(){if(this.active&&this.layers){this.map.removeLayer(this.layer);}
OpenLayers.Control.prototype.destroy.apply(this,arguments);if(this.layers){this.layer.destroy();}},activate:function(){if(!this.active){if(this.layers){this.map.addLayer(this.layer);}
this.handlers.feature.activate();if(this.box&&this.handlers.box){this.handlers.box.activate();}}
return OpenLayers.Control.prototype.activate.apply(this,arguments);},deactivate:function(){if(this.active){this.handlers.feature.deactivate();if(this.handlers.box){this.handlers.box.deactivate();}
if(this.layers){this.map.removeLayer(this.layer);}}
return OpenLayers.Control.prototype.deactivate.apply(this,arguments);},unselectAll:function(options){var layers=this.layers||[this.layer];var layer,feature;for(var l=0;l<layers.length;++l){layer=layers[l];for(var i=layer.selectedFeatures.length-1;i>=0;--i){feature=layer.selectedFeatures[i];if(!options||options.except!=feature){this.unselect(feature);}}}},clickFeature:function(feature){if(!this.hover){var selected=(OpenLayers.Util.indexOf(feature.layer.selectedFeatures,feature)>-1);if(selected){if(this.toggleSelect()){this.unselect(feature);}else if(!this.multipleSelect()){this.unselectAll({except:feature});}}else{if(!this.multipleSelect()){this.unselectAll({except:feature});}
this.select(feature);}}},multipleSelect:function(){return this.multiple||(this.handlers.feature.evt&&this.handlers.feature.evt[this.multipleKey]);},toggleSelect:function(){return this.toggle||(this.handlers.feature.evt&&this.handlers.feature.evt[this.toggleKey]);},clickoutFeature:function(feature){if(!this.hover&&this.clickout){this.unselectAll();}},overFeature:function(feature){var layer=feature.layer;if(this.hover){if(this.highlightOnly){this.highlight(feature);}else if(OpenLayers.Util.indexOf(layer.selectedFeatures,feature)==-1){this.select(feature);}}},outFeature:function(feature){if(this.hover){if(this.highlightOnly){if(feature._lastHighlighter==this.id){if(feature._prevHighlighter&&feature._prevHighlighter!=this.id){delete feature._lastHighlighter;var control=this.map.getControl(feature._prevHighlighter);if(control){control.highlight(feature);}}else{this.unhighlight(feature);}}}else{this.unselect(feature);}}},highlight:function(feature){var layer=feature.layer;var cont=this.events.triggerEvent("beforefeaturehighlighted",{feature:feature});if(cont!==false){feature._prevHighlighter=feature._lastHighlighter;feature._lastHighlighter=this.id;var style=this.selectStyle||this.renderIntent;layer.drawFeature(feature,style);this.events.triggerEvent("featurehighlighted",{feature:feature});}},unhighlight:function(feature){var layer=feature.layer;if(feature._prevHighlighter==undefined){delete feature._lastHighlighter;}else if(feature._prevHighlighter==this.id){delete feature._prevHighlighter;}else{feature._lastHighlighter=feature._prevHighlighter;delete feature._prevHighlighter;}
layer.drawFeature(feature,feature.style||feature.layer.style||"default");this.events.triggerEvent("featureunhighlighted",{feature:feature});},select:function(feature){var cont=this.onBeforeSelect.call(this.scope,feature);var layer=feature.layer;if(cont!==false){cont=layer.events.triggerEvent("beforefeatureselected",{feature:feature});if(cont!==false){layer.selectedFeatures.push(feature);this.highlight(feature);if(!this.handlers.feature.lastFeature){this.handlers.feature.lastFeature=layer.selectedFeatures[0];}
layer.events.triggerEvent("featureselected",{feature:feature});this.onSelect.call(this.scope,feature);}}},unselect:function(feature){var layer=feature.layer;this.unhighlight(feature);OpenLayers.Util.removeItem(layer.selectedFeatures,feature);layer.events.triggerEvent("featureunselected",{feature:feature});this.onUnselect.call(this.scope,feature);},selectBox:function(position){if(position instanceof OpenLayers.Bounds){var minXY=this.map.getLonLatFromPixel({x:position.left,y:position.bottom});var maxXY=this.map.getLonLatFromPixel({x:position.right,y:position.top});var bounds=new OpenLayers.Bounds(minXY.lon,minXY.lat,maxXY.lon,maxXY.lat);if(!this.multipleSelect()){this.unselectAll();}
var prevMultiple=this.multiple;this.multiple=true;var layers=this.layers||[this.layer];this.events.triggerEvent("boxselectionstart",{layers:layers});var layer;for(var l=0;l<layers.length;++l){layer=layers[l];for(var i=0,len=layer.features.length;i<len;++i){var feature=layer.features[i];if(!feature.getVisibility()){continue;}
if(this.geometryTypes==null||OpenLayers.Util.indexOf(this.geometryTypes,feature.geometry.CLASS_NAME)>-1){if(bounds.toGeometry().intersects(feature.geometry)){if(OpenLayers.Util.indexOf(layer.selectedFeatures,feature)==-1){this.select(feature);}}}}}
this.multiple=prevMultiple;this.events.triggerEvent("boxselectionend",{layers:layers});}},setMap:function(map){this.handlers.feature.setMap(map);if(this.box){this.handlers.box.setMap(map);}
OpenLayers.Control.prototype.setMap.apply(this,arguments);},setLayer:function(layers){var isActive=this.active;this.unselectAll();this.deactivate();if(this.layers){this.layer.destroy();this.layers=null;}
this.initLayer(layers);this.handlers.feature.layer=this.layer;if(isActive){this.activate();}},CLASS_NAME:"OpenLayers.Control.SelectFeature"});OpenLayers.Control.ZoomBox=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,out:false,keyMask:null,alwaysZoom:false,draw:function(){this.handler=new OpenLayers.Handler.Box(this,{done:this.zoomBox},{keyMask:this.keyMask});},zoomBox:function(position){if(position instanceof OpenLayers.Bounds){var bounds;if(!this.out){var minXY=this.map.getLonLatFromPixel({x:position.left,y:position.bottom});var maxXY=this.map.getLonLatFromPixel({x:position.right,y:position.top});bounds=new OpenLayers.Bounds(minXY.lon,minXY.lat,maxXY.lon,maxXY.lat);}else{var pixWidth=Math.abs(position.right-position.left);var pixHeight=Math.abs(position.top-position.bottom);var zoomFactor=Math.min((this.map.size.h/pixHeight),(this.map.size.w/pixWidth));var extent=this.map.getExtent();var center=this.map.getLonLatFromPixel(position.getCenterPixel());var xmin=center.lon-(extent.getWidth()/2)*zoomFactor;var xmax=center.lon+(extent.getWidth()/2)*zoomFactor;var ymin=center.lat-(extent.getHeight()/2)*zoomFactor;var ymax=center.lat+(extent.getHeight()/2)*zoomFactor;bounds=new OpenLayers.Bounds(xmin,ymin,xmax,ymax);}
var lastZoom=this.map.getZoom();this.map.zoomToExtent(bounds);if(lastZoom==this.map.getZoom()&&this.alwaysZoom==true){this.map.zoomTo(lastZoom+(this.out?-1:1));}}else{if(!this.out){this.map.setCenter(this.map.getLonLatFromPixel(position),this.map.getZoom()+1);}else{this.map.setCenter(this.map.getLonLatFromPixel(position),this.map.getZoom()-1);}}},CLASS_NAME:"OpenLayers.Control.ZoomBox"});OpenLayers.Renderer.Canvas=OpenLayers.Class(OpenLayers.Renderer,{hitDetection:true,hitOverflow:0,canvas:null,features:null,pendingRedraw:false,initialize:function(containerID,options){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.root=document.createElement("canvas");this.container.appendChild(this.root);this.canvas=this.root.getContext("2d");this.features={};if(this.hitDetection){this.hitCanvas=document.createElement("canvas");this.hitContext=this.hitCanvas.getContext("2d");}},setExtent:function(){OpenLayers.Renderer.prototype.setExtent.apply(this,arguments);return false;},eraseGeometry:function(geometry,featureId){this.eraseFeatures(this.features[featureId][0]);},supported:function(){var canvas=document.createElement("canvas");return!!canvas.getContext;},setSize:function(size){this.size=size.clone();var root=this.root;root.style.width=size.w+"px";root.style.height=size.h+"px";root.width=size.w;root.height=size.h;this.resolution=null;if(this.hitDetection){var hitCanvas=this.hitCanvas;hitCanvas.style.width=size.w+"px";hitCanvas.style.height=size.h+"px";hitCanvas.width=size.w;hitCanvas.height=size.h;}},drawFeature:function(feature,style){var rendered;if(feature.geometry){style=this.applyDefaultSymbolizer(style||feature.style);var bounds=feature.geometry.getBounds();var worldBounds;if(this.map.baseLayer&&this.map.baseLayer.wrapDateLine){worldBounds=this.map.getMaxExtent();}
var intersects=bounds&&bounds.intersectsBounds(this.extent,{worldBounds:worldBounds});rendered=(style.display!=="none")&&!!bounds&&intersects;if(rendered){this.features[feature.id]=[feature,style];}
else{delete(this.features[feature.id]);}
this.pendingRedraw=true;}
if(this.pendingRedraw&&!this.locked){this.redraw();this.pendingRedraw=false;}
return rendered;},drawGeometry:function(geometry,style,featureId){var className=geometry.CLASS_NAME;if((className=="OpenLayers.Geometry.Collection")||(className=="OpenLayers.Geometry.MultiPoint")||(className=="OpenLayers.Geometry.MultiLineString")||(className=="OpenLayers.Geometry.MultiPolygon")){for(var i=0;i<geometry.components.length;i++){this.drawGeometry(geometry.components[i],style,featureId);}
return;}
switch(geometry.CLASS_NAME){case"OpenLayers.Geometry.Point":this.drawPoint(geometry,style,featureId);break;case"OpenLayers.Geometry.LineString":this.drawLineString(geometry,style,featureId);break;case"OpenLayers.Geometry.LinearRing":this.drawLinearRing(geometry,style,featureId);break;case"OpenLayers.Geometry.Polygon":this.drawPolygon(geometry,style,featureId);break;default:break;}},drawExternalGraphic:function(geometry,style,featureId){var img=new Image();if(style.graphicTitle){img.title=style.graphicTitle;}
var width=style.graphicWidth||style.graphicHeight;var height=style.graphicHeight||style.graphicWidth;width=width?width:style.pointRadius*2;height=height?height:style.pointRadius*2;var xOffset=(style.graphicXOffset!=undefined)?style.graphicXOffset:-(0.5*width);var yOffset=(style.graphicYOffset!=undefined)?style.graphicYOffset:-(0.5*height);var opacity=style.graphicOpacity||style.fillOpacity;var onLoad=function(){if(!this.features[featureId]){return;}
var pt=this.getLocalXY(geometry);var p0=pt[0];var p1=pt[1];if(!isNaN(p0)&&!isNaN(p1)){var x=(p0+xOffset)|0;var y=(p1+yOffset)|0;var canvas=this.canvas;canvas.globalAlpha=opacity;var factor=OpenLayers.Renderer.Canvas.drawImageScaleFactor||(OpenLayers.Renderer.Canvas.drawImageScaleFactor=/android 2.1/.test(navigator.userAgent.toLowerCase())?320/window.screen.width:1);canvas.drawImage(img,x*factor,y*factor,width*factor,height*factor);if(this.hitDetection){this.setHitContextStyle("fill",featureId);this.hitContext.fillRect(x,y,width,height);}}};img.onload=OpenLayers.Function.bind(onLoad,this);img.src=style.externalGraphic;},setCanvasStyle:function(type,style){if(type==="fill"){this.canvas.globalAlpha=style['fillOpacity'];this.canvas.fillStyle=style['fillColor'];}else if(type==="stroke"){this.canvas.globalAlpha=style['strokeOpacity'];this.canvas.strokeStyle=style['strokeColor'];this.canvas.lineWidth=style['strokeWidth'];}else{this.canvas.globalAlpha=0;this.canvas.lineWidth=1;}},featureIdToHex:function(featureId){var id=Number(featureId.split("_").pop())+1;if(id>=16777216){this.hitOverflow=id-16777215;id=id%16777216+1;}
var hex="000000"+id.toString(16);var len=hex.length;hex="#"+hex.substring(len-6,len);return hex;},setHitContextStyle:function(type,featureId,symbolizer){var hex=this.featureIdToHex(featureId);if(type=="fill"){this.hitContext.globalAlpha=1.0;this.hitContext.fillStyle=hex;}else if(type=="stroke"){this.hitContext.globalAlpha=1.0;this.hitContext.strokeStyle=hex;this.hitContext.lineWidth=symbolizer.strokeWidth+2;}else{this.hitContext.globalAlpha=0;this.hitContext.lineWidth=1;}},drawPoint:function(geometry,style,featureId){if(style.graphic!==false){if(style.externalGraphic){this.drawExternalGraphic(geometry,style,featureId);}else{var pt=this.getLocalXY(geometry);var p0=pt[0];var p1=pt[1];if(!isNaN(p0)&&!isNaN(p1)){var twoPi=Math.PI*2;var radius=style.pointRadius;if(style.fill!==false){this.setCanvasStyle("fill",style);this.canvas.beginPath();this.canvas.arc(p0,p1,radius,0,twoPi,true);this.canvas.fill();if(this.hitDetection){this.setHitContextStyle("fill",featureId,style);this.hitContext.beginPath();this.hitContext.arc(p0,p1,radius,0,twoPi,true);this.hitContext.fill();}}
if(style.stroke!==false){this.setCanvasStyle("stroke",style);this.canvas.beginPath();this.canvas.arc(p0,p1,radius,0,twoPi,true);this.canvas.stroke();if(this.hitDetection){this.setHitContextStyle("stroke",featureId,style);this.hitContext.beginPath();this.hitContext.arc(p0,p1,radius,0,twoPi,true);this.hitContext.stroke();}
this.setCanvasStyle("reset");}}}}},drawLineString:function(geometry,style,featureId){style=OpenLayers.Util.applyDefaults({fill:false},style);this.drawLinearRing(geometry,style,featureId);},drawLinearRing:function(geometry,style,featureId){if(style.fill!==false){this.setCanvasStyle("fill",style);this.renderPath(this.canvas,geometry,style,featureId,"fill");if(this.hitDetection){this.setHitContextStyle("fill",featureId,style);this.renderPath(this.hitContext,geometry,style,featureId,"fill");}}
if(style.stroke!==false){this.setCanvasStyle("stroke",style);this.renderPath(this.canvas,geometry,style,featureId,"stroke");if(this.hitDetection){this.setHitContextStyle("stroke",featureId,style);this.renderPath(this.hitContext,geometry,style,featureId,"stroke");}}
this.setCanvasStyle("reset");},renderPath:function(context,geometry,style,featureId,type){var components=geometry.components;var len=components.length;context.beginPath();var start=this.getLocalXY(components[0]);var x=start[0];var y=start[1];if(!isNaN(x)&&!isNaN(y)){context.moveTo(start[0],start[1]);for(var i=1;i<len;++i){var pt=this.getLocalXY(components[i]);context.lineTo(pt[0],pt[1]);}
if(type==="fill"){context.fill();}else{context.stroke();}}},drawPolygon:function(geometry,style,featureId){var components=geometry.components;var len=components.length;this.drawLinearRing(components[0],style,featureId);for(var i=1;i<len;++i){this.canvas.globalCompositeOperation="destination-out";if(this.hitDetection){this.hitContext.globalCompositeOperation="destination-out";}
this.drawLinearRing(components[i],OpenLayers.Util.applyDefaults({stroke:false,fillOpacity:1.0},style),featureId);this.canvas.globalCompositeOperation="source-over";if(this.hitDetection){this.hitContext.globalCompositeOperation="source-over";}
this.drawLinearRing(components[i],OpenLayers.Util.applyDefaults({fill:false},style),featureId);}},drawText:function(location,style){var pt=this.getLocalXY(location);this.setCanvasStyle("reset");this.canvas.fillStyle=style.fontColor;this.canvas.globalAlpha=style.fontOpacity||1.0;var fontStyle=[style.fontStyle?style.fontStyle:"normal","normal",style.fontWeight?style.fontWeight:"normal",style.fontSize?style.fontSize:"1em",style.fontFamily?style.fontFamily:"sans-serif"].join(" ");var labelRows=style.label.split('\n');var numRows=labelRows.length;if(this.canvas.fillText){this.canvas.font=fontStyle;this.canvas.textAlign=OpenLayers.Renderer.Canvas.LABEL_ALIGN[style.labelAlign[0]]||"center";this.canvas.textBaseline=OpenLayers.Renderer.Canvas.LABEL_ALIGN[style.labelAlign[1]]||"middle";var vfactor=OpenLayers.Renderer.Canvas.LABEL_FACTOR[style.labelAlign[1]];if(vfactor==null){vfactor=-.5;}
var lineHeight=this.canvas.measureText('Mg').height||this.canvas.measureText('xx').width;pt[1]+=lineHeight*vfactor*(numRows-1);for(var i=0;i<numRows;i++){if(style.labelOutlineWidth){this.canvas.save();this.canvas.strokeStyle=style.labelOutlineColor;this.canvas.lineWidth=style.labelOutlineWidth;this.canvas.strokeText(labelRows[i],pt[0],pt[1]+(lineHeight*i)+1);this.canvas.restore();}
this.canvas.fillText(labelRows[i],pt[0],pt[1]+(lineHeight*i));}}else if(this.canvas.mozDrawText){this.canvas.mozTextStyle=fontStyle;var hfactor=OpenLayers.Renderer.Canvas.LABEL_FACTOR[style.labelAlign[0]];if(hfactor==null){hfactor=-.5;}
var vfactor=OpenLayers.Renderer.Canvas.LABEL_FACTOR[style.labelAlign[1]];if(vfactor==null){vfactor=-.5;}
var lineHeight=this.canvas.mozMeasureText('xx');pt[1]+=lineHeight*(1+(vfactor*numRows));for(var i=0;i<numRows;i++){var x=pt[0]+(hfactor*this.canvas.mozMeasureText(labelRows[i]));var y=pt[1]+(i*lineHeight);this.canvas.translate(x,y);this.canvas.mozDrawText(labelRows[i]);this.canvas.translate(-x,-y);}}
this.setCanvasStyle("reset");},getLocalXY:function(point){var resolution=this.getResolution();var extent=this.extent;var x=((point.x-this.featureDx)/resolution+(-extent.left/resolution));var y=((extent.top/resolution)-point.y/resolution);return[x,y];},clear:function(){var height=this.root.height;var width=this.root.width;this.canvas.clearRect(0,0,width,height);this.features={};if(this.hitDetection){this.hitContext.clearRect(0,0,width,height);}},getFeatureIdFromEvent:function(evt){var feature;if(this.hitDetection){if(!this.map.dragging){var xy=evt.xy;var x=xy.x|0;var y=xy.y|0;var data=this.hitContext.getImageData(x,y,1,1).data;if(data[3]===255){var id=data[2]+(256*(data[1]+(256*data[0])));if(id){feature=this.features["OpenLayers.Feature.Vector_"+(id-1+this.hitOverflow)][0];}}}}
return feature;},eraseFeatures:function(features){if(!(OpenLayers.Util.isArray(features))){features=[features];}
for(var i=0;i<features.length;++i){delete this.features[features[i].id];}
this.redraw();},redraw:function(){if(!this.locked){var height=this.root.height;var width=this.root.width;this.canvas.clearRect(0,0,width,height);if(this.hitDetection){this.hitContext.clearRect(0,0,width,height);}
var labelMap=[];var feature,geometry,style;var worldBounds=(this.map.baseLayer&&this.map.baseLayer.wrapDateLine)&&this.map.getMaxExtent();for(var id in this.features){if(!this.features.hasOwnProperty(id)){continue;}
feature=this.features[id][0];geometry=feature.geometry;this.calculateFeatureDx(geometry.getBounds(),worldBounds);style=this.features[id][1];this.drawGeometry(geometry,style,feature.id);if(style.label){labelMap.push([feature,style]);}}
var item;for(var i=0,len=labelMap.length;i<len;++i){item=labelMap[i];this.drawText(item[0].geometry.getCentroid(),item[1]);}}},CLASS_NAME:"OpenLayers.Renderer.Canvas"});OpenLayers.Renderer.Canvas.LABEL_ALIGN={"l":"left","r":"right","t":"top","b":"bottom"};OpenLayers.Renderer.Canvas.LABEL_FACTOR={"l":0,"r":-1,"t":0,"b":-1};OpenLayers.Renderer.Canvas.drawImageScaleFactor=null;OpenLayers.ElementsIndexer=OpenLayers.Class({maxZIndex:null,order:null,indices:null,compare:null,initialize:function(yOrdering){this.compare=yOrdering?OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_Y_ORDER:OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_DRAWING_ORDER;this.clear();},insert:function(newNode){if(this.exists(newNode)){this.remove(newNode);}
var nodeId=newNode.id;this.determineZIndex(newNode);var leftIndex=-1;var rightIndex=this.order.length;var middle;while(rightIndex-leftIndex>1){middle=parseInt((leftIndex+rightIndex)/2);var placement=this.compare(this,newNode,OpenLayers.Util.getElement(this.order[middle]));if(placement>0){leftIndex=middle;}else{rightIndex=middle;}}
this.order.splice(rightIndex,0,nodeId);this.indices[nodeId]=this.getZIndex(newNode);return this.getNextElement(rightIndex);},remove:function(node){var nodeId=node.id;var arrayIndex=OpenLayers.Util.indexOf(this.order,nodeId);if(arrayIndex>=0){this.order.splice(arrayIndex,1);delete this.indices[nodeId];if(this.order.length>0){var lastId=this.order[this.order.length-1];this.maxZIndex=this.indices[lastId];}else{this.maxZIndex=0;}}},clear:function(){this.order=[];this.indices={};this.maxZIndex=0;},exists:function(node){return(this.indices[node.id]!=null);},getZIndex:function(node){return node._style.graphicZIndex;},determineZIndex:function(node){var zIndex=node._style.graphicZIndex;if(zIndex==null){zIndex=this.maxZIndex;node._style.graphicZIndex=zIndex;}else if(zIndex>this.maxZIndex){this.maxZIndex=zIndex;}},getNextElement:function(index){var nextIndex=index+1;if(nextIndex<this.order.length){var nextElement=OpenLayers.Util.getElement(this.order[nextIndex]);if(nextElement==undefined){nextElement=this.getNextElement(nextIndex);}
return nextElement;}else{return null;}},CLASS_NAME:"OpenLayers.ElementsIndexer"});OpenLayers.ElementsIndexer.IndexingMethods={Z_ORDER:function(indexer,newNode,nextNode){var newZIndex=indexer.getZIndex(newNode);var returnVal=0;if(nextNode){var nextZIndex=indexer.getZIndex(nextNode);returnVal=newZIndex-nextZIndex;}
return returnVal;},Z_ORDER_DRAWING_ORDER:function(indexer,newNode,nextNode){var returnVal=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(indexer,newNode,nextNode);if(nextNode&&returnVal==0){returnVal=1;}
return returnVal;},Z_ORDER_Y_ORDER:function(indexer,newNode,nextNode){var returnVal=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(indexer,newNode,nextNode);if(nextNode&&returnVal===0){var result=nextNode._boundsBottom-newNode._boundsBottom;returnVal=(result===0)?1:result;}
return returnVal;}};OpenLayers.Renderer.Elements=OpenLayers.Class(OpenLayers.Renderer,{rendererRoot:null,root:null,vectorRoot:null,textRoot:null,xmlns:null,xOffset:0,indexer:null,BACKGROUND_ID_SUFFIX:"_background",LABEL_ID_SUFFIX:"_label",LABEL_OUTLINE_SUFFIX:"_outline",initialize:function(containerID,options){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.rendererRoot=this.createRenderRoot();this.root=this.createRoot("_root");this.vectorRoot=this.createRoot("_vroot");this.textRoot=this.createRoot("_troot");this.root.appendChild(this.vectorRoot);this.root.appendChild(this.textRoot);this.rendererRoot.appendChild(this.root);this.container.appendChild(this.rendererRoot);if(options&&(options.zIndexing||options.yOrdering)){this.indexer=new OpenLayers.ElementsIndexer(options.yOrdering);}},destroy:function(){this.clear();this.rendererRoot=null;this.root=null;this.xmlns=null;OpenLayers.Renderer.prototype.destroy.apply(this,arguments);},clear:function(){var child;var root=this.vectorRoot;if(root){while(child=root.firstChild){root.removeChild(child);}}
root=this.textRoot;if(root){while(child=root.firstChild){root.removeChild(child);}}
if(this.indexer){this.indexer.clear();}},setExtent:function(extent,resolutionChanged){var coordSysUnchanged=OpenLayers.Renderer.prototype.setExtent.apply(this,arguments);var resolution=this.getResolution();if(this.map.baseLayer&&this.map.baseLayer.wrapDateLine){var rightOfDateLine,ratio=extent.getWidth()/this.map.getExtent().getWidth(),extent=extent.scale(1/ratio),world=this.map.getMaxExtent();if(world.right>extent.left&&world.right<extent.right){rightOfDateLine=true;}else if(world.left>extent.left&&world.left<extent.right){rightOfDateLine=false;}
if(rightOfDateLine!==this.rightOfDateLine||resolutionChanged){coordSysUnchanged=false;this.xOffset=rightOfDateLine===true?world.getWidth()/resolution:0;}
this.rightOfDateLine=rightOfDateLine;}
return coordSysUnchanged;},getNodeType:function(geometry,style){},drawGeometry:function(geometry,style,featureId){var className=geometry.CLASS_NAME;var rendered=true;if((className=="OpenLayers.Geometry.Collection")||(className=="OpenLayers.Geometry.MultiPoint")||(className=="OpenLayers.Geometry.MultiLineString")||(className=="OpenLayers.Geometry.MultiPolygon")){for(var i=0,len=geometry.components.length;i<len;i++){rendered=this.drawGeometry(geometry.components[i],style,featureId)&&rendered;}
return rendered;};rendered=false;var removeBackground=false;if(style.display!="none"){if(style.backgroundGraphic){this.redrawBackgroundNode(geometry.id,geometry,style,featureId);}else{removeBackground=true;}
rendered=this.redrawNode(geometry.id,geometry,style,featureId);}
if(rendered==false){var node=document.getElementById(geometry.id);if(node){if(node._style.backgroundGraphic){removeBackground=true;}
node.parentNode.removeChild(node);}}
if(removeBackground){var node=document.getElementById(geometry.id+this.BACKGROUND_ID_SUFFIX);if(node){node.parentNode.removeChild(node);}}
return rendered;},redrawNode:function(id,geometry,style,featureId){style=this.applyDefaultSymbolizer(style);var node=this.nodeFactory(id,this.getNodeType(geometry,style));node._featureId=featureId;node._boundsBottom=geometry.getBounds().bottom;node._geometryClass=geometry.CLASS_NAME;node._style=style;var drawResult=this.drawGeometryNode(node,geometry,style);if(drawResult===false){return false;}
node=drawResult.node;if(this.indexer){var insert=this.indexer.insert(node);if(insert){this.vectorRoot.insertBefore(node,insert);}else{this.vectorRoot.appendChild(node);}}else{if(node.parentNode!==this.vectorRoot){this.vectorRoot.appendChild(node);}}
this.postDraw(node);return drawResult.complete;},redrawBackgroundNode:function(id,geometry,style,featureId){var backgroundStyle=OpenLayers.Util.extend({},style);backgroundStyle.externalGraphic=backgroundStyle.backgroundGraphic;backgroundStyle.graphicXOffset=backgroundStyle.backgroundXOffset;backgroundStyle.graphicYOffset=backgroundStyle.backgroundYOffset;backgroundStyle.graphicZIndex=backgroundStyle.backgroundGraphicZIndex;backgroundStyle.graphicWidth=backgroundStyle.backgroundWidth||backgroundStyle.graphicWidth;backgroundStyle.graphicHeight=backgroundStyle.backgroundHeight||backgroundStyle.graphicHeight;backgroundStyle.backgroundGraphic=null;backgroundStyle.backgroundXOffset=null;backgroundStyle.backgroundYOffset=null;backgroundStyle.backgroundGraphicZIndex=null;return this.redrawNode(id+this.BACKGROUND_ID_SUFFIX,geometry,backgroundStyle,null);},drawGeometryNode:function(node,geometry,style){style=style||node._style;var options={'isFilled':style.fill===undefined?true:style.fill,'isStroked':style.stroke===undefined?!!style.strokeWidth:style.stroke};var drawn;switch(geometry.CLASS_NAME){case"OpenLayers.Geometry.Point":if(style.graphic===false){options.isFilled=false;options.isStroked=false;}
drawn=this.drawPoint(node,geometry);break;case"OpenLayers.Geometry.LineString":options.isFilled=false;drawn=this.drawLineString(node,geometry);break;case"OpenLayers.Geometry.LinearRing":drawn=this.drawLinearRing(node,geometry);break;case"OpenLayers.Geometry.Polygon":drawn=this.drawPolygon(node,geometry);break;case"OpenLayers.Geometry.Rectangle":drawn=this.drawRectangle(node,geometry);break;default:break;}
node._options=options;if(drawn!=false){return{node:this.setStyle(node,style,options,geometry),complete:drawn};}else{return false;}},postDraw:function(node){},drawPoint:function(node,geometry){},drawLineString:function(node,geometry){},drawLinearRing:function(node,geometry){},drawPolygon:function(node,geometry){},drawRectangle:function(node,geometry){},drawCircle:function(node,geometry){},removeText:function(featureId){var label=document.getElementById(featureId+this.LABEL_ID_SUFFIX);if(label){this.textRoot.removeChild(label);}
var outline=document.getElementById(featureId+this.LABEL_OUTLINE_SUFFIX);if(outline){this.textRoot.removeChild(outline);}},getFeatureIdFromEvent:function(evt){var target=evt.target;var useElement=target&&target.correspondingUseElement;var node=useElement?useElement:(target||evt.srcElement);return node._featureId;},eraseGeometry:function(geometry,featureId){if((geometry.CLASS_NAME=="OpenLayers.Geometry.MultiPoint")||(geometry.CLASS_NAME=="OpenLayers.Geometry.MultiLineString")||(geometry.CLASS_NAME=="OpenLayers.Geometry.MultiPolygon")||(geometry.CLASS_NAME=="OpenLayers.Geometry.Collection")){for(var i=0,len=geometry.components.length;i<len;i++){this.eraseGeometry(geometry.components[i],featureId);}}else{var element=OpenLayers.Util.getElement(geometry.id);if(element&&element.parentNode){if(element.geometry){element.geometry.destroy();element.geometry=null;}
element.parentNode.removeChild(element);if(this.indexer){this.indexer.remove(element);}
if(element._style.backgroundGraphic){var backgroundId=geometry.id+this.BACKGROUND_ID_SUFFIX;var bElem=OpenLayers.Util.getElement(backgroundId);if(bElem&&bElem.parentNode){bElem.parentNode.removeChild(bElem);}}}}},nodeFactory:function(id,type){var node=OpenLayers.Util.getElement(id);if(node){if(!this.nodeTypeCompare(node,type)){node.parentNode.removeChild(node);node=this.nodeFactory(id,type);}}else{node=this.createNode(type,id);}
return node;},nodeTypeCompare:function(node,type){},createNode:function(type,id){},moveRoot:function(renderer){var root=this.root;if(renderer.root.parentNode==this.rendererRoot){root=renderer.root;}
root.parentNode.removeChild(root);renderer.rendererRoot.appendChild(root);},getRenderLayerId:function(){return this.root.parentNode.parentNode.id;},isComplexSymbol:function(graphicName){return(graphicName!="circle")&&!!graphicName;},CLASS_NAME:"OpenLayers.Renderer.Elements"});OpenLayers.Renderer.symbol={"star":[350,75,379,161,469,161,397,215,423,301,350,250,277,301,303,215,231,161,321,161,350,75],"cross":[4,0,6,0,6,4,10,4,10,6,6,6,6,10,4,10,4,6,0,6,0,4,4,4,4,0],"x":[0,0,25,0,50,35,75,0,100,0,65,50,100,100,75,100,50,65,25,100,0,100,35,50,0,0],"square":[0,0,0,1,1,1,1,0,0,0],"triangle":[0,10,10,10,5,0,0,10]};OpenLayers.Renderer.SVG=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"http://www.w3.org/2000/svg",xlinkns:"http://www.w3.org/1999/xlink",MAX_PIXEL:15000,translationParameters:null,symbolMetrics:null,initialize:function(containerID){if(!this.supported()){return;}
OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments);this.translationParameters={x:0,y:0};this.symbolMetrics={};},supported:function(){var svgFeature="http://www.w3.org/TR/SVG11/feature#";return(document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature(svgFeature+"SVG","1.1")||document.implementation.hasFeature(svgFeature+"BasicStructure","1.1")));},inValidRange:function(x,y,xyOnly){var left=x+(xyOnly?0:this.translationParameters.x);var top=y+(xyOnly?0:this.translationParameters.y);return(left>=-this.MAX_PIXEL&&left<=this.MAX_PIXEL&&top>=-this.MAX_PIXEL&&top<=this.MAX_PIXEL);},setExtent:function(extent,resolutionChanged){var coordSysUnchanged=OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var resolution=this.getResolution(),left=-extent.left/resolution,top=extent.top/resolution;if(resolutionChanged){this.left=left;this.top=top;var extentString="0 0 "+this.size.w+" "+this.size.h;this.rendererRoot.setAttributeNS(null,"viewBox",extentString);this.translate(this.xOffset,0);return true;}else{var inRange=this.translate(left-this.left+this.xOffset,top-this.top);if(!inRange){this.setExtent(extent,true);}
return coordSysUnchanged&&inRange;}},translate:function(x,y){if(!this.inValidRange(x,y,true)){return false;}else{var transformString="";if(x||y){transformString="translate("+x+","+y+")";}
this.root.setAttributeNS(null,"transform",transformString);this.translationParameters={x:x,y:y};return true;}},setSize:function(size){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);this.rendererRoot.setAttributeNS(null,"width",this.size.w);this.rendererRoot.setAttributeNS(null,"height",this.size.h);},getNodeType:function(geometry,style){var nodeType=null;switch(geometry.CLASS_NAME){case"OpenLayers.Geometry.Point":if(style.externalGraphic){nodeType="image";}else if(this.isComplexSymbol(style.graphicName)){nodeType="svg";}else{nodeType="circle";}
break;case"OpenLayers.Geometry.Rectangle":nodeType="rect";break;case"OpenLayers.Geometry.LineString":nodeType="polyline";break;case"OpenLayers.Geometry.LinearRing":nodeType="polygon";break;case"OpenLayers.Geometry.Polygon":case"OpenLayers.Geometry.Curve":nodeType="path";break;default:break;}
return nodeType;},setStyle:function(node,style,options){style=style||node._style;options=options||node._options;var r=parseFloat(node.getAttributeNS(null,"r"));var widthFactor=1;var pos;if(node._geometryClass=="OpenLayers.Geometry.Point"&&r){node.style.visibility="";if(style.graphic===false){node.style.visibility="hidden";}else if(style.externalGraphic){pos=this.getPosition(node);if(style.graphicTitle){node.setAttributeNS(null,"title",style.graphicTitle);var titleNode=node.getElementsByTagName("title");if(titleNode.length>0){titleNode[0].firstChild.textContent=style.graphicTitle;}else{var label=this.nodeFactory(null,"title");label.textContent=style.graphicTitle;node.appendChild(label);}}
if(style.graphicWidth&&style.graphicHeight){node.setAttributeNS(null,"preserveAspectRatio","none");}
var width=style.graphicWidth||style.graphicHeight;var height=style.graphicHeight||style.graphicWidth;width=width?width:style.pointRadius*2;height=height?height:style.pointRadius*2;var xOffset=(style.graphicXOffset!=undefined)?style.graphicXOffset:-(0.5*width);var yOffset=(style.graphicYOffset!=undefined)?style.graphicYOffset:-(0.5*height);var opacity=style.graphicOpacity||style.fillOpacity;node.setAttributeNS(null,"x",(pos.x+xOffset).toFixed());node.setAttributeNS(null,"y",(pos.y+yOffset).toFixed());node.setAttributeNS(null,"width",width);node.setAttributeNS(null,"height",height);node.setAttributeNS(this.xlinkns,"href",style.externalGraphic);node.setAttributeNS(null,"style","opacity: "+opacity);node.onclick=OpenLayers.Renderer.SVG.preventDefault;}else if(this.isComplexSymbol(style.graphicName)){var offset=style.pointRadius*3;var size=offset*2;var src=this.importSymbol(style.graphicName);pos=this.getPosition(node);widthFactor=this.symbolMetrics[src.id][0]*3/size;var parent=node.parentNode;var nextSibling=node.nextSibling;if(parent){parent.removeChild(node);}
node.firstChild&&node.removeChild(node.firstChild);node.appendChild(src.firstChild.cloneNode(true));node.setAttributeNS(null,"viewBox",src.getAttributeNS(null,"viewBox"));node.setAttributeNS(null,"width",size);node.setAttributeNS(null,"height",size);node.setAttributeNS(null,"x",pos.x-offset);node.setAttributeNS(null,"y",pos.y-offset);if(nextSibling){parent.insertBefore(node,nextSibling);}else if(parent){parent.appendChild(node);}}else{node.setAttributeNS(null,"r",style.pointRadius);}
var rotation=style.rotation;if((rotation!==undefined||node._rotation!==undefined)&&pos){node._rotation=rotation;rotation|=0;if(node.nodeName!=="svg"){node.setAttributeNS(null,"transform","rotate("+rotation+" "+pos.x+" "+
pos.y+")");}else{var metrics=this.symbolMetrics[src.id];node.firstChild.setAttributeNS(null,"transform","rotate("
+rotation+" "
+metrics[1]+" "
+metrics[2]+")");}}}
if(options.isFilled){node.setAttributeNS(null,"fill",style.fillColor);node.setAttributeNS(null,"fill-opacity",style.fillOpacity);}else{node.setAttributeNS(null,"fill","none");}
if(options.isStroked){node.setAttributeNS(null,"stroke",style.strokeColor);node.setAttributeNS(null,"stroke-opacity",style.strokeOpacity);node.setAttributeNS(null,"stroke-width",style.strokeWidth*widthFactor);node.setAttributeNS(null,"stroke-linecap",style.strokeLinecap||"round");node.setAttributeNS(null,"stroke-linejoin","round");style.strokeDashstyle&&node.setAttributeNS(null,"stroke-dasharray",this.dashStyle(style,widthFactor));}else{node.setAttributeNS(null,"stroke","none");}
if(style.pointerEvents){node.setAttributeNS(null,"pointer-events",style.pointerEvents);}
if(style.cursor!=null){node.setAttributeNS(null,"cursor",style.cursor);}
return node;},dashStyle:function(style,widthFactor){var w=style.strokeWidth*widthFactor;var str=style.strokeDashstyle;switch(str){case'solid':return'none';case'dot':return[1,4*w].join();case'dash':return[4*w,4*w].join();case'dashdot':return[4*w,4*w,1,4*w].join();case'longdash':return[8*w,4*w].join();case'longdashdot':return[8*w,4*w,1,4*w].join();default:return OpenLayers.String.trim(str).replace(/\s+/g,",");}},createNode:function(type,id){var node=document.createElementNS(this.xmlns,type);if(id){node.setAttributeNS(null,"id",id);}
return node;},nodeTypeCompare:function(node,type){return(type==node.nodeName);},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_svgRoot","svg");},createRoot:function(suffix){return this.nodeFactory(this.container.id+suffix,"g");},createDefs:function(){var defs=this.nodeFactory(this.container.id+"_defs","defs");this.rendererRoot.appendChild(defs);return defs;},drawPoint:function(node,geometry){return this.drawCircle(node,geometry,1);},drawCircle:function(node,geometry,radius){var resolution=this.getResolution();var x=((geometry.x-this.featureDx)/resolution+this.left);var y=(this.top-geometry.y/resolution);if(this.inValidRange(x,y)){node.setAttributeNS(null,"cx",x);node.setAttributeNS(null,"cy",y);node.setAttributeNS(null,"r",radius);return node;}else{return false;}},drawLineString:function(node,geometry){var componentsResult=this.getComponentsString(geometry.components);if(componentsResult.path){node.setAttributeNS(null,"points",componentsResult.path);return(componentsResult.complete?node:null);}else{return false;}},drawLinearRing:function(node,geometry){var componentsResult=this.getComponentsString(geometry.components);if(componentsResult.path){node.setAttributeNS(null,"points",componentsResult.path);return(componentsResult.complete?node:null);}else{return false;}},drawPolygon:function(node,geometry){var d="";var draw=true;var complete=true;var linearRingResult,path;for(var j=0,len=geometry.components.length;j<len;j++){d+=" M";linearRingResult=this.getComponentsString(geometry.components[j].components," ");path=linearRingResult.path;if(path){d+=" "+path;complete=linearRingResult.complete&&complete;}else{draw=false;}}
d+=" z";if(draw){node.setAttributeNS(null,"d",d);node.setAttributeNS(null,"fill-rule","evenodd");return complete?node:null;}else{return false;}},drawRectangle:function(node,geometry){var resolution=this.getResolution();var x=((geometry.x-this.featureDx)/resolution+this.left);var y=(this.top-geometry.y/resolution);if(this.inValidRange(x,y)){node.setAttributeNS(null,"x",x);node.setAttributeNS(null,"y",y);node.setAttributeNS(null,"width",geometry.width/resolution);node.setAttributeNS(null,"height",geometry.height/resolution);return node;}else{return false;}},drawText:function(featureId,style,location){var drawOutline=(!!style.labelOutlineWidth);if(drawOutline){var outlineStyle=OpenLayers.Util.extend({},style);outlineStyle.fontColor=outlineStyle.labelOutlineColor;outlineStyle.fontStrokeColor=outlineStyle.labelOutlineColor;outlineStyle.fontStrokeWidth=style.labelOutlineWidth;delete outlineStyle.labelOutlineWidth;this.drawText(featureId,outlineStyle,location);}
var resolution=this.getResolution();var x=((location.x-this.featureDx)/resolution+this.left);var y=(location.y/resolution-this.top);var suffix=(drawOutline)?this.LABEL_OUTLINE_SUFFIX:this.LABEL_ID_SUFFIX;var label=this.nodeFactory(featureId+suffix,"text");label.setAttributeNS(null,"x",x);label.setAttributeNS(null,"y",-y);if(style.fontColor){label.setAttributeNS(null,"fill",style.fontColor);}
if(style.fontStrokeColor){label.setAttributeNS(null,"stroke",style.fontStrokeColor);}
if(style.fontStrokeWidth){label.setAttributeNS(null,"stroke-width",style.fontStrokeWidth);}
if(style.fontOpacity){label.setAttributeNS(null,"opacity",style.fontOpacity);}
if(style.fontFamily){label.setAttributeNS(null,"font-family",style.fontFamily);}
if(style.fontSize){label.setAttributeNS(null,"font-size",style.fontSize);}
if(style.fontWeight){label.setAttributeNS(null,"font-weight",style.fontWeight);}
if(style.fontStyle){label.setAttributeNS(null,"font-style",style.fontStyle);}
if(style.labelSelect===true){label.setAttributeNS(null,"pointer-events","visible");label._featureId=featureId;}else{label.setAttributeNS(null,"pointer-events","none");}
var align=style.labelAlign||OpenLayers.Renderer.defaultSymbolizer.labelAlign;label.setAttributeNS(null,"text-anchor",OpenLayers.Renderer.SVG.LABEL_ALIGN[align[0]]||"middle");if(OpenLayers.IS_GECKO===true){label.setAttributeNS(null,"dominant-baseline",OpenLayers.Renderer.SVG.LABEL_ALIGN[align[1]]||"central");}
var labelRows=style.label.split('\n');var numRows=labelRows.length;while(label.childNodes.length>numRows){label.removeChild(label.lastChild);}
for(var i=0;i<numRows;i++){var tspan=this.nodeFactory(featureId+suffix+"_tspan_"+i,"tspan");if(style.labelSelect===true){tspan._featureId=featureId;tspan._geometry=location;tspan._geometryClass=location.CLASS_NAME;}
if(OpenLayers.IS_GECKO===false){tspan.setAttributeNS(null,"baseline-shift",OpenLayers.Renderer.SVG.LABEL_VSHIFT[align[1]]||"-35%");}
tspan.setAttribute("x",x);if(i==0){var vfactor=OpenLayers.Renderer.SVG.LABEL_VFACTOR[align[1]];if(vfactor==null){vfactor=-.5;}
tspan.setAttribute("dy",(vfactor*(numRows-1))+"em");}else{tspan.setAttribute("dy","1em");}
tspan.textContent=(labelRows[i]==='')?' ':labelRows[i];if(!tspan.parentNode){label.appendChild(tspan);}}
if(!label.parentNode){this.textRoot.appendChild(label);}},getComponentsString:function(components,separator){var renderCmp=[];var complete=true;var len=components.length;var strings=[];var str,component;for(var i=0;i<len;i++){component=components[i];renderCmp.push(component);str=this.getShortString(component);if(str){strings.push(str);}else{if(i>0){if(this.getShortString(components[i-1])){strings.push(this.clipLine(components[i],components[i-1]));}}
if(i<len-1){if(this.getShortString(components[i+1])){strings.push(this.clipLine(components[i],components[i+1]));}}
complete=false;}}
return{path:strings.join(separator||","),complete:complete};},clipLine:function(badComponent,goodComponent){if(goodComponent.equals(badComponent)){return"";}
var resolution=this.getResolution();var maxX=this.MAX_PIXEL-this.translationParameters.x;var maxY=this.MAX_PIXEL-this.translationParameters.y;var x1=(goodComponent.x-this.featureDx)/resolution+this.left;var y1=this.top-goodComponent.y/resolution;var x2=(badComponent.x-this.featureDx)/resolution+this.left;var y2=this.top-badComponent.y/resolution;var k;if(x2<-maxX||x2>maxX){k=(y2-y1)/(x2-x1);x2=x2<0?-maxX:maxX;y2=y1+(x2-x1)*k;}
if(y2<-maxY||y2>maxY){k=(x2-x1)/(y2-y1);y2=y2<0?-maxY:maxY;x2=x1+(y2-y1)*k;}
return x2+","+y2;},getShortString:function(point){var resolution=this.getResolution();var x=((point.x-this.featureDx)/resolution+this.left);var y=(this.top-point.y/resolution);if(this.inValidRange(x,y)){return x+","+y;}else{return false;}},getPosition:function(node){return({x:parseFloat(node.getAttributeNS(null,"cx")),y:parseFloat(node.getAttributeNS(null,"cy"))});},importSymbol:function(graphicName){if(!this.defs){this.defs=this.createDefs();}
var id=this.container.id+"-"+graphicName;var existing=document.getElementById(id);if(existing!=null){return existing;}
var symbol=OpenLayers.Renderer.symbol[graphicName];if(!symbol){throw new Error(graphicName+' is not a valid symbol name');}
var symbolNode=this.nodeFactory(id,"symbol");var node=this.nodeFactory(null,"polygon");symbolNode.appendChild(node);var symbolExtent=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0);var points=[];var x,y;for(var i=0;i<symbol.length;i=i+2){x=symbol[i];y=symbol[i+1];symbolExtent.left=Math.min(symbolExtent.left,x);symbolExtent.bottom=Math.min(symbolExtent.bottom,y);symbolExtent.right=Math.max(symbolExtent.right,x);symbolExtent.top=Math.max(symbolExtent.top,y);points.push(x,",",y);}
node.setAttributeNS(null,"points",points.join(" "));var width=symbolExtent.getWidth();var height=symbolExtent.getHeight();var viewBox=[symbolExtent.left-width,symbolExtent.bottom-height,width*3,height*3];symbolNode.setAttributeNS(null,"viewBox",viewBox.join(" "));this.symbolMetrics[id]=[Math.max(width,height),symbolExtent.getCenterLonLat().lon,symbolExtent.getCenterLonLat().lat];this.defs.appendChild(symbolNode);return symbolNode;},getFeatureIdFromEvent:function(evt){var featureId=OpenLayers.Renderer.Elements.prototype.getFeatureIdFromEvent.apply(this,arguments);if(!featureId){var target=evt.target;featureId=target.parentNode&&target!=this.rendererRoot?target.parentNode._featureId:undefined;}
return featureId;},CLASS_NAME:"OpenLayers.Renderer.SVG"});OpenLayers.Renderer.SVG.LABEL_ALIGN={"l":"start","r":"end","b":"bottom","t":"hanging"};OpenLayers.Renderer.SVG.LABEL_VSHIFT={"t":"-70%","b":"0"};OpenLayers.Renderer.SVG.LABEL_VFACTOR={"t":0,"b":-1};OpenLayers.Renderer.SVG.preventDefault=function(e){e.preventDefault&&e.preventDefault();};OpenLayers.Renderer.VML=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"urn:schemas-microsoft-com:vml",symbolCache:{},offset:null,initialize:function(containerID){if(!this.supported()){return;}
if(!document.namespaces.olv){document.namespaces.add("olv",this.xmlns);var style=document.createStyleSheet();var shapes=['shape','rect','oval','fill','stroke','imagedata','group','textbox'];for(var i=0,len=shapes.length;i<len;i++){style.addRule('olv\\:'+shapes[i],"behavior: url(#default#VML); "+"position: absolute; display: inline-block;");}}
OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments);},supported:function(){return!!(document.namespaces);},setExtent:function(extent,resolutionChanged){var coordSysUnchanged=OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var resolution=this.getResolution();var left=(extent.left/resolution)|0;var top=(extent.top/resolution-this.size.h)|0;if(resolutionChanged||!this.offset){this.offset={x:left,y:top};left=0;top=0;}else{left=left-this.offset.x;top=top-this.offset.y;}
var org=(left-this.xOffset)+" "+top;this.root.coordorigin=org;var roots=[this.root,this.vectorRoot,this.textRoot];var root;for(var i=0,len=roots.length;i<len;++i){root=roots[i];var size=this.size.w+" "+this.size.h;root.coordsize=size;}
this.root.style.flip="y";return coordSysUnchanged;},setSize:function(size){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);var roots=[this.rendererRoot,this.root,this.vectorRoot,this.textRoot];var w=this.size.w+"px";var h=this.size.h+"px";var root;for(var i=0,len=roots.length;i<len;++i){root=roots[i];root.style.width=w;root.style.height=h;}},getNodeType:function(geometry,style){var nodeType=null;switch(geometry.CLASS_NAME){case"OpenLayers.Geometry.Point":if(style.externalGraphic){nodeType="olv:rect";}else if(this.isComplexSymbol(style.graphicName)){nodeType="olv:shape";}else{nodeType="olv:oval";}
break;case"OpenLayers.Geometry.Rectangle":nodeType="olv:rect";break;case"OpenLayers.Geometry.LineString":case"OpenLayers.Geometry.LinearRing":case"OpenLayers.Geometry.Polygon":case"OpenLayers.Geometry.Curve":nodeType="olv:shape";break;default:break;}
return nodeType;},setStyle:function(node,style,options,geometry){style=style||node._style;options=options||node._options;var fillColor=style.fillColor;if(node._geometryClass==="OpenLayers.Geometry.Point"){if(style.externalGraphic){options.isFilled=true;if(style.graphicTitle){node.title=style.graphicTitle;}
var width=style.graphicWidth||style.graphicHeight;var height=style.graphicHeight||style.graphicWidth;width=width?width:style.pointRadius*2;height=height?height:style.pointRadius*2;var resolution=this.getResolution();var xOffset=(style.graphicXOffset!=undefined)?style.graphicXOffset:-(0.5*width);var yOffset=(style.graphicYOffset!=undefined)?style.graphicYOffset:-(0.5*height);node.style.left=((((geometry.x-this.featureDx)/resolution-this.offset.x)+xOffset)|0)+"px";node.style.top=(((geometry.y/resolution-this.offset.y)-(yOffset+height))|0)+"px";node.style.width=width+"px";node.style.height=height+"px";node.style.flip="y";fillColor="none";options.isStroked=false;}else if(this.isComplexSymbol(style.graphicName)){var cache=this.importSymbol(style.graphicName);node.path=cache.path;node.coordorigin=cache.left+","+cache.bottom;var size=cache.size;node.coordsize=size+","+size;this.drawCircle(node,geometry,style.pointRadius);node.style.flip="y";}else{this.drawCircle(node,geometry,style.pointRadius);}}
if(options.isFilled){node.fillcolor=fillColor;}else{node.filled="false";}
var fills=node.getElementsByTagName("fill");var fill=(fills.length==0)?null:fills[0];if(!options.isFilled){if(fill){node.removeChild(fill);}}else{if(!fill){fill=this.createNode('olv:fill',node.id+"_fill");}
fill.opacity=style.fillOpacity;if(node._geometryClass==="OpenLayers.Geometry.Point"&&style.externalGraphic){if(style.graphicOpacity){fill.opacity=style.graphicOpacity;}
fill.src=style.externalGraphic;fill.type="frame";if(!(style.graphicWidth&&style.graphicHeight)){fill.aspect="atmost";}}
if(fill.parentNode!=node){node.appendChild(fill);}}
var rotation=style.rotation;if((rotation!==undefined||node._rotation!==undefined)){node._rotation=rotation;if(style.externalGraphic){this.graphicRotate(node,xOffset,yOffset,style);fill.opacity=0;}else if(node._geometryClass==="OpenLayers.Geometry.Point"){node.style.rotation=rotation||0;}}
var strokes=node.getElementsByTagName("stroke");var stroke=(strokes.length==0)?null:strokes[0];if(!options.isStroked){node.stroked=false;if(stroke){stroke.on=false;}}else{if(!stroke){stroke=this.createNode('olv:stroke',node.id+"_stroke");node.appendChild(stroke);}
stroke.on=true;stroke.color=style.strokeColor;stroke.weight=style.strokeWidth+"px";stroke.opacity=style.strokeOpacity;stroke.endcap=style.strokeLinecap=='butt'?'flat':(style.strokeLinecap||'round');if(style.strokeDashstyle){stroke.dashstyle=this.dashStyle(style);}}
if(style.cursor!="inherit"&&style.cursor!=null){node.style.cursor=style.cursor;}
return node;},graphicRotate:function(node,xOffset,yOffset,style){var style=style||node._style;var rotation=style.rotation||0;var aspectRatio,size;if(!(style.graphicWidth&&style.graphicHeight)){var img=new Image();img.onreadystatechange=OpenLayers.Function.bind(function(){if(img.readyState=="complete"||img.readyState=="interactive"){aspectRatio=img.width/img.height;size=Math.max(style.pointRadius*2,style.graphicWidth||0,style.graphicHeight||0);xOffset=xOffset*aspectRatio;style.graphicWidth=size*aspectRatio;style.graphicHeight=size;this.graphicRotate(node,xOffset,yOffset,style);}},this);img.src=style.externalGraphic;return;}else{size=Math.max(style.graphicWidth,style.graphicHeight);aspectRatio=style.graphicWidth/style.graphicHeight;}
var width=Math.round(style.graphicWidth||size*aspectRatio);var height=Math.round(style.graphicHeight||size);node.style.width=width+"px";node.style.height=height+"px";var image=document.getElementById(node.id+"_image");if(!image){image=this.createNode("olv:imagedata",node.id+"_image");node.appendChild(image);}
image.style.width=width+"px";image.style.height=height+"px";image.src=style.externalGraphic;image.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader("+"src='', sizingMethod='scale')";var rot=rotation*Math.PI/180;var sintheta=Math.sin(rot);var costheta=Math.cos(rot);var filter="progid:DXImageTransform.Microsoft.Matrix(M11="+costheta+",M12="+(-sintheta)+",M21="+sintheta+",M22="+costheta+",SizingMethod='auto expand')\n";var opacity=style.graphicOpacity||style.fillOpacity;if(opacity&&opacity!=1){filter+="progid:DXImageTransform.Microsoft.BasicImage(opacity="+
opacity+")\n";}
node.style.filter=filter;var centerPoint=new OpenLayers.Geometry.Point(-xOffset,-yOffset);var imgBox=new OpenLayers.Bounds(0,0,width,height).toGeometry();imgBox.rotate(style.rotation,centerPoint);var imgBounds=imgBox.getBounds();node.style.left=Math.round(parseInt(node.style.left)+imgBounds.left)+"px";node.style.top=Math.round(parseInt(node.style.top)-imgBounds.bottom)+"px";},postDraw:function(node){node.style.visibility="visible";var fillColor=node._style.fillColor;var strokeColor=node._style.strokeColor;if(fillColor=="none"&&node.fillcolor!=fillColor){node.fillcolor=fillColor;}
if(strokeColor=="none"&&node.strokecolor!=strokeColor){node.strokecolor=strokeColor;}},setNodeDimension:function(node,geometry){var bbox=geometry.getBounds();if(bbox){var resolution=this.getResolution();var scaledBox=new OpenLayers.Bounds(((bbox.left-this.featureDx)/resolution-this.offset.x)|0,(bbox.bottom/resolution-this.offset.y)|0,((bbox.right-this.featureDx)/resolution-this.offset.x)|0,(bbox.top/resolution-this.offset.y)|0);node.style.left=scaledBox.left+"px";node.style.top=scaledBox.top+"px";node.style.width=scaledBox.getWidth()+"px";node.style.height=scaledBox.getHeight()+"px";node.coordorigin=scaledBox.left+" "+scaledBox.top;node.coordsize=scaledBox.getWidth()+" "+scaledBox.getHeight();}},dashStyle:function(style){var dash=style.strokeDashstyle;switch(dash){case'solid':case'dot':case'dash':case'dashdot':case'longdash':case'longdashdot':return dash;default:var parts=dash.split(/[ ,]/);if(parts.length==2){if(1*parts[0]>=2*parts[1]){return"longdash";}
return(parts[0]==1||parts[1]==1)?"dot":"dash";}else if(parts.length==4){return(1*parts[0]>=2*parts[1])?"longdashdot":"dashdot";}
return"solid";}},createNode:function(type,id){var node=document.createElement(type);if(id){node.id=id;}
node.unselectable='on';node.onselectstart=OpenLayers.Function.False;return node;},nodeTypeCompare:function(node,type){var subType=type;var splitIndex=subType.indexOf(":");if(splitIndex!=-1){subType=subType.substr(splitIndex+1);}
var nodeName=node.nodeName;splitIndex=nodeName.indexOf(":");if(splitIndex!=-1){nodeName=nodeName.substr(splitIndex+1);}
return(subType==nodeName);},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_vmlRoot","div");},createRoot:function(suffix){return this.nodeFactory(this.container.id+suffix,"olv:group");},drawPoint:function(node,geometry){return this.drawCircle(node,geometry,1);},drawCircle:function(node,geometry,radius){if(!isNaN(geometry.x)&&!isNaN(geometry.y)){var resolution=this.getResolution();node.style.left=((((geometry.x-this.featureDx)/resolution-this.offset.x)|0)-radius)+"px";node.style.top=(((geometry.y/resolution-this.offset.y)|0)-radius)+"px";var diameter=radius*2;node.style.width=diameter+"px";node.style.height=diameter+"px";return node;}
return false;},drawLineString:function(node,geometry){return this.drawLine(node,geometry,false);},drawLinearRing:function(node,geometry){return this.drawLine(node,geometry,true);},drawLine:function(node,geometry,closeLine){this.setNodeDimension(node,geometry);var resolution=this.getResolution();var numComponents=geometry.components.length;var parts=new Array(numComponents);var comp,x,y;for(var i=0;i<numComponents;i++){comp=geometry.components[i];x=((comp.x-this.featureDx)/resolution-this.offset.x)|0;y=(comp.y/resolution-this.offset.y)|0;parts[i]=" "+x+","+y+" l ";}
var end=(closeLine)?" x e":" e";node.path="m"+parts.join("")+end;return node;},drawPolygon:function(node,geometry){this.setNodeDimension(node,geometry);var resolution=this.getResolution();var path=[];var j,jj,points,area,first,second,i,ii,comp,pathComp,x,y;for(j=0,jj=geometry.components.length;j<jj;j++){path.push("m");points=geometry.components[j].components;area=(j===0);first=null;second=null;for(i=0,ii=points.length;i<ii;i++){comp=points[i];x=((comp.x-this.featureDx)/resolution-this.offset.x)|0;y=(comp.y/resolution-this.offset.y)|0;pathComp=" "+x+","+y;path.push(pathComp);if(i==0){path.push(" l");}
if(!area){if(!first){first=pathComp;}else if(first!=pathComp){if(!second){second=pathComp;}else if(second!=pathComp){area=true;}}}}
path.push(area?" x ":" ");}
path.push("e");node.path=path.join("");return node;},drawRectangle:function(node,geometry){var resolution=this.getResolution();node.style.left=(((geometry.x-this.featureDx)/resolution-this.offset.x)|0)+"px";node.style.top=((geometry.y/resolution-this.offset.y)|0)+"px";node.style.width=((geometry.width/resolution)|0)+"px";node.style.height=((geometry.height/resolution)|0)+"px";return node;},drawText:function(featureId,style,location){var label=this.nodeFactory(featureId+this.LABEL_ID_SUFFIX,"olv:rect");var textbox=this.nodeFactory(featureId+this.LABEL_ID_SUFFIX+"_textbox","olv:textbox");var resolution=this.getResolution();label.style.left=(((location.x-this.featureDx)/resolution-this.offset.x)|0)+"px";label.style.top=((location.y/resolution-this.offset.y)|0)+"px";label.style.flip="y";textbox.innerText=style.label;if(style.cursor!="inherit"&&style.cursor!=null){textbox.style.cursor=style.cursor;}
if(style.fontColor){textbox.style.color=style.fontColor;}
if(style.fontOpacity){textbox.style.filter='alpha(opacity='+(style.fontOpacity*100)+')';}
if(style.fontFamily){textbox.style.fontFamily=style.fontFamily;}
if(style.fontSize){textbox.style.fontSize=style.fontSize;}
if(style.fontWeight){textbox.style.fontWeight=style.fontWeight;}
if(style.fontStyle){textbox.style.fontStyle=style.fontStyle;}
if(style.labelSelect===true){label._featureId=featureId;textbox._featureId=featureId;textbox._geometry=location;textbox._geometryClass=location.CLASS_NAME;}
textbox.style.whiteSpace="nowrap";textbox.inset="1px,0px,0px,0px";if(!label.parentNode){label.appendChild(textbox);this.textRoot.appendChild(label);}
var align=style.labelAlign||"cm";if(align.length==1){align+="m";}
var xshift=textbox.clientWidth*(OpenLayers.Renderer.VML.LABEL_SHIFT[align.substr(0,1)]);var yshift=textbox.clientHeight*(OpenLayers.Renderer.VML.LABEL_SHIFT[align.substr(1,1)]);label.style.left=parseInt(label.style.left)-xshift-1+"px";label.style.top=parseInt(label.style.top)+yshift+"px";},moveRoot:function(renderer){var layer=this.map.getLayer(renderer.container.id);if(layer instanceof OpenLayers.Layer.Vector.RootContainer){layer=this.map.getLayer(this.container.id);}
layer&&layer.renderer.clear();OpenLayers.Renderer.Elements.prototype.moveRoot.apply(this,arguments);layer&&layer.redraw();},importSymbol:function(graphicName){var id=this.container.id+"-"+graphicName;var cache=this.symbolCache[id];if(cache){return cache;}
var symbol=OpenLayers.Renderer.symbol[graphicName];if(!symbol){throw new Error(graphicName+' is not a valid symbol name');}
var symbolExtent=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0);var pathitems=["m"];for(var i=0;i<symbol.length;i=i+2){var x=symbol[i];var y=symbol[i+1];symbolExtent.left=Math.min(symbolExtent.left,x);symbolExtent.bottom=Math.min(symbolExtent.bottom,y);symbolExtent.right=Math.max(symbolExtent.right,x);symbolExtent.top=Math.max(symbolExtent.top,y);pathitems.push(x);pathitems.push(y);if(i==0){pathitems.push("l");}}
pathitems.push("x e");var path=pathitems.join(" ");var diff=(symbolExtent.getWidth()-symbolExtent.getHeight())/2;if(diff>0){symbolExtent.bottom=symbolExtent.bottom-diff;symbolExtent.top=symbolExtent.top+diff;}else{symbolExtent.left=symbolExtent.left+diff;symbolExtent.right=symbolExtent.right-diff;}
cache={path:path,size:symbolExtent.getWidth(),left:symbolExtent.left,bottom:symbolExtent.bottom};this.symbolCache[id]=cache;return cache;},CLASS_NAME:"OpenLayers.Renderer.VML"});OpenLayers.Renderer.VML.LABEL_SHIFT={"l":0,"c":.5,"r":1,"t":0,"m":.5,"b":1};OpenLayers.Tile=OpenLayers.Class({events:null,eventListeners:null,id:null,layer:null,url:null,bounds:null,size:null,position:null,isLoading:false,initialize:function(layer,position,bounds,url,size,options){this.layer=layer;this.position=position.clone();this.setBounds(bounds);this.url=url;if(size){this.size=size.clone();}
this.id=OpenLayers.Util.createUniqueID("Tile_");OpenLayers.Util.extend(this,options);this.events=new OpenLayers.Events(this);if(this.eventListeners instanceof Object){this.events.on(this.eventListeners);}},unload:function(){if(this.isLoading){this.isLoading=false;this.events.triggerEvent("unload");}},destroy:function(){this.layer=null;this.bounds=null;this.size=null;this.position=null;if(this.eventListeners){this.events.un(this.eventListeners);}
this.events.destroy();this.eventListeners=null;this.events=null;},draw:function(){this.clear();return this.shouldDraw();},shouldDraw:function(){var withinMaxExtent=false,maxExtent=this.layer.maxExtent;if(maxExtent){var map=this.layer.map;var worldBounds=map.baseLayer.wrapDateLine&&map.getMaxExtent();if(this.bounds.intersectsBounds(maxExtent,{inclusive:false,worldBounds:worldBounds})){withinMaxExtent=true;}}
return withinMaxExtent||this.layer.displayOutsideMaxExtent;},setBounds:function(bounds){bounds=bounds.clone();if(this.layer.map.baseLayer.wrapDateLine){var worldExtent=this.layer.map.getMaxExtent(),tolerance=this.layer.map.getResolution();bounds=bounds.wrapDateLine(worldExtent,{leftTolerance:tolerance,rightTolerance:tolerance});}
this.bounds=bounds;},moveTo:function(bounds,position,redraw){if(redraw==null){redraw=true;}
this.setBounds(bounds);this.position=position.clone();if(redraw){this.draw();}},clear:function(draw){},CLASS_NAME:"OpenLayers.Tile"});OpenLayers.Tile.Image=OpenLayers.Class(OpenLayers.Tile,{url:null,imgDiv:null,frame:null,imageReloadAttempts:null,layerAlphaHack:null,asyncRequestId:null,blankImageUrl:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAQAIBRAA7",maxGetUrlLength:null,initialize:function(layer,position,bounds,url,size,options){OpenLayers.Tile.prototype.initialize.apply(this,arguments);this.url=url;this.layerAlphaHack=this.layer.alpha&&OpenLayers.Util.alphaHack();if(this.maxGetUrlLength!=null||this.layer.gutter||this.layerAlphaHack){this.frame=document.createElement("div");this.frame.style.position="absolute";this.frame.style.overflow="hidden";}
if(this.maxGetUrlLength!=null){OpenLayers.Util.extend(this,OpenLayers.Tile.Image.IFrame);}},destroy:function(){if(this.imgDiv){this.clear();this.imgDiv=null;this.frame=null;}
this.asyncRequestId=null;OpenLayers.Tile.prototype.destroy.apply(this,arguments);},draw:function(){var drawn=OpenLayers.Tile.prototype.draw.apply(this,arguments);if(drawn){if(this.layer!=this.layer.map.baseLayer&&this.layer.reproject){this.bounds=this.getBoundsFromBaseLayer(this.position);}
if(this.isLoading){this.events.triggerEvent("reload");}else{this.isLoading=true;this.events.triggerEvent("loadstart");}
this.positionTile();this.renderTile();}else{this.unload();}
return drawn;},renderTile:function(){this.layer.div.appendChild(this.getTile());if(this.layer.async){var id=this.asyncRequestId=(this.asyncRequestId||0)+1;this.layer.getURLasync(this.bounds,function(url){if(id==this.asyncRequestId){this.url=url;this.initImage();}},this);}else{this.url=this.layer.getURL(this.bounds);this.initImage();}},positionTile:function(){var style=this.getTile().style;style.left=this.position.x+"%";style.top=this.position.y+"%";style.width=this.size.w+"%";style.height=this.size.h+"%";},clear:function(){var img=this.imgDiv;if(img){OpenLayers.Event.stopObservingElement(img);var tile=this.getTile();if(tile.parentNode===this.layer.div){this.layer.div.removeChild(tile);}
this.setImgSrc();if(this.layerAlphaHack===true){img.style.filter="";}
OpenLayers.Element.removeClass(img,"olImageLoadError");}},getImage:function(){if(!this.imgDiv){this.imgDiv=document.createElement("img");this.imgDiv.className="olTileImage";this.imgDiv.galleryImg="no";var style=this.imgDiv.style;if(this.layer.gutter){var left=this.layer.gutter/this.layer.tileSize.w*100;var top=this.layer.gutter/this.layer.tileSize.h*100;style.left=-left+"%";style.top=-top+"%";style.width=(2*left+100)+"%";style.height=(2*top+100)+"%";}else{style.width="100%";style.height="100%";}
style.visibility="hidden";style.opacity=0;if(this.layer.opacity<1){style.filter='alpha(opacity='+
(this.layer.opacity*100)+')';}
style.position="absolute";if(this.layerAlphaHack){style.paddingTop=style.height;style.height="0";style.width="100%";}
if(this.frame){this.frame.appendChild(this.imgDiv);}}
return this.imgDiv;},initImage:function(){var img=this.getImage();if(this.url&&img.getAttribute("src")==this.url){this.onImageLoad();}else{var load=OpenLayers.Function.bind(function(){OpenLayers.Event.stopObservingElement(img);OpenLayers.Event.observe(img,"load",OpenLayers.Function.bind(this.onImageLoad,this));OpenLayers.Event.observe(img,"error",OpenLayers.Function.bind(this.onImageError,this));this.imageReloadAttempts=0;this.setImgSrc(this.url);},this);if(img.getAttribute("src")==this.blankImageUrl){load();}else{OpenLayers.Event.observe(img,"load",load);OpenLayers.Event.observe(img,"error",load);img.src=this.blankImageUrl;}}},setImgSrc:function(url){var img=this.imgDiv;img.style.visibility='hidden';img.style.opacity=0;if(url){img.src=url;}},getTile:function(){return this.frame?this.frame:this.getImage();},createBackBuffer:function(){if(!this.imgDiv||this.isLoading){return;}
var backBuffer;if(this.frame){backBuffer=this.frame.cloneNode(false);backBuffer.appendChild(this.imgDiv);}else{backBuffer=this.imgDiv;}
this.imgDiv=null;return backBuffer;},onImageLoad:function(){var img=this.imgDiv;OpenLayers.Event.stopObservingElement(img);img.style.visibility='inherit';img.style.opacity=this.layer.opacity;this.isLoading=false;this.events.triggerEvent("loadend");if(parseFloat(navigator.appVersion.split("MSIE")[1])<7&&this.layer&&this.layer.div){var span=document.createElement("span");span.style.display="none";var layerDiv=this.layer.div;layerDiv.appendChild(span);window.setTimeout(function(){span.parentNode===layerDiv&&span.parentNode.removeChild(span);},0);}
if(this.layerAlphaHack===true){img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+
img.src+"', sizingMethod='scale')";}},onImageError:function(){var img=this.imgDiv;if(img.src!=null){this.imageReloadAttempts++;if(this.imageReloadAttempts<=OpenLayers.IMAGE_RELOAD_ATTEMPTS){this.setImgSrc(this.layer.getURL(this.bounds));}else{OpenLayers.Element.addClass(img,"olImageLoadError");this.onImageLoad();}}},CLASS_NAME:"OpenLayers.Tile.Image"});Ext.namespace("GeoExt");GeoExt.Action=Ext.extend(Ext.Action,{control:null,activateOnEnable:false,deactivateOnDisable:false,map:null,uScope:null,uHandler:null,uToggleHandler:null,uCheckHandler:null,constructor:function(config){this.uScope=config.scope;this.uHandler=config.handler;this.uToggleHandler=config.toggleHandler;this.uCheckHandler=config.checkHandler;config.scope=this;config.handler=this.pHandler;config.toggleHandler=this.pToggleHandler;config.checkHandler=this.pCheckHandler;var ctrl=this.control=config.control;delete config.control;this.activateOnEnable=!!config.activateOnEnable;delete config.activateOnEnable;this.deactivateOnDisable=!!config.deactivateOnDisable;delete config.deactivateOnDisable;if(ctrl){if(config.map){config.map.addControl(ctrl);delete config.map;}
if((config.pressed||config.checked)&&ctrl.map){ctrl.activate();}
ctrl.events.on({activate:this.onCtrlActivate,deactivate:this.onCtrlDeactivate,scope:this});}
arguments.callee.superclass.constructor.call(this,config);},pHandler:function(cmp){var ctrl=this.control;if(ctrl&&ctrl.type==OpenLayers.Control.TYPE_BUTTON){ctrl.trigger();}
if(this.uHandler){this.uHandler.apply(this.uScope,arguments);}},pToggleHandler:function(cmp,state){this.changeControlState(state);if(this.uToggleHandler){this.uToggleHandler.apply(this.uScope,arguments);}},pCheckHandler:function(cmp,state){this.changeControlState(state);if(this.uCheckHandler){this.uCheckHandler.apply(this.uScope,arguments);}},changeControlState:function(state){if(state){if(!this._activating){this._activating=true;this.control.activate();this._activating=false;}}else{if(!this._deactivating){this._deactivating=true;this.control.deactivate();this._deactivating=false;}}},onCtrlActivate:function(){var ctrl=this.control;if(ctrl.type==OpenLayers.Control.TYPE_BUTTON){this.enable();}else{this.safeCallEach("toggle",[true]);this.safeCallEach("setChecked",[true]);}},onCtrlDeactivate:function(){var ctrl=this.control;if(ctrl.type==OpenLayers.Control.TYPE_BUTTON){this.disable();}else{this.safeCallEach("toggle",[false]);this.safeCallEach("setChecked",[false]);}},safeCallEach:function(fnName,args){var cs=this.items;for(var i=0,len=cs.length;i<len;i++){if(cs[i][fnName]){cs[i].rendered?cs[i][fnName].apply(cs[i],args):cs[i].on({"render":cs[i][fnName].createDelegate(cs[i],args),single:true});}}},setDisabled:function(v){if(!v&&this.activateOnEnable&&this.control&&!this.control.active){this.control.activate();}
if(v&&this.deactivateOnDisable&&this.control&&this.control.active){this.control.deactivate();}
return GeoExt.Action.superclass.setDisabled.apply(this,arguments);}});Ext.namespace("GeoExt");GeoExt.MapPanel=Ext.extend(Ext.Panel,{map:null,layers:null,center:null,zoom:null,extent:null,prettyStateKeys:false,stateEvents:["aftermapmove","afterlayervisibilitychange","afterlayeropacitychange","afterlayerorderchange","afterlayernamechange","afterlayeradd","afterlayerremove"],initComponent:function(){if(!(this.map instanceof OpenLayers.Map)){this.map=new OpenLayers.Map(Ext.applyIf(this.map||{},{allOverlays:true}));}
var layers=this.layers;if(!layers||layers instanceof Array){this.layers=new GeoExt.data.LayerStore({layers:layers,map:this.map.layers.length>0?this.map:null});}
if(typeof this.center=="string"){this.center=OpenLayers.LonLat.fromString(this.center);}else if(this.center instanceof Array){this.center=new OpenLayers.LonLat(this.center[0],this.center[1]);}
if(typeof this.extent=="string"){this.extent=OpenLayers.Bounds.fromString(this.extent);}else if(this.extent instanceof Array){this.extent=OpenLayers.Bounds.fromArray(this.extent);}
GeoExt.MapPanel.superclass.initComponent.call(this);this.addEvents("aftermapmove","afterlayervisibilitychange","afterlayeropacitychange","afterlayerorderchange","afterlayernamechange","afterlayeradd","afterlayerremove");this.map.events.on({"moveend":this.onMoveend,"changelayer":this.onChangelayer,"addlayer":this.onAddlayer,"removelayer":this.onRemovelayer,scope:this});},onMoveend:function(){this.fireEvent("aftermapmove");},onChangelayer:function(e){if(e.property){if(e.property==="visibility"){this.fireEvent("afterlayervisibilitychange");}else if(e.property==="order"){this.fireEvent("afterlayerorderchange");}else if(e.property==="name"){this.fireEvent("afterlayernamechange");}else if(e.property==="opacity"){this.fireEvent("afterlayeropacitychange");}}},onAddlayer:function(){this.fireEvent("afterlayeradd");},onRemovelayer:function(){this.fireEvent("afterlayerremove");},applyState:function(state){this.center=new OpenLayers.LonLat(state.x,state.y);this.zoom=state.zoom;var i,l,layer,layerId,visibility,opacity;var layers=this.map.layers;for(i=0,l=layers.length;i<l;i++){layer=layers[i];layerId=this.prettyStateKeys?layer.name:layer.id;visibility=state["visibility_"+layerId];if(visibility!==undefined){visibility=(/^true$/i).test(visibility);if(layer.isBaseLayer){if(visibility){this.map.setBaseLayer(layer);}}else{layer.setVisibility(visibility);}}
opacity=state["opacity_"+layerId];if(opacity!==undefined){layer.setOpacity(opacity);}}},getState:function(){var state;if(!this.map){return;}
var center=this.map.getCenter();state=center?{x:center.lon,y:center.lat,zoom:this.map.getZoom()}:{};var i,l,layer,layerId,layers=this.map.layers;for(i=0,l=layers.length;i<l;i++){layer=layers[i];layerId=this.prettyStateKeys?layer.name:layer.id;state["visibility_"+layerId]=layer.getVisibility();state["opacity_"+layerId]=layer.opacity==null?1:layer.opacity;}
return state;},updateMapSize:function(){if(this.map){this.map.updateSize();}},renderMap:function(){var map=this.map;map.render(this.body.dom);this.layers.bind(map);if(map.layers.length>0){this.setInitialExtent();}else{this.layers.on("add",this.setInitialExtent,this,{single:true});}},setInitialExtent:function(){var map=this.map;if(this.center||this.zoom!=null){map.setCenter(this.center,this.zoom);}else if(this.extent){map.zoomToExtent(this.extent);}else{map.zoomToMaxExtent();}},afterRender:function(){GeoExt.MapPanel.superclass.afterRender.apply(this,arguments);if(!this.ownerCt){this.renderMap();}else{this.ownerCt.on("move",this.updateMapSize,this);this.ownerCt.on({"afterlayout":this.afterLayout,scope:this});}},afterLayout:function(){var width=this.getInnerWidth()-
this.body.getBorderWidth("lr");var height=this.getInnerHeight()-
this.body.getBorderWidth("tb");if(width>0&&height>0){this.ownerCt.un("afterlayout",this.afterLayout,this);this.renderMap();}},onResize:function(){GeoExt.MapPanel.superclass.onResize.apply(this,arguments);this.updateMapSize();},onBeforeAdd:function(item){if(typeof item.addToMapPanel==="function"){item.addToMapPanel(this);}
GeoExt.MapPanel.superclass.onBeforeAdd.apply(this,arguments);},remove:function(item,autoDestroy){if(typeof item.removeFromMapPanel==="function"){item.removeFromMapPanel(this);}
GeoExt.MapPanel.superclass.remove.apply(this,arguments);},beforeDestroy:function(){if(this.ownerCt){this.ownerCt.un("move",this.updateMapSize,this);}
if(this.map&&this.map.events){this.map.events.un({"moveend":this.onMoveend,"changelayer":this.onChangelayer,"addlayer":this.onAddlayer,"removelayer":this.onRemovelayer,scope:this});}
if(!this.initialConfig.map||!(this.initialConfig.map instanceof OpenLayers.Map)){if(this.map&&this.map.destroy){this.map.destroy();}}
delete this.map;GeoExt.MapPanel.superclass.beforeDestroy.apply(this,arguments);}});GeoExt.MapPanel.guess=function(){return Ext.ComponentMgr.all.find(function(o){return o instanceof GeoExt.MapPanel;});};Ext.reg('gx_mappanel',GeoExt.MapPanel);Ext.namespace("MapFish");mapFishApiPool={apiRefs:[],createRef:function(ref){var index=this.apiRefs.length;this.apiRefs[index]=ref;return index;}};MapFish.API=OpenLayers.Class({map:null,drawLayer:null,baseConfig:null,apiId:null,searcher:null,debug:null,tree:null,isMainApp:null,recenterUrl:'/recenter',highlightUrl:'/geometry',layerTreeNodes:null,selectCtrl:null,popup:null,apiName:'MapFish',tools:null,activatePopup:true,initialize:function(config){Ext.QuickTips.init();Ext.BLANK_IMAGE_URL=OpenLayers.Util.getImagesLocation()+"blank.gif";this.apiId=mapFishApiPool.createRef(this);this.baseConfig=config||{};OpenLayers.Tile.Image.useBlankTile=false;this.debug=Boolean(this.baseConfig.debug);this.isMainApp=Boolean(this.baseConfig.isMainApp);if(typeof this.baseConfig.activatePopup!='undefined'){this.activatePopup=this.baseConfig.activatePopup;}
this.layerTreeNodes=[];var lang=this.baseConfig.lang||($('lang')?$('lang').value:null)||this.lang;if(lang){OpenLayers.Lang.setCode(lang);}
if(!this.debug){OpenLayers.Util.onImageLoadError=function(){this.style.display="none";this.src=Ext.BLANK_IMAGE_URL;};}},createMap:function(config){config=config||{};var options=this.getMapOptions();if(config.div){options.div=config.div;}
var layers=this.getLayers(config);var controls=this.getControls(config);if(controls){options.controls=controls;}
this.map=new OpenLayers.Map(options);this.drawLayer=this.getDrawingLayer();layers.push(this.drawLayer);this.map.addLayers(layers);this.drawLayer.setZIndex(this.map.Z_INDEX_BASE['Feature']);this.map.events.on({scope:this.drawLayer,changelayer:function(evt){if(evt.property=="order"){this.setZIndex(this.map.Z_INDEX_BASE['Feature']);}}});if(!this.map.getCenter()){if(config.easting&&config.northing){this.map.setCenter(new OpenLayers.LonLat(config.easting,config.northing),config.zoom);}else if(config.bbox){this.map.zoomToExtent(new OpenLayers.Bounds.fromArray(config.bbox));}else if(this.baseConfig.initialExtent){this.map.zoomToExtent(new OpenLayers.Bounds.fromArray(this.baseConfig.initialExtent));}else{this.map.zoomToMaxExtent();}}
return this.map;},getCreateMapDescription:function(html){var separator=this.getReturnLine(html);var comment="      // createMap config parameters"+separator;comment=comment+"      //  div - div where to place the map"+separator;comment=comment+"      //  easting - center of the map, easting value"+separator;comment=comment+"      //  northing - center of the map, northing value"+separator;comment=comment+"      //  zoom - zoom level"+separator;comment=comment+"      //  bbox - bbox of the initial extent"+separator;return comment;},createPermalinkFormPanel:function(){return new MapFish.API.PermalinkFormPanel();},createApiFormPanel:function(){return new MapFish.API.ApiFormPanel(this);},createAddWmsLayerFormPanel:function(){return new MapFish.API.AddWmsLayerFormPanel(this);},getReturnLine:function(html){var separator="\n";if(html){separator="<br>";}
return separator;},createApiCode:function(html){var separator=this.getReturnLine(html);var apiText='<html xmlns=\"http://www.w3.org/1999/xhtml\">';apiText=apiText+separator;apiText=apiText+"  <head>";apiText=apiText+separator;apiText=apiText+"    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf8\" />";apiText=apiText+separator;apiText=apiText+"    <meta name=\"content-language\" content=\"en\" />";apiText=apiText+separator;apiText=apiText+"    <title>API</title>";s=document.styleSheets;for(i=0;i<s.length;i++){apiText=apiText+separator;apiText=apiText+"    <link rel=\"stylesheet\" type=\"text/css\" href=\""+s[i].href+"\"/>";}
var scripts=document.getElementsByTagName('script');for(i=0;i<scripts.length;i++){var script=scripts[i];if(script.src.indexOf('init.js')<0&&script.src.indexOf('ws.geonames.org')<0){apiText=apiText+separator;apiText=apiText+"    <script type=\"text/javascript\" src=\""+script.src+"\"></script>";}}
apiText=apiText+separator;apiText=apiText+"  <script type=\"text/javascript\">"+separator;apiText=apiText+"    Ext.onReady(function() {"+separator;apiText=apiText+"      geo = new "+this.apiName+".API();"+separator;apiText=apiText+this.getCreateMapDescription(html);apiText=apiText+"      geo.createMap({"+separator;apiText=apiText+"         div: 'mymap1',"+separator;apiText=apiText+"         zoom: "+this.map.zoom+","+separator,apiText=apiText+"         easting: "+this.map.getCenter().lon+","+separator,apiText=apiText+"         northing: "+this.map.getCenter().lat+separator,apiText=apiText+"      });"+separator;var cbShowMarker=Ext.getCmp('cbMarkerApiFormPanel');if(cbShowMarker){if(cbShowMarker.getValue()){apiText=apiText+this.getShowMarkerDescription(html);apiText=apiText+"      geo.showMarker();"+separator;}}
var cbShowPopup=Ext.getCmp('cbPopupApiFormPanel');if(cbShowPopup){if(cbShowPopup.getValue()){apiText=apiText+this.getShowPopupDescription(html);apiText=apiText+"      geo.showPopup({"+separator;apiText=apiText+"         html: '"+Ext.getCmp('cbPopupContentApiFormPanel').getValue()+"'"+separator;apiText=apiText+"      });"+separator;}}
apiText=apiText+"    });"+separator;apiText=apiText+"  </script>"+separator;apiText=apiText+"  </head>";apiText=apiText+separator;apiText=apiText+"    <body>";apiText=apiText+separator;apiText=apiText+"       <div id=\"mymap1\" style=\"width:800px;height:600px;border:1px solid black;\"></div>";apiText=apiText+separator;apiText=apiText+"    </body>";apiText=apiText+separator;apiText=apiText+"</html>";apiText=apiText+separator;return apiText;},createMapPanel:function(config){var mapPanel;config=config||{};if(!this.map){var mapConfig=config.mapInfo||{};this.createMap(mapConfig);}
config.map=this.map;var center=this.map.getCenter();if(center){config.center=[center.lon,center.lat];}
var zoom=this.map.getZoom();if(zoom){config.zoom=zoom;}
if(config.showTools){var tbarConfig=config.toolbar||{};config.tbar=this.createToolbar(tbarConfig);}
if(config.renderTo){mapPanel=new GeoExt.MapPanel(config);}else{mapPanel=Ext.apply(config,{xtype:'gx_mappanel'});}
return mapPanel;},createLayerTree:function(config){config=config||{};var options={id:config.id,map:this.map,showWmsLegend:config.showWmsLegend,model:this.getLayerTreeModel(),plugins:[mapfish.widgets.LayerTree.createContextualMenuPlugin(['opacitySlideDirect'])]}
if(config.div){Ext.apply(options,{renderTo:config.div,height:'auto'});}else{Ext.apply(options,{title:config.title,listeners:{checkchange:function(node,checked){var permalink=this.map.getControl('mapfish.api.permalink');if(permalink){permalink.updateLink();}}}});}
this.tree=new mapfish.widgets.LayerTree(options);if(config.layers){var checkedNodes=this.tree.getChecked();for(var i=0,n=checkedNodes.length;i<n;i++){this.tree.setNodeChecked(checkedNodes[i],false);}
for(var i=0,n=config.layers.length;i<n;i++){var layer=config.layers[i];var node=this.tree.nodeIdToNode[layer];this.tree.setNodeChecked(node,true);}}
return this.tree;},createToolbar:function(config){config=Ext.apply({items:['ZoomToMaxExtent','Navigation','ZoomBox','LengthMeasure','AreaMeasure','NavigationHistory']},config);this.tools=[];for(var i=0;i<config.items.length;i++){this['init'+config.items[i]](config);}
return this.tools;},initSeparator:function(config){this.tools.push(new Ext.Toolbar.Spacer());this.tools.push(new Ext.Toolbar.Separator());this.tools.push(new Ext.Toolbar.Spacer());},initFillToolbar:function(config){this.tools.push('->');},initZoomToMaxExtent:function(config){var action=new GeoExt.Action(Ext.apply({map:this.map,control:new MapFish.API.ZoomToExtent(config.controls),iconCls:'zoomfull',tooltip:OpenLayers.i18n("max extent")},config.actions));this.tools.push(action);},initNavigation:function(config){var action=new Ext.Button(Ext.apply({toggleGroup:config.toggleGroup||'navigation',allowDepress:false,pressed:true,id:'navigationButton',tooltip:OpenLayers.i18n('pan'),iconCls:'pan'},config.actions));this.tools.push(action);},initZoomBox:function(config){var action=new GeoExt.Action(Ext.apply({map:this.map,control:new OpenLayers.Control.ZoomBox(config.controls),toggleGroup:config.toggleGroup||'navigation',allowDepress:false,tooltip:OpenLayers.i18n('zoom box'),iconCls:'zoomin'},config.actions));this.tools.push(action);},initZoomOut:function(config){var action=new GeoExt.Action(Ext.apply({map:this.map,control:new OpenLayers.Control.ZoomBox(Ext.apply({out:true},config.controls)),toggleGroup:config.toggleGroup||'navigation',allowDepress:false,tooltip:OpenLayers.i18n('zoom out'),iconCls:'zoomout'},config.actions));this.tools.push(action);},initLengthMeasure:function(config){var measure=new MapFish.API.Measure(config.controls);var action=new GeoExt.Action(Ext.apply({map:this.map,control:measure.createLengthMeasureControl(),toggleGroup:config.toggleGroup||'navigation',allowDepress:false,tooltip:OpenLayers.i18n('length measure'),iconCls:'measureLength'},config.actions));this.tools.push(action);},initAreaMeasure:function(config){var measure=new MapFish.API.Measure(config.controls);var action=new GeoExt.Action(Ext.apply({map:this.map,control:measure.createAreaMeasureControl(),toggleGroup:config.toggleGroup||'navigation',allowDepress:false,tooltip:OpenLayers.i18n('area measure'),iconCls:'measureArea'},config.actions));this.tools.push(action);},initNavigationHistory:function(config){var history=new OpenLayers.Control.NavigationHistory(config.controls);history.activate();this.map.addControl(history);var action=new GeoExt.Action(Ext.apply({tooltip:OpenLayers.i18n("previous"),control:history.previous,iconCls:'previous',disabled:true},config.actions));this.tools.push(action);action=new GeoExt.Action(Ext.apply({tooltip:OpenLayers.i18n("next"),control:history.next,iconCls:'next',disabled:true},config.actions));this.tools.push(action);},initDrawFeature:function(config){var handlers=mapfish.Util.fixArray(config.drawHandlers||['Point','Path','Polygon']);for(var i=0;i<handlers.length;i++){var control=new OpenLayers.Control.DrawFeature(this.getDrawingLayer(),OpenLayers.Handler[handlers[i]],config.controls);this.map.addControl(control);var action=new GeoExt.Action(Ext.apply({map:this.map,control:control,toggleGroup:config.toggleGroup||'navigation',allowDepress:false,iconCls:'draw'+handlers[i]},config.actions));this.tools.push(action);}},initClearFeatures:function(config){var scope=this;var action=new Ext.Button(Ext.apply({handler:function(){scope.getDrawingLayer().destroyFeatures()},iconCls:'clearfeatures'},config.actions));this.tools.push(action);},showFeatureTooltip:function(config){if(!config.layer||!config.id)return;this.getSearcher().recenterProtocol.read({params:{layer:config.layer,id:config.id}});},recenterOnObjects:function(layer,ids,pointZoomLevel){if(this.isMainApp){OpenLayers.Request.GET({url:this.baseConfig.baseUrl+this.recenterUrl,params:{layers:layer,ids:ids},success:function(response){var f=new OpenLayers.Format.JSON();var bbox=f.read(response.responseText);this.recenterOnBbox(bbox,pointZoomLevel);},scope:this});}else{var ds=new Ext.data.Store({proxy:new Ext.data.ScriptTagProxy({url:this.baseConfig.baseUrl+this.recenterUrl}),reader:new Ext.data.JsonReader({root:"rows",totalProperty:"results"},[{name:'bbox'}])});ds.load({params:{layers:layer,ids:[ids],cb:'mapFishApiPool.apiRefs['+this.apiId+'].recenterOnBboxCb('+pointZoomLevel+')'}});}},highlightObjects:function(layer,ids){var ds=new Ext.data.Store({proxy:new Ext.data.ScriptTagProxy({url:this.baseConfig.baseUrl+this.highlightUrl}),reader:new Ext.data.JsonReader({root:"rows",totalProperty:"results"},[{name:'features'}])});ds.load({params:{layers:layer,ids:[ids],cb:'mapFishApiPool.apiRefs['+this.apiId+'].highlightObjectsCb'}});},showFeatures:function(layer,ids,pointZoomLevel){this.recenterOnObjects(layer,ids,pointZoomLevel);this.highlightObjects(layer,ids);},showMarker:function(options){options=options||{};var easting;var northing;var iconPath;var recenter;var graphicHeight;var graphicWidth;var fillOpacity;var html;if(options.easting){easting=options.easting;}else{easting=this.map.getCenter().lon;}
if(options.northing){northing=options.northing;}else{northing=this.map.getCenter().lat;}
if(options.iconPath){if(options.iconPath.indexOf('http://')==0){iconPath=this.getIconPath(options.iconPath);}else{if(options.iconPath.indexOf('/')==0){iconPath=this.baseConfig.baseUrl+this.getIconPath(options.iconPath);}else{iconPath=this.baseConfig.baseUrl+'/'+this.getIconPath(options.iconPath);}}}else{iconPath=this.baseConfig.baseUrl+"/mfbase/openlayers/img/marker-gold.png";}
if(options.recenter){if(options.recenter=="true"||options.recenter=="True"||options.recenter=="TRUE"){recenter="true";}else{recenter="false";}}else{recenter="false";}
if(options.graphicHeight){graphicHeight=options.graphicHeight;}else{var graphic=new Image();graphic.src=this.getIconPath(iconPath);if(graphic.height){graphicHeight=graphic.height;}else{graphicHeight=25;}}
if(options.graphicWidth){graphicWidth=options.graphicWidth;}else{var graphic=new Image();graphic.src=this.getIconPath(iconPath);if(graphic.width){graphicWidth=graphic.width;}else{graphicWidth=25;}}
if(options.fillOpacity){fillOpacity=options.fillOpacity;}else{fillOpacity=1;}
if(options.html){html=options.html;}else{html=null;}
var style_mark=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style['default']);style_mark.externalGraphic=this.getIconPath(iconPath);style_mark.fillOpacity=fillOpacity;style_mark.graphicHeight=graphicHeight;style_mark.graphicWidth=graphicWidth;var features=new Array(1);features[0]=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(easting,northing),{html:html},style_mark);this.drawLayer.addFeatures(features);if(recenter=="true"){this.map.setCenter(new OpenLayers.LonLat(easting,northing));}
return features;},getShowMarkerDescription:function(html){var separator=this.getReturnLine(html);var comment="      // showMarker config parameters"+separator;comment=comment+"      //  easting - position of the marker, default: map center"+separator;comment=comment+"      //  northing - position of the marker, default: map center"+separator;comment=comment+"      //  iconPath - path of a custom icon for the marker (url or relative), default: /mfbase/openlayers/img/marker-gold.png"+separator;comment=comment+"      //  recenter - define if the map has to recentered at the marker position, default: false"+separator;comment=comment+"      //  graphicHeight - height of the height, default: the icon height"+separator;comment=comment+"      //  graphicWidth - width of the height, default: the icon width"+separator;comment=comment+"      //  fillOpacity - opacity of the marker (from 0 to 1), default: 1"+separator;comment=comment+"      //  html - html content of a popup, default: null"+separator;return comment;},showPopup:function(options){options=options||{};var easting;var northing;var title;var html;var recenter;var width;var collapsible;var unpinnable;var feature;if(options.feature){feature=options.feature;html=options.feature.attributes.html;}else{if(options.easting){easting=options.easting;}else{easting=this.map.getCenter().lon;}
if(options.northing){northing=options.northing;}else{northing=this.map.getCenter().lat;}
if(options.html){html=options.html;}else{html=null;}}
if(options.title){title=options.title;}else{title="";}
if(options.recenter){if(options.recenter=="true"||options.recenter=="True"||options.recenter=="TRUE"){recenter="true";}else{recenter="false";}}else{recenter="false";}
if(options.width){width=options.width;}else{width=200;}
if(options.collapsible){collapsible=options.collapsible;}else{collapsible=false;}
if(options.unpinnable){unpinnable=options.unpinnable;}else{unpinnable=true;}
if(this.popup){this.popup.close();}
if(html){this.popup=new GeoExt.Popup({map:this.map,feature:feature,title:title,lonlat:new OpenLayers.LonLat(easting,northing),width:width,html:html,collapsible:collapsible,unpinnable:unpinnable});if(feature){this.popup.on({close:function(){if(OpenLayers.Util.indexOf(this.drawLayer.selectedFeatures,feature)>-1){this.selectCtrl.unselect(feature);}},scope:this});}
this.popup.show();}
if(recenter=="true"){this.map.setCenter(new OpenLayers.LonLat(easting,northing));}},getShowPopupDescription:function(html){var separator=this.getReturnLine(html);var comment="      // showPopup config parameters"+separator;comment=comment+"      //  easting - position of the popup - default: map center"+separator;comment=comment+"      //  northing - position of the popup, default: map center"+separator;comment=comment+"      //  title - title of the window, default: "+separator;comment=comment+"      //  html - html content of the popup, default: '' . If empty, no popup is shown"+separator;comment=comment+"      //  recenter - define if the map has to recentered at the popup position, default: false"+separator;comment=comment+"      //  width - width of the popup, default: 200"+separator;comment=comment+"      //  collapsible - default: false"+separator;comment=comment+"      //  unpinnable - default: true"+separator;comment=comment+"      //  feature - feature associated with the popup"+separator;return comment;},updateLayerTreeFromPermalink:function(){var layertree=this.tree;if(layertree&&this.layerTreeNodes.length>0){var checkedNodes=layertree.getChecked();for(var i=0,len=checkedNodes.length;i<len;i++){layertree.setNodeChecked(checkedNodes[i],false);}
for(var i=0,len=this.layerTreeNodes.length;i<len;i++){var nodeId=layertree.nodeIdToNode[this.layerTreeNodes[i]];if(nodeId){layertree.setNodeChecked(nodeId,true);}}}},recenterOnBboxCb:function(r,pointZoomLevel){this.recenterOnBbox(r.rows[0].bbox);},recenterOnBbox:function(bbox,pointZoomLevel){var bounds=new OpenLayers.Bounds(bbox[0],bbox[1],bbox[2],bbox[3]);if(bounds.getWidth()&&bounds.getHeight()){this.map.zoomToExtent(bounds);}else{var center=bounds.getCenterLonLat();if(center.lat&&center.lon){if(pointZoomLevel){this.map.setCenter(center,pointZoomLevel);}else{this.map.setCenter(center,19);}}}},highlightObjectsCb:function(r){var geo=new OpenLayers.Format.GeoJSON();var features=geo.read(r.rows[0].features);if(features){var layer=this.getDrawingLayer();layer.addFeatures(features);}},getDrawingLayer:function(){if(!this.drawLayer){var myStyles=new OpenLayers.StyleMap({"default":new OpenLayers.Style({pointRadius:"10",fillColor:"#FFFF00",fillOpacity:0.8,strokeColor:"#FF8000",strokeOpacity:0.8,strokeWidth:2})});this.drawLayer=new OpenLayers.Layer.Vector("Drawings layer",{displayInLayerSwitcher:false,styleMap:myStyles});if(!this.selectCtrl){this.selectCtrl=new OpenLayers.Control.SelectFeature(this.drawLayer);this.map.addControl(this.selectCtrl);this.selectCtrl.activate();this.drawLayer.events.on({featureselected:function(e){if(this.activatePopup){this.showPopup({feature:e.feature});};document.body.style.cursor='default';},scope:this});}}
return this.drawLayer;},getLayers:function(config){return null;},getControls:function(config){return null;},getMapOptions:function(){return null;},getLayerTreeModel:function(){return null;},getSearcher:function(){if(!this.searcher){this.searcher=new MapFish.API.Search({api:this,url:this.baseConfig.searchUrl});}
return this.searcher;},getIconPath:function(iconPath){return iconPath;}});OpenLayers.Control.MousePosition=OpenLayers.Class(OpenLayers.Control,{autoActivate:true,element:null,prefix:'',separator:', ',suffix:'',numDigits:5,granularity:10,emptyString:null,lastXy:null,displayProjection:null,destroy:function(){this.deactivate();OpenLayers.Control.prototype.destroy.apply(this,arguments);},activate:function(){if(OpenLayers.Control.prototype.activate.apply(this,arguments)){this.map.events.register('mousemove',this,this.redraw);this.map.events.register('mouseout',this,this.reset);this.redraw();return true;}else{return false;}},deactivate:function(){if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)){this.map.events.unregister('mousemove',this,this.redraw);this.map.events.unregister('mouseout',this,this.reset);this.element.innerHTML="";return true;}else{return false;}},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.div.left="";this.div.top="";this.element=this.div;}
return this.div;},redraw:function(evt){var lonLat;if(evt==null){this.reset();return;}else{if(this.lastXy==null||Math.abs(evt.xy.x-this.lastXy.x)>this.granularity||Math.abs(evt.xy.y-this.lastXy.y)>this.granularity)
{this.lastXy=evt.xy;return;}
lonLat=this.map.getLonLatFromPixel(evt.xy);if(!lonLat){return;}
if(this.displayProjection){lonLat.transform(this.map.getProjectionObject(),this.displayProjection);}
this.lastXy=evt.xy;}
var newHtml=this.formatOutput(lonLat);if(newHtml!=this.element.innerHTML){this.element.innerHTML=newHtml;}},reset:function(evt){if(this.emptyString!=null){this.element.innerHTML=this.emptyString;}},formatOutput:function(lonLat){var digits=parseInt(this.numDigits);var newHtml=this.prefix+
lonLat.lon.toFixed(digits)+
this.separator+
lonLat.lat.toFixed(digits)+
this.suffix;return newHtml;},CLASS_NAME:"OpenLayers.Control.MousePosition"});OpenLayers.Control.DragPan=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,panned:false,interval:1,documentDrag:false,kinetic:null,enableKinetic:false,kineticInterval:10,draw:function(){if(this.enableKinetic){var config={interval:this.kineticInterval};if(typeof this.enableKinetic==="object"){config=OpenLayers.Util.extend(config,this.enableKinetic);}
this.kinetic=new OpenLayers.Kinetic(config);}
this.handler=new OpenLayers.Handler.Drag(this,{"move":this.panMap,"done":this.panMapDone,"down":this.panMapStart},{interval:this.interval,documentDrag:this.documentDrag});},panMapStart:function(){if(this.kinetic){this.kinetic.begin();}},panMap:function(xy){if(this.kinetic){this.kinetic.update(xy);}
this.panned=true;this.map.pan(this.handler.last.x-xy.x,this.handler.last.y-xy.y,{dragging:true,animate:false});},panMapDone:function(xy){if(this.panned){var res=null;if(this.kinetic){res=this.kinetic.end(xy);}
this.map.pan(this.handler.last.x-xy.x,this.handler.last.y-xy.y,{dragging:!!res,animate:false});if(res){var self=this;this.kinetic.move(res,function(x,y,end){self.map.pan(x,y,{dragging:!end,animate:false});});}
this.panned=false;}},CLASS_NAME:"OpenLayers.Control.DragPan"});OpenLayers.Handler.MouseWheel=OpenLayers.Class(OpenLayers.Handler,{wheelListener:null,mousePosition:null,interval:0,delta:0,cumulative:true,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.wheelListener=OpenLayers.Function.bindAsEventListener(this.onWheelEvent,this);},destroy:function(){OpenLayers.Handler.prototype.destroy.apply(this,arguments);this.wheelListener=null;},onWheelEvent:function(e){if(!this.map||!this.checkModifiers(e)){return;}
var overScrollableDiv=false;var overLayerDiv=false;var overMapDiv=false;var elem=OpenLayers.Event.element(e);while((elem!=null)&&!overMapDiv&&!overScrollableDiv){if(!overScrollableDiv){try{if(elem.currentStyle){overflow=elem.currentStyle["overflow"];}else{var style=document.defaultView.getComputedStyle(elem,null);var overflow=style.getPropertyValue("overflow");}
overScrollableDiv=(overflow&&(overflow=="auto")||(overflow=="scroll"));}catch(err){}}
if(!overLayerDiv){for(var i=0,len=this.map.layers.length;i<len;i++){if(elem==this.map.layers[i].div||elem==this.map.layers[i].pane){overLayerDiv=true;break;}}}
overMapDiv=(elem==this.map.div);elem=elem.parentNode;}
if(!overScrollableDiv&&overMapDiv){if(overLayerDiv){var delta=0;if(!e){e=window.event;}
if(e.wheelDelta){delta=e.wheelDelta/120;if(window.opera&&window.opera.version()<9.2){delta=-delta;}}else if(e.detail){delta=-e.detail/3;}
this.delta=this.delta+delta;if(this.interval){window.clearTimeout(this._timeoutId);this._timeoutId=window.setTimeout(OpenLayers.Function.bind(function(){this.wheelZoom(e);},this),this.interval);}else{this.wheelZoom(e);}}
OpenLayers.Event.stop(e);}},wheelZoom:function(e){var delta=this.delta;this.delta=0;if(delta){if(this.mousePosition){e.xy=this.mousePosition;}
if(!e.xy){e.xy=this.map.getPixelFromLonLat(this.map.getCenter());}
if(delta<0){this.callback("down",[e,this.cumulative?delta:-1]);}else{this.callback("up",[e,this.cumulative?delta:1]);}}},mousemove:function(evt){this.mousePosition=evt.xy;},activate:function(evt){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){var wheelListener=this.wheelListener;OpenLayers.Event.observe(window,"DOMMouseScroll",wheelListener);OpenLayers.Event.observe(window,"mousewheel",wheelListener);OpenLayers.Event.observe(document,"mousewheel",wheelListener);return true;}else{return false;}},deactivate:function(evt){if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){var wheelListener=this.wheelListener;OpenLayers.Event.stopObserving(window,"DOMMouseScroll",wheelListener);OpenLayers.Event.stopObserving(window,"mousewheel",wheelListener);OpenLayers.Event.stopObserving(document,"mousewheel",wheelListener);return true;}else{return false;}},CLASS_NAME:"OpenLayers.Handler.MouseWheel"});OpenLayers.Control.Navigation=OpenLayers.Class(OpenLayers.Control,{dragPan:null,dragPanOptions:null,pinchZoom:null,pinchZoomOptions:null,documentDrag:false,zoomBox:null,zoomBoxEnabled:true,zoomWheelEnabled:true,mouseWheelOptions:null,handleRightClicks:false,zoomBoxKeyMask:OpenLayers.Handler.MOD_SHIFT,autoActivate:true,initialize:function(options){this.handlers={};OpenLayers.Control.prototype.initialize.apply(this,arguments);},destroy:function(){this.deactivate();if(this.dragPan){this.dragPan.destroy();}
this.dragPan=null;if(this.zoomBox){this.zoomBox.destroy();}
this.zoomBox=null;if(this.pinchZoom){this.pinchZoom.destroy();}
this.pinchZoom=null;OpenLayers.Control.prototype.destroy.apply(this,arguments);},activate:function(){this.dragPan.activate();if(this.zoomWheelEnabled){this.handlers.wheel.activate();}
this.handlers.click.activate();if(this.zoomBoxEnabled){this.zoomBox.activate();}
if(this.pinchZoom){this.pinchZoom.activate();}
return OpenLayers.Control.prototype.activate.apply(this,arguments);},deactivate:function(){if(this.pinchZoom){this.pinchZoom.deactivate();}
this.zoomBox.deactivate();this.dragPan.deactivate();this.handlers.click.deactivate();this.handlers.wheel.deactivate();return OpenLayers.Control.prototype.deactivate.apply(this,arguments);},draw:function(){if(this.handleRightClicks){this.map.viewPortDiv.oncontextmenu=OpenLayers.Function.False;}
var clickCallbacks={'click':this.defaultClick,'dblclick':this.defaultDblClick,'dblrightclick':this.defaultDblRightClick};var clickOptions={'double':true,'stopDouble':true};this.handlers.click=new OpenLayers.Handler.Click(this,clickCallbacks,clickOptions);this.dragPan=new OpenLayers.Control.DragPan(OpenLayers.Util.extend({map:this.map,documentDrag:this.documentDrag},this.dragPanOptions));this.zoomBox=new OpenLayers.Control.ZoomBox({map:this.map,keyMask:this.zoomBoxKeyMask});this.dragPan.draw();this.zoomBox.draw();this.handlers.wheel=new OpenLayers.Handler.MouseWheel(this,{"up":this.wheelUp,"down":this.wheelDown},this.mouseWheelOptions);if(OpenLayers.Control.PinchZoom){this.pinchZoom=new OpenLayers.Control.PinchZoom(OpenLayers.Util.extend({map:this.map},this.pinchZoomOptions));}},defaultClick:function(evt){if(evt.lastTouches&&evt.lastTouches.length==2){this.map.zoomOut();}},defaultDblClick:function(evt){var newCenter=this.map.getLonLatFromViewPortPx(evt.xy);this.map.setCenter(newCenter,this.map.zoom+1);},defaultDblRightClick:function(evt){var newCenter=this.map.getLonLatFromViewPortPx(evt.xy);this.map.setCenter(newCenter,this.map.zoom-1);},wheelChange:function(evt,deltaZ){var currentZoom=this.map.getZoom();var newZoom=this.map.getZoom()+Math.round(deltaZ);newZoom=Math.max(newZoom,0);newZoom=Math.min(newZoom,this.map.getNumZoomLevels());if(newZoom===currentZoom){return;}
var size=this.map.getSize();var deltaX=size.w/2-evt.xy.x;var deltaY=evt.xy.y-size.h/2;var newRes=this.map.baseLayer.getResolutionForZoom(newZoom);var zoomPoint=this.map.getLonLatFromPixel(evt.xy);var newCenter=new OpenLayers.LonLat(zoomPoint.lon+deltaX*newRes,zoomPoint.lat+deltaY*newRes);this.map.setCenter(newCenter,newZoom);},wheelUp:function(evt,delta){this.wheelChange(evt,delta||1);},wheelDown:function(evt,delta){this.wheelChange(evt,delta||-1);},disableZoomBox:function(){this.zoomBoxEnabled=false;this.zoomBox.deactivate();},enableZoomBox:function(){this.zoomBoxEnabled=true;if(this.active){this.zoomBox.activate();}},disableZoomWheel:function(){this.zoomWheelEnabled=false;this.handlers.wheel.deactivate();},enableZoomWheel:function(){this.zoomWheelEnabled=true;if(this.active){this.handlers.wheel.activate();}},CLASS_NAME:"OpenLayers.Control.Navigation"});OpenLayers.Control.Scale=OpenLayers.Class(OpenLayers.Control,{element:null,geodesic:false,initialize:function(element,options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.element=OpenLayers.Util.getElement(element);},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.element=document.createElement("div");this.div.appendChild(this.element);}
this.map.events.register('moveend',this,this.updateScale);this.updateScale();return this.div;},updateScale:function(){var scale;if(this.geodesic===true){var units=this.map.getUnits();if(!units){return;}
var inches=OpenLayers.INCHES_PER_UNIT;scale=(this.map.getGeodesicPixelSize().w||0.000001)*inches["km"]*OpenLayers.DOTS_PER_INCH;}else{scale=this.map.getScale();}
if(!scale){return;}
if(scale>=9500&&scale<=950000){scale=Math.round(scale/1000)+"K";}else if(scale>=950000){scale=Math.round(scale/1000000)+"M";}else{scale=Math.round(scale);}
this.element.innerHTML=OpenLayers.i18n("Scale = 1 : ${scaleDenom}",{'scaleDenom':scale});},CLASS_NAME:"OpenLayers.Control.Scale"});OpenLayers.Control.ScaleLine=OpenLayers.Class(OpenLayers.Control,{maxWidth:100,topOutUnits:"km",topInUnits:"m",bottomOutUnits:"mi",bottomInUnits:"ft",eTop:null,eBottom:null,geodesic:false,draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.eTop){this.eTop=document.createElement("div");this.eTop.className=this.displayClass+"Top";var theLen=this.topInUnits.length;this.div.appendChild(this.eTop);if((this.topOutUnits=="")||(this.topInUnits=="")){this.eTop.style.visibility="hidden";}else{this.eTop.style.visibility="visible";}
this.eBottom=document.createElement("div");this.eBottom.className=this.displayClass+"Bottom";this.div.appendChild(this.eBottom);if((this.bottomOutUnits=="")||(this.bottomInUnits=="")){this.eBottom.style.visibility="hidden";}else{this.eBottom.style.visibility="visible";}}
this.map.events.register('moveend',this,this.update);this.update();return this.div;},getBarLen:function(maxLen){var digits=parseInt(Math.log(maxLen)/Math.log(10));var pow10=Math.pow(10,digits);var firstChar=parseInt(maxLen/pow10);var barLen;if(firstChar>5){barLen=5;}else if(firstChar>2){barLen=2;}else{barLen=1;}
return barLen*pow10;},update:function(){var res=this.map.getResolution();if(!res){return;}
var curMapUnits=this.map.getUnits();var inches=OpenLayers.INCHES_PER_UNIT;var maxSizeData=this.maxWidth*res*inches[curMapUnits];var geodesicRatio=1;if(this.geodesic===true){var maxSizeGeodesic=(this.map.getGeodesicPixelSize().w||0.000001)*this.maxWidth;var maxSizeKilometers=maxSizeData/inches["km"];geodesicRatio=maxSizeGeodesic/maxSizeKilometers;maxSizeData*=geodesicRatio;}
var topUnits;var bottomUnits;if(maxSizeData>100000){topUnits=this.topOutUnits;bottomUnits=this.bottomOutUnits;}else{topUnits=this.topInUnits;bottomUnits=this.bottomInUnits;}
var topMax=maxSizeData/inches[topUnits];var bottomMax=maxSizeData/inches[bottomUnits];var topRounded=this.getBarLen(topMax);var bottomRounded=this.getBarLen(bottomMax);topMax=topRounded/inches[curMapUnits]*inches[topUnits];bottomMax=bottomRounded/inches[curMapUnits]*inches[bottomUnits];var topPx=topMax/res/geodesicRatio;var bottomPx=bottomMax/res/geodesicRatio;if(this.eBottom.style.visibility=="visible"){this.eBottom.style.width=Math.round(bottomPx)+"px";this.eBottom.innerHTML=bottomRounded+" "+bottomUnits;}
if(this.eTop.style.visibility=="visible"){this.eTop.style.width=Math.round(topPx)+"px";this.eTop.innerHTML=topRounded+" "+topUnits;}},CLASS_NAME:"OpenLayers.Control.ScaleLine"});OpenLayers.Layer.HTTPRequest=OpenLayers.Class(OpenLayers.Layer,{URL_HASH_FACTOR:(Math.sqrt(5)-1)/2,url:null,params:null,reproject:false,initialize:function(name,url,params,options){OpenLayers.Layer.prototype.initialize.apply(this,[name,options]);this.url=url;this.params=OpenLayers.Util.extend({},params);},destroy:function(){this.url=null;this.params=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.HTTPRequest(this.name,this.url,this.params,this.getOptions());}
obj=OpenLayers.Layer.prototype.clone.apply(this,[obj]);return obj;},setUrl:function(newUrl){this.url=newUrl;},mergeNewParams:function(newParams){this.params=OpenLayers.Util.extend(this.params,newParams);this.resolution=null;var ret=this.redraw();if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"params"});}
return ret;},redraw:function(force){if(force){return this.mergeNewParams({"_olSalt":Math.random()});}else{return OpenLayers.Layer.prototype.redraw.call(this);}},selectUrl:function(paramString,urls){var product=1;for(var i=0,len=paramString.length;i<len;i++){product*=paramString.charCodeAt(i)*this.URL_HASH_FACTOR;product-=Math.floor(product);}
return urls[Math.floor(product*urls.length)];},getFullRequestString:function(newParams,altUrl){var url=altUrl||this.url;var allParams=OpenLayers.Util.extend({},this.params);allParams=OpenLayers.Util.extend(allParams,newParams);var paramsString=OpenLayers.Util.getParameterString(allParams);if(OpenLayers.Util.isArray(url)){url=this.selectUrl(paramsString,url);}
var urlParams=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(url));for(var key in allParams){if(key.toUpperCase()in urlParams){delete allParams[key];}}
paramsString=OpenLayers.Util.getParameterString(allParams);return OpenLayers.Util.urlAppend(url,paramsString);},CLASS_NAME:"OpenLayers.Layer.HTTPRequest"});OpenLayers.Layer.Grid=OpenLayers.Class(OpenLayers.Layer.HTTPRequest,{tileSize:null,tileOriginCorner:"bl",tileOrigin:null,tileOptions:null,tileClass:OpenLayers.Tile.Image,grid:null,singleTile:false,ratio:1.5,buffer:0,numLoadingTiles:0,tileLoadingDelay:100,serverResolutions:null,timerId:null,backBuffer:null,gridResolution:null,backBufferResolution:null,backBufferLonLat:null,backBufferTimerId:null,initialize:function(name,url,params,options){OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,arguments);this.grid=[];this._moveGriddedTiles=OpenLayers.Function.bind(this.moveGriddedTiles,this);},removeMap:function(map){if(this.timerId!=null){window.clearTimeout(this.timerId);this.timerId=null;}
if(this.backBufferTimerId!==null){window.clearTimeout(this.backBufferTimerId);this.backBufferTimerId=null;}},destroy:function(){this.removeBackBuffer();this.clearGrid();this.grid=null;this.tileSize=null;OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this,arguments);},clearGrid:function(){if(this.grid){for(var iRow=0,len=this.grid.length;iRow<len;iRow++){var row=this.grid[iRow];for(var iCol=0,clen=row.length;iCol<clen;iCol++){var tile=row[iCol];this.removeTileMonitoringHooks(tile);tile.destroy();}}
this.grid=[];this.gridResolution=null;}},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.Grid(this.name,this.url,this.params,this.getOptions());}
obj=OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this,[obj]);if(this.tileSize!=null){obj.tileSize=this.tileSize.clone();}
obj.grid=[];obj.gridResolution=null;return obj;},moveTo:function(bounds,zoomChanged,dragging){OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this,arguments);bounds=bounds||this.map.getExtent();if(bounds!=null){var forceReTile=!this.grid.length||zoomChanged;var tilesBounds=this.getTilesBounds();var resolution=this.map.getResolution();var serverResolution=this.getServerResolution(resolution);if(this.singleTile){if(forceReTile||(!dragging&&!tilesBounds.containsBounds(bounds))){if(zoomChanged&&this.transitionEffect!=='resize'){this.removeBackBuffer();}
if(!zoomChanged||this.transitionEffect==='resize'){this.applyBackBuffer(serverResolution);}
this.initSingleTile(bounds);}}else{forceReTile=forceReTile||!tilesBounds.intersectsBounds(bounds,{worldBounds:this.map.baseLayer.wrapDateLine&&this.map.getMaxExtent()});if(resolution!==serverResolution){bounds=this.map.calculateBounds(null,serverResolution);if(forceReTile){var scale=serverResolution/resolution;this.transformDiv(scale);}}else{this.div.style.width='100%';this.div.style.height='100%';this.div.style.left='0%';this.div.style.top='0%';}
if(forceReTile){if(zoomChanged&&this.transitionEffect==='resize'){this.applyBackBuffer(serverResolution);}
this.initGriddedTiles(bounds);}else{this.scheduleMoveGriddedTiles();}}}},getServerResolution:function(resolution){resolution=resolution||this.map.getResolution();if(this.serverResolutions&&OpenLayers.Util.indexOf(this.serverResolutions,resolution)===-1){var i,serverResolution;for(i=this.serverResolutions.length-1;i>=0;i--){serverResolution=this.serverResolutions[i];if(serverResolution>resolution){resolution=serverResolution;break;}}
if(i===-1){throw'no appropriate resolution in serverResolutions';}}
return resolution;},getServerZoom:function(){return this.map.getZoomForResolution(this.getServerResolution());},transformDiv:function(scale){this.div.style.width=100*scale+'%';this.div.style.height=100*scale+'%';var size=this.map.getSize();var lcX=parseInt(this.map.layerContainerDiv.style.left,10);var lcY=parseInt(this.map.layerContainerDiv.style.top,10);var x=(lcX-(size.w/2.0))*(scale-1);var y=(lcY-(size.h/2.0))*(scale-1);this.div.style.left=x+'%';this.div.style.top=y+'%';},getResolutionScale:function(){return parseInt(this.div.style.width,10)/100;},applyBackBuffer:function(resolution){if(this.backBufferTimerId!==null){this.removeBackBuffer();}
var backBuffer=this.backBuffer;if(!backBuffer){backBuffer=this.createBackBuffer();if(!backBuffer){return;}
this.div.insertBefore(backBuffer,this.div.firstChild);this.backBuffer=backBuffer;var topLeftTileBounds=this.grid[0][0].bounds;this.backBufferLonLat={lon:topLeftTileBounds.left,lat:topLeftTileBounds.top};this.backBufferResolution=this.gridResolution;}
var style=backBuffer.style;var ratio=this.backBufferResolution/resolution;style.width=100*ratio+'%';style.height=100*ratio+'%';var position=this.getViewPortPxFromLonLat(this.backBufferLonLat,resolution);var leftOffset=parseInt(this.map.layerContainerDiv.style.left,10);var topOffset=parseInt(this.map.layerContainerDiv.style.top,10);backBuffer.style.left=(position.x-leftOffset)+'%';backBuffer.style.top=(position.y-topOffset)+'%';},createBackBuffer:function(){var backBuffer;if(this.grid.length>0){backBuffer=document.createElement('div');backBuffer.id=this.div.id+'_bb';backBuffer.className='olBackBuffer';backBuffer.style.position='absolute';backBuffer.style.width='100%';backBuffer.style.height='100%';for(var i=0,lenI=this.grid.length;i<lenI;i++){for(var j=0,lenJ=this.grid[i].length;j<lenJ;j++){var tile=this.grid[i][j].createBackBuffer();if(!tile){continue;}
tile.style.top=(i*this.tileSize.h)+'%';tile.style.left=(j*this.tileSize.w)+'%';backBuffer.appendChild(tile);}}}
return backBuffer;},removeBackBuffer:function(){if(this.backBuffer){this.div.removeChild(this.backBuffer);this.backBuffer=null;this.backBufferResolution=null;if(this.backBufferTimerId!==null){window.clearTimeout(this.backBufferTimerId);this.backBufferTimerId=null;}}},moveByPx:function(dx,dy){if(!this.singleTile){this.scheduleMoveGriddedTiles();}},scheduleMoveGriddedTiles:function(){if(this.timerId!=null){window.clearTimeout(this.timerId);}
this.timerId=window.setTimeout(this._moveGriddedTiles,this.tileLoadingDelay);},setTileSize:function(size){if(this.singleTile){size=this.map.getSize();size.h=parseInt(size.h*this.ratio);size.w=parseInt(size.w*this.ratio);}
OpenLayers.Layer.HTTPRequest.prototype.setTileSize.apply(this,[size]);},getTilesBounds:function(){var bounds=null;var length=this.grid.length;if(length){var bottomLeftTileBounds=this.grid[length-1][0].bounds,width=this.grid[0].length*bottomLeftTileBounds.getWidth(),height=this.grid.length*bottomLeftTileBounds.getHeight();bounds=new OpenLayers.Bounds(bottomLeftTileBounds.left,bottomLeftTileBounds.bottom,bottomLeftTileBounds.left+width,bottomLeftTileBounds.bottom+height);}
return bounds;},initSingleTile:function(bounds){var center=bounds.getCenterLonLat();var tileWidth=bounds.getWidth()*this.ratio;var tileHeight=bounds.getHeight()*this.ratio;var tileBounds=new OpenLayers.Bounds(center.lon-(tileWidth/2),center.lat-(tileHeight/2),center.lon+(tileWidth/2),center.lat+(tileHeight/2));var px=this.map.getLayerPxFromLonLat({lon:tileBounds.left,lat:tileBounds.top});if(!this.grid.length){this.grid[0]=[];}
var tile=this.grid[0][0];if(!tile){tile=this.addTile(tileBounds,px);this.addTileMonitoringHooks(tile);tile.draw();this.grid[0][0]=tile;}else{tile.moveTo(tileBounds,px);}
this.removeExcessTiles(1,1);this.gridResolution=this.getServerResolution();},calculateGridLayout:function(bounds,origin,resolution){var tilelon=resolution*this.tileSize.w;var tilelat=resolution*this.tileSize.h;var offsetlon=bounds.left-origin.lon;var tilecol=Math.floor(offsetlon/tilelon)-this.buffer;var tilecolremain=offsetlon/tilelon-tilecol;var tileoffsetx=-tilecolremain*this.tileSize.w;var tileoffsetlon=origin.lon+tilecol*tilelon;var offsetlat=bounds.top-(origin.lat+tilelat);var tilerow=Math.ceil(offsetlat/tilelat)+this.buffer;var tilerowremain=tilerow-offsetlat/tilelat;var tileoffsety=-tilerowremain*this.tileSize.h;var tileoffsetlat=origin.lat+tilerow*tilelat;return{tilelon:tilelon,tilelat:tilelat,tileoffsetlon:tileoffsetlon,tileoffsetlat:tileoffsetlat,tileoffsetx:tileoffsetx,tileoffsety:tileoffsety};},getTileOrigin:function(){var origin=this.tileOrigin;if(!origin){var extent=this.getMaxExtent();var edges=({"tl":["left","top"],"tr":["right","top"],"bl":["left","bottom"],"br":["right","bottom"]})[this.tileOriginCorner];origin=new OpenLayers.LonLat(extent[edges[0]],extent[edges[1]]);}
return origin;},initGriddedTiles:function(bounds){var viewSize=this.map.getSize();var minRows=Math.ceil(viewSize.h/this.tileSize.h)+
Math.max(1,2*this.buffer);var minCols=Math.ceil(viewSize.w/this.tileSize.w)+
Math.max(1,2*this.buffer);var origin=this.getTileOrigin();var resolution=this.getServerResolution();var tileLayout=this.calculateGridLayout(bounds,origin,resolution);var tileoffsetx=Math.round(tileLayout.tileoffsetx);var tileoffsety=Math.round(tileLayout.tileoffsety);var tileoffsetlon=tileLayout.tileoffsetlon;var tileoffsetlat=tileLayout.tileoffsetlat;var tilelon=tileLayout.tilelon;var tilelat=tileLayout.tilelat;var startX=tileoffsetx;var startLon=tileoffsetlon;var rowidx=0;var layerContainerDivLeft=parseInt(this.map.layerContainerDiv.style.left);var layerContainerDivTop=parseInt(this.map.layerContainerDiv.style.top);do{var row=this.grid[rowidx++];if(!row){row=[];this.grid.push(row);}
tileoffsetlon=startLon;tileoffsetx=startX;var colidx=0;do{var tileBounds=new OpenLayers.Bounds(tileoffsetlon,tileoffsetlat,tileoffsetlon+tilelon,tileoffsetlat+tilelat);var x=tileoffsetx;x-=layerContainerDivLeft;var y=tileoffsety;y-=layerContainerDivTop;var px=new OpenLayers.Pixel(x,y);var tile=row[colidx++];if(!tile){tile=this.addTile(tileBounds,px);this.addTileMonitoringHooks(tile);row.push(tile);}else{tile.moveTo(tileBounds,px,false);}
tileoffsetlon+=tilelon;tileoffsetx+=this.tileSize.w;}while((tileoffsetlon<=bounds.right+tilelon*this.buffer)||colidx<minCols);tileoffsetlat-=tilelat;tileoffsety+=this.tileSize.h;}while((tileoffsetlat>=bounds.bottom-tilelat*this.buffer)||rowidx<minRows);this.removeExcessTiles(rowidx,colidx);this.gridResolution=this.getServerResolution();this.spiralTileLoad();},getMaxExtent:function(){return this.maxExtent;},spiralTileLoad:function(){var tileQueue=[];var directions=["right","down","left","up"];var iRow=0;var iCell=-1;var direction=OpenLayers.Util.indexOf(directions,"right");var directionsTried=0;while(directionsTried<directions.length){var testRow=iRow;var testCell=iCell;switch(directions[direction]){case"right":testCell++;break;case"down":testRow++;break;case"left":testCell--;break;case"up":testRow--;break;}
var tile=null;if((testRow<this.grid.length)&&(testRow>=0)&&(testCell<this.grid[0].length)&&(testCell>=0)){tile=this.grid[testRow][testCell];}
if((tile!=null)&&(!tile.queued)){tileQueue.unshift(tile);tile.queued=true;directionsTried=0;iRow=testRow;iCell=testCell;}else{direction=(direction+1)%4;directionsTried++;}}
for(var i=0,len=tileQueue.length;i<len;i++){var tile=tileQueue[i];tile.draw();tile.queued=false;}},addTile:function(bounds,position){return new this.tileClass(this,position,bounds,null,this.tileSize,this.tileOptions);},addTileMonitoringHooks:function(tile){tile.onLoadStart=function(){if(this.numLoadingTiles==0){this.events.triggerEvent("loadstart");}
this.numLoadingTiles++;};tile.events.register("loadstart",this,tile.onLoadStart);tile.onLoadEnd=function(){this.numLoadingTiles--;this.events.triggerEvent("tileloaded");if(this.numLoadingTiles==0){this.events.triggerEvent("loadend");if(this.backBuffer){this.backBufferTimerId=window.setTimeout(OpenLayers.Function.bind(this.removeBackBuffer,this),2500);}}};tile.events.register("loadend",this,tile.onLoadEnd);tile.events.register("unload",this,tile.onLoadEnd);},removeTileMonitoringHooks:function(tile){tile.unload();tile.events.un({"loadstart":tile.onLoadStart,"loadend":tile.onLoadEnd,"unload":tile.onLoadEnd,scope:this});},moveGriddedTiles:function(){var shifted=true;var buffer=this.buffer||1;var scale=this.getResolutionScale();var tlLayer=this.grid[0][0].position.clone();tlLayer.x*=scale;tlLayer.y*=scale;tlLayer=tlLayer.add(parseInt(this.div.style.left,10),parseInt(this.div.style.top,10));var offsetX=parseInt(this.map.layerContainerDiv.style.left);var offsetY=parseInt(this.map.layerContainerDiv.style.top);var tlViewPort=tlLayer.add(offsetX,offsetY);var tileSize={w:this.tileSize.w*scale,h:this.tileSize.h*scale};if(tlViewPort.x>-tileSize.w*(buffer-1)){this.shiftColumn(true);}else if(tlViewPort.x<-tileSize.w*buffer){this.shiftColumn(false);}else if(tlViewPort.y>-tileSize.h*(buffer-1)){this.shiftRow(true);}else if(tlViewPort.y<-tileSize.h*buffer){this.shiftRow(false);}else{shifted=false;}
if(shifted){this.timerId=window.setTimeout(this._moveGriddedTiles,0);}},shiftRow:function(prepend){var modelRowIndex=(prepend)?0:(this.grid.length-1);var grid=this.grid;var modelRow=grid[modelRowIndex];var resolution=this.getServerResolution();var deltaY=(prepend)?-this.tileSize.h:this.tileSize.h;var deltaLat=resolution*-deltaY;var row=(prepend)?grid.pop():grid.shift();for(var i=0,len=modelRow.length;i<len;i++){var modelTile=modelRow[i];var bounds=modelTile.bounds.clone();var position=modelTile.position.clone();bounds.bottom=bounds.bottom+deltaLat;bounds.top=bounds.top+deltaLat;position.y=position.y+deltaY;row[i].moveTo(bounds,position);}
if(prepend){grid.unshift(row);}else{grid.push(row);}},shiftColumn:function(prepend){var deltaX=(prepend)?-this.tileSize.w:this.tileSize.w;var resolution=this.getServerResolution();var deltaLon=resolution*deltaX;for(var i=0,len=this.grid.length;i<len;i++){var row=this.grid[i];var modelTileIndex=(prepend)?0:(row.length-1);var modelTile=row[modelTileIndex];var bounds=modelTile.bounds.clone();var position=modelTile.position.clone();bounds.left=bounds.left+deltaLon;bounds.right=bounds.right+deltaLon;position.x=position.x+deltaX;var tile=prepend?this.grid[i].pop():this.grid[i].shift();tile.moveTo(bounds,position);if(prepend){row.unshift(tile);}else{row.push(tile);}}},removeExcessTiles:function(rows,columns){while(this.grid.length>rows){var row=this.grid.pop();for(var i=0,l=row.length;i<l;i++){var tile=row[i];this.removeTileMonitoringHooks(tile);tile.destroy();}}
while(this.grid[0].length>columns){for(var i=0,l=this.grid.length;i<l;i++){var row=this.grid[i];var tile=row.pop();this.removeTileMonitoringHooks(tile);tile.destroy();}}},onMapResize:function(){if(this.singleTile){this.clearGrid();this.setTileSize();}},getTileBounds:function(viewPortPx){var maxExtent=this.maxExtent;var resolution=this.getResolution();var tileMapWidth=resolution*this.tileSize.w;var tileMapHeight=resolution*this.tileSize.h;var mapPoint=this.getLonLatFromViewPortPx(viewPortPx);var tileLeft=maxExtent.left+(tileMapWidth*Math.floor((mapPoint.lon-
maxExtent.left)/tileMapWidth));var tileBottom=maxExtent.bottom+(tileMapHeight*Math.floor((mapPoint.lat-
maxExtent.bottom)/tileMapHeight));return new OpenLayers.Bounds(tileLeft,tileBottom,tileLeft+tileMapWidth,tileBottom+tileMapHeight);},CLASS_NAME:"OpenLayers.Layer.Grid"});OpenLayers.Layer.TileCache=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:true,format:'image/png',serverResolutions:null,initialize:function(name,url,layername,options){this.layername=layername;OpenLayers.Layer.Grid.prototype.initialize.apply(this,[name,url,{},options]);this.extension=this.format.split('/')[1].toLowerCase();this.extension=(this.extension=='jpg')?'jpeg':this.extension;},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.TileCache(this.name,this.url,this.layername,this.getOptions());}
obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj;},getURL:function(bounds){var res=this.getServerResolution();var bbox=this.maxExtent;var size=this.tileSize;var tileX=Math.round((bounds.left-bbox.left)/(res*size.w));var tileY=Math.round((bounds.bottom-bbox.bottom)/(res*size.h));var tileZ=this.serverResolutions!=null?OpenLayers.Util.indexOf(this.serverResolutions,res):this.map.getZoom();function zeroPad(number,length){number=String(number);var zeros=[];for(var i=0;i<length;++i){zeros.push('0');}
return zeros.join('').substring(0,length-number.length)+number;}
var components=[this.layername,zeroPad(tileZ,2),zeroPad(parseInt(tileX/1000000),3),zeroPad((parseInt(tileX/1000)%1000),3),zeroPad((parseInt(tileX)%1000),3),zeroPad(parseInt(tileY/1000000),3),zeroPad((parseInt(tileY/1000)%1000),3),zeroPad((parseInt(tileY)%1000),3)+'.'+this.extension];var path=components.join('/');var url=this.url;if(OpenLayers.Util.isArray(url)){url=this.selectUrl(path,url);}
url=(url.charAt(url.length-1)=='/')?url:url+'/';return url+path;},CLASS_NAME:"OpenLayers.Layer.TileCache"});OpenLayers.Layer.WMS=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{service:"WMS",version:"1.1.1",request:"GetMap",styles:"",format:"image/jpeg"},isBaseLayer:true,encodeBBOX:false,noMagic:false,yx:{'EPSG:4326':true},initialize:function(name,url,params,options){var newArguments=[];params=OpenLayers.Util.upperCaseObject(params);if(parseFloat(params.VERSION)>=1.3&&!params.EXCEPTIONS){params.EXCEPTIONS="INIMAGE";}
newArguments.push(name,url,params,options);OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);OpenLayers.Util.applyDefaults(this.params,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS));if(!this.noMagic&&this.params.TRANSPARENT&&this.params.TRANSPARENT.toString().toLowerCase()=="true"){if((options==null)||(!options.isBaseLayer)){this.isBaseLayer=false;}
if(this.params.FORMAT=="image/jpeg"){this.params.FORMAT=OpenLayers.Util.alphaHack()?"image/gif":"image/png";}}},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.WMS(this.name,this.url,this.params,this.getOptions());}
obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj;},reverseAxisOrder:function(){return(parseFloat(this.params.VERSION)>=1.3&&!!this.yx[this.map.getProjectionObject().getCode()]);},getURL:function(bounds){bounds=this.adjustBounds(bounds);var imageSize=this.getImageSize();var newParams={};var reverseAxisOrder=this.reverseAxisOrder();newParams.BBOX=this.encodeBBOX?bounds.toBBOX(null,reverseAxisOrder):bounds.toArray(reverseAxisOrder);newParams.WIDTH=imageSize.w;newParams.HEIGHT=imageSize.h;var requestString=this.getFullRequestString(newParams);return requestString;},mergeNewParams:function(newParams){var upperParams=OpenLayers.Util.upperCaseObject(newParams);var newArguments=[upperParams];return OpenLayers.Layer.Grid.prototype.mergeNewParams.apply(this,newArguments);},getFullRequestString:function(newParams,altUrl){var mapProjection=this.map.getProjectionObject();var projectionCode=this.projection&&this.projection.equals(mapProjection)?this.projection.getCode():mapProjection.getCode();var value=(projectionCode=="none")?null:projectionCode;if(parseFloat(this.params.VERSION)>=1.3){this.params.CRS=value;}else{this.params.SRS=value;}
if(typeof this.params.TRANSPARENT=="boolean"){newParams.TRANSPARENT=this.params.TRANSPARENT?"TRUE":"FALSE";}
return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments);},CLASS_NAME:"OpenLayers.Layer.WMS"});Ext.namespace("cdbund");cdbund.API=OpenLayers.Class(MapFish.API,{lang:'de',mapOptions:null,bgLayers:{},mapOpacitySlider:null,mapOpacityValue:100,initialize:function(config){MapFish.API.prototype.initialize.apply(this,arguments);this.baseConfig=cdbund.config;if(this.isMainApp){this.baseConfig.baseUrl='';}
if(config){Ext.apply(this.baseConfig,config);}},createSearchBox:function(config){config=config||{};var store=new Ext.data.JsonStore({proxy:new Ext.data.HttpProxy({url:this.baseConfig.searchUrl+'properties',method:'GET'}),baseParams:{lang:OpenLayers.Lang.getCode(),ref:config.ref||''},root:'results',fields:['label','listlabel','service','bbox','objectorig']});var tpl=new Ext.XTemplate('<tpl for="."><div class="x-combo-list-item {service}">','{listlabel}','</div></tpl>');var searchConfig={store:store,tpl:tpl,hideTrigger:true,minChars:2,queryDelay:50,emptyText:OpenLayers.i18n('Geo search...'),loadingText:OpenLayers.i18n('loadingText'),displayField:'label',cls:'cbSearchCls',ctCls:'cbSearchContainerCls',width:config.width||200};if(config.renderTo){searchConfig['renderTo']=config.renderTo;}
var search=new Ext.form.ComboBox(searchConfig);search.on('beforequery',function(queryEvent){var query=queryEvent.query;var coord_re=/([\d\.']+)[\s,]+([\d\.']+)/;var match=query.match(coord_re);if(match){var left=parseFloat(match[1].replace("'",""));var right=parseFloat(match[2].replace("'",""));var position=new OpenLayers.LonLat(left>right?left:right,right<left?right:left);var valid=false;if(this.map.maxExtent.containsLonLat(position)){valid=true;}else{position=new OpenLayers.LonLat(left<right?left:right,right>left?right:left);position.transform(new OpenLayers.Projection("EPSG:4326"),this.map.getProjectionObject());if(this.map.maxExtent.containsLonLat(position)){valid=true;}}
if(valid){this.map.setCenter(position,5);return false;}}
return true;},this);search.on('select',function(combo,record,index){var bbox=record.get('bbox');var service=record.get('service');if(bbox){if(service=='swissnames'){var objectorig=record.get('objectorig');if(objectorig=='LK500'){this.map.setCenter(OpenLayers.Bounds.fromArray(bbox).getCenterLonLat(),4);}else if(objectorig=='LK200'){this.map.setCenter(OpenLayers.Bounds.fromArray(bbox).getCenterLonLat(),5);}else if(objectorig=='LK100'){this.map.setCenter(OpenLayers.Bounds.fromArray(bbox).getCenterLonLat(),6);}else if(objectorig=='LK50'){this.map.setCenter(OpenLayers.Bounds.fromArray(bbox).getCenterLonLat(),7);}else if(objectorig=='LK25'){this.map.setCenter(OpenLayers.Bounds.fromArray(bbox).getCenterLonLat(),8);}else{this.map.zoomToExtent(OpenLayers.Bounds.fromArray(bbox));}}else{this.map.zoomToExtent(OpenLayers.Bounds.fromArray(bbox));}}},this);return search;},createMapOpacitySlider:function(config){config=config||{};this.handleMapOpacity();this.mapOpacitySlider=new GeoExt.LayerOpacitySlider(Ext.apply({cls:'mapopacityslider',layer:this.bgLayers['primaryLayer'],complementaryLayer:this.bgLayers['complementaryLayer'],changeVisibility:true,width:config.width||200,aggressive:true,plugins:new GeoExt.LayerOpacitySliderTip({template:OpenLayers.i18n('slidertip'),minWidth:50,offsets:[0,100],hover:true})},config));return this.mapOpacitySlider;},createMap:function(config){this.map=MapFish.API.prototype.createMap.apply(this,arguments);if(this.isMainApp){if(this.map.zoom<2){this.map.zoomTo(1);}}
return this.map;},handleMapOpacity:function(){this.bgLayers['primaryLayer'].setOpacity(this.mapOpacityValue/100);if(this.mapOpacityValue==100){return;}
if(this.mapOpacityValue==0){this.bgLayers['primaryLayer'].setVisibility(false);this.bgLayers['complementaryLayer'].setVisibility(true);}else{this.bgLayers['primaryLayer'].setVisibility(true);this.bgLayers['complementaryLayer'].setVisibility(true);}},getMapOptions:function(){if(!this.mapOptions){this.mapOptions={projection:new OpenLayers.Projection("EPSG:21781"),units:"m",maxExtent:new OpenLayers.Bounds.fromArray(this.baseConfig.maxExtent),restrictedExtent:new OpenLayers.Bounds.fromArray(this.baseConfig.maxExtent),allOverlays:true,resolutions:this.baseConfig.resolutions};}
return this.mapOptions;},getLayers:function(config){return[new OpenLayers.Layer("void-layer",{isBaseLayer:true,visibility:false}),new OpenLayers.Layer.TileCache("pixelmaps-color",this.baseConfig.tilecacheDirectUrl,'Pixelmap_color_smaller',{format:'image/png',isBaseLayer:true,buffer:0,resolutions:this.baseConfig.pixelmapResolutions,transitionEffect:'resize',serverResolutions:this.baseConfig.serverResolutions}),new OpenLayers.Layer.TileCache("pixelmaps-gray",this.baseConfig.tilecacheDirectUrl,'Pixelmap_gray',{format:'image/png',isBaseLayer:true,visibility:false,buffer:0,resolutions:this.baseConfig.pixelmapResolutions,transitionEffect:'resize'}),new OpenLayers.Layer.TileCache("aerial",['http://t0.tilecache.ab-swisstopo.camptocamp.net/cache/','http://t1.tilecache.ab-swisstopo.camptocamp.net/cache/','http://t3.tilecache.ab-swisstopo.camptocamp.net/cache/'],'aerial_smaller',{format:'image/jpeg',isBaseLayer:true,visibility:false,buffer:0,transitionEffect:'resize',serverResolutions:this.baseConfig.serverResolutions}),new OpenLayers.Layer.WMS("admin",this.baseConfig.tilecacheUrl,{layers:['gemeinde','bezirke','kanton','suisse'],transparent:true,format:'image/png'},{isBaseLayer:false,visibility:false,buffer:0})];},getControls:function(config){var options=this.getMapOptions();return[new OpenLayers.Control.Navigation(),new OpenLayers.Control.ScaleLine(),new OpenLayers.Control.MousePosition({div:$('mousepos'),numDigits:0,prefix:OpenLayers.i18n('Coordinates (m): ')}),new OpenLayers.Control.OverviewMap({div:$('overviewmap'),layers:[new OpenLayers.Layer.Image("overview",this.baseConfig.baseUrl+"gfx/keymap.png",new OpenLayers.Bounds(485000,65000,835000,298000),new OpenLayers.Size(150,99))],size:new OpenLayers.Size(180,100),isSuitableOverview:function(){return true;},mapOptions:{units:options.units,projection:options.projection,maxExtent:options.maxExtent,scales:[7000000]}}),new OpenLayers.Control.Scale($('scale'),{updateScale:function(){var scale=this.map.getScale();if(!scale){return;}
this.element.innerHTML=OpenLayers.i18n("scale",{scaleDenom:OpenLayers.Number.format(scale,0,"'")});}})];},getLayerTreeModel:function(){return[{text:OpenLayers.i18n('Background'),printText:'',expanded:false,children:[{text:OpenLayers.i18n('Administrative'),printText:'',checked:false,expanded:true,children:[{text:OpenLayers.i18n('Gemeinde'),printText:'',checked:false,layerName:'admin:gemeinde'},{text:OpenLayers.i18n('Bezirk'),printText:'',checked:false,layerName:'admin:bezirke'},{text:OpenLayers.i18n('Kanton'),printText:'',checked:false,layerName:'admin:kanton'},{text:OpenLayers.i18n('Schweiz'),printText:'',checked:false,layerName:'admin:suisse'}]},{text:OpenLayers.i18n('Nationales Maps'),printText:'',checked:true,layerName:'pixelmaps-color'},{text:OpenLayers.i18n('Grays Nationales Maps'),printText:'',checked:false,layerName:'pixelmaps-gray'},{text:OpenLayers.i18n('Aerial Images'),printText:'',checked:false,layerName:'aerial'},{text:OpenLayers.i18n('None'),printText:'',checked:false,layerName:'void-layer'}]}];},getMapOpacitySlider:function(){if(!this.mapOpacitySlider){this.mapOpacitySlider=this.createMapOpacitySlider();}
return this.mapOpacitySlider;}});OpenLayers.Layer.Image=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:true,url:null,extent:null,size:null,tile:null,aspectRatio:null,initialize:function(name,url,extent,size,options){this.url=url;this.extent=extent;this.maxExtent=extent;this.size=size;OpenLayers.Layer.prototype.initialize.apply(this,[name,options]);this.aspectRatio=(this.extent.getHeight()/this.size.h)/(this.extent.getWidth()/this.size.w);},destroy:function(){if(this.tile){this.removeTileMonitoringHooks(this.tile);this.tile.destroy();this.tile=null;}
OpenLayers.Layer.prototype.destroy.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.Image(this.name,this.url,this.extent,this.size,this.getOptions());}
obj=OpenLayers.Layer.prototype.clone.apply(this,[obj]);return obj;},setMap:function(map){if(this.options.maxResolution==null){this.options.maxResolution=this.aspectRatio*this.extent.getWidth()/this.size.w;}
OpenLayers.Layer.prototype.setMap.apply(this,arguments);},moveTo:function(bounds,zoomChanged,dragging){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);var firstRendering=(this.tile==null);if(zoomChanged||firstRendering){this.setTileSize();var ulPx=this.map.getLayerPxFromLonLat({lon:this.extent.left,lat:this.extent.top});if(firstRendering){this.tile=new OpenLayers.Tile.Image(this,ulPx,this.extent,null,this.tileSize);this.addTileMonitoringHooks(this.tile);}else{this.tile.size=this.tileSize.clone();this.tile.position=ulPx.clone();}
this.tile.draw();}},setTileSize:function(){var tileWidth=this.extent.getWidth()/this.map.getResolution();var tileHeight=this.extent.getHeight()/this.map.getResolution();this.tileSize=new OpenLayers.Size(tileWidth,tileHeight);},addTileMonitoringHooks:function(tile){tile.onLoadStart=function(){this.events.triggerEvent("loadstart");};tile.events.register("loadstart",this,tile.onLoadStart);tile.onLoadEnd=function(){this.events.triggerEvent("loadend");};tile.events.register("loadend",this,tile.onLoadEnd);tile.events.register("unload",this,tile.onLoadEnd);},removeTileMonitoringHooks:function(tile){tile.unload();tile.events.un({"loadstart":tile.onLoadStart,"loadend":tile.onLoadEnd,"unload":tile.onLoadEnd,scope:this});},setUrl:function(newUrl){this.url=newUrl;this.tile.draw();},getURL:function(bounds){return this.url;},CLASS_NAME:"OpenLayers.Layer.Image"});OpenLayers.Format.XML=OpenLayers.Class(OpenLayers.Format,{namespaces:null,namespaceAlias:null,defaultPrefix:null,readers:{},writers:{},xmldom:null,initialize:function(options){if(window.ActiveXObject){this.xmldom=new ActiveXObject("Microsoft.XMLDOM");}
OpenLayers.Format.prototype.initialize.apply(this,[options]);this.namespaces=OpenLayers.Util.extend({},this.namespaces);this.namespaceAlias={};for(var alias in this.namespaces){this.namespaceAlias[this.namespaces[alias]]=alias;}},destroy:function(){this.xmldom=null;OpenLayers.Format.prototype.destroy.apply(this,arguments);},setNamespace:function(alias,uri){this.namespaces[alias]=uri;this.namespaceAlias[uri]=alias;},read:function(text){var index=text.indexOf('<');if(index>0){text=text.substring(index);}
var node=OpenLayers.Util.Try(OpenLayers.Function.bind((function(){var xmldom;if(window.ActiveXObject&&!this.xmldom){xmldom=new ActiveXObject("Microsoft.XMLDOM");}else{xmldom=this.xmldom;}
xmldom.loadXML(text);return xmldom;}),this),function(){return new DOMParser().parseFromString(text,'text/xml');},function(){var req=new XMLHttpRequest();req.open("GET","data:"+"text/xml"+";charset=utf-8,"+encodeURIComponent(text),false);if(req.overrideMimeType){req.overrideMimeType("text/xml");}
req.send(null);return req.responseXML;});if(this.keepData){this.data=node;}
return node;},write:function(node){var data;if(this.xmldom){data=node.xml;}else{var serializer=new XMLSerializer();if(node.nodeType==1){var doc=document.implementation.createDocument("","",null);if(doc.importNode){node=doc.importNode(node,true);}
doc.appendChild(node);data=serializer.serializeToString(doc);}else{data=serializer.serializeToString(node);}}
return data;},createElementNS:function(uri,name){var element;if(this.xmldom){if(typeof uri=="string"){element=this.xmldom.createNode(1,name,uri);}else{element=this.xmldom.createNode(1,name,"");}}else{element=document.createElementNS(uri,name);}
return element;},createTextNode:function(text){var node;if(typeof text!=="string"){text=String(text);}
if(this.xmldom){node=this.xmldom.createTextNode(text);}else{node=document.createTextNode(text);}
return node;},getElementsByTagNameNS:function(node,uri,name){var elements=[];if(node.getElementsByTagNameNS){elements=node.getElementsByTagNameNS(uri,name);}else{var allNodes=node.getElementsByTagName("*");var potentialNode,fullName;for(var i=0,len=allNodes.length;i<len;++i){potentialNode=allNodes[i];fullName=(potentialNode.prefix)?(potentialNode.prefix+":"+name):name;if((name=="*")||(fullName==potentialNode.nodeName)){if((uri=="*")||(uri==potentialNode.namespaceURI)){elements.push(potentialNode);}}}}
return elements;},getAttributeNodeNS:function(node,uri,name){var attributeNode=null;if(node.getAttributeNodeNS){attributeNode=node.getAttributeNodeNS(uri,name);}else{var attributes=node.attributes;var potentialNode,fullName;for(var i=0,len=attributes.length;i<len;++i){potentialNode=attributes[i];if(potentialNode.namespaceURI==uri){fullName=(potentialNode.prefix)?(potentialNode.prefix+":"+name):name;if(fullName==potentialNode.nodeName){attributeNode=potentialNode;break;}}}}
return attributeNode;},getAttributeNS:function(node,uri,name){var attributeValue="";if(node.getAttributeNS){attributeValue=node.getAttributeNS(uri,name)||"";}else{var attributeNode=this.getAttributeNodeNS(node,uri,name);if(attributeNode){attributeValue=attributeNode.nodeValue;}}
return attributeValue;},getChildValue:function(node,def){var value=def||"";if(node){for(var child=node.firstChild;child;child=child.nextSibling){switch(child.nodeType){case 3:case 4:value+=child.nodeValue;}}}
return value;},isSimpleContent:function(node){var simple=true;for(var child=node.firstChild;child;child=child.nextSibling){if(child.nodeType===1){simple=false;break;}}
return simple;},contentType:function(node){var simple=false,complex=false;var type=OpenLayers.Format.XML.CONTENT_TYPE.EMPTY;for(var child=node.firstChild;child;child=child.nextSibling){switch(child.nodeType){case 1:complex=true;break;case 8:break;default:simple=true;}
if(complex&&simple){break;}}
if(complex&&simple){type=OpenLayers.Format.XML.CONTENT_TYPE.MIXED;}else if(complex){return OpenLayers.Format.XML.CONTENT_TYPE.COMPLEX;}else if(simple){return OpenLayers.Format.XML.CONTENT_TYPE.SIMPLE;}
return type;},hasAttributeNS:function(node,uri,name){var found=false;if(node.hasAttributeNS){found=node.hasAttributeNS(uri,name);}else{found=!!this.getAttributeNodeNS(node,uri,name);}
return found;},setAttributeNS:function(node,uri,name,value){if(node.setAttributeNS){node.setAttributeNS(uri,name,value);}else{if(this.xmldom){if(uri){var attribute=node.ownerDocument.createNode(2,name,uri);attribute.nodeValue=value;node.setAttributeNode(attribute);}else{node.setAttribute(name,value);}}else{throw"setAttributeNS not implemented";}}},createElementNSPlus:function(name,options){options=options||{};var uri=options.uri||this.namespaces[options.prefix];if(!uri){var loc=name.indexOf(":");uri=this.namespaces[name.substring(0,loc)];}
if(!uri){uri=this.namespaces[this.defaultPrefix];}
var node=this.createElementNS(uri,name);if(options.attributes){this.setAttributes(node,options.attributes);}
var value=options.value;if(value!=null){node.appendChild(this.createTextNode(value));}
return node;},setAttributes:function(node,obj){var value,uri;for(var name in obj){if(obj[name]!=null&&obj[name].toString){value=obj[name].toString();uri=this.namespaces[name.substring(0,name.indexOf(":"))]||null;this.setAttributeNS(node,uri,name,value);}}},readNode:function(node,obj){if(!obj){obj={};}
var group=this.readers[node.namespaceURI?this.namespaceAlias[node.namespaceURI]:this.defaultPrefix];if(group){var local=node.localName||node.nodeName.split(":").pop();var reader=group[local]||group["*"];if(reader){reader.apply(this,[node,obj]);}}
return obj;},readChildNodes:function(node,obj){if(!obj){obj={};}
var children=node.childNodes;var child;for(var i=0,len=children.length;i<len;++i){child=children[i];if(child.nodeType==1){this.readNode(child,obj);}}
return obj;},writeNode:function(name,obj,parent){var prefix,local;var split=name.indexOf(":");if(split>0){prefix=name.substring(0,split);local=name.substring(split+1);}else{if(parent){prefix=this.namespaceAlias[parent.namespaceURI];}else{prefix=this.defaultPrefix;}
local=name;}
var child=this.writers[prefix][local].apply(this,[obj]);if(parent){parent.appendChild(child);}
return child;},getChildEl:function(node,name,uri){return node&&this.getThisOrNextEl(node.firstChild,name,uri);},getNextEl:function(node,name,uri){return node&&this.getThisOrNextEl(node.nextSibling,name,uri);},getThisOrNextEl:function(node,name,uri){outer:for(var sibling=node;sibling;sibling=sibling.nextSibling){switch(sibling.nodeType){case 1:if((!name||name===(sibling.localName||sibling.nodeName.split(":").pop()))&&(!uri||uri===sibling.namespaceURI)){break outer;}
sibling=null;break outer;case 3:if(/^\s*$/.test(sibling.nodeValue)){break;}
case 4:case 6:case 12:case 10:case 11:sibling=null;break outer;}}
return sibling||null;},lookupNamespaceURI:function(node,prefix){var uri=null;if(node){if(node.lookupNamespaceURI){uri=node.lookupNamespaceURI(prefix);}else{outer:switch(node.nodeType){case 1:if(node.namespaceURI!==null&&node.prefix===prefix){uri=node.namespaceURI;break outer;}
var len=node.attributes.length;if(len){var attr;for(var i=0;i<len;++i){attr=node.attributes[i];if(attr.prefix==="xmlns"&&attr.name==="xmlns:"+prefix){uri=attr.value||null;break outer;}else if(attr.name==="xmlns"&&prefix===null){uri=attr.value||null;break outer;}}}
uri=this.lookupNamespaceURI(node.parentNode,prefix);break outer;case 2:uri=this.lookupNamespaceURI(node.ownerElement,prefix);break outer;case 9:uri=this.lookupNamespaceURI(node.documentElement,prefix);break outer;case 6:case 12:case 10:case 11:break outer;default:uri=this.lookupNamespaceURI(node.parentNode,prefix);break outer;}}}
return uri;},getXMLDoc:function(){if(!OpenLayers.Format.XML.document&&!this.xmldom){if(document.implementation&&document.implementation.createDocument){OpenLayers.Format.XML.document=document.implementation.createDocument("","",null);}else if(!this.xmldom&&window.ActiveXObject){this.xmldom=new ActiveXObject("Microsoft.XMLDOM");}}
return OpenLayers.Format.XML.document||this.xmldom;},CLASS_NAME:"OpenLayers.Format.XML"});OpenLayers.Format.XML.CONTENT_TYPE={EMPTY:0,SIMPLE:1,COMPLEX:2,MIXED:3};OpenLayers.Format.XML.lookupNamespaceURI=OpenLayers.Function.bind(OpenLayers.Format.XML.prototype.lookupNamespaceURI,OpenLayers.Format.XML.prototype);OpenLayers.Format.XML.document=null;OpenLayers.Format.GPX=OpenLayers.Class(OpenLayers.Format.XML,{defaultDesc:"No description available",extractWaypoints:true,extractTracks:true,extractRoutes:true,extractAttributes:true,namespaces:{gpx:"http://www.topografix.com/GPX/1/1",xsi:"http://www.w3.org/2001/XMLSchema-instance"},schemaLocation:"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd",initialize:function(options){this.externalProjection=new OpenLayers.Projection("EPSG:4326");OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);},read:function(doc){if(typeof doc=="string"){doc=OpenLayers.Format.XML.prototype.read.apply(this,[doc]);}
var features=[];if(this.extractTracks){var tracks=doc.getElementsByTagName("trk");for(var i=0,len=tracks.length;i<len;i++){var attrs={};if(this.extractAttributes){attrs=this.parseAttributes(tracks[i]);}
var segs=this.getElementsByTagNameNS(tracks[i],tracks[i].namespaceURI,"trkseg");for(var j=0,seglen=segs.length;j<seglen;j++){var track=this.extractSegment(segs[j],"trkpt");features.push(new OpenLayers.Feature.Vector(track,attrs));}}}
if(this.extractRoutes){var routes=doc.getElementsByTagName("rte");for(var k=0,klen=routes.length;k<klen;k++){var attrs={};if(this.extractAttributes){attrs=this.parseAttributes(routes[k]);}
var route=this.extractSegment(routes[k],"rtept");features.push(new OpenLayers.Feature.Vector(route,attrs));}}
if(this.extractWaypoints){var waypoints=doc.getElementsByTagName("wpt");for(var l=0,len=waypoints.length;l<len;l++){var attrs={};if(this.extractAttributes){attrs=this.parseAttributes(waypoints[l]);}
var wpt=new OpenLayers.Geometry.Point(waypoints[l].getAttribute("lon"),waypoints[l].getAttribute("lat"));features.push(new OpenLayers.Feature.Vector(wpt,attrs));}}
if(this.internalProjection&&this.externalProjection){for(var g=0,featLength=features.length;g<featLength;g++){features[g].geometry.transform(this.externalProjection,this.internalProjection);}}
return features;},extractSegment:function(segment,segmentType){var points=this.getElementsByTagNameNS(segment,segment.namespaceURI,segmentType);var point_features=[];for(var i=0,len=points.length;i<len;i++){point_features.push(new OpenLayers.Geometry.Point(points[i].getAttribute("lon"),points[i].getAttribute("lat")));}
return new OpenLayers.Geometry.LineString(point_features);},parseAttributes:function(node){var attributes={};var attrNode=node.firstChild,value,name;while(attrNode){if(attrNode.nodeType==1){value=attrNode.firstChild;if(value.nodeType==3||value.nodeType==4){name=(attrNode.prefix)?attrNode.nodeName.split(":")[1]:attrNode.nodeName;if(name!="trkseg"&&name!="rtept"){attributes[name]=value.nodeValue;}}}
attrNode=attrNode.nextSibling;}
return attributes;},write:function(features,metadata){features=OpenLayers.Util.isArray(features)?features:[features];var gpx=this.createElementNSPlus("gpx:gpx");gpx.setAttribute("version","1.1");this.setAttributes(gpx,{"xsi:schemaLocation":this.schemaLocation});if(metadata&&typeof metadata=='object'){gpx.appendChild(this.buildMetadataNode(metadata));}
for(var i=0,len=features.length;i<len;i++){gpx.appendChild(this.buildFeatureNode(features[i]));}
return OpenLayers.Format.XML.prototype.write.apply(this,[gpx]);},buildMetadataNode:function(metadata){var types=['name','desc','author'],node=this.createElementNSPlus('gpx:metadata');for(var i=0;i<types.length;i++){var type=types[i];if(metadata[type]){var n=this.createElementNSPlus("gpx:"+type);n.appendChild(this.createTextNode(metadata[type]));node.appendChild(n);}}
return node;},buildFeatureNode:function(feature){var geometry=feature.geometry;geometry=geometry.clone();if(this.internalProjection&&this.externalProjection){geometry.transform(this.internalProjection,this.externalProjection);}
if(geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){var wpt=this.buildWptNode(feature);return wpt;}else{var trkNode=this.createElementNSPlus("gpx:trk");this.appendAttributesNode(trkNode,feature);var trkSegNodes=this.buildTrkSegNode(geometry);trkSegNodes=OpenLayers.Util.isArray(trkSegNodes)?trkSegNodes:[trkSegNodes];for(var i=0,len=trkSegNodes.length;i<len;i++){trkNode.appendChild(trkSegNodes[i]);}
return trkNode;}},buildTrkSegNode:function(geometry){var node,i,len,point,nodes;if(geometry.CLASS_NAME=="OpenLayers.Geometry.LineString"||geometry.CLASS_NAME=="OpenLayers.Geometry.LinearRing"){node=this.createElementNSPlus("gpx:trkseg");for(i=0,len=geometry.components.length;i<len;i++){point=geometry.components[i];node.appendChild(this.buildTrkPtNode(point));}
return node;}else{nodes=[];for(i=0,len=geometry.components.length;i<len;i++){nodes.push(this.buildTrkSegNode(geometry.components[i]));}
return nodes;}},buildTrkPtNode:function(point){var node=this.createElementNSPlus("gpx:trkpt");node.setAttribute("lon",point.x);node.setAttribute("lat",point.y);return node;},buildWptNode:function(feature){var node=this.createElementNSPlus("gpx:wpt");node.setAttribute("lon",feature.geometry.x);node.setAttribute("lat",feature.geometry.y);this.appendAttributesNode(node,feature);return node;},appendAttributesNode:function(node,feature){var name=this.createElementNSPlus('gpx:name');name.appendChild(this.createTextNode(feature.attributes.name||feature.id));node.appendChild(name);var desc=this.createElementNSPlus('gpx:desc');desc.appendChild(this.createTextNode(feature.attributes.description||this.defaultDesc));node.appendChild(desc);},CLASS_NAME:"OpenLayers.Format.GPX"});Ext.namespace("GeoExt.ux.data");GeoExt.ux.data.formats=[['KML','OpenLayers.Format.KML',{extractStyles:true,extractAttributes:true,kmlns:"http://www.opengis.net/kml/2.2"}],['GPX','OpenLayers.Format.GPX',{extractTracks:true,extractAttributes:true}],['GeoJSON','OpenLayers.Format.GeoJSON',{}],['GeoRSS','OpenLayers.Format.GeoRSS',{}],['GML','OpenLayers.Format.GML',{}]];GeoExt.ux.data.formats.getFormatConfig=function(format){for(var i=0;i<GeoExt.ux.data.formats.length;i++){if(GeoExt.ux.data.formats[i][0]==format){return GeoExt.ux.data.formats[i][2];}}};GeoExt.ux.data.FormatStore=new Ext.data.SimpleStore({fields:['shortName','openLayersClass','formatConfig'],data:GeoExt.ux.data.formats});OpenLayers.Control.ArgParser=OpenLayers.Class(OpenLayers.Control,{center:null,zoom:null,layers:null,displayProjection:null,getParameters:function(url){url=url||window.location.href;var parameters=OpenLayers.Util.getParameters(url);var index=url.indexOf('#');if(index>0){url='?'+url.substring(index+1,url.length);OpenLayers.Util.extend(parameters,OpenLayers.Util.getParameters(url));}
return parameters;},setMap:function(map){OpenLayers.Control.prototype.setMap.apply(this,arguments);for(var i=0,len=this.map.controls.length;i<len;i++){var control=this.map.controls[i];if((control!=this)&&(control.CLASS_NAME=="OpenLayers.Control.ArgParser")){if(control.displayProjection!=this.displayProjection){this.displayProjection=control.displayProjection;}
break;}}
if(i==this.map.controls.length){var args=this.getParameters();if(args.layers){this.layers=args.layers;this.map.events.register('addlayer',this,this.configureLayers);this.configureLayers();}
if(args.lat&&args.lon){this.center=new OpenLayers.LonLat(parseFloat(args.lon),parseFloat(args.lat));if(args.zoom){this.zoom=parseFloat(args.zoom);}
this.map.events.register('changebaselayer',this,this.setCenter);this.setCenter();}}},setCenter:function(){if(this.map.baseLayer){this.map.events.unregister('changebaselayer',this,this.setCenter);if(this.displayProjection){this.center.transform(this.displayProjection,this.map.getProjectionObject());}
this.map.setCenter(this.center,this.zoom);}},configureLayers:function(){if(this.layers.length==this.map.layers.length){this.map.events.unregister('addlayer',this,this.configureLayers);for(var i=0,len=this.layers.length;i<len;i++){var layer=this.map.layers[i];var c=this.layers.charAt(i);if(c=="B"){this.map.setBaseLayer(layer);}else if((c=="T")||(c=="F")){layer.setVisibility(c=="T");}}}},CLASS_NAME:"OpenLayers.Control.ArgParser"});Ext.namespace("MapFish");MapFish.API.ArgParser=OpenLayers.Class(OpenLayers.Control.ArgParser,{coordsParams:null,api:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.api=options&&options.api;this.coordsParams=options&&options.coordsParams||{lon:'lon',lat:'lat'};},setMap:function(map){OpenLayers.Control.prototype.setMap.apply(this,arguments);var args=OpenLayers.Util.getParameters();if(args.layerNodes){if(typeof args.layerNodes=='string'){args.layerNodes=[args.layerNodes];}
if(this.api){this.api.layerTreeNodes=args.layerNodes;}}
var lon=args[this.coordsParams.lon];var lat=args[this.coordsParams.lat];if(lon&&lat){this.center=new OpenLayers.LonLat(parseFloat(lon),parseFloat(lat));if(args.zoom){this.zoom=parseInt(args.zoom);}
this.map.events.register('changebaselayer',this,this.setCenter);this.setCenter();}},CLASS_NAME:"MapFish.API.ArgParser"});OpenLayers.Handler.Polygon=OpenLayers.Class(OpenLayers.Handler.Path,{holeModifier:null,drawingHole:false,polygon:null,createFeature:function(pixel){var lonlat=this.layer.getLonLatFromViewPortPx(pixel);var geometry=new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat);this.point=new OpenLayers.Feature.Vector(geometry);this.line=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LinearRing([this.point.geometry]));this.polygon=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon([this.line.geometry]));this.callback("create",[this.point.geometry,this.getSketch()]);this.point.geometry.clearBounds();this.layer.addFeatures([this.polygon,this.point],{silent:true});},addPoint:function(pixel){if(!this.drawingHole&&this.holeModifier&&this.evt&&this.evt[this.holeModifier]){var geometry=this.point.geometry;var features=this.control.layer.features;var candidate,polygon;for(var i=features.length-1;i>=0;--i){candidate=features[i].geometry;if((candidate instanceof OpenLayers.Geometry.Polygon||candidate instanceof OpenLayers.Geometry.MultiPolygon)&&candidate.intersects(geometry)){polygon=features[i];this.control.layer.removeFeatures([polygon],{silent:true});this.control.layer.events.registerPriority("sketchcomplete",this,this.finalizeInteriorRing);this.control.layer.events.registerPriority("sketchmodified",this,this.enforceTopology);polygon.geometry.addComponent(this.line.geometry);this.polygon=polygon;this.drawingHole=true;break;}}}
OpenLayers.Handler.Path.prototype.addPoint.apply(this,arguments);},getCurrentPointIndex:function(){return this.line.geometry.components.length-2;},enforceTopology:function(event){var point=event.vertex;var components=this.line.geometry.components;if(!this.polygon.geometry.intersects(point)){var last=components[components.length-3];point.x=last.x;point.y=last.y;}},finishGeometry:function(){var index=this.line.geometry.components.length-2;this.line.geometry.removeComponent(this.line.geometry.components[index]);this.removePoint();this.finalize();},finalizeInteriorRing:function(){var ring=this.line.geometry;var modified=(ring.getArea()!==0);if(modified){var rings=this.polygon.geometry.components;for(var i=rings.length-2;i>=0;--i){if(ring.intersects(rings[i])){modified=false;break;}}
if(modified){var target;outer:for(var i=rings.length-2;i>0;--i){var points=rings[i].components;for(var j=0,jj=points.length;j<jj;++j){if(ring.containsPoint(points[j])){modified=false;break outer;}}}}}
if(modified){if(this.polygon.state!==OpenLayers.State.INSERT){this.polygon.state=OpenLayers.State.UPDATE;}}else{this.polygon.geometry.removeComponent(ring);}
this.restoreFeature();return false;},cancel:function(){if(this.drawingHole){this.polygon.geometry.removeComponent(this.line.geometry);this.restoreFeature(true);}
return OpenLayers.Handler.Path.prototype.cancel.apply(this,arguments);},restoreFeature:function(cancel){this.control.layer.events.unregister("sketchcomplete",this,this.finalizeInteriorRing);this.control.layer.events.unregister("sketchmodified",this,this.enforceTopology);this.layer.removeFeatures([this.polygon],{silent:true});this.control.layer.addFeatures([this.polygon],{silent:true});this.drawingHole=false;if(!cancel){this.control.layer.events.triggerEvent("sketchcomplete",{feature:this.polygon});}},destroyFeature:function(force){OpenLayers.Handler.Path.prototype.destroyFeature.call(this,force);this.polygon=null;},drawFeature:function(){this.layer.drawFeature(this.polygon,this.style);this.layer.drawFeature(this.point,this.style);},getSketch:function(){return this.polygon;},getGeometry:function(){var geometry=this.polygon&&this.polygon.geometry;if(geometry&&this.multi){geometry=new OpenLayers.Geometry.MultiPolygon([geometry]);}
return geometry;},CLASS_NAME:"OpenLayers.Handler.Polygon"});OpenLayers.Control.DragFeature=OpenLayers.Class(OpenLayers.Control,{geometryTypes:null,onStart:function(feature,pixel){},onDrag:function(feature,pixel){},onComplete:function(feature,pixel){},onEnter:function(feature){},onLeave:function(feature){},documentDrag:false,layer:null,feature:null,dragCallbacks:{},featureCallbacks:{},lastPixel:null,initialize:function(layer,options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.layer=layer;this.handlers={drag:new OpenLayers.Handler.Drag(this,OpenLayers.Util.extend({down:this.downFeature,move:this.moveFeature,up:this.upFeature,out:this.cancel,done:this.doneDragging},this.dragCallbacks),{documentDrag:this.documentDrag}),feature:new OpenLayers.Handler.Feature(this,this.layer,OpenLayers.Util.extend({click:this.clickFeature,clickout:this.clickoutFeature,over:this.overFeature,out:this.outFeature},this.featureCallbacks),{geometryTypes:this.geometryTypes})};},clickFeature:function(feature){if(this.handlers.feature.touch&&!this.over&&this.overFeature(feature)){this.handlers.drag.dragstart(this.handlers.feature.evt);this.handlers.drag.stopDown=false;}},clickoutFeature:function(feature){if(this.handlers.feature.touch&&this.over){this.outFeature(feature);this.handlers.drag.stopDown=true;}},destroy:function(){this.layer=null;OpenLayers.Control.prototype.destroy.apply(this,[]);},activate:function(){return(this.handlers.feature.activate()&&OpenLayers.Control.prototype.activate.apply(this,arguments));},deactivate:function(){this.handlers.drag.deactivate();this.handlers.feature.deactivate();this.feature=null;this.dragging=false;this.lastPixel=null;OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass+"Over");return OpenLayers.Control.prototype.deactivate.apply(this,arguments);},overFeature:function(feature){var activated=false;if(!this.handlers.drag.dragging){this.feature=feature;this.handlers.drag.activate();activated=true;this.over=true;OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass+"Over");this.onEnter(feature);}else{if(this.feature.id==feature.id){this.over=true;}else{this.over=false;}}
return activated;},downFeature:function(pixel){this.lastPixel=pixel;this.onStart(this.feature,pixel);},moveFeature:function(pixel){var res=this.map.getResolution();this.feature.geometry.move(res*(pixel.x-this.lastPixel.x),res*(this.lastPixel.y-pixel.y));this.layer.drawFeature(this.feature);this.lastPixel=pixel;this.onDrag(this.feature,pixel);},upFeature:function(pixel){if(!this.over){this.handlers.drag.deactivate();}},doneDragging:function(pixel){this.onComplete(this.feature,pixel);},outFeature:function(feature){if(!this.handlers.drag.dragging){this.over=false;this.handlers.drag.deactivate();OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass+"Over");this.onLeave(feature);this.feature=null;}else{if(this.feature.id==feature.id){this.over=false;}}},cancel:function(){this.handlers.drag.deactivate();this.over=false;},setMap:function(map){this.handlers.drag.setMap(map);this.handlers.feature.setMap(map);OpenLayers.Control.prototype.setMap.apply(this,arguments);},CLASS_NAME:"OpenLayers.Control.DragFeature"});OpenLayers.Handler.Keyboard=OpenLayers.Class(OpenLayers.Handler,{KEY_EVENTS:["keydown","keyup"],eventListener:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.eventListener=OpenLayers.Function.bindAsEventListener(this.handleKeyEvent,this);},destroy:function(){this.deactivate();this.eventListener=null;OpenLayers.Handler.prototype.destroy.apply(this,arguments);},activate:function(){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){for(var i=0,len=this.KEY_EVENTS.length;i<len;i++){OpenLayers.Event.observe(document,this.KEY_EVENTS[i],this.eventListener);}
return true;}else{return false;}},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){for(var i=0,len=this.KEY_EVENTS.length;i<len;i++){OpenLayers.Event.stopObserving(document,this.KEY_EVENTS[i],this.eventListener);}
deactivated=true;}
return deactivated;},handleKeyEvent:function(evt){if(this.checkModifiers(evt)){this.callback(evt.type,[evt]);}},CLASS_NAME:"OpenLayers.Handler.Keyboard"});OpenLayers.Control.ModifyFeature=OpenLayers.Class(OpenLayers.Control,{geometryTypes:null,clickout:true,toggle:true,standalone:false,layer:null,feature:null,vertices:null,virtualVertices:null,selectControl:null,dragControl:null,handlers:null,deleteCodes:null,virtualStyle:null,vertexRenderIntent:null,mode:null,modified:false,radiusHandle:null,dragHandle:null,onModificationStart:function(){},onModification:function(){},onModificationEnd:function(){},initialize:function(layer,options){options=options||{};this.layer=layer;this.vertices=[];this.virtualVertices=[];this.virtualStyle=OpenLayers.Util.extend({},this.layer.style||this.layer.styleMap.createSymbolizer(null,options.vertexRenderIntent));this.virtualStyle.fillOpacity=0.3;this.virtualStyle.strokeOpacity=0.3;this.deleteCodes=[46,68];this.mode=OpenLayers.Control.ModifyFeature.RESHAPE;OpenLayers.Control.prototype.initialize.apply(this,[options]);if(!(OpenLayers.Util.isArray(this.deleteCodes))){this.deleteCodes=[this.deleteCodes];}
var control=this;var selectOptions={geometryTypes:this.geometryTypes,clickout:this.clickout,toggle:this.toggle,onBeforeSelect:this.beforeSelectFeature,onSelect:this.selectFeature,onUnselect:this.unselectFeature,scope:this};if(this.standalone===false){this.selectControl=new OpenLayers.Control.SelectFeature(layer,selectOptions);}
var dragOptions={geometryTypes:["OpenLayers.Geometry.Point"],snappingOptions:this.snappingOptions,onStart:function(feature,pixel){control.dragStart.apply(control,[feature,pixel]);},onDrag:function(feature,pixel){control.dragVertex.apply(control,[feature,pixel]);},onComplete:function(feature){control.dragComplete.apply(control,[feature]);},featureCallbacks:{over:function(feature){if(control.standalone!==true||feature._sketch||control.feature===feature){control.dragControl.overFeature.apply(control.dragControl,[feature]);}}}};this.dragControl=new OpenLayers.Control.DragFeature(layer,dragOptions);var keyboardOptions={keydown:this.handleKeypress};this.handlers={keyboard:new OpenLayers.Handler.Keyboard(this,keyboardOptions)};},destroy:function(){this.layer=null;this.standalone||this.selectControl.destroy();this.dragControl.destroy();OpenLayers.Control.prototype.destroy.apply(this,[]);},activate:function(){return((this.standalone||this.selectControl.activate())&&this.handlers.keyboard.activate()&&OpenLayers.Control.prototype.activate.apply(this,arguments));},deactivate:function(){var deactivated=false;if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)){this.layer.removeFeatures(this.vertices,{silent:true});this.layer.removeFeatures(this.virtualVertices,{silent:true});this.vertices=[];this.dragControl.deactivate();var feature=this.feature;var valid=feature&&feature.geometry&&feature.layer;if(this.standalone===false){if(valid){this.selectControl.unselect.apply(this.selectControl,[feature]);}
this.selectControl.deactivate();}else{if(valid){this.unselectFeature(feature);}}
this.handlers.keyboard.deactivate();deactivated=true;}
return deactivated;},beforeSelectFeature:function(feature){return this.layer.events.triggerEvent("beforefeaturemodified",{feature:feature});},selectFeature:function(feature){if(!this.standalone||this.beforeSelectFeature(feature)!==false){this.feature=feature;this.modified=false;this.resetVertices();this.dragControl.activate();this.onModificationStart(this.feature);}
var modified=feature.modified;if(feature.geometry&&!(modified&&modified.geometry)){this._originalGeometry=feature.geometry.clone();}},unselectFeature:function(feature){this.layer.removeFeatures(this.vertices,{silent:true});this.vertices=[];this.layer.destroyFeatures(this.virtualVertices,{silent:true});this.virtualVertices=[];if(this.dragHandle){this.layer.destroyFeatures([this.dragHandle],{silent:true});delete this.dragHandle;}
if(this.radiusHandle){this.layer.destroyFeatures([this.radiusHandle],{silent:true});delete this.radiusHandle;}
this.feature=null;this.dragControl.deactivate();this.onModificationEnd(feature);this.layer.events.triggerEvent("afterfeaturemodified",{feature:feature,modified:this.modified});this.modified=false;},dragStart:function(feature,pixel){if(feature!=this.feature&&!feature.geometry.parent&&feature!=this.dragHandle&&feature!=this.radiusHandle){if(this.standalone===false&&this.feature){this.selectControl.clickFeature.apply(this.selectControl,[this.feature]);}
if(this.geometryTypes==null||OpenLayers.Util.indexOf(this.geometryTypes,feature.geometry.CLASS_NAME)!=-1){this.standalone||this.selectControl.clickFeature.apply(this.selectControl,[feature]);this.dragControl.overFeature.apply(this.dragControl,[feature]);this.dragControl.lastPixel=pixel;this.dragControl.handlers.drag.started=true;this.dragControl.handlers.drag.start=pixel;this.dragControl.handlers.drag.last=pixel;}}},dragVertex:function(vertex,pixel){this.modified=true;if(this.feature.geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){if(this.feature!=vertex){this.feature=vertex;}
this.layer.events.triggerEvent("vertexmodified",{vertex:vertex.geometry,feature:this.feature,pixel:pixel});}else{if(vertex._index){vertex.geometry.parent.addComponent(vertex.geometry,vertex._index);delete vertex._index;OpenLayers.Util.removeItem(this.virtualVertices,vertex);this.vertices.push(vertex);}else if(vertex==this.dragHandle){this.layer.removeFeatures(this.vertices,{silent:true});this.vertices=[];if(this.radiusHandle){this.layer.destroyFeatures([this.radiusHandle],{silent:true});this.radiusHandle=null;}}else if(vertex!==this.radiusHandle){this.layer.events.triggerEvent("vertexmodified",{vertex:vertex.geometry,feature:this.feature,pixel:pixel});}
if(this.virtualVertices.length>0){this.layer.destroyFeatures(this.virtualVertices,{silent:true});this.virtualVertices=[];}
this.layer.drawFeature(this.feature,this.standalone?undefined:this.selectControl.renderIntent);}
this.layer.drawFeature(vertex);},dragComplete:function(vertex){this.resetVertices();this.setFeatureState();this.onModification(this.feature);this.layer.events.triggerEvent("featuremodified",{feature:this.feature});},setFeatureState:function(){if(this.feature.state!=OpenLayers.State.INSERT&&this.feature.state!=OpenLayers.State.DELETE){this.feature.state=OpenLayers.State.UPDATE;if(this.modified&&this._originalGeometry){var feature=this.feature;feature.modified=OpenLayers.Util.extend(feature.modified,{geometry:this._originalGeometry});delete this._originalGeometry;}}},resetVertices:function(){if(this.dragControl.feature){this.dragControl.outFeature(this.dragControl.feature);}
if(this.vertices.length>0){this.layer.removeFeatures(this.vertices,{silent:true});this.vertices=[];}
if(this.virtualVertices.length>0){this.layer.removeFeatures(this.virtualVertices,{silent:true});this.virtualVertices=[];}
if(this.dragHandle){this.layer.destroyFeatures([this.dragHandle],{silent:true});this.dragHandle=null;}
if(this.radiusHandle){this.layer.destroyFeatures([this.radiusHandle],{silent:true});this.radiusHandle=null;}
if(this.feature&&this.feature.geometry.CLASS_NAME!="OpenLayers.Geometry.Point"){if((this.mode&OpenLayers.Control.ModifyFeature.DRAG)){this.collectDragHandle();}
if((this.mode&(OpenLayers.Control.ModifyFeature.ROTATE|OpenLayers.Control.ModifyFeature.RESIZE))){this.collectRadiusHandle();}
if(this.mode&OpenLayers.Control.ModifyFeature.RESHAPE){if(!(this.mode&OpenLayers.Control.ModifyFeature.RESIZE)){this.collectVertices();}}}},handleKeypress:function(evt){var code=evt.keyCode;if(this.feature&&OpenLayers.Util.indexOf(this.deleteCodes,code)!=-1){var vertex=this.dragControl.feature;if(vertex&&OpenLayers.Util.indexOf(this.vertices,vertex)!=-1&&!this.dragControl.handlers.drag.dragging&&vertex.geometry.parent){vertex.geometry.parent.removeComponent(vertex.geometry);this.layer.events.triggerEvent("vertexremoved",{vertex:vertex.geometry,feature:this.feature,pixel:evt.xy});this.layer.drawFeature(this.feature,this.standalone?undefined:this.selectControl.renderIntent);this.modified=true;this.resetVertices();this.setFeatureState();this.onModification(this.feature);this.layer.events.triggerEvent("featuremodified",{feature:this.feature});}}},collectVertices:function(){this.vertices=[];this.virtualVertices=[];var control=this;function collectComponentVertices(geometry){var i,vertex,component,len;if(geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){vertex=new OpenLayers.Feature.Vector(geometry);vertex._sketch=true;vertex.renderIntent=control.vertexRenderIntent;control.vertices.push(vertex);}else{var numVert=geometry.components.length;if(geometry.CLASS_NAME=="OpenLayers.Geometry.LinearRing"){numVert-=1;}
for(i=0;i<numVert;++i){component=geometry.components[i];if(component.CLASS_NAME=="OpenLayers.Geometry.Point"){vertex=new OpenLayers.Feature.Vector(component);vertex._sketch=true;vertex.renderIntent=control.vertexRenderIntent;control.vertices.push(vertex);}else{collectComponentVertices(component);}}
if(geometry.CLASS_NAME!="OpenLayers.Geometry.MultiPoint"){for(i=0,len=geometry.components.length;i<len-1;++i){var prevVertex=geometry.components[i];var nextVertex=geometry.components[i+1];if(prevVertex.CLASS_NAME=="OpenLayers.Geometry.Point"&&nextVertex.CLASS_NAME=="OpenLayers.Geometry.Point"){var x=(prevVertex.x+nextVertex.x)/2;var y=(prevVertex.y+nextVertex.y)/2;var point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(x,y),null,control.virtualStyle);point.geometry.parent=geometry;point._index=i+1;point._sketch=true;control.virtualVertices.push(point);}}}}}
collectComponentVertices.call(this,this.feature.geometry);this.layer.addFeatures(this.virtualVertices,{silent:true});this.layer.addFeatures(this.vertices,{silent:true});},collectDragHandle:function(){var geometry=this.feature.geometry;var center=geometry.getBounds().getCenterLonLat();var originGeometry=new OpenLayers.Geometry.Point(center.lon,center.lat);var origin=new OpenLayers.Feature.Vector(originGeometry);originGeometry.move=function(x,y){OpenLayers.Geometry.Point.prototype.move.call(this,x,y);geometry.move(x,y);};origin._sketch=true;this.dragHandle=origin;this.dragHandle.renderIntent=this.vertexRenderIntent;this.layer.addFeatures([this.dragHandle],{silent:true});},collectRadiusHandle:function(){var geometry=this.feature.geometry;var bounds=geometry.getBounds();var center=bounds.getCenterLonLat();var originGeometry=new OpenLayers.Geometry.Point(center.lon,center.lat);var radiusGeometry=new OpenLayers.Geometry.Point(bounds.right,bounds.bottom);var radius=new OpenLayers.Feature.Vector(radiusGeometry);var resize=(this.mode&OpenLayers.Control.ModifyFeature.RESIZE);var reshape=(this.mode&OpenLayers.Control.ModifyFeature.RESHAPE);var rotate=(this.mode&OpenLayers.Control.ModifyFeature.ROTATE);radiusGeometry.move=function(x,y){OpenLayers.Geometry.Point.prototype.move.call(this,x,y);var dx1=this.x-originGeometry.x;var dy1=this.y-originGeometry.y;var dx0=dx1-x;var dy0=dy1-y;if(rotate){var a0=Math.atan2(dy0,dx0);var a1=Math.atan2(dy1,dx1);var angle=a1-a0;angle*=180/Math.PI;geometry.rotate(angle,originGeometry);}
if(resize){var scale,ratio;if(reshape){scale=dy1/dy0;ratio=(dx1/dx0)/scale;}else{var l0=Math.sqrt((dx0*dx0)+(dy0*dy0));var l1=Math.sqrt((dx1*dx1)+(dy1*dy1));scale=l1/l0;}
geometry.resize(scale,originGeometry,ratio);}};radius._sketch=true;this.radiusHandle=radius;this.radiusHandle.renderIntent=this.vertexRenderIntent;this.layer.addFeatures([this.radiusHandle],{silent:true});},setMap:function(map){this.standalone||this.selectControl.setMap(map);this.dragControl.setMap(map);OpenLayers.Control.prototype.setMap.apply(this,arguments);},CLASS_NAME:"OpenLayers.Control.ModifyFeature"});OpenLayers.Control.ModifyFeature.RESHAPE=1;OpenLayers.Control.ModifyFeature.RESIZE=2;OpenLayers.Control.ModifyFeature.ROTATE=4;OpenLayers.Control.ModifyFeature.DRAG=8;Ext.namespace("GeoExt.tree");GeoExt.tree.TreeNodeUIEventMixin=function(){return{constructor:function(node){node.addEvents("rendernode","rawclicknode");this.superclass=arguments.callee.superclass;this.superclass.constructor.apply(this,arguments);},render:function(bulkRender){if(!this.rendered){this.superclass.render.apply(this,arguments);this.fireEvent("rendernode",this.node);}},onClick:function(e){if(this.fireEvent("rawclicknode",this.node,e)!==false){this.superclass.onClick.apply(this,arguments);}}}};OpenLayers.Control.ZoomToMaxExtent=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){if(this.map){this.map.zoomToMaxExtent();}},CLASS_NAME:"OpenLayers.Control.ZoomToMaxExtent"});Ext.namespace("GeoExt.ux.form");GeoExt.ux.form.FeaturePanel=Ext.extend(Ext.form.FormPanel,{labelWidth:100,border:false,bodyStyle:'padding:5px 5px 5px 5px',width:'auto',autoWidth:true,height:'auto',autoHeight:true,defaults:{width:120},defaultType:'textfield',features:null,layer:null,controler:null,autoSave:true,deleteAction:null,attributeFieldSetId:"gx_featurepanel_attributefieldset_id",labelAttribute:"name",useIcons:true,styler:null,initComponent:function(){this.initFeatures(this.features);this.initToolbar();this.initMyItems();GeoExt.ux.form.FeaturePanel.superclass.initComponent.call(this);},initFeatures:function(features){if(features instanceof Array){this.features=features;}else{this.features=[features];}},initToolbar:function(){this.initDeleteAction();Ext.apply(this,{bbar:new Ext.Toolbar(this.getActions())});},initMyItems:function(){var oItems,oGroup,feature,field,oGroupItems;if(this.features.length!=1){return;}else{feature=this.features[0];}
oItems=[];oGroupItems=[];oGroup={id:this.attributeFieldSetId,xtype:'fieldset',title:OpenLayers.i18n('Attributes'),layout:'form',collapsible:true,autoHeight:this.autoHeight,autoWidth:this.autoWidth,defaults:this.defaults,defaultType:this.defaultType};for(var attribute in feature.attributes){field={'name':attribute,'fieldLabel':attribute,'id':attribute,'value':feature.attributes[attribute]};oGroupItems.push(field);}
oGroup.items=oGroupItems;oItems.push(oGroup);switch(this.styler)
{case"combobox":if(!GeoExt.ux.LayerStyleManager){break;}
var styleStore=new Ext.data.SimpleStore(GeoExt.ux.data.getFeatureEditingDefaultStyleStoreOptions());styleStore.sort('name');var styler=new GeoExt.ux.LayerStyleManager(new GeoExt.ux.StyleSelectorComboBox({store:styleStore,comboBoxOptions:{emptyText:OpenLayers.i18n("select a color..."),fieldLabel:OpenLayers.i18n('color')}}),{});oGroup={xtype:'fieldset',title:OpenLayers.i18n('Style'),layout:'form',collapsible:true,autoHeight:this.autoHeight,autoWidth:this.autoWidth,defaults:this.defaults,defaultType:this.defaultType,items:[styler.createLayout().comboBox]};oItems.push(oGroup);styler.setCurrentFeature(this.features[0]);break;}
Ext.apply(this,{items:oItems});},initDeleteAction:function(){var actionOptions={handler:this.deleteFeatures,scope:this,tooltip:OpenLayers.i18n('Delete feature')};if(this.useIcons===true){actionOptions.iconCls="gx-featureediting-delete";}else{actionOptions.text=OpenLayers.i18n('Delete');}
this.deleteAction=new Ext.Action(actionOptions);},deleteFeatures:function(){Ext.MessageBox.confirm(OpenLayers.i18n('Delete Feature'),OpenLayers.i18n('Do you really want to delete this feature ?'),function(btn){if(btn=='yes'){for(var i=0;i<this.features.length;i++){var feature=this.features[i];if(feature.popup){feature.popup.close();feature.popup=null;}
feature.layer.destroyFeatures([feature]);}
this.controler.reactivateDrawControl();}},this);},getActions:function(){return[this.deleteAction];},triggerAutoSave:function(){if(this.autoSave){this.save();}},save:function(){var feature;if(this.features&&this.features.length===0){return;}
if(this.features.length!=1){return;}else{feature=this.features[0];}
this.parseFormFieldsToFeatureAttributes(feature);if(feature.isLabel===true){if(feature.attributes[this.labelAttribute]!=""){feature.style.label=feature.attributes[this.labelAttribute];feature.style.graphic=false;feature.style.labelSelect=true;feature.layer.drawFeature(feature);}else{feature.layer.destroyFeatures([feature]);if(this.controler.popup){this.controler.popup.close();this.controler.popup=null;}}}},parseFeatureAttributesToFormFields:function(feature){var aoElements,nElements,fieldSet;fieldSet=this.findById(this.attributeFieldSetId);aoElements=fieldSet.items.items;nElements=aoElements.length;for(var i=0;i<nElements;i++){var oElement=aoElements[i];var szAttribute=oElement.getName();var szValue=null;if(oElement.initialConfig.isfid)
{szValue=feature.fid;}
else
{szValue=feature.attributes[szAttribute];}
oElement.setValue(szValue);}},parseFormFieldsToFeatureAttributes:function(feature){var field,id,value,fieldSet;fieldSet=this.findById(this.attributeFieldSetId);for(var i=0;i<fieldSet.items.length;i++){field=fieldSet.items.get(i);id=field.getName();value=field.getValue();feature.attributes[id]=value;}
feature.layer.events.triggerEvent("featuremodified",{feature:feature});},onAfterRender:function(){var feature;if(this.features.length!=1){return;}else{feature=this.features[0];}
this.parseFeatureAttributesToFormFields(feature);},beforeDestroy:function(){delete this.feature;}});Ext.reg("gx_featurepanel",GeoExt.ux.form.FeaturePanel);OpenLayers.Control.Panel=OpenLayers.Class(OpenLayers.Control,{controls:null,autoActivate:true,defaultControl:null,saveState:false,allowDepress:false,activeState:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.controls=[];this.activeState={};},destroy:function(){if(this.map){this.map.events.unregister("buttonclick",this,this.onButtonClick);}
OpenLayers.Control.prototype.destroy.apply(this,arguments);for(var ctl,i=this.controls.length-1;i>=0;i--){ctl=this.controls[i];if(ctl.events){ctl.events.un({activate:this.iconOn,deactivate:this.iconOff});}
ctl.panel_div=null;}
this.activeState=null;},activate:function(){if(OpenLayers.Control.prototype.activate.apply(this,arguments)){var control;for(var i=0,len=this.controls.length;i<len;i++){control=this.controls[i];if(control===this.defaultControl||(this.saveState&&this.activeState[control.id])){control.activate();}}
if(this.saveState===true){this.defaultControl=null;}
this.redraw();return true;}else{return false;}},deactivate:function(){if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)){var control;for(var i=0,len=this.controls.length;i<len;i++){control=this.controls[i];this.activeState[control.id]=control.deactivate();}
this.redraw();return true;}else{return false;}},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(this.outsideViewport){this.events.attachToElement(this.div);this.events.register("buttonclick",this,this.onButtonClick);}else{this.map.events.register("buttonclick",this,this.onButtonClick);}
this.addControlsToMap(this.controls);return this.div;},redraw:function(){for(var l=this.div.childNodes.length,i=l-1;i>=0;i--){this.div.removeChild(this.div.childNodes[i]);}
this.div.innerHTML="";if(this.active){for(var i=0,len=this.controls.length;i<len;i++){this.div.appendChild(this.controls[i].panel_div);}}},activateControl:function(control){if(!this.active){return false;}
if(control.type==OpenLayers.Control.TYPE_BUTTON){control.trigger();return;}
if(control.type==OpenLayers.Control.TYPE_TOGGLE){if(control.active){control.deactivate();}else{control.activate();}
return;}
if(this.allowDepress&&control.active){control.deactivate();}else{var c;for(var i=0,len=this.controls.length;i<len;i++){c=this.controls[i];if(c!=control&&(c.type===OpenLayers.Control.TYPE_TOOL||c.type==null)){c.deactivate();}}
control.activate();}},addControls:function(controls){if(!(OpenLayers.Util.isArray(controls))){controls=[controls];}
this.controls=this.controls.concat(controls);for(var i=0,len=controls.length;i<len;i++){var element=document.createElement("div");element.className=controls[i].displayClass+"ItemInactive olButton";controls[i].panel_div=element;if(controls[i].title!=""){controls[i].panel_div.title=controls[i].title;}}
if(this.map){this.addControlsToMap(controls);this.redraw();}},addControlsToMap:function(controls){var control;for(var i=0,len=controls.length;i<len;i++){control=controls[i];if(control.autoActivate===true){control.autoActivate=false;this.map.addControl(control);control.autoActivate=true;}else{this.map.addControl(control);control.deactivate();}
control.events.on({activate:this.iconOn,deactivate:this.iconOff});}},iconOn:function(){var d=this.panel_div;var re=new RegExp(this.displayClass+'ItemInactive');d.className=d.className.replace(re,this.displayClass+"ItemActive");},iconOff:function(){var d=this.panel_div;var re=new RegExp(this.displayClass+'ItemActive');d.className=d.className.replace(re,this.displayClass+"ItemInactive");},onButtonClick:function(evt){var controls=this.controls,button=evt.buttonElement;for(var i=controls.length-1;i>=0;--i){if(controls[i].panel_div===button){this.activateControl(controls[i]);break;}}},getControlsBy:function(property,match){var test=(typeof match.test=="function");var found=OpenLayers.Array.filter(this.controls,function(item){return item[property]==match||(test&&match.test(item[property]));});return found;},getControlsByName:function(match){return this.getControlsBy("name",match);},getControlsByClass:function(match){return this.getControlsBy("CLASS_NAME",match);},CLASS_NAME:"OpenLayers.Control.Panel"});OpenLayers.Control.Permalink=OpenLayers.Class(OpenLayers.Control,{argParserClass:OpenLayers.Control.ArgParser,element:null,anchor:false,base:'',displayProjection:null,initialize:function(element,base,options){if(element!==null&&typeof element=='object'&&!OpenLayers.Util.isElement(element)){options=element;this.base=document.location.href;OpenLayers.Control.prototype.initialize.apply(this,[options]);if(this.element!=null){this.element=OpenLayers.Util.getElement(this.element);}}
else{OpenLayers.Control.prototype.initialize.apply(this,[options]);this.element=OpenLayers.Util.getElement(element);this.base=base||document.location.href;}},destroy:function(){if(this.element.parentNode==this.div){this.div.removeChild(this.element);}
this.element=null;this.map.events.unregister('moveend',this,this.updateLink);OpenLayers.Control.prototype.destroy.apply(this,arguments);},setMap:function(map){OpenLayers.Control.prototype.setMap.apply(this,arguments);for(var i=0,len=this.map.controls.length;i<len;i++){var control=this.map.controls[i];if(control.CLASS_NAME==this.argParserClass.CLASS_NAME){if(control.displayProjection!=this.displayProjection){this.displayProjection=control.displayProjection;}
break;}}
if(i==this.map.controls.length){this.map.addControl(new this.argParserClass({'displayProjection':this.displayProjection}));}},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element&&!this.anchor){this.element=document.createElement("a");this.element.innerHTML=OpenLayers.i18n("Permalink");this.element.href="";this.div.appendChild(this.element);}
this.map.events.on({'moveend':this.updateLink,'changelayer':this.updateLink,'changebaselayer':this.updateLink,scope:this});this.updateLink();return this.div;},updateLink:function(){var separator=this.anchor?'#':'?';var href=this.base;if(href.indexOf(separator)!=-1){href=href.substring(0,href.indexOf(separator));}
href+=separator+OpenLayers.Util.getParameterString(this.createParams());if(this.anchor&&!this.element){window.location.href=href;}
else{this.element.href=href;}},createParams:function(center,zoom,layers){center=center||this.map.getCenter();var params=OpenLayers.Util.getParameters(this.base);if(center){params.zoom=zoom||this.map.getZoom();var lat=center.lat;var lon=center.lon;if(this.displayProjection){var mapPosition=OpenLayers.Projection.transform({x:lon,y:lat},this.map.getProjectionObject(),this.displayProjection);lon=mapPosition.x;lat=mapPosition.y;}
params.lat=Math.round(lat*100000)/100000;params.lon=Math.round(lon*100000)/100000;layers=layers||this.map.layers;params.layers='';for(var i=0,len=layers.length;i<len;i++){var layer=layers[i];if(layer.isBaseLayer){params.layers+=(layer==this.map.baseLayer)?"B":"0";}else{params.layers+=(layer.getVisibility())?"T":"F";}}}
return params;},CLASS_NAME:"OpenLayers.Control.Permalink"});Ext.namespace("geoadmin");geoadmin.Profile=OpenLayers.Class(OpenLayers.Control.DrawFeature,{serviceUrl:null,nbPoints:200,layers:['MNS','MNT'],popupConfig:null,popup:null,curProfile:null,id:null,layer:null,style:{strokeColor:"#FF0000",strokeOpacity:0.85,strokeWidth:3,strokeLinecap:"round",strokeDashstyle:"solid",pointRadius:0,pointerEvents:"visiblePainted",cursor:"inherit"},styleMarker:{strokeColor:"#FF0000",strokeOpacity:0.85,strokeWidth:3,strokeLinecap:"round",strokeDashstyle:"solid",pointRadius:5,pointerEvents:"visiblePainted",cursor:"inherit"},initialize:function(options){this.id=geoadmin.Profile.id++;geoadmin.Profile.repository[this.id]=this;var layer=new OpenLayers.Layer.Vector("Profile",{alwaysInRange:true,displayInLayerSwitcher:false,styleMap:new OpenLayers.StyleMap(this.style)});options=OpenLayers.Util.extend(options,{createFeature:function(){this.startDrawing();OpenLayers.Control.DrawFeature.prototype.createFeature.apply(this,arguments);},handlerOptions:{layerOptions:{style:this.style}}});delete options.id;OpenLayers.Control.DrawFeature.prototype.initialize.call(this,layer,OpenLayers.Handler.Path,options);},activate:function(){if(OpenLayers.Control.DrawFeature.prototype.activate.call(this)){this.map.addLayer(this.layer);}},deactivate:function(){if(OpenLayers.Control.DrawFeature.prototype.deactivate.call(this)){this.layer.destroyFeatures();this.map.removeLayer(this.layer);this.closePopup();}},closePopup:function(){if(this.popup){this.popup.close();this.popup=null;}},startDrawing:function(){this.closePopup();this.layer.destroyFeatures();},createPopup:function(uuid){var csvUrl=this.serviceUrl+'profile.csv?uuid='+uuid;var config=Ext.apply({title:'<span style="float: right; padding-right: 10px;"><a href="'+csvUrl+'">'+
OpenLayers.i18n('geoadmin.profile.exportCSV')+'</a></span>'+
OpenLayers.i18n('geoadmin.profile'),width:450,height:300,minWidth:450,minHeight:300,html:'',resizable:true,collapsible:true,constrain:true,closeAction:'close'},this.popupConfig);this.popup=new Ext.Window(config);Ext.Ajax.request({url:this.serviceUrl+'profile.json?uuid='+uuid,success:function(result){this.curProfile=new OpenLayers.Format.JSON().read(result.responseText);},scope:this});this.popup.on({resize:function(win){var graph=this.createGraph(uuid,win.getInnerWidth(),win.getInnerHeight());win.body.update(graph);},close:function(){this.destroy();},scope:this});this.popup.show();this.popup.resizer.on("beforeresize",function(){this.popup.body.update("");},this);},createGraph:function(uuid,width,height){var profileXmlUrl=this.serviceUrl+'profile.xml?uuid='+uuid+'&width='+width+'&height='+height;profileXmlUrl=encodeURIComponent(profileXmlUrl);return'<object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,45,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="'+this.id+'_chart" height="'+height+'" width="'+width+'">\n'+'  <param name="scale"             value="noscale">\n'+'  <param name="salign"            value="tl">\n'+'  <param name="bgcolor"           value="#E8E8E8">\n'+'  <param name="movie"             value="'+this.serviceUrl+'charts/charts.swf">\n'+'  <param name="Flashvars"         value="library_path='+this.serviceUrl+'charts/charts_library&xml_source='+profileXmlUrl+'&chart_id='+this.id+'_chart">\n'+'  <p¨aram name="menu"              value="true">\n'+'  <param name="allowScriptAccess" value="sameDomain">\n'+'  <param name="quality"           value="high">\n'+'  <param name="play"              value="true">\n'+'  <param name="devicefont"        value="false">\n'+'  <embed scale="noscale"\n'+'      allowscriptaccess = "sameDomain"\n'+'      bgcolor           = "#E8E8E8"\n'+'      devicefont        = "false"\n'+'      flashvars         = "library_path='+this.serviceUrl+'charts/charts_library&xml_source='+profileXmlUrl+'&chart_id='+this.id+'_chart"\n'+'      menu              = "true"\n'+'      name              = "'+this.id+'_chart"\n'+'      play              = "true"\n'+'      pluginspage       = "http://www.macromedia.com/go/getflashplayer"\n'+'      quality           = "high"\n'+'      salign            = "tl"\n'+'      src               = "'+this.serviceUrl+'charts/charts.swf"\n'+'      type              = "application/x-shockwave-flash"\n'+'      align             = "l"\n'+'      height            = "'+height+'"\n'+'      width             = "'+width+'"/>\n'+'</object>';},featureAdded:function(feature){this.closePopup();var nbGeometryPoints=feature.geometry.components.length;var geometryLength=feature.geometry.getLength();if(geometryLength<=0.0){Ext.Msg.alert(OpenLayers.i18n('mf.error'),OpenLayers.i18n('geoadmin.profile.tooSmall'));return;}
var format=new OpenLayers.Format.GeoJSON();var geojson=format.write(feature.geometry);var paramsString='nbPoints='+this.nbPoints+'&layers='+this.layers.join(',')+'&lang='+OpenLayers.Lang.getCode();Ext.Ajax.request({url:this.serviceUrl+'profile?'+paramsString,method:'POST',jsonData:geojson,success:function(result){var uuid=new OpenLayers.Format.JSON().read(result.responseText)['uuid'];this.createPopup(uuid);},scope:this});},chartClick:function(index){if(!this.curProfile){return;}
var point=this.curProfile.profile[index];if(this.marker){this.marker.destroy();}
this.marker=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(point.x,point.y),{},this.styleMarker);this.layer.addFeatures([this.marker]);},destroy:function(){this.layer.destroyFeatures();this.layer.map.removeLayer(this.layer);this.layer.destroy();OpenLayers.Control.DrawFeature.prototype.destroy.call(this);},CLASS_NAME:"geoadmin.Profile"});geoadmin.Profile.id=0;geoadmin.Profile.repository={};geoadmin.Profile.chartClick=function(col,row,value,category,series,chartId){var index=(col-1)/2;geoadmin.Profile.repository[chartId.replace('_chart','')].chartClick(index);};Ext.namespace("GeoExt");GeoExt.LayerOpacitySlider=Ext.extend(Ext.slider.SingleSlider,{layer:null,complementaryLayer:null,delay:5,changeVisibilityDelay:5,aggressive:false,changeVisibility:false,value:null,inverse:false,constructor:function(config){if(config.layer){this.layer=this.getLayer(config.layer);this.bind();this.complementaryLayer=this.getLayer(config.complementaryLayer);if(config.inverse!==undefined){this.inverse=config.inverse;}
config.value=(config.value!==undefined)?config.value:this.getOpacityValue(this.layer);delete config.layer;delete config.complementaryLayer;}
GeoExt.LayerOpacitySlider.superclass.constructor.call(this,config);},bind:function(){if(this.layer&&this.layer.map){this.layer.map.events.on({changelayer:this.update,scope:this});}},unbind:function(){if(this.layer&&this.layer.map&&this.layer.map.events){this.layer.map.events.un({changelayer:this.update,scope:this});}},update:function(evt){if(evt.property==="opacity"&&evt.layer==this.layer&&!this._settingOpacity){this.setValue(this.getOpacityValue(this.layer));}},setLayer:function(layer){this.unbind();this.layer=this.getLayer(layer);this.setValue(this.getOpacityValue(layer));this.bind();},getOpacityValue:function(layer){var value;if(layer&&layer.opacity!==null){value=parseInt(layer.opacity*(this.maxValue-this.minValue));}else{value=this.maxValue;}
if(this.inverse===true){value=(this.maxValue-this.minValue)-value;}
return value;},getLayer:function(layer){if(layer instanceof OpenLayers.Layer){return layer;}else if(layer instanceof GeoExt.data.LayerRecord){return layer.getLayer();}},initComponent:function(){GeoExt.LayerOpacitySlider.superclass.initComponent.call(this);if(this.changeVisibility&&this.layer&&(this.layer.opacity==0||(this.inverse===false&&this.value==this.minValue)||(this.inverse===true&&this.value==this.maxValue))){this.layer.setVisibility(false);}
if(this.complementaryLayer&&((this.layer&&this.layer.opacity==1)||(this.inverse===false&&this.value==this.maxValue)||(this.inverse===true&&this.value==this.minValue))){this.complementaryLayer.setVisibility(false);}
if(this.aggressive===true){this.on('change',this.changeLayerOpacity,this,{buffer:this.delay});}else{this.on('changecomplete',this.changeLayerOpacity,this);}
if(this.changeVisibility===true){this.on('change',this.changeLayerVisibility,this,{buffer:this.changeVisibilityDelay});}
if(this.complementaryLayer){this.on('change',this.changeComplementaryLayerVisibility,this,{buffer:this.changeVisibilityDelay});}
this.on("beforedestroy",this.unbind,this);},changeLayerOpacity:function(slider,value){if(this.layer){value=value/(this.maxValue-this.minValue);if(this.inverse===true){value=1-value;}
this._settingOpacity=true;this.layer.setOpacity(value);delete this._settingOpacity;}},changeLayerVisibility:function(slider,value){var currentVisibility=this.layer.getVisibility();if((this.inverse===false&&value==this.minValue)||(this.inverse===true&&value==this.maxValue)&&currentVisibility===true){this.layer.setVisibility(false);}else if((this.inverse===false&&value>this.minValue)||(this.inverse===true&&value<this.maxValue)&&currentVisibility==false){this.layer.setVisibility(true);}},changeComplementaryLayerVisibility:function(slider,value){var currentVisibility=this.complementaryLayer.getVisibility();if((this.inverse===false&&value==this.maxValue)||(this.inverse===true&&value==this.minValue)&&currentVisibility===true){this.complementaryLayer.setVisibility(false);}else if((this.inverse===false&&value<this.maxValue)||(this.inverse===true&&value>this.minValue)&&currentVisibility==false){this.complementaryLayer.setVisibility(true);}},addToMapPanel:function(panel){this.on({render:function(){var el=this.getEl();el.setStyle({position:"absolute",zIndex:panel.map.Z_INDEX_BASE.Control});el.on({mousedown:this.stopMouseEvents,click:this.stopMouseEvents});},scope:this});},removeFromMapPanel:function(panel){var el=this.getEl();el.un({mousedown:this.stopMouseEvents,click:this.stopMouseEvents,scope:this});this.unbind();},stopMouseEvents:function(e){e.stopEvent();}});Ext.reg('gx_opacityslider',GeoExt.LayerOpacitySlider);Ext.namespace("GeoExt.ux.data");GeoExt.ux.data.importFeatures=null;GeoExt.ux.data.Import=function(map,layer,format,filecontent,features){GeoExt.ux.data.Import.importFeatures=[];if(format&&filecontent){if(format=='KML'){var kmlReader=new OpenLayers.Format.KML(OpenLayers.Util.extend({externalProjection:new OpenLayers.Projection("EPSG:4326"),internalProjection:map.getProjectionObject()},GeoExt.ux.data.formats.getFormatConfig(format)));GeoExt.ux.data.importFeatures=kmlReader.read(filecontent);}else if(format=='GPX'){var gpxReader=new OpenLayers.Format.GPX(OpenLayers.Util.extend({externalProjection:new OpenLayers.Projection("EPSG:4326"),internalProjection:map.getProjectionObject()},GeoExt.ux.data.formats.getFormatConfig(format)));GeoExt.ux.data.importFeatures=gpxReader.read(filecontent);}else if(format=='GML'){var gmlReader=new OpenLayers.Format.GML(GeoExt.ux.data.formats.getFormatConfig(format));GeoExt.ux.data.importFeatures=gmlReader.read(filecontent);}else if(format=='GeoJSON'){var geojsonReader=new OpenLayers.Format.GeoJSON(GeoExt.ux.data.formats.getFormatConfig(format));GeoExt.ux.data.importFeatures=geojsonReader.read(filecontent);}else if(format=='GeoRSS'){var georssReader=new OpenLayers.Format.GeoRSS(GeoExt.ux.data.formats.getFormatConfig(format));GeoExt.ux.data.importFeatures=georssReader.read(filecontent);}else{return'Format '+format+' not supported. Patch welcome !';}}
if(features){GeoExt.ux.data.importFeatures=features;}
if(!layer){layer=new OpenLayers.Layer.Vector("Import",{projection:map.displayProjection});map.addLayer(layer);}
layer.addFeatures(GeoExt.ux.data.importFeatures);return layer;};GeoExt.ux.data.Import.KMLImport=function(map,layer){GeoExt.ux.data.Export.format='KML';var importPanel=new GeoExt.ux.LayerManagerImportPanel({map:map,defaultFormat:'KML',layer:layer});importPanel.on('dataimported',function(panel,format,filecontent,features){alert(OpenLayers.i18n("KML data sucessfully imported in layer: "+panel.layer.name+" !"+" Number of imported features: "+features.length));importWindow.close();});var importWindow=new Ext.Window({id:'importwindow',modal:true,title:OpenLayers.i18n('Import KML'),height:135,width:290,items:[importPanel]});importWindow.show();};OpenLayers.Date={toISOString:(function(){if("toISOString"in Date.prototype){return function(date){return date.toISOString();};}else{function pad(num,len){var str=num+"";while(str.length<len){str="0"+str;}
return str;}
return function(date){var str;if(isNaN(date.getTime())){str="Invalid Date";}else{str=date.getUTCFullYear()+"-"+
pad(date.getUTCMonth()+1,2)+"-"+
pad(date.getUTCDate(),2)+"T"+
pad(date.getUTCHours(),2)+":"+
pad(date.getUTCMinutes(),2)+":"+
pad(date.getUTCSeconds(),2)+"."+
pad(date.getUTCMilliseconds(),3)+"Z";}
return str;};}})(),parse:function(str){var date;var match=str.match(/^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))|Z)?$/);if(match&&(match[1]||match[7])){var year=parseInt(match[1],10)||0;var month=(parseInt(match[2],10)-1)||0;var day=parseInt(match[3],10)||1;date=new Date(Date.UTC(year,month,day));var type=match[7];if(type){var hours=parseInt(match[4],10);var minutes=parseInt(match[5],10);var secFrac=parseFloat(match[6]);var seconds=secFrac|0;var milliseconds=Math.round(1000*(secFrac-seconds));date.setUTCHours(hours,minutes,seconds,milliseconds);if(type!=="Z"){var hoursOffset=parseInt(type,10);var minutesOffset=parseInt(match[8],10)||0;var offset=-1000*(60*(hoursOffset*60)+minutesOffset*60);date=new Date(date.getTime()+offset);}}}else{date=new Date("invalid");}
return date;}};OpenLayers.Format.KML=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{kml:"http://www.opengis.net/kml/2.2",gx:"http://www.google.com/kml/ext/2.2"},kmlns:"http://earth.google.com/kml/2.0",placemarksDesc:"No description available",foldersName:"OpenLayers export",foldersDesc:"Exported on "+new Date(),extractAttributes:true,extractStyles:false,extractTracks:false,trackAttributes:null,internalns:null,features:null,styles:null,styleBaseUrl:"",fetched:null,maxDepth:0,initialize:function(options){this.regExes={trimSpace:(/^\s*|\s*$/g),removeSpace:(/\s*/g),splitSpace:(/\s+/),trimComma:(/\s*,\s*/g),kmlColor:(/(\w{2})(\w{2})(\w{2})(\w{2})/),kmlIconPalette:(/root:\/\/icons\/palette-(\d+)(\.\w+)/),straightBracket:(/\$\[(.*?)\]/g)};this.externalProjection=new OpenLayers.Projection("EPSG:4326");OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);},read:function(data){this.features=[];this.styles={};this.fetched={};var options={depth:0,styleBaseUrl:this.styleBaseUrl};return this.parseData(data,options);},parseData:function(data,options){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}
var types=["Link","NetworkLink","Style","StyleMap","Placemark"];for(var i=0,len=types.length;i<len;++i){var type=types[i];var nodes=this.getElementsByTagNameNS(data,"*",type);if(nodes.length==0){continue;}
switch(type.toLowerCase()){case"link":case"networklink":this.parseLinks(nodes,options);break;case"style":if(this.extractStyles){this.parseStyles(nodes,options);}
break;case"stylemap":if(this.extractStyles){this.parseStyleMaps(nodes,options);}
break;case"placemark":this.parseFeatures(nodes,options);break;}}
return this.features;},parseLinks:function(nodes,options){if(options.depth>=this.maxDepth){return false;}
var newOptions=OpenLayers.Util.extend({},options);newOptions.depth++;for(var i=0,len=nodes.length;i<len;i++){var href=this.parseProperty(nodes[i],"*","href");if(href&&!this.fetched[href]){this.fetched[href]=true;var data=this.fetchLink(href);if(data){this.parseData(data,newOptions);}}}},fetchLink:function(href){var request=OpenLayers.Request.GET({url:href,async:false});if(request){return request.responseText;}},parseStyles:function(nodes,options){for(var i=0,len=nodes.length;i<len;i++){var style=this.parseStyle(nodes[i]);if(style){var styleName=(options.styleBaseUrl||"")+"#"+style.id;this.styles[styleName]=style;}}},parseKmlColor:function(kmlColor){var color=null;if(kmlColor){var matches=kmlColor.match(this.regExes.kmlColor);if(matches){color={color:'#'+matches[4]+matches[3]+matches[2],opacity:parseInt(matches[1],16)/255};}}
return color;},parseStyle:function(node){var style={};var types=["LineStyle","PolyStyle","IconStyle","BalloonStyle","LabelStyle"];var type,styleTypeNode,nodeList,geometry,parser;for(var i=0,len=types.length;i<len;++i){type=types[i];styleTypeNode=this.getElementsByTagNameNS(node,"*",type)[0];if(!styleTypeNode){continue;}
switch(type.toLowerCase()){case"linestyle":var kmlColor=this.parseProperty(styleTypeNode,"*","color");var color=this.parseKmlColor(kmlColor);if(color){style["strokeColor"]=color.color;style["strokeOpacity"]=color.opacity;}
var width=this.parseProperty(styleTypeNode,"*","width");if(width){style["strokeWidth"]=width;}
break;case"polystyle":var kmlColor=this.parseProperty(styleTypeNode,"*","color");var color=this.parseKmlColor(kmlColor);if(color){style["fillOpacity"]=color.opacity;style["fillColor"]=color.color;}
var fill=this.parseProperty(styleTypeNode,"*","fill");if(fill=="0"){style["fillColor"]="none";}
var outline=this.parseProperty(styleTypeNode,"*","outline");if(outline=="0"){style["strokeWidth"]="0";}
break;case"iconstyle":var scale=parseFloat(this.parseProperty(styleTypeNode,"*","scale")||1);var width=32*scale;var height=32*scale;var iconNode=this.getElementsByTagNameNS(styleTypeNode,"*","Icon")[0];if(iconNode){var href=this.parseProperty(iconNode,"*","href");if(href){var w=this.parseProperty(iconNode,"*","w");var h=this.parseProperty(iconNode,"*","h");var google="http://maps.google.com/mapfiles/kml";if(OpenLayers.String.startsWith(href,google)&&!w&&!h){w=64;h=64;scale=scale/2;}
w=w||h;h=h||w;if(w){width=parseInt(w)*scale;}
if(h){height=parseInt(h)*scale;}
var matches=href.match(this.regExes.kmlIconPalette);if(matches){var palette=matches[1];var file_extension=matches[2];var x=this.parseProperty(iconNode,"*","x");var y=this.parseProperty(iconNode,"*","y");var posX=x?x/32:0;var posY=y?(7-y/32):7;var pos=posY*8+posX;href="http://maps.google.com/mapfiles/kml/pal"
+palette+"/icon"+pos+file_extension;}
style["graphicOpacity"]=1;style["externalGraphic"]=href;}}
var hotSpotNode=this.getElementsByTagNameNS(styleTypeNode,"*","hotSpot")[0];if(hotSpotNode){var x=parseFloat(hotSpotNode.getAttribute("x"));var y=parseFloat(hotSpotNode.getAttribute("y"));var xUnits=hotSpotNode.getAttribute("xunits");if(xUnits=="pixels"){style["graphicXOffset"]=-x*scale;}
else if(xUnits=="insetPixels"){style["graphicXOffset"]=-width+(x*scale);}
else if(xUnits=="fraction"){style["graphicXOffset"]=-width*x;}
var yUnits=hotSpotNode.getAttribute("yunits");if(yUnits=="pixels"){style["graphicYOffset"]=-height+(y*scale)+1;}
else if(yUnits=="insetPixels"){style["graphicYOffset"]=-(y*scale)+1;}
else if(yUnits=="fraction"){style["graphicYOffset"]=-height*(1-y)+1;}}
style["graphicWidth"]=width;style["graphicHeight"]=height;break;case"balloonstyle":var balloonStyle=OpenLayers.Util.getXmlNodeValue(styleTypeNode);if(balloonStyle){style["balloonStyle"]=balloonStyle.replace(this.regExes.straightBracket,"${$1}");}
break;case"labelstyle":var kmlColor=this.parseProperty(styleTypeNode,"*","color");var color=this.parseKmlColor(kmlColor);if(color){style["fontColor"]=color.color;style["fontOpacity"]=color.opacity;}
break;default:}}
if(!style["strokeColor"]&&style["fillColor"]){style["strokeColor"]=style["fillColor"];}
var id=node.getAttribute("id");if(id&&style){style.id=id;}
return style;},parseStyleMaps:function(nodes,options){for(var i=0,len=nodes.length;i<len;i++){var node=nodes[i];var pairs=this.getElementsByTagNameNS(node,"*","Pair");var id=node.getAttribute("id");for(var j=0,jlen=pairs.length;j<jlen;j++){var pair=pairs[j];var key=this.parseProperty(pair,"*","key");var styleUrl=this.parseProperty(pair,"*","styleUrl");if(styleUrl&&key=="normal"){this.styles[(options.styleBaseUrl||"")+"#"+id]=this.styles[(options.styleBaseUrl||"")+styleUrl];}}}},parseFeatures:function(nodes,options){var features=[];for(var i=0,len=nodes.length;i<len;i++){var featureNode=nodes[i];var feature=this.parseFeature.apply(this,[featureNode]);if(feature){if(this.extractStyles&&feature.attributes&&feature.attributes.styleUrl){feature.style=this.getStyle(feature.attributes.styleUrl,options);}
if(this.extractStyles){var inlineStyleNode=this.getElementsByTagNameNS(featureNode,"*","Style")[0];if(inlineStyleNode){var inlineStyle=this.parseStyle(inlineStyleNode);if(inlineStyle){feature.style=OpenLayers.Util.extend(feature.style,inlineStyle);}}}
if(this.extractTracks){var tracks=this.getElementsByTagNameNS(featureNode,this.namespaces.gx,"Track");if(tracks&&tracks.length>0){var track=tracks[0];var container={features:[],feature:feature};this.readNode(track,container);if(container.features.length>0){features.push.apply(features,container.features);}}}else{features.push(feature);}}else{throw"Bad Placemark: "+i;}}
this.features=this.features.concat(features);},readers:{"kml":{"when":function(node,container){container.whens.push(OpenLayers.Date.parse(this.getChildValue(node)));},"_trackPointAttribute":function(node,container){var name=node.nodeName.split(":").pop();container.attributes[name].push(this.getChildValue(node));}},"gx":{"Track":function(node,container){var obj={whens:[],points:[],angles:[]};if(this.trackAttributes){var name;obj.attributes={};for(var i=0,ii=this.trackAttributes.length;i<ii;++i){name=this.trackAttributes[i];obj.attributes[name]=[];if(!(name in this.readers.kml)){this.readers.kml[name]=this.readers.kml._trackPointAttribute;}}}
this.readChildNodes(node,obj);if(obj.whens.length!==obj.points.length){throw new Error("gx:Track with unequal number of when ("+
obj.whens.length+") and gx:coord ("+
obj.points.length+") elements.");}
var hasAngles=obj.angles.length>0;if(hasAngles&&obj.whens.length!==obj.angles.length){throw new Error("gx:Track with unequal number of when ("+
obj.whens.length+") and gx:angles ("+
obj.angles.length+") elements.");}
var feature,point,angles;for(var i=0,ii=obj.whens.length;i<ii;++i){feature=container.feature.clone();feature.fid=container.feature.fid||container.feature.id;point=obj.points[i];feature.geometry=point;if("z"in point){feature.attributes.altitude=point.z;}
if(this.internalProjection&&this.externalProjection){feature.geometry.transform(this.externalProjection,this.internalProjection);}
if(this.trackAttributes){for(var j=0,jj=this.trackAttributes.length;j<jj;++j){feature.attributes[name]=obj.attributes[this.trackAttributes[j]][i];}}
feature.attributes.when=obj.whens[i];feature.attributes.trackId=container.feature.id;if(hasAngles){angles=obj.angles[i];feature.attributes.heading=parseFloat(angles[0]);feature.attributes.tilt=parseFloat(angles[1]);feature.attributes.roll=parseFloat(angles[2]);}
container.features.push(feature);}},"coord":function(node,container){var str=this.getChildValue(node);var coords=str.replace(this.regExes.trimSpace,"").split(/\s+/);var point=new OpenLayers.Geometry.Point(coords[0],coords[1]);if(coords.length>2){point.z=parseFloat(coords[2]);}
container.points.push(point);},"angles":function(node,container){var str=this.getChildValue(node);var parts=str.replace(this.regExes.trimSpace,"").split(/\s+/);container.angles.push(parts);}}},parseFeature:function(node){var order=["MultiGeometry","Polygon","LineString","Point"];var type,nodeList,geometry,parser;for(var i=0,len=order.length;i<len;++i){type=order[i];this.internalns=node.namespaceURI?node.namespaceURI:this.kmlns;nodeList=this.getElementsByTagNameNS(node,this.internalns,type);if(nodeList.length>0){var parser=this.parseGeometry[type.toLowerCase()];if(parser){geometry=parser.apply(this,[nodeList[0]]);if(this.internalProjection&&this.externalProjection){geometry.transform(this.externalProjection,this.internalProjection);}}else{throw new TypeError("Unsupported geometry type: "+type);}
break;}}
var attributes;if(this.extractAttributes){attributes=this.parseAttributes(node);}
var feature=new OpenLayers.Feature.Vector(geometry,attributes);var fid=node.getAttribute("id")||node.getAttribute("name");if(fid!=null){feature.fid=fid;}
return feature;},getStyle:function(styleUrl,options){var styleBaseUrl=OpenLayers.Util.removeTail(styleUrl);var newOptions=OpenLayers.Util.extend({},options);newOptions.depth++;newOptions.styleBaseUrl=styleBaseUrl;if(!this.styles[styleUrl]&&!OpenLayers.String.startsWith(styleUrl,"#")&&newOptions.depth<=this.maxDepth&&!this.fetched[styleBaseUrl]){var data=this.fetchLink(styleBaseUrl);if(data){this.parseData(data,newOptions);}}
var style=OpenLayers.Util.extend({},this.styles[styleUrl]);return style;},parseGeometry:{point:function(node){var nodeList=this.getElementsByTagNameNS(node,this.internalns,"coordinates");var coords=[];if(nodeList.length>0){var coordString=nodeList[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.removeSpace,"");coords=coordString.split(",");}
var point=null;if(coords.length>1){if(coords.length==2){coords[2]=null;}
point=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);}else{throw"Bad coordinate string: "+coordString;}
return point;},linestring:function(node,ring){var nodeList=this.getElementsByTagNameNS(node,this.internalns,"coordinates");var line=null;if(nodeList.length>0){var coordString=this.getChildValue(nodeList[0]);coordString=coordString.replace(this.regExes.trimSpace,"");coordString=coordString.replace(this.regExes.trimComma,",");var pointList=coordString.split(this.regExes.splitSpace);var numPoints=pointList.length;var points=new Array(numPoints);var coords,numCoords;for(var i=0;i<numPoints;++i){coords=pointList[i].split(",");numCoords=coords.length;if(numCoords>1){if(coords.length==2){coords[2]=null;}
points[i]=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);}else{throw"Bad LineString point coordinates: "+
pointList[i];}}
if(numPoints){if(ring){line=new OpenLayers.Geometry.LinearRing(points);}else{line=new OpenLayers.Geometry.LineString(points);}}else{throw"Bad LineString coordinates: "+coordString;}}
return line;},polygon:function(node){var nodeList=this.getElementsByTagNameNS(node,this.internalns,"LinearRing");var numRings=nodeList.length;var components=new Array(numRings);if(numRings>0){var ring;for(var i=0,len=nodeList.length;i<len;++i){ring=this.parseGeometry.linestring.apply(this,[nodeList[i],true]);if(ring){components[i]=ring;}else{throw"Bad LinearRing geometry: "+i;}}}
return new OpenLayers.Geometry.Polygon(components);},multigeometry:function(node){var child,parser;var parts=[];var children=node.childNodes;for(var i=0,len=children.length;i<len;++i){child=children[i];if(child.nodeType==1){var type=(child.prefix)?child.nodeName.split(":")[1]:child.nodeName;var parser=this.parseGeometry[type.toLowerCase()];if(parser){parts.push(parser.apply(this,[child]));}}}
return new OpenLayers.Geometry.Collection(parts);}},parseAttributes:function(node){var attributes={};var edNodes=node.getElementsByTagName("ExtendedData");if(edNodes.length){attributes=this.parseExtendedData(edNodes[0]);}
var child,grandchildren,grandchild;var children=node.childNodes;for(var i=0,len=children.length;i<len;++i){child=children[i];if(child.nodeType==1){grandchildren=child.childNodes;if(grandchildren.length>=1&&grandchildren.length<=3){var grandchild;switch(grandchildren.length){case 1:grandchild=grandchildren[0];break;case 2:var c1=grandchildren[0];var c2=grandchildren[1];grandchild=(c1.nodeType==3||c1.nodeType==4)?c1:c2;break;case 3:default:grandchild=grandchildren[1];break;}
if(grandchild.nodeType==3||grandchild.nodeType==4){var name=(child.prefix)?child.nodeName.split(":")[1]:child.nodeName;var value=OpenLayers.Util.getXmlNodeValue(grandchild);if(value){value=value.replace(this.regExes.trimSpace,"");attributes[name]=value;}}}}}
return attributes;},parseExtendedData:function(node){var attributes={};var i,len,data,key;var dataNodes=node.getElementsByTagName("Data");for(i=0,len=dataNodes.length;i<len;i++){data=dataNodes[i];key=data.getAttribute("name");var ed={};var valueNode=data.getElementsByTagName("value");if(valueNode.length){ed['value']=this.getChildValue(valueNode[0]);}
var nameNode=data.getElementsByTagName("displayName");if(nameNode.length){ed['displayName']=this.getChildValue(nameNode[0]);}
attributes[key]=ed;}
var simpleDataNodes=node.getElementsByTagName("SimpleData");for(i=0,len=simpleDataNodes.length;i<len;i++){var ed={};data=simpleDataNodes[i];key=data.getAttribute("name");ed['value']=this.getChildValue(data);ed['displayName']=key;attributes[key]=ed;}
return attributes;},parseProperty:function(xmlNode,namespace,tagName){var value;var nodeList=this.getElementsByTagNameNS(xmlNode,namespace,tagName);try{value=OpenLayers.Util.getXmlNodeValue(nodeList[0]);}catch(e){value=null;}
return value;},write:function(features){if(!(OpenLayers.Util.isArray(features))){features=[features];}
var kml=this.createElementNS(this.kmlns,"kml");var folder=this.createFolderXML();for(var i=0,len=features.length;i<len;++i){folder.appendChild(this.createPlacemarkXML(features[i]));}
kml.appendChild(folder);return OpenLayers.Format.XML.prototype.write.apply(this,[kml]);},createFolderXML:function(){var folder=this.createElementNS(this.kmlns,"Folder");if(this.foldersName){var folderName=this.createElementNS(this.kmlns,"name");var folderNameText=this.createTextNode(this.foldersName);folderName.appendChild(folderNameText);folder.appendChild(folderName);}
if(this.foldersDesc){var folderDesc=this.createElementNS(this.kmlns,"description");var folderDescText=this.createTextNode(this.foldersDesc);folderDesc.appendChild(folderDescText);folder.appendChild(folderDesc);}
return folder;},createPlacemarkXML:function(feature){var placemarkName=this.createElementNS(this.kmlns,"name");var name=feature.style&&feature.style.label?feature.style.label:feature.attributes.name||feature.id;placemarkName.appendChild(this.createTextNode(name));var placemarkDesc=this.createElementNS(this.kmlns,"description");var desc=feature.attributes.description||this.placemarksDesc;placemarkDesc.appendChild(this.createTextNode(desc));var placemarkNode=this.createElementNS(this.kmlns,"Placemark");if(feature.fid!=null){placemarkNode.setAttribute("id",feature.fid);}
placemarkNode.appendChild(placemarkName);placemarkNode.appendChild(placemarkDesc);var geometryNode=this.buildGeometryNode(feature.geometry);placemarkNode.appendChild(geometryNode);return placemarkNode;},buildGeometryNode:function(geometry){var className=geometry.CLASS_NAME;var type=className.substring(className.lastIndexOf(".")+1);var builder=this.buildGeometry[type.toLowerCase()];var node=null;if(builder){node=builder.apply(this,[geometry]);}
return node;},buildGeometry:{point:function(geometry){var kml=this.createElementNS(this.kmlns,"Point");kml.appendChild(this.buildCoordinatesNode(geometry));return kml;},multipoint:function(geometry){return this.buildGeometry.collection.apply(this,[geometry]);},linestring:function(geometry){var kml=this.createElementNS(this.kmlns,"LineString");kml.appendChild(this.buildCoordinatesNode(geometry));return kml;},multilinestring:function(geometry){return this.buildGeometry.collection.apply(this,[geometry]);},linearring:function(geometry){var kml=this.createElementNS(this.kmlns,"LinearRing");kml.appendChild(this.buildCoordinatesNode(geometry));return kml;},polygon:function(geometry){var kml=this.createElementNS(this.kmlns,"Polygon");var rings=geometry.components;var ringMember,ringGeom,type;for(var i=0,len=rings.length;i<len;++i){type=(i==0)?"outerBoundaryIs":"innerBoundaryIs";ringMember=this.createElementNS(this.kmlns,type);ringGeom=this.buildGeometry.linearring.apply(this,[rings[i]]);ringMember.appendChild(ringGeom);kml.appendChild(ringMember);}
return kml;},multipolygon:function(geometry){return this.buildGeometry.collection.apply(this,[geometry]);},collection:function(geometry){var kml=this.createElementNS(this.kmlns,"MultiGeometry");var child;for(var i=0,len=geometry.components.length;i<len;++i){child=this.buildGeometryNode.apply(this,[geometry.components[i]]);if(child){kml.appendChild(child);}}
return kml;}},buildCoordinatesNode:function(geometry){var coordinatesNode=this.createElementNS(this.kmlns,"coordinates");var path;var points=geometry.components;if(points){var point;var numPoints=points.length;var parts=new Array(numPoints);for(var i=0;i<numPoints;++i){point=points[i];parts[i]=this.buildCoordinates(point);}
path=parts.join(" ");}else{path=this.buildCoordinates(geometry);}
var txtNode=this.createTextNode(path);coordinatesNode.appendChild(txtNode);return coordinatesNode;},buildCoordinates:function(point){if(this.internalProjection&&this.externalProjection){point=point.clone();point.transform(this.internalProjection,this.externalProjection);}
return point.x+","+point.y;},CLASS_NAME:"OpenLayers.Format.KML"});Ext.namespace("GeoExt.data");GeoExt.data.FeatureStoreMixin=function(){return{layer:null,reader:null,featureFilter:null,constructor:function(config){config=config||{};config.reader=config.reader||new GeoExt.data.FeatureReader({},config.fields);var layer=config.layer;delete config.layer;if(config.features){config.data=config.features;}
delete config.features;var options={initDir:config.initDir};delete config.initDir;arguments.callee.superclass.constructor.call(this,config);if(layer){this.bind(layer,options);}},bind:function(layer,options){if(this.layer){return;}
this.layer=layer;options=options||{};var initDir=options.initDir;if(options.initDir==undefined){initDir=GeoExt.data.FeatureStore.LAYER_TO_STORE|GeoExt.data.FeatureStore.STORE_TO_LAYER;}
var features=layer.features.slice(0);if(initDir&GeoExt.data.FeatureStore.STORE_TO_LAYER){var records=this.getRange();for(var i=records.length-1;i>=0;i--){this.layer.addFeatures([records[i].getFeature()]);}}
if(initDir&GeoExt.data.FeatureStore.LAYER_TO_STORE){this.loadData(features,true);}
layer.events.on({"featuresadded":this.onFeaturesAdded,"featuresremoved":this.onFeaturesRemoved,"featuremodified":this.onFeatureModified,scope:this});this.on({"load":this.onLoad,"clear":this.onClear,"add":this.onAdd,"remove":this.onRemove,"update":this.onUpdate,scope:this});},unbind:function(){if(this.layer){this.layer.events.un({"featuresadded":this.onFeaturesAdded,"featuresremoved":this.onFeaturesRemoved,"featuremodified":this.onFeatureModified,scope:this});this.un("load",this.onLoad,this);this.un("clear",this.onClear,this);this.un("add",this.onAdd,this);this.un("remove",this.onRemove,this);this.un("update",this.onUpdate,this);this.layer=null;}},getRecordFromFeature:function(feature){return this.getByFeature(feature)||null;},getByFeature:function(feature){var record;if(feature.state!==OpenLayers.State.INSERT){record=this.getById(feature.id);}else{var index=this.findBy(function(r){return r.getFeature()===feature;});if(index>-1){record=this.getAt(index);}}
return record;},onFeaturesAdded:function(evt){if(!this._adding){var features=evt.features,toAdd=features;if(this.featureFilter){toAdd=[];var i,len,feature;for(var i=0,len=features.length;i<len;i++){feature=features[i];if(this.featureFilter.evaluate(feature)!==false){toAdd.push(feature);}}}
this._adding=true;this.loadData(toAdd,true);delete this._adding;}},onFeaturesRemoved:function(evt){if(!this._removing){var features=evt.features,feature,record,i;for(i=features.length-1;i>=0;i--){feature=features[i];record=this.getByFeature(feature);if(record!==undefined){this._removing=true;this.remove(record);delete this._removing;}}}},onFeatureModified:function(evt){if(!this._updating){var feature=evt.feature;var record=this.getByFeature(feature);if(record!==undefined){record.beginEdit();var attributes=feature.attributes;if(attributes){var fields=this.recordType.prototype.fields;for(var i=0,len=fields.length;i<len;i++){var field=fields.items[i];var key=field.mapping||field.name;if(key in attributes){record.set(field.name,field.convert(attributes[key]));}}}
record.set("state",feature.state);record.set("fid",feature.fid);record.setFeature(feature);this._updating=true;record.endEdit();delete this._updating;}}},addFeaturesToLayer:function(records){var i,len,features;features=new Array((len=records.length));for(i=0;i<len;i++){features[i]=records[i].getFeature();}
if(features.length>0){this._adding=true;this.layer.addFeatures(features);delete this._adding;}},onLoad:function(store,records,options){if(!options||options.add!==true){this._removing=true;this.layer.removeFeatures(this.layer.features);delete this._removing;this.addFeaturesToLayer(records);}},onClear:function(store){this._removing=true;this.layer.removeFeatures(this.layer.features);delete this._removing;},onAdd:function(store,records,index){if(!this._adding){this.addFeaturesToLayer(records);}},onRemove:function(store,record,index){if(!this._removing){var feature=record.getFeature();if(this.layer.getFeatureById(feature.id)!=null){this._removing=true;this.layer.removeFeatures([record.getFeature()]);delete this._removing;}}},onUpdate:function(store,record,operation){if(!this._updating){var defaultFields=new GeoExt.data.FeatureRecord().fields;var feature=record.getFeature();if(feature.state!==OpenLayers.State.INSERT){feature.state=OpenLayers.State.UPDATE;}
if(record.fields){var cont=this.layer.events.triggerEvent("beforefeaturemodified",{feature:feature});if(cont!==false){var attributes=feature.attributes;record.fields.each(function(field){var key=field.mapping||field.name;if(!defaultFields.containsKey(key)){attributes[key]=record.get(field.name);}});this._updating=true;this.layer.events.triggerEvent("featuremodified",{feature:feature});delete this._updating;if(this.layer.getFeatureById(feature.id)!=null){this.layer.drawFeature(feature);}}}}}};};GeoExt.data.FeatureStore=Ext.extend(Ext.data.Store,new GeoExt.data.FeatureStoreMixin);GeoExt.data.FeatureStore.LAYER_TO_STORE=1;GeoExt.data.FeatureStore.STORE_TO_LAYER=2;Ext.namespace("geoadmin");geoadmin.Layers=OpenLayers.Class({layers:null,initialize:function(){this.layers=geoadmin.layer_config;}});Proj4js.defs["EPSG:2169"]="+title=Luxembourg 1930 / Gauss+proj=tmerc +lat_0=49.83333333333334 +lon_0=6.166666666666667 +k=1 +x_0=80000 +y_0=100000 +ellps=intl +towgs84=-193,13.7,-39.3,-0.41,-2.933,2.688,0.43 +units=m +no_defs";Proj4js.defs["EPSG:32631-2"]="+title=UTM +proj=utm +zone=31 +ellps=WGS84 +datum=WGS84 +units=m +no_defs";Proj4js.defs["EPSG:32631"]="+title=UTM 31U +proj=utm +zone=31 +ellps=WGS84 +datum=WGS84 +units=m +no_defs";Ext.namespace("geoadmin");geoadmin.InspireCatalogPanel=Ext.extend(Ext.tree.TreePanel,{id:'inspire_catalog_panel',animate:false,root:{nodeType:'async'},border:false,rootVisible:false,selectedNode:null,selectedNodeId:'',layers:null,listeners:{dblclick:function(node,e){this.selectNode(node);this.selectedNodeId=node.id;},click:function(node,e){this.selectNode(node);this.selectedNodeId=node.id;},checkchange:function(node,state){if(state){if(api.getBodNumberLayer()==5){this.suspendEvents();node.getUI().toggleCheck(false);this.updateCustomizedCheckbox(node,false);alert(OpenLayers.i18n('You can add only 5 layers in the layer tree.'));this.resumeEvents();}else{this.updateCustomizedCheckbox(node,true);api.addLayerToMap(this.getLayerIdFromNodeId(node.id));}}else{api.removeLayerFromMap(this.getLayerIdFromNodeId(node.id));}},beforeclick:function(node,event){if(event.getTarget().className=='treelayerlink'){return false;}else{this.selectedNode=node;this.selectedNodeId=node.id;return true;}},beforedblclick:function(node,event){if(event.getTarget().className=='treelayerlink'){return false;}else{this.selectedNode=node;this.selectedNodeId=node.id;return true;}}},updateCustomizedCheckbox:function(node,state){Ext.get(node.id+'_cb').dom.className=state?'checkboxOn':'checkboxOff';},addtreeLayerLink:function(id,nodeId){var iconTypeClass="treelayericon-"+this.layers[id].type;var layerlink='<div class="'+iconTypeClass+'"></div><div class="layerNodeTools"><div class="treelayerpipe"></div><div class="treelayerlink" onclick="geoadmin.LayerInfo.openDetails(\''+id+'\');"></div><div class="treelayerpipe"></div><div class="checkboxOff" id="'+nodeId+'_cb" onclick="api.inspireCatalogPanel.toggleCheckbox(\''+nodeId+'\');"></div><div class="treelayerpipe"></div></div>';return layerlink;},toggleCheckbox:function(nodeId){this.getNodeById(nodeId).ui.toggleCheck();},getSelectedNode:function(){if(this.selectedNode){return this.selectedNode.id;}else{return'';}},setSelectedNode:function(){this.root.cascade(function(n){var expanded=n.isExpanded();if(!expanded){n.expand();}
if(n.id==this.selectedNodeId){this.selectNode(n);n.ensureVisible();this.selectedNode=n;return false;}else if(!expanded){n.collapse();}},this);},getLayerIdFromNodeId:function(nodeId){var result=nodeId.replace('node_','');result=result.substring(0,result.length-1);return result;},setCheckNodes:function(map){this.root.cascade(function(n){var expanded=n.isExpanded();if(!expanded){n.expand();}
if(n.isLeaf()){var layers=map.getLayersBy('bodid',this.getLayerIdFromNodeId(n.id));var check=layers.length>0;this.suspendEvents();n.getUI().toggleCheck(check);this.updateCustomizedCheckbox(n,check);this.resumeEvents();}
if(!expanded){n.collapse();}},this);},registerMapEvent:function(map){map.events.on({'removelayer':function(layer){if(map){this.setCheckNodes(map);this.setSelectedNode();}},'addlayer':function(layer){if(map){this.setCheckNodes(map);this.setSelectedNode();}},scope:this});},selectNode:function(node){var cls=node.attributes.cls,ui=node.getUI();ui.addClass('nodeBackgroundSelected');ui.removeClass(cls);ui.addClass(cls+'selected');node.parentNode.cascade(function(n){if(n!=node&&n!=node.parentNode){cls=n.attributes.cls;ui=n.getUI();n.collapse();ui.removeClass('nodeBackgroundSelected');ui.addClass(cls);ui.removeClass(cls+'selected');}},this);node.bubble(function(n){if(n!=node&&n!=this.root){cls=n.attributes.cls;ui=n.getUI();ui.removeClass('nodeBackgroundSelected');ui.removeClass(cls);ui.addClass(cls+'selected');}},this);},initComponent:function(){this.root.children=geoadmin.catalog_nodes.children;geoadmin.InspireCatalogPanel.superclass.initComponent.call(this);}});Ext.namespace("geoadmin.LayerInfo");geoadmin.LayerInfo.win=null;geoadmin.LayerInfo.openDetails=function(id){var win=geoadmin.LayerInfo.win;if(win==null){var title=api.layers[id]?api.layers[id].name:'';win=new Ext.Window({closeAction:'hide',resizable:true,autoScroll:true,width:525,cls:'LayerInfo',tools:[{id:'infoBox'},{id:'infoTool'},{id:'close',handler:function(event,toolEl,panel){win.close();}}],toolTemplate:new Ext.XTemplate('<tpl if="id==\'infoBox\'">','<div class="x-tool x-tool-infoBox">infobox</div>','</tpl>','<tpl if="id==\'infoTool\'">','<div class="x-tool x-tool-infoTool">&#160;</div>','</tpl>','<tpl if="id==\'close\'">','<div class="x-tool x-tool-close">&#160;</div>','</tpl>'),layout:'anchor',margin:'10 10 10 10',items:{html:'<a href="'+geoadmin.LayerInfo.getMetadataLink(id)+'" target="_blank">'+OpenLayers.i18n('Layer metadata')+'</a>  '+'<p>&nbsp;</p><iframe src="'+geoadmin.LayerInfo.getLegendLink(id)+'" frameborder=0 width=100% height=300 > </iframe>'}});win.show();}};geoadmin.LayerInfo.getLegendLink=function(id){legendName=api.layers[id].legendName?api.layers[id].legendName:'none';var lang=OpenLayers.Lang.getCode();var link='http://wiki.geoportail.lu/doku.php?id=';link+=lang;link+=':legend:';link+=legendName;link+='&do=export_html';return link;};geoadmin.LayerInfo.getMetadataLink=function(id){metadataID=api.layers[id].metadataID?api.layers[id].metadataID:'none';var lang=OpenLayers.Lang.getCode();var link='http://www.geoportal.lu/Portail/menuAction.do?lang=';link+=lang;link+='&dispatch=load&menuToLoad=inspireViewMetadataExt&uid=';link+=metadataID;return link;};Ext.namespace("geoadmin");geoadmin.MyMapsPanel=Ext.extend(Ext.Panel,{baseCls:'mymaps',border:false,dirty:false,loggedIn:false,maps:null,categories:null,map:null,olMap:null,popup:null,url:null,uploadUrl:null,initComponent:function(){this.loggedIn=!!this.maps;this.title=OpenLayers.i18n('mymaps.title');if(this.loggedIn){this.layout='card';this.layoutOnCardChange=true;this.items=[this.getListPanel()];if(this.map){this.on('afterrender',function(){this.add(this.getViewPanel());this.getLayout().setActiveItem('view');},this);}else{this.activeItem='list';}}else{this.layout='fit';var info={xtype:'box',html:OpenLayers.i18n('mymaps.infomsg')};if(this.map){this.on('afterrender',function(){this.add([this.getViewPanel([{xtype:'box',autoEl:{tag:'div',html:'<hr />'}},info])]);this.doLayout();},this);}else{this.items=info;}}
var context={getColor:function(feature){return feature.attributes.color||'#FF0000';},getLabel:function(feature){return feature.attributes.isLabel?feature.attributes.name:'';},getPointRadius:function(feature){return feature.attributes.isLabel?0:5;},getStroke:function(feature){return feature.attributes.stroke;}};var defaultStyleOptions=OpenLayers.Util.applyDefaults({pointRadius:"${getPointRadius}",fillOpacity:0.5,strokeOpacity:0.7,fillColor:"${getColor}",strokeColor:"${getColor}",strokeWidth:"${getStroke}",label:"${getLabel}",fontSize:"${getStroke}",fontColor:"${getColor}",cursor:'pointer'});this.styleMap=new OpenLayers.StyleMap({'default':new OpenLayers.Style(defaultStyleOptions,{context:context}),'vertices':new OpenLayers.Style({pointRadius:5,graphicName:"square",fillColor:"white",fillOpacity:0.6,strokeWidth:1,strokeOpacity:1,strokeColor:"#333333"})});this.dummyForm=Ext.DomHelper.append(document.body,{tag:'form'});geoadmin.MyMapsPanel.superclass.initComponent.call(this);},getListPanel:function(){var store=new Ext.data.JsonStore({url:this.url,data:this.maps,root:null,fields:['title','public','url','uuid'],autoLoad:true});var tpl=new Ext.XTemplate('<tpl for=".">','<div class="view-item-wrap">','<img class="delete" src="',Ext.BLANK_IMAGE_URL,'"/>','<tpl if="public==false"><img class="lock" src="',Ext.BLANK_IMAGE_URL,'" /></tpl>','{title}','</div>','</tpl>','<div class="x-clear"></div>');var emptyText='<div class="x-results-view-item">'+OpenLayers.i18n('mymaps.no_map')+'</div>';return{itemId:'list',border:false,layout:'vbox',layoutConfig:{align:'stretch'},items:[{xtype:'container',cls:'create',height:30,items:[{xtype:'hyperlink',text:OpenLayers.i18n('mymaps.create_new'),listeners:{'click':function(){this.add(this.getEditPanel());this.getLayout().setActiveItem('edit');},scope:this}}]},new Ext.DataView({store:store,tpl:tpl,itemSelector:'div.view-item-wrap',overClass:'x-view-over',emptyText:emptyText,autoScroll:true,flex:1,listeners:{click:function(view,index,node,e){if(e.getTarget('.delete')){var r=view.getRecord(node),uuid=r.get('uuid');Ext.MessageBox.confirm(OpenLayers.i18n('mymaps.delete'),OpenLayers.i18n('mymaps.confirm_map_deletion'),function(btn){if(btn=='yes'){Ext.Ajax.request({url:this.url+'/'+uuid,method:'DELETE',success:function(){view.store.remove(r);},scope:this});}},this);return false;}
window.location.href=view.getRecord(node).get('url');},scope:this}})],listeners:{'activate':function(){store.reload();}}};},getFeaturesGrid:function(layer,selectControl,callback){var autoActivateControl=true;if(selectControl){autoActivateControl=false;}
if(!layer){layer=new OpenLayers.Layer.Vector("mymapsLayer",{displayInLayerSwitcher:false,styleMap:this.styleMap});this.layer=layer;selectControl=new OpenLayers.Control.SelectFeature(layer);this.olMap.addControl(selectControl);layer.events.on({'featureselected':this.displayFeatureAttributes.createDelegate(this,[selectControl],true)});}
this.olMap.addLayer(layer);var fsConfig={fields:['name','description','image','thumbnail','color','isLabel'],layer:layer};if(this.map){Ext.apply(fsConfig,{proxy:new GeoExt.data.ProtocolProxy({protocol:new OpenLayers.Protocol.HTTP({url:this.url+'/'+this.map.uuid+'/features',format:new OpenLayers.Format.GeoJSON()})}),autoLoad:true});}else{callback&&callback.call(this);}
var store=new GeoExt.data.FeatureStore(fsConfig);var smConfig;if(selectControl){smConfig={selectControl:selectControl,autoActivateControl:autoActivateControl};}
return new Ext.grid.GridPanel({store:store,autoScroll:true,border:false,flex:1,viewConfig:{forceFit:true},hideHeaders:true,columns:[{header:'',dataIndex:'fid',renderer:this.renderFeature,width:14},{header:'Name',dataIndex:'name',autoFit:true}],sm:new GeoExt.grid.FeatureSelectionModel(smConfig),listeners:{beforedestroy:function(grid){grid.getSelectionModel().selectRecords([]);},destroy:function(){layer.map.removeLayer(layer);},afterrender:function(grid){grid.store.on('load',callback||Ext.emptyFn,this);},scope:this}});},getViewPanel:function(_items){_items=_items||[];var linkBtnId=Ext.id();var template=new Ext.XTemplate('<p>','<span class="linkContainer" id="',linkBtnId,'"></span>','<span class="title">{title}</span>','</p>');var linkButton=new Ext.Button({iconCls:'link',cls:'light-btn',menu:[{xtype:'container',layout:'form',labelAlign:'top',width:400,items:[{xtype:'textfield',anchor:'100%',selectOnFocus:true,value:this.api.baseConfig.baseUrl+this.map.url,fieldLabel:OpenLayers.i18n('mymaps.linkmsg')}]}],tooltip:OpenLayers.i18n('mymaps.link_tip')});var ratingVote=function(){return Math.round(this.map.rating).toString();}
var ratingCls=function(r){return'rating rating'+r;}
var ratingCount=function(count){return count+' '+OpenLayers.i18n('mymaps.ratings');}
var ratingAndComments={xtype:'container',items:[{xtype:'button',text:ratingCount(this.map.rating_count),iconCls:ratingCls(ratingVote.call(this)),cls:'light-btn rating-count',tooltip:Math.round(this.map.rating*100)/100,menu:new Ext.menu.Menu({cls:'rating-menu',width:84,items:[{cls:"rating0",rating:0},{cls:"rating1",rating:1},{cls:"rating2",rating:2},{cls:"rating3",rating:3},{cls:"rating4",rating:4},{cls:"rating5",rating:5}],listeners:{itemclick:function(item,e){var button=item.parentMenu.ownerCt;Ext.Ajax.request({url:this.url+'/'+this.map.uuid+'/rate',method:'GET',params:{rating:item.rating},success:function(response){alert(OpenLayers.i18n("mymaps.rating_ok"));var result=Ext.util.JSON.decode(response.responseText);button.setIconClass(ratingCls(Math.round(result.rating)));button.setText(ratingCount(result.rating_count));button.setTooltip(Math.round(result.rating*100)/100);},failure:function(){alert("Something went wrong");}});},scope:this}})},{xtype:'hyperlink',text:OpenLayers.i18n('mymaps.leavecomment'),listeners:{click:function(){this.addComment();},scope:this}}]};var actions=this.createExportButton();var items=[];if(this.loggedIn){items.push({xtype:'container',items:[{xtype:'hyperlink',text:OpenLayers.i18n('mymaps.back_to_list'),listeners:{click:function(){this.getLayout().setActiveItem('list');this.remove(this.items.get('view'));this.map=null;},scope:this}}]});var copyAndModify=[],editMap=function(copy){this.remove(this.items.get('view'));this.add(this.getEditPanel());this.getLayout().setActiveItem('edit');var editPanel=this.items.get('edit');var form=editPanel.items.get('form');if(copy){delete this.map.uuid;}
form.getForm().items.each(function(item){item.suspendEvents();},this);form.getForm().setValues(this.map);form.getForm().items.each(function(item){item.resumeEvents();},this);};copyAndModify.push({xtype:'hyperlink',text:OpenLayers.i18n('mymaps.copy_to_own_maps'),listeners:{click:function(){editMap.call(this,true);},scope:this}});if(this.map.isAuthor){copyAndModify.push({xtype:'button',text:OpenLayers.i18n('mymaps.modify'),handler:editMap.createDelegate(this,[],false)});}
items.push({xtype:'container',layout:'hbox',height:25,layoutConfig:{pack:'end'},items:copyAndModify});}
items=items.concat([{xtype:'container',html:template.apply(this.map)},{xtype:'container',flex:1,autoScroll:true,html:this.map.description},{xtype:'box',autoEl:{tag:'p',"class":'author',html:OpenLayers.i18n('mymaps.map_created_by')+this.map.user_login}},ratingAndComments,{xtype:'box',autoEl:{tag:'hr'}},this.getFeaturesGrid(),actions]);items=items.concat(_items);return{itemId:'view',border:false,layout:'vbox',layoutConfig:{align:'stretch'},items:items,listeners:{afterlayout:function(panel){linkButton.render(Ext.get(linkBtnId));}}};},getEditPanel:function(){var backToList={xtype:'hyperlink',text:OpenLayers.i18n('mymaps.back_to_list'),listeners:{click:function(){this.getLayout().setActiveItem('list');this.remove(this.items.get('edit'));},scope:this}};var save=function(callback){featuresGrid.getSelectionModel().selectRecords([]);var uuidField=form.getForm().findField('uuid');var uuid=uuidField.getValue();var url=this.url+(uuid?'/'+uuid:'');form.getForm().submit({url:url,method:uuid?'PUT':'POST',params:this.getOLMapParams(),success:function(form,action){uuidField.setValue(action.result.uuid);saveButton.setText(OpenLayers.i18n('mymaps.saved'));saveButton.setDisabled(true);saveButton.ownerCt.doLayout();this.dirty=false;this.map=action.result;if(callback){callback.call(this);}},failure:function(){console.log("failure");},scope:this});}
var saveButton=new Ext.Button({xtype:'button',text:OpenLayers.i18n('mymaps.save'),handler:save.createDelegate(this,[],false),disabled:true});function activateSave(){this.dirty=true;if(saveButton.rendered&&saveButton.btnEl){saveButton.setText(saveButton.initialConfig.text);saveButton.setDisabled(false);if(this.ownerCt.getActiveTab()==this){saveButton.ownerCt.doLayout();}}}
this.olMap.events.on({addlayer:activateSave,changelayer:activateSave,moveend:activateSave,scope:this});var buttons={xtype:'container',layout:'hbox',layoutConfig:{pack:'end'},defaults:{margins:'0 0 0 5'},items:[{xtype:'button',text:'OK',handler:function(){if(this.dirty){var box=Ext.MessageBox.show({title:OpenLayers.i18n('mymaps.not_saved_modifications'),msg:OpenLayers.i18n('mymaps.not_saved_modifications_msg'),buttons:Ext.MessageBox.YESNOCANCEL,fn:function(btn,text,opt){function quit(){if(this.map){window.location=this.map.url;}else{this.getLayout().setActiveItem('list');this.remove(this.items.get('edit'));}}
switch(btn){case"yes":save.call(this,quit);break;case"no":quit.call(this);break;}},scope:this});}else{window.location=this.map.url}},scope:this},saveButton]};var category;if(this.categories&&this.categories.length>0){this.categories=[{id:'--',name:OpenLayers.i18n('mymaps.no_category')}].concat(this.categories);var categoriesStore=new Ext.data.JsonStore({fields:['id','name'],data:this.categories});category={xtype:'combo',store:categoriesStore,hiddenName:'category_id',valueField:'id',displayField:'name',mode:'local',triggerAction:'all',listWidth:200,emptyText:OpenLayers.i18n('mymaps.category'),editable:false,listeners:{select:function(combo,r){if(r.get('id')=='--'){combo.clearValue();}
combo.triggerBlur.defer(100,combo);},change:activateSave,scope:this}}}else{category={xtype:'box'};}
var form=new Ext.form.FormPanel({labelAlign:'top',border:false,itemId:'form',defaults:{enableKeyEvents:true,listeners:{keypress:activateSave,change:activateSave,scope:this}},items:[{xtype:'hidden',name:'uuid'},{xtype:'hidden',name:'theme',value:geoadmin.theme},{xtype:'textfield',fieldLabel:OpenLayers.i18n('mymaps.form.title'),emptyText:OpenLayers.i18n('mymaps.defaulttitle'),name:'title',anchor:'100%'},{xtype:'textarea',fieldLabel:OpenLayers.i18n('mymaps.form.description'),name:'description',anchor:'100%'},{xtype:'container',layout:'column',defaults:{columnWidth:0.5},items:[{xtype:'checkbox',name:'public',hideLabel:true,boxLabel:OpenLayers.i18n('mymaps.public'),listeners:{check:activateSave,scope:this}},category]}]});this.layer=new OpenLayers.Layer.Vector("mymapsLayer",{displayInLayerSwitcher:false,styleMap:this.styleMap});this.olMap.addLayers([this.layer]);var featureEditingControler=new GeoExt.ux.FeatureEditingControler({map:this.olMap,layers:[this.layer],styler:'combobox',uploadImageUrl:this.url+'/upload_image',featurePanelClass:geoadmin.MyMapsFeaturePanel,'export':false,'import':false,defaultAttributes:['name','description','image','thumbnail','color','stroke','isLabel'],defaultAttributesValues:[OpenLayers.i18n('mymaps.defaulttitle'),'','','','#FF0000',null],popupOptions:{anchored:false,unpinnable:false,draggable:true},selectControlOptions:{vertexRenderIntent:'vertices'}});function addLayerEvents(){this.layer.events.on({featureadded:activateSave,featureremoved:activateSave,featuremodified:activateSave,scope:this});}
var featuresGrid=this.getFeaturesGrid(this.layer,featureEditingControler.featureControl.selectControl,addLayerEvents.createDelegate(this));var uploadButton=new Ext.ux.form.FileUploadField({buttonOnly:true,buttonText:OpenLayers.i18n('mymaps.import'),name:'file',hideLabel:true,listeners:{'fileselected':function(button,value){uploadForm.getForm().submit({url:this.uploadUrl,waitMsg:OpenLayers.i18n('mymaps.loading'),success:function(panel,o){this.downloadData(o.result.url,o.result.type);},scope:this});},'render':function(field){new Ext.ToolTip({target:field.fileInput,html:OpenLayers.i18n('mymaps.importtip')});},scope:this}});var uploadForm=new Ext.form.FormPanel({border:false,items:uploadButton,fileUpload:true});var actions=featureEditingControler.actions.concat(['->',uploadForm]);var editingToolbar={xtype:'toolbar',items:[actions]};return{xtype:'container',itemId:'edit',layout:'vbox',layoutConfig:{align:'stretch'},items:[backToList,buttons,form,editingToolbar,featuresGrid],listeners:{afterrender:function(){featureEditingControler.featureControl.activate();},destroy:function(){this.map=null;for(var i=0;i<actions.length;i++){if(actions[i].control){actions[i].control.deactivate();}}},scope:this}};},getOLMapParams:function(){var center=this.olMap.getCenter();var permalink;for(var i=0;i<this.olMap.controls.length;i++){var control=this.olMap.controls[i];if(control instanceof OpenLayers.Control.Permalink){permalink=control;}}
var format=new OpenLayers.Format.GeoJSON();var params={features:format.write(this.layer.features)};if(permalink){Ext.apply(params,permalink.createParams(this.olMap.getCenter(),this.olMap.getZoom(),this.olMap.layers));}
for(i in params){params[i]=[params[i]].join(',');}
return params;},addComment:function(){var _=OpenLayers.i18n;var items=[];if(!this.loggedIn){items.push(new Ext.form.TextField({name:'name',allowBlank:false,fieldLabel:_('mymaps.name'),disabled:!!geoadmin.user,value:geoadmin.user&&geoadmin.user.name}));items.push(new Ext.form.TextField({name:'mail',allowBlank:false,fieldLabel:_('mymaps.mail'),disabled:!!geoadmin.user,value:geoadmin.user&&geoadmin.user.mail,vtype:"email"}));}
items.push(new Ext.form.TextArea({xtype:'textarea',allowBlank:false,name:'comment',emptyText:_('mymaps.comment'),anchor:'100%',hideLabel:true,listeners:{blur:function(){Recaptcha.focus_response_field();}}}));var id=Ext.id();items.push(new Ext.BoxComponent({autoEl:{tag:'div',id:id},listeners:{afterrender:function(){var self=this;Recaptcha.create(self.api.baseConfig.captchaPublicKey,id,{theme:'clean'});},scope:this}}));var form=new Ext.form.FormPanel({items:items,border:false,buttons:[{text:_('mymaps.send'),disabled:true,handler:function(button){button.setIconClass('loading');button.setDisabled(true);form.getForm().submit({url:this.url+'/'+this.map.uuid+'/comment',success:function(){button.setIconClass(button.initialConfig.iconCls);win.add({xtype:'box',html:'<p>'+
_('mymaps.comment.success')+'</p>'});win.doLayout();win.close.defer(3000,win);button.setText(_('mymaps.sent'));},failure:function(form,resp){var subMsg='';if(resp.result.invalidCaptcha){subMsg='<p>'+_('mymaps.comment.invalidCaptcha')+'</p>';}
button.setIconClass(button.initialConfig.iconCls);var msg=win.add({xtype:'box',html:'<p>'+
_('mymaps.comment.failure')+'</p>'+
subMsg});win.doLayout();msg.hide.defer(2000,msg);button.setDisabled(false);}});},scope:this}],monitorValid:true,listeners:{clientvalidation:function(form,valid){form.buttons[0].setDisabled(!valid);}}});var win=new Ext.Window({title:_('mymaps.leavecomment'),hideLabels:true,modal:true,shadow:false,width:460,items:form});win.show();},formatArea:function(num){if(num>1000000){return(num/1000000).toFixed(3)+" kmÂ²";}
else{return num+" mÂ²";}},formatLength:function(num){if(num>1000){return(num/1000).toFixed(3)+" km";}
else{return num+" m";}},displayFeatureAttributes:function(obj,selectControl){var feature=obj.feature;this.popup&&this.popup.close();var measure;var items=[];if(feature.attributes.thumbnail){items.push(new Ext.BoxComponent({autoEl:{tag:'img',src:feature.attributes.thumbnail,cls:'thumbnail'},listeners:{render:function(cmp){cmp.mon(cmp.el,{'click':function(){window.open(feature.attributes.image);}});}}}));}
items.push({xtype:'box',html:feature.attributes.description});items.push({xtype:'hyperlink',text:OpenLayers.i18n('mymaps.zoom_to'),listeners:{'click':function(){this.olMap.zoomToExtent(feature.geometry.getBounds());},scope:this}});if(feature.geometry instanceof OpenLayers.Geometry.LineString){measure=OpenLayers.String.format(OpenLayers.i18n('mymaps.length'),{length:this.formatLength(feature.geometry.getLength().toFixed(3))});items.push({xtype:'hyperlink',text:OpenLayers.i18n('mymaps.show_profile'),listeners:{'click':function(){var control=new geoadmin.Profile({layers:["MNT"],serviceUrl:this.api.baseConfig.baseUrl});this.olMap.addControl(control);this.olMap.addLayer(control.layer);var f=feature.clone();control.layer.addFeatures(f);control.featureAdded(f);},scope:this}});}else if(feature.geometry instanceof OpenLayers.Geometry.Polygon){measure=OpenLayers.String.format(OpenLayers.i18n('mymaps.area'),{area:this.formatArea(feature.geometry.getArea().toFixed(3))});}
if(measure){items.push({xtype:'box',html:measure});}
items.push(this.createExportButton(feature));var location=feature.geometry.getCentroid(true);var extent=this.olMap.getExtent(),extentAsPoly=extent.toGeometry();if(extentAsPoly.intersects(feature.geometry)){if(!extent.containsBounds(feature.geometry.getBounds())){location=this.olMap.getCenter();}}else{this.olMap.zoomToExtent(feature.geometry.getBounds());}
this.popup=new GeoExt.Popup({map:this.olMap,title:feature.attributes.name,location:location,unpinnable:false,width:300,cls:'feature-popup',anchored:false,unpinnable:false,draggable:true,items:items});this.popup.show();this.popup.on({'close':function(){selectControl.unselectAll();}});feature.layer.events.on({'featureunselected':function(){this.popup.close();},'scope':this});},downloadData:function(url,type){var format;var options={externalProjection:new OpenLayers.Projection('EPSG:4326'),internalProjection:this.olMap.getProjectionObject()};switch(type){case'.kml':format=new OpenLayers.Format.KML(options);break;case'.gpx':format=new OpenLayers.Format.GPX(options);break;default:break;}
if(!format){Ext.MessageBox.alert(OpenLayers.i18n('mymaps.unsupportedfiletitle'),OpenLayers.i18n('mymaps.unsupportedfilemsg'));return;}
Ext.Ajax.request({url:url,success:function(r){var features=format.read(r.responseText);Ext.each(features,function(f){f.attributes.color='#FF0000';f.attributes.stroke=2;});this.layer.addFeatures(features);var extent=new OpenLayers.Bounds();Ext.each(features,function(feature){extent.extend(feature.geometry.getBounds());});this.olMap.zoomToExtent(extent);},scope:this});},createExportButton:function(feature){return{xtype:'container',layout:'hbox',layoutConfig:{pack:'end'},items:[{xtype:'button',text:OpenLayers.i18n('mymaps.export.txt'),tooltip:OpenLayers.i18n(feature?'mymaps.export.feature.msg':'mymaps.export.msg'),menu:new Ext.menu.Menu({items:[{text:'KML'},{text:'GPX'}],listeners:{itemclick:function(item,e){var metadata,title=feature&&feature.attributes.name||this.map.title,description=feature&&feature.attributes.description||this.map.description,features=feature||this.layer.features,options={externalProjection:new OpenLayers.Projection('EPSG:4326'),internalProjection:this.olMap.getProjectionObject()};if(item.text=='KML'){Ext.apply(options,{foldersName:title,foldersDesc:description})}else if(item.text=='GPX'){metadata={name:title,desc:description}}
var format=new OpenLayers.Format[item.text](options);Ext.Ajax.request({url:this.url+'/export',params:{content:format.write(features,metadata),format:item.text.toLowerCase(),name:title},isUpload:true,form:this.dummyForm,scope:this});},scope:this}})}]};},renderFeature:function(value,p,r){var id=Ext.id(),feature=r.get('feature');function getSymbolTypeFromFeature(feature){var type;switch(feature.geometry.CLASS_NAME){case"OpenLayers.Geometry.MultiLineString":case"OpenLayers.Geometry.LineString":type='Line';break;case"OpenLayers.Geometry.Point":type='Point';break;case"OpenLayers.Geometry.Polygon":type='Polygon';break;}
return type;}
(function(){if(r&&r.store){var symbolizer=r.store.layer.styleMap.createSymbolizer(feature,'default');if(feature.attributes.isLabel===true){symbolizer.label='T';}
var renderer=new GeoExt.FeatureRenderer({renderTo:id,symbolType:getSymbolTypeFromFeature(feature),symbolizers:[symbolizer]});}}).defer(25);return(String.format('<div id="{0}"></div>',id));}});Ext.namespace("geoadmin.layerNode");geoadmin.TextItem=Ext.extend(Ext.Toolbar.Item,{constructor:function(config){var s=document.createElement("span");s.id=config.id;s.className="ytb-text";if(config.opacity==null){s.innerHTML='100%';}else{s.innerHTML=parseInt(config.opacity*100)+'%';}
geoadmin.TextItem.superclass.constructor.call(this,s);},enable:Ext.emptyFn,disable:Ext.emptyFn,focus:Ext.emptyFn});geoadmin.LayerOpacitySliderLabel=Ext.extend(Ext.Component,{target:null,el:null,constructor:function(target){this.target=target;},init:function(slider){slider.on("change",this.change,this);},change:function(slider,value){if(!this.el){this.el=Ext.get(this.target);}
this.el.dom.innerHTML=value+'%';}});geoadmin.toggleVisibility=function(layer,action){layer.setVisibility(!layer.visibility);if(action){if(layer.visibility){action.setIconClass('visibility-on');}else{action.setIconClass('visibility-off');}}};geoadmin.layerNode.tbar=function(node,ct){return new Ext.Toolbar({cls:"gx-toolbar",height:24,ctCls:"line-height-zero",hidden:false,buttons:[OpenLayers.i18n('Opacity:'),new GeoExt.LayerOpacitySlider({layer:node.layer,aggressive:true,plugins:new geoadmin.LayerOpacitySliderLabel(node.layer.bodid+'-opacity-lbl'),width:100}),new geoadmin.TextItem({id:node.layer.bodid+'-opacity-lbl',opacity:node.layer.opacity}),'->',new Ext.Action({iconCls:node.layer.visibility?'visibility-on':'visibility-off',tooltip:OpenLayers.i18n("Layer visibility"),handler:function(){geoadmin.toggleVisibility(node.layer,this);}}),new Ext.Action({iconCls:'layer-info',tooltip:OpenLayers.i18n("about that layer"),handler:function(){geoadmin.LayerInfo.openDetails(node.layer.bodid);}})]});};geoadmin.layerNode.act=function(node,action,evt){var layer=node.layer;switch(action){case"down":layer.map.raiseLayer(layer,-1);break;case"up":layer.map.raiseLayer(layer,+1);break;case"delete":layer.destroy();break;case"close":node.component.hide();var open_button=Ext.get(node.id+'_open');var close_button=Ext.get(node.id+'_close');close_button.hide();open_button.show();break;case"open":node.component.show();var open_button=Ext.get(node.id+'_open');var close_button=Ext.get(node.id+'_close');open_button.hide();close_button.show();break;}};geoadmin.LayerNode=Ext.extend(GeoExt.tree.LayerNode,{constructor:function(config){if(config.layer.layerType){config.iconCls='tree-layer-icon-'+config.layer.layerType;}
geoadmin.LayerNode.superclass.constructor.apply(this,arguments);}});Ext.tree.TreePanel.nodeTypes.geoadmin_layer=geoadmin.LayerNode;geoadmin.LayerNodeUI=Ext.extend(GeoExt.tree.LayerNodeUI,new GeoExt.tree.TreeNodeUIEventMixin());Ext.tree.TreeEventModel.prototype.getNode=function(e){var t;if(t=e.getTarget('.x-tree-node-el',50)){var id=Ext.fly(t,'_treeEvents').getAttribute('tree-node-id','ext');if(id){return this.tree.getNodeById(id);}}
return null;};OpenLayers.Rule=OpenLayers.Class({id:null,name:null,title:null,description:null,context:null,filter:null,elseFilter:false,symbolizer:null,symbolizers:null,minScaleDenominator:null,maxScaleDenominator:null,initialize:function(options){this.symbolizer={};OpenLayers.Util.extend(this,options);if(this.symbolizers){delete this.symbolizer;}
this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");},destroy:function(){for(var i in this.symbolizer){this.symbolizer[i]=null;}
this.symbolizer=null;delete this.symbolizers;},evaluate:function(feature){var context=this.getContext(feature);var applies=true;if(this.minScaleDenominator||this.maxScaleDenominator){var scale=feature.layer.map.getScale();}
if(this.minScaleDenominator){applies=scale>=OpenLayers.Style.createLiteral(this.minScaleDenominator,context);}
if(applies&&this.maxScaleDenominator){applies=scale<OpenLayers.Style.createLiteral(this.maxScaleDenominator,context);}
if(applies&&this.filter){if(this.filter.CLASS_NAME=="OpenLayers.Filter.FeatureId"){applies=this.filter.evaluate(feature);}else{applies=this.filter.evaluate(context);}}
return applies;},getContext:function(feature){var context=this.context;if(!context){context=feature.attributes||feature.data;}
if(typeof this.context=="function"){context=this.context(feature);}
return context;},clone:function(){var options=OpenLayers.Util.extend({},this);if(this.symbolizers){var len=this.symbolizers.length;options.symbolizers=new Array(len);for(var i=0;i<len;++i){options.symbolizers[i]=this.symbolizers[i].clone();}}else{options.symbolizer={};var value,type;for(var key in this.symbolizer){value=this.symbolizer[key];type=typeof value;if(type==="object"){options.symbolizer[key]=OpenLayers.Util.extend({},value);}else if(type==="string"){options.symbolizer[key]=value;}}}
options.filter=this.filter&&this.filter.clone();options.context=this.context&&OpenLayers.Util.extend({},this.context);return new OpenLayers.Rule(options);},CLASS_NAME:"OpenLayers.Rule"});Ext.namespace("MapFish");MapFish.API.Measure=OpenLayers.Class({prevPopup:null,options:null,initialize:function(config){config=config||{};Ext.apply(this,config);var options=null;if(!Ext.isEmpty(config.options)){options=config.options;};this.options=Ext.apply({persist:true,handlerOptions:{layerOptions:{styleMap:this.getStyleMap()}},eventListeners:{'measure':this.renderMeasure,'measurepartial':this.clearMeasure,'deactivate':this.deactivateTool,scope:this}},options);},createLengthMeasureControl:function(){return new OpenLayers.Control.Measure(OpenLayers.Handler.Path,this.options);},createAreaMeasureControl:function(){return new OpenLayers.Control.Measure(OpenLayers.Handler.Polygon,this.options);},getStyleMap:function(){var sketchSymbolizers={"Point":{pointRadius:4,graphicName:"square",fillColor:"white",fillOpacity:1,strokeWidth:1,strokeOpacity:1,strokeColor:"#FFFF33"},"Line":{strokeWidth:3,strokeOpacity:1,strokeColor:"#FFFF33"},"Polygon":{strokeWidth:2,strokeOpacity:1,strokeColor:"#FFFF33",fillColor:"white",fillOpacity:0.3}};var style=new OpenLayers.Style();style.addRules([new OpenLayers.Rule({symbolizer:sketchSymbolizers})]);return new OpenLayers.StyleMap({"default":style});},renderMeasure:function(event){var out=event.measure.toFixed(3)+" "+event.units;if(event.order!=1){out+="<sup>2</"+"sup>";}
this.createPopup(out);},createPopup:function(out){this.clearMeasure();var popup=new Ext.Window({title:OpenLayers.i18n('Measure'),html:out,width:150,bodyStyle:'background-color: #FFFFD0;'});this.prevPopup=popup;popup.show();},clearMeasure:function(){var th=this.scope||this;if(th.prevPopup){th.prevPopup.close();}
th.prevPopup=null;},deactivateTool:function(){this.clearMeasure();}});OpenLayers.Control.Attribution=OpenLayers.Class(OpenLayers.Control,{separator:", ",destroy:function(){this.map.events.un({"removelayer":this.updateAttribution,"addlayer":this.updateAttribution,"changelayer":this.updateAttribution,"changebaselayer":this.updateAttribution,scope:this});OpenLayers.Control.prototype.destroy.apply(this,arguments);},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.map.events.on({'changebaselayer':this.updateAttribution,'changelayer':this.updateAttribution,'addlayer':this.updateAttribution,'removelayer':this.updateAttribution,scope:this});this.updateAttribution();return this.div;},updateAttribution:function(){var attributions=[];if(this.map&&this.map.layers){for(var i=0,len=this.map.layers.length;i<len;i++){var layer=this.map.layers[i];if(layer.attribution&&layer.getVisibility()){if(OpenLayers.Util.indexOf(attributions,layer.attribution)===-1){attributions.push(layer.attribution);}}}
this.div.innerHTML=attributions.join(this.separator);}},CLASS_NAME:"OpenLayers.Control.Attribution"});OpenLayers.Handler.Pinch=OpenLayers.Class(OpenLayers.Handler,{started:false,stopDown:false,pinching:false,last:null,start:null,touchstart:function(evt){var propagate=true;this.pinching=false;if(OpenLayers.Event.isMultiTouch(evt)){this.started=true;this.last=this.start={distance:this.getDistance(evt.touches),delta:0,scale:1};this.callback("start",[evt,this.start]);propagate=!this.stopDown;}else{this.started=false;this.start=null;this.last=null;}
OpenLayers.Event.stop(evt);return propagate;},touchmove:function(evt){if(this.started&&OpenLayers.Event.isMultiTouch(evt)){this.pinching=true;var current=this.getPinchData(evt);this.callback("move",[evt,current]);this.last=current;OpenLayers.Event.stop(evt);}
return true;},touchend:function(evt){if(this.started){this.started=false;this.pinching=false;this.callback("done",[evt,this.start,this.last]);this.start=null;this.last=null;}
return true;},activate:function(){var activated=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.pinching=false;activated=true;}
return activated;},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.started=false;this.pinching=false;this.start=null;this.last=null;deactivated=true;}
return deactivated;},getDistance:function(touches){var t0=touches[0];var t1=touches[1];return Math.sqrt(Math.pow(t0.clientX-t1.clientX,2)+
Math.pow(t0.clientY-t1.clientY,2));},getPinchData:function(evt){var distance=this.getDistance(evt.touches);var scale=distance/this.start.distance;return{distance:distance,delta:this.last.distance-distance,scale:scale};},CLASS_NAME:"OpenLayers.Handler.Pinch"});OpenLayers.Control.PinchZoom=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,containerCenter:null,pinchOrigin:null,currentCenter:null,autoActivate:true,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.handler=new OpenLayers.Handler.Pinch(this,{start:this.pinchStart,move:this.pinchMove,done:this.pinchDone},this.handlerOptions);},activate:function(){var activated=OpenLayers.Control.prototype.activate.apply(this,arguments);if(activated){this.map.events.on({moveend:this.updateContainerCenter,scope:this});this.updateContainerCenter();}
return activated;},deactivate:function(){var deactivated=OpenLayers.Control.prototype.deactivate.apply(this,arguments);if(this.map&&this.map.events){this.map.events.un({moveend:this.updateContainerCenter,scope:this});}
return deactivated;},updateContainerCenter:function(){var container=this.map.layerContainerDiv;this.containerCenter={x:parseInt(container.style.left,10)+50,y:parseInt(container.style.top,10)+50};},pinchStart:function(evt,pinchData){this.pinchOrigin=evt.xy;this.currentCenter=evt.xy;},pinchMove:function(evt,pinchData){var scale=pinchData.scale;var containerCenter=this.containerCenter;var pinchOrigin=this.pinchOrigin;var current=evt.xy;var dx=Math.round((current.x-pinchOrigin.x)+(scale-1)*(containerCenter.x-pinchOrigin.x));var dy=Math.round((current.y-pinchOrigin.y)+(scale-1)*(containerCenter.y-pinchOrigin.y));this.applyTransform("translate("+dx+"px, "+dy+"px) scale("+scale+")");this.currentCenter=current;},applyTransform:function(transform){var style=this.map.layerContainerDiv.style;style['-webkit-transform']=transform;style['-moz-transform']=transform;},pinchDone:function(evt,start,last){this.applyTransform("");var zoom=this.map.getZoomForResolution(this.map.getResolution()/last.scale,true);if(zoom!==this.map.getZoom()||!this.currentCenter.equals(this.pinchOrigin)){var resolution=this.map.getResolutionForZoom(zoom);var location=this.map.getLonLatFromPixel(this.pinchOrigin);var zoomPixel=this.currentCenter;var size=this.map.getSize();location.lon+=resolution*((size.w/2)-zoomPixel.x);location.lat-=resolution*((size.h/2)-zoomPixel.y);this.map.setCenter(location,zoom);}},CLASS_NAME:"OpenLayers.Control.PinchZoom"});Ext.namespace("GeoExt.ux");GeoExt.ux.DisplayProjectionSelectorCombo=Ext.extend(Ext.form.ComboBox,{map:null,updateMapDisplayProjection:true,controls:null,projections:null,tpl:'<tpl for="."><div class="x-combo-list-item">{[values.title]} </div></tpl>',editable:false,triggerAction:'all',mode:'local',initComponent:function(){GeoExt.ux.DisplayProjectionSelectorCombo.superclass.initComponent.apply(this,arguments);this.store=new Ext.data.Store();var projectionRecord=Ext.data.Record.create([{name:'title'},{name:'projName'},{name:'srsCode'}]);var mapProjection=null;var mapProjectionRecord=null;if(this.projections){for(var i=0;i<this.projections.length;i++){mapProjection=new OpenLayers.Projection(this.projections[i]);mapProjectionRecord=new projectionRecord({title:mapProjection.proj.title,projName:mapProjection.proj.projName,srsCode:mapProjection.proj.srsCodeInput});this.store.add(mapProjectionRecord);}}else{mapProjection=new OpenLayers.Projection(this.map.getProjection());mapProjectionRecord=new projectionRecord({title:mapProjection.proj.title,projName:mapProjection.proj.projName,srsCode:mapProjection.proj.srsCodeInput});this.store.add(mapProjectionRecord);if(this.map.displayProjection&&mapProjection.proj.title!=this.map.displayProjection.proj.title){var mapDisplayProjectionRecord=new projectionRecord({title:this.map.displayProjection.proj.title,projName:this.map.displayProjection.proj.projName,srsCode:this.map.displayProjection.proj.srsCodeInput});this.store.add(mapDisplayProjectionRecord);}}
if(this.map.displayProjection){this.setValue(this.map.displayProjection.proj.title);}else{this.setValue(mapProjection.proj.title);}
this.on('select',function(combo,record,index){var displayProjection=new OpenLayers.Projection(record.data.srsCode);if(this.updateMapDisplayProjection){this.map.displayProjection=displayProjection;}
var control=null;if(this.controls){for(var k=0;k<this.controls.length;k++){control=this.controls[k];if(control.displayProjection){control.displayProjection=displayProjection;}
if(control.redraw){control.redraw();}}}else{for(var i=0;i<this.map.controls.length;i++){control=this.map.controls[i];if(control.displayProjection){control.displayProjection=displayProjection;}
if(control.redraw){control.redraw();}}}
this.fireEvent('displayProjectionChanged',this);},this);this.on('displayProjectionChanged',function(combo){combo.setValue(this.map.displayProjection.proj.title);},this);this.addEvents('displayProjectionChanged');}});Ext.reg('gxux_displayprojectionselectorcombo',GeoExt.ux.DisplayProjectionSelectorCombo);Ext.namespace("GeoExt.ux.form");GeoExt.ux.form.FeatureEditingPanel=Ext.extend(Ext.form.FormPanel,{labelWidth:100,border:false,bodyStyle:'padding:5px 5px 5px 5px',width:300,defaults:{width:120},defaultType:'textfield',controler:null,downloadService:null,initComponent:function(){if(this.controler){this.initToolbar();this.initForm();}
GeoExt.ux.form.FeatureEditingPanel.superclass.initComponent.call(this);},initToolbar:function(){Ext.apply(this,{tbar:new Ext.Toolbar(this.controler.actions)});},initForm:function(){oItems=[];oItems.push({id:"testid",fieldLabel:OpenLayers.i18n("myOption"),maxLength:50,xtype:"checkbox"});Ext.apply(this,{items:oItems});},beforeDestroy:function(){delete this.controler;}});Ext.reg("gx_featureeditingpanel",GeoExt.ux.form.FeatureEditingPanel);Ext.namespace("GeoExt.ux.form");GeoExt.ux.form.RedLiningPanel=Ext.extend(GeoExt.ux.form.FeatureEditingPanel,{map:null,'import':true,'export':true,toggleGroup:null,popupOptions:{},selectControlOptions:{},initComponent:function(){this.initMap();this.initControler();GeoExt.ux.form.RedLiningPanel.superclass.initComponent.call(this);},initMap:function(){if(this.map instanceof GeoExt.MapPanel){this.map=this.map.map;}
if(!this.map){this.map=GeoExt.MapPanel.guess().map;}},initControler:function(){this.controler=new GeoExt.ux.FeatureEditingControler({'cosmetic':true,'map':this.map,'import':this['import'],'export':this['export'],'toggleGroup':this.toggleGroup,'popupOptions':this.popupOptions,'selectControlOptions':this.selectControlOptions});}});Ext.reg("gx_redliningpanel",GeoExt.ux.form.RedLiningPanel);Ext.namespace("GeoExt.ux.form");GeoExt.ux.form.FeaturePanel=Ext.extend(Ext.form.FormPanel,{labelWidth:100,border:false,bodyStyle:'padding:5px 5px 5px 5px',width:'auto',autoWidth:true,height:'auto',autoHeight:true,defaults:{width:120},defaultType:'textfield',features:null,layer:null,controler:null,autoSave:true,deleteAction:null,attributeFieldSetId:"gx_featurepanel_attributefieldset_id",labelAttribute:"name",useIcons:true,initComponent:function(){this.initFeatures(this.features);this.initToolbar();this.initForm();GeoExt.ux.form.FeaturePanel.superclass.initComponent.call(this);},initFeatures:function(features){if(features instanceof Array){this.features=features;}else{this.features=[features];}},initToolbar:function(){this.initDeleteAction();Ext.apply(this,{bbar:new Ext.Toolbar(this.getActions())});},initForm:function(){var oItems,oGroup,feature,field,oGroupItems;if(this.features.length!=1){return;}else{feature=this.features[0];}
oItems=[];oGroupItems=[];oGroup={id:this.attributeFieldSetId,xtype:'fieldset',title:OpenLayers.i18n('Attributes'),layout:'form',collapsible:true,autoHeight:this.autoHeight,autoWidth:this.autoWidth,defaults:this.defaults,defaultType:this.defaultType};if(feature.isLabel){oGroupItems.push({name:'name',fieldLabel:OpenLayers.i18n('name'),id:'name',value:feature.attributes['name']});}
var styles=[];switch(feature.geometry.CLASS_NAME){case"OpenLayers.Geometry.Point":if(feature.isLabel){styles=[["default",OpenLayers.i18n("arial 12"),{fontSize:'12px'}],["arial_16",OpenLayers.i18n("arial 16"),{fontSize:'16px'}],["arial_24",OpenLayers.i18n("arial 24"),{fontSize:'24px'}]];}else{styles=[["default",OpenLayers.i18n("red"),{graphicName:null,fillColor:'red',strokeColor:'red'}],["yellow",OpenLayers.i18n("yellow"),{graphicName:'star',fillColor:'yellow',strokeColor:'black'}]];}
break;case"OpenLayers.Geometry.Polygon":styles=[["default",OpenLayers.i18n("red"),{fillColor:'red',strokeColor:'red'}],["yellow",OpenLayers.i18n("yellow"),{fillColor:'yellow',strokeColor:'yellow'}]];break;case"OpenLayers.Geometry.LineString":styles=[["default",OpenLayers.i18n("red"),{strokeColor:'red',strokeWidth:1}],["yellow",OpenLayers.i18n("yellow"),{strokeColor:'yellow',strokeWidth:1}],["red_2",OpenLayers.i18n("red 2"),{strokeColor:'red',strokeWidth:2}],["yellow_2",OpenLayers.i18n("yellow 2"),{strokeColor:'yellow',strokeWidth:2}]];break;default:alert("unknow");break;}
var styleStore=new Ext.data.SimpleStore({fields:['id','name','style'],data:styles});var styleCombo=new Ext.form.ComboBox({store:styleStore,triggerAction:'all',mode:'local',valueField:'id',displayField:'name',editable:false,fieldLabel:OpenLayers.i18n("style"),value:feature.attributes.__styleid||"default"});styleCombo.on("select",function(combo,record,index){var n=record.get("name");var s=record.get("style");for(var i=0;i<this.features.length;i++){var f=this.features[i];f.style=OpenLayers.Util.extend(f.style,s);f.layer.drawFeature(f);f.attributes.__styleid=n;}},this);oGroupItems.push(styleCombo);oGroup.items=oGroupItems;oItems.push(oGroup);Ext.apply(this,{items:oItems});},initDeleteAction:function(){var actionOptions={handler:this.deleteFeatures,scope:this,tooltip:OpenLayers.i18n('Delete feature')};if(this.useIcons===true){actionOptions.iconCls="gx-featureediting-delete";}else{actionOptions.text=OpenLayers.i18n('Delete');}
this.deleteAction=new Ext.Action(actionOptions);},deleteFeatures:function(){Ext.MessageBox.confirm(OpenLayers.i18n('Delete Feature'),OpenLayers.i18n('Do you really want to delete this feature ?'),function(btn){if(btn=='yes'){for(var i=0;i<this.features.length;i++){var feature=this.features[i];if(feature.popup){feature.popup.close();feature.popup=null;}
feature.layer.destroyFeatures([feature]);}
this.controler.reactivateDrawControl();}},this);},getActions:function(){if(!this.closeAction){this.closeAction=new Ext.Action({handler:function(){this.controler.triggerAutoSave();if(this.controler.popup){this.controler.popup.close();}
this.controler.reactivateDrawControl();},scope:this,text:OpenLayers.i18n('Close')});}
return[this.deleteAction,'->',this.closeAction];},triggerAutoSave:function(){if(this.autoSave){this.save();}},save:function(){var feature;if(this.features&&this.features.length===0){return;}
if(this.features.length!=1){return;}else{feature=this.features[0];}
this.parseFormFieldsToFeatureAttributes(feature);if(feature.isLabel===true){if(feature.attributes[this.labelAttribute]!=""){feature.style.label=feature.attributes[this.labelAttribute];feature.style.graphic=false;feature.style.labelSelect=true;feature.layer.drawFeature(feature);}else{feature.layer.destroyFeatures([feature]);if(this.controler.popup){this.controler.popup.close();this.controler.popup=null;}}}},parseFeatureAttributesToFormFields:function(feature){var aoElements,nElements,fieldSet;fieldSet=this.findById(this.attributeFieldSetId);aoElements=fieldSet.items.items;nElements=aoElements.length;for(var i=0;i<nElements;i++){var oElement=aoElements[i];var szAttribute=oElement.getName();var szValue=null;if(oElement.initialConfig.isfid)
{szValue=feature.fid;}
else
{szValue=feature.attributes[szAttribute];}
oElement.setValue(szValue);}},parseFormFieldsToFeatureAttributes:function(feature){var field,id,value,fieldSet;fieldSet=this.findById(this.attributeFieldSetId);for(var i=0;i<fieldSet.items.length;i++){field=fieldSet.items.get(i);id=field.getName();value=field.getValue();feature.attributes[id]=value;}},onAfterRender:function(){var feature;if(this.features.length!=1){return;}else{feature=this.features[0];}
this.parseFeatureAttributesToFormFields(feature);},beforeDestroy:function(){delete this.feature;}});Ext.reg("gx_featurepanel",GeoExt.ux.form.FeaturePanel);mapfish.PrintProtocol=OpenLayers.Class({config:null,spec:null,params:null,hasOverview:false,geodetic:false,initialize:function(map,config,overrides,dpi,params,geodetic){this.config=config;this.spec={pages:[]};overrides=this.fixOverrides(overrides,map);this.geodetic=(geodetic!=undefined)?geodetic:this.geodetic;this.addMapParams(overrides,map,dpi);this.addOverviewMapParams(overrides,map,dpi);this.params=params;},getAllInOneUrl:function(){var json=new OpenLayers.Format.JSON();var result=this.config.printURL+"?spec="+
json.write(this.encodeForURL(this.spec));if(this.params){result+="&"+OpenLayers.Util.getParameterString(this.params);}
return result;},createPDF:function(success,popup,failure,context){var specTxt=new OpenLayers.Format.JSON().write(this.spec);OpenLayers.Console.info(specTxt);try{var charset="UTF-8";var params=OpenLayers.Util.applyDefaults({url:this.config.createURL},this.params);OpenLayers.Request.POST({url:this.config.createURL,data:specTxt,params:params,headers:{'CONTENT-TYPE':"application/json; charset="+charset},callback:function(request){if(request.status>=200&&request.status<300){var json=new OpenLayers.Format.JSON();var answer=json.read(request.responseText);if(answer&&answer.getURL){this.openPdf(answer,success,popup,context);}else{failure.call(context,request);}}else{failure.call(context,request);}},scope:this});}catch(err){OpenLayers.Console.warn("Cannot request the print service by AJAX. You must set "+"the 'OpenLayers.ProxyHost' variable. Fallback to GET method");window.open(this.getAllInOneUrl());success.call(context,err);}},openPdf:function(answer,success,popup,context){OpenLayers.Console.info(answer.getURL);if(Ext.isIE||Ext.isOpera){popup.call(context,answer);}else{window.location=answer.getURL;success.call(context);}},fixOverrides:function(overrides,map){overrides=OpenLayers.Util.extend({},overrides);var hasOverview=false;var name;for(var i=0;i<map.layers.length;++i){var olLayer=map.layers[i];name=olLayer.name;if(!overrides[name]){overrides[name]={};}else if(overrides[name].overview){hasOverview=true;}}
if(hasOverview){for(name in overrides){var cur=overrides[name];if(!cur.overview){cur.overview=false;}}}
this.hasOverview=hasOverview;return overrides;},addMapParams:function(overrides,map,dpi){var spec=this.spec;spec.dpi=dpi;spec.units=map.baseLayer.units;spec.srs=map.baseLayer.projection.getCode();spec.geodetic=this.geodetic;var layers=spec.layers=[];this.fillLayers(layers,map.layers,overrides,dpi);},addOverviewMapParams:function(overrides,map,dpi){if(!this.hasOverview){var overviewControls=map.getControlsByClass('OpenLayers.Control.OverviewMap');if(overviewControls.length>0){var spec=this.spec;var layers=spec.overviewLayers=[];this.fillLayers(layers,overviewControls[0].layers,overrides,dpi);}}},fillLayers:function(layers,olLayers,overrides,dpi){for(var i=0;i<olLayers.length;++i){var olLayer=olLayers[i];var layerOverrides=OpenLayers.Util.extend({},overrides[olLayer.name]);OpenLayers.Util.extend(layerOverrides,layerOverrides[dpi]);if((olLayer.getVisibility()&&layerOverrides.visibility!==false)||layerOverrides.visibility===true){var type=olLayer.CLASS_NAME;var handler=mapfish.PrintProtocol.SUPPORTED_TYPES[type];if(handler){var layer=handler.call(this,olLayer);if(layer){this.applyOverrides(layer,layerOverrides);if(olLayer.isBaseLayer){layers.unshift(layer);}else{layers.push(layer);}}}else if(!handler){OpenLayers.Console.error("Don't know how to print a layer of type "+type+" ("+olLayer.name+")");}}}},applyOverrides:function(layer,overrides){for(var key in overrides){if(isNaN(parseInt(key))){var value=overrides[key];if(key=='layers'||key=='styles'){value=mapfish.Util.fixArray(value);}
if(key=="visibility"){}else if(layer[key]!=null||key=="overview"){layer[key]=value;}else{layer.customParams[key]=value;}}}},convertLayer:function(olLayer){var url=olLayer.url;if(url instanceof Array){url=url[0];}
return{baseURL:mapfish.Util.relativeToAbsoluteURL(url),opacity:(olLayer.opacity!=null)?olLayer.opacity:1.0,singleTile:olLayer.singleTile,customParams:{}};},convertWMSLayer:function(olLayer){var layer=OpenLayers.Util.extend(this.convertLayer(olLayer),{type:'WMS',layers:mapfish.Util.fixArray(olLayer.params.LAYERS),format:olLayer.params.FORMAT||olLayer.DEFAULT_PARAMS.format,styles:mapfish.Util.fixArray(olLayer.params.STYLES||olLayer.DEFAULT_PARAMS.styles)});for(var paramName in olLayer.params){var paramNameLow=paramName.toLowerCase();if(olLayer.DEFAULT_PARAMS[paramNameLow]==null&&paramNameLow!='layers'&&paramNameLow!='width'&&paramNameLow!='height'&&paramNameLow!='srs'){layer.customParams[paramName]=olLayer.params[paramName];}}
return layer;},convertMapServerLayer:function(olLayer){var layer=OpenLayers.Util.extend(this.convertLayer(olLayer),{type:'MapServer',layers:mapfish.Util.fixArray(olLayer.params.LAYERS||olLayer.params.layers),format:olLayer.params.FORMAT||olLayer.params.format||olLayer.DEFAULT_PARAMS.format});for(var paramName in olLayer.params){var paramNameLow=paramName.toLowerCase();if(olLayer.DEFAULT_PARAMS[paramNameLow]==null&&paramNameLow!='layers'&&paramNameLow!='format'&&paramNameLow!='width'&&paramNameLow!='height'&&paramNameLow!='srs'){layer.customParams[paramName]=olLayer.params[paramName];}}
return layer;},convertTileCacheLayer:function(olLayer){return OpenLayers.Util.extend(this.convertLayer(olLayer),{type:'TileCache',layer:olLayer.layername,maxExtent:olLayer.maxExtent.toArray(),tileSize:[olLayer.tileSize.w,olLayer.tileSize.h],extension:olLayer.extension,resolutions:olLayer.serverResolutions||olLayer.resolutions});},convertOSMLayer:function(olLayer){var layerInfo=this.convertTileCacheLayer(olLayer);layerInfo.type='Osm';layerInfo.baseURL=layerInfo.baseURL.substr(0,layerInfo.baseURL.indexOf("$"));layerInfo.extension="png";return layerInfo;},convertGoogleLayer:function(olLayer){var layerInfo=this.convertTileCacheLayer(olLayer);layerInfo.type='Google';layerInfo.baseURL='http://maps.google.com/maps/api/staticmap';layerInfo.extension="png";layerInfo.format='png32';layerInfo.sensor='false';if(olLayer.type){if(olLayer.type.getName()=='Satellite'){layerInfo.maptype='satellite';}else if(olLayer.type.getName()=='Hybrid'){layerInfo.maptype='hybrid';}else if(olLayer.type.getName()=='Terrain'){layerInfo.maptype='terrain';}else{layerInfo.maptype='roadmap';}}else{layerInfo.maptype='roadmap';}
return layerInfo;},convertTMSLayer:function(olLayer){var layerInfo=this.convertTileCacheLayer(olLayer);layerInfo.type='TMS';layerInfo.baseURL=olLayer.url;layerInfo.format=olLayer.type;return layerInfo;},convertImageLayer:function(olLayer){var url=olLayer.getURL(olLayer.extent);return{type:'Image',baseURL:mapfish.Util.relativeToAbsoluteURL(url),opacity:(olLayer.opacity!=null)?olLayer.opacity:1.0,extent:olLayer.extent.toArray(),pixelSize:[olLayer.size.w,olLayer.size.h],name:olLayer.name};},convertVectorLayer:function(olLayer){var olFeatures=olLayer.features;var features=[];var styles={};var formatter=new OpenLayers.Format.GeoJSON();var nextId=1;for(var i=0;i<olFeatures.length;++i){var feature=olFeatures[i];var style=feature.style||olLayer.style||olLayer.styleMap.createSymbolizer(feature,feature.renderIntent);var styleName;if(style._printId){styleName=style._printId;}else{style._printId=styleName=nextId++;styles[styleName]=style;if(style.externalGraphic){style.externalGraphic=mapfish.Util.relativeToAbsoluteURL(style.externalGraphic);}}
var featureGeoJson=formatter.extract.feature.call(formatter,feature);featureGeoJson.properties=OpenLayers.Util.extend({_style:styleName},featureGeoJson.properties);for(var cur in featureGeoJson.properties){var curVal=featureGeoJson.properties[cur];if(curVal instanceof Object&&!(curVal instanceof String)){delete featureGeoJson.properties[cur];}}
features.push(featureGeoJson);}
for(var key in styles){delete styles[key]._printId;}
var geoJson={"type":"FeatureCollection","features":features};return OpenLayers.Util.extend(this.convertLayer(olLayer),{type:'Vector',styles:styles,styleProperty:'_style',geoJson:geoJson,name:olLayer.name,opacity:(olLayer.opacity!=null)?olLayer.opacity:1.0});},encodeForURL:function(cur){if(cur==null)return null;var type=typeof cur;Ext.type(cur);if(type=='string'){return escape(cur.replace(/[\n]/g,"\\n"));}else if(type=='object'&&cur.constructor==Array){var array=[];for(var i=0;i<cur.length;++i){var val=this.encodeForURL(cur[i]);if(val!=null)array.push(val);}
return array;}else if(type=='object'&&cur.CLASS_NAME&&cur.CLASS_NAME=='OpenLayers.Feature.Vector'){return new OpenLayers.Format.WKT().write(cur);}else if(type=='object'){var hash={};for(var j in cur){var val2=this.encodeForURL(cur[j]);if(val2!=null)hash[j]=val2;}
return hash;}else{return cur;}},CLASS_NAME:"mapfish.PrintProtocol"});mapfish.PrintProtocol.getConfiguration=function(url,success,failure,context,params){try{params=OpenLayers.Util.extend(params,{url:url});OpenLayers.Request.GET({url:url,params:params,callback:function(request){if(request.status>=200&&request.status<300){var json=new OpenLayers.Format.JSON();var answer=json.read(request.responseText);if(answer){success.call(context,answer);}else{failure.call(context,request);}}else{failure.call(context,request);}}});}catch(err){failure.call(context,err);}};mapfish.PrintProtocol.IGNORED=function(){return null;};mapfish.PrintProtocol.SUPPORTED_TYPES={'OpenLayers.Layer':mapfish.PrintProtocol.IGNORED,'OpenLayers.Layer.WMS':mapfish.PrintProtocol.prototype.convertWMSLayer,'OpenLayers.Layer.WMS.Untiled':mapfish.PrintProtocol.prototype.convertWMSLayer,'OpenLayers.Layer.TileCache':mapfish.PrintProtocol.prototype.convertTileCacheLayer,'OpenLayers.Layer.OSM':mapfish.PrintProtocol.prototype.convertOSMLayer,'OpenLayers.Layer.TMS':mapfish.PrintProtocol.prototype.convertTMSLayer,'OpenLayers.Layer.Vector':mapfish.PrintProtocol.prototype.convertVectorLayer,'OpenLayers.Layer.Vector.RootContainer':mapfish.PrintProtocol.prototype.convertVectorLayer,'OpenLayers.Layer.GML':mapfish.PrintProtocol.prototype.convertVectorLayer,'OpenLayers.Layer.PointTrack':mapfish.PrintProtocol.prototype.convertVectorLayer,'OpenLayers.Layer.MapServer':mapfish.PrintProtocol.prototype.convertMapServerLayer,'OpenLayers.Layer.MapServer.Untiled':mapfish.PrintProtocol.prototype.convertMapServerLayer,'OpenLayers.Layer.Image':mapfish.PrintProtocol.prototype.convertImageLayer,'OpenLayers.Layer.Google':mapfish.PrintProtocol.prototype.convertGoogleLayer};mapfish.Util={};mapfish.Util.sum=function(array){for(var i=0,sum=0;i<array.length;sum+=array[i++]);return sum;};mapfish.Util.max=function(array){return Math.max.apply({},array);};mapfish.Util.min=function(array){return Math.min.apply({},array);};mapfish.Util.getIconUrl=function(wmsUrl,options){if(!options.layer){OpenLayers.Console.warn('Missing required layer option in mapfish.Util.getIconUrl');return'';}
if(!options.rule){options.rule=options.layer;}
if(wmsUrl.indexOf("?")<0){wmsUrl+="?";}else if(wmsUrl.lastIndexOf('&')!=(wmsUrl.length-1)){if(wmsUrl.indexOf("?")!=(wmsUrl.length-1)){wmsUrl+="&";}}
var options=OpenLayers.Util.extend({layer:"",rule:"",service:"WMS",version:"1.1.1",request:"GetLegendGraphic",format:"image/png",width:16,height:16},options);options=OpenLayers.Util.upperCaseObject(options);return wmsUrl+OpenLayers.Util.getParameterString(options);};mapfish.Util.arrayEqual=function(a,b){if(a==null||b==null)
return false;if(typeof(a)!='object'||typeof(b)!='object')
return false;if(a.length!=b.length)
return false;for(var i=0;i<a.length;i++){if(typeof(a[i])!=typeof(b[i]))
return false;if(a[i]!=b[i])
return false;}
return true;};mapfish.Util.isIE7=function(){var ua=navigator.userAgent.toLowerCase();return ua.indexOf("msie 7")>-1;};mapfish.Util.relativeToAbsoluteURL=function(source,loc){loc=loc||location;var h,p,re;if(/^\w+:/.test(source)||!source){return source;}
h=loc.protocol+"//"+loc.host;if(source.indexOf("/")==0){return h+source;}
p=loc.pathname.replace(/\/[^\/]*$/,'');p=p+"/"+source;re=/\/[^\/]+\/\.\.\//;while(p.match(re)!==null){p=p.replace(re,'/');}
if(p.indexOf("/../")>-1){return null;}
re=/\/\.\//;while(p.match(re)!==null){p=p.replace(re,'/');}
return h+p;};mapfish.Util.fixArray=function(subs){if(subs==''||subs==null){return[];}else if(subs instanceof Array){return subs;}else{return subs.split(',');}};mapfish.Util.formatURL=function(url){var proxy=mapfish.PROXY_HOST;if(proxy&&(url.indexOf("http")==0)){var str=url;var protocol=str.match(/https?:\/\//)[0].split(':')[0];str=str.slice((protocol+'://').length);var path=undefined;var pathSeparatorIndex=str.indexOf('/');if(pathSeparatorIndex!=-1){path=str.substring(pathSeparatorIndex);str=str.slice(0,pathSeparatorIndex);}
var host_port=str.split(":");var host=host_port[0];var port=host_port.length>1?host_port[1]:undefined;url=protocol+','+host;url+=(port==undefined?'':','+port);url+=(path==undefined?'':path);if(proxy.lastIndexOf('/')!=proxy.length-1){url='/'+url;}
url=proxy+url;}
return url;};Ext.namespace('mapfish.widgets');Ext.namespace('mapfish.widgets.print');mapfish.widgets.print.Base={map:null,overrides:null,configUrl:null,config:null,layerTree:null,grids:null,serviceParams:null,mask:null,printing:false,geodetic:false,initPrint:function(){if(this.overrides==null){this.overrides={};}
if(this.config==null){mapfish.PrintProtocol.getConfiguration(this.configUrl,this.configReceived,this.configFailed,this,this.serviceParams);return true;}else{this.fillComponent();return false;}},configReceived:function(config){this.config=config;if(this.mask){this.mask.hide();}},configFailed:function(){if(this.mask){this.mask.hide();}},print:function(){if(this.mask){this.mask.msg=OpenLayers.Lang.translate('mf.print.generatingPDF');this.mask.show();}
var printCommand=new mapfish.PrintProtocol(this.map,this.config,this.overrides,this.getCurDpi(),this.serviceParams,this.geodetic);if(this.layerTree){this.addLegends(printCommand.spec);}
if(this.grids){this.addGrids(printCommand.spec);}
this.fillSpec(printCommand);this.printing=true;printCommand.createPDF(function(){if(this.mask)this.mask.hide();this.printing=false;},function(request){var onClick='Ext.getCmp(\'printPopup\').destroy();';if(Ext.isOpera){onClick+='window.open(\''+request.getURL+'\', \'_blank\');';}else{onClick+='window.location=\''+request.getURL+'\';';}
var content=OpenLayers.Lang.translate('mf.print.pdfReady')+'<br /><br />'+'<table onclick="'+onClick+'" border="0" cellpadding="0" cellspacing="0" class="x-btn-wrap" align="center">'+'<tbody><tr><td class="x-btn-left"><i>&#160;</i></td>'+'<td class="x-btn-center"><em unselectable="on" class="x-btn x-btn-text">'+Ext.MessageBox.buttonText.ok+'</em></td>'+'<td class="x-btn-right"><i>&#160;</i></td></tr>'+'</tbody></table>';var popup=new Ext.Window({bodyStyle:'padding: 7px;',width:200,id:"printPopup",autoHeight:true,constrain:true,closable:false,title:OpenLayers.Lang.translate('mf.information'),html:content,listeners:{destroy:function(){if(this.mask)this.mask.hide();this.printing=false;},scope:this}});popup.show();},function(request){Ext.Msg.alert(OpenLayers.Lang.translate('mf.error'),OpenLayers.Lang.translate('mf.print.unableToPrint'));if(this.mask)this.mask.hide();this.printing=false;},this);},addGrids:function(spec){var grids=this.grids;if(grids&&typeof grids=="function"){grids=grids();}
if(grids){for(var name in grids){var grid=grids[name];if(!grid){continue;}
spec[name]={};var specData=spec[name].data=[];var specCols=spec[name].columns=[];var columns=grid.getColumnModel();var store=grid.getStore();for(var j=0;j<columns.getColumnCount();++j){if(!columns.isHidden(j)){specCols.push(columns.getDataIndex(j));}}
store.each(function(record){var hash={};for(var key in record.data){var val=record.data[key];if(val!=null){if(val.CLASS_NAME&&val.CLASS_NAME=='OpenLayers.Feature.Vector'){val=new OpenLayers.Format.WKT().write(val);}
hash[key]=val;}}
specData.push(hash);},this);}}},addLegends:function(spec){var legends=spec.legends=[];function addLayer(layerNode){var layerInfo={name:layerNode.attributes.printText||layerNode.attributes.text,icon:mapfish.Util.relativeToAbsoluteURL(layerNode.attributes.icon)};var classesInfo=layerInfo.classes=[];layerNode.eachChild(function(classNode){classesInfo.push({name:classNode.attributes.printText||classNode.attributes.text,icon:mapfish.Util.relativeToAbsoluteURL(classNode.attributes.icon)});},this);legends.push(layerInfo);}
function goDeep(root){root.eachChild(function(node){var attr=node.attributes;if(attr.checked&&attr.layerNames&&!attr.hidden&&attr.printText!==''){addLayer(node);}else{goDeep(node);}},this);}
goDeep(this.layerTree.getRootNode());if(legends.length==0){delete spec.legends;}},fillSpec:null,getCurDpi:null};Ext.namespace('mapfish.widgets');Ext.namespace('mapfish.widgets.print');mapfish.widgets.print.BaseWidget=function(options){mapfish.widgets.print.BaseWidget.superclass.constructor.call(this,options);};Ext.extend(mapfish.widgets.print.BaseWidget,Ext.Panel,{pageDrag:null,rotateHandle:null,layer:null,styleMap:null,layout:'fit',initComponent:function(){mapfish.widgets.print.BaseWidget.superclass.initComponent.call(this);this.addEvents("configloaded");this.on('expand',this.setUp,this);this.on('collapse',this.tearDown,this);this.on('activate',this.setUp,this);this.on('deactivate',this.tearDown,this);this.on('enable',this.setUp,this);this.on('disable',this.tearDown,this);this.on('destroy',this.tearDown,this);this.on('render',function(){var mask=this.mask=new Ext.LoadMask(this.body,{msg:OpenLayers.Lang.translate('mf.print.loadingConfig')});if(this.config==null){mask.show();}},this);if(!this.initPrint()){this.fillComponent();}},configReceived:function(config){mapfish.widgets.print.Base.configReceived.call(this,config);this.fillComponent();this.doLayout();this.setUp();this.fireEvent("configloaded");},configFailed:function(){mapfish.widgets.print.Base.configFailed.call(this);this.add({border:false,region:'center',html:OpenLayers.Lang.translate('mf.print.serverDown')});this.doLayout();this.config=false;},isReallyVisible:function(){if(!this.isVisible()||!this.body.isVisible(true))return false;var result=true;this.bubble(function(component){return result=result&&component.isVisible()&&(!component.body||component.body.isVisible());},this);return result;},setUp:function(){if(!this.disabled&&this.isReallyVisible()&&this.config&&!this.layer){this.map.addLayer(this.getOrCreateLayer());this.pageDrag.activate();}},tearDown:function(){if(this.config&&this.pageDrag&&this.layer){this.pageDrag.destroy();this.pageDrag=null;this.removeRotateHandle();this.layer.removeFeatures(this.layer.features);this.layer.destroy();this.layer=null;}},getOrCreateLayer:function(){if(!this.layer){var self=this;this.layer=new OpenLayers.Layer.Vector("_Print"+this.getId(),{displayInLayerSwitcher:false,styleMap:this.styleMap,calculateInRange:function(){return true;}});this.pageDrag=new OpenLayers.Control.DragFeature(this.layer);this.map.addControl(this.pageDrag);var curFeature=null;this.pageDrag.onStart=function(feature){OpenLayers.Control.DragFeature.prototype.onStart.apply(this,arguments);curFeature=feature;if(feature.attributes.rotate){self.pageRotateStart(feature);}else{self.pageDragStart(feature);}};this.pageDrag.onDrag=function(feature){OpenLayers.Control.DragFeature.prototype.onDrag.apply(this,arguments);if(!feature)feature=curFeature;if(feature.attributes.rotate){self.pageRotated(feature);}};this.pageDrag.onComplete=function(feature){OpenLayers.Control.DragFeature.prototype.onComplete.apply(this,arguments);if(!feature)feature=curFeature;if(feature.attributes.rotate){self.pageRotateComplete(feature);}else{self.pageDragComplete(feature);}
curFeature=null;};this.afterLayerCreated();}
return this.layer;},pageRotateStart:function(feature){},pageRotated:function(feature){var center=feature.attributes.center;var pos=feature.geometry;var angle=Math.atan2(pos.x-center.x,pos.y-center.y)*180/Math.PI;var page=feature.attributes.page;page.attributes.rotation=angle;var centerPoint=new OpenLayers.Geometry.Point(center.x,center.y);page.geometry.rotate(feature.attributes.prevAngle-angle,centerPoint);this.layer.drawFeature(page);this.setCurRotation(Math.round(angle));feature.attributes.prevAngle=angle;},pageRotateComplete:function(feature){this.createRotateHandle(feature.attributes.page);},pageDragStart:function(feature){this.removeRotateHandle();},removeRotateHandle:function(){if(this.rotateHandle){this.rotateHandle.destroy();this.rotateHandle=null;}},pageDragComplete:function(feature){if(this.getCurLayout().rotation){this.createRotateHandle(feature);}},createRotateHandle:function(feature){this.removeRotateHandle();var firstPoint=feature.geometry.components[0].components[2];var secondPoint=feature.geometry.components[0].components[3];var lon=(firstPoint.x+secondPoint.x)/2;var lat=(firstPoint.y+secondPoint.y)/2;var rotatePoint=new OpenLayers.Geometry.Point(lon,lat);var center=this.getCenterRectangle(feature);this.rotateHandle=new OpenLayers.Feature.Vector(rotatePoint,{rotate:true,page:feature,center:{x:center[0],y:center[1]},prevAngle:feature.attributes.rotation});this.layer.addFeatures(this.rotateHandle);},createRectangle:function(center,scale,layout,rotation){var extent=this.getExtent(center,scale,layout);var rect=extent.toGeometry();if(rotation!=0.0){var centerPoint=new OpenLayers.Geometry.Point(center.lon,center.lat);rect.rotate(-rotation,centerPoint);}
var feature=new OpenLayers.Feature.Vector(rect,{rotation:rotation});this.layer.addFeatures(feature);return feature;},getCenterRectangle:function(rectangle){var center=rectangle.geometry.getBounds().getCenterLonLat();return[center.lon,center.lat];},getExtent:function(center,scale,layout){var unitsRatio=OpenLayers.INCHES_PER_UNIT[this.map.baseLayer.units];var w=layout.map.width/72.0/unitsRatio*scale/2.0;var h=layout.map.height/72.0/unitsRatio*scale/2.0;var proj=this.map.getProjectionObject();if(this.geodetic&&(proj.projCode!='EPGS:4326')){var wgs84=new OpenLayers.Projection('EPSG:4326');var wgs84center=center.clone().transform(proj,wgs84);var dest=OpenLayers.Util.destinationVincenty;var wp1=dest(wgs84center,90,w);var wp2=dest(wgs84center,270,w);var hp1=dest(wgs84center,0,h);var hp2=dest(wgs84center,180,h);var p=OpenLayers.Geometry.Point;var bounds=new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([new p(wp1.lon,wp1.lat),new p(hp2.lon,hp2.lat),new p(wp2.lon,wp2.lat),new p(hp1.lon,hp1.lat)])]).getBounds();return bounds.transform(wgs84,proj);}
return new OpenLayers.Bounds(center.lon-w,center.lat-h,center.lon+w,center.lat+h);},fitScale:function(layout){var availsTxt=this.config.scales;if(availsTxt.length==0)return;var avails=[];for(var i=0;i<availsTxt.length;++i){avails.push(parseFloat(availsTxt[i].value));}
avails.sort(function(a,b){return a-b;});var bounds=this.map.getExtent();var unitsRatio=OpenLayers.INCHES_PER_UNIT[this.map.baseLayer.units];var size=layout.map;var targetScale=Math.min(bounds.getWidth()/size.width*72.0*unitsRatio,bounds.getHeight()/size.height*72.0*unitsRatio);var nearestScale=avails[0];for(var j=1;j<avails.length;++j){if(avails[j]<=targetScale){nearestScale=avails[j];}else{break;}}
return nearestScale;},print:function(){this.overrides[this.layer.name]={visibility:false};mapfish.widgets.print.Base.print.call(this);delete this.overrides[this.layer.name];},getLayoutForName:function(layoutName){var layouts=this.config.layouts;for(var i=0;i<layouts.length;++i){var cur=layouts[i];if(cur.name==layoutName){return cur;}}},createScaleCombo:function(){var scaleStore=new Ext.data.JsonStore({root:"scales",fields:['name','value'],data:this.config});return new Ext.form.ComboBox({fieldLabel:OpenLayers.Lang.translate('mf.print.scale'),store:scaleStore,displayField:'name',valueField:'value',typeAhead:false,mode:'local',id:'scale_'+this.getId(),hiddenId:'scaleId_'+this.getId(),hiddenName:"scale",name:"scale",editable:false,triggerAction:'all',value:this.config.scales[this.config.scales.length-1].value});},createDpiCombo:function(name){if(this.config.dpis.length>1){var dpiStore=new Ext.data.JsonStore({root:"dpis",fields:['name','value'],data:this.config});return{fieldLabel:OpenLayers.Lang.translate('mf.print.dpi'),xtype:'combo',store:dpiStore,displayField:'name',valueField:'value',typeAhead:false,mode:'local',id:'dpi_'+this.getId(),hiddenId:'dpiId_'+this.getId(),hiddenName:name,name:name,editable:false,triggerAction:'all',value:this.config.dpis[0].value};}else{return{xtype:'hidden',name:name,value:this.config.dpis[0].value};}},createLayoutCombo:function(name){if(this.config.layouts.length>1){var layoutStore=new Ext.data.JsonStore({root:"layouts",fields:['name'],data:this.config});return new Ext.form.ComboBox({fieldLabel:OpenLayers.Lang.translate('mf.print.layout'),store:layoutStore,displayField:'name',valueField:'name',typeAhead:false,mode:'local',id:'layout_'+this.getId(),hiddenId:'layoutId_'+this.getId(),hiddenName:name,name:name,editable:false,triggerAction:'all',value:this.config.layouts[0].name});}else{return new Ext.form.Hidden({name:name,value:this.config.layouts[0].name});}},createRotationTextField:function(){var layouts=this.config.layouts;var hasRotation=false;for(var i=0;i<layouts.length&&!hasRotation;++i){hasRotation=layouts[i].rotation;}
if(hasRotation){var num=/^-?[0-9]+$/;return new Ext.form.TextField({fieldLabel:OpenLayers.Lang.translate('mf.print.rotation'),name:'rotation',value:'0',maskRe:/^[-0-9]$/,msgTarget:'side',validator:function(v){return num.test(v)?true:"Not a number";}});}else{return null;}},fillComponent:null,afterLayerCreated:null,fillSpec:null,getCurLayout:null,setCurRotation:null});OpenLayers.Util.applyDefaults(mapfish.widgets.print.BaseWidget.prototype,mapfish.widgets.print.Base);Ext.namespace('mapfish.widgets');Ext.namespace('mapfish.widgets.print');mapfish.widgets.print.SimpleForm=Ext.extend(mapfish.widgets.print.BaseWidget,{formConfig:null,wantResetButton:true,scale:null,rectangle:null,rotation:null,infoPanel:null,fillComponent:function(){var formConfig=OpenLayers.Util.extend({border:false,bodyBorder:false},this.formConfig);var formPanel=this.formPanel=new Ext.form.FormPanel(formConfig);var layout=this.createLayoutCombo("/layout");if(this.config.layouts.length>1){layout.on('select',this.updateRectangle,this);}
formPanel.add(layout);formPanel.add(this.createDpiCombo("/dpi"));this.scale=formPanel.add(this.createScaleCombo());this.scale.on('select',this.updateRectangle,this);this.rotation=this.createRotationTextField();if(this.rotation!=null){this.rotation.setDisabled(!this.config.layouts[0].rotation);formPanel.add(this.rotation);this.rotation.on('change',function(){if(!this.rotation.isValid(true)){this.rotation.setValue(0);}
this.updateRectangle();},this);}
if(this.infoPanel!=null){formPanel.add(this.infoPanel);}
if(this.wantResetButton){formPanel.addButton({text:OpenLayers.Lang.translate('mf.print.resetPos'),scope:this,handler:function(){this.setCurScale(this.fitScale(this.getCurLayout()));if(this.rotation){this.setCurRotation(0);}
this.createTheRectangle();}});}
formPanel.addButton({text:OpenLayers.Lang.translate('mf.print.print'),scope:this,handler:this.print});this.add(formPanel);},updateRectangle:function(){this.layer.removeFeatures(this.rectangle);var center=this.rectangle.geometry.getBounds().getCenterLonLat();var layout=this.getCurLayout();this.rectangle=this.createRectangle(center,this.getCurScale(),layout,this.rotation&&layout.rotation?this.rotation.getValue():0);if(this.rotation){this.rotation.setDisabled(!layout.rotation);if(!layout.rotation){this.rotation.setValue(0);}}
if(layout.rotation){this.createRotateHandle(this.rectangle);}else{this.removeRotateHandle();}},createTheRectangle:function(){if(this.rectangle)this.layer.removeFeatures(this.rectangle);var layout=this.getCurLayout();this.rectangle=this.createRectangle(this.map.getCenter(),this.getCurScale(),this.getCurLayout(),this.rotation&&layout.rotation?this.rotation.getValue():0);if(layout.rotation){this.createRotateHandle(this.rectangle);}},afterLayerCreated:function(){this.setCurScale(this.fitScale(this.getCurLayout()));this.createTheRectangle();},getCurLayout:function(){var values=this.formPanel.getForm().getValues();var layoutName=values['/layout'];return this.getLayoutForName(layoutName);},getCurScale:function(){var values=this.formPanel.getForm().getValues();return values['scale'];},setCurScale:function(value){this.scale.setValue(value);},getCurDpi:function(){var values=this.formPanel.getForm().getValues();return values["dpi"];},setCurRotation:function(rotation){this.rotation.setValue(rotation);},fillSpec:function(printCommand){var singlePage={center:this.getCenterRectangle(this.rectangle)};var params=printCommand.spec;params.pages.push(singlePage);this.formPanel.getForm().items.each(function(cur){var name=cur.getName();if(OpenLayers.String.startsWith(name,"/")){params[name.substr(1)]=cur.getValue();}else{singlePage[name]=cur.getValue();}},this);}});Ext.reg('print-simple',mapfish.widgets.print.SimpleForm);Ext.namespace("GeoExt.tree");GeoExt.tree.LayerContainer=Ext.extend(Ext.tree.AsyncTreeNode,{text:'Layers',constructor:function(config){config=Ext.applyIf(config||{},{text:this.text});this.loader=config.loader instanceof GeoExt.tree.LayerLoader?config.loader:new GeoExt.tree.LayerLoader(Ext.applyIf(config.loader||{},{store:config.layerStore}));GeoExt.tree.LayerContainer.superclass.constructor.call(this,config);},recordIndexToNodeIndex:function(index){var store=this.loader.store;var count=store.getCount();var nodeCount=this.childNodes.length;var nodeIndex=-1;for(var i=count-1;i>=0;--i){if(this.loader.filter(store.getAt(i))===true){++nodeIndex;if(index===i||nodeIndex>nodeCount-1){break;}}}
return nodeIndex;},destroy:function(){delete this.layerStore;GeoExt.tree.LayerContainer.superclass.destroy.apply(this,arguments);}});Ext.tree.TreePanel.nodeTypes.gx_layercontainer=GeoExt.tree.LayerContainer;Ext.namespace("GeoExt.plugins");GeoExt.plugins.TreeNodeActions=Ext.extend(Ext.util.Observable,{actionsCls:"gx-tree-layer-actions",actionCls:"gx-tree-layer-action",constructor:function(config){Ext.apply(this.initialConfig,Ext.apply({},config));Ext.apply(this,config);this.addEvents("action");GeoExt.plugins.TreeNodeActions.superclass.constructor.apply(this,arguments);},init:function(tree){tree.on({"rendernode":this.onRenderNode,"rawclicknode":this.onRawClickNode,"beforedestroy":this.onBeforeDestroy,scope:this});},onRenderNode:function(node){var rendered=node.rendered;if(!rendered){var attr=node.attributes;var actions=attr.actions||this.actions;if(actions&&actions.length>0){var html=['<div class="',this.actionsCls,'">'];for(var i=0,len=actions.length;i<len;i++){var a=actions[i];html=html.concat(['<img id="'+node.id+'_'+a.action,'" ext:qtip="'+a.qtip,'" src="'+Ext.BLANK_IMAGE_URL,'" class="'+this.actionCls+' '+a.action+'" />']);}
html.concat(['</div>']);Ext.DomHelper.insertFirst(node.ui.elNode,html.join(""));}
if(node.layer.map){this.updateActions(node);}else if(node.layerStore){node.layerStore.on({'bind':function(){this.updateActions(node);},scope:this});}}},updateActions:function(node){var actions=node.attributes.actions||this.actions||[];Ext.each(actions,function(a,index){var el=Ext.get(node.id+'_'+a.action);if(el&&typeof a.update=="function"){a.update.call(node,el);}});},onRawClickNode:function(node,e){if(e.getTarget('.'+this.actionCls,1)){var t=e.getTarget('.'+this.actionCls,1);var action=t.className.replace(this.actionCls+' ','');this.fireEvent("action",node,action,e);return false;}},onBeforeDestroy:function(tree){tree.un("rendernode",this.onRenderNode,this);tree.un("rawclicknode",this.onRawClickNode,this);tree.un("beforedestroy",this.onBeforeDestroy,this);}});Ext.preg("gx_treenodeactions",GeoExt.plugins.TreeNodeActions);Ext.namespace("GeoExt.plugins");GeoExt.plugins.TreeNodeComponent=Ext.extend(Ext.util.Observable,{constructor:function(config){Ext.apply(this.initialConfig,Ext.apply({},config));Ext.apply(this,config);GeoExt.plugins.TreeNodeComponent.superclass.constructor.apply(this,arguments);},init:function(tree){tree.on({"rendernode":this.onRenderNode,"beforedestroy":this.onBeforeDestroy,scope:this});},onRenderNode:function(node){var rendered=node.rendered;var attr=node.attributes;var component=attr.component||this.component;if(!rendered&&component){var elt=Ext.DomHelper.append(node.ui.elNode,[{"tag":"div"}]);if(typeof component=="function"){component=component(node,elt);}else if(typeof component=="object"&&typeof component.fn=="function"){component=component.fn.apply(component.scope,[node,elt]);}
if(typeof component=="object"&&typeof component.xtype=="string"){component=Ext.ComponentMgr.create(component);}
if(component instanceof Ext.Component){component.render(elt);node.component=component;}}},onBeforeDestroy:function(tree){tree.un("rendernode",this.onRenderNode,this);tree.un("beforedestroy",this.onBeforeDestroy,this);}});Ext.preg("gx_treenodecomponent",GeoExt.plugins.TreeNodeComponent);Ext.namespace("geoadmin");geoadmin.API=OpenLayers.Class(cdbund.API,{printPanel:{},linkPanel:{},mesureControls:null,inspireCatalogPanel:{},myMapsPanel:null,layers:{},bgLayer:'',bgSwitchLayers:{},permalinkLayers:[],permalinkLayersIndices:[],permalinkLayersOpacity:[],permalinkLayersVisibility:[],noHeader:'false',showLocation:'false',crosshair:'false',recenterUrl:'bodfeature/bbox',highlightUrl:'bodfeature/geometry',locationLabel:null,showLocationRequestOngoing:false,showLocationInMapRequestOngoing:false,clientX:null,clientY:null,navControl:null,mousePosition:null,elevation:null,bgLayerCombo:null,aerial:null,featuresToShow:null,featuresShown:null,lang:null,initialize:function(config){OpenLayers.IMAGE_RELOAD_ATTEMPTS=5;cdbund.API.prototype.initialize.apply(this,arguments);OpenLayers.ImgPath=this.baseConfig.baseUrl+'gfx/ol/';Ext.BLANK_IMAGE_URL=this.baseConfig.baseUrl+'mfbase/ext/resources/images/default/s.gif';Ext.QuickTips.init();this.layers=(new geoadmin.Layers()).layers;if(this.isMainApp){this.initInspireCatalogPanel();this.initMyMapsPanel();}
Ext.namespace("geoadmin");geoadmin.routingText="";},createMap:function(config){if(config){if(config.layers){var reg=new RegExp("( )","g");config.layers=config.layers.replace(reg,'');this.permalinkLayers=config.layers.split(',');}else if(typeof geoadmin.startLayers!='undefined'){this.permalinkLayers=geoadmin.startLayers.split(',');}
if(config.layers_indices){this.permalinkLayersIndices=config.layers_indices.split(',');}
if(config.layers_opacity){this.permalinkLayersOpacity=config.layers_opacity.split(',');}
if(config.layers_visibility){this.permalinkLayersVisibility=config.layers_visibility.split(',');}
if(config.bgLayer){this.bgLayer=config.bgLayer;}
if(typeof config.bgOpacity!='undefined'){this.mapOpacityValue=parseInt(config.bgOpacity);}else{if(typeof geoadmin.bgOpacity!='undefined'){this.mapOpacityValue=parseInt(geoadmin.bgOpacity);}}}
var args=OpenLayers.Util.getParameters();if(!this.bgLayer){if(args.bgLayer){this.bgLayer=args.bgLayer;}else if(typeof geoadmin.bgLayer!='undefined'){this.bgLayer=geoadmin.bgLayer;}}
this.map=cdbund.API.prototype.createMap.apply(this,arguments);if(typeof geoadmin.startX!='undefined'&&typeof geoadmin.startY!='undefined'&&typeof geoadmin.startZoom!='undefined')
{var x;if(typeof args.X=='undefined'){x=geoadmin.startX;}else{x=args.X;}
var y;if(typeof args.Y=='undefined'){y=geoadmin.startY;}else{y=args.Y;}
var zoom;if(typeof args.zoom=='undefined'){zoom=geoadmin.startZoom;}else{zoom=args.zoom;}
this.map.setCenter(new OpenLayers.LonLat(y,x),zoom);}
this.map.events.on({'changelayer':function(evt){if(evt.layer.bodid=='addresses'||evt.layer.bodid=='parcels'||evt.layer.bodid=='asta_flik_parcels')
{if(this.featuresShown){this.getDrawingLayer().destroyFeatures();this.featuresShown=false;}}},scope:this});this.map.events.on({'removelayer':function(evt){if(evt.layer.bodid=='addresses'||evt.layer.bodid=='parcels'||evt.layer.bodid=='asta_flik_parcels')
{if(this.featuresShown){this.getDrawingLayer().destroyFeatures();this.featuresShown=false;}}},scope:this});if(!this.isMainApp){this.handleMapOpacity();}
if(this.permalinkLayers.length>0){this.checkPermalinkLayersExclusions();for(var i=0,len=this.permalinkLayers.length;i<len;i++){this.addLayerToMap(this.permalinkLayers[i]);}
this.orderLayers();this.setLayersOpacity();this.setLayersVisibility();}
if(this.featuresToShow){this.showFeatures(this.featuresToShow.layer,this.featuresToShow.ids);this.addLayerToMap(this.featuresToShow.layer);}
var zoomToMaxExtent=new OpenLayers.Control.ZoomToMaxExtent({title:OpenLayers.i18n('Zoom to the max extent')});var panel=new OpenLayers.Control.Panel({defaultControl:zoomToMaxExtent});panel.addControls([zoomToMaxExtent]);this.map.addControl(panel);if(this.isMainApp){var tooltips=new geoadmin.TooltipFeature({api:this,map:this.map});tooltips.activate();this.map.addControl(tooltips);if(this.showLocationInMap=='true'){this.createLocationTooltip();}
this.map.events.on({'addlayer':this.updateLayersZIndex,scope:this});}
if(this.crosshair=='lion'){this.showMarker({iconPath:'gfx/lion.png',fillOpacity:0.9,graphicHeight:25,graphicWidth:25});}else if(this.crosshair=='dot'){this.showMarker({iconPath:'gfx/dot.png',fillOpacity:0.9,graphicHeight:20,graphicWidth:20});}else if(this.crosshair=='target'||this.crosshair=='true'){this.showMarker({iconPath:'gfx/target.png',fillOpacity:0.9,graphicHeight:50,graphicWidth:50});}
var myStyles=new OpenLayers.StyleMap({"default":new OpenLayers.Style({pointRadius:"10",fillColor:"#FFFF00",fillOpacity:0.8,strokeColor:"#FF8000",strokeOpacity:0.8,strokeWidth:3})});this.drawLayer.styleMap=myStyles;if(this.isMainApp){this.myMapsPanel.olMap=this.map;}
return this.map;},createToolbar:function(config){config=Ext.apply({items:['MapOpacity','NavigationHistory','Searchbox','Permalink','Print']},config);var items=[],action;if(config.items.indexOf('MapOpacity')!=-1){items.push('<span class="mapopacityslider">'+OpenLayers.i18n('Aerial Images')+'</span> ');items.push(this.createMapOpacitySlider({width:100}));this.mapOpacitySlider.on('change',this.checkBgOpacityForLayerExclusion,this);items.push(this.createBgLayerCombo());}
if(config.items.indexOf('NavigationHistory')!=-1){var history=new OpenLayers.Control.NavigationHistory(config.controls);history.activate();this.map.addControl(history);action=new GeoExt.Action(Ext.apply({tooltip:OpenLayers.i18n("previous"),control:history.previous,iconCls:'previous',disabled:true},config.actions));items.push(action);action=new GeoExt.Action(Ext.apply({tooltip:OpenLayers.i18n("next"),control:history.next,iconCls:'next',disabled:true},config.actions));items.push(action);}
if(config.items.indexOf('Searchbox')!=-1){items.push(this.createSearchBox({ref:'geoadmin',width:250}));}
if(this.isMainApp&&api.showLocation=='true'){items.push(this.createLocationLabel());}
items.push('->');if(this.isMainApp&&config.items.indexOf('Permalink')!=-1){this.initLinkPanel();var permalink=new geoadmin.API.Permalink('permalink',null,{api:this});permalink.activate();this.map.addControl(permalink);var handler=function(){var lc=Ext.get('linkContainer');if(!lc.isVisible()){var pc=Ext.get('printContainer');if(pc.isVisible()){pc.hide();this.printPanel.disable();this.drawLayer.setZIndex(this.map.Z_INDEX_BASE['Feature']);}
Ext.get('redliningContainer').hide();this.deactivateRedlining();Ext.get('measureContainer').hide();this.deactivateMeasure();lc.show();this.linkPanel.enable();this.linkPanel.doLayout();}else{lc.hide();this.linkPanel.disable();}};action=new Ext.Action({text:OpenLayers.i18n('permalink action'),enableToggle:true,toggleGroup:'export',handler:handler.createDelegate(this)});items.push(action);}
if(this.isMainApp){this.initMeasurePanel();action=new Ext.Action({text:OpenLayers.i18n('measure.text.button'),enableToggle:true,toggleGroup:'export',handler:function(){var mc=Ext.get('measureContainer');if(mc.isVisible()){mc.hide();this.deactivateMeasure();}else{this.deactivateRedlining();Ext.get('redliningContainer').hide();Ext.get('linkContainer').hide();this.printPanel.disable();this.drawLayer.setZIndex(this.map.Z_INDEX_BASE['Feature']);Ext.get('printContainer').hide();mc.show();}},scope:this});items.push(action);if(this.isMainApp&&config.items.indexOf('Print')!=-1){this.initPrintPanel();var handler=function(){var pc=Ext.get('printContainer');if(!pc.isVisible()){Ext.get('linkContainer').hide();Ext.get('measureContainer').hide();this.deactivateMeasure();Ext.get('redliningContainer').hide();this.deactivateRedlining();pc.show();this.printPanel.enable();this.printPanel.doLayout();}else{pc.hide();this.printPanel.disable();this.drawLayer.setZIndex(this.map.Z_INDEX_BASE['Feature']);}};action=new Ext.Action({text:OpenLayers.i18n('print action'),enableToggle:true,toggleGroup:'export',handler:handler.createDelegate(this)});items.push(action);}
this.initRedliningPanel();var handler=function(){var rc=Ext.get('redliningContainer');if(rc.isVisible()){rc.hide();this.deactivateRedlining();}else{this.deactivateMeasure();Ext.get('measureContainer').hide();Ext.get('linkContainer').hide();this.printPanel.disable();this.drawLayer.setZIndex(this.map.Z_INDEX_BASE['Feature']);Ext.get('printContainer').hide();rc.show();this.redliningPanel.enable();this.redliningPanel.doLayout();}};action=new Ext.Action({text:OpenLayers.i18n('redlining action'),enableToggle:true,toggleGroup:'export',handler:handler.createDelegate(this)});items.push(action);}
return items;},createBbar:function(config){var items=[];items.push(' ');items.push(new GeoExt.ux.ScaleSelectorCombo({map:this.map,fakeScaleValue:["1500","3000","6000","15000","30000","60000","150000","300000","450000","700000","1500000"],width:100}));items.push('  ');items.push(new GeoExt.ux.DisplayProjectionSelectorCombo({map:this.map,controls:[this.mousePosition],projections:['EPSG:2169','EPSG:4326','EPSG:32631-2'],width:170}));items.push('  ');items.push(Ext.getDom('mousepos'));items.push(Ext.getDom('elevation'));items.push(Ext.getDom('azimut'));items.push('->');items.push('<a href="http://www.geoportail.lu/" target="_blank">Geoportail</a>');return items;},createSearchBox:function(config){config=config||{};var store=new Ext.data.JsonStore({proxy:new Ext.data.HttpProxy({url:'locationsearch',method:'GET'}),baseParams:{lang:OpenLayers.Lang.getCode(),ref:config.ref||''},root:'results',fields:['label','listlabel','type','bbox','id']});var tpl=new Ext.XTemplate('<tpl for="."><div class="x-combo-list-item">','{listlabel}','</div></tpl>');var searchConfig={store:store,tpl:tpl,hideTrigger:false,minChars:1,queryDelay:50,emptyText:OpenLayers.i18n('Geo search...'),loadingText:OpenLayers.i18n('loadingText'),displayField:'label',cls:'cbSearchCls',ctCls:'cbSearchContainerCls',width:config.width||200,listWidth:320,selectOnFocus:true,triggerClass:'loupe',listeners:{render:function(){this.el.set({qtip:OpenLayers.i18n('searchQuicktip'),qwidth:400});this.validate();this.el.set({qtip:OpenLayers.i18n('searchQuicktip')});}}};if(config.renderTo){searchConfig['renderTo']=config.renderTo;}
var search=new Ext.form.ComboBox(searchConfig);Ext.apply(Ext.QuickTips.getQuickTip(),{showDelay:50,dismissDelay:10000,trackMouse:true});search.on('beforequery',function(queryEvent){var query=queryEvent.query;var coord_re=/([\d\.']+)[\s,]+([\d\.']+)/;var match=query.match(coord_re);if(match){var left=parseFloat(match[1].replace("'",""));var right=parseFloat(match[2].replace("'",""));var position=new OpenLayers.LonLat(left,right);var valid=false;if(this.map.maxExtent.containsLonLat(position)){valid=true;}else{position.transform(new OpenLayers.Projection("EPSG:4326"),this.map.getProjectionObject());if(this.map.maxExtent.containsLonLat(position)){valid=true;}}
if(valid){this.map.setCenter(position,9);this.getDrawingLayer().destroyFeatures();this.showMarker();return false;}}
return true;},this);search.on('select',function(combo,record,index){this.map.zoomToExtent(OpenLayers.Bounds.fromArray(record.get('bbox')));if(record.data.type=='Adresse'||record.data.type=='Parcelle'||record.data.type=='hydro'||record.data.type=='hydro_km'||record.data.type=='FLIK'){var layers=new Array();switch(record.data.type){case'Adresse':layers.push('addresses');break;case'Parcelle':layers.push('parcels');break;case'FLIK':layers.push('asta_flik_parcels');break;case'hydro_km':layers.push('wg_kilometrierung_hauptgewasser');layers.push('wg_kilometrierung_nebengewasser');break;}
for(var i=0,l=layers.length;i<l;i++)
{this.addLayerToMap(layers[i]);}
if(this.featuresShown){this.getDrawingLayer().destroyFeatures();this.featuresShown=false;}
if(record.data.type=='Parcelle'){if(this.layers['parcels']==undefined){return;}}
if(record.data.type=='FLIK'){if(this.layers['asta_flik_parcels']==undefined){return;}}
this.showFeatures('locations',[record.data.id]);}},this);return search;},createLocationLabel:function(){this.locationLabel=new Ext.form.Label({id:'locationLabel',text:' ',cls:'location-label'});this.map.events.register('mousemove',this,this.updateLocationLabel);return this.locationLabel;},createLocationTooltip:function(){this.map.events.register('mousemove',this,this.showLocationTooltip);this.map.events.register('mouseout',this,this.hideMouseOver);},showLocationTooltip:function(evt){if(this.showLocationInMapRequestOngoing){return;}
var updateTooltip=function(response){var x=Ext.decode(response.responseText)
var text="";var firstDone=false;for(i=0;i<x.features.length;i++){if(firstDone){text=text+" - ";}
if(x.features[i].origin=='zipcode'){if(x.features[i].plz!='0'&&x.features[i].plz!=''){text=text+x.features[i].plz;firstDone=true;}}
if(x.features[i].origin=='kantone'){text=text+x.features[i].name;firstDone=true;}
if(x.features[i].origin=='gg25'){text=text+x.features[i].gemname;firstDone=true;}
if(x.features[i].origin=='sn25'){text=text+x.features[i].name;firstDone=true;}}
var mouseOver=Ext.get('MouseOver').dom;if(text.length>0){mouseOver.innerHTML=text;var topPixel=this.clientY+10;var leftPixel=this.clientX+10;mouseOver.style.top=topPixel+"px";mouseOver.style.left=leftPixel+"px";mouseOver.style.display="block";}else{mouseOver.innerHTML="";mouseOver.style.top="0px";mouseOver.style.left="0px";mouseOver.style.display="none";}
this.showLocationInMapRequestOngoing=false;};var lonLat=this.map.getLonLatFromPixel(evt.xy);this.clientX=evt.clientX;this.clientY=evt.clientY;Ext.Ajax.request({url:this.baseConfig.baseUrl+'swisssearch/geocoding',success:updateTooltip,failure:function(){this.showLocationInMapRequestOngoing=false},method:'GET',params:{easting:lonLat.lon,northing:lonLat.lat,ref:'geoadmin'},scope:this});this.showLocationInMapRequestOngoing=true;},hideMouseOver:function(evt){var mouseOver=Ext.get('MouseOver').dom;mouseOver.innerHTML="";mouseOver.style.top="0px";mouseOver.style.left="0px";mouseOver.style.display="none";},updateLocationLabel:function(evt){if(this.showLocationRequestOngoing){return;}
var updateLabel=function(response){var x=Ext.decode(response.responseText)
var text="";var firstDone=false;for(i=0;i<x.features.length;i++){if(firstDone){text=text+" - ";}
if(x.features[i].origin=='zipcode'){if(x.features[i].plz!='0'&&x.features[i].plz!=''){text=text+x.features[i].plz;firstDone=true;}}
if(x.features[i].origin=='kantone'){text=text+x.features[i].name;firstDone=true;}
if(x.features[i].origin=='gg25'){text=text+x.features[i].gemname;firstDone=true;}
if(x.features[i].origin=='sn25'){text=text+x.features[i].name;firstDone=true;}}
Ext.getCmp('locationLabel').setText(text);this.showLocationRequestOngoing=false;};var lonLat=this.map.getLonLatFromPixel(evt.xy);Ext.Ajax.request({url:'swisssearch/geocoding',success:updateLabel,failure:function(){this.showLocationRequestOngoing=false},method:'GET',params:{easting:lonLat.lon,northing:lonLat.lat,ref:'geoadmin'},scope:this});this.showLocationRequestOngoing=true;},resizeCatalogTreePanel:function(height){var layerManager=Ext.getCmp('layermanager');layerManager.setHeight(height-180);},createLayerTree:function(config){config=config||{};if(config.div){alert('layertree is not available in external mode');return null;}
var actionsPlugin=new GeoExt.plugins.TreeNodeActions({listeners:{action:geoadmin.layerNode.act}});var hideIfFirst=function(el){var isFirst=this.isFirst();if(isFirst&&!this._updating&&this.nextSibling&&this.nextSibling.hidden===false){this._updating=true;var next=this.nextSibling;if(next){actionsPlugin.updateActions(next);}
delete this._updating;}
if(isFirst){el.hide();}else{el.show();}};var hideIfLast=function(el){var isLast=this.isLast();if(isLast&&!this._updating&&this.previousSibling&&this.previousSibling.hidden===false){this._updating=true;var previous=this.previousSibling;if(previous){actionsPlugin.updateActions(previous);}
delete this._updating;}
if(isLast){el.hide();}else{el.show();}};this.tree=new Ext.tree.TreePanel({title:OpenLayers.i18n('Layer Selection'),id:'layertree',rootVisible:false,autoScroll:true,containerScroll:true,height:150,lines:false,loader:{applyLoader:false},plugins:[actionsPlugin,{ptype:'gx_treenodecomponent'}],root:{nodeType:"gx_layercontainer",loader:{baseAttrs:{nodeType:"geoadmin_layer",uiProvider:geoadmin.LayerNodeUI,actions:[{action:"close",qtip:OpenLayers.i18n("hide layer options")},{action:"open",qtip:OpenLayers.i18n("show layer options")},{action:"pipe-up",qtip:'',update:hideIfFirst},{action:"up",qtip:OpenLayers.i18n("move layer up"),update:hideIfFirst},{action:"pipe-down",qtip:'',update:hideIfLast},{action:"down",qtip:OpenLayers.i18n("move layer down"),update:hideIfLast},{action:"pipe",qtip:''},{action:"delete",qtip:OpenLayers.i18n("remove layer")},{action:"pipe",qtip:''}],checked:null,component:geoadmin.layerNode.tbar}}}});return this.tree;},orderLayers:function(){if(this.permalinkLayers&&this.permalinkLayersIndices){for(i=0;i<this.permalinkLayers.length;i++){var layers=this.map.getLayersBy('bodid',this.permalinkLayers[i]);if(layers.length==1&&this.permalinkLayersIndices[i]){this.map.setLayerIndex(layers[0],this.permalinkLayersIndices[i]);}}}},setLayersOpacity:function(){if(this.permalinkLayers&&this.permalinkLayersOpacity){for(var i=0;i<this.permalinkLayers.length;i++){var layers=this.map.getLayersBy('bodid',this.permalinkLayers[i]);if(layers.length==1&&this.permalinkLayersOpacity[i]){layers[0].setOpacity(this.permalinkLayersOpacity[i]);}}}},setLayersVisibility:function(){if(this.permalinkLayers&&this.permalinkLayersVisibility){for(var i=0;i<this.permalinkLayers.length;i++){var layers=this.map.getLayersBy('bodid',this.permalinkLayers[i]);if(layers.length==1&&this.permalinkLayersVisibility[i]){if(this.permalinkLayersVisibility[i]=='true'){layers[0].setVisibility(true);}else{layers[0].setVisibility(false);}}}}},createBgLayerCombo:function(config){var bgLayers=[];var layerId;for(layerId in this.bgSwitchLayers){bgLayers.push([layerId,OpenLayers.i18n(layerId)]);}
var store=new Ext.data.SimpleStore({fields:['id','name'],data:bgLayers});this.bgLayerCombo=new Ext.form.ComboBox({id:'bgLayer',editable:false,hideLabel:true,width:150,cls:'bgLayerCls',ctCls:'bgLayerContainerCls',store:store,displayField:'name',valueField:'id',forceSelection:true,value:this.bgLayers.primaryLayer.name,triggerAction:'all',mode:'local',listeners:{select:function(combo,record,index){var layerId=record.data.id;this.updateBgLayerCombo(layerId);this.checkForLayersExclusion(layerId,true);},scope:this}});return this.bgLayerCombo;},updateBgLayerCombo:function(layerId){if(this.bgSwitchLayers[layerId]){var primaryLayer=this.bgSwitchLayers[layerId];primaryLayer.setVisibility(true);primaryLayer.setOpacity(this.mapOpacitySlider.layer.opacity);this.bgLayers['primaryLayer']=primaryLayer;this.mapOpacitySlider.layer=primaryLayer;var bgLayer;for(bgLayer in this.bgSwitchLayers){if(bgLayer!=layerId){var layer=this.map.getLayersByName(bgLayer)[0];if(layer){layer.setVisibility(false);}}}}},getMapOptions:function(){if(!this.mapOptions){this.mapOptions={projection:new OpenLayers.Projection("EPSG:2169"),displayProjection:new OpenLayers.Projection("EPSG:2169"),units:"m",maxExtent:new OpenLayers.Bounds.fromArray(this.baseConfig.maxExtent),restrictedExtent:new OpenLayers.Bounds.fromArray([40000,50000,120000,150000]),allOverlays:true,resolutions:this.baseConfig.resolutions,theme:this.baseConfig.baseUrl+'mfbase/openlayers/theme/default/style.css'};}
return this.mapOptions;},getLayers:function(config){this.aerial=new OpenLayers.Layer.TileCache("aerial",this.baseConfig.tilecacheDirectUrl,'ortho',{format:'image/jpeg',visibility:false,buffer:0,transitionEffect:'resize',displayInLayerSwitcher:false,serverResolutions:this.baseConfig.pixelmapResolutions,exclusion:[1,2],isBgLayer:true,attribution:OpenLayers.i18n("aerial attribution")});var pixelmapsColor=new OpenLayers.Layer.TileCache("pixelmaps-color",this.baseConfig.tilecacheDirectUrl,'topo',{format:'image/png',visibility:false,buffer:0,transitionEffect:'resize',displayInLayerSwitcher:false,serverResolutions:this.baseConfig.pixelmapResolutions,exclusion:[11,12],isBgLayer:true,attribution:OpenLayers.i18n("pixelmap-color attribution")});var streets=new OpenLayers.Layer.TileCache("streets",this.baseConfig.tilecacheDirectUrl,'streets_jpeg',{format:'image/jpeg',visibility:false,buffer:0,transitionEffect:'resize',displayInLayerSwitcher:false,serverResolutions:this.baseConfig.pixelmapResolutions,exclusion:[1,2],isBgLayer:true,attribution:OpenLayers.i18n("aerial attribution")});var pixelmapsGray=new OpenLayers.Layer.TileCache("pixelmaps-gray",this.baseConfig.tilecacheDirectUrl,'topo_bw',{format:'image/png',visibility:false,buffer:0,transitionEffect:'resize',displayInLayerSwitcher:false,serverResolutions:this.baseConfig.pixelmapResolutions,exclusion:[21,22],isBgLayer:true,attribution:OpenLayers.i18n("pixelmap-gray attribution")});var voidLayer=new OpenLayers.Layer("voidLayer",{isBaseLayer:false,isBgLayer:true,displayInLayerSwitcher:false});this.bgSwitchLayers={'pixelmaps-color':pixelmapsColor,'pixelmaps-gray':pixelmapsGray,'streets':streets,'voidLayer':voidLayer};var initialPrimaryLayer;if(this.bgLayer&&this.bgSwitchLayers[this.bgLayer]){initialPrimaryLayer=this.bgSwitchLayers[this.bgLayer];}else{initialPrimaryLayer=pixelmapsColor;}
initialPrimaryLayer.setVisibility(true);this.bgLayers={primaryLayer:initialPrimaryLayer,complementaryLayer:this.aerial};return[this.aerial,pixelmapsColor,streets,pixelmapsGray,voidLayer];},getControls:function(config){var options=this.getMapOptions();this.navControl=new OpenLayers.Control.Navigation({handleRightClicks:true});this.mousePosition=new geoadmin.API.MousePosition({div:$('mousepos'),prefix:OpenLayers.i18n('Coordinates: ')});var controls=[new OpenLayers.Control.PanZoomBar(),this.navControl,new OpenLayers.Control.ScaleLine(),new OpenLayers.Control.Attribution(),this.mousePosition,new OpenLayers.Control.OverviewMap({layers:[new OpenLayers.Layer.Image("overview",this.baseConfig.baseUrl+"gfx/keymap.png",new OpenLayers.Bounds(40000,55000,114000,140000),new OpenLayers.Size(130,150))],size:new OpenLayers.Size(130,150),isSuitableOverview:function(){return true;},mapOptions:{units:options.units,projection:options.projection,maxExtent:options.maxExtent,scales:[2000000]}})];if(this.isMainApp){controls.push(new geoadmin.API.ArgParser({api:this}));this.elevation=new geoadmin.Elevation({element:$('elevation'),prefix:'&nbsp;-&nbsp;'+OpenLayers.i18n('Elevation: '),naString:OpenLayers.i18n('N/A'),suffix:' m',serviceUrl:geoadmin.elevationServiceUrl});controls.push(this.elevation);}
return controls;},deactivateRedlining:function(){var actions=this.redlining.controler.actions;for(var i=0;i<actions.length;i++){if(actions[i].control){actions[i].control.deactivate();}}},initRedliningPanel:function(){var closebtn=new Ext.Action({iconCls:'close-button',toggleGroup:'export',handler:function(){Ext.get('redliningContainer').hide();this.deactivateRedlining();},scope:this});this.redlining=new GeoExt.ux.form.RedLiningPanel({map:this.map,width:200,layerOptions:{displayInLayerSwitcher:false},popupOptions:{unpinnable:false,draggable:true},selectControlOptions:{toggle:false,clickout:false},id:'redliningPanel','export':false,'import':false,bodyStyle:'display: none'});this.redliningPanel=new Ext.Panel({tbar:['->',closebtn],title:OpenLayers.i18n('redlining'),renderTo:'redliningContainer',width:200,baseCls:'export-panel',items:[this.redlining]});},createSegmentMeasureControl:function(){var sketchSymbolizers={"Point":{pointRadius:6,graphicName:"cross",fillColor:"#FF0000",fillOpacity:1,strokeWidth:1,strokeOpacity:1,strokeColor:"#333333"},"Line":{strokeWidth:3,strokeOpacity:1,strokeColor:"#FF0000"},"Polygon":{strokeWidth:1,strokeOpacity:1,strokeColor:"#FF0000",fillOpacity:0}};var style=new OpenLayers.Style();style.addRules([new OpenLayers.Rule({symbolizer:sketchSymbolizers})]);var styleMap=new OpenLayers.StyleMap({"default":style});var control=new geoadmin.SegmentMeasure({elevationServiceUrl:geoadmin.elevationServiceUrl,handlerOptions:{layerOptions:{styleMap:styleMap}}});function measurepartial(e){var units=e.units;var distance=OpenLayers.i18n('Distance: ')+
e.distance.toFixed(3)+" "+units;var azimut=OpenLayers.i18n('Azimut: ')+e.azimut+'&deg;';var elevations=e.elevations;var out=[distance,azimut];if(elevations){out.push(OpenLayers.i18n('Elevation offset: ')+
Math.round(elevations[1]-elevations[0],2)+" m");}
$('azimut').innerHTML=out.join(', ');return out;}
var popup=undefined;function measure(e){var out=measurepartial(e);if(popup){popup.close();popup=undefined;}
popup=new Ext.Window({title:OpenLayers.i18n('measure.popup.azimut'),html:out.join('<br/>'),width:150,bodyStyle:'background-color: #FFFFD0;'});popup.show();}
control.events.on({"activate":function(){this.mousePosition&&this.mousePosition.deactivate();this.elevation&&this.elevation.deactivate();$('azimut').innerHTML=OpenLayers.i18n('azimut_measurement_help');},"deactivate":function(){this.mousePosition&&this.mousePosition.activate();this.elevation&&this.elevation.activate();$('azimut').innerHTML="";if(popup){popup.close();popup=undefined;}},"measure":measure,"measurepartial":measurepartial,scope:this});return control;},deactivateMeasure:function(){var i,l,c;for(i=0,l=this.measureControls.length;i<l;i++){c=this.measureControls[i];c.deactivate();}},initMeasurePanel:function(){var closebtn=new Ext.Action({iconCls:'close-button',toggleGroup:'export',handler:function(){this.deactivateMeasure();Ext.get('measureContainer').hide();},scope:this});var items=[],control;this.measureControls=[];var measure=new MapFish.API.Measure();control=measure.createLengthMeasureControl();this.measureControls.push(control);items.push(new GeoExt.Action({map:this.map,control:control,toggleGroup:'measure',allowDepress:true,iconCls:'measureLength',tooltip:OpenLayers.i18n('measure.tooltip.length')}));control=measure.createAreaMeasureControl();this.measureControls.push(control);items.push(new GeoExt.Action({map:this.map,control:control,toggleGroup:'measure',allowDepress:true,iconCls:'measureArea',tooltip:OpenLayers.i18n('measure.tooltip.area')}));control=this.createSegmentMeasureControl();this.measureControls.push(control);items.push(new GeoExt.Action({map:this.map,control:control,toggleGroup:'measure',allowDepress:true,iconCls:'azimut',tooltip:OpenLayers.i18n('measure.tooltip.azimut')}));control=new geoadmin.Profile({layers:["MNT"],serviceUrl:this.baseConfig.baseUrl});this.measureControls.push(control);items.push(new GeoExt.Action({map:this.map,control:control,toggleGroup:'measure',allowDepress:true,iconCls:'profile',tooltip:OpenLayers.i18n('measure.tooltip.profile')}));var tbar=new Ext.Toolbar(items);var innerPanel=new Ext.Panel({id:'measurePanel',border:false,bodyStyle:'display: none',tbar:tbar});var outerPanel=new Ext.Panel({tbar:['->',closebtn],title:OpenLayers.i18n('measure.text.panel'),renderTo:'measureContainer',width:200,border:false,baseCls:'export-panel',items:innerPanel});},initPrintPanel:function(wantPNG){if(wantPNG===undefined)wantPNG=true;var closebtn=new Ext.Action({iconCls:'close-button',toggleGroup:'export',handler:function(){Ext.get('printContainer').hide();this.printPanel.disable();this.drawLayer.setZIndex(this.map.Z_INDEX_BASE['Feature']);},scope:this});var pngBtnCfg=[];if(wantPNG){pngBtnCfg.push({text:"PNG",handler:function(){this.printPanel._png=true;this.printPanel.print();delete this.printPanel._png;},scope:this});}
this.printPanel=new mapfish.widgets.print.SimpleForm({renderTo:'printContainer',width:200,configUrl:this.baseConfig.printUrl+'/info.json',layerTree:this.tree,map:this.map,baseCls:'export-panel',styleMap:new OpenLayers.StyleMap({"default":new OpenLayers.Style({pointRadius:"10",fillColor:"#FF0000",fillOpacity:0.5,strokeColor:"#FF0000",strokeOpacity:1.0,strokeWidth:1})}),fillSpec:function(printCommand){mapfish.widgets.print.SimpleForm.prototype.fillSpec.apply(this,arguments);printCommand.spec.outputFormat=this._png?"png":"pdf";printCommand.spec.pages[0].print_img=geoadmin.print_img;printCommand.spec.pages[0].print_short_txt=geoadmin.print_short_txt;printCommand.spec.pages[0].print_long_txt=geoadmin.print_long_txt;printCommand.spec.print_img=geoadmin.print_img;printCommand.spec.print_short_txt=geoadmin.print_short_txt;printCommand.spec.print_long_txt=geoadmin.print_long_txt;printCommand.spec.routing=geoadmin.routingText;},title:OpenLayers.i18n('PDF'),tbar:['->',closebtn],createLayoutCombo:function(name){var orientations=[];for(var i=0;i<this.config.layouts.length;i++){var layout=this.config.layouts[i];if(layout.name!="e_commande_landscape"){orientations.push({'name':layout.name,'label':OpenLayers.i18n(layout.name)});}}
var layoutStore=new Ext.data.JsonStore({fields:['name','label'],data:orientations});return new Ext.form.ComboBox({fieldLabel:OpenLayers.Lang.translate('mf.print.layout'),store:layoutStore,displayField:'label',valueField:'name',typeAhead:false,mode:'local',id:'layout_'+this.getId(),hiddenId:'layoutId_'+this.getId(),hiddenName:name,name:name,editable:false,triggerAction:'all',value:this.config.layouts[0].name});},formConfig:{labelAlign:'top',defaults:{width:160,listWidth:160},items:[{xtype:'textfield',fieldLabel:OpenLayers.i18n('Title'),name:'title',value:''},{xtype:'hidden',name:'lang'+OpenLayers.Lang.getCode(),value:true}],buttons:pngBtnCfg},serviceParams:{locale:'fr_CH'},wantResetButton:false});},initLinkPanel:function(){var closebtn=new Ext.Action({iconCls:'close-button',toggleGroup:'export',handler:function(){Ext.get('linkContainer').hide();}});this.linkPanel=new Ext.FormPanel({renderTo:'linkContainer',width:450,title:OpenLayers.i18n('Map URL'),border:false,baseCls:'export-panel',tbar:['->',closebtn],labelAlign:'top',items:[{xtype:'textfield',fieldLabel:OpenLayers.i18n('URL'),width:440,id:'permalink',listeners:{'focus':function(){this.selectText();}}}]});},addLayerToMap:function(id){var bodLayersCount=0;var maxlayerNumber=5;for(var i=0,len=this.map.layers.length;i<len;i++){var layer=this.map.layers[i];if(layer.bodid!=undefined){if(layer.bodid==id){return false;}else{bodLayersCount++;}}}
this.checkForLayersExclusion(id);if(bodLayersCount<maxlayerNumber){var config=this.layers[id];if(config){var layer;if(config.categoryId){layer=new OpenLayers.Layer.WMS(config.name,this.baseConfig.mymapsWmsUrl,{layers:'category_'+config.categoryId,format:'image/png'},{singleTile:true,ratio:1,bodid:id,layername:id});}else{layer=new OpenLayers.Layer.TileCache(config.name,this.baseConfig.tilecacheDirectUrl,id,{format:config.format,bodid:id,datenherr:config.datenherr?config.datenherr:'',isBaseLayer:false,layerType:config.type,opacity:config.opacity,buffer:0,exclusion:config.exclusion,transitionEffect:'resize',serverResolutions:this.baseConfig.pixelmapResolutions});}
this.map.addLayer(layer);return true;}else{return false;}}},getBodNumberLayer:function(){var bodLayersCount=0;for(var i=0,len=this.map.layers.length;i<len;i++){var layer=this.map.layers[i];if(layer.bodid!=undefined){bodLayersCount++;}}
return bodLayersCount;},removeLayerFromMap:function(id){var layers=this.map.getLayersBy('bodid',id);if(layers.length==1){var layer=layers[0];layer.destroy();}
this.drawLayer.setZIndex(this.map.Z_INDEX_BASE['Feature']);},initInspireCatalogPanel:function(){this.inspireCatalogPanel=new geoadmin.InspireCatalogPanel({layers:this.layers});},initMyMapsPanel:function(){this.myMapsPanel=new geoadmin.MyMapsPanel({title:OpenLayers.i18n('My Maps'),maps:geoadmin.maps,categories:geoadmin.mymaps_categories,map:geoadmin.map,url:geoadmin.mymaps_url,uploadUrl:geoadmin.upload_url,api:this});},getInspireCatalogPanel:function(){return this.inspireCatalogPanel;},getLayerTreeModel:function(){return null;},checkBgOpacityForLayerExclusion:function(slider,value){this.checkForLayersExclusionHelper(this.aerial.exclusion,true);},checkForLayersExclusion:function(id,isBgLayer){var layers=isBgLayer?this.bgSwitchLayers:this.layers;if(!layers[id]||!layers[id].exclusion)return;this.checkForLayersExclusionHelper(layers[id].exclusion,isBgLayer);},checkForLayersExclusionHelper:function(newLayerExclusion,isBgLayer){var layersToRemove=[];for(var i=0,len=this.map.layers.length;i<len;i++){var layer=this.map.layers[i];if(!layer.exclusion)continue;if(this.haveExclusionMatch(newLayerExclusion,layer.exclusion)){if(!layer.isBgLayer){layersToRemove.push(layer.bodid);this.drawLayer.destroyFeatures();}else if(!isBgLayer){layer.setVisibility(false);this.drawLayer.destroyFeatures();this.showVoidLayer();}}}
for(var i=0,len=layersToRemove.length;i<len;i++){this.removeLayerFromMap(layersToRemove[i]);}},checkPermalinkLayersExclusions:function(){var layersToRemove=[],layers=[],bodid,layer1,layer2;for(var i=0,len=this.permalinkLayers.length;i<len;i++){bodid=this.permalinkLayers[i];if(!this.layers[bodid]){layersToRemove.push(i);continue;}
layer1=this.layers[bodid];if(layers.length==0||!layer1.exclusion){layers.push(bodid);continue;}
for(var j=0,len2=layers.length;j<len2;j++){layer2=this.layers[layers[j]];if(layer2.exclusion&&this.haveExclusionMatch(layer1.exclusion,layer2.exclusion)){layersToRemove.push(this.permalinkLayers.indexOf(layers[j]));}
layers.push(bodid);}}
var permalinkLayers=[];for(var i=0,len=this.permalinkLayers.length;i<len;i++){if(layersToRemove.indexOf(i)==-1){permalinkLayers.push(this.permalinkLayers[i]);}}
this.permalinkLayers=permalinkLayers;if(this.permalinkLayersIndices){var permalinkLayersIndices=[];for(var i=0,len=this.permalinkLayersIndices.length;i<len;i++){if(layersToRemove.indexOf(i)==-1){permalinkLayersIndices.push(this.permalinkLayersIndices[i]);}}
this.permalinkLayersIndices=permalinkLayersIndices;}
if(this.permalinkLayersOpacity){var permalinkLayersOpacity=[];for(var i=0,len=this.permalinkLayersOpacity.length;i<len;i++){if(layersToRemove.indexOf(i)==-1){permalinkLayersOpacity.push(this.permalinkLayersOpacity[i]);}}
this.permalinkLayersOpacity=permalinkLayersOpacity;}},haveExclusionMatch:function(array1,array2){for(var i=0,len=array1.length;i<len;i++){if(array2.indexOf(array1[i])!=-1){return true;}}
return false;},showVoidLayer:function(){if(this.mapOpacitySlider&&this.bgLayerCombo){this.mapOpacitySlider.setValue(100);this.bgLayerCombo.setValue('voidLayer');this.updateBgLayerCombo('voidLayer');}else{this.mapOpacityValue=100;this.bgLayer='voidLayer';this.bgLayers.primaryLayer=this.bgSwitchLayers[this.bgLayer];}},updateLayersZIndex:function(addedLayer){var layer=this.map.getLayersByName('Drawings layer')[0];this.map.setLayerIndex(layer,this.map.layers.length);var layer=this.map.getLayersByName('Cosmetic')[0];this.map.setLayerIndex(layer,this.map.layers.length-1);},recenterOnBbox:function(bbox){var bounds=new OpenLayers.Bounds(bbox[0],bbox[1],bbox[2],bbox[3]);if(bounds.getWidth()&&bounds.getHeight()){this.map.zoomToExtent(bounds);}else{var center=bounds.getCenterLonLat();if(center.lat&&center.lon){this.map.setCenter(center,9);}}},showFeatures:function(layer,ids){var ds=new Ext.data.Store({proxy:new Ext.data.ScriptTagProxy({url:this.baseConfig.baseUrl+this.highlightUrl}),reader:new Ext.data.JsonReader({root:"rows",totalProperty:"results"},[{name:'features'}])});ds.load({params:{layers:layer,ids:[ids],ref:'geoadmin',cb:'mapFishApiPool.apiRefs['+this.apiId+'].showFeaturesCb'}});},showFeaturesCb:function(r){var geo=new OpenLayers.Format.GeoJSON();var features=geo.read(r.rows[0].features);if(features.length>0){var layer=this.getDrawingLayer();layer.addFeatures(features);if(features.length==1&&features[0].geometry instanceof OpenLayers.Geometry.Point){var point=features[0].geometry;this.map.setCenter(new OpenLayers.LonLat(point.x,point.y),10);}else{this.map.zoomToExtent(layer.getDataExtent());}
this.featuresShown=true;}}});Ext.ns('Ext.ux.form');Ext.ux.form.SpinnerField=Ext.extend(Ext.form.NumberField,{actionMode:'wrap',deferHeight:true,autoSize:Ext.emptyFn,onBlur:Ext.emptyFn,adjustSize:Ext.BoxComponent.prototype.adjustSize,constructor:function(config){var spinnerConfig=Ext.copyTo({},config,'incrementValue,alternateIncrementValue,accelerate,defaultValue,triggerClass,splitterClass');var spl=this.spinner=new Ext.ux.Spinner(spinnerConfig);var plugins=config.plugins?(Ext.isArray(config.plugins)?config.plugins.push(spl):[config.plugins,spl]):spl;Ext.ux.form.SpinnerField.superclass.constructor.call(this,Ext.apply(config,{plugins:plugins}));},getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},alignErrorIcon:function(){if(this.wrap){this.errorIcon.alignTo(this.wrap,'tl-tr',[2,0]);}},validateBlur:function(){return true;}});Ext.reg('spinnerfield',Ext.ux.form.SpinnerField);Ext.form.SpinnerField=Ext.ux.form.SpinnerField;Ext.namespace("GeoExt.tree");GeoExt.tree.LayerLoader=function(config){Ext.apply(this,config);this.addEvents("beforeload","load");GeoExt.tree.LayerLoader.superclass.constructor.call(this);};Ext.extend(GeoExt.tree.LayerLoader,Ext.util.Observable,{store:null,filter:function(record){return record.getLayer().displayInLayerSwitcher==true;},baseAttrs:null,uiProviders:null,load:function(node,callback){if(this.fireEvent("beforeload",this,node)){this.removeStoreHandlers();while(node.firstChild){node.removeChild(node.firstChild);}
if(!this.uiProviders){this.uiProviders=node.getOwnerTree().getLoader().uiProviders;}
if(!this.store){this.store=GeoExt.MapPanel.guess().layers;}
this.store.each(function(record){this.addLayerNode(node,record);},this);this.addStoreHandlers(node);if(typeof callback=="function"){callback();}
this.fireEvent("load",this,node);}},onStoreAdd:function(store,records,index,node){if(!this._reordering){var nodeIndex=node.recordIndexToNodeIndex(index+records.length-1);for(var i=0;i<records.length;++i){this.addLayerNode(node,records[i],nodeIndex);}}},onStoreRemove:function(store,record,index,node){if(!this._reordering){this.removeLayerNode(node,record);}},addLayerNode:function(node,layerRecord,index){index=index||0;if(this.filter(layerRecord)===true){var child=this.createNode({nodeType:'gx_layer',layer:layerRecord.getLayer(),layerStore:this.store});var sibling=node.item(index);if(sibling){node.insertBefore(child,sibling);}else{node.appendChild(child);}
child.on("move",this.onChildMove,this);}},removeLayerNode:function(node,layerRecord){if(this.filter(layerRecord)===true){var child=node.findChildBy(function(node){return node.layer==layerRecord.getLayer();});if(child){child.un("move",this.onChildMove,this);child.remove();node.reload();}}},onChildMove:function(tree,node,oldParent,newParent,index){this._reordering=true;var record=this.store.getByLayer(node.layer);if(newParent instanceof GeoExt.tree.LayerContainer&&this.store===newParent.loader.store){newParent.loader._reordering=true;this.store.remove(record);var newRecordIndex;if(newParent.childNodes.length>1){var searchIndex=(index===0)?index+1:index-1;newRecordIndex=this.store.findBy(function(r){return newParent.childNodes[searchIndex].layer===r.getLayer();});index===0&&newRecordIndex++;}else if(oldParent.parentNode===newParent.parentNode){var prev=newParent;do{prev=prev.previousSibling;}while(prev&&!(prev instanceof GeoExt.tree.LayerContainer&&prev.lastChild));if(prev){newRecordIndex=this.store.findBy(function(r){return prev.lastChild.layer===r.getLayer();});}else{var next=newParent;do{next=next.nextSibling;}while(next&&!(next instanceof GeoExt.tree.LayerContainer&&next.firstChild));if(next){newRecordIndex=this.store.findBy(function(r){return next.firstChild.layer===r.getLayer();});}
newRecordIndex++;}}
if(newRecordIndex!==undefined){this.store.insert(newRecordIndex,[record]);window.setTimeout(function(){newParent.reload();oldParent.reload();});}else{this.store.insert(oldRecordIndex,[record]);}
delete newParent.loader._reordering;}
delete this._reordering;},addStoreHandlers:function(node){if(!this._storeHandlers){this._storeHandlers={"add":this.onStoreAdd.createDelegate(this,[node],true),"remove":this.onStoreRemove.createDelegate(this,[node],true)};for(var evt in this._storeHandlers){this.store.on(evt,this._storeHandlers[evt],this);}}},removeStoreHandlers:function(){if(this._storeHandlers){for(var evt in this._storeHandlers){this.store.un(evt,this._storeHandlers[evt],this);}
delete this._storeHandlers;}},createNode:function(attr){if(this.baseAttrs){Ext.apply(attr,this.baseAttrs);}
if(typeof attr.uiProvider=='string'){attr.uiProvider=this.uiProviders[attr.uiProvider]||eval(attr.uiProvider);}
attr.nodeType=attr.nodeType||"gx_layer";return new Ext.tree.TreePanel.nodeTypes[attr.nodeType](attr);},destroy:function(){this.removeStoreHandlers();}});Ext.namespace('GeoExt.ux');var scriptSourceLayerManagerExportWindow=(function(){var scripts=document.getElementsByTagName('script'),script=scripts[scripts.length-1];if(script.getAttribute.length!==undefined){return script.src;}
return script.getAttribute('src',-1);}());GeoExt.ux.LayerManagerExportWindow=Ext.extend(Ext.Window,{id:'layermanagerexportwindow',modal:true,title:OpenLayers.i18n('Export Window'),width:500,height:300,minWidth:300,minHeight:200,layout:'absolute',plain:true,bodyStyle:'padding:5px;',filename:null,filecontent:null,downloadifyBox:null,downloadifyLoaded:false,baseUrl:scriptSourceLayerManagerExportWindow.replace('/widgets/LayerManagerExportWindow.js',''),initComponent:function(){this.downloadifyBox=new Ext.BoxComponent({x:405,y:6,width:66,height:21,id:'downloadify',anchor:'',autoEl:{tag:'p',style:"text-align:right"}});this.items=[{x:10,y:5,xtype:'textfield',id:'filename',name:'filename',value:this.filename,width:384},this.downloadifyBox,{x:10,y:35,xtype:'textarea',id:'data',name:'data',value:this.filecontent,anchor:'100% 100%'}];GeoExt.ux.LayerManagerExportWindow.superclass.initComponent.call(this);this.on('afterlayout',function(){var el=Ext.get('downloadify');if(el&&!this.downloadifyLoaded&&GetFlashVersion()>=10.00){Downloadify.create('downloadify',{filename:function(){return document.getElementById('filename').value;},data:function(){return document.getElementById('data').value;},onComplete:function(){Ext.getCmp('layermanagerexportwindow').close();},onCancel:function(){},onError:function(){alert('Error occured during storage');},transparent:false,swf:this.baseUrl+'/downloadify/media/downloadify.swf',downloadImage:this.baseUrl+'/downloadify/images/extjs_download_default.png',width:66,height:21,append:false});this.downloadifyLoaded=true;}},this);}});Ext.reg('gxux_layermanagerexportwindow',GeoExt.ux.LayerManagerExportWindow);Ext.namespace("GeoExt.ux");GeoExt.ux.FeatureEditingControler=Ext.extend(Ext.util.Observable,{map:null,drawControls:null,lastDrawControl:null,deleteAllAction:null,actions:null,featureControl:null,layers:null,activeLayer:null,featurePanel:null,featurePanelClass:null,popup:null,useIcons:true,downloadService:null,useDefaultAttributes:true,defaultAttributes:['name','description'],defaultAttributesValues:[OpenLayers.i18n('no title'),''],autoSave:true,style:null,defaultStyle:{fillColor:"red",strokeColor:"red"},layerOptions:{},cosmetic:false,fadeRatio:0.4,opacityProperties:["fillOpacity","hoverFillOpacity","strokeOpacity","hoverStrokeOpacity"],defaultOpacity:1,'import':true,'export':true,toggleGroup:null,popupOptions:{},selectControlOptions:{},styler:null,constructor:function(config){Ext.apply(this,config);this.addEvents(["activelayerchanged"]);this.drawControls=[];this.actions=[];this.layers=[];this.initMap();if(config['layers']!=null){this.addLayers(config['layers']);delete config['layers'];}
if(this.cosmetic===true){var style=this.style||OpenLayers.Util.applyDefaults(this.defaultStyle,OpenLayers.Feature.Vector.style["default"]);var styleMap=new OpenLayers.StyleMap(style);var layerOptions=OpenLayers.Util.applyDefaults(this.layerOptions,{styleMap:styleMap,displayInLayerSwitcher:false});layer=new OpenLayers.Layer.Vector("Cosmetic",layerOptions);this.addLayers([layer]);}
if(this.layers.length>0){this.setActiveLayer(this.layers[0]);}
GeoExt.ux.FeatureEditingControler.superclass.constructor.apply(this,arguments);},addLayers:function(layers){for(var i=0;i<layers.length;i++){this.addLayer(layers[i]);}},addLayer:function(layer){if(!layer.map){this.map.addLayer(layer);}
this.layers.push(layer);layer.events.on({"beforefeatureselected":this.onBeforeFeatureSelect,"featureunselected":this.onFeatureUnselect,"featureselected":this.onFeatureSelect,"beforefeaturemodified":this.onModificationStart,"featuremodified":this.onModification,"afterfeaturemodified":this.onModificationEnd,"beforefeatureadded":this.onBeforeFeatureAdded,scope:this});},setActiveLayer:function(layer){this.activeLayer=layer;this.fireEvent("activelayerchanged",this,layer);this.initDrawControls(layer);this.initFeatureControl(layer);this.initDeleteAllAction();this.initImport();this.initExport();},initMap:function(){if(this.map instanceof GeoExt.MapPanel){this.map=this.map.map;}
if(!this.map){this.map=GeoExt.MapPanel.guess().map;}
if(!this.toggleGroup){this.toggleGroup=this.map.id;}},initFeatureControl:function(layer){var control,actionOptions;control=new OpenLayers.Control.ModifyFeature(layer,this.selectControlOptions);this.featureControl=control;actionOptions={control:control,map:this.map,toggleGroup:this.toggleGroup,allowDepress:false,pressed:false,tooltip:OpenLayers.i18n("Edit Feature"),group:this.toggleGroup,checked:false};if(this.useIcons===true){actionOptions.iconCls="gx-featureediting-editfeature";}else{actionOptions.text=OpenLayers.i18n("Edit Feature");}
var action=new GeoExt.Action(actionOptions);this.actions.push(action);},destroyFeatureControl:function(){},initDrawControls:function(layer){var control,handler,geometryTypes,geometryType,options,action,iconCls,actionOptions,tooltip;geometryTypes=[];options={};if(OpenLayers.i18n(layer.geometryType)){geometryTypes.push(OpenLayers.i18n(layer.geometryType));}else{geometryTypes.push(OpenLayers.i18n("Point"));geometryTypes.push(OpenLayers.i18n("LineString"));geometryTypes.push(OpenLayers.i18n("Polygon"));geometryTypes.push(OpenLayers.i18n("Label"));}
for(var i=0;i<geometryTypes.length;i++){geometryType=geometryTypes[i];switch(geometryType){case OpenLayers.i18n("LineString"):case OpenLayers.i18n("MultiLineString"):handler=OpenLayers.Handler.Path;iconCls="gx-featureediting-draw-line";tooltip=OpenLayers.i18n("Create line");break;case OpenLayers.i18n("Point"):case OpenLayers.i18n("MultiPoint"):handler=OpenLayers.Handler.Point;iconCls="gx-featureediting-draw-point";tooltip=OpenLayers.i18n("Create point");break;case OpenLayers.i18n("Polygon"):case OpenLayers.i18n("MultiPolygon"):handler=OpenLayers.Handler.Polygon;iconCls="gx-featureediting-draw-polygon";tooltip=OpenLayers.i18n("Create polygon");break;case OpenLayers.i18n("Label"):handler=OpenLayers.Handler.Point;iconCls="gx-featureediting-draw-label";tooltip=OpenLayers.i18n("Create label");break;}
control=new OpenLayers.Control.DrawFeature(layer,handler,options);this.drawControls.push(control);if(geometryType==OpenLayers.i18n("Label")){control.events.on({"featureadded":this.onLabelAdded,scope:this});}
control.events.on({"featureadded":this.onFeatureAdded,scope:this});actionOptions={control:control,map:this.map,toggleGroup:this.toggleGroup,allowDepress:false,pressed:false,tooltip:tooltip,group:this.toggleGroup,checked:false};if(this.useIcons===true){actionOptions.iconCls=iconCls;}else{actionOptions.text=geometryType;}
action=new GeoExt.Action(actionOptions);this.actions.push(action);}},destroyDrawControls:function(){for(var i=0;i<this.drawControls.length;i++){this.drawControls[i].destroy();}
this.drawControls=[];},initDeleteAllAction:function(){var actionOptions={handler:this.deleteAllFeatures,scope:this,tooltip:OpenLayers.i18n('Delete all features')};if(this.useIcons===true){actionOptions.iconCls="gx-featureediting-delete";}else{actionOptions.text=OpenLayers.i18n('DeleteAll');}
var action=new Ext.Action(actionOptions);this.deleteAllAction=action;this.actions.push(action);},deleteAllFeatures:function(){Ext.MessageBox.confirm(OpenLayers.i18n('Delete All Features'),OpenLayers.i18n('Do you really want to delete all features ?'),function(btn){if(btn=='yes'){if(this.popup){this.popup.close();this.popup=null;}
for(var i=0;i<this.layers.length;i++){this.layers[i].destroyFeatures();}}},this);},initImport:function(layer){if(this['import']===true){var actionOptions={handler:this.importFeatures,scope:this,tooltip:OpenLayers.i18n('Import KML')};if(this.useIcons===true){actionOptions.iconCls="gx-featureediting-import";}else{actionOptions.text=OpenLayers.i18n("Import");}
var action=new Ext.Action(actionOptions);this.actions.push(action);}},importFeatures:function(){GeoExt.ux.data.Import.KMLImport(this.map,this.activeLayer);},initExport:function(){if(this['export']===true){var actionOptions={handler:this.exportFeatures,scope:this,tooltip:OpenLayers.i18n('Export KML')};if(this.useIcons===true){actionOptions.iconCls="gx-featureediting-export";}else{actionOptions.text=OpenLayers.i18n("Export");}
var action=new Ext.Action(actionOptions);this.actions.push(action);}},exportFeatures:function(){GeoExt.ux.data.Export.KMLExport(this.map,this.layers,null,this.downloadService);},getSelectControl:function(){var control=false;switch(this.featureControl.CLASS_NAME){case"OpenLayers.Control.SelectFeature":control=this.featureControl;break;case"OpenLayers.Control.ModifyFeature":case"OpenLayers.Control.DeleteFeature":control=this.featureControl.selectControl;break;}
return control;},getActiveDrawControl:function(){var control=false;for(var i=0;i<this.drawControls.length;i++){if(this.drawControls[i].active){control=this.drawControls[i];break;}}
return control;},onLabelAdded:function(event){var feature=event.feature;feature.isLabel=true;},onFeatureAdded:function(event){var feature,drawControl;feature=event.feature;feature.state=OpenLayers.State.INSERT;drawControl=this.getActiveDrawControl();if(drawControl){drawControl.deactivate();this.lastDrawControl=drawControl;}
this.featureControl.activate();var control=this.getSelectControl();control.select.defer(1,control,[feature]);},onModificationStart:function(event){var feature=(event.geometry)?event:event.feature;var drawControl=this.getActiveDrawControl();if(drawControl){drawControl.deactivate();this.featureControl.activate();}
var options={autoSave:this.autoSave,features:[feature],controler:this,useIcons:this.useIcons,styler:this.styler};if(this['export']===true){options['plugins']=[new GeoExt.ux.ExportFeature(),new GeoExt.ux.CloseFeatureDialog()];}
clazz=this.featurePanelClass||GeoExt.ux.form.FeaturePanel;this.featurePanel=new clazz(options);popupOptions={location:feature,feature:feature,controler:this,items:[this.featurePanel]};popupOptions=OpenLayers.Util.applyDefaults(popupOptions,this.popupOptions);popupOptions=OpenLayers.Util.applyDefaults(popupOptions,{title:OpenLayers.i18n('Edit Feature'),layout:'fit',width:280});var popup=new GeoExt.Popup(popupOptions);feature.popup=popup;this.popup=popup;popup.on({close:function(){if(OpenLayers.Util.indexOf(this.controler.activeLayer.selectedFeatures,this.feature)>-1){this.controler.getSelectControl().unselect(this.feature);}}});popup.show();},onModification:function(event){var feature=(event.geometry)?event:event.feature;},onModificationEnd:function(event){var feature=(event.geometry)?event:event.feature;if(!feature){return;}
this.triggerAutoSave();if(feature.popup){feature.popup.close();feature.popup=null;}
this.reactivateDrawControl();},onBeforeFeatureAdded:function(event){var feature=event.feature;this.parseFeatureStyle(feature);this.parseFeatureDefaultAttributes(feature);},parseFeatureStyle:function(feature){var symbolizer=this.activeLayer.styleMap.createSymbolizer(feature);feature.style=symbolizer;},parseFeatureDefaultAttributes:function(feature){var hasAttributes;if(this.useDefaultAttributes===true){hasAttributes=false;for(var key in feature.attributes){hasAttributes=true;break;}
if(!hasAttributes){for(var i=0;i<this.defaultAttributes.length;i++){feature.attributes[this.defaultAttributes[i]]=this.defaultAttributesValues[i];}}}},reactivateDrawControl:function(){if(this.lastDrawControl&&this.activeLayer.selectedFeatures.length===0){this.featureControl.deactivate();this.lastDrawControl.activate();this.lastDrawControl=null;}},triggerAutoSave:function(){if(this.autoSave){this.featurePanel.triggerAutoSave();}},onBeforeFeatureSelect:function(event){var feature=(event.geometry)?event:event.feature;if(feature.layer.selectedFeatures.length===0){this.applyStyles('faded',{'redraw':true});}},onFeatureUnselect:function(event){var feature=(event.geometry)?event:event.feature;this.applyStyle(feature,'faded',{'redraw':true});if(feature.layer.selectedFeatures.length===0){this.applyStyles('normal',{'redraw':true});}},onFeatureSelect:function(event){var feature=(event.geometry)?event:event.feature;this.applyStyle(feature,'normal',{'redraw':true});},applyStyles:function(style,options){style=style||"normal";options=options||{};for(var i=0;i<this.layers.length;i++){layer=this.layers[i];for(var j=0;j<layer.features.length;j++){feature=layer.features[j];if(!feature._sketch){this.applyStyle(feature,style);}}
if(options['redraw']===true){layer.redraw();}}},applyStyle:function(feature,style,options){var fRatio;options=options||{};switch(style){case"faded":fRatio=this.fadeRatio;break;default:fRatio=1/this.fadeRatio;}
for(var i=0;i<this.opacityProperties.length;i++){property=this.opacityProperties[i];if(feature.style[property]){feature.style[property]*=fRatio;}}
if(options['redraw']===true){feature.layer.drawFeature(feature);}},CLASS_NAME:"GeoExt.ux.FeatureEditingControler"});Ext.namespace("MapFish");MapFish.API.Permalink=OpenLayers.Class(OpenLayers.Control.Permalink,{id:'mapfish.api.permalink',coordsParams:null,api:null,argParserClass:MapFish.API.ArgParser,initialize:function(element,base,options){OpenLayers.Control.Permalink.prototype.initialize.apply(this,arguments);this.api=options&&options.api;this.coordsParams=options&&options.coordsParams||{lon:'lon',lat:'lat'};},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.map.events.on({'moveend':this.updateLink,'changelayer':this.updateLink,'changebaselayer':this.updateLink,scope:this});this.updateLink();return this.div;},updateLink:function(){var href=this.base;if(href.indexOf('?')!=-1){href=href.substring(0,href.indexOf('?'));}
href+='?'+OpenLayers.Util.getParameterString(this.createParams());if(this.element){this.element.value=href;}},createParams:function(center,zoom,layers){if(this.map){center=center||this.map.getCenter();}else{return'';}
if(OpenLayers.String.contains(this.base,'?')){}else{this.base=this.base+"?";}
var params=OpenLayers.Util.getParameters(this.base);if(center){params.zoom=zoom||this.map.getZoom();var lat=center.lat;var lon=center.lon;if(this.displayProjection){var mapPosition=OpenLayers.Projection.transform({x:lon,y:lat},this.map.getProjectionObject(),this.displayProjection);lon=mapPosition.x;lat=mapPosition.y;}
params[this.coordsParams.lat]=Math.round(lat*100000)/100000;params[this.coordsParams.lon]=Math.round(lon*100000)/100000;params.layers=null;var layertree=this.api.tree;if(layertree){var nodes=[];var checkedNodes=layertree.getChecked();for(var i=0,len=checkedNodes.length;i<len;i++){var node=checkedNodes[i];if(node.id){nodes.push(node.id);}}
if(nodes.length>0){params.layerNodes=nodes;}}}
return params;},CLASS_NAME:"MapFish.API.Permalink"});Ext.namespace("geoadmin.API");geoadmin.API.Permalink=OpenLayers.Class(MapFish.API.Permalink,{initialize:function(element,base,options){MapFish.API.Permalink.prototype.initialize.apply(this,arguments);this.coordsParams=options&&options.coordsParams||{lon:'Y',lat:'X'};},setMap:function(map){OpenLayers.Control.prototype.setMap.apply(this,arguments);},draw:function(){MapFish.API.Permalink.prototype.draw.apply(this,arguments);this.map.events.on({'addlayer':this.updateLink,'removelayer':this.updateLink,scope:this});this.api.getInspireCatalogPanel().on({'click':this.updateLink,'dblclick':this.updateLink,scope:this});this.api.getMapOpacitySlider().on({'click':this.updateLink,scope:this});Ext.getCmp('bgLayer').on({'select':this.updateLink,scope:this});this.updateLink();return this.div;},createParams:function(center,zoom,layers){var params=MapFish.API.Permalink.prototype.createParams.apply(this,arguments);if(this.map){}else{return'';}
params.layers=null;params.layers_indices=null;params.layers_opacity=null;params.layers_visibility=null;layers=layers||this.map.layers;var activatedLayers=[];var activatedLayersIndices=[];var activatedLayersOpacity=[];var activatedLayersVisibility=[];for(var i=0,len=layers.length;i<len;i++){var layer=layers[i];if(!layer.isBaseLayer&&layer.name!='aerial'&&layer.name!='pixelmaps-color'&&layer.name!='pixelmaps-gray'&&layer.name!='streets'&&layer.name!='cadastre'&&layer.name!='Drawings layer'&&layer.name!='voidLayer'&&layer.name!='Cosmetic'&&layer.name!='mymapsLayer'){activatedLayers.push(layer.layername);activatedLayersIndices.push(this.map.getLayerIndex(layer));if(layer.opacity!=null){activatedLayersOpacity.push(layer.opacity);}else{activatedLayersOpacity.push('1');}
activatedLayersVisibility.push(layer.visibility);}}
if(activatedLayers.length){params.layers=activatedLayers;params.layers_indices=activatedLayersIndices;params.layers_opacity=activatedLayersOpacity;params.layers_visibility=activatedLayersVisibility;}
var bgOpacity=this.api.getMapOpacitySlider().getValue();if(typeof bgOpacity!='undefined'&&bgOpacity!=100){params.bgOpacity=bgOpacity;}else{params.bgOpacity=null;}
var bgLayer=Ext.getCmp('bgLayer').value;params.bgLayer=(bgLayer!=geoadmin.bgLayer)?bgLayer:null;var selectedNode=this.api.getInspireCatalogPanel().getSelectedNode();if(selectedNode){params.selectedNode=selectedNode;}
if(params.scale){params.zoom=null;}
return params;},CLASS_NAME:"geoadmin.API.Permalink"});Ext.namespace("GeoExt.data");GeoExt.data.LayerRecord=Ext.data.Record.create([{name:"layer"},{name:"title",type:"string",mapping:"name"}]);GeoExt.data.LayerRecord.prototype.getLayer=function(){return this.get("layer");};GeoExt.data.LayerRecord.prototype.setLayer=function(layer){if(layer!==this.data.layer){this.dirty=true;if(!this.modified){this.modified={};}
if(this.modified.layer===undefined){this.modified.layer=this.data.layer;}
this.data.layer=layer;if(!this.editing){this.afterEdit();}}};GeoExt.data.LayerRecord.prototype.clone=function(id){var layer=this.getLayer()&&this.getLayer().clone();return new this.constructor(Ext.applyIf({layer:layer},this.data),id||layer.id);};GeoExt.data.LayerRecord.create=function(o){var f=Ext.extend(GeoExt.data.LayerRecord,{});var p=f.prototype;p.fields=new Ext.util.MixedCollection(false,function(field){return field.name;});GeoExt.data.LayerRecord.prototype.fields.each(function(f){p.fields.add(f);});if(o){for(var i=0,len=o.length;i<len;i++){p.fields.add(new Ext.data.Field(o[i]));}}
f.getField=function(name){return p.fields.get(name);};return f;};Ext.ux.Spinner=Ext.extend(Ext.util.Observable,{incrementValue:1,alternateIncrementValue:5,triggerClass:'x-form-spinner-trigger',splitterClass:'x-form-spinner-splitter',alternateKey:Ext.EventObject.shiftKey,defaultValue:0,accelerate:false,constructor:function(config){Ext.ux.Spinner.superclass.constructor.call(this,config);Ext.apply(this,config);this.mimicing=false;},init:function(field){this.field=field;field.afterMethod('onRender',this.doRender,this);field.afterMethod('onEnable',this.doEnable,this);field.afterMethod('onDisable',this.doDisable,this);field.afterMethod('afterRender',this.doAfterRender,this);field.afterMethod('onResize',this.doResize,this);field.afterMethod('onFocus',this.doFocus,this);field.beforeMethod('onDestroy',this.doDestroy,this);},doRender:function(ct,position){var el=this.el=this.field.getEl();var f=this.field;if(!f.wrap){f.wrap=this.wrap=el.wrap({cls:"x-form-field-wrap"});}
else{this.wrap=f.wrap.addClass('x-form-field-wrap');}
this.trigger=this.wrap.createChild({tag:"img",src:Ext.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.triggerClass});if(!f.width){this.wrap.setWidth(el.getWidth()+this.trigger.getWidth());}
this.splitter=this.wrap.createChild({tag:'div',cls:this.splitterClass,style:'width:13px; height:2px;'});this.splitter.setRight((Ext.isIE)?1:2).setTop(10).show();this.proxy=this.trigger.createProxy('',this.splitter,true);this.proxy.addClass("x-form-spinner-proxy");this.proxy.setStyle('left','0px');this.proxy.setSize(14,1);this.proxy.hide();this.dd=new Ext.dd.DDProxy(this.splitter.dom.id,"SpinnerDrag",{dragElId:this.proxy.id});this.initTrigger();this.initSpinner();},doAfterRender:function(){var y;if(Ext.isIE&&this.el.getY()!=(y=this.trigger.getY())){this.el.position();this.el.setY(y);}},doEnable:function(){if(this.wrap){this.disabled=false;this.wrap.removeClass(this.field.disabledClass);}},doDisable:function(){if(this.wrap){this.disabled=true;this.wrap.addClass(this.field.disabledClass);this.el.removeClass(this.field.disabledClass);}},doResize:function(w,h){if(typeof w=='number'){this.el.setWidth(w-this.trigger.getWidth());}
this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth());},doFocus:function(){if(!this.mimicing){this.wrap.addClass('x-trigger-wrap-focus');this.mimicing=true;Ext.get(Ext.isIE?document.body:document).on("mousedown",this.mimicBlur,this,{delay:10});this.el.on('keydown',this.checkTab,this);}},checkTab:function(e){if(e.getKey()==e.TAB){this.triggerBlur();}},mimicBlur:function(e){if(!this.wrap.contains(e.target)&&this.field.validateBlur(e)){this.triggerBlur();}},triggerBlur:function(){this.mimicing=false;Ext.get(Ext.isIE?document.body:document).un("mousedown",this.mimicBlur,this);this.el.un("keydown",this.checkTab,this);this.field.beforeBlur();this.wrap.removeClass('x-trigger-wrap-focus');this.field.onBlur.call(this.field);},initTrigger:function(){this.trigger.addClassOnOver('x-form-trigger-over');this.trigger.addClassOnClick('x-form-trigger-click');},initSpinner:function(){this.field.addEvents({'spin':true,'spinup':true,'spindown':true});this.keyNav=new Ext.KeyNav(this.el,{"up":function(e){e.preventDefault();this.onSpinUp();},"down":function(e){e.preventDefault();this.onSpinDown();},"pageUp":function(e){e.preventDefault();this.onSpinUpAlternate();},"pageDown":function(e){e.preventDefault();this.onSpinDownAlternate();},scope:this});this.repeater=new Ext.util.ClickRepeater(this.trigger,{accelerate:this.accelerate});this.field.mon(this.repeater,"click",this.onTriggerClick,this,{preventDefault:true});this.field.mon(this.trigger,{mouseover:this.onMouseOver,mouseout:this.onMouseOut,mousemove:this.onMouseMove,mousedown:this.onMouseDown,mouseup:this.onMouseUp,scope:this,preventDefault:true});this.field.mon(this.wrap,"mousewheel",this.handleMouseWheel,this);this.dd.setXConstraint(0,0,10)
this.dd.setYConstraint(1500,1500,10);this.dd.endDrag=this.endDrag.createDelegate(this);this.dd.startDrag=this.startDrag.createDelegate(this);this.dd.onDrag=this.onDrag.createDelegate(this);},onMouseOver:function(){if(this.disabled){return;}
var middle=this.getMiddle();this.tmpHoverClass=(Ext.EventObject.getPageY()<middle)?'x-form-spinner-overup':'x-form-spinner-overdown';this.trigger.addClass(this.tmpHoverClass);},onMouseOut:function(){this.trigger.removeClass(this.tmpHoverClass);},onMouseMove:function(){if(this.disabled){return;}
var middle=this.getMiddle();if(((Ext.EventObject.getPageY()>middle)&&this.tmpHoverClass=="x-form-spinner-overup")||((Ext.EventObject.getPageY()<middle)&&this.tmpHoverClass=="x-form-spinner-overdown")){}},onMouseDown:function(){if(this.disabled){return;}
var middle=this.getMiddle();this.tmpClickClass=(Ext.EventObject.getPageY()<middle)?'x-form-spinner-clickup':'x-form-spinner-clickdown';this.trigger.addClass(this.tmpClickClass);},onMouseUp:function(){this.trigger.removeClass(this.tmpClickClass);},onTriggerClick:function(){if(this.disabled||this.el.dom.readOnly){return;}
var middle=this.getMiddle();var ud=(Ext.EventObject.getPageY()<middle)?'Up':'Down';this['onSpin'+ud]();},getMiddle:function(){var t=this.trigger.getTop();var h=this.trigger.getHeight();var middle=t+(h/2);return middle;},isSpinnable:function(){if(this.disabled||this.el.dom.readOnly){Ext.EventObject.preventDefault();return false;}
return true;},handleMouseWheel:function(e){if(this.wrap.hasClass('x-trigger-wrap-focus')==false){return;}
var delta=e.getWheelDelta();if(delta>0){this.onSpinUp();e.stopEvent();}
else
if(delta<0){this.onSpinDown();e.stopEvent();}},startDrag:function(){this.proxy.show();this._previousY=Ext.fly(this.dd.getDragEl()).getTop();},endDrag:function(){this.proxy.hide();},onDrag:function(){if(this.disabled){return;}
var y=Ext.fly(this.dd.getDragEl()).getTop();var ud='';if(this._previousY>y){ud='Up';}
if(this._previousY<y){ud='Down';}
if(ud!=''){this['onSpin'+ud]();}
this._previousY=y;},onSpinUp:function(){if(this.isSpinnable()==false){return;}
if(Ext.EventObject.shiftKey==true){this.onSpinUpAlternate();return;}
else{this.spin(false,false);}
this.field.fireEvent("spin",this);this.field.fireEvent("spinup",this);},onSpinDown:function(){if(this.isSpinnable()==false){return;}
if(Ext.EventObject.shiftKey==true){this.onSpinDownAlternate();return;}
else{this.spin(true,false);}
this.field.fireEvent("spin",this);this.field.fireEvent("spindown",this);},onSpinUpAlternate:function(){if(this.isSpinnable()==false){return;}
this.spin(false,true);this.field.fireEvent("spin",this);this.field.fireEvent("spinup",this);},onSpinDownAlternate:function(){if(this.isSpinnable()==false){return;}
this.spin(true,true);this.field.fireEvent("spin",this);this.field.fireEvent("spindown",this);},spin:function(down,alternate){var v=parseFloat(this.field.getValue());var incr=(alternate==true)?this.alternateIncrementValue:this.incrementValue;(down==true)?v-=incr:v+=incr;v=(isNaN(v))?this.defaultValue:v;v=this.fixBoundries(v);this.field.setRawValue(v);},fixBoundries:function(value){var v=value;if(this.field.minValue!=undefined&&v<this.field.minValue){v=this.field.minValue;}
if(this.field.maxValue!=undefined&&v>this.field.maxValue){v=this.field.maxValue;}
return this.fixPrecision(v);},fixPrecision:function(value){var nan=isNaN(value);if(!this.field.allowDecimals||this.field.decimalPrecision==-1||nan||!value){return nan?'':value;}
return parseFloat(parseFloat(value).toFixed(this.field.decimalPrecision));},doDestroy:function(){if(this.trigger){this.trigger.remove();}
if(this.wrap){this.wrap.remove();delete this.field.wrap;}
if(this.splitter){this.splitter.remove();}
if(this.dd){this.dd.unreg();this.dd=null;}
if(this.proxy){this.proxy.remove();}
if(this.repeater){this.repeater.purgeListeners();}
if(this.mimicing){Ext.get(Ext.isIE?document.body:document).un("mousedown",this.mimicBlur,this);}}});Ext.form.Spinner=Ext.ux.Spinner;Ext.namespace('Ext.ux');Ext.ux.Hyperlink=Ext.extend(Ext.BoxComponent,{iconCls:'',initComponent:function(){this.addEvents('click');this.autoEl={tag:'a',href:'javascript:void(0);','class':'x-hyperlink',html:this.text};Ext.ux.Hyperlink.superclass.initComponent.call(this);},onRender:function(ct,position){Ext.ux.Hyperlink.superclass.onRender.call(this,ct,position);this.mon(this.el,{scope:this,click:this.click});},click:function(e){this.fireEvent('click',this);}});Ext.reg('hyperlink',Ext.ux.Hyperlink);Ext.namespace("geoadmin");geoadmin.MyMapsFeaturePanel=Ext.extend(Ext.form.FormPanel,{labelWidth:100,border:false,bodyStyle:'padding:5px 5px 5px 5px',width:'auto',autoWidth:true,height:'auto',autoHeight:true,defaults:{width:120},defaultType:'textfield',features:null,controler:null,autoSave:true,labelAttribute:"name",styler:null,fileUpload:true,initComponent:function(){this.initFeatures(this.features);this.initToolbar();this.initMyItems();geoadmin.MyMapsFeaturePanel.superclass.initComponent.call(this);this.parseFormFieldsToFeatureAttributes(this.features[0]);this.on('afterrender',function(){var feature=this.features[0];feature.layer.drawFeature(feature);},this);},initFeatures:function(features){if(features instanceof Array){this.features=features;}else{this.features=[features];}},initToolbar:function(){this.initDeleteAction();Ext.apply(this,{bbar:new Ext.Toolbar(this.getActions())});},triggerAutoSave:function(){if(this.autoSave){this.save();}},initDeleteAction:function(){var actionOptions={handler:this.deleteFeatures,scope:this,tooltip:OpenLayers.i18n('Delete feature')};if(this.useIcons===true){actionOptions.iconCls="gx-featureediting-delete";}else{actionOptions.text=OpenLayers.i18n('Delete');}
this.deleteAction=new Ext.Action(actionOptions);},deleteFeatures:function(){Ext.MessageBox.confirm(OpenLayers.i18n('Delete Feature'),OpenLayers.i18n('Do you really want to delete this feature ?'),function(btn){if(btn=='yes'){for(var i=0;i<this.features.length;i++){var feature=this.features[i];if(feature.popup){feature.popup.close();feature.popup=null;}
feature.layer.destroyFeatures([feature]);}
this.controler.reactivateDrawControl();}},this);},getActions:function(){if(!this.closeAction){this.closeAction=new Ext.Action({handler:function(){this.controler.triggerAutoSave();if(this.controler.popup){this.controler.popup.close();}
this.controler.reactivateDrawControl();},scope:this,text:OpenLayers.i18n('Close')});}
return[this.deleteAction,'->',this.closeAction];},save:function(){var feature;if(this.features&&this.features.length===0){return;}
if(this.features.length!=1){return;}else{feature=this.features[0];}
this.parseFormFieldsToFeatureAttributes(feature);if(feature.isLabel===true){if(feature.attributes[this.labelAttribute]==""){feature.layer.destroyFeatures([feature]);if(this.controler.popup){this.controler.popup.close();this.controler.popup=null;}}}},initMyItems:function(){var oItems,feature,field;if(this.features.length!=1){return;}else{feature=this.features[0];}
oItems=[{name:'name',anchor:'100%',fieldLabel:OpenLayers.i18n('mymaps.name'),value:feature.attributes['name']||OpenLayers.i18n('mymaps.defaulttitle'),enableKeyEvents:true,listeners:{keyup:function(){this.parseFormFieldsToFeatureAttributes(feature);},scope:this}}];if(!feature.isLabel){oItems.push([{xtype:'textarea',name:'description',anchor:'100%',fieldLabel:OpenLayers.i18n('mymaps.description'),value:feature.attributes['description']},{name:'thumbnail',xtype:'hidden',value:feature.attributes['thumbnail']},{name:'image',xtype:'hidden',value:feature.attributes['image']}]);}else{oItems.push([{name:'isLabel',xtype:'hidden',value:true}])}
var uploadButton=new Ext.ux.form.FileUploadField({buttonOnly:true,buttonText:'',buttonCfg:{width:40,height:40,icon:feature.attributes['thumbnail']||Ext.BLANK_IMAGE_URL,iconCls:'image'},name:'file',listeners:{'fileselected':function(button,value){var extension=value.substring(value.lastIndexOf('.')+1).toLowerCase()
if(extension!='jpg'&&extension!='gif'&&extension!='jpeg'&&extension!='png'){Ext.MessageBox.alert(OpenLayers.i18n('mymaps.unsupportedfiletitle'),OpenLayers.i18n('mymaps.unsupportedimagetypemsg'));return;}
this.getForm().submit({url:this.controler.uploadImageUrl,waitMsg:OpenLayers.i18n('mymaps.loading'),success:function(panel,o){uploadButton.button.setIcon(o.result.thumbnail);this.getForm().findField('thumbnail').setValue(o.result.thumbnail);this.getForm().findField('image').setValue(o.result.image);deleteButton.show();deleteButton.ownerCt.doLayout();},scope:this});},'render':function(field){new Ext.ToolTip({target:field.fileInput,html:OpenLayers.i18n('mymaps.uploadimagetip')});},scope:this}});var deleteButton=new Ext.ux.Hyperlink({text:OpenLayers.i18n('mymaps.deleteimage'),hidden:(feature.attributes['thumbnail'])?false:true,listeners:{'click':function(cmp){cmp.hide();uploadButton.button.setIcon(Ext.BLANK_IMAGE_URL);this.getForm().findField('thumbnail').setValue('');this.getForm().findField('image').setValue('');},scope:this}});if(!feature.isLabel){oItems.push({xtype:'compositefield',fieldLabel:OpenLayers.i18n('mymaps.image'),items:[{xtype:'box',height:50,width:1},uploadButton,deleteButton]});}
var colorField=new Ext.form.Hidden({name:'color',value:feature.attributes['color']});oItems.push(colorField);var color=(feature.attributes['color'])?feature.attributes['color']:'#00FF00';oItems.push({xtype:'compositefield',fieldLabel:OpenLayers.i18n('mymaps.color'),items:[{xtype:'displayfield',value:''},{xtype:'button',text:'&nbsp;&nbsp;&nbsp;&nbsp;',menu:{xtype:'colormenu',value:color.replace('#',''),listeners:{select:function(menu,color){color="#"+color;menu.ownerCt.ownerCt.btnEl.setStyle("background",color);colorField.setValue(color);this.parseFormFieldsToFeatureAttributes(feature);},scope:this}},listeners:{render:function(button){button.btnEl.setStyle("background",color);}}}]});oItems.push({xtype:'spinnerfield',name:'stroke',fieldLabel:OpenLayers.i18n('mymaps.width'),value:feature.attributes.stroke||((feature.isLabel)?12:1),width:40,minValue:feature.isLabel?10:1,maxValue:feature.isLabel?20:10,listeners:{spin:function(spinner){this.parseFormFieldsToFeatureAttributes(feature);},scope:this}});Ext.apply(this,{items:oItems});},parseFormFieldsToFeatureAttributes:function(feature){for(attribute in feature.attributes){var field=this.getForm().findField(attribute);if(field){feature.attributes[attribute]=field.getValue();}}
var symbolizer=feature.layer.styleMap.createSymbolizer(feature,'default');feature.style=symbolizer;feature.layer.drawFeature(feature);feature.layer.events.triggerEvent("featuremodified",{feature:feature});},beforeDestroy:function(){delete this.feature;}});Ext.namespace("GeoExt.ux.data");GeoExt.ux.data.getFeatureEditingDefaultStyleStoreOptions=function(){return{fields:['name','style'],data:[[OpenLayers.i18n('blue'),{fillColor:'blue',strokeColor:'blue'}],[OpenLayers.i18n('red'),{fillColor:'red',strokeColor:'red'}],[OpenLayers.i18n('green'),{fillColor:'green',strokeColor:'green'}],[OpenLayers.i18n('yellow'),{fillColor:'yellow',strokeColor:'yellow'}],[OpenLayers.i18n('orange'),{fillColor:'#FFA500',strokeColor:'#FFA500'}],[OpenLayers.i18n('purple'),{fillColor:'purple',strokeColor:'purple'}],[OpenLayers.i18n('white'),{fillColor:'white',strokeColor:'white'}],[OpenLayers.i18n('black'),{fillColor:'black',strokeColor:'black'}],[OpenLayers.i18n('gray'),{fillColor:'gray',strokeColor:'gray'}],[OpenLayers.i18n('pink'),{fillColor:'#FFC0CB',strokeColor:'#FFC0CB'}],[OpenLayers.i18n('brown'),{fillColor:'#A52A2A',strokeColor:'#A52A2A'}],[OpenLayers.i18n('cyan'),{fillColor:'#00FFFF',strokeColor:'#00FFFF'}],[OpenLayers.i18n('lime'),{fillColor:'lime',strokeColor:'lime'}],[OpenLayers.i18n('indigo'),{fillColor:'#4B0082',strokeColor:'#4B0082'}],[OpenLayers.i18n('magenta'),{fillColor:'#FF00FF',strokeColor:'#FF00FF'}],[OpenLayers.i18n('maroon'),{fillColor:'maroon',strokeColor:'maroon'}],[OpenLayers.i18n('olive'),{fillColor:'olive',strokeColor:'olive'}],[OpenLayers.i18n('plum'),{fillColor:'#DDA0DD',strokeColor:'#DDA0DD'}],[OpenLayers.i18n('salmon'),{fillColor:'#FA8072',strokeColor:'#FA8072'}],[OpenLayers.i18n('gold'),{fillColor:'#FFD700',strokeColor:'#FFD700'}],[OpenLayers.i18n('silver'),{fillColor:'silver',strokeColor:'silver'}]]}};Ext.namespace("GeoExt");GeoExt.SliderTip=Ext.extend(Ext.slider.Tip,{hover:true,minWidth:10,offsets:[0,-10],dragging:false,init:function(slider){GeoExt.SliderTip.superclass.init.apply(this,arguments);if(this.hover){slider.on("render",this.registerThumbListeners,this);}
this.slider=slider;},registerThumbListeners:function(){var thumb,el;for(var i=0,ii=this.slider.thumbs.length;i<ii;++i){thumb=this.slider.thumbs[i];el=thumb.tracker.el;(function(thumb,el){el.on({mouseover:function(e){this.onSlide(this.slider,e,thumb);this.dragging=false;},mouseout:function(){if(!this.dragging){this.hide.apply(this,arguments);}},scope:this})}).apply(this,[thumb,el]);}},onSlide:function(slider,e,thumb){this.dragging=true;return GeoExt.SliderTip.superclass.onSlide.apply(this,arguments);}});Ext.namespace("GeoExt");GeoExt.LayerOpacitySliderTip=Ext.extend(GeoExt.SliderTip,{template:'<div>{opacity}%</div>',compiledTemplate:null,init:function(slider){this.compiledTemplate=new Ext.Template(this.template);GeoExt.LayerOpacitySliderTip.superclass.init.call(this,slider);},getText:function(thumb){var data={opacity:thumb.value};return this.compiledTemplate.apply(data);}});Ext.namespace('GeoExt.ux');GeoExt.ux.LayerManagerImportPanel=Ext.extend(Ext.Panel,{map:null,border:false,defaultFormat:'KML',layer:null,formatCombo:null,initComponent:function(){this.formatCombo=new Ext.form.ComboBox({id:'layermanagerimportformat',fieldLabel:OpenLayers.i18n('Format'),store:GeoExt.ux.data.FormatStore,displayField:'shortName',typeAhead:true,mode:'local',triggerAction:'all',emptyText:'Select a format...',selectOnFocus:true,resizable:true});this.formatCombo.setValue(this.defaultFormat);this.fileSelectorBox=new Ext.BoxComponent({id:'fileSelectorBox',autoEl:{html:'<input type="file" name="fileselector" id="fileselector"/>'}});this.items=[{layout:'form',border:false,items:[{layout:'column',border:false,defaults:{layout:'form',border:false,bodyStyle:'padding:5px 5px 5px 5px'},items:[{columnWidth:1,defaults:{anchor:'100%'},items:[this.formatCombo]}]}]},{layout:'column',border:false,defaults:{layout:'form',border:false,bodyStyle:'padding:5px 5px 5px 5px'},items:[{columnWidth:1,bodyCfg:{tag:'center'},items:[this.fileSelectorBox]}]},{layout:'column',border:false,defaults:{layout:'form',border:false,bodyStyle:'padding:5px 5px 5px 5px'},items:[{columnWidth:1,bodyCfg:{tag:'center'},items:[{xtype:'button',text:OpenLayers.i18n('Import'),handler:function(){if(document.getElementById('fileselector').value==""){alert(OpenLayers.i18n('Select a file to import'));}else{var filecontent;if(Ext.isIE){try{var objFSO=new ActiveXObject("Scripting.FileSystemObject");if(objFSO.FileExists(document.getElementById('fileselector').value)){filecontent=objFSO.OpenTextFile(document.getElementById('fileselector').value,1).ReadAll();}}
catch(e)
{alert('Dear IE user. Add this site in the list of trusted site and activate the ActiveX. '+e.description);return;}}else if(Ext.isGecko){filecontent=document.getElementById('fileselector').files.item(0).getAsText('UTF-8');}else{alert('Your browser is not supported. Patch welcome !');return;}
this.fireEvent('beforedataimported',this,this.formatCombo.getValue(),filecontent);this.layer=GeoExt.ux.data.Import(this.map,this.layer,this.formatCombo.getValue(),filecontent,null);this.fireEvent('dataimported',this,this.formatCombo.getValue(),filecontent,GeoExt.ux.data.importFeatures);}},scope:this}]}]}];this.addEvents('dataimported','beforedataimported');GeoExt.ux.LayerManagerImportPanel.superclass.initComponent.call(this);}});Ext.reg('gxux_layermanagerimportpanel',GeoExt.ux.LayerManagerImportPanel);OpenLayers.Util.extend(OpenLayers.Lang.fr,{'Attributes':'Attributs','Delete feature':'Supprimer objet','Delete Feature':'Supprimer Objet','Do you really want to delete this feature ?':'Voulez-vous vraiment supprimer cet objet ?','Delete':'Supprimer','Export KML':'Exporter KML','Export':'Exporter','Import KML':'Importer KML','Import':'Importer','Edit Feature':'Editer Objet','LineString':'Ligne','MultiLineString':'MultiLigne','Point':'Point','MultiPoint':'MultiPoint','Polygon':'Polygone','MultiPolygon':'MultiPolygone','Label':'Etiquette','Create point':'CrÃ©er point','Create line':'CrÃ©er ligne','Create polygon':'CrÃ©er polygone','Create label':'CrÃ©er Ã©tiquette','Delete all features':'Supprimer tous les objets','DeleteAll':'Tous supprimer','Delete All Features':'Supprimer Tous Les Objets','Do you really want to delete all features ?':'Voulez-vous vraiment supprimer tous les objets ?','RedLining Panel':'Outil de dessin','Close':'Fermer','Style':'Style','color':'couleur','select a color...':'couleur...','blue':'bleu','red':'rouge','green':'vert','yellow':'jaune','orange':'orange','purple':'violet','white':'blanc','black':'noir','gray':'gris','pink':'rose','brown':'brun','cyan':'cyan','lime':'lime','indigo':'indigo','magenta':'magenta','maroon':'maron','olive':'olive','plum':'prune','salmon':'saumon','gold':'or','silver':'argent'});(function(){Downloadify=window.Downloadify={queue:{},uid:(new Date).getTime(),getTextForSave:function(b){if(b=Downloadify.queue[b])return b.getData();return""},getFileNameForSave:function(b){if(b=Downloadify.queue[b])return b.getFilename();return""},saveComplete:function(b){(b=Downloadify.queue[b])&&b.complete();return true},saveCancel:function(b){(b=Downloadify.queue[b])&&b.cancel();return true},saveError:function(b){(b=Downloadify.queue[b])&&b.error();return true},addToQueue:function(b){Downloadify.queue[b.queue_name]=b},getUID:function(b){if(b.id=="")b.id="downloadify_"+Downloadify.uid++;return b.id}};Downloadify.create=function(b,c){b=typeof b=="string"?document.getElementById(b):b;return new Downloadify.Container(b,c)};Downloadify.Container=function(b,c){var a=this;a.el=b;a.enabled=true;a.dataCallback=null;a.filenameCallback=null;a.data=null;a.filename=null;function f(){a.options=c;if(!a.options.append)a.el.innerHTML="";a.flashContainer=document.createElement("span");a.el.appendChild(a.flashContainer);a.queue_name=Downloadify.getUID(a.flashContainer);if(typeof a.options.filename==="function")a.filenameCallback=a.options.filename;else if(a.options.filename)a.filename=a.options.filename;if(typeof a.options.data==="function")a.dataCallback=a.options.data;else if(a.options.data)a.data=a.options.data;var d={queue_name:a.queue_name,width:a.options.width,height:a.options.height},e={allowScriptAccess:"always"},g={id:a.flashContainer.id,name:a.flashContainer.id};if(a.options.enabled===false)a.enabled=false;if(a.options.transparent===true)e.wmode="transparent";if(a.options.downloadImage)d.downloadImage=a.options.downloadImage;swfobject.embedSWF(a.options.swf,a.flashContainer.id,a.options.width,a.options.height,"10",null,d,e,g);Downloadify.addToQueue(a)}a.enable=function(){var d=document.getElementById(a.flashContainer.id);d.setEnabled(true);a.enabled=true};a.disable=function(){var d=document.getElementById(a.flashContainer.id);d.setEnabled(false);a.enabled=false};a.getData=function(){if(!a.enabled)return"";return a.dataCallback?a.dataCallback():a.data?a.data:""};a.getFilename=function(){return a.filenameCallback?a.filenameCallback():a.filename?a.filename:""};a.complete=function(){typeof a.options.onComplete==="function"&&a.options.onComplete()};a.cancel=function(){typeof a.options.onCancel==="function"&&a.options.onCancel()};a.error=function(){typeof a.options.onError==="function"&&a.options.onError()};f()};Downloadify.defaultOptions={swf:"media/downloadify.swf",downloadImage:"images/download.png",width:100,height:30,transparent:true,append:false}})();typeof jQuery!="undefined"&&function(b){b.fn.downloadify=function(c){return this.each(function(){c=b.extend({},Downloadify.defaultOptions,c);var a=Downloadify.create(this,c);b(this).data("Downloadify",a)})}}(jQuery);Ext.namespace('GeoExt','GeoExt.data');GeoExt.data.ProtocolProxy=function(config){Ext.apply(this,config);GeoExt.data.ProtocolProxy.superclass.constructor.apply(this,arguments);};Ext.extend(GeoExt.data.ProtocolProxy,Ext.data.DataProxy,{protocol:null,abortPrevious:true,setParamsAsOptions:false,response:null,load:function(params,reader,callback,scope,arg){if(this.fireEvent("beforeload",this,params)!==false){var o={params:params||{},request:{callback:callback,scope:scope,arg:arg},reader:reader};var cb=OpenLayers.Function.bind(this.loadResponse,this,o);if(this.abortPrevious){this.abortRequest();}
var options={params:params,callback:cb,scope:this};Ext.applyIf(options,arg);if(this.setParamsAsOptions===true){Ext.applyIf(options,options.params);delete options.params;}
this.response=this.protocol.read(options);}else{callback.call(scope||this,null,arg,false);}},abortRequest:function(){if(this.response){this.protocol.abort(this.response);this.response=null;}},loadResponse:function(o,response){if(response.success()){var result=o.reader.read(response);this.fireEvent("load",this,o,o.request.arg);o.request.callback.call(o.request.scope,result,o.request.arg,true);}else{this.fireEvent("loadexception",this,o,response);o.request.callback.call(o.request.scope,null,o.request.arg,false);}}});Ext.namespace("geoadmin.API");geoadmin.API.ArgParser=OpenLayers.Class(MapFish.API.ArgParser,{initialize:function(options){MapFish.API.ArgParser.prototype.initialize.apply(this,arguments);this.coordsParams=options&&options.coordsParams||{lon:'Y',lat:'X'};},setMap:function(map){MapFish.API.ArgParser.prototype.setMap.apply(this,arguments);var args=OpenLayers.Util.getParameters();if(args.selectedNode){this.api.getInspireCatalogPanel().selectedNodeId=args.selectedNode;}
if(args.layers){if(typeof args.layers=='string'){args.layers=[args.layers];args.layers_indices=[args.layers_indices];args.layers_opacity=[args.layers_opacity];args.layers_visibility=[args.layers_visibility];}
this.api.permalinkLayers=args.layers;this.api.permalinkLayersIndices=args.layers_indices;this.api.permalinkLayersOpacity=args.layers_opacity;this.api.permalinkLayersVisibility=args.layers_visibility;}
if(args.crosshair){this.api.crosshair=args.crosshair;}else{this.api.crosshair=false;}
if(typeof args.bgOpacity!='undefined'){if(parseInt(args.bgOpacity)<100){this.api.mapOpacityValue=parseInt(args.bgOpacity);}}
if(args.scale){this.zoom=this.getZoomFromScale(args.scale);this.setCenter();}
if(args.noHeader){this.api.noHeader=args.noHeader;}
if(args.showLocation){this.api.showLocation=args.showLocation;}
if(args.showLocationInMap){this.api.showLocationInMap=args.showLocationInMap;}
for(var key in args){if(args[key]&&key!="mode"&&key!="lang"&&key!="selectedNode"&&key!="layers"&&key!="bgOpacity"&&key!="bgLayer"&&key!="zoom"&&key!="X"&&key!="Y"&&key!="scale"&&key!="layers_indices"&&key!="layers_opacity"&&key!="layers_visibility"&&key!="noHeader"&&key!="showLocation"){this.api.featuresToShow={layer:key,ids:args[key]};}}},getZoomFromScale:function(scale){if(scale=='6500000')return 0;if(scale=='5000000')return 1;if(scale=='2500000')return 2;if(scale=='1000000')return 3;if(scale=='500000')return 4;if(scale=='200000')return 5;if(scale=='100000')return 6;if(scale=='50000')return 7;if(scale=='25000')return 8;if(scale=='20000')return 9;if(scale=='10000')return 10;if(scale=='5000')return 11;},CLASS_NAME:"geoadmin.API.ArgParser"});Ext.namespace("GeoExt.data");GeoExt.data.FeatureRecord=Ext.data.Record.create([{name:"feature"},{name:"state"},{name:"fid"}]);GeoExt.data.FeatureRecord.prototype.getFeature=function(){return this.get("feature");};GeoExt.data.FeatureRecord.prototype.setFeature=function(feature){if(feature!==this.data.feature){this.dirty=true;if(!this.modified){this.modified={};}
if(this.modified.feature===undefined){this.modified.feature=this.data.feature;}
this.data.feature=feature;if(!this.editing){this.afterEdit();}}};GeoExt.data.FeatureRecord.create=function(o){var f=Ext.extend(GeoExt.data.FeatureRecord,{});var p=f.prototype;p.fields=new Ext.util.MixedCollection(false,function(field){return field.name;});GeoExt.data.FeatureRecord.prototype.fields.each(function(f){p.fields.add(f);});if(o){for(var i=0,len=o.length;i<len;i++){p.fields.add(new Ext.data.Field(o[i]));}}
f.getField=function(name){return p.fields.get(name);};return f;};Ext.namespace('GeoExt');GeoExt.FeatureRenderer=Ext.extend(Ext.BoxComponent,{feature:undefined,symbolizers:[OpenLayers.Feature.Vector.style["default"]],symbolType:"Polygon",resolution:1,minWidth:20,minHeight:20,renderers:["SVG","VML","Canvas"],rendererOptions:null,pointFeature:undefined,lineFeature:undefined,polygonFeature:undefined,renderer:null,initComponent:function(){GeoExt.FeatureRenderer.superclass.initComponent.apply(this,arguments);Ext.applyIf(this,{pointFeature:new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(0,0)),lineFeature:new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString([new OpenLayers.Geometry.Point(-8,-3),new OpenLayers.Geometry.Point(-3,3),new OpenLayers.Geometry.Point(3,-3),new OpenLayers.Geometry.Point(8,3)])),polygonFeature:new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(-8,-4),new OpenLayers.Geometry.Point(-6,-6),new OpenLayers.Geometry.Point(6,-6),new OpenLayers.Geometry.Point(8,-4),new OpenLayers.Geometry.Point(8,4),new OpenLayers.Geometry.Point(6,6),new OpenLayers.Geometry.Point(-6,6),new OpenLayers.Geometry.Point(-8,4)])]))});if(!this.feature){this.setFeature(null,{draw:false});}
this.addEvents("click");},initCustomEvents:function(){this.clearCustomEvents();this.el.on("click",this.onClick,this);},clearCustomEvents:function(){if(this.el&&this.el.removeAllListeners){this.el.removeAllListeners();}},onClick:function(){this.fireEvent("click",this);},onRender:function(ct,position){if(!this.el){this.el=document.createElement("div");this.el.id=this.getId();}
if(!this.renderer||!this.renderer.supported()){this.assignRenderer();}
this.renderer.map={getResolution:(function(){return this.resolution;}).createDelegate(this)};GeoExt.FeatureRenderer.superclass.onRender.apply(this,arguments);this.drawFeature();},afterRender:function(){GeoExt.FeatureRenderer.superclass.afterRender.apply(this,arguments);this.initCustomEvents();},onResize:function(w,h){this.setRendererDimensions();GeoExt.FeatureRenderer.superclass.onResize.apply(this,arguments);},setRendererDimensions:function(){var gb=this.feature.geometry.getBounds();var gw=gb.getWidth();var gh=gb.getHeight();var resolution=this.initialConfig.resolution;if(!resolution){resolution=Math.max(gw/this.width||0,gh/this.height||0)||1;}
this.resolution=resolution;var width=Math.max(this.width||this.minWidth,gw/resolution);var height=Math.max(this.height||this.minHeight,gh/resolution);var center=gb.getCenterPixel();var bhalfw=width*resolution/2;var bhalfh=height*resolution/2;var bounds=new OpenLayers.Bounds(center.x-bhalfw,center.y-bhalfh,center.x+bhalfw,center.y+bhalfh);this.renderer.setSize(new OpenLayers.Size(Math.round(width),Math.round(height)));this.renderer.setExtent(bounds,true);},assignRenderer:function(){for(var i=0,len=this.renderers.length;i<len;++i){var Renderer=OpenLayers.Renderer[this.renderers[i]];if(Renderer&&Renderer.prototype.supported()){this.renderer=new Renderer(this.el,this.rendererOptions);break;}}},setSymbolizers:function(symbolizers,options){this.symbolizers=symbolizers;if(!options||options.draw){this.drawFeature();}},setSymbolType:function(type,options){this.symbolType=type;this.setFeature(null,options);},setFeature:function(feature,options){this.feature=feature||this[this.symbolType.toLowerCase()+"Feature"];if(!options||options.draw){this.drawFeature();}},drawFeature:function(){this.renderer.clear();this.setRendererDimensions();var Symbolizer=OpenLayers.Symbolizer;var Text=Symbolizer&&Symbolizer.Text;var symbolizer,feature,geomType;for(var i=0,len=this.symbolizers.length;i<len;++i){symbolizer=this.symbolizers[i];feature=this.feature;if(!Text||!(symbolizer instanceof Text)){if(Symbolizer&&(symbolizer instanceof Symbolizer)){symbolizer=symbolizer.clone();if(!this.initialConfig.feature){geomType=symbolizer.CLASS_NAME.split(".").pop().toLowerCase();feature=this[geomType+"Feature"];}}else{symbolizer=Ext.apply({},symbolizer);}
this.renderer.drawFeature(feature.clone(),symbolizer);}}},update:function(options){options=options||{};if(options.feature){this.setFeature(options.feature,{draw:false});}else if(options.symbolType){this.setSymbolType(options.symbolType,{draw:false});}
if(options.symbolizers){this.setSymbolizers(options.symbolizers,{draw:false});}
this.drawFeature();},beforeDestroy:function(){this.clearCustomEvents();if(this.renderer){this.renderer.destroy();}}});Ext.reg('gx_renderer',GeoExt.FeatureRenderer);Ext.namespace("geoadmin.API");geoadmin.API.MousePosition=OpenLayers.Class(OpenLayers.Control.MousePosition,{epsg4326:new OpenLayers.Projection("EPSG:4326"),epsg32631:new OpenLayers.Projection("EPSG:32631"),epsg32632:new OpenLayers.Projection("EPSG:32632"),confSuffix:null,initialize:function(options){OpenLayers.Control.MousePosition.prototype.initialize.apply(this,arguments);this.confSuffix=this.suffix;},redraw:function(evt){var lonLat,lonLat2;if(evt==null){this.reset();return;}else{if(this.lastXy==null||Math.abs(evt.xy.x-this.lastXy.x)>this.granularity||Math.abs(evt.xy.y-this.lastXy.y)>this.granularity)
{this.lastXy=evt.xy;return;}
lonLat=this.map.getLonLatFromPixel(evt.xy);if(!lonLat){return;}
if(this.displayProjection){if(["EPSG:32631-2","EPSG:32631","EPSG:32632"].indexOf(this.displayProjection.projCode)!=-1){lonLat2=lonLat.clone();lonLat2.transform(this.map.getProjectionObject(),this.epsg4326);if(Math.floor(lonLat2.lon)>=6){this.displayProjection=this.epsg32632;this.suffix=" (UTM 32U)";}else{this.displayProjection=this.epsg32631;this.suffix=" (UTM 31U)";}}else{this.suffix=this.confSuffix;}
this.numDigits=this.displayProjection.projCode=="EPSG:4326"?5:0;lonLat.transform(this.map.getProjectionObject(),this.displayProjection);}
this.lastXy=evt.xy;}
var newHtml=this.formatOutput(lonLat);if(this.displayProjection.projCode=="EPSG:4326"){newHtml=OpenLayers.Util.getFormattedLonLat(lonLat.lon,'lon','dms')+" ("+lonLat.lon.toFixed(5)+"), "
+OpenLayers.Util.getFormattedLonLat(lonLat.lat,'lat','dms')+" ("+lonLat.lat.toFixed(5)+")";}
if(newHtml!=this.element.innerHTML){this.element.innerHTML=newHtml;}},autoActivate:true,destroy:function(){this.deactivate();OpenLayers.Control.prototype.destroy.apply(this,arguments);},activate:function(){if(OpenLayers.Control.prototype.activate.apply(this,arguments)){this.map.events.register('mousemove',this,this.redraw);this.map.events.register('mouseout',this,this.reset);this.redraw();return true;}else{return false;}},deactivate:function(){if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)){this.map.events.unregister('mousemove',this,this.redraw);this.map.events.unregister('mouseout',this,this.reset);this.element.innerHTML="";return true;}else{return false;}},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.div.left="";this.div.top="";this.element=this.div;}
return this.div;},setMap:function(){OpenLayers.Control.prototype.setMap.apply(this,arguments);}});OpenLayers.Format.GML=OpenLayers.Class(OpenLayers.Format.XML,{featureNS:"http://mapserver.gis.umn.edu/mapserver",featurePrefix:"feature",featureName:"featureMember",layerName:"features",geometryName:"geometry",collectionName:"FeatureCollection",gmlns:"http://www.opengis.net/gml",extractAttributes:true,xy:true,initialize:function(options){this.regExes={trimSpace:(/^\s*|\s*$/g),removeSpace:(/\s*/g),splitSpace:(/\s+/),trimComma:(/\s*,\s*/g)};OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}
var featureNodes=this.getElementsByTagNameNS(data.documentElement,this.gmlns,this.featureName);var features=[];for(var i=0;i<featureNodes.length;i++){var feature=this.parseFeature(featureNodes[i]);if(feature){features.push(feature);}}
return features;},parseFeature:function(node){var order=["MultiPolygon","Polygon","MultiLineString","LineString","MultiPoint","Point","Envelope"];var type,nodeList,geometry,parser;for(var i=0;i<order.length;++i){type=order[i];nodeList=this.getElementsByTagNameNS(node,this.gmlns,type);if(nodeList.length>0){parser=this.parseGeometry[type.toLowerCase()];if(parser){geometry=parser.apply(this,[nodeList[0]]);if(this.internalProjection&&this.externalProjection){geometry.transform(this.externalProjection,this.internalProjection);}}else{throw new TypeError("Unsupported geometry type: "+type);}
break;}}
var bounds;var boxNodes=this.getElementsByTagNameNS(node,this.gmlns,"Box");for(i=0;i<boxNodes.length;++i){var boxNode=boxNodes[i];var box=this.parseGeometry["box"].apply(this,[boxNode]);var parentNode=boxNode.parentNode;var parentName=parentNode.localName||parentNode.nodeName.split(":").pop();if(parentName==="boundedBy"){bounds=box;}else{geometry=box.toGeometry();}}
var attributes;if(this.extractAttributes){attributes=this.parseAttributes(node);}
var feature=new OpenLayers.Feature.Vector(geometry,attributes);feature.bounds=bounds;feature.gml={featureType:node.firstChild.nodeName.split(":")[1],featureNS:node.firstChild.namespaceURI,featureNSPrefix:node.firstChild.prefix};var childNode=node.firstChild;var fid;while(childNode){if(childNode.nodeType==1){fid=childNode.getAttribute("fid")||childNode.getAttribute("id");if(fid){break;}}
childNode=childNode.nextSibling;}
feature.fid=fid;return feature;},parseGeometry:{point:function(node){var nodeList,coordString;var coords=[];var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"pos");if(nodeList.length>0){coordString=nodeList[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.trimSpace,"");coords=coordString.split(this.regExes.splitSpace);}
if(coords.length==0){nodeList=this.getElementsByTagNameNS(node,this.gmlns,"coordinates");if(nodeList.length>0){coordString=nodeList[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.removeSpace,"");coords=coordString.split(",");}}
if(coords.length==0){nodeList=this.getElementsByTagNameNS(node,this.gmlns,"coord");if(nodeList.length>0){var xList=this.getElementsByTagNameNS(nodeList[0],this.gmlns,"X");var yList=this.getElementsByTagNameNS(nodeList[0],this.gmlns,"Y");if(xList.length>0&&yList.length>0){coords=[xList[0].firstChild.nodeValue,yList[0].firstChild.nodeValue];}}}
if(coords.length==2){coords[2]=null;}
if(this.xy){return new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);}
else{return new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2]);}},multipoint:function(node){var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"Point");var components=[];if(nodeList.length>0){var point;for(var i=0;i<nodeList.length;++i){point=this.parseGeometry.point.apply(this,[nodeList[i]]);if(point){components.push(point);}}}
return new OpenLayers.Geometry.MultiPoint(components);},linestring:function(node,ring){var nodeList,coordString;var coords=[];var points=[];nodeList=this.getElementsByTagNameNS(node,this.gmlns,"posList");if(nodeList.length>0){coordString=this.getChildValue(nodeList[0]);coordString=coordString.replace(this.regExes.trimSpace,"");coords=coordString.split(this.regExes.splitSpace);var dim=parseInt(nodeList[0].getAttribute("dimension"));var j,x,y,z;for(var i=0;i<coords.length/dim;++i){j=i*dim;x=coords[j];y=coords[j+1];z=(dim==2)?null:coords[j+2];if(this.xy){points.push(new OpenLayers.Geometry.Point(x,y,z));}else{points.push(new OpenLayers.Geometry.Point(y,x,z));}}}
if(coords.length==0){nodeList=this.getElementsByTagNameNS(node,this.gmlns,"coordinates");if(nodeList.length>0){coordString=this.getChildValue(nodeList[0]);coordString=coordString.replace(this.regExes.trimSpace,"");coordString=coordString.replace(this.regExes.trimComma,",");var pointList=coordString.split(this.regExes.splitSpace);for(var i=0;i<pointList.length;++i){coords=pointList[i].split(",");if(coords.length==2){coords[2]=null;}
if(this.xy){points.push(new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]));}else{points.push(new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2]));}}}}
var line=null;if(points.length!=0){if(ring){line=new OpenLayers.Geometry.LinearRing(points);}else{line=new OpenLayers.Geometry.LineString(points);}}
return line;},multilinestring:function(node){var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"LineString");var components=[];if(nodeList.length>0){var line;for(var i=0;i<nodeList.length;++i){line=this.parseGeometry.linestring.apply(this,[nodeList[i]]);if(line){components.push(line);}}}
return new OpenLayers.Geometry.MultiLineString(components);},polygon:function(node){var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"LinearRing");var components=[];if(nodeList.length>0){var ring;for(var i=0;i<nodeList.length;++i){ring=this.parseGeometry.linestring.apply(this,[nodeList[i],true]);if(ring){components.push(ring);}}}
return new OpenLayers.Geometry.Polygon(components);},multipolygon:function(node){var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"Polygon");var components=[];if(nodeList.length>0){var polygon;for(var i=0;i<nodeList.length;++i){polygon=this.parseGeometry.polygon.apply(this,[nodeList[i]]);if(polygon){components.push(polygon);}}}
return new OpenLayers.Geometry.MultiPolygon(components);},envelope:function(node){var components=[];var coordString;var envelope;var lpoint=this.getElementsByTagNameNS(node,this.gmlns,"lowerCorner");if(lpoint.length>0){var coords=[];if(lpoint.length>0){coordString=lpoint[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.trimSpace,"");coords=coordString.split(this.regExes.splitSpace);}
if(coords.length==2){coords[2]=null;}
if(this.xy){var lowerPoint=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);}else{var lowerPoint=new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2]);}}
var upoint=this.getElementsByTagNameNS(node,this.gmlns,"upperCorner");if(upoint.length>0){var coords=[];if(upoint.length>0){coordString=upoint[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.trimSpace,"");coords=coordString.split(this.regExes.splitSpace);}
if(coords.length==2){coords[2]=null;}
if(this.xy){var upperPoint=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);}else{var upperPoint=new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2]);}}
if(lowerPoint&&upperPoint){components.push(new OpenLayers.Geometry.Point(lowerPoint.x,lowerPoint.y));components.push(new OpenLayers.Geometry.Point(upperPoint.x,lowerPoint.y));components.push(new OpenLayers.Geometry.Point(upperPoint.x,upperPoint.y));components.push(new OpenLayers.Geometry.Point(lowerPoint.x,upperPoint.y));components.push(new OpenLayers.Geometry.Point(lowerPoint.x,lowerPoint.y));var ring=new OpenLayers.Geometry.LinearRing(components);envelope=new OpenLayers.Geometry.Polygon([ring]);}
return envelope;},box:function(node){var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"coordinates");var coordString;var coords,beginPoint=null,endPoint=null;if(nodeList.length>0){coordString=nodeList[0].firstChild.nodeValue;coords=coordString.split(" ");if(coords.length==2){beginPoint=coords[0].split(",");endPoint=coords[1].split(",");}}
if(beginPoint!==null&&endPoint!==null){return new OpenLayers.Bounds(parseFloat(beginPoint[0]),parseFloat(beginPoint[1]),parseFloat(endPoint[0]),parseFloat(endPoint[1]));}}},parseAttributes:function(node){var attributes={};var childNode=node.firstChild;var children,i,child,grandchildren,grandchild,name,value;while(childNode){if(childNode.nodeType==1){children=childNode.childNodes;for(i=0;i<children.length;++i){child=children[i];if(child.nodeType==1){grandchildren=child.childNodes;if(grandchildren.length==1){grandchild=grandchildren[0];if(grandchild.nodeType==3||grandchild.nodeType==4){name=(child.prefix)?child.nodeName.split(":")[1]:child.nodeName;value=grandchild.nodeValue.replace(this.regExes.trimSpace,"");attributes[name]=value;}}else{attributes[child.nodeName.split(":").pop()]=null;}}}
break;}
childNode=childNode.nextSibling;}
return attributes;},write:function(features){if(!(OpenLayers.Util.isArray(features))){features=[features];}
var gml=this.createElementNS("http://www.opengis.net/wfs","wfs:"+this.collectionName);for(var i=0;i<features.length;i++){gml.appendChild(this.createFeatureXML(features[i]));}
return OpenLayers.Format.XML.prototype.write.apply(this,[gml]);},createFeatureXML:function(feature){var geometry=feature.geometry;var geometryNode=this.buildGeometryNode(geometry);var geomContainer=this.createElementNS(this.featureNS,this.featurePrefix+":"+
this.geometryName);geomContainer.appendChild(geometryNode);var featureNode=this.createElementNS(this.gmlns,"gml:"+this.featureName);var featureContainer=this.createElementNS(this.featureNS,this.featurePrefix+":"+
this.layerName);var fid=feature.fid||feature.id;featureContainer.setAttribute("fid",fid);featureContainer.appendChild(geomContainer);for(var attr in feature.attributes){var attrText=this.createTextNode(feature.attributes[attr]);var nodename=attr.substring(attr.lastIndexOf(":")+1);var attrContainer=this.createElementNS(this.featureNS,this.featurePrefix+":"+
nodename);attrContainer.appendChild(attrText);featureContainer.appendChild(attrContainer);}
featureNode.appendChild(featureContainer);return featureNode;},buildGeometryNode:function(geometry){if(this.externalProjection&&this.internalProjection){geometry=geometry.clone();geometry.transform(this.internalProjection,this.externalProjection);}
var className=geometry.CLASS_NAME;var type=className.substring(className.lastIndexOf(".")+1);var builder=this.buildGeometry[type.toLowerCase()];return builder.apply(this,[geometry]);},buildGeometry:{point:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:Point");gml.appendChild(this.buildCoordinatesNode(geometry));return gml;},multipoint:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:MultiPoint");var points=geometry.components;var pointMember,pointGeom;for(var i=0;i<points.length;i++){pointMember=this.createElementNS(this.gmlns,"gml:pointMember");pointGeom=this.buildGeometry.point.apply(this,[points[i]]);pointMember.appendChild(pointGeom);gml.appendChild(pointMember);}
return gml;},linestring:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:LineString");gml.appendChild(this.buildCoordinatesNode(geometry));return gml;},multilinestring:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:MultiLineString");var lines=geometry.components;var lineMember,lineGeom;for(var i=0;i<lines.length;++i){lineMember=this.createElementNS(this.gmlns,"gml:lineStringMember");lineGeom=this.buildGeometry.linestring.apply(this,[lines[i]]);lineMember.appendChild(lineGeom);gml.appendChild(lineMember);}
return gml;},linearring:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:LinearRing");gml.appendChild(this.buildCoordinatesNode(geometry));return gml;},polygon:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:Polygon");var rings=geometry.components;var ringMember,ringGeom,type;for(var i=0;i<rings.length;++i){type=(i==0)?"outerBoundaryIs":"innerBoundaryIs";ringMember=this.createElementNS(this.gmlns,"gml:"+type);ringGeom=this.buildGeometry.linearring.apply(this,[rings[i]]);ringMember.appendChild(ringGeom);gml.appendChild(ringMember);}
return gml;},multipolygon:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:MultiPolygon");var polys=geometry.components;var polyMember,polyGeom;for(var i=0;i<polys.length;++i){polyMember=this.createElementNS(this.gmlns,"gml:polygonMember");polyGeom=this.buildGeometry.polygon.apply(this,[polys[i]]);polyMember.appendChild(polyGeom);gml.appendChild(polyMember);}
return gml;},bounds:function(bounds){var gml=this.createElementNS(this.gmlns,"gml:Box");gml.appendChild(this.buildCoordinatesNode(bounds));return gml;}},buildCoordinatesNode:function(geometry){var coordinatesNode=this.createElementNS(this.gmlns,"gml:coordinates");coordinatesNode.setAttribute("decimal",".");coordinatesNode.setAttribute("cs",",");coordinatesNode.setAttribute("ts"," ");var parts=[];if(geometry instanceof OpenLayers.Bounds){parts.push(geometry.left+","+geometry.bottom);parts.push(geometry.right+","+geometry.top);}else{var points=(geometry.components)?geometry.components:[geometry];for(var i=0;i<points.length;i++){parts.push(points[i].x+","+points[i].y);}}
var txtNode=this.createTextNode(parts.join(" "));coordinatesNode.appendChild(txtNode);return coordinatesNode;},CLASS_NAME:"OpenLayers.Format.GML"});OpenLayers.Format.GeoRSS=OpenLayers.Class(OpenLayers.Format.XML,{rssns:"http://backend.userland.com/rss2",featureNS:"http://mapserver.gis.umn.edu/mapserver",georssns:"http://www.georss.org/georss",geons:"http://www.w3.org/2003/01/geo/wgs84_pos#",featureTitle:"Untitled",featureDescription:"No Description",gmlParser:null,xy:false,createGeometryFromItem:function(item){var point=this.getElementsByTagNameNS(item,this.georssns,"point");var lat=this.getElementsByTagNameNS(item,this.geons,'lat');var lon=this.getElementsByTagNameNS(item,this.geons,'long');var line=this.getElementsByTagNameNS(item,this.georssns,"line");var polygon=this.getElementsByTagNameNS(item,this.georssns,"polygon");var where=this.getElementsByTagNameNS(item,this.georssns,"where");var box=this.getElementsByTagNameNS(item,this.georssns,"box");if(point.length>0||(lat.length>0&&lon.length>0)){var location;if(point.length>0){location=OpenLayers.String.trim(point[0].firstChild.nodeValue).split(/\s+/);if(location.length!=2){location=OpenLayers.String.trim(point[0].firstChild.nodeValue).split(/\s*,\s*/);}}else{location=[parseFloat(lat[0].firstChild.nodeValue),parseFloat(lon[0].firstChild.nodeValue)];}
var geometry=new OpenLayers.Geometry.Point(location[1],location[0]);}else if(line.length>0){var coords=OpenLayers.String.trim(this.getChildValue(line[0])).split(/\s+/);var components=[];var point;for(var i=0,len=coords.length;i<len;i+=2){point=new OpenLayers.Geometry.Point(coords[i+1],coords[i]);components.push(point);}
geometry=new OpenLayers.Geometry.LineString(components);}else if(polygon.length>0){var coords=OpenLayers.String.trim(this.getChildValue(polygon[0])).split(/\s+/);var components=[];var point;for(var i=0,len=coords.length;i<len;i+=2){point=new OpenLayers.Geometry.Point(coords[i+1],coords[i]);components.push(point);}
geometry=new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing(components)]);}else if(where.length>0){if(!this.gmlParser){this.gmlParser=new OpenLayers.Format.GML({'xy':this.xy});}
var feature=this.gmlParser.parseFeature(where[0]);geometry=feature.geometry;}else if(box.length>0){var coords=OpenLayers.String.trim(box[0].firstChild.nodeValue).split(/\s+/);var components=[];var point;if(coords.length>3){point=new OpenLayers.Geometry.Point(coords[1],coords[0]);components.push(point);point=new OpenLayers.Geometry.Point(coords[1],coords[2]);components.push(point);point=new OpenLayers.Geometry.Point(coords[3],coords[2]);components.push(point);point=new OpenLayers.Geometry.Point(coords[3],coords[0]);components.push(point);point=new OpenLayers.Geometry.Point(coords[1],coords[0]);components.push(point);}
geometry=new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing(components)]);}
if(geometry&&this.internalProjection&&this.externalProjection){geometry.transform(this.externalProjection,this.internalProjection);}
return geometry;},createFeatureFromItem:function(item){var geometry=this.createGeometryFromItem(item);var title=this._getChildValue(item,"*","title",this.featureTitle);var description=this._getChildValue(item,"*","description",this._getChildValue(item,"*","content",this._getChildValue(item,"*","summary",this.featureDescription)));var link=this._getChildValue(item,"*","link");if(!link){try{link=this.getElementsByTagNameNS(item,"*","link")[0].getAttribute("href");}catch(e){link=null;}}
var id=this._getChildValue(item,"*","id",null);var data={"title":title,"description":description,"link":link};var feature=new OpenLayers.Feature.Vector(geometry,data);feature.fid=id;return feature;},_getChildValue:function(node,nsuri,name,def){var value;var eles=this.getElementsByTagNameNS(node,nsuri,name);if(eles&&eles[0]&&eles[0].firstChild&&eles[0].firstChild.nodeValue){value=this.getChildValue(eles[0]);}else{value=(def==undefined)?"":def;}
return value;},read:function(doc){if(typeof doc=="string"){doc=OpenLayers.Format.XML.prototype.read.apply(this,[doc]);}
var itemlist=null;itemlist=this.getElementsByTagNameNS(doc,'*','item');if(itemlist.length==0){itemlist=this.getElementsByTagNameNS(doc,'*','entry');}
var numItems=itemlist.length;var features=new Array(numItems);for(var i=0;i<numItems;i++){features[i]=this.createFeatureFromItem(itemlist[i]);}
return features;},write:function(features){var georss;if(OpenLayers.Util.isArray(features)){georss=this.createElementNS(this.rssns,"rss");for(var i=0,len=features.length;i<len;i++){georss.appendChild(this.createFeatureXML(features[i]));}}else{georss=this.createFeatureXML(features);}
return OpenLayers.Format.XML.prototype.write.apply(this,[georss]);},createFeatureXML:function(feature){var geometryNode=this.buildGeometryNode(feature.geometry);var featureNode=this.createElementNS(this.rssns,"item");var titleNode=this.createElementNS(this.rssns,"title");titleNode.appendChild(this.createTextNode(feature.attributes.title?feature.attributes.title:""));var descNode=this.createElementNS(this.rssns,"description");descNode.appendChild(this.createTextNode(feature.attributes.description?feature.attributes.description:""));featureNode.appendChild(titleNode);featureNode.appendChild(descNode);if(feature.attributes.link){var linkNode=this.createElementNS(this.rssns,"link");linkNode.appendChild(this.createTextNode(feature.attributes.link));featureNode.appendChild(linkNode);}
for(var attr in feature.attributes){if(attr=="link"||attr=="title"||attr=="description"){continue;}
var attrText=this.createTextNode(feature.attributes[attr]);var nodename=attr;if(attr.search(":")!=-1){nodename=attr.split(":")[1];}
var attrContainer=this.createElementNS(this.featureNS,"feature:"+nodename);attrContainer.appendChild(attrText);featureNode.appendChild(attrContainer);}
featureNode.appendChild(geometryNode);return featureNode;},buildGeometryNode:function(geometry){if(this.internalProjection&&this.externalProjection){geometry=geometry.clone();geometry.transform(this.internalProjection,this.externalProjection);}
var node;if(geometry.CLASS_NAME=="OpenLayers.Geometry.Polygon"){node=this.createElementNS(this.georssns,'georss:polygon');node.appendChild(this.buildCoordinatesNode(geometry.components[0]));}
else if(geometry.CLASS_NAME=="OpenLayers.Geometry.LineString"){node=this.createElementNS(this.georssns,'georss:line');node.appendChild(this.buildCoordinatesNode(geometry));}
else if(geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){node=this.createElementNS(this.georssns,'georss:point');node.appendChild(this.buildCoordinatesNode(geometry));}else{throw"Couldn't parse "+geometry.CLASS_NAME;}
return node;},buildCoordinatesNode:function(geometry){var points=null;if(geometry.components){points=geometry.components;}
var path;if(points){var numPoints=points.length;var parts=new Array(numPoints);for(var i=0;i<numPoints;i++){parts[i]=points[i].y+" "+points[i].x;}
path=parts.join(" ");}else{path=geometry.y+" "+geometry.x;}
return this.createTextNode(path);},CLASS_NAME:"OpenLayers.Format.GeoRSS"});Ext.namespace("GeoExt.data");GeoExt.data.ScaleStore=Ext.extend(Ext.data.Store,{map:null,constructor:function(config){var map=(config.map instanceof GeoExt.MapPanel?config.map.map:config.map);delete config.map;config=Ext.applyIf(config,{reader:new Ext.data.JsonReader({},["level","resolution","scale"])});GeoExt.data.ScaleStore.superclass.constructor.call(this,config);if(map){this.bind(map);}},bind:function(map,options){this.map=(map instanceof GeoExt.MapPanel?map.map:map);this.map.events.register('changebaselayer',this,this.populateFromMap);if(this.map.baseLayer){this.populateFromMap();}else{this.map.events.register('addlayer',this,this.populateOnAdd);}},unbind:function(){if(this.map){this.map.events.unregister('addlayer',this,this.populateOnAdd);this.map.events.unregister('changebaselayer',this,this.populateFromMap);delete this.map;}},populateOnAdd:function(evt){if(evt.layer.isBaseLayer){this.populateFromMap();this.map.events.unregister('addlayer',this,this.populateOnAdd);}},populateFromMap:function(){var zooms=[];var resolutions=this.map.baseLayer.resolutions;var units=this.map.baseLayer.units;for(var i=resolutions.length-1;i>=0;i--){var res=resolutions[i];zooms.push({level:i,resolution:res,scale:OpenLayers.Util.getScaleFromResolution(res,units)});}
this.loadData(zooms);},destroy:function(){this.unbind();GeoExt.data.ScaleStore.superclass.destroy.apply(this,arguments);}});Ext.namespace("GeoExt.ux");GeoExt.ux.ExportFeature=Ext.extend(Ext.util.Observable,{controler:null,editFeatureForm:null,init:function(form){this.controler=form.controler;var actionOptions={handler:this.exportFeatures,scope:this,tooltip:OpenLayers.i18n('Export KML')};if(this.controler.useIcons===true){actionOptions.iconCls="gx-featureediting-export";}else{actionOptions.text=OpenLayers.i18n("Export");}
var action=new Ext.Action(actionOptions);var bbar=form.getBottomToolbar();if(bbar.rendered||!bbar.buttons){bbar.add(action);}else{bbar.buttons.push(action);}
this.editFeatureForm=form;},exportFeatures:function(){var map=this.controler.map;var downloadService=this.controler.downloadService;var features=this.editFeatureForm.features;this.controler.triggerAutoSave();GeoExt.ux.data.Export.KMLExport(map,null,features,downloadService);}});Ext.namespace("GeoExt.ux");GeoExt.ux.CloseFeatureDialog=Ext.extend(Ext.util.Observable,{controler:null,editFeatureForm:null,init:function(form){this.controler=form.controler;var actionOptions={handler:this.closeFeatureDialog,scope:this,tooltip:OpenLayers.i18n('Close')};actionOptions.text=OpenLayers.i18n("Close");var action=new Ext.Action(actionOptions);var bbar=form.getBottomToolbar();if(bbar.rendered||!bbar.buttons){bbar.add('->');bbar.add(action);}else{bbar.buttons.push('->');bbar.buttons.push(action);}
this.editFeatureForm=form;},closeFeatureDialog:function(){this.controler.triggerAutoSave();if(this.controler.popup){this.controler.popup.close();}
this.controler.reactivateDrawControl();}});Ext.namespace("GeoExt","GeoExt.data");GeoExt.data.LayerReader=function(meta,recordType){meta=meta||{};if(!(recordType instanceof Function)){recordType=GeoExt.data.LayerRecord.create(recordType||meta.fields||{});}
GeoExt.data.LayerReader.superclass.constructor.call(this,meta,recordType);};Ext.extend(GeoExt.data.LayerReader,Ext.data.DataReader,{totalRecords:null,readRecords:function(layers){var records=[];if(layers){var recordType=this.recordType,fields=recordType.prototype.fields;var i,lenI,j,lenJ,layer,values,field,v;for(i=0,lenI=layers.length;i<lenI;i++){layer=layers[i];values={};for(j=0,lenJ=fields.length;j<lenJ;j++){field=fields.items[j];v=layer[field.mapping||field.name]||field.defaultValue;v=field.convert(v);values[field.name]=v;}
values.layer=layer;records[records.length]=new recordType(values,layer.id);}}
return{records:records,totalRecords:this.totalRecords!=null?this.totalRecords:records.length};}});Ext.namespace("GeoExt.ux.data");GeoExt.ux.data.Export=function(map,format,layers,features){var exportLayers=[];var exportFeatures=[];if(features){exportFeatures=features;}else{if(layers){exportLayers=layers;}else{for(var i=0;i<map.layers.length;i++){var layer=map.layers[i];if(layer.CLASS_NAME){if(GeoExt.ux.data.Export.isLayerSupported(layer.CLASS_NAME)){exportLayers.push(layer);}}}}
for(var j=0;j<exportLayers.length;j++){var exportLayer=exportLayers[j];if(exportLayer.features){for(var k=0;k<exportLayer.features.length;k++){exportFeatures.push(exportLayer.features[k]);}}}}
if(format=='KML'){var kmlWriter=new OpenLayers.Format.KML(OpenLayers.Util.extend({externalProjection:new OpenLayers.Projection("EPSG:4326"),internalProjection:map.getProjectionObject()},GeoExt.ux.data.formats.getFormatConfig(format)));return kmlWriter.write(exportFeatures);}else if(format=='GeoJSON'){var geojsonWriter=new OpenLayers.Format.GeoJSON(GeoExt.ux.data.formats.getFormatConfig(format));return geojsonWriter.write(exportFeatures);}else if(format=='GeoRSS'){var georssWriter=new OpenLayers.Format.GeoRSS(GeoExt.ux.data.formats.getFormatConfig(format));return georssWriter.write(exportFeatures);}else if(format=='GML'){var gmlWriter=new OpenLayers.Format.GML(GeoExt.ux.data.formats.getFormatConfig(format));return gmlWriter.write(exportFeatures);}else{return'Format '+format+' not supported. Patch welcome !';}};GeoExt.ux.data.Export.content=null;GeoExt.ux.data.Export.format=null;GeoExt.ux.data.Export.exportWindow=null;GeoExt.ux.data.Export.SupportedLayerType=[['OpenLayers.Layer.Vector'],['OpenLayers.Layer.WFS'],['OpenLayers.Layer.GML'],['OpenLayers.Layer.GeoRSS']];GeoExt.ux.data.Export.isLayerSupported=function(className){for(var i=0;i<GeoExt.ux.data.Export.SupportedLayerType.length;i++){if(GeoExt.ux.data.Export.SupportedLayerType[i][0]===className){return true;}}
return false;};GeoExt.ux.data.Export.OpenWindowDownloadify=function(){GeoExt.ux.data.Export.exportWindow=new GeoExt.ux.LayerManagerExportWindow({filename:'export.'+GeoExt.ux.data.Export.format.toLowerCase(),filecontent:GeoExt.ux.data.Export.content.replace(/&lt;/g,'<').replace(/&gt;/g,'>')});GeoExt.ux.data.Export.exportWindow.show();};GeoExt.ux.data.Export.KMLExport=function(map,layers,features,downloadService){GeoExt.ux.data.Export.format='KML';GeoExt.ux.data.Export.content=GeoExt.ux.data.Export(map,GeoExt.ux.data.Export.format,layers,features);if(downloadService){var form=document.createElement("form");form.setAttribute("method",'POST');form.setAttribute("action",downloadService);var formatField=document.createElement("input");formatField.setAttribute("type","hidden");formatField.setAttribute("name","format");formatField.setAttribute("value",GeoExt.ux.data.Export.format);var contentField=document.createElement("input");contentField.setAttribute("type","hidden");contentField.setAttribute("name","content");contentField.setAttribute("value",GeoExt.ux.data.Export.content.replace(/&lt;/g,'<').replace(/&gt;/g,'>'));form.appendChild(formatField);form.appendChild(contentField);document.body.appendChild(form);form.submit();}else{if(GetFlashVersion()>10.00){GeoExt.ux.data.Export.OpenWindowDownloadify();}else{alert('Please install Flash 10 in order to use the following window.');GeoExt.ux.data.Export.OpenWindowDownloadify();}}};Ext.namespace('GeoExt','GeoExt.data');GeoExt.data.FeatureReader=function(meta,recordType){meta=meta||{};if(!(recordType instanceof Function)){recordType=GeoExt.data.FeatureRecord.create(recordType||meta.fields||{});}
GeoExt.data.FeatureReader.superclass.constructor.call(this,meta,recordType);};Ext.extend(GeoExt.data.FeatureReader,Ext.data.DataReader,{totalRecords:null,read:function(response){return this.readRecords(response.features);},readRecords:function(features){var records=[];if(features){var recordType=this.recordType,fields=recordType.prototype.fields;var i,lenI,j,lenJ,feature,values,field,v;for(i=0,lenI=features.length;i<lenI;i++){feature=features[i];values={};if(feature.attributes){for(j=0,lenJ=fields.length;j<lenJ;j++){field=fields.items[j];if(/[\[\.]/.test(field.mapping)){try{v=new Function("obj","return obj."+field.mapping)(feature.attributes);}catch(e){v=field.defaultValue;}}
else{v=feature.attributes[field.mapping||field.name]||field.defaultValue;}
if(field.convert){v=field.convert(v);}
values[field.name]=v;}}
values.feature=feature;values.state=feature.state;values.fid=feature.fid;var id=(feature.state===OpenLayers.State.INSERT)?undefined:feature.id;records[records.length]=new recordType(values,id);}}
return{records:records,totalRecords:this.totalRecords!=null?this.totalRecords:records.length};}});Ext.namespace("geoadmin");geoadmin.Elevation=OpenLayers.Class(OpenLayers.Control,{serviceUrl:null,element:null,prefix:'',suffix:'',naString:'N/A',response:null,autoActivate:true,initialize:function(options){this.handler=new OpenLayers.Handler.Hover(this,{'move':this.cancel,'pause':this.getElevation},{'delay':250});OpenLayers.Control.prototype.initialize.apply(this,[options]);},activate:function(){if(!this.active){this.handler.activate();}
return OpenLayers.Control.prototype.activate.apply(this,arguments);},deactivate:function(){this.element.innerHTML="";if(this.active){this.handler.deactivate();}
return OpenLayers.Control.prototype.deactivate.apply(this,arguments);},cancel:function(){this.reset();if(this.response){this.response.abort();this.response=null;}},getElevation:function(evt){var point=this.map.getLonLatFromPixel(evt.xy);this.request(point);},request:function(point){this.response=OpenLayers.Request.GET({url:this.serviceUrl,params:{lon:point.lon,lat:point.lat},callback:function(result){var newHtml=this.formatoutput(result.responseText);this.element.innerHTML=newHtml;},scope:this});},reset:function(){this.element.innerHTML=this.prefix;},formatoutput:function(elevation){var newhtml;if(elevation!='None'){var digits=parseInt(this.numdigits);newhtml=this.prefix+
elevation+
this.suffix;}else{newhtml=this.prefix+this.naString;}
return newhtml;}});function GetFlashVersionActivex(i){try{var control=new ActiveXObject('ShockwaveFlash.ShockwaveFlash.'+i);var version=control.GetVariable("$version");var temp=version.split(" ");var version_array=temp[1].split(",");return parseFloat(version_array[0]+"."+version_array[2]);}
catch(e){return 0.0;}}
function GetFlashVersionPlugin(){var flash_version=0.0;if(navigator.plugins!==null&&navigator.plugins.length>0){if(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]){var plugin_name=navigator.plugins["Shockwave Flash 2.0"]?"Shockwave Flash 2.0":"Shockwave Flash";var flash_desc=navigator.plugins[plugin_name].description;var desc_segments=flash_desc.split(" ");var major_segments=desc_segments[2].split(".");var major=major_segments[0];var minor_segments=(desc_segments[3]!="")?desc_segments[3].split("r"):desc_segments[4].split("r");var minor=minor_segments[1]>0?minor_segments[1]:0;flash_version=parseFloat(major+"."+minor);}
else{flash_version=-1;}}
else if(navigator.userAgent.toLowerCase().indexOf("webtv/2.6")!=-1){flash_version=4;}
else if(navigator.userAgent.toLowerCase().indexOf("webtv/2.5")!=-1){flash_version=3;}
else if(navigator.userAgent.toLowerCase().indexOf("webtv")!=-1){flash_version=2;}
else{flash_version=-1;}
return flash_version;}
function GetFlashVersion(){var is_ie=navigator.appVersion.toLowerCase().indexOf("msie")!=-1;var is_win=navigator.appVersion.toLowerCase().indexOf("win")!=-1;var is_opera=navigator.userAgent.toLowerCase().indexOf("opera")!=-1;for(i=12;i>0;i--){var flash_version=(is_ie&&is_win&&!is_opera)?GetFlashVersionActivex(i):GetFlashVersionPlugin();if(flash_version!==0){return flash_version;}}
return 0.0;}
Ext.namespace('GeoExt.grid');GeoExt.grid.FeatureSelectionModelMixin=function(){return{autoActivateControl:true,layerFromStore:true,selectControl:null,bound:false,superclass:null,constructor:function(config){config=config||{};if(config.selectControl instanceof OpenLayers.Control.SelectFeature){if(!config.singleSelect){var ctrl=config.selectControl;config.singleSelect=!(ctrl.multiple||!!ctrl.multipleKey);}}else if(config.layer instanceof OpenLayers.Layer.Vector){this.selectControl=this.createSelectControl(config.layer,config.selectControl);delete config.layer;delete config.selectControl;}
this.superclass=arguments.callee.superclass;this.superclass.constructor.call(this,config);},initEvents:function(){this.superclass.initEvents.call(this);if(this.layerFromStore){var layer=this.grid.getStore()&&this.grid.getStore().layer;if(layer&&!(this.selectControl instanceof OpenLayers.Control.SelectFeature)){this.selectControl=this.createSelectControl(layer,this.selectControl);}}
if(this.selectControl){this.bind(this.selectControl);}},createSelectControl:function(layer,config){config=config||{};var singleSelect=config.singleSelect!==undefined?config.singleSelect:this.singleSelect;config=OpenLayers.Util.extend({toggle:true,multipleKey:singleSelect?null:(Ext.isMac?"metaKey":"ctrlKey")},config);var selectControl=new OpenLayers.Control.SelectFeature(layer,config);layer.map.addControl(selectControl);return selectControl;},bind:function(obj,options){if(!this.bound){options=options||{};this.selectControl=obj;if(obj instanceof OpenLayers.Layer.Vector){this.selectControl=this.createSelectControl(obj,options.controlConfig);}
if(this.autoActivateControl){this.selectControl.activate();}
var layers=this.getLayers();for(var i=0,len=layers.length;i<len;i++){layers[i].events.on({featureselected:this.featureSelected,featureunselected:this.featureUnselected,scope:this});}
this.on("rowselect",this.rowSelected,this);this.on("rowdeselect",this.rowDeselected,this);this.bound=true;}
return this.selectControl;},unbind:function(){var selectControl=this.selectControl;if(this.bound){var layers=this.getLayers();for(var i=0,len=layers.length;i<len;i++){layers[i].events.un({featureselected:this.featureSelected,featureunselected:this.featureUnselected,scope:this});}
this.un("rowselect",this.rowSelected,this);this.un("rowdeselect",this.rowDeselected,this);if(this.autoActivateControl){selectControl.deactivate();}
this.selectControl=null;this.bound=false;}
return selectControl;},featureSelected:function(evt){if(!this._selecting){var store=this.grid.store;var row=store.findBy(function(record,id){return record.getFeature()==evt.feature;});if(row!=-1&&!this.isSelected(row)){this._selecting=true;this.selectRow(row,!this.singleSelect);this._selecting=false;this.grid.getView().focusRow(row);}}},featureUnselected:function(evt){if(!this._selecting){var store=this.grid.store;var row=store.findBy(function(record,id){return record.getFeature()==evt.feature;});if(row!=-1&&this.isSelected(row)){this._selecting=true;this.deselectRow(row);this._selecting=false;this.grid.getView().focusRow(row);}}},rowSelected:function(model,row,record){var feature=record.getFeature();if(!this._selecting&&feature){var layers=this.getLayers();for(var i=0,len=layers.length;i<len;i++){if(layers[i].selectedFeatures.indexOf(feature)==-1){this._selecting=true;this.selectControl.select(feature);this._selecting=false;break;}}}},rowDeselected:function(model,row,record){var feature=record.getFeature();if(!this._selecting&&feature){var layers=this.getLayers();for(var i=0,len=layers.length;i<len;i++){if(layers[i].selectedFeatures.indexOf(feature)!=-1){this._selecting=true;this.selectControl.unselect(feature);this._selecting=false;break;}}}},getLayers:function(){return this.selectControl.layers||[this.selectControl.layer];}};};GeoExt.grid.FeatureSelectionModel=Ext.extend(Ext.grid.RowSelectionModel,new GeoExt.grid.FeatureSelectionModelMixin);
