This file is indexed.

/usr/share/javascript/openlayers/OpenLayers.mobile.min.js is in libjs-openlayers 2.13.1+ds2-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
var OpenLayers={VERSION_NUMBER:"Release 2.13.1",singleFile:true,_getScriptLocation:function(){var r=new RegExp("(^|(.*?\\/))(OpenLayers[^\\/]*?\\.js)(\\?|$)"),s=document.getElementsByTagName("script"),src,m,l="";for(var i=0,len=s.length;i<len;i++){src=s[i].getAttribute("src");if(src){m=src.match(r);if(m){l=m[1];break}}}return function(){return l}}(),ImgPath:""};OpenLayers.String={startsWith:function(str,sub){return str.indexOf(sub)==0},contains:function(str,sub){return str.indexOf(sub)!=-1},trim:function(str){return str.replace(/^\s\s*/,"").replace(/\s\s*$/,"")},camelize:function(str){var oStringList=str.split("-");var camelizedString=oStringList[0];for(var i=1,len=oStringList.length;i<len;i++){var s=oStringList[i];camelizedString+=s.charAt(0).toUpperCase()+s.substring(1)}return camelizedString},format:function(template,context,args){if(!context){context=window}var replacer=function(str,match){var replacement;var subs=match.split(/\.+/);for(var i=0;i<subs.length;i++){if(i==0){replacement=context}if(replacement===undefined){break}replacement=replacement[subs[i]]}if(typeof replacement=="function"){replacement=args?replacement.apply(null,args):replacement()}if(typeof replacement=="undefined"){return"undefined"}else{return replacement}};return template.replace(OpenLayers.String.tokenRegEx,replacer)},tokenRegEx:/\$\{([\w.]+?)\}/g,numberRegEx:/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,isNumeric:function(value){return OpenLayers.String.numberRegEx.test(value)},numericIf:function(value,trimWhitespace){var originalValue=value;if(trimWhitespace===true&&value!=null&&value.replace){value=value.replace(/^\s*|\s*$/g,"")}return OpenLayers.String.isNumeric(value)?parseFloat(value):originalValue}};OpenLayers.Number={decimalSeparator:".",thousandsSeparator:",",limitSigDigs:function(num,sig){var fig=0;if(sig>0){fig=parseFloat(num.toPrecision(sig))}return fig},format:function(num,dec,tsep,dsep){dec=typeof dec!="undefined"?dec:0;tsep=typeof tsep!="undefined"?tsep:OpenLayers.Number.thousandsSeparator;dsep=typeof dsep!="undefined"?dsep:OpenLayers.Number.decimalSeparator;if(dec!=null){num=parseFloat(num.toFixed(dec))}var parts=num.toString().split(".");if(parts.length==1&&dec==null){dec=0}var integer=parts[0];if(tsep){var thousands=/(-?[0-9]+)([0-9]{3})/;while(thousands.test(integer)){integer=integer.replace(thousands,"$1"+tsep+"$2")}}var str;if(dec==0){str=integer}else{var rem=parts.length>1?parts[1]:"0";if(dec!=null){rem=rem+new Array(dec-rem.length+1).join("0")}str=integer+dsep+rem}return str},zeroPad:function(num,len,radix){var str=num.toString(radix||10);while(str.length<len){str="0"+str}return str}};OpenLayers.Function={bind:function(func,object){var args=Array.prototype.slice.apply(arguments,[2]);return function(){var newArgs=args.concat(Array.prototype.slice.apply(arguments,[0]));return func.apply(object,newArgs)}},bindAsEventListener:function(func,object){return function(event){return func.call(object,event||window.event)}},False:function(){return false},True:function(){return true},Void:function(){}};OpenLayers.Array={filter:function(array,callback,caller){var selected=[];if(Array.prototype.filter){selected=array.filter(callback,caller)}else{var len=array.length;if(typeof callback!="function"){throw new TypeError}for(var i=0;i<len;i++){if(i in array){var val=array[i];if(callback.call(caller,val,i,array)){selected.push(val)}}}}return selected}};OpenLayers.Class=function(){var len=arguments.length;var P=arguments[0];var F=arguments[len-1];var C=typeof F.initialize=="function"?F.initialize:function(){P.prototype.initialize.apply(this,arguments)};if(len>1){var newArgs=[C,P].concat(Array.prototype.slice.call(arguments).slice(1,len-1),F);OpenLayers.inherit.apply(null,newArgs)}else{C.prototype=F}return C};OpenLayers.inherit=function(C,P){var F=function(){};F.prototype=P.prototype;C.prototype=new F;var i,l,o;for(i=2,l=arguments.length;i<l;i++){o=arguments[i];if(typeof o==="function"){o=o.prototype}OpenLayers.Util.extend(C.prototype,o)}};OpenLayers.Util=OpenLayers.Util||{};OpenLayers.Util.extend=function(destination,source){destination=destination||{};if(source){for(var property in source){var value=source[property];if(value!==undefined){destination[property]=value}}var sourceIsEvt=typeof window.Event=="function"&&source instanceof window.Event;if(!sourceIsEvt&&source.hasOwnProperty&&source.hasOwnProperty("toString")){destination.toString=source.toString}}return destination};OpenLayers.Bounds=OpenLayers.Class({left:null,bottom:null,right:null,top:null,centerLonLat:null,initialize:function(left,bottom,right,top){if(OpenLayers.Util.isArray(left)){top=left[3];right=left[2];bottom=left[1];left=left[0]}if(left!=null){this.left=OpenLayers.Util.toFloat(left)}if(bottom!=null){this.bottom=OpenLayers.Util.toFloat(bottom)}if(right!=null){this.right=OpenLayers.Util.toFloat(right)}if(top!=null){this.top=OpenLayers.Util.toFloat(top)}},clone:function(){return new OpenLayers.Bounds(this.left,this.bottom,this.right,this.top)},equals:function(bounds){var equals=false;if(bounds!=null){equals=this.left==bounds.left&&this.right==bounds.right&&this.top==bounds.top&&this.bottom==bounds.bottom}return equals},toString:function(){return[this.left,this.bottom,this.right,this.top].join(",")},toArray:function(reverseAxisOrder){if(reverseAxisOrder===true){return[this.bottom,this.left,this.top,this.right]}else{return[this.left,this.bottom,this.right,this.top]}},toBBOX:function(decimal,reverseAxisOrder){if(decimal==null){decimal=6}var mult=Math.pow(10,decimal);var xmin=Math.round(this.left*mult)/mult;var ymin=Math.round(this.bottom*mult)/mult;var xmax=Math.round(this.right*mult)/mult;var ymax=Math.round(this.top*mult)/mult;if(reverseAxisOrder===true){return ymin+","+xmin+","+ymax+","+xmax}else{return xmin+","+ymin+","+xmax+","+ymax}},toGeometry:function(){return new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(this.left,this.bottom),new OpenLayers.Geometry.Point(this.right,this.bottom),new OpenLayers.Geometry.Point(this.right,this.top),new OpenLayers.Geometry.Point(this.left,this.top)])])},getWidth:function(){return this.right-this.left},getHeight:function(){return this.top-this.bottom},getSize:function(){return new OpenLayers.Size(this.getWidth(),this.getHeight())},getCenterPixel:function(){return new OpenLayers.Pixel((this.left+this.right)/2,(this.bottom+this.top)/2)},getCenterLonLat:function(){if(!this.centerLonLat){this.centerLonLat=new OpenLayers.LonLat((this.left+this.right)/2,(this.bottom+this.top)/2)}return this.centerLonLat},scale:function(ratio,origin){if(origin==null){origin=this.getCenterLonLat()}var origx,origy;if(origin.CLASS_NAME=="OpenLayers.LonLat"){origx=origin.lon;origy=origin.lat}else{origx=origin.x;origy=origin.y}var left=(this.left-origx)*ratio+origx;var bottom=(this.bottom-origy)*ratio+origy;var right=(this.right-origx)*ratio+origx;var top=(this.top-origy)*ratio+origy;return new OpenLayers.Bounds(left,bottom,right,top)},add:function(x,y){if(x==null||y==null){throw new TypeError("Bounds.add cannot receive null values")}return new OpenLayers.Bounds(this.left+x,this.bottom+y,this.right+x,this.top+y)},extend:function(object){if(object){switch(object.CLASS_NAME){case"OpenLayers.LonLat":this.extendXY(object.lon,object.lat);break;case"OpenLayers.Geometry.Point":this.extendXY(object.x,object.y);break;case"OpenLayers.Bounds":this.centerLonLat=null;if(this.left==null||object.left<this.left){this.left=object.left}if(this.bottom==null||object.bottom<this.bottom){this.bottom=object.bottom}if(this.right==null||object.right>this.right){this.right=object.right}if(this.top==null||object.top>this.top){this.top=object.top}break}}},extendXY:function(x,y){this.centerLonLat=null;if(this.left==null||x<this.left){this.left=x}if(this.bottom==null||y<this.bottom){this.bottom=y}if(this.right==null||x>this.right){this.right=x}if(this.top==null||y>this.top){this.top=y}},containsLonLat:function(ll,options){if(typeof options==="boolean"){options={inclusive:options}}options=options||{};var contains=this.contains(ll.lon,ll.lat,options.inclusive),worldBounds=options.worldBounds;if(worldBounds&&!contains){var worldWidth=worldBounds.getWidth();var worldCenterX=(worldBounds.left+worldBounds.right)/2;var worldsAway=Math.round((ll.lon-worldCenterX)/worldWidth);contains=this.containsLonLat({lon:ll.lon-worldsAway*worldWidth,lat:ll.lat},{inclusive:options.inclusive})}return contains},containsPixel:function(px,inclusive){return this.contains(px.x,px.y,inclusive)},contains:function(x,y,inclusive){if(inclusive==null){inclusive=true}if(x==null||y==null){return false}x=OpenLayers.Util.toFloat(x);y=OpenLayers.Util.toFloat(y);var contains=false;if(inclusive){contains=x>=this.left&&x<=this.right&&y>=this.bottom&&y<=this.top}else{contains=x>this.left&&x<this.right&&y>this.bottom&&y<this.top}return contains},intersectsBounds:function(bounds,options){if(typeof options==="boolean"){options={inclusive:options}}options=options||{};if(options.worldBounds){var self=this.wrapDateLine(options.worldBounds);bounds=bounds.wrapDateLine(options.worldBounds)}else{self=this}if(options.inclusive==null){options.inclusive=true}var intersects=false;var mightTouch=self.left==bounds.right||self.right==bounds.left||self.top==bounds.bottom||self.bottom==bounds.top;if(options.inclusive||!mightTouch){var inBottom=bounds.bottom>=self.bottom&&bounds.bottom<=self.top||self.bottom>=bounds.bottom&&self.bottom<=bounds.top;var inTop=bounds.top>=self.bottom&&bounds.top<=self.top||self.top>bounds.bottom&&self.top<bounds.top;var inLeft=bounds.left>=self.left&&bounds.left<=self.right||self.left>=bounds.left&&self.left<=bounds.right;var inRight=bounds.right>=self.left&&bounds.right<=self.right||self.right>=bounds.left&&self.right<=bounds.right;intersects=(inBottom||inTop)&&(inLeft||inRight)}if(options.worldBounds&&!intersects){var world=options.worldBounds;var width=world.getWidth();var selfCrosses=!world.containsBounds(self);var boundsCrosses=!world.containsBounds(bounds);if(selfCrosses&&!boundsCrosses){bounds=bounds.add(-width,0);intersects=self.intersectsBounds(bounds,{inclusive:options.inclusive})}else if(boundsCrosses&&!selfCrosses){self=self.add(-width,0);intersects=bounds.intersectsBounds(self,{inclusive:options.inclusive})}}return intersects},containsBounds:function(bounds,partial,inclusive){if(partial==null){partial=false}if(inclusive==null){inclusive=true}var bottomLeft=this.contains(bounds.left,bounds.bottom,inclusive);var bottomRight=this.contains(bounds.right,bounds.bottom,inclusive);var topLeft=this.contains(bounds.left,bounds.top,inclusive);var topRight=this.contains(bounds.right,bounds.top,inclusive);return partial?bottomLeft||bottomRight||topLeft||topRight:bottomLeft&&bottomRight&&topLeft&&topRight},determineQuadrant:function(lonlat){var quadrant="";var center=this.getCenterLonLat();quadrant+=lonlat.lat<center.lat?"b":"t";quadrant+=lonlat.lon<center.lon?"l":"r";return quadrant},transform:function(source,dest){this.centerLonLat=null;var ll=OpenLayers.Projection.transform({x:this.left,y:this.bottom},source,dest);var lr=OpenLayers.Projection.transform({x:this.right,y:this.bottom},source,dest);var ul=OpenLayers.Projection.transform({x:this.left,y:this.top},source,dest);var ur=OpenLayers.Projection.transform({x:this.right,y:this.top},source,dest);this.left=Math.min(ll.x,ul.x);this.bottom=Math.min(ll.y,lr.y);this.right=Math.max(lr.x,ur.x);this.top=Math.max(ul.y,ur.y);return this},wrapDateLine:function(maxExtent,options){options=options||{};var leftTolerance=options.leftTolerance||0;var rightTolerance=options.rightTolerance||0;var newBounds=this.clone();if(maxExtent){var width=maxExtent.getWidth();while(newBounds.left<maxExtent.left&&newBounds.right-rightTolerance<=maxExtent.left){newBounds=newBounds.add(width,0)}while(newBounds.left+leftTolerance>=maxExtent.right&&newBounds.right>maxExtent.right){newBounds=newBounds.add(-width,0)}var newLeft=newBounds.left+leftTolerance;if(newLeft<maxExtent.right&&newLeft>maxExtent.left&&newBounds.right-rightTolerance>maxExtent.right){newBounds=newBounds.add(-width,0)}}return newBounds},CLASS_NAME:"OpenLayers.Bounds"});OpenLayers.Bounds.fromString=function(str,reverseAxisOrder){var bounds=str.split(",");return OpenLayers.Bounds.fromArray(bounds,reverseAxisOrder)};OpenLayers.Bounds.fromArray=function(bbox,reverseAxisOrder){return reverseAxisOrder===true?new OpenLayers.Bounds(bbox[1],bbox[0],bbox[3],bbox[2]):new OpenLayers.Bounds(bbox[0],bbox[1],bbox[2],bbox[3])};OpenLayers.Bounds.fromSize=function(size){return new OpenLayers.Bounds(0,size.h,size.w,0)};OpenLayers.Bounds.oppositeQuadrant=function(quadrant){var opp="";opp+=quadrant.charAt(0)=="t"?"b":"t";opp+=quadrant.charAt(1)=="l"?"r":"l";return opp};OpenLayers.Element={visible:function(element){return OpenLayers.Util.getElement(element).style.display!="none"},toggle:function(){for(var i=0,len=arguments.length;i<len;i++){var element=OpenLayers.Util.getElement(arguments[i]);var display=OpenLayers.Element.visible(element)?"none":"";element.style.display=display}},remove:function(element){element=OpenLayers.Util.getElement(element);element.parentNode.removeChild(element)},getHeight:function(element){element=OpenLayers.Util.getElement(element);return element.offsetHeight},hasClass:function(element,name){var names=element.className;return!!names&&new RegExp("(^|\\s)"+name+"(\\s|$)").test(names)},addClass:function(element,name){if(!OpenLayers.Element.hasClass(element,name)){element.className+=(element.className?" ":"")+name}return element},removeClass:function(element,name){var names=element.className;if(names){element.className=OpenLayers.String.trim(names.replace(new RegExp("(^|\\s+)"+name+"(\\s+|$)")," "))}return element},toggleClass:function(element,name){if(OpenLayers.Element.hasClass(element,name)){OpenLayers.Element.removeClass(element,name)}else{OpenLayers.Element.addClass(element,name)}return element},getStyle:function(element,style){element=OpenLayers.Util.getElement(element);var value=null;if(element&&element.style){value=element.style[OpenLayers.String.camelize(style)];if(!value){if(document.defaultView&&document.defaultView.getComputedStyle){var css=document.defaultView.getComputedStyle(element,null);value=css?css.getPropertyValue(style):null}else if(element.currentStyle){value=element.currentStyle[OpenLayers.String.camelize(style)]}}var positions=["left","top","right","bottom"];if(window.opera&&OpenLayers.Util.indexOf(positions,style)!=-1&&OpenLayers.Element.getStyle(element,"position")=="static"){value="auto"}}return value=="auto"?null:value}};OpenLayers.LonLat=OpenLayers.Class({lon:0,lat:0,initialize:function(lon,lat){if(OpenLayers.Util.isArray(lon)){lat=lon[1];lon=lon[0]}this.lon=OpenLayers.Util.toFloat(lon);this.lat=OpenLayers.Util.toFloat(lat)},toString:function(){return"lon="+this.lon+",lat="+this.lat},toShortString:function(){return this.lon+", "+this.lat},clone:function(){return new OpenLayers.LonLat(this.lon,this.lat)},add:function(lon,lat){if(lon==null||lat==null){throw new TypeError("LonLat.add cannot receive null values")}return new OpenLayers.LonLat(this.lon+OpenLayers.Util.toFloat(lon),this.lat+OpenLayers.Util.toFloat(lat))},equals:function(ll){var equals=false;if(ll!=null){equals=this.lon==ll.lon&&this.lat==ll.lat||isNaN(this.lon)&&isNaN(this.lat)&&isNaN(ll.lon)&&isNaN(ll.lat)}return equals},transform:function(source,dest){var point=OpenLayers.Projection.transform({x:this.lon,y:this.lat},source,dest);this.lon=point.x;this.lat=point.y;return this},wrapDateLine:function(maxExtent){var newLonLat=this.clone();if(maxExtent){while(newLonLat.lon<maxExtent.left){newLonLat.lon+=maxExtent.getWidth()}while(newLonLat.lon>maxExtent.right){newLonLat.lon-=maxExtent.getWidth()}}return newLonLat},CLASS_NAME:"OpenLayers.LonLat"});OpenLayers.LonLat.fromString=function(str){var pair=str.split(",");return new OpenLayers.LonLat(pair[0],pair[1])};OpenLayers.LonLat.fromArray=function(arr){var gotArr=OpenLayers.Util.isArray(arr),lon=gotArr&&arr[0],lat=gotArr&&arr[1];return new OpenLayers.LonLat(lon,lat)};OpenLayers.Pixel=OpenLayers.Class({x:0,y:0,initialize:function(x,y){this.x=parseFloat(x);this.y=parseFloat(y)},toString:function(){return"x="+this.x+",y="+this.y},clone:function(){return new OpenLayers.Pixel(this.x,this.y)},equals:function(px){var equals=false;if(px!=null){equals=this.x==px.x&&this.y==px.y||isNaN(this.x)&&isNaN(this.y)&&isNaN(px.x)&&isNaN(px.y)}return equals},distanceTo:function(px){return Math.sqrt(Math.pow(this.x-px.x,2)+Math.pow(this.y-px.y,2))},add:function(x,y){if(x==null||y==null){throw new TypeError("Pixel.add cannot receive null values")}return new OpenLayers.Pixel(this.x+x,this.y+y)},offset:function(px){var newPx=this.clone();if(px){newPx=this.add(px.x,px.y)}return newPx},CLASS_NAME:"OpenLayers.Pixel"});OpenLayers.Size=OpenLayers.Class({w:0,h:0,initialize:function(w,h){this.w=parseFloat(w);this.h=parseFloat(h)},toString:function(){return"w="+this.w+",h="+this.h},clone:function(){return new OpenLayers.Size(this.w,this.h)},equals:function(sz){var equals=false;if(sz!=null){equals=this.w==sz.w&&this.h==sz.h||isNaN(this.w)&&isNaN(this.h)&&isNaN(sz.w)&&isNaN(sz.h)}return equals},CLASS_NAME:"OpenLayers.Size"});OpenLayers.Console={log:function(){},debug:function(){},info:function(){},warn:function(){},error:function(){},userError:function(error){alert(error)},assert:function(){},dir:function(){},dirxml:function(){},trace:function(){},group:function(){},groupEnd:function(){},time:function(){},timeEnd:function(){},profile:function(){},profileEnd:function(){},count:function(){},CLASS_NAME:"OpenLayers.Console"};(function(){var scripts=document.getElementsByTagName("script");for(var i=0,len=scripts.length;i<len;++i){if(scripts[i].src.indexOf("firebug.js")!=-1){if(console){OpenLayers.Util.extend(OpenLayers.Console,console);break}}}})();OpenLayers.Lang={code:null,defaultCode:"en",getCode:function(){if(!OpenLayers.Lang.code){OpenLayers.Lang.setCode()}return OpenLayers.Lang.code},setCode:function(code){var lang;if(!code){code=OpenLayers.BROWSER_NAME=="msie"?navigator.userLanguage:navigator.language}var parts=code.split("-");parts[0]=parts[0].toLowerCase();if(typeof OpenLayers.Lang[parts[0]]=="object"){lang=parts[0]}if(parts[1]){var testLang=parts[0]+"-"+parts[1].toUpperCase();if(typeof OpenLayers.Lang[testLang]=="object"){lang=testLang}}if(!lang){OpenLayers.Console.warn("Failed to find OpenLayers.Lang."+parts.join("-")+" dictionary, falling back to default language");lang=OpenLayers.Lang.defaultCode}OpenLayers.Lang.code=lang},translate:function(key,context){var dictionary=OpenLayers.Lang[OpenLayers.Lang.getCode()];var message=dictionary&&dictionary[key];if(!message){message=key}if(context){message=OpenLayers.String.format(message,context)}return message}};OpenLayers.i18n=OpenLayers.Lang.translate;OpenLayers.Util=OpenLayers.Util||{};OpenLayers.Util.getElement=function(){var elements=[];for(var i=0,len=arguments.length;i<len;i++){var element=arguments[i];if(typeof element=="string"){element=document.getElementById(element)}if(arguments.length==1){return element}elements.push(element)}return elements};OpenLayers.Util.isElement=function(o){return!!(o&&o.nodeType===1)};OpenLayers.Util.isArray=function(a){return Object.prototype.toString.call(a)==="[object Array]"};OpenLayers.Util.removeItem=function(array,item){for(var i=array.length-1;i>=0;i--){if(array[i]==item){array.splice(i,1)}}return array};OpenLayers.Util.indexOf=function(array,obj){if(typeof array.indexOf=="function"){return array.indexOf(obj)}else{for(var i=0,len=array.length;i<len;i++){if(array[i]==obj){return i}}return-1}};OpenLayers.Util.dotless=/\./g;OpenLayers.Util.modifyDOMElement=function(element,id,px,sz,position,border,overflow,opacity){if(id){element.id=id.replace(OpenLayers.Util.dotless,"_")}if(px){element.style.left=px.x+"px";element.style.top=px.y+"px"}if(sz){element.style.width=sz.w+"px";element.style.height=sz.h+"px"}if(position){element.style.position=position}if(border){element.style.border=border}if(overflow){element.style.overflow=overflow}if(parseFloat(opacity)>=0&&parseFloat(opacity)<1){element.style.filter="alpha(opacity="+opacity*100+")";element.style.opacity=opacity}else if(parseFloat(opacity)==1){element.style.filter="";element.style.opacity=""}};OpenLayers.Util.createDiv=function(id,px,sz,imgURL,position,border,overflow,opacity){var dom=document.createElement("div");if(imgURL){dom.style.backgroundImage="url("+imgURL+")"}if(!id){id=OpenLayers.Util.createUniqueID("OpenLayersDiv")}if(!position){position="absolute"}OpenLayers.Util.modifyDOMElement(dom,id,px,sz,position,border,overflow,opacity);return dom};OpenLayers.Util.createImage=function(id,px,sz,imgURL,position,border,opacity,delayDisplay){var image=document.createElement("img");if(!id){id=OpenLayers.Util.createUniqueID("OpenLayersDiv")}if(!position){position="relative"}OpenLayers.Util.modifyDOMElement(image,id,px,sz,position,border,null,opacity);if(delayDisplay){image.style.display="none";function display(){image.style.display="";OpenLayers.Event.stopObservingElement(image)}OpenLayers.Event.observe(image,"load",display);OpenLayers.Event.observe(image,"error",display)}image.style.alt=id;image.galleryImg="no";if(imgURL){image.src=imgURL}return image};OpenLayers.IMAGE_RELOAD_ATTEMPTS=0;OpenLayers.Util.alphaHackNeeded=null;OpenLayers.Util.alphaHack=function(){if(OpenLayers.Util.alphaHackNeeded==null){var arVersion=navigator.appVersion.split("MSIE");var version=parseFloat(arVersion[1]);var filter=false;try{filter=!!document.body.filters}catch(e){}OpenLayers.Util.alphaHackNeeded=filter&&version>=5.5&&version<7}return OpenLayers.Util.alphaHackNeeded};OpenLayers.Util.modifyAlphaImageDiv=function(div,id,px,sz,imgURL,position,border,sizing,opacity){OpenLayers.Util.modifyDOMElement(div,id,px,sz,position,null,null,opacity);var img=div.childNodes[0];if(imgURL){img.src=imgURL}OpenLayers.Util.modifyDOMElement(img,div.id+"_innerImage",null,sz,"relative",border);if(OpenLayers.Util.alphaHack()){if(div.style.display!="none"){div.style.display="inline-block"}if(sizing==null){sizing="scale"}div.style.filter="progid:DXImageTransform.Microsoft"+".AlphaImageLoader(src='"+img.src+"', "+"sizingMethod='"+sizing+"')";if(parseFloat(div.style.opacity)>=0&&parseFloat(div.style.opacity)<1){div.style.filter+=" alpha(opacity="+div.style.opacity*100+")"}img.style.filter="alpha(opacity=0)"}};OpenLayers.Util.createAlphaImageDiv=function(id,px,sz,imgURL,position,border,sizing,opacity,delayDisplay){var div=OpenLayers.Util.createDiv();var img=OpenLayers.Util.createImage(null,null,null,null,null,null,null,delayDisplay);img.className="olAlphaImg";div.appendChild(img);OpenLayers.Util.modifyAlphaImageDiv(div,id,px,sz,imgURL,position,border,sizing,opacity);return div};OpenLayers.Util.upperCaseObject=function(object){var uObject={};for(var key in object){uObject[key.toUpperCase()]=object[key]}return uObject};OpenLayers.Util.applyDefaults=function(to,from){to=to||{};var fromIsEvt=typeof window.Event=="function"&&from instanceof window.Event;for(var key in from){if(to[key]===undefined||!fromIsEvt&&from.hasOwnProperty&&from.hasOwnProperty(key)&&!to.hasOwnProperty(key)){to[key]=from[key]}}if(!fromIsEvt&&from&&from.hasOwnProperty&&from.hasOwnProperty("toString")&&!to.hasOwnProperty("toString")){to.toString=from.toString}return to};OpenLayers.Util.getParameterString=function(params){var paramsArray=[];for(var key in params){var value=params[key];if(value!=null&&typeof value!="function"){var encodedValue;if(typeof value=="object"&&value.constructor==Array){var encodedItemArray=[];var item;for(var itemIndex=0,len=value.length;itemIndex<len;itemIndex++){item=value[itemIndex];encodedItemArray.push(encodeURIComponent(item===null||item===undefined?"":item))}encodedValue=encodedItemArray.join(",")}else{encodedValue=encodeURIComponent(value)}paramsArray.push(encodeURIComponent(key)+"="+encodedValue)}}return paramsArray.join("&")};OpenLayers.Util.urlAppend=function(url,paramStr){var newUrl=url;if(paramStr){var parts=(url+" ").split(/[?&]/);newUrl+=parts.pop()===" "?paramStr:parts.length?"&"+paramStr:"?"+paramStr}return newUrl};OpenLayers.Util.getImagesLocation=function(){return OpenLayers.ImgPath||OpenLayers._getScriptLocation()+"img/"};OpenLayers.Util.getImageLocation=function(image){return OpenLayers.Util.getImagesLocation()+image};OpenLayers.Util.Try=function(){var returnValue=null;for(var i=0,len=arguments.length;i<len;i++){var lambda=arguments[i];try{returnValue=lambda();break}catch(e){}}return returnValue};OpenLayers.Util.getXmlNodeValue=function(node){var val=null;OpenLayers.Util.Try(function(){val=node.text;if(!val){val=node.textContent}if(!val){val=node.firstChild.nodeValue}},function(){val=node.textContent});return val};OpenLayers.Util.mouseLeft=function(evt,div){var target=evt.relatedTarget?evt.relatedTarget:evt.toElement;while(target!=div&&target!=null){target=target.parentNode}return target!=div};OpenLayers.Util.DEFAULT_PRECISION=14;OpenLayers.Util.toFloat=function(number,precision){if(precision==null){precision=OpenLayers.Util.DEFAULT_PRECISION}if(typeof number!=="number"){number=parseFloat(number)}return precision===0?number:parseFloat(number.toPrecision(precision))};OpenLayers.Util.rad=function(x){return x*Math.PI/180};OpenLayers.Util.deg=function(x){return x*180/Math.PI};OpenLayers.Util.VincentyConstants={a:6378137,b:6356752.3142,f:1/298.257223563};OpenLayers.Util.distVincenty=function(p1,p2){var ct=OpenLayers.Util.VincentyConstants;var a=ct.a,b=ct.b,f=ct.f;var L=OpenLayers.Util.rad(p2.lon-p1.lon);var U1=Math.atan((1-f)*Math.tan(OpenLayers.Util.rad(p1.lat)));var U2=Math.atan((1-f)*Math.tan(OpenLayers.Util.rad(p2.lat)));var sinU1=Math.sin(U1),cosU1=Math.cos(U1);var sinU2=Math.sin(U2),cosU2=Math.cos(U2);var lambda=L,lambdaP=2*Math.PI;var iterLimit=20;while(Math.abs(lambda-lambdaP)>1e-12&&--iterLimit>0){var sinLambda=Math.sin(lambda),cosLambda=Math.cos(lambda);var sinSigma=Math.sqrt(cosU2*sinLambda*(cosU2*sinLambda)+(cosU1*sinU2-sinU1*cosU2*cosLambda)*(cosU1*sinU2-sinU1*cosU2*cosLambda));if(sinSigma==0){return 0}var cosSigma=sinU1*sinU2+cosU1*cosU2*cosLambda;var sigma=Math.atan2(sinSigma,cosSigma);var alpha=Math.asin(cosU1*cosU2*sinLambda/sinSigma);var cosSqAlpha=Math.cos(alpha)*Math.cos(alpha);var cos2SigmaM=cosSigma-2*sinU1*sinU2/cosSqAlpha;var C=f/16*cosSqAlpha*(4+f*(4-3*cosSqAlpha));lambdaP=lambda;lambda=L+(1-C)*f*Math.sin(alpha)*(sigma+C*sinSigma*(cos2SigmaM+C*cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)))}if(iterLimit==0){return NaN}var uSq=cosSqAlpha*(a*a-b*b)/(b*b);var A=1+uSq/16384*(4096+uSq*(-768+uSq*(320-175*uSq)));var B=uSq/1024*(256+uSq*(-128+uSq*(74-47*uSq)));var deltaSigma=B*sinSigma*(cos2SigmaM+B/4*(cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)-B/6*cos2SigmaM*(-3+4*sinSigma*sinSigma)*(-3+4*cos2SigmaM*cos2SigmaM)));var s=b*A*(sigma-deltaSigma);var d=s.toFixed(3)/1e3;return d};OpenLayers.Util.destinationVincenty=function(lonlat,brng,dist){var u=OpenLayers.Util;var ct=u.VincentyConstants;var a=ct.a,b=ct.b,f=ct.f;var lon1=lonlat.lon;var lat1=lonlat.lat;var s=dist;var alpha1=u.rad(brng);var sinAlpha1=Math.sin(alpha1);var cosAlpha1=Math.cos(alpha1);var tanU1=(1-f)*Math.tan(u.rad(lat1));var cosU1=1/Math.sqrt(1+tanU1*tanU1),sinU1=tanU1*cosU1;var sigma1=Math.atan2(tanU1,cosAlpha1);var sinAlpha=cosU1*sinAlpha1;var cosSqAlpha=1-sinAlpha*sinAlpha;var uSq=cosSqAlpha*(a*a-b*b)/(b*b);var A=1+uSq/16384*(4096+uSq*(-768+uSq*(320-175*uSq)));var B=uSq/1024*(256+uSq*(-128+uSq*(74-47*uSq)));var sigma=s/(b*A),sigmaP=2*Math.PI;while(Math.abs(sigma-sigmaP)>1e-12){var cos2SigmaM=Math.cos(2*sigma1+sigma);var sinSigma=Math.sin(sigma);var cosSigma=Math.cos(sigma);var deltaSigma=B*sinSigma*(cos2SigmaM+B/4*(cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)-B/6*cos2SigmaM*(-3+4*sinSigma*sinSigma)*(-3+4*cos2SigmaM*cos2SigmaM)));sigmaP=sigma;sigma=s/(b*A)+deltaSigma}var tmp=sinU1*sinSigma-cosU1*cosSigma*cosAlpha1;var lat2=Math.atan2(sinU1*cosSigma+cosU1*sinSigma*cosAlpha1,(1-f)*Math.sqrt(sinAlpha*sinAlpha+tmp*tmp));var lambda=Math.atan2(sinSigma*sinAlpha1,cosU1*cosSigma-sinU1*sinSigma*cosAlpha1);var C=f/16*cosSqAlpha*(4+f*(4-3*cosSqAlpha));var L=lambda-(1-C)*f*sinAlpha*(sigma+C*sinSigma*(cos2SigmaM+C*cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)));var revAz=Math.atan2(sinAlpha,-tmp);return new OpenLayers.LonLat(lon1+u.deg(L),u.deg(lat2))};OpenLayers.Util.getParameters=function(url,options){options=options||{};url=url===null||url===undefined?window.location.href:url;var paramsString="";if(OpenLayers.String.contains(url,"?")){var start=url.indexOf("?")+1;var end=OpenLayers.String.contains(url,"#")?url.indexOf("#"):url.length;paramsString=url.substring(start,end)}var parameters={};var pairs=paramsString.split(/[&;]/);for(var i=0,len=pairs.length;i<len;++i){var keyValue=pairs[i].split("=");if(keyValue[0]){var key=keyValue[0];try{key=decodeURIComponent(key)}catch(err){key=unescape(key)}var value=(keyValue[1]||"").replace(/\+/g," ");try{value=decodeURIComponent(value)}catch(err){value=unescape(value)}if(options.splitArgs!==false){value=value.split(",")}if(value.length==1){value=value[0]}parameters[key]=value}}return parameters};OpenLayers.Util.lastSeqID=0;OpenLayers.Util.createUniqueID=function(prefix){if(prefix==null){prefix="id_"}else{prefix=prefix.replace(OpenLayers.Util.dotless,"_")}OpenLayers.Util.lastSeqID+=1;return prefix+OpenLayers.Util.lastSeqID};OpenLayers.INCHES_PER_UNIT={inches:1,ft:12,mi:63360,m:39.37,km:39370,dd:4374754,yd:36};OpenLayers.INCHES_PER_UNIT["in"]=OpenLayers.INCHES_PER_UNIT.inches;OpenLayers.INCHES_PER_UNIT["degrees"]=OpenLayers.INCHES_PER_UNIT.dd;OpenLayers.INCHES_PER_UNIT["nmi"]=1852*OpenLayers.INCHES_PER_UNIT.m;OpenLayers.METERS_PER_INCH=.0254000508001016;OpenLayers.Util.extend(OpenLayers.INCHES_PER_UNIT,{Inch:OpenLayers.INCHES_PER_UNIT.inches,Meter:1/OpenLayers.METERS_PER_INCH,Foot:.3048006096012192/OpenLayers.METERS_PER_INCH,IFoot:.3048/OpenLayers.METERS_PER_INCH,ClarkeFoot:.3047972651151/OpenLayers.METERS_PER_INCH,SearsFoot:.30479947153867626/OpenLayers.METERS_PER_INCH,GoldCoastFoot:.3047997101815088/OpenLayers.METERS_PER_INCH,IInch:.0254/OpenLayers.METERS_PER_INCH,MicroInch:254e-7/OpenLayers.METERS_PER_INCH,Mil:2.54e-8/OpenLayers.METERS_PER_INCH,Centimeter:.01/OpenLayers.METERS_PER_INCH,Kilometer:1e3/OpenLayers.METERS_PER_INCH,Yard:.9144018288036576/OpenLayers.METERS_PER_INCH,SearsYard:.914398414616029/OpenLayers.METERS_PER_INCH,IndianYard:.9143985307444408/OpenLayers.METERS_PER_INCH,IndianYd37:.91439523/OpenLayers.METERS_PER_INCH,IndianYd62:.9143988/OpenLayers.METERS_PER_INCH,IndianYd75:.9143985/OpenLayers.METERS_PER_INCH,IndianFoot:.30479951/OpenLayers.METERS_PER_INCH,IndianFt37:.30479841/OpenLayers.METERS_PER_INCH,IndianFt62:.3047996/OpenLayers.METERS_PER_INCH,IndianFt75:.3047995/OpenLayers.METERS_PER_INCH,Mile:1609.3472186944373/OpenLayers.METERS_PER_INCH,IYard:.9144/OpenLayers.METERS_PER_INCH,IMile:1609.344/OpenLayers.METERS_PER_INCH,NautM:1852/OpenLayers.METERS_PER_INCH,"Lat-66":110943.31648893273/OpenLayers.METERS_PER_INCH,"Lat-83":110946.25736872235/OpenLayers.METERS_PER_INCH,Decimeter:.1/OpenLayers.METERS_PER_INCH,Millimeter:.001/OpenLayers.METERS_PER_INCH,Dekameter:10/OpenLayers.METERS_PER_INCH,Decameter:10/OpenLayers.METERS_PER_INCH,Hectometer:100/OpenLayers.METERS_PER_INCH,GermanMeter:1.0000135965/OpenLayers.METERS_PER_INCH,CaGrid:.999738/OpenLayers.METERS_PER_INCH,ClarkeChain:20.1166194976/OpenLayers.METERS_PER_INCH,GunterChain:20.11684023368047/OpenLayers.METERS_PER_INCH,BenoitChain:20.116782494375872/OpenLayers.METERS_PER_INCH,SearsChain:20.11676512155/OpenLayers.METERS_PER_INCH,ClarkeLink:.201166194976/OpenLayers.METERS_PER_INCH,GunterLink:.2011684023368047/OpenLayers.METERS_PER_INCH,BenoitLink:.20116782494375873/OpenLayers.METERS_PER_INCH,SearsLink:.2011676512155/OpenLayers.METERS_PER_INCH,Rod:5.02921005842012/OpenLayers.METERS_PER_INCH,IntnlChain:20.1168/OpenLayers.METERS_PER_INCH,IntnlLink:.201168/OpenLayers.METERS_PER_INCH,Perch:5.02921005842012/OpenLayers.METERS_PER_INCH,Pole:5.02921005842012/OpenLayers.METERS_PER_INCH,Furlong:201.1684023368046/OpenLayers.METERS_PER_INCH,Rood:3.778266898/OpenLayers.METERS_PER_INCH,CapeFoot:.3047972615/OpenLayers.METERS_PER_INCH,Brealey:375/OpenLayers.METERS_PER_INCH,ModAmFt:.304812252984506/OpenLayers.METERS_PER_INCH,Fathom:1.8288/OpenLayers.METERS_PER_INCH,"NautM-UK":1853.184/OpenLayers.METERS_PER_INCH,"50kilometers":5e4/OpenLayers.METERS_PER_INCH,"150kilometers":15e4/OpenLayers.METERS_PER_INCH});
OpenLayers.Util.extend(OpenLayers.INCHES_PER_UNIT,{mm:OpenLayers.INCHES_PER_UNIT["Meter"]/1e3,cm:OpenLayers.INCHES_PER_UNIT["Meter"]/100,dm:OpenLayers.INCHES_PER_UNIT["Meter"]*100,km:OpenLayers.INCHES_PER_UNIT["Meter"]*1e3,kmi:OpenLayers.INCHES_PER_UNIT["nmi"],fath:OpenLayers.INCHES_PER_UNIT["Fathom"],ch:OpenLayers.INCHES_PER_UNIT["IntnlChain"],link:OpenLayers.INCHES_PER_UNIT["IntnlLink"],"us-in":OpenLayers.INCHES_PER_UNIT["inches"],"us-ft":OpenLayers.INCHES_PER_UNIT["Foot"],"us-yd":OpenLayers.INCHES_PER_UNIT["Yard"],"us-ch":OpenLayers.INCHES_PER_UNIT["GunterChain"],"us-mi":OpenLayers.INCHES_PER_UNIT["Mile"],"ind-yd":OpenLayers.INCHES_PER_UNIT["IndianYd37"],"ind-ft":OpenLayers.INCHES_PER_UNIT["IndianFt37"],"ind-ch":20.11669506/OpenLayers.METERS_PER_INCH});OpenLayers.DOTS_PER_INCH=72;OpenLayers.Util.normalizeScale=function(scale){var normScale=scale>1?1/scale:scale;return normScale};OpenLayers.Util.getResolutionFromScale=function(scale,units){var resolution;if(scale){if(units==null){units="degrees"}var normScale=OpenLayers.Util.normalizeScale(scale);resolution=1/(normScale*OpenLayers.INCHES_PER_UNIT[units]*OpenLayers.DOTS_PER_INCH)}return resolution};OpenLayers.Util.getScaleFromResolution=function(resolution,units){if(units==null){units="degrees"}var scale=resolution*OpenLayers.INCHES_PER_UNIT[units]*OpenLayers.DOTS_PER_INCH;return scale};OpenLayers.Util.pagePosition=function(forElement){var pos=[0,0];var viewportElement=OpenLayers.Util.getViewportElement();if(!forElement||forElement==window||forElement==viewportElement){return pos}var BUGGY_GECKO_BOX_OBJECT=OpenLayers.IS_GECKO&&document.getBoxObjectFor&&OpenLayers.Element.getStyle(forElement,"position")=="absolute"&&(forElement.style.top==""||forElement.style.left=="");var parent=null;var box;if(forElement.getBoundingClientRect){box=forElement.getBoundingClientRect();var scrollTop=window.pageYOffset||viewportElement.scrollTop;var scrollLeft=window.pageXOffset||viewportElement.scrollLeft;pos[0]=box.left+scrollLeft;pos[1]=box.top+scrollTop}else if(document.getBoxObjectFor&&!BUGGY_GECKO_BOX_OBJECT){box=document.getBoxObjectFor(forElement);var vpBox=document.getBoxObjectFor(viewportElement);pos[0]=box.screenX-vpBox.screenX;pos[1]=box.screenY-vpBox.screenY}else{pos[0]=forElement.offsetLeft;pos[1]=forElement.offsetTop;parent=forElement.offsetParent;if(parent!=forElement){while(parent){pos[0]+=parent.offsetLeft;pos[1]+=parent.offsetTop;parent=parent.offsetParent}}var browser=OpenLayers.BROWSER_NAME;if(browser=="opera"||browser=="safari"&&OpenLayers.Element.getStyle(forElement,"position")=="absolute"){pos[1]-=document.body.offsetTop}parent=forElement.offsetParent;while(parent&&parent!=document.body){pos[0]-=parent.scrollLeft;if(browser!="opera"||parent.tagName!="TR"){pos[1]-=parent.scrollTop}parent=parent.offsetParent}}return pos};OpenLayers.Util.getViewportElement=function(){var viewportElement=arguments.callee.viewportElement;if(viewportElement==undefined){viewportElement=OpenLayers.BROWSER_NAME=="msie"&&document.compatMode!="CSS1Compat"?document.body:document.documentElement;arguments.callee.viewportElement=viewportElement}return viewportElement};OpenLayers.Util.isEquivalentUrl=function(url1,url2,options){options=options||{};OpenLayers.Util.applyDefaults(options,{ignoreCase:true,ignorePort80:true,ignoreHash:true,splitArgs:false});var urlObj1=OpenLayers.Util.createUrlObject(url1,options);var urlObj2=OpenLayers.Util.createUrlObject(url2,options);for(var key in urlObj1){if(key!=="args"){if(urlObj1[key]!=urlObj2[key]){return false}}}for(var key in urlObj1.args){if(urlObj1.args[key]!=urlObj2.args[key]){return false}delete urlObj2.args[key]}for(var key in urlObj2.args){return false}return true};OpenLayers.Util.createUrlObject=function(url,options){options=options||{};if(!/^\w+:\/\//.test(url)){var loc=window.location;var port=loc.port?":"+loc.port:"";var fullUrl=loc.protocol+"//"+loc.host.split(":").shift()+port;if(url.indexOf("/")===0){url=fullUrl+url}else{var parts=loc.pathname.split("/");parts.pop();url=fullUrl+parts.join("/")+"/"+url}}if(options.ignoreCase){url=url.toLowerCase()}var a=document.createElement("a");a.href=url;var urlObject={};urlObject.host=a.host.split(":").shift();urlObject.protocol=a.protocol;if(options.ignorePort80){urlObject.port=a.port=="80"||a.port=="0"?"":a.port}else{urlObject.port=a.port==""||a.port=="0"?"80":a.port}urlObject.hash=options.ignoreHash||a.hash==="#"?"":a.hash;var queryString=a.search;if(!queryString){var qMark=url.indexOf("?");queryString=qMark!=-1?url.substr(qMark):""}urlObject.args=OpenLayers.Util.getParameters(queryString,{splitArgs:options.splitArgs});urlObject.pathname=a.pathname.charAt(0)=="/"?a.pathname:"/"+a.pathname;return urlObject};OpenLayers.Util.removeTail=function(url){var head=null;var qMark=url.indexOf("?");var hashMark=url.indexOf("#");if(qMark==-1){head=hashMark!=-1?url.substr(0,hashMark):url}else{head=hashMark!=-1?url.substr(0,Math.min(qMark,hashMark)):url.substr(0,qMark)}return head};OpenLayers.IS_GECKO=function(){var ua=navigator.userAgent.toLowerCase();return ua.indexOf("webkit")==-1&&ua.indexOf("gecko")!=-1}();OpenLayers.CANVAS_SUPPORTED=function(){var elem=document.createElement("canvas");return!!(elem.getContext&&elem.getContext("2d"))}();OpenLayers.BROWSER_NAME=function(){var name="";var ua=navigator.userAgent.toLowerCase();if(ua.indexOf("opera")!=-1){name="opera"}else if(ua.indexOf("msie")!=-1){name="msie"}else if(ua.indexOf("safari")!=-1){name="safari"}else if(ua.indexOf("mozilla")!=-1){if(ua.indexOf("firefox")!=-1){name="firefox"}else{name="mozilla"}}return name}();OpenLayers.Util.getBrowserName=function(){return OpenLayers.BROWSER_NAME};OpenLayers.Util.getRenderedDimensions=function(contentHTML,size,options){var w,h;var container=document.createElement("div");container.style.visibility="hidden";var containerElement=options&&options.containerElement?options.containerElement:document.body;var parentHasPositionAbsolute=false;var superContainer=null;var parent=containerElement;while(parent&&parent.tagName.toLowerCase()!="body"){var parentPosition=OpenLayers.Element.getStyle(parent,"position");if(parentPosition=="absolute"){parentHasPositionAbsolute=true;break}else if(parentPosition&&parentPosition!="static"){break}parent=parent.parentNode}if(parentHasPositionAbsolute&&(containerElement.clientHeight===0||containerElement.clientWidth===0)){superContainer=document.createElement("div");superContainer.style.visibility="hidden";superContainer.style.position="absolute";superContainer.style.overflow="visible";superContainer.style.width=document.body.clientWidth+"px";superContainer.style.height=document.body.clientHeight+"px";superContainer.appendChild(container)}container.style.position="absolute";if(size){if(size.w){w=size.w;container.style.width=w+"px"}else if(size.h){h=size.h;container.style.height=h+"px"}}if(options&&options.displayClass){container.className=options.displayClass}var content=document.createElement("div");content.innerHTML=contentHTML;content.style.overflow="visible";if(content.childNodes){for(var i=0,l=content.childNodes.length;i<l;i++){if(!content.childNodes[i].style)continue;content.childNodes[i].style.overflow="visible"}}container.appendChild(content);if(superContainer){containerElement.appendChild(superContainer)}else{containerElement.appendChild(container)}if(!w){w=parseInt(content.scrollWidth);container.style.width=w+"px"}if(!h){h=parseInt(content.scrollHeight)}container.removeChild(content);if(superContainer){superContainer.removeChild(container);containerElement.removeChild(superContainer)}else{containerElement.removeChild(container)}return new OpenLayers.Size(w,h)};OpenLayers.Util.getScrollbarWidth=function(){var scrollbarWidth=OpenLayers.Util._scrollbarWidth;if(scrollbarWidth==null){var scr=null;var inn=null;var wNoScroll=0;var wScroll=0;scr=document.createElement("div");scr.style.position="absolute";scr.style.top="-1000px";scr.style.left="-1000px";scr.style.width="100px";scr.style.height="50px";scr.style.overflow="hidden";inn=document.createElement("div");inn.style.width="100%";inn.style.height="200px";scr.appendChild(inn);document.body.appendChild(scr);wNoScroll=inn.offsetWidth;scr.style.overflow="scroll";wScroll=inn.offsetWidth;document.body.removeChild(document.body.lastChild);OpenLayers.Util._scrollbarWidth=wNoScroll-wScroll;scrollbarWidth=OpenLayers.Util._scrollbarWidth}return scrollbarWidth};OpenLayers.Util.getFormattedLonLat=function(coordinate,axis,dmsOption){if(!dmsOption){dmsOption="dms"}coordinate=(coordinate+540)%360-180;var abscoordinate=Math.abs(coordinate);var coordinatedegrees=Math.floor(abscoordinate);var coordinateminutes=(abscoordinate-coordinatedegrees)/(1/60);var tempcoordinateminutes=coordinateminutes;coordinateminutes=Math.floor(coordinateminutes);var coordinateseconds=(tempcoordinateminutes-coordinateminutes)/(1/60);coordinateseconds=Math.round(coordinateseconds*10);coordinateseconds/=10;if(coordinateseconds>=60){coordinateseconds-=60;coordinateminutes+=1;if(coordinateminutes>=60){coordinateminutes-=60;coordinatedegrees+=1}}if(coordinatedegrees<10){coordinatedegrees="0"+coordinatedegrees}var str=coordinatedegrees+"°";if(dmsOption.indexOf("dm")>=0){if(coordinateminutes<10){coordinateminutes="0"+coordinateminutes}str+=coordinateminutes+"'";if(dmsOption.indexOf("dms")>=0){if(coordinateseconds<10){coordinateseconds="0"+coordinateseconds}str+=coordinateseconds+'"'}}if(axis=="lon"){str+=coordinate<0?OpenLayers.i18n("W"):OpenLayers.i18n("E")}else{str+=coordinate<0?OpenLayers.i18n("S"):OpenLayers.i18n("N")}return str};OpenLayers.Event={observers:false,KEY_SPACE:32,KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(event){return event.target||event.srcElement},isSingleTouch:function(event){return event.touches&&event.touches.length==1},isMultiTouch:function(event){return event.touches&&event.touches.length>1},isLeftClick:function(event){return event.which&&event.which==1||event.button&&event.button==1},isRightClick:function(event){return event.which&&event.which==3||event.button&&event.button==2},stop:function(event,allowDefault){if(!allowDefault){OpenLayers.Event.preventDefault(event)}if(event.stopPropagation){event.stopPropagation()}else{event.cancelBubble=true}},preventDefault:function(event){if(event.preventDefault){event.preventDefault()}else{event.returnValue=false}},findElement:function(event,tagName){var element=OpenLayers.Event.element(event);while(element.parentNode&&(!element.tagName||element.tagName.toUpperCase()!=tagName.toUpperCase())){element=element.parentNode}return element},observe:function(elementParam,name,observer,useCapture){var element=OpenLayers.Util.getElement(elementParam);useCapture=useCapture||false;if(name=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.attachEvent)){name="keydown"}if(!this.observers){this.observers={}}if(!element._eventCacheID){var idPrefix="eventCacheID_";if(element.id){idPrefix=element.id+"_"+idPrefix}element._eventCacheID=OpenLayers.Util.createUniqueID(idPrefix)}var cacheID=element._eventCacheID;if(!this.observers[cacheID]){this.observers[cacheID]=[]}this.observers[cacheID].push({element:element,name:name,observer:observer,useCapture:useCapture});if(element.addEventListener){element.addEventListener(name,observer,useCapture)}else if(element.attachEvent){element.attachEvent("on"+name,observer)}},stopObservingElement:function(elementParam){var element=OpenLayers.Util.getElement(elementParam);var cacheID=element._eventCacheID;this._removeElementObservers(OpenLayers.Event.observers[cacheID])},_removeElementObservers:function(elementObservers){if(elementObservers){for(var i=elementObservers.length-1;i>=0;i--){var entry=elementObservers[i];OpenLayers.Event.stopObserving.apply(this,[entry.element,entry.name,entry.observer,entry.useCapture])}}},stopObserving:function(elementParam,name,observer,useCapture){useCapture=useCapture||false;var element=OpenLayers.Util.getElement(elementParam);var cacheID=element._eventCacheID;if(name=="keypress"){if(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.detachEvent){name="keydown"}}var foundEntry=false;var elementObservers=OpenLayers.Event.observers[cacheID];if(elementObservers){var i=0;while(!foundEntry&&i<elementObservers.length){var cacheEntry=elementObservers[i];if(cacheEntry.name==name&&cacheEntry.observer==observer&&cacheEntry.useCapture==useCapture){elementObservers.splice(i,1);if(elementObservers.length==0){delete OpenLayers.Event.observers[cacheID]}foundEntry=true;break}i++}}if(foundEntry){if(element.removeEventListener){element.removeEventListener(name,observer,useCapture)}else if(element&&element.detachEvent){element.detachEvent("on"+name,observer)}}return foundEntry},unloadCache:function(){if(OpenLayers.Event&&OpenLayers.Event.observers){for(var cacheID in OpenLayers.Event.observers){var elementObservers=OpenLayers.Event.observers[cacheID];OpenLayers.Event._removeElementObservers.apply(this,[elementObservers])}OpenLayers.Event.observers=false}},CLASS_NAME:"OpenLayers.Event"};OpenLayers.Event.observe(window,"unload",OpenLayers.Event.unloadCache,false);OpenLayers.Events=OpenLayers.Class({BROWSER_EVENTS:["mouseover","mouseout","mousedown","mouseup","mousemove","click","dblclick","rightclick","dblrightclick","resize","focus","blur","touchstart","touchmove","touchend","keydown"],listeners:null,object:null,element:null,eventHandler:null,fallThrough:null,includeXY:false,extensions:null,extensionCount:null,clearMouseListener:null,initialize:function(object,element,eventTypes,fallThrough,options){OpenLayers.Util.extend(this,options);this.object=object;this.fallThrough=fallThrough;this.listeners={};this.extensions={};this.extensionCount={};this._msTouches=[];if(element!=null){this.attachToElement(element)}},destroy:function(){for(var e in this.extensions){if(typeof this.extensions[e]!=="boolean"){this.extensions[e].destroy()}}this.extensions=null;if(this.element){OpenLayers.Event.stopObservingElement(this.element);if(this.element.hasScrollEvent){OpenLayers.Event.stopObserving(window,"scroll",this.clearMouseListener)}}this.element=null;this.listeners=null;this.object=null;this.fallThrough=null;this.eventHandler=null},addEventType:function(eventName){},attachToElement:function(element){if(this.element){OpenLayers.Event.stopObservingElement(this.element)}else{this.eventHandler=OpenLayers.Function.bindAsEventListener(this.handleBrowserEvent,this);this.clearMouseListener=OpenLayers.Function.bind(this.clearMouseCache,this)}this.element=element;var msTouch=!!window.navigator.msMaxTouchPoints;var type;for(var i=0,len=this.BROWSER_EVENTS.length;i<len;i++){type=this.BROWSER_EVENTS[i];OpenLayers.Event.observe(element,type,this.eventHandler);if(msTouch&&type.indexOf("touch")===0){this.addMsTouchListener(element,type,this.eventHandler)}}OpenLayers.Event.observe(element,"dragstart",OpenLayers.Event.stop)},on:function(object){for(var type in object){if(type!="scope"&&object.hasOwnProperty(type)){this.register(type,object.scope,object[type])}}},register:function(type,obj,func,priority){if(type in OpenLayers.Events&&!this.extensions[type]){this.extensions[type]=new OpenLayers.Events[type](this)}if(func!=null){if(obj==null){obj=this.object}var listeners=this.listeners[type];if(!listeners){listeners=[];this.listeners[type]=listeners;this.extensionCount[type]=0}var listener={obj:obj,func:func};if(priority){listeners.splice(this.extensionCount[type],0,listener);if(typeof priority==="object"&&priority.extension){this.extensionCount[type]++}}else{listeners.push(listener)}}},registerPriority:function(type,obj,func){this.register(type,obj,func,true)},un:function(object){for(var type in object){if(type!="scope"&&object.hasOwnProperty(type)){this.unregister(type,object.scope,object[type])}}},unregister:function(type,obj,func){if(obj==null){obj=this.object}var listeners=this.listeners[type];if(listeners!=null){for(var i=0,len=listeners.length;i<len;i++){if(listeners[i].obj==obj&&listeners[i].func==func){listeners.splice(i,1);break}}}},remove:function(type){if(this.listeners[type]!=null){this.listeners[type]=[]}},triggerEvent:function(type,evt){var listeners=this.listeners[type];if(!listeners||listeners.length==0){return undefined}if(evt==null){evt={}}evt.object=this.object;evt.element=this.element;if(!evt.type){evt.type=type}listeners=listeners.slice();var continueChain;for(var i=0,len=listeners.length;i<len;i++){var callback=listeners[i];continueChain=callback.func.apply(callback.obj,[evt]);if(continueChain!=undefined&&continueChain==false){break}}if(!this.fallThrough){OpenLayers.Event.stop(evt,true)}return continueChain},handleBrowserEvent:function(evt){var type=evt.type,listeners=this.listeners[type];if(!listeners||listeners.length==0){return}var touches=evt.touches;if(touches&&touches[0]){var x=0;var y=0;var num=touches.length;var touch;for(var i=0;i<num;++i){touch=this.getTouchClientXY(touches[i]);x+=touch.clientX;y+=touch.clientY}evt.clientX=x/num;evt.clientY=y/num}if(this.includeXY){evt.xy=this.getMousePosition(evt)}this.triggerEvent(type,evt)},getTouchClientXY:function(evt){var win=window.olMockWin||window,winPageX=win.pageXOffset,winPageY=win.pageYOffset,x=evt.clientX,y=evt.clientY;if(evt.pageY===0&&Math.floor(y)>Math.floor(evt.pageY)||evt.pageX===0&&Math.floor(x)>Math.floor(evt.pageX)){x=x-winPageX;y=y-winPageY}else if(y<evt.pageY-winPageY||x<evt.pageX-winPageX){x=evt.pageX-winPageX;y=evt.pageY-winPageY}evt.olClientX=x;evt.olClientY=y;return{clientX:x,clientY:y}},clearMouseCache:function(){this.element.scrolls=null;this.element.lefttop=null;this.element.offsets=null},getMousePosition:function(evt){if(!this.includeXY){this.clearMouseCache()}else if(!this.element.hasScrollEvent){OpenLayers.Event.observe(window,"scroll",this.clearMouseListener);this.element.hasScrollEvent=true}if(!this.element.scrolls){var viewportElement=OpenLayers.Util.getViewportElement();this.element.scrolls=[window.pageXOffset||viewportElement.scrollLeft,window.pageYOffset||viewportElement.scrollTop]}if(!this.element.lefttop){this.element.lefttop=[document.documentElement.clientLeft||0,document.documentElement.clientTop||0]}if(!this.element.offsets){this.element.offsets=OpenLayers.Util.pagePosition(this.element)}return new OpenLayers.Pixel(evt.clientX+this.element.scrolls[0]-this.element.offsets[0]-this.element.lefttop[0],evt.clientY+this.element.scrolls[1]-this.element.offsets[1]-this.element.lefttop[1])},addMsTouchListener:function(element,type,handler){var eventHandler=this.eventHandler;var touches=this._msTouches;function msHandler(evt){handler(OpenLayers.Util.applyDefaults({stopPropagation:function(){for(var i=touches.length-1;i>=0;--i){touches[i].stopPropagation()}},preventDefault:function(){for(var i=touches.length-1;i>=0;--i){touches[i].preventDefault()}},type:type},evt))}switch(type){case"touchstart":return this.addMsTouchListenerStart(element,type,msHandler);case"touchend":return this.addMsTouchListenerEnd(element,type,msHandler);case"touchmove":return this.addMsTouchListenerMove(element,type,msHandler);default:throw"Unknown touch event type"}},addMsTouchListenerStart:function(element,type,handler){var touches=this._msTouches;var cb=function(e){var alreadyInArray=false;for(var i=0,ii=touches.length;i<ii;++i){if(touches[i].pointerId==e.pointerId){alreadyInArray=true;break}}if(!alreadyInArray){touches.push(e)}e.touches=touches.slice();handler(e)};OpenLayers.Event.observe(element,"MSPointerDown",cb);var internalCb=function(e){for(var i=0,ii=touches.length;i<ii;++i){if(touches[i].pointerId==e.pointerId){touches.splice(i,1);break}}};OpenLayers.Event.observe(element,"MSPointerUp",internalCb)},addMsTouchListenerMove:function(element,type,handler){var touches=this._msTouches;var cb=function(e){if(e.pointerType==e.MSPOINTER_TYPE_MOUSE&&e.buttons==0){return}if(touches.length==1&&touches[0].pageX==e.pageX&&touches[0].pageY==e.pageY){return}for(var i=0,ii=touches.length;i<ii;++i){if(touches[i].pointerId==e.pointerId){touches[i]=e;break}}e.touches=touches.slice();handler(e)};OpenLayers.Event.observe(element,"MSPointerMove",cb)},addMsTouchListenerEnd:function(element,type,handler){var touches=this._msTouches;var cb=function(e){for(var i=0,ii=touches.length;i<ii;++i){if(touches[i].pointerId==e.pointerId){touches.splice(i,1);break}}e.touches=touches.slice();handler(e)};OpenLayers.Event.observe(element,"MSPointerUp",cb)},CLASS_NAME:"OpenLayers.Events"});OpenLayers.Events.buttonclick=OpenLayers.Class({target:null,events:["mousedown","mouseup","click","dblclick","touchstart","touchmove","touchend","keydown"],startRegEx:/^mousedown|touchstart$/,cancelRegEx:/^touchmove$/,completeRegEx:/^mouseup|touchend$/,initialize:function(target){this.target=target;for(var i=this.events.length-1;i>=0;--i){this.target.register(this.events[i],this,this.buttonClick,{extension:true})}},destroy:function(){for(var i=this.events.length-1;i>=0;--i){this.target.unregister(this.events[i],this,this.buttonClick)}delete this.target},getPressedButton:function(element){var depth=3,button;do{if(OpenLayers.Element.hasClass(element,"olButton")){button=element;break}element=element.parentNode}while(--depth>0&&element);return button},ignore:function(element){var depth=3,ignore=false;do{if(element.nodeName.toLowerCase()==="a"){ignore=true;break}element=element.parentNode}while(--depth>0&&element);return ignore},buttonClick:function(evt){var propagate=true,element=OpenLayers.Event.element(evt);if(element&&(OpenLayers.Event.isLeftClick(evt)||!~evt.type.indexOf("mouse"))){var button=this.getPressedButton(element);if(button){if(evt.type==="keydown"){switch(evt.keyCode){case OpenLayers.Event.KEY_RETURN:case OpenLayers.Event.KEY_SPACE:this.target.triggerEvent("buttonclick",{buttonElement:button});OpenLayers.Event.stop(evt);propagate=false;break}}else if(this.startEvt){if(this.completeRegEx.test(evt.type)){var pos=OpenLayers.Util.pagePosition(button);var viewportElement=OpenLayers.Util.getViewportElement();var scrollTop=window.pageYOffset||viewportElement.scrollTop;var scrollLeft=window.pageXOffset||viewportElement.scrollLeft;pos[0]=pos[0]-scrollLeft;pos[1]=pos[1]-scrollTop;this.target.triggerEvent("buttonclick",{buttonElement:button,buttonXY:{x:this.startEvt.clientX-pos[0],y:this.startEvt.clientY-pos[1]}})}if(this.cancelRegEx.test(evt.type)){delete this.startEvt}OpenLayers.Event.stop(evt);propagate=false}if(this.startRegEx.test(evt.type)){this.startEvt=evt;OpenLayers.Event.stop(evt);propagate=false}}else{propagate=!this.ignore(OpenLayers.Event.element(evt));delete this.startEvt}}return propagate}});OpenLayers.Control=OpenLayers.Class({id:null,map:null,div:null,type:null,allowSelection:false,displayClass:"",title:"",autoActivate:false,active:null,handlerOptions:null,handler:null,eventListeners:null,events:null,initialize:function(options){this.displayClass=this.CLASS_NAME.replace("OpenLayers.","ol").replace(/\./g,"");OpenLayers.Util.extend(this,options);this.events=new OpenLayers.Events(this);if(this.eventListeners instanceof Object){this.events.on(this.eventListeners)}if(this.id==null){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")}},destroy:function(){if(this.events){if(this.eventListeners){this.events.un(this.eventListeners)}this.events.destroy();this.events=null}this.eventListeners=null;if(this.handler){this.handler.destroy();this.handler=null}if(this.handlers){for(var key in this.handlers){if(this.handlers.hasOwnProperty(key)&&typeof this.handlers[key].destroy=="function"){this.handlers[key].destroy()}}this.handlers=null}if(this.map){this.map.removeControl(this);this.map=null}this.div=null},setMap:function(map){this.map=map;if(this.handler){this.handler.setMap(map)}},draw:function(px){if(this.div==null){this.div=OpenLayers.Util.createDiv(this.id);this.div.className=this.displayClass;if(!this.allowSelection){this.div.className+=" olControlNoSelect";this.div.setAttribute("unselectable","on",0);this.div.onselectstart=OpenLayers.Function.False}if(this.title!=""){this.div.title=this.title}}if(px!=null){this.position=px.clone()}this.moveTo(this.position);return this.div},moveTo:function(px){if(px!=null&&this.div!=null){this.div.style.left=px.x+"px";this.div.style.top=px.y+"px"}},activate:function(){if(this.active){return false}if(this.handler){this.handler.activate()}this.active=true;if(this.map){OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active")}this.events.triggerEvent("activate");return true},deactivate:function(){if(this.active){if(this.handler){this.handler.deactivate()}this.active=false;if(this.map){OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active")}this.events.triggerEvent("deactivate");return true}return false},CLASS_NAME:"OpenLayers.Control"});OpenLayers.Control.TYPE_BUTTON=1;OpenLayers.Control.TYPE_TOGGLE=2;OpenLayers.Control.TYPE_TOOL=3;OpenLayers.Geometry=OpenLayers.Class({id:null,parent:null,bounds:null,initialize:function(){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){this.id=null;this.bounds=null},clone:function(){return new OpenLayers.Geometry},setBounds:function(bounds){if(bounds){this.bounds=bounds.clone()}},clearBounds:function(){this.bounds=null;if(this.parent){this.parent.clearBounds()}},extendBounds:function(newBounds){var bounds=this.getBounds();if(!bounds){this.setBounds(newBounds)}else{this.bounds.extend(newBounds)}},getBounds:function(){if(this.bounds==null){this.calculateBounds()}return this.bounds},calculateBounds:function(){},distanceTo:function(geometry,options){},getVertices:function(nodes){},atPoint:function(lonlat,toleranceLon,toleranceLat){var atPoint=false;var bounds=this.getBounds();if(bounds!=null&&lonlat!=null){var dX=toleranceLon!=null?toleranceLon:0;var dY=toleranceLat!=null?toleranceLat:0;var toleranceBounds=new OpenLayers.Bounds(this.bounds.left-dX,this.bounds.bottom-dY,this.bounds.right+dX,this.bounds.top+dY);atPoint=toleranceBounds.containsLonLat(lonlat)}return atPoint},getLength:function(){return 0},getArea:function(){return 0},getCentroid:function(){return null},toString:function(){var string;if(OpenLayers.Format&&OpenLayers.Format.WKT){string=OpenLayers.Format.WKT.prototype.write(new OpenLayers.Feature.Vector(this))}else{string=Object.prototype.toString.call(this)}return string},CLASS_NAME:"OpenLayers.Geometry"});OpenLayers.Geometry.fromWKT=function(wkt){var geom;if(OpenLayers.Format&&OpenLayers.Format.WKT){var format=OpenLayers.Geometry.fromWKT.format;if(!format){format=new OpenLayers.Format.WKT;OpenLayers.Geometry.fromWKT.format=format}var result=format.read(wkt);if(result instanceof OpenLayers.Feature.Vector){geom=result.geometry}else if(OpenLayers.Util.isArray(result)){var len=result.length;var components=new Array(len);for(var i=0;i<len;++i){components[i]=result[i].geometry}geom=new OpenLayers.Geometry.Collection(components)}}return geom};OpenLayers.Geometry.segmentsIntersect=function(seg1,seg2,options){var point=options&&options.point;var tolerance=options&&options.tolerance;var intersection=false;var x11_21=seg1.x1-seg2.x1;var y11_21=seg1.y1-seg2.y1;var x12_11=seg1.x2-seg1.x1;var y12_11=seg1.y2-seg1.y1;var y22_21=seg2.y2-seg2.y1;var x22_21=seg2.x2-seg2.x1;var d=y22_21*x12_11-x22_21*y12_11;var n1=x22_21*y11_21-y22_21*x11_21;var n2=x12_11*y11_21-y12_11*x11_21;if(d==0){if(n1==0&&n2==0){intersection=true}}else{var along1=n1/d;var along2=n2/d;if(along1>=0&&along1<=1&&along2>=0&&along2<=1){if(!point){intersection=true}else{var x=seg1.x1+along1*x12_11;var y=seg1.y1+along1*y12_11;intersection=new OpenLayers.Geometry.Point(x,y)}}}if(tolerance){var dist;if(intersection){if(point){var segs=[seg1,seg2];var seg,x,y;outer:for(var i=0;i<2;++i){seg=segs[i];for(var j=1;j<3;++j){x=seg["x"+j];y=seg["y"+j];dist=Math.sqrt(Math.pow(x-intersection.x,2)+Math.pow(y-intersection.y,2));if(dist<tolerance){intersection.x=x;intersection.y=y;break outer}}}}}else{var segs=[seg1,seg2];var source,target,x,y,p,result;outer:for(var i=0;i<2;++i){source=segs[i];target=segs[(i+1)%2];for(var j=1;j<3;++j){p={x:source["x"+j],y:source["y"+j]};result=OpenLayers.Geometry.distanceToSegment(p,target);if(result.distance<tolerance){if(point){intersection=new OpenLayers.Geometry.Point(p.x,p.y)}else{intersection=true}break outer}}}}}return intersection};OpenLayers.Geometry.distanceToSegment=function(point,segment){var result=OpenLayers.Geometry.distanceSquaredToSegment(point,segment);result.distance=Math.sqrt(result.distance);return result};OpenLayers.Geometry.distanceSquaredToSegment=function(point,segment){var x0=point.x;var y0=point.y;var x1=segment.x1;var y1=segment.y1;var x2=segment.x2;var y2=segment.y2;var dx=x2-x1;var dy=y2-y1;var along=(dx*(x0-x1)+dy*(y0-y1))/(Math.pow(dx,2)+Math.pow(dy,2));var x,y;if(along<=0){x=x1;y=y1}else if(along>=1){x=x2;y=y2}else{x=x1+along*dx;y=y1+along*dy}return{distance:Math.pow(x-x0,2)+Math.pow(y-y0,2),x:x,y:y,along:along}};OpenLayers.Geometry.Collection=OpenLayers.Class(OpenLayers.Geometry,{components:null,componentTypes:null,initialize:function(components){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.components=[];if(components!=null){this.addComponents(components)}},destroy:function(){this.components.length=0;this.components=null;OpenLayers.Geometry.prototype.destroy.apply(this,arguments)},clone:function(){var geometry=eval("new "+this.CLASS_NAME+"()");for(var i=0,len=this.components.length;i<len;i++){geometry.addComponent(this.components[i].clone())}OpenLayers.Util.applyDefaults(geometry,this);return geometry},getComponentsString:function(){var strings=[];for(var i=0,len=this.components.length;i<len;i++){strings.push(this.components[i].toShortString())}return strings.join(",")},calculateBounds:function(){this.bounds=null;var bounds=new OpenLayers.Bounds;var components=this.components;if(components){for(var i=0,len=components.length;i<len;i++){bounds.extend(components[i].getBounds())}}if(bounds.left!=null&&bounds.bottom!=null&&bounds.right!=null&&bounds.top!=null){this.setBounds(bounds)}},addComponents:function(components){if(!OpenLayers.Util.isArray(components)){components=[components]}for(var i=0,len=components.length;i<len;i++){this.addComponent(components[i])}},addComponent:function(component,index){var added=false;if(component){if(this.componentTypes==null||OpenLayers.Util.indexOf(this.componentTypes,component.CLASS_NAME)>-1){if(index!=null&&index<this.components.length){var components1=this.components.slice(0,index);var components2=this.components.slice(index,this.components.length);components1.push(component);this.components=components1.concat(components2)}else{this.components.push(component)}component.parent=this;this.clearBounds();added=true}}return added},removeComponents:function(components){var removed=false;if(!OpenLayers.Util.isArray(components)){components=[components]}for(var i=components.length-1;i>=0;--i){removed=this.removeComponent(components[i])||removed}return removed},removeComponent:function(component){OpenLayers.Util.removeItem(this.components,component);this.clearBounds();return true},getLength:function(){var length=0;for(var i=0,len=this.components.length;i<len;i++){length+=this.components[i].getLength()}return length},getArea:function(){var area=0;for(var i=0,len=this.components.length;i<len;i++){area+=this.components[i].getArea()}return area},getGeodesicArea:function(projection){var area=0;for(var i=0,len=this.components.length;i<len;i++){area+=this.components[i].getGeodesicArea(projection)}return area},getCentroid:function(weighted){if(!weighted){return this.components.length&&this.components[0].getCentroid()}var len=this.components.length;if(!len){return false}var areas=[];var centroids=[];var areaSum=0;var minArea=Number.MAX_VALUE;var component;for(var i=0;i<len;++i){component=this.components[i];var area=component.getArea();var centroid=component.getCentroid(true);if(isNaN(area)||isNaN(centroid.x)||isNaN(centroid.y)){continue}areas.push(area);areaSum+=area;minArea=area<minArea&&area>0?area:minArea;centroids.push(centroid)
}len=areas.length;if(areaSum===0){for(var i=0;i<len;++i){areas[i]=1}areaSum=areas.length}else{for(var i=0;i<len;++i){areas[i]/=minArea}areaSum/=minArea}var xSum=0,ySum=0,centroid,area;for(var i=0;i<len;++i){centroid=centroids[i];area=areas[i];xSum+=centroid.x*area;ySum+=centroid.y*area}return new OpenLayers.Geometry.Point(xSum/areaSum,ySum/areaSum)},getGeodesicLength:function(projection){var length=0;for(var i=0,len=this.components.length;i<len;i++){length+=this.components[i].getGeodesicLength(projection)}return length},move:function(x,y){for(var i=0,len=this.components.length;i<len;i++){this.components[i].move(x,y)}},rotate:function(angle,origin){for(var i=0,len=this.components.length;i<len;++i){this.components[i].rotate(angle,origin)}},resize:function(scale,origin,ratio){for(var i=0;i<this.components.length;++i){this.components[i].resize(scale,origin,ratio)}return this},distanceTo:function(geometry,options){var edge=!(options&&options.edge===false);var details=edge&&options&&options.details;var result,best,distance;var min=Number.POSITIVE_INFINITY;for(var i=0,len=this.components.length;i<len;++i){result=this.components[i].distanceTo(geometry,options);distance=details?result.distance:result;if(distance<min){min=distance;best=result;if(min==0){break}}}return best},equals:function(geometry){var equivalent=true;if(!geometry||!geometry.CLASS_NAME||this.CLASS_NAME!=geometry.CLASS_NAME){equivalent=false}else if(!OpenLayers.Util.isArray(geometry.components)||geometry.components.length!=this.components.length){equivalent=false}else{for(var i=0,len=this.components.length;i<len;++i){if(!this.components[i].equals(geometry.components[i])){equivalent=false;break}}}return equivalent},transform:function(source,dest){if(source&&dest){for(var i=0,len=this.components.length;i<len;i++){var component=this.components[i];component.transform(source,dest)}this.bounds=null}return this},intersects:function(geometry){var intersect=false;for(var i=0,len=this.components.length;i<len;++i){intersect=geometry.intersects(this.components[i]);if(intersect){break}}return intersect},getVertices:function(nodes){var vertices=[];for(var i=0,len=this.components.length;i<len;++i){Array.prototype.push.apply(vertices,this.components[i].getVertices(nodes))}return vertices},CLASS_NAME:"OpenLayers.Geometry.Collection"});OpenLayers.Geometry.Point=OpenLayers.Class(OpenLayers.Geometry,{x:null,y:null,initialize:function(x,y){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.x=parseFloat(x);this.y=parseFloat(y)},clone:function(obj){if(obj==null){obj=new OpenLayers.Geometry.Point(this.x,this.y)}OpenLayers.Util.applyDefaults(obj,this);return obj},calculateBounds:function(){this.bounds=new OpenLayers.Bounds(this.x,this.y,this.x,this.y)},distanceTo:function(geometry,options){var edge=!(options&&options.edge===false);var details=edge&&options&&options.details;var distance,x0,y0,x1,y1,result;if(geometry instanceof OpenLayers.Geometry.Point){x0=this.x;y0=this.y;x1=geometry.x;y1=geometry.y;distance=Math.sqrt(Math.pow(x0-x1,2)+Math.pow(y0-y1,2));result=!details?distance:{x0:x0,y0:y0,x1:x1,y1:y1,distance:distance}}else{result=geometry.distanceTo(this,options);if(details){result={x0:result.x1,y0:result.y1,x1:result.x0,y1:result.y0,distance:result.distance}}}return result},equals:function(geom){var equals=false;if(geom!=null){equals=this.x==geom.x&&this.y==geom.y||isNaN(this.x)&&isNaN(this.y)&&isNaN(geom.x)&&isNaN(geom.y)}return equals},toShortString:function(){return this.x+", "+this.y},move:function(x,y){this.x=this.x+x;this.y=this.y+y;this.clearBounds()},rotate:function(angle,origin){angle*=Math.PI/180;var radius=this.distanceTo(origin);var theta=angle+Math.atan2(this.y-origin.y,this.x-origin.x);this.x=origin.x+radius*Math.cos(theta);this.y=origin.y+radius*Math.sin(theta);this.clearBounds()},getCentroid:function(){return new OpenLayers.Geometry.Point(this.x,this.y)},resize:function(scale,origin,ratio){ratio=ratio==undefined?1:ratio;this.x=origin.x+scale*ratio*(this.x-origin.x);this.y=origin.y+scale*(this.y-origin.y);this.clearBounds();return this},intersects:function(geometry){var intersect=false;if(geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){intersect=this.equals(geometry)}else{intersect=geometry.intersects(this)}return intersect},transform:function(source,dest){if(source&&dest){OpenLayers.Projection.transform(this,source,dest);this.bounds=null}return this},getVertices:function(nodes){return[this]},CLASS_NAME:"OpenLayers.Geometry.Point"});OpenLayers.Geometry.MultiPoint=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.Point"],addPoint:function(point,index){this.addComponent(point,index)},removePoint:function(point){this.removeComponent(point)},CLASS_NAME:"OpenLayers.Geometry.MultiPoint"});OpenLayers.Geometry.Curve=OpenLayers.Class(OpenLayers.Geometry.MultiPoint,{componentTypes:["OpenLayers.Geometry.Point"],getLength:function(){var length=0;if(this.components&&this.components.length>1){for(var i=1,len=this.components.length;i<len;i++){length+=this.components[i-1].distanceTo(this.components[i])}}return length},getGeodesicLength:function(projection){var geom=this;if(projection){var gg=new OpenLayers.Projection("EPSG:4326");if(!gg.equals(projection)){geom=this.clone().transform(projection,gg)}}var length=0;if(geom.components&&geom.components.length>1){var p1,p2;for(var i=1,len=geom.components.length;i<len;i++){p1=geom.components[i-1];p2=geom.components[i];length+=OpenLayers.Util.distVincenty({lon:p1.x,lat:p1.y},{lon:p2.x,lat:p2.y})}}return length*1e3},CLASS_NAME:"OpenLayers.Geometry.Curve"});OpenLayers.Geometry.LineString=OpenLayers.Class(OpenLayers.Geometry.Curve,{removeComponent:function(point){var removed=this.components&&this.components.length>2;if(removed){OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments)}return removed},intersects:function(geometry){var intersect=false;var type=geometry.CLASS_NAME;if(type=="OpenLayers.Geometry.LineString"||type=="OpenLayers.Geometry.LinearRing"||type=="OpenLayers.Geometry.Point"){var segs1=this.getSortedSegments();var segs2;if(type=="OpenLayers.Geometry.Point"){segs2=[{x1:geometry.x,y1:geometry.y,x2:geometry.x,y2:geometry.y}]}else{segs2=geometry.getSortedSegments()}var seg1,seg1x1,seg1x2,seg1y1,seg1y2,seg2,seg2y1,seg2y2;outer:for(var i=0,len=segs1.length;i<len;++i){seg1=segs1[i];seg1x1=seg1.x1;seg1x2=seg1.x2;seg1y1=seg1.y1;seg1y2=seg1.y2;inner:for(var j=0,jlen=segs2.length;j<jlen;++j){seg2=segs2[j];if(seg2.x1>seg1x2){break}if(seg2.x2<seg1x1){continue}seg2y1=seg2.y1;seg2y2=seg2.y2;if(Math.min(seg2y1,seg2y2)>Math.max(seg1y1,seg1y2)){continue}if(Math.max(seg2y1,seg2y2)<Math.min(seg1y1,seg1y2)){continue}if(OpenLayers.Geometry.segmentsIntersect(seg1,seg2)){intersect=true;break outer}}}}else{intersect=geometry.intersects(this)}return intersect},getSortedSegments:function(){var numSeg=this.components.length-1;var segments=new Array(numSeg),point1,point2;for(var i=0;i<numSeg;++i){point1=this.components[i];point2=this.components[i+1];if(point1.x<point2.x){segments[i]={x1:point1.x,y1:point1.y,x2:point2.x,y2:point2.y}}else{segments[i]={x1:point2.x,y1:point2.y,x2:point1.x,y2:point1.y}}}function byX1(seg1,seg2){return seg1.x1-seg2.x1}return segments.sort(byX1)},splitWithSegment:function(seg,options){var edge=!(options&&options.edge===false);var tolerance=options&&options.tolerance;var lines=[];var verts=this.getVertices();var points=[];var intersections=[];var split=false;var vert1,vert2,point;var node,vertex,target;var interOptions={point:true,tolerance:tolerance};var result=null;for(var i=0,stop=verts.length-2;i<=stop;++i){vert1=verts[i];points.push(vert1.clone());vert2=verts[i+1];target={x1:vert1.x,y1:vert1.y,x2:vert2.x,y2:vert2.y};point=OpenLayers.Geometry.segmentsIntersect(seg,target,interOptions);if(point instanceof OpenLayers.Geometry.Point){if(point.x===seg.x1&&point.y===seg.y1||point.x===seg.x2&&point.y===seg.y2||point.equals(vert1)||point.equals(vert2)){vertex=true}else{vertex=false}if(vertex||edge){if(!point.equals(intersections[intersections.length-1])){intersections.push(point.clone())}if(i===0){if(point.equals(vert1)){continue}}if(point.equals(vert2)){continue}split=true;if(!point.equals(vert1)){points.push(point)}lines.push(new OpenLayers.Geometry.LineString(points));points=[point.clone()]}}}if(split){points.push(vert2.clone());lines.push(new OpenLayers.Geometry.LineString(points))}if(intersections.length>0){var xDir=seg.x1<seg.x2?1:-1;var yDir=seg.y1<seg.y2?1:-1;result={lines:lines,points:intersections.sort(function(p1,p2){return xDir*p1.x-xDir*p2.x||yDir*p1.y-yDir*p2.y})}}return result},split:function(target,options){var results=null;var mutual=options&&options.mutual;var sourceSplit,targetSplit,sourceParts,targetParts;if(target instanceof OpenLayers.Geometry.LineString){var verts=this.getVertices();var vert1,vert2,seg,splits,lines,point;var points=[];sourceParts=[];for(var i=0,stop=verts.length-2;i<=stop;++i){vert1=verts[i];vert2=verts[i+1];seg={x1:vert1.x,y1:vert1.y,x2:vert2.x,y2:vert2.y};targetParts=targetParts||[target];if(mutual){points.push(vert1.clone())}for(var j=0;j<targetParts.length;++j){splits=targetParts[j].splitWithSegment(seg,options);if(splits){lines=splits.lines;if(lines.length>0){lines.unshift(j,1);Array.prototype.splice.apply(targetParts,lines);j+=lines.length-2}if(mutual){for(var k=0,len=splits.points.length;k<len;++k){point=splits.points[k];if(!point.equals(vert1)){points.push(point);sourceParts.push(new OpenLayers.Geometry.LineString(points));if(point.equals(vert2)){points=[]}else{points=[point.clone()]}}}}}}}if(mutual&&sourceParts.length>0&&points.length>0){points.push(vert2.clone());sourceParts.push(new OpenLayers.Geometry.LineString(points))}}else{results=target.splitWith(this,options)}if(targetParts&&targetParts.length>1){targetSplit=true}else{targetParts=[]}if(sourceParts&&sourceParts.length>1){sourceSplit=true}else{sourceParts=[]}if(targetSplit||sourceSplit){if(mutual){results=[sourceParts,targetParts]}else{results=targetParts}}return results},splitWith:function(geometry,options){return geometry.split(this,options)},getVertices:function(nodes){var vertices;if(nodes===true){vertices=[this.components[0],this.components[this.components.length-1]]}else if(nodes===false){vertices=this.components.slice(1,this.components.length-1)}else{vertices=this.components.slice()}return vertices},distanceTo:function(geometry,options){var edge=!(options&&options.edge===false);var details=edge&&options&&options.details;var result,best={};var min=Number.POSITIVE_INFINITY;if(geometry instanceof OpenLayers.Geometry.Point){var segs=this.getSortedSegments();var x=geometry.x;var y=geometry.y;var seg;for(var i=0,len=segs.length;i<len;++i){seg=segs[i];result=OpenLayers.Geometry.distanceToSegment(geometry,seg);if(result.distance<min){min=result.distance;best=result;if(min===0){break}}else{if(seg.x2>x&&(y>seg.y1&&y<seg.y2||y<seg.y1&&y>seg.y2)){break}}}if(details){best={distance:best.distance,x0:best.x,y0:best.y,x1:x,y1:y}}else{best=best.distance}}else if(geometry instanceof OpenLayers.Geometry.LineString){var segs0=this.getSortedSegments();var segs1=geometry.getSortedSegments();var seg0,seg1,intersection,x0,y0;var len1=segs1.length;var interOptions={point:true};outer:for(var i=0,len=segs0.length;i<len;++i){seg0=segs0[i];x0=seg0.x1;y0=seg0.y1;for(var j=0;j<len1;++j){seg1=segs1[j];intersection=OpenLayers.Geometry.segmentsIntersect(seg0,seg1,interOptions);if(intersection){min=0;best={distance:0,x0:intersection.x,y0:intersection.y,x1:intersection.x,y1:intersection.y};break outer}else{result=OpenLayers.Geometry.distanceToSegment({x:x0,y:y0},seg1);if(result.distance<min){min=result.distance;best={distance:min,x0:x0,y0:y0,x1:result.x,y1:result.y}}}}}if(!details){best=best.distance}if(min!==0){if(seg0){result=geometry.distanceTo(new OpenLayers.Geometry.Point(seg0.x2,seg0.y2),options);var dist=details?result.distance:result;if(dist<min){if(details){best={distance:min,x0:result.x1,y0:result.y1,x1:result.x0,y1:result.y0}}else{best=dist}}}}}else{best=geometry.distanceTo(this,options);if(details){best={distance:best.distance,x0:best.x1,y0:best.y1,x1:best.x0,y1:best.y0}}}return best},simplify:function(tolerance){if(this&&this!==null){var points=this.getVertices();if(points.length<3){return this}var compareNumbers=function(a,b){return a-b};var douglasPeuckerReduction=function(points,firstPoint,lastPoint,tolerance){var maxDistance=0;var indexFarthest=0;for(var index=firstPoint,distance;index<lastPoint;index++){distance=perpendicularDistance(points[firstPoint],points[lastPoint],points[index]);if(distance>maxDistance){maxDistance=distance;indexFarthest=index}}if(maxDistance>tolerance&&indexFarthest!=firstPoint){pointIndexsToKeep.push(indexFarthest);douglasPeuckerReduction(points,firstPoint,indexFarthest,tolerance);douglasPeuckerReduction(points,indexFarthest,lastPoint,tolerance)}};var perpendicularDistance=function(point1,point2,point){var area=Math.abs(.5*(point1.x*point2.y+point2.x*point.y+point.x*point1.y-point2.x*point1.y-point.x*point2.y-point1.x*point.y));var bottom=Math.sqrt(Math.pow(point1.x-point2.x,2)+Math.pow(point1.y-point2.y,2));var height=area/bottom*2;return height};var firstPoint=0;var lastPoint=points.length-1;var pointIndexsToKeep=[];pointIndexsToKeep.push(firstPoint);pointIndexsToKeep.push(lastPoint);while(points[firstPoint].equals(points[lastPoint])){lastPoint--;pointIndexsToKeep.push(lastPoint)}douglasPeuckerReduction(points,firstPoint,lastPoint,tolerance);var returnPoints=[];pointIndexsToKeep.sort(compareNumbers);for(var index=0;index<pointIndexsToKeep.length;index++){returnPoints.push(points[pointIndexsToKeep[index]])}return new OpenLayers.Geometry.LineString(returnPoints)}else{return this}},CLASS_NAME:"OpenLayers.Geometry.LineString"});OpenLayers.Geometry.LinearRing=OpenLayers.Class(OpenLayers.Geometry.LineString,{componentTypes:["OpenLayers.Geometry.Point"],addComponent:function(point,index){var added=false;var lastPoint=this.components.pop();if(index!=null||!point.equals(lastPoint)){added=OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,arguments)}var firstPoint=this.components[0];OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[firstPoint]);return added},removeComponent:function(point){var removed=this.components&&this.components.length>3;if(removed){this.components.pop();OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);var firstPoint=this.components[0];OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[firstPoint])}return removed},move:function(x,y){for(var i=0,len=this.components.length;i<len-1;i++){this.components[i].move(x,y)}},rotate:function(angle,origin){for(var i=0,len=this.components.length;i<len-1;++i){this.components[i].rotate(angle,origin)}},resize:function(scale,origin,ratio){for(var i=0,len=this.components.length;i<len-1;++i){this.components[i].resize(scale,origin,ratio)}return this},transform:function(source,dest){if(source&&dest){for(var i=0,len=this.components.length;i<len-1;i++){var component=this.components[i];component.transform(source,dest)}this.bounds=null}return this},getCentroid:function(){if(this.components){var len=this.components.length;if(len>0&&len<=2){return this.components[0].clone()}else if(len>2){var sumX=0;var sumY=0;var x0=this.components[0].x;var y0=this.components[0].y;var area=-1*this.getArea();if(area!=0){for(var i=0;i<len-1;i++){var b=this.components[i];var c=this.components[i+1];sumX+=(b.x+c.x-2*x0)*((b.x-x0)*(c.y-y0)-(c.x-x0)*(b.y-y0));sumY+=(b.y+c.y-2*y0)*((b.x-x0)*(c.y-y0)-(c.x-x0)*(b.y-y0))}var x=x0+sumX/(6*area);var y=y0+sumY/(6*area)}else{for(var i=0;i<len-1;i++){sumX+=this.components[i].x;sumY+=this.components[i].y}var x=sumX/(len-1);var y=sumY/(len-1)}return new OpenLayers.Geometry.Point(x,y)}else{return null}}},getArea:function(){var area=0;if(this.components&&this.components.length>2){var sum=0;for(var i=0,len=this.components.length;i<len-1;i++){var b=this.components[i];var c=this.components[i+1];sum+=(b.x+c.x)*(c.y-b.y)}area=-sum/2}return area},getGeodesicArea:function(projection){var ring=this;if(projection){var gg=new OpenLayers.Projection("EPSG:4326");if(!gg.equals(projection)){ring=this.clone().transform(projection,gg)}}var area=0;var len=ring.components&&ring.components.length;if(len>2){var p1,p2;for(var i=0;i<len-1;i++){p1=ring.components[i];p2=ring.components[i+1];area+=OpenLayers.Util.rad(p2.x-p1.x)*(2+Math.sin(OpenLayers.Util.rad(p1.y))+Math.sin(OpenLayers.Util.rad(p2.y)))}area=area*6378137*6378137/2}return area},containsPoint:function(point){var approx=OpenLayers.Number.limitSigDigs;var digs=14;var px=approx(point.x,digs);var py=approx(point.y,digs);function getX(y,x1,y1,x2,y2){return(y-y2)*((x2-x1)/(y2-y1))+x2}var numSeg=this.components.length-1;var start,end,x1,y1,x2,y2,cx,cy;var crosses=0;for(var i=0;i<numSeg;++i){start=this.components[i];x1=approx(start.x,digs);y1=approx(start.y,digs);end=this.components[i+1];x2=approx(end.x,digs);y2=approx(end.y,digs);if(y1==y2){if(py==y1){if(x1<=x2&&(px>=x1&&px<=x2)||x1>=x2&&(px<=x1&&px>=x2)){crosses=-1;break}}continue}cx=approx(getX(py,x1,y1,x2,y2),digs);if(cx==px){if(y1<y2&&(py>=y1&&py<=y2)||y1>y2&&(py<=y1&&py>=y2)){crosses=-1;break}}if(cx<=px){continue}if(x1!=x2&&(cx<Math.min(x1,x2)||cx>Math.max(x1,x2))){continue}if(y1<y2&&(py>=y1&&py<y2)||y1>y2&&(py<y1&&py>=y2)){++crosses}}var contained=crosses==-1?1:!!(crosses&1);return contained},intersects:function(geometry){var intersect=false;if(geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){intersect=this.containsPoint(geometry)}else if(geometry.CLASS_NAME=="OpenLayers.Geometry.LineString"){intersect=geometry.intersects(this)}else if(geometry.CLASS_NAME=="OpenLayers.Geometry.LinearRing"){intersect=OpenLayers.Geometry.LineString.prototype.intersects.apply(this,[geometry])}else{for(var i=0,len=geometry.components.length;i<len;++i){intersect=geometry.components[i].intersects(this);if(intersect){break}}}return intersect},getVertices:function(nodes){return nodes===true?[]:this.components.slice(0,this.components.length-1)},CLASS_NAME:"OpenLayers.Geometry.LinearRing"});OpenLayers.Util=OpenLayers.Util||{};OpenLayers.Util.vendorPrefix=function(){"use strict";var VENDOR_PREFIXES=["","O","ms","Moz","Webkit"],divStyle=document.createElement("div").style,cssCache={},jsCache={};function domToCss(prefixedDom){if(!prefixedDom){return null}return prefixedDom.replace(/([A-Z])/g,function(c){return"-"+c.toLowerCase()}).replace(/^ms-/,"-ms-")}function css(property){if(cssCache[property]===undefined){var domProperty=property.replace(/(-[\s\S])/g,function(c){return c.charAt(1).toUpperCase()});var prefixedDom=style(domProperty);cssCache[property]=domToCss(prefixedDom)}return cssCache[property]}function js(obj,property){if(jsCache[property]===undefined){var tmpProp,i=0,l=VENDOR_PREFIXES.length,prefix,isStyleObj=typeof obj.cssText!=="undefined";jsCache[property]=null;for(;i<l;i++){prefix=VENDOR_PREFIXES[i];if(prefix){if(!isStyleObj){prefix=prefix.toLowerCase()}tmpProp=prefix+property.charAt(0).toUpperCase()+property.slice(1)}else{tmpProp=property}if(obj[tmpProp]!==undefined){jsCache[property]=tmpProp;break}}}return jsCache[property]}function style(property){return js(divStyle,property)}return{css:css,js:js,style:style,cssCache:cssCache,jsCache:jsCache}}();OpenLayers.Animation=function(window){var requestAnimationFrame=OpenLayers.Util.vendorPrefix.js(window,"requestAnimationFrame");var isNative=!!requestAnimationFrame;var requestFrame=function(){var request=window[requestAnimationFrame]||function(callback,element){window.setTimeout(callback,16)};return function(callback,element){request.apply(window,[callback,element])}}();var counter=0;var loops={};function start(callback,duration,element){duration=duration>0?duration:Number.POSITIVE_INFINITY;var id=++counter;var start=+new Date;loops[id]=function(){if(loops[id]&&+new Date-start<=duration){callback();if(loops[id]){requestFrame(loops[id],element)}}else{delete loops[id]}};requestFrame(loops[id],element);return id}function stop(id){delete loops[id]}return{isNative:isNative,requestFrame:requestFrame,start:start,stop:stop}}(window);OpenLayers.Tween=OpenLayers.Class({easing:null,begin:null,finish:null,duration:null,callbacks:null,time:null,minFrameRate:null,startTime:null,animationId:null,playing:false,initialize:function(easing){this.easing=easing?easing:OpenLayers.Easing.Expo.easeOut},start:function(begin,finish,duration,options){this.playing=true;this.begin=begin;this.finish=finish;this.duration=duration;this.callbacks=options.callbacks;this.minFrameRate=options.minFrameRate||30;this.time=0;this.startTime=(new Date).getTime();OpenLayers.Animation.stop(this.animationId);this.animationId=null;if(this.callbacks&&this.callbacks.start){this.callbacks.start.call(this,this.begin)}this.animationId=OpenLayers.Animation.start(OpenLayers.Function.bind(this.play,this))},stop:function(){if(!this.playing){return}if(this.callbacks&&this.callbacks.done){this.callbacks.done.call(this,this.finish)}OpenLayers.Animation.stop(this.animationId);this.animationId=null;this.playing=false},play:function(){var value={};for(var i in this.begin){var b=this.begin[i];var f=this.finish[i];if(b==null||f==null||isNaN(b)||isNaN(f)){throw new TypeError("invalid value for Tween")}var c=f-b;value[i]=this.easing.apply(this,[this.time,b,c,this.duration])}this.time++;if(this.callbacks&&this.callbacks.eachStep){if(((new Date).getTime()-this.startTime)/this.time<=1e3/this.minFrameRate){this.callbacks.eachStep.call(this,value)}}if(this.time>this.duration){this.stop()}},CLASS_NAME:"OpenLayers.Tween"});OpenLayers.Easing={CLASS_NAME:"OpenLayers.Easing"};OpenLayers.Easing.Linear={easeIn:function(t,b,c,d){return c*t/d+b},easeOut:function(t,b,c,d){return c*t/d+b},easeInOut:function(t,b,c,d){return c*t/d+b},CLASS_NAME:"OpenLayers.Easing.Linear"};OpenLayers.Easing.Expo={easeIn:function(t,b,c,d){return t==0?b:c*Math.pow(2,10*(t/d-1))+b},easeOut:function(t,b,c,d){return t==d?b+c:c*(-Math.pow(2,-10*t/d)+1)+b},easeInOut:function(t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b},CLASS_NAME:"OpenLayers.Easing.Expo"};OpenLayers.Easing.Quad={easeIn:function(t,b,c,d){return c*(t/=d)*t+b},easeOut:function(t,b,c,d){return-c*(t/=d)*(t-2)+b},easeInOut:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*(--t*(t-2)-1)+b},CLASS_NAME:"OpenLayers.Easing.Quad"};OpenLayers.Projection=OpenLayers.Class({proj:null,projCode:null,titleRegEx:/\+title=[^\+]*/,initialize:function(projCode,options){OpenLayers.Util.extend(this,options);this.projCode=projCode;if(typeof Proj4js=="object"){this.proj=new Proj4js.Proj(projCode)}},getCode:function(){return this.proj?this.proj.srsCode:this.projCode},getUnits:function(){return this.proj?this.proj.units:null},toString:function(){return this.getCode()},equals:function(projection){var p=projection,equals=false;if(p){if(!(p instanceof OpenLayers.Projection)){p=new OpenLayers.Projection(p)}if(typeof Proj4js=="object"&&this.proj.defData&&p.proj.defData){equals=this.proj.defData.replace(this.titleRegEx,"")==p.proj.defData.replace(this.titleRegEx,"")}else if(p.getCode){var source=this.getCode(),target=p.getCode();equals=source==target||!!OpenLayers.Projection.transforms[source]&&OpenLayers.Projection.transforms[source][target]===OpenLayers.Projection.nullTransform}}return equals},destroy:function(){delete this.proj;delete this.projCode},CLASS_NAME:"OpenLayers.Projection"});OpenLayers.Projection.transforms={};OpenLayers.Projection.defaults={"EPSG:4326":{units:"degrees",maxExtent:[-180,-90,180,90],yx:true},"CRS:84":{units:"degrees",maxExtent:[-180,-90,180,90]},"EPSG:900913":{units:"m",maxExtent:[-20037508.34,-20037508.34,20037508.34,20037508.34]}};OpenLayers.Projection.addTransform=function(from,to,method){if(method===OpenLayers.Projection.nullTransform){var defaults=OpenLayers.Projection.defaults[from];if(defaults&&!OpenLayers.Projection.defaults[to]){OpenLayers.Projection.defaults[to]=defaults}}if(!OpenLayers.Projection.transforms[from]){OpenLayers.Projection.transforms[from]={}}OpenLayers.Projection.transforms[from][to]=method};OpenLayers.Projection.transform=function(point,source,dest){if(source&&dest){if(!(source instanceof OpenLayers.Projection)){source=new OpenLayers.Projection(source)}if(!(dest instanceof OpenLayers.Projection)){dest=new OpenLayers.Projection(dest)}if(source.proj&&dest.proj){point=Proj4js.transform(source.proj,dest.proj,point)}else{var sourceCode=source.getCode();var destCode=dest.getCode();var transforms=OpenLayers.Projection.transforms;if(transforms[sourceCode]&&transforms[sourceCode][destCode]){transforms[sourceCode][destCode](point)}}}return point};OpenLayers.Projection.nullTransform=function(point){return point};(function(){var pole=20037508.34;function inverseMercator(xy){xy.x=180*xy.x/pole;xy.y=180/Math.PI*(2*Math.atan(Math.exp(xy.y/pole*Math.PI))-Math.PI/2);return xy}function forwardMercator(xy){xy.x=xy.x*pole/180;var y=Math.log(Math.tan((90+xy.y)*Math.PI/360))/Math.PI*pole;xy.y=Math.max(-20037508.34,Math.min(y,20037508.34));return xy}function map(base,codes){var add=OpenLayers.Projection.addTransform;var same=OpenLayers.Projection.nullTransform;var i,len,code,other,j;for(i=0,len=codes.length;i<len;++i){code=codes[i];add(base,code,forwardMercator);add(code,base,inverseMercator);for(j=i+1;j<len;++j){other=codes[j];add(code,other,same);add(other,code,same)}}}var mercator=["EPSG:900913","EPSG:3857","EPSG:102113","EPSG:102100"],geographic=["CRS:84","urn:ogc:def:crs:EPSG:6.6:4326","EPSG:4326"],i;for(i=mercator.length-1;i>=0;--i){map(mercator[i],geographic)}for(i=geographic.length-1;i>=0;--i){map(geographic[i],mercator)}})();OpenLayers.Map=OpenLayers.Class({Z_INDEX_BASE:{BaseLayer:100,Overlay:325,Feature:725,Popup:750,Control:1e3},id:null,fractionalZoom:false,events:null,allOverlays:false,div:null,dragging:false,size:null,viewPortDiv:null,layerContainerOrigin:null,layerContainerDiv:null,layers:null,controls:null,popups:null,baseLayer:null,center:null,resolution:null,zoom:0,panRatio:1.5,options:null,tileSize:null,projection:"EPSG:4326",units:null,resolutions:null,maxResolution:null,minResolution:null,maxScale:null,minScale:null,maxExtent:null,minExtent:null,restrictedExtent:null,numZoomLevels:16,theme:null,displayProjection:null,fallThrough:false,autoUpdateSize:true,eventListeners:null,panTween:null,panMethod:OpenLayers.Easing.Expo.easeOut,panDuration:50,zoomTween:null,zoomMethod:OpenLayers.Easing.Quad.easeOut,zoomDuration:20,paddingForPopups:null,layerContainerOriginPx:null,minPx:null,maxPx:null,initialize:function(div,options){if(arguments.length===1&&typeof div==="object"){options=div;div=options&&options.div}this.tileSize=new OpenLayers.Size(OpenLayers.Map.TILE_WIDTH,OpenLayers.Map.TILE_HEIGHT);this.paddingForPopups=new OpenLayers.Bounds(15,15,15,15);this.theme=OpenLayers._getScriptLocation()+"theme/default/style.css";this.options=OpenLayers.Util.extend({},options);OpenLayers.Util.extend(this,options);var projCode=this.projection instanceof OpenLayers.Projection?this.projection.projCode:this.projection;OpenLayers.Util.applyDefaults(this,OpenLayers.Projection.defaults[projCode]);if(this.maxExtent&&!(this.maxExtent instanceof OpenLayers.Bounds)){this.maxExtent=new OpenLayers.Bounds(this.maxExtent)}if(this.minExtent&&!(this.minExtent instanceof OpenLayers.Bounds)){this.minExtent=new OpenLayers.Bounds(this.minExtent)}if(this.restrictedExtent&&!(this.restrictedExtent instanceof OpenLayers.Bounds)){this.restrictedExtent=new OpenLayers.Bounds(this.restrictedExtent)}if(this.center&&!(this.center instanceof OpenLayers.LonLat)){this.center=new OpenLayers.LonLat(this.center)}this.layers=[];this.id=OpenLayers.Util.createUniqueID("OpenLayers.Map_");this.div=OpenLayers.Util.getElement(div);if(!this.div){this.div=document.createElement("div");this.div.style.height="1px";this.div.style.width="1px"}OpenLayers.Element.addClass(this.div,"olMap");var id=this.id+"_OpenLayers_ViewPort";this.viewPortDiv=OpenLayers.Util.createDiv(id,null,null,null,"relative",null,"hidden");this.viewPortDiv.style.width="100%";this.viewPortDiv.style.height="100%";this.viewPortDiv.className="olMapViewport";this.div.appendChild(this.viewPortDiv);this.events=new OpenLayers.Events(this,this.viewPortDiv,null,this.fallThrough,{includeXY:true});if(OpenLayers.TileManager&&this.tileManager!==null){if(!(this.tileManager instanceof OpenLayers.TileManager)){this.tileManager=new OpenLayers.TileManager(this.tileManager)}this.tileManager.addMap(this)}id=this.id+"_OpenLayers_Container";this.layerContainerDiv=OpenLayers.Util.createDiv(id);this.layerContainerDiv.style.zIndex=this.Z_INDEX_BASE["Popup"]-1;this.layerContainerOriginPx={x:0,y:0};this.applyTransform();this.viewPortDiv.appendChild(this.layerContainerDiv);this.updateSize();if(this.eventListeners instanceof Object){this.events.on(this.eventListeners)}if(this.autoUpdateSize===true){this.updateSizeDestroy=OpenLayers.Function.bind(this.updateSize,this);OpenLayers.Event.observe(window,"resize",this.updateSizeDestroy)}if(this.theme){var addNode=true;var nodes=document.getElementsByTagName("link");for(var i=0,len=nodes.length;i<len;++i){if(OpenLayers.Util.isEquivalentUrl(nodes.item(i).href,this.theme)){addNode=false;break}}if(addNode){var cssNode=document.createElement("link");cssNode.setAttribute("rel","stylesheet");cssNode.setAttribute("type","text/css");cssNode.setAttribute("href",this.theme);document.getElementsByTagName("head")[0].appendChild(cssNode)}}if(this.controls==null){this.controls=[];if(OpenLayers.Control!=null){if(OpenLayers.Control.Navigation){this.controls.push(new OpenLayers.Control.Navigation)}else if(OpenLayers.Control.TouchNavigation){this.controls.push(new OpenLayers.Control.TouchNavigation)}if(OpenLayers.Control.Zoom){this.controls.push(new OpenLayers.Control.Zoom)}else if(OpenLayers.Control.PanZoom){this.controls.push(new OpenLayers.Control.PanZoom)}if(OpenLayers.Control.ArgParser){this.controls.push(new OpenLayers.Control.ArgParser)}if(OpenLayers.Control.Attribution){this.controls.push(new OpenLayers.Control.Attribution)}}}for(var i=0,len=this.controls.length;i<len;i++){this.addControlToMap(this.controls[i])}this.popups=[];this.unloadDestroy=OpenLayers.Function.bind(this.destroy,this);OpenLayers.Event.observe(window,"unload",this.unloadDestroy);if(options&&options.layers){delete this.center;delete this.zoom;this.addLayers(options.layers);if(options.center&&!this.getCenter()){this.setCenter(options.center,options.zoom)}}if(this.panMethod){this.panTween=new OpenLayers.Tween(this.panMethod)}if(this.zoomMethod&&this.applyTransform.transform){this.zoomTween=new OpenLayers.Tween(this.zoomMethod)}},getViewport:function(){return this.viewPortDiv},render:function(div){this.div=OpenLayers.Util.getElement(div);OpenLayers.Element.addClass(this.div,"olMap");this.viewPortDiv.parentNode.removeChild(this.viewPortDiv);this.div.appendChild(this.viewPortDiv);this.updateSize()},unloadDestroy:null,updateSizeDestroy:null,destroy:function(){if(!this.unloadDestroy){return false}if(this.panTween){this.panTween.stop();this.panTween=null}if(this.zoomTween){this.zoomTween.stop();this.zoomTween=null}OpenLayers.Event.stopObserving(window,"unload",this.unloadDestroy);this.unloadDestroy=null;if(this.updateSizeDestroy){OpenLayers.Event.stopObserving(window,"resize",this.updateSizeDestroy)}this.paddingForPopups=null;if(this.controls!=null){for(var i=this.controls.length-1;i>=0;--i){this.controls[i].destroy()}this.controls=null}if(this.layers!=null){for(var i=this.layers.length-1;i>=0;--i){this.layers[i].destroy(false)}this.layers=null}if(this.viewPortDiv&&this.viewPortDiv.parentNode){this.viewPortDiv.parentNode.removeChild(this.viewPortDiv)}this.viewPortDiv=null;if(this.tileManager){this.tileManager.removeMap(this);this.tileManager=null}if(this.eventListeners){this.events.un(this.eventListeners);this.eventListeners=null}this.events.destroy();this.events=null;this.options=null},setOptions:function(options){var updatePxExtent=this.minPx&&options.restrictedExtent!=this.restrictedExtent;
OpenLayers.Util.extend(this,options);updatePxExtent&&this.moveTo(this.getCachedCenter(),this.zoom,{forceZoomChange:true})},getTileSize:function(){return this.tileSize},getBy:function(array,property,match){var test=typeof match.test=="function";var found=OpenLayers.Array.filter(this[array],function(item){return item[property]==match||test&&match.test(item[property])});return found},getLayersBy:function(property,match){return this.getBy("layers",property,match)},getLayersByName:function(match){return this.getLayersBy("name",match)},getLayersByClass:function(match){return this.getLayersBy("CLASS_NAME",match)},getControlsBy:function(property,match){return this.getBy("controls",property,match)},getControlsByClass:function(match){return this.getControlsBy("CLASS_NAME",match)},getLayer:function(id){var foundLayer=null;for(var i=0,len=this.layers.length;i<len;i++){var layer=this.layers[i];if(layer.id==id){foundLayer=layer;break}}return foundLayer},setLayerZIndex:function(layer,zIdx){layer.setZIndex(this.Z_INDEX_BASE[layer.isBaseLayer?"BaseLayer":"Overlay"]+zIdx*5)},resetLayersZIndex:function(){for(var i=0,len=this.layers.length;i<len;i++){var layer=this.layers[i];this.setLayerZIndex(layer,i)}},addLayer:function(layer){for(var i=0,len=this.layers.length;i<len;i++){if(this.layers[i]==layer){return false}}if(this.events.triggerEvent("preaddlayer",{layer:layer})===false){return false}if(this.allOverlays){layer.isBaseLayer=false}layer.div.className="olLayerDiv";layer.div.style.overflow="";this.setLayerZIndex(layer,this.layers.length);if(layer.isFixed){this.viewPortDiv.appendChild(layer.div)}else{this.layerContainerDiv.appendChild(layer.div)}this.layers.push(layer);layer.setMap(this);if(layer.isBaseLayer||this.allOverlays&&!this.baseLayer){if(this.baseLayer==null){this.setBaseLayer(layer)}else{layer.setVisibility(false)}}else{layer.redraw()}this.events.triggerEvent("addlayer",{layer:layer});layer.events.triggerEvent("added",{map:this,layer:layer});layer.afterAdd();return true},addLayers:function(layers){for(var i=0,len=layers.length;i<len;i++){this.addLayer(layers[i])}},removeLayer:function(layer,setNewBaseLayer){if(this.events.triggerEvent("preremovelayer",{layer:layer})===false){return}if(setNewBaseLayer==null){setNewBaseLayer=true}if(layer.isFixed){this.viewPortDiv.removeChild(layer.div)}else{this.layerContainerDiv.removeChild(layer.div)}OpenLayers.Util.removeItem(this.layers,layer);layer.removeMap(this);layer.map=null;if(this.baseLayer==layer){this.baseLayer=null;if(setNewBaseLayer){for(var i=0,len=this.layers.length;i<len;i++){var iLayer=this.layers[i];if(iLayer.isBaseLayer||this.allOverlays){this.setBaseLayer(iLayer);break}}}}this.resetLayersZIndex();this.events.triggerEvent("removelayer",{layer:layer});layer.events.triggerEvent("removed",{map:this,layer:layer})},getNumLayers:function(){return this.layers.length},getLayerIndex:function(layer){return OpenLayers.Util.indexOf(this.layers,layer)},setLayerIndex:function(layer,idx){var base=this.getLayerIndex(layer);if(idx<0){idx=0}else if(idx>this.layers.length){idx=this.layers.length}if(base!=idx){this.layers.splice(base,1);this.layers.splice(idx,0,layer);for(var i=0,len=this.layers.length;i<len;i++){this.setLayerZIndex(this.layers[i],i)}this.events.triggerEvent("changelayer",{layer:layer,property:"order"});if(this.allOverlays){if(idx===0){this.setBaseLayer(layer)}else if(this.baseLayer!==this.layers[0]){this.setBaseLayer(this.layers[0])}}}},raiseLayer:function(layer,delta){var idx=this.getLayerIndex(layer)+delta;this.setLayerIndex(layer,idx)},setBaseLayer:function(newBaseLayer){if(newBaseLayer!=this.baseLayer){if(OpenLayers.Util.indexOf(this.layers,newBaseLayer)!=-1){var center=this.getCachedCenter();var newResolution=OpenLayers.Util.getResolutionFromScale(this.getScale(),newBaseLayer.units);if(this.baseLayer!=null&&!this.allOverlays){this.baseLayer.setVisibility(false)}this.baseLayer=newBaseLayer;if(!this.allOverlays||this.baseLayer.visibility){this.baseLayer.setVisibility(true);if(this.baseLayer.inRange===false){this.baseLayer.redraw()}}if(center!=null){var newZoom=this.getZoomForResolution(newResolution||this.resolution,true);this.setCenter(center,newZoom,false,true)}this.events.triggerEvent("changebaselayer",{layer:this.baseLayer})}}},addControl:function(control,px){this.controls.push(control);this.addControlToMap(control,px)},addControls:function(controls,pixels){var pxs=arguments.length===1?[]:pixels;for(var i=0,len=controls.length;i<len;i++){var ctrl=controls[i];var px=pxs[i]?pxs[i]:null;this.addControl(ctrl,px)}},addControlToMap:function(control,px){control.outsideViewport=control.div!=null;if(this.displayProjection&&!control.displayProjection){control.displayProjection=this.displayProjection}control.setMap(this);var div=control.draw(px);if(div){if(!control.outsideViewport){div.style.zIndex=this.Z_INDEX_BASE["Control"]+this.controls.length;this.viewPortDiv.appendChild(div)}}if(control.autoActivate){control.activate()}},getControl:function(id){var returnControl=null;for(var i=0,len=this.controls.length;i<len;i++){var control=this.controls[i];if(control.id==id){returnControl=control;break}}return returnControl},removeControl:function(control){if(control&&control==this.getControl(control.id)){if(control.div&&control.div.parentNode==this.viewPortDiv){this.viewPortDiv.removeChild(control.div)}OpenLayers.Util.removeItem(this.controls,control)}},addPopup:function(popup,exclusive){if(exclusive){for(var i=this.popups.length-1;i>=0;--i){this.removePopup(this.popups[i])}}popup.map=this;this.popups.push(popup);var popupDiv=popup.draw();if(popupDiv){popupDiv.style.zIndex=this.Z_INDEX_BASE["Popup"]+this.popups.length;this.layerContainerDiv.appendChild(popupDiv)}},removePopup:function(popup){OpenLayers.Util.removeItem(this.popups,popup);if(popup.div){try{this.layerContainerDiv.removeChild(popup.div)}catch(e){}}popup.map=null},getSize:function(){var size=null;if(this.size!=null){size=this.size.clone()}return size},updateSize:function(){var newSize=this.getCurrentSize();if(newSize&&!isNaN(newSize.h)&&!isNaN(newSize.w)){this.events.clearMouseCache();var oldSize=this.getSize();if(oldSize==null){this.size=oldSize=newSize}if(!newSize.equals(oldSize)){this.size=newSize;for(var i=0,len=this.layers.length;i<len;i++){this.layers[i].onMapResize()}var center=this.getCachedCenter();if(this.baseLayer!=null&&center!=null){var zoom=this.getZoom();this.zoom=null;this.setCenter(center,zoom)}}}this.events.triggerEvent("updatesize")},getCurrentSize:function(){var size=new OpenLayers.Size(this.div.clientWidth,this.div.clientHeight);if(size.w==0&&size.h==0||isNaN(size.w)&&isNaN(size.h)){size.w=this.div.offsetWidth;size.h=this.div.offsetHeight}if(size.w==0&&size.h==0||isNaN(size.w)&&isNaN(size.h)){size.w=parseInt(this.div.style.width);size.h=parseInt(this.div.style.height)}return size},calculateBounds:function(center,resolution){var extent=null;if(center==null){center=this.getCachedCenter()}if(resolution==null){resolution=this.getResolution()}if(center!=null&&resolution!=null){var halfWDeg=this.size.w*resolution/2;var halfHDeg=this.size.h*resolution/2;extent=new OpenLayers.Bounds(center.lon-halfWDeg,center.lat-halfHDeg,center.lon+halfWDeg,center.lat+halfHDeg)}return extent},getCenter:function(){var center=null;var cachedCenter=this.getCachedCenter();if(cachedCenter){center=cachedCenter.clone()}return center},getCachedCenter:function(){if(!this.center&&this.size){this.center=this.getLonLatFromViewPortPx({x:this.size.w/2,y:this.size.h/2})}return this.center},getZoom:function(){return this.zoom},pan:function(dx,dy,options){options=OpenLayers.Util.applyDefaults(options,{animate:true,dragging:false});if(options.dragging){if(dx!=0||dy!=0){this.moveByPx(dx,dy)}}else{var centerPx=this.getViewPortPxFromLonLat(this.getCachedCenter());var newCenterPx=centerPx.add(dx,dy);if(this.dragging||!newCenterPx.equals(centerPx)){var newCenterLonLat=this.getLonLatFromViewPortPx(newCenterPx);if(options.animate){this.panTo(newCenterLonLat)}else{this.moveTo(newCenterLonLat);if(this.dragging){this.dragging=false;this.events.triggerEvent("moveend")}}}}},panTo:function(lonlat){if(this.panTween&&this.getExtent().scale(this.panRatio).containsLonLat(lonlat)){var center=this.getCachedCenter();if(lonlat.equals(center)){return}var from=this.getPixelFromLonLat(center);var to=this.getPixelFromLonLat(lonlat);var vector={x:to.x-from.x,y:to.y-from.y};var last={x:0,y:0};this.panTween.start({x:0,y:0},vector,this.panDuration,{callbacks:{eachStep:OpenLayers.Function.bind(function(px){var x=px.x-last.x,y=px.y-last.y;this.moveByPx(x,y);last.x=Math.round(px.x);last.y=Math.round(px.y)},this),done:OpenLayers.Function.bind(function(px){this.moveTo(lonlat);this.dragging=false;this.events.triggerEvent("moveend")},this)}})}else{this.setCenter(lonlat)}},setCenter:function(lonlat,zoom,dragging,forceZoomChange){if(this.panTween){this.panTween.stop()}if(this.zoomTween){this.zoomTween.stop()}this.moveTo(lonlat,zoom,{dragging:dragging,forceZoomChange:forceZoomChange})},moveByPx:function(dx,dy){var hw=this.size.w/2;var hh=this.size.h/2;var x=hw+dx;var y=hh+dy;var wrapDateLine=this.baseLayer.wrapDateLine;var xRestriction=0;var yRestriction=0;if(this.restrictedExtent){xRestriction=hw;yRestriction=hh;wrapDateLine=false}dx=wrapDateLine||x<=this.maxPx.x-xRestriction&&x>=this.minPx.x+xRestriction?Math.round(dx):0;dy=y<=this.maxPx.y-yRestriction&&y>=this.minPx.y+yRestriction?Math.round(dy):0;if(dx||dy){if(!this.dragging){this.dragging=true;this.events.triggerEvent("movestart")}this.center=null;if(dx){this.layerContainerOriginPx.x-=dx;this.minPx.x-=dx;this.maxPx.x-=dx}if(dy){this.layerContainerOriginPx.y-=dy;this.minPx.y-=dy;this.maxPx.y-=dy}this.applyTransform();var layer,i,len;for(i=0,len=this.layers.length;i<len;++i){layer=this.layers[i];if(layer.visibility&&(layer===this.baseLayer||layer.inRange)){layer.moveByPx(dx,dy);layer.events.triggerEvent("move")}}this.events.triggerEvent("move")}},adjustZoom:function(zoom){if(this.baseLayer&&this.baseLayer.wrapDateLine){var resolution,resolutions=this.baseLayer.resolutions,maxResolution=this.getMaxExtent().getWidth()/this.size.w;if(this.getResolutionForZoom(zoom)>maxResolution){if(this.fractionalZoom){zoom=this.getZoomForResolution(maxResolution)}else{for(var i=zoom|0,ii=resolutions.length;i<ii;++i){if(resolutions[i]<=maxResolution){zoom=i;break}}}}}return zoom},getMinZoom:function(){return this.adjustZoom(0)},moveTo:function(lonlat,zoom,options){if(lonlat!=null&&!(lonlat instanceof OpenLayers.LonLat)){lonlat=new OpenLayers.LonLat(lonlat)}if(!options){options={}}if(zoom!=null){zoom=parseFloat(zoom);if(!this.fractionalZoom){zoom=Math.round(zoom)}}var requestedZoom=zoom;zoom=this.adjustZoom(zoom);if(zoom!==requestedZoom){lonlat=this.getCenter()}var dragging=options.dragging||this.dragging;var forceZoomChange=options.forceZoomChange;if(!this.getCachedCenter()&&!this.isValidLonLat(lonlat)){lonlat=this.maxExtent.getCenterLonLat();this.center=lonlat.clone()}if(this.restrictedExtent!=null){if(lonlat==null){lonlat=this.center}if(zoom==null){zoom=this.getZoom()}var resolution=this.getResolutionForZoom(zoom);var extent=this.calculateBounds(lonlat,resolution);if(!this.restrictedExtent.containsBounds(extent)){var maxCenter=this.restrictedExtent.getCenterLonLat();if(extent.getWidth()>this.restrictedExtent.getWidth()){lonlat=new OpenLayers.LonLat(maxCenter.lon,lonlat.lat)}else if(extent.left<this.restrictedExtent.left){lonlat=lonlat.add(this.restrictedExtent.left-extent.left,0)}else if(extent.right>this.restrictedExtent.right){lonlat=lonlat.add(this.restrictedExtent.right-extent.right,0)}if(extent.getHeight()>this.restrictedExtent.getHeight()){lonlat=new OpenLayers.LonLat(lonlat.lon,maxCenter.lat)}else if(extent.bottom<this.restrictedExtent.bottom){lonlat=lonlat.add(0,this.restrictedExtent.bottom-extent.bottom)}else if(extent.top>this.restrictedExtent.top){lonlat=lonlat.add(0,this.restrictedExtent.top-extent.top)}}}var zoomChanged=forceZoomChange||this.isValidZoomLevel(zoom)&&zoom!=this.getZoom();var centerChanged=this.isValidLonLat(lonlat)&&!lonlat.equals(this.center);if(zoomChanged||centerChanged||dragging){dragging||this.events.triggerEvent("movestart",{zoomChanged:zoomChanged});if(centerChanged){if(!zoomChanged&&this.center){this.centerLayerContainer(lonlat)}this.center=lonlat.clone()}var res=zoomChanged?this.getResolutionForZoom(zoom):this.getResolution();if(zoomChanged||this.layerContainerOrigin==null){this.layerContainerOrigin=this.getCachedCenter();this.layerContainerOriginPx.x=0;this.layerContainerOriginPx.y=0;this.applyTransform();var maxExtent=this.getMaxExtent({restricted:true});var maxExtentCenter=maxExtent.getCenterLonLat();var lonDelta=this.center.lon-maxExtentCenter.lon;var latDelta=maxExtentCenter.lat-this.center.lat;var extentWidth=Math.round(maxExtent.getWidth()/res);var extentHeight=Math.round(maxExtent.getHeight()/res);this.minPx={x:(this.size.w-extentWidth)/2-lonDelta/res,y:(this.size.h-extentHeight)/2-latDelta/res};this.maxPx={x:this.minPx.x+Math.round(maxExtent.getWidth()/res),y:this.minPx.y+Math.round(maxExtent.getHeight()/res)}}if(zoomChanged){this.zoom=zoom;this.resolution=res}var bounds=this.getExtent();if(this.baseLayer.visibility){this.baseLayer.moveTo(bounds,zoomChanged,options.dragging);options.dragging||this.baseLayer.events.triggerEvent("moveend",{zoomChanged:zoomChanged})}bounds=this.baseLayer.getExtent();for(var i=this.layers.length-1;i>=0;--i){var layer=this.layers[i];if(layer!==this.baseLayer&&!layer.isBaseLayer){var inRange=layer.calculateInRange();if(layer.inRange!=inRange){layer.inRange=inRange;if(!inRange){layer.display(false)}this.events.triggerEvent("changelayer",{layer:layer,property:"visibility"})}if(inRange&&layer.visibility){layer.moveTo(bounds,zoomChanged,options.dragging);options.dragging||layer.events.triggerEvent("moveend",{zoomChanged:zoomChanged})}}}this.events.triggerEvent("move");dragging||this.events.triggerEvent("moveend");if(zoomChanged){for(var i=0,len=this.popups.length;i<len;i++){this.popups[i].updatePosition()}this.events.triggerEvent("zoomend")}}},centerLayerContainer:function(lonlat){var originPx=this.getViewPortPxFromLonLat(this.layerContainerOrigin);var newPx=this.getViewPortPxFromLonLat(lonlat);if(originPx!=null&&newPx!=null){var oldLeft=this.layerContainerOriginPx.x;var oldTop=this.layerContainerOriginPx.y;var newLeft=Math.round(originPx.x-newPx.x);var newTop=Math.round(originPx.y-newPx.y);this.applyTransform(this.layerContainerOriginPx.x=newLeft,this.layerContainerOriginPx.y=newTop);var dx=oldLeft-newLeft;var dy=oldTop-newTop;this.minPx.x-=dx;this.maxPx.x-=dx;this.minPx.y-=dy;this.maxPx.y-=dy}},isValidZoomLevel:function(zoomLevel){return zoomLevel!=null&&zoomLevel>=0&&zoomLevel<this.getNumZoomLevels()},isValidLonLat:function(lonlat){var valid=false;if(lonlat!=null){var maxExtent=this.getMaxExtent();var worldBounds=this.baseLayer.wrapDateLine&&maxExtent;valid=maxExtent.containsLonLat(lonlat,{worldBounds:worldBounds})}return valid},getProjection:function(){var projection=this.getProjectionObject();return projection?projection.getCode():null},getProjectionObject:function(){var projection=null;if(this.baseLayer!=null){projection=this.baseLayer.projection}return projection},getMaxResolution:function(){var maxResolution=null;if(this.baseLayer!=null){maxResolution=this.baseLayer.maxResolution}return maxResolution},getMaxExtent:function(options){var maxExtent=null;if(options&&options.restricted&&this.restrictedExtent){maxExtent=this.restrictedExtent}else if(this.baseLayer!=null){maxExtent=this.baseLayer.maxExtent}return maxExtent},getNumZoomLevels:function(){var numZoomLevels=null;if(this.baseLayer!=null){numZoomLevels=this.baseLayer.numZoomLevels}return numZoomLevels},getExtent:function(){var extent=null;if(this.baseLayer!=null){extent=this.baseLayer.getExtent()}return extent},getResolution:function(){var resolution=null;if(this.baseLayer!=null){resolution=this.baseLayer.getResolution()}else if(this.allOverlays===true&&this.layers.length>0){resolution=this.layers[0].getResolution()}return resolution},getUnits:function(){var units=null;if(this.baseLayer!=null){units=this.baseLayer.units}return units},getScale:function(){var scale=null;if(this.baseLayer!=null){var res=this.getResolution();var units=this.baseLayer.units;scale=OpenLayers.Util.getScaleFromResolution(res,units)}return scale},getZoomForExtent:function(bounds,closest){var zoom=null;if(this.baseLayer!=null){zoom=this.baseLayer.getZoomForExtent(bounds,closest)}return zoom},getResolutionForZoom:function(zoom){var resolution=null;if(this.baseLayer){resolution=this.baseLayer.getResolutionForZoom(zoom)}return resolution},getZoomForResolution:function(resolution,closest){var zoom=null;if(this.baseLayer!=null){zoom=this.baseLayer.getZoomForResolution(resolution,closest)}return zoom},zoomTo:function(zoom,xy){var map=this;if(map.isValidZoomLevel(zoom)){if(map.baseLayer.wrapDateLine){zoom=map.adjustZoom(zoom)}if(map.zoomTween){var currentRes=map.getResolution(),targetRes=map.getResolutionForZoom(zoom),start={scale:1},end={scale:currentRes/targetRes};if(map.zoomTween.playing&&map.zoomTween.duration<3*map.zoomDuration){map.zoomTween.finish={scale:map.zoomTween.finish.scale*end.scale}}else{if(!xy){var size=map.getSize();xy={x:size.w/2,y:size.h/2}}map.zoomTween.start(start,end,map.zoomDuration,{minFrameRate:50,callbacks:{eachStep:function(data){var containerOrigin=map.layerContainerOriginPx,scale=data.scale,dx=(scale-1)*(containerOrigin.x-xy.x)|0,dy=(scale-1)*(containerOrigin.y-xy.y)|0;map.applyTransform(containerOrigin.x+dx,containerOrigin.y+dy,scale)},done:function(data){map.applyTransform();var resolution=map.getResolution()/data.scale,zoom=map.getZoomForResolution(resolution,true);map.moveTo(map.getZoomTargetCenter(xy,resolution),zoom,true)}}})}}else{var center=xy?map.getZoomTargetCenter(xy,map.getResolutionForZoom(zoom)):null;map.setCenter(center,zoom)}}},zoomIn:function(){this.zoomTo(this.getZoom()+1)},zoomOut:function(){this.zoomTo(this.getZoom()-1)},zoomToExtent:function(bounds,closest){if(!(bounds instanceof OpenLayers.Bounds)){bounds=new OpenLayers.Bounds(bounds)}var center=bounds.getCenterLonLat();if(this.baseLayer.wrapDateLine){var maxExtent=this.getMaxExtent();bounds=bounds.clone();while(bounds.right<bounds.left){bounds.right+=maxExtent.getWidth()}center=bounds.getCenterLonLat().wrapDateLine(maxExtent)}this.setCenter(center,this.getZoomForExtent(bounds,closest))},zoomToMaxExtent:function(options){var restricted=options?options.restricted:true;var maxExtent=this.getMaxExtent({restricted:restricted});this.zoomToExtent(maxExtent)},zoomToScale:function(scale,closest){var res=OpenLayers.Util.getResolutionFromScale(scale,this.baseLayer.units);var halfWDeg=this.size.w*res/2;var halfHDeg=this.size.h*res/2;var center=this.getCachedCenter();var extent=new OpenLayers.Bounds(center.lon-halfWDeg,center.lat-halfHDeg,center.lon+halfWDeg,center.lat+halfHDeg);this.zoomToExtent(extent,closest)},getLonLatFromViewPortPx:function(viewPortPx){var lonlat=null;if(this.baseLayer!=null){lonlat=this.baseLayer.getLonLatFromViewPortPx(viewPortPx)}return lonlat},getViewPortPxFromLonLat:function(lonlat){var px=null;if(this.baseLayer!=null){px=this.baseLayer.getViewPortPxFromLonLat(lonlat)}return px},getZoomTargetCenter:function(xy,resolution){var lonlat=null,size=this.getSize(),deltaX=size.w/2-xy.x,deltaY=xy.y-size.h/2,zoomPoint=this.getLonLatFromPixel(xy);if(zoomPoint){lonlat=new OpenLayers.LonLat(zoomPoint.lon+deltaX*resolution,zoomPoint.lat+deltaY*resolution)}return lonlat},getLonLatFromPixel:function(px){return this.getLonLatFromViewPortPx(px)},getPixelFromLonLat:function(lonlat){var px=this.getViewPortPxFromLonLat(lonlat);px.x=Math.round(px.x);px.y=Math.round(px.y);return px},getGeodesicPixelSize:function(px){var lonlat=px?this.getLonLatFromPixel(px):this.getCachedCenter()||new OpenLayers.LonLat(0,0);var res=this.getResolution();var left=lonlat.add(-res/2,0);var right=lonlat.add(res/2,0);var bottom=lonlat.add(0,-res/2);var top=lonlat.add(0,res/2);var dest=new OpenLayers.Projection("EPSG:4326");var source=this.getProjectionObject()||dest;if(!source.equals(dest)){left.transform(source,dest);right.transform(source,dest);bottom.transform(source,dest);top.transform(source,dest)}return new OpenLayers.Size(OpenLayers.Util.distVincenty(left,right),OpenLayers.Util.distVincenty(bottom,top))},getViewPortPxFromLayerPx:function(layerPx){var viewPortPx=null;if(layerPx!=null){var dX=this.layerContainerOriginPx.x;var dY=this.layerContainerOriginPx.y;viewPortPx=layerPx.add(dX,dY)}return viewPortPx},getLayerPxFromViewPortPx:function(viewPortPx){var layerPx=null;if(viewPortPx!=null){var dX=-this.layerContainerOriginPx.x;var dY=-this.layerContainerOriginPx.y;layerPx=viewPortPx.add(dX,dY);if(isNaN(layerPx.x)||isNaN(layerPx.y)){layerPx=null}}return layerPx},getLonLatFromLayerPx:function(px){px=this.getViewPortPxFromLayerPx(px);return this.getLonLatFromViewPortPx(px)},getLayerPxFromLonLat:function(lonlat){var px=this.getPixelFromLonLat(lonlat);return this.getLayerPxFromViewPortPx(px)},applyTransform:function(x,y,scale){scale=scale||1;var origin=this.layerContainerOriginPx,needTransform=scale!==1;x=x||origin.x;y=y||origin.y;var style=this.layerContainerDiv.style,transform=this.applyTransform.transform,template=this.applyTransform.template;if(transform===undefined){transform=OpenLayers.Util.vendorPrefix.style("transform");this.applyTransform.transform=transform;if(transform){var computedStyle=OpenLayers.Element.getStyle(this.viewPortDiv,OpenLayers.Util.vendorPrefix.css("transform"));if(!computedStyle||computedStyle!=="none"){template=["translate3d(",",0) ","scale3d(",",1)"];style[transform]=[template[0],"0,0",template[1]].join("")}if(!template||!~style[transform].indexOf(template[0])){template=["translate(",") ","scale(",")"]}this.applyTransform.template=template}}if(transform!==null&&(template[0]==="translate3d("||needTransform===true)){if(needTransform===true&&template[0]==="translate("){x-=origin.x;y-=origin.y;style.left=origin.x+"px";style.top=origin.y+"px"}style[transform]=[template[0],x,"px,",y,"px",template[1],template[2],scale,",",scale,template[3]].join("")}else{style.left=x+"px";style.top=y+"px";if(transform!==null){style[transform]=""}}},CLASS_NAME:"OpenLayers.Map"});OpenLayers.Map.TILE_WIDTH=256;OpenLayers.Map.TILE_HEIGHT=256;OpenLayers.Layer=OpenLayers.Class({id:null,name:null,div:null,opacity:1,alwaysInRange:null,RESOLUTION_PROPERTIES:["scales","resolutions","maxScale","minScale","maxResolution","minResolution","numZoomLevels","maxZoomLevel"],events:null,map:null,isBaseLayer:false,alpha:false,displayInLayerSwitcher:true,visibility:true,attribution:null,inRange:false,imageSize:null,options:null,eventListeners: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,metadata:null,initialize:function(name,options){this.metadata={};options=OpenLayers.Util.extend({},options);if(this.alwaysInRange!=null){options.alwaysInRange=this.alwaysInRange}this.addOptions(options);this.name=name;if(this.id==null){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");this.div=OpenLayers.Util.createDiv(this.id);this.div.style.width="100%";this.div.style.height="100%";this.div.dir="ltr";this.events=new OpenLayers.Events(this,this.div);if(this.eventListeners instanceof Object){this.events.on(this.eventListeners)}}},destroy:function(setNewBaseLayer){if(setNewBaseLayer==null){setNewBaseLayer=true}if(this.map!=null){this.map.removeLayer(this,setNewBaseLayer)}this.projection=null;this.map=null;this.name=null;this.div=null;this.options=null;if(this.events){if(this.eventListeners){this.events.un(this.eventListeners)}this.events.destroy()}this.eventListeners=null;this.events=null},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer(this.name,this.getOptions())}OpenLayers.Util.applyDefaults(obj,this);obj.map=null;return obj},getOptions:function(){var options={};for(var o in this.options){options[o]=this[o]}return options},setName:function(newName){if(newName!=this.name){this.name=newName;if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"name"})}}},addOptions:function(newOptions,reinitialize){if(this.options==null){this.options={}}if(newOptions){if(typeof newOptions.projection=="string"){newOptions.projection=new OpenLayers.Projection(newOptions.projection)}if(newOptions.projection){OpenLayers.Util.applyDefaults(newOptions,OpenLayers.Projection.defaults[newOptions.projection.getCode()])}if(newOptions.maxExtent&&!(newOptions.maxExtent instanceof OpenLayers.Bounds)){newOptions.maxExtent=new OpenLayers.Bounds(newOptions.maxExtent)}if(newOptions.minExtent&&!(newOptions.minExtent instanceof OpenLayers.Bounds)){newOptions.minExtent=new OpenLayers.Bounds(newOptions.minExtent)}}OpenLayers.Util.extend(this.options,newOptions);OpenLayers.Util.extend(this,newOptions);if(this.projection&&this.projection.getUnits()){this.units=this.projection.getUnits()}if(this.map){var resolution=this.map.getResolution();var properties=this.RESOLUTION_PROPERTIES.concat(["projection","units","minExtent","maxExtent"]);for(var o in newOptions){if(newOptions.hasOwnProperty(o)&&OpenLayers.Util.indexOf(properties,o)>=0){this.initResolutions();if(reinitialize&&this.map.baseLayer===this){this.map.setCenter(this.map.getCenter(),this.map.getZoomForResolution(resolution),false,true);this.map.events.triggerEvent("changebaselayer",{layer:this})}break}}}},onMapResize:function(){},redraw:function(){var redrawn=false;if(this.map){this.inRange=this.calculateInRange();var extent=this.getExtent();if(extent&&this.inRange&&this.visibility){var zoomChanged=true;this.moveTo(extent,zoomChanged,false);this.events.triggerEvent("moveend",{zoomChanged:zoomChanged});redrawn=true}}return redrawn},moveTo:function(bounds,zoomChanged,dragging){var display=this.visibility;if(!this.isBaseLayer){display=display&&this.inRange}this.display(display)},moveByPx:function(dx,dy){},setMap:function(map){if(this.map==null){this.map=map;this.maxExtent=this.maxExtent||this.map.maxExtent;this.minExtent=this.minExtent||this.map.minExtent;this.projection=this.projection||this.map.projection;if(typeof this.projection=="string"){this.projection=new OpenLayers.Projection(this.projection)}this.units=this.projection.getUnits()||this.units||this.map.units;this.initResolutions();if(!this.isBaseLayer){this.inRange=this.calculateInRange();var show=this.visibility&&this.inRange;this.div.style.display=show?"":"none"}this.setTileSize()}},afterAdd:function(){},removeMap:function(map){},getImageSize:function(bounds){return this.imageSize||this.tileSize},setTileSize:function(size){var tileSize=size?size:this.tileSize?this.tileSize:this.map.getTileSize();this.tileSize=tileSize;if(this.gutter){this.imageSize=new OpenLayers.Size(tileSize.w+2*this.gutter,tileSize.h+2*this.gutter)}},getVisibility:function(){return this.visibility},setVisibility:function(visibility){if(visibility!=this.visibility){this.visibility=visibility;this.display(visibility);this.redraw();if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"visibility"})}this.events.triggerEvent("visibilitychanged")}},display:function(display){if(display!=(this.div.style.display!="none")){this.div.style.display=display&&this.calculateInRange()?"block":"none"}},calculateInRange:function(){var inRange=false;if(this.alwaysInRange){inRange=true}else{if(this.map){var resolution=this.map.getResolution();inRange=resolution>=this.minResolution&&resolution<=this.maxResolution}}return inRange},setIsBaseLayer:function(isBaseLayer){if(isBaseLayer!=this.isBaseLayer){this.isBaseLayer=isBaseLayer;if(this.map!=null){this.map.events.triggerEvent("changebaselayer",{layer:this})}}},initResolutions:function(){var i,len,p;var props={},alwaysInRange=true;for(i=0,len=this.RESOLUTION_PROPERTIES.length;i<len;i++){p=this.RESOLUTION_PROPERTIES[i];props[p]=this.options[p];if(alwaysInRange&&this.options[p]){alwaysInRange=false}}if(this.options.alwaysInRange==null){this.alwaysInRange=alwaysInRange}if(props.resolutions==null){props.resolutions=this.resolutionsFromScales(props.scales)}if(props.resolutions==null){props.resolutions=this.calculateResolutions(props)}if(props.resolutions==null){for(i=0,len=this.RESOLUTION_PROPERTIES.length;i<len;i++){p=this.RESOLUTION_PROPERTIES[i];props[p]=this.options[p]!=null?this.options[p]:this.map[p]}if(props.resolutions==null){props.resolutions=this.resolutionsFromScales(props.scales)}if(props.resolutions==null){props.resolutions=this.calculateResolutions(props)}}var maxResolution;if(this.options.maxResolution&&this.options.maxResolution!=="auto"){maxResolution=this.options.maxResolution}if(this.options.minScale){maxResolution=OpenLayers.Util.getResolutionFromScale(this.options.minScale,this.units)}var minResolution;if(this.options.minResolution&&this.options.minResolution!=="auto"){minResolution=this.options.minResolution}if(this.options.maxScale){minResolution=OpenLayers.Util.getResolutionFromScale(this.options.maxScale,this.units)}if(props.resolutions){props.resolutions.sort(function(a,b){return b-a});if(!maxResolution){maxResolution=props.resolutions[0]}if(!minResolution){var lastIdx=props.resolutions.length-1;minResolution=props.resolutions[lastIdx]}}this.resolutions=props.resolutions;if(this.resolutions){len=this.resolutions.length;this.scales=new Array(len);for(i=0;i<len;i++){this.scales[i]=OpenLayers.Util.getScaleFromResolution(this.resolutions[i],this.units)}this.numZoomLevels=len}this.minResolution=minResolution;if(minResolution){this.maxScale=OpenLayers.Util.getScaleFromResolution(minResolution,this.units)}this.maxResolution=maxResolution;if(maxResolution){this.minScale=OpenLayers.Util.getScaleFromResolution(maxResolution,this.units)}},resolutionsFromScales:function(scales){if(scales==null){return}var resolutions,i,len;len=scales.length;resolutions=new Array(len);for(i=0;i<len;i++){resolutions[i]=OpenLayers.Util.getResolutionFromScale(scales[i],this.units)}return resolutions},calculateResolutions:function(props){var viewSize,wRes,hRes;var maxResolution=props.maxResolution;if(props.minScale!=null){maxResolution=OpenLayers.Util.getResolutionFromScale(props.minScale,this.units)}else if(maxResolution=="auto"&&this.maxExtent!=null){viewSize=this.map.getSize();wRes=this.maxExtent.getWidth()/viewSize.w;hRes=this.maxExtent.getHeight()/viewSize.h;maxResolution=Math.max(wRes,hRes)}var minResolution=props.minResolution;if(props.maxScale!=null){minResolution=OpenLayers.Util.getResolutionFromScale(props.maxScale,this.units)}else if(props.minResolution=="auto"&&this.minExtent!=null){viewSize=this.map.getSize();wRes=this.minExtent.getWidth()/viewSize.w;hRes=this.minExtent.getHeight()/viewSize.h;minResolution=Math.max(wRes,hRes)}if(typeof maxResolution!=="number"&&typeof minResolution!=="number"&&this.maxExtent!=null){var tileSize=this.map.getTileSize();maxResolution=Math.max(this.maxExtent.getWidth()/tileSize.w,this.maxExtent.getHeight()/tileSize.h)}var maxZoomLevel=props.maxZoomLevel;var numZoomLevels=props.numZoomLevels;if(typeof minResolution==="number"&&typeof maxResolution==="number"&&numZoomLevels===undefined){var ratio=maxResolution/minResolution;numZoomLevels=Math.floor(Math.log(ratio)/Math.log(2))+1}else if(numZoomLevels===undefined&&maxZoomLevel!=null){numZoomLevels=maxZoomLevel+1}if(typeof numZoomLevels!=="number"||numZoomLevels<=0||typeof maxResolution!=="number"&&typeof minResolution!=="number"){return}var resolutions=new Array(numZoomLevels);var base=2;if(typeof minResolution=="number"&&typeof maxResolution=="number"){base=Math.pow(maxResolution/minResolution,1/(numZoomLevels-1))}var i;if(typeof maxResolution==="number"){for(i=0;i<numZoomLevels;i++){resolutions[i]=maxResolution/Math.pow(base,i)}}else{for(i=0;i<numZoomLevels;i++){resolutions[numZoomLevels-1-i]=minResolution*Math.pow(base,i)}}return resolutions},getResolution:function(){var zoom=this.map.getZoom();
return this.getResolutionForZoom(zoom)},getExtent:function(){return this.map.calculateBounds()},getZoomForExtent:function(extent,closest){var viewSize=this.map.getSize();var idealResolution=Math.max(extent.getWidth()/viewSize.w,extent.getHeight()/viewSize.h);return this.getZoomForResolution(idealResolution,closest)},getDataExtent:function(){},getResolutionForZoom:function(zoom){zoom=Math.max(0,Math.min(zoom,this.resolutions.length-1));var resolution;if(this.map.fractionalZoom){var low=Math.floor(zoom);var high=Math.ceil(zoom);resolution=this.resolutions[low]-(zoom-low)*(this.resolutions[low]-this.resolutions[high])}else{resolution=this.resolutions[Math.round(zoom)]}return resolution},getZoomForResolution:function(resolution,closest){var zoom,i,len;if(this.map.fractionalZoom){var lowZoom=0;var highZoom=this.resolutions.length-1;var highRes=this.resolutions[lowZoom];var lowRes=this.resolutions[highZoom];var res;for(i=0,len=this.resolutions.length;i<len;++i){res=this.resolutions[i];if(res>=resolution){highRes=res;lowZoom=i}if(res<=resolution){lowRes=res;highZoom=i;break}}var dRes=highRes-lowRes;if(dRes>0){zoom=lowZoom+(highRes-resolution)/dRes}else{zoom=lowZoom}}else{var diff;var minDiff=Number.POSITIVE_INFINITY;for(i=0,len=this.resolutions.length;i<len;i++){if(closest){diff=Math.abs(this.resolutions[i]-resolution);if(diff>minDiff){break}minDiff=diff}else{if(this.resolutions[i]<resolution){break}}}zoom=Math.max(0,i-1)}return zoom},getLonLatFromViewPortPx:function(viewPortPx){var lonlat=null;var map=this.map;if(viewPortPx!=null&&map.minPx){var res=map.getResolution();var maxExtent=map.getMaxExtent({restricted:true});var lon=(viewPortPx.x-map.minPx.x)*res+maxExtent.left;var lat=(map.minPx.y-viewPortPx.y)*res+maxExtent.top;lonlat=new OpenLayers.LonLat(lon,lat);if(this.wrapDateLine){lonlat=lonlat.wrapDateLine(this.maxExtent)}}return lonlat},getViewPortPxFromLonLat:function(lonlat,resolution){var px=null;if(lonlat!=null){resolution=resolution||this.map.getResolution();var extent=this.map.calculateBounds(null,resolution);px=new OpenLayers.Pixel(1/resolution*(lonlat.lon-extent.left),1/resolution*(extent.top-lonlat.lat))}return px},setOpacity:function(opacity){if(opacity!=this.opacity){this.opacity=opacity;var childNodes=this.div.childNodes;for(var i=0,len=childNodes.length;i<len;++i){var element=childNodes[i].firstChild||childNodes[i];var lastChild=childNodes[i].lastChild;if(lastChild&&lastChild.nodeName.toLowerCase()==="iframe"){element=lastChild.parentNode}OpenLayers.Util.modifyDOMElement(element,null,null,null,null,null,null,opacity)}if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"opacity"})}}},getZIndex:function(){return this.div.style.zIndex},setZIndex:function(zIndex){this.div.style.zIndex=zIndex},adjustBounds:function(bounds){if(this.gutter){var mapGutter=this.gutter*this.map.getResolution();bounds=new OpenLayers.Bounds(bounds.left-mapGutter,bounds.bottom-mapGutter,bounds.right+mapGutter,bounds.top+mapGutter)}if(this.wrapDateLine){var wrappingOptions={rightTolerance:this.getResolution(),leftTolerance:this.getResolution()};bounds=bounds.wrapDateLine(this.maxExtent,wrappingOptions)}return bounds},CLASS_NAME:"OpenLayers.Layer"});OpenLayers.Layer.HTTPRequest=OpenLayers.Class(OpenLayers.Layer,{URL_HASH_FACTOR:(Math.sqrt(5)-1)/2,url:null,params:null,reproject:false,initialize:function(name,url,params,options){OpenLayers.Layer.prototype.initialize.apply(this,[name,options]);this.url=url;if(!this.params){this.params=OpenLayers.Util.extend({},params)}},destroy:function(){this.url=null;this.params=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.HTTPRequest(this.name,this.url,this.params,this.getOptions())}obj=OpenLayers.Layer.prototype.clone.apply(this,[obj]);return obj},setUrl:function(newUrl){this.url=newUrl},mergeNewParams:function(newParams){this.params=OpenLayers.Util.extend(this.params,newParams);var ret=this.redraw();if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"params"})}return ret},redraw:function(force){if(force){return this.mergeNewParams({_olSalt:Math.random()})}else{return OpenLayers.Layer.prototype.redraw.apply(this,[])}},selectUrl:function(paramString,urls){var product=1;for(var i=0,len=paramString.length;i<len;i++){product*=paramString.charCodeAt(i)*this.URL_HASH_FACTOR;product-=Math.floor(product)}return urls[Math.floor(product*urls.length)]},getFullRequestString:function(newParams,altUrl){var url=altUrl||this.url;var allParams=OpenLayers.Util.extend({},this.params);allParams=OpenLayers.Util.extend(allParams,newParams);var paramsString=OpenLayers.Util.getParameterString(allParams);if(OpenLayers.Util.isArray(url)){url=this.selectUrl(paramsString,url)}var urlParams=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(url));for(var key in allParams){if(key.toUpperCase()in urlParams){delete allParams[key]}}paramsString=OpenLayers.Util.getParameterString(allParams);return OpenLayers.Util.urlAppend(url,paramsString)},CLASS_NAME:"OpenLayers.Layer.HTTPRequest"});OpenLayers.Tile=OpenLayers.Class({events:null,eventListeners:null,id:null,layer:null,url:null,bounds:null,size:null,position:null,isLoading:false,initialize:function(layer,position,bounds,url,size,options){this.layer=layer;this.position=position.clone();this.setBounds(bounds);this.url=url;if(size){this.size=size.clone()}this.id=OpenLayers.Util.createUniqueID("Tile_");OpenLayers.Util.extend(this,options);this.events=new OpenLayers.Events(this);if(this.eventListeners instanceof Object){this.events.on(this.eventListeners)}},unload:function(){if(this.isLoading){this.isLoading=false;this.events.triggerEvent("unload")}},destroy:function(){this.layer=null;this.bounds=null;this.size=null;this.position=null;if(this.eventListeners){this.events.un(this.eventListeners)}this.events.destroy();this.eventListeners=null;this.events=null},draw:function(force){if(!force){this.clear()}var draw=this.shouldDraw();if(draw&&!force&&this.events.triggerEvent("beforedraw")===false){draw=null}return draw},shouldDraw:function(){var withinMaxExtent=false,maxExtent=this.layer.maxExtent;if(maxExtent){var map=this.layer.map;var worldBounds=map.baseLayer.wrapDateLine&&map.getMaxExtent();if(this.bounds.intersectsBounds(maxExtent,{inclusive:false,worldBounds:worldBounds})){withinMaxExtent=true}}return withinMaxExtent||this.layer.displayOutsideMaxExtent},setBounds:function(bounds){bounds=bounds.clone();if(this.layer.map.baseLayer.wrapDateLine){var worldExtent=this.layer.map.getMaxExtent(),tolerance=this.layer.map.getResolution();bounds=bounds.wrapDateLine(worldExtent,{leftTolerance:tolerance,rightTolerance:tolerance})}this.bounds=bounds},moveTo:function(bounds,position,redraw){if(redraw==null){redraw=true}this.setBounds(bounds);this.position=position.clone();if(redraw){this.draw()}},clear:function(draw){},CLASS_NAME:"OpenLayers.Tile"});OpenLayers.Tile.Image=OpenLayers.Class(OpenLayers.Tile,{url:null,imgDiv:null,frame:null,imageReloadAttempts:null,layerAlphaHack:null,asyncRequestId:null,maxGetUrlLength:null,canvasContext:null,crossOriginKeyword:null,initialize:function(layer,position,bounds,url,size,options){OpenLayers.Tile.prototype.initialize.apply(this,arguments);this.url=url;this.layerAlphaHack=this.layer.alpha&&OpenLayers.Util.alphaHack();if(this.maxGetUrlLength!=null||this.layer.gutter||this.layerAlphaHack){this.frame=document.createElement("div");this.frame.style.position="absolute";this.frame.style.overflow="hidden"}if(this.maxGetUrlLength!=null){OpenLayers.Util.extend(this,OpenLayers.Tile.Image.IFrame)}},destroy:function(){if(this.imgDiv){this.clear();this.imgDiv=null;this.frame=null}this.asyncRequestId=null;OpenLayers.Tile.prototype.destroy.apply(this,arguments)},draw:function(){var shouldDraw=OpenLayers.Tile.prototype.draw.apply(this,arguments);if(shouldDraw){if(this.layer!=this.layer.map.baseLayer&&this.layer.reproject){this.bounds=this.getBoundsFromBaseLayer(this.position)}if(this.isLoading){this._loadEvent="reload"}else{this.isLoading=true;this._loadEvent="loadstart"}this.renderTile();this.positionTile()}else if(shouldDraw===false){this.unload()}return shouldDraw},renderTile:function(){if(this.layer.async){var id=this.asyncRequestId=(this.asyncRequestId||0)+1;this.layer.getURLasync(this.bounds,function(url){if(id==this.asyncRequestId){this.url=url;this.initImage()}},this)}else{this.url=this.layer.getURL(this.bounds);this.initImage()}},positionTile:function(){var style=this.getTile().style,size=this.frame?this.size:this.layer.getImageSize(this.bounds),ratio=1;if(this.layer instanceof OpenLayers.Layer.Grid){ratio=this.layer.getServerResolution()/this.layer.map.getResolution()}style.left=this.position.x+"px";style.top=this.position.y+"px";style.width=Math.round(ratio*size.w)+"px";style.height=Math.round(ratio*size.h)+"px"},clear:function(){OpenLayers.Tile.prototype.clear.apply(this,arguments);var img=this.imgDiv;if(img){var tile=this.getTile();if(tile.parentNode===this.layer.div){this.layer.div.removeChild(tile)}this.setImgSrc();if(this.layerAlphaHack===true){img.style.filter=""}OpenLayers.Element.removeClass(img,"olImageLoadError")}this.canvasContext=null},getImage:function(){if(!this.imgDiv){this.imgDiv=OpenLayers.Tile.Image.IMAGE.cloneNode(false);var style=this.imgDiv.style;if(this.frame){var left=0,top=0;if(this.layer.gutter){left=this.layer.gutter/this.layer.tileSize.w*100;top=this.layer.gutter/this.layer.tileSize.h*100}style.left=-left+"%";style.top=-top+"%";style.width=2*left+100+"%";style.height=2*top+100+"%"}style.visibility="hidden";style.opacity=0;if(this.layer.opacity<1){style.filter="alpha(opacity="+this.layer.opacity*100+")"}style.position="absolute";if(this.layerAlphaHack){style.paddingTop=style.height;style.height="0";style.width="100%"}if(this.frame){this.frame.appendChild(this.imgDiv)}}return this.imgDiv},setImage:function(img){this.imgDiv=img},initImage:function(){if(!this.url&&!this.imgDiv){this.isLoading=false;return}this.events.triggerEvent("beforeload");this.layer.div.appendChild(this.getTile());this.events.triggerEvent(this._loadEvent);var img=this.getImage();var src=img.getAttribute("src")||"";if(this.url&&OpenLayers.Util.isEquivalentUrl(src,this.url)){this._loadTimeout=window.setTimeout(OpenLayers.Function.bind(this.onImageLoad,this),0)}else{this.stopLoading();if(this.crossOriginKeyword){img.removeAttribute("crossorigin")}OpenLayers.Event.observe(img,"load",OpenLayers.Function.bind(this.onImageLoad,this));OpenLayers.Event.observe(img,"error",OpenLayers.Function.bind(this.onImageError,this));this.imageReloadAttempts=0;this.setImgSrc(this.url)}},setImgSrc:function(url){var img=this.imgDiv;if(url){img.style.visibility="hidden";img.style.opacity=0;if(this.crossOriginKeyword){if(url.substr(0,5)!=="data:"){img.setAttribute("crossorigin",this.crossOriginKeyword)}else{img.removeAttribute("crossorigin")}}img.src=url}else{this.stopLoading();this.imgDiv=null;if(img.parentNode){img.parentNode.removeChild(img)}}},getTile:function(){return this.frame?this.frame:this.getImage()},createBackBuffer:function(){if(!this.imgDiv||this.isLoading){return}var backBuffer;if(this.frame){backBuffer=this.frame.cloneNode(false);backBuffer.appendChild(this.imgDiv)}else{backBuffer=this.imgDiv}this.imgDiv=null;return backBuffer},onImageLoad:function(){var img=this.imgDiv;this.stopLoading();img.style.visibility="inherit";img.style.opacity=this.layer.opacity;this.isLoading=false;this.canvasContext=null;this.events.triggerEvent("loadend");if(this.layerAlphaHack===true){img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+img.src+"', sizingMethod='scale')"}},onImageError:function(){var img=this.imgDiv;if(img.src!=null){this.imageReloadAttempts++;if(this.imageReloadAttempts<=OpenLayers.IMAGE_RELOAD_ATTEMPTS){this.setImgSrc(this.layer.getURL(this.bounds))}else{OpenLayers.Element.addClass(img,"olImageLoadError");this.events.triggerEvent("loaderror");this.onImageLoad()}}},stopLoading:function(){OpenLayers.Event.stopObservingElement(this.imgDiv);window.clearTimeout(this._loadTimeout);delete this._loadTimeout},getCanvasContext:function(){if(OpenLayers.CANVAS_SUPPORTED&&this.imgDiv&&!this.isLoading){if(!this.canvasContext){var canvas=document.createElement("canvas");canvas.width=this.size.w;canvas.height=this.size.h;this.canvasContext=canvas.getContext("2d");this.canvasContext.drawImage(this.imgDiv,0,0)}return this.canvasContext}},CLASS_NAME:"OpenLayers.Tile.Image"});OpenLayers.Tile.Image.IMAGE=function(){var img=new Image;img.className="olTileImage";img.galleryImg="no";return img}();OpenLayers.Layer.Grid=OpenLayers.Class(OpenLayers.Layer.HTTPRequest,{tileSize:null,tileOriginCorner:"bl",tileOrigin:null,tileOptions:null,tileClass:OpenLayers.Tile.Image,grid:null,singleTile:false,ratio:1.5,buffer:0,transitionEffect:"resize",numLoadingTiles:0,serverResolutions:null,loading:false,backBuffer:null,gridResolution:null,backBufferResolution:null,backBufferLonLat:null,backBufferTimerId:null,removeBackBufferDelay:null,className:null,gridLayout:null,rowSign:null,transitionendEvents:["transitionend","webkitTransitionEnd","otransitionend","oTransitionEnd"],initialize:function(name,url,params,options){OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,arguments);this.grid=[];this._removeBackBuffer=OpenLayers.Function.bind(this.removeBackBuffer,this);this.initProperties();this.rowSign=this.tileOriginCorner.substr(0,1)==="t"?1:-1},initProperties:function(){if(this.options.removeBackBufferDelay===undefined){this.removeBackBufferDelay=this.singleTile?0:2500}if(this.options.className===undefined){this.className=this.singleTile?"olLayerGridSingleTile":"olLayerGrid"}},setMap:function(map){OpenLayers.Layer.HTTPRequest.prototype.setMap.call(this,map);OpenLayers.Element.addClass(this.div,this.className)},removeMap:function(map){this.removeBackBuffer()},destroy:function(){this.removeBackBuffer();this.clearGrid();this.grid=null;this.tileSize=null;OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this,arguments)},clearGrid:function(){if(this.grid){for(var iRow=0,len=this.grid.length;iRow<len;iRow++){var row=this.grid[iRow];for(var iCol=0,clen=row.length;iCol<clen;iCol++){var tile=row[iCol];this.destroyTile(tile)}}this.grid=[];this.gridResolution=null;this.gridLayout=null}},addOptions:function(newOptions,reinitialize){var singleTileChanged=newOptions.singleTile!==undefined&&newOptions.singleTile!==this.singleTile;OpenLayers.Layer.HTTPRequest.prototype.addOptions.apply(this,arguments);if(this.map&&singleTileChanged){this.initProperties();this.clearGrid();this.tileSize=this.options.tileSize;this.setTileSize();this.moveTo(null,true)}},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.Grid(this.name,this.url,this.params,this.getOptions())}obj=OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this,[obj]);if(this.tileSize!=null){obj.tileSize=this.tileSize.clone()}obj.grid=[];obj.gridResolution=null;obj.backBuffer=null;obj.backBufferTimerId=null;obj.loading=false;obj.numLoadingTiles=0;return obj},moveTo:function(bounds,zoomChanged,dragging){OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this,arguments);bounds=bounds||this.map.getExtent();if(bounds!=null){var forceReTile=!this.grid.length||zoomChanged;var tilesBounds=this.getTilesBounds();var resolution=this.map.getResolution();var serverResolution=this.getServerResolution(resolution);if(this.singleTile){if(forceReTile||!dragging&&!tilesBounds.containsBounds(bounds)){if(zoomChanged&&this.transitionEffect!=="resize"){this.removeBackBuffer()}if(!zoomChanged||this.transitionEffect==="resize"){this.applyBackBuffer(resolution)}this.initSingleTile(bounds)}}else{forceReTile=forceReTile||!tilesBounds.intersectsBounds(bounds,{worldBounds:this.map.baseLayer.wrapDateLine&&this.map.getMaxExtent()});if(forceReTile){if(zoomChanged&&(this.transitionEffect==="resize"||this.gridResolution===resolution)){this.applyBackBuffer(resolution)}this.initGriddedTiles(bounds)}else{this.moveGriddedTiles()}}}},getTileData:function(loc){var data=null,x=loc.lon,y=loc.lat,numRows=this.grid.length;if(this.map&&numRows){var res=this.map.getResolution(),tileWidth=this.tileSize.w,tileHeight=this.tileSize.h,bounds=this.grid[0][0].bounds,left=bounds.left,top=bounds.top;if(x<left){if(this.map.baseLayer.wrapDateLine){var worldWidth=this.map.getMaxExtent().getWidth();var worldsAway=Math.ceil((left-x)/worldWidth);x+=worldWidth*worldsAway}}var dtx=(x-left)/(res*tileWidth);var dty=(top-y)/(res*tileHeight);var col=Math.floor(dtx);var row=Math.floor(dty);if(row>=0&&row<numRows){var tile=this.grid[row][col];if(tile){data={tile:tile,i:Math.floor((dtx-col)*tileWidth),j:Math.floor((dty-row)*tileHeight)}}}}return data},destroyTile:function(tile){this.removeTileMonitoringHooks(tile);tile.destroy()},getServerResolution:function(resolution){var distance=Number.POSITIVE_INFINITY;resolution=resolution||this.map.getResolution();if(this.serverResolutions&&OpenLayers.Util.indexOf(this.serverResolutions,resolution)===-1){var i,newDistance,newResolution,serverResolution;for(i=this.serverResolutions.length-1;i>=0;i--){newResolution=this.serverResolutions[i];newDistance=Math.abs(newResolution-resolution);if(newDistance>distance){break}distance=newDistance;serverResolution=newResolution}resolution=serverResolution}return resolution},getServerZoom:function(){var resolution=this.getServerResolution();return this.serverResolutions?OpenLayers.Util.indexOf(this.serverResolutions,resolution):this.map.getZoomForResolution(resolution)+(this.zoomOffset||0)},applyBackBuffer:function(resolution){if(this.backBufferTimerId!==null){this.removeBackBuffer()}var backBuffer=this.backBuffer;if(!backBuffer){backBuffer=this.createBackBuffer();if(!backBuffer){return}if(resolution===this.gridResolution){this.div.insertBefore(backBuffer,this.div.firstChild)}else{this.map.baseLayer.div.parentNode.insertBefore(backBuffer,this.map.baseLayer.div)}this.backBuffer=backBuffer;var topLeftTileBounds=this.grid[0][0].bounds;this.backBufferLonLat={lon:topLeftTileBounds.left,lat:topLeftTileBounds.top};this.backBufferResolution=this.gridResolution}var ratio=this.backBufferResolution/resolution;var tiles=backBuffer.childNodes,tile;for(var i=tiles.length-1;i>=0;--i){tile=tiles[i];tile.style.top=(ratio*tile._i*tile._h|0)+"px";tile.style.left=(ratio*tile._j*tile._w|0)+"px";tile.style.width=Math.round(ratio*tile._w)+"px";tile.style.height=Math.round(ratio*tile._h)+"px"}var position=this.getViewPortPxFromLonLat(this.backBufferLonLat,resolution);var leftOffset=this.map.layerContainerOriginPx.x;var topOffset=this.map.layerContainerOriginPx.y;backBuffer.style.left=Math.round(position.x-leftOffset)+"px";backBuffer.style.top=Math.round(position.y-topOffset)+"px"},createBackBuffer:function(){var backBuffer;if(this.grid.length>0){backBuffer=document.createElement("div");backBuffer.id=this.div.id+"_bb";backBuffer.className="olBackBuffer";backBuffer.style.position="absolute";var map=this.map;backBuffer.style.zIndex=this.transitionEffect==="resize"?this.getZIndex()-1:map.Z_INDEX_BASE.BaseLayer-(map.getNumLayers()-map.getLayerIndex(this));for(var i=0,lenI=this.grid.length;i<lenI;i++){for(var j=0,lenJ=this.grid[i].length;j<lenJ;j++){var tile=this.grid[i][j],markup=this.grid[i][j].createBackBuffer();if(markup){markup._i=i;markup._j=j;markup._w=tile.size.w;markup._h=tile.size.h;markup.id=tile.id+"_bb";backBuffer.appendChild(markup)}}}}return backBuffer},removeBackBuffer:function(){if(this._transitionElement){for(var i=this.transitionendEvents.length-1;i>=0;--i){OpenLayers.Event.stopObserving(this._transitionElement,this.transitionendEvents[i],this._removeBackBuffer)}delete this._transitionElement}if(this.backBuffer){if(this.backBuffer.parentNode){this.backBuffer.parentNode.removeChild(this.backBuffer)}this.backBuffer=null;this.backBufferResolution=null;if(this.backBufferTimerId!==null){window.clearTimeout(this.backBufferTimerId);this.backBufferTimerId=null}}},moveByPx:function(dx,dy){if(!this.singleTile){this.moveGriddedTiles()}},setTileSize:function(size){if(this.singleTile){size=this.map.getSize();size.h=parseInt(size.h*this.ratio,10);size.w=parseInt(size.w*this.ratio,10)}OpenLayers.Layer.HTTPRequest.prototype.setTileSize.apply(this,[size])},getTilesBounds:function(){var bounds=null;var length=this.grid.length;if(length){var bottomLeftTileBounds=this.grid[length-1][0].bounds,width=this.grid[0].length*bottomLeftTileBounds.getWidth(),height=this.grid.length*bottomLeftTileBounds.getHeight();bounds=new OpenLayers.Bounds(bottomLeftTileBounds.left,bottomLeftTileBounds.bottom,bottomLeftTileBounds.left+width,bottomLeftTileBounds.bottom+height)}return bounds},initSingleTile:function(bounds){this.events.triggerEvent("retile");var center=bounds.getCenterLonLat();var tileWidth=bounds.getWidth()*this.ratio;var tileHeight=bounds.getHeight()*this.ratio;var tileBounds=new OpenLayers.Bounds(center.lon-tileWidth/2,center.lat-tileHeight/2,center.lon+tileWidth/2,center.lat+tileHeight/2);var px=this.map.getLayerPxFromLonLat({lon:tileBounds.left,lat:tileBounds.top});if(!this.grid.length){this.grid[0]=[]}var tile=this.grid[0][0];if(!tile){tile=this.addTile(tileBounds,px);this.addTileMonitoringHooks(tile);tile.draw();this.grid[0][0]=tile}else{tile.moveTo(tileBounds,px)}this.removeExcessTiles(1,1);this.gridResolution=this.getServerResolution()},calculateGridLayout:function(bounds,origin,resolution){var tilelon=resolution*this.tileSize.w;var tilelat=resolution*this.tileSize.h;var offsetlon=bounds.left-origin.lon;var tilecol=Math.floor(offsetlon/tilelon)-this.buffer;var rowSign=this.rowSign;var offsetlat=rowSign*(origin.lat-bounds.top+tilelat);var tilerow=Math[~rowSign?"floor":"ceil"](offsetlat/tilelat)-this.buffer*rowSign;return{tilelon:tilelon,tilelat:tilelat,startcol:tilecol,startrow:tilerow}},getTileOrigin:function(){var origin=this.tileOrigin;if(!origin){var extent=this.getMaxExtent();var edges={tl:["left","top"],tr:["right","top"],bl:["left","bottom"],br:["right","bottom"]}[this.tileOriginCorner];origin=new OpenLayers.LonLat(extent[edges[0]],extent[edges[1]])}return origin},getTileBoundsForGridIndex:function(row,col){var origin=this.getTileOrigin();var tileLayout=this.gridLayout;var tilelon=tileLayout.tilelon;var tilelat=tileLayout.tilelat;var startcol=tileLayout.startcol;var startrow=tileLayout.startrow;var rowSign=this.rowSign;return new OpenLayers.Bounds(origin.lon+(startcol+col)*tilelon,origin.lat-(startrow+row*rowSign)*tilelat*rowSign,origin.lon+(startcol+col+1)*tilelon,origin.lat-(startrow+(row-1)*rowSign)*tilelat*rowSign)},initGriddedTiles:function(bounds){this.events.triggerEvent("retile");var viewSize=this.map.getSize();var origin=this.getTileOrigin();var resolution=this.map.getResolution(),serverResolution=this.getServerResolution(),ratio=resolution/serverResolution,tileSize={w:this.tileSize.w/ratio,h:this.tileSize.h/ratio};var minRows=Math.ceil(viewSize.h/tileSize.h)+2*this.buffer+1;var minCols=Math.ceil(viewSize.w/tileSize.w)+2*this.buffer+1;var tileLayout=this.calculateGridLayout(bounds,origin,serverResolution);this.gridLayout=tileLayout;var tilelon=tileLayout.tilelon;var tilelat=tileLayout.tilelat;var layerContainerDivLeft=this.map.layerContainerOriginPx.x;var layerContainerDivTop=this.map.layerContainerOriginPx.y;var tileBounds=this.getTileBoundsForGridIndex(0,0);var startPx=this.map.getViewPortPxFromLonLat(new OpenLayers.LonLat(tileBounds.left,tileBounds.top));startPx.x=Math.round(startPx.x)-layerContainerDivLeft;startPx.y=Math.round(startPx.y)-layerContainerDivTop;var tileData=[],center=this.map.getCenter();var rowidx=0;do{var row=this.grid[rowidx];if(!row){row=[];this.grid.push(row)}var colidx=0;do{tileBounds=this.getTileBoundsForGridIndex(rowidx,colidx);var px=startPx.clone();px.x=px.x+colidx*Math.round(tileSize.w);px.y=px.y+rowidx*Math.round(tileSize.h);var tile=row[colidx];if(!tile){tile=this.addTile(tileBounds,px);this.addTileMonitoringHooks(tile);row.push(tile)}else{tile.moveTo(tileBounds,px,false)}var tileCenter=tileBounds.getCenterLonLat();tileData.push({tile:tile,distance:Math.pow(tileCenter.lon-center.lon,2)+Math.pow(tileCenter.lat-center.lat,2)});colidx+=1}while(tileBounds.right<=bounds.right+tilelon*this.buffer||colidx<minCols);rowidx+=1}while(tileBounds.bottom>=bounds.bottom-tilelat*this.buffer||rowidx<minRows);this.removeExcessTiles(rowidx,colidx);var resolution=this.getServerResolution();this.gridResolution=resolution;tileData.sort(function(a,b){return a.distance-b.distance});for(var i=0,ii=tileData.length;i<ii;++i){tileData[i].tile.draw()}},getMaxExtent:function(){return this.maxExtent},addTile:function(bounds,position){var tile=new this.tileClass(this,position,bounds,null,this.tileSize,this.tileOptions);this.events.triggerEvent("addtile",{tile:tile});return tile},addTileMonitoringHooks:function(tile){var replacingCls="olTileReplacing";tile.onLoadStart=function(){if(this.loading===false){this.loading=true;this.events.triggerEvent("loadstart")}this.events.triggerEvent("tileloadstart",{tile:tile});this.numLoadingTiles++;if(!this.singleTile&&this.backBuffer&&this.gridResolution===this.backBufferResolution){OpenLayers.Element.addClass(tile.getTile(),replacingCls)}};tile.onLoadEnd=function(evt){this.numLoadingTiles--;var aborted=evt.type==="unload";this.events.triggerEvent("tileloaded",{tile:tile,aborted:aborted});if(!this.singleTile&&!aborted&&this.backBuffer&&this.gridResolution===this.backBufferResolution){var tileDiv=tile.getTile();if(OpenLayers.Element.getStyle(tileDiv,"display")==="none"){var bufferTile=document.getElementById(tile.id+"_bb");if(bufferTile){bufferTile.parentNode.removeChild(bufferTile)}}OpenLayers.Element.removeClass(tileDiv,replacingCls)}if(this.numLoadingTiles===0){if(this.backBuffer){if(this.backBuffer.childNodes.length===0){this.removeBackBuffer()}else{this._transitionElement=aborted?this.div.lastChild:tile.imgDiv;var transitionendEvents=this.transitionendEvents;for(var i=transitionendEvents.length-1;i>=0;--i){OpenLayers.Event.observe(this._transitionElement,transitionendEvents[i],this._removeBackBuffer)}this.backBufferTimerId=window.setTimeout(this._removeBackBuffer,this.removeBackBufferDelay)}}this.loading=false;this.events.triggerEvent("loadend")}};tile.onLoadError=function(){this.events.triggerEvent("tileerror",{tile:tile})};tile.events.on({loadstart:tile.onLoadStart,loadend:tile.onLoadEnd,unload:tile.onLoadEnd,loaderror:tile.onLoadError,scope:this})},removeTileMonitoringHooks:function(tile){tile.unload();tile.events.un({loadstart:tile.onLoadStart,loadend:tile.onLoadEnd,unload:tile.onLoadEnd,loaderror:tile.onLoadError,scope:this})},moveGriddedTiles:function(){var buffer=this.buffer+1;while(true){var tlTile=this.grid[0][0];var tlViewPort={x:tlTile.position.x+this.map.layerContainerOriginPx.x,y:tlTile.position.y+this.map.layerContainerOriginPx.y};var ratio=this.getServerResolution()/this.map.getResolution();var tileSize={w:Math.round(this.tileSize.w*ratio),h:Math.round(this.tileSize.h*ratio)};if(tlViewPort.x>-tileSize.w*(buffer-1)){this.shiftColumn(true,tileSize)}else if(tlViewPort.x<-tileSize.w*buffer){this.shiftColumn(false,tileSize)}else if(tlViewPort.y>-tileSize.h*(buffer-1)){this.shiftRow(true,tileSize)}else if(tlViewPort.y<-tileSize.h*buffer){this.shiftRow(false,tileSize)}else{break}}},shiftRow:function(prepend,tileSize){var grid=this.grid;var rowIndex=prepend?0:grid.length-1;var sign=prepend?-1:1;var rowSign=this.rowSign;var tileLayout=this.gridLayout;tileLayout.startrow+=sign*rowSign;var modelRow=grid[rowIndex];var row=grid[prepend?"pop":"shift"]();for(var i=0,len=row.length;i<len;i++){var tile=row[i];var position=modelRow[i].position.clone();position.y+=tileSize.h*sign;tile.moveTo(this.getTileBoundsForGridIndex(rowIndex,i),position)}grid[prepend?"unshift":"push"](row)},shiftColumn:function(prepend,tileSize){var grid=this.grid;var colIndex=prepend?0:grid[0].length-1;var sign=prepend?-1:1;var tileLayout=this.gridLayout;tileLayout.startcol+=sign;for(var i=0,len=grid.length;i<len;i++){var row=grid[i];var position=row[colIndex].position.clone();var tile=row[prepend?"pop":"shift"]();position.x+=tileSize.w*sign;tile.moveTo(this.getTileBoundsForGridIndex(i,colIndex),position);row[prepend?"unshift":"push"](tile)}},removeExcessTiles:function(rows,columns){var i,l;while(this.grid.length>rows){var row=this.grid.pop();for(i=0,l=row.length;i<l;i++){var tile=row[i];this.destroyTile(tile)}}for(i=0,l=this.grid.length;i<l;i++){while(this.grid[i].length>columns){var row=this.grid[i];var tile=row.pop();this.destroyTile(tile)}}},onMapResize:function(){if(this.singleTile){this.clearGrid();this.setTileSize()}},getTileBounds:function(viewPortPx){var maxExtent=this.maxExtent;var resolution=this.getResolution();var tileMapWidth=resolution*this.tileSize.w;var tileMapHeight=resolution*this.tileSize.h;var mapPoint=this.getLonLatFromViewPortPx(viewPortPx);var tileLeft=maxExtent.left+tileMapWidth*Math.floor((mapPoint.lon-maxExtent.left)/tileMapWidth);var tileBottom=maxExtent.bottom+tileMapHeight*Math.floor((mapPoint.lat-maxExtent.bottom)/tileMapHeight);return new OpenLayers.Bounds(tileLeft,tileBottom,tileLeft+tileMapWidth,tileBottom+tileMapHeight)},CLASS_NAME:"OpenLayers.Layer.Grid"});OpenLayers.Layer.XYZ=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:true,sphericalMercator:false,zoomOffset:0,serverResolutions:null,initialize:function(name,url,options){if(options&&options.sphericalMercator||this.sphericalMercator){options=OpenLayers.Util.extend({projection:"EPSG:900913",numZoomLevels:19},options)}OpenLayers.Layer.Grid.prototype.initialize.apply(this,[name||this.name,url||this.url,{},options])},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.XYZ(this.name,this.url,this.getOptions())}obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj},getURL:function(bounds){var xyz=this.getXYZ(bounds);var url=this.url;if(OpenLayers.Util.isArray(url)){var s=""+xyz.x+xyz.y+xyz.z;url=this.selectUrl(s,url)}return OpenLayers.String.format(url,xyz)},getXYZ:function(bounds){var res=this.getServerResolution();var x=Math.round((bounds.left-this.maxExtent.left)/(res*this.tileSize.w));var y=Math.round((this.maxExtent.top-bounds.top)/(res*this.tileSize.h));var z=this.getServerZoom();if(this.wrapDateLine){var limit=Math.pow(2,z);x=(x%limit+limit)%limit}return{x:x,y:y,z:z}},setMap:function(map){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments);if(!this.tileOrigin){this.tileOrigin=new OpenLayers.LonLat(this.maxExtent.left,this.maxExtent.bottom)}},CLASS_NAME:"OpenLayers.Layer.XYZ"});OpenLayers.Layer.OSM=OpenLayers.Class(OpenLayers.Layer.XYZ,{name:"OpenStreetMap",url:["http://a.tile.openstreetmap.org/${z}/${x}/${y}.png","http://b.tile.openstreetmap.org/${z}/${x}/${y}.png","http://c.tile.openstreetmap.org/${z}/${x}/${y}.png"],attribution:"&copy; <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a> contributors",sphericalMercator:true,wrapDateLine:true,tileOptions:null,initialize:function(name,url,options){OpenLayers.Layer.XYZ.prototype.initialize.apply(this,arguments);this.tileOptions=OpenLayers.Util.extend({crossOriginKeyword:"anonymous"},this.options&&this.options.tileOptions)},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.OSM(this.name,this.url,this.getOptions())}obj=OpenLayers.Layer.XYZ.prototype.clone.apply(this,[obj]);return obj},CLASS_NAME:"OpenLayers.Layer.OSM"});OpenLayers.Renderer=OpenLayers.Class({container:null,root:null,extent:null,locked:false,size:null,resolution:null,map:null,featureDx:0,initialize:function(containerID,options){this.container=OpenLayers.Util.getElement(containerID);OpenLayers.Util.extend(this,options)},destroy:function(){this.container=null;this.extent=null;this.size=null;this.resolution=null;this.map=null},supported:function(){return false},setExtent:function(extent,resolutionChanged){this.extent=extent.clone();if(this.map.baseLayer&&this.map.baseLayer.wrapDateLine){var ratio=extent.getWidth()/this.map.getExtent().getWidth(),extent=extent.scale(1/ratio);this.extent=extent.wrapDateLine(this.map.getMaxExtent()).scale(ratio)
}if(resolutionChanged){this.resolution=null}return true},setSize:function(size){this.size=size.clone();this.resolution=null},getResolution:function(){this.resolution=this.resolution||this.map.getResolution();return this.resolution},drawFeature:function(feature,style){if(style==null){style=feature.style}if(feature.geometry){var bounds=feature.geometry.getBounds();if(bounds){var worldBounds;if(this.map.baseLayer&&this.map.baseLayer.wrapDateLine){worldBounds=this.map.getMaxExtent()}if(!bounds.intersectsBounds(this.extent,{worldBounds:worldBounds})){style={display:"none"}}else{this.calculateFeatureDx(bounds,worldBounds)}var rendered=this.drawGeometry(feature.geometry,style,feature.id);if(style.display!="none"&&style.label&&rendered!==false){var location=feature.geometry.getCentroid();if(style.labelXOffset||style.labelYOffset){var xOffset=isNaN(style.labelXOffset)?0:style.labelXOffset;var yOffset=isNaN(style.labelYOffset)?0:style.labelYOffset;var res=this.getResolution();location.move(xOffset*res,yOffset*res)}this.drawText(feature.id,style,location)}else{this.removeText(feature.id)}return rendered}}},calculateFeatureDx:function(bounds,worldBounds){this.featureDx=0;if(worldBounds){var worldWidth=worldBounds.getWidth(),rendererCenterX=(this.extent.left+this.extent.right)/2,featureCenterX=(bounds.left+bounds.right)/2,worldsAway=Math.round((featureCenterX-rendererCenterX)/worldWidth);this.featureDx=worldsAway*worldWidth}},drawGeometry:function(geometry,style,featureId){},drawText:function(featureId,style,location){},removeText:function(featureId){},clear:function(){},getFeatureIdFromEvent:function(evt){},eraseFeatures:function(features){if(!OpenLayers.Util.isArray(features)){features=[features]}for(var i=0,len=features.length;i<len;++i){var feature=features[i];this.eraseGeometry(feature.geometry,feature.id);this.removeText(feature.id)}},eraseGeometry:function(geometry,featureId){},moveRoot:function(renderer){},getRenderLayerId:function(){return this.container.id},applyDefaultSymbolizer:function(symbolizer){var result=OpenLayers.Util.extend({},OpenLayers.Renderer.defaultSymbolizer);if(symbolizer.stroke===false){delete result.strokeWidth;delete result.strokeColor}if(symbolizer.fill===false){delete result.fillColor}OpenLayers.Util.extend(result,symbolizer);return result},CLASS_NAME:"OpenLayers.Renderer"});OpenLayers.Renderer.defaultSymbolizer={fillColor:"#000000",strokeColor:"#000000",strokeWidth:2,fillOpacity:1,strokeOpacity:1,pointRadius:0,labelAlign:"cm"};OpenLayers.Renderer.symbol={star:[350,75,379,161,469,161,397,215,423,301,350,250,277,301,303,215,231,161,321,161,350,75],cross:[4,0,6,0,6,4,10,4,10,6,6,6,6,10,4,10,4,6,0,6,0,4,4,4,4,0],x:[0,0,25,0,50,35,75,0,100,0,65,50,100,100,75,100,50,65,25,100,0,100,35,50,0,0],square:[0,0,0,1,1,1,1,0,0,0],triangle:[0,10,10,10,5,0,0,10]};OpenLayers.Renderer.Canvas=OpenLayers.Class(OpenLayers.Renderer,{hitDetection:true,hitOverflow:0,canvas:null,features:null,pendingRedraw:false,cachedSymbolBounds:{},initialize:function(containerID,options){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.root=document.createElement("canvas");this.container.appendChild(this.root);this.canvas=this.root.getContext("2d");this.features={};if(this.hitDetection){this.hitCanvas=document.createElement("canvas");this.hitContext=this.hitCanvas.getContext("2d")}},setExtent:function(){OpenLayers.Renderer.prototype.setExtent.apply(this,arguments);return false},eraseGeometry:function(geometry,featureId){this.eraseFeatures(this.features[featureId][0])},supported:function(){return OpenLayers.CANVAS_SUPPORTED},setSize:function(size){this.size=size.clone();var root=this.root;root.style.width=size.w+"px";root.style.height=size.h+"px";root.width=size.w;root.height=size.h;this.resolution=null;if(this.hitDetection){var hitCanvas=this.hitCanvas;hitCanvas.style.width=size.w+"px";hitCanvas.style.height=size.h+"px";hitCanvas.width=size.w;hitCanvas.height=size.h}},drawFeature:function(feature,style){var rendered;if(feature.geometry){style=this.applyDefaultSymbolizer(style||feature.style);var bounds=feature.geometry.getBounds();var worldBounds;if(this.map.baseLayer&&this.map.baseLayer.wrapDateLine){worldBounds=this.map.getMaxExtent()}var intersects=bounds&&bounds.intersectsBounds(this.extent,{worldBounds:worldBounds});rendered=style.display!=="none"&&!!bounds&&intersects;if(rendered){this.features[feature.id]=[feature,style]}else{delete this.features[feature.id]}this.pendingRedraw=true}if(this.pendingRedraw&&!this.locked){this.redraw();this.pendingRedraw=false}return rendered},drawGeometry:function(geometry,style,featureId){var className=geometry.CLASS_NAME;if(className=="OpenLayers.Geometry.Collection"||className=="OpenLayers.Geometry.MultiPoint"||className=="OpenLayers.Geometry.MultiLineString"||className=="OpenLayers.Geometry.MultiPolygon"){for(var i=0;i<geometry.components.length;i++){this.drawGeometry(geometry.components[i],style,featureId)}return}switch(geometry.CLASS_NAME){case"OpenLayers.Geometry.Point":this.drawPoint(geometry,style,featureId);break;case"OpenLayers.Geometry.LineString":this.drawLineString(geometry,style,featureId);break;case"OpenLayers.Geometry.LinearRing":this.drawLinearRing(geometry,style,featureId);break;case"OpenLayers.Geometry.Polygon":this.drawPolygon(geometry,style,featureId);break;default:break}},drawExternalGraphic:function(geometry,style,featureId){var img=new Image;var title=style.title||style.graphicTitle;if(title){img.title=title}var width=style.graphicWidth||style.graphicHeight;var height=style.graphicHeight||style.graphicWidth;width=width?width:style.pointRadius*2;height=height?height:style.pointRadius*2;var xOffset=style.graphicXOffset!=undefined?style.graphicXOffset:-(.5*width);var yOffset=style.graphicYOffset!=undefined?style.graphicYOffset:-(.5*height);var opacity=style.graphicOpacity||style.fillOpacity;var onLoad=function(){if(!this.features[featureId]){return}var pt=this.getLocalXY(geometry);var p0=pt[0];var p1=pt[1];if(!isNaN(p0)&&!isNaN(p1)){var x=p0+xOffset|0;var y=p1+yOffset|0;var canvas=this.canvas;canvas.globalAlpha=opacity;var factor=OpenLayers.Renderer.Canvas.drawImageScaleFactor||(OpenLayers.Renderer.Canvas.drawImageScaleFactor=/android 2.1/.test(navigator.userAgent.toLowerCase())?320/window.screen.width:1);canvas.drawImage(img,x*factor,y*factor,width*factor,height*factor);if(this.hitDetection){this.setHitContextStyle("fill",featureId);this.hitContext.fillRect(x,y,width,height)}}};img.onload=OpenLayers.Function.bind(onLoad,this);img.src=style.externalGraphic},drawNamedSymbol:function(geometry,style,featureId){var x,y,cx,cy,i,symbolBounds,scaling,angle;var unscaledStrokeWidth;var deg2rad=Math.PI/180;var symbol=OpenLayers.Renderer.symbol[style.graphicName];if(!symbol){throw new Error(style.graphicName+" is not a valid symbol name")}if(!symbol.length||symbol.length<2)return;var pt=this.getLocalXY(geometry);var p0=pt[0];var p1=pt[1];if(isNaN(p0)||isNaN(p1))return;this.canvas.lineCap="round";this.canvas.lineJoin="round";if(this.hitDetection){this.hitContext.lineCap="round";this.hitContext.lineJoin="round"}if(style.graphicName in this.cachedSymbolBounds){symbolBounds=this.cachedSymbolBounds[style.graphicName]}else{symbolBounds=new OpenLayers.Bounds;for(i=0;i<symbol.length;i+=2){symbolBounds.extend(new OpenLayers.LonLat(symbol[i],symbol[i+1]))}this.cachedSymbolBounds[style.graphicName]=symbolBounds}this.canvas.save();if(this.hitDetection){this.hitContext.save()}this.canvas.translate(p0,p1);if(this.hitDetection){this.hitContext.translate(p0,p1)}angle=deg2rad*style.rotation;if(!isNaN(angle)){this.canvas.rotate(angle);if(this.hitDetection){this.hitContext.rotate(angle)}}scaling=2*style.pointRadius/Math.max(symbolBounds.getWidth(),symbolBounds.getHeight());this.canvas.scale(scaling,scaling);if(this.hitDetection){this.hitContext.scale(scaling,scaling)}cx=symbolBounds.getCenterLonLat().lon;cy=symbolBounds.getCenterLonLat().lat;this.canvas.translate(-cx,-cy);if(this.hitDetection){this.hitContext.translate(-cx,-cy)}unscaledStrokeWidth=style.strokeWidth;style.strokeWidth=unscaledStrokeWidth/scaling;if(style.fill!==false){this.setCanvasStyle("fill",style);this.canvas.beginPath();for(i=0;i<symbol.length;i=i+2){x=symbol[i];y=symbol[i+1];if(i==0)this.canvas.moveTo(x,y);this.canvas.lineTo(x,y)}this.canvas.closePath();this.canvas.fill();if(this.hitDetection){this.setHitContextStyle("fill",featureId,style);this.hitContext.beginPath();for(i=0;i<symbol.length;i=i+2){x=symbol[i];y=symbol[i+1];if(i==0)this.canvas.moveTo(x,y);this.hitContext.lineTo(x,y)}this.hitContext.closePath();this.hitContext.fill()}}if(style.stroke!==false){this.setCanvasStyle("stroke",style);this.canvas.beginPath();for(i=0;i<symbol.length;i=i+2){x=symbol[i];y=symbol[i+1];if(i==0)this.canvas.moveTo(x,y);this.canvas.lineTo(x,y)}this.canvas.closePath();this.canvas.stroke();if(this.hitDetection){this.setHitContextStyle("stroke",featureId,style,scaling);this.hitContext.beginPath();for(i=0;i<symbol.length;i=i+2){x=symbol[i];y=symbol[i+1];if(i==0)this.hitContext.moveTo(x,y);this.hitContext.lineTo(x,y)}this.hitContext.closePath();this.hitContext.stroke()}}style.strokeWidth=unscaledStrokeWidth;this.canvas.restore();if(this.hitDetection){this.hitContext.restore()}this.setCanvasStyle("reset")},setCanvasStyle:function(type,style){if(type==="fill"){this.canvas.globalAlpha=style["fillOpacity"];this.canvas.fillStyle=style["fillColor"]}else if(type==="stroke"){this.canvas.globalAlpha=style["strokeOpacity"];this.canvas.strokeStyle=style["strokeColor"];this.canvas.lineWidth=style["strokeWidth"]}else{this.canvas.globalAlpha=0;this.canvas.lineWidth=1}},featureIdToHex:function(featureId){var id=Number(featureId.split("_").pop())+1;if(id>=16777216){this.hitOverflow=id-16777215;id=id%16777216+1}var hex="000000"+id.toString(16);var len=hex.length;hex="#"+hex.substring(len-6,len);return hex},setHitContextStyle:function(type,featureId,symbolizer,strokeScaling){var hex=this.featureIdToHex(featureId);if(type=="fill"){this.hitContext.globalAlpha=1;this.hitContext.fillStyle=hex}else if(type=="stroke"){this.hitContext.globalAlpha=1;this.hitContext.strokeStyle=hex;if(typeof strokeScaling==="undefined"){this.hitContext.lineWidth=symbolizer.strokeWidth+2}else{if(!isNaN(strokeScaling)){this.hitContext.lineWidth=symbolizer.strokeWidth+2/strokeScaling}}}else{this.hitContext.globalAlpha=0;this.hitContext.lineWidth=1}},drawPoint:function(geometry,style,featureId){if(style.graphic!==false){if(style.externalGraphic){this.drawExternalGraphic(geometry,style,featureId)}else if(style.graphicName&&style.graphicName!="circle"){this.drawNamedSymbol(geometry,style,featureId)}else{var pt=this.getLocalXY(geometry);var p0=pt[0];var p1=pt[1];if(!isNaN(p0)&&!isNaN(p1)){var twoPi=Math.PI*2;var radius=style.pointRadius;if(style.fill!==false){this.setCanvasStyle("fill",style);this.canvas.beginPath();this.canvas.arc(p0,p1,radius,0,twoPi,true);this.canvas.fill();if(this.hitDetection){this.setHitContextStyle("fill",featureId,style);this.hitContext.beginPath();this.hitContext.arc(p0,p1,radius,0,twoPi,true);this.hitContext.fill()}}if(style.stroke!==false){this.setCanvasStyle("stroke",style);this.canvas.beginPath();this.canvas.arc(p0,p1,radius,0,twoPi,true);this.canvas.stroke();if(this.hitDetection){this.setHitContextStyle("stroke",featureId,style);this.hitContext.beginPath();this.hitContext.arc(p0,p1,radius,0,twoPi,true);this.hitContext.stroke()}this.setCanvasStyle("reset")}}}}},drawLineString:function(geometry,style,featureId){style=OpenLayers.Util.applyDefaults({fill:false},style);this.drawLinearRing(geometry,style,featureId)},drawLinearRing:function(geometry,style,featureId){if(style.fill!==false){this.setCanvasStyle("fill",style);this.renderPath(this.canvas,geometry,style,featureId,"fill");if(this.hitDetection){this.setHitContextStyle("fill",featureId,style);this.renderPath(this.hitContext,geometry,style,featureId,"fill")}}if(style.stroke!==false){this.setCanvasStyle("stroke",style);this.renderPath(this.canvas,geometry,style,featureId,"stroke");if(this.hitDetection){this.setHitContextStyle("stroke",featureId,style);this.renderPath(this.hitContext,geometry,style,featureId,"stroke")}}this.setCanvasStyle("reset")},renderPath:function(context,geometry,style,featureId,type){var components=geometry.components;var len=components.length;context.beginPath();var start=this.getLocalXY(components[0]);var x=start[0];var y=start[1];if(!isNaN(x)&&!isNaN(y)){context.moveTo(start[0],start[1]);for(var i=1;i<len;++i){var pt=this.getLocalXY(components[i]);context.lineTo(pt[0],pt[1])}if(type==="fill"){context.fill()}else{context.stroke()}}},drawPolygon:function(geometry,style,featureId){var components=geometry.components;var len=components.length;this.drawLinearRing(components[0],style,featureId);for(var i=1;i<len;++i){this.canvas.globalCompositeOperation="destination-out";if(this.hitDetection){this.hitContext.globalCompositeOperation="destination-out"}this.drawLinearRing(components[i],OpenLayers.Util.applyDefaults({stroke:false,fillOpacity:1},style),featureId);this.canvas.globalCompositeOperation="source-over";if(this.hitDetection){this.hitContext.globalCompositeOperation="source-over"}this.drawLinearRing(components[i],OpenLayers.Util.applyDefaults({fill:false},style),featureId)}},drawText:function(location,style){var pt=this.getLocalXY(location);this.setCanvasStyle("reset");this.canvas.fillStyle=style.fontColor;this.canvas.globalAlpha=style.fontOpacity||1;var fontStyle=[style.fontStyle?style.fontStyle:"normal","normal",style.fontWeight?style.fontWeight:"normal",style.fontSize?style.fontSize:"1em",style.fontFamily?style.fontFamily:"sans-serif"].join(" ");var labelRows=style.label.split("\n");var numRows=labelRows.length;if(this.canvas.fillText){this.canvas.font=fontStyle;this.canvas.textAlign=OpenLayers.Renderer.Canvas.LABEL_ALIGN[style.labelAlign[0]]||"center";this.canvas.textBaseline=OpenLayers.Renderer.Canvas.LABEL_ALIGN[style.labelAlign[1]]||"middle";var vfactor=OpenLayers.Renderer.Canvas.LABEL_FACTOR[style.labelAlign[1]];if(vfactor==null){vfactor=-.5}var lineHeight=this.canvas.measureText("Mg").height||this.canvas.measureText("xx").width;pt[1]+=lineHeight*vfactor*(numRows-1);for(var i=0;i<numRows;i++){if(style.labelOutlineWidth){this.canvas.save();this.canvas.globalAlpha=style.labelOutlineOpacity||style.fontOpacity||1;this.canvas.strokeStyle=style.labelOutlineColor;this.canvas.lineWidth=style.labelOutlineWidth;this.canvas.strokeText(labelRows[i],pt[0],pt[1]+lineHeight*i+1);this.canvas.restore()}this.canvas.fillText(labelRows[i],pt[0],pt[1]+lineHeight*i)}}else if(this.canvas.mozDrawText){this.canvas.mozTextStyle=fontStyle;var hfactor=OpenLayers.Renderer.Canvas.LABEL_FACTOR[style.labelAlign[0]];if(hfactor==null){hfactor=-.5}var vfactor=OpenLayers.Renderer.Canvas.LABEL_FACTOR[style.labelAlign[1]];if(vfactor==null){vfactor=-.5}var lineHeight=this.canvas.mozMeasureText("xx");pt[1]+=lineHeight*(1+vfactor*numRows);for(var i=0;i<numRows;i++){var x=pt[0]+hfactor*this.canvas.mozMeasureText(labelRows[i]);var y=pt[1]+i*lineHeight;this.canvas.translate(x,y);this.canvas.mozDrawText(labelRows[i]);this.canvas.translate(-x,-y)}}this.setCanvasStyle("reset")},getLocalXY:function(point){var resolution=this.getResolution();var extent=this.extent;var x=(point.x-this.featureDx)/resolution+-extent.left/resolution;var y=extent.top/resolution-point.y/resolution;return[x,y]},clear:function(){var height=this.root.height;var width=this.root.width;this.canvas.clearRect(0,0,width,height);this.features={};if(this.hitDetection){this.hitContext.clearRect(0,0,width,height)}},getFeatureIdFromEvent:function(evt){var featureId,feature;if(this.hitDetection&&this.root.style.display!=="none"){if(!this.map.dragging){var xy=evt.xy;var x=xy.x|0;var y=xy.y|0;var data=this.hitContext.getImageData(x,y,1,1).data;if(data[3]===255){var id=data[2]+256*(data[1]+256*data[0]);if(id){featureId="OpenLayers_Feature_Vector_"+(id-1+this.hitOverflow);try{feature=this.features[featureId][0]}catch(err){}}}}}return feature},eraseFeatures:function(features){if(!OpenLayers.Util.isArray(features)){features=[features]}for(var i=0;i<features.length;++i){delete this.features[features[i].id]}this.redraw()},redraw:function(){if(!this.locked){var height=this.root.height;var width=this.root.width;this.canvas.clearRect(0,0,width,height);if(this.hitDetection){this.hitContext.clearRect(0,0,width,height)}var labelMap=[];var feature,geometry,style;var worldBounds=this.map.baseLayer&&this.map.baseLayer.wrapDateLine&&this.map.getMaxExtent();for(var id in this.features){if(!this.features.hasOwnProperty(id)){continue}feature=this.features[id][0];geometry=feature.geometry;this.calculateFeatureDx(geometry.getBounds(),worldBounds);style=this.features[id][1];this.drawGeometry(geometry,style,feature.id);if(style.label){labelMap.push([feature,style])}}var item;for(var i=0,len=labelMap.length;i<len;++i){item=labelMap[i];this.drawText(item[0].geometry.getCentroid(),item[1])}}},CLASS_NAME:"OpenLayers.Renderer.Canvas"});OpenLayers.Renderer.Canvas.LABEL_ALIGN={l:"left",r:"right",t:"top",b:"bottom"};OpenLayers.Renderer.Canvas.LABEL_FACTOR={l:0,r:-1,t:0,b:-1};OpenLayers.Renderer.Canvas.drawImageScaleFactor=null;OpenLayers.Handler=OpenLayers.Class({id:null,control:null,map:null,keyMask:null,active:false,evt:null,touch:false,initialize:function(control,callbacks,options){OpenLayers.Util.extend(this,options);this.control=control;this.callbacks=callbacks;var map=this.map||control.map;if(map){this.setMap(map)}this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},setMap:function(map){this.map=map},checkModifiers:function(evt){if(this.keyMask==null){return true}var keyModifiers=(evt.shiftKey?OpenLayers.Handler.MOD_SHIFT:0)|(evt.ctrlKey?OpenLayers.Handler.MOD_CTRL:0)|(evt.altKey?OpenLayers.Handler.MOD_ALT:0)|(evt.metaKey?OpenLayers.Handler.MOD_META:0);return keyModifiers==this.keyMask},activate:function(){if(this.active){return false}var events=OpenLayers.Events.prototype.BROWSER_EVENTS;for(var i=0,len=events.length;i<len;i++){if(this[events[i]]){this.register(events[i],this[events[i]])}}this.active=true;return true},deactivate:function(){if(!this.active){return false}var events=OpenLayers.Events.prototype.BROWSER_EVENTS;for(var i=0,len=events.length;i<len;i++){if(this[events[i]]){this.unregister(events[i],this[events[i]])}}this.touch=false;this.active=false;return true},startTouch:function(){if(!this.touch){this.touch=true;var events=["mousedown","mouseup","mousemove","click","dblclick","mouseout"];for(var i=0,len=events.length;i<len;i++){if(this[events[i]]){this.unregister(events[i],this[events[i]])}}}},callback:function(name,args){if(name&&this.callbacks[name]){this.callbacks[name].apply(this.control,args)}},register:function(name,method){this.map.events.registerPriority(name,this,method);this.map.events.registerPriority(name,this,this.setEvent)},unregister:function(name,method){this.map.events.unregister(name,this,method);this.map.events.unregister(name,this,this.setEvent)},setEvent:function(evt){this.evt=evt;return true},destroy:function(){this.deactivate();this.control=this.map=null},CLASS_NAME:"OpenLayers.Handler"});OpenLayers.Handler.MOD_NONE=0;OpenLayers.Handler.MOD_SHIFT=1;OpenLayers.Handler.MOD_CTRL=2;OpenLayers.Handler.MOD_ALT=4;OpenLayers.Handler.MOD_META=8;OpenLayers.Handler.Drag=OpenLayers.Class(OpenLayers.Handler,{started:false,stopDown:true,dragging:false,last:null,start:null,lastMoveEvt:null,oldOnselectstart:null,interval:0,timeoutId:null,documentDrag:false,documentEvents:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);if(this.documentDrag===true){var me=this;this._docMove=function(evt){me.mousemove({xy:{x:evt.clientX,y:evt.clientY},element:document})};this._docUp=function(evt){me.mouseup({xy:{x:evt.clientX,y:evt.clientY}})}}},dragstart:function(evt){var propagate=true;this.dragging=false;if(this.checkModifiers(evt)&&(OpenLayers.Event.isLeftClick(evt)||OpenLayers.Event.isSingleTouch(evt))){this.started=true;this.start=evt.xy;this.last=evt.xy;OpenLayers.Element.addClass(this.map.viewPortDiv,"olDragDown");this.down(evt);this.callback("down",[evt.xy]);OpenLayers.Event.preventDefault(evt);if(!this.oldOnselectstart){this.oldOnselectstart=document.onselectstart?document.onselectstart:OpenLayers.Function.True}document.onselectstart=OpenLayers.Function.False;propagate=!this.stopDown}else{this.started=false;this.start=null;this.last=null}return propagate},dragmove:function(evt){this.lastMoveEvt=evt;if(this.started&&!this.timeoutId&&(evt.xy.x!=this.last.x||evt.xy.y!=this.last.y)){if(this.documentDrag===true&&this.documentEvents){if(evt.element===document){this.adjustXY(evt);this.setEvent(evt)}else{this.removeDocumentEvents()}}if(this.interval>0){this.timeoutId=setTimeout(OpenLayers.Function.bind(this.removeTimeout,this),this.interval)}this.dragging=true;this.move(evt);this.callback("move",[evt.xy]);if(!this.oldOnselectstart){this.oldOnselectstart=document.onselectstart;document.onselectstart=OpenLayers.Function.False}this.last=evt.xy}return true},dragend:function(evt){if(this.started){if(this.documentDrag===true&&this.documentEvents){this.adjustXY(evt);this.removeDocumentEvents()}var dragged=this.start!=this.last;this.started=false;this.dragging=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.up(evt);this.callback("up",[evt.xy]);if(dragged){this.callback("done",[evt.xy])}document.onselectstart=this.oldOnselectstart}return true},down:function(evt){},move:function(evt){},up:function(evt){},out:function(evt){},mousedown:function(evt){return this.dragstart(evt)},touchstart:function(evt){this.startTouch();return this.dragstart(evt)},mousemove:function(evt){return this.dragmove(evt)},touchmove:function(evt){return this.dragmove(evt)},removeTimeout:function(){this.timeoutId=null;if(this.dragging){this.mousemove(this.lastMoveEvt)}},mouseup:function(evt){return this.dragend(evt)},touchend:function(evt){evt.xy=this.last;return this.dragend(evt)},mouseout:function(evt){if(this.started&&OpenLayers.Util.mouseLeft(evt,this.map.viewPortDiv)){if(this.documentDrag===true){this.addDocumentEvents()}else{var dragged=this.start!=this.last;this.started=false;this.dragging=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.out(evt);this.callback("out",[]);if(dragged){this.callback("done",[evt.xy])}if(document.onselectstart){document.onselectstart=this.oldOnselectstart}}}return true},click:function(evt){return this.start==this.last},activate:function(){var activated=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragging=false;activated=true}return activated},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.started=false;this.dragging=false;this.start=null;this.last=null;deactivated=true;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown")}return deactivated},adjustXY:function(evt){var pos=OpenLayers.Util.pagePosition(this.map.viewPortDiv);evt.xy.x-=pos[0];evt.xy.y-=pos[1]},addDocumentEvents:function(){OpenLayers.Element.addClass(document.body,"olDragDown");this.documentEvents=true;OpenLayers.Event.observe(document,"mousemove",this._docMove);OpenLayers.Event.observe(document,"mouseup",this._docUp)},removeDocumentEvents:function(){OpenLayers.Element.removeClass(document.body,"olDragDown");this.documentEvents=false;OpenLayers.Event.stopObserving(document,"mousemove",this._docMove);OpenLayers.Event.stopObserving(document,"mouseup",this._docUp)},CLASS_NAME:"OpenLayers.Handler.Drag"});OpenLayers.Handler.Keyboard=OpenLayers.Class(OpenLayers.Handler,{KEY_EVENTS:["keydown","keyup"],eventListener:null,observeElement:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.eventListener=OpenLayers.Function.bindAsEventListener(this.handleKeyEvent,this)},destroy:function(){this.deactivate();this.eventListener=null;OpenLayers.Handler.prototype.destroy.apply(this,arguments)},activate:function(){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.observeElement=this.observeElement||document;for(var i=0,len=this.KEY_EVENTS.length;i<len;i++){OpenLayers.Event.observe(this.observeElement,this.KEY_EVENTS[i],this.eventListener)}return true}else{return false}},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){for(var i=0,len=this.KEY_EVENTS.length;i<len;i++){OpenLayers.Event.stopObserving(this.observeElement,this.KEY_EVENTS[i],this.eventListener)}deactivated=true}return deactivated},handleKeyEvent:function(evt){if(this.checkModifiers(evt)){this.callback(evt.type,[evt])}},CLASS_NAME:"OpenLayers.Handler.Keyboard"});OpenLayers.Control.ModifyFeature=OpenLayers.Class(OpenLayers.Control,{documentDrag:false,geometryTypes:null,clickout:true,toggle:true,standalone:false,layer:null,feature:null,vertex:null,vertices:null,virtualVertices:null,handlers:null,deleteCodes:null,virtualStyle:null,vertexRenderIntent:null,mode:null,createVertices:true,modified:false,radiusHandle:null,dragHandle:null,onModificationStart:function(){},onModification:function(){},onModificationEnd:function(){},initialize:function(layer,options){options=options||{};this.layer=layer;this.vertices=[];this.virtualVertices=[];this.virtualStyle=OpenLayers.Util.extend({},this.layer.style||this.layer.styleMap.createSymbolizer(null,options.vertexRenderIntent));this.virtualStyle.fillOpacity=.3;this.virtualStyle.strokeOpacity=.3;this.deleteCodes=[46,68];this.mode=OpenLayers.Control.ModifyFeature.RESHAPE;OpenLayers.Control.prototype.initialize.apply(this,[options]);if(!OpenLayers.Util.isArray(this.deleteCodes)){this.deleteCodes=[this.deleteCodes]}var dragCallbacks={down:function(pixel){this.vertex=null;var feature=this.layer.getFeatureFromEvent(this.handlers.drag.evt);if(feature){this.dragStart(feature)}else if(this.clickout){this._unselect=this.feature}},move:function(pixel){delete this._unselect;if(this.vertex){this.dragVertex(this.vertex,pixel)}},up:function(){this.handlers.drag.stopDown=false;if(this._unselect){this.unselectFeature(this._unselect);delete this._unselect}},done:function(pixel){if(this.vertex){this.dragComplete(this.vertex)}}};var dragOptions={documentDrag:this.documentDrag,stopDown:false};var keyboardOptions={keydown:this.handleKeypress};this.handlers={keyboard:new OpenLayers.Handler.Keyboard(this,keyboardOptions),drag:new OpenLayers.Handler.Drag(this,dragCallbacks,dragOptions)}},destroy:function(){if(this.map){this.map.events.un({removelayer:this.handleMapEvents,changelayer:this.handleMapEvents,scope:this})}this.layer=null;OpenLayers.Control.prototype.destroy.apply(this,[])},activate:function(){this.moveLayerToTop();this.map.events.on({removelayer:this.handleMapEvents,changelayer:this.handleMapEvents,scope:this});return this.handlers.keyboard.activate()&&this.handlers.drag.activate()&&OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){var deactivated=false;if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)){this.moveLayerBack();this.map.events.un({removelayer:this.handleMapEvents,changelayer:this.handleMapEvents,scope:this});this.layer.removeFeatures(this.vertices,{silent:true});this.layer.removeFeatures(this.virtualVertices,{silent:true});this.vertices=[];this.handlers.drag.deactivate();this.handlers.keyboard.deactivate();var feature=this.feature;if(feature&&feature.geometry&&feature.layer){this.unselectFeature(feature)}deactivated=true}return deactivated},beforeSelectFeature:function(feature){return this.layer.events.triggerEvent("beforefeaturemodified",{feature:feature})},selectFeature:function(feature){if(this.feature===feature||this.geometryTypes&&OpenLayers.Util.indexOf(this.geometryTypes,feature.geometry.CLASS_NAME)==-1){return}if(this.beforeSelectFeature(feature)!==false){if(this.feature){this.unselectFeature(this.feature)}this.feature=feature;this.layer.selectedFeatures.push(feature);this.layer.drawFeature(feature,"select");this.modified=false;this.resetVertices();this.onModificationStart(this.feature)}var modified=feature.modified;if(feature.geometry&&!(modified&&modified.geometry)){this._originalGeometry=feature.geometry.clone()}},unselectFeature:function(feature){this.layer.removeFeatures(this.vertices,{silent:true});this.vertices=[];this.layer.destroyFeatures(this.virtualVertices,{silent:true});this.virtualVertices=[];if(this.dragHandle){this.layer.destroyFeatures([this.dragHandle],{silent:true});delete this.dragHandle}if(this.radiusHandle){this.layer.destroyFeatures([this.radiusHandle],{silent:true});delete this.radiusHandle}this.layer.drawFeature(this.feature,"default");this.feature=null;OpenLayers.Util.removeItem(this.layer.selectedFeatures,feature);this.onModificationEnd(feature);this.layer.events.triggerEvent("afterfeaturemodified",{feature:feature,modified:this.modified});this.modified=false},dragStart:function(feature){var isPoint=feature.geometry.CLASS_NAME=="OpenLayers.Geometry.Point";if(!this.standalone&&(!feature._sketch&&isPoint||!feature._sketch)){if(this.toggle&&this.feature===feature){this._unselect=feature}this.selectFeature(feature)}if(feature._sketch||isPoint){this.vertex=feature;this.handlers.drag.stopDown=true}},dragVertex:function(vertex,pixel){var pos=this.map.getLonLatFromViewPortPx(pixel);var geom=vertex.geometry;geom.move(pos.lon-geom.x,pos.lat-geom.y);this.modified=true;if(this.feature.geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){this.layer.events.triggerEvent("vertexmodified",{vertex:vertex.geometry,feature:this.feature,pixel:pixel})}else{if(vertex._index){vertex.geometry.parent.addComponent(vertex.geometry,vertex._index);delete vertex._index;OpenLayers.Util.removeItem(this.virtualVertices,vertex);this.vertices.push(vertex)}else if(vertex==this.dragHandle){this.layer.removeFeatures(this.vertices,{silent:true});this.vertices=[];if(this.radiusHandle){this.layer.destroyFeatures([this.radiusHandle],{silent:true});this.radiusHandle=null}}else if(vertex!==this.radiusHandle){this.layer.events.triggerEvent("vertexmodified",{vertex:vertex.geometry,feature:this.feature,pixel:pixel})}if(this.virtualVertices.length>0){this.layer.destroyFeatures(this.virtualVertices,{silent:true});this.virtualVertices=[]}this.layer.drawFeature(this.feature,this.standalone?undefined:"select")}this.layer.drawFeature(vertex)},dragComplete:function(vertex){this.resetVertices();this.setFeatureState();this.onModification(this.feature);this.layer.events.triggerEvent("featuremodified",{feature:this.feature})},setFeatureState:function(){if(this.feature.state!=OpenLayers.State.INSERT&&this.feature.state!=OpenLayers.State.DELETE){this.feature.state=OpenLayers.State.UPDATE;if(this.modified&&this._originalGeometry){var feature=this.feature;feature.modified=OpenLayers.Util.extend(feature.modified,{geometry:this._originalGeometry});delete this._originalGeometry}}},resetVertices:function(){if(this.vertices.length>0){this.layer.removeFeatures(this.vertices,{silent:true});this.vertices=[]}if(this.virtualVertices.length>0){this.layer.removeFeatures(this.virtualVertices,{silent:true});this.virtualVertices=[]}if(this.dragHandle){this.layer.destroyFeatures([this.dragHandle],{silent:true});this.dragHandle=null}if(this.radiusHandle){this.layer.destroyFeatures([this.radiusHandle],{silent:true});this.radiusHandle=null}if(this.feature&&this.feature.geometry.CLASS_NAME!="OpenLayers.Geometry.Point"){if(this.mode&OpenLayers.Control.ModifyFeature.DRAG){this.collectDragHandle()}if(this.mode&(OpenLayers.Control.ModifyFeature.ROTATE|OpenLayers.Control.ModifyFeature.RESIZE)){this.collectRadiusHandle()}if(this.mode&OpenLayers.Control.ModifyFeature.RESHAPE){if(!(this.mode&OpenLayers.Control.ModifyFeature.RESIZE)){this.collectVertices()}}}},handleKeypress:function(evt){var code=evt.keyCode;if(this.feature&&OpenLayers.Util.indexOf(this.deleteCodes,code)!=-1){var vertex=this.layer.getFeatureFromEvent(this.handlers.drag.evt);if(vertex&&OpenLayers.Util.indexOf(this.vertices,vertex)!=-1&&!this.handlers.drag.dragging&&vertex.geometry.parent){vertex.geometry.parent.removeComponent(vertex.geometry);
this.layer.events.triggerEvent("vertexremoved",{vertex:vertex.geometry,feature:this.feature,pixel:evt.xy});this.layer.drawFeature(this.feature,this.standalone?undefined:"select");this.modified=true;this.resetVertices();this.setFeatureState();this.onModification(this.feature);this.layer.events.triggerEvent("featuremodified",{feature:this.feature})}}},collectVertices:function(){this.vertices=[];this.virtualVertices=[];var control=this;function collectComponentVertices(geometry){var i,vertex,component,len;if(geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){vertex=new OpenLayers.Feature.Vector(geometry);vertex._sketch=true;vertex.renderIntent=control.vertexRenderIntent;control.vertices.push(vertex)}else{var numVert=geometry.components.length;if(geometry.CLASS_NAME=="OpenLayers.Geometry.LinearRing"){numVert-=1}for(i=0;i<numVert;++i){component=geometry.components[i];if(component.CLASS_NAME=="OpenLayers.Geometry.Point"){vertex=new OpenLayers.Feature.Vector(component);vertex._sketch=true;vertex.renderIntent=control.vertexRenderIntent;control.vertices.push(vertex)}else{collectComponentVertices(component)}}if(control.createVertices&&geometry.CLASS_NAME!="OpenLayers.Geometry.MultiPoint"){for(i=0,len=geometry.components.length;i<len-1;++i){var prevVertex=geometry.components[i];var nextVertex=geometry.components[i+1];if(prevVertex.CLASS_NAME=="OpenLayers.Geometry.Point"&&nextVertex.CLASS_NAME=="OpenLayers.Geometry.Point"){var x=(prevVertex.x+nextVertex.x)/2;var y=(prevVertex.y+nextVertex.y)/2;var point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(x,y),null,control.virtualStyle);point.geometry.parent=geometry;point._index=i+1;point._sketch=true;control.virtualVertices.push(point)}}}}}collectComponentVertices.call(this,this.feature.geometry);this.layer.addFeatures(this.virtualVertices,{silent:true});this.layer.addFeatures(this.vertices,{silent:true})},collectDragHandle:function(){var geometry=this.feature.geometry;var center=geometry.getBounds().getCenterLonLat();var originGeometry=new OpenLayers.Geometry.Point(center.lon,center.lat);var origin=new OpenLayers.Feature.Vector(originGeometry);originGeometry.move=function(x,y){OpenLayers.Geometry.Point.prototype.move.call(this,x,y);geometry.move(x,y)};origin._sketch=true;this.dragHandle=origin;this.dragHandle.renderIntent=this.vertexRenderIntent;this.layer.addFeatures([this.dragHandle],{silent:true})},collectRadiusHandle:function(){var geometry=this.feature.geometry;var bounds=geometry.getBounds();var center=bounds.getCenterLonLat();var originGeometry=new OpenLayers.Geometry.Point(center.lon,center.lat);var radiusGeometry=new OpenLayers.Geometry.Point(bounds.right,bounds.bottom);var radius=new OpenLayers.Feature.Vector(radiusGeometry);var resize=this.mode&OpenLayers.Control.ModifyFeature.RESIZE;var reshape=this.mode&OpenLayers.Control.ModifyFeature.RESHAPE;var rotate=this.mode&OpenLayers.Control.ModifyFeature.ROTATE;radiusGeometry.move=function(x,y){OpenLayers.Geometry.Point.prototype.move.call(this,x,y);var dx1=this.x-originGeometry.x;var dy1=this.y-originGeometry.y;var dx0=dx1-x;var dy0=dy1-y;if(rotate){var a0=Math.atan2(dy0,dx0);var a1=Math.atan2(dy1,dx1);var angle=a1-a0;angle*=180/Math.PI;geometry.rotate(angle,originGeometry)}if(resize){var scale,ratio;if(reshape){scale=dy1/dy0;ratio=dx1/dx0/scale}else{var l0=Math.sqrt(dx0*dx0+dy0*dy0);var l1=Math.sqrt(dx1*dx1+dy1*dy1);scale=l1/l0}geometry.resize(scale,originGeometry,ratio)}};radius._sketch=true;this.radiusHandle=radius;this.radiusHandle.renderIntent=this.vertexRenderIntent;this.layer.addFeatures([this.radiusHandle],{silent:true})},setMap:function(map){this.handlers.drag.setMap(map);OpenLayers.Control.prototype.setMap.apply(this,arguments)},handleMapEvents:function(evt){if(evt.type=="removelayer"||evt.property=="order"){this.moveLayerToTop()}},moveLayerToTop:function(){var index=Math.max(this.map.Z_INDEX_BASE["Feature"]-1,this.layer.getZIndex())+1;this.layer.setZIndex(index)},moveLayerBack:function(){var index=this.layer.getZIndex()-1;if(index>=this.map.Z_INDEX_BASE["Feature"]){this.layer.setZIndex(index)}else{this.map.setLayerZIndex(this.layer,this.map.getLayerIndex(this.layer))}},CLASS_NAME:"OpenLayers.Control.ModifyFeature"});OpenLayers.Control.ModifyFeature.RESHAPE=1;OpenLayers.Control.ModifyFeature.RESIZE=2;OpenLayers.Control.ModifyFeature.ROTATE=4;OpenLayers.Control.ModifyFeature.DRAG=8;OpenLayers.Layer.Bing=OpenLayers.Class(OpenLayers.Layer.XYZ,{key:null,serverResolutions:[156543.03390625,78271.516953125,39135.7584765625,19567.87923828125,9783.939619140625,4891.9698095703125,2445.9849047851562,1222.9924523925781,611.4962261962891,305.74811309814453,152.87405654907226,76.43702827453613,38.218514137268066,19.109257068634033,9.554628534317017,4.777314267158508,2.388657133579254,1.194328566789627,.5971642833948135,.29858214169740677,.14929107084870338,.07464553542435169],attributionTemplate:'<span class="olBingAttribution ${type}">'+'<div><a target="_blank" href="http://www.bing.com/maps/">'+'<img src="${logo}" /></a></div>${copyrights}'+'<a style="white-space: nowrap" target="_blank" '+'href="http://www.microsoft.com/maps/product/terms.html">'+"Terms of Use</a></span>",metadata:null,protocolRegex:/^http:/i,type:"Road",culture:"en-US",metadataParams:null,tileOptions:null,protocol:~window.location.href.indexOf("http")?"":"http:",initialize:function(options){options=OpenLayers.Util.applyDefaults({sphericalMercator:true},options);var name=options.name||"Bing "+(options.type||this.type);var newArgs=[name,null,options];OpenLayers.Layer.XYZ.prototype.initialize.apply(this,newArgs);this.tileOptions=OpenLayers.Util.extend({crossOriginKeyword:"anonymous"},this.options.tileOptions);this.loadMetadata()},loadMetadata:function(){this._callbackId="_callback_"+this.id.replace(/\./g,"_");window[this._callbackId]=OpenLayers.Function.bind(OpenLayers.Layer.Bing.processMetadata,this);var params=OpenLayers.Util.applyDefaults({key:this.key,jsonp:this._callbackId,include:"ImageryProviders"},this.metadataParams);var url=this.protocol+"//dev.virtualearth.net/REST/v1/Imagery/Metadata/"+this.type+"?"+OpenLayers.Util.getParameterString(params);var script=document.createElement("script");script.type="text/javascript";script.src=url;script.id=this._callbackId;document.getElementsByTagName("head")[0].appendChild(script)},initLayer:function(){var res=this.metadata.resourceSets[0].resources[0];var url=res.imageUrl.replace("{quadkey}","${quadkey}");url=url.replace("{culture}",this.culture);url=url.replace(this.protocolRegex,this.protocol);this.url=[];for(var i=0;i<res.imageUrlSubdomains.length;++i){this.url.push(url.replace("{subdomain}",res.imageUrlSubdomains[i]))}this.addOptions({maxResolution:Math.min(this.serverResolutions[res.zoomMin],this.maxResolution||Number.POSITIVE_INFINITY),numZoomLevels:Math.min(res.zoomMax+1-res.zoomMin,this.numZoomLevels)},true);if(!this.isBaseLayer){this.redraw()}this.updateAttribution()},getURL:function(bounds){if(!this.url){return}var xyz=this.getXYZ(bounds),x=xyz.x,y=xyz.y,z=xyz.z;var quadDigits=[];for(var i=z;i>0;--i){var digit="0";var mask=1<<i-1;if((x&mask)!=0){digit++}if((y&mask)!=0){digit++;digit++}quadDigits.push(digit)}var quadKey=quadDigits.join("");var url=this.selectUrl(""+x+y+z,this.url);return OpenLayers.String.format(url,{quadkey:quadKey})},updateAttribution:function(){var metadata=this.metadata;if(!metadata.resourceSets||!this.map||!this.map.center){return}var res=metadata.resourceSets[0].resources[0];var extent=this.map.getExtent().transform(this.map.getProjectionObject(),new OpenLayers.Projection("EPSG:4326"));var providers=res.imageryProviders||[],zoom=OpenLayers.Util.indexOf(this.serverResolutions,this.getServerResolution()),copyrights="",provider,i,ii,j,jj,bbox,coverage;for(i=0,ii=providers.length;i<ii;++i){provider=providers[i];for(j=0,jj=provider.coverageAreas.length;j<jj;++j){coverage=provider.coverageAreas[j];bbox=OpenLayers.Bounds.fromArray(coverage.bbox,true);if(extent.intersectsBounds(bbox)&&zoom<=coverage.zoomMax&&zoom>=coverage.zoomMin){copyrights+=provider.attribution+" "}}}var logo=metadata.brandLogoUri.replace(this.protocolRegex,this.protocol);this.attribution=OpenLayers.String.format(this.attributionTemplate,{type:this.type.toLowerCase(),logo:logo,copyrights:copyrights});this.map&&this.map.events.triggerEvent("changelayer",{layer:this,property:"attribution"})},setMap:function(){OpenLayers.Layer.XYZ.prototype.setMap.apply(this,arguments);this.map.events.register("moveend",this,this.updateAttribution)},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.Bing(this.options)}obj=OpenLayers.Layer.XYZ.prototype.clone.apply(this,[obj]);return obj},destroy:function(){this.map&&this.map.events.unregister("moveend",this,this.updateAttribution);OpenLayers.Layer.XYZ.prototype.destroy.apply(this,arguments)},CLASS_NAME:"OpenLayers.Layer.Bing"});OpenLayers.Layer.Bing.processMetadata=function(metadata){this.metadata=metadata;this.initLayer();var script=document.getElementById(this._callbackId);script.parentNode.removeChild(script);window[this._callbackId]=undefined;delete this._callbackId};OpenLayers.Geometry.MultiLineString=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LineString"],split:function(geometry,options){var results=null;var mutual=options&&options.mutual;var splits,sourceLine,sourceLines,sourceSplit,targetSplit;var sourceParts=[];var targetParts=[geometry];for(var i=0,len=this.components.length;i<len;++i){sourceLine=this.components[i];sourceSplit=false;for(var j=0;j<targetParts.length;++j){splits=sourceLine.split(targetParts[j],options);if(splits){if(mutual){sourceLines=splits[0];for(var k=0,klen=sourceLines.length;k<klen;++k){if(k===0&&sourceParts.length){sourceParts[sourceParts.length-1].addComponent(sourceLines[k])}else{sourceParts.push(new OpenLayers.Geometry.MultiLineString([sourceLines[k]]))}}sourceSplit=true;splits=splits[1]}if(splits.length){splits.unshift(j,1);Array.prototype.splice.apply(targetParts,splits);break}}}if(!sourceSplit){if(sourceParts.length){sourceParts[sourceParts.length-1].addComponent(sourceLine.clone())}else{sourceParts=[new OpenLayers.Geometry.MultiLineString(sourceLine.clone())]}}}if(sourceParts&&sourceParts.length>1){sourceSplit=true}else{sourceParts=[]}if(targetParts&&targetParts.length>1){targetSplit=true}else{targetParts=[]}if(sourceSplit||targetSplit){if(mutual){results=[sourceParts,targetParts]}else{results=targetParts}}return results},splitWith:function(geometry,options){var results=null;var mutual=options&&options.mutual;var splits,targetLine,sourceLines,sourceSplit,targetSplit,sourceParts,targetParts;if(geometry instanceof OpenLayers.Geometry.LineString){targetParts=[];sourceParts=[geometry];for(var i=0,len=this.components.length;i<len;++i){targetSplit=false;targetLine=this.components[i];for(var j=0;j<sourceParts.length;++j){splits=sourceParts[j].split(targetLine,options);if(splits){if(mutual){sourceLines=splits[0];if(sourceLines.length){sourceLines.unshift(j,1);Array.prototype.splice.apply(sourceParts,sourceLines);j+=sourceLines.length-2}splits=splits[1];if(splits.length===0){splits=[targetLine.clone()]}}for(var k=0,klen=splits.length;k<klen;++k){if(k===0&&targetParts.length){targetParts[targetParts.length-1].addComponent(splits[k])}else{targetParts.push(new OpenLayers.Geometry.MultiLineString([splits[k]]))}}targetSplit=true}}if(!targetSplit){if(targetParts.length){targetParts[targetParts.length-1].addComponent(targetLine.clone())}else{targetParts=[new OpenLayers.Geometry.MultiLineString([targetLine.clone()])]}}}}else{results=geometry.split(this)}if(sourceParts&&sourceParts.length>1){sourceSplit=true}else{sourceParts=[]}if(targetParts&&targetParts.length>1){targetSplit=true}else{targetParts=[]}if(sourceSplit||targetSplit){if(mutual){results=[sourceParts,targetParts]}else{results=targetParts}}return results},CLASS_NAME:"OpenLayers.Geometry.MultiLineString"});OpenLayers.Format=OpenLayers.Class({options:null,externalProjection:null,internalProjection:null,data:null,keepData:false,initialize:function(options){OpenLayers.Util.extend(this,options);this.options=options},destroy:function(){},read:function(data){throw new Error("Read not implemented.")},write:function(object){throw new Error("Write not implemented.")},CLASS_NAME:"OpenLayers.Format"});OpenLayers.Format.XML=OpenLayers.Class(OpenLayers.Format,{namespaces:null,namespaceAlias:null,defaultPrefix:null,readers:{},writers:{},xmldom:null,initialize:function(options){if(window.ActiveXObject){this.xmldom=new ActiveXObject("Microsoft.XMLDOM")}OpenLayers.Format.prototype.initialize.apply(this,[options]);this.namespaces=OpenLayers.Util.extend({},this.namespaces);this.namespaceAlias={};for(var alias in this.namespaces){this.namespaceAlias[this.namespaces[alias]]=alias}},destroy:function(){this.xmldom=null;OpenLayers.Format.prototype.destroy.apply(this,arguments)},setNamespace:function(alias,uri){this.namespaces[alias]=uri;this.namespaceAlias[uri]=alias},read:function(text){var index=text.indexOf("<");if(index>0){text=text.substring(index)}var node=OpenLayers.Util.Try(OpenLayers.Function.bind(function(){var xmldom;if(window.ActiveXObject&&!this.xmldom){xmldom=new ActiveXObject("Microsoft.XMLDOM")}else{xmldom=this.xmldom}xmldom.loadXML(text);return xmldom},this),function(){return(new DOMParser).parseFromString(text,"text/xml")},function(){var req=new XMLHttpRequest;req.open("GET","data:"+"text/xml"+";charset=utf-8,"+encodeURIComponent(text),false);if(req.overrideMimeType){req.overrideMimeType("text/xml")}req.send(null);return req.responseXML});if(this.keepData){this.data=node}return node},write:function(node){var data;if(this.xmldom){data=node.xml}else{var serializer=new XMLSerializer;if(node.nodeType==1){var doc=document.implementation.createDocument("","",null);if(doc.importNode){node=doc.importNode(node,true)}doc.appendChild(node);data=serializer.serializeToString(doc)}else{data=serializer.serializeToString(node)}}return data},createElementNS:function(uri,name){var element;if(this.xmldom){if(typeof uri=="string"){element=this.xmldom.createNode(1,name,uri)}else{element=this.xmldom.createNode(1,name,"")}}else{element=document.createElementNS(uri,name)}return element},createDocumentFragment:function(){var element;if(this.xmldom){element=this.xmldom.createDocumentFragment()}else{element=document.createDocumentFragment()}return element},createTextNode:function(text){var node;if(typeof text!=="string"){text=String(text)}if(this.xmldom){node=this.xmldom.createTextNode(text)}else{node=document.createTextNode(text)}return node},getElementsByTagNameNS:function(node,uri,name){var elements=[];if(node.getElementsByTagNameNS){elements=node.getElementsByTagNameNS(uri,name)}else{var allNodes=node.getElementsByTagName("*");var potentialNode,fullName;for(var i=0,len=allNodes.length;i<len;++i){potentialNode=allNodes[i];fullName=potentialNode.prefix?potentialNode.prefix+":"+name:name;if(name=="*"||fullName==potentialNode.nodeName){if(uri=="*"||uri==potentialNode.namespaceURI){elements.push(potentialNode)}}}}return elements},getAttributeNodeNS:function(node,uri,name){var attributeNode=null;if(node.getAttributeNodeNS){attributeNode=node.getAttributeNodeNS(uri,name)}else{var attributes=node.attributes;var potentialNode,fullName;for(var i=0,len=attributes.length;i<len;++i){potentialNode=attributes[i];if(potentialNode.namespaceURI==uri){fullName=potentialNode.prefix?potentialNode.prefix+":"+name:name;if(fullName==potentialNode.nodeName){attributeNode=potentialNode;break}}}}return attributeNode},getAttributeNS:function(node,uri,name){var attributeValue="";if(node.getAttributeNS){attributeValue=node.getAttributeNS(uri,name)||""}else{var attributeNode=this.getAttributeNodeNS(node,uri,name);if(attributeNode){attributeValue=attributeNode.nodeValue}}return attributeValue},getChildValue:function(node,def){var value=def||"";if(node){for(var child=node.firstChild;child;child=child.nextSibling){switch(child.nodeType){case 3:case 4:value+=child.nodeValue}}}return value},isSimpleContent:function(node){var simple=true;for(var child=node.firstChild;child;child=child.nextSibling){if(child.nodeType===1){simple=false;break}}return simple},contentType:function(node){var simple=false,complex=false;var type=OpenLayers.Format.XML.CONTENT_TYPE.EMPTY;for(var child=node.firstChild;child;child=child.nextSibling){switch(child.nodeType){case 1:complex=true;break;case 8:break;default:simple=true}if(complex&&simple){break}}if(complex&&simple){type=OpenLayers.Format.XML.CONTENT_TYPE.MIXED}else if(complex){return OpenLayers.Format.XML.CONTENT_TYPE.COMPLEX}else if(simple){return OpenLayers.Format.XML.CONTENT_TYPE.SIMPLE}return type},hasAttributeNS:function(node,uri,name){var found=false;if(node.hasAttributeNS){found=node.hasAttributeNS(uri,name)}else{found=!!this.getAttributeNodeNS(node,uri,name)}return found},setAttributeNS:function(node,uri,name,value){if(node.setAttributeNS){node.setAttributeNS(uri,name,value)}else{if(this.xmldom){if(uri){var attribute=node.ownerDocument.createNode(2,name,uri);attribute.nodeValue=value;node.setAttributeNode(attribute)}else{node.setAttribute(name,value)}}else{throw"setAttributeNS not implemented"}}},createElementNSPlus:function(name,options){options=options||{};var uri=options.uri||this.namespaces[options.prefix];if(!uri){var loc=name.indexOf(":");uri=this.namespaces[name.substring(0,loc)]}if(!uri){uri=this.namespaces[this.defaultPrefix]}var node=this.createElementNS(uri,name);if(options.attributes){this.setAttributes(node,options.attributes)}var value=options.value;if(value!=null){node.appendChild(this.createTextNode(value))}return node},setAttributes:function(node,obj){var value,uri;for(var name in obj){if(obj[name]!=null&&obj[name].toString){value=obj[name].toString();uri=this.namespaces[name.substring(0,name.indexOf(":"))]||null;this.setAttributeNS(node,uri,name,value)}}},readNode:function(node,obj){if(!obj){obj={}}var group=this.readers[node.namespaceURI?this.namespaceAlias[node.namespaceURI]:this.defaultPrefix];if(group){var local=node.localName||node.nodeName.split(":").pop();var reader=group[local]||group["*"];if(reader){reader.apply(this,[node,obj])}}return obj},readChildNodes:function(node,obj){if(!obj){obj={}}var children=node.childNodes;var child;for(var i=0,len=children.length;i<len;++i){child=children[i];if(child.nodeType==1){this.readNode(child,obj)}}return obj},writeNode:function(name,obj,parent){var prefix,local;var split=name.indexOf(":");if(split>0){prefix=name.substring(0,split);local=name.substring(split+1)}else{if(parent){prefix=this.namespaceAlias[parent.namespaceURI]}else{prefix=this.defaultPrefix}local=name}var child=this.writers[prefix][local].apply(this,[obj]);if(parent){parent.appendChild(child)}return child},getChildEl:function(node,name,uri){return node&&this.getThisOrNextEl(node.firstChild,name,uri)},getNextEl:function(node,name,uri){return node&&this.getThisOrNextEl(node.nextSibling,name,uri)},getThisOrNextEl:function(node,name,uri){outer:for(var sibling=node;sibling;sibling=sibling.nextSibling){switch(sibling.nodeType){case 1:if((!name||name===(sibling.localName||sibling.nodeName.split(":").pop()))&&(!uri||uri===sibling.namespaceURI)){break outer}sibling=null;break outer;case 3:if(/^\s*$/.test(sibling.nodeValue)){break}case 4:case 6:case 12:case 10:case 11:sibling=null;break outer}}return sibling||null},lookupNamespaceURI:function(node,prefix){var uri=null;if(node){if(node.lookupNamespaceURI){uri=node.lookupNamespaceURI(prefix)}else{outer:switch(node.nodeType){case 1:if(node.namespaceURI!==null&&node.prefix===prefix){uri=node.namespaceURI;break outer}var len=node.attributes.length;if(len){var attr;for(var i=0;i<len;++i){attr=node.attributes[i];if(attr.prefix==="xmlns"&&attr.name==="xmlns:"+prefix){uri=attr.value||null;break outer}else if(attr.name==="xmlns"&&prefix===null){uri=attr.value||null;break outer}}}uri=this.lookupNamespaceURI(node.parentNode,prefix);break outer;case 2:uri=this.lookupNamespaceURI(node.ownerElement,prefix);break outer;case 9:uri=this.lookupNamespaceURI(node.documentElement,prefix);break outer;case 6:case 12:case 10:case 11:break outer;default:uri=this.lookupNamespaceURI(node.parentNode,prefix);break outer}}}return uri},getXMLDoc:function(){if(!OpenLayers.Format.XML.document&&!this.xmldom){if(document.implementation&&document.implementation.createDocument){OpenLayers.Format.XML.document=document.implementation.createDocument("","",null)}else if(!this.xmldom&&window.ActiveXObject){this.xmldom=new ActiveXObject("Microsoft.XMLDOM")}}return OpenLayers.Format.XML.document||this.xmldom},CLASS_NAME:"OpenLayers.Format.XML"});OpenLayers.Format.XML.CONTENT_TYPE={EMPTY:0,SIMPLE:1,COMPLEX:2,MIXED:3};OpenLayers.Format.XML.lookupNamespaceURI=OpenLayers.Function.bind(OpenLayers.Format.XML.prototype.lookupNamespaceURI,OpenLayers.Format.XML.prototype);OpenLayers.Format.XML.document=null;OpenLayers.Format.OGCExceptionReport=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{ogc:"http://www.opengis.net/ogc"},regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g},defaultPrefix:"ogc",read:function(data){var result;if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data])}var root=data.documentElement;var exceptionInfo={exceptionReport:null};if(root){this.readChildNodes(data,exceptionInfo);if(exceptionInfo.exceptionReport===null){exceptionInfo=(new OpenLayers.Format.OWSCommon).read(data)}}return exceptionInfo},readers:{ogc:{ServiceExceptionReport:function(node,obj){obj.exceptionReport={exceptions:[]};this.readChildNodes(node,obj.exceptionReport)},ServiceException:function(node,exceptionReport){var exception={code:node.getAttribute("code"),locator:node.getAttribute("locator"),text:this.getChildValue(node)};exceptionReport.exceptions.push(exception)}}},CLASS_NAME:"OpenLayers.Format.OGCExceptionReport"});OpenLayers.Format.XML.VersionedOGC=OpenLayers.Class(OpenLayers.Format.XML,{defaultVersion:null,version:null,profile:null,allowFallback:false,name:null,stringifyOutput:false,parser:null,initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);var className=this.CLASS_NAME;this.name=className.substring(className.lastIndexOf(".")+1)},getVersion:function(root,options){var version;if(root){version=this.version;if(!version){version=root.getAttribute("version");if(!version){version=this.defaultVersion}}}else{version=options&&options.version||this.version||this.defaultVersion}return version},getParser:function(version){version=version||this.defaultVersion;var profile=this.profile?"_"+this.profile:"";if(!this.parser||this.parser.VERSION!=version){var format=OpenLayers.Format[this.name]["v"+version.replace(/\./g,"_")+profile];if(!format){if(profile!==""&&this.allowFallback){profile="";format=OpenLayers.Format[this.name]["v"+version.replace(/\./g,"_")]}if(!format){throw"Can't find a "+this.name+" parser for version "+version+profile}}this.parser=new format(this.options)}return this.parser},write:function(obj,options){var version=this.getVersion(null,options);this.parser=this.getParser(version);var root=this.parser.write(obj,options);if(this.stringifyOutput===false){return root}else{return OpenLayers.Format.XML.prototype.write.apply(this,[root])}},read:function(data,options){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data])}var root=data.documentElement;var version=this.getVersion(root);this.parser=this.getParser(version);var obj=this.parser.read(data,options);var errorProperty=this.parser.errorProperty||null;if(errorProperty!==null&&obj[errorProperty]===undefined){var format=new OpenLayers.Format.OGCExceptionReport;obj.error=format.read(data)}obj.version=version;return obj},CLASS_NAME:"OpenLayers.Format.XML.VersionedOGC"});OpenLayers.Feature=OpenLayers.Class({layer:null,id:null,lonlat:null,data:null,marker:null,popupClass:null,popup:null,initialize:function(layer,lonlat,data){this.layer=layer;this.lonlat=lonlat;this.data=data!=null?data:{};this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){if(this.layer!=null&&this.layer.map!=null){if(this.popup!=null){this.layer.map.removePopup(this.popup)}}if(this.layer!=null&&this.marker!=null){this.layer.removeMarker(this.marker)}this.layer=null;this.id=null;this.lonlat=null;this.data=null;if(this.marker!=null){this.destroyMarker(this.marker);this.marker=null}if(this.popup!=null){this.destroyPopup(this.popup);this.popup=null}},onScreen:function(){var onScreen=false;if(this.layer!=null&&this.layer.map!=null){var screenBounds=this.layer.map.getExtent();onScreen=screenBounds.containsLonLat(this.lonlat)}return onScreen},createMarker:function(){if(this.lonlat!=null){this.marker=new OpenLayers.Marker(this.lonlat,this.data.icon)}return this.marker},destroyMarker:function(){this.marker.destroy()},createPopup:function(closeBox){if(this.lonlat!=null){if(!this.popup){var anchor=this.marker?this.marker.icon:null;var popupClass=this.popupClass?this.popupClass:OpenLayers.Popup.Anchored;this.popup=new popupClass(this.id+"_popup",this.lonlat,this.data.popupSize,this.data.popupContentHTML,anchor,closeBox)}if(this.data.overflow!=null){this.popup.contentDiv.style.overflow=this.data.overflow}this.popup.feature=this}return this.popup},destroyPopup:function(){if(this.popup){this.popup.feature=null;this.popup.destroy();this.popup=null}},CLASS_NAME:"OpenLayers.Feature"});OpenLayers.State={UNKNOWN:"Unknown",INSERT:"Insert",UPDATE:"Update",DELETE:"Delete"};OpenLayers.Feature.Vector=OpenLayers.Class(OpenLayers.Feature,{fid:null,geometry:null,attributes:null,bounds:null,state:null,style:null,url:null,renderIntent:"default",modified:null,initialize:function(geometry,attributes,style){OpenLayers.Feature.prototype.initialize.apply(this,[null,null,attributes]);this.lonlat=null;this.geometry=geometry?geometry:null;this.state=null;this.attributes={};if(attributes){this.attributes=OpenLayers.Util.extend(this.attributes,attributes)}this.style=style?style:null},destroy:function(){if(this.layer){this.layer.removeFeatures(this);this.layer=null}this.geometry=null;this.modified=null;OpenLayers.Feature.prototype.destroy.apply(this,arguments)},clone:function(){return new OpenLayers.Feature.Vector(this.geometry?this.geometry.clone():null,this.attributes,this.style)},onScreen:function(boundsOnly){var onScreen=false;if(this.layer&&this.layer.map){var screenBounds=this.layer.map.getExtent();if(boundsOnly){var featureBounds=this.geometry.getBounds();onScreen=screenBounds.intersectsBounds(featureBounds)}else{var screenPoly=screenBounds.toGeometry();onScreen=screenPoly.intersects(this.geometry)}}return onScreen},getVisibility:function(){return!(this.style&&this.style.display=="none"||!this.layer||this.layer&&this.layer.styleMap&&this.layer.styleMap.createSymbolizer(this,this.renderIntent).display=="none"||this.layer&&!this.layer.getVisibility())},createMarker:function(){return null},destroyMarker:function(){},createPopup:function(){return null},atPoint:function(lonlat,toleranceLon,toleranceLat){var atPoint=false;if(this.geometry){atPoint=this.geometry.atPoint(lonlat,toleranceLon,toleranceLat)}return atPoint},destroyPopup:function(){},move:function(location){if(!this.layer||!this.geometry.move){return undefined}var pixel;if(location.CLASS_NAME=="OpenLayers.LonLat"){pixel=this.layer.getViewPortPxFromLonLat(location)}else{pixel=location}var lastPixel=this.layer.getViewPortPxFromLonLat(this.geometry.getBounds().getCenterLonLat());var res=this.layer.map.getResolution();this.geometry.move(res*(pixel.x-lastPixel.x),res*(lastPixel.y-pixel.y));this.layer.drawFeature(this);return lastPixel},toState:function(state){if(state==OpenLayers.State.UPDATE){switch(this.state){case OpenLayers.State.UNKNOWN:case OpenLayers.State.DELETE:this.state=state;break;case OpenLayers.State.UPDATE:case OpenLayers.State.INSERT:break}}else if(state==OpenLayers.State.INSERT){switch(this.state){case OpenLayers.State.UNKNOWN:break;default:this.state=state;break}}else if(state==OpenLayers.State.DELETE){switch(this.state){case OpenLayers.State.INSERT:break;case OpenLayers.State.DELETE:break;case OpenLayers.State.UNKNOWN:case OpenLayers.State.UPDATE:this.state=state;break}}else if(state==OpenLayers.State.UNKNOWN){this.state=state}},CLASS_NAME:"OpenLayers.Feature.Vector"});OpenLayers.Feature.Vector.style={"default":{fillColor:"#ee9900",fillOpacity:.4,hoverFillColor:"white",hoverFillOpacity:.8,strokeColor:"#ee9900",strokeOpacity:1,strokeWidth:1,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit",fontColor:"#000000",labelAlign:"cm",labelOutlineColor:"white",labelOutlineWidth:3},select:{fillColor:"blue",fillOpacity:.4,hoverFillColor:"white",hoverFillOpacity:.8,strokeColor:"blue",strokeOpacity:1,strokeWidth:2,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"pointer",fontColor:"#000000",labelAlign:"cm",labelOutlineColor:"white",labelOutlineWidth:3},temporary:{fillColor:"#66cccc",fillOpacity:.2,hoverFillColor:"white",hoverFillOpacity:.8,strokeColor:"#66cccc",strokeOpacity:1,strokeLinecap:"round",strokeWidth:2,strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit",fontColor:"#000000",labelAlign:"cm",labelOutlineColor:"white",labelOutlineWidth:3},"delete":{display:"none"}};OpenLayers.Style=OpenLayers.Class({id:null,name:null,title:null,description:null,layerName:null,isDefault:false,rules:null,context:null,defaultStyle:null,defaultsPerSymbolizer:false,propertyStyles:null,initialize:function(style,options){OpenLayers.Util.extend(this,options);this.rules=[];if(options&&options.rules){this.addRules(options.rules)}this.setDefaultStyle(style||OpenLayers.Feature.Vector.style["default"]);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){for(var i=0,len=this.rules.length;i<len;i++){this.rules[i].destroy();this.rules[i]=null}this.rules=null;this.defaultStyle=null},createSymbolizer:function(feature){var style=this.defaultsPerSymbolizer?{}:this.createLiterals(OpenLayers.Util.extend({},this.defaultStyle),feature);var rules=this.rules;var rule,context;var elseRules=[];var appliedRules=false;for(var i=0,len=rules.length;i<len;i++){rule=rules[i];var applies=rule.evaluate(feature);if(applies){if(rule instanceof OpenLayers.Rule&&rule.elseFilter){elseRules.push(rule)}else{appliedRules=true;this.applySymbolizer(rule,style,feature)}}}if(appliedRules==false&&elseRules.length>0){appliedRules=true;for(var i=0,len=elseRules.length;i<len;i++){this.applySymbolizer(elseRules[i],style,feature)}}if(rules.length>0&&appliedRules==false){style.display="none"}if(style.label!=null&&typeof style.label!=="string"){style.label=String(style.label)}return style},applySymbolizer:function(rule,style,feature){var symbolizerPrefix=feature.geometry?this.getSymbolizerPrefix(feature.geometry):OpenLayers.Style.SYMBOLIZER_PREFIXES[0];var symbolizer=rule.symbolizer[symbolizerPrefix]||rule.symbolizer;if(this.defaultsPerSymbolizer===true){var defaults=this.defaultStyle;OpenLayers.Util.applyDefaults(symbolizer,{pointRadius:defaults.pointRadius});if(symbolizer.stroke===true||symbolizer.graphic===true){OpenLayers.Util.applyDefaults(symbolizer,{strokeWidth:defaults.strokeWidth,strokeColor:defaults.strokeColor,strokeOpacity:defaults.strokeOpacity,strokeDashstyle:defaults.strokeDashstyle,strokeLinecap:defaults.strokeLinecap})}if(symbolizer.fill===true||symbolizer.graphic===true){OpenLayers.Util.applyDefaults(symbolizer,{fillColor:defaults.fillColor,fillOpacity:defaults.fillOpacity})}if(symbolizer.graphic===true){OpenLayers.Util.applyDefaults(symbolizer,{pointRadius:this.defaultStyle.pointRadius,externalGraphic:this.defaultStyle.externalGraphic,graphicName:this.defaultStyle.graphicName,graphicOpacity:this.defaultStyle.graphicOpacity,graphicWidth:this.defaultStyle.graphicWidth,graphicHeight:this.defaultStyle.graphicHeight,graphicXOffset:this.defaultStyle.graphicXOffset,graphicYOffset:this.defaultStyle.graphicYOffset})
}}return this.createLiterals(OpenLayers.Util.extend(style,symbolizer),feature)},createLiterals:function(style,feature){var context=OpenLayers.Util.extend({},feature.attributes||feature.data);OpenLayers.Util.extend(context,this.context);for(var i in this.propertyStyles){style[i]=OpenLayers.Style.createLiteral(style[i],context,feature,i)}return style},findPropertyStyles:function(){var propertyStyles={};var style=this.defaultStyle;this.addPropertyStyles(propertyStyles,style);var rules=this.rules;var symbolizer,value;for(var i=0,len=rules.length;i<len;i++){symbolizer=rules[i].symbolizer;for(var key in symbolizer){value=symbolizer[key];if(typeof value=="object"){this.addPropertyStyles(propertyStyles,value)}else{this.addPropertyStyles(propertyStyles,symbolizer);break}}}return propertyStyles},addPropertyStyles:function(propertyStyles,symbolizer){var property;for(var key in symbolizer){property=symbolizer[key];if(typeof property=="string"&&property.match(/\$\{\w+\}/)){propertyStyles[key]=true}}return propertyStyles},addRules:function(rules){Array.prototype.push.apply(this.rules,rules);this.propertyStyles=this.findPropertyStyles()},setDefaultStyle:function(style){this.defaultStyle=style;this.propertyStyles=this.findPropertyStyles()},getSymbolizerPrefix:function(geometry){var prefixes=OpenLayers.Style.SYMBOLIZER_PREFIXES;for(var i=0,len=prefixes.length;i<len;i++){if(geometry.CLASS_NAME.indexOf(prefixes[i])!=-1){return prefixes[i]}}},clone:function(){var options=OpenLayers.Util.extend({},this);if(this.rules){options.rules=[];for(var i=0,len=this.rules.length;i<len;++i){options.rules.push(this.rules[i].clone())}}options.context=this.context&&OpenLayers.Util.extend({},this.context);var defaultStyle=OpenLayers.Util.extend({},this.defaultStyle);return new OpenLayers.Style(defaultStyle,options)},CLASS_NAME:"OpenLayers.Style"});OpenLayers.Style.createLiteral=function(value,context,feature,property){if(typeof value=="string"&&value.indexOf("${")!=-1){value=OpenLayers.String.format(value,context,[feature,property]);value=isNaN(value)||!value?value:parseFloat(value)}return value};OpenLayers.Style.SYMBOLIZER_PREFIXES=["Point","Line","Polygon","Text","Raster"];OpenLayers.Filter=OpenLayers.Class({initialize:function(options){OpenLayers.Util.extend(this,options)},destroy:function(){},evaluate:function(context){return true},clone:function(){return null},toString:function(){var string;if(OpenLayers.Format&&OpenLayers.Format.CQL){string=OpenLayers.Format.CQL.prototype.write(this)}else{string=Object.prototype.toString.call(this)}return string},CLASS_NAME:"OpenLayers.Filter"});OpenLayers.Filter.FeatureId=OpenLayers.Class(OpenLayers.Filter,{fids:null,type:"FID",initialize:function(options){this.fids=[];OpenLayers.Filter.prototype.initialize.apply(this,[options])},evaluate:function(feature){for(var i=0,len=this.fids.length;i<len;i++){var fid=feature.fid||feature.id;if(fid==this.fids[i]){return true}}return false},clone:function(){var filter=new OpenLayers.Filter.FeatureId;OpenLayers.Util.extend(filter,this);filter.fids=this.fids.slice();return filter},CLASS_NAME:"OpenLayers.Filter.FeatureId"});OpenLayers.Filter.Logical=OpenLayers.Class(OpenLayers.Filter,{filters:null,type:null,initialize:function(options){this.filters=[];OpenLayers.Filter.prototype.initialize.apply(this,[options])},destroy:function(){this.filters=null;OpenLayers.Filter.prototype.destroy.apply(this)},evaluate:function(context){var i,len;switch(this.type){case OpenLayers.Filter.Logical.AND:for(i=0,len=this.filters.length;i<len;i++){if(this.filters[i].evaluate(context)==false){return false}}return true;case OpenLayers.Filter.Logical.OR:for(i=0,len=this.filters.length;i<len;i++){if(this.filters[i].evaluate(context)==true){return true}}return false;case OpenLayers.Filter.Logical.NOT:return!this.filters[0].evaluate(context)}return undefined},clone:function(){var filters=[];for(var i=0,len=this.filters.length;i<len;++i){filters.push(this.filters[i].clone())}return new OpenLayers.Filter.Logical({type:this.type,filters:filters})},CLASS_NAME:"OpenLayers.Filter.Logical"});OpenLayers.Filter.Logical.AND="&&";OpenLayers.Filter.Logical.OR="||";OpenLayers.Filter.Logical.NOT="!";OpenLayers.Filter.Comparison=OpenLayers.Class(OpenLayers.Filter,{type:null,property:null,value:null,matchCase:true,lowerBoundary:null,upperBoundary:null,initialize:function(options){OpenLayers.Filter.prototype.initialize.apply(this,[options]);if(this.type===OpenLayers.Filter.Comparison.LIKE&&options.matchCase===undefined){this.matchCase=null}},evaluate:function(context){if(context instanceof OpenLayers.Feature.Vector){context=context.attributes}var result=false;var got=context[this.property];var exp;switch(this.type){case OpenLayers.Filter.Comparison.EQUAL_TO:exp=this.value;if(!this.matchCase&&typeof got=="string"&&typeof exp=="string"){result=got.toUpperCase()==exp.toUpperCase()}else{result=got==exp}break;case OpenLayers.Filter.Comparison.NOT_EQUAL_TO:exp=this.value;if(!this.matchCase&&typeof got=="string"&&typeof exp=="string"){result=got.toUpperCase()!=exp.toUpperCase()}else{result=got!=exp}break;case OpenLayers.Filter.Comparison.LESS_THAN:result=got<this.value;break;case OpenLayers.Filter.Comparison.GREATER_THAN:result=got>this.value;break;case OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO:result=got<=this.value;break;case OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO:result=got>=this.value;break;case OpenLayers.Filter.Comparison.BETWEEN:result=got>=this.lowerBoundary&&got<=this.upperBoundary;break;case OpenLayers.Filter.Comparison.LIKE:var regexp=new RegExp(this.value,"gi");result=regexp.test(got);break;case OpenLayers.Filter.Comparison.IS_NULL:result=got===null;break}return result},value2regex:function(wildCard,singleChar,escapeChar){if(wildCard=="."){throw new Error("'.' is an unsupported wildCard character for "+"OpenLayers.Filter.Comparison")}wildCard=wildCard?wildCard:"*";singleChar=singleChar?singleChar:".";escapeChar=escapeChar?escapeChar:"!";this.value=this.value.replace(new RegExp("\\"+escapeChar+"(.|$)","g"),"\\$1");this.value=this.value.replace(new RegExp("\\"+singleChar,"g"),".");this.value=this.value.replace(new RegExp("\\"+wildCard,"g"),".*");this.value=this.value.replace(new RegExp("\\\\.\\*","g"),"\\"+wildCard);this.value=this.value.replace(new RegExp("\\\\\\.","g"),"\\"+singleChar);return this.value},regex2value:function(){var value=this.value;value=value.replace(/!/g,"!!");value=value.replace(/(\\)?\\\./g,function($0,$1){return $1?$0:"!."});value=value.replace(/(\\)?\\\*/g,function($0,$1){return $1?$0:"!*"});value=value.replace(/\\\\/g,"\\");value=value.replace(/\.\*/g,"*");return value},clone:function(){return OpenLayers.Util.extend(new OpenLayers.Filter.Comparison,this)},CLASS_NAME:"OpenLayers.Filter.Comparison"});OpenLayers.Filter.Comparison.EQUAL_TO="==";OpenLayers.Filter.Comparison.NOT_EQUAL_TO="!=";OpenLayers.Filter.Comparison.LESS_THAN="<";OpenLayers.Filter.Comparison.GREATER_THAN=">";OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO="<=";OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO=">=";OpenLayers.Filter.Comparison.BETWEEN="..";OpenLayers.Filter.Comparison.LIKE="~";OpenLayers.Filter.Comparison.IS_NULL="NULL";OpenLayers.Format.Filter=OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC,{defaultVersion:"1.0.0",CLASS_NAME:"OpenLayers.Format.Filter"});OpenLayers.Format.WFST=function(options){options=OpenLayers.Util.applyDefaults(options,OpenLayers.Format.WFST.DEFAULTS);var cls=OpenLayers.Format.WFST["v"+options.version.replace(/\./g,"_")];if(!cls){throw"Unsupported WFST version: "+options.version}return new cls(options)};OpenLayers.Format.WFST.DEFAULTS={version:"1.0.0"};OpenLayers.Filter.Spatial=OpenLayers.Class(OpenLayers.Filter,{type:null,property:null,value:null,distance:null,distanceUnits:null,evaluate:function(feature){var intersect=false;switch(this.type){case OpenLayers.Filter.Spatial.BBOX:case OpenLayers.Filter.Spatial.INTERSECTS:if(feature.geometry){var geom=this.value;if(this.value.CLASS_NAME=="OpenLayers.Bounds"){geom=this.value.toGeometry()}if(feature.geometry.intersects(geom)){intersect=true}}break;default:throw new Error("evaluate is not implemented for this filter type.")}return intersect},clone:function(){var options=OpenLayers.Util.applyDefaults({value:this.value&&this.value.clone&&this.value.clone()},this);return new OpenLayers.Filter.Spatial(options)},CLASS_NAME:"OpenLayers.Filter.Spatial"});OpenLayers.Filter.Spatial.BBOX="BBOX";OpenLayers.Filter.Spatial.INTERSECTS="INTERSECTS";OpenLayers.Filter.Spatial.DWITHIN="DWITHIN";OpenLayers.Filter.Spatial.WITHIN="WITHIN";OpenLayers.Filter.Spatial.CONTAINS="CONTAINS";OpenLayers.Format.WFST.v1=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance",wfs:"http://www.opengis.net/wfs",gml:"http://www.opengis.net/gml",ogc:"http://www.opengis.net/ogc",ows:"http://www.opengis.net/ows"},defaultPrefix:"wfs",version:null,schemaLocations:null,srsName:null,extractAttributes:true,xy:true,stateName:null,initialize:function(options){this.stateName={};this.stateName[OpenLayers.State.INSERT]="wfs:Insert";this.stateName[OpenLayers.State.UPDATE]="wfs:Update";this.stateName[OpenLayers.State.DELETE]="wfs:Delete";OpenLayers.Format.XML.prototype.initialize.apply(this,[options])},getSrsName:function(feature,options){var srsName=options&&options.srsName;if(!srsName){if(feature&&feature.layer){srsName=feature.layer.projection.getCode()}else{srsName=this.srsName}}return srsName},read:function(data,options){options=options||{};OpenLayers.Util.applyDefaults(options,{output:"features"});if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data])}if(data&&data.nodeType==9){data=data.documentElement}var obj={};if(data){this.readNode(data,obj,true)}if(obj.features&&options.output==="features"){obj=obj.features}return obj},readers:{wfs:{FeatureCollection:function(node,obj){obj.features=[];this.readChildNodes(node,obj)}}},write:function(features,options){var node=this.writeNode("wfs:Transaction",{features:features,options:options});var value=this.schemaLocationAttr();if(value){this.setAttributeNS(node,this.namespaces["xsi"],"xsi:schemaLocation",value)}return OpenLayers.Format.XML.prototype.write.apply(this,[node])},writers:{wfs:{GetFeature:function(options){var node=this.createElementNSPlus("wfs:GetFeature",{attributes:{service:"WFS",version:this.version,handle:options&&options.handle,outputFormat:options&&options.outputFormat,maxFeatures:options&&options.maxFeatures,"xsi:schemaLocation":this.schemaLocationAttr(options)}});if(typeof this.featureType=="string"){this.writeNode("Query",options,node)}else{for(var i=0,len=this.featureType.length;i<len;i++){options.featureType=this.featureType[i];this.writeNode("Query",options,node)}}return node},Transaction:function(obj){obj=obj||{};var options=obj.options||{};var node=this.createElementNSPlus("wfs:Transaction",{attributes:{service:"WFS",version:this.version,handle:options.handle}});var i,len;var features=obj.features;if(features){if(options.multi===true){OpenLayers.Util.extend(this.geometryTypes,{"OpenLayers.Geometry.Point":"MultiPoint","OpenLayers.Geometry.LineString":this.multiCurve===true?"MultiCurve":"MultiLineString","OpenLayers.Geometry.Polygon":this.multiSurface===true?"MultiSurface":"MultiPolygon"})}var name,feature;for(i=0,len=features.length;i<len;++i){feature=features[i];name=this.stateName[feature.state];if(name){this.writeNode(name,{feature:feature,options:options},node)}}if(options.multi===true){this.setGeometryTypes()}}if(options.nativeElements){for(i=0,len=options.nativeElements.length;i<len;++i){this.writeNode("wfs:Native",options.nativeElements[i],node)}}return node},Native:function(nativeElement){var node=this.createElementNSPlus("wfs:Native",{attributes:{vendorId:nativeElement.vendorId,safeToIgnore:nativeElement.safeToIgnore},value:nativeElement.value});return node},Insert:function(obj){var feature=obj.feature;var options=obj.options;var node=this.createElementNSPlus("wfs:Insert",{attributes:{handle:options&&options.handle}});this.srsName=this.getSrsName(feature);this.writeNode("feature:_typeName",feature,node);return node},Update:function(obj){var feature=obj.feature;var options=obj.options;var node=this.createElementNSPlus("wfs:Update",{attributes:{handle:options&&options.handle,typeName:(this.featureNS?this.featurePrefix+":":"")+this.featureType}});if(this.featureNS){node.setAttribute("xmlns:"+this.featurePrefix,this.featureNS)}var modified=feature.modified;if(this.geometryName!==null&&(!modified||modified.geometry!==undefined)){this.srsName=this.getSrsName(feature);this.writeNode("Property",{name:this.geometryName,value:feature.geometry},node)}for(var key in feature.attributes){if(feature.attributes[key]!==undefined&&(!modified||!modified.attributes||modified.attributes&&modified.attributes[key]!==undefined)){this.writeNode("Property",{name:key,value:feature.attributes[key]},node)}}this.writeNode("ogc:Filter",new OpenLayers.Filter.FeatureId({fids:[feature.fid]}),node);return node},Property:function(obj){var node=this.createElementNSPlus("wfs:Property");this.writeNode("Name",obj.name,node);if(obj.value!==null){this.writeNode("Value",obj.value,node)}return node},Name:function(name){return this.createElementNSPlus("wfs:Name",{value:name})},Value:function(obj){var node;if(obj instanceof OpenLayers.Geometry){node=this.createElementNSPlus("wfs:Value");var geom=this.writeNode("feature:_geometry",obj).firstChild;node.appendChild(geom)}else{node=this.createElementNSPlus("wfs:Value",{value:obj})}return node},Delete:function(obj){var feature=obj.feature;var options=obj.options;var node=this.createElementNSPlus("wfs:Delete",{attributes:{handle:options&&options.handle,typeName:(this.featureNS?this.featurePrefix+":":"")+this.featureType}});if(this.featureNS){node.setAttribute("xmlns:"+this.featurePrefix,this.featureNS)}this.writeNode("ogc:Filter",new OpenLayers.Filter.FeatureId({fids:[feature.fid]}),node);return node}}},schemaLocationAttr:function(options){options=OpenLayers.Util.extend({featurePrefix:this.featurePrefix,schema:this.schema},options);var schemaLocations=OpenLayers.Util.extend({},this.schemaLocations);if(options.schema){schemaLocations[options.featurePrefix]=options.schema}var parts=[];var uri;for(var key in schemaLocations){uri=this.namespaces[key];if(uri){parts.push(uri+" "+schemaLocations[key])}}var value=parts.join(" ")||undefined;return value},setFilterProperty:function(filter){if(filter.filters){for(var i=0,len=filter.filters.length;i<len;++i){OpenLayers.Format.WFST.v1.prototype.setFilterProperty.call(this,filter.filters[i])}}else{if(filter instanceof OpenLayers.Filter.Spatial&&!filter.property){filter.property=this.geometryName}}},CLASS_NAME:"OpenLayers.Format.WFST.v1"});OpenLayers.Geometry.Polygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LinearRing"],getArea:function(){var area=0;if(this.components&&this.components.length>0){area+=Math.abs(this.components[0].getArea());for(var i=1,len=this.components.length;i<len;i++){area-=Math.abs(this.components[i].getArea())}}return area},getGeodesicArea:function(projection){var area=0;if(this.components&&this.components.length>0){area+=Math.abs(this.components[0].getGeodesicArea(projection));for(var i=1,len=this.components.length;i<len;i++){area-=Math.abs(this.components[i].getGeodesicArea(projection))}}return area},containsPoint:function(point){var numRings=this.components.length;var contained=false;if(numRings>0){contained=this.components[0].containsPoint(point);if(contained!==1){if(contained&&numRings>1){var hole;for(var i=1;i<numRings;++i){hole=this.components[i].containsPoint(point);if(hole){if(hole===1){contained=1}else{contained=false}break}}}}}return contained},intersects:function(geometry){var intersect=false;var i,len;if(geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){intersect=this.containsPoint(geometry)}else if(geometry.CLASS_NAME=="OpenLayers.Geometry.LineString"||geometry.CLASS_NAME=="OpenLayers.Geometry.LinearRing"){for(i=0,len=this.components.length;i<len;++i){intersect=geometry.intersects(this.components[i]);if(intersect){break}}if(!intersect){for(i=0,len=geometry.components.length;i<len;++i){intersect=this.containsPoint(geometry.components[i]);if(intersect){break}}}}else{for(i=0,len=geometry.components.length;i<len;++i){intersect=this.intersects(geometry.components[i]);if(intersect){break}}}if(!intersect&&geometry.CLASS_NAME=="OpenLayers.Geometry.Polygon"){var ring=this.components[0];for(i=0,len=ring.components.length;i<len;++i){intersect=geometry.containsPoint(ring.components[i]);if(intersect){break}}}return intersect},distanceTo:function(geometry,options){var edge=!(options&&options.edge===false);var result;if(!edge&&this.intersects(geometry)){result=0}else{result=OpenLayers.Geometry.Collection.prototype.distanceTo.apply(this,[geometry,options])}return result},CLASS_NAME:"OpenLayers.Geometry.Polygon"});OpenLayers.Geometry.Polygon.createRegularPolygon=function(origin,radius,sides,rotation){var angle=Math.PI*(1/sides-1/2);if(rotation){angle+=rotation/180*Math.PI}var rotatedAngle,x,y;var points=[];for(var i=0;i<sides;++i){rotatedAngle=angle+i*2*Math.PI/sides;x=origin.x+radius*Math.cos(rotatedAngle);y=origin.y+radius*Math.sin(rotatedAngle);points.push(new OpenLayers.Geometry.Point(x,y))}var ring=new OpenLayers.Geometry.LinearRing(points);return new OpenLayers.Geometry.Polygon([ring])};OpenLayers.Geometry.MultiPolygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.Polygon"],CLASS_NAME:"OpenLayers.Geometry.MultiPolygon"});OpenLayers.Format.GML=OpenLayers.Class(OpenLayers.Format.XML,{featureNS:"http://mapserver.gis.umn.edu/mapserver",featurePrefix:"feature",featureName:"featureMember",layerName:"features",geometryName:"geometry",collectionName:"FeatureCollection",gmlns:"http://www.opengis.net/gml",extractAttributes:true,xy:true,initialize:function(options){this.regExes={trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g};OpenLayers.Format.XML.prototype.initialize.apply(this,[options])},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data])}var featureNodes=this.getElementsByTagNameNS(data.documentElement,this.gmlns,this.featureName);var features=[];for(var i=0;i<featureNodes.length;i++){var feature=this.parseFeature(featureNodes[i]);if(feature){features.push(feature)}}return features},parseFeature:function(node){var order=["MultiPolygon","Polygon","MultiLineString","LineString","MultiPoint","Point","Envelope"];var type,nodeList,geometry,parser;for(var i=0;i<order.length;++i){type=order[i];nodeList=this.getElementsByTagNameNS(node,this.gmlns,type);if(nodeList.length>0){parser=this.parseGeometry[type.toLowerCase()];if(parser){geometry=parser.apply(this,[nodeList[0]]);if(this.internalProjection&&this.externalProjection){geometry.transform(this.externalProjection,this.internalProjection)}}else{throw new TypeError("Unsupported geometry type: "+type)}break}}var bounds;var boxNodes=this.getElementsByTagNameNS(node,this.gmlns,"Box");for(i=0;i<boxNodes.length;++i){var boxNode=boxNodes[i];var box=this.parseGeometry["box"].apply(this,[boxNode]);var parentNode=boxNode.parentNode;var parentName=parentNode.localName||parentNode.nodeName.split(":").pop();if(parentName==="boundedBy"){bounds=box}else{geometry=box.toGeometry()}}var attributes;if(this.extractAttributes){attributes=this.parseAttributes(node)}var feature=new OpenLayers.Feature.Vector(geometry,attributes);feature.bounds=bounds;feature.gml={featureType:node.firstChild.nodeName.split(":")[1],featureNS:node.firstChild.namespaceURI,featureNSPrefix:node.firstChild.prefix};var childNode=node.firstChild;var fid;while(childNode){if(childNode.nodeType==1){fid=childNode.getAttribute("fid")||childNode.getAttribute("id");if(fid){break}}childNode=childNode.nextSibling}feature.fid=fid;return feature},parseGeometry:{point:function(node){var nodeList,coordString;var coords=[];var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"pos");if(nodeList.length>0){coordString=nodeList[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.trimSpace,"");coords=coordString.split(this.regExes.splitSpace)}if(coords.length==0){nodeList=this.getElementsByTagNameNS(node,this.gmlns,"coordinates");if(nodeList.length>0){coordString=nodeList[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.removeSpace,"");coords=coordString.split(",")}}if(coords.length==0){nodeList=this.getElementsByTagNameNS(node,this.gmlns,"coord");if(nodeList.length>0){var xList=this.getElementsByTagNameNS(nodeList[0],this.gmlns,"X");var yList=this.getElementsByTagNameNS(nodeList[0],this.gmlns,"Y");if(xList.length>0&&yList.length>0){coords=[xList[0].firstChild.nodeValue,yList[0].firstChild.nodeValue]}}}if(coords.length==2){coords[2]=null}if(this.xy){return new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2])}else{return new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2])}},multipoint:function(node){var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"Point");var components=[];if(nodeList.length>0){var point;for(var i=0;i<nodeList.length;++i){point=this.parseGeometry.point.apply(this,[nodeList[i]]);if(point){components.push(point)}}}return new OpenLayers.Geometry.MultiPoint(components)},linestring:function(node,ring){var nodeList,coordString;var coords=[];var points=[];nodeList=this.getElementsByTagNameNS(node,this.gmlns,"posList");if(nodeList.length>0){coordString=this.getChildValue(nodeList[0]);coordString=coordString.replace(this.regExes.trimSpace,"");coords=coordString.split(this.regExes.splitSpace);var dim=parseInt(nodeList[0].getAttribute("dimension"));var j,x,y,z;for(var i=0;i<coords.length/dim;++i){j=i*dim;x=coords[j];y=coords[j+1];z=dim==2?null:coords[j+2];if(this.xy){points.push(new OpenLayers.Geometry.Point(x,y,z))}else{points.push(new OpenLayers.Geometry.Point(y,x,z))}}}if(coords.length==0){nodeList=this.getElementsByTagNameNS(node,this.gmlns,"coordinates");if(nodeList.length>0){coordString=this.getChildValue(nodeList[0]);coordString=coordString.replace(this.regExes.trimSpace,"");coordString=coordString.replace(this.regExes.trimComma,",");var pointList=coordString.split(this.regExes.splitSpace);for(var i=0;i<pointList.length;++i){coords=pointList[i].split(",");if(coords.length==2){coords[2]=null}if(this.xy){points.push(new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]))}else{points.push(new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2]))}}}}var line=null;if(points.length!=0){if(ring){line=new OpenLayers.Geometry.LinearRing(points)}else{line=new OpenLayers.Geometry.LineString(points)}}return line},multilinestring:function(node){var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"LineString");var components=[];if(nodeList.length>0){var line;for(var i=0;i<nodeList.length;++i){line=this.parseGeometry.linestring.apply(this,[nodeList[i]]);if(line){components.push(line)}}}return new OpenLayers.Geometry.MultiLineString(components)},polygon:function(node){var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"LinearRing");var components=[];if(nodeList.length>0){var ring;for(var i=0;i<nodeList.length;++i){ring=this.parseGeometry.linestring.apply(this,[nodeList[i],true]);if(ring){components.push(ring)}}}return new OpenLayers.Geometry.Polygon(components)},multipolygon:function(node){var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"Polygon");var components=[];if(nodeList.length>0){var polygon;for(var i=0;i<nodeList.length;++i){polygon=this.parseGeometry.polygon.apply(this,[nodeList[i]]);if(polygon){components.push(polygon)}}}return new OpenLayers.Geometry.MultiPolygon(components)},envelope:function(node){var components=[];var coordString;var envelope;var lpoint=this.getElementsByTagNameNS(node,this.gmlns,"lowerCorner");if(lpoint.length>0){var coords=[];if(lpoint.length>0){coordString=lpoint[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.trimSpace,"");coords=coordString.split(this.regExes.splitSpace)}if(coords.length==2){coords[2]=null}if(this.xy){var lowerPoint=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2])}else{var lowerPoint=new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2])}}var upoint=this.getElementsByTagNameNS(node,this.gmlns,"upperCorner");if(upoint.length>0){var coords=[];if(upoint.length>0){coordString=upoint[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.trimSpace,"");coords=coordString.split(this.regExes.splitSpace)}if(coords.length==2){coords[2]=null}if(this.xy){var upperPoint=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2])}else{var upperPoint=new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2])}}if(lowerPoint&&upperPoint){components.push(new OpenLayers.Geometry.Point(lowerPoint.x,lowerPoint.y));components.push(new OpenLayers.Geometry.Point(upperPoint.x,lowerPoint.y));components.push(new OpenLayers.Geometry.Point(upperPoint.x,upperPoint.y));components.push(new OpenLayers.Geometry.Point(lowerPoint.x,upperPoint.y));components.push(new OpenLayers.Geometry.Point(lowerPoint.x,lowerPoint.y));var ring=new OpenLayers.Geometry.LinearRing(components);envelope=new OpenLayers.Geometry.Polygon([ring])}return envelope},box:function(node){var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"coordinates");var coordString;var coords,beginPoint=null,endPoint=null;if(nodeList.length>0){coordString=nodeList[0].firstChild.nodeValue;coords=coordString.split(" ");if(coords.length==2){beginPoint=coords[0].split(",");endPoint=coords[1].split(",")}}if(beginPoint!==null&&endPoint!==null){return new OpenLayers.Bounds(parseFloat(beginPoint[0]),parseFloat(beginPoint[1]),parseFloat(endPoint[0]),parseFloat(endPoint[1]))}}},parseAttributes:function(node){var attributes={};var childNode=node.firstChild;var children,i,child,grandchildren,grandchild,name,value;while(childNode){if(childNode.nodeType==1){children=childNode.childNodes;for(i=0;i<children.length;++i){child=children[i];if(child.nodeType==1){grandchildren=child.childNodes;if(grandchildren.length==1){grandchild=grandchildren[0];if(grandchild.nodeType==3||grandchild.nodeType==4){name=child.prefix?child.nodeName.split(":")[1]:child.nodeName;value=grandchild.nodeValue.replace(this.regExes.trimSpace,"");attributes[name]=value}}else{attributes[child.nodeName.split(":").pop()]=null}}}break}childNode=childNode.nextSibling}return attributes},write:function(features){if(!OpenLayers.Util.isArray(features)){features=[features]}var gml=this.createElementNS("http://www.opengis.net/wfs","wfs:"+this.collectionName);for(var i=0;i<features.length;i++){gml.appendChild(this.createFeatureXML(features[i]))}return OpenLayers.Format.XML.prototype.write.apply(this,[gml])},createFeatureXML:function(feature){var geometry=feature.geometry;var geometryNode=this.buildGeometryNode(geometry);var geomContainer=this.createElementNS(this.featureNS,this.featurePrefix+":"+this.geometryName);geomContainer.appendChild(geometryNode);var featureNode=this.createElementNS(this.gmlns,"gml:"+this.featureName);var featureContainer=this.createElementNS(this.featureNS,this.featurePrefix+":"+this.layerName);var fid=feature.fid||feature.id;featureContainer.setAttribute("fid",fid);featureContainer.appendChild(geomContainer);for(var attr in feature.attributes){var attrText=this.createTextNode(feature.attributes[attr]);var nodename=attr.substring(attr.lastIndexOf(":")+1);var attrContainer=this.createElementNS(this.featureNS,this.featurePrefix+":"+nodename);attrContainer.appendChild(attrText);featureContainer.appendChild(attrContainer)}featureNode.appendChild(featureContainer);return featureNode},buildGeometryNode:function(geometry){if(this.externalProjection&&this.internalProjection){geometry=geometry.clone();geometry.transform(this.internalProjection,this.externalProjection)}var className=geometry.CLASS_NAME;var type=className.substring(className.lastIndexOf(".")+1);var builder=this.buildGeometry[type.toLowerCase()];return builder.apply(this,[geometry])},buildGeometry:{point:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:Point");gml.appendChild(this.buildCoordinatesNode(geometry));return gml},multipoint:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:MultiPoint");var points=geometry.components;var pointMember,pointGeom;for(var i=0;i<points.length;i++){pointMember=this.createElementNS(this.gmlns,"gml:pointMember");pointGeom=this.buildGeometry.point.apply(this,[points[i]]);pointMember.appendChild(pointGeom);gml.appendChild(pointMember)}return gml},linestring:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:LineString");gml.appendChild(this.buildCoordinatesNode(geometry));return gml},multilinestring:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:MultiLineString");var lines=geometry.components;var lineMember,lineGeom;for(var i=0;i<lines.length;++i){lineMember=this.createElementNS(this.gmlns,"gml:lineStringMember");lineGeom=this.buildGeometry.linestring.apply(this,[lines[i]]);lineMember.appendChild(lineGeom);gml.appendChild(lineMember)}return gml},linearring:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:LinearRing");gml.appendChild(this.buildCoordinatesNode(geometry));return gml},polygon:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:Polygon");var rings=geometry.components;var ringMember,ringGeom,type;for(var i=0;i<rings.length;++i){type=i==0?"outerBoundaryIs":"innerBoundaryIs";ringMember=this.createElementNS(this.gmlns,"gml:"+type);ringGeom=this.buildGeometry.linearring.apply(this,[rings[i]]);ringMember.appendChild(ringGeom);gml.appendChild(ringMember)}return gml},multipolygon:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:MultiPolygon");var polys=geometry.components;var polyMember,polyGeom;for(var i=0;i<polys.length;++i){polyMember=this.createElementNS(this.gmlns,"gml:polygonMember");polyGeom=this.buildGeometry.polygon.apply(this,[polys[i]]);polyMember.appendChild(polyGeom);gml.appendChild(polyMember)}return gml},bounds:function(bounds){var gml=this.createElementNS(this.gmlns,"gml:Box");gml.appendChild(this.buildCoordinatesNode(bounds));return gml}},buildCoordinatesNode:function(geometry){var coordinatesNode=this.createElementNS(this.gmlns,"gml:coordinates");coordinatesNode.setAttribute("decimal",".");coordinatesNode.setAttribute("cs",",");coordinatesNode.setAttribute("ts"," ");var parts=[];if(geometry instanceof OpenLayers.Bounds){parts.push(geometry.left+","+geometry.bottom);parts.push(geometry.right+","+geometry.top)}else{var points=geometry.components?geometry.components:[geometry];for(var i=0;i<points.length;i++){parts.push(points[i].x+","+points[i].y)}}var txtNode=this.createTextNode(parts.join(" "));coordinatesNode.appendChild(txtNode);return coordinatesNode},CLASS_NAME:"OpenLayers.Format.GML"});if(!OpenLayers.Format.GML){OpenLayers.Format.GML={}}OpenLayers.Format.GML.Base=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{gml:"http://www.opengis.net/gml",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance",wfs:"http://www.opengis.net/wfs"},defaultPrefix:"gml",schemaLocation:null,featureType:null,featureNS:null,geometryName:"geometry",extractAttributes:true,srsName:null,xy:true,geometryTypes:null,singleFeatureType:null,regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g,featureMember:/^(.*:)?featureMembers?$/},initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);this.setGeometryTypes();if(options&&options.featureNS){this.setNamespace("feature",options.featureNS)}this.singleFeatureType=!options||typeof options.featureType==="string"},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data])}if(data&&data.nodeType==9){data=data.documentElement}var features=[];this.readNode(data,{features:features},true);
if(features.length==0){var elements=this.getElementsByTagNameNS(data,this.namespaces.gml,"featureMember");if(elements.length){for(var i=0,len=elements.length;i<len;++i){this.readNode(elements[i],{features:features},true)}}else{var elements=this.getElementsByTagNameNS(data,this.namespaces.gml,"featureMembers");if(elements.length){this.readNode(elements[0],{features:features},true)}}}return features},readNode:function(node,obj,first){if(first===true&&this.autoConfig===true){this.featureType=null;delete this.namespaceAlias[this.featureNS];delete this.namespaces["feature"];this.featureNS=null}if(!this.featureNS&&(!(node.prefix in this.namespaces)&&node.parentNode.namespaceURI==this.namespaces["gml"]&&this.regExes.featureMember.test(node.parentNode.nodeName))){this.featureType=node.nodeName.split(":").pop();this.setNamespace("feature",node.namespaceURI);this.featureNS=node.namespaceURI;this.autoConfig=true}return OpenLayers.Format.XML.prototype.readNode.apply(this,[node,obj])},readers:{gml:{_inherit:function(node,obj,container){},featureMember:function(node,obj){this.readChildNodes(node,obj)},featureMembers:function(node,obj){this.readChildNodes(node,obj)},name:function(node,obj){obj.name=this.getChildValue(node)},boundedBy:function(node,obj){var container={};this.readChildNodes(node,container);if(container.components&&container.components.length>0){obj.bounds=container.components[0]}},Point:function(node,container){var obj={points:[]};this.readChildNodes(node,obj);if(!container.components){container.components=[]}container.components.push(obj.points[0])},coordinates:function(node,obj){var str=this.getChildValue(node).replace(this.regExes.trimSpace,"");str=str.replace(this.regExes.trimComma,",");var pointList=str.split(this.regExes.splitSpace);var coords;var numPoints=pointList.length;var points=new Array(numPoints);for(var i=0;i<numPoints;++i){coords=pointList[i].split(",");if(this.xy){points[i]=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2])}else{points[i]=new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2])}}obj.points=points},coord:function(node,obj){var coord={};this.readChildNodes(node,coord);if(!obj.points){obj.points=[]}obj.points.push(new OpenLayers.Geometry.Point(coord.x,coord.y,coord.z))},X:function(node,coord){coord.x=this.getChildValue(node)},Y:function(node,coord){coord.y=this.getChildValue(node)},Z:function(node,coord){coord.z=this.getChildValue(node)},MultiPoint:function(node,container){var obj={components:[]};this.readers.gml._inherit.apply(this,[node,obj,container]);this.readChildNodes(node,obj);container.components=[new OpenLayers.Geometry.MultiPoint(obj.components)]},pointMember:function(node,obj){this.readChildNodes(node,obj)},LineString:function(node,container){var obj={};this.readers.gml._inherit.apply(this,[node,obj,container]);this.readChildNodes(node,obj);if(!container.components){container.components=[]}container.components.push(new OpenLayers.Geometry.LineString(obj.points))},MultiLineString:function(node,container){var obj={components:[]};this.readers.gml._inherit.apply(this,[node,obj,container]);this.readChildNodes(node,obj);container.components=[new OpenLayers.Geometry.MultiLineString(obj.components)]},lineStringMember:function(node,obj){this.readChildNodes(node,obj)},Polygon:function(node,container){var obj={outer:null,inner:[]};this.readers.gml._inherit.apply(this,[node,obj,container]);this.readChildNodes(node,obj);obj.inner.unshift(obj.outer);if(!container.components){container.components=[]}container.components.push(new OpenLayers.Geometry.Polygon(obj.inner))},LinearRing:function(node,obj){var container={};this.readers.gml._inherit.apply(this,[node,container]);this.readChildNodes(node,container);obj.components=[new OpenLayers.Geometry.LinearRing(container.points)]},MultiPolygon:function(node,container){var obj={components:[]};this.readers.gml._inherit.apply(this,[node,obj,container]);this.readChildNodes(node,obj);container.components=[new OpenLayers.Geometry.MultiPolygon(obj.components)]},polygonMember:function(node,obj){this.readChildNodes(node,obj)},GeometryCollection:function(node,container){var obj={components:[]};this.readers.gml._inherit.apply(this,[node,obj,container]);this.readChildNodes(node,obj);container.components=[new OpenLayers.Geometry.Collection(obj.components)]},geometryMember:function(node,obj){this.readChildNodes(node,obj)}},feature:{"*":function(node,obj){var name;var local=node.localName||node.nodeName.split(":").pop();if(obj.features){if(!this.singleFeatureType&&OpenLayers.Util.indexOf(this.featureType,local)!==-1){name="_typeName"}else if(local===this.featureType){name="_typeName"}}else{if(node.childNodes.length==0||node.childNodes.length==1&&node.firstChild.nodeType==3){if(this.extractAttributes){name="_attribute"}}else{name="_geometry"}}if(name){this.readers.feature[name].apply(this,[node,obj])}},_typeName:function(node,obj){var container={components:[],attributes:{}};this.readChildNodes(node,container);if(container.name){container.attributes.name=container.name}var feature=new OpenLayers.Feature.Vector(container.components[0],container.attributes);if(!this.singleFeatureType){feature.type=node.nodeName.split(":").pop();feature.namespace=node.namespaceURI}var fid=node.getAttribute("fid")||this.getAttributeNS(node,this.namespaces["gml"],"id");if(fid){feature.fid=fid}if(this.internalProjection&&this.externalProjection&&feature.geometry){feature.geometry.transform(this.externalProjection,this.internalProjection)}if(container.bounds){feature.bounds=container.bounds}obj.features.push(feature)},_geometry:function(node,obj){if(!this.geometryName){this.geometryName=node.nodeName.split(":").pop()}this.readChildNodes(node,obj)},_attribute:function(node,obj){var local=node.localName||node.nodeName.split(":").pop();var value=this.getChildValue(node);obj.attributes[local]=value}},wfs:{FeatureCollection:function(node,obj){this.readChildNodes(node,obj)}}},write:function(features){var name;if(OpenLayers.Util.isArray(features)){name="featureMembers"}else{name="featureMember"}var root=this.writeNode("gml:"+name,features);this.setAttributeNS(root,this.namespaces["xsi"],"xsi:schemaLocation",this.schemaLocation);return OpenLayers.Format.XML.prototype.write.apply(this,[root])},writers:{gml:{featureMember:function(feature){var node=this.createElementNSPlus("gml:featureMember");this.writeNode("feature:_typeName",feature,node);return node},MultiPoint:function(geometry){var node=this.createElementNSPlus("gml:MultiPoint");var components=geometry.components||[geometry];for(var i=0,ii=components.length;i<ii;++i){this.writeNode("pointMember",components[i],node)}return node},pointMember:function(geometry){var node=this.createElementNSPlus("gml:pointMember");this.writeNode("Point",geometry,node);return node},MultiLineString:function(geometry){var node=this.createElementNSPlus("gml:MultiLineString");var components=geometry.components||[geometry];for(var i=0,ii=components.length;i<ii;++i){this.writeNode("lineStringMember",components[i],node)}return node},lineStringMember:function(geometry){var node=this.createElementNSPlus("gml:lineStringMember");this.writeNode("LineString",geometry,node);return node},MultiPolygon:function(geometry){var node=this.createElementNSPlus("gml:MultiPolygon");var components=geometry.components||[geometry];for(var i=0,ii=components.length;i<ii;++i){this.writeNode("polygonMember",components[i],node)}return node},polygonMember:function(geometry){var node=this.createElementNSPlus("gml:polygonMember");this.writeNode("Polygon",geometry,node);return node},GeometryCollection:function(geometry){var node=this.createElementNSPlus("gml:GeometryCollection");for(var i=0,len=geometry.components.length;i<len;++i){this.writeNode("geometryMember",geometry.components[i],node)}return node},geometryMember:function(geometry){var node=this.createElementNSPlus("gml:geometryMember");var child=this.writeNode("feature:_geometry",geometry);node.appendChild(child.firstChild);return node}},feature:{_typeName:function(feature){var node=this.createElementNSPlus("feature:"+this.featureType,{attributes:{fid:feature.fid}});if(feature.geometry){this.writeNode("feature:_geometry",feature.geometry,node)}for(var name in feature.attributes){var value=feature.attributes[name];if(value!=null){this.writeNode("feature:_attribute",{name:name,value:value},node)}}return node},_geometry:function(geometry){if(this.externalProjection&&this.internalProjection){geometry=geometry.clone().transform(this.internalProjection,this.externalProjection)}var node=this.createElementNSPlus("feature:"+this.geometryName);var type=this.geometryTypes[geometry.CLASS_NAME];var child=this.writeNode("gml:"+type,geometry,node);if(this.srsName){child.setAttribute("srsName",this.srsName)}return node},_attribute:function(obj){return this.createElementNSPlus("feature:"+obj.name,{value:obj.value})}},wfs:{FeatureCollection:function(features){var node=this.createElementNSPlus("wfs:FeatureCollection");for(var i=0,len=features.length;i<len;++i){this.writeNode("gml:featureMember",features[i],node)}return node}}},setGeometryTypes:function(){this.geometryTypes={"OpenLayers.Geometry.Point":"Point","OpenLayers.Geometry.MultiPoint":"MultiPoint","OpenLayers.Geometry.LineString":"LineString","OpenLayers.Geometry.MultiLineString":"MultiLineString","OpenLayers.Geometry.Polygon":"Polygon","OpenLayers.Geometry.MultiPolygon":"MultiPolygon","OpenLayers.Geometry.Collection":"GeometryCollection"}},CLASS_NAME:"OpenLayers.Format.GML.Base"});OpenLayers.Format.GML.v2=OpenLayers.Class(OpenLayers.Format.GML.Base,{schemaLocation:"http://www.opengis.net/gml http://schemas.opengis.net/gml/2.1.2/feature.xsd",initialize:function(options){OpenLayers.Format.GML.Base.prototype.initialize.apply(this,[options])},readers:{gml:OpenLayers.Util.applyDefaults({outerBoundaryIs:function(node,container){var obj={};this.readChildNodes(node,obj);container.outer=obj.components[0]},innerBoundaryIs:function(node,container){var obj={};this.readChildNodes(node,obj);container.inner.push(obj.components[0])},Box:function(node,container){var obj={};this.readChildNodes(node,obj);if(!container.components){container.components=[]}var min=obj.points[0];var max=obj.points[1];container.components.push(new OpenLayers.Bounds(min.x,min.y,max.x,max.y))}},OpenLayers.Format.GML.Base.prototype.readers["gml"]),feature:OpenLayers.Format.GML.Base.prototype.readers["feature"],wfs:OpenLayers.Format.GML.Base.prototype.readers["wfs"]},write:function(features){var name;if(OpenLayers.Util.isArray(features)){name="wfs:FeatureCollection"}else{name="gml:featureMember"}var root=this.writeNode(name,features);this.setAttributeNS(root,this.namespaces["xsi"],"xsi:schemaLocation",this.schemaLocation);return OpenLayers.Format.XML.prototype.write.apply(this,[root])},writers:{gml:OpenLayers.Util.applyDefaults({Point:function(geometry){var node=this.createElementNSPlus("gml:Point");this.writeNode("coordinates",[geometry],node);return node},coordinates:function(points){var numPoints=points.length;var parts=new Array(numPoints);var point;for(var i=0;i<numPoints;++i){point=points[i];if(this.xy){parts[i]=point.x+","+point.y}else{parts[i]=point.y+","+point.x}if(point.z!=undefined){parts[i]+=","+point.z}}return this.createElementNSPlus("gml:coordinates",{attributes:{decimal:".",cs:",",ts:" "},value:numPoints==1?parts[0]:parts.join(" ")})},LineString:function(geometry){var node=this.createElementNSPlus("gml:LineString");this.writeNode("coordinates",geometry.components,node);return node},Polygon:function(geometry){var node=this.createElementNSPlus("gml:Polygon");this.writeNode("outerBoundaryIs",geometry.components[0],node);for(var i=1;i<geometry.components.length;++i){this.writeNode("innerBoundaryIs",geometry.components[i],node)}return node},outerBoundaryIs:function(ring){var node=this.createElementNSPlus("gml:outerBoundaryIs");this.writeNode("LinearRing",ring,node);return node},innerBoundaryIs:function(ring){var node=this.createElementNSPlus("gml:innerBoundaryIs");this.writeNode("LinearRing",ring,node);return node},LinearRing:function(ring){var node=this.createElementNSPlus("gml:LinearRing");this.writeNode("coordinates",ring.components,node);return node},Box:function(bounds){var node=this.createElementNSPlus("gml:Box");this.writeNode("coordinates",[{x:bounds.left,y:bounds.bottom},{x:bounds.right,y:bounds.top}],node);if(this.srsName){node.setAttribute("srsName",this.srsName)}return node}},OpenLayers.Format.GML.Base.prototype.writers["gml"]),feature:OpenLayers.Format.GML.Base.prototype.writers["feature"],wfs:OpenLayers.Format.GML.Base.prototype.writers["wfs"]},CLASS_NAME:"OpenLayers.Format.GML.v2"});OpenLayers.Filter.Function=OpenLayers.Class(OpenLayers.Filter,{name:null,params:null,CLASS_NAME:"OpenLayers.Filter.Function"});OpenLayers.Date={dateRegEx:/^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))|Z)?$/,toISOString:function(){if("toISOString"in Date.prototype){return function(date){return date.toISOString()}}else{return function(date){var str;if(isNaN(date.getTime())){str="Invalid Date"}else{str=date.getUTCFullYear()+"-"+OpenLayers.Number.zeroPad(date.getUTCMonth()+1,2)+"-"+OpenLayers.Number.zeroPad(date.getUTCDate(),2)+"T"+OpenLayers.Number.zeroPad(date.getUTCHours(),2)+":"+OpenLayers.Number.zeroPad(date.getUTCMinutes(),2)+":"+OpenLayers.Number.zeroPad(date.getUTCSeconds(),2)+"."+OpenLayers.Number.zeroPad(date.getUTCMilliseconds(),3)+"Z"}return str}}}(),parse:function(str){var date;var match=str.match(this.dateRegEx);if(match&&(match[1]||match[7])){var year=parseInt(match[1],10)||0;var month=parseInt(match[2],10)-1||0;var day=parseInt(match[3],10)||1;date=new Date(Date.UTC(year,month,day));var type=match[7];if(type){var hours=parseInt(match[4],10);var minutes=parseInt(match[5],10);var secFrac=parseFloat(match[6]);var seconds=secFrac|0;var milliseconds=Math.round(1e3*(secFrac-seconds));date.setUTCHours(hours,minutes,seconds,milliseconds);if(type!=="Z"){var hoursOffset=parseInt(type,10);var minutesOffset=parseInt(match[8],10)||0;var offset=-1e3*(60*(hoursOffset*60)+minutesOffset*60);date=new Date(date.getTime()+offset)}}}else{date=new Date("invalid")}return date}};OpenLayers.Format.Filter.v1=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{ogc:"http://www.opengis.net/ogc",gml:"http://www.opengis.net/gml",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance"},defaultPrefix:"ogc",schemaLocation:null,initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options])},read:function(data){var obj={};this.readers.ogc["Filter"].apply(this,[data,obj]);return obj.filter},readers:{ogc:{_expression:function(node){var obj,value="";for(var child=node.firstChild;child;child=child.nextSibling){switch(child.nodeType){case 1:obj=this.readNode(child);if(obj.property){value+="${"+obj.property+"}"}else if(obj.value!==undefined){value+=obj.value}break;case 3:case 4:value+=child.nodeValue}}return value},Filter:function(node,parent){var obj={fids:[],filters:[]};this.readChildNodes(node,obj);if(obj.fids.length>0){parent.filter=new OpenLayers.Filter.FeatureId({fids:obj.fids})}else if(obj.filters.length>0){parent.filter=obj.filters[0]}},FeatureId:function(node,obj){var fid=node.getAttribute("fid");if(fid){obj.fids.push(fid)}},And:function(node,obj){var filter=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.AND});this.readChildNodes(node,filter);obj.filters.push(filter)},Or:function(node,obj){var filter=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.OR});this.readChildNodes(node,filter);obj.filters.push(filter)},Not:function(node,obj){var filter=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.NOT});this.readChildNodes(node,filter);obj.filters.push(filter)},PropertyIsLessThan:function(node,obj){var filter=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.LESS_THAN});this.readChildNodes(node,filter);obj.filters.push(filter)},PropertyIsGreaterThan:function(node,obj){var filter=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.GREATER_THAN});this.readChildNodes(node,filter);obj.filters.push(filter)},PropertyIsLessThanOrEqualTo:function(node,obj){var filter=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO});this.readChildNodes(node,filter);obj.filters.push(filter)},PropertyIsGreaterThanOrEqualTo:function(node,obj){var filter=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO});this.readChildNodes(node,filter);obj.filters.push(filter)},PropertyIsBetween:function(node,obj){var filter=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.BETWEEN});this.readChildNodes(node,filter);obj.filters.push(filter)},Literal:function(node,obj){obj.value=OpenLayers.String.numericIf(this.getChildValue(node),true)},PropertyName:function(node,filter){filter.property=this.getChildValue(node)},LowerBoundary:function(node,filter){filter.lowerBoundary=OpenLayers.String.numericIf(this.readers.ogc._expression.call(this,node),true)},UpperBoundary:function(node,filter){filter.upperBoundary=OpenLayers.String.numericIf(this.readers.ogc._expression.call(this,node),true)},Intersects:function(node,obj){this.readSpatial(node,obj,OpenLayers.Filter.Spatial.INTERSECTS)},Within:function(node,obj){this.readSpatial(node,obj,OpenLayers.Filter.Spatial.WITHIN)},Contains:function(node,obj){this.readSpatial(node,obj,OpenLayers.Filter.Spatial.CONTAINS)},DWithin:function(node,obj){this.readSpatial(node,obj,OpenLayers.Filter.Spatial.DWITHIN)},Distance:function(node,obj){obj.distance=parseInt(this.getChildValue(node));obj.distanceUnits=node.getAttribute("units")},Function:function(node,obj){return},PropertyIsNull:function(node,obj){var filter=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.IS_NULL});this.readChildNodes(node,filter);obj.filters.push(filter)}}},readSpatial:function(node,obj,type){var filter=new OpenLayers.Filter.Spatial({type:type});this.readChildNodes(node,filter);filter.value=filter.components[0];delete filter.components;obj.filters.push(filter)},encodeLiteral:function(value){if(value instanceof Date){value=OpenLayers.Date.toISOString(value)}return value},writeOgcExpression:function(value,node){if(value instanceof OpenLayers.Filter.Function){this.writeNode("Function",value,node)}else{this.writeNode("Literal",value,node)}return node},write:function(filter){return this.writers.ogc["Filter"].apply(this,[filter])},writers:{ogc:{Filter:function(filter){var node=this.createElementNSPlus("ogc:Filter");this.writeNode(this.getFilterType(filter),filter,node);return node},_featureIds:function(filter){var node=this.createDocumentFragment();for(var i=0,ii=filter.fids.length;i<ii;++i){this.writeNode("ogc:FeatureId",filter.fids[i],node)}return node},FeatureId:function(fid){return this.createElementNSPlus("ogc:FeatureId",{attributes:{fid:fid}})},And:function(filter){var node=this.createElementNSPlus("ogc:And");var childFilter;for(var i=0,ii=filter.filters.length;i<ii;++i){childFilter=filter.filters[i];this.writeNode(this.getFilterType(childFilter),childFilter,node)}return node},Or:function(filter){var node=this.createElementNSPlus("ogc:Or");var childFilter;for(var i=0,ii=filter.filters.length;i<ii;++i){childFilter=filter.filters[i];this.writeNode(this.getFilterType(childFilter),childFilter,node)}return node},Not:function(filter){var node=this.createElementNSPlus("ogc:Not");var childFilter=filter.filters[0];this.writeNode(this.getFilterType(childFilter),childFilter,node);return node},PropertyIsLessThan:function(filter){var node=this.createElementNSPlus("ogc:PropertyIsLessThan");this.writeNode("PropertyName",filter,node);this.writeOgcExpression(filter.value,node);return node},PropertyIsGreaterThan:function(filter){var node=this.createElementNSPlus("ogc:PropertyIsGreaterThan");this.writeNode("PropertyName",filter,node);this.writeOgcExpression(filter.value,node);return node},PropertyIsLessThanOrEqualTo:function(filter){var node=this.createElementNSPlus("ogc:PropertyIsLessThanOrEqualTo");this.writeNode("PropertyName",filter,node);this.writeOgcExpression(filter.value,node);return node},PropertyIsGreaterThanOrEqualTo:function(filter){var node=this.createElementNSPlus("ogc:PropertyIsGreaterThanOrEqualTo");this.writeNode("PropertyName",filter,node);this.writeOgcExpression(filter.value,node);return node},PropertyIsBetween:function(filter){var node=this.createElementNSPlus("ogc:PropertyIsBetween");this.writeNode("PropertyName",filter,node);this.writeNode("LowerBoundary",filter,node);this.writeNode("UpperBoundary",filter,node);return node},PropertyName:function(filter){return this.createElementNSPlus("ogc:PropertyName",{value:filter.property})},Literal:function(value){var encode=this.encodeLiteral||OpenLayers.Format.Filter.v1.prototype.encodeLiteral;return this.createElementNSPlus("ogc:Literal",{value:encode(value)})},LowerBoundary:function(filter){var node=this.createElementNSPlus("ogc:LowerBoundary");this.writeOgcExpression(filter.lowerBoundary,node);return node},UpperBoundary:function(filter){var node=this.createElementNSPlus("ogc:UpperBoundary");this.writeNode("Literal",filter.upperBoundary,node);return node},INTERSECTS:function(filter){return this.writeSpatial(filter,"Intersects")},WITHIN:function(filter){return this.writeSpatial(filter,"Within")},CONTAINS:function(filter){return this.writeSpatial(filter,"Contains")},DWITHIN:function(filter){var node=this.writeSpatial(filter,"DWithin");this.writeNode("Distance",filter,node);return node},Distance:function(filter){return this.createElementNSPlus("ogc:Distance",{attributes:{units:filter.distanceUnits},value:filter.distance})},Function:function(filter){var node=this.createElementNSPlus("ogc:Function",{attributes:{name:filter.name}});var params=filter.params;for(var i=0,len=params.length;i<len;i++){this.writeOgcExpression(params[i],node)}return node},PropertyIsNull:function(filter){var node=this.createElementNSPlus("ogc:PropertyIsNull");this.writeNode("PropertyName",filter,node);return node}}},getFilterType:function(filter){var filterType=this.filterMap[filter.type];if(!filterType){throw"Filter writing not supported for rule type: "+filter.type}return filterType},filterMap:{"&&":"And","||":"Or","!":"Not","==":"PropertyIsEqualTo","!=":"PropertyIsNotEqualTo","<":"PropertyIsLessThan",">":"PropertyIsGreaterThan","<=":"PropertyIsLessThanOrEqualTo",">=":"PropertyIsGreaterThanOrEqualTo","..":"PropertyIsBetween","~":"PropertyIsLike",NULL:"PropertyIsNull",BBOX:"BBOX",DWITHIN:"DWITHIN",WITHIN:"WITHIN",CONTAINS:"CONTAINS",INTERSECTS:"INTERSECTS",FID:"_featureIds"},CLASS_NAME:"OpenLayers.Format.Filter.v1"});OpenLayers.Format.Filter.v1_0_0=OpenLayers.Class(OpenLayers.Format.GML.v2,OpenLayers.Format.Filter.v1,{VERSION:"1.0.0",schemaLocation:"http://www.opengis.net/ogc/filter/1.0.0/filter.xsd",initialize:function(options){OpenLayers.Format.GML.v2.prototype.initialize.apply(this,[options])},readers:{ogc:OpenLayers.Util.applyDefaults({PropertyIsEqualTo:function(node,obj){var filter=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.EQUAL_TO});this.readChildNodes(node,filter);obj.filters.push(filter)},PropertyIsNotEqualTo:function(node,obj){var filter=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.NOT_EQUAL_TO});this.readChildNodes(node,filter);obj.filters.push(filter)},PropertyIsLike:function(node,obj){var filter=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.LIKE});this.readChildNodes(node,filter);var wildCard=node.getAttribute("wildCard");var singleChar=node.getAttribute("singleChar");var esc=node.getAttribute("escape");filter.value2regex(wildCard,singleChar,esc);obj.filters.push(filter)}},OpenLayers.Format.Filter.v1.prototype.readers["ogc"]),gml:OpenLayers.Format.GML.v2.prototype.readers["gml"],feature:OpenLayers.Format.GML.v2.prototype.readers["feature"]},writers:{ogc:OpenLayers.Util.applyDefaults({PropertyIsEqualTo:function(filter){var node=this.createElementNSPlus("ogc:PropertyIsEqualTo");this.writeNode("PropertyName",filter,node);this.writeOgcExpression(filter.value,node);return node},PropertyIsNotEqualTo:function(filter){var node=this.createElementNSPlus("ogc:PropertyIsNotEqualTo");this.writeNode("PropertyName",filter,node);this.writeOgcExpression(filter.value,node);return node},PropertyIsLike:function(filter){var node=this.createElementNSPlus("ogc:PropertyIsLike",{attributes:{wildCard:"*",singleChar:".",escape:"!"}});this.writeNode("PropertyName",filter,node);this.writeNode("Literal",filter.regex2value(),node);return node},BBOX:function(filter){var node=this.createElementNSPlus("ogc:BBOX");filter.property&&this.writeNode("PropertyName",filter,node);var box=this.writeNode("gml:Box",filter.value,node);if(filter.projection){box.setAttribute("srsName",filter.projection)}return node}},OpenLayers.Format.Filter.v1.prototype.writers["ogc"]),gml:OpenLayers.Format.GML.v2.prototype.writers["gml"],feature:OpenLayers.Format.GML.v2.prototype.writers["feature"]},writeSpatial:function(filter,name){var node=this.createElementNSPlus("ogc:"+name);this.writeNode("PropertyName",filter,node);if(filter.value instanceof OpenLayers.Filter.Function){this.writeNode("Function",filter.value,node)}else{var child;if(filter.value instanceof OpenLayers.Geometry){child=this.writeNode("feature:_geometry",filter.value).firstChild}else{child=this.writeNode("gml:Box",filter.value)}if(filter.projection){child.setAttribute("srsName",filter.projection)}node.appendChild(child)}return node},CLASS_NAME:"OpenLayers.Format.Filter.v1_0_0"});OpenLayers.Format.WFST.v1_0_0=OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0,OpenLayers.Format.WFST.v1,{version:"1.0.0",srsNameInQuery:false,schemaLocations:{wfs:"http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd"},initialize:function(options){OpenLayers.Format.Filter.v1_0_0.prototype.initialize.apply(this,[options]);OpenLayers.Format.WFST.v1.prototype.initialize.apply(this,[options])},readNode:function(node,obj,first){return OpenLayers.Format.GML.v2.prototype.readNode.apply(this,arguments)},readers:{wfs:OpenLayers.Util.applyDefaults({WFS_TransactionResponse:function(node,obj){obj.insertIds=[];obj.success=false;this.readChildNodes(node,obj)},InsertResult:function(node,container){var obj={fids:[]};this.readChildNodes(node,obj);container.insertIds=container.insertIds.concat(obj.fids)},TransactionResult:function(node,obj){this.readChildNodes(node,obj)},Status:function(node,obj){this.readChildNodes(node,obj)},SUCCESS:function(node,obj){obj.success=true}},OpenLayers.Format.WFST.v1.prototype.readers["wfs"]),gml:OpenLayers.Format.GML.v2.prototype.readers["gml"],feature:OpenLayers.Format.GML.v2.prototype.readers["feature"],ogc:OpenLayers.Format.Filter.v1_0_0.prototype.readers["ogc"]},writers:{wfs:OpenLayers.Util.applyDefaults({Query:function(options){options=OpenLayers.Util.extend({featureNS:this.featureNS,featurePrefix:this.featurePrefix,featureType:this.featureType,srsName:this.srsName,srsNameInQuery:this.srsNameInQuery},options);var prefix=options.featurePrefix;var node=this.createElementNSPlus("wfs:Query",{attributes:{typeName:(prefix?prefix+":":"")+options.featureType}});if(options.srsNameInQuery&&options.srsName){node.setAttribute("srsName",options.srsName)}if(options.featureNS){node.setAttribute("xmlns:"+prefix,options.featureNS)}if(options.propertyNames){for(var i=0,len=options.propertyNames.length;i<len;i++){this.writeNode("ogc:PropertyName",{property:options.propertyNames[i]},node)}}if(options.filter){this.setFilterProperty(options.filter);this.writeNode("ogc:Filter",options.filter,node)}return node}},OpenLayers.Format.WFST.v1.prototype.writers["wfs"]),gml:OpenLayers.Format.GML.v2.prototype.writers["gml"],feature:OpenLayers.Format.GML.v2.prototype.writers["feature"],ogc:OpenLayers.Format.Filter.v1_0_0.prototype.writers["ogc"]},CLASS_NAME:"OpenLayers.Format.WFST.v1_0_0"});OpenLayers.ElementsIndexer=OpenLayers.Class({maxZIndex:null,order:null,indices:null,compare:null,initialize:function(yOrdering){this.compare=yOrdering?OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_Y_ORDER:OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_DRAWING_ORDER;this.clear()},insert:function(newNode){if(this.exists(newNode)){this.remove(newNode)}var nodeId=newNode.id;this.determineZIndex(newNode);var leftIndex=-1;var rightIndex=this.order.length;var middle;while(rightIndex-leftIndex>1){middle=parseInt((leftIndex+rightIndex)/2);var placement=this.compare(this,newNode,OpenLayers.Util.getElement(this.order[middle]));if(placement>0){leftIndex=middle}else{rightIndex=middle}}this.order.splice(rightIndex,0,nodeId);this.indices[nodeId]=this.getZIndex(newNode);return this.getNextElement(rightIndex)},remove:function(node){var nodeId=node.id;var arrayIndex=OpenLayers.Util.indexOf(this.order,nodeId);if(arrayIndex>=0){this.order.splice(arrayIndex,1);delete this.indices[nodeId];if(this.order.length>0){var lastId=this.order[this.order.length-1];this.maxZIndex=this.indices[lastId]}else{this.maxZIndex=0}}},clear:function(){this.order=[];this.indices={};this.maxZIndex=0},exists:function(node){return this.indices[node.id]!=null},getZIndex:function(node){return node._style.graphicZIndex},determineZIndex:function(node){var zIndex=node._style.graphicZIndex;if(zIndex==null){zIndex=this.maxZIndex;node._style.graphicZIndex=zIndex}else if(zIndex>this.maxZIndex){this.maxZIndex=zIndex}},getNextElement:function(index){var nextIndex=index+1;if(nextIndex<this.order.length){var nextElement=OpenLayers.Util.getElement(this.order[nextIndex]);if(nextElement==undefined){nextElement=this.getNextElement(nextIndex)}return nextElement}else{return null}},CLASS_NAME:"OpenLayers.ElementsIndexer"});OpenLayers.ElementsIndexer.IndexingMethods={Z_ORDER:function(indexer,newNode,nextNode){var newZIndex=indexer.getZIndex(newNode);var returnVal=0;if(nextNode){var nextZIndex=indexer.getZIndex(nextNode);returnVal=newZIndex-nextZIndex}return returnVal},Z_ORDER_DRAWING_ORDER:function(indexer,newNode,nextNode){var returnVal=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(indexer,newNode,nextNode);if(nextNode&&returnVal==0){returnVal=1}return returnVal},Z_ORDER_Y_ORDER:function(indexer,newNode,nextNode){var returnVal=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(indexer,newNode,nextNode);if(nextNode&&returnVal===0){var result=nextNode._boundsBottom-newNode._boundsBottom;returnVal=result===0?1:result}return returnVal}};OpenLayers.Renderer.Elements=OpenLayers.Class(OpenLayers.Renderer,{rendererRoot:null,root:null,vectorRoot:null,textRoot:null,xmlns:null,xOffset:0,indexer:null,BACKGROUND_ID_SUFFIX:"_background",LABEL_ID_SUFFIX:"_label",LABEL_OUTLINE_SUFFIX:"_outline",initialize:function(containerID,options){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.rendererRoot=this.createRenderRoot();this.root=this.createRoot("_root");this.vectorRoot=this.createRoot("_vroot");this.textRoot=this.createRoot("_troot");this.root.appendChild(this.vectorRoot);this.root.appendChild(this.textRoot);this.rendererRoot.appendChild(this.root);this.container.appendChild(this.rendererRoot);if(options&&(options.zIndexing||options.yOrdering)){this.indexer=new OpenLayers.ElementsIndexer(options.yOrdering)}},destroy:function(){this.clear();this.rendererRoot=null;this.root=null;this.xmlns=null;OpenLayers.Renderer.prototype.destroy.apply(this,arguments)},clear:function(){var child;var root=this.vectorRoot;if(root){while(child=root.firstChild){root.removeChild(child)}}root=this.textRoot;if(root){while(child=root.firstChild){root.removeChild(child)}}if(this.indexer){this.indexer.clear()}},setExtent:function(extent,resolutionChanged){var coordSysUnchanged=OpenLayers.Renderer.prototype.setExtent.apply(this,arguments);var resolution=this.getResolution();if(this.map.baseLayer&&this.map.baseLayer.wrapDateLine){var rightOfDateLine,ratio=extent.getWidth()/this.map.getExtent().getWidth(),extent=extent.scale(1/ratio),world=this.map.getMaxExtent();if(world.right>extent.left&&world.right<extent.right){rightOfDateLine=true
}else if(world.left>extent.left&&world.left<extent.right){rightOfDateLine=false}if(rightOfDateLine!==this.rightOfDateLine||resolutionChanged){coordSysUnchanged=false;this.xOffset=rightOfDateLine===true?world.getWidth()/resolution:0}this.rightOfDateLine=rightOfDateLine}return coordSysUnchanged},getNodeType:function(geometry,style){},drawGeometry:function(geometry,style,featureId){var className=geometry.CLASS_NAME;var rendered=true;if(className=="OpenLayers.Geometry.Collection"||className=="OpenLayers.Geometry.MultiPoint"||className=="OpenLayers.Geometry.MultiLineString"||className=="OpenLayers.Geometry.MultiPolygon"){for(var i=0,len=geometry.components.length;i<len;i++){rendered=this.drawGeometry(geometry.components[i],style,featureId)&&rendered}return rendered}rendered=false;var removeBackground=false;if(style.display!="none"){if(style.backgroundGraphic){this.redrawBackgroundNode(geometry.id,geometry,style,featureId)}else{removeBackground=true}rendered=this.redrawNode(geometry.id,geometry,style,featureId)}if(rendered==false){var node=document.getElementById(geometry.id);if(node){if(node._style.backgroundGraphic){removeBackground=true}node.parentNode.removeChild(node)}}if(removeBackground){var node=document.getElementById(geometry.id+this.BACKGROUND_ID_SUFFIX);if(node){node.parentNode.removeChild(node)}}return rendered},redrawNode:function(id,geometry,style,featureId){style=this.applyDefaultSymbolizer(style);var node=this.nodeFactory(id,this.getNodeType(geometry,style));node._featureId=featureId;node._boundsBottom=geometry.getBounds().bottom;node._geometryClass=geometry.CLASS_NAME;node._style=style;var drawResult=this.drawGeometryNode(node,geometry,style);if(drawResult===false){return false}node=drawResult.node;if(this.indexer){var insert=this.indexer.insert(node);if(insert){this.vectorRoot.insertBefore(node,insert)}else{this.vectorRoot.appendChild(node)}}else{if(node.parentNode!==this.vectorRoot){this.vectorRoot.appendChild(node)}}this.postDraw(node);return drawResult.complete},redrawBackgroundNode:function(id,geometry,style,featureId){var backgroundStyle=OpenLayers.Util.extend({},style);backgroundStyle.externalGraphic=backgroundStyle.backgroundGraphic;backgroundStyle.graphicXOffset=backgroundStyle.backgroundXOffset;backgroundStyle.graphicYOffset=backgroundStyle.backgroundYOffset;backgroundStyle.graphicZIndex=backgroundStyle.backgroundGraphicZIndex;backgroundStyle.graphicWidth=backgroundStyle.backgroundWidth||backgroundStyle.graphicWidth;backgroundStyle.graphicHeight=backgroundStyle.backgroundHeight||backgroundStyle.graphicHeight;backgroundStyle.backgroundGraphic=null;backgroundStyle.backgroundXOffset=null;backgroundStyle.backgroundYOffset=null;backgroundStyle.backgroundGraphicZIndex=null;return this.redrawNode(id+this.BACKGROUND_ID_SUFFIX,geometry,backgroundStyle,null)},drawGeometryNode:function(node,geometry,style){style=style||node._style;var options={isFilled:style.fill===undefined?true:style.fill,isStroked:style.stroke===undefined?!!style.strokeWidth:style.stroke};var drawn;switch(geometry.CLASS_NAME){case"OpenLayers.Geometry.Point":if(style.graphic===false){options.isFilled=false;options.isStroked=false}drawn=this.drawPoint(node,geometry);break;case"OpenLayers.Geometry.LineString":options.isFilled=false;drawn=this.drawLineString(node,geometry);break;case"OpenLayers.Geometry.LinearRing":drawn=this.drawLinearRing(node,geometry);break;case"OpenLayers.Geometry.Polygon":drawn=this.drawPolygon(node,geometry);break;case"OpenLayers.Geometry.Rectangle":drawn=this.drawRectangle(node,geometry);break;default:break}node._options=options;if(drawn!=false){return{node:this.setStyle(node,style,options,geometry),complete:drawn}}else{return false}},postDraw:function(node){},drawPoint:function(node,geometry){},drawLineString:function(node,geometry){},drawLinearRing:function(node,geometry){},drawPolygon:function(node,geometry){},drawRectangle:function(node,geometry){},drawCircle:function(node,geometry){},removeText:function(featureId){var label=document.getElementById(featureId+this.LABEL_ID_SUFFIX);if(label){this.textRoot.removeChild(label)}var outline=document.getElementById(featureId+this.LABEL_OUTLINE_SUFFIX);if(outline){this.textRoot.removeChild(outline)}},getFeatureIdFromEvent:function(evt){var target=evt.target;var useElement=target&&target.correspondingUseElement;var node=useElement?useElement:target||evt.srcElement;return node._featureId},eraseGeometry:function(geometry,featureId){if(geometry.CLASS_NAME=="OpenLayers.Geometry.MultiPoint"||geometry.CLASS_NAME=="OpenLayers.Geometry.MultiLineString"||geometry.CLASS_NAME=="OpenLayers.Geometry.MultiPolygon"||geometry.CLASS_NAME=="OpenLayers.Geometry.Collection"){for(var i=0,len=geometry.components.length;i<len;i++){this.eraseGeometry(geometry.components[i],featureId)}}else{var element=OpenLayers.Util.getElement(geometry.id);if(element&&element.parentNode){if(element.geometry){element.geometry.destroy();element.geometry=null}element.parentNode.removeChild(element);if(this.indexer){this.indexer.remove(element)}if(element._style.backgroundGraphic){var backgroundId=geometry.id+this.BACKGROUND_ID_SUFFIX;var bElem=OpenLayers.Util.getElement(backgroundId);if(bElem&&bElem.parentNode){bElem.parentNode.removeChild(bElem)}}}}},nodeFactory:function(id,type){var node=OpenLayers.Util.getElement(id);if(node){if(!this.nodeTypeCompare(node,type)){node.parentNode.removeChild(node);node=this.nodeFactory(id,type)}}else{node=this.createNode(type,id)}return node},nodeTypeCompare:function(node,type){},createNode:function(type,id){},moveRoot:function(renderer){var root=this.root;if(renderer.root.parentNode==this.rendererRoot){root=renderer.root}root.parentNode.removeChild(root);renderer.rendererRoot.appendChild(root)},getRenderLayerId:function(){return this.root.parentNode.parentNode.id},isComplexSymbol:function(graphicName){return graphicName!="circle"&&!!graphicName},CLASS_NAME:"OpenLayers.Renderer.Elements"});OpenLayers.Control.Panel=OpenLayers.Class(OpenLayers.Control,{controls:null,autoActivate:true,defaultControl:null,saveState:false,allowDepress:false,activeState:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.controls=[];this.activeState={}},destroy:function(){if(this.map){this.map.events.unregister("buttonclick",this,this.onButtonClick)}OpenLayers.Control.prototype.destroy.apply(this,arguments);for(var ctl,i=this.controls.length-1;i>=0;i--){ctl=this.controls[i];if(ctl.events){ctl.events.un({activate:this.iconOn,deactivate:this.iconOff})}ctl.panel_div=null}this.activeState=null},activate:function(){if(OpenLayers.Control.prototype.activate.apply(this,arguments)){var control;for(var i=0,len=this.controls.length;i<len;i++){control=this.controls[i];if(control===this.defaultControl||this.saveState&&this.activeState[control.id]){control.activate()}}if(this.saveState===true){this.defaultControl=null}this.redraw();return true}else{return false}},deactivate:function(){if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)){var control;for(var i=0,len=this.controls.length;i<len;i++){control=this.controls[i];this.activeState[control.id]=control.deactivate()}this.redraw();return true}else{return false}},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(this.outsideViewport){this.events.attachToElement(this.div);this.events.register("buttonclick",this,this.onButtonClick)}else{this.map.events.register("buttonclick",this,this.onButtonClick)}this.addControlsToMap(this.controls);return this.div},redraw:function(){for(var l=this.div.childNodes.length,i=l-1;i>=0;i--){this.div.removeChild(this.div.childNodes[i])}this.div.innerHTML="";if(this.active){for(var i=0,len=this.controls.length;i<len;i++){this.div.appendChild(this.controls[i].panel_div)}}},activateControl:function(control){if(!this.active){return false}if(control.type==OpenLayers.Control.TYPE_BUTTON){control.trigger();return}if(control.type==OpenLayers.Control.TYPE_TOGGLE){if(control.active){control.deactivate()}else{control.activate()}return}if(this.allowDepress&&control.active){control.deactivate()}else{var c;for(var i=0,len=this.controls.length;i<len;i++){c=this.controls[i];if(c!=control&&(c.type===OpenLayers.Control.TYPE_TOOL||c.type==null)){c.deactivate()}}control.activate()}},addControls:function(controls){if(!OpenLayers.Util.isArray(controls)){controls=[controls]}this.controls=this.controls.concat(controls);for(var i=0,len=controls.length;i<len;i++){var control=controls[i],element=this.createControlMarkup(control);OpenLayers.Element.addClass(element,control.displayClass+"ItemInactive");OpenLayers.Element.addClass(element,"olButton");if(control.title!=""&&!element.title){element.title=control.title}control.panel_div=element}if(this.map){this.addControlsToMap(controls);this.redraw()}},createControlMarkup:function(control){return document.createElement("div")},addControlsToMap:function(controls){var control;for(var i=0,len=controls.length;i<len;i++){control=controls[i];if(control.autoActivate===true){control.autoActivate=false;this.map.addControl(control);control.autoActivate=true}else{this.map.addControl(control);control.deactivate()}control.events.on({activate:this.iconOn,deactivate:this.iconOff})}},iconOn:function(){var d=this.panel_div;var re=new RegExp("\\b("+this.displayClass+"Item)Inactive\\b");d.className=d.className.replace(re,"$1Active")},iconOff:function(){var d=this.panel_div;var re=new RegExp("\\b("+this.displayClass+"Item)Active\\b");d.className=d.className.replace(re,"$1Inactive")},onButtonClick:function(evt){var controls=this.controls,button=evt.buttonElement;for(var i=controls.length-1;i>=0;--i){if(controls[i].panel_div===button){this.activateControl(controls[i]);break}}},getControlsBy:function(property,match){var test=typeof match.test=="function";var found=OpenLayers.Array.filter(this.controls,function(item){return item[property]==match||test&&match.test(item[property])});return found},getControlsByName:function(match){return this.getControlsBy("name",match)},getControlsByClass:function(match){return this.getControlsBy("CLASS_NAME",match)},CLASS_NAME:"OpenLayers.Control.Panel"});OpenLayers.Strategy=OpenLayers.Class({layer:null,options:null,active:null,autoActivate:true,autoDestroy:true,initialize:function(options){OpenLayers.Util.extend(this,options);this.options=options;this.active=false},destroy:function(){this.deactivate();this.layer=null;this.options=null},setLayer:function(layer){this.layer=layer},activate:function(){if(!this.active){this.active=true;return true}return false},deactivate:function(){if(this.active){this.active=false;return true}return false},CLASS_NAME:"OpenLayers.Strategy"});OpenLayers.Strategy.Fixed=OpenLayers.Class(OpenLayers.Strategy,{preload:false,activate:function(){var activated=OpenLayers.Strategy.prototype.activate.apply(this,arguments);if(activated){this.layer.events.on({refresh:this.load,scope:this});if(this.layer.visibility==true||this.preload){this.load()}else{this.layer.events.on({visibilitychanged:this.load,scope:this})}}return activated},deactivate:function(){var deactivated=OpenLayers.Strategy.prototype.deactivate.call(this);if(deactivated){this.layer.events.un({refresh:this.load,visibilitychanged:this.load,scope:this})}return deactivated},load:function(options){var layer=this.layer;layer.events.triggerEvent("loadstart",{filter:layer.filter});layer.protocol.read(OpenLayers.Util.applyDefaults({callback:this.merge,filter:layer.filter,scope:this},options));layer.events.un({visibilitychanged:this.load,scope:this})},merge:function(resp){var layer=this.layer;layer.destroyFeatures();var features=resp.features;if(features&&features.length>0){var remote=layer.projection;var local=layer.map.getProjectionObject();if(!local.equals(remote)){var geom;for(var i=0,len=features.length;i<len;++i){geom=features[i].geometry;if(geom){geom.transform(remote,local)}}}layer.addFeatures(features)}layer.events.triggerEvent("loadend",{response:resp})},CLASS_NAME:"OpenLayers.Strategy.Fixed"});OpenLayers.Control.Zoom=OpenLayers.Class(OpenLayers.Control,{zoomInText:"+",zoomInId:"olZoomInLink",zoomOutText:"−",zoomOutId:"olZoomOutLink",draw:function(){var div=OpenLayers.Control.prototype.draw.apply(this),links=this.getOrCreateLinks(div),zoomIn=links.zoomIn,zoomOut=links.zoomOut,eventsInstance=this.map.events;if(zoomOut.parentNode!==div){eventsInstance=this.events;eventsInstance.attachToElement(zoomOut.parentNode)}eventsInstance.register("buttonclick",this,this.onZoomClick);this.zoomInLink=zoomIn;this.zoomOutLink=zoomOut;return div},getOrCreateLinks:function(el){var zoomIn=document.getElementById(this.zoomInId),zoomOut=document.getElementById(this.zoomOutId);if(!zoomIn){zoomIn=document.createElement("a");zoomIn.href="#zoomIn";zoomIn.appendChild(document.createTextNode(this.zoomInText));zoomIn.className="olControlZoomIn";el.appendChild(zoomIn)}OpenLayers.Element.addClass(zoomIn,"olButton");if(!zoomOut){zoomOut=document.createElement("a");zoomOut.href="#zoomOut";zoomOut.appendChild(document.createTextNode(this.zoomOutText));zoomOut.className="olControlZoomOut";el.appendChild(zoomOut)}OpenLayers.Element.addClass(zoomOut,"olButton");return{zoomIn:zoomIn,zoomOut:zoomOut}},onZoomClick:function(evt){var button=evt.buttonElement;if(button===this.zoomInLink){this.map.zoomIn()}else if(button===this.zoomOutLink){this.map.zoomOut()}},destroy:function(){if(this.map){this.map.events.unregister("buttonclick",this,this.onZoomClick)}delete this.zoomInLink;delete this.zoomOutLink;OpenLayers.Control.prototype.destroy.apply(this)},CLASS_NAME:"OpenLayers.Control.Zoom"});OpenLayers.Protocol=OpenLayers.Class({format:null,options:null,autoDestroy:true,defaultFilter:null,initialize:function(options){options=options||{};OpenLayers.Util.extend(this,options);this.options=options},mergeWithDefaultFilter:function(filter){var merged;if(filter&&this.defaultFilter){merged=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.AND,filters:[this.defaultFilter,filter]})}else{merged=filter||this.defaultFilter||undefined}return merged},destroy:function(){this.options=null;this.format=null},read:function(options){options=options||{};options.filter=this.mergeWithDefaultFilter(options.filter)},create:function(){},update:function(){},"delete":function(){},commit:function(){},abort:function(response){},createCallback:function(method,response,options){return OpenLayers.Function.bind(function(){method.apply(this,[response,options])},this)},CLASS_NAME:"OpenLayers.Protocol"});OpenLayers.Protocol.Response=OpenLayers.Class({code:null,requestType:null,last:true,features:null,data:null,reqFeatures:null,priv:null,error:null,initialize:function(options){OpenLayers.Util.extend(this,options)},success:function(){return this.code>0},CLASS_NAME:"OpenLayers.Protocol.Response"});OpenLayers.Protocol.Response.SUCCESS=1;OpenLayers.Protocol.Response.FAILURE=0;OpenLayers.Protocol.WFS=function(options){options=OpenLayers.Util.applyDefaults(options,OpenLayers.Protocol.WFS.DEFAULTS);var cls=OpenLayers.Protocol.WFS["v"+options.version.replace(/\./g,"_")];if(!cls){throw"Unsupported WFS version: "+options.version}return new cls(options)};OpenLayers.Protocol.WFS.fromWMSLayer=function(layer,options){var typeName,featurePrefix;var param=layer.params["LAYERS"];var parts=(OpenLayers.Util.isArray(param)?param[0]:param).split(":");if(parts.length>1){featurePrefix=parts[0]}typeName=parts.pop();var protocolOptions={url:layer.url,featureType:typeName,featurePrefix:featurePrefix,srsName:layer.projection&&layer.projection.getCode()||layer.map&&layer.map.getProjectionObject().getCode(),version:"1.1.0"};return new OpenLayers.Protocol.WFS(OpenLayers.Util.applyDefaults(options,protocolOptions))};OpenLayers.Protocol.WFS.DEFAULTS={version:"1.0.0"};OpenLayers.ProxyHost="";if(!OpenLayers.Request){OpenLayers.Request={}}OpenLayers.Util.extend(OpenLayers.Request,{DEFAULT_CONFIG:{method:"GET",url:window.location.href,async:true,user:undefined,password:undefined,params:null,proxy:OpenLayers.ProxyHost,headers:{},data:null,callback:function(){},success:null,failure:null,scope:null},URL_SPLIT_REGEX:/([^:]*:)\/\/([^:]*:?[^@]*@)?([^:\/\?]*):?([^\/\?]*)/,events:new OpenLayers.Events(this),makeSameOrigin:function(url,proxy){var sameOrigin=url.indexOf("http")!==0;var urlParts=!sameOrigin&&url.match(this.URL_SPLIT_REGEX);if(urlParts){var location=window.location;sameOrigin=urlParts[1]==location.protocol&&urlParts[3]==location.hostname;var uPort=urlParts[4],lPort=location.port;if(uPort!=80&&uPort!=""||lPort!="80"&&lPort!=""){sameOrigin=sameOrigin&&uPort==lPort}}if(!sameOrigin){if(proxy){if(typeof proxy=="function"){url=proxy(url)}else{url=proxy+encodeURIComponent(url)}}}return url},issue:function(config){var defaultConfig=OpenLayers.Util.extend(this.DEFAULT_CONFIG,{proxy:OpenLayers.ProxyHost});config=config||{};config.headers=config.headers||{};config=OpenLayers.Util.applyDefaults(config,defaultConfig);config.headers=OpenLayers.Util.applyDefaults(config.headers,defaultConfig.headers);var customRequestedWithHeader=false,headerKey;for(headerKey in config.headers){if(config.headers.hasOwnProperty(headerKey)){if(headerKey.toLowerCase()==="x-requested-with"){customRequestedWithHeader=true}}}if(customRequestedWithHeader===false){config.headers["X-Requested-With"]="XMLHttpRequest"}var request=new OpenLayers.Request.XMLHttpRequest;var url=OpenLayers.Util.urlAppend(config.url,OpenLayers.Util.getParameterString(config.params||{}));url=OpenLayers.Request.makeSameOrigin(url,config.proxy);request.open(config.method,url,config.async,config.user,config.password);for(var header in config.headers){request.setRequestHeader(header,config.headers[header])}var events=this.events;var self=this;request.onreadystatechange=function(){if(request.readyState==OpenLayers.Request.XMLHttpRequest.DONE){var proceed=events.triggerEvent("complete",{request:request,config:config,requestUrl:url});if(proceed!==false){self.runCallbacks({request:request,config:config,requestUrl:url})}}};if(config.async===false){request.send(config.data)}else{window.setTimeout(function(){if(request.readyState!==0){request.send(config.data)}},0)}return request},runCallbacks:function(options){var request=options.request;var config=options.config;var complete=config.scope?OpenLayers.Function.bind(config.callback,config.scope):config.callback;var success;if(config.success){success=config.scope?OpenLayers.Function.bind(config.success,config.scope):config.success}var failure;if(config.failure){failure=config.scope?OpenLayers.Function.bind(config.failure,config.scope):config.failure}if(OpenLayers.Util.createUrlObject(config.url).protocol=="file:"&&request.responseText){request.status=200}complete(request);if(!request.status||request.status>=200&&request.status<300){this.events.triggerEvent("success",options);if(success){success(request)}}if(request.status&&(request.status<200||request.status>=300)){this.events.triggerEvent("failure",options);if(failure){failure(request)}}},GET:function(config){config=OpenLayers.Util.extend(config,{method:"GET"});return OpenLayers.Request.issue(config)},POST:function(config){config=OpenLayers.Util.extend(config,{method:"POST"});config.headers=config.headers?config.headers:{};if(!("CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(config.headers))){config.headers["Content-Type"]="application/xml"}return OpenLayers.Request.issue(config)},PUT:function(config){config=OpenLayers.Util.extend(config,{method:"PUT"});config.headers=config.headers?config.headers:{};if(!("CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(config.headers))){config.headers["Content-Type"]="application/xml"}return OpenLayers.Request.issue(config)},DELETE:function(config){config=OpenLayers.Util.extend(config,{method:"DELETE"});return OpenLayers.Request.issue(config)},HEAD:function(config){config=OpenLayers.Util.extend(config,{method:"HEAD"});return OpenLayers.Request.issue(config)},OPTIONS:function(config){config=OpenLayers.Util.extend(config,{method:"OPTIONS"});return OpenLayers.Request.issue(config)}});(function(){var oXMLHttpRequest=window.XMLHttpRequest;var bGecko=!!window.controllers,bIE=window.document.all&&!window.opera,bIE7=bIE&&window.navigator.userAgent.match(/MSIE 7.0/);function fXMLHttpRequest(){this._object=oXMLHttpRequest&&!bIE7?new oXMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");this._listeners=[]}function cXMLHttpRequest(){return new fXMLHttpRequest}cXMLHttpRequest.prototype=fXMLHttpRequest.prototype;if(bGecko&&oXMLHttpRequest.wrapped)cXMLHttpRequest.wrapped=oXMLHttpRequest.wrapped;cXMLHttpRequest.UNSENT=0;cXMLHttpRequest.OPENED=1;cXMLHttpRequest.HEADERS_RECEIVED=2;cXMLHttpRequest.LOADING=3;cXMLHttpRequest.DONE=4;cXMLHttpRequest.prototype.readyState=cXMLHttpRequest.UNSENT;cXMLHttpRequest.prototype.responseText="";cXMLHttpRequest.prototype.responseXML=null;cXMLHttpRequest.prototype.status=0;cXMLHttpRequest.prototype.statusText="";cXMLHttpRequest.prototype.priority="NORMAL";cXMLHttpRequest.prototype.onreadystatechange=null;cXMLHttpRequest.onreadystatechange=null;cXMLHttpRequest.onopen=null;cXMLHttpRequest.onsend=null;cXMLHttpRequest.onabort=null;cXMLHttpRequest.prototype.open=function(sMethod,sUrl,bAsync,sUser,sPassword){delete this._headers;if(arguments.length<3)bAsync=true;this._async=bAsync;var oRequest=this,nState=this.readyState,fOnUnload;if(bIE&&bAsync){fOnUnload=function(){if(nState!=cXMLHttpRequest.DONE){fCleanTransport(oRequest);oRequest.abort()}};window.attachEvent("onunload",fOnUnload)}if(cXMLHttpRequest.onopen)cXMLHttpRequest.onopen.apply(this,arguments);if(arguments.length>4)this._object.open(sMethod,sUrl,bAsync,sUser,sPassword);else if(arguments.length>3)this._object.open(sMethod,sUrl,bAsync,sUser);else this._object.open(sMethod,sUrl,bAsync);this.readyState=cXMLHttpRequest.OPENED;fReadyStateChange(this);this._object.onreadystatechange=function(){if(bGecko&&!bAsync)return;oRequest.readyState=oRequest._object.readyState;fSynchronizeValues(oRequest);if(oRequest._aborted){oRequest.readyState=cXMLHttpRequest.UNSENT;return}if(oRequest.readyState==cXMLHttpRequest.DONE){delete oRequest._data;fCleanTransport(oRequest);if(bIE&&bAsync)window.detachEvent("onunload",fOnUnload)}if(nState!=oRequest.readyState)fReadyStateChange(oRequest);nState=oRequest.readyState}};function fXMLHttpRequest_send(oRequest){oRequest._object.send(oRequest._data);if(bGecko&&!oRequest._async){oRequest.readyState=cXMLHttpRequest.OPENED;fSynchronizeValues(oRequest);while(oRequest.readyState<cXMLHttpRequest.DONE){oRequest.readyState++;fReadyStateChange(oRequest);if(oRequest._aborted)return}}}cXMLHttpRequest.prototype.send=function(vData){if(cXMLHttpRequest.onsend)cXMLHttpRequest.onsend.apply(this,arguments);if(!arguments.length)vData=null;if(vData&&vData.nodeType){vData=window.XMLSerializer?(new window.XMLSerializer).serializeToString(vData):vData.xml;if(!this._headers["Content-Type"])this._object.setRequestHeader("Content-Type","application/xml")}this._data=vData;fXMLHttpRequest_send(this)};cXMLHttpRequest.prototype.abort=function(){if(cXMLHttpRequest.onabort)cXMLHttpRequest.onabort.apply(this,arguments);if(this.readyState>cXMLHttpRequest.UNSENT)this._aborted=true;this._object.abort();fCleanTransport(this);this.readyState=cXMLHttpRequest.UNSENT;delete this._data};cXMLHttpRequest.prototype.getAllResponseHeaders=function(){return this._object.getAllResponseHeaders()};cXMLHttpRequest.prototype.getResponseHeader=function(sName){return this._object.getResponseHeader(sName)};cXMLHttpRequest.prototype.setRequestHeader=function(sName,sValue){if(!this._headers)this._headers={};this._headers[sName]=sValue;return this._object.setRequestHeader(sName,sValue)};cXMLHttpRequest.prototype.addEventListener=function(sName,fHandler,bUseCapture){for(var nIndex=0,oListener;oListener=this._listeners[nIndex];nIndex++)if(oListener[0]==sName&&oListener[1]==fHandler&&oListener[2]==bUseCapture)return;this._listeners.push([sName,fHandler,bUseCapture])};cXMLHttpRequest.prototype.removeEventListener=function(sName,fHandler,bUseCapture){for(var nIndex=0,oListener;oListener=this._listeners[nIndex];nIndex++)if(oListener[0]==sName&&oListener[1]==fHandler&&oListener[2]==bUseCapture)break;if(oListener)this._listeners.splice(nIndex,1)};cXMLHttpRequest.prototype.dispatchEvent=function(oEvent){var oEventPseudo={type:oEvent.type,target:this,currentTarget:this,eventPhase:2,bubbles:oEvent.bubbles,cancelable:oEvent.cancelable,timeStamp:oEvent.timeStamp,stopPropagation:function(){},preventDefault:function(){},initEvent:function(){}};if(oEventPseudo.type=="readystatechange"&&this.onreadystatechange)(this.onreadystatechange.handleEvent||this.onreadystatechange).apply(this,[oEventPseudo]);for(var nIndex=0,oListener;oListener=this._listeners[nIndex];nIndex++)if(oListener[0]==oEventPseudo.type&&!oListener[2])(oListener[1].handleEvent||oListener[1]).apply(this,[oEventPseudo])};cXMLHttpRequest.prototype.toString=function(){return"["+"object"+" "+"XMLHttpRequest"+"]"};cXMLHttpRequest.toString=function(){return"["+"XMLHttpRequest"+"]"};function fReadyStateChange(oRequest){if(cXMLHttpRequest.onreadystatechange)cXMLHttpRequest.onreadystatechange.apply(oRequest);oRequest.dispatchEvent({type:"readystatechange",bubbles:false,cancelable:false,timeStamp:new Date+0})}function fGetDocument(oRequest){var oDocument=oRequest.responseXML,sResponse=oRequest.responseText;if(bIE&&sResponse&&oDocument&&!oDocument.documentElement&&oRequest.getResponseHeader("Content-Type").match(/[^\/]+\/[^\+]+\+xml/)){oDocument=new window.ActiveXObject("Microsoft.XMLDOM");oDocument.async=false;oDocument.validateOnParse=false;oDocument.loadXML(sResponse)}if(oDocument)if(bIE&&oDocument.parseError!=0||!oDocument.documentElement||oDocument.documentElement&&oDocument.documentElement.tagName=="parsererror")return null;return oDocument}function fSynchronizeValues(oRequest){try{oRequest.responseText=oRequest._object.responseText}catch(e){}try{oRequest.responseXML=fGetDocument(oRequest._object)}catch(e){}try{oRequest.status=oRequest._object.status}catch(e){}try{oRequest.statusText=oRequest._object.statusText}catch(e){}}function fCleanTransport(oRequest){oRequest._object.onreadystatechange=new window.Function}if(!window.Function.prototype.apply){window.Function.prototype.apply=function(oRequest,oArguments){if(!oArguments)oArguments=[];oRequest.__func=this;oRequest.__func(oArguments[0],oArguments[1],oArguments[2],oArguments[3],oArguments[4]);delete oRequest.__func}}if(!OpenLayers.Request){OpenLayers.Request={}}OpenLayers.Request.XMLHttpRequest=cXMLHttpRequest})();OpenLayers.Format.KML=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{kml:"http://www.opengis.net/kml/2.2",gx:"http://www.google.com/kml/ext/2.2"},kmlns:"http://earth.google.com/kml/2.0",placemarksDesc:"No description available",foldersName:"OpenLayers export",foldersDesc:"Exported on "+new Date,extractAttributes:true,kvpAttributes:false,extractStyles:false,extractTracks:false,trackAttributes:null,internalns:null,features:null,styles:null,styleBaseUrl:"",fetched:null,maxDepth:0,initialize:function(options){this.regExes={trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g,kmlColor:/(\w{2})(\w{2})(\w{2})(\w{2})/,kmlIconPalette:/root:\/\/icons\/palette-(\d+)(\.\w+)/,straightBracket:/\$\[(.*?)\]/g};this.externalProjection=new OpenLayers.Projection("EPSG:4326");OpenLayers.Format.XML.prototype.initialize.apply(this,[options])},read:function(data){this.features=[];this.styles={};this.fetched={};var options={depth:0,styleBaseUrl:this.styleBaseUrl};return this.parseData(data,options)},parseData:function(data,options){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data])}var types=["Link","NetworkLink","Style","StyleMap","Placemark"];for(var i=0,len=types.length;i<len;++i){var type=types[i];var nodes=this.getElementsByTagNameNS(data,"*",type);if(nodes.length==0){continue}switch(type.toLowerCase()){case"link":case"networklink":this.parseLinks(nodes,options);break;case"style":if(this.extractStyles){this.parseStyles(nodes,options)}break;case"stylemap":if(this.extractStyles){this.parseStyleMaps(nodes,options)}break;case"placemark":this.parseFeatures(nodes,options);break}}return this.features},parseLinks:function(nodes,options){if(options.depth>=this.maxDepth){return false}var newOptions=OpenLayers.Util.extend({},options);newOptions.depth++;for(var i=0,len=nodes.length;i<len;i++){var href=this.parseProperty(nodes[i],"*","href");if(href&&!this.fetched[href]){this.fetched[href]=true;var data=this.fetchLink(href);if(data){this.parseData(data,newOptions)}}}},fetchLink:function(href){var request=OpenLayers.Request.GET({url:href,async:false});if(request){return request.responseText}},parseStyles:function(nodes,options){for(var i=0,len=nodes.length;i<len;i++){var style=this.parseStyle(nodes[i]);if(style){var styleName=(options.styleBaseUrl||"")+"#"+style.id;this.styles[styleName]=style}}},parseKmlColor:function(kmlColor){var color=null;if(kmlColor){var matches=kmlColor.match(this.regExes.kmlColor);if(matches){color={color:"#"+matches[4]+matches[3]+matches[2],opacity:parseInt(matches[1],16)/255}}}return color},parseStyle:function(node){var style={};var types=["LineStyle","PolyStyle","IconStyle","BalloonStyle","LabelStyle"];var type,styleTypeNode,nodeList,geometry,parser;for(var i=0,len=types.length;i<len;++i){type=types[i];styleTypeNode=this.getElementsByTagNameNS(node,"*",type)[0];if(!styleTypeNode){continue}switch(type.toLowerCase()){case"linestyle":var kmlColor=this.parseProperty(styleTypeNode,"*","color");var color=this.parseKmlColor(kmlColor);if(color){style["strokeColor"]=color.color;style["strokeOpacity"]=color.opacity}var width=this.parseProperty(styleTypeNode,"*","width");if(width){style["strokeWidth"]=width}break;case"polystyle":var kmlColor=this.parseProperty(styleTypeNode,"*","color");var color=this.parseKmlColor(kmlColor);if(color){style["fillOpacity"]=color.opacity;style["fillColor"]=color.color}var fill=this.parseProperty(styleTypeNode,"*","fill");if(fill=="0"){style["fillColor"]="none"}var outline=this.parseProperty(styleTypeNode,"*","outline");if(outline=="0"){style["strokeWidth"]="0"}break;case"iconstyle":var scale=parseFloat(this.parseProperty(styleTypeNode,"*","scale")||1);var width=32*scale;var height=32*scale;var iconNode=this.getElementsByTagNameNS(styleTypeNode,"*","Icon")[0];if(iconNode){var href=this.parseProperty(iconNode,"*","href");if(href){var w=this.parseProperty(iconNode,"*","w");var h=this.parseProperty(iconNode,"*","h");var google="http://maps.google.com/mapfiles/kml";if(OpenLayers.String.startsWith(href,google)&&!w&&!h){w=64;h=64;scale=scale/2}w=w||h;h=h||w;if(w){width=parseInt(w)*scale}if(h){height=parseInt(h)*scale}var matches=href.match(this.regExes.kmlIconPalette);if(matches){var palette=matches[1];var file_extension=matches[2];var x=this.parseProperty(iconNode,"*","x");var y=this.parseProperty(iconNode,"*","y");var posX=x?x/32:0;var posY=y?7-y/32:7;var pos=posY*8+posX;href="http://maps.google.com/mapfiles/kml/pal"+palette+"/icon"+pos+file_extension}style["graphicOpacity"]=1;style["externalGraphic"]=href}}var hotSpotNode=this.getElementsByTagNameNS(styleTypeNode,"*","hotSpot")[0];if(hotSpotNode){var x=parseFloat(hotSpotNode.getAttribute("x"));var y=parseFloat(hotSpotNode.getAttribute("y"));var xUnits=hotSpotNode.getAttribute("xunits");if(xUnits=="pixels"){style["graphicXOffset"]=-x*scale}else if(xUnits=="insetPixels"){style["graphicXOffset"]=-width+x*scale}else if(xUnits=="fraction"){style["graphicXOffset"]=-width*x}var yUnits=hotSpotNode.getAttribute("yunits");if(yUnits=="pixels"){style["graphicYOffset"]=-height+y*scale+1}else if(yUnits=="insetPixels"){style["graphicYOffset"]=-(y*scale)+1}else if(yUnits=="fraction"){style["graphicYOffset"]=-height*(1-y)+1}}style["graphicWidth"]=width;style["graphicHeight"]=height;break;case"balloonstyle":var balloonStyle=OpenLayers.Util.getXmlNodeValue(styleTypeNode);if(balloonStyle){style["balloonStyle"]=balloonStyle.replace(this.regExes.straightBracket,"${$1}")}break;case"labelstyle":var kmlColor=this.parseProperty(styleTypeNode,"*","color");
var color=this.parseKmlColor(kmlColor);if(color){style["fontColor"]=color.color;style["fontOpacity"]=color.opacity}break;default:}}if(!style["strokeColor"]&&style["fillColor"]){style["strokeColor"]=style["fillColor"]}var id=node.getAttribute("id");if(id&&style){style.id=id}return style},parseStyleMaps:function(nodes,options){for(var i=0,len=nodes.length;i<len;i++){var node=nodes[i];var pairs=this.getElementsByTagNameNS(node,"*","Pair");var id=node.getAttribute("id");for(var j=0,jlen=pairs.length;j<jlen;j++){var pair=pairs[j];var key=this.parseProperty(pair,"*","key");var styleUrl=this.parseProperty(pair,"*","styleUrl");if(styleUrl&&key=="normal"){this.styles[(options.styleBaseUrl||"")+"#"+id]=this.styles[(options.styleBaseUrl||"")+styleUrl]}}}},parseFeatures:function(nodes,options){var features=[];for(var i=0,len=nodes.length;i<len;i++){var featureNode=nodes[i];var feature=this.parseFeature.apply(this,[featureNode]);if(feature){if(this.extractStyles&&feature.attributes&&feature.attributes.styleUrl){feature.style=this.getStyle(feature.attributes.styleUrl,options)}if(this.extractStyles){var inlineStyleNode=this.getElementsByTagNameNS(featureNode,"*","Style")[0];if(inlineStyleNode){var inlineStyle=this.parseStyle(inlineStyleNode);if(inlineStyle){feature.style=OpenLayers.Util.extend(feature.style,inlineStyle)}}}if(this.extractTracks){var tracks=this.getElementsByTagNameNS(featureNode,this.namespaces.gx,"Track");if(tracks&&tracks.length>0){var track=tracks[0];var container={features:[],feature:feature};this.readNode(track,container);if(container.features.length>0){features.push.apply(features,container.features)}}}else{features.push(feature)}}else{throw"Bad Placemark: "+i}}this.features=this.features.concat(features)},readers:{kml:{when:function(node,container){container.whens.push(OpenLayers.Date.parse(this.getChildValue(node)))},_trackPointAttribute:function(node,container){var name=node.nodeName.split(":").pop();container.attributes[name].push(this.getChildValue(node))}},gx:{Track:function(node,container){var obj={whens:[],points:[],angles:[]};if(this.trackAttributes){var name;obj.attributes={};for(var i=0,ii=this.trackAttributes.length;i<ii;++i){name=this.trackAttributes[i];obj.attributes[name]=[];if(!(name in this.readers.kml)){this.readers.kml[name]=this.readers.kml._trackPointAttribute}}}this.readChildNodes(node,obj);if(obj.whens.length!==obj.points.length){throw new Error("gx:Track with unequal number of when ("+obj.whens.length+") and gx:coord ("+obj.points.length+") elements.")}var hasAngles=obj.angles.length>0;if(hasAngles&&obj.whens.length!==obj.angles.length){throw new Error("gx:Track with unequal number of when ("+obj.whens.length+") and gx:angles ("+obj.angles.length+") elements.")}var feature,point,angles;for(var i=0,ii=obj.whens.length;i<ii;++i){feature=container.feature.clone();feature.fid=container.feature.fid||container.feature.id;point=obj.points[i];feature.geometry=point;if("z"in point){feature.attributes.altitude=point.z}if(this.internalProjection&&this.externalProjection){feature.geometry.transform(this.externalProjection,this.internalProjection)}if(this.trackAttributes){for(var j=0,jj=this.trackAttributes.length;j<jj;++j){var name=this.trackAttributes[j];feature.attributes[name]=obj.attributes[name][i]}}feature.attributes.when=obj.whens[i];feature.attributes.trackId=container.feature.id;if(hasAngles){angles=obj.angles[i];feature.attributes.heading=parseFloat(angles[0]);feature.attributes.tilt=parseFloat(angles[1]);feature.attributes.roll=parseFloat(angles[2])}container.features.push(feature)}},coord:function(node,container){var str=this.getChildValue(node);var coords=str.replace(this.regExes.trimSpace,"").split(/\s+/);var point=new OpenLayers.Geometry.Point(coords[0],coords[1]);if(coords.length>2){point.z=parseFloat(coords[2])}container.points.push(point)},angles:function(node,container){var str=this.getChildValue(node);var parts=str.replace(this.regExes.trimSpace,"").split(/\s+/);container.angles.push(parts)}}},parseFeature:function(node){var order=["MultiGeometry","Polygon","LineString","Point"];var type,nodeList,geometry,parser;for(var i=0,len=order.length;i<len;++i){type=order[i];this.internalns=node.namespaceURI?node.namespaceURI:this.kmlns;nodeList=this.getElementsByTagNameNS(node,this.internalns,type);if(nodeList.length>0){var parser=this.parseGeometry[type.toLowerCase()];if(parser){geometry=parser.apply(this,[nodeList[0]]);if(this.internalProjection&&this.externalProjection){geometry.transform(this.externalProjection,this.internalProjection)}}else{throw new TypeError("Unsupported geometry type: "+type)}break}}var attributes;if(this.extractAttributes){attributes=this.parseAttributes(node)}var feature=new OpenLayers.Feature.Vector(geometry,attributes);var fid=node.getAttribute("id")||node.getAttribute("name");if(fid!=null){feature.fid=fid}return feature},getStyle:function(styleUrl,options){var styleBaseUrl=OpenLayers.Util.removeTail(styleUrl);var newOptions=OpenLayers.Util.extend({},options);newOptions.depth++;newOptions.styleBaseUrl=styleBaseUrl;if(!this.styles[styleUrl]&&!OpenLayers.String.startsWith(styleUrl,"#")&&newOptions.depth<=this.maxDepth&&!this.fetched[styleBaseUrl]){var data=this.fetchLink(styleBaseUrl);if(data){this.parseData(data,newOptions)}}var style=OpenLayers.Util.extend({},this.styles[styleUrl]);return style},parseGeometry:{point:function(node){var nodeList=this.getElementsByTagNameNS(node,this.internalns,"coordinates");var coords=[];if(nodeList.length>0){var coordString=nodeList[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.removeSpace,"");coords=coordString.split(",")}var point=null;if(coords.length>1){if(coords.length==2){coords[2]=null}point=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2])}else{throw"Bad coordinate string: "+coordString}return point},linestring:function(node,ring){var nodeList=this.getElementsByTagNameNS(node,this.internalns,"coordinates");var line=null;if(nodeList.length>0){var coordString=this.getChildValue(nodeList[0]);coordString=coordString.replace(this.regExes.trimSpace,"");coordString=coordString.replace(this.regExes.trimComma,",");var pointList=coordString.split(this.regExes.splitSpace);var numPoints=pointList.length;var points=new Array(numPoints);var coords,numCoords;for(var i=0;i<numPoints;++i){coords=pointList[i].split(",");numCoords=coords.length;if(numCoords>1){if(coords.length==2){coords[2]=null}points[i]=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2])}else{throw"Bad LineString point coordinates: "+pointList[i]}}if(numPoints){if(ring){line=new OpenLayers.Geometry.LinearRing(points)}else{line=new OpenLayers.Geometry.LineString(points)}}else{throw"Bad LineString coordinates: "+coordString}}return line},polygon:function(node){var nodeList=this.getElementsByTagNameNS(node,this.internalns,"LinearRing");var numRings=nodeList.length;var components=new Array(numRings);if(numRings>0){var ring;for(var i=0,len=nodeList.length;i<len;++i){ring=this.parseGeometry.linestring.apply(this,[nodeList[i],true]);if(ring){components[i]=ring}else{throw"Bad LinearRing geometry: "+i}}}return new OpenLayers.Geometry.Polygon(components)},multigeometry:function(node){var child,parser;var parts=[];var children=node.childNodes;for(var i=0,len=children.length;i<len;++i){child=children[i];if(child.nodeType==1){var type=child.prefix?child.nodeName.split(":")[1]:child.nodeName;var parser=this.parseGeometry[type.toLowerCase()];if(parser){parts.push(parser.apply(this,[child]))}}}return new OpenLayers.Geometry.Collection(parts)}},parseAttributes:function(node){var attributes={};var edNodes=node.getElementsByTagName("ExtendedData");if(edNodes.length){attributes=this.parseExtendedData(edNodes[0])}var child,grandchildren,grandchild;var children=node.childNodes;for(var i=0,len=children.length;i<len;++i){child=children[i];if(child.nodeType==1){grandchildren=child.childNodes;if(grandchildren.length>=1&&grandchildren.length<=3){var grandchild;switch(grandchildren.length){case 1:grandchild=grandchildren[0];break;case 2:var c1=grandchildren[0];var c2=grandchildren[1];grandchild=c1.nodeType==3||c1.nodeType==4?c1:c2;break;case 3:default:grandchild=grandchildren[1];break}if(grandchild.nodeType==3||grandchild.nodeType==4){var name=child.prefix?child.nodeName.split(":")[1]:child.nodeName;var value=OpenLayers.Util.getXmlNodeValue(grandchild);if(value){value=value.replace(this.regExes.trimSpace,"");attributes[name]=value}}}}}return attributes},parseExtendedData:function(node){var attributes={};var i,len,data,key;var dataNodes=node.getElementsByTagName("Data");for(i=0,len=dataNodes.length;i<len;i++){data=dataNodes[i];key=data.getAttribute("name");var ed={};var valueNode=data.getElementsByTagName("value");if(valueNode.length){ed["value"]=this.getChildValue(valueNode[0])}if(this.kvpAttributes){attributes[key]=ed["value"]}else{var nameNode=data.getElementsByTagName("displayName");if(nameNode.length){ed["displayName"]=this.getChildValue(nameNode[0])}attributes[key]=ed}}var simpleDataNodes=node.getElementsByTagName("SimpleData");for(i=0,len=simpleDataNodes.length;i<len;i++){var ed={};data=simpleDataNodes[i];key=data.getAttribute("name");ed["value"]=this.getChildValue(data);if(this.kvpAttributes){attributes[key]=ed["value"]}else{ed["displayName"]=key;attributes[key]=ed}}return attributes},parseProperty:function(xmlNode,namespace,tagName){var value;var nodeList=this.getElementsByTagNameNS(xmlNode,namespace,tagName);try{value=OpenLayers.Util.getXmlNodeValue(nodeList[0])}catch(e){value=null}return value},write:function(features){if(!OpenLayers.Util.isArray(features)){features=[features]}var kml=this.createElementNS(this.kmlns,"kml");var folder=this.createFolderXML();for(var i=0,len=features.length;i<len;++i){folder.appendChild(this.createPlacemarkXML(features[i]))}kml.appendChild(folder);return OpenLayers.Format.XML.prototype.write.apply(this,[kml])},createFolderXML:function(){var folder=this.createElementNS(this.kmlns,"Folder");if(this.foldersName){var folderName=this.createElementNS(this.kmlns,"name");var folderNameText=this.createTextNode(this.foldersName);folderName.appendChild(folderNameText);folder.appendChild(folderName)}if(this.foldersDesc){var folderDesc=this.createElementNS(this.kmlns,"description");var folderDescText=this.createTextNode(this.foldersDesc);folderDesc.appendChild(folderDescText);folder.appendChild(folderDesc)}return folder},createPlacemarkXML:function(feature){var placemarkName=this.createElementNS(this.kmlns,"name");var label=feature.style&&feature.style.label?feature.style.label:feature.id;var name=feature.attributes.name||label;placemarkName.appendChild(this.createTextNode(name));var placemarkDesc=this.createElementNS(this.kmlns,"description");var desc=feature.attributes.description||this.placemarksDesc;placemarkDesc.appendChild(this.createTextNode(desc));var placemarkNode=this.createElementNS(this.kmlns,"Placemark");if(feature.fid!=null){placemarkNode.setAttribute("id",feature.fid)}placemarkNode.appendChild(placemarkName);placemarkNode.appendChild(placemarkDesc);var geometryNode=this.buildGeometryNode(feature.geometry);placemarkNode.appendChild(geometryNode);if(feature.attributes){var edNode=this.buildExtendedData(feature.attributes);if(edNode){placemarkNode.appendChild(edNode)}}return placemarkNode},buildGeometryNode:function(geometry){var className=geometry.CLASS_NAME;var type=className.substring(className.lastIndexOf(".")+1);var builder=this.buildGeometry[type.toLowerCase()];var node=null;if(builder){node=builder.apply(this,[geometry])}return node},buildGeometry:{point:function(geometry){var kml=this.createElementNS(this.kmlns,"Point");kml.appendChild(this.buildCoordinatesNode(geometry));return kml},multipoint:function(geometry){return this.buildGeometry.collection.apply(this,[geometry])},linestring:function(geometry){var kml=this.createElementNS(this.kmlns,"LineString");kml.appendChild(this.buildCoordinatesNode(geometry));return kml},multilinestring:function(geometry){return this.buildGeometry.collection.apply(this,[geometry])},linearring:function(geometry){var kml=this.createElementNS(this.kmlns,"LinearRing");kml.appendChild(this.buildCoordinatesNode(geometry));return kml},polygon:function(geometry){var kml=this.createElementNS(this.kmlns,"Polygon");var rings=geometry.components;var ringMember,ringGeom,type;for(var i=0,len=rings.length;i<len;++i){type=i==0?"outerBoundaryIs":"innerBoundaryIs";ringMember=this.createElementNS(this.kmlns,type);ringGeom=this.buildGeometry.linearring.apply(this,[rings[i]]);ringMember.appendChild(ringGeom);kml.appendChild(ringMember)}return kml},multipolygon:function(geometry){return this.buildGeometry.collection.apply(this,[geometry])},collection:function(geometry){var kml=this.createElementNS(this.kmlns,"MultiGeometry");var child;for(var i=0,len=geometry.components.length;i<len;++i){child=this.buildGeometryNode.apply(this,[geometry.components[i]]);if(child){kml.appendChild(child)}}return kml}},buildCoordinatesNode:function(geometry){var coordinatesNode=this.createElementNS(this.kmlns,"coordinates");var path;var points=geometry.components;if(points){var point;var numPoints=points.length;var parts=new Array(numPoints);for(var i=0;i<numPoints;++i){point=points[i];parts[i]=this.buildCoordinates(point)}path=parts.join(" ")}else{path=this.buildCoordinates(geometry)}var txtNode=this.createTextNode(path);coordinatesNode.appendChild(txtNode);return coordinatesNode},buildCoordinates:function(point){if(this.internalProjection&&this.externalProjection){point=point.clone();point.transform(this.internalProjection,this.externalProjection)}return point.x+","+point.y},buildExtendedData:function(attributes){var extendedData=this.createElementNS(this.kmlns,"ExtendedData");for(var attributeName in attributes){if(attributes[attributeName]&&attributeName!="name"&&attributeName!="description"&&attributeName!="styleUrl"){var data=this.createElementNS(this.kmlns,"Data");data.setAttribute("name",attributeName);var value=this.createElementNS(this.kmlns,"value");if(typeof attributes[attributeName]=="object"){if(attributes[attributeName].value){value.appendChild(this.createTextNode(attributes[attributeName].value))}if(attributes[attributeName].displayName){var displayName=this.createElementNS(this.kmlns,"displayName");displayName.appendChild(this.getXMLDoc().createCDATASection(attributes[attributeName].displayName));data.appendChild(displayName)}}else{value.appendChild(this.createTextNode(attributes[attributeName]))}data.appendChild(value);extendedData.appendChild(data)}}if(this.isSimpleContent(extendedData)){return null}else{return extendedData}},CLASS_NAME:"OpenLayers.Format.KML"});OpenLayers.Protocol.WFS.v1=OpenLayers.Class(OpenLayers.Protocol,{version:null,srsName:"EPSG:4326",featureType:null,featureNS:null,geometryName:"the_geom",schema:null,featurePrefix:"feature",formatOptions:null,readFormat:null,readOptions:null,initialize:function(options){OpenLayers.Protocol.prototype.initialize.apply(this,[options]);if(!options.format){this.format=OpenLayers.Format.WFST(OpenLayers.Util.extend({version:this.version,featureType:this.featureType,featureNS:this.featureNS,featurePrefix:this.featurePrefix,geometryName:this.geometryName,srsName:this.srsName,schema:this.schema},this.formatOptions))}if(!options.geometryName&&parseFloat(this.format.version)>1){this.setGeometryName(null)}},destroy:function(){if(this.options&&!this.options.format){this.format.destroy()}this.format=null;OpenLayers.Protocol.prototype.destroy.apply(this)},read:function(options){OpenLayers.Protocol.prototype.read.apply(this,arguments);options=OpenLayers.Util.extend({},options);OpenLayers.Util.applyDefaults(options,this.options||{});var response=new OpenLayers.Protocol.Response({requestType:"read"});var data=OpenLayers.Format.XML.prototype.write.apply(this.format,[this.format.writeNode("wfs:GetFeature",options)]);response.priv=OpenLayers.Request.POST({url:options.url,callback:this.createCallback(this.handleRead,response,options),params:options.params,headers:options.headers,data:data});return response},setFeatureType:function(featureType){this.featureType=featureType;this.format.featureType=featureType},setGeometryName:function(geometryName){this.geometryName=geometryName;this.format.geometryName=geometryName},handleRead:function(response,options){options=OpenLayers.Util.extend({},options);OpenLayers.Util.applyDefaults(options,this.options);if(options.callback){var request=response.priv;if(request.status>=200&&request.status<300){var result=this.parseResponse(request,options.readOptions);if(result&&result.success!==false){if(options.readOptions&&options.readOptions.output=="object"){OpenLayers.Util.extend(response,result)}else{response.features=result}response.code=OpenLayers.Protocol.Response.SUCCESS}else{response.code=OpenLayers.Protocol.Response.FAILURE;response.error=result}}else{response.code=OpenLayers.Protocol.Response.FAILURE}options.callback.call(options.scope,response)}},parseResponse:function(request,options){var doc=request.responseXML;if(!doc||!doc.documentElement){doc=request.responseText}if(!doc||doc.length<=0){return null}var result=this.readFormat!==null?this.readFormat.read(doc):this.format.read(doc,options);if(!this.featureNS){var format=this.readFormat||this.format;this.featureNS=format.featureNS;format.autoConfig=false;if(!this.geometryName){this.setGeometryName(format.geometryName)}}return result},commit:function(features,options){options=OpenLayers.Util.extend({},options);OpenLayers.Util.applyDefaults(options,this.options);var response=new OpenLayers.Protocol.Response({requestType:"commit",reqFeatures:features});response.priv=OpenLayers.Request.POST({url:options.url,headers:options.headers,data:this.format.write(features,options),callback:this.createCallback(this.handleCommit,response,options)});return response},handleCommit:function(response,options){if(options.callback){var request=response.priv;var data=request.responseXML;if(!data||!data.documentElement){data=request.responseText}var obj=this.format.read(data)||{};response.insertIds=obj.insertIds||[];if(obj.success){response.code=OpenLayers.Protocol.Response.SUCCESS}else{response.code=OpenLayers.Protocol.Response.FAILURE;response.error=obj}options.callback.call(options.scope,response)}},filterDelete:function(filter,options){options=OpenLayers.Util.extend({},options);OpenLayers.Util.applyDefaults(options,this.options);var response=new OpenLayers.Protocol.Response({requestType:"commit"});var root=this.format.createElementNSPlus("wfs:Transaction",{attributes:{service:"WFS",version:this.version}});var deleteNode=this.format.createElementNSPlus("wfs:Delete",{attributes:{typeName:(options.featureNS?this.featurePrefix+":":"")+options.featureType}});if(options.featureNS){deleteNode.setAttribute("xmlns:"+this.featurePrefix,options.featureNS)}var filterNode=this.format.writeNode("ogc:Filter",filter);deleteNode.appendChild(filterNode);root.appendChild(deleteNode);var data=OpenLayers.Format.XML.prototype.write.apply(this.format,[root]);return OpenLayers.Request.POST({url:this.url,callback:options.callback||function(){},data:data})},abort:function(response){if(response){response.priv.abort()}},CLASS_NAME:"OpenLayers.Protocol.WFS.v1"});OpenLayers.Handler.Feature=OpenLayers.Class(OpenLayers.Handler,{EVENTMAP:{click:{"in":"click",out:"clickout"},mousemove:{"in":"over",out:"out"},dblclick:{"in":"dblclick",out:null},mousedown:{"in":null,out:null},mouseup:{"in":null,out:null},touchstart:{"in":"click",out:"clickout"}},feature:null,lastFeature:null,down:null,up:null,clickTolerance:4,geometryTypes:null,stopClick:true,stopDown:true,stopUp:false,initialize:function(control,layer,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,[control,callbacks,options]);this.layer=layer},touchstart:function(evt){this.startTouch();return OpenLayers.Event.isMultiTouch(evt)?true:this.mousedown(evt)},touchmove:function(evt){OpenLayers.Event.preventDefault(evt)},mousedown:function(evt){if(OpenLayers.Event.isLeftClick(evt)||OpenLayers.Event.isSingleTouch(evt)){this.down=evt.xy}return this.handle(evt)?!this.stopDown:true},mouseup:function(evt){this.up=evt.xy;return this.handle(evt)?!this.stopUp:true},click:function(evt){return this.handle(evt)?!this.stopClick:true},mousemove:function(evt){if(!this.callbacks["over"]&&!this.callbacks["out"]){return true}this.handle(evt);return true},dblclick:function(evt){return!this.handle(evt)},geometryTypeMatches:function(feature){return this.geometryTypes==null||OpenLayers.Util.indexOf(this.geometryTypes,feature.geometry.CLASS_NAME)>-1},handle:function(evt){if(this.feature&&!this.feature.layer){this.feature=null}var type=evt.type;var handled=false;var previouslyIn=!!this.feature;var click=type=="click"||type=="dblclick"||type=="touchstart";this.feature=this.layer.getFeatureFromEvent(evt);if(this.feature&&!this.feature.layer){this.feature=null}if(this.lastFeature&&!this.lastFeature.layer){this.lastFeature=null}if(this.feature){if(type==="touchstart"){OpenLayers.Event.preventDefault(evt)}var inNew=this.feature!=this.lastFeature;if(this.geometryTypeMatches(this.feature)){if(previouslyIn&&inNew){if(this.lastFeature){this.triggerCallback(type,"out",[this.lastFeature])}this.triggerCallback(type,"in",[this.feature])}else if(!previouslyIn||click){this.triggerCallback(type,"in",[this.feature])}this.lastFeature=this.feature;handled=true}else{if(this.lastFeature&&(previouslyIn&&inNew||click)){this.triggerCallback(type,"out",[this.lastFeature])}this.feature=null}}else if(this.lastFeature&&(previouslyIn||click)){this.triggerCallback(type,"out",[this.lastFeature])}return handled},triggerCallback:function(type,mode,args){var key=this.EVENTMAP[type][mode];if(key){if(type=="click"&&this.up&&this.down){var dpx=Math.sqrt(Math.pow(this.up.x-this.down.x,2)+Math.pow(this.up.y-this.down.y,2));if(dpx<=this.clickTolerance){this.callback(key,args)}this.up=this.down=null}else{this.callback(key,args)}}},activate:function(){var activated=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.moveLayerToTop();this.map.events.on({removelayer:this.handleMapEvents,changelayer:this.handleMapEvents,scope:this});activated=true}return activated},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.moveLayerBack();this.feature=null;this.lastFeature=null;this.down=null;this.up=null;this.map.events.un({removelayer:this.handleMapEvents,changelayer:this.handleMapEvents,scope:this});deactivated=true}return deactivated},handleMapEvents:function(evt){if(evt.type=="removelayer"||evt.property=="order"){this.moveLayerToTop()}},moveLayerToTop:function(){var index=Math.max(this.map.Z_INDEX_BASE["Feature"]-1,this.layer.getZIndex())+1;this.layer.setZIndex(index)},moveLayerBack:function(){var index=this.layer.getZIndex()-1;if(index>=this.map.Z_INDEX_BASE["Feature"]){this.layer.setZIndex(index)}else{this.map.setLayerZIndex(this.layer,this.map.getLayerIndex(this.layer))}},CLASS_NAME:"OpenLayers.Handler.Feature"});OpenLayers.StyleMap=OpenLayers.Class({styles:null,extendDefault:true,initialize:function(style,options){this.styles={"default":new OpenLayers.Style(OpenLayers.Feature.Vector.style["default"]),select:new OpenLayers.Style(OpenLayers.Feature.Vector.style["select"]),temporary:new OpenLayers.Style(OpenLayers.Feature.Vector.style["temporary"]),"delete":new OpenLayers.Style(OpenLayers.Feature.Vector.style["delete"])};if(style instanceof OpenLayers.Style){this.styles["default"]=style;this.styles["select"]=style;this.styles["temporary"]=style;this.styles["delete"]=style}else if(typeof style=="object"){for(var key in style){if(style[key]instanceof OpenLayers.Style){this.styles[key]=style[key]}else if(typeof style[key]=="object"){this.styles[key]=new OpenLayers.Style(style[key])}else{this.styles["default"]=new OpenLayers.Style(style);this.styles["select"]=new OpenLayers.Style(style);this.styles["temporary"]=new OpenLayers.Style(style);this.styles["delete"]=new OpenLayers.Style(style);break}}}OpenLayers.Util.extend(this,options)},destroy:function(){for(var key in this.styles){this.styles[key].destroy()}this.styles=null},createSymbolizer:function(feature,intent){if(!feature){feature=new OpenLayers.Feature.Vector}if(!this.styles[intent]){intent="default"}feature.renderIntent=intent;var defaultSymbolizer={};if(this.extendDefault&&intent!="default"){defaultSymbolizer=this.styles["default"].createSymbolizer(feature)}return OpenLayers.Util.extend(defaultSymbolizer,this.styles[intent].createSymbolizer(feature))},addUniqueValueRules:function(renderIntent,property,symbolizers,context){var rules=[];for(var value in symbolizers){rules.push(new OpenLayers.Rule({symbolizer:symbolizers[value],context:context,filter:new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.EQUAL_TO,property:property,value:value})}))}this.styles[renderIntent].addRules(rules)},CLASS_NAME:"OpenLayers.StyleMap"});OpenLayers.Layer.Vector=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:false,isFixed:false,features:null,filter:null,selectedFeatures:null,unrenderedFeatures:null,reportError:true,style:null,styleMap:null,strategies:null,protocol:null,renderers:["SVG","VML","Canvas"],renderer:null,rendererOptions:null,geometryType:null,drawn:false,ratio:1,initialize:function(name,options){OpenLayers.Layer.prototype.initialize.apply(this,arguments);if(!this.renderer||!this.renderer.supported()){this.assignRenderer()}if(!this.renderer||!this.renderer.supported()){this.renderer=null;this.displayError()}if(!this.styleMap){this.styleMap=new OpenLayers.StyleMap}this.features=[];this.selectedFeatures=[];this.unrenderedFeatures={};if(this.strategies){for(var i=0,len=this.strategies.length;i<len;i++){this.strategies[i].setLayer(this)}}},destroy:function(){if(this.strategies){var strategy,i,len;for(i=0,len=this.strategies.length;i<len;i++){strategy=this.strategies[i];if(strategy.autoDestroy){strategy.destroy()}}this.strategies=null}if(this.protocol){if(this.protocol.autoDestroy){this.protocol.destroy()}this.protocol=null}this.destroyFeatures();this.features=null;this.selectedFeatures=null;this.unrenderedFeatures=null;if(this.renderer){this.renderer.destroy()}this.renderer=null;this.geometryType=null;this.drawn=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.Vector(this.name,this.getOptions())}obj=OpenLayers.Layer.prototype.clone.apply(this,[obj]);var features=this.features;var len=features.length;var clonedFeatures=new Array(len);for(var i=0;i<len;++i){clonedFeatures[i]=features[i].clone()}obj.features=clonedFeatures;return obj},refresh:function(obj){if(this.calculateInRange()&&this.visibility){this.events.triggerEvent("refresh",obj)}},assignRenderer:function(){for(var i=0,len=this.renderers.length;i<len;i++){var rendererClass=this.renderers[i];var renderer=typeof rendererClass=="function"?rendererClass:OpenLayers.Renderer[rendererClass];if(renderer&&renderer.prototype.supported()){this.renderer=new renderer(this.div,this.rendererOptions);break}}},displayError:function(){if(this.reportError){OpenLayers.Console.userError(OpenLayers.i18n("browserNotSupported",{renderers:this.renderers.join("\n")}))}},setMap:function(map){OpenLayers.Layer.prototype.setMap.apply(this,arguments);if(!this.renderer){this.map.removeLayer(this)}else{this.renderer.map=this.map;var newSize=this.map.getSize();newSize.w=newSize.w*this.ratio;newSize.h=newSize.h*this.ratio;this.renderer.setSize(newSize)}},afterAdd:function(){if(this.strategies){var strategy,i,len;for(i=0,len=this.strategies.length;i<len;i++){strategy=this.strategies[i];if(strategy.autoActivate){strategy.activate()}}}},removeMap:function(map){this.drawn=false;if(this.strategies){var strategy,i,len;for(i=0,len=this.strategies.length;i<len;i++){strategy=this.strategies[i];if(strategy.autoActivate){strategy.deactivate()}}}},onMapResize:function(){OpenLayers.Layer.prototype.onMapResize.apply(this,arguments);var newSize=this.map.getSize();newSize.w=newSize.w*this.ratio;newSize.h=newSize.h*this.ratio;this.renderer.setSize(newSize)},moveTo:function(bounds,zoomChanged,dragging){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);var coordSysUnchanged=true;if(!dragging){this.renderer.root.style.visibility="hidden";var viewSize=this.map.getSize(),viewWidth=viewSize.w,viewHeight=viewSize.h,offsetLeft=viewWidth/2*this.ratio-viewWidth/2,offsetTop=viewHeight/2*this.ratio-viewHeight/2;offsetLeft+=this.map.layerContainerOriginPx.x;offsetLeft=-Math.round(offsetLeft);offsetTop+=this.map.layerContainerOriginPx.y;offsetTop=-Math.round(offsetTop);this.div.style.left=offsetLeft+"px";this.div.style.top=offsetTop+"px";var extent=this.map.getExtent().scale(this.ratio);coordSysUnchanged=this.renderer.setExtent(extent,zoomChanged);this.renderer.root.style.visibility="visible";if(OpenLayers.IS_GECKO===true){this.div.scrollLeft=this.div.scrollLeft}if(!zoomChanged&&coordSysUnchanged){for(var i in this.unrenderedFeatures){var feature=this.unrenderedFeatures[i];this.drawFeature(feature)}}}if(!this.drawn||zoomChanged||!coordSysUnchanged){this.drawn=true;var feature;for(var i=0,len=this.features.length;i<len;i++){this.renderer.locked=i!==len-1;feature=this.features[i];this.drawFeature(feature)}}},display:function(display){OpenLayers.Layer.prototype.display.apply(this,arguments);var currentDisplay=this.div.style.display;if(currentDisplay!=this.renderer.root.style.display){this.renderer.root.style.display=currentDisplay}},addFeatures:function(features,options){if(!OpenLayers.Util.isArray(features)){features=[features]}var notify=!options||!options.silent;if(notify){var event={features:features};var ret=this.events.triggerEvent("beforefeaturesadded",event);if(ret===false){return}features=event.features}var featuresAdded=[];for(var i=0,len=features.length;i<len;i++){if(i!=features.length-1){this.renderer.locked=true}else{this.renderer.locked=false}var feature=features[i];if(this.geometryType&&!(feature.geometry instanceof this.geometryType)){throw new TypeError("addFeatures: component should be an "+this.geometryType.prototype.CLASS_NAME)}feature.layer=this;if(!feature.style&&this.style){feature.style=OpenLayers.Util.extend({},this.style)}if(notify){if(this.events.triggerEvent("beforefeatureadded",{feature:feature})===false){continue}this.preFeatureInsert(feature)}featuresAdded.push(feature);this.features.push(feature);this.drawFeature(feature);if(notify){this.events.triggerEvent("featureadded",{feature:feature});this.onFeatureInsert(feature)}}if(notify){this.events.triggerEvent("featuresadded",{features:featuresAdded})}},removeFeatures:function(features,options){if(!features||features.length===0){return}if(features===this.features){return this.removeAllFeatures(options)}if(!OpenLayers.Util.isArray(features)){features=[features]}if(features===this.selectedFeatures){features=features.slice()}var notify=!options||!options.silent;if(notify){this.events.triggerEvent("beforefeaturesremoved",{features:features})}for(var i=features.length-1;i>=0;i--){if(i!=0&&features[i-1].geometry){this.renderer.locked=true}else{this.renderer.locked=false}var feature=features[i];delete this.unrenderedFeatures[feature.id];if(notify){this.events.triggerEvent("beforefeatureremoved",{feature:feature})}this.features=OpenLayers.Util.removeItem(this.features,feature);feature.layer=null;if(feature.geometry){this.renderer.eraseFeatures(feature)}if(OpenLayers.Util.indexOf(this.selectedFeatures,feature)!=-1){OpenLayers.Util.removeItem(this.selectedFeatures,feature)}if(notify){this.events.triggerEvent("featureremoved",{feature:feature})}}if(notify){this.events.triggerEvent("featuresremoved",{features:features})}},removeAllFeatures:function(options){var notify=!options||!options.silent;var features=this.features;if(notify){this.events.triggerEvent("beforefeaturesremoved",{features:features})}var feature;for(var i=features.length-1;i>=0;i--){feature=features[i];if(notify){this.events.triggerEvent("beforefeatureremoved",{feature:feature})
}feature.layer=null;if(notify){this.events.triggerEvent("featureremoved",{feature:feature})}}this.renderer.clear();this.features=[];this.unrenderedFeatures={};this.selectedFeatures=[];if(notify){this.events.triggerEvent("featuresremoved",{features:features})}},destroyFeatures:function(features,options){var all=features==undefined;if(all){features=this.features}if(features){this.removeFeatures(features,options);for(var i=features.length-1;i>=0;i--){features[i].destroy()}}},drawFeature:function(feature,style){if(!this.drawn){return}if(typeof style!="object"){if(!style&&feature.state===OpenLayers.State.DELETE){style="delete"}var renderIntent=style||feature.renderIntent;style=feature.style||this.style;if(!style){style=this.styleMap.createSymbolizer(feature,renderIntent)}}var drawn=this.renderer.drawFeature(feature,style);if(drawn===false||drawn===null){this.unrenderedFeatures[feature.id]=feature}else{delete this.unrenderedFeatures[feature.id]}},eraseFeatures:function(features){this.renderer.eraseFeatures(features)},getFeatureFromEvent:function(evt){if(!this.renderer){throw new Error("getFeatureFromEvent called on layer with no "+"renderer. This usually means you destroyed a "+"layer, but not some handler which is associated "+"with it.")}var feature=null;var featureId=this.renderer.getFeatureIdFromEvent(evt);if(featureId){if(typeof featureId==="string"){feature=this.getFeatureById(featureId)}else{feature=featureId}}return feature},getFeatureBy:function(property,value){var feature=null;for(var i=0,len=this.features.length;i<len;++i){if(this.features[i][property]==value){feature=this.features[i];break}}return feature},getFeatureById:function(featureId){return this.getFeatureBy("id",featureId)},getFeatureByFid:function(featureFid){return this.getFeatureBy("fid",featureFid)},getFeaturesByAttribute:function(attrName,attrValue){var i,feature,len=this.features.length,foundFeatures=[];for(i=0;i<len;i++){feature=this.features[i];if(feature&&feature.attributes){if(feature.attributes[attrName]===attrValue){foundFeatures.push(feature)}}}return foundFeatures},onFeatureInsert:function(feature){},preFeatureInsert:function(feature){},getDataExtent:function(){var maxExtent=null;var features=this.features;if(features&&features.length>0){var geometry=null;for(var i=0,len=features.length;i<len;i++){geometry=features[i].geometry;if(geometry){if(maxExtent===null){maxExtent=new OpenLayers.Bounds}maxExtent.extend(geometry.getBounds())}}}return maxExtent},CLASS_NAME:"OpenLayers.Layer.Vector"});OpenLayers.Layer.Vector.RootContainer=OpenLayers.Class(OpenLayers.Layer.Vector,{displayInLayerSwitcher:false,layers:null,display:function(){},getFeatureFromEvent:function(evt){var layers=this.layers;var feature;for(var i=0;i<layers.length;i++){feature=layers[i].getFeatureFromEvent(evt);if(feature){return feature}}},setMap:function(map){OpenLayers.Layer.Vector.prototype.setMap.apply(this,arguments);this.collectRoots();map.events.register("changelayer",this,this.handleChangeLayer)},removeMap:function(map){map.events.unregister("changelayer",this,this.handleChangeLayer);this.resetRoots();OpenLayers.Layer.Vector.prototype.removeMap.apply(this,arguments)},collectRoots:function(){var layer;for(var i=0;i<this.map.layers.length;++i){layer=this.map.layers[i];if(OpenLayers.Util.indexOf(this.layers,layer)!=-1){layer.renderer.moveRoot(this.renderer)}}},resetRoots:function(){var layer;for(var i=0;i<this.layers.length;++i){layer=this.layers[i];if(this.renderer&&layer.renderer.getRenderLayerId()==this.id){this.renderer.moveRoot(layer.renderer)}}},handleChangeLayer:function(evt){var layer=evt.layer;if(evt.property=="order"&&OpenLayers.Util.indexOf(this.layers,layer)!=-1){this.resetRoots();this.collectRoots()}},CLASS_NAME:"OpenLayers.Layer.Vector.RootContainer"});OpenLayers.Control.SelectFeature=OpenLayers.Class(OpenLayers.Control,{multipleKey:null,toggleKey:null,multiple:false,clickout:true,toggle:false,hover:false,highlightOnly:false,box:false,onBeforeSelect:function(){},onSelect:function(){},onUnselect:function(){},scope:null,geometryTypes:null,layer:null,layers:null,callbacks:null,selectStyle:null,renderIntent:"select",handlers:null,initialize:function(layers,options){OpenLayers.Control.prototype.initialize.apply(this,[options]);if(this.scope===null){this.scope=this}this.initLayer(layers);var callbacks={click:this.clickFeature,clickout:this.clickoutFeature};if(this.hover){callbacks.over=this.overFeature;callbacks.out=this.outFeature}this.callbacks=OpenLayers.Util.extend(callbacks,this.callbacks);this.handlers={feature:new OpenLayers.Handler.Feature(this,this.layer,this.callbacks,{geometryTypes:this.geometryTypes})};if(this.box){this.handlers.box=new OpenLayers.Handler.Box(this,{done:this.selectBox},{boxDivClassName:"olHandlerBoxSelectFeature"})}},initLayer:function(layers){if(OpenLayers.Util.isArray(layers)){this.layers=layers;this.layer=new OpenLayers.Layer.Vector.RootContainer(this.id+"_container",{layers:layers})}else{this.layer=layers}},destroy:function(){if(this.active&&this.layers){this.map.removeLayer(this.layer)}OpenLayers.Control.prototype.destroy.apply(this,arguments);if(this.layers){this.layer.destroy()}},activate:function(){if(!this.active){if(this.layers){this.map.addLayer(this.layer)}this.handlers.feature.activate();if(this.box&&this.handlers.box){this.handlers.box.activate()}}return OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){if(this.active){this.handlers.feature.deactivate();if(this.handlers.box){this.handlers.box.deactivate()}if(this.layers){this.map.removeLayer(this.layer)}}return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},unselectAll:function(options){var layers=this.layers||[this.layer],layer,feature,l,numExcept;for(l=0;l<layers.length;++l){layer=layers[l];numExcept=0;if(layer.selectedFeatures!=null){while(layer.selectedFeatures.length>numExcept){feature=layer.selectedFeatures[numExcept];if(!options||options.except!=feature){this.unselect(feature)}else{++numExcept}}}}},clickFeature:function(feature){if(!this.hover){var selected=OpenLayers.Util.indexOf(feature.layer.selectedFeatures,feature)>-1;if(selected){if(this.toggleSelect()){this.unselect(feature)}else if(!this.multipleSelect()){this.unselectAll({except:feature})}}else{if(!this.multipleSelect()){this.unselectAll({except:feature})}this.select(feature)}}},multipleSelect:function(){return this.multiple||this.handlers.feature.evt&&this.handlers.feature.evt[this.multipleKey]},toggleSelect:function(){return this.toggle||this.handlers.feature.evt&&this.handlers.feature.evt[this.toggleKey]},clickoutFeature:function(feature){if(!this.hover&&this.clickout){this.unselectAll()}},overFeature:function(feature){var layer=feature.layer;if(this.hover){if(this.highlightOnly){this.highlight(feature)}else if(OpenLayers.Util.indexOf(layer.selectedFeatures,feature)==-1){this.select(feature)}}},outFeature:function(feature){if(this.hover){if(this.highlightOnly){if(feature._lastHighlighter==this.id){if(feature._prevHighlighter&&feature._prevHighlighter!=this.id){delete feature._lastHighlighter;var control=this.map.getControl(feature._prevHighlighter);if(control){control.highlight(feature)}}else{this.unhighlight(feature)}}}else{this.unselect(feature)}}},highlight:function(feature){var layer=feature.layer;var cont=this.events.triggerEvent("beforefeaturehighlighted",{feature:feature});if(cont!==false){feature._prevHighlighter=feature._lastHighlighter;feature._lastHighlighter=this.id;var style=this.selectStyle||this.renderIntent;layer.drawFeature(feature,style);this.events.triggerEvent("featurehighlighted",{feature:feature})}},unhighlight:function(feature){var layer=feature.layer;if(feature._prevHighlighter==undefined){delete feature._lastHighlighter}else if(feature._prevHighlighter==this.id){delete feature._prevHighlighter}else{feature._lastHighlighter=feature._prevHighlighter;delete feature._prevHighlighter}layer.drawFeature(feature,feature.style||feature.layer.style||"default");this.events.triggerEvent("featureunhighlighted",{feature:feature})},select:function(feature){var cont=this.onBeforeSelect.call(this.scope,feature);var layer=feature.layer;if(cont!==false){cont=layer.events.triggerEvent("beforefeatureselected",{feature:feature});if(cont!==false){layer.selectedFeatures.push(feature);this.highlight(feature);if(!this.handlers.feature.lastFeature){this.handlers.feature.lastFeature=layer.selectedFeatures[0]}layer.events.triggerEvent("featureselected",{feature:feature});this.onSelect.call(this.scope,feature)}}},unselect:function(feature){var layer=feature.layer;this.unhighlight(feature);OpenLayers.Util.removeItem(layer.selectedFeatures,feature);layer.events.triggerEvent("featureunselected",{feature:feature});this.onUnselect.call(this.scope,feature)},selectBox:function(position){if(position instanceof OpenLayers.Bounds){var minXY=this.map.getLonLatFromPixel({x:position.left,y:position.bottom});var maxXY=this.map.getLonLatFromPixel({x:position.right,y:position.top});var bounds=new OpenLayers.Bounds(minXY.lon,minXY.lat,maxXY.lon,maxXY.lat);if(!this.multipleSelect()){this.unselectAll()}var prevMultiple=this.multiple;this.multiple=true;var layers=this.layers||[this.layer];this.events.triggerEvent("boxselectionstart",{layers:layers});var layer;for(var l=0;l<layers.length;++l){layer=layers[l];for(var i=0,len=layer.features.length;i<len;++i){var feature=layer.features[i];if(!feature.getVisibility()){continue}if(this.geometryTypes==null||OpenLayers.Util.indexOf(this.geometryTypes,feature.geometry.CLASS_NAME)>-1){if(bounds.toGeometry().intersects(feature.geometry)){if(OpenLayers.Util.indexOf(layer.selectedFeatures,feature)==-1){this.select(feature)}}}}}this.multiple=prevMultiple;this.events.triggerEvent("boxselectionend",{layers:layers})}},setMap:function(map){this.handlers.feature.setMap(map);if(this.box){this.handlers.box.setMap(map)}OpenLayers.Control.prototype.setMap.apply(this,arguments)},setLayer:function(layers){var isActive=this.active;this.unselectAll();this.deactivate();if(this.layers){this.layer.destroy();this.layers=null}this.initLayer(layers);this.handlers.feature.layer=this.layer;if(isActive){this.activate()}},CLASS_NAME:"OpenLayers.Control.SelectFeature"});OpenLayers.Handler.Point=OpenLayers.Class(OpenLayers.Handler,{point:null,layer:null,multi:false,citeCompliant:false,mouseDown:false,stoppedDown:null,lastDown:null,lastUp:null,persist:false,stopDown:false,stopUp:false,layerOptions:null,pixelTolerance:5,lastTouchPx:null,initialize:function(control,callbacks,options){if(!(options&&options.layerOptions&&options.layerOptions.styleMap)){this.style=OpenLayers.Util.extend(OpenLayers.Feature.Vector.style["default"],{})}OpenLayers.Handler.prototype.initialize.apply(this,arguments)},activate:function(){if(!OpenLayers.Handler.prototype.activate.apply(this,arguments)){return false}var options=OpenLayers.Util.extend({displayInLayerSwitcher:false,calculateInRange:OpenLayers.Function.True,wrapDateLine:this.citeCompliant},this.layerOptions);this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,options);this.map.addLayer(this.layer);return true},createFeature:function(pixel){var lonlat=this.layer.getLonLatFromViewPortPx(pixel);var geometry=new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat);this.point=new OpenLayers.Feature.Vector(geometry);this.callback("create",[this.point.geometry,this.point]);this.point.geometry.clearBounds();this.layer.addFeatures([this.point],{silent:true})},deactivate:function(){if(!OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){return false}this.cancel();if(this.layer.map!=null){this.destroyFeature(true);this.layer.destroy(false)}this.layer=null;return true},destroyFeature:function(force){if(this.layer&&(force||!this.persist)){this.layer.destroyFeatures()}this.point=null},destroyPersistedFeature:function(){var layer=this.layer;if(layer&&layer.features.length>1){this.layer.features[0].destroy()}},finalize:function(cancel){var key=cancel?"cancel":"done";this.mouseDown=false;this.lastDown=null;this.lastUp=null;this.lastTouchPx=null;this.callback(key,[this.geometryClone()]);this.destroyFeature(cancel)},cancel:function(){this.finalize(true)},click:function(evt){OpenLayers.Event.stop(evt);return false},dblclick:function(evt){OpenLayers.Event.stop(evt);return false},modifyFeature:function(pixel){if(!this.point){this.createFeature(pixel)}var lonlat=this.layer.getLonLatFromViewPortPx(pixel);this.point.geometry.x=lonlat.lon;this.point.geometry.y=lonlat.lat;this.callback("modify",[this.point.geometry,this.point,false]);this.point.geometry.clearBounds();this.drawFeature()},drawFeature:function(){this.layer.drawFeature(this.point,this.style)},getGeometry:function(){var geometry=this.point&&this.point.geometry;if(geometry&&this.multi){geometry=new OpenLayers.Geometry.MultiPoint([geometry])}return geometry},geometryClone:function(){var geom=this.getGeometry();return geom&&geom.clone()},mousedown:function(evt){return this.down(evt)},touchstart:function(evt){this.startTouch();this.lastTouchPx=evt.xy;return this.down(evt)},mousemove:function(evt){return this.move(evt)},touchmove:function(evt){this.lastTouchPx=evt.xy;return this.move(evt)},mouseup:function(evt){return this.up(evt)},touchend:function(evt){evt.xy=this.lastTouchPx;return this.up(evt)},down:function(evt){this.mouseDown=true;this.lastDown=evt.xy;if(!this.touch){this.modifyFeature(evt.xy)}this.stoppedDown=this.stopDown;return!this.stopDown},move:function(evt){if(!this.touch&&(!this.mouseDown||this.stoppedDown)){this.modifyFeature(evt.xy)}return true},up:function(evt){this.mouseDown=false;this.stoppedDown=this.stopDown;if(!this.checkModifiers(evt)){return true}if(this.lastUp&&this.lastUp.equals(evt.xy)){return true}if(this.lastDown&&this.passesTolerance(this.lastDown,evt.xy,this.pixelTolerance)){if(this.touch){this.modifyFeature(evt.xy)}if(this.persist){this.destroyPersistedFeature()}this.lastUp=evt.xy;this.finalize();return!this.stopUp}else{return true}},mouseout:function(evt){if(OpenLayers.Util.mouseLeft(evt,this.map.viewPortDiv)){this.stoppedDown=this.stopDown;this.mouseDown=false}},passesTolerance:function(pixel1,pixel2,tolerance){var passes=true;if(tolerance!=null&&pixel1&&pixel2){var dist=pixel1.distanceTo(pixel2);if(dist>tolerance){passes=false}}return passes},CLASS_NAME:"OpenLayers.Handler.Point"});OpenLayers.Handler.Path=OpenLayers.Class(OpenLayers.Handler.Point,{line:null,maxVertices:null,doubleTouchTolerance:20,freehand:false,freehandToggle:"shiftKey",timerId:null,redoStack:null,createFeature:function(pixel){var lonlat=this.layer.getLonLatFromViewPortPx(pixel);var geometry=new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat);this.point=new OpenLayers.Feature.Vector(geometry);this.line=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString([this.point.geometry]));this.callback("create",[this.point.geometry,this.getSketch()]);this.point.geometry.clearBounds();this.layer.addFeatures([this.line,this.point],{silent:true})},destroyFeature:function(force){OpenLayers.Handler.Point.prototype.destroyFeature.call(this,force);this.line=null},destroyPersistedFeature:function(){var layer=this.layer;if(layer&&layer.features.length>2){this.layer.features[0].destroy()}},removePoint:function(){if(this.point){this.layer.removeFeatures([this.point])}},addPoint:function(pixel){this.layer.removeFeatures([this.point]);var lonlat=this.layer.getLonLatFromViewPortPx(pixel);this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat));this.line.geometry.addComponent(this.point.geometry,this.line.geometry.components.length);this.layer.addFeatures([this.point]);this.callback("point",[this.point.geometry,this.getGeometry()]);this.callback("modify",[this.point.geometry,this.getSketch()]);this.drawFeature();delete this.redoStack},insertXY:function(x,y){this.line.geometry.addComponent(new OpenLayers.Geometry.Point(x,y),this.getCurrentPointIndex());this.drawFeature();delete this.redoStack},insertDeltaXY:function(dx,dy){var previousIndex=this.getCurrentPointIndex()-1;var p0=this.line.geometry.components[previousIndex];if(p0&&!isNaN(p0.x)&&!isNaN(p0.y)){this.insertXY(p0.x+dx,p0.y+dy)}},insertDirectionLength:function(direction,length){direction*=Math.PI/180;var dx=length*Math.cos(direction);var dy=length*Math.sin(direction);this.insertDeltaXY(dx,dy)},insertDeflectionLength:function(deflection,length){var previousIndex=this.getCurrentPointIndex()-1;if(previousIndex>0){var p1=this.line.geometry.components[previousIndex];var p0=this.line.geometry.components[previousIndex-1];var theta=Math.atan2(p1.y-p0.y,p1.x-p0.x);this.insertDirectionLength(theta*180/Math.PI+deflection,length)}},getCurrentPointIndex:function(){return this.line.geometry.components.length-1},undo:function(){var geometry=this.line.geometry;var components=geometry.components;var index=this.getCurrentPointIndex()-1;var target=components[index];var undone=geometry.removeComponent(target);if(undone){if(this.touch&&index>0){components=geometry.components;var lastpt=components[index-1];var curptidx=this.getCurrentPointIndex();var curpt=components[curptidx];curpt.x=lastpt.x;curpt.y=lastpt.y}if(!this.redoStack){this.redoStack=[]}this.redoStack.push(target);this.drawFeature()}return undone},redo:function(){var target=this.redoStack&&this.redoStack.pop();if(target){this.line.geometry.addComponent(target,this.getCurrentPointIndex());this.drawFeature()}return!!target},freehandMode:function(evt){return this.freehandToggle&&evt[this.freehandToggle]?!this.freehand:this.freehand},modifyFeature:function(pixel,drawing){if(!this.line){this.createFeature(pixel)}var lonlat=this.layer.getLonLatFromViewPortPx(pixel);this.point.geometry.x=lonlat.lon;this.point.geometry.y=lonlat.lat;this.callback("modify",[this.point.geometry,this.getSketch(),drawing]);this.point.geometry.clearBounds();this.drawFeature()},drawFeature:function(){this.layer.drawFeature(this.line,this.style);this.layer.drawFeature(this.point,this.style)},getSketch:function(){return this.line},getGeometry:function(){var geometry=this.line&&this.line.geometry;if(geometry&&this.multi){geometry=new OpenLayers.Geometry.MultiLineString([geometry])}return geometry},touchstart:function(evt){if(this.timerId&&this.passesTolerance(this.lastTouchPx,evt.xy,this.doubleTouchTolerance)){this.finishGeometry();window.clearTimeout(this.timerId);this.timerId=null;return false}else{if(this.timerId){window.clearTimeout(this.timerId);this.timerId=null}this.timerId=window.setTimeout(OpenLayers.Function.bind(function(){this.timerId=null},this),300);return OpenLayers.Handler.Point.prototype.touchstart.call(this,evt)}},down:function(evt){var stopDown=this.stopDown;if(this.freehandMode(evt)){stopDown=true;if(this.touch){this.modifyFeature(evt.xy,!!this.lastUp);OpenLayers.Event.stop(evt)}}if(!this.touch&&(!this.lastDown||!this.passesTolerance(this.lastDown,evt.xy,this.pixelTolerance))){this.modifyFeature(evt.xy,!!this.lastUp)}this.mouseDown=true;this.lastDown=evt.xy;this.stoppedDown=stopDown;return!stopDown},move:function(evt){if(this.stoppedDown&&this.freehandMode(evt)){if(this.persist){this.destroyPersistedFeature()}if(this.maxVertices&&this.line&&this.line.geometry.components.length===this.maxVertices){this.removePoint();this.finalize()}else{this.addPoint(evt.xy)}return false}if(!this.touch&&(!this.mouseDown||this.stoppedDown)){this.modifyFeature(evt.xy,!!this.lastUp)}return true},up:function(evt){if(this.mouseDown&&(!this.lastUp||!this.lastUp.equals(evt.xy))){if(this.stoppedDown&&this.freehandMode(evt)){if(this.persist){this.destroyPersistedFeature()}this.removePoint();this.finalize()}else{if(this.passesTolerance(this.lastDown,evt.xy,this.pixelTolerance)){if(this.touch){this.modifyFeature(evt.xy)}if(this.lastUp==null&&this.persist){this.destroyPersistedFeature()}this.addPoint(evt.xy);this.lastUp=evt.xy;if(this.line.geometry.components.length===this.maxVertices+1){this.finishGeometry()}}}}this.stoppedDown=this.stopDown;this.mouseDown=false;return!this.stopUp},finishGeometry:function(){var index=this.line.geometry.components.length-1;this.line.geometry.removeComponent(this.line.geometry.components[index]);this.removePoint();this.finalize()},dblclick:function(evt){if(!this.freehandMode(evt)){this.finishGeometry()}return false},CLASS_NAME:"OpenLayers.Handler.Path"});OpenLayers.Control.Attribution=OpenLayers.Class(OpenLayers.Control,{separator:", ",template:"${layers}",destroy:function(){this.map.events.un({removelayer:this.updateAttribution,addlayer:this.updateAttribution,changelayer:this.updateAttribution,changebaselayer:this.updateAttribution,scope:this});OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.map.events.on({changebaselayer:this.updateAttribution,changelayer:this.updateAttribution,addlayer:this.updateAttribution,removelayer:this.updateAttribution,scope:this});this.updateAttribution();return this.div},updateAttribution:function(){var attributions=[];if(this.map&&this.map.layers){for(var i=0,len=this.map.layers.length;i<len;i++){var layer=this.map.layers[i];if(layer.attribution&&layer.getVisibility()){if(OpenLayers.Util.indexOf(attributions,layer.attribution)===-1){attributions.push(layer.attribution)}}}this.div.innerHTML=OpenLayers.String.format(this.template,{layers:attributions.join(this.separator)})}},CLASS_NAME:"OpenLayers.Control.Attribution"});OpenLayers.Kinetic=OpenLayers.Class({threshold:0,deceleration:.0035,nbPoints:100,delay:200,points:undefined,timerId:undefined,initialize:function(options){OpenLayers.Util.extend(this,options)},begin:function(){OpenLayers.Animation.stop(this.timerId);this.timerId=undefined;this.points=[]},update:function(xy){this.points.unshift({xy:xy,tick:(new Date).getTime()});if(this.points.length>this.nbPoints){this.points.pop()}},end:function(xy){var last,now=(new Date).getTime();for(var i=0,l=this.points.length,point;i<l;i++){point=this.points[i];if(now-point.tick>this.delay){break}last=point}if(!last){return}var time=(new Date).getTime()-last.tick;var dist=Math.sqrt(Math.pow(xy.x-last.xy.x,2)+Math.pow(xy.y-last.xy.y,2));var speed=dist/time;if(speed==0||speed<this.threshold){return}var theta=Math.asin((xy.y-last.xy.y)/dist);if(last.xy.x<=xy.x){theta=Math.PI-theta}return{speed:speed,theta:theta}},move:function(info,callback){var v0=info.speed;var fx=Math.cos(info.theta);var fy=-Math.sin(info.theta);var initialTime=(new Date).getTime();var lastX=0;var lastY=0;var timerCallback=function(){if(this.timerId==null){return}var t=(new Date).getTime()-initialTime;var p=-this.deceleration*Math.pow(t,2)/2+v0*t;var x=p*fx;var y=p*fy;var args={};args.end=false;var v=-this.deceleration*t+v0;if(v<=0){OpenLayers.Animation.stop(this.timerId);this.timerId=null;args.end=true}args.x=x-lastX;args.y=y-lastY;lastX=x;lastY=y;callback(args.x,args.y,args.end)};this.timerId=OpenLayers.Animation.start(OpenLayers.Function.bind(timerCallback,this))},CLASS_NAME:"OpenLayers.Kinetic"});OpenLayers.Layer.WMS=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{service:"WMS",version:"1.1.1",request:"GetMap",styles:"",format:"image/jpeg"},isBaseLayer:true,encodeBBOX:false,noMagic:false,yx:{},initialize:function(name,url,params,options){var newArguments=[];params=OpenLayers.Util.upperCaseObject(params);if(parseFloat(params.VERSION)>=1.3&&!params.EXCEPTIONS){params.EXCEPTIONS="INIMAGE"}newArguments.push(name,url,params,options);OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);OpenLayers.Util.applyDefaults(this.params,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS));if(!this.noMagic&&this.params.TRANSPARENT&&this.params.TRANSPARENT.toString().toLowerCase()=="true"){if(options==null||!options.isBaseLayer){this.isBaseLayer=false}if(this.params.FORMAT=="image/jpeg"){this.params.FORMAT=OpenLayers.Util.alphaHack()?"image/gif":"image/png"}}},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.WMS(this.name,this.url,this.params,this.getOptions())}obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj},reverseAxisOrder:function(){var projCode=this.projection.getCode();return parseFloat(this.params.VERSION)>=1.3&&!!(this.yx[projCode]||OpenLayers.Projection.defaults[projCode]&&OpenLayers.Projection.defaults[projCode].yx)},getURL:function(bounds){bounds=this.adjustBounds(bounds);var imageSize=this.getImageSize();var newParams={};var reverseAxisOrder=this.reverseAxisOrder();newParams.BBOX=this.encodeBBOX?bounds.toBBOX(null,reverseAxisOrder):bounds.toArray(reverseAxisOrder);newParams.WIDTH=imageSize.w;newParams.HEIGHT=imageSize.h;var requestString=this.getFullRequestString(newParams);return requestString},mergeNewParams:function(newParams){var upperParams=OpenLayers.Util.upperCaseObject(newParams);var newArguments=[upperParams];return OpenLayers.Layer.Grid.prototype.mergeNewParams.apply(this,newArguments)},getFullRequestString:function(newParams,altUrl){var mapProjection=this.map.getProjectionObject();var projectionCode=this.projection&&this.projection.equals(mapProjection)?this.projection.getCode():mapProjection.getCode();var value=projectionCode=="none"?null:projectionCode;if(parseFloat(this.params.VERSION)>=1.3){this.params.CRS=value}else{this.params.SRS=value}if(typeof this.params.TRANSPARENT=="boolean"){newParams.TRANSPARENT=this.params.TRANSPARENT?"TRUE":"FALSE"}return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments)},CLASS_NAME:"OpenLayers.Layer.WMS"});OpenLayers.Renderer.SVG=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"http://www.w3.org/2000/svg",xlinkns:"http://www.w3.org/1999/xlink",MAX_PIXEL:15e3,translationParameters:null,symbolMetrics:null,initialize:function(containerID){if(!this.supported()){return}OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments);this.translationParameters={x:0,y:0};this.symbolMetrics={}},supported:function(){var svgFeature="http://www.w3.org/TR/SVG11/feature#";return document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature(svgFeature+"SVG","1.1")||document.implementation.hasFeature(svgFeature+"BasicStructure","1.1"))},inValidRange:function(x,y,xyOnly){var left=x+(xyOnly?0:this.translationParameters.x);var top=y+(xyOnly?0:this.translationParameters.y);return left>=-this.MAX_PIXEL&&left<=this.MAX_PIXEL&&top>=-this.MAX_PIXEL&&top<=this.MAX_PIXEL},setExtent:function(extent,resolutionChanged){var coordSysUnchanged=OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var resolution=this.getResolution(),left=-extent.left/resolution,top=extent.top/resolution;if(resolutionChanged){this.left=left;this.top=top;var extentString="0 0 "+this.size.w+" "+this.size.h;this.rendererRoot.setAttributeNS(null,"viewBox",extentString);this.translate(this.xOffset,0);return true}else{var inRange=this.translate(left-this.left+this.xOffset,top-this.top);if(!inRange){this.setExtent(extent,true)}return coordSysUnchanged&&inRange}},translate:function(x,y){if(!this.inValidRange(x,y,true)){return false}else{var transformString="";if(x||y){transformString="translate("+x+","+y+")"}this.root.setAttributeNS(null,"transform",transformString);this.translationParameters={x:x,y:y};return true}},setSize:function(size){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);this.rendererRoot.setAttributeNS(null,"width",this.size.w);this.rendererRoot.setAttributeNS(null,"height",this.size.h)},getNodeType:function(geometry,style){var nodeType=null;switch(geometry.CLASS_NAME){case"OpenLayers.Geometry.Point":if(style.externalGraphic){nodeType="image"}else if(this.isComplexSymbol(style.graphicName)){nodeType="svg"}else{nodeType="circle"}break;case"OpenLayers.Geometry.Rectangle":nodeType="rect";break;case"OpenLayers.Geometry.LineString":nodeType="polyline";break;case"OpenLayers.Geometry.LinearRing":nodeType="polygon";break;case"OpenLayers.Geometry.Polygon":case"OpenLayers.Geometry.Curve":nodeType="path";break;default:break}return nodeType},setStyle:function(node,style,options){style=style||node._style;options=options||node._options;var title=style.title||style.graphicTitle;if(title){node.setAttributeNS(null,"title",title);var titleNode=node.getElementsByTagName("title");if(titleNode.length>0){titleNode[0].firstChild.textContent=title}else{var label=this.nodeFactory(null,"title");label.textContent=title;node.appendChild(label)}}var r=parseFloat(node.getAttributeNS(null,"r"));var widthFactor=1;var pos;if(node._geometryClass=="OpenLayers.Geometry.Point"&&r){node.style.visibility="";if(style.graphic===false){node.style.visibility="hidden"}else if(style.externalGraphic){pos=this.getPosition(node);if(style.graphicWidth&&style.graphicHeight){node.setAttributeNS(null,"preserveAspectRatio","none")}var width=style.graphicWidth||style.graphicHeight;var height=style.graphicHeight||style.graphicWidth;width=width?width:style.pointRadius*2;height=height?height:style.pointRadius*2;var xOffset=style.graphicXOffset!=undefined?style.graphicXOffset:-(.5*width);var yOffset=style.graphicYOffset!=undefined?style.graphicYOffset:-(.5*height);var opacity=style.graphicOpacity||style.fillOpacity;node.setAttributeNS(null,"x",(pos.x+xOffset).toFixed());node.setAttributeNS(null,"y",(pos.y+yOffset).toFixed());node.setAttributeNS(null,"width",width);node.setAttributeNS(null,"height",height);node.setAttributeNS(this.xlinkns,"xlink:href",style.externalGraphic);node.setAttributeNS(null,"style","opacity: "+opacity);node.onclick=OpenLayers.Event.preventDefault}else if(this.isComplexSymbol(style.graphicName)){var offset=style.pointRadius*3;var size=offset*2;var src=this.importSymbol(style.graphicName);pos=this.getPosition(node);widthFactor=this.symbolMetrics[src.id][0]*3/size;var parent=node.parentNode;var nextSibling=node.nextSibling;if(parent){parent.removeChild(node)}node.firstChild&&node.removeChild(node.firstChild);node.appendChild(src.firstChild.cloneNode(true));node.setAttributeNS(null,"viewBox",src.getAttributeNS(null,"viewBox"));node.setAttributeNS(null,"width",size);node.setAttributeNS(null,"height",size);node.setAttributeNS(null,"x",pos.x-offset);node.setAttributeNS(null,"y",pos.y-offset);if(nextSibling){parent.insertBefore(node,nextSibling)}else if(parent){parent.appendChild(node)}}else{node.setAttributeNS(null,"r",style.pointRadius)}var rotation=style.rotation;if((rotation!==undefined||node._rotation!==undefined)&&pos){node._rotation=rotation;rotation|=0;if(node.nodeName!=="svg"){node.setAttributeNS(null,"transform","rotate("+rotation+" "+pos.x+" "+pos.y+")")}else{var metrics=this.symbolMetrics[src.id];node.firstChild.setAttributeNS(null,"transform","rotate("+rotation+" "+metrics[1]+" "+metrics[2]+")")}}}if(options.isFilled){node.setAttributeNS(null,"fill",style.fillColor);node.setAttributeNS(null,"fill-opacity",style.fillOpacity)}else{node.setAttributeNS(null,"fill","none")}if(options.isStroked){node.setAttributeNS(null,"stroke",style.strokeColor);node.setAttributeNS(null,"stroke-opacity",style.strokeOpacity);node.setAttributeNS(null,"stroke-width",style.strokeWidth*widthFactor);node.setAttributeNS(null,"stroke-linecap",style.strokeLinecap||"round");node.setAttributeNS(null,"stroke-linejoin","round");style.strokeDashstyle&&node.setAttributeNS(null,"stroke-dasharray",this.dashStyle(style,widthFactor))}else{node.setAttributeNS(null,"stroke","none")}if(style.pointerEvents){node.setAttributeNS(null,"pointer-events",style.pointerEvents)}if(style.cursor!=null){node.setAttributeNS(null,"cursor",style.cursor)}return node},dashStyle:function(style,widthFactor){var w=style.strokeWidth*widthFactor;var str=style.strokeDashstyle;switch(str){case"solid":return"none";case"dot":return[1,4*w].join();case"dash":return[4*w,4*w].join();case"dashdot":return[4*w,4*w,1,4*w].join();case"longdash":return[8*w,4*w].join();case"longdashdot":return[8*w,4*w,1,4*w].join();default:return OpenLayers.String.trim(str).replace(/\s+/g,",")}},createNode:function(type,id){var node=document.createElementNS(this.xmlns,type);if(id){node.setAttributeNS(null,"id",id)}return node},nodeTypeCompare:function(node,type){return type==node.nodeName
},createRenderRoot:function(){var svg=this.nodeFactory(this.container.id+"_svgRoot","svg");svg.style.display="block";return svg},createRoot:function(suffix){return this.nodeFactory(this.container.id+suffix,"g")},createDefs:function(){var defs=this.nodeFactory(this.container.id+"_defs","defs");this.rendererRoot.appendChild(defs);return defs},drawPoint:function(node,geometry){return this.drawCircle(node,geometry,1)},drawCircle:function(node,geometry,radius){var resolution=this.getResolution();var x=(geometry.x-this.featureDx)/resolution+this.left;var y=this.top-geometry.y/resolution;if(this.inValidRange(x,y)){node.setAttributeNS(null,"cx",x);node.setAttributeNS(null,"cy",y);node.setAttributeNS(null,"r",radius);return node}else{return false}},drawLineString:function(node,geometry){var componentsResult=this.getComponentsString(geometry.components);if(componentsResult.path){node.setAttributeNS(null,"points",componentsResult.path);return componentsResult.complete?node:null}else{return false}},drawLinearRing:function(node,geometry){var componentsResult=this.getComponentsString(geometry.components);if(componentsResult.path){node.setAttributeNS(null,"points",componentsResult.path);return componentsResult.complete?node:null}else{return false}},drawPolygon:function(node,geometry){var d="";var draw=true;var complete=true;var linearRingResult,path;for(var j=0,len=geometry.components.length;j<len;j++){d+=" M";linearRingResult=this.getComponentsString(geometry.components[j].components," ");path=linearRingResult.path;if(path){d+=" "+path;complete=linearRingResult.complete&&complete}else{draw=false}}d+=" z";if(draw){node.setAttributeNS(null,"d",d);node.setAttributeNS(null,"fill-rule","evenodd");return complete?node:null}else{return false}},drawRectangle:function(node,geometry){var resolution=this.getResolution();var x=(geometry.x-this.featureDx)/resolution+this.left;var y=this.top-geometry.y/resolution;if(this.inValidRange(x,y)){node.setAttributeNS(null,"x",x);node.setAttributeNS(null,"y",y);node.setAttributeNS(null,"width",geometry.width/resolution);node.setAttributeNS(null,"height",geometry.height/resolution);return node}else{return false}},drawText:function(featureId,style,location){var drawOutline=!!style.labelOutlineWidth;if(drawOutline){var outlineStyle=OpenLayers.Util.extend({},style);outlineStyle.fontColor=outlineStyle.labelOutlineColor;outlineStyle.fontStrokeColor=outlineStyle.labelOutlineColor;outlineStyle.fontStrokeWidth=style.labelOutlineWidth;if(style.labelOutlineOpacity){outlineStyle.fontOpacity=style.labelOutlineOpacity}delete outlineStyle.labelOutlineWidth;this.drawText(featureId,outlineStyle,location)}var resolution=this.getResolution();var x=(location.x-this.featureDx)/resolution+this.left;var y=location.y/resolution-this.top;var suffix=drawOutline?this.LABEL_OUTLINE_SUFFIX:this.LABEL_ID_SUFFIX;var label=this.nodeFactory(featureId+suffix,"text");label.setAttributeNS(null,"x",x);label.setAttributeNS(null,"y",-y);if(style.fontColor){label.setAttributeNS(null,"fill",style.fontColor)}if(style.fontStrokeColor){label.setAttributeNS(null,"stroke",style.fontStrokeColor)}if(style.fontStrokeWidth){label.setAttributeNS(null,"stroke-width",style.fontStrokeWidth)}if(style.fontOpacity){label.setAttributeNS(null,"opacity",style.fontOpacity)}if(style.fontFamily){label.setAttributeNS(null,"font-family",style.fontFamily)}if(style.fontSize){label.setAttributeNS(null,"font-size",style.fontSize)}if(style.fontWeight){label.setAttributeNS(null,"font-weight",style.fontWeight)}if(style.fontStyle){label.setAttributeNS(null,"font-style",style.fontStyle)}if(style.labelSelect===true){label.setAttributeNS(null,"pointer-events","visible");label._featureId=featureId}else{label.setAttributeNS(null,"pointer-events","none")}var align=style.labelAlign||OpenLayers.Renderer.defaultSymbolizer.labelAlign;label.setAttributeNS(null,"text-anchor",OpenLayers.Renderer.SVG.LABEL_ALIGN[align[0]]||"middle");if(OpenLayers.IS_GECKO===true){label.setAttributeNS(null,"dominant-baseline",OpenLayers.Renderer.SVG.LABEL_ALIGN[align[1]]||"central")}var labelRows=style.label.split("\n");var numRows=labelRows.length;while(label.childNodes.length>numRows){label.removeChild(label.lastChild)}for(var i=0;i<numRows;i++){var tspan=this.nodeFactory(featureId+suffix+"_tspan_"+i,"tspan");if(style.labelSelect===true){tspan._featureId=featureId;tspan._geometry=location;tspan._geometryClass=location.CLASS_NAME}if(OpenLayers.IS_GECKO===false){tspan.setAttributeNS(null,"baseline-shift",OpenLayers.Renderer.SVG.LABEL_VSHIFT[align[1]]||"-35%")}tspan.setAttribute("x",x);if(i==0){var vfactor=OpenLayers.Renderer.SVG.LABEL_VFACTOR[align[1]];if(vfactor==null){vfactor=-.5}tspan.setAttribute("dy",vfactor*(numRows-1)+"em")}else{tspan.setAttribute("dy","1em")}tspan.textContent=labelRows[i]===""?" ":labelRows[i];if(!tspan.parentNode){label.appendChild(tspan)}}if(!label.parentNode){this.textRoot.appendChild(label)}},getComponentsString:function(components,separator){var renderCmp=[];var complete=true;var len=components.length;var strings=[];var str,component;for(var i=0;i<len;i++){component=components[i];renderCmp.push(component);str=this.getShortString(component);if(str){strings.push(str)}else{if(i>0){if(this.getShortString(components[i-1])){strings.push(this.clipLine(components[i],components[i-1]))}}if(i<len-1){if(this.getShortString(components[i+1])){strings.push(this.clipLine(components[i],components[i+1]))}}complete=false}}return{path:strings.join(separator||","),complete:complete}},clipLine:function(badComponent,goodComponent){if(goodComponent.equals(badComponent)){return""}var resolution=this.getResolution();var maxX=this.MAX_PIXEL-this.translationParameters.x;var maxY=this.MAX_PIXEL-this.translationParameters.y;var x1=(goodComponent.x-this.featureDx)/resolution+this.left;var y1=this.top-goodComponent.y/resolution;var x2=(badComponent.x-this.featureDx)/resolution+this.left;var y2=this.top-badComponent.y/resolution;var k;if(x2<-maxX||x2>maxX){k=(y2-y1)/(x2-x1);x2=x2<0?-maxX:maxX;y2=y1+(x2-x1)*k}if(y2<-maxY||y2>maxY){k=(x2-x1)/(y2-y1);y2=y2<0?-maxY:maxY;x2=x1+(y2-y1)*k}return x2+","+y2},getShortString:function(point){var resolution=this.getResolution();var x=(point.x-this.featureDx)/resolution+this.left;var y=this.top-point.y/resolution;if(this.inValidRange(x,y)){return x+","+y}else{return false}},getPosition:function(node){return{x:parseFloat(node.getAttributeNS(null,"cx")),y:parseFloat(node.getAttributeNS(null,"cy"))}},importSymbol:function(graphicName){if(!this.defs){this.defs=this.createDefs()}var id=this.container.id+"-"+graphicName;var existing=document.getElementById(id);if(existing!=null){return existing}var symbol=OpenLayers.Renderer.symbol[graphicName];if(!symbol){throw new Error(graphicName+" is not a valid symbol name")}var symbolNode=this.nodeFactory(id,"symbol");var node=this.nodeFactory(null,"polygon");symbolNode.appendChild(node);var symbolExtent=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0);var points=[];var x,y;for(var i=0;i<symbol.length;i=i+2){x=symbol[i];y=symbol[i+1];symbolExtent.left=Math.min(symbolExtent.left,x);symbolExtent.bottom=Math.min(symbolExtent.bottom,y);symbolExtent.right=Math.max(symbolExtent.right,x);symbolExtent.top=Math.max(symbolExtent.top,y);points.push(x,",",y)}node.setAttributeNS(null,"points",points.join(" "));var width=symbolExtent.getWidth();var height=symbolExtent.getHeight();var viewBox=[symbolExtent.left-width,symbolExtent.bottom-height,width*3,height*3];symbolNode.setAttributeNS(null,"viewBox",viewBox.join(" "));this.symbolMetrics[id]=[Math.max(width,height),symbolExtent.getCenterLonLat().lon,symbolExtent.getCenterLonLat().lat];this.defs.appendChild(symbolNode);return symbolNode},getFeatureIdFromEvent:function(evt){var featureId=OpenLayers.Renderer.Elements.prototype.getFeatureIdFromEvent.apply(this,arguments);if(!featureId){var target=evt.target;featureId=target.parentNode&&target!=this.rendererRoot?target.parentNode._featureId:undefined}return featureId},CLASS_NAME:"OpenLayers.Renderer.SVG"});OpenLayers.Renderer.SVG.LABEL_ALIGN={l:"start",r:"end",b:"bottom",t:"hanging"};OpenLayers.Renderer.SVG.LABEL_VSHIFT={t:"-70%",b:"0"};OpenLayers.Renderer.SVG.LABEL_VFACTOR={t:0,b:-1};OpenLayers.Renderer.SVG.preventDefault=function(e){OpenLayers.Event.preventDefault(e)};OpenLayers.Format.JSON=OpenLayers.Class(OpenLayers.Format,{indent:"    ",space:" ",newline:"\n",level:0,pretty:false,nativeJSON:function(){return!!(window.JSON&&typeof JSON.parse=="function"&&typeof JSON.stringify=="function")}(),read:function(json,filter){var object;if(this.nativeJSON){object=JSON.parse(json,filter)}else try{if(/^[\],:{}\s]*$/.test(json.replace(/\\["\\\/bfnrtu]/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){object=eval("("+json+")");if(typeof filter==="function"){function walk(k,v){if(v&&typeof v==="object"){for(var i in v){if(v.hasOwnProperty(i)){v[i]=walk(i,v[i])}}}return filter(k,v)}object=walk("",object)}}}catch(e){}if(this.keepData){this.data=object}return object},write:function(value,pretty){this.pretty=!!pretty;var json=null;var type=typeof value;if(this.serialize[type]){try{json=!this.pretty&&this.nativeJSON?JSON.stringify(value):this.serialize[type].apply(this,[value])}catch(err){OpenLayers.Console.error("Trouble serializing: "+err)}}return json},writeIndent:function(){var pieces=[];if(this.pretty){for(var i=0;i<this.level;++i){pieces.push(this.indent)}}return pieces.join("")},writeNewline:function(){return this.pretty?this.newline:""},writeSpace:function(){return this.pretty?this.space:""},serialize:{object:function(object){if(object==null){return"null"}if(object.constructor==Date){return this.serialize.date.apply(this,[object])}if(object.constructor==Array){return this.serialize.array.apply(this,[object])}var pieces=["{"];this.level+=1;var key,keyJSON,valueJSON;var addComma=false;for(key in object){if(object.hasOwnProperty(key)){keyJSON=OpenLayers.Format.JSON.prototype.write.apply(this,[key,this.pretty]);valueJSON=OpenLayers.Format.JSON.prototype.write.apply(this,[object[key],this.pretty]);if(keyJSON!=null&&valueJSON!=null){if(addComma){pieces.push(",")}pieces.push(this.writeNewline(),this.writeIndent(),keyJSON,":",this.writeSpace(),valueJSON);addComma=true}}}this.level-=1;pieces.push(this.writeNewline(),this.writeIndent(),"}");return pieces.join("")},array:function(array){var json;var pieces=["["];this.level+=1;for(var i=0,len=array.length;i<len;++i){json=OpenLayers.Format.JSON.prototype.write.apply(this,[array[i],this.pretty]);if(json!=null){if(i>0){pieces.push(",")}pieces.push(this.writeNewline(),this.writeIndent(),json)}}this.level-=1;pieces.push(this.writeNewline(),this.writeIndent(),"]");return pieces.join("")},string:function(string){var m={"\b":"\\b","	":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};if(/["\\\x00-\x1f]/.test(string)){return'"'+string.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=m[b];if(c){return c}c=b.charCodeAt();return"\\u00"+Math.floor(c/16).toString(16)+(c%16).toString(16)})+'"'}return'"'+string+'"'},number:function(number){return isFinite(number)?String(number):"null"},"boolean":function(bool){return String(bool)},date:function(date){function format(number){return number<10?"0"+number:number}return'"'+date.getFullYear()+"-"+format(date.getMonth()+1)+"-"+format(date.getDate())+"T"+format(date.getHours())+":"+format(date.getMinutes())+":"+format(date.getSeconds())+'"'}},CLASS_NAME:"OpenLayers.Format.JSON"});OpenLayers.Format.GeoJSON=OpenLayers.Class(OpenLayers.Format.JSON,{ignoreExtraDims:false,read:function(json,type,filter){type=type?type:"FeatureCollection";var results=null;var obj=null;if(typeof json=="string"){obj=OpenLayers.Format.JSON.prototype.read.apply(this,[json,filter])}else{obj=json}if(!obj){OpenLayers.Console.error("Bad JSON: "+json)}else if(typeof obj.type!="string"){OpenLayers.Console.error("Bad GeoJSON - no type: "+json)}else if(this.isValidType(obj,type)){switch(type){case"Geometry":try{results=this.parseGeometry(obj)}catch(err){OpenLayers.Console.error(err)}break;case"Feature":try{results=this.parseFeature(obj);results.type="Feature"}catch(err){OpenLayers.Console.error(err)}break;case"FeatureCollection":results=[];switch(obj.type){case"Feature":try{results.push(this.parseFeature(obj))}catch(err){results=null;OpenLayers.Console.error(err)}break;case"FeatureCollection":for(var i=0,len=obj.features.length;i<len;++i){try{results.push(this.parseFeature(obj.features[i]))}catch(err){results=null;OpenLayers.Console.error(err)}}break;default:try{var geom=this.parseGeometry(obj);results.push(new OpenLayers.Feature.Vector(geom))}catch(err){results=null;OpenLayers.Console.error(err)}}break}}return results},isValidType:function(obj,type){var valid=false;switch(type){case"Geometry":if(OpenLayers.Util.indexOf(["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon","Box","GeometryCollection"],obj.type)==-1){OpenLayers.Console.error("Unsupported geometry type: "+obj.type)}else{valid=true}break;case"FeatureCollection":valid=true;break;default:if(obj.type==type){valid=true}else{OpenLayers.Console.error("Cannot convert types from "+obj.type+" to "+type)}}return valid},parseFeature:function(obj){var feature,geometry,attributes,bbox;attributes=obj.properties?obj.properties:{};bbox=obj.geometry&&obj.geometry.bbox||obj.bbox;try{geometry=this.parseGeometry(obj.geometry)}catch(err){throw err}feature=new OpenLayers.Feature.Vector(geometry,attributes);if(bbox){feature.bounds=OpenLayers.Bounds.fromArray(bbox)}if(obj.id){feature.fid=obj.id}return feature},parseGeometry:function(obj){if(obj==null){return null}var geometry,collection=false;if(obj.type=="GeometryCollection"){if(!OpenLayers.Util.isArray(obj.geometries)){throw"GeometryCollection must have geometries array: "+obj}var numGeom=obj.geometries.length;var components=new Array(numGeom);for(var i=0;i<numGeom;++i){components[i]=this.parseGeometry.apply(this,[obj.geometries[i]])}geometry=new OpenLayers.Geometry.Collection(components);collection=true}else{if(!OpenLayers.Util.isArray(obj.coordinates)){throw"Geometry must have coordinates array: "+obj}if(!this.parseCoords[obj.type.toLowerCase()]){throw"Unsupported geometry type: "+obj.type}try{geometry=this.parseCoords[obj.type.toLowerCase()].apply(this,[obj.coordinates])}catch(err){throw err}}if(this.internalProjection&&this.externalProjection&&!collection){geometry.transform(this.externalProjection,this.internalProjection)}return geometry},parseCoords:{point:function(array){if(this.ignoreExtraDims==false&&array.length!=2){throw"Only 2D points are supported: "+array}return new OpenLayers.Geometry.Point(array[0],array[1])},multipoint:function(array){var points=[];var p=null;for(var i=0,len=array.length;i<len;++i){try{p=this.parseCoords["point"].apply(this,[array[i]])}catch(err){throw err}points.push(p)}return new OpenLayers.Geometry.MultiPoint(points)},linestring:function(array){var points=[];var p=null;for(var i=0,len=array.length;i<len;++i){try{p=this.parseCoords["point"].apply(this,[array[i]])}catch(err){throw err}points.push(p)}return new OpenLayers.Geometry.LineString(points)},multilinestring:function(array){var lines=[];var l=null;for(var i=0,len=array.length;i<len;++i){try{l=this.parseCoords["linestring"].apply(this,[array[i]])}catch(err){throw err}lines.push(l)}return new OpenLayers.Geometry.MultiLineString(lines)},polygon:function(array){var rings=[];var r,l;for(var i=0,len=array.length;i<len;++i){try{l=this.parseCoords["linestring"].apply(this,[array[i]])}catch(err){throw err}r=new OpenLayers.Geometry.LinearRing(l.components);rings.push(r)}return new OpenLayers.Geometry.Polygon(rings)},multipolygon:function(array){var polys=[];var p=null;for(var i=0,len=array.length;i<len;++i){try{p=this.parseCoords["polygon"].apply(this,[array[i]])}catch(err){throw err}polys.push(p)}return new OpenLayers.Geometry.MultiPolygon(polys)},box:function(array){if(array.length!=2){throw"GeoJSON box coordinates must have 2 elements"}return new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(array[0][0],array[0][1]),new OpenLayers.Geometry.Point(array[1][0],array[0][1]),new OpenLayers.Geometry.Point(array[1][0],array[1][1]),new OpenLayers.Geometry.Point(array[0][0],array[1][1]),new OpenLayers.Geometry.Point(array[0][0],array[0][1])])])}},write:function(obj,pretty){var geojson={type:null};if(OpenLayers.Util.isArray(obj)){geojson.type="FeatureCollection";var numFeatures=obj.length;geojson.features=new Array(numFeatures);for(var i=0;i<numFeatures;++i){var element=obj[i];if(!element instanceof OpenLayers.Feature.Vector){var msg="FeatureCollection only supports collections "+"of features: "+element;throw msg}geojson.features[i]=this.extract.feature.apply(this,[element])}}else if(obj.CLASS_NAME.indexOf("OpenLayers.Geometry")==0){geojson=this.extract.geometry.apply(this,[obj])}else if(obj instanceof OpenLayers.Feature.Vector){geojson=this.extract.feature.apply(this,[obj]);if(obj.layer&&obj.layer.projection){geojson.crs=this.createCRSObject(obj)}}return OpenLayers.Format.JSON.prototype.write.apply(this,[geojson,pretty])},createCRSObject:function(object){var proj=object.layer.projection.toString();var crs={};if(proj.match(/epsg:/i)){var code=parseInt(proj.substring(proj.indexOf(":")+1));if(code==4326){crs={type:"name",properties:{name:"urn:ogc:def:crs:OGC:1.3:CRS84"}}}else{crs={type:"name",properties:{name:"EPSG:"+code}}}}return crs},extract:{feature:function(feature){var geom=this.extract.geometry.apply(this,[feature.geometry]);var json={type:"Feature",properties:feature.attributes,geometry:geom};if(feature.fid!=null){json.id=feature.fid}return json},geometry:function(geometry){if(geometry==null){return null}if(this.internalProjection&&this.externalProjection){geometry=geometry.clone();geometry.transform(this.internalProjection,this.externalProjection)}var geometryType=geometry.CLASS_NAME.split(".")[2];var data=this.extract[geometryType.toLowerCase()].apply(this,[geometry]);var json;if(geometryType=="Collection"){json={type:"GeometryCollection",geometries:data}}else{json={type:geometryType,coordinates:data}}return json},point:function(point){return[point.x,point.y]},multipoint:function(multipoint){var array=[];for(var i=0,len=multipoint.components.length;i<len;++i){array.push(this.extract.point.apply(this,[multipoint.components[i]]))}return array},linestring:function(linestring){var array=[];for(var i=0,len=linestring.components.length;i<len;++i){array.push(this.extract.point.apply(this,[linestring.components[i]]))}return array},multilinestring:function(multilinestring){var array=[];for(var i=0,len=multilinestring.components.length;i<len;++i){array.push(this.extract.linestring.apply(this,[multilinestring.components[i]]))}return array},polygon:function(polygon){var array=[];for(var i=0,len=polygon.components.length;i<len;++i){array.push(this.extract.linestring.apply(this,[polygon.components[i]]))}return array},multipolygon:function(multipolygon){var array=[];for(var i=0,len=multipolygon.components.length;i<len;++i){array.push(this.extract.polygon.apply(this,[multipolygon.components[i]]))}return array},collection:function(collection){var len=collection.components.length;var array=new Array(len);for(var i=0;i<len;++i){array[i]=this.extract.geometry.apply(this,[collection.components[i]])}return array}},CLASS_NAME:"OpenLayers.Format.GeoJSON"});OpenLayers.Control.DrawFeature=OpenLayers.Class(OpenLayers.Control,{layer:null,callbacks:null,multi:false,featureAdded:function(){},initialize:function(layer,handler,options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.callbacks=OpenLayers.Util.extend({done:this.drawFeature,modify:function(vertex,feature){this.layer.events.triggerEvent("sketchmodified",{vertex:vertex,feature:feature})},create:function(vertex,feature){this.layer.events.triggerEvent("sketchstarted",{vertex:vertex,feature:feature})}},this.callbacks);this.layer=layer;this.handlerOptions=this.handlerOptions||{};this.handlerOptions.layerOptions=OpenLayers.Util.applyDefaults(this.handlerOptions.layerOptions,{renderers:layer.renderers,rendererOptions:layer.rendererOptions});if(!("multi"in this.handlerOptions)){this.handlerOptions.multi=this.multi}var sketchStyle=this.layer.styleMap&&this.layer.styleMap.styles.temporary;if(sketchStyle){this.handlerOptions.layerOptions=OpenLayers.Util.applyDefaults(this.handlerOptions.layerOptions,{styleMap:new OpenLayers.StyleMap({"default":sketchStyle})})}this.handler=new handler(this,this.callbacks,this.handlerOptions)},drawFeature:function(geometry){var feature=new OpenLayers.Feature.Vector(geometry);var proceed=this.layer.events.triggerEvent("sketchcomplete",{feature:feature});if(proceed!==false){feature.state=OpenLayers.State.INSERT;this.layer.addFeatures([feature]);this.featureAdded(feature);this.events.triggerEvent("featureadded",{feature:feature})}},insertXY:function(x,y){if(this.handler&&this.handler.line){this.handler.insertXY(x,y)}},insertDeltaXY:function(dx,dy){if(this.handler&&this.handler.line){this.handler.insertDeltaXY(dx,dy)}},insertDirectionLength:function(direction,length){if(this.handler&&this.handler.line){this.handler.insertDirectionLength(direction,length)}},insertDeflectionLength:function(deflection,length){if(this.handler&&this.handler.line){this.handler.insertDeflectionLength(deflection,length)}},undo:function(){return this.handler.undo&&this.handler.undo()},redo:function(){return this.handler.redo&&this.handler.redo()},finishSketch:function(){this.handler.finishGeometry()},cancel:function(){this.handler.cancel()},CLASS_NAME:"OpenLayers.Control.DrawFeature"});OpenLayers.Handler.Pinch=OpenLayers.Class(OpenLayers.Handler,{started:false,stopDown:false,pinching:false,last:null,start:null,touchstart:function(evt){var propagate=true;this.pinching=false;if(OpenLayers.Event.isMultiTouch(evt)){this.started=true;this.last=this.start={distance:this.getDistance(evt.touches),delta:0,scale:1};this.callback("start",[evt,this.start]);propagate=!this.stopDown}else if(this.started){return false}else{this.started=false;this.start=null;this.last=null}OpenLayers.Event.preventDefault(evt);return propagate},touchmove:function(evt){if(this.started&&OpenLayers.Event.isMultiTouch(evt)){this.pinching=true;var current=this.getPinchData(evt);this.callback("move",[evt,current]);this.last=current;OpenLayers.Event.stop(evt)}else if(this.started){return false}return true},touchend:function(evt){if(this.started&&!OpenLayers.Event.isMultiTouch(evt)){this.started=false;this.pinching=false;this.callback("done",[evt,this.start,this.last]);this.start=null;this.last=null;return false}return true},activate:function(){var activated=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.pinching=false;activated=true}return activated},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.started=false;this.pinching=false;this.start=null;this.last=null;deactivated=true}return deactivated},getDistance:function(touches){var t0=touches[0];var t1=touches[1];return Math.sqrt(Math.pow(t0.olClientX-t1.olClientX,2)+Math.pow(t0.olClientY-t1.olClientY,2))},getPinchData:function(evt){var distance=this.getDistance(evt.touches);var scale=distance/this.start.distance;return{distance:distance,delta:this.last.distance-distance,scale:scale}},CLASS_NAME:"OpenLayers.Handler.Pinch"});OpenLayers.Handler.Polygon=OpenLayers.Class(OpenLayers.Handler.Path,{holeModifier:null,drawingHole:false,polygon:null,createFeature:function(pixel){var lonlat=this.layer.getLonLatFromViewPortPx(pixel);var geometry=new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat);this.point=new OpenLayers.Feature.Vector(geometry);this.line=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LinearRing([this.point.geometry]));this.polygon=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon([this.line.geometry]));this.callback("create",[this.point.geometry,this.getSketch()]);this.point.geometry.clearBounds();this.layer.addFeatures([this.polygon,this.point],{silent:true})},addPoint:function(pixel){if(!this.drawingHole&&this.holeModifier&&this.evt&&this.evt[this.holeModifier]){var geometry=this.point.geometry;var features=this.control.layer.features;var candidate,polygon;for(var i=features.length-1;i>=0;--i){candidate=features[i].geometry;if((candidate instanceof OpenLayers.Geometry.Polygon||candidate instanceof OpenLayers.Geometry.MultiPolygon)&&candidate.intersects(geometry)){polygon=features[i];this.control.layer.removeFeatures([polygon],{silent:true});this.control.layer.events.registerPriority("sketchcomplete",this,this.finalizeInteriorRing);this.control.layer.events.registerPriority("sketchmodified",this,this.enforceTopology);polygon.geometry.addComponent(this.line.geometry);this.polygon=polygon;this.drawingHole=true;break}}}OpenLayers.Handler.Path.prototype.addPoint.apply(this,arguments)},getCurrentPointIndex:function(){return this.line.geometry.components.length-2},enforceTopology:function(event){var point=event.vertex;var components=this.line.geometry.components;if(!this.polygon.geometry.intersects(point)){var last=components[components.length-3];point.x=last.x;point.y=last.y}},finishGeometry:function(){var index=this.line.geometry.components.length-2;this.line.geometry.removeComponent(this.line.geometry.components[index]);this.removePoint();this.finalize()},finalizeInteriorRing:function(){var ring=this.line.geometry;var modified=ring.getArea()!==0;if(modified){var rings=this.polygon.geometry.components;for(var i=rings.length-2;i>=0;--i){if(ring.intersects(rings[i])){modified=false;break}}if(modified){var target;outer:for(var i=rings.length-2;i>0;--i){var points=rings[i].components;for(var j=0,jj=points.length;j<jj;++j){if(ring.containsPoint(points[j])){modified=false;break outer}}}}}if(modified){if(this.polygon.state!==OpenLayers.State.INSERT){this.polygon.state=OpenLayers.State.UPDATE}}else{this.polygon.geometry.removeComponent(ring)}this.restoreFeature();return false},cancel:function(){if(this.drawingHole){this.polygon.geometry.removeComponent(this.line.geometry);this.restoreFeature(true)}return OpenLayers.Handler.Path.prototype.cancel.apply(this,arguments)},restoreFeature:function(cancel){this.control.layer.events.unregister("sketchcomplete",this,this.finalizeInteriorRing);this.control.layer.events.unregister("sketchmodified",this,this.enforceTopology);this.layer.removeFeatures([this.polygon],{silent:true});this.control.layer.addFeatures([this.polygon],{silent:true});this.drawingHole=false;if(!cancel){this.control.layer.events.triggerEvent("sketchcomplete",{feature:this.polygon})}},destroyFeature:function(force){OpenLayers.Handler.Path.prototype.destroyFeature.call(this,force);this.polygon=null},drawFeature:function(){this.layer.drawFeature(this.polygon,this.style);this.layer.drawFeature(this.point,this.style)},getSketch:function(){return this.polygon},getGeometry:function(){var geometry=this.polygon&&this.polygon.geometry;if(geometry&&this.multi){geometry=new OpenLayers.Geometry.MultiPolygon([geometry])}return geometry},CLASS_NAME:"OpenLayers.Handler.Polygon"});OpenLayers.Control.Geolocate=OpenLayers.Class(OpenLayers.Control,{geolocation:null,available:"geolocation"in navigator,bind:true,watch:false,geolocationOptions:null,destroy:function(){this.deactivate();OpenLayers.Control.prototype.destroy.apply(this,arguments)},activate:function(){if(this.available&&!this.geolocation){this.geolocation=navigator.geolocation}if(!this.geolocation){this.events.triggerEvent("locationuncapable");return false}if(OpenLayers.Control.prototype.activate.apply(this,arguments)){if(this.watch){this.watchId=this.geolocation.watchPosition(OpenLayers.Function.bind(this.geolocate,this),OpenLayers.Function.bind(this.failure,this),this.geolocationOptions)}else{this.getCurrentLocation()}return true}return false},deactivate:function(){if(this.active&&this.watchId!==null){this.geolocation.clearWatch(this.watchId)}return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},geolocate:function(position){var center=new OpenLayers.LonLat(position.coords.longitude,position.coords.latitude).transform(new OpenLayers.Projection("EPSG:4326"),this.map.getProjectionObject());if(this.bind){this.map.setCenter(center)}this.events.triggerEvent("locationupdated",{position:position,point:new OpenLayers.Geometry.Point(center.lon,center.lat)})},getCurrentLocation:function(){if(!this.active||this.watch){return false}this.geolocation.getCurrentPosition(OpenLayers.Function.bind(this.geolocate,this),OpenLayers.Function.bind(this.failure,this),this.geolocationOptions);return true},failure:function(error){this.events.triggerEvent("locationfailed",{error:error})},CLASS_NAME:"OpenLayers.Control.Geolocate"});OpenLayers.Protocol.HTTP=OpenLayers.Class(OpenLayers.Protocol,{url:null,headers:null,params:null,callback:null,scope:null,readWithPOST:false,updateWithPOST:false,deleteWithPOST:false,wildcarded:false,srsInBBOX:false,initialize:function(options){options=options||{};this.params={};this.headers={};OpenLayers.Protocol.prototype.initialize.apply(this,arguments);if(!this.filterToParams&&OpenLayers.Format.QueryStringFilter){var format=new OpenLayers.Format.QueryStringFilter({wildcarded:this.wildcarded,srsInBBOX:this.srsInBBOX});this.filterToParams=function(filter,params){return format.write(filter,params)}}},destroy:function(){this.params=null;this.headers=null;OpenLayers.Protocol.prototype.destroy.apply(this)},read:function(options){OpenLayers.Protocol.prototype.read.apply(this,arguments);options=options||{};options.params=OpenLayers.Util.applyDefaults(options.params,this.options.params);options=OpenLayers.Util.applyDefaults(options,this.options);if(options.filter&&this.filterToParams){options.params=this.filterToParams(options.filter,options.params)}var readWithPOST=options.readWithPOST!==undefined?options.readWithPOST:this.readWithPOST;var resp=new OpenLayers.Protocol.Response({requestType:"read"});if(readWithPOST){var headers=options.headers||{};headers["Content-Type"]="application/x-www-form-urlencoded";resp.priv=OpenLayers.Request.POST({url:options.url,callback:this.createCallback(this.handleRead,resp,options),data:OpenLayers.Util.getParameterString(options.params),headers:headers})}else{resp.priv=OpenLayers.Request.GET({url:options.url,callback:this.createCallback(this.handleRead,resp,options),params:options.params,headers:options.headers})}return resp},handleRead:function(resp,options){this.handleResponse(resp,options)},create:function(features,options){options=OpenLayers.Util.applyDefaults(options,this.options);var resp=new OpenLayers.Protocol.Response({reqFeatures:features,requestType:"create"});resp.priv=OpenLayers.Request.POST({url:options.url,callback:this.createCallback(this.handleCreate,resp,options),headers:options.headers,data:this.format.write(features)});return resp},handleCreate:function(resp,options){this.handleResponse(resp,options)},update:function(feature,options){options=options||{};var url=options.url||feature.url||this.options.url+"/"+feature.fid;options=OpenLayers.Util.applyDefaults(options,this.options);var resp=new OpenLayers.Protocol.Response({reqFeatures:feature,requestType:"update"});var method=this.updateWithPOST?"POST":"PUT";resp.priv=OpenLayers.Request[method]({url:url,callback:this.createCallback(this.handleUpdate,resp,options),headers:options.headers,data:this.format.write(feature)});return resp},handleUpdate:function(resp,options){this.handleResponse(resp,options)},"delete":function(feature,options){options=options||{};var url=options.url||feature.url||this.options.url+"/"+feature.fid;options=OpenLayers.Util.applyDefaults(options,this.options);var resp=new OpenLayers.Protocol.Response({reqFeatures:feature,requestType:"delete"});var method=this.deleteWithPOST?"POST":"DELETE";var requestOptions={url:url,callback:this.createCallback(this.handleDelete,resp,options),headers:options.headers};if(this.deleteWithPOST){requestOptions.data=this.format.write(feature)
}resp.priv=OpenLayers.Request[method](requestOptions);return resp},handleDelete:function(resp,options){this.handleResponse(resp,options)},handleResponse:function(resp,options){var request=resp.priv;if(options.callback){if(request.status>=200&&request.status<300){if(resp.requestType!="delete"){resp.features=this.parseFeatures(request)}resp.code=OpenLayers.Protocol.Response.SUCCESS}else{resp.code=OpenLayers.Protocol.Response.FAILURE}options.callback.call(options.scope,resp)}},parseFeatures:function(request){var doc=request.responseXML;if(!doc||!doc.documentElement){doc=request.responseText}if(!doc||doc.length<=0){return null}return this.format.read(doc)},commit:function(features,options){options=OpenLayers.Util.applyDefaults(options,this.options);var resp=[],nResponses=0;var types={};types[OpenLayers.State.INSERT]=[];types[OpenLayers.State.UPDATE]=[];types[OpenLayers.State.DELETE]=[];var feature,list,requestFeatures=[];for(var i=0,len=features.length;i<len;++i){feature=features[i];list=types[feature.state];if(list){list.push(feature);requestFeatures.push(feature)}}var nRequests=(types[OpenLayers.State.INSERT].length>0?1:0)+types[OpenLayers.State.UPDATE].length+types[OpenLayers.State.DELETE].length;var success=true;var finalResponse=new OpenLayers.Protocol.Response({reqFeatures:requestFeatures});function insertCallback(response){var len=response.features?response.features.length:0;var fids=new Array(len);for(var i=0;i<len;++i){fids[i]=response.features[i].fid}finalResponse.insertIds=fids;callback.apply(this,[response])}function callback(response){this.callUserCallback(response,options);success=success&&response.success();nResponses++;if(nResponses>=nRequests){if(options.callback){finalResponse.code=success?OpenLayers.Protocol.Response.SUCCESS:OpenLayers.Protocol.Response.FAILURE;options.callback.apply(options.scope,[finalResponse])}}}var queue=types[OpenLayers.State.INSERT];if(queue.length>0){resp.push(this.create(queue,OpenLayers.Util.applyDefaults({callback:insertCallback,scope:this},options.create)))}queue=types[OpenLayers.State.UPDATE];for(var i=queue.length-1;i>=0;--i){resp.push(this.update(queue[i],OpenLayers.Util.applyDefaults({callback:callback,scope:this},options.update)))}queue=types[OpenLayers.State.DELETE];for(var i=queue.length-1;i>=0;--i){resp.push(this["delete"](queue[i],OpenLayers.Util.applyDefaults({callback:callback,scope:this},options["delete"])))}return resp},abort:function(response){if(response){response.priv.abort()}},callUserCallback:function(resp,options){var opt=options[resp.requestType];if(opt&&opt.callback){opt.callback.call(opt.scope,resp)}},CLASS_NAME:"OpenLayers.Protocol.HTTP"});OpenLayers.Control.DragPan=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,panned:false,interval:0,documentDrag:false,kinetic:null,enableKinetic:true,kineticInterval:10,draw:function(){if(this.enableKinetic&&OpenLayers.Kinetic){var config={interval:this.kineticInterval};if(typeof this.enableKinetic==="object"){config=OpenLayers.Util.extend(config,this.enableKinetic)}this.kinetic=new OpenLayers.Kinetic(config)}this.handler=new OpenLayers.Handler.Drag(this,{move:this.panMap,done:this.panMapDone,down:this.panMapStart},{interval:this.interval,documentDrag:this.documentDrag})},panMapStart:function(){if(this.kinetic){this.kinetic.begin()}},panMap:function(xy){if(this.kinetic){this.kinetic.update(xy)}this.panned=true;this.map.pan(this.handler.last.x-xy.x,this.handler.last.y-xy.y,{dragging:true,animate:false})},panMapDone:function(xy){if(this.panned){var res=null;if(this.kinetic){res=this.kinetic.end(xy)}this.map.pan(this.handler.last.x-xy.x,this.handler.last.y-xy.y,{dragging:!!res,animate:false});if(res){var self=this;this.kinetic.move(res,function(x,y,end){self.map.pan(x,y,{dragging:!end,animate:false})})}this.panned=false}},CLASS_NAME:"OpenLayers.Control.DragPan"});OpenLayers.Control.PinchZoom=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,pinchOrigin:null,currentCenter:null,autoActivate:true,preserveCenter:false,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.handler=new OpenLayers.Handler.Pinch(this,{start:this.pinchStart,move:this.pinchMove,done:this.pinchDone},this.handlerOptions)},pinchStart:function(evt,pinchData){var xy=this.preserveCenter?this.map.getPixelFromLonLat(this.map.getCenter()):evt.xy;this.pinchOrigin=xy;this.currentCenter=xy},pinchMove:function(evt,pinchData){var scale=pinchData.scale;var containerOrigin=this.map.layerContainerOriginPx;var pinchOrigin=this.pinchOrigin;var current=this.preserveCenter?this.map.getPixelFromLonLat(this.map.getCenter()):evt.xy;var dx=Math.round(containerOrigin.x+current.x-pinchOrigin.x+(scale-1)*(containerOrigin.x-pinchOrigin.x));var dy=Math.round(containerOrigin.y+current.y-pinchOrigin.y+(scale-1)*(containerOrigin.y-pinchOrigin.y));this.map.applyTransform(dx,dy,scale);this.currentCenter=current},pinchDone:function(evt,start,last){this.map.applyTransform();var zoom=this.map.getZoomForResolution(this.map.getResolution()/last.scale,true);if(zoom!==this.map.getZoom()||!this.currentCenter.equals(this.pinchOrigin)){var resolution=this.map.getResolutionForZoom(zoom);var location=this.map.getLonLatFromPixel(this.pinchOrigin);var zoomPixel=this.currentCenter;var size=this.map.getSize();location.lon+=resolution*(size.w/2-zoomPixel.x);location.lat-=resolution*(size.h/2-zoomPixel.y);this.map.div.clientWidth=this.map.div.clientWidth;this.map.setCenter(location,zoom)}},CLASS_NAME:"OpenLayers.Control.PinchZoom"});OpenLayers.Handler.Click=OpenLayers.Class(OpenLayers.Handler,{delay:300,single:true,"double":false,pixelTolerance:0,dblclickTolerance:13,stopSingle:false,stopDouble:false,timerId:null,down:null,last:null,first:null,rightclickTimerId:null,touchstart:function(evt){this.startTouch();this.down=this.getEventInfo(evt);this.last=this.getEventInfo(evt);return true},touchmove:function(evt){this.last=this.getEventInfo(evt);return true},touchend:function(evt){if(this.down){evt.xy=this.last.xy;evt.lastTouches=this.last.touches;this.handleSingle(evt);this.down=null}return true},mousedown:function(evt){this.down=this.getEventInfo(evt);this.last=this.getEventInfo(evt);return true},mouseup:function(evt){var propagate=true;if(this.checkModifiers(evt)&&this.control.handleRightClicks&&OpenLayers.Event.isRightClick(evt)){propagate=this.rightclick(evt)}return propagate},rightclick:function(evt){if(this.passesTolerance(evt)){if(this.rightclickTimerId!=null){this.clearTimer();this.callback("dblrightclick",[evt]);return!this.stopDouble}else{var clickEvent=this["double"]?OpenLayers.Util.extend({},evt):this.callback("rightclick",[evt]);var delayedRightCall=OpenLayers.Function.bind(this.delayedRightCall,this,clickEvent);this.rightclickTimerId=window.setTimeout(delayedRightCall,this.delay)}}return!this.stopSingle},delayedRightCall:function(evt){this.rightclickTimerId=null;if(evt){this.callback("rightclick",[evt])}},click:function(evt){if(!this.last){this.last=this.getEventInfo(evt)}this.handleSingle(evt);return!this.stopSingle},dblclick:function(evt){this.handleDouble(evt);return!this.stopDouble},handleDouble:function(evt){if(this.passesDblclickTolerance(evt)){if(this["double"]){this.callback("dblclick",[evt])}this.clearTimer()}},handleSingle:function(evt){if(this.passesTolerance(evt)){if(this.timerId!=null){if(this.last.touches&&this.last.touches.length===1){if(this["double"]){OpenLayers.Event.preventDefault(evt)}this.handleDouble(evt)}if(!this.last.touches||this.last.touches.length!==2){this.clearTimer()}}else{this.first=this.getEventInfo(evt);var clickEvent=this.single?OpenLayers.Util.extend({},evt):null;this.queuePotentialClick(clickEvent)}}},queuePotentialClick:function(evt){this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,evt),this.delay)},passesTolerance:function(evt){var passes=true;if(this.pixelTolerance!=null&&this.down&&this.down.xy){passes=this.pixelTolerance>=this.down.xy.distanceTo(evt.xy);if(passes&&this.touch&&this.down.touches.length===this.last.touches.length){for(var i=0,ii=this.down.touches.length;i<ii;++i){if(this.getTouchDistance(this.down.touches[i],this.last.touches[i])>this.pixelTolerance){passes=false;break}}}}return passes},getTouchDistance:function(from,to){return Math.sqrt(Math.pow(from.clientX-to.clientX,2)+Math.pow(from.clientY-to.clientY,2))},passesDblclickTolerance:function(evt){var passes=true;if(this.down&&this.first){passes=this.down.xy.distanceTo(this.first.xy)<=this.dblclickTolerance}return passes},clearTimer:function(){if(this.timerId!=null){window.clearTimeout(this.timerId);this.timerId=null}if(this.rightclickTimerId!=null){window.clearTimeout(this.rightclickTimerId);this.rightclickTimerId=null}},delayedCall:function(evt){this.timerId=null;if(evt){this.callback("click",[evt])}},getEventInfo:function(evt){var touches;if(evt.touches){var len=evt.touches.length;touches=new Array(len);var touch;for(var i=0;i<len;i++){touch=evt.touches[i];touches[i]={clientX:touch.olClientX,clientY:touch.olClientY}}}return{xy:evt.xy,touches:touches}},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.clearTimer();this.down=null;this.first=null;this.last=null;deactivated=true}return deactivated},CLASS_NAME:"OpenLayers.Handler.Click"});OpenLayers.Control.TouchNavigation=OpenLayers.Class(OpenLayers.Control,{dragPan:null,dragPanOptions:null,pinchZoom:null,pinchZoomOptions:null,clickHandlerOptions:null,documentDrag:false,autoActivate:true,initialize:function(options){this.handlers={};OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.deactivate();if(this.dragPan){this.dragPan.destroy()}this.dragPan=null;if(this.pinchZoom){this.pinchZoom.destroy();delete this.pinchZoom}OpenLayers.Control.prototype.destroy.apply(this,arguments)},activate:function(){if(OpenLayers.Control.prototype.activate.apply(this,arguments)){this.dragPan.activate();this.handlers.click.activate();this.pinchZoom.activate();return true}return false},deactivate:function(){if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)){this.dragPan.deactivate();this.handlers.click.deactivate();this.pinchZoom.deactivate();return true}return false},draw:function(){var clickCallbacks={click:this.defaultClick,dblclick:this.defaultDblClick};var clickOptions=OpenLayers.Util.extend({"double":true,stopDouble:true,pixelTolerance:2},this.clickHandlerOptions);this.handlers.click=new OpenLayers.Handler.Click(this,clickCallbacks,clickOptions);this.dragPan=new OpenLayers.Control.DragPan(OpenLayers.Util.extend({map:this.map,documentDrag:this.documentDrag},this.dragPanOptions));this.dragPan.draw();this.pinchZoom=new OpenLayers.Control.PinchZoom(OpenLayers.Util.extend({map:this.map},this.pinchZoomOptions))},defaultClick:function(evt){if(evt.lastTouches&&evt.lastTouches.length==2){this.map.zoomOut()}},defaultDblClick:function(evt){this.map.zoomTo(this.map.zoom+1,evt.xy)},CLASS_NAME:"OpenLayers.Control.TouchNavigation"});OpenLayers.Protocol.WFS.v1_0_0=OpenLayers.Class(OpenLayers.Protocol.WFS.v1,{version:"1.0.0",CLASS_NAME:"OpenLayers.Protocol.WFS.v1_0_0"});OpenLayers.TileManager=OpenLayers.Class({cacheSize:256,tilesPerFrame:2,frameDelay:16,moveDelay:100,zoomDelay:200,maps:null,tileQueueId:null,tileQueue:null,tileCache:null,tileCacheIndex:null,initialize:function(options){OpenLayers.Util.extend(this,options);this.maps=[];this.tileQueueId={};this.tileQueue={};this.tileCache={};this.tileCacheIndex=[]},addMap:function(map){if(this._destroyed||!OpenLayers.Layer.Grid){return}this.maps.push(map);this.tileQueue[map.id]=[];for(var i=0,ii=map.layers.length;i<ii;++i){this.addLayer({layer:map.layers[i]})}map.events.on({move:this.move,zoomend:this.zoomEnd,changelayer:this.changeLayer,addlayer:this.addLayer,preremovelayer:this.removeLayer,scope:this})},removeMap:function(map){if(this._destroyed||!OpenLayers.Layer.Grid){return}window.clearTimeout(this.tileQueueId[map.id]);if(map.layers){for(var i=0,ii=map.layers.length;i<ii;++i){this.removeLayer({layer:map.layers[i]})}}if(map.events){map.events.un({move:this.move,zoomend:this.zoomEnd,changelayer:this.changeLayer,addlayer:this.addLayer,preremovelayer:this.removeLayer,scope:this})}delete this.tileQueue[map.id];delete this.tileQueueId[map.id];OpenLayers.Util.removeItem(this.maps,map)},move:function(evt){this.updateTimeout(evt.object,this.moveDelay,true)},zoomEnd:function(evt){this.updateTimeout(evt.object,this.zoomDelay)},changeLayer:function(evt){if(evt.property==="visibility"||evt.property==="params"){this.updateTimeout(evt.object,0)}},addLayer:function(evt){var layer=evt.layer;if(layer instanceof OpenLayers.Layer.Grid){layer.events.on({addtile:this.addTile,retile:this.clearTileQueue,scope:this});var i,j,tile;for(i=layer.grid.length-1;i>=0;--i){for(j=layer.grid[i].length-1;j>=0;--j){tile=layer.grid[i][j];this.addTile({tile:tile});if(tile.url&&!tile.imgDiv){this.manageTileCache({object:tile})}}}}},removeLayer:function(evt){var layer=evt.layer;if(layer instanceof OpenLayers.Layer.Grid){this.clearTileQueue({object:layer});if(layer.events){layer.events.un({addtile:this.addTile,retile:this.clearTileQueue,scope:this})}if(layer.grid){var i,j,tile;for(i=layer.grid.length-1;i>=0;--i){for(j=layer.grid[i].length-1;j>=0;--j){tile=layer.grid[i][j];this.unloadTile({object:tile})}}}}},updateTimeout:function(map,delay,nice){window.clearTimeout(this.tileQueueId[map.id]);var tileQueue=this.tileQueue[map.id];if(!nice||tileQueue.length){this.tileQueueId[map.id]=window.setTimeout(OpenLayers.Function.bind(function(){this.drawTilesFromQueue(map);if(tileQueue.length){this.updateTimeout(map,this.frameDelay)}},this),delay)}},addTile:function(evt){if(evt.tile instanceof OpenLayers.Tile.Image){evt.tile.events.on({beforedraw:this.queueTileDraw,beforeload:this.manageTileCache,loadend:this.addToCache,unload:this.unloadTile,scope:this})}else{this.removeLayer({layer:evt.tile.layer})}},unloadTile:function(evt){var tile=evt.object;tile.events.un({beforedraw:this.queueTileDraw,beforeload:this.manageTileCache,loadend:this.addToCache,unload:this.unloadTile,scope:this});OpenLayers.Util.removeItem(this.tileQueue[tile.layer.map.id],tile)},queueTileDraw:function(evt){var tile=evt.object;var queued=false;var layer=tile.layer;var url=layer.getURL(tile.bounds);var img=this.tileCache[url];if(img&&img.className!=="olTileImage"){delete this.tileCache[url];OpenLayers.Util.removeItem(this.tileCacheIndex,url);img=null}if(layer.url&&(layer.async||!img)){var tileQueue=this.tileQueue[layer.map.id];if(!~OpenLayers.Util.indexOf(tileQueue,tile)){tileQueue.push(tile)}queued=true}return!queued},drawTilesFromQueue:function(map){var tileQueue=this.tileQueue[map.id];var limit=this.tilesPerFrame;var animating=map.zoomTween&&map.zoomTween.playing;while(!animating&&tileQueue.length&&limit){tileQueue.shift().draw(true);--limit}},manageTileCache:function(evt){var tile=evt.object;var img=this.tileCache[tile.url];if(img){if(img.parentNode&&OpenLayers.Element.hasClass(img.parentNode,"olBackBuffer")){img.parentNode.removeChild(img);img.id=null}if(!img.parentNode){img.style.visibility="hidden";img.style.opacity=0;tile.setImage(img);OpenLayers.Util.removeItem(this.tileCacheIndex,tile.url);this.tileCacheIndex.push(tile.url)}}},addToCache:function(evt){var tile=evt.object;if(!this.tileCache[tile.url]){if(!OpenLayers.Element.hasClass(tile.imgDiv,"olImageLoadError")){if(this.tileCacheIndex.length>=this.cacheSize){delete this.tileCache[this.tileCacheIndex[0]];this.tileCacheIndex.shift()}this.tileCache[tile.url]=tile.imgDiv;this.tileCacheIndex.push(tile.url)}}},clearTileQueue:function(evt){var layer=evt.object;var tileQueue=this.tileQueue[layer.map.id];for(var i=tileQueue.length-1;i>=0;--i){if(tileQueue[i].layer===layer){tileQueue.splice(i,1)}}},destroy:function(){for(var i=this.maps.length-1;i>=0;--i){this.removeMap(this.maps[i])}this.maps=null;this.tileQueue=null;this.tileQueueId=null;this.tileCache=null;this.tileCacheIndex=null;this._destroyed=true}});