OpenLayers={};OpenLayers.singleFile=true;
(function(){var a=typeof OpenLayers=="object"&&OpenLayers.singleFile;OpenLayers={_scriptName:!a?"lib/OpenLayers.js":"OpenLayers.js",_getScriptLocation:function(){var f=this._searchForLibraryLocation(document.getElementsByTagName("head")[0].childNodes);if(f==null)f=this._searchForLibraryLocation(document.getElementsByTagName("script"));return f==null?"":f},_searchForLibraryLocation:function(f){for(var g=null,h=OpenLayers._scriptName,j=0;j<f.length;j++)if(f[j].tagName=="SCRIPT"){var k=f[j].getAttribute("src");
if(k!=null){if(k.indexOf("?")>-1)k=k.substring(0,k.indexOf("?"));if(k){var m=k.lastIndexOf(h);if(m>-1&&m+h.length==k.length){g=k.slice(0,-h.length);break}}}}return g}};if(!a){a=new Array("OpenLayers/Util.js","OpenLayers/Console.js","OpenLayers/BaseTypes.js","OpenLayers/BaseTypes/Class.js","OpenLayers/BaseTypes/Bounds.js","OpenLayers/BaseTypes/Element.js","OpenLayers/BaseTypes/LonLat.js","OpenLayers/BaseTypes/Pixel.js","OpenLayers/BaseTypes/Size.js","Rico/Corner.js","Rico/Color.js","OpenLayers/Ajax.js",
"OpenLayers/Events.js","OpenLayers/Map.js","OpenLayers/Layer.js","OpenLayers/Icon.js","OpenLayers/Marker.js","OpenLayers/Marker/Box.js","OpenLayers/Popup.js","OpenLayers/Tile.js","OpenLayers/Tile/Image.js","OpenLayers/Tile/WFS.js","OpenLayers/Layer/Image.js","OpenLayers/Layer/SphericalMercator.js","OpenLayers/Layer/EventPane.js","OpenLayers/Layer/FixedZoomLevels.js","OpenLayers/Layer/Google.js","OpenLayers/Layer/VirtualEarth.js","OpenLayers/Layer/Yahoo.js","OpenLayers/Layer/HTTPRequest.js","OpenLayers/Layer/Grid.js",
"OpenLayers/Layer/MapServer.js","OpenLayers/Layer/MapServer/Untiled.js","OpenLayers/Layer/KaMap.js","OpenLayers/Layer/MultiMap.js","OpenLayers/Layer/Markers.js","OpenLayers/Layer/Text.js","OpenLayers/Layer/WorldWind.js","OpenLayers/Layer/WMS.js","OpenLayers/Layer/WMS/Untiled.js","OpenLayers/Layer/GeoRSS.js","OpenLayers/Layer/Boxes.js","OpenLayers/Layer/TMS.js","OpenLayers/Layer/TileCache.js","OpenLayers/Popup/Anchored.js","OpenLayers/Popup/AnchoredBubble.js","OpenLayers/Feature.js","OpenLayers/Feature/Vector.js",
"OpenLayers/Feature/WFS.js","OpenLayers/Handler.js","OpenLayers/Handler/Point.js","OpenLayers/Handler/Path.js","OpenLayers/Handler/Polygon.js","OpenLayers/Handler/Feature.js","OpenLayers/Handler/Drag.js","OpenLayers/Handler/RegularPolygon.js","OpenLayers/Handler/Box.js","OpenLayers/Handler/MouseWheel.js","OpenLayers/Handler/Keyboard.js","OpenLayers/Control.js","OpenLayers/Control/Attribution.js","OpenLayers/Control/ZoomBox.js","OpenLayers/Control/ZoomToMaxExtent.js","OpenLayers/Control/DragPan.js",
"OpenLayers/Control/Navigation.js","OpenLayers/Control/MouseDefaults.js","OpenLayers/Control/MousePosition.js","OpenLayers/Control/OverviewMap.js","OpenLayers/Control/KeyboardDefaults.js","OpenLayers/Control/PanZoom.js","OpenLayers/Control/PanZoomBar.js","OpenLayers/Control/ArgParser.js","OpenLayers/Control/Permalink.js","OpenLayers/Control/Scale.js","OpenLayers/Control/LayerSwitcher.js","OpenLayers/Control/DrawFeature.js","OpenLayers/Control/DragFeature.js","OpenLayers/Control/ModifyFeature.js",
"OpenLayers/Control/Panel.js","OpenLayers/Control/SelectFeature.js","OpenLayers/Geometry.js","OpenLayers/Geometry/Rectangle.js","OpenLayers/Geometry/Collection.js","OpenLayers/Geometry/Point.js","OpenLayers/Geometry/MultiPoint.js","OpenLayers/Geometry/Curve.js","OpenLayers/Geometry/LineString.js","OpenLayers/Geometry/LinearRing.js","OpenLayers/Geometry/Polygon.js","OpenLayers/Geometry/MultiLineString.js","OpenLayers/Geometry/MultiPolygon.js","OpenLayers/Geometry/Surface.js","OpenLayers/Renderer.js",
"OpenLayers/Renderer/Elements.js","OpenLayers/Renderer/SVG.js","OpenLayers/Renderer/VML.js","OpenLayers/Layer/Vector.js","OpenLayers/Layer/GML.js","OpenLayers/Format.js","OpenLayers/Format/XML.js","OpenLayers/Format/GML.js","OpenLayers/Format/KML.js","OpenLayers/Format/GeoRSS.js","OpenLayers/Format/WFS.js","OpenLayers/Format/WKT.js","OpenLayers/Format/JSON.js","OpenLayers/Format/GeoJSON.js","OpenLayers/Layer/WFS.js","OpenLayers/Control/MouseToolbar.js","OpenLayers/Control/NavToolbar.js","OpenLayers/Control/EditingToolbar.js");
for(var b="",c=OpenLayers._getScriptLocation()+"lib/",d=0;d<a.length;d++)if(/MSIE/.test(navigator.userAgent)||/Safari/.test(navigator.userAgent))b+="<script src='"+c+a[d]+"'><\/script>";else{var e=document.createElement("script");e.src=c+a[d];(document.getElementsByTagName("head").length?document.getElementsByTagName("head")[0]:document.body).appendChild(e)}b&&document.write(b)}})();OpenLayers.VERSION_NUMBER="$Revision: 1.2 $";OpenLayers.Util={};
OpenLayers.Util.getElement=function(){for(var a=[],b=0;b<arguments.length;b++){var c=arguments[b];if(typeof c=="string")c=document.getElementById(c);if(arguments.length==1)return c;a.push(c)}return a};if($==null)var $=OpenLayers.Util.getElement;OpenLayers.Util.extend=function(a,b){if(a&&b){for(var c in b)a[c]=b[c];if(b.hasOwnProperty&&b.hasOwnProperty("toString"))a.toString=b.toString}return a};OpenLayers.Util.removeItem=function(a,b){for(var c=0;c<a.length;c++)a[c]==b&&a.splice(c,1);return a};
OpenLayers.Util.removeNode=function(a){var b=document.getElementById("IELeakGarbageBin");if(!b){b=document.createElement("DIV");b.id="IELeakGarbageBin";b.style.display="none";document.body.appendChild(b)}b.appendChild(a);b.innerHTML=""};OpenLayers.Util.clearArray=function(a){OpenLayers.Console.warn("OpenLayers.Util.clearArray() is Deprecated. Please use 'array.length = 0' instead.");a.length=0};OpenLayers.Util.indexOf=function(a,b){for(var c=0;c<a.length;c++)if(a[c]==b)return c;return-1};
OpenLayers.Util.modifyDOMElement=function(a,b,c,d,e,f,g,h){if(b)a.id=b;if(c){a.style.left=c.x+"px";a.style.top=c.y+"px"}if(d){a.style.width=d.w+"px";a.style.height=d.h+"px"}if(e)a.style.position=e;if(f)a.style.border=f;if(g)a.style.overflow=g;if(h)if(h==1){a.style.opacity=null;a.style.filter=null}else{a.style.opacity=h;a.style.filter="alpha(opacity="+h*100+")"}};
OpenLayers.Util.createDiv=function(a,b,c,d,e,f,g,h){var j=document.createElement("div");if(d)j.style.backgroundImage="url("+d+")";a||(a=OpenLayers.Util.createUniqueID("OpenLayersDiv"));e||(e="absolute");OpenLayers.Util.modifyDOMElement(j,a,b,c,e,f,g,h);return j};
OpenLayers.Util.createImage=function(a,b,c,d,e,f,g,h){var j=document.createElement("img");a||(a=OpenLayers.Util.createUniqueID("OpenLayersDiv"));e||(e="relative");OpenLayers.Util.modifyDOMElement(j,a,b,c,e,f,null,g);if(h){j.style.display="none";OpenLayers.Event.observe(j,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,j));OpenLayers.Event.observe(j,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,j))}j.style.alt=a;j.galleryImg="no";if(d)j.src=d;return j};
OpenLayers.Util.setOpacity=function(a,b){OpenLayers.Util.modifyDOMElement(a,null,null,null,null,null,null,b)};OpenLayers.Util.onImageLoad=function(){if(!this.viewRequestID||this.map&&this.viewRequestID==this.map.viewRequestID){this.style.backgroundColor=null;this.style.display=""}};OpenLayers.Util.onImageLoadErrorColor="pink";OpenLayers.IMAGE_RELOAD_ATTEMPTS=0;
OpenLayers.Util.onImageLoadError=function(){this._attempts=this._attempts?this._attempts+1:1;if(this._attempts<=OpenLayers.IMAGE_RELOAD_ATTEMPTS)this.src=this.src;else this.style.backgroundColor=OpenLayers.Util.onImageLoadErrorColor;this.style.display=""};OpenLayers.Util.alphaHack=function(){var a=navigator.appVersion.split("MSIE");a=parseFloat(a[1]);var b=false;try{b=document.body.filters}catch(c){}return b&&a>=5.5&&a<7};
OpenLayers.Util.modifyAlphaImageDiv=function(a,b,c,d,e,f,g,h,j){OpenLayers.Util.modifyDOMElement(a,b,c,d);b=a.childNodes[0];if(!b){b=OpenLayers.Util.createImage(null,null,null,null,null,null,null,false);a.appendChild(b)}if(e)b.src=e;OpenLayers.Util.modifyDOMElement(b,a.id+"_innerImage",null,d,"relative",g);if(j)if(j==1){a.style.opacity=null;a.style.filter=null}else{a.style.opacity=j;a.style.filter="alpha(opacity="+j*100+")"}if(OpenLayers.Util.alphaHack()){a.style.display="inline-block";if(h==null)h=
"scale";a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+b.src+"', sizingMethod='"+h+"')";if(a.style.opacity)a.style.filter+=" alpha(opacity="+a.style.opacity*100+")";b.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=0)"}};
OpenLayers.Util.createAlphaImageDiv=function(a,b,c,d,e,f,g,h,j){var k=OpenLayers.Util.createDiv(),m=OpenLayers.Util.createImage(null,null,null,null,null,null,null,false);k.appendChild(m);if(j)m.style.display="none";OpenLayers.Util.modifyAlphaImageDiv(k,a,b,c,d,e,f,g,h);if(c){m.width=c.w;m.height=c.h}return k};OpenLayers.Util.upperCaseObject=function(a){var b={};for(var c in a)b[c.toUpperCase()]=a[c];return b};OpenLayers.Util.applyDefaults=function(a,b){for(var c in b)if(a[c]==null)a[c]=b[c]};
OpenLayers.Util.getParameterString=function(a){paramsArray=[];for(var b in a){var c=a[b];if(c!=null&&typeof c!="function"){if(typeof c=="object"&&c.constructor==Array){for(var d=[],e=0;e<c.length;e++)d.push(encodeURIComponent(c[e]));c=d.join(",")}else c=encodeURIComponent(c);paramsArray.push(encodeURIComponent(b)+"="+c)}}return paramsArray.join("&")};OpenLayers.ImgPath="";OpenLayers.Util.getImagesLocation=function(){return OpenLayers.ImgPath||OpenLayers._getScriptLocation()+"img/"};
OpenLayers.Util.Try=function(){for(var a=null,b=0;b<arguments.length;b++){var c=arguments[b];try{a=c();break}catch(d){}}return a};OpenLayers.Util.getNodes=function(a,b){return OpenLayers.Util.Try(function(){return OpenLayers.Util._getNodes(a.documentElement.childNodes,b)},function(){return OpenLayers.Util._getNodes(a.childNodes,b)})};OpenLayers.Util._getNodes=function(a,b){for(var c=[],d=0;d<a.length;d++)a[d].nodeName==b&&c.push(a[d]);return c};
OpenLayers.Util.getTagText=function(a,b,c){if((a=OpenLayers.Util.getNodes(a,b))&&a.length>0){c||(c=0);if(a[c].childNodes.length>1)return a.childNodes[1].nodeValue;else if(a[c].childNodes.length==1)return a[c].firstChild.nodeValue}else return""};OpenLayers.Util.getXmlNodeValue=function(a){var b=null;OpenLayers.Util.Try(function(){b=a.text;if(!b)b=a.textContent;if(!b)b=a.firstChild.nodeValue},function(){b=a.textContent});return b};
OpenLayers.Util.mouseLeft=function(a,b){for(a=a.relatedTarget?a.relatedTarget:a.toElement;a!=b&&a!=null;)a=a.parentNode;return a!=b};OpenLayers.Util.rad=function(a){return a*Math.PI/180};
OpenLayers.Util.distVincenty=function(a,b){var c=1/298.257223563,d=OpenLayers.Util.rad(b.lon-a.lon);a=Math.atan((1-c)*Math.tan(OpenLayers.Util.rad(a.lat)));var e=Math.atan((1-c)*Math.tan(OpenLayers.Util.rad(b.lat)));b=Math.sin(a);a=Math.cos(a);var f=Math.sin(e);e=Math.cos(e);for(var g=d,h=2*Math.PI,j=20;Math.abs(g-h)>1.0E-12&&--j>0;){var k=Math.sin(g),m=Math.cos(g),l=Math.sqrt(e*k*e*k+(a*f-b*e*m)*(a*f-b*e*m));if(l==0)return 0;m=b*f+a*e*m;var o=Math.atan2(l,m),p=Math.asin(a*e*k/l),q=Math.cos(p)*Math.cos(p);
k=m-2*b*f/q;var n=c/16*q*(4+c*(4-3*q));h=g;g=d+(1-n)*c*Math.sin(p)*(o+n*l*(k+n*m*(-1+2*k*k)))}if(j==0)return NaN;c=q*2.723316066819453E11/4.0408299984087055E13;d=c/1024*(256+c*(-128+c*(74-47*c)));return(6356752.3142*(1+c/16384*(4096+c*(-768+c*(320-175*c))))*(o-d*l*(k+d/4*(m*(-1+2*k*k)-d/6*k*(-3+4*l*l)*(-3+4*k*k))))).toFixed(3)/1E3};
OpenLayers.Util.getParameters=function(a){a=a||window.location.href;if(a==null)a=window.location.href;var b="";if(OpenLayers.String.contains(a,"?")){b=a.indexOf("?")+1;var c=OpenLayers.String.contains(a,"#")?a.indexOf("#"):a.length;b=a.substring(b,c)}a={};b=b.split(/[&;]/);for(c=0;c<b.length;++c){var d=b[c].split("=");if(d[0]){var e=decodeURIComponent(d[0]);d=d[1]||"";d=d.split(",");for(var f=0;f<d.length;f++)d[f]=decodeURIComponent(d[f]);if(d.length==1)d=d[0];a[e]=d}}return a};
OpenLayers.Util.getArgs=function(a){OpenLayers.Console.warn("The getArgs() function is deprecated and will be removed with the 3.0 version of OpenLayers. Please instead use OpenLayers.Util.getParameters().");return OpenLayers.Util.getParameters(a)};OpenLayers.Util.lastSeqID=0;OpenLayers.Util.createUniqueID=function(a){if(a==null)a="id_";OpenLayers.Util.lastSeqID+=1;return a+OpenLayers.Util.lastSeqID};OpenLayers.INCHES_PER_UNIT={inches:1,ft:12,mi:63360,m:39.3701,km:39370.1,dd:4374754};
OpenLayers.INCHES_PER_UNIT["in"]=OpenLayers.INCHES_PER_UNIT.inches;OpenLayers.INCHES_PER_UNIT.degrees=OpenLayers.INCHES_PER_UNIT.dd;OpenLayers.DOTS_PER_INCH=72;OpenLayers.Util.normalizeScale=function(a){return a>1?1/a:a};OpenLayers.Util.getResolutionFromScale=function(a,b){if(b==null)b="degrees";return 1/(OpenLayers.Util.normalizeScale(a)*OpenLayers.INCHES_PER_UNIT[b]*OpenLayers.DOTS_PER_INCH)};
OpenLayers.Util.getScaleFromResolution=function(a,b){if(b==null)b="degrees";return a*OpenLayers.INCHES_PER_UNIT[b]*OpenLayers.DOTS_PER_INCH};OpenLayers.Util.safeStopPropagation=function(a){OpenLayers.Event.stop(a,true)};
OpenLayers.Util.pagePosition=function(a){for(var b=0,c=0,d=a,e=a;d;){if(d==document.body)if(e&&e.style&&OpenLayers.Element.getStyle(e,"position")=="absolute")break;b+=d.offsetTop||0;c+=d.offsetLeft||0;e=d;try{d=d.offsetParent}catch(f){OpenLayers.Console.error("OpenLayers.Util.pagePosition failed: element with id "+d.id+" may be misplaced.");break}}for(d=a;d;){b-=d.scrollTop||0;c-=d.scrollLeft||0;d=d.parentNode}return[c,b]};
OpenLayers.Util.docPosition=function(a){var b=0,c=0;a=a;do{b+=a.offsetTop||0;c+=a.offsetLeft||0;if(a.offsetParent==document.body)if(OpenLayers.Element.getStyle(a,"position")=="absolute")break}while(a=a.offsetParent);return[c,b]};
OpenLayers.Util.isEquivalentUrl=function(a,b,c){c=c||{};OpenLayers.Util.applyDefaults(c,{ignoreCase:true,ignorePort80:true,ignoreHash:true});urlObj1=OpenLayers.Util.createUrlObject(a,c);urlObj2=OpenLayers.Util.createUrlObject(b,c);for(var d in urlObj1){c.test&&alert(d+"\n1:"+urlObj1[d]+"\n2:"+urlObj2[d]);a=urlObj1[d];b=urlObj2[d];switch(d){case "args":break;case "host":case "port":case "protocol":if(a==""||b=="")break;default:if(d!="args"&&urlObj1[d]!=urlObj2[d])return false;break}}for(d in urlObj1.args){if(urlObj1.args[d]!=
urlObj2.args[d])return false;delete urlObj2.args[d]}for(d in urlObj2.args)return false;return true};
OpenLayers.Util.createUrlObject=function(a,b){b=b||{};var c={};if(b.ignoreCase)a=a.toLowerCase();var d=document.createElement("a");d.href=a;c.host=d.host;var e=d.port;if(e.length<=0)c.host=c.host.substring(0,c.host.length-e.length);c.protocol=d.protocol;c.port=e=="80"&&b.ignorePort80?"":e;c.hash=b.ignoreHash?"":d.hash;e=d.search;if(!e){e=a.indexOf("?");e=e!=-1?a.substr(e):""}c.args=OpenLayers.Util.getParameters(e);if(c.protocol=="file:"&&a.indexOf("file:")!=-1||c.protocol!="file:"&&c.host!=""){c.pathname=
d.pathname;b=c.pathname.indexOf("?");if(b!=-1)c.pathname=c.pathname.substring(0,b)}else{d=OpenLayers.Util.removeTail(a);a=0;do{e=d.indexOf("../");if(e==0){a++;d=d.substr(3)}else if(e>=0){var f=d.substr(0,e-1),g=f.indexOf("/");f=g!=-1?f.substr(0,g+1):"";d=d.substr(e+3);d=f+d}}while(e!=-1);e=document.createElement("a");f=window.location.href;if(b.ignoreCase)f=f.toLowerCase();e.href=f;c.protocol=e.protocol;b=e.pathname.indexOf("/")!=-1?"/":"\\";b=e.pathname.split(b);for(b.pop();a>0&&b.length>0;){b.pop();
a--}d=b.join("/")+"/"+d;c.pathname=d}if(c.protocol=="file:"||c.protocol=="")c.host="localhost";return c};OpenLayers.Util.removeTail=function(a){var b=null;b=a.indexOf("?");var c=a.indexOf("#");return b=b==-1?c!=-1?a.substr(0,c):a:c!=-1?a.substr(0,Math.min(b,c)):a.substr(0,b)};
OpenLayers.Util.getBrowserName=function(){var a="",b=navigator.userAgent.toLowerCase();if(b.indexOf("opera")!=-1)a="opera";else if(b.indexOf("msie")!=-1)a="msie";else if(b.indexOf("safari")!=-1)a="safari";else if(b.indexOf("mozilla")!=-1)a=b.indexOf("firefox")!=-1?"firefox":"mozilla";return a};
OpenLayers.Console={log:function(){},debug:function(){},info:function(){},warn:function(){},error:function(){},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(){if(window.console)for(var a=document.getElementsByTagName("script"),b=0;b<a.length;++b)if(a[b].src.indexOf("firebug.js")!=-1){OpenLayers.Util.extend(OpenLayers.Console,console);break}})();OpenLayers.String={startsWith:function(a,b){return a.indexOf(b)==0},contains:function(a,b){return a.indexOf(b)!=-1},trim:function(a){return a.replace(/^\s*(.*?)\s*$/,"$1")},camelize:function(a){a=a.split("-");for(var b=a[0],c=1;c<a.length;c++){var d=a[c];b+=d.charAt(0).toUpperCase()+d.substring(1)}return b}};
if(!String.prototype.startsWith)String.prototype.startsWith=function(a){return OpenLayers.String.startsWith(this,a)};if(!String.prototype.contains)String.prototype.contains=function(a){return OpenLayers.String.contains(this,a)};if(!String.prototype.trim)String.prototype.trim=function(){return OpenLayers.String.trim(this)};if(!String.prototype.camelize)String.prototype.camelize=function(){return OpenLayers.String.camelize(this)};
OpenLayers.Number={limitSigDigs:function(a,b){return b>0?parseFloat(a.toPrecision(b)):0}};if(!Number.prototype.limitSigDigs)Number.prototype.limitSigDigs=function(a){return OpenLayers.Number.limitSigDigs(this,a)};
OpenLayers.Function={bind:function(a,b){var c=Array.prototype.slice.apply(arguments,[2]);return function(){var d=c.concat(Array.prototype.slice.apply(arguments,[0]));return a.apply(b,d)}},bindAsEventListener:function(a,b){function c(e){if(!e)return[];if(e.toArray)return e.toArray();else{for(var f=[],g=0,h=e.length;g<h;g++)f.push(e[g]);return f}}var d=c(arguments);d.shift();d.shift();return function(e){return a.apply(b,[e||window.event].concat(d))}}};
if(!Function.prototype.bindAsEventListener)Function.prototype.bindAsEventListener=function(a){return OpenLayers.Function.bindAsEventListener(this,a)};OpenLayers.Class=function(){for(var a=function(){arguments&&arguments[0]!=OpenLayers.Class.isPrototype&&this.initialize.apply(this,arguments)},b={},c,d=0;d<arguments.length;++d){c=typeof arguments[d]=="function"?arguments[d].prototype:arguments[d];OpenLayers.Util.extend(b,c)}a.prototype=b;return a};OpenLayers.Class.isPrototype=function(){};
OpenLayers.Class.create=function(){return function(){arguments&&arguments[0]!=OpenLayers.Class.isPrototype&&this.initialize.apply(this,arguments)}};OpenLayers.Class.inherit=function(){for(var a=new arguments[0](OpenLayers.Class.isPrototype),b=1;b<arguments.length;b++){if(typeof arguments[b]=="function")arguments[b]=new arguments[b](OpenLayers.Class.isPrototype);OpenLayers.Util.extend(a,arguments[b])}return a};
OpenLayers.Bounds=OpenLayers.Class({left:null,bottom:null,right:null,top:null,initialize:function(a,b,c,d){if(a!=null)this.left=parseFloat(a);if(b!=null)this.bottom=parseFloat(b);if(c!=null)this.right=parseFloat(c);if(d!=null)this.top=parseFloat(d)},clone:function(){return new OpenLayers.Bounds(this.left,this.bottom,this.right,this.top)},equals:function(a){var b=false;if(a!=null)b=this.left==a.left&&this.right==a.right&&this.top==a.top&&this.bottom==a.bottom;return b},toString:function(){return"left-bottom=("+
this.left+","+this.bottom+") right-top=("+this.right+","+this.top+")"},toArray:function(){return[this.left,this.bottom,this.right,this.top]},toBBOX:function(a){if(a==null)a=6;a=Math.pow(10,a);return Math.round(this.left*a)/a+","+Math.round(this.bottom*a)/a+","+Math.round(this.right*a)/a+","+Math.round(this.top*a)/a},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(){return new OpenLayers.LonLat((this.left+this.right)/2,(this.bottom+this.top)/2)},add:function(a,b){if(a==null||b==null){OpenLayers.Console.error("You must pass both x and y values to the add function.");return null}return new OpenLayers.Bounds(this.left+a,this.bottom+b,this.right+a,this.top+b)},extend:function(a){var b=null;if(a){switch(a.CLASS_NAME){case "OpenLayers.LonLat":b=new OpenLayers.Bounds(a.lon,a.lat,a.lon,a.lat);break;
case "OpenLayers.Geometry.Point":b=new OpenLayers.Bounds(a.x,a.y,a.x,a.y);break;case "OpenLayers.Bounds":b=a;break}if(b){if(this.left==null||b.left<this.left)this.left=b.left;if(this.bottom==null||b.bottom<this.bottom)this.bottom=b.bottom;if(this.right==null||b.right>this.right)this.right=b.right;if(this.top==null||b.top>this.top)this.top=b.top}}},containsLonLat:function(a,b){return this.contains(a.lon,a.lat,b)},containsPixel:function(a,b){return this.contains(a.x,a.y,b)},contains:function(a,b,c){if(c==
null)c=true;var d=false;return d=c?a>=this.left&&a<=this.right&&b>=this.bottom&&b<=this.top:a>this.left&&a<this.right&&b>this.bottom&&b<this.top},intersectsBounds:function(a,b){if(b==null)b=true;var c=a.bottom==this.bottom&&a.top==this.top?true:a.bottom>this.bottom&&a.bottom<this.top||this.bottom>a.bottom&&this.bottom<a.top,d=a.bottom==this.bottom&&a.top==this.top?true:a.top>this.bottom&&a.top<this.top||this.top>a.bottom&&this.top<a.top,e=a.right==this.right&&a.left==this.left?true:a.right>this.left&&
a.right<this.right||this.right>a.left&&this.right<a.right,f=a.right==this.right&&a.left==this.left?true:a.left>this.left&&a.left<this.right||this.left>a.left&&this.left<a.right;return this.containsBounds(a,true,b)||a.containsBounds(this,true,b)||(d||c)&&(f||e)},containsBounds:function(a,b,c){if(b==null)b=false;if(c==null)c=true;var d,e;if(c){c=a.left>=this.left&&a.left<=this.right;d=a.top>=this.bottom&&a.top<=this.top;e=a.right>=this.left&&a.right<=this.right;a=a.bottom>=this.bottom&&a.bottom<=this.top}else{c=
a.left>this.left&&a.left<this.right;d=a.top>this.bottom&&a.top<this.top;e=a.right>this.left&&a.right<this.right;a=a.bottom>this.bottom&&a.bottom<this.top}return b?(d||a)&&(c||e):d&&c&&a&&e},determineQuadrant:function(a){var b="",c=this.getCenterLonLat();b+=a.lat<c.lat?"b":"t";b+=a.lon<c.lon?"l":"r";return b},wrapDateLine:function(a,b){b=b||{};var c=b.leftTolerance||0;b=b.rightTolerance||0;var d=this.clone();if(a){for(;d.left<a.left&&d.right-b<=a.left;)d=d.add(a.getWidth(),0);for(;d.left+c>=a.right&&
d.right>a.right;)d=d.add(-a.getWidth(),0)}return d},CLASS_NAME:"OpenLayers.Bounds"});OpenLayers.Bounds.fromString=function(a){a=a.split(",");return OpenLayers.Bounds.fromArray(a)};OpenLayers.Bounds.fromArray=function(a){return new OpenLayers.Bounds(parseFloat(a[0]),parseFloat(a[1]),parseFloat(a[2]),parseFloat(a[3]))};OpenLayers.Bounds.fromSize=function(a){return new OpenLayers.Bounds(0,a.h,a.w,0)};
OpenLayers.Bounds.oppositeQuadrant=function(a){var b="";b+=a.charAt(0)=="t"?"b":"t";b+=a.charAt(1)=="l"?"r":"l";return b};
OpenLayers.Element={visible:function(a){return OpenLayers.Util.getElement(a).style.display!="none"},toggle:function(){for(var a=0;a<arguments.length;a++){var b=OpenLayers.Util.getElement(arguments[a]),c=OpenLayers.Element.visible(b)?"hide":"show";OpenLayers.Element[c](b)}},hide:function(){for(var a=0;a<arguments.length;a++)OpenLayers.Util.getElement(arguments[a]).style.display="none"},show:function(){for(var a=0;a<arguments.length;a++)OpenLayers.Util.getElement(arguments[a]).style.display=""},remove:function(a){a=
OpenLayers.Util.getElement(a);a.parentNode.removeChild(a)},getHeight:function(a){a=OpenLayers.Util.getElement(a);return a.offsetHeight},getDimensions:function(a){a=OpenLayers.Util.getElement(a);if(OpenLayers.Element.getStyle(a,"display")!="none")return{width:a.offsetWidth,height:a.offsetHeight};var b=a.style,c=b.visibility,d=b.position;b.visibility="hidden";b.position="absolute";b.display="";var e=a.clientWidth;a=a.clientHeight;b.display="none";b.position=d;b.visibility=c;return{width:e,height:a}},
getStyle:function(a,b){a=OpenLayers.Util.getElement(a);var c=a.style[OpenLayers.String.camelize(b)];if(!c)if(document.defaultView&&document.defaultView.getComputedStyle)c=(c=document.defaultView.getComputedStyle(a,null))?c.getPropertyValue(b):null;else if(a.currentStyle)c=a.currentStyle[OpenLayers.String.camelize(b)];var d=["left","top","right","bottom"];if(window.opera&&OpenLayers.Util.indexOf(d,b)!=-1&&OpenLayers.Element.getStyle(a,"position")=="static")c="auto";return c=="auto"?null:c}};
OpenLayers.LonLat=OpenLayers.Class({lon:0,lat:0,initialize:function(a,b){this.lon=parseFloat(a);this.lat=parseFloat(b)},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(a,b){if(a==null||b==null){OpenLayers.Console.error("You must pass both lon and lat values to the add function.");return null}return new OpenLayers.LonLat(this.lon+a,this.lat+b)},equals:function(a){var b=
false;if(a!=null)b=this.lon==a.lon&&this.lat==a.lat||isNaN(this.lon)&&isNaN(this.lat)&&isNaN(a.lon)&&isNaN(a.lat);return b},wrapDateLine:function(a){var b=this.clone();if(a){for(;b.lon<a.left;)b.lon+=a.getWidth();for(;b.lon>a.right;)b.lon-=a.getWidth()}return b},CLASS_NAME:"OpenLayers.LonLat"});OpenLayers.LonLat.fromString=function(a){a=a.split(",");return new OpenLayers.LonLat(parseFloat(a[0]),parseFloat(a[1]))};
OpenLayers.Pixel=OpenLayers.Class({x:0,y:0,initialize:function(a,b){this.x=parseFloat(a);this.y=parseFloat(b)},toString:function(){return"x="+this.x+",y="+this.y},clone:function(){return new OpenLayers.Pixel(this.x,this.y)},equals:function(a){var b=false;if(a!=null)b=this.x==a.x&&this.y==a.y||isNaN(this.x)&&isNaN(this.y)&&isNaN(a.x)&&isNaN(a.y);return b},add:function(a,b){if(a==null||b==null){OpenLayers.Console.error("You must pass both x and y values to the add function.");return null}return new OpenLayers.Pixel(this.x+
a,this.y+b)},offset:function(a){var b=this.clone();if(a)b=this.add(a.x,a.y);return b},CLASS_NAME:"OpenLayers.Pixel"});OpenLayers.Size=OpenLayers.Class({w:0,h:0,initialize:function(a,b){this.w=parseFloat(a);this.h=parseFloat(b)},toString:function(){return"w="+this.w+",h="+this.h},clone:function(){return new OpenLayers.Size(this.w,this.h)},equals:function(a){var b=false;if(a!=null)b=this.w==a.w&&this.h==a.h||isNaN(this.w)&&isNaN(this.h)&&isNaN(a.w)&&isNaN(a.h);return b},CLASS_NAME:"OpenLayers.Size"});
OpenLayers.Rico={};
OpenLayers.Rico.Corner={round:function(a,b){a=OpenLayers.Util.getElement(a);this._setOptions(b);b=this.options.color;if(this.options.color=="fromElement")b=this._background(a);var c=this.options.bgColor;if(this.options.bgColor=="fromParent")c=this._background(a.offsetParent);this._roundCornersImpl(a,b,c)},changeColor:function(a,b){a.style.backgroundColor=b;a=a.parentNode.getElementsByTagName("span");for(var c=0;c<a.length;c++)a[c].style.backgroundColor=b},changeOpacity:function(a,b){var c="alpha(opacity="+
b*100+")";a.style.opacity=b;a.style.filter=c;a=a.parentNode.getElementsByTagName("span");for(var d=0;d<a.length;d++){a[d].style.opacity=b;a[d].style.filter=c}},reRound:function(a,b){var c=a.parentNode.childNodes[2];a.parentNode.removeChild(a.parentNode.childNodes[0]);a.parentNode.removeChild(c);this.round(a.parentNode,b)},_roundCornersImpl:function(a,b,c){this.options.border&&this._renderBorder(a,c);this._isTopRounded()&&this._roundTopCorners(a,b,c);this._isBottomRounded()&&this._roundBottomCorners(a,
b,c)},_renderBorder:function(a,b){b="1px solid "+this._borderColor(b);a.innerHTML="<div "+("style='"+("border-left: "+b)+";"+("border-right: "+b)+"'")+">"+a.innerHTML+"</div>"},_roundTopCorners:function(a,b,c){for(var d=this._createCorner(c),e=0;e<this.options.numSlices;e++)d.appendChild(this._createCornerSlice(b,c,e,"top"));a.style.paddingTop=0;a.insertBefore(d,a.firstChild)},_roundBottomCorners:function(a,b,c){for(var d=this._createCorner(c),e=this.options.numSlices-1;e>=0;e--)d.appendChild(this._createCornerSlice(b,
c,e,"bottom"));a.style.paddingBottom=0;a.appendChild(d)},_createCorner:function(a){var b=document.createElement("div");b.style.backgroundColor=this._isTransparent()?"transparent":a;return b},_createCornerSlice:function(a,b,c,d){var e=document.createElement("span"),f=e.style;f.backgroundColor=a;f.display="block";f.height="1px";f.overflow="hidden";f.fontSize="1px";a=this._borderColor(a,b);if(this.options.border&&c==0){f.borderTopStyle="solid";f.borderTopWidth="1px";f.borderLeftWidth="0px";f.borderRightWidth=
"0px";f.borderBottomWidth="0px";f.height="0px";f.borderColor=a}else if(a){f.borderColor=a;f.borderStyle="solid";f.borderWidth="0px 1px"}if(!this.options.compact&&c==this.options.numSlices-1)f.height="2px";this._setMargin(e,c,d);this._setBorder(e,c,d);return e},_setOptions:function(a){this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:true,border:false,compact:false};OpenLayers.Util.extend(this.options,a||{});this.options.numSlices=this.options.compact?2:4;if(this._isTransparent())this.options.blend=
false},_whichSideTop:function(){if(this._hasString(this.options.corners,"all","top"))return"";if(this.options.corners.indexOf("tl")>=0&&this.options.corners.indexOf("tr")>=0)return"";if(this.options.corners.indexOf("tl")>=0)return"left";else if(this.options.corners.indexOf("tr")>=0)return"right";return""},_whichSideBottom:function(){if(this._hasString(this.options.corners,"all","bottom"))return"";if(this.options.corners.indexOf("bl")>=0&&this.options.corners.indexOf("br")>=0)return"";if(this.options.corners.indexOf("bl")>=
0)return"left";else if(this.options.corners.indexOf("br")>=0)return"right";return""},_borderColor:function(a,b){return a=="transparent"?b:this.options.border?this.options.border:this.options.blend?this._blend(b,a):""},_setMargin:function(a,b,c){b=this._marginSize(b);c=c=="top"?this._whichSideTop():this._whichSideBottom();if(c=="left"){a.style.marginLeft=b+"px";a.style.marginRight="0px"}else if(c=="right"){a.style.marginRight=b+"px";a.style.marginLeft="0px"}else{a.style.marginLeft=b+"px";a.style.marginRight=
b+"px"}},_setBorder:function(a,b,c){b=this._borderSize(b);c=c=="top"?this._whichSideTop():this._whichSideBottom();if(c=="left"){a.style.borderLeftWidth=b+"px";a.style.borderRightWidth="0px"}else if(c=="right"){a.style.borderRightWidth=b+"px";a.style.borderLeftWidth="0px"}else{a.style.borderLeftWidth=b+"px";a.style.borderRightWidth=b+"px"}if(this.options.border!=false)a.style.borderLeftWidth=b+"px";a.style.borderRightWidth=b+"px"},_marginSize:function(a){if(this._isTransparent())return 0;var b=[5,
3,2,1],c=[3,2,1,0],d=[2,1],e=[1,0];return this.options.compact&&this.options.blend?e[a]:this.options.compact?d[a]:this.options.blend?c[a]:b[a]},_borderSize:function(a){var b=[5,3,2,1],c=[2,1,1,1],d=[1,0],e=[0,2,0,0];if(this.options.compact&&(this.options.blend||this._isTransparent()))return 1;else if(this.options.compact)return d[a];else if(this.options.blend)return c[a];else if(this.options.border)return e[a];else if(this._isTransparent())return b[a];return 0},_hasString:function(a){for(var b=1;b<
arguments.length;b++)if(a.indexOf(arguments[b])>=0)return true;return false},_blend:function(a,b){a=OpenLayers.Rico.Color.createFromHex(a);a.blend(OpenLayers.Rico.Color.createFromHex(b));return a},_background:function(a){try{return OpenLayers.Rico.Color.createColorFromBackground(a).asHex()}catch(b){return"#ffffff"}},_isTransparent:function(){return this.options.color=="transparent"},_isTopRounded:function(){return this._hasString(this.options.corners,"all","top","tl","tr")},_isBottomRounded:function(){return this._hasString(this.options.corners,
"all","bottom","bl","br")},_hasSingleTextChild:function(a){return a.childNodes.length==1&&a.childNodes[0].nodeType==3}};
OpenLayers.Rico.Color=OpenLayers.Class({initialize:function(a,b,c){this.rgb={r:a,g:b,b:c}},setRed:function(a){this.rgb.r=a},setGreen:function(a){this.rgb.g=a},setBlue:function(a){this.rgb.b=a},setHue:function(a){var b=this.asHSB();b.h=a;this.rgb=OpenLayers.Rico.Color.HSBtoRGB(b.h,b.s,b.b)},setSaturation:function(a){var b=this.asHSB();b.s=a;this.rgb=OpenLayers.Rico.Color.HSBtoRGB(b.h,b.s,b.b)},setBrightness:function(a){var b=this.asHSB();b.b=a;this.rgb=OpenLayers.Rico.Color.HSBtoRGB(b.h,b.s,b.b)},
darken:function(a){var b=this.asHSB();this.rgb=OpenLayers.Rico.Color.HSBtoRGB(b.h,b.s,Math.max(b.b-a,0))},brighten:function(a){var b=this.asHSB();this.rgb=OpenLayers.Rico.Color.HSBtoRGB(b.h,b.s,Math.min(b.b+a,1))},blend:function(a){this.rgb.r=Math.floor((this.rgb.r+a.rgb.r)/2);this.rgb.g=Math.floor((this.rgb.g+a.rgb.g)/2);this.rgb.b=Math.floor((this.rgb.b+a.rgb.b)/2)},isBright:function(){this.asHSB();return this.asHSB().b>0.5},isDark:function(){return!this.isBright()},asRGB:function(){return"rgb("+
this.rgb.r+","+this.rgb.g+","+this.rgb.b+")"},asHex:function(){return"#"+this.rgb.r.toColorPart()+this.rgb.g.toColorPart()+this.rgb.b.toColorPart()},asHSB:function(){return OpenLayers.Rico.Color.RGBtoHSB(this.rgb.r,this.rgb.g,this.rgb.b)},toString:function(){return this.asHex()}});
OpenLayers.Rico.Color.createFromHex=function(a){if(a.length==4){var b=a;a="#";for(var c=1;c<4;c++)a+=b.charAt(c)+b.charAt(c)}if(a.indexOf("#")==0)a=a.substring(1);b=a.substring(0,2);c=a.substring(2,4);a=a.substring(4,6);return new OpenLayers.Rico.Color(parseInt(b,16),parseInt(c,16),parseInt(a,16))};
OpenLayers.Rico.Color.createColorFromBackground=function(a){var b=RicoUtil.getElementsComputedStyle(OpenLayers.Util.getElement(a),"backgroundColor","background-color");if(b=="transparent"&&a.parentNode)return OpenLayers.Rico.Color.createColorFromBackground(a.parentNode);if(b==null)return new OpenLayers.Rico.Color(255,255,255);if(b.indexOf("rgb(")==0){a=b.substring(4,b.length-1).split(",");return new OpenLayers.Rico.Color(parseInt(a[0]),parseInt(a[1]),parseInt(a[2]))}else return b.indexOf("#")==0?
OpenLayers.Rico.Color.createFromHex(b):new OpenLayers.Rico.Color(255,255,255)};
OpenLayers.Rico.Color.HSBtoRGB=function(a,b,c){var d=0,e=0,f=0;if(b==0)f=e=d=parseInt(c*255+0.5);else{a=(a-Math.floor(a))*6;var g=a-Math.floor(a),h=c*(1-b),j=c*(1-b*g);b=c*(1-b*(1-g));switch(parseInt(a)){case 0:d=c*255+0.5;e=b*255+0.5;f=h*255+0.5;break;case 1:d=j*255+0.5;e=c*255+0.5;f=h*255+0.5;break;case 2:d=h*255+0.5;e=c*255+0.5;f=b*255+0.5;break;case 3:d=h*255+0.5;e=j*255+0.5;f=c*255+0.5;break;case 4:d=b*255+0.5;e=h*255+0.5;f=c*255+0.5;break;case 5:d=c*255+0.5;e=h*255+0.5;f=j*255+0.5;break}}return{r:parseInt(d),
g:parseInt(e),b:parseInt(f)}};OpenLayers.Rico.Color.RGBtoHSB=function(a,b,c){var d,e,f=a>b?a:b;if(c>f)f=c;var g=a<b?a:b;if(c<g)g=c;e=f/255;d=f!=0?(f-g)/f:0;if(d==0)a=0;else{var h=(f-a)/(f-g),j=(f-b)/(f-g);c=(f-c)/(f-g);a=a==f?c-j:b==f?2+h-c:4+j-h;a/=6;if(a<0)a+=1}return{h:a,s:d,b:e}};OpenLayers.ProxyHost="";OpenLayers.nullHandler=function(a){alert("Unhandled request return "+a.statusText)};
OpenLayers.loadURL=function(a,b,c,d,e){if(OpenLayers.ProxyHost&&OpenLayers.String.startsWith(a,"http"))a=OpenLayers.ProxyHost+escape(a);d=d?OpenLayers.Function.bind(d,c):OpenLayers.nullHandler;c=e?OpenLayers.Function.bind(e,c):OpenLayers.nullHandler;new OpenLayers.Ajax.Request(a,{method:"get",parameters:b,onComplete:d,onFailure:c})};
OpenLayers.parseXMLString=function(a){var b=a.indexOf("<");if(b>0)a=a.substring(b);return OpenLayers.Util.Try(function(){var c=new ActiveXObject("Microsoft.XMLDOM");c.loadXML(a);return c},function(){return(new DOMParser).parseFromString(a,"text/xml")},function(){var c=new XMLHttpRequest;c.open("GET","data:text/xml;charset=utf-8,"+encodeURIComponent(a),false);c.overrideMimeType&&c.overrideMimeType("text/xml");c.send(null);return c.responseXML})};
OpenLayers.Ajax={emptyFunction:function(){},getTransport:function(){return OpenLayers.Util.Try(function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")},function(){return new XMLHttpRequest})||false},activeRequestCount:0};
OpenLayers.Ajax.Responders={responders:[],register:function(a){for(var b=0;b<this.responders.length;b++)if(a==this.responders[b])return;this.responders.push(a)},dispatch:function(a,b,c,d){for(var e,f=0;f<this.responders.length;f++){e=this.responders[f];if(e[a]&&typeof e[a]=="function")try{e[a].apply(e,[b,c,d])}catch(g){}}}};OpenLayers.Ajax.Responders.register({onCreate:function(){OpenLayers.Ajax.activeRequestCount++},onComplete:function(){OpenLayers.Ajax.activeRequestCount--}});
OpenLayers.Ajax.Base=function(){};OpenLayers.Ajax.Base.prototype={setOptions:function(a){this.options={method:"post",asynchronous:true,parameters:""};OpenLayers.Util.extend(this.options,a||{})},responseIsSuccess:function(){return this.transport.status==undefined||this.transport.status==0||this.transport.status>=200&&this.transport.status<300},responseIsFailure:function(){return!this.responseIsSuccess()}};
OpenLayers.Ajax.Request=OpenLayers.Class(OpenLayers.Ajax.Base,{initialize:function(a,b){this.transport=OpenLayers.Ajax.getTransport();this.setOptions(b);this.request(a)},request:function(a){var b=this.options.parameters||"";if(b.length>0)b+="&_=";try{this.url=a;if(this.options.method=="get"&&b.length>0)this.url+=(this.url.match(/\?/)?"&":"?")+b;OpenLayers.Ajax.Responders.dispatch("onCreate",this,this.transport);this.transport.open(this.options.method,this.url,this.options.asynchronous);if(this.options.asynchronous){this.transport.onreadystatechange=
OpenLayers.Function.bind(this.onStateChange,this);setTimeout(OpenLayers.Function.bind(function(){this.respondToReadyState(1)},this),10)}this.setRequestHeaders();var c=this.options.postBody?this.options.postBody:b;this.transport.send(this.options.method=="post"?c:null);!this.options.asynchronous&&this.transport.overrideMimeType&&this.onStateChange()}catch(d){this.dispatchException(d)}},setRequestHeaders:function(){var a=["X-Requested-With","XMLHttpRequest","X-Prototype-Version","OpenLayers"];if(this.options.method==
"post"&&!this.options.postBody){a.push("Content-type","application/x-www-form-urlencoded");this.transport.overrideMimeType&&a.push("Connection","close")}this.options.requestHeaders&&a.push.apply(a,this.options.requestHeaders);for(var b=0;b<a.length;b+=2)this.transport.setRequestHeader(a[b],a[b+1])},onStateChange:function(){this.transport.readyState!=1&&this.respondToReadyState(this.transport.readyState)},header:function(a){try{return this.transport.getResponseHeader(a)}catch(b){}},evalJSON:function(){try{return eval(this.header("X-JSON"))}catch(a){}},
evalResponse:function(){try{return eval(this.transport.responseText)}catch(a){this.dispatchException(a)}},respondToReadyState:function(a){a=OpenLayers.Ajax.Request.Events[a];var b=this.transport,c=this.evalJSON();if(a=="Complete"){try{var d=this.responseIsSuccess()?"Success":"Failure";(this.options["on"+this.transport.status]||this.options["on"+d]||OpenLayers.Ajax.emptyFunction)(b,c,this)}catch(e){this.dispatchException(e)}if((this.header("Content-type")||"").match(/^text\/javascript/i))this.evalResponse()}try{(this.options["on"+
a]||OpenLayers.Ajax.emptyFunction)(b,c,this);OpenLayers.Ajax.Responders.dispatch("on"+a,this,b,c,this)}catch(f){this.dispatchException(f)}if(a=="Complete")this.transport.onreadystatechange=OpenLayers.Ajax.emptyFunction},dispatchException:function(a){if(this.options.onException)this.options.onException(this,a);else throw a;OpenLayers.Ajax.Responders.dispatch("onException",this,a)}});OpenLayers.Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];
OpenLayers.Ajax.getElementsByTagNameNS=function(a,b,c,d){var e=null;return e=a.getElementsByTagNameNS?a.getElementsByTagNameNS(b,d):a.getElementsByTagName(c+":"+d)};OpenLayers.Ajax.serializeXMLToString=function(a){return data=(new XMLSerializer).serializeToString(a)};
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(a){return a.target||a.srcElement},isLeftClick:function(a){return a.which&&a.which==1||a.button&&a.button==1},stop:function(a,b){if(!b)if(a.preventDefault)a.preventDefault();else a.returnValue=false;if(a.stopPropagation)a.stopPropagation();else a.cancelBubble=true},findElement:function(a,b){for(a=OpenLayers.Event.element(a);a.parentNode&&
(!a.tagName||a.tagName.toUpperCase()!=b.toUpperCase());)a=a.parentNode;return a},observe:function(a,b,c,d){a=OpenLayers.Util.getElement(a);d=d||false;if(b=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||a.attachEvent))b="keydown";if(!this.observers)this.observers={};if(!a._eventCacheID){var e="eventCacheID_";if(a.id)e=a.id+"_"+e;a._eventCacheID=OpenLayers.Util.createUniqueID(e)}e=a._eventCacheID;this.observers[e]||(this.observers[e]=[]);this.observers[e].push({element:a,name:b,
observer:c,useCapture:d});if(a.addEventListener)a.addEventListener(b,c,d);else a.attachEvent&&a.attachEvent("on"+b,c)},stopObservingElement:function(a){(a=OpenLayers.Util.getElement(a))&&this._removeElementObservers(OpenLayers.Event.observers[a._eventCacheID])},_removeElementObservers:function(a){if(a)for(var b=a.length-1;b>=0;b--){var c=a[b];OpenLayers.Event.stopObserving.apply(this,new Array(c.element,c.name,c.observer,c.useCapture))}},stopObserving:function(a,b,c,d){d=d||false;a=OpenLayers.Util.getElement(a);
var e=a._eventCacheID;if(b=="keypress")if(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||a.detachEvent)b="keydown";var f=false,g=OpenLayers.Event.observers[e];if(g)for(var h=0;!f&&h<g.length;){var j=g[h];if(j.name==b&&j.observer==c&&j.useCapture==d){g.splice(h,1);g.length==0&&delete OpenLayers.Event.observers[e];f=true;break}h++}if(a.removeEventListener)a.removeEventListener(b,c,d);else a&&a.detachEvent&&a.detachEvent("on"+b,c);return f},unloadCache:function(){if(OpenLayers.Event.observers){for(var a in OpenLayers.Event.observers)OpenLayers.Event._removeElementObservers.apply(this,
[OpenLayers.Event.observers[a]]);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","resize","focus","blur"],listeners:null,object:null,element:null,eventTypes:null,eventHandler:null,fallThrough:null,initialize:function(a,b,c,d){this.object=a;this.element=b;this.eventTypes=c;this.fallThrough=d;this.listeners={};this.eventHandler=OpenLayers.Function.bindAsEventListener(this.handleBrowserEvent,this);if(this.eventTypes!=null)for(a=0;a<this.eventTypes.length;a++)this.addEventType(this.eventTypes[a]);
this.element!=null&&this.attachToElement(b)},destroy:function(){this.element&&OpenLayers.Event.stopObservingElement(this.element);this.eventHandler=this.fallThrough=this.eventTypes=this.object=this.listeners=this.element=null},addEventType:function(a){this.listeners[a]||(this.listeners[a]=[])},attachToElement:function(a){for(var b=0;b<this.BROWSER_EVENTS.length;b++){var c=this.BROWSER_EVENTS[b];this.addEventType(c);OpenLayers.Event.observe(a,c,this.eventHandler)}OpenLayers.Event.observe(a,"dragstart",
OpenLayers.Event.stop)},register:function(a,b,c){if(c!=null){if(b==null)b=this.object;a=this.listeners[a];a!=null&&a.push({obj:b,func:c})}},registerPriority:function(a,b,c){if(c!=null){if(b==null)b=this.object;a=this.listeners[a];a!=null&&a.unshift({obj:b,func:c})}},unregister:function(a,b,c){if(b==null)b=this.object;a=this.listeners[a];if(a!=null)for(var d=0;d<a.length;d++)if(a[d].obj==b&&a[d].func==c){a.splice(d,1);break}},remove:function(a){if(this.listeners[a]!=null)this.listeners[a]=[]},triggerEvent:function(a,
b){if(b==null)b={};b.object=this.object;b.element=this.element;a=this.listeners[a]?this.listeners[a].slice():null;if(a!=null&&a.length>0){for(var c=0;c<a.length;c++){var d=a[c];d=d.obj!=null?d.func.call(d.obj,b):d.func(b);if(d!=null&&d==false)break}this.fallThrough||OpenLayers.Event.stop(b,true)}},handleBrowserEvent:function(a){a.xy=this.getMousePosition(a);this.triggerEvent(a.type,a)},getMousePosition:function(a){if(!this.element.offsets){this.element.offsets=OpenLayers.Util.pagePosition(this.element);
this.element.offsets[0]+=document.documentElement.scrollLeft||document.body.scrollLeft;this.element.offsets[1]+=document.documentElement.scrollTop||document.body.scrollTop}return new OpenLayers.Pixel(a.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)-this.element.offsets[0]-(document.documentElement.clientLeft||0),a.clientY+(document.documentElement.scrollTop||document.body.scrollTop)-this.element.offsets[1]-(document.documentElement.clientTop||0))},CLASS_NAME:"OpenLayers.Events"});
OpenLayers.Map=OpenLayers.Class({Z_INDEX_BASE:{BaseLayer:100,Overlay:325,Popup:750,Control:1E3},EVENT_TYPES:["addlayer","removelayer","changelayer","movestart","move","moveend","zoomend","popupopen","popupclose","addmarker","removemarker","clearmarkers","mouseover","mouseout","mousemove","dragstart","drag","dragend","changebaselayer"],id:null,events:null,div:null,size:null,viewPortDiv:null,layerContainerOrigin:null,layerContainerDiv:null,layers:null,controls:null,popups:null,baseLayer:null,center:null,
zoom:0,viewRequestID:0,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,fallThrough:false,initialize:function(a,b){this.setOptions(b);this.id=OpenLayers.Util.createUniqueID("OpenLayers.Map_");this.div=OpenLayers.Util.getElement(a);b=this.div.id+"_OpenLayers_ViewPort";this.viewPortDiv=OpenLayers.Util.createDiv(b,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.popupDiv=OpenLayers.Util.createDiv(a.id+"_OpenLayers_PopupDiv",null,null,null,"absolute",null);this.popupDiv.style.zIndex=this.Z_INDEX_BASE.Control+100;this.popupDiv.className="olMapPopup";b=this.div.id+"_OpenLayers_Container";this.layerContainerDiv=OpenLayers.Util.createDiv(b);this.layerContainerDiv.style.zIndex=this.Z_INDEX_BASE.Popup-
1;this.viewPortDiv.appendChild(this.layerContainerDiv);this.viewPortDiv.appendChild(this.popupDiv);this.events=new OpenLayers.Events(this,this.div,this.EVENT_TYPES,this.fallThrough);this.updateSize();this.events.register("movestart",this,this.updateSize);OpenLayers.String.contains(navigator.appName,"Microsoft")?this.events.register("resize",this,this.updateSize):OpenLayers.Event.observe(window,"resize",OpenLayers.Function.bind(this.updateSize,this));if(this.theme){a=true;b=document.getElementsByTagName("link");
for(var c=0;c<b.length;++c)if(OpenLayers.Util.isEquivalentUrl(b.item(c).href,this.theme)){a=false;break}if(a){a=document.createElement("link");a.setAttribute("rel","stylesheet");a.setAttribute("type","text/css");a.setAttribute("href",this.theme);document.getElementsByTagName("head")[0].appendChild(a)}}this.layers=[];if(this.controls==null)this.controls=OpenLayers.Control!=null?[new OpenLayers.Control.Navigation,new OpenLayers.Control.PanZoom,new OpenLayers.Control.ArgParser,new OpenLayers.Control.Attribution]:
[];for(c=0;c<this.controls.length;c++)this.addControlToMap(this.controls[c]);this.popups=[];this.unloadDestroy=OpenLayers.Function.bind(this.destroy,this);OpenLayers.Event.observe(window,"unload",this.unloadDestroy)},unloadDestroy:null,destroy:function(){if(!this.unloadDestroy)return false;OpenLayers.Event.stopObserving(window,"unload",this.unloadDestroy);this.unloadDestroy=null;if(this.layers!=null){for(var a=this.layers.length-1;a>=0;--a)this.layers[a].destroy(false);this.layers=null}if(this.controls!=
null){for(a=this.controls.length-1;a>=0;--a)this.controls[a].destroy();this.controls=null}this.viewPortDiv&&this.div.removeChild(this.viewPortDiv);this.viewPortDiv=null;this.events.destroy();this.events=null},setOptions:function(a){this.tileSize=new OpenLayers.Size(OpenLayers.Map.TILE_WIDTH,OpenLayers.Map.TILE_HEIGHT);this.maxExtent=new OpenLayers.Bounds(-180,-90,180,90);this.theme=OpenLayers._getScriptLocation()+"theme/default/style.css";OpenLayers.Util.extend(this,a)},getTileSize:function(){return this.tileSize},
getLayer:function(a){for(var b=null,c=0;c<this.layers.length;c++){var d=this.layers[c];if(d.id==a)b=d}return b},setLayerZIndex:function(a,b){a.setZIndex(this.Z_INDEX_BASE[a.isBaseLayer?"BaseLayer":"Overlay"]+b*5)},addLayer:function(a){for(var b=0;b<this.layers.length;b++)if(this.layers[b]==a){OpenLayers.Console.warn("You tried to add the layer: "+a.name+" to the map, but it has already been added");return false}a.div.style.overflow="";this.setLayerZIndex(a,this.layers.length);a.isFixed?this.viewPortDiv.appendChild(a.div):
this.layerContainerDiv.appendChild(a.div);this.layers.push(a);a.setMap(this);if(a.isBaseLayer)this.baseLayer==null?this.setBaseLayer(a):a.setVisibility(false);else a.redraw();this.events.triggerEvent("addlayer")},addLayers:function(a){for(var b=0;b<a.length;b++)this.addLayer(a[b])},removeLayer:function(a,b){if(b==null)b=true;a.isFixed?this.viewPortDiv.removeChild(a.div):this.layerContainerDiv.removeChild(a.div);OpenLayers.Util.removeItem(this.layers,a);a.removeMap(this);a.map=null;if(b&&this.baseLayer==
a){this.baseLayer=null;for(i=0;i<this.layers.length;i++){a=this.layers[i];if(a.isBaseLayer){this.setBaseLayer(a);break}}}this.events.triggerEvent("removelayer")},getNumLayers:function(){return this.layers.length},getLayerIndex:function(a){return OpenLayers.Util.indexOf(this.layers,a)},setLayerIndex:function(a,b){var c=this.getLayerIndex(a);if(b<0)b=0;else if(b>this.layers.length)b=this.layers.length;if(c!=b){this.layers.splice(c,1);this.layers.splice(b,0,a);for(a=0;a<this.layers.length;a++)this.setLayerZIndex(this.layers[a],
a);this.events.triggerEvent("changelayer")}},raiseLayer:function(a,b){b=this.getLayerIndex(a)+b;this.setLayerIndex(a,b)},setBaseLayer:function(a){var b=null;if(this.baseLayer)b=this.baseLayer.getExtent();if(a!=this.baseLayer)if(OpenLayers.Util.indexOf(this.layers,a)!=-1){this.baseLayer!=null&&this.baseLayer.setVisibility(false);this.baseLayer=a;this.viewRequestID++;this.baseLayer.visibility=true;a=this.getCenter();if(a!=null)b==null?this.setCenter(a,this.getZoom(),false,true):this.setCenter(b.getCenterLonLat(),
this.getZoomForExtent(b,true),false,true);this.events.triggerEvent("changebaselayer")}},addControl:function(a,b){this.controls.push(a);this.addControlToMap(a,b)},addControlToMap:function(a,b){a.outsideViewport=a.div!=null;a.setMap(this);if(b=a.draw(b))if(!a.outsideViewport){b.style.zIndex=this.Z_INDEX_BASE.Control+this.controls.length;this.viewPortDiv.appendChild(b)}},getControl:function(a){for(var b=null,c=0;c<this.controls.length;c++){var d=this.controls[c];if(d.id==a){b=d;break}}return b},removeControl:function(a){if(a&&
a==this.getControl(a.id)){a.outsideViewport||this.viewPortDiv.removeChild(a.div);OpenLayers.Util.removeItem(this.controls,a)}},addPopup:function(a,b){if(b)for(b=0;b<this.popups.length;b++)this.removePopup(this.popups[b]);a.map=this;this.popups.push(a);if(a=a.draw()){a.style.zIndex=this.Z_INDEX_BASE.Control+100+this.popups.length;this.popupDiv.appendChild(a)}},removePopup:function(a){OpenLayers.Util.removeItem(this.popups,a);if(a.div)try{this.popupDiv.removeChild(a.div)}catch(b){}a.map=null},getSize:function(){var a=
null;if(this.size!=null)a=this.size.clone();return a},updateSize:function(){this.events.element.offsets=null;var a=this.getCurrentSize(),b=this.getSize();if(b==null)this.size=b=a;if(!a.equals(b)){this.size=a;for(b=0;b<this.layers.length;b++)this.layers[b].onMapResize();if(this.baseLayer!=null&&this.center!=undefined){if(navigator.appName.contains("Microsoft")&&this.div.style.height)this.viewPortDiv.style.height=this.div.style.height;this.getLonLatFromViewPortPx(new OpenLayers.Pixel(a.w/2,a.h/2));
a=this.getZoom();this.zoom=null;this.setCenter(this.getCenter(),a)}}},getCurrentSize:function(){var a=new OpenLayers.Size(this.div.clientWidth,this.div.clientHeight);if(a.w==0&&a.h==0||isNaN(a.w)&&isNaN(a.h)){var b=OpenLayers.Element.getDimensions(this.div);a.w=b.width;a.h=b.height}if(a.w==0&&a.h==0||isNaN(a.w)&&isNaN(a.h)){a.w=parseInt(this.div.style.width);a.h=parseInt(this.div.style.height)}return a},calculateBounds:function(a,b){var c=null;if(a==null)a=this.getCenter();if(b==null)b=this.getResolution();
if(a!=null&&b!=null){var d=this.getSize();c=d.w*b;b=d.h*b;c=new OpenLayers.Bounds(a.lon-c/2,a.lat-b/2,a.lon+c/2,a.lat+b/2)}return c},getCenter:function(){return this.center},getZoom:function(){return this.zoom},pan:function(a,b){var c=this.getViewPortPxFromLonLat(this.getCenter());a=c.add(a,b);a.equals(c)||this.setCenter(this.getLonLatFromViewPortPx(a))},setCenter:function(a,b,c,d){if(!this.center&&!this.isValidLonLat(a))a=this.maxExtent.getCenterLonLat();if(this.restrictedExtent!=null){if(a==null)a=
this.getCenter();if(b==null)b=this.getZoom();var e=null;if(this.baseLayer!=null)e=this.baseLayer.resolutions[b];e=this.calculateBounds(a,e);if(!this.restrictedExtent.containsBounds(e)){var f=this.restrictedExtent.getCenterLonLat();if(e.getWidth()>this.restrictedExtent.getWidth())a=new OpenLayers.LonLat(f.lon,a.lat);else if(e.left<this.restrictedExtent.left)a=a.add(this.restrictedExtent.left-e.left,0);else if(e.right>this.restrictedExtent.right)a=a.add(this.restrictedExtent.right-e.right,0);if(e.getHeight()>
this.restrictedExtent.getHeight())a=new OpenLayers.LonLat(a.lon,f.lat);else if(e.bottom<this.restrictedExtent.bottom)a=a.add(0,this.restrictedExtent.bottom-e.bottom);else if(e.top>this.restrictedExtent.top)a=a.add(0,this.restrictedExtent.top-e.top)}}d=d||this.isValidZoomLevel(b)&&b!=this.getZoom();e=this.isValidLonLat(a)&&!a.equals(this.center);if(d||e||!c){c||this.events.triggerEvent("movestart");if(e){!d&&this.center&&this.centerLayerContainer(a);this.center=a.clone()}if(d||this.layerContainerOrigin==
null){this.layerContainerOrigin=this.center.clone();this.layerContainerDiv.style.left="0px";this.layerContainerDiv.style.top="0px"}if(d){this.zoom=b;this.viewRequestID++}a=this.getExtent();this.baseLayer.moveTo(a,d,c);a=this.baseLayer.getExtent();for(b=0;b<this.layers.length;b++){e=this.layers[b];if(!e.isBaseLayer){f=e.calculateInRange();if(e.inRange!=f){e.inRange=f;f=true;this.events.triggerEvent("changelayer")}else f=e.visibility&&e.inRange;f&&e.moveTo(a,d,c)}}if(d)for(b=0;b<this.popups.length;b++)this.popups[b].updatePosition();
this.events.triggerEvent("move");d&&this.events.triggerEvent("zoomend")}this.popupDiv.style.left=this.layerContainerDiv.style.left;this.popupDiv.style.top=this.layerContainerDiv.style.top;c||this.events.triggerEvent("moveend")},centerLayerContainer:function(a){var b=this.getViewPortPxFromLonLat(this.layerContainerOrigin);a=this.getViewPortPxFromLonLat(a);if(b!=null&&a!=null){this.layerContainerDiv.style.left=b.x-a.x+"px";this.layerContainerDiv.style.top=b.y-a.y+"px"}},isValidZoomLevel:function(a){return a!=
null&&a>=0&&a<this.getNumZoomLevels()},isValidLonLat:function(a){var b=false;if(a!=null)b=this.getMaxExtent().containsLonLat(a);return b},getProjection:function(){var a=null;if(this.baseLayer!=null)a=this.baseLayer.projection;return a},getMaxResolution:function(){var a=null;if(this.baseLayer!=null)a=this.baseLayer.maxResolution;return a},getMaxExtent:function(){var a=null;if(this.baseLayer!=null)a=this.baseLayer.maxExtent;return a},getNumZoomLevels:function(){var a=null;if(this.baseLayer!=null)a=
this.baseLayer.numZoomLevels;return a},getExtent:function(){var a=null;if(this.baseLayer!=null)a=this.baseLayer.getExtent();return a},getResolution:function(){var a=null;if(this.baseLayer!=null)a=this.baseLayer.getResolution();return a},getScale:function(){var a=null;if(this.baseLayer!=null){a=this.getResolution();a=OpenLayers.Util.getScaleFromResolution(a,this.baseLayer.units)}return a},getZoomForExtent:function(a,b){var c=null;if(this.baseLayer!=null)c=this.baseLayer.getZoomForExtent(a,b);return c},
getZoomForResolution:function(a,b){var c=null;if(this.baseLayer!=null)c=this.baseLayer.getZoomForResolution(a,b);return c},zoomTo:function(a){this.isValidZoomLevel(a)&&this.setCenter(null,a)},zoomIn:function(){this.zoomTo(this.getZoom()+1)},zoomOut:function(){this.zoomTo(this.getZoom()-1)},zoomToExtent:function(a){var b=a.getCenterLonLat();if(this.baseLayer.wrapDateLine){b=this.getMaxExtent();for(a=a.clone();a.right<a.left;)a.right+=b.getWidth();b=a.getCenterLonLat().wrapDateLine(b)}this.setCenter(b,
this.getZoomForExtent(a))},zoomToMaxExtent:function(){this.zoomToExtent(this.getMaxExtent())},zoomToScale:function(a){var b=OpenLayers.Util.getResolutionFromScale(a,this.baseLayer.units),c=this.getSize();a=c.w*b;b=c.h*b;c=this.getCenter();this.zoomToExtent(new OpenLayers.Bounds(c.lon-a/2,c.lat-b/2,c.lon+a/2,c.lat+b/2))},getLonLatFromViewPortPx:function(a){var b=null;if(this.baseLayer!=null)b=this.baseLayer.getLonLatFromViewPortPx(a);return b},getViewPortPxFromLonLat:function(a){var b=null;if(this.baseLayer!=
null)b=this.baseLayer.getViewPortPxFromLonLat(a);return b},getLonLatFromPixel:function(a){return this.getLonLatFromViewPortPx(a)},getPixelFromLonLat:function(a){return this.getViewPortPxFromLonLat(a)},getViewPortPxFromLayerPx:function(a){var b=null;if(a!=null){b=parseInt(this.layerContainerDiv.style.left);var c=parseInt(this.layerContainerDiv.style.top);b=a.add(b,c)}return b},getLayerPxFromViewPortPx:function(a){var b=null;if(a!=null){b=-parseInt(this.layerContainerDiv.style.left);var c=-parseInt(this.layerContainerDiv.style.top);
b=a.add(b,c);if(isNaN(b.x)||isNaN(b.y))b=null}return b},getLonLatFromLayerPx:function(a){a=this.getViewPortPxFromLayerPx(a);return this.getLonLatFromViewPortPx(a)},getLayerPxFromLonLat:function(a){return this.getLayerPxFromViewPortPx(this.getViewPortPxFromLonLat(a))},CLASS_NAME:"OpenLayers.Map"});OpenLayers.Map.TILE_WIDTH=256;OpenLayers.Map.TILE_HEIGHT=256;
OpenLayers.Layer=OpenLayers.Class({id:null,name:null,div:null,EVENT_TYPES:["loadstart","loadend","loadcancel","visibilitychanged"],events:null,map:null,isBaseLayer:false,alpha:false,displayInLayerSwitcher:true,visibility:true,attribution:null,inRange:false,imageSize:null,imageOffset:null,options:null,gutter:0,projection:null,units:null,scales:null,resolutions:null,maxExtent:null,minExtent:null,maxResolution:null,minResolution:null,numZoomLevels:null,minScale:null,maxScale:null,displayOutsideMaxExtent:false,
wrapDateLine:false,initialize:function(a,b){this.addOptions(b);this.name=a;if(this.id==null){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");this.div=OpenLayers.Util.createDiv();this.div.style.width="100%";this.div.style.height="100%";this.div.id=this.id;this.events=new OpenLayers.Events(this,this.div,this.EVENT_TYPES)}if(this.wrapDateLine)this.displayOutsideMaxExtent=true},destroy:function(a){if(a==null)a=true;this.map!=null&&this.map.removeLayer(this,a);this.options=this.div=this.name=
this.map=null;this.events&&this.events.destroy();this.events=null},clone:function(a){if(a==null)a=new OpenLayers.Layer(this.name,this.options);OpenLayers.Util.applyDefaults(a,this);a.map=null;return a},setName:function(a){if(a!=this.name){this.name=a;this.map!=null&&this.map.events.triggerEvent("changelayer")}},addOptions:function(a){if(this.options==null)this.options={};OpenLayers.Util.extend(this.options,a);OpenLayers.Util.extend(this,a)},onMapResize:function(){},redraw:function(){var a=false;if(this.map){this.inRange=
this.calculateInRange();var b=this.getExtent();if(b&&this.inRange&&this.visibility){this.moveTo(b,true,false);a=true}}return a},moveTo:function(){var a=this.visibility;this.isBaseLayer||(a=a&&this.inRange);this.display(a)},setMap:function(a){if(this.map==null){this.map=a;this.maxExtent=this.maxExtent||this.map.maxExtent;this.projection=this.projection||this.map.projection;this.units=this.units||this.map.units;this.initResolutions();if(!this.isBaseLayer){this.inRange=this.calculateInRange();this.div.style.display=
this.visibility&&this.inRange?"":"none"}this.setTileSize()}},removeMap:function(){},getImageSize:function(){return this.imageSize||this.tileSize},setTileSize:function(a){this.tileSize=a=a?a:this.tileSize?this.tileSize:this.map.getTileSize();if(this.gutter){this.imageOffset=new OpenLayers.Pixel(-this.gutter,-this.gutter);this.imageSize=new OpenLayers.Size(a.w+2*this.gutter,a.h+2*this.gutter)}},getVisibility:function(){return this.visibility},setVisibility:function(a){if(a!=this.visibility){this.visibility=
a;this.display(a);this.redraw();this.map!=null&&this.map.events.triggerEvent("changelayer");this.events.triggerEvent("visibilitychanged")}},display:function(a){if(a!=(this.div.style.display!="none"))this.div.style.display=a?"block":"none"},calculateInRange:function(){var a=false;if(this.map){a=this.map.getResolution();a=a>=this.minResolution&&a<=this.maxResolution}return a},setIsBaseLayer:function(a){if(a!=this.isBaseLayer){this.isBaseLayer=a;this.map!=null&&this.map.events.triggerEvent("changelayer")}},
initResolutions:function(){for(var a=new Array("projection","units","scales","resolutions","maxScale","minScale","maxResolution","minResolution","minExtent","maxExtent","numZoomLevels","maxZoomLevel"),b={},c=0;c<a.length;c++){var d=a[c];b[d]=this.options[d]||this.map[d]}if(!b.numZoomLevels&&b.maxZoomLevel)b.numZoomLevels=b.maxZoomLevel+1;if(b.scales!=null||b.resolutions!=null){if(b.scales!=null){b.resolutions=[];for(c=0;c<b.scales.length;c++)b.resolutions[c]=OpenLayers.Util.getResolutionFromScale(b.scales[c],
b.units)}b.numZoomLevels=b.resolutions.length}else{b.resolutions=[];if(b.minScale)b.maxResolution=OpenLayers.Util.getResolutionFromScale(b.minScale,b.units);else if(b.maxResolution=="auto"){a=this.map.getSize();c=b.maxExtent.getWidth()/a.w;a=b.maxExtent.getHeight()/a.h;b.maxResolution=Math.max(c,a)}if(b.maxScale!=null)b.minResolution=OpenLayers.Util.getResolutionFromScale(b.maxScale);else if(b.minResolution=="auto"&&b.minExtent!=null){a=this.map.getSize();c=b.minExtent.getWidth()/a.w;a=b.minExtent.getHeight()/
a.h;b.minResolution=Math.max(c,a)}if(b.minResolution!=null)b.numZoomLevels=Math.floor(Math.log(b.maxResolution/b.minResolution)/Math.log(2))+1;for(c=0;c<b.numZoomLevels;c++){a=b.maxResolution/Math.pow(2,c);b.resolutions.push(a)}}b.resolutions.sort(function(e,f){return f-e});this.resolutions=b.resolutions;this.maxResolution=b.resolutions[0];this.minResolution=b.resolutions[b.resolutions.length-1];this.scales=[];for(c=0;c<b.resolutions.length;c++)this.scales[c]=OpenLayers.Util.getScaleFromResolution(b.resolutions[c],
b.units);this.minScale=this.scales[0];this.maxScale=this.scales[this.scales.length-1];this.numZoomLevels=b.numZoomLevels},getResolution:function(){return this.resolutions[this.map.getZoom()]},getExtent:function(){return this.map.calculateBounds()},getZoomForExtent:function(a,b){var c=this.map.getSize();return this.getZoomForResolution(Math.max(a.getWidth()/c.w,a.getHeight()/c.h),b)},getDataExtent:function(){},getZoomForResolution:function(a,b){for(var c,d=Number.POSITIVE_INFINITY,e=0;e<this.resolutions.length;e++)if(b){c=
Math.abs(this.resolutions[e]-a);if(c>d)break;d=c}else if(this.resolutions[e]<a)break;return Math.max(0,e-1)},getLonLatFromViewPortPx:function(a){var b=null;if(a!=null){var c=this.map.getSize(),d=this.map.getCenter();if(d){b=this.map.getResolution();b=new OpenLayers.LonLat(d.lon+(a.x-c.w/2)*b,d.lat-(a.y-c.h/2)*b);if(this.wrapDateLine)b=b.wrapDateLine(this.maxExtent)}}return b},getViewPortPxFromLonLat:function(a){var b=null;if(a!=null){b=this.map.getResolution();var c=this.map.getExtent();b=new OpenLayers.Pixel(Math.round(1/
b*(a.lon-c.left)),Math.round(1/b*(c.top-a.lat)))}return b},setOpacity:function(a){if(a!=this.opacity){this.opacity=a;for(var b=0;b<this.div.childNodes.length;++b)OpenLayers.Util.modifyDOMElement(this.div.childNodes[b].firstChild,null,null,null,null,null,null,a)}},setZIndex:function(a){this.div.style.zIndex=a},adjustBounds:function(a){if(this.gutter){var b=this.gutter*this.map.getResolution();a=new OpenLayers.Bounds(a.left-b,a.bottom-b,a.right+b,a.top+b)}if(this.wrapDateLine){b={rightTolerance:this.getResolution()};
a=a.wrapDateLine(this.maxExtent,b)}return a},CLASS_NAME:"OpenLayers.Layer"});
OpenLayers.Icon=OpenLayers.Class({url:null,size:null,offset:null,calculateOffset:null,imageDiv:null,px:null,initialize:function(a,b,c,d){this.url=a;this.size=b?b:new OpenLayers.Size(20,20);this.offset=c?c:new OpenLayers.Pixel(-(this.size.w/2),-(this.size.h/2));this.calculateOffset=d;a=OpenLayers.Util.createUniqueID("OL_Icon_");this.imageDiv=OpenLayers.Util.createAlphaImageDiv(a)},destroy:function(){OpenLayers.Event.stopObservingElement(this.imageDiv.firstChild);OpenLayers.Util.removeNode(this.imageDiv);
this.imageDiv=null},clone:function(){return new OpenLayers.Icon(this.url,this.size,this.offset,this.calculateOffset)},setSize:function(a){if(a!=null)this.size=a;this.draw()},draw:function(a){OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,null,this.size,this.url,"absolute");this.moveTo(a);return this.imageDiv},setOpacity:function(a){OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,null,null,null,null,null,null,a)},moveTo:function(a){if(a!=null)this.px=a;if(this.imageDiv!=null)if(this.px==
null)this.display(false);else{if(this.calculateOffset)this.offset=this.calculateOffset(this.size);a=this.px.offset(this.offset);OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,a)}},display:function(a){this.imageDiv.style.display=a?"":"none"},CLASS_NAME:"OpenLayers.Icon"});
OpenLayers.Marker=OpenLayers.Class({icon:null,lonlat:null,events:null,map:null,initialize:function(a,b){this.lonlat=a;a=b?b:OpenLayers.Marker.defaultIcon();if(this.icon==null)this.icon=a;else{this.icon.url=a.url;this.icon.size=a.size;this.icon.offset=a.offset;this.icon.calculateOffset=a.calculateOffset}this.events=new OpenLayers.Events(this,this.icon.imageDiv,null)},destroy:function(){this.map=null;this.events.destroy();this.events=null;if(this.icon!=null){this.icon.destroy();this.icon=null}},draw:function(a){return this.icon.draw(a)},
moveTo:function(a){a!=null&&this.icon!=null&&this.icon.moveTo(a);this.lonlat=this.map.getLonLatFromLayerPx(a)},onScreen:function(){var a=false;if(this.map)a=this.map.getExtent().containsLonLat(this.lonlat);return a},inflate:function(a){this.icon&&this.icon.setSize(new OpenLayers.Size(this.icon.size.w*a,this.icon.size.h*a))},setOpacity:function(a){this.icon.setOpacity(a)},display:function(a){this.icon.display(a)},CLASS_NAME:"OpenLayers.Marker"});
OpenLayers.Marker.defaultIcon=function(){var a=OpenLayers.Util.getImagesLocation()+"marker.png",b=new OpenLayers.Size(21,25);return new OpenLayers.Icon(a,b,null,function(c){return new OpenLayers.Pixel(-(c.w/2),-c.h)})};
OpenLayers.Marker.Box=OpenLayers.Class(OpenLayers.Marker,{bounds:null,div:null,initialize:function(a,b,c){this.bounds=a;this.div=OpenLayers.Util.createDiv();this.div.style.overflow="hidden";this.events=new OpenLayers.Events(this,this.div,null);this.setBorder(b,c)},destroy:function(){this.div=this.bounds=null;OpenLayers.Marker.prototype.destroy.apply(this,arguments)},setBorder:function(a,b){a||(a="red");b||(b=2);this.div.style.border=b+"px solid "+a},draw:function(a,b){OpenLayers.Util.modifyDOMElement(this.div,
null,a,b);return this.div},onScreen:function(){var a=false;if(this.map)a=this.map.getExtent().containsBounds(this.bounds,true,true);return a},display:function(a){this.div.style.display=a?"":"none"},CLASS_NAME:"OpenLayers.Marker.Box"});
OpenLayers.Popup=OpenLayers.Class({events:null,id:"",lonlat:null,div:null,size:null,contentHTML:"",backgroundColor:"",opacity:"",border:"",contentDiv:null,groupDiv:null,padding:5,map:null,initialize:function(a,b,c,d,e){if(a==null)a=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");this.id=a;this.lonlat=b;this.size=c!=null?c:new OpenLayers.Size(OpenLayers.Popup.WIDTH,OpenLayers.Popup.HEIGHT);if(d!=null)this.contentHTML=d;this.backgroundColor=OpenLayers.Popup.COLOR;this.opacity=OpenLayers.Popup.OPACITY;
this.border=OpenLayers.Popup.BORDER;this.div=OpenLayers.Util.createDiv(this.id,null,null,null,null,null,"hidden");this.div.className="olPopup";this.groupDiv=OpenLayers.Util.createDiv(null,null,null,null,"relative",null,"hidden");a=this.div.id+"_contentDiv";this.contentDiv=OpenLayers.Util.createDiv(a,null,this.size.clone(),null,"relative",null,"hidden");this.contentDiv.className="olPopupContent";this.groupDiv.appendChild(this.contentDiv);this.div.appendChild(this.groupDiv);if(e){a=new OpenLayers.Size(17,
17);b=OpenLayers.Util.getImagesLocation()+"close.gif";a=OpenLayers.Util.createAlphaImageDiv(this.id+"_close",null,a,b);a.style.right=this.padding+"px";a.style.top=this.padding+"px";this.groupDiv.appendChild(a);OpenLayers.Event.observe(a,"click",OpenLayers.Function.bindAsEventListener(function(f){this.hide();OpenLayers.Event.stop(f)},this))}this.registerEvents()},destroy:function(){if(this.map!=null){this.map.removePopup(this);this.map=null}this.events.destroy();this.div=this.events=null},draw:function(a){if(a==
null)if(this.lonlat!=null&&this.map!=null)a=this.map.getLayerPxFromLonLat(this.lonlat);this.setSize();this.setBackgroundColor();this.setOpacity();this.setBorder();this.setContentHTML();this.moveTo(a);return this.div},updatePosition:function(){if(this.lonlat&&this.map){var a=this.map.getLayerPxFromLonLat(this.lonlat);a&&this.moveTo(a)}},moveTo:function(a){if(a!=null&&this.div!=null){this.div.style.left=a.x+"px";this.div.style.top=a.y+"px"}},visible:function(){return OpenLayers.Element.visible(this.div)},
toggle:function(){OpenLayers.Element.toggle(this.div)},show:function(){OpenLayers.Element.show(this.div)},hide:function(){OpenLayers.Element.hide(this.div)},setSize:function(a){if(a!=undefined)this.size=a;if(this.div!=null){this.div.style.width=this.size.w+"px";this.div.style.height=this.size.h+"px"}if(this.contentDiv!=null){this.contentDiv.style.width=this.size.w+"px";this.contentDiv.style.height=this.size.h+"px"}},setBackgroundColor:function(a){if(a!=undefined)this.backgroundColor=a;if(this.div!=
null)this.div.style.backgroundColor=this.backgroundColor},setOpacity:function(a){if(a!=undefined)this.opacity=a;if(this.div!=null){this.div.style.opacity=this.opacity;this.div.style.filter="alpha(opacity="+this.opacity*100+")"}},setBorder:function(a){if(a!=undefined)this.border=a;if(this.div!=null)this.div.style.border=this.border},setContentHTML:function(a){if(a!=null)this.contentHTML=a;if(this.contentDiv!=null)this.contentDiv.innerHTML=this.contentHTML},registerEvents:function(){this.events=new OpenLayers.Events(this,
this.div,null,true);this.events.register("mousedown",this,this.onmousedown);this.events.register("mousemove",this,this.onmousemove);this.events.register("mouseup",this,this.onmouseup);this.events.register("click",this,this.onclick);this.events.register("mouseout",this,this.onmouseout);this.events.register("dblclick",this,this.ondblclick)},onmousedown:function(a){this.mousedown=true;OpenLayers.Event.stop(a,true)},onmousemove:function(a){this.mousedown&&OpenLayers.Event.stop(a,true)},onmouseup:function(a){if(this.mousedown){this.mousedown=
false;OpenLayers.Event.stop(a,true)}},onclick:function(a){OpenLayers.Event.stop(a,true)},onmouseout:function(){this.mousedown=false},ondblclick:function(a){OpenLayers.Event.stop(a,true)},CLASS_NAME:"OpenLayers.Popup"});OpenLayers.Popup.WIDTH=200;OpenLayers.Popup.HEIGHT=200;OpenLayers.Popup.COLOR="white";OpenLayers.Popup.OPACITY=1;OpenLayers.Popup.BORDER="0px";
OpenLayers.Tile=OpenLayers.Class({EVENT_TYPES:["loadstart","loadend","reload"],events:null,id:null,layer:null,url:null,bounds:null,size:null,position:null,drawn:false,isLoading:false,initialize:function(a,b,c,d,e){this.layer=a;this.position=b;this.bounds=c;this.url=d;this.size=e;this.id=OpenLayers.Util.createUniqueID("Tile_");this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES)},destroy:function(){this.position=this.size=this.bounds=this.layer=null;this.events.destroy();this.events=null},
draw:function(){this.clear();var a=this.layer.maxExtent;a=a&&this.bounds.intersectsBounds(a,false);var b=this.layer.map.getExtent();b=b&&this.bounds.intersectsBounds(b,false);return(a||this.layer.displayOutsideMaxExtent)&&(b||this.layer.buffer!=0)},moveTo:function(a,b,c){if(c==null)c=true;this.clear();this.bounds=a.clone();this.position=b.clone();c&&this.draw()},clear:function(){this.drawn=false},getBoundsFromBaseLayer:function(a){OpenLayers.Console.warn("You are using the 'reproject' option on the "+
this.layer.name+" 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.");var b=this.layer.map.getLonLatFromLayerPx(a);a=a.clone();a.x+=this.size.w;a.y+=this.size.h;a=this.layer.map.getLonLatFromLayerPx(a);if(b.lon>a.lon)if(b.lon<0)b.lon=-180-(b.lon+180);else a.lon=180+a.lon+180;
return bounds=new OpenLayers.Bounds(b.lon,a.lat,a.lon,b.lat)},CLASS_NAME:"OpenLayers.Tile"});
OpenLayers.Tile.Image=OpenLayers.Class(OpenLayers.Tile,{url:null,imgDiv:null,frame:null,initialize:function(a,b,c,d){OpenLayers.Tile.prototype.initialize.apply(this,arguments);this.url=d;this.frame=document.createElement("div");this.frame.style.overflow="hidden";this.frame.style.position="absolute"},destroy:function(){if(this.imgDiv!=null){OpenLayers.Event.stopObservingElement(this.imgDiv.id);if(this.imgDiv.parentNode==this.frame){this.frame.removeChild(this.imgDiv);this.imgDiv.map=null}}this.imgDiv=
null;this.frame!=null&&this.frame.parentNode==this.layer.div&&this.layer.div.removeChild(this.frame);this.frame=null;OpenLayers.Tile.prototype.destroy.apply(this,arguments)},draw:function(){if(this.layer!=this.layer.map.baseLayer&&this.layer.reproject)this.bounds=this.getBoundsFromBaseLayer(this.position);if(!OpenLayers.Tile.prototype.draw.apply(this,arguments))return false;if(this.isLoading)this.events.triggerEvent("reload");else{this.isLoading=true;this.events.triggerEvent("loadstart")}this.imgDiv==
null&&this.initImgDiv();this.imgDiv.viewRequestID=this.layer.map.viewRequestID;this.url=this.layer.getURL(this.bounds);OpenLayers.Util.modifyDOMElement(this.frame,null,this.position,this.size);var a=this.layer.getImageSize();if(this.layer.alpha)OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv,null,null,a,this.url);else{this.imgDiv.src=this.url;OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,a)}return this.drawn=true},clear:function(){OpenLayers.Tile.prototype.clear.apply(this,arguments);if(this.imgDiv){this.imgDiv.style.display=
"none";if(OpenLayers.Tile.Image.useBlankTile)this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif"}},initImgDiv:function(){var a=this.layer.imageOffset,b=this.layer.getImageSize();this.imgDiv=this.layer.alpha?OpenLayers.Util.createAlphaImageDiv(null,a,b,null,"relative",null,null,null,true):OpenLayers.Util.createImage(null,a,b,null,"relative",null,null,true);this.imgDiv.className="olTileImage";this.frame.appendChild(this.imgDiv);this.layer.div.appendChild(this.frame);this.layer.opacity!=
null&&OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,null,null,null,null,this.layer.opacity);this.imgDiv.map=this.layer.map;OpenLayers.Event.observe(this.imgDiv,"load",OpenLayers.Function.bind(function(){if(this.isLoading){this.isLoading=false;this.events.triggerEvent("loadend")}},this))},checkImgURL:function(){if(this.layer)if(!OpenLayers.Util.isEquivalentUrl(this.layer.alpha?this.imgDiv.firstChild.src:this.imgDiv.src,this.url))this.imgDiv.style.display="none"},CLASS_NAME:"OpenLayers.Tile.Image"});
OpenLayers.Tile.Image.useBlankTile=navigator.userAgent.indexOf("Opera")!=-1||navigator.userAgent.indexOf("AppleWebKit")!=-1;
OpenLayers.Tile.WFS=OpenLayers.Class(OpenLayers.Tile,{features:null,url:null,initialize:function(a,b,c,d){OpenLayers.Tile.prototype.initialize.apply(this,arguments);this.url=d;this.features=[]},destroy:function(){OpenLayers.Tile.prototype.destroy.apply(this,arguments);this.destroyAllFeatures();this.url=this.features=null},clear:function(){OpenLayers.Tile.prototype.clear.apply(this,arguments);this.destroyAllFeatures()},draw:function(){if(OpenLayers.Tile.prototype.draw.apply(this,arguments)){if(this.isLoading)this.events.triggerEvent("reload");
else{this.isLoading=true;this.events.triggerEvent("loadstart")}this.loadFeaturesForRegion(this.requestSuccess)}},loadFeaturesForRegion:function(a){OpenLayers.loadURL(this.url,null,this,a)},requestSuccess:function(a){if(this.features){var b=a.responseXML;if(!b||a.fileType!="XML")b=OpenLayers.parseXMLString(a.responseText);this.layer.vectorMode?this.layer.addFeatures((new OpenLayers.Format.GML({extractAttributes:this.layer.options.extractAttributes})).read(b)):this.addResults(OpenLayers.Ajax.getElementsByTagNameNS(b,
"http://www.opengis.net/gml","gml","featureMember"))}this.events&&this.events.triggerEvent("loadend")},addResults:function(a){for(var b=0;b<a.length;b++)this.features.push(new this.layer.featureClass(this.layer,a[b]))},destroyAllFeatures:function(){for(;this.features.length>0;)this.features.shift().destroy()},CLASS_NAME:"OpenLayers.Tile.WFS"});
OpenLayers.Layer.Image=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:true,url:null,extent:null,size:null,tile:null,aspectRatio:null,initialize:function(a,b,c,d,e){this.url=b;this.extent=c;this.size=d;OpenLayers.Layer.prototype.initialize.apply(this,[a,e]);this.aspectRatio=this.extent.getHeight()/this.size.h/(this.extent.getWidth()/this.size.w)},destroy:function(){if(this.tile){this.tile.destroy();this.tile=null}OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(a){if(a==null)a=
new OpenLayers.Layer.Image(this.name,this.url,this.extent,this.size,this.options);return a=OpenLayers.Layer.prototype.clone.apply(this,[a])},setMap:function(){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(a,b){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);var c=this.tile==null;if(b||c){this.setTileSize();var d=this.map.getLayerPxFromLonLat(new OpenLayers.LonLat(this.extent.left,
this.extent.top));if(c)this.tile=new OpenLayers.Tile.Image(this,d,this.extent,null,this.tileSize);else{this.tile.size=this.tileSize.clone();this.tile.position=d.clone()}this.tile.draw()}},setTileSize:function(){var a=this.extent.getWidth()/this.map.getResolution(),b=this.extent.getHeight()/this.map.getResolution();this.tileSize=new OpenLayers.Size(a,b)},setUrl:function(a){this.url=a;this.tile.draw()},getURL:function(){return this.url},CLASS_NAME:"OpenLayers.Layer.Image"});
OpenLayers.Layer.SphericalMercator={getExtent:function(){var a=null;return a=this.sphericalMercator?this.map.calculateBounds():OpenLayers.Layer.FixedZoomLevels.prototype.getExtent.apply(this)},initMercatorParameters:function(){this.RESOLUTIONS=[];for(var a=0;a<=this.MAX_ZOOM_LEVEL;++a)this.RESOLUTIONS[a]=156543.0339/Math.pow(2,a);this.units="m";this.projection="EPSG:900913"},forwardMercator:function(a,b){a=a*2.003750834E7/180;b=Math.log(Math.tan((90+b)*Math.PI/360))/(Math.PI/180);b=b*2.003750834E7/
180;return new OpenLayers.LonLat(a,b)},inverseMercator:function(a,b){a=a/2.003750834E7*180;b=b/2.003750834E7*180;b=180/Math.PI*(2*Math.atan(Math.exp(b*Math.PI/180))-Math.PI/2);return new OpenLayers.LonLat(a,b)}};
OpenLayers.Layer.EventPane=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:true,isFixed:true,pane:null,mapObject:null,initialize:function(){OpenLayers.Layer.prototype.initialize.apply(this,arguments);if(this.pane==null)this.pane=OpenLayers.Util.createDiv(this.div.id+"_EventPane")},destroy:function(){this.mapObject=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},setMap:function(){OpenLayers.Layer.prototype.setMap.apply(this,arguments);this.pane.style.zIndex=parseInt(this.div.style.zIndex)+
1;this.pane.style.display=this.div.style.display;this.pane.style.width="100%";this.pane.style.height="100%";if(OpenLayers.Util.getBrowserName()=="msie")this.pane.style.background="url("+OpenLayers.Util.getImagesLocation()+"blank.gif)";this.isFixed?this.map.viewPortDiv.appendChild(this.pane):this.map.layerContainerDiv.appendChild(this.pane);this.loadMapObject();this.mapObject==null&&this.loadWarningMessage()},removeMap:function(){if(this.pane&&this.pane.parentNode){this.pane.parentNode.removeChild(this.pane);
this.pane=null}OpenLayers.Layer.prototype.removeMap.apply(this,arguments)},loadWarningMessage:function(){this.div.style.backgroundColor="darkblue";var a=this.map.getSize();msgW=Math.min(a.w,300);msgH=Math.min(a.h,200);var b=new OpenLayers.Size(msgW,msgH);a=(new OpenLayers.Pixel(a.w/2,a.h/2)).add(-b.w/2,-b.h/2);b=OpenLayers.Util.createDiv(this.name+"_warning",a,b,null,null,null,"auto");b.style.padding="7px";b.style.backgroundColor="yellow";b.innerHTML=this.getWarningHTML();this.div.appendChild(b)},
getWarningHTML:function(){return""},display:function(){OpenLayers.Layer.prototype.display.apply(this,arguments);this.pane.style.display=this.div.style.display},setZIndex:function(){OpenLayers.Layer.prototype.setZIndex.apply(this,arguments);this.pane.style.zIndex=parseInt(this.div.style.zIndex)+1},moveTo:function(){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);if(this.mapObject!=null){var a=this.map.getCenter(),b=this.map.getZoom();if(a!=null){var c=this.getOLLonLatFromMapObjectLonLat(this.getMapObjectCenter()),
d=this.getOLZoomFromMapObjectZoom(this.getMapObjectZoom());if(!a.equals(c)||b!=d){a=this.getMapObjectLonLatFromOLLonLat(a);b=this.getMapObjectZoomFromOLZoom(b);this.setMapObjectCenter(a,b)}}}},getLonLatFromViewPortPx:function(a){var b=null;if(this.mapObject!=null&&this.getMapObjectCenter()!=null)b=this.getOLLonLatFromMapObjectLonLat(this.getMapObjectLonLatFromMapObjectPixel(this.getMapObjectPixelFromOLPixel(a)));return b},getViewPortPxFromLonLat:function(a){var b=null;if(this.mapObject!=null&&this.getMapObjectCenter()!=
null)b=this.getOLPixelFromMapObjectPixel(this.getMapObjectPixelFromMapObjectLonLat(this.getMapObjectLonLatFromOLLonLat(a)));return b},getOLLonLatFromMapObjectLonLat:function(a){var b=null;if(a!=null){b=this.getLongitudeFromMapObjectLonLat(a);a=this.getLatitudeFromMapObjectLonLat(a);b=new OpenLayers.LonLat(b,a)}return b},getMapObjectLonLatFromOLLonLat:function(a){var b=null;if(a!=null)b=this.getMapObjectLonLatFromLonLat(a.lon,a.lat);return b},getOLPixelFromMapObjectPixel:function(a){var b=null;if(a!=
null){b=this.getXFromMapObjectPixel(a);a=this.getYFromMapObjectPixel(a);b=new OpenLayers.Pixel(b,a)}return b},getMapObjectPixelFromOLPixel:function(a){var b=null;if(a!=null)b=this.getMapObjectPixelFromXY(a.x,a.y);return b},CLASS_NAME:"OpenLayers.Layer.EventPane"});
OpenLayers.Layer.FixedZoomLevels=OpenLayers.Class({initialize:function(){},initResolutions:function(){for(var a=new Array("minZoomLevel","maxZoomLevel","numZoomLevels"),b=0;b<a.length;b++){var c=a[b];this[c]=this.options[c]!=null?this.options[c]:this.map[c]}if(this.minZoomLevel==null||this.minZoomLevel<this.MIN_ZOOM_LEVEL)this.minZoomLevel=this.MIN_ZOOM_LEVEL;b=this.MAX_ZOOM_LEVEL-this.minZoomLevel+1;this.numZoomLevels=this.numZoomLevels!=null?Math.min(this.numZoomLevels,b):this.maxZoomLevel!=null?
Math.min(this.maxZoomLevel-this.minZoomLevel+1,b):b;this.maxZoomLevel=this.minZoomLevel+this.numZoomLevels-1;if(this.RESOLUTIONS!=null){a=0;this.resolutions=[];for(b=this.minZoomLevel;b<this.numZoomLevels;b++)this.resolutions[a++]=this.RESOLUTIONS[b]}},getResolution:function(){if(this.resolutions!=null)return OpenLayers.Layer.prototype.getResolution.apply(this,arguments);else{var a=null,b=this.map.getSize(),c=this.getExtent();if(b!=null&&c!=null)a=Math.max(c.getWidth()/b.w,c.getHeight()/b.h);return a}},
getExtent:function(){var a=null,b=this.map.getSize(),c=this.getLonLatFromViewPortPx(new OpenLayers.Pixel(0,0));b=this.getLonLatFromViewPortPx(new OpenLayers.Pixel(b.w,b.h));if(c!=null&&b!=null)a=new OpenLayers.Bounds(c.lon,b.lat,b.lon,c.lat);return a},getZoomForResolution:function(a){return this.resolutions!=null?OpenLayers.Layer.prototype.getZoomForResolution.apply(this,arguments):this.getZoomForExtent(OpenLayers.Layer.prototype.getExtent.apply(this,[a]))},getOLZoomFromMapObjectZoom:function(a){var b=
null;if(a!=null)b=a-this.minZoomLevel;return b},getMapObjectZoomFromOLZoom:function(a){var b=null;if(a!=null)b=a+this.minZoomLevel;return b},CLASS_NAME:"FixedZoomLevels.js"});
OpenLayers.Layer.HTTPRequest=OpenLayers.Class(OpenLayers.Layer,{URL_HASH_FACTOR:(Math.sqrt(5)-1)/2,url:null,params:null,reproject:false,initialize:function(a,b,c,d){var e=arguments;e=[a,d];OpenLayers.Layer.prototype.initialize.apply(this,e);this.url=b;this.params=OpenLayers.Util.extend({},c)},destroy:function(){this.params=this.url=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(a){if(a==null)a=new OpenLayers.Layer.HTTPRequest(this.name,this.url,this.params,this.options);
return a=OpenLayers.Layer.prototype.clone.apply(this,[a])},setUrl:function(a){this.url=a},mergeNewParams:function(a){this.params=OpenLayers.Util.extend(this.params,a);this.redraw()},selectUrl:function(a,b){for(var c=1,d=0;d<a.length;d++){c*=a.charCodeAt(d)*this.URL_HASH_FACTOR;c-=Math.floor(c)}return b[Math.floor(c*b.length)]},getFullRequestString:function(a,b){b=b||this.url;var c=OpenLayers.Util.extend({},this.params);c=OpenLayers.Util.extend(c,a);a=OpenLayers.Util.getParameterString(c);if(b instanceof
Array)b=this.selectUrl(a,b);a=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(b));for(var d in c)d.toUpperCase()in a&&delete c[d];a=OpenLayers.Util.getParameterString(c);d=b;if(a!=""){c=b.charAt(b.length-1);d+=c=="&"||c=="?"?a:b.indexOf("?")==-1?"?"+a:"&"+a}return d},CLASS_NAME:"OpenLayers.Layer.HTTPRequest"});
OpenLayers.Layer.Grid=OpenLayers.Class(OpenLayers.Layer.HTTPRequest,{tileSize:null,grid:null,singleTile:false,ratio:1.5,buffer:0,numLoadingTiles:0,initialize:function(){OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,arguments);this.events.addEventType("tileloaded");this.grid=[]},destroy:function(){this.clearGrid();this.tileSize=this.grid=null;OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this,arguments)},clearGrid:function(){if(this.grid){for(var a=0;a<this.grid.length;a++)for(var b=
this.grid[a],c=0;c<b.length;c++){var d=b[c];this.removeTileMonitoringHooks(d);d.destroy()}this.grid=[]}},clone:function(a){if(a==null)a=new OpenLayers.Layer.Grid(this.name,this.url,this.params,this.options);a=OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this,[a]);if(this.tileSize!=null)a.tileSize=this.tileSize.clone();a.grid=[];return a},moveTo:function(a,b,c){OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this,arguments);a=a||this.map.getExtent();if(a!=null){var d=!this.grid.length||b,
e=this.getTilesBounds();if(this.singleTile){if(d||!c&&!e.containsBounds(a))this.initSingleTile(a)}else d||!e.containsBounds(a,true)?this.initGriddedTiles(a):this.moveGriddedTiles(a)}},setTileSize:function(a){if(this.singleTile){a=this.map.getSize().clone();a.h=parseInt(a.h*this.ratio);a.w=parseInt(a.w*this.ratio)}OpenLayers.Layer.HTTPRequest.prototype.setTileSize.apply(this,[a])},getGridBounds:function(){OpenLayers.Console.warn("The getGridBounds() function is deprecated. It will be removed in 3.0. Please use getTilesBounds() instead.");
return this.getTilesBounds()},getTilesBounds:function(){var a=null;if(this.grid.length){a=this.grid[this.grid.length-1][0];var b=this.grid[0][this.grid[0].length-1];a=new OpenLayers.Bounds(a.bounds.left,a.bounds.bottom,b.bounds.right,b.bounds.top)}return a},initSingleTile:function(a){var b=a.getCenterLonLat(),c=a.getWidth()*this.ratio;a=a.getHeight()*this.ratio;b=new OpenLayers.Bounds(b.lon-c/2,b.lat-a/2,b.lon+c/2,b.lat+a/2);c=this.map.getLayerPxFromLonLat(new OpenLayers.LonLat(b.left,b.top));this.grid.length||
(this.grid[0]=[]);if(a=this.grid[0][0])a.moveTo(b,c);else{a=this.addTile(b,c);this.addTileMonitoringHooks(a);a.draw();this.grid[0][0]=a}this.removeExcessTiles(1,1)},initGriddedTiles:function(a){var b=this.map.getSize(),c=Math.ceil(b.h/this.tileSize.h)+Math.max(1,2*this.buffer);b=Math.ceil(b.w/this.tileSize.w)+Math.max(1,2*this.buffer);var d=this.map.getMaxExtent(),e=this.map.getResolution(),f=e*this.tileSize.w;e=e*this.tileSize.h;var g=a.left-d.left,h=Math.floor(g/f)-this.buffer;g=-(g/f-h)*this.tileSize.w;
h=d.left+h*f;var j=a.top-(d.bottom+e),k=Math.ceil(j/e)+this.buffer;j=-(k-j/e)*this.tileSize.h;d=d.bottom+k*e;g=Math.round(g);j=Math.round(j);this.origin=new OpenLayers.Pixel(g,j);k=g;var m=h,l=0;do{var o=this.grid[l++];if(!o){o=[];this.grid.push(o)}h=m;g=k;var p=0;do{var q=new OpenLayers.Bounds(h,d,h+f,d+e),n=g;n-=parseInt(this.map.layerContainerDiv.style.left);var r=j;r-=parseInt(this.map.layerContainerDiv.style.top);n=new OpenLayers.Pixel(n,r);if(r=o[p++])r.moveTo(q,n,false);else{r=this.addTile(q,
n);this.addTileMonitoringHooks(r);o.push(r)}h+=f;g+=this.tileSize.w}while(h<=a.right+f*this.buffer||p<b);d-=e;j+=this.tileSize.h}while(d>=a.bottom-e*this.buffer||l<c);this.removeExcessTiles(l,p);this.spiralTileLoad()},spiralTileLoad:function(){for(var a=[],b=["right","down","left","up"],c=0,d=-1,e=OpenLayers.Util.indexOf(b,"right"),f=0;f<b.length;){var g=c,h=d;switch(b[e]){case "right":h++;break;case "down":g++;break;case "left":h--;break;case "up":g--;break}var j=null;if(g<this.grid.length&&g>=0&&
h<this.grid[0].length&&h>=0)j=this.grid[g][h];if(j!=null&&!j.queued){a.unshift(j);j.queued=true;f=0;c=g;d=h}else{e=(e+1)%4;f++}}for(b=0;b<a.length;b++){j=a[b];j.draw();j.queued=false}},addTile:function(){},addTileMonitoringHooks:function(a){a.onLoadStart=function(){this.numLoadingTiles==0&&this.events.triggerEvent("loadstart");this.numLoadingTiles++};a.events.register("loadstart",this,a.onLoadStart);a.onLoadEnd=function(){this.numLoadingTiles--;this.events.triggerEvent("tileloaded");this.numLoadingTiles==
0&&this.events.triggerEvent("loadend")};a.events.register("loadend",this,a.onLoadEnd)},removeTileMonitoringHooks:function(a){a.events.unregister("loadstart",this,a.onLoadStart);a.events.unregister("loadend",this,a.onLoadEnd)},moveGriddedTiles:function(a){for(var b=this.buffer||1;;){var c=this.map.getViewPortPxFromLayerPx(this.grid[0][0].position);if(c.x>-this.tileSize.w*(b-1))this.shiftColumn(true);else if(c.x<-this.tileSize.w*b)this.shiftColumn(false);else if(c.y>-this.tileSize.h*(b-1))this.shiftRow(true);
else if(c.y<-this.tileSize.h*b)this.shiftRow(false);else break}if(this.buffer==0){b=0;for(c=this.grid.length;b<c;b++)for(var d=this.grid[b],e=0,f=d.length;e<f;e++){var g=d[e];!g.drawn&&g.bounds.intersectsBounds(a,false)&&g.draw()}}},shiftRow:function(a){var b=this.grid[a?0:this.grid.length-1],c=this.map.getResolution(),d=a?-this.tileSize.h:this.tileSize.h;c=c*-d;for(var e=a?this.grid.pop():this.grid.shift(),f=0;f<b.length;f++){var g=b[f],h=g.bounds.clone();g=g.position.clone();h.bottom+=c;h.top+=
c;g.y+=d;e[f].moveTo(h,g)}a?this.grid.unshift(e):this.grid.push(e)},shiftColumn:function(a){for(var b=a?-this.tileSize.w:this.tileSize.w,c=this.map.getResolution()*b,d=0;d<this.grid.length;d++){var e=this.grid[d],f=e[a?0:e.length-1];e=f.bounds.clone();f=f.position.clone();e.left+=c;e.right+=c;f.x+=b;var g=a?this.grid[d].pop():this.grid[d].shift();g.moveTo(e,f);a?this.grid[d].unshift(g):this.grid[d].push(g)}},removeExcessTiles:function(a,b){for(;this.grid.length>a;)for(var c=this.grid.pop(),d=0,e=
c.length;d<e;d++){var f=c[d];this.removeTileMonitoringHooks(f);f.destroy()}for(;this.grid[0].length>b;){d=0;for(e=this.grid.length;d<e;d++){c=this.grid[d];f=c.pop();this.removeTileMonitoringHooks(f);f.destroy()}}},onMapResize:function(){if(this.singleTile){this.clearGrid();this.setTileSize();this.initSingleTile(this.map.getExtent())}},getTileBounds:function(a){var b=this.map.getMaxExtent(),c=this.getResolution(),d=c*this.tileSize.w;c=c*this.tileSize.h;var e=this.getLonLatFromViewPortPx(a);a=b.left+
d*Math.floor((e.lon-b.left)/d);b=b.bottom+c*Math.floor((e.lat-b.bottom)/c);return new OpenLayers.Bounds(a,b,a+d,b+c)},CLASS_NAME:"OpenLayers.Layer.Grid"});
OpenLayers.Layer.Markers=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:false,markers:null,drawn:false,initialize:function(){OpenLayers.Layer.prototype.initialize.apply(this,arguments);this.markers=[]},destroy:function(){this.clearMarkers();this.markers=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},moveTo:function(a,b){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);if(b||!this.drawn){for(i=0;i<this.markers.length;i++)this.drawMarker(this.markers[i]);this.drawn=true}},addMarker:function(a){this.markers.push(a);
if(this.map&&this.map.getExtent()){a.map=this.map;this.drawMarker(a)}},removeMarker:function(a){OpenLayers.Util.removeItem(this.markers,a);if(a.icon!=null&&a.icon.imageDiv!=null&&a.icon.imageDiv.parentNode==this.div){a.icon.imageDiv.parentNode.removeChild(a.icon.imageDiv);a.drawn=false}},clearMarkers:function(){if(this.markers!=null)for(;this.markers.length>0;)this.removeMarker(this.markers[0])},drawMarker:function(a){var b=this.map.getLayerPxFromLonLat(a.lonlat);if(b==null)a.display(false);else{b=
a.draw(b);if(!a.drawn){this.div.appendChild(b);a.drawn=true}}},getDataExtent:function(){var a=null;if(this.markers&&this.markers.length>0){a=new OpenLayers.Bounds;for(var b=0;b<this.markers.length;b++)a.extend(this.markers[b].lonlat)}return a},CLASS_NAME:"OpenLayers.Layer.Markers"});
OpenLayers.Layer.Text=OpenLayers.Class(OpenLayers.Layer.Markers,{location:null,features:null,selectedFeature:null,initialize:function(){OpenLayers.Layer.Markers.prototype.initialize.apply(this,arguments);this.features=[];if(this.location!=null){this.events.triggerEvent("loadstart");OpenLayers.loadURL(this.location,null,this,this.parseData,function(){this.events.triggerEvent("loadend")})}},destroy:function(){this.clearFeatures();this.features=null;OpenLayers.Layer.Markers.prototype.destroy.apply(this,
arguments)},parseData:function(a){a=a.responseText.split("\n");for(var b,c=0;c<a.length-1;c++){var d=a[c].replace(/^\s*/,"").replace(/\s*$/,"");if(d.charAt(0)!="#")if(b){var e=d.split("\t");d=new OpenLayers.LonLat(0,0);for(var f,g,h,j,k,m=false,l=0;l<e.length;l++)if(e[l])if(b[l]=="point"){m=e[l].split(",");d.lat=parseFloat(m[0]);d.lon=parseFloat(m[1]);m=true}else if(b[l]=="lat"){d.lat=parseFloat(e[l]);m=true}else if(b[l]=="lon"){d.lon=parseFloat(e[l]);m=true}else if(b[l]=="title")f=e[l];else if(b[l]==
"image"||b[l]=="icon")g=e[l];else if(b[l]=="iconSize"){h=e[l].split(",");h=new OpenLayers.Size(parseFloat(h[0]),parseFloat(h[1]))}else if(b[l]=="iconOffset"){j=e[l].split(",");j=new OpenLayers.Pixel(parseFloat(j[0]),parseFloat(j[1]))}else if(b[l]=="title")f=e[l];else if(b[l]=="description")description=e[l];else if(b[l]=="overflow")k=e[l];if(m){e={};if(g!=null)e.icon=new OpenLayers.Icon(g,h,j);else{e.icon=OpenLayers.Marker.defaultIcon();h!=null&&e.icon.setSize(h)}if(f!=null&&description!=null)e.popupContentHTML=
"<h2>"+f+"</h2><p>"+description+"</p>";e.overflow=k||"auto";d=new OpenLayers.Feature(this,d,e);this.features.push(d);e=d.createMarker();f!=null&&description!=null&&e.events.register("click",d,this.markerClick);this.addMarker(e)}}else b=d.split("\t")}this.events.triggerEvent("loadend")},markerClick:function(a){var b=this==this.layer.selectedFeature;this.layer.selectedFeature=!b?this:null;for(var c=0;c<this.layer.map.popups.length;c++)this.layer.map.removePopup(this.layer.map.popups[c]);b||this.layer.map.addPopup(this.createPopup());
OpenLayers.Event.stop(a)},clearFeatures:function(){if(this.features!=null)for(;this.features.length>0;){var a=this.features[0];OpenLayers.Util.removeItem(this.features,a);a.destroy()}},CLASS_NAME:"OpenLayers.Layer.Text"});
OpenLayers.Layer.WMS=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{service:"WMS",version:"1.1.1",request:"GetMap",styles:"",exceptions:"application/vnd.ogc.se_inimage",format:"image/jpeg"},reproject:false,isBaseLayer:true,encodeBBOX:false,initialize:function(a,b,c,d){var e=[];c=OpenLayers.Util.upperCaseObject(c);e.push(a,b,c,d);OpenLayers.Layer.Grid.prototype.initialize.apply(this,e);OpenLayers.Util.applyDefaults(this.params,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS));if(this.params.TRANSPARENT&&
this.params.TRANSPARENT.toString().toLowerCase()=="true"){if(d==null||!d.isBaseLayer)this.isBaseLayer=false;if(this.params.FORMAT=="image/jpeg")this.params.FORMAT=OpenLayers.Util.alphaHack()?"image/gif":"image/png"}},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments)},clone:function(a){if(a==null)a=new OpenLayers.Layer.WMS(this.name,this.url,this.params,this.options);return a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a])},getURL:function(a){a=this.adjustBounds(a);
var b=this.getImageSize();return this.getFullRequestString({BBOX:this.encodeBBOX?a.toBBOX():a.toArray(),WIDTH:b.w,HEIGHT:b.h})},addTile:function(a,b){return new OpenLayers.Tile.Image(this,b,a,null,this.tileSize)},mergeNewParams:function(a){a=[OpenLayers.Util.upperCaseObject(a)];OpenLayers.Layer.Grid.prototype.mergeNewParams.apply(this,a)},getFullRequestString:function(){var a=this.map.getProjection();this.params.SRS=a=="none"?null:a;return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,
arguments)},CLASS_NAME:"OpenLayers.Layer.WMS"});
OpenLayers.Layer.WMS.Untiled=OpenLayers.Class(OpenLayers.Layer.WMS,{singleTile:true,initialize:function(){OpenLayers.Layer.WMS.prototype.initialize.apply(this,arguments);OpenLayers.Console.warn("The OpenLayers.Layer.WMS.Untiled class is deprecated and will be removed in 3.0. Instead, you should use the normal OpenLayers.Layer.WMS class, passing it the option 'singleTile' as true.")},clone:function(a){if(a==null)a=new OpenLayers.Layer.WMS.Untiled(this.name,this.url,this.params,this.options);return a=
OpenLayers.Layer.WMS.prototype.clone.apply(this,[a])},CLASS_NAME:"OpenLayers.Layer.WMS.Untiled"});
OpenLayers.Layer.Boxes=OpenLayers.Class(OpenLayers.Layer.Markers,{initialize:function(){OpenLayers.Layer.Markers.prototype.initialize.apply(this,arguments)},drawMarker:function(a){var b=a.bounds,c=this.map.getLayerPxFromLonLat(new OpenLayers.LonLat(b.left,b.top));b=this.map.getLayerPxFromLonLat(new OpenLayers.LonLat(b.right,b.bottom));if(b==null||c==null)a.display(false);else{b=new OpenLayers.Size(Math.max(1,b.x-c.x),Math.max(1,b.y-c.y));c=a.draw(c,b);if(!a.drawn){this.div.appendChild(c);a.drawn=
true}}},removeMarker:function(a){OpenLayers.Util.removeItem(this.markers,a);a.div!=null&&a.div.parentNode==this.div&&this.div.removeChild(a.div)},CLASS_NAME:"OpenLayers.Layer.Boxes"});
OpenLayers.Layer.TileCache=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:true,tileOrigin:null,format:"image/png",initialize:function(a,b,c,d){d=OpenLayers.Util.extend({maxResolution:0.703125},d);this.layername=c;OpenLayers.Layer.Grid.prototype.initialize.apply(this,[a,b,{},d]);this.extension=this.format.split("/")[1].toLowerCase();this.extension=this.extension=="jpeg"?"jpg":this.extension},clone:function(a){if(a==null)a=new OpenLayers.Layer.TileCache(this.name,this.url,this.options);return a=
OpenLayers.Layer.Grid.prototype.clone.apply(this,[a])},getURL:function(a){function b(g,h){g=String(g);for(var j=[],k=0;k<h;++k)j.push("0");return j.join("").substring(0,h-g.length)+g}var c=this.map.getResolution(),d=this.maxExtent,e=this.tileSize,f=Math.floor((a.left-d.left)/(c*e.w));a=Math.floor((a.bottom-d.bottom)/(c*e.h));f=[this.layername,b(this.map.zoom,2),b(parseInt(f/1E6),3),b(parseInt(f/1E3)%1E3,3),b(parseInt(f)%1E3,3),b(parseInt(a/1E6),3),b(parseInt(a/1E3)%1E3,3),b(parseInt(a)%1E3,3)+"."+
this.extension].join("/");a=this.url;if(a instanceof Array)a=this.selectUrl(f,a);a=a.charAt(a.length-1)=="/"?a:a+"/";return a+f},addTile:function(a,b){var c=this.getURL(a);return new OpenLayers.Tile.Image(this,b,a,c,this.tileSize)},setMap:function(){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments);if(!this.tileOrigin)this.tileOrigin=new OpenLayers.LonLat(this.map.maxExtent.left,this.map.maxExtent.bottom)},CLASS_NAME:"OpenLayers.Layer.TileCache"});
OpenLayers.Popup.Anchored=OpenLayers.Class(OpenLayers.Popup,{relativePosition:null,anchor:null,initialize:function(a,b,c,d,e,f){OpenLayers.Popup.prototype.initialize.apply(this,new Array(a,b,c,d,f));this.anchor=e!=null?e:{size:new OpenLayers.Size(0,0),offset:new OpenLayers.Pixel(0,0)}},draw:function(a){if(a==null)if(this.lonlat!=null&&this.map!=null)a=this.map.getLayerPxFromLonLat(this.lonlat);this.relativePosition=this.calculateRelativePosition(a);return OpenLayers.Popup.prototype.draw.apply(this,
arguments)},calculateRelativePosition:function(a){a=this.map.getLonLatFromLayerPx(a);a=this.map.getExtent().determineQuadrant(a);return OpenLayers.Bounds.oppositeQuadrant(a)},moveTo:function(a){this.relativePosition=this.calculateRelativePosition(a);a=this.calculateNewPx(a);OpenLayers.Popup.prototype.moveTo.apply(this,new Array(a))},setSize:function(){OpenLayers.Popup.prototype.setSize.apply(this,arguments);this.lonlat&&this.map&&this.moveTo(this.map.getLayerPxFromLonLat(this.lonlat))},calculateNewPx:function(a){a=
a.offset(this.anchor.offset);var b=this.relativePosition.charAt(0)=="t";a.y+=b?-this.size.h:this.anchor.size.h;b=this.relativePosition.charAt(1)=="l";a.x+=b?-this.size.w:this.anchor.size.w;return a},CLASS_NAME:"OpenLayers.Popup.Anchored"});
OpenLayers.Popup.AnchoredBubble=OpenLayers.Class(OpenLayers.Popup.Anchored,{rounded:false,initialize:function(){OpenLayers.Popup.Anchored.prototype.initialize.apply(this,arguments)},draw:function(){OpenLayers.Popup.Anchored.prototype.draw.apply(this,arguments);this.setContentHTML();this.setBackgroundColor();this.setOpacity();return this.div},moveTo:function(){OpenLayers.Popup.Anchored.prototype.moveTo.apply(this,arguments);this.setRicoCorners(!this.rounded);this.rounded=true},setSize:function(){OpenLayers.Popup.Anchored.prototype.setSize.apply(this,
arguments);if(this.contentDiv!=null){var a=this.size.clone();a.h-=2*OpenLayers.Popup.AnchoredBubble.CORNER_SIZE;a.h-=2*this.padding;this.contentDiv.style.height=a.h+"px";this.contentDiv.style.width=a.w+"px";if(this.map){this.setRicoCorners(!this.rounded);this.rounded=true}}},setBackgroundColor:function(a){if(a!=undefined)this.backgroundColor=a;if(this.div!=null)if(this.contentDiv!=null){this.div.style.background="transparent";OpenLayers.Rico.Corner.changeColor(this.contentDiv,this.backgroundColor)}},
setOpacity:function(a){if(a!=undefined)this.opacity=a;this.div!=null&&this.contentDiv!=null&&OpenLayers.Rico.Corner.changeOpacity(this.contentDiv,this.opacity)},setBorder:function(){this.border=0},setRicoCorners:function(a){var b={corners:this.getCornersToRound(this.relativePosition),color:this.backgroundColor,bgColor:"transparent",blend:false};if(a)OpenLayers.Rico.Corner.round(this.div,b);else{OpenLayers.Rico.Corner.reRound(this.groupDiv,b);this.setBackgroundColor();this.setOpacity()}},getCornersToRound:function(){var a=
["tl","tr","bl","br"],b=OpenLayers.Bounds.oppositeQuadrant(this.relativePosition);OpenLayers.Util.removeItem(a,b);return a.join(" ")},CLASS_NAME:"OpenLayers.Popup.AnchoredBubble"});OpenLayers.Popup.AnchoredBubble.CORNER_SIZE=5;
OpenLayers.Feature=OpenLayers.Class({layer:null,id:null,lonlat:null,data:null,marker:null,popupClass:OpenLayers.Popup.AnchoredBubble,popup:null,initialize:function(a,b,c){this.layer=a;this.lonlat=b;this.data=c!=null?c:{};this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){this.layer!=null&&this.layer.map!=null&&this.popup!=null&&this.layer.map.removePopup(this.popup);this.data=this.lonlat=this.id=this.layer=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 a=false;if(this.layer!=null&&this.layer.map!=null)a=this.layer.map.getExtent().containsLonLat(this.lonlat);return a},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(a){if(this.lonlat!=null){this.popup=new this.popupClass(this.id+"_popup",this.lonlat,this.data.popupSize,
this.data.popupContentHTML,this.marker?this.marker.icon:null,a);if(this.data.overflow!=null)this.popup.contentDiv.style.overflow=this.data.overflow;this.popup.feature=this}return this.popup},destroyPopup:function(){this.popup.feature=null;this.popup.destroy()},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,state:null,style:null,initialize:function(a,b,c){OpenLayers.Feature.prototype.initialize.apply(this,[null,null,b]);this.lonlat=null;this.geometry=a;this.state=null;this.attributes={};if(b)this.attributes=OpenLayers.Util.extend(this.attributes,b);this.style=c?c:null},destroy:function(){if(this.layer){this.layer.removeFeatures(this);this.layer=null}this.geometry=null;OpenLayers.Feature.prototype.destroy.apply(this,
arguments)},clone:function(){return new OpenLayers.Feature.Vector(this.geometry.clone(),this.attributes,this.style)},onScreen:function(){return null},createMarker:function(){return null},destroyMarker:function(){},createPopup:function(){return null},atPoint:function(a,b,c){var d=false;if(this.geometry)d=this.geometry.atPoint(a,b,c);return d},destroyPopup:function(){},toState:function(a){if(a==OpenLayers.State.UPDATE)switch(this.state){case OpenLayers.State.UNKNOWN:case OpenLayers.State.DELETE:this.state=
a;break;case OpenLayers.State.UPDATE:case OpenLayers.State.INSERT:break}else if(a==OpenLayers.State.INSERT)switch(this.state){case OpenLayers.State.UNKNOWN:break;default:this.state=a;break}else if(a==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=a;break}else if(a==OpenLayers.State.UNKNOWN)this.state=a},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",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted"},select:{fillColor:"blue",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"blue",strokeOpacity:1,strokeWidth:2,strokeLinecap:"round",
hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"pointer"},temporary:{fillColor:"yellow",fillOpacity:0.2,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"yellow",strokeOpacity:1,strokeLinecap:"round",strokeWidth:4,hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted"}};
OpenLayers.Feature.WFS=OpenLayers.Class(OpenLayers.Feature,{initialize:function(a,b){var c=arguments;c=this.processXMLNode(b);c=new Array(a,c.lonlat,c);OpenLayers.Feature.prototype.initialize.apply(this,c);this.createMarker();this.layer.addMarker(this.marker)},destroy:function(){this.marker!=null&&this.layer.removeMarker(this.marker);OpenLayers.Feature.prototype.destroy.apply(this,arguments)},processXMLNode:function(a){a=OpenLayers.Ajax.getElementsByTagNameNS(a,"http://www.opengis.net/gml","gml",
"Point");a=OpenLayers.Util.getXmlNodeValue(OpenLayers.Ajax.getElementsByTagNameNS(a[0],"http://www.opengis.net/gml","gml","coordinates")[0]).split(",");return{lonlat:new OpenLayers.LonLat(parseFloat(a[0]),parseFloat(a[1])),id:null}},CLASS_NAME:"OpenLayers.Feature.WFS"});
OpenLayers.Handler=OpenLayers.Class({id:null,control:null,map:null,keyMask:null,active:false,evt:null,initialize:function(a,b,c){OpenLayers.Util.extend(this,c);this.control=a;this.callbacks=b;a.map&&this.setMap(a.map);OpenLayers.Util.extend(this,c);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},setMap:function(a){this.map=a},checkModifiers:function(a){if(this.keyMask==null)return true;return((a.shiftKey?OpenLayers.Handler.MOD_SHIFT:0)|(a.ctrlKey?OpenLayers.Handler.MOD_CTRL:0)|(a.altKey?
OpenLayers.Handler.MOD_ALT:0))==this.keyMask},activate:function(){if(this.active)return false;for(var a=OpenLayers.Events.prototype.BROWSER_EVENTS,b=0;b<a.length;b++)this[a[b]]&&this.register(a[b],this[a[b]]);return this.active=true},deactivate:function(){if(!this.active)return false;for(var a=OpenLayers.Events.prototype.BROWSER_EVENTS,b=0;b<a.length;b++)this[a[b]]&&this.unregister(a[b],this[a[b]]);this.active=false;return true},callback:function(a,b){this.callbacks[a]&&this.callbacks[a].apply(this.control,
b)},register:function(a,b){this.map.events.registerPriority(a,this,b);this.map.events.registerPriority(a,this,this.setEvent)},unregister:function(a,b){this.map.events.unregister(a,this,b);this.map.events.unregister(a,this,this.setEvent)},setEvent:function(a){this.evt=a;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.Handler.Point=OpenLayers.Class(OpenLayers.Handler,{point:null,layer:null,drawing:false,mouseDown:false,lastDown:null,lastUp:null,initialize:function(){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;this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,{displayInLayerSwitcher:false});this.map.addLayer(this.layer);
return true},createFeature:function(){this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point)},deactivate:function(){if(!OpenLayers.Handler.prototype.deactivate.apply(this,arguments))return false;this.drawing&&this.cancel();this.map.removeLayer(this.layer,false);this.layer.destroy();this.layer=null;return true},destroyFeature:function(){this.point.destroy();this.point=null},finalize:function(){this.layer.renderer.clear();this.callback("done",[this.geometryClone()]);this.destroyFeature();
this.mouseDown=this.drawing=false;this.lastUp=this.lastDown=null},cancel:function(){this.layer.renderer.clear();this.callback("cancel",[this.geometryClone()]);this.destroyFeature();this.mouseDown=this.drawing=false;this.lastUp=this.lastDown=null},dblclick:function(a){OpenLayers.Event.stop(a);return false},drawFeature:function(){this.layer.drawFeature(this.point,this.style)},geometryClone:function(){return this.point.geometry.clone()},mousedown:function(a){if(!this.checkModifiers(a))return true;if(this.lastDown&&
this.lastDown.equals(a.xy))return true;this.lastDown==null&&this.createFeature();this.lastDown=a.xy;this.drawing=true;a=this.map.getLonLatFromPixel(a.xy);this.point.geometry.x=a.lon;this.point.geometry.y=a.lat;this.drawFeature();return false},mousemove:function(a){if(this.drawing){a=this.map.getLonLatFromPixel(a.xy);this.point.geometry.x=a.lon;this.point.geometry.y=a.lat;this.point.geometry.clearBounds();this.drawFeature()}return true},mouseup:function(){if(this.drawing){this.finalize();return false}else return true},
CLASS_NAME:"OpenLayers.Handler.Point"});
OpenLayers.Handler.Path=OpenLayers.Class(OpenLayers.Handler.Point,{line:null,freehand:false,freehandToggle:"shiftKey",initialize:function(){OpenLayers.Handler.Point.prototype.initialize.apply(this,arguments)},createFeature:function(){this.line=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString);this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point)},destroyFeature:function(){OpenLayers.Handler.Point.prototype.destroyFeature.apply(this);this.line.destroy();this.line=
null},addPoint:function(){this.line.geometry.addComponent(this.point.geometry.clone(),this.line.geometry.components.length);this.callback("point",[this.point.geometry])},freehandMode:function(a){return this.freehandToggle&&a[this.freehandToggle]?!this.freehand:this.freehand},modifyFeature:function(){var a=this.line.geometry.components.length-1;this.line.geometry.components[a].x=this.point.geometry.x;this.line.geometry.components[a].y=this.point.geometry.y;this.line.geometry.components[a].clearBounds()},
drawFeature:function(){this.layer.drawFeature(this.line,this.style);this.layer.drawFeature(this.point,this.style)},geometryClone:function(){return this.line.geometry.clone()},mousedown:function(a){if(this.lastDown&&this.lastDown.equals(a.xy))return false;this.lastDown==null&&this.createFeature();this.mouseDown=true;this.lastDown=a.xy;var b=this.control.map.getLonLatFromPixel(a.xy);this.point.geometry.x=b.lon;this.point.geometry.y=b.lat;if(this.lastUp==null||!this.lastUp.equals(a.xy))this.addPoint();
this.drawFeature();this.drawing=true;return false},mousemove:function(a){if(this.drawing){var b=this.map.getLonLatFromPixel(a.xy);this.point.geometry.x=b.lon;this.point.geometry.y=b.lat;this.mouseDown&&this.freehandMode(a)?this.addPoint():this.modifyFeature();this.drawFeature()}return true},mouseup:function(a){this.mouseDown=false;if(this.drawing){if(this.freehandMode(a))this.finalize();else{this.lastUp==null&&this.addPoint();this.lastUp=a.xy}return false}return true},dblclick:function(a){if(!this.freehandMode(a)){this.line.geometry.removeComponent(this.line.geometry.components[this.line.geometry.components.length-
1]);this.finalize()}return false},CLASS_NAME:"OpenLayers.Handler.Path"});
OpenLayers.Handler.Polygon=OpenLayers.Class(OpenLayers.Handler.Path,{polygon:null,initialize:function(){OpenLayers.Handler.Path.prototype.initialize.apply(this,arguments)},createFeature:function(){this.polygon=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon);this.line=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LinearRing);this.polygon.geometry.addComponent(this.line.geometry);this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point)},destroyFeature:function(){OpenLayers.Handler.Path.prototype.destroyFeature.apply(this);
this.polygon.destroy();this.polygon=null},modifyFeature:function(){var a=this.line.geometry.components.length-2;this.line.geometry.components[a].x=this.point.geometry.x;this.line.geometry.components[a].y=this.point.geometry.y;this.line.geometry.components[a].clearBounds()},drawFeature:function(){this.layer.drawFeature(this.polygon,this.style);this.layer.drawFeature(this.point,this.style)},geometryClone:function(){return this.polygon.geometry.clone()},dblclick:function(a){if(!this.freehandMode(a)){this.line.geometry.removeComponent(this.line.geometry.components[this.line.geometry.components.length-
2]);this.finalize()}return false},CLASS_NAME:"OpenLayers.Handler.Polygon"});
OpenLayers.Handler.Feature=OpenLayers.Class(OpenLayers.Handler,{geometryTypes:null,layerIndex:null,feature:null,initialize:function(a,b,c,d){OpenLayers.Handler.prototype.initialize.apply(this,[a,c,d]);this.layer=b},click:function(a){return!this.select("click",a)},mousedown:function(a){return!this.select("down",a)},mousemove:function(a){this.select("move",a);return true},mouseup:function(a){return!this.select("up",a)},dblclick:function(a){return!this.select("dblclick",a)},select:function(a,b){b=this.layer.getFeatureFromEvent(b);
var c=false;if(b)if(this.geometryTypes==null||OpenLayers.Util.indexOf(this.geometryTypes,b.geometry.CLASS_NAME)>-1){if(this.feature){if(this.feature!=b){this.callback("out",[this.feature]);this.callback("over",[b])}}else this.callback("over",[b]);this.feature=b;this.callback(a,[b]);c=true}else{if(this.feature&&this.feature!=b){this.callback("out",[this.feature]);this.feature=null}c=false}else{if(this.feature){this.callback("out",[this.feature]);this.feature=null}c=false}return c},activate:function(){if(OpenLayers.Handler.prototype.activate.apply(this,
arguments)){this.layerIndex=this.layer.div.style.zIndex;this.layer.div.style.zIndex=this.map.Z_INDEX_BASE.Popup-1;return true}else return false},deactivate:function(){if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){if(this.layer&&this.layer.div)this.layer.div.style.zIndex=this.layerIndex;return true}else return false},CLASS_NAME:"OpenLayers.Handler.Feature"});
OpenLayers.Handler.Drag=OpenLayers.Class(OpenLayers.Handler,{started:false,dragging:false,last:null,start:null,oldOnselectstart:null,initialize:function(){OpenLayers.Handler.prototype.initialize.apply(this,arguments)},down:function(){},move:function(){},up:function(){},out:function(){},mousedown:function(a){var b=true;this.dragging=false;if(this.checkModifiers(a)&&OpenLayers.Event.isLeftClick(a)){this.started=true;this.last=this.start=a.xy;this.map.div.style.cursor="move";this.down(a);this.callback("down",
[a.xy]);OpenLayers.Event.stop(a);if(!this.oldOnselectstart){this.oldOnselectstart=document.onselectstart;document.onselectstart=function(){return false}}b=false}else{this.started=false;this.last=this.start=null}return b},mousemove:function(a){if(this.started)if(a.xy.x!=this.last.x||a.xy.y!=this.last.y){this.dragging=true;this.move(a);this.callback("move",[a.xy]);if(!this.oldOnselectstart){this.oldOnselectstart=document.onselectstart;document.onselectstart=function(){return false}}this.last=a.xy}return true},
mouseup:function(a){if(this.started){this.dragging=this.started=false;this.map.div.style.cursor="";this.up(a);this.callback("up",[a.xy]);this.callback("done",[a.xy]);document.onselectstart=this.oldOnselectstart}return true},mouseout:function(a){if(this.started&&OpenLayers.Util.mouseLeft(a,this.map.div)){this.dragging=this.started=false;this.map.div.style.cursor="";this.out(a);this.callback("out",[]);if(document.onselectstart)document.onselectstart=this.oldOnselectstart;this.callback("done",[a.xy])}return true},
click:function(){return this.start==this.last},activate:function(){var a=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragging=false;a=true}return a},deactivate:function(){var a=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.dragging=this.started=false;this.last=this.start=null;a=true}return a},CLASS_NAME:"OpenLayers.Handler.Drag"});
OpenLayers.Handler.RegularPolygon=OpenLayers.Class(OpenLayers.Handler.Drag,{sides:4,radius:null,snapAngle:null,snapToggle:"shiftKey",persist:false,angle:null,fixedRadius:false,feature:null,layer:null,origin:null,initialize:function(a,b,c){this.style=OpenLayers.Util.extend(OpenLayers.Feature.Vector.style["default"],{});OpenLayers.Handler.prototype.initialize.apply(this,[a,b,c]);this.options=c?c:{}},setOptions:function(a){OpenLayers.Util.extend(this.options,a);OpenLayers.Util.extend(this,a)},activate:function(){var a=
false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,{displayInLayerSwitcher:false});this.map.addLayer(this.layer);a=true}return a},deactivate:function(){var a=false;if(OpenLayers.Handler.Drag.prototype.deactivate.apply(this,arguments)){this.dragging&&this.cancel();this.map.removeLayer(this.layer,false);this.layer.destroy();this.feature&&this.feature.destroy();a=true}return a},down:function(a){this.fixedRadius=!!this.radius;a=
this.map.getLonLatFromPixel(a.xy);this.origin=new OpenLayers.Geometry.Point(a.lon,a.lat);if(!this.fixedRadius)this.radius=this.map.getResolution();this.persist&&this.clear();this.feature=new OpenLayers.Feature.Vector;this.createGeometry();this.layer.addFeatures([this.feature]);this.layer.drawFeature(this.feature,this.style)},move:function(a){var b=this.map.getLonLatFromPixel(a.xy);b=new OpenLayers.Geometry.Point(b.lon,b.lat);if(this.fixedRadius)this.origin=b;else{this.calculateAngle(b,a);this.radius=
Math.max(this.map.getResolution()/2,b.distanceTo(this.origin))}this.modifyGeometry();this.layer.drawFeature(this.feature,this.style)},up:function(){this.finalize()},out:function(){this.finalize()},createGeometry:function(){this.angle=Math.PI*(1/this.sides-0.5);if(this.snapAngle)this.angle+=this.snapAngle*(Math.PI/180);this.feature.geometry=OpenLayers.Geometry.Polygon.createRegularPolygon(this.origin,this.radius,this.sides,this.snapAngle)},modifyGeometry:function(){var a,b,c=this.feature.geometry.components[0];
c.components.length!=this.sides+1&&this.createGeometry();for(var d=0;d<this.sides;++d){b=c.components[d];a=this.angle+d*2*Math.PI/this.sides;b.x=this.origin.x+this.radius*Math.cos(a);b.y=this.origin.y+this.radius*Math.sin(a);b.clearBounds()}},calculateAngle:function(a,b){a=Math.atan2(a.y-this.origin.y,a.x-this.origin.x);if(this.snapAngle&&this.snapToggle&&!b[this.snapToggle]){b=Math.PI/180*this.snapAngle;this.angle=Math.round(a/b)*b}else this.angle=a},cancel:function(){this.callback("cancel",null);
this.finalize()},finalize:function(){this.origin=null;this.radius=this.options.radius},clear:function(){this.layer.renderer.clear();this.layer.destroyFeatures()},callback:function(a){this.callbacks[a]&&this.callbacks[a].apply(this.control,[this.feature.geometry.clone()]);if(!this.persist&&(a=="done"||a=="cancel"))this.clear()},CLASS_NAME:"OpenLayers.Handler.RegularPolygon"});
OpenLayers.Handler.Box=OpenLayers.Class(OpenLayers.Handler,{dragHandler:null,initialize:function(a,b){OpenLayers.Handler.prototype.initialize.apply(this,arguments);b={down:this.startBox,move:this.moveBox,out:this.removeBox,up:this.endBox};this.dragHandler=new OpenLayers.Handler.Drag(this,b,{keyMask:this.keyMask})},setMap:function(a){OpenLayers.Handler.prototype.setMap.apply(this,arguments);this.dragHandler&&this.dragHandler.setMap(a)},startBox:function(){this.zoomBox=OpenLayers.Util.createDiv("zoomBox",
this.dragHandler.start,null,null,"absolute","2px solid red");this.zoomBox.style.backgroundColor="white";this.zoomBox.style.filter="alpha(opacity=50)";this.zoomBox.style.opacity="0.50";this.zoomBox.style.fontSize="1px";this.zoomBox.style.zIndex=this.map.Z_INDEX_BASE.Popup-1;this.map.viewPortDiv.appendChild(this.zoomBox);this.map.div.style.cursor="crosshair"},moveBox:function(a){var b=Math.abs(this.dragHandler.start.x-a.x),c=Math.abs(this.dragHandler.start.y-a.y);this.zoomBox.style.width=Math.max(1,
b)+"px";this.zoomBox.style.height=Math.max(1,c)+"px";if(a.x<this.dragHandler.start.x)this.zoomBox.style.left=a.x+"px";if(a.y<this.dragHandler.start.y)this.zoomBox.style.top=a.y+"px"},endBox:function(a){var b;if(Math.abs(this.dragHandler.start.x-a.x)>5||Math.abs(this.dragHandler.start.y-a.y)>5){var c=this.dragHandler.start;b=Math.min(c.y,a.y);var d=Math.max(c.y,a.y),e=Math.min(c.x,a.x);a=Math.max(c.x,a.x);b=new OpenLayers.Bounds(e,d,a,b)}else b=this.dragHandler.start.clone();this.removeBox();this.map.div.style.cursor=
"";this.callback("done",[b])},removeBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox);this.zoomBox=null},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)){this.dragHandler.deactivate();return true}else return false},CLASS_NAME:"OpenLayers.Handler.Box"});
OpenLayers.Handler.MouseWheel=OpenLayers.Class(OpenLayers.Handler,{wheelListener:null,mousePosition:null,initialize:function(){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(a){if(this.checkModifiers(a)){for(var b=false,c=OpenLayers.Event.element(a);c!=null;){if(this.map&&c==this.map.div){b=
true;break}c=c.parentNode}if(b){b=0;if(!a)a=window.event;if(a.wheelDelta){b=a.wheelDelta/120;if(window.opera)b=-b}else if(a.detail)b=-a.detail/3;if(b){if(this.mousePosition)a.xy=this.mousePosition;if(!a.xy)a.xy=this.map.getPixelFromLonLat(this.map.getCenter());b<0?this.callback("down",[a,b]):this.callback("up",[a,b])}OpenLayers.Event.stop(a)}}},mousemove:function(a){this.mousePosition=a.xy},activate:function(){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){var a=this.wheelListener;
OpenLayers.Event.observe(window,"DOMMouseScroll",a);OpenLayers.Event.observe(window,"mousewheel",a);OpenLayers.Event.observe(document,"mousewheel",a);return true}else return false},deactivate:function(){if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){var a=this.wheelListener;OpenLayers.Event.stopObserving(window,"DOMMouseScroll",a);OpenLayers.Event.stopObserving(window,"mousewheel",a);OpenLayers.Event.stopObserving(document,"mousewheel",a);return true}else return false},CLASS_NAME:"OpenLayers.Handler.MouseWheel"});
OpenLayers.Handler.Keyboard=OpenLayers.Class(OpenLayers.Handler,{KEY_EVENTS:["keydown","keypress","keyup"],eventListener:null,initialize:function(){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 a=
0;a<this.KEY_EVENTS.length;a++)OpenLayers.Event.observe(document,this.KEY_EVENTS[a],this.eventListener);return true}else return false},deactivate:function(){var a=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){for(a=0;a<this.KEY_EVENTS.length;a++)OpenLayers.Event.stopObserving(document,this.KEY_EVENTS[a],this.eventListener);a=true}return a},handleKeyEvent:function(a){if(this.checkModifiers(a))this.callback(a.type,[a.charCode||a.keyCode,a])},CLASS_NAME:"OpenLayers.Handler.Keyboard"});
OpenLayers.Control=OpenLayers.Class({id:null,map:null,div:null,type:null,displayClass:"",active:null,handler:null,initialize:function(a){this.displayClass=this.CLASS_NAME.replace("OpenLayers.","ol").replace(/\./g,"");OpenLayers.Util.extend(this,a);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){this.handler&&this.handler.destroy();this.map=null},setMap:function(a){this.map=a;this.handler&&this.handler.setMap(a)},draw:function(a){if(this.div==null){this.div=OpenLayers.Util.createDiv();
this.div.id=this.id;this.div.className=this.displayClass}if(a!=null)this.position=a.clone();this.moveTo(this.position);return this.div},moveTo:function(a){if(a!=null&&this.div!=null){this.div.style.left=a.x+"px";this.div.style.top=a.y+"px"}},activate:function(){if(this.active)return false;this.handler&&this.handler.activate();return this.active=true},deactivate:function(){if(this.active){this.handler&&this.handler.deactivate();this.active=false;return true}return false},CLASS_NAME:"OpenLayers.Control"});
OpenLayers.Control.TYPE_BUTTON=1;OpenLayers.Control.TYPE_TOGGLE=2;OpenLayers.Control.TYPE_TOOL=3;
OpenLayers.Control.Attribution=OpenLayers.Class(OpenLayers.Control,{separator:", ",initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.map.events.unregister("removelayer",this,this.updateAttribution);this.map.events.unregister("addlayer",this,this.updateAttribution);this.map.events.unregister("changelayer",this,this.updateAttribution);this.map.events.unregister("changebaselayer",this,this.updateAttribution);OpenLayers.Control.prototype.destroy.apply(this,
arguments)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.map.events.register("changebaselayer",this,this.updateAttribution);this.map.events.register("changelayer",this,this.updateAttribution);this.map.events.register("addlayer",this,this.updateAttribution);this.map.events.register("removelayer",this,this.updateAttribution);this.updateAttribution();return this.div},updateAttribution:function(){var a=[];if(this.map&&this.map.layers){for(var b=0;b<this.map.layers.length;b++){var c=
this.map.layers[b];c.attribution&&c.getVisibility()&&a.push(c.attribution)}this.div.innerHTML=a.join(this.separator)}},CLASS_NAME:"OpenLayers.Control.Attribution"});
OpenLayers.Control.ZoomBox=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,draw:function(){this.handler=new OpenLayers.Handler.Box(this,{done:this.zoomBox},{keyMask:this.keyMask})},zoomBox:function(a){if(a instanceof OpenLayers.Bounds){var b=this.map.getLonLatFromPixel(new OpenLayers.Pixel(a.left,a.bottom));a=this.map.getLonLatFromPixel(new OpenLayers.Pixel(a.right,a.top));this.map.zoomToExtent(new OpenLayers.Bounds(b.lon,b.lat,a.lon,a.lat))}else this.map.setCenter(this.map.getLonLatFromPixel(a),
this.map.getZoom()+1)},CLASS_NAME:"OpenLayers.Control.ZoomBox"});OpenLayers.Control.ZoomToMaxExtent=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){this.map&&this.map.zoomToMaxExtent()},CLASS_NAME:"OpenLayers.Control.ZoomToMaxExtent"});
OpenLayers.Control.DragPan=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,panned:false,draw:function(){this.handler=new OpenLayers.Handler.Drag(this,{move:this.panMap,done:this.panMapDone})},panMap:function(a){this.panned=true;var b=this.handler.last.x-a.x;a=this.handler.last.y-a.y;var c=this.map.getSize();this.map.setCenter(this.map.getLonLatFromViewPortPx(new OpenLayers.Pixel(c.w/2+b,c.h/2+a)),null,this.handler.dragging)},panMapDone:function(a){if(this.panned){this.panMap(a);
this.panned=false}},CLASS_NAME:"OpenLayers.Control.DragPan"});
OpenLayers.Control.Navigation=OpenLayers.Class(OpenLayers.Control,{dragPan:null,zoomBox:null,wheelHandler:null,initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments)},activate:function(){this.dragPan.activate();this.wheelHandler.activate();this.zoomBox.activate();return OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){this.zoomBox.deactivate();this.dragPan.deactivate();this.wheelHandler.deactivate();return OpenLayers.Control.prototype.deactivate.apply(this,
arguments)},draw:function(){this.map.events.register("dblclick",this,this.defaultDblClick);this.dragPan=new OpenLayers.Control.DragPan({map:this.map});this.zoomBox=new OpenLayers.Control.ZoomBox({map:this.map,keyMask:OpenLayers.Handler.MOD_SHIFT});this.dragPan.draw();this.zoomBox.draw();this.wheelHandler=new OpenLayers.Handler.MouseWheel(this,{up:this.wheelUp,down:this.wheelDown});this.activate()},defaultDblClick:function(a){this.map.setCenter(this.map.getLonLatFromViewPortPx(a.xy),this.map.zoom+
1);OpenLayers.Event.stop(a);return false},wheelChange:function(a,b){b=this.map.getZoom()+b;if(this.map.isValidZoomLevel(b)){var c=this.map.getSize(),d=c.w/2-a.xy.x;c=a.xy.y-c.h/2;var e=this.map.baseLayer.resolutions[b];a=this.map.getLonLatFromPixel(a.xy);this.map.setCenter(new OpenLayers.LonLat(a.lon+d*e,a.lat+c*e),b)}},wheelUp:function(a){this.wheelChange(a,1)},wheelDown:function(a){this.wheelChange(a,-1)},CLASS_NAME:"OpenLayers.Control.Navigation"});
OpenLayers.Control.MouseDefaults=OpenLayers.Class(OpenLayers.Control,{performedDrag:false,wheelObserver:null,initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.handler&&this.handler.destroy();this.handler=null;this.map.events.unregister("click",this,this.defaultClick);this.map.events.unregister("dblclick",this,this.defaultDblClick);this.map.events.unregister("mousedown",this,this.defaultMouseDown);this.map.events.unregister("mouseup",this,
this.defaultMouseUp);this.map.events.unregister("mousemove",this,this.defaultMouseMove);this.map.events.unregister("mouseout",this,this.defaultMouseOut);OpenLayers.Event.stopObserving(window,"DOMMouseScroll",this.wheelObserver);OpenLayers.Event.stopObserving(window,"mousewheel",this.wheelObserver);OpenLayers.Event.stopObserving(document,"mousewheel",this.wheelObserver);this.wheelObserver=null;OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(){this.map.events.register("click",
this,this.defaultClick);this.map.events.register("dblclick",this,this.defaultDblClick);this.map.events.register("mousedown",this,this.defaultMouseDown);this.map.events.register("mouseup",this,this.defaultMouseUp);this.map.events.register("mousemove",this,this.defaultMouseMove);this.map.events.register("mouseout",this,this.defaultMouseOut);this.registerWheelEvents()},registerWheelEvents:function(){this.wheelObserver=OpenLayers.Function.bindAsEventListener(this.onWheelEvent,this);OpenLayers.Event.observe(window,
"DOMMouseScroll",this.wheelObserver);OpenLayers.Event.observe(window,"mousewheel",this.wheelObserver);OpenLayers.Event.observe(document,"mousewheel",this.wheelObserver)},defaultClick:function(a){if(OpenLayers.Event.isLeftClick(a)){a=!this.performedDrag;this.performedDrag=false;return a}},defaultDblClick:function(a){this.map.setCenter(this.map.getLonLatFromViewPortPx(a.xy),this.map.zoom+1);OpenLayers.Event.stop(a);return false},defaultMouseDown:function(a){if(OpenLayers.Event.isLeftClick(a)){this.mouseDragStart=
a.xy.clone();this.performedDrag=false;if(a.shiftKey){this.map.div.style.cursor="crosshair";this.zoomBox=OpenLayers.Util.createDiv("zoomBox",this.mouseDragStart,null,null,"absolute","2px solid red");this.zoomBox.style.backgroundColor="white";this.zoomBox.style.filter="alpha(opacity=50)";this.zoomBox.style.opacity="0.50";this.zoomBox.style.fontSize="1px";this.zoomBox.style.zIndex=this.map.Z_INDEX_BASE.Popup-1;this.map.viewPortDiv.appendChild(this.zoomBox)}document.onselectstart=function(){return false};
OpenLayers.Event.stop(a)}},defaultMouseMove:function(a){this.mousePosition=a.xy.clone();if(this.mouseDragStart!=null){if(this.zoomBox){var b=Math.abs(this.mouseDragStart.x-a.xy.x),c=Math.abs(this.mouseDragStart.y-a.xy.y);this.zoomBox.style.width=Math.max(1,b)+"px";this.zoomBox.style.height=Math.max(1,c)+"px";if(a.xy.x<this.mouseDragStart.x)this.zoomBox.style.left=a.xy.x+"px";if(a.xy.y<this.mouseDragStart.y)this.zoomBox.style.top=a.xy.y+"px"}else{b=this.mouseDragStart.x-a.xy.x;c=this.mouseDragStart.y-
a.xy.y;var d=this.map.getSize();this.map.setCenter(this.map.getLonLatFromViewPortPx(new OpenLayers.Pixel(d.w/2+b,d.h/2+c)),null,true);this.mouseDragStart=a.xy.clone();this.map.div.style.cursor="move"}this.performedDrag=true}},defaultMouseUp:function(a){if(OpenLayers.Event.isLeftClick(a)){if(this.zoomBox)this.zoomBoxEnd(a);else this.performedDrag&&this.map.setCenter(this.map.center);this.mouseDragStart=document.onselectstart=null;this.map.div.style.cursor=""}},defaultMouseOut:function(a){if(this.mouseDragStart!=
null&&OpenLayers.Util.mouseLeft(a,this.map.div)){this.zoomBox&&this.removeZoomBox();this.mouseDragStart=null}},defaultWheelUp:function(a){this.map.getZoom()<=this.map.getNumZoomLevels()&&this.map.setCenter(this.map.getLonLatFromPixel(a.xy),this.map.getZoom()+1)},defaultWheelDown:function(a){this.map.getZoom()>0&&this.map.setCenter(this.map.getLonLatFromPixel(a.xy),this.map.getZoom()-1)},zoomBoxEnd:function(a){if(this.mouseDragStart!=null){if(Math.abs(this.mouseDragStart.x-a.xy.x)>5||Math.abs(this.mouseDragStart.y-
a.xy.y)>5){var b=this.map.getLonLatFromViewPortPx(this.mouseDragStart),c=this.map.getLonLatFromViewPortPx(a.xy);a=Math.max(b.lat,c.lat);var d=Math.min(b.lat,c.lat),e=Math.min(b.lon,c.lon);b=Math.max(b.lon,c.lon);this.map.zoomToExtent(new OpenLayers.Bounds(e,d,b,a))}else{c=this.map.getLonLatFromViewPortPx(a.xy);this.map.setCenter(new OpenLayers.LonLat(c.lon,c.lat),this.map.getZoom()+1)}this.removeZoomBox()}},removeZoomBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox);this.zoomBox=null},
onWheelEvent:function(a){for(var b=false,c=OpenLayers.Event.element(a);c!=null;){if(this.map&&c==this.map.div){b=true;break}c=c.parentNode}if(b){b=0;if(!a)a=window.event;if(a.wheelDelta){b=a.wheelDelta/120;if(window.opera)b=-b}else if(a.detail)b=-a.detail/3;if(b){a.xy=this.mousePosition;b<0?this.defaultWheelDown(a):this.defaultWheelUp(a)}OpenLayers.Event.stop(a)}},CLASS_NAME:"OpenLayers.Control.MouseDefaults"});
OpenLayers.Control.MousePosition=OpenLayers.Class(OpenLayers.Control,{element:null,prefix:"",separator:", ",suffix:"",numdigits:5,granularity:10,lastXy:null,initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.map&&this.map.events.unregister("mousemove",this,this.redraw);OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.div.left="";this.div.top=
"";this.div.className=this.displayClass;this.element=this.div}this.redraw();return this.div},redraw:function(a){var b;if(a==null)b=new OpenLayers.LonLat(0,0);else{if(this.lastXy==null||Math.abs(a.xy.x-this.lastXy.x)>this.granularity||Math.abs(a.xy.y-this.lastXy.y)>this.granularity){this.lastXy=a.xy;return}b=this.map.getLonLatFromPixel(a.xy);this.lastXy=a.xy}a=parseInt(this.numdigits);b=this.prefix+b.lon.toFixed(a)+this.separator+b.lat.toFixed(a)+this.suffix;if(b!=this.element.innerHTML)this.element.innerHTML=
b},setMap:function(){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.map.events.register("mousemove",this,this.redraw)},CLASS_NAME:"OpenLayers.Control.MousePosition"});
OpenLayers.Control.KeyboardDefaults=OpenLayers.Class(OpenLayers.Control,{slideFactor:75,keyCodes:[OpenLayers.Event.KEY_LEFT,OpenLayers.Event.KEY_RIGHT,OpenLayers.Event.KEY_UP,OpenLayers.Event.KEY_DOWN,33,34,35,36,43,45,107,109],initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.handler&&this.handler.destroy();this.handler=null;OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(){this.handler=new OpenLayers.Handler.Keyboard(this,
{keypress:this.defaultKeyPress,keydown:this.defaultKeyPress,keyup:this.defaultKeyUp});this.activate()},defaultKeyPress:function(a,b){this.eatPanKeycodes(b)},defaultKeyUp:function(a,b){switch(a){case OpenLayers.Event.KEY_LEFT:this.map.pan(-this.slideFactor,0);break;case OpenLayers.Event.KEY_RIGHT:this.map.pan(this.slideFactor,0);break;case OpenLayers.Event.KEY_UP:this.map.pan(0,-this.slideFactor);break;case OpenLayers.Event.KEY_DOWN:this.map.pan(0,this.slideFactor);break;case 33:var c=this.map.getSize();
this.map.pan(0,-0.75*c.h);break;case 34:c=this.map.getSize();this.map.pan(0,0.75*c.h);break;case 35:c=this.map.getSize();this.map.pan(0.75*c.w,0);break;case 36:c=this.map.getSize();this.map.pan(-0.75*c.w,0);break;case 187:case 107:case 61:case 43:this.map.zoomIn();break;case 45:this.map.zoomOut();break;case 109:this.map.zoomOut();break}this.eatPanKeycodes(a,b)},eatPanKeycodes:function(a,b){for(var c=0;c<this.keyCodes.length;c++)this.keyCodes[c]==a&&b&&OpenLayers.Event.stop(b)},CLASS_NAME:"OpenLayers.Control.KeyboardDefaults"});
OpenLayers.Control.PanZoom=OpenLayers.Class(OpenLayers.Control,{slideFactor:50,buttons:null,position:null,initialize:function(){this.position=new OpenLayers.Pixel(OpenLayers.Control.PanZoom.X,OpenLayers.Control.PanZoom.Y);OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){for(OpenLayers.Control.prototype.destroy.apply(this,arguments);this.buttons.length;){var a=this.buttons.shift();a.map=null;OpenLayers.Event.stopObservingElement(a)}this.position=this.buttons=null},
draw:function(a){OpenLayers.Control.prototype.draw.apply(this,arguments);a=this.position;this.buttons=[];var b=new OpenLayers.Size(18,18),c=new OpenLayers.Pixel(a.x+b.w/2,a.y);this._addButton("panup","north-mini.png",c,b);a.y=c.y+b.h;this._addButton("panleft","west-mini.png",a,b);this._addButton("panright","east-mini.png",a.add(b.w,0),b);this._addButton("pandown","south-mini.png",c.add(0,b.h*2),b);this._addButton("zoomin","zoom-plus-mini.png",c.add(0,b.h*3+5),b);this._addButton("zoomworld","zoom-world-mini.png",
c.add(0,b.h*4+5),b);this._addButton("zoomout","zoom-minus-mini.png",c.add(0,b.h*5+5),b);return this.div},_addButton:function(a,b,c,d){b=OpenLayers.Util.getImagesLocation()+b;c=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_PanZoom_"+a,c,d,b,"absolute");this.div.appendChild(c);OpenLayers.Event.observe(c,"mousedown",OpenLayers.Function.bindAsEventListener(this.buttonDown,c));OpenLayers.Event.observe(c,"dblclick",OpenLayers.Function.bindAsEventListener(this.doubleClick,c));OpenLayers.Event.observe(c,
"click",OpenLayers.Function.bindAsEventListener(this.doubleClick,c));c.action=a;c.map=this.map;c.slideFactor=this.slideFactor;this.buttons.push(c);return c},doubleClick:function(a){OpenLayers.Event.stop(a);return false},buttonDown:function(a){if(OpenLayers.Event.isLeftClick(a)){switch(this.action){case "panup":this.map.pan(0,-50);break;case "pandown":this.map.pan(0,50);break;case "panleft":this.map.pan(-50,0);break;case "panright":this.map.pan(50,0);break;case "zoomin":this.map.zoomIn();break;case "zoomout":this.map.zoomOut();
break;case "zoomworld":this.map.zoomToMaxExtent();break}OpenLayers.Event.stop(a)}},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,divEvents:null,initialize:function(){OpenLayers.Control.PanZoom.prototype.initialize.apply(this,arguments)},destroy:function(){this.div.removeChild(this.slider);this.slider=null;this.sliderEvents.destroy();this.sliderEvents=null;this.div.removeChild(this.zoombarDiv);this.zoomBarDiv=null;this.divEvents.destroy();this.divEvents=null;this.map.events.unregister("zoomend",
this,this.moveZoomBar);this.map.events.unregister("changebaselayer",this,this.redraw);OpenLayers.Control.PanZoom.prototype.destroy.apply(this,arguments)},setMap:function(){OpenLayers.Control.PanZoom.prototype.setMap.apply(this,arguments);this.map.events.register("changebaselayer",this,this.redraw)},redraw:function(){if(this.div!=null)this.div.innerHTML="";this.draw()},draw:function(a){OpenLayers.Control.prototype.draw.apply(this,arguments);a=this.position.clone();this.buttons=[];var b=new OpenLayers.Size(18,
18),c=new OpenLayers.Pixel(a.x+b.w/2,a.y);this._addButton("panup","north-mini.png",c,b);a.y=c.y+b.h;this._addButton("panleft","west-mini.png",a,b);this._addButton("panright","east-mini.png",a.add(b.w,0),b);this._addButton("pandown","south-mini.png",c.add(0,b.h*2),b);this._addButton("zoomin","zoom-plus-mini.png",c.add(0,b.h*3+5),b);c=this._addZoomBar(c.add(0,b.h*4+5));this._addButton("zoomout","zoom-minus-mini.png",c,b);return this.div},_addZoomBar:function(a){var b=OpenLayers.Util.getImagesLocation(),
c="OpenLayers_Control_PanZoomBar_Slider"+this.map.id,d=this.map.getNumZoomLevels()-1-this.map.getZoom();this.slider=d=OpenLayers.Util.createAlphaImageDiv(c,a.add(-1,d*this.zoomStopHeight),new OpenLayers.Size(20,9),b+"slider.png","absolute");this.sliderEvents=new OpenLayers.Events(this,d,null,true);this.sliderEvents.register("mousedown",this,this.zoomBarDown);this.sliderEvents.register("mousemove",this,this.zoomBarDrag);this.sliderEvents.register("mouseup",this,this.zoomBarUp);this.sliderEvents.register("dblclick",
this,this.doubleClick);this.sliderEvents.register("click",this,this.doubleClick);sz=new OpenLayers.Size;sz.h=this.zoomStopHeight*this.map.getNumZoomLevels();sz.w=this.zoomStopWidth;c=null;if(OpenLayers.Util.alphaHack()){c="OpenLayers_Control_PanZoomBar"+this.map.id;c=OpenLayers.Util.createAlphaImageDiv(c,a,new OpenLayers.Size(sz.w,this.zoomStopHeight),b+"zoombar.png","absolute",null,"crop");c.style.height=sz.h}else c=OpenLayers.Util.createDiv("OpenLayers_Control_PanZoomBar_Zoombar"+this.map.id,a,
sz,b+"zoombar.png");this.zoombarDiv=c;this.divEvents=new OpenLayers.Events(this,c,null,true);this.divEvents.register("mousedown",this,this.divClick);this.divEvents.register("mousemove",this,this.passEventToSlider);this.divEvents.register("dblclick",this,this.doubleClick);this.divEvents.register("click",this,this.doubleClick);this.div.appendChild(c);this.startTop=parseInt(c.style.top);this.div.appendChild(d);this.map.events.register("zoomend",this,this.moveZoomBar);return a=a.add(0,this.zoomStopHeight*
this.map.getNumZoomLevels())},passEventToSlider:function(a){this.sliderEvents.handleBrowserEvent(a)},divClick:function(a){if(OpenLayers.Event.isLeftClick(a)){var b=a.xy.y,c=OpenLayers.Util.pagePosition(a.object)[1];b=Math.floor((b-c)/this.zoomStopHeight);this.map.zoomTo(this.map.getNumZoomLevels()-1-b);OpenLayers.Event.stop(a)}},zoomBarDown:function(a){if(OpenLayers.Event.isLeftClick(a)){this.map.events.register("mousemove",this,this.passEventToSlider);this.map.events.register("mouseup",this,this.passEventToSlider);
this.mouseDragStart=a.xy.clone();this.zoomStart=a.xy.clone();this.div.style.cursor="move";this.zoombarDiv.offsets=null;OpenLayers.Event.stop(a)}},zoomBarDrag:function(a){if(this.mouseDragStart!=null){var b=this.mouseDragStart.y-a.xy.y,c=OpenLayers.Util.pagePosition(this.zoombarDiv);if(a.clientY-c[1]>0&&a.clientY-c[1]<parseInt(this.zoombarDiv.style.height)-2)this.slider.style.top=parseInt(this.slider.style.top)-b+"px";this.mouseDragStart=a.xy.clone();OpenLayers.Event.stop(a)}},zoomBarUp:function(a){if(OpenLayers.Event.isLeftClick(a))if(this.zoomStart){this.div.style.cursor=
"";this.map.events.unregister("mouseup",this,this.passEventToSlider);this.map.events.unregister("mousemove",this,this.passEventToSlider);this.map.zoomTo(this.map.zoom+Math.round((this.zoomStart.y-a.xy.y)/this.zoomStopHeight));this.moveZoomBar();this.mouseDragStart=null;OpenLayers.Event.stop(a)}},moveZoomBar:function(){this.slider.style.top=(this.map.getNumZoomLevels()-1-this.map.getZoom())*this.zoomStopHeight+this.startTop+1+"px"},CLASS_NAME:"OpenLayers.Control.PanZoomBar"});
OpenLayers.Control.ArgParser=OpenLayers.Class(OpenLayers.Control,{center:null,zoom:null,layers:null,initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments)},setMap:function(){OpenLayers.Control.prototype.setMap.apply(this,arguments);for(var a=0;a<this.map.controls.length;a++){var b=this.map.controls[a];if(b!=this&&b.CLASS_NAME=="OpenLayers.Control.ArgParser")break}if(a==this.map.controls.length){a=OpenLayers.Util.getParameters();if(a.lat&&a.lon){this.center=new OpenLayers.LonLat(parseFloat(a.lon),
parseFloat(a.lat));if(a.zoom)this.zoom=parseInt(a.zoom);this.map.events.register("changebaselayer",this,this.setCenter);this.setCenter()}if(a.layers){this.layers=a.layers;this.map.events.register("addlayer",this,this.configureLayers);this.configureLayers()}}},setCenter:function(){if(this.map.baseLayer){this.map.events.unregister("changebaselayer",this,this.setCenter);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 a=0;a<this.layers.length;a++){var b=this.map.layers[a],c=this.layers.charAt(a);if(c=="B")this.map.setBaseLayer(b);else if(c=="T"||c=="F")b.setVisibility(c=="T")}}},CLASS_NAME:"OpenLayers.Control.ArgParser"});
OpenLayers.Control.LayerSwitcher=OpenLayers.Class(OpenLayers.Control,{activeColor:"darkblue",layerStates:null,layersDiv:null,baseLayersDiv:null,baseLayers:null,dataLbl:null,dataLayersDiv:null,dataLayers:null,minimizeDiv:null,maximizeDiv:null,ascending:true,initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.layerStates=[]},destroy:function(){OpenLayers.Event.stopObservingElement(this.div);OpenLayers.Event.stopObservingElement(this.minimizeDiv);OpenLayers.Event.stopObservingElement(this.maximizeDiv);
this.clearLayersArray("base");this.clearLayersArray("data");this.map.events.unregister("addlayer",this,this.redraw);this.map.events.unregister("changelayer",this,this.redraw);this.map.events.unregister("removelayer",this,this.redraw);this.map.events.unregister("changebaselayer",this,this.redraw);OpenLayers.Control.prototype.destroy.apply(this,arguments)},setMap:function(){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.map.events.register("addlayer",this,this.redraw);this.map.events.register("changelayer",
this,this.redraw);this.map.events.register("removelayer",this,this.redraw);this.map.events.register("changebaselayer",this,this.redraw)},draw:function(){OpenLayers.Control.prototype.draw.apply(this);this.loadContents();this.outsideViewport||this.minimizeControl();this.redraw();return this.div},clearLayersArray:function(a){var b=this[a+"Layers"];if(b)for(var c=0;c<b.length;c++){var d=b[c];OpenLayers.Event.stopObservingElement(d.inputElem);OpenLayers.Event.stopObservingElement(d.labelSpan)}this[a+"LayersDiv"].innerHTML=
"";this[a+"Layers"]=[]},checkRedraw:function(){var a=false;if(!this.layerStates.length||this.map.layers.length!=this.layerStates.length)a=true;else for(var b=0;b<this.layerStates.length;b++){var c=this.layerStates[b],d=this.map.layers[b];if(c.name!=d.name||c.inRange!=d.inRange||c.id!=d.id||c.visibility!=d.visibility){a=true;break}}return a},redraw:function(){if(!this.checkRedraw())return this.div;this.clearLayersArray("base");this.clearLayersArray("data");var a=false,b=false;this.layerStates=new Array(this.map.layers.length);
for(var c=0;c<this.map.layers.length;c++){var d=this.map.layers[c];this.layerStates[c]={name:d.name,visibility:d.visibility,inRange:d.inRange,id:d.id}}var e=this.map.layers.slice();this.ascending||e.reverse();for(c=0;c<e.length;c++){d=e[c];var f=d.isBaseLayer;if(d.displayInLayerSwitcher){if(f)b=true;else a=true;var g=f?d==this.map.baseLayer:d.getVisibility(),h=document.createElement("input");h.id="input_"+d.name;h.name=f?"baseLayers":d.name;h.type=f?"radio":"checkbox";h.value=d.name;h.checked=g;h.defaultChecked=
g;if(!f&&!d.inRange)h.disabled=true;var j={inputElem:h,layer:d,layerSwitcher:this};OpenLayers.Event.observe(h,"mouseup",OpenLayers.Function.bindAsEventListener(this.onInputClick,j));g=document.createElement("span");if(!f&&!d.inRange)g.style.color="gray";g.innerHTML=d.name;g.style.verticalAlign=f?"bottom":"baseline";OpenLayers.Event.observe(g,"click",OpenLayers.Function.bindAsEventListener(this.onInputClick,j));j=document.createElement("br");(f?this.baseLayers:this.dataLayers).push({layer:d,inputElem:h,
labelSpan:g});d=f?this.baseLayersDiv:this.dataLayersDiv;d.appendChild(h);d.appendChild(g);d.appendChild(j)}}this.dataLbl.style.display=a?"":"none";this.baseLbl.style.display=b?"":"none";return this.div},onInputClick:function(a){if(!this.inputElem.disabled)if(this.inputElem.type=="radio"){this.inputElem.checked=true;this.layer.map.setBaseLayer(this.layer)}else{this.inputElem.checked=!this.inputElem.checked;this.layerSwitcher.updateMap()}OpenLayers.Event.stop(a)},onLayerClick:function(){this.updateMap()},
updateMap:function(){for(var a=0;a<this.baseLayers.length;a++){var b=this.baseLayers[a];b.inputElem.checked&&this.map.setBaseLayer(b.layer,false)}for(a=0;a<this.dataLayers.length;a++){b=this.dataLayers[a];b.layer.setVisibility(b.inputElem.checked)}},maximizeControl:function(a){this.div.style.width="20em";this.div.style.height="";this.showControls(false);a!=null&&OpenLayers.Event.stop(a)},minimizeControl:function(a){this.div.style.width="0px";this.div.style.height="0px";this.showControls(true);a!=
null&&OpenLayers.Event.stop(a)},showControls:function(a){this.maximizeDiv.style.display=a?"":"none";this.minimizeDiv.style.display=a?"none":"";this.layersDiv.style.display=a?"none":""},loadContents:function(){this.div.style.position="absolute";this.div.style.top="25px";this.div.style.right="0px";this.div.style.left="";this.div.style.fontFamily="sans-serif";this.div.style.fontWeight="bold";this.div.style.marginTop="3px";this.div.style.marginLeft="3px";this.div.style.marginBottom="3px";this.div.style.fontSize=
"smaller";this.div.style.color="white";this.div.style.backgroundColor="transparent";OpenLayers.Event.observe(this.div,"mouseup",OpenLayers.Function.bindAsEventListener(this.mouseUp,this));OpenLayers.Event.observe(this.div,"click",this.ignoreEvent);OpenLayers.Event.observe(this.div,"mousedown",OpenLayers.Function.bindAsEventListener(this.mouseDown,this));OpenLayers.Event.observe(this.div,"dblclick",this.ignoreEvent);this.layersDiv=document.createElement("div");this.layersDiv.id="layersDiv";this.layersDiv.style.paddingTop=
"5px";this.layersDiv.style.paddingLeft="10px";this.layersDiv.style.paddingBottom="5px";this.layersDiv.style.paddingRight="75px";this.layersDiv.style.backgroundColor=this.activeColor;this.layersDiv.style.width="100%";this.layersDiv.style.height="100%";this.baseLbl=document.createElement("div");this.baseLbl.innerHTML="<u>Base Layer</u>";this.baseLbl.style.marginTop="3px";this.baseLbl.style.marginLeft="3px";this.baseLbl.style.marginBottom="3px";this.baseLayersDiv=document.createElement("div");this.baseLayersDiv.style.paddingLeft=
"10px";this.dataLbl=document.createElement("div");this.dataLbl.innerHTML="<u>Overlays</u>";this.dataLbl.style.marginTop="3px";this.dataLbl.style.marginLeft="3px";this.dataLbl.style.marginBottom="3px";this.dataLayersDiv=document.createElement("div");this.dataLayersDiv.style.paddingLeft="10px";if(this.ascending){this.layersDiv.appendChild(this.baseLbl);this.layersDiv.appendChild(this.baseLayersDiv);this.layersDiv.appendChild(this.dataLbl);this.layersDiv.appendChild(this.dataLayersDiv)}else{this.layersDiv.appendChild(this.dataLbl);
this.layersDiv.appendChild(this.dataLayersDiv);this.layersDiv.appendChild(this.baseLbl);this.layersDiv.appendChild(this.baseLayersDiv)}this.div.appendChild(this.layersDiv);OpenLayers.Rico.Corner.round(this.div,{corners:"tl bl",bgColor:"transparent",color:this.activeColor,blend:false});OpenLayers.Rico.Corner.changeOpacity(this.layersDiv,0.75);var a=OpenLayers.Util.getImagesLocation(),b=new OpenLayers.Size(18,18),c=a+"layer-switcher-maximize.png";this.maximizeDiv=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_MaximizeDiv",
null,b,c,"absolute");this.maximizeDiv.style.top="5px";this.maximizeDiv.style.right="0px";this.maximizeDiv.style.left="";this.maximizeDiv.style.display="none";OpenLayers.Event.observe(this.maximizeDiv,"click",OpenLayers.Function.bindAsEventListener(this.maximizeControl,this));this.div.appendChild(this.maximizeDiv);c=a+"layer-switcher-minimize.png";b=new OpenLayers.Size(18,18);this.minimizeDiv=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_MinimizeDiv",null,b,c,"absolute");this.minimizeDiv.style.top=
"5px";this.minimizeDiv.style.right="0px";this.minimizeDiv.style.left="";this.minimizeDiv.style.display="none";OpenLayers.Event.observe(this.minimizeDiv,"click",OpenLayers.Function.bindAsEventListener(this.minimizeControl,this));this.div.appendChild(this.minimizeDiv)},ignoreEvent:function(a){OpenLayers.Event.stop(a)},mouseDown:function(a){this.isMouseDown=true;this.ignoreEvent(a)},mouseUp:function(a){if(this.isMouseDown){this.isMouseDown=false;this.ignoreEvent(a)}},CLASS_NAME:"OpenLayers.Control.LayerSwitcher"});
OpenLayers.Control.DrawFeature=OpenLayers.Class(OpenLayers.Control,{layer:null,callbacks:null,featureAdded:function(){},handlerOptions:null,initialize:function(a,b,c){OpenLayers.Control.prototype.initialize.apply(this,[c]);this.callbacks=OpenLayers.Util.extend({done:this.drawFeature},this.callbacks);this.layer=a;this.handler=new b(this,this.callbacks,this.handlerOptions)},drawFeature:function(a){a=new OpenLayers.Feature.Vector(a);this.layer.addFeatures([a]);this.featureAdded(a)},CLASS_NAME:"OpenLayers.Control.DrawFeature"});
OpenLayers.Control.DragFeature=OpenLayers.Class(OpenLayers.Control,{geometryTypes:null,onStart:function(){},onDrag:function(){},onComplete:function(){},layer:null,feature:null,dragHandler:null,dragCallbacks:{},featureHandler:null,featureCallbacks:{},lastPixel:null,initialize:function(a,b){OpenLayers.Control.prototype.initialize.apply(this,[b]);this.layer=a;this.dragCallbacks=OpenLayers.Util.extend({down:this.downFeature,move:this.moveFeature,up:this.upFeature,out:this.cancel,done:this.doneDragging},
this.dragCallbacks);this.dragHandler=new OpenLayers.Handler.Drag(this,this.dragCallbacks);this.featureCallbacks=OpenLayers.Util.extend({over:this.overFeature,out:this.outFeature},this.featureCallbacks);this.featureHandler=new OpenLayers.Handler.Feature(this,this.layer,this.featureCallbacks,{geometryTypes:this.geometryTypes})},destroy:function(){this.layer=null;this.dragHandler.destroy();this.featureHandler.destroy();OpenLayers.Control.prototype.destroy.apply(this,[])},activate:function(){return this.featureHandler.activate()&&
OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){this.dragHandler.deactivate();this.featureHandler.deactivate();this.feature=null;this.dragging=false;this.lastPixel=null;return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},overFeature:function(a){if(this.dragHandler.dragging)this.over=this.feature.id==a.id?true:false;else{this.feature=a;this.dragHandler.activate();this.over=true;this.map.div.style.cursor="move"}},downFeature:function(a){this.lastPixel=
a;this.onStart(this.feature,a)},moveFeature:function(a){var b=this.map.getResolution();this.feature.geometry.move(b*(a.x-this.lastPixel.x),b*(this.lastPixel.y-a.y));this.layer.drawFeature(this.feature);this.lastPixel=a;this.onDrag(this.feature,a)},upFeature:function(){if(!this.over){this.dragHandler.deactivate();this.feature=null;this.map.div.style.cursor="default"}},doneDragging:function(a){this.onComplete(this.feature,a)},outFeature:function(a){if(this.dragHandler.dragging){if(this.feature.id==
a.id)this.over=false}else{this.over=false;this.dragHandler.deactivate();this.map.div.style.cursor="default";this.feature=null}},cancel:function(){this.dragHandler.deactivate();this.over=false},setMap:function(a){this.dragHandler.setMap(a);this.featureHandler.setMap(a);OpenLayers.Control.prototype.setMap.apply(this,arguments)},CLASS_NAME:"OpenLayers.Control.DragFeature"});
OpenLayers.Control.ModifyFeature=OpenLayers.Class(OpenLayers.Control,{geometryTypes:null,layer:null,feature:null,vertices:null,virtualVertices:null,selectControl:null,dragControl:null,keyboardHandler:null,deleteCodes:null,virtualStyle:null,onModificationStart:function(){},onModification:function(){},onModificationEnd:function(){},initialize:function(a,b){this.layer=a;this.vertices=[];this.virtualVertices=[];this.styleVirtual=OpenLayers.Util.extend({},this.layer.style);this.styleVirtual.fillOpacity=
0.3;this.styleVirtual.strokeOpacity=0.3;this.deleteCodes=[46,100];OpenLayers.Control.prototype.initialize.apply(this,[b]);if(!(this.deleteCodes instanceof Array))this.deleteCodes=[this.deleteCodes];var c=this;this.selectControl=new OpenLayers.Control.SelectFeature(a,{geometryTypes:this.geometryTypes,onSelect:function(d){c.selectFeature.apply(c,[d])},onUnselect:function(d){c.unselectFeature.apply(c,[d])}});this.dragControl=new OpenLayers.Control.DragFeature(a,{geometryTypes:["OpenLayers.Geometry.Point"],
snappingOptions:this.snappingOptions,onStart:function(d,e){c.dragStart.apply(c,[d,e])},onDrag:function(d){c.dragVertex.apply(c,[d])},onComplete:function(d){c.dragComplete.apply(c,[d])}});this.keyboardHandler=new OpenLayers.Handler.Keyboard(this,{keypress:this.handleKeypress})},destroy:function(){this.layer=null;this.selectControl.destroy();this.dragControl.destroy();this.keyboardHandler.destroy();OpenLayers.Control.prototype.destroy.apply(this,[])},activate:function(){return this.selectControl.activate()&&
this.keyboardHandler.activate()&&OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){var a=false;if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)){this.layer.removeFeatures(this.vertices);this.layer.removeFeatures(this.virtualVertices);this.vertices=[];this.dragControl.deactivate();this.feature&&this.selectControl.unselect.apply(this.selectControl,[this.feature]);this.selectControl.deactivate();this.keyboardHandler.deactivate();a=true}return a},selectFeature:function(a){this.feature=
a;this.resetVertices();this.dragControl.activate();this.onModificationStart(this.feature)},unselectFeature:function(a){this.layer.removeFeatures(this.vertices);this.layer.removeFeatures(this.virtualVertices);this.vertices=[];this.virtualVertices=[];this.feature=null;this.dragControl.deactivate();this.onModificationEnd(a)},dragStart:function(a,b){if(a!=this.feature&&OpenLayers.Util.indexOf(this.vertices,a)==-1&&OpenLayers.Util.indexOf(this.virtualVertices,a)==-1){this.feature&&this.selectControl.clickFeature.apply(this.selectControl,
[this.feature]);if(this.geometryTypes==null||OpenLayers.Util.indexOf(this.geometryTypes,a.geometry.CLASS_NAME)!=-1){this.selectControl.clickFeature.apply(this.selectControl,[a]);this.dragControl.overFeature.apply(this.dragControl,[a]);this.dragControl.lastPixel=b;this.dragControl.dragHandler.started=true;this.dragControl.dragHandler.start=b;this.dragControl.dragHandler.last=b}}},dragVertex:function(a){if(this.feature.geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){if(this.feature!=a)this.feature=
a}else if(OpenLayers.Util.indexOf(this.virtualVertices,a)!=-1){a.geometry.parent.addComponent(a.geometry,a._index);delete a._index;OpenLayers.Util.removeItem(this.virtualVertices,a);this.layer.removeFeatures(a)}this.layer.drawFeature(this.feature,this.selectControl.selectStyle);this.layer.removeFeatures(this.virtualVertices);this.layer.drawFeature(a)},dragComplete:function(){this.resetVertices();this.onModification(this.feature)},resetVertices:function(){if(this.vertices.length>0){this.layer.removeFeatures(this.vertices);
this.vertices=[]}if(this.virtualVertices.length>0){this.layer.removeFeatures(this.virtualVertices);this.virtualVertices=[]}if(this.feature&&this.feature.geometry.CLASS_NAME!="OpenLayers.Geometry.Point"){this.collectVertices(this.feature.geometry);this.layer.addFeatures(this.vertices);this.layer.addFeatures(this.virtualVertices)}},handleKeypress:function(a){if(this.feature&&OpenLayers.Util.indexOf(this.deleteCodes,a)!=-1)if((a=this.dragControl.feature)&&OpenLayers.Util.indexOf(this.vertices,a)!=-1){a.geometry.parent.removeComponent(a.geometry);
this.layer.drawFeature(this.feature,this.selectControl.selectStyle);this.resetVertices();this.onModification(this.feature)}},collectVertices:function(){function a(c){var d,e;if(c.CLASS_NAME=="OpenLayers.Geometry.Point"){e=new OpenLayers.Feature.Vector(c);b.vertices.push(e)}else{for(d=0;d<c.components.length;++d){e=c.components[d];if(e.CLASS_NAME=="OpenLayers.Geometry.Point"){e=new OpenLayers.Feature.Vector(e);b.vertices.push(e)}else a(e)}if(c.CLASS_NAME!="OpenLayers.Geometry.MultiPoint")for(d=0;d<
c.components.length-1;++d){e=c.components[d];var f=c.components[d+1];if(e.CLASS_NAME=="OpenLayers.Geometry.Point"&&f.CLASS_NAME=="OpenLayers.Geometry.Point"){e=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point((e.x+f.x)/2,(e.y+f.y)/2),null,b.styleVirtual);e.geometry.parent=c;e._index=d+1;b.virtualVertices.push(e)}}}}this.vertices=[];this.virtualVirtices=[];var b=this;a(this.feature.geometry)},setMap:function(a){this.selectControl.setMap(a);this.dragControl.setMap(a);OpenLayers.Control.prototype.setMap.apply(this,
arguments)},CLASS_NAME:"OpenLayers.Control.ModifyFeature"});
OpenLayers.Control.Panel=OpenLayers.Class(OpenLayers.Control,{controls:null,defaultControl:null,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,[a]);this.controls=[]},destroy:function(){OpenLayers.Control.prototype.destroy.apply(this,arguments);for(var a=this.controls.length-1;a>=0;a--){OpenLayers.Event.stopObservingElement(this.controls[a].panel_div);this.controls[a].panel_div=null}},activate:function(){if(OpenLayers.Control.prototype.activate.apply(this,arguments)){for(var a=
0;a<this.controls.length;a++)this.controls[a]==this.defaultControl&&this.controls[a].activate();this.redraw();return true}else return false},deactivate:function(){if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)){for(var a=0;a<this.controls.length;a++)this.controls[a].deactivate();this.redraw();return true}else return false},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);for(var a=0;a<this.controls.length;a++){this.map.addControl(this.controls[a]);this.controls[a].deactivate()}this.activate();
return this.div},redraw:function(){this.div.innerHTML="";if(this.active)for(var a=0;a<this.controls.length;a++){var b=this.controls[a].panel_div;b.className=this.controls[a].active?this.controls[a].displayClass+"ItemActive":this.controls[a].displayClass+"ItemInactive";this.div.appendChild(b)}},activateControl:function(a){if(!this.active)return false;if(a.type==OpenLayers.Control.TYPE_BUTTON)a.trigger();else if(a.type==OpenLayers.Control.TYPE_TOGGLE)a.active?a.deactivate():a.activate();else{for(var b=
0;b<this.controls.length;b++)if(this.controls[b]==a)a.activate();else this.controls[b].type!=OpenLayers.Control.TYPE_TOGGLE&&this.controls[b].deactivate();this.redraw()}},addControls:function(a){a instanceof Array||(a=[a]);this.controls=this.controls.concat(a);for(var b=0;b<a.length;b++){var c=document.createElement("div");document.createTextNode(" ");a[b].panel_div=c;OpenLayers.Event.observe(a[b].panel_div,"click",OpenLayers.Function.bind(this.onClick,this,a[b]));OpenLayers.Event.observe(a[b].panel_div,
"mousedown",OpenLayers.Function.bindAsEventListener(OpenLayers.Event.stop))}if(this.map){for(b=0;b<a.length;b++){this.map.addControl(a[b]);a[b].deactivate()}this.redraw()}},onClick:function(a,b){OpenLayers.Event.stop(b?b:window.event);this.activateControl(a)},CLASS_NAME:"OpenLayers.Control.Panel"});
OpenLayers.Control.SelectFeature=OpenLayers.Class(OpenLayers.Control,{multiple:false,hover:false,onSelect:function(){},onUnselect:function(){},geometryTypes:null,layer:null,callbacks:null,selectStyle:OpenLayers.Feature.Vector.style.select,handler:null,initialize:function(a,b){OpenLayers.Control.prototype.initialize.apply(this,[b]);this.layer=a;this.callbacks=OpenLayers.Util.extend({click:this.clickFeature,over:this.overFeature,out:this.outFeature},this.callbacks);this.handler=new OpenLayers.Handler.Feature(this,
a,this.callbacks,{geometryTypes:this.geometryTypes})},clickFeature:function(a){if(!this.hover)if(this.multiple)OpenLayers.Util.indexOf(this.layer.selectedFeatures,a)>-1?this.unselect(a):this.select(a);else if(OpenLayers.Util.indexOf(this.layer.selectedFeatures,a)>-1)this.unselect(a);else{if(this.layer.selectedFeatures)for(var b=0;b<this.layer.selectedFeatures.length;b++)this.unselect(this.layer.selectedFeatures[b]);this.select(a)}},overFeature:function(a){if(this.hover)OpenLayers.Util.indexOf(this.layer.selectedFeatures,
a)>-1||this.select(a)},outFeature:function(a){this.hover&&this.unselect(a)},select:function(a){if(a.originalStyle==null)a.originalStyle=a.style;this.layer.selectedFeatures.push(a);a.style=this.selectStyle;this.layer.drawFeature(a);this.onSelect(a)},unselect:function(a){if(a.originalStyle!=null)a.style=a.originalStyle;this.layer.drawFeature(a);OpenLayers.Util.removeItem(this.layer.selectedFeatures,a);this.onUnselect(a)},setMap:function(a){this.handler.setMap(a);OpenLayers.Control.prototype.setMap.apply(this,
arguments)},CLASS_NAME:"OpenLayers.Control.SelectFeature"});
OpenLayers.Geometry=OpenLayers.Class({id:null,parent:null,bounds:null,initialize:function(){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){this.bounds=this.id=null},clone:function(){return new OpenLayers.Geometry},setBounds:function(a){if(a)this.bounds=a.clone()},clearBounds:function(){this.bounds=null;this.parent&&this.parent.clearBounds()},extendBounds:function(a){this.getBounds()?this.bounds.extend(a):this.setBounds(a)},getBounds:function(){this.bounds==null&&this.calculateBounds();
return this.bounds},calculateBounds:function(){},atPoint:function(a,b,c){var d=false;if(this.getBounds()!=null&&a!=null){b=b!=null?b:0;c=c!=null?c:0;d=(new OpenLayers.Bounds(this.bounds.left-b,this.bounds.bottom-c,this.bounds.right+b,this.bounds.top+c)).containsLonLat(a)}return d},getLength:function(){return 0},getArea:function(){return 0},toString:function(){return OpenLayers.Format.WKT.prototype.write(new OpenLayers.Feature.Vector(this))},CLASS_NAME:"OpenLayers.Geometry"});
OpenLayers.Geometry.Rectangle=OpenLayers.Class(OpenLayers.Geometry,{x:null,y:null,width:null,height:null,initialize:function(a,b,c,d){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.x=a;this.y=b;this.width=c;this.height=d},calculateBounds:function(){this.bounds=new OpenLayers.Bounds(this.x,this.y,this.x+this.width,this.y+this.height)},getLength:function(){return 2*this.width+2*this.height},getArea:function(){return this.width*this.height},CLASS_NAME:"OpenLayers.Geometry.Rectangle"});
OpenLayers.Geometry.Collection=OpenLayers.Class(OpenLayers.Geometry,{components:null,componentTypes:null,initialize:function(a){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.components=[];a!=null&&this.addComponents(a)},destroy:function(){this.components.length=0;this.components=null},clone:function(){for(var a=eval("new "+this.CLASS_NAME+"()"),b=0;b<this.components.length;b++)a.addComponent(this.components[b].clone());OpenLayers.Util.applyDefaults(a,this);return a},getComponentsString:function(){for(var a=
[],b=0;b<this.components.length;b++)a.push(this.components[b].toShortString());return a.join(",")},calculateBounds:function(){this.bounds=null;if(this.components&&this.components.length>0){this.setBounds(this.components[0].getBounds());for(var a=1;a<this.components.length;a++)this.extendBounds(this.components[a].getBounds())}},addComponents:function(a){a instanceof Array||(a=[a]);for(var b=0;b<a.length;b++)this.addComponent(a[b])},addComponent:function(a,b){var c=false;if(a)if(this.componentTypes==
null||OpenLayers.Util.indexOf(this.componentTypes,a.CLASS_NAME)>-1){if(b!=null&&b<this.components.length){c=this.components.slice(0,b);b=this.components.slice(b,this.components.length);c.push(a);this.components=c.concat(b)}else this.components.push(a);a.parent=this;this.clearBounds();c=true}return c},removeComponents:function(a){a instanceof Array||(a=[a]);for(var b=0;b<a.length;b++)this.removeComponent(a[b])},removeComponent:function(a){OpenLayers.Util.removeItem(this.components,a);this.clearBounds()},
getLength:function(){for(var a=0,b=0;b<this.components.length;b++)a+=this.components[b].getLength();return a},getArea:function(){for(var a=0,b=0;b<this.components.length;b++)a+=this.components[b].getArea();return a},move:function(a,b){for(var c=0;c<this.components.length;c++)this.components[c].move(a,b)},rotate:function(a,b){for(var c=0;c<this.components.length;++c)this.components[c].rotate(a,b)},resize:function(a,b){for(var c=0;c<this.components.length;++c)this.components[c].resize(a,b)},equals:function(a){var b=
true;if(!a.CLASS_NAME||this.CLASS_NAME!=a.CLASS_NAME)b=false;else if(!(a.components instanceof Array)||a.components.length!=this.components.length)b=false;else for(var c=0;c<this.components.length;++c)if(!this.components[c].equals(a.components[c])){b=false;break}return b},CLASS_NAME:"OpenLayers.Geometry.Collection"});
OpenLayers.Geometry.Point=OpenLayers.Class(OpenLayers.Geometry,{x:null,y:null,initialize:function(a,b){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.x=parseFloat(a);this.y=parseFloat(b)},clone:function(a){if(a==null)a=new OpenLayers.Geometry.Point(this.x,this.y);OpenLayers.Util.applyDefaults(a,this);return a},calculateBounds:function(){this.bounds=new OpenLayers.Bounds(this.x,this.y,this.x,this.y)},distanceTo:function(a){var b=0;if(this.x!=null&&this.y!=null&&a!=null&&a.x!=null&&
a.y!=null){b=Math.pow(this.x-a.x,2);a=Math.pow(this.y-a.y,2);b=Math.sqrt(b+a)}return b},equals:function(a){var b=false;if(a!=null)b=this.x==a.x&&this.y==a.y||isNaN(this.x)&&isNaN(this.y)&&isNaN(a.x)&&isNaN(a.y);return b},toShortString:function(){return this.x+", "+this.y},move:function(a,b){this.x+=a;this.y+=b;this.clearBounds()},rotate:function(a,b){a*=Math.PI/180;var c=this.distanceTo(b);a=a+Math.atan2(this.y-b.y,this.x-b.x);this.x=b.x+c*Math.cos(a);this.y=b.y+c*Math.sin(a);this.clearBounds()},
resize:function(a,b){this.x=b.x+a*(this.x-b.x);this.y=b.y+a*(this.y-b.y);this.clearBounds()},CLASS_NAME:"OpenLayers.Geometry.Point"});OpenLayers.Geometry.MultiPoint=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments)},addPoint:function(a,b){this.addComponent(a,b)},removePoint:function(a){this.removeComponent(a)},CLASS_NAME:"OpenLayers.Geometry.MultiPoint"});
OpenLayers.Geometry.Curve=OpenLayers.Class(OpenLayers.Geometry.MultiPoint,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(){OpenLayers.Geometry.MultiPoint.prototype.initialize.apply(this,arguments)},getLength:function(){var a=0;if(this.components&&this.components.length>1)for(var b=1;b<this.components.length;b++)a+=this.components[b-1].distanceTo(this.components[b]);return a},CLASS_NAME:"OpenLayers.Geometry.Curve"});
OpenLayers.Geometry.LineString=OpenLayers.Class(OpenLayers.Geometry.Curve,{initialize:function(){OpenLayers.Geometry.Curve.prototype.initialize.apply(this,arguments)},removeComponent:function(){this.components&&this.components.length>2&&OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments)},CLASS_NAME:"OpenLayers.Geometry.LineString"});
OpenLayers.Geometry.LinearRing=OpenLayers.Class(OpenLayers.Geometry.LineString,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(){OpenLayers.Geometry.LineString.prototype.initialize.apply(this,arguments)},addComponent:function(a,b){var c=false,d=this.components.pop();if(b!=null||!a.equals(d))c=OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,arguments);OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[this.components[0]]);return c},removeComponent:function(){if(this.components.length>
4){this.components.pop();OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[this.components[0]])}},move:function(a,b){for(var c=0;c<this.components.length-1;c++)this.components[c].move(a,b)},rotate:function(a,b){for(var c=0;c<this.components.length-1;++c)this.components[c].rotate(a,b)},resize:function(a,b){for(var c=0;c<this.components.length-1;++c)this.components[c].resize(a,b)},getArea:function(){var a=
0;if(this.components&&this.components.length>2){for(var b=a=0;b<this.components.length-1;b++){var c=this.components[b],d=this.components[b+1];a+=(c.x+d.x)*(d.y-c.y)}a=-a/2}return a},CLASS_NAME:"OpenLayers.Geometry.LinearRing"});
OpenLayers.Geometry.Polygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LinearRing"],initialize:function(){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments)},getArea:function(){var a=0;if(this.components&&this.components.length>0){a+=Math.abs(this.components[0].getArea());for(var b=1;b<this.components.length;b++)a-=Math.abs(this.components[b].getArea())}return a},CLASS_NAME:"OpenLayers.Geometry.Polygon"});
OpenLayers.Geometry.Polygon.createRegularPolygon=function(a,b,c,d){var e=Math.PI*(1/c-0.5);if(d)e+=d/180*Math.PI;for(var f,g=[],h=0;h<c;++h){rotatedAngle=e+h*2*Math.PI/c;d=a.x+b*Math.cos(rotatedAngle);f=a.y+b*Math.sin(rotatedAngle);g.push(new OpenLayers.Geometry.Point(d,f))}a=new OpenLayers.Geometry.LinearRing(g);return new OpenLayers.Geometry.Polygon([a])};
OpenLayers.Geometry.MultiLineString=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LineString"],initialize:function(){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments)},CLASS_NAME:"OpenLayers.Geometry.MultiLineString"});
OpenLayers.Geometry.MultiPolygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.Polygon"],initialize:function(){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments)},CLASS_NAME:"OpenLayers.Geometry.MultiPolygon"});OpenLayers.Geometry.Surface=OpenLayers.Class(OpenLayers.Geometry,{initialize:function(){OpenLayers.Geometry.prototype.initialize.apply(this,arguments)},CLASS_NAME:"OpenLayers.Geometry.Surface"});
OpenLayers.Renderer=OpenLayers.Class({container:null,extent:null,size:null,resolution:null,map:null,initialize:function(a){this.container=OpenLayers.Util.getElement(a)},destroy:function(){this.map=this.resolution=this.size=this.extent=this.container=null},supported:function(){return false},setExtent:function(a){this.extent=a.clone();this.resolution=null},setSize:function(a){this.size=a.clone();this.resolution=null},getResolution:function(){return this.resolution=this.resolution||this.map.getResolution()},
drawFeature:function(a,b){if(b==null)b=a.style;this.drawGeometry(a.geometry,b,a.id)},drawGeometry:function(){},clear:function(){},getFeatureIdFromEvent:function(){},eraseFeatures:function(a){a instanceof Array||(a=[a]);for(var b=0;b<a.length;++b)this.eraseGeometry(a[b].geometry)},eraseGeometry:function(){},CLASS_NAME:"OpenLayers.Renderer"});
OpenLayers.Renderer.Elements=OpenLayers.Class(OpenLayers.Renderer,{rendererRoot:null,root:null,xmlns:null,initialize:function(){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.rendererRoot=this.createRenderRoot();this.root=this.createRoot();this.rendererRoot.appendChild(this.root);this.container.appendChild(this.rendererRoot)},destroy:function(){this.clear();this.xmlns=this.root=this.rendererRoot=null;OpenLayers.Renderer.prototype.destroy.apply(this,arguments)},clear:function(){if(this.root)for(;this.root.childNodes.length>
0;)this.root.removeChild(this.root.firstChild)},getNodeType:function(){},drawGeometry:function(a,b,c){var d=a.CLASS_NAME;if(d=="OpenLayers.Geometry.Collection"||d=="OpenLayers.Geometry.MultiPoint"||d=="OpenLayers.Geometry.MultiLineString"||d=="OpenLayers.Geometry.MultiPolygon")for(d=0;d<a.components.length;d++)this.drawGeometry(a.components[d],b,c);else{d=this.getNodeType(a);d=this.nodeFactory(a.id,d,a);d._featureId=c;d._geometryClass=a.CLASS_NAME;d._style=b;this.root.appendChild(d);this.drawGeometryNode(d,
a)}},drawGeometryNode:function(a,b,c){c=c||a._style;var d={isFilled:true,isStroked:true};switch(b.CLASS_NAME){case "OpenLayers.Geometry.Point":this.drawPoint(a,b);break;case "OpenLayers.Geometry.LineString":if(EMS.Util.isIE6()){d.isFilled=true;c.fillOpacity=0.0010;c.fillColor="none"}else d.isFilled=false;this.drawLineString(a,b);break;case "OpenLayers.Geometry.LinearRing":this.drawLinearRing(a,b);break;case "OpenLayers.Geometry.Polygon":this.drawPolygon(a,b);break;case "OpenLayers.Geometry.Surface":this.drawSurface(a,
b);break;case "OpenLayers.Geometry.Rectangle":this.drawRectangle(a,b);break;default:break}a._style=c;a._options=d;this.setStyle(a,c,d,b)},drawPoint:function(){},drawLineString:function(){},drawLinearRing:function(){},drawPolygon:function(){},drawRectangle:function(){},drawCircle:function(){},drawCurve:function(){},drawSurface:function(){},getFeatureIdFromEvent:function(a){return(a.target||a.srcElement)._featureId},eraseGeometry:function(a){if(a.CLASS_NAME=="OpenLayers.Geometry.MultiPoint"||a.CLASS_NAME==
"OpenLayers.Geometry.MultiLineString"||a.CLASS_NAME=="OpenLayers.Geometry.MultiPolygon")for(var b=0;b<a.components.length;b++)this.eraseGeometry(a.components[b]);else if((a=OpenLayers.Util.getElement(a.id))&&a.parentNode){if(a.geometry){a.geometry.destroy();a.geometry=null}a.parentNode.removeChild(a)}},nodeFactory:function(a,b,c){var d=OpenLayers.Util.getElement(a);if(d){if(!this.nodeTypeCompare(d,b)){d.parentNode.removeChild(d);d=this.nodeFactory(a,b,c)}}else d=this.createNode(b,a);return d},CLASS_NAME:"OpenLayers.Renderer.Elements"});
OpenLayers.Renderer.SVG=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"http://www.w3.org/2000/svg",maxPixel:15E3,localResolution:null,initialize:function(){this.supported()&&OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments)},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments)},supported:function(){return document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#SVG",
"1.1")||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"))},setExtent:function(a){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var b=this.getResolution();if(!this.localResolution||b!=this.localResolution){this.left=-a.left/b;this.top=a.top/b}var c=0,d=0;if(this.localResolution&&b==this.localResolution){c=this.left- -a.left/b;d=this.top-a.top/b}this.localResolution=b;this.rendererRoot.setAttributeNS(null,"viewBox",c+" "+d+" "+a.getWidth()/
b+" "+a.getHeight()/b)},setSize:function(){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(a){var b=null;switch(a.CLASS_NAME){case "OpenLayers.Geometry.Point":b="circle";break;case "OpenLayers.Geometry.Rectangle":b="rect";break;case "OpenLayers.Geometry.LineString":b="polyline";break;case "OpenLayers.Geometry.LinearRing":b="polygon";break;case "OpenLayers.Geometry.Polygon":case "OpenLayers.Geometry.Curve":case "OpenLayers.Geometry.Surface":b=
"path";break;default:break}return b},setStyle:function(a,b,c){b=b||a._style;c=c||a._options;if(a._geometryClass=="OpenLayers.Geometry.Point")if(b.externalGraphic){var d=a.getAttributeNS(null,"id"),e=parseFloat(a.getAttributeNS(null,"cx")),f=parseFloat(a.getAttributeNS(null,"cy")),g=a._featureId,h=a._geometryClass,j=a._style;this.root.removeChild(a);a=this.createNode("image",d);a._featureId=g;a._geometryClass=h;a._style=j;this.root.appendChild(a);b.graphicWidth&&b.graphicHeight&&a.setAttributeNS(null,
"preserveAspectRatio","none");d=b.graphicWidth||b.graphicHeight;g=b.graphicHeight||b.graphicWidth;d=d?d:b.pointRadius*2;g=g?g:b.pointRadius*2;h=b.graphicYOffset!=undefined?b.graphicYOffset:-(0.5*g);j=b.graphicOpacity||b.fillOpacity;a.setAttributeNS(null,"x",(e+(b.graphicXOffset!=undefined?b.graphicXOffset:-(0.5*d))).toFixed());a.setAttributeNS(null,"y",(-f+h).toFixed());a.setAttributeNS(null,"width",d);a.setAttributeNS(null,"height",g);a.setAttributeNS("http://www.w3.org/1999/xlink","href",b.externalGraphic);
a.setAttributeNS(null,"transform","scale(1,-1)");a.setAttributeNS(null,"style","opacity: "+j)}else a.setAttributeNS(null,"r",b.pointRadius);if(c.isFilled){a.setAttributeNS(null,"fill",b.fillColor);a.setAttributeNS(null,"fill-opacity",b.fillOpacity)}else a.setAttributeNS(null,"fill","none");if(c.isStroked){a.setAttributeNS(null,"stroke",b.strokeColor);a.setAttributeNS(null,"stroke-opacity",b.strokeOpacity);a.setAttributeNS(null,"stroke-width",b.strokeWidth);a.setAttributeNS(null,"stroke-linecap",b.strokeLinecap)}else a.setAttributeNS(null,
"stroke","none");b.pointerEvents&&a.setAttributeNS(null,"pointer-events",b.pointerEvents);b.cursor&&a.setAttributeNS(null,"cursor",b.cursor)},createNode:function(a,b){a=document.createElementNS(this.xmlns,a);b&&a.setAttributeNS(null,"id",b);return a},nodeTypeCompare:function(a,b){return b==a.nodeName},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_svgRoot","svg")},createRoot:function(){var a=this.nodeFactory(this.container.id+"_root","g");a.setAttributeNS(null,"transform",
"scale(1, -1)");return a},drawPoint:function(a,b){this.drawCircle(a,b,1)},drawCircle:function(a,b,c){var d=this.getResolution(),e=b.x/d+this.left;b=b.y/d-this.top;d=true;if(e<-this.maxPixel||e>this.maxPixel)d=false;if(b<-this.maxPixel||b>this.maxPixel)d=false;if(d){a.setAttributeNS(null,"cx",e);a.setAttributeNS(null,"cy",b);a.setAttributeNS(null,"r",c)}else this.root.removeChild(a)},drawLineString:function(a,b){a.setAttributeNS(null,"points",this.getComponentsString(b.components))},drawLinearRing:function(a,
b){a.setAttributeNS(null,"points",this.getComponentsString(b.components))},drawPolygon:function(a,b){for(var c="",d=true,e=0;e<b.components.length;e++){var f=b.components[e];c+=" M";for(var g=0;g<f.components.length;g++){var h=this.getShortString(f.components[g]);if(h)c+=" "+h;else d=false}}c+=" z";if(d){a.setAttributeNS(null,"d",c);a.setAttributeNS(null,"fill-rule","evenodd")}else a.setAttributeNS(null,"d","")},drawRectangle:function(a,b){var c=b.x/resolution+this.left,d=b.y/resolution-this.top,
e=true;if(c<-this.maxPixel||c>this.maxPixel)e=false;if(d<-this.maxPixel||d>this.maxPixel)e=false;if(e){a.setAttributeNS(null,"x",c);a.setAttributeNS(null,"y",d);a.setAttributeNS(null,"width",b.width);a.setAttributeNS(null,"height",b.height)}else{a.setAttributeNS(null,"x","");a.setAttributeNS(null,"y","");a.setAttributeNS(null,"width",0);a.setAttributeNS(null,"height",0)}},drawCurve:function(a,b){for(var c=null,d=true,e=0;e<b.components.length;e++)if(e%3==0&&e/3==0){var f=this.getShortString(b.components[e]);
f||(d=false);c="M "+f}else if(e%3==1){(f=this.getShortString(b.components[e]))||(d=false);c+=" C "+f}else{(f=this.getShortString(b.components[e]))||(d=false);c+=" "+f}d?a.setAttributeNS(null,"d",c):a.setAttributeNS(null,"d","")},drawSurface:function(a,b){for(var c=null,d=true,e=0;e<b.components.length;e++)if(e%3==0&&e/3==0){var f=this.getShortString(b.components[e]);f||(d=false);c="M "+f}else if(e%3==1){(f=this.getShortString(b.components[e]))||(d=false);c+=" C "+f}else{(f=this.getShortString(b.components[e]))||
(d=false);c+=" "+f}c+=" Z";d?a.setAttributeNS(null,"d",c):a.setAttributeNS(null,"d","")},getComponentsString:function(a){for(var b=[],c=0;c<a.length;c++){var d=this.getShortString(a[c]);d&&b.push(d)}return b.join(",")},getShortString:function(a){var b=this.getResolution(),c=a.x/b+this.left;a=a.y/b-this.top;if(c<-this.maxPixel||c>this.maxPixel)return false;if(a<-this.maxPixel||a>this.maxPixel)return false;return c+","+a},CLASS_NAME:"OpenLayers.Renderer.SVG"});
OpenLayers.Renderer.VML=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"urn:schemas-microsoft-com:vml",initialize:function(){if(this.supported()){try{document.namespaces.add("v","urn:schemas-microsoft-com:vml");document.createStyleSheet().addRule("v\\:*","behavior: url(#default#VML); position: relative; display: inline-block;")}catch(a){}OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments)}},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments)},
supported:function(){return document.namespaces},setExtent:function(a){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var b=this.getResolution();if(EMS.Util.isIE8()){this.extent=a;var c="0 0"}else c=a.left/b+" "+a.top/b;this.root.setAttribute("coordorigin",c);this.root.setAttribute("coordsize",a.getWidth()/b+" "+-a.getHeight()/b)},setSize:function(){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);this.rendererRoot.style.width=this.size.w;this.rendererRoot.style.height=
this.size.h;this.root.style.width="100%";this.root.style.height="100%"},getNodeType:function(a){var b=null;switch(a.CLASS_NAME){case "OpenLayers.Geometry.Point":b="v:oval";break;case "OpenLayers.Geometry.Rectangle":b="v:rect";break;case "OpenLayers.Geometry.LineString":case "OpenLayers.Geometry.LinearRing":case "OpenLayers.Geometry.Polygon":case "OpenLayers.Geometry.Curve":case "OpenLayers.Geometry.Surface":b="v:shape";break;default:break}return b},setStyle:function(a,b,c,d){b=b||a._style;c=c||a._options;
if(a._geometryClass=="OpenLayers.Geometry.Point")if(b.externalGraphic){var e=a.id,f=a._featureId,g=a._geometryClass,h=a._style;this.root.removeChild(a);a=this.createNode("v:rect",e);e=this.createNode("v:fill",e+"_image");a.appendChild(e);a._featureId=f;a._geometryClass=g;a._style=h;this.root.appendChild(a);e.src=b.externalGraphic;e.type="frame";a.style.flip="y";if(!(b.graphicWidth&&b.graphicHeight))e.aspect="atmost";f=b.graphicWidth||b.graphicHeight;g=b.graphicHeight||b.graphicWidth;f=f?f:b.pointRadius*
2;g=g?g:b.pointRadius*2;h=this.getResolution();e=b.graphicYOffset!=undefined?b.graphicYOffset:-(0.5*g);a.style.left=(d.x/h+(b.graphicXOffset!=undefined?b.graphicXOffset:-(0.5*f))).toFixed();a.style.top=(d.y/h-(e+g)).toFixed();a.style.width=f;a.style.height=g;b.fillColor="none";b.strokeColor="none"}else this.drawCircle(a,d,b.pointRadius);a.setAttribute("fillcolor",c.isFilled?b.fillColor:"none");d=a.getElementsByTagName("fill");e=d.length==0?null:d[0];if(c.isFilled){if(!e){e=this.createNode("v:fill",
a.id+"_fill");a.appendChild(e)}if(a._geometryClass=="OpenLayers.Geometry.Point"&&b.externalGraphic&&b.graphicOpacity)e.setAttribute("opacity",b.graphicOpacity);else b.fillOpacity&&e.setAttribute("opacity",b.fillOpacity)}else e&&a.removeChild(e);a.setAttribute("strokecolor",c.isStroked?b.strokeColor:"none");a.setAttribute("strokeweight",b.strokeWidth);d=a.getElementsByTagName("stroke");d=d.length==0?null:d[0];if(c.isStroked){if(!d){d=this.createNode("v:stroke",a.id+"_stroke");a.appendChild(d)}d.setAttribute("opacity",
b.strokeOpacity);d.setAttribute("endcap",!b.strokeLinecap||b.strokeLinecap=="butt"?"flat":b.strokeLinecap)}else d&&a.removeChild(d);if(b.cursor)a.style.cursor=b.cursor},setNodeDimension:function(a,b){if(b=b.getBounds()){var c=this.getResolution();b=new OpenLayers.Bounds((b.left/c).toFixed(),(b.bottom/c).toFixed(),(b.right/c).toFixed(),(b.top/c).toFixed());if(EMS.Util.isIE8()){a.style.left=0;a.style.top=0}else{a.style.left=b.left;a.style.top=b.top}a.style.width=b.getWidth();a.style.height=b.getHeight();
a.coordorigin=EMS.Util.isIE8()?"0 0":b.left+" "+b.top;a.coordsize=b.getWidth()+" "+b.getHeight()}},createNode:function(a,b){a=document.createElement(a);b&&a.setAttribute("id",b);return a},nodeTypeCompare:function(a,b){b=b;var c=b.indexOf(":");if(c!=-1)b=b.substr(c+1);a=a.nodeName;c=a.indexOf(":");if(c!=-1)a=a.substr(c+1);return b==a},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_vmlRoot","div")},createRoot:function(){return this.nodeFactory(this.container.id+"_root","v:group")},
drawPoint:function(a,b){this.drawCircle(a,b,1)},drawCircle:function(a,b,c){if(!isNaN(b.x)&&!isNaN(b.y)){var d=this.getResolution();a.style.left=(b.x/d).toFixed()-c;a.style.top=(b.y/d).toFixed()-c;b=c*2;a.style.width=b;a.style.height=b}},drawLineString:function(a,b){this.drawLine(a,b,false)},drawLinearRing:function(a,b){this.drawLine(a,b,true)},drawLine:function(a,b,c){this.setNodeDimension(a,b);for(var d=this.getResolution(),e="m",f=0;f<b.components.length;f++){if(EMS.Util.isIE8())var g=b.components[f].x/
d-this.extent.left/d,h=b.components[f].y/d-this.extent.top/d;else{g=b.components[f].x/d;h=b.components[f].y/d}e+=" "+g.toFixed()+","+h.toFixed()+" l "}if(c)e+=" x";e+=" e";a.path=e},drawPolygon:function(a,b){this.setNodeDimension(a,b);for(var c=this.getResolution(),d="",e=0;e<b.components.length;e++){var f=b.components[e];d+="m";for(var g=0;g<f.components.length;g++){if(EMS.Util.isIE8())var h=f.components[g].x/c-this.extent.left/c,j=f.components[g].y/c-this.extent.top/c;else{h=f.components[g].x/c;
j=f.components[g].y/c}d+=" "+h.toFixed()+","+j.toFixed();if(g==0)d+=" l"}d+=" x "}d+="e";a.path=d},drawRectangle:function(a,b){var c=this.getResolution();a.style.left=b.x/c;a.style.top=b.y/c;a.style.width=b.width/c;a.style.height=b.height/c},drawCurve:function(a,b){this.setNodeDimension(a,b);for(var c=this.getResolution(),d="",e=0;e<b.components.length;e++){var f=b.components[e].x/c,g=b.components[e].y/c;if(e%3==0&&e/3==0)d+="m";else if(e%3==1)d+=" c";d+=" "+f+","+g}d+=" x e";a.path=d},drawSurface:function(a,
b){this.setNodeDimension(a,b);for(var c=this.getResolution(),d="",e=0;e<b.components.length;e++){var f=b.components[e].x/c,g=b.components[e].y/c;if(e%3==0&&e/3==0)d+="m";else if(e%3==1)d+=" c";d+=" "+f+","+g}d+=" x e";a.path=d},CLASS_NAME:"OpenLayers.Renderer.VML"});
OpenLayers.Layer.Vector=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:false,isFixed:false,isVector:true,features:null,selectedFeatures:null,reportError:true,style:null,renderers:["SVG","VML"],renderer:null,geometryType:null,drawn:false,initialize:function(){this.style=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style["default"]);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()}this.features=[];this.selectedFeatures=[]},destroy:function(){OpenLayers.Layer.prototype.destroy.apply(this,arguments);this.destroyFeatures();this.selectedFeatures=this.features=null;this.renderer&&this.renderer.destroy();this.drawn=this.geometryType=this.renderer=null},assignRenderer:function(){for(var a=0;a<this.renderers.length;a++){var b=OpenLayers.Renderer[this.renderers[a]];if(b&&b.prototype.supported()){this.renderer=new b(this.div);break}}},displayError:function(){if(this.reportError){var a=
"Your browser does not support vector rendering. Currently supported renderers are:\n";a+=this.renderers.join("\n");alert(a)}},setMap:function(){OpenLayers.Layer.prototype.setMap.apply(this,arguments);if(this.renderer){this.renderer.map=this.map;this.renderer.setSize(this.map.getSize())}else this.map.removeLayer(this)},onMapResize:function(){OpenLayers.Layer.prototype.onMapResize.apply(this,arguments);this.renderer.setSize(this.map.getSize())},moveTo:function(a,b,c){OpenLayers.Layer.prototype.moveTo.apply(this,
arguments);if(!c){this.div.style.left=-parseInt(this.map.layerContainerDiv.style.left)+"px";this.div.style.top=-parseInt(this.map.layerContainerDiv.style.top)+"px";this.renderer.setExtent(this.map.getExtent())}if(!this.drawn||b||EMS.Util.isIE8()){this.drawn=true;for(var d=0;d<this.features.length;d++)this.drawFeature(this.features[d])}},addFeatures:function(a){a instanceof Array||(a=[a]);for(var b=0;b<a.length;b++){var c=a[b];if(this.geometryType&&!(c.geometry instanceof this.geometryType))throw"addFeatures : component should be an "+
this.geometryType.prototype.CLASS_NAME;this.features.push(c);c.layer=this;if(!c.style)c.style=OpenLayers.Util.extend({},this.style);this.preFeatureInsert(c);this.drawn&&this.drawFeature(c);this.onFeatureInsert(c)}},removeFeatures:function(a){a instanceof Array||(a=[a]);for(var b=a.length-1;b>=0;b--){var c=a[b];this.features=OpenLayers.Util.removeItem(this.features,c);c.geometry&&this.renderer.eraseGeometry(c.geometry);OpenLayers.Util.indexOf(this.selectedFeatures,c)!=-1&&OpenLayers.Util.removeItem(this.selectedFeatures,
c)}},destroyFeatures:function(){this.selectedFeatures=[];for(var a=this.features.length-1;a>=0;a--)this.features[a].destroy()},drawFeature:function(a,b){if(b==null)b=a.style?a.style:this.style;this.renderer.drawFeature(a,b)},eraseFeatures:function(a){this.renderer.eraseFeatures(a)},getFeatureFromEvent:function(a){if(!this.renderer){OpenLayers.Console.error("getFeatureFromEvent called on layer with no renderer. This usually means you destroyed a layer, but not some handler which is associated with it.");
return null}return this.getFeatureById(this.renderer.getFeatureIdFromEvent(a))},getFeatureById:function(a){for(var b=null,c=0;c<this.features.length;++c)if(this.features[c].id==a){b=this.features[c];break}return b},onFeatureInsert:function(){},preFeatureInsert:function(){},CLASS_NAME:"OpenLayers.Layer.Vector"});
OpenLayers.Layer.GML=OpenLayers.Class(OpenLayers.Layer.Vector,{loaded:false,format:null,initialize:function(a,b,c){var d=[];d.push(a,c);OpenLayers.Layer.Vector.prototype.initialize.apply(this,d);this.url=b},setVisibility:function(){OpenLayers.Layer.Vector.prototype.setVisibility.apply(this,arguments);this.visibility&&!this.loaded&&this.loadGML()},moveTo:function(){OpenLayers.Layer.Vector.prototype.moveTo.apply(this,arguments);if(this.visibility&&!this.loaded){this.events.triggerEvent("loadstart");
this.loadGML()}},loadGML:function(){if(!this.loaded){OpenLayers.loadURL(this.url,null,this,this.requestSuccess,this.requestFailure);this.loaded=true}},requestSuccess:function(a){var b=a.responseXML;if(!b||a.fileType!="XML")b=a.responseText;this.addFeatures((this.format?new this.format:new OpenLayers.Format.GML).read(b));this.events.triggerEvent("loadend")},requestFailure:function(){alert("Error in loading GML file "+this.url);this.events.triggerEvent("loadend")},CLASS_NAME:"OpenLayers.Layer.GML"});
OpenLayers.Layer.WFS=OpenLayers.Class(OpenLayers.Layer.Vector,OpenLayers.Layer.Markers,{isBaseLayer:false,tile:null,ratio:2,DEFAULT_PARAMS:{service:"WFS",version:"1.0.0",request:"GetFeature"},featureClass:null,vectorMode:true,encodeBBOX:false,extractAttributes:false,initialize:function(a,b,c,d){if(d==undefined)d={};if(d.featureClass||!OpenLayers.Layer.Vector||!OpenLayers.Feature.Vector)this.vectorMode=false;OpenLayers.Util.extend(d,{reportError:false});var e=[];e.push(a,d);OpenLayers.Layer.Vector.prototype.initialize.apply(this,
e);if(!this.renderer||!this.vectorMode){this.vectorMode=false;if(!d.featureClass)d.featureClass=OpenLayers.Feature.WFS;OpenLayers.Layer.Markers.prototype.initialize.apply(this,e)}if(this.params&&this.params.typename&&!this.options.typename)this.options.typename=this.params.typename;if(!this.options.geometry_column)this.options.geometry_column="the_geom";this.params=c;OpenLayers.Util.applyDefaults(this.params,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS));this.url=b},destroy:function(){this.vectorMode?
OpenLayers.Layer.Vector.prototype.destroy.apply(this,arguments):OpenLayers.Layer.Markers.prototype.destroy.apply(this,arguments)},setMap:function(){this.vectorMode?OpenLayers.Layer.Vector.prototype.setMap.apply(this,arguments):OpenLayers.Layer.Markers.prototype.setMap.apply(this,arguments)},moveTo:function(a,b,c){this.vectorMode?OpenLayers.Layer.Vector.prototype.moveTo.apply(this,arguments):OpenLayers.Layer.Markers.prototype.moveTo.apply(this,arguments);if(c)return false;b&&this.vectorMode&&this.renderer.clear();
if(this.options.minZoomLevel){OpenLayers.Console.warn("The minZoomLevel property is only intended for use with the FixedZoomLevels-descendent layers. That this wfs layer checks for minZoomLevel is a relic of thepast. 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");
if(this.map.getZoom()<this.options.minZoomLevel)return null}if(a==null)a=this.map.getExtent();var d=this.tile==null,e=!d&&!this.tile.bounds.containsBounds(a);if((b||d||!c&&e)&&this.inRange){d=a.getCenterLonLat();e=a.getWidth()*this.ratio;var f=a.getHeight()*this.ratio;d=new OpenLayers.Bounds(d.lon-e/2,d.lat-f/2,d.lon+e/2,d.lat+f/2);e=this.map.getSize();e.w*=this.ratio;e.h*=this.ratio;f=this.map.getLayerPxFromLonLat(new OpenLayers.LonLat(d.left,d.top));var g=this.getFullRequestString(),h={BBOX:this.encodeBBOX?
d.toBBOX():d.toArray()};g+="&"+OpenLayers.Util.getParameterString(h);if(this.tile){if(this.vectorMode){this.destroyFeatures();this.renderer.clear()}else this.clearMarkers();this.removeTileMonitoringHooks(this.tile);this.tile.destroy();this.tile=null}this.tile=new OpenLayers.Tile.WFS(this,f,d,g,e);this.addTileMonitoringHooks(this.tile);this.tile.draw()}},addTileMonitoringHooks:function(a){a.onLoadStart=function(){this==this.layer.tile&&this.layer.events.triggerEvent("loadstart")};a.events.register("loadstart",
a,a.onLoadStart);a.onLoadEnd=function(){if(this==this.layer.tile){this.layer.events.triggerEvent("tileloaded");this.layer.events.triggerEvent("loadend")}};a.events.register("loadend",a,a.onLoadEnd)},removeTileMonitoringHooks:function(a){a.events.unregister("loadstart",a,a.onLoadStart);a.events.unregister("loadend",a,a.onLoadEnd)},onMapResize:function(){this.vectorMode?OpenLayers.Layer.Vector.prototype.onMapResize.apply(this,arguments):OpenLayers.Layer.Markers.prototype.onMapResize.apply(this,arguments)},
mergeNewParams:function(a){a=[OpenLayers.Util.upperCaseObject(a)];OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this,a)},clone:function(a){if(a==null)a=new OpenLayers.Layer.WFS(this.name,this.url,this.params,this.options);return a=this.vectorMode?OpenLayers.Layer.Vector.prototype.clone.apply(this,[a]):OpenLayers.Layer.Markers.prototype.clone.apply(this,[a])},getFullRequestString:function(){var a=this.map.getProjection();this.params.SRS=a=="none"?null:a;return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,
arguments)},commit:function(){if(!this.writer)this.writer=new OpenLayers.Format.WFS({},this);var a=this.writer.write(this.features),b=this.url;if(OpenLayers.ProxyHost&&OpenLayers.String.startsWith(this.url,"http"))b=OpenLayers.ProxyHost+escape(this.url);var c=OpenLayers.Function.bind(this.commitSuccess,this),d=OpenLayers.Function.bind(this.commitFailure,this);a=OpenLayers.Ajax.serializeXMLToString(a);new OpenLayers.Ajax.Request(b,{method:"post",postBody:a,onComplete:c,onFailure:d})},commitSuccess:function(a){a=
a.responseText;if(a.indexOf("SUCCESS")!=-1){this.commitReport("WFS Transaction: SUCCESS",a);for(a=0;a<this.features.length;a++)this.features[a].state=null}else if(a.indexOf("FAILED")!=-1||a.indexOf("Exception")!=-1)this.commitReport("WFS Transaction: FAILED",a)},commitFailure:function(){},commitReport:function(a){alert(a)},refresh:function(){if(this.tile){if(this.vectorMode){this.renderer.clear();this.features.length=0}else{this.clearMarkers();this.markers.length=0}this.tile.draw()}},CLASS_NAME:"OpenLayers.Layer.WFS"});
OpenLayers.Control.MouseToolbar=OpenLayers.Class(OpenLayers.Control.MouseDefaults,{mode:null,buttons:null,direction:"vertical",buttonClicked:null,initialize:function(a,b){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.position=new OpenLayers.Pixel(OpenLayers.Control.MouseToolbar.X,OpenLayers.Control.MouseToolbar.Y);if(a)this.position=a;if(b)this.direction=b;this.measureDivs=[]},destroy:function(){for(var a in this.buttons){var b=this.buttons[a];b.map=null;b.events.destroy()}OpenLayers.Control.MouseDefaults.prototype.destroy.apply(this,
arguments)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);OpenLayers.Control.MouseDefaults.prototype.draw.apply(this,arguments);this.buttons={};var a=new OpenLayers.Size(28,28),b=new OpenLayers.Pixel(OpenLayers.Control.MouseToolbar.X,0);this._addButton("zoombox","drag-rectangle-off.png","drag-rectangle-on.png",b,a,"Shift->Drag to zoom to area");b=b.add(this.direction=="vertical"?0:a.w,this.direction=="vertical"?a.h:0);this._addButton("pan","panning-hand-off.png","panning-hand-on.png",
b,a,"Drag the map to pan.");b.add(this.direction=="vertical"?0:a.w,this.direction=="vertical"?a.h:0);this.switchModeTo("pan");return this.div},_addButton:function(a,b,c,d,e,f){b=OpenLayers.Util.getImagesLocation()+b;c=OpenLayers.Util.getImagesLocation()+c;d=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_MouseToolbar_"+a,d,e,b,"absolute");this.div.appendChild(d);d.imgLocation=b;d.activeImgLocation=c;d.events=new OpenLayers.Events(this,d,null,true);d.events.register("mousedown",this,this.buttonDown);
d.events.register("mouseup",this,this.buttonUp);d.events.register("dblclick",this,OpenLayers.Event.stop);d.action=a;d.title=f;d.alt=f;d.map=this.map;return this.buttons[a]=d},buttonDown:function(a){if(OpenLayers.Event.isLeftClick(a)){this.buttonClicked=a.element.action;OpenLayers.Event.stop(a)}},buttonUp:function(a){if(OpenLayers.Event.isLeftClick(a))if(this.buttonClicked!=null){this.buttonClicked==a.element.action&&this.switchModeTo(a.element.action);OpenLayers.Event.stop(a);this.buttonClicked=null}},
defaultDblClick:function(a){this.switchModeTo("pan");this.performedDrag=false;this.map.setCenter(this.map.getLonLatFromViewPortPx(a.xy),this.map.zoom+1);OpenLayers.Event.stop(a);return false},defaultMouseDown:function(a){if(OpenLayers.Event.isLeftClick(a)){this.mouseDragStart=a.xy.clone();this.startViaKeyboard=this.performedDrag=false;if(a.shiftKey&&this.mode!="zoombox"){this.switchModeTo("zoombox");this.startViaKeyboard=true}else if(a.altKey&&this.mode!="measure")this.switchModeTo("measure");else this.mode||
this.switchModeTo("pan");switch(this.mode){case "zoombox":this.map.div.style.cursor="crosshair";this.zoomBox=OpenLayers.Util.createDiv("zoomBox",this.mouseDragStart,null,null,"absolute","2px solid red");this.zoomBox.style.backgroundColor="white";this.zoomBox.style.filter="alpha(opacity=50)";this.zoomBox.style.opacity="0.50";this.zoomBox.style.fontSize="1px";this.zoomBox.style.zIndex=this.map.Z_INDEX_BASE.Popup-1;this.map.viewPortDiv.appendChild(this.zoomBox);this.performedDrag=true;break;case "measure":var b=
"";if(this.measureStart){measureEnd=this.map.getLonLatFromViewPortPx(this.mouseDragStart);b=OpenLayers.Util.distVincenty(this.measureStart,measureEnd);b=Math.round(b*100)/100;b+="km";this.measureStartBox=this.measureBox}this.measureStart=this.map.getLonLatFromViewPortPx(this.mouseDragStart);this.measureBox=OpenLayers.Util.createDiv(null,this.mouseDragStart.add(-2-parseInt(this.map.layerContainerDiv.style.left),-2-parseInt(this.map.layerContainerDiv.style.top)),null,null,"absolute");this.measureBox.style.width=
"4px";this.measureBox.style.height="4px";this.measureBox.style.fontSize="1px";this.measureBox.style.backgroundColor="red";this.measureBox.style.zIndex=this.map.Z_INDEX_BASE.Popup-1;this.map.layerContainerDiv.appendChild(this.measureBox);if(b){this.measureBoxDistance=OpenLayers.Util.createDiv(null,this.mouseDragStart.add(-2-parseInt(this.map.layerContainerDiv.style.left),2-parseInt(this.map.layerContainerDiv.style.top)),null,null,"absolute");this.measureBoxDistance.innerHTML=b;this.measureBoxDistance.style.zIndex=
this.map.Z_INDEX_BASE.Popup-1;this.map.layerContainerDiv.appendChild(this.measureBoxDistance);this.measureDivs.push(this.measureBoxDistance)}this.measureBox.style.zIndex=this.map.Z_INDEX_BASE.Popup-1;this.map.layerContainerDiv.appendChild(this.measureBox);this.measureDivs.push(this.measureBox);break;default:this.map.div.style.cursor="move";break}document.onselectstart=function(){return false};OpenLayers.Event.stop(a)}},switchModeTo:function(a){if(a!=this.mode){this.mode&&this.buttons[this.mode]&&
OpenLayers.Util.modifyAlphaImageDiv(this.buttons[this.mode],null,null,null,this.buttons[this.mode].imgLocation);if(this.mode=="measure"&&a!="measure"){for(var b=0;b<this.measureDivs.length;b++)this.measureDivs[b]&&this.map.layerContainerDiv.removeChild(this.measureDivs[b]);this.measureDivs=[];this.measureStart=null}this.mode=a;this.buttons[a]&&OpenLayers.Util.modifyAlphaImageDiv(this.buttons[a],null,null,null,this.buttons[a].activeImgLocation);switch(this.mode){case "zoombox":this.map.div.style.cursor=
"crosshair";break;default:this.map.div.style.cursor="";break}}},leaveMode:function(){this.switchModeTo("pan")},defaultMouseMove:function(a){if(this.mouseDragStart!=null){switch(this.mode){case "zoombox":var b=Math.abs(this.mouseDragStart.x-a.xy.x),c=Math.abs(this.mouseDragStart.y-a.xy.y);this.zoomBox.style.width=Math.max(1,b)+"px";this.zoomBox.style.height=Math.max(1,c)+"px";if(a.xy.x<this.mouseDragStart.x)this.zoomBox.style.left=a.xy.x+"px";if(a.xy.y<this.mouseDragStart.y)this.zoomBox.style.top=
a.xy.y+"px";break;default:b=this.mouseDragStart.x-a.xy.x;c=this.mouseDragStart.y-a.xy.y;var d=this.map.getSize();this.map.setCenter(this.map.getLonLatFromViewPortPx(new OpenLayers.Pixel(d.w/2+b,d.h/2+c)),null,true);this.mouseDragStart=a.xy.clone()}this.performedDrag=true}},defaultMouseUp:function(a){if(OpenLayers.Event.isLeftClick(a)){switch(this.mode){case "zoombox":this.zoomBoxEnd(a);this.startViaKeyboard&&this.leaveMode();break;case "pan":this.performedDrag&&this.map.setCenter(this.map.center)}this.mouseDragStart=
document.onselectstart=null;this.map.div.style.cursor="default"}},defaultMouseOut:function(a){if(this.mouseDragStart!=null&&OpenLayers.Util.mouseLeft(a,this.map.div)){if(this.zoomBox){this.removeZoomBox();this.startViaKeyboard&&this.leaveMode()}this.mouseDragStart=null;this.map.div.style.cursor="default"}},defaultClick:function(){if(this.performedDrag)return this.performedDrag=false}});OpenLayers.Control.MouseToolbar.X=6;OpenLayers.Control.MouseToolbar.Y=300;
OpenLayers.Control.NavToolbar=OpenLayers.Class(OpenLayers.Control.Panel,{initialize:function(a){OpenLayers.Control.Panel.prototype.initialize.apply(this,[a]);this.addControls([new OpenLayers.Control.Navigation,new OpenLayers.Control.ZoomBox])},draw:function(){var a=OpenLayers.Control.Panel.prototype.draw.apply(this,arguments);this.activateControl(this.controls[0]);return a},CLASS_NAME:"OpenLayers.Control.NavToolbar"});

