/*

  OpenLayers.js -- OpenLayers Map Viewer Library

  Copyright 2005-2006 MetaCarta, Inc., released under a modified BSD license.
  Please see http://svn.openlayers.org/trunk/openlayers/repository-license.txt
  for the full text of the license.

  Includes compressed code under the following licenses:

  (For uncompressed versions of the code used please see the
  OpenLayers SVN repository: <http://openlayers.org/>)

  Built from version 2036 of the sandbox/vector branch of OpenLayers,
  URL: http://svn.openlayers.org/sandbox/vector

*/

/* Contains portions of Prototype.js:
 *
 * Prototype JavaScript framework, version 1.4.0
 *  (c) 2005 Sam Stephenson <sam@conio.net>
 *
 *  Prototype is freely distributable under the terms of an MIT-style license.
 *  For details, see the Prototype web site: http://prototype.conio.net/
 *
/*--------------------------------------------------------------------------*/

/**  
*  
*  Contains portions of Rico <http://openrico.org/>
* 
*  Copyright 2005 Sabre Airline Solutions  
*  
*  Licensed under the Apache License, Version 2.0 (the "License"); you
*  may not use this file except in compliance with the License. You
*  may obtain a copy of the License at
*  
*         http://www.apache.org/licenses/LICENSE-2.0  
*  
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
*  implied. See the License for the specific language governing
*  permissions and limitations under the License. 
*
**/


_OPENLAYERS_SFL_=true
OpenLayers=new Object();OpenLayers._scriptName=(typeof(_OPENLAYERS_SFL_)=="undefined"?"lib/OpenLayers.js":"OpenLayers.js");OpenLayers._getScriptLocation=function(){var scriptLocation="";var SCRIPT_NAME=OpenLayers._scriptName;var scripts=document.getElementsByTagName('script');for(var i=0;i<scripts.length;i++){var src=scripts[i].getAttribute('src');if(src){var index=src.lastIndexOf(SCRIPT_NAME);if((index>-1)&&(index+SCRIPT_NAME.length==src.length)){scriptLocation=src.slice(0,-SCRIPT_NAME.length);break;}}}
return scriptLocation;}
if(typeof(_OPENLAYERS_SFL_)=="undefined"){(function(){var jsfiles=new Array("OpenLayers/BaseTypes.js","OpenLayers/Util.js","Rico/Corner.js","Rico/Color.js","OpenLayers/Ajax.js","OpenLayers/Events.js","OpenLayers/Map.js","OpenLayers/Layer.js","OpenLayers/Icon.js","OpenLayers/Marker.js","OpenLayers/Marker/Box.js","OpenLayers/Popup.js","OpenLayers/Tile.js","OpenLayers/Feature.js","OpenLayers/Tile/Image.js","OpenLayers/Tile/WFS.js","OpenLayers/Attributes.js","OpenLayers/Attributes/GML.js","OpenLayers/Layer/Image.js","OpenLayers/Layer/EventPane.js","OpenLayers/Layer/FixedZoomLevels.js","OpenLayers/Layer/Google.js","OpenLayers/Layer/VirtualEarth.js","OpenLayers/Layer/Yahoo.js","OpenLayers/Layer/HTTPRequest.js","OpenLayers/Layer/Grid.js","OpenLayers/Layer/MapServer.js","OpenLayers/Layer/KaMap.js","OpenLayers/Layer/MultiMap.js","OpenLayers/Layer/Markers.js","OpenLayers/Layer/Text.js","OpenLayers/Layer/WorldWind.js","OpenLayers/Layer/WMS.js","OpenLayers/Layer/WMS/Untiled.js","OpenLayers/Layer/GeoRSS.js","OpenLayers/Layer/Boxes.js","OpenLayers/Layer/Vector.js","OpenLayers/Layer/WFS.js","OpenLayers/Layer/GML.js","OpenLayers/Popup/Anchored.js","OpenLayers/Popup/AnchoredBubble.js","OpenLayers/Control.js","OpenLayers/Control/MouseDefaults.js","OpenLayers/Control/MouseToolbar.js","OpenLayers/Control/MousePosition.js","OpenLayers/Control/OverviewMap.js","OpenLayers/Control/KeyboardDefaults.js","OpenLayers/Control/PanZoom.js","OpenLayers/Control/PanZoomBar.js","OpenLayers/Control/ArgParser.js","OpenLayers/Control/Permalink.js","OpenLayers/Control/Scale.js","OpenLayers/Control/LayerSwitcher.js","OpenLayers/Control/EditingToolbar.js","OpenLayers/Control/EditingTool.js","OpenLayers/Control/EditingAttributes.js","OpenLayers/Control/EditingTool/Selection.js","OpenLayers/Control/EditingTool/MovePathPoint.js","OpenLayers/Control/EditingTool/DrawLinearPath.js","OpenLayers/Control/EditingTool/DrawPoint.js","OpenLayers/Control/EditingTool/DrawLineString.js","OpenLayers/Control/EditingTool/RemovePathPoint.js","OpenLayers/Control/EditingTool/AddPathPoint.js","OpenLayers/Control/EditingTool/DrawLinearRing.js","OpenLayers/Control/EditingTool/Rotate.js","OpenLayers/Control/EditingTool/Commit.js","OpenLayers/Control/EditingMode.js","OpenLayers/Control/EditingMode/PointSnapping.js","OpenLayers/Control/EditingMode/SegmentSnapping.js","OpenLayers/Geometry.js","OpenLayers/Geometry/Aggregate.js","OpenLayers/Geometry/Point.js","OpenLayers/Geometry/Curve.js","OpenLayers/Geometry/LineString.js","OpenLayers/Geometry/LineSegment.js","OpenLayers/Geometry/LinearRing.js","OpenLayers/Geometry/Surface.js","OpenLayers/Geometry/Polygon.js","OpenLayers/Geometry/Rectangle.js","OpenLayers/Geometry/MultiPoint.js","OpenLayers/Geometry/MultiLineString.js","OpenLayers/Geometry/MultiPolygon.js","OpenLayers/Renderer.js","OpenLayers/Renderer/Svg.js","OpenLayers/Renderer/Vml.js","OpenLayers/Math.js","OpenLayers/Math/Matrix.js","OpenLayers/Style.js","OpenLayers/Style/WebSafe.js","OpenLayers/Parser.js","OpenLayers/Parser/GML.js","OpenLayers/Writer.js","OpenLayers/Writer/WFS.js","OpenLayers/Writer/GML.js");var allScriptTags="";var host=OpenLayers._getScriptLocation()+"lib/";for(var i=0;i<jsfiles.length;i++){if(/MSIE/.test(navigator.userAgent)||/Safari/.test(navigator.userAgent)){var currentScriptTag="<script src='"+host+jsfiles[i]+"'></script>";allScriptTags+=currentScriptTag;}else{var s=document.createElement("script");s.src=host+jsfiles[i];var h=document.getElementsByTagName("head").length?document.getElementsByTagName("head")[0]:document.body;h.appendChild(s);}}
if(allScriptTags)document.write(allScriptTags);})();}
OpenLayers.VERSION_NUMBER="$Revision: 1721 $";OpenLayers.Class={isPrototype:function(){},create:function(){return function(){if(arguments&&arguments[0]!=OpenLayers.Class.isPrototype)
this.initialize.apply(this,arguments);}},inherit:function(){var superClass=arguments[0];var proto=new superClass(OpenLayers.Class.isPrototype);for(var i=1;i<arguments.length;i++){if(typeof arguments[i]=="function"){var mixin=arguments[i];arguments[i]=new mixin(OpenLayers.Class.isPrototype);}
OpenLayers.Util.extend(proto,arguments[i]);}
return proto;}};OpenLayers.Pixel=OpenLayers.Class.create();OpenLayers.Pixel.prototype={x:0.0,y:0.0,initialize:function(x,y){this.x=parseFloat(x);this.y=parseFloat(y);},toString:function(){return("x="+this.x+",y="+this.y);},clone:function(){return new OpenLayers.Pixel(this.x,this.y);},equals:function(px){var equals=false;if(px!=null){equals=((this.x==px.x&&this.y==px.y)||(isNaN(this.x)&&isNaN(this.y)&&isNaN(px.x)&&isNaN(px.y)));}
return equals;},add:function(x,y){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.create();OpenLayers.Size.prototype={w:0.0,h:0.0,initialize:function(w,h){this.w=parseFloat(w);this.h=parseFloat(h);},toString:function(){return("w="+this.w+",h="+this.h);},clone:function(){return new OpenLayers.Size(this.w,this.h);},equals:function(sz){var equals=false;if(sz!=null){equals=((this.w==sz.w&&this.h==sz.h)||(isNaN(this.w)&&isNaN(this.h)&&isNaN(sz.w)&&isNaN(sz.h)));}
return equals;},CLASS_NAME:"OpenLayers.Size"};OpenLayers.LonLat=OpenLayers.Class.create();OpenLayers.LonLat.prototype={lon:0.0,lat:0.0,initialize:function(lon,lat){this.lon=parseFloat(lon);this.lat=parseFloat(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){return new OpenLayers.LonLat(this.lon+lon,this.lat+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;},CLASS_NAME:"OpenLayers.LonLat"};OpenLayers.LonLat.fromString=function(str){var pair=str.split(",");return new OpenLayers.LonLat(parseFloat(pair[0]),parseFloat(pair[1]));};OpenLayers.Bounds=OpenLayers.Class.create();OpenLayers.Bounds.prototype={left:0.0,bottom:0.0,right:0.0,top:0.0,initialize:function(left,bottom,right,top){this.left=parseFloat(left);this.bottom=parseFloat(bottom);this.right=parseFloat(right);this.top=parseFloat(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("left-bottom=("+this.left+","+this.bottom+")"
+" right-top=("+this.right+","+this.top+")");},toBBOX:function(decimal){if(decimal==null){decimal=6;}
var mult=Math.pow(10,decimal);var bbox=Math.round(this.left*mult)/mult+","+
Math.round(this.bottom*mult)/mult+","+
Math.round(this.right*mult)/mult+","+
Math.round(this.top*mult)/mult;return bbox;},getWidth:function(){return(this.right-this.left);},getHeight:function(){return(this.top-this.bottom);},getSize:function(){return new OpenLayers.Size(this.getWidth(),this.getHeight());},getCenterPixel:function(){return new OpenLayers.Pixel((this.left+this.right)/2,(this.bottom+this.top)/2);},getCenterLonLat:function(){return new OpenLayers.LonLat((this.left+this.right)/2,(this.bottom+this.top)/2);},add:function(x,y){return new OpenLayers.Bounds(this.left+x,this.bottom+y,this.right+x,this.top+y);},extendBounds:function(left,bottom,right,top){if(left&&bottom){this.left=(left<this.left)?left:this.left;this.bottom=(bottom<this.bottom)?bottom:this.bottom;if(right&&top){this.right=(right>this.right)?right:this.right;this.top=(top>this.top)?top:this.top;}else{this.right=(left>this.right)?left:this.right;this.top=(bottom>this.top)?bottom:this.top;}}},containsLonLat:function(ll,inclusive){return this.contains(ll.lon,ll.lat,inclusive);},containsPixel:function(px,inclusive){return this.contains(px.x,px.y,inclusive);},contains:function(x,y,inclusive){if(inclusive==null){inclusive=true;}
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,inclusive){if(inclusive==null){inclusive=true;}
var inBottom=(bounds.bottom==this.bottom&&bounds.top==this.top)?true:(((bounds.bottom>this.bottom)&&(bounds.bottom<this.top))||((this.bottom>bounds.bottom)&&(this.bottom<bounds.top)));var inTop=(bounds.bottom==this.bottom&&bounds.top==this.top)?true:(((bounds.top>this.bottom)&&(bounds.top<this.top))||((this.top>bounds.bottom)&&(this.top<bounds.top)));var inRight=(bounds.right==this.right&&bounds.left==this.left)?true:(((bounds.right>this.left)&&(bounds.right<this.right))||((this.right>bounds.left)&&(this.right<bounds.right)));var inLeft=(bounds.right==this.right&&bounds.left==this.left)?true:(((bounds.left>this.left)&&(bounds.left<this.right))||((this.left>bounds.left)&&(this.left<bounds.right)));return(this.containsBounds(bounds,true,inclusive)||bounds.containsBounds(this,true,inclusive)||((inTop||inBottom)&&(inLeft||inRight)));},containsBounds:function(bounds,partial,inclusive){if(partial==null){partial=false;}
if(inclusive==null){inclusive=true;}
var inLeft;var inTop;var inRight;var inBottom;if(inclusive){inLeft=(bounds.left>=this.left)&&(bounds.left<=this.right);inTop=(bounds.top>=this.bottom)&&(bounds.top<=this.top);inRight=(bounds.right>=this.left)&&(bounds.right<=this.right);inBottom=(bounds.bottom>=this.bottom)&&(bounds.bottom<=this.top);}else{inLeft=(bounds.left>this.left)&&(bounds.left<this.right);inTop=(bounds.top>this.bottom)&&(bounds.top<this.top);inRight=(bounds.right>this.left)&&(bounds.right<this.right);inBottom=(bounds.bottom>this.bottom)&&(bounds.bottom<this.top);}
return(partial)?(inTop||inBottom)&&(inLeft||inRight):(inTop&&inLeft&&inBottom&&inRight);},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;},CLASS_NAME:"OpenLayers.Bounds"};OpenLayers.Bounds.fromString=function(str){var bounds=str.split(",");return OpenLayers.Bounds.fromArray(bounds);};OpenLayers.Bounds.fromArray=function(bbox){return new OpenLayers.Bounds(parseFloat(bbox[0]),parseFloat(bbox[1]),parseFloat(bbox[2]),parseFloat(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 $(element).style.display!='none';},toggle:function(){for(var i=0;i<arguments.length;i++){var element=$(arguments[i]);OpenLayers.Element[OpenLayers.Element.visible(element)?'hide':'show'](element);}},hide:function(){for(var i=0;i<arguments.length;i++){var element=$(arguments[i]);element.style.display='none';}},show:function(){for(var i=0;i<arguments.length;i++){var element=$(arguments[i]);element.style.display='';}},remove:function(element){element=$(element);element.parentNode.removeChild(element);},getHeight:function(element){element=$(element);return element.offsetHeight;},getDimensions:function(element){element=$(element);if(OpenLayers.Element.getStyle(element,'display')!='none')
return{width:element.offsetWidth,height:element.offsetHeight};var els=element.style;var originalVisibility=els.visibility;var originalPosition=els.position;els.visibility='hidden';els.position='absolute';els.display='';var originalWidth=element.clientWidth;var originalHeight=element.clientHeight;els.display='none';els.position=originalPosition;els.visibility=originalVisibility;return{width:originalWidth,height:originalHeight};},getStyle:function(element,style){element=$(element);var value=element.style[style.camelize()];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[style.camelize()];}}
if(window.opera&&OpenLayers.Util.indexOf(['left','top','right','bottom'],style)!=-1)
if(OpenLayers.Element.getStyle(element,'position')=='static')value='auto';return value=='auto'?null:value;}};String.prototype.startsWith=function(sStart){return(this.substr(0,sStart.length)==sStart);};String.prototype.contains=function(str){return(this.indexOf(str)!=-1);};String.prototype.trim=function(){var b=0;while(this.substr(b,1)==" "){b++;}
var e=this.length-1;while(this.substr(e,1)==" "){e--;}
return this.substring(b,e+1);};String.indexOf=function(object){for(var i=0;i<this.length;i++)
if(this[i]==object)return i;return-1;};String.prototype.camelize=function(){var oStringList=this.split('-');if(oStringList.length==1)return oStringList[0];var camelizedString=this.indexOf('-')==0?oStringList[0].charAt(0).toUpperCase()+oStringList[0].substring(1):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;};Number.prototype.limitSigDigs=function(sig){var number=(sig>0)?this.toString():0;if(sig<number.length){var exp=number.length-sig;number=Math.round(this/Math.pow(10,exp))*Math.pow(10,exp);}
return parseInt(number);}
Function.prototype.bind=function(){var __method=this,args=[],object=arguments[0];for(var i=1;i<arguments.length;i++)
args.push(arguments[i]);return function(moreargs){for(var i=0;i<arguments.length;i++)
args.push(arguments[i]);return __method.apply(object,args);}};Function.prototype.bindAsEventListener=function(object){var __method=this;return function(event){return __method.call(object,event||window.event);}};OpenLayers.Util=new Object();if($==null){var $=function(){var elements=new Array();for(var i=0;i<arguments.length;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.extend=function(destination,source){for(property in source){destination[property]=source[property];}
return destination;};OpenLayers.Util.removeItem=function(array,item){for(var i=0;i<array.length;i++){if(array[i]==item){array.splice(i,1);}}
return array;};OpenLayers.Util.clearArray=function(array){array.length=0;};OpenLayers.Util.indexOf=function(array,obj){for(var i=0;i<array.length;i++){if(array[i]==obj)return i;}
return-1;};OpenLayers.Util.modifyDOMElement=function(element,id,px,sz,position,border,overflow,opacity){if(id){element.id=id;}
if(px){element.style.left=px.x+"px";element.style.top=px.y+"px";}
if(sz){element.style.width=sz.w+"px";element.style.height=sz.h+"px";}
if(position){element.style.position=position;}
if(border){element.style.border=border;}
if(overflow){element.style.overflow=overflow;}
if(opacity){element.style.opacity=opacity;element.style.filter='alpha(opacity='+(opacity*100)+')';}};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){image=document.createElement("img");if(delayDisplay){image.style.display="none";OpenLayers.Event.observe(image,"load",OpenLayers.Util.onImageLoad.bindAsEventListener(image));OpenLayers.Event.observe(image,"error",OpenLayers.Util.onImageLoadError.bindAsEventListener(image));}
image.style.alt=id;image.galleryImg="no";if(imgURL){image.src=imgURL;}
if(!id){id=OpenLayers.Util.createUniqueID("OpenLayersDiv");}
if(!position){position="relative";}
OpenLayers.Util.modifyDOMElement(image,id,px,sz,position,border,null,opacity);return image;};OpenLayers.Util.setOpacity=function(element,opacity){OpenLayers.Util.modifyDOMElement(element,null,null,null,null,null,null,opacity);}
OpenLayers.Util.onImageLoad=function(){this.style.backgroundColor=null;this.style.display="";};OpenLayers.Util.onImageLoadErrorColor="pink";OpenLayers.Util.onImageLoadError=function(){this.style.backgroundColor=OpenLayers.Util.onImageLoadErrorColor;this.style.display="";};OpenLayers.Util.alphaHack=function(){var arVersion=navigator.appVersion.split("MSIE");var version=parseFloat(arVersion[1]);var filter=false;try{filter=document.body.filters;}catch(e){}
return(filter&&(version>=5.5)&&(version<7));}
OpenLayers.Util.modifyAlphaImageDiv=function(div,id,px,sz,imgURL,position,border,sizing,opacity){OpenLayers.Util.modifyDOMElement(div,id,px,sz);var img=div.childNodes[0];if(imgURL){img.src=imgURL;}
OpenLayers.Util.modifyDOMElement(img,div.id+"_innerImage",null,sz,"relative",border);if(opacity){div.style.opacity=opacity;div.style.filter='alpha(opacity='+(opacity*100)+')';}
if(OpenLayers.Util.alphaHack()){div.style.display="inline-block";if(sizing==null){sizing="scale";}
div.style.filter="progid:DXImageTransform.Microsoft"+".AlphaImageLoader(src='"+img.src+"', "+"sizingMethod='"+sizing+"')";if(div.style.opacity){div.style.filter+=" alpha(opacity="+div.style.opacity*100+")";}
img.style.filter="progid:DXImageTransform.Microsoft"+".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,false);div.appendChild(img);if(delayDisplay){img.style.display="none";OpenLayers.Event.observe(img,"load",OpenLayers.Util.onImageLoad.bindAsEventListener(div));OpenLayers.Event.observe(img,"error",OpenLayers.Util.onImageLoadError.bindAsEventListener(div));}
OpenLayers.Util.modifyAlphaImageDiv(div,id,px,sz,imgURL,position,border,sizing,opacity);return div;};OpenLayers.Util.upperCaseObject=function(object){var uObject=new Object();for(var key in object){uObject[key.toUpperCase()]=object[key];}
return uObject;};OpenLayers.Util.applyDefaults=function(to,from){for(var key in from){if(to[key]==null){to[key]=from[key];}}};OpenLayers.Util.getParameterString=function(params){paramsArray=new Array();for(var key in params){var value=params[key];if((value!=null)&&(typeof value!='function')){paramsArray.push(key+"="+value);}}
return paramsArray.join("&");};OpenLayers.ImgPath='';OpenLayers.Util.getImagesLocation=function(){return OpenLayers.ImgPath||(OpenLayers._getScriptLocation()+"img/");};OpenLayers.Util.Try=function(){var returnValue;for(var i=0;i<arguments.length;i++){var lambda=arguments[i];try{returnValue=lambda();break;}catch(e){}}
return returnValue;}
OpenLayers.Util.getNodes=function(p,tagName){var nodes=OpenLayers.Util.Try(function(){return OpenLayers.Util._getNodes(p.documentElement.childNodes,tagName);},function(){return OpenLayers.Util._getNodes(p.childNodes,tagName);});return nodes;};OpenLayers.Util._getNodes=function(nodes,tagName){var retArray=new Array();for(var i=0;i<nodes.length;i++){if(nodes[i].nodeName==tagName){retArray.push(nodes[i]);}}
return retArray;};OpenLayers.Util.getTagText=function(parent,item,index){var result=OpenLayers.Util.getNodes(parent,item);if(result&&(result.length>0))
{if(!index){index=0;}
if(result[index].childNodes.length>1){return result.childNodes[1].nodeValue;}
else if(result[index].childNodes.length==1){return result[index].firstChild.nodeValue;}}else{return"";}};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.rad=function(x){return x*Math.PI/180;};OpenLayers.Util.distVincenty=function(p1,p2){var a=6378137,b=6356752.3142,f=1/298.257223563;var L=OpenLayers.Util.rad(p2.lon-p1.lon);var U1=Math.atan((1-f)*Math.tan(OpenLayers.Util.rad(p1.lat)));var U2=Math.atan((1-f)*Math.tan(OpenLayers.Util.rad(p2.lat)));var sinU1=Math.sin(U1),cosU1=Math.cos(U1);var sinU2=Math.sin(U2),cosU2=Math.cos(U2);var lambda=L,lambdaP=2*Math.PI;var iterLimit=20;while(Math.abs(lambda-lambdaP)>1e-12&&--iterLimit>0){var sinLambda=Math.sin(lambda),cosLambda=Math.cos(lambda);var sinSigma=Math.sqrt((cosU2*sinLambda)*(cosU2*sinLambda)+
(cosU1*sinU2-sinU1*cosU2*cosLambda)*(cosU1*sinU2-sinU1*cosU2*cosLambda));if(sinSigma==0)return 0;var cosSigma=sinU1*sinU2+cosU1*cosU2*cosLambda;var sigma=Math.atan2(sinSigma,cosSigma);var alpha=Math.asin(cosU1*cosU2*sinLambda/sinSigma);var cosSqAlpha=Math.cos(alpha)*Math.cos(alpha);var cos2SigmaM=cosSigma-2*sinU1*sinU2/cosSqAlpha;var C=f/16*cosSqAlpha*(4+f*(4-3*cosSqAlpha));lambdaP=lambda;lambda=L+(1-C)*f*Math.sin(alpha)*(sigma+C*sinSigma*(cos2SigmaM+C*cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)));}
if(iterLimit==0)return NaN
var uSq=cosSqAlpha*(a*a-b*b)/(b*b);var A=1+uSq/16384*(4096+uSq*(-768+uSq*(320-175*uSq)));var B=uSq/1024*(256+uSq*(-128+uSq*(74-47*uSq)));var deltaSigma=B*sinSigma*(cos2SigmaM+B/4*(cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)-
B/6*cos2SigmaM*(-3+4*sinSigma*sinSigma)*(-3+4*cos2SigmaM*cos2SigmaM)));var s=b*A*(sigma-deltaSigma);var d=s.toFixed(3)/1000;return d;};OpenLayers.Util.getArgs=function(){var args=new Object();var query=location.search.substring(1);var pairs=query.split("&");for(var i=0;i<pairs.length;i++){var pos=pairs[i].indexOf('=');if(pos==-1)continue;var argname=pairs[i].substring(0,pos);var value=pairs[i].substring(pos+1);args[argname]=unescape(value);}
return args;};OpenLayers.Util.createUniqueID=function(prefix){if(prefix==null){prefix="id_";}
return prefix+Math.round(Math.random()*10000);};OpenLayers.INCHES_PER_UNIT={'inches':1.0,'ft':12.0,'mi':63360.0,'m':39.3701,'km':39370.1,'dd':4374754};OpenLayers.INCHES_PER_UNIT["in"]=OpenLayers.INCHES_PER_UNIT.inches;OpenLayers.INCHES_PER_UNIT["degrees"]=OpenLayers.INCHES_PER_UNIT.dd;OpenLayers.DOTS_PER_INCH=72;OpenLayers.Util.normalizeScale=function(scale){var normScale=(scale>1.0)?(1.0/scale):scale;return normScale;};OpenLayers.Util.getResolutionFromScale=function(scale,units){if(units==null){units="degrees";}
var normScale=OpenLayers.Util.normalizeScale(scale);var 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.safeStopPropagation=function(evt){if(evt.stopPropagation){evt.stopPropagation();}
evt.cancelBubble=true;};OpenLayers.Util.pagePosition=function(forElement){var valueT=0,valueL=0;var element=forElement;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body)
if(OpenLayers.Element.getStyle(element,'position')=='absolute')break;}while(element=element.offsetParent);element=forElement;do{valueT-=element.scrollTop||0;valueL-=element.scrollLeft||0;}while(element=element.parentNode);return[valueL,valueT];};OpenLayers.Util.distance2Pts=function(x1,y1,x2,y2){return(Math.sqrt(Math.pow(x1-x2,2)+Math.pow(y1-y2,2)));};var Rico=new Object();Rico.Corner={round:function(e,options){var e=$(e);this._setOptions(options);var color=this.options.color;if(this.options.color=="fromElement")
color=this._background(e);var bgColor=this.options.bgColor;if(this.options.bgColor=="fromParent")
bgColor=this._background(e.offsetParent);this._roundCornersImpl(e,color,bgColor);},changeColor:function(theDiv,newColor){theDiv.style.backgroundColor=newColor;var spanElements=theDiv.parentNode.getElementsByTagName("span");for(var currIdx=0;currIdx<spanElements.length;currIdx++){spanElements[currIdx].style.backgroundColor=newColor;}},changeOpacity:function(theDiv,newOpacity){var mozillaOpacity=newOpacity;var ieOpacity='alpha(opacity='+newOpacity*100+')';theDiv.style.opacity=mozillaOpacity;theDiv.style.filter=ieOpacity;var spanElements=theDiv.parentNode.getElementsByTagName("span");for(var currIdx=0;currIdx<spanElements.length;currIdx++){spanElements[currIdx].style.opacity=mozillaOpacity;spanElements[currIdx].style.filter=ieOpacity;}},reRound:function(theDiv,options){var topRico=theDiv.parentNode.childNodes[0];var bottomRico=theDiv.parentNode.childNodes[2];theDiv.parentNode.removeChild(topRico);theDiv.parentNode.removeChild(bottomRico);this.round(theDiv.parentNode,options);},_roundCornersImpl:function(e,color,bgColor){if(this.options.border)
this._renderBorder(e,bgColor);if(this._isTopRounded())
this._roundTopCorners(e,color,bgColor);if(this._isBottomRounded())
this._roundBottomCorners(e,color,bgColor);},_renderBorder:function(el,bgColor){var borderValue="1px solid "+this._borderColor(bgColor);var borderL="border-left: "+borderValue;var borderR="border-right: "+borderValue;var style="style='"+borderL+";"+borderR+"'";el.innerHTML="<div "+style+">"+el.innerHTML+"</div>"},_roundTopCorners:function(el,color,bgColor){var corner=this._createCorner(bgColor);for(var i=0;i<this.options.numSlices;i++)
corner.appendChild(this._createCornerSlice(color,bgColor,i,"top"));el.style.paddingTop=0;el.insertBefore(corner,el.firstChild);},_roundBottomCorners:function(el,color,bgColor){var corner=this._createCorner(bgColor);for(var i=(this.options.numSlices-1);i>=0;i--)
corner.appendChild(this._createCornerSlice(color,bgColor,i,"bottom"));el.style.paddingBottom=0;el.appendChild(corner);},_createCorner:function(bgColor){var corner=document.createElement("div");corner.style.backgroundColor=(this._isTransparent()?"transparent":bgColor);return corner;},_createCornerSlice:function(color,bgColor,n,position){var slice=document.createElement("span");var inStyle=slice.style;inStyle.backgroundColor=color;inStyle.display="block";inStyle.height="1px";inStyle.overflow="hidden";inStyle.fontSize="1px";var borderColor=this._borderColor(color,bgColor);if(this.options.border&&n==0){inStyle.borderTopStyle="solid";inStyle.borderTopWidth="1px";inStyle.borderLeftWidth="0px";inStyle.borderRightWidth="0px";inStyle.borderBottomWidth="0px";inStyle.height="0px";inStyle.borderColor=borderColor;}
else if(borderColor){inStyle.borderColor=borderColor;inStyle.borderStyle="solid";inStyle.borderWidth="0px 1px";}
if(!this.options.compact&&(n==(this.options.numSlices-1)))
inStyle.height="2px";this._setMargin(slice,n,position);this._setBorder(slice,n,position);return slice;},_setOptions:function(options){this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:true,border:false,compact:false}
OpenLayers.Util.extend(this.options,options||{});this.options.numSlices=this.options.compact?2:4;if(this._isTransparent())
this.options.blend=false;},_whichSideTop:function(){if(this._hasString(this.options.corners,"all","top"))
return"";if(this.options.corners.indexOf("tl")>=0&&this.options.corners.indexOf("tr")>=0)
return"";if(this.options.corners.indexOf("tl")>=0)
return"left";else if(this.options.corners.indexOf("tr")>=0)
return"right";return"";},_whichSideBottom:function(){if(this._hasString(this.options.corners,"all","bottom"))
return"";if(this.options.corners.indexOf("bl")>=0&&this.options.corners.indexOf("br")>=0)
return"";if(this.options.corners.indexOf("bl")>=0)
return"left";else if(this.options.corners.indexOf("br")>=0)
return"right";return"";},_borderColor:function(color,bgColor){if(color=="transparent")
return bgColor;else if(this.options.border)
return this.options.border;else if(this.options.blend)
return this._blend(bgColor,color);else
return"";},_setMargin:function(el,n,corners){var marginSize=this._marginSize(n);var whichSide=corners=="top"?this._whichSideTop():this._whichSideBottom();if(whichSide=="left"){el.style.marginLeft=marginSize+"px";el.style.marginRight="0px";}
else if(whichSide=="right"){el.style.marginRight=marginSize+"px";el.style.marginLeft="0px";}
else{el.style.marginLeft=marginSize+"px";el.style.marginRight=marginSize+"px";}},_setBorder:function(el,n,corners){var borderSize=this._borderSize(n);var whichSide=corners=="top"?this._whichSideTop():this._whichSideBottom();if(whichSide=="left"){el.style.borderLeftWidth=borderSize+"px";el.style.borderRightWidth="0px";}
else if(whichSide=="right"){el.style.borderRightWidth=borderSize+"px";el.style.borderLeftWidth="0px";}
else{el.style.borderLeftWidth=borderSize+"px";el.style.borderRightWidth=borderSize+"px";}
if(this.options.border!=false)
el.style.borderLeftWidth=borderSize+"px";el.style.borderRightWidth=borderSize+"px";},_marginSize:function(n){if(this._isTransparent())
return 0;var marginSizes=[5,3,2,1];var blendedMarginSizes=[3,2,1,0];var compactMarginSizes=[2,1];var smBlendedMarginSizes=[1,0];if(this.options.compact&&this.options.blend)
return smBlendedMarginSizes[n];else if(this.options.compact)
return compactMarginSizes[n];else if(this.options.blend)
return blendedMarginSizes[n];else
return marginSizes[n];},_borderSize:function(n){var transparentBorderSizes=[5,3,2,1];var blendedBorderSizes=[2,1,1,1];var compactBorderSizes=[1,0];var actualBorderSizes=[0,2,0,0];if(this.options.compact&&(this.options.blend||this._isTransparent()))
return 1;else if(this.options.compact)
return compactBorderSizes[n];else if(this.options.blend)
return blendedBorderSizes[n];else if(this.options.border)
return actualBorderSizes[n];else if(this._isTransparent())
return transparentBorderSizes[n];return 0;},_hasString:function(str){for(var i=1;i<arguments.length;i++)if(str.indexOf(arguments[i])>=0)return true;return false;},_blend:function(c1,c2){var cc1=Rico.Color.createFromHex(c1);cc1.blend(Rico.Color.createFromHex(c2));return cc1;},_background:function(el){try{return Rico.Color.createColorFromBackground(el).asHex();}catch(err){return"#ffffff";}},_isTransparent:function(){return this.options.color=="transparent";},_isTopRounded:function(){return this._hasString(this.options.corners,"all","top","tl","tr");},_isBottomRounded:function(){return this._hasString(this.options.corners,"all","bottom","bl","br");},_hasSingleTextChild:function(el){return el.childNodes.length==1&&el.childNodes[0].nodeType==3;}}
OpenLayers.ProxyHost="";OpenLayers.nullHandler=function(request){alert("Unhandled request return "+request.statusText);};OpenLayers.loadURL=function(uri,params,caller,onComplete,onFailure){if(OpenLayers.ProxyHost&&uri.startsWith("http")){uri=OpenLayers.ProxyHost+escape(uri);}
var success=(onComplete)?onComplete.bind(caller):OpenLayers.nullHandler;var failure=(onFailure)?onFailure.bind(caller):OpenLayers.nullHandler;new OpenLayers.Ajax.Request(uri,{method:'get',parameters:params,onComplete:success,onFailure:failure});};OpenLayers.serializeXMLNode=function(node){var serializer=new XMLSerializer();return serializer.serializeToString(node);};OpenLayers.parseXMLString=function(text){var index=text.indexOf('<');if(index>0){text=text.substring(index);}
var ajaxResponse=OpenLayers.Util.Try(function(){var xmldom=new ActiveXObject('Microsoft.XMLDOM');xmldom.loadXML(text);return xmldom;},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;});return ajaxResponse;};OpenLayers.Ajax={emptyFunction:function(){},getTransport:function(){return OpenLayers.Util.Try(function(){return new ActiveXObject('Msxml2.XMLHTTP')},function(){return new ActiveXObject('Microsoft.XMLHTTP')},function(){return new XMLHttpRequest()})||false;},activeRequestCount:0};OpenLayers.Ajax.Responders={responders:[],register:function(responderToAdd){for(var i=0;i<this.responders.length;i++)
if(responderToAdd==this.responders[i])
return;this.responders.push(responderToAdd);},dispatch:function(callback,request,transport,json){for(var i=0;i<this.responders.length;i++){responder=this.responders[i];if(responder[callback]&&typeof responder[callback]=='function'){try{responder[callback].apply(responder,[request,transport,json]);}catch(e){}}}}};OpenLayers.Ajax.Responders.register({onCreate:function(){OpenLayers.Ajax.activeRequestCount++;},onComplete:function(){OpenLayers.Ajax.activeRequestCount--;}});OpenLayers.Ajax.Base=function(){};OpenLayers.Ajax.Base.prototype={setOptions:function(options){this.options={method:'post',asynchronous:true,parameters:''}
OpenLayers.Util.extend(this.options,options||{});},responseIsSuccess:function(){return this.transport.status==undefined||this.transport.status==0||(this.transport.status>=200&&this.transport.status<300);},responseIsFailure:function(){return!this.responseIsSuccess();}}
OpenLayers.Ajax.Request=OpenLayers.Class.create();OpenLayers.Ajax.Request.Events=['Uninitialized','Loading','Loaded','Interactive','Complete'];OpenLayers.Ajax.Request.prototype=OpenLayers.Class.inherit(OpenLayers.Ajax.Base,{initialize:function(url,options){this.transport=OpenLayers.Ajax.getTransport();this.setOptions(options);this.request(url);},request:function(url){var parameters=this.options.parameters||'';try{this.url=url;if(this.options.method=='get'&&parameters.length>0)
this.url+=(this.url.match(/\?/)?'&':'?')+parameters;OpenLayers.Ajax.Responders.dispatch('onCreate',this,this.transport);this.transport.open(this.options.method,this.url,this.options.asynchronous);if(this.options.asynchronous){this.transport.onreadystatechange=this.onStateChange.bind(this);setTimeout((function(){this.respondToReadyState(1)}).bind(this),10);}
this.setRequestHeaders();var body=this.options.postBody?this.options.postBody:parameters;this.transport.send(this.options.method=='post'?body:null);}catch(e){this.dispatchException(e);}},setRequestHeaders:function(){var requestHeaders=['X-Requested-With','XMLHttpRequest','X-Prototype-Version','OpenLayers'];if(this.options.method=='post'){requestHeaders.push('Content-type','application/x-www-form-urlencoded');if(this.transport.overrideMimeType)
requestHeaders.push('Connection','close');}
if(this.options.requestHeaders)
requestHeaders.push.apply(requestHeaders,this.options.requestHeaders);for(var i=0;i<requestHeaders.length;i+=2)
this.transport.setRequestHeader(requestHeaders[i],requestHeaders[i+1]);},onStateChange:function(){var readyState=this.transport.readyState;if(readyState!=1)
this.respondToReadyState(this.transport.readyState);},header:function(name){try{return this.transport.getResponseHeader(name);}catch(e){}},evalJSON:function(){try{return eval(this.header('X-JSON'));}catch(e){}},evalResponse:function(){try{return eval(this.transport.responseText);}catch(e){this.dispatchException(e);}},respondToReadyState:function(readyState){var event=OpenLayers.Ajax.Request.Events[readyState];var transport=this.transport,json=this.evalJSON();if(event=='Complete'){try{(this.options['on'+this.transport.status]||this.options['on'+(this.responseIsSuccess()?'Success':'Failure')]||OpenLayers.Ajax.emptyFunction)(transport,json);}catch(e){this.dispatchException(e);}
if((this.header('Content-type')||'').match(/^text\/javascript/i))
this.evalResponse();}
try{(this.options['on'+event]||OpenLayers.Ajax.emptyFunction)(transport,json);OpenLayers.Ajax.Responders.dispatch('on'+event,this,transport,json);}catch(e){this.dispatchException(e);}
if(event=='Complete')
this.transport.onreadystatechange=OpenLayers.Ajax.emptyFunction;},dispatchException:function(exception){(this.options.onException||OpenLayers.Ajax.emptyFunction)(this,exception);OpenLayers.Ajax.Responders.dispatch('onException',this,exception);}});OpenLayers.Ajax.getElementsByTagNameNS=function(parentnode,nsuri,nsprefix,tagname){return parentnode.getElementsByTagNameNS?parentnode.getElementsByTagNameNS(nsuri,tagname):parentnode.getElementsByTagName(nsprefix+':'+tagname);}
OpenLayers.Attributes=OpenLayers.Class.create();OpenLayers.Attributes.prototype={attributes:null,initialize:function(attributes){this.addAttributes(attributes);},destroy:function(){this.attributes=null;},addAttributes:function(attributes){if(!(attributes instanceof Array)){attributes=[attributes];}
if(this.attributes){this.attributes=this.attributes.concat(attributes);}else{this.attributes=[].concat(attributes);}},getAttributes:function(){if(this.attributes){return this.attributes;}else{return new Array();}},CLASS_NAME:"OpenLayers.Attributes"};OpenLayers.Control=OpenLayers.Class.create();OpenLayers.Control.prototype={id:null,map:null,div:null,position:null,mouseDragStart:null,initialize:function(options){OpenLayers.Util.extend(this,options);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");},destroy:function(){this.map=null;},setMap:function(map){this.map=map;},draw:function(px){if(this.div==null){this.div=OpenLayers.Util.createDiv();this.div.id=this.id;this.div.className='olControl';}
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";}},CLASS_NAME:"OpenLayers.Control"};OpenLayers.Control.EditingMode=OpenLayers.Class.create();OpenLayers.Control.EditingMode.prototype={initialize:function(){},calculatePoint:function(evtGeometry,currentGeometry,mouseCoordinates){},CLASS_NAME:"OpenLayers.Control.EditingMode"}
OpenLayers.Control.OverviewMap=OpenLayers.Class.create();OpenLayers.Control.OverviewMap.prototype=OpenLayers.Class.inherit(OpenLayers.Control,{id:"OverviewMap",element:null,ovmap:null,layers:[],minRatio:8,maxRatio:32,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,[options]);},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!(this.layers.length>0)){if(this.map.baseLayer){var layer=this.map.baseLayer.clone();this.layers=[layer];}else{this.map.events.register("changebaselayer",this,this.baseLayerDraw);return this.div;}}
this.element=document.createElement('div');this.element.className='olControlOverviewMapElement';this.element.style.display='none';this.mapDiv=document.createElement('div');this.mapDiv.style.width='180px';this.mapDiv.style.height='90px';this.mapDiv.style.position='relative';this.mapDiv.style.overflow='hidden';this.mapDiv.id=OpenLayers.Util.createUniqueID('overviewMap');this.extentRectangle=document.createElement('div');this.extentRectangle.style.position='absolute';this.extentRectangle.style.zIndex=1000;this.extentRectangle.style.backgroundImage='url('+
OpenLayers.Util.getImagesLocation()+'/blank.png)';this.extentRectangle.className='olControlOverviewMapExtentRectangle';this.mapDiv.appendChild(this.extentRectangle);this.element.appendChild(this.mapDiv);this.div.appendChild(this.element);this.div.className='olControlOverviewMapContainer';this.map.events.register('moveend',this,this.update);this.elementEvents=new OpenLayers.Events(this,this.element);this.elementEvents.register('mousedown',this,function(e){OpenLayers.Event.stop(e);});this.elementEvents.register('click',this,function(e){OpenLayers.Event.stop(e);});this.elementEvents.register('dblclick',this,function(e){OpenLayers.Event.stop(e);});this.rectEvents=new OpenLayers.Events(this,this.extentRectangle);this.rectEvents.register('mouseover',this,this.rectMouseOver);this.rectEvents.register('mouseout',this,this.rectMouseOut);this.rectEvents.register('mousedown',this,this.rectMouseDown);this.rectEvents.register('mousemove',this,this.rectMouseMove);this.rectEvents.register('mouseup',this,this.rectMouseUp);this.rectEvents.register('click',this,function(e){OpenLayers.Event.stop(e);});this.rectEvents.register('dblclick',this,this.rectDblClick);this.mapDivEvents=new OpenLayers.Events(this,this.mapDiv);this.mapDivEvents.register('click',this,this.mapDivClick);var imgLocation=OpenLayers.Util.getImagesLocation();var img=imgLocation+'layer-switcher-maximize.png';this.maximizeDiv=OpenLayers.Util.createAlphaImageDiv('olControlOverviewMapMaximizeButton',null,new OpenLayers.Size(18,18),img,'absolute');this.maximizeDiv.style.display='none';this.maximizeDiv.className='olControlOverviewMapMaximizeButton';OpenLayers.Event.observe(this.maximizeDiv,'click',this.maximizeControl.bindAsEventListener(this));this.div.appendChild(this.maximizeDiv);var img=imgLocation+'layer-switcher-minimize.png';this.minimizeDiv=OpenLayers.Util.createAlphaImageDiv('OpenLayers_Control_minimizeDiv',null,new OpenLayers.Size(18,18),img,'absolute');this.minimizeDiv.style.display='none';this.minimizeDiv.className='olControlOverviewMapMinimizeButton';OpenLayers.Event.observe(this.minimizeDiv,'click',this.minimizeControl.bindAsEventListener(this));this.div.appendChild(this.minimizeDiv);this.minimizeControl();return this.div;},baseLayerDraw:function(){this.draw();this.map.events.unregister("changebaselayer",this,this.baseLayerDraw);},rectMouseOver:function(evt){this.extentRectangle.style.cursor='move';},rectMouseOut:function(evt){this.extentRectangle.style.cursor='default';if(this.rectDragStart!=null){if(this.performedRectDrag){this.updateMapToRect();}
document.onselectstart=null;this.rectDragStart=null;}},rectMouseDown:function(evt){if(!OpenLayers.Event.isLeftClick(evt))return;this.rectDragStart=evt.xy.clone();this.performedRectDrag=false;OpenLayers.Event.stop(evt);},rectMouseMove:function(evt){if(this.rectDragStart!=null){var deltaX=this.rectDragStart.x-evt.xy.x;var deltaY=this.rectDragStart.y-evt.xy.y;var rectPxBounds=this.getRectPxBounds();var rectTop=rectPxBounds.top;var rectLeft=rectPxBounds.left;var rectHeight=Math.abs(rectPxBounds.getHeight());var rectWidth=rectPxBounds.getWidth();var newTop=Math.max(0,(rectTop-deltaY));newTop=Math.min(newTop,this.ovmap.size.h-this.hComp-rectHeight);var newLeft=Math.max(0,(rectLeft-deltaX));newLeft=Math.min(newLeft,this.ovmap.size.w-this.wComp-rectWidth);this.setRectPxBounds(new OpenLayers.Bounds(newLeft,newTop+rectHeight,newLeft+rectWidth,newTop));this.rectDragStart=evt.xy.clone();this.performedRectDrag=true;OpenLayers.Event.stop(evt);}},rectMouseUp:function(evt){if(!OpenLayers.Event.isLeftClick(evt))return;if(this.performedRectDrag){this.updateMapToRect();OpenLayers.Event.stop(evt);}
document.onselectstart=null;this.rectDragStart=null;},rectDblClick:function(evt){this.performedRectDrag=false;OpenLayers.Event.stop(evt);this.updateOverview();},mapDivClick:function(evt){var pxBounds=this.getRectPxBounds();var pxCenter=pxBounds.getCenterPixel();var deltaX=evt.xy.x-pxCenter.x;var deltaY=evt.xy.y-pxCenter.y;var top=pxBounds.top;var left=pxBounds.left;var height=Math.abs(pxBounds.getHeight());var width=pxBounds.getWidth();var newTop=Math.max(0,(top+deltaY));newTop=Math.min(newTop,this.ovmap.size.h-height);var newLeft=Math.max(0,(left+deltaX));newLeft=Math.min(newLeft,this.ovmap.size.w-width);this.setRectPxBounds(new OpenLayers.Bounds(newLeft,newTop+height,newLeft+width,newTop));this.updateMapToRect();OpenLayers.Event.stop(evt);},maximizeControl:function(e){this.element.style.display='';this.showToggle(false);if(e!=null){OpenLayers.Event.stop(e);}},minimizeControl:function(e){this.element.style.display='none';this.showToggle(true);if(e!=null){OpenLayers.Event.stop(e);}},showToggle:function(minimize){this.maximizeDiv.style.display=minimize?'':'none';this.minimizeDiv.style.display=minimize?'none':'';},update:function(){if(this.ovmap==null){this.createMap();}
if(!this.isSuitableOverview()){this.updateOverview();}
this.updateRectToMap();},isSuitableOverview:function(){var mapExtent=this.map.getExtent();var maxExtent=this.map.maxExtent;var testExtent=new OpenLayers.Bounds(Math.max(mapExtent.left,maxExtent.left),Math.max(mapExtent.bottom,maxExtent.bottom),Math.min(mapExtent.right,maxExtent.right),Math.min(mapExtent.top,maxExtent.top));var resRatio=this.ovmap.getResolution()/this.map.getResolution();return((resRatio>this.minRatio)&&(resRatio<=this.maxRatio)&&(this.ovmap.getExtent().containsBounds(testExtent)));},updateOverview:function(){var mapRes=this.map.getResolution();var targetRes=this.ovmap.getResolution();var resRatio=targetRes/mapRes;if(resRatio>this.maxRatio){targetRes=this.minRatio*mapRes;}else if(resRatio<=this.minRatio){targetRes=this.maxRatio*mapRes;}
this.ovmap.setCenter(this.map.center,this.ovmap.getZoomForResolution(targetRes));this.updateRectToMap();},createMap:function(){this.ovmap=new OpenLayers.Map(this.mapDiv.id,{controls:[],maxResolution:'auto'});this.ovmap.addLayers(this.layers);this.ovmap.zoomToMaxExtent();this.wComp=parseInt(OpenLayers.Element.getStyle(this.extentRectangle,'border-left-width'))+
parseInt(OpenLayers.Element.getStyle(this.extentRectangle,'border-right-width'));this.wComp=(this.wComp)?this.wComp:2;this.hComp=parseInt(OpenLayers.Element.getStyle(this.extentRectangle,'border-top-width'))+
parseInt(OpenLayers.Element.getStyle(this.extentRectangle,'border-bottom-width'));this.hComp=(this.hComp)?this.hComp:2;},updateRectToMap:function(){if(this.map.units!='degrees'){if(this.map.projection!=this.ovmap.map.projection){alert('The overview map only works when it is in the same projection as the main map');}}
var pxBounds=this.getRectBoundsFromMapBounds(this.map.getExtent());this.setRectPxBounds(pxBounds);},updateMapToRect:function(){var pxBounds=this.getRectPxBounds();var lonLatBounds=this.getMapBoundsFromRectBounds(pxBounds);this.map.setCenter(lonLatBounds.getCenterLonLat(),this.map.zoom);},getRectPxBounds:function(){var top=parseInt(this.extentRectangle.style.top);var left=parseInt(this.extentRectangle.style.left);var height=parseInt(this.extentRectangle.style.height);var width=parseInt(this.extentRectangle.style.width);return new OpenLayers.Bounds(left,top+height,left+width,top);},setRectPxBounds:function(pxBounds){var top=Math.max(pxBounds.top,0);var left=Math.max(pxBounds.left,0);var bottom=Math.min(pxBounds.top+Math.abs(pxBounds.getHeight()),this.ovmap.size.h-this.hComp);var right=Math.min(pxBounds.left+pxBounds.getWidth(),this.ovmap.size.w-this.wComp);this.extentRectangle.style.top=parseInt(top)+'px';this.extentRectangle.style.left=parseInt(left)+'px';this.extentRectangle.style.height=parseInt(bottom-top)+'px';this.extentRectangle.style.width=parseInt(right-left)+'px';},getRectBoundsFromMapBounds:function(lonLatBounds){var leftBottomLonLat=new OpenLayers.LonLat(lonLatBounds.left,lonLatBounds.bottom);var rightTopLonLat=new OpenLayers.LonLat(lonLatBounds.right,lonLatBounds.top);var leftBottomPx=this.getOverviewPxFromLonLat(leftBottomLonLat);var rightTopPx=this.getOverviewPxFromLonLat(rightTopLonLat);return new OpenLayers.Bounds(leftBottomPx.x,leftBottomPx.y,rightTopPx.x,rightTopPx.y);},getMapBoundsFromRectBounds:function(pxBounds){var leftBottomPx=new OpenLayers.Pixel(pxBounds.left,pxBounds.bottom);var rightTopPx=new OpenLayers.Pixel(pxBounds.right,pxBounds.top);var leftBottomLonLat=this.getLonLatFromOverviewPx(leftBottomPx);var rightTopLonLat=this.getLonLatFromOverviewPx(rightTopPx);return new OpenLayers.Bounds(leftBottomLonLat.lon,leftBottomLonLat.lat,rightTopLonLat.lon,rightTopLonLat.lat);},getLonLatFromOverviewPx:function(overviewMapPx){var size=this.ovmap.size;var res=this.ovmap.getResolution();var center=this.ovmap.getExtent().getCenterLonLat();var delta_x=overviewMapPx.x-(size.w/2);var delta_y=overviewMapPx.y-(size.h/2);return new OpenLayers.LonLat(center.lon+delta_x*res,center.lat-delta_y*res);},getOverviewPxFromLonLat:function(lonlat){var res=this.ovmap.getResolution();var extent=this.ovmap.getExtent();return new OpenLayers.Pixel(Math.round(1/res*(lonlat.lon-extent.left)),Math.round(1/res*(extent.top-lonlat.lat)));},CLASS_NAME:'OpenLayers.Control.OverviewMap'});OpenLayers.Event={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,KEY_SHIFT:16,KEY_CAPSLOCK:20,KEY_CTRL:16,element:function(event){return event.target||event.srcElement;},isLeftClick:function(event){return(((event.which)&&(event.which==1))||((event.button)&&(event.button==1)));},pointerX:function(event){return event.pageX||(event.clientX+
(document.documentElement.scrollLeft||document.body.scrollLeft));},pointerY:function(event){return event.pageY||(event.clientY+
(document.documentElement.scrollTop||document.body.scrollTop));},stop:function(event){if(event.preventDefault){event.preventDefault();event.stopPropagation();}else{event.returnValue=false;event.cancelBubble=true;}},findElement:function(event,tagName){var element=OpenLayers.Event.element(event);while(element.parentNode&&(!element.tagName||(element.tagName.toUpperCase()!=tagName.toUpperCase())))
element=element.parentNode;return element;},observers:false,_observeAndCache:function(element,name,observer,useCapture){if(!this.observers)this.observers=[];if(element.addEventListener){this.observers.push([element,name,observer,useCapture]);element.addEventListener(name,observer,useCapture);}else if(element.attachEvent){this.observers.push([element,name,observer,useCapture]);element.attachEvent('on'+name,observer);}},unloadCache:function(){if(!OpenLayers.Event.observers)return;for(var i=0;i<OpenLayers.Event.observers.length;i++){OpenLayers.Event.stopObserving.apply(this,OpenLayers.Event.observers[i]);OpenLayers.Event.observers[i][0]=null;}
OpenLayers.Event.observers=false;},observe:function(elementParam,name,observer,useCapture){var element=$(elementParam);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.attachEvent))
name='keydown';this._observeAndCache(element,name,observer,useCapture);},stopObserving:function(elementParam,name,observer,useCapture){var element=$(elementParam);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.detachEvent))
name='keydown';if(element.removeEventListener){element.removeEventListener(name,observer,useCapture);}else if(element.detachEvent){element.detachEvent('on'+name,observer);}}};OpenLayers.Event.observe(window,'unload',OpenLayers.Event.unloadCache,false);if(window.Event){OpenLayers.Util.extend(window.Event,OpenLayers.Event);}else{var Event=OpenLayers.Event;}
OpenLayers.Events=OpenLayers.Class.create();OpenLayers.Events.prototype={BROWSER_EVENTS:["mouseover","mouseout","mousedown","mouseup","mousemove","click","dblclick","resize","focus","blur"],listeners:null,object:null,element:null,eventTypes:null,initialize:function(object,element,eventTypes,fallThrough){this.object=object;this.element=element;this.eventTypes=eventTypes;this.fallThrough=fallThrough;this.listeners=new Object();if(this.eventTypes!=null)
for(var i=0;i<this.eventTypes.length;i++)
this.listeners[this.eventTypes[i]]=new Array();if(this.element!=null)
this.attachToElement(element);},attachToElement:function(element){for(var i=0;i<this.BROWSER_EVENTS.length;i++){var eventType=this.BROWSER_EVENTS[i];if(this.listeners[eventType]==null)
this.listeners[eventType]=new Array();OpenLayers.Event.observe(element,eventType,this.handleBrowserEvent.bindAsEventListener(this));}
OpenLayers.Event.observe(element,"dragstart",OpenLayers.Event.stop);},register:function(type,obj,func){if(func!=null){if(obj==null){obj=this.object;}
var listeners=this.listeners[type];if(listeners!=null){listeners.push({obj:obj,func:func});}}},unregister:function(type,obj,func){if(obj==null){obj=this.object;}
var listeners=this.listeners[type];if(listeners!=null){for(var i=0;i<listeners.length;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]=new Array();}},triggerEvent:function(type,evt){if(evt==null){evt=new Object();}
evt.object=this.object;evt.element=this.element;var listeners=this.listeners[type];if((listeners!=null)&&(listeners.length>0)){for(var i=0;i<listeners.length;i++){var callback=listeners[i];var continueChain;if(callback.obj!=null){continueChain=callback.func.call(callback.obj,evt);}else{continueChain=callback.func(evt);}
if((continueChain!=null)&&(continueChain==false)){break;}}
if(!this.fallThrough){OpenLayers.Util.safeStopPropagation(evt);}}},handleBrowserEvent:function(evt){evt.xy=this.getMousePosition(evt);this.object.getLonLatFromLayerPx(evt.xy)
this.triggerEvent(evt.type,evt)},getMousePosition:function(evt){if(!this.element.offsets){this.element.offsets=OpenLayers.Util.pagePosition(this.element);this.element.offsets[0]+=(document.documentElement.scrollLeft||document.body.scrollLeft);this.element.offsets[1]+=(document.documentElement.scrollTop||document.body.scrollTop);}
return new OpenLayers.Pixel((evt.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft))-this.element.offsets[0],(evt.clientY+(document.documentElement.scrollTop||document.body.scrollTop))-this.element.offsets[1]);},CLASS_NAME:"OpenLayers.Events"};OpenLayers.Geometry=OpenLayers.Class.create();OpenLayers.Geometry.prototype={style:null,bounds:null,feature:null,initialize:function(){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");},setBounds:function(bounds){this.bounds=bounds;},extendBounds:function(bounds){if(!this.bounds){this.setBounds(bounds);}else{this.bounds.extendBounds(bounds);}},getBounds:function(){return this.bounds;},atPoint:function(lonlat,toleranceLon,toleranceLat){var atPoint=false;toleranceLon=(toleranceLon)?toleranceLon:0;toleranceLat=(toleranceLat)?toleranceLat:0;if(this.bounds){atPoint=((this.bounds.bottom-toleranceLat)<=lonlat.lat)&&(lonlat.lat<=(this.bounds.top+toleranceLat))&&((this.bounds.left-toleranceLon)<=lonlat.lon)&&(lonlat.lon<=(this.bounds.right+toleranceLon));}
return atPoint;},CLASS_NAME:"OpenLayers.Geometry"};OpenLayers.Icon=OpenLayers.Class.create();OpenLayers.Icon.prototype={url:null,size:null,offset:null,calculateOffset:null,imageDiv:null,px:null,initialize:function(url,size,offset,calculateOffset){this.url=url;this.size=(size)?size:new OpenLayers.Size(20,20);this.offset=offset;this.calculateOffset=(calculateOffset)?calculateOffset:function(size){return new OpenLayers.Pixel(-(size.w/2),-(size.h/2));};this.imageDiv=OpenLayers.Util.createAlphaImageDiv();},destroy:function(){this.imageDiv=null;},clone:function(){return new OpenLayers.Icon(this.url,this.size,this.offset,this.calculateOffset);},setSize:function(size){if(size!=null){this.size=size;}
this.draw();},draw:function(px){OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,null,this.size,this.url,"absolute");this.moveTo(px);return this.imageDiv;},setOpacity:function(opacity){OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,null,null,null,null,null,null,opacity);},moveTo:function(px){if(px!=null){this.px=px;}
if(this.imageDiv!=null){if(this.px==null){this.display(false);}else{if(this.calculateOffset){this.offset=this.calculateOffset(this.size);}
var offsetPx=this.px.offset(this.offset);OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,offsetPx);this.display(true);}}},display:function(display){this.imageDiv.style.display=(display)?"":"none";},CLASS_NAME:"OpenLayers.Icon"};OpenLayers.Layer=OpenLayers.Class.create();OpenLayers.Layer.prototype={id:null,name:null,div:null,map:null,isBaseLayer:false,alpha:false,displayInLayerSwitcher:true,visibility:true,inRange:false,options:null,projection:null,units:null,scales:null,resolutions:null,maxExtent:null,minExtent:null,maxResolution:null,minResolution:null,numZoomLevels:null,minScale:null,maxScale:null,displayOutsideMaxExtent:false,initialize:function(name,options){this.options=OpenLayers.Util.extend(new Object(),options);OpenLayers.Util.extend(this,this.options);this.name=name;this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");if(this.div==null){this.div=OpenLayers.Util.createDiv();this.div.style.width="100%";this.div.style.height="100%";this.div.id=this.id;}},destroy:function(){if(this.map!=null){this.map.removeLayer(this);}
this.map=null;this.name=null;this.div=null;this.options=null;},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer(this.name,this.options);}
OpenLayers.Util.applyDefaults(obj,this);obj.map=null;return obj;},setName:function(newName){this.name=newName;if(this.map!=null)
this.map.events.triggerEvent("changelayer");},addOptions:function(newOptions){OpenLayers.Util.extend(this.options,newOptions);OpenLayers.Util.extend(this,newOptions);},onMapResize:function(){},moveTo:function(bounds,zoomChanged,dragging){var display=this.visibility;if(!this.isBaseLayer){display=display&&this.inRange;}
this.display(display);},setMap:function(map){this.map=map;this.maxExtent=this.maxExtent||this.map.maxExtent;this.projection=this.projection||this.map.projection;this.units=this.units||this.map.units;this.initResolutions();if(!this.isBaseLayer){this.inRange=this.calculateInRange();}},getVisibility:function(){return this.visibility;},setVisibility:function(visibility,noEvent){if(visibility!=this.visibility){this.visibility=visibility;this.display(visibility);if(this.map!=null){var extent=this.map.getExtent();if(extent!=null){this.moveTo(extent,true);}}
if((this.map!=null)&&((noEvent==null)||(noEvent==false))){this.map.events.triggerEvent("changelayer");}}},display:function(display){if(display!=(this.div.style.display!="none")){this.div.style.display=(display)?"block":"none";}},calculateInRange:function(){var inRange=false;if(this.map){var resolution=this.map.getResolution();inRange=((resolution>=this.minResolution)&&(resolution<=this.maxResolution));}
return inRange;},setIsBaseLayer:function(isBaseLayer){this.isBaseLayer=isBaseLayer;if(this.map!=null){this.map.events.triggerEvent("changelayer");}},initResolutions:function(){var props=new Array('projection','units','scales','resolutions','maxScale','minScale','maxResolution','minResolution','minExtent','maxExtent','numZoomLevels','maxZoomLevel');var confProps=new Object();for(var i=0;i<props.length;i++){var property=props[i];confProps[property]=this.options[property]||this.map[property];}
if((!confProps.numZoomLevels)&&(confProps.maxZoomLevel)){confProps.numZoomLevels=confProps.maxZoomLevel+1;}
if((confProps.scales!=null)||(confProps.resolutions!=null)){if(confProps.scales!=null){confProps.resolutions=new Array();for(var i=0;i<confProps.scales.length;i++){var scale=confProps.scales[i];confProps.resolutions[i]=OpenLayers.Util.getResolutionFromScale(scale,confProps.units);}}
confProps.numZoomLevels=confProps.resolutions.length;}else{confProps.resolutions=new Array();if(confProps.minScale){confProps.maxResolution=OpenLayers.Util.getResolutionFromScale(confProps.minScale,confProps.units);}else if(confProps.maxResolution=="auto"){var viewSize=this.map.getSize();var wRes=confProps.maxExtent.getWidth()/viewSize.w;var hRes=confProps.maxExtent.getHeight()/viewSize.h;confProps.maxResolution=Math.max(wRes,hRes);}
if(confProps.maxScale!=null){confProps.minResolution=OpenLayers.Util.getResolutionFromScale(confProps.maxScale);}else if((confProps.minResolution=="auto")&&(confProps.minExtent!=null)){var viewSize=this.map.getSize();var wRes=confProps.minExtent.getWidth()/viewSize.w;var hRes=confProps.minExtent.getHeight()/viewSize.h;confProps.minResolution=Math.max(wRes,hRes);}
if(confProps.minResolution!=null){var ratio=confProps.maxResolution/confProps.minResolution;confProps.numZoomLevels=Math.floor(Math.log(ratio)/Math.log(2))+1;}
for(var i=0;i<confProps.numZoomLevels;i++){var res=confProps.maxResolution/Math.pow(2,i)
confProps.resolutions.push(res);}}
confProps.resolutions.sort(function(a,b){return(b-a);});this.resolutions=confProps.resolutions;this.maxResolution=confProps.resolutions[0];var lastIndex=confProps.resolutions.length-1;this.minResolution=confProps.resolutions[lastIndex];this.scales=new Array();for(var i=0;i<confProps.resolutions.length;i++){this.scales[i]=OpenLayers.Util.getScaleFromResolution(confProps.resolutions[i],confProps.units);}
this.minScale=this.scales[0];this.maxScale=this.scales[this.scales.length-1];this.numZoomLevels=confProps.numZoomLevels;},getResolution:function(){var zoom=this.map.getZoom();return this.resolutions[zoom];},getExtent:function(){return this.map.calculateBounds();},getZoomForExtent:function(extent){var viewSize=this.map.getSize();var idealResolution=Math.max(extent.getWidth()/viewSize.w,extent.getHeight()/viewSize.h);return this.getZoomForResolution(idealResolution);},getZoomForResolution:function(resolution){for(var i=1;i<this.resolutions.length;i++){if(this.resolutions[i]<resolution){break;}}
return(i-1);},getLonLatFromViewPortPx:function(viewPortPx){var lonlat=null;if(viewPortPx!=null){var size=this.map.getSize();var center=this.map.getCenter();var res=this.map.getResolution();var delta_x=viewPortPx.x-(size.w/2);var delta_y=viewPortPx.y-(size.h/2);lonlat=new OpenLayers.LonLat(center.lon+delta_x*res,center.lat-delta_y*res);}
return lonlat;},getViewPortPxFromLonLat:function(lonlat){var px=null;if(lonlat!=null){var resolution=this.map.getResolution();var extent=this.map.getExtent();px=new OpenLayers.Pixel(Math.round(1/resolution*(lonlat.lon-extent.left)),Math.round(1/resolution*(extent.top-lonlat.lat)));}
return px;},setOpacity:function(opacity){this.opacity=opacity;for(var i=0;i<this.div.childNodes.length;++i){var element=this.div.childNodes[i];OpenLayers.Util.modifyDOMElement(element,null,null,null,null,null,null,opacity);}},setZIndex:function(zIdx){this.div.style.zIndex=zIdx;},CLASS_NAME:"OpenLayers.Layer"};OpenLayers.Layer.FixedZoomLevels=OpenLayers.Class.create();OpenLayers.Layer.FixedZoomLevels.prototype={initialize:function(){},initResolutions:function(){var props=new Array('minZoomLevel','maxZoomLevel','numZoomLevels');for(var i=0;i<props.length;i++){var property=props[i];this[property]=(this.options[property]!=null)?this.options[property]:this.map[property];}
if((this.minZoomLevel==null)||(this.minZoomLevel<this.MIN_ZOOM_LEVEL)){this.minZoomLevel=this.MIN_ZOOM_LEVEL;}
var limitZoomLevels=this.MAX_ZOOM_LEVEL-this.minZoomLevel+1;if(this.numZoomLevels!=null){this.numZoomLevels=Math.min(this.numZoomLevels,limitZoomLevels);}else{if(this.maxZoomLevel!=null){var zoomDiff=this.maxZoomLevel-this.minZoomLevel+1;this.numZoomLevels=Math.min(zoomDiff,limitZoomLevels);}else{this.numZoomLevels=limitZoomLevels;}}
this.maxZoomLevel=this.minZoomLevel+this.numZoomLevels-1;if(this.RESOLUTIONS!=null){var resolutionsIndex=0;this.resolutions=[];for(var i=this.minZoomLevel;i<this.numZoomLevels;i++){this.resolutions[resolutionsIndex++]=this.RESOLUTIONS[i];}}},getResolution:function(){if(this.resolutions!=null){return OpenLayers.Layer.prototype.getResolution.apply(this,arguments);}else{var resolution=null;var viewSize=this.map.getSize();var extent=this.getExtent();if((viewSize!=null)&&(extent!=null)){resolution=Math.max(extent.getWidth()/viewSize.w,extent.getHeight()/viewSize.h);}
return resolution;}},getExtent:function(){var extent=null;var size=this.map.getSize();var tlPx=new OpenLayers.Pixel(0,0);var tlLL=this.getLonLatFromViewPortPx(tlPx);var brPx=new OpenLayers.Pixel(size.w,size.h);var brLL=this.getLonLatFromViewPortPx(brPx);if((tlLL!=null)&&(brLL!=null)){extent=new OpenLayers.Bounds(tlLL.lon,brLL.lat,brLL.lon,tlLL.lat);}
return extent;},getZoomForResolution:function(resolution){if(this.resolutions!=null){return OpenLayers.Layer.prototype.getZoomForResolution.apply(this,arguments);}else{var extent=OpenLayers.Layer.prototype.getExtent.apply(this,[resolution]);return this.getZoomForExtent(extent);}},getOLZoomFromMapObjectZoom:function(moZoom){var zoom=null;if(moZoom!=null){zoom=moZoom-this.minZoomLevel;}
return zoom;},getMapObjectZoomFromOLZoom:function(olZoom){var zoom=null;if(olZoom!=null){zoom=olZoom+this.minZoomLevel;}
return zoom;},CLASS_NAME:"FixedZoomLevels.js"};OpenLayers.Marker=OpenLayers.Class.create();OpenLayers.Marker.prototype={icon:null,lonlat:null,events:null,map:null,initialize:function(lonlat,icon){this.lonlat=lonlat;var newIcon=(icon)?icon:OpenLayers.Marker.defaultIcon();if(this.icon==null){this.icon=newIcon;}else{this.icon.url=newIcon.url;this.icon.size=newIcon.size;this.icon.offset=newIcon.offset;this.icon.calculateOffset=newIcon.calculateOffset;}
this.events=new OpenLayers.Events(this,this.icon.imageDiv,null);},destroy:function(){this.map=null;if(this.icon!=null){this.icon.destroy();this.icon=null;}},draw:function(px){return this.icon.draw(px);},moveTo:function(px){if((px!=null)&&(this.icon!=null)){this.icon.moveTo(px);}},onScreen:function(){var onScreen=false;if(this.map){var screenBounds=this.map.getExtent();onScreen=screenBounds.containsLonLat(this.lonlat);}
return onScreen;},inflate:function(inflate){if(this.icon){var newSize=new OpenLayers.Size(this.icon.size.w*inflate,this.icon.size.h*inflate);this.icon.setSize(newSize);}},setOpacity:function(opacity){this.icon.setOpacity(opacity);},display:function(display){this.icon.display(display);},CLASS_NAME:"OpenLayers.Marker"};OpenLayers.Marker.defaultIcon=function(){var url=OpenLayers.Util.getImagesLocation()+"marker.png";var size=new OpenLayers.Size(21,25);return new OpenLayers.Icon(url,size);};OpenLayers.Math={};OpenLayers.Math.Matrix=Array;OpenLayers.Math.Matrix.iDF=0;OpenLayers.Math.Matrix.ALMOST_ZERO=1e-10;OpenLayers.Math.Matrix.multiply=function(a,b){var ay=a.length;var ax=a[0].length;var by=b.length;var bx=b[0].length;if(ax!=by){alert("Can't multiply matricies of sizes "+ax+","+ay+" and "+bx+","+by);return[[0]];}
var c=[];for(var k=0;k<ay;k++){c[k]=[];for(var i=0;i<bx;i++){c[k][i]=0;for(var m=0;m<ax;m++){c[k][i]+=a[k][m]*b[m][i];}}}
return c;}
OpenLayers.Math.Matrix.product=function(){if(arguments.length==0){alert("can't multiply 0 matrices!");return 1;}
var result=arguments[0];for(var i=1;i<arguments.length;i++){result=OpenLayers.Math.Matrix.multiply(result,arguments[i]);}
return result;}
OpenLayers.Math.Matrix.sum=function(){if(arguments.length==0){alert("can't sum 0 matrices!");return 0;}
var result=OpenLayers.Math.Matrix.copy(arguments[0]);var rows=result.length;if(rows==0){alert("can't deal with matrices of 0 rows!");return 0;}
var cols=result[0].length;if(cols==0){alert("can't deal with matrices of 0 cols!");return 0;}
for(var i=1;i<arguments.length;++i){var arg=arguments[i];if(arg.length!=rows||arg[0].length!=cols){alert("can't add matrices of different dimensions: first dimensions were "+rows+"x"+cols+", current dimensions are "+arg.length+"x"+arg[0].length);return 0;}
for(var r=0;r<rows;r++){for(var c=0;c<cols;c++){result[r][c]+=arg[r][c];}}}
return result;}
OpenLayers.Math.Matrix.inverse=function(a){if(a.length==1&&a[0].length==1){return[[1/a[0][0]]];}
var tms=a.length;var m=OpenLayers.Math.Matrix.create(tms,tms);var mm=OpenLayers.Math.Matrix.adjoint(a);var det=OpenLayers.Math.Matrix.determinant(a);var dd=0;if(det==0){alert("Determinant Equals 0, Not Invertible.");return[[0]];}else{dd=1/det;}
for(var i=0;i<tms;i++){for(var j=0;j<tms;j++){m[i][j]=dd*mm[i][j];}}
return m;}
OpenLayers.Math.Matrix.determinant=function(a){if(a.length!=a[0].length){alert("Can't calculate the determiant of a non-squre Matrix!");return 0;}
var tms=a.length;var det=1;var b=OpenLayers.Math.Matrix.upperTriangle(a);for(var i=0;i<tms;i++){var bii=b[i][i];if(Math.abs(bii)<OpenLayers.Math.Matrix.ALMOST_ZERO){return 0;}
det*=bii;}
det=det*OpenLayers.Math.Matrix.iDF;return det;}
OpenLayers.Math.Matrix.upperTriangle=function(m){m=OpenLayers.Math.Matrix.copy(m);var f1=0;var temp=0;var tms=m.length;var v=1;OpenLayers.Math.Matrix.iDF=1;for(var col=0;col<tms-1;col++){if(typeof m[col][col]!='number'){alert("non-numeric entry found in a numeric Matrix: m["+col+"]["+col+"]="+m[col][col]);}
v=1;var stop_loop=0;while((m[col][col]==0)&&!stop_loop){if(col+v>=tms){OpenLayers.Math.Matrix.iDF=0;stop_loop=1;}else{for(var r=0;r<tms;r++){temp=m[col][r];m[col][r]=m[col+v][r];m[col+v][r]=temp;}
v++;OpenLayers.Math.Matrix.iDF*=-1;}}
for(var row=col+1;row<tms;row++){if(typeof m[row][col]!='number'){alert("non-numeric entry found in a numeric Matrix: m["+row+"]["+col+"]="+m[row][col]);}
if(typeof m[col][row]!='number'){alert("non-numeric entry found in a numeric Matrix: m["+col+"]["+row+"]="+m[col][row]);}
if(m[col][col]!=0){var f1=(-1)*m[row][col]/m[col][col];for(var i=col;i<tms;i++){m[row][i]=f1*m[col][i]+m[row][i];}}}}
return m;}
OpenLayers.Math.Matrix.create=function(a,b,value){if(!value){value=0;}
var m=[];for(var i=0;i<b;i++){m[i]=[];for(var j=0;j<a;j++){m[i][j]=value;}}
return m;}
OpenLayers.Math.Matrix.ones=function(a,b){return OpenLayers.Math.Matrix.create(a,b,1);}
OpenLayers.Math.Matrix.zeros=function(a,b){return OpenLayers.Math.Matrix.create(a,b,0);}
OpenLayers.Math.Matrix.identity=function(size,scale){if(!scale){scale=1;}
var m=[];for(var i=0;i<size;i++){m[i]=[];for(var j=0;j<size;j++){m[i][j]=(i==j?scale:0);}}
return m;}
OpenLayers.Math.Matrix.adjoint=function(a){var tms=a.length;if(tms<=1){alert("Can't find the adjoint of a Matrix with a dimension less than 2");return[[0]];}
if(a.length!=a[0].length){alert("Can't find the adjoint of a non-square Matrix");return[[0]];}
var m=OpenLayers.Math.Matrix.create(tms,tms);var ii=0;var jj=0;var ia=0;var ja=0;var det=0;var ap=OpenLayers.Math.Matrix.create(tms-1,tms-1);for(var i=0;i<tms;i++){for(var j=0;j<tms;j++){ia=0;for(ii=0;ii<tms;ii++){if(ii==i){continue;}
ja=0;for(jj=0;jj<tms;jj++){if(jj==j){continue;}
ap[ia][ja]=a[ii][jj];ja++;}
ia++;}
det=OpenLayers.Math.Matrix.determinant(ap);m[i][j]=Math.pow(-1,(i+j))*det;}}
m=OpenLayers.Math.Matrix.transpose(m);return m;}
OpenLayers.Math.Matrix.transpose=function(a){var m=OpenLayers.Math.Matrix.create(a.length,a[0].length);for(var i=0;i<a.length;i++){for(var j=0;j<a[i].length;j++){m[j][i]=a[i][j];}}
return m;}
OpenLayers.Math.Matrix.format=function(a,decimal_points){if(arguments.length<=1){decimal_points=5;}
function format_int(x,dp){var fac=Math.pow(10,dp);var a=Math.round(x*fac)/fac;var b=a.toString();if(b.charAt(0)!='-'){b=' '+b;}
var has_dp=0;for(var i=1;i<b.length;i++){if(b.charAt(i)=='.'){has_dp=1;}}
if(!has_dp){b+='.';}
while(b.length<dp+3){b+='0';}
return b;}
var ya=a.length;var xa=ya>0?a[0].length:0;var buffer='';for(var y=0;y<ya;y++){buffer+='| ';for(var x=0;x<xa;x++){buffer+=format_int(a[y][x],decimal_points)+' ';}
buffer+='|\n';}
return buffer;}
OpenLayers.Math.Matrix.copy=function(a){var ya=a.length;var xa=a[0].length;var m=OpenLayers.Math.Matrix.create(xa,ya);for(var y=0;y<ya;y++){for(var x=0;x<xa;x++){m[y][x]=a[y][x];}}
return m;}
OpenLayers.Math.Matrix.scale=function(k,a){a=OpenLayers.Math.Matrix.copy(a);var ya=a.length;var xa=a[0].length;for(var y=0;y<ya;y++){for(var x=0;x<xa;x++){a[y][x]*=k;}}
return a;}
OpenLayers.Parser=OpenLayers.Class.create();OpenLayers.Parser.prototype={initialize:function(){},load:function(uri,bbox,onComplete,onFailure){},destroy:function(){this.map=null;},CLASS_NAME:"OpenLayers.Parser"};OpenLayers.Popup=OpenLayers.Class.create();OpenLayers.Popup.WIDTH=200;OpenLayers.Popup.HEIGHT=200;OpenLayers.Popup.COLOR="white";OpenLayers.Popup.OPACITY=1;OpenLayers.Popup.BORDER="0px";OpenLayers.Popup.prototype={events:null,id:"",lonlat:null,div:null,size:null,contentHTML:"",backgroundColor:"",opacity:"",border:"",contentDiv:null,padding:5,map:null,initialize:function(id,lonlat,size,contentHTML,closeBox){if(id==null){id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");}
this.id=id;this.lonlat=lonlat;this.size=(size!=null)?size:new OpenLayers.Size(OpenLayers.Popup.WIDTH,OpenLayers.Popup.HEIGHT);if(contentHTML!=null){this.contentHTML=contentHTML;}
this.backgroundColor=OpenLayers.Popup.COLOR;this.opacity=OpenLayers.Popup.OPACITY;this.border=OpenLayers.Popup.BORDER;this.div=OpenLayers.Util.createDiv(this.id,null,null,null,null,null,"hidden");this.div.className='olPopup';var id=this.div.id+"_contentDiv";this.contentDiv=OpenLayers.Util.createDiv(id,null,this.size.clone(),null,"relative",null,"hidden");this.contentDiv.className='olPopupContent';this.div.appendChild(this.contentDiv);if(closeBox==true){var closeSize=new OpenLayers.Size(17,17);var img=OpenLayers.Util.getImagesLocation()+"close.gif";var closeImg=OpenLayers.Util.createAlphaImageDiv(this.id+"_close",null,closeSize,img);closeImg.style.right=this.padding+"px";closeImg.style.top=this.padding+"px";this.div.appendChild(closeImg);var closeEvents=new OpenLayers.Events(this,closeImg);closeEvents.register("mousedown",this,this.hide);}
this.registerEvents();},destroy:function(){if(this.map!=null){this.map.removePopup(this);}
this.div=null;this.map=null;},draw:function(px){if(px==null){if((this.lonlat!=null)&&(this.map!=null)){px=this.map.getLayerPxFromLonLat(this.lonlat);}}
this.setSize();this.setBackgroundColor();this.setOpacity();this.setBorder();this.setContentHTML();this.moveTo(px);return this.div;},updatePosition:function(){if((this.lonlat)&&(this.map)){var px=this.map.getLayerPxFromLonLat(this.lonlat);this.moveTo(px);}},moveTo:function(px){if((px!=null)&&(this.div!=null)){this.div.style.left=px.x+"px";this.div.style.top=px.y+"px";}},visible:function(){return OpenLayers.Element.visible(this.div);},toggle:function(){OpenLayers.Element.toggle(this.div);},show:function(){OpenLayers.Element.show(this.div);},hide:function(){OpenLayers.Element.hide(this.div);},setSize:function(size){if(size!=undefined){this.size=size;}
if(this.div!=null){this.div.style.width=this.size.w+"px";this.div.style.height=this.size.h+"px";}},setBackgroundColor:function(color){if(color!=undefined){this.backgroundColor=color;}
if(this.div!=null){this.div.style.backgroundColor=this.backgroundColor;}},setOpacity:function(opacity){if(opacity!=undefined){this.opacity=opacity;}
if(this.div!=null){this.div.style.opacity=this.opacity;this.div.style.filter='alpha(opacity='+this.opacity*100+')';}},setBorder:function(border){if(border!=undefined){this.border=border;}
if(this.div!=null){this.div.style.border=this.border;}},setContentHTML:function(contentHTML){if(contentHTML!=null){this.contentHTML=contentHTML;}
if(this.contentDiv!=null){this.contentDiv.innerHTML=this.contentHTML;}},registerEvents:function(){this.events=new OpenLayers.Events(this,this.div,null,true);this.events.register("mousedown",this,this.onmousedown);this.events.register("mousemove",this,this.onmousemove);this.events.register("mouseup",this,this.onmouseup);this.events.register("click",this,OpenLayers.Util.safeStopPropagation);this.events.register("mouseout",this,this.onmouseout);this.events.register("dblclick",this,OpenLayers.Util.safeStopPropagation);},onmousedown:function(evt){this.mousedown=true;OpenLayers.Util.safeStopPropagation(evt);},onmousemove:function(evt){if(this.mousedown){OpenLayers.Util.safeStopPropagation(evt);}},onmouseup:function(evt){if(this.mousedown){this.mousedown=false;OpenLayers.Util.safeStopPropagation(evt);}},onmouseout:function(evt){this.mousedown=false;},CLASS_NAME:"OpenLayers.Popup"};OpenLayers.Renderer=OpenLayers.Class.create();OpenLayers.Renderer.prototype={initialize:function(){},createRoot:function(element){},deleteRoot:function(element){},clearRoot:function(){},setExtent:function(x,y,width,height){},setSize:function(width,height){},getGeometryFromEvent:function(evt){},drawGeometry:function(geometry,style){if(!style){return;}
switch(geometry.CLASS_NAME){case"OpenLayers.Geometry.Point":this.drawPoint(geometry,style);break;case"OpenLayers.Geometry.Curve":this.drawCurve(geometry,style);break;case"OpenLayers.Geometry.LineSegment":case"OpenLayers.Geometry.LineString":this.drawLineString(geometry,style);break;case"OpenLayers.Geometry.LinearRing":this.drawLinearRing(geometry,style);break;case"OpenLayers.Geometry.Polygon":this.drawPolygon(geometry,style);break;case"OpenLayers.Geometry.Surface":this.drawSurface(geometry,style);break;case"OpenLayers.Geometry.Rectangle":this.drawRectangle(geometry,style);break;case"OpenLayers.Geometry.MultiPoint":case"OpenLayers.Geometry.MultiLineString":case"OpenLayers.Geometry.MultiPolygon":for(var i=0;i<geometry.components.length;i++){this.drawGeometry(geometry.components[i],style);}
break;default:break;}},eraseGeometry:function(geometry){},drawPoint:function(geometry,style){},drawLineString:function(geometry,style){},drawLinearRing:function(geometry,style){},drawPolygon:function(geometry,style){},drawRectangle:function(geometry,style){},drawCircle:function(geometry,style){},drawCurve:function(geometry,style){},drawSurface:function(geometry,style){},CLASS_NAME:"OpenLayers.Renderer"};OpenLayers.Style=OpenLayers.Class.create();OpenLayers.Style.prototype={fillColor:"white",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"red",strokeOpacity:1,strokeWidth:0.2,strokeUnit:"%",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,hoverStrokeUnit:"%",pointRadius:1,pointUnit:"%",hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",map:null,initialize:function(object){OpenLayers.Util.extend(this,object);},CLASS_NAME:"OpenLayers.Style"}
OpenLayers.Style.DefaultRendererStyle=new OpenLayers.Style();OpenLayers.Style.DefaultRendererSelectionStyle=new OpenLayers.Style({strokeColor:"blue"});OpenLayers.Style.DefaultRendererSnappingSegmentStyle=new OpenLayers.Style({strokeColor:"white",strokeOpacity:0.5,strokeWidth:3,strokeUnit:"%",pointRadius:0.1,pointUnit:"%"});OpenLayers.Style.DefaultRendererSnappingPointStyle=new OpenLayers.Style({fillColor:"blue",fillOpacity:1,strokeColor:"blue",strokeOpacity:1,strokeWidth:0.2,strokeUnit:"%",pointRadius:0.5,pointUnit:"%",pointerEvents:"none"});OpenLayers.Style.DefaultRendererTemporaryElementStyle=new OpenLayers.Style({fillOpacity:0,strokeColor:"yellow",strokeOpacity:1,strokeWidth:0.2,strokeUnit:"%",pointRadius:1,pointUnit:"%",pointerEvents:"none"});OpenLayers.Tile=OpenLayers.Class.create();OpenLayers.Tile.prototype={id:null,layer:null,url:null,bounds:null,size:null,position:null,drawn:false,initialize:function(layer,position,bounds,url,size){this.layer=layer;this.position=position;this.bounds=bounds;this.url=url;this.size=size;this.id=OpenLayers.Util.createUniqueID("Tile_");},destroy:function(){this.layer=null;this.bounds=null;this.size=null;this.position=null;},draw:function(){this.drawn=true;},moveTo:function(bounds,position,redraw){if(redraw==null){redraw=true;}
this.clear();this.bounds=bounds.clone();this.position=position.clone();if(redraw){this.draw();}},clear:function(){this.drawn=false;},getBoundsFromBaseLayer:function(position){var topLeft=this.layer.map.getLonLatFromLayerPx(this.position);var bottomRightPx=this.position.clone();bottomRightPx.x+=this.size.w;bottomRightPx.y+=this.size.h;var bottomRight=this.layer.map.getLonLatFromLayerPx(bottomRightPx);if(topLeft.lon>bottomRight.lon){if(topLeft.lon<0){topLeft.lon=-180-(topLeft.lon+180);}else{bottomRight.lon=180+bottomRight.lon+180;}}
bounds=new OpenLayers.Bounds(topLeft.lon,bottomRight.lat,bottomRight.lon,topLeft.lat);return bounds;},CLASS_NAME:"OpenLayers.Tile"};OpenLayers.Writer=OpenLayers.Class.create();OpenLayers.Writer.prototype={initialize:function(){},destroy:function(){},commit:function(uri,features,onSuccess,onFailure){},_insert:function(feature){},_update:function(feature){},_delete:function(feature){},CLASS_NAME:"OpenLayers.Writer"};OpenLayers.Writer.GML=OpenLayers.Class.create();OpenLayers.Writer.GML.prototype={gml:'',initialize:function(){},buildXmlNode:function(geometry){if(geometry.CLASS_NAME=="OpenLayers.Geometry.MultiPolygon"||geometry.CLASS_NAME=="OpenLayers.Geometry.Polygon"){this.gml=document.createElementNS("http://www.opengis.net/gml",'gml:MultiPolygon');this.gml.setAttribute("srsName","http://www.opengis.net/gml/srs/epsg.xml#4326");var polygonMember=document.createElementNS("http://www.opengis.net/gml",'gml:polygonMember');var polygon=document.createElementNS("http://www.opengis.net/gml",'gml:Polygon');var outerRing=document.createElementNS("http://www.opengis.net/gml",'gml:outerBoundaryIs');var linearRing=document.createElementNS("http://www.opengis.net/gml",'gml:LinearRing');linearRing.appendChild(this.buildCoordinatesNode(geometry.components[0]));outerRing.appendChild(linearRing);polygon.appendChild(outerRing);polygonMember.appendChild(polygon);this.gml.appendChild(polygonMember);}
else if(geometry.CLASS_NAME=="OpenLayers.Geometry.MultiLineString"||geometry.CLASS_NAME=="OpenLayers.Geometry.LineString"){this.gml=document.createElementNS("http://www.opengis.net/gml",'gml:MultiLineString');this.gml.setAttribute("srsName","http://www.opengis.net/gml/srs/epsg.xml#4326");var lineStringMember=document.createElementNS("http://www.opengis.net/gml",'gml:lineStringMember');var lineString=document.createElementNS("http://www.opengis.net/gml",'gml:LineString');lineString.appendChild(this.buildCoordinatesNode(geometry));lineStringMember.appendChild(lineString);this.gml.appendChild(lineStringMember);}
else if(geometry.CLASS_NAME=="OpenLayers.Geometry.MultiPoint"||geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){this.gml=document.createElementNS("http://www.opengis.net/gml",'gml:MultiPoint');this.gml.setAttribute("srsName","http://www.opengis.net/gml/srs/epsg.xml#4326");var polygonMember=document.createElementNS("http://www.opengis.net/gml",'gml:polygonMember');var polygon=document.createElementNS("http://www.opengis.net/gml",'gml:Polygon');polygon.appendChild(this.buildCoordinatesNode(geometry));polygonMember.appendChild(polygon);this.gml.appendChild(polygonMember);}},buildCoordinatesNode:function(geometry){var coordinatesNode=document.createElementNS("http://www.opengis.net/gml","gml:coordinates");coordinatesNode.setAttribute("decimal",".");coordinatesNode.setAttribute("cs",",");coordinatesNode.setAttribute("ts"," ");if(geometry.components){var points=geometry.components[0].path;}else{var points=geometry.path;}
var path="";for(var i=0;i<points.length;i++){path+=points[i].lon+","+points[i].lat+" ";}
var txtNode=document.createTextNode(path);coordinatesNode.appendChild(txtNode);return coordinatesNode;},CLASS_NAME:"OpenLayers.Writer.GML"}
Rico.Color=OpenLayers.Class.create();Rico.Color.prototype={initialize:function(red,green,blue){this.rgb={r:red,g:green,b:blue};},setRed:function(r){this.rgb.r=r;},setGreen:function(g){this.rgb.g=g;},setBlue:function(b){this.rgb.b=b;},setHue:function(h){var hsb=this.asHSB();hsb.h=h;this.rgb=Rico.Color.HSBtoRGB(hsb.h,hsb.s,hsb.b);},setSaturation:function(s){var hsb=this.asHSB();hsb.s=s;this.rgb=Rico.Color.HSBtoRGB(hsb.h,hsb.s,hsb.b);},setBrightness:function(b){var hsb=this.asHSB();hsb.b=b;this.rgb=Rico.Color.HSBtoRGB(hsb.h,hsb.s,hsb.b);},darken:function(percent){var hsb=this.asHSB();this.rgb=Rico.Color.HSBtoRGB(hsb.h,hsb.s,Math.max(hsb.b-percent,0));},brighten:function(percent){var hsb=this.asHSB();this.rgb=Rico.Color.HSBtoRGB(hsb.h,hsb.s,Math.min(hsb.b+percent,1));},blend:function(other){this.rgb.r=Math.floor((this.rgb.r+other.rgb.r)/2);this.rgb.g=Math.floor((this.rgb.g+other.rgb.g)/2);this.rgb.b=Math.floor((this.rgb.b+other.rgb.b)/2);},isBright:function(){var hsb=this.asHSB();return this.asHSB().b>0.5;},isDark:function(){return!this.isBright();},asRGB:function(){return"rgb("+this.rgb.r+","+this.rgb.g+","+this.rgb.b+")";},asHex:function(){return"#"+this.rgb.r.toColorPart()+this.rgb.g.toColorPart()+this.rgb.b.toColorPart();},asHSB:function(){return Rico.Color.RGBtoHSB(this.rgb.r,this.rgb.g,this.rgb.b);},toString:function(){return this.asHex();}};Rico.Color.createFromHex=function(hexCode){if(hexCode.length==4){var shortHexCode=hexCode;var hexCode='#';for(var i=1;i<4;i++)hexCode+=(shortHexCode.charAt(i)+
shortHexCode.charAt(i));}
if(hexCode.indexOf('#')==0)
hexCode=hexCode.substring(1);var red=hexCode.substring(0,2);var green=hexCode.substring(2,4);var blue=hexCode.substring(4,6);return new Rico.Color(parseInt(red,16),parseInt(green,16),parseInt(blue,16));}
Rico.Color.createColorFromBackground=function(elem){var actualColor=RicoUtil.getElementsComputedStyle($(elem),"backgroundColor","background-color");if(actualColor=="transparent"&&elem.parentNode)
return Rico.Color.createColorFromBackground(elem.parentNode);if(actualColor==null)
return new Rico.Color(255,255,255);if(actualColor.indexOf("rgb(")==0){var colors=actualColor.substring(4,actualColor.length-1);var colorArray=colors.split(",");return new Rico.Color(parseInt(colorArray[0]),parseInt(colorArray[1]),parseInt(colorArray[2]));}
else if(actualColor.indexOf("#")==0){return Rico.Color.createFromHex(actualColor);}
else
return new Rico.Color(255,255,255);}
Rico.Color.HSBtoRGB=function(hue,saturation,brightness){var red=0;var green=0;var blue=0;if(saturation==0){red=parseInt(brightness*255.0+0.5);green=red;blue=red;}
else{var h=(hue-Math.floor(hue))*6.0;var f=h-Math.floor(h);var p=brightness*(1.0-saturation);var q=brightness*(1.0-saturation*f);var t=brightness*(1.0-(saturation*(1.0-f)));switch(parseInt(h)){case 0:red=(brightness*255.0+0.5);green=(t*255.0+0.5);blue=(p*255.0+0.5);break;case 1:red=(q*255.0+0.5);green=(brightness*255.0+0.5);blue=(p*255.0+0.5);break;case 2:red=(p*255.0+0.5);green=(brightness*255.0+0.5);blue=(t*255.0+0.5);break;case 3:red=(p*255.0+0.5);green=(q*255.0+0.5);blue=(brightness*255.0+0.5);break;case 4:red=(t*255.0+0.5);green=(p*255.0+0.5);blue=(brightness*255.0+0.5);break;case 5:red=(brightness*255.0+0.5);green=(p*255.0+0.5);blue=(q*255.0+0.5);break;}}
return{r:parseInt(red),g:parseInt(green),b:parseInt(blue)};}
Rico.Color.RGBtoHSB=function(r,g,b){var hue;var saturation;var brightness;var cmax=(r>g)?r:g;if(b>cmax)
cmax=b;var cmin=(r<g)?r:g;if(b<cmin)
cmin=b;brightness=cmax/255.0;if(cmax!=0)
saturation=(cmax-cmin)/cmax;else
saturation=0;if(saturation==0)
hue=0;else{var redc=(cmax-r)/(cmax-cmin);var greenc=(cmax-g)/(cmax-cmin);var bluec=(cmax-b)/(cmax-cmin);if(r==cmax)
hue=bluec-greenc;else if(g==cmax)
hue=2.0+redc-bluec;else
hue=4.0+greenc-redc;hue=hue/6.0;if(hue<0)
hue=hue+1.0;}
return{h:hue,s:saturation,b:brightness};}
OpenLayers.Control.ArgParser=OpenLayers.Class.create();OpenLayers.Control.ArgParser.prototype=OpenLayers.Class.inherit(OpenLayers.Control,{center:null,zoom:null,layers:null,initialize:function(element,base){OpenLayers.Control.prototype.initialize.apply(this,arguments);},setMap:function(map){OpenLayers.Control.prototype.setMap.apply(this,arguments);for(var i=0;i<this.map.controls.length;i++){var control=this.map.controls[i];if((control!=this)&&(control.CLASS_NAME=="OpenLayers.Control.ArgParser")){break;}}
if(i==this.map.controls.length){var args=OpenLayers.Util.getArgs();if(args.lat&&args.lon){this.center=new OpenLayers.LonLat(parseFloat(args.lon),parseFloat(args.lat));if(args.zoom){this.zoom=parseInt(args.zoom);}
this.map.events.register('changebaselayer',this,this.setCenter);this.setCenter();}
if(args.layers){this.layers=args.layers;this.map.events.register('addlayer',this,this.configureLayers);this.configureLayers();}}},setCenter:function(){if(this.map.baseLayer){this.map.events.unregister('changebaselayer',this,this.setCenter);this.map.setCenter(this.center,this.zoom);}},configureLayers:function(){if(this.layers.length==this.map.layers.length){this.map.events.unregister('addlayer',this,this.configureLayers);for(var i=0;i<this.layers.length;i++){var layer=this.map.layers[i];var c=this.layers.charAt(i);if(c=="B"){this.map.setBaseLayer(layer);}else if((c=="T")||(c=="F")){layer.setVisibility(c=="T");}}}},CLASS_NAME:"OpenLayers.Control.ArgParser"});OpenLayers.Control.EditingMode=OpenLayers.Class.create();OpenLayers.Control.EditingMode.prototype=OpenLayers.Class.inherit(OpenLayers.Control,{initialize:function(){},calculatePoint:function(mouseCoordinates,evtGeometry,currentGeometry){},CLASS_NAME:"OpenLayers.Control.EditingMode"});OpenLayers.Control.EditingProcess=OpenLayers.Class.create();OpenLayers.Control.EditingProcess.prototype=OpenLayers.Class.inherit(OpenLayers.Control,{});OpenLayers.Control.EditingTool=OpenLayers.Class.create();OpenLayers.Control.EditingTool.prototype=OpenLayers.Class.inherit(OpenLayers.Control,{performedDrag:false,layer:null,editingModes:[],snappingTolerance:5,autoPanTolerance:10,autoPanStep:2,autoPanInterval:10,tmpStyle:null,initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.editingModes.push(new OpenLayers.Control.EditingMode.PointSnapping());this.editingModes.push(new OpenLayers.Control.EditingMode.SegmentSnapping());this.style=OpenLayers.Style.DefaultRendererTemporaryElementStyle;},setLayer:function(layer){if(layer){this.layer=layer;}else{for(var i=0;i<this.map.layers.length;i++){if(this.map.layers[i].isVector){this.layer=this.map.layers[i];}}}},turnOn:function(){this.setLayer();this.defaultClick=this.defaultClick.bindAsEventListener(this);this.defaultDblClick=this.defaultDblClick.bindAsEventListener(this);this.defaultMouseDown=this.defaultMouseDown.bindAsEventListener(this);this.defaultMouseUp=this.defaultMouseUp.bindAsEventListener(this);this.defaultMouseMove=this.defaultMouseMove.bindAsEventListener(this);this.defaultMouseOut=this.defaultMouseOut.bindAsEventListener(this);this.defaultWheelEvent=this.defaultWheelEvent.bindAsEventListener(this);this.map.events.register("click",this,this.defaultClick);this.map.events.register("dblclick",this,this.defaultDblClick);this.map.events.register("mousedown",this,this.defaultMouseDown);this.map.events.register("mouseup",this,this.defaultMouseUp);this.map.events.register("mousemove",this,this.defaultMouseMove);this.map.events.register("mouseout",this,this.defaultMouseOut);OpenLayers.Event.observe(window,"DOMMouseScroll",this.defaultWheelEvent,false);OpenLayers.Event.observe(window,"mousewheel",this.defaultWheelEvent,false);OpenLayers.Event.observe(document,"mousewheel",this.defaultWheelEvent,false);this.defaultKeyDown=this.defaultKeyDown.bindAsEventListener(this);this.defaultKeyUp=this.defaultKeyUp.bindAsEventListener(this);OpenLayers.Event.observe(document,"keydown",this.defaultKeyDown);OpenLayers.Event.observe(document,"keyup",this.defaultKeyUp);},turnOff:function(){this.map.events.unregister("click",this,this.defaultClick);this.map.events.unregister("dblclick",this,this.defaultDblClick);this.map.events.unregister("mousedown",this,this.defaultMouseDown);this.map.events.unregister("mouseup",this,this.defaultMouseUp);this.map.events.unregister("mousemove",this,this.defaultMouseMove);this.map.events.unregister("mouseout",this,this.defaultMouseOut);OpenLayers.Event.stopObserving(document,"keydown",this.defaultKeyDown);OpenLayers.Event.stopObserving(document,"keyup",this.defaultKeyUp);OpenLayers.Event.stopObserving(window,"DOMMouseScroll",this.defaultWheelEvent,false);OpenLayers.Event.stopObserving(window,"mousewheel",this.defaultWheelEvent,false);OpenLayers.Event.stopObserving(document,"mousewheel",this.defaultWheelEvent,false);this.map.events.unregister("Editing",map,this.defaultEditing);},setEventContext:function(evt){var lonlat=this.map.getLonLatFromLayerPx(evt.xy);evt.point=new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat);evt.targetGeometry=this.layer.renderer.getGeometryFromEvent(evt);if(this.editingModes){for(var i=0;i<this.editingModes.length;i++){var snappingCoordinates=this.editingModes[i].calculatePoint(evt.point,evt.targetGeometry,this.geometry,this.layer);if(snappingCoordinates){evt.point=snappingCoordinates;break;}}}},defaultClick:function(evt){this.setEventContext(evt);},defaultDblClick:function(evt){this.setEventContext(evt);},defaultMouseDown:function(evt){this.setEventContext(evt);this.mouseDown=true;},defaultMouseMove:function(evt){this.setEventContext(evt);var size=this.map.getSize();var posX=size.w-evt.xy.x;var posY=size.h-evt.xy.y;if(posX<=this.autoPanTolerance){if(!this.autoPanXTimeoutId){this.autoPanXTimeoutId=window.setInterval(function(){this.map.pan(this.autoPanStep,0);}.bind(this),this.autoPanInterval);}}else if(posX>=(size.w-this.autoPanTolerance)){if(!this.autoPanXTimeoutId){this.autoPanXTimeoutId=window.setInterval(function(){this.map.pan(-this.autoPanStep,0);}.bind(this),this.autoPanInterval);}}else{if(this.autoPanXTimeoutId){window.clearInterval(this.autoPanXTimeoutId);this.autoPanXTimeoutId=null;}}
if(posY<=this.autoPanTolerance){if(!this.autoPanYTimeoutId){this.autoPanYTimeoutId=window.setInterval(function(){this.map.pan(0,this.autoPanStep);}.bind(this),this.autoPanInterval);}}else if(posY>=(size.h-this.autoPanTolerance)){if(!this.autoPanYTimeoutId){this.autoPanYTimeoutId=window.setInterval(function(){this.map.pan(0,-this.autoPanStep);}.bind(this),this.autoPanInterval);}}else{if(this.autoPanYTimeoutId){window.clearInterval(this.autoPanYTimeoutId);this.autoPanYTimeoutId=null;}}},defaultMouseUp:function(evt){this.setEventContext(evt);this.mouseDown=false;},defaultMouseOut:function(evt){this.setEventContext(evt);if(this.autoPanXTimeoutId){window.clearInterval(this.autoPanXTimeoutId);this.autoPanXTimeoutId=null;}
if(this.autoPanYTimeoutId){window.clearInterval(this.autoPanYTimeoutId);this.autoPanYTimeoutId=null;}},defaultWheelEvent:function(evt){OpenLayers.Control.MouseDefaults.prototype.onWheelEvent.apply(this,arguments);},defaultWheelUp:function(evt){OpenLayers.Control.MouseDefaults.prototype.defaultWheelUp.apply(this,arguments);},defaultWheelDown:function(evt){OpenLayers.Control.MouseDefaults.prototype.defaultWheelDown.apply(this,arguments);},defaultKeyDown:function(evt){switch(evt.keyCode){case OpenLayers.Event.KEY_LEFT:this.map.pan(-50,0);break;case OpenLayers.Event.KEY_RIGHT:this.map.pan(50,0);break;case OpenLayers.Event.KEY_UP:this.map.pan(0,-50);break;case OpenLayers.Event.KEY_DOWN:this.map.pan(0,50);break;case OpenLayers.Event.KEY_SHIFT:this.shiftDown=true;this.controlledMode=true;break;case OpenLayers.Event.KEY_CAPSLOCK:this.capsLock=!this.capsLock;this.snappingMode=!this.snappingMode;break;}},defaultKeyUp:function(evt){switch(evt.keyCode){case OpenLayers.Event.KEY_SHIFT:this.shiftDown=false;this.controlledMode=false;break;}},CLASS_NAME:"OpenLayers.Control.EditingTool"});OpenLayers.Control.DrawCurvePath=OpenLayers.Class.create();OpenLayers.Control.DrawCurvePath.prototype=OpenLayers.Class.inherit(OpenLayers.Control,{performedDrag:false,layer:null,geometryClass:null,geometry:null,initialize:function(LinearPathClass){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.geometryClass=LinearPathClass;},setLayer:function(layer){if(layer)
this.layer=layer;else
for(var i=0;i<this.map.layers.length;i++){if(this.map.layers[i].CLASS_NAME=="OpenLayers.Layer.Vector")
this.layer=this.map.layers[i];}},observe:function(){this.setLayer();this.defaultKeyPress.bindAsEventListener(this);OpenLayers.Event.observe(window,"keypress",this.defaultKeyPress,false);this.geometry=new this.geometryClass();},dispose:function(){OpenLayers.Event.stopObserving(window,"keypress",this.defaultKeyPress,false);this.geometry=null;},draw:function(){},analyseDrawingEvent:function(){},defaultClick:function(evt){OpenLayers.Event.stop(evt);},defaultDblClick:function(evt){var lonlat=this.layer.map.getLonLatFromLayerPx(evt.xy);var point=new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat);this.geometry.path[this.geometry.path.length-1]=point;this.geometry.path[this.geometry.path.length-2]=point;var feature=new OpenLayers.Feature();feature.setGeometry(this.geometry);this.layer.addFeatures(feature);this.layer.removeTmpFeature();this.geometry=new this.geometryClass();OpenLayers.Event.stop(evt);},defaultMouseDown:function(evt){OpenLayers.Event.stop(evt);this.mouseDown=true;var lonlat=this.layer.map.getLonLatFromLayerPx(evt.xy);var point=new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat)
if(this.geometry.path.length==0)
this.geometry.path.push(point);this.geometry.path.push(point);this.geometry.path.push(point);this.geometry.path.push(point);this.layer.setTmpFeature(this.geometry);},defaultMouseMove:function(evt){OpenLayers.Control.EditingTool.prototype.defaultMouseMove.apply(this,arguments);var lonlat=this.layer.map.getLonLatFromLayerPx(evt.xy);var point=new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat);if(this.mouseDown){this.geometry.path[this.geometry.path.length-1]=point;this.geometry.path[this.geometry.path.length-2]=point;this.geometry.path[this.geometry.path.length-3]=point;if(this.geometry.path.length>4){var point2=this.geometry.path[this.geometry.path.length-4];var point3=new OpenLayers.Geometry.Point(point2.lon-(point.lon-point2.lon),point2.lat-(point.lat-point2.lat));this.geometry.path[this.geometry.path.length-5]=point3;}}else{this.geometry.path[this.geometry.path.length-1]=point;this.geometry.path[this.geometry.path.length-2]=point;}
this.layer.setTmpFeature(this.geometry);},defaultMouseUp:function(evt){this.mouseDown=false;},defaultMouseOut:function(evt){},defaultWheelUp:function(){},defaultWheelDown:function(){},defaultKeyPress:function(evt){switch(event.keyCode){case"asdf":break;}},CLASS_NAME:"OpenLayers.Control.DrawLinearPath"});OpenLayers.Control.EditingToolbar=OpenLayers.Class.create();OpenLayers.Control.EditingToolbar.prototype=OpenLayers.Class.inherit(OpenLayers.Control,{map:null,activeTool:null,tools:null,initialize:function(options){},setMap:function(map){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.position=new OpenLayers.Pixel(16,140);},setTool:function(tool){if(this.activeTool){this.activeTool.turnOff();}
this.activeTool=tool;this.activeTool.turnOn();},addTools:function(tools){if(!(tools instanceof Array)){tools=[tools];}
if(this.tools){this.tools=this.tools.concat(tools);}else{this.tools=[].concat(tools);}},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);for(var i=0;i<this.tools.length;i++){this.tools[i].map=this.map;}
for(var i=0;i<this.tools.length;i++){this._drawTool(this.tools[i]);}
if(!this.activeTool){}
return this.div;},_drawTool:function(tool){var imgLocation=OpenLayers.Util.getImagesLocation()+tool.image
var toolDiv=OpenLayers.Util.createDiv(tool.id,null,tool.size,imgLocation,"relative");toolDiv.model=tool;OpenLayers.Event.observe(toolDiv,"click",this._toolClick.bindAsEventListener(this));this.div.appendChild(toolDiv);return tool;},_toolClick:function(evt){this.setTool(OpenLayers.Event.element(evt).model);OpenLayers.Event.stop(evt);},_toolMouseDown:function(evt){OpenLayers.Event.stop(evt);},CLASS_NAME:"OpenLayer.Control.EditingToolbar"});OpenLayers.Control.LayerSwitcher=OpenLayers.Class.create();OpenLayers.Control.LayerSwitcher.prototype=OpenLayers.Class.inherit(OpenLayers.Control,{activeColor:"darkblue",layersDiv:null,baseLayersDiv:null,baseLayerInputs:null,selectedVectorLayer:null,selectedVectorLayerZIndex:null,dataLbl:null,dataLayersDiv:null,dataLayerInputs:null,minimizeDiv:null,maximizeDiv:null,ascending:true,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,arguments);},setMap:function(map){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.map.events.register("addlayer",this,this.redraw);this.map.events.register("changelayer",this,this.redraw);this.map.events.register("removelayer",this,this.redraw);this.map.events.register("changebaselayer",this,this.redraw);},draw:function(){OpenLayers.Control.prototype.draw.apply(this);this.loadContents();this.minimizeControl();this.redraw();return this.div;},redraw:function(){this.baseLayersDiv.innerHTML="";this.baseLayerInputs=new Array();this.dataLayersDiv.innerHTML="";this.dataLayerInputs=new Array();var containsOverlays=false;var layers=this.map.layers.slice();if(!this.ascending){layers.reverse();}
for(var i=0;i<layers.length;i++){var layer=layers[i];var baseLayer=layer.isBaseLayer;var vectorLayer=layer.isVector;if(baseLayer||layer.displayInLayerSwitcher){if(!baseLayer){containsOverlays=true;}
var checked=(baseLayer)?(layer==this.map.baseLayer):layer.getVisibility();var inputElem=document.createElement("input");inputElem.id="input_"+layer.name;inputElem.name=(baseLayer)?"baseLayers":layer.name;inputElem.type=(baseLayer)?"radio":"checkbox";inputElem.value=layer.name;inputElem.checked=checked;inputElem.defaultChecked=checked;inputElem.layer=layer;inputElem.control=this;if(!baseLayer&&!layer.inRange){inputElem.disabled=true;}
OpenLayers.Event.observe(inputElem,"mouseup",this.onInputClick.bindAsEventListener(inputElem));var labelSpan=document.createElement("span");if(!baseLayer&&!layer.inRange){labelSpan.style.color="gray";}
labelSpan.innerHTML=layer.name;labelSpan.style.verticalAlign=(baseLayer)?"bottom":"baseline";OpenLayers.Event.observe(labelSpan,"click",this.onInputClick.bindAsEventListener(inputElem));var br=document.createElement("br");var groupArray=(baseLayer)?this.baseLayerInputs:this.dataLayerInputs;groupArray.push(inputElem);var groupDiv=(baseLayer)?this.baseLayersDiv:this.dataLayersDiv;if(vectorLayer){vectorInputElem=document.createElement("input");vectorInputElem.name="VectorRadio";vectorInputElem.type="radio";vectorInputElem.layer=layer;groupDiv.appendChild(vectorInputElem);OpenLayers.Event.observe(vectorInputElem,"mouseup",this.onVectorInputClick.bindAsEventListener(this));}
groupDiv.appendChild(inputElem);groupDiv.appendChild(labelSpan);groupDiv.appendChild(br);}}
this.dataLbl.style.display=(containsOverlays)?"":"none";return this.div;},onInputClick:function(e){if(!this.disabled){if(this.type=="radio"){this.checked=true;this.layer.map.setBaseLayer(this.layer,true);this.layer.map.events.triggerEvent("changebaselayer");}else{this.checked=!this.checked;this.control.updateMap();}}
OpenLayers.Event.stop(e);},onVectorInputClick:function(e){if(this.selectedVectorLayer){this.selectedVectorLayer.div.style.zIndex=this.selectedVectorLayerZIndex;}
var vectorInput=e.target||e.srcElement;this.selectedVectorLayer=vectorInput.layer;this.selectedVectorLayerZIndex=this.selectedVectorLayer.div.style.zIndex;this.selectedVectorLayer.div.style.zIndex=850;if(!vectorInput.disabled){vectorInput.checked=true;}},onLayerClick:function(e){this.updateMap();},updateMap:function(){for(var i=0;i<this.baseLayerInputs.length;i++){var input=this.baseLayerInputs[i];if(input.checked){this.map.setBaseLayer(input.layer,false);}}
for(var i=0;i<this.dataLayerInputs.length;i++){var input=this.dataLayerInputs[i];input.layer.setVisibility(input.checked,true);}},maximizeControl:function(e){this.div.style.width="20em";this.div.style.height="";this.showControls(false);if(e!=null){OpenLayers.Event.stop(e);}},minimizeControl:function(e){this.div.style.width="0px";this.div.style.height="0px";this.showControls(true);if(e!=null){OpenLayers.Event.stop(e);}},showControls:function(minimize){this.maximizeDiv.style.display=minimize?"":"none";this.minimizeDiv.style.display=minimize?"none":"";this.layersDiv.style.display=minimize?"none":"";},loadContents:function(){this.div.style.position="absolute";this.div.style.top="10px";this.div.style.right="0px";this.div.style.left="";this.div.style.fontFamily="sans-serif";this.div.style.fontWeight="bold";this.div.style.marginTop="3px";this.div.style.marginLeft="3px";this.div.style.marginBottom="3px";this.div.style.fontSize="smaller";this.div.style.color="white";this.div.style.backgroundColor="transparent";OpenLayers.Event.observe(this.div,"mouseup",this.mouseUp.bindAsEventListener(this));OpenLayers.Event.observe(this.div,"click",this.ignoreEvent);OpenLayers.Event.observe(this.div,"mousedown",this.mouseDown.bindAsEventListener(this));OpenLayers.Event.observe(this.div,"dblclick",this.ignoreEvent);this.layersDiv=document.createElement("div");this.layersDiv.id="layersDiv";this.layersDiv.style.paddingTop="5px";this.layersDiv.style.paddingLeft="10px";this.layersDiv.style.paddingBottom="5px";this.layersDiv.style.paddingRight="75px";this.layersDiv.style.backgroundColor=this.activeColor;this.layersDiv.style.width="100%";this.layersDiv.style.height="100%";var baseLbl=document.createElement("div");baseLbl.innerHTML="<u>Base Layer</u>";baseLbl.style.marginTop="3px";baseLbl.style.marginLeft="3px";baseLbl.style.marginBottom="3px";this.baseLayersDiv=document.createElement("div");this.baseLayersDiv.style.paddingLeft="10px";this.dataLbl=document.createElement("div");this.dataLbl.innerHTML="<u>Overlays</u>";this.dataLbl.style.marginTop="3px";this.dataLbl.style.marginLeft="3px";this.dataLbl.style.marginBottom="3px";this.dataLayersDiv=document.createElement("div");this.dataLayersDiv.style.paddingLeft="10px";if(this.ascending){this.layersDiv.appendChild(baseLbl);this.layersDiv.appendChild(this.baseLayersDiv);this.layersDiv.appendChild(this.dataLbl);this.layersDiv.appendChild(this.dataLayersDiv);}else{this.layersDiv.appendChild(this.dataLbl);this.layersDiv.appendChild(this.dataLayersDiv);this.layersDiv.appendChild(baseLbl);this.layersDiv.appendChild(this.baseLayersDiv);}
this.div.appendChild(this.layersDiv);Rico.Corner.round(this.div,{corners:"tl bl",bgColor:"transparent",color:this.activeColor,blend:false});Rico.Corner.changeOpacity(this.layersDiv,0.75);var imgLocation=OpenLayers.Util.getImagesLocation();var sz=new OpenLayers.Size(18,18);var img=imgLocation+'layer-switcher-maximize.png';this.maximizeDiv=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_MaximizeDiv",null,sz,img,"absolute");this.maximizeDiv.style.top="5px";this.maximizeDiv.style.right="0px";this.maximizeDiv.style.left="";this.maximizeDiv.style.display="none";OpenLayers.Event.observe(this.maximizeDiv,"click",this.maximizeControl.bindAsEventListener(this));this.div.appendChild(this.maximizeDiv);var img=imgLocation+'layer-switcher-minimize.png';var sz=new OpenLayers.Size(18,18);this.minimizeDiv=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_MinimizeDiv",null,sz,img,"absolute");this.minimizeDiv.style.top="5px";this.minimizeDiv.style.right="0px";this.minimizeDiv.style.left="";this.minimizeDiv.style.display="none";OpenLayers.Event.observe(this.minimizeDiv,"click",this.minimizeControl.bindAsEventListener(this));this.div.appendChild(this.minimizeDiv);},ignoreEvent:function(evt){OpenLayers.Event.stop(evt);},mouseDown:function(evt){this.mouseDown=true;this.ignoreEvent(evt);},mouseUp:function(evt){if(this.mouseDown){this.mouseDown=false;this.ignoreEvent(evt);}},CLASS_NAME:"OpenLayers.Control.LayerSwitcher"});OpenLayers.Control.MouseDefaults=OpenLayers.Class.create();OpenLayers.Control.MouseDefaults.prototype=OpenLayers.Class.inherit(OpenLayers.Control,{performedDrag:false,image:"transform-move.gif",size:new OpenLayers.Size(22,22),initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments);},turnOn:function(){this.map.events.register("click",this,this.defaultClick);this.map.events.register("dblclick",this,this.defaultDblClick);this.map.events.register("mousedown",this,this.defaultMouseDown);this.map.events.register("mouseup",this,this.defaultMouseUp);this.map.events.register("mousemove",this,this.defaultMouseMove);this.map.events.register("mouseout",this,this.defaultMouseOut);this.onWheelEvent=this.onWheelEvent.bindAsEventListener(this);OpenLayers.Event.observe(window,"DOMMouseScroll",this.onWheelEvent,false);OpenLayers.Event.observe(window,"mousewheel",this.onWheelEvent,false);OpenLayers.Event.observe(document,"mousewheel",this.onWheelEvent,false);},turnOff:function(){this.map.events.unregister("click",this,this.defaultClick);this.map.events.unregister("dblclick",this,this.defaultDblClick);this.map.events.unregister("mousedown",this,this.defaultMouseDown);this.map.events.unregister("mouseup",this,this.defaultMouseUp);this.map.events.unregister("mousemove",this,this.defaultMouseMove);this.map.events.unregister("mouseout",this,this.defaultMouseOut);OpenLayers.Event.stopObserving(window,"DOMMouseScroll",this.onWheelEvent,false);OpenLayers.Event.stopObserving(window,"mousewheel",this.onWheelEvent,false);OpenLayers.Event.stopObserving(document,"mousewheel",this.onWheelEvent,false);},draw:function(){this.map.events.register("click",this,this.defaultClick);this.map.events.register("dblclick",this,this.defaultDblClick);this.map.events.register("mousedown",this,this.defaultMouseDown);this.map.events.register("mouseup",this,this.defaultMouseUp);this.map.events.register("mousemove",this,this.defaultMouseMove);this.map.events.register("mouseout",this,this.defaultMouseOut);},defaultClick:function(evt){if(!OpenLayers.Event.isLeftClick(evt))return;var notAfterDrag=!this.performedDrag;this.performedDrag=false;return notAfterDrag;},defaultDblClick:function(evt){var newCenter=this.map.getLonLatFromViewPortPx(evt.xy);this.map.setCenter(newCenter,this.map.zoom+1);OpenLayers.Event.stop(evt);return false;},defaultMouseDown:function(evt){if(!OpenLayers.Event.isLeftClick(evt))return;this.mouseDragStart=evt.xy.clone();this.performedDrag=false;if(evt.shiftKey){this.map.div.style.cursor="crosshair";this.zoomBox=OpenLayers.Util.createDiv('zoomBox',this.mouseDragStart,null,null,"absolute","2px solid red");this.zoomBox.style.backgroundColor="white";this.zoomBox.style.filter="alpha(opacity=50)";this.zoomBox.style.opacity="0.50";this.zoomBox.style.fontSize="1px";this.zoomBox.style.zIndex=this.map.Z_INDEX_BASE["Popup"]-1;this.map.viewPortDiv.appendChild(this.zoomBox);}
document.onselectstart=function(){return false;}
OpenLayers.Event.stop(evt);},defaultMouseMove:function(evt){if(this.mouseDragStart!=null){if(this.zoomBox){var deltaX=Math.abs(this.mouseDragStart.x-evt.xy.x);var deltaY=Math.abs(this.mouseDragStart.y-evt.xy.y);this.zoomBox.style.width=Math.max(1,deltaX)+"px";this.zoomBox.style.height=Math.max(1,deltaY)+"px";if(evt.xy.x<this.mouseDragStart.x){this.zoomBox.style.left=evt.xy.x+"px";}
if(evt.xy.y<this.mouseDragStart.y){this.zoomBox.style.top=evt.xy.y+"px";}}else{var deltaX=this.mouseDragStart.x-evt.xy.x;var deltaY=this.mouseDragStart.y-evt.xy.y;var size=this.map.getSize();var newXY=new OpenLayers.Pixel(size.w/2+deltaX,size.h/2+deltaY);var newCenter=this.map.getLonLatFromViewPortPx(newXY);this.map.setCenter(newCenter,null,true);this.mouseDragStart=evt.xy.clone();this.map.div.style.cursor="move";}
this.performedDrag=true;}},defaultMouseUp:function(evt){if(!OpenLayers.Event.isLeftClick(evt))return;if(this.zoomBox){this.zoomBoxEnd(evt);}else{if(this.performedDrag){this.map.setCenter(this.map.center);}}
document.onselectstart=null;this.mouseDragStart=null;this.map.div.style.cursor="default";},defaultMouseOut:function(evt){if(this.mouseDragStart!=null&&OpenLayers.Util.mouseLeft(evt,this.map.div)){if(this.zoomBox){this.removeZoomBox();}
this.mouseDragStart=null;}},defaultWheelUp:function(){this.map.zoomIn();},defaultWheelDown:function(){this.map.zoomOut();},zoomBoxEnd:function(evt){if(this.mouseDragStart!=null){if(Math.abs(this.mouseDragStart.x-evt.xy.x)>5||Math.abs(this.mouseDragStart.y-evt.xy.y)>5){var start=this.map.getLonLatFromViewPortPx(this.mouseDragStart);var end=this.map.getLonLatFromViewPortPx(evt.xy);var top=Math.max(start.lat,end.lat);var bottom=Math.min(start.lat,end.lat);var left=Math.min(start.lon,end.lon);var right=Math.max(start.lon,end.lon);var bounds=new OpenLayers.Bounds(left,bottom,right,top);this.map.zoomToExtent(bounds);}else{var end=this.map.getLonLatFromViewPortPx(evt.xy);this.map.setCenter(new OpenLayers.LonLat((end.lon),(end.lat)),this.map.getZoom()+1);}
this.removeZoomBox();}},removeZoomBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox);this.zoomBox=null;},onWheelEvent:function(e){var inMap=false;var elem=OpenLayers.Event.element(e);while(elem!=null){if(this.map&&elem==this.map.div){inMap=true;break;}
elem=elem.parentNode;}
if(inMap){var delta=0;if(!e){e=window.event;}
if(e.wheelDelta){delta=e.wheelDelta/120;if(window.opera){delta=-delta;}}else if(e.detail){delta=-e.detail/3;}
if(delta){if(delta<0){this.defaultWheelDown();}else{this.defaultWheelUp();}}
OpenLayers.Event.stop(e);}},CLASS_NAME:"OpenLayers.Control.MouseDefaults"});OpenLayers.Control.MousePosition=OpenLayers.Class.create();OpenLayers.Control.MousePosition.prototype=OpenLayers.Class.inherit(OpenLayers.Control,{element:null,prefix:'',separator:', ',suffix:'',numdigits:5,granularity:10,lastXy:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,arguments);},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.div.left="";this.div.top="";this.div.className="olControlMousePosition";this.element=this.div;}
this.redraw();return this.div;},redraw:function(evt){var lonLat;if(evt==null){lonLat=new OpenLayers.LonLat(0,0);}else{if(this.lastXy==null||Math.abs(evt.xy.x-this.lastXy.x)>this.granularity||Math.abs(evt.xy.y-this.lastXy.y)>this.granularity)
{this.lastXy=evt.xy;return;}
lonLat=this.map.getLonLatFromPixel(evt.xy);this.lastXy=evt.xy;}
var digits=parseInt(this.numdigits);var newHtml=this.prefix+
lonLat.lon.toFixed(digits)+
this.separator+
lonLat.lat.toFixed(digits)+
this.suffix;if(newHtml!=this.element.innerHTML){this.element.innerHTML=newHtml;}},setMap:function(){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.map.events.register('mousemove',this,this.redraw);},CLASS_NAME:"OpenLayers.Control.MousePosition"});OpenLayers.Control.PanZoom=OpenLayers.Class.create();OpenLayers.Control.PanZoom.X=4;OpenLayers.Control.PanZoom.Y=4;OpenLayers.Control.PanZoom.prototype=OpenLayers.Class.inherit(OpenLayers.Control,{slideFactor:50,buttons:null,position:null,initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.position=new OpenLayers.Pixel(OpenLayers.Control.PanZoom.X,OpenLayers.Control.PanZoom.Y);},draw:function(px){OpenLayers.Control.prototype.draw.apply(this,arguments);px=this.position;this.buttons=new Array();var sz=new OpenLayers.Size(18,18);var centered=new OpenLayers.Pixel(px.x+sz.w/2,px.y);this._addButton("panup","north-mini.png",centered,sz);px.y=centered.y+sz.h;this._addButton("panleft","west-mini.png",px,sz);this._addButton("panright","east-mini.png",px.add(sz.w,0),sz);this._addButton("pandown","south-mini.png",centered.add(0,sz.h*2),sz);this._addButton("zoomin","zoom-plus-mini.png",centered.add(0,sz.h*3+5),sz);this._addButton("zoomworld","zoom-world-mini.png",centered.add(0,sz.h*4+5),sz);this._addButton("zoomout","zoom-minus-mini.png",centered.add(0,sz.h*5+5),sz);return this.div;},_addButton:function(id,img,xy,sz){var imgLocation=OpenLayers.Util.getImagesLocation()+img;var btn=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_PanZoom_"+id,xy,sz,imgLocation,"absolute");this.div.appendChild(btn);btn.onmousedown=this.buttonDown.bindAsEventListener(btn);btn.ondblclick=this.doubleClick.bindAsEventListener(btn);btn.onclick=this.doubleClick.bindAsEventListener(btn);btn.action=id;btn.map=this.map;btn.slideFactor=this.slideFactor;this.buttons.push(btn);return btn;},doubleClick:function(evt){OpenLayers.Event.stop(evt);return false;},buttonDown:function(evt){if(!OpenLayers.Event.isLeftClick(evt))return;switch(this.action){case"panup":this.map.pan(0,-50);break;case"pandown":this.map.pan(0,50);break;case"panleft":this.map.pan(-50,0);break;case"panright":this.map.pan(50,0);break;case"zoomin":this.map.zoomIn();break;case"zoomout":this.map.zoomOut();break;case"zoomworld":this.map.zoomToMaxExtent();break;}
OpenLayers.Event.stop(evt);},destroy:function(){OpenLayers.Control.prototype.destroy.apply(this,arguments);for(i=0;i<this.buttons.length;i++){this.buttons[i].map=null;}},CLASS_NAME:"OpenLayers.Control.PanZoom"});OpenLayers.Control.Permalink=OpenLayers.Class.create();OpenLayers.Control.Permalink.prototype=OpenLayers.Class.inherit(OpenLayers.Control,{element:null,base:'',initialize:function(element,base){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.element=element;if(base){this.base=base;}},setMap:function(map){OpenLayers.Control.prototype.setMap.apply(this,arguments);for(var i=0;i<this.map.controls.length;i++){var control=this.map.controls[i];if(control.CLASS_NAME=="OpenLayers.Control.ArgParser"){break;}}
if(i==this.map.controls.length){this.map.addControl(new OpenLayers.Control.ArgParser());}},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.div.className='olControlPermalink';this.element=document.createElement("a");this.element.style.fontSize="smaller";this.element.innerHTML="Permalink";this.element.href="";this.div.appendChild(this.element);}
this.map.events.register('moveend',this,this.updateLink);return this.div;},updateLink:function(){var center=this.map.getCenter();var zoom="zoom="+this.map.getZoom();var lat="lat="+Math.round(center.lat*100000)/100000;var lon="lon="+Math.round(center.lon*100000)/100000;var layers="layers=";for(var i=0;i<this.map.layers.length;i++){var layer=this.map.layers[i];if(layer.isBaseLayer){layers+=(layer==this.map.baseLayer)?"B":"0";}else{layers+=(layer.getVisibility())?"T":"F";}}
var href=this.base+"?"+lat+"&"+lon+"&"+zoom+"&"+layers;this.element.href=href;},CLASS_NAME:"OpenLayers.Control.Permalink"});OpenLayers.Control.Scale=OpenLayers.Class.create();OpenLayers.Control.Scale.prototype=OpenLayers.Class.inherit(OpenLayers.Control,{element:null,initialize:function(element){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.element=element;},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.element=document.createElement("div");this.div.className="olControlScale";this.element.style.fontSize="smaller";this.div.appendChild(this.element);}
this.map.events.register('moveend',this,this.updateScale);this.updateScale();return this.div;},updateScale:function(){var scale=this.map.getScale();if(!scale)return;if(scale>=9500&&scale<=950000){scale=Math.round(scale/1000)+"K";}else if(scale>=950000){scale=Math.round(scale/1000000)+"M";}else{scale=Math.round(scale/100)*100;}
this.element.innerHTML="Scale = 1 : "+scale;},CLASS_NAME:"OpenLayers.Control.Scale"});OpenLayers.State={UNKNOWN:'Unknown',INSERT:'Insert',UPDATE:'Update',DELETE:'Delete'}
OpenLayers.Feature=OpenLayers.Class.create();OpenLayers.Feature.prototype={events:null,layer:null,id:null,geometry:null,data:null,marker:null,attributes:null,popup:null,state:null,initialize:function(layer,geometry,data){this.layer=layer;this.setGeometry(geometry);this.data=(data!=null)?data:new Object();this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");this.state=null;},destroy:function(){if((this.layer!=null)&&(this.layer.map!=null)){if(this.popup!=null){this.layer.map.removePopup(this.popup);}}
this.events=null;this.layer=null;this.id=null;this.geometry=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.geometry);}
return onScreen;},createMarker:function(){var marker=null;if(this.geometry!=null){this.marker=new OpenLayers.Marker(this.geometry,this.data.icon);}
return this.marker;},destroyMarker:function(){this.marker.destroy();},createPopup:function(){if(this.geometry!=null){var id=this.id+"_popup";var anchor=(this.marker)?this.marker.icon:null;this.popup=new OpenLayers.Popup.AnchoredBubble(id,this.geometry,this.data.popupSize,this.data.popupContentHTML,anchor);}
return this.popup;},setGeometry:function(geometry){if(geometry){this.geometry=geometry;this.geometry.feature=this;this._setGeometryFeatureReference(this.geometry,this);}},_setGeometryFeatureReference:function(geometry,feature){geometry.feature=feature;if(geometry.components){for(var i=0;i<geometry.components.length;i++){this._setGeometryFeatureReference(geometry.components[i],feature);}}},setAttributes:function(attributes){this.attributes=attributes;},atPoint:function(lonlat,toleranceLon,toleranceLat){var atPoint=false;if(this.geometry){atPoint=this.geometry.atPoint(lonlat,toleranceLon,toleranceLat);}
return atPoint;},setStyle:function(style){this.style=style;},getStyle:function(){return style;},destroyPopup:function(){this.popup.destroy()},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"};OpenLayers.Geometry.Aggregate=function(){}
OpenLayers.Geometry.Aggregate.prototype=OpenLayers.Class.inherit(OpenLayers.Geometry,{getComponents:function(){return this.components?this.components:null;},addComponents:function(components){if(!(components instanceof Array)){components=[components];}
if(this.components){this.components=this.components.concat(components);}else{this.components=[].concat(components);}},removeComponents:function(components){if(!(components instanceof Array)){components=[components];}
for(var i=0;i<components.length;i++){this.components=OpenLayers.Util.removeItem(this.components,components[i]);}},CLASS_NAME:"OpenLayers.Geometry.Aggregate"});OpenLayers.Geometry.Curve=OpenLayers.Class.create();OpenLayers.Geometry.Curve.prototype=OpenLayers.Class.inherit(OpenLayers.Geometry,{initialize:function(points){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.path=[];if(points&&points instanceof Array){for(var i=0;i<points.length;i++){this.addPoint(points[i]);}}
this.bbox=new OpenLayers.Geometry.Rectangle();this.bbox.geometry=this;},getBoundingBox:function(){if(this.path.length>0){var xmin,ymin,xmax,ymax=null;for(var i=0;i<this.path.length;i++){point=this.path[i];if(point.lon<xmin||xmin==null){xmin=point.lon;}
if(point.lon>xmax||xmax==null){xmax=point.lon;}
if(point.lat<ymin||ymin==null){ymin=point.lat;}
if(point.lat>ymax||ymax==null){ymax=point.lat;}}
this.bbox.x=xmin;this.bbox.y=ymin;this.bbox.width=xmax-xmin;this.bbox.height=ymax-ymin;return this.bbox;}},addPoint:function(point,index){if(point){if(index){var path1=this.path.slice(0,index);var path2=this.path.slice(index,this.path.length);this.path=path1.concat([point],path2);}else{this.path.push(point);}}},removePoint:function(point){this.path=OpenLayers.Util.removeItem(this.path,point);},clone:function(){return new OpenLayers.Geometry.Curve(this.path);},CLASS_NAME:"OpenLayers.Geometry.Curve"});OpenLayers.Geometry.Point=OpenLayers.Class.create();OpenLayers.Geometry.Point.prototype=OpenLayers.Class.inherit(OpenLayers.LonLat,OpenLayers.Geometry,{initialize:function(x,y){OpenLayers.LonLat.prototype.initialize.apply(this,arguments);OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");this.x=this.lon;this.y=this.lat;},setX:function(x){this.lon=x;this.x=x;},setY:function(y){this.lat=y;this.y=y;},getX:function(){return this.lon;},getY:function(){return this.lat;},clone:function(){return new OpenLayers.Geometry.LineString(this.x,this.y);},toString:function(){return this.x+","+this.y;},CLASS_NAME:"OpenLayers.Geometry.Point"});OpenLayers.Geometry.Rectangle=OpenLayers.Class.create();OpenLayers.Geometry.Rectangle.prototype=OpenLayers.Class.inherit(OpenLayers.Geometry,{initialize:function(x,y,width,height){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.x=x;this.y=y;this.width=width;this.height=height;this.setPath();},getBoundingBox:function(){return this;},setPath:function(){p1=new OpenLayers.Geometry.Point;p1.x=this.x;p1.y=this.y;p2=new OpenLayers.Geometry.Point;p2.x=this.x+this.width;p2.y=this.y;p3=new OpenLayers.Geometry.Point;p3.x=this.x+this.width;p3.y=this.y-this.height;p4=new OpenLayers.Geometry.Point;p4.x=this.x;p4.y=this.y-this.height;this.path=[this.p1,this.p2,this.p3,this.p4];},CLASS_NAME:"OpenLayers.Geometry.Rectangle"});OpenLayers.Geometry.Surface=OpenLayers.Class.create();OpenLayers.Geometry.Surface.prototype=OpenLayers.Class.inherit(OpenLayers.Geometry,{CLASS_NAME:"OpenLayers.Geometry.Surface"});OpenLayers.Layer.Canvas=OpenLayers.Class.create();OpenLayers.Layer.Canvas.prototype=OpenLayers.Class.inherit(OpenLayers.Layer,{isBaseLayer:false,isFixed:true,canvas:null,lines:new Array(),initialize:function(name,options){OpenLayers.Layer.prototype.initialize.apply(this,arguments);},destroy:function(){canvas=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments);},moveTo:function(bounds,zoomChanged,dragging){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);this.redraw();},setStrokeColor:function(color){var ctx=this.canvas.getContext("2d");ctx.strokeStyle=color;},setStrokeWidth:function(width){var ctx=this.canvas.getContext("2d");ctx.lineWidth=width;},setAlpha:function(alpha){var ctx=this.canvas.getContext("2d");ctx.globalAlpha=alpha;},clearCanvas:function(){if(this.canvas!=null){this.canvas.getContext("2d").clearRect(0,0,this.map.getSize().w,this.map.getSize().h);}},drawLine:function(start,end){var ctx=this.canvas.getContext("2d");this.addLine(start,end);this.lines.push(new Array(start,end,ctx.strokeStyle,ctx.lineWidth,ctx.globalAlpha));},addLine:function(start,end){var ctx=this.canvas.getContext("2d");var startpx=this.map.getPixelFromLonLat(start);var endpx=this.map.getPixelFromLonLat(end);ctx.beginPath();ctx.moveTo(startpx.x,startpx.y);ctx.lineTo(endpx.x,endpx.y);ctx.closePath();ctx.stroke();},redraw:function(){if(!this.canvas){this.canvas=document.createElement("CANVAS");this.canvas.setAttribute("width",this.map.getSize().w);this.canvas.setAttribute("height",this.map.getSize().h);this.div.appendChild(this.canvas);}else{this.clearCanvas();}
for(var i=0;i<this.lines.length;i++){this.setStrokeColor(this.lines[i][2]);this.setStrokeWidth(this.lines[i][3]);this.setAlpha(this.lines[i][4]);this.addLine(this.lines[i][0],this.lines[i][1]);}},CLASS_NAME:"OpenLayers.Layer.Canvas"});OpenLayers.Layer.EventPane=OpenLayers.Class.create();OpenLayers.Layer.EventPane.prototype=OpenLayers.Class.inherit(OpenLayers.Layer,{isBaseLayer:true,isFixed:true,pane:null,mapObject:null,initialize:function(name,options){OpenLayers.Layer.prototype.initialize.apply(this,arguments);if(this.pane==null){this.pane=OpenLayers.Util.createDiv(this.div.id+"_EventPane");}},destroy:function(){this.mapObject=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments);},setMap:function(map){OpenLayers.Layer.prototype.setMap.apply(this,arguments);this.pane.style.zIndex=parseInt(this.div.style.zIndex)+1;this.pane.style.display=this.div.style.display;this.pane.style.width="100%";this.pane.style.height="100%";if(/MSIE/.test(navigator.userAgent)){this.pane.style.background="url("+OpenLayers.Util.getImagesLocation()+"blank.gif)";}
if(this.isFixed){this.map.viewPortDiv.appendChild(this.pane);}else{this.map.layerContainerDiv.appendChild(this.pane);}
this.loadMapObject();if(this.mapObject==null){this.loadWarningMessage();}},loadWarningMessage:function(){this.div.style.backgroundColor="darkblue";var viewSize=this.map.getSize();msgW=Math.min(viewSize.w,300);msgH=Math.min(viewSize.h,200);var size=new OpenLayers.Size(msgW,msgH);var centerPx=new OpenLayers.Pixel(viewSize.w/2,viewSize.h/2);var topLeft=centerPx.add(-size.w/2,-size.h/2);var div=OpenLayers.Util.createDiv(this.name+"_warning",topLeft,size,null,null,null,"auto");div.style.padding="7px";div.style.backgroundColor="yellow";div.innerHTML=this.getWarningHTML();this.div.appendChild(div);},display:function(display){OpenLayers.Layer.prototype.display.apply(this,arguments);this.pane.style.display=this.div.style.display;},setZIndex:function(zIndex){OpenLayers.Layer.prototype.setZIndex.apply(this,arguments);this.pane.style.zIndex=parseInt(this.div.style.zIndex)+1;},moveTo:function(bounds,zoomChanged,dragging){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);if(this.mapObject!=null){var newCenter=this.map.getCenter();var newZoom=this.map.getZoom();if(newCenter!=null){var moOldCenter=this.getMapObjectCenter();var oldCenter=this.getOLLonLatFromMapObjectLonLat(moOldCenter);var moOldZoom=this.getMapObjectZoom();var oldZoom=this.getOLZoomFromMapObjectZoom(moOldZoom);if(!(newCenter.equals(oldCenter))||!(newZoom==oldZoom)){var center=this.getMapObjectLonLatFromOLLonLat(newCenter);var zoom=this.getMapObjectZoomFromOLZoom(newZoom);this.setMapObjectCenter(center,zoom);}}}},getLonLatFromViewPortPx:function(viewPortPx){var lonlat=null;if((this.mapObject!=null)&&(this.getMapObjectCenter()!=null)){var moPixel=this.getMapObjectPixelFromOLPixel(viewPortPx);var moLonLat=this.getMapObjectLonLatFromMapObjectPixel(moPixel)
lonlat=this.getOLLonLatFromMapObjectLonLat(moLonLat);}
return lonlat;},getViewPortPxFromLonLat:function(lonlat){var viewPortPx=null;if((this.mapObject!=null)&&(this.getMapObjectCenter()!=null)){var moLonLat=this.getMapObjectLonLatFromOLLonLat(lonlat);var moPixel=this.getMapObjectPixelFromMapObjectLonLat(moLonLat)
viewPortPx=this.getOLPixelFromMapObjectPixel(moPixel);}
return viewPortPx;},getOLLonLatFromMapObjectLonLat:function(moLonLat){var olLonLat=null;if(moLonLat!=null){var lon=this.getLongitudeFromMapObjectLonLat(moLonLat);var lat=this.getLatitudeFromMapObjectLonLat(moLonLat);olLonLat=new OpenLayers.LonLat(lon,lat);}
return olLonLat;},getMapObjectLonLatFromOLLonLat:function(olLonLat){var moLatLng=null;if(olLonLat!=null){moLatLng=this.getMapObjectLonLatFromLonLat(olLonLat.lon,olLonLat.lat);}
return moLatLng;},getOLPixelFromMapObjectPixel:function(moPixel){var olPixel=null;if(moPixel!=null){var x=this.getXFromMapObjectPixel(moPixel);var y=this.getYFromMapObjectPixel(moPixel);olPixel=new OpenLayers.Pixel(x,y);}
return olPixel;},getMapObjectPixelFromOLPixel:function(olPixel){var moPixel=null;if(olPixel!=null){moPixel=this.getMapObjectPixelFromXY(olPixel.x,olPixel.y);}
return moPixel;},CLASS_NAME:"OpenLayers.Layer.EventPane"});OpenLayers.Layer.HTTPRequest=OpenLayers.Class.create();OpenLayers.Layer.HTTPRequest.prototype=OpenLayers.Class.inherit(OpenLayers.Layer,{url:null,params:null,reproject:false,initialize:function(name,url,params,options){var newArguments=arguments;newArguments=[name,options];OpenLayers.Layer.prototype.initialize.apply(this,newArguments);this.url=url;this.params=OpenLayers.Util.extend(new Object(),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.options);}
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);},getFullRequestString:function(newParams,altUrl){var url=(altUrl==null)?this.url:altUrl;var requestString=url;var allParams=OpenLayers.Util.extend(new Object(),this.params);var allParams=OpenLayers.Util.extend(allParams,newParams);var paramsString=OpenLayers.Util.getParameterString(allParams);if(paramsString!=""){var lastServerChar=this.url.charAt(this.url.length-1);if((lastServerChar=="&")||(lastServerChar=="?")){requestString+=paramsString;}else{if(this.url.indexOf('?')==-1){requestString+='?'+paramsString;}else{requestString+='&'+paramsString;}}}
return requestString;},CLASS_NAME:"OpenLayers.Layer.HTTPRequest"});OpenLayers.Layer.Image=OpenLayers.Class.create();OpenLayers.Layer.Image.prototype=OpenLayers.Class.inherit(OpenLayers.Layer,{isBaseLayer:true,url:null,extent:null,size:null,tile:null,aspectRatio:null,initialize:function(name,url,extent,size,options){this.url=url;this.extent=extent;this.size=size;OpenLayers.Layer.prototype.initialize.apply(this,[name,options]);this.aspectRatio=(this.extent.getHeight()/this.size.h)/(this.extent.getWidth()/this.size.w);},destroy:function(){this.tile.destroy();this.tile=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.Image(this.name,this.url,this.extent,this.size,this.options);}
obj=OpenLayers.Layer.prototype.clone.apply(this,[obj]);return obj;},setMap:function(map){if(this.options.maxResolution==null){this.options.maxResolution=this.extent.getWidth()/this.size.w;}
OpenLayers.Layer.prototype.setMap.apply(this,arguments);},moveTo:function(bounds,zoomChanged,dragging){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);var firstRendering=(this.tile==null);if(zoomChanged||firstRendering){var tileWidth=this.extent.getWidth()/this.map.getResolution();var tileHeight=this.extent.getHeight()/(this.map.getResolution()*this.aspectRatio);var tileSize=new OpenLayers.Size(tileWidth,tileHeight);var ul=new OpenLayers.LonLat(this.extent.left,this.extent.top);var ulPx=this.map.getLayerPxFromLonLat(ul);if(firstRendering){this.tile=new OpenLayers.Tile.Image(this,ulPx,this.extent,this.url,tileSize);}else{this.tile.size=tileSize.clone();this.tile.position=ulPx.clone();}
this.tile.draw();}},setUrl:function(newUrl){this.url=newUrl;this.draw();},getURL:function(bounds){return this.url;},CLASS_NAME:"OpenLayers.Layer.Image"});OpenLayers.Layer.Markers=OpenLayers.Class.create();OpenLayers.Layer.Markers.prototype=OpenLayers.Class.inherit(OpenLayers.Layer,{isBaseLayer:false,markers:null,initialize:function(name,options){OpenLayers.Layer.prototype.initialize.apply(this,arguments);this.markers=new Array();},destroy:function(){this.clearMarkers();markers=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments);},moveTo:function(bounds,zoomChanged,dragging){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);if(zoomChanged){this.redraw();}},addMarker:function(marker){this.markers.push(marker);if(this.map&&this.map.getExtent()){marker.map=this.map;this.drawMarker(marker);}},removeMarker:function(marker){OpenLayers.Util.removeItem(this.markers,marker);if((marker.icon!=null)&&(marker.icon.imageDiv!=null)&&(marker.icon.imageDiv.parentNode==this.div)){this.div.removeChild(marker.icon.imageDiv);}},clearMarkers:function(){if(this.markers!=null){while(this.markers.length>0){this.removeMarker(this.markers[0]);}}},redraw:function(){for(i=0;i<this.markers.length;i++){this.drawMarker(this.markers[i]);}},drawMarker:function(marker){var px=this.map.getLayerPxFromLonLat(marker.lonlat);if(px==null){marker.display(false);}else{var markerImg=marker.draw(px);if(!marker.drawn){this.div.appendChild(markerImg);marker.drawn=true;}}},CLASS_NAME:"OpenLayers.Layer.Markers"});OpenLayers.Layer.Vector=OpenLayers.Class.create();OpenLayers.Layer.Vector.prototype=OpenLayers.Class.inherit(OpenLayers.Layer,{isBaseLayer:false,isFixed:true,isVector:true,isSelected:false,features:null,map:null,url:'',parser:null,writer:null,initialize:function(name,options){OpenLayers.Layer.prototype.initialize.apply(this,arguments);if(!this.renderer){this.renderer=document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#SVG","1.1")?new OpenLayers.Renderer.Svg(this):new OpenLayers.Renderer.Vml(this);}
if(!this.style){this.style=OpenLayers.Style.DefaultRendererStyle;}
if(!this.parser){}
this.features=new Array();this.selection=new Array();},addFeatures:function(features){if(!(features instanceof Array)){features=[features];}
for(var i=0;i<features.length;i++){features[i].layer=this;}
this.features=this.features.concat(features);for(var i=0;i<features.length;i++){var style=features[i].geometry.style||this.style;var feature=this.renderer.drawGeometry(features[i].geometry,style);features[i].toState(OpenLayers.State.INSERT);if(features[i].state==OpenLayers.State.INSERT){this.onFeatureInsert(features[i]);}else if(features[i].state==OpenLayers.State.UNKNOWN){this.onFeatureUnknown(features[i]);}}
return features;},removeFeatures:function(features){if(!(features instanceof Array)){features=[features];}
for(var i=0;i<features.length;i++){var geometry=features[i].geometry;if(geometry.components){for(var j=0;j<geometry.components.length;j++){this.renderer.eraseGeometry(geometry.components[i]);}}else{this.renderer.eraseGeometry(features[i].geometry);}}
for(var i=0;i<features.length;i++){features[i].toState(OpenLayers.State.DELETE);}
return features;},updateFeatures:function(features){for(var i=0;i<features.length;i++){features[i].toState(OpenLayers.State.UPDATE);if(features[i].state==OpenLayers.State.UPDATE){this.onFeatureUpdate(features[i]);}}},moveTo:function(bounds,zoomChanged,minor){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);this.renderer.createRoot(this.div);this.renderer.setSize(this.map.getSize().w,this.map.getSize().h);this.renderer.setExtent(this.map.getExtent().left,this.map.getExtent().top,this.map.getExtent().getWidth(),this.map.getExtent().getHeight());},onFeatureUpdate:function(feature){},onFeatureInsert:function(feature){},onFeatureUnknown:function(feature){},commit:function(){if(!this.writer){this.writer=new OpenLayers.Writer.WFS();}
this.writer.commit(this.url,this.features,this.commitSuccess,this.commitFailure);},CLASS_NAME:"OpenLayers.Layer.Vector"});OpenLayers.Map=OpenLayers.Class.create();OpenLayers.Map.TILE_WIDTH=256;OpenLayers.Map.TILE_HEIGHT=256;OpenLayers.Map.prototype={Z_INDEX_BASE:{BaseLayer:100,Overlay:325,Popup:750,Control:1000},EVENT_TYPES:["addlayer","removelayer","changelayer","movestart","move","moveend","zoomend","popupopen","popupclose","addmarker","removemarker","clearmarkers","mouseover","mouseout","mousemove","dragstart","drag","dragend","changebaselayer","Editing"],events:null,div:null,size:null,viewPortDiv:null,layerContainerOrigin:null,layerContainerDiv:null,layers:null,controls:null,popups:null,baseLayer:null,center:null,zoom:0,tileSize:null,projection:"EPSG:4326",units:'degrees',maxResolution:1.40625,minResolution:null,maxScale:null,minScale:null,maxExtent:null,minExtent:null,numZoomLevels:16,theme:null,initialize:function(div,options){this.div=div=$(div);var id=div.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);id=div.id+"_OpenLayers_Container";this.layerContainerDiv=OpenLayers.Util.createDiv(id);this.layerContainerDiv.style.zIndex=this.Z_INDEX_BASE['Popup']-1;this.viewPortDiv.appendChild(this.layerContainerDiv);this.events=new OpenLayers.Events(this,div,this.EVENT_TYPES);this.updateSize();if(navigator.appName.contains("Microsoft")){this.events.register("resize",this,this.updateSize);}else{OpenLayers.Event.observe(window,'resize',this.updateSize.bindAsEventListener(this));}
this.setOptions(options);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);this.layers=[];if(this.controls==null){if(OpenLayers.Control!=null){this.controls=[new OpenLayers.Control.MouseDefaults(),new OpenLayers.Control.PanZoom(),new OpenLayers.Control.ArgParser()];}else{this.controls=[];}}
for(var i=0;i<this.controls.length;i++){this.addControlToMap(this.controls[i]);}
this.popups=new Array();OpenLayers.Event.observe(window,'unload',this.destroy.bindAsEventListener(this));},destroy:function(){if(this.layers!=null){for(var i=0;i<this.layers.length;i++){this.layers[i].destroy();}
this.layers=null;}
if(this.controls!=null){for(var i=0;i<this.controls.length;i++){this.controls[i].destroy();}
this.controls=null;}},setOptions:function(options){this.tileSize=new OpenLayers.Size(OpenLayers.Map.TILE_WIDTH,OpenLayers.Map.TILE_HEIGHT);this.maxExtent=new OpenLayers.Bounds(-180,-90,180,90);this.theme=OpenLayers._getScriptLocation()+'theme/default/style.css';OpenLayers.Util.extend(this,options);},getTileSize:function(){return this.tileSize;},getLayer:function(id){var foundLayer=null;for(var i=0;i<this.layers.length;i++){var layer=this.layers[i];if(layer.id==id){foundLayer=layer;}}
return foundLayer;},setLayerZIndex:function(layer,zIdx){layer.setZIndex(this.Z_INDEX_BASE[layer.isBaseLayer?'BaseLayer':'Overlay']
+zIdx*5);},addLayer:function(layer){layer.div.style.overflow="";this.setLayerZIndex(layer,this.layers.length);if(layer.isFixed){if(layer.isVector){layer.setZIndex(this.Z_INDEX_BASE['Popup']+this.layers.length*5);}
this.viewPortDiv.appendChild(layer.div);}else{this.layerContainerDiv.appendChild(layer.div);}
this.layers.push(layer);layer.setMap(this);if(layer.isBaseLayer){if(this.baseLayer==null){this.setBaseLayer(layer);}else{layer.setVisibility(false);}}else{if(this.getCenter()!=null){layer.moveTo(this.getExtent(),true);}}
this.events.triggerEvent("addlayer");},addLayers:function(layers){for(var i=0;i<layers.length;i++){this.addLayer(layers[i]);}},removeLayer:function(layer){if(layer.isFixed){this.viewPortDiv.removeChild(layer.div);}else{this.layerContainerDiv.removeChild(layer.div);}
layer.map=null;OpenLayers.Util.removeItem(this.layers,layer);if(this.baseLayer==layer){this.baseLayer=null;for(i=0;i<this.layers.length;i++){var iLayer=this.layers[i];if(iLayer.isBaseLayer){this.setBaseLayer(iLayer);break;}}}
this.events.triggerEvent("removelayer");},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;i<this.layers.length;i++)
this.setLayerZIndex(this.layers[i],i);this.events.triggerEvent("changelayer");}},raiseLayer:function(layer,delta){var idx=this.getLayerIndex(layer)+delta;this.setLayerIndex(layer,idx);},setBaseLayer:function(newBaseLayer,noEvent){var oldBaseLayer=this.baseLayer;if(newBaseLayer!=oldBaseLayer){if(OpenLayers.Util.indexOf(this.layers,newBaseLayer)!=-1){if(oldBaseLayer!=null){oldBaseLayer.setVisibility(false,noEvent);}
this.baseLayer=newBaseLayer;this.baseLayer.setVisibility(true,noEvent);var center=this.getCenter();if(center!=null){if(oldBaseLayer==null){this.setCenter(center);}else{this.zoomToExtent(oldBaseLayer.getExtent());}}
if((noEvent==null)||(noEvent==false)){this.events.triggerEvent("changebaselayer");}}}},addControl:function(control,px){this.controls.push(control);this.addControlToMap(control,px);},addControlToMap:function(control,px){control.setMap(this);var div=control.draw(px);if(div){div.style.zIndex=this.Z_INDEX_BASE['Control']+
this.controls.length;this.viewPortDiv.appendChild(div);}},addPopup:function(popup,exclusive){if(exclusive){for(var i=0;i<this.popups.length;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();var oldSize=this.getSize();if(oldSize==null)
this.size=oldSize=newSize;if(!newSize.equals(oldSize)){for(var i=0;i<this.layers.length;i++){this.layers[i].onMapResize();}
this.size=newSize;this.events.element.offsets=null;if(this.baseLayer!=null){var center=new OpenLayers.Pixel(newSize.w/2,newSize.h/2);var centerLL=this.getLonLatFromViewPortPx(center);var zoom=this.getZoom();this.zoom=null;this.setCenter(this.getCenter(),zoom);}}},getCurrentSize:function(){var size=new OpenLayers.Size(this.div.clientWidth,this.div.clientHeight);if(size.w==0&&size.h==0){var dim=OpenLayers.Element.getDimensions(this.div);size.w=dim.width;size.h=dim.height;}
if(size.w==0&&size.h==0){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.getCenter();}
if(resolution==null){resolution=this.getResolution();}
if((center!=null)&&(resolution!=null)){var size=this.getSize();var w_deg=size.w*resolution;var h_deg=size.h*resolution;extent=new OpenLayers.Bounds(center.lon-w_deg/2,center.lat-h_deg/2,center.lon+w_deg/2,center.lat+h_deg/2);}
return extent;},getCenter:function(){return this.center;},getZoom:function(){return this.zoom;},pan:function(dx,dy){var centerPx=this.getViewPortPxFromLonLat(this.getCenter());var newCenterPx=centerPx.add(dx,dy);if(!newCenterPx.equals(centerPx)){var newCenterLonLat=this.getLonLatFromViewPortPx(newCenterPx);this.setCenter(newCenterLonLat);}},setCenter:function(lonlat,zoom,dragging){if(!this.center&&!this.isValidLonLat(lonlat)){lonlat=this.maxExtent.getCenterLonLat();}
var zoomChanged=(this.isValidZoomLevel(zoom))&&(zoom!=this.getZoom());var centerChanged=(this.isValidLonLat(lonlat))&&(!lonlat.equals(this.center));if(zoomChanged||centerChanged||!dragging){if(!dragging){this.events.triggerEvent("movestart");}
if(centerChanged){if((!zoomChanged)&&(this.center)){this.centerLayerContainer(lonlat);}
this.center=lonlat.clone();}
if((zoomChanged)||(this.layerContainerOrigin==null)){this.layerContainerOrigin=this.center.clone();this.layerContainerDiv.style.left="0px";this.layerContainerDiv.style.top="0px";}
if(zoomChanged){this.zoom=zoom;for(var i=0;i<this.popups.length;i++){this.popups[i].updatePosition();}}
var bounds=this.getExtent();this.baseLayer.moveTo(bounds,zoomChanged,dragging);for(var i=0;i<this.layers.length;i++){var layer=this.layers[i];if(!layer.isBaseLayer){var moveLayer;var inRange=layer.calculateInRange();if(layer.inRange!=inRange){layer.inRange=inRange;moveLayer=true;this.events.triggerEvent("changelayer");}else{moveLayer=(layer.visibility&&layer.inRange);}
if(moveLayer){layer.moveTo(bounds,zoomChanged,dragging);}}}
this.events.triggerEvent("move");if(zoomChanged){this.events.triggerEvent("zoomend");}}
if(!dragging){this.events.triggerEvent("moveend");}},centerLayerContainer:function(lonlat){var originPx=this.getViewPortPxFromLonLat(this.layerContainerOrigin);var newPx=this.getViewPortPxFromLonLat(lonlat);this.layerContainerDiv.style.left=(originPx.x-newPx.x)+"px";this.layerContainerDiv.style.top=(originPx.y-newPx.y)+"px";},isValidZoomLevel:function(zoomLevel){return((zoomLevel!=null)&&(zoomLevel>=0)&&(zoomLevel<this.getNumZoomLevels()));},isValidLonLat:function(lonlat){var valid=false;if(lonlat!=null){var maxExtent=this.getMaxExtent();valid=maxExtent.containsLonLat(lonlat);}
return valid;},getProjection: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(){var maxExtent=null;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();}
return resolution;},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){var zoom=null;if(this.baseLayer!=null){zoom=this.baseLayer.getZoomForExtent(bounds);}
return zoom;},getZoomForResolution:function(resolution){var zoom=null;if(this.baseLayer!=null){zoom=this.baseLayer.getZoomForResolution(resolution);}
return zoom;},zoomTo:function(zoom){if(this.isValidZoomLevel(zoom)){this.setCenter(null,zoom);}},zoomIn:function(){this.zoomTo(this.getZoom()+1);},zoomOut:function(){this.zoomTo(this.getZoom()-1);},zoomToExtent:function(bounds){this.setCenter(bounds.getCenterLonLat(),this.getZoomForExtent(bounds));},zoomToMaxExtent:function(){this.zoomToExtent(this.getMaxExtent());},zoomToScale:function(scale){var res=OpenLayers.Util.getResolutionFromScale(scale,this.baseLayer.units);var size=this.getSize();var w_deg=size.w*res;var h_deg=size.h*res;var center=this.getCenter();var extent=new OpenLayers.Bounds(center.lon-w_deg/2,center.lat-h_deg/2,center.lon+w_deg/2,center.lat+h_deg/2);this.zoomToExtent(extent);},getLonLatFromViewPortPx:function(viewPortPx){var lonlat=null;if(this.baseLayer!=null){lonlat=this.baseLayer.getLonLatFromViewPortPx(viewPortPx);}
return lonlat;},getViewPortPxFromLonLat:function(lonlat){var px=null;if(this.baseLayer!=null){px=this.baseLayer.getViewPortPxFromLonLat(lonlat);}
return px;},getLonLatFromPixel:function(px){return this.getLonLatFromViewPortPx(px);},getPixelFromLonLat:function(lonlat){return this.getViewPortPxFromLonLat(lonlat);},getViewPortPxFromLayerPx:function(layerPx){var viewPortPx=null;if(layerPx!=null){var dX=parseInt(this.layerContainerDiv.style.left);var dY=parseInt(this.layerContainerDiv.style.top);viewPortPx=layerPx.add(dX,dY);}
return viewPortPx;},getLayerPxFromViewPortPx:function(viewPortPx){var layerPx=null;if(viewPortPx!=null){var dX=-parseInt(this.layerContainerDiv.style.left);var dY=-parseInt(this.layerContainerDiv.style.top);layerPx=viewPortPx.add(dX,dY);if(isNaN(layerPx.x)||isNaN(layerPx.y)){layerPx=null;}}
return layerPx;},getLonLatFromLayerPx:function(px){return this.getLonLatFromViewPortPx(px);},getLayerPxFromLonLat:function(lonlat){var px=this.getViewPortPxFromLonLat(lonlat);return this.getLayerPxFromViewPortPx(px);},CLASS_NAME:"OpenLayers.Map"};OpenLayers.Marker.Box=OpenLayers.Class.create();OpenLayers.Marker.Box.prototype=OpenLayers.Class.inherit(OpenLayers.Marker,{bounds:null,div:null,initialize:function(bounds,borderColor,borderWidth){this.bounds=bounds;this.div=OpenLayers.Util.createDiv();this.div.style.overflow='hidden';this.events=new OpenLayers.Events(this,this.div,null);this.setBorder(borderColor,borderWidth);},setBorder:function(color,width){if(!color)color="red";if(!width)width=2;this.div.style.border=width+"px solid "+color;},draw:function(px,sz){OpenLayers.Util.modifyDOMElement(this.div,null,px,sz);return this.div;},onScreen:function(){var onScreen=false;if(this.map){var screenBounds=this.map.getExtent();onScreen=screenBounds.containsBounds(this.bounds,true,true);}
return onScreen;},display:function(display){this.div.style.display=(display)?"":"none";},CLASS_NAME:"OpenLayers.Marker.Box"});OpenLayers.Parser.GML=OpenLayers.Class.create();OpenLayers.Parser.GML.prototype=OpenLayers.Class.inherit(OpenLayers.Parser,{featureCollection:[],initialize:function(){},load:function(xmlNode){var newArguments=arguments;this.featureCollection=[];var featureNodes=OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,"http://www.opengis.net/gml","gml","featureMember");var dim;var coordNodes=OpenLayers.Ajax.getElementsByTagNameNS(featureNodes[0],"http://www.opengis.net/gml","gml","posList");if(coordNodes.length==0)coordNodes=OpenLayers.Ajax.getElementsByTagNameNS(featureNodes[0],"http://www.opengis.net/gml","gml","pos");if(coordNodes.length>0){dim=coordNodes[0].getAttribute("srsDimension");}
this.dim=(dim=="3"||dim==3)?3:2;for(var i=0;i<featureNodes.length;i++){var feature=this.processXMLNode(featureNodes[i]);if(feature){this.featureCollection.push(feature);attributes=new OpenLayers.Attributes.GML(featureNodes[i]);feature.setAttributes(attributes);}}},destroy:function(){this.featureCollection=[];OpenLayers.Parser.prototype.destroy.apply(this,arguments);},processXMLNode:function(xmlNode){var geom;var p;var feature=new OpenLayers.Feature();feature.toState(OpenLayers.State.UNKNOWN);if(OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,"http://www.opengis.net/gml","gml","MultiPolygon").length!=0){var multipolygon=OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,"http://www.opengis.net/gml","gml","MultiPolygon")[0];geom=new OpenLayers.Geometry.MultiPolygon();var polygons=OpenLayers.Ajax.getElementsByTagNameNS(multipolygon,"http://www.opengis.net/gml","gml","Polygon");for(var i=0;i<polygons.length;i++){polygon=this.parsePolygonNode(polygons[i],geom);geom.addComponents(polygon);geom.extendBounds(polygon.getBounds());}}
else if(OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,"http://www.opengis.net/gml","gml","MultiLineString").length!=0){var multilinestring=OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,"http://www.opengis.net/gml","gml","MultiLineString")[0];geom=new OpenLayers.Geometry.MultiLineString();var lineStrings=OpenLayers.Ajax.getElementsByTagNameNS(multilinestring,"http://www.opengis.net/gml","gml","LineString");for(var i=0;i<lineStrings.length;i++){p=this.parseCoords(lineStrings[i]);if(p.points){var lineString=new OpenLayers.Geometry.LineString(p.points);geom.addComponents(lineString);geom.extendBounds(p.bounds);}}}
else if(OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,"http://www.opengis.net/gml","gml","MultiPoint").length!=0){var multiPoint=OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,"http://www.opengis.net/gml","gml","MultiPoint")[0];geom=new OpenLayers.Geometry.MultiPoint();var points=OpenLayers.Ajax.getElementsByTagNameNS(multiPoint,"http://www.opengis.net/gml","gml","Point");for(var i=0;i<points.length;i++){p=this.parseCoords(points[i]);geom.addComponents(p.points[0]);geom.extendBounds(p.bounds);}}
else if(OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,"http://www.opengis.net/gml","gml","Polygon").length!=0){var polygon=OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,"http://www.opengis.net/gml","gml","Polygon")[0];geom=this.parsePolygonNode(polygon);}
else if(OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,"http://www.opengis.net/gml","gml","LineString").length!=0){var lineString=OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,"http://www.opengis.net/gml","gml","LineString")[0];p=this.parseCoords(lineString);if(p.points){geom=new OpenLayers.Geometry.LineString(p.points);geom.extendBounds(p.bounds);}}
else if(OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,"http://www.opengis.net/gml","gml","Point").length!=0){var point=OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,"http://www.opengis.net/gml","gml","Point")[0];p=this.parseCoords(point);if(p.points){geom=p.points[0];geom.extendBounds(p.bounds);}}
feature.setGeometry(geom);return feature;},parsePolygonNode:function(polygonNode){var linearRings=OpenLayers.Ajax.getElementsByTagNameNS(polygonNode,"http://www.opengis.net/gml","gml","LinearRing");var rings=[];var p;var polyBounds;for(var i=0;i<linearRings.length;i++){p=this.parseCoords(linearRings[i]);ring1=new OpenLayers.Geometry.LinearRing(p.points);ring1.extendBounds(p.bounds);if(polyBounds){polyBounds.extendBounds(p.bounds);}else{polyBounds=p.bounds;}
rings.push(ring1);}
var poly=new OpenLayers.Geometry.Polygon(rings);poly.extendBounds(polyBounds);return poly;},parseCoords:function(xmlNode){var x,y,left,bottom,right,top,bounds;var p=new Array();if(xmlNode){p.points=new Array();var coordNodes=OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,"http://www.opengis.net/gml","gml","posList");if(coordNodes.length==0)coordNodes=OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,"http://www.opengis.net/gml","gml","pos");if(coordNodes.length==0)coordNodes=OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,"http://www.opengis.net/gml","gml","coordinates");var coordString=OpenLayers.Util.getXmlNodeValue(coordNodes[0]);var re=RegExp('[, \n\t]+','g');var nums=(coordString)?coordString.split(re):new Array();while(nums[0]=="")nums.shift();while(nums[nums.length-1]=="")nums.pop();for(i=0;i<nums.length;i=i+this.dim){x=parseFloat(nums[i]);y=parseFloat(nums[i+1]);p.points.push(new OpenLayers.Geometry.Point(x,y));if(!p.bounds){p.bounds=new OpenLayers.Bounds(x,y,x,y);}else{p.bounds.extendBounds(x,y);}}}
return p;},CLASS_NAME:"OpenLayers.Parser.GML"});OpenLayers.Popup.Anchored=OpenLayers.Class.create();OpenLayers.Popup.Anchored.prototype=OpenLayers.Class.inherit(OpenLayers.Popup,{relativePosition:null,anchor:null,initialize:function(id,lonlat,size,contentHTML,anchor,closeBox){var newArguments=new Array(id,lonlat,size,contentHTML,closeBox);OpenLayers.Popup.prototype.initialize.apply(this,newArguments);this.anchor=(anchor!=null)?anchor:{size:new OpenLayers.Size(0,0),offset:new OpenLayers.Pixel(0,0)};},draw:function(px){if(px==null){if((this.lonlat!=null)&&(this.map!=null)){px=this.map.getLayerPxFromLonLat(this.lonlat);}}
this.relativePosition=this.calculateRelativePosition(px);return OpenLayers.Popup.prototype.draw.apply(this,arguments);},calculateRelativePosition:function(px){var lonlat=this.map.getLonLatFromLayerPx(px);var extent=this.map.getExtent();var quadrant=extent.determineQuadrant(lonlat);return OpenLayers.Bounds.oppositeQuadrant(quadrant);},moveTo:function(px){var newPx=this.calculateNewPx(px);var newArguments=new Array(newPx);OpenLayers.Popup.prototype.moveTo.apply(this,newArguments);},setSize:function(size){OpenLayers.Popup.prototype.setSize.apply(this,arguments);if((this.lonlat)&&(this.map)){var px=this.map.getLayerPxFromLonLat(this.lonlat);this.moveTo(px);}},calculateNewPx:function(px){var newPx=px.offset(this.anchor.offset);var top=(this.relativePosition.charAt(0)=='t');newPx.y+=(top)?-this.size.h:this.anchor.size.h;var left=(this.relativePosition.charAt(1)=='l');newPx.x+=(left)?-this.size.w:this.anchor.size.w;return newPx;},CLASS_NAME:"OpenLayers.Popup.Anchored"});OpenLayers.Renderer.Svg=OpenLayers.Class.create();OpenLayers.Renderer.Svg.prototype=OpenLayers.Class.inherit(OpenLayers.Renderer,{svgns:"http://www.w3.org/2000/svg",initialize:function(){},createRoot:function(element){if(!this.root){this.container=$(element);this.root=this._nodeFactory("g",this.container.id+"_root");this.root.setAttributeNS(null,"transform","scale(1, -1)");this.svgRoot=this._nodeFactory("svg",this.container.id+"_svgRoot");this.svgRoot.appendChild(this.root);this.container.appendChild(this.svgRoot);}
return this.root;},deleteRoot:function(element){this.container.removeChild(this.svgRoot);},clearRoot:function(){while(this.root.childNodes.length>0){this.root.removeChild(this.root.firstChild);}},setExtent:function(x,y,width,height){this.svgRoot.setAttributeNS(null,"viewBox",x+" "+-y+" "+width+" "+height);},setSize:function(width,height){this.svgRoot.setAttributeNS(null,"width",width);this.svgRoot.setAttributeNS(null,"height",height);},getGeometryFromEvent:function(evt){var geometry=false;var node=evt.target||evt.srcElement;geometry=node.geometry;return geometry;},drawGeometry:function(geometry,style){OpenLayers.Renderer.prototype.drawGeometry.apply(this,arguments);},eraseGeometry:function(geometry,style){element=$(geometry.id);if(element&&element.parentNode){element.parentNode.removeChild(element);}
return geometry;},drawPoint:function(geometry,style){var node=this._nodeFactory("circle",geometry.id);node.geometry=geometry;node.setAttributeNS(null,"cx",geometry.x);node.setAttributeNS(null,"cy",geometry.y);node.setAttributeNS(null,"r",((style.pointRadius)+style.pointUnit));this._setStyle(node,style,true,true);this.root.appendChild(node);return node;},drawLineString:function(geometry,style){var node=this._nodeFactory("polyline",geometry.id);this._setStyle(node,style,false,true);node.geometry=geometry;node.setAttributeNS(null,"points",geometry.path);this.root.appendChild(node);},drawLinearRing:function(geometry,style){var node=this._nodeFactory("polygon",geometry.id);node.geometry=geometry;node.setAttributeNS(null,"points",geometry.path);this._setStyle(node,style,true,true);this.root.appendChild(node);},drawPolygon:function(geometry,style){var node=this._nodeFactory("path",geometry.id);node.geometry=geometry;var d='';for(var j=0;j<geometry.components.length;j++){var linearRing=geometry.components[j];d+=" M";for(var i=0;i<linearRing.path.length;i++){d+=" "+linearRing.path[i];}}
node.setAttributeNS(null,"d",d);node.setAttributeNS(null,"fill-rule","evenodd");this._setStyle(node,style,true,true);this.root.appendChild(node);},drawRectangle:function(geometry,style){var node=this._nodeFactory("rect",geometry.id);node.geometry=geometry;node.setAttributeNS(null,"x",geometry.x);node.setAttributeNS(null,"y",geometry.y);node.setAttributeNS(null,"width",geometry.width);node.setAttributeNS(null,"height",geometry.height);this._setStyle(node,style,true,true);this.root.appendChild(node);},drawCircle:function(geometry,style){var node=this._nodeFactory("circle",geometry.id);node.geometry=geometry;node.setAttributeNS(null,"cx",geometry.cx);node.setAttributeNS(null,"cy",geometry.cy);node.setAttributeNS(null,"r",geometry.r);this._setStyle(node,style,true,true);this.root.appendChild(node);},drawCurve:function(geometry,style){var node=this._nodeFactory("path",geometry.id);node.geometry=geometry;var d=null;for(var i=0;i<geometry.path.length;i++){if((i%3)==0&&(i/3)==0){d="M "+geometry.path[i];}else if((i%3)==1){d=d+" C "+geometry.path[i];}else{d=d+" "+geometry.path[i];}}
node.setAttributeNS(null,"d",d);this._setStyle(node,style,false,true);this.root.appendChild(node);},drawSurface:function(geometry,style){var node=this._nodeFactory("path",geometry.id);node.geometry=geometry;var d=null;for(var i=0;i<geometry.path.length;i++){if((i%3)==0&&(i/3)==0){d="M "+geometry.path[i];}else if((i%3)==1){d=d+" C "+geometry.path[i];}else{d=d+" "+geometry.path[i];}}
d=d+" Z";node.setAttributeNS(null,"d",d);this._setStyle(node,geometry.style,true,true);this.root.appendChild(node);},_setStyle:function(node,style,isFilled,isStroked){if(isFilled){node.setAttributeNS(null,"fill",style.fillColor);node.setAttributeNS(null,"fill-opacity",style.fillOpacity);}else{node.setAttributeNS(null,"fill","none");}
if(isStroked){node.setAttributeNS(null,"stroke",style.strokeColor);node.setAttributeNS(null,"stroke-opacity",style.strokeOpacity);node.setAttributeNS(null,"stroke-width",style.strokeWidth+style.strokeUnit);}else{node.setAttributeNS(null,"stroke","none");}
if(style.pointerEvents){node.setAttributeNS(null,"pointer-events",style.pointerEvents);}
if(!parent){this.root.appendChild(node);}
return node;},_nodeFactory:function(type,id){if($(id)){var node=$(id);if(type!=node.nodeName){node.parentNode.removeChild(node);node=this._nodeFactory(type,id);}}else{var node=document.createElementNS(this.svgns,type);if(id){node.setAttributeNS(null,"id",id);}}
return node;},CLASS_NAME:"OpenLayers.Renderer.Svg"});OpenLayers.Renderer.Vml=OpenLayers.Class.create();OpenLayers.Renderer.Vml.prototype=OpenLayers.Class.inherit(OpenLayers.Renderer,{vmlns:"urn:schemas-microsoft-com:vml",initialize:function(){},createRoot:function(element){if(this.root==null){document.namespaces.add("v","urn:schemas-microsoft-com:vml");var style=document.createStyleSheet();style.addRule('v\\:*',"behavior: url(#default#VML);");this.container=$(element);this.vmlRoot=this._nodeFactory("div",this.container.id+"_vmlRoot");this.root=this._nodeFactory("v:group",this.container.id+"_root");this.vmlRoot.appendChild(this.root);this.container.appendChild(this.vmlRoot);}
return this.root;},deleteRoot:function(element){this.container.removeChild(this.vmlRoot);},clearRoot:function(){while(this.root.childNodes.length>0){this.root.removeChild(this.root.firstChild);}},setExtent:function(x,y,width,height){this.root.setAttribute("coordorigin",this._vmlParseFloat(x)+" "+this._vmlParseFloat(y));this.root.setAttribute("coordsize",this._vmlParseFloat(width)+" "+this._vmlParseFloat(-height));},setSize:function(width,height){this.vmlRoot.style.width=width;this.vmlRoot.style.height=height;this.root.style.width=width;this.root.style.height=height;},getGeometryFromEvent:function(evt){var geometry=false;var node=evt.target||evt.srcElement;geometry=node.geometry;return geometry;},drawGeometry:function(geometry,style){OpenLayers.Renderer.prototype.drawGeometry.apply(this,arguments);},eraseGeometry:function(geometry,style){element=$(geometry.id);if(element&&element.parentNode){element.parentNode.removeChild(element);}
return geometry;},drawPoint:function(geometry,style){var node=this._nodeFactory("v:shape",geometry.id);var path=this._nodeFactory("v:path",geometry.id+"_path");node.setAttribute("coordsize","100 100");path.setAttribute("v","m 0,-50 at-50,-50,50,50,0,-50,0,-50 x e");node.appendChild(path);if(style.pointerEvents=="visiblePainted"){node.geometry=geometry;}
node.style.left=this._vmlParseFloat(geometry.x);node.style.top=this._vmlParseFloat(geometry.y);node.style.width=((style.pointRadius*1.5)+style.pointUnit);node.style.height=((style.pointRadius*1.5)+style.pointUnit);this._setStyle(node,style,true,true);this.root.appendChild(node);return node;},drawLineString:function(geometry,style){var bbox=this._getVmlBoundingBox(geometry.path);var node=this._nodeFactory("v:shape",geometry.id);if(style.pointerEvents=="visiblePainted"){node.geometry=geometry;}
node.style.left=this._vmlParseFloat(bbox.x);node.style.top=this._vmlParseFloat(bbox.y);node.style.width=this._vmlParseFloat(bbox.width);node.style.height=this._vmlParseFloat(bbox.height);node.coordorigin="0 0";node.coordsize=this._vmlParseFloat(bbox.width)+" "+this._vmlParseFloat(bbox.height);var path="";for(var i=0;i<geometry.path.length;i++){if(i==0){path+="m "+this._vmlParseFloat(geometry.path[i].getX()-bbox.x)+","+this._vmlParseFloat(geometry.path[i].getY()-bbox.y)+" l";}else{path+=" "+this._vmlParseFloat(geometry.path[i].getX()-bbox.x)+","+this._vmlParseFloat(geometry.path[i].getY()-bbox.y)+" l ";}}
path+=" e";node.path=path;this._setStyle(node,style,false,true);this.root.appendChild(node);return node;},drawLinearRing:function(geometry,style){var bbox=this._getVmlBoundingBox(geometry.path);var node=this._nodeFactory("v:shape",geometry.id);if(style.pointerEvents=="visiblePainted"){node.geometry=geometry;}
node.style.left=this._vmlParseFloat(bbox.x);node.style.top=this._vmlParseFloat(bbox.y);node.style.width=this._vmlParseFloat(bbox.width);node.style.height=this._vmlParseFloat(bbox.height);node.coordorigin="0 0";node.coordsize=this._vmlParseFloat(bbox.width)+" "+this._vmlParseFloat(bbox.height);var path="";for(var i=0;i<geometry.path.length;i++){if(i==0){path+="m "+this._vmlParseFloat(geometry.path[i].getX()-bbox.x)+","+this._vmlParseFloat(geometry.path[i].getY()-bbox.y)+" l";}else{path+=" "+this._vmlParseFloat(geometry.path[i].getX()-bbox.x)+","+this._vmlParseFloat(geometry.path[i].getY()-bbox.y)+" l ";}}
path+=" x e";node.path=path;this._setStyle(node,style,true,true);this.root.appendChild(node);return node;},drawPolygon:function(geometry,style){var bbox=this._getVmlBoundingBox(geometry.components[0].path);var node=this._nodeFactory("v:shape",geometry.id);if(style.pointerEvents=="visiblePainted"){node.geometry=geometry;}
node.style.left=this._vmlParseFloat(bbox.x);node.style.top=this._vmlParseFloat(bbox.y);node.style.width=this._vmlParseFloat(bbox.width);node.style.height=this._vmlParseFloat(bbox.height);node.coordorigin="0 0";node.coordsize=this._vmlParseFloat(bbox.width)+" "+this._vmlParseFloat(bbox.height);var path="";for(var j=0;j<geometry.components.length;j++){var linearRing=geometry.components[j];if(j!=0){path+=" x ";}
for(var i=0;i<linearRing.path.length;i++){if(i==0){path+="m "+this._vmlParseFloat(linearRing.path[i].getX()-bbox.x)+","+this._vmlParseFloat(linearRing.path[i].getY()-bbox.y)+" l";}else{path+=" "+this._vmlParseFloat(linearRing.path[i].getX()-bbox.x)+","+this._vmlParseFloat(linearRing.path[i].getY()-bbox.y);}}}
path+=" x e";node.path=path;this._setStyle(node,style,true,true);this.root.appendChild(node);return node;},drawRectangle:function(geometry,style){var node=this._nodeFactory("v:rect",geometry.id);if(style.pointerEvents=="visiblePainted"){node.geometry=geometry;}
node.style.left=this._vmlParseFloat(geometry.x);node.style.top=this._vmlParseFloat(geometry.y);node.style.width=this._vmlParseFloat(geometry.width);node.style.height=this._vmlParseFloat(geometry.height);this._setStyle(node,style,true,true);this.root.appendChild(node);return node;},drawCircle:function(geometry,style){var node=this._nodeFactory("v:oval",geometry.id);if(style.pointerEvents=="visiblePainted"){node.geometry=geometry;}
node.style.left=this._vmlParseFloat(geometry.cx-geometry.rx);node.style.top=this._vmlParseFloat(geometry.cy-geometry.ry);node.style.width=this._vmlParseFloat(geometry.rx*2);node.style.height=this._vmlParseFloat(geometry.ry*2);node.appendChild(this._getFillElement());node.appendChild(this._getStrokeElement());if(!parent)
this.root.appendChild(node);return node;},drawEllipse:function(geometry,style){var node=this._nodeFactory("v:oval",geometry.id);if(style.pointerEvents=="visiblePainted"){node.geometry=geometry;}
node.style.left=this._vmlParseFloat(geometry.cx-geometry.rx);node.style.top=this._vmlParseFloat(geometry.cy-geometry.ry);node.style.width=this._vmlParseFloat(geometry.rx*2);node.style.height=this._vmlParseFloat(geometry.ry*2);node.appendChild(this._getFillElement());node.appendChild(this._getStrokeElement());if(!parent)
this.root.appendChild(node);return node;},drawCurve:function(geometry,style){var bbox=this._getVmlBoundingBox(geometry.path);var node=this._nodeFactory("v:shape",geometry.id);if(style.pointerEvents=="visiblePainted"){node.geometry=geometry;}
node.style.left=this._vmlParseFloat(bbox.x);node.style.top=this._vmlParseFloat(bbox.y);node.style.width=this._vmlParseFloat(bbox.width);node.style.height=this._vmlParseFloat(bbox.height);node.coordorigin="0 0";node.coordsize=this._vmlParseFloat(bbox.width)+" "+this._vmlParseFloat(bbox.height);var path="";for(var i=0;i<geometry.path.length;i++){if((i%3)==0&&(i/3)==0){path+="m "+this._vmlParseFloat(geometry.path[i].getX()-bbox.x)+","+this._vmlParseFloat(geometry.path[i].getY()-bbox.y);}else if((i%3)==1){path+=" c "+this._vmlParseFloat(geometry.path[i].getX()-bbox.x)+","+this._vmlParseFloat(geometry.path[i].getY()-bbox.y);}else{path+=" "+this._vmlParseFloat(geometry.path[i].getX()-bbox.x)+","+this._vmlParseFloat(geometry.path[i].getY()-bbox.y);}}
path+=" x e";node.path=path;this._setStyle(node,style,false,true);this.root.appendChild(node);return node;},drawSurface:function(geometry,style){var bbox=this._getVmlBoundingBox(geometry.paht);var node=this._nodeFactory("v:shape",geometry.id);node.style.left=this._vmlParseFloat(bbox.x);node.style.top=this._vmlParseFloat(bbox.y);node.style.width=this._vmlParseFloat(bbox.width);node.style.height=this._vmlParseFloat(bbox.height);node.coordorigin="0 0";node.coordsize=this._vmlParseFloat(bbox.width)+" "+this._vmlParseFloat(bbox.height);var path="";for(var i=0;i<geometry.path.length;i++){if((i%3)==0&&(i/3)==0){path+="m "+this._vmlParseFloat(geometry.path[i].getX()-bbox.x)+","+this._vmlParseFloat(geometry.path[i].getY()-bbox.y);}else if((i%3)==1){path+=" c "+this._vmlParseFloat(geometry.path[i].getX()-bbox.x)+","+this._vmlParseFloat(geometry.path[i].getY()-bbox.y);}else{path+=" "+this._vmlParseFloat(geometry.path[i].getX()-bbox.x)+","+this._vmlParseFloat(geometry.path[i].getY()-bbox.y);}}
path+=" x e";node.path=path;this._setStyle(node,style,true,true)
this.root.appendChild(node);return node;},_setStyle:function(node,style,isFilled,isStroked){var fill=this._nodeFactory('v:fill');fill.setAttribute("on",isFilled);fill.setAttribute("color",style.fillColor);fill.setAttribute("opacity",style.fillOpacity);node.appendChild(fill);var stroke=this._nodeFactory('v:stroke');stroke.setAttribute("on",isStroked);stroke.setAttribute("color",style.strokeColor);stroke.setAttribute("weight",style.strokeWidth);stroke.setAttribute("opacity",style.strokeOpacity);node.appendChild(stroke);},_getVmlBoundingBox:function(points){var rectangle=null;if(points){var xMin=points[0].getX();var yMin=points[0].getY();var xMax=points[0].getX();var yMax=points[0].getY();for(var i=0;i<points.length;i++){xMin=(points[i].getX()<xMin)?points[i].getX():xMin;yMin=(points[i].getY()<yMin)?points[i].getY():yMin;xMax=(points[i].getX()>xMax)?points[i].getX():xMax;yMax=(points[i].getY()>yMax)?points[i].getY():yMax;}
rectangle={x:xMin,y:yMin,width:xMax-xMin,height:yMax-yMin};}
return rectangle;},_nodeFactory:function(type,id){if($(id)){var node=$(id);if(type!=node.nodeName){node.parentNode.removeChild(node);node=this._nodeFactory(type,id);}}else{var node=document.createElement(type);if(id){node.setAttribute('id',id);}}
return node;},_vmlParseFloat:function(floatValue){return Math.round(1000*floatValue);},CLASS_NAME:"OpenLayers.Renderer.Vml"});OpenLayers.Style.WebSafe=OpenLayers.Class.create();OpenLayers.Style.WebSafe.prototype=OpenLayers.Class.inherit(OpenLayers.Style,{initialize:function(name){var newArguments=new Array(name);OpenLayers.Style.prototype.initialize.apply(this,newArguments);this.color=this.getWebSafeColor(arguments[0]);this.fillColor=this.color;this.hoverFillColor=this.color;this.strokeColor=this.color;},getWebSafeColor:function(colorNumber){colors=new Array("00","33","66","99","CC","FF");colorNumber=(colorNumber)?colorNumber:0;colorNumber=(colorNumber<0)?0:colorNumber;colorNumber=(colorNumber>215)?215:colorNumber;i=parseInt(colorNumber/36);j=parseInt((colorNumber-i*36)/6);k=parseInt((colorNumber-i*36-j*6));var color="#"+colors[i]+colors[j]+colors[k];return color;},CLASS_NAME:"OpenLayers.Style.WebSafe"});OpenLayers.Tile.Image=OpenLayers.Class.create();OpenLayers.Tile.Image.prototype=OpenLayers.Class.inherit(OpenLayers.Tile,{imgDiv:null,initialize:function(layer,position,bounds,url,size){OpenLayers.Tile.prototype.initialize.apply(this,arguments);},destroy:function(){if((this.imgDiv!=null)&&(this.imgDiv.parentNode==this.layer.div)){this.layer.div.removeChild(this.imgDiv);}
this.imgDiv=null;OpenLayers.Tile.prototype.destroy.apply(this,arguments);},draw:function(){OpenLayers.Tile.prototype.draw.apply(this,arguments);if(this.imgDiv==null){this.initImgDiv();}
if(this.layer!=this.layer.map.baseLayer&&this.layer.reproject){this.bounds=this.getBoundsFromBaseLayer(this.position);}
this.url=this.layer.getURL(this.bounds);this.imgDiv.style.display="none";if(this.layer.displayOutsideMaxExtent||(this.layer.maxExtent&&(this.bounds.intersectsBounds(this.layer.maxExtent,false)))){if(this.layer.alpha){OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv,null,this.position,this.size,this.url);}else{this.imgDiv.src=this.url;OpenLayers.Util.modifyDOMElement(this.imgDiv,null,this.position,this.size);}}},clear:function(){OpenLayers.Tile.prototype.clear.apply(this,arguments);if(this.imgDiv){this.imgDiv.style.display="none";}},moveTo:function(bounds,position,redraw){if(this.layer!=this.layer.map.baseLayer&&this.layer.reproject){bounds=this.getBoundsFromBaseLayer(position);}
this.url=this.layer.getURL(bounds);OpenLayers.Tile.prototype.moveTo.apply(this,arguments);},initImgDiv:function(){if(this.layer.alpha){this.imgDiv=OpenLayers.Util.createAlphaImageDiv(null,this.position,this.size,null,"absolute",null,null,null,true);}else{this.imgDiv=OpenLayers.Util.createImage(null,this.position,this.size,null,"absolute",null,null,true);}
this.imgDiv.className='olTileImage';OpenLayers.Event.observe(this.imgDiv,"load",this.checkImgURL.bindAsEventListener(this));this.layer.div.appendChild(this.imgDiv);if(this.layer.opacity!=null){OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,null,null,null,null,this.layer.opacity);}},checkImgURL:function(){var loaded=this.layer.alpha?this.imgDiv.firstChild.src:this.imgDiv.src;if(loaded!=this.url){this.imgDiv.style.display="none";}},CLASS_NAME:"OpenLayers.Tile.Image"});OpenLayers.Tile.WFS=OpenLayers.Class.create();OpenLayers.Tile.WFS.prototype=OpenLayers.Class.inherit(OpenLayers.Tile,{features:null,urls:null,initialize:function(layer,position,bounds,url,size){var newArguments=arguments;newArguments=[layer,position,bounds,null,size];OpenLayers.Tile.prototype.initialize.apply(this,newArguments);this.url=url;this.features=new Array();},destroy:function(){OpenLayers.Tile.prototype.destroy.apply(this,arguments);this.destroyAllFeatures();this.features=null;this.url=null;},clear:function(){OpenLayers.Tile.prototype.clear.apply(this,arguments);this.destroyAllFeatures();},draw:function(){if(this.layer.displayOutsideMaxExtent||(this.layer.maxExtent&&this.layer.maxExtent.intersectsBounds(this.bounds,false))){this.loadFeaturesForRegion(this.requestSuccess);}},loadFeaturesForRegion:function(success,failure){OpenLayers.loadURL(this.url,null,this,success);},requestSuccess:function(request){var doc=request.responseXML;if(!doc||request.fileType!="XML"){doc=OpenLayers.parseXMLString(request.responseText);}
var gml=new OpenLayers.Parser.GML();gml.load(doc);var featureCollection=gml.featureCollection;this.layer.addFeatures(featureCollection);},addResults:function(results){for(var i=0;i<results.length;i++){var feature=new this.layer.featureClass(this.layer,results[i]);this.features.push(feature);}},destroyAllFeatures:function(){while(this.features.length>0){var feature=this.features.shift();feature.destroy();}},CLASS_NAME:"OpenLayers.Tile.WFS"});OpenLayers.Writer.WFS=OpenLayers.Class.create();OpenLayers.Writer.WFS.prototype=OpenLayers.Class.inherit(OpenLayers.Writer,{initialize:function(features){},destroy:function(){},commit:function(uri,features,onSuccess,onFailure){var transaction=document.createElementNS('http://www.opengis.net/wfs','wfs:Transaction');for(var i=0;i<features.length;i++){switch(features[i].state){case OpenLayers.State.INSERT:transaction.appendChild(this._insert(features[i]));break;case OpenLayers.State.UPDATE:transaction.appendChild(this._update(features[i]));break;case OpenLayers.State.DELETE:transaction.appendChild(this._delete(features[i]));break;}}
if(transaction.childNodes.length==0){alert("nothing to commit");return;}
transaction=OpenLayers.serializeXMLNode(transaction);new OpenLayers.Ajax.Request("/geoserver/wfs/transaction",{method:'post',parameters:transaction,onComplete:onSuccess,onFailure:onFailure});},_insert:function(feature){var insertNode=document.createElementNS('http://www.opengis.net/wfs','wfs:Insert');var element=document.createElementNS('http://www.opengis.net/wfs',feature.layer.params.typename);var geometry=document.createElementNS('http://www.opengis.net/wfs',feature.layer.params.geometry_column);var gml=new OpenLayers.Writer.GML();gml.buildXmlNode(feature.geometry);geometry.appendChild(gml.gml);element.appendChild(geometry);insertNode.appendChild(element);return insertNode;},_update:function(feature){var updateNode=document.createElementNS('http://www.opengis.net/wfs','wfs:Update');updateNode.setAttribute("typeName",feature.attributes.featureMember.childNodes[0].nodeName);var propertyNode=document.createElementNS('http://www.opengis.net/wfs','wfs:Property');var nameNode=document.createElementNS('http://www.opengis.net/wfs','wfs:Name');var txtNode=document.createTextNode(feature.layer.params.geometry_column);nameNode.appendChild(txtNode);propertyNode.appendChild(nameNode);var valueNode=document.createElementNS('http://www.opengis.net/wfs','wfs:Value');var gml=new OpenLayers.Writer.GML();gml.buildXmlNode(feature.geometry);valueNode.appendChild(gml.gml);propertyNode.appendChild(valueNode);updateNode.appendChild(propertyNode);var filterNode=document.createElementNS('http://www.opengis.net/ogc','ogc:Filter');var filterIdNode=document.createElementNS('http://www.opengis.net/ogc','ogc:FeatureId');filterIdNode.setAttribute("fid",feature.attributes.featureMember.childNodes[0].attributes['fid'].nodeValue);filterNode.appendChild(filterIdNode);updateNode.appendChild(filterNode);return updateNode;},_delete:function(feature){var deleteNode=document.createElementNS('http://www.opengis.net/wfs','wfs:Delete');deleteNode.setAttribute("typeName",feature.attributes.featureMember.childNodes[0].nodeName);var filterNode=document.createElementNS('http://www.opengis.net/ogc','ogc:Filter');var filterIdNode=document.createElementNS('http://www.opengis.net/ogc','ogc:FeatureId');filterIdNode.setAttribute("fid",feature.attributes.featureMember.childNodes[0].attributes['fid'].nodeValue);filterNode.appendChild(filterIdNode);deleteNode.appendChild(filterNode);return deleteNode;},CLASS_NAME:"OpenLayers.Writer.WFS"});OpenLayers.Attributes.GML=OpenLayers.Class.create();OpenLayers.Attributes.GML.prototype=OpenLayers.Class.inherit(OpenLayers.Attributes,{initialize:function(featureMember){this.featureMember=featureMember;},destroy:function(){this.featureMember=null;OpenLayers.Attributes.prototype.destroy.apply(this);},getAttributes:function(){if(!this.attributes){if(this.featureMember){this.getLeafNodes(this.featureMember);}else{this.attributes=new Array();}}
return OpenLayers.Attributes.prototype.getAttributes.apply(this);},getLeafNodes:function(parentNode){var nodes=parentNode.childNodes;for(var i=0;i<nodes.length;i++){var value=OpenLayers.Util.getXmlNodeValue(nodes[i]);var name=nodes[i].nodeName;if((name.search(":pos")!=-1)||(name.search(":posList")!=-1)||(name.search(":coordinates")!=-1)){return;}
if((nodes[i].childNodes.length==1&&nodes[i].childNodes[0].nodeName=="#text")||(nodes[i].childNodes.length==0&&nodes[i].nodeName!="#text")){this.addAttributes([{label:name,value:value}]);}
this.getLeafNodes(nodes[i]);}},CLASS_NAME:"OpenLayers.Layer.GML"});OpenLayers.Control.EditingAttributes=OpenLayers.Class.create();OpenLayers.Control.EditingAttributes.prototype=OpenLayers.Class.inherit(OpenLayers.Control.EditingTool,{activeColor:"darkblue",image:"dialog-information.gif",size:new OpenLayers.Size(22,22),initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.position=new OpenLayers.Pixel(100,200);},turnOn:function(){this.setLayer();this.defaultMouseDown=this.defaultMouseDown.bindAsEventListener(this);this.map.events.register("mousedown",this,this.defaultMouseDown);},turnOff:function(){this.map.events.unregister("mousedown",this,this.defaultMouseDown);},setContent:function(attributes){this.div.innerHTML="";this.div.style.position="absolute";this.div.style.top="30px";this.div.style.right="0px";this.div.style.left="";this.div.style.fontFamily="sans-serif";this.div.style.fontWeight="bold";this.div.style.marginTop="3px";this.div.style.marginLeft="3px";this.div.style.marginBottom="3px";this.div.style.fontSize="smaller";this.div.style.color="white";this.div.style.backgroundColor="transparent";this.innerDiv=document.createElement("div");this.innerDiv.innerHTML="<b>Attribute List</b><br/>"
this.innerDiv.id="layersDiv";this.innerDiv.style.paddingTop="2px";this.innerDiv.style.paddingLeft="2px";this.innerDiv.style.paddingBottom="2px";this.innerDiv.style.paddingRight="2px";this.innerDiv.style.backgroundColor=this.activeColor;this.innerDiv.style.height="450";this.innerDiv.style.overflow="auto";this.div.appendChild(this.innerDiv);Rico.Corner.round(this.div,{corners:"tl bl",bgColor:"transparent",color:this.activeColor,blend:false});Rico.Corner.changeOpacity(this.innerDiv,0.75);attribs=attributes.getAttributes();for(var i=0;i<attribs.length;i++){var attributeDiv=document.createElement("div");var attributeValue=document.createElement("div");var attributeLabel=document.createElement("label");attributeLabel.setAttribute("for",attribs[i].label);attributeLabel.appendChild(document.createTextNode(attribs[i].label));var attributeValue=document.createElement("input");attributeValue.setAttribute("type","text");attributeValue.setAttribute("id",attribs[i].label);attributeValue.setAttribute("value",attribs[i].value);attributeDiv.appendChild(attributeLabel);attributeDiv.appendChild(attributeValue);this.innerDiv.appendChild(attributeDiv);}
var imgLocation=OpenLayers.Util.getImagesLocation();var img=imgLocation+'layer-switcher-minimize.png';var sz=new OpenLayers.Size(18,18);this.minimizeDiv=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_MinimizeDiv",null,sz,img,"absolute");this.minimizeDiv.style.top="5px";this.minimizeDiv.style.right="0px";this.minimizeDiv.style.left="";this.minimizeDiv.style.display="";OpenLayers.Event.observe(this.minimizeDiv,"click",this.minimizeControl.bindAsEventListener(this));this.div.appendChild(this.minimizeDiv);OpenLayers.Event.observe(this.div,"mouseup",this.ignoreEvent);OpenLayers.Event.observe(this.div,"mousedown",this.ignoreEvent);OpenLayers.Event.observe(this.div,"click",this.ignoreEvent);OpenLayers.Event.observe(this.div,"dblclick",this.ignoreEvent);OpenLayers.Event.observe(this.div,"mousemove",this.ignoreEvent);},defaultMouseDown:function(evt){if(this.lastDown&&this.lastDown.x==evt.xy.x&&this.lastDown.y==evt.xy.y){return;}
this.lastDown=evt.xy;OpenLayers.Control.EditingTool.prototype.defaultMouseDown.apply(this,arguments);if(evt.targetGeometry&&evt.targetGeometry.feature&&evt.targetGeometry.feature.attributes){this.setContent(evt.targetGeometry.feature.attributes);}},setEventContext:function(evt){var lonlat=this.map.getLonLatFromLayerPx(evt.xy);evt.point=new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat);var size=this.map.getSize();var extent=this.map.getExtent();var tolerance=2;var toleranceLon=(extent.right-extent.left)*tolerance/size.w;var toleranceLat=(extent.top-extent.bottom)*tolerance/size.h;var toleranceLon1,toleranceLat1;if(this.map.layers.length>0){evt.targetGeometry=this.map.layers[this.map.layers.length-1].renderer.getGeometryFromEvent(evt);}
for(var i=this.map.layers.length-1;(!evt.targetGeometry&&(i>=0));i--){if(this.map.layers[i].getVisibility()&&this.map.layers[i].isVector){toleranceLon1=toleranceLon;toleranceLat1=toleranceLat;for(var f=0;!evt.targetGeometry&&(f<this.map.layers[i].features.length);f++){if(this.map.layers[i].features[f].atPoint(lonlat,toleranceLon1,toleranceLat1)){evt.targetGeometry=this.map.layers[i].features[f].geometry;}}}}
if(this.editingModes){for(var i=0;i<this.editingModes.length;i++){var snappingCoordinates=this.editingModes[i].calculatePoint(evt.point,evt.targetGeometry,this.geometry,this.layer);if(snappingCoordinates){evt.point=snappingCoordinates;break;}}}},minimizeControl:function(e){this.div.innerHTML="";},ignoreEvent:function(evt){OpenLayers.Event.stop(evt);},CLASS_NAME:"OpenLayers.Control.EditingAttributes"});OpenLayers.Control.EditingMode.ControlledEditing=OpenLayers.Class.create();OpenLayers.Control.EditingMode.ControlledEditing.prototype=OpenLayers.Class.inherit(OpenLayers.Control.EditingMode,{initialize:function(){},calculatePoint:function(mouseCoordinates,evtGeometry,currentGeometry,layer){var snappingPoint=false;if(this.geometry&&this.geometry.path.length>0){var lastPoint=this.geometry.path[this.geometry.path.length-1];var width=tmpPoint.x-lastPoint.x;var height=tmpPoint.y-lastPoint.y;var hyp=Math.sqrt(Math.pow(width,2)+Math.pow(height,2));var alpha=Math.acos(width/(hyp))*180.0/Math.PI;var step=22.5;for(var degree=0;degree<=180;degree+=step){if((alpha>(degree-step/2))&&(alpha<(degree+step/2))){var y=(height<0)?-Math.sin(degree/180*Math.PI)*hyp+lastPoint.y:Math.sin(degree/180*Math.PI)*hyp+lastPoint.y;var x=Math.cos(degree/180*Math.PI)*hyp+lastPoint.x;evt.point=new OpenLayers.Geometry.Point(x,y);}}}
return snappingPoint;},CLASS_NAME:"OpenLayers.Control.EditingMode.ControlledEditing"});OpenLayers.Control.EditingMode.PointArraySnapping=OpenLayers.Class.create();OpenLayers.Control.EditingMode.PointArraySnapping.prototype=OpenLayers.Class.inherit(OpenLayers.Control.EditingMode,{initialize:function(){},calculatePoint:function(evtGeometry,currentGeometry,mouseCoordinates,layer){var snappingPoint=false;var closestVertex=null;var distance=this.snappingTolerance*this.map.getResolution();for(var i=0;i<vector.features.length;i++){var feature=vector.features[i];if(!feature.extent||!feature.extent.containsLonLat(lonlat)){return;}
for(var j=0;j<feature.path.length;j++){var vertex=feature.path[j];var currentDistance=OpenLayers.Util.distance2Pts(vertex.lon,vertex.lat,lonlat.lon,lonlat.lat);if(currentDistance<distance){closestVertex=vertex;distance=currentDistance;}}}
if(closestVertex!=null){evt.point=new OpenLayers.Geometry.Point(closestVertex.lon,closestVertex.lat);}else{evt.point=new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat);}
return snappingPoint;},CLASS_NAME:"OpenLayers.Control.EditingMode.PointArraySnapping"});OpenLayers.Control.EditingMode.PointSnapping=OpenLayers.Class.create();OpenLayers.Control.EditingMode.PointSnapping.prototype=OpenLayers.Class.inherit(OpenLayers.Control.EditingMode,{initialize:function(){this.tolerance=10;this.style=OpenLayers.Style.DefaultRendererSnappingPointStyle;this.tmpPoint=new OpenLayers.Geometry.Point();this.tmpPoint.id="tmpPoint";},calculatePoint:function(mouseCoordinates,targetGeometry,currentGeometry,layer){var snappingPoint=false;if(targetGeometry&&targetGeometry.CLASS_NAME=="OpenLayers.Geometry.Point"&&targetGeometry.isSnappingElement){snappingPoint=targetGeometry;this.tmpPoint.x=snappingPoint.x;this.tmpPoint.y=snappingPoint.y;layer.renderer.drawGeometry(this.tmpPoint,this.style);}else if(targetGeometry&&targetGeometry.path){var distance=this.tolerance
for(var i=0;i<targetGeometry.path.length;i++){var pixel=layer.map.getPixelFromLonLat(targetGeometry.path[i]);var mousePixel=layer.map.getPixelFromLonLat(mouseCoordinates);var currentDistance=OpenLayers.Util.distance2Pts(pixel.x,pixel.y,mousePixel.x,mousePixel.y);if(currentDistance<distance){closestVertexIndex=i;distance=currentDistance;}}
var point=targetGeometry.path[closestVertexIndex];snappingPoint=point;snappingPoint.isSnappingElement=true;this.tmpPoint.x=snappingPoint.x;this.tmpPoint.y=snappingPoint.y;layer.renderer.drawGeometry(this.tmpPoint,this.style);}else if(targetGeometry&&targetGeometry.components){for(var i=0;i<targetGeometry.components.length;i++){snappingPoint=this.calculatePoint(mouseCoordinates,targetGeometry.components[i],currentGeometry,layer);}}else{layer.renderer.eraseGeometry(this.tmpPoint);}
return snappingPoint;},setTolerance:function(tolerance){this.tolerance=tolerance;},CLASS_NAME:"OpenLayers.Control.EditingMode.PointSnapping"});OpenLayers.Control.EditingMode.SegmentSnapping=OpenLayers.Class.create();OpenLayers.Control.EditingMode.SegmentSnapping.prototype=OpenLayers.Class.inherit(OpenLayers.Control.EditingMode,{initialize:function(){this.tmpPoint=new OpenLayers.Geometry.Point();this.tmpPoint.id="tmpPoint";this.tmpSegment=new OpenLayers.Geometry.LineSegment();this.tmpSegment.id="tmpSegment";this.tmpSegment.isSnappingSegment=true;this.pointStyle=OpenLayers.Style.DefaultRendererSnappingPointStyle;this.segmentStyle=OpenLayers.Style.DefaultRendererSnappingSegmentStyle},calculatePoint:function(mouseCoordinates,evtGeometry,currentGeometry,layer){var snappingPoint=false;var snappingSegment=null;if(evtGeometry&&evtGeometry.m1){var m1=evtGeometry.m1;var p1=evtGeometry.p1;var m2=-m1;var p2=mouseCoordinates.y-m2*mouseCoordinates.x;var x=(p2-p1)/(2*m1);var y=m1*x+p1;snappingPoint=new OpenLayers.Geometry.Point(x,y);snappingPoint.m1=m1;snappingPoint.p1=p1;}else if(evtGeometry&&evtGeometry.path){var delta=null;for(var i=0;i<evtGeometry.path.length-1;i++){var point1=evtGeometry.path[i];var point2=evtGeometry.path[i+1];var m1=(point2.y-point1.y)/(point2.x-point1.x);var p1=point1.y-m1*point1.x;var m2=-m1;var p2=mouseCoordinates.y-m2*mouseCoordinates.x;var x=(p2-p1)/(2*m1);var y=(m1*x+p1);var point=new OpenLayers.Geometry.Point(x,y);var tmpDelta=Math.sqrt(Math.pow((point.x-mouseCoordinates.x),2)+Math.pow((point.y-mouseCoordinates.y),2));if(!delta||(tmpDelta<delta&&(Math.min(point1.x,point2.x)<=point.x&&point.x<=Math.max(point1.x,point2.x)))){snappingPoint=point;delta=tmpDelta;snappingSegment=new OpenLayers.Geometry.LineSegment(point1,point2);snappingSegment.m1=snappingPoint.m1=m1;snappingSegment.p1=snappingPoint.p1=p1;}}}else{layer.renderer.eraseGeometry(this.tmpPoint);layer.renderer.eraseGeometry(this.tmpSegment);}
if(snappingPoint){this.tmpPoint.x=snappingPoint.x;this.tmpPoint.y=snappingPoint.y;layer.renderer.drawGeometry(this.tmpPoint,this.pointStyle);}
if(snappingSegment){this.tmpSegment.path=snappingSegment.path;layer.renderer.drawGeometry(this.tmpSegment,this.segmentStyle);}
return snappingPoint;},CLASS_NAME:"OpenLayers.Control.EditingMode.PointSnapping"});OpenLayers.Control.EditingTool.AddPathPoint=OpenLayers.Class.create();OpenLayers.Control.EditingTool.AddPathPoint.prototype=OpenLayers.Class.inherit(OpenLayers.Control.EditingTool,{image:"add-point.gif",size:new OpenLayers.Size(24,24),initialize:function(){OpenLayers.Control.EditingTool.prototype.initialize.apply(this,arguments);this.geometry=null;this.editingModes=[]},turnOn:function(){OpenLayers.Control.EditingTool.prototype.turnOn.apply(this,arguments);},turnOff:function(){OpenLayers.Control.EditingTool.prototype.turnOff.apply(this,arguments);},defaultMouseDown:function(evt){OpenLayers.Control.EditingTool.prototype.defaultMouseDown.apply(this,arguments);if(evt.targetGeometry&&evt.targetGeometry.path){var newPoint=false;var pathIndex=null;var delta=null;for(var i=0;i<evt.targetGeometry.path.length-1;i++){var point1=evt.targetGeometry.path[i];var point2=evt.targetGeometry.path[i+1];var m1=(point2.y-point1.y)/(point2.x-point1.x);var p1=point1.y-m1*point1.x;var m2=-m1;var p2=evt.point.y-m2*evt.point.x;var x=(p2-p1)/(2*m1);var y=(m1*x+p1);var point=new OpenLayers.Geometry.Point(x,y);var tmpDelta=Math.sqrt(Math.pow((point.x-evt.point.x),2)+Math.pow((point.y-evt.point.y),2));if(!delta||(tmpDelta<delta&&(Math.min(point1.x,point2.x)<=point.x&&point.x<=Math.max(point1.x,point2.x)))){newPoint=point;delta=tmpDelta;pathIndex=i;}}
if(newPoint){evt.targetGeometry.addPoint(newPoint,pathIndex+1);this.layer.renderer.drawGeometry(newPoint,"tmpPoint");this.layer.renderer.drawGeometry(evt.targetGeometry);}}},CLASS_NAME:"OpenLayers.Control.AddPathPoint"});OpenLayers.Control.EditingTool.Commit=OpenLayers.Class.create();OpenLayers.Control.EditingTool.Commit.prototype=OpenLayers.Class.inherit(OpenLayers.Control.EditingTool,{image:"media-floppy.png",size:new OpenLayers.Size(22,22),initialize:function(){OpenLayers.Control.EditingTool.prototype.initialize.apply(this,arguments);},turnOn:function(){OpenLayers.Control.EditingTool.prototype.turnOn.apply(this,arguments);this.layer.commit();},turnOff:function(){OpenLayers.Control.EditingTool.prototype.turnOff.apply(this,arguments);},finalizeGeometry:function(){},defaultMouseDown:function(evt){},defaultMouseMove:function(evt){},defaultMouseUp:function(evt){},defaultKeyDown:function(evt){},CLASS_NAME:"OpenLayers.Control.Commit"});OpenLayers.Control.EditingTool.DrawLineString=OpenLayers.Class.create();OpenLayers.Control.EditingTool.DrawLineString.prototype=OpenLayers.Class.inherit(OpenLayers.Control.EditingTool,{image:"stock_draw-polygon.gif",size:new OpenLayers.Size(24,24),initialize:function(){OpenLayers.Control.EditingTool.prototype.initialize.apply(this,arguments);},turnOn:function(){OpenLayers.Control.EditingTool.prototype.turnOn.apply(this,arguments);this.geometry=new OpenLayers.Geometry.LineString();this.tmpPoint=new OpenLayers.Geometry.Point();this.tmpSegment=new OpenLayers.Geometry.LineSegment();},turnOff:function(){OpenLayers.Control.EditingTool.prototype.turnOff.apply(this,arguments);this.eraseTmpElements();this.geometry=null;},finalizeGeometry:function(){var feature=new OpenLayers.Feature();feature.setGeometry(this.geometry);this.layer.addFeatures(feature);this.geometry=new OpenLayers.Geometry.LineString();},eraseTmpElements:function(){for(var i=0;i<this.geometry.path.length;i++){this.layer.renderer.eraseGeometry(this.geometry.path[i]);}
this.layer.renderer.eraseGeometry(this.tmpPoint);this.layer.renderer.eraseGeometry(this.tmpSegment);},defaultDblClick:function(evt){OpenLayers.Control.EditingTool.prototype.defaultDblClick.apply(this,arguments);this.defaultMouseDown(evt);this.eraseTmpElements();if(this.geometry.path.length>2){this.finalizeGeometry();}},defaultMouseDown:function(evt){if(this.lastDown&&this.lastDown.x==evt.xy.x&&this.lastDown.y==evt.xy.y){return;}
this.lastDown=evt.xy;OpenLayers.Control.EditingTool.prototype.defaultMouseDown.apply(this,arguments);this.geometry.addPoint(evt.point);this.layer.renderer.drawGeometry(evt.point,this.layer.style);this.layer.renderer.drawGeometry(this.geometry,this.layer.style);},defaultMouseMove:function(evt){OpenLayers.Control.EditingTool.prototype.defaultMouseMove.apply(this,arguments);if(this.mouseDown){this.defaultMouseDown(evt);}else{if(this.geometry.path.length>0){this.tmpPoint.x=evt.point.x;this.tmpPoint.y=evt.point.y;this.layer.renderer.drawGeometry(this.tmpPoint,this.style);this.tmpSegment.path[0]=evt.point;this.tmpSegment.path[1]=this.geometry.path[this.geometry.path.length-1];this.layer.renderer.drawGeometry(this.tmpSegment,this.style);}}},defaultKeyDown:function(evt){OpenLayers.Control.EditingTool.prototype.defaultKeyDown.apply(this,arguments);switch(evt.keyCode){case OpenLayers.Event.KEY_RETURN:this.eraseTmpElements();if(this.geometry.path.length>1){this.finalizeGeometry();}
this.geometry.path.clear();break;case OpenLayers.Event.KEY_BACKSPACE:case OpenLayers.Event.KEY_DELETE:case OpenLayers.Event.KEY_ESC:this.eraseTmpElements();this.geometry.path.clear();OpenLayers.Event.stop(evt);break;}},CLASS_NAME:"OpenLayers.Control.DrawLineString"});OpenLayers.Control.EditingTool.DrawLinearPath=OpenLayers.Class.create();OpenLayers.Control.EditingTool.DrawLinearPath.prototype=OpenLayers.Class.inherit(OpenLayers.Control.EditingTool,{image:"stock_draw-polygon.gif",size:new OpenLayers.Size(24,24),initialize:function(){OpenLayers.Control.EditingTool.prototype.initialize.apply(this,arguments);this.geometry=null;},turnOn:function(){OpenLayers.Control.EditingTool.prototype.turnOn.apply(this,arguments);this.geometry=new OpenLayers.Geometry.LineString();},turnOff:function(){OpenLayers.Control.EditingTool.prototype.turnOff.apply(this,arguments);this.eraseTmpElements();this.geometry=null;},finalizeGeometry:function(){var feature=new OpenLayers.Feature();feature.setGeometry(this.geometry);this.layer.addFeatures(feature);this.geometry=new OpenLayers.Geometry.LineString();},eraseTmpElements:function(){for(var i=0;i<this.geometry.path.length;i++){this.layer.renderer.eraseGeometry(this.geometry.path[i].id);}
this.layer.renderer.eraseGeometry("tmpSegment");this.layer.renderer.eraseGeometry("tmpPath");this.layer.renderer.eraseGeometry("tmpPoint");},defaultDblClick:function(evt){this.defaultMouseDown(evt);this.eraseTmpElements();if(this.geometry.path.length>1){this.finalizeGeometry();}
this.geometry.path.clear();},defaultMouseDown:function(evt){if(this.lastDown&&this.lastDown.x==evt.xy.x&&this.lastDown.y==evt.xy.y){return;}
this.lastDown=evt.xy;this.mouseDown=true;evt.point.style=OpenLayers.Style.DefaultRendererTemporaryElementStlyle;this.geometry.addPoint(evt.point);this.layer.renderer.drawGeometry(evt.point);this.layer.renderer.drawGeometry(this.geometry,"tmpPath");},defaultMouseMove:function(evt){OpenLayers.Control.EditingTool.prototype.defaultMouseMove.apply(this,arguments);if(this.mouseDown){this.defaultMouseDown(evt);}else{if(this.geometry.path.length>0){this.layer.renderer.drawGeometry(evt.point,"tmpPoint");var tmpSegment=new OpenLayers.Geometry.LineSegment(this.geometry.path[this.geometry.path.length-1],evt.point);tmpSegment.style=OpenLayers.Style.DefaultRendererTemporaryElementStlyle;this.layer.renderer.drawGeometry(tmpSegment,"tmpSegment");}}},defaultMouseUp:function(evt){this.mouseDown=false;},defaultKeyDown:function(evt){OpenLayers.Control.EditingTool.prototype.defaultKeyDown.apply(this,arguments);switch(evt.keyCode){case OpenLayers.Event.KEY_RETURN:this.eraseTmpElements();if(this.geometry.path.length>1){this.finalizeGeometry();}
this.geometry.path.clear();break;case OpenLayers.Event.KEY_BACKSPACE:case OpenLayers.Event.KEY_DELETE:case OpenLayers.Event.KEY_ESC:this.eraseTmpElements();this.geometry.path.clear();OpenLayers.Event.stop(evt);break;}},CLASS_NAME:"OpenLayers.Control.DrawLinearPath"});OpenLayers.Control.EditingTool.DrawLinearRing=OpenLayers.Class.create();OpenLayers.Control.EditingTool.DrawLinearRing.prototype=OpenLayers.Class.inherit(OpenLayers.Control.EditingTool,{image:"stock_draw-polygon-filled.gif",size:new OpenLayers.Size(24,24),initialize:function(){OpenLayers.Control.EditingTool.prototype.initialize.apply(this,arguments);},turnOn:function(){OpenLayers.Control.EditingTool.prototype.turnOn.apply(this,arguments);this.geometry=new OpenLayers.Geometry.LinearRing();this.tmpPoint=new OpenLayers.Geometry.Point();this.tmpLineSting=new OpenLayers.Geometry.LineString();},turnOff:function(){OpenLayers.Control.EditingTool.prototype.turnOff.apply(this,arguments);this.eraseTmpElements();this.geometry=null;},finalizeGeometry:function(){var feature=new OpenLayers.Feature();feature.setGeometry(this.geometry);this.layer.addFeatures(feature);this.geometry=new OpenLayers.Geometry.LinearRing();},eraseTmpElements:function(){for(var i=0;i<this.geometry.path.length;i++){this.layer.renderer.eraseGeometry(this.geometry.path[i]);}
this.layer.renderer.eraseGeometry(this.tmpPoint);this.layer.renderer.eraseGeometry(this.tmpLineSting);},defaultDblClick:function(evt){OpenLayers.Control.EditingTool.prototype.defaultDblClick.apply(this,arguments);this.defaultMouseDown(evt);this.eraseTmpElements();if(this.geometry.path.length>1){this.finalizeGeometry();}},defaultMouseDown:function(evt){if(this.lastDown&&this.lastDown.x==evt.xy.x&&this.lastDown.y==evt.xy.y){return;}
this.lastDown=evt.xy;OpenLayers.Control.EditingTool.prototype.defaultMouseDown.apply(this,arguments);if(evt.point==this.geometry.path[0]){this.eraseTmpElements();this.finalizeGeometry();}else{this.geometry.addPoint(evt.point);this.layer.renderer.drawGeometry(evt.point,this.layer.style);this.layer.renderer.drawGeometry(this.geometry,this.layer.style);}},defaultMouseMove:function(evt){if(this.lastDown&&this.lastDown.x==evt.xy.x&&this.lastDown.y==evt.xy.y){return;}
OpenLayers.Control.EditingTool.prototype.defaultMouseMove.apply(this,arguments);if(this.mouseDown){this.defaultMouseDown(evt);}else{if(this.geometry.path.length>0){this.tmpPoint.x=evt.point.x;this.tmpPoint.y=evt.point.y;this.layer.renderer.drawGeometry(this.tmpPoint,this.style);this.tmpLineSting.path[0]=this.geometry.path[this.geometry.path.length-2];this.tmpLineSting.path[1]=evt.point;this.tmpLineSting.path[2]=this.geometry.path[this.geometry.path.length-1];this.layer.renderer.drawGeometry(this.tmpLineSting,this.style);}}},defaultKeyDown:function(evt){OpenLayers.Control.EditingTool.prototype.defaultKeyDown.apply(this,arguments);switch(evt.keyCode){case OpenLayers.Event.KEY_RETURN:this.eraseTmpElements();if(this.geometry.path.length>1){this.finalizeGeometry();}
this.geometry.path.clear();break;case OpenLayers.Event.KEY_BACKSPACE:case OpenLayers.Event.KEY_DELETE:case OpenLayers.Event.KEY_ESC:this.eraseTmpElements();this.geometry.path.clear();OpenLayers.Event.stop(evt);break;}},CLASS_NAME:"OpenLayers.Control.DrawLinearRing"});OpenLayers.Control.EditingTool.DrawPoint=OpenLayers.Class.create();OpenLayers.Control.EditingTool.DrawPoint.prototype=OpenLayers.Class.inherit(OpenLayers.Control.EditingTool,{image:"stock-tool-pencil-22.gif",size:new OpenLayers.Size(24,24),initialize:function(){OpenLayers.Control.EditingTool.prototype.initialize.apply(this,arguments);},turnOn:function(){OpenLayers.Control.EditingTool.prototype.turnOn.apply(this,arguments);this.geometry=new OpenLayers.Geometry.Point();},turnOff:function(){OpenLayers.Control.EditingTool.prototype.turnOff.apply(this,arguments);this.layer.removeFeatures(this.geometry.feature);this.layer.renderer.eraseGeometry(this.geometry);},finalizeGeometry:function(){var feature=new OpenLayers.Feature();feature.setGeometry(this.geometry);this.layer.addFeatures(feature);},defaultMouseDown:function(evt){if(this.lastDown&&this.lastDown.x==evt.xy.x&&this.lastDown.y==evt.xy.y){return;}
OpenLayers.Control.EditingTool.prototype.defaultMouseDown.apply(this,arguments);this.geometry=new OpenLayers.Geometry.Point();this.geometry.x=evt.point.x;this.geometry.y=evt.point.y;this.layer.renderer.drawGeometry(this.geometry,this.style);},defaultMouseMove:function(evt){OpenLayers.Control.EditingTool.prototype.defaultMouseMove.apply(this,arguments);if(this.mouseDown){this.geometry.x=evt.point.x;this.geometry.y=evt.point.y;this.layer.renderer.drawGeometry(this.geometry,this.style);}},defaultMouseUp:function(evt){OpenLayers.Control.EditingTool.prototype.defaultMouseUp.apply(this,arguments);this.finalizeGeometry();},defaultKeyDown:function(evt){OpenLayers.Control.EditingTool.prototype.defaultKeyDown.apply(this,arguments);switch(evt.keyCode){case OpenLayers.Event.KEY_RETURN:this.eraseTmpElements();if(this.geometry.path.length>1){this.finalizeGeometry();}
this.geometry.path.clear();break;case OpenLayers.Event.KEY_BACKSPACE:case OpenLayers.Event.KEY_DELETE:case OpenLayers.Event.KEY_ESC:this.eraseTmpElements();this.geometry.path.clear();OpenLayers.Event.stop(evt);break;}},CLASS_NAME:"OpenLayers.Control.DrawPoint"});OpenLayers.Control.EditingTool.MovePathPoint=OpenLayers.Class.create();OpenLayers.Control.EditingTool.MovePathPoint.prototype=OpenLayers.Class.inherit(OpenLayers.Control.EditingTool,{image:"edit.gif",size:new OpenLayers.Size(22,22),tolerance:5,initialize:function(){OpenLayers.Control.EditingTool.prototype.initialize.apply(this,arguments);this.style=OpenLayers.Style.DefaultRendererMovePathPointStyle;this.editingModes=[new OpenLayers.Control.EditingMode.PointSnapping()];},turnOn:function(){OpenLayers.Control.EditingTool.prototype.turnOn.apply(this,arguments);this.selection=[];},turnOff:function(){OpenLayers.Control.EditingTool.prototype.turnOff.apply(this,arguments);for(var i=0;i<this.selection.length;i++){this.layer.renderer.eraseGeometry(this.selection[i]);}
this.selection=[];},defaultMouseDown:function(evt){if(this.lastDown&&this.lastDown.x==evt.xy.x&&this.lastDown.y==evt.xy.y){return;}
this.lastDown=evt.xy;OpenLayers.Control.EditingTool.prototype.defaultMouseDown.apply(this,arguments);var lonlat=this.map.getLonLatFromLayerPx(evt.xy);var mouseCoordinates=new OpenLayers.LonLat(lonlat.lon,lonlat.lat);if(evt.targetGeometry&&evt.targetGeometry.components){for(var i=0;i<evt.targetGeometry.components.length;i++){this._handleSelection(evt.targetGeometry.components[i],mouseCoordinates);}}else if(evt.targetGeometry&&evt.targetGeometry.path){this._handleSelection(evt.targetGeometry,mouseCoordinates);}else{for(var i=0;i<this.selection.length;i++){this.layer.renderer.eraseGeometry(this.selection[i],this.layer.style);}
this.selection=[];this.layer.selection=[];}
var lonlat=this.map.getLonLatFromLayerPx(evt.xy);this.lastPositionReference=new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat);},_handleSelection:function(geometry,mouseCoordinates){var distance=this.tolerance
for(var i=0;i<geometry.path.length;i++){var tmpPoint=geometry.path[i];var pixel=this.layer.map.getPixelFromLonLat(tmpPoint);var mousePixel=this.layer.map.getPixelFromLonLat(mouseCoordinates);var currentDistance=OpenLayers.Util.distance2Pts(pixel.x,pixel.y,mousePixel.x,mousePixel.y);if(currentDistance<distance){closestVertexIndex=i;distance=currentDistance;}}
var point=geometry.path[closestVertexIndex];if(point){if(this.shiftDown){if(OpenLayers.Util.indexOf(this.selection,point)<0){this.selection.push(point);this.layer.renderer.drawGeometry(point,this.layer.style);}else{this.selection=OpenLayers.Util.removeItem(this.selection,point);this.layer.renderer.eraseGeometry(point);}}else{for(var i=0;i<this.selection.length;i++){this.layer.renderer.eraseGeometry(this.selection[i]);}
this.selection=[point];this.layer.renderer.drawGeometry(point,this.layer.style);}}else{for(var i=0;i<this.selection.length;i++){this.layer.renderer.eraseGeometry(this.selection[i],this.layer.style);}
this.layer.selection=[];}
if(this.shiftDown){if(OpenLayers.Util.indexOf(this.layer.selection,geometry.feature)<0){this.layer.selection.push(geometry.feature);}else{}}else{this.layer.selection=geometry.feature?[geometry.feature]:[];}},defaultMouseMove:function(evt){OpenLayers.Control.EditingTool.prototype.defaultMouseMove.apply(this,arguments);if(this.mouseDown){var lonlat=this.map.getLonLatFromLayerPx(evt.xy);var xTranslation=lonlat.lon-this.lastPositionReference.x;var yTranslation=lonlat.lat-this.lastPositionReference.y;var lonlat=this.map.getLonLatFromLayerPx(evt.xy);this.lastPositionReference=new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat);for(var i=0;i<this.selection.length;i++){this.selection[i].setX(this.selection[i].x+xTranslation);this.selection[i].setY(this.selection[i].y+yTranslation);this.layer.renderer.drawGeometry(this.selection[i],this.layer.style);}
for(var i=0;i<this.layer.selection.length;i++){this.layer.renderer.drawGeometry(this.layer.selection[i].geometry,this.layer.style);}}},defaultMouseUp:function(evt){OpenLayers.Control.EditingTool.prototype.defaultMouseUp.apply(this,arguments);if(this.layer.selection.length>0){this.layer.updateFeatures(this.layer.selection);}},defaultKeyDown:function(evt){OpenLayers.Control.EditingTool.prototype.defaultKeyDown.apply(this,arguments);switch(evt.keyCode){case OpenLayers.Event.KEY_BACKSPACE:case OpenLayers.Event.KEY_DELETE:this.eraseTmpElements();this.layer.removeFeatures(this.MovePathPoint);this.selection.clear();OpenLayers.Event.stop(evt);break;}},CLASS_NAME:"OpenLayers.Control.MovePathPoint"});OpenLayers.Control.EditingTool.RemovePathPoint=OpenLayers.Class.create();OpenLayers.Control.EditingTool.RemovePathPoint.prototype=OpenLayers.Class.inherit(OpenLayers.Control.EditingTool,{image:"remove-point.gif",size:new OpenLayers.Size(24,24),tolerance:5,initialize:function(){OpenLayers.Control.EditingTool.prototype.initialize.apply(this,arguments);this.geometry=null;},turnOn:function(){OpenLayers.Control.EditingTool.prototype.turnOn.apply(this,arguments);},turnOff:function(){OpenLayers.Control.EditingTool.prototype.turnOff.apply(this,arguments);},defaultMouseDown:function(evt){OpenLayers.Control.EditingTool.prototype.defaultMouseDown.apply(this,arguments);var distance=this.tolerance
if(evt.targetGeometry&&evt.targetGeometry.path){for(var i=0;i<evt.targetGeometry.path.length;i++){var pixel=this.layer.map.getPixelFromLonLat(evt.targetGeometry.path[i]);var currentDistance=OpenLayers.Util.distance2Pts(pixel.x,pixel.y,evt.xy.x,evt.xy.y);if(currentDistance<distance){closestVertexIndex=i;distance=currentDistance;}}
evt.targetGeometry.removePoint(evt.targetGeometry.path[closestVertexIndex]);this.layer.updateFeatures([evt.targetGeometry.feature]);this.layer.renderer.drawGeometry(evt.targetGeometry,this.layer.style);}},CLASS_NAME:"OpenLayers.Control.RemovePathPoint"});OpenLayers.Control.EditingTool.Rotate=OpenLayers.Class.create();OpenLayers.Control.EditingTool.Rotate.prototype=OpenLayers.Class.inherit(OpenLayers.Control.EditingTool,{image:"transform-rotate.gif",size:new OpenLayers.Size(24,24),rotationDegree:0,initialize:function(){OpenLayers.Control.EditingTool.prototype.initialize.apply(this,arguments);this.tmpGeometry=null;this.editingModes=[];},turnOn:function(){OpenLayers.Control.EditingTool.prototype.turnOn.apply(this,arguments);},turnOff:function(){OpenLayers.Control.EditingTool.prototype.turnOff.apply(this,arguments);},finalizeGeometry:function(){},eraseTmpElements:function(){},defaultDblClick:function(evt){},defaultMouseDown:function(evt){if(this.lastDown&&this.lastDown.x==evt.xy.x&&this.lastDown.y==evt.xy.y){return;}
this.lastDown=evt.xy;OpenLayers.Control.EditingTool.prototype.defaultMouseDown.apply(this,arguments);if(evt.targetGeometry){var geometryClass=eval(evt.targetGeometry.CLASS_NAME);this.tmpGeometry=new geometryClass(evt.targetGeometry.path);this.geometry=evt.targetGeometry;var bbox=this.geometry.getBoundingBox();this.rotationCenter=new OpenLayers.Geometry.Point(bbox.x+bbox.width/2,bbox.y+bbox.height/2);var lonlat=this.map.getLonLatFromLayerPx(evt.xy);this.rotationReference=new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat);this.layer.renderer.drawGeometry(this.rotationCenter,this.style);}},defaultMouseMove:function(evt){OpenLayers.Control.EditingTool.prototype.defaultMouseMove.apply(this,arguments);if(this.mouseDown){var alpha=this.rotationDegree/180*Math.PI;this.rotationDegree+=2;var rotationMatrix=[[Math.cos(alpha),-Math.sin(alpha),0],[Math.sin(alpha),Math.cos(alpha),0],[0,0,1]];var path=[];for(var i=0;i<this.geometry.path.length;i++){var x=this.geometry.path[i].x-this.rotationCenter.x;var y=this.geometry.path[i].y-this.rotationCenter.y;var pointMatrix=[[x],[y],[1]];var newPointMatrix=OpenLayers.Math.Matrix.multiply(rotationMatrix,pointMatrix);path.push(new OpenLayers.Geometry.Point((newPointMatrix[0][0]+this.rotationCenter.x),(newPointMatrix[1][0]+this.rotationCenter.y)));}
this.tmpGeometry.path=path;this.layer.renderer.drawGeometry(this.tmpGeometry,this.style);}},defaultMouseUp:function(evt){OpenLayers.Control.EditingTool.prototype.defaultMouseUp.apply(this,arguments);},defaultKeyDown:function(evt){OpenLayers.Control.EditingTool.prototype.defaultKeyDown.apply(this,arguments);},CLASS_NAME:"OpenLayers.Control.Rotate"});OpenLayers.Control.EditingTool.Selection=OpenLayers.Class.create();OpenLayers.Control.EditingTool.Selection.prototype=OpenLayers.Class.inherit(OpenLayers.Control.EditingTool,{image:"mouse-cursor-white.gif",size:new OpenLayers.Size(22,22),attributesControl:null,initialize:function(){OpenLayers.Control.EditingTool.prototype.initialize.apply(this,arguments);this.style=OpenLayers.Style.DefaultRendererSelectionStyle;this.editingModes=[];},turnOff:function(){OpenLayers.Control.EditingTool.prototype.turnOff.apply(this,arguments);this.eraseTmpElements();this.points=[];},drawTmpElements:function(){},eraseTmpElements:function(){},defaultMouseDown:function(evt){if(this.lastDown&&this.lastDown.x==evt.xy.x&&this.lastDown.y==evt.xy.y){return;}
this.lastDown=evt.xy;OpenLayers.Control.EditingTool.prototype.defaultMouseDown.apply(this,arguments);if(this.attributesControl&&evt.targetGeometry&&evt.targetGeometry.feature&&evt.targetGeometry.feature.attributes){this.attributesControl.setContent(evt.targetGeometry.feature.attributes);}
if(evt.targetGeometry&&evt.targetGeometry.feature&&!evt.targetGeometry.isSnappingSegment){this.eraseTmpElements();if(this.shiftDown){if(OpenLayers.Util.indexOf(this.layer.selection,evt.targetGeometry.feature)<0){this.layer.selection.push(evt.targetGeometry.feature);this.layer.renderer.drawGeometry(evt.targetGeometry,this.style);}else{this.layer.selection=OpenLayers.Util.removeItem(this.layer.selection,evt.targetGeometry.feature);this.layer.renderer.drawGeometry(evt.targetGeometry,this.layer.style);}}else{for(var i=0;i<this.layer.selection.length;i++){this.layer.renderer.drawGeometry(this.layer.selection[i].geometry,this.layer.style);}
this.layer.selection=[];this.layer.selection=[evt.targetGeometry.feature];this.layer.renderer.drawGeometry(evt.targetGeometry.feature.geometry,this.style);}}else{for(var i=0;i<this.layer.selection.length;i++){this.layer.renderer.drawGeometry(this.layer.selection[i].geometry,this.layer.style);}
this.layer.selection=[];}
var lonlat=this.map.getLonLatFromLayerPx(evt.xy);this.lastPositionReference=new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat);},defaultMouseMove:function(evt){OpenLayers.Control.EditingTool.prototype.defaultMouseMove.apply(this,arguments);this.eraseTmpElements();if(this.mouseDown){this.selectionChange=true;var xTranslation=evt.point.x-this.lastPositionReference.x;var yTranslation=evt.point.y-this.lastPositionReference.y;var lonlat=this.map.getLonLatFromLayerPx(evt.xy);this.lastPositionReference=new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat);for(var i=0;i<this.layer.selection.length;i++){if(this.layer.selection[i].geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){this.layer.selection[i].geometry.setX(this.layer.selection[i].geometry.x+xTranslation);this.layer.selection[i].geometry.setY(this.layer.selection[i].geometry.y+yTranslation);}else if(this.layer.selection[i].geometry.path){var path=this.layer.selection[i].geometry.path;for(var iPath=0;iPath<path.length;iPath++){if(this.layer.selection[i].geometry.CLASS_NAME!="OpenLayers.Geometry.LinearRing"||iPath!=path.length-1){path[iPath].setX(path[iPath].x+xTranslation);path[iPath].setY(path[iPath].y+yTranslation);}}
this.layer.selection[i].geometry.path=path;}else{}
this.layer.renderer.drawGeometry(this.layer.selection[i].geometry,this.style);}}},defaultMouseUp:function(evt){OpenLayers.Control.EditingTool.prototype.defaultMouseUp.apply(this,arguments);if(this.layer.selection.length>0){this.layer.updateFeatures(this.layer.selection);}},defaultKeyDown:function(evt){OpenLayers.Control.EditingTool.prototype.defaultKeyDown.apply(this,arguments);switch(evt.keyCode){case OpenLayers.Event.KEY_BACKSPACE:case OpenLayers.Event.KEY_DELETE:this.layer.removeFeatures(this.layer.selection);this.layer.selection=[]
OpenLayers.Event.stop(evt);break;}},CLASS_NAME:"OpenLayers.Control.Selection"});OpenLayers.Control.MouseToolbar=OpenLayers.Class.create();OpenLayers.Control.MouseToolbar.X=6;OpenLayers.Control.MouseToolbar.Y=300;OpenLayers.Control.MouseToolbar.prototype=OpenLayers.Class.inherit(OpenLayers.Control.MouseDefaults,{mode:null,buttons:null,direction:"vertical",buttonClicked:null,initialize:function(position,direction){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.position=new OpenLayers.Pixel(OpenLayers.Control.MouseToolbar.X,OpenLayers.Control.MouseToolbar.Y);if(position){this.position=position;}
if(direction){this.direction=direction;}
this.measureDivs=[];},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);OpenLayers.Control.MouseDefaults.prototype.draw.apply(this,arguments);this.buttons=new Object();var sz=new OpenLayers.Size(28,28);var centered=this.position;this._addButton("zoombox","drag-rectangle-off.png","drag-rectangle-on.png",centered,sz,"Shift->Drag to zoom to area");centered=centered.add((this.direction=="vertical"?0:sz.w),(this.direction=="vertical"?sz.h:0));this._addButton("pan","panning-hand-off.png","panning-hand-on.png",centered,sz,"Drag the map to pan.");centered=centered.add((this.direction=="vertical"?0:sz.w),(this.direction=="vertical"?sz.h:0));this.switchModeTo("pan");return this.div;},_addButton:function(id,img,activeImg,xy,sz,title){var imgLocation=OpenLayers.Util.getImagesLocation()+img;var activeImgLocation=OpenLayers.Util.getImagesLocation()+activeImg;var btn=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_MouseToolbar_"+id,xy,sz,imgLocation,"absolute");this.div.appendChild(btn);btn.imgLocation=imgLocation;btn.activeImgLocation=activeImgLocation;btn.events=new OpenLayers.Events(this,btn,null,true);btn.events.register("mousedown",this,this.buttonDown);btn.events.register("mouseup",this,this.buttonUp);btn.events.register("dblclick",this,OpenLayers.Event.stop);btn.action=id;btn.title=title;btn.alt=title;btn.map=this.map;this.buttons[id]=btn;return btn;},buttonDown:function(evt){if(!OpenLayers.Event.isLeftClick(evt))return;this.buttonClicked=evt.element.action;OpenLayers.Event.stop(evt);},buttonUp:function(evt){if(!OpenLayers.Event.isLeftClick(evt))return;if(this.buttonClicked!=null){if(this.buttonClicked==evt.element.action){this.switchModeTo(evt.element.action);}
OpenLayers.Event.stop(evt);this.buttonClicked=null;}},defaultDblClick:function(evt){this.switchModeTo("pan");this.performedDrag=false;var newCenter=this.map.getLonLatFromViewPortPx(evt.xy);this.map.setCenter(newCenter,this.map.zoom+1);OpenLayers.Event.stop(evt);return false;},defaultMouseDown:function(evt){if(!OpenLayers.Event.isLeftClick(evt))return;this.mouseDragStart=evt.xy.clone();this.performedDrag=false;this.startViaKeyboard=false;if(evt.shiftKey&&this.mode!="zoombox"){this.switchModeTo("zoombox");this.startViaKeyboard=true;}else if(evt.altKey&&this.mode!="measure"){this.switchModeTo("measure");}else if(!this.mode){this.switchModeTo("pan");}
switch(this.mode){case"zoombox":this.map.div.style.cursor="crosshair";this.zoomBox=OpenLayers.Util.createDiv('zoomBox',this.mouseDragStart,null,null,"absolute","2px solid red");this.zoomBox.style.backgroundColor="white";this.zoomBox.style.filter="alpha(opacity=50)";this.zoomBox.style.opacity="0.50";this.zoomBox.style.fontSize="1px";this.zoomBox.style.zIndex=this.map.Z_INDEX_BASE["Popup"]-1;this.map.viewPortDiv.appendChild(this.zoomBox);this.performedDrag=true;break;case"measure":var distance="";if(this.measureStart){measureEnd=this.map.getLonLatFromViewPortPx(this.mouseDragStart);distance=OpenLayers.Util.distVincenty(this.measureStart,measureEnd);distance=Math.round(distance*100)/100;distance=distance+"km";this.measureStartBox=this.measureBox;}
this.measureStart=this.map.getLonLatFromViewPortPx(this.mouseDragStart);;this.measureBox=OpenLayers.Util.createDiv(null,this.mouseDragStart.add(-2-parseInt(this.map.layerContainerDiv.style.left),-2-parseInt(this.map.layerContainerDiv.style.top)),null,null,"absolute");this.measureBox.style.width="4px";this.measureBox.style.height="4px";this.measureBox.style.fontSize="1px";this.measureBox.style.backgroundColor="red";this.measureBox.style.zIndex=this.map.Z_INDEX_BASE["Popup"]-1;this.map.layerContainerDiv.appendChild(this.measureBox);if(distance){this.measureBoxDistance=OpenLayers.Util.createDiv(null,this.mouseDragStart.add(-2-parseInt(this.map.layerContainerDiv.style.left),2-parseInt(this.map.layerContainerDiv.style.top)),null,null,"absolute");this.measureBoxDistance.innerHTML=distance;this.measureBoxDistance.style.zIndex=this.map.Z_INDEX_BASE["Popup"]-1;this.map.layerContainerDiv.appendChild(this.measureBoxDistance);this.measureDivs.push(this.measureBoxDistance);}
this.measureBox.style.zIndex=this.map.Z_INDEX_BASE["Popup"]-1;this.map.layerContainerDiv.appendChild(this.measureBox);this.measureDivs.push(this.measureBox);break;default:this.map.div.style.cursor="move";break;}
document.onselectstart=function(){return false;}
OpenLayers.Event.stop(evt);},switchModeTo:function(mode){if(mode!=this.mode){if(this.mode&&this.buttons[this.mode]){OpenLayers.Util.modifyAlphaImageDiv(this.buttons[this.mode],null,null,null,this.buttons[this.mode].imgLocation);}
if(this.mode=="measure"&&mode!="measure"){for(var i=0;i<this.measureDivs.length;i++){if(this.measureDivs[i]){this.map.layerContainerDiv.removeChild(this.measureDivs[i]);}}
this.measureDivs=[];this.measureStart=null;}
this.mode=mode;if(this.buttons[mode]){OpenLayers.Util.modifyAlphaImageDiv(this.buttons[mode],null,null,null,this.buttons[mode].activeImgLocation);}
switch(this.mode){case"zoombox":this.map.div.style.cursor="crosshair";break;default:this.map.div.style.cursor="default";break;}}},leaveMode:function(){this.switchModeTo("pan");},defaultMouseMove:function(evt){if(this.mouseDragStart!=null){switch(this.mode){case"zoombox":var deltaX=Math.abs(this.mouseDragStart.x-evt.xy.x);var deltaY=Math.abs(this.mouseDragStart.y-evt.xy.y);this.zoomBox.style.width=Math.max(1,deltaX)+"px";this.zoomBox.style.height=Math.max(1,deltaY)+"px";if(evt.xy.x<this.mouseDragStart.x){this.zoomBox.style.left=evt.xy.x+"px";}
if(evt.xy.y<this.mouseDragStart.y){this.zoomBox.style.top=evt.xy.y+"px";}
break;default:var deltaX=this.mouseDragStart.x-evt.xy.x;var deltaY=this.mouseDragStart.y-evt.xy.y;var size=this.map.getSize();var newXY=new OpenLayers.Pixel(size.w/2+deltaX,size.h/2+deltaY);var newCenter=this.map.getLonLatFromViewPortPx(newXY);this.map.setCenter(newCenter,null,true);this.mouseDragStart=evt.xy.clone();}
this.performedDrag=true;}},defaultMouseUp:function(evt){if(!OpenLayers.Event.isLeftClick(evt))return;switch(this.mode){case"zoombox":this.zoomBoxEnd(evt);if(this.startViaKeyboard)this.leaveMode();break;case"pan":if(this.performedDrag){this.map.setCenter(this.map.center);}}
document.onselectstart=null;this.mouseDragStart=null;this.map.div.style.cursor="default";},defaultMouseOut:function(evt){if(this.mouseDragStart!=null&&OpenLayers.Util.mouseLeft(evt,this.map.div)){if(this.zoomBox){this.removeZoomBox();if(this.startViaKeyboard)this.leaveMode();}
this.mouseDragStart=null;this.map.div.style.cursor="default";}},defaultClick:function(evt){if(this.performedDrag){this.performedDrag=false;return false;}}});OpenLayers.Control.PanZoomBar=OpenLayers.Class.create();OpenLayers.Control.PanZoomBar.X=4;OpenLayers.Control.PanZoomBar.Y=4;OpenLayers.Control.PanZoomBar.prototype=OpenLayers.Class.inherit(OpenLayers.Control.PanZoom,{buttons:null,zoomStopWidth:18,zoomStopHeight:11,initialize:function(){OpenLayers.Control.PanZoom.prototype.initialize.apply(this,arguments);this.position=new OpenLayers.Pixel(OpenLayers.Control.PanZoomBar.X,OpenLayers.Control.PanZoomBar.Y);},setMap:function(map){OpenLayers.Control.PanZoom.prototype.setMap.apply(this,arguments);this.map.events.register("changebaselayer",this,this.redraw);},redraw:function(){if(this.div!=null){this.div.innerHTML="";}
this.draw();},draw:function(px){OpenLayers.Control.prototype.draw.apply(this,arguments);px=this.position.clone();this.buttons=new Array();var sz=new OpenLayers.Size(18,18);var centered=new OpenLayers.Pixel(px.x+sz.w/2,px.y);this._addButton("panup","north-mini.png",centered,sz);px.y=centered.y+sz.h;this._addButton("panleft","west-mini.png",px,sz);this._addButton("panright","east-mini.png",px.add(sz.w,0),sz);this._addButton("pandown","south-mini.png",centered.add(0,sz.h*2),sz);this._addButton("zoomin","zoom-plus-mini.png",centered.add(0,sz.h*3+5),sz);centered=this._addZoomBar(centered.add(0,sz.h*4+5));this._addButton("zoomout","zoom-minus-mini.png",centered,sz);return this.div;},_addZoomBar:function(centered){var imgLocation=OpenLayers.Util.getImagesLocation();var id="OpenLayers_Control_PanZoomBar_Slider"+this.map.id;var zoomsToEnd=this.map.getNumZoomLevels()-1-this.map.getZoom();var slider=OpenLayers.Util.createAlphaImageDiv(id,centered.add(-1,zoomsToEnd*this.zoomStopHeight),new OpenLayers.Size(20,9),imgLocation+"slider.png","absolute");this.slider=slider;this.sliderEvents=new OpenLayers.Events(this,slider,null,true);this.sliderEvents.register("mousedown",this,this.zoomBarDown);this.sliderEvents.register("mousemove",this,this.zoomBarDrag);this.sliderEvents.register("mouseup",this,this.zoomBarUp);this.sliderEvents.register("dblclick",this,this.doubleClick);this.sliderEvents.register("click",this,this.doubleClick);sz=new OpenLayers.Size();sz.h=this.zoomStopHeight*this.map.getNumZoomLevels();sz.w=this.zoomStopWidth;var div=null
if(OpenLayers.Util.alphaHack()){var id="OpenLayers_Control_PanZoomBar"+this.map.id;div=OpenLayers.Util.createAlphaImageDiv(id,centered,new OpenLayers.Size(sz.w,this.zoomStopHeight),imgLocation+"zoombar.png","absolute",null,"crop");div.style.height=sz.h;}else{div=OpenLayers.Util.createDiv('OpenLayers_Control_PanZoomBar_Zoombar'+this.map.id,centered,sz,imgLocation+"zoombar.png");}
this.zoombarDiv=div;this.divEvents=new OpenLayers.Events(this,div,null,true);this.divEvents.register("mousedown",this,this.divClick);this.divEvents.register("mousemove",this,this.passEventToSlider);this.divEvents.register("dblclick",this,this.doubleClick);this.divEvents.register("click",this,this.doubleClick);this.div.appendChild(div);this.startTop=parseInt(div.style.top);this.div.appendChild(slider);this.map.events.register("zoomend",this,this.moveZoomBar);centered=centered.add(0,this.zoomStopHeight*this.map.getNumZoomLevels());return centered;},passEventToSlider:function(evt){this.sliderEvents.handleBrowserEvent(evt);},divClick:function(evt){if(!OpenLayers.Event.isLeftClick(evt))return;var y=evt.xy.y;var top=OpenLayers.Util.pagePosition(evt.object)[1];var levels=Math.floor((y-top)/this.zoomStopHeight);this.map.zoomTo((this.map.getNumZoomLevels()-1)-levels);OpenLayers.Event.stop(evt);},zoomBarDown:function(evt){if(!OpenLayers.Event.isLeftClick(evt))return;this.map.events.register("mousemove",this,this.passEventToSlider);this.map.events.register("mouseup",this,this.passEventToSlider);this.mouseDragStart=evt.xy.clone();this.zoomStart=evt.xy.clone();this.div.style.cursor="move";OpenLayers.Event.stop(evt);},zoomBarDrag:function(evt){if(this.mouseDragStart!=null){var deltaY=this.mouseDragStart.y-evt.xy.y
var offsets=OpenLayers.Util.pagePosition(this.zoombarDiv);if((evt.clientY-offsets[1])>0&&(evt.clientY-offsets[1])<parseInt(this.zoombarDiv.style.height)-2){var newTop=parseInt(this.slider.style.top)-deltaY;this.slider.style.top=newTop+"px";}
this.mouseDragStart=evt.xy.clone();OpenLayers.Event.stop(evt);}},zoomBarUp:function(evt){if(!OpenLayers.Event.isLeftClick(evt))return;if(this.zoomStart){this.div.style.cursor="default";this.map.events.unregister("mouseup",this,this.passEventToSlider);this.map.events.unregister("mousemove",this,this.passEventToSlider);var deltaY=this.zoomStart.y-evt.xy.y
this.map.zoomTo(this.map.zoom+Math.round(deltaY/this.zoomStopHeight));this.moveZoomBar();this.mouseDragStart=null;OpenLayers.Event.stop(evt);}},moveZoomBar:function(){var newTop=((this.map.getNumZoomLevels()-1)-this.map.getZoom())*this.zoomStopHeight+this.startTop+1;this.slider.style.top=newTop+"px";},CLASS_NAME:"OpenLayers.Control.PanZoomBar"});OpenLayers.Geometry.LineString=OpenLayers.Class.create();OpenLayers.Geometry.LineString.prototype=OpenLayers.Class.inherit(OpenLayers.Geometry.Curve,{toString:function(){return this.path.toString();},clone:function(){return new OpenLayers.Geometry.LineString(this.path);},CLASS_NAME:"OpenLayers.Geometry.LineString"});OpenLayers.Geometry.MultiLineString=OpenLayers.Class.create();OpenLayers.Geometry.MultiLineString.prototype=OpenLayers.Class.inherit(OpenLayers.Geometry.Aggregate,{initialize:function(components){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");if(components!=null){this.addComponents(components);}},addComponents:function(components){if(!(components instanceof Array)){components=[components];}
for(var i=0;i<components.length;i++){if(!(components[i]instanceof OpenLayers.Geometry.LineString)){throw"component should be an OpenLayers.Geometry.LineString";}}
OpenLayers.Geometry.Aggregate.prototype.addComponents.apply(this,arguments);},removeComponents:function(components){OpenLayers.Geometry.Aggregate.prototype.removeComponents.apply(this,components);},CLASS_NAME:"OpenLayers.Geometry.MultiLineString"});OpenLayers.Geometry.MultiPoint=OpenLayers.Class.create();OpenLayers.Geometry.MultiPoint.prototype=OpenLayers.Class.inherit(OpenLayers.Geometry.Aggregate,{initialize:function(components){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");if(components!=null){this.addComponents(components);}},addComponents:function(components){if(!(components instanceof Array)){components=[components];}
for(var i=0;i<components.length;i++){if(!(components[i]instanceof OpenLayers.Geometry.Point)){throw"component should be an OpenLayers.Geometry.Point";}}
OpenLayers.Geometry.Aggregate.prototype.addComponents.apply(this,arguments);},removeComponents:function(components){OpenLayers.Geometry.Aggregate.prototype.removeComponents.apply(this,arguments);},CLASS_NAME:"OpenLayers.Geometry.MultiPoint"});OpenLayers.Geometry.MultiPolygon=OpenLayers.Class.create();OpenLayers.Geometry.MultiPolygon.prototype=OpenLayers.Class.inherit(OpenLayers.Geometry.Aggregate,{initialize:function(components){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");if(components!=null){this.addComponents(components);}},addComponents:function(components){if(!(components instanceof Array)){components=[components];}
for(var i=0;i<components.length;i++){if(!(components[i]instanceof OpenLayers.Geometry.Polygon)){throw"component should be an OpenLayers.Geometry.Polygon";}}
OpenLayers.Geometry.Aggregate.prototype.addComponents.apply(this,arguments);},removeComponents:function(components){OpenLayers.Geometry.Aggregate.prototype.removeComponents.apply(this,arguments);},CLASS_NAME:"OpenLayers.Geometry.MultiPolygon"});OpenLayers.Geometry.Polygon=OpenLayers.Class.create();OpenLayers.Geometry.Polygon.prototype=OpenLayers.Class.inherit(OpenLayers.Geometry.Aggregate,{initialize:function(components){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");if(components!=null){this.addComponents(components);}},addComponents:function(components){if(!(components instanceof Array)){components=[components];}
for(var i=0;i<components.length;i++){if(!(components[i]instanceof OpenLayers.Geometry.LinearRing)){throw"component should be an OpenLayers.Geometry.LinearRing";}}
OpenLayers.Geometry.Aggregate.prototype.addComponents.apply(this,arguments);},removeComponents:function(components){OpenLayers.Geometry.Aggregate.prototype.removeComponents.apply(this,arguments);},CLASS_NAME:"OpenLayers.Geometry.Polygon"});OpenLayers.Layer.Boxes=OpenLayers.Class.create();OpenLayers.Layer.Boxes.prototype=OpenLayers.Class.inherit(OpenLayers.Layer.Markers,{initialize:function(){OpenLayers.Layer.Markers.prototype.initialize.apply(this,arguments);},drawMarker:function(marker){var bounds=marker.bounds;var topleft=this.map.getLayerPxFromLonLat(new OpenLayers.LonLat(bounds.left,bounds.top));var botright=this.map.getLayerPxFromLonLat(new OpenLayers.LonLat(bounds.right,bounds.bottom));if(botright==null||topleft==null){marker.display(false);}else{var sz=new OpenLayers.Size(Math.max(1,botright.x-topleft.x),Math.max(1,botright.y-topleft.y));var markerDiv=marker.draw(topleft,sz);if(!marker.drawn){this.div.appendChild(markerDiv);marker.drawn=true;}}},CLASS_NAME:"OpenLayers.Layer.Boxes"});OpenLayers.Layer.GML=OpenLayers.Class.create();OpenLayers.Layer.GML.prototype=OpenLayers.Class.inherit(OpenLayers.Layer.Vector,{initialize:function(name,href,options){var newArguments=new Array()
newArguments.push(name,options);OpenLayers.Layer.Vector.prototype.initialize.apply(this,newArguments);this.href=href;this.gmlLoad=false;},setVisibility:function(visibility,noEvent){if(this.visibility&&!this.gmlLoad){this.gmlLoad=true;var results=OpenLayers.loadURL(this.href,null,this,this.requestSuccess,this.requestFailure);}
var newArguments=new Array()
newArguments.push(visibility,noEvent);OpenLayers.Layer.Vector.prototype.setVisibility.apply(this,newArguments);},moveTo:function(bounds,zoomChanged,minor){OpenLayers.Layer.Vector.prototype.moveTo.apply(this,arguments);if(this.visibility&&!this.gmlLoad){this.gmlLoad=true;var results=OpenLayers.loadURL(this.href,null,this,this.requestSuccess,this.requestFailure);}},requestSuccess:function(request){var doc=request.responseXML;if(!doc||request.fileType!="XML"){doc=OpenLayers.parseXMLString(request.responseText);}
var gml=new OpenLayers.Parser.GML();gml.load(doc);var featureCollection=gml.featureCollection;this.addFeatures(featureCollection);},requestFailure:function(request){alert("Error in loading GML file "+this.href);},CLASS_NAME:"OpenLayers.Layer.GML"});OpenLayers.Layer.GeoRSS=OpenLayers.Class.create();OpenLayers.Layer.GeoRSS.prototype=OpenLayers.Class.inherit(OpenLayers.Layer.Markers,{location:null,features:null,selectedFeature:null,initialize:function(name,location){OpenLayers.Layer.Markers.prototype.initialize.apply(this,[name]);this.location=location;this.features=new Array();OpenLayers.loadURL(location,null,this,this.parseData);},destroy:function(){this.clearFeatures();this.features=null;OpenLayers.Layer.Markers.prototype.destroy.apply(this,arguments);},parseData:function(ajaxRequest){var doc=ajaxRequest.responseXML;if(!doc||ajaxRequest.fileType!="XML"){doc=OpenLayers.parseXMLString(ajaxRequest.responseText);}
this.name=null;try{this.name=doc.getElementsByTagNameNS('*','title')[0].firstChild.nodeValue;}
catch(e){this.name=doc.getElementsByTagName('title')[0].firstChild.nodeValue;}
var itemlist=null;try{itemlist=doc.getElementsByTagNameNS('*','item');}
catch(e){itemlist=doc.getElementsByTagName('item');}
if(itemlist.length==0){try{itemlist=doc.getElementsByTagNameNS('*','entry');}
catch(e){itemlist=doc.getElementsByTagName('entry');}}
for(var i=0;i<itemlist.length;i++){var data={};var point=OpenLayers.Util.getNodes(itemlist[i],'georss:point');var lat=OpenLayers.Util.getNodes(itemlist[i],'geo:lat');var lon=OpenLayers.Util.getNodes(itemlist[i],'geo:long');if(point.length>0){var location=point[0].firstChild.nodeValue.split(" ");if(location.length!=2){var location=point[0].firstChild.nodeValue.split(",");}}else if(lat.length>0&&lon.length>0){var location=[parseFloat(lat[0].firstChild.nodeValue),parseFloat(lon[0].firstChild.nodeValue)];}else{continue;}
location=new OpenLayers.LonLat(parseFloat(location[1]),parseFloat(location[0]));var title="Untitled";try{title=OpenLayers.Util.getNodes(itemlist[i],"title")[0].firstChild.nodeValue;}
catch(e){title="Untitled";}
var descr_nodes=null;try{descr_nodes=itemlist[i].getElementsByTagNameNS("*","description");}
catch(e){descr_nodes=itemlist[i].getElementsByTagName("description");}
if(descr_nodes.length==0){try{descr_nodes=itemlist[i].getElementsByTagNameNS("*","summary");}
catch(e){descr_nodes=itemlist[i].getElementsByTagName("summary");}}
var description="No description.";try{description=descr_nodes[0].firstChild.nodeValue;}
catch(e){description="No description.";}
try{var link=OpenLayers.Util.getNodes(itemlist[i],"link")[0].firstChild.nodeValue;}catch(e){}
data.icon=OpenLayers.Marker.defaultIcon();data.popupSize=new OpenLayers.Size(250,120);if((title!=null)&&(description!=null)){contentHTML='<div class="olLayerGeoRSSClose">[x]</div>';contentHTML+='<div class="olLayerGeoRSSTitle">';if(link)contentHTML+='<a class="link" href="'+link+'" target="_blank">';contentHTML+=title;if(link)contentHTML+='</a>';contentHTML+='</div>';contentHTML+='<div style="" class="olLayerGeoRSSDescription">';contentHTML+=description;contentHTML+='</div>';data['popupContentHTML']=contentHTML;}
var feature=new OpenLayers.Feature(this,location,data);this.features.push(feature);var marker=feature.createMarker();marker.events.register('click',feature,this.markerClick);this.addMarker(marker);}},markerClick:function(evt){sameMarkerClicked=(this==this.layer.selectedFeature);this.layer.selectedFeature=(!sameMarkerClicked)?this:null;for(var i=0;i<this.layer.map.popups.length;i++){this.layer.map.removePopup(this.layer.map.popups[i]);}
if(!sameMarkerClicked){var popup=this.createPopup();OpenLayers.Event.observe(popup.div,"click",function(){for(var i=0;i<this.layer.map.popups.length;i++){this.layer.map.removePopup(this.layer.map.popups[i]);}}.bindAsEventListener(this));this.layer.map.addPopup(popup);}
OpenLayers.Event.stop(evt);},clearFeatures:function(){if(this.features!=null){while(this.features.length>0){var feature=this.features[0];OpenLayers.Util.removeItem(this.features,feature);feature.destroy();}}},CLASS_NAME:"OpenLayers.Layer.GeoRSS"});OpenLayers.Layer.Google=OpenLayers.Class.create();OpenLayers.Layer.Google.prototype=OpenLayers.Class.inherit(OpenLayers.Layer.EventPane,OpenLayers.Layer.FixedZoomLevels,{MIN_ZOOM_LEVEL:0,MAX_ZOOM_LEVEL:17,RESOLUTIONS:[1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125],type:null,initialize:function(name,options){OpenLayers.Layer.EventPane.prototype.initialize.apply(this,arguments);OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,arguments);this.addContainerPxFunction();},loadMapObject:function(){try{this.mapObject=new GMap2(this.div);var poweredBy=this.div.lastChild;this.div.removeChild(poweredBy);this.pane.appendChild(poweredBy);poweredBy.className="olLayerGooglePoweredBy gmnoprint";poweredBy.style.left="";poweredBy.style.bottom="";var termsOfUse=this.div.lastChild;this.div.removeChild(termsOfUse);this.pane.appendChild(termsOfUse);termsOfUse.className="olLayerGoogleCopyright";termsOfUse.style.right="";termsOfUse.style.bottom="";}catch(e){}},setMap:function(map){OpenLayers.Layer.EventPane.prototype.setMap.apply(this,arguments);if(this.type!=null){this.map.events.register("moveend",this,this.setMapType);}},setMapType:function(){if(this.mapObject.getCenter()!=null){this.mapObject.setMapType(this.type);this.map.events.unregister("moveend",this,this.setMapType);}},onMapResize:function(){this.mapObject.checkResize();},getOLBoundsFromMapObjectBounds:function(moBounds){var olBounds=null;if(moBounds!=null){var sw=moBounds.getSouthWest();var ne=moBounds.getNorthEast();olBounds=new OpenLayers.Bounds(sw.lng(),sw.lat(),ne.lng(),ne.lat());}
return olBounds;},getMapObjectBoundsFromOLBounds:function(olBounds){var moBounds=null;if(olBounds!=null){var sw=new GLatLng(olBounds.bottom,olBounds.left);var ne=new GLatLng(olBounds.top,olBounds.right);moBounds=new GLatLngBounds(sw,ne);}
return moBounds;},addContainerPxFunction:function(){if(typeof GMap2!="undefined"&&!GMap2.fromLatLngToContainerPixel){GMap2.prototype.fromLatLngToContainerPixel=function(gLatLng){var gPoint=this.fromLatLngToDivPixel(gLatLng);var div=this.b.firstChild.firstChild;gPoint.x+=div.offsetLeft;gPoint.y+=div.offsetTop;return gPoint;};}},getWarningHTML:function(){var html="";html+="The Google Layer was unable to load correctly.<br>";html+="<br>";html+="To get rid of this message, select a new BaseLayer "
html+="in the layer switcher in the upper-right corner.<br>";html+="<br>";html+="Most likely, this is because the Google Maps library";html+=" script was either not included, or does not contain the";html+=" correct API key for your site.<br>";html+="<br>";html+="Developers: For help getting this working correctly, ";html+="<a href='http://trac.openlayers.org/wiki/Google' "
html+="target='_blank'>";html+="click here";html+="</a>";return html;},setMapObjectCenter:function(center,zoom){this.mapObject.setCenter(center,zoom);},getMapObjectCenter:function(){return this.mapObject.getCenter();},getMapObjectZoom:function(){return this.mapObject.getZoom();},getMapObjectLonLatFromMapObjectPixel:function(moPixel){return this.mapObject.fromContainerPixelToLatLng(moPixel);},getMapObjectPixelFromMapObjectLonLat:function(moLonLat){return this.mapObject.fromLatLngToContainerPixel(moLonLat);},getMapObjectZoomFromMapObjectBounds:function(moBounds){return this.mapObject.getBoundsZoomLevel(moBounds);},getLongitudeFromMapObjectLonLat:function(moLonLat){return moLonLat.lng();},getLatitudeFromMapObjectLonLat:function(moLonLat){return moLonLat.lat();},getMapObjectLonLatFromLonLat:function(lon,lat){return new GLatLng(lat,lon);},getXFromMapObjectPixel:function(moPixel){return moPixel.x;},getYFromMapObjectPixel:function(moPixel){return moPixel.y;},getMapObjectPixelFromXY:function(x,y){return new GPoint(x,y);},CLASS_NAME:"OpenLayers.Layer.Google"});OpenLayers.Layer.Grid=OpenLayers.Class.create();OpenLayers.Layer.Grid.prototype=OpenLayers.Class.inherit(OpenLayers.Layer.HTTPRequest,{tileSize:null,grid:null,buffer:2,initialize:function(name,url,params,options){OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,arguments);this.grid=new Array();},destroy:function(){this.clearGrid();this.grid=null;this.tileSize=null;OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.Grid(this.name,this.url,this.params,this.options);}
obj=OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this,[obj]);if(this.tileSize!=null){obj.tileSize=this.tileSize.clone();}
obj.grid=new Array();return obj;},setMap:function(map){OpenLayers.Layer.HTTPRequest.prototype.setMap.apply(this,arguments);if(this.tileSize==null){this.tileSize=this.map.getTileSize();}},moveTo:function(bounds,zoomChanged,dragging){OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this,arguments);if(bounds==null){bounds=this.map.getExtent();}
if(bounds!=null){if(!this.grid.length||zoomChanged||!this.getGridBounds().containsBounds(bounds,true)){this._initTiles();}else{while(true){var tlLayer=this.grid[0][0].position;var tlViewPort=this.map.getViewPortPxFromLayerPx(tlLayer);if(tlViewPort.x>-this.tileSize.w*(this.buffer-1)){this.shiftColumn(true);}else if(tlViewPort.x<-this.tileSize.w*this.buffer){this.shiftColumn(false);}else if(tlViewPort.y>-this.tileSize.h*(this.buffer-1)){this.shiftRow(true);}else if(tlViewPort.y<-this.tileSize.h*this.buffer){this.shiftRow(false);}else{break;}}}}},getGridBounds:function(){var bottom=this.grid.length-1;var bottomLeftTile=this.grid[bottom][0];var right=this.grid[0].length-1;var topRightTile=this.grid[0][right];return new OpenLayers.Bounds(bottomLeftTile.bounds.left,bottomLeftTile.bounds.bottom,topRightTile.bounds.right,topRightTile.bounds.top);},_initTiles:function(){var viewSize=this.map.getSize();var bounds=this.map.getExtent();var extent=this.map.getMaxExtent();var resolution=this.map.getResolution();var tilelon=resolution*this.tileSize.w;var tilelat=resolution*this.tileSize.h;var offsetlon=bounds.left-extent.left;var tilecol=Math.floor(offsetlon/tilelon)-this.buffer;var tilecolremain=offsetlon/tilelon-tilecol;var tileoffsetx=-tilecolremain*this.tileSize.w;var tileoffsetlon=extent.left+tilecol*tilelon;var offsetlat=bounds.top-(extent.bottom+tilelat);var tilerow=Math.ceil(offsetlat/tilelat)+this.buffer;var tilerowremain=tilerow-offsetlat/tilelat;var tileoffsety=-tilerowremain*this.tileSize.h;var tileoffsetlat=extent.bottom+tilerow*tilelat;tileoffsetx=Math.round(tileoffsetx);tileoffsety=Math.round(tileoffsety);this.origin=new OpenLayers.Pixel(tileoffsetx,tileoffsety);var startX=tileoffsetx;var startLon=tileoffsetlon;var rowidx=0;do{var row=this.grid[rowidx++];if(!row){row=new Array();this.grid.push(row);}
tileoffsetlon=startLon;tileoffsetx=startX;var colidx=0;do{var tileBounds=new OpenLayers.Bounds(tileoffsetlon,tileoffsetlat,tileoffsetlon+tilelon,tileoffsetlat+tilelat);var x=tileoffsetx;x-=parseInt(this.map.layerContainerDiv.style.left);var y=tileoffsety;y-=parseInt(this.map.layerContainerDiv.style.top);var px=new OpenLayers.Pixel(x,y);var tile=row[colidx++];if(!tile){tile=this.addTile(tileBounds,px);row.push(tile);}else{tile.moveTo(tileBounds,px,false);}
tileoffsetlon+=tilelon;tileoffsetx+=this.tileSize.w;}while(tileoffsetlon<=bounds.right+tilelon*this.buffer)
tileoffsetlat-=tilelat;tileoffsety+=this.tileSize.h;}while(tileoffsetlat>=bounds.bottom-tilelat*this.buffer)
this.spiralTileLoad();},spiralTileLoad:function(){var tileQueue=new Array();var directions=["right","down","left","up"];var iRow=0;var iCell=-1;var direction=OpenLayers.Util.indexOf(directions,"right");var directionsTried=0;while(directionsTried<directions.length){var testRow=iRow;var testCell=iCell;switch(directions[direction]){case"right":testCell++;break;case"down":testRow++;break;case"left":testCell--;break;case"up":testRow--;break;}
var tile=null;if((testRow<this.grid.length)&&(testRow>=0)&&(testCell<this.grid[0].length)&&(testCell>=0)){tile=this.grid[testRow][testCell];}
if((tile!=null)&&(!tile.queued)){tileQueue.unshift(tile);tile.queued=true;directionsTried=0;iRow=testRow;iCell=testCell;}else{direction=(direction+1)%4;directionsTried++;}}
for(var i=0;i<tileQueue.length;i++){var tile=tileQueue[i]
tile.draw();tile.queued=false;}},addTile:function(bounds,position){},clearGrid:function(){if(this.grid){for(var iRow=0;iRow<this.grid.length;iRow++){var row=this.grid[iRow];for(var iCol=0;iCol<row.length;iCol++){OpenLayers.Util.clearArray(row[iCol]);}}}},shiftRow:function(prepend){var modelRowIndex=(prepend)?0:(this.grid.length-1);var modelRow=this.grid[modelRowIndex];var resolution=this.map.getResolution();var deltaY=(prepend)?-this.tileSize.h:this.tileSize.h;var deltaLat=resolution*-deltaY;var row=(prepend)?this.grid.pop():this.grid.shift();for(var i=0;i<modelRow.length;i++){var modelTile=modelRow[i];var bounds=modelTile.bounds.clone();var position=modelTile.position.clone();bounds.bottom=bounds.bottom+deltaLat;bounds.top=bounds.top+deltaLat;position.y=position.y+deltaY;row[i].moveTo(bounds,position);}
if(prepend){this.grid.unshift(row);}else{this.grid.push(row);}},shiftColumn:function(prepend){var deltaX=(prepend)?-this.tileSize.w:this.tileSize.w;var resolution=this.map.getResolution();var deltaLon=resolution*deltaX;for(var i=0;i<this.grid.length;i++){var row=this.grid[i];var modelTileIndex=(prepend)?0:(row.length-1);var modelTile=row[modelTileIndex];var bounds=modelTile.bounds.clone();var position=modelTile.position.clone();bounds.left=bounds.left+deltaLon;bounds.right=bounds.right+deltaLon;position.x=position.x+deltaX;var tile=prepend?this.grid[i].pop():this.grid[i].shift()
tile.moveTo(bounds,position);if(prepend){this.grid[i].unshift(tile);}else{this.grid[i].push(tile);}}},CLASS_NAME:"OpenLayers.Layer.Grid"});OpenLayers.Layer.MultiMap=OpenLayers.Class.create();OpenLayers.Layer.MultiMap.prototype=OpenLayers.Class.inherit(OpenLayers.Layer.EventPane,OpenLayers.Layer.FixedZoomLevels,{MIN_ZOOM_LEVEL:1,MAX_ZOOM_LEVEL:17,RESOLUTIONS:[9,1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125],type:null,initialize:function(name,options){OpenLayers.Layer.EventPane.prototype.initialize.apply(this,arguments);OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,arguments);},loadMapObject:function(){try{this.mapObject=new MultimapViewer(this.div);}catch(e){}},getWarningHTML:function(){var html="";html+="The MM Layer was unable to load correctly.<br>";html+="<br>";html+="To get rid of this message, select a new BaseLayer "
html+="in the layer switcher in the upper-right corner.<br>";html+="<br>";html+="Most likely, this is because the MM library";html+=" script was either not correctly included.<br>";html+="<br>";html+="Demmlopers: For help getting this working correctly, ";html+="<a href='http://trac.openlayers.org/wiki/MultiMap' "
html+="target='_blank'>";html+="click here";html+="</a>";return html;},setMapObjectCenter:function(center,zoom){this.mapObject.goToPosition(center,zoom);},getMapObjectCenter:function(){return this.mapObject.getCurrentPosition();},getMapObjectZoom:function(){return this.mapObject.getZoomFactor();},getMapObjectLonLatFromMapObjectPixel:function(moPixel){moPixel.x=moPixel.x-(this.map.getSize().w/2);moPixel.y=moPixel.y-(this.map.getSize().h/2);return this.mapObject.getMapPositionAt(moPixel);},getMapObjectPixelFromMapObjectLonLat:function(moLonLat){return this.mapObject.geoPosToContainerPixels(moLonLat);},getLongitudeFromMapObjectLonLat:function(moLonLat){return moLonLat.lon;},getLatitudeFromMapObjectLonLat:function(moLonLat){return moLonLat.lat;},getMapObjectLonLatFromLonLat:function(lon,lat){return new MMLatLon(lat,lon);},getXFromMapObjectPixel:function(moPixel){return moPixel.x;},getYFromMapObjectPixel:function(moPixel){return moPixel.y;},getMapObjectPixelFromXY:function(x,y){return new MMPoint(x,y);},CLASS_NAME:"OpenLayers.Layer.MultiMap"});OpenLayers.Layer.Text=OpenLayers.Class.create();OpenLayers.Layer.Text.prototype=OpenLayers.Class.inherit(OpenLayers.Layer.Markers,{location:null,features:null,selectedFeature:null,initialize:function(name,options){OpenLayers.Layer.Markers.prototype.initialize.apply(this,arguments);this.features=new Array();if(this.location!=null){OpenLayers.loadURL(this.location,null,this,this.parseData);}},destroy:function(){this.clearFeatures();this.features=null;OpenLayers.Layer.Markers.prototype.destroy.apply(this,arguments);},parseData:function(ajaxRequest){var text=ajaxRequest.responseText;var lines=text.split('\n');var columns;for(var lcv=0;lcv<(lines.length-1);lcv++){var currLine=lines[lcv].replace(/^\s*/,'').replace(/\s*$/,'');if(currLine.charAt(0)!='#'){if(!columns){columns=currLine.split('\t');}else{var vals=currLine.split('\t');var location=new OpenLayers.LonLat(0,0);var title;var url;var icon,iconSize,iconOffset;var set=false;for(var valIndex=0;valIndex<vals.length;valIndex++){if(vals[valIndex]){if(columns[valIndex]=='point'){var coords=vals[valIndex].split(',');location.lat=parseFloat(coords[0]);location.lon=parseFloat(coords[1]);set=true;}else if(columns[valIndex]=='lat'){location.lat=parseFloat(vals[valIndex]);set=true;}else if(columns[valIndex]=='lon'){location.lon=parseFloat(vals[valIndex]);set=true;}else if(columns[valIndex]=='title')
title=vals[valIndex];else if(columns[valIndex]=='image'||columns[valIndex]=='icon')
url=vals[valIndex];else if(columns[valIndex]=='iconSize'){var size=vals[valIndex].split(',');iconSize=new OpenLayers.Size(parseFloat(size[0]),parseFloat(size[1]));}else if(columns[valIndex]=='iconOffset'){var offset=vals[valIndex].split(',');iconOffset=new OpenLayers.Pixel(parseFloat(offset[0]),parseFloat(offset[1]));}else if(columns[valIndex]=='title'){title=vals[valIndex];}else if(columns[valIndex]=='description'){description=vals[valIndex];}}}
if(set){var data=new Object();if(url!=null){data.icon=new OpenLayers.Icon(url,iconSize,iconOffset);}else{data.icon=OpenLayers.Marker.defaultIcon();if(iconSize!=null){data.icon.setSize(iconSize);}}
if((title!=null)&&(description!=null)){data['popupContentHTML']='<h2>'+title+'</h2><p>'+description+'</p>';}
var feature=new OpenLayers.Feature(this,location,data);this.features.push(feature);var marker=feature.createMarker();marker.events.register('click',feature,this.markerClick);this.addMarker(marker);}}}}},markerClick:function(evt){sameMarkerClicked=(this==this.layer.selectedFeature);this.layer.selectedFeature=(!sameMarkerClicked)?this:null;for(var i=0;i<this.layer.map.popups.length;i++){this.layer.map.removePopup(this.layer.map.popups[i]);}
if(!sameMarkerClicked){this.layer.map.addPopup(this.createPopup());}
OpenLayers.Event.stop(evt);},clearFeatures:function(){if(this.features!=null){while(this.features.length>0){var feature=this.features[0];OpenLayers.Util.removeItem(this.features,feature);feature.destroy();}}},CLASS_NAME:"OpenLayers.Layer.Text"});OpenLayers.Layer.VirtualEarth=OpenLayers.Class.create();OpenLayers.Layer.VirtualEarth.prototype=OpenLayers.Class.inherit(OpenLayers.Layer.EventPane,OpenLayers.Layer.FixedZoomLevels,{MIN_ZOOM_LEVEL:1,MAX_ZOOM_LEVEL:17,RESOLUTIONS:[1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125],type:null,initialize:function(name,options){OpenLayers.Layer.EventPane.prototype.initialize.apply(this,arguments);OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,arguments);},loadMapObject:function(){var veDiv=OpenLayers.Util.createDiv(this.name);var sz=this.map.getSize();veDiv.style.width=sz.w;veDiv.style.height=sz.h;this.div.appendChild(veDiv);try{this.mapObject=new VEMap(this.name);}catch(e){}
if(this.mapObject!=null){try{this.mapObject.LoadMap(null,null,this.type);}catch(e){}
this.mapObject.HideDashboard();}},getWarningHTML:function(){var html="";html+="The VE Layer was unable to load correctly.<br>";html+="<br>";html+="To get rid of this message, select a new BaseLayer "
html+="in the layer switcher in the upper-right corner.<br>";html+="<br>";html+="Most likely, this is because the VE library";html+=" script was either not correctly included.<br>";html+="<br>";html+="Developers: For help getting this working correctly, ";html+="<a href='http://trac.openlayers.org/wiki/VirtualEarth' "
html+="target='_blank'>";html+="click here";html+="</a>";return html;},setMapObjectCenter:function(center,zoom){this.mapObject.SetCenterAndZoom(center,zoom);},getMapObjectCenter:function(){return this.mapObject.GetCenter();},getMapObjectZoom:function(){return this.mapObject.GetZoomLevel();},getMapObjectLonLatFromMapObjectPixel:function(moPixel){return this.mapObject.PixelToLatLong(moPixel.x,moPixel.y);},getMapObjectPixelFromMapObjectLonLat:function(moLonLat){return this.mapObject.LatLongToPixel(moLonLat);},getLongitudeFromMapObjectLonLat:function(moLonLat){return moLonLat.Longitude;},getLatitudeFromMapObjectLonLat:function(moLonLat){return moLonLat.Latitude;},getMapObjectLonLatFromLonLat:function(lon,lat){return new VELatLong(lat,lon);},getXFromMapObjectPixel:function(moPixel){return moPixel.x;},getYFromMapObjectPixel:function(moPixel){return moPixel.y;},getMapObjectPixelFromXY:function(x,y){return new Msn.VE.Pixel(x,y);},CLASS_NAME:"OpenLayers.Layer.VirtualEarth"});OpenLayers.Layer.Yahoo=OpenLayers.Class.create();OpenLayers.Layer.Yahoo.prototype=OpenLayers.Class.inherit(OpenLayers.Layer.EventPane,OpenLayers.Layer.FixedZoomLevels,{MIN_ZOOM_LEVEL:0,MAX_ZOOM_LEVEL:15,RESOLUTIONS:[1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125],type:null,initialize:function(name,options){OpenLayers.Layer.EventPane.prototype.initialize.apply(this,arguments);OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,arguments);},loadMapObject:function(){try{this.mapObject=new YMap(this.div,this.type);}catch(e){}},setMap:function(map){OpenLayers.Layer.EventPane.prototype.setMap.apply(this,arguments);this.map.events.register("moveend",this,this.fixYahooEventPane);},fixYahooEventPane:function(){var yahooEventPane=$("ygddfdiv");if(yahooEventPane!=null){if(yahooEventPane.parentNode!=null)
yahooEventPane.parentNode.removeChild(yahooEventPane);this.map.events.unregister("moveend",this,this.fixYahooEventPane);}},getWarningHTML:function(){var html="";html+="The Yahoo Layer was unable to load correctly.<br>";html+="<br>";html+="To get rid of this message, select a new BaseLayer "
html+="in the layer switcher in the upper-right corner.<br>";html+="<br>";html+="Most likely, this is because the Yahoo library";html+=" script was either not correctly included.<br>";html+="<br>";html+="Developers: For help getting this working correctly, ";html+="<a href='http://trac.openlayers.org/wiki/Yahoo' "
html+="target='_blank'>";html+="click here";html+="</a>";return html;},getOLZoomFromMapObjectZoom:function(moZoom){var zoom=null;if(moZoom!=null){zoom=OpenLayers.Layer.FixedZoomLevels.prototype.getOLZoomFromMapObjectZoom.apply(this,[moZoom]);zoom=18-zoom;}
return zoom;},getMapObjectZoomFromOLZoom:function(olZoom){var zoom=null;if(olZoom!=null){zoom=OpenLayers.Layer.FixedZoomLevels.prototype.getMapObjectZoomFromOLZoom.apply(this,[olZoom]);zoom=18-zoom;}
return zoom;},setMapObjectCenter:function(center,zoom){this.mapObject.drawZoomAndCenter(center,zoom);},getMapObjectCenter:function(){return this.mapObject.getCenterLatLon();},getMapObjectZoom:function(){return this.mapObject.getZoomLevel();},getMapObjectLonLatFromMapObjectPixel:function(moPixel){return this.mapObject.convertXYLatLon(moPixel);},getMapObjectPixelFromMapObjectLonLat:function(moLonLat){return this.mapObject.convertLatLonXY(moLonLat);},getLongitudeFromMapObjectLonLat:function(moLonLat){return moLonLat.Lon;},getLatitudeFromMapObjectLonLat:function(moLonLat){return moLonLat.Lat;},getMapObjectLonLatFromLonLat:function(lon,lat){return new YGeoPoint(lat,lon);},getXFromMapObjectPixel:function(moPixel){return moPixel.x;},getYFromMapObjectPixel:function(moPixel){return moPixel.y;},getMapObjectPixelFromXY:function(x,y){return new YCoordPoint(x,y);},CLASS_NAME:"OpenLayers.Layer.Yahoo"});OpenLayers.Popup.AnchoredBubble=OpenLayers.Class.create();OpenLayers.Popup.AnchoredBubble.CORNER_SIZE=5;OpenLayers.Popup.AnchoredBubble.prototype=OpenLayers.Class.inherit(OpenLayers.Popup.Anchored,{rounded:false,initialize:function(id,lonlat,size,contentHTML,anchor,closeBox){OpenLayers.Popup.Anchored.prototype.initialize.apply(this,arguments);},draw:function(px){OpenLayers.Popup.Anchored.prototype.draw.apply(this,arguments);this.setContentHTML();this.setRicoCorners(!this.rounded);this.rounded=true;this.setBackgroundColor();this.setOpacity();return this.div;},setSize:function(size){OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments);if(this.contentDiv!=null){var contentSize=this.size.clone();contentSize.h-=(2*OpenLayers.Popup.AnchoredBubble.CORNER_SIZE);contentSize.h-=(2*this.padding);this.contentDiv.style.height=contentSize.h+"px";this.setRicoCorners(!this.rounded);this.rounded=true;}},setBackgroundColor:function(color){if(color!=undefined){this.backgroundColor=color;}
if(this.div!=null){if(this.contentDiv!=null){this.div.style.background="transparent";Rico.Corner.changeColor(this.contentDiv,this.backgroundColor);}}},setOpacity:function(opacity){if(opacity!=undefined){this.opacity=opacity;}
if(this.div!=null){if(this.contentDiv!=null){Rico.Corner.changeOpacity(this.contentDiv,this.opacity);}}},setBorder:function(border){this.border=0;},setRicoCorners:function(firstTime){var corners=this.getCornersToRound(this.relativePosition);var options={corners:corners,color:this.backgroundColor,bgColor:"transparent",blend:false};if(firstTime){Rico.Corner.round(this.div,options);}else{Rico.Corner.reRound(this.contentDiv,options);this.setBackgroundColor();this.setOpacity();}},getCornersToRound:function(){var corners=['tl','tr','bl','br'];var corner=OpenLayers.Bounds.oppositeQuadrant(this.relativePosition);OpenLayers.Util.removeItem(corners,corner);return corners.join(" ");},CLASS_NAME:"OpenLayers.Popup.AnchoredBubble"});OpenLayers.Geometry.LineSegment=OpenLayers.Class.create();OpenLayers.Geometry.LineSegment.prototype=OpenLayers.Class.inherit(OpenLayers.Geometry.LineString,{initialize:function(point1,point2){arguments=[[point1,point2]]
OpenLayers.Geometry.LineString.prototype.initialize.apply(this,arguments);},clone:function(){return new OpenLayers.Geometry.LineSegment(this.path);},CLASS_NAME:"OpenLayers.Geometry.LineSegment"});OpenLayers.Geometry.LinearRing=OpenLayers.Class.create();OpenLayers.Geometry.LinearRing.prototype=OpenLayers.Class.inherit(OpenLayers.Geometry.LineString,{initialize:function(points){OpenLayers.Geometry.LineString.prototype.initialize.apply(this,arguments);},addPoint:function(){this.path.pop();OpenLayers.Geometry.LineString.prototype.addPoint.apply(this,arguments);this.path.push(this.path[0]);},removePoint:function(){this.path.pop();OpenLayers.Geometry.LineString.prototype.removePoint.apply(this,arguments);this.path.push(this.path[0]);},toString:function(){return this.path.toString();},CLASS_NAME:"OpenLayers.Geometry.LinearRing"});OpenLayers.Layer.KaMap=OpenLayers.Class.create();OpenLayers.Layer.KaMap.prototype=OpenLayers.Class.inherit(OpenLayers.Layer.Grid,{isBaseLayer:true,units:null,resolution:OpenLayers.DOTS_PER_INCH,DEFAULT_PARAMS:{i:'jpeg',map:''},initialize:function(name,url,params,options){var newArguments=new Array();newArguments.push(name,url,params,options);OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);this.params=(params?params:{});if(params){OpenLayers.Util.applyDefaults(this.params,this.DEFAULT_PARAMS);}},getURL:function(bounds){var mapRes=this.map.getResolution();var scale=Math.round((this.map.getScale()*10000))/10000;var cellSize=new OpenLayers.Size(mapRes*this.tileSize.w,mapRes*this.tileSize.h);var pX=Math.round(((bounds.left)/cellSize.w)*this.tileSize.w);var pY=-Math.round(((bounds.top)/cellSize.h)*this.tileSize.h);return this.getFullRequestString({t:pY,l:pX,s:scale});},addTile:function(bounds,position){var url=this.getURL(bounds);return new OpenLayers.Tile.Image(this,position,bounds,url,this.tileSize);},_initTiles:function(){var viewSize=this.map.getSize();var bounds=this.map.getExtent();var extent=this.map.getMaxExtent();var resolution=this.map.getResolution();var tilelon=resolution*this.tileSize.w;var tilelat=resolution*this.tileSize.h;var offsetlon=bounds.left;var tilecol=Math.floor(offsetlon/tilelon);var tilecolremain=offsetlon/tilelon-tilecol;var tileoffsetx=-tilecolremain*this.tileSize.w;var tileoffsetlon=tilecol*tilelon;var offsetlat=bounds.top;var tilerow=Math.ceil(offsetlat/tilelat);var tilerowremain=tilerow-offsetlat/tilelat;var tileoffsety=-(tilerowremain+1)*this.tileSize.h;var tileoffsetlat=tilerow*tilelat;tileoffsetx=Math.round(tileoffsetx);tileoffsety=Math.round(tileoffsety);this.origin=new OpenLayers.Pixel(tileoffsetx,tileoffsety);var startX=tileoffsetx;var startLon=tileoffsetlon;var rowidx=0;do{var row;row=this.grid[rowidx++];if(!row){row=new Array();this.grid.push(row);}
tileoffsetlon=startLon;tileoffsetx=startX;var colidx=0;do{var tileBounds=new OpenLayers.Bounds(tileoffsetlon,tileoffsetlat,tileoffsetlon+tilelon,tileoffsetlat+tilelat);var x=tileoffsetx;x-=parseInt(this.map.layerContainerDiv.style.left);var y=tileoffsety;y-=parseInt(this.map.layerContainerDiv.style.top);var px=new OpenLayers.Pixel(x,y);var tile;tile=row[colidx++];if(!tile){tile=this.addTile(tileBounds,px);row.push(tile);}else{tile.moveTo(tileBounds,px,false);}
tileoffsetlon+=tilelon;tileoffsetx+=this.tileSize.w;}while(tileoffsetlon<=bounds.right+tilelon*this.buffer)
tileoffsetlat-=tilelat;tileoffsety+=this.tileSize.h;}while(tileoffsetlat>=bounds.bottom-tilelat*this.buffer)
this.spiralTileLoad();},CLASS_NAME:"OpenLayers.Layer.KaMap"});OpenLayers.Layer.MapServer=OpenLayers.Class.create();OpenLayers.Layer.MapServer.prototype=OpenLayers.Class.inherit(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{mode:"map",map_imagetype:"png"},initialize:function(name,url,params){var newArguments=new Array();params=OpenLayers.Util.upperCaseObject(params);newArguments.push(name,url,params);OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);if(arguments.length>0){OpenLayers.Util.applyDefaults(this.params,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS));}},isBaseLayer:function(){return(this.params.TRANSPARENT!='true');},clone:function(name,params){var mergedParams={};OpenLayers.Util.extend(mergedParams,this.params);OpenLayers.Util.extend(mergedParams,params);var obj=new OpenLayers.Layer.MapServer(name,this.url,mergedParams);obj.setTileSize(this.tileSize);return obj;},addTile:function(bounds,position){var url=this.getURL(bounds);return new OpenLayers.Tile.Image(this,position,bounds,url,this.tileSize);},getURL:function(bounds){var url=this.getFullRequestString({mapext:bounds.toBBOX().replace(/,/g,"+"),imgext:bounds.toBBOX().replace(/,/g,"+"),map_size:this.tileSize.w+'+'+this.tileSize.h,imgx:this.tileSize.w/2,imgy:this.tileSize.h/2,imgxy:this.tileSize.w+"+"+this.tileSize.h});return url;},CLASS_NAME:"OpenLayers.Layer.MapServer"});OpenLayers.Layer.WFS=OpenLayers.Class.create();OpenLayers.Layer.WFS.prototype=OpenLayers.Class.inherit(OpenLayers.Layer.Vector,{isBaseLayer:false,ratio:2,DEFAULT_PARAMS:{service:"WFS",version:"1.0.0",request:"GetFeature"},tileClass:OpenLayers.Tile.WFS,initialize:function(name,url,params,options){var newArguments=new Array()
newArguments.push(name,options);OpenLayers.Layer.Vector.prototype.initialize.apply(this,newArguments);this.params=params;OpenLayers.Util.applyDefaults(this.params,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS));this.url=url;},destroy:function(){OpenLayers.Layer.Vector.prototype.destroy.apply(this,arguments);},setMap:function(map){OpenLayers.Layer.Vector.prototype.setMap.apply(this,arguments);},moveTo:function(bounds,zoomChanged,dragging){OpenLayers.Layer.Vector.prototype.moveTo.apply(this,arguments);if(dragging){return false;}
if(zoomChanged){this.renderer.clearRoot();}
if(this.map.getZoom()<this.params.maxZoomLevel){return null;};if(bounds==null){bounds=this.map.getExtent();}
var firstRendering=(this.tile==null);var outOfBounds=(!firstRendering&&!this.tile.bounds.containsBounds(bounds));if(zoomChanged||firstRendering||(!dragging&&outOfBounds)){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 tileSize=this.map.getSize();tileSize.w=tileSize.w*this.ratio;tileSize.h=tileSize.h*this.ratio;var ul=new OpenLayers.LonLat(tileBounds.left,tileBounds.top);var pos=this.map.getLayerPxFromLonLat(ul);var url=this.getFullRequestString();var params={BBOX:tileBounds.toBBOX()};url+="&"+OpenLayers.Util.getParameterString(params);if(!this.tile){this.tile=new this.tileClass(this,pos,tileBounds,url,tileSize);this.tile.draw();}else{OpenLayers.Util.clearArray(this.features);this.renderer.clearRoot();this.tile=null;this.tile=new this.tileClass(this,pos,tileBounds,url,tileSize);this.tile.draw();}}},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.WFS(this.name,this.url,this.params,this.options);}
obj=OpenLayers.Layer.Vector.prototype.clone.apply(this,[obj]);return obj;},getFullRequestString:function(newParams){var projection=this.map.getProjection();this.params.SRS=(projection=="none")?null:projection;return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments);},commitSuccess:function(request){var response=request.responseText;if(response.indexOf('SUCCESS')!=-1){alert('WFS Transaction : SUCCESS');}else if(response.indexOf('FAILED')!=-1||response.indexOf('Exception')!=-1){alert('WFS Transaction : FAILED');}},commitFailure:function(request){},CLASS_NAME:"OpenLayers.Layer.WFS"});OpenLayers.Layer.WMS=OpenLayers.Class.create();OpenLayers.Layer.WMS.prototype=OpenLayers.Class.inherit(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{service:"WMS",version:"1.1.1",request:"GetMap",styles:"",exceptions:"application/vnd.ogc.se_inimage",format:"image/jpeg"},reproject:true,initialize:function(name,url,params,options){var newArguments=new Array();params=OpenLayers.Util.upperCaseObject(params);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(options==null||options.isBaseLayer==null){this.isBaseLayer=((this.params.TRANSPARENT!="true")&&(this.params.TRANSPARENT!=true));}},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.WMS(this.name,this.url,this.params,this.options);}
obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj;},getURL:function(bounds){return this.getFullRequestString({BBOX:bounds.toBBOX(),WIDTH:this.tileSize.w,HEIGHT:this.tileSize.h});},addTile:function(bounds,position){url=this.getURL(bounds);return new OpenLayers.Tile.Image(this,position,bounds,url,this.tileSize);},mergeNewParams:function(newParams){var upperParams=OpenLayers.Util.upperCaseObject(newParams);var newArguments=[upperParams];OpenLayers.Layer.Grid.prototype.mergeNewParams.apply(this,newArguments);if(this.map!=null){this._initTiles();}},getFullRequestString:function(newParams){var projection=this.map.getProjection();this.params.SRS=(projection=="none")?null:projection;return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments);},CLASS_NAME:"OpenLayers.Layer.WMS"});OpenLayers.Layer.WorldWind=OpenLayers.Class.create();OpenLayers.Layer.WorldWind.prototype=OpenLayers.Class.inherit(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{},isBaseLayer:true,lzd:null,zoomLevels:null,initialize:function(name,url,lzd,zoomLevels,params,options){this.lzd=lzd;this.zoomLevels=zoomLevels;var newArguments=new Array();newArguments.push(name,url,params,options);OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);this.params=(params?params:{});if(params){OpenLayers.Util.applyDefaults(this.params,this.DEFAULT_PARAMS);}},addTile:function(bounds,position){if(this.map.getResolution()<=(this.lzd/512)&&this.getZoom()<=this.zoomLevels){var url=this.getURL(bounds);return new OpenLayers.Tile.Image(this,position,bounds,url,this.tileSize);}else{return new OpenLayers.Tile.Image(this,position,bounds,OpenLayers.Util.getImagesLocation()+"blank.gif",this.tileSize);}},getZoom:function(){var zoom=this.map.getZoom();var extent=this.map.getMaxExtent();zoom=zoom-Math.log(this.maxResolution/(this.lzd/512))/Math.log(2);return zoom;},getURL:function(bounds){var zoom=this.getZoom();var extent=this.map.getMaxExtent();var deg=this.lzd/Math.pow(2,this.getZoom());var x=Math.floor((bounds.left-extent.left)/deg);var y=Math.floor((bounds.bottom-extent.bottom)/deg);if(this.map.getResolution()<=(this.lzd/512)&&this.getZoom()<=this.zoomLevels){return this.getFullRequestString({L:zoom,X:x,Y:y});}else{return OpenLayers.Util.getImagesLocation()+"blank.gif";}},CLASS_NAME:"OpenLayers.Layer.WorldWind"});OpenLayers.Layer.WMS.Untiled=OpenLayers.Class.create();OpenLayers.Layer.WMS.Untiled.prototype=OpenLayers.Class.inherit(OpenLayers.Layer.HTTPRequest,{DEFAULT_PARAMS:{service:"WMS",version:"1.1.1",request:"GetMap",styles:"",exceptions:"application/vnd.ogc.se_inimage",format:"image/jpeg"},reproject:true,ratio:2,tile:null,initialize:function(name,url,params,options){var newArguments=new Array();params=OpenLayers.Util.upperCaseObject(params);newArguments.push(name,url,params,options);OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,newArguments);OpenLayers.Util.applyDefaults(this.params,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS));if((options==null)||(options.isBaseLayer==null)){this.isBaseLayer=((this.params.TRANSPARENT!="true")&&(this.params.TRANSPARENT!=true));}},destroy:function(){this.tile.destroy();this.tile=null;OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.WMS.Untiled(this.name,this.url,this.params,this.options);}
obj=OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this,[obj]);return obj;},setMap:function(map){OpenLayers.Layer.HTTPRequest.prototype.setMap.apply(this,arguments);},moveTo:function(bounds,zoomChanged,dragging){OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this,arguments);if(bounds==null){bounds=this.map.getExtent();}
var firstRendering=(this.tile==null);var outOfBounds=(!firstRendering&&!this.tile.bounds.containsBounds(bounds));if(zoomChanged||firstRendering||(!dragging&&outOfBounds)){if(this.tile){OpenLayers.Util.clearArray(this.tile);}
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 tileSize=this.map.getSize();tileSize.w=tileSize.w*this.ratio;tileSize.h=tileSize.h*this.ratio;var url=this.getURL(tileBounds);var ul=new OpenLayers.LonLat(tileBounds.left,tileBounds.top);var pos=this.map.getLayerPxFromLonLat(ul);if(!this.tile){this.tile=new OpenLayers.Tile.Image(this,pos,tileBounds,url,tileSize);this.tile.draw();}else{this.tile.moveTo(tileBounds,pos);}}},getURL:function(bounds){var tileSize=this.map.getSize();tileSize.w=tileSize.w*this.ratio;tileSize.h=tileSize.h*this.ratio;return this.getFullRequestString({'BBOX':bounds.toBBOX(),'WIDTH':tileSize.w,'HEIGHT':tileSize.h});},setUrl:function(newUrl){OpenLayers.Layer.HTTPRequest.prototype.setUrl.apply(this,arguments);this.moveTo();},mergeNewParams:function(newParams){var upperParams=OpenLayers.Util.upperCaseObject(newParams);var newArguments=[upperParams];OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this,newArguments);this.moveTo();},getFullRequestString:function(newParams){var projection=this.map.getProjection();this.params.SRS=(projection=="none")?null:projection;return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments);},CLASS_NAME:"OpenLayers.Layer.WMS.Untiled"});
