OpenLayers={};OpenLayers.singleFile=true;
(function(){var a=typeof OpenLayers=="object"&&OpenLayers.singleFile;window.OpenLayers={_scriptName:!a?"lib/OpenLayers.js":"OpenLayers.js",_getScriptLocation:function(){for(var i="",h=new RegExp("(^|(.*?\\/))("+OpenLayers._scriptName+")(\\?|$)"),j=document.getElementsByTagName("script"),k=0,l=j.length;k<l;k++){var n=j[k].getAttribute("src");if(n)if(n=n.match(h)){i=n[1];break}}return i}};if(!a){a=new Array("OpenLayers/Util.js","OpenLayers/BaseTypes.js","OpenLayers/BaseTypes/Class.js","OpenLayers/BaseTypes/Bounds.js",
"OpenLayers/BaseTypes/Element.js","OpenLayers/BaseTypes/LonLat.js","OpenLayers/BaseTypes/Pixel.js","OpenLayers/BaseTypes/Size.js","OpenLayers/Console.js","OpenLayers/Tween.js","Rico/Corner.js","Rico/Color.js","OpenLayers/Ajax.js","OpenLayers/Events.js","OpenLayers/Request.js","OpenLayers/Request/XMLHttpRequest.js","OpenLayers/Projection.js","OpenLayers/Map.js","OpenLayers/Layer.js","OpenLayers/Icon.js","OpenLayers/Marker.js","OpenLayers/Marker/Box.js","OpenLayers/Popup.js","OpenLayers/Tile.js","OpenLayers/Tile/Image.js",
"OpenLayers/Tile/WFS.js","OpenLayers/Layer/Image.js","OpenLayers/Layer/SphericalMercator.js","OpenLayers/Layer/EventPane.js","OpenLayers/Layer/FixedZoomLevels.js","OpenLayers/Layer/Google.js","OpenLayers/Layer/VirtualEarth.js","OpenLayers/Layer/Yahoo.js","OpenLayers/Layer/HTTPRequest.js","OpenLayers/Layer/Grid.js","OpenLayers/Layer/MapGuide.js","OpenLayers/Layer/MapServer.js","OpenLayers/Layer/MapServer/Untiled.js","OpenLayers/Layer/KaMap.js","OpenLayers/Layer/KaMapCache.js","OpenLayers/Layer/MultiMap.js",
"OpenLayers/Layer/Markers.js","OpenLayers/Layer/Text.js","OpenLayers/Layer/WorldWind.js","OpenLayers/Layer/ArcGIS93Rest.js","OpenLayers/Layer/WMS.js","OpenLayers/Layer/WMS/Untiled.js","OpenLayers/Layer/ArcIMS.js","OpenLayers/Layer/GeoRSS.js","OpenLayers/Layer/Boxes.js","OpenLayers/Layer/XYZ.js","OpenLayers/Layer/TMS.js","OpenLayers/Layer/TileCache.js","OpenLayers/Popup/Anchored.js","OpenLayers/Popup/AnchoredBubble.js","OpenLayers/Popup/Framed.js","OpenLayers/Popup/FramedCloud.js","OpenLayers/Feature.js",
"OpenLayers/Feature/Vector.js","OpenLayers/Feature/WFS.js","OpenLayers/Handler.js","OpenLayers/Handler/Click.js","OpenLayers/Handler/Hover.js","OpenLayers/Handler/Point.js","OpenLayers/Handler/Path.js","OpenLayers/Handler/Polygon.js","OpenLayers/Handler/Feature.js","OpenLayers/Handler/Drag.js","OpenLayers/Handler/RegularPolygon.js","OpenLayers/Handler/Box.js","OpenLayers/Handler/MouseWheel.js","OpenLayers/Handler/Keyboard.js","OpenLayers/Control.js","OpenLayers/Control/Attribution.js","OpenLayers/Control/Button.js",
"OpenLayers/Control/ZoomBox.js","OpenLayers/Control/ZoomToMaxExtent.js","OpenLayers/Control/DragPan.js","OpenLayers/Control/Navigation.js","OpenLayers/Control/MouseDefaults.js","OpenLayers/Control/MousePosition.js","OpenLayers/Control/OverviewMap.js","OpenLayers/Control/KeyboardDefaults.js","OpenLayers/Control/PanZoom.js","OpenLayers/Control/PanZoomBar.js","OpenLayers/Control/ArgParser.js","OpenLayers/Control/Permalink.js","OpenLayers/Control/Scale.js","OpenLayers/Control/ScaleLine.js","OpenLayers/Control/Snapping.js",
"OpenLayers/Control/Split.js","OpenLayers/Control/LayerSwitcher.js","OpenLayers/Control/DrawFeature.js","OpenLayers/Control/DragFeature.js","OpenLayers/Control/ModifyFeature.js","OpenLayers/Control/Panel.js","OpenLayers/Control/SelectFeature.js","OpenLayers/Control/NavigationHistory.js","OpenLayers/Control/Measure.js","OpenLayers/Control/WMSGetFeatureInfo.js","OpenLayers/Geometry.js","OpenLayers/Geometry/Rectangle.js","OpenLayers/Geometry/Collection.js","OpenLayers/Geometry/Point.js","OpenLayers/Geometry/MultiPoint.js",
"OpenLayers/Geometry/Curve.js","OpenLayers/Geometry/LineString.js","OpenLayers/Geometry/LinearRing.js","OpenLayers/Geometry/Polygon.js","OpenLayers/Geometry/MultiLineString.js","OpenLayers/Geometry/MultiPolygon.js","OpenLayers/Geometry/Surface.js","OpenLayers/Renderer.js","OpenLayers/Renderer/Elements.js","OpenLayers/Renderer/SVG.js","OpenLayers/Renderer/Canvas.js","OpenLayers/Renderer/VML.js","OpenLayers/Layer/Vector.js","OpenLayers/Layer/Vector/RootContainer.js","OpenLayers/Strategy.js","OpenLayers/Strategy/Fixed.js",
"OpenLayers/Strategy/Cluster.js","OpenLayers/Strategy/Paging.js","OpenLayers/Strategy/BBOX.js","OpenLayers/Strategy/Save.js","OpenLayers/Protocol.js","OpenLayers/Protocol/HTTP.js","OpenLayers/Protocol/SQL.js","OpenLayers/Protocol/SQL/Gears.js","OpenLayers/Protocol/WFS.js","OpenLayers/Protocol/WFS/v1.js","OpenLayers/Protocol/WFS/v1_0_0.js","OpenLayers/Protocol/WFS/v1_1_0.js","OpenLayers/Layer/PointTrack.js","OpenLayers/Layer/GML.js","OpenLayers/Style.js","OpenLayers/StyleMap.js","OpenLayers/Rule.js",
"OpenLayers/Filter.js","OpenLayers/Filter/FeatureId.js","OpenLayers/Filter/Logical.js","OpenLayers/Filter/Comparison.js","OpenLayers/Filter/Spatial.js","OpenLayers/Format.js","OpenLayers/Format/XML.js","OpenLayers/Format/ArcXML.js","OpenLayers/Format/ArcXML/Features.js","OpenLayers/Format/GML.js","OpenLayers/Format/GML/Base.js","OpenLayers/Format/GML/v2.js","OpenLayers/Format/GML/v3.js","OpenLayers/Format/KML.js","OpenLayers/Format/GeoRSS.js","OpenLayers/Format/WFS.js","OpenLayers/Format/WFSCapabilities.js",
"OpenLayers/Format/WFSCapabilities/v1.js","OpenLayers/Format/WFSCapabilities/v1_0_0.js","OpenLayers/Format/WFSCapabilities/v1_1_0.js","OpenLayers/Format/WFSDescribeFeatureType.js","OpenLayers/Format/WMSDescribeLayer.js","OpenLayers/Format/WMSDescribeLayer/v1_1.js","OpenLayers/Format/WKT.js","OpenLayers/Format/OSM.js","OpenLayers/Format/GPX.js","OpenLayers/Format/Filter.js","OpenLayers/Format/Filter/v1.js","OpenLayers/Format/Filter/v1_0_0.js","OpenLayers/Format/Filter/v1_1_0.js","OpenLayers/Format/SLD.js",
"OpenLayers/Format/SLD/v1.js","OpenLayers/Format/SLD/v1_0_0.js","OpenLayers/Format/SLD/v1.js","OpenLayers/Format/WFST.js","OpenLayers/Format/WFST/v1.js","OpenLayers/Format/WFST/v1_0_0.js","OpenLayers/Format/WFST/v1_1_0.js","OpenLayers/Format/Text.js","OpenLayers/Format/JSON.js","OpenLayers/Format/GeoJSON.js","OpenLayers/Format/WMC.js","OpenLayers/Format/WMC/v1.js","OpenLayers/Format/WMC/v1_0_0.js","OpenLayers/Format/WMC/v1_1_0.js","OpenLayers/Format/WMSCapabilities.js","OpenLayers/Format/WMSCapabilities/v1_1.js",
"OpenLayers/Format/WMSCapabilities/v1_1_0.js","OpenLayers/Format/WMSCapabilities/v1_1_1.js","OpenLayers/Format/WMSGetFeatureInfo.js","OpenLayers/Layer/WFS.js","OpenLayers/Control/GetFeature.js","OpenLayers/Control/MouseToolbar.js","OpenLayers/Control/NavToolbar.js","OpenLayers/Control/PanPanel.js","OpenLayers/Control/Pan.js","OpenLayers/Control/ZoomIn.js","OpenLayers/Control/ZoomOut.js","OpenLayers/Control/ZoomPanel.js","OpenLayers/Control/EditingToolbar.js","OpenLayers/Lang.js","OpenLayers/Lang/en.js");
var b=navigator.userAgent;if(b=b.match("MSIE")||b.match("Safari"))var c=new Array(a.length);for(var d=OpenLayers._getScriptLocation()+"lib/",e=0,f=a.length;e<f;e++)if(b)c[e]="<script src='"+d+a[e]+"'><\/script>";else{var g=document.createElement("script");g.src=d+a[e];(document.getElementsByTagName("head").length?document.getElementsByTagName("head")[0]:document.body).appendChild(g)}b&&document.write(c.join(""))}})();OpenLayers.VERSION_NUMBER="OpenLayers 2.8 -- $Revision: 9492 $";
OpenLayers.Util={};OpenLayers.Util.getElement=function(){for(var a=[],b=0,c=arguments.length;b<c;b++){var d=arguments[b];if(typeof d=="string")d=document.getElementById(d);if(arguments.length==1)return d;a.push(d)}return a};if(typeof window.$==="undefined")window.$=OpenLayers.Util.getElement;
OpenLayers.Util.extend=function(a,b){a=a||{};if(b){for(var c in b){var d=b[c];if(d!==undefined)a[c]=d}if(!(typeof window.Event=="function"&&b instanceof window.Event)&&b.hasOwnProperty&&b.hasOwnProperty("toString"))a.toString=b.toString}return a};OpenLayers.Util.removeItem=function(a,b){for(var c=a.length-1;c>=0;c--)a[c]==b&&a.splice(c,1);return a};OpenLayers.Util.clearArray=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"array = []"}));a.length=0};
OpenLayers.Util.indexOf=function(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]==b)return c;return-1};OpenLayers.Util.modifyDOMElement=function(a,b,c,d,e,f,g,i){if(b)a.id=b;if(c){a.style.left=c.x+"px";a.style.top=c.y+"px"}if(d){a.style.width=d.w+"px";a.style.height=d.h+"px"}if(e)a.style.position=e;if(f)a.style.border=f;if(g)a.style.overflow=g;if(parseFloat(i)>=0&&parseFloat(i)<1){a.style.filter="alpha(opacity="+i*100+")";a.style.opacity=i}else if(parseFloat(i)==1){a.style.filter="";a.style.opacity=""}};
OpenLayers.Util.createDiv=function(a,b,c,d,e,f,g,i){var h=document.createElement("div");if(d)h.style.backgroundImage="url("+d+")";a||(a=OpenLayers.Util.createUniqueID("OpenLayersDiv"));e||(e="absolute");OpenLayers.Util.modifyDOMElement(h,a,b,c,e,f,g,i);return h};
OpenLayers.Util.createImage=function(a,b,c,d,e,f,g,i){var h=document.createElement("img");a||(a=OpenLayers.Util.createUniqueID("OpenLayersDiv"));e||(e="relative");OpenLayers.Util.modifyDOMElement(h,a,b,c,e,f,null,g);if(i){h.style.display="none";OpenLayers.Event.observe(h,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,h));OpenLayers.Event.observe(h,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,h))}h.style.alt=a;h.galleryImg="no";if(d)h.src=d;return h};
OpenLayers.Util.setOpacity=function(a,b){OpenLayers.Util.modifyDOMElement(a,null,null,null,null,null,null,b)};OpenLayers.Util.onImageLoad=function(){if(!this.viewRequestID||this.map&&this.viewRequestID==this.map.viewRequestID){this.style.backgroundColor="transparent";this.style.display=""}};OpenLayers.Util.onImageLoadErrorColor="pink";OpenLayers.IMAGE_RELOAD_ATTEMPTS=0;
OpenLayers.Util.onImageLoadError=function(){this._attempts=this._attempts?this._attempts+1:1;if(this._attempts<=OpenLayers.IMAGE_RELOAD_ATTEMPTS){var a=this.urls;if(a&&a instanceof Array&&a.length>1){var b=this.src.toString(),c,d;for(d=0;c=a[d];d++)if(b.indexOf(c)!=-1)break;var e=Math.floor(a.length*Math.random());e=a[e];for(d=0;e==c&&d++<4;){e=Math.floor(a.length*Math.random());e=a[e]}this.src=b.replace(c,e)}else this.src=this.src}else this.style.backgroundColor=OpenLayers.Util.onImageLoadErrorColor;
this.style.display=""};OpenLayers.Util.alphaHackNeeded=null;OpenLayers.Util.alphaHack=function(){if(OpenLayers.Util.alphaHackNeeded==null){var a=navigator.appVersion.split("MSIE");a=parseFloat(a[1]);var b=false;try{b=!!document.body.filters}catch(c){}OpenLayers.Util.alphaHackNeeded=b&&a>=5.5&&a<7}return OpenLayers.Util.alphaHackNeeded};
OpenLayers.Util.modifyAlphaImageDiv=function(a,b,c,d,e,f,g,i,h){OpenLayers.Util.modifyDOMElement(a,b,c,d,f,null,null,h);b=a.childNodes[0];if(e)b.src=e;OpenLayers.Util.modifyDOMElement(b,a.id+"_innerImage",null,d,"relative",g);if(OpenLayers.Util.alphaHack()){if(a.style.display!="none")a.style.display="inline-block";if(i==null)i="scale";a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+b.src+"', sizingMethod='"+i+"')";if(parseFloat(a.style.opacity)>=0&&parseFloat(a.style.opacity)<
1)a.style.filter+=" alpha(opacity="+a.style.opacity*100+")";b.style.filter="alpha(opacity=0)"}};
OpenLayers.Util.createAlphaImageDiv=function(a,b,c,d,e,f,g,i,h){var j=OpenLayers.Util.createDiv(),k=OpenLayers.Util.createImage(null,null,null,null,null,null,null,false);j.appendChild(k);if(h){k.style.display="none";OpenLayers.Event.observe(k,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,j));OpenLayers.Event.observe(k,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,j))}OpenLayers.Util.modifyAlphaImageDiv(j,a,b,c,d,e,f,g,i);return j};
OpenLayers.Util.upperCaseObject=function(a){var b={};for(var c in a)b[c.toUpperCase()]=a[c];return b};OpenLayers.Util.applyDefaults=function(a,b){a=a||{};var c=typeof window.Event=="function"&&b instanceof window.Event;for(var d in b)if(a[d]===undefined||!c&&b.hasOwnProperty&&b.hasOwnProperty(d)&&!a.hasOwnProperty(d))a[d]=b[d];if(!c&&b&&b.hasOwnProperty&&b.hasOwnProperty("toString")&&!a.hasOwnProperty("toString"))a.toString=b.toString;return a};
OpenLayers.Util.getParameterString=function(a){var b=[];for(var c in a){var d=a[c];if(d!=null&&typeof d!="function"){if(typeof d=="object"&&d.constructor==Array){for(var e=[],f=0,g=d.length;f<g;f++)e.push(encodeURIComponent(d[f]));d=e.join(",")}else d=encodeURIComponent(d);b.push(encodeURIComponent(c)+"="+d)}}return b.join("&")};OpenLayers.ImgPath="";OpenLayers.Util.getImagesLocation=function(){return OpenLayers.ImgPath||OpenLayers._getScriptLocation()+"img/"};
OpenLayers.Util.Try=function(){for(var a=null,b=0,c=arguments.length;b<c;b++){var d=arguments[b];try{a=d();break}catch(e){}}return a};OpenLayers.Util.getNodes=function(a,b){return OpenLayers.Util.Try(function(){return OpenLayers.Util._getNodes(a.documentElement.childNodes,b)},function(){return OpenLayers.Util._getNodes(a.childNodes,b)})};OpenLayers.Util._getNodes=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)a[d].nodeName==b&&c.push(a[d]);return c};
OpenLayers.Util.getTagText=function(a,b,c){if((a=OpenLayers.Util.getNodes(a,b))&&a.length>0){c||(c=0);if(a[c].childNodes.length>1)return a.childNodes[1].nodeValue;else if(a[c].childNodes.length==1)return a[c].firstChild.nodeValue}else return""};OpenLayers.Util.getXmlNodeValue=function(a){var b=null;OpenLayers.Util.Try(function(){b=a.text;if(!b)b=a.textContent;if(!b)b=a.firstChild.nodeValue},function(){b=a.textContent});return b};
OpenLayers.Util.mouseLeft=function(a,b){for(a=a.relatedTarget?a.relatedTarget:a.toElement;a!=b&&a!=null;)a=a.parentNode;return a!=b};OpenLayers.Util.DEFAULT_PRECISION=14;OpenLayers.Util.toFloat=function(a,b){if(b==null)b=OpenLayers.Util.DEFAULT_PRECISION;return a=b==0?parseFloat(a):parseFloat(parseFloat(a).toPrecision(b))};OpenLayers.Util.rad=function(a){return a*Math.PI/180};
OpenLayers.Util.distVincenty=function(a,b){var c=1/298.257223563,d=OpenLayers.Util.rad(b.lon-a.lon);a=Math.atan((1-c)*Math.tan(OpenLayers.Util.rad(a.lat)));var e=Math.atan((1-c)*Math.tan(OpenLayers.Util.rad(b.lat)));b=Math.sin(a);a=Math.cos(a);var f=Math.sin(e);e=Math.cos(e);for(var g=d,i=2*Math.PI,h=20;Math.abs(g-i)>1.0E-12&&--h>0;){var j=Math.sin(g),k=Math.cos(g),l=Math.sqrt(e*j*e*j+(a*f-b*e*k)*(a*f-b*e*k));if(l==0)return 0;k=b*f+a*e*k;var n=Math.atan2(l,k),m=Math.asin(a*e*j/l),o=Math.cos(m)*Math.cos(m);
j=k-2*b*f/o;var p=c/16*o*(4+c*(4-3*o));i=g;g=d+(1-p)*c*Math.sin(m)*(n+p*l*(j+p*k*(-1+2*j*j)))}if(h==0)return NaN;c=o*2.723316066819453E11/4.0408299984087055E13;d=c/1024*(256+c*(-128+c*(74-47*c)));return(6356752.3142*(1+c/16384*(4096+c*(-768+c*(320-175*c))))*(n-d*l*(j+d/4*(k*(-1+2*j*j)-d/6*j*(-3+4*l*l)*(-3+4*j*j))))).toFixed(3)/1E3};
OpenLayers.Util.getParameters=function(a){a=a||window.location.href;var b="";if(OpenLayers.String.contains(a,"?")){b=a.indexOf("?")+1;var c=OpenLayers.String.contains(a,"#")?a.indexOf("#"):a.length;b=a.substring(b,c)}a={};b=b.split(/[&;]/);c=0;for(var d=b.length;c<d;++c){var e=b[c].split("=");if(e[0]){var f=decodeURIComponent(e[0]);e=e[1]||"";e=e.split(",");for(var g=0,i=e.length;g<i;g++)e[g]=decodeURIComponent(e[g]);if(e.length==1)e=e[0];a[f]=e}}return a};
OpenLayers.Util.getArgs=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Util.getParameters"}));return OpenLayers.Util.getParameters(a)};OpenLayers.Util.lastSeqID=0;OpenLayers.Util.createUniqueID=function(a){if(a==null)a="id_";OpenLayers.Util.lastSeqID+=1;return a+OpenLayers.Util.lastSeqID};OpenLayers.INCHES_PER_UNIT={inches:1,ft:12,mi:63360,m:39.3701,km:39370.1,dd:4374754,yd:36};OpenLayers.INCHES_PER_UNIT["in"]=OpenLayers.INCHES_PER_UNIT.inches;
OpenLayers.INCHES_PER_UNIT.degrees=OpenLayers.INCHES_PER_UNIT.dd;OpenLayers.INCHES_PER_UNIT.nmi=1852*OpenLayers.INCHES_PER_UNIT.m;OpenLayers.METERS_PER_INCH=0.0254000508001016;
OpenLayers.Util.extend(OpenLayers.INCHES_PER_UNIT,{Inch:OpenLayers.INCHES_PER_UNIT.inches,Meter:1/OpenLayers.METERS_PER_INCH,Foot:0.3048006096012192/OpenLayers.METERS_PER_INCH,IFoot:0.3048/OpenLayers.METERS_PER_INCH,ClarkeFoot:0.3047972651151/OpenLayers.METERS_PER_INCH,SearsFoot:0.30479947153867626/OpenLayers.METERS_PER_INCH,GoldCoastFoot:0.3047997101815088/OpenLayers.METERS_PER_INCH,IInch:0.0254/OpenLayers.METERS_PER_INCH,MicroInch:2.54E-5/OpenLayers.METERS_PER_INCH,Mil:2.54E-8/OpenLayers.METERS_PER_INCH,
Centimeter:0.01/OpenLayers.METERS_PER_INCH,Kilometer:1E3/OpenLayers.METERS_PER_INCH,Yard:0.9144018288036576/OpenLayers.METERS_PER_INCH,SearsYard:0.914398414616029/OpenLayers.METERS_PER_INCH,IndianYard:0.9143985307444408/OpenLayers.METERS_PER_INCH,IndianYd37:0.91439523/OpenLayers.METERS_PER_INCH,IndianYd62:0.9143988/OpenLayers.METERS_PER_INCH,IndianYd75:0.9143985/OpenLayers.METERS_PER_INCH,IndianFoot:0.30479951/OpenLayers.METERS_PER_INCH,IndianFt37:0.30479841/OpenLayers.METERS_PER_INCH,IndianFt62:0.3047996/
OpenLayers.METERS_PER_INCH,IndianFt75:0.3047995/OpenLayers.METERS_PER_INCH,Mile:1609.3472186944373/OpenLayers.METERS_PER_INCH,IYard:0.9144/OpenLayers.METERS_PER_INCH,IMile:1609.344/OpenLayers.METERS_PER_INCH,NautM:1852/OpenLayers.METERS_PER_INCH,"Lat-66":110943.31648893273/OpenLayers.METERS_PER_INCH,"Lat-83":110946.25736872235/OpenLayers.METERS_PER_INCH,Decimeter:0.1/OpenLayers.METERS_PER_INCH,Millimeter:0.0010/OpenLayers.METERS_PER_INCH,Dekameter:10/OpenLayers.METERS_PER_INCH,Decameter:10/OpenLayers.METERS_PER_INCH,
Hectometer:100/OpenLayers.METERS_PER_INCH,GermanMeter:1.0000135965/OpenLayers.METERS_PER_INCH,CaGrid:0.999738/OpenLayers.METERS_PER_INCH,ClarkeChain:20.1166194976/OpenLayers.METERS_PER_INCH,GunterChain:20.11684023368047/OpenLayers.METERS_PER_INCH,BenoitChain:20.116782494375872/OpenLayers.METERS_PER_INCH,SearsChain:20.11676512155/OpenLayers.METERS_PER_INCH,ClarkeLink:0.201166194976/OpenLayers.METERS_PER_INCH,GunterLink:0.2011684023368047/OpenLayers.METERS_PER_INCH,BenoitLink:0.20116782494375873/OpenLayers.METERS_PER_INCH,
SearsLink:0.2011676512155/OpenLayers.METERS_PER_INCH,Rod:5.02921005842012/OpenLayers.METERS_PER_INCH,IntnlChain:20.1168/OpenLayers.METERS_PER_INCH,IntnlLink:0.201168/OpenLayers.METERS_PER_INCH,Perch:5.02921005842012/OpenLayers.METERS_PER_INCH,Pole:5.02921005842012/OpenLayers.METERS_PER_INCH,Furlong:201.1684023368046/OpenLayers.METERS_PER_INCH,Rood:3.778266898/OpenLayers.METERS_PER_INCH,CapeFoot:0.3047972615/OpenLayers.METERS_PER_INCH,Brealey:375/OpenLayers.METERS_PER_INCH,ModAmFt:0.304812252984506/
OpenLayers.METERS_PER_INCH,Fathom:1.8288/OpenLayers.METERS_PER_INCH,"NautM-UK":1853.184/OpenLayers.METERS_PER_INCH,"50kilometers":5E4/OpenLayers.METERS_PER_INCH,"150kilometers":15E4/OpenLayers.METERS_PER_INCH});
OpenLayers.Util.extend(OpenLayers.INCHES_PER_UNIT,{mm:OpenLayers.INCHES_PER_UNIT.Meter/1E3,cm:OpenLayers.INCHES_PER_UNIT.Meter/100,dm:OpenLayers.INCHES_PER_UNIT.Meter*100,km:OpenLayers.INCHES_PER_UNIT.Meter*1E3,kmi:OpenLayers.INCHES_PER_UNIT.nmi,fath:OpenLayers.INCHES_PER_UNIT.Fathom,ch:OpenLayers.INCHES_PER_UNIT.IntnlChain,link:OpenLayers.INCHES_PER_UNIT.IntnlLink,"us-in":OpenLayers.INCHES_PER_UNIT.inches,"us-ft":OpenLayers.INCHES_PER_UNIT.Foot,"us-yd":OpenLayers.INCHES_PER_UNIT.Yard,"us-ch":OpenLayers.INCHES_PER_UNIT.GunterChain,
"us-mi":OpenLayers.INCHES_PER_UNIT.Mile,"ind-yd":OpenLayers.INCHES_PER_UNIT.IndianYd37,"ind-ft":OpenLayers.INCHES_PER_UNIT.IndianFt37,"ind-ch":20.11669506/OpenLayers.METERS_PER_INCH});OpenLayers.DOTS_PER_INCH=72;OpenLayers.Util.normalizeScale=function(a){return a>1?1/a:a};OpenLayers.Util.getResolutionFromScale=function(a,b){if(b==null)b="degrees";return 1/(OpenLayers.Util.normalizeScale(a)*OpenLayers.INCHES_PER_UNIT[b]*OpenLayers.DOTS_PER_INCH)};
OpenLayers.Util.getScaleFromResolution=function(a,b){if(b==null)b="degrees";return a*OpenLayers.INCHES_PER_UNIT[b]*OpenLayers.DOTS_PER_INCH};OpenLayers.Util.safeStopPropagation=function(a){OpenLayers.Event.stop(a,true)};
OpenLayers.Util.pagePosition=function(a){for(var b=0,c=0,d=a,e=a;d;){if(d==document.body)if(OpenLayers.Element.getStyle(e,"position")=="absolute")break;b+=d.offsetTop||0;c+=d.offsetLeft||0;e=d;try{d=d.offsetParent}catch(f){OpenLayers.Console.error(OpenLayers.i18n("pagePositionFailed",{elemId:d.id}));break}}for(d=a;d;){b-=d.scrollTop||0;c-=d.scrollLeft||0;d=d.parentNode}return[c,b]};
OpenLayers.Util.isEquivalentUrl=function(a,b,c){c=c||{};OpenLayers.Util.applyDefaults(c,{ignoreCase:true,ignorePort80:true,ignoreHash:true});a=OpenLayers.Util.createUrlObject(a,c);b=OpenLayers.Util.createUrlObject(b,c);for(var d in a)if(d!=="args")if(a[d]!=b[d])return false;for(d in a.args){if(a.args[d]!=b.args[d])return false;delete b.args[d]}for(d in b.args)return false;return true};
OpenLayers.Util.createUrlObject=function(a,b){b=b||{};if(!/^\w+:\/\//.test(a)){var c=window.location,d=c.port?":"+c.port:"";d=c.protocol+"//"+c.host.split(":").shift()+d;if(a.indexOf("/")===0)a=d+a;else{c=c.pathname.split("/");c.pop();a=d+c.join("/")+"/"+a}}if(b.ignoreCase)a=a.toLowerCase();c=document.createElement("a");c.href=a;d={};d.host=c.host.split(":").shift();d.protocol=c.protocol;d.port=b.ignorePort80?c.port=="80"||c.port=="0"?"":c.port:c.port==""||c.port=="0"?"80":c.port;d.hash=b.ignoreHash||
c.hash==="#"?"":c.hash;b=c.search;if(!b){b=a.indexOf("?");b=b!=-1?a.substr(b):""}d.args=OpenLayers.Util.getParameters(b);d.pathname=c.pathname.charAt(0)=="/"?c.pathname:"/"+c.pathname;return d};OpenLayers.Util.removeTail=function(a){var b=null;b=a.indexOf("?");var c=a.indexOf("#");return b=b==-1?c!=-1?a.substr(0,c):a:c!=-1?a.substr(0,Math.min(b,c)):a.substr(0,b)};
OpenLayers.Util.getBrowserName=function(){var a="",b=navigator.userAgent.toLowerCase();if(b.indexOf("opera")!=-1)a="opera";else if(b.indexOf("msie")!=-1)a="msie";else if(b.indexOf("safari")!=-1)a="safari";else if(b.indexOf("mozilla")!=-1)a=b.indexOf("firefox")!=-1?"firefox":"mozilla";return a};
OpenLayers.Util.getRenderedDimensions=function(a,b,c){var d,e,f=document.createElement("div");f.style.visibility="hidden";var g=c&&c.containerElement?c.containerElement:document.body;if(b)if(b.w){d=b.w;f.style.width=d+"px"}else if(b.h){e=b.h;f.style.height=e+"px"}if(c&&c.displayClass)f.className=c.displayClass;b=document.createElement("div");b.innerHTML=a;b.style.overflow="visible";if(b.childNodes){a=0;for(c=b.childNodes.length;a<c;a++)if(b.childNodes[a].style)b.childNodes[a].style.overflow="visible"}f.appendChild(b);
g.appendChild(f);a=false;for(c=f.parentNode;c&&c.tagName.toLowerCase()!="body";){var i=OpenLayers.Element.getStyle(c,"position");if(i=="absolute"){a=true;break}else if(i&&i!="static")break;c=c.parentNode}if(!a)f.style.position="absolute";if(!d){d=parseInt(b.scrollWidth);f.style.width=d+"px"}e||(e=parseInt(b.scrollHeight));f.removeChild(b);g.removeChild(f);return new OpenLayers.Size(d,e)};
OpenLayers.Util.getScrollbarWidth=function(){var a=OpenLayers.Util._scrollbarWidth;if(a==null){var b=null,c=null;b=a=0;b=document.createElement("div");b.style.position="absolute";b.style.top="-1000px";b.style.left="-1000px";b.style.width="100px";b.style.height="50px";b.style.overflow="hidden";c=document.createElement("div");c.style.width="100%";c.style.height="200px";b.appendChild(c);document.body.appendChild(b);a=c.offsetWidth;b.style.overflow="scroll";b=c.offsetWidth;document.body.removeChild(document.body.lastChild);
OpenLayers.Util._scrollbarWidth=a-b;a=OpenLayers.Util._scrollbarWidth}return a};OpenLayers.Util.docPosition=function(a){var b=0,c=0;a=a;do{b+=a.offsetTop||0;c+=a.offsetLeft||0;if(a.offsetParent==document.body)if(OpenLayers.Element.getStyle(a,"position")=="absolute")break}while(a=a.offsetParent);return[c,b]};
OpenLayers.String={startsWith:function(a,b){return a.indexOf(b)==0},contains:function(a,b){return a.indexOf(b)!=-1},trim:function(a){return a.replace(/^\s\s*/,"").replace(/\s\s*$/,"")},camelize:function(a){a=a.split("-");for(var b=a[0],c=1,d=a.length;c<d;c++){var e=a[c];b+=e.charAt(0).toUpperCase()+e.substring(1)}return b},format:function(a,b,c){b||(b=window);return a.replace(OpenLayers.String.tokenRegEx,function(d,e){var f;d=e.split(/\.+/);for(e=0;e<d.length;e++){if(e==0)f=b;f=f[d[e]]}if(typeof f==
"function")f=c?f.apply(null,c):f();return typeof f=="undefined"?"undefined":f})},tokenRegEx:/\$\{([\w.]+?)\}/g,numberRegEx:/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,isNumeric:function(a){return OpenLayers.String.numberRegEx.test(a)},numericIf:function(a){return OpenLayers.String.isNumeric(a)?parseFloat(a):a}};
if(!String.prototype.startsWith)String.prototype.startsWith=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.String.startsWith"}));return OpenLayers.String.startsWith(this,a)};if(!String.prototype.contains)String.prototype.contains=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.String.contains"}));return OpenLayers.String.contains(this,a)};
if(!String.prototype.trim)String.prototype.trim=function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.String.trim"}));return OpenLayers.String.trim(this)};if(!String.prototype.camelize)String.prototype.camelize=function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.String.camelize"}));return OpenLayers.String.camelize(this)};
OpenLayers.Number={decimalSeparator:".",thousandsSeparator:",",limitSigDigs:function(a,b){var c=0;if(b>0)c=parseFloat(a.toPrecision(b));return c},format:function(a,b,c,d){b=typeof b!="undefined"?b:0;c=typeof c!="undefined"?c:OpenLayers.Number.thousandsSeparator;d=typeof d!="undefined"?d:OpenLayers.Number.decimalSeparator;if(b!=null)a=parseFloat(a.toFixed(b));var e=a.toString().split(".");if(e.length==1&&b==null)b=0;a=e[0];if(c)for(var f=/(-?[0-9]+)([0-9]{3})/;f.test(a);)a=a.replace(f,"$1"+c+"$2");
if(b==0)b=a;else{c=e.length>1?e[1]:"0";if(b!=null)c+=(new Array(b-c.length+1)).join("0");b=a+d+c}return b}};if(!Number.prototype.limitSigDigs)Number.prototype.limitSigDigs=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Number.limitSigDigs"}));return OpenLayers.Number.limitSigDigs(this,a)};
OpenLayers.Function={bind:function(a,b){var c=Array.prototype.slice.apply(arguments,[2]);return function(){var d=c.concat(Array.prototype.slice.apply(arguments,[0]));return a.apply(b,d)}},bindAsEventListener:function(a,b){return function(c){return a.call(b,c||window.event)}}};
if(!Function.prototype.bind)Function.prototype.bind=function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Function.bind"}));Array.prototype.unshift.apply(arguments,[this]);return OpenLayers.Function.bind.apply(null,arguments)};
if(!Function.prototype.bindAsEventListener)Function.prototype.bindAsEventListener=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Function.bindAsEventListener"}));return OpenLayers.Function.bindAsEventListener(this,a)};OpenLayers.Array={filter:function(a,b,c){var d=[];if(Array.prototype.filter)d=a.filter(b,c);else{var e=a.length;if(typeof b!="function")throw new TypeError;for(var f=0;f<e;f++)if(f in a){var g=a[f];b.call(c,g,f,a)&&d.push(g)}}return d}};
OpenLayers.Class=function(){for(var a=function(){arguments&&arguments[0]!=OpenLayers.Class.isPrototype&&this.initialize.apply(this,arguments)},b={},c,d=0,e=arguments.length;d<e;++d){if(typeof arguments[d]=="function"){if(d==0&&e>1){c=arguments[d].prototype.initialize;arguments[d].prototype.initialize=function(){};b=new arguments[d];if(c===undefined)delete arguments[d].prototype.initialize;else arguments[d].prototype.initialize=c}c=arguments[d].prototype}else c=arguments[d];OpenLayers.Util.extend(b,
c)}a.prototype=b;return a};OpenLayers.Class.isPrototype=function(){};OpenLayers.Class.create=function(){return function(){arguments&&arguments[0]!=OpenLayers.Class.isPrototype&&this.initialize.apply(this,arguments)}};OpenLayers.Class.inherit=function(){for(var a=new arguments[0](OpenLayers.Class.isPrototype),b=1,c=arguments.length;b<c;b++){if(typeof arguments[b]=="function")arguments[b]=new arguments[b](OpenLayers.Class.isPrototype);OpenLayers.Util.extend(a,arguments[b])}return a};
OpenLayers.Bounds=OpenLayers.Class({left:null,bottom:null,right:null,top:null,centerLonLat:null,initialize:function(a,b,c,d){if(a!=null)this.left=OpenLayers.Util.toFloat(a);if(b!=null)this.bottom=OpenLayers.Util.toFloat(b);if(c!=null)this.right=OpenLayers.Util.toFloat(c);if(d!=null)this.top=OpenLayers.Util.toFloat(d)},clone:function(){return new OpenLayers.Bounds(this.left,this.bottom,this.right,this.top)},equals:function(a){var b=false;if(a!=null)b=this.left==a.left&&this.right==a.right&&this.top==
a.top&&this.bottom==a.bottom;return b},toString:function(){return"left-bottom=("+this.left+","+this.bottom+") right-top=("+this.right+","+this.top+")"},toArray:function(){return[this.left,this.bottom,this.right,this.top]},toBBOX:function(a){if(a==null)a=6;a=Math.pow(10,a);return Math.round(this.left*a)/a+","+Math.round(this.bottom*a)/a+","+Math.round(this.right*a)/a+","+Math.round(this.top*a)/a},toGeometry:function(){return new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(this.left,
this.bottom),new OpenLayers.Geometry.Point(this.right,this.bottom),new OpenLayers.Geometry.Point(this.right,this.top),new OpenLayers.Geometry.Point(this.left,this.top)])])},getWidth:function(){return this.right-this.left},getHeight:function(){return this.top-this.bottom},getSize:function(){return new OpenLayers.Size(this.getWidth(),this.getHeight())},getCenterPixel:function(){return new OpenLayers.Pixel((this.left+this.right)/2,(this.bottom+this.top)/2)},getCenterLonLat:function(){if(!this.centerLonLat)this.centerLonLat=
new OpenLayers.LonLat((this.left+this.right)/2,(this.bottom+this.top)/2);return this.centerLonLat},scale:function(a,b){if(b==null)b=this.getCenterLonLat();var c;if(b.CLASS_NAME=="OpenLayers.LonLat"){c=b.lon;b=b.lat}else{c=b.x;b=b.y}return new OpenLayers.Bounds((this.left-c)*a+c,(this.bottom-b)*a+b,(this.right-c)*a+c,(this.top-b)*a+b)},add:function(a,b){if(a==null||b==null){a=OpenLayers.i18n("boundsAddError");OpenLayers.Console.error(a);return null}return new OpenLayers.Bounds(this.left+a,this.bottom+
b,this.right+a,this.top+b)},extend:function(a){var b=null;if(a){switch(a.CLASS_NAME){case "OpenLayers.LonLat":b=new OpenLayers.Bounds(a.lon,a.lat,a.lon,a.lat);break;case "OpenLayers.Geometry.Point":b=new OpenLayers.Bounds(a.x,a.y,a.x,a.y);break;case "OpenLayers.Bounds":b=a;break}if(b){this.centerLonLat=null;if(this.left==null||b.left<this.left)this.left=b.left;if(this.bottom==null||b.bottom<this.bottom)this.bottom=b.bottom;if(this.right==null||b.right>this.right)this.right=b.right;if(this.top==null||
b.top>this.top)this.top=b.top}}},containsLonLat:function(a,b){return this.contains(a.lon,a.lat,b)},containsPixel:function(a,b){return this.contains(a.x,a.y,b)},contains:function(a,b,c){if(c==null)c=true;if(a==null||b==null)return false;a=OpenLayers.Util.toFloat(a);b=OpenLayers.Util.toFloat(b);var d=false;return d=c?a>=this.left&&a<=this.right&&b>=this.bottom&&b<=this.top:a>this.left&&a<this.right&&b>this.bottom&&b<this.top},intersectsBounds:function(a,b){if(b==null)b=true;var c=false,d=this.left==
a.right||this.right==a.left||this.top==a.bottom||this.bottom==a.top;if(b||!d){b=a.top>=this.bottom&&a.top<=this.top||this.top>a.bottom&&this.top<a.top;c=a.left>=this.left&&a.left<=this.right||this.left>=a.left&&this.left<=a.right;d=a.right>=this.left&&a.right<=this.right||this.right>=a.left&&this.right<=a.right;c=(a.bottom>=this.bottom&&a.bottom<=this.top||this.bottom>=a.bottom&&this.bottom<=a.top||b)&&(c||d)}return c},containsBounds:function(a,b,c){if(b==null)b=false;if(c==null)c=true;var d=this.contains(a.left,
a.bottom,c),e=this.contains(a.right,a.bottom,c),f=this.contains(a.left,a.top,c);a=this.contains(a.right,a.top,c);return b?d||e||f||a:d&&e&&f&&a},determineQuadrant:function(a){var b="",c=this.getCenterLonLat();b+=a.lat<c.lat?"b":"t";b+=a.lon<c.lon?"l":"r";return b},transform:function(a,b){this.centerLonLat=null;var c=OpenLayers.Projection.transform({x:this.left,y:this.bottom},a,b),d=OpenLayers.Projection.transform({x:this.right,y:this.bottom},a,b),e=OpenLayers.Projection.transform({x:this.left,y:this.top},
a,b);a=OpenLayers.Projection.transform({x:this.right,y:this.top},a,b);this.left=Math.min(c.x,e.x);this.bottom=Math.min(c.y,d.y);this.right=Math.max(d.x,a.x);this.top=Math.max(e.y,a.y);return this},wrapDateLine:function(a,b){b=b||{};var c=b.leftTolerance||0;b=b.rightTolerance||0;var d=this.clone();if(a){for(;d.left<a.left&&d.right-b<=a.left;)d=d.add(a.getWidth(),0);for(;d.left+c>=a.right&&d.right>a.right;)d=d.add(-a.getWidth(),0)}return d},CLASS_NAME:"OpenLayers.Bounds"});
OpenLayers.Bounds.fromString=function(a){a=a.split(",");return OpenLayers.Bounds.fromArray(a)};OpenLayers.Bounds.fromArray=function(a){return new OpenLayers.Bounds(parseFloat(a[0]),parseFloat(a[1]),parseFloat(a[2]),parseFloat(a[3]))};OpenLayers.Bounds.fromSize=function(a){return new OpenLayers.Bounds(0,a.h,a.w,0)};OpenLayers.Bounds.oppositeQuadrant=function(a){var b="";b+=a.charAt(0)=="t"?"b":"t";b+=a.charAt(1)=="l"?"r":"l";return b};
OpenLayers.Element={visible:function(a){return OpenLayers.Util.getElement(a).style.display!="none"},toggle:function(){for(var a=0,b=arguments.length;a<b;a++){var c=OpenLayers.Util.getElement(arguments[a]),d=OpenLayers.Element.visible(c)?"hide":"show";OpenLayers.Element[d](c)}},hide:function(){for(var a=0,b=arguments.length;a<b;a++)OpenLayers.Util.getElement(arguments[a]).style.display="none"},show:function(){for(var a=0,b=arguments.length;a<b;a++)OpenLayers.Util.getElement(arguments[a]).style.display=
""},remove:function(a){a=OpenLayers.Util.getElement(a);a.parentNode.removeChild(a)},getHeight:function(a){a=OpenLayers.Util.getElement(a);return a.offsetHeight},getDimensions:function(a){a=OpenLayers.Util.getElement(a);if(OpenLayers.Element.getStyle(a,"display")!="none")return{width:a.offsetWidth,height:a.offsetHeight};var b=a.style,c=b.visibility,d=b.position;b.visibility="hidden";b.position="absolute";b.display="";var e=a.clientWidth;a=a.clientHeight;b.display="none";b.position=d;b.visibility=c;
return{width:e,height:a}},hasClass:function(a,b){a=a.className;return!!a&&(new RegExp("(^|\\s)"+b+"(\\s|$)")).test(a)},addClass:function(a,b){OpenLayers.Element.hasClass(a,b)||(a.className+=(a.className?" ":"")+b);return a},removeClass:function(a,b){var c=a.className;if(c)a.className=OpenLayers.String.trim(c.replace(new RegExp("(^|\\s+)"+b+"(\\s+|$)")," "));return a},toggleClass:function(a,b){OpenLayers.Element.hasClass(a,b)?OpenLayers.Element.removeClass(a,b):OpenLayers.Element.addClass(a,b);return a},
getStyle:function(a,b){a=OpenLayers.Util.getElement(a);var c=null;if(a&&a.style){c=a.style[OpenLayers.String.camelize(b)];if(!c)if(document.defaultView&&document.defaultView.getComputedStyle)c=(c=document.defaultView.getComputedStyle(a,null))?c.getPropertyValue(b):null;else if(a.currentStyle)c=a.currentStyle[OpenLayers.String.camelize(b)];var d=["left","top","right","bottom"];if(window.opera&&OpenLayers.Util.indexOf(d,b)!=-1&&OpenLayers.Element.getStyle(a,"position")=="static")c="auto"}return c==
"auto"?null:c}};
OpenLayers.LonLat=OpenLayers.Class({lon:0,lat:0,initialize:function(a,b){this.lon=OpenLayers.Util.toFloat(a);this.lat=OpenLayers.Util.toFloat(b)},toString:function(){return"lon="+this.lon+",lat="+this.lat},toShortString:function(){return this.lon+", "+this.lat},clone:function(){return new OpenLayers.LonLat(this.lon,this.lat)},add:function(a,b){if(a==null||b==null){a=OpenLayers.i18n("lonlatAddError");OpenLayers.Console.error(a);return null}return new OpenLayers.LonLat(this.lon+a,this.lat+b)},equals:function(a){var b=
false;if(a!=null)b=this.lon==a.lon&&this.lat==a.lat||isNaN(this.lon)&&isNaN(this.lat)&&isNaN(a.lon)&&isNaN(a.lat);return b},transform:function(a,b){a=OpenLayers.Projection.transform({x:this.lon,y:this.lat},a,b);this.lon=a.x;this.lat=a.y;return this},wrapDateLine:function(a){var b=this.clone();if(a){for(;b.lon<a.left;)b.lon+=a.getWidth();for(;b.lon>a.right;)b.lon-=a.getWidth()}return b},CLASS_NAME:"OpenLayers.LonLat"});
OpenLayers.LonLat.fromString=function(a){a=a.split(",");return new OpenLayers.LonLat(parseFloat(a[0]),parseFloat(a[1]))};
OpenLayers.Pixel=OpenLayers.Class({x:0,y:0,initialize:function(a,b){this.x=parseFloat(a);this.y=parseFloat(b)},toString:function(){return"x="+this.x+",y="+this.y},clone:function(){return new OpenLayers.Pixel(this.x,this.y)},equals:function(a){var b=false;if(a!=null)b=this.x==a.x&&this.y==a.y||isNaN(this.x)&&isNaN(this.y)&&isNaN(a.x)&&isNaN(a.y);return b},add:function(a,b){if(a==null||b==null){a=OpenLayers.i18n("pixelAddError");OpenLayers.Console.error(a);return null}return new OpenLayers.Pixel(this.x+
a,this.y+b)},offset:function(a){var b=this.clone();if(a)b=this.add(a.x,a.y);return b},CLASS_NAME:"OpenLayers.Pixel"});OpenLayers.Size=OpenLayers.Class({w:0,h:0,initialize:function(a,b){this.w=parseFloat(a);this.h=parseFloat(b)},toString:function(){return"w="+this.w+",h="+this.h},clone:function(){return new OpenLayers.Size(this.w,this.h)},equals:function(a){var b=false;if(a!=null)b=this.w==a.w&&this.h==a.h||isNaN(this.w)&&isNaN(this.h)&&isNaN(a.w)&&isNaN(a.h);return b},CLASS_NAME:"OpenLayers.Size"});
OpenLayers.Console={log:function(){},debug:function(){},info:function(){},warn:function(){},error:function(){},userError:function(a){alert(a)},assert:function(){},dir:function(){},dirxml:function(){},trace:function(){},group:function(){},groupEnd:function(){},time:function(){},timeEnd:function(){},profile:function(){},profileEnd:function(){},count:function(){},CLASS_NAME:"OpenLayers.Console"};
(function(){for(var a=document.getElementsByTagName("script"),b=0,c=a.length;b<c;++b)if(a[b].src.indexOf("firebug.js")!=-1)if(console){OpenLayers.Util.extend(OpenLayers.Console,console);break}})();
OpenLayers.Tween=OpenLayers.Class({INTERVAL:10,easing:null,begin:null,finish:null,duration:null,callbacks:null,time:null,interval:null,playing:false,initialize:function(a){this.easing=a?a:OpenLayers.Easing.Expo.easeOut},start:function(a,b,c,d){this.playing=true;this.begin=a;this.finish=b;this.duration=c;this.callbacks=d.callbacks;this.time=0;if(this.interval){window.clearInterval(this.interval);this.interval=null}this.callbacks&&this.callbacks.start&&this.callbacks.start.call(this,this.begin);this.interval=
window.setInterval(OpenLayers.Function.bind(this.play,this),this.INTERVAL)},stop:function(){if(this.playing){this.callbacks&&this.callbacks.done&&this.callbacks.done.call(this,this.finish);window.clearInterval(this.interval);this.interval=null;this.playing=false}},play:function(){var a={};for(var b in this.begin){var c=this.begin[b],d=this.finish[b];if(c==null||d==null||isNaN(c)||isNaN(d))OpenLayers.Console.error("invalid value for Tween");a[b]=this.easing.apply(this,[this.time,c,d-c,this.duration])}this.time++;
this.callbacks&&this.callbacks.eachStep&&this.callbacks.eachStep.call(this,a);if(this.time>this.duration){if(this.callbacks&&this.callbacks.done){this.callbacks.done.call(this,this.finish);this.playing=false}window.clearInterval(this.interval);this.interval=null}},CLASS_NAME:"OpenLayers.Tween"});OpenLayers.Easing={CLASS_NAME:"OpenLayers.Easing"};
OpenLayers.Easing.Linear={easeIn:function(a,b,c,d){return c*a/d+b},easeOut:function(a,b,c,d){return c*a/d+b},easeInOut:function(a,b,c,d){return c*a/d+b},CLASS_NAME:"OpenLayers.Easing.Linear"};
OpenLayers.Easing.Expo={easeIn:function(a,b,c,d){return a==0?b:c*Math.pow(2,10*(a/d-1))+b},easeOut:function(a,b,c,d){return a==d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b},easeInOut:function(a,b,c,d){if(a==0)return b;if(a==d)return b+c;if((a/=d/2)<1)return c/2*Math.pow(2,10*(a-1))+b;return c/2*(-Math.pow(2,-10*--a)+2)+b},CLASS_NAME:"OpenLayers.Easing.Expo"};
OpenLayers.Easing.Quad={easeIn:function(a,b,c,d){return c*(a/=d)*a+b},easeOut:function(a,b,c,d){return-c*(a/=d)*(a-2)+b},easeInOut:function(a,b,c,d){if((a/=d/2)<1)return c/2*a*a+b;return-c/2*(--a*(a-2)-1)+b},CLASS_NAME:"OpenLayers.Easing.Quad"};OpenLayers.Rico={};
OpenLayers.Rico.Corner={round:function(a,b){a=OpenLayers.Util.getElement(a);this._setOptions(b);b=this.options.color;if(this.options.color=="fromElement")b=this._background(a);var c=this.options.bgColor;if(this.options.bgColor=="fromParent")c=this._background(a.offsetParent);this._roundCornersImpl(a,b,c)},changeColor:function(a,b){a.style.backgroundColor=b;a=a.parentNode.getElementsByTagName("span");for(var c=0;c<a.length;c++)a[c].style.backgroundColor=b},changeOpacity:function(a,b){var c="alpha(opacity="+
b*100+")";a.style.opacity=b;a.style.filter=c;a=a.parentNode.getElementsByTagName("span");for(var d=0;d<a.length;d++){a[d].style.opacity=b;a[d].style.filter=c}},reRound:function(a,b){var c=a.parentNode.childNodes[2];a.parentNode.removeChild(a.parentNode.childNodes[0]);a.parentNode.removeChild(c);this.round(a.parentNode,b)},_roundCornersImpl:function(a,b,c){this.options.border&&this._renderBorder(a,c);this._isTopRounded()&&this._roundTopCorners(a,b,c);this._isBottomRounded()&&this._roundBottomCorners(a,
b,c)},_renderBorder:function(a,b){b="1px solid "+this._borderColor(b);a.innerHTML="<div "+("style='"+("border-left: "+b)+";"+("border-right: "+b)+"'")+">"+a.innerHTML+"</div>"},_roundTopCorners:function(a,b,c){for(var d=this._createCorner(c),e=0;e<this.options.numSlices;e++)d.appendChild(this._createCornerSlice(b,c,e,"top"));a.style.paddingTop=0;a.insertBefore(d,a.firstChild)},_roundBottomCorners:function(a,b,c){for(var d=this._createCorner(c),e=this.options.numSlices-1;e>=0;e--)d.appendChild(this._createCornerSlice(b,
c,e,"bottom"));a.style.paddingBottom=0;a.appendChild(d)},_createCorner:function(a){var b=document.createElement("div");b.style.backgroundColor=this._isTransparent()?"transparent":a;return b},_createCornerSlice:function(a,b,c,d){var e=document.createElement("span"),f=e.style;f.backgroundColor=a;f.display="block";f.height="1px";f.overflow="hidden";f.fontSize="1px";a=this._borderColor(a,b);if(this.options.border&&c==0){f.borderTopStyle="solid";f.borderTopWidth="1px";f.borderLeftWidth="0px";f.borderRightWidth=
"0px";f.borderBottomWidth="0px";f.height="0px";f.borderColor=a}else if(a){f.borderColor=a;f.borderStyle="solid";f.borderWidth="0px 1px"}if(!this.options.compact&&c==this.options.numSlices-1)f.height="2px";this._setMargin(e,c,d);this._setBorder(e,c,d);return e},_setOptions:function(a){this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:true,border:false,compact:false};OpenLayers.Util.extend(this.options,a||{});this.options.numSlices=this.options.compact?2:4;if(this._isTransparent())this.options.blend=
false},_whichSideTop:function(){if(this._hasString(this.options.corners,"all","top"))return"";if(this.options.corners.indexOf("tl")>=0&&this.options.corners.indexOf("tr")>=0)return"";if(this.options.corners.indexOf("tl")>=0)return"left";else if(this.options.corners.indexOf("tr")>=0)return"right";return""},_whichSideBottom:function(){if(this._hasString(this.options.corners,"all","bottom"))return"";if(this.options.corners.indexOf("bl")>=0&&this.options.corners.indexOf("br")>=0)return"";if(this.options.corners.indexOf("bl")>=
0)return"left";else if(this.options.corners.indexOf("br")>=0)return"right";return""},_borderColor:function(a,b){return a=="transparent"?b:this.options.border?this.options.border:this.options.blend?this._blend(b,a):""},_setMargin:function(a,b,c){b=this._marginSize(b);c=c=="top"?this._whichSideTop():this._whichSideBottom();if(c=="left"){a.style.marginLeft=b+"px";a.style.marginRight="0px"}else if(c=="right"){a.style.marginRight=b+"px";a.style.marginLeft="0px"}else{a.style.marginLeft=b+"px";a.style.marginRight=
b+"px"}},_setBorder:function(a,b,c){b=this._borderSize(b);c=c=="top"?this._whichSideTop():this._whichSideBottom();if(c=="left"){a.style.borderLeftWidth=b+"px";a.style.borderRightWidth="0px"}else if(c=="right"){a.style.borderRightWidth=b+"px";a.style.borderLeftWidth="0px"}else{a.style.borderLeftWidth=b+"px";a.style.borderRightWidth=b+"px"}if(this.options.border!=false){a.style.borderLeftWidth=b+"px";a.style.borderRightWidth=b+"px"}},_marginSize:function(a){if(this._isTransparent())return 0;var b=[5,
3,2,1],c=[3,2,1,0],d=[2,1],e=[1,0];return this.options.compact&&this.options.blend?e[a]:this.options.compact?d[a]:this.options.blend?c[a]:b[a]},_borderSize:function(a){var b=[5,3,2,1],c=[2,1,1,1],d=[1,0],e=[0,2,0,0];if(this.options.compact&&(this.options.blend||this._isTransparent()))return 1;else if(this.options.compact)return d[a];else if(this.options.blend)return c[a];else if(this.options.border)return e[a];else if(this._isTransparent())return b[a];return 0},_hasString:function(a){for(var b=1;b<
arguments.length;b++)if(a.indexOf(arguments[b])>=0)return true;return false},_blend:function(a,b){a=OpenLayers.Rico.Color.createFromHex(a);a.blend(OpenLayers.Rico.Color.createFromHex(b));return a},_background:function(a){try{return OpenLayers.Rico.Color.createColorFromBackground(a).asHex()}catch(b){return"#ffffff"}},_isTransparent:function(){return this.options.color=="transparent"},_isTopRounded:function(){return this._hasString(this.options.corners,"all","top","tl","tr")},_isBottomRounded:function(){return this._hasString(this.options.corners,
"all","bottom","bl","br")},_hasSingleTextChild:function(a){return a.childNodes.length==1&&a.childNodes[0].nodeType==3}};
OpenLayers.Rico.Color=OpenLayers.Class({initialize:function(a,b,c){this.rgb={r:a,g:b,b:c}},setRed:function(a){this.rgb.r=a},setGreen:function(a){this.rgb.g=a},setBlue:function(a){this.rgb.b=a},setHue:function(a){var b=this.asHSB();b.h=a;this.rgb=OpenLayers.Rico.Color.HSBtoRGB(b.h,b.s,b.b)},setSaturation:function(a){var b=this.asHSB();b.s=a;this.rgb=OpenLayers.Rico.Color.HSBtoRGB(b.h,b.s,b.b)},setBrightness:function(a){var b=this.asHSB();b.b=a;this.rgb=OpenLayers.Rico.Color.HSBtoRGB(b.h,b.s,b.b)},
darken:function(a){var b=this.asHSB();this.rgb=OpenLayers.Rico.Color.HSBtoRGB(b.h,b.s,Math.max(b.b-a,0))},brighten:function(a){var b=this.asHSB();this.rgb=OpenLayers.Rico.Color.HSBtoRGB(b.h,b.s,Math.min(b.b+a,1))},blend:function(a){this.rgb.r=Math.floor((this.rgb.r+a.rgb.r)/2);this.rgb.g=Math.floor((this.rgb.g+a.rgb.g)/2);this.rgb.b=Math.floor((this.rgb.b+a.rgb.b)/2)},isBright:function(){this.asHSB();return this.asHSB().b>0.5},isDark:function(){return!this.isBright()},asRGB:function(){return"rgb("+
this.rgb.r+","+this.rgb.g+","+this.rgb.b+")"},asHex:function(){return"#"+this.rgb.r.toColorPart()+this.rgb.g.toColorPart()+this.rgb.b.toColorPart()},asHSB:function(){return OpenLayers.Rico.Color.RGBtoHSB(this.rgb.r,this.rgb.g,this.rgb.b)},toString:function(){return this.asHex()}});
OpenLayers.Rico.Color.createFromHex=function(a){if(a.length==4){var b=a;a="#";for(var c=1;c<4;c++)a+=b.charAt(c)+b.charAt(c)}if(a.indexOf("#")==0)a=a.substring(1);b=a.substring(0,2);c=a.substring(2,4);a=a.substring(4,6);return new OpenLayers.Rico.Color(parseInt(b,16),parseInt(c,16),parseInt(a,16))};
OpenLayers.Rico.Color.createColorFromBackground=function(a){var b=RicoUtil.getElementsComputedStyle(OpenLayers.Util.getElement(a),"backgroundColor","background-color");if(b=="transparent"&&a.parentNode)return OpenLayers.Rico.Color.createColorFromBackground(a.parentNode);if(b==null)return new OpenLayers.Rico.Color(255,255,255);if(b.indexOf("rgb(")==0){a=b.substring(4,b.length-1).split(",");return new OpenLayers.Rico.Color(parseInt(a[0]),parseInt(a[1]),parseInt(a[2]))}else return b.indexOf("#")==0?
OpenLayers.Rico.Color.createFromHex(b):new OpenLayers.Rico.Color(255,255,255)};
OpenLayers.Rico.Color.HSBtoRGB=function(a,b,c){var d=0,e=0,f=0;if(b==0)f=e=d=parseInt(c*255+0.5);else{a=(a-Math.floor(a))*6;var g=a-Math.floor(a),i=c*(1-b),h=c*(1-b*g);b=c*(1-b*(1-g));switch(parseInt(a)){case 0:d=c*255+0.5;e=b*255+0.5;f=i*255+0.5;break;case 1:d=h*255+0.5;e=c*255+0.5;f=i*255+0.5;break;case 2:d=i*255+0.5;e=c*255+0.5;f=b*255+0.5;break;case 3:d=i*255+0.5;e=h*255+0.5;f=c*255+0.5;break;case 4:d=b*255+0.5;e=i*255+0.5;f=c*255+0.5;break;case 5:d=c*255+0.5;e=i*255+0.5;f=h*255+0.5;break}}return{r:parseInt(d),
g:parseInt(e),b:parseInt(f)}};OpenLayers.Rico.Color.RGBtoHSB=function(a,b,c){var d,e,f=a>b?a:b;if(c>f)f=c;var g=a<b?a:b;if(c<g)g=c;e=f/255;d=f!=0?(f-g)/f:0;if(d==0)a=0;else{var i=(f-a)/(f-g),h=(f-b)/(f-g);c=(f-c)/(f-g);a=a==f?c-h:b==f?2+i-c:4+h-i;a/=6;if(a<0)a+=1}return{h:a,s:d,b:e}};OpenLayers.ProxyHost="";OpenLayers.nullHandler=function(a){alert("Unhandled request return "+a.statusText)};
OpenLayers.loadURL=function(a,b,c,d,e){if(OpenLayers.ProxyHost&&OpenLayers.String.startsWith(a,"http"))a=OpenLayers.ProxyHost+escape(a);d=d?OpenLayers.Function.bind(d,c):OpenLayers.nullHandler;c=e?OpenLayers.Function.bind(e,c):OpenLayers.nullHandler;new OpenLayers.Ajax.Request(a,{method:"get",parameters:b,onComplete:d,onFailure:c})};
OpenLayers.parseXMLString=function(a){var b=a.indexOf("<");if(b>0)a=a.substring(b);return OpenLayers.Util.Try(function(){var c=new ActiveXObject("Microsoft.XMLDOM");c.loadXML(a);return c},function(){return(new DOMParser).parseFromString(a,"text/xml")},function(){var c=new XMLHttpRequest;c.open("GET","data:text/xml;charset=utf-8,"+encodeURIComponent(a),false);c.overrideMimeType&&c.overrideMimeType("text/xml");c.send(null);return c.responseXML})};
OpenLayers.Ajax={emptyFunction:function(){},getTransport:function(){return OpenLayers.Util.Try(function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")},function(){return new XMLHttpRequest})||false},activeRequestCount:0};
OpenLayers.Ajax.Responders={responders:[],register:function(a){for(var b=0;b<this.responders.length;b++)if(a==this.responders[b])return;this.responders.push(a)},dispatch:function(a,b,c,d){for(var e,f=0;f<this.responders.length;f++){e=this.responders[f];if(e[a]&&typeof e[a]=="function")try{e[a].apply(e,[b,c,d])}catch(g){}}}};OpenLayers.Ajax.Responders.register({onCreate:function(){OpenLayers.Ajax.activeRequestCount++},onComplete:function(){OpenLayers.Ajax.activeRequestCount--}});
OpenLayers.Ajax.Base=function(){};OpenLayers.Ajax.Base.prototype={setOptions:function(a){this.options={method:"post",asynchronous:true,parameters:""};OpenLayers.Util.extend(this.options,a||{})},responseIsSuccess:function(){return this.transport.status==undefined||this.transport.status==0||this.transport.status>=200&&this.transport.status<300},responseIsFailure:function(){return!this.responseIsSuccess()}};
OpenLayers.Ajax.Request=OpenLayers.Class(OpenLayers.Ajax.Base,{initialize:function(a,b){this.transport=OpenLayers.Ajax.getTransport();this.setOptions(b);this.request(a)},request:function(a){var b=this.options.parameters||"";if(b.length>0)b+="&_=";try{this.url=a;if(this.options.method=="get"&&b.length>0)this.url+=(this.url.match(/\?/)?"&":"?")+b;OpenLayers.Ajax.Responders.dispatch("onCreate",this,this.transport);this.transport.open(this.options.method,this.url,this.options.asynchronous);if(this.options.asynchronous){this.transport.onreadystatechange=
OpenLayers.Function.bind(this.onStateChange,this);setTimeout(OpenLayers.Function.bind(function(){this.respondToReadyState(1)},this),10)}this.setRequestHeaders();var c=this.options.postBody?this.options.postBody:b;this.transport.send(this.options.method=="post"?c:null);!this.options.asynchronous&&this.transport.overrideMimeType&&this.onStateChange()}catch(d){this.dispatchException(d)}},setRequestHeaders:function(){var a=["X-Requested-With","XMLHttpRequest","X-Prototype-Version","OpenLayers"];if(this.options.method==
"post"&&!this.options.postBody){a.push("Content-type","application/x-www-form-urlencoded");this.transport.overrideMimeType&&a.push("Connection","close")}this.options.requestHeaders&&a.push.apply(a,this.options.requestHeaders);for(var b=0;b<a.length;b+=2)this.transport.setRequestHeader(a[b],a[b+1])},onStateChange:function(){this.transport.readyState!=1&&this.respondToReadyState(this.transport.readyState)},header:function(a){try{return this.transport.getResponseHeader(a)}catch(b){}},evalJSON:function(){try{return eval(this.header("X-JSON"))}catch(a){}},
evalResponse:function(){try{return eval(this.transport.responseText)}catch(a){this.dispatchException(a)}},respondToReadyState:function(a){a=OpenLayers.Ajax.Request.Events[a];var b=this.transport,c=this.evalJSON();if(a=="Complete"){try{var d=this.responseIsSuccess()?"Success":"Failure";(this.options["on"+this.transport.status]||this.options["on"+d]||OpenLayers.Ajax.emptyFunction)(b,c,this)}catch(e){this.dispatchException(e)}if((this.header("Content-type")||"").match(/^text\/javascript/i))this.evalResponse()}try{(this.options["on"+
a]||OpenLayers.Ajax.emptyFunction)(b,c,this);OpenLayers.Ajax.Responders.dispatch("on"+a,this,b,c,this)}catch(f){this.dispatchException(f)}if(a=="Complete")this.transport.onreadystatechange=OpenLayers.Ajax.emptyFunction},dispatchException:function(a){if(this.options.onException)this.options.onException(this,a);else throw a;OpenLayers.Ajax.Responders.dispatch("onException",this,a)}});OpenLayers.Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];
OpenLayers.Ajax.getElementsByTagNameNS=function(a,b,c,d){var e=null;return e=a.getElementsByTagNameNS?a.getElementsByTagNameNS(b,d):a.getElementsByTagName(c+":"+d)};OpenLayers.Ajax.serializeXMLToString=function(a){return data=(new XMLSerializer).serializeToString(a)};
OpenLayers.Event={observers:false,KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(a){return a.target||a.srcElement},isLeftClick:function(a){return a.which&&a.which==1||a.button&&a.button==1},isRightClick:function(a){return a.which&&a.which==3||a.button&&a.button==2},stop:function(a,b){if(!b)if(a.preventDefault)a.preventDefault();else a.returnValue=false;if(a.stopPropagation)a.stopPropagation();else a.cancelBubble=true},
findElement:function(a,b){for(a=OpenLayers.Event.element(a);a.parentNode&&(!a.tagName||a.tagName.toUpperCase()!=b.toUpperCase());)a=a.parentNode;return a},observe:function(a,b,c,d){a=OpenLayers.Util.getElement(a);d=d||false;if(b=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||a.attachEvent))b="keydown";if(!this.observers)this.observers={};if(!a._eventCacheID){var e="eventCacheID_";if(a.id)e=a.id+"_"+e;a._eventCacheID=OpenLayers.Util.createUniqueID(e)}e=a._eventCacheID;this.observers[e]||
(this.observers[e]=[]);this.observers[e].push({element:a,name:b,observer:c,useCapture:d});if(a.addEventListener)a.addEventListener(b,c,d);else a.attachEvent&&a.attachEvent("on"+b,c)},stopObservingElement:function(a){a=OpenLayers.Util.getElement(a)._eventCacheID;this._removeElementObservers(OpenLayers.Event.observers[a])},_removeElementObservers:function(a){if(a)for(var b=a.length-1;b>=0;b--){var c=a[b];OpenLayers.Event.stopObserving.apply(this,new Array(c.element,c.name,c.observer,c.useCapture))}},
stopObserving:function(a,b,c,d){d=d||false;a=OpenLayers.Util.getElement(a);var e=a._eventCacheID;if(b=="keypress")if(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||a.detachEvent)b="keydown";var f=false,g=OpenLayers.Event.observers[e];if(g)for(var i=0;!f&&i<g.length;){var h=g[i];if(h.name==b&&h.observer==c&&h.useCapture==d){g.splice(i,1);g.length==0&&delete OpenLayers.Event.observers[e];f=true;break}i++}if(f)if(a.removeEventListener)a.removeEventListener(b,c,d);else a&&a.detachEvent&&a.detachEvent("on"+
b,c);return f},unloadCache:function(){if(OpenLayers.Event&&OpenLayers.Event.observers){for(var a in OpenLayers.Event.observers)OpenLayers.Event._removeElementObservers.apply(this,[OpenLayers.Event.observers[a]]);OpenLayers.Event.observers=false}},CLASS_NAME:"OpenLayers.Event"};OpenLayers.Event.observe(window,"unload",OpenLayers.Event.unloadCache,false);if(window.Event)OpenLayers.Util.applyDefaults(window.Event,OpenLayers.Event);else var Event=OpenLayers.Event;
OpenLayers.Events=OpenLayers.Class({BROWSER_EVENTS:["mouseover","mouseout","mousedown","mouseup","mousemove","click","dblclick","rightclick","dblrightclick","resize","focus","blur"],listeners:null,object:null,element:null,eventTypes:null,eventHandler:null,fallThrough:null,includeXY:false,clearMouseListener:null,initialize:function(a,b,c,d,e){OpenLayers.Util.extend(this,e);this.object=a;this.fallThrough=d;this.listeners={};this.eventHandler=OpenLayers.Function.bindAsEventListener(this.handleBrowserEvent,
this);this.clearMouseListener=OpenLayers.Function.bind(this.clearMouseCache,this);this.eventTypes=[];if(c!=null){a=0;for(d=c.length;a<d;a++)this.addEventType(c[a])}b!=null&&this.attachToElement(b)},destroy:function(){if(this.element){OpenLayers.Event.stopObservingElement(this.element);this.element.hasScrollEvent&&OpenLayers.Event.stopObserving(window,"scroll",this.clearMouseListener)}this.eventHandler=this.fallThrough=this.eventTypes=this.object=this.listeners=this.element=null},addEventType:function(a){if(!this.listeners[a]){this.eventTypes.push(a);
this.listeners[a]=[]}},attachToElement:function(a){this.element&&OpenLayers.Event.stopObservingElement(this.element);this.element=a;for(var b=0,c=this.BROWSER_EVENTS.length;b<c;b++){var d=this.BROWSER_EVENTS[b];this.addEventType(d);OpenLayers.Event.observe(a,d,this.eventHandler)}OpenLayers.Event.observe(a,"dragstart",OpenLayers.Event.stop)},on:function(a){for(var b in a)b!="scope"&&this.register(b,a.scope,a[b])},register:function(a,b,c){if(c!=null&&OpenLayers.Util.indexOf(this.eventTypes,a)!=-1){if(b==
null)b=this.object;this.listeners[a].push({obj:b,func:c})}},registerPriority:function(a,b,c){if(c!=null){if(b==null)b=this.object;a=this.listeners[a];a!=null&&a.unshift({obj:b,func:c})}},un:function(a){for(var b in a)b!="scope"&&this.unregister(b,a.scope,a[b])},unregister:function(a,b,c){if(b==null)b=this.object;a=this.listeners[a];if(a!=null)for(var d=0,e=a.length;d<e;d++)if(a[d].obj==b&&a[d].func==c){a.splice(d,1);break}},remove:function(a){if(this.listeners[a]!=null)this.listeners[a]=[]},triggerEvent:function(a,
b){var c=this.listeners[a];if(!(!c||c.length==0)){if(b==null)b={};b.object=this.object;b.element=this.element;if(!b.type)b.type=a;c=c.slice();var d;a=0;for(var e=c.length;a<e;a++){d=c[a];d=d.func.apply(d.obj,[b]);if(d!=undefined&&d==false)break}this.fallThrough||OpenLayers.Event.stop(b,true);return d}},handleBrowserEvent:function(a){if(this.includeXY)a.xy=this.getMousePosition(a);this.triggerEvent(a.type,a)},clearMouseCache:function(){this.element.scrolls=null;this.element.lefttop=null;this.element.offsets=
null},getMousePosition:function(a){if(this.includeXY){if(!this.element.hasScrollEvent){OpenLayers.Event.observe(window,"scroll",this.clearMouseListener);this.element.hasScrollEvent=true}}else this.clearMouseCache();if(!this.element.scrolls)this.element.scrolls=[document.documentElement.scrollLeft||document.body.scrollLeft,document.documentElement.scrollTop||document.body.scrollTop];if(!this.element.lefttop)this.element.lefttop=[document.documentElement.clientLeft||0,document.documentElement.clientTop||
0];if(!this.element.offsets){this.element.offsets=OpenLayers.Util.pagePosition(this.element);this.element.offsets[0]+=this.element.scrolls[0];this.element.offsets[1]+=this.element.scrolls[1]}return new OpenLayers.Pixel(a.clientX+this.element.scrolls[0]-this.element.offsets[0]-this.element.lefttop[0],a.clientY+this.element.scrolls[1]-this.element.offsets[1]-this.element.lefttop[1])},CLASS_NAME:"OpenLayers.Events"});
OpenLayers.Request={DEFAULT_CONFIG:{method:"GET",url:window.location.href,async:true,user:undefined,password:undefined,params:null,proxy:OpenLayers.ProxyHost,headers:{},data:null,callback:function(){},success:null,failure:null,scope:null},events:new OpenLayers.Events(this,null,["complete","success","failure"]),issue:function(a){var b=OpenLayers.Util.extend(this.DEFAULT_CONFIG,{proxy:OpenLayers.ProxyHost});a=OpenLayers.Util.applyDefaults(a,b);var c=new OpenLayers.Request.XMLHttpRequest,d=a.url;if(a.params){b=
OpenLayers.Util.getParameterString(a.params);if(b.length>0){var e=d.indexOf("?")>-1?"&":"?";d+=e+b}}if(a.proxy&&d.indexOf("http")==0)d=a.proxy+encodeURIComponent(d);c.open(a.method,d,a.async,a.user,a.password);for(var f in a.headers)c.setRequestHeader(f,a.headers[f]);var g=a.scope?OpenLayers.Function.bind(a.callback,a.scope):a.callback,i;if(a.success)i=a.scope?OpenLayers.Function.bind(a.success,a.scope):a.success;var h;if(a.failure)h=a.scope?OpenLayers.Function.bind(a.failure,a.scope):a.failure;var j=
this.events;c.onreadystatechange=function(){if(c.readyState==OpenLayers.Request.XMLHttpRequest.DONE)if(j.triggerEvent("complete",{request:c,config:a,requestUrl:d})!==false){g(c);if(!c.status||c.status>=200&&c.status<300){j.triggerEvent("success",{request:c,config:a,requestUrl:d});i&&i(c)}if(c.status&&(c.status<200||c.status>=300)){j.triggerEvent("failure",{request:c,config:a,requestUrl:d});h&&h(c)}}};a.async===false?c.send(a.data):window.setTimeout(function(){c.send(a.data)},0);return c},GET:function(a){a=
OpenLayers.Util.extend(a,{method:"GET"});return OpenLayers.Request.issue(a)},POST:function(a){a=OpenLayers.Util.extend(a,{method:"POST"});a.headers=a.headers?a.headers:{};"CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(a.headers)||(a.headers["Content-Type"]="application/xml");return OpenLayers.Request.issue(a)},PUT:function(a){a=OpenLayers.Util.extend(a,{method:"PUT"});a.headers=a.headers?a.headers:{};"CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(a.headers)||(a.headers["Content-Type"]="application/xml");
return OpenLayers.Request.issue(a)},DELETE:function(a){a=OpenLayers.Util.extend(a,{method:"DELETE"});return OpenLayers.Request.issue(a)},HEAD:function(a){a=OpenLayers.Util.extend(a,{method:"HEAD"});return OpenLayers.Request.issue(a)},OPTIONS:function(a){a=OpenLayers.Util.extend(a,{method:"OPTIONS"});return OpenLayers.Request.issue(a)}};
(function(){function a(){this._object=f?new f:new window.ActiveXObject("Microsoft.XMLHTTP")}function b(h){h.onreadystatechange&&h.onreadystatechange.apply(h);a.onreadystatechange&&a.onreadystatechange.apply(h)}function c(h){var j=h.responseXML;if(i&&j&&!j.documentElement&&h.getResponseHeader("Content-Type").match(/[^\/]+\/[^\+]+\+xml/)){j=new ActiveXObject("Microsoft.XMLDOM");j.loadXML(h.responseText)}if(j)if(i&&j.parseError!=0||j.documentElement&&j.documentElement.tagName=="parsererror")return null;
return j}function d(h){try{h.responseText=h._object.responseText}catch(j){}try{h.responseXML=c(h._object)}catch(k){}try{h.status=h._object.status}catch(l){}try{h.statusText=h._object.statusText}catch(n){}}function e(h){h._object.onreadystatechange=new window.Function;delete h._headers}var f=window.XMLHttpRequest,g=!!window.controllers,i=window.document.all&&!window.opera;if(g&&f.wrapped)a.wrapped=f.wrapped;a.UNSENT=0;a.OPENED=1;a.HEADERS_RECEIVED=2;a.LOADING=3;a.DONE=4;a.prototype.readyState=a.UNSENT;
a.prototype.responseText="";a.prototype.responseXML=null;a.prototype.status=0;a.prototype.statusText="";a.prototype.onreadystatechange=null;a.onreadystatechange=null;a.onopen=null;a.onsend=null;a.onabort=null;a.prototype.open=function(h,j,k,l,n){this._async=k;var m=this,o=this.readyState;if(i){var p=function(){m._object.readyState!=a.DONE&&e(m)};k&&window.attachEvent("onunload",p)}this._object.onreadystatechange=function(){if(!(g&&!k)){m.readyState=m._object.readyState;d(m);if(m._aborted)m.readyState=
a.UNSENT;else{if(m.readyState==a.DONE){e(m);i&&k&&window.detachEvent("onunload",p)}o!=m.readyState&&b(m);o=m.readyState}}};a.onopen&&a.onopen.apply(this,arguments);this._object.open(h,j,k,l,n);if(!k&&g){this.readyState=a.OPENED;b(this)}};a.prototype.send=function(h){a.onsend&&a.onsend.apply(this,arguments);if(h&&h.nodeType){h=window.XMLSerializer?(new window.XMLSerializer).serializeToString(h):h.xml;this._headers["Content-Type"]||this._object.setRequestHeader("Content-Type","application/xml")}this._object.send(h);
if(g&&!this._async){this.readyState=a.OPENED;for(d(this);this.readyState<a.DONE;){this.readyState++;b(this);if(this._aborted)return}}};a.prototype.abort=function(){a.onabort&&a.onabort.apply(this,arguments);if(this.readyState>a.UNSENT)this._aborted=true;this._object.abort();e(this)};a.prototype.getAllResponseHeaders=function(){return this._object.getAllResponseHeaders()};a.prototype.getResponseHeader=function(h){return this._object.getResponseHeader(h)};a.prototype.setRequestHeader=function(h,j){if(!this._headers)this._headers=
{};this._headers[h]=j;return this._object.setRequestHeader(h,j)};a.prototype.toString=function(){return"[object XMLHttpRequest]"};a.toString=function(){return"[XMLHttpRequest]"};if(!window.Function.prototype.apply)window.Function.prototype.apply=function(h,j){j||(j=[]);h.__func=this;h.__func(j[0],j[1],j[2],j[3],j[4]);delete h.__func};OpenLayers.Request.XMLHttpRequest=a})();
OpenLayers.Projection=OpenLayers.Class({proj:null,projCode:null,initialize:function(a,b){OpenLayers.Util.extend(this,b);this.projCode=a;if(window.Proj4js)this.proj=new Proj4js.Proj(a)},getCode:function(){return this.proj?this.proj.srsCode:this.projCode},getUnits:function(){return this.proj?this.proj.units:null},toString:function(){return this.getCode()},equals:function(a){return a&&a.getCode?this.getCode()==a.getCode():false},destroy:function(){delete this.proj;delete this.projCode},CLASS_NAME:"OpenLayers.Projection"});
OpenLayers.Projection.transforms={};OpenLayers.Projection.addTransform=function(a,b,c){OpenLayers.Projection.transforms[a]||(OpenLayers.Projection.transforms[a]={});OpenLayers.Projection.transforms[a][b]=c};OpenLayers.Projection.transform=function(a,b,c){if(b.proj&&c.proj)a=Proj4js.transform(b.proj,c.proj,a);else b&&c&&OpenLayers.Projection.transforms[b.getCode()]&&OpenLayers.Projection.transforms[b.getCode()][c.getCode()]&&OpenLayers.Projection.transforms[b.getCode()][c.getCode()](a);return a};
OpenLayers.Map=OpenLayers.Class({Z_INDEX_BASE:{BaseLayer:100,Overlay:325,Feature:725,Popup:750,Control:1E3},EVENT_TYPES:["preaddlayer","addlayer","removelayer","changelayer","movestart","move","moveend","zoomend","popupopen","popupclose","addmarker","removemarker","clearmarkers","mouseover","mouseout","mousemove","dragstart","drag","dragend","changebaselayer"],id:null,fractionalZoom:false,events:null,allOverlays:false,div:null,dragging:false,size:null,viewPortDiv:null,layerContainerOrigin:null,layerContainerDiv:null,
layers:null,controls:null,popups:null,baseLayer:null,center:null,resolution:null,zoom:0,panRatio:1.5,viewRequestID:0,tileSize:null,projection:"EPSG:4326",units:"degrees",resolutions:null,maxResolution:1.40625,minResolution:null,maxScale:null,minScale:null,maxExtent:null,minExtent:null,restrictedExtent:null,numZoomLevels:16,theme:null,displayProjection:null,fallThrough:true,panTween:null,eventListeners:null,panMethod:OpenLayers.Easing.Expo.easeOut,panDuration:50,paddingForPopups:null,initialize:function(a,
b){if(arguments.length===1&&typeof a==="object")a=(b=a)&&b.div;this.tileSize=new OpenLayers.Size(OpenLayers.Map.TILE_WIDTH,OpenLayers.Map.TILE_HEIGHT);this.maxExtent=new OpenLayers.Bounds(-180,-90,180,90);this.paddingForPopups=new OpenLayers.Bounds(15,15,15,15);this.theme=OpenLayers._getScriptLocation()+"theme/default/style.css";OpenLayers.Util.extend(this,b);this.id=OpenLayers.Util.createUniqueID("OpenLayers.Map_");this.div=OpenLayers.Util.getElement(a);if(!this.div){this.div=document.createElement("div");
this.div.style.height="1px";this.div.style.width="1px"}OpenLayers.Element.addClass(this.div,"olMap");var c=this.div.id+"_OpenLayers_ViewPort";this.viewPortDiv=OpenLayers.Util.createDiv(c,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);c=this.div.id+"_OpenLayers_Container";this.layerContainerDiv=OpenLayers.Util.createDiv(c);this.layerContainerDiv.style.zIndex=
this.Z_INDEX_BASE.Popup-1;this.viewPortDiv.appendChild(this.layerContainerDiv);this.events=new OpenLayers.Events(this,this.div,this.EVENT_TYPES,this.fallThrough,{includeXY:true});this.updateSize();this.eventListeners instanceof Object&&this.events.on(this.eventListeners);this.events.register("movestart",this,this.updateSize);if(OpenLayers.String.contains(navigator.appName,"Microsoft"))this.events.register("resize",this,this.updateSize);else{this.updateSizeDestroy=OpenLayers.Function.bind(this.updateSize,
this);OpenLayers.Event.observe(window,"resize",this.updateSizeDestroy)}if(this.theme){c=true;for(var d=document.getElementsByTagName("link"),e=0,f=d.length;e<f;++e)if(OpenLayers.Util.isEquivalentUrl(d.item(e).href,this.theme)){c=false;break}if(c){c=document.createElement("link");c.setAttribute("rel","stylesheet");c.setAttribute("type","text/css");c.setAttribute("href",this.theme);document.getElementsByTagName("head")[0].appendChild(c)}}this.layers=[];if(this.controls==null)this.controls=OpenLayers.Control!=
null?[new OpenLayers.Control.Navigation,new OpenLayers.Control.PanZoom,new OpenLayers.Control.ArgParser,new OpenLayers.Control.Attribution]:[];e=0;for(f=this.controls.length;e<f;e++)this.addControlToMap(this.controls[e]);this.popups=[];this.unloadDestroy=OpenLayers.Function.bind(this.destroy,this);OpenLayers.Event.observe(window,"unload",this.unloadDestroy)},render:function(a){this.div=OpenLayers.Util.getElement(a);OpenLayers.Element.addClass(this.div,"olMap");this.events.attachToElement(this.div);
this.viewPortDiv.parentNode.removeChild(this.viewPortDiv);this.div.appendChild(this.viewPortDiv);this.updateSize()},unloadDestroy:null,updateSizeDestroy:null,destroy:function(){if(!this.unloadDestroy)return false;OpenLayers.Event.stopObserving(window,"unload",this.unloadDestroy);this.unloadDestroy=null;this.updateSizeDestroy?OpenLayers.Event.stopObserving(window,"resize",this.updateSizeDestroy):this.events.unregister("resize",this,this.updateSize);this.paddingForPopups=null;if(this.controls!=null){for(var a=
this.controls.length-1;a>=0;--a)this.controls[a].destroy();this.controls=null}if(this.layers!=null){for(a=this.layers.length-1;a>=0;--a)this.layers[a].destroy(false);this.layers=null}this.viewPortDiv&&this.div.removeChild(this.viewPortDiv);this.viewPortDiv=null;if(this.eventListeners){this.events.un(this.eventListeners);this.eventListeners=null}this.events.destroy();this.events=null},setOptions:function(a){OpenLayers.Util.extend(this,a)},getTileSize:function(){return this.tileSize},getBy:function(a,
b,c){var d=typeof c.test=="function";return OpenLayers.Array.filter(this[a],function(e){return e[b]==c||d&&c.test(e[b])})},getLayersBy:function(a,b){return this.getBy("layers",a,b)},getLayersByName:function(a){return this.getLayersBy("name",a)},getLayersByClass:function(a){return this.getLayersBy("CLASS_NAME",a)},getControlsBy:function(a,b){return this.getBy("controls",a,b)},getControlsByClass:function(a){return this.getControlsBy("CLASS_NAME",a)},getLayer:function(a){for(var b=null,c=0,d=this.layers.length;c<
d;c++){var e=this.layers[c];if(e.id==a){b=e;break}}return b},setLayerZIndex:function(a,b){a.setZIndex(this.Z_INDEX_BASE[a.isBaseLayer?"BaseLayer":"Overlay"]+b*5)},resetLayersZIndex:function(){for(var a=0,b=this.layers.length;a<b;a++)this.setLayerZIndex(this.layers[a],a)},addLayer:function(a){for(var b=0,c=this.layers.length;b<c;b++)if(this.layers[b]==a){a=OpenLayers.i18n("layerAlreadyAdded",{layerName:a.name});OpenLayers.Console.warn(a);return false}if(this.allOverlays)a.isBaseLayer=false;this.events.triggerEvent("preaddlayer",
{layer:a});a.div.className="olLayerDiv";a.div.style.overflow="";this.setLayerZIndex(a,this.layers.length);if(a.CLASS_NAME=="EMS.IndexedLayer")a.div.className="olLayerDiv olLayerBg";a.isFixed?this.viewPortDiv.appendChild(a.div):this.layerContainerDiv.appendChild(a.div);this.layers.push(a);a.setMap(this);if(a.isBaseLayer||this.allOverlays&&!this.baseLayer)this.baseLayer==null?this.setBaseLayer(a):a.setVisibility(false);else a.redraw();this.events.triggerEvent("addlayer",{layer:a});a.afterAdd()},addLayers:function(a){for(var b=
0,c=a.length;b<c;b++)this.addLayer(a[b])},removeLayer:function(a,b){if(b==null)b=true;a.isFixed?this.viewPortDiv.removeChild(a.div):this.layerContainerDiv.removeChild(a.div);OpenLayers.Util.removeItem(this.layers,a);a.removeMap(this);a.map=null;if(this.baseLayer==a){this.baseLayer=null;if(b){b=0;for(var c=this.layers.length;b<c;b++){var d=this.layers[b];if(d.isBaseLayer||this.allOverlays){this.setBaseLayer(d);break}}}}this.resetLayersZIndex();this.events.triggerEvent("removelayer",{layer:a})},getNumLayers:function(){return this.layers.length},
getLayerIndex:function(a){return OpenLayers.Util.indexOf(this.layers,a)},setLayerIndex:function(a,b){var c=this.getLayerIndex(a);if(b<0)b=0;else if(b>this.layers.length)b=this.layers.length;if(c!=b){this.layers.splice(c,1);this.layers.splice(b,0,a);c=0;for(var d=this.layers.length;c<d;c++)this.setLayerZIndex(this.layers[c],c);this.events.triggerEvent("changelayer",{layer:a,property:"order"});if(this.allOverlays)if(b===0)this.setBaseLayer(a);else this.baseLayer!==this.layers[0]&&this.setBaseLayer(this.layers[0])}},
raiseLayer:function(a,b){b=this.getLayerIndex(a)+b;this.setLayerIndex(a,b)},setBaseLayer:function(a){var b=null;if(this.baseLayer)b=this.baseLayer.getExtent();if(a!=this.baseLayer)if(OpenLayers.Util.indexOf(this.layers,a)!=-1){this.baseLayer!=null&&!this.allOverlays&&this.baseLayer.setVisibility(false);this.baseLayer=a;this.viewRequestID++;if(!this.allOverlays)this.baseLayer.visibility=true;a=this.getCenter();if(a!=null){a=b?b.getCenterLonLat():a;b=b?this.getZoomForExtent(b,true):this.getZoomForResolution(this.resolution,
true);this.setCenter(a,b,false,true)}this.events.triggerEvent("changebaselayer",{layer:this.baseLayer})}},addControl:function(a,b){this.controls.push(a);this.addControlToMap(a,b)},addControlToMap:function(a,b){a.outsideViewport=a.div!=null;if(this.displayProjection&&!a.displayProjection)a.displayProjection=this.displayProjection;a.setMap(this);if(b=a.draw(b))if(!a.outsideViewport){b.style.zIndex=this.Z_INDEX_BASE.Control+this.controls.length;this.viewPortDiv.appendChild(b)}},getControl:function(a){for(var b=
null,c=0,d=this.controls.length;c<d;c++){var e=this.controls[c];if(e.id==a){b=e;break}}return b},removeControl:function(a){if(a&&a==this.getControl(a.id)){a.div&&a.div.parentNode==this.viewPortDiv&&this.viewPortDiv.removeChild(a.div);OpenLayers.Util.removeItem(this.controls,a)}},addPopup:function(a,b){if(b)for(b=this.popups.length-1;b>=0;--b)this.removePopup(this.popups[b]);a.map=this;this.popups.push(a);if(a=a.draw()){a.style.zIndex=this.Z_INDEX_BASE.Popup+this.popups.length;this.layerContainerDiv.appendChild(a)}},
removePopup:function(a){OpenLayers.Util.removeItem(this.popups,a);if(a.div)try{this.layerContainerDiv.removeChild(a.div)}catch(b){}a.map=null},getSize:function(){var a=null;if(this.size!=null)a=this.size.clone();return a},updateSize:function(){this.events.clearMouseCache();var a=this.getCurrentSize(),b=this.getSize();if(b==null)this.size=b=a;if(!a.equals(b)){this.size=a;b=0;for(var c=this.layers.length;b<c;b++)this.layers[b].onMapResize();if(this.baseLayer!=null){this.getLonLatFromViewPortPx(new OpenLayers.Pixel(a.w/
2,a.h/2));a=this.getZoom();this.zoom=null;this.setCenter(this.getCenter(),a)}}},getCurrentSize:function(){var a=new OpenLayers.Size(this.div.clientWidth,this.div.clientHeight);if(a.w==0&&a.h==0||isNaN(a.w)&&isNaN(a.h)){var b=OpenLayers.Element.getDimensions(this.div);a.w=b.width;a.h=b.height}if(a.w==0&&a.h==0||isNaN(a.w)&&isNaN(a.h)){a.w=parseInt(this.div.style.width);a.h=parseInt(this.div.style.height)}return a},calculateBounds:function(a,b){var c=null;if(a==null)a=this.getCenter();if(b==null)b=
this.getResolution();if(a!=null&&b!=null){var d=this.getSize();c=d.w*b;b=d.h*b;c=new OpenLayers.Bounds(a.lon-c/2,a.lat-b/2,a.lon+c/2,a.lat+b/2)}return c},getCenter:function(){var a=null;if(this.center)a=this.center.clone();return a},getZoom:function(){return this.zoom},pan:function(a,b,c){c=OpenLayers.Util.applyDefaults(c,{animate:true,dragging:false});var d=this.getViewPortPxFromLonLat(this.getCenter());a=d.add(a,b);if(!c.dragging||!a.equals(d)){d=this.getLonLatFromViewPortPx(a);c.animate?this.panTo(d):
this.setCenter(d,null,c.dragging)}},panTo:function(a){if(this.panMethod&&this.getExtent().scale(this.panRatio).containsLonLat(a)){if(!this.panTween)this.panTween=new OpenLayers.Tween(this.panMethod);var b=this.getCenter();a.lon==b.lon&&a.lat==b.lat||this.panTween.start({lon:b.lon,lat:b.lat},{lon:a.lon,lat:a.lat},this.panDuration,{callbacks:{start:OpenLayers.Function.bind(function(){this.events.triggerEvent("movestart")},this),eachStep:OpenLayers.Function.bind(function(c){c=new OpenLayers.LonLat(c.lon,
c.lat);this.moveTo(c,this.zoom,{dragging:true,noEvent:true})},this),done:OpenLayers.Function.bind(function(c){c=new OpenLayers.LonLat(c.lon,c.lat);this.moveTo(c,this.zoom,{noEvent:true});this.events.triggerEvent("moveend")},this)}})}else this.setCenter(a)},setCenter:function(a,b,c,d){this.moveTo(a,b,{dragging:c,forceZoomChange:d,caller:"setCenter"})},moveTo:function(a,b,c){c||(c={});var d=c.dragging,e=c.forceZoomChange,f=c.noEvent;this.panTween&&c.caller=="setCenter"&&this.panTween.stop();if(!this.center&&
!this.isValidLonLat(a))a=this.maxExtent.getCenterLonLat();if(this.restrictedExtent!=null){if(a==null)a=this.getCenter();if(b==null)b=this.getZoom();c=this.getResolutionForZoom(b);c=this.calculateBounds(a,c);if(!this.restrictedExtent.containsBounds(c)){var g=this.restrictedExtent.getCenterLonLat();if(c.getWidth()>this.restrictedExtent.getWidth())a=new OpenLayers.LonLat(g.lon,a.lat);else if(c.left<this.restrictedExtent.left)a=a.add(this.restrictedExtent.left-c.left,0);else if(c.right>this.restrictedExtent.right)a=
a.add(this.restrictedExtent.right-c.right,0);if(c.getHeight()>this.restrictedExtent.getHeight())a=new OpenLayers.LonLat(a.lon,g.lat);else if(c.bottom<this.restrictedExtent.bottom)a=a.add(0,this.restrictedExtent.bottom-c.bottom);else if(c.top>this.restrictedExtent.top)a=a.add(0,this.restrictedExtent.top-c.top)}}e=e||this.isValidZoomLevel(b)&&b!=this.getZoom();c=this.isValidLonLat(a)&&!a.equals(this.center);if(e||c||!d){!this.dragging&&!f&&this.events.triggerEvent("movestart");if(c){!e&&this.center&&
this.centerLayerContainer(a);this.center=a.clone()}if(e||this.layerContainerOrigin==null){this.layerContainerOrigin=this.center.clone();this.layerContainerDiv.style.left="0px";this.layerContainerDiv.style.top="0px"}if(e){this.zoom=b;this.resolution=this.getResolutionForZoom(b);this.viewRequestID++}a=this.getExtent();if(this.baseLayer.visibility){this.baseLayer.moveTo(a,e,d);d?this.baseLayer.events.triggerEvent("move"):this.baseLayer.events.triggerEvent("moveend",{zoomChanged:e})}a=this.baseLayer.getExtent();
b=0;for(c=this.layers.length;b<c;b++){g=this.layers[b];if(g!==this.baseLayer&&!g.isBaseLayer){var i=g.calculateInRange();if(g.inRange!=i){(g.inRange=i)||g.display(false);this.events.triggerEvent("changelayer",{layer:g,property:"visibility"})}if(i&&g.visibility){g.moveTo(a,e,d);d?g.events.triggerEvent("move"):g.events.triggerEvent("moveend",{zoomChanged:e})}}}if(e){b=0;for(c=this.popups.length;b<c;b++)this.popups[b].updatePosition()}this.events.triggerEvent("move");e&&this.events.triggerEvent("zoomend")}!d&&
!f&&this.events.triggerEvent("moveend");this.dragging=!!d},centerLayerContainer:function(a){var b=this.getViewPortPxFromLonLat(this.layerContainerOrigin);a=this.getViewPortPxFromLonLat(a);if(b!=null&&a!=null){this.layerContainerDiv.style.left=Math.round(b.x-a.x)+"px";this.layerContainerDiv.style.top=Math.round(b.y-a.y)+"px"}},isValidZoomLevel:function(a){return a!=null&&a>=0&&a<this.getNumZoomLevels()},isValidLonLat:function(a){var b=false;if(a!=null)b=this.getMaxExtent().containsLonLat(a);return b},
getProjection:function(){var a=this.getProjectionObject();return a?a.getCode():null},getProjectionObject:function(){var a=null;if(this.baseLayer!=null)a=this.baseLayer.projection;return a},getMaxResolution:function(){var a=null;if(this.baseLayer!=null)a=this.baseLayer.maxResolution;return a},getMaxExtent:function(a){var b=null;if(a&&a.restricted&&this.restrictedExtent)b=this.restrictedExtent;else if(this.baseLayer!=null)b=this.baseLayer.maxExtent;return b},getNumZoomLevels:function(){var a=null;if(this.baseLayer!=
null)a=this.baseLayer.numZoomLevels;return a},getExtent:function(){var a=null;if(this.baseLayer!=null)a=this.baseLayer.getExtent();return a},getResolution:function(){var a=null;if(this.baseLayer!=null)a=this.baseLayer.getResolution();return a},getUnits:function(){var a=null;if(this.baseLayer!=null)a=this.baseLayer.units;return a},getScale:function(){var a=null;if(this.baseLayer!=null){a=this.getResolution();a=OpenLayers.Util.getScaleFromResolution(a,this.baseLayer.units)}return a},getZoomForExtent:function(a,
b){var c=null;if(this.baseLayer!=null)c=this.baseLayer.getZoomForExtent(a,b);return c},getResolutionForZoom:function(a){var b=null;if(this.baseLayer)b=this.baseLayer.getResolutionForZoom(a);return b},getZoomForResolution:function(a,b){var c=null;if(this.baseLayer!=null)c=this.baseLayer.getZoomForResolution(a,b);return c},zoomTo:function(a){this.isValidZoomLevel(a)&&this.setCenter(null,a)},zoomIn:function(){this.zoomTo(this.getZoom()+1)},zoomOut:function(){this.zoomTo(this.getZoom()-1)},zoomToExtent:function(a,
b){var c=a.getCenterLonLat();if(this.baseLayer.wrapDateLine){c=this.getMaxExtent();for(a=a.clone();a.right<a.left;)a.right+=c.getWidth();c=a.getCenterLonLat().wrapDateLine(c)}this.setCenter(c,this.getZoomForExtent(a,b))},zoomToMaxExtent:function(a){this.zoomToExtent(this.getMaxExtent({restricted:a?a.restricted:true}))},zoomToScale:function(a,b){var c=OpenLayers.Util.getResolutionFromScale(a,this.baseLayer.units),d=this.getSize();a=d.w*c;c=d.h*c;d=this.getCenter();this.zoomToExtent(new OpenLayers.Bounds(d.lon-
a/2,d.lat-c/2,d.lon+a/2,d.lat+c/2),b)},getLonLatFromViewPortPx:function(a){var b=null;if(this.baseLayer!=null)b=this.baseLayer.getLonLatFromViewPortPx(a);return b},getViewPortPxFromLonLat:function(a){var b=null;if(this.baseLayer!=null)b=this.baseLayer.getViewPortPxFromLonLat(a);return b},getLonLatFromPixel:function(a){return this.getLonLatFromViewPortPx(a)},getPixelFromLonLat:function(a){a=this.getViewPortPxFromLonLat(a);a.x=Math.round(a.x);a.y=Math.round(a.y);return a},getViewPortPxFromLayerPx:function(a){var b=
null;if(a!=null){b=parseInt(this.layerContainerDiv.style.left);var c=parseInt(this.layerContainerDiv.style.top);b=a.add(b,c)}return b},getLayerPxFromViewPortPx:function(a){var b=null;if(a!=null){b=-parseInt(this.layerContainerDiv.style.left);var c=-parseInt(this.layerContainerDiv.style.top);b=a.add(b,c);if(isNaN(b.x)||isNaN(b.y))b=null}return b},getLonLatFromLayerPx:function(a){a=this.getViewPortPxFromLayerPx(a);return this.getLonLatFromViewPortPx(a)},getLayerPxFromLonLat:function(a){return this.getLayerPxFromViewPortPx(this.getPixelFromLonLat(a))},
CLASS_NAME:"OpenLayers.Map"});OpenLayers.Map.TILE_WIDTH=256;OpenLayers.Map.TILE_HEIGHT=256;
OpenLayers.Layer=OpenLayers.Class({id:null,name:null,div:null,opacity:null,alwaysInRange:null,EVENT_TYPES:["loadstart","loadend","loadcancel","visibilitychanged","move","moveend"],events:null,map:null,isBaseLayer:false,alpha:false,displayInLayerSwitcher:true,visibility:true,attribution:null,inRange:false,imageSize:null,imageOffset:null,options:null,eventListeners:null,gutter:0,projection:null,units:null,scales:null,resolutions:null,maxExtent:null,minExtent:null,maxResolution:null,minResolution:null,
numZoomLevels:null,minScale:null,maxScale:null,displayOutsideMaxExtent:false,wrapDateLine:false,transitionEffect:null,SUPPORTED_TRANSITIONS:["resize"],initialize:function(a,b){this.addOptions(b);this.name=a;if(this.id==null){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");this.div=OpenLayers.Util.createDiv(this.id);this.div.style.width="100%";this.div.style.height="100%";this.div.dir="ltr";this.events=new OpenLayers.Events(this,this.div,this.EVENT_TYPES);this.eventListeners instanceof
Object&&this.events.on(this.eventListeners)}if(this.wrapDateLine)this.displayOutsideMaxExtent=true},destroy:function(a){if(a==null)a=true;this.map!=null&&this.map.removeLayer(this,a);this.options=this.div=this.name=this.map=this.projection=null;if(this.events){this.eventListeners&&this.events.un(this.eventListeners);this.events.destroy()}this.events=this.eventListeners=null},clone:function(a){if(a==null)a=new OpenLayers.Layer(this.name,this.options);OpenLayers.Util.applyDefaults(a,this);a.map=null;
return a},setName:function(a){if(a!=this.name){this.name=a;this.map!=null&&this.map.events.triggerEvent("changelayer",{layer:this,property:"name"})}},addOptions:function(a){if(this.options==null)this.options={};OpenLayers.Util.extend(this.options,a);OpenLayers.Util.extend(this,a)},onMapResize:function(){},redraw:function(){var a=false;if(this.map){this.inRange=this.calculateInRange();var b=this.getExtent();if(b&&this.inRange&&this.visibility){this.moveTo(b,true,false);this.events.triggerEvent("moveend",
{zoomChanged:true});a=true}}return a},moveTo:function(){var a=this.visibility;this.isBaseLayer||(a=a&&this.inRange);this.display(a)},setMap:function(a){if(this.map==null){this.map=a;this.maxExtent=this.maxExtent||this.map.maxExtent;if((this.projection=this.projection||this.map.projection)&&typeof this.projection=="string")this.projection=new OpenLayers.Projection(this.projection);this.units=this.projection.getUnits()||this.units||this.map.units;this.initResolutions();if(!this.isBaseLayer){this.inRange=
this.calculateInRange();this.div.style.display=this.visibility&&this.inRange?"":"none"}this.setTileSize()}},afterAdd:function(){},removeMap:function(){},getImageSize:function(){return this.imageSize||this.tileSize},setTileSize:function(a){this.tileSize=a=a?a:this.tileSize?this.tileSize:this.map.getTileSize();if(this.gutter){this.imageOffset=new OpenLayers.Pixel(-this.gutter,-this.gutter);this.imageSize=new OpenLayers.Size(a.w+2*this.gutter,a.h+2*this.gutter)}},getVisibility:function(){return this.visibility},
setVisibility:function(a){if(a!=this.visibility){this.visibility=a;this.display(a);this.redraw();this.map!=null&&this.map.events.triggerEvent("changelayer",{layer:this,property:"visibility"});this.events.triggerEvent("visibilitychanged")}},display:function(a){var b=this.calculateInRange();if(a!=(this.div.style.display!="none"))this.div.style.display=a&&b?"block":"none"},calculateInRange:function(){var a=false;if(this.alwaysInRange)a=true;else if(this.map){a=this.map.getResolution();a=a>=this.minResolution&&
a<=this.maxResolution}return a},setIsBaseLayer:function(a){if(a!=this.isBaseLayer){this.isBaseLayer=a;this.map!=null&&this.map.events.triggerEvent("changebaselayer",{layer:this})}},initResolutions:function(){for(var a=new Array("projection","units","scales","resolutions","maxScale","minScale","maxResolution","minResolution","minExtent","maxExtent","numZoomLevels","maxZoomLevel"),b=["projection","units"],c=false,d={},e=0,f=a.length;e<f;e++){var g=a[e];if(this.options[g]&&OpenLayers.Util.indexOf(b,
g)==-1)c=true;d[g]=this.options[g]||this.map[g]}if(this.alwaysInRange==null)this.alwaysInRange=!c;if((this.options.minScale!=null||this.options.maxScale!=null)&&this.options.scales==null)d.scales=null;if((this.options.minResolution!=null||this.options.maxResolution!=null)&&this.options.resolutions==null)d.resolutions=null;if(!d.numZoomLevels&&d.maxZoomLevel)d.numZoomLevels=d.maxZoomLevel+1;if(d.scales!=null||d.resolutions!=null){if(d.scales!=null){d.resolutions=[];e=0;for(f=d.scales.length;e<f;e++)d.resolutions[e]=
OpenLayers.Util.getResolutionFromScale(d.scales[e],d.units)}d.numZoomLevels=d.resolutions.length}else{if(d.minScale)d.maxResolution=OpenLayers.Util.getResolutionFromScale(d.minScale,d.units);else if(d.maxResolution=="auto"){a=this.map.getSize();e=d.maxExtent.getWidth()/a.w;a=d.maxExtent.getHeight()/a.h;d.maxResolution=Math.max(e,a)}if(d.maxScale!=null)d.minResolution=OpenLayers.Util.getResolutionFromScale(d.maxScale,d.units);else if(d.minResolution=="auto"&&d.minExtent!=null){a=this.map.getSize();
e=d.minExtent.getWidth()/a.w;a=d.minExtent.getHeight()/a.h;d.minResolution=Math.max(e,a)}if(d.minResolution!=null&&this.options.numZoomLevels==undefined)d.numZoomLevels=Math.floor(Math.log(d.maxResolution/d.minResolution)/Math.log(2))+1;d.resolutions=new Array(d.numZoomLevels);a=2;if(typeof d.minResolution=="number"&&d.numZoomLevels>1)a=Math.pow(d.maxResolution/d.minResolution,1/(d.numZoomLevels-1));for(e=0;e<d.numZoomLevels;e++){b=d.maxResolution/Math.pow(a,e);d.resolutions[e]=b}}d.resolutions.sort(function(i,
h){return h-i});this.resolutions=d.resolutions;this.maxResolution=d.resolutions[0];this.minResolution=d.resolutions[d.resolutions.length-1];this.scales=[];e=0;for(f=d.resolutions.length;e<f;e++)this.scales[e]=OpenLayers.Util.getScaleFromResolution(d.resolutions[e],d.units);this.minScale=this.scales[0];this.maxScale=this.scales[this.scales.length-1];this.numZoomLevels=d.numZoomLevels},getResolution:function(){return this.getResolutionForZoom(this.map.getZoom())},getExtent:function(){return this.map.calculateBounds()},
getZoomForExtent:function(a,b){var c=this.map.getSize();return this.getZoomForResolution(Math.max(a.getWidth()/c.w,a.getHeight()/c.h),b)},getDataExtent:function(){},getResolutionForZoom:function(a){a=Math.max(0,Math.min(a,this.resolutions.length-1));if(this.map.fractionalZoom){var b=Math.floor(a),c=Math.ceil(a);a=this.resolutions[b]-(a-b)*(this.resolutions[b]-this.resolutions[c])}else a=this.resolutions[Math.round(a)];return a},getZoomForResolution:function(a,b){if(this.map.fractionalZoom){b=0;for(var c=
this.resolutions[b],d=this.resolutions[this.resolutions.length-1],e,f=0,g=this.resolutions.length;f<g;++f){e=this.resolutions[f];if(e>=a){c=e;b=f}if(e<=a){d=e;break}}f=c-d;a=f>0?b+(c-a)/f:b}else{d=Number.POSITIVE_INFINITY;f=0;for(g=this.resolutions.length;f<g;f++)if(b){c=Math.abs(this.resolutions[f]-a);if(c>d)break;d=c}else if(this.resolutions[f]<a)break;a=Math.max(0,f-1)}return a},getLonLatFromViewPortPx:function(a){var b=null;if(a!=null){var c=this.map.getSize(),d=this.map.getCenter();if(d){b=this.map.getResolution();
b=new OpenLayers.LonLat(d.lon+(a.x-c.w/2)*b,d.lat-(a.y-c.h/2)*b);if(this.wrapDateLine)b=b.wrapDateLine(this.maxExtent)}}return b},getViewPortPxFromLonLat:function(a){var b=null;if(a!=null){b=this.map.getResolution();var c=this.map.getExtent();b=new OpenLayers.Pixel(1/b*(a.lon-c.left),1/b*(c.top-a.lat))}return b},setOpacity:function(a){if(a!=this.opacity){this.opacity=a;for(var b=0,c=this.div.childNodes.length;b<c;++b)OpenLayers.Util.modifyDOMElement(this.div.childNodes[b].firstChild,null,null,null,
null,null,null,a)}},getZIndex:function(){return this.div.style.zIndex},setZIndex:function(a){this.div.style.zIndex=a},adjustBounds:function(a){if(this.gutter){var b=this.gutter*this.map.getResolution();a=new OpenLayers.Bounds(a.left-b,a.bottom-b,a.right+b,a.top+b)}if(this.wrapDateLine){b={rightTolerance:this.getResolution()};a=a.wrapDateLine(this.maxExtent,b)}return a},CLASS_NAME:"OpenLayers.Layer"});
OpenLayers.Icon=OpenLayers.Class({url:null,size:null,offset:null,calculateOffset:null,imageDiv:null,px:null,initialize:function(a,b,c,d){this.url=a;this.size=b?b:new OpenLayers.Size(20,20);this.offset=c?c:new OpenLayers.Pixel(-(this.size.w/2),-(this.size.h/2));this.calculateOffset=d;a=OpenLayers.Util.createUniqueID("OL_Icon_");this.imageDiv=OpenLayers.Util.createAlphaImageDiv(a)},destroy:function(){this.erase();OpenLayers.Event.stopObservingElement(this.imageDiv.firstChild);this.imageDiv.innerHTML=
"";this.imageDiv=null},clone:function(){return new OpenLayers.Icon(this.url,this.size,this.offset,this.calculateOffset)},setSize:function(a){if(a!=null)this.size=a;this.draw()},setUrl:function(a){if(a!=null)this.url=a;this.draw()},draw:function(a){OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,null,this.size,this.url,"absolute");this.moveTo(a);return this.imageDiv},erase:function(){this.imageDiv!=null&&this.imageDiv.parentNode!=null&&OpenLayers.Element.remove(this.imageDiv)},setOpacity:function(a){OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,
null,null,null,null,null,null,null,a)},moveTo:function(a){if(a!=null)this.px=a;if(this.imageDiv!=null)if(this.px==null)this.display(false);else{if(this.calculateOffset)this.offset=this.calculateOffset(this.size);a=this.px.offset(this.offset);OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,a)}},display:function(a){this.imageDiv.style.display=a?"":"none"},isDrawn:function(){return this.imageDiv&&this.imageDiv.parentNode&&this.imageDiv.parentNode.nodeType!=11},CLASS_NAME:"OpenLayers.Icon"});
OpenLayers.Marker=OpenLayers.Class({icon:null,lonlat:null,events:null,map:null,initialize:function(a,b){this.lonlat=a;a=b?b:OpenLayers.Marker.defaultIcon();if(this.icon==null)this.icon=a;else{this.icon.url=a.url;this.icon.size=a.size;this.icon.offset=a.offset;this.icon.calculateOffset=a.calculateOffset}this.events=new OpenLayers.Events(this,this.icon.imageDiv,null)},destroy:function(){this.erase();this.map=null;this.events.destroy();this.events=null;if(this.icon!=null){this.icon.destroy();this.icon=
null}},draw:function(a){return this.icon.draw(a)},erase:function(){this.icon!=null&&this.icon.erase()},moveTo:function(a){a!=null&&this.icon!=null&&this.icon.moveTo(a);this.lonlat=this.map.getLonLatFromLayerPx(a)},isDrawn:function(){return this.icon&&this.icon.isDrawn()},onScreen:function(){var a=false;if(this.map)a=this.map.getExtent().containsLonLat(this.lonlat);return a},inflate:function(a){this.icon&&this.icon.setSize(new OpenLayers.Size(this.icon.size.w*a,this.icon.size.h*a))},setOpacity:function(a){this.icon.setOpacity(a)},
setUrl:function(a){this.icon.setUrl(a)},display:function(a){this.icon.display(a)},CLASS_NAME:"OpenLayers.Marker"});OpenLayers.Marker.defaultIcon=function(){var a=OpenLayers.Util.getImagesLocation()+"marker.png",b=new OpenLayers.Size(21,25);return new OpenLayers.Icon(a,b,null,function(c){return new OpenLayers.Pixel(-(c.w/2),-c.h)})};
OpenLayers.Marker.Box=OpenLayers.Class(OpenLayers.Marker,{bounds:null,div:null,initialize:function(a,b,c){this.bounds=a;this.div=OpenLayers.Util.createDiv();this.div.style.overflow="hidden";this.events=new OpenLayers.Events(this,this.div,null);this.setBorder(b,c)},destroy:function(){this.div=this.bounds=null;OpenLayers.Marker.prototype.destroy.apply(this,arguments)},setBorder:function(a,b){a||(a="red");b||(b=2);this.div.style.border=b+"px solid "+a},draw:function(a,b){OpenLayers.Util.modifyDOMElement(this.div,
null,a,b);return this.div},onScreen:function(){var a=false;if(this.map)a=this.map.getExtent().containsBounds(this.bounds,true,true);return a},display:function(a){this.div.style.display=a?"":"none"},CLASS_NAME:"OpenLayers.Marker.Box"});
OpenLayers.Popup=OpenLayers.Class({events:null,id:"",lonlat:null,div:null,contentSize:null,size:null,contentHTML:null,backgroundColor:"",opacity:"",border:"",contentDiv:null,groupDiv:null,closeDiv:null,autoSize:false,minSize:null,maxSize:null,displayClass:"olPopup",contentDisplayClass:"olPopupContent",padding:0,disableFirefoxOverflowHack:false,fixPadding:function(){if(typeof this.padding=="number")this.padding=new OpenLayers.Bounds(this.padding,this.padding,this.padding,this.padding)},panMapIfOutOfView:false,
keepInMap:false,closeOnMove:false,map:null,initialize:function(a,b,c,d,e,f){if(a==null)a=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");this.id=a;this.lonlat=b;this.contentSize=c!=null?c:new OpenLayers.Size(OpenLayers.Popup.WIDTH,OpenLayers.Popup.HEIGHT);if(d!=null)this.contentHTML=d;this.backgroundColor=OpenLayers.Popup.COLOR;this.opacity=OpenLayers.Popup.OPACITY;this.border=OpenLayers.Popup.BORDER;this.div=OpenLayers.Util.createDiv(this.id,null,null,null,null,null,"hidden");this.div.className=
this.displayClass;this.groupDiv=OpenLayers.Util.createDiv(this.id+"_GroupDiv",null,null,null,"relative",null,"hidden");a=this.div.id+"_contentDiv";this.contentDiv=OpenLayers.Util.createDiv(a,null,this.contentSize.clone(),null,"relative");this.contentDiv.className=this.contentDisplayClass;this.groupDiv.appendChild(this.contentDiv);this.div.appendChild(this.groupDiv);e&&this.addCloseBox(f);this.registerEvents()},destroy:function(){this.border=this.opacity=this.backgroundColor=this.contentHTML=this.size=
this.lonlat=this.id=null;this.closeOnMove&&this.map&&this.map.events.unregister("movestart",this,this.hide);this.events.destroy();this.events=null;if(this.closeDiv){OpenLayers.Event.stopObservingElement(this.closeDiv);this.groupDiv.removeChild(this.closeDiv)}this.closeDiv=null;this.div.removeChild(this.groupDiv);this.groupDiv=null;this.map!=null&&this.map.removePopup(this);this.panMapIfOutOfView=this.padding=this.maxSize=this.minSize=this.autoSize=this.div=this.map=null},draw:function(a){if(a==null)if(this.lonlat!=
null&&this.map!=null)a=this.map.getLayerPxFromLonLat(this.lonlat);this.closeOnMove&&this.map.events.register("movestart",this,this.hide);if(!this.disableFirefoxOverflowHack&&OpenLayers.Util.getBrowserName()=="firefox"){this.map.events.register("movestart",this,function(){var b=document.defaultView.getComputedStyle(this.contentDiv,null).getPropertyValue("overflow");if(b!="hidden"){this.contentDiv._oldOverflow=b;this.contentDiv.style.overflow="hidden"}});this.map.events.register("moveend",this,function(){var b=
this.contentDiv._oldOverflow;if(b){this.contentDiv.style.overflow=b;this.contentDiv._oldOverflow=null}})}this.moveTo(a);!this.autoSize&&!this.size&&this.setSize(this.contentSize);this.setBackgroundColor();this.setOpacity();this.setBorder();this.setContentHTML();this.panMapIfOutOfView&&this.panIntoView();return this.div},updatePosition:function(){if(this.lonlat&&this.map){var a=this.map.getLayerPxFromLonLat(this.lonlat);a&&this.moveTo(a)}},moveTo:function(a){if(a!=null&&this.div!=null){this.div.style.left=
a.x+"px";this.div.style.top=a.y+"px"}},visible:function(){return OpenLayers.Element.visible(this.div)},toggle:function(){this.visible()?this.hide():this.show()},show:function(){OpenLayers.Element.show(this.div);this.panMapIfOutOfView&&this.panIntoView()},hide:function(){OpenLayers.Element.hide(this.div)},setSize:function(a){this.size=a.clone();var b=this.getContentDivPadding(),c=b.left+b.right,d=b.top+b.bottom;this.fixPadding();c+=this.padding.left+this.padding.right;d+=this.padding.top+this.padding.bottom;
if(this.closeDiv){var e=parseInt(this.closeDiv.style.width);c+=e+b.right}this.size.w+=c;this.size.h+=d;if(OpenLayers.Util.getBrowserName()=="msie"){this.contentSize.w+=b.left+b.right;this.contentSize.h+=b.bottom+b.top}if(this.div!=null){this.div.style.width=this.size.w+"px";this.div.style.height=this.size.h+"px"}if(this.contentDiv!=null){this.contentDiv.style.width=a.w+"px";this.contentDiv.style.height=a.h+"px"}},updateSize:function(){var a="<div class='"+this.contentDisplayClass+"'>"+this.contentDiv.innerHTML+
"</div>",b=this.map?this.map.layerContainerDiv:document.body,c=OpenLayers.Util.getRenderedDimensions(a,null,{displayClass:this.displayClass,containerElement:b}),d=this.getSafeContentSize(c),e=null;if(d.equals(c))e=c;else{e=new OpenLayers.Size;e.w=d.w<c.w?d.w:null;e.h=d.h<c.h?d.h:null;if(e.w&&e.h)e=d;else{a=OpenLayers.Util.getRenderedDimensions(a,e,{displayClass:this.contentDisplayClass,containerElement:b});if(OpenLayers.Element.getStyle(this.contentDiv,"overflow")!="hidden"&&a.equals(d)){d=OpenLayers.Util.getScrollbarWidth();
if(e.w)a.h+=d;else a.w+=d}e=this.getSafeContentSize(a)}}this.setSize(e)},setBackgroundColor:function(a){if(a!=undefined)this.backgroundColor=a;if(this.div!=null)this.div.style.backgroundColor=this.backgroundColor},setOpacity:function(a){if(a!=undefined)this.opacity=a;if(this.div!=null){this.div.style.opacity=this.opacity;this.div.style.filter="alpha(opacity="+this.opacity*100+")"}},setBorder:function(a){if(a!=undefined)this.border=a;if(this.div!=null)this.div.style.border=this.border},setContentHTML:function(a){if(a!=
null)this.contentHTML=a;if(this.contentDiv!=null&&this.contentHTML!=null&&this.contentHTML!=this.contentDiv.innerHTML){this.contentDiv.innerHTML=this.contentHTML;if(this.autoSize){this.registerImageListeners();this.updateSize()}}},registerImageListeners:function(){for(var a=function(){this.popup.updateSize();this.popup.visible()&&this.popup.panMapIfOutOfView&&this.popup.panIntoView();OpenLayers.Event.stopObserving(this.img,"load",this.img._onImageLoad)},b=this.contentDiv.getElementsByTagName("img"),
c=0,d=b.length;c<d;c++){var e=b[c];if(e.width==0||e.height==0){e._onImgLoad=OpenLayers.Function.bind(a,{popup:this,img:e});OpenLayers.Event.observe(e,"load",e._onImgLoad)}}},getSafeContentSize:function(a){a=a.clone();var b=this.getContentDivPadding(),c=b.left+b.right,d=b.top+b.bottom;this.fixPadding();c+=this.padding.left+this.padding.right;d+=this.padding.top+this.padding.bottom;if(this.closeDiv){var e=parseInt(this.closeDiv.style.width);c+=e+b.right}if(this.minSize){a.w=Math.max(a.w,this.minSize.w-
c);a.h=Math.max(a.h,this.minSize.h-d)}if(this.maxSize){a.w=Math.min(a.w,this.maxSize.w-c);a.h=Math.min(a.h,this.maxSize.h-d)}if(this.map&&this.map.size){e=b=0;if(this.keepInMap&&!this.panMapIfOutOfView){e=this.map.getPixelFromLonLat(this.lonlat);switch(this.relativePosition){case "tr":b=e.x;e=this.map.size.h-e.y;break;case "tl":b=this.map.size.w-e.x;e=this.map.size.h-e.y;break;case "bl":b=this.map.size.w-e.x;e=e.y;break;case "br":b=e.x;e=e.y;break;default:b=e.x;e=this.map.size.h-e.y;break}}d=this.map.size.h-
this.map.paddingForPopups.top-this.map.paddingForPopups.bottom-d-e;a.w=Math.min(a.w,this.map.size.w-this.map.paddingForPopups.left-this.map.paddingForPopups.right-c-b);a.h=Math.min(a.h,d)}return a},getContentDivPadding:function(){var a=this._contentDivPadding;if(!a){if(this.div.parentNode==null){this.div.style.display="none";document.body.appendChild(this.div)}this._contentDivPadding=a=new OpenLayers.Bounds(OpenLayers.Element.getStyle(this.contentDiv,"padding-left"),OpenLayers.Element.getStyle(this.contentDiv,
"padding-bottom"),OpenLayers.Element.getStyle(this.contentDiv,"padding-right"),OpenLayers.Element.getStyle(this.contentDiv,"padding-top"));if(this.div.parentNode==document.body){document.body.removeChild(this.div);this.div.style.display=""}}return a},addCloseBox:function(a){this.closeDiv=OpenLayers.Util.createDiv(this.id+"_close",null,new OpenLayers.Size(17,17));this.closeDiv.className="olPopupCloseBox";var b=this.getContentDivPadding();this.closeDiv.style.right=b.right+"px";this.closeDiv.style.top=
b.top+"px";this.groupDiv.appendChild(this.closeDiv);OpenLayers.Event.observe(this.closeDiv,"click",OpenLayers.Function.bindAsEventListener(a||function(c){this.hide();OpenLayers.Event.stop(c)},this))},panIntoView:function(){var a=this.map.getSize(),b=this.map.getViewPortPxFromLayerPx(new OpenLayers.Pixel(parseInt(this.div.style.left),parseInt(this.div.style.top))),c=b.clone();if(b.x<this.map.paddingForPopups.left)c.x=this.map.paddingForPopups.left;else if(b.x+this.size.w>a.w-this.map.paddingForPopups.right)c.x=
a.w-this.map.paddingForPopups.right-this.size.w;if(b.y<this.map.paddingForPopups.top)c.y=this.map.paddingForPopups.top;else if(b.y+this.size.h>a.h-this.map.paddingForPopups.bottom)c.y=a.h-this.map.paddingForPopups.bottom-this.size.h;this.map.pan(b.x-c.x,b.y-c.y)},registerEvents:function(){this.events=new OpenLayers.Events(this,this.div,null,true);this.events.on({mousedown:this.onmousedown,mousemove:this.onmousemove,mouseup:this.onmouseup,click:this.onclick,mouseout:this.onmouseout,dblclick:this.ondblclick,
scope:this})},onmousedown:function(a){this.mousedown=true;OpenLayers.Event.stop(a,true)},onmousemove:function(a){this.mousedown&&OpenLayers.Event.stop(a,true)},onmouseup:function(a){if(this.mousedown){this.mousedown=false;OpenLayers.Event.stop(a,true)}},onclick:function(a){OpenLayers.Event.stop(a,true)},onmouseout:function(){this.mousedown=false},ondblclick:function(a){OpenLayers.Event.stop(a,true)},CLASS_NAME:"OpenLayers.Popup"});OpenLayers.Popup.WIDTH=200;OpenLayers.Popup.HEIGHT=200;
OpenLayers.Popup.COLOR="white";OpenLayers.Popup.OPACITY=1;OpenLayers.Popup.BORDER="0px";
OpenLayers.Tile=OpenLayers.Class({EVENT_TYPES:["loadstart","loadend","reload","unload"],events:null,id:null,layer:null,url:null,bounds:null,size:null,position:null,isLoading:false,initialize:function(a,b,c,d,e){this.layer=a;this.position=b.clone();this.bounds=c.clone();this.url=d;this.size=e.clone();this.id=OpenLayers.Util.createUniqueID("Tile_");this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES)},unload:function(){if(this.isLoading){this.isLoading=false;this.events.triggerEvent("unload")}},
destroy:function(){this.position=this.size=this.bounds=this.layer=null;this.events.destroy();this.events=null},clone:function(a){if(a==null)a=new OpenLayers.Tile(this.layer,this.position,this.bounds,this.url,this.size);OpenLayers.Util.applyDefaults(a,this);return a},draw:function(){var a=this.layer.maxExtent;this.shouldDraw=a&&this.bounds.intersectsBounds(a,false)||this.layer.displayOutsideMaxExtent;this.clear();return this.shouldDraw},moveTo:function(a,b,c){if(c==null)c=true;this.bounds=a.clone();
this.position=b.clone();c&&this.draw()},clear:function(){},getBoundsFromBaseLayer:function(a){var b=OpenLayers.i18n("reprojectDeprecated",{layerName:this.layer.name});OpenLayers.Console.warn(b);b=this.layer.map.getLonLatFromLayerPx(a);a=a.clone();a.x+=this.size.w;a.y+=this.size.h;a=this.layer.map.getLonLatFromLayerPx(a);if(b.lon>a.lon)if(b.lon<0)b.lon=-180-(b.lon+180);else a.lon=180+a.lon+180;return new OpenLayers.Bounds(b.lon,a.lat,a.lon,b.lat)},showTile:function(){this.shouldDraw&&this.show()},
show:function(){},hide:function(){},CLASS_NAME:"OpenLayers.Tile"});var tileNum=0;function debug(){}
OpenLayers.Tile.Image=OpenLayers.Class(OpenLayers.Tile,{url:null,imgDiv:null,frame:null,layerAlphaHack:null,isBackBuffer:false,lastRatio:1,isFirstDraw:true,backBufferTile:null,initialize:function(a,b,c,d){OpenLayers.Tile.prototype.initialize.apply(this,arguments);this.url=d;this.frame=document.createElement("div");this.frame.style.overflow="hidden";this.frame.style.position="absolute";this.layerAlphaHack=this.layer.alpha&&OpenLayers.Util.alphaHack();this.tileId=tileNum++},destroy:function(){if(this.imgDiv!=
null){this.layerAlphaHack&&OpenLayers.Event.stopObservingElement(this.imgDiv.childNodes[0]);OpenLayers.Event.stopObservingElement(this.imgDiv);if(this.imgDiv.parentNode==this.frame){this.frame.removeChild(this.imgDiv);this.imgDiv.map=null}this.imgDiv.urls=null;this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif"}this.imgDiv=null;this.frame!=null&&this.frame.parentNode==this.layer.div&&this.layer.div.removeChild(this.frame);this.frame=null;if(this.backBufferTile){this.backBufferTile.destroy();
this.backBufferTile=null}this.layer.events.unregister("loadend",this,this.resetBackBuffer);OpenLayers.Tile.prototype.destroy.apply(this,arguments)},clone:function(a){if(a==null)a=new OpenLayers.Tile.Image(this.layer,this.position,this.bounds,this.url,this.size);a=OpenLayers.Tile.prototype.clone.apply(this,[a]);a.imgDiv=null;return a},draw:function(){if(this.layer!=this.layer.map.baseLayer&&this.layer.reproject)this.bounds=this.getBoundsFromBaseLayer(this.position);var a=OpenLayers.Tile.prototype.draw.apply(this,
arguments);debug(this,"draw",a);debug(this,"isBackBufferTile",this.backBufferTile!=null);if(OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1)if(a){if(!this.backBufferTile){debug(this,"creating & hiding back buffer - no image set yet");this.backBufferTile=this.clone();this.backBufferTile.hide();this.backBufferTile.isBackBuffer=true;this.events.register("loadend",this,this.resetBackBuffer);this.layer.events.register("loadend",this,this.resetBackBuffer)}this.startTransition()}else this.backBufferTile&&
this.backBufferTile.clear();else if(a&&this.isFirstDraw){this.events.register("loadend",this,this.showTile);this.isFirstDraw=false}if(!a)return false;if(this.isLoading)this.events.triggerEvent("reload");else{this.isLoading=true;this.events.triggerEvent("loadstart")}return this.renderTile()},resetBackBuffer:function(){debug(this,"resetBackBuffer",this.backBufferTile!=null,this.isFirstDraw,this.layer.numLoadingTiles,this.backBufferTile&&(this.isFirstDraw||!this.layer.numLoadingTiles));this.showTile();
if(this.backBufferTile&&(this.isFirstDraw||!this.layer.numLoadingTiles)){this.isFirstDraw=false;var a=this.layer.maxExtent;if(a&&this.bounds.intersectsBounds(a,false)){this.backBufferTile.position=this.position;this.backBufferTile.bounds=this.bounds;this.backBufferTile.size=this.size;this.backBufferTile.imageSize=this.layer.getImageSize(this.bounds)||this.size;this.backBufferTile.imageOffset=this.layer.imageOffset;this.backBufferTile.resolution=this.layer.getResolution();this.backBufferTile.renderTile()}this.backBufferTile.hide()}},
renderTile:function(){debug(this,"renderTile");this.imgDiv==null&&this.initImgDiv();this.imgDiv.viewRequestID=this.layer.map.viewRequestID;if(this.layer.async)this.layer.getURLasync(this.bounds,this,"url",this.positionImage);else{if(this.layer.url instanceof Array)this.imgDiv.urls=this.layer.url.slice();this.url=this.layer.getURL(this.bounds);this.positionImage()}return true},positionImage:function(){if(this.layer!=null){OpenLayers.Util.modifyDOMElement(this.frame,null,this.position,this.size);var a=
this.layer.getImageSize(this.bounds);if(this.layerAlphaHack)OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv,null,null,a,this.url);else{OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,a);this.imgDiv.src=this.url}}},clear:function(){if(this.imgDiv){debug(this,"clearing image div");this.hide();if(OpenLayers.Tile.Image.useBlankTile)this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif"}},initImgDiv:function(){debug(this,"initImgDiv");var a=this.layer.imageOffset,b=this.layer.getImageSize(this.bounds);
this.imgDiv=this.layerAlphaHack?OpenLayers.Util.createAlphaImageDiv(null,a,b,null,"relative",null,null,null,true):OpenLayers.Util.createImage(null,a,b,null,"relative",null,null,true);this.imgDiv.className="olTileImage";this.frame.style.zIndex=this.isBackBuffer?0:1;this.frame.appendChild(this.imgDiv);this.layer.div.appendChild(this.frame);this.layer.opacity!=null&&OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,null,null,null,null,this.layer.opacity);this.imgDiv.map=this.layer.map;var c=function(){if(this.isLoading){this.isLoading=
false;this.events.triggerEvent("loadend")}};this.layerAlphaHack?OpenLayers.Event.observe(this.imgDiv.childNodes[0],"load",OpenLayers.Function.bind(c,this)):OpenLayers.Event.observe(this.imgDiv,"load",OpenLayers.Function.bind(c,this));OpenLayers.Event.observe(this.imgDiv,"error",OpenLayers.Function.bind(function(){this.imgDiv._attempts>OpenLayers.IMAGE_RELOAD_ATTEMPTS&&c.call(this)},this))},checkImgURL:function(){if(this.layer)OpenLayers.Util.isEquivalentUrl(this.layerAlphaHack?this.imgDiv.firstChild.src:
this.imgDiv.src,this.url)||this.hide()},startTransition:function(){debug(this,"startTransition");if(!this.backBufferTile||!this.backBufferTile.imgDiv)debug(this,"back buffer not valid");else{var a=1;if(this.backBufferTile.resolution)a=this.backBufferTile.resolution/this.layer.getResolution();debug(this,"back buffer tile ratio ",a," last ratio",this.lastRatio," rejigging ",a!=this.lastRatio);if(a!=this.lastRatio){if(this.layer.transitionEffect=="resize"){debug(this,"resizing");var b=new OpenLayers.LonLat(this.backBufferTile.bounds.left,
this.backBufferTile.bounds.top),c=new OpenLayers.Size(this.backBufferTile.size.w*a,this.backBufferTile.size.h*a);b=this.layer.map.getLayerPxFromLonLat(b);OpenLayers.Util.modifyDOMElement(this.backBufferTile.frame,null,b,c);c=this.backBufferTile.imageSize;c=new OpenLayers.Size(c.w*a,c.h*a);if(b=this.backBufferTile.imageOffset)b=new OpenLayers.Pixel(b.x*a,b.y*a);OpenLayers.Util.modifyDOMElement(this.backBufferTile.imgDiv,null,b,c);this.backBufferTile.show()}}else{if(!this.layer.singleTile){b=new OpenLayers.LonLat(this.backBufferTile.bounds.left,
this.backBufferTile.bounds.top);c=new OpenLayers.Size(this.backBufferTile.size.w*a,this.backBufferTile.size.h*a);b=this.layer.map.getLayerPxFromLonLat(b);OpenLayers.Util.modifyDOMElement(this.backBufferTile.frame,null,b,c);c=this.backBufferTile.imageSize;c=new OpenLayers.Size(c.w*a,c.h*a);if(b=this.backBufferTile.imageOffset)b=new OpenLayers.Pixel(b.x*a,b.y*a);OpenLayers.Util.modifyDOMElement(this.backBufferTile.imgDiv,null,b,c)}this.backBufferTile.show()}this.lastRatio=a}},show:function(){this.frame.style.display=
"";if(OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1)if(navigator.userAgent.toLowerCase().indexOf("gecko")!=-1)this.frame.scrollLeft=this.frame.scrollLeft},hide:function(){this.frame.style.display="none"},CLASS_NAME:"OpenLayers.Tile.Image"});OpenLayers.Tile.Image.useBlankTile=OpenLayers.Util.getBrowserName()=="safari"||OpenLayers.Util.getBrowserName()=="opera";
OpenLayers.Tile.WFS=OpenLayers.Class(OpenLayers.Tile,{features:null,url:null,request:null,initialize:function(a,b,c,d){OpenLayers.Tile.prototype.initialize.apply(this,arguments);this.url=d;this.features=[]},destroy:function(){OpenLayers.Tile.prototype.destroy.apply(this,arguments);this.destroyAllFeatures();this.url=this.features=null;if(this.request){this.request.abort();this.request=null}},clear:function(){this.destroyAllFeatures()},draw:function(){if(OpenLayers.Tile.prototype.draw.apply(this,arguments)){if(this.isLoading)this.events.triggerEvent("reload");
else{this.isLoading=true;this.events.triggerEvent("loadstart")}this.loadFeaturesForRegion(this.requestSuccess)}},loadFeaturesForRegion:function(a,b){this.request&&this.request.abort();this.request=OpenLayers.Request.GET({url:this.url,success:a,failure:b,scope:this})},requestSuccess:function(a){if(this.features){var b=a.responseXML;if(!b||!b.documentElement)b=a.responseText;if(this.layer.vectorMode)this.layer.addFeatures(this.layer.formatObject.read(b));else{a=new OpenLayers.Format.XML;if(typeof b==
"string")b=a.read(b);this.addResults(a.getElementsByTagNameNS(b,"http://www.opengis.net/gml","featureMember"))}}this.events&&this.events.triggerEvent("loadend");this.request=null},addResults:function(a){for(var b=0;b<a.length;b++)this.features.push(new this.layer.featureClass(this.layer,a[b]))},destroyAllFeatures:function(){for(;this.features.length>0;)this.features.shift().destroy()},CLASS_NAME:"OpenLayers.Tile.WFS"});
OpenLayers.Layer.Image=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:true,url:null,extent:null,size:null,tile:null,aspectRatio:null,initialize:function(a,b,c,d,e){this.url=b;this.maxExtent=this.extent=c;this.size=d;OpenLayers.Layer.prototype.initialize.apply(this,[a,e]);this.aspectRatio=this.extent.getHeight()/this.size.h/(this.extent.getWidth()/this.size.w)},destroy:function(){if(this.tile){this.removeTileMonitoringHooks(this.tile);this.tile.destroy();this.tile=null}OpenLayers.Layer.prototype.destroy.apply(this,
arguments)},clone:function(a){if(a==null)a=new OpenLayers.Layer.Image(this.name,this.url,this.extent,this.size,this.options);return a=OpenLayers.Layer.prototype.clone.apply(this,[a])},setMap:function(){if(this.options.maxResolution==null)this.options.maxResolution=this.aspectRatio*this.extent.getWidth()/this.size.w;OpenLayers.Layer.prototype.setMap.apply(this,arguments)},moveTo:function(a,b){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);var c=this.tile==null;if(b||c){this.setTileSize();
var d=this.map.getLayerPxFromLonLat(new OpenLayers.LonLat(this.extent.left,this.extent.top));if(c){this.tile=new OpenLayers.Tile.Image(this,d,this.extent,null,this.tileSize);this.addTileMonitoringHooks(this.tile)}else{this.tile.size=this.tileSize.clone();this.tile.position=d.clone()}this.tile.draw()}},setTileSize:function(){var a=this.extent.getWidth()/this.map.getResolution(),b=this.extent.getHeight()/this.map.getResolution();this.tileSize=new OpenLayers.Size(a,b)},addTileMonitoringHooks:function(a){a.onLoadStart=
function(){this.events.triggerEvent("loadstart")};a.events.register("loadstart",this,a.onLoadStart);a.onLoadEnd=function(){this.events.triggerEvent("loadend")};a.events.register("loadend",this,a.onLoadEnd);a.events.register("unload",this,a.onLoadEnd)},removeTileMonitoringHooks:function(a){a.unload();a.events.un({loadstart:a.onLoadStart,loadend:a.onLoadEnd,unload:a.onLoadEnd,scope:this})},setUrl:function(a){this.url=a;this.tile.draw()},getURL:function(){return this.url},CLASS_NAME:"OpenLayers.Layer.Image"});
OpenLayers.Layer.FixedZoomLevels=OpenLayers.Class({initialize:function(){},initResolutions:function(){for(var a=new Array("minZoomLevel","maxZoomLevel","numZoomLevels"),b=0,c=a.length;b<c;b++){var d=a[b];this[d]=this.options[d]!=null?this.options[d]:this.map[d]}if(this.minZoomLevel==null||this.minZoomLevel<this.MIN_ZOOM_LEVEL)this.minZoomLevel=this.MIN_ZOOM_LEVEL;a=this.MAX_ZOOM_LEVEL-this.minZoomLevel+1;b=this.options.numZoomLevels==null&&this.options.maxZoomLevel!=null||this.numZoomLevels==null&&
this.maxZoomLevel!=null?this.maxZoomLevel-this.minZoomLevel+1:this.numZoomLevels;this.numZoomLevels=b!=null?Math.min(b,a):a;this.maxZoomLevel=this.minZoomLevel+this.numZoomLevels-1;if(this.RESOLUTIONS!=null){a=0;this.resolutions=[];for(b=this.minZoomLevel;b<=this.maxZoomLevel;b++)this.resolutions[a++]=this.RESOLUTIONS[b];this.maxResolution=this.resolutions[0];this.minResolution=this.resolutions[this.resolutions.length-1]}},getResolution:function(){if(this.resolutions!=null)return OpenLayers.Layer.prototype.getResolution.apply(this,
arguments);else{var a=null,b=this.map.getSize(),c=this.getExtent();if(b!=null&&c!=null)a=Math.max(c.getWidth()/b.w,c.getHeight()/b.h);return a}},getExtent:function(){var a=null,b=this.map.getSize(),c=this.getLonLatFromViewPortPx(new OpenLayers.Pixel(0,0));b=this.getLonLatFromViewPortPx(new OpenLayers.Pixel(b.w,b.h));if(c!=null&&b!=null)a=new OpenLayers.Bounds(c.lon,b.lat,b.lon,c.lat);return a},getZoomForResolution:function(){return this.resolutions!=null?OpenLayers.Layer.prototype.getZoomForResolution.apply(this,
arguments):this.getZoomForExtent(OpenLayers.Layer.prototype.getExtent.apply(this,[]))},getOLZoomFromMapObjectZoom:function(a){var b=null;if(a!=null)b=a-this.minZoomLevel;return b},getMapObjectZoomFromOLZoom:function(a){var b=null;if(a!=null)b=a+this.minZoomLevel;return b},CLASS_NAME:"OpenLayers.Layer.FixedZoomLevels"});
OpenLayers.Layer.HTTPRequest=OpenLayers.Class(OpenLayers.Layer,{URL_HASH_FACTOR:(Math.sqrt(5)-1)/2,url:null,params:null,reproject:false,initialize:function(a,b,c,d){var e=arguments;e=[a,d];OpenLayers.Layer.prototype.initialize.apply(this,e);this.url=b;this.params=OpenLayers.Util.extend({},c)},destroy:function(){this.params=this.url=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(a){if(a==null)a=new OpenLayers.Layer.HTTPRequest(this.name,this.url,this.params,this.options);
return a=OpenLayers.Layer.prototype.clone.apply(this,[a])},setUrl:function(a){this.url=a},mergeNewParams:function(a){this.params=OpenLayers.Util.extend(this.params,a);return this.redraw()},redraw:function(a){return a?this.mergeNewParams({_olSalt:Math.random()}):OpenLayers.Layer.prototype.redraw.apply(this,[])},selectUrl:function(a,b){for(var c=1,d=0,e=a.length;d<e;d++){c*=a.charCodeAt(d)*this.URL_HASH_FACTOR;c-=Math.floor(c)}return b[Math.floor(c*b.length)]},getFullRequestString:function(a,b){b=b||
this.url;var c=OpenLayers.Util.extend({},this.params);c=OpenLayers.Util.extend(c,a);a=OpenLayers.Util.getParameterString(c);if(b instanceof Array)b=this.selectUrl(a,b);a=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(b));for(var d in c)d.toUpperCase()in a&&delete c[d];a=OpenLayers.Util.getParameterString(c);d=b;if(a!=""){c=b.charAt(b.length-1);d+=c=="&"||c=="?"?a:b.indexOf("?")==-1?"?"+a:"&"+a}return d},CLASS_NAME:"OpenLayers.Layer.HTTPRequest"});
OpenLayers.Layer.Grid=OpenLayers.Class(OpenLayers.Layer.HTTPRequest,{tileSize:null,grid:null,singleTile:false,ratio:1.5,buffer:0,numLoadingTiles:0,initialize:function(){OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,arguments);this.events.addEventType("tileloaded");this.grid=[]},destroy:function(){this.clearGrid();this.tileSize=this.grid=null;OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this,arguments)},clearGrid:function(){if(this.grid){for(var a=0,b=this.grid.length;a<b;a++)for(var c=
this.grid[a],d=0,e=c.length;d<e;d++){var f=c[d];this.removeTileMonitoringHooks(f);f.destroy()}this.grid=[]}},clone:function(a){if(a==null)a=new OpenLayers.Layer.Grid(this.name,this.url,this.params,this.options);a=OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this,[a]);if(this.tileSize!=null)a.tileSize=this.tileSize.clone();a.grid=[];return a},moveTo:function(a,b,c){OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this,arguments);a=a||this.map.getExtent();if(a!=null){var d=!this.grid.length||
b,e=this.getTilesBounds();if(this.singleTile){if(d||!c&&!e.containsBounds(a))this.initSingleTile(a)}else d||!e.containsBounds(a,true)?this.initGriddedTiles(a):this.moveGriddedTiles(a)}},setTileSize:function(a){if(this.singleTile){a=this.map.getSize().clone();a.h=parseInt(a.h*this.ratio);a.w=parseInt(a.w*this.ratio)}OpenLayers.Layer.HTTPRequest.prototype.setTileSize.apply(this,[a])},getGridBounds:function(){OpenLayers.Console.warn("The getGridBounds() function is deprecated. It will be removed in 3.0. Please use getTilesBounds() instead.");
return this.getTilesBounds()},getTilesBounds:function(){var a=null;if(this.grid.length){a=this.grid[this.grid.length-1][0];var b=this.grid[0][this.grid[0].length-1];a=new OpenLayers.Bounds(a.bounds.left,a.bounds.bottom,b.bounds.right,b.bounds.top)}return a},initSingleTile:function(a){var b=a.getCenterLonLat(),c=a.getWidth()*this.ratio;a=a.getHeight()*this.ratio;b=new OpenLayers.Bounds(b.lon-c/2,b.lat-a/2,b.lon+c/2,b.lat+a/2);c=this.map.getLayerPxFromLonLat(new OpenLayers.LonLat(b.left,b.top));this.grid.length||
(this.grid[0]=[]);if(a=this.grid[0][0])a.moveTo(b,c);else{a=this.addTile(b,c);this.addTileMonitoringHooks(a);a.draw();this.grid[0][0]=a}this.removeExcessTiles(1,1)},calculateGridLayout:function(a,b,c){var d=c*this.tileSize.w;c=c*this.tileSize.h;var e=a.left-b.left,f=Math.floor(e/d)-this.buffer;e=-(e/d-f)*this.tileSize.w;f=b.left+f*d;a=a.top-(b.bottom+c);var g=Math.ceil(a/c)+this.buffer;return{tilelon:d,tilelat:c,tileoffsetlon:f,tileoffsetlat:b.bottom+g*c,tileoffsetx:e,tileoffsety:-(g-a/c)*this.tileSize.h}},
initGriddedTiles:function(a){var b=this.map.getSize(),c=Math.ceil(b.h/this.tileSize.h)+Math.max(1,2*this.buffer);b=Math.ceil(b.w/this.tileSize.w)+Math.max(1,2*this.buffer);var d=this.maxExtent,e=this.map.getResolution(),f=this.calculateGridLayout(a,d,e);d=Math.round(f.tileoffsetx);e=Math.round(f.tileoffsety);var g=f.tileoffsetlon,i=f.tileoffsetlat,h=f.tilelon;f=f.tilelat;this.origin=new OpenLayers.Pixel(d,e);var j=d,k=g,l=0,n=parseInt(this.map.layerContainerDiv.style.left),m=parseInt(this.map.layerContainerDiv.style.top);
do{var o=this.grid[l++];if(!o){o=[];this.grid.push(o)}g=k;d=j;var p=0;do{var q=new OpenLayers.Bounds(g,i,g+h,i+f),r=d;r-=n;var s=e;s-=m;r=new OpenLayers.Pixel(r,s);if(s=o[p++])s.moveTo(q,r,false);else{s=this.addTile(q,r);this.addTileMonitoringHooks(s);o.push(s)}g+=h;d+=this.tileSize.w}while(g<=a.right+h*this.buffer||p<b);i-=f;e+=this.tileSize.h}while(i>=a.bottom-f*this.buffer||l<c);this.removeExcessTiles(l,p);this.spiralTileLoad()},spiralTileLoad:function(){for(var a=[],b=["right","down","left","up"],
c=0,d=-1,e=OpenLayers.Util.indexOf(b,"right"),f=0;f<b.length;){var g=c,i=d;switch(b[e]){case "right":i++;break;case "down":g++;break;case "left":i--;break;case "up":g--;break}var h=null;if(g<this.grid.length&&g>=0&&i<this.grid[0].length&&i>=0)h=this.grid[g][i];if(h!=null&&!h.queued){a.unshift(h);h.queued=true;f=0;c=g;d=i}else{e=(e+1)%4;f++}}b=0;for(c=a.length;b<c;b++){h=a[b];h.draw();h.queued=false}},addTile:function(){},addTileMonitoringHooks:function(a){a.onLoadStart=function(){this.numLoadingTiles==
0&&this.events.triggerEvent("loadstart");this.numLoadingTiles++};a.events.register("loadstart",this,a.onLoadStart);a.onLoadEnd=function(){this.numLoadingTiles--;this.events.triggerEvent("tileloaded");this.numLoadingTiles==0&&this.events.triggerEvent("loadend")};a.events.register("loadend",this,a.onLoadEnd);a.events.register("unload",this,a.onLoadEnd)},removeTileMonitoringHooks:function(a){a.unload();a.events.un({loadstart:a.onLoadStart,loadend:a.onLoadEnd,unload:a.onLoadEnd,scope:this})},moveGriddedTiles:function(){for(var a=
this.buffer||1;;){var b=this.map.getViewPortPxFromLayerPx(this.grid[0][0].position);if(b.x>-this.tileSize.w*(a-1))this.shiftColumn(true);else if(b.x<-this.tileSize.w*a)this.shiftColumn(false);else if(b.y>-this.tileSize.h*(a-1))this.shiftRow(true);else if(b.y<-this.tileSize.h*a)this.shiftRow(false);else break}},shiftRow:function(a){var b=this.grid,c=b[a?0:this.grid.length-1],d=this.map.getResolution(),e=a?-this.tileSize.h:this.tileSize.h;d=d*-e;for(var f=a?b.pop():b.shift(),g=0,i=c.length;g<i;g++){var h=
c[g],j=h.bounds.clone();h=h.position.clone();j.bottom+=d;j.top+=d;h.y+=e;f[g].moveTo(j,h)}a?b.unshift(f):b.push(f)},shiftColumn:function(a){for(var b=a?-this.tileSize.w:this.tileSize.w,c=this.map.getResolution()*b,d=0,e=this.grid.length;d<e;d++){var f=this.grid[d],g=f[a?0:f.length-1],i=g.bounds.clone();g=g.position.clone();i.left+=c;i.right+=c;g.x+=b;var h=a?this.grid[d].pop():this.grid[d].shift();h.moveTo(i,g);a?f.unshift(h):f.push(h)}},removeExcessTiles:function(a,b){for(;this.grid.length>a;)for(var c=
this.grid.pop(),d=0,e=c.length;d<e;d++){var f=c[d];this.removeTileMonitoringHooks(f);f.destroy()}for(;this.grid[0].length>b;){d=0;for(e=this.grid.length;d<e;d++){c=this.grid[d];f=c.pop();this.removeTileMonitoringHooks(f);f.destroy()}}},onMapResize:function(){if(this.singleTile){this.clearGrid();this.setTileSize()}},getTileBounds:function(a){var b=this.maxExtent,c=this.getResolution(),d=c*this.tileSize.w;c=c*this.tileSize.h;var e=this.getLonLatFromViewPortPx(a);a=b.left+d*Math.floor((e.lon-b.left)/
d);b=b.bottom+c*Math.floor((e.lat-b.bottom)/c);return new OpenLayers.Bounds(a,b,a+d,b+c)},CLASS_NAME:"OpenLayers.Layer.Grid"});
OpenLayers.Layer.Markers=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:false,markers:null,drawn:false,initialize:function(){OpenLayers.Layer.prototype.initialize.apply(this,arguments);this.markers=[]},destroy:function(){this.clearMarkers();this.markers=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},setOpacity:function(a){if(a!=this.opacity){this.opacity=a;a=0;for(var b=this.markers.length;a<b;a++)this.markers[a].setOpacity(this.opacity)}},moveTo:function(a,b){OpenLayers.Layer.prototype.moveTo.apply(this,
arguments);if(b||!this.drawn){for(var c=0,d=this.markers.length;c<d;c++)this.drawMarker(this.markers[c]);this.drawn=true}},addMarker:function(a){this.markers.push(a);this.opacity!=null&&a.setOpacity(this.opacity);if(this.map&&this.map.getExtent()){a.map=this.map;this.drawMarker(a)}},removeMarker:function(a){if(this.markers&&this.markers.length){OpenLayers.Util.removeItem(this.markers,a);a.erase()}},clearMarkers:function(){if(this.markers!=null)for(;this.markers.length>0;)this.removeMarker(this.markers[0])},
drawMarker:function(a){var b=this.map.getLayerPxFromLonLat(a.lonlat);if(b==null)a.display(false);else if(a.isDrawn())a.icon&&a.icon.moveTo(b);else this.div.appendChild(a.draw(b))},getDataExtent:function(){var a=null;if(this.markers&&this.markers.length>0){a=new OpenLayers.Bounds;for(var b=0,c=this.markers.length;b<c;b++)a.extend(this.markers[b].lonlat)}return a},CLASS_NAME:"OpenLayers.Layer.Markers"});
OpenLayers.Layer.Text=OpenLayers.Class(OpenLayers.Layer.Markers,{location:null,features:null,formatOptions:null,selectedFeature:null,initialize:function(){OpenLayers.Layer.Markers.prototype.initialize.apply(this,arguments);this.features=[]},destroy:function(){OpenLayers.Layer.Markers.prototype.destroy.apply(this,arguments);this.clearFeatures();this.features=null},loadText:function(){if(!this.loaded)if(this.location!=null){this.events.triggerEvent("loadstart");OpenLayers.Request.GET({url:this.location,
success:this.parseData,failure:function(){this.events.triggerEvent("loadend")},scope:this});this.loaded=true}},moveTo:function(){OpenLayers.Layer.Markers.prototype.moveTo.apply(this,arguments);this.visibility&&!this.loaded&&this.loadText()},parseData:function(a){a=a.responseText;var b={};OpenLayers.Util.extend(b,this.formatOptions);if(this.map&&!this.projection.equals(this.map.getProjectionObject())){b.externalProjection=this.projection;b.internalProjection=this.map.getProjectionObject()}a=(new OpenLayers.Format.Text(b)).read(a);
b=0;for(var c=a.length;b<c;b++){var d={},e=a[b],f,g,i;f=new OpenLayers.LonLat(e.geometry.x,e.geometry.y);if(e.style.graphicWidth&&e.style.graphicHeight)g=new OpenLayers.Size(e.style.graphicWidth,e.style.graphicHeight);if(e.style.graphicXOffset!==undefined&&e.style.graphicYOffset!==undefined)i=new OpenLayers.Pixel(e.style.graphicXOffset,e.style.graphicYOffset);if(e.style.externalGraphic!=null)d.icon=new OpenLayers.Icon(e.style.externalGraphic,g,i);else{d.icon=OpenLayers.Marker.defaultIcon();g!=null&&
d.icon.setSize(g)}if(e.attributes.title!=null&&e.attributes.description!=null)d.popupContentHTML="<h2>"+e.attributes.title+"</h2><p>"+e.attributes.description+"</p>";d.overflow=e.attributes.overflow||"auto";d=new OpenLayers.Feature(this,f,d);this.features.push(d);f=d.createMarker();e.attributes.title!=null&&e.attributes.description!=null&&f.events.register("click",d,this.markerClick);this.addMarker(f)}this.events.triggerEvent("loadend")},markerClick:function(a){var b=this==this.layer.selectedFeature;
this.layer.selectedFeature=!b?this:null;for(var c=0,d=this.layer.map.popups.length;c<d;c++)this.layer.map.removePopup(this.layer.map.popups[c]);b||this.layer.map.addPopup(this.createPopup());OpenLayers.Event.stop(a)},clearFeatures:function(){if(this.features!=null)for(;this.features.length>0;){var a=this.features[0];OpenLayers.Util.removeItem(this.features,a);a.destroy()}},CLASS_NAME:"OpenLayers.Layer.Text"});
OpenLayers.Layer.WMS=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{service:"WMS",version:"1.1.1",request:"GetMap",styles:"",exceptions:"application/vnd.ogc.se_inimage",format:"image/jpeg"},reproject:false,isBaseLayer:true,encodeBBOX:false,noMagic:false,initialize:function(a,b,c,d){var e=[];c=OpenLayers.Util.upperCaseObject(c);e.push(a,b,c,d);OpenLayers.Layer.Grid.prototype.initialize.apply(this,e);OpenLayers.Util.applyDefaults(this.params,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS));
if(!this.noMagic&&this.params.TRANSPARENT&&this.params.TRANSPARENT.toString().toLowerCase()=="true"){if(d==null||!d.isBaseLayer)this.isBaseLayer=false;if(this.params.FORMAT=="image/jpeg")this.params.FORMAT=OpenLayers.Util.alphaHack()?"image/gif":"image/png"}},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments)},clone:function(a){if(a==null)a=new OpenLayers.Layer.WMS(this.name,this.url,this.params,this.options);return a=OpenLayers.Layer.Grid.prototype.clone.apply(this,
[a])},getURL:function(a){a=this.adjustBounds(a);var b=this.getImageSize();return this.getFullRequestString({BBOX:this.encodeBBOX?a.toBBOX():a.toArray(),WIDTH:b.w,HEIGHT:b.h})},addTile:function(a,b){return new OpenLayers.Tile.Image(this,b,a,null,this.tileSize)},mergeNewParams:function(a){a=[OpenLayers.Util.upperCaseObject(a)];return OpenLayers.Layer.Grid.prototype.mergeNewParams.apply(this,a)},getFullRequestString:function(){var a=this.map.getProjection();this.params.SRS=a=="none"?null:a;return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,
arguments)},CLASS_NAME:"OpenLayers.Layer.WMS"});
OpenLayers.Feature=OpenLayers.Class({layer:null,id:null,lonlat:null,data:null,marker:null,popupClass:OpenLayers.Popup.AnchoredBubble,popup:null,initialize:function(a,b,c){this.layer=a;this.lonlat=b;this.data=c!=null?c:{};this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){this.layer!=null&&this.layer.map!=null&&this.popup!=null&&this.layer.map.removePopup(this.popup);this.data=this.lonlat=this.id=this.layer=null;if(this.marker!=null){this.destroyMarker(this.marker);this.marker=
null}if(this.popup!=null){this.destroyPopup(this.popup);this.popup=null}},onScreen:function(){var a=false;if(this.layer!=null&&this.layer.map!=null)a=this.layer.map.getExtent().containsLonLat(this.lonlat);return a},createMarker:function(){if(this.lonlat!=null)this.marker=new OpenLayers.Marker(this.lonlat,this.data.icon);return this.marker},destroyMarker:function(){this.marker.destroy()},createPopup:function(a){if(this.lonlat!=null){var b=this.id+"_popup",c=this.marker?this.marker.icon:null;if(!this.popup)this.popup=
new this.popupClass(b,this.lonlat,this.data.popupSize,this.data.popupContentHTML,c,a);if(this.data.overflow!=null)this.popup.contentDiv.style.overflow=this.data.overflow;this.popup.feature=this}return this.popup},destroyPopup:function(){if(this.popup){this.popup.feature=null;this.popup.destroy();this.popup=null}},CLASS_NAME:"OpenLayers.Feature"});OpenLayers.State={UNKNOWN:"Unknown",INSERT:"Insert",UPDATE:"Update",DELETE:"Delete"};
OpenLayers.Feature.Vector=OpenLayers.Class(OpenLayers.Feature,{fid:null,geometry:null,attributes:null,bounds:null,state:null,style:null,renderIntent:"default",initialize:function(a,b,c){OpenLayers.Feature.prototype.initialize.apply(this,[null,null,b]);this.lonlat=null;this.geometry=a?a:null;this.state=null;this.attributes={};if(b)this.attributes=OpenLayers.Util.extend(this.attributes,b);this.style=c?c:null},destroy:function(){if(this.layer){this.layer.removeFeatures(this);this.layer=null}this.geometry=
null;OpenLayers.Feature.prototype.destroy.apply(this,arguments)},clone:function(){return new OpenLayers.Feature.Vector(this.geometry?this.geometry.clone():null,this.attributes,this.style)},onScreen:function(a){var b=false;if(this.layer&&this.layer.map){b=this.layer.map.getExtent();if(a){a=this.geometry.getBounds();b=b.intersectsBounds(a)}else b=b.toGeometry().intersects(this.geometry)}return b},createMarker:function(){return null},destroyMarker:function(){},createPopup:function(){return null},atPoint:function(a,
b,c){var d=false;if(this.geometry)d=this.geometry.atPoint(a,b,c);return d},destroyPopup:function(){},move:function(a){if(this.layer&&this.geometry.move){a=a.CLASS_NAME=="OpenLayers.LonLat"?this.layer.getViewPortPxFromLonLat(a):a;var b=this.layer.getViewPortPxFromLonLat(this.geometry.getBounds().getCenterLonLat()),c=this.layer.map.getResolution();this.geometry.move(c*(a.x-b.x),c*(b.y-a.y));this.layer.drawFeature(this);return b}},toState:function(a){if(a==OpenLayers.State.UPDATE)switch(this.state){case OpenLayers.State.UNKNOWN:case OpenLayers.State.DELETE:this.state=
a;break;case OpenLayers.State.UPDATE:case OpenLayers.State.INSERT:break}else if(a==OpenLayers.State.INSERT)switch(this.state){case OpenLayers.State.UNKNOWN:break;default:this.state=a;break}else if(a==OpenLayers.State.DELETE)switch(this.state){case OpenLayers.State.INSERT:break;case OpenLayers.State.DELETE:break;case OpenLayers.State.UNKNOWN:case OpenLayers.State.UPDATE:this.state=a;break}else if(a==OpenLayers.State.UNKNOWN)this.state=a},CLASS_NAME:"OpenLayers.Feature.Vector"});
OpenLayers.Feature.Vector.style={"default":{fillColor:"#ee9900",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#ee9900",strokeOpacity:1,strokeWidth:1,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},select:{fillColor:"blue",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"blue",strokeOpacity:1,
strokeWidth:2,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"pointer"},temporary:{fillColor:"#66cccc",fillOpacity:0.2,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#66cccc",strokeOpacity:1,strokeLinecap:"round",strokeWidth:2,strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,
hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},"delete":{display:"none"}};
OpenLayers.Feature.WFS=OpenLayers.Class(OpenLayers.Feature,{initialize:function(a,b){var c=arguments;c=this.processXMLNode(b);c=new Array(a,c.lonlat,c);OpenLayers.Feature.prototype.initialize.apply(this,c);this.createMarker();this.layer.addMarker(this.marker)},destroy:function(){this.marker!=null&&this.layer.removeMarker(this.marker);OpenLayers.Feature.prototype.destroy.apply(this,arguments)},processXMLNode:function(a){a=OpenLayers.Ajax.getElementsByTagNameNS(a,"http://www.opengis.net/gml","gml",
"Point");a=OpenLayers.Util.getXmlNodeValue(OpenLayers.Ajax.getElementsByTagNameNS(a[0],"http://www.opengis.net/gml","gml","coordinates")[0]).split(",");return{lonlat:new OpenLayers.LonLat(parseFloat(a[0]),parseFloat(a[1])),id:null}},CLASS_NAME:"OpenLayers.Feature.WFS"});
OpenLayers.Handler=OpenLayers.Class({id:null,control:null,map:null,keyMask:null,active:false,evt:null,initialize:function(a,b,c){OpenLayers.Util.extend(this,c);this.control=a;this.callbacks=b;a.map&&this.setMap(a.map);OpenLayers.Util.extend(this,c);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},setMap:function(a){this.map=a},checkModifiers:function(a){if(this.keyMask==null)return true;return((a.shiftKey?OpenLayers.Handler.MOD_SHIFT:0)|(a.ctrlKey?OpenLayers.Handler.MOD_CTRL:0)|(a.altKey?
OpenLayers.Handler.MOD_ALT:0))==this.keyMask},activate:function(){if(this.active)return false;for(var a=OpenLayers.Events.prototype.BROWSER_EVENTS,b=0,c=a.length;b<c;b++)this[a[b]]&&this.register(a[b],this[a[b]]);return this.active=true},deactivate:function(){if(!this.active)return false;for(var a=OpenLayers.Events.prototype.BROWSER_EVENTS,b=0,c=a.length;b<c;b++)this[a[b]]&&this.unregister(a[b],this[a[b]]);this.active=false;return true},callback:function(a,b){a&&this.callbacks[a]&&this.callbacks[a].apply(this.control,
b)},register:function(a,b){this.map.events.registerPriority(a,this,b);this.map.events.registerPriority(a,this,this.setEvent)},unregister:function(a,b){this.map.events.unregister(a,this,b);this.map.events.unregister(a,this,this.setEvent)},setEvent:function(a){this.evt=a;return true},destroy:function(){this.deactivate();this.control=this.map=null},CLASS_NAME:"OpenLayers.Handler"});OpenLayers.Handler.MOD_NONE=0;OpenLayers.Handler.MOD_SHIFT=1;OpenLayers.Handler.MOD_CTRL=2;OpenLayers.Handler.MOD_ALT=4;
OpenLayers.Handler.Click=OpenLayers.Class(OpenLayers.Handler,{delay:300,single:true,"double":false,pixelTolerance:0,stopSingle:false,stopDouble:false,timerId:null,down:null,rightclickTimerId:null,initialize:function(){OpenLayers.Handler.prototype.initialize.apply(this,arguments);if(this.pixelTolerance!=null)this.mousedown=function(a){this.down=a.xy;return true}},mousedown:null,mouseup:function(a){var b=true;if(this.checkModifiers(a)&&this.control.handleRightClicks&&OpenLayers.Event.isRightClick(a))b=
this.rightclick(a);return b},rightclick:function(a){if(this.passesTolerance(a))if(this.rightclickTimerId!=null){this.clearTimer();this.callback("dblrightclick",[a]);return!this.stopDouble}else{a=this["double"]?OpenLayers.Util.extend({},a):this.callback("rightclick",[a]);a=OpenLayers.Function.bind(this.delayedRightCall,this,a);this.rightclickTimerId=window.setTimeout(a,this.delay)}return!this.stopSingle},delayedRightCall:function(a){this.rightclickTimerId=null;a&&this.callback("rightclick",[a]);return!this.stopSingle},
dblclick:function(a){if(this.passesTolerance(a)){this["double"]&&this.callback("dblclick",[a]);this.clearTimer()}return!this.stopDouble},click:function(a){if(this.passesTolerance(a))if(this.timerId!=null)this.clearTimer();else{a=this.single?OpenLayers.Util.extend({},a):null;this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,a),this.delay)}return!this.stopSingle},passesTolerance:function(a){var b=true;if(this.pixelTolerance!=null&&this.down)if(Math.sqrt(Math.pow(this.down.x-
a.xy.x,2)+Math.pow(this.down.y-a.xy.y,2))>this.pixelTolerance)b=false;return b},clearTimer:function(){if(this.timerId!=null){window.clearTimeout(this.timerId);this.timerId=null}if(this.rightclickTimerId!=null){window.clearTimeout(this.rightclickTimerId);this.rightclickTimerId=null}},delayedCall:function(a){this.timerId=null;a&&this.callback("click",[a])},deactivate:function(){var a=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.clearTimer();this.down=null;a=true}return a},
CLASS_NAME:"OpenLayers.Handler.Click"});
OpenLayers.Handler.Hover=OpenLayers.Class(OpenLayers.Handler,{delay:500,pixelTolerance:null,stopMove:false,px:null,timerId:null,initialize:function(){OpenLayers.Handler.prototype.initialize.apply(this,arguments)},mousemove:function(a){if(this.passesTolerance(a.xy)){this.clearTimer();this.callback("move",[a]);this.px=a.xy;a=OpenLayers.Util.extend({},a);this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,a),this.delay)}return!this.stopMove},mouseout:function(a){if(OpenLayers.Util.mouseLeft(a,
this.map.div)){this.clearTimer();this.callback("move",[a])}return true},passesTolerance:function(a){var b=true;if(this.pixelTolerance&&this.px)if(Math.sqrt(Math.pow(this.px.x-a.x,2)+Math.pow(this.px.y-a.y,2))<this.pixelTolerance)b=false;return b},clearTimer:function(){if(this.timerId!=null){window.clearTimeout(this.timerId);this.timerId=null}},delayedCall:function(a){this.callback("pause",[a])},deactivate:function(){var a=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.clearTimer();
a=true}return a},CLASS_NAME:"OpenLayers.Handler.Hover"});
OpenLayers.Handler.Point=OpenLayers.Class(OpenLayers.Handler,{point:null,layer:null,multi:false,drawing:false,mouseDown:false,lastDown:null,lastUp:null,persist:false,layerOptions:null,initialize:function(a,b,c){if(!(c&&c.layerOptions&&c.layerOptions.styleMap))this.style=OpenLayers.Util.extend(OpenLayers.Feature.Vector.style["default"],{});OpenLayers.Handler.prototype.initialize.apply(this,arguments)},activate:function(){if(!OpenLayers.Handler.prototype.activate.apply(this,arguments))return false;
var a=OpenLayers.Util.extend({displayInLayerSwitcher:false,calculateInRange:function(){return true}},this.layerOptions);this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,a);this.map.addLayer(this.layer);return true},createFeature:function(a){a=this.map.getLonLatFromPixel(a);this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(a.lon,a.lat));this.callback("create",[this.point.geometry,this.point]);this.point.geometry.clearBounds();this.layer.addFeatures([this.point],{silent:true})},
deactivate:function(){if(!OpenLayers.Handler.prototype.deactivate.apply(this,arguments))return false;this.drawing&&this.cancel();this.destroyFeature();this.layer.map!=null&&this.layer.destroy(false);this.layer=null;return true},destroyFeature:function(){this.layer&&this.layer.destroyFeatures();this.point=null},finalize:function(a){var b=a?"cancel":"done";this.mouseDown=this.drawing=false;this.lastUp=this.lastDown=null;this.callback(b,[this.geometryClone()]);if(a||!this.persist)this.destroyFeature()},
cancel:function(){this.finalize(true)},click:function(a){OpenLayers.Event.stop(a);return false},dblclick:function(a){OpenLayers.Event.stop(a);return false},modifyFeature:function(a){a=this.map.getLonLatFromPixel(a);this.point.geometry.x=a.lon;this.point.geometry.y=a.lat;this.callback("modify",[this.point.geometry,this.point]);this.point.geometry.clearBounds();this.drawFeature()},drawFeature:function(){this.layer.drawFeature(this.point,this.style)},getGeometry:function(){var a=this.point&&this.point.geometry;
if(a&&this.multi)a=new OpenLayers.Geometry.MultiPoint([a]);return a},geometryClone:function(){var a=this.getGeometry();return a&&a.clone()},mousedown:function(a){if(!this.checkModifiers(a))return true;if(this.lastDown&&this.lastDown.equals(a.xy))return true;this.drawing=true;if(this.lastDown==null){this.persist&&this.destroyFeature();this.createFeature(a.xy)}else this.modifyFeature(a.xy);this.lastDown=a.xy;return false},mousemove:function(a){this.drawing&&this.modifyFeature(a.xy);return true},mouseup:function(){if(this.drawing){this.finalize();
return false}else return true},CLASS_NAME:"OpenLayers.Handler.Point"});
OpenLayers.Handler.Path=OpenLayers.Class(OpenLayers.Handler.Point,{line:null,freehand:false,freehandToggle:"shiftKey",initialize:function(){OpenLayers.Handler.Point.prototype.initialize.apply(this,arguments)},createFeature:function(a){a=this.control.map.getLonLatFromPixel(a);this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(a.lon,a.lat));this.line=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString([this.point.geometry]));this.callback("create",[this.point.geometry,
this.getSketch()]);this.point.geometry.clearBounds();this.layer.addFeatures([this.line,this.point],{silent:true})},destroyFeature:function(){OpenLayers.Handler.Point.prototype.destroyFeature.apply(this);this.line=null},removePoint:function(){this.point&&this.layer.removeFeatures([this.point])},addPoint:function(a){this.layer.removeFeatures([this.point]);a=this.control.map.getLonLatFromPixel(a);this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(a.lon,a.lat));this.line.geometry.addComponent(this.point.geometry,
this.line.geometry.components.length);this.callback("point",[this.point.geometry,this.getGeometry()]);this.callback("modify",[this.point.geometry,this.getSketch()]);this.drawFeature()},freehandMode:function(a){return this.freehandToggle&&a[this.freehandToggle]?!this.freehand:this.freehand},modifyFeature:function(a){a=this.control.map.getLonLatFromPixel(a);this.point.geometry.x=a.lon;this.point.geometry.y=a.lat;this.callback("modify",[this.point.geometry,this.getSketch()]);this.point.geometry.clearBounds();
this.drawFeature()},drawFeature:function(){this.layer.drawFeature(this.line,this.style);this.layer.drawFeature(this.point,this.style)},getSketch:function(){return this.line},getGeometry:function(){var a=this.line&&this.line.geometry;if(a&&this.multi)a=new OpenLayers.Geometry.MultiLineString([a]);return a},mousedown:function(a){if(this.lastDown&&this.lastDown.equals(a.xy))return false;if(this.lastDown==null){this.persist&&this.destroyFeature();this.createFeature(a.xy)}else if(this.lastUp==null||!this.lastUp.equals(a.xy))this.addPoint(a.xy);
this.mouseDown=true;this.lastDown=a.xy;this.drawing=true;return false},mousemove:function(a){if(this.drawing)this.mouseDown&&this.freehandMode(a)?this.addPoint(a.xy):this.modifyFeature(a.xy);return true},mouseup:function(a){this.mouseDown=false;if(this.drawing){if(this.freehandMode(a)){this.removePoint();this.finalize()}else{this.lastUp==null&&this.addPoint(a.xy);this.lastUp=a.xy}return false}return true},dblclick:function(a){if(!this.freehandMode(a)){this.line.geometry.removeComponent(this.line.geometry.components[this.line.geometry.components.length-
1]);this.removePoint();this.finalize()}return false},CLASS_NAME:"OpenLayers.Handler.Path"});
OpenLayers.Handler.Polygon=OpenLayers.Class(OpenLayers.Handler.Path,{polygon:null,initialize:function(){OpenLayers.Handler.Path.prototype.initialize.apply(this,arguments)},createFeature:function(a){a=this.control.map.getLonLatFromPixel(a);this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(a.lon,a.lat));this.line=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LinearRing([this.point.geometry]));this.polygon=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon([this.line.geometry]));
this.callback("create",[this.point.geometry,this.getSketch()]);this.point.geometry.clearBounds();this.layer.addFeatures([this.polygon,this.point],{silent:true})},destroyFeature:function(){OpenLayers.Handler.Path.prototype.destroyFeature.apply(this);this.polygon=null},drawFeature:function(){this.layer.drawFeature(this.polygon,this.style);this.layer.drawFeature(this.point,this.style)},getSketch:function(){return this.polygon},getGeometry:function(){var a=this.polygon&&this.polygon.geometry;if(a&&this.multi)a=
new OpenLayers.Geometry.MultiPolygon([a]);return a},dblclick:function(a){if(!this.freehandMode(a)){this.line.geometry.removeComponent(this.line.geometry.components[this.line.geometry.components.length-2]);this.removePoint();this.finalize()}return false},CLASS_NAME:"OpenLayers.Handler.Polygon"});
OpenLayers.Handler.Feature=OpenLayers.Class(OpenLayers.Handler,{EVENTMAP:{click:{"in":"click",out:"clickout"},mousemove:{"in":"over",out:"out"},dblclick:{"in":"dblclick",out:null},mousedown:{"in":null,out:null},mouseup:{"in":null,out:null}},feature:null,lastFeature:null,down:null,up:null,clickTolerance:4,geometryTypes:null,stopClick:true,stopDown:true,stopUp:false,initialize:function(a,b,c,d){OpenLayers.Handler.prototype.initialize.apply(this,[a,c,d]);this.layer=b},mousedown:function(a){this.down=
a.xy;return this.handle(a)?!this.stopDown:true},mouseup:function(a){this.up=a.xy;return this.handle(a)?!this.stopUp:true},click:function(a){return this.handle(a)?!this.stopClick:true},mousemove:function(a){if(!this.callbacks.over&&!this.callbacks.out)return true;this.handle(a);return true},dblclick:function(a){return!this.handle(a)},geometryTypeMatches:function(a){return this.geometryTypes==null||OpenLayers.Util.indexOf(this.geometryTypes,a.geometry.CLASS_NAME)>-1},handle:function(a){if(this.feature&&
!this.feature.layer)this.feature=null;var b=a.type,c=false,d=!!this.feature,e=b=="click"||b=="dblclick";if((this.feature=this.layer.getFeatureFromEvent(a))&&!this.feature.layer)this.feature=null;if(this.lastFeature&&!this.lastFeature.layer)this.lastFeature=null;if(this.feature){a=this.feature!=this.lastFeature;if(this.geometryTypeMatches(this.feature)){if(d&&a){this.lastFeature&&this.triggerCallback(b,"out",[this.lastFeature]);this.triggerCallback(b,"in",[this.feature])}else if(!d||e)this.triggerCallback(b,
"in",[this.feature]);this.lastFeature=this.feature;c=true}else{if(this.lastFeature&&(d&&a||e))this.triggerCallback(b,"out",[this.lastFeature]);this.feature=null}}else if(this.lastFeature&&(d||e))this.triggerCallback(b,"out",[this.lastFeature]);return c},triggerCallback:function(a,b,c){if(b=this.EVENTMAP[a][b])if(a=="click"&&this.up&&this.down)Math.sqrt(Math.pow(this.up.x-this.down.x,2)+Math.pow(this.up.y-this.down.y,2))<=this.clickTolerance&&this.callback(b,c);else this.callback(b,c)},activate:function(){var a=
false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.moveLayerToTop();this.map.events.on({removelayer:this.handleMapEvents,changelayer:this.handleMapEvents,scope:this});a=true}return a},deactivate:function(){var a=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.moveLayerBack();this.up=this.down=this.lastFeature=this.feature=null;this.map.events.un({removelayer:this.handleMapEvents,changelayer:this.handleMapEvents,scope:this});a=true}return a},handleMapEvents:function(a){if(!a.property||
a.property=="order")this.moveLayerToTop()},moveLayerToTop:function(){this.layer.setZIndex(Math.max(this.map.Z_INDEX_BASE.Feature-1,this.layer.getZIndex())+1)},moveLayerBack:function(){var a=this.layer.getZIndex()-1;a>=this.map.Z_INDEX_BASE.Feature?this.layer.setZIndex(a):this.map.setLayerZIndex(this.layer,this.map.getLayerIndex(this.layer))},CLASS_NAME:"OpenLayers.Handler.Feature"});
OpenLayers.Handler.Drag=OpenLayers.Class(OpenLayers.Handler,{started:false,stopDown:true,dragging:false,last:null,start:null,oldOnselectstart:null,interval:0,timeoutId:null,initialize:function(){OpenLayers.Handler.prototype.initialize.apply(this,arguments)},down:function(){},move:function(){},up:function(){},out:function(){},mousedown:function(a){var b=true;this.dragging=false;if(this.checkModifiers(a)&&OpenLayers.Event.isLeftClick(a)){this.started=true;this.last=this.start=a.xy;OpenLayers.Element.addClass(this.map.viewPortDiv,
"olDragDown");this.down(a);this.callback("down",[a.xy]);OpenLayers.Event.stop(a);if(!this.oldOnselectstart){this.oldOnselectstart=document.onselectstart?document.onselectstart:function(){return true};document.onselectstart=function(){return false}}b=!this.stopDown}else{this.started=false;this.last=this.start=null}return b},mousemove:function(a){if(this.started&&!this.timeoutId&&(a.xy.x!=this.last.x||a.xy.y!=this.last.y)){if(this.interval>0)this.timeoutId=setTimeout(OpenLayers.Function.bind(this.removeTimeout,
this),this.interval);this.dragging=true;this.move(a);this.callback("move",[a.xy]);if(!this.oldOnselectstart){this.oldOnselectstart=document.onselectstart;document.onselectstart=function(){return false}}this.last=this.evt.xy}return true},removeTimeout:function(){this.timeoutId=null},mouseup:function(a){if(this.started){var b=this.start!=this.last;this.dragging=this.started=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.up(a);this.callback("up",[a.xy]);b&&this.callback("done",
[a.xy]);document.onselectstart=this.oldOnselectstart}return true},mouseout:function(a){if(this.started&&OpenLayers.Util.mouseLeft(a,this.map.div)){var b=this.start!=this.last;this.dragging=this.started=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.out(a);this.callback("out",[]);b&&this.callback("done",[a.xy]);if(document.onselectstart)document.onselectstart=this.oldOnselectstart}return true},click:function(){return this.start==this.last},activate:function(){var a=false;
if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragging=false;a=true}return a},deactivate:function(){var a=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.dragging=this.started=false;this.last=this.start=null;a=true;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown")}return a},CLASS_NAME:"OpenLayers.Handler.Drag"});
OpenLayers.Handler.RegularPolygon=OpenLayers.Class(OpenLayers.Handler.Drag,{sides:4,radius:null,snapAngle:null,snapToggle:"shiftKey",persist:false,irregular:false,angle:null,fixedRadius:false,feature:null,layer:null,origin:null,initialize:function(a,b,c){this.style=OpenLayers.Util.extend(OpenLayers.Feature.Vector.style["default"],{});OpenLayers.Handler.prototype.initialize.apply(this,[a,b,c]);this.options=c?c:{}},setOptions:function(a){OpenLayers.Util.extend(this.options,a);OpenLayers.Util.extend(this,
a)},activate:function(){var a=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,{displayInLayerSwitcher:false,calculateInRange:function(){return true}});this.map.addLayer(this.layer);a=true}return a},deactivate:function(){var a=false;if(OpenLayers.Handler.Drag.prototype.deactivate.apply(this,arguments)){this.dragging&&this.cancel();if(this.layer.map!=null){this.layer.destroy(false);this.feature&&this.feature.destroy()}this.feature=
this.layer=null;a=true}return a},down:function(a){this.fixedRadius=!!this.radius;a=this.map.getLonLatFromPixel(a.xy);this.origin=new OpenLayers.Geometry.Point(a.lon,a.lat);if(!this.fixedRadius||this.irregular)this.radius=this.map.getResolution();this.persist&&this.clear();this.feature=new OpenLayers.Feature.Vector;this.createGeometry();this.callback("create",[this.origin,this.feature]);this.layer.addFeatures([this.feature],{silent:true});this.layer.drawFeature(this.feature,this.style)},move:function(a){var b=
this.map.getLonLatFromPixel(a.xy);b=new OpenLayers.Geometry.Point(b.lon,b.lat);if(this.irregular){a=Math.sqrt(2)*Math.abs(b.y-this.origin.y)/2;this.radius=Math.max(this.map.getResolution()/2,a)}else if(this.fixedRadius)this.origin=b;else{this.calculateAngle(b,a);this.radius=Math.max(this.map.getResolution()/2,b.distanceTo(this.origin))}this.modifyGeometry();if(this.irregular){a=b.x-this.origin.x;b=b.y-this.origin.y;this.feature.geometry.resize(1,this.origin,b==0?a/(this.radius*Math.sqrt(2)):a/b);
this.feature.geometry.move(a/2,b/2)}this.layer.drawFeature(this.feature,this.style)},up:function(a){this.finalize();this.start==this.last&&this.callback("done",[a.xy])},out:function(){this.finalize()},createGeometry:function(){this.angle=Math.PI*(1/this.sides-0.5);if(this.snapAngle)this.angle+=this.snapAngle*(Math.PI/180);this.feature.geometry=OpenLayers.Geometry.Polygon.createRegularPolygon(this.origin,this.radius,this.sides,this.snapAngle)},modifyGeometry:function(){var a,b,c=this.feature.geometry.components[0];
if(c.components.length!=this.sides+1){this.createGeometry();c=this.feature.geometry.components[0]}for(var d=0;d<this.sides;++d){b=c.components[d];a=this.angle+d*2*Math.PI/this.sides;b.x=this.origin.x+this.radius*Math.cos(a);b.y=this.origin.y+this.radius*Math.sin(a);b.clearBounds()}},calculateAngle:function(a,b){a=Math.atan2(a.y-this.origin.y,a.x-this.origin.x);if(this.snapAngle&&this.snapToggle&&!b[this.snapToggle]){b=Math.PI/180*this.snapAngle;this.angle=Math.round(a/b)*b}else this.angle=a},cancel:function(){this.callback("cancel",
null);this.finalize()},finalize:function(){this.origin=null;this.radius=this.options.radius},clear:function(){this.layer.renderer.clear();this.layer.destroyFeatures()},callback:function(a){this.callbacks[a]&&this.callbacks[a].apply(this.control,[this.feature.geometry.clone()]);if(!this.persist&&(a=="done"||a=="cancel"))this.clear()},CLASS_NAME:"OpenLayers.Handler.RegularPolygon"});
OpenLayers.Handler.Box=OpenLayers.Class(OpenLayers.Handler,{dragHandler:null,boxDivClassName:"olHandlerBoxZoomBox",boxCharacteristics:null,initialize:function(a,b){OpenLayers.Handler.prototype.initialize.apply(this,arguments);b={down:this.startBox,move:this.moveBox,out:this.removeBox,up:this.endBox};this.dragHandler=new OpenLayers.Handler.Drag(this,b,{keyMask:this.keyMask})},setMap:function(a){OpenLayers.Handler.prototype.setMap.apply(this,arguments);this.dragHandler&&this.dragHandler.setMap(a)},
startBox:function(){this.zoomBox=OpenLayers.Util.createDiv("zoomBox",this.dragHandler.start);this.zoomBox.className=this.boxDivClassName;this.zoomBox.style.zIndex=this.map.Z_INDEX_BASE.Popup-1;this.map.viewPortDiv.appendChild(this.zoomBox);OpenLayers.Element.addClass(this.map.viewPortDiv,"olDrawBox")},moveBox:function(a){var b=this.dragHandler.start.x,c=this.dragHandler.start.y,d=Math.abs(b-a.x),e=Math.abs(c-a.y);this.zoomBox.style.width=Math.max(1,d)+"px";this.zoomBox.style.height=Math.max(1,e)+
"px";this.zoomBox.style.left=a.x<b?a.x+"px":b+"px";this.zoomBox.style.top=a.y<c?a.y+"px":c+"px";var f=this.getBoxCharacteristics();if(f.newBoxModel){if(a.x>b)this.zoomBox.style.width=Math.max(1,d-f.xOffset)+"px";if(a.y>c)this.zoomBox.style.height=Math.max(1,e-f.yOffset)+"px"}},endBox:function(a){var b;if(Math.abs(this.dragHandler.start.x-a.x)>5||Math.abs(this.dragHandler.start.y-a.y)>5){var c=this.dragHandler.start;b=Math.min(c.y,a.y);var d=Math.max(c.y,a.y),e=Math.min(c.x,a.x);a=Math.max(c.x,a.x);
b=new OpenLayers.Bounds(e,d,a,b)}else b=this.dragHandler.start.clone();this.removeBox();this.callback("done",[b])},removeBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox);this.boxCharacteristics=this.zoomBox=null;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDrawBox")},activate:function(){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragHandler.activate();return true}else return false},deactivate:function(){if(OpenLayers.Handler.prototype.deactivate.apply(this,
arguments)){this.dragHandler.deactivate();return true}else return false},getBoxCharacteristics:function(){if(!this.boxCharacteristics){var a=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-left-width"))+parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-right-width"))+1,b=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-top-width"))+parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-bottom-width"))+1,c=OpenLayers.Util.getBrowserName()=="msie"?document.compatMode!=
"BackCompat":true;this.boxCharacteristics={xOffset:a,yOffset:b,newBoxModel:c}}return this.boxCharacteristics},CLASS_NAME:"OpenLayers.Handler.Box"});
OpenLayers.Handler.MouseWheel=OpenLayers.Class(OpenLayers.Handler,{wheelListener:null,mousePosition:null,initialize:function(){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.wheelListener=OpenLayers.Function.bindAsEventListener(this.onWheelEvent,this)},destroy:function(){OpenLayers.Handler.prototype.destroy.apply(this,arguments);this.wheelListener=null},onWheelEvent:function(a){if(this.map&&this.checkModifiers(a)){for(var b=false,c=false,d=false,e=OpenLayers.Event.element(a);e!=
null&&!d&&!b;){if(!b)try{var f=e.currentStyle?e.currentStyle.overflow:document.defaultView.getComputedStyle(e,null).getPropertyValue("overflow");b=f&&f=="auto"||f=="scroll"}catch(g){}if(!c){d=0;for(var i=this.map.layers.length;d<i;d++)if(e==this.map.layers[d].div||e==this.map.layers[d].pane){c=true;break}}d=e==this.map.div;e=e.parentNode}if(!b&&d){c&&this.wheelZoom(a);OpenLayers.Event.stop(a)}}},wheelZoom:function(a){var b=0;if(!a)a=window.event;if(a.wheelDelta){b=a.wheelDelta/120;if(window.opera&&
window.opera.version()<9.2)b=-b}else if(a.detail)b=-a.detail/3;if(b){if(this.mousePosition)a.xy=this.mousePosition;if(!a.xy)a.xy=this.map.getPixelFromLonLat(this.map.getCenter());b<0?this.callback("down",[a,b]):this.callback("up",[a,b])}},mousemove:function(a){this.mousePosition=a.xy},activate:function(){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){var a=this.wheelListener;OpenLayers.Event.observe(window,"DOMMouseScroll",a);OpenLayers.Event.observe(window,"mousewheel",a);OpenLayers.Event.observe(document,
"mousewheel",a);return true}else return false},deactivate:function(){if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){var a=this.wheelListener;OpenLayers.Event.stopObserving(window,"DOMMouseScroll",a);OpenLayers.Event.stopObserving(window,"mousewheel",a);OpenLayers.Event.stopObserving(document,"mousewheel",a);return true}else return false},CLASS_NAME:"OpenLayers.Handler.MouseWheel"});
OpenLayers.Handler.Keyboard=OpenLayers.Class(OpenLayers.Handler,{KEY_EVENTS:["keydown","keyup"],eventListener:null,initialize:function(){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.eventListener=OpenLayers.Function.bindAsEventListener(this.handleKeyEvent,this)},destroy:function(){this.deactivate();this.eventListener=null;OpenLayers.Handler.prototype.destroy.apply(this,arguments)},activate:function(){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){for(var a=0,
b=this.KEY_EVENTS.length;a<b;a++)OpenLayers.Event.observe(document,this.KEY_EVENTS[a],this.eventListener);return true}else return false},deactivate:function(){var a=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){a=0;for(var b=this.KEY_EVENTS.length;a<b;a++)OpenLayers.Event.stopObserving(document,this.KEY_EVENTS[a],this.eventListener);a=true}return a},handleKeyEvent:function(a){this.checkModifiers(a)&&this.callback(a.type,[a])},CLASS_NAME:"OpenLayers.Handler.Keyboard"});
OpenLayers.Control=OpenLayers.Class({id:null,map:null,div:null,type:null,allowSelection:false,displayClass:"",title:"",active:null,handler:null,eventListeners:null,events:null,EVENT_TYPES:["activate","deactivate"],initialize:function(a){this.displayClass=this.CLASS_NAME.replace("OpenLayers.","ol").replace(/\./g,"");OpenLayers.Util.extend(this,a);this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES);this.eventListeners instanceof Object&&this.events.on(this.eventListeners);if(this.id==null)this.id=
OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){if(this.events){this.eventListeners&&this.events.un(this.eventListeners);this.events.destroy();this.events=null}this.eventListeners=null;if(this.handler){this.handler.destroy();this.handler=null}if(this.handlers){for(var a in this.handlers)this.handlers.hasOwnProperty(a)&&typeof this.handlers[a].destroy=="function"&&this.handlers[a].destroy();this.handlers=null}if(this.map){this.map.removeControl(this);this.map=null}},setMap:function(a){this.map=
a;this.handler&&this.handler.setMap(a)},draw:function(a){if(this.div==null){this.div=OpenLayers.Util.createDiv(this.id);this.div.className=this.displayClass;if(!this.allowSelection){this.div.className+=" olControlNoSelect";this.div.setAttribute("unselectable","on",0);this.div.onselectstart=function(){return false}}if(this.title!="")this.div.title=this.title}if(a!=null)this.position=a.clone();this.moveTo(this.position);return this.div},moveTo:function(a){if(a!=null&&this.div!=null){this.div.style.left=
a.x+"px";this.div.style.top=a.y+"px"}},activate:function(){if(this.active)return false;this.handler&&this.handler.activate();this.active=true;this.map&&OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active");this.events.triggerEvent("activate");return true},deactivate:function(){if(this.active){this.handler&&this.handler.deactivate();this.active=false;this.map&&OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active");this.events.triggerEvent("deactivate");
return true}return false},CLASS_NAME:"OpenLayers.Control"});OpenLayers.Control.TYPE_BUTTON=1;OpenLayers.Control.TYPE_TOGGLE=2;OpenLayers.Control.TYPE_TOOL=3;
OpenLayers.Control.MouseDefaults=OpenLayers.Class(OpenLayers.Control,{performedDrag:false,wheelObserver:null,initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.handler&&this.handler.destroy();this.handler=null;this.map.events.un({click:this.defaultClick,dblclick:this.defaultDblClick,mousedown:this.defaultMouseDown,mouseup:this.defaultMouseUp,mousemove:this.defaultMouseMove,mouseout:this.defaultMouseOut,scope:this});OpenLayers.Event.stopObserving(window,
"DOMMouseScroll",this.wheelObserver);OpenLayers.Event.stopObserving(window,"mousewheel",this.wheelObserver);OpenLayers.Event.stopObserving(document,"mousewheel",this.wheelObserver);this.wheelObserver=null;OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(){this.map.events.on({click:this.defaultClick,dblclick:this.defaultDblClick,mousedown:this.defaultMouseDown,mouseup:this.defaultMouseUp,mousemove:this.defaultMouseMove,mouseout:this.defaultMouseOut,scope:this});this.registerWheelEvents()},
registerWheelEvents:function(){this.wheelObserver=OpenLayers.Function.bindAsEventListener(this.onWheelEvent,this);OpenLayers.Event.observe(window,"DOMMouseScroll",this.wheelObserver);OpenLayers.Event.observe(window,"mousewheel",this.wheelObserver);OpenLayers.Event.observe(document,"mousewheel",this.wheelObserver)},defaultClick:function(a){if(OpenLayers.Event.isLeftClick(a)){a=!this.performedDrag;this.performedDrag=false;return a}},defaultDblClick:function(a){this.map.setCenter(this.map.getLonLatFromViewPortPx(a.xy),
this.map.zoom+1);OpenLayers.Event.stop(a);return false},defaultMouseDown:function(a){if(OpenLayers.Event.isLeftClick(a)){this.mouseDragStart=a.xy.clone();this.performedDrag=false;if(a.shiftKey){this.map.div.style.cursor="crosshair";this.zoomBox=OpenLayers.Util.createDiv("zoomBox",this.mouseDragStart,null,null,"absolute","2px solid red");this.zoomBox.style.backgroundColor="white";this.zoomBox.style.filter="alpha(opacity=50)";this.zoomBox.style.opacity="0.50";this.zoomBox.style.fontSize="1px";this.zoomBox.style.zIndex=
this.map.Z_INDEX_BASE.Popup-1;this.map.viewPortDiv.appendChild(this.zoomBox)}document.onselectstart=function(){return false};OpenLayers.Event.stop(a)}},defaultMouseMove:function(a){this.mousePosition=a.xy.clone();if(this.mouseDragStart!=null){if(this.zoomBox){var b=Math.abs(this.mouseDragStart.x-a.xy.x),c=Math.abs(this.mouseDragStart.y-a.xy.y);this.zoomBox.style.width=Math.max(1,b)+"px";this.zoomBox.style.height=Math.max(1,c)+"px";if(a.xy.x<this.mouseDragStart.x)this.zoomBox.style.left=a.xy.x+"px";
if(a.xy.y<this.mouseDragStart.y)this.zoomBox.style.top=a.xy.y+"px"}else{b=this.mouseDragStart.x-a.xy.x;c=this.mouseDragStart.y-a.xy.y;var d=this.map.getSize();this.map.setCenter(this.map.getLonLatFromViewPortPx(new OpenLayers.Pixel(d.w/2+b,d.h/2+c)),null,true);this.mouseDragStart=a.xy.clone();this.map.div.style.cursor="move"}this.performedDrag=true}},defaultMouseUp:function(a){if(OpenLayers.Event.isLeftClick(a)){if(this.zoomBox)this.zoomBoxEnd(a);else this.performedDrag&&this.map.setCenter(this.map.center);
this.mouseDragStart=document.onselectstart=null;this.map.div.style.cursor=""}},defaultMouseOut:function(a){if(this.mouseDragStart!=null&&OpenLayers.Util.mouseLeft(a,this.map.div)){this.zoomBox&&this.removeZoomBox();this.mouseDragStart=null}},defaultWheelUp:function(a){this.map.getZoom()<=this.map.getNumZoomLevels()&&this.map.setCenter(this.map.getLonLatFromPixel(a.xy),this.map.getZoom()+1)},defaultWheelDown:function(a){this.map.getZoom()>0&&this.map.setCenter(this.map.getLonLatFromPixel(a.xy),this.map.getZoom()-
1)},zoomBoxEnd:function(a){if(this.mouseDragStart!=null){if(Math.abs(this.mouseDragStart.x-a.xy.x)>5||Math.abs(this.mouseDragStart.y-a.xy.y)>5){var b=this.map.getLonLatFromViewPortPx(this.mouseDragStart),c=this.map.getLonLatFromViewPortPx(a.xy);a=Math.max(b.lat,c.lat);var d=Math.min(b.lat,c.lat),e=Math.min(b.lon,c.lon);b=Math.max(b.lon,c.lon);this.map.zoomToExtent(new OpenLayers.Bounds(e,d,b,a))}else{c=this.map.getLonLatFromViewPortPx(a.xy);this.map.setCenter(new OpenLayers.LonLat(c.lon,c.lat),this.map.getZoom()+
1)}this.removeZoomBox()}},removeZoomBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox);this.zoomBox=null},onWheelEvent:function(a){for(var b=false,c=OpenLayers.Event.element(a);c!=null;){if(this.map&&c==this.map.div){b=true;break}c=c.parentNode}if(b){b=0;if(!a)a=window.event;if(a.wheelDelta){b=a.wheelDelta/120;if(window.opera&&window.opera.version()<9.2)b=-b}else if(a.detail)b=-a.detail/3;if(b){a.xy=this.mousePosition;b<0?this.defaultWheelDown(a):this.defaultWheelUp(a)}OpenLayers.Event.stop(a)}},
CLASS_NAME:"OpenLayers.Control.MouseDefaults"});
OpenLayers.Control.MousePosition=OpenLayers.Class(OpenLayers.Control,{element:null,prefix:"",separator:", ",suffix:"",numDigits:5,granularity:10,lastXy:null,displayProjection:null,initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.map&&this.map.events.unregister("mousemove",this,this.redraw);OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.div.left=
"";this.div.top="";this.element=this.div}this.redraw();return this.div},redraw:function(a){var b;if(a==null)b=new OpenLayers.LonLat(0,0);else{if(this.lastXy==null||Math.abs(a.xy.x-this.lastXy.x)>this.granularity||Math.abs(a.xy.y-this.lastXy.y)>this.granularity){this.lastXy=a.xy;return}b=this.map.getLonLatFromPixel(a.xy);if(!b)return;this.displayProjection&&b.transform(this.map.getProjectionObject(),this.displayProjection);this.lastXy=a.xy}a=this.formatOutput(b);if(a!=this.element.innerHTML)this.element.innerHTML=
a},formatOutput:function(a){var b=parseInt(this.numDigits);return this.prefix+a.lon.toFixed(b)+this.separator+a.lat.toFixed(b)+this.suffix},setMap:function(){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.map.events.register("mousemove",this,this.redraw)},CLASS_NAME:"OpenLayers.Control.MousePosition"});
OpenLayers.Control.KeyboardDefaults=OpenLayers.Class(OpenLayers.Control,{slideFactor:75,initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.handler&&this.handler.destroy();this.handler=null;OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(){this.handler=new OpenLayers.Handler.Keyboard(this,{keydown:this.defaultKeyPress});this.activate()},defaultKeyPress:function(a){switch(a.keyCode){case OpenLayers.Event.KEY_LEFT:this.map.pan(-this.slideFactor,
0);break;case OpenLayers.Event.KEY_RIGHT:this.map.pan(this.slideFactor,0);break;case OpenLayers.Event.KEY_UP:this.map.pan(0,-this.slideFactor);break;case OpenLayers.Event.KEY_DOWN:this.map.pan(0,this.slideFactor);break;case 33:a=this.map.getSize();this.map.pan(0,-0.75*a.h);break;case 34:a=this.map.getSize();this.map.pan(0,0.75*a.h);break;case 35:a=this.map.getSize();this.map.pan(0.75*a.w,0);break;case 36:a=this.map.getSize();this.map.pan(-0.75*a.w,0);break;case 43:case 61:case 187:case 107:this.map.zoomIn();
break;case 45:case 109:case 189:case 95:this.map.zoomOut();break}},CLASS_NAME:"OpenLayers.Control.KeyboardDefaults"});
OpenLayers.Control.PanZoom=OpenLayers.Class(OpenLayers.Control,{slideFactor:50,slideRatio:null,buttons:null,position:null,initialize:function(){this.position=new OpenLayers.Pixel(OpenLayers.Control.PanZoom.X,OpenLayers.Control.PanZoom.Y);OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){OpenLayers.Control.prototype.destroy.apply(this,arguments);this.removeButtons();this.position=this.buttons=null},draw:function(a){OpenLayers.Control.prototype.draw.apply(this,arguments);
a=this.position;this.buttons=[];var b=new OpenLayers.Size(18,18),c=new OpenLayers.Pixel(a.x+b.w/2,a.y);this._addButton("panup","north-mini.png",c,b);a.y=c.y+b.h;this._addButton("panleft","west-mini.png",a,b);this._addButton("panright","east-mini.png",a.add(b.w,0),b);this._addButton("pandown","south-mini.png",c.add(0,b.h*2),b);this._addButton("zoomin","zoom-plus-mini.png",c.add(0,b.h*3+5),b);this._addButton("zoomworld","zoom-world-mini.png",c.add(0,b.h*4+5),b);this._addButton("zoomout","zoom-minus-mini.png",
c.add(0,b.h*5+5),b);return this.div},_addButton:function(a,b,c,d){b=OpenLayers.Util.getImagesLocation()+b;c=OpenLayers.Util.createAlphaImageDiv(this.id+"_"+a,c,d,b,"absolute");this.div.appendChild(c);OpenLayers.Event.observe(c,"mousedown",OpenLayers.Function.bindAsEventListener(this.buttonDown,c));OpenLayers.Event.observe(c,"dblclick",OpenLayers.Function.bindAsEventListener(this.doubleClick,c));OpenLayers.Event.observe(c,"click",OpenLayers.Function.bindAsEventListener(this.doubleClick,c));c.action=
a;c.map=this.map;if(this.slideRatio){var e=this.slideRatio;a=function(g){return this.map.getSize()[g]*e}}else{var f=this.slideFactor;a=function(){return f}}c.getSlideFactor=a;this.buttons.push(c);return c},_removeButton:function(a){OpenLayers.Event.stopObservingElement(a);a.map=null;this.div.removeChild(a);OpenLayers.Util.removeItem(this.buttons,a)},removeButtons:function(){for(var a=this.buttons.length-1;a>=0;--a)this._removeButton(this.buttons[a])},doubleClick:function(a){OpenLayers.Event.stop(a);
return false},buttonDown:function(a){if(OpenLayers.Event.isLeftClick(a)){switch(this.action){case "panup":this.map.pan(0,-this.getSlideFactor("h"));break;case "pandown":this.map.pan(0,this.getSlideFactor("h"));break;case "panleft":this.map.pan(-this.getSlideFactor("w"),0);break;case "panright":this.map.pan(this.getSlideFactor("w"),0);break;case "zoomin":this.map.zoomIn();break;case "zoomout":this.map.zoomOut();break;case "zoomworld":this.map.zoomToMaxExtent();break}OpenLayers.Event.stop(a)}},CLASS_NAME:"OpenLayers.Control.PanZoom"});
OpenLayers.Control.PanZoom.X=4;OpenLayers.Control.PanZoom.Y=4;
OpenLayers.Control.DragFeature=OpenLayers.Class(OpenLayers.Control,{geometryTypes:null,onStart:function(){},onDrag:function(){},onComplete:function(){},layer:null,feature:null,dragCallbacks:{},featureCallbacks:{},lastPixel:null,initialize:function(a,b){OpenLayers.Control.prototype.initialize.apply(this,[b]);this.layer=a;this.handlers={drag:new OpenLayers.Handler.Drag(this,OpenLayers.Util.extend({down:this.downFeature,move:this.moveFeature,up:this.upFeature,out:this.cancel,done:this.doneDragging},
this.dragCallbacks)),feature:new OpenLayers.Handler.Feature(this,this.layer,OpenLayers.Util.extend({over:this.overFeature,out:this.outFeature},this.featureCallbacks),{geometryTypes:this.geometryTypes})}},destroy:function(){this.layer=null;OpenLayers.Control.prototype.destroy.apply(this,[])},activate:function(){return this.handlers.feature.activate()&&OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){this.handlers.drag.deactivate();this.handlers.feature.deactivate();
this.feature=null;this.dragging=false;this.lastPixel=null;OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass+"Over");return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},overFeature:function(a){if(this.handlers.drag.dragging)this.over=this.feature.id==a.id?true:false;else{this.feature=a;this.handlers.drag.activate();this.over=true;OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass+"Over")}},downFeature:function(a){this.lastPixel=a;this.onStart(this.feature,
a)},moveFeature:function(a){var b=this.map.getResolution();this.feature.geometry.move(b*(a.x-this.lastPixel.x),b*(this.lastPixel.y-a.y));this.layer.drawFeature(this.feature);this.lastPixel=a;this.onDrag(this.feature,a)},upFeature:function(){this.over||this.handlers.drag.deactivate()},doneDragging:function(a){this.onComplete(this.feature,a)},outFeature:function(a){if(this.handlers.drag.dragging){if(this.feature.id==a.id)this.over=false}else{this.over=false;this.handlers.drag.deactivate();OpenLayers.Element.removeClass(this.map.viewPortDiv,
this.displayClass+"Over");this.feature=null}},cancel:function(){this.handlers.drag.deactivate();this.over=false},setMap:function(a){this.handlers.drag.setMap(a);this.handlers.feature.setMap(a);OpenLayers.Control.prototype.setMap.apply(this,arguments)},CLASS_NAME:"OpenLayers.Control.DragFeature"});
OpenLayers.Geometry=OpenLayers.Class({id:null,parent:null,bounds:null,initialize:function(){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){this.bounds=this.id=null},clone:function(){return new OpenLayers.Geometry},setBounds:function(a){if(a)this.bounds=a.clone()},clearBounds:function(){this.bounds=null;this.parent&&this.parent.clearBounds()},extendBounds:function(a){this.getBounds()?this.bounds.extend(a):this.setBounds(a)},getBounds:function(){this.bounds==null&&this.calculateBounds();
return this.bounds},calculateBounds:function(){},distanceTo:function(){},getVertices:function(){},atPoint:function(a,b,c){var d=false;if(this.getBounds()!=null&&a!=null){b=b!=null?b:0;c=c!=null?c:0;d=(new OpenLayers.Bounds(this.bounds.left-b,this.bounds.bottom-c,this.bounds.right+b,this.bounds.top+c)).containsLonLat(a)}return d},getLength:function(){return 0},getArea:function(){return 0},getCentroid:function(){return null},toString:function(){return OpenLayers.Format.WKT.prototype.write(new OpenLayers.Feature.Vector(this))},
CLASS_NAME:"OpenLayers.Geometry"});OpenLayers.Geometry.fromWKT=function(a){var b=arguments.callee.format;if(!b){b=new OpenLayers.Format.WKT;arguments.callee.format=b}var c;b=b.read(a);if(b instanceof OpenLayers.Feature.Vector)c=b.geometry;else if(b instanceof Array){c=b.length;for(var d=new Array(c),e=0;e<c;++e)d[e]=b[e].geometry;c=new OpenLayers.Geometry.Collection(d)}return c};
OpenLayers.Geometry.segmentsIntersect=function(a,b,c){var d=c&&c.point;c=c&&c.tolerance;var e=false,f=a.x1-b.x1,g=a.y1-b.y1,i=a.x2-a.x1,h=a.y2-a.y1,j=b.y2-b.y1,k=b.x2-b.x1,l=j*i-k*h;j=k*g-j*f;g=i*g-h*f;if(l==0){if(j==0&&g==0)e=true}else{f=j/l;l=g/l;if(f>=0&&f<=1&&l>=0&&l<=1)if(d){i=a.x1+f*i;l=a.y1+f*h;e=new OpenLayers.Geometry.Point(i,l)}else e=true}if(c)if(e){if(d){a=[a,b];b=0;a:for(;b<2;++b){f=a[b];for(h=1;h<3;++h){i=f["x"+h];l=f["y"+h];d=Math.sqrt(Math.pow(i-e.x,2)+Math.pow(l-e.y,2));if(d<c){e.x=
i;e.y=l;break a}}}}}else{a=[a,b];b=0;a:for(;b<2;++b){i=a[b];l=a[(b+1)%2];for(h=1;h<3;++h){f={x:i["x"+h],y:i["y"+h]};g=OpenLayers.Geometry.distanceToSegment(f,l);if(g.distance<c){e=d?new OpenLayers.Geometry.Point(f.x,f.y):true;break a}}}}return e};
OpenLayers.Geometry.distanceToSegment=function(a,b){var c=a.x;a=a.y;var d=b.x1,e=b.y1,f=b.x2;b=b.y2;var g=f-d,i=b-e,h=(g*(c-d)+i*(a-e))/(Math.pow(g,2)+Math.pow(i,2));if(h<=0){d=d;e=e}else if(h>=1){d=f;e=b}else{d=d+h*g;e=e+h*i}return{distance:Math.sqrt(Math.pow(d-c,2)+Math.pow(e-a,2)),x:d,y:e}};
OpenLayers.Geometry.Rectangle=OpenLayers.Class(OpenLayers.Geometry,{x:null,y:null,width:null,height:null,initialize:function(a,b,c,d){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.x=a;this.y=b;this.width=c;this.height=d},calculateBounds:function(){this.bounds=new OpenLayers.Bounds(this.x,this.y,this.x+this.width,this.y+this.height)},getLength:function(){return 2*this.width+2*this.height},getArea:function(){return this.width*this.height},CLASS_NAME:"OpenLayers.Geometry.Rectangle"});
OpenLayers.Geometry.Collection=OpenLayers.Class(OpenLayers.Geometry,{components:null,componentTypes:null,initialize:function(a){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.components=[];a!=null&&this.addComponents(a)},destroy:function(){this.components.length=0;this.components=null},clone:function(){for(var a=eval("new "+this.CLASS_NAME+"()"),b=0,c=this.components.length;b<c;b++)a.addComponent(this.components[b].clone());OpenLayers.Util.applyDefaults(a,this);return a},getComponentsString:function(){for(var a=
[],b=0,c=this.components.length;b<c;b++)a.push(this.components[b].toShortString());return a.join(",")},calculateBounds:function(){this.bounds=null;if(this.components&&this.components.length>0){this.setBounds(this.components[0].getBounds());for(var a=1,b=this.components.length;a<b;a++)this.extendBounds(this.components[a].getBounds())}},addComponents:function(a){a instanceof Array||(a=[a]);for(var b=0,c=a.length;b<c;b++)this.addComponent(a[b])},addComponent:function(a,b){var c=false;if(a)if(this.componentTypes==
null||OpenLayers.Util.indexOf(this.componentTypes,a.CLASS_NAME)>-1){if(b!=null&&b<this.components.length){c=this.components.slice(0,b);b=this.components.slice(b,this.components.length);c.push(a);this.components=c.concat(b)}else this.components.push(a);a.parent=this;this.clearBounds();c=true}return c},removeComponents:function(a){a instanceof Array||(a=[a]);for(var b=a.length-1;b>=0;--b)this.removeComponent(a[b])},removeComponent:function(a){OpenLayers.Util.removeItem(this.components,a);this.clearBounds()},
getLength:function(){for(var a=0,b=0,c=this.components.length;b<c;b++)a+=this.components[b].getLength();return a},getArea:function(){for(var a=0,b=0,c=this.components.length;b<c;b++)a+=this.components[b].getArea();return a},getGeodesicArea:function(a){for(var b=0,c=0,d=this.components.length;c<d;c++)b+=this.components[c].getGeodesicArea(a);return b},getCentroid:function(){return this.components.length&&this.components[0].getCentroid()},getGeodesicLength:function(a){for(var b=0,c=0,d=this.components.length;c<
d;c++)b+=this.components[c].getGeodesicLength(a);return b},move:function(a,b){for(var c=0,d=this.components.length;c<d;c++)this.components[c].move(a,b)},rotate:function(a,b){for(var c=0,d=this.components.length;c<d;++c)this.components[c].rotate(a,b)},resize:function(a,b,c){for(var d=0;d<this.components.length;++d)this.components[d].resize(a,b,c);return this},distanceTo:function(a,b){for(var c=!(b&&b.edge===false)&&b&&b.details,d,e,f=Number.POSITIVE_INFINITY,g=0,i=this.components.length;g<i;++g){d=
this.components[g].distanceTo(a,b);distance=c?d.distance:d;if(distance<f){f=distance;e=d;if(f==0)break}}return e},equals:function(a){var b=true;if(!a||!a.CLASS_NAME||this.CLASS_NAME!=a.CLASS_NAME)b=false;else if(!(a.components instanceof Array)||a.components.length!=this.components.length)b=false;else for(var c=0,d=this.components.length;c<d;++c)if(!this.components[c].equals(a.components[c])){b=false;break}return b},transform:function(a,b){if(a&&b){for(var c=0,d=this.components.length;c<d;c++)this.components[c].transform(a,
b);this.bounds=null}return this},intersects:function(a){for(var b=false,c=0,d=this.components.length;c<d;++c)if(b=a.intersects(this.components[c]))break;return b},getVertices:function(a){for(var b=[],c=0,d=this.components.length;c<d;++c)Array.prototype.push.apply(b,this.components[c].getVertices(a));return b},CLASS_NAME:"OpenLayers.Geometry.Collection"});
OpenLayers.Geometry.Point=OpenLayers.Class(OpenLayers.Geometry,{x:null,y:null,initialize:function(a,b){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.x=parseFloat(a);this.y=parseFloat(b)},clone:function(a){if(a==null)a=new OpenLayers.Geometry.Point(this.x,this.y);OpenLayers.Util.applyDefaults(a,this);return a},calculateBounds:function(){this.bounds=new OpenLayers.Bounds(this.x,this.y,this.x,this.y)},distanceTo:function(a,b){var c=!(b&&b.edge===false)&&b&&b.details,d,e,f;if(a instanceof
OpenLayers.Geometry.Point){b=this.x;d=this.y;e=a.x;f=a.y;a=Math.sqrt(Math.pow(b-e,2)+Math.pow(d-f,2));b=!c?a:{x0:b,y0:d,x1:e,y1:f,distance:a}}else{b=a.distanceTo(this,b);if(c)b={x0:b.x1,y0:b.y1,x1:b.x0,y1:b.y0,distance:b.distance}}return b},equals:function(a){var b=false;if(a!=null)b=this.x==a.x&&this.y==a.y||isNaN(this.x)&&isNaN(this.y)&&isNaN(a.x)&&isNaN(a.y);return b},toShortString:function(){return this.x+", "+this.y},move:function(a,b){this.x+=a;this.y+=b;this.clearBounds()},rotate:function(a,
b){a*=Math.PI/180;var c=this.distanceTo(b);a=a+Math.atan2(this.y-b.y,this.x-b.x);this.x=b.x+c*Math.cos(a);this.y=b.y+c*Math.sin(a);this.clearBounds()},getCentroid:function(){return new OpenLayers.Geometry.Point(this.x,this.y)},resize:function(a,b,c){c=c==undefined?1:c;this.x=b.x+a*c*(this.x-b.x);this.y=b.y+a*(this.y-b.y);this.clearBounds();return this},intersects:function(a){var b=false;return b=a.CLASS_NAME=="OpenLayers.Geometry.Point"?this.equals(a):a.intersects(this)},transform:function(a,b){if(a&&
b){OpenLayers.Projection.transform(this,a,b);this.bounds=null}return this},getVertices:function(){return[this]},CLASS_NAME:"OpenLayers.Geometry.Point"});OpenLayers.Geometry.MultiPoint=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments)},addPoint:function(a,b){this.addComponent(a,b)},removePoint:function(a){this.removeComponent(a)},CLASS_NAME:"OpenLayers.Geometry.MultiPoint"});
OpenLayers.Geometry.Curve=OpenLayers.Class(OpenLayers.Geometry.MultiPoint,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(){OpenLayers.Geometry.MultiPoint.prototype.initialize.apply(this,arguments)},getLength:function(){var a=0;if(this.components&&this.components.length>1)for(var b=1,c=this.components.length;b<c;b++)a+=this.components[b-1].distanceTo(this.components[b]);return a},getGeodesicLength:function(a){var b=this;if(a){var c=new OpenLayers.Projection("EPSG:4326");c.equals(a)||
(b=this.clone().transform(a,c))}a=0;if(b.components&&b.components.length>1)for(var d,e=1,f=b.components.length;e<f;e++){c=b.components[e-1];d=b.components[e];a+=OpenLayers.Util.distVincenty({lon:c.x,lat:c.y},{lon:d.x,lat:d.y})}return a*1E3},CLASS_NAME:"OpenLayers.Geometry.Curve"});
OpenLayers.Geometry.LineString=OpenLayers.Class(OpenLayers.Geometry.Curve,{initialize:function(){OpenLayers.Geometry.Curve.prototype.initialize.apply(this,arguments)},removeComponent:function(){this.components&&this.components.length>2&&OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments)},intersects:function(a){var b=false,c=a.CLASS_NAME;if(c=="OpenLayers.Geometry.LineString"||c=="OpenLayers.Geometry.LinearRing"||c=="OpenLayers.Geometry.Point"){var d=this.getSortedSegments();
a=c=="OpenLayers.Geometry.Point"?[{x1:a.x,y1:a.y,x2:a.x,y2:a.y}]:a.getSortedSegments();var e,f,g,i,h,j,k,l=0,n=d.length;a:for(;l<n;++l){c=d[l];e=c.x1;f=c.x2;g=c.y1;i=c.y2;var m=0,o=a.length;for(;m<o;++m){h=a[m];if(h.x1>f)break;if(!(h.x2<e)){j=h.y1;k=h.y2;if(!(Math.min(j,k)>Math.max(g,i)))if(!(Math.max(j,k)<Math.min(g,i)))if(OpenLayers.Geometry.segmentsIntersect(c,h)){b=true;break a}}}}}else b=a.intersects(this);return b},getSortedSegments:function(){function a(e,f){return e.x1-f.x1}for(var b=this.components.length-
1,c=new Array(b),d=0;d<b;++d){point1=this.components[d];point2=this.components[d+1];c[d]=point1.x<point2.x?{x1:point1.x,y1:point1.y,x2:point2.x,y2:point2.y}:{x1:point2.x,y1:point2.y,x2:point1.x,y2:point1.y}}return c.sort(a)},splitWithSegment:function(a,b){var c=!(b&&b.edge===false),d=b&&b.tolerance;b=[];for(var e=this.getVertices(),f=[],g=[],i=false,h,j,k,l={point:true,tolerance:d},n=null,m=0,o=e.length-2;m<=o;++m){d=e[m];f.push(d.clone());h=e[m+1];j={x1:d.x,y1:d.y,x2:h.x,y2:h.y};j=OpenLayers.Geometry.segmentsIntersect(a,
j,l);if(j instanceof OpenLayers.Geometry.Point)if((k=j.x===a.x1&&j.y===a.y1||j.x===a.x2&&j.y===a.y2||j.equals(d)||j.equals(h)?true:false)||c){j.equals(g[g.length-1])||g.push(j.clone());if(m===0)if(j.equals(d))continue;if(!j.equals(h)){i=true;j.equals(d)||f.push(j);b.push(new OpenLayers.Geometry.LineString(f));f=[j.clone()]}}}if(i){f.push(h.clone());b.push(new OpenLayers.Geometry.LineString(f))}if(g.length>0){var p=a.x1<a.x2?1:-1,q=a.y1<a.y2?1:-1;n={lines:b,points:g.sort(function(r,s){return p*r.x-
p*s.x||q*r.y-q*s.y})}}return n},split:function(a,b){var c=null,d=b&&b.mutual,e,f,g,i;if(a instanceof OpenLayers.Geometry.LineString){var h=this.getVertices(),j,k,l,n,m,o=[];g=[];for(var p=0,q=h.length-2;p<=q;++p){j=h[p];k=h[p+1];l={x1:j.x,y1:j.y,x2:k.x,y2:k.y};i=i||[a];d&&o.push(j.clone());for(var r=0;r<i.length;++r)if(n=i[r].splitWithSegment(l,b)){m=n.lines;if(m.length>0){m.unshift(r,1);Array.prototype.splice.apply(i,m);r+=m.length-2}if(d)for(var s=0,t=n.points.length;s<t;++s){m=n.points[s];if(!m.equals(j)){o.push(m);
g.push(new OpenLayers.Geometry.LineString(o));o=m.equals(k)?[]:[m.clone()]}}}}if(d&&g.length>0&&o.length>0){o.push(k.clone());g.push(new OpenLayers.Geometry.LineString(o))}}else c=a.splitWith(this,b);if(i&&i.length>1)f=true;else i=[];if(g&&g.length>1)e=true;else g=[];if(f||e)c=d?[g,i]:i;return c},splitWith:function(a,b){return a.split(this,b)},getVertices:function(a){return a===true?[this.components[0],this.components[this.components.length-1]]:a===false?this.components.slice(1,this.components.length-
1):this.components.slice()},distanceTo:function(a,b){var c=!(b&&b.edge===false)&&b&&b.details,d,e={},f=Number.POSITIVE_INFINITY;if(a instanceof OpenLayers.Geometry.Point){b=this.getSortedSegments();for(var g=a.x,i=a.y,h,j=0,k=b.length;j<k;++j){h=b[j];d=OpenLayers.Geometry.distanceToSegment(a,h);if(d.distance<f){f=d.distance;e=d;if(f===0)break}else if(h.x2>g&&(i>h.y1&&i<h.y2||i<h.y1&&i>h.y2))break}e=c?{distance:e.distance,x0:e.x,y0:e.y,x1:g,y1:i}:e.distance}else if(a instanceof OpenLayers.Geometry.LineString){g=
this.getSortedSegments();i=a.getSortedSegments();var l,n,m,o=i.length,p={point:true};j=0;k=g.length;a:for(;j<k;++j){h=g[j];n=h.x1;m=h.y1;for(var q=0;q<o;++q){d=i[q];if(l=OpenLayers.Geometry.segmentsIntersect(h,d,p)){f=0;e={distance:0,x0:l.x,y0:l.y,x1:l.x,y1:l.y};break a}else{d=OpenLayers.Geometry.distanceToSegment({x:n,y:m},d);if(d.distance<f){f=d.distance;e={distance:f,x0:n,y0:m,x1:d.x,y1:d.y}}}}}if(!c)e=e.distance;if(f!==0)if(h){d=a.distanceTo(new OpenLayers.Geometry.Point(h.x2,h.y2),b);a=c?d.distance:
d;if(a<f)e=c?{distance:f,x0:d.x1,y0:d.y1,x1:d.x0,y1:d.y0}:a}}else{e=a.distanceTo(this,b);if(c)e={distance:e.distance,x0:e.x1,y0:e.y1,x1:e.x0,y1:e.y0}}return e},CLASS_NAME:"OpenLayers.Geometry.LineString"});
OpenLayers.Geometry.LinearRing=OpenLayers.Class(OpenLayers.Geometry.LineString,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(){OpenLayers.Geometry.LineString.prototype.initialize.apply(this,arguments)},addComponent:function(a,b){var c=false,d=this.components.pop();if(b!=null||!a.equals(d))c=OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,arguments);OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[this.components[0]]);return c},removeComponent:function(){if(this.components.length>
4){this.components.pop();OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[this.components[0]])}},move:function(a,b){for(var c=0,d=this.components.length;c<d-1;c++)this.components[c].move(a,b)},rotate:function(a,b){for(var c=0,d=this.components.length;c<d-1;++c)this.components[c].rotate(a,b)},resize:function(a,b,c){for(var d=0,e=this.components.length;d<e-1;++d)this.components[d].resize(a,b,c);return this},
transform:function(a,b){if(a&&b){for(var c=0,d=this.components.length;c<d-1;c++)this.components[c].transform(a,b);this.bounds=null}return this},getCentroid:function(){if(this.components&&this.components.length>2){for(var a=0,b=0,c=0;c<this.components.length-1;c++){var d=this.components[c],e=this.components[c+1];a+=(d.x+e.x)*(d.x*e.y-e.x*d.y);b+=(d.y+e.y)*(d.x*e.y-e.x*d.y)}c=-1*this.getArea();a=a/(6*c);b=b/(6*c)}return new OpenLayers.Geometry.Point(a,b)},getArea:function(){var a=0;if(this.components&&
this.components.length>2){for(var b=a=0,c=this.components.length;b<c-1;b++){var d=this.components[b],e=this.components[b+1];a+=(d.x+e.x)*(e.y-d.y)}a=-a/2}return a},getGeodesicArea:function(a){var b=this;if(a){var c=new OpenLayers.Projection("EPSG:4326");c.equals(a)||(b=this.clone().transform(a,c))}a=0;c=b.components&&b.components.length;if(c>2){for(var d,e,f=0;f<c-1;f++){d=b.components[f];e=b.components[f+1];a+=OpenLayers.Util.rad(e.x-d.x)*(2+Math.sin(OpenLayers.Util.rad(d.y))+Math.sin(OpenLayers.Util.rad(e.y)))}a=
a*6378137*6378137/2}return a},containsPoint:function(a){function b(n,m,o,p,q){return((m-p)*n+(p*o-m*q))/(o-q)}var c=OpenLayers.Number.limitSigDigs,d=c(a.x,14);a=c(a.y,14);for(var e=this.components.length-1,f,g,i,h,j,k=0,l=0;l<e;++l){f=this.components[l];i=c(f.x,14);f=c(f.y,14);g=this.components[l+1];h=c(g.x,14);g=c(g.y,14);if(f==g){if(a==f)if(i<=h&&d>=i&&d<=h||i>=h&&d<=i&&d>=h){k=-1;break}}else{j=c(b(a,i,f,h,g),14);if(j==d)if(f<g&&a>=f&&a<=g||f>g&&a<=f&&a>=g){k=-1;break}if(!(j<=d))if(!(i!=h&&(j<Math.min(i,
h)||j>Math.max(i,h))))if(f<g&&a>=f&&a<g||f>g&&a<f&&a>=g)++k}}return k==-1?1:!!(k&1)},intersects:function(a){var b=false;if(a.CLASS_NAME=="OpenLayers.Geometry.Point")b=this.containsPoint(a);else if(a.CLASS_NAME=="OpenLayers.Geometry.LineString")b=a.intersects(this);else if(a.CLASS_NAME=="OpenLayers.Geometry.LinearRing")b=OpenLayers.Geometry.LineString.prototype.intersects.apply(this,[a]);else for(var c=0,d=a.components.length;c<d;++c)if(b=a.components[c].intersects(this))break;return b},getVertices:function(a){return a===
true?[]:this.components.slice(0,this.components.length-1)},CLASS_NAME:"OpenLayers.Geometry.LinearRing"});
OpenLayers.Geometry.Polygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LinearRing"],initialize:function(){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments)},getArea:function(){var a=0;if(this.components&&this.components.length>0){a+=Math.abs(this.components[0].getArea());for(var b=1,c=this.components.length;b<c;b++)a-=Math.abs(this.components[b].getArea())}return a},getGeodesicArea:function(a){var b=0;if(this.components&&this.components.length>
0){b+=Math.abs(this.components[0].getGeodesicArea(a));for(var c=1,d=this.components.length;c<d;c++)b-=Math.abs(this.components[c].getGeodesicArea(a))}return b},containsPoint:function(a){var b=this.components.length,c=false;if(b>0){c=this.components[0].containsPoint(a);if(c!==1)if(c&&b>1)for(var d,e=1;e<b;++e)if(d=this.components[e].containsPoint(a)){c=d===1?1:false;break}}return c},intersects:function(a){var b=false,c,d;if(a.CLASS_NAME=="OpenLayers.Geometry.Point")b=this.containsPoint(a);else if(a.CLASS_NAME==
"OpenLayers.Geometry.LineString"||a.CLASS_NAME=="OpenLayers.Geometry.LinearRing"){c=0;for(d=this.components.length;c<d;++c)if(b=a.intersects(this.components[c]))break;if(!b){c=0;for(d=a.components.length;c<d;++c)if(b=this.containsPoint(a.components[c]))break}}else{c=0;for(d=a.components.length;c<d;++c)if(b=this.intersects(a.components[c]))break}if(!b&&a.CLASS_NAME=="OpenLayers.Geometry.Polygon"){var e=this.components[0];c=0;for(d=e.components.length;c<d;++c)if(b=a.containsPoint(e.components[c]))break}return b},
distanceTo:function(a,b){return b&&b.edge===false&&this.intersects(a)?0:OpenLayers.Geometry.Collection.prototype.distanceTo.apply(this,[a,b])},CLASS_NAME:"OpenLayers.Geometry.Polygon"});OpenLayers.Geometry.Polygon.createRegularPolygon=function(a,b,c,d){var e=Math.PI*(1/c-0.5);if(d)e+=d/180*Math.PI;for(var f,g=[],i=0;i<c;++i){f=e+i*2*Math.PI/c;d=a.x+b*Math.cos(f);f=a.y+b*Math.sin(f);g.push(new OpenLayers.Geometry.Point(d,f))}a=new OpenLayers.Geometry.LinearRing(g);return new OpenLayers.Geometry.Polygon([a])};
OpenLayers.Geometry.MultiLineString=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LineString"],initialize:function(){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments)},split:function(a,b){for(var c=null,d=b&&b.mutual,e,f,g,i=[],h=[a],j=0,k=this.components.length;j<k;++j){e=this.components[j];f=false;for(var l=0;l<h.length;++l)if(a=e.split(h[l],b)){if(d){f=a[0];for(var n=0,m=f.length;n<m;++n)n===0&&i.length?i[i.length-1].addComponent(f[n]):
i.push(new OpenLayers.Geometry.MultiLineString([f[n]]));f=true;a=a[1]}if(a.length){a.unshift(l,1);Array.prototype.splice.apply(h,a);break}}if(!f)if(i.length)i[i.length-1].addComponent(e.clone());else i=[new OpenLayers.Geometry.MultiLineString(e.clone())]}if(i&&i.length>1)f=true;else i=[];if(h&&h.length>1)g=true;else h=[];if(f||g)c=d?[i,h]:h;return c},splitWith:function(a,b){var c=null,d=b&&b.mutual,e,f,g,i,h;if(a instanceof OpenLayers.Geometry.LineString){h=[];i=[a];for(var j=0,k=this.components.length;j<
k;++j){f=false;e=this.components[j];for(var l=0;l<i.length;++l)if(a=i[l].split(e,b)){if(d){f=a[0];if(f.length){f.unshift(l,1);Array.prototype.splice.apply(i,f);l+=f.length-2}a=a[1];if(a.length===0)a=[e.clone()]}f=0;for(var n=a.length;f<n;++f)f===0&&h.length?h[h.length-1].addComponent(a[f]):h.push(new OpenLayers.Geometry.MultiLineString([a[f]]));f=true}if(!f)if(h.length)h[h.length-1].addComponent(e.clone());else h=[new OpenLayers.Geometry.MultiLineString([e.clone()])]}}else c=a.split(this);if(i&&i.length>
1)g=true;else i=[];if(h&&h.length>1)f=true;else h=[];if(g||f)c=d?[i,h]:h;return c},CLASS_NAME:"OpenLayers.Geometry.MultiLineString"});OpenLayers.Geometry.MultiPolygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.Polygon"],initialize:function(){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments)},CLASS_NAME:"OpenLayers.Geometry.MultiPolygon"});
OpenLayers.Geometry.Surface=OpenLayers.Class(OpenLayers.Geometry,{initialize:function(){OpenLayers.Geometry.prototype.initialize.apply(this,arguments)},CLASS_NAME:"OpenLayers.Geometry.Surface"});
OpenLayers.Renderer=OpenLayers.Class({container:null,root:null,extent:null,locked:false,size:null,resolution:null,map:null,initialize:function(a){this.container=OpenLayers.Util.getElement(a)},destroy:function(){this.map=this.resolution=this.size=this.extent=this.container=null},supported:function(){return false},setExtent:function(a,b){this.extent=a.clone();if(b)this.resolution=null},setSize:function(a){this.size=a.clone();this.resolution=null},getResolution:function(){return this.resolution=this.resolution||
this.map.getResolution()},drawFeature:function(a,b){if(b==null)b=a.style;if(a.geometry){var c=a.geometry.getBounds();if(c){c.intersectsBounds(this.extent)||(b={display:"none"});c=this.drawGeometry(a.geometry,b,a.id);b.display!="none"&&b.label&&c!==false?this.drawText(a.id,b,a.geometry.getCentroid()):this.removeText(a.id);return c}}},drawGeometry:function(){},drawText:function(){},removeText:function(){},clear:function(){},getFeatureIdFromEvent:function(){},eraseFeatures:function(a){a instanceof Array||
(a=[a]);for(var b=0,c=a.length;b<c;++b){this.eraseGeometry(a[b].geometry);this.removeText(a[b].id)}},eraseGeometry:function(){},moveRoot:function(){},getRenderLayerId:function(){return this.container.id},CLASS_NAME:"OpenLayers.Renderer"});
OpenLayers.ElementsIndexer=OpenLayers.Class({maxZIndex:null,order:null,indices:null,compare:null,initialize:function(a){this.compare=a?OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_Y_ORDER:OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_DRAWING_ORDER;this.order=[];this.indices={};this.maxZIndex=0},insert:function(a){this.exists(a)&&this.remove(a);var b=a.id;this.determineZIndex(a);for(var c=-1,d=this.order.length,e;d-c>1;){e=parseInt((c+d)/2);if(this.compare(this,a,OpenLayers.Util.getElement(this.order[e]))>
0)c=e;else d=e}this.order.splice(d,0,b);this.indices[b]=this.getZIndex(a);return this.getNextElement(d)},remove:function(a){a=a.id;var b=OpenLayers.Util.indexOf(this.order,a);if(b>=0){this.order.splice(b,1);delete this.indices[a];this.maxZIndex=this.order.length>0?this.indices[this.order[this.order.length-1]]:0}},clear:function(){this.order=[];this.indices={};this.maxZIndex=0},exists:function(a){return this.indices[a.id]!=null},getZIndex:function(a){return a._style.graphicZIndex},determineZIndex:function(a){var b=
a._style.graphicZIndex;if(b==null){b=this.maxZIndex;a._style.graphicZIndex=b}else if(b>this.maxZIndex)this.maxZIndex=b},getNextElement:function(a){a=a+1;if(a<this.order.length){var b=OpenLayers.Util.getElement(this.order[a]);if(b==undefined)b=this.getNextElement(a);return b}else return null},CLASS_NAME:"OpenLayers.ElementsIndexer"});
OpenLayers.ElementsIndexer.IndexingMethods={Z_ORDER:function(a,b,c){b=a.getZIndex(b);var d=0;if(c){a=a.getZIndex(c);d=b-a}return d},Z_ORDER_DRAWING_ORDER:function(a,b,c){a=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(a,b,c);if(c&&a==0)a=1;return a},Z_ORDER_Y_ORDER:function(a,b,c){a=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(a,b,c);if(c&&a==0){b=b._geometry.getBounds().bottom;c=c._geometry.getBounds().bottom-b;a=c==0?1:c}return a}};
OpenLayers.Renderer.Elements=OpenLayers.Class(OpenLayers.Renderer,{rendererRoot:null,root:null,vectorRoot:null,textRoot:null,xmlns:null,indexer:null,BACKGROUND_ID_SUFFIX:"_background",LABEL_ID_SUFFIX:"_label",minimumSymbolizer:{strokeLinecap:"round",strokeOpacity:1,strokeDashstyle:"solid",fillOpacity:1,pointRadius:0},initialize:function(a,b){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.rendererRoot=this.createRenderRoot();this.root=this.createRoot("_root");this.vectorRoot=this.createRoot("_vroot");
this.textRoot=this.createRoot("_troot");this.root.appendChild(this.vectorRoot);this.root.appendChild(this.textRoot);this.rendererRoot.appendChild(this.root);this.container.appendChild(this.rendererRoot);if(b&&(b.zIndexing||b.yOrdering))this.indexer=new OpenLayers.ElementsIndexer(b.yOrdering)},destroy:function(){this.clear();this.xmlns=this.root=this.rendererRoot=null;OpenLayers.Renderer.prototype.destroy.apply(this,arguments)},clear:function(){if(this.vectorRoot)for(;this.vectorRoot.childNodes.length>
0;)this.vectorRoot.removeChild(this.vectorRoot.firstChild);if(this.textRoot)for(;this.textRoot.childNodes.length>0;)this.textRoot.removeChild(this.textRoot.firstChild);this.indexer&&this.indexer.clear()},getNodeType:function(){},drawGeometry:function(a,b,c){var d=a.CLASS_NAME,e=true;if(d=="OpenLayers.Geometry.Collection"||d=="OpenLayers.Geometry.MultiPoint"||d=="OpenLayers.Geometry.MultiLineString"||d=="OpenLayers.Geometry.MultiPolygon"){d=0;for(var f=a.components.length;d<f;d++)e=this.drawGeometry(a.components[d],
b,c)&&e;return e}e=false;if(b.display!="none"){b.backgroundGraphic&&this.redrawBackgroundNode(a.id,a,b,c);e=this.redrawNode(a.id,a,b,c)}if(e==false)if(b=document.getElementById(a.id)){b._style.backgroundGraphic&&b.parentNode.removeChild(document.getElementById(a.id+this.BACKGROUND_ID_SUFFIX));b.parentNode.removeChild(b)}return e},redrawNode:function(a,b,c,d){a=this.nodeFactory(a,this.getNodeType(b,c));a._featureId=d;a._geometry=b;a._geometryClass=b.CLASS_NAME;a._style=c;b=this.drawGeometryNode(a,
b,c);if(b===false)return false;a=b.node;if(this.indexer)(c=this.indexer.insert(a))?this.vectorRoot.insertBefore(a,c):this.vectorRoot.appendChild(a);else a.parentNode!==this.vectorRoot&&this.vectorRoot.appendChild(a);this.postDraw(a);return b.complete},redrawBackgroundNode:function(a,b,c){c=OpenLayers.Util.extend({},c);c.externalGraphic=c.backgroundGraphic;c.graphicXOffset=c.backgroundXOffset;c.graphicYOffset=c.backgroundYOffset;c.graphicZIndex=c.backgroundGraphicZIndex;c.graphicWidth=c.backgroundWidth||
c.graphicWidth;c.graphicHeight=c.backgroundHeight||c.graphicHeight;c.backgroundGraphic=null;c.backgroundXOffset=null;c.backgroundYOffset=null;c.backgroundGraphicZIndex=null;return this.redrawNode(a+this.BACKGROUND_ID_SUFFIX,b,c,null)},drawGeometryNode:function(a,b,c){c=c||a._style;OpenLayers.Util.applyDefaults(c,this.minimumSymbolizer);var d={isFilled:c.fill===undefined?true:c.fill,isStroked:c.stroke===undefined?!!c.strokeWidth:c.stroke},e;switch(b.CLASS_NAME){case "OpenLayers.Geometry.Point":if(c.graphic===
false){d.isFilled=false;d.isStroked=false}e=this.drawPoint(a,b);break;case "OpenLayers.Geometry.LineString":d.isFilled=false;e=this.drawLineString(a,b);break;case "OpenLayers.Geometry.LinearRing":e=this.drawLinearRing(a,b);break;case "OpenLayers.Geometry.Polygon":e=this.drawPolygon(a,b);break;case "OpenLayers.Geometry.Surface":e=this.drawSurface(a,b);break;case "OpenLayers.Geometry.Rectangle":e=this.drawRectangle(a,b);break;default:break}a._style=c;a._options=d;return e!=false?{node:this.setStyle(a,
c,d,b),complete:e}:false},postDraw:function(){},drawPoint:function(){},drawLineString:function(){},drawLinearRing:function(){},drawPolygon:function(){},drawRectangle:function(){},drawCircle:function(){},drawSurface:function(){},removeText:function(a){(a=document.getElementById(a+this.LABEL_ID_SUFFIX))&&this.textRoot.removeChild(a)},getFeatureIdFromEvent:function(a){var b=a.target,c=b&&b.correspondingUseElement;return(c?c:b||a.srcElement)._featureId},eraseGeometry:function(a){if(a.CLASS_NAME=="OpenLayers.Geometry.MultiPoint"||
a.CLASS_NAME=="OpenLayers.Geometry.MultiLineString"||a.CLASS_NAME=="OpenLayers.Geometry.MultiPolygon"||a.CLASS_NAME=="OpenLayers.Geometry.Collection")for(var b=0,c=a.components.length;b<c;b++)this.eraseGeometry(a.components[b]);else if((b=OpenLayers.Util.getElement(a.id))&&b.parentNode){if(b.geometry){b.geometry.destroy();b.geometry=null}b.parentNode.removeChild(b);this.indexer&&this.indexer.remove(b);if(b._style.backgroundGraphic)(a=OpenLayers.Util.getElement(a.id+this.BACKGROUND_ID_SUFFIX))&&a.parentNode&&
a.parentNode.removeChild(a)}},nodeFactory:function(a,b){var c=OpenLayers.Util.getElement(a);if(c){if(!this.nodeTypeCompare(c,b)){c.parentNode.removeChild(c);c=this.nodeFactory(a,b)}}else c=this.createNode(b,a);return c},nodeTypeCompare:function(){},createNode:function(){},moveRoot:function(a){var b=this.root;if(a.root.parentNode==this.rendererRoot)b=a.root;b.parentNode.removeChild(b);a.rendererRoot.appendChild(b)},getRenderLayerId:function(){return this.root.parentNode.parentNode.id},isComplexSymbol:function(a){return a!=
"circle"&&!!a},CLASS_NAME:"OpenLayers.Renderer.Elements"});OpenLayers.Renderer.symbol={star:[350,75,379,161,469,161,397,215,423,301,350,250,277,301,303,215,231,161,321,161,350,75],cross:[4,0,6,0,6,4,10,4,10,6,6,6,6,10,4,10,4,6,0,6,0,4,4,4,4,0],x:[0,0,25,0,50,35,75,0,100,0,65,50,100,100,75,100,50,65,25,100,0,100,35,50,0,0],square:[0,0,0,1,1,1,1,0,0,0],triangle:[0,10,10,10,5,0,0,10]};
OpenLayers.Renderer.SVG=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"http://www.w3.org/2000/svg",xlinkns:"http://www.w3.org/1999/xlink",MAX_PIXEL:15E3,translationParameters:null,symbolSize:{},isGecko:null,initialize:function(){if(this.supported()){OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments);this.translationParameters={x:0,y:0};this.isGecko=navigator.userAgent.toLowerCase().indexOf("gecko/")!=-1}},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,
arguments)},supported:function(){return document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#SVG","1.1")||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"))},inValidRange:function(a,b,c){a=a+(c?0:this.translationParameters.x);b=b+(c?0:this.translationParameters.y);return a>=-this.MAX_PIXEL&&a<=this.MAX_PIXEL&&b>=-this.MAX_PIXEL&&b<=this.MAX_PIXEL},setExtent:function(a,
b){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var c=this.getResolution(),d=-a.left/c;c=a.top/c;if(b){this.left=d;this.top=c;this.rendererRoot.setAttributeNS(null,"viewBox","0 0 "+this.size.w+" "+this.size.h);this.translate(0,0);return true}else{(d=this.translate(d-this.left,c-this.top))||this.setExtent(a,true);return d}},translate:function(a,b){if(this.inValidRange(a,b,true)){var c="";if(a||b)c="translate("+a+","+b+")";this.root.setAttributeNS(null,"transform",c);this.translationParameters=
{x:a,y:b};return true}else return false},setSize:function(){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);this.rendererRoot.setAttributeNS(null,"width",this.size.w);this.rendererRoot.setAttributeNS(null,"height",this.size.h)},getNodeType:function(a,b){var c=null;switch(a.CLASS_NAME){case "OpenLayers.Geometry.Point":c=b.externalGraphic?"image":this.isComplexSymbol(b.graphicName)?"use":"circle";break;case "OpenLayers.Geometry.Rectangle":c="rect";break;case "OpenLayers.Geometry.LineString":c=
"polyline";break;case "OpenLayers.Geometry.LinearRing":c="polygon";break;case "OpenLayers.Geometry.Polygon":case "OpenLayers.Geometry.Curve":case "OpenLayers.Geometry.Surface":c="path";break;default:break}return c},setStyle:function(a,b,c){b=b||a._style;c=c||a._options;var d=parseFloat(a.getAttributeNS(null,"r")),e=1,f;if(a._geometryClass=="OpenLayers.Geometry.Point"&&d){a.style.visibility="";if(b.graphic===false)a.style.visibility="hidden";else if(b.externalGraphic){f=this.getPosition(a);b.graphicTitle&&
a.setAttributeNS(null,"title",b.graphicTitle);b.graphicWidth&&b.graphicHeight&&a.setAttributeNS(null,"preserveAspectRatio","none");d=b.graphicWidth||b.graphicHeight;var g=b.graphicHeight||b.graphicWidth;d=d?d:b.pointRadius*2;g=g?g:b.pointRadius*2;var i=b.graphicYOffset!=undefined?b.graphicYOffset:-(0.5*g),h=b.graphicOpacity||b.fillOpacity;a.setAttributeNS(null,"x",(f.x+(b.graphicXOffset!=undefined?b.graphicXOffset:-(0.5*d))).toFixed());a.setAttributeNS(null,"y",(f.y+i).toFixed());a.setAttributeNS(null,
"width",d);a.setAttributeNS(null,"height",g);a.setAttributeNS(this.xlinkns,"href",b.externalGraphic);a.setAttributeNS(null,"style","opacity: "+h)}else if(this.isComplexSymbol(b.graphicName)){d=b.pointRadius*3;g=d*2;e=this.importSymbol(b.graphicName);i="#"+e;f=this.getPosition(a);e=this.symbolSize[e]/g;h=a.parentNode;var j=a.nextSibling;h&&h.removeChild(a);a.setAttributeNS(this.xlinkns,"href",i);a.setAttributeNS(null,"width",g);a.setAttributeNS(null,"height",g);a.setAttributeNS(null,"x",f.x-d);a.setAttributeNS(null,
"y",f.y-d);if(j)h.insertBefore(a,j);else h&&h.appendChild(a)}else a.setAttributeNS(null,"r",b.pointRadius);if(typeof b.rotation!="undefined"&&f){f=OpenLayers.String.format("rotate(${0} ${1} ${2})",[b.rotation,f.x,f.y]);a.setAttributeNS(null,"transform",f)}}if(c.isFilled){a.setAttributeNS(null,"fill",b.fillColor);a.setAttributeNS(null,"fill-opacity",b.fillOpacity)}else a.setAttributeNS(null,"fill","none");if(c.isStroked){a.setAttributeNS(null,"stroke",b.strokeColor);a.setAttributeNS(null,"stroke-opacity",
b.strokeOpacity);a.setAttributeNS(null,"stroke-width",b.strokeWidth*e);a.setAttributeNS(null,"stroke-linecap",b.strokeLinecap);a.setAttributeNS(null,"stroke-linejoin","round");a.setAttributeNS(null,"stroke-dasharray",this.dashStyle(b,e))}else a.setAttributeNS(null,"stroke","none");b.pointerEvents&&a.setAttributeNS(null,"pointer-events",b.pointerEvents);b.cursor!=null&&a.setAttributeNS(null,"cursor",b.cursor);return a},dashStyle:function(a,b){b=a.strokeWidth*b;switch(a.strokeDashstyle){case "solid":return"none";
case "dot":return[1,4*b].join();case "dash":return[4*b,4*b].join();case "dashdot":return[4*b,4*b,1,4*b].join();case "longdash":return[8*b,4*b].join();case "longdashdot":return[8*b,4*b,1,4*b].join();default:return a.strokeDashstyle.replace(/ /g,",")}},createNode:function(a,b){a=document.createElementNS(this.xmlns,a);b&&a.setAttributeNS(null,"id",b);return a},nodeTypeCompare:function(a,b){return b==a.nodeName},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_svgRoot","svg")},
createRoot:function(a){return this.nodeFactory(this.container.id+a,"g")},createDefs:function(){var a=this.nodeFactory(this.container.id+"_defs","defs");this.rendererRoot.appendChild(a);return a},drawPoint:function(a,b){return this.drawCircle(a,b,1)},drawCircle:function(a,b,c){var d=this.getResolution(),e=b.x/d+this.left;b=this.top-b.y/d;if(this.inValidRange(e,b)){a.setAttributeNS(null,"cx",e);a.setAttributeNS(null,"cy",b);a.setAttributeNS(null,"r",c);return a}else return false},drawLineString:function(a,
b){b=this.getComponentsString(b.components);if(b.path){a.setAttributeNS(null,"points",b.path);return b.complete?a:null}else return false},drawLinearRing:function(a,b){b=this.getComponentsString(b.components);if(b.path){a.setAttributeNS(null,"points",b.path);return b.complete?a:null}else return false},drawPolygon:function(a,b){for(var c="",d=true,e=true,f,g,i=0,h=b.components.length;i<h;i++){c+=" M";f=this.getComponentsString(b.components[i].components," ");if(g=f.path){c+=" "+g;e=f.complete&&e}else d=
false}c+=" z";if(d){a.setAttributeNS(null,"d",c);a.setAttributeNS(null,"fill-rule","evenodd");return e?a:null}else return false},drawRectangle:function(a,b){var c=this.getResolution(),d=b.x/c+this.left,e=this.top-b.y/c;if(this.inValidRange(d,e)){a.setAttributeNS(null,"x",d);a.setAttributeNS(null,"y",e);a.setAttributeNS(null,"width",b.width/c);a.setAttributeNS(null,"height",b.height/c);return a}else return false},drawSurface:function(a,b){for(var c=null,d=true,e=0,f=b.components.length;e<f;e++)if(e%
3==0&&e/3==0){var g=this.getShortString(b.components[e]);g||(d=false);c="M "+g}else if(e%3==1){(g=this.getShortString(b.components[e]))||(d=false);c+=" C "+g}else{(g=this.getShortString(b.components[e]))||(d=false);c+=" "+g}c+=" Z";if(d){a.setAttributeNS(null,"d",c);return a}else return false},drawText:function(a,b,c){var d=this.getResolution(),e=c.x/d+this.left;d=c.y/d-this.top;c=this.nodeFactory(a+this.LABEL_ID_SUFFIX,"text");a=this.nodeFactory(a+this.LABEL_ID_SUFFIX+"_tspan","tspan");c.setAttributeNS(null,
"x",e);c.setAttributeNS(null,"y",-d);c.setAttributeNS(null,"pointer-events","none");b.fontColor&&c.setAttributeNS(null,"fill",b.fontColor);b.fontFamily&&c.setAttributeNS(null,"font-family",b.fontFamily);b.fontSize&&c.setAttributeNS(null,"font-size",b.fontSize);b.fontWeight&&c.setAttributeNS(null,"font-weight",b.fontWeight);e=b.labelAlign||"cm";c.setAttributeNS(null,"text-anchor",OpenLayers.Renderer.SVG.LABEL_ALIGN[e[0]]||"middle");this.isGecko?c.setAttributeNS(null,"dominant-baseline",OpenLayers.Renderer.SVG.LABEL_ALIGN[e[1]]||
"central"):a.setAttributeNS(null,"baseline-shift",OpenLayers.Renderer.SVG.LABEL_VSHIFT[e[1]]||"-35%");a.textContent=b.label;if(!c.parentNode){c.appendChild(a);this.textRoot.appendChild(c)}},getComponentsString:function(a,b){for(var c=[],d=true,e=a.length,f=[],g,i=0;i<e;i++){g=a[i];c.push(g);if(g=this.getShortString(g))f.push(g);else{i>0&&this.getShortString(a[i-1])&&f.push(this.clipLine(a[i],a[i-1]));i<e-1&&this.getShortString(a[i+1])&&f.push(this.clipLine(a[i],a[i+1]));d=false}}return{path:f.join(b||
","),complete:d}},clipLine:function(a,b){if(b.equals(a))return"";var c=this.getResolution(),d=this.MAX_PIXEL-this.translationParameters.x,e=this.MAX_PIXEL-this.translationParameters.y,f=b.x/c+this.left;b=this.top-b.y/c;var g=a.x/c+this.left;a=this.top-a.y/c;if(g<-d||g>d){c=(a-b)/(g-f);g=g<0?-d:d;a=b+(g-f)*c}if(a<-e||a>e){c=(g-f)/(a-b);a=a<0?-e:e;g=f+(a-b)*c}return g+","+a},getShortString:function(a){var b=this.getResolution(),c=a.x/b+this.left;a=this.top-a.y/b;return this.inValidRange(c,a)?c+","+
a:false},getPosition:function(a){return{x:parseFloat(a.getAttributeNS(null,"cx")),y:parseFloat(a.getAttributeNS(null,"cy"))}},importSymbol:function(a){if(!this.defs)this.defs=this.createDefs();var b=this.container.id+"-"+a;if(document.getElementById(b)!=null)return b;var c=OpenLayers.Renderer.symbol[a];if(c){a=this.nodeFactory(b,"symbol");var d=this.nodeFactory(null,"polygon");a.appendChild(d);for(var e=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0),f="",g,i,h=0;h<c.length;h+=2){g=c[h];
i=c[h+1];e.left=Math.min(e.left,g);e.bottom=Math.min(e.bottom,i);e.right=Math.max(e.right,g);e.top=Math.max(e.top,i);f+=" "+g+","+i}d.setAttributeNS(null,"points",f);c=e.getWidth();d=e.getHeight();a.setAttributeNS(null,"viewBox",[e.left-c,e.bottom-d,c*3,d*3].join(" "));this.symbolSize[b]=Math.max(c,d)*3;this.defs.appendChild(a);return a.id}else throw new Error(a+" is not a valid symbol name");},CLASS_NAME:"OpenLayers.Renderer.SVG"});
OpenLayers.Renderer.SVG.LABEL_ALIGN={l:"start",r:"end",b:"bottom",t:"hanging"};OpenLayers.Renderer.SVG.LABEL_VSHIFT={t:"-70%",b:"0"};
OpenLayers.Renderer.Canvas=OpenLayers.Class(OpenLayers.Renderer,{canvas:null,features:null,geometryMap:null,initialize:function(){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.root=document.createElement("canvas");this.container.appendChild(this.root);this.canvas=this.root.getContext("2d");this.features={};this.geometryMap={}},eraseGeometry:function(a){this.eraseFeatures(this.features[this.geometryMap[a.id]][0])},supported:function(){return!!document.createElement("canvas").getContext},
setExtent:function(a){this.extent=a.clone();this.resolution=null;this.redraw()},setSize:function(a){this.size=a.clone();this.root.style.width=a.w+"px";this.root.style.height=a.h+"px";this.root.width=a.w;this.root.height=a.h;this.resolution=null},drawFeature:function(a,b){if(b==null)b=a.style;b=OpenLayers.Util.extend({fillColor:"#000000",strokeColor:"#000000",strokeWidth:2,fillOpacity:1,strokeOpacity:1},b);this.features[a.id]=[a,b];if(a.geometry)this.geometryMap[a.geometry.id]=a.id;this.redraw()},
drawGeometry:function(a,b){var c=a.CLASS_NAME;if(c=="OpenLayers.Geometry.Collection"||c=="OpenLayers.Geometry.MultiPoint"||c=="OpenLayers.Geometry.MultiLineString"||c=="OpenLayers.Geometry.MultiPolygon")for(c=0;c<a.components.length;c++)this.drawGeometry(a.components[c],b);else switch(a.CLASS_NAME){case "OpenLayers.Geometry.Point":this.drawPoint(a,b);break;case "OpenLayers.Geometry.LineString":this.drawLineString(a,b);break;case "OpenLayers.Geometry.LinearRing":this.drawLinearRing(a,b);break;case "OpenLayers.Geometry.Polygon":this.drawPolygon(a,
b);break;default:break}},drawExternalGraphic:function(a,b){var c=new Image;c.src=b.externalGraphic;if(b.graphicTitle)c.title=b.graphicTitle;var d=b.graphicWidth||b.graphicHeight,e=b.graphicHeight||b.graphicWidth;d=d?d:b.pointRadius*2;e=e?e:b.pointRadius*2;c.onload=OpenLayers.Function.bind(function(){this.canvas.drawImage(this.img,this.x,this.y,this.width,this.height)},{img:c,x:a[0]+(b.graphicXOffset!=undefined?b.graphicXOffset:-(0.5*d)),y:a[1]+(b.graphicYOffset!=undefined?b.graphicYOffset:-(0.5*e)),
width:d,height:e,canvas:this.canvas})},setCanvasStyle:function(a,b){if(a=="fill"){this.canvas.globalAlpha=b.fillOpacity;this.canvas.fillStyle=b.fillColor}else if(a=="stroke"){this.canvas.globalAlpha=b.strokeOpacity;this.canvas.strokeStyle=b.strokeColor;this.canvas.lineWidth=b.strokeWidth}else{this.canvas.globalAlpha=0;this.canvas.lineWidth=1}},drawPoint:function(a,b){if(b.graphic!==false){a=this.getLocalXY(a);if(b.externalGraphic)this.drawExternalGraphic(a,b);else{if(b.fill!==false){this.setCanvasStyle("fill",
b);this.canvas.beginPath();this.canvas.arc(a[0],a[1],6,0,Math.PI*2,true);this.canvas.fill()}if(b.stroke!==false){this.setCanvasStyle("stroke",b);this.canvas.beginPath();this.canvas.arc(a[0],a[1],6,0,Math.PI*2,true);this.canvas.stroke();this.setCanvasStyle("reset")}}}},drawLineString:function(a,b){if(b.stroke!==false){this.setCanvasStyle("stroke",b);this.canvas.beginPath();b=this.getLocalXY(a.components[0]);this.canvas.moveTo(b[0],b[1]);for(b=1;b<a.components.length;b++){var c=this.getLocalXY(a.components[b]);
this.canvas.lineTo(c[0],c[1])}this.canvas.stroke()}this.setCanvasStyle("reset")},drawLinearRing:function(a,b){if(b.fill!==false){this.setCanvasStyle("fill",b);this.canvas.beginPath();var c=this.getLocalXY(a.components[0]);this.canvas.moveTo(c[0],c[1]);for(c=1;c<a.components.length-1;c++){var d=this.getLocalXY(a.components[c]);this.canvas.lineTo(d[0],d[1])}this.canvas.fill()}if(b.stroke!==false){this.setCanvasStyle("stroke",b);this.canvas.beginPath();c=this.getLocalXY(a.components[0]);this.canvas.moveTo(c[0],
c[1]);for(c=1;c<a.components.length;c++){d=this.getLocalXY(a.components[c]);this.canvas.lineTo(d[0],d[1])}this.canvas.stroke()}this.setCanvasStyle("reset")},drawPolygon:function(a,b){this.drawLinearRing(a.components[0],b);for(b=1;b<a.components.length;b++)this.drawLinearRing(a.components[b],{fillOpacity:0,strokeWidth:0,strokeOpacity:0,strokeColor:"#000000",fillColor:"#000000"})},drawText:function(a,b){b=OpenLayers.Util.extend({fontColor:"#000000",labelAlign:"cm"},b);a=this.getLocalXY(a);this.setCanvasStyle("reset");
this.canvas.fillStyle=b.fontColor;this.canvas.globalAlpha=1;var c=b.fontWeight+" "+b.fontSize+" "+b.fontFamily;if(this.canvas.fillText){var d=OpenLayers.Renderer.Canvas.LABEL_ALIGN[b.labelAlign[0]]||"middle";this.canvas.font=c;this.canvas.textAlign=d;this.canvas.fillText(b.label,a[0],a[1])}else if(this.canvas.mozDrawText){this.canvas.mozTextStyle=c;c=this.canvas.mozMeasureText(b.label);switch(b.labelAlign[0]){case "l":break;case "r":a[0]-=c;break;case "c":default:a[0]-=c/2}this.canvas.translate(a[0],
a[1]);this.canvas.mozDrawText(b.label);this.canvas.translate(-1*a[0],-1*a[1])}this.setCanvasStyle("reset")},getLocalXY:function(a){var b=this.getResolution(),c=this.extent;return[a.x/b+-c.left/b,c.top/b-a.y/b]},clear:function(){this.canvas.clearRect(0,0,this.root.width,this.root.height)},getFeatureIdFromEvent:function(a){a=this.map.getLonLatFromPixel(a.xy);var b=this.getResolution();a=(new OpenLayers.Bounds(a.lon-b*5,a.lat-b*5,a.lon+b*5,a.lat+b*5)).toGeometry();for(var c in this.features)if(this.features.hasOwnProperty(c))if(this.features[c][0].geometry.intersects(a))return c;
return null},eraseFeatures:function(a){a instanceof Array||(a=[a]);for(var b=0;b<a.length;++b)delete this.features[a[b].id];this.redraw()},redraw:function(){if(!this.locked){this.clear();var a=[],b,c;for(var d in this.features)if(this.features.hasOwnProperty(d)){b=this.features[d][0];c=this.features[d][1];if(b.geometry){this.drawGeometry(b.geometry,c);c.label&&a.push([b,c])}}for(c=0;len=a.length,c<len;++c){b=a[c];this.drawText(b[0].geometry.getCentroid(),b[1])}}},CLASS_NAME:"OpenLayers.Renderer.Canvas"});
OpenLayers.Renderer.Canvas.LABEL_ALIGN={l:"left",r:"right"};
OpenLayers.Renderer.VML=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"urn:schemas-microsoft-com:vml",symbolCache:{},offset:null,initialize:function(){if(this.supported()){if(!document.namespaces.olv){document.namespaces.add("olv",this.xmlns);for(var a=document.createStyleSheet(),b=["shape","rect","oval","fill","stroke","imagedata","group","textbox"],c=0,d=b.length;c<d;c++)a.addRule("olv\\:"+b[c],"behavior: url(#default#VML); position: absolute; display: inline-block;")}OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments);
this.offset={x:0,y:0}}},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments)},supported:function(){return!!document.namespaces},setExtent:function(a,b){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var c=this.getResolution(),d=a.left/c;c=a.top/c-this.size.h;if(b){this.offset={x:d,y:c};c=d=0}else{d-=this.offset.x;c-=this.offset.y}this.root.coordorigin=d+" "+c;d=[this.root,this.vectorRoot,this.textRoot];for(var e=0,f=d.length;e<f;++e){c=d[e];
c.coordsize=this.size.w+" "+this.size.h}this.root.style.flip="y";return true},setSize:function(){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);for(var a=[this.rendererRoot,this.root,this.vectorRoot,this.textRoot],b=this.size.w+"px",c=this.size.h+"px",d,e=0,f=a.length;e<f;++e){d=a[e];d.style.width=b;d.style.height=c}},getNodeType:function(a,b){var c=null;switch(a.CLASS_NAME){case "OpenLayers.Geometry.Point":c=b.externalGraphic?"olv:rect":this.isComplexSymbol(b.graphicName)?"olv:shape":
"olv:oval";break;case "OpenLayers.Geometry.Rectangle":c="olv:rect";break;case "OpenLayers.Geometry.LineString":case "OpenLayers.Geometry.LinearRing":case "OpenLayers.Geometry.Polygon":case "OpenLayers.Geometry.Curve":case "OpenLayers.Geometry.Surface":c="olv:shape";break;default:break}return c},setStyle:function(a,b,c,d){b=b||a._style;c=c||a._options;if(a._geometryClass=="OpenLayers.Geometry.Point")if(b.externalGraphic){if(b.graphicTitle)a.title=b.graphicTitle;var e=b.graphicWidth||b.graphicHeight,
f=b.graphicHeight||b.graphicWidth;e=e?e:b.pointRadius*2;f=f?f:b.pointRadius*2;var g=this.getResolution(),i=b.graphicXOffset!=undefined?b.graphicXOffset:-(0.5*e),h=b.graphicYOffset!=undefined?b.graphicYOffset:-(0.5*f);a.style.left=(d.x/g-this.offset.x+i).toFixed();a.style.top=(d.y/g-this.offset.y-(h+f)).toFixed();a.style.width=e+"px";a.style.height=f+"px";a.style.flip="y";b.fillColor="none";c.isStroked=false}else if(this.isComplexSymbol(b.graphicName)){e=this.importSymbol(b.graphicName);a.path=e.path;
a.coordorigin=e.left+","+e.bottom;e=e.size;a.coordsize=e+","+e;this.drawCircle(a,d,b.pointRadius);a.style.flip="y"}else this.drawCircle(a,d,b.pointRadius);if(c.isFilled)a.fillcolor=b.fillColor;else a.filled="false";d=a.getElementsByTagName("fill");d=d.length==0?null:d[0];if(c.isFilled){d||(d=this.createNode("olv:fill",a.id+"_fill"));d.opacity=b.fillOpacity;if(a._geometryClass=="OpenLayers.Geometry.Point"&&b.externalGraphic){if(b.graphicOpacity)d.opacity=b.graphicOpacity;d.src=b.externalGraphic;d.type=
"frame";if(!(b.graphicWidth&&b.graphicHeight))d.aspect="atmost"}d.parentNode!=a&&a.appendChild(d)}else d&&a.removeChild(d);if(typeof b.rotation!="undefined")if(b.externalGraphic){this.graphicRotate(a,i,h);d.opacity=0}else a.style.rotation=b.rotation;if(c.isStroked){a.strokecolor=b.strokeColor;a.strokeweight=b.strokeWidth+"px"}else a.stroked=false;i=a.getElementsByTagName("stroke");i=i.length==0?null:i[0];if(c.isStroked){if(!i){i=this.createNode("olv:stroke",a.id+"_stroke");a.appendChild(i)}i.opacity=
b.strokeOpacity;i.endcap=!b.strokeLinecap||b.strokeLinecap=="butt"?"flat":b.strokeLinecap;i.dashstyle=this.dashStyle(b)}else i&&a.removeChild(i);if(b.cursor!="inherit"&&b.cursor!=null)a.style.cursor=b.cursor;return a},graphicRotate:function(a,b,c){var d=d||a._style,e,f;if(d.graphicWidth&&d.graphicHeight){f=Math.max(d.graphicWidth,d.graphicHeight);e=d.graphicWidth/d.graphicHeight;var g=Math.round(d.graphicWidth||f*e),i=Math.round(d.graphicHeight||f);a.style.width=g+"px";a.style.height=i+"px";var h=
document.getElementById(a.id+"_image");if(!h){h=this.createNode("olv:imagedata",a.id+"_image");a.appendChild(h)}h.style.width=g+"px";h.style.height=i+"px";h.src=d.externalGraphic;h.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='', sizingMethod='scale')";var j=d.rotation*Math.PI/180;h=Math.sin(j);j=Math.cos(j);h="progid:DXImageTransform.Microsoft.Matrix(M11="+j+",M12="+-h+",M21="+h+",M22="+j+",SizingMethod='auto expand')\n";if((j=d.graphicOpacity||d.fillOpacity)&&j!=1)h+="progid:DXImageTransform.Microsoft.BasicImage(opacity="+
j+")\n";a.style.filter=h;h=new OpenLayers.Geometry.Point(-b,-c);g=(new OpenLayers.Bounds(0,0,g,i)).toGeometry();g.rotate(d.rotation,h);g=g.getBounds();a.style.left=Math.round(parseInt(a.style.left)+g.left)+"px";a.style.top=Math.round(parseInt(a.style.top)-g.bottom)+"px"}else{var k=new Image;k.onreadystatechange=OpenLayers.Function.bind(function(){if(k.readyState=="complete"||k.readyState=="interactive"){e=k.width/k.height;f=Math.max(d.pointRadius*2,d.graphicWidth||0,d.graphicHeight||0);b*=e;d.graphicWidth=
f*e;d.graphicHeight=f;this.graphicRotate(a,b,c)}},this);k.src=d.externalGraphic}},postDraw:function(a){var b=a._style.fillColor,c=a._style.strokeColor;if(b=="none"&&a.fillcolor!=b)a.fillcolor=b;if(c=="none"&&a.strokecolor!=c)a.strokecolor=c},setNodeDimension:function(a,b){if(b=b.getBounds()){var c=this.getResolution();b=new OpenLayers.Bounds((b.left/c-this.offset.x).toFixed(),(b.bottom/c-this.offset.y).toFixed(),(b.right/c-this.offset.x).toFixed(),(b.top/c-this.offset.y).toFixed());a.style.left=b.left+
"px";a.style.top=b.top+"px";a.style.width=b.getWidth()+"px";a.style.height=b.getHeight()+"px";a.coordorigin=b.left+" "+b.top;a.coordsize=b.getWidth()+" "+b.getHeight()}},dashStyle:function(a){a=a.strokeDashstyle;switch(a){case "solid":case "dot":case "dash":case "dashdot":case "longdash":case "longdashdot":return a;default:a=a.split(/[ ,]/);if(a.length==2){if(1*a[0]>=2*a[1])return"longdash";return a[0]==1||a[1]==1?"dot":"dash"}else if(a.length==4)return 1*a[0]>=2*a[1]?"longdashdot":"dashdot";return"solid"}},
createNode:function(a,b){a=document.createElement(a);if(b)a.id=b;a.unselectable="on";a.onselectstart=function(){return false};return a},nodeTypeCompare:function(a,b){b=b;var c=b.indexOf(":");if(c!=-1)b=b.substr(c+1);a=a.nodeName;c=a.indexOf(":");if(c!=-1)a=a.substr(c+1);return b==a},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_vmlRoot","div")},createRoot:function(a){return this.nodeFactory(this.container.id+a,"olv:group")},drawPoint:function(a,b){return this.drawCircle(a,
b,1)},drawCircle:function(a,b,c){if(!isNaN(b.x)&&!isNaN(b.y)){var d=this.getResolution();a.style.left=(b.x/d-this.offset.x).toFixed()-c+"px";a.style.top=(b.y/d-this.offset.y).toFixed()-c+"px";b=c*2;a.style.width=b+"px";a.style.height=b+"px";return a}return false},drawLineString:function(a,b){return this.drawLine(a,b,false)},drawLinearRing:function(a,b){return this.drawLine(a,b,true)},drawLine:function(a,b,c){this.setNodeDimension(a,b);for(var d=this.getResolution(),e=b.components.length,f=new Array(e),
g,i,h=0;h<e;h++){g=b.components[h];i=g.x/d-this.offset.x;g=g.y/d-this.offset.y;f[h]=" "+i.toFixed()+","+g.toFixed()+" l "}b=c?" x e":" e";a.path="m"+f.join("")+b;return a},drawPolygon:function(a,b){this.setNodeDimension(a,b);var c=this.getResolution(),d=[],e,f,g,i,h,j,k;g=0;for(i=b.components.length;g<i;g++){e=b.components[g];d.push("m");f=0;for(h=e.components.length;f<h;f++){j=e.components[f];k=j.x/c-this.offset.x;j=j.y/c-this.offset.y;d.push(" "+k.toFixed()+","+j.toFixed());f==0&&d.push(" l")}d.push(" x ")}d.push("e");
a.path=d.join("");return a},drawRectangle:function(a,b){var c=this.getResolution();a.style.left=b.x/c-this.offset.x+"px";a.style.top=b.y/c-this.offset.y+"px";a.style.width=b.width/c+"px";a.style.height=b.height/c+"px";return a},drawText:function(a,b,c){var d=this.nodeFactory(a+this.LABEL_ID_SUFFIX,"olv:rect");a=this.nodeFactory(a+this.LABEL_ID_SUFFIX+"_textbox","olv:textbox");var e=this.getResolution();d.style.left=(c.x/e-this.offset.x).toFixed()+"px";d.style.top=(c.y/e-this.offset.y).toFixed()+"px";
d.style.flip="y";a.innerText=b.label;if(b.fillColor)a.style.color=b.fontColor;if(b.fontFamily)a.style.fontFamily=b.fontFamily;if(b.fontSize)a.style.fontSize=b.fontSize;if(b.fontWeight)a.style.fontWeight=b.fontWeight;a.style.whiteSpace="nowrap";a.inset="1px,0px,0px,0px";if(!d.parentNode){d.appendChild(a);this.textRoot.appendChild(d)}c=b.labelAlign||"cm";b=a.clientWidth*OpenLayers.Renderer.VML.LABEL_SHIFT[c.substr(0,1)];a=a.clientHeight*OpenLayers.Renderer.VML.LABEL_SHIFT[c.substr(1,1)];d.style.left=
parseInt(d.style.left)-b-1+"px";d.style.top=parseInt(d.style.top)+a+"px"},drawSurface:function(a,b){this.setNodeDimension(a,b);for(var c=this.getResolution(),d=[],e,f,g=0,i=b.components.length;g<i;g++){e=b.components[g];f=e.x/c-this.offset.x;e=e.y/c-this.offset.y;if(g%3==0&&g/3==0)d.push("m");else g%3==1&&d.push(" c");d.push(" "+f+","+e)}d.push(" x e");a.path=d.join("");return a},moveRoot:function(a){var b=this.map.getLayer(a.container.id);if(b instanceof OpenLayers.Layer.Vector.RootContainer)b=this.map.getLayer(this.container.id);
b&&b.renderer.clear();OpenLayers.Renderer.Elements.prototype.moveRoot.apply(this,arguments);b&&b.redraw()},importSymbol:function(a){var b=this.container.id+"-"+a,c=this.symbolCache[b];if(c)return c;if(c=OpenLayers.Renderer.symbol[a]){a=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0);for(var d=["m"],e=0;e<c.length;e+=2){x=c[e];y=c[e+1];a.left=Math.min(a.left,x);a.bottom=Math.min(a.bottom,y);a.right=Math.max(a.right,x);a.top=Math.max(a.top,y);d.push(x);d.push(y);e==0&&d.push("l")}d.push("x e");
c=d.join(" ");d=(a.getWidth()-a.getHeight())/2;if(d>0){a.bottom-=d;a.top+=d}else{a.left-=d;a.right+=d}c={path:c,size:a.getWidth(),left:a.left,bottom:a.bottom};return this.symbolCache[b]=c}else throw new Error(a+" is not a valid symbol name");},CLASS_NAME:"OpenLayers.Renderer.VML"});OpenLayers.Renderer.VML.LABEL_SHIFT={l:0,c:0.5,r:1,t:0,m:0.5,b:1};
OpenLayers.Layer.Vector=OpenLayers.Class(OpenLayers.Layer,{EVENT_TYPES:["beforefeatureadded","beforefeaturesadded","featureadded","featuresadded","beforefeatureremoved","featureremoved","featuresremoved","beforefeatureselected","featureselected","featureunselected","beforefeaturemodified","featuremodified","afterfeaturemodified","vertexmodified","sketchstarted","sketchmodified","sketchcomplete","refresh"],isBaseLayer:false,isFixed:false,isVector:true,features:null,selectedFeatures:null,unrenderedFeatures:null,
reportError:true,style:null,styleMap:null,strategies:null,protocol:null,renderers:["SVG","VML","Canvas"],renderer:null,rendererOptions:null,geometryType:null,drawn:false,initialize:function(){this.EVENT_TYPES=OpenLayers.Layer.Vector.prototype.EVENT_TYPES.concat(OpenLayers.Layer.prototype.EVENT_TYPES);OpenLayers.Layer.prototype.initialize.apply(this,arguments);if(!this.renderer||!this.renderer.supported())this.assignRenderer();if(!this.renderer||!this.renderer.supported()){this.renderer=null;this.displayError()}if(!this.styleMap)this.styleMap=
new OpenLayers.StyleMap;this.features=[];this.selectedFeatures=[];this.unrenderedFeatures={};if(this.strategies)for(var a=0,b=this.strategies.length;a<b;a++)this.strategies[a].setLayer(this)},destroy:function(){if(this.strategies){var a,b,c;b=0;for(c=this.strategies.length;b<c;b++){a=this.strategies[b];a.autoDestroy&&a.destroy()}this.strategies=null}if(this.protocol){this.protocol.autoDestroy&&this.protocol.destroy();this.protocol=null}this.destroyFeatures();this.unrenderedFeatures=this.selectedFeatures=
this.features=null;this.renderer&&this.renderer.destroy();this.drawn=this.geometryType=this.renderer=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},refresh:function(a){this.calculateInRange()&&this.visibility&&this.events.triggerEvent("refresh",a)},assignRenderer:function(){for(var a=0,b=this.renderers.length;a<b;a++){var c=OpenLayers.Renderer[this.renderers[a]];if(c&&c.prototype.supported()){this.renderer=new c(this.div,this.rendererOptions);break}}},displayError:function(){this.reportError&&
OpenLayers.Console.userError(OpenLayers.i18n("browserNotSupported",{renderers:this.renderers.join("\n")}))},setMap:function(){OpenLayers.Layer.prototype.setMap.apply(this,arguments);if(this.renderer){this.renderer.map=this.map;this.renderer.setSize(this.map.getSize())}else this.map.removeLayer(this)},afterAdd:function(){if(this.strategies){var a,b,c;b=0;for(c=this.strategies.length;b<c;b++){a=this.strategies[b];a.autoActivate&&a.activate()}}},removeMap:function(){if(this.strategies){var a,b,c;b=0;
for(c=this.strategies.length;b<c;b++){a=this.strategies[b];a.autoActivate&&a.deactivate()}}},onMapResize:function(){OpenLayers.Layer.prototype.onMapResize.apply(this,arguments);this.renderer.setSize(this.map.getSize())},moveTo:function(a,b,c){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);var d=true;if(!c){this.renderer.root.style.visibility="hidden";this.div.style.left=-parseInt(this.map.layerContainerDiv.style.left)+"px";this.div.style.top=-parseInt(this.map.layerContainerDiv.style.top)+
"px";d=this.renderer.setExtent(this.map.getExtent(),b);this.renderer.root.style.visibility="visible";if(navigator.userAgent.toLowerCase().indexOf("gecko")!=-1)this.div.scrollLeft=this.div.scrollLeft;if(!b&&d)for(var e in this.unrenderedFeatures){var f=this.unrenderedFeatures[e];this.drawFeature(f)}}if(!this.drawn||b||!d){this.drawn=true;e=0;for(d=this.features.length;e<d;e++){this.renderer.locked=e!==d-1;f=this.features[e];this.drawFeature(f)}}},display:function(){OpenLayers.Layer.prototype.display.apply(this,
arguments);var a=this.div.style.display;if(a!=this.renderer.root.style.display)this.renderer.root.style.display=a},addFeatures:function(a,b){a instanceof Array||(a=[a]);if(b=!b||!b.silent){a={features:a};if(this.events.triggerEvent("beforefeaturesadded",a)===false)return;a=a.features}for(var c=0,d=a.length;c<d;c++){this.renderer.locked=c!=a.length-1?true:false;var e=a[c];if(this.geometryType&&!(e.geometry instanceof this.geometryType))throw OpenLayers.i18n("componentShouldBe",{geomType:this.geometryType.prototype.CLASS_NAME});
this.features.push(e);e.layer=this;if(!e.style&&this.style)e.style=OpenLayers.Util.extend({},this.style);if(b){if(this.events.triggerEvent("beforefeatureadded",{feature:e})===false)continue;this.preFeatureInsert(e)}this.drawFeature(e);if(b){this.events.triggerEvent("featureadded",{feature:e});this.onFeatureInsert(e)}}b&&this.events.triggerEvent("featuresadded",{features:a})},removeFeatures:function(a,b){if(!(!a||a.length===0)){a instanceof Array||(a=[a]);if(a===this.features)a=a.slice();b=!b||!b.silent;
for(var c=a.length-1;c>=0;c--){this.renderer.locked=c!=0&&a[c-1].geometry?true:false;var d=a[c];delete this.unrenderedFeatures[d.id];b&&this.events.triggerEvent("beforefeatureremoved",{feature:d});this.features=OpenLayers.Util.removeItem(this.features,d);d.layer=null;d.geometry&&this.renderer.eraseFeatures(d);OpenLayers.Util.indexOf(this.selectedFeatures,d)!=-1&&OpenLayers.Util.removeItem(this.selectedFeatures,d);b&&this.events.triggerEvent("featureremoved",{feature:d})}b&&this.events.triggerEvent("featuresremoved",
{features:a})}},destroyFeatures:function(a,b){if(a==undefined)a=this.features;if(a){this.removeFeatures(a,b);for(b=a.length-1;b>=0;b--)a[b].destroy()}},drawFeature:function(a,b){if(this.drawn){if(typeof b!="object"){if(!b&&a.state===OpenLayers.State.DELETE)b="delete";var c=b||a.renderIntent;(b=a.style||this.style)||(b=this.styleMap.createSymbolizer(a,c))}if(this.renderer.drawFeature(a,b))delete this.unrenderedFeatures[a.id];else this.unrenderedFeatures[a.id]=a}},eraseFeatures:function(a){this.renderer.eraseFeatures(a)},
getFeatureFromEvent:function(a){if(!this.renderer){OpenLayers.Console.error(OpenLayers.i18n("getFeatureError"));return null}return this.getFeatureById(this.renderer.getFeatureIdFromEvent(a))},getFeatureById:function(a){for(var b=null,c=0,d=this.features.length;c<d;++c)if(this.features[c].id==a){b=this.features[c];break}return b},onFeatureInsert:function(){},preFeatureInsert:function(){},getDataExtent:function(){var a=null;if(this.features&&this.features.length>0){a=new OpenLayers.Bounds;for(var b=
0,c=this.features.length;b<c;b++)a.extend(this.features[b].geometry.getBounds())}return a},CLASS_NAME:"OpenLayers.Layer.Vector"});
OpenLayers.Layer.Vector.RootContainer=OpenLayers.Class(OpenLayers.Layer.Vector,{displayInLayerSwitcher:false,layers:null,initialize:function(){OpenLayers.Layer.Vector.prototype.initialize.apply(this,arguments)},display:function(){},getFeatureFromEvent:function(a){for(var b=this.layers,c,d=0;d<b.length;d++)if(c=b[d].getFeatureFromEvent(a))return c},setMap:function(a){OpenLayers.Layer.Vector.prototype.setMap.apply(this,arguments);this.collectRoots();a.events.register("changelayer",this,this.handleChangeLayer)},
removeMap:function(a){a.events.unregister("changelayer",this,this.handleChangeLayer);this.resetRoots();OpenLayers.Layer.Vector.prototype.removeMap.apply(this,arguments)},collectRoots:function(){for(var a,b=0;b<this.map.layers.length;++b){a=this.map.layers[b];OpenLayers.Util.indexOf(this.layers,a)!=-1&&a.renderer.moveRoot(this.renderer)}},resetRoots:function(){for(var a,b=0;b<this.layers.length;++b){a=this.layers[b];this.renderer&&a.renderer.getRenderLayerId()==this.id&&this.renderer.moveRoot(a.renderer)}},
handleChangeLayer:function(a){var b=a.layer;if(a.property=="order"&&OpenLayers.Util.indexOf(this.layers,b)!=-1){this.resetRoots();this.collectRoots()}},CLASS_NAME:"OpenLayers.Layer.Vector.RootContainer"});
OpenLayers.Style=OpenLayers.Class({name:null,title:null,description:null,layerName:null,isDefault:false,rules:null,context:null,defaultStyle:null,defaultsPerSymbolizer:false,propertyStyles:null,initialize:function(a,b){OpenLayers.Util.extend(this,b);this.rules=[];b&&b.rules&&this.addRules(b.rules);this.setDefaultStyle(a||OpenLayers.Feature.Vector.style["default"])},destroy:function(){for(var a=0,b=this.rules.length;a<b;a++){this.rules[a].destroy();this.rules[a]=null}this.defaultStyle=this.rules=null},
createSymbolizer:function(a){for(var b=this.defaultsPerSymbolizer?{}:this.createLiterals(OpenLayers.Util.extend({},this.defaultStyle),a),c=this.rules,d,e=[],f=false,g=0,i=c.length;g<i;g++){d=c[g];if(d.evaluate(a))if(d instanceof OpenLayers.Rule&&d.elseFilter)e.push(d);else{f=true;this.applySymbolizer(d,b,a)}}if(f==false&&e.length>0){f=true;g=0;for(i=e.length;g<i;g++)this.applySymbolizer(e[g],b,a)}if(c.length>0&&f==false)b.display="none";return b},applySymbolizer:function(a,b,c){var d=c.geometry?this.getSymbolizerPrefix(c.geometry):
OpenLayers.Style.SYMBOLIZER_PREFIXES[0];a=a.symbolizer[d]||a.symbolizer;if(this.defaultsPerSymbolizer===true){d=this.defaultStyle;OpenLayers.Util.applyDefaults(a,{pointRadius:d.pointRadius});if(a.stroke===true||a.graphic===true)OpenLayers.Util.applyDefaults(a,{strokeWidth:d.strokeWidth,strokeColor:d.strokeColor,strokeOpacity:d.strokeOpacity,strokeDashstyle:d.strokeDashstyle,strokeLinecap:d.strokeLinecap});if(a.fill===true||a.graphic===true)OpenLayers.Util.applyDefaults(a,{fillColor:d.fillColor,fillOpacity:d.fillOpacity});
a.graphic===true&&OpenLayers.Util.applyDefaults(a,{pointRadius:this.defaultStyle.pointRadius,externalGraphic:this.defaultStyle.externalGraphic,graphicName:this.defaultStyle.graphicName,graphicOpacity:this.defaultStyle.graphicOpacity,graphicWidth:this.defaultStyle.graphicWidth,graphicHeight:this.defaultStyle.graphicHeight,graphicXOffset:this.defaultStyle.graphicXOffset,graphicYOffset:this.defaultStyle.graphicYOffset})}return this.createLiterals(OpenLayers.Util.extend(b,a),c)},createLiterals:function(a,
b){var c=this.context||b.attributes||b.data;for(var d in this.propertyStyles)a[d]=OpenLayers.Style.createLiteral(a[d],c,b);return a},findPropertyStyles:function(){var a={};this.addPropertyStyles(a,this.defaultStyle);for(var b=this.rules,c,d,e=0,f=b.length;e<f;e++){c=b[e].symbolizer;for(var g in c){d=c[g];if(typeof d=="object")this.addPropertyStyles(a,d);else{this.addPropertyStyles(a,c);break}}}return a},addPropertyStyles:function(a,b){var c;for(var d in b){c=b[d];if(typeof c=="string"&&c.match(/\$\{\w+\}/))a[d]=
true}return a},addRules:function(a){this.rules=this.rules.concat(a);this.propertyStyles=this.findPropertyStyles()},setDefaultStyle:function(a){this.defaultStyle=a;this.propertyStyles=this.findPropertyStyles()},getSymbolizerPrefix:function(a){for(var b=OpenLayers.Style.SYMBOLIZER_PREFIXES,c=0,d=b.length;c<d;c++)if(a.CLASS_NAME.indexOf(b[c])!=-1)return b[c]},CLASS_NAME:"OpenLayers.Style"});
OpenLayers.Style.createLiteral=function(a,b,c){if(typeof a=="string"&&a.indexOf("${")!=-1){a=OpenLayers.String.format(a,b,[c]);a=isNaN(a)||!a?a:parseFloat(a)}return a};OpenLayers.Style.SYMBOLIZER_PREFIXES=["Point","Line","Polygon","Text"];
OpenLayers.StyleMap=OpenLayers.Class({styles:null,extendDefault:true,initialize:function(a,b){this.styles={"default":new OpenLayers.Style(OpenLayers.Feature.Vector.style["default"]),select:new OpenLayers.Style(OpenLayers.Feature.Vector.style.select),temporary:new OpenLayers.Style(OpenLayers.Feature.Vector.style.temporary),"delete":new OpenLayers.Style(OpenLayers.Feature.Vector.style["delete"])};if(a instanceof OpenLayers.Style){this.styles["default"]=a;this.styles.select=a;this.styles.temporary=a;
this.styles["delete"]=a}else if(typeof a=="object")for(var c in a)if(a[c]instanceof OpenLayers.Style)this.styles[c]=a[c];else if(typeof a[c]=="object")this.styles[c]=new OpenLayers.Style(a[c]);else{this.styles["default"]=new OpenLayers.Style(a);this.styles.select=new OpenLayers.Style(a);this.styles.temporary=new OpenLayers.Style(a);this.styles["delete"]=new OpenLayers.Style(a);break}OpenLayers.Util.extend(this,b)},destroy:function(){for(var a in this.styles)this.styles[a].destroy();this.styles=null},
createSymbolizer:function(a,b){a||(a=new OpenLayers.Feature.Vector);this.styles[b]||(b="default");a.renderIntent=b;var c={};if(this.extendDefault&&b!="default")c=this.styles["default"].createSymbolizer(a);return OpenLayers.Util.extend(c,this.styles[b].createSymbolizer(a))},addUniqueValueRules:function(a,b,c,d){var e=[];for(var f in c)e.push(new OpenLayers.Rule({symbolizer:c[f],context:d,filter:new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.EQUAL_TO,property:b,value:f})}));this.styles[a].addRules(e)},
CLASS_NAME:"OpenLayers.StyleMap"});
OpenLayers.Rule=OpenLayers.Class({id:null,name:"default",title:null,description:null,context:null,filter:null,elseFilter:false,symbolizer:null,minScaleDenominator:null,maxScaleDenominator:null,initialize:function(a){this.symbolizer={};OpenLayers.Util.extend(this,a);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){for(var a in this.symbolizer)this.symbolizer[a]=null;this.symbolizer=null},evaluate:function(a){var b=this.getContext(a),c=true;if(this.minScaleDenominator||
this.maxScaleDenominator)var d=a.layer.map.getScale();if(this.minScaleDenominator)c=d>=OpenLayers.Style.createLiteral(this.minScaleDenominator,b);if(c&&this.maxScaleDenominator)c=d<OpenLayers.Style.createLiteral(this.maxScaleDenominator,b);if(c&&this.filter)c=this.filter.CLASS_NAME=="OpenLayers.Filter.FeatureId"?this.filter.evaluate(a):this.filter.evaluate(b);return c},getContext:function(a){var b=this.context;b||(b=a.attributes||a.data);if(typeof this.context=="function")b=this.context(a);return b},
clone:function(){var a=OpenLayers.Util.extend({},this);a.symbolizer={};for(var b in this.symbolizer){value=this.symbolizer[b];type=typeof value;if(type==="object")a.symbolizer[b]=OpenLayers.Util.extend({},value);else if(type==="string")a.symbolizer[b]=value}a.filter=this.filter&&this.filter.clone();a.context=this.context&&OpenLayers.Util.extend({},this.context);return new OpenLayers.Rule(a)},CLASS_NAME:"OpenLayers.Rule"});
OpenLayers.Lang={code:null,defaultCode:"en",getCode:function(){OpenLayers.Lang.code||OpenLayers.Lang.setCode();return OpenLayers.Lang.code},setCode:function(a){var b;a||(a=OpenLayers.Util.getBrowserName()=="msie"?navigator.userLanguage:navigator.language);a=a.split("-");a[0]=a[0].toLowerCase();if(typeof OpenLayers.Lang[a[0]]=="object")b=a[0];if(a[1]){var c=a[0]+"-"+a[1].toUpperCase();if(typeof OpenLayers.Lang[c]=="object")b=c}if(!b){OpenLayers.Console.warn("Failed to find OpenLayers.Lang."+a.join("-")+
" dictionary, falling back to default language");b=OpenLayers.Lang.defaultCode}OpenLayers.Lang.code=b},translate:function(a,b){var c=OpenLayers.Lang[OpenLayers.Lang.getCode()][a];c||(c=a);if(b)c=OpenLayers.String.format(c,b);return c}};OpenLayers.i18n=OpenLayers.Lang.translate;
OpenLayers.Lang.en={unhandledRequest:"Unhandled request return ${statusText}",permalink:"Permalink",overlays:"Overlays",baseLayer:"Base Layer",sameProjection:"The overview map only works when it is in the same projection as the main map",readNotImplemented:"Read not implemented.",writeNotImplemented:"Write not implemented.",noFID:"Can't update a feature for which there is no FID.",errorLoadingGML:"Error in loading GML file ${url}",browserNotSupported:"Your browser does not support vector rendering. Currently supported renderers are:\n${renderers}",
componentShouldBe:"addFeatures : component should be an ${geomType}",getFeatureError:"getFeatureFromEvent called on layer with no renderer. This usually means you destroyed a layer, but not some handler which is associated with it.",minZoomLevelError:"The minZoomLevel property is only intended for use with the FixedZoomLevels-descendent layers. That this wfs layer checks for minZoomLevel is a relic of thepast. We cannot, however, remove it without possibly breaking OL based applications that may depend on it. Therefore we are deprecating it -- the minZoomLevel check below will be removed at 3.0. Please instead use min/max resolution setting as described here: http://trac.openlayers.org/wiki/SettingZoomLevels",
commitSuccess:"WFS Transaction: SUCCESS ${response}",commitFailed:"WFS Transaction: FAILED ${response}",googleWarning:"The Google Layer was unable to load correctly.<br><br>To get rid of this message, select a new BaseLayer in the layer switcher in the upper-right corner.<br><br>Most likely, this is because the Google Maps library script was either not included, or does not contain the correct API key for your site.<br><br>Developers: For help getting this working correctly, <a href='http://trac.openlayers.org/wiki/Google' target='_blank'>click here</a>",
getLayerWarning:"The ${layerType} Layer was unable to load correctly.<br><br>To get rid of this message, select a new BaseLayer in the layer switcher in the upper-right corner.<br><br>Most likely, this is because the ${layerLib} library script was not correctly included.<br><br>Developers: For help getting this working correctly, <a href='http://trac.openlayers.org/wiki/${layerLib}' target='_blank'>click here</a>",scale:"Scale = 1 : ${scaleDenom}",layerAlreadyAdded:"You tried to add the layer: ${layerName} to the map, but it has already been added",
reprojectDeprecated:"You are using the 'reproject' option on the ${layerName} layer. This option is deprecated: its use was designed to support displaying data over commercial basemaps, but that functionality should now be achieved by using Spherical Mercator support. More information is available from http://trac.openlayers.org/wiki/SphericalMercator.",methodDeprecated:"This method has been deprecated and will be removed in 3.0. Please use ${newMethod} instead.",boundsAddError:"You must pass both x and y values to the add function.",
lonlatAddError:"You must pass both lon and lat values to the add function.",pixelAddError:"You must pass both x and y values to the add function.",unsupportedGeometryType:"Unsupported geometry type: ${geomType}",pagePositionFailed:"OpenLayers.Util.pagePosition failed: element with id ${elemId} may be misplaced.",end:"",filterEvaluateNotImplemented:"evaluate is not implemented for this filter type."};
var _EMS_SFL_=true;EMS={};EMS.Control={};EMS.Handler={};EMS._scriptName=typeof _EMS_SFL_=="undefined"?"lib/EMS.js":"EMS.js";EMS._getScriptLocation=function(){var a=this._searchForEmsLibraryLocation(document.getElementsByTagName("head")[0].childNodes);if(a==null)a=this._searchForEmsLibraryLocation(document.getElementsByTagName("script"));return a==null?"":a};
EMS._searchForEmsLibraryLocation=function(a){for(var b=null,c=EMS._scriptName,d=0;d<a.length;d++)if(a[d].tagName=="SCRIPT"){var e=a[d].getAttribute("src");if(e!=null){if(e.indexOf("?")>-1)e=e.substring(0,e.indexOf("?"));if(e){var f=e.lastIndexOf(c);if(f>-1&&f+c.length==e.length){b=e.slice(0,-c.length);break}}}}return b};
typeof _EMS_SFL_=="undefined"&&function(){for(var a=new Array("ems/EMSUtils.js","ems/Ajax.js","ems/HoverIcon.js","ems/EMSServices.js","ems/EMSGeometry.js","ems/EMSZoomBar.js","ems/EMSPopup.js","ems/EMSPanButton.js","ems/HighlightFeature.js","ems/MouseDefaults.js","ems/OverviewMap.js","ems/NorthArrow.js","ems/Copyright.js","ems/Button.js","ems/Scale.js","ems/MultiPopup.js","ems/MarkerProximityCombiner.js","ems/MarkerGroup.js","ems/CombinerCalculator.js","ems/MagicMarker.js","ems/PixelBounds.js","ems/MagicMarkerSorter.js",
"ems/IndexedLayer.js","ems/ContextMenu.js","ems/RightClick.js","ems/ContextPopup.js","ems/TabbedPopup.js","ems/RoutePopup.js","ems/DraggingControl.js","ems/DragMarkerHandler.js"),b="",c=EMS._getScriptLocation()+"lib/",d=0;d<a.length;d++)if(/MSIE/.test(navigator.userAgent)||/Safari/.test(navigator.userAgent))b+="<script src='"+c+a[d]+"'><\/script>";else{var e=document.createElement("script");e.src=c+a[d];(document.getElementsByTagName("head").length?document.getElementsByTagName("head")[0]:document.body).appendChild(e)}b&&
document.write(b)}();EMS.Util={};EMS.Util.latToSGP4=function(a){return EMS.mapProjection.projectLatitude(a)};EMS.Util.sgp4ToLat=function(a){return EMS.mapProjection.unprojectLatitude(a)};EMS.Util.isIE8=function(){if(OpenLayers.Util.getBrowserName()=="msie")if(typeof XDomainRequest!="undefined")return true;return false};EMS.Util.isIE6=function(){if(window.ActiveXObject)if(!window.XMLHttpRequest)return true;return false};
EMS.Util.isGecko=function(){return document.getBoxObjectFor!=null||window.mozInnerScreenX!=null};EMS.Util.$type=function(a){if(a===null||a===undefined)return false;var b=typeof a;if(b=="object"){if(a.htmlElement)return"element";if(a.push)return"array";if(a.nodeName)switch(a.nodeType){case 1:return"element";case 3:return a.nodeValue.test(/\S/)?"textnode":"whitespace"}}return b};
EMS.Util.Json={toString:function(a){switch(EMS.Util.$type(a)){case "string":return'"'+a.replace(new RegExp('(["\\\\])',"g"),"\\$1")+'"';case "array":return"["+this._map(a,function(d){return EMS.Util.Json.toString(d)}).join(",")+"]";case "object":var b=[];for(var c in a)EMS.Util.$type(a[c])!="function"&&b.push('"'+c+'":'+EMS.Util.Json.toString(a[c]));return"{"+b.join(",")+"}";case "function":return null}return String(a)},evaluate:function(a){return eval("("+a+")")},_map:function(a,b){for(var c=[],
d=0;d<a.length;d++)c.push(b(a[d]));return c}};EMS.Util.getParameterString=function(a){var b=[];for(var c in a){var d=a[c];if(d!=null&&typeof d!="function"){d=typeof d=="object"?encodeURIComponent(EMS.Util.Json.toString(d)):encodeURIComponent(d);b.push(encodeURIComponent(c)+"="+d)}}return b.join("&")};
EMS.Event={pointerX:function(a){return a.pageX||a.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)},pointerY:function(a){return a.pageY||a.clientY+(document.documentElement.scrollTop||document.body.scrollTop)}};
OpenLayers.Util.onImageLoadError=function(){this._attempts=this._attempts?this._attempts+1:1;if(this._attempts<=OpenLayers.IMAGE_RELOAD_ATTEMPTS)this.src=this.src;else{var a="";if(OpenLayers.Map.TILE_WIDTH==200)a="_200x200";this.src=this.src.indexOf("LAYERS=street")>=0?EMS.Util.getImagesLocation()+"no_data_map"+a+".png":EMS.Util.getImagesLocation()+"no_data"+a+".png"}this.style.display=""};EMS.ImgPath="";EMS.Util.getImagesLocation=function(){return EMS.ImgPath||EMS._getScriptLocation()+"img/"};
EMS.Util.getDomain=function(){return/https?.\/\/([^:\/]*)[:\/]/.exec(window.location.href)[1]};EMS.Util.toAbsoluteUrl=function(a){return a.startsWith("/")?window.location.href.match(/http:\/\/.*?\//)[0]+a.substring(1):(a.indexOf("http://")>=0?"":window.location.href.match(/.*\//)[0])+a};
EMS.Util.dump=function(a,b){var c="";b||(b=0);for(var d="",e=0;e<b+1;e++)d+="    ";if(typeof a=="object")for(var f in a){e=a[f];if(typeof e=="object"){c+=d+"'"+f+"' ...\n";c+=dump(e,b+1)}else c+=d+"'"+f+"' => \""+e+'"\n'}else c="===>"+a+"<===("+typeof a+")";return c};EMS.Util.defaultResolutions=[0.1,0.05,0.025,0.0125,0.00625,0.003125,0.0015625,7.8125E-4,3.90625E-4,1.953125E-4,9.765625E-5,4.8828125E-5,2.44140625E-5,1.220703125E-5,6.103515625E-6,3.0517578125E-6,1.52587890625E-6];
EMS.Util.ZoomCalculator=OpenLayers.Class({initialize:function(a,b){this.resolutions=a;a=OpenLayers.Element.getDimensions(b);if(a.width==undefined||a.height==undefined||a.width==0||a.height==0){this.width=parseInt($(b).style.width);this.height=parseInt($(b).style.height)}else{this.width=a.width;this.height=a.height}},getZoomForExtent:function(a){var b=new OpenLayers.Size(this.width,this.height);return this.getZoomForResolution(Math.max(a.getWidth()/b.w,a.getHeight()/b.h))},getZoomForResolution:function(a){for(var b=
1;b<this.resolutions.length;b++)if(this.resolutions[b]<a)break;return b-1}});OpenLayers.Event.isLeftClick=function(a){return a.which&&a.which==1||typeof a.button!="undefined"&&a.button<2};OpenLayers.Util.alphaHack=function(){if(navigator.appVersion.indexOf("MSIE")!=-1){var a=navigator.appVersion.split("MSIE");a=parseFloat(a[1]);var b=false;try{b=document.body.filters}catch(c){}return b&&a>=5.5&&a<7&&!window.XMLHttpRequest}return false};
OpenLayers.LonLat.prototype.asWGS84=function(){return{lon:this.lon,lat:EMS.Util.sgp4ToLat(this.lat)}};EMS.LonLat=OpenLayers.Class(OpenLayers.LonLat,{initialize:function(a,b){OpenLayers.LonLat.prototype.initialize.apply(this,[a,EMS.Util.latToSGP4(b)])}});OpenLayers.Bounds.prototype.asWGS84=function(){return new OpenLayers.Bounds(this.left,EMS.Util.sgp4ToLat(this.bottom),this.right,EMS.Util.sgp4ToLat(this.top))};
EMS.Bounds=OpenLayers.Class(OpenLayers.Bounds,{initialize:function(a,b,c,d){OpenLayers.Bounds.prototype.initialize.apply(this,[a,EMS.Util.latToSGP4(b),c,EMS.Util.latToSGP4(d)])}});EMS.Util.supportsSmoothZoom=function(){return navigator.userAgent.indexOf("AppleWebKit/")>-1};
EMS.Util.smoothZoom=function(a,b,c,d){var e=a.baseLayer.div.parentNode,f=a.getResolution()/a.baseLayer.resolutions[d];b=Math.round(a.getPixelFromLonLat(b).x-e.style.pixelLeft)+"px "+Math.round(a.getPixelFromLonLat(b).y-e.style.pixelTop)+"px";if(EMS.Util.supportsSmoothZoom()){e.style.webkitTransform="scale("+f+")";e.style.webkitTransformOrigin=b;e.style.webkitTransition="0.5s";f=OpenLayers.Function.bind(function(){e.style.webkitTransformOrigin="";e.style.webkitTransform="";e.style.webkitTransition=
"";a.setCenter(c,d)},this);setTimeout(f,500)}else a.setCenter(c,d)};OpenLayers.Events.prototype.includeXY=true;
EMS.EllipsoidalMercatorProjection=OpenLayers.Class({initialize:function(){},E:0.0818191908426216,projectLatitude:function(a){a=this.toRadians(a);a=Math.pow(this.eDiff(this.E,a),this.E)/this.eDiff(1,a);a=Math.log(a)/2;return this.toDegrees(a)},unprojectLatitude:function(a){a=this.toRadians(a);var b=1,c=0,d;for(i=0;i<12;i++){d=c;c=Math.PI/2-2*Math.atan(Math.exp(-a)*b);if(Math.abs(c-d)<1.0E-7)break;b=Math.pow(this.eDiff(this.E,c),this.E/2)}return this.toDegrees(c)},toRadians:function(a){return a/180*
Math.PI},toDegrees:function(a){return a*180/Math.PI},eDiff:function(a,b){return(1-a*Math.sin(b))/(1+a*Math.sin(b))}});
EMS.SGP4Projection=OpenLayers.Class({convertY:[0,10,20.154266,30.796044,42.343049,55.397122,70.95436,90.95436,120.192404,177.780109],initialize:function(){},projectLatitude:function(a){var b=Math.ceil(a/10);if(b>=9)b=8;if(a>=0)return convertY[b]+(a-10*b)/10*(convertY[b+1]-convertY[b]);else{a=-a;b=-b;return-(convertY[b]+(a-10*b)/10*(convertY[b+1]-convertY[b]))}},unprojectLatitude:function(a){var b;if(a>=0){for(b=0;b<10;b++)if(a<convertY[b])return(b-1)*10+10*(a-convertY[b-1])/(convertY[b]-convertY[b-
1]);b=9;return(b-1)*10+10*(a-convertY[b-1])/(convertY[b]-convertY[b-1])}else{a=-a;for(b=0;b<10;b++)if(a<convertY[b])return-((b-1)*10+10*(a-convertY[b-1])/(convertY[b]-convertY[b-1]));b=9;return-((b-1)*10+10*(a-convertY[b-1])/(convertY[b]-convertY[b-1]))}}});EMS.mapProjection=new EMS.EllipsoidalMercatorProjection;EMS.Ajax={};EMS.Ajax.cancelableRequests=[];EMS.Ajax.groupedRequests={};EMS.Ajax.maxCrossDomainURLLength=1800;EMS.Ajax.crossDomainTimeout=1E4;EMS.Ajax.jsessionId=null;
if(typeof EMS.Services=="undefined")EMS.Services={};EMS.Services._jsonBaseUrl=EMS._getScriptLocation()+"../..";
EMS.Ajax.json=function(a,b,c){a=EMS.Services._jsonBaseUrl+a;c=c?c:{};c.parameters=c.parameters?c.parameters:{};c.parameters.domain=EMS.Util.getDomain();if(!c.parameters.token)c.parameters.token=EMS.token;if(c.parameters&&typeof c.parameters!="string")c.parameters=EMS.Util.getParameterString(c.parameters);var d=c.onException?c.onException:EMS.Services._onException,e=c.communicationMode||EMS.Services.communicationMode,f=function(){};isJsonResponseOK=function(l){if(l.stat&&l.stat=="fail"){var n="["+
l.code+"] "+l.error;if(l.stackTrace)n+="\n\n"+l.stackTrace;d(f,n);return false}return true};try{var g=EMS.Ajax.jsessionId!=null?EMS.Ajax.jsessionId:window.opener!=null&&window.opener.EMS!=null&&window.opener.EMS.Ajax.jsessionId!=null?window.opener.EMS.Ajax.jsessionId:null}catch(j){}if(g!=null){var h="jsessionid";if(e=="XMLHttpRequest")h="ems.jsessionid";a+=";"+h+"="+g}if(e=="XMLHttpRequest"){var k;e=OpenLayers.Function.bind(function(l,n,o){n=eval("("+l.responseText+")");EMS.Ajax.Responders.dispatch("onComplete",
k,l,n);o&&o.options&&o.options.group&&o.options.requestTime<EMS.Ajax.groupedRequests[o.options.group]||isJsonResponseOK(n)&&b(n.message)},this);c=OpenLayers.Util.extend(c,{onComplete:e,onException:d});k=new OpenLayers.Ajax.Request(a,c);EMS.Ajax.Responders.dispatch("onCreate",k,k.transport,null)}else if(e=="CrossDomain"){f=function(){};e=[];if(c.parameters.length>EMS.Ajax.maxCrossDomainURLLength){e=[];g=0;h=true;for(var m=0;h;){var p=c.parameters.lastIndexOf("%22",m+EMS.Ajax.maxCrossDomainURLLength);
if(p==m){e[g]=c.parameters.substring(m);g++;h=false}else e[g]=c.parameters.substring(m,p);m=p;g++}}else e[0]=c.parameters;var q={transport:f,options:c};if(typeof handlerFunctions=="undefined")handlerFunctions={};if(typeof handler=="undefined")handler=0;else handler++;handlerFunctions["ajaxHandler"+handler]=OpenLayers.Function.bind(function(l,n,o){if(!(l&&n<EMS.Ajax.groupedRequests[l]))if(isJsonResponseOK(o))if(!o.chunked)try{EMS.Ajax.Responders.dispatch("onComplete",q,f,o);b(o.message)}catch(r){alert("exception "+
r)}},this,c.group,(new Date).getTime());EMS.Ajax.Responders.dispatch("onCreate",q,f,null);for(c=0;c<e.length;c++){g=new Date;oScript=document.createElement("script");h=e[c].replace(/=/g,"%3D%3D").replace(/&/g,"%26%26");g=a+"?cb=ajaxHandler"+handler+"&rf="+g.getTime()+"&nop="+e.length+"&pn="+(c+1)+"&part="+h;oScript.setAttribute("src",g);oScript.setAttribute("id","emsajaxscript"+handler);document.getElementsByTagName("head").item(0).appendChild(oScript)}setTimeout(OpenLayers.Function.bind(function(l){window["ajaxHandler"+
l]=null;l=document.getElementById("emsajaxscript"+l);var n=document.getElementsByTagName("head").item(0);l&&n.removeChild(l)},this),EMS.Ajax.crossDomainTimeout)}else alert("Invalid communication mode. Expected XMLHttpRequest or CrossDomain")};EMS.Services._json=EMS.Ajax.json;EMS.Ajax.callInProgress=function(a){switch(a.readyState){case 1:case 2:case 3:return true;default:return false}};
EMS.Ajax.cancelAll=function(){for(var a=0;a<EMS.Ajax.cancelableRequests.length;a++)if(EMS.Ajax.callInProgress(EMS.Ajax.cancelableRequests[a].transport)){EMS.Ajax.cancelableRequests[a].options.onException=function(){};EMS.Ajax.cancelableRequests[a].transport.abort()}EMS.Ajax.cancelableRequests=[]};EMS.Ajax.requestCreate=function(a){a.options.requestTime=(new Date).getTime();a.options.uninterruptable||EMS.Ajax.cancelableRequests.push(a)};
EMS.Ajax.requestComplete=function(a){var b=-1,c=false;for(b=0;b<EMS.Ajax.cancelableRequests.length;b++)if(EMS.Ajax.cancelableRequests[b].options.requestTime==a.options.requestTime){c=true;break}c&&EMS.Ajax.cancelableRequests.splice(b,1);if(a.options.group)if(EMS.Ajax.groupedRequests[a.options.group])if(a.options.requestTime<EMS.Ajax.groupedRequests[a.options.group])a.options.staleRequest=true;else EMS.Ajax.groupedRequests[a.options.group]=a.options.requestTime;else EMS.Ajax.groupedRequests[a.options.group]=
a.options.requestTime};EMS.Ajax.Responders={responders:[],register:function(a){for(var b=0;b<this.responders.length;b++)if(a==this.responders[b])return;this.responders.push(a)},dispatch:function(a,b,c,d){for(var e=0;e<this.responders.length;e++){var f=this.responders[e];if(f[a]&&typeof f[a]=="function")try{f[a].apply(f,[b,c,d])}catch(g){}}}};EMS.Ajax.Responders.register({onCreate:EMS.Ajax.requestCreate,onComplete:EMS.Ajax.requestComplete});
EMS.Ajax.requestCompleteExtractJsessionId=function(a,b,c){if(c.jsessionid)EMS.Ajax.jsessionId=c.jsessionid};EMS.Ajax.Responders.register({onComplete:EMS.Ajax.requestCompleteExtractJsessionId});
EMS.Control.PanButton=OpenLayers.Class(OpenLayers.Control,{id:null,type:null,map:null,element:null,offset:0,smallPanButton:false,initialize:function(a,b,c){OpenLayers.Control.prototype.initialize.apply(this,[c]);this.type=a;if(!b)if(this.smallPanButton)if(a=="n")b=new EMS.HoverIcon(EMS.Util.getImagesLocation()+"pan_north_sml.png",new OpenLayers.Size(20,16));else if(a=="s")b=new EMS.HoverIcon(EMS.Util.getImagesLocation()+"pan_south_sml.png",new OpenLayers.Size(20,16));else if(a=="e")b=new EMS.HoverIcon(EMS.Util.getImagesLocation()+
"pan_east_sml.png",new OpenLayers.Size(16,20));else{if(a=="w")b=new EMS.HoverIcon(EMS.Util.getImagesLocation()+"pan_west_sml.png",new OpenLayers.Size(16,20))}else if(a=="n")b=new EMS.HoverIcon(EMS.Util.getImagesLocation()+"pan_north.png",new OpenLayers.Size(25,20));else if(a=="s")b=new EMS.HoverIcon(EMS.Util.getImagesLocation()+"pan_south.png",new OpenLayers.Size(25,20));else if(a=="e")b=new EMS.HoverIcon(EMS.Util.getImagesLocation()+"pan_east.png",new OpenLayers.Size(20,25));else if(a=="w")b=new EMS.HoverIcon(EMS.Util.getImagesLocation()+
"pan_west.png",new OpenLayers.Size(20,25));this.icon=b;this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");this.displayClass=this.CLASS_NAME.replace("EMS.","ems").replace(".","")+"-"+a},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments);var b=OpenLayers.Function.bind(this.updateSize),c=a.updateSize;a.onMapResize=function(){c();b()};navigator.appName.contains("Microsoft")?a.events.register("resize",this,this.updateSize):OpenLayers.Event.observe(window,"resize",this.updateSizeCallback=
this.updateSize.bindAsEventListener(this))},updateSize:function(){var a=this.icon.size.w,b=this.icon.size.h,c;if(this.type=="n")c=new OpenLayers.Pixel(this.map.getSize().w/2-a/2,0+this.offset);else if(this.type=="s")c=new OpenLayers.Pixel(this.map.getSize().w/2-a/2,this.map.getSize().h-(b+this.offset));else if(this.type=="e")c=new OpenLayers.Pixel(this.map.getSize().w-(a+this.offset),this.map.getSize().h/2-b/2);else if(this.type=="w")c=new OpenLayers.Pixel(0+this.offset,this.map.getSize().h/2-b/2);
OpenLayers.Util.modifyDOMElement(this.div,null,c)},destroy:function(){OpenLayers.Event.stopObservingElement(this.div)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.div.style.overflow="hidden";this.div.style.height=this.icon.size.h+"px";var a=this.icon.size.w,b=this.icon.size.h,c;if(this.type=="n")c=new OpenLayers.Pixel(this.map.getSize().w/2-a/2,0+this.offset);else if(this.type=="s")c=new OpenLayers.Pixel(this.map.getSize().w/2-a/2,this.map.getSize().h-(b+this.offset));
else if(this.type=="e")c=new OpenLayers.Pixel(this.map.getSize().w-(a+this.offset),this.map.getSize().h/2-b/2);else if(this.type=="w")c=new OpenLayers.Pixel(0+this.offset,this.map.getSize().h/2-b/2);this.icon.draw();this.icon.display(true);OpenLayers.Event.observe(this.div,"click",this.pan.bindAsEventListener(this));OpenLayers.Event.observe(this.div,"mousedown",this._eatThisEvent);OpenLayers.Event.observe(this.div,"mouseup",this._eatThisEvent);OpenLayers.Event.observe(this.div,"dblclick",this._eatThisEvent);
this.div.appendChild(this.icon.imageDiv);OpenLayers.Util.modifyDOMElement(this.div,null,c);OpenLayers.Util.modifyDOMElement(this.icon.imageDiv,null,null,null,"static");return this.div},pan:function(a){var b=this.map.getCenter().clone();if(this.type=="n")b.lat+=this.map.getExtent().getHeight()/2;else if(this.type=="s")b.lat-=this.map.getExtent().getHeight()/2;else if(this.type=="w")b.lon-=this.map.getExtent().getWidth()/2;else if(this.type=="e")b.lon+=this.map.getExtent().getWidth()/2;this.map.setCenter(b);
OpenLayers.Event.stop(a);return false},_eatThisEvent:function(a){OpenLayers.Event.stop(a);return false},CLASS_NAME:"EMS.Control.PanButton"});
EMS.Button=OpenLayers.Class(OpenLayers.Control,{EVENT_TYPES:["click"],events:null,isDown:false,initialize:function(a,b,c,d,e){OpenLayers.Control.prototype.initialize.apply(this,[e]);this.upIcon=a;this.downIcon=b;this.hoverIcon=c;this.isDown=d;this.events=new OpenLayers.Events(this,this.div,this.EVENT_TYPES,false)},destroy:function(){OpenLayers.Event.stopObservingElement(this.imageDiv)},redraw:function(){if(this.div!=null)this.div.innerHTML="";this.draw()},draw:function(a){OpenLayers.Control.prototype.draw.apply(this,
arguments);this.imageDiv=OpenLayers.Util.createDiv(null,a,this.size(),this.url(),"absolute");this.imageDiv.className=this.displayClass;this.div.appendChild(this.imageDiv);this.contentDiv=OpenLayers.Util.createDiv(null,null,this.size(),null,"absolute");this.contentDiv.className="contentDiv";this.imageDiv.appendChild(this.contentDiv);if(!this.isDown){OpenLayers.Event.observe(this.imageDiv,"mouseover",this.mouseOver.bindAsEventListener(this));OpenLayers.Event.observe(this.imageDiv,"mouseout",this.mouseOut.bindAsEventListener(this))}OpenLayers.Event.observe(this.imageDiv,
"mouseDown",function(){});OpenLayers.Event.observe(this.imageDiv,"click",this.click.bindAsEventListener(this))},size:function(){return this.isDown?this.downIcon.size:this.upIcon.size},url:function(){return this.isDown?this.downIcon.url:this.upIcon.url},mouseOver:function(){this.imageDiv.style.backgroundImage='url("'+this.hoverIcon.url+'")'},mouseOut:function(){this.imageDiv.style.backgroundImage='url("'+this.upIcon.url+'")'},click:function(a){this.events.triggerEvent("click",a);OpenLayers.Event.stop(a)},
CLASS_NAME:"EMS.Control.Button"});
EMS.Popup=OpenLayers.Class({EVENT_TYPES:["shown","hidden"],events:null,id:"",lonlat:null,div:null,size:null,contentHTML:"",backgroundColor:"",opacity:1,border:"",contentDiv:null,groupDiv:null,padding:5,calloutSize:new OpenLayers.Size(14,22),map:null,initialize:function(a,b,c,d,e,f){if(a==null)a=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");this.id=a;this.lonlat=b;this.size=c!=null?c:new OpenLayers.Size(OpenLayers.Popup.WIDTH,OpenLayers.Popup.HEIGHT);if(d!=null)this.contentHTML=d;this.anchor=
e;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,"visible");this.div.className="emsPopup";this.div.style.backgroundColor="transparent";this.calloutDiv=OpenLayers.Util.createAlphaImageDiv(this.div.getAttribute("id")+"-callout",null,this.calloutSize,null,"absolute",null,null,1);this.calloutDiv.style.backgroundColor="transparent";this.div.appendChild(this.calloutDiv);
this.groupDiv=OpenLayers.Util.createDiv(null,null,null,null,"absolute",null,"hidden");this.groupDiv.className="emsPopupGroup";this.shadow1Div=OpenLayers.Util.createDiv(null,null,null,null,"absolute",null,"hidden",0.15);this.shadow1Div.style.marginLeft="4px";this.shadow1Div.style.marginTop="4px";this.shadow1Div.style.backgroundColor="black";this.shadow2Div=OpenLayers.Util.createDiv(null,null,null,null,"absolute",null,"hidden",0.15);this.shadow2Div.style.marginTop="8px";this.shadow2Div.style.marginLeft=
"8px";this.shadow2Div.style.backgroundColor="black";a=this.div.id+"_contentDiv";this.contentDiv=OpenLayers.Util.createDiv(a,null,this.size.clone(),null,"relative",null,"hidden");this.contentDiv.className="emsPopupContent";this.groupDiv.appendChild(this.contentDiv);this.div.appendChild(this.shadow1Div);this.div.appendChild(this.shadow2Div);this.div.appendChild(this.groupDiv);if(f){a=new OpenLayers.Size(12,12);b=EMS.Util.getImagesLocation()+"close_off.gif";a=OpenLayers.Util.createAlphaImageDiv(this.id+
"_close",null,a,b);a.style.right=this.padding+"px";a.style.top=this.padding+"px";this.groupDiv.appendChild(a);OpenLayers.Event.observe(a,"click",function(g){this.hide();OpenLayers.Event.stop(g)}.bindAsEventListener(this))}this.registerEvents()},destroy:function(){if(this.map!=null){this.map.removePopup(this);this.map=null}this.events.destroy();this.div=this.events=null},draw:function(a){if(a==null)if(this.lonlat!=null&&this.map!=null)a=this.map.getLayerPxFromLonLat(this.lonlat);this.setSize();this.setBackgroundColor();
this.setOpacity();this.setBorder();this.setContentHTML();this.moveTo(a);return this.div},updatePosition:function(){this.lonlat&&this.map&&this.moveTo(this.map.getLayerPxFromLonLat(this.lonlat))},moveTo:function(a){if(a!=null&&this.div!=null){var b=this.direction(a),c=a,d=this.anchor==undefined?0:this.anchor.size.h,e=this.anchor==undefined?0:this.anchor.size.w;if(this.anchor!=undefined){if(this.anchor.offset!=undefined&&d/2==this.anchor.offset.y/-1)d=0;a=a.add(b*e/2,-d/2)}if(b==-1){a=a.add(-this.size.w,
0);a=a.add(b*this.calloutSize.w,0)}a=a.add(0,-this.size.h/2);if(this.map.getExtent().containsLonLat(this.map.getLonLatFromLayerPx(c)))if(this.map.getViewPortPxFromLayerPx(a).y<0)a=a.add(0,-this.map.getViewPortPxFromLayerPx(a).y);else if(this.map.getViewPortPxFromLayerPx(a).y+this.size.h>this.map.getSize().h)a=a.add(0,-(this.map.getViewPortPxFromLayerPx(a).y+this.size.h-this.map.getSize().h));this.shadow1Div.style.marginTop="4px";this.shadow2Div.style.marginTop="8px";if(b>0){this.shadow1Div.style.marginLeft=
this.calloutSize.w+4+"px";this.shadow2Div.style.marginLeft=this.calloutSize.w+8+"px";this.groupDiv.style.marginLeft=this.calloutSize.w+"px";this.groupDiv.style.marginRight="0px";this.shadow1Div.style.marginRight="0px";this.shadow2Div.style.marginRight="0px"}else{this.shadow1Div.style.marginLeft="0px";this.shadow2Div.style.marginLeft="0px";this.groupDiv.style.marginLeft="0px";this.shadow1Div.style.marginLeft="4px";this.shadow2Div.style.marginLeft="8px";this.groupDiv.style.marginRight=this.calloutSize.w+
"px"}if(b>0){this.calloutDiv.style.left="2px";this.calloutDiv.style.right=""}else{this.calloutDiv.style.right="2px";this.calloutDiv.style.left=""}this.calloutDiv.style.top=c.y-a.y-this.calloutSize.h/2-d/2+"px";this.calloutDiv.style.zIndex=this.div.style.zIndex+1;b>0?OpenLayers.Util.modifyAlphaImageDiv(this.calloutDiv,null,null,null,EMS.Util.getImagesLocation()+"calloutleft.png"):OpenLayers.Util.modifyAlphaImageDiv(this.calloutDiv,null,null,null,EMS.Util.getImagesLocation()+"calloutright.png");this.div.style.left=
a.x+"px";this.div.style.top=a.y+"px"}},direction:function(a){a=this.map.getLonLatFromLayerPx(a);return this.map.getExtent().determineQuadrant(a).charAt(1)=="l"?1:-1},visible:function(){return OpenLayers.Element.visible(this.div)},toggle:function(){OpenLayers.Element.toggle(this.div);this.visible()?this.events.triggerEvent("shown"):this.events.triggerEvent("hidden")},show:function(){OpenLayers.Element.show(this.div);this.events.triggerEvent("shown")},hide:function(){OpenLayers.Element.hide(this.div);
this.events.triggerEvent("hidden")},setSize:function(a){if(a!=undefined)this.size=a;if(this.div!=null){this.div.style.width=this.size.w+this.calloutSize.w+"px";this.div.style.height=this.size.h+"px"}a=this.size.w-4;var b=this.size.h-4;if(this.groupDiv!=null){this.groupDiv.style.width=a+"px";this.groupDiv.style.height=b+"px"}if(this.shadow1Div!=null&&this.shadow2Div!=null){this.shadow1Div.style.width=a+4+"px";this.shadow1Div.style.height=b+4+"px";this.shadow2Div.style.width=a+4+"px";this.shadow2Div.style.height=
b+4+"px"}if(this.contentDiv!=null){this.contentDiv.style.width=a+"px";this.contentDiv.style.height=b+"px"}},setBackgroundColor:function(a){if(a!=undefined)this.backgroundColor=a;if(this.div!=null)this.groupDiv.style.backgroundColor=this.backgroundColor},setOpacity:function(a){if(a!=undefined)this.opacity=a;if(this.div!=null)if(this.opacity==1){this.div.style.opacity=null;this.div.style.filter=null}else{this.div.style.opacity=this.opacity;this.div.style.filter="alpha(opacity="+this.opacity*100+")"}},
setBorder:function(a){if(a!=undefined)this.border=a;if(this.div!=null)this.div.style.border=this.border},setContentHTML:function(a){if(a!=null)this.contentHTML=a;if(this.contentDiv!=null)this.contentDiv.innerHTML=this.contentHTML},registerEvents:function(){this.events=new OpenLayers.Events(this,this.div,this.EVENT_TYPES,true);this.events.register("mousedown",this,this.onmousedown);this.events.register("mousemove",this,this.onmousemove);this.events.register("mouseup",this,this.onmouseup);this.events.register("click",
this,this.onclick);this.events.register("mouseout",this,this.onmouseout);this.events.register("dblclick",this,this.ondblclick)},onmousedown:function(a){this.mousedown=true;OpenLayers.Event.stop(a,true)},onmousemove:function(a){this.mousedown&&OpenLayers.Event.stop(a,true)},onmouseup:function(a){if(this.mousedown){this.mousedown=false;OpenLayers.Event.stop(a,true)}},onclick:function(a){OpenLayers.Event.stop(a,true)},onmouseout:function(){this.mousedown=false},ondblclick:function(a){OpenLayers.Event.stop(a,
true)},CLASS_NAME:"EMS.Popup"});
EMS.Control.ZoomBar=OpenLayers.Class(OpenLayers.Control.PanZoom,{buttons:null,showHybridInPhotoView:true,sliderSize:new OpenLayers.Size(40,161),handleSize:new OpenLayers.Size(23,18),fullZoomBar:true,showMapPhotoButtons:true,initialize:function(a,b,c,d,e){OpenLayers.Control.PanZoom.prototype.initialize.apply(this,[]);this.streetLayer=a;this.photoLayer=b;this.hybridLayer=c;if(d!=undefined)this.fullZoomBar=d;if(e!=undefined)this.showMapPhotoButtons=e;this.position=new OpenLayers.Pixel(EMS.Control.ZoomBar.X,EMS.Control.ZoomBar.Y)},
destroy:function(){OpenLayers.Event.stopObservingElement(this.markersDiv);if(this.fullZoomBar){this.scale.events.destroy();for(var a=0;a<this.markers.length;a++){this.markers[a].events.destroy();OpenLayers.Event.stopObservingElement(this.markers[a].image);OpenLayers.Util.removeNode(this.div)}}OpenLayers.Event.stopObservingElement(this.zoominButton);OpenLayers.Event.stopObservingElement(this.zoomoutButton);this.fullZoomBar&&this.map.events.unregister("mousemove",this,this._showHideMarkers);this.map=
null},setMap:function(){OpenLayers.Control.PanZoom.prototype.setMap.apply(this,arguments);this.map.events.register("changebaselayer",this,this.redraw)},redraw:function(){if(this.div!=null)this.div.innerHTML="";this.draw()},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);zoomPx=this.position.clone();layerPx=this.position.clone();this.buttons=[];if(this.showMapPhotoButtons){this.layersDiv=OpenLayers.Util.createDiv(this.div.id+"_LayersButtons",layerPx,new OpenLayers.Size(75,22),
null,"absolute");this.layersDiv.className="LayersButtons";this.streetButton=this._addStreetButton(layerPx);this.photoButton=this._addPhotoButton(layerPx.add(38,0));this.layersDiv.style.left="27px";this.layersDiv.style.top="2px";if(this.photoButton.isDown)var a="button_bg_lrg.png",b=209;else{a="button_bg_sml.png";b=108}this.layerBackground=OpenLayers.Util.createAlphaImageDiv(null,this.position.clone(),new OpenLayers.Size(b,25),EMS.Util.getImagesLocation()+a);this.div.appendChild(this.layerBackground);
this.div.appendChild(this.layersDiv)}this.northArrow=OpenLayers.Util.createAlphaImageDiv(null,this.position.clone().add(7,2),new OpenLayers.Size(13,20),EMS.Util.getImagesLocation()+"north_arrow.png");this.northArrow.style.position="absolute";this.northArrow.firstChild.alt="Magnetic North";this.div.appendChild(this.northArrow);zoomPx=this.showMapPhotoButtons?zoomPx.add(29,34):zoomPx.add(8,30);this.zoomoutButton=this._addButton("zoomout","sdr-zoomout.png",zoomPx,new OpenLayers.Size(21,26));zoomPx=zoomPx.add(0,
26);if(this.fullZoomBar){this._addScale(this.div.id+"EMSZoomBar_Scale","sdr-scale.png",zoomPx,new OpenLayers.Size(21,169));this.scale.className="EMSZoombarScale";this.markersDiv=OpenLayers.Util.createDiv(this.div.id+"_Markers",zoomPx.add(16,0),new OpenLayers.Size(0,169),null,"absolute");this.markersDiv.className="EMSZoombarMarkers";this.map.events.register("mousemove",this,this._showHideMarkers);this.div.appendChild(this.markersDiv);this.markers=[];this._addMarker("country-marker","country-marker.png",
new OpenLayers.Pixel(0,1),new OpenLayers.Size(46,15));this._addMarker("state-marker","state-marker.png",new OpenLayers.Pixel(0,30),new OpenLayers.Size(46,15));this._addMarker("suburb-marker","suburb-marker.png",new OpenLayers.Pixel(0,97),new OpenLayers.Size(46,15));this._addMarker("street-marker","street-marker.png",new OpenLayers.Pixel(0,125),new OpenLayers.Size(46,15));this._addZoomBar(zoomPx.add(0,6));zoomPx=zoomPx.add(0,169);this.moveZoomBar()}this.zoominButton=this._addButton("zoomin","sdr-zoomin.png",
zoomPx,new OpenLayers.Size(21,26));return this.div},_showHideMarkers:function(a){var b=OpenLayers.Util.docPosition(this.map.div),c=EMS.Event.pointerX(a);a=EMS.Event.pointerY(a);c-=b[0];a-=b[1];if(this.markersVisible)c>28&&c<90&&a>34&&a<256||this.slider.childNodes[0].style.marginTop!="-18px"&&this.hideMarkers();else c>28&&c<53&&a>34&&a<256&&this.showMarkers()},ignoreEvent:function(a){OpenLayers.Event.stop(a)},_addScale:function(a,b,c,d){b=EMS.Util.getImagesLocation()+b;this.scale=OpenLayers.Util.createAlphaImageDiv(a,
c,d,b,"absolute",null,null);this.scale.events=new OpenLayers.Events(this,this.scale,null,true);this.scale.events.register("mousedown",this,this.divClick);this.scale.events.register("mousemove",this,this.passEventToSlider);this.scale.events.register("mouseup",this,this.passEventToSlider);this.scale.events.register("dblclick",this,this.doubleClick);this.scale.events.register("click",this,this.doubleClick);this.div.appendChild(this.scale);return this.scale},_addMarker:function(a,b,c,d){b=EMS.Util.getImagesLocation()+
b;b=OpenLayers.Util.createAlphaImageDiv(a+"-image",null,new OpenLayers.Size(d.w,d.h*2),b);OpenLayers.Event.observe(b,"mouseover",function(){this.style.marginTop="-15px"}.bindAsEventListener(b));OpenLayers.Event.observe(b,"mouseout",function(){if(!this.parentNode.selected)this.style.marginTop="0px"}.bindAsEventListener(b));a=OpenLayers.Util.createDiv(a,c,d,null,"absolute",null,"hidden");a.appendChild(b);a.image=b;a.value=c.y;a.events=new OpenLayers.Events(this,a,null,true);a.events.register("mousedown",
this,this.markerClick);a.events.register("mouseover",a,function(){this.style.cursor="pointer"});this.markers.push(a);a.style.visibility="hidden";this.markersDiv.appendChild(a);return this.marker},_addButton:function(a,b,c,d){b=EMS.Util.getImagesLocation()+b;b=OpenLayers.Util.createAlphaImageDiv(a+"-image",null,new OpenLayers.Size(d.w,d.h*2),b);OpenLayers.Event.observe(b,"mouseover",function(){this.style.marginTop="-26px"}.bindAsEventListener(b));OpenLayers.Event.observe(b,"mouseout",function(){this.style.marginTop=
"0px"}.bindAsEventListener(b));if(a=="zoomin")b.firstChild.alt="Zoom In";else if(a=="zoomout")b.firstChild.alt="Zoom Out";c=OpenLayers.Util.createDiv(a,c,d,null,"absolute",null,"hidden");c.appendChild(b);this.div.appendChild(c);c.events=new OpenLayers.Events(this,c,null,true);c.events.register("mousedown",c,this.buttonDown);c.events.register("dblclick",c,this.doubleClick);c.events.register("click",c,this.doubleClick);c.events.register("mouseover",c,function(){this.style.cursor="pointer"});if(this.fullZoomBar){c.events.register("mousemove",
this,this.passEventToSlider);c.events.register("mouseup",this,this.passEventToSlider);c.events.register("mouseover",this,this.showMarkers);c.events.register("mouseout",this,this.hideMarkers)}c.action=a;c.map=this.map;c.slideFactor=this.slideFactor;this.buttons.push(c);return c},_addZoomBar:function(a){var b=EMS.Util.getImagesLocation(),c=this.sliderSize.clone(),d=this.handleSize,e="EMS_Control_ZoomBar_Slider"+this.map.id;this.map.getNumZoomLevels();this.map.getZoom();b=OpenLayers.Util.createAlphaImageDiv(e+
"-image",null,new OpenLayers.Size(this.handleSize.w,this.handleSize.h*2),b+"sdr-pointer.png");OpenLayers.Event.observe(b,"mouseover",function(){this.style.marginTop="-18px"}.bindAsEventListener(b));OpenLayers.Event.observe(b,"mouseout",function(){this.style.marginTop="0px"}.bindAsEventListener(b));this.slider=OpenLayers.Util.createDiv(e,a.add(-d.w/2+4,c.h-d.h/2),this.handleSize,null,"absolute",null,"hidden");this.slider.appendChild(b);this.slider.events=new OpenLayers.Events(this,this.slider,null,
true);this.slider.events.register("mousedown",this,this.zoomBarDown);this.slider.events.register("mousemove",this,this.zoomBarDrag);this.slider.events.register("mouseup",this,this.zoomBarUp);this.slider.events.register("dblclick",this,this.doubleClick);this.slider.events.register("click",this,this.doubleClick);this.slider.events.register("mouseover",this,this.showMarkers);this.slider.className="ZoomBar_Slider";this.div.appendChild(this.slider);this.map.events.register("zoomend",this,this.moveZoomBar);
return a=a.add(0,c.h)},_addPhotoButton:function(a){var b=new OpenLayers.Icon(EMS.Util.getImagesLocation()+"Photo_off.gif",new OpenLayers.Size(36,21),new OpenLayers.Size(0,0)),c=new OpenLayers.Icon(EMS.Util.getImagesLocation()+"Photo_on_extended.gif",new OpenLayers.Size(137,21),new OpenLayers.Size(0,0)),d=new OpenLayers.Icon(EMS.Util.getImagesLocation()+"Photo_on.gif",new OpenLayers.Size(36,21),new OpenLayers.Size(0,0)),e=this.photoLayer.getVisibility();b=new EMS.Button(b,c,d,e,{div:this.layersDiv,
displayClass:"photoLayerSelector"});b.draw(a);b.contentDiv.innerHTML="Photo";b.events.register("click",this,function(f){this.streetButton.isDown=false;this.photoButton.isDown=true;this.map.setBaseLayer(this.photoLayer,false);this.hybridLayer.setVisibility(this.showHybridInPhotoView);this.photoButton.contentDiv.innerHTML="";this.photoButton.contentDiv.appendChild(this._photoContents(this.streetButton.isDown,this.photoButton.isDown,this.hybridLayer.getVisibility()));OpenLayers.Event.stop(f)});return b},
displayPhotoLayer:function(a){this.map.setBaseLayer(this.photoLayer,false);this.hybridLayer.setVisibility(a);if(this.showMapPhotoButtons){this.streetButton.isDown=false;this.photoButton.isDown=true;this.photoButton.contentDiv.innerHTML="";this.photoButton.contentDiv.appendChild(this._photoContents(this.streetButton.isDown,this.photoButton.isDown,this.hybridLayer.getVisibility()))}},_addStreetButton:function(a){var b=new OpenLayers.Icon(EMS.Util.getImagesLocation()+"Map_off.gif",new OpenLayers.Size(38,
21),new OpenLayers.Size(0,0)),c=new OpenLayers.Icon(EMS.Util.getImagesLocation()+"Map_on.gif",new OpenLayers.Size(38,21),new OpenLayers.Size(0,0)),d=c.clone(),e=this.streetLayer.getVisibility();b=new EMS.Button(b,c,d,e,{div:this.layersDiv,displayClass:"streetLayerSelector"});b.draw(a);b.contentDiv.innerHTML=e?"<b>Map</b>":"Map";b.events.register("click",this,function(f){this.streetButton.isDown=true;this.photoButton.isDown=false;this.photoButton.contentDiv.innerHTML="";this.photoButton.contentDiv.appendChild(this._photoContents(this.streetButton.isDown,
this.photoButton.isDown,this.hybridLayer.getVisibility()));this.map.setBaseLayer(this.streetLayer,false);OpenLayers.Event.stop(f)});this.hybridLayer.setVisibility(false);return b},_photoContents:function(a,b,c){a=OpenLayers.Util.createDiv();var d=document.createTextNode("Photo ");if(b){var e=document.createElement("b");e.appendChild(d);d=e}a.appendChild(d);if(b){b=document.createElement("img");b.src=EMS.Util.getImagesLocation()+"divider.gif";a.appendChild(b);b=document.createTextNode(" ");a.appendChild(b);
b=document.createElement("span");d=document.createElement("a");d.href="#";OpenLayers.Event.observe(d,"click",this._toggleHybrid.bindAsEventListener(this));c=c?document.createTextNode("Hide street labels"):document.createTextNode("Show street labels");d.appendChild(c);b.appendChild(d);a.appendChild(b)}return a},_toggleHybrid:function(){this.hybridLayer.setVisibility(!this.hybridLayer.getVisibility(),false);this.showHybridInPhotoView=this.hybridLayer.getVisibility()},_addHover:function(a){OpenLayers.Event.observe(a,
"mouseover",function(){a.style.backgroundImage=a.onImgLocation})},passEventToSlider:function(a){this.slider.events.handleBrowserEvent(a)},divClick:function(a){if(OpenLayers.Event.isLeftClick(a)){this.map.zoomTo(Math.ceil((a.xy.y-this.handleSize.h/2)/this.sliderSize.h*this.map.getNumZoomLevels()));this.updateMarkers();OpenLayers.Event.stop(a)}},markerClick:function(a){if(OpenLayers.Event.isLeftClick(a)){a.xy.y=a.element.value;this.divClick(a)}},updateMarkers:function(){for(var a=OpenLayers.Util.pagePosition(this.slider)[1],
b=0;b<this.markers.length;b++){var c=this.markers[b],d=OpenLayers.Util.pagePosition(c)[1];d=c.clientHeight+d-a;if(d<this.handleSize.h*2&&d>=0){c.selected=true;c.image.style.marginTop="-15px"}else{c.selected=false;c.image.style.marginTop="0px"}}},showMarkers:function(){this.updateMarkers();this.markersVisible=true;for(var a=0;a<this.markers.length;a++)this.markers[a].style.visibility="visible"},hideMarkers:function(){this.markersVisible=false;if(this.mouseDragStart==null)for(var a=0;a<this.markers.length;a++)this.markers[a].style.visibility=
"hidden"},zoomBarDown:function(a){if(OpenLayers.Event.isLeftClick(a)){document.onselectstart=function(){return false};document.onmouseup=function(){document.onselectstart=null};this.map.events.unregister("zoomend",this,this.moveZoomBar);this.map.events.register("mousemove",this,this.passEventToSlider);this.map.events.register("mouseup",this,this.passEventToSlider);this.mouseDragStart=a.xy.clone();this.zoomStart=a.xy.clone();this.slider.style.cursor="url('"+EMS.Util.getImagesLocation()+"grabbing.cur'), move";
this.div.style.cursor="url('"+EMS.Util.getImagesLocation()+"grabbing.cur'), move";OpenLayers.Event.stop(a)}},zoomBarDrag:function(a){if(this.mouseDragStart!=null){var b=OpenLayers.Util.docPosition(this.scale),c=EMS.Event.pointerY(a)-b[1],d=parseInt(this.scale.style.top),e=parseInt(this.scale.style.height),f=parseInt(this.slider.style.height);b=d+c-f/2;var g=c-f/2<0;if(g)b=d;if(c=c-f/2>e-f)b=d+e-f;d=parseInt(this.slider.style.top);this.slider.style.top=b+"px";this.updateMarkers();this.mouseDragStart=
a.xy.clone();d!=b&&(g||c)?this.zoomBarUp(a):OpenLayers.Event.stop(a)}},zoomBarUp:function(a){if(OpenLayers.Event.isLeftClick(a))if(this.zoomStart){this.slider.style.cursor="url('"+EMS.Util.getImagesLocation()+"grab.cur'), move";this.div.style.cursor="url('"+EMS.Util.getImagesLocation()+"grab.cur'), move";this.map.events.unregister("mouseup",this,this.passEventToSlider);this.map.events.unregister("mousemove",this,this.passEventToSlider);this.map.zoomTo(Math.floor((this.slider.offsetTop-this.scale.offsetTop)/
this.sliderSize.h*this.map.getNumZoomLevels()));this.mouseDragStart=null;OpenLayers.Event.stop(a);this.map.events.register("zoomend",this,this.moveZoomBar);this.moveZoomBar();this.markersVisible||this.hideMarkers();this.zoomStart=null}},moveZoomBar:function(){var a=this.map.getZoom()/this.map.getNumZoomLevels()*this.sliderSize.h;a+=parseInt(this.scale.style.top);this.slider.style.top=a+"px";this.updateMarkers()},CLASS_NAME:"EMS.Control.ZoomBar"});EMS.Control.ZoomBar.X=0;EMS.Control.ZoomBar.Y=0;
if(typeof EMS.Services=="undefined")EMS.Services={};OpenLayers.Map.TILE_WIDTH=400;OpenLayers.Map.TILE_HEIGHT=400;EMS.Services.communicationMode="XMLHttpRequest";EMS.Services._onException=function(a,b){typeof OpenLayers.Console!="undefined"&&OpenLayers.Console&&OpenLayers.Console.debug(b);b.message?alert("Problem: "+b.message):alert("Problem: "+b)};
EMS.Services.Map=OpenLayers.Class(OpenLayers.Map,{buffer:0,tilePath:null,pingPeriod:3E5,EVENT_TYPES:["addlayer","removelayer","changelayer","movestart","move","moveend","zoomend","popupopen","popupclose","addmarker","removemarker","clearmarkers","mouseover","mouseout","mousemove","dragstart","drag","dragend","changebaselayer","inactiveclick"],initialize:function(a,b){this.active=true;this.tilePath=EMS.tilePath;b=b?b:{};b=OpenLayers.Util.extend({maxExtent:new OpenLayers.Bounds(100,-50,170,-3),maxResolution:0.1,
numZoomLevels:17,miniControls:false,showMapPhotoButtons:true,showMaxExtent:true},b);var c=false;if(b.controls==null){b.controls=[];c=true}OpenLayers.Map.prototype.initialize.apply(this,[a,b]);if(EMS.tilePath instanceof Array){a=new Array(EMS.tilePath.length);for(var d=0;d<EMS.tilePath.length;d++)a[d]=EMS.tilePath[d]+"/tile?"}else a=EMS.tilePath+"/tile?";if(b.layers==null){this.whereis_street_wms=new EMS.IndexedLayer("Whereis Street",a,{layers:"street",format:"image/gif",CACHE:"TRUE",VERSION:EMS.tileVersion},
{displayOutsideMaxExtent:true,visible:true});this.whereis_street_wms.setVisibility(true);this.whereis_street_wms.transitionEffect="resize";this.whereis_photo_wms=new EMS.IndexedLayer("Whereis Photo",a,{layers:"photo",format:"image/jpg",CACHE:"TRUE",VERSION:EMS.tileVersion},{displayOutsideMaxExtent:true,visible:false});this.whereis_photo_wms.setVisibility(false);this.whereis_photo_wms.transitionEffect="resize";this.whereis_hybrid_wms=new EMS.IndexedLayer("Whereis Hybrid",a,{layers:"hybrid",format:"image/gif",
TRANSPARENT:true,CACHE:"TRUE",VERSION:EMS.tileVersion},{displayOutsideMaxExtent:true,transparent:true});this.whereis_hybrid_wms.setVisibility(false);this.whereis_hybrid_wms.transitionEffect="resize";if(OpenLayers.Renderer.SVG.prototype.supported()||OpenLayers.Renderer.VML.prototype.supported())this.vlayer=new EMS.Layer.Vector("Route");this.markersLayer=new OpenLayers.Layer.Markers("Markers");OpenLayers.Renderer.SVG.prototype.supported()||OpenLayers.Renderer.VML.prototype.supported()?this.addLayers([this.whereis_street_wms,
this.whereis_photo_wms,this.whereis_hybrid_wms,this.vlayer,this.markersLayer]):this.addLayers([this.whereis_street_wms,this.whereis_photo_wms,this.whereis_hybrid_wms,this.markersLayer])}if(c){this.addControl(this.zoombar=new EMS.Control.ZoomBar(this.whereis_street_wms,this.whereis_photo_wms,this.whereis_hybrid_wms,!b.miniControls,b.showMapPhotoButtons));this.addControl(this.mouseDefaults=new EMS.Control.MouseDefaults);this.addControl(this.panNorth=new EMS.Control.PanButton("n"));this.addControl(this.panSouth=
new EMS.Control.PanButton("s"));this.addControl(this.panEast=new EMS.Control.PanButton("e"));this.addControl(this.panWest=new EMS.Control.PanButton("w"));this.addControl(this.copyRight=new EMS.Control.Copyright({smallCopyright:b.miniControls}));this.addControl(this.scalebar=new EMS.Control.Scale);c=new EMS.IndexedLayer("Street",a,{layers:"street",format:"image/gif",cache:"TRUE",version:EMS.tileVersion},{displayOutsideMaxExtent:true,visible:true});c.buffer=0;this.addControl(this.overviewmap=new EMS.Control.OverviewMap({layers:[c],
mapOptions:{maxResolution:1.6,numZoomLevels:21,maxExtent:new OpenLayers.Bounds(100,-50,170,-3)}}))}this.center==undefined&&b.showMaxExtent&&this.zoomToMaxExtent();c=OpenLayers.Function.bind(function(e){if(e.authorized){if(!b.noping)this.timeoutVar=setTimeout(OpenLayers.Function.bind(this.ping,this),this.pingPeriod);b.onInit&&b.onInit(this)}else{EMS.token=null;this.destroy();alert("Authentication problem")}},this);a=EMS.Util.getDomain();EMS.Ajax.json("/json/auth/init",c,{parameters:{token:EMS.token,
domain:a}})},ping:function(){var a=function(){};EMS.Services._json("/json/ping/ping",a,{parameters:{},onException:a});this.timeoutVar=setTimeout(OpenLayers.Function.bind(this.ping,this),this.pingPeriod)},destroy:function(){OpenLayers.Map.prototype.destroy.apply(this);this.timeoutVar&&clearTimeout(this.timeoutVar)},deactivate:function(){if(this.active){var a=document.createElement("div");a.style.left="0px";a.style.top="0px";a.style.width="100%";a.style.height="100%";a.id=this.div.id+"glassPane";a.style.position=
"relative";a.style.backgroundImage="url('+ "+EMS.Util.getImagesLocation()+"blank.gif')";a.style.zIndex="4000";var b=this.div.childNodes[0],c=function(e){OpenLayers.Event.stop(e);this.events.triggerEvent("inactiveclick")}.bindAsEventListener(this),d=function(e){OpenLayers.Event.stop(e)}.bindAsEventListener(this);OpenLayers.Event.observe(a,"click",c);OpenLayers.Event.observe(a,"mousedown",c);OpenLayers.Event.observe(a,"mouseup",c);OpenLayers.Event.observe(a,"dblclick",c);OpenLayers.Event.observe(a,
"mousemove",d);OpenLayers.Event.observe(a,"mouseover",d);OpenLayers.Event.observe(a,"mouseout",d);b.appendChild(a);this.glassPane=a;this.active=false}},activate:function(){if(!this.active){OpenLayers.Event.stopObservingElement(this.glassPane);this.div.childNodes[0].removeChild(this.glassPane);this.active=true}},print:function(a,b){var c={layers:OpenLayers.Function.bind(function(){var d=[];this.whereis_street_wms.getVisibility()&&d.push("street");this.whereis_photo_wms.getVisibility()&&d.push("photo");
this.whereis_hybrid_wms.getVisibility()&&d.push("hybrid");return d},this)(),vector:this._externalizeVectorLayer(this.vlayer),markers:this._remoteMarkers(this.markersLayer),mapWidth:this.getSize().w,mapHeight:this.getSize().h,boundingBox:{left:this.getExtent().left,bottom:this.getExtent().bottom,right:this.getExtent().right,top:this.getExtent().top}};b=OpenLayers.Util.extend({parameters:{request:c}},b);EMS.Services._json("/json/print/custom",a,b)},print2:function(a,b,c){a={layers:OpenLayers.Function.bind(function(){var d=
[];this.whereis_street_wms.getVisibility()&&d.push("street");this.whereis_photo_wms.getVisibility()&&d.push("photo");this.whereis_hybrid_wms.getVisibility()&&d.push("hybrid");return d},this)(),routeHandle:a,markers:this._remoteMarkers(this.markersLayer),mapWidth:c.width?c.width:this.getSize().w,mapHeight:c.height?c.height:this.getSize().h,boundingBox:{left:this.getExtent().left,bottom:this.getExtent().bottom,right:this.getExtent().right,top:this.getExtent().top}};c=OpenLayers.Util.extend({parameters:{request:a}},
c);EMS.Services._json("/json/print/simple",b,c)},_remoteGrid:function(a){if(a.getVisibility()){for(var b=[],c=0;c<a.grid.length;c++){b[c]=[];for(var d=0;d<a.grid[c].length;d++){var e=a.grid[c][d];b[c][d]={bounds:{left:e.bounds.left,right:e.bounds.right,top:e.bounds.top,bottom:e.bounds.bottom},url:e.url,position:{x:e.position.x+this.layerContainerDiv.offsetLeft,y:e.position.y+this.layerContainerDiv.offsetTop}}}}return b}else return null},_remoteMarkers:function(a){for(var b=[],c=0;c<a.markers.length;c++){var d=
a.markers[c];if(d.visible==undefined||d.visible)b.push({lonlat:{lat:d.lonlat.lat,lon:d.lonlat.lon},icon:{px:{x:d.icon.px.x,y:d.icon.px.y},sz:{w:d.icon.size.w,h:d.icon.size.h},url:EMS.Util.toAbsoluteUrl(d.icon.url),offset:{x:d.icon.offset.x,y:d.icon.offset.y}}})}return b},_remoteFeatures:function(a){for(var b=[],c=0;c<a.features.length;c++)for(var d=a.features[c],e=0;e<d.geometry.components.length;e++)b.push(d.geometry.components[e].toString());return b},_externalizeVectorLayer:function(a){var b=new EMS.Geometry.PolylineBoundsFilter(this.getExtent()),
c=new EMS.Geometry.SimpleLineReducer(this.getResolution());return a.externalize(new EMS.Geometry.JsonFormatter(b,c))}});
EMS.Services.Geocoder=OpenLayers.Class({initialize:function(){},findAddress:function(a,b,c,d,e){var f={};f.street=a;f.suburb=b;f.state=c;a={address:f};if(e&&e.feature)a=OpenLayers.Util.extend({feature:e.feature},a);e=OpenLayers.Util.extend({parameters:a},e);this._json("/json/fastGeocode/simple",d,e)},findGeocodedAddress:function(a,b,c){a={address:a.address};if(c&&c.feature)a=OpenLayers.Util.extend({feature:c.feature},a);c=OpenLayers.Util.extend({parameters:a},c);this._json("/json/fastGeocode/findGeocodedAddress",
b,c)},reverseGeocode:function(a,b,c,d){a={longitude:a,latitude:b};if(d&&d.feature)a=OpenLayers.Util.extend({feature:d.feature},a);d=OpenLayers.Util.extend({parameters:a},d);this._json("/json/fastGeocode/reverseGeocode",c,d)},reverseGeocodePoi:function(a,b,c){c=OpenLayers.Util.extend({parameters:{longitude:a.lon,latitude:a.lat,keyword:a.keyword,source:a.source}},c);this._json("/json/fastGeocode/reverseGeocodePoi",b,c)},findLocalityByPrefix:function(a,b,c){c=OpenLayers.Util.extend({parameters:{address:a.address,
id:a.id}},c);this._json("/json/fastGeocode/findLocalityByPrefix",b,c)},findStreetByPrefix:function(a,b,c){c=OpenLayers.Util.extend({parameters:{street:a}},c);this._json("/json/fastGeocode/findStreetByPrefix",b,c)},poiSearch:function(a,b,c){c=OpenLayers.Util.extend({parameters:{address:a.address,bounds:a.bounds,keyword:a.keyword,offset:a.offset,size:a.size,source:a.source,id:a.id,poiId:a.poiId}},c);this._json("/json/fastGeocode/poiSearch",b,c)},combinedSearch:function(a,b,c){c=OpenLayers.Util.extend({parameters:{address:a.address,
keyword:a.keyword,bounds:a.bounds,offset:a.offset,size:a.size,source:a.source,id:a.id,poiId:a.poiId}},c);this._json("/json/fastGeocode/combinedSearch",b,c)},locationPoiSearch:function(a,b,c){c=OpenLayers.Util.extend({parameters:{address:a.address,bounds:a.bounds,keyword:a.keyword,xy:a.xy,offset:a.offset,size:a.size,source:a.source,id:a.id,poiId:a.poiId,feature:a.feature}},c);this._json("/json/fastGeocode/locationPoiSearch",b,c)},geocodeIntersection:function(a,b,c){c=OpenLayers.Util.extend({parameters:{primaryStreet:a.primaryStreet,
intersectingStreet:a.intersectingStreet,suburb:a.suburb,state:a.state}},c);this._json("/json/geocode/geocodeIntersection",b,c)},reverseGeocodeIntersection:function(a,b,c,d){d=OpenLayers.Util.extend({parameters:{longitude:a,latitude:b}},d);this._json("/json/geocode/reverseGeocodeIntersection",c,d)},_json:EMS.Services._json,_onException:EMS.Services._onException,CLASS_NAME:"EMS.Services.Geocoder"});
EMS.Services.Itin=OpenLayers.Class({initialize:function(){},splitRoute:function(a,b,c,d,e,f,g){g=OpenLayers.Util.extend({parameters:this._getRouteParams(a,b,c,d,e)},g);this._json("/json/itin/splitRoute",f,g)},combinedRoute:function(a,b,c,d,e,f,g){g=OpenLayers.Util.extend({parameters:this._getRouteParams(a,b,c,d,e,g.landmarks)},g);this._json("/json/itin/combinedRoute",f,g)},_getRouteParams:function(a,b,c,d,e,f){var g={};if(a[0].street)g.wpAddresses=a;else for(var j=0;j<a.length;j++)g["wp"+(j+1)]=a[j];
g.fastest=b;g.tolls=c;g.tt=d;g.handleOnly=e;g.landmarks=f;return g},getRoutePart:function(a,b,c,d,e){e=OpenLayers.Util.extend({parameters:{handle:a,resolution:b,left:c.left,top:c.top,right:c.right,bottom:c.bottom}},e);this._json("/json/itin/getRoutePart",d,e)},rankPoints:function(a,b,c,d,e,f){f=OpenLayers.Util.extend({parameters:{lon:a.lon,lat:a.lat,tolls:c,mode:d,points:b}},f);this._json("/json/itin/rankPoints",e,f)},releaseRouteHandle:function(a,b){b=OpenLayers.Util.extend({parameters:{handle:a}},
b);this._json("/json/itin/releaseRouteHandle",function(){},b)},_json:EMS.Services._json,_onException:EMS.Services._onException,CLASS_NAME:"EMS.Services.Itin"});
EMS.Services.Itin2=OpenLayers.Class(EMS.Services.Itin,{combinedRoute:function(a,b,c){c=OpenLayers.Util.extend({parameters:{json:a}},c);this._json("/json/route/route",b,c)},getRoutePart:function(a,b,c,d,e){e=OpenLayers.Util.extend({parameters:{handle:a,resolution:b,left:c.left,top:c.top,right:c.right,bottom:c.bottom}},e);this._json("/json/route/getRoutePart",d,e)}});OpenLayers.Map.prototype.getLayerByName=function(a){for(var b=0;b<this.layers.length;b++)if(this.layers[b].name==a)return this.layers[b]};
EMS.Services.StandardIconGeometry={colours:{purple:{start:"4D1448",end:"AB489B"},green:{start:"1D4242",end:"71C9C1"},brown:{start:"522C10",end:"AD8852"}},poi:{size:new OpenLayers.Size(27,32),offset:new OpenLayers.Pixel(-14,-32),url:function(a,b,c,d,e,f){a="/marker?type=poi&width=27&height=96&colour1="+encodeURIComponent(a)+"&colour2="+encodeURIComponent(b)+"&text1="+encodeURIComponent(c);if(d!=null)a+="&textColour="+encodeURIComponent(d);if(e!=null)a+="&hoverColour1="+encodeURIComponent(e);if(f!=
null)a+="&hoverColour2="+encodeURIComponent(f);return a}},multipoi:{size:new OpenLayers.Size(36,43),offset:new OpenLayers.Pixel(-14,-43),url:function(a,b,c,d,e,f){a="/marker?type=multipoi&width=36&height=129&colour1="+encodeURIComponent(a)+"&colour2="+encodeURIComponent(b)+"&text2=&text1="+encodeURIComponent(c);if(d!=null)a+="&textColour="+encodeURIComponent(d);if(e!=null)a+="&hoverColour1="+encodeURIComponent(e);if(f!=null)a+="&hoverColour2="+encodeURIComponent(f);return a}},babushka:{size:new OpenLayers.Size(36,
43),offset:new OpenLayers.Pixel(-14,-43),url:function(a,b,c,d,e,f){a="/marker?type=babushka&width=36&height=129&text1="+encodeURIComponent(a);a+=b!=null?"&colour1="+encodeURIComponent(b):"&colour1=213367";a+=b!=null?"&colour2="+encodeURIComponent(c):"&colour2=2B89C9";if(d!=null)a+="&textColour="+encodeURIComponent(d);if(e!=null)a+="&hoverColour1="+encodeURIComponent(e);if(f!=null)a+="&hoverColour2="+encodeURIComponent(f);return a}}};
EMS.Services.StandardIcons={crossHair:function(){return new EMS.HoverIcon(EMS.Util.getImagesLocation()+"cross_hair.png",new OpenLayers.Size(28,30),new OpenLayers.Pixel(-14,-15))},crossHairAGD:function(){return new EMS.HoverIcon(EMS.Util.getImagesLocation()+"cross_hair3.png",new OpenLayers.Size(28,30),new OpenLayers.Pixel(-14,-15))},crossHairGDA:function(){return new EMS.HoverIcon(EMS.Util.getImagesLocation()+"cross_hair2.png",new OpenLayers.Size(28,30),new OpenLayers.Pixel(-14,-15))},start:function(){return new EMS.HoverIcon(EMS.Util.getImagesLocation()+
"start.png",new OpenLayers.Size(43,30),new OpenLayers.Pixel(-20,-29))},end:function(){return new EMS.HoverIcon(EMS.Util.getImagesLocation()+"end.png",new OpenLayers.Size(34,30),new OpenLayers.Pixel(-20,-29))},vias:[function(){return new EMS.HoverIcon(EMS.Util.getImagesLocation()+"via1.png",new OpenLayers.Size(42,30),new OpenLayers.Pixel(-20,-29))},function(){return new EMS.HoverIcon(EMS.Util.getImagesLocation()+"via2.png",new OpenLayers.Size(42,30),new OpenLayers.Pixel(-20,-29))},function(){return new EMS.HoverIcon(EMS.Util.getImagesLocation()+
"via3.png",new OpenLayers.Size(42,30),new OpenLayers.Pixel(-20,-29))},function(){return new EMS.HoverIcon(EMS.Util.getImagesLocation()+"via4.png",new OpenLayers.Size(42,30),new OpenLayers.Pixel(-20,-29))},function(){return new EMS.HoverIcon(EMS.Util.getImagesLocation()+"via5.png",new OpenLayers.Size(42,30),new OpenLayers.Pixel(-20,-29))}],redNumber:function(a,b){return new OpenLayers.Icon(a+"/marker?type=number&width=20&height=20&colour1=000000&colour2=000000&text1="+b,new OpenLayers.Size(20,20),
new OpenLayers.Pixel(-10,-10))},poi:function(a,b,c,d,e,f,g){return new EMS.HoverIcon(a+EMS.Services.StandardIconGeometry.poi.url(b,c,d,e,f,g),EMS.Services.StandardIconGeometry.poi.size,EMS.Services.StandardIconGeometry.poi.offset,null,3)},purplePoi:function(a,b){return EMS.Services.StandardIcons.poi(a,EMS.Services.StandardIconGeometry.colours.purple.start,EMS.Services.StandardIconGeometry.colours.purple.end,b)},greenPoi:function(a,b){return EMS.Services.StandardIcons.poi(a,EMS.Services.StandardIconGeometry.colours.green.start,
EMS.Services.StandardIconGeometry.colours.green.end,b)},brownPoi:function(a,b){return EMS.Services.StandardIcons.poi(a,EMS.Services.StandardIconGeometry.colours.brown.start,EMS.Services.StandardIconGeometry.colours.brown.end,b)},multipoi:function(a,b,c,d,e,f,g){return new EMS.HoverIcon(a+EMS.Services.StandardIconGeometry.multipoi.url(b,c,d,e,f,g),EMS.Services.StandardIconGeometry.multipoi.size,EMS.Services.StandardIconGeometry.multipoi.offset,null,3)},purpleMultipoi:function(a,b){return new EMS.Services.StandardIcons.multipoi(a,
EMS.Services.StandardIconGeometry.colours.purple.start,EMS.Services.StandardIconGeometry.colours.purple.end,b)},greenMultipoi:function(a,b){return new EMS.Services.StandardIcons.multipoi(a,EMS.Services.StandardIconGeometry.colours.green.start,EMS.Services.StandardIconGeometry.colours.green.end,b)},brownMultipoi:function(a,b){return new EMS.Services.StandardIcons.multipoi(a,EMS.Services.StandardIconGeometry.colours.brown.start,EMS.Services.StandardIconGeometry.colours.brown.end,b)},babushka:function(a,
b,c,d,e,f,g){return new EMS.HoverIcon(a+EMS.Services.StandardIconGeometry.babushka.url(b,c,d,e,f,g),EMS.Services.StandardIconGeometry.babushka.size,EMS.Services.StandardIconGeometry.babushka.offset,null,3)},circlePoi:function(){return new EMS.HoverIcon(EMS.Util.getImagesLocation()+"circle_poi.png",new OpenLayers.Size(16,16),new OpenLayers.Pixel(-8,-8),null,2)}};
EMS.Services.LineFeatureStyle={fillColor:"#3366ff",fillOpacity:0.7,hoverFillColor:"red",hoverFillOpacity:1,strokeColor:"#3366ff",strokeOpacity:0.7,strokeWidth:7,hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:6,pointRadius:6,hoverPointRadius:6,hoverPointUnit:"%",pointerEvents:"visiblePainted"};
EMS.Services.RouteManager=OpenLayers.Class({EVENT_TYPES:["routeretrieved","invalidroute","routeerror"],events:null,mode:null,initialize:function(a){this.map=a;this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES);this.show=true;this.vectors=[]},route:function(a,b,c,d,e,f){if(!this.itin)this.itin=new EMS.Services.Itin;this.mode="route1";this.options=f;this.routeVectorLayer=e;this.itin.combinedRoute(a,b,c,d,true,OpenLayers.Function.bind(this._setupMapRoute,this),f)},toggleRoute:function(a){this.show=
a;this.routeVectorLayer&&this.routeVectorLayer.setVisibility(a)},clearRoute:function(){this.routeVectorLayer&&this.routeVectorLayer.setVisibility(false);this.rHandle&&this.itin.releaseRouteHandle(this.rHandle);this._clearVectorFeatures();this.map.events.unregister("moveend",this,this._moveHandler);this.routeDetails=this.routeVectorLayer=this.rHandle=null},_clearVectorFeatures:function(){if(this.routeVectorLayer&&this.vectors){this.routeVectorLayer.removeFeatures(this.vectors);this.vectors=[]}},_setupMapRoute:function(a){if(a.error)this.events.triggerEvent("routeerror",
a);else{this.rHandle=a.routeHandle;this.routeDetails=a;this.map.events.register("moveend",this,this._moveHandler);this.events.triggerEvent("routeretrieved");this._moveHandler();this.options&&this.options.onComplete&&this.options.onComplete(a)}},_moveHandler:function(){if(this.show){var a=this.map.getExtent();a.top=EMS.Util.sgp4ToLat(a.top);a.bottom=EMS.Util.sgp4ToLat(a.bottom);if(navigator.appName.contains("Microsoft"))this._clearVectorFeatures();else if(EMS.Util.isGecko()){var b=this.map.getCenter().lon/
this.map.getResolution()+this.routeVectorLayer.renderer.left,c=this.map.getCenter().lat/this.map.getResolution()-this.routeVectorLayer.renderer.top;if(b<-14000||b>14E3)this.routeVectorLayer.renderer.localResolution=null;if(c<-14000||c>14E3)this.routeVectorLayer.renderer.localResolution=null}this.itin.getRoutePart(this.rHandle,this.map.getResolution(),a,OpenLayers.Function.bind(this._plotRouteLine,this),{group:"routePart"})}},_plotRouteLine:function(a){if(this.routeVectorLayer){var b=[];if(a.invalidRoute){this.events.triggerEvent("invalidroute");
this.clearRoute()}else{this.routeVectorLayer.setVisibility(false);for(var c=0;c<a.routes.length;c++){var d=a.routes[c],e=[];for(k=0;k<d.routeGeometry.length;k++){for(var f=[],g=0;g<d.routeGeometry[k].length;g++){var j=d.routeGeometry[k][g][0],h=EMS.Util.latToSGP4(d.routeGeometry[k][g][1]);j=new OpenLayers.Geometry.Point(j,h);f.push(j)}if(f.length>0){f=new OpenLayers.Geometry.LineString(f);e.push(f)}}if(e.length>0){d=new OpenLayers.Geometry.MultiLineString(e);d=new EMS.Feature.Vector(d);d.routeNumber=
c;d.routeHandle=a.routeHandle;d.style=EMS.Services.LineFeatureStyle;b.push(d)}}this._clearVectorFeatures();if(b.length>0){this.routeVectorLayer.addFeatures(b);for(var k=0;k<b.length;k++)this.vectors.push(b[k])}this.routeVectorLayer.setVisibility(true)}}},CLASS_NAME:"EMS.Services.RouteManager"});
EMS.Services.RouteManager2=OpenLayers.Class(EMS.Services.RouteManager,{route:function(a,b,c){if(!this.itin)this.itin=new EMS.Services.Itin2;a.preferences.contains("ROUTE_HANDLE_ONLY")||a.preferences.push("ROUTE_HANDLE_ONLY");this.mode="route2";this.options=c;this.routeVectorLayer=b;this.itin.combinedRoute(a,OpenLayers.Function.bind(this._setupMapRoute,this),c)},_plotRouteLine:function(a){if(this.routeVectorLayer){var b=[];if(a.invalidRoute){this.events.triggerEvent("invalidroute");this.clearRoute()}else{this.routeVectorLayer.setVisibility(false);
var c=[],d=a.polylines;for(h=0;h<d.length;h++){for(var e=[],f=0;f<d[h].length;f++){var g=d[h][f][0],j=EMS.Util.latToSGP4(d[h][f][1]);g=new OpenLayers.Geometry.Point(g,j);e.push(g)}if(e.length>0){e=new OpenLayers.Geometry.LineString(e);c.push(e)}}if(c.length>0){c=new OpenLayers.Geometry.MultiLineString(c);c=new EMS.Feature.Vector(c);c.style=EMS.Services.LineFeatureStyle;c.routeHandle=a.routeHandle;b.push(c)}this._clearVectorFeatures();if(b.length>0){this.routeVectorLayer.addFeatures(b);for(var h=0;h<
b.length;h++)this.vectors.push(b[h])}this.routeVectorLayer.setVisibility(true)}}},CLASS_NAME:"EMS.Services.RouteManager2"});OpenLayers.Util.removeNode=function(a){var b=document.getElementById("IELeakGarbageBin");if(!b){b=document.createElement("DIV");b.id="IELeakGarbageBin";b.style.display="none";document.body.appendChild(b)}b.appendChild(a);b.innerHTML=""};OpenLayers.Geometry.prototype.externalize=function(){throw"EMS Unsupported Geometry Type: "+this.CLASS_NAME;};
OpenLayers.Geometry.LineString.prototype.externalize=function(a){return a.formatPolyline(this)};OpenLayers.Geometry.LinearRing.prototype.externalize=function(a){return a.formatClosedPolyline(this)};OpenLayers.Geometry.MultiLineString.prototype.externalize=function(a){return a.formatGeometryContainer(this)};OpenLayers.Geometry.Polygon.prototype.externalize=function(a){return a.formatGeometryContainer(this)};OpenLayers.Geometry.Point.prototype.externalize=function(a){return a.formatPoint(this)};
OpenLayers.Feature.Vector.prototype.externalize=function(a){return a.formatFeature(this)};EMS.Layer={};EMS.Layer.Vector=OpenLayers.Class(OpenLayers.Layer.Vector,{initialize:function(){OpenLayers.Layer.Vector.prototype.initialize.apply(this,arguments)},externalize:function(a){return a.formatVector(this)}});EMS.Feature={};EMS.Feature.Vector=OpenLayers.Class(OpenLayers.Feature.Vector,{routeHandle:null,initialize:function(){OpenLayers.Feature.Vector.prototype.initialize.apply(this,arguments)},getRouteHandle:function(){return this.routeHandle}});
EMS.Geometry={};
EMS.Geometry.JsonFormatter=OpenLayers.Class({defaultColor:"none",defaultOpacity:0,defaultWidth:1,defaultLinecap:null,filter:null,lineReducer:null,initialize:function(a,b){this.filter=a;this.lineReducer=b},formatVector:function(a){return{features:this._formatComponents(a.features)}},formatFeature:function(a){return{routeHandle:a.routeHandle?a.routeHandle:null,style:this.formatStyle(a.style),geometry:a.routeHandle?null:a.geometry.externalize(this)}},formatGeometryContainer:function(a){return{type:a.CLASS_NAME,components:this._formatComponents(a.components)}},
formatPolyline:function(a){for(var b=this._filterPolyline(a.components),c=[],d=0;d<b.length;d++)c.push(this._formatComponents(this._reducePolyline(b[d])));return{type:a.CLASS_NAME,segments:c}},formatClosedPolyline:function(a){var b=[];b.push(this._formatComponents(this._reducePolyline(a.components)));return{type:a.CLASS_NAME,segments:b}},formatStyle:function(a){return{fillColor:a.fillColor?a.fillColor:this.defaultColor,fillOpacity:a.fillOpacity?a.fillOpacity:this.defaultOpacity,strokeColor:a.strokeColor?
a.strokeColor:this.defaultColor,strokeOpacity:a.strokeOpacity?a.strokeOpacity:this.defaultOpacity,strokeWidth:a.strokeWidth?a.strokeWidth:this.defaultWidth,strokeLinecap:a.strokeLinecap?a.strokeLinecap:this.defaultLinecap}},_formatComponents:function(a){for(var b=[],c=0;c<a.length;c++)b.push(a[c].externalize(this));return b},_reducePolyline:function(a){if(this.lineReducer)return this.lineReducer.reduce(a);return a},_filterPolyline:function(a){if(this.filter)return this.filter.filter(a);return[a]},
formatPoint:function(a){return{x:a.x,y:EMS.Util.sgp4ToLat(a.y)}},CLASS_NAME:"EMS.Geometry.JsonFormatter"});
EMS.Geometry.SimpleLineReducer=OpenLayers.Class({factor:5,minDistance:null,initialize:function(a){this.minDistance=a*this.factor},reduce:function(a){var b=[],c=a[0];b.push(c);if(a.length>1){for(var d=a.length-1,e=1;e<d;e++){var f=a[e];if(this.includePoint(c,f)){b.push(f);c=f}}b.push(a[d])}return b},includePoint:function(a,b){return Math.abs(a.x-b.x)>this.minDistance||Math.abs(a.y-b.y)>this.minDistance},CLASS_NAME:"EMS.Geometry.SimpleLineReducer"});
EMS.Geometry.PolylineBoundsFilter=OpenLayers.Class({bounds:null,initialize:function(a){this.bounds=a},filter:function(a){var b=[];if(a.length>1){for(var c=[],d=a.length-1,e=0;e<d;e++)if(this.bounds.intersectsBounds(new OpenLayers.Bounds(a[e].x,a[e].y,a[e+1].x,a[e+1].y))){c.length==0&&c.push(a[e]);c.push(a[e+1])}else if(c.length>0){b.push(c);c=[]}c.length>1&&b.push(c)}return b},CLASS_NAME:"EMS.Geometry.PolylineBoundsFilter"});
EMS.HoverIcon=OpenLayers.Class({url:null,size:null,offset:null,calculateOffset:null,alphaImageDiv:null,imageDiv:null,px:null,stickyState:null,initialize:function(a,b,c,d,e){this.stickyState=null;this.numberOfStates=e||2;this.url=a;this.size=b?b:new OpenLayers.Size(20,20);this.offset=c?c:new OpenLayers.Pixel(-(this.size.w/this.numberOfStates),-(this.size.h/this.numberOfStates));this.calculateOffset=d;a=OpenLayers.Util.createUniqueID("OL_Icon_");this.alphaImageDiv=OpenLayers.Util.createAlphaImageDiv(a,
null,new OpenLayers.Size(b.w,b.h*this.numberOfStates));this.imageDiv=OpenLayers.Util.createDiv(null,null,b,null,null,null,"hidden");this.imageDiv.appendChild(this.alphaImageDiv)},destroy:function(){OpenLayers.Event.stopObservingElement(this.alphaImageDiv.firstChild);OpenLayers.Event.stopObservingElement(this.alphaImageDiv);OpenLayers.Util.removeNode(this.alphaImageDiv);OpenLayers.Util.removeNode(this.imageDiv);this.imageDiv=this.alphaImageDiv=null},clone:function(){return new EMS.HoverIcon(this.url,
this.size,this.offset,this.calculateOffset,this.numberOfStates)},setSize:function(a){if(a!=null)this.size=a;this.draw()},draw:function(a){OpenLayers.Util.modifyAlphaImageDiv(this.alphaImageDiv,null,null,new OpenLayers.Size(this.size.w,this.size.h),this.url,"absolute");OpenLayers.Util.modifyDOMElement(this.imageDiv,null,null,new OpenLayers.Size(this.size.w,this.size.h));this.imageDiv.style.position="absolute";this.imageDiv.style.overflow="hidden";this.alphaImageDiv.childNodes[0].style.height=this.size.h*
this.numberOfStates+"px";this.alphaImageDiv.style.height=this.size.h+"px";this.alphaImageDiv.style.position="relative";if(this.alphaImageDiv.firstChild.src.match("north")!=null)this.alphaImageDiv.firstChild.alt="Pan north";else if(this.alphaImageDiv.firstChild.src.match("south")!=null)this.alphaImageDiv.firstChild.alt="Pan south";else if(this.alphaImageDiv.firstChild.src.match("west")!=null)this.alphaImageDiv.firstChild.alt="Pan west";else if(this.alphaImageDiv.firstChild.src.match("east")!=null)this.alphaImageDiv.firstChild.alt=
"Pan east";OpenLayers.Event.observe(this.alphaImageDiv,"mouseover",function(){var b=this.alphaImageDiv,c;c=this.stickyState?-this.size.h*this.stickyState+"px":-this.size.h+"px";if(document.all)b.style.marginTop=c;else b.style.top=c}.bindAsEventListener(this));OpenLayers.Event.observe(this.alphaImageDiv,"mouseout",function(){var b=this.alphaImageDiv,c;c=this.stickyState?-this.size.h*this.stickyState+"px":"0px";if(document.all)b.style.marginTop=c;else b.style.top=c}.bindAsEventListener(this));this.setStickyState(this.stickyState);
this.moveTo(a);return this.imageDiv},setOpacity:function(a){OpenLayers.Util.modifyAlphaImageDiv(this.alphaImageDiv,null,null,null,null,null,null,null,a)},moveTo:function(a){if(a!=null)this.px=a;if(this.alphaImageDiv!=null)if(this.px==null)this.display(false);else{if(this.calculateOffset)this.offset=this.calculateOffset(this.size);a=this.px.offset(this.offset);OpenLayers.Util.modifyDOMElement(this.imageDiv,null,a)}},display:function(a){this.imageDiv.style.display=a?"":"none"},setStickyState:function(a){if(a==
null)a=0;this.stickyState=a;a=-this.size.h*this.stickyState+"px";if(document.all)this.alphaImageDiv.style.marginTop=a;else this.alphaImageDiv.style.top=a},isDrawn:function(){return this.imageDiv&&this.imageDiv.parentNode&&this.imageDiv.parentNode.nodeType!=11},erase:function(){this.imageDiv!=null&&this.imageDiv.parentNode!=null&&OpenLayers.Element.remove(this.imageDiv)},CLASS_NAME:"EMS.HoverIcon"});
EMS.Control.MouseDefaults=OpenLayers.Class(OpenLayers.Control,{performedDrag:false,wheelObserver:null,initialize:function(){this.active=true;OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.handler&&this.handler.destroy();this.handler=null;this.map.events.unregister("click",this,this.defaultClick);this.map.events.unregister("dblclick",this,this.defaultDblClick);this.map.events.unregister("mousedown",this,this.defaultMouseDown);this.map.events.unregister("mouseup",
this,this.defaultMouseUp);this.map.events.unregister("mousemove",this,this.defaultMouseMove);this.map.events.unregister("mouseout",this,this.defaultMouseOut);OpenLayers.Event.stopObserving(window,"DOMMouseScroll",this.wheelObserver);OpenLayers.Event.stopObserving(window,"mousewheel",this.wheelObserver);OpenLayers.Event.stopObserving(document,"mousewheel",this.wheelObserver);this.wheelObserver=null;OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(){this.map.events.register("click",
this,this.defaultClick);this.map.events.register("dblclick",this,this.defaultDblClick);this.map.events.register("mousedown",this,this.defaultMouseDown);this.map.events.register("mouseup",this,this.defaultMouseUp);this.map.events.register("mousemove",this,this.defaultMouseMove);this.map.events.register("mouseout",this,this.defaultMouseOut);this.registerWheelEvents();this.map.viewPortDiv.style.cursor="url('"+EMS.Util.getImagesLocation()+"grab.cur'), move"},registerWheelEvents:function(){this.wheelObserver=
this.onWheelEvent.bindAsEventListener(this);OpenLayers.Event.observe(window,"DOMMouseScroll",this.wheelObserver);OpenLayers.Event.observe(window,"mousewheel",this.wheelObserver);OpenLayers.Event.observe(document,"mousewheel",this.wheelObserver)},defaultMouseDown:function(a){if(this.active){this.mouseDownStart=a.xy.clone();this.mouseDownStartTime=(new Date).valueOf();this.clickCalled=this.doubleClickCalled=false;this.map.viewPortDiv.style.cursor="url('"+EMS.Util.getImagesLocation()+"grabbing.cur'), move";
if(OpenLayers.Event.isLeftClick(a)){this.mouseDragStart=a.xy.clone();this.performedDrag=false;if(a.shiftKey){this.map.div.style.cursor="crosshair";this.zoomBox=OpenLayers.Util.createDiv("zoomBox",this.mouseDragStart,null,null,"absolute","2px solid red");this.zoomBox.style.backgroundColor="white";this.zoomBox.style.filter="alpha(opacity=50)";this.zoomBox.style.opacity="0.50";this.zoomBox.style.fontSize="1px";this.zoomBox.style.zIndex=this.map.Z_INDEX_BASE.Popup-1;this.map.viewPortDiv.appendChild(this.zoomBox)}document.onselectstart=
function(){return false};OpenLayers.Event.stop(a)}}},defaultClick:function(a){if(this.active){this.clickCalled=true;var b=OpenLayers.Control.MouseDefaults.prototype.defaultClick.apply(this,arguments);if(!OpenLayers.Event.isLeftClick(a))return b;this.mouseDownStart=null;return b}},defaultMouseMove:function(a){if(this.active){this.mousePosition=a.xy.clone();if(this.mouseDragStart!=null)if(this.zoomBox){var b=Math.abs(this.mouseDragStart.x-a.xy.x),c=Math.abs(this.mouseDragStart.y-a.xy.y);this.zoomBox.style.width=
Math.max(1,b)+"px";this.zoomBox.style.height=Math.max(1,c)+"px";if(a.xy.x<this.mouseDragStart.x)this.zoomBox.style.left=a.xy.x+"px";if(a.xy.y<this.mouseDragStart.y)this.zoomBox.style.top=a.xy.y+"px"}else{b=this.mouseDragStart.x-a.xy.x;c=this.mouseDragStart.y-a.xy.y;if(!(!this.performedDrag&&Math.abs(b)<7&&Math.abs(c)<7)){var d=this.map.getSize();this.map.setCenter(this.map.getLonLatFromViewPortPx(new OpenLayers.Pixel(d.w/2+b,d.h/2+c)),null,true);this.mouseDragStart=a.xy.clone();this.map.div.style.cursor=
"move";this.performedDrag=true}}}},defaultMouseOut:function(a){if(this.active)if(this.mouseDragStart!=null&&OpenLayers.Util.mouseLeft(a,this.map.div)){this.zoomBox&&this.removeZoomBox();this.mouseDragStart=null;this.map.events.triggerEvent("moveend")}},cancelRecenter:function(){this.doubleClickCalled=true},defaultWheelUp:function(a){if(this.active){a=this.map.getLonLatFromPixel(a.xy);var b=this.map.getCenter(),c=this.map.getResolution();c=new OpenLayers.Pixel((a.lon-b.lon)/c,(a.lat-b.lat)/c);var d=
this.map.baseLayer!=null?this.map.baseLayer.resolutions[this.map.getZoom()+1]:this.map.getResolution();if(this.useSmoothZoom()){b=new OpenLayers.LonLat(b.lon+c.x*d,b.lat+c.y*d);EMS.Util.smoothZoom(this.map,a,b,this.map.getZoom()+1)}else this.map.setCenter(new OpenLayers.LonLat(a.lon-c.x*d,a.lat-c.y*d),this.map.getZoom()+1)}},useSmoothZoom:function(){return OpenLayers.Layer.prototype.SUPPORTED_TRANSITIONS&&this.contains(OpenLayers.Layer.prototype.SUPPORTED_TRANSITIONS,"resize")&&this.map.baseLayer.transitionEffect==
"resize"},contains:function(a,b){for(var c=0;c<a.length;c++)if(a[c]==b)return true;return false},defaultWheelDown:function(a){if(this.active)if(this.map.getZoom()>0){a=this.map.getLonLatFromPixel(a.xy);var b=this.map.getCenter(),c=this.map.getResolution();b=new OpenLayers.Pixel((a.lon-b.lon)/c,(a.lat-b.lat)/c);c=this.map.baseLayer!=null?this.map.baseLayer.resolutions[this.map.getZoom()-1]:this.map.getResolution();if(this.useSmoothZoom()){b=new OpenLayers.LonLat(a.lon-b.x*c,a.lat-b.y*c);EMS.Util.smoothZoom(this.map,
a,b,this.map.getZoom()-1)}else this.map.setCenter(new OpenLayers.LonLat(a.lon-b.x*c,a.lat-b.y*c),this.map.getZoom()-1)}},defaultMouseUp:function(a){if(this.active){this.map.viewPortDiv.style.cursor="url('"+EMS.Util.getImagesLocation()+"grab.cur'), move";if(OpenLayers.Event.isLeftClick(a)){if(this.zoomBox)this.zoomBoxEnd(a);else this.performedDrag&&this.map.setCenter(this.map.center);this.mouseDragStart=document.onselectstart=null;this.map.div.style.cursor="";this.performedDrag=false}}},zoomBoxEnd:function(a){if(this.mouseDragStart!=
null){if(Math.abs(this.mouseDragStart.x-a.xy.x)>5||Math.abs(this.mouseDragStart.y-a.xy.y)>5){var b=this.map.getLonLatFromViewPortPx(this.mouseDragStart),c=this.map.getLonLatFromViewPortPx(a.xy);a=Math.max(b.lat,c.lat);var d=Math.min(b.lat,c.lat),e=Math.min(b.lon,c.lon);b=Math.max(b.lon,c.lon);this.map.zoomToExtent(new OpenLayers.Bounds(e,d,b,a))}else{c=this.map.getLonLatFromViewPortPx(a.xy);this.map.setCenter(new OpenLayers.LonLat(c.lon,c.lat),this.map.getZoom()+1)}this.removeZoomBox()}},removeZoomBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox);
this.zoomBox=null},defaultDblClick:function(a){if(this.active){this.doubleClickCalled=true;this.map.setCenter(this.map.getLonLatFromViewPortPx(a.xy),this.map.zoom+1);OpenLayers.Event.stop(a);return false}},onWheelEvent:function(a){for(var b=false,c=OpenLayers.Event.element(a);c!=null;){if(this.map&&c==this.map.div){b=true;break}c=c.parentNode}if(b){b=0;if(!a)a=window.event;if(a.wheelDelta){b=a.wheelDelta/120;if(window.opera)b=-b}else if(a.detail)b=-a.detail/3;if(b){a.xy=this.mousePosition;b<0?this.defaultWheelDown(a):
this.defaultWheelUp(a)}OpenLayers.Event.stop(a)}},CLASS_NAME:"EMS.Control.MouseDefaults"});
EMS.HighlightFeature=OpenLayers.Class(OpenLayers.Control,{callbacks:null,onSelect:function(){},onUnselect:function(){},initialize:function(a,b){OpenLayers.Control.prototype.initialize.apply(this,[b]);this.callbacks=OpenLayers.Util.extend({over:this.overFeature,out:this.outFeature},this.callbacks);this.layer=a;this.handler=new OpenLayers.Handler.Feature(this,a,this.callbacks);this.selectStyle=b.hoverStyle;this.handler.activate=function(){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.layerIndex=
this.layer.div.style.zIndex;return true}else return false}},overFeature:function(a){OpenLayers.Util.indexOf(this.layer.selectedFeatures,a)>-1||this.select(a)},outFeature:function(a){this.unselect(a)},select:function(a){if(a.originalStyle==null)a.originalStyle=a.style;this.layer.selectedFeatures.push(a);this.layer.drawFeature(a,this.selectStyle);this.onSelect(a)},unselect:function(a){if(a.originalStyle==null)a.originalStyle=a.style;this.layer.drawFeature(a,a.originalStyle);OpenLayers.Util.removeItem(this.layer.selectedFeatures,
a);this.onUnselect(a)},setMap:function(a){this.handler.setMap(a);OpenLayers.Control.prototype.setMap.apply(this,arguments)},CLASS_NAME:"EMS.HighlightFeature"});
EMS.Control.OverviewMap=OpenLayers.Class(OpenLayers.Control,{EVENT_TYPES:["minimize","maximize"],id:"OverviewMap",element:null,events:null,ovmap:null,size:new OpenLayers.Size(145,93),layers:null,minRatio:9,maxRatio:9,mapOptions:null,initialize:function(a){this.layers=a.layers;OpenLayers.Control.prototype.initialize.apply(this,[a]);this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES)},destroy:function(){if(this.mapDiv){this.mapDiv.removeChild(this.extentRectangle);this.extentRectangle=null;
this.rectEvents.destroy();this.ovmap=this.rectEvents=null;this.element.removeChild(this.mapDiv);this.mapDiv=null;this.mapDivEvents.destroy();this.mapDivEvents=null;this.div.removeChild(this.element);this.element=null;this.elementEvents.destroy();this.elementEvents=null;if(this.maximizeDiv){OpenLayers.Event.stopObservingElement(this.maximizeDiv);this.div.removeChild(this.maximizeDiv);this.maximizeDiv=null}if(this.minimizeDiv){OpenLayers.Event.stopObservingElement(this.minimizeDiv);this.div.removeChild(this.minimizeDiv);
this.minimizeDiv=null}this.map.events.unregister("moveend",this,this.update);this.map.events.unregister("changebaselayer",this,this.baseLayerDraw);this.events.destroy();OpenLayers.Control.prototype.destroy.apply(this,arguments)}},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!(this.layers.length>0))if(this.map.baseLayer)this.layers=[this.map.baseLayer.clone()];else{this.map.events.register("changebaselayer",this,this.baseLayerDraw);return this.div}this.element=document.createElement("div");
this.element.className=this.displayClass+"Element";this.element.style.display="none";this.element.style.bottom="0px";this.element.style.right="145px";this.cornersDivTop=this.createCorner("Top",145,4,0,0,"frame-top.gif");this.cornersDivBottom=this.createCorner("Bottom",145,4,89,0,"frame-bottom.gif");this.cornersDivLeft=this.createCorner("Left",4,85,4,0,"frame-left.gif");this.cornersDivRight=this.createCorner("Right",1,93,0,145,"frame-right.gif");this.australiaDiv=document.createElement("div");this.australiaDiv.style.width=
this.size.w+"px";this.australiaDiv.style.height=this.size.h+"px";this.australiaDiv.style.left="0px";this.australiaDiv.style.top="0px";this.australiaDiv.style.position="absolute";this.australiaDiv.style.overflow="hidden";this.australiaDiv.style.backgroundImage="url('"+EMS.Util.getImagesLocation()+"australia.gif')";this.australiaDiv.id=OpenLayers.Util.createUniqueID("australiaOverview");this.australiaDiv.style.display="none";this.mapDiv=document.createElement("div");this.mapDiv.style.width=this.size.w+
"px";this.mapDiv.style.height=this.size.h+"px";this.mapDiv.style.position="relative";this.mapDiv.style.overflow="hidden";this.mapDiv.id=OpenLayers.Util.createUniqueID("overviewMap");this.extentRectangle=document.createElement("div");this.extentRectangle.style.position="absolute";this.extentRectangle.style.zIndex=1E3;this.extentRectangle.style.overflow="hidden";this.extentRectangle.className=this.displayClass+"ExtentRectangle";this.mapDiv.appendChild(this.extentRectangle);this.element.appendChild(this.mapDiv);
this.element.appendChild(this.australiaDiv);this.element.appendChild(this.cornersDivTop);this.element.appendChild(this.cornersDivBottom);this.element.appendChild(this.cornersDivLeft);this.element.appendChild(this.cornersDivRight);this.div.appendChild(this.element);this.elementEvents=new OpenLayers.Events(this,this.element);this.elementEvents.register("mousedown",this,function(c){OpenLayers.Event.stop(c)});this.elementEvents.register("click",this,function(c){OpenLayers.Event.stop(c)});this.elementEvents.register("dblclick",
this,function(c){OpenLayers.Event.stop(c)});this.rectEvents=new OpenLayers.Events(this,this.extentRectangle,null,true);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(c){OpenLayers.Event.stop(c)});this.rectEvents.register("dblclick",
this,this.rectDblClick);this.mapDivEvents=new OpenLayers.Events(this,this.mapDiv);this.mapDivEvents.register("click",this,this.mapDivClick);if(this.outsideViewport)this.element.style.display="";else{this.div.className=this.displayClass+"Container";var a=EMS.Util.getImagesLocation(),b=a+"tab_out.gif";this.maximizeDiv=OpenLayers.Util.createAlphaImageDiv(this.displayClass+"MaximizeButton",null,new OpenLayers.Size(15,38),b,"absolute");this.maximizeDiv.style.display="none";this.maximizeDiv.className=this.displayClass+
"MaximizeButton";OpenLayers.Event.observe(this.maximizeDiv,"click",this.maximizeControl.bindAsEventListener(this));OpenLayers.Event.observe(this.maximizeDiv,"dblclick",function(c){OpenLayers.Event.stop(c)});this.div.appendChild(this.maximizeDiv);this.addHover(this.maximizeDiv,"tab_out_over.gif","tab_out.gif");b=a+"tab_in.gif";this.minimizeDiv=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_minimizeDiv",null,new OpenLayers.Size(15,38),b,"absolute");this.minimizeDiv.style.zIndex="3000";this.minimizeDiv.style.display=
"none";this.minimizeDiv.className=this.displayClass+"MinimizeButton";OpenLayers.Event.observe(this.minimizeDiv,"click",this.minimizeControl.bindAsEventListener(this));OpenLayers.Event.observe(this.minimizeDiv,"dblclick",function(c){OpenLayers.Event.stop(c)});this.div.appendChild(this.minimizeDiv);this.addHover(this.minimizeDiv,"tab_in_over.gif","tab_in.gif");this.minimizeControl()}this.map.getExtent()&&this.update();this.map.events.register("moveend",this,this.update);return this.div},addHover:function(a,
b,c){var d=function(e,f){for(;e;){if(e==f)return true;e=e.parentNode}return false};OpenLayers.Event.observe(a,"mouseover",function(){if(!a.isOver){if(navigator.appVersion.indexOf("MSIE 6.")!=-1){a.appendChild(OpenLayers.Util.createImage(null,null,null,EMS.Util.getImagesLocation()+b));a.childNodes[1].style.top="0px";a.childNodes[1].style.left="0px";a.childNodes[1].style.position="absolute";a.childNodes[1].style.marginLeft="0px";a.childNodes[1].style.marginTop="0px"}else a.childNodes[0].src=EMS.Util.getImagesLocation()+
b;a.isOver=true}});OpenLayers.Event.observe(a,"mouseout",function(e){if(!(e.relatedTarget==this||d(e.relatedTarget,a))){if(navigator.appVersion.indexOf("MSIE 6.")!=-1)a.removeChild(a.childNodes[1]);else a.childNodes[0].src=EMS.Util.getImagesLocation()+c;a.isOver=false}})},createCorner:function(a,b,c,d,e,f){var g;g=document.createElement("div");g.id=OpenLayers.Util.createUniqueID("cornersOverview"+a);g.style.width=b+"px";g.style.height=c+"px";g.style.left=e+"px";g.style.top=d+"px";g.style.position=
"absolute";g.style.overflow="hidden";g.style.backgroundImage="url('"+EMS.Util.getImagesLocation()+f+"')";g.style.zIndex=1E3;return g},baseLayerDraw:function(){this.draw();this.map.events.unregister("changebaselayer",this,this.baseLayerDraw)},rectMouseOver:function(){},rectMouseOut:function(a){if(this.rectDragStart!=null){if(this.performedRectDrag){this.rectMouseMove(a);a=this.getRectPxBounds();if(a.top<=0||a.left<=0||a.bottom>=this.size.h-this.hComp||a.right>=this.size.w-this.wComp)this.updateMapToRect();
else return}this.rectDragStart=null}},rectMouseDown:function(a){if(OpenLayers.Event.isLeftClick(a)){this.rectDragStart=a.xy.clone();this.performedRectDrag=false;document.onselectstart=function(){return false};OpenLayers.Event.stop(a)}},rectMouseMove:function(a){if(this.rectDragStart!=null){var b=this.rectDragStart.x-a.xy.x,c=this.rectDragStart.y-a.xy.y,d=this.getRectPxBounds(),e=d.top,f=d.left,g=Math.abs(d.getHeight());d=d.getWidth();c=Math.max(0,e-c);c=Math.min(c,this.ovmap.size.h-this.hComp-g);
b=Math.max(0,f-b);b=Math.min(b,this.ovmap.size.w-this.wComp-d);this.setRectPxBounds(new OpenLayers.Bounds(b,c+g,b+d,c));this.rectDragStart=a.xy.clone();this.performedRectDrag=true;OpenLayers.Event.stop(a);this.extentRectangle.style.cursor="url('"+EMS.Util.getImagesLocation()+"grabbing.cur'), move"}else this.extentRectangle.style.cursor="url('"+EMS.Util.getImagesLocation()+"grab.cur'), move"},rectMouseUp:function(a){if(OpenLayers.Event.isLeftClick(a)){if(this.performedRectDrag){this.updateMapToRect();
OpenLayers.Event.stop(a)}this.rectDragStart=document.onselectstart=null}},rectDblClick:function(a){this.performedRectDrag=false;OpenLayers.Event.stop(a);this.updateOverview()},mapDivClick:function(a){var b=this.getRectPxBounds(),c=b.getCenterPixel(),d=a.xy.x-c.x,e=a.xy.y-c.y,f=b.top,g=b.left;c=Math.abs(b.getHeight());b=b.getWidth();e=Math.max(0,f+e);e=Math.min(e,this.ovmap.size.h-c);d=Math.max(0,g+d);d=Math.min(d,this.ovmap.size.w-b);this.setRectPxBounds(new OpenLayers.Bounds(d,e+c,d+b,e));this.updateMapToRect();
OpenLayers.Event.stop(a)},maximizeControl:function(a){this.element.style.display="";this.showToggle(false);a!=null&&OpenLayers.Event.stop(a);this.events.triggerEvent("maximize")},minimizeControl:function(a){this.element.style.display="none";this.showToggle(true);a!=null&&OpenLayers.Event.stop(a);this.events.triggerEvent("minimize")},showToggle:function(a){this.maximizeDiv.style.display=a?"":"none";this.minimizeDiv.style.display=a?"none":""},update:function(){this.ovmap==null&&this.createMap();this.updateOverview();
this.updateRectToMap()},isSuitableOverview:function(){var a=this.map.getExtent(),b=this.map.maxExtent;a=new OpenLayers.Bounds(Math.max(a.left,b.left),Math.max(a.bottom,b.bottom),Math.min(a.right,b.right),Math.min(a.top,b.top));b=this.ovmap.getResolution()/this.map.getResolution();return b>this.minRatio&&b<=this.maxRatio&&this.ovmap.getExtent().containsBounds(a)},updateOverview:function(){if(!(this.map.getResolution()>0.0125)){this.australiaDiv.style.display="none";this.mapDiv.style.display="block"}var a=
this.map.getResolution(),b=this.ovmap.getResolution(),c=b/a;if(c>this.maxRatio)b=this.minRatio*a;else if(c<=this.minRatio)b=this.maxRatio*a;a=this.ovmap.getZoomForResolution(b);if(a<1)a=1;this.ovmap.setCenter(this.map.center,a);this.updateRectToMap()},createMap:function(){var a=OpenLayers.Util.extend({controls:[],buffer:0},this.mapOptions);this.ovmap=new OpenLayers.Map(this.mapDiv,a);this.ovmap.addLayers(this.layers);this.ovmap.zoomToMaxExtent();this.wComp=(this.wComp=parseInt(OpenLayers.Element.getStyle(this.extentRectangle,
"border-left-width"))+parseInt(OpenLayers.Element.getStyle(this.extentRectangle,"border-right-width")))?this.wComp:2;this.hComp=(this.hComp=parseInt(OpenLayers.Element.getStyle(this.extentRectangle,"border-top-width"))+parseInt(OpenLayers.Element.getStyle(this.extentRectangle,"border-bottom-width")))?this.hComp:2},updateRectToMap:function(){this.map.units!="degrees"&&this.ovmap.getProjection()&&this.map.getProjection()!=this.ovmap.getProjection()&&alert("The overview map only works when it is in the same projection as the main map");
var a=this.getRectBoundsFromMapBounds(this.map.getExtent());a&&this.setRectPxBounds(a)},updateMapToRect:function(){this.map.setCenter(this.getMapBoundsFromRectBounds(this.getRectPxBounds()).getCenterLonLat(),this.map.zoom)},getRectPxBounds:function(){var a=parseInt(this.extentRectangle.style.top),b=parseInt(this.extentRectangle.style.left),c=parseInt(this.extentRectangle.style.height),d=parseInt(this.extentRectangle.style.width);return new OpenLayers.Bounds(b,a+c,b+d,a)},setRectPxBounds:function(a){var b=
Math.max(a.top,0),c=Math.max(a.left,0),d=Math.min(a.top+Math.abs(a.getHeight()),this.ovmap.size.h-this.hComp);a=Math.min(a.left+a.getWidth(),this.ovmap.size.w-this.wComp);this.extentRectangle.style.top=parseInt(b)+"px";this.extentRectangle.style.left=parseInt(c)+"px";this.extentRectangle.style.height=parseInt(Math.max(d-b,0))+"px";this.extentRectangle.style.width=parseInt(Math.max(a-c,0))+"px"},getRectBoundsFromMapBounds:function(a){var b=new OpenLayers.LonLat(a.left,a.bottom);a=new OpenLayers.LonLat(a.right,
a.top);b=this.getOverviewPxFromLonLat(b);a=this.getOverviewPxFromLonLat(a);var c=null;if(b&&a)c=new OpenLayers.Bounds(b.x,b.y,a.x,a.y);return c},getMapBoundsFromRectBounds:function(a){var b=new OpenLayers.Pixel(a.left,a.bottom);a=new OpenLayers.Pixel(a.right,a.top);b=this.getLonLatFromOverviewPx(b);a=this.getLonLatFromOverviewPx(a);return new OpenLayers.Bounds(b.lon,b.lat,a.lon,a.lat)},getLonLatFromOverviewPx:function(a){var b=this.ovmap.size,c=this.ovmap.getResolution(),d=this.ovmap.getExtent().getCenterLonLat();
return new OpenLayers.LonLat(d.lon+(a.x-b.w/2)*c,d.lat-(a.y-b.h/2)*c)},getOverviewPxFromLonLat:function(a){var b=this.ovmap.getResolution(),c=this.ovmap.getExtent(),d=null;if(c)d=new OpenLayers.Pixel(Math.round(1/b*(a.lon-c.left)),Math.round(1/b*(c.top-a.lat)));return d},CLASS_NAME:"EMS.Control.OverviewMap"});
EMS.Control.NorthArrow=OpenLayers.Class(OpenLayers.Control,{element:null,initialize:function(){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=this.displayClass;var a=OpenLayers.Util.createAlphaImageDiv(null,null,new OpenLayers.Size(11,18),EMS.Util.getImagesLocation()+"north_arrow.png");a.style.position="relative";this.element=this.div;this.element.appendChild(a)}return this.div},
CLASS_NAME:"EMS.Control.NorthArrow"});
EMS.Control.Copyright=OpenLayers.Class(OpenLayers.Control,{element:null,smallCopyright:false,initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){OpenLayers.Control.prototype.destroy.apply(this,arguments);OpenLayers.Event.stopObservingElement(this.div)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.div.left="";this.div.top="";this.div.className=this.displayClass;var a=OpenLayers.Util.createAlphaImageDiv(null,
null,new OpenLayers.Size(70,22),EMS.Util.getImagesLocation()+"whereis-footprint.png");a.style.position="relative";OpenLayers.Event.observe(a,"click",function(c){var d=(new OpenLayers.LonLat(this.map.center.lon,this.map.center.lat)).asWGS84();window.open("http://www.whereis.com/?y="+d.lat+"&x="+d.lon+"&z="+this.map.zoom,"_blank");OpenLayers.Event.stop(c)}.bindAsEventListener(this));OpenLayers.Event.observe(a,"mouseover",function(){a.style.cursor="pointer"});var b=this.smallCopyright?OpenLayers.Util.createAlphaImageDiv(null,
null,new OpenLayers.Size(46,22),EMS.Util.getImagesLocation()+"legals_sml.png"):OpenLayers.Util.createAlphaImageDiv(null,null,new OpenLayers.Size(80,22),EMS.Util.getImagesLocation()+"legals.png");b.style.position="absolute";b.style.top="0px";b.style.left="70px";OpenLayers.Event.observe(b,"click",function(c){window.open("http://www.whereis.com/products/terms-of-use/index.html","_blank");OpenLayers.Event.stop(c)});OpenLayers.Event.observe(b,"mouseover",function(){b.style.cursor="pointer"});this.element=
this.div;this.element.appendChild(a);this.element.appendChild(b)}return this.div},CLASS_NAME:"EMS.Control.Copyright"});
EMS.Control.Scale=OpenLayers.Class(OpenLayers.Control,{element:null,bottom:null,initialize:function(a,b){OpenLayers.Control.prototype.initialize.apply(this,[b]);this.element=OpenLayers.Util.getElement(a)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.element=document.createElement("div");this.div.className=this.displayClass;if(this.bottom!=undefined)this.div.style.bottom=this.bottom;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(){function a(f){return Math.log(f)/Math.LN10}function b(f){return Math.pow(10,Math.floor(a(f)+1.0E-7))}if(this.map)if(this.map.getExtent()){var c=Math.cos(EMS.Util.sgp4ToLat((this.map.getExtent().bottom+this.map.getExtent().top)/2)*Math.PI/180)*6378137*Math.PI*this.map.getExtent().getWidth()/180;if(c){var d=c/4;this.map.getSize();c=this.map.getSize().w/c;d=Math.round(d/b(d))*b(d);c=d*c;d=d<1E3?"&nbsp;"+d+"m":"&nbsp;"+
d/1E3+"km";var e;e=this.map.whereis_street_wms.getVisibility()?"black":"white";this.element.innerHTML="<div class='"+this.displayClass+"Text' style='width: "+c+"px ; color:"+e+"'>"+d+"</div>"}}},CLASS_NAME:"EMS.Control.Scale"});
EMS.MultiPopup=OpenLayers.Class(EMS.Popup,{events:null,EVENT_TYPES:["markerclick","hidden","shown"],history:[],initialize:function(a,b,c,d,e,f,g,j){this.mapId=OpenLayers.Util.createUniqueID(this.CLASS_NAME.replace(/\./g,"")+"_map");EMS.Popup.prototype.initialize.apply(this,[a,b,c,"",d,e]);this.locatables=f;this.locatableRenderer=g;OpenLayers.Util.extend(this,j||{});this.history=[];this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES,true)},markerCreator:function(a){var b;if(a.length==1){b=
EMS.Services.StandardIcons.greenPoi(this.map.tilePath,"");a=a[0].lonlat.clone()}else{b=EMS.Services.StandardIcons.greenMultipoi(this.map.tilePath,a.length);for(var c=new OpenLayers.Bounds(a[0].lonlat.lon,a[0].lonlat.lat,a[0].lonlat.lon,a[0].lonlat.lat),d=1;d<a.length;d++)c.extend(a[d].lonlat);a=c.getCenterLonLat()}return new OpenLayers.Marker(a,b)},markerReleaser:function(a){a.destroy()},draw:function(){var a=EMS.Popup.prototype.draw.apply(this,arguments);this.countDiv=OpenLayers.Util.createDiv(null);
this.countDiv.className="ems-multipoi-count";this.contentDiv.appendChild(this.countDiv);this.mapTab=this.createMapTab();this.listTab=this.createListTab();this.tabs=new EMS.MultiPopupTabs([this.mapTab,this.listTab]);this.showListFirst==true?this.tabs.showTab(this.listTab):this.tabs.showTab(this.mapTab);return a},createMapTab:function(){var a=OpenLayers.Util.createDiv(null,new OpenLayers.Pixel(5,32),new OpenLayers.Size(this.size.w-15,this.size.h-70),null,"absolute");this.tab1ContentsDiv=a;a.style.borderTop=
"1px solid #58a2d1";var b=this.createImageDiv("multi-tab.gif",0,0,45,32,90,96,140,1),c=this.createImageDiv("multi-tab.gif",0,32,45,32,90,96,140,1),d=this.createImageDiv("multi-tab.gif",0,64,45,32,90,96,140,1),e=new EMS.MultiPopupTab(b,c,d,a);this.contentDiv.appendChild(a);this.contentDiv.appendChild(b);this.contentDiv.appendChild(c);this.contentDiv.appendChild(d);this.mapDiv=OpenLayers.Util.createDiv(this.mapId,null,null);this.mapDiv.style.width=this.size.w-15+"px";this.mapDiv.style.height=this.size.h-
70+"px";this.tab1ContentsDiv.appendChild(this.mapDiv);a=this.getExtent(this.locatables,this.mapDiv);b=(new EMS.Util.ZoomCalculator(EMS.Util.defaultResolutions,this.mapDiv)).getZoomForExtent(a);this.multimap=new EMS.Services.Map(this.mapDiv,{onInit:OpenLayers.Function.bind(this.mapInit,this),controls:[],layers:[],noping:true,zoom:b,center:a.getCenterLonLat()});this.historyDiv=OpenLayers.Util.createDiv(null,new OpenLayers.Pixel(0,this.size.h-30));this.historyDiv.className="ems-history";a=document.createElement("a");
a.className="ems-top-back";a.href="#";this.historyDiv.appendChild(a);this.historyDiv.appendChild(document.createTextNode("  "));b=document.createElement("a");b.href="#";b.className="ems-back";b.appendChild(document.createTextNode("Back"));this.historyDiv.appendChild(b);this.historyDiv.style.top=this.size.h-65+"px";this.tab1ContentsDiv.appendChild(this.historyDiv);OpenLayers.Event.observe(b,"click",OpenLayers.Function.bind(this.backInHistory,this));OpenLayers.Event.observe(a,"click",OpenLayers.Function.bind(this.backInHistoryToTop,
this));return e},createListTab:function(){var a=OpenLayers.Util.createDiv(null,new OpenLayers.Pixel(5,32),new OpenLayers.Size(this.size.w-15,this.size.h-47),null,"absolute");this.tab2ContentsDiv=a;this.tab2ContentsDiv.style.overflow="auto";a.style.borderTop="1px solid #58a2d1";var b=this.createImageDiv("multi-tab.gif",45,0,45,32,90,96,186,1),c=this.createImageDiv("multi-tab.gif",45,32,45,32,90,96,186,1),d=this.createImageDiv("multi-tab.gif",45,64,45,32,90,96,186,1),e=new EMS.MultiPopupTab(b,c,d,a);
this.contentDiv.appendChild(a);this.contentDiv.appendChild(b);this.contentDiv.appendChild(c);this.contentDiv.appendChild(d);return e},createImageDiv:function(a,b,c,d,e,f,g,j,h){d=OpenLayers.Util.createDiv(null,new OpenLayers.Pixel(j,h),new OpenLayers.Size(d,e),null,"absolute");d.style.overflow="hidden";a=OpenLayers.Util.createImage(null,new OpenLayers.Pixel(-b,-c),new OpenLayers.Size(f,g),EMS.Util.getImagesLocation()+a);d.appendChild(a);return d},mapInit:function(a){this.map=a;var b=new OpenLayers.Layer.Markers("Markers"),
c=new EMS.IndexedLayer("Whereis Street",this.map.tilePath+"/tile?",{layers:"street",format:"image/gif",cache:"TRUE",version:"1.0.2"},{displayOutsideMaxExtent:true,visible:true});a.markersLayer=b;a.whereis_street_wms=c;a.addLayer(a.whereis_street_wms);a.addLayer(a.markersLayer);b=new EMS.CombinerCalculator(a.getResolution(),this.locatables);this.history.push(this.locatables);this.updateHistoryLinks();b=b.calculateCombined();c=this.getExtent(this.locatables,this.mapDiv);var d=(new EMS.Util.ZoomCalculator(EMS.Util.defaultResolutions,
this.mapDiv)).getZoomForExtent(c);a.setCenter(c.getCenterLonLat(),d);for(c=0;c<b.length;c++){d=b[c];var e=this.markerCreator(d.combined);e.lonlat.lon=d.lonlat.lon;e.lonlat.lat=d.lonlat.lat;a.markersLayer.addMarker(e);d.combined.length>1?e.events.register("click",this,OpenLayers.Function.bind(this.zoomMarker,this,d.combined,a)):e.events.register("click",this,OpenLayers.Function.bind(this.zoomToMarker,this,d.combined))}for(c=0;c<this.locatables.length;c++)this.tab2ContentsDiv.appendChild(this.locatableRenderer(this.locatables[c]));
this.countDiv.innerHTML="<img src='"+EMS.Services.StandardIcons.redNumber(this.map.tilePath,this.locatables.length).url+"'/><span style='display: block; margin-left: 2em; margin-top: -1.7em;'> place"+(this.locatables.length==1?"":"s")+"</span>"},zoomMarker:function(a,b){for(var c=this.getExtent(a,this.mapDiv),d=b.getZoomForExtent(c),e=true,f=0;f<a.length;f++)if(f==0)var g=a[0].lonlat;else g.equals(a[f].lonlat)||(e=false);if(b.getZoom()==d||e)this.tabs.showTab(this.listTab);b.setCenter(c.getCenterLonLat(),
d);f=this.history.length==0?-1:this.history[this.history.length-1].length;if(b.getZoom()!=d||f!=a.length){this.history.push(a);this.tab2ContentsDiv.innerHTML="";d=(new EMS.CombinerCalculator(b.getResolution(),a)).calculateCombined();this.destroyMarkersOnMap(b);for(f=0;f<d.length;f++){c=this.markerCreator(d[f].combined);c.lonlat.lon=d[f].lonlat.lon;c.lonlat.lat=d[f].lonlat.lat;b.markersLayer.addMarker(c);d[f].combined.length>1?c.events.register("click",this,OpenLayers.Function.bind(this.zoomMarker,
this,d[f].combined,b)):c.events.register("click",this,OpenLayers.Function.bind(this.zoomToMarker,this,c))}for(f=0;f<a.length;f++)this.tab2ContentsDiv.appendChild(this.locatableRenderer(a[f]));this.updateHistoryLinks();this.countDiv.innerHTML="<img src='"+EMS.Services.StandardIcons.redNumber(this.map.tilePath,a.length).url+"'/><span style='display: block; margin-left: 2em; margin-top: -1.7em;'> place"+(a.length==1?"":"s")+"</span>"}},backInHistory:function(){var a=this.history.pop();a=this.history.pop();
console.assert(a,"Locatables present");this.zoomMarker(a,this.multimap)},backInHistoryToTop:function(){var a=this.history[0];this.history=[];console.assert(a,"Locatables present");this.zoomMarker(a,this.multimap)},updateHistoryLinks:function(){this.historyDiv.style.display=this.history.length>1?"block":"none"},destroyMarkersOnMap:function(a){for(var b=a.markersLayer.markers;b.length>0;){var c=b[0];a.markersLayer.removeMarker(c);this.markerReleaser(c)}},zoomToMarker:function(a){console.assert(a,"marker present");
this.events.triggerEvent("markerclick",{marker:a,popup:this})},destroy:function(){this.destroyMarkersOnMap();this.events.destroy();if(this.multimap){this.multimap.destroy();this.multimap=null}},getExtent:function(a,b){var c=EMS.Util.defaultResolutions;b=new EMS.Util.ZoomCalculator(c,b);for(var d,e=0;e<a.length;e++)if(e==0)d=new OpenLayers.Bounds(a[e].lonlat.lon,a[e].lonlat.lat,a[e].lonlat.lon,a[e].lonlat.lat);else d.extend(new OpenLayers.LonLat(a[e].lonlat.lon,a[e].lonlat.lat));a=b.getZoomForExtent(d);
c=c[a];d.extend(new OpenLayers.LonLat(d.left,d.top+c*66));d.extend(new OpenLayers.LonLat(d.left-c*15,d.top));d.extend(new OpenLayers.LonLat(d.right+c*15,d.top));return d},CLASS_NAME:"EMS.MultiPopup"});
EMS.MultiPopupTabs=OpenLayers.Class({initialize:function(a){this.tabs=a;for(var b=0;b<a.length;b++){OpenLayers.Event.observe(a[b].tabOffDiv,"click",OpenLayers.Function.bind(this.showTab,this,a[b]));OpenLayers.Event.observe(a[b].tabHoverDiv,"click",OpenLayers.Function.bind(this.showTab,this,a[b]))}},addTab:function(a){this.tabs.push(a);OpenLayers.Event.observe(a.tabOffDiv,"click",OpenLayers.Function.bind(this.showTab,this,a));OpenLayers.Event.observe(a.tabHoverDiv,"click",OpenLayers.Function.bind(this.showTab,
this,a))},showTab:function(a){this.activeTab&&this.activeTab.hide();a.show();this.activeTab=a}});
EMS.MultiPopupTab=OpenLayers.Class({initialize:function(a,b,c,d){this.tabOnDiv=a;this.tabOffDiv=b;this.tabHoverDiv=c;this.contentDiv=d;OpenLayers.Event.observe(this.tabOffDiv,"mouseover",function(){OpenLayers.Element.hide(b);OpenLayers.Element.show(c)});OpenLayers.Event.observe(this.tabHoverDiv,"mouseout",function(){OpenLayers.Element.visible(a)?OpenLayers.Element.hide(b):OpenLayers.Element.show(b);OpenLayers.Element.hide(c)});this.hide()},show:function(){OpenLayers.Element.show(this.tabOnDiv);OpenLayers.Element.hide(this.tabOffDiv);
OpenLayers.Element.hide(this.tabHoverDiv);OpenLayers.Element.show(this.contentDiv)},hide:function(){OpenLayers.Element.hide(this.tabOnDiv);OpenLayers.Element.show(this.tabOffDiv);OpenLayers.Element.hide(this.tabHoverDiv);OpenLayers.Element.hide(this.contentDiv)}});
EMS.CombinerCalculator=OpenLayers.Class({combinePixels:40,initialize:function(a,b,c){this.resolution=a;this.locatableObjects=[].concat(b);this.locatableObjects.sort(function(d,e){return e.lonlat.lon-d.lonlat.lon});c=c||{};OpenLayers.Util.extend(this,c)},calculateCombined:function(){for(var a=[],b=0;b<this.locatableObjects.length;b++){var c=this.locatableObjects[b];if(!c.combined){var d=new OpenLayers.Bounds(c.lonlat.lon,c.lonlat.lat,c.lonlat.lon,c.lonlat.lat),e=[c];c.combined=true;var f,g;for(g=b+
1;g<this.locatableObjects.length;g++){f=this.testForCloseness(c,this.locatableObjects[g],d);if(f=="combine"){d.extend(this.locatableObjects[g].lonlat);this.locatableObjects[g].combined=true;e.push(this.locatableObjects[g])}else if(f=="break")break}for(g=b-1;g>=0;g--){f=this.testForCloseness(c,this.locatableObjects[g],d);if(f=="combine"){d.extend(this.locatableObjects[g].lonlat);this.locatableObjects[g].combined=true;e.push(this.locatableObjects[g])}else if(f=="break")break}a.push({lonlat:d.getCenterLonLat(),
combined:e})}}for(b=0;b<this.locatableObjects.length;b++)delete this.locatableObjects[b].combined;return a},testForCloseness:function(a,b,c){if(Math.abs((b.lonlat.lon-a.lonlat.lon)/this.resolution)>this.combinePixels)return"break";if(a!=b&&!b.combined){a=Math.abs(c.getCenterLonLat().lon-b.lonlat.lon)/this.resolution;b=Math.abs(c.getCenterLonLat().lat-b.lonlat.lat)/this.resolution;if(a<this.combinePixels&&b<this.combinePixels)return"combine"}return"nomatch"}});
EMS.MarkerProximityCombiner=OpenLayers.Class({combinePixels:40,groups:null,multigroupIconFactory:function(a){return EMS.Services.StandardIcons.babushka(this.map.tilePath,a.length)},initialize:function(a,b,c){this.map=a;this.groups=b;c=c||{};OpenLayers.Util.extend(this,c);a=this._markerIterator();for(b=null;b=a();)b.combined=null},getMarkers:function(){this.markers||this._calculateMarkers();return this.markers},destroy:function(){this.groups=this.map=null},_calculateMarkers:function(){this.markers=
[];for(var a=[],b=0;b<this.groups.length;b++)a=a.concat(this.groups[b].markers);a.sort(function(k,m){return m.lonlat.lon-k.lonlat.lon});var c,d,e=0;for(b=0;b<a.length;b++){c=a[b];if(this._markerVisible(c)){if(!c.combined){var f=[this._copyMarker(c)],g=new OpenLayers.Bounds(c.lonlat.lon,c.lonlat.lat,c.lonlat.lon,c.lonlat.lat);function j(k){if(!this._markerVisible(k))return true;if(Math.abs((k.lonlat.lon-c.lonlat.lon)/this.map.getResolution())>this.combinePixels)return false;if(c!=k&&!k.combined){var m=
Math.abs(g.getCenterLonLat().lon-k.lonlat.lon)/this.map.getResolution(),p=Math.abs(g.getCenterLonLat().lat-k.lonlat.lat)/this.map.getResolution();if(m<this.combinePixels&&p<this.combinePixels){f.push(this._copyMarker(k));k.combined=true;g.extend(k.lonlat)}}return true}for(var h=b+1;h<a.length;h++){d=a[h];if(!OpenLayers.Function.bind(j,this)(d))break}for(h=b-1;h>=0;h--){d=a[h];if(!OpenLayers.Function.bind(j,this)(d))break}c.combined=true;f.length==1?this.markers.push(this._copyMarker(c)):this.markers.push(this._makeCombinedMarker(f,
g))}e++}}},_makeCombinedMarker:function(a,b){for(var c=null,d=false,e=0;e<a.length;e++){if(c!=null&&a[e].group.name!=c)d=true;c=a[e].group.name}c=d?this.multigroupIconFactory(a):a[0].group.iconFactory(a);d=b.getCenterLonLat();c=new OpenLayers.Marker(d,c);c.combinedMarkers=a;c.combinedBounds=b;return c},_copyMarker:function(a){var b=new OpenLayers.Marker(a.lonlat.clone(),a.icon.clone());b.group=a.group;return b},_markerVisible:function(a){if(a.icon.div){if(OpenLayers.Element.visible(a.icon.div))return true}else if(a.icon.imageDiv)if(OpenLayers.Element.visible(a.icon.imageDiv))return true;
return false},_markerIterator:function(){var a=0,b=0,c=this.groups;return function(){for(;;)if(a<c.length){var d=c[a].markers[b++];if(d)if(d.icon.div){if(OpenLayers.Element.visible(d.icon.div))return d}else{if(d.icon.imageDiv)if(OpenLayers.Element.visible(d.icon.imageDiv))return d}else{a++;b=0}}else return null}}});EMS.MarkerGroup=OpenLayers.Class({markers:null,name:"",iconFactory:null,initialize:function(a,b){this.name=a;this.iconFactory=b;this.markers=[]},addMarker:function(a){a.group=this;this.markers.push(a)}});
EMS.PixelBounds=OpenLayers.Class({left:null,bottom:null,right:null,top:null,initialize:function(a,b,c,d){if(a!=null)this.left=a;if(b!=null)this.bottom=b;if(c!=null)this.top=c;if(d!=null)this.right=d},extend:function(a){if(a.CLASS_NAME=="EMS.PixelBounds"){if(this.left==null)this.left=a.left;else if(a.left!=null&&a.left<this.left)this.left=a.left;if(this.right==null)this.right=a.right;else if(a.right!=null&&a.right>this.right)this.right=a.right;if(this.bottom==null)this.bottom=a.bottom;else if(a.bottom!=
null&&a.bottom>this.bottom)this.bottom=a.bottom;if(this.top==null)this.top=a.top;else if(a.top!=null&&a.top<this.top)this.top=a.top}else if(a.CLASS_NAME=="OpenLayers.Pixel"){if(this.left==null)this.left=a.x;else if(a.x<this.left)this.left=a.x;if(this.right==null)this.right=a.x;else if(a.x>this.right)this.right=a.x;if(this.bottom==null)this.bottom=a.y;else if(a.y>this.bottom)this.bottom=a.y;if(this.top==null)this.top=a.y;else if(a.y<this.top)this.top=a.y}else throw new Error("invalid pixelable type");
},center:function(){return[Math.round((this.right+this.left)/2),Math.round((this.bottom+this.top)/2)]},width:function(){if(this.right!=null&&this.left!=null)return this.right-this.left;return 0},height:function(){if(this.bottom!=null&&this.top!=null)return this.bottom-this.top;return 0},CLASS_NAME:"EMS.PixelBounds"});
EMS.VectorMarker=OpenLayers.Class(OpenLayers.Marker,{defaultOptions:{width:150,fontStyle:"font-family:Verdana;font-size:16px",lineHeight:18,height:28,pointDrop:8,mouseOver:function(){this.childNodes[2].setAttribute("fill","#81BFE8");this.childNodes[3].setAttribute("fill","#2478C0")},mouseOut:function(){this.childNodes[2].setAttribute("fill","url(#gradient)");this.childNodes[3].setAttribute("fill","#fff")},opacity:1,click:null,curveRadius:7},div:null,label:null,offset:0,popupOffset:null,slidePx:0,
options:{},initialize:function(a,b,c,d){this.lonlat=a;this.label=b;d=d?d:{};this.options=OpenLayers.Util.extend(this.defaultOptions,d);a=this.options.height+this.options.pointDrop;b=this.options.width;if(c){d=Math.round(b/2-this.options.curveRadius-6);this.slidePx=c>d?d:c<0-d?0-d:c}c=-b/2+this.slidePx;this.icon={};this.icon.imageDiv=this.generateMarkup();this.div=this.icon.imageDiv;this.events=new OpenLayers.Events(this,this.div,null);this.popupOffset={size:new OpenLayers.Size(b,a),offset:new OpenLayers.Pixel(c,
a)};if(this.options.mouseOver!=null)this.div.onmouseover=this.options.mouseOver;if(this.options.mouseOut!=null)this.div.onmouseout=this.options.mouseOut;if(this.options.click!=null)this.div.onclick=this.options.click},draw:function(a){a=this.setOffset(a);this.div.setAttribute("transform","translate("+a.x+","+a.y+")");return this.div},destroy:function(){this.map=null;this.events.destroy();this.events=null;if(this.icon!=null){this.icon.imageDiv.parentNode.removeChild(this.icon.imageDiv);this.icon=null}},
generateMarkup:function(){var a=!!document.createElement("canvas").getContext;if(document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#SVG","1.1")||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")))return this.generateSVG();else a||alert("Unsupported browser type for VectorMarker")},generateCanvas:function(){},generateSVG:function(){var a=this.slidePx,b=
this.options.pointDrop,c=this.options.height,d=this.options.width,e=this.options.curveRadius,f=document.createElementNS("http://www.w3.org/2000/svg","g");f.setAttribute("opacity",this.options.opacity);this.path1=document.createElementNS("http://www.w3.org/2000/svg","path");this.path1.setAttribute("fill","url(#outerColor)");this.path1.setAttribute("d",this.createPath(0,c,0,d,e,b,a));this.path2=document.createElementNS("http://www.w3.org/2000/svg","path");this.path2.setAttribute("fill","url(#innerColor");
this.path2.setAttribute("d",this.createPath(1,c-1,1,d-1,e-1,b-1,a));this.path3=document.createElementNS("http://www.w3.org/2000/svg","path");this.path3.setAttribute("fill","url(#gradient)");this.path3.setAttribute("d",this.createPath(2,c-2,2,d-2,e-2,b-2,a));this.labelDiv=document.createElementNS("http://www.w3.org/2000/svg","text");this.labelDiv.setAttribute("x",d-(d-0)/2);this.labelDiv.setAttribute("y",this.options.height/2);this.labelDiv.setAttribute("width",this.options.width-4);this.labelDiv.setAttribute("fill",
"#ffffff");this.labelDiv.setAttribute("style","text-anchor:middle;dominant-baseline:central;"+this.options.fontStyle);a=this.label.split("\\n");b=a.length;if(b!=0)if(b==1)this.labelDiv.appendChild(document.createTextNode(this.label));else{c=this.options.height/2-b*this.options.lineHeight/2+this.options.lineHeight/2;for(d=0;d<b;d++){e=c+d*this.options.lineHeight;var g=document.createElementNS("http://www.w3.org/2000/svg","tspan");g.setAttribute("y",e);g.setAttribute("x",this.options.width/2);g.appendChild(document.createTextNode(a[d]));
this.labelDiv.appendChild(g)}}f.appendChild(this.path1);f.appendChild(this.path2);f.appendChild(this.path3);f.appendChild(this.labelDiv);return f},getPixelBounds:function(a){var b=Math.round(1/a*this.lonlat.lon);a=Math.round(1/a*this.lonlat.lat);var c=new EMS.PixelBounds;c.extend(new OpenLayers.Pixel(b-75+this.slidePx,a-47));c.extend(new OpenLayers.Pixel(b+75+this.slidePx,a));return c},createPath:function(a,b,c,d,e,f,g){g=d-(d-c)/2+g;var j=c+e,h=d-e,k=a+e,m=b-e;e=e*4/7;return"M"+h+" "+a+" C"+(h+e)+
" "+a+" "+d+" "+(k-e)+" "+d+" "+k+" L"+d+" "+m+" C"+d+" "+(m+e)+" "+(h+e)+" "+b+" "+h+" "+b+" L"+(g+5)+" "+b+" L"+g+" "+(b+f)+" L"+(g-5)+" "+b+" L"+j+" "+b+" C"+(j-e)+" "+b+" "+c+" "+(m+e)+" "+c+" "+m+" L"+c+" "+k+" C"+c+" "+(k-e)+" "+(j-e)+" "+a+" "+j+" "+a+"  Z"},setOffset:function(a){var b=a.x-Math.round(this.options.width/2+this.slidePx);return new OpenLayers.Pixel(b,a.y-this.options.height-this.options.pointDrop)},CLASS_NAME:"EMS.VectorMarker"});
EMS.VectorMarkers=OpenLayers.Class(OpenLayers.Layer.Markers,{isVector:true,showError:true,svgFrame:null,options:{outerBorder:"#0870B3",innerBorder:"#81BFE8",gradientFrom:"#56A8DD",gradientTo:"#2A79BE"},initialize:function(a,b){var c=!!document.createElement("canvas").getContext,d=document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#SVG","1.1")||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure",
"1.1"));if(!c&&!d)return this.doErrror();this.addOptions(b);this.id=(this.name=a)?a:OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");this.div=OpenLayers.Util.createDiv();this.events=new OpenLayers.Events(this,this.div,this.EVENT_TYPES);this.div.id=this.id;this.div.style.width="100%";this.div.style.height="100%";this.div.style.display="block";if(d){this.svgFrame=this.createSVGFrame();this.div.appendChild(this.svgFrame)}this.markers=[]},createSVGFrame:function(){var a=document.createElementNS("http://www.w3.org/2000/svg",
"svg");a.setAttributeNS(null,"id",this.div.id+"_svgRoot");a.setAttributeNS(null,"width","100%");a.setAttributeNS(null,"height","100%");var b=document.createElementNS("http://www.w3.org/2000/svg","defs"),c=document.createElementNS("http://www.w3.org/2000/svg","linearGradient");c.setAttributeNS(null,"id","outerColor");c.setAttributeNS(null,"x1","0%");c.setAttributeNS(null,"y1","0%");c.setAttributeNS(null,"x2","0%");c.setAttributeNS(null,"y2","100%");var d=document.createElementNS("http://www.w3.org/2000/svg",
"stop");d.setAttributeNS(null,"offset","0%");d.setAttributeNS(null,"style","stop-color:"+this.options.outerBorder+";stop-opacity:1");var e=document.createElementNS("http://www.w3.org/2000/svg","stop");e.setAttributeNS(null,"offset","100%");e.setAttributeNS(null,"style","stop-color:"+this.options.outerBorder+";stop-opacity:1");c.appendChild(d);c.appendChild(e);b.appendChild(c);c=document.createElementNS("http://www.w3.org/2000/svg","linearGradient");c.setAttributeNS(null,"id","innerColor");c.setAttributeNS(null,
"x1","0%");c.setAttributeNS(null,"y1","0%");c.setAttributeNS(null,"x2","0%");c.setAttributeNS(null,"y2","100%");d=document.createElementNS("http://www.w3.org/2000/svg","stop");d.setAttributeNS(null,"offset","0%");d.setAttributeNS(null,"style","stop-color:"+this.options.innerBorder+";stop-opacity:1");e=document.createElementNS("http://www.w3.org/2000/svg","stop");e.setAttributeNS(null,"offset","100%");e.setAttributeNS(null,"style","stop-color:"+this.options.innerBorder+";stop-opacity:1");c.appendChild(d);
c.appendChild(e);b.appendChild(c);c=document.createElementNS("http://www.w3.org/2000/svg","filter");c.setAttributeNS(null,"id","shadowFilter");d=document.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");c.setAttributeNS(null,"in","SourceAlpha");c.setAttributeNS(null,"stdDeviation","2");c.setAttributeNS(null,"result","MyBlur");c.appendChild(d);b.appendChild(c);c=document.createElementNS("http://www.w3.org/2000/svg","linearGradient");c.setAttributeNS(null,"id","gradient");c.setAttributeNS(null,
"x1","0%");c.setAttributeNS(null,"y1","0%");c.setAttributeNS(null,"x2","0%");c.setAttributeNS(null,"y2","100%");d=document.createElementNS("http://www.w3.org/2000/svg","stop");d.setAttributeNS(null,"offset","0%");d.setAttributeNS(null,"style","stop-color:"+this.options.gradientFrom+";stop-opacity:1");e=document.createElementNS("http://www.w3.org/2000/svg","stop");e.setAttributeNS(null,"offset","100%");e.setAttributeNS(null,"style","stop-color:"+this.options.gradientTo+";stop-opacity:1");c.appendChild(d);
c.appendChild(e);b.appendChild(c);a.appendChild(b);return a},drawMarker:function(a){var b=this.map.getLayerPxFromLonLat(a.lonlat);if(b==null)a.display(false);else{b=a.draw(b);if(!a.drawn){this.svgFrame.appendChild(b);a.drawn=true}}},moveTo:function(a,b,c){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);if(!c){this.div.style.left=-parseInt(this.map.layerContainerDiv.style.left)+"px";this.div.style.top=-parseInt(this.map.layerContainerDiv.style.top)+"px";this.setExtent(this.map.getExtent())}},
onMapResize:function(){OpenLayers.Layer.prototype.onMapResize.apply(this,arguments);this.setSize(this.map.getSize())},removeMarker:function(a){a.div&&a.div.parentNode&&a.div.parentNode.removeChild(a.div);a.drawn=false;OpenLayers.Util.removeItem(this.markers,a)},clearMarkers:function(){if(this.markers!=null)for(;this.markers.length>0;)this.removeMarker(this.markers[0])},setExtent:function(a){var b=this.map.getResolution();if(!this.localResolution||b!=this.localResolution){this.left=-a.left/b;this.top=
a.top/b}var c=0,d=0;if(this.localResolution&&b==this.localResolution){c=this.left- -a.left/b;d=this.top-a.top/b}this.localResolution=b;this.svgFrame.setAttributeNS(null,"viewBox",c+" "+d+" "+a.getWidth()/b+" "+a.getHeight()/b)},setMap:function(a){OpenLayers.Layer.prototype.setMap.apply(this,arguments);this.setExtent(a.getExtent());this.setSize(this.map.getSize())},setSize:function(a){this.svgFrame.setAttributeNS(null,"width",a.w+"px");this.svgFrame.setAttributeNS(null,"height",a.h+"px")},doError:function(){this.showError==
true&&alert("Your browser is not compatible with VectorMarkers")},CLASS_NAME:"OpenLayers.Layer.VectorMarkers"});
EMS.VectorMarkerSorter=OpenLayers.Class(EMS.CombinerCalculator,{xOverlapTolerance:10,yOverlapTolerance:10,shuffle:function(){var a=this.calculateCombined(),b=[];if(a.length<2)b=a;else if(a.length==2){var c=a[0].combined[0],d=a[1].combined[0];if(this._hasOverlap(c,d)){c=this._calculateSlide(c,d);a[0].slidePx=Math.round((0-c)/2);a[1].slidePx=Math.round(c/2);b.push(a[0]);b.push(a[1])}else b=a}else b=this._recursivelySlideMarkers(a,[]);return b},_hasOverlap:function(a,b){var c=false,d=new EMS.PixelBounds;
a=a.getPixelBounds(this.resolution);b=b.getPixelBounds(this.resolution);d.extend(a);d.extend(b);b=a.width()+b.width()-d.width();d=a.height()+a.height()-d.height();if(b>this.xOverlapTolerance&&d>this.yOverlapTolerance)c=true;return c},_getDistance:function(a,b){a=a.getPixelBounds(this.resolution).center();var c=b.getPixelBounds(this.resolution).center();b=Math.max(a[0],c[0])-Math.min(a[0],c[0]);a=Math.max(a[1],c[1])-Math.min(a[1],c[1]);return Math.sqrt(b*b+a*a)},_getMostCrowdedIndex:function(a){for(var b=
null,c=null,d=0;d<a.length;d++){for(var e=0,f=0;f<a.length;f++)e+=this._getDistance(a[d].combined[0],a[f].combined[0]);e=e/a.length;if(b!=null){if(b>e){b=e;c=d}}else{b=e;c=d}}return c},_getMidpoint:function(a,b){var c=new EMS.PixelBounds;a=a.getPixelBounds(this.resolution);b=b.getPixelBounds(this.resolution);c.extend(a);c.extend(b);return a.width()+b.width()-c.width()},_calculateSlide:function(a,b){var c=0,d=new EMS.PixelBounds;a=a.getPixelBounds(this.resolution);var e=b.getPixelBounds(this.resolution);
d.extend(a);d.extend(e);d=a.width()+e.width()-d.width();if(d>0)c=0>e.center()[0]-a.center()[0]?0-d:d;b=Math.round(b.options.width/2);if(c<0-b)c=0-b;else if(c>b)c=b;return 0-c},_recursivelySlideMarkers:function(a,b){if(a.length>1){for(var c=[],d=this._getMostCrowdedIndex(a),e=a[d].combined[0],f=0;f<a.length;f++){var g=a[f];g.slidePx=g.slidePx==null?0:g.slidePx;if(d!=f){var j=g.combined[0];if(this._hasOverlap(e,j)==true&&!g.moved){var h=this._calculateSlide(e,j);j.moved=true;g.slidePx=Math.round(h)}c.push(g)}}b.push(a[d]);
return this._recursivelySlideMarkers(c,b)}else a.length==1&&b.push(a[0]);return b},CLASS_NAME:"EMS.VectorMarkerSorter"});
EMS.IndexedLayer=OpenLayers.Class(OpenLayers.Layer.WMS,{DEFAULT_PARAMS:{service:"EMS",version:"1.1.1"},initialize:function(){OpenLayers.Layer.WMS.prototype.initialize.apply(this,arguments)},getURL:function(a){var b=this.getImageSize(),c=(a.left-this.map.getMaxExtent().left)/(b.w*this.map.getResolution());a=(a.bottom-this.map.getMaxExtent().bottom)/(b.h*this.map.getResolution());b=this.map.getNumZoomLevels()-this.map.getZoom();return this.getFullRequestString({X:Math.round(c),Y:Math.round(a),Z:b})},
CLASS_NAME:"EMS.IndexedLayer"});EMS.BackgroundLayer=OpenLayers.Class(EMS.IndexedLayer,{DEFAULT_PARAMS:{service:"EMS",version:"1.1.1"},initialize:function(){EMS.IndexedLayer.prototype.initialize.apply(this,arguments);this.div.background='url("'+EMS.BackgroundLayer.TILE+'")'},getURL:function(){return this.getFullRequestString({})},setVisibility:function(){this.visibility=true;this.display(true);this.redraw()},CLASS_NAME:"EMS.BackgroundLayer"});EMS.BackgroundLayer.TILE=EMS.Util.getImagesLocation()+"tile_bg_200x200.gif";
EMS.Control.ContextMenu=OpenLayers.Class.create();
EMS.Control.ContextMenu.prototype=OpenLayers.Class.inherit(OpenLayers.Control,{EVENT_TYPES:["showMenu","hideMenu"],menuDisplayOwner:null,menuDisplayCallbacks:null,initialize:function(a,b,c){OpenLayers.Control.prototype.initialize.apply(this,[c]);var d=OpenLayers.Util.extend({show:this.showMenu,hide:this.hideMenu},d);this.handler=new EMS.Handler.RightClick(this,d,{});this.menuDisplayOwner=a;this.menuDisplayCallbacks=b},callback:function(a,b){this.menuDisplayCallbacks[a]&&this.menuDisplayCallbacks[a].apply(this.control,
b)},showMenu:function(a){this.callback("showMenu",[this.map.getLonLatFromPixel(a.xy)])},hideMenu:function(){this.callback("hideMenu",[])},activate:function(){if(this.active)return false;this.handler&&this.handler.activate();this.map.div.oncontextmenu=function(){return false};this.map.events.register("zoomend",this,this.hideMenu);return this.active=true},deactivate:function(){if(this.active){this.handler&&this.handler.deactivate();this.map.events.unregister("zoomend",this,this.hideMenu);this.active=
false;return true}return false},CLASS_NAME:"EMS.Control.ContextMenu"});EMS.Handler.RightClick=OpenLayers.Class.create();
EMS.Handler.RightClick.prototype=OpenLayers.Class.inherit(OpenLayers.Handler,{initialize:function(){OpenLayers.Handler.prototype.initialize.apply(this,arguments)},activate:function(){if(!OpenLayers.Handler.prototype.activate.apply(this,arguments))return false;return true},deactivate:function(){if(!OpenLayers.Handler.prototype.deactivate.apply(this,arguments))return false;this.showingMenu&&this.hideMenu();return true},mousedown:function(a){if(a.which&&a.which==2||a.button&&a.button==2){this.hideMenu(a);
this.displayMenu(a)}else this.hideMenu(a)},hideMenu:function(a){this.callback("hide",[a])},displayMenu:function(a){this.callback("show",[a])},CLASS_NAME:"EMS.Handler.RightClick"});
EMS.ContextPopup=OpenLayers.Class(OpenLayers.Popup.Anchored,{anchor:{size:new OpenLayers.Size(0,0),offset:new OpenLayers.Pixel(0,0)},address:null,menuOptions:null,initialize:function(a,b,c,d,e){OpenLayers.Popup.Anchored.prototype.initialize.apply(this,[a,c,b,"",this.anchor,false]);this.address=d;this.setBackgroundColor("#FFFFFF");this.setBorder("2px solid #999999");this.menuOptions=e},draw:function(){OpenLayers.Popup.Anchored.prototype.draw.apply(this,arguments);var a=this.size.h;this.element=$(this.contentDiv);
this.element.addClass("emsPopupContent");if(this.menuOptions){this.menu=OpenLayers.Util.createDiv(null);this.menu.className="emsPopupMenu";if(this.address){var b="";b+=this.address.streetNumber;b+=" "+this.address.street.fullName;b+=" "+this.address.suburb;b+=" "+this.address.state;b+="<BR/><BR/>";this.menu.innerHTML=b}for(b=0;b<this.menuOptions.length;b++){this.subMenu=OpenLayers.Util.createDiv(null);this.subMenu.className="emsPopupMenuOption";OpenLayers.Event.observe(this.subMenu,"mouseover",OpenLayers.Function.bind(this.mouseOverMenu,
this));OpenLayers.Event.observe(this.subMenu,"mouseout",OpenLayers.Function.bind(this.mouseOutMenu,this));OpenLayers.Event.observe(this.subMenu,"click",OpenLayers.Function.bind(this.menuOptions[b][1],this,this.address));this.subMenu.innerHTML=this.menuOptions[b][0];a+=30;this.menu.appendChild(this.subMenu)}this.setSize(new OpenLayers.Size(150,a));this.element.appendChild(this.menu)}return this.div},mouseOverMenu:function(a){if(!a)a=window.event;(window.event?a.srcElement:a.target).setStyle("background",
"grey")},mouseOutMenu:function(a){if(!a)a=window.event;(window.event?a.srcElement:a.target).setStyle("background","lightgrey")},CLASS_NAME:"EMS.ContextPopup"});
EMS.TabbedPopup=OpenLayers.Class(EMS.Popup,{EVENT_TYPES:["shown","hidden"],tabs:null,logoDiv:null,initialize:function(a,b,c,d,e,f,g,j){EMS.Popup.prototype.initialize.apply(this,[a,b,c?c:new OpenLayers.Size(304,286),d,e,f]);this.logoDiv=g;this.tabs=j},createTab:function(a){var b=this.currentPx.clone(),c=OpenLayers.Util.createDiv(null,b,a.headingWidth,null,"absolute");c.className="emsPopupTabOn";c.style.borderBottom="1px solid white";c.style.zIndex=2E3;c.innerHTML=a.heading;var d=OpenLayers.Util.createAlphaImageDiv(c.id+
"_left",new OpenLayers.Pixel(0,0),new OpenLayers.Size(1,33),EMS.Util.getImagesLocation()+"tab_end.gif"),e=OpenLayers.Util.createAlphaImageDiv(c.id+"_right",new OpenLayers.Pixel(a.headingWidth.w-1,0),new OpenLayers.Size(1,33),EMS.Util.getImagesLocation()+"tab_end.gif");c.appendChild(d);c.appendChild(e);d=OpenLayers.Util.createDiv(null,b,a.headingWidth,null,"absolute");d.className="emsPopupTabOff";d.innerHTML=a.heading;b=OpenLayers.Util.createDiv(null,b,a.headingWidth,null,"absolute");b.className="emsPopupTabHover";
b.innerHTML=a.heading;this.currentPx=this.currentPx.add(a.headingWidth.w,0);this.contentDiv.appendChild(c);this.contentDiv.appendChild(d);this.contentDiv.appendChild(b);this.contentDiv.appendChild(a.contentDiv);return new EMS.MultiPopupTab(c,d,b,a.contentDiv)},draw:function(){var a=EMS.Popup.prototype.draw.apply(this,arguments);if(this.tabs!=undefined){if(this.logoDiv!=undefined){this.contentDiv.appendChild(this.logoDiv);this.currentPx=new OpenLayers.Pixel(this.logoDiv.style.width,2)}else this.currentPx=
new OpenLayers.Pixel(50,2);this.tab1=this.createTab(this.tabs[0]);this.multiTabs=new EMS.MultiPopupTabs([this.tab1]);if(this.tabs.length>1){this.tab2=this.createTab(this.tabs[1]);this.multiTabs.addTab(this.tab2)}if(this.tabs.length>2){this.tab3=this.createTab(this.tabs[2]);this.multiTabs.addTab(this.tab3)}if(this.tabs.length>3){this.tab4=this.createTab(this.tabs[3]);this.multiTabs.addTab(this.tab4)}this.multiTabs.showTab(this.tab1)}return a},createImageDiv:function(a,b,c,d,e,f,g,j,h){d=OpenLayers.Util.createDiv(null,
new OpenLayers.Pixel(j,h),new OpenLayers.Size(d,e),null,"absolute");d.style.overflow="hidden";a=OpenLayers.Util.createImage(null,new OpenLayers.Pixel(-b,-c),new OpenLayers.Size(f,g),EMS.Util.getImagesLocation()+a);d.appendChild(a);return d}});EMS.CustomTab=OpenLayers.Class({initialize:function(a,b,c){this.heading=a;this.contentDiv=b;this.headingWidth=c==undefined?new OpenLayers.Size(45,32):new OpenLayers.Size(c,32)}});
EMS.RoutePopup=OpenLayers.Class(EMS.Popup,{EVENT_TYPES:["shown","hidden","next","previous"],routeDetail:null,routeMap:null,currentRoute:0,currentSegment:0,mapZoomLevel:13,zoomToLevel:13,showRouteMarkers:true,initialize:function(a,b,c,d){if(b)this.currentRoute=b;if(c)this.currentSegment=c;if(d)this.showRouteMarkers=d;this.routeDetail=a;EMS.Popup.prototype.initialize.apply(this,["emsRoutePopup",this.getSegmentLonLat(),new OpenLayers.Size(250,260)," ",null,true])},getCurrentSegment:function(){return this.getCurrentRoute().routeSegments[this.currentSegment]},
getCurrentRoute:function(){return this.routeDetail.routes[this.currentRoute]},draw:function(){var a=EMS.Popup.prototype.draw.apply(this,arguments);this.instructionsDiv=OpenLayers.Util.createDiv(null,new OpenLayers.Pixel(15,10),new OpenLayers.Size(215,42),null,"absolute");this.instructionsDiv.innerHTML=this.getSegmentInstructions();this.instructionsDiv.className="emsRouteInstructions";this.contentDiv.appendChild(this.instructionsDiv);this.nextPreviousLinks=OpenLayers.Util.createDiv(null,new OpenLayers.Pixel(15,
52),new OpenLayers.Size(220,30),null,"absolute");this.nextPreviousLinks.className="emsRouteLinks";this.previous=document.createElement("a");this.previous.className=this.hasPrevious()?"emsPreviousLink":"emsPreviousLink emsDisabled";this.previous.appendChild(document.createTextNode("<< Previous"));this.nextPreviousLinks.appendChild(this.previous);OpenLayers.Event.observe(this.previous,"mouseover",function(){this.className+=" emsHover"});OpenLayers.Event.observe(this.previous,"mouseout",function(){this.className=
this.className.replace("emsHover","")});OpenLayers.Event.observe(this.previous,"click",OpenLayers.Function.bind(this.goPrevious,this));this.next=document.createElement("a");this.next.className=this.hasNext()?"emsNextLink":"emsNextLink emsDisabled";this.next.appendChild(document.createTextNode("Next >>"));this.nextPreviousLinks.appendChild(this.next);OpenLayers.Event.observe(this.next,"mouseover",function(){this.className+=" emsHover"});OpenLayers.Event.observe(this.next,"mouseout",function(){this.className=
this.className.replace("emsHover","")});OpenLayers.Event.observe(this.next,"click",OpenLayers.Function.bind(this.goNext,this));this.contentDiv.appendChild(this.nextPreviousLinks);this.mapDiv=OpenLayers.Util.createDiv("mapDiv",new OpenLayers.Pixel(5,67),new OpenLayers.Size(234,160),null,"absolute");this.mapDiv.className="emsRouteMap";this.contentDiv.appendChild(this.mapDiv);this.routeMap=new EMS.Services.Map(this.mapDiv,{onInit:OpenLayers.Function.bind(this.mapInit,this),controls:[],layers:[],noping:true,
zoom:this.mapZoomLevel,center:this.lonlat});this.zoomToLink=OpenLayers.Util.createDiv(null,new OpenLayers.Pixel(15,235),new OpenLayers.Size(220,20),null,"absolute");this.zoomToLink.className="emsRouteLinks";this.zoomTo=document.createElement("a");this.zoomTo.className=this.map.getZoom()<this.zoomToLevel?"emsZoomToLink":"emsZoomToLink emsDisabled";this.zoomTo.appendChild(document.createTextNode("Zoom to"));this.zoomToLink.appendChild(this.zoomTo);OpenLayers.Event.observe(this.zoomTo,"mouseover",function(){this.className+=
" emsHover"});OpenLayers.Event.observe(this.zoomTo,"mouseout",function(){this.className=this.className.replace("emsHover","")});OpenLayers.Event.observe(this.zoomTo,"click",OpenLayers.Function.bind(this.goZoomTo,this));this.contentDiv.appendChild(this.zoomToLink);return a},updateSegment:function(){this.instructionsDiv.innerHTML=this.getSegmentInstructions();this.routeMap.setCenter(this.lonlat,this.mapZoomLevel);if(this.lonlat&&this.map){this.map.getExtent().containsLonLat(this.lonlat)||this.map.setCenter(this.lonlat);
this.moveTo(this.map.getLayerPxFromLonLat(this.lonlat))}this.previous.className=this.hasPrevious()?"emsPreviousLink":"emsPreviousLink emsDisabled";this.next.className=this.hasNext()?"emsNextLink":"emsNextLink emsDisabled";this.zoomTo.className=this.map.getZoom()<this.zoomToLevel?"emsZoomToLink":"emsZoomToLink emsDisabled"},goZoomTo:function(){if(this.map.getZoom()<this.zoomToLevel){this.map.setCenter(this.lonlat,this.zoomToLevel);this.map.removePopup(this);this.events.triggerEvent("hidden")}},goNext:function(){if(this.currentSegment+
1==this.getCurrentRoute().routeSegments.length)if(this.currentRoute+1!=this.routeDetail.routes.length){this.currentRoute++;this.currentSegment=0}else return;else this.currentSegment++;this.lonlat=this.getSegmentLonLat();this.updateSegment();this.events.triggerEvent("next")},goPrevious:function(){if(this.currentSegment==0)if(this.currentRoute!=0){this.currentRoute--;this.currentSegment=this.getCurrentRoute().routeSegments.length-1}else return;else this.currentSegment--;this.lonlat=this.getSegmentLonLat();
this.updateSegment();this.events.triggerEvent("previous")},hasNext:function(){if(this.currentRoute==this.routeDetail.routes.length-1&&this.currentSegment==this.getCurrentRoute().routeSegments.length-1)return false;return true},hasPrevious:function(){if(this.currentSegment==0&&this.currentRoute==0)return false;return true},mapInit:function(){var a=new OpenLayers.Layer.Markers("Route Markers"),b=new EMS.IndexedLayer("Whereis Route Popup",this.map.tilePath+"/tile?",{layers:"street",format:"image/gif",
cache:"TRUE",version:"1.0.2"},{displayOutsideMaxExtent:true,visible:true});this.routeMap.markersLayer=a;this.routeMap.whereis_street_wms=b;this.routeMap.addLayer(b);if(OpenLayers.Renderer.SVG.prototype.supported()||OpenLayers.Renderer.VML.prototype.supported()){this.routeVectorLayer=new OpenLayers.Layer.Vector("Route");this.routeMap.addLayer(this.routeVectorLayer)}this.routeMap.addLayer(a);if(this.showRouteMarkers)for(b=0;b<this.routeDetail.routes.length;b++)for(var c=0;c<this.routeDetail.routes[b].routeSegments.length;c++){if(b==
0&&c==0){seg=this.routeDetail.routes[b].routeSegments[c];var d=new OpenLayers.Marker((new EMS.LonLat(seg.centre.longitude,seg.centre.latitude)).clone(),EMS.Services.StandardIcons.start());a.addMarker(d)}if(b!=0&&c==0){seg=this.routeDetail.routes[b].routeSegments[c];d=new OpenLayers.Marker((new EMS.LonLat(seg.centre.longitude,seg.centre.latitude)).clone(),EMS.Services.StandardIcons.vias[b-1]());a.addMarker(d)}if(b+1==this.routeDetail.routes.length&&c+1==this.routeDetail.routes[b].routeSegments.length){seg=
this.routeDetail.routes[b].routeSegments[c];d=new OpenLayers.Marker((new EMS.LonLat(seg.centre.longitude,seg.centre.latitude)).clone(),EMS.Services.StandardIcons.end());a.addMarker(d)}}this.routeManager=new EMS.Services.RouteManager(this.routeMap);this.routeManager.routeVectorLayer=this.routeVectorLayer;this.routeManager.itin=new EMS.Services.Itin;this.routeManager._setupMapRoute(this.routeDetail)},getSegmentLonLat:function(){return new EMS.LonLat(this.getCurrentSegment().centre.longitude,this.getCurrentSegment().centre.latitude)},
getSegmentInstructions:function(){var a="<span>"+(this.currentSegment+1)+". "+this.getCurrentSegment().textualInstruction+"</span>";a=a.replace("ROUNDABOUT","roundabout");a=a.replace("Start at","Continue on");for(a=a.replace("Stop at","Arrive at");;){a=a.replace("_","<strong>");a=a.replace("_","</strong>");if(a.indexOf("_")==-1)break}if(this.getCurrentSegment().travelTime!=0){a=a+"<br /><span>Travel "+this.formatLength(this.getCurrentSegment().metres);a=a+" ("+this.formatTime(this.getCurrentSegment().travelTime)+
")</span>"}return a},formatLength:function(a){var b=Math.round(a/1E3*10)/10;if(b<0.1){b=Math.round(a);b+="m"}else b+="km";return b},formatTime:function(a){var b=Math.round(a/60*10)/10;if(b<1){b=Math.round(a);b+="sec"}else if(b>60)b=Math.floor(b/60)+"hr "+Math.round(b%60)+"min";else{b=Math.round(a/60);b+="min"}return b},destroy:function(){if(this.map!=null){this.map.removePopup(this);this.routeMap.destroy();this.routeMap=null}this.routeManager.clearRoute();this.routeDetail=null;this.events.destroy();
this.div=this.events=null}});EMS.Control.DraggingControl=OpenLayers.Class.create();
EMS.Control.DraggingControl.prototype=OpenLayers.Class.inherit(OpenLayers.Control.DragFeature,{startPixel:null,performedDrag:false,oldCallback:null,initialize:function(a,b){OpenLayers.Control.prototype.initialize.apply(this,[b]);this.layer=a;this.dragCallbacks=OpenLayers.Util.extend({down:this.downFeature,move:this.moveFeature,up:this.upFeature,out:this.cancel,done:this.doneDragging},this.dragCallbacks);this.featureCallbacks=OpenLayers.Util.extend({over:this.overFeature,out:this.outFeature},this.featureCallbacks);
a={geometryTypes:this.geometryTypes};this.dragHandler=new OpenLayers.Handler.Drag(this,this.dragCallbacks);this.featureHandler=new EMS.Handler.DragMarkerHandler(this,this.layer,this.featureCallbacks,a);this.handlers={drag:this.dragHandler,feature:this.featureHandler};this.oldCallback=b.markerDropped},moveFeature:function(a){if(this.active)if(this.startPixel!=null)if(this.preformedDrag){this.feature.moveTo(this.feature.icon.px.add(a.x-this.lastPixel.x,a.y-this.lastPixel.y));this.lastPixel=a;this.onDrag(this.feature,
a)}else{var b=Math.abs(this.startPixel.x-a.x),c=Math.abs(this.startPixel.y-a.y);if(!(Math.abs(b)<7&&Math.abs(c)<7)){this.preformedDrag=true;this.onStart(this.feature,a)}}},upFeature:function(){if(this.active)if(!this.over){this.dragHandler.deactivate();this.map.div.style.cursor="default"}},downFeature:function(a){if(this.active){this.preformedDrag=false;this.lastPixel=this.startPixel=a}},doneDragging:function(a){if(this.active){if(this.preformedDrag){if(this.feature)this.feature.preformedDrag=true;
this.oldCallback?this.oldCallback(this.feature,a):this.onComplete(this.feature,a)}else this.cancel();if(!this.over)this.feature=null;this.preformedDrag=false;this.lastPixel=this.startPixel=null}},cancel:function(){this.dragHandler.deactivate();this.preformedDrag=this.over=false;this.lastPixel=this.startPixel=null},CLASS_NAME:"EMS.Control.DraggingControl"});EMS.Handler.DragMarkerHandler=OpenLayers.Class.create();
EMS.Handler.DragMarkerHandler.prototype=OpenLayers.Class.inherit(OpenLayers.Handler.Feature,{handle:function(a){var b=a.target||a.srcElement;a=null;for(var c=0;c<this.layer.markers.length;c++)if(b.id.match("Icon"))if(b.id.match("innerImage")){if(this.layer.markers[c].icon.alphaImageDiv.firstChild==b){a=this.layer.markers[c];break}}else if(this.layer.markers[c].icon.alphaImageDiv.id==b.id){a=this.layer.markers[c];break}b=false;if(a)if(this.geometryTypes==null||a.geometry!=null&&OpenLayers.Util.indexOf(this.geometryTypes,
a.geometry.CLASS_NAME)>-1||a.type!=null&&OpenLayers.Util.indexOf(this.geometryTypes,a.type)>-1){if(this.feature){if(this.feature!=a){this.callback("out",[this.feature]);this.callback("over",[a])}}else this.callback("over",[a]);this.feature=a;this.callback("move",[a]);b=true}else{if(this.feature&&this.feature!=a){this.callback("out",[this.feature]);this.feature=null}b=false}else{if(this.feature){this.callback("out",[this.feature]);this.feature=null}b=false}return b},select:function(a,b){return this.handle(b)},
CLASS_NAME:"EMS.Handler.DragMarkerHandler"});EMS.InteractiveMarkerStyles={SLIM:1,THICK:2,TEXT:3,SLIM_MULTI:4,MULTI:5,SLIM_CIRCLE:6,THICK_CIRCLE:7};EMS.InteractiveMarkerPopupSizes={MINI:1,SMALL:2,SMALL_WITH_HEADER:3,LARGE:4,LARGE_WITH_HEADER:5};
EMS.InteractiveIcon=OpenLayers.Class({defaultOptions:{markerStyle:EMS.InteractiveMarkerStyles.SLIM,dockedInfoBoxId:null,title:"",text:"",popupEdgeMargin:10,fadeDuration:20},size:null,slidePx:null,offset:null,div:null,px:null,_showingPopup:false,_originalDiv:null,_popupDiv:null,_popupBox:null,initialize:function(a,b){b=b?b:{};this.options=OpenLayers.Util.extend(this.defaultOptions,b);OpenLayers.Util.createUniqueID("EMS_InteractiveIcon_");this._showingPopup=false;switch(this.options.markerStyle){case EMS.InteractiveMarkerStyles.SLIM:this.div=
this.createSlimPoi();this.size=new OpenLayers.Size(30,33);this.slidePx=new OpenLayers.Size(15,24);break;case EMS.InteractiveMarkerStyles.THICK:this.div=this.createThickPoi();this.size=new OpenLayers.Size(50,33);this.slidePx=new OpenLayers.Size(8,24);break;case EMS.InteractiveMarkerStyles.TEXT:this.div=this.createTextPoi();this.size=new OpenLayers.Size(201,50);this.slidePx=new OpenLayers.Size(0,20);break;case EMS.InteractiveMarkerStyles.SLIM_MULTI:this.div=this.createSlimMultiPoi();this.size=new OpenLayers.Size(30,
33);this.slidePx=new OpenLayers.Size(15,24);break;case EMS.InteractiveMarkerStyles.MULTI:this.div=this.createThickMultiPoi();this.size=new OpenLayers.Size(50,33);this.slidePx=new OpenLayers.Size(8,24);break;case EMS.InteractiveMarkerStyles.SLIM_CIRCLE:this.div=this.createSlimCirclePoi();this.size=new OpenLayers.Size(20,20);this.slidePx=new OpenLayers.Size(2,-26);break;case EMS.InteractiveMarkerStyles.THICK_CIRCLE:this.div=this.createThickCirclePoi();this.size=new OpenLayers.Size(25,25);this.slidePx=
new OpenLayers.Size(2,-35);break;default:}this.div.icon=this;this._originalDiv=this.div;this.map=a},createDiv:function(a,b){var c=document.createElement("div");c.setAttribute("class",a);b&&b.appendChild(c);return c},createMarkerPoi:function(){var a=this.createDiv("marker"),b=this.createDiv("marker-shadow",a);this.createDiv("main-shadow",b);this.createDiv("triangle-shadow",b);b=this.createDiv("inside",this.createDiv("box",this.createDiv("clip",a)));if(this.options.text!=""){b=this.createDiv("text",
b);b.innerText=this.options.text}else{b=this.createDiv("text point",b);b.innerText="."}this.createDiv("inside",this.createDiv("triangle-box",a));this.textDiv=b;return a},createSlimPoi:function(){var a=this.createMarkerPoi();a.setAttribute("class","marker mini");return a},createThickPoi:function(){var a=this.createMarkerPoi();a.setAttribute("class","marker fat");return a},createMultiMarkerComponent:function(a,b){a=this.createDiv(a);var c=this.createDiv("inside",this.createDiv("box",this.createDiv("clip",
a)));if(b)this.createDiv("text point",c).innerText="...";this.createDiv("inside",this.createDiv("triangle-box",a));return a},createMultiMarkerPoi:function(){var a=this.createDiv("marker"),b=this.createDiv("marker-shadow",a);this.createDiv("main-shadow",b);this.createDiv("triangle-shadow",b);a.appendChild(this.createMultiMarkerComponent("multi-component back"));a.appendChild(this.createMultiMarkerComponent("multi-component middle"));a.appendChild(this.createMultiMarkerComponent("multi-component front",
true));return a},createSlimMultiPoi:function(){var a=this.createMultiMarkerPoi();a.setAttribute("class","marker mini multi");return a},createThickMultiPoi:function(){var a=this.createMultiMarkerPoi();a.setAttribute("class","marker fat multi");return a},createTextPoi:function(){var a=this.createDiv("poi"),b=this.createDiv("box",a),c=this.createDiv("inside",b),d=false;if(this.options.title!=""){d=this.createDiv("title",c);d.innerText=this.options.title;this.titleDiv=d;d=true}c=this.createDiv("text",
c);c.innerText=this.options.text;d&&c.setAttribute("class","text with-title");this.disclosureDiv=this.createDiv("disclosure",b);this.createDiv("inside",this.createDiv("triangle-box",a));this.createDiv("triangle-cover",a);this.textDiv=c;return a},createPopup:function(a){var b=this.createDiv("poi"),c=this.createDiv("box",b);this._popupBox=c;c=this.createDiv("inside",c);a&&this.createDiv("popup-contents",c).appendChild(a);this.createDiv("inside",this.createDiv("triangle-box",b));this.createDiv("triangle-cover",
b);return b},createCirclePoi:function(){var a=this.createDiv("non-geo-marker");this.createDiv("marker-shadow",a);this.createDiv("clip",a);var b=this.createDiv("inside",a);if(this.options.text!=""){b=this.createDiv("text",b);b.innerText=this.options.text}else{b=this.createDiv("text point",b);b.innerText="."}this.textDiv=b;return a},createSlimCirclePoi:function(){var a=this.createCirclePoi();a.setAttribute("class","non-geo-marker mini");return a},createThickCirclePoi:function(){var a=this.createCirclePoi();
a.setAttribute("class","non-geo-marker fat");return a},showPopup:function(a,b,c){map.resetPan&&this.map.resetPan();if(this.marker){if(!this._showingPopup){if(!this._popupDiv){this._popupDiv=this.createPopup(a);this._popupDiv.setAttribute("class",this._popupDiv.getAttribute("class")+" popup");if(!c)c=EMS.InteractiveMarkerPopupSizes.SMALL;switch(c){case EMS.InteractiveMarkerPopupSizes.MINI:this._popupDiv.size=new OpenLayers.Size(202,110);this._popupDiv.slidePx=new OpenLayers.Size(0,54);this._popupBox.setAttribute("class",
"box mini");break;default:case EMS.InteractiveMarkerPopupSizes.SMALL:this._popupDiv.size=new OpenLayers.Size(202,210);this._popupDiv.slidePx=new OpenLayers.Size(0,104);this._popupBox.setAttribute("class","box small");break;case EMS.InteractiveMarkerPopupSizes.SMALL_WITH_HEADER:this._popupDiv.size=new OpenLayers.Size(202,244);this._popupDiv.slidePx=new OpenLayers.Size(0,118);this._popupBox.setAttribute("class","box small-with-head");break;case EMS.InteractiveMarkerPopupSizes.LARGE:this._popupDiv.size=
new OpenLayers.Size(206,246);this._popupDiv.slidePx=new OpenLayers.Size(0,120);this._popupBox.setAttribute("class","box large");break;case EMS.InteractiveMarkerPopupSizes.LARGE_WITH_HEADER:this._popupDiv.size=new OpenLayers.Size(202,280);this._popupDiv.slidePx=new OpenLayers.Size(2,134);this._popupBox.setAttribute("class","box large-with-head");break}this._originalDiv.size=this.size;this._originalDiv.slidePx=this.slidePx}this.fadeIn(this._popupDiv);this.fadeOut(this._originalDiv);this.map.markersLayer.removeMarker(this.marker);
this.size=this._popupDiv.size;this.slidePx=this._popupDiv.slidePx;this.div=this._popupDiv;this.map.markersLayer.addMarker(this.marker);if(b){a=moveY=0;var d=this.map.getPixelFromLonLat(this.marker.lonlat);b=this.options.popupEdgeMargin;c=d.y-this.size.h;var e=d.x-0.5*this.size.w;d=this.map.getSize().w-(d.x+0.5*this.size.w);if(c<b)moveY=c-b;if(e<b)a=e-b;else if(d<b)a=b-d;this.map.pan(a,moveY)}this._showingPopup=true;return this._popupDiv}return null}},hidePopup:function(){if(this._showingPopup){this.map.markersLayer.removeMarker(this.marker);
this.size=this._originalDiv.size;this.slidePx=this._originalDiv.slidePx;this.fadeOut(this._popupDiv);this.fadeIn(this._originalDiv);this.div=this._originalDiv;this.map.markersLayer.addMarker(this.marker);this._showingPopup=false}},fadeTween:function(a,b,c){a.style.opacity=b;var d=new OpenLayers.Tween(OpenLayers.Easing.Linear.easeIn);this.animationTween=d;d.type="fade";d.start({opacity:b},{opacity:c},this.options.fadeDuration,{callbacks:{eachStep:function(e){e=e.opacity;if(e>1)e=1;else if(e<0)e=0;
a.style.opacity=e}}})},fadeIn:function(a){this.fadeTween(a,0,1)},fadeOut:function(a){this.fadeTween(a,1,0)},destroy:function(){this.erase();OpenLayers.Event.stopObservingElement(this._originalDiv);this._originalDiv.innerHTML="";this._originalDiv=null;OpenLayers.Event.stopObservingElement(this._popupDiv);this._popupDiv.innerHTML="";this._popupDiv=null},draw:function(a){this.moveTo(a);return this.div},erase:function(){this.div!=null&&this.div.parentNode!=null&&OpenLayers.Element.remove(this.div)},moveTo:function(a){if(a!=
null)this.px=a;if(this.div!=null)if(this.px==null)this.display(false);else{if(this.calculateOffset)this.offset=this.calculateOffset(this.size);a=this.px.offset(this.offset);OpenLayers.Util.modifyDOMElement(this.div,null,a)}},calculateOffset:function(){return new OpenLayers.Pixel(-(this.size.w/2)-this.slidePx.w,-(this.size.h/2)-this.slidePx.h)},isDrawn:function(){return this.div&&this.div.parentNode&&this.div.parentNode.nodeType!=11},CLASS_NAME:"EMS.InteractiveIcon"});
EMS.LocationMarkerIcon=OpenLayers.Class({defaultOptions:{centerImageLocating:EMS.Util.getImagesLocation()+"location-center.png",centerImageLocated:EMS.Util.getImagesLocation()+"location-center.png",pulseRadiusWhenFound:80,pulseTime:150,pulseDelay:2E3,supportsScale3d:false,locatingOpacity:0.6,locatingPulseMinimum:32},size:new OpenLayers.Size(100,100),offset:null,div:null,px:null,cssSize:new OpenLayers.Size(100,100),initialize:function(a,b){b=b?b:{};this.options=OpenLayers.Util.extend(this.defaultOptions,
b);this.offset=b.offset?offset:new OpenLayers.Pixel(-(this.size.w/2),-(this.size.h/2));OpenLayers.Util.createUniqueID("EMS_LocationIcon_");b=document.createElement("div");b.setAttribute("class","location-marker");var c=document.createElement("div");c.setAttribute("class","stroke");b.appendChild(c);var d=document.createElement("div");d.setAttribute("class","gradient");b.appendChild(d);var e=OpenLayers.Util.createImage(null,null,new OpenLayers.Size(20,23),this.options.centerImageLocating,null,null,
null,false);e.style.position="absolute";b.appendChild(e);this.div=b;this.gradientDiv=d;this.strokeDiv=c;this.imageElem=e;this.map=a},destroy:function(){this.erase();OpenLayers.Event.stopObservingElement(this.div.firstChild);this.div.innerHTML="";this.div=null},draw:function(a){this.moveTo(a);return this.div},erase:function(){this.div!=null&&this.div.parentNode!=null&&OpenLayers.Element.remove(this.div)},moveTo:function(a){if(a!=null)this.px=a;if(this.div!=null)if(this.px==null)this.display(false);
else{if(this.calculateOffset)this.offset=this.calculateOffset(this.size);a=this.px.offset(this.offset);OpenLayers.Util.modifyDOMElement(this.div,null,a)}},isDrawn:function(){return this.div&&this.div.parentNode&&this.div.parentNode.nodeType!=11},doLocatedAnimationStep:function(){var a=new OpenLayers.Tween(OpenLayers.Easing.Linear.easeIn);this.animationTween=a;a.type="located";var b=this;a.start({scaleAmt:0,opacity:3},{scaleAmt:this.options.pulseRadiusWhenFound/this.cssSize.w,opacity:0},this.options.pulseTime,
{callbacks:{eachStep:function(c){var d=c.opacity;if(d>1)d=1;b.setBackgroundOpacity(d);b.scaleBy(c.scaleAmt)},done:function(){b.animationTimeout=setTimeout(function(){b.doLocatedAnimationStep()},b.options.pulseDelay)}}})},startLocatedAnimation:function(){this.stopAnimations();this.imageElem.src=this.options.centerImageLocated;this.doLocatedAnimationStep()},doLocatingAnimationStep:function(){var a=new OpenLayers.Tween(OpenLayers.Easing.Linear.easeIn);this.animationTween=a;a.type="locating";var b=8;
if(this.nextFindAnimationShouldGrow)this.nextFindAnimationShouldGrow=false;else{b*=-1;this.nextFindAnimationShouldGrow=true}var c={scale:this.lastAnimatedAccuracy-b};b={scale:this.locationAccuracy+b};this.lastAnimatedAccuracy=this.locationAccuracy;this.lastAnimatedResolution=this.map.getResolution();var d=this;a.start(c,b,100,{callbacks:{eachStep:function(e){if(d.map.getResolution()==d.lastAnimatedResolution)d.scaleBy(e.scale/d.cssSize.w);else{d.stopAnimations();d.animationTimeout=setTimeout(function(){d.doLocatingAnimationStep()},
10)}},done:function(){d.animationTimeout=setTimeout(function(){d.doLocatingAnimationStep()},10)}}})},setAccuracyPixelsBasedOnScale:function(){this.locationAccuracy=this.locationAccuracyInMeters/1E3/111.12/this.map.getResolution();if(this.locationAccuracy<this.options.locatingPulseMinimum)this.locationAccuracy=this.options.locatingPulseMinimum},setLocationAccuracy:function(a){this.locationAccuracyInMeters=a;this.setAccuracyPixelsBasedOnScale()},startLocatingAnimation:function(){this.stopAnimations();
if(this.locationAccuracy>0){this.imageElem.src=this.options.centerImageLocating;this.setBackgroundOpacity(this.options.locatingOpacity);this.lastAnimatedAccuracy=this.locationAccuracy;this.nextFindAnimationShouldGrow=true;this.doLocatingAnimationStep()}},stopAnimations:function(){if(this.animationTween){this.lastAnimationTween=this.animationTween;this.animationTween=null;this.lastAnimationTween.stop()}if(this.animationTimeout){clearTimeout(this.animationTimeout);this.animationTimeout=null}},startAnimations:function(){(this.animationTween=
this.lastAnimationTween)&&this.animationTween.start(this.animationTween.begin,this.animationTween.finish,this.animationTween.duration,{callbacks:this.animationTween.callbacks})},setBackgroundOpacity:function(a){this.gradientDiv.style.opacity=a},scaleBy:function(a){this.gradientDiv.style.webkitTransform=this.options.supportsScale3d?"scale3d("+a+","+a+","+a+")":"scale("+a+")"},CLASS_NAME:"EMS.LocationMarkerIcon"});
EMS.Control.DockedInfoBox=OpenLayers.Class(OpenLayers.Control,{element:null,contents:null,contentIndex:null,prevDiv:null,nextDiv:null,contentsChangedCallback:null,initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){OpenLayers.Event.stopObservingElement(this.prevDiv);OpenLayers.Event.stopObservingElement(this.nextDiv);OpenLayers.Control.prototype.destroy.apply(this,arguments);OpenLayers.Event.stopObservingElement(this.div)},setContents:function(a,
b){if(a instanceof Array){this.contentIndex=0;if(b&&b instanceof Function)this.contentsChangedCallback=b}this.contents=a},loadContentsForIndex:function(a){if(a<0)a=0;if(a>=this.contents.length)a=this.contents.length-1;this.contentIndex=a;this.contentDiv.innerHTML="";this.contentDiv.appendChild(this.contents[this.contentIndex]);var b=a==this.contents.length-1?"next inactive":"next";this.prevDiv.setAttribute("class",a==0?"prev inactive":"prev");this.nextDiv.setAttribute("class",b);this.contentsChangedCallback&&
this.contentsChangedCallback(a)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.div.className="dock";var a=document.createElement("div");a.setAttribute("class","inside");this.div.appendChild(a);this.inside=a;if(this.contents instanceof Array){a=document.createElement("div");a.setAttribute("class","prev");this.inside.appendChild(a);var b=document.createElement("div");b.setAttribute("class","icon");a.appendChild(b);this.prevDiv=a}a=document.createElement("div");
a.setAttribute("class","content");this.inside.appendChild(a);this.contentDiv=a;if(this.contents instanceof Array){a=document.createElement("div");a.setAttribute("class","next");this.inside.appendChild(a);b=document.createElement("div");b.setAttribute("class","icon");a.appendChild(b);this.nextDiv=a;this.prevDiv.addEventListener("touchend",function(){this.loadContentsForIndex(this.contentIndex-1)}.bind(this),false);this.nextDiv.addEventListener("touchend",function(){this.loadContentsForIndex(this.contentIndex+
1)}.bind(this),false);this.loadContentsForIndex(0)}else this.contentDiv.appendChild(this.contents)}return this.div},CLASS_NAME:"EMS.Control.DockedInfoBox"});OpenLayers.Map.TILE_WIDTH=200;OpenLayers.Map.TILE_HEIGHT=200;EMS.IndexedLayer.prototype.DEFAULT_PARAMS={service:"MOB",version:"1.1.1"};EMS.BackgroundLayer.prototype.DEFAULT_PARAMS={service:"MOB",version:"1.1.1"};OpenLayers._scriptName="EMS.js";
EMS.Services.Map.prototype.initialize=function(a,b){this.active=true;this.tilePath=EMS.tilePath;b=b?b:{};b=OpenLayers.Util.extend({maxExtent:new OpenLayers.Bounds(100,-50,170,-3),maxResolution:0.1,numZoomLevels:17,miniControls:false,showMapPhotoButtons:true,showMaxExtent:true},b);var c=false;if(b.controls==null){b.controls=[];c=true}OpenLayers.Map.prototype.initialize.apply(this,[a,b]);if(EMS.tilePath instanceof Array){a=new Array(EMS.tilePath.length);for(var d=0;d<EMS.tilePath.length;d++)a[d]=EMS.tilePath[d]+
"/tile?"}else a=EMS.tilePath+"/tile?";if(b.layers==null){this.bgLayer=new EMS.BackgroundLayer("Background tiles",EMS.BackgroundLayer.TILE,{layers:"background",format:"image/gif",CACHE:"TRUE",VERSION:EMS.tileVersion},{displayOutsideMaxExtent:true,visible:true});this.bgLayer.isBaseLayer=true;this.bgLayer.setVisibility(true);this.whereis_street_wms=new EMS.IndexedLayer("Whereis Street",a,{layers:"street",format:"image/gif",TRANSPARENT:true,CACHE:"TRUE",VERSION:EMS.tileVersion},{displayOutsideMaxExtent:true,
visible:true,transparent:true});this.whereis_street_wms.setVisibility(true);this.whereis_street_wms.transitionEffect="resize";this.whereis_photo_wms=new EMS.IndexedLayer("Whereis Photo",a,{layers:"photo",format:"image/jpg",TRANSPARENT:true,CACHE:"TRUE",VERSION:EMS.tileVersion},{displayOutsideMaxExtent:true,visible:false,transparent:true});this.whereis_photo_wms.setVisibility(false);this.whereis_photo_wms.transitionEffect="resize";this.whereis_hybrid_wms=new EMS.IndexedLayer("Whereis Hybrid",a,{layers:"hybrid",
format:"image/gif",TRANSPARENT:true,CACHE:"TRUE",VERSION:EMS.tileVersion},{displayOutsideMaxExtent:true,transparent:true});this.whereis_hybrid_wms.setVisibility(false);this.whereis_hybrid_wms.transitionEffect="resize";if(OpenLayers.Renderer.SVG.prototype.supported()||OpenLayers.Renderer.VML.prototype.supported())this.vlayer=new EMS.Layer.Vector("Route");this.markersLayer=new OpenLayers.Layer.Markers("Markers");OpenLayers.Renderer.SVG.prototype.supported()||OpenLayers.Renderer.VML.prototype.supported()?
this.addLayers([this.bgLayer,this.whereis_street_wms,this.whereis_photo_wms,this.whereis_hybrid_wms,this.vlayer,this.markersLayer]):this.addLayers([this.bgLayer,this.whereis_street_wms,this.whereis_photo_wms,this.whereis_hybrid_wms,this.markersLayer])}this.setBaseLayer(this.bgLayer,false);if(c){this.addControl(this.zoombar=new EMS.Control.ZoomBar(this.whereis_street_wms,this.whereis_photo_wms,this.whereis_hybrid_wms,!b.miniControls,b.showMapPhotoButtons));this.addControl(this.mouseDefaults=new EMS.Control.MouseDefaults);
this.addControl(this.panNorth=new EMS.Control.PanButton("n"));this.addControl(this.panSouth=new EMS.Control.PanButton("s"));this.addControl(this.panEast=new EMS.Control.PanButton("e"));this.addControl(this.panWest=new EMS.Control.PanButton("w"));this.addControl(this.copyRight=new EMS.Control.Copyright({smallCopyright:b.miniControls}));this.addControl(this.scalebar=new EMS.Control.Scale);c=new EMS.IndexedLayer("Street",a,{layers:"street",format:"image/gif",cache:"TRUE",version:EMS.tileVersion},{displayOutsideMaxExtent:true,
visible:true});c.buffer=0;this.addControl(this.overviewmap=new EMS.Control.OverviewMap({layers:[c],mapOptions:{maxResolution:1.6,numZoomLevels:21,maxExtent:new OpenLayers.Bounds(100,-50,170,-3)}}))}this.center==undefined&&b.showMaxExtent&&this.zoomToMaxExtent();c=OpenLayers.Function.bind(function(e){if(e.authorized){if(!b.noping)this.timeoutVar=setTimeout(OpenLayers.Function.bind(this.ping,this),this.pingPeriod);b.onInit&&b.onInit(this)}else{EMS.token=null;this.destroy();alert("Authentication problem")}},
this);a=EMS.Util.getDomain();EMS.Ajax.json("/json/auth/init",c,{parameters:{token:EMS.token,domain:a}})};

EMS.tilePath = 'http://tiles.whereis.com:80/remapper';
EMS.tileVersion = '1.0.8';
EMS.token = '4515030282502994577';
EMS.VERSION_NUMBER = '1.20.3';


