From ca11b7819dafc0d53736af2879e809a8b843610a Mon Sep 17 00:00:00 2001 From: Young Hahn Date: Fri, 25 Feb 2011 15:49:19 -0500 Subject: [PATCH] Make google interaction code usable via wax. --- build/wax.g.js | 4251 ++++++++++++++++++++++++++++++--- build/wax.g.min.js | 130 +- build/wax.ol.js | 3694 +++++++++++++++++++++++++++- build/wax.ol.min.js | 130 +- control/g/interaction.js | 89 +- control/g/legend.js | 17 - example/google_interaction.js | 39 +- lib/record.js | 5 +- 8 files changed, 7998 insertions(+), 357 deletions(-) delete mode 100644 control/g/legend.js diff --git a/build/wax.g.js b/build/wax.g.js index 96284d00..99b0b038 100644 --- a/build/wax.g.js +++ b/build/wax.g.js @@ -1,4 +1,1407 @@ /* + + OpenLayers.js -- OpenLayers Map Viewer Library + + Copyright 2005-2010 OpenLayers Contributors, released under the Clear BSD + license. Please see http://svn.openlayers.org/trunk/openlayers/license.txt + for the full text of the license. + + Includes compressed code under the following licenses: + + (For uncompressed versions of the code used please see the + OpenLayers SVN repository: ) + +*/ + +/* Contains portions of Prototype.js: + * + * Prototype JavaScript framework, version 1.4.0 + * (c) 2005 Sam Stephenson + * + * Prototype is freely distributable under the terms of an MIT-style license. + * For details, see the Prototype web site: http://prototype.conio.net/ + * + *--------------------------------------------------------------------------*/ + +/** +* +* Contains portions of Rico +* +* Copyright 2005 Sabre Airline Solutions +* +* Licensed under the Apache License, Version 2.0 (the "License"); you +* may not use this file except in compliance with the License. You +* may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +* implied. See the License for the specific language governing +* permissions and limitations under the License. +* +**/ + +/** + * Contains XMLHttpRequest.js + * Copyright 2007 Sergey Ilinsky (http://www.ilinsky.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +/** + * Contains portions of Gears + * + * Copyright 2007, Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of Google Inc. nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Sets up google.gears.*, which is *the only* supported way to access Gears. + * + * Circumvent this file at your own risk! + * + * In the future, Gears may automatically define google.gears.* without this + * file. Gears may use these objects to transparently fix bugs and compatibility + * issues. Applications that use the code below will continue to work seamlessly + * when that happens. + */ + +/** + * OpenLayers.Util.pagePosition is based on Yahoo's getXY method, which is + * Copyright (c) 2006, Yahoo! Inc. + * All rights reserved. + * + * Redistribution and use of this software in source and binary forms, with or + * without modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of Yahoo! Inc. nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission of Yahoo! Inc. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */var OpenLayers={VERSION_NUMBER:"$Revision: 10862 $",singleFile:true,_getScriptLocation:(function(){var r=new RegExp("(^|(.*?\\/))(OpenLayers\.js)(\\?|$)"),s=document.getElementsByTagName('script'),src,m,l="";for(var i=0,len=s.length;i";}else{var s=document.createElement("script");s.src=host+jsfiles[i];var h=document.getElementsByTagName("head").length?document.getElementsByTagName("head")[0]:document.body;h.appendChild(s);}} +if(docWrite){document.write(allScriptTags.join(""));}}})();OpenLayers.VERSION_NUMBER="$Revision: 10862 $";OpenLayers.String={startsWith:function(str,sub){return(str.indexOf(sub)==0);},contains:function(str,sub){return(str.indexOf(sub)!=-1);},trim:function(str){return str.replace(/^\s\s*/,'').replace(/\s\s*$/,'');},camelize:function(str){var oStringList=str.split('-');var camelizedString=oStringList[0];for(var i=1,len=oStringList.length;i0){fig=parseFloat(num.toPrecision(sig));} +return fig;},format:function(num,dec,tsep,dsep){dec=(typeof dec!="undefined")?dec:0;tsep=(typeof tsep!="undefined")?tsep:OpenLayers.Number.thousandsSeparator;dsep=(typeof dsep!="undefined")?dsep:OpenLayers.Number.decimalSeparator;if(dec!=null){num=parseFloat(num.toFixed(dec));} +var parts=num.toString().split(".");if(parts.length==1&&dec==null){dec=0;} +var integer=parts[0];if(tsep){var thousands=/(-?[0-9]+)([0-9]{3})/;while(thousands.test(integer)){integer=integer.replace(thousands,"$1"+tsep+"$2");}} +var str;if(dec==0){str=integer;}else{var rem=parts.length>1?parts[1]:"0";if(dec!=null){rem=rem+new Array(dec-rem.length+1).join("0");} +str=integer+dsep+rem;} +return str;}};if(!Number.prototype.limitSigDigs){Number.prototype.limitSigDigs=function(sig){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{'newMethod':'OpenLayers.Number.limitSigDigs'}));return OpenLayers.Number.limitSigDigs(this,sig);};} +OpenLayers.Function={bind:function(func,object){var args=Array.prototype.slice.apply(arguments,[2]);return function(){var newArgs=args.concat(Array.prototype.slice.apply(arguments,[0]));return func.apply(object,newArgs);};},bindAsEventListener:function(func,object){return function(event){return func.call(object,event||window.event);};},False:function(){return false;},True:function(){return true;}};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(object){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{'newMethod':'OpenLayers.Function.bindAsEventListener'}));return OpenLayers.Function.bindAsEventListener(this,object);};} +OpenLayers.Array={filter:function(array,callback,caller){var selected=[];if(Array.prototype.filter){selected=array.filter(callback,caller);}else{var len=array.length;if(typeof callback!="function"){throw new TypeError();} +for(var i=0;i1){var newArgs=[C,P].concat(Array.prototype.slice.call(arguments).slice(1,len-1),F);OpenLayers.inherit.apply(null,newArgs);}else{C.prototype=F;} +return C;};OpenLayers.Class.isPrototype=function(){};OpenLayers.Class.create=function(){return function(){if(arguments&&arguments[0]!=OpenLayers.Class.isPrototype){this.initialize.apply(this,arguments);}};};OpenLayers.Class.inherit=function(P){var C=function(){P.call(this);};var newArgs=[C].concat(Array.prototype.slice.call(arguments));OpenLayers.inherit.apply(null,newArgs);return C.prototype;};OpenLayers.inherit=function(C,P){var F=function(){};F.prototype=P.prototype;C.prototype=new F;var i,l,o;for(i=2,l=arguments.length;i=0;i--){if(array[i]==item){array.splice(i,1);}} +return array;};OpenLayers.Util.clearArray=function(array){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{'newMethod':'array = []'}));array.length=0;};OpenLayers.Util.indexOf=function(array,obj){if(typeof array.indexOf=="function"){return array.indexOf(obj);}else{for(var i=0,len=array.length;i=0.0&&parseFloat(opacity)<1.0){element.style.filter='alpha(opacity='+(opacity*100)+')';element.style.opacity=opacity;}else if(parseFloat(opacity)==1.0){element.style.filter='';element.style.opacity='';}};OpenLayers.Util.createDiv=function(id,px,sz,imgURL,position,border,overflow,opacity){var dom=document.createElement('div');if(imgURL){dom.style.backgroundImage='url('+imgURL+')';} +if(!id){id=OpenLayers.Util.createUniqueID("OpenLayersDiv");} +if(!position){position="absolute";} +OpenLayers.Util.modifyDOMElement(dom,id,px,sz,position,border,overflow,opacity);return dom;};OpenLayers.Util.createImage=function(id,px,sz,imgURL,position,border,opacity,delayDisplay){var image=document.createElement("img");if(!id){id=OpenLayers.Util.createUniqueID("OpenLayersDiv");} +if(!position){position="relative";} +OpenLayers.Util.modifyDOMElement(image,id,px,sz,position,border,null,opacity);if(delayDisplay){image.style.display="none";OpenLayers.Event.observe(image,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,image));OpenLayers.Event.observe(image,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,image));} +image.style.alt=id;image.galleryImg="no";if(imgURL){image.src=imgURL;} +return image;};OpenLayers.Util.setOpacity=function(element,opacity){OpenLayers.Util.modifyDOMElement(element,null,null,null,null,null,null,opacity);};OpenLayers.Util.onImageLoad=function(){if(!this.viewRequestID||(this.map&&this.viewRequestID==this.map.viewRequestID)){this.style.display="";} +OpenLayers.Element.removeClass(this,"olImageLoadError");};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 urls=this.urls;if(urls&&urls instanceof Array&&urls.length>1){var src=this.src.toString();var current_url,k;for(k=0;current_url=urls[k];k++){if(src.indexOf(current_url)!=-1){break;}} +var guess=Math.floor(urls.length*Math.random());var new_url=urls[guess];k=0;while(new_url==current_url&&k++<4){guess=Math.floor(urls.length*Math.random());new_url=urls[guess];} +this.src=src.replace(current_url,new_url);}else{this.src=this.src;}}else{OpenLayers.Element.addClass(this,"olImageLoadError");} +this.style.display="";};OpenLayers.Util.alphaHackNeeded=null;OpenLayers.Util.alphaHack=function(){if(OpenLayers.Util.alphaHackNeeded==null){var arVersion=navigator.appVersion.split("MSIE");var version=parseFloat(arVersion[1]);var filter=false;try{filter=!!(document.body.filters);}catch(e){} +OpenLayers.Util.alphaHackNeeded=(filter&&(version>=5.5)&&(version<7));} +return OpenLayers.Util.alphaHackNeeded;};OpenLayers.Util.modifyAlphaImageDiv=function(div,id,px,sz,imgURL,position,border,sizing,opacity){OpenLayers.Util.modifyDOMElement(div,id,px,sz,position,null,null,opacity);var img=div.childNodes[0];if(imgURL){img.src=imgURL;} +OpenLayers.Util.modifyDOMElement(img,div.id+"_innerImage",null,sz,"relative",border);if(OpenLayers.Util.alphaHack()){if(div.style.display!="none"){div.style.display="inline-block";} +if(sizing==null){sizing="scale";} +div.style.filter="progid:DXImageTransform.Microsoft"+".AlphaImageLoader(src='"+img.src+"', "+"sizingMethod='"+sizing+"')";if(parseFloat(div.style.opacity)>=0.0&&parseFloat(div.style.opacity)<1.0){div.style.filter+=" alpha(opacity="+div.style.opacity*100+")";} +img.style.filter="alpha(opacity=0)";}};OpenLayers.Util.createAlphaImageDiv=function(id,px,sz,imgURL,position,border,sizing,opacity,delayDisplay){var div=OpenLayers.Util.createDiv();var img=OpenLayers.Util.createImage(null,null,null,null,null,null,null,false);div.appendChild(img);if(delayDisplay){img.style.display="none";OpenLayers.Event.observe(img,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,div));OpenLayers.Event.observe(img,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,div));} +OpenLayers.Util.modifyAlphaImageDiv(div,id,px,sz,imgURL,position,border,sizing,opacity);return div;};OpenLayers.Util.upperCaseObject=function(object){var uObject={};for(var key in object){uObject[key.toUpperCase()]=object[key];} +return uObject;};OpenLayers.Util.applyDefaults=function(to,from){to=to||{};var fromIsEvt=typeof window.Event=="function"&&from instanceof window.Event;for(var key in from){if(to[key]===undefined||(!fromIsEvt&&from.hasOwnProperty&&from.hasOwnProperty(key)&&!to.hasOwnProperty(key))){to[key]=from[key];}} +if(!fromIsEvt&&from&&from.hasOwnProperty&&from.hasOwnProperty('toString')&&!to.hasOwnProperty('toString')){to.toString=from.toString;} +return to;};OpenLayers.Util.getParameterString=function(params){var paramsArray=[];for(var key in params){var value=params[key];if((value!=null)&&(typeof value!='function')){var encodedValue;if(typeof value=='object'&&value.constructor==Array){var encodedItemArray=[];var item;for(var itemIndex=0,len=value.length;itemIndex0)) +{if(!index){index=0;} +if(result[index].childNodes.length>1){return result.childNodes[1].nodeValue;} +else if(result[index].childNodes.length==1){return result[index].firstChild.nodeValue;}}else{return"";}};OpenLayers.Util.getXmlNodeValue=function(node){var val=null;OpenLayers.Util.Try(function(){val=node.text;if(!val){val=node.textContent;} +if(!val){val=node.firstChild.nodeValue;}},function(){val=node.textContent;});return val;};OpenLayers.Util.mouseLeft=function(evt,div){var target=(evt.relatedTarget)?evt.relatedTarget:evt.toElement;while(target!=div&&target!=null){target=target.parentNode;} +return(target!=div);};OpenLayers.Util.DEFAULT_PRECISION=14;OpenLayers.Util.toFloat=function(number,precision){if(precision==null){precision=OpenLayers.Util.DEFAULT_PRECISION;} +var number;if(precision==0){number=parseFloat(number);}else{number=parseFloat(parseFloat(number).toPrecision(precision));} +return number;};OpenLayers.Util.rad=function(x){return x*Math.PI/180;};OpenLayers.Util.deg=function(x){return x*180/Math.PI;};OpenLayers.Util.VincentyConstants={a:6378137,b:6356752.3142,f:1/298.257223563};OpenLayers.Util.distVincenty=function(p1,p2){var ct=OpenLayers.Util.VincentyConstants;var a=ct.a,b=ct.b,f=ct.f;var L=OpenLayers.Util.rad(p2.lon-p1.lon);var U1=Math.atan((1-f)*Math.tan(OpenLayers.Util.rad(p1.lat)));var U2=Math.atan((1-f)*Math.tan(OpenLayers.Util.rad(p2.lat)));var sinU1=Math.sin(U1),cosU1=Math.cos(U1);var sinU2=Math.sin(U2),cosU2=Math.cos(U2);var lambda=L,lambdaP=2*Math.PI;var iterLimit=20;while(Math.abs(lambda-lambdaP)>1e-12&&--iterLimit>0){var sinLambda=Math.sin(lambda),cosLambda=Math.cos(lambda);var sinSigma=Math.sqrt((cosU2*sinLambda)*(cosU2*sinLambda)+ +(cosU1*sinU2-sinU1*cosU2*cosLambda)*(cosU1*sinU2-sinU1*cosU2*cosLambda));if(sinSigma==0){return 0;} +var cosSigma=sinU1*sinU2+cosU1*cosU2*cosLambda;var sigma=Math.atan2(sinSigma,cosSigma);var alpha=Math.asin(cosU1*cosU2*sinLambda/sinSigma);var cosSqAlpha=Math.cos(alpha)*Math.cos(alpha);var cos2SigmaM=cosSigma-2*sinU1*sinU2/cosSqAlpha;var C=f/16*cosSqAlpha*(4+f*(4-3*cosSqAlpha));lambdaP=lambda;lambda=L+(1-C)*f*Math.sin(alpha)*(sigma+C*sinSigma*(cos2SigmaM+C*cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)));} +if(iterLimit==0){return NaN;} +var uSq=cosSqAlpha*(a*a-b*b)/(b*b);var A=1+uSq/16384*(4096+uSq*(-768+uSq*(320-175*uSq)));var B=uSq/1024*(256+uSq*(-128+uSq*(74-47*uSq)));var deltaSigma=B*sinSigma*(cos2SigmaM+B/4*(cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)- +B/6*cos2SigmaM*(-3+4*sinSigma*sinSigma)*(-3+4*cos2SigmaM*cos2SigmaM)));var s=b*A*(sigma-deltaSigma);var d=s.toFixed(3)/1000;return d;};OpenLayers.Util.destinationVincenty=function(lonlat,brng,dist){var u=OpenLayers.Util;var ct=u.VincentyConstants;var a=ct.a,b=ct.b,f=ct.f;var lon1=lonlat.lon;var lat1=lonlat.lat;var s=dist;var alpha1=u.rad(brng);var sinAlpha1=Math.sin(alpha1);var cosAlpha1=Math.cos(alpha1);var tanU1=(1-f)*Math.tan(u.rad(lat1));var cosU1=1/Math.sqrt((1+tanU1*tanU1)),sinU1=tanU1*cosU1;var sigma1=Math.atan2(tanU1,cosAlpha1);var sinAlpha=cosU1*sinAlpha1;var cosSqAlpha=1-sinAlpha*sinAlpha;var uSq=cosSqAlpha*(a*a-b*b)/(b*b);var A=1+uSq/16384*(4096+uSq*(-768+uSq*(320-175*uSq)));var B=uSq/1024*(256+uSq*(-128+uSq*(74-47*uSq)));var sigma=s/(b*A),sigmaP=2*Math.PI;while(Math.abs(sigma-sigmaP)>1e-12){var cos2SigmaM=Math.cos(2*sigma1+sigma);var sinSigma=Math.sin(sigma);var cosSigma=Math.cos(sigma);var deltaSigma=B*sinSigma*(cos2SigmaM+B/4*(cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)- +B/6*cos2SigmaM*(-3+4*sinSigma*sinSigma)*(-3+4*cos2SigmaM*cos2SigmaM)));sigmaP=sigma;sigma=s/(b*A)+deltaSigma;} +var tmp=sinU1*sinSigma-cosU1*cosSigma*cosAlpha1;var lat2=Math.atan2(sinU1*cosSigma+cosU1*sinSigma*cosAlpha1,(1-f)*Math.sqrt(sinAlpha*sinAlpha+tmp*tmp));var lambda=Math.atan2(sinSigma*sinAlpha1,cosU1*cosSigma-sinU1*sinSigma*cosAlpha1);var C=f/16*cosSqAlpha*(4+f*(4-3*cosSqAlpha));var L=lambda-(1-C)*f*sinAlpha*(sigma+C*sinSigma*(cos2SigmaM+C*cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)));var revAz=Math.atan2(sinAlpha,-tmp);return new OpenLayers.LonLat(lon1+u.deg(L),u.deg(lat2));};OpenLayers.Util.getParameters=function(url){url=url||window.location.href;var paramsString="";if(OpenLayers.String.contains(url,'?')){var start=url.indexOf('?')+1;var end=OpenLayers.String.contains(url,"#")?url.indexOf('#'):url.length;paramsString=url.substring(start,end);} +var parameters={};var pairs=paramsString.split(/[&;]/);for(var i=0,len=pairs.length;i1.0)?(1.0/scale):scale;return normScale;};OpenLayers.Util.getResolutionFromScale=function(scale,units){var resolution;if(scale){if(units==null){units="degrees";} +var normScale=OpenLayers.Util.normalizeScale(scale);resolution=1/(normScale*OpenLayers.INCHES_PER_UNIT[units]*OpenLayers.DOTS_PER_INCH);} +return resolution;};OpenLayers.Util.getScaleFromResolution=function(resolution,units){if(units==null){units="degrees";} +var scale=resolution*OpenLayers.INCHES_PER_UNIT[units]*OpenLayers.DOTS_PER_INCH;return scale;};OpenLayers.Util.safeStopPropagation=function(evt){OpenLayers.Event.stop(evt,true);};OpenLayers.Util.pagePosition=function(forElement){var pos=[0,0];var viewportElement=OpenLayers.Util.getViewportElement();if(!forElement||forElement==window||forElement==viewportElement){return pos;} +var BUGGY_GECKO_BOX_OBJECT=OpenLayers.IS_GECKO&&document.getBoxObjectFor&&OpenLayers.Element.getStyle(forElement,'position')=='absolute'&&(forElement.style.top==''||forElement.style.left=='');var parent=null;var box;if(forElement.getBoundingClientRect){box=forElement.getBoundingClientRect();var scrollTop=viewportElement.scrollTop;var scrollLeft=viewportElement.scrollLeft;pos[0]=box.left+scrollLeft;pos[1]=box.top+scrollTop;}else if(document.getBoxObjectFor&&!BUGGY_GECKO_BOX_OBJECT){box=document.getBoxObjectFor(forElement);var vpBox=document.getBoxObjectFor(viewportElement);pos[0]=box.screenX-vpBox.screenX;pos[1]=box.screenY-vpBox.screenY;}else{pos[0]=forElement.offsetLeft;pos[1]=forElement.offsetTop;parent=forElement.offsetParent;if(parent!=forElement){while(parent){pos[0]+=parent.offsetLeft;pos[1]+=parent.offsetTop;parent=parent.offsetParent;}} +var browser=OpenLayers.BROWSER_NAME;if(browser=="opera"||(browser=="safari"&&OpenLayers.Element.getStyle(forElement,'position')=='absolute')){pos[1]-=document.body.offsetTop;} +parent=forElement.offsetParent;while(parent&&parent!=document.body){pos[0]-=parent.scrollLeft;if(browser!="opera"||parent.tagName!='TR'){pos[1]-=parent.scrollTop;} +parent=parent.offsetParent;}} +return pos;};OpenLayers.Util.getViewportElement=function(){var viewportElement=arguments.callee.viewportElement;if(viewportElement==undefined){viewportElement=(OpenLayers.BROWSER_NAME=="msie"&&document.compatMode!='CSS1Compat')?document.body:document.documentElement;arguments.callee.viewportElement=viewportElement;} +return viewportElement;};OpenLayers.Util.isEquivalentUrl=function(url1,url2,options){options=options||{};OpenLayers.Util.applyDefaults(options,{ignoreCase:true,ignorePort80:true,ignoreHash:true});var urlObj1=OpenLayers.Util.createUrlObject(url1,options);var urlObj2=OpenLayers.Util.createUrlObject(url2,options);for(var key in urlObj1){if(key!=="args"){if(urlObj1[key]!=urlObj2[key]){return false;}}} +for(var key in urlObj1.args){if(urlObj1.args[key]!=urlObj2.args[key]){return false;} +delete urlObj2.args[key];} +for(var key in urlObj2.args){return false;} +return true;};OpenLayers.Util.createUrlObject=function(url,options){options=options||{};if(!(/^\w+:\/\//).test(url)){var loc=window.location;var port=loc.port?":"+loc.port:"";var fullUrl=loc.protocol+"//"+loc.host.split(":").shift()+port;if(url.indexOf("/")===0){url=fullUrl+url;}else{var parts=loc.pathname.split("/");parts.pop();url=fullUrl+parts.join("/")+"/"+url;}} +if(options.ignoreCase){url=url.toLowerCase();} +var a=document.createElement('a');a.href=url;var urlObject={};urlObject.host=a.host.split(":").shift();urlObject.protocol=a.protocol;if(options.ignorePort80){urlObject.port=(a.port=="80"||a.port=="0")?"":a.port;}else{urlObject.port=(a.port==""||a.port=="0")?"80":a.port;} +urlObject.hash=(options.ignoreHash||a.hash==="#")?"":a.hash;var queryString=a.search;if(!queryString){var qMark=url.indexOf("?");queryString=(qMark!=-1)?url.substr(qMark):"";} +urlObject.args=OpenLayers.Util.getParameters(queryString);urlObject.pathname=(a.pathname.charAt(0)=="/")?a.pathname:"/"+a.pathname;return urlObject;};OpenLayers.Util.removeTail=function(url){var head=null;var qMark=url.indexOf("?");var hashMark=url.indexOf("#");if(qMark==-1){head=(hashMark!=-1)?url.substr(0,hashMark):url;}else{head=(hashMark!=-1)?url.substr(0,Math.min(qMark,hashMark)):url.substr(0,qMark);} +return head;};OpenLayers.IS_GECKO=(function(){return navigator.userAgent.toLowerCase().indexOf("gecko")!=-1;})();OpenLayers.BROWSER_NAME=(function(){var name="";var ua=navigator.userAgent.toLowerCase();if(ua.indexOf("opera")!=-1){name="opera";}else if(ua.indexOf("msie")!=-1){name="msie";}else if(ua.indexOf("safari")!=-1){name="safari";}else if(ua.indexOf("mozilla")!=-1){if(ua.indexOf("firefox")!=-1){name="firefox";}else{name="mozilla";}} +return name;})();OpenLayers.Util.getBrowserName=function(){return OpenLayers.BROWSER_NAME;};OpenLayers.Util.getRenderedDimensions=function(contentHTML,size,options){var w,h;var container=document.createElement("div");container.style.visibility="hidden";var containerElement=(options&&options.containerElement)?options.containerElement:document.body;if(size){if(size.w){w=size.w;container.style.width=w+"px";}else if(size.h){h=size.h;container.style.height=h+"px";}} +if(options&&options.displayClass){container.className=options.displayClass;} +var content=document.createElement("div");content.innerHTML=contentHTML;content.style.overflow="visible";if(content.childNodes){for(var i=0,l=content.childNodes.length;i=0){if(coordinateminutes<10){coordinateminutes="0"+coordinateminutes;} +str+=coordinateminutes+"'";if(dmsOption.indexOf('dms')>=0){if(coordinateseconds<10){coordinateseconds="0"+coordinateseconds;} +str+=coordinateseconds+'"';}} +if(axis=="lon"){str+=coordinate<0?OpenLayers.i18n("W"):OpenLayers.i18n("E");}else{str+=coordinate<0?OpenLayers.i18n("S"):OpenLayers.i18n("N");} +return str;};OpenLayers.Rico=new Object();OpenLayers.Rico.Corner={round:function(e,options){e=OpenLayers.Util.getElement(e);this._setOptions(options);var color=this.options.color;if(this.options.color=="fromElement"){color=this._background(e);} +var bgColor=this.options.bgColor;if(this.options.bgColor=="fromParent"){bgColor=this._background(e.offsetParent);} +this._roundCornersImpl(e,color,bgColor);},changeColor:function(theDiv,newColor){theDiv.style.backgroundColor=newColor;var spanElements=theDiv.parentNode.getElementsByTagName("span");for(var currIdx=0;currIdx"+el.innerHTML+"";},_roundTopCorners:function(el,color,bgColor){var corner=this._createCorner(bgColor);for(var i=0;i=0;i--){corner.appendChild(this._createCornerSlice(color,bgColor,i,"bottom"));} +el.style.paddingBottom=0;el.appendChild(corner);},_createCorner:function(bgColor){var corner=document.createElement("div");corner.style.backgroundColor=(this._isTransparent()?"transparent":bgColor);return corner;},_createCornerSlice:function(color,bgColor,n,position){var slice=document.createElement("span");var inStyle=slice.style;inStyle.backgroundColor=color;inStyle.display="block";inStyle.height="1px";inStyle.overflow="hidden";inStyle.fontSize="1px";var borderColor=this._borderColor(color,bgColor);if(this.options.border&&n==0){inStyle.borderTopStyle="solid";inStyle.borderTopWidth="1px";inStyle.borderLeftWidth="0px";inStyle.borderRightWidth="0px";inStyle.borderBottomWidth="0px";inStyle.height="0px";inStyle.borderColor=borderColor;} +else if(borderColor){inStyle.borderColor=borderColor;inStyle.borderStyle="solid";inStyle.borderWidth="0px 1px";} +if(!this.options.compact&&(n==(this.options.numSlices-1))){inStyle.height="2px";} +this._setMargin(slice,n,position);this._setBorder(slice,n,position);return slice;},_setOptions:function(options){this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:true,border:false,compact:false};OpenLayers.Util.extend(this.options,options||{});this.options.numSlices=this.options.compact?2:4;if(this._isTransparent()){this.options.blend=false;}},_whichSideTop:function(){if(this._hasString(this.options.corners,"all","top")){return"";} +if(this.options.corners.indexOf("tl")>=0&&this.options.corners.indexOf("tr")>=0){return"";} +if(this.options.corners.indexOf("tl")>=0){return"left";}else if(this.options.corners.indexOf("tr")>=0){return"right";} +return"";},_whichSideBottom:function(){if(this._hasString(this.options.corners,"all","bottom")){return"";} +if(this.options.corners.indexOf("bl")>=0&&this.options.corners.indexOf("br")>=0){return"";} +if(this.options.corners.indexOf("bl")>=0){return"left";}else if(this.options.corners.indexOf("br")>=0){return"right";} +return"";},_borderColor:function(color,bgColor){if(color=="transparent"){return bgColor;}else if(this.options.border){return this.options.border;}else if(this.options.blend){return this._blend(bgColor,color);}else{return"";}},_setMargin:function(el,n,corners){var marginSize=this._marginSize(n);var whichSide=corners=="top"?this._whichSideTop():this._whichSideBottom();if(whichSide=="left"){el.style.marginLeft=marginSize+"px";el.style.marginRight="0px";} +else if(whichSide=="right"){el.style.marginRight=marginSize+"px";el.style.marginLeft="0px";} +else{el.style.marginLeft=marginSize+"px";el.style.marginRight=marginSize+"px";}},_setBorder:function(el,n,corners){var borderSize=this._borderSize(n);var whichSide=corners=="top"?this._whichSideTop():this._whichSideBottom();if(whichSide=="left"){el.style.borderLeftWidth=borderSize+"px";el.style.borderRightWidth="0px";} +else if(whichSide=="right"){el.style.borderRightWidth=borderSize+"px";el.style.borderLeftWidth="0px";} +else{el.style.borderLeftWidth=borderSize+"px";el.style.borderRightWidth=borderSize+"px";} +if(this.options.border!=false){el.style.borderLeftWidth=borderSize+"px";el.style.borderRightWidth=borderSize+"px";}},_marginSize:function(n){if(this._isTransparent()){return 0;} +var marginSizes=[5,3,2,1];var blendedMarginSizes=[3,2,1,0];var compactMarginSizes=[2,1];var smBlendedMarginSizes=[1,0];if(this.options.compact&&this.options.blend){return smBlendedMarginSizes[n];}else if(this.options.compact){return compactMarginSizes[n];}else if(this.options.blend){return blendedMarginSizes[n];}else{return marginSizes[n];}},_borderSize:function(n){var transparentBorderSizes=[5,3,2,1];var blendedBorderSizes=[2,1,1,1];var compactBorderSizes=[1,0];var actualBorderSizes=[0,2,0,0];if(this.options.compact&&(this.options.blend||this._isTransparent())){return 1;}else if(this.options.compact){return compactBorderSizes[n];}else if(this.options.blend){return blendedBorderSizes[n];}else if(this.options.border){return actualBorderSizes[n];}else if(this._isTransparent()){return transparentBorderSizes[n];} +return 0;},_hasString:function(str){for(var i=1;i=0){return true;}return false;},_blend:function(c1,c2){var cc1=OpenLayers.Rico.Color.createFromHex(c1);cc1.blend(OpenLayers.Rico.Color.createFromHex(c2));return cc1;},_background:function(el){try{return OpenLayers.Rico.Color.createColorFromBackground(el).asHex();}catch(err){return"#ffffff";}},_isTransparent:function(){return this.options.color=="transparent";},_isTopRounded:function(){return this._hasString(this.options.corners,"all","top","tl","tr");},_isBottomRounded:function(){return this._hasString(this.options.corners,"all","bottom","bl","br");},_hasSingleTextChild:function(el){return el.childNodes.length==1&&el.childNodes[0].nodeType==3;}};OpenLayers.Element={visible:function(element){return OpenLayers.Util.getElement(element).style.display!='none';},toggle:function(){for(var i=0,len=arguments.length;i"+ +this.contentDiv.innerHTML+"";var containerElement=(this.map)?this.map.layerContainerDiv:document.body;var realSize=OpenLayers.Util.getRenderedDimensions(preparedHTML,null,{displayClass:this.displayClass,containerElement:containerElement});var safeSize=this.getSafeContentSize(realSize);var newSize=null;if(safeSize.equals(realSize)){newSize=realSize;}else{var fixedSize=new OpenLayers.Size();fixedSize.w=(safeSize.w(mapSize.w-this.map.paddingForPopups.right)){newTL.x=mapSize.w-this.map.paddingForPopups.right-this.size.w;} +if(origTL.y(mapSize.h-this.map.paddingForPopups.bottom)){newTL.y=mapSize.h-this.map.paddingForPopups.bottom-this.size.h;} +var dx=origTL.x-newTL.x;var dy=origTL.y-newTL.y;this.map.pan(dx,dy);},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(evt){this.mousedown=true;OpenLayers.Event.stop(evt,true);},onmousemove:function(evt){if(this.mousedown){OpenLayers.Event.stop(evt,true);}},onmouseup:function(evt){if(this.mousedown){this.mousedown=false;OpenLayers.Event.stop(evt,true);}},onclick:function(evt){OpenLayers.Event.stop(evt,true);},onmouseout:function(evt){this.mousedown=false;},ondblclick:function(evt){OpenLayers.Event.stop(evt,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.Renderer=OpenLayers.Class({container:null,root:null,extent:null,locked:false,size:null,resolution:null,map:null,initialize:function(containerID,options){this.container=OpenLayers.Util.getElement(containerID);},destroy:function(){this.container=null;this.extent=null;this.size=null;this.resolution=null;this.map=null;},supported:function(){return false;},setExtent:function(extent,resolutionChanged){this.extent=extent.clone();if(resolutionChanged){this.resolution=null;}},setSize:function(size){this.size=size.clone();this.resolution=null;},getResolution:function(){this.resolution=this.resolution||this.map.getResolution();return this.resolution;},drawFeature:function(feature,style){if(style==null){style=feature.style;} +if(feature.geometry){var bounds=feature.geometry.getBounds();if(bounds){if(!bounds.intersectsBounds(this.extent)){style={display:"none"};} +var rendered=this.drawGeometry(feature.geometry,style,feature.id);if(style.display!="none"&&style.label&&rendered!==false){var location=feature.geometry.getCentroid();if(style.labelXOffset||style.labelYOffset){xOffset=isNaN(style.labelXOffset)?0:style.labelXOffset;yOffset=isNaN(style.labelYOffset)?0:style.labelYOffset;var res=this.getResolution();location.move(xOffset*res,yOffset*res);} +this.drawText(feature.id,style,location);}else{this.removeText(feature.id);} +return rendered;}}},drawGeometry:function(geometry,style,featureId){},drawText:function(featureId,style,location){},removeText:function(featureId){},clear:function(){},getFeatureIdFromEvent:function(evt){},eraseFeatures:function(features){if(!(features instanceof Array)){features=[features];} +for(var i=0,len=features.length;ithis.right)){this.right=bounds.right;} +if((this.top==null)||(bounds.top>this.top)){this.top=bounds.top;}}}},containsLonLat:function(ll,inclusive){return this.contains(ll.lon,ll.lat,inclusive);},containsPixel:function(px,inclusive){return this.contains(px.x,px.y,inclusive);},contains:function(x,y,inclusive){if(inclusive==null){inclusive=true;} +if(x==null||y==null){return false;} +x=OpenLayers.Util.toFloat(x);y=OpenLayers.Util.toFloat(y);var contains=false;if(inclusive){contains=((x>=this.left)&&(x<=this.right)&&(y>=this.bottom)&&(y<=this.top));}else{contains=((x>this.left)&&(xthis.bottom)&&(y=this.bottom)&&(bounds.bottom<=this.top))||((this.bottom>=bounds.bottom)&&(this.bottom<=bounds.top)));var inTop=(((bounds.top>=this.bottom)&&(bounds.top<=this.top))||((this.top>bounds.bottom)&&(this.top=this.left)&&(bounds.left<=this.right))||((this.left>=bounds.left)&&(this.left<=bounds.right)));var inRight=(((bounds.right>=this.left)&&(bounds.right<=this.right))||((this.right>=bounds.left)&&(this.right<=bounds.right)));intersects=((inBottom||inTop)&&(inLeft||inRight));} +return intersects;},containsBounds:function(bounds,partial,inclusive){if(partial==null){partial=false;} +if(inclusive==null){inclusive=true;} +var bottomLeft=this.contains(bounds.left,bounds.bottom,inclusive);var bottomRight=this.contains(bounds.right,bounds.bottom,inclusive);var topLeft=this.contains(bounds.left,bounds.top,inclusive);var topRight=this.contains(bounds.right,bounds.top,inclusive);return(partial)?(bottomLeft||bottomRight||topLeft||topRight):(bottomLeft&&bottomRight&&topLeft&&topRight);},determineQuadrant:function(lonlat){var quadrant="";var center=this.getCenterLonLat();quadrant+=(lonlat.lat=maxExtent.right&&newBounds.right>maxExtent.right){newBounds=newBounds.add(-maxExtent.getWidth(),0);}} +return newBounds;},CLASS_NAME:"OpenLayers.Bounds"});OpenLayers.Bounds.fromString=function(str){var bounds=str.split(",");return OpenLayers.Bounds.fromArray(bounds);};OpenLayers.Bounds.fromArray=function(bbox){return new OpenLayers.Bounds(parseFloat(bbox[0]),parseFloat(bbox[1]),parseFloat(bbox[2]),parseFloat(bbox[3]));};OpenLayers.Bounds.fromSize=function(size){return new OpenLayers.Bounds(0,size.h,size.w,0);};OpenLayers.Bounds.oppositeQuadrant=function(quadrant){var opp="";opp+=(quadrant.charAt(0)=='t')?'b':'t';opp+=(quadrant.charAt(1)=='l')?'r':'l';return opp;};OpenLayers.LonLat=OpenLayers.Class({lon:0.0,lat:0.0,initialize:function(lon,lat){this.lon=OpenLayers.Util.toFloat(lon);this.lat=OpenLayers.Util.toFloat(lat);},toString:function(){return("lon="+this.lon+",lat="+this.lat);},toShortString:function(){return(this.lon+", "+this.lat);},clone:function(){return new OpenLayers.LonLat(this.lon,this.lat);},add:function(lon,lat){if((lon==null)||(lat==null)){var msg=OpenLayers.i18n("lonlatAddError");OpenLayers.Console.error(msg);return null;} +return new OpenLayers.LonLat(this.lon+OpenLayers.Util.toFloat(lon),this.lat+OpenLayers.Util.toFloat(lat));},equals:function(ll){var equals=false;if(ll!=null){equals=((this.lon==ll.lon&&this.lat==ll.lat)||(isNaN(this.lon)&&isNaN(this.lat)&&isNaN(ll.lon)&&isNaN(ll.lat)));} +return equals;},transform:function(source,dest){var point=OpenLayers.Projection.transform({'x':this.lon,'y':this.lat},source,dest);this.lon=point.x;this.lat=point.y;return this;},wrapDateLine:function(maxExtent){var newLonLat=this.clone();if(maxExtent){while(newLonLat.lonmaxExtent.right){newLonLat.lon-=maxExtent.getWidth();}} +return newLonLat;},CLASS_NAME:"OpenLayers.LonLat"});OpenLayers.LonLat.fromString=function(str){var pair=str.split(",");return new OpenLayers.LonLat(pair[0],pair[1]);};OpenLayers.Pixel=OpenLayers.Class({x:0.0,y:0.0,initialize:function(x,y){this.x=parseFloat(x);this.y=parseFloat(y);},toString:function(){return("x="+this.x+",y="+this.y);},clone:function(){return new OpenLayers.Pixel(this.x,this.y);},equals:function(px){var equals=false;if(px!=null){equals=((this.x==px.x&&this.y==px.y)||(isNaN(this.x)&&isNaN(this.y)&&isNaN(px.x)&&isNaN(px.y)));} +return equals;},add:function(x,y){if((x==null)||(y==null)){var msg=OpenLayers.i18n("pixelAddError");OpenLayers.Console.error(msg);return null;} +return new OpenLayers.Pixel(this.x+x,this.y+y);},offset:function(px){var newPx=this.clone();if(px){newPx=this.add(px.x,px.y);} +return newPx;},CLASS_NAME:"OpenLayers.Pixel"});OpenLayers.Control=OpenLayers.Class({id:null,map:null,div:null,type:null,allowSelection:false,displayClass:"",title:"",autoActivate:false,active:null,handler:null,eventListeners:null,events:null,EVENT_TYPES:["activate","deactivate"],initialize:function(options){this.displayClass=this.CLASS_NAME.replace("OpenLayers.","ol").replace(/\./g,"");OpenLayers.Util.extend(this,options);this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES);if(this.eventListeners instanceof Object){this.events.on(this.eventListeners);} +if(this.id==null){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");}},destroy:function(){if(this.events){if(this.eventListeners){this.events.un(this.eventListeners);} +this.events.destroy();this.events=null;} +this.eventListeners=null;if(this.handler){this.handler.destroy();this.handler=null;} +if(this.handlers){for(var key in this.handlers){if(this.handlers.hasOwnProperty(key)&&typeof this.handlers[key].destroy=="function"){this.handlers[key].destroy();}} +this.handlers=null;} +if(this.map){this.map.removeControl(this);this.map=null;}},setMap:function(map){this.map=map;if(this.handler){this.handler.setMap(map);}},draw:function(px){if(this.div==null){this.div=OpenLayers.Util.createDiv(this.id);this.div.className=this.displayClass;if(!this.allowSelection){this.div.className+=" olControlNoSelect";this.div.setAttribute("unselectable","on",0);this.div.onselectstart=OpenLayers.Function.False;} +if(this.title!=""){this.div.title=this.title;}} +if(px!=null){this.position=px.clone();} +this.moveTo(this.position);return this.div;},moveTo:function(px){if((px!=null)&&(this.div!=null)){this.div.style.left=px.x+"px";this.div.style.top=px.y+"px";}},activate:function(){if(this.active){return false;} +if(this.handler){this.handler.activate();} +this.active=true;if(this.map){OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active");} +this.events.triggerEvent("activate");return true;},deactivate:function(){if(this.active){if(this.handler){this.handler.deactivate();} +this.active=false;if(this.map){OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active");} +this.events.triggerEvent("deactivate");return true;} +return false;},CLASS_NAME:"OpenLayers.Control"});OpenLayers.Control.TYPE_BUTTON=1;OpenLayers.Control.TYPE_TOGGLE=2;OpenLayers.Control.TYPE_TOOL=3;OpenLayers.Lang={code:null,defaultCode:"en",getCode:function(){if(!OpenLayers.Lang.code){OpenLayers.Lang.setCode();} +return OpenLayers.Lang.code;},setCode:function(code){var lang;if(!code){code=(OpenLayers.BROWSER_NAME=="msie")?navigator.userLanguage:navigator.language;} +var parts=code.split('-');parts[0]=parts[0].toLowerCase();if(typeof OpenLayers.Lang[parts[0]]=="object"){lang=parts[0];} +if(parts[1]){var testLang=parts[0]+'-'+parts[1].toUpperCase();if(typeof OpenLayers.Lang[testLang]=="object"){lang=testLang;}} +if(!lang){OpenLayers.Console.warn('Failed to find OpenLayers.Lang.'+parts.join("-")+' dictionary, falling back to default language');lang=OpenLayers.Lang.defaultCode;} +OpenLayers.Lang.code=lang;},translate:function(key,context){var dictionary=OpenLayers.Lang[OpenLayers.Lang.getCode()];var message=dictionary[key];if(!message){message=key;} +if(context){message=OpenLayers.String.format(message,context);} +return message;}};OpenLayers.i18n=OpenLayers.Lang.translate;OpenLayers.Popup.Anchored=OpenLayers.Class(OpenLayers.Popup,{relativePosition:null,keepInMap:true,anchor:null,initialize:function(id,lonlat,contentSize,contentHTML,anchor,closeBox,closeBoxCallback){var newArguments=[id,lonlat,contentSize,contentHTML,closeBox,closeBoxCallback];OpenLayers.Popup.prototype.initialize.apply(this,newArguments);this.anchor=(anchor!=null)?anchor:{size:new OpenLayers.Size(0,0),offset:new OpenLayers.Pixel(0,0)};},destroy:function(){this.anchor=null;this.relativePosition=null;OpenLayers.Popup.prototype.destroy.apply(this,arguments);},show:function(){this.updatePosition();OpenLayers.Popup.prototype.show.apply(this,arguments);},moveTo:function(px){var oldRelativePosition=this.relativePosition;this.relativePosition=this.calculateRelativePosition(px);var newPx=this.calculateNewPx(px);var newArguments=new Array(newPx);OpenLayers.Popup.prototype.moveTo.apply(this,newArguments);if(this.relativePosition!=oldRelativePosition){this.updateRelativePosition();}},setSize:function(contentSize){OpenLayers.Popup.prototype.setSize.apply(this,arguments);if((this.lonlat)&&(this.map)){var px=this.map.getLayerPxFromLonLat(this.lonlat);this.moveTo(px);}},calculateRelativePosition:function(px){var lonlat=this.map.getLonLatFromLayerPx(px);var extent=this.map.getExtent();var quadrant=extent.determineQuadrant(lonlat);return OpenLayers.Bounds.oppositeQuadrant(quadrant);},updateRelativePosition:function(){},calculateNewPx:function(px){var newPx=px.offset(this.anchor.offset);var size=this.size||this.contentSize;var top=(this.relativePosition.charAt(0)=='t');newPx.y+=(top)?-(size.h+this.anchor.size.h):this.anchor.size.h;var left=(this.relativePosition.charAt(1)=='l');newPx.x+=(left)?-(size.w+this.anchor.size.w):this.anchor.size.w;return newPx;},CLASS_NAME:"OpenLayers.Popup.Anchored"});OpenLayers.Renderer.Canvas=OpenLayers.Class(OpenLayers.Renderer,{canvas:null,features:null,initialize:function(containerID){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={};},eraseGeometry:function(geometry,featureId){this.eraseFeatures(this.features[featureId][0]);},supported:function(){var canvas=document.createElement("canvas");return!!canvas.getContext;},setSize:function(size){this.size=size.clone();this.root.style.width=size.w+"px";this.root.style.height=size.h+"px";this.root.width=size.w;this.root.height=size.h;this.resolution=null;},drawFeature:function(feature,style){style=style||feature.style;style=this.applyDefaultSymbolizer(style);this.features[feature.id]=[feature,style];this.redraw();},drawGeometry:function(geometry,style){var className=geometry.CLASS_NAME;if((className=="OpenLayers.Geometry.Collection")||(className=="OpenLayers.Geometry.MultiPoint")||(className=="OpenLayers.Geometry.MultiLineString")||(className=="OpenLayers.Geometry.MultiPolygon")){for(var i=0;i1){middle=parseInt((leftIndex+rightIndex)/2);var placement=this.compare(this,newNode,OpenLayers.Util.getElement(this.order[middle]));if(placement>0){leftIndex=middle;}else{rightIndex=middle;}} +this.order.splice(rightIndex,0,nodeId);this.indices[nodeId]=this.getZIndex(newNode);return this.getNextElement(rightIndex);},remove:function(node){var nodeId=node.id;var arrayIndex=OpenLayers.Util.indexOf(this.order,nodeId);if(arrayIndex>=0){this.order.splice(arrayIndex,1);delete this.indices[nodeId];if(this.order.length>0){var lastId=this.order[this.order.length-1];this.maxZIndex=this.indices[lastId];}else{this.maxZIndex=0;}}},clear:function(){this.order=[];this.indices={};this.maxZIndex=0;},exists:function(node){return(this.indices[node.id]!=null);},getZIndex:function(node){return node._style.graphicZIndex;},determineZIndex:function(node){var zIndex=node._style.graphicZIndex;if(zIndex==null){zIndex=this.maxZIndex;node._style.graphicZIndex=zIndex;}else if(zIndex>this.maxZIndex){this.maxZIndex=zIndex;}},getNextElement:function(index){var nextIndex=index+1;if(nextIndexthis.duration){this.stop();}},CLASS_NAME:"OpenLayers.Tween"});OpenLayers.Easing={CLASS_NAME:"OpenLayers.Easing"};OpenLayers.Easing.Linear={easeIn:function(t,b,c,d){return c*t/d+b;},easeOut:function(t,b,c,d){return c*t/d+b;},easeInOut:function(t,b,c,d){return c*t/d+b;},CLASS_NAME:"OpenLayers.Easing.Linear"};OpenLayers.Easing.Expo={easeIn:function(t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b;},easeOut:function(t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b;},easeInOut:function(t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b;},CLASS_NAME:"OpenLayers.Easing.Expo"};OpenLayers.Easing.Quad={easeIn:function(t,b,c,d){return c*(t/=d)*t+b;},easeOut:function(t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeInOut:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;},CLASS_NAME:"OpenLayers.Easing.Quad"};OpenLayers.Control.ArgParser=OpenLayers.Class(OpenLayers.Control,{center:null,zoom:null,layers:null,displayProjection:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,arguments);},setMap:function(map){OpenLayers.Control.prototype.setMap.apply(this,arguments);for(var i=0,len=this.map.controls.length;i=0;--i){this._removeButton(this.buttons[i]);}},doubleClick:function(evt){OpenLayers.Event.stop(evt);return false;},buttonDown:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;} +switch(this.action){case"panup":this.map.pan(0,-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(evt);},CLASS_NAME:"OpenLayers.Control.PanZoom"});OpenLayers.Control.PanZoom.X=4;OpenLayers.Control.PanZoom.Y=4;OpenLayers.Control.Panel=OpenLayers.Class(OpenLayers.Control,{controls:null,autoActivate:true,defaultControl:null,saveState:false,activeState:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.controls=[];this.activeState={};},destroy:function(){OpenLayers.Control.prototype.destroy.apply(this,arguments);for(var i=this.controls.length-1;i>=0;i--){if(this.controls[i].events){this.controls[i].events.un({"activate":this.redraw,"deactivate":this.redraw,scope:this});} +OpenLayers.Event.stopObservingElement(this.controls[i].panel_div);this.controls[i].panel_div=null;} +this.activeState=null;},activate:function(){if(OpenLayers.Control.prototype.activate.apply(this,arguments)){var control;for(var i=0,len=this.controls.length;i=0;i--){this.div.removeChild(this.div.childNodes[i]);} +this.div.innerHTML="";if(this.active){for(var i=0,len=this.controls.length;i5){barLen=5;}else if(firstChar>2){barLen=2;}else{barLen=1;} +return barLen*pow10;},update:function(){var res=this.map.getResolution();if(!res){return;} +var curMapUnits=this.map.getUnits();var inches=OpenLayers.INCHES_PER_UNIT;var maxSizeData=this.maxWidth*res*inches[curMapUnits];var geodesicRatio=1;if(this.geodesic===true){var maxSizeGeodesic=(this.map.getGeodesicPixelSize().w||0.000001)*this.maxWidth;var maxSizeKilometers=maxSizeData/inches["km"];geodesicRatio=maxSizeGeodesic/maxSizeKilometers;maxSizeData*=geodesicRatio;} +var topUnits;var bottomUnits;if(maxSizeData>100000){topUnits=this.topOutUnits;bottomUnits=this.bottomOutUnits;}else{topUnits=this.topInUnits;bottomUnits=this.bottomInUnits;} +var topMax=maxSizeData/inches[topUnits];var bottomMax=maxSizeData/inches[bottomUnits];var topRounded=this.getBarLen(topMax);var bottomRounded=this.getBarLen(bottomMax);topMax=topRounded/inches[curMapUnits]*inches[topUnits];bottomMax=bottomRounded/inches[curMapUnits]*inches[bottomUnits];var topPx=topMax/res/geodesicRatio;var bottomPx=bottomMax/res/geodesicRatio;if(this.eBottom.style.visibility=="visible"){this.eBottom.style.width=Math.round(bottomPx)+"px";this.eBottom.innerHTML=bottomRounded+" "+bottomUnits;} +if(this.eTop.style.visibility=="visible"){this.eTop.style.width=Math.round(topPx)+"px";this.eTop.innerHTML=topRounded+" "+topUnits;}},CLASS_NAME:"OpenLayers.Control.ScaleLine"});OpenLayers.Control.ZoomIn=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){this.map.zoomIn();},CLASS_NAME:"OpenLayers.Control.ZoomIn"});OpenLayers.Control.ZoomOut=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){this.map.zoomOut();},CLASS_NAME:"OpenLayers.Control.ZoomOut"});OpenLayers.Control.ZoomToMaxExtent=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){if(this.map){this.map.zoomToMaxExtent();}},CLASS_NAME:"OpenLayers.Control.ZoomToMaxExtent"});OpenLayers.Event={observers:false,KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(event){return event.target||event.srcElement;},isLeftClick:function(event){return(((event.which)&&(event.which==1))||((event.button)&&(event.button==1)));},isRightClick:function(event){return(((event.which)&&(event.which==3))||((event.button)&&(event.button==2)));},stop:function(event,allowDefault){if(!allowDefault){if(event.preventDefault){event.preventDefault();}else{event.returnValue=false;}} +if(event.stopPropagation){event.stopPropagation();}else{event.cancelBubble=true;}},findElement:function(event,tagName){var element=OpenLayers.Event.element(event);while(element.parentNode&&(!element.tagName||(element.tagName.toUpperCase()!=tagName.toUpperCase()))){element=element.parentNode;} +return element;},observe:function(elementParam,name,observer,useCapture){var element=OpenLayers.Util.getElement(elementParam);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.attachEvent)){name='keydown';} +if(!this.observers){this.observers={};} +if(!element._eventCacheID){var idPrefix="eventCacheID_";if(element.id){idPrefix=element.id+"_"+idPrefix;} +element._eventCacheID=OpenLayers.Util.createUniqueID(idPrefix);} +var cacheID=element._eventCacheID;if(!this.observers[cacheID]){this.observers[cacheID]=[];} +this.observers[cacheID].push({'element':element,'name':name,'observer':observer,'useCapture':useCapture});if(element.addEventListener){element.addEventListener(name,observer,useCapture);}else if(element.attachEvent){element.attachEvent('on'+name,observer);}},stopObservingElement:function(elementParam){var element=OpenLayers.Util.getElement(elementParam);var cacheID=element._eventCacheID;this._removeElementObservers(OpenLayers.Event.observers[cacheID]);},_removeElementObservers:function(elementObservers){if(elementObservers){for(var i=elementObservers.length-1;i>=0;i--){var entry=elementObservers[i];var args=new Array(entry.element,entry.name,entry.observer,entry.useCapture);var removed=OpenLayers.Event.stopObserving.apply(this,args);}}},stopObserving:function(elementParam,name,observer,useCapture){useCapture=useCapture||false;var element=OpenLayers.Util.getElement(elementParam);var cacheID=element._eventCacheID;if(name=='keypress'){if(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.detachEvent){name='keydown';}} +var foundEntry=false;var elementObservers=OpenLayers.Event.observers[cacheID];if(elementObservers){var i=0;while(!foundEntry&&i
"+"To get rid of this message, select a new BaseLayer "+"in the layer switcher in the upper-right corner.

"+"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.

"+"Developers: For help getting this working correctly, "+"click here",'getLayerWarning':"The ${layerType} Layer was unable to load correctly.

"+"To get rid of this message, select a new BaseLayer "+"in the layer switcher in the upper-right corner.

"+"Most likely, this is because the ${layerLib} library "+"script was not correctly included.

"+"Developers: For help getting this working correctly, "+"click here",'scale':"Scale = 1 : ${scaleDenom}",'W':'W','E':'E','N':'N','S':'S','graticule':'Graticule','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.",'filterEvaluateNotImplemented':"evaluate is not implemented for this filter type.",'end':''};OpenLayers.Popup.AnchoredBubble=OpenLayers.Class(OpenLayers.Popup.Anchored,{rounded:false,initialize:function(id,lonlat,contentSize,contentHTML,anchor,closeBox,closeBoxCallback){this.padding=new OpenLayers.Bounds(0,OpenLayers.Popup.AnchoredBubble.CORNER_SIZE,0,OpenLayers.Popup.AnchoredBubble.CORNER_SIZE);OpenLayers.Popup.Anchored.prototype.initialize.apply(this,arguments);},draw:function(px){OpenLayers.Popup.Anchored.prototype.draw.apply(this,arguments);this.setContentHTML();this.setBackgroundColor();this.setOpacity();return this.div;},updateRelativePosition:function(){this.setRicoCorners();},setSize:function(contentSize){OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments);this.setRicoCorners();},setBackgroundColor:function(color){if(color!=undefined){this.backgroundColor=color;} +if(this.div!=null){if(this.contentDiv!=null){this.div.style.background="transparent";OpenLayers.Rico.Corner.changeColor(this.groupDiv,this.backgroundColor);}}},setOpacity:function(opacity){OpenLayers.Popup.Anchored.prototype.setOpacity.call(this,opacity);if(this.div!=null){if(this.groupDiv!=null){OpenLayers.Rico.Corner.changeOpacity(this.groupDiv,this.opacity);}}},setBorder:function(border){this.border=0;},setRicoCorners:function(){var corners=this.getCornersToRound(this.relativePosition);var options={corners:corners,color:this.backgroundColor,bgColor:"transparent",blend:false};if(!this.rounded){OpenLayers.Rico.Corner.round(this.div,options);this.rounded=true;}else{OpenLayers.Rico.Corner.reRound(this.groupDiv,options);this.setBackgroundColor();this.setOpacity();}},getCornersToRound:function(){var corners=['tl','tr','bl','br'];var corner=OpenLayers.Bounds.oppositeQuadrant(this.relativePosition);OpenLayers.Util.removeItem(corners,corner);return corners.join(" ");},CLASS_NAME:"OpenLayers.Popup.AnchoredBubble"});OpenLayers.Popup.AnchoredBubble.CORNER_SIZE=5;OpenLayers.Projection=OpenLayers.Class({proj:null,projCode:null,titleRegEx:/\+title=[^\+]*/,initialize:function(projCode,options){OpenLayers.Util.extend(this,options);this.projCode=projCode;if(window.Proj4js){this.proj=new Proj4js.Proj(projCode);}},getCode:function(){return this.proj?this.proj.srsCode:this.projCode;},getUnits:function(){return this.proj?this.proj.units:null;},toString:function(){return this.getCode();},equals:function(projection){var p=projection,equals=false;if(p){if(window.Proj4js&&this.proj.defData&&p.proj.defData){equals=this.proj.defData.replace(this.titleRegEx,"")==p.proj.defData.replace(this.titleRegEx,"");}else if(p.getCode){var source=this.getCode(),target=p.getCode();equals=source==target||!!OpenLayers.Projection.transforms[source]&&OpenLayers.Projection.transforms[source][target]===OpenLayers.Projection.nullTransform;}} +return equals;},destroy:function(){delete this.proj;delete this.projCode;},CLASS_NAME:"OpenLayers.Projection"});OpenLayers.Projection.transforms={};OpenLayers.Projection.addTransform=function(from,to,method){if(!OpenLayers.Projection.transforms[from]){OpenLayers.Projection.transforms[from]={};} +OpenLayers.Projection.transforms[from][to]=method;};OpenLayers.Projection.transform=function(point,source,dest){if(source.proj&&dest.proj){point=Proj4js.transform(source.proj,dest.proj,point);}else if(source&&dest&&OpenLayers.Projection.transforms[source.getCode()]&&OpenLayers.Projection.transforms[source.getCode()][dest.getCode()]){OpenLayers.Projection.transforms[source.getCode()][dest.getCode()](point);} +return point;};OpenLayers.Projection.nullTransform=function(point){return point;};OpenLayers.Renderer.SVG=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"http://www.w3.org/2000/svg",xlinkns:"http://www.w3.org/1999/xlink",MAX_PIXEL:15000,translationParameters:null,symbolMetrics:null,supportUse:null,initialize:function(containerID){if(!this.supported()){return;} +OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments);this.translationParameters={x:0,y:0};this.supportUse=(navigator.userAgent.toLowerCase().indexOf("applewebkit/5")==-1);this.symbolMetrics={};},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments);},supported:function(){var svgFeature="http://www.w3.org/TR/SVG11/feature#";return(document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature(svgFeature+"SVG","1.1")||document.implementation.hasFeature(svgFeature+"BasicStructure","1.1")));},inValidRange:function(x,y,xyOnly){var left=x+(xyOnly?0:this.translationParameters.x);var top=y+(xyOnly?0:this.translationParameters.y);return(left>=-this.MAX_PIXEL&&left<=this.MAX_PIXEL&&top>=-this.MAX_PIXEL&&top<=this.MAX_PIXEL);},setExtent:function(extent,resolutionChanged){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var resolution=this.getResolution();var left=-extent.left/resolution;var top=extent.top/resolution;if(resolutionChanged){this.left=left;this.top=top;var extentString="0 0 "+this.size.w+" "+this.size.h;this.rendererRoot.setAttributeNS(null,"viewBox",extentString);this.translate(0,0);return true;}else{var inRange=this.translate(left-this.left,top-this.top);if(!inRange){this.setExtent(extent,true);} +return inRange;}},translate:function(x,y){if(!this.inValidRange(x,y,true)){return false;}else{var transformString="";if(x||y){transformString="translate("+x+","+y+")";} +this.root.setAttributeNS(null,"transform",transformString);this.translationParameters={x:x,y:y};return true;}},setSize:function(size){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);this.rendererRoot.setAttributeNS(null,"width",this.size.w);this.rendererRoot.setAttributeNS(null,"height",this.size.h);},getNodeType:function(geometry,style){var nodeType=null;switch(geometry.CLASS_NAME){case"OpenLayers.Geometry.Point":if(style.externalGraphic){nodeType="image";}else if(this.isComplexSymbol(style.graphicName)){nodeType=this.supportUse===false?"svg":"use";}else{nodeType="circle";} +break;case"OpenLayers.Geometry.Rectangle":nodeType="rect";break;case"OpenLayers.Geometry.LineString":nodeType="polyline";break;case"OpenLayers.Geometry.LinearRing":nodeType="polygon";break;case"OpenLayers.Geometry.Polygon":case"OpenLayers.Geometry.Curve":case"OpenLayers.Geometry.Surface":nodeType="path";break;default:break;} +return nodeType;},setStyle:function(node,style,options){style=style||node._style;options=options||node._options;var r=parseFloat(node.getAttributeNS(null,"r"));var widthFactor=1;var pos;if(node._geometryClass=="OpenLayers.Geometry.Point"&&r){node.style.visibility="";if(style.graphic===false){node.style.visibility="hidden";}else if(style.externalGraphic){pos=this.getPosition(node);if(style.graphicTitle){node.setAttributeNS(null,"title",style.graphicTitle);} +if(style.graphicWidth&&style.graphicHeight){node.setAttributeNS(null,"preserveAspectRatio","none");} +var width=style.graphicWidth||style.graphicHeight;var height=style.graphicHeight||style.graphicWidth;width=width?width:style.pointRadius*2;height=height?height:style.pointRadius*2;var xOffset=(style.graphicXOffset!=undefined)?style.graphicXOffset:-(0.5*width);var yOffset=(style.graphicYOffset!=undefined)?style.graphicYOffset:-(0.5*height);var opacity=style.graphicOpacity||style.fillOpacity;node.setAttributeNS(null,"x",(pos.x+xOffset).toFixed());node.setAttributeNS(null,"y",(pos.y+yOffset).toFixed());node.setAttributeNS(null,"width",width);node.setAttributeNS(null,"height",height);node.setAttributeNS(this.xlinkns,"href",style.externalGraphic);node.setAttributeNS(null,"style","opacity: "+opacity);}else if(this.isComplexSymbol(style.graphicName)){var offset=style.pointRadius*3;var size=offset*2;var id=this.importSymbol(style.graphicName);pos=this.getPosition(node);widthFactor=this.symbolMetrics[id][0]*3/size;var parent=node.parentNode;var nextSibling=node.nextSibling;if(parent){parent.removeChild(node);} +if(this.supportUse===false){var src=document.getElementById(id);node.firstChild&&node.removeChild(node.firstChild);node.appendChild(src.firstChild.cloneNode(true));node.setAttributeNS(null,"viewBox",src.getAttributeNS(null,"viewBox"));}else{node.setAttributeNS(this.xlinkns,"href","#"+id);} +node.setAttributeNS(null,"width",size);node.setAttributeNS(null,"height",size);node.setAttributeNS(null,"x",pos.x-offset);node.setAttributeNS(null,"y",pos.y-offset);if(nextSibling){parent.insertBefore(node,nextSibling);}else if(parent){parent.appendChild(node);}}else{node.setAttributeNS(null,"r",style.pointRadius);} +var rotation=style.rotation;if((rotation!==undefined||node._rotation!==undefined)&&pos){node._rotation=rotation;rotation|=0;if(node.nodeName!=="svg"){node.setAttributeNS(null,"transform","rotate("+rotation+" "+pos.x+" "+ +pos.y+")");}else{var metrics=this.symbolMetrics[id];node.firstChild.setAttributeNS(null,"transform","rotate("+style.rotation+" "+metrics[1]+" "+metrics[2]+")");}}} +if(options.isFilled){node.setAttributeNS(null,"fill",style.fillColor);node.setAttributeNS(null,"fill-opacity",style.fillOpacity);}else{node.setAttributeNS(null,"fill","none");} +if(options.isStroked){node.setAttributeNS(null,"stroke",style.strokeColor);node.setAttributeNS(null,"stroke-opacity",style.strokeOpacity);node.setAttributeNS(null,"stroke-width",style.strokeWidth*widthFactor);node.setAttributeNS(null,"stroke-linecap",style.strokeLinecap||"round");node.setAttributeNS(null,"stroke-linejoin","round");style.strokeDashstyle&&node.setAttributeNS(null,"stroke-dasharray",this.dashStyle(style,widthFactor));}else{node.setAttributeNS(null,"stroke","none");} +if(style.pointerEvents){node.setAttributeNS(null,"pointer-events",style.pointerEvents);} +if(style.cursor!=null){node.setAttributeNS(null,"cursor",style.cursor);} +return node;},dashStyle:function(style,widthFactor){var w=style.strokeWidth*widthFactor;var str=style.strokeDashstyle;switch(str){case'solid':return'none';case'dot':return[1,4*w].join();case'dash':return[4*w,4*w].join();case'dashdot':return[4*w,4*w,1,4*w].join();case'longdash':return[8*w,4*w].join();case'longdashdot':return[8*w,4*w,1,4*w].join();default:return OpenLayers.String.trim(str).replace(/\s+/g,",");}},createNode:function(type,id){var node=document.createElementNS(this.xmlns,type);if(id){node.setAttributeNS(null,"id",id);} +return node;},nodeTypeCompare:function(node,type){return(type==node.nodeName);},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_svgRoot","svg");},createRoot:function(suffix){return this.nodeFactory(this.container.id+suffix,"g");},createDefs:function(){var defs=this.nodeFactory(this.container.id+"_defs","defs");this.rendererRoot.appendChild(defs);return defs;},drawPoint:function(node,geometry){return this.drawCircle(node,geometry,1);},drawCircle:function(node,geometry,radius){var resolution=this.getResolution();var x=(geometry.x/resolution+this.left);var y=(this.top-geometry.y/resolution);if(this.inValidRange(x,y)){node.setAttributeNS(null,"cx",x);node.setAttributeNS(null,"cy",y);node.setAttributeNS(null,"r",radius);return node;}else{return false;}},drawLineString:function(node,geometry){var componentsResult=this.getComponentsString(geometry.components);if(componentsResult.path){node.setAttributeNS(null,"points",componentsResult.path);return(componentsResult.complete?node:null);}else{return false;}},drawLinearRing:function(node,geometry){var componentsResult=this.getComponentsString(geometry.components);if(componentsResult.path){node.setAttributeNS(null,"points",componentsResult.path);return(componentsResult.complete?node:null);}else{return false;}},drawPolygon:function(node,geometry){var d="";var draw=true;var complete=true;var linearRingResult,path;for(var j=0,len=geometry.components.length;j0){if(this.getShortString(components[i-1])){strings.push(this.clipLine(components[i],components[i-1]));}} +if(imaxX){k=(y2-y1)/(x2-x1);x2=x2<0?-maxX:maxX;y2=y1+(x2-x1)*k;} +if(y2<-maxY||y2>maxY){k=(x2-x1)/(y2-y1);y2=y2<0?-maxY:maxY;x2=x1+(y2-y1)*k;} +return x2+","+y2;},getShortString:function(point){var resolution=this.getResolution();var x=(point.x/resolution+this.left);var y=(this.top-point.y/resolution);if(this.inValidRange(x,y)){return x+","+y;}else{return false;}},getPosition:function(node){return({x:parseFloat(node.getAttributeNS(null,"cx")),y:parseFloat(node.getAttributeNS(null,"cy"))});},importSymbol:function(graphicName){if(!this.defs){this.defs=this.createDefs();} +var id=this.container.id+"-"+graphicName;if(document.getElementById(id)!=null){return id;} +var symbol=OpenLayers.Renderer.symbol[graphicName];if(!symbol){throw new Error(graphicName+' is not a valid symbol name');} +var symbolNode=this.nodeFactory(id,"symbol");var node=this.nodeFactory(null,"polygon");symbolNode.appendChild(node);var symbolExtent=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0);var points=[];var x,y;for(var i=0;i=2*parts[1]){return"longdash";} +return(parts[0]==1||parts[1]==1)?"dot":"dash";}else if(parts.length==4){return(1*parts[0]>=2*parts[1])?"longdashdot":"dashdot";} +return"solid";}},createNode:function(type,id){var node=document.createElement(type);if(id){node.id=id;} +node.unselectable='on';node.onselectstart=OpenLayers.Function.False;return node;},nodeTypeCompare:function(node,type){var subType=type;var splitIndex=subType.indexOf(":");if(splitIndex!=-1){subType=subType.substr(splitIndex+1);} +var nodeName=node.nodeName;splitIndex=nodeName.indexOf(":");if(splitIndex!=-1){nodeName=nodeName.substr(splitIndex+1);} +return(subType==nodeName);},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_vmlRoot","div");},createRoot:function(suffix){return this.nodeFactory(this.container.id+suffix,"olv:group");},drawPoint:function(node,geometry){return this.drawCircle(node,geometry,1);},drawCircle:function(node,geometry,radius){if(!isNaN(geometry.x)&&!isNaN(geometry.y)){var resolution=this.getResolution();node.style.left=(((geometry.x/resolution-this.offset.x)|0)-radius)+"px";node.style.top=(((geometry.y/resolution-this.offset.y)|0)-radius)+"px";var diameter=radius*2;node.style.width=diameter+"px";node.style.height=diameter+"px";return node;} +return false;},drawLineString:function(node,geometry){return this.drawLine(node,geometry,false);},drawLinearRing:function(node,geometry){return this.drawLine(node,geometry,true);},drawLine:function(node,geometry,closeLine){this.setNodeDimension(node,geometry);var resolution=this.getResolution();var numComponents=geometry.components.length;var parts=new Array(numComponents);var comp,x,y;for(var i=0;i0){symbolExtent.bottom=symbolExtent.bottom-diff;symbolExtent.top=symbolExtent.top+diff;}else{symbolExtent.left=symbolExtent.left+diff;symbolExtent.right=symbolExtent.right-diff;} +cache={path:path,size:symbolExtent.getWidth(),left:symbolExtent.left,bottom:symbolExtent.bottom};this.symbolCache[id]=cache;return cache;},CLASS_NAME:"OpenLayers.Renderer.VML"});OpenLayers.Renderer.VML.LABEL_SHIFT={"l":0,"c":.5,"r":1,"t":0,"m":.5,"b":1};OpenLayers.Tile=OpenLayers.Class({EVENT_TYPES:["loadstart","loadend","reload","unload"],events:null,id:null,layer:null,url:null,bounds:null,size:null,position:null,isLoading:false,initialize:function(layer,position,bounds,url,size,options){this.layer=layer;this.position=position.clone();this.bounds=bounds.clone();this.url=url;this.size=size.clone();this.id=OpenLayers.Util.createUniqueID("Tile_");this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES);OpenLayers.Util.extend(this,options);},unload:function(){if(this.isLoading){this.isLoading=false;this.events.triggerEvent("unload");}},destroy:function(){this.layer=null;this.bounds=null;this.size=null;this.position=null;this.events.destroy();this.events=null;},clone:function(obj){if(obj==null){obj=new OpenLayers.Tile(this.layer,this.position,this.bounds,this.url,this.size);} +OpenLayers.Util.applyDefaults(obj,this);return obj;},draw:function(){var maxExtent=this.layer.maxExtent;var withinMaxExtent=(maxExtent&&this.bounds.intersectsBounds(maxExtent,false));this.shouldDraw=(withinMaxExtent||this.layer.displayOutsideMaxExtent);this.clear();return this.shouldDraw;},moveTo:function(bounds,position,redraw){if(redraw==null){redraw=true;} +this.bounds=bounds.clone();this.position=position.clone();if(redraw){this.draw();}},clear:function(){},getBoundsFromBaseLayer:function(position){var msg=OpenLayers.i18n('reprojectDeprecated',{'layerName':this.layer.name});OpenLayers.Console.warn(msg);var topLeft=this.layer.map.getLonLatFromLayerPx(position);var bottomRightPx=position.clone();bottomRightPx.x+=this.size.w;bottomRightPx.y+=this.size.h;var bottomRight=this.layer.map.getLonLatFromLayerPx(bottomRightPx);if(topLeft.lon>bottomRight.lon){if(topLeft.lon<0){topLeft.lon=-180-(topLeft.lon+180);}else{bottomRight.lon=180+bottomRight.lon+180;}} +var bounds=new OpenLayers.Bounds(topLeft.lon,bottomRight.lat,bottomRight.lon,topLeft.lat);return bounds;},showTile:function(){if(this.shouldDraw){this.show();}},show:function(){},hide:function(){},CLASS_NAME:"OpenLayers.Tile"});OpenLayers.Control.PanZoomBar=OpenLayers.Class(OpenLayers.Control.PanZoom,{zoomStopWidth:18,zoomStopHeight:11,slider:null,sliderEvents:null,zoombarDiv:null,divEvents:null,zoomWorldIcon:false,forceFixedZoomLevel:false,mouseDragStart:null,zoomStart:null,initialize:function(){OpenLayers.Control.PanZoom.prototype.initialize.apply(this,arguments);},destroy:function(){this._removeZoomBar();this.map.events.un({"changebaselayer":this.redraw,scope:this});OpenLayers.Control.PanZoom.prototype.destroy.apply(this,arguments);delete this.mouseDragStart;delete this.zoomStart;},setMap:function(map){OpenLayers.Control.PanZoom.prototype.setMap.apply(this,arguments);this.map.events.register("changebaselayer",this,this.redraw);},redraw:function(){if(this.div!=null){this.removeButtons();this._removeZoomBar();} +this.draw();},draw:function(px){OpenLayers.Control.prototype.draw.apply(this,arguments);px=this.position.clone();this.buttons=[];var sz=new OpenLayers.Size(18,18);var centered=new OpenLayers.Pixel(px.x+sz.w/2,px.y);var wposition=sz.w;if(this.zoomWorldIcon){centered=new OpenLayers.Pixel(px.x+sz.w,px.y);} +this._addButton("panup","north-mini.png",centered,sz);px.y=centered.y+sz.h;this._addButton("panleft","west-mini.png",px,sz);if(this.zoomWorldIcon){this._addButton("zoomworld","zoom-world-mini.png",px.add(sz.w,0),sz);wposition*=2;} +this._addButton("panright","east-mini.png",px.add(wposition,0),sz);this._addButton("pandown","south-mini.png",centered.add(0,sz.h*2),sz);this._addButton("zoomin","zoom-plus-mini.png",centered.add(0,sz.h*3+5),sz);centered=this._addZoomBar(centered.add(0,sz.h*4+5));this._addButton("zoomout","zoom-minus-mini.png",centered,sz);return this.div;},_addZoomBar:function(centered){var imgLocation=OpenLayers.Util.getImagesLocation();var id=this.id+"_"+this.map.id;var zoomsToEnd=this.map.getNumZoomLevels()-1-this.map.getZoom();var slider=OpenLayers.Util.createAlphaImageDiv(id,centered.add(-1,zoomsToEnd*this.zoomStopHeight),new OpenLayers.Size(20,9),imgLocation+"slider.png","absolute");this.slider=slider;this.sliderEvents=new OpenLayers.Events(this,slider,null,true,{includeXY:true});this.sliderEvents.on({"mousedown":this.zoomBarDown,"mousemove":this.zoomBarDrag,"mouseup":this.zoomBarUp,"dblclick":this.doubleClick,"click":this.doubleClick});var sz=new OpenLayers.Size();sz.h=this.zoomStopHeight*this.map.getNumZoomLevels();sz.w=this.zoomStopWidth;var div=null;if(OpenLayers.Util.alphaHack()){var id=this.id+"_"+this.map.id;div=OpenLayers.Util.createAlphaImageDiv(id,centered,new OpenLayers.Size(sz.w,this.zoomStopHeight),imgLocation+"zoombar.png","absolute",null,"crop");div.style.height=sz.h+"px";}else{div=OpenLayers.Util.createDiv('OpenLayers_Control_PanZoomBar_Zoombar'+this.map.id,centered,sz,imgLocation+"zoombar.png");} +this.zoombarDiv=div;this.divEvents=new OpenLayers.Events(this,div,null,true,{includeXY:true});this.divEvents.on({"mousedown":this.divClick,"mousemove":this.passEventToSlider,"dblclick":this.doubleClick,"click":this.doubleClick});this.div.appendChild(div);this.startTop=parseInt(div.style.top);this.div.appendChild(slider);this.map.events.register("zoomend",this,this.moveZoomBar);centered=centered.add(0,this.zoomStopHeight*this.map.getNumZoomLevels());return centered;},_removeZoomBar:function(){this.sliderEvents.un({"mousedown":this.zoomBarDown,"mousemove":this.zoomBarDrag,"mouseup":this.zoomBarUp,"dblclick":this.doubleClick,"click":this.doubleClick});this.sliderEvents.destroy();this.divEvents.un({"mousedown":this.divClick,"mousemove":this.passEventToSlider,"dblclick":this.doubleClick,"click":this.doubleClick});this.divEvents.destroy();this.div.removeChild(this.zoombarDiv);this.zoombarDiv=null;this.div.removeChild(this.slider);this.slider=null;this.map.events.unregister("zoomend",this,this.moveZoomBar);},passEventToSlider:function(evt){this.sliderEvents.handleBrowserEvent(evt);},divClick:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;} +var levels=evt.xy.y/this.zoomStopHeight;if(this.forceFixedZoomLevel||!this.map.fractionalZoom){levels=Math.floor(levels);} +var zoom=(this.map.getNumZoomLevels()-1)-levels;zoom=Math.min(Math.max(zoom,0),this.map.getNumZoomLevels()-1);this.map.zoomTo(zoom);OpenLayers.Event.stop(evt);},zoomBarDown:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;} +this.map.events.on({"mousemove":this.passEventToSlider,"mouseup":this.passEventToSlider,scope:this});this.mouseDragStart=evt.xy.clone();this.zoomStart=evt.xy.clone();this.div.style.cursor="move";this.zoombarDiv.offsets=null;OpenLayers.Event.stop(evt);},zoomBarDrag:function(evt){if(this.mouseDragStart!=null){var deltaY=this.mouseDragStart.y-evt.xy.y;var offsets=OpenLayers.Util.pagePosition(this.zoombarDiv);if((evt.clientY-offsets[1])>0&&(evt.clientY-offsets[1])0){pieces.push(',');} +pieces.push(this.writeNewline(),this.writeIndent(),json);}} +this.level-=1;pieces.push(this.writeNewline(),this.writeIndent(),']');return pieces.join('');},'string':function(string){var m={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};if(/["\\\x00-\x1f]/.test(string)){return'"'+string.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=m[b];if(c){return c;} +c=b.charCodeAt();return'\\u00'+ +Math.floor(c/16).toString(16)+ +(c%16).toString(16);})+'"';} +return'"'+string+'"';},'number':function(number){return isFinite(number)?String(number):"null";},'boolean':function(bool){return String(bool);},'date':function(date){function format(number){return(number<10)?'0'+number:number;} +return'"'+date.getFullYear()+'-'+ +format(date.getMonth()+1)+'-'+ +format(date.getDate())+'T'+ +format(date.getHours())+':'+ +format(date.getMinutes())+':'+ +format(date.getSeconds())+'"';}},CLASS_NAME:"OpenLayers.Format.JSON"});OpenLayers.Format.XML=OpenLayers.Class(OpenLayers.Format,{namespaces:null,namespaceAlias:null,defaultPrefix:null,readers:{},writers:{},xmldom:null,initialize:function(options){if(window.ActiveXObject){this.xmldom=new ActiveXObject("Microsoft.XMLDOM");} +OpenLayers.Format.prototype.initialize.apply(this,[options]);this.namespaces=OpenLayers.Util.extend({},this.namespaces);this.namespaceAlias={};for(var alias in this.namespaces){this.namespaceAlias[this.namespaces[alias]]=alias;}},destroy:function(){this.xmldom=null;OpenLayers.Format.prototype.destroy.apply(this,arguments);},setNamespace:function(alias,uri){this.namespaces[alias]=uri;this.namespaceAlias[uri]=alias;},read:function(text){var index=text.indexOf('<');if(index>0){text=text.substring(index);} +var node=OpenLayers.Util.Try(OpenLayers.Function.bind((function(){var xmldom;if(window.ActiveXObject&&!this.xmldom){xmldom=new ActiveXObject("Microsoft.XMLDOM");}else{xmldom=this.xmldom;} +xmldom.loadXML(text);return xmldom;}),this),function(){return new DOMParser().parseFromString(text,'text/xml');},function(){var req=new XMLHttpRequest();req.open("GET","data:"+"text/xml"+";charset=utf-8,"+encodeURIComponent(text),false);if(req.overrideMimeType){req.overrideMimeType("text/xml");} +req.send(null);return req.responseXML;});if(this.keepData){this.data=node;} +return node;},write:function(node){var data;if(this.xmldom){data=node.xml;}else{var serializer=new XMLSerializer();if(node.nodeType==1){var doc=document.implementation.createDocument("","",null);if(doc.importNode){node=doc.importNode(node,true);} +doc.appendChild(node);data=serializer.serializeToString(doc);}else{data=serializer.serializeToString(node);}} +return data;},createElementNS:function(uri,name){var element;if(this.xmldom){if(typeof uri=="string"){element=this.xmldom.createNode(1,name,uri);}else{element=this.xmldom.createNode(1,name,"");}}else{element=document.createElementNS(uri,name);} +return element;},createTextNode:function(text){var node;if(typeof text!=="string"){text=String(text);} +if(this.xmldom){node=this.xmldom.createTextNode(text);}else{node=document.createTextNode(text);} +return node;},getElementsByTagNameNS:function(node,uri,name){var elements=[];if(node.getElementsByTagNameNS){elements=node.getElementsByTagNameNS(uri,name);}else{var allNodes=node.getElementsByTagName("*");var potentialNode,fullName;for(var i=0,len=allNodes.length;i0){prefix=name.substring(0,split);local=name.substring(split+1);}else{if(parent){prefix=this.namespaceAlias[parent.namespaceURI];}else{prefix=this.defaultPrefix;} +local=name;} +var child=this.writers[prefix][local].apply(this,[obj]);if(parent){parent.appendChild(child);} +return child;},getChildEl:function(node,name,uri){return node&&this.getThisOrNextEl(node.firstChild,name,uri);},getNextEl:function(node,name,uri){return node&&this.getThisOrNextEl(node.nextSibling,name,uri);},getThisOrNextEl:function(node,name,uri){outer:for(var sibling=node;sibling;sibling=sibling.nextSibling){switch(sibling.nodeType){case 1:if((!name||name===(sibling.localName||sibling.nodeName.split(":").pop()))&&(!uri||uri===sibling.namespaceURI)){break outer;} +sibling=null;break outer;case 3:if(/^\s*$/.test(sibling.nodeValue)){break;} +case 4:case 6:case 12:case 10:case 11:sibling=null;break outer;}} +return sibling||null;},lookupNamespaceURI:function(node,prefix){var uri=null;if(node){if(node.lookupNamespaceURI){uri=node.lookupNamespaceURI(prefix);}else{outer:switch(node.nodeType){case 1:if(node.namespaceURI!==null&&node.prefix===prefix){uri=node.namespaceURI;break outer;} +var len=node.attributes.length;if(len){var attr;for(var i=0;i=0;--i){this.controls[i].destroy();} +this.controls=null;} +if(this.layers!=null){for(var i=this.layers.length-1;i>=0;--i){this.layers[i].destroy(false);} +this.layers=null;} +if(this.viewPortDiv){this.div.removeChild(this.viewPortDiv);} +this.viewPortDiv=null;if(this.eventListeners){this.events.un(this.eventListeners);this.eventListeners=null;} +this.events.destroy();this.events=null;},setOptions:function(options){OpenLayers.Util.extend(this,options);},getTileSize:function(){return this.tileSize;},getBy:function(array,property,match){var test=(typeof match.test=="function");var found=OpenLayers.Array.filter(this[array],function(item){return item[property]==match||(test&&match.test(item[property]));});return found;},getLayersBy:function(property,match){return this.getBy("layers",property,match);},getLayersByName:function(match){return this.getLayersBy("name",match);},getLayersByClass:function(match){return this.getLayersBy("CLASS_NAME",match);},getControlsBy:function(property,match){return this.getBy("controls",property,match);},getControlsByClass:function(match){return this.getControlsBy("CLASS_NAME",match);},getLayer:function(id){var foundLayer=null;for(var i=0,len=this.layers.length;ithis.layers.length){idx=this.layers.length;} +if(base!=idx){this.layers.splice(base,1);this.layers.splice(idx,0,layer);for(var i=0,len=this.layers.length;i=0;--i){this.removePopup(this.popups[i]);}} +popup.map=this;this.popups.push(popup);var popupDiv=popup.draw();if(popupDiv){popupDiv.style.zIndex=this.Z_INDEX_BASE['Popup']+ +this.popups.length;this.layerContainerDiv.appendChild(popupDiv);}},removePopup:function(popup){OpenLayers.Util.removeItem(this.popups,popup);if(popup.div){try{this.layerContainerDiv.removeChild(popup.div);} +catch(e){}} +popup.map=null;},getSize:function(){var size=null;if(this.size!=null){size=this.size.clone();} +return size;},updateSize:function(){var newSize=this.getCurrentSize();if(newSize&&!isNaN(newSize.h)&&!isNaN(newSize.w)){this.events.clearMouseCache();var oldSize=this.getSize();if(oldSize==null){this.size=oldSize=newSize;} +if(!newSize.equals(oldSize)){this.size=newSize;for(var i=0,len=this.layers.length;ithis.restrictedExtent.getWidth()){lonlat=new OpenLayers.LonLat(maxCenter.lon,lonlat.lat);}else if(extent.leftthis.restrictedExtent.right){lonlat=lonlat.add(this.restrictedExtent.right- +extent.right,0);} +if(extent.getHeight()>this.restrictedExtent.getHeight()){lonlat=new OpenLayers.LonLat(lonlat.lon,maxCenter.lat);}else if(extent.bottomthis.restrictedExtent.top){lonlat=lonlat.add(0,this.restrictedExtent.top- +extent.top);}}} +var zoomChanged=forceZoomChange||((this.isValidZoomLevel(zoom))&&(zoom!=this.getZoom()));var centerChanged=(this.isValidLonLat(lonlat))&&(!lonlat.equals(this.center));if(zoomChanged||centerChanged||!dragging){if(!this.dragging&&!noEvent){this.events.triggerEvent("movestart");} +if(centerChanged){if((!zoomChanged)&&(this.center)){this.centerLayerContainer(lonlat);} +this.center=lonlat.clone();} +if((zoomChanged)||(this.layerContainerOrigin==null)){this.layerContainerOrigin=this.center.clone();this.layerContainerDiv.style.left="0px";this.layerContainerDiv.style.top="0px";} +if(zoomChanged){this.zoom=zoom;this.resolution=this.getResolutionForZoom(zoom);this.viewRequestID++;} +var bounds=this.getExtent();if(this.baseLayer.visibility){this.baseLayer.moveTo(bounds,zoomChanged,dragging);if(dragging){this.baseLayer.events.triggerEvent("move");}else{this.baseLayer.events.triggerEvent("moveend",{"zoomChanged":zoomChanged});}} +bounds=this.baseLayer.getExtent();for(var i=0,len=this.layers.length;i=0)&&(zoomLevel0){resolution=this.layers[0].getResolution();} +return resolution;},getUnits:function(){var units=null;if(this.baseLayer!=null){units=this.baseLayer.units;} +return units;},getScale:function(){var scale=null;if(this.baseLayer!=null){var res=this.getResolution();var units=this.baseLayer.units;scale=OpenLayers.Util.getScaleFromResolution(res,units);} +return scale;},getZoomForExtent:function(bounds,closest){var zoom=null;if(this.baseLayer!=null){zoom=this.baseLayer.getZoomForExtent(bounds,closest);} +return zoom;},getResolutionForZoom:function(zoom){var resolution=null;if(this.baseLayer){resolution=this.baseLayer.getResolutionForZoom(zoom);} +return resolution;},getZoomForResolution:function(resolution,closest){var zoom=null;if(this.baseLayer!=null){zoom=this.baseLayer.getZoomForResolution(resolution,closest);} +return zoom;},zoomTo:function(zoom){if(this.isValidZoomLevel(zoom)){this.setCenter(null,zoom);}},zoomIn:function(){this.zoomTo(this.getZoom()+1);},zoomOut:function(){this.zoomTo(this.getZoom()-1);},zoomToExtent:function(bounds,closest){var center=bounds.getCenterLonLat();if(this.baseLayer.wrapDateLine){var maxExtent=this.getMaxExtent();bounds=bounds.clone();while(bounds.right0){var separator=(url.indexOf('?')>-1)?'&':'?';url+=separator+paramString;}} +if(config.proxy&&(url.indexOf("http")==0)){if(typeof config.proxy=="function"){url=config.proxy(url);}else{url=config.proxy+encodeURIComponent(url);}} +request.open(config.method,url,config.async,config.user,config.password);for(var header in config.headers){request.setRequestHeader(header,config.headers[header]);} +var events=this.events;var self=this;request.onreadystatechange=function(){if(request.readyState==OpenLayers.Request.XMLHttpRequest.DONE){var proceed=events.triggerEvent("complete",{request:request,config:config,requestUrl:url});if(proceed!==false){self.runCallbacks({request:request,config:config,requestUrl:url});}}};if(config.async===false){request.send(config.data);}else{window.setTimeout(function(){if(request._aborted!==true){request.send(config.data);}},0);} +return request;},runCallbacks:function(options){var request=options.request;var config=options.config;var complete=(config.scope)?OpenLayers.Function.bind(config.callback,config.scope):config.callback;var success;if(config.success){success=(config.scope)?OpenLayers.Function.bind(config.success,config.scope):config.success;} +var failure;if(config.failure){failure=(config.scope)?OpenLayers.Function.bind(config.failure,config.scope):config.failure;} +complete(request);if(!request.status||(request.status>=200&&request.status<300)){this.events.triggerEvent("success",options);if(success){success(request);}} +if(request.status&&(request.status<200||request.status>=300)){this.events.triggerEvent("failure",options);if(failure){failure(request);}}},GET:function(config){config=OpenLayers.Util.extend(config,{method:"GET"});return OpenLayers.Request.issue(config);},POST:function(config){config=OpenLayers.Util.extend(config,{method:"POST"});config.headers=config.headers?config.headers:{};if(!("CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(config.headers))){config.headers["Content-Type"]="application/xml";} +return OpenLayers.Request.issue(config);},PUT:function(config){config=OpenLayers.Util.extend(config,{method:"PUT"});config.headers=config.headers?config.headers:{};if(!("CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(config.headers))){config.headers["Content-Type"]="application/xml";} +return OpenLayers.Request.issue(config);},DELETE:function(config){config=OpenLayers.Util.extend(config,{method:"DELETE"});return OpenLayers.Request.issue(config);},HEAD:function(config){config=OpenLayers.Util.extend(config,{method:"HEAD"});return OpenLayers.Request.issue(config);},OPTIONS:function(config){config=OpenLayers.Util.extend(config,{method:"OPTIONS"});return OpenLayers.Request.issue(config);}};OpenLayers.Tile.Image=OpenLayers.Class(OpenLayers.Tile,{url:null,imgDiv:null,frame:null,layerAlphaHack:null,isBackBuffer:false,lastRatio:1,isFirstDraw:true,backBufferTile:null,maxGetUrlLength:null,initialize:function(layer,position,bounds,url,size,options){OpenLayers.Tile.prototype.initialize.apply(this,arguments);if(this.maxGetUrlLength!=null){OpenLayers.Util.extend(this,OpenLayers.Tile.Image.IFrame);} +this.url=url;this.frame=document.createElement('div');this.frame.style.overflow='hidden';this.frame.style.position='absolute';this.layerAlphaHack=this.layer.alpha&&OpenLayers.Util.alphaHack();},destroy:function(){if(this.imgDiv!=null){this.removeImgDiv();} +this.imgDiv=null;if((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(obj){if(obj==null){obj=new OpenLayers.Tile.Image(this.layer,this.position,this.bounds,this.url,this.size);} +obj=OpenLayers.Tile.prototype.clone.apply(this,[obj]);obj.imgDiv=null;return obj;},draw:function(){if(this.layer!=this.layer.map.baseLayer&&this.layer.reproject){this.bounds=this.getBoundsFromBaseLayer(this.position);} +var drawTile=OpenLayers.Tile.prototype.draw.apply(this,arguments);if((OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1)||this.layer.singleTile){if(drawTile){if(!this.backBufferTile){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{if(this.backBufferTile){this.backBufferTile.clear();}}}else{if(drawTile&&this.isFirstDraw){this.events.register('loadend',this,this.showTile);this.isFirstDraw=false;}} +if(!drawTile){return false;} +if(this.isLoading){this.events.triggerEvent("reload");}else{this.isLoading=true;this.events.triggerEvent("loadstart");} +return this.renderTile();},resetBackBuffer:function(){this.showTile();if(this.backBufferTile&&(this.isFirstDraw||!this.layer.numLoadingTiles)){this.isFirstDraw=false;var maxExtent=this.layer.maxExtent;var withinMaxExtent=(maxExtent&&this.bounds.intersectsBounds(maxExtent,false));if(withinMaxExtent){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(){if(this.layer.async){this.initImgDiv();this.layer.getURLasync(this.bounds,this,"url",this.positionImage);}else{this.url=this.layer.getURL(this.bounds);this.initImgDiv();this.positionImage();} +return true;},positionImage:function(){if(this.layer===null){return;} +OpenLayers.Util.modifyDOMElement(this.frame,null,this.position,this.size);var imageSize=this.layer.getImageSize(this.bounds);if(this.layerAlphaHack){OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv,null,null,imageSize,this.url);}else{OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,imageSize);this.imgDiv.src=this.url;}},clear:function(){if(this.imgDiv){this.hide();if(OpenLayers.Tile.Image.useBlankTile){this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif";}}},initImgDiv:function(){if(this.imgDiv==null){var offset=this.layer.imageOffset;var size=this.layer.getImageSize(this.bounds);if(this.layerAlphaHack){this.imgDiv=OpenLayers.Util.createAlphaImageDiv(null,offset,size,null,"relative",null,null,null,true);}else{this.imgDiv=OpenLayers.Util.createImage(null,offset,size,null,"relative",null,null,true);} +if(this.layer.url instanceof Array){this.imgDiv.urls=this.layer.url.slice();} +this.imgDiv.className='olTileImage';this.frame.style.zIndex=this.isBackBuffer?0:1;this.frame.appendChild(this.imgDiv);this.layer.div.appendChild(this.frame);if(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 onload=function(){if(this.isLoading){this.isLoading=false;this.events.triggerEvent("loadend");}};if(this.layerAlphaHack){OpenLayers.Event.observe(this.imgDiv.childNodes[0],'load',OpenLayers.Function.bind(onload,this));}else{OpenLayers.Event.observe(this.imgDiv,'load',OpenLayers.Function.bind(onload,this));} +var onerror=function(){if(this.imgDiv._attempts>OpenLayers.IMAGE_RELOAD_ATTEMPTS){onload.call(this);}};OpenLayers.Event.observe(this.imgDiv,"error",OpenLayers.Function.bind(onerror,this));} +this.imgDiv.viewRequestID=this.layer.map.viewRequestID;},removeImgDiv:function(){OpenLayers.Event.stopObservingElement(this.imgDiv);if(this.imgDiv.parentNode==this.frame){this.frame.removeChild(this.imgDiv);this.imgDiv.map=null;} +this.imgDiv.urls=null;var child=this.imgDiv.firstChild;if(child){OpenLayers.Event.stopObservingElement(child);this.imgDiv.removeChild(child);delete child;}else{this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif";}},checkImgURL:function(){if(this.layer){var loaded=this.layerAlphaHack?this.imgDiv.firstChild.src:this.imgDiv.src;if(!OpenLayers.Util.isEquivalentUrl(loaded,this.url)){this.hide();}}},startTransition:function(){if(!this.backBufferTile||!this.backBufferTile.imgDiv){return;} +var ratio=1;if(this.backBufferTile.resolution){ratio=this.backBufferTile.resolution/this.layer.getResolution();} +if(ratio!=this.lastRatio){if(this.layer.transitionEffect=='resize'){var upperLeft=new OpenLayers.LonLat(this.backBufferTile.bounds.left,this.backBufferTile.bounds.top);var size=new OpenLayers.Size(this.backBufferTile.size.w*ratio,this.backBufferTile.size.h*ratio);var px=this.layer.map.getLayerPxFromLonLat(upperLeft);OpenLayers.Util.modifyDOMElement(this.backBufferTile.frame,null,px,size);var imageSize=this.backBufferTile.imageSize;imageSize=new OpenLayers.Size(imageSize.w*ratio,imageSize.h*ratio);var imageOffset=this.backBufferTile.imageOffset;if(imageOffset){imageOffset=new OpenLayers.Pixel(imageOffset.x*ratio,imageOffset.y*ratio);} +OpenLayers.Util.modifyDOMElement(this.backBufferTile.imgDiv,null,imageOffset,imageSize);this.backBufferTile.show();}}else{if(this.layer.singleTile){this.backBufferTile.show();}else{this.backBufferTile.hide();}} +this.lastRatio=ratio;},show:function(){this.frame.style.display='';if(OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1){if(OpenLayers.IS_GECKO===true){this.frame.scrollLeft=this.frame.scrollLeft;}}},hide:function(){this.frame.style.display='none';},CLASS_NAME:"OpenLayers.Tile.Image"});OpenLayers.Tile.Image.useBlankTile=(OpenLayers.BROWSER_NAME=="safari"||OpenLayers.BROWSER_NAME=="opera");OpenLayers.Feature=OpenLayers.Class({layer:null,id:null,lonlat:null,data:null,marker:null,popupClass:OpenLayers.Popup.AnchoredBubble,popup:null,initialize:function(layer,lonlat,data){this.layer=layer;this.lonlat=lonlat;this.data=(data!=null)?data:{};this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");},destroy:function(){if((this.layer!=null)&&(this.layer.map!=null)){if(this.popup!=null){this.layer.map.removePopup(this.popup);}} +if(this.layer!=null&&this.marker!=null){this.layer.removeMarker(this.marker);} +this.layer=null;this.id=null;this.lonlat=null;this.data=null;if(this.marker!=null){this.destroyMarker(this.marker);this.marker=null;} +if(this.popup!=null){this.destroyPopup(this.popup);this.popup=null;}},onScreen:function(){var onScreen=false;if((this.layer!=null)&&(this.layer.map!=null)){var screenBounds=this.layer.map.getExtent();onScreen=screenBounds.containsLonLat(this.lonlat);} +return onScreen;},createMarker:function(){if(this.lonlat!=null){this.marker=new OpenLayers.Marker(this.lonlat,this.data.icon);} +return this.marker;},destroyMarker:function(){this.marker.destroy();},createPopup:function(closeBox){if(this.lonlat!=null){var id=this.id+"_popup";var anchor=(this.marker)?this.marker.icon:null;if(!this.popup){this.popup=new this.popupClass(id,this.lonlat,this.data.popupSize,this.data.popupContentHTML,anchor,closeBox);} +if(this.data.overflow!=null){this.popup.contentDiv.style.overflow=this.data.overflow;} +this.popup.feature=this;} +return this.popup;},destroyPopup:function(){if(this.popup){this.popup.feature=null;this.popup.destroy();this.popup=null;}},CLASS_NAME:"OpenLayers.Feature"});OpenLayers.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(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);if(this.pixelTolerance!=null){this.mousedown=function(evt){this.down=evt.xy;return true;};}},mousedown:null,mouseup:function(evt){var propagate=true;if(this.checkModifiers(evt)&&this.control.handleRightClicks&&OpenLayers.Event.isRightClick(evt)){propagate=this.rightclick(evt);} +return propagate;},rightclick:function(evt){if(this.passesTolerance(evt)){if(this.rightclickTimerId!=null){this.clearTimer();this.callback('dblrightclick',[evt]);return!this.stopDouble;}else{var clickEvent=this['double']?OpenLayers.Util.extend({},evt):this.callback('rightclick',[evt]);var delayedRightCall=OpenLayers.Function.bind(this.delayedRightCall,this,clickEvent);this.rightclickTimerId=window.setTimeout(delayedRightCall,this.delay);}} +return!this.stopSingle;},delayedRightCall:function(evt){this.rightclickTimerId=null;if(evt){this.callback('rightclick',[evt]);} +return!this.stopSingle;},dblclick:function(evt){if(this.passesTolerance(evt)){if(this["double"]){this.callback('dblclick',[evt]);} +this.clearTimer();} +return!this.stopDouble;},click:function(evt){if(this.passesTolerance(evt)){if(this.timerId!=null){this.clearTimer();}else{var clickEvent=this.single?OpenLayers.Util.extend({},evt):null;this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,clickEvent),this.delay);}} +return!this.stopSingle;},passesTolerance:function(evt){var passes=true;if(this.pixelTolerance!=null&&this.down){var dpx=Math.sqrt(Math.pow(this.down.x-evt.xy.x,2)+ +Math.pow(this.down.y-evt.xy.y,2));if(dpx>this.pixelTolerance){passes=false;}} +return passes;},clearTimer:function(){if(this.timerId!=null){window.clearTimeout(this.timerId);this.timerId=null;} +if(this.rightclickTimerId!=null){window.clearTimeout(this.rightclickTimerId);this.rightclickTimerId=null;}},delayedCall:function(evt){this.timerId=null;if(evt){this.callback('click',[evt]);}},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.clearTimer();this.down=null;deactivated=true;} +return deactivated;},CLASS_NAME:"OpenLayers.Handler.Click"});OpenLayers.Handler.Drag=OpenLayers.Class(OpenLayers.Handler,{started:false,stopDown:true,dragging:false,last:null,start:null,oldOnselectstart:null,interval:0,timeoutId:null,documentDrag:false,documentEvents:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);},down:function(evt){},move:function(evt){},up:function(evt){},out:function(evt){},mousedown:function(evt){var propagate=true;this.dragging=false;if(this.checkModifiers(evt)&&OpenLayers.Event.isLeftClick(evt)){this.started=true;this.start=evt.xy;this.last=evt.xy;OpenLayers.Element.addClass(this.map.viewPortDiv,"olDragDown");this.down(evt);this.callback("down",[evt.xy]);OpenLayers.Event.stop(evt);if(!this.oldOnselectstart){this.oldOnselectstart=(document.onselectstart)?document.onselectstart:OpenLayers.Function.True;} +document.onselectstart=OpenLayers.Function.False;propagate=!this.stopDown;}else{this.started=false;this.start=null;this.last=null;} +return propagate;},mousemove:function(evt){if(this.started&&!this.timeoutId&&(evt.xy.x!=this.last.x||evt.xy.y!=this.last.y)){if(this.documentDrag===true&&this.documentEvents){if(evt.element===document){this.adjustXY(evt);this.setEvent(evt);}else{this.destroyDocumentEvents();}} +if(this.interval>0){this.timeoutId=setTimeout(OpenLayers.Function.bind(this.removeTimeout,this),this.interval);} +this.dragging=true;this.move(evt);this.callback("move",[evt.xy]);if(!this.oldOnselectstart){this.oldOnselectstart=document.onselectstart;document.onselectstart=OpenLayers.Function.False;} +this.last=this.evt.xy;} +return true;},removeTimeout:function(){this.timeoutId=null;},mouseup:function(evt){if(this.started){if(this.documentDrag===true&&this.documentEvents){this.adjustXY(evt);this.destroyDocumentEvents();} +var dragged=(this.start!=this.last);this.started=false;this.dragging=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.up(evt);this.callback("up",[evt.xy]);if(dragged){this.callback("done",[evt.xy]);} +document.onselectstart=this.oldOnselectstart;} +return true;},mouseout:function(evt){if(this.started&&OpenLayers.Util.mouseLeft(evt,this.map.div)){if(this.documentDrag===true){this.documentEvents=new OpenLayers.Events(this,document,null,null,{includeXY:true});this.documentEvents.on({mousemove:this.mousemove,mouseup:this.mouseup});OpenLayers.Element.addClass(document.body,"olDragDown");}else{var dragged=(this.start!=this.last);this.started=false;this.dragging=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.out(evt);this.callback("out",[]);if(dragged){this.callback("done",[evt.xy]);} +if(document.onselectstart){document.onselectstart=this.oldOnselectstart;}}} +return true;},click:function(evt){return(this.start==this.last);},activate:function(){var activated=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragging=false;activated=true;} +return activated;},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.started=false;this.dragging=false;this.start=null;this.last=null;deactivated=true;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");} +return deactivated;},adjustXY:function(evt){var pos=OpenLayers.Util.pagePosition(this.map.viewPortDiv);evt.xy.x-=pos[0];evt.xy.y-=pos[1];},destroyDocumentEvents:function(){OpenLayers.Element.removeClass(document.body,"olDragDown");this.documentEvents.destroy();this.documentEvents=null;},CLASS_NAME:"OpenLayers.Handler.Drag"});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(control,layer,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,[control,callbacks,options]);this.layer=layer;},mousedown:function(evt){this.down=evt.xy;return this.handle(evt)?!this.stopDown:true;},mouseup:function(evt){this.up=evt.xy;return this.handle(evt)?!this.stopUp:true;},click:function(evt){return this.handle(evt)?!this.stopClick:true;},mousemove:function(evt){if(!this.callbacks['over']&&!this.callbacks['out']){return true;} +this.handle(evt);return true;},dblclick:function(evt){return!this.handle(evt);},geometryTypeMatches:function(feature){return this.geometryTypes==null||OpenLayers.Util.indexOf(this.geometryTypes,feature.geometry.CLASS_NAME)>-1;},handle:function(evt){if(this.feature&&!this.feature.layer){this.feature=null;} +var type=evt.type;var handled=false;var previouslyIn=!!(this.feature);var click=(type=="click"||type=="dblclick");this.feature=this.layer.getFeatureFromEvent(evt);if(this.feature&&!this.feature.layer){this.feature=null;} +if(this.lastFeature&&!this.lastFeature.layer){this.lastFeature=null;} +if(this.feature){var inNew=(this.feature!=this.lastFeature);if(this.geometryTypeMatches(this.feature)){if(previouslyIn&&inNew){if(this.lastFeature){this.triggerCallback(type,'out',[this.lastFeature]);} +this.triggerCallback(type,'in',[this.feature]);}else if(!previouslyIn||click){this.triggerCallback(type,'in',[this.feature]);} +this.lastFeature=this.feature;handled=true;}else{if(this.lastFeature&&(previouslyIn&&inNew||click)){this.triggerCallback(type,'out',[this.lastFeature]);} +this.feature=null;}}else{if(this.lastFeature&&(previouslyIn||click)){this.triggerCallback(type,'out',[this.lastFeature]);}} +return handled;},triggerCallback:function(type,mode,args){var key=this.EVENTMAP[type][mode];if(key){if(type=='click'&&this.up&&this.down){var dpx=Math.sqrt(Math.pow(this.up.x-this.down.x,2)+ +Math.pow(this.up.y-this.down.y,2));if(dpx<=this.clickTolerance){this.callback(key,args);}}else{this.callback(key,args);}}},activate:function(){var activated=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.moveLayerToTop();this.map.events.on({"removelayer":this.handleMapEvents,"changelayer":this.handleMapEvents,scope:this});activated=true;} +return activated;},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.moveLayerBack();this.feature=null;this.lastFeature=null;this.down=null;this.up=null;this.map.events.un({"removelayer":this.handleMapEvents,"changelayer":this.handleMapEvents,scope:this});deactivated=true;} +return deactivated;},handleMapEvents:function(evt){if(!evt.property||evt.property=="order"){this.moveLayerToTop();}},moveLayerToTop:function(){var index=Math.max(this.map.Z_INDEX_BASE['Feature']-1,this.layer.getZIndex())+1;this.layer.setZIndex(index);},moveLayerBack:function(){var index=this.layer.getZIndex()-1;if(index>=this.map.Z_INDEX_BASE['Feature']){this.layer.setZIndex(index);}else{this.map.setLayerZIndex(this.layer,this.map.getLayerIndex(this.layer));}},CLASS_NAME:"OpenLayers.Handler.Feature"});OpenLayers.Handler.Hover=OpenLayers.Class(OpenLayers.Handler,{delay:500,pixelTolerance:null,stopMove:false,px:null,timerId:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);},mousemove:function(evt){if(this.passesTolerance(evt.xy)){this.clearTimer();this.callback('move',[evt]);this.px=evt.xy;evt=OpenLayers.Util.extend({},evt);this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,evt),this.delay);} +return!this.stopMove;},mouseout:function(evt){if(OpenLayers.Util.mouseLeft(evt,this.map.div)){this.clearTimer();this.callback('move',[evt]);} +return true;},passesTolerance:function(px){var passes=true;if(this.pixelTolerance&&this.px){var dpx=Math.sqrt(Math.pow(this.px.x-px.x,2)+ +Math.pow(this.px.y-px.y,2));if(dpx=0){this.initResolutions();break;}}}},onMapResize:function(){},redraw:function(){var redrawn=false;if(this.map){this.inRange=this.calculateInRange();var extent=this.getExtent();if(extent&&this.inRange&&this.visibility){var zoomChanged=true;this.moveTo(extent,zoomChanged,false);this.events.triggerEvent("moveend",{"zoomChanged":zoomChanged});redrawn=true;}} +return redrawn;},moveTo:function(bounds,zoomChanged,dragging){var display=this.visibility;if(!this.isBaseLayer){display=display&&this.inRange;} +this.display(display);},setMap:function(map){if(this.map==null){this.map=map;this.maxExtent=this.maxExtent||this.map.maxExtent;this.minExtent=this.minExtent||this.map.minExtent;this.projection=this.projection||this.map.projection;if(typeof this.projection=="string"){this.projection=new OpenLayers.Projection(this.projection);} +this.units=this.projection.getUnits()||this.units||this.map.units;this.initResolutions();if(!this.isBaseLayer){this.inRange=this.calculateInRange();var show=((this.visibility)&&(this.inRange));this.div.style.display=show?"":"none";} +this.setTileSize();}},afterAdd:function(){},removeMap:function(map){},getImageSize:function(bounds){return(this.imageSize||this.tileSize);},setTileSize:function(size){var tileSize=(size)?size:((this.tileSize)?this.tileSize:this.map.getTileSize());this.tileSize=tileSize;if(this.gutter){this.imageOffset=new OpenLayers.Pixel(-this.gutter,-this.gutter);this.imageSize=new OpenLayers.Size(tileSize.w+(2*this.gutter),tileSize.h+(2*this.gutter));}},getVisibility:function(){return this.visibility;},setVisibility:function(visibility){if(visibility!=this.visibility){this.visibility=visibility;this.display(visibility);this.redraw();if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"visibility"});} +this.events.triggerEvent("visibilitychanged");}},display:function(display){if(display!=(this.div.style.display!="none")){this.div.style.display=(display&&this.calculateInRange())?"block":"none";}},calculateInRange:function(){var inRange=false;if(this.alwaysInRange){inRange=true;}else{if(this.map){var resolution=this.map.getResolution();inRange=((resolution>=this.minResolution)&&(resolution<=this.maxResolution));}} +return inRange;},setIsBaseLayer:function(isBaseLayer){if(isBaseLayer!=this.isBaseLayer){this.isBaseLayer=isBaseLayer;if(this.map!=null){this.map.events.triggerEvent("changebaselayer",{layer:this});}}},initResolutions:function(){var i,len;var props={},alwaysInRange=true;for(i=0,len=this.RESOLUTION_PROPERTIES.length;i=resolution){highRes=res;lowZoom=i;} +if(res<=resolution){lowRes=res;highZoom=i;break;}} +var dRes=highRes-lowRes;if(dRes>0){zoom=lowZoom+((highRes-resolution)/dRes);}else{zoom=lowZoom;}}else{var diff;var minDiff=Number.POSITIVE_INFINITY;for(var i=0,len=this.resolutions.length;iminDiff){break;} +minDiff=diff;}else{if(this.resolutions[i]4) +this._object.open(sMethod,sUrl,bAsync,sUser,sPassword);else +if(arguments.length>3) +this._object.open(sMethod,sUrl,bAsync,sUser);else +this._object.open(sMethod,sUrl,bAsync);if(!bGecko&&!bIE){this.readyState=cXMLHttpRequest.OPENED;fReadyStateChange(this);} +this._object.onreadystatechange=function(){if(bGecko&&!bAsync) +return;oRequest.readyState=oRequest._object.readyState;fSynchronizeValues(oRequest);if(oRequest._aborted){oRequest.readyState=cXMLHttpRequest.UNSENT;return;} +if(oRequest.readyState==cXMLHttpRequest.DONE){fCleanTransport(oRequest);if(bIE&&bAsync) +window.detachEvent("onunload",fOnUnload);} +if(nState!=oRequest.readyState) +fReadyStateChange(oRequest);nState=oRequest.readyState;}};cXMLHttpRequest.prototype.send=function(vData){if(cXMLHttpRequest.onsend) +cXMLHttpRequest.onsend.apply(this,arguments);if(vData&&vData.nodeType){vData=window.XMLSerializer?new window.XMLSerializer().serializeToString(vData):vData.xml;if(!this._headers["Content-Type"]) +this._object.setRequestHeader("Content-Type","application/xml");} +this._object.send(vData);if(bGecko&&!this._async){this.readyState=cXMLHttpRequest.OPENED;fSynchronizeValues(this);while(this.readyStatecXMLHttpRequest.UNSENT) +this._aborted=true;this._object.abort();fCleanTransport(this);};cXMLHttpRequest.prototype.getAllResponseHeaders=function(){return this._object.getAllResponseHeaders();};cXMLHttpRequest.prototype.getResponseHeader=function(sName){return this._object.getResponseHeader(sName);};cXMLHttpRequest.prototype.setRequestHeader=function(sName,sValue){if(!this._headers) +this._headers={};this._headers[sName]=sValue;return this._object.setRequestHeader(sName,sValue);};cXMLHttpRequest.prototype.addEventListener=function(sName,fHandler,bUseCapture){for(var nIndex=0,oListener;oListener=this._listeners[nIndex];nIndex++) +if(oListener[0]==sName&&oListener[1]==fHandler&&oListener[2]==bUseCapture) +return;this._listeners.push([sName,fHandler,bUseCapture]);};cXMLHttpRequest.prototype.removeEventListener=function(sName,fHandler,bUseCapture){for(var nIndex=0,oListener;oListener=this._listeners[nIndex];nIndex++) +if(oListener[0]==sName&&oListener[1]==fHandler&&oListener[2]==bUseCapture) +break;if(oListener) +this._listeners.splice(nIndex,1);};cXMLHttpRequest.prototype.dispatchEvent=function(oEvent){var oEventPseudo={'type':oEvent.type,'target':this,'currentTarget':this,'eventPhase':2,'bubbles':oEvent.bubbles,'cancelable':oEvent.cancelable,'timeStamp':oEvent.timeStamp,'stopPropagation':function(){},'preventDefault':function(){},'initEvent':function(){}};if(oEventPseudo.type=="readystatechange"&&this.onreadystatechange) +(this.onreadystatechange.handleEvent||this.onreadystatechange).apply(this,[oEventPseudo]);for(var nIndex=0,oListener;oListener=this._listeners[nIndex];nIndex++) +if(oListener[0]==oEventPseudo.type&&!oListener[2]) +(oListener[1].handleEvent||oListener[1]).apply(this,[oEventPseudo]);};cXMLHttpRequest.prototype.toString=function(){return'['+"object"+' '+"XMLHttpRequest"+']';};cXMLHttpRequest.toString=function(){return'['+"XMLHttpRequest"+']';};function fReadyStateChange(oRequest){if(cXMLHttpRequest.onreadystatechange) +cXMLHttpRequest.onreadystatechange.apply(oRequest);oRequest.dispatchEvent({'type':"readystatechange",'bubbles':false,'cancelable':false,'timeStamp':new Date+0});};function fGetDocument(oRequest){var oDocument=oRequest.responseXML,sResponse=oRequest.responseText;if(bIE&&sResponse&&oDocument&&!oDocument.documentElement&&oRequest.getResponseHeader("Content-Type").match(/[^\/]+\/[^\+]+\+xml/)){oDocument=new window.ActiveXObject("Microsoft.XMLDOM");oDocument.async=false;oDocument.validateOnParse=false;oDocument.loadXML(sResponse);} +if(oDocument) +if((bIE&&oDocument.parseError!=0)||!oDocument.documentElement||(oDocument.documentElement&&oDocument.documentElement.tagName=="parsererror")) +return null;return oDocument;};function fSynchronizeValues(oRequest){try{oRequest.responseText=oRequest._object.responseText;}catch(e){} +try{oRequest.responseXML=fGetDocument(oRequest._object);}catch(e){} +try{oRequest.status=oRequest._object.status;}catch(e){} +try{oRequest.statusText=oRequest._object.statusText;}catch(e){}};function fCleanTransport(oRequest){oRequest._object.onreadystatechange=new window.Function;};if(!window.Function.prototype.apply){window.Function.prototype.apply=function(oRequest,oArguments){if(!oArguments) +oArguments=[];oRequest.__func=this;oRequest.__func(oArguments[0],oArguments[1],oArguments[2],oArguments[3],oArguments[4]);delete oRequest.__func;};};OpenLayers.Request.XMLHttpRequest=cXMLHttpRequest;})();OpenLayers.Control.DragPan=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,panned:false,interval:25,documentDrag:false,draw:function(){this.handler=new OpenLayers.Handler.Drag(this,{"move":this.panMap,"done":this.panMapDone},{interval:this.interval,documentDrag:this.documentDrag});},panMap:function(xy){this.panned=true;this.map.pan(this.handler.last.x-xy.x,this.handler.last.y-xy.y,{dragging:this.handler.dragging,animate:false});},panMapDone:function(xy){if(this.panned){this.panMap(xy);this.panned=false;}},CLASS_NAME:"OpenLayers.Control.DragPan"});OpenLayers.Control.KeyboardDefaults=OpenLayers.Class(OpenLayers.Control,{autoActivate:true,slideFactor:75,initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments);},destroy:function(){if(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});},defaultKeyPress:function(evt){switch(evt.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:var size=this.map.getSize();this.map.pan(0,-0.75*size.h);break;case 34:var size=this.map.getSize();this.map.pan(0,0.75*size.h);break;case 35:var size=this.map.getSize();this.map.pan(0.75*size.w,0);break;case 36:var size=this.map.getSize();this.map.pan(-0.75*size.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.State={UNKNOWN:'Unknown',INSERT:'Insert',UPDATE:'Update',DELETE:'Delete'};OpenLayers.Feature.Vector=OpenLayers.Class(OpenLayers.Feature,{fid:null,geometry:null,attributes:null,bounds:null,state:null,style:null,url:null,renderIntent:"default",initialize:function(geometry,attributes,style){OpenLayers.Feature.prototype.initialize.apply(this,[null,null,attributes]);this.lonlat=null;this.geometry=geometry?geometry:null;this.state=null;this.attributes={};if(attributes){this.attributes=OpenLayers.Util.extend(this.attributes,attributes);} +this.style=style?style:null;},destroy:function(){if(this.layer){this.layer.removeFeatures(this);this.layer=null;} +this.geometry=null;OpenLayers.Feature.prototype.destroy.apply(this,arguments);},clone:function(){return new OpenLayers.Feature.Vector(this.geometry?this.geometry.clone():null,this.attributes,this.style);},onScreen:function(boundsOnly){var onScreen=false;if(this.layer&&this.layer.map){var screenBounds=this.layer.map.getExtent();if(boundsOnly){var featureBounds=this.geometry.getBounds();onScreen=screenBounds.intersectsBounds(featureBounds);}else{var screenPoly=screenBounds.toGeometry();onScreen=screenPoly.intersects(this.geometry);}} +return onScreen;},getVisibility:function(){return!(this.style&&this.style.display=='none'||!this.layer||this.layer&&this.layer.styleMap&&this.layer.styleMap.createSymbolizer(this,this.renderIntent).display=='none'||this.layer&&!this.layer.getVisibility());},createMarker:function(){return null;},destroyMarker:function(){},createPopup:function(){return null;},atPoint:function(lonlat,toleranceLon,toleranceLat){var atPoint=false;if(this.geometry){atPoint=this.geometry.atPoint(lonlat,toleranceLon,toleranceLat);} +return atPoint;},destroyPopup:function(){},move:function(location){if(!this.layer||!this.geometry.move){return;} +var pixel;if(location.CLASS_NAME=="OpenLayers.LonLat"){pixel=this.layer.getViewPortPxFromLonLat(location);}else{pixel=location;} +var lastPixel=this.layer.getViewPortPxFromLonLat(this.geometry.getBounds().getCenterLonLat());var res=this.layer.map.getResolution();this.geometry.move(res*(pixel.x-lastPixel.x),res*(lastPixel.y-pixel.y));this.layer.drawFeature(this);return lastPixel;},toState:function(state){if(state==OpenLayers.State.UPDATE){switch(this.state){case OpenLayers.State.UNKNOWN:case OpenLayers.State.DELETE:this.state=state;break;case OpenLayers.State.UPDATE:case OpenLayers.State.INSERT:break;}}else if(state==OpenLayers.State.INSERT){switch(this.state){case OpenLayers.State.UNKNOWN:break;default:this.state=state;break;}}else if(state==OpenLayers.State.DELETE){switch(this.state){case OpenLayers.State.INSERT:break;case OpenLayers.State.DELETE:break;case OpenLayers.State.UNKNOWN:case OpenLayers.State.UPDATE:this.state=state;break;}}else if(state==OpenLayers.State.UNKNOWN){this.state=state;}},CLASS_NAME:"OpenLayers.Feature.Vector"});OpenLayers.Feature.Vector.style={'default':{fillColor:"#ee9900",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#ee9900",strokeOpacity:1,strokeWidth:1,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},'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.Handler.Box=OpenLayers.Class(OpenLayers.Handler,{dragHandler:null,boxDivClassName:'olHandlerBoxZoomBox',boxCharacteristics:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);var callbacks={"down":this.startBox,"move":this.moveBox,"out":this.removeBox,"up":this.endBox};this.dragHandler=new OpenLayers.Handler.Drag(this,callbacks,{keyMask:this.keyMask});},destroy:function(){if(this.dragHandler){this.dragHandler.destroy();this.dragHandler=null;} +OpenLayers.Handler.prototype.destroy.apply(this,arguments);},setMap:function(map){OpenLayers.Handler.prototype.setMap.apply(this,arguments);if(this.dragHandler){this.dragHandler.setMap(map);}},startBox:function(xy){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(xy){var startX=this.dragHandler.start.x;var startY=this.dragHandler.start.y;var deltaX=Math.abs(startX-xy.x);var deltaY=Math.abs(startY-xy.y);this.zoomBox.style.width=Math.max(1,deltaX)+"px";this.zoomBox.style.height=Math.max(1,deltaY)+"px";this.zoomBox.style.left=xy.xstartX){this.zoomBox.style.width=Math.max(1,deltaX-box.xOffset)+"px";} +if(xy.y>startY){this.zoomBox.style.height=Math.max(1,deltaY-box.yOffset)+"px";}}},endBox:function(end){var result;if(Math.abs(this.dragHandler.start.x-end.x)>5||Math.abs(this.dragHandler.start.y-end.y)>5){var start=this.dragHandler.start;var top=Math.min(start.y,end.y);var bottom=Math.max(start.y,end.y);var left=Math.min(start.x,end.x);var right=Math.max(start.x,end.x);result=new OpenLayers.Bounds(left,bottom,right,top);}else{result=this.dragHandler.start.clone();} +this.removeBox();this.callback("done",[result]);},removeBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox);this.zoomBox=null;this.boxCharacteristics=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 xOffset=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-left-width"))+parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-right-width"))+1;var yOffset=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-top-width"))+parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-bottom-width"))+1;var newBoxModel=OpenLayers.BROWSER_NAME=="msie"?document.compatMode!="BackCompat":true;this.boxCharacteristics={xOffset:xOffset,yOffset:yOffset,newBoxModel:newBoxModel};} +return this.boxCharacteristics;},CLASS_NAME:"OpenLayers.Handler.Box"});OpenLayers.Handler.RegularPolygon=OpenLayers.Class(OpenLayers.Handler.Drag,{sides:4,radius:null,snapAngle:null,snapToggle:'shiftKey',layerOptions:null,persist:false,irregular:false,angle:null,fixedRadius:false,feature:null,layer:null,origin:null,initialize:function(control,callbacks,options){if(!(options&&options.layerOptions&&options.layerOptions.styleMap)){this.style=OpenLayers.Util.extend(OpenLayers.Feature.Vector.style['default'],{});} +OpenLayers.Handler.prototype.initialize.apply(this,[control,callbacks,options]);this.options=(options)?options:{};},setOptions:function(newOptions){OpenLayers.Util.extend(this.options,newOptions);OpenLayers.Util.extend(this,newOptions);},activate:function(){var activated=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){var options=OpenLayers.Util.extend({displayInLayerSwitcher:false,calculateInRange:OpenLayers.Function.True},this.layerOptions);this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,options);this.map.addLayer(this.layer);activated=true;} +return activated;},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.Drag.prototype.deactivate.apply(this,arguments)){if(this.dragging){this.cancel();} +if(this.layer.map!=null){this.layer.destroy(false);if(this.feature){this.feature.destroy();}} +this.layer=null;this.feature=null;deactivated=true;} +return deactivated;},down:function(evt){this.fixedRadius=!!(this.radius);var maploc=this.map.getLonLatFromPixel(evt.xy);this.origin=new OpenLayers.Geometry.Point(maploc.lon,maploc.lat);if(!this.fixedRadius||this.irregular){this.radius=this.map.getResolution();} +if(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(evt){var maploc=this.map.getLonLatFromPixel(evt.xy);var point=new OpenLayers.Geometry.Point(maploc.lon,maploc.lat);if(this.irregular){var ry=Math.sqrt(2)*Math.abs(point.y-this.origin.y)/2;this.radius=Math.max(this.map.getResolution()/2,ry);}else if(this.fixedRadius){this.origin=point;}else{this.calculateAngle(point,evt);this.radius=Math.max(this.map.getResolution()/2,point.distanceTo(this.origin));} +this.modifyGeometry();if(this.irregular){var dx=point.x-this.origin.x;var dy=point.y-this.origin.y;var ratio;if(dy==0){ratio=dx/(this.radius*Math.sqrt(2));}else{ratio=dx/dy;} +this.feature.geometry.resize(1,this.origin,ratio);this.feature.geometry.move(dx/2,dy/2);} +this.layer.drawFeature(this.feature,this.style);},up:function(evt){this.finalize();if(this.start==this.last){this.callback("done",[evt.xy]);}},out:function(evt){this.finalize();},createGeometry:function(){this.angle=Math.PI*((1/this.sides)-(1/2));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 angle,point;var ring=this.feature.geometry.components[0];if(ring.components.length!=(this.sides+1)){this.createGeometry();ring=this.feature.geometry.components[0];} +for(var i=0;i0){pieces.push(',');} +geometry=collection[i].geometry;type=geometry.CLASS_NAME.split('.')[2].toLowerCase();if(!this.extract[type]){return null;} +if(this.internalProjection&&this.externalProjection){geometry=geometry.clone();geometry.transform(this.internalProjection,this.externalProjection);} +data=this.extract[type].apply(this,[geometry]);pieces.push(type.toUpperCase()+'('+data+')');} +if(isCollection){pieces.push(')');} +return pieces.join('');},extract:{'point':function(point){return point.x+' '+point.y;},'multipoint':function(multipoint){var array=[];for(var i=0,len=multipoint.components.length;i=bounds.bottom-tilelat*this.buffer)||rowidx=0)&&(testCell=0)){tile=this.grid[testRow][testCell];} +if((tile!=null)&&(!tile.queued)){tileQueue.unshift(tile);tile.queued=true;directionsTried=0;iRow=testRow;iCell=testCell;}else{direction=(direction+1)%4;directionsTried++;}} +for(var i=0,len=tileQueue.length;i-this.tileSize.w*(buffer-1)){this.shiftColumn(true);}else if(tlViewPort.x<-this.tileSize.w*buffer){this.shiftColumn(false);}else if(tlViewPort.y>-this.tileSize.h*(buffer-1)){this.shiftRow(true);}else if(tlViewPort.y<-this.tileSize.h*buffer){this.shiftRow(false);}else{break;}};},shiftRow:function(prepend){var modelRowIndex=(prepend)?0:(this.grid.length-1);var grid=this.grid;var modelRow=grid[modelRowIndex];var resolution=this.map.getResolution();var deltaY=(prepend)?-this.tileSize.h:this.tileSize.h;var deltaLat=resolution*-deltaY;var row=(prepend)?grid.pop():grid.shift();for(var i=0,len=modelRow.length;irows){var row=this.grid.pop();for(var i=0,l=row.length;icolumns){for(var i=0,l=this.grid.length;i0){appliedRules=true;for(var i=0,len=elseRules.length;i0&&appliedRules==false){style.display="none";} +return style;},applySymbolizer:function(rule,style,feature){var symbolizerPrefix=feature.geometry?this.getSymbolizerPrefix(feature.geometry):OpenLayers.Style.SYMBOLIZER_PREFIXES[0];var symbolizer=rule.symbolizer[symbolizerPrefix]||rule.symbolizer;if(this.defaultsPerSymbolizer===true){var defaults=this.defaultStyle;OpenLayers.Util.applyDefaults(symbolizer,{pointRadius:defaults.pointRadius});if(symbolizer.stroke===true||symbolizer.graphic===true){OpenLayers.Util.applyDefaults(symbolizer,{strokeWidth:defaults.strokeWidth,strokeColor:defaults.strokeColor,strokeOpacity:defaults.strokeOpacity,strokeDashstyle:defaults.strokeDashstyle,strokeLinecap:defaults.strokeLinecap});} +if(symbolizer.fill===true||symbolizer.graphic===true){OpenLayers.Util.applyDefaults(symbolizer,{fillColor:defaults.fillColor,fillOpacity:defaults.fillOpacity});} +if(symbolizer.graphic===true){OpenLayers.Util.applyDefaults(symbolizer,{pointRadius:this.defaultStyle.pointRadius,externalGraphic:this.defaultStyle.externalGraphic,graphicName:this.defaultStyle.graphicName,graphicOpacity:this.defaultStyle.graphicOpacity,graphicWidth:this.defaultStyle.graphicWidth,graphicHeight:this.defaultStyle.graphicHeight,graphicXOffset:this.defaultStyle.graphicXOffset,graphicYOffset:this.defaultStyle.graphicYOffset});}} +return this.createLiterals(OpenLayers.Util.extend(style,symbolizer),feature);},createLiterals:function(style,feature){var context=OpenLayers.Util.extend({},feature.attributes||feature.data);OpenLayers.Util.extend(context,this.context);for(var i in this.propertyStyles){style[i]=OpenLayers.Style.createLiteral(style[i],context,feature,i);} +return style;},findPropertyStyles:function(){var propertyStyles={};var style=this.defaultStyle;this.addPropertyStyles(propertyStyles,style);var rules=this.rules;var symbolizer,value;for(var i=0,len=rules.length;i=0&&along1<=1&&along2>=0&&along2<=1){if(!point){intersection=true;}else{var x=seg1.x1+(along1*x12_11);var y=seg1.y1+(along1*y12_11);intersection=new OpenLayers.Geometry.Point(x,y);}}} +if(tolerance){var dist;if(intersection){if(point){var segs=[seg1,seg2];var seg,x,y;outer:for(var i=0;i<2;++i){seg=segs[i];for(var j=1;j<3;++j){x=seg["x"+j];y=seg["y"+j];dist=Math.sqrt(Math.pow(x-intersection.x,2)+ +Math.pow(y-intersection.y,2));if(dist=1.0){x=x2;y=y2;}else{x=x1+along*dx;y=y1+along*dy;} +return{distance:Math.sqrt(Math.pow(x-x0,2)+Math.pow(y-y0,2)),x:x,y:y};};OpenLayers.Layer.TMS=OpenLayers.Class(OpenLayers.Layer.Grid,{serviceVersion:"1.0.0",isBaseLayer:true,tileOrigin:null,serverResolutions:null,zoomOffset:0,initialize:function(name,url,options){var newArguments=[];newArguments.push(name,url,{},options);OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.TMS(this.name,this.url,this.getOptions());} +obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj;},getURL:function(bounds){bounds=this.adjustBounds(bounds);var res=this.map.getResolution();var x=Math.round((bounds.left-this.tileOrigin.lon)/(res*this.tileSize.w));var y=Math.round((bounds.bottom-this.tileOrigin.lat)/(res*this.tileSize.h));var z=this.serverResolutions!=null?OpenLayers.Util.indexOf(this.serverResolutions,res):this.map.getZoom()+this.zoomOffset;var path=this.serviceVersion+"/"+this.layername+"/"+z+"/"+x+"/"+y+"."+this.type;var url=this.url;if(url instanceof Array){url=this.selectUrl(path,url);} +return url+path;},addTile:function(bounds,position){return new OpenLayers.Tile.Image(this,position,bounds,null,this.tileSize);},setMap:function(map){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments);if(!this.tileOrigin){this.tileOrigin=new OpenLayers.LonLat(this.map.maxExtent.left,this.map.maxExtent.bottom);}},CLASS_NAME:"OpenLayers.Layer.TMS"});OpenLayers.Layer.XYZ=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:true,sphericalMercator:false,zoomOffset:0,initialize:function(name,url,options){if(options&&options.sphericalMercator||this.sphericalMercator){options=OpenLayers.Util.extend({maxExtent:new OpenLayers.Bounds(-128*156543.0339,-128*156543.0339,128*156543.0339,128*156543.0339),maxResolution:156543.0339,numZoomLevels:19,units:"m",projection:"EPSG:900913"},options);} +url=url||this.url;name=name||this.name;var newArguments=[name,url,{},options];OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.XYZ(this.name,this.url,this.getOptions());} +obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj;},getURL:function(bounds){var res=this.map.getResolution();var x=Math.round((bounds.left-this.maxExtent.left)/(res*this.tileSize.w));var y=Math.round((this.maxExtent.top-bounds.top)/(res*this.tileSize.h));var z=this.map.getZoom()+this.zoomOffset;var url=this.url;var s=''+x+y+z;if(url instanceof Array) +{url=this.selectUrl(s,url);} +var path=OpenLayers.String.format(url,{'x':x,'y':y,'z':z});return path;},addTile:function(bounds,position){return new OpenLayers.Tile.Image(this,position,bounds,null,this.tileSize);},setMap:function(map){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments);if(!this.tileOrigin){this.tileOrigin=new OpenLayers.LonLat(this.maxExtent.left,this.maxExtent.bottom);}},CLASS_NAME:"OpenLayers.Layer.XYZ"});OpenLayers.Layer.OSM=OpenLayers.Class(OpenLayers.Layer.XYZ,{name:"OpenStreetMap",attribution:"Data CC-By-SA by OpenStreetMap",sphericalMercator:true,url:'http://tile.openstreetmap.org/${z}/${x}/${y}.png',clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.OSM(this.name,this.url,this.getOptions());} +obj=OpenLayers.Layer.XYZ.prototype.clone.apply(this,[obj]);return obj;},CLASS_NAME:"OpenLayers.Layer.OSM"});OpenLayers.Rule=OpenLayers.Class({id:null,name:null,title:null,description:null,context:null,filter:null,elseFilter:false,symbolizer:null,symbolizers:null,minScaleDenominator:null,maxScaleDenominator:null,initialize:function(options){this.symbolizer={};OpenLayers.Util.extend(this,options);if(this.symbolizers){delete this.symbolizer;} +this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");},destroy:function(){for(var i in this.symbolizer){this.symbolizer[i]=null;} +this.symbolizer=null;delete this.symbolizers;},evaluate:function(feature){var context=this.getContext(feature);var applies=true;if(this.minScaleDenominator||this.maxScaleDenominator){var scale=feature.layer.map.getScale();} +if(this.minScaleDenominator){applies=scale>=OpenLayers.Style.createLiteral(this.minScaleDenominator,context);} +if(applies&&this.maxScaleDenominator){applies=scalethis.value;break;case OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO:result=got<=this.value;break;case OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO:result=got>=this.value;break;case OpenLayers.Filter.Comparison.BETWEEN:result=(got>=this.lowerBoundary)&&(got<=this.upperBoundary);break;case OpenLayers.Filter.Comparison.LIKE:var regexp=new RegExp(this.value,"gi");result=regexp.test(got);break;} +return result;},value2regex:function(wildCard,singleChar,escapeChar){if(wildCard=="."){var msg="'.' is an unsupported wildCard character for "+"OpenLayers.Filter.Comparison";OpenLayers.Console.error(msg);return null;} +wildCard=wildCard?wildCard:"*";singleChar=singleChar?singleChar:".";escapeChar=escapeChar?escapeChar:"!";this.value=this.value.replace(new RegExp("\\"+escapeChar+"(.|$)","g"),"\\$1");this.value=this.value.replace(new RegExp("\\"+singleChar,"g"),".");this.value=this.value.replace(new RegExp("\\"+wildCard,"g"),".*");this.value=this.value.replace(new RegExp("\\\\.\\*","g"),"\\"+wildCard);this.value=this.value.replace(new RegExp("\\\\\\.","g"),"\\"+singleChar);return this.value;},regex2value:function(){var value=this.value;value=value.replace(/!/g,"!!");value=value.replace(/(\\)?\\\./g,function($0,$1){return $1?$0:"!.";});value=value.replace(/(\\)?\\\*/g,function($0,$1){return $1?$0:"!*";});value=value.replace(/\\\\/g,"\\");value=value.replace(/\.\*/g,"*");return value;},clone:function(){return OpenLayers.Util.extend(new OpenLayers.Filter.Comparison(),this);},CLASS_NAME:"OpenLayers.Filter.Comparison"});OpenLayers.Filter.Comparison.EQUAL_TO="==";OpenLayers.Filter.Comparison.NOT_EQUAL_TO="!=";OpenLayers.Filter.Comparison.LESS_THAN="<";OpenLayers.Filter.Comparison.GREATER_THAN=">";OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO="<=";OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO=">=";OpenLayers.Filter.Comparison.BETWEEN="..";OpenLayers.Filter.Comparison.LIKE="~";OpenLayers.Geometry.Collection=OpenLayers.Class(OpenLayers.Geometry,{components:null,componentTypes:null,initialize:function(components){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.components=[];if(components!=null){this.addComponents(components);}},destroy:function(){this.components.length=0;this.components=null;OpenLayers.Geometry.prototype.destroy.apply(this,arguments);},clone:function(){var geometry=eval("new "+this.CLASS_NAME+"()");for(var i=0,len=this.components.length;i0){this.setBounds(this.components[0].getBounds());for(var i=1,len=this.components.length;i-1)){if(index!=null&&(index=0;--i){this.removeComponent(components[i]);}},removeComponent:function(component){OpenLayers.Util.removeItem(this.components,component);this.clearBounds();},getLength:function(){var length=0.0;for(var i=0,len=this.components.length;i0)?area:minArea;centroids.push(centroid);} +len=areas.length;if(areaSum===0){for(var i=0;i=0;i--){if(i!=0&&features[i-1].geometry){this.renderer.locked=true;}else{this.renderer.locked=false;} +var feature=features[i];delete this.unrenderedFeatures[feature.id];if(notify){this.events.triggerEvent("beforefeatureremoved",{feature:feature});} +this.features=OpenLayers.Util.removeItem(this.features,feature);feature.layer=null;if(feature.geometry){this.renderer.eraseFeatures(feature);} +if(OpenLayers.Util.indexOf(this.selectedFeatures,feature)!=-1){OpenLayers.Util.removeItem(this.selectedFeatures,feature);} +if(notify){this.events.triggerEvent("featureremoved",{feature:feature});}} +if(notify){this.events.triggerEvent("featuresremoved",{features:features});}},removeAllFeatures:function(options){var notify=!options||!options.silent;var features=this.features;if(notify){this.events.triggerEvent("beforefeaturesremoved",{features:features});} +var feature;for(var i=features.length-1;i>=0;i--){feature=features[i];if(notify){this.events.triggerEvent("beforefeatureremoved",{feature:feature});} +feature.layer=null;if(notify){this.events.triggerEvent("featureremoved",{feature:feature});}} +this.renderer.clear();this.features=[];this.unrenderedFeatures={};this.selectedFeatures=[];if(notify){this.events.triggerEvent("featuresremoved",{features:features});}},destroyFeatures:function(features,options){var all=(features==undefined);if(all){features=this.features;} +if(features){this.removeFeatures(features,options);for(var i=features.length-1;i>=0;i--){features[i].destroy();}}},drawFeature:function(feature,style){if(!this.drawn){return} +if(typeof style!="object"){if(!style&&feature.state===OpenLayers.State.DELETE){style="delete";} +var renderIntent=style||feature.renderIntent;style=feature.style||this.style;if(!style){style=this.styleMap.createSymbolizer(feature,renderIntent);}} +if(!this.renderer.drawFeature(feature,style)){this.unrenderedFeatures[feature.id]=feature;}else{delete this.unrenderedFeatures[feature.id];};},eraseFeatures:function(features){this.renderer.eraseFeatures(features);},getFeatureFromEvent:function(evt){if(!this.renderer){OpenLayers.Console.error(OpenLayers.i18n("getFeatureError"));return null;} +var featureId=this.renderer.getFeatureIdFromEvent(evt);return this.getFeatureById(featureId);},getFeatureBy:function(property,value){var feature=null;for(var i=0,len=this.features.length;i0)){maxExtent=new OpenLayers.Bounds();var geometry=null;for(var i=0,len=features.length;i=0;--i){feature=layer.selectedFeatures[i];if(!options||options.except!=feature){this.unselect(feature);}}}},clickFeature:function(feature){if(!this.hover){var selected=(OpenLayers.Util.indexOf(feature.layer.selectedFeatures,feature)>-1);if(selected){if(this.toggleSelect()){this.unselect(feature);}else if(!this.multipleSelect()){this.unselectAll({except:feature});}}else{if(!this.multipleSelect()){this.unselectAll({except:feature});} +this.select(feature);}}},multipleSelect:function(){return this.multiple||(this.handlers.feature.evt&&this.handlers.feature.evt[this.multipleKey]);},toggleSelect:function(){return this.toggle||(this.handlers.feature.evt&&this.handlers.feature.evt[this.toggleKey]);},clickoutFeature:function(feature){if(!this.hover&&this.clickout){this.unselectAll();}},overFeature:function(feature){var layer=feature.layer;if(this.hover){if(this.highlightOnly){this.highlight(feature);}else if(OpenLayers.Util.indexOf(layer.selectedFeatures,feature)==-1){this.select(feature);}}},outFeature:function(feature){if(this.hover){if(this.highlightOnly){if(feature._lastHighlighter==this.id){if(feature._prevHighlighter&&feature._prevHighlighter!=this.id){delete feature._lastHighlighter;var control=this.map.getControl(feature._prevHighlighter);if(control){control.highlight(feature);}}else{this.unhighlight(feature);}}}else{this.unselect(feature);}}},highlight:function(feature){var layer=feature.layer;var cont=this.events.triggerEvent("beforefeaturehighlighted",{feature:feature});if(cont!==false){feature._prevHighlighter=feature._lastHighlighter;feature._lastHighlighter=this.id;var style=this.selectStyle||this.renderIntent;layer.drawFeature(feature,style);this.events.triggerEvent("featurehighlighted",{feature:feature});}},unhighlight:function(feature){var layer=feature.layer;feature._lastHighlighter=feature._prevHighlighter;delete feature._prevHighlighter;layer.drawFeature(feature,feature.style||feature.layer.style||"default");this.events.triggerEvent("featureunhighlighted",{feature:feature});},select:function(feature){var cont=this.onBeforeSelect.call(this.scope,feature);var layer=feature.layer;if(cont!==false){cont=layer.events.triggerEvent("beforefeatureselected",{feature:feature});if(cont!==false){layer.selectedFeatures.push(feature);this.highlight(feature);if(!this.handlers.feature.lastFeature){this.handlers.feature.lastFeature=layer.selectedFeatures[0];} +layer.events.triggerEvent("featureselected",{feature:feature});this.onSelect.call(this.scope,feature);}}},unselect:function(feature){var layer=feature.layer;this.unhighlight(feature);OpenLayers.Util.removeItem(layer.selectedFeatures,feature);layer.events.triggerEvent("featureunselected",{feature:feature});this.onUnselect.call(this.scope,feature);},selectBox:function(position){if(position instanceof OpenLayers.Bounds){var minXY=this.map.getLonLatFromPixel(new OpenLayers.Pixel(position.left,position.bottom));var maxXY=this.map.getLonLatFromPixel(new OpenLayers.Pixel(position.right,position.top));var bounds=new OpenLayers.Bounds(minXY.lon,minXY.lat,maxXY.lon,maxXY.lat);if(!this.multipleSelect()){this.unselectAll();} +var prevMultiple=this.multiple;this.multiple=true;var layers=this.layers||[this.layer];var layer;for(var l=0;l-1){if(bounds.toGeometry().intersects(feature.geometry)){if(OpenLayers.Util.indexOf(layer.selectedFeatures,feature)==-1){this.select(feature);}}}}} +this.multiple=prevMultiple;}},setMap:function(map){this.handlers.feature.setMap(map);if(this.box){this.handlers.box.setMap(map);} +OpenLayers.Control.prototype.setMap.apply(this,arguments);},setLayer:function(layers){var isActive=this.active;this.unselectAll();this.deactivate();if(this.layers){this.layer.destroy();this.layers=null;} +this.initLayer(layers);this.handlers.feature.layer=this.layer;if(isActive){this.activate();}},CLASS_NAME:"OpenLayers.Control.SelectFeature"});OpenLayers.Geometry.Curve=OpenLayers.Class(OpenLayers.Geometry.MultiPoint,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(points){OpenLayers.Geometry.MultiPoint.prototype.initialize.apply(this,arguments);},getLength:function(){var length=0.0;if(this.components&&(this.components.length>1)){for(var i=1,len=this.components.length;i1)){var p1,p2;for(var i=1,len=geom.components.length;i2)){OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);}},intersects:function(geometry){var intersect=false;var type=geometry.CLASS_NAME;if(type=="OpenLayers.Geometry.LineString"||type=="OpenLayers.Geometry.LinearRing"||type=="OpenLayers.Geometry.Point"){var segs1=this.getSortedSegments();var segs2;if(type=="OpenLayers.Geometry.Point"){segs2=[{x1:geometry.x,y1:geometry.y,x2:geometry.x,y2:geometry.y}];}else{segs2=geometry.getSortedSegments();} +var seg1,seg1x1,seg1x2,seg1y1,seg1y2,seg2,seg2y1,seg2y2;outer:for(var i=0,len=segs1.length;iseg1x2){break;} +if(seg2.x2Math.max(seg1y1,seg1y2)){continue;} +if(Math.max(seg2y1,seg2y2)0){var xDir=seg.x10){lines.unshift(j,1);Array.prototype.splice.apply(targetParts,lines);j+=lines.length-2;} +if(mutual){for(var k=0,len=splits.points.length;k0&&points.length>0){points.push(vert2.clone());sourceParts.push(new OpenLayers.Geometry.LineString(points));}}else{results=target.splitWith(this,options);} +if(targetParts&&targetParts.length>1){targetSplit=true;}else{targetParts=[];} +if(sourceParts&&sourceParts.length>1){sourceSplit=true;}else{sourceParts=[];} +if(targetSplit||sourceSplit){if(mutual){results=[sourceParts,targetParts];}else{results=targetParts;}} +return results;},splitWith:function(geometry,options){return geometry.split(this,options);},getVertices:function(nodes){var vertices;if(nodes===true){vertices=[this.components[0],this.components[this.components.length-1]];}else if(nodes===false){vertices=this.components.slice(1,this.components.length-1);}else{vertices=this.components.slice();} +return vertices;},distanceTo:function(geometry,options){var edge=!(options&&options.edge===false);var details=edge&&options&&options.details;var result,best={};var min=Number.POSITIVE_INFINITY;if(geometry instanceof OpenLayers.Geometry.Point){var segs=this.getSortedSegments();var x=geometry.x;var y=geometry.y;var seg;for(var i=0,len=segs.length;ix&&((y>seg.y1&&yseg.y2))){break;}}} +if(details){best={distance:best.distance,x0:best.x,y0:best.y,x1:x,y1:y};}else{best=best.distance;}}else if(geometry instanceof OpenLayers.Geometry.LineString){var segs0=this.getSortedSegments();var segs1=geometry.getSortedSegments();var seg0,seg1,intersection,x0,y0;var len1=segs1.length;var interOptions={point:true};outer:for(var i=0,len=segs0.length;i4){this.components.pop();OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);var firstPoint=this.components[0];OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[firstPoint]);}},move:function(x,y){for(var i=0,len=this.components.length;i2)){var sumX=0.0;var sumY=0.0;for(var i=0;i2)){var sum=0.0;for(var i=0,len=this.components.length;i2){var p1,p2;for(var i=0;i=x1&&px<=x2)||x1>=x2&&(px<=x1&&px>=x2)){crosses=-1;break;}} +continue;} +cx=approx(getX(py,x1,y1,x2,y2),digs);if(cx==px){if(y1=y1&&py<=y2)||y1>y2&&(py<=y1&&py>=y2)){crosses=-1;break;}} +if(cx<=px){continue;} +if(x1!=x2&&(cxMath.max(x1,x2))){continue;} +if(y1=y1&&pyy2&&(py=y2)){++crosses;}} +var contained=(crosses==-1)?1:!!(crosses&1);return contained;},intersects:function(geometry){var intersect=false;if(geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){intersect=this.containsPoint(geometry);}else if(geometry.CLASS_NAME=="OpenLayers.Geometry.LineString"){intersect=geometry.intersects(this);}else if(geometry.CLASS_NAME=="OpenLayers.Geometry.LinearRing"){intersect=OpenLayers.Geometry.LineString.prototype.intersects.apply(this,[geometry]);}else{for(var i=0,len=geometry.components.length;i1){sourceSplit=true;}else{sourceParts=[];} +if(targetParts&&targetParts.length>1){targetSplit=true;}else{targetParts=[];} +if(sourceSplit||targetSplit){if(mutual){results=[sourceParts,targetParts];}else{results=targetParts;}} +return results;},splitWith:function(geometry,options){var results=null;var mutual=options&&options.mutual;var splits,targetLine,sourceLines,sourceSplit,targetSplit,sourceParts,targetParts;if(geometry instanceof OpenLayers.Geometry.LineString){targetParts=[];sourceParts=[geometry];for(var i=0,len=this.components.length;i1){sourceSplit=true;}else{sourceParts=[];} +if(targetParts&&targetParts.length>1){targetSplit=true;}else{targetParts=[];} +if(sourceSplit||targetSplit){if(mutual){results=[sourceParts,targetParts];}else{results=targetParts;}} +return results;},CLASS_NAME:"OpenLayers.Geometry.MultiLineString"});OpenLayers.Geometry.Polygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LinearRing"],initialize:function(components){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments);},getArea:function(){var area=0.0;if(this.components&&(this.components.length>0)){area+=Math.abs(this.components[0].getArea());for(var i=1,len=this.components.length;i0)){area+=Math.abs(this.components[0].getGeodesicArea(projection));for(var i=1,len=this.components.length;i0){contained=this.components[0].containsPoint(point);if(contained!==1){if(contained&&numRings>1){var hole;for(var i=1;i=this.maxDepth){return false;} +var newOptions=OpenLayers.Util.extend({},options);newOptions.depth++;for(var i=0,len=nodes.length;i0){var track=tracks[0];var container={features:[],feature:feature};this.readNode(track,container);if(container.features.length>0){features.push.apply(features,container.features);}}}else{features.push(feature);}}else{throw"Bad Placemark: "+i;}} +this.features=this.features.concat(features);},readers:{"kml":{"when":function(node,container){container.whens.push(OpenLayers.Date.parse(this.getChildValue(node)));},"_trackPointAttribute":function(node,container){var name=node.nodeName.split(":").pop();container.attributes[name].push(this.getChildValue(node));}},"gx":{"Track":function(node,container){var obj={whens:[],points:[],angles:[]};if(this.trackAttributes){var name;obj.attributes={};for(var i=0,ii=this.trackAttributes.length;i0;if(hasAngles&&obj.whens.length!==obj.angles.length){throw new Error("gx:Track with unequal number of when ("+obj.whens.length+") and gx:angles ("+obj.angles.length+") elements.");} +var feature,point,angles;for(var i=0,ii=obj.whens.length;i2){point.z=parseFloat(coords[2]);} +container.points.push(point);},"angles":function(node,container){var str=this.getChildValue(node);var parts=str.replace(this.regExes.trimSpace,"").split(/\s+/);container.angles.push(parts);}}},parseFeature:function(node){var order=["MultiGeometry","Polygon","LineString","Point"];var type,nodeList,geometry,parser;for(var i=0,len=order.length;i0){var parser=this.parseGeometry[type.toLowerCase()];if(parser){geometry=parser.apply(this,[nodeList[0]]);if(this.internalProjection&&this.externalProjection){geometry.transform(this.externalProjection,this.internalProjection);}}else{OpenLayers.Console.error(OpenLayers.i18n("unsupportedGeometryType",{'geomType':type}));} +break;}} +var attributes;if(this.extractAttributes){attributes=this.parseAttributes(node);} +var feature=new OpenLayers.Feature.Vector(geometry,attributes);var fid=node.getAttribute("id")||node.getAttribute("name");if(fid!=null){feature.fid=fid;} +return feature;},getStyle:function(styleUrl,options){var styleBaseUrl=OpenLayers.Util.removeTail(styleUrl);var newOptions=OpenLayers.Util.extend({},options);newOptions.depth++;newOptions.styleBaseUrl=styleBaseUrl;if(!this.styles[styleUrl]&&!OpenLayers.String.startsWith(styleUrl,"#")&&newOptions.depth<=this.maxDepth&&!this.fetched[styleBaseUrl]){var data=this.fetchLink(styleBaseUrl);if(data){this.parseData(data,newOptions);}} +var style=OpenLayers.Util.extend({},this.styles[styleUrl]);return style;},parseGeometry:{point:function(node){var nodeList=this.getElementsByTagNameNS(node,this.internalns,"coordinates");var coords=[];if(nodeList.length>0){var coordString=nodeList[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.removeSpace,"");coords=coordString.split(",");} +var point=null;if(coords.length>1){if(coords.length==2){coords[2]=null;} +point=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);}else{throw"Bad coordinate string: "+coordString;} +return point;},linestring:function(node,ring){var nodeList=this.getElementsByTagNameNS(node,this.internalns,"coordinates");var line=null;if(nodeList.length>0){var coordString=this.getChildValue(nodeList[0]);coordString=coordString.replace(this.regExes.trimSpace,"");coordString=coordString.replace(this.regExes.trimComma,",");var pointList=coordString.split(this.regExes.splitSpace);var numPoints=pointList.length;var points=new Array(numPoints);var coords,numCoords;for(var i=0;i1){if(coords.length==2){coords[2]=null;} +points[i]=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);}else{throw"Bad LineString point coordinates: "+ +pointList[i];}} +if(numPoints){if(ring){line=new OpenLayers.Geometry.LinearRing(points);}else{line=new OpenLayers.Geometry.LineString(points);}}else{throw"Bad LineString coordinates: "+coordString;}} +return line;},polygon:function(node){var nodeList=this.getElementsByTagNameNS(node,this.internalns,"LinearRing");var numRings=nodeList.length;var components=new Array(numRings);if(numRings>0){var ring;for(var i=0,len=nodeList.length;i=1&&grandchildren.length<=3){var grandchild;switch(grandchildren.length){case 1:grandchild=grandchildren[0];break;case 2:var c1=grandchildren[0];var c2=grandchildren[1];grandchild=(c1.nodeType==3||c1.nodeType==4)?c1:c2;break;case 3:default:grandchild=grandchildren[1];break;} +if(grandchild.nodeType==3||grandchild.nodeType==4){var name=(child.prefix)?child.nodeName.split(":")[1]:child.nodeName;var value=OpenLayers.Util.getXmlNodeValue(grandchild);if(value){value=value.replace(this.regExes.trimSpace,"");attributes[name]=value;}}}}} +return attributes;},parseExtendedData:function(node){var attributes={};var i,len,data,key;var dataNodes=node.getElementsByTagName("Data");for(i=0,len=dataNodes.length;i 0 && setTimeout( function() { + notifyError( STR_TIMEOUT ); + } , timeout ); + + // Re-declare cleanUp function + cleanUp = function() { + timeoutTimer && clearTimeout( timeoutTimer ); + script[ STR_ONREADYSTATECHANGE ] + = script[ STR_ONCLICK ] + = script[ STR_ONLOAD ] + = script[ STR_ONERROR ] + = null; + head[ STR_REMOVE_CHILD ]( script ); + scriptAfter && head[ STR_REMOVE_CHILD ]( scriptAfter ); + }; + + // Install the generic callback + // (BEWARE: global namespace pollution ahoy) + window[ successCallbackName ] = genericCallback; + + // Create the script tag + script = $( STR_SCRIPT_TAG )[ 0 ]; + script.id = STR_JQUERY_JSONP + count++; + + // Set charset if provided + if ( charset ) { + script[ STR_CHARSET ] = charset; + } + + // Callback function + function callback( result ) { + ( script[ STR_ONCLICK ] || noop )(); + result = lastValue; + lastValue = undefined; + result ? notifySuccess( result[ 0 ] ) : notifyError( STR_ERROR ); + } + + // IE: event/htmlFor/onclick trick + // One can't rely on proper order for onreadystatechange + // We have to sniff since FF doesn't like event & htmlFor... at all + if ( browser.msie ) { + + script.event = STR_ONCLICK; + script.htmlFor = script.id; + script[ STR_ONREADYSTATECHANGE ] = function() { + /loaded|complete/.test( script.readyState ) && callback(); + }; + + // All others: standard handlers + } else { + + script[ STR_ONERROR ] = script[ STR_ONLOAD ] = callback; + + browser.opera ? + + // Opera: onerror is not called, use synchronized script execution + ( ( scriptAfter = $( STR_SCRIPT_TAG )[ 0 ] ).text = "jQuery('#" + script.id + "')[0]." + STR_ONERROR + "()" ) + + // Firefox: set script as async to avoid blocking scripts (3.6+ only) + : script[ STR_ASYNC ] = STR_ASYNC; + + ; + } + + // Set source + script.src = url; + + // Append main script + appendScript( script ); + + // Opera: Append trailing script + scriptAfter && appendScript( scriptAfter ); + } + + } , 0 ); + + return xOptions; + } + + // ###################### SETUP FUNCTION ## + jsonp.setup = function( xOptions ) { + $.extend( xOptionsDefaults , xOptions ); + }; + + // ###################### INSTALL in jQuery ## + $.jsonp = jsonp; + +} )( jQuery , setTimeout );if (!org) var org = {}; +if (!org.polymaps) org.polymaps = {}; +(function(po){ + + po.version = "2.4.0"; // semver.org + + var zero = {x: 0, y: 0}; +po.ns = { + svg: "http://www.w3.org/2000/svg", + xlink: "http://www.w3.org/1999/xlink" +}; + +function ns(name) { + var i = name.indexOf(":"); + return i < 0 ? name : { + space: po.ns[name.substring(0, i)], + local: name.substring(i + 1) + }; +} +po.id = (function() { + var id = 0; + return function() { + return ++id; + }; +})(); +po.svg = function(type) { + return document.createElementNS(po.ns.svg, type); +}; +po.transform = function(a, b, c, d, e, f) { + var transform = {}, + zoomDelta, + zoomFraction, + k; + + if (!arguments.length) { + a = 1; c = 0; e = 0; + b = 0; d = 1; f = 0; + } + + transform.zoomFraction = function(x) { + if (!arguments.length) return zoomFraction; + zoomFraction = x; + zoomDelta = Math.floor(zoomFraction + Math.log(Math.sqrt(a * a + b * b + c * c + d * d)) / Math.log(2)); + k = Math.pow(2, -zoomDelta); + return transform; + }; + + transform.apply = function(x) { + var k0 = Math.pow(2, -x.zoom), + k1 = Math.pow(2, x.zoom - zoomDelta); + return { + column: (a * x.column * k0 + c * x.row * k0 + e) * k1, + row: (b * x.column * k0 + d * x.row * k0 + f) * k1, + zoom: x.zoom - zoomDelta + }; + }; + + transform.unapply = function(x) { + var k0 = Math.pow(2, -x.zoom), + k1 = Math.pow(2, x.zoom + zoomDelta); + return { + column: (x.column * k0 * d - x.row * k0 * c - e * d + f * c) / (a * d - b * c) * k1, + row: (x.column * k0 * b - x.row * k0 * a - e * b + f * a) / (c * b - d * a) * k1, + zoom: x.zoom + zoomDelta + }; + }; + + transform.toString = function() { + return "matrix(" + [a * k, b * k, c * k, d * k].join(" ") + " 0 0)"; + }; + + return transform.zoomFraction(0); +}; +po.cache = function(load, unload) { + var cache = {}, + locks = {}, + map = {}, + head = null, + tail = null, + size = 64, + n = 0; + + function remove(tile) { + n--; + if (unload) unload(tile); + delete map[tile.key]; + if (tile.next) tile.next.prev = tile.prev; + else if (tail = tile.prev) tail.next = null; + if (tile.prev) tile.prev.next = tile.next; + else if (head = tile.next) head.prev = null; + } + + function flush() { + for (var tile = tail; n > size; tile = tile.prev) { + if (!tile) break; + if (tile.lock) continue; + remove(tile); + } + } + + cache.peek = function(c) { + return map[[c.zoom, c.column, c.row].join("/")]; + }; + + cache.load = function(c, projection) { + var key = [c.zoom, c.column, c.row].join("/"), + tile = map[key]; + if (tile) { + if (tile.prev) { + tile.prev.next = tile.next; + if (tile.next) tile.next.prev = tile.prev; + else tail = tile.prev; + tile.prev = null; + tile.next = head; + head.prev = tile; + head = tile; + } + tile.lock = 1; + locks[key] = tile; + return tile; + } + tile = { + key: key, + column: c.column, + row: c.row, + zoom: c.zoom, + next: head, + prev: null, + lock: 1 + }; + load.call(null, tile, projection); + locks[key] = map[key] = tile; + if (head) head.prev = tile; + else tail = tile; + head = tile; + n++; + return tile; + }; + + cache.unload = function(key) { + if (!(key in locks)) return false; + var tile = locks[key]; + tile.lock = 0; + delete locks[key]; + if (tile.request && tile.request.abort(false)) remove(tile); + return tile; + }; + + cache.locks = function() { + return locks; + }; + + cache.size = function(x) { + if (!arguments.length) return size; + size = x; + flush(); + return cache; + }; + + cache.flush = function() { + flush(); + return cache; + }; + + cache.clear = function() { + for (var key in map) { + var tile = map[key]; + if (tile.request) tile.request.abort(false); + if (unload) unload(map[key]); + if (tile.lock) { + tile.lock = 0; + tile.element.parentNode.removeChild(tile.element); + } + } + locks = {}; + map = {}; + head = tail = null; + n = 0; + return cache; + }; + + return cache; +}; +po.url = function(template) { + var hosts = []; + + function format(c) { + var max = c.zoom < 0 ? 1 : 1 << c.zoom, + column = c.column % max; + if (column < 0) column += max; + return template.replace(/{(.)}/g, function(s, v) { + switch (v) { + case "S": return hosts[(Math.abs(c.zoom) + c.row + column) % hosts.length]; + case "Z": return c.zoom; + case "X": return column; + case "Y": return c.row; + case "B": { + var nw = po.map.coordinateLocation({row: c.row, column: column, zoom: c.zoom}), + se = po.map.coordinateLocation({row: c.row + 1, column: column + 1, zoom: c.zoom}), + pn = Math.ceil(Math.log(c.zoom) / Math.LN2); + return se.lat.toFixed(pn) + + "," + nw.lon.toFixed(pn) + + "," + nw.lat.toFixed(pn) + + "," + se.lon.toFixed(pn); + } + } + return v; + }); + } + + format.template = function(x) { + if (!arguments.length) return template; + template = x; + return format; + }; + + format.hosts = function(x) { + if (!arguments.length) return hosts; + hosts = x; + return format; + }; + + return format; +}; +po.dispatch = function(that) { + var types = {}; + + that.on = function(type, handler) { + var listeners = types[type] || (types[type] = []); + for (var i = 0; i < listeners.length; i++) { + if (listeners[i].handler == handler) return that; // already registered + } + listeners.push({handler: handler, on: true}); + return that; + }; + + that.off = function(type, handler) { + var listeners = types[type]; + if (listeners) for (var i = 0; i < listeners.length; i++) { + var l = listeners[i]; + if (l.handler == handler) { + l.on = false; + listeners.splice(i, 1); + break; + } + } + return that; + }; + + return function(event) { + var listeners = types[event.type]; + if (!listeners) return; + listeners = listeners.slice(); // defensive copy + for (var i = 0; i < listeners.length; i++) { + var l = listeners[i]; + if (l.on) l.handler.call(that, event); + } + }; +}; +po.queue = (function() { + var queued = [], active = 0, size = 6; + + function process() { + if ((active >= size) || !queued.length) return; + active++; + queued.pop()(); + } + + function dequeue(send) { + for (var i = 0; i < queued.length; i++) { + if (queued[i] == send) { + queued.splice(i, 1); + return true; + } + } + return false; + } + + function request(url, callback, mimeType) { + var req; + + function send() { + req = new XMLHttpRequest(); + if (mimeType) { + req.overrideMimeType(mimeType); + } + req.open("GET", url, true); + req.onreadystatechange = function(e) { + if (req.readyState == 4) { + active--; + if (req.status < 300) callback(req); + process(); + } + }; + req.send(null); + } + + function abort(hard) { + if (dequeue(send)) return true; + if (hard && req) { req.abort(); return true; } + return false; + } + + queued.push(send); + process(); + return {abort: abort}; + } + + function text(url, callback, mimeType) { + return request(url, function(req) { + if (req.responseText) callback(req.responseText); + }, mimeType); + } + + /* + * We the override MIME type here so that you can load local files; some + * browsers don't assign a proper MIME type for local files. + */ + + function json(url, callback) { + return request(url, function(req) { + if (req.responseText) callback(JSON.parse(req.responseText)); + }, "application/json"); + } + + function xml(url, callback) { + return request(url, function(req) { + if (req.responseXML) callback(req.responseXML); + }, "application/xml"); + } + + function image(image, src, callback) { + var img; + + function send() { + img = document.createElement("img"); + img.onerror = function() { + active--; + process(); + }; + img.onload = function() { + active--; + callback(img); + process(); + }; + img.src = src; + image.setAttributeNS(po.ns.xlink, "href", src); + } + + function abort(hard) { + if (dequeue(send)) return true; + if (hard && img) { img.src = "about:"; return true; } // cancels request + return false; + } + + queued.push(send); + process(); + return {abort: abort}; + } + + return {text: text, xml: xml, json: json, image: image}; +})(); +po.map = function() { + var map = {}, + container, + size, + sizeActual = zero, + sizeRadius = zero, // sizeActual / 2 + tileSize = {x: 256, y: 256}, + center = {lat: 37.76487, lon: -122.41948}, + zoom = 12, + zoomFraction = 0, + zoomFactor = 1, // Math.pow(2, zoomFraction) + zoomRange = [1, 18], + angle = 0, + angleCos = 1, // Math.cos(angle) + angleSin = 0, // Math.sin(angle) + angleCosi = 1, // Math.cos(-angle) + angleSini = 0, // Math.sin(-angle) + ymin = -180, // lat2y(centerRange[0].lat) + ymax = 180; // lat2y(centerRange[1].lat) + + var centerRange = [ + {lat: y2lat(ymin), lon: -Infinity}, + {lat: y2lat(ymax), lon: Infinity} + ]; + + map.locationCoordinate = function(l) { + var c = po.map.locationCoordinate(l), + k = Math.pow(2, zoom); + c.column *= k; + c.row *= k; + c.zoom += zoom; + return c; + }; + + map.coordinateLocation = po.map.coordinateLocation; + + map.coordinatePoint = function(tileCenter, c) { + var kc = Math.pow(2, zoom - c.zoom), + kt = Math.pow(2, zoom - tileCenter.zoom), + dx = (c.column * kc - tileCenter.column * kt) * tileSize.x * zoomFactor, + dy = (c.row * kc - tileCenter.row * kt) * tileSize.y * zoomFactor; + return { + x: sizeRadius.x + angleCos * dx - angleSin * dy, + y: sizeRadius.y + angleSin * dx + angleCos * dy + }; + }; + + map.pointCoordinate = function(tileCenter, p) { + var kt = Math.pow(2, zoom - tileCenter.zoom), + dx = (p.x - sizeRadius.x) / zoomFactor, + dy = (p.y - sizeRadius.y) / zoomFactor; + return { + column: tileCenter.column * kt + (angleCosi * dx - angleSini * dy) / tileSize.x, + row: tileCenter.row * kt + (angleSini * dx + angleCosi * dy) / tileSize.y, + zoom: zoom + }; + }; + + map.locationPoint = function(l) { + var k = Math.pow(2, zoom + zoomFraction - 3) / 45, + dx = (l.lon - center.lon) * k * tileSize.x, + dy = (lat2y(center.lat) - lat2y(l.lat)) * k * tileSize.y; + return { + x: sizeRadius.x + angleCos * dx - angleSin * dy, + y: sizeRadius.y + angleSin * dx + angleCos * dy + }; + }; + + map.pointLocation = function(p) { + var k = 45 / Math.pow(2, zoom + zoomFraction - 3), + dx = (p.x - sizeRadius.x) * k, + dy = (p.y - sizeRadius.y) * k; + return { + lon: center.lon + (angleCosi * dx - angleSini * dy) / tileSize.x, + lat: y2lat(lat2y(center.lat) - (angleSini * dx + angleCosi * dy) / tileSize.y) + }; + }; + + function rezoom() { + if (zoomRange) { + if (zoom < zoomRange[0]) zoom = zoomRange[0]; + else if (zoom > zoomRange[1]) zoom = zoomRange[1]; + } + zoomFraction = zoom - (zoom = Math.round(zoom)); + zoomFactor = Math.pow(2, zoomFraction); + } + + function recenter() { + if (!centerRange) return; + var k = 45 / Math.pow(2, zoom + zoomFraction - 3); + + // constrain latitude + var y = Math.max(Math.abs(angleSin * sizeRadius.x + angleCos * sizeRadius.y), + Math.abs(angleSini * sizeRadius.x + angleCosi * sizeRadius.y)), + lat0 = y2lat(ymin - y * k / tileSize.y), + lat1 = y2lat(ymax + y * k / tileSize.y); + center.lat = Math.max(lat0, Math.min(lat1, center.lat)); + + // constrain longitude + var x = Math.max(Math.abs(angleSin * sizeRadius.y + angleCos * sizeRadius.x), + Math.abs(angleSini * sizeRadius.y + angleCosi * sizeRadius.x)), + lon0 = centerRange[0].lon - x * k / tileSize.x, + lon1 = centerRange[1].lon + x * k / tileSize.x; + center.lon = Math.max(lon0, Math.min(lon1, center.lon)); + } + + // a place to capture mouse events if no tiles exist + var rect = po.svg("rect"); + rect.setAttribute("visibility", "hidden"); + rect.setAttribute("pointer-events", "all"); + + map.container = function(x) { + if (!arguments.length) return container; + container = x; + container.setAttribute("class", "map"); + container.appendChild(rect); + return map.resize(); // infer size + }; + + map.focusableParent = function() { + for (var p = container; p; p = p.parentNode) { + if (p.tabIndex >= 0) return p; + } + return window; + }; + + map.mouse = function(e) { + var point = (container.ownerSVGElement || container).createSVGPoint(); + if ((bug44083 < 0) && (window.scrollX || window.scrollY)) { + var svg = document.body.appendChild(po.svg("svg")); + svg.style.position = "absolute"; + svg.style.top = svg.style.left = "0px"; + var ctm = svg.getScreenCTM(); + bug44083 = !(ctm.f || ctm.e); + document.body.removeChild(svg); + } + if (bug44083) { + point.x = e.pageX; + point.y = e.pageY; + } else { + point.x = e.clientX; + point.y = e.clientY; + } + return point.matrixTransform(container.getScreenCTM().inverse()); + }; + + map.size = function(x) { + if (!arguments.length) return sizeActual; + size = x; + return map.resize(); // size tiles + }; + + map.resize = function() { + if (!size) { + rect.setAttribute("width", "100%"); + rect.setAttribute("height", "100%"); + b = rect.getBBox(); + sizeActual = {x: b.width, y: b.height}; + resizer.add(map); + } else { + sizeActual = size; + resizer.remove(map); + } + rect.setAttribute("width", sizeActual.x); + rect.setAttribute("height", sizeActual.y); + sizeRadius = {x: sizeActual.x / 2, y: sizeActual.y / 2}; + recenter(); + map.dispatch({type: "resize"}); + return map; + }; + + map.tileSize = function(x) { + if (!arguments.length) return tileSize; + tileSize = x; + map.dispatch({type: "move"}); + return map; + }; + + map.center = function(x) { + if (!arguments.length) return center; + center = x; + recenter(); + map.dispatch({type: "move"}); + return map; + }; + + map.panBy = function(x) { + var k = 45 / Math.pow(2, zoom + zoomFraction - 3), + dx = x.x * k, + dy = x.y * k; + return map.center({ + lon: center.lon + (angleSini * dy - angleCosi * dx) / tileSize.x, + lat: y2lat(lat2y(center.lat) + (angleSini * dx + angleCosi * dy) / tileSize.y) + }); + }; + + map.centerRange = function(x) { + if (!arguments.length) return centerRange; + centerRange = x; + if (centerRange) { + ymin = centerRange[0].lat > -90 ? lat2y(centerRange[0].lat) : -Infinity; + ymax = centerRange[0].lat < 90 ? lat2y(centerRange[1].lat) : Infinity; + } else { + ymin = -Infinity; + ymax = Infinity; + } + recenter(); + map.dispatch({type: "move"}); + return map; + }; + + map.zoom = function(x) { + if (!arguments.length) return zoom + zoomFraction; + zoom = x; + rezoom(); + return map.center(center); + }; + + map.zoomBy = function(z, x0, l) { + if (arguments.length < 2) return map.zoom(zoom + zoomFraction + z); + + // compute the location of x0 + if (arguments.length < 3) l = map.pointLocation(x0); + + // update the zoom level + zoom = zoom + zoomFraction + z; + rezoom(); + + // compute the new point of the location + var x1 = map.locationPoint(l); + + return map.panBy({x: x0.x - x1.x, y: x0.y - x1.y}); + }; + + map.zoomRange = function(x) { + if (!arguments.length) return zoomRange; + zoomRange = x; + return map.zoom(zoom + zoomFraction); + }; + + map.extent = function(x) { + if (!arguments.length) return [ + map.pointLocation({x: 0, y: sizeActual.y}), + map.pointLocation({x: sizeActual.x, y: 0}) + ]; + + // compute the extent in points, scale factor, and center + var bl = map.locationPoint(x[0]), + tr = map.locationPoint(x[1]), + k = Math.max((tr.x - bl.x) / sizeActual.x, (bl.y - tr.y) / sizeActual.y), + l = map.pointLocation({x: (bl.x + tr.x) / 2, y: (bl.y + tr.y) / 2}); + + // update the zoom level + zoom = zoom + zoomFraction - Math.log(k) / Math.log(2); + rezoom(); + + // set the new center + return map.center(l); + }; + + map.angle = function(x) { + if (!arguments.length) return angle; + angle = x; + angleCos = Math.cos(angle); + angleSin = Math.sin(angle); + angleCosi = Math.cos(-angle); + angleSini = Math.sin(-angle); + recenter(); + map.dispatch({type: "move"}); + return map; + }; + + map.add = function(x) { + x.map(map); + return map; + }; + + map.remove = function(x) { + x.map(null); + return map; + }; + + map.dispatch = po.dispatch(map); + + return map; +}; + +function resizer(e) { + for (var i = 0; i < resizer.maps.length; i++) { + resizer.maps[i].resize(); + } +} + +resizer.maps = []; + +resizer.add = function(map) { + for (var i = 0; i < resizer.maps.length; i++) { + if (resizer.maps[i] == map) return; + } + resizer.maps.push(map); +}; + +resizer.remove = function(map) { + for (var i = 0; i < resizer.maps.length; i++) { + if (resizer.maps[i] == map) { + resizer.maps.splice(i, 1); + return; + } + } +}; + +// Note: assumes single window (no frames, iframes, etc.)! +window.addEventListener("resize", resizer, false); + +// See http://wiki.openstreetmap.org/wiki/Mercator + +function y2lat(y) { + return 360 / Math.PI * Math.atan(Math.exp(y * Math.PI / 180)) - 90; +} + +function lat2y(lat) { + return 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + lat * Math.PI / 360)); +} + +po.map.locationCoordinate = function(l) { + var k = 1 / 360; + return { + column: (l.lon + 180) * k, + row: (180 - lat2y(l.lat)) * k, + zoom: 0 + }; +}; + +po.map.coordinateLocation = function(c) { + var k = 45 / Math.pow(2, c.zoom - 3); + return { + lon: k * c.column - 180, + lat: y2lat(180 - k * c.row) + }; +}; + +// https://bugs.webkit.org/show_bug.cgi?id=44083 +var bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0; +po.layer = function(load, unload) { + var layer = {}, + cache = layer.cache = po.cache(load, unload).size(512), + tile = true, + visible = true, + zoom, + id, + map, + container = po.svg("g"), + transform, + levelZoom, + levels = {}; + + container.setAttribute("class", "layer"); + for (var i = -4; i <= -1; i++) levels[i] = container.appendChild(po.svg("g")); + for (var i = 2; i >= 1; i--) levels[i] = container.appendChild(po.svg("g")); + levels[0] = container.appendChild(po.svg("g")); + + function zoomIn(z) { + var end = levels[0].nextSibling; + for (; levelZoom < z; levelZoom++) { + // -4, -3, -2, -1, +2, +1, =0 // current order + // -3, -2, -1, +2, +1, =0, -4 // insertBefore(-4, end) + // -3, -2, -1, +1, =0, -4, +2 // insertBefore(+2, end) + // -3, -2, -1, =0, -4, +2, +1 // insertBefore(+1, end) + // -4, -3, -2, -1, +2, +1, =0 // relabel + container.insertBefore(levels[-4], end); + container.insertBefore(levels[2], end); + container.insertBefore(levels[1], end); + var t = levels[-4]; + for (var dz = -4; dz < 2;) levels[dz] = levels[++dz]; + levels[dz] = t; + } + } + + function zoomOut(z) { + var end = levels[0].nextSibling; + for (; levelZoom > z; levelZoom--) { + // -4, -3, -2, -1, +2, +1, =0 // current order + // -4, -3, -2, +2, +1, =0, -1 // insertBefore(-1, end) + // +2, -4, -3, -2, +1, =0, -1 // insertBefore(+2, -4) + // -4, -3, -2, -1, +2, +1, =0 // relabel + container.insertBefore(levels[-1], end); + container.insertBefore(levels[2], levels[-4]); + var t = levels[2]; + for (var dz = 2; dz > -4;) levels[dz] = levels[--dz]; + levels[dz] = t; + } + } + + function move() { + var map = layer.map(), // in case the layer is removed + mapZoom = map.zoom(), + mapZoomFraction = mapZoom - (mapZoom = Math.round(mapZoom)), + mapSize = map.size(), + mapAngle = map.angle(), + tileSize = map.tileSize(), + tileCenter = map.locationCoordinate(map.center()); + + // set the layer zoom levels + if (levelZoom != mapZoom) { + if (levelZoom < mapZoom) zoomIn(mapZoom); + else if (levelZoom > mapZoom) zoomOut(mapZoom); + else levelZoom = mapZoom; + for (var z = -4; z <= 2; z++) { + var l = levels[z]; + l.setAttribute("class", "zoom" + (z < 0 ? "" : "+") + z + " zoom" + (mapZoom + z)); + l.setAttribute("transform", "scale(" + Math.pow(2, -z) + ")"); + } + } + + // set the layer transform + container.setAttribute("transform", + "translate(" + (mapSize.x / 2) + "," + (mapSize.y / 2) + ")" + + (mapAngle ? "rotate(" + mapAngle / Math.PI * 180 + ")" : "") + + (mapZoomFraction ? "scale(" + Math.pow(2, mapZoomFraction) + ")" : "") + + (transform ? transform.zoomFraction(mapZoomFraction) : "")); + + // get the coordinates of the four corners + var c0 = map.pointCoordinate(tileCenter, zero), + c1 = map.pointCoordinate(tileCenter, {x: mapSize.x, y: 0}), + c2 = map.pointCoordinate(tileCenter, mapSize), + c3 = map.pointCoordinate(tileCenter, {x: 0, y: mapSize.y}); + + // round to pixel boundary to avoid anti-aliasing artifacts + if (!mapZoomFraction && !mapAngle && !transform) { + tileCenter.column = (Math.round(tileSize.x * tileCenter.column) + (mapSize.x & 1) / 2) / tileSize.x; + tileCenter.row = (Math.round(tileSize.y * tileCenter.row) + (mapSize.y & 1) / 2) / tileSize.y; + } + + // layer-specific coordinate transform + if (transform) { + c0 = transform.unapply(c0); + c1 = transform.unapply(c1); + c2 = transform.unapply(c2); + c3 = transform.unapply(c3); + tileCenter = transform.unapply(tileCenter); + } + + // layer-specific zoom transform + var tileLevel = zoom ? zoom(c0.zoom) - c0.zoom : 0; + if (tileLevel) { + var k = Math.pow(2, tileLevel); + c0.column *= k; c0.row *= k; + c1.column *= k; c1.row *= k; + c2.column *= k; c2.row *= k; + c3.column *= k; c3.row *= k; + c0.zoom = c1.zoom = c2.zoom = c3.zoom += tileLevel; + } + + // tile-specific projection + function projection(c) { + var zoom = c.zoom, + max = zoom < 0 ? 1 : 1 << zoom, + column = c.column % max, + row = c.row; + if (column < 0) column += max; + return { + locationPoint: function(l) { + var c = po.map.locationCoordinate(l), + k = Math.pow(2, zoom - c.zoom); + return { + x: tileSize.x * (k * c.column - column), + y: tileSize.y * (k * c.row - row) + }; + } + }; + } + + // record which tiles are visible + var oldLocks = cache.locks(), newLocks = {}; + + // reset the proxy counts + for (var key in oldLocks) { + oldLocks[key].proxyCount = 0; + } + + // load the tiles! + if (visible && tileLevel > -5 && tileLevel < 3) { + var ymax = c0.zoom < 0 ? 1 : 1 << c0.zoom; + if (tile) { + scanTriangle(c0, c1, c2, 0, ymax, scanLine); + scanTriangle(c2, c3, c0, 0, ymax, scanLine); + } else { + var x = Math.floor((c0.column + c2.column) / 2), + y = Math.max(0, Math.min(ymax - 1, Math.floor((c1.row + c3.row) / 2))), + z = Math.min(4, c0.zoom); + x = x >> z << z; + y = y >> z << z; + scanLine(x, x + 1, y); + } + } + + // scan-line conversion + function scanLine(x0, x1, y) { + var z = c0.zoom, + z0 = 2 - tileLevel, + z1 = 4 + tileLevel; + + for (var x = x0; x < x1; x++) { + var t = cache.load({column: x, row: y, zoom: z}, projection); + if (!t.ready && !(t.key in newLocks)) { + t.proxyRefs = {}; + var c, full, proxy; + + // downsample high-resolution tiles + for (var dz = 1; dz <= z0; dz++) { + full = true; + for (var dy = 0, k = 1 << dz; dy <= k; dy++) { + for (var dx = 0; dx <= k; dx++) { + proxy = cache.peek(c = { + column: (x << dz) + dx, + row: (y << dz) + dy, + zoom: z + dz + }); + if (proxy && proxy.ready) { + newLocks[proxy.key] = cache.load(c); + proxy.proxyCount++; + t.proxyRefs[proxy.key] = proxy; + } else { + full = false; + } + } + } + if (full) break; + } + + // upsample low-resolution tiles + if (!full) { + for (var dz = 1; dz <= z1; dz++) { + proxy = cache.peek(c = { + column: x >> dz, + row: y >> dz, + zoom: z - dz + }); + if (proxy && proxy.ready) { + newLocks[proxy.key] = cache.load(c); + proxy.proxyCount++; + t.proxyRefs[proxy.key] = proxy; + break; + } + } + } + } + newLocks[t.key] = t; + } + } + + // position tiles + for (var key in newLocks) { + var t = newLocks[key], + k = Math.pow(2, t.level = t.zoom - tileCenter.zoom); + t.element.setAttribute("transform", "translate(" + + (t.x = tileSize.x * (t.column - tileCenter.column * k)) + "," + + (t.y = tileSize.y * (t.row - tileCenter.row * k)) + ")"); + } + + // remove tiles that are no longer visible + for (var key in oldLocks) { + if (!(key in newLocks)) { + var t = cache.unload(key); + t.element.parentNode.removeChild(t.element); + delete t.proxyRefs; + } + } + + // append tiles that are now visible + for (var key in newLocks) { + var t = newLocks[key]; + if (t.element.parentNode != levels[t.level]) { + levels[t.level].appendChild(t.element); + if (layer.show) layer.show(t); + } + } + + // flush the cache, clearing no-longer-needed tiles + cache.flush(); + + // dispatch the move event + layer.dispatch({type: "move"}); + } + + // remove proxy tiles when tiles load + function cleanup(e) { + if (e.tile.proxyRefs) { + for (var proxyKey in e.tile.proxyRefs) { + var proxyTile = e.tile.proxyRefs[proxyKey]; + if ((--proxyTile.proxyCount <= 0) && cache.unload(proxyKey)) { + proxyTile.element.parentNode.removeChild(proxyTile.element); + } + } + delete e.tile.proxyRefs; + } + } + + layer.map = function(x) { + if (!arguments.length) return map; + if (map) { + if (map == x) { + container.parentNode.appendChild(container); // move to end + return layer; + } + map.off("move", move).off("resize", move); + container.parentNode.removeChild(container); + } + map = x; + if (map) { + map.container().appendChild(container); + if (layer.init) layer.init(container); + map.on("move", move).on("resize", move); + move(); + } + return layer; + }; + + layer.container = function() { + return container; + }; + + layer.levels = function() { + return levels; + }; + + layer.id = function(x) { + if (!arguments.length) return id; + id = x; + container.setAttribute("id", x); + return layer; + }; + + layer.visible = function(x) { + if (!arguments.length) return visible; + if (visible = x) container.removeAttribute("visibility") + else container.setAttribute("visibility", "hidden"); + if (map) move(); + return layer; + }; + + layer.transform = function(x) { + if (!arguments.length) return transform; + transform = x; + if (map) move(); + return layer; + }; + + layer.zoom = function(x) { + if (!arguments.length) return zoom; + zoom = typeof x == "function" || x == null ? x : function() { return x; }; + if (map) move(); + return layer; + }; + + layer.tile = function(x) { + if (!arguments.length) return tile; + tile = x; + if (map) move(); + return layer; + }; + + layer.reload = function() { + cache.clear(); + if (map) move(); + return layer; + }; + + layer.dispatch = po.dispatch(layer); + layer.on("load", cleanup); + + return layer; +}; + +// scan-line conversion +function edge(a, b) { + if (a.row > b.row) { var t = a; a = b; b = t; } + return { + x0: a.column, + y0: a.row, + x1: b.column, + y1: b.row, + dx: b.column - a.column, + dy: b.row - a.row + }; +} + +// scan-line conversion +function scanSpans(e0, e1, ymin, ymax, scanLine) { + var y0 = Math.max(ymin, Math.floor(e1.y0)), + y1 = Math.min(ymax, Math.ceil(e1.y1)); + + // sort edges by x-coordinate + if ((e0.x0 == e1.x0 && e0.y0 == e1.y0) + ? (e0.x0 + e1.dy / e0.dy * e0.dx < e1.x1) + : (e0.x1 - e1.dy / e0.dy * e0.dx < e1.x0)) { + var t = e0; e0 = e1; e1 = t; + } + + // scan lines! + var m0 = e0.dx / e0.dy, + m1 = e1.dx / e1.dy, + d0 = e0.dx > 0, // use y + 1 to compute x0 + d1 = e1.dx < 0; // use y + 1 to compute x1 + for (var y = y0; y < y1; y++) { + var x0 = m0 * Math.max(0, Math.min(e0.dy, y + d0 - e0.y0)) + e0.x0, + x1 = m1 * Math.max(0, Math.min(e1.dy, y + d1 - e1.y0)) + e1.x0; + scanLine(Math.floor(x1), Math.ceil(x0), y); + } +} + +// scan-line conversion +function scanTriangle(a, b, c, ymin, ymax, scanLine) { + var ab = edge(a, b), + bc = edge(b, c), + ca = edge(c, a); + + // sort edges by y-length + if (ab.dy > bc.dy) { var t = ab; ab = bc; bc = t; } + if (ab.dy > ca.dy) { var t = ab; ab = ca; ca = t; } + if (bc.dy > ca.dy) { var t = bc; bc = ca; ca = t; } + + // scan span! scan span! + if (ab.dy) scanSpans(ca, ab, ymin, ymax, scanLine); + if (bc.dy) scanSpans(ca, bc, ymin, ymax, scanLine); +} +po.image = function() { + var image = po.layer(load, unload), + url; + + function load(tile) { + var element = tile.element = po.svg("image"), size = image.map().tileSize(); + element.setAttribute("preserveAspectRatio", "none"); + element.setAttribute("width", size.x); + element.setAttribute("height", size.y); + + if (typeof url == "function") { + element.setAttribute("opacity", 0); + tile.request = po.queue.image(element, url(tile), function(img) { + delete tile.request; + tile.ready = true; + tile.img = img; + element.removeAttribute("opacity"); + image.dispatch({type: "load", tile: tile}); + }); + } else { + tile.ready = true; + if (url) element.setAttributeNS(po.ns.xlink, "href", url); + image.dispatch({type: "load", tile: tile}); + } + } + + function unload(tile) { + if (tile.request) tile.request.abort(true); + } + + image.url = function(x) { + if (!arguments.length) return url; + url = typeof x == "string" && /{.}/.test(x) ? po.url(x) : x; + return image.reload(); + }; + + return image; +}; +po.geoJson = function(fetch) { + var geoJson = po.layer(load, unload), + container = geoJson.container(), + url, + clip = true, + clipId = "org.polymaps." + po.id(), + clipHref = "url(#" + clipId + ")", + clipPath = container.insertBefore(po.svg("clipPath"), container.firstChild), + clipRect = clipPath.appendChild(po.svg("rect")), + scale = "auto", + zoom = null, + features; + + container.setAttribute("fill-rule", "evenodd"); + clipPath.setAttribute("id", clipId); + + if (!arguments.length) fetch = po.queue.json; + + function projection(proj) { + var l = {lat: 0, lon: 0}; + return function(coordinates) { + l.lat = coordinates[1]; + l.lon = coordinates[0]; + var p = proj(l); + coordinates.x = p.x; + coordinates.y = p.y; + return p; + }; + } + + function geometry(o, proj) { + return o && o.type in types && types[o.type](o, proj); + } + + var types = { + + Point: function(o, proj) { + var p = proj(o.coordinates), + c = po.svg("circle"); + c.setAttribute("r", 4.5); + c.setAttribute("transform", "translate(" + p.x + "," + p.y + ")"); + return c; + }, + + MultiPoint: function(o, proj) { + var g = po.svg("g"), + c = o.coordinates, + p, // proj(c[i]) + x, // svg:circle + i = -1, + n = c.length; + while (++i < n) { + x = g.appendChild(po.svg("circle")); + x.setAttribute("r", 4.5); + x.setAttribute("transform", "translate(" + (p = proj(c[i])).x + "," + p.y + ")"); + } + return g; + }, + + LineString: function(o, proj) { + var x = po.svg("path"), + d = ["M"], + c = o.coordinates, + p, // proj(c[i]) + i = -1, + n = c.length; + while (++i < n) d.push((p = proj(c[i])).x, ",", p.y, "L"); + d.pop(); + if (!d.length) return; + x.setAttribute("d", d.join("")); + return x; + }, + + MultiLineString: function(o, proj) { + var x = po.svg("path"), + d = [], + ci = o.coordinates, + cj, // ci[i] + i = -1, + j, + n = ci.length, + m; + while (++i < n) { + cj = ci[i]; + j = -1; + m = cj.length; + d.push("M"); + while (++j < m) d.push((p = proj(cj[j])).x, ",", p.y, "L"); + d.pop(); + } + if (!d.length) return; + x.setAttribute("d", d.join("")); + return x; + }, + + Polygon: function(o, proj) { + var x = po.svg("path"), + d = [], + ci = o.coordinates, + cj, // ci[i] + i = -1, + j, + n = ci.length, + m; + while (++i < n) { + cj = ci[i]; + j = -1; + m = cj.length - 1; + d.push("M"); + while (++j < m) d.push((p = proj(cj[j])).x, ",", p.y, "L"); + d[d.length - 1] = "Z"; + } + if (!d.length) return; + x.setAttribute("d", d.join("")); + return x; + }, + + MultiPolygon: function(o, proj) { + var x = po.svg("path"), + d = [], + ci = o.coordinates, + cj, // ci[i] + ck, // cj[j] + i = -1, + j, + k, + n = ci.length, + m, + l; + while (++i < n) { + cj = ci[i]; + j = -1; + m = cj.length; + while (++j < m) { + ck = cj[j]; + k = -1; + l = ck.length - 1; + d.push("M"); + while (++k < l) d.push((p = proj(ck[k])).x, ",", p.y, "L"); + d[d.length - 1] = "Z"; + } + } + if (!d.length) return; + x.setAttribute("d", d.join("")); + return x; + }, + + GeometryCollection: function(o, proj) { + var g = po.svg("g"), + i = -1, + c = o.geometries, + n = c.length, + x; + while (++i < n) { + x = geometry(c[i], proj); + if (x) g.appendChild(x); + } + return g; + } + + }; + + function rescale(o, e, k) { + return o.type in rescales && rescales[o.type](o, e, k); + } + + var rescales = { + + Point: function (o, e, k) { + var p = o.coordinates; + e.setAttribute("transform", "translate(" + p.x + "," + p.y + ")" + k); + }, + + MultiPoint: function (o, e, k) { + var c = o.coordinates, + i = -1, + n = p.length, + x = e.firstChild, + p; + while (++i < n) { + p = c[i]; + x.setAttribute("transform", "translate(" + p.x + "," + p.y + ")" + k); + x = x.nextSibling; + } + } + + }; + + function load(tile, proj) { + var g = tile.element = po.svg("g"); + tile.features = []; + + proj = projection(proj(tile).locationPoint); + + function update(data) { + var updated = []; + + /* Fetch the next batch of features, if so directed. */ + if (data.next) tile.request = fetch(data.next.href, update); + + /* Convert the GeoJSON to SVG. */ + switch (data.type) { + case "FeatureCollection": { + for (var i = 0; i < data.features.length; i++) { + var feature = data.features[i], + element = geometry(feature.geometry, proj); + if (element) updated.push({element: g.appendChild(element), data: feature}); + } + break; + } + case "Feature": { + var element = geometry(data.geometry, proj); + if (element) updated.push({element: g.appendChild(element), data: data}); + break; + } + default: { + var element = geometry(data, proj); + if (element) updated.push({element: g.appendChild(element), data: {type: "Feature", geometry: data}}); + break; + } + } + + tile.ready = true; + updated.push.apply(tile.features, updated); + geoJson.dispatch({type: "load", tile: tile, features: updated}); + } + + if (url != null) { + tile.request = fetch(typeof url == "function" ? url(tile) : url, update); + } else { + update({type: "FeatureCollection", features: features || []}); + } + } + + function unload(tile) { + if (tile.request) tile.request.abort(true); + } + + function move() { + var zoom = geoJson.map().zoom(), + tiles = geoJson.cache.locks(), // visible tiles + key, // key in locks + tile, // locks[key] + features, // tile.features + i, // current feature index + n, // current feature count, features.length + feature, // features[i] + k; // scale transform + if (scale == "fixed") { + for (key in tiles) { + if ((tile = tiles[key]).scale != zoom) { + k = "scale(" + Math.pow(2, tile.zoom - zoom) + ")"; + i = -1; + n = (features = tile.features).length; + while (++i < n) rescale((feature = features[i]).data.geometry, feature.element, k); + tile.scale = zoom; + } + } + } else { + for (key in tiles) { + i = -1; + n = (features = (tile = tiles[key]).features).length; + while (++i < n) rescale((feature = features[i]).data.geometry, feature.element, ""); + delete tile.scale; + } + } + } + + geoJson.url = function(x) { + if (!arguments.length) return url; + url = typeof x == "string" && /{.}/.test(x) ? po.url(x) : x; + if (url != null) features = null; + if (typeof url == "string") geoJson.tile(false); + return geoJson.reload(); + }; + + geoJson.features = function(x) { + if (!arguments.length) return features; + if (features = x) { + url = null; + geoJson.tile(false); + } + return geoJson.reload(); + }; + + geoJson.clip = function(x) { + if (!arguments.length) return clip; + if (clip) container.removeChild(clipPath); + if (clip = x) container.insertBefore(clipPath, container.firstChild); + var locks = geoJson.cache.locks(); + for (var key in locks) { + if (clip) locks[key].element.setAttribute("clip-path", clipHref); + else locks[key].element.removeAttribute("clip-path"); + } + return geoJson; + }; + + var __tile__ = geoJson.tile; + geoJson.tile = function(x) { + if (arguments.length && !x) geoJson.clip(x); + return __tile__.apply(geoJson, arguments); + }; + + var __map__ = geoJson.map; + geoJson.map = function(x) { + if (x && clipRect) { + var size = x.tileSize(); + clipRect.setAttribute("width", size.x); + clipRect.setAttribute("height", size.y); + } + return __map__.apply(geoJson, arguments); + }; + + geoJson.scale = function(x) { + if (!arguments.length) return scale; + if (scale = x) geoJson.on("move", move); + else geoJson.off("move", move); + if (geoJson.map()) move(); + return geoJson; + }; + + geoJson.show = function(tile) { + if (clip) tile.element.setAttribute("clip-path", clipHref); + else tile.element.removeAttribute("clip-path"); + geoJson.dispatch({type: "show", tile: tile, features: tile.features}); + return geoJson; + }; + + geoJson.reshow = function() { + var locks = geoJson.cache.locks(); + for (var key in locks) geoJson.show(locks[key]); + return geoJson; + }; + + return geoJson; +}; +po.dblclick = function() { + var dblclick = {}, + zoom = "mouse", + map, + container; + + function handle(e) { + var z = map.zoom(); + if (e.shiftKey) z = Math.ceil(z) - z - 1; + else z = 1 - z + Math.floor(z); + zoom === "mouse" ? map.zoomBy(z, map.mouse(e)) : map.zoomBy(z); + } + + dblclick.zoom = function(x) { + if (!arguments.length) return zoom; + zoom = x; + return dblclick; + }; + + dblclick.map = function(x) { + if (!arguments.length) return map; + if (map) { + container.removeEventListener("dblclick", handle, false); + container = null; + } + if (map = x) { + container = map.container(); + container.addEventListener("dblclick", handle, false); + } + return dblclick; + }; + + return dblclick; +}; +po.drag = function() { + var drag = {}, + map, + container, + dragging; + + function mousedown(e) { + if (e.shiftKey) return; + dragging = { + x: e.clientX, + y: e.clientY + }; + map.focusableParent().focus(); + e.preventDefault(); + document.body.style.setProperty("cursor", "move", null); + } + + function mousemove(e) { + if (!dragging) return; + map.panBy({x: e.clientX - dragging.x, y: e.clientY - dragging.y}); + dragging.x = e.clientX; + dragging.y = e.clientY; + } + + function mouseup(e) { + if (!dragging) return; + mousemove(e); + dragging = null; + document.body.style.removeProperty("cursor"); + } + + drag.map = function(x) { + if (!arguments.length) return map; + if (map) { + container.removeEventListener("mousedown", mousedown, false); + container = null; + } + if (map = x) { + container = map.container(); + container.addEventListener("mousedown", mousedown, false); + } + return drag; + }; + + window.addEventListener("mousemove", mousemove, false); + window.addEventListener("mouseup", mouseup, false); + + return drag; +}; +po.wheel = function() { + var wheel = {}, + timePrev = 0, + last = 0, + smooth = true, + zoom = "mouse", + location, + map, + container; + + function move(e) { + location = null; + } + + function mousewheel(e) { + var delta = (e.wheelDelta / 120 || -e.detail) * .1, + point; + + /* Detect fast & large wheel events on WebKit. */ + if (bug40441 < 0) { + var now = Date.now(), since = now - last; + if ((since > 9) && (Math.abs(e.wheelDelta) / since >= 50)) bug40441 = 1; + last = now; + } + if (bug40441 == 1) delta *= .03; + + /* If smooth zooming is disabled, batch events into unit steps. */ + if (!smooth && delta) { + var timeNow = Date.now(); + if (timeNow - timePrev > 200) { + delta = delta > 0 ? +1 : -1; + timePrev = timeNow; + } else { + delta = 0; + } + } + + if (delta) { + switch (zoom) { + case "mouse": { + point = map.mouse(e); + if (!location) location = map.pointLocation(point); + map.off("move", move).zoomBy(delta, point, location).on("move", move); + break; + } + case "location": { + map.zoomBy(delta, map.locationPoint(location), location); + break; + } + default: { // center + map.zoomBy(delta); + break; + } + } + } + + e.preventDefault(); + return false; // for Firefox + } + + wheel.smooth = function(x) { + if (!arguments.length) return smooth; + smooth = x; + return wheel; + }; + + wheel.zoom = function(x, l) { + if (!arguments.length) return zoom; + zoom = x; + location = l; + if (map) { + if (zoom == "mouse") map.on("move", move); + else map.off("move", move); + } + return wheel; + }; + + wheel.map = function(x) { + if (!arguments.length) return map; + if (map) { + container.removeEventListener("mousemove", move, false); + container.removeEventListener("mousewheel", mousewheel, false); + container.removeEventListener("DOMMouseScroll", mousewheel, false); + container = null; + map.off("move", move); + } + if (map = x) { + if (zoom == "mouse") map.on("move", move); + container = map.container(); + container.addEventListener("mousemove", move, false); + container.addEventListener("mousewheel", mousewheel, false); + container.addEventListener("DOMMouseScroll", mousewheel, false); + } + return wheel; + }; + + return wheel; +}; + +// https://bugs.webkit.org/show_bug.cgi?id=40441 +var bug40441 = /WebKit\/533/.test(navigator.userAgent) ? -1 : 0; +po.arrow = function() { + var arrow = {}, + key = {left: 0, right: 0, up: 0, down: 0}, + last = 0, + repeatTimer, + repeatDelay = 250, + repeatInterval = 50, + speed = 16, + map, + parent; + + function keydown(e) { + if (e.ctrlKey || e.altKey || e.metaKey) return; + var now = Date.now(), dx = 0, dy = 0; + switch (e.keyCode) { + case 37: { + if (!key.left) { + last = now; + key.left = 1; + if (!key.right) dx = speed; + } + break; + } + case 39: { + if (!key.right) { + last = now; + key.right = 1; + if (!key.left) dx = -speed; + } + break; + } + case 38: { + if (!key.up) { + last = now; + key.up = 1; + if (!key.down) dy = speed; + } + break; + } + case 40: { + if (!key.down) { + last = now; + key.down = 1; + if (!key.up) dy = -speed; + } + break; + } + default: return; + } + if (dx || dy) map.panBy({x: dx, y: dy}); + if (!repeatTimer && (key.left | key.right | key.up | key.down)) { + repeatTimer = setInterval(repeat, repeatInterval); + } + e.preventDefault(); + } + + function keyup(e) { + last = Date.now(); + switch (e.keyCode) { + case 37: key.left = 0; break; + case 39: key.right = 0; break; + case 38: key.up = 0; break; + case 40: key.down = 0; break; + default: return; + } + if (repeatTimer && !(key.left | key.right | key.up | key.down)) { + repeatTimer = clearInterval(repeatTimer); + } + e.preventDefault(); + } + + function keypress(e) { + switch (e.charCode) { + case 45: case 95: map.zoom(Math.ceil(map.zoom()) - 1); break; // - _ + case 43: case 61: map.zoom(Math.floor(map.zoom()) + 1); break; // = + + default: return; + } + e.preventDefault(); + } + + function repeat() { + if (!map) return; + if (Date.now() < last + repeatDelay) return; + var dx = (key.left - key.right) * speed, + dy = (key.up - key.down) * speed; + if (dx || dy) map.panBy({x: dx, y: dy}); + } + + arrow.map = function(x) { + if (!arguments.length) return map; + if (map) { + parent.removeEventListener("keypress", keypress, false); + parent.removeEventListener("keydown", keydown, false); + parent.removeEventListener("keyup", keyup, false); + parent = null; + } + if (map = x) { + parent = map.focusableParent(); + parent.addEventListener("keypress", keypress, false); + parent.addEventListener("keydown", keydown, false); + parent.addEventListener("keyup", keyup, false); + } + return arrow; + }; + + arrow.speed = function(x) { + if (!arguments.length) return speed; + speed = x; + return arrow; + }; + + return arrow; +}; +po.hash = function() { + var hash = {}, + s0, // cached location.hash + lat = 90 - 1e-8, // allowable latitude range + map; + + var parser = function(s) { + var args = s.split("/").map(Number); + if (args.length < 3 || args.some(isNaN)) + move(); // replace bogus hash + else { + var size = map.size(); + map.zoomBy(args[0] - map.zoom(), + {x: size.x / 2, y: size.y / 2}, + {lat: Math.min(lat, Math.max(-lat, args[1])), lon: args[2]}); + } + }; + + var formatter = function(map) { + var center = map.center(), + zoom = map.zoom(), + precision = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2)); + return "#" + zoom.toFixed(2) + + "/" + center.lat.toFixed(precision) + + "/" + center.lon.toFixed(precision); + }; + + function move() { + var s1 = formatter(map); + if (s0 !== s1) location.replace(s0 = s1); // don't recenter the map! + } + + function hashchange() { + if (location.hash === s0) return; // ignore spurious hashchange events + parser((s0 = location.hash).substring(1)); + } + + hash.map = function(x) { + if (!arguments.length) return map; + if (map) { + map.off("move", move); + window.removeEventListener("hashchange", hashchange, false); + } + if (map = x) { + map.on("move", move); + window.addEventListener("hashchange", hashchange, false); + location.hash ? hashchange() : move(); + } + return hash; + }; + + hash.parser = function(x) { + if (!arguments.length) return parser; + parser = x; + return hash; + }; + + hash.formatter = function(x) { + if (!arguments.length) return formatter; + formatter = x; + return hash; + }; + + return hash; +}; +// Default map controls. +po.interact = function() { + var interact = {}, + drag = po.drag(), + wheel = po.wheel(), + dblclick = po.dblclick(), + arrow = po.arrow(); + + interact.map = function(x) { + drag.map(x); + wheel.map(x); + dblclick.map(x); + arrow.map(x); + return interact; + }; + + return interact; +}; +po.compass = function() { + var compass = {}, + g = po.svg("g"), + ticks = {}, + r = 30, + speed = 16, + last = 0, + repeatDelay = 250, + repeatInterval = 50, + position = "top-left", // top-left, top-right, bottom-left, bottom-right + zoomStyle = "small", // none, small, big + zoomContainer, + panStyle = "small", // none, small + panTimer, + panDirection, + panContainer, + drag, + dragRect = po.svg("rect"), + map, + container, + window; + + g.setAttribute("class", "compass"); + dragRect.setAttribute("class", "back fore"); + dragRect.setAttribute("pointer-events", "none"); + dragRect.setAttribute("display", "none"); + + function panStart(e) { + g.setAttribute("class", "compass active"); + if (!panTimer) panTimer = setInterval(panRepeat, repeatInterval); + if (panDirection) map.panBy(panDirection); + last = Date.now(); + return cancel(e); + } + + function panRepeat() { + if (panDirection && (Date.now() > last + repeatDelay)) { + map.panBy(panDirection); + } + } + + function mousedown(e) { + if (e.shiftKey) { + drag = {x0: map.mouse(e)}; + map.focusableParent().focus(); + return cancel(e); + } + } + + function mousemove(e) { + if (!drag) return; + drag.x1 = map.mouse(e); + dragRect.setAttribute("x", Math.min(drag.x0.x, drag.x1.x)); + dragRect.setAttribute("y", Math.min(drag.x0.y, drag.x1.y)); + dragRect.setAttribute("width", Math.abs(drag.x0.x - drag.x1.x)); + dragRect.setAttribute("height", Math.abs(drag.x0.y - drag.x1.y)); + dragRect.removeAttribute("display"); + } + + function mouseup(e) { + g.setAttribute("class", "compass"); + if (drag) { + if (drag.x1) { + map.extent([ + map.pointLocation({ + x: Math.min(drag.x0.x, drag.x1.x), + y: Math.max(drag.x0.y, drag.x1.y) + }), + map.pointLocation({ + x: Math.max(drag.x0.x, drag.x1.x), + y: Math.min(drag.x0.y, drag.x1.y) + }) + ]); + dragRect.setAttribute("display", "none"); + } + drag = null; + } + if (panTimer) { + clearInterval(panTimer); + panTimer = 0; + } + } + + function panBy(x) { + return function() { + x ? this.setAttribute("class", "active") : this.removeAttribute("class"); + panDirection = x; + }; + } + + function zoomBy(x) { + return function(e) { + g.setAttribute("class", "compass active"); + var z = map.zoom(); + map.zoom(x < 0 ? Math.ceil(z) - 1 : Math.floor(z) + 1); + return cancel(e); + }; + } + + function zoomTo(x) { + return function(e) { + map.zoom(x); + return cancel(e); + }; + } + + function zoomOver() { + this.setAttribute("class", "active"); + } + + function zoomOut() { + this.removeAttribute("class"); + } + + function cancel(e) { + e.stopPropagation(); + e.preventDefault(); + return false; + } + + function pan(by) { + var x = Math.SQRT1_2 * r, + y = r * .7, + z = r * .2, + g = po.svg("g"), + dir = g.appendChild(po.svg("path")), + chv = g.appendChild(po.svg("path")); + dir.setAttribute("class", "direction"); + dir.setAttribute("pointer-events", "all"); + dir.setAttribute("d", "M0,0L" + x + "," + x + "A" + r + "," + r + " 0 0,1 " + -x + "," + x + "Z"); + chv.setAttribute("class", "chevron"); + chv.setAttribute("d", "M" + z + "," + (y - z) + "L0," + y + " " + -z + "," + (y - z)); + chv.setAttribute("pointer-events", "none"); + g.addEventListener("mousedown", panStart, false); + g.addEventListener("mouseover", panBy(by), false); + g.addEventListener("mouseout", panBy(null), false); + g.addEventListener("dblclick", cancel, false); + return g; + } + + function zoom(by) { + var x = r * .4, + y = x / 2, + g = po.svg("g"), + back = g.appendChild(po.svg("path")), + dire = g.appendChild(po.svg("path")), + chev = g.appendChild(po.svg("path")), + fore = g.appendChild(po.svg("path")); + back.setAttribute("class", "back"); + back.setAttribute("d", "M" + -x + ",0V" + -x + "A" + x + "," + x + " 0 1,1 " + x + "," + -x + "V0Z"); + dire.setAttribute("class", "direction"); + dire.setAttribute("d", back.getAttribute("d")); + chev.setAttribute("class", "chevron"); + chev.setAttribute("d", "M" + -y + "," + -x + "H" + y + (by > 0 ? "M0," + (-x - y) + "V" + -y : "")); + fore.setAttribute("class", "fore"); + fore.setAttribute("fill", "none"); + fore.setAttribute("d", back.getAttribute("d")); + g.addEventListener("mousedown", zoomBy(by), false); + g.addEventListener("mouseover", zoomOver, false); + g.addEventListener("mouseout", zoomOut, false); + g.addEventListener("dblclick", cancel, false); + return g; + } + + function tick(i) { + var x = r * .2, + y = r * .4, + g = po.svg("g"), + back = g.appendChild(po.svg("rect")), + chev = g.appendChild(po.svg("path")); + back.setAttribute("pointer-events", "all"); + back.setAttribute("fill", "none"); + back.setAttribute("x", -y); + back.setAttribute("y", -.75 * y); + back.setAttribute("width", 2 * y); + back.setAttribute("height", 1.5 * y); + chev.setAttribute("class", "chevron"); + chev.setAttribute("d", "M" + -x + ",0H" + x); + g.addEventListener("mousedown", zoomTo(i), false); + g.addEventListener("dblclick", cancel, false); + return g; + } + + function move() { + var x = r + 6, y = x, size = map.size(); + switch (position) { + case "top-left": break; + case "top-right": x = size.x - x; break; + case "bottom-left": y = size.y - y; break; + case "bottom-right": x = size.x - x; y = size.y - y; break; + } + var tx = "translate(" + x + "," + y + ")"; + if (panContainer) panContainer.setAttribute("transform", tx); + if (zoomContainer) zoomContainer.setAttribute("transform", tx); + for (var i in ticks) { + i == map.zoom() + ? ticks[i].setAttribute("class", "active") + : ticks[i].removeAttribute("class"); + } + } + + function draw() { + while (g.lastChild) g.removeChild(g.lastChild); + + g.appendChild(dragRect); + + if (panStyle != "none") { + panContainer = g.appendChild(po.svg("g")); + panContainer.setAttribute("class", "pan"); + + var back = panContainer.appendChild(po.svg("circle")); + back.setAttribute("class", "back"); + back.setAttribute("r", r); + + var s = panContainer.appendChild(pan({x: 0, y: -speed})); + s.setAttribute("transform", "rotate(0)"); + + var w = panContainer.appendChild(pan({x: speed, y: 0})); + w.setAttribute("transform", "rotate(90)"); + + var n = panContainer.appendChild(pan({x: 0, y: speed})); + n.setAttribute("transform", "rotate(180)"); + + var e = panContainer.appendChild(pan({x: -speed, y: 0})); + e.setAttribute("transform", "rotate(270)"); + + var fore = panContainer.appendChild(po.svg("circle")); + fore.setAttribute("fill", "none"); + fore.setAttribute("class", "fore"); + fore.setAttribute("r", r); + } else { + panContainer = null; + } + + if (zoomStyle != "none") { + zoomContainer = g.appendChild(po.svg("g")); + zoomContainer.setAttribute("class", "zoom"); + + var j = -.5; + if (zoomStyle == "big") { + ticks = {}; + for (var i = map.zoomRange()[0], j = 0; i <= map.zoomRange()[1]; i++, j++) { + (ticks[i] = zoomContainer.appendChild(tick(i))) + .setAttribute("transform", "translate(0," + (-(j + .75) * r * .4) + ")"); + } + } + + var p = panStyle == "none" ? .4 : 2; + zoomContainer.setAttribute("transform", "translate(0," + r * (/^top-/.test(position) ? (p + (j + .5) * .4) : -p) + ")"); + zoomContainer.appendChild(zoom(+1)).setAttribute("transform", "translate(0," + (-(j + .5) * r * .4) + ")"); + zoomContainer.appendChild(zoom(-1)).setAttribute("transform", "scale(-1)"); + } else { + zoomContainer = null; + } + + move(); + } + + compass.radius = function(x) { + if (!arguments.length) return r; + r = x; + if (map) draw(); + return compass; + }; + + compass.speed = function(x) { + if (!arguments.length) return r; + speed = x; + return compass; + }; + + compass.position = function(x) { + if (!arguments.length) return position; + position = x; + if (map) draw(); + return compass; + }; + + compass.pan = function(x) { + if (!arguments.length) return panStyle; + panStyle = x; + if (map) draw(); + return compass; + }; + + compass.zoom = function(x) { + if (!arguments.length) return zoomStyle; + zoomStyle = x; + if (map) draw(); + return compass; + }; + + compass.map = function(x) { + if (!arguments.length) return map; + if (map) { + container.removeEventListener("mousedown", mousedown, false); + container.removeChild(g); + container = null; + window.removeEventListener("mousemove", mousemove, false); + window.removeEventListener("mouseup", mouseup, false); + window = null; + map.off("move", move).off("resize", move); + } + if (map = x) { + container = map.container(); + container.appendChild(g); + container.addEventListener("mousedown", mousedown, false); + window = container.ownerDocument.defaultView; + window.addEventListener("mousemove", mousemove, false); + window.addEventListener("mouseup", mouseup, false); + map.on("move", move).on("resize", move); + draw(); + } + return compass; + }; + + return compass; +}; +po.grid = function() { + var grid = {}, + map, + g = po.svg("g"); + + g.setAttribute("class", "grid"); + + function move(e) { + var p, + line = g.firstChild, + size = map.size(), + nw = map.pointLocation(zero), + se = map.pointLocation(size), + step = Math.pow(2, 4 - Math.round(map.zoom())); + + // Round to step. + nw.lat = Math.floor(nw.lat / step) * step; + nw.lon = Math.ceil(nw.lon / step) * step; + + // Longitude ticks. + for (var x; (x = map.locationPoint(nw).x) <= size.x; nw.lon += step) { + if (!line) line = g.appendChild(po.svg("line")); + line.setAttribute("x1", x); + line.setAttribute("x2", x); + line.setAttribute("y1", 0); + line.setAttribute("y2", size.y); + line = line.nextSibling; + } + + // Latitude ticks. + for (var y; (y = map.locationPoint(nw).y) <= size.y; nw.lat -= step) { + if (!line) line = g.appendChild(po.svg("line")); + line.setAttribute("y1", y); + line.setAttribute("y2", y); + line.setAttribute("x1", 0); + line.setAttribute("x2", size.x); + line = line.nextSibling; + } + + // Remove extra ticks. + while (line) { + var next = line.nextSibling; + g.removeChild(line); + line = next; + } + } + + grid.map = function(x) { + if (!arguments.length) return map; + if (map) { + g.parentNode.removeChild(g); + map.off("move", move).off("resize", move); + } + if (map = x) { + map.on("move", move).on("resize", move); + map.container().appendChild(g); + map.dispatch({type: "move"}); + } + return grid; + }; + + return grid; +}; +po.stylist = function() { + var attrs = [], + styles = [], + title; + + function stylist(e) { + var ne = e.features.length, + na = attrs.length, + ns = styles.length, + f, // feature + d, // data + o, // element + x, // attr or style or title descriptor + v, // attr or style or title value + i, + j; + for (i = 0; i < ne; ++i) { + if (!(o = (f = e.features[i]).element)) continue; + d = f.data; + for (j = 0; j < na; ++j) { + v = (x = attrs[j]).value; + if (typeof v === "function") v = v.call(null, d); + v == null ? (x.name.local + ? o.removeAttributeNS(x.name.space, x.name.local) + : o.removeAttribute(x.name)) : (x.name.local + ? o.setAttributeNS(x.name.space, x.name.local, v) + : o.setAttribute(x.name, v)); + } + for (j = 0; j < ns; ++j) { + v = (x = styles[j]).value; + if (typeof v === "function") v = v.call(null, d); + v == null + ? o.style.removeProperty(x.name) + : o.style.setProperty(x.name, v, x.priority); + } + if (v = title) { + if (typeof v === "function") v = v.call(null, d); + while (o.lastChild) o.removeChild(o.lastChild); + if (v != null) o.appendChild(po.svg("title")).appendChild(document.createTextNode(v)); + } + } + } + + stylist.attr = function(n, v) { + attrs.push({name: ns(n), value: v}); + return stylist; + }; - // Call beforeSend if provided (early abort if false returned) - if ( callIfDefined( xOptions.beforeSend, xOptions , [ xOptions ] ) === false || done ) { - return xOptions; - } - - // Control entries - url = url || STR_EMPTY; - data = data ? ( (typeof data) == "string" ? data : $.param( data , xOptions.traditional ) ) : STR_EMPTY; - - // Build final url - url += data ? ( qMarkOrAmp( url ) + data ) : STR_EMPTY; - - // Add callback parameter if provided as option - callbackParameter && ( url += qMarkOrAmp( url ) + encodeURIComponent( callbackParameter ) + "=?" ); - - // Add anticache parameter if needed - ! cacheFlag && ! pageCacheFlag && ( url += qMarkOrAmp( url ) + "_" + ( new Date() ).getTime() + "=" ); - - // Replace last ? by callback parameter - url = url.replace( /=\?(&|$)/ , "=" + successCallbackName + "$1" ); - - // Success notifier - function notifySuccess( json ) { - ! done++ && setTimeout( function() { - cleanUp(); - // Pagecache if needed - pageCacheFlag && ( pageCache [ url ] = { s: [ json ] } ); - // Apply the data filter if provided - dataFilter && ( json = dataFilter.apply( xOptions , [ json ] ) ); - // Call success then complete - callIfDefined( xOptions.success , xOptions , [ json , STR_SUCCESS ] ); - callIfDefined( completeCallback , xOptions , [ xOptions , STR_SUCCESS ] ); - } , 0 ); - } - - // Error notifier - function notifyError( type ) { - ! done++ && setTimeout( function() { - // Clean up - cleanUp(); - // If pure error (not timeout), cache if needed - pageCacheFlag && type != STR_TIMEOUT && ( pageCache[ url ] = type ); - // Call error then complete - callIfDefined( xOptions.error , xOptions , [ xOptions , type ] ); - callIfDefined( completeCallback , xOptions , [ xOptions , type ] ); - } , 0 ); - } - - // Check page cache - pageCacheFlag && ( pageCached = pageCache[ url ] ) - ? ( pageCached.s ? notifySuccess( pageCached.s[ 0 ] ) : notifyError( pageCached ) ) - : - // Initiate request - setTimeout( function( script , scriptAfter , timeoutTimer ) { - - if ( ! done ) { - - // If a timeout is needed, install it - timeoutTimer = timeout > 0 && setTimeout( function() { - notifyError( STR_TIMEOUT ); - } , timeout ); - - // Re-declare cleanUp function - cleanUp = function() { - timeoutTimer && clearTimeout( timeoutTimer ); - script[ STR_ONREADYSTATECHANGE ] - = script[ STR_ONCLICK ] - = script[ STR_ONLOAD ] - = script[ STR_ONERROR ] - = null; - head[ STR_REMOVE_CHILD ]( script ); - scriptAfter && head[ STR_REMOVE_CHILD ]( scriptAfter ); - }; - - // Install the generic callback - // (BEWARE: global namespace pollution ahoy) - window[ successCallbackName ] = genericCallback; + stylist.style = function(n, v, p) { + styles.push({name: n, value: v, priority: arguments.length < 3 ? null : p}); + return stylist; + }; - // Create the script tag - script = $( STR_SCRIPT_TAG )[ 0 ]; - script.id = STR_JQUERY_JSONP + count++; - - // Set charset if provided - if ( charset ) { - script[ STR_CHARSET ] = charset; - } - - // Callback function - function callback( result ) { - ( script[ STR_ONCLICK ] || noop )(); - result = lastValue; - lastValue = undefined; - result ? notifySuccess( result[ 0 ] ) : notifyError( STR_ERROR ); - } - - // IE: event/htmlFor/onclick trick - // One can't rely on proper order for onreadystatechange - // We have to sniff since FF doesn't like event & htmlFor... at all - if ( browser.msie ) { - - script.event = STR_ONCLICK; - script.htmlFor = script.id; - script[ STR_ONREADYSTATECHANGE ] = function() { - /loaded|complete/.test( script.readyState ) && callback(); - }; - - // All others: standard handlers - } else { - - script[ STR_ONERROR ] = script[ STR_ONLOAD ] = callback; - - browser.opera ? - - // Opera: onerror is not called, use synchronized script execution - ( ( scriptAfter = $( STR_SCRIPT_TAG )[ 0 ] ).text = "jQuery('#" + script.id + "')[0]." + STR_ONERROR + "()" ) - - // Firefox: set script as async to avoid blocking scripts (3.6+ only) - : script[ STR_ASYNC ] = STR_ASYNC; - - ; - } - - // Set source - script.src = url; - - // Append main script - appendScript( script ); - - // Opera: Append trailing script - scriptAfter && appendScript( scriptAfter ); - } - - } , 0 ); - - return xOptions; - } - - // ###################### SETUP FUNCTION ## - jsonp.setup = function( xOptions ) { - $.extend( xOptionsDefaults , xOptions ); - }; + stylist.title = function(v) { + title = v; + return stylist; + }; - // ###################### INSTALL in jQuery ## - $.jsonp = jsonp; - -} )( jQuery , setTimeout );// Wax Header + return stylist; +}; +})(org.polymaps); +// Wax Header var wax = wax || {}; // Instantiate objects based on a JSON "record". The record must be a statement @@ -334,7 +4021,10 @@ wax.Wax = { runFunction: function(fn_name, args, cur) { var fn_obj = this.getFunction(fn_name, cur); var fn_args = args.length ? wax.Wax.reify(args) : []; - if (cur) { + // @TODO: This is currently a stopgap measure that calls methods like + // `foo.bar()` in the context of `foo`. It will probably be necessary + // in the future to be able to call `foo.bar()` from other contexts. + if (cur && fn_name.indexOf('.') === -1) { return fn_obj[1].apply(cur, fn_args); } else { return fn_obj[1].apply(fn_obj[0], fn_args); @@ -1486,30 +5176,35 @@ wax.tooltip.unselect = function(feature, context, layer_id) { var wax = wax || {}; wax.g = wax.g || {}; +// Controls constructor. +wax.g.Controls = function(map) { + this.map = map; +}; + // Since Google Maps obscures mouseover events, grids need to calculated // in order to simulate them, and eventually do multi-layer interaction. -wax.g.calculateGrid = function(map) { - if (map.interaction_grid) return; - // Get all 'marked' tiles, added by the `wax.g.MapType` layer. - var interactive_tiles = $('.interactive-div-' + map.getZoom() + ' img', map.d); - var start_offset = $(map.d).offset(); - // Return an array of objects which have the **relative** offset of - // each tile, with a reference to the tile object in `tile`, since the API - // returns evt coordinates as relative to the map object. - var tiles = $(interactive_tiles).map(function(t) { - var e_offset = $(interactive_tiles[t]).offset(); - return { - xy: { - left: e_offset.left - start_offset.left, - top: e_offset.top - start_offset.top - }, - tile: interactive_tiles[t] - }; - }); - return tiles; +wax.g.Controls.prototype.calculateGrid = function() { + if (this.map.interaction_grid) return; + // Get all 'marked' tiles, added by the `wax.g.MapType` layer. + var interactive_tiles = $('.interactive-div-' + this.map.getZoom() + ' img', this.map.d); + var start_offset = $(this.map.d).offset(); + // Return an array of objects which have the **relative** offset of + // each tile, with a reference to the tile object in `tile`, since the API + // returns evt coordinates as relative to the map object. + var tiles = $(interactive_tiles).map(function(t) { + var e_offset = $(interactive_tiles[t]).offset(); + return { + xy: { + left: e_offset.left - start_offset.left, + top: e_offset.top - start_offset.top + }, + tile: interactive_tiles[t] + }; + }); + return tiles; }; -wax.g.inTile = function(sevt, xy) { +wax.g.Controls.prototype.inTile = function(sevt, xy) { if ((xy.top < sevt.y) && ((xy.top + 256) > sevt.y) && (xy.left < sevt.x) && @@ -1518,55 +5213,71 @@ wax.g.inTile = function(sevt, xy) { } }; -wax.g.Interaction = function(map) { +wax.g.Controls.prototype.Interaction = function() { + var that = this; var gm = new wax.GridManager(); var f = null; var find = function(map, evt) { var found = false; - var interaction_grid = wax.g.calculateGrid(map); + var interaction_grid = that.calculateGrid(); for (var i = 0; i < interaction_grid.length && !found; i++) { - if (wax.g.inTile(evt.pixel, interaction_grid[i].xy)) { + if (that.inTile(evt.pixel, interaction_grid[i].xy)) { var found = interaction_grid[i]; } } return found; }; - google.maps.event.addListener(map, 'mousemove', function(evt) { + google.maps.event.addListener(this.map, 'mousemove', function(evt) { var options = { format: 'teaser' }; - var found = find(map, evt); + var found = find(this.map, evt); if (!found) return; gm.getGrid($(found.tile).attr('src'), function(g) { if (!g) return; var feature = g.getFeature( - evt.pixel.x + $(map.d).offset().left, - evt.pixel.y + $(map.d).offset().top, + evt.pixel.x + $(that.map.d).offset().left, + evt.pixel.y + $(that.map.d).offset().top, found.tile, options ); if (feature !== f) { - wax.tooltip.unselect(feature, $(map.d), 0); - wax.tooltip.select(feature, $(map.d), 0); + wax.tooltip.unselect(feature, $(that.map.d), 0); + wax.tooltip.select(feature, $(that.map.d), 0); f = feature; } }); }); - google.maps.event.addListener(map, 'click', function(evt) { + google.maps.event.addListener(this.map, 'click', function(evt) { var options = { format: 'full' }; - var found = find(map, evt); + var found = find(this.map, evt); if (!found) return; gm.getGrid($(found.tile).attr('src'), function(g) { if (!g) return; var feature = g.getFeature( - evt.pixel.x + $(map.d).offset().left, - evt.pixel.y + $(map.d).offset().top, + evt.pixel.x + $(that.map.d).offset().left, + evt.pixel.y + $(that.map.d).offset().top, found.tile, options ); - feature && wax.tooltip.click(feature, $(map.d), 0); + feature && wax.tooltip.click(feature, $(that.map.d), 0); }); }); + return this; }; +wax.g.Controls.prototype.Legend = function() { + var that = this, + legend = new wax.Legend($(this.map.d)), + url = null; + + // Ideally we would use the 'tilesloaded' event here. This doesn't seem to + // work so we use the much less appropriate 'idle' event. + google.maps.event.addListener(this.map, 'idle', function() { + if (url) return; + var img = $('.interactive-div-' + that.map.getZoom() + ' img:first', that.map.d); + img && (url = img.attr('src')) && legend.render([url]); + }); + return this; +}; // Wax header var wax = wax || {}; wax.g = wax.g || {}; diff --git a/build/wax.g.min.js b/build/wax.g.min.js index 2f9aaa3f..69cfc272 100644 --- a/build/wax.g.min.js +++ b/build/wax.g.min.js @@ -1,10 +1,126 @@ /* - * jQuery JSONP Core Plugin 2.1.4 (2010-11-17) - * - * http://code.google.com/p/jquery-jsonp/ + + OpenLayers.js -- OpenLayers Map Viewer Library + + Copyright 2005-2010 OpenLayers Contributors, released under the Clear BSD + license. Please see http://svn.openlayers.org/trunk/openlayers/license.txt + for the full text of the license. + + Includes compressed code under the following licenses: + + (For uncompressed versions of the code used please see the + OpenLayers SVN repository: ) + +*//* Contains portions of Prototype.js: + * + * Prototype JavaScript framework, version 1.4.0 + * (c) 2005 Sam Stephenson + * + * Prototype is freely distributable under the terms of an MIT-style license. + * For details, see the Prototype web site: http://prototype.conio.net/ + * + *--------------------------------------------------------------------------*//** +* +* Contains portions of Rico +* +* Copyright 2005 Sabre Airline Solutions +* +* Licensed under the Apache License, Version 2.0 (the "License"); you +* may not use this file except in compliance with the License. You +* may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +* implied. See the License for the specific language governing +* permissions and limitations under the License. +* +**//** + * Contains XMLHttpRequest.js + * Copyright 2007 Sergey Ilinsky (http://www.ilinsky.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + *//** + * Contains portions of Gears + * + * Copyright 2007, Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of Google Inc. nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. * - * Copyright (c) 2010 Julian Aubourg + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * This document is licensed as free software under the terms of the - * MIT License: http://www.opensource.org/licenses/mit-license.php - */(function(a,b){function B(m){function P(a){!(M++)&&b(function(){N(),G&&a!=u&&(x[I]=a),f(m.error,m,[m,a]),f(B,m,[m,a])},0)}function O(a){!(M++)&&b(function(){N(),G&&(x[I]={s:[a]}),C&&(a=C.apply(m,[a])),f(m.success,m,[a,t]),f(B,m,[m,t])},0)}m=a.extend({},A,m);var B=m.complete,C=m.dataFilter,D=m.callbackParameter,E=m.callback,F=m.cache,G=m.pageCache,H=m.charset,I=m.url,J=m.data,K=m.timeout,L,M=0,N=c;m.abort=function(){!(M++)&&N()};if(f(m.beforeSend,m,[m])===!1||M)return m;I=I||j,J=J?typeof J=="string"?J:a.param(J,m.traditional):j,I+=J?g(I)+J:j,D&&(I+=g(I)+encodeURIComponent(D)+"=?"),!F&&!G&&(I+=g(I)+"_"+(new Date).getTime()+"="),I=I.replace(/=\?(&|$)/,"="+E+"$1"),G&&(L=x[I])?L.s?O(L.s[0]):P(L):b(function(f,g,j){if(!M){j=K>0&&b(function(){P(u)},K),N=function(){j&&clearTimeout(j),f[q]=f[n]=f[p]=f[o]=null,w[r](f),g&&w[r](g)},window[E]=d,f=a(s)[0],f.id=l+y++,H&&(f[i]=H);function m(a){(f[n]||c)(),a=z,z=undefined,a?O(a[0]):P(k)}v.msie?(f.event=n,f.htmlFor=f.id,f[q]=function(){/loaded|complete/.test(f.readyState)&&m()}):(f[o]=f[p]=m,v.opera?(g=a(s)[0]).text="jQuery('#"+f.id+"')[0]."+o+"()":f[h]=h),f.src=I,e(f),g&&e(g)}},0);return m}function g(a){return/\?/.test(a)?"&":"?"}function f(a,b,c){return a&&a.apply(b.context||b,c)}function e(a){w.insertBefore(a,w.firstChild)}function d(a){z=[a]}function c(){}var h="async",i="charset",j="",k="error",l="_jqjsp",m="on",n=m+"click",o=m+k,p=m+"load",q=m+"readystatechange",r="removeChild",s="";else{var j=document.createElement("script");j.src=g+c[h];var k=document.getElementsByTagName("head").length?document.getElementsByTagName("head")[0]:document.body;k.appendChild(j)}e&&document.write(f.join(""))}})(),OpenLayers.VERSION_NUMBER="$Revision: 10862 $",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){var b=a.split("-"),c=b[0];for(var d=1,e=b.length;d0&&(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,b!=null&&(a=parseFloat(a.toFixed(b)));var e=a.toString().split(".");e.length==1&&b==null&&(b=0);var f=e[0];if(c){var g=/(-?[0-9]+)([0-9]{3})/;while(g.test(f))f=f.replace(g,"$1"+c+"$2")}var h;if(b==0)h=f;else{var i=e.length>1?e[1]:"0";b!=null&&(i=i+Array(b-i.length+1).join("0")),h=f+d+i}return h}},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)}},False:function(){return!1},True:function(){return!0}},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)}),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;f1){var e=[d,b].concat(Array.prototype.slice.call(arguments).slice(1,a-1),c);OpenLayers.inherit.apply(null,e)}else d.prototype=c;return d},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(a){var b=function(){a.call(this)},c=[b].concat(Array.prototype.slice.call(arguments));OpenLayers.inherit.apply(null,c);return b.prototype},OpenLayers.inherit=function(a,b){var c=function(){};c.prototype=b.prototype,a.prototype=new c;var d,e,f;for(d=2,e=arguments.length;d=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){if(typeof a.indexOf=="function")return a.indexOf(b);for(var c=0,d=a.length;c=0&&parseFloat(h)<1?(a.style.filter="alpha(opacity="+h*100+")",a.style.opacity=h):parseFloat(h)==1&&(a.style.filter="",a.style.opacity="")},OpenLayers.Util.createDiv=function(a,b,c,d,e,f,g,h){var i=document.createElement("div");d&&(i.style.backgroundImage="url("+d+")"),a||(a=OpenLayers.Util.createUniqueID("OpenLayersDiv")),e||(e="absolute"),OpenLayers.Util.modifyDOMElement(i,a,b,c,e,f,g,h);return i},OpenLayers.Util.createImage=function(a,b,c,d,e,f,g,h){var i=document.createElement("img");a||(a=OpenLayers.Util.createUniqueID("OpenLayersDiv")),e||(e="relative"),OpenLayers.Util.modifyDOMElement(i,a,b,c,e,f,null,g),h&&(i.style.display="none",OpenLayers.Event.observe(i,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,i)),OpenLayers.Event.observe(i,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,i))),i.style.alt=a,i.galleryImg="no",d&&(i.src=d);return i},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.display="";OpenLayers.Element.removeClass(this,"olImageLoadError")},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()),f=a[e];d=0;while(f==c&&d++<4)e=Math.floor(a.length*Math.random()),f=a[e];this.src=b.replace(c,f)}else this.src=this.src}else OpenLayers.Element.addClass(this,"olImageLoadError");this.style.display=""},OpenLayers.Util.alphaHackNeeded=null,OpenLayers.Util.alphaHack=function(){if(OpenLayers.Util.alphaHackNeeded==null){var a=navigator.appVersion.split("MSIE"),b=parseFloat(a[1]),c=!1;try{c=!!document.body.filters}catch(d){}OpenLayers.Util.alphaHackNeeded=c&&b>=5.5&&b<7}return OpenLayers.Util.alphaHackNeeded},OpenLayers.Util.modifyAlphaImageDiv=function(a,b,c,d,e,f,g,h,i){OpenLayers.Util.modifyDOMElement(a,b,c,d,f,null,null,i);var j=a.childNodes[0];e&&(j.src=e),OpenLayers.Util.modifyDOMElement(j,a.id+"_innerImage",null,d,"relative",g),OpenLayers.Util.alphaHack()&&(a.style.display!="none"&&(a.style.display="inline-block"),h==null&&(h="scale"),a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+j.src+"', "+"sizingMethod='"+h+"')",parseFloat(a.style.opacity)>=0&&parseFloat(a.style.opacity)<1&&(a.style.filter+=" alpha(opacity="+a.style.opacity*100+")"),j.style.filter="alpha(opacity=0)")},OpenLayers.Util.createAlphaImageDiv=function(a,b,c,d,e,f,g,h,i){var j=OpenLayers.Util.createDiv(),k=OpenLayers.Util.createImage(null,null,null,null,null,null,null,!1);j.appendChild(k),i&&(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,h);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];!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"){var e;if(typeof d=="object"&&d.constructor==Array){var f=[],g;for(var h=0,i=d.length;h0))return"";c||(c=0);if(d[c].childNodes.length>1)return d.childNodes[1].nodeValue;if(d[c].childNodes.length==1)return d[c].firstChild.nodeValue},OpenLayers.Util.getXmlNodeValue=function(a){var b=null;OpenLayers.Util.Try(function(){b=a.text,b||(b=a.textContent),b||(b=a.firstChild.nodeValue)},function(){b=a.textContent});return b},OpenLayers.Util.mouseLeft=function(a,b){var c=a.relatedTarget?a.relatedTarget:a.toElement;while(c!=b&&c!=null)c=c.parentNode;return c!=b},OpenLayers.Util.DEFAULT_PRECISION=14,OpenLayers.Util.toFloat=function(a,b){b==null&&(b=OpenLayers.Util.DEFAULT_PRECISION);var a;b==0?a=parseFloat(a):a=parseFloat(parseFloat(a).toPrecision(b));return a},OpenLayers.Util.rad=function(a){return a*Math.PI/180},OpenLayers.Util.deg=function(a){return a*180/Math.PI},OpenLayers.Util.VincentyConstants={a:6378137,b:6356752.3142,f:1/298.257223563},OpenLayers.Util.distVincenty=function(a,b){var c=OpenLayers.Util.VincentyConstants,d=c.a,e=c.b,f=c.f,g=OpenLayers.Util.rad(b.lon-a.lon),h=Math.atan((1-f)*Math.tan(OpenLayers.Util.rad(a.lat))),i=Math.atan((1-f)*Math.tan(OpenLayers.Util.rad(b.lat))),j=Math.sin(h),k=Math.cos(h),l=Math.sin(i),m=Math.cos(i),n=g,o=2*Math.PI,p=20;while(Math.abs(n-o)>1e-12&&--p>0){var q=Math.sin(n),r=Math.cos(n),s=Math.sqrt(m*q*m*q+(k*l-j*m*r)*(k*l-j*m*r));if(s==0)return 0;var t=j*l+k*m*r,u=Math.atan2(s,t),v=Math.asin(k*m*q/s),w=Math.cos(v)*Math.cos(v),x=t-2*j*l/w,y=f/16*w*(4+f*(4-3*w));o=n,n=g+(1-y)*f*Math.sin(v)*(u+y*s*(x+y*t*(-1+2*x*x)))}if(p==0)return NaN;var z=w*(d*d-e*e)/(e*e),A=1+z/16384*(4096+z*(-768+z*(320-175*z))),B=z/1024*(256+z*(-128+z*(74-47*z))),C=B*s*(x+B/4*(t*(-1+2*x*x)-B/6*x*(-3+4*s*s)*(-3+4*x*x))),D=e*A*(u-C),E=D.toFixed(3)/1e3;return E},OpenLayers.Util.destinationVincenty=function(a,b,c){var d=OpenLayers.Util,e=d.VincentyConstants,f=e.a,g=e.b,h=e.f,i=a.lon,j=a.lat,k=c,l=d.rad(b),m=Math.sin(l),n=Math.cos(l),o=(1-h)*Math.tan(d.rad(j)),p=1/Math.sqrt(1+o*o),q=o*p,r=Math.atan2(o,n),s=p*m,t=1-s*s,u=t*(f*f-g*g)/(g*g),v=1+u/16384*(4096+u*(-768+u*(320-175*u))),w=u/1024*(256+u*(-128+u*(74-47*u))),x=k/(g*v),y=2*Math.PI;while(Math.abs(x-y)>1e-12){var z=Math.cos(2*r+x),A=Math.sin(x),B=Math.cos(x),C=w*A*(z+w/4*(B*(-1+2*z*z)-w/6*z*(-3+4*A*A)*(-3+4*z*z)));y=x,x=k/(g*v)+C}var D=q*A-p*B*n,E=Math.atan2(q*B+p*A*n,(1-h)*Math.sqrt(s*s+D*D)),F=Math.atan2(A*m,p*B-q*A*n),G=h/16*t*(4+h*(4-3*t)),H=F-(1-G)*h*s*(x+G*A*(z+G*B*(-1+2*z*z))),I=Math.atan2(s,-D);return new OpenLayers.LonLat(i+d.deg(H),d.deg(E))},OpenLayers.Util.getParameters=function(a){a=a||window.location.href;var b="";if(OpenLayers.String.contains(a,"?")){var c=a.indexOf("?")+1,d=OpenLayers.String.contains(a,"#")?a.indexOf("#"):a.length;b=a.substring(c,d)}var e={},f=b.split(/[&;]/);for(var g=0,h=f.length;g1?1/a:a;return b},OpenLayers.Util.getResolutionFromScale=function(a,b){var c;if(a){b==null&&(b="degrees");var d=OpenLayers.Util.normalizeScale(a);c=1/(d*OpenLayers.INCHES_PER_UNIT[b]*OpenLayers.DOTS_PER_INCH)}return c},OpenLayers.Util.getScaleFromResolution=function(a,b){b==null&&(b="degrees");var c=a*OpenLayers.INCHES_PER_UNIT[b]*OpenLayers.DOTS_PER_INCH;return c},OpenLayers.Util.safeStopPropagation=function(a){OpenLayers.Event.stop(a,!0)},OpenLayers.Util.pagePosition=function(a){var b=[0,0],c=OpenLayers.Util.getViewportElement();if(!a||a==window||a==c)return b;var d=OpenLayers.IS_GECKO&&document.getBoxObjectFor&&OpenLayers.Element.getStyle(a,"position")=="absolute"&&(a.style.top==""||a.style.left==""),e=null,f;if(a.getBoundingClientRect){f=a.getBoundingClientRect();var g=c.scrollTop,h=c.scrollLeft;b[0]=f.left+h,b[1]=f.top+g}else if(document.getBoxObjectFor&&!d){f=document.getBoxObjectFor(a);var i=document.getBoxObjectFor(c);b[0]=f.screenX-i.screenX,b[1]=f.screenY-i.screenY}else{b[0]=a.offsetLeft,b[1]=a.offsetTop,e=a.offsetParent;if(e!=a)while(e)b[0]+=e.offsetLeft,b[1]+=e.offsetTop,e=e.offsetParent;var j=OpenLayers.BROWSER_NAME;if(j=="opera"||j=="safari"&&OpenLayers.Element.getStyle(a,"position")=="absolute")b[1]-=document.body.offsetTop;e=a.offsetParent;while(e&&e!=document.body){b[0]-=e.scrollLeft;if(j!="opera"||e.tagName!="TR")b[1]-=e.scrollTop;e=e.offsetParent}}return b},OpenLayers.Util.getViewportElement=function(){var a=arguments.callee.viewportElement;a==undefined&&(a=OpenLayers.BROWSER_NAME=="msie"&&document.compatMode!="CSS1Compat"?document.body:document.documentElement,arguments.callee.viewportElement=a);return a},OpenLayers.Util.isEquivalentUrl=function(a,b,c){c=c||{},OpenLayers.Util.applyDefaults(c,{ignoreCase:!0,ignorePort80:!0,ignoreHash:!0});var d=OpenLayers.Util.createUrlObject(a,c),e=OpenLayers.Util.createUrlObject(b,c);for(var f in d)if(f!=="args"&&d[f]!=e[f])return!1;for(var f in d.args){if(d.args[f]!=e.args[f])return!1;delete e.args[f]}for(var f in e.args)return!1;return!0},OpenLayers.Util.createUrlObject=function(a,b){b=b||{};if(!/^\w+:\/\//.test(a)){var c=window.location,d=c.port?":"+c.port:"",e=c.protocol+"//"+c.host.split(":").shift()+d;if(a.indexOf("/")===0)a=e+a;else{var f=c.pathname.split("/");f.pop(),a=e+f.join("/")+"/"+a}}b.ignoreCase&&(a=a.toLowerCase());var g=document.createElement("a");g.href=a;var h={};h.host=g.host.split(":").shift(),h.protocol=g.protocol,b.ignorePort80?h.port=g.port=="80"||g.port=="0"?"":g.port:h.port=g.port==""||g.port=="0"?"80":g.port,h.hash=b.ignoreHash||g.hash==="#"?"":g.hash;var i=g.search;if(!i){var j=a.indexOf("?");i=j!=-1?a.substr(j):""}h.args=OpenLayers.Util.getParameters(i),h.pathname=g.pathname.charAt(0)=="/"?g.pathname:"/"+g.pathname;return h},OpenLayers.Util.removeTail=function(a){var b=null,c=a.indexOf("?"),d=a.indexOf("#");c==-1?b=d!=-1?a.substr(0,d):a:b=d!=-1?a.substr(0,Math.min(c,d)):a.substr(0,c);return b},OpenLayers.IS_GECKO=function(){return navigator.userAgent.toLowerCase().indexOf("gecko")!=-1}(),OpenLayers.BROWSER_NAME=function(){var a="",b=navigator.userAgent.toLowerCase();b.indexOf("opera")!=-1?a="opera":b.indexOf("msie")!=-1?a="msie":b.indexOf("safari")!=-1?a="safari":b.indexOf("mozilla")!=-1&&(b.indexOf("firefox")!=-1?a="firefox":a="mozilla");return a}(),OpenLayers.Util.getBrowserName=function(){return OpenLayers.BROWSER_NAME},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;b&&(b.w?(d=b.w,f.style.width=d+"px"):b.h&&(e=b.h,f.style.height=e+"px")),c&&c.displayClass&&(f.className=c.displayClass);var h=document.createElement("div");h.innerHTML=a,h.style.overflow="visible";if(h.childNodes)for(var i=0,j=h.childNodes.length;i=0&&(f<10&&(f="0"+f),i+=f+"'",c.indexOf("dms")>=0&&(h<10&&(h="0"+h),i+=h+'"')),b=="lon"?i+=a<0?OpenLayers.i18n("W"):OpenLayers.i18n("E"):i+=a<0?OpenLayers.i18n("S"):OpenLayers.i18n("N");return i},OpenLayers.Rico=new Object,OpenLayers.Rico.Corner={round:function(a,b){a=OpenLayers.Util.getElement(a),this._setOptions(b);var c=this.options.color;this.options.color=="fromElement"&&(c=this._background(a));var d=this.options.bgColor;this.options.bgColor=="fromParent"&&(d=this._background(a.offsetParent)),this._roundCornersImpl(a,c,d)},changeColor:function(a,b){a.style.backgroundColor=b;var c=a.parentNode.getElementsByTagName("span");for(var d=0;d"+a.innerHTML+""},_roundTopCorners:function(a,b,c){var d=this._createCorner(c);for(var e=0;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";var g=this._borderColor(a,b);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=g):g&&(f.borderColor=g,f.borderStyle="solid",f.borderWidth="0px 1px"),!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:!0,border:!1,compact:!1},OpenLayers.Util.extend(this.options,a||{}),this.options.numSlices=this.options.compact?2:4,this._isTransparent()&&(this.options.blend=!1)},_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";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";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){var d=this._marginSize(b),e=c=="top"?this._whichSideTop():this._whichSideBottom();e=="left"?(a.style.marginLeft=d+"px",a.style.marginRight="0px"):e=="right"?(a.style.marginRight=d+"px",a.style.marginLeft="0px"):(a.style.marginLeft=d+"px",a.style.marginRight=d+"px")},_setBorder:function(a,b,c){var d=this._borderSize(b),e=c=="top"?this._whichSideTop():this._whichSideBottom();e=="left"?(a.style.borderLeftWidth=d+"px",a.style.borderRightWidth="0px"):e=="right"?(a.style.borderRightWidth=d+"px",a.style.borderLeftWidth="0px"):(a.style.borderLeftWidth=d+"px",a.style.borderRightWidth=d+"px"),this.options.border!=!1&&(a.style.borderLeftWidth=d+"px",a.style.borderRightWidth=d+"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;if(this.options.compact)return d[a];if(this.options.blend)return c[a];if(this.options.border)return e[a];if(this._isTransparent())return b[a];return 0},_hasString:function(a){for(var b=1;b=0)return!0;return!1},_blend:function(a,b){var c=OpenLayers.Rico.Color.createFromHex(a);c.blend(OpenLayers.Rico.Color.createFromHex(b));return c},_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.Element={visible:function(a){return OpenLayers.Util.getElement(a).style.display!="none"},toggle:function(){for(var a=0,b=arguments.length;a"+this.contentDiv.innerHTML+"",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{var f=new OpenLayers.Size;f.w=d.wa.w-this.map.paddingForPopups.right&&(c.x=a.w-this.map.paddingForPopups.right-this.size.w),b.ya.h-this.map.paddingForPopups.bottom&&(c.y=a.h-this.map.paddingForPopups.bottom-this.size.h);var d=b.x-c.x,e=b.y-c.y;this.map.pan(d,e)},registerEvents:function(){this.events=new OpenLayers.Events(this,this.div,null,!0),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=!0,OpenLayers.Event.stop(a,!0)},onmousemove:function(a){this.mousedown&&OpenLayers.Event.stop(a,!0)},onmouseup:function(a){this.mousedown&&(this.mousedown=!1,OpenLayers.Event.stop(a,!0))},onclick:function(a){OpenLayers.Event.stop(a,!0)},onmouseout:function(a){this.mousedown=!1},ondblclick:function(a){OpenLayers.Event.stop(a,!0)},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.Renderer=OpenLayers.Class({container:null,root:null,extent:null,locked:!1,size:null,resolution:null,map:null,initialize:function(a,b){this.container=OpenLayers.Util.getElement(a)},destroy:function(){this.container=null,this.extent=null,this.size=null,this.resolution=null,this.map=null},supported:function(){return!1},setExtent:function(a,b){this.extent=a.clone(),b&&(this.resolution=null)},setSize:function(a){this.size=a.clone(),this.resolution=null},getResolution:function(){this.resolution=this.resolution||this.map.getResolution();return this.resolution},drawFeature:function(a,b){b==null&&(b=a.style);if(a.geometry){var c=a.geometry.getBounds();if(c){c.intersectsBounds(this.extent)||(b={display:"none"});var d=this.drawGeometry(a.geometry,b,a.id);if(b.display!="none"&&b.label&&d!==!1){var e=a.geometry.getCentroid();if(b.labelXOffset||b.labelYOffset){xOffset=isNaN(b.labelXOffset)?0:b.labelXOffset,yOffset=isNaN(b.labelYOffset)?0:b.labelYOffset;var f=this.getResolution();e.move(xOffset*f,yOffset*f)}this.drawText(a.id,b,e)}else this.removeText(a.id);return d}}},drawGeometry:function(a,b,c){},drawText:function(a,b,c){},removeText:function(a){},clear:function(){},getFeatureIdFromEvent:function(a){},eraseFeatures:function(a){a instanceof Array||(a=[a]);for(var b=0,c=a.length;bthis.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){c==null&&(c=!0);if(a==null||b==null)return!1;a=OpenLayers.Util.toFloat(a),b=OpenLayers.Util.toFloat(b);var d=!1;c?d=a>=this.left&&a<=this.right&&b>=this.bottom&&b<=this.top:d=a>this.left&&athis.bottom&&b=this.bottom&&a.bottom<=this.top||this.bottom>=a.bottom&&this.bottom<=a.top,f=a.top>=this.bottom&&a.top<=this.top||this.top>a.bottom&&this.top=this.left&&a.left<=this.right||this.left>=a.left&&this.left<=a.right,h=a.right>=this.left&&a.right<=this.right||this.right>=a.left&&this.right<=a.right;c=(e||f)&&(g||h)}return c},containsBounds:function(a,b,c){b==null&&(b=!1),c==null&&(c=!0);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),g=this.contains(a.right,a.top,c);return b?d||e||f||g:d&&e&&f&&g},determineQuadrant:function(a){var b="",c=this.getCenterLonLat();b+=a.lat=a.right&&e.right>a.right)e=e.add(-a.getWidth(),0)}return e},CLASS_NAME:"OpenLayers.Bounds"}),OpenLayers.Bounds.fromString=function(a){var b=a.split(",");return OpenLayers.Bounds.fromArray(b)},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.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){var c=OpenLayers.i18n("lonlatAddError");OpenLayers.Console.error(c);return null}return new OpenLayers.LonLat(this.lon+OpenLayers.Util.toFloat(a), +this.lat+OpenLayers.Util.toFloat(b))},equals:function(a){var b=!1;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){var c=OpenLayers.Projection.transform({x:this.lon,y:this.lat},a,b);this.lon=c.x,this.lat=c.y;return this},wrapDateLine:function(a){var b=this.clone();if(a){while(b.lona.right)b.lon-=a.getWidth()}return b},CLASS_NAME:"OpenLayers.LonLat"}),OpenLayers.LonLat.fromString=function(a){var b=a.split(",");return new OpenLayers.LonLat(b[0],b[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=!1;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){var c=OpenLayers.i18n("pixelAddError");OpenLayers.Console.error(c);return null}return new OpenLayers.Pixel(this.x+a,this.y+b)},offset:function(a){var b=this.clone();a&&(b=this.add(a.x,a.y));return b},CLASS_NAME:"OpenLayers.Pixel"}),OpenLayers.Control=OpenLayers.Class({id:null,map:null,div:null,type:null,allowSelection:!1,displayClass:"",title:"",autoActivate:!1,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),this.id==null&&(this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_"))},destroy:function(){this.events&&(this.eventListeners&&this.events.un(this.eventListeners),this.events.destroy(),this.events=null),this.eventListeners=null,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}this.map&&(this.map.removeControl(this),this.map=null)},setMap:function(a){this.map=a,this.handler&&this.handler.setMap(a)},draw:function(a){this.div==null&&(this.div=OpenLayers.Util.createDiv(this.id),this.div.className=this.displayClass,this.allowSelection||(this.div.className+=" olControlNoSelect",this.div.setAttribute("unselectable","on",0),this.div.onselectstart=OpenLayers.Function.False),this.title!=""&&(this.div.title=this.title)),a!=null&&(this.position=a.clone()),this.moveTo(this.position);return this.div},moveTo:function(a){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!1;this.handler&&this.handler.activate(),this.active=!0,this.map&&OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active"),this.events.triggerEvent("activate");return!0},deactivate:function(){if(this.active){this.handler&&this.handler.deactivate(),this.active=!1,this.map&&OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active"),this.events.triggerEvent("deactivate");return!0}return!1},CLASS_NAME:"OpenLayers.Control"}),OpenLayers.Control.TYPE_BUTTON=1,OpenLayers.Control.TYPE_TOGGLE=2,OpenLayers.Control.TYPE_TOOL=3,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.BROWSER_NAME=="msie"?navigator.userLanguage:navigator.language);var c=a.split("-");c[0]=c[0].toLowerCase(),typeof OpenLayers.Lang[c[0]]=="object"&&(b=c[0]);if(c[1]){var d=c[0]+"-"+c[1].toUpperCase();typeof OpenLayers.Lang[d]=="object"&&(b=d)}b||(OpenLayers.Console.warn("Failed to find OpenLayers.Lang."+c.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()],d=c[a];d||(d=a),b&&(d=OpenLayers.String.format(d,b));return d}},OpenLayers.i18n=OpenLayers.Lang.translate,OpenLayers.Popup.Anchored=OpenLayers.Class(OpenLayers.Popup,{relativePosition:null,keepInMap:!0,anchor:null,initialize:function(a,b,c,d,e,f,g){var h=[a,b,c,d,f,g];OpenLayers.Popup.prototype.initialize.apply(this,h),this.anchor=e!=null?e:{size:new OpenLayers.Size(0,0),offset:new OpenLayers.Pixel(0,0)}},destroy:function(){this.anchor=null,this.relativePosition=null,OpenLayers.Popup.prototype.destroy.apply(this,arguments)},show:function(){this.updatePosition(),OpenLayers.Popup.prototype.show.apply(this,arguments)},moveTo:function(a){var b=this.relativePosition;this.relativePosition=this.calculateRelativePosition(a);var c=this.calculateNewPx(a),d=Array(c);OpenLayers.Popup.prototype.moveTo.apply(this,d),this.relativePosition!=b&&this.updateRelativePosition()},setSize:function(a){OpenLayers.Popup.prototype.setSize.apply(this,arguments);if(this.lonlat&&this.map){var b=this.map.getLayerPxFromLonLat(this.lonlat);this.moveTo(b)}},calculateRelativePosition:function(a){var b=this.map.getLonLatFromLayerPx(a),c=this.map.getExtent(),d=c.determineQuadrant(b);return OpenLayers.Bounds.oppositeQuadrant(d)},updateRelativePosition:function(){},calculateNewPx:function(a){var b=a.offset(this.anchor.offset),c=this.size||this.contentSize,d=this.relativePosition.charAt(0)=="t";b.y+=d?-(c.h+this.anchor.size.h):this.anchor.size.h;var e=this.relativePosition.charAt(1)=="l";b.x+=e?-(c.w+this.anchor.size.w):this.anchor.size.w;return b},CLASS_NAME:"OpenLayers.Popup.Anchored"}),OpenLayers.Renderer.Canvas=OpenLayers.Class(OpenLayers.Renderer,{canvas:null,features:null,initialize:function(a){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={}},eraseGeometry:function(a,b){this.eraseFeatures(this.features[b][0])},supported:function(){var a=document.createElement("canvas");return!!a.getContext},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){b=b||a.style,b=this.applyDefaultSymbolizer(b),this.features[a.id]=[a,b],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(var d=0;d1){e=parseInt((c+d)/2);var f=this.compare(this,a,OpenLayers.Util.getElement(this.order[e]));f>0?c=e:d=e}this.order.splice(d,0,b),this.indices[b]=this.getZIndex(a);return this.getNextElement(d)},remove:function(a){var b=a.id,c=OpenLayers.Util.indexOf(this.order,b);if(c>=0){this.order.splice(c,1),delete this.indices[b];if(this.order.length>0){var d=this.order[this.order.length-1];this.maxZIndex=this.indices[d]}else this.maxZIndex=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;b==null?(b=this.maxZIndex,a._style.graphicZIndex=b):b>this.maxZIndex&&(this.maxZIndex=b)},getNextElement:function(a){var b=a+1;if(bthis.duration&&this.stop()},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.Control.ArgParser=OpenLayers.Class(OpenLayers.Control,{center:null,zoom:null,layers:null,displayProjection:null,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,arguments)},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments);for(var b=0,c=this.map.controls.length;b=0;--a)this._removeButton(this.buttons[a])},doubleClick:function(a){OpenLayers.Event.stop(a);return!1},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()}OpenLayers.Event.stop(a)}},CLASS_NAME:"OpenLayers.Control.PanZoom"}),OpenLayers.Control.PanZoom.X=4,OpenLayers.Control.PanZoom.Y=4,OpenLayers.Control.Panel=OpenLayers.Class(OpenLayers.Control,{controls:null,autoActivate:!0,defaultControl:null,saveState:!1,activeState:null,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,[a]),this.controls=[],this.activeState={}},destroy:function(){OpenLayers.Control.prototype.destroy.apply(this,arguments);for(var a=this.controls.length-1;a>=0;a--)this.controls[a].events&&this.controls[a].events.un({activate:this.redraw,deactivate:this.redraw,scope:this}),OpenLayers.Event.stopObservingElement(this.controls[a].panel_div),this.controls[a].panel_div=null;this.activeState=null},activate:function(){if(OpenLayers.Control.prototype.activate.apply(this,arguments)){var a;for(var b=0,c=this.controls.length;b=0;b--)this.div.removeChild(this.div.childNodes[b]);this.div.innerHTML="";if(this.active)for(var b=0,c=this.controls.length;b5?e=5:d>2?e=2:e=1;return e*c},update:function(){var a=this.map.getResolution();if(!!a){var b=this.map.getUnits(),c=OpenLayers.INCHES_PER_UNIT,d=this.maxWidth*a*c[b],e=1;if(this.geodesic===!0){var f=(this.map.getGeodesicPixelSize().w||1e-6)*this.maxWidth,g=d/c.km;e=f/g,d*=e}var h,i;d>1e5?(h=this.topOutUnits,i=this.bottomOutUnits):(h=this.topInUnits,i=this.bottomInUnits);var j=d/c[h],k=d/c[i],l=this.getBarLen(j),m=this.getBarLen(k);j=l/c[b]*c[h],k=m/c[b]*c[i];var n=j/a/e,o=k/a/e;this.eBottom.style.visibility=="visible"&&(this.eBottom.style.width=Math.round(o)+"px",this.eBottom.innerHTML=m+" "+i),this.eTop.style.visibility=="visible"&&(this.eTop.style.width=Math.round(n)+"px",this.eTop.innerHTML=l+" "+h)}},CLASS_NAME:"OpenLayers.Control.ScaleLine"}),OpenLayers.Control.ZoomIn=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){this.map.zoomIn()},CLASS_NAME:"OpenLayers.Control.ZoomIn"}),OpenLayers.Control.ZoomOut=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){this.map.zoomOut()},CLASS_NAME:"OpenLayers.Control.ZoomOut"}),OpenLayers.Control.ZoomToMaxExtent=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){this.map&&this.map.zoomToMaxExtent()},CLASS_NAME:"OpenLayers.Control.ZoomToMaxExtent"}),OpenLayers.Event={observers:!1,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){b||(a.preventDefault?a.preventDefault():a.returnValue=!1),a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},findElement:function(a,b){var c=OpenLayers.Event.element(a);while(c.parentNode&&(!c.tagName||c.tagName.toUpperCase()!=b.toUpperCase()))c=c.parentNode;return c},observe:function(a,b,c,d){var e=OpenLayers.Util.getElement(a);d=d||!1,b=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||e.attachEvent)&&(b="keydown"),this.observers||(this.observers={});if(!e._eventCacheID){var f="eventCacheID_";e.id&&(f=e.id+"_"+f),e._eventCacheID=OpenLayers.Util.createUniqueID(f)}var g=e._eventCacheID;this.observers[g]||(this.observers[g]=[]),this.observers[g].push({element:e,name:b,observer:c,useCapture:d}),e.addEventListener?e.addEventListener(b,c,d):e.attachEvent&&e.attachEvent("on"+b,c)},stopObservingElement:function(a){var b=OpenLayers.Util.getElement(a),c=b._eventCacheID;this._removeElementObservers(OpenLayers.Event.observers[c])},_removeElementObservers:function(a){if(a)for(var b=a.length-1;b>=0;b--)var c=a[b],d=[c.element,c.name,c.observer,c.useCapture],e=OpenLayers.Event.stopObserving.apply(this,d)},stopObserving:function(a,b,c,d){d=d||!1;var e=OpenLayers.Util.getElement(a),f=e._eventCacheID;b=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||e.detachEvent)&&(b="keydown");var g=!1,h=OpenLayers.Event.observers[f];if(h){var i=0;while(!g&&i
To get rid of this message, select a new BaseLayer in the layer switcher in the upper-right corner.

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.

Developers: For help getting this working correctly, click here",getLayerWarning:"The ${layerType} Layer was unable to load correctly.

To get rid of this message, select a new BaseLayer in the layer switcher in the upper-right corner.

Most likely, this is because the ${layerLib} library script was not correctly included.

Developers: For help getting this working correctly, click here",scale:"Scale = 1 : ${scaleDenom}",W:"W",E:"E",N:"N",S:"S",graticule:"Graticule",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.",filterEvaluateNotImplemented:"evaluate is not implemented for this filter type.",end:""},OpenLayers.Popup.AnchoredBubble=OpenLayers.Class(OpenLayers.Popup.Anchored,{rounded:!1,initialize:function(a,b,c,d,e,f,g){this.padding=new OpenLayers.Bounds(0,OpenLayers.Popup.AnchoredBubble.CORNER_SIZE,0,OpenLayers.Popup.AnchoredBubble.CORNER_SIZE),OpenLayers.Popup.Anchored.prototype.initialize.apply(this,arguments)},draw:function(a){OpenLayers.Popup.Anchored.prototype.draw.apply(this,arguments),this.setContentHTML(),this.setBackgroundColor(),this.setOpacity();return this.div},updateRelativePosition:function(){this.setRicoCorners()},setSize:function(a){OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments),this.setRicoCorners()},setBackgroundColor:function(a){a!=undefined&&(this.backgroundColor=a),this.div!=null&&this.contentDiv!=null&&(this.div.style.background="transparent",OpenLayers.Rico.Corner.changeColor(this.groupDiv,this.backgroundColor))},setOpacity:function(a){OpenLayers.Popup.Anchored.prototype.setOpacity.call(this,a),this.div!=null&&this.groupDiv!=null&&OpenLayers.Rico.Corner.changeOpacity(this.groupDiv,this.opacity)},setBorder:function(a){this.border=0},setRicoCorners:function(){var a=this.getCornersToRound(this.relativePosition),b={corners:a,color:this.backgroundColor,bgColor:"transparent",blend:!1};this.rounded?(OpenLayers.Rico.Corner.reRound(this.groupDiv,b),this.setBackgroundColor(),this.setOpacity()):(OpenLayers.Rico.Corner.round(this.div,b),this.rounded=!0)},getCornersToRound:function(){var a=["tl","tr","bl","br"],b=OpenLayers.Bounds.oppositeQuadrant(this.relativePosition);OpenLayers.Util.removeItem(a,b);return a.join(" ")},CLASS_NAME:"OpenLayers.Popup.AnchoredBubble"}),OpenLayers.Popup.AnchoredBubble.CORNER_SIZE=5,OpenLayers.Projection=OpenLayers.Class({proj:null,projCode:null,titleRegEx:/\+title=[^\+]*/,initialize:function(a,b){OpenLayers.Util.extend(this,b),this.projCode=a,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){var b=a,c=!1;if(b)if(window.Proj4js&&this.proj.defData&&b.proj.defData)c=this.proj.defData.replace(this.titleRegEx,"")==b.proj.defData.replace(this.titleRegEx,"");else if(b.getCode){var d=this.getCode(),e=b.getCode();c=d==e||!!OpenLayers.Projection.transforms[d]&&OpenLayers.Projection.transforms[d][e]===OpenLayers.Projection.nullTransform}return c},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){b.proj&&c.proj?a=Proj4js.transform(b.proj,c.proj,a):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.Projection.nullTransform=function(a){return a},OpenLayers.Renderer.SVG=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"http://www.w3.org/2000/svg",xlinkns:"http://www.w3.org/1999/xlink",MAX_PIXEL:15e3,translationParameters:null,symbolMetrics:null,supportUse:null,initialize:function(a){!this.supported()||(OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments),this.translationParameters={x:0,y:0},this.supportUse=navigator.userAgent.toLowerCase().indexOf("applewebkit/5")==-1,this.symbolMetrics={})},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments)},supported:function(){var a="http://www.w3.org/TR/SVG11/feature#";return document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature(a+"SVG","1.1")||document.implementation.hasFeature(a+"BasicStructure","1.1"))},inValidRange:function(a,b,c){var d=a+(c?0:this.translationParameters.x),e=b+(c?0:this.translationParameters.y);return d>=-this.MAX_PIXEL&&d<=this.MAX_PIXEL&&e>=-this.MAX_PIXEL&&e<=this.MAX_PIXEL},setExtent:function(a,b){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var c=this.getResolution(),d=-a.left/c,e=a.top/c;if(b){this.left=d,this.top=e;var f="0 0 "+this.size.w+" "+this.size.h;this.rendererRoot.setAttributeNS(null,"viewBox",f),this.translate(0,0);return!0}var g=this.translate(d-this.left,e-this.top);g||this.setExtent(a,!0);return g},translate:function(a,b){if(!this.inValidRange(a,b,!0))return!1;var c="";if(a||b)c="translate("+a+","+b+")";this.root.setAttributeNS(null,"transform",c),this.translationParameters={x:a,y:b};return!0},setSize:function(a){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":b.externalGraphic?c="image":this.isComplexSymbol(b.graphicName)?c=this.supportUse===!1?"svg":"use":c="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:}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===!1)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");var g=b.graphicWidth||b.graphicHeight,h=b.graphicHeight||b.graphicWidth;g=g?g:b.pointRadius*2,h=h?h:b.pointRadius*2;var i=b.graphicXOffset!=undefined?b.graphicXOffset:-(.5*g),j=b.graphicYOffset!=undefined?b.graphicYOffset:-(.5*h),k=b.graphicOpacity||b.fillOpacity;a.setAttributeNS(null,"x",(f.x+i).toFixed()),a.setAttributeNS(null,"y",(f.y+j).toFixed()),a.setAttributeNS(null,"width",g),a.setAttributeNS(null,"height",h),a.setAttributeNS(this.xlinkns,"href",b.externalGraphic),a.setAttributeNS(null,"style","opacity: "+k)}else if(this.isComplexSymbol(b.graphicName)){var l=b.pointRadius*3,m=l*2,n=this.importSymbol(b.graphicName);f=this.getPosition(a),e=this.symbolMetrics[n][0]*3/m;var o=a.parentNode,p=a.nextSibling;o&&o.removeChild(a);if(this.supportUse===!1){var q=document.getElementById(n);a.firstChild&&a.removeChild(a.firstChild),a.appendChild(q.firstChild.cloneNode(!0)),a.setAttributeNS(null,"viewBox",q.getAttributeNS(null,"viewBox"))}else a.setAttributeNS(this.xlinkns,"href","#"+n);a.setAttributeNS(null,"width",m),a.setAttributeNS(null,"height",m),a.setAttributeNS(null,"x",f.x-l),a.setAttributeNS(null,"y",f.y-l),p?o.insertBefore(a,p):o&&o.appendChild(a)}else a.setAttributeNS(null,"r",b.pointRadius);var r=b.rotation;if((r!==undefined||a._rotation!==undefined)&&f){a._rotation=r,r|=0;if(a.nodeName!=="svg")a.setAttributeNS(null,"transform","rotate("+r+" "+f.x+" "+f.y+")");else{var s=this.symbolMetrics[n];a.firstChild.setAttributeNS(null,"transform","rotate("+b.rotation+" "+s[1]+" "+s[2]+")")}}}c.isFilled?(a.setAttributeNS(null,"fill",b.fillColor),a.setAttributeNS(null,"fill-opacity",b.fillOpacity)):a.setAttributeNS(null,"fill","none"),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||"round"),a.setAttributeNS(null,"stroke-linejoin","round"),b.strokeDashstyle&&a.setAttributeNS(null,"stroke-dasharray",this.dashStyle(b,e))):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){var c=a.strokeWidth*b,d=a.strokeDashstyle;switch(d){case"solid":return"none";case"dot":return[1,4*c].join();case"dash":return[4*c,4*c].join();case"dashdot":return[4*c,4*c,1,4*c].join();case"longdash":return[8*c,4*c].join();case"longdashdot":return[8*c,4*c,1,4*c].join();default:return OpenLayers.String.trim(d).replace(/\s+/g,",")}},createNode:function(a,b){var c=document.createElementNS(this.xmlns,a);b&&c.setAttributeNS(null,"id",b);return c},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,f=this.top-b.y/d;if(this.inValidRange(e,f)){a.setAttributeNS(null,"cx",e),a.setAttributeNS(null,"cy",f),a.setAttributeNS(null,"r",c);return a}return!1},drawLineString:function(a,b){var c=this.getComponentsString(b.components);if(c.path){a.setAttributeNS(null,"points",c.path);return c.complete?a:null}return!1},drawLinearRing:function(a,b){var c=this.getComponentsString(b.components);if(c.path){a.setAttributeNS(null,"points",c.path);return c.complete?a:null}return!1},drawPolygon:function(a,b){var c="",d=!0,e=!0,f,g;for(var h=0,i=b.components.length;h0&&this.getShortString(a[i-1])&&f.push(this.clipLine(a[i],a[i-1])),id)j=(i-g)/(h-f),h=h<0?-d:d,i=g+(h-f)*j;if(i<-e||i>e)j=(h-f)/(i-g),i=i<0?-e:e,h=f+(i-g)*j;return h+","+i},getShortString:function(a){var b=this.getResolution(),c=a.x/b+this.left,d=this.top-a.y/b;return this.inValidRange(c,d)?c+","+d:!1},getPosition:function(a){return{x:parseFloat(a.getAttributeNS(null,"cx")),y:parseFloat(a.getAttributeNS(null,"cy"))}},importSymbol:function(a){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)throw new Error(a+" is not a valid symbol name");var d=this.nodeFactory(b,"symbol"),e=this.nodeFactory(null,"polygon");d.appendChild(e);var f=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0),g=[],h,i;for(var j=0;j=2*c[1])return"longdash";return c[0]==1||c[1]==1?"dot":"dash"}if(c.length==4)return 1*c[0]>=2*c[1]?"longdashdot":"dashdot";return"solid"}},createNode:function(a,b){var c=document.createElement(a);b&&(c.id=b),c.unselectable="on",c.onselectstart=OpenLayers.Function.False;return c},nodeTypeCompare:function(a,b){var c=b,d=c.indexOf(":");d!=-1&&(c=c.substr(d+1));var e=a.nodeName;d=e.indexOf(":"),d!=-1&&(e=e.substr(d+1));return c==e},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|0)-c+"px",a.style.top=(b.y/d-this.offset.y|0)-c+"px";var e=c*2;a.style.width=e+"px",a.style.height=e+"px";return a}return!1},drawLineString:function(a,b){return this.drawLine(a,b,!1)},drawLinearRing:function(a,b){return this.drawLine(a,b,!0)},drawLine:function(a,b,c){this.setNodeDimension(a,b);var d=this.getResolution(),e=b.components.length,f=Array(e),g,h,i;for(var j=0;j0?(e.bottom=e.bottom-k,e.top=e.top+k):(e.left=e.left+k,e.right=e.right-k),c={path:j,size:e.getWidth(),left:e.left,bottom:e.bottom},this.symbolCache[b]=c;return c},CLASS_NAME:"OpenLayers.Renderer.VML"}),OpenLayers.Renderer.VML.LABEL_SHIFT={l:0,c:.5,r:1,t:0,m:.5,b:1},OpenLayers.Tile=OpenLayers.Class({EVENT_TYPES:["loadstart","loadend","reload","unload"],events:null,id:null,layer:null,url:null,bounds:null,size:null,position:null,isLoading:!1,initialize:function(a,b,c,d,e,f){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),OpenLayers.Util.extend(this,f)},unload:function(){this.isLoading&&(this.isLoading=!1,this.events.triggerEvent("unload"))},destroy:function(){this.layer=null,this.bounds=null,this.size=null,this.position=null,this.events.destroy(),this.events=null},clone:function(a){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,b=a&&this.bounds.intersectsBounds(a,!1);this.shouldDraw=b||this.layer.displayOutsideMaxExtent,this.clear();return this.shouldDraw},moveTo:function(a,b,c){c==null&&(c=!0),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);var c=this.layer.map.getLonLatFromLayerPx(a),d=a.clone();d.x+=this.size.w,d.y+=this.size.h;var e=this.layer.map.getLonLatFromLayerPx(d);c.lon>e.lon&&(c.lon<0?c.lon=-180-(c.lon+180):e.lon=180+e.lon+180);var f=new OpenLayers.Bounds(c.lon,e.lat,e.lon,c.lat);return f},showTile:function(){this.shouldDraw&&this.show()},show:function(){},hide:function(){},CLASS_NAME:"OpenLayers.Tile"}),OpenLayers.Control.PanZoomBar=OpenLayers.Class(OpenLayers.Control.PanZoom,{zoomStopWidth:18,zoomStopHeight:11,slider:null,sliderEvents:null,zoombarDiv:null,divEvents:null,zoomWorldIcon:!1,forceFixedZoomLevel:!1,mouseDragStart:null,zoomStart:null,initialize:function(){OpenLayers.Control.PanZoom.prototype.initialize.apply(this,arguments)},destroy:function(){this._removeZoomBar(),this.map.events.un({changebaselayer:this.redraw,scope:this}),OpenLayers.Control.PanZoom.prototype.destroy.apply(this,arguments),delete this.mouseDragStart,delete this.zoomStart},setMap:function(a){OpenLayers.Control.PanZoom.prototype.setMap.apply(this,arguments),this.map.events.register("changebaselayer",this,this.redraw)},redraw:function(){this.div!=null&&(this.removeButtons(),this._removeZoomBar()),this.draw()},draw:function(a){OpenLayers.Control.prototype.draw.apply(this,arguments),a=this.position.clone(),this.buttons=[];var b=new OpenLayers.Size(18,18),c=new OpenLayers.Pixel(a.x+b.w/2,a.y),d=b.w;this.zoomWorldIcon&&(c=new OpenLayers.Pixel(a.x+b.w,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.zoomWorldIcon&&(this._addButton("zoomworld","zoom-world-mini.png",a.add(b.w,0),b),d*=2),this._addButton("panright","east-mini.png",a.add(d,0),b),this._addButton("pandown","south-mini.png",c.add(0,b.h*2),b),this._addButton("zoomin","zoom-plus-mini.png",c.add(0,b.h*3+5),b),c=this._addZoomBar(c.add(0,b.h*4+5)),this._addButton("zoomout","zoom-minus-mini.png",c,b);return this.div},_addZoomBar:function(a){var b=OpenLayers.Util.getImagesLocation(),c=this.id+"_"+this.map.id,d=this.map.getNumZoomLevels()-1-this.map.getZoom(),e=OpenLayers.Util.createAlphaImageDiv(c,a.add(-1,d*this.zoomStopHeight),new OpenLayers.Size(20,9),b+"slider.png","absolute");this.slider=e,this.sliderEvents=new OpenLayers.Events(this,e,null,!0,{includeXY:!0}),this.sliderEvents.on({mousedown:this.zoomBarDown,mousemove:this.zoomBarDrag,mouseup:this.zoomBarUp,dblclick:this.doubleClick,click:this.doubleClick});var f=new OpenLayers.Size;f.h=this.zoomStopHeight*this.map.getNumZoomLevels(),f.w=this.zoomStopWidth;var g=null;if(OpenLayers.Util.alphaHack()){var c=this.id+"_"+this.map.id;g=OpenLayers.Util.createAlphaImageDiv(c,a,new OpenLayers.Size(f.w,this.zoomStopHeight),b+"zoombar.png","absolute",null,"crop"),g.style.height=f.h+"px"}else g=OpenLayers.Util.createDiv("OpenLayers_Control_PanZoomBar_Zoombar"+this.map.id,a,f,b+"zoombar.png");this.zoombarDiv=g,this.divEvents=new OpenLayers.Events(this,g,null,!0,{includeXY:!0}),this.divEvents.on({mousedown:this.divClick,mousemove:this.passEventToSlider,dblclick:this.doubleClick,click:this.doubleClick}),this.div.appendChild(g),this.startTop=parseInt(g.style.top),this.div.appendChild(e),this.map.events.register("zoomend",this,this.moveZoomBar),a=a.add(0,this.zoomStopHeight*this.map.getNumZoomLevels());return a},_removeZoomBar:function(){this.sliderEvents.un({mousedown:this.zoomBarDown,mousemove:this.zoomBarDrag,mouseup:this.zoomBarUp,dblclick:this.doubleClick,click:this.doubleClick}),this.sliderEvents.destroy(),this.divEvents.un({mousedown:this.divClick,mousemove:this.passEventToSlider,dblclick:this.doubleClick,click:this.doubleClick}),this.divEvents.destroy(),this.div.removeChild(this.zoombarDiv),this.zoombarDiv=null,this.div.removeChild(this.slider),this.slider=null,this.map.events.unregister("zoomend",this,this.moveZoomBar)},passEventToSlider:function(a){this.sliderEvents.handleBrowserEvent(a)},divClick:function(a){if(!!OpenLayers.Event.isLeftClick(a)){var b=a.xy.y/this.zoomStopHeight;if(this.forceFixedZoomLevel||!this.map.fractionalZoom)b=Math.floor(b);var c=this.map.getNumZoomLevels()-1-b;c=Math.min(Math.max(c,0),this.map.getNumZoomLevels()-1),this.map.zoomTo(c),OpenLayers.Event.stop(a)}},zoomBarDown:function(a){!OpenLayers.Event.isLeftClick(a)||(this.map.events.on({mousemove:this.passEventToSlider,mouseup:this.passEventToSlider,scope:this}),this.mouseDragStart=a.xy.clone(),this.zoomStart=a.xy.clone(),this.div.style.cursor="move",this.zoombarDiv.offsets=null,OpenLayers.Event.stop(a))},zoomBarDrag:function(a){if(this.mouseDragStart!=null){var b=this.mouseDragStart.y-a.xy.y,c=OpenLayers.Util.pagePosition(this.zoombarDiv);if(a.clientY-c[1]>0&&a.clientY-c[1]0&&c.push(","),c.push(this.writeNewline(),this.writeIndent(),b));this.level-=1,c.push(this.writeNewline(),this.writeIndent(),"]");return c.join("")},string:function(a){var b={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};if(/["\\\x00-\x1f]/.test(a))return'"'+a.replace(/([\x00-\x1f\\"])/g,function(a,c){var d=b[c];if(d)return d;d=c.charCodeAt();return"\\u00"+Math.floor(d/16).toString(16)+(d%16).toString(16)})+'"';return'"'+a+'"'},number:function(a){return isFinite(a)?String(a):"null"},"boolean":function(a){return String(a)},date:function(a){function b(a){return a<10?"0"+a:a}return'"'+a.getFullYear()+"-"+b(a.getMonth()+1)+"-"+b(a.getDate())+"T"+b(a.getHours())+":"+b(a.getMinutes())+":"+b(a.getSeconds())+'"'}},CLASS_NAME:"OpenLayers.Format.JSON"}),OpenLayers.Format.XML=OpenLayers.Class(OpenLayers.Format,{namespaces:null,namespaceAlias:null,defaultPrefix:null,readers:{},writers:{},xmldom:null,initialize:function(a){window.ActiveXObject&&(this.xmldom=new ActiveXObject("Microsoft.XMLDOM")),OpenLayers.Format.prototype.initialize.apply(this,[a]),this.namespaces=OpenLayers.Util.extend({},this.namespaces),this.namespaceAlias={};for(var b in this.namespaces)this.namespaceAlias[this.namespaces[b]]=b},destroy:function(){this.xmldom=null,OpenLayers.Format.prototype.destroy.apply(this,arguments)},setNamespace:function(a,b){this.namespaces[a]=b,this.namespaceAlias[b]=a},read:function(a){var b=a.indexOf("<");b>0&&(a=a.substring(b));var c=OpenLayers.Util.Try(OpenLayers.Function.bind(function(){var b;window.ActiveXObject&&!this.xmldom?b=new ActiveXObject("Microsoft.XMLDOM"):b=this.xmldom,b.loadXML(a);return b},this),function(){return(new DOMParser).parseFromString(a,"text/xml")},function(){var b=new XMLHttpRequest;b.open("GET","data:text/xml;charset=utf-8,"+encodeURIComponent(a),!1),b.overrideMimeType&&b.overrideMimeType("text/xml"),b.send(null);return b.responseXML});this.keepData&&(this.data=c);return c},write:function(a){var b;if(this.xmldom)b=a.xml;else{var c=new XMLSerializer;if(a.nodeType==1){var d=document.implementation.createDocument("","",null);d.importNode&&(a=d.importNode(a,!0)),d.appendChild(a),b=c.serializeToString(d)}else b=c.serializeToString(a)}return b},createElementNS:function(a,b){var c;this.xmldom?typeof a=="string"?c=this.xmldom.createNode(1,b,a):c=this.xmldom.createNode(1,b,""):c=document.createElementNS(a,b);return c},createTextNode:function(a){var b;typeof a!="string"&&(a=String(a)),this.xmldom?b=this.xmldom.createTextNode(a):b=document.createTextNode(a);return b},getElementsByTagNameNS:function(a,b,c){var d=[];if(a.getElementsByTagNameNS)d=a.getElementsByTagNameNS(b,c);else{var e=a.getElementsByTagName("*"),f,g;for(var h=0,i=e.length;h0?(d=a.substring(0,f),e=a.substring(f+1)):(c?d=this.namespaceAlias[c.namespaceURI]:d=this.defaultPrefix,e=a);var g=this.writers[d][e].apply(this,[b]);c&&c.appendChild(g);return g},getChildEl:function(a,b,c){return a&&this.getThisOrNextEl(a.firstChild,b,c)},getNextEl:function(a,b,c){return a&&this.getThisOrNextEl(a.nextSibling,b,c)},getThisOrNextEl:function(a,b,c){outer:for(var d=a;d;d=d.nextSibling)switch(d.nodeType){case 1:if((!b||b===(d.localName||d.nodeName.split(":").pop()))&&(!c||c===d.namespaceURI))break outer;d=null;break outer;case 3:if(/^\s*$/.test(d.nodeValue))break;case 4:case 6:case 12:case 10:case 11:d=null;break outer}return d||null},lookupNamespaceURI:function(a,b){var c=null;if(a)if(a.lookupNamespaceURI)c=a.lookupNamespaceURI(b);else outer:switch(a.nodeType){case 1:if(a.namespaceURI!==null&&a.prefix===b){c=a.namespaceURI;break outer}var d=a.attributes.length;if(d){var e;for(var f=0;f=0;--a)this.controls[a].destroy();this.controls=null}if(this.layers!=null){for(var a=this.layers.length-1;a>=0;--a)this.layers[a].destroy(!1);this.layers=null}this.viewPortDiv&&this.div.removeChild( +this.viewPortDiv),this.viewPortDiv=null,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",e=OpenLayers.Array.filter(this[a],function(a){return a[b]==c||d&&c.test(a[b])});return e},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){var b=null;for(var c=0,d=this.layers.length;cthis.layers.length&&(b=this.layers.length);if(c!=b){this.layers.splice(c,1),this.layers.splice(b,0,a);for(var d=0,e=this.layers.length;d=0;--c)this.removePopup(this.popups[c]);a.map=this,this.popups.push(a);var d=a.draw();d&&(d.style.zIndex=this.Z_INDEX_BASE.Popup+this.popups.length,this.layerContainerDiv.appendChild(d))},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;this.size!=null&&(a=this.size.clone());return a},updateSize:function(){var a=this.getCurrentSize();if(a&&!isNaN(a.h)&&!isNaN(a.w)){this.events.clearMouseCache();var b=this.getSize();b==null&&(this.size=b=a);if(!a.equals(b)){this.size=a;for(var c=0,d=this.layers.length;cthis.restrictedExtent.getWidth()?a=new OpenLayers.LonLat(i.lon,a.lat):h.leftthis.restrictedExtent.right&&(a=a.add(this.restrictedExtent.right-h.right,0)),h.getHeight()>this.restrictedExtent.getHeight()?a=new OpenLayers.LonLat(a.lon,i.lat):h.bottomthis.restrictedExtent.top&&(a=a.add(0,this.restrictedExtent.top-h.top))}}var j=e||this.isValidZoomLevel(b)&&b!=this.getZoom(),k=this.isValidLonLat(a)&&!a.equals(this.center);if(j||k||!d){!this.dragging&&!f&&this.events.triggerEvent("movestart"),k&&(!j&&this.center&&this.centerLayerContainer(a),this.center=a.clone());if(j||this.layerContainerOrigin==null)this.layerContainerOrigin=this.center.clone(),this.layerContainerDiv.style.left="0px",this.layerContainerDiv.style.top="0px";j&&(this.zoom=b,this.resolution=this.getResolutionForZoom(b),this.viewRequestID++);var l=this.getExtent();this.baseLayer.visibility&&(this.baseLayer.moveTo(l,j,d),d?this.baseLayer.events.triggerEvent("move"):this.baseLayer.events.triggerEvent("moveend",{zoomChanged:j})),l=this.baseLayer.getExtent();for(var m=0,n=this.layers.length;m=0&&a0&&(a=this.layers[0].getResolution());return a},getUnits:function(){var a=null;this.baseLayer!=null&&(a=this.baseLayer.units);return a},getScale:function(){var a=null;if(this.baseLayer!=null){var b=this.getResolution(),c=this.baseLayer.units;a=OpenLayers.Util.getScaleFromResolution(b,c)}return a},getZoomForExtent:function(a,b){var c=null;this.baseLayer!=null&&(c=this.baseLayer.getZoomForExtent(a,b));return c},getResolutionForZoom:function(a){var b=null;this.baseLayer&&(b=this.baseLayer.getResolutionForZoom(a));return b},getZoomForResolution:function(a,b){var c=null;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){var d=this.getMaxExtent();a=a.clone();while(a.right0){var f=d.indexOf("?")>-1?"&":"?";d+=f+e}}a.proxy&&d.indexOf("http")==0&&(typeof a.proxy=="function"?d=a.proxy(d):d=a.proxy+encodeURIComponent(d)),c.open(a.method,d,a.async,a.user,a.password);for(var g in a.headers)c.setRequestHeader(g,a.headers[g]);var h=this.events,i=this;c.onreadystatechange=function(){if(c.readyState==OpenLayers.Request.XMLHttpRequest.DONE){var b=h.triggerEvent("complete",{request:c,config:a,requestUrl:d});b!==!1&&i.runCallbacks({request:c,config:a,requestUrl:d})}},a.async===!1?c.send(a.data):window.setTimeout(function(){c._aborted!==!0&&c.send(a.data)},0);return c},runCallbacks:function(a){var b=a.request,c=a.config,d=c.scope?OpenLayers.Function.bind(c.callback,c.scope):c.callback,e;c.success&&(e=c.scope?OpenLayers.Function.bind(c.success,c.scope):c.success);var f;c.failure&&(f=c.scope?OpenLayers.Function.bind(c.failure,c.scope):c.failure),d(b);if(!b.status||b.status>=200&&b.status<300)this.events.triggerEvent("success",a),e&&e(b);b.status&&(b.status<200||b.status>=300)&&(this.events.triggerEvent("failure",a),f&&f(b))},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)}},OpenLayers.Tile.Image=OpenLayers.Class(OpenLayers.Tile,{url:null,imgDiv:null,frame:null,layerAlphaHack:null,isBackBuffer:!1,lastRatio:1,isFirstDraw:!0,backBufferTile:null,maxGetUrlLength:null,initialize:function(a,b,c,d,e,f){OpenLayers.Tile.prototype.initialize.apply(this,arguments),this.maxGetUrlLength!=null&&OpenLayers.Util.extend(this,OpenLayers.Tile.Image.IFrame),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()},destroy:function(){this.imgDiv!=null&&this.removeImgDiv(),this.imgDiv=null,this.frame!=null&&this.frame.parentNode==this.layer.div&&this.layer.div.removeChild(this.frame),this.frame=null,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){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(){this.layer!=this.layer.map.baseLayer&&this.layer.reproject&&(this.bounds=this.getBoundsFromBaseLayer(this.position));var a=OpenLayers.Tile.prototype.draw.apply(this,arguments);OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1||this.layer.singleTile?a?(this.backBufferTile||(this.backBufferTile=this.clone(),this.backBufferTile.hide(),this.backBufferTile.isBackBuffer=!0,this.events.register("loadend",this,this.resetBackBuffer),this.layer.events.register("loadend",this,this.resetBackBuffer)),this.startTransition()):this.backBufferTile&&this.backBufferTile.clear():a&&this.isFirstDraw&&(this.events.register("loadend",this,this.showTile),this.isFirstDraw=!1);if(!a)return!1;this.isLoading?this.events.triggerEvent("reload"):(this.isLoading=!0,this.events.triggerEvent("loadstart"));return this.renderTile()},resetBackBuffer:function(){this.showTile();if(this.backBufferTile&&(this.isFirstDraw||!this.layer.numLoadingTiles)){this.isFirstDraw=!1;var a=this.layer.maxExtent,b=a&&this.bounds.intersectsBounds(a,!1);b&&(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(){this.layer.async?(this.initImgDiv(),this.layer.getURLasync(this.bounds,this,"url",this.positionImage)):(this.url=this.layer.getURL(this.bounds),this.initImgDiv(),this.positionImage());return!0},positionImage:function(){if(this.layer!==null){OpenLayers.Util.modifyDOMElement(this.frame,null,this.position,this.size);var a=this.layer.getImageSize(this.bounds);this.layerAlphaHack?OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv,null,null,a,this.url):(OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,a),this.imgDiv.src=this.url)}},clear:function(){this.imgDiv&&(this.hide(),OpenLayers.Tile.Image.useBlankTile&&(this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif"))},initImgDiv:function(){if(this.imgDiv==null){var a=this.layer.imageOffset,b=this.layer.getImageSize(this.bounds);this.layerAlphaHack?this.imgDiv=OpenLayers.Util.createAlphaImageDiv(null,a,b,null,"relative",null,null,null,!0):this.imgDiv=OpenLayers.Util.createImage(null,a,b,null,"relative",null,null,!0),this.layer.url instanceof Array&&(this.imgDiv.urls=this.layer.url.slice()),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(){this.isLoading&&(this.isLoading=!1,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));var d=function(){this.imgDiv._attempts>OpenLayers.IMAGE_RELOAD_ATTEMPTS&&c.call(this)};OpenLayers.Event.observe(this.imgDiv,"error",OpenLayers.Function.bind(d,this))}this.imgDiv.viewRequestID=this.layer.map.viewRequestID},removeImgDiv:function(){OpenLayers.Event.stopObservingElement(this.imgDiv),this.imgDiv.parentNode==this.frame&&(this.frame.removeChild(this.imgDiv),this.imgDiv.map=null),this.imgDiv.urls=null;var a=this.imgDiv.firstChild;a?(OpenLayers.Event.stopObservingElement(a),this.imgDiv.removeChild(a),delete a):this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif"},checkImgURL:function(){if(this.layer){var a=this.layerAlphaHack?this.imgDiv.firstChild.src:this.imgDiv.src;OpenLayers.Util.isEquivalentUrl(a,this.url)||this.hide()}},startTransition:function(){if(!!this.backBufferTile&&!!this.backBufferTile.imgDiv){var a=1;this.backBufferTile.resolution&&(a=this.backBufferTile.resolution/this.layer.getResolution());if(a!=this.lastRatio){if(this.layer.transitionEffect=="resize"){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),d=this.layer.map.getLayerPxFromLonLat(b);OpenLayers.Util.modifyDOMElement(this.backBufferTile.frame,null,d,c);var e=this.backBufferTile.imageSize;e=new OpenLayers.Size(e.w*a,e.h*a);var f=this.backBufferTile.imageOffset;f&&(f=new OpenLayers.Pixel(f.x*a,f.y*a)),OpenLayers.Util.modifyDOMElement(this.backBufferTile.imgDiv,null,f,e),this.backBufferTile.show()}}else this.layer.singleTile?this.backBufferTile.show():this.backBufferTile.hide();this.lastRatio=a}},show:function(){this.frame.style.display="",OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1&&OpenLayers.IS_GECKO===!0&&(this.frame.scrollLeft=this.frame.scrollLeft)},hide:function(){this.frame.style.display="none"},CLASS_NAME:"OpenLayers.Tile.Image"}),OpenLayers.Tile.Image.useBlankTile=OpenLayers.BROWSER_NAME=="safari"||OpenLayers.BROWSER_NAME=="opera",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.layer!=null&&this.marker!=null&&this.layer.removeMarker(this.marker),this.layer=null,this.id=null,this.lonlat=null,this.data=null,this.marker!=null&&(this.destroyMarker(this.marker),this.marker=null),this.popup!=null&&(this.destroyPopup(this.popup),this.popup=null)},onScreen:function(){var a=!1;if(this.layer!=null&&this.layer.map!=null){var b=this.layer.map.getExtent();a=b.containsLonLat(this.lonlat)}return a},createMarker:function(){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;this.popup||(this.popup=new this.popupClass(b,this.lonlat,this.data.popupSize,this.data.popupContentHTML,c,a)),this.data.overflow!=null&&(this.popup.contentDiv.style.overflow=this.data.overflow),this.popup.feature=this}return this.popup},destroyPopup:function(){this.popup&&(this.popup.feature=null,this.popup.destroy(),this.popup=null)},CLASS_NAME:"OpenLayers.Feature"}),OpenLayers.Handler.Click=OpenLayers.Class(OpenLayers.Handler,{delay:300,single:!0,"double":!1,pixelTolerance:0,stopSingle:!1,stopDouble:!1,timerId:null,down:null,rightclickTimerId:null,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments),this.pixelTolerance!=null&&(this.mousedown=function(a){this.down=a.xy;return!0})},mousedown:null,mouseup:function(a){var b=!0;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}var b=this["double"]?OpenLayers.Util.extend({},a):this.callback("rightclick",[a]),c=OpenLayers.Function.bind(this.delayedRightCall,this,b);this.rightclickTimerId=window.setTimeout(c,this.delay)}return!this.stopSingle},delayedRightCall:function(a){this.rightclickTimerId=null,a&&this.callback("rightclick",[a]);return!this.stopSingle},dblclick:function(a){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{var b=this.single?OpenLayers.Util.extend({},a):null;this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,b),this.delay)}return!this.stopSingle},passesTolerance:function(a){var b=!0;if(this.pixelTolerance!=null&&this.down){var c=Math.sqrt(Math.pow(this.down.x-a.xy.x,2)+Math.pow(this.down.y-a.xy.y,2));c>this.pixelTolerance&&(b=!1)}return b},clearTimer:function(){this.timerId!=null&&(window.clearTimeout(this.timerId),this.timerId=null),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=!1;OpenLayers.Handler.prototype.deactivate.apply(this,arguments)&&(this.clearTimer(),this.down=null,a=!0);return a},CLASS_NAME:"OpenLayers.Handler.Click"}),OpenLayers.Handler.Drag=OpenLayers.Class(OpenLayers.Handler,{started:!1,stopDown:!0,dragging:!1,last:null,start:null,oldOnselectstart:null,interval:0,timeoutId:null,documentDrag:!1,documentEvents:null,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments)},down:function(a){},move:function(a){},up:function(a){},out:function(a){},mousedown:function(a){var b=!0;this.dragging=!1,this.checkModifiers(a)&&OpenLayers.Event.isLeftClick(a)?(this.started=!0,this.start=a.xy,this.last=a.xy,OpenLayers.Element.addClass(this.map.viewPortDiv,"olDragDown"),this.down(a),this.callback("down",[a.xy]),OpenLayers.Event.stop(a),this.oldOnselectstart||(this.oldOnselectstart=document.onselectstart?document.onselectstart:OpenLayers.Function.True),document.onselectstart=OpenLayers.Function.False,b=!this.stopDown):(this.started=!1,this.start=null,this.last=null);return b},mousemove:function(a){this.started&&!this.timeoutId&&(a.xy.x!=this.last.x||a.xy.y!=this.last.y)&&(this.documentDrag===!0&&this.documentEvents&&(a.element===document?(this.adjustXY(a),this.setEvent(a)):this.destroyDocumentEvents()),this.interval>0&&(this.timeoutId=setTimeout(OpenLayers.Function.bind(this.removeTimeout,this),this.interval)),this.dragging=!0,this.move(a),this.callback("move",[a.xy]),this.oldOnselectstart||(this.oldOnselectstart=document.onselectstart,document.onselectstart=OpenLayers.Function.False),this.last=this.evt.xy);return!0},removeTimeout:function(){this.timeoutId=null},mouseup:function(a){if(this.started){this.documentDrag===!0&&this.documentEvents&&(this.adjustXY(a),this.destroyDocumentEvents());var b=this.start!=this.last;this.started=!1,this.dragging=!1,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!0},mouseout:function(a){if(this.started&&OpenLayers.Util.mouseLeft(a,this.map.div))if(this.documentDrag===!0)this.documentEvents=new OpenLayers.Events(this,document,null,null,{includeXY:!0}),this.documentEvents.on({mousemove:this.mousemove,mouseup:this.mouseup}),OpenLayers.Element.addClass(document.body,"olDragDown");else{var b=this.start!=this.last;this.started=!1,this.dragging=!1,OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown"),this.out(a),this.callback("out",[]),b&&this.callback("done",[a.xy]),document.onselectstart&&(document.onselectstart=this.oldOnselectstart)}return!0},click:function(a){return this.start==this.last},activate:function(){var a=!1;OpenLayers.Handler.prototype.activate.apply(this,arguments)&&(this.dragging=!1,a=!0);return a},deactivate:function(){var a=!1;OpenLayers.Handler.prototype.deactivate.apply(this,arguments)&&(this.started=!1,this.dragging=!1,this.start=null,this.last=null,a=!0,OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown"));return a},adjustXY:function(a){var b=OpenLayers.Util.pagePosition(this.map.viewPortDiv);a.xy.x-=b[0],a.xy.y-=b[1]},destroyDocumentEvents:function(){OpenLayers.Element.removeClass(document.body,"olDragDown"),this.documentEvents.destroy(),this.documentEvents=null},CLASS_NAME:"OpenLayers.Handler.Drag"}),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:!0,stopDown:!0,stopUp:!1,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:!0},mouseup:function(a){this.up=a.xy;return this.handle(a)?!this.stopUp:!0},click:function(a){return this.handle(a)?!this.stopClick:!0},mousemove:function(a){if(!this.callbacks.over&&!this.callbacks.out)return!0;this.handle(a);return!0},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){this.feature&&!this.feature.layer&&(this.feature=null);var b=a.type,c=!1,d=!!this.feature,e=b=="click"||b=="dblclick";this.feature=this.layer.getFeatureFromEvent(a),this.feature&&!this.feature.layer&&(this.feature=null),this.lastFeature&&!this.lastFeature.layer&&(this.lastFeature=null);if(this.feature){var f=this.feature!=this.lastFeature;this.geometryTypeMatches(this.feature)?(d&&f?(this.lastFeature&&this.triggerCallback(b,"out",[this.lastFeature]),this.triggerCallback(b,"in",[this.feature])):(!d||e)&&this.triggerCallback(b,"in",[this.feature]),this.lastFeature=this.feature,c=!0):(this.lastFeature&&(d&&f||e)&&this.triggerCallback(b,"out",[this.lastFeature]),this.feature=null)}else this.lastFeature&&(d||e)&&this.triggerCallback(b,"out",[this.lastFeature]);return c},triggerCallback:function(a,b,c){var d=this.EVENTMAP[a][b];if(d)if(a=="click"&&this.up&&this.down){var e=Math.sqrt(Math.pow(this.up.x-this.down.x,2)+Math.pow(this.up.y-this.down.y,2));e<=this.clickTolerance&&this.callback(d,c)}else this.callback(d,c)},activate:function(){var a=!1;OpenLayers.Handler.prototype.activate.apply(this,arguments)&&(this.moveLayerToTop(),this.map.events.on({removelayer:this.handleMapEvents,changelayer:this.handleMapEvents,scope:this}),a=!0);return a},deactivate:function(){var a=!1;OpenLayers.Handler.prototype.deactivate.apply(this,arguments)&&(this.moveLayerBack(),this.feature=null,this.lastFeature=null,this.down= +null,this.up=null,this.map.events.un({removelayer:this.handleMapEvents,changelayer:this.handleMapEvents,scope:this}),a=!0);return a},handleMapEvents:function(a){(!a.property||a.property=="order")&&this.moveLayerToTop()},moveLayerToTop:function(){var a=Math.max(this.map.Z_INDEX_BASE.Feature-1,this.layer.getZIndex())+1;this.layer.setZIndex(a)},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.Hover=OpenLayers.Class(OpenLayers.Handler,{delay:500,pixelTolerance:null,stopMove:!1,px:null,timerId:null,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments)},mousemove:function(a){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){OpenLayers.Util.mouseLeft(a,this.map.div)&&(this.clearTimer(),this.callback("move",[a]));return!0},passesTolerance:function(a){var b=!0;if(this.pixelTolerance&&this.px){var c=Math.sqrt(Math.pow(this.px.x-a.x,2)+Math.pow(this.px.y-a.y,2));c=0){this.initResolutions();break}}},onMapResize:function(){},redraw:function(){var a=!1;if(this.map){this.inRange=this.calculateInRange();var b=this.getExtent();if(b&&this.inRange&&this.visibility){var c=!0;this.moveTo(b,c,!1),this.events.triggerEvent("moveend",{zoomChanged:c}),a=!0}}return a},moveTo:function(a,b,c){var d=this.visibility;this.isBaseLayer||(d=d&&this.inRange),this.display(d)},setMap:function(a){if(this.map==null){this.map=a,this.maxExtent=this.maxExtent||this.map.maxExtent,this.minExtent=this.minExtent||this.map.minExtent,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();var b=this.visibility&&this.inRange;this.div.style.display=b?"":"none"}this.setTileSize()}},afterAdd:function(){},removeMap:function(a){},getImageSize:function(a){return this.imageSize||this.tileSize},setTileSize:function(a){var b=a?a:this.tileSize?this.tileSize:this.map.getTileSize();this.tileSize=b,this.gutter&&(this.imageOffset=new OpenLayers.Pixel(-this.gutter,-this.gutter),this.imageSize=new OpenLayers.Size(b.w+2*this.gutter,b.h+2*this.gutter))},getVisibility:function(){return this.visibility},setVisibility:function(a){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){a!=(this.div.style.display!="none")&&(this.div.style.display=a&&this.calculateInRange()?"block":"none")},calculateInRange:function(){var a=!1;if(this.alwaysInRange)a=!0;else if(this.map){var b=this.map.getResolution();a=b>=this.minResolution&&b<=this.maxResolution}return a},setIsBaseLayer:function(a){a!=this.isBaseLayer&&(this.isBaseLayer=a,this.map!=null&&this.map.events.triggerEvent("changebaselayer",{layer:this}))},initResolutions:function(){var a,b,c={},d=!0;for(a=0,b=this.RESOLUTION_PROPERTIES.length;a=a&&(f=h,d=i);if(h<=a){g=h,e=i;break}}var k=f-g;k>0?c=d+(f-a)/k:c=d}else{var l,m=Number.POSITIVE_INFINITY;for(var i=0,j=this.resolutions.length;im)break;m=l}else if(this.resolutions[i]4?this._object.open(a,d,g,j,k):arguments.length>3?this._object.open(a,d,g,j):this._object.open(a,d,g),!b&&!c&&(this.readyState=e.OPENED,f(this)),this._object.onreadystatechange=function(){if(!b||!!g){l.readyState=l._object.readyState,h(l);if(l._aborted){l.readyState=e.UNSENT;return}l.readyState==e.DONE&&(i(l),c&&g&&window.detachEvent("onunload",n)),m!=l.readyState&&f(l),m=l.readyState}}},e.prototype.send=function(a){e.onsend&&e.onsend.apply(this,arguments),a&&a.nodeType&&(a=window.XMLSerializer?(new window.XMLSerializer).serializeToString(a):a.xml,this._headers["Content-Type"]||this._object.setRequestHeader("Content-Type","application/xml")),this._object.send(a);if(b&&!this._async){this.readyState=e.OPENED,h(this);while(this.readyStatee.UNSENT&&(this._aborted=!0),this._object.abort(),i(this)},e.prototype.getAllResponseHeaders=function(){return this._object.getAllResponseHeaders()},e.prototype.getResponseHeader=function(a){return this._object.getResponseHeader(a)},e.prototype.setRequestHeader=function(a,b){this._headers||(this._headers={}),this._headers[a]=b;return this._object.setRequestHeader(a,b)},e.prototype.addEventListener=function(a,b,c){for(var d=0,e;e=this._listeners[d];d++)if(e[0]==a&&e[1]==b&&e[2]==c)return;this._listeners.push([a,b,c])},e.prototype.removeEventListener=function(a,b,c){for(var d=0,e;e=this._listeners[d];d++)if(e[0]==a&&e[1]==b&&e[2]==c)break;e&&this._listeners.splice(d,1)},e.prototype.dispatchEvent=function(a){var b={type:a.type,target:this,currentTarget:this,eventPhase:2,bubbles:a.bubbles,cancelable:a.cancelable,timeStamp:a.timeStamp,stopPropagation:function(){},preventDefault:function(){},initEvent:function(){}};b.type=="readystatechange"&&this.onreadystatechange&&(this.onreadystatechange.handleEvent||this.onreadystatechange).apply(this,[b]);for(var c=0,d;d=this._listeners[c];c++)d[0]==b.type&&!d[2]&&(d[1].handleEvent||d[1]).apply(this,[b])},e.prototype.toString=function(){return"[object XMLHttpRequest]"},e.toString=function(){return"[XMLHttpRequest]"},window.Function.prototype.apply||(window.Function.prototype.apply=function(a,b){b||(b=[]),a.__func=this,a.__func(b[0],b[1],b[2],b[3],b[4]),delete a.__func}),OpenLayers.Request.XMLHttpRequest=e}(),OpenLayers.Control.DragPan=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,panned:!1,interval:25,documentDrag:!1,draw:function(){this.handler=new OpenLayers.Handler.Drag(this,{move:this.panMap,done:this.panMapDone},{interval:this.interval,documentDrag:this.documentDrag})},panMap:function(a){this.panned=!0,this.map.pan(this.handler.last.x-a.x,this.handler.last.y-a.y,{dragging:this.handler.dragging,animate:!1})},panMapDone:function(a){this.panned&&(this.panMap(a),this.panned=!1)},CLASS_NAME:"OpenLayers.Control.DragPan"}),OpenLayers.Control.KeyboardDefaults=OpenLayers.Class(OpenLayers.Control,{autoActivate:!0,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})},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:var b=this.map.getSize();this.map.pan(0,-0.75*b.h);break;case 34:var b=this.map.getSize();this.map.pan(0,.75*b.h);break;case 35:var b=this.map.getSize();this.map.pan(.75*b.w,0);break;case 36:var b=this.map.getSize();this.map.pan(-0.75*b.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()}},CLASS_NAME:"OpenLayers.Control.KeyboardDefaults"}),OpenLayers.State={UNKNOWN:"Unknown",INSERT:"Insert",UPDATE:"Update",DELETE:"Delete"},OpenLayers.Feature.Vector=OpenLayers.Class(OpenLayers.Feature,{fid:null,geometry:null,attributes:null,bounds:null,state:null,style:null,url:null,renderIntent:"default",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={},b&&(this.attributes=OpenLayers.Util.extend(this.attributes,b)),this.style=c?c:null},destroy:function(){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=!1;if(this.layer&&this.layer.map){var c=this.layer.map.getExtent();if(a){var d=this.geometry.getBounds();b=c.intersectsBounds(d)}else{var e=c.toGeometry();b=e.intersects(this.geometry)}}return b},getVisibility:function(){return!(this.style&&this.style.display=="none"||!this.layer||this.layer&&this.layer.styleMap&&this.layer.styleMap.createSymbolizer(this,this.renderIntent).display=="none"||this.layer&&!this.layer.getVisibility())},createMarker:function(){return null},destroyMarker:function(){},createPopup:function(){return null},atPoint:function(a,b,c){var d=!1;this.geometry&&(d=this.geometry.atPoint(a,b,c));return d},destroyPopup:function(){},move:function(a){if(!!this.layer&&!!this.geometry.move){var b;a.CLASS_NAME=="OpenLayers.LonLat"?b=this.layer.getViewPortPxFromLonLat(a):b=a;var c=this.layer.getViewPortPxFromLonLat(this.geometry.getBounds().getCenterLonLat()),d=this.layer.map.getResolution();this.geometry.move(d*(b.x-c.x),d*(c.y-b.y)),this.layer.drawFeature(this);return c}},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:}else if(a==OpenLayers.State.INSERT)switch(this.state){case OpenLayers.State.UNKNOWN:break;default:this.state=a}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}else a==OpenLayers.State.UNKNOWN&&(this.state=a)},CLASS_NAME:"OpenLayers.Feature.Vector"}),OpenLayers.Feature.Vector.style={"default":{fillColor:"#ee9900",fillOpacity:.4,hoverFillColor:"white",hoverFillOpacity:.8,strokeColor:"#ee9900",strokeOpacity:1,strokeWidth:1,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},select:{fillColor:"blue",fillOpacity:.4,hoverFillColor:"white",hoverFillOpacity:.8,strokeColor:"blue",strokeOpacity:1,strokeWidth:2,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"pointer"},temporary:{fillColor:"#66cccc",fillOpacity:.2,hoverFillColor:"white",hoverFillOpacity:.8,strokeColor:"#66cccc",strokeOpacity:1,strokeLinecap:"round",strokeWidth:2,strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},"delete":{display:"none"}},OpenLayers.Handler.Box=OpenLayers.Class(OpenLayers.Handler,{dragHandler:null,boxDivClassName:"olHandlerBoxZoomBox",boxCharacteristics:null,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments);var b={down:this.startBox,move:this.moveBox,out:this.removeBox,up:this.endBox};this.dragHandler=new OpenLayers.Handler.Drag(this,b,{keyMask:this.keyMask})},destroy:function(){this.dragHandler&&(this.dragHandler.destroy(),this.dragHandler=null),OpenLayers.Handler.prototype.destroy.apply(this,arguments)},setMap:function(a){OpenLayers.Handler.prototype.setMap.apply(this,arguments),this.dragHandler&&this.dragHandler.setMap(a)},startBox:function(a){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.xb&&(this.zoomBox.style.width=Math.max(1,d-f.xOffset)+"px"),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,d=Math.min(c.y,a.y),e=Math.max(c.y,a.y),f=Math.min(c.x,a.x),g=Math.max(c.x,a.x);b=new OpenLayers.Bounds(f,e,g,d)}else b=this.dragHandler.start.clone();this.removeBox(),this.callback("done",[b])},removeBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox),this.zoomBox=null,this.boxCharacteristics=null,OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDrawBox")},activate:function(){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragHandler.activate();return!0}return!1},deactivate:function(){if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.dragHandler.deactivate();return!0}return!1},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.BROWSER_NAME=="msie"?document.compatMode!="BackCompat":!0;this.boxCharacteristics={xOffset:a,yOffset:b,newBoxModel:c}}return this.boxCharacteristics},CLASS_NAME:"OpenLayers.Handler.Box"}),OpenLayers.Handler.RegularPolygon=OpenLayers.Class(OpenLayers.Handler.Drag,{sides:4,radius:null,snapAngle:null,snapToggle:"shiftKey",layerOptions:null,persist:!1,irregular:!1,angle:null,fixedRadius:!1,feature:null,layer:null,origin:null,initialize:function(a,b,c){c&&c.layerOptions&&c.layerOptions.styleMap||(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=!1;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){var b=OpenLayers.Util.extend({displayInLayerSwitcher:!1,calculateInRange:OpenLayers.Function.True},this.layerOptions);this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,b),this.map.addLayer(this.layer),a=!0}return a},deactivate:function(){var a=!1;OpenLayers.Handler.Drag.prototype.deactivate.apply(this,arguments)&&(this.dragging&&this.cancel(),this.layer.map!=null&&(this.layer.destroy(!1),this.feature&&this.feature.destroy()),this.layer=null,this.feature=null,a=!0);return a},down:function(a){this.fixedRadius=!!this.radius;var b=this.map.getLonLatFromPixel(a.xy);this.origin=new OpenLayers.Geometry.Point(b.lon,b.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:!0}),this.layer.drawFeature(this.feature,this.style)},move:function(a){var b=this.map.getLonLatFromPixel(a.xy),c=new OpenLayers.Geometry.Point(b.lon,b.lat);if(this.irregular){var d=Math.sqrt(2)*Math.abs(c.y-this.origin.y)/2;this.radius=Math.max(this.map.getResolution()/2,d)}else this.fixedRadius?this.origin=c:(this.calculateAngle(c,a),this.radius=Math.max(this.map.getResolution()/2,c.distanceTo(this.origin)));this.modifyGeometry();if(this.irregular){var e=c.x-this.origin.x,f=c.y-this.origin.y,g;f==0?g=e/(this.radius*Math.sqrt(2)):g=e/f,this.feature.geometry.resize(1,this.origin,g),this.feature.geometry.move(e/2,f/2)}this.layer.drawFeature(this.feature,this.style)},up:function(a){this.finalize(),this.start==this.last&&this.callback("done",[a.xy])},out:function(a){this.finalize()},createGeometry:function(){this.angle=Math.PI*(1/this.sides-.5),this.snapAngle&&(this.angle+=this.snapAngle*(Math.PI/180)),this.feature.geometry=OpenLayers.Geometry.Polygon.createRegularPolygon(this.origin,this.radius,this.sides,this.snapAngle)},modifyGeometry:function(){var a,b,c=this.feature.geometry.components[0];c.components.length!=this.sides+1&&(this.createGeometry(),c=this.feature.geometry.components[0]);for(var d=0;d0&&g.push(","),c=b[h].geometry,d=c.CLASS_NAME.split(".")[2].toLowerCase();if(!this.extract[d])return null;this.internalProjection&&this.externalProjection&&(c=c.clone(),c.transform(this.internalProjection,this.externalProjection)),e=this.extract[d].apply(this,[c]),g.push(d.toUpperCase()+"("+e+")")}f&&g.push(")");return g.join("")},extract:{point:function(a){return a.x+" "+a.y},multipoint:function(a){var b=[];for(var c=0,d=a.components.length;c=a.bottom-m*this.buffer||p=0&&h=0&&(i=this.grid[g][h]),i!=null&&!i.queued?(a.unshift(i),i.queued=!0,f=0,c=g,d=h):(e=(e+1)%4,f++)}for(var j=0,k=a.length;j-this.tileSize.w*(b-1))this.shiftColumn(!0);else if(d.x<-this.tileSize.w*b)this.shiftColumn(!1);else if(d.y>-this.tileSize.h*(b-1))this.shiftRow(!0);else if(d.y<-this.tileSize.h*b)this.shiftRow(!1);else break}},shiftRow:function(a){var b=a?0:this.grid.length-1,c=this.grid,d=c[b],e=this.map.getResolution(),f=a?-this.tileSize.h:this.tileSize.h,g=e*-f,h=a?c.pop():c.shift();for(var i=0,j=d.length;ia){var c=this.grid.pop();for(var d=0,e=c.length;db)for(var d=0,e=this.grid.length;d0){g=!0;for(var h=0,i=f.length;h0&&g==!1&&(b.display="none");return b},applySymbolizer:function(a,b,c){var d=c.geometry?this.getSymbolizerPrefix(c.geometry):OpenLayers.Style.SYMBOLIZER_PREFIXES[0],e=a.symbolizer[d]||a.symbolizer;if(this.defaultsPerSymbolizer===!0){var f=this.defaultStyle;OpenLayers.Util.applyDefaults(e,{pointRadius:f.pointRadius}),(e.stroke===!0||e.graphic===!0)&&OpenLayers.Util.applyDefaults(e,{strokeWidth:f.strokeWidth,strokeColor:f.strokeColor,strokeOpacity:f.strokeOpacity,strokeDashstyle:f.strokeDashstyle,strokeLinecap:f.strokeLinecap}),(e.fill===!0||e.graphic===!0)&&OpenLayers.Util.applyDefaults(e,{fillColor:f.fillColor,fillOpacity:f.fillOpacity}),e.graphic===!0&&OpenLayers.Util.applyDefaults(e,{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,e),c)},createLiterals:function(a,b){var c=OpenLayers.Util.extend({},b.attributes||b.data);OpenLayers.Util.extend(c,this.context);for(var d in this.propertyStyles)a[d]=OpenLayers.Style.createLiteral(a[d],c,b,d);return a},findPropertyStyles:function(){var a={},b=this.defaultStyle;this.addPropertyStyles(a,b);var c=this.rules,d,e;for(var f=0,g=c.length;f=0&&p<=1&&q>=0&&q<=1)if(!d)f=!0;else{var r=a.x1+p*i,s=a.y1+p*j;f=new OpenLayers.Geometry.Point(r,s)}}if(e){var t;if(f){if(d){var u=[a,b],v,r,s;outer:for(var w=0;w<2;++w){v=u[w];for(var x=1;x<3;++x){r=v["x"+x],s=v["y"+x],t=Math.sqrt(Math.pow(r-f.x,2)+Math.pow(s-f.y,2));if(t=1?(l=g,m=h):(l=e+k*i,m=f+k*j);return{distance:Math.sqrt(Math.pow(l-c,2)+Math.pow(m-d,2)),x:l,y:m}},OpenLayers.Layer.TMS=OpenLayers.Class(OpenLayers.Layer.Grid,{serviceVersion:"1.0.0",isBaseLayer:!0,tileOrigin:null,serverResolutions:null,zoomOffset:0,initialize:function(a,b,c){var d=[];d.push(a,b,{},c),OpenLayers.Layer.Grid.prototype.initialize.apply(this,d)},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments)},clone:function(a){a==null&&(a=new OpenLayers.Layer.TMS(this.name,this.url,this.getOptions())),a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a]);return a},getURL:function(a){a=this.adjustBounds(a);var b=this.map.getResolution(),c=Math.round((a.left-this.tileOrigin.lon)/(b*this.tileSize.w)),d=Math.round((a.bottom-this.tileOrigin.lat)/(b*this.tileSize.h)),e=this.serverResolutions!=null?OpenLayers.Util.indexOf(this.serverResolutions,b):this.map.getZoom()+this.zoomOffset,f=this.serviceVersion+"/"+this.layername+"/"+e+"/"+c+"/"+d+"."+this.type,g=this.url;g instanceof Array&&(g=this.selectUrl(f,g));return g+f},addTile:function(a,b){return new OpenLayers.Tile.Image(this,b,a,null,this.tileSize)},setMap:function(a){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments),this.tileOrigin||(this.tileOrigin=new OpenLayers.LonLat(this.map.maxExtent.left,this.map.maxExtent.bottom))},CLASS_NAME:"OpenLayers.Layer.TMS"}),OpenLayers.Layer.XYZ=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:!0,sphericalMercator:!1,zoomOffset:0,initialize:function(a,b,c){if(c&&c.sphericalMercator||this.sphericalMercator)c=OpenLayers.Util.extend({maxExtent:new OpenLayers.Bounds(-20037508.3392,-20037508.3392,20037508.3392,20037508.3392),maxResolution:156543.0339,numZoomLevels:19,units:"m",projection:"EPSG:900913"},c);b=b||this.url,a=a||this.name;var d=[a,b,{},c];OpenLayers.Layer.Grid.prototype.initialize.apply(this,d)},clone:function(a){a==null&&(a=new OpenLayers.Layer.XYZ(this.name,this.url,this.getOptions())),a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a]);return a},getURL:function(a){var b=this.map.getResolution(),c=Math.round((a.left-this.maxExtent.left)/(b*this.tileSize.w)),d=Math.round((this.maxExtent.top-a.top)/(b*this.tileSize.h)),e=this.map.getZoom()+this.zoomOffset,f=this.url,g=""+c+d+e;f instanceof Array&&(f=this.selectUrl(g,f));var h=OpenLayers.String.format(f,{x:c,y:d,z:e});return h},addTile:function(a,b){return new OpenLayers.Tile.Image(this,b,a,null,this.tileSize)},setMap:function(a){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments),this.tileOrigin||(this.tileOrigin=new OpenLayers.LonLat(this.maxExtent.left,this.maxExtent.bottom))},CLASS_NAME:"OpenLayers.Layer.XYZ"}),OpenLayers.Layer.OSM=OpenLayers.Class(OpenLayers.Layer.XYZ,{name:"OpenStreetMap",attribution:"Data CC-By-SA by OpenStreetMap",sphericalMercator:!0,url:"http://tile.openstreetmap.org/${z}/${x}/${y}.png",clone:function(a){a==null&&(a=new OpenLayers.Layer.OSM(this.name,this.url,this.getOptions())),a=OpenLayers.Layer.XYZ.prototype.clone.apply(this,[a]);return a},CLASS_NAME:"OpenLayers.Layer.OSM"}),OpenLayers.Rule=OpenLayers.Class({id:null,name:null,title:null,description:null,context:null,filter:null,elseFilter:!1,symbolizer:null,symbolizers:null,minScaleDenominator:null,maxScaleDenominator:null,initialize:function(a){this.symbolizer={},OpenLayers.Util.extend(this,a),this.symbolizers&&delete this.symbolizer,this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){for(var a in this.symbolizer)this.symbolizer[a]=null;this.symbolizer=null,delete this.symbolizers},evaluate:function(a){var b=this.getContext(a),c=!0;if(this.minScaleDenominator||this.maxScaleDenominator)var d=a.layer.map.getScale();this.minScaleDenominator&&(c=d>=OpenLayers.Style.createLiteral(this.minScaleDenominator,b)),c&&this.maxScaleDenominator&&(c=dthis.value;break;case OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO:b=c<=this.value;break;case OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO:b=c>=this.value;break;case OpenLayers.Filter.Comparison.BETWEEN:b=c>=this.lowerBoundary&&c<=this.upperBoundary;break;case OpenLayers.Filter.Comparison.LIKE:var e=new RegExp(this.value,"gi");b=e.test(c)}return b},value2regex:function(a,b,c){if(a=="."){var d="'.' is an unsupported wildCard character for OpenLayers.Filter.Comparison";OpenLayers.Console.error(d);return null}a=a?a:"*",b=b?b:".",c=c?c:"!",this.value=this.value.replace(new RegExp("\\"+c+"(.|$)","g"),"\\$1"),this.value=this.value.replace(new RegExp("\\"+b,"g"),"."),this.value=this.value.replace(new RegExp("\\"+a,"g"),".*"),this.value=this.value.replace(new RegExp("\\\\.\\*","g"),"\\"+a),this.value=this.value.replace(new RegExp("\\\\\\.","g"),"\\"+b);return this.value},regex2value:function(){var a=this.value;a=a.replace(/!/g,"!!"),a=a.replace(/(\\)?\\\./g,function(a,b){return b?a:"!."}),a=a.replace(/(\\)?\\\*/g,function(a,b){return b?a:"!*"}),a=a.replace(/\\\\/g,"\\"),a=a.replace(/\.\*/g,"*");return a},clone:function(){return OpenLayers.Util.extend(new OpenLayers.Filter.Comparison,this)},CLASS_NAME:"OpenLayers.Filter.Comparison"}),OpenLayers.Filter.Comparison.EQUAL_TO="==",OpenLayers.Filter.Comparison.NOT_EQUAL_TO="!=",OpenLayers.Filter.Comparison.LESS_THAN="<",OpenLayers.Filter.Comparison.GREATER_THAN=">",OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO="<=",OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO=">=",OpenLayers.Filter.Comparison.BETWEEN="..",OpenLayers.Filter.Comparison.LIKE="~",OpenLayers.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,OpenLayers.Geometry.prototype.destroy.apply(this,arguments)},clone:function(){var geometry=eval("new "+this.CLASS_NAME+"()");for(var i=0,len=this.components.length;i0){this.setBounds(this.components[0].getBounds());for(var a=1,b=this.components.length;a-1){if(b!=null&&b=0;--b)this.removeComponent(a[b])},removeComponent:function(a){OpenLayers.Util.removeItem(this.components,a),this.clearBounds()},getLength:function(){var a=0;for( +var b=0,c=this.components.length;b0?i:f,d.push(j)}b=c.length;if(e===0){for(var h=0;h=0;d--){d!=0&&a[d-1].geometry?this.renderer.locked=!0:this.renderer.locked=!1;var e=a[d];delete this.unrenderedFeatures[e.id],c&&this.events.triggerEvent("beforefeatureremoved",{feature:e}),this.features=OpenLayers.Util.removeItem(this.features,e),e.layer=null,e.geometry&&this.renderer.eraseFeatures(e),OpenLayers.Util.indexOf(this.selectedFeatures,e)!=-1&&OpenLayers.Util.removeItem(this.selectedFeatures,e),c&&this.events.triggerEvent("featureremoved",{feature:e})}c&&this.events.triggerEvent("featuresremoved",{features:a})}},removeAllFeatures:function(a){var b=!a||!a.silent,c=this.features;b&&this.events.triggerEvent("beforefeaturesremoved",{features:c});var d;for(var e=c.length-1;e>=0;e--)d=c[e],b&&this.events.triggerEvent("beforefeatureremoved",{feature:d}),d.layer=null,b&&this.events.triggerEvent("featureremoved",{feature:d});this.renderer.clear(),this.features=[],this.unrenderedFeatures={},this.selectedFeatures=[],b&&this.events.triggerEvent("featuresremoved",{features:c})},destroyFeatures:function(a,b){var c=a==undefined;c&&(a=this.features);if(a){this.removeFeatures(a,b);for(var d=a.length-1;d>=0;d--)a[d].destroy()}},drawFeature:function(a,b){if(!!this.drawn){if(typeof b!="object"){!b&&a.state===OpenLayers.State.DELETE&&(b="delete");var c=b||a.renderIntent;b=a.style||this.style,b||(b=this.styleMap.createSymbolizer(a,c))}this.renderer.drawFeature(a,b)?delete this.unrenderedFeatures[a.id]: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}var b=this.renderer.getFeatureIdFromEvent(a);return this.getFeatureById(b)},getFeatureBy:function(a,b){var c=null;for(var d=0,e=this.features.length;d0){a=new OpenLayers.Bounds;var c=null;for(var d=0,e=b.length;d=0;--f)d=c.selectedFeatures[f],(!a||a.except!=d)&&this.unselect(d)}},clickFeature:function(a){if(!this.hover){var b=OpenLayers.Util.indexOf(a.layer.selectedFeatures,a)>-1;b?this.toggleSelect()?this.unselect(a):this.multipleSelect()||this.unselectAll({except:a}):(this.multipleSelect()||this.unselectAll({except:a}),this.select(a))}},multipleSelect:function(){return this.multiple||this.handlers.feature.evt&&this.handlers.feature.evt[this.multipleKey]},toggleSelect:function(){return this.toggle||this.handlers.feature.evt&&this.handlers.feature.evt[this.toggleKey]},clickoutFeature:function(a){!this.hover&&this.clickout&&this.unselectAll()},overFeature:function(a){var b=a.layer;this.hover&&(this.highlightOnly?this.highlight(a):OpenLayers.Util.indexOf(b.selectedFeatures,a)==-1&&this.select(a))},outFeature:function(a){if(this.hover)if(this.highlightOnly){if(a._lastHighlighter==this.id)if(a._prevHighlighter&&a._prevHighlighter!=this.id){delete a._lastHighlighter;var b=this.map.getControl(a._prevHighlighter);b&&b.highlight(a)}else this.unhighlight(a)}else this.unselect(a)},highlight:function(a){var b=a.layer,c=this.events.triggerEvent("beforefeaturehighlighted",{feature:a});if(c!==!1){a._prevHighlighter=a._lastHighlighter,a._lastHighlighter=this.id;var d=this.selectStyle||this.renderIntent;b.drawFeature(a,d),this.events.triggerEvent("featurehighlighted",{feature:a})}},unhighlight:function(a){var b=a.layer;a._lastHighlighter=a._prevHighlighter,delete a._prevHighlighter,b.drawFeature(a,a.style||a.layer.style||"default"),this.events.triggerEvent("featureunhighlighted",{feature:a})},select:function(a){var b=this.onBeforeSelect.call(this.scope,a),c=a.layer;b!==!1&&(b=c.events.triggerEvent("beforefeatureselected",{feature:a}),b!==!1&&(c.selectedFeatures.push(a),this.highlight(a),this.handlers.feature.lastFeature||(this.handlers.feature.lastFeature=c.selectedFeatures[0]),c.events.triggerEvent("featureselected",{feature:a}),this.onSelect.call(this.scope,a)))},unselect:function(a){var b=a.layer;this.unhighlight(a),OpenLayers.Util.removeItem(b.selectedFeatures,a),b.events.triggerEvent("featureunselected",{feature:a}),this.onUnselect.call(this.scope,a)},selectBox:function(a){if(a instanceof OpenLayers.Bounds){var b=this.map.getLonLatFromPixel(new OpenLayers.Pixel(a.left,a.bottom)),c=this.map.getLonLatFromPixel(new OpenLayers.Pixel(a.right,a.top)),d=new OpenLayers.Bounds(b.lon,b.lat,c.lon,c.lat);this.multipleSelect()||this.unselectAll();var e=this.multiple;this.multiple=!0;var f=this.layers||[this.layer],g;for(var h=0;h-1)&&d.toGeometry().intersects(k.geometry)&&OpenLayers.Util.indexOf(g.selectedFeatures,k)==-1&&this.select(k)}}this.multiple=e}},setMap:function(a){this.handlers.feature.setMap(a),this.box&&this.handlers.box.setMap(a),OpenLayers.Control.prototype.setMap.apply(this,arguments)},setLayer:function(a){var b=this.active;this.unselectAll(),this.deactivate(),this.layers&&(this.layer.destroy(),this.layers=null),this.initLayer(a),this.handlers.feature.layer=this.layer,b&&this.activate()},CLASS_NAME:"OpenLayers.Control.SelectFeature"}),OpenLayers.Geometry.Curve=OpenLayers.Class(OpenLayers.Geometry.MultiPoint,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(a){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;b1){var e,f;for(var g=1,h=b.components.length;g2&&OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments)},intersects:function(a){var b=!1,c=a.CLASS_NAME;if(c=="OpenLayers.Geometry.LineString"||c=="OpenLayers.Geometry.LinearRing"||c=="OpenLayers.Geometry.Point"){var d=this.getSortedSegments(),e;c=="OpenLayers.Geometry.Point"?e=[{x1:a.x,y1:a.y,x2:a.x,y2:a.y}]:e=a.getSortedSegments();var f,g,h,i,j,k,l,m;outer:for(var n=0,o=d.length;nh)break;if(k.x2Math.max(i,j))continue;if(Math.max(l,m)0){var t=a.x10&&(n.unshift(s,1),Array.prototype.splice.apply(h,n),s+=n.length-2);if(d)for(var t=0,u=m.points.length;t0&&p.length>0&&(p.push(k.clone()),g.push(new OpenLayers.Geometry.LineString(p)))}else c=a.splitWith(this,b);h&&h.length>1?f=!0:h=[],g&&g.length>1?e=!0:g=[];if(f||e)d?c=[g,h]:c=h;return c},splitWith:function(a,b){return a.split(this,b)},getVertices:function(a){var b;a===!0?b=[this.components[0],this.components[this.components.length-1]]:a===!1?b=this.components.slice(1,this.components.length-1):b=this.components.slice();return b},distanceTo:function(a,b){var c=!b||b.edge!==!1,d=c&&b&&b.details,e,f={},g=Number.POSITIVE_INFINITY;if(a instanceof OpenLayers.Geometry.Point){var h=this.getSortedSegments(),i=a.x,j=a.y,k;for(var l=0,m=h.length;li&&(j>k.y1&&jk.y2))break}d?f={distance:f.distance,x0:f.x,y0:f.y,x1:i,y1:j}:f=f.distance}else if(a instanceof OpenLayers.Geometry.LineString){var n=this.getSortedSegments(),o=a.getSortedSegments(),p,q,r,s,t,u=o.length,v={point:!0};outer:for(var l=0,m=n.length;l4){this.components.pop(),OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);var b=this.components[0];OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[b])}},move:function(a,b){for(var c=0,d=this.components.length;c2){var a=0,b=0;for(var c=0;c2){var b=0;for(var c=0,d=this.components.length;c2){var f,g;for(var h=0;h=j&&d<=l||j>=l&&d<=j&&d>=l){p=-1;break}continue}n=b(f(e,j,k,l,m),c);if(n==d)if(k=k&&e<=m||k>m&&e<=k&&e>=m){p=-1;break}if(n<=d)continue;if(j!=l&&(nMath.max(j,l)))continue;(k=k&&em&&e=m)&&++p}var r=p==-1?1:!!(p&1);return r},intersects:function(a){var b=!1;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;c1?h=!0:j=[],k&&k.length>1?i=!0:k=[];if(h||i)d?c=[j,k]:c=k;return c},splitWith:function(a,b){var c=null,d=b&&b.mutual,e,f,g,h,i,j,k;if(a instanceof OpenLayers.Geometry.LineString){k=[],j=[a];for(var l=0,m=this.components.length;l1?h=!0:j=[],k&&k.length>1?i=!0:k=[];if(h||i)d?c=[j,k]:c=k;return c},CLASS_NAME:"OpenLayers.Geometry.MultiLineString"}),OpenLayers.Geometry.Polygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LinearRing"],initialize:function(a){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;b0){b+=Math.abs(this.components[0].getGeodesicArea(a));for(var c=1,d=this.components.length;c0){c=this.components[0].containsPoint(a);if(c!==1&&c&&b>1){var d;for(var e=1;e=this.maxDepth)return!1;var c=OpenLayers.Util.extend({},b);c.depth++;for(var d=0,e=a.length;d0){var k=j[0],l={features:[],feature:g};this.readNode(k,l),l.features.length>0&&c.push.apply(c,l.features)}}else c.push(g)}this.features=this.features.concat(c)},readers:{kml:{when:function(a,b){b.whens.push(OpenLayers.Date.parse(this.getChildValue(a)))},_trackPointAttribute:function(a,b){var c=a.nodeName.split(":").pop();b.attributes[c].push(this.getChildValue(a))}},gx:{Track:function(a,b){var c={whens:[],points:[],angles:[]};if(this.trackAttributes){var d;c.attributes={};for(var e=0,f=this.trackAttributes.length;e0;if(g&&c.whens.length!==c.angles.length)throw new Error("gx:Track with unequal number of when ("+c.whens.length+") and gx:angles ("+c.angles.length+") elements.");var h,i,j;for(var e=0,f=c.whens.length;e2&&(e.z=parseFloat(d[2])),b.points.push(e)},angles:function(a,b){var c=this.getChildValue(a),d=c.replace(this.regExes.trimSpace,"").split(/\s+/);b.angles.push(d)}}},parseFeature:function(a){var b=["MultiGeometry","Polygon","LineString","Point"],c,d,e,f;for(var g=0,h=b.length;g0){var f=this.parseGeometry[c.toLowerCase()];f?(e=f.apply(this,[d[0]]),this.internalProjection&&this.externalProjection&&e.transform(this.externalProjection,this.internalProjection)):OpenLayers.Console.error(OpenLayers.i18n("unsupportedGeometryType",{geomType:c}));break}}var i;this.extractAttributes&&(i=this.parseAttributes(a));var j=new OpenLayers.Feature.Vector(e,i),k=a.getAttribute("id")||a.getAttribute("name");k!=null&&(j.fid=k);return j},getStyle:function(a,b){var c=OpenLayers.Util.removeTail(a),d=OpenLayers.Util.extend({},b);d.depth++,d.styleBaseUrl=c;if(!this.styles[a]&&!OpenLayers.String.startsWith(a,"#")&&d.depth<=this.maxDepth&&!this.fetched[c]){var e=this.fetchLink(c);e&&this.parseData(e,d)}var f=OpenLayers.Util.extend({},this.styles[a]);return f},parseGeometry:{point:function(a){var b=this.getElementsByTagNameNS(a,this.internalns,"coordinates"),c=[];if(b.length>0){var d=b[0].firstChild.nodeValue;d=d.replace(this.regExes.removeSpace,""),c=d.split(",")}var e=null;if(c.length>1)c.length==2&&(c[2]=null),e=new OpenLayers.Geometry.Point(c[0],c[1],c[2]);else throw"Bad coordinate string: "+d;return e},linestring:function(a,b){var c=this.getElementsByTagNameNS(a,this.internalns,"coordinates"),d=null;if(c.length>0){var e=this.getChildValue(c[0]);e=e.replace(this.regExes.trimSpace,""),e=e.replace(this.regExes.trimComma,",");var f=e.split(this.regExes.splitSpace),g=f.length,h=Array(g),i,j;for(var k=0;k1)i.length==2&&(i[2]=null),h[k]=new OpenLayers.Geometry.Point(i[0],i[1],i[2]);else throw"Bad LineString point coordinates: "+f[k]}if(g)b?d=new OpenLayers.Geometry.LinearRing(h):d=new OpenLayers.Geometry.LineString(h);else throw"Bad LineString coordinates: "+e}return d},polygon:function(a){var b=this.getElementsByTagNameNS(a,this.internalns,"LinearRing"),c=b.length,d=Array(c);if(c>0){var e;for(var f=0,g=b.length;f=1&&e.length<=3){var f;switch(e.length){case 1:f=e[0];break;case 2:var j=e[0],k=e[1];f=j.nodeType==3||j.nodeType==4?j:k;break;case 3:default:f=e[1]}if(f.nodeType==3||f.nodeType==4){var l=d.prefix?d.nodeName.split(":")[1]:d.nodeName,m=OpenLayers.Util.getXmlNodeValue(f);m&&(m=m.replace(this.regExes.trimSpace,""),b[l]=m)}}}}return b},parseExtendedData:function(a){var b={},c,d,e,f,g=a.getElementsByTagName("Data");for(c=0,d=g.length;c0&&b(function(){P(u)},K),N=function(){j&&clearTimeout(j),f[q]=f[n]=f[p]=f[o]=null,w[r](f),g&&w[r](g)},window[E]=d,f=a(s)[0],f.id=l+y++,H&&(f[i]=H);function m(a){(f[n]||c)(),a=z,z=undefined,a?O(a[0]):P(k)}v.msie?(f.event=n,f.htmlFor=f.id,f[q]=function(){/loaded|complete/.test(f.readyState)&&m()}):(f[o]=f[p]=m,v.opera?(g=a(s)[0]).text="jQuery('#"+f.id+"')[0]."+o+"()":f[h]=h),f.src=I,e(f),g&&e(g)}},0);return m}function g(a){return/\?/.test(a)?"&":"?"}function f(a,b,c){return a&&a.apply(b.context||b,c)}function e(a){w.insertBefore(a,w.firstChild)}function d(a){z=[a]}function c(){}var h="async",i="charset",j="",k="error",l="_jqjsp",m="on",n=m+"click",o=m+k,p=m+"load",q=m+"readystatechange",r="removeChild",s="";}else{var s=document.createElement("script");s.src=host+jsfiles[i];var h=document.getElementsByTagName("head").length?document.getElementsByTagName("head")[0]:document.body;h.appendChild(s);}} +if(docWrite){document.write(allScriptTags.join(""));}}})();OpenLayers.VERSION_NUMBER="$Revision: 10862 $";OpenLayers.String={startsWith:function(str,sub){return(str.indexOf(sub)==0);},contains:function(str,sub){return(str.indexOf(sub)!=-1);},trim:function(str){return str.replace(/^\s\s*/,'').replace(/\s\s*$/,'');},camelize:function(str){var oStringList=str.split('-');var camelizedString=oStringList[0];for(var i=1,len=oStringList.length;i0){fig=parseFloat(num.toPrecision(sig));} +return fig;},format:function(num,dec,tsep,dsep){dec=(typeof dec!="undefined")?dec:0;tsep=(typeof tsep!="undefined")?tsep:OpenLayers.Number.thousandsSeparator;dsep=(typeof dsep!="undefined")?dsep:OpenLayers.Number.decimalSeparator;if(dec!=null){num=parseFloat(num.toFixed(dec));} +var parts=num.toString().split(".");if(parts.length==1&&dec==null){dec=0;} +var integer=parts[0];if(tsep){var thousands=/(-?[0-9]+)([0-9]{3})/;while(thousands.test(integer)){integer=integer.replace(thousands,"$1"+tsep+"$2");}} +var str;if(dec==0){str=integer;}else{var rem=parts.length>1?parts[1]:"0";if(dec!=null){rem=rem+new Array(dec-rem.length+1).join("0");} +str=integer+dsep+rem;} +return str;}};if(!Number.prototype.limitSigDigs){Number.prototype.limitSigDigs=function(sig){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{'newMethod':'OpenLayers.Number.limitSigDigs'}));return OpenLayers.Number.limitSigDigs(this,sig);};} +OpenLayers.Function={bind:function(func,object){var args=Array.prototype.slice.apply(arguments,[2]);return function(){var newArgs=args.concat(Array.prototype.slice.apply(arguments,[0]));return func.apply(object,newArgs);};},bindAsEventListener:function(func,object){return function(event){return func.call(object,event||window.event);};},False:function(){return false;},True:function(){return true;}};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(object){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{'newMethod':'OpenLayers.Function.bindAsEventListener'}));return OpenLayers.Function.bindAsEventListener(this,object);};} +OpenLayers.Array={filter:function(array,callback,caller){var selected=[];if(Array.prototype.filter){selected=array.filter(callback,caller);}else{var len=array.length;if(typeof callback!="function"){throw new TypeError();} +for(var i=0;i1){var newArgs=[C,P].concat(Array.prototype.slice.call(arguments).slice(1,len-1),F);OpenLayers.inherit.apply(null,newArgs);}else{C.prototype=F;} +return C;};OpenLayers.Class.isPrototype=function(){};OpenLayers.Class.create=function(){return function(){if(arguments&&arguments[0]!=OpenLayers.Class.isPrototype){this.initialize.apply(this,arguments);}};};OpenLayers.Class.inherit=function(P){var C=function(){P.call(this);};var newArgs=[C].concat(Array.prototype.slice.call(arguments));OpenLayers.inherit.apply(null,newArgs);return C.prototype;};OpenLayers.inherit=function(C,P){var F=function(){};F.prototype=P.prototype;C.prototype=new F;var i,l,o;for(i=2,l=arguments.length;i=0;i--){if(array[i]==item){array.splice(i,1);}} +return array;};OpenLayers.Util.clearArray=function(array){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{'newMethod':'array = []'}));array.length=0;};OpenLayers.Util.indexOf=function(array,obj){if(typeof array.indexOf=="function"){return array.indexOf(obj);}else{for(var i=0,len=array.length;i=0.0&&parseFloat(opacity)<1.0){element.style.filter='alpha(opacity='+(opacity*100)+')';element.style.opacity=opacity;}else if(parseFloat(opacity)==1.0){element.style.filter='';element.style.opacity='';}};OpenLayers.Util.createDiv=function(id,px,sz,imgURL,position,border,overflow,opacity){var dom=document.createElement('div');if(imgURL){dom.style.backgroundImage='url('+imgURL+')';} +if(!id){id=OpenLayers.Util.createUniqueID("OpenLayersDiv");} +if(!position){position="absolute";} +OpenLayers.Util.modifyDOMElement(dom,id,px,sz,position,border,overflow,opacity);return dom;};OpenLayers.Util.createImage=function(id,px,sz,imgURL,position,border,opacity,delayDisplay){var image=document.createElement("img");if(!id){id=OpenLayers.Util.createUniqueID("OpenLayersDiv");} +if(!position){position="relative";} +OpenLayers.Util.modifyDOMElement(image,id,px,sz,position,border,null,opacity);if(delayDisplay){image.style.display="none";OpenLayers.Event.observe(image,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,image));OpenLayers.Event.observe(image,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,image));} +image.style.alt=id;image.galleryImg="no";if(imgURL){image.src=imgURL;} +return image;};OpenLayers.Util.setOpacity=function(element,opacity){OpenLayers.Util.modifyDOMElement(element,null,null,null,null,null,null,opacity);};OpenLayers.Util.onImageLoad=function(){if(!this.viewRequestID||(this.map&&this.viewRequestID==this.map.viewRequestID)){this.style.display="";} +OpenLayers.Element.removeClass(this,"olImageLoadError");};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 urls=this.urls;if(urls&&urls instanceof Array&&urls.length>1){var src=this.src.toString();var current_url,k;for(k=0;current_url=urls[k];k++){if(src.indexOf(current_url)!=-1){break;}} +var guess=Math.floor(urls.length*Math.random());var new_url=urls[guess];k=0;while(new_url==current_url&&k++<4){guess=Math.floor(urls.length*Math.random());new_url=urls[guess];} +this.src=src.replace(current_url,new_url);}else{this.src=this.src;}}else{OpenLayers.Element.addClass(this,"olImageLoadError");} +this.style.display="";};OpenLayers.Util.alphaHackNeeded=null;OpenLayers.Util.alphaHack=function(){if(OpenLayers.Util.alphaHackNeeded==null){var arVersion=navigator.appVersion.split("MSIE");var version=parseFloat(arVersion[1]);var filter=false;try{filter=!!(document.body.filters);}catch(e){} +OpenLayers.Util.alphaHackNeeded=(filter&&(version>=5.5)&&(version<7));} +return OpenLayers.Util.alphaHackNeeded;};OpenLayers.Util.modifyAlphaImageDiv=function(div,id,px,sz,imgURL,position,border,sizing,opacity){OpenLayers.Util.modifyDOMElement(div,id,px,sz,position,null,null,opacity);var img=div.childNodes[0];if(imgURL){img.src=imgURL;} +OpenLayers.Util.modifyDOMElement(img,div.id+"_innerImage",null,sz,"relative",border);if(OpenLayers.Util.alphaHack()){if(div.style.display!="none"){div.style.display="inline-block";} +if(sizing==null){sizing="scale";} +div.style.filter="progid:DXImageTransform.Microsoft"+".AlphaImageLoader(src='"+img.src+"', "+"sizingMethod='"+sizing+"')";if(parseFloat(div.style.opacity)>=0.0&&parseFloat(div.style.opacity)<1.0){div.style.filter+=" alpha(opacity="+div.style.opacity*100+")";} +img.style.filter="alpha(opacity=0)";}};OpenLayers.Util.createAlphaImageDiv=function(id,px,sz,imgURL,position,border,sizing,opacity,delayDisplay){var div=OpenLayers.Util.createDiv();var img=OpenLayers.Util.createImage(null,null,null,null,null,null,null,false);div.appendChild(img);if(delayDisplay){img.style.display="none";OpenLayers.Event.observe(img,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,div));OpenLayers.Event.observe(img,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,div));} +OpenLayers.Util.modifyAlphaImageDiv(div,id,px,sz,imgURL,position,border,sizing,opacity);return div;};OpenLayers.Util.upperCaseObject=function(object){var uObject={};for(var key in object){uObject[key.toUpperCase()]=object[key];} +return uObject;};OpenLayers.Util.applyDefaults=function(to,from){to=to||{};var fromIsEvt=typeof window.Event=="function"&&from instanceof window.Event;for(var key in from){if(to[key]===undefined||(!fromIsEvt&&from.hasOwnProperty&&from.hasOwnProperty(key)&&!to.hasOwnProperty(key))){to[key]=from[key];}} +if(!fromIsEvt&&from&&from.hasOwnProperty&&from.hasOwnProperty('toString')&&!to.hasOwnProperty('toString')){to.toString=from.toString;} +return to;};OpenLayers.Util.getParameterString=function(params){var paramsArray=[];for(var key in params){var value=params[key];if((value!=null)&&(typeof value!='function')){var encodedValue;if(typeof value=='object'&&value.constructor==Array){var encodedItemArray=[];var item;for(var itemIndex=0,len=value.length;itemIndex0)) +{if(!index){index=0;} +if(result[index].childNodes.length>1){return result.childNodes[1].nodeValue;} +else if(result[index].childNodes.length==1){return result[index].firstChild.nodeValue;}}else{return"";}};OpenLayers.Util.getXmlNodeValue=function(node){var val=null;OpenLayers.Util.Try(function(){val=node.text;if(!val){val=node.textContent;} +if(!val){val=node.firstChild.nodeValue;}},function(){val=node.textContent;});return val;};OpenLayers.Util.mouseLeft=function(evt,div){var target=(evt.relatedTarget)?evt.relatedTarget:evt.toElement;while(target!=div&&target!=null){target=target.parentNode;} +return(target!=div);};OpenLayers.Util.DEFAULT_PRECISION=14;OpenLayers.Util.toFloat=function(number,precision){if(precision==null){precision=OpenLayers.Util.DEFAULT_PRECISION;} +var number;if(precision==0){number=parseFloat(number);}else{number=parseFloat(parseFloat(number).toPrecision(precision));} +return number;};OpenLayers.Util.rad=function(x){return x*Math.PI/180;};OpenLayers.Util.deg=function(x){return x*180/Math.PI;};OpenLayers.Util.VincentyConstants={a:6378137,b:6356752.3142,f:1/298.257223563};OpenLayers.Util.distVincenty=function(p1,p2){var ct=OpenLayers.Util.VincentyConstants;var a=ct.a,b=ct.b,f=ct.f;var L=OpenLayers.Util.rad(p2.lon-p1.lon);var U1=Math.atan((1-f)*Math.tan(OpenLayers.Util.rad(p1.lat)));var U2=Math.atan((1-f)*Math.tan(OpenLayers.Util.rad(p2.lat)));var sinU1=Math.sin(U1),cosU1=Math.cos(U1);var sinU2=Math.sin(U2),cosU2=Math.cos(U2);var lambda=L,lambdaP=2*Math.PI;var iterLimit=20;while(Math.abs(lambda-lambdaP)>1e-12&&--iterLimit>0){var sinLambda=Math.sin(lambda),cosLambda=Math.cos(lambda);var sinSigma=Math.sqrt((cosU2*sinLambda)*(cosU2*sinLambda)+ +(cosU1*sinU2-sinU1*cosU2*cosLambda)*(cosU1*sinU2-sinU1*cosU2*cosLambda));if(sinSigma==0){return 0;} +var cosSigma=sinU1*sinU2+cosU1*cosU2*cosLambda;var sigma=Math.atan2(sinSigma,cosSigma);var alpha=Math.asin(cosU1*cosU2*sinLambda/sinSigma);var cosSqAlpha=Math.cos(alpha)*Math.cos(alpha);var cos2SigmaM=cosSigma-2*sinU1*sinU2/cosSqAlpha;var C=f/16*cosSqAlpha*(4+f*(4-3*cosSqAlpha));lambdaP=lambda;lambda=L+(1-C)*f*Math.sin(alpha)*(sigma+C*sinSigma*(cos2SigmaM+C*cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)));} +if(iterLimit==0){return NaN;} +var uSq=cosSqAlpha*(a*a-b*b)/(b*b);var A=1+uSq/16384*(4096+uSq*(-768+uSq*(320-175*uSq)));var B=uSq/1024*(256+uSq*(-128+uSq*(74-47*uSq)));var deltaSigma=B*sinSigma*(cos2SigmaM+B/4*(cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)- +B/6*cos2SigmaM*(-3+4*sinSigma*sinSigma)*(-3+4*cos2SigmaM*cos2SigmaM)));var s=b*A*(sigma-deltaSigma);var d=s.toFixed(3)/1000;return d;};OpenLayers.Util.destinationVincenty=function(lonlat,brng,dist){var u=OpenLayers.Util;var ct=u.VincentyConstants;var a=ct.a,b=ct.b,f=ct.f;var lon1=lonlat.lon;var lat1=lonlat.lat;var s=dist;var alpha1=u.rad(brng);var sinAlpha1=Math.sin(alpha1);var cosAlpha1=Math.cos(alpha1);var tanU1=(1-f)*Math.tan(u.rad(lat1));var cosU1=1/Math.sqrt((1+tanU1*tanU1)),sinU1=tanU1*cosU1;var sigma1=Math.atan2(tanU1,cosAlpha1);var sinAlpha=cosU1*sinAlpha1;var cosSqAlpha=1-sinAlpha*sinAlpha;var uSq=cosSqAlpha*(a*a-b*b)/(b*b);var A=1+uSq/16384*(4096+uSq*(-768+uSq*(320-175*uSq)));var B=uSq/1024*(256+uSq*(-128+uSq*(74-47*uSq)));var sigma=s/(b*A),sigmaP=2*Math.PI;while(Math.abs(sigma-sigmaP)>1e-12){var cos2SigmaM=Math.cos(2*sigma1+sigma);var sinSigma=Math.sin(sigma);var cosSigma=Math.cos(sigma);var deltaSigma=B*sinSigma*(cos2SigmaM+B/4*(cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)- +B/6*cos2SigmaM*(-3+4*sinSigma*sinSigma)*(-3+4*cos2SigmaM*cos2SigmaM)));sigmaP=sigma;sigma=s/(b*A)+deltaSigma;} +var tmp=sinU1*sinSigma-cosU1*cosSigma*cosAlpha1;var lat2=Math.atan2(sinU1*cosSigma+cosU1*sinSigma*cosAlpha1,(1-f)*Math.sqrt(sinAlpha*sinAlpha+tmp*tmp));var lambda=Math.atan2(sinSigma*sinAlpha1,cosU1*cosSigma-sinU1*sinSigma*cosAlpha1);var C=f/16*cosSqAlpha*(4+f*(4-3*cosSqAlpha));var L=lambda-(1-C)*f*sinAlpha*(sigma+C*sinSigma*(cos2SigmaM+C*cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)));var revAz=Math.atan2(sinAlpha,-tmp);return new OpenLayers.LonLat(lon1+u.deg(L),u.deg(lat2));};OpenLayers.Util.getParameters=function(url){url=url||window.location.href;var paramsString="";if(OpenLayers.String.contains(url,'?')){var start=url.indexOf('?')+1;var end=OpenLayers.String.contains(url,"#")?url.indexOf('#'):url.length;paramsString=url.substring(start,end);} +var parameters={};var pairs=paramsString.split(/[&;]/);for(var i=0,len=pairs.length;i1.0)?(1.0/scale):scale;return normScale;};OpenLayers.Util.getResolutionFromScale=function(scale,units){var resolution;if(scale){if(units==null){units="degrees";} +var normScale=OpenLayers.Util.normalizeScale(scale);resolution=1/(normScale*OpenLayers.INCHES_PER_UNIT[units]*OpenLayers.DOTS_PER_INCH);} +return resolution;};OpenLayers.Util.getScaleFromResolution=function(resolution,units){if(units==null){units="degrees";} +var scale=resolution*OpenLayers.INCHES_PER_UNIT[units]*OpenLayers.DOTS_PER_INCH;return scale;};OpenLayers.Util.safeStopPropagation=function(evt){OpenLayers.Event.stop(evt,true);};OpenLayers.Util.pagePosition=function(forElement){var pos=[0,0];var viewportElement=OpenLayers.Util.getViewportElement();if(!forElement||forElement==window||forElement==viewportElement){return pos;} +var BUGGY_GECKO_BOX_OBJECT=OpenLayers.IS_GECKO&&document.getBoxObjectFor&&OpenLayers.Element.getStyle(forElement,'position')=='absolute'&&(forElement.style.top==''||forElement.style.left=='');var parent=null;var box;if(forElement.getBoundingClientRect){box=forElement.getBoundingClientRect();var scrollTop=viewportElement.scrollTop;var scrollLeft=viewportElement.scrollLeft;pos[0]=box.left+scrollLeft;pos[1]=box.top+scrollTop;}else if(document.getBoxObjectFor&&!BUGGY_GECKO_BOX_OBJECT){box=document.getBoxObjectFor(forElement);var vpBox=document.getBoxObjectFor(viewportElement);pos[0]=box.screenX-vpBox.screenX;pos[1]=box.screenY-vpBox.screenY;}else{pos[0]=forElement.offsetLeft;pos[1]=forElement.offsetTop;parent=forElement.offsetParent;if(parent!=forElement){while(parent){pos[0]+=parent.offsetLeft;pos[1]+=parent.offsetTop;parent=parent.offsetParent;}} +var browser=OpenLayers.BROWSER_NAME;if(browser=="opera"||(browser=="safari"&&OpenLayers.Element.getStyle(forElement,'position')=='absolute')){pos[1]-=document.body.offsetTop;} +parent=forElement.offsetParent;while(parent&&parent!=document.body){pos[0]-=parent.scrollLeft;if(browser!="opera"||parent.tagName!='TR'){pos[1]-=parent.scrollTop;} +parent=parent.offsetParent;}} +return pos;};OpenLayers.Util.getViewportElement=function(){var viewportElement=arguments.callee.viewportElement;if(viewportElement==undefined){viewportElement=(OpenLayers.BROWSER_NAME=="msie"&&document.compatMode!='CSS1Compat')?document.body:document.documentElement;arguments.callee.viewportElement=viewportElement;} +return viewportElement;};OpenLayers.Util.isEquivalentUrl=function(url1,url2,options){options=options||{};OpenLayers.Util.applyDefaults(options,{ignoreCase:true,ignorePort80:true,ignoreHash:true});var urlObj1=OpenLayers.Util.createUrlObject(url1,options);var urlObj2=OpenLayers.Util.createUrlObject(url2,options);for(var key in urlObj1){if(key!=="args"){if(urlObj1[key]!=urlObj2[key]){return false;}}} +for(var key in urlObj1.args){if(urlObj1.args[key]!=urlObj2.args[key]){return false;} +delete urlObj2.args[key];} +for(var key in urlObj2.args){return false;} +return true;};OpenLayers.Util.createUrlObject=function(url,options){options=options||{};if(!(/^\w+:\/\//).test(url)){var loc=window.location;var port=loc.port?":"+loc.port:"";var fullUrl=loc.protocol+"//"+loc.host.split(":").shift()+port;if(url.indexOf("/")===0){url=fullUrl+url;}else{var parts=loc.pathname.split("/");parts.pop();url=fullUrl+parts.join("/")+"/"+url;}} +if(options.ignoreCase){url=url.toLowerCase();} +var a=document.createElement('a');a.href=url;var urlObject={};urlObject.host=a.host.split(":").shift();urlObject.protocol=a.protocol;if(options.ignorePort80){urlObject.port=(a.port=="80"||a.port=="0")?"":a.port;}else{urlObject.port=(a.port==""||a.port=="0")?"80":a.port;} +urlObject.hash=(options.ignoreHash||a.hash==="#")?"":a.hash;var queryString=a.search;if(!queryString){var qMark=url.indexOf("?");queryString=(qMark!=-1)?url.substr(qMark):"";} +urlObject.args=OpenLayers.Util.getParameters(queryString);urlObject.pathname=(a.pathname.charAt(0)=="/")?a.pathname:"/"+a.pathname;return urlObject;};OpenLayers.Util.removeTail=function(url){var head=null;var qMark=url.indexOf("?");var hashMark=url.indexOf("#");if(qMark==-1){head=(hashMark!=-1)?url.substr(0,hashMark):url;}else{head=(hashMark!=-1)?url.substr(0,Math.min(qMark,hashMark)):url.substr(0,qMark);} +return head;};OpenLayers.IS_GECKO=(function(){return navigator.userAgent.toLowerCase().indexOf("gecko")!=-1;})();OpenLayers.BROWSER_NAME=(function(){var name="";var ua=navigator.userAgent.toLowerCase();if(ua.indexOf("opera")!=-1){name="opera";}else if(ua.indexOf("msie")!=-1){name="msie";}else if(ua.indexOf("safari")!=-1){name="safari";}else if(ua.indexOf("mozilla")!=-1){if(ua.indexOf("firefox")!=-1){name="firefox";}else{name="mozilla";}} +return name;})();OpenLayers.Util.getBrowserName=function(){return OpenLayers.BROWSER_NAME;};OpenLayers.Util.getRenderedDimensions=function(contentHTML,size,options){var w,h;var container=document.createElement("div");container.style.visibility="hidden";var containerElement=(options&&options.containerElement)?options.containerElement:document.body;if(size){if(size.w){w=size.w;container.style.width=w+"px";}else if(size.h){h=size.h;container.style.height=h+"px";}} +if(options&&options.displayClass){container.className=options.displayClass;} +var content=document.createElement("div");content.innerHTML=contentHTML;content.style.overflow="visible";if(content.childNodes){for(var i=0,l=content.childNodes.length;i=0){if(coordinateminutes<10){coordinateminutes="0"+coordinateminutes;} +str+=coordinateminutes+"'";if(dmsOption.indexOf('dms')>=0){if(coordinateseconds<10){coordinateseconds="0"+coordinateseconds;} +str+=coordinateseconds+'"';}} +if(axis=="lon"){str+=coordinate<0?OpenLayers.i18n("W"):OpenLayers.i18n("E");}else{str+=coordinate<0?OpenLayers.i18n("S"):OpenLayers.i18n("N");} +return str;};OpenLayers.Rico=new Object();OpenLayers.Rico.Corner={round:function(e,options){e=OpenLayers.Util.getElement(e);this._setOptions(options);var color=this.options.color;if(this.options.color=="fromElement"){color=this._background(e);} +var bgColor=this.options.bgColor;if(this.options.bgColor=="fromParent"){bgColor=this._background(e.offsetParent);} +this._roundCornersImpl(e,color,bgColor);},changeColor:function(theDiv,newColor){theDiv.style.backgroundColor=newColor;var spanElements=theDiv.parentNode.getElementsByTagName("span");for(var currIdx=0;currIdx"+el.innerHTML+"";},_roundTopCorners:function(el,color,bgColor){var corner=this._createCorner(bgColor);for(var i=0;i=0;i--){corner.appendChild(this._createCornerSlice(color,bgColor,i,"bottom"));} +el.style.paddingBottom=0;el.appendChild(corner);},_createCorner:function(bgColor){var corner=document.createElement("div");corner.style.backgroundColor=(this._isTransparent()?"transparent":bgColor);return corner;},_createCornerSlice:function(color,bgColor,n,position){var slice=document.createElement("span");var inStyle=slice.style;inStyle.backgroundColor=color;inStyle.display="block";inStyle.height="1px";inStyle.overflow="hidden";inStyle.fontSize="1px";var borderColor=this._borderColor(color,bgColor);if(this.options.border&&n==0){inStyle.borderTopStyle="solid";inStyle.borderTopWidth="1px";inStyle.borderLeftWidth="0px";inStyle.borderRightWidth="0px";inStyle.borderBottomWidth="0px";inStyle.height="0px";inStyle.borderColor=borderColor;} +else if(borderColor){inStyle.borderColor=borderColor;inStyle.borderStyle="solid";inStyle.borderWidth="0px 1px";} +if(!this.options.compact&&(n==(this.options.numSlices-1))){inStyle.height="2px";} +this._setMargin(slice,n,position);this._setBorder(slice,n,position);return slice;},_setOptions:function(options){this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:true,border:false,compact:false};OpenLayers.Util.extend(this.options,options||{});this.options.numSlices=this.options.compact?2:4;if(this._isTransparent()){this.options.blend=false;}},_whichSideTop:function(){if(this._hasString(this.options.corners,"all","top")){return"";} +if(this.options.corners.indexOf("tl")>=0&&this.options.corners.indexOf("tr")>=0){return"";} +if(this.options.corners.indexOf("tl")>=0){return"left";}else if(this.options.corners.indexOf("tr")>=0){return"right";} +return"";},_whichSideBottom:function(){if(this._hasString(this.options.corners,"all","bottom")){return"";} +if(this.options.corners.indexOf("bl")>=0&&this.options.corners.indexOf("br")>=0){return"";} +if(this.options.corners.indexOf("bl")>=0){return"left";}else if(this.options.corners.indexOf("br")>=0){return"right";} +return"";},_borderColor:function(color,bgColor){if(color=="transparent"){return bgColor;}else if(this.options.border){return this.options.border;}else if(this.options.blend){return this._blend(bgColor,color);}else{return"";}},_setMargin:function(el,n,corners){var marginSize=this._marginSize(n);var whichSide=corners=="top"?this._whichSideTop():this._whichSideBottom();if(whichSide=="left"){el.style.marginLeft=marginSize+"px";el.style.marginRight="0px";} +else if(whichSide=="right"){el.style.marginRight=marginSize+"px";el.style.marginLeft="0px";} +else{el.style.marginLeft=marginSize+"px";el.style.marginRight=marginSize+"px";}},_setBorder:function(el,n,corners){var borderSize=this._borderSize(n);var whichSide=corners=="top"?this._whichSideTop():this._whichSideBottom();if(whichSide=="left"){el.style.borderLeftWidth=borderSize+"px";el.style.borderRightWidth="0px";} +else if(whichSide=="right"){el.style.borderRightWidth=borderSize+"px";el.style.borderLeftWidth="0px";} +else{el.style.borderLeftWidth=borderSize+"px";el.style.borderRightWidth=borderSize+"px";} +if(this.options.border!=false){el.style.borderLeftWidth=borderSize+"px";el.style.borderRightWidth=borderSize+"px";}},_marginSize:function(n){if(this._isTransparent()){return 0;} +var marginSizes=[5,3,2,1];var blendedMarginSizes=[3,2,1,0];var compactMarginSizes=[2,1];var smBlendedMarginSizes=[1,0];if(this.options.compact&&this.options.blend){return smBlendedMarginSizes[n];}else if(this.options.compact){return compactMarginSizes[n];}else if(this.options.blend){return blendedMarginSizes[n];}else{return marginSizes[n];}},_borderSize:function(n){var transparentBorderSizes=[5,3,2,1];var blendedBorderSizes=[2,1,1,1];var compactBorderSizes=[1,0];var actualBorderSizes=[0,2,0,0];if(this.options.compact&&(this.options.blend||this._isTransparent())){return 1;}else if(this.options.compact){return compactBorderSizes[n];}else if(this.options.blend){return blendedBorderSizes[n];}else if(this.options.border){return actualBorderSizes[n];}else if(this._isTransparent()){return transparentBorderSizes[n];} +return 0;},_hasString:function(str){for(var i=1;i=0){return true;}return false;},_blend:function(c1,c2){var cc1=OpenLayers.Rico.Color.createFromHex(c1);cc1.blend(OpenLayers.Rico.Color.createFromHex(c2));return cc1;},_background:function(el){try{return OpenLayers.Rico.Color.createColorFromBackground(el).asHex();}catch(err){return"#ffffff";}},_isTransparent:function(){return this.options.color=="transparent";},_isTopRounded:function(){return this._hasString(this.options.corners,"all","top","tl","tr");},_isBottomRounded:function(){return this._hasString(this.options.corners,"all","bottom","bl","br");},_hasSingleTextChild:function(el){return el.childNodes.length==1&&el.childNodes[0].nodeType==3;}};OpenLayers.Element={visible:function(element){return OpenLayers.Util.getElement(element).style.display!='none';},toggle:function(){for(var i=0,len=arguments.length;i"+ +this.contentDiv.innerHTML+"";var containerElement=(this.map)?this.map.layerContainerDiv:document.body;var realSize=OpenLayers.Util.getRenderedDimensions(preparedHTML,null,{displayClass:this.displayClass,containerElement:containerElement});var safeSize=this.getSafeContentSize(realSize);var newSize=null;if(safeSize.equals(realSize)){newSize=realSize;}else{var fixedSize=new OpenLayers.Size();fixedSize.w=(safeSize.w(mapSize.w-this.map.paddingForPopups.right)){newTL.x=mapSize.w-this.map.paddingForPopups.right-this.size.w;} +if(origTL.y(mapSize.h-this.map.paddingForPopups.bottom)){newTL.y=mapSize.h-this.map.paddingForPopups.bottom-this.size.h;} +var dx=origTL.x-newTL.x;var dy=origTL.y-newTL.y;this.map.pan(dx,dy);},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(evt){this.mousedown=true;OpenLayers.Event.stop(evt,true);},onmousemove:function(evt){if(this.mousedown){OpenLayers.Event.stop(evt,true);}},onmouseup:function(evt){if(this.mousedown){this.mousedown=false;OpenLayers.Event.stop(evt,true);}},onclick:function(evt){OpenLayers.Event.stop(evt,true);},onmouseout:function(evt){this.mousedown=false;},ondblclick:function(evt){OpenLayers.Event.stop(evt,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.Renderer=OpenLayers.Class({container:null,root:null,extent:null,locked:false,size:null,resolution:null,map:null,initialize:function(containerID,options){this.container=OpenLayers.Util.getElement(containerID);},destroy:function(){this.container=null;this.extent=null;this.size=null;this.resolution=null;this.map=null;},supported:function(){return false;},setExtent:function(extent,resolutionChanged){this.extent=extent.clone();if(resolutionChanged){this.resolution=null;}},setSize:function(size){this.size=size.clone();this.resolution=null;},getResolution:function(){this.resolution=this.resolution||this.map.getResolution();return this.resolution;},drawFeature:function(feature,style){if(style==null){style=feature.style;} +if(feature.geometry){var bounds=feature.geometry.getBounds();if(bounds){if(!bounds.intersectsBounds(this.extent)){style={display:"none"};} +var rendered=this.drawGeometry(feature.geometry,style,feature.id);if(style.display!="none"&&style.label&&rendered!==false){var location=feature.geometry.getCentroid();if(style.labelXOffset||style.labelYOffset){xOffset=isNaN(style.labelXOffset)?0:style.labelXOffset;yOffset=isNaN(style.labelYOffset)?0:style.labelYOffset;var res=this.getResolution();location.move(xOffset*res,yOffset*res);} +this.drawText(feature.id,style,location);}else{this.removeText(feature.id);} +return rendered;}}},drawGeometry:function(geometry,style,featureId){},drawText:function(featureId,style,location){},removeText:function(featureId){},clear:function(){},getFeatureIdFromEvent:function(evt){},eraseFeatures:function(features){if(!(features instanceof Array)){features=[features];} +for(var i=0,len=features.length;ithis.right)){this.right=bounds.right;} +if((this.top==null)||(bounds.top>this.top)){this.top=bounds.top;}}}},containsLonLat:function(ll,inclusive){return this.contains(ll.lon,ll.lat,inclusive);},containsPixel:function(px,inclusive){return this.contains(px.x,px.y,inclusive);},contains:function(x,y,inclusive){if(inclusive==null){inclusive=true;} +if(x==null||y==null){return false;} +x=OpenLayers.Util.toFloat(x);y=OpenLayers.Util.toFloat(y);var contains=false;if(inclusive){contains=((x>=this.left)&&(x<=this.right)&&(y>=this.bottom)&&(y<=this.top));}else{contains=((x>this.left)&&(xthis.bottom)&&(y=this.bottom)&&(bounds.bottom<=this.top))||((this.bottom>=bounds.bottom)&&(this.bottom<=bounds.top)));var inTop=(((bounds.top>=this.bottom)&&(bounds.top<=this.top))||((this.top>bounds.bottom)&&(this.top=this.left)&&(bounds.left<=this.right))||((this.left>=bounds.left)&&(this.left<=bounds.right)));var inRight=(((bounds.right>=this.left)&&(bounds.right<=this.right))||((this.right>=bounds.left)&&(this.right<=bounds.right)));intersects=((inBottom||inTop)&&(inLeft||inRight));} +return intersects;},containsBounds:function(bounds,partial,inclusive){if(partial==null){partial=false;} +if(inclusive==null){inclusive=true;} +var bottomLeft=this.contains(bounds.left,bounds.bottom,inclusive);var bottomRight=this.contains(bounds.right,bounds.bottom,inclusive);var topLeft=this.contains(bounds.left,bounds.top,inclusive);var topRight=this.contains(bounds.right,bounds.top,inclusive);return(partial)?(bottomLeft||bottomRight||topLeft||topRight):(bottomLeft&&bottomRight&&topLeft&&topRight);},determineQuadrant:function(lonlat){var quadrant="";var center=this.getCenterLonLat();quadrant+=(lonlat.lat=maxExtent.right&&newBounds.right>maxExtent.right){newBounds=newBounds.add(-maxExtent.getWidth(),0);}} +return newBounds;},CLASS_NAME:"OpenLayers.Bounds"});OpenLayers.Bounds.fromString=function(str){var bounds=str.split(",");return OpenLayers.Bounds.fromArray(bounds);};OpenLayers.Bounds.fromArray=function(bbox){return new OpenLayers.Bounds(parseFloat(bbox[0]),parseFloat(bbox[1]),parseFloat(bbox[2]),parseFloat(bbox[3]));};OpenLayers.Bounds.fromSize=function(size){return new OpenLayers.Bounds(0,size.h,size.w,0);};OpenLayers.Bounds.oppositeQuadrant=function(quadrant){var opp="";opp+=(quadrant.charAt(0)=='t')?'b':'t';opp+=(quadrant.charAt(1)=='l')?'r':'l';return opp;};OpenLayers.LonLat=OpenLayers.Class({lon:0.0,lat:0.0,initialize:function(lon,lat){this.lon=OpenLayers.Util.toFloat(lon);this.lat=OpenLayers.Util.toFloat(lat);},toString:function(){return("lon="+this.lon+",lat="+this.lat);},toShortString:function(){return(this.lon+", "+this.lat);},clone:function(){return new OpenLayers.LonLat(this.lon,this.lat);},add:function(lon,lat){if((lon==null)||(lat==null)){var msg=OpenLayers.i18n("lonlatAddError");OpenLayers.Console.error(msg);return null;} +return new OpenLayers.LonLat(this.lon+OpenLayers.Util.toFloat(lon),this.lat+OpenLayers.Util.toFloat(lat));},equals:function(ll){var equals=false;if(ll!=null){equals=((this.lon==ll.lon&&this.lat==ll.lat)||(isNaN(this.lon)&&isNaN(this.lat)&&isNaN(ll.lon)&&isNaN(ll.lat)));} +return equals;},transform:function(source,dest){var point=OpenLayers.Projection.transform({'x':this.lon,'y':this.lat},source,dest);this.lon=point.x;this.lat=point.y;return this;},wrapDateLine:function(maxExtent){var newLonLat=this.clone();if(maxExtent){while(newLonLat.lonmaxExtent.right){newLonLat.lon-=maxExtent.getWidth();}} +return newLonLat;},CLASS_NAME:"OpenLayers.LonLat"});OpenLayers.LonLat.fromString=function(str){var pair=str.split(",");return new OpenLayers.LonLat(pair[0],pair[1]);};OpenLayers.Pixel=OpenLayers.Class({x:0.0,y:0.0,initialize:function(x,y){this.x=parseFloat(x);this.y=parseFloat(y);},toString:function(){return("x="+this.x+",y="+this.y);},clone:function(){return new OpenLayers.Pixel(this.x,this.y);},equals:function(px){var equals=false;if(px!=null){equals=((this.x==px.x&&this.y==px.y)||(isNaN(this.x)&&isNaN(this.y)&&isNaN(px.x)&&isNaN(px.y)));} +return equals;},add:function(x,y){if((x==null)||(y==null)){var msg=OpenLayers.i18n("pixelAddError");OpenLayers.Console.error(msg);return null;} +return new OpenLayers.Pixel(this.x+x,this.y+y);},offset:function(px){var newPx=this.clone();if(px){newPx=this.add(px.x,px.y);} +return newPx;},CLASS_NAME:"OpenLayers.Pixel"});OpenLayers.Control=OpenLayers.Class({id:null,map:null,div:null,type:null,allowSelection:false,displayClass:"",title:"",autoActivate:false,active:null,handler:null,eventListeners:null,events:null,EVENT_TYPES:["activate","deactivate"],initialize:function(options){this.displayClass=this.CLASS_NAME.replace("OpenLayers.","ol").replace(/\./g,"");OpenLayers.Util.extend(this,options);this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES);if(this.eventListeners instanceof Object){this.events.on(this.eventListeners);} +if(this.id==null){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");}},destroy:function(){if(this.events){if(this.eventListeners){this.events.un(this.eventListeners);} +this.events.destroy();this.events=null;} +this.eventListeners=null;if(this.handler){this.handler.destroy();this.handler=null;} +if(this.handlers){for(var key in this.handlers){if(this.handlers.hasOwnProperty(key)&&typeof this.handlers[key].destroy=="function"){this.handlers[key].destroy();}} +this.handlers=null;} +if(this.map){this.map.removeControl(this);this.map=null;}},setMap:function(map){this.map=map;if(this.handler){this.handler.setMap(map);}},draw:function(px){if(this.div==null){this.div=OpenLayers.Util.createDiv(this.id);this.div.className=this.displayClass;if(!this.allowSelection){this.div.className+=" olControlNoSelect";this.div.setAttribute("unselectable","on",0);this.div.onselectstart=OpenLayers.Function.False;} +if(this.title!=""){this.div.title=this.title;}} +if(px!=null){this.position=px.clone();} +this.moveTo(this.position);return this.div;},moveTo:function(px){if((px!=null)&&(this.div!=null)){this.div.style.left=px.x+"px";this.div.style.top=px.y+"px";}},activate:function(){if(this.active){return false;} +if(this.handler){this.handler.activate();} +this.active=true;if(this.map){OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active");} +this.events.triggerEvent("activate");return true;},deactivate:function(){if(this.active){if(this.handler){this.handler.deactivate();} +this.active=false;if(this.map){OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active");} +this.events.triggerEvent("deactivate");return true;} +return false;},CLASS_NAME:"OpenLayers.Control"});OpenLayers.Control.TYPE_BUTTON=1;OpenLayers.Control.TYPE_TOGGLE=2;OpenLayers.Control.TYPE_TOOL=3;OpenLayers.Lang={code:null,defaultCode:"en",getCode:function(){if(!OpenLayers.Lang.code){OpenLayers.Lang.setCode();} +return OpenLayers.Lang.code;},setCode:function(code){var lang;if(!code){code=(OpenLayers.BROWSER_NAME=="msie")?navigator.userLanguage:navigator.language;} +var parts=code.split('-');parts[0]=parts[0].toLowerCase();if(typeof OpenLayers.Lang[parts[0]]=="object"){lang=parts[0];} +if(parts[1]){var testLang=parts[0]+'-'+parts[1].toUpperCase();if(typeof OpenLayers.Lang[testLang]=="object"){lang=testLang;}} +if(!lang){OpenLayers.Console.warn('Failed to find OpenLayers.Lang.'+parts.join("-")+' dictionary, falling back to default language');lang=OpenLayers.Lang.defaultCode;} +OpenLayers.Lang.code=lang;},translate:function(key,context){var dictionary=OpenLayers.Lang[OpenLayers.Lang.getCode()];var message=dictionary[key];if(!message){message=key;} +if(context){message=OpenLayers.String.format(message,context);} +return message;}};OpenLayers.i18n=OpenLayers.Lang.translate;OpenLayers.Popup.Anchored=OpenLayers.Class(OpenLayers.Popup,{relativePosition:null,keepInMap:true,anchor:null,initialize:function(id,lonlat,contentSize,contentHTML,anchor,closeBox,closeBoxCallback){var newArguments=[id,lonlat,contentSize,contentHTML,closeBox,closeBoxCallback];OpenLayers.Popup.prototype.initialize.apply(this,newArguments);this.anchor=(anchor!=null)?anchor:{size:new OpenLayers.Size(0,0),offset:new OpenLayers.Pixel(0,0)};},destroy:function(){this.anchor=null;this.relativePosition=null;OpenLayers.Popup.prototype.destroy.apply(this,arguments);},show:function(){this.updatePosition();OpenLayers.Popup.prototype.show.apply(this,arguments);},moveTo:function(px){var oldRelativePosition=this.relativePosition;this.relativePosition=this.calculateRelativePosition(px);var newPx=this.calculateNewPx(px);var newArguments=new Array(newPx);OpenLayers.Popup.prototype.moveTo.apply(this,newArguments);if(this.relativePosition!=oldRelativePosition){this.updateRelativePosition();}},setSize:function(contentSize){OpenLayers.Popup.prototype.setSize.apply(this,arguments);if((this.lonlat)&&(this.map)){var px=this.map.getLayerPxFromLonLat(this.lonlat);this.moveTo(px);}},calculateRelativePosition:function(px){var lonlat=this.map.getLonLatFromLayerPx(px);var extent=this.map.getExtent();var quadrant=extent.determineQuadrant(lonlat);return OpenLayers.Bounds.oppositeQuadrant(quadrant);},updateRelativePosition:function(){},calculateNewPx:function(px){var newPx=px.offset(this.anchor.offset);var size=this.size||this.contentSize;var top=(this.relativePosition.charAt(0)=='t');newPx.y+=(top)?-(size.h+this.anchor.size.h):this.anchor.size.h;var left=(this.relativePosition.charAt(1)=='l');newPx.x+=(left)?-(size.w+this.anchor.size.w):this.anchor.size.w;return newPx;},CLASS_NAME:"OpenLayers.Popup.Anchored"});OpenLayers.Renderer.Canvas=OpenLayers.Class(OpenLayers.Renderer,{canvas:null,features:null,initialize:function(containerID){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={};},eraseGeometry:function(geometry,featureId){this.eraseFeatures(this.features[featureId][0]);},supported:function(){var canvas=document.createElement("canvas");return!!canvas.getContext;},setSize:function(size){this.size=size.clone();this.root.style.width=size.w+"px";this.root.style.height=size.h+"px";this.root.width=size.w;this.root.height=size.h;this.resolution=null;},drawFeature:function(feature,style){style=style||feature.style;style=this.applyDefaultSymbolizer(style);this.features[feature.id]=[feature,style];this.redraw();},drawGeometry:function(geometry,style){var className=geometry.CLASS_NAME;if((className=="OpenLayers.Geometry.Collection")||(className=="OpenLayers.Geometry.MultiPoint")||(className=="OpenLayers.Geometry.MultiLineString")||(className=="OpenLayers.Geometry.MultiPolygon")){for(var i=0;i1){middle=parseInt((leftIndex+rightIndex)/2);var placement=this.compare(this,newNode,OpenLayers.Util.getElement(this.order[middle]));if(placement>0){leftIndex=middle;}else{rightIndex=middle;}} +this.order.splice(rightIndex,0,nodeId);this.indices[nodeId]=this.getZIndex(newNode);return this.getNextElement(rightIndex);},remove:function(node){var nodeId=node.id;var arrayIndex=OpenLayers.Util.indexOf(this.order,nodeId);if(arrayIndex>=0){this.order.splice(arrayIndex,1);delete this.indices[nodeId];if(this.order.length>0){var lastId=this.order[this.order.length-1];this.maxZIndex=this.indices[lastId];}else{this.maxZIndex=0;}}},clear:function(){this.order=[];this.indices={};this.maxZIndex=0;},exists:function(node){return(this.indices[node.id]!=null);},getZIndex:function(node){return node._style.graphicZIndex;},determineZIndex:function(node){var zIndex=node._style.graphicZIndex;if(zIndex==null){zIndex=this.maxZIndex;node._style.graphicZIndex=zIndex;}else if(zIndex>this.maxZIndex){this.maxZIndex=zIndex;}},getNextElement:function(index){var nextIndex=index+1;if(nextIndexthis.duration){this.stop();}},CLASS_NAME:"OpenLayers.Tween"});OpenLayers.Easing={CLASS_NAME:"OpenLayers.Easing"};OpenLayers.Easing.Linear={easeIn:function(t,b,c,d){return c*t/d+b;},easeOut:function(t,b,c,d){return c*t/d+b;},easeInOut:function(t,b,c,d){return c*t/d+b;},CLASS_NAME:"OpenLayers.Easing.Linear"};OpenLayers.Easing.Expo={easeIn:function(t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b;},easeOut:function(t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b;},easeInOut:function(t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b;},CLASS_NAME:"OpenLayers.Easing.Expo"};OpenLayers.Easing.Quad={easeIn:function(t,b,c,d){return c*(t/=d)*t+b;},easeOut:function(t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeInOut:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;},CLASS_NAME:"OpenLayers.Easing.Quad"};OpenLayers.Control.ArgParser=OpenLayers.Class(OpenLayers.Control,{center:null,zoom:null,layers:null,displayProjection:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,arguments);},setMap:function(map){OpenLayers.Control.prototype.setMap.apply(this,arguments);for(var i=0,len=this.map.controls.length;i=0;--i){this._removeButton(this.buttons[i]);}},doubleClick:function(evt){OpenLayers.Event.stop(evt);return false;},buttonDown:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;} +switch(this.action){case"panup":this.map.pan(0,-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(evt);},CLASS_NAME:"OpenLayers.Control.PanZoom"});OpenLayers.Control.PanZoom.X=4;OpenLayers.Control.PanZoom.Y=4;OpenLayers.Control.Panel=OpenLayers.Class(OpenLayers.Control,{controls:null,autoActivate:true,defaultControl:null,saveState:false,activeState:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.controls=[];this.activeState={};},destroy:function(){OpenLayers.Control.prototype.destroy.apply(this,arguments);for(var i=this.controls.length-1;i>=0;i--){if(this.controls[i].events){this.controls[i].events.un({"activate":this.redraw,"deactivate":this.redraw,scope:this});} +OpenLayers.Event.stopObservingElement(this.controls[i].panel_div);this.controls[i].panel_div=null;} +this.activeState=null;},activate:function(){if(OpenLayers.Control.prototype.activate.apply(this,arguments)){var control;for(var i=0,len=this.controls.length;i=0;i--){this.div.removeChild(this.div.childNodes[i]);} +this.div.innerHTML="";if(this.active){for(var i=0,len=this.controls.length;i5){barLen=5;}else if(firstChar>2){barLen=2;}else{barLen=1;} +return barLen*pow10;},update:function(){var res=this.map.getResolution();if(!res){return;} +var curMapUnits=this.map.getUnits();var inches=OpenLayers.INCHES_PER_UNIT;var maxSizeData=this.maxWidth*res*inches[curMapUnits];var geodesicRatio=1;if(this.geodesic===true){var maxSizeGeodesic=(this.map.getGeodesicPixelSize().w||0.000001)*this.maxWidth;var maxSizeKilometers=maxSizeData/inches["km"];geodesicRatio=maxSizeGeodesic/maxSizeKilometers;maxSizeData*=geodesicRatio;} +var topUnits;var bottomUnits;if(maxSizeData>100000){topUnits=this.topOutUnits;bottomUnits=this.bottomOutUnits;}else{topUnits=this.topInUnits;bottomUnits=this.bottomInUnits;} +var topMax=maxSizeData/inches[topUnits];var bottomMax=maxSizeData/inches[bottomUnits];var topRounded=this.getBarLen(topMax);var bottomRounded=this.getBarLen(bottomMax);topMax=topRounded/inches[curMapUnits]*inches[topUnits];bottomMax=bottomRounded/inches[curMapUnits]*inches[bottomUnits];var topPx=topMax/res/geodesicRatio;var bottomPx=bottomMax/res/geodesicRatio;if(this.eBottom.style.visibility=="visible"){this.eBottom.style.width=Math.round(bottomPx)+"px";this.eBottom.innerHTML=bottomRounded+" "+bottomUnits;} +if(this.eTop.style.visibility=="visible"){this.eTop.style.width=Math.round(topPx)+"px";this.eTop.innerHTML=topRounded+" "+topUnits;}},CLASS_NAME:"OpenLayers.Control.ScaleLine"});OpenLayers.Control.ZoomIn=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){this.map.zoomIn();},CLASS_NAME:"OpenLayers.Control.ZoomIn"});OpenLayers.Control.ZoomOut=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){this.map.zoomOut();},CLASS_NAME:"OpenLayers.Control.ZoomOut"});OpenLayers.Control.ZoomToMaxExtent=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){if(this.map){this.map.zoomToMaxExtent();}},CLASS_NAME:"OpenLayers.Control.ZoomToMaxExtent"});OpenLayers.Event={observers:false,KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(event){return event.target||event.srcElement;},isLeftClick:function(event){return(((event.which)&&(event.which==1))||((event.button)&&(event.button==1)));},isRightClick:function(event){return(((event.which)&&(event.which==3))||((event.button)&&(event.button==2)));},stop:function(event,allowDefault){if(!allowDefault){if(event.preventDefault){event.preventDefault();}else{event.returnValue=false;}} +if(event.stopPropagation){event.stopPropagation();}else{event.cancelBubble=true;}},findElement:function(event,tagName){var element=OpenLayers.Event.element(event);while(element.parentNode&&(!element.tagName||(element.tagName.toUpperCase()!=tagName.toUpperCase()))){element=element.parentNode;} +return element;},observe:function(elementParam,name,observer,useCapture){var element=OpenLayers.Util.getElement(elementParam);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.attachEvent)){name='keydown';} +if(!this.observers){this.observers={};} +if(!element._eventCacheID){var idPrefix="eventCacheID_";if(element.id){idPrefix=element.id+"_"+idPrefix;} +element._eventCacheID=OpenLayers.Util.createUniqueID(idPrefix);} +var cacheID=element._eventCacheID;if(!this.observers[cacheID]){this.observers[cacheID]=[];} +this.observers[cacheID].push({'element':element,'name':name,'observer':observer,'useCapture':useCapture});if(element.addEventListener){element.addEventListener(name,observer,useCapture);}else if(element.attachEvent){element.attachEvent('on'+name,observer);}},stopObservingElement:function(elementParam){var element=OpenLayers.Util.getElement(elementParam);var cacheID=element._eventCacheID;this._removeElementObservers(OpenLayers.Event.observers[cacheID]);},_removeElementObservers:function(elementObservers){if(elementObservers){for(var i=elementObservers.length-1;i>=0;i--){var entry=elementObservers[i];var args=new Array(entry.element,entry.name,entry.observer,entry.useCapture);var removed=OpenLayers.Event.stopObserving.apply(this,args);}}},stopObserving:function(elementParam,name,observer,useCapture){useCapture=useCapture||false;var element=OpenLayers.Util.getElement(elementParam);var cacheID=element._eventCacheID;if(name=='keypress'){if(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.detachEvent){name='keydown';}} +var foundEntry=false;var elementObservers=OpenLayers.Event.observers[cacheID];if(elementObservers){var i=0;while(!foundEntry&&i
"+"To get rid of this message, select a new BaseLayer "+"in the layer switcher in the upper-right corner.

"+"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.

"+"Developers: For help getting this working correctly, "+"click here",'getLayerWarning':"The ${layerType} Layer was unable to load correctly.

"+"To get rid of this message, select a new BaseLayer "+"in the layer switcher in the upper-right corner.

"+"Most likely, this is because the ${layerLib} library "+"script was not correctly included.

"+"Developers: For help getting this working correctly, "+"click here",'scale':"Scale = 1 : ${scaleDenom}",'W':'W','E':'E','N':'N','S':'S','graticule':'Graticule','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.",'filterEvaluateNotImplemented':"evaluate is not implemented for this filter type.",'end':''};OpenLayers.Popup.AnchoredBubble=OpenLayers.Class(OpenLayers.Popup.Anchored,{rounded:false,initialize:function(id,lonlat,contentSize,contentHTML,anchor,closeBox,closeBoxCallback){this.padding=new OpenLayers.Bounds(0,OpenLayers.Popup.AnchoredBubble.CORNER_SIZE,0,OpenLayers.Popup.AnchoredBubble.CORNER_SIZE);OpenLayers.Popup.Anchored.prototype.initialize.apply(this,arguments);},draw:function(px){OpenLayers.Popup.Anchored.prototype.draw.apply(this,arguments);this.setContentHTML();this.setBackgroundColor();this.setOpacity();return this.div;},updateRelativePosition:function(){this.setRicoCorners();},setSize:function(contentSize){OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments);this.setRicoCorners();},setBackgroundColor:function(color){if(color!=undefined){this.backgroundColor=color;} +if(this.div!=null){if(this.contentDiv!=null){this.div.style.background="transparent";OpenLayers.Rico.Corner.changeColor(this.groupDiv,this.backgroundColor);}}},setOpacity:function(opacity){OpenLayers.Popup.Anchored.prototype.setOpacity.call(this,opacity);if(this.div!=null){if(this.groupDiv!=null){OpenLayers.Rico.Corner.changeOpacity(this.groupDiv,this.opacity);}}},setBorder:function(border){this.border=0;},setRicoCorners:function(){var corners=this.getCornersToRound(this.relativePosition);var options={corners:corners,color:this.backgroundColor,bgColor:"transparent",blend:false};if(!this.rounded){OpenLayers.Rico.Corner.round(this.div,options);this.rounded=true;}else{OpenLayers.Rico.Corner.reRound(this.groupDiv,options);this.setBackgroundColor();this.setOpacity();}},getCornersToRound:function(){var corners=['tl','tr','bl','br'];var corner=OpenLayers.Bounds.oppositeQuadrant(this.relativePosition);OpenLayers.Util.removeItem(corners,corner);return corners.join(" ");},CLASS_NAME:"OpenLayers.Popup.AnchoredBubble"});OpenLayers.Popup.AnchoredBubble.CORNER_SIZE=5;OpenLayers.Projection=OpenLayers.Class({proj:null,projCode:null,titleRegEx:/\+title=[^\+]*/,initialize:function(projCode,options){OpenLayers.Util.extend(this,options);this.projCode=projCode;if(window.Proj4js){this.proj=new Proj4js.Proj(projCode);}},getCode:function(){return this.proj?this.proj.srsCode:this.projCode;},getUnits:function(){return this.proj?this.proj.units:null;},toString:function(){return this.getCode();},equals:function(projection){var p=projection,equals=false;if(p){if(window.Proj4js&&this.proj.defData&&p.proj.defData){equals=this.proj.defData.replace(this.titleRegEx,"")==p.proj.defData.replace(this.titleRegEx,"");}else if(p.getCode){var source=this.getCode(),target=p.getCode();equals=source==target||!!OpenLayers.Projection.transforms[source]&&OpenLayers.Projection.transforms[source][target]===OpenLayers.Projection.nullTransform;}} +return equals;},destroy:function(){delete this.proj;delete this.projCode;},CLASS_NAME:"OpenLayers.Projection"});OpenLayers.Projection.transforms={};OpenLayers.Projection.addTransform=function(from,to,method){if(!OpenLayers.Projection.transforms[from]){OpenLayers.Projection.transforms[from]={};} +OpenLayers.Projection.transforms[from][to]=method;};OpenLayers.Projection.transform=function(point,source,dest){if(source.proj&&dest.proj){point=Proj4js.transform(source.proj,dest.proj,point);}else if(source&&dest&&OpenLayers.Projection.transforms[source.getCode()]&&OpenLayers.Projection.transforms[source.getCode()][dest.getCode()]){OpenLayers.Projection.transforms[source.getCode()][dest.getCode()](point);} +return point;};OpenLayers.Projection.nullTransform=function(point){return point;};OpenLayers.Renderer.SVG=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"http://www.w3.org/2000/svg",xlinkns:"http://www.w3.org/1999/xlink",MAX_PIXEL:15000,translationParameters:null,symbolMetrics:null,supportUse:null,initialize:function(containerID){if(!this.supported()){return;} +OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments);this.translationParameters={x:0,y:0};this.supportUse=(navigator.userAgent.toLowerCase().indexOf("applewebkit/5")==-1);this.symbolMetrics={};},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments);},supported:function(){var svgFeature="http://www.w3.org/TR/SVG11/feature#";return(document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature(svgFeature+"SVG","1.1")||document.implementation.hasFeature(svgFeature+"BasicStructure","1.1")));},inValidRange:function(x,y,xyOnly){var left=x+(xyOnly?0:this.translationParameters.x);var top=y+(xyOnly?0:this.translationParameters.y);return(left>=-this.MAX_PIXEL&&left<=this.MAX_PIXEL&&top>=-this.MAX_PIXEL&&top<=this.MAX_PIXEL);},setExtent:function(extent,resolutionChanged){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var resolution=this.getResolution();var left=-extent.left/resolution;var top=extent.top/resolution;if(resolutionChanged){this.left=left;this.top=top;var extentString="0 0 "+this.size.w+" "+this.size.h;this.rendererRoot.setAttributeNS(null,"viewBox",extentString);this.translate(0,0);return true;}else{var inRange=this.translate(left-this.left,top-this.top);if(!inRange){this.setExtent(extent,true);} +return inRange;}},translate:function(x,y){if(!this.inValidRange(x,y,true)){return false;}else{var transformString="";if(x||y){transformString="translate("+x+","+y+")";} +this.root.setAttributeNS(null,"transform",transformString);this.translationParameters={x:x,y:y};return true;}},setSize:function(size){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);this.rendererRoot.setAttributeNS(null,"width",this.size.w);this.rendererRoot.setAttributeNS(null,"height",this.size.h);},getNodeType:function(geometry,style){var nodeType=null;switch(geometry.CLASS_NAME){case"OpenLayers.Geometry.Point":if(style.externalGraphic){nodeType="image";}else if(this.isComplexSymbol(style.graphicName)){nodeType=this.supportUse===false?"svg":"use";}else{nodeType="circle";} +break;case"OpenLayers.Geometry.Rectangle":nodeType="rect";break;case"OpenLayers.Geometry.LineString":nodeType="polyline";break;case"OpenLayers.Geometry.LinearRing":nodeType="polygon";break;case"OpenLayers.Geometry.Polygon":case"OpenLayers.Geometry.Curve":case"OpenLayers.Geometry.Surface":nodeType="path";break;default:break;} +return nodeType;},setStyle:function(node,style,options){style=style||node._style;options=options||node._options;var r=parseFloat(node.getAttributeNS(null,"r"));var widthFactor=1;var pos;if(node._geometryClass=="OpenLayers.Geometry.Point"&&r){node.style.visibility="";if(style.graphic===false){node.style.visibility="hidden";}else if(style.externalGraphic){pos=this.getPosition(node);if(style.graphicTitle){node.setAttributeNS(null,"title",style.graphicTitle);} +if(style.graphicWidth&&style.graphicHeight){node.setAttributeNS(null,"preserveAspectRatio","none");} +var width=style.graphicWidth||style.graphicHeight;var height=style.graphicHeight||style.graphicWidth;width=width?width:style.pointRadius*2;height=height?height:style.pointRadius*2;var xOffset=(style.graphicXOffset!=undefined)?style.graphicXOffset:-(0.5*width);var yOffset=(style.graphicYOffset!=undefined)?style.graphicYOffset:-(0.5*height);var opacity=style.graphicOpacity||style.fillOpacity;node.setAttributeNS(null,"x",(pos.x+xOffset).toFixed());node.setAttributeNS(null,"y",(pos.y+yOffset).toFixed());node.setAttributeNS(null,"width",width);node.setAttributeNS(null,"height",height);node.setAttributeNS(this.xlinkns,"href",style.externalGraphic);node.setAttributeNS(null,"style","opacity: "+opacity);}else if(this.isComplexSymbol(style.graphicName)){var offset=style.pointRadius*3;var size=offset*2;var id=this.importSymbol(style.graphicName);pos=this.getPosition(node);widthFactor=this.symbolMetrics[id][0]*3/size;var parent=node.parentNode;var nextSibling=node.nextSibling;if(parent){parent.removeChild(node);} +if(this.supportUse===false){var src=document.getElementById(id);node.firstChild&&node.removeChild(node.firstChild);node.appendChild(src.firstChild.cloneNode(true));node.setAttributeNS(null,"viewBox",src.getAttributeNS(null,"viewBox"));}else{node.setAttributeNS(this.xlinkns,"href","#"+id);} +node.setAttributeNS(null,"width",size);node.setAttributeNS(null,"height",size);node.setAttributeNS(null,"x",pos.x-offset);node.setAttributeNS(null,"y",pos.y-offset);if(nextSibling){parent.insertBefore(node,nextSibling);}else if(parent){parent.appendChild(node);}}else{node.setAttributeNS(null,"r",style.pointRadius);} +var rotation=style.rotation;if((rotation!==undefined||node._rotation!==undefined)&&pos){node._rotation=rotation;rotation|=0;if(node.nodeName!=="svg"){node.setAttributeNS(null,"transform","rotate("+rotation+" "+pos.x+" "+ +pos.y+")");}else{var metrics=this.symbolMetrics[id];node.firstChild.setAttributeNS(null,"transform","rotate("+style.rotation+" "+metrics[1]+" "+metrics[2]+")");}}} +if(options.isFilled){node.setAttributeNS(null,"fill",style.fillColor);node.setAttributeNS(null,"fill-opacity",style.fillOpacity);}else{node.setAttributeNS(null,"fill","none");} +if(options.isStroked){node.setAttributeNS(null,"stroke",style.strokeColor);node.setAttributeNS(null,"stroke-opacity",style.strokeOpacity);node.setAttributeNS(null,"stroke-width",style.strokeWidth*widthFactor);node.setAttributeNS(null,"stroke-linecap",style.strokeLinecap||"round");node.setAttributeNS(null,"stroke-linejoin","round");style.strokeDashstyle&&node.setAttributeNS(null,"stroke-dasharray",this.dashStyle(style,widthFactor));}else{node.setAttributeNS(null,"stroke","none");} +if(style.pointerEvents){node.setAttributeNS(null,"pointer-events",style.pointerEvents);} +if(style.cursor!=null){node.setAttributeNS(null,"cursor",style.cursor);} +return node;},dashStyle:function(style,widthFactor){var w=style.strokeWidth*widthFactor;var str=style.strokeDashstyle;switch(str){case'solid':return'none';case'dot':return[1,4*w].join();case'dash':return[4*w,4*w].join();case'dashdot':return[4*w,4*w,1,4*w].join();case'longdash':return[8*w,4*w].join();case'longdashdot':return[8*w,4*w,1,4*w].join();default:return OpenLayers.String.trim(str).replace(/\s+/g,",");}},createNode:function(type,id){var node=document.createElementNS(this.xmlns,type);if(id){node.setAttributeNS(null,"id",id);} +return node;},nodeTypeCompare:function(node,type){return(type==node.nodeName);},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_svgRoot","svg");},createRoot:function(suffix){return this.nodeFactory(this.container.id+suffix,"g");},createDefs:function(){var defs=this.nodeFactory(this.container.id+"_defs","defs");this.rendererRoot.appendChild(defs);return defs;},drawPoint:function(node,geometry){return this.drawCircle(node,geometry,1);},drawCircle:function(node,geometry,radius){var resolution=this.getResolution();var x=(geometry.x/resolution+this.left);var y=(this.top-geometry.y/resolution);if(this.inValidRange(x,y)){node.setAttributeNS(null,"cx",x);node.setAttributeNS(null,"cy",y);node.setAttributeNS(null,"r",radius);return node;}else{return false;}},drawLineString:function(node,geometry){var componentsResult=this.getComponentsString(geometry.components);if(componentsResult.path){node.setAttributeNS(null,"points",componentsResult.path);return(componentsResult.complete?node:null);}else{return false;}},drawLinearRing:function(node,geometry){var componentsResult=this.getComponentsString(geometry.components);if(componentsResult.path){node.setAttributeNS(null,"points",componentsResult.path);return(componentsResult.complete?node:null);}else{return false;}},drawPolygon:function(node,geometry){var d="";var draw=true;var complete=true;var linearRingResult,path;for(var j=0,len=geometry.components.length;j0){if(this.getShortString(components[i-1])){strings.push(this.clipLine(components[i],components[i-1]));}} +if(imaxX){k=(y2-y1)/(x2-x1);x2=x2<0?-maxX:maxX;y2=y1+(x2-x1)*k;} +if(y2<-maxY||y2>maxY){k=(x2-x1)/(y2-y1);y2=y2<0?-maxY:maxY;x2=x1+(y2-y1)*k;} +return x2+","+y2;},getShortString:function(point){var resolution=this.getResolution();var x=(point.x/resolution+this.left);var y=(this.top-point.y/resolution);if(this.inValidRange(x,y)){return x+","+y;}else{return false;}},getPosition:function(node){return({x:parseFloat(node.getAttributeNS(null,"cx")),y:parseFloat(node.getAttributeNS(null,"cy"))});},importSymbol:function(graphicName){if(!this.defs){this.defs=this.createDefs();} +var id=this.container.id+"-"+graphicName;if(document.getElementById(id)!=null){return id;} +var symbol=OpenLayers.Renderer.symbol[graphicName];if(!symbol){throw new Error(graphicName+' is not a valid symbol name');} +var symbolNode=this.nodeFactory(id,"symbol");var node=this.nodeFactory(null,"polygon");symbolNode.appendChild(node);var symbolExtent=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0);var points=[];var x,y;for(var i=0;i=2*parts[1]){return"longdash";} +return(parts[0]==1||parts[1]==1)?"dot":"dash";}else if(parts.length==4){return(1*parts[0]>=2*parts[1])?"longdashdot":"dashdot";} +return"solid";}},createNode:function(type,id){var node=document.createElement(type);if(id){node.id=id;} +node.unselectable='on';node.onselectstart=OpenLayers.Function.False;return node;},nodeTypeCompare:function(node,type){var subType=type;var splitIndex=subType.indexOf(":");if(splitIndex!=-1){subType=subType.substr(splitIndex+1);} +var nodeName=node.nodeName;splitIndex=nodeName.indexOf(":");if(splitIndex!=-1){nodeName=nodeName.substr(splitIndex+1);} +return(subType==nodeName);},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_vmlRoot","div");},createRoot:function(suffix){return this.nodeFactory(this.container.id+suffix,"olv:group");},drawPoint:function(node,geometry){return this.drawCircle(node,geometry,1);},drawCircle:function(node,geometry,radius){if(!isNaN(geometry.x)&&!isNaN(geometry.y)){var resolution=this.getResolution();node.style.left=(((geometry.x/resolution-this.offset.x)|0)-radius)+"px";node.style.top=(((geometry.y/resolution-this.offset.y)|0)-radius)+"px";var diameter=radius*2;node.style.width=diameter+"px";node.style.height=diameter+"px";return node;} +return false;},drawLineString:function(node,geometry){return this.drawLine(node,geometry,false);},drawLinearRing:function(node,geometry){return this.drawLine(node,geometry,true);},drawLine:function(node,geometry,closeLine){this.setNodeDimension(node,geometry);var resolution=this.getResolution();var numComponents=geometry.components.length;var parts=new Array(numComponents);var comp,x,y;for(var i=0;i0){symbolExtent.bottom=symbolExtent.bottom-diff;symbolExtent.top=symbolExtent.top+diff;}else{symbolExtent.left=symbolExtent.left+diff;symbolExtent.right=symbolExtent.right-diff;} +cache={path:path,size:symbolExtent.getWidth(),left:symbolExtent.left,bottom:symbolExtent.bottom};this.symbolCache[id]=cache;return cache;},CLASS_NAME:"OpenLayers.Renderer.VML"});OpenLayers.Renderer.VML.LABEL_SHIFT={"l":0,"c":.5,"r":1,"t":0,"m":.5,"b":1};OpenLayers.Tile=OpenLayers.Class({EVENT_TYPES:["loadstart","loadend","reload","unload"],events:null,id:null,layer:null,url:null,bounds:null,size:null,position:null,isLoading:false,initialize:function(layer,position,bounds,url,size,options){this.layer=layer;this.position=position.clone();this.bounds=bounds.clone();this.url=url;this.size=size.clone();this.id=OpenLayers.Util.createUniqueID("Tile_");this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES);OpenLayers.Util.extend(this,options);},unload:function(){if(this.isLoading){this.isLoading=false;this.events.triggerEvent("unload");}},destroy:function(){this.layer=null;this.bounds=null;this.size=null;this.position=null;this.events.destroy();this.events=null;},clone:function(obj){if(obj==null){obj=new OpenLayers.Tile(this.layer,this.position,this.bounds,this.url,this.size);} +OpenLayers.Util.applyDefaults(obj,this);return obj;},draw:function(){var maxExtent=this.layer.maxExtent;var withinMaxExtent=(maxExtent&&this.bounds.intersectsBounds(maxExtent,false));this.shouldDraw=(withinMaxExtent||this.layer.displayOutsideMaxExtent);this.clear();return this.shouldDraw;},moveTo:function(bounds,position,redraw){if(redraw==null){redraw=true;} +this.bounds=bounds.clone();this.position=position.clone();if(redraw){this.draw();}},clear:function(){},getBoundsFromBaseLayer:function(position){var msg=OpenLayers.i18n('reprojectDeprecated',{'layerName':this.layer.name});OpenLayers.Console.warn(msg);var topLeft=this.layer.map.getLonLatFromLayerPx(position);var bottomRightPx=position.clone();bottomRightPx.x+=this.size.w;bottomRightPx.y+=this.size.h;var bottomRight=this.layer.map.getLonLatFromLayerPx(bottomRightPx);if(topLeft.lon>bottomRight.lon){if(topLeft.lon<0){topLeft.lon=-180-(topLeft.lon+180);}else{bottomRight.lon=180+bottomRight.lon+180;}} +var bounds=new OpenLayers.Bounds(topLeft.lon,bottomRight.lat,bottomRight.lon,topLeft.lat);return bounds;},showTile:function(){if(this.shouldDraw){this.show();}},show:function(){},hide:function(){},CLASS_NAME:"OpenLayers.Tile"});OpenLayers.Control.PanZoomBar=OpenLayers.Class(OpenLayers.Control.PanZoom,{zoomStopWidth:18,zoomStopHeight:11,slider:null,sliderEvents:null,zoombarDiv:null,divEvents:null,zoomWorldIcon:false,forceFixedZoomLevel:false,mouseDragStart:null,zoomStart:null,initialize:function(){OpenLayers.Control.PanZoom.prototype.initialize.apply(this,arguments);},destroy:function(){this._removeZoomBar();this.map.events.un({"changebaselayer":this.redraw,scope:this});OpenLayers.Control.PanZoom.prototype.destroy.apply(this,arguments);delete this.mouseDragStart;delete this.zoomStart;},setMap:function(map){OpenLayers.Control.PanZoom.prototype.setMap.apply(this,arguments);this.map.events.register("changebaselayer",this,this.redraw);},redraw:function(){if(this.div!=null){this.removeButtons();this._removeZoomBar();} +this.draw();},draw:function(px){OpenLayers.Control.prototype.draw.apply(this,arguments);px=this.position.clone();this.buttons=[];var sz=new OpenLayers.Size(18,18);var centered=new OpenLayers.Pixel(px.x+sz.w/2,px.y);var wposition=sz.w;if(this.zoomWorldIcon){centered=new OpenLayers.Pixel(px.x+sz.w,px.y);} +this._addButton("panup","north-mini.png",centered,sz);px.y=centered.y+sz.h;this._addButton("panleft","west-mini.png",px,sz);if(this.zoomWorldIcon){this._addButton("zoomworld","zoom-world-mini.png",px.add(sz.w,0),sz);wposition*=2;} +this._addButton("panright","east-mini.png",px.add(wposition,0),sz);this._addButton("pandown","south-mini.png",centered.add(0,sz.h*2),sz);this._addButton("zoomin","zoom-plus-mini.png",centered.add(0,sz.h*3+5),sz);centered=this._addZoomBar(centered.add(0,sz.h*4+5));this._addButton("zoomout","zoom-minus-mini.png",centered,sz);return this.div;},_addZoomBar:function(centered){var imgLocation=OpenLayers.Util.getImagesLocation();var id=this.id+"_"+this.map.id;var zoomsToEnd=this.map.getNumZoomLevels()-1-this.map.getZoom();var slider=OpenLayers.Util.createAlphaImageDiv(id,centered.add(-1,zoomsToEnd*this.zoomStopHeight),new OpenLayers.Size(20,9),imgLocation+"slider.png","absolute");this.slider=slider;this.sliderEvents=new OpenLayers.Events(this,slider,null,true,{includeXY:true});this.sliderEvents.on({"mousedown":this.zoomBarDown,"mousemove":this.zoomBarDrag,"mouseup":this.zoomBarUp,"dblclick":this.doubleClick,"click":this.doubleClick});var sz=new OpenLayers.Size();sz.h=this.zoomStopHeight*this.map.getNumZoomLevels();sz.w=this.zoomStopWidth;var div=null;if(OpenLayers.Util.alphaHack()){var id=this.id+"_"+this.map.id;div=OpenLayers.Util.createAlphaImageDiv(id,centered,new OpenLayers.Size(sz.w,this.zoomStopHeight),imgLocation+"zoombar.png","absolute",null,"crop");div.style.height=sz.h+"px";}else{div=OpenLayers.Util.createDiv('OpenLayers_Control_PanZoomBar_Zoombar'+this.map.id,centered,sz,imgLocation+"zoombar.png");} +this.zoombarDiv=div;this.divEvents=new OpenLayers.Events(this,div,null,true,{includeXY:true});this.divEvents.on({"mousedown":this.divClick,"mousemove":this.passEventToSlider,"dblclick":this.doubleClick,"click":this.doubleClick});this.div.appendChild(div);this.startTop=parseInt(div.style.top);this.div.appendChild(slider);this.map.events.register("zoomend",this,this.moveZoomBar);centered=centered.add(0,this.zoomStopHeight*this.map.getNumZoomLevels());return centered;},_removeZoomBar:function(){this.sliderEvents.un({"mousedown":this.zoomBarDown,"mousemove":this.zoomBarDrag,"mouseup":this.zoomBarUp,"dblclick":this.doubleClick,"click":this.doubleClick});this.sliderEvents.destroy();this.divEvents.un({"mousedown":this.divClick,"mousemove":this.passEventToSlider,"dblclick":this.doubleClick,"click":this.doubleClick});this.divEvents.destroy();this.div.removeChild(this.zoombarDiv);this.zoombarDiv=null;this.div.removeChild(this.slider);this.slider=null;this.map.events.unregister("zoomend",this,this.moveZoomBar);},passEventToSlider:function(evt){this.sliderEvents.handleBrowserEvent(evt);},divClick:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;} +var levels=evt.xy.y/this.zoomStopHeight;if(this.forceFixedZoomLevel||!this.map.fractionalZoom){levels=Math.floor(levels);} +var zoom=(this.map.getNumZoomLevels()-1)-levels;zoom=Math.min(Math.max(zoom,0),this.map.getNumZoomLevels()-1);this.map.zoomTo(zoom);OpenLayers.Event.stop(evt);},zoomBarDown:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;} +this.map.events.on({"mousemove":this.passEventToSlider,"mouseup":this.passEventToSlider,scope:this});this.mouseDragStart=evt.xy.clone();this.zoomStart=evt.xy.clone();this.div.style.cursor="move";this.zoombarDiv.offsets=null;OpenLayers.Event.stop(evt);},zoomBarDrag:function(evt){if(this.mouseDragStart!=null){var deltaY=this.mouseDragStart.y-evt.xy.y;var offsets=OpenLayers.Util.pagePosition(this.zoombarDiv);if((evt.clientY-offsets[1])>0&&(evt.clientY-offsets[1])0){pieces.push(',');} +pieces.push(this.writeNewline(),this.writeIndent(),json);}} +this.level-=1;pieces.push(this.writeNewline(),this.writeIndent(),']');return pieces.join('');},'string':function(string){var m={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};if(/["\\\x00-\x1f]/.test(string)){return'"'+string.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=m[b];if(c){return c;} +c=b.charCodeAt();return'\\u00'+ +Math.floor(c/16).toString(16)+ +(c%16).toString(16);})+'"';} +return'"'+string+'"';},'number':function(number){return isFinite(number)?String(number):"null";},'boolean':function(bool){return String(bool);},'date':function(date){function format(number){return(number<10)?'0'+number:number;} +return'"'+date.getFullYear()+'-'+ +format(date.getMonth()+1)+'-'+ +format(date.getDate())+'T'+ +format(date.getHours())+':'+ +format(date.getMinutes())+':'+ +format(date.getSeconds())+'"';}},CLASS_NAME:"OpenLayers.Format.JSON"});OpenLayers.Format.XML=OpenLayers.Class(OpenLayers.Format,{namespaces:null,namespaceAlias:null,defaultPrefix:null,readers:{},writers:{},xmldom:null,initialize:function(options){if(window.ActiveXObject){this.xmldom=new ActiveXObject("Microsoft.XMLDOM");} +OpenLayers.Format.prototype.initialize.apply(this,[options]);this.namespaces=OpenLayers.Util.extend({},this.namespaces);this.namespaceAlias={};for(var alias in this.namespaces){this.namespaceAlias[this.namespaces[alias]]=alias;}},destroy:function(){this.xmldom=null;OpenLayers.Format.prototype.destroy.apply(this,arguments);},setNamespace:function(alias,uri){this.namespaces[alias]=uri;this.namespaceAlias[uri]=alias;},read:function(text){var index=text.indexOf('<');if(index>0){text=text.substring(index);} +var node=OpenLayers.Util.Try(OpenLayers.Function.bind((function(){var xmldom;if(window.ActiveXObject&&!this.xmldom){xmldom=new ActiveXObject("Microsoft.XMLDOM");}else{xmldom=this.xmldom;} +xmldom.loadXML(text);return xmldom;}),this),function(){return new DOMParser().parseFromString(text,'text/xml');},function(){var req=new XMLHttpRequest();req.open("GET","data:"+"text/xml"+";charset=utf-8,"+encodeURIComponent(text),false);if(req.overrideMimeType){req.overrideMimeType("text/xml");} +req.send(null);return req.responseXML;});if(this.keepData){this.data=node;} +return node;},write:function(node){var data;if(this.xmldom){data=node.xml;}else{var serializer=new XMLSerializer();if(node.nodeType==1){var doc=document.implementation.createDocument("","",null);if(doc.importNode){node=doc.importNode(node,true);} +doc.appendChild(node);data=serializer.serializeToString(doc);}else{data=serializer.serializeToString(node);}} +return data;},createElementNS:function(uri,name){var element;if(this.xmldom){if(typeof uri=="string"){element=this.xmldom.createNode(1,name,uri);}else{element=this.xmldom.createNode(1,name,"");}}else{element=document.createElementNS(uri,name);} +return element;},createTextNode:function(text){var node;if(typeof text!=="string"){text=String(text);} +if(this.xmldom){node=this.xmldom.createTextNode(text);}else{node=document.createTextNode(text);} +return node;},getElementsByTagNameNS:function(node,uri,name){var elements=[];if(node.getElementsByTagNameNS){elements=node.getElementsByTagNameNS(uri,name);}else{var allNodes=node.getElementsByTagName("*");var potentialNode,fullName;for(var i=0,len=allNodes.length;i0){prefix=name.substring(0,split);local=name.substring(split+1);}else{if(parent){prefix=this.namespaceAlias[parent.namespaceURI];}else{prefix=this.defaultPrefix;} +local=name;} +var child=this.writers[prefix][local].apply(this,[obj]);if(parent){parent.appendChild(child);} +return child;},getChildEl:function(node,name,uri){return node&&this.getThisOrNextEl(node.firstChild,name,uri);},getNextEl:function(node,name,uri){return node&&this.getThisOrNextEl(node.nextSibling,name,uri);},getThisOrNextEl:function(node,name,uri){outer:for(var sibling=node;sibling;sibling=sibling.nextSibling){switch(sibling.nodeType){case 1:if((!name||name===(sibling.localName||sibling.nodeName.split(":").pop()))&&(!uri||uri===sibling.namespaceURI)){break outer;} +sibling=null;break outer;case 3:if(/^\s*$/.test(sibling.nodeValue)){break;} +case 4:case 6:case 12:case 10:case 11:sibling=null;break outer;}} +return sibling||null;},lookupNamespaceURI:function(node,prefix){var uri=null;if(node){if(node.lookupNamespaceURI){uri=node.lookupNamespaceURI(prefix);}else{outer:switch(node.nodeType){case 1:if(node.namespaceURI!==null&&node.prefix===prefix){uri=node.namespaceURI;break outer;} +var len=node.attributes.length;if(len){var attr;for(var i=0;i=0;--i){this.controls[i].destroy();} +this.controls=null;} +if(this.layers!=null){for(var i=this.layers.length-1;i>=0;--i){this.layers[i].destroy(false);} +this.layers=null;} +if(this.viewPortDiv){this.div.removeChild(this.viewPortDiv);} +this.viewPortDiv=null;if(this.eventListeners){this.events.un(this.eventListeners);this.eventListeners=null;} +this.events.destroy();this.events=null;},setOptions:function(options){OpenLayers.Util.extend(this,options);},getTileSize:function(){return this.tileSize;},getBy:function(array,property,match){var test=(typeof match.test=="function");var found=OpenLayers.Array.filter(this[array],function(item){return item[property]==match||(test&&match.test(item[property]));});return found;},getLayersBy:function(property,match){return this.getBy("layers",property,match);},getLayersByName:function(match){return this.getLayersBy("name",match);},getLayersByClass:function(match){return this.getLayersBy("CLASS_NAME",match);},getControlsBy:function(property,match){return this.getBy("controls",property,match);},getControlsByClass:function(match){return this.getControlsBy("CLASS_NAME",match);},getLayer:function(id){var foundLayer=null;for(var i=0,len=this.layers.length;ithis.layers.length){idx=this.layers.length;} +if(base!=idx){this.layers.splice(base,1);this.layers.splice(idx,0,layer);for(var i=0,len=this.layers.length;i=0;--i){this.removePopup(this.popups[i]);}} +popup.map=this;this.popups.push(popup);var popupDiv=popup.draw();if(popupDiv){popupDiv.style.zIndex=this.Z_INDEX_BASE['Popup']+ +this.popups.length;this.layerContainerDiv.appendChild(popupDiv);}},removePopup:function(popup){OpenLayers.Util.removeItem(this.popups,popup);if(popup.div){try{this.layerContainerDiv.removeChild(popup.div);} +catch(e){}} +popup.map=null;},getSize:function(){var size=null;if(this.size!=null){size=this.size.clone();} +return size;},updateSize:function(){var newSize=this.getCurrentSize();if(newSize&&!isNaN(newSize.h)&&!isNaN(newSize.w)){this.events.clearMouseCache();var oldSize=this.getSize();if(oldSize==null){this.size=oldSize=newSize;} +if(!newSize.equals(oldSize)){this.size=newSize;for(var i=0,len=this.layers.length;ithis.restrictedExtent.getWidth()){lonlat=new OpenLayers.LonLat(maxCenter.lon,lonlat.lat);}else if(extent.leftthis.restrictedExtent.right){lonlat=lonlat.add(this.restrictedExtent.right- +extent.right,0);} +if(extent.getHeight()>this.restrictedExtent.getHeight()){lonlat=new OpenLayers.LonLat(lonlat.lon,maxCenter.lat);}else if(extent.bottomthis.restrictedExtent.top){lonlat=lonlat.add(0,this.restrictedExtent.top- +extent.top);}}} +var zoomChanged=forceZoomChange||((this.isValidZoomLevel(zoom))&&(zoom!=this.getZoom()));var centerChanged=(this.isValidLonLat(lonlat))&&(!lonlat.equals(this.center));if(zoomChanged||centerChanged||!dragging){if(!this.dragging&&!noEvent){this.events.triggerEvent("movestart");} +if(centerChanged){if((!zoomChanged)&&(this.center)){this.centerLayerContainer(lonlat);} +this.center=lonlat.clone();} +if((zoomChanged)||(this.layerContainerOrigin==null)){this.layerContainerOrigin=this.center.clone();this.layerContainerDiv.style.left="0px";this.layerContainerDiv.style.top="0px";} +if(zoomChanged){this.zoom=zoom;this.resolution=this.getResolutionForZoom(zoom);this.viewRequestID++;} +var bounds=this.getExtent();if(this.baseLayer.visibility){this.baseLayer.moveTo(bounds,zoomChanged,dragging);if(dragging){this.baseLayer.events.triggerEvent("move");}else{this.baseLayer.events.triggerEvent("moveend",{"zoomChanged":zoomChanged});}} +bounds=this.baseLayer.getExtent();for(var i=0,len=this.layers.length;i=0)&&(zoomLevel0){resolution=this.layers[0].getResolution();} +return resolution;},getUnits:function(){var units=null;if(this.baseLayer!=null){units=this.baseLayer.units;} +return units;},getScale:function(){var scale=null;if(this.baseLayer!=null){var res=this.getResolution();var units=this.baseLayer.units;scale=OpenLayers.Util.getScaleFromResolution(res,units);} +return scale;},getZoomForExtent:function(bounds,closest){var zoom=null;if(this.baseLayer!=null){zoom=this.baseLayer.getZoomForExtent(bounds,closest);} +return zoom;},getResolutionForZoom:function(zoom){var resolution=null;if(this.baseLayer){resolution=this.baseLayer.getResolutionForZoom(zoom);} +return resolution;},getZoomForResolution:function(resolution,closest){var zoom=null;if(this.baseLayer!=null){zoom=this.baseLayer.getZoomForResolution(resolution,closest);} +return zoom;},zoomTo:function(zoom){if(this.isValidZoomLevel(zoom)){this.setCenter(null,zoom);}},zoomIn:function(){this.zoomTo(this.getZoom()+1);},zoomOut:function(){this.zoomTo(this.getZoom()-1);},zoomToExtent:function(bounds,closest){var center=bounds.getCenterLonLat();if(this.baseLayer.wrapDateLine){var maxExtent=this.getMaxExtent();bounds=bounds.clone();while(bounds.right0){var separator=(url.indexOf('?')>-1)?'&':'?';url+=separator+paramString;}} +if(config.proxy&&(url.indexOf("http")==0)){if(typeof config.proxy=="function"){url=config.proxy(url);}else{url=config.proxy+encodeURIComponent(url);}} +request.open(config.method,url,config.async,config.user,config.password);for(var header in config.headers){request.setRequestHeader(header,config.headers[header]);} +var events=this.events;var self=this;request.onreadystatechange=function(){if(request.readyState==OpenLayers.Request.XMLHttpRequest.DONE){var proceed=events.triggerEvent("complete",{request:request,config:config,requestUrl:url});if(proceed!==false){self.runCallbacks({request:request,config:config,requestUrl:url});}}};if(config.async===false){request.send(config.data);}else{window.setTimeout(function(){if(request._aborted!==true){request.send(config.data);}},0);} +return request;},runCallbacks:function(options){var request=options.request;var config=options.config;var complete=(config.scope)?OpenLayers.Function.bind(config.callback,config.scope):config.callback;var success;if(config.success){success=(config.scope)?OpenLayers.Function.bind(config.success,config.scope):config.success;} +var failure;if(config.failure){failure=(config.scope)?OpenLayers.Function.bind(config.failure,config.scope):config.failure;} +complete(request);if(!request.status||(request.status>=200&&request.status<300)){this.events.triggerEvent("success",options);if(success){success(request);}} +if(request.status&&(request.status<200||request.status>=300)){this.events.triggerEvent("failure",options);if(failure){failure(request);}}},GET:function(config){config=OpenLayers.Util.extend(config,{method:"GET"});return OpenLayers.Request.issue(config);},POST:function(config){config=OpenLayers.Util.extend(config,{method:"POST"});config.headers=config.headers?config.headers:{};if(!("CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(config.headers))){config.headers["Content-Type"]="application/xml";} +return OpenLayers.Request.issue(config);},PUT:function(config){config=OpenLayers.Util.extend(config,{method:"PUT"});config.headers=config.headers?config.headers:{};if(!("CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(config.headers))){config.headers["Content-Type"]="application/xml";} +return OpenLayers.Request.issue(config);},DELETE:function(config){config=OpenLayers.Util.extend(config,{method:"DELETE"});return OpenLayers.Request.issue(config);},HEAD:function(config){config=OpenLayers.Util.extend(config,{method:"HEAD"});return OpenLayers.Request.issue(config);},OPTIONS:function(config){config=OpenLayers.Util.extend(config,{method:"OPTIONS"});return OpenLayers.Request.issue(config);}};OpenLayers.Tile.Image=OpenLayers.Class(OpenLayers.Tile,{url:null,imgDiv:null,frame:null,layerAlphaHack:null,isBackBuffer:false,lastRatio:1,isFirstDraw:true,backBufferTile:null,maxGetUrlLength:null,initialize:function(layer,position,bounds,url,size,options){OpenLayers.Tile.prototype.initialize.apply(this,arguments);if(this.maxGetUrlLength!=null){OpenLayers.Util.extend(this,OpenLayers.Tile.Image.IFrame);} +this.url=url;this.frame=document.createElement('div');this.frame.style.overflow='hidden';this.frame.style.position='absolute';this.layerAlphaHack=this.layer.alpha&&OpenLayers.Util.alphaHack();},destroy:function(){if(this.imgDiv!=null){this.removeImgDiv();} +this.imgDiv=null;if((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(obj){if(obj==null){obj=new OpenLayers.Tile.Image(this.layer,this.position,this.bounds,this.url,this.size);} +obj=OpenLayers.Tile.prototype.clone.apply(this,[obj]);obj.imgDiv=null;return obj;},draw:function(){if(this.layer!=this.layer.map.baseLayer&&this.layer.reproject){this.bounds=this.getBoundsFromBaseLayer(this.position);} +var drawTile=OpenLayers.Tile.prototype.draw.apply(this,arguments);if((OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1)||this.layer.singleTile){if(drawTile){if(!this.backBufferTile){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{if(this.backBufferTile){this.backBufferTile.clear();}}}else{if(drawTile&&this.isFirstDraw){this.events.register('loadend',this,this.showTile);this.isFirstDraw=false;}} +if(!drawTile){return false;} +if(this.isLoading){this.events.triggerEvent("reload");}else{this.isLoading=true;this.events.triggerEvent("loadstart");} +return this.renderTile();},resetBackBuffer:function(){this.showTile();if(this.backBufferTile&&(this.isFirstDraw||!this.layer.numLoadingTiles)){this.isFirstDraw=false;var maxExtent=this.layer.maxExtent;var withinMaxExtent=(maxExtent&&this.bounds.intersectsBounds(maxExtent,false));if(withinMaxExtent){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(){if(this.layer.async){this.initImgDiv();this.layer.getURLasync(this.bounds,this,"url",this.positionImage);}else{this.url=this.layer.getURL(this.bounds);this.initImgDiv();this.positionImage();} +return true;},positionImage:function(){if(this.layer===null){return;} +OpenLayers.Util.modifyDOMElement(this.frame,null,this.position,this.size);var imageSize=this.layer.getImageSize(this.bounds);if(this.layerAlphaHack){OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv,null,null,imageSize,this.url);}else{OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,imageSize);this.imgDiv.src=this.url;}},clear:function(){if(this.imgDiv){this.hide();if(OpenLayers.Tile.Image.useBlankTile){this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif";}}},initImgDiv:function(){if(this.imgDiv==null){var offset=this.layer.imageOffset;var size=this.layer.getImageSize(this.bounds);if(this.layerAlphaHack){this.imgDiv=OpenLayers.Util.createAlphaImageDiv(null,offset,size,null,"relative",null,null,null,true);}else{this.imgDiv=OpenLayers.Util.createImage(null,offset,size,null,"relative",null,null,true);} +if(this.layer.url instanceof Array){this.imgDiv.urls=this.layer.url.slice();} +this.imgDiv.className='olTileImage';this.frame.style.zIndex=this.isBackBuffer?0:1;this.frame.appendChild(this.imgDiv);this.layer.div.appendChild(this.frame);if(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 onload=function(){if(this.isLoading){this.isLoading=false;this.events.triggerEvent("loadend");}};if(this.layerAlphaHack){OpenLayers.Event.observe(this.imgDiv.childNodes[0],'load',OpenLayers.Function.bind(onload,this));}else{OpenLayers.Event.observe(this.imgDiv,'load',OpenLayers.Function.bind(onload,this));} +var onerror=function(){if(this.imgDiv._attempts>OpenLayers.IMAGE_RELOAD_ATTEMPTS){onload.call(this);}};OpenLayers.Event.observe(this.imgDiv,"error",OpenLayers.Function.bind(onerror,this));} +this.imgDiv.viewRequestID=this.layer.map.viewRequestID;},removeImgDiv:function(){OpenLayers.Event.stopObservingElement(this.imgDiv);if(this.imgDiv.parentNode==this.frame){this.frame.removeChild(this.imgDiv);this.imgDiv.map=null;} +this.imgDiv.urls=null;var child=this.imgDiv.firstChild;if(child){OpenLayers.Event.stopObservingElement(child);this.imgDiv.removeChild(child);delete child;}else{this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif";}},checkImgURL:function(){if(this.layer){var loaded=this.layerAlphaHack?this.imgDiv.firstChild.src:this.imgDiv.src;if(!OpenLayers.Util.isEquivalentUrl(loaded,this.url)){this.hide();}}},startTransition:function(){if(!this.backBufferTile||!this.backBufferTile.imgDiv){return;} +var ratio=1;if(this.backBufferTile.resolution){ratio=this.backBufferTile.resolution/this.layer.getResolution();} +if(ratio!=this.lastRatio){if(this.layer.transitionEffect=='resize'){var upperLeft=new OpenLayers.LonLat(this.backBufferTile.bounds.left,this.backBufferTile.bounds.top);var size=new OpenLayers.Size(this.backBufferTile.size.w*ratio,this.backBufferTile.size.h*ratio);var px=this.layer.map.getLayerPxFromLonLat(upperLeft);OpenLayers.Util.modifyDOMElement(this.backBufferTile.frame,null,px,size);var imageSize=this.backBufferTile.imageSize;imageSize=new OpenLayers.Size(imageSize.w*ratio,imageSize.h*ratio);var imageOffset=this.backBufferTile.imageOffset;if(imageOffset){imageOffset=new OpenLayers.Pixel(imageOffset.x*ratio,imageOffset.y*ratio);} +OpenLayers.Util.modifyDOMElement(this.backBufferTile.imgDiv,null,imageOffset,imageSize);this.backBufferTile.show();}}else{if(this.layer.singleTile){this.backBufferTile.show();}else{this.backBufferTile.hide();}} +this.lastRatio=ratio;},show:function(){this.frame.style.display='';if(OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1){if(OpenLayers.IS_GECKO===true){this.frame.scrollLeft=this.frame.scrollLeft;}}},hide:function(){this.frame.style.display='none';},CLASS_NAME:"OpenLayers.Tile.Image"});OpenLayers.Tile.Image.useBlankTile=(OpenLayers.BROWSER_NAME=="safari"||OpenLayers.BROWSER_NAME=="opera");OpenLayers.Feature=OpenLayers.Class({layer:null,id:null,lonlat:null,data:null,marker:null,popupClass:OpenLayers.Popup.AnchoredBubble,popup:null,initialize:function(layer,lonlat,data){this.layer=layer;this.lonlat=lonlat;this.data=(data!=null)?data:{};this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");},destroy:function(){if((this.layer!=null)&&(this.layer.map!=null)){if(this.popup!=null){this.layer.map.removePopup(this.popup);}} +if(this.layer!=null&&this.marker!=null){this.layer.removeMarker(this.marker);} +this.layer=null;this.id=null;this.lonlat=null;this.data=null;if(this.marker!=null){this.destroyMarker(this.marker);this.marker=null;} +if(this.popup!=null){this.destroyPopup(this.popup);this.popup=null;}},onScreen:function(){var onScreen=false;if((this.layer!=null)&&(this.layer.map!=null)){var screenBounds=this.layer.map.getExtent();onScreen=screenBounds.containsLonLat(this.lonlat);} +return onScreen;},createMarker:function(){if(this.lonlat!=null){this.marker=new OpenLayers.Marker(this.lonlat,this.data.icon);} +return this.marker;},destroyMarker:function(){this.marker.destroy();},createPopup:function(closeBox){if(this.lonlat!=null){var id=this.id+"_popup";var anchor=(this.marker)?this.marker.icon:null;if(!this.popup){this.popup=new this.popupClass(id,this.lonlat,this.data.popupSize,this.data.popupContentHTML,anchor,closeBox);} +if(this.data.overflow!=null){this.popup.contentDiv.style.overflow=this.data.overflow;} +this.popup.feature=this;} +return this.popup;},destroyPopup:function(){if(this.popup){this.popup.feature=null;this.popup.destroy();this.popup=null;}},CLASS_NAME:"OpenLayers.Feature"});OpenLayers.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(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);if(this.pixelTolerance!=null){this.mousedown=function(evt){this.down=evt.xy;return true;};}},mousedown:null,mouseup:function(evt){var propagate=true;if(this.checkModifiers(evt)&&this.control.handleRightClicks&&OpenLayers.Event.isRightClick(evt)){propagate=this.rightclick(evt);} +return propagate;},rightclick:function(evt){if(this.passesTolerance(evt)){if(this.rightclickTimerId!=null){this.clearTimer();this.callback('dblrightclick',[evt]);return!this.stopDouble;}else{var clickEvent=this['double']?OpenLayers.Util.extend({},evt):this.callback('rightclick',[evt]);var delayedRightCall=OpenLayers.Function.bind(this.delayedRightCall,this,clickEvent);this.rightclickTimerId=window.setTimeout(delayedRightCall,this.delay);}} +return!this.stopSingle;},delayedRightCall:function(evt){this.rightclickTimerId=null;if(evt){this.callback('rightclick',[evt]);} +return!this.stopSingle;},dblclick:function(evt){if(this.passesTolerance(evt)){if(this["double"]){this.callback('dblclick',[evt]);} +this.clearTimer();} +return!this.stopDouble;},click:function(evt){if(this.passesTolerance(evt)){if(this.timerId!=null){this.clearTimer();}else{var clickEvent=this.single?OpenLayers.Util.extend({},evt):null;this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,clickEvent),this.delay);}} +return!this.stopSingle;},passesTolerance:function(evt){var passes=true;if(this.pixelTolerance!=null&&this.down){var dpx=Math.sqrt(Math.pow(this.down.x-evt.xy.x,2)+ +Math.pow(this.down.y-evt.xy.y,2));if(dpx>this.pixelTolerance){passes=false;}} +return passes;},clearTimer:function(){if(this.timerId!=null){window.clearTimeout(this.timerId);this.timerId=null;} +if(this.rightclickTimerId!=null){window.clearTimeout(this.rightclickTimerId);this.rightclickTimerId=null;}},delayedCall:function(evt){this.timerId=null;if(evt){this.callback('click',[evt]);}},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.clearTimer();this.down=null;deactivated=true;} +return deactivated;},CLASS_NAME:"OpenLayers.Handler.Click"});OpenLayers.Handler.Drag=OpenLayers.Class(OpenLayers.Handler,{started:false,stopDown:true,dragging:false,last:null,start:null,oldOnselectstart:null,interval:0,timeoutId:null,documentDrag:false,documentEvents:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);},down:function(evt){},move:function(evt){},up:function(evt){},out:function(evt){},mousedown:function(evt){var propagate=true;this.dragging=false;if(this.checkModifiers(evt)&&OpenLayers.Event.isLeftClick(evt)){this.started=true;this.start=evt.xy;this.last=evt.xy;OpenLayers.Element.addClass(this.map.viewPortDiv,"olDragDown");this.down(evt);this.callback("down",[evt.xy]);OpenLayers.Event.stop(evt);if(!this.oldOnselectstart){this.oldOnselectstart=(document.onselectstart)?document.onselectstart:OpenLayers.Function.True;} +document.onselectstart=OpenLayers.Function.False;propagate=!this.stopDown;}else{this.started=false;this.start=null;this.last=null;} +return propagate;},mousemove:function(evt){if(this.started&&!this.timeoutId&&(evt.xy.x!=this.last.x||evt.xy.y!=this.last.y)){if(this.documentDrag===true&&this.documentEvents){if(evt.element===document){this.adjustXY(evt);this.setEvent(evt);}else{this.destroyDocumentEvents();}} +if(this.interval>0){this.timeoutId=setTimeout(OpenLayers.Function.bind(this.removeTimeout,this),this.interval);} +this.dragging=true;this.move(evt);this.callback("move",[evt.xy]);if(!this.oldOnselectstart){this.oldOnselectstart=document.onselectstart;document.onselectstart=OpenLayers.Function.False;} +this.last=this.evt.xy;} +return true;},removeTimeout:function(){this.timeoutId=null;},mouseup:function(evt){if(this.started){if(this.documentDrag===true&&this.documentEvents){this.adjustXY(evt);this.destroyDocumentEvents();} +var dragged=(this.start!=this.last);this.started=false;this.dragging=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.up(evt);this.callback("up",[evt.xy]);if(dragged){this.callback("done",[evt.xy]);} +document.onselectstart=this.oldOnselectstart;} +return true;},mouseout:function(evt){if(this.started&&OpenLayers.Util.mouseLeft(evt,this.map.div)){if(this.documentDrag===true){this.documentEvents=new OpenLayers.Events(this,document,null,null,{includeXY:true});this.documentEvents.on({mousemove:this.mousemove,mouseup:this.mouseup});OpenLayers.Element.addClass(document.body,"olDragDown");}else{var dragged=(this.start!=this.last);this.started=false;this.dragging=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.out(evt);this.callback("out",[]);if(dragged){this.callback("done",[evt.xy]);} +if(document.onselectstart){document.onselectstart=this.oldOnselectstart;}}} +return true;},click:function(evt){return(this.start==this.last);},activate:function(){var activated=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragging=false;activated=true;} +return activated;},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.started=false;this.dragging=false;this.start=null;this.last=null;deactivated=true;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");} +return deactivated;},adjustXY:function(evt){var pos=OpenLayers.Util.pagePosition(this.map.viewPortDiv);evt.xy.x-=pos[0];evt.xy.y-=pos[1];},destroyDocumentEvents:function(){OpenLayers.Element.removeClass(document.body,"olDragDown");this.documentEvents.destroy();this.documentEvents=null;},CLASS_NAME:"OpenLayers.Handler.Drag"});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(control,layer,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,[control,callbacks,options]);this.layer=layer;},mousedown:function(evt){this.down=evt.xy;return this.handle(evt)?!this.stopDown:true;},mouseup:function(evt){this.up=evt.xy;return this.handle(evt)?!this.stopUp:true;},click:function(evt){return this.handle(evt)?!this.stopClick:true;},mousemove:function(evt){if(!this.callbacks['over']&&!this.callbacks['out']){return true;} +this.handle(evt);return true;},dblclick:function(evt){return!this.handle(evt);},geometryTypeMatches:function(feature){return this.geometryTypes==null||OpenLayers.Util.indexOf(this.geometryTypes,feature.geometry.CLASS_NAME)>-1;},handle:function(evt){if(this.feature&&!this.feature.layer){this.feature=null;} +var type=evt.type;var handled=false;var previouslyIn=!!(this.feature);var click=(type=="click"||type=="dblclick");this.feature=this.layer.getFeatureFromEvent(evt);if(this.feature&&!this.feature.layer){this.feature=null;} +if(this.lastFeature&&!this.lastFeature.layer){this.lastFeature=null;} +if(this.feature){var inNew=(this.feature!=this.lastFeature);if(this.geometryTypeMatches(this.feature)){if(previouslyIn&&inNew){if(this.lastFeature){this.triggerCallback(type,'out',[this.lastFeature]);} +this.triggerCallback(type,'in',[this.feature]);}else if(!previouslyIn||click){this.triggerCallback(type,'in',[this.feature]);} +this.lastFeature=this.feature;handled=true;}else{if(this.lastFeature&&(previouslyIn&&inNew||click)){this.triggerCallback(type,'out',[this.lastFeature]);} +this.feature=null;}}else{if(this.lastFeature&&(previouslyIn||click)){this.triggerCallback(type,'out',[this.lastFeature]);}} +return handled;},triggerCallback:function(type,mode,args){var key=this.EVENTMAP[type][mode];if(key){if(type=='click'&&this.up&&this.down){var dpx=Math.sqrt(Math.pow(this.up.x-this.down.x,2)+ +Math.pow(this.up.y-this.down.y,2));if(dpx<=this.clickTolerance){this.callback(key,args);}}else{this.callback(key,args);}}},activate:function(){var activated=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.moveLayerToTop();this.map.events.on({"removelayer":this.handleMapEvents,"changelayer":this.handleMapEvents,scope:this});activated=true;} +return activated;},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.moveLayerBack();this.feature=null;this.lastFeature=null;this.down=null;this.up=null;this.map.events.un({"removelayer":this.handleMapEvents,"changelayer":this.handleMapEvents,scope:this});deactivated=true;} +return deactivated;},handleMapEvents:function(evt){if(!evt.property||evt.property=="order"){this.moveLayerToTop();}},moveLayerToTop:function(){var index=Math.max(this.map.Z_INDEX_BASE['Feature']-1,this.layer.getZIndex())+1;this.layer.setZIndex(index);},moveLayerBack:function(){var index=this.layer.getZIndex()-1;if(index>=this.map.Z_INDEX_BASE['Feature']){this.layer.setZIndex(index);}else{this.map.setLayerZIndex(this.layer,this.map.getLayerIndex(this.layer));}},CLASS_NAME:"OpenLayers.Handler.Feature"});OpenLayers.Handler.Hover=OpenLayers.Class(OpenLayers.Handler,{delay:500,pixelTolerance:null,stopMove:false,px:null,timerId:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);},mousemove:function(evt){if(this.passesTolerance(evt.xy)){this.clearTimer();this.callback('move',[evt]);this.px=evt.xy;evt=OpenLayers.Util.extend({},evt);this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,evt),this.delay);} +return!this.stopMove;},mouseout:function(evt){if(OpenLayers.Util.mouseLeft(evt,this.map.div)){this.clearTimer();this.callback('move',[evt]);} +return true;},passesTolerance:function(px){var passes=true;if(this.pixelTolerance&&this.px){var dpx=Math.sqrt(Math.pow(this.px.x-px.x,2)+ +Math.pow(this.px.y-px.y,2));if(dpx=0){this.initResolutions();break;}}}},onMapResize:function(){},redraw:function(){var redrawn=false;if(this.map){this.inRange=this.calculateInRange();var extent=this.getExtent();if(extent&&this.inRange&&this.visibility){var zoomChanged=true;this.moveTo(extent,zoomChanged,false);this.events.triggerEvent("moveend",{"zoomChanged":zoomChanged});redrawn=true;}} +return redrawn;},moveTo:function(bounds,zoomChanged,dragging){var display=this.visibility;if(!this.isBaseLayer){display=display&&this.inRange;} +this.display(display);},setMap:function(map){if(this.map==null){this.map=map;this.maxExtent=this.maxExtent||this.map.maxExtent;this.minExtent=this.minExtent||this.map.minExtent;this.projection=this.projection||this.map.projection;if(typeof this.projection=="string"){this.projection=new OpenLayers.Projection(this.projection);} +this.units=this.projection.getUnits()||this.units||this.map.units;this.initResolutions();if(!this.isBaseLayer){this.inRange=this.calculateInRange();var show=((this.visibility)&&(this.inRange));this.div.style.display=show?"":"none";} +this.setTileSize();}},afterAdd:function(){},removeMap:function(map){},getImageSize:function(bounds){return(this.imageSize||this.tileSize);},setTileSize:function(size){var tileSize=(size)?size:((this.tileSize)?this.tileSize:this.map.getTileSize());this.tileSize=tileSize;if(this.gutter){this.imageOffset=new OpenLayers.Pixel(-this.gutter,-this.gutter);this.imageSize=new OpenLayers.Size(tileSize.w+(2*this.gutter),tileSize.h+(2*this.gutter));}},getVisibility:function(){return this.visibility;},setVisibility:function(visibility){if(visibility!=this.visibility){this.visibility=visibility;this.display(visibility);this.redraw();if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"visibility"});} +this.events.triggerEvent("visibilitychanged");}},display:function(display){if(display!=(this.div.style.display!="none")){this.div.style.display=(display&&this.calculateInRange())?"block":"none";}},calculateInRange:function(){var inRange=false;if(this.alwaysInRange){inRange=true;}else{if(this.map){var resolution=this.map.getResolution();inRange=((resolution>=this.minResolution)&&(resolution<=this.maxResolution));}} +return inRange;},setIsBaseLayer:function(isBaseLayer){if(isBaseLayer!=this.isBaseLayer){this.isBaseLayer=isBaseLayer;if(this.map!=null){this.map.events.triggerEvent("changebaselayer",{layer:this});}}},initResolutions:function(){var i,len;var props={},alwaysInRange=true;for(i=0,len=this.RESOLUTION_PROPERTIES.length;i=resolution){highRes=res;lowZoom=i;} +if(res<=resolution){lowRes=res;highZoom=i;break;}} +var dRes=highRes-lowRes;if(dRes>0){zoom=lowZoom+((highRes-resolution)/dRes);}else{zoom=lowZoom;}}else{var diff;var minDiff=Number.POSITIVE_INFINITY;for(var i=0,len=this.resolutions.length;iminDiff){break;} +minDiff=diff;}else{if(this.resolutions[i]4) +this._object.open(sMethod,sUrl,bAsync,sUser,sPassword);else +if(arguments.length>3) +this._object.open(sMethod,sUrl,bAsync,sUser);else +this._object.open(sMethod,sUrl,bAsync);if(!bGecko&&!bIE){this.readyState=cXMLHttpRequest.OPENED;fReadyStateChange(this);} +this._object.onreadystatechange=function(){if(bGecko&&!bAsync) +return;oRequest.readyState=oRequest._object.readyState;fSynchronizeValues(oRequest);if(oRequest._aborted){oRequest.readyState=cXMLHttpRequest.UNSENT;return;} +if(oRequest.readyState==cXMLHttpRequest.DONE){fCleanTransport(oRequest);if(bIE&&bAsync) +window.detachEvent("onunload",fOnUnload);} +if(nState!=oRequest.readyState) +fReadyStateChange(oRequest);nState=oRequest.readyState;}};cXMLHttpRequest.prototype.send=function(vData){if(cXMLHttpRequest.onsend) +cXMLHttpRequest.onsend.apply(this,arguments);if(vData&&vData.nodeType){vData=window.XMLSerializer?new window.XMLSerializer().serializeToString(vData):vData.xml;if(!this._headers["Content-Type"]) +this._object.setRequestHeader("Content-Type","application/xml");} +this._object.send(vData);if(bGecko&&!this._async){this.readyState=cXMLHttpRequest.OPENED;fSynchronizeValues(this);while(this.readyStatecXMLHttpRequest.UNSENT) +this._aborted=true;this._object.abort();fCleanTransport(this);};cXMLHttpRequest.prototype.getAllResponseHeaders=function(){return this._object.getAllResponseHeaders();};cXMLHttpRequest.prototype.getResponseHeader=function(sName){return this._object.getResponseHeader(sName);};cXMLHttpRequest.prototype.setRequestHeader=function(sName,sValue){if(!this._headers) +this._headers={};this._headers[sName]=sValue;return this._object.setRequestHeader(sName,sValue);};cXMLHttpRequest.prototype.addEventListener=function(sName,fHandler,bUseCapture){for(var nIndex=0,oListener;oListener=this._listeners[nIndex];nIndex++) +if(oListener[0]==sName&&oListener[1]==fHandler&&oListener[2]==bUseCapture) +return;this._listeners.push([sName,fHandler,bUseCapture]);};cXMLHttpRequest.prototype.removeEventListener=function(sName,fHandler,bUseCapture){for(var nIndex=0,oListener;oListener=this._listeners[nIndex];nIndex++) +if(oListener[0]==sName&&oListener[1]==fHandler&&oListener[2]==bUseCapture) +break;if(oListener) +this._listeners.splice(nIndex,1);};cXMLHttpRequest.prototype.dispatchEvent=function(oEvent){var oEventPseudo={'type':oEvent.type,'target':this,'currentTarget':this,'eventPhase':2,'bubbles':oEvent.bubbles,'cancelable':oEvent.cancelable,'timeStamp':oEvent.timeStamp,'stopPropagation':function(){},'preventDefault':function(){},'initEvent':function(){}};if(oEventPseudo.type=="readystatechange"&&this.onreadystatechange) +(this.onreadystatechange.handleEvent||this.onreadystatechange).apply(this,[oEventPseudo]);for(var nIndex=0,oListener;oListener=this._listeners[nIndex];nIndex++) +if(oListener[0]==oEventPseudo.type&&!oListener[2]) +(oListener[1].handleEvent||oListener[1]).apply(this,[oEventPseudo]);};cXMLHttpRequest.prototype.toString=function(){return'['+"object"+' '+"XMLHttpRequest"+']';};cXMLHttpRequest.toString=function(){return'['+"XMLHttpRequest"+']';};function fReadyStateChange(oRequest){if(cXMLHttpRequest.onreadystatechange) +cXMLHttpRequest.onreadystatechange.apply(oRequest);oRequest.dispatchEvent({'type':"readystatechange",'bubbles':false,'cancelable':false,'timeStamp':new Date+0});};function fGetDocument(oRequest){var oDocument=oRequest.responseXML,sResponse=oRequest.responseText;if(bIE&&sResponse&&oDocument&&!oDocument.documentElement&&oRequest.getResponseHeader("Content-Type").match(/[^\/]+\/[^\+]+\+xml/)){oDocument=new window.ActiveXObject("Microsoft.XMLDOM");oDocument.async=false;oDocument.validateOnParse=false;oDocument.loadXML(sResponse);} +if(oDocument) +if((bIE&&oDocument.parseError!=0)||!oDocument.documentElement||(oDocument.documentElement&&oDocument.documentElement.tagName=="parsererror")) +return null;return oDocument;};function fSynchronizeValues(oRequest){try{oRequest.responseText=oRequest._object.responseText;}catch(e){} +try{oRequest.responseXML=fGetDocument(oRequest._object);}catch(e){} +try{oRequest.status=oRequest._object.status;}catch(e){} +try{oRequest.statusText=oRequest._object.statusText;}catch(e){}};function fCleanTransport(oRequest){oRequest._object.onreadystatechange=new window.Function;};if(!window.Function.prototype.apply){window.Function.prototype.apply=function(oRequest,oArguments){if(!oArguments) +oArguments=[];oRequest.__func=this;oRequest.__func(oArguments[0],oArguments[1],oArguments[2],oArguments[3],oArguments[4]);delete oRequest.__func;};};OpenLayers.Request.XMLHttpRequest=cXMLHttpRequest;})();OpenLayers.Control.DragPan=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,panned:false,interval:25,documentDrag:false,draw:function(){this.handler=new OpenLayers.Handler.Drag(this,{"move":this.panMap,"done":this.panMapDone},{interval:this.interval,documentDrag:this.documentDrag});},panMap:function(xy){this.panned=true;this.map.pan(this.handler.last.x-xy.x,this.handler.last.y-xy.y,{dragging:this.handler.dragging,animate:false});},panMapDone:function(xy){if(this.panned){this.panMap(xy);this.panned=false;}},CLASS_NAME:"OpenLayers.Control.DragPan"});OpenLayers.Control.KeyboardDefaults=OpenLayers.Class(OpenLayers.Control,{autoActivate:true,slideFactor:75,initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments);},destroy:function(){if(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});},defaultKeyPress:function(evt){switch(evt.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:var size=this.map.getSize();this.map.pan(0,-0.75*size.h);break;case 34:var size=this.map.getSize();this.map.pan(0,0.75*size.h);break;case 35:var size=this.map.getSize();this.map.pan(0.75*size.w,0);break;case 36:var size=this.map.getSize();this.map.pan(-0.75*size.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.State={UNKNOWN:'Unknown',INSERT:'Insert',UPDATE:'Update',DELETE:'Delete'};OpenLayers.Feature.Vector=OpenLayers.Class(OpenLayers.Feature,{fid:null,geometry:null,attributes:null,bounds:null,state:null,style:null,url:null,renderIntent:"default",initialize:function(geometry,attributes,style){OpenLayers.Feature.prototype.initialize.apply(this,[null,null,attributes]);this.lonlat=null;this.geometry=geometry?geometry:null;this.state=null;this.attributes={};if(attributes){this.attributes=OpenLayers.Util.extend(this.attributes,attributes);} +this.style=style?style:null;},destroy:function(){if(this.layer){this.layer.removeFeatures(this);this.layer=null;} +this.geometry=null;OpenLayers.Feature.prototype.destroy.apply(this,arguments);},clone:function(){return new OpenLayers.Feature.Vector(this.geometry?this.geometry.clone():null,this.attributes,this.style);},onScreen:function(boundsOnly){var onScreen=false;if(this.layer&&this.layer.map){var screenBounds=this.layer.map.getExtent();if(boundsOnly){var featureBounds=this.geometry.getBounds();onScreen=screenBounds.intersectsBounds(featureBounds);}else{var screenPoly=screenBounds.toGeometry();onScreen=screenPoly.intersects(this.geometry);}} +return onScreen;},getVisibility:function(){return!(this.style&&this.style.display=='none'||!this.layer||this.layer&&this.layer.styleMap&&this.layer.styleMap.createSymbolizer(this,this.renderIntent).display=='none'||this.layer&&!this.layer.getVisibility());},createMarker:function(){return null;},destroyMarker:function(){},createPopup:function(){return null;},atPoint:function(lonlat,toleranceLon,toleranceLat){var atPoint=false;if(this.geometry){atPoint=this.geometry.atPoint(lonlat,toleranceLon,toleranceLat);} +return atPoint;},destroyPopup:function(){},move:function(location){if(!this.layer||!this.geometry.move){return;} +var pixel;if(location.CLASS_NAME=="OpenLayers.LonLat"){pixel=this.layer.getViewPortPxFromLonLat(location);}else{pixel=location;} +var lastPixel=this.layer.getViewPortPxFromLonLat(this.geometry.getBounds().getCenterLonLat());var res=this.layer.map.getResolution();this.geometry.move(res*(pixel.x-lastPixel.x),res*(lastPixel.y-pixel.y));this.layer.drawFeature(this);return lastPixel;},toState:function(state){if(state==OpenLayers.State.UPDATE){switch(this.state){case OpenLayers.State.UNKNOWN:case OpenLayers.State.DELETE:this.state=state;break;case OpenLayers.State.UPDATE:case OpenLayers.State.INSERT:break;}}else if(state==OpenLayers.State.INSERT){switch(this.state){case OpenLayers.State.UNKNOWN:break;default:this.state=state;break;}}else if(state==OpenLayers.State.DELETE){switch(this.state){case OpenLayers.State.INSERT:break;case OpenLayers.State.DELETE:break;case OpenLayers.State.UNKNOWN:case OpenLayers.State.UPDATE:this.state=state;break;}}else if(state==OpenLayers.State.UNKNOWN){this.state=state;}},CLASS_NAME:"OpenLayers.Feature.Vector"});OpenLayers.Feature.Vector.style={'default':{fillColor:"#ee9900",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#ee9900",strokeOpacity:1,strokeWidth:1,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},'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.Handler.Box=OpenLayers.Class(OpenLayers.Handler,{dragHandler:null,boxDivClassName:'olHandlerBoxZoomBox',boxCharacteristics:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);var callbacks={"down":this.startBox,"move":this.moveBox,"out":this.removeBox,"up":this.endBox};this.dragHandler=new OpenLayers.Handler.Drag(this,callbacks,{keyMask:this.keyMask});},destroy:function(){if(this.dragHandler){this.dragHandler.destroy();this.dragHandler=null;} +OpenLayers.Handler.prototype.destroy.apply(this,arguments);},setMap:function(map){OpenLayers.Handler.prototype.setMap.apply(this,arguments);if(this.dragHandler){this.dragHandler.setMap(map);}},startBox:function(xy){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(xy){var startX=this.dragHandler.start.x;var startY=this.dragHandler.start.y;var deltaX=Math.abs(startX-xy.x);var deltaY=Math.abs(startY-xy.y);this.zoomBox.style.width=Math.max(1,deltaX)+"px";this.zoomBox.style.height=Math.max(1,deltaY)+"px";this.zoomBox.style.left=xy.xstartX){this.zoomBox.style.width=Math.max(1,deltaX-box.xOffset)+"px";} +if(xy.y>startY){this.zoomBox.style.height=Math.max(1,deltaY-box.yOffset)+"px";}}},endBox:function(end){var result;if(Math.abs(this.dragHandler.start.x-end.x)>5||Math.abs(this.dragHandler.start.y-end.y)>5){var start=this.dragHandler.start;var top=Math.min(start.y,end.y);var bottom=Math.max(start.y,end.y);var left=Math.min(start.x,end.x);var right=Math.max(start.x,end.x);result=new OpenLayers.Bounds(left,bottom,right,top);}else{result=this.dragHandler.start.clone();} +this.removeBox();this.callback("done",[result]);},removeBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox);this.zoomBox=null;this.boxCharacteristics=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 xOffset=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-left-width"))+parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-right-width"))+1;var yOffset=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-top-width"))+parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-bottom-width"))+1;var newBoxModel=OpenLayers.BROWSER_NAME=="msie"?document.compatMode!="BackCompat":true;this.boxCharacteristics={xOffset:xOffset,yOffset:yOffset,newBoxModel:newBoxModel};} +return this.boxCharacteristics;},CLASS_NAME:"OpenLayers.Handler.Box"});OpenLayers.Handler.RegularPolygon=OpenLayers.Class(OpenLayers.Handler.Drag,{sides:4,radius:null,snapAngle:null,snapToggle:'shiftKey',layerOptions:null,persist:false,irregular:false,angle:null,fixedRadius:false,feature:null,layer:null,origin:null,initialize:function(control,callbacks,options){if(!(options&&options.layerOptions&&options.layerOptions.styleMap)){this.style=OpenLayers.Util.extend(OpenLayers.Feature.Vector.style['default'],{});} +OpenLayers.Handler.prototype.initialize.apply(this,[control,callbacks,options]);this.options=(options)?options:{};},setOptions:function(newOptions){OpenLayers.Util.extend(this.options,newOptions);OpenLayers.Util.extend(this,newOptions);},activate:function(){var activated=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){var options=OpenLayers.Util.extend({displayInLayerSwitcher:false,calculateInRange:OpenLayers.Function.True},this.layerOptions);this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,options);this.map.addLayer(this.layer);activated=true;} +return activated;},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.Drag.prototype.deactivate.apply(this,arguments)){if(this.dragging){this.cancel();} +if(this.layer.map!=null){this.layer.destroy(false);if(this.feature){this.feature.destroy();}} +this.layer=null;this.feature=null;deactivated=true;} +return deactivated;},down:function(evt){this.fixedRadius=!!(this.radius);var maploc=this.map.getLonLatFromPixel(evt.xy);this.origin=new OpenLayers.Geometry.Point(maploc.lon,maploc.lat);if(!this.fixedRadius||this.irregular){this.radius=this.map.getResolution();} +if(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(evt){var maploc=this.map.getLonLatFromPixel(evt.xy);var point=new OpenLayers.Geometry.Point(maploc.lon,maploc.lat);if(this.irregular){var ry=Math.sqrt(2)*Math.abs(point.y-this.origin.y)/2;this.radius=Math.max(this.map.getResolution()/2,ry);}else if(this.fixedRadius){this.origin=point;}else{this.calculateAngle(point,evt);this.radius=Math.max(this.map.getResolution()/2,point.distanceTo(this.origin));} +this.modifyGeometry();if(this.irregular){var dx=point.x-this.origin.x;var dy=point.y-this.origin.y;var ratio;if(dy==0){ratio=dx/(this.radius*Math.sqrt(2));}else{ratio=dx/dy;} +this.feature.geometry.resize(1,this.origin,ratio);this.feature.geometry.move(dx/2,dy/2);} +this.layer.drawFeature(this.feature,this.style);},up:function(evt){this.finalize();if(this.start==this.last){this.callback("done",[evt.xy]);}},out:function(evt){this.finalize();},createGeometry:function(){this.angle=Math.PI*((1/this.sides)-(1/2));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 angle,point;var ring=this.feature.geometry.components[0];if(ring.components.length!=(this.sides+1)){this.createGeometry();ring=this.feature.geometry.components[0];} +for(var i=0;i0){pieces.push(',');} +geometry=collection[i].geometry;type=geometry.CLASS_NAME.split('.')[2].toLowerCase();if(!this.extract[type]){return null;} +if(this.internalProjection&&this.externalProjection){geometry=geometry.clone();geometry.transform(this.internalProjection,this.externalProjection);} +data=this.extract[type].apply(this,[geometry]);pieces.push(type.toUpperCase()+'('+data+')');} +if(isCollection){pieces.push(')');} +return pieces.join('');},extract:{'point':function(point){return point.x+' '+point.y;},'multipoint':function(multipoint){var array=[];for(var i=0,len=multipoint.components.length;i=bounds.bottom-tilelat*this.buffer)||rowidx=0)&&(testCell=0)){tile=this.grid[testRow][testCell];} +if((tile!=null)&&(!tile.queued)){tileQueue.unshift(tile);tile.queued=true;directionsTried=0;iRow=testRow;iCell=testCell;}else{direction=(direction+1)%4;directionsTried++;}} +for(var i=0,len=tileQueue.length;i-this.tileSize.w*(buffer-1)){this.shiftColumn(true);}else if(tlViewPort.x<-this.tileSize.w*buffer){this.shiftColumn(false);}else if(tlViewPort.y>-this.tileSize.h*(buffer-1)){this.shiftRow(true);}else if(tlViewPort.y<-this.tileSize.h*buffer){this.shiftRow(false);}else{break;}};},shiftRow:function(prepend){var modelRowIndex=(prepend)?0:(this.grid.length-1);var grid=this.grid;var modelRow=grid[modelRowIndex];var resolution=this.map.getResolution();var deltaY=(prepend)?-this.tileSize.h:this.tileSize.h;var deltaLat=resolution*-deltaY;var row=(prepend)?grid.pop():grid.shift();for(var i=0,len=modelRow.length;irows){var row=this.grid.pop();for(var i=0,l=row.length;icolumns){for(var i=0,l=this.grid.length;i0){appliedRules=true;for(var i=0,len=elseRules.length;i0&&appliedRules==false){style.display="none";} +return style;},applySymbolizer:function(rule,style,feature){var symbolizerPrefix=feature.geometry?this.getSymbolizerPrefix(feature.geometry):OpenLayers.Style.SYMBOLIZER_PREFIXES[0];var symbolizer=rule.symbolizer[symbolizerPrefix]||rule.symbolizer;if(this.defaultsPerSymbolizer===true){var defaults=this.defaultStyle;OpenLayers.Util.applyDefaults(symbolizer,{pointRadius:defaults.pointRadius});if(symbolizer.stroke===true||symbolizer.graphic===true){OpenLayers.Util.applyDefaults(symbolizer,{strokeWidth:defaults.strokeWidth,strokeColor:defaults.strokeColor,strokeOpacity:defaults.strokeOpacity,strokeDashstyle:defaults.strokeDashstyle,strokeLinecap:defaults.strokeLinecap});} +if(symbolizer.fill===true||symbolizer.graphic===true){OpenLayers.Util.applyDefaults(symbolizer,{fillColor:defaults.fillColor,fillOpacity:defaults.fillOpacity});} +if(symbolizer.graphic===true){OpenLayers.Util.applyDefaults(symbolizer,{pointRadius:this.defaultStyle.pointRadius,externalGraphic:this.defaultStyle.externalGraphic,graphicName:this.defaultStyle.graphicName,graphicOpacity:this.defaultStyle.graphicOpacity,graphicWidth:this.defaultStyle.graphicWidth,graphicHeight:this.defaultStyle.graphicHeight,graphicXOffset:this.defaultStyle.graphicXOffset,graphicYOffset:this.defaultStyle.graphicYOffset});}} +return this.createLiterals(OpenLayers.Util.extend(style,symbolizer),feature);},createLiterals:function(style,feature){var context=OpenLayers.Util.extend({},feature.attributes||feature.data);OpenLayers.Util.extend(context,this.context);for(var i in this.propertyStyles){style[i]=OpenLayers.Style.createLiteral(style[i],context,feature,i);} +return style;},findPropertyStyles:function(){var propertyStyles={};var style=this.defaultStyle;this.addPropertyStyles(propertyStyles,style);var rules=this.rules;var symbolizer,value;for(var i=0,len=rules.length;i=0&&along1<=1&&along2>=0&&along2<=1){if(!point){intersection=true;}else{var x=seg1.x1+(along1*x12_11);var y=seg1.y1+(along1*y12_11);intersection=new OpenLayers.Geometry.Point(x,y);}}} +if(tolerance){var dist;if(intersection){if(point){var segs=[seg1,seg2];var seg,x,y;outer:for(var i=0;i<2;++i){seg=segs[i];for(var j=1;j<3;++j){x=seg["x"+j];y=seg["y"+j];dist=Math.sqrt(Math.pow(x-intersection.x,2)+ +Math.pow(y-intersection.y,2));if(dist=1.0){x=x2;y=y2;}else{x=x1+along*dx;y=y1+along*dy;} +return{distance:Math.sqrt(Math.pow(x-x0,2)+Math.pow(y-y0,2)),x:x,y:y};};OpenLayers.Layer.TMS=OpenLayers.Class(OpenLayers.Layer.Grid,{serviceVersion:"1.0.0",isBaseLayer:true,tileOrigin:null,serverResolutions:null,zoomOffset:0,initialize:function(name,url,options){var newArguments=[];newArguments.push(name,url,{},options);OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.TMS(this.name,this.url,this.getOptions());} +obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj;},getURL:function(bounds){bounds=this.adjustBounds(bounds);var res=this.map.getResolution();var x=Math.round((bounds.left-this.tileOrigin.lon)/(res*this.tileSize.w));var y=Math.round((bounds.bottom-this.tileOrigin.lat)/(res*this.tileSize.h));var z=this.serverResolutions!=null?OpenLayers.Util.indexOf(this.serverResolutions,res):this.map.getZoom()+this.zoomOffset;var path=this.serviceVersion+"/"+this.layername+"/"+z+"/"+x+"/"+y+"."+this.type;var url=this.url;if(url instanceof Array){url=this.selectUrl(path,url);} +return url+path;},addTile:function(bounds,position){return new OpenLayers.Tile.Image(this,position,bounds,null,this.tileSize);},setMap:function(map){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments);if(!this.tileOrigin){this.tileOrigin=new OpenLayers.LonLat(this.map.maxExtent.left,this.map.maxExtent.bottom);}},CLASS_NAME:"OpenLayers.Layer.TMS"});OpenLayers.Layer.XYZ=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:true,sphericalMercator:false,zoomOffset:0,initialize:function(name,url,options){if(options&&options.sphericalMercator||this.sphericalMercator){options=OpenLayers.Util.extend({maxExtent:new OpenLayers.Bounds(-128*156543.0339,-128*156543.0339,128*156543.0339,128*156543.0339),maxResolution:156543.0339,numZoomLevels:19,units:"m",projection:"EPSG:900913"},options);} +url=url||this.url;name=name||this.name;var newArguments=[name,url,{},options];OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.XYZ(this.name,this.url,this.getOptions());} +obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj;},getURL:function(bounds){var res=this.map.getResolution();var x=Math.round((bounds.left-this.maxExtent.left)/(res*this.tileSize.w));var y=Math.round((this.maxExtent.top-bounds.top)/(res*this.tileSize.h));var z=this.map.getZoom()+this.zoomOffset;var url=this.url;var s=''+x+y+z;if(url instanceof Array) +{url=this.selectUrl(s,url);} +var path=OpenLayers.String.format(url,{'x':x,'y':y,'z':z});return path;},addTile:function(bounds,position){return new OpenLayers.Tile.Image(this,position,bounds,null,this.tileSize);},setMap:function(map){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments);if(!this.tileOrigin){this.tileOrigin=new OpenLayers.LonLat(this.maxExtent.left,this.maxExtent.bottom);}},CLASS_NAME:"OpenLayers.Layer.XYZ"});OpenLayers.Layer.OSM=OpenLayers.Class(OpenLayers.Layer.XYZ,{name:"OpenStreetMap",attribution:"Data CC-By-SA by OpenStreetMap",sphericalMercator:true,url:'http://tile.openstreetmap.org/${z}/${x}/${y}.png',clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.OSM(this.name,this.url,this.getOptions());} +obj=OpenLayers.Layer.XYZ.prototype.clone.apply(this,[obj]);return obj;},CLASS_NAME:"OpenLayers.Layer.OSM"});OpenLayers.Rule=OpenLayers.Class({id:null,name:null,title:null,description:null,context:null,filter:null,elseFilter:false,symbolizer:null,symbolizers:null,minScaleDenominator:null,maxScaleDenominator:null,initialize:function(options){this.symbolizer={};OpenLayers.Util.extend(this,options);if(this.symbolizers){delete this.symbolizer;} +this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");},destroy:function(){for(var i in this.symbolizer){this.symbolizer[i]=null;} +this.symbolizer=null;delete this.symbolizers;},evaluate:function(feature){var context=this.getContext(feature);var applies=true;if(this.minScaleDenominator||this.maxScaleDenominator){var scale=feature.layer.map.getScale();} +if(this.minScaleDenominator){applies=scale>=OpenLayers.Style.createLiteral(this.minScaleDenominator,context);} +if(applies&&this.maxScaleDenominator){applies=scalethis.value;break;case OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO:result=got<=this.value;break;case OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO:result=got>=this.value;break;case OpenLayers.Filter.Comparison.BETWEEN:result=(got>=this.lowerBoundary)&&(got<=this.upperBoundary);break;case OpenLayers.Filter.Comparison.LIKE:var regexp=new RegExp(this.value,"gi");result=regexp.test(got);break;} +return result;},value2regex:function(wildCard,singleChar,escapeChar){if(wildCard=="."){var msg="'.' is an unsupported wildCard character for "+"OpenLayers.Filter.Comparison";OpenLayers.Console.error(msg);return null;} +wildCard=wildCard?wildCard:"*";singleChar=singleChar?singleChar:".";escapeChar=escapeChar?escapeChar:"!";this.value=this.value.replace(new RegExp("\\"+escapeChar+"(.|$)","g"),"\\$1");this.value=this.value.replace(new RegExp("\\"+singleChar,"g"),".");this.value=this.value.replace(new RegExp("\\"+wildCard,"g"),".*");this.value=this.value.replace(new RegExp("\\\\.\\*","g"),"\\"+wildCard);this.value=this.value.replace(new RegExp("\\\\\\.","g"),"\\"+singleChar);return this.value;},regex2value:function(){var value=this.value;value=value.replace(/!/g,"!!");value=value.replace(/(\\)?\\\./g,function($0,$1){return $1?$0:"!.";});value=value.replace(/(\\)?\\\*/g,function($0,$1){return $1?$0:"!*";});value=value.replace(/\\\\/g,"\\");value=value.replace(/\.\*/g,"*");return value;},clone:function(){return OpenLayers.Util.extend(new OpenLayers.Filter.Comparison(),this);},CLASS_NAME:"OpenLayers.Filter.Comparison"});OpenLayers.Filter.Comparison.EQUAL_TO="==";OpenLayers.Filter.Comparison.NOT_EQUAL_TO="!=";OpenLayers.Filter.Comparison.LESS_THAN="<";OpenLayers.Filter.Comparison.GREATER_THAN=">";OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO="<=";OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO=">=";OpenLayers.Filter.Comparison.BETWEEN="..";OpenLayers.Filter.Comparison.LIKE="~";OpenLayers.Geometry.Collection=OpenLayers.Class(OpenLayers.Geometry,{components:null,componentTypes:null,initialize:function(components){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.components=[];if(components!=null){this.addComponents(components);}},destroy:function(){this.components.length=0;this.components=null;OpenLayers.Geometry.prototype.destroy.apply(this,arguments);},clone:function(){var geometry=eval("new "+this.CLASS_NAME+"()");for(var i=0,len=this.components.length;i0){this.setBounds(this.components[0].getBounds());for(var i=1,len=this.components.length;i-1)){if(index!=null&&(index=0;--i){this.removeComponent(components[i]);}},removeComponent:function(component){OpenLayers.Util.removeItem(this.components,component);this.clearBounds();},getLength:function(){var length=0.0;for(var i=0,len=this.components.length;i0)?area:minArea;centroids.push(centroid);} +len=areas.length;if(areaSum===0){for(var i=0;i=0;i--){if(i!=0&&features[i-1].geometry){this.renderer.locked=true;}else{this.renderer.locked=false;} +var feature=features[i];delete this.unrenderedFeatures[feature.id];if(notify){this.events.triggerEvent("beforefeatureremoved",{feature:feature});} +this.features=OpenLayers.Util.removeItem(this.features,feature);feature.layer=null;if(feature.geometry){this.renderer.eraseFeatures(feature);} +if(OpenLayers.Util.indexOf(this.selectedFeatures,feature)!=-1){OpenLayers.Util.removeItem(this.selectedFeatures,feature);} +if(notify){this.events.triggerEvent("featureremoved",{feature:feature});}} +if(notify){this.events.triggerEvent("featuresremoved",{features:features});}},removeAllFeatures:function(options){var notify=!options||!options.silent;var features=this.features;if(notify){this.events.triggerEvent("beforefeaturesremoved",{features:features});} +var feature;for(var i=features.length-1;i>=0;i--){feature=features[i];if(notify){this.events.triggerEvent("beforefeatureremoved",{feature:feature});} +feature.layer=null;if(notify){this.events.triggerEvent("featureremoved",{feature:feature});}} +this.renderer.clear();this.features=[];this.unrenderedFeatures={};this.selectedFeatures=[];if(notify){this.events.triggerEvent("featuresremoved",{features:features});}},destroyFeatures:function(features,options){var all=(features==undefined);if(all){features=this.features;} +if(features){this.removeFeatures(features,options);for(var i=features.length-1;i>=0;i--){features[i].destroy();}}},drawFeature:function(feature,style){if(!this.drawn){return} +if(typeof style!="object"){if(!style&&feature.state===OpenLayers.State.DELETE){style="delete";} +var renderIntent=style||feature.renderIntent;style=feature.style||this.style;if(!style){style=this.styleMap.createSymbolizer(feature,renderIntent);}} +if(!this.renderer.drawFeature(feature,style)){this.unrenderedFeatures[feature.id]=feature;}else{delete this.unrenderedFeatures[feature.id];};},eraseFeatures:function(features){this.renderer.eraseFeatures(features);},getFeatureFromEvent:function(evt){if(!this.renderer){OpenLayers.Console.error(OpenLayers.i18n("getFeatureError"));return null;} +var featureId=this.renderer.getFeatureIdFromEvent(evt);return this.getFeatureById(featureId);},getFeatureBy:function(property,value){var feature=null;for(var i=0,len=this.features.length;i0)){maxExtent=new OpenLayers.Bounds();var geometry=null;for(var i=0,len=features.length;i=0;--i){feature=layer.selectedFeatures[i];if(!options||options.except!=feature){this.unselect(feature);}}}},clickFeature:function(feature){if(!this.hover){var selected=(OpenLayers.Util.indexOf(feature.layer.selectedFeatures,feature)>-1);if(selected){if(this.toggleSelect()){this.unselect(feature);}else if(!this.multipleSelect()){this.unselectAll({except:feature});}}else{if(!this.multipleSelect()){this.unselectAll({except:feature});} +this.select(feature);}}},multipleSelect:function(){return this.multiple||(this.handlers.feature.evt&&this.handlers.feature.evt[this.multipleKey]);},toggleSelect:function(){return this.toggle||(this.handlers.feature.evt&&this.handlers.feature.evt[this.toggleKey]);},clickoutFeature:function(feature){if(!this.hover&&this.clickout){this.unselectAll();}},overFeature:function(feature){var layer=feature.layer;if(this.hover){if(this.highlightOnly){this.highlight(feature);}else if(OpenLayers.Util.indexOf(layer.selectedFeatures,feature)==-1){this.select(feature);}}},outFeature:function(feature){if(this.hover){if(this.highlightOnly){if(feature._lastHighlighter==this.id){if(feature._prevHighlighter&&feature._prevHighlighter!=this.id){delete feature._lastHighlighter;var control=this.map.getControl(feature._prevHighlighter);if(control){control.highlight(feature);}}else{this.unhighlight(feature);}}}else{this.unselect(feature);}}},highlight:function(feature){var layer=feature.layer;var cont=this.events.triggerEvent("beforefeaturehighlighted",{feature:feature});if(cont!==false){feature._prevHighlighter=feature._lastHighlighter;feature._lastHighlighter=this.id;var style=this.selectStyle||this.renderIntent;layer.drawFeature(feature,style);this.events.triggerEvent("featurehighlighted",{feature:feature});}},unhighlight:function(feature){var layer=feature.layer;feature._lastHighlighter=feature._prevHighlighter;delete feature._prevHighlighter;layer.drawFeature(feature,feature.style||feature.layer.style||"default");this.events.triggerEvent("featureunhighlighted",{feature:feature});},select:function(feature){var cont=this.onBeforeSelect.call(this.scope,feature);var layer=feature.layer;if(cont!==false){cont=layer.events.triggerEvent("beforefeatureselected",{feature:feature});if(cont!==false){layer.selectedFeatures.push(feature);this.highlight(feature);if(!this.handlers.feature.lastFeature){this.handlers.feature.lastFeature=layer.selectedFeatures[0];} +layer.events.triggerEvent("featureselected",{feature:feature});this.onSelect.call(this.scope,feature);}}},unselect:function(feature){var layer=feature.layer;this.unhighlight(feature);OpenLayers.Util.removeItem(layer.selectedFeatures,feature);layer.events.triggerEvent("featureunselected",{feature:feature});this.onUnselect.call(this.scope,feature);},selectBox:function(position){if(position instanceof OpenLayers.Bounds){var minXY=this.map.getLonLatFromPixel(new OpenLayers.Pixel(position.left,position.bottom));var maxXY=this.map.getLonLatFromPixel(new OpenLayers.Pixel(position.right,position.top));var bounds=new OpenLayers.Bounds(minXY.lon,minXY.lat,maxXY.lon,maxXY.lat);if(!this.multipleSelect()){this.unselectAll();} +var prevMultiple=this.multiple;this.multiple=true;var layers=this.layers||[this.layer];var layer;for(var l=0;l-1){if(bounds.toGeometry().intersects(feature.geometry)){if(OpenLayers.Util.indexOf(layer.selectedFeatures,feature)==-1){this.select(feature);}}}}} +this.multiple=prevMultiple;}},setMap:function(map){this.handlers.feature.setMap(map);if(this.box){this.handlers.box.setMap(map);} +OpenLayers.Control.prototype.setMap.apply(this,arguments);},setLayer:function(layers){var isActive=this.active;this.unselectAll();this.deactivate();if(this.layers){this.layer.destroy();this.layers=null;} +this.initLayer(layers);this.handlers.feature.layer=this.layer;if(isActive){this.activate();}},CLASS_NAME:"OpenLayers.Control.SelectFeature"});OpenLayers.Geometry.Curve=OpenLayers.Class(OpenLayers.Geometry.MultiPoint,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(points){OpenLayers.Geometry.MultiPoint.prototype.initialize.apply(this,arguments);},getLength:function(){var length=0.0;if(this.components&&(this.components.length>1)){for(var i=1,len=this.components.length;i1)){var p1,p2;for(var i=1,len=geom.components.length;i2)){OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);}},intersects:function(geometry){var intersect=false;var type=geometry.CLASS_NAME;if(type=="OpenLayers.Geometry.LineString"||type=="OpenLayers.Geometry.LinearRing"||type=="OpenLayers.Geometry.Point"){var segs1=this.getSortedSegments();var segs2;if(type=="OpenLayers.Geometry.Point"){segs2=[{x1:geometry.x,y1:geometry.y,x2:geometry.x,y2:geometry.y}];}else{segs2=geometry.getSortedSegments();} +var seg1,seg1x1,seg1x2,seg1y1,seg1y2,seg2,seg2y1,seg2y2;outer:for(var i=0,len=segs1.length;iseg1x2){break;} +if(seg2.x2Math.max(seg1y1,seg1y2)){continue;} +if(Math.max(seg2y1,seg2y2)0){var xDir=seg.x10){lines.unshift(j,1);Array.prototype.splice.apply(targetParts,lines);j+=lines.length-2;} +if(mutual){for(var k=0,len=splits.points.length;k0&&points.length>0){points.push(vert2.clone());sourceParts.push(new OpenLayers.Geometry.LineString(points));}}else{results=target.splitWith(this,options);} +if(targetParts&&targetParts.length>1){targetSplit=true;}else{targetParts=[];} +if(sourceParts&&sourceParts.length>1){sourceSplit=true;}else{sourceParts=[];} +if(targetSplit||sourceSplit){if(mutual){results=[sourceParts,targetParts];}else{results=targetParts;}} +return results;},splitWith:function(geometry,options){return geometry.split(this,options);},getVertices:function(nodes){var vertices;if(nodes===true){vertices=[this.components[0],this.components[this.components.length-1]];}else if(nodes===false){vertices=this.components.slice(1,this.components.length-1);}else{vertices=this.components.slice();} +return vertices;},distanceTo:function(geometry,options){var edge=!(options&&options.edge===false);var details=edge&&options&&options.details;var result,best={};var min=Number.POSITIVE_INFINITY;if(geometry instanceof OpenLayers.Geometry.Point){var segs=this.getSortedSegments();var x=geometry.x;var y=geometry.y;var seg;for(var i=0,len=segs.length;ix&&((y>seg.y1&&yseg.y2))){break;}}} +if(details){best={distance:best.distance,x0:best.x,y0:best.y,x1:x,y1:y};}else{best=best.distance;}}else if(geometry instanceof OpenLayers.Geometry.LineString){var segs0=this.getSortedSegments();var segs1=geometry.getSortedSegments();var seg0,seg1,intersection,x0,y0;var len1=segs1.length;var interOptions={point:true};outer:for(var i=0,len=segs0.length;i4){this.components.pop();OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);var firstPoint=this.components[0];OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[firstPoint]);}},move:function(x,y){for(var i=0,len=this.components.length;i2)){var sumX=0.0;var sumY=0.0;for(var i=0;i2)){var sum=0.0;for(var i=0,len=this.components.length;i2){var p1,p2;for(var i=0;i=x1&&px<=x2)||x1>=x2&&(px<=x1&&px>=x2)){crosses=-1;break;}} +continue;} +cx=approx(getX(py,x1,y1,x2,y2),digs);if(cx==px){if(y1=y1&&py<=y2)||y1>y2&&(py<=y1&&py>=y2)){crosses=-1;break;}} +if(cx<=px){continue;} +if(x1!=x2&&(cxMath.max(x1,x2))){continue;} +if(y1=y1&&pyy2&&(py=y2)){++crosses;}} +var contained=(crosses==-1)?1:!!(crosses&1);return contained;},intersects:function(geometry){var intersect=false;if(geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){intersect=this.containsPoint(geometry);}else if(geometry.CLASS_NAME=="OpenLayers.Geometry.LineString"){intersect=geometry.intersects(this);}else if(geometry.CLASS_NAME=="OpenLayers.Geometry.LinearRing"){intersect=OpenLayers.Geometry.LineString.prototype.intersects.apply(this,[geometry]);}else{for(var i=0,len=geometry.components.length;i1){sourceSplit=true;}else{sourceParts=[];} +if(targetParts&&targetParts.length>1){targetSplit=true;}else{targetParts=[];} +if(sourceSplit||targetSplit){if(mutual){results=[sourceParts,targetParts];}else{results=targetParts;}} +return results;},splitWith:function(geometry,options){var results=null;var mutual=options&&options.mutual;var splits,targetLine,sourceLines,sourceSplit,targetSplit,sourceParts,targetParts;if(geometry instanceof OpenLayers.Geometry.LineString){targetParts=[];sourceParts=[geometry];for(var i=0,len=this.components.length;i1){sourceSplit=true;}else{sourceParts=[];} +if(targetParts&&targetParts.length>1){targetSplit=true;}else{targetParts=[];} +if(sourceSplit||targetSplit){if(mutual){results=[sourceParts,targetParts];}else{results=targetParts;}} +return results;},CLASS_NAME:"OpenLayers.Geometry.MultiLineString"});OpenLayers.Geometry.Polygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LinearRing"],initialize:function(components){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments);},getArea:function(){var area=0.0;if(this.components&&(this.components.length>0)){area+=Math.abs(this.components[0].getArea());for(var i=1,len=this.components.length;i0)){area+=Math.abs(this.components[0].getGeodesicArea(projection));for(var i=1,len=this.components.length;i0){contained=this.components[0].containsPoint(point);if(contained!==1){if(contained&&numRings>1){var hole;for(var i=1;i=this.maxDepth){return false;} +var newOptions=OpenLayers.Util.extend({},options);newOptions.depth++;for(var i=0,len=nodes.length;i0){var track=tracks[0];var container={features:[],feature:feature};this.readNode(track,container);if(container.features.length>0){features.push.apply(features,container.features);}}}else{features.push(feature);}}else{throw"Bad Placemark: "+i;}} +this.features=this.features.concat(features);},readers:{"kml":{"when":function(node,container){container.whens.push(OpenLayers.Date.parse(this.getChildValue(node)));},"_trackPointAttribute":function(node,container){var name=node.nodeName.split(":").pop();container.attributes[name].push(this.getChildValue(node));}},"gx":{"Track":function(node,container){var obj={whens:[],points:[],angles:[]};if(this.trackAttributes){var name;obj.attributes={};for(var i=0,ii=this.trackAttributes.length;i0;if(hasAngles&&obj.whens.length!==obj.angles.length){throw new Error("gx:Track with unequal number of when ("+obj.whens.length+") and gx:angles ("+obj.angles.length+") elements.");} +var feature,point,angles;for(var i=0,ii=obj.whens.length;i2){point.z=parseFloat(coords[2]);} +container.points.push(point);},"angles":function(node,container){var str=this.getChildValue(node);var parts=str.replace(this.regExes.trimSpace,"").split(/\s+/);container.angles.push(parts);}}},parseFeature:function(node){var order=["MultiGeometry","Polygon","LineString","Point"];var type,nodeList,geometry,parser;for(var i=0,len=order.length;i0){var parser=this.parseGeometry[type.toLowerCase()];if(parser){geometry=parser.apply(this,[nodeList[0]]);if(this.internalProjection&&this.externalProjection){geometry.transform(this.externalProjection,this.internalProjection);}}else{OpenLayers.Console.error(OpenLayers.i18n("unsupportedGeometryType",{'geomType':type}));} +break;}} +var attributes;if(this.extractAttributes){attributes=this.parseAttributes(node);} +var feature=new OpenLayers.Feature.Vector(geometry,attributes);var fid=node.getAttribute("id")||node.getAttribute("name");if(fid!=null){feature.fid=fid;} +return feature;},getStyle:function(styleUrl,options){var styleBaseUrl=OpenLayers.Util.removeTail(styleUrl);var newOptions=OpenLayers.Util.extend({},options);newOptions.depth++;newOptions.styleBaseUrl=styleBaseUrl;if(!this.styles[styleUrl]&&!OpenLayers.String.startsWith(styleUrl,"#")&&newOptions.depth<=this.maxDepth&&!this.fetched[styleBaseUrl]){var data=this.fetchLink(styleBaseUrl);if(data){this.parseData(data,newOptions);}} +var style=OpenLayers.Util.extend({},this.styles[styleUrl]);return style;},parseGeometry:{point:function(node){var nodeList=this.getElementsByTagNameNS(node,this.internalns,"coordinates");var coords=[];if(nodeList.length>0){var coordString=nodeList[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.removeSpace,"");coords=coordString.split(",");} +var point=null;if(coords.length>1){if(coords.length==2){coords[2]=null;} +point=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);}else{throw"Bad coordinate string: "+coordString;} +return point;},linestring:function(node,ring){var nodeList=this.getElementsByTagNameNS(node,this.internalns,"coordinates");var line=null;if(nodeList.length>0){var coordString=this.getChildValue(nodeList[0]);coordString=coordString.replace(this.regExes.trimSpace,"");coordString=coordString.replace(this.regExes.trimComma,",");var pointList=coordString.split(this.regExes.splitSpace);var numPoints=pointList.length;var points=new Array(numPoints);var coords,numCoords;for(var i=0;i1){if(coords.length==2){coords[2]=null;} +points[i]=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);}else{throw"Bad LineString point coordinates: "+ +pointList[i];}} +if(numPoints){if(ring){line=new OpenLayers.Geometry.LinearRing(points);}else{line=new OpenLayers.Geometry.LineString(points);}}else{throw"Bad LineString coordinates: "+coordString;}} +return line;},polygon:function(node){var nodeList=this.getElementsByTagNameNS(node,this.internalns,"LinearRing");var numRings=nodeList.length;var components=new Array(numRings);if(numRings>0){var ring;for(var i=0,len=nodeList.length;i=1&&grandchildren.length<=3){var grandchild;switch(grandchildren.length){case 1:grandchild=grandchildren[0];break;case 2:var c1=grandchildren[0];var c2=grandchildren[1];grandchild=(c1.nodeType==3||c1.nodeType==4)?c1:c2;break;case 3:default:grandchild=grandchildren[1];break;} +if(grandchild.nodeType==3||grandchild.nodeType==4){var name=(child.prefix)?child.nodeName.split(":")[1]:child.nodeName;var value=OpenLayers.Util.getXmlNodeValue(grandchild);if(value){value=value.replace(this.regExes.trimSpace,"");attributes[name]=value;}}}}} +return attributes;},parseExtendedData:function(node){var attributes={};var i,len,data,key;var dataNodes=node.getElementsByTagName("Data");for(i=0,len=dataNodes.length;i size; tile = tile.prev) { + if (!tile) break; + if (tile.lock) continue; + remove(tile); + } + } + + cache.peek = function(c) { + return map[[c.zoom, c.column, c.row].join("/")]; + }; + + cache.load = function(c, projection) { + var key = [c.zoom, c.column, c.row].join("/"), + tile = map[key]; + if (tile) { + if (tile.prev) { + tile.prev.next = tile.next; + if (tile.next) tile.next.prev = tile.prev; + else tail = tile.prev; + tile.prev = null; + tile.next = head; + head.prev = tile; + head = tile; + } + tile.lock = 1; + locks[key] = tile; + return tile; + } + tile = { + key: key, + column: c.column, + row: c.row, + zoom: c.zoom, + next: head, + prev: null, + lock: 1 + }; + load.call(null, tile, projection); + locks[key] = map[key] = tile; + if (head) head.prev = tile; + else tail = tile; + head = tile; + n++; + return tile; + }; + + cache.unload = function(key) { + if (!(key in locks)) return false; + var tile = locks[key]; + tile.lock = 0; + delete locks[key]; + if (tile.request && tile.request.abort(false)) remove(tile); + return tile; + }; + + cache.locks = function() { + return locks; + }; + + cache.size = function(x) { + if (!arguments.length) return size; + size = x; + flush(); + return cache; + }; + + cache.flush = function() { + flush(); + return cache; + }; + + cache.clear = function() { + for (var key in map) { + var tile = map[key]; + if (tile.request) tile.request.abort(false); + if (unload) unload(map[key]); + if (tile.lock) { + tile.lock = 0; + tile.element.parentNode.removeChild(tile.element); + } + } + locks = {}; + map = {}; + head = tail = null; + n = 0; + return cache; + }; + + return cache; +}; +po.url = function(template) { + var hosts = []; + + function format(c) { + var max = c.zoom < 0 ? 1 : 1 << c.zoom, + column = c.column % max; + if (column < 0) column += max; + return template.replace(/{(.)}/g, function(s, v) { + switch (v) { + case "S": return hosts[(Math.abs(c.zoom) + c.row + column) % hosts.length]; + case "Z": return c.zoom; + case "X": return column; + case "Y": return c.row; + case "B": { + var nw = po.map.coordinateLocation({row: c.row, column: column, zoom: c.zoom}), + se = po.map.coordinateLocation({row: c.row + 1, column: column + 1, zoom: c.zoom}), + pn = Math.ceil(Math.log(c.zoom) / Math.LN2); + return se.lat.toFixed(pn) + + "," + nw.lon.toFixed(pn) + + "," + nw.lat.toFixed(pn) + + "," + se.lon.toFixed(pn); + } + } + return v; + }); + } + + format.template = function(x) { + if (!arguments.length) return template; + template = x; + return format; + }; + + format.hosts = function(x) { + if (!arguments.length) return hosts; + hosts = x; + return format; + }; + + return format; +}; +po.dispatch = function(that) { + var types = {}; + + that.on = function(type, handler) { + var listeners = types[type] || (types[type] = []); + for (var i = 0; i < listeners.length; i++) { + if (listeners[i].handler == handler) return that; // already registered + } + listeners.push({handler: handler, on: true}); + return that; + }; + + that.off = function(type, handler) { + var listeners = types[type]; + if (listeners) for (var i = 0; i < listeners.length; i++) { + var l = listeners[i]; + if (l.handler == handler) { + l.on = false; + listeners.splice(i, 1); + break; + } + } + return that; + }; + + return function(event) { + var listeners = types[event.type]; + if (!listeners) return; + listeners = listeners.slice(); // defensive copy + for (var i = 0; i < listeners.length; i++) { + var l = listeners[i]; + if (l.on) l.handler.call(that, event); + } + }; +}; +po.queue = (function() { + var queued = [], active = 0, size = 6; + + function process() { + if ((active >= size) || !queued.length) return; + active++; + queued.pop()(); + } + + function dequeue(send) { + for (var i = 0; i < queued.length; i++) { + if (queued[i] == send) { + queued.splice(i, 1); + return true; + } + } + return false; + } + + function request(url, callback, mimeType) { + var req; + + function send() { + req = new XMLHttpRequest(); + if (mimeType) { + req.overrideMimeType(mimeType); + } + req.open("GET", url, true); + req.onreadystatechange = function(e) { + if (req.readyState == 4) { + active--; + if (req.status < 300) callback(req); + process(); + } + }; + req.send(null); + } + + function abort(hard) { + if (dequeue(send)) return true; + if (hard && req) { req.abort(); return true; } + return false; + } + + queued.push(send); + process(); + return {abort: abort}; + } + + function text(url, callback, mimeType) { + return request(url, function(req) { + if (req.responseText) callback(req.responseText); + }, mimeType); + } + + /* + * We the override MIME type here so that you can load local files; some + * browsers don't assign a proper MIME type for local files. + */ + + function json(url, callback) { + return request(url, function(req) { + if (req.responseText) callback(JSON.parse(req.responseText)); + }, "application/json"); + } + + function xml(url, callback) { + return request(url, function(req) { + if (req.responseXML) callback(req.responseXML); + }, "application/xml"); + } + + function image(image, src, callback) { + var img; + + function send() { + img = document.createElement("img"); + img.onerror = function() { + active--; + process(); + }; + img.onload = function() { + active--; + callback(img); + process(); + }; + img.src = src; + image.setAttributeNS(po.ns.xlink, "href", src); + } + + function abort(hard) { + if (dequeue(send)) return true; + if (hard && img) { img.src = "about:"; return true; } // cancels request + return false; + } + + queued.push(send); + process(); + return {abort: abort}; + } + + return {text: text, xml: xml, json: json, image: image}; +})(); +po.map = function() { + var map = {}, + container, + size, + sizeActual = zero, + sizeRadius = zero, // sizeActual / 2 + tileSize = {x: 256, y: 256}, + center = {lat: 37.76487, lon: -122.41948}, + zoom = 12, + zoomFraction = 0, + zoomFactor = 1, // Math.pow(2, zoomFraction) + zoomRange = [1, 18], + angle = 0, + angleCos = 1, // Math.cos(angle) + angleSin = 0, // Math.sin(angle) + angleCosi = 1, // Math.cos(-angle) + angleSini = 0, // Math.sin(-angle) + ymin = -180, // lat2y(centerRange[0].lat) + ymax = 180; // lat2y(centerRange[1].lat) + + var centerRange = [ + {lat: y2lat(ymin), lon: -Infinity}, + {lat: y2lat(ymax), lon: Infinity} + ]; + + map.locationCoordinate = function(l) { + var c = po.map.locationCoordinate(l), + k = Math.pow(2, zoom); + c.column *= k; + c.row *= k; + c.zoom += zoom; + return c; + }; + + map.coordinateLocation = po.map.coordinateLocation; + + map.coordinatePoint = function(tileCenter, c) { + var kc = Math.pow(2, zoom - c.zoom), + kt = Math.pow(2, zoom - tileCenter.zoom), + dx = (c.column * kc - tileCenter.column * kt) * tileSize.x * zoomFactor, + dy = (c.row * kc - tileCenter.row * kt) * tileSize.y * zoomFactor; + return { + x: sizeRadius.x + angleCos * dx - angleSin * dy, + y: sizeRadius.y + angleSin * dx + angleCos * dy + }; + }; + + map.pointCoordinate = function(tileCenter, p) { + var kt = Math.pow(2, zoom - tileCenter.zoom), + dx = (p.x - sizeRadius.x) / zoomFactor, + dy = (p.y - sizeRadius.y) / zoomFactor; + return { + column: tileCenter.column * kt + (angleCosi * dx - angleSini * dy) / tileSize.x, + row: tileCenter.row * kt + (angleSini * dx + angleCosi * dy) / tileSize.y, + zoom: zoom + }; + }; + + map.locationPoint = function(l) { + var k = Math.pow(2, zoom + zoomFraction - 3) / 45, + dx = (l.lon - center.lon) * k * tileSize.x, + dy = (lat2y(center.lat) - lat2y(l.lat)) * k * tileSize.y; + return { + x: sizeRadius.x + angleCos * dx - angleSin * dy, + y: sizeRadius.y + angleSin * dx + angleCos * dy + }; + }; + + map.pointLocation = function(p) { + var k = 45 / Math.pow(2, zoom + zoomFraction - 3), + dx = (p.x - sizeRadius.x) * k, + dy = (p.y - sizeRadius.y) * k; + return { + lon: center.lon + (angleCosi * dx - angleSini * dy) / tileSize.x, + lat: y2lat(lat2y(center.lat) - (angleSini * dx + angleCosi * dy) / tileSize.y) + }; + }; + + function rezoom() { + if (zoomRange) { + if (zoom < zoomRange[0]) zoom = zoomRange[0]; + else if (zoom > zoomRange[1]) zoom = zoomRange[1]; + } + zoomFraction = zoom - (zoom = Math.round(zoom)); + zoomFactor = Math.pow(2, zoomFraction); + } + + function recenter() { + if (!centerRange) return; + var k = 45 / Math.pow(2, zoom + zoomFraction - 3); + + // constrain latitude + var y = Math.max(Math.abs(angleSin * sizeRadius.x + angleCos * sizeRadius.y), + Math.abs(angleSini * sizeRadius.x + angleCosi * sizeRadius.y)), + lat0 = y2lat(ymin - y * k / tileSize.y), + lat1 = y2lat(ymax + y * k / tileSize.y); + center.lat = Math.max(lat0, Math.min(lat1, center.lat)); + + // constrain longitude + var x = Math.max(Math.abs(angleSin * sizeRadius.y + angleCos * sizeRadius.x), + Math.abs(angleSini * sizeRadius.y + angleCosi * sizeRadius.x)), + lon0 = centerRange[0].lon - x * k / tileSize.x, + lon1 = centerRange[1].lon + x * k / tileSize.x; + center.lon = Math.max(lon0, Math.min(lon1, center.lon)); + } + + // a place to capture mouse events if no tiles exist + var rect = po.svg("rect"); + rect.setAttribute("visibility", "hidden"); + rect.setAttribute("pointer-events", "all"); + + map.container = function(x) { + if (!arguments.length) return container; + container = x; + container.setAttribute("class", "map"); + container.appendChild(rect); + return map.resize(); // infer size + }; + + map.focusableParent = function() { + for (var p = container; p; p = p.parentNode) { + if (p.tabIndex >= 0) return p; + } + return window; + }; + + map.mouse = function(e) { + var point = (container.ownerSVGElement || container).createSVGPoint(); + if ((bug44083 < 0) && (window.scrollX || window.scrollY)) { + var svg = document.body.appendChild(po.svg("svg")); + svg.style.position = "absolute"; + svg.style.top = svg.style.left = "0px"; + var ctm = svg.getScreenCTM(); + bug44083 = !(ctm.f || ctm.e); + document.body.removeChild(svg); + } + if (bug44083) { + point.x = e.pageX; + point.y = e.pageY; + } else { + point.x = e.clientX; + point.y = e.clientY; + } + return point.matrixTransform(container.getScreenCTM().inverse()); + }; + + map.size = function(x) { + if (!arguments.length) return sizeActual; + size = x; + return map.resize(); // size tiles + }; + + map.resize = function() { + if (!size) { + rect.setAttribute("width", "100%"); + rect.setAttribute("height", "100%"); + b = rect.getBBox(); + sizeActual = {x: b.width, y: b.height}; + resizer.add(map); + } else { + sizeActual = size; + resizer.remove(map); + } + rect.setAttribute("width", sizeActual.x); + rect.setAttribute("height", sizeActual.y); + sizeRadius = {x: sizeActual.x / 2, y: sizeActual.y / 2}; + recenter(); + map.dispatch({type: "resize"}); + return map; + }; + + map.tileSize = function(x) { + if (!arguments.length) return tileSize; + tileSize = x; + map.dispatch({type: "move"}); + return map; + }; + + map.center = function(x) { + if (!arguments.length) return center; + center = x; + recenter(); + map.dispatch({type: "move"}); + return map; + }; + + map.panBy = function(x) { + var k = 45 / Math.pow(2, zoom + zoomFraction - 3), + dx = x.x * k, + dy = x.y * k; + return map.center({ + lon: center.lon + (angleSini * dy - angleCosi * dx) / tileSize.x, + lat: y2lat(lat2y(center.lat) + (angleSini * dx + angleCosi * dy) / tileSize.y) + }); + }; + + map.centerRange = function(x) { + if (!arguments.length) return centerRange; + centerRange = x; + if (centerRange) { + ymin = centerRange[0].lat > -90 ? lat2y(centerRange[0].lat) : -Infinity; + ymax = centerRange[0].lat < 90 ? lat2y(centerRange[1].lat) : Infinity; + } else { + ymin = -Infinity; + ymax = Infinity; + } + recenter(); + map.dispatch({type: "move"}); + return map; + }; + + map.zoom = function(x) { + if (!arguments.length) return zoom + zoomFraction; + zoom = x; + rezoom(); + return map.center(center); + }; + + map.zoomBy = function(z, x0, l) { + if (arguments.length < 2) return map.zoom(zoom + zoomFraction + z); + + // compute the location of x0 + if (arguments.length < 3) l = map.pointLocation(x0); + + // update the zoom level + zoom = zoom + zoomFraction + z; + rezoom(); + + // compute the new point of the location + var x1 = map.locationPoint(l); + + return map.panBy({x: x0.x - x1.x, y: x0.y - x1.y}); + }; + + map.zoomRange = function(x) { + if (!arguments.length) return zoomRange; + zoomRange = x; + return map.zoom(zoom + zoomFraction); + }; + + map.extent = function(x) { + if (!arguments.length) return [ + map.pointLocation({x: 0, y: sizeActual.y}), + map.pointLocation({x: sizeActual.x, y: 0}) + ]; + + // compute the extent in points, scale factor, and center + var bl = map.locationPoint(x[0]), + tr = map.locationPoint(x[1]), + k = Math.max((tr.x - bl.x) / sizeActual.x, (bl.y - tr.y) / sizeActual.y), + l = map.pointLocation({x: (bl.x + tr.x) / 2, y: (bl.y + tr.y) / 2}); + + // update the zoom level + zoom = zoom + zoomFraction - Math.log(k) / Math.log(2); + rezoom(); + + // set the new center + return map.center(l); + }; + + map.angle = function(x) { + if (!arguments.length) return angle; + angle = x; + angleCos = Math.cos(angle); + angleSin = Math.sin(angle); + angleCosi = Math.cos(-angle); + angleSini = Math.sin(-angle); + recenter(); + map.dispatch({type: "move"}); + return map; + }; + + map.add = function(x) { + x.map(map); + return map; + }; + + map.remove = function(x) { + x.map(null); + return map; + }; + + map.dispatch = po.dispatch(map); + + return map; +}; + +function resizer(e) { + for (var i = 0; i < resizer.maps.length; i++) { + resizer.maps[i].resize(); + } +} + +resizer.maps = []; + +resizer.add = function(map) { + for (var i = 0; i < resizer.maps.length; i++) { + if (resizer.maps[i] == map) return; + } + resizer.maps.push(map); +}; + +resizer.remove = function(map) { + for (var i = 0; i < resizer.maps.length; i++) { + if (resizer.maps[i] == map) { + resizer.maps.splice(i, 1); + return; + } + } +}; + +// Note: assumes single window (no frames, iframes, etc.)! +window.addEventListener("resize", resizer, false); + +// See http://wiki.openstreetmap.org/wiki/Mercator + +function y2lat(y) { + return 360 / Math.PI * Math.atan(Math.exp(y * Math.PI / 180)) - 90; +} + +function lat2y(lat) { + return 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + lat * Math.PI / 360)); +} + +po.map.locationCoordinate = function(l) { + var k = 1 / 360; + return { + column: (l.lon + 180) * k, + row: (180 - lat2y(l.lat)) * k, + zoom: 0 + }; +}; + +po.map.coordinateLocation = function(c) { + var k = 45 / Math.pow(2, c.zoom - 3); + return { + lon: k * c.column - 180, + lat: y2lat(180 - k * c.row) + }; +}; + +// https://bugs.webkit.org/show_bug.cgi?id=44083 +var bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0; +po.layer = function(load, unload) { + var layer = {}, + cache = layer.cache = po.cache(load, unload).size(512), + tile = true, + visible = true, + zoom, + id, + map, + container = po.svg("g"), + transform, + levelZoom, + levels = {}; + + container.setAttribute("class", "layer"); + for (var i = -4; i <= -1; i++) levels[i] = container.appendChild(po.svg("g")); + for (var i = 2; i >= 1; i--) levels[i] = container.appendChild(po.svg("g")); + levels[0] = container.appendChild(po.svg("g")); + + function zoomIn(z) { + var end = levels[0].nextSibling; + for (; levelZoom < z; levelZoom++) { + // -4, -3, -2, -1, +2, +1, =0 // current order + // -3, -2, -1, +2, +1, =0, -4 // insertBefore(-4, end) + // -3, -2, -1, +1, =0, -4, +2 // insertBefore(+2, end) + // -3, -2, -1, =0, -4, +2, +1 // insertBefore(+1, end) + // -4, -3, -2, -1, +2, +1, =0 // relabel + container.insertBefore(levels[-4], end); + container.insertBefore(levels[2], end); + container.insertBefore(levels[1], end); + var t = levels[-4]; + for (var dz = -4; dz < 2;) levels[dz] = levels[++dz]; + levels[dz] = t; + } + } + + function zoomOut(z) { + var end = levels[0].nextSibling; + for (; levelZoom > z; levelZoom--) { + // -4, -3, -2, -1, +2, +1, =0 // current order + // -4, -3, -2, +2, +1, =0, -1 // insertBefore(-1, end) + // +2, -4, -3, -2, +1, =0, -1 // insertBefore(+2, -4) + // -4, -3, -2, -1, +2, +1, =0 // relabel + container.insertBefore(levels[-1], end); + container.insertBefore(levels[2], levels[-4]); + var t = levels[2]; + for (var dz = 2; dz > -4;) levels[dz] = levels[--dz]; + levels[dz] = t; + } + } + + function move() { + var map = layer.map(), // in case the layer is removed + mapZoom = map.zoom(), + mapZoomFraction = mapZoom - (mapZoom = Math.round(mapZoom)), + mapSize = map.size(), + mapAngle = map.angle(), + tileSize = map.tileSize(), + tileCenter = map.locationCoordinate(map.center()); + + // set the layer zoom levels + if (levelZoom != mapZoom) { + if (levelZoom < mapZoom) zoomIn(mapZoom); + else if (levelZoom > mapZoom) zoomOut(mapZoom); + else levelZoom = mapZoom; + for (var z = -4; z <= 2; z++) { + var l = levels[z]; + l.setAttribute("class", "zoom" + (z < 0 ? "" : "+") + z + " zoom" + (mapZoom + z)); + l.setAttribute("transform", "scale(" + Math.pow(2, -z) + ")"); + } + } + + // set the layer transform + container.setAttribute("transform", + "translate(" + (mapSize.x / 2) + "," + (mapSize.y / 2) + ")" + + (mapAngle ? "rotate(" + mapAngle / Math.PI * 180 + ")" : "") + + (mapZoomFraction ? "scale(" + Math.pow(2, mapZoomFraction) + ")" : "") + + (transform ? transform.zoomFraction(mapZoomFraction) : "")); + + // get the coordinates of the four corners + var c0 = map.pointCoordinate(tileCenter, zero), + c1 = map.pointCoordinate(tileCenter, {x: mapSize.x, y: 0}), + c2 = map.pointCoordinate(tileCenter, mapSize), + c3 = map.pointCoordinate(tileCenter, {x: 0, y: mapSize.y}); + + // round to pixel boundary to avoid anti-aliasing artifacts + if (!mapZoomFraction && !mapAngle && !transform) { + tileCenter.column = (Math.round(tileSize.x * tileCenter.column) + (mapSize.x & 1) / 2) / tileSize.x; + tileCenter.row = (Math.round(tileSize.y * tileCenter.row) + (mapSize.y & 1) / 2) / tileSize.y; + } + + // layer-specific coordinate transform + if (transform) { + c0 = transform.unapply(c0); + c1 = transform.unapply(c1); + c2 = transform.unapply(c2); + c3 = transform.unapply(c3); + tileCenter = transform.unapply(tileCenter); + } + + // layer-specific zoom transform + var tileLevel = zoom ? zoom(c0.zoom) - c0.zoom : 0; + if (tileLevel) { + var k = Math.pow(2, tileLevel); + c0.column *= k; c0.row *= k; + c1.column *= k; c1.row *= k; + c2.column *= k; c2.row *= k; + c3.column *= k; c3.row *= k; + c0.zoom = c1.zoom = c2.zoom = c3.zoom += tileLevel; + } + + // tile-specific projection + function projection(c) { + var zoom = c.zoom, + max = zoom < 0 ? 1 : 1 << zoom, + column = c.column % max, + row = c.row; + if (column < 0) column += max; + return { + locationPoint: function(l) { + var c = po.map.locationCoordinate(l), + k = Math.pow(2, zoom - c.zoom); + return { + x: tileSize.x * (k * c.column - column), + y: tileSize.y * (k * c.row - row) + }; + } + }; + } + + // record which tiles are visible + var oldLocks = cache.locks(), newLocks = {}; + + // reset the proxy counts + for (var key in oldLocks) { + oldLocks[key].proxyCount = 0; + } + + // load the tiles! + if (visible && tileLevel > -5 && tileLevel < 3) { + var ymax = c0.zoom < 0 ? 1 : 1 << c0.zoom; + if (tile) { + scanTriangle(c0, c1, c2, 0, ymax, scanLine); + scanTriangle(c2, c3, c0, 0, ymax, scanLine); + } else { + var x = Math.floor((c0.column + c2.column) / 2), + y = Math.max(0, Math.min(ymax - 1, Math.floor((c1.row + c3.row) / 2))), + z = Math.min(4, c0.zoom); + x = x >> z << z; + y = y >> z << z; + scanLine(x, x + 1, y); + } + } + + // scan-line conversion + function scanLine(x0, x1, y) { + var z = c0.zoom, + z0 = 2 - tileLevel, + z1 = 4 + tileLevel; + + for (var x = x0; x < x1; x++) { + var t = cache.load({column: x, row: y, zoom: z}, projection); + if (!t.ready && !(t.key in newLocks)) { + t.proxyRefs = {}; + var c, full, proxy; + + // downsample high-resolution tiles + for (var dz = 1; dz <= z0; dz++) { + full = true; + for (var dy = 0, k = 1 << dz; dy <= k; dy++) { + for (var dx = 0; dx <= k; dx++) { + proxy = cache.peek(c = { + column: (x << dz) + dx, + row: (y << dz) + dy, + zoom: z + dz + }); + if (proxy && proxy.ready) { + newLocks[proxy.key] = cache.load(c); + proxy.proxyCount++; + t.proxyRefs[proxy.key] = proxy; + } else { + full = false; + } + } + } + if (full) break; + } + + // upsample low-resolution tiles + if (!full) { + for (var dz = 1; dz <= z1; dz++) { + proxy = cache.peek(c = { + column: x >> dz, + row: y >> dz, + zoom: z - dz + }); + if (proxy && proxy.ready) { + newLocks[proxy.key] = cache.load(c); + proxy.proxyCount++; + t.proxyRefs[proxy.key] = proxy; + break; + } + } + } + } + newLocks[t.key] = t; + } + } + + // position tiles + for (var key in newLocks) { + var t = newLocks[key], + k = Math.pow(2, t.level = t.zoom - tileCenter.zoom); + t.element.setAttribute("transform", "translate(" + + (t.x = tileSize.x * (t.column - tileCenter.column * k)) + "," + + (t.y = tileSize.y * (t.row - tileCenter.row * k)) + ")"); + } + + // remove tiles that are no longer visible + for (var key in oldLocks) { + if (!(key in newLocks)) { + var t = cache.unload(key); + t.element.parentNode.removeChild(t.element); + delete t.proxyRefs; + } + } + + // append tiles that are now visible + for (var key in newLocks) { + var t = newLocks[key]; + if (t.element.parentNode != levels[t.level]) { + levels[t.level].appendChild(t.element); + if (layer.show) layer.show(t); + } + } + + // flush the cache, clearing no-longer-needed tiles + cache.flush(); + + // dispatch the move event + layer.dispatch({type: "move"}); + } + + // remove proxy tiles when tiles load + function cleanup(e) { + if (e.tile.proxyRefs) { + for (var proxyKey in e.tile.proxyRefs) { + var proxyTile = e.tile.proxyRefs[proxyKey]; + if ((--proxyTile.proxyCount <= 0) && cache.unload(proxyKey)) { + proxyTile.element.parentNode.removeChild(proxyTile.element); + } + } + delete e.tile.proxyRefs; + } + } + + layer.map = function(x) { + if (!arguments.length) return map; + if (map) { + if (map == x) { + container.parentNode.appendChild(container); // move to end + return layer; + } + map.off("move", move).off("resize", move); + container.parentNode.removeChild(container); + } + map = x; + if (map) { + map.container().appendChild(container); + if (layer.init) layer.init(container); + map.on("move", move).on("resize", move); + move(); + } + return layer; + }; + + layer.container = function() { + return container; + }; + + layer.levels = function() { + return levels; + }; + + layer.id = function(x) { + if (!arguments.length) return id; + id = x; + container.setAttribute("id", x); + return layer; + }; + + layer.visible = function(x) { + if (!arguments.length) return visible; + if (visible = x) container.removeAttribute("visibility") + else container.setAttribute("visibility", "hidden"); + if (map) move(); + return layer; + }; + + layer.transform = function(x) { + if (!arguments.length) return transform; + transform = x; + if (map) move(); + return layer; + }; + + layer.zoom = function(x) { + if (!arguments.length) return zoom; + zoom = typeof x == "function" || x == null ? x : function() { return x; }; + if (map) move(); + return layer; + }; + + layer.tile = function(x) { + if (!arguments.length) return tile; + tile = x; + if (map) move(); + return layer; + }; + + layer.reload = function() { + cache.clear(); + if (map) move(); + return layer; + }; + + layer.dispatch = po.dispatch(layer); + layer.on("load", cleanup); + + return layer; +}; + +// scan-line conversion +function edge(a, b) { + if (a.row > b.row) { var t = a; a = b; b = t; } + return { + x0: a.column, + y0: a.row, + x1: b.column, + y1: b.row, + dx: b.column - a.column, + dy: b.row - a.row + }; +} + +// scan-line conversion +function scanSpans(e0, e1, ymin, ymax, scanLine) { + var y0 = Math.max(ymin, Math.floor(e1.y0)), + y1 = Math.min(ymax, Math.ceil(e1.y1)); + + // sort edges by x-coordinate + if ((e0.x0 == e1.x0 && e0.y0 == e1.y0) + ? (e0.x0 + e1.dy / e0.dy * e0.dx < e1.x1) + : (e0.x1 - e1.dy / e0.dy * e0.dx < e1.x0)) { + var t = e0; e0 = e1; e1 = t; + } + + // scan lines! + var m0 = e0.dx / e0.dy, + m1 = e1.dx / e1.dy, + d0 = e0.dx > 0, // use y + 1 to compute x0 + d1 = e1.dx < 0; // use y + 1 to compute x1 + for (var y = y0; y < y1; y++) { + var x0 = m0 * Math.max(0, Math.min(e0.dy, y + d0 - e0.y0)) + e0.x0, + x1 = m1 * Math.max(0, Math.min(e1.dy, y + d1 - e1.y0)) + e1.x0; + scanLine(Math.floor(x1), Math.ceil(x0), y); + } +} + +// scan-line conversion +function scanTriangle(a, b, c, ymin, ymax, scanLine) { + var ab = edge(a, b), + bc = edge(b, c), + ca = edge(c, a); + + // sort edges by y-length + if (ab.dy > bc.dy) { var t = ab; ab = bc; bc = t; } + if (ab.dy > ca.dy) { var t = ab; ab = ca; ca = t; } + if (bc.dy > ca.dy) { var t = bc; bc = ca; ca = t; } + + // scan span! scan span! + if (ab.dy) scanSpans(ca, ab, ymin, ymax, scanLine); + if (bc.dy) scanSpans(ca, bc, ymin, ymax, scanLine); +} +po.image = function() { + var image = po.layer(load, unload), + url; + + function load(tile) { + var element = tile.element = po.svg("image"), size = image.map().tileSize(); + element.setAttribute("preserveAspectRatio", "none"); + element.setAttribute("width", size.x); + element.setAttribute("height", size.y); + + if (typeof url == "function") { + element.setAttribute("opacity", 0); + tile.request = po.queue.image(element, url(tile), function(img) { + delete tile.request; + tile.ready = true; + tile.img = img; + element.removeAttribute("opacity"); + image.dispatch({type: "load", tile: tile}); + }); + } else { + tile.ready = true; + if (url) element.setAttributeNS(po.ns.xlink, "href", url); + image.dispatch({type: "load", tile: tile}); + } + } + + function unload(tile) { + if (tile.request) tile.request.abort(true); + } + + image.url = function(x) { + if (!arguments.length) return url; + url = typeof x == "string" && /{.}/.test(x) ? po.url(x) : x; + return image.reload(); + }; + + return image; +}; +po.geoJson = function(fetch) { + var geoJson = po.layer(load, unload), + container = geoJson.container(), + url, + clip = true, + clipId = "org.polymaps." + po.id(), + clipHref = "url(#" + clipId + ")", + clipPath = container.insertBefore(po.svg("clipPath"), container.firstChild), + clipRect = clipPath.appendChild(po.svg("rect")), + scale = "auto", + zoom = null, + features; + + container.setAttribute("fill-rule", "evenodd"); + clipPath.setAttribute("id", clipId); + + if (!arguments.length) fetch = po.queue.json; + + function projection(proj) { + var l = {lat: 0, lon: 0}; + return function(coordinates) { + l.lat = coordinates[1]; + l.lon = coordinates[0]; + var p = proj(l); + coordinates.x = p.x; + coordinates.y = p.y; + return p; + }; + } + + function geometry(o, proj) { + return o && o.type in types && types[o.type](o, proj); + } + + var types = { + + Point: function(o, proj) { + var p = proj(o.coordinates), + c = po.svg("circle"); + c.setAttribute("r", 4.5); + c.setAttribute("transform", "translate(" + p.x + "," + p.y + ")"); + return c; + }, + + MultiPoint: function(o, proj) { + var g = po.svg("g"), + c = o.coordinates, + p, // proj(c[i]) + x, // svg:circle + i = -1, + n = c.length; + while (++i < n) { + x = g.appendChild(po.svg("circle")); + x.setAttribute("r", 4.5); + x.setAttribute("transform", "translate(" + (p = proj(c[i])).x + "," + p.y + ")"); + } + return g; + }, + + LineString: function(o, proj) { + var x = po.svg("path"), + d = ["M"], + c = o.coordinates, + p, // proj(c[i]) + i = -1, + n = c.length; + while (++i < n) d.push((p = proj(c[i])).x, ",", p.y, "L"); + d.pop(); + if (!d.length) return; + x.setAttribute("d", d.join("")); + return x; + }, + + MultiLineString: function(o, proj) { + var x = po.svg("path"), + d = [], + ci = o.coordinates, + cj, // ci[i] + i = -1, + j, + n = ci.length, + m; + while (++i < n) { + cj = ci[i]; + j = -1; + m = cj.length; + d.push("M"); + while (++j < m) d.push((p = proj(cj[j])).x, ",", p.y, "L"); + d.pop(); + } + if (!d.length) return; + x.setAttribute("d", d.join("")); + return x; + }, + + Polygon: function(o, proj) { + var x = po.svg("path"), + d = [], + ci = o.coordinates, + cj, // ci[i] + i = -1, + j, + n = ci.length, + m; + while (++i < n) { + cj = ci[i]; + j = -1; + m = cj.length - 1; + d.push("M"); + while (++j < m) d.push((p = proj(cj[j])).x, ",", p.y, "L"); + d[d.length - 1] = "Z"; + } + if (!d.length) return; + x.setAttribute("d", d.join("")); + return x; + }, + + MultiPolygon: function(o, proj) { + var x = po.svg("path"), + d = [], + ci = o.coordinates, + cj, // ci[i] + ck, // cj[j] + i = -1, + j, + k, + n = ci.length, + m, + l; + while (++i < n) { + cj = ci[i]; + j = -1; + m = cj.length; + while (++j < m) { + ck = cj[j]; + k = -1; + l = ck.length - 1; + d.push("M"); + while (++k < l) d.push((p = proj(ck[k])).x, ",", p.y, "L"); + d[d.length - 1] = "Z"; + } + } + if (!d.length) return; + x.setAttribute("d", d.join("")); + return x; + }, + + GeometryCollection: function(o, proj) { + var g = po.svg("g"), + i = -1, + c = o.geometries, + n = c.length, + x; + while (++i < n) { + x = geometry(c[i], proj); + if (x) g.appendChild(x); + } + return g; + } + + }; + + function rescale(o, e, k) { + return o.type in rescales && rescales[o.type](o, e, k); + } + + var rescales = { + + Point: function (o, e, k) { + var p = o.coordinates; + e.setAttribute("transform", "translate(" + p.x + "," + p.y + ")" + k); + }, + + MultiPoint: function (o, e, k) { + var c = o.coordinates, + i = -1, + n = p.length, + x = e.firstChild, + p; + while (++i < n) { + p = c[i]; + x.setAttribute("transform", "translate(" + p.x + "," + p.y + ")" + k); + x = x.nextSibling; + } + } + + }; + + function load(tile, proj) { + var g = tile.element = po.svg("g"); + tile.features = []; + + proj = projection(proj(tile).locationPoint); + + function update(data) { + var updated = []; + + /* Fetch the next batch of features, if so directed. */ + if (data.next) tile.request = fetch(data.next.href, update); + + /* Convert the GeoJSON to SVG. */ + switch (data.type) { + case "FeatureCollection": { + for (var i = 0; i < data.features.length; i++) { + var feature = data.features[i], + element = geometry(feature.geometry, proj); + if (element) updated.push({element: g.appendChild(element), data: feature}); + } + break; + } + case "Feature": { + var element = geometry(data.geometry, proj); + if (element) updated.push({element: g.appendChild(element), data: data}); + break; + } + default: { + var element = geometry(data, proj); + if (element) updated.push({element: g.appendChild(element), data: {type: "Feature", geometry: data}}); + break; + } + } + + tile.ready = true; + updated.push.apply(tile.features, updated); + geoJson.dispatch({type: "load", tile: tile, features: updated}); + } + + if (url != null) { + tile.request = fetch(typeof url == "function" ? url(tile) : url, update); + } else { + update({type: "FeatureCollection", features: features || []}); + } + } + + function unload(tile) { + if (tile.request) tile.request.abort(true); + } + + function move() { + var zoom = geoJson.map().zoom(), + tiles = geoJson.cache.locks(), // visible tiles + key, // key in locks + tile, // locks[key] + features, // tile.features + i, // current feature index + n, // current feature count, features.length + feature, // features[i] + k; // scale transform + if (scale == "fixed") { + for (key in tiles) { + if ((tile = tiles[key]).scale != zoom) { + k = "scale(" + Math.pow(2, tile.zoom - zoom) + ")"; + i = -1; + n = (features = tile.features).length; + while (++i < n) rescale((feature = features[i]).data.geometry, feature.element, k); + tile.scale = zoom; + } + } + } else { + for (key in tiles) { + i = -1; + n = (features = (tile = tiles[key]).features).length; + while (++i < n) rescale((feature = features[i]).data.geometry, feature.element, ""); + delete tile.scale; + } + } + } + + geoJson.url = function(x) { + if (!arguments.length) return url; + url = typeof x == "string" && /{.}/.test(x) ? po.url(x) : x; + if (url != null) features = null; + if (typeof url == "string") geoJson.tile(false); + return geoJson.reload(); + }; + + geoJson.features = function(x) { + if (!arguments.length) return features; + if (features = x) { + url = null; + geoJson.tile(false); + } + return geoJson.reload(); + }; + + geoJson.clip = function(x) { + if (!arguments.length) return clip; + if (clip) container.removeChild(clipPath); + if (clip = x) container.insertBefore(clipPath, container.firstChild); + var locks = geoJson.cache.locks(); + for (var key in locks) { + if (clip) locks[key].element.setAttribute("clip-path", clipHref); + else locks[key].element.removeAttribute("clip-path"); + } + return geoJson; + }; + + var __tile__ = geoJson.tile; + geoJson.tile = function(x) { + if (arguments.length && !x) geoJson.clip(x); + return __tile__.apply(geoJson, arguments); + }; + + var __map__ = geoJson.map; + geoJson.map = function(x) { + if (x && clipRect) { + var size = x.tileSize(); + clipRect.setAttribute("width", size.x); + clipRect.setAttribute("height", size.y); + } + return __map__.apply(geoJson, arguments); + }; + + geoJson.scale = function(x) { + if (!arguments.length) return scale; + if (scale = x) geoJson.on("move", move); + else geoJson.off("move", move); + if (geoJson.map()) move(); + return geoJson; + }; + + geoJson.show = function(tile) { + if (clip) tile.element.setAttribute("clip-path", clipHref); + else tile.element.removeAttribute("clip-path"); + geoJson.dispatch({type: "show", tile: tile, features: tile.features}); + return geoJson; + }; + + geoJson.reshow = function() { + var locks = geoJson.cache.locks(); + for (var key in locks) geoJson.show(locks[key]); + return geoJson; + }; + + return geoJson; +}; +po.dblclick = function() { + var dblclick = {}, + zoom = "mouse", + map, + container; + + function handle(e) { + var z = map.zoom(); + if (e.shiftKey) z = Math.ceil(z) - z - 1; + else z = 1 - z + Math.floor(z); + zoom === "mouse" ? map.zoomBy(z, map.mouse(e)) : map.zoomBy(z); + } + + dblclick.zoom = function(x) { + if (!arguments.length) return zoom; + zoom = x; + return dblclick; + }; + + dblclick.map = function(x) { + if (!arguments.length) return map; + if (map) { + container.removeEventListener("dblclick", handle, false); + container = null; + } + if (map = x) { + container = map.container(); + container.addEventListener("dblclick", handle, false); + } + return dblclick; + }; + + return dblclick; +}; +po.drag = function() { + var drag = {}, + map, + container, + dragging; + + function mousedown(e) { + if (e.shiftKey) return; + dragging = { + x: e.clientX, + y: e.clientY + }; + map.focusableParent().focus(); + e.preventDefault(); + document.body.style.setProperty("cursor", "move", null); + } + + function mousemove(e) { + if (!dragging) return; + map.panBy({x: e.clientX - dragging.x, y: e.clientY - dragging.y}); + dragging.x = e.clientX; + dragging.y = e.clientY; + } + + function mouseup(e) { + if (!dragging) return; + mousemove(e); + dragging = null; + document.body.style.removeProperty("cursor"); + } + + drag.map = function(x) { + if (!arguments.length) return map; + if (map) { + container.removeEventListener("mousedown", mousedown, false); + container = null; + } + if (map = x) { + container = map.container(); + container.addEventListener("mousedown", mousedown, false); + } + return drag; + }; + + window.addEventListener("mousemove", mousemove, false); + window.addEventListener("mouseup", mouseup, false); + + return drag; +}; +po.wheel = function() { + var wheel = {}, + timePrev = 0, + last = 0, + smooth = true, + zoom = "mouse", + location, + map, + container; + + function move(e) { + location = null; + } + + function mousewheel(e) { + var delta = (e.wheelDelta / 120 || -e.detail) * .1, + point; + + /* Detect fast & large wheel events on WebKit. */ + if (bug40441 < 0) { + var now = Date.now(), since = now - last; + if ((since > 9) && (Math.abs(e.wheelDelta) / since >= 50)) bug40441 = 1; + last = now; + } + if (bug40441 == 1) delta *= .03; + + /* If smooth zooming is disabled, batch events into unit steps. */ + if (!smooth && delta) { + var timeNow = Date.now(); + if (timeNow - timePrev > 200) { + delta = delta > 0 ? +1 : -1; + timePrev = timeNow; + } else { + delta = 0; + } + } + + if (delta) { + switch (zoom) { + case "mouse": { + point = map.mouse(e); + if (!location) location = map.pointLocation(point); + map.off("move", move).zoomBy(delta, point, location).on("move", move); + break; + } + case "location": { + map.zoomBy(delta, map.locationPoint(location), location); + break; + } + default: { // center + map.zoomBy(delta); + break; + } + } + } + + e.preventDefault(); + return false; // for Firefox + } + + wheel.smooth = function(x) { + if (!arguments.length) return smooth; + smooth = x; + return wheel; + }; + + wheel.zoom = function(x, l) { + if (!arguments.length) return zoom; + zoom = x; + location = l; + if (map) { + if (zoom == "mouse") map.on("move", move); + else map.off("move", move); + } + return wheel; + }; + + wheel.map = function(x) { + if (!arguments.length) return map; + if (map) { + container.removeEventListener("mousemove", move, false); + container.removeEventListener("mousewheel", mousewheel, false); + container.removeEventListener("DOMMouseScroll", mousewheel, false); + container = null; + map.off("move", move); + } + if (map = x) { + if (zoom == "mouse") map.on("move", move); + container = map.container(); + container.addEventListener("mousemove", move, false); + container.addEventListener("mousewheel", mousewheel, false); + container.addEventListener("DOMMouseScroll", mousewheel, false); + } + return wheel; + }; + + return wheel; +}; + +// https://bugs.webkit.org/show_bug.cgi?id=40441 +var bug40441 = /WebKit\/533/.test(navigator.userAgent) ? -1 : 0; +po.arrow = function() { + var arrow = {}, + key = {left: 0, right: 0, up: 0, down: 0}, + last = 0, + repeatTimer, + repeatDelay = 250, + repeatInterval = 50, + speed = 16, + map, + parent; + + function keydown(e) { + if (e.ctrlKey || e.altKey || e.metaKey) return; + var now = Date.now(), dx = 0, dy = 0; + switch (e.keyCode) { + case 37: { + if (!key.left) { + last = now; + key.left = 1; + if (!key.right) dx = speed; + } + break; + } + case 39: { + if (!key.right) { + last = now; + key.right = 1; + if (!key.left) dx = -speed; + } + break; + } + case 38: { + if (!key.up) { + last = now; + key.up = 1; + if (!key.down) dy = speed; + } + break; + } + case 40: { + if (!key.down) { + last = now; + key.down = 1; + if (!key.up) dy = -speed; + } + break; + } + default: return; + } + if (dx || dy) map.panBy({x: dx, y: dy}); + if (!repeatTimer && (key.left | key.right | key.up | key.down)) { + repeatTimer = setInterval(repeat, repeatInterval); + } + e.preventDefault(); + } + + function keyup(e) { + last = Date.now(); + switch (e.keyCode) { + case 37: key.left = 0; break; + case 39: key.right = 0; break; + case 38: key.up = 0; break; + case 40: key.down = 0; break; + default: return; + } + if (repeatTimer && !(key.left | key.right | key.up | key.down)) { + repeatTimer = clearInterval(repeatTimer); + } + e.preventDefault(); + } + + function keypress(e) { + switch (e.charCode) { + case 45: case 95: map.zoom(Math.ceil(map.zoom()) - 1); break; // - _ + case 43: case 61: map.zoom(Math.floor(map.zoom()) + 1); break; // = + + default: return; + } + e.preventDefault(); + } + + function repeat() { + if (!map) return; + if (Date.now() < last + repeatDelay) return; + var dx = (key.left - key.right) * speed, + dy = (key.up - key.down) * speed; + if (dx || dy) map.panBy({x: dx, y: dy}); + } + + arrow.map = function(x) { + if (!arguments.length) return map; + if (map) { + parent.removeEventListener("keypress", keypress, false); + parent.removeEventListener("keydown", keydown, false); + parent.removeEventListener("keyup", keyup, false); + parent = null; + } + if (map = x) { + parent = map.focusableParent(); + parent.addEventListener("keypress", keypress, false); + parent.addEventListener("keydown", keydown, false); + parent.addEventListener("keyup", keyup, false); + } + return arrow; + }; + + arrow.speed = function(x) { + if (!arguments.length) return speed; + speed = x; + return arrow; + }; + + return arrow; +}; +po.hash = function() { + var hash = {}, + s0, // cached location.hash + lat = 90 - 1e-8, // allowable latitude range + map; + + var parser = function(s) { + var args = s.split("/").map(Number); + if (args.length < 3 || args.some(isNaN)) + move(); // replace bogus hash + else { + var size = map.size(); + map.zoomBy(args[0] - map.zoom(), + {x: size.x / 2, y: size.y / 2}, + {lat: Math.min(lat, Math.max(-lat, args[1])), lon: args[2]}); + } + }; + + var formatter = function(map) { + var center = map.center(), + zoom = map.zoom(), + precision = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2)); + return "#" + zoom.toFixed(2) + + "/" + center.lat.toFixed(precision) + + "/" + center.lon.toFixed(precision); + }; + + function move() { + var s1 = formatter(map); + if (s0 !== s1) location.replace(s0 = s1); // don't recenter the map! + } + + function hashchange() { + if (location.hash === s0) return; // ignore spurious hashchange events + parser((s0 = location.hash).substring(1)); + } + + hash.map = function(x) { + if (!arguments.length) return map; + if (map) { + map.off("move", move); + window.removeEventListener("hashchange", hashchange, false); + } + if (map = x) { + map.on("move", move); + window.addEventListener("hashchange", hashchange, false); + location.hash ? hashchange() : move(); + } + return hash; + }; + + hash.parser = function(x) { + if (!arguments.length) return parser; + parser = x; + return hash; + }; + + hash.formatter = function(x) { + if (!arguments.length) return formatter; + formatter = x; + return hash; + }; + + return hash; +}; +// Default map controls. +po.interact = function() { + var interact = {}, + drag = po.drag(), + wheel = po.wheel(), + dblclick = po.dblclick(), + arrow = po.arrow(); + + interact.map = function(x) { + drag.map(x); + wheel.map(x); + dblclick.map(x); + arrow.map(x); + return interact; + }; + + return interact; +}; +po.compass = function() { + var compass = {}, + g = po.svg("g"), + ticks = {}, + r = 30, + speed = 16, + last = 0, + repeatDelay = 250, + repeatInterval = 50, + position = "top-left", // top-left, top-right, bottom-left, bottom-right + zoomStyle = "small", // none, small, big + zoomContainer, + panStyle = "small", // none, small + panTimer, + panDirection, + panContainer, + drag, + dragRect = po.svg("rect"), + map, + container, + window; + + g.setAttribute("class", "compass"); + dragRect.setAttribute("class", "back fore"); + dragRect.setAttribute("pointer-events", "none"); + dragRect.setAttribute("display", "none"); + + function panStart(e) { + g.setAttribute("class", "compass active"); + if (!panTimer) panTimer = setInterval(panRepeat, repeatInterval); + if (panDirection) map.panBy(panDirection); + last = Date.now(); + return cancel(e); + } + + function panRepeat() { + if (panDirection && (Date.now() > last + repeatDelay)) { + map.panBy(panDirection); + } + } + + function mousedown(e) { + if (e.shiftKey) { + drag = {x0: map.mouse(e)}; + map.focusableParent().focus(); + return cancel(e); + } + } + + function mousemove(e) { + if (!drag) return; + drag.x1 = map.mouse(e); + dragRect.setAttribute("x", Math.min(drag.x0.x, drag.x1.x)); + dragRect.setAttribute("y", Math.min(drag.x0.y, drag.x1.y)); + dragRect.setAttribute("width", Math.abs(drag.x0.x - drag.x1.x)); + dragRect.setAttribute("height", Math.abs(drag.x0.y - drag.x1.y)); + dragRect.removeAttribute("display"); + } + + function mouseup(e) { + g.setAttribute("class", "compass"); + if (drag) { + if (drag.x1) { + map.extent([ + map.pointLocation({ + x: Math.min(drag.x0.x, drag.x1.x), + y: Math.max(drag.x0.y, drag.x1.y) + }), + map.pointLocation({ + x: Math.max(drag.x0.x, drag.x1.x), + y: Math.min(drag.x0.y, drag.x1.y) + }) + ]); + dragRect.setAttribute("display", "none"); + } + drag = null; + } + if (panTimer) { + clearInterval(panTimer); + panTimer = 0; + } + } + + function panBy(x) { + return function() { + x ? this.setAttribute("class", "active") : this.removeAttribute("class"); + panDirection = x; + }; + } + + function zoomBy(x) { + return function(e) { + g.setAttribute("class", "compass active"); + var z = map.zoom(); + map.zoom(x < 0 ? Math.ceil(z) - 1 : Math.floor(z) + 1); + return cancel(e); + }; + } + + function zoomTo(x) { + return function(e) { + map.zoom(x); + return cancel(e); + }; + } + + function zoomOver() { + this.setAttribute("class", "active"); + } + + function zoomOut() { + this.removeAttribute("class"); + } + + function cancel(e) { + e.stopPropagation(); + e.preventDefault(); + return false; + } + + function pan(by) { + var x = Math.SQRT1_2 * r, + y = r * .7, + z = r * .2, + g = po.svg("g"), + dir = g.appendChild(po.svg("path")), + chv = g.appendChild(po.svg("path")); + dir.setAttribute("class", "direction"); + dir.setAttribute("pointer-events", "all"); + dir.setAttribute("d", "M0,0L" + x + "," + x + "A" + r + "," + r + " 0 0,1 " + -x + "," + x + "Z"); + chv.setAttribute("class", "chevron"); + chv.setAttribute("d", "M" + z + "," + (y - z) + "L0," + y + " " + -z + "," + (y - z)); + chv.setAttribute("pointer-events", "none"); + g.addEventListener("mousedown", panStart, false); + g.addEventListener("mouseover", panBy(by), false); + g.addEventListener("mouseout", panBy(null), false); + g.addEventListener("dblclick", cancel, false); + return g; + } + + function zoom(by) { + var x = r * .4, + y = x / 2, + g = po.svg("g"), + back = g.appendChild(po.svg("path")), + dire = g.appendChild(po.svg("path")), + chev = g.appendChild(po.svg("path")), + fore = g.appendChild(po.svg("path")); + back.setAttribute("class", "back"); + back.setAttribute("d", "M" + -x + ",0V" + -x + "A" + x + "," + x + " 0 1,1 " + x + "," + -x + "V0Z"); + dire.setAttribute("class", "direction"); + dire.setAttribute("d", back.getAttribute("d")); + chev.setAttribute("class", "chevron"); + chev.setAttribute("d", "M" + -y + "," + -x + "H" + y + (by > 0 ? "M0," + (-x - y) + "V" + -y : "")); + fore.setAttribute("class", "fore"); + fore.setAttribute("fill", "none"); + fore.setAttribute("d", back.getAttribute("d")); + g.addEventListener("mousedown", zoomBy(by), false); + g.addEventListener("mouseover", zoomOver, false); + g.addEventListener("mouseout", zoomOut, false); + g.addEventListener("dblclick", cancel, false); + return g; + } + + function tick(i) { + var x = r * .2, + y = r * .4, + g = po.svg("g"), + back = g.appendChild(po.svg("rect")), + chev = g.appendChild(po.svg("path")); + back.setAttribute("pointer-events", "all"); + back.setAttribute("fill", "none"); + back.setAttribute("x", -y); + back.setAttribute("y", -.75 * y); + back.setAttribute("width", 2 * y); + back.setAttribute("height", 1.5 * y); + chev.setAttribute("class", "chevron"); + chev.setAttribute("d", "M" + -x + ",0H" + x); + g.addEventListener("mousedown", zoomTo(i), false); + g.addEventListener("dblclick", cancel, false); + return g; + } + + function move() { + var x = r + 6, y = x, size = map.size(); + switch (position) { + case "top-left": break; + case "top-right": x = size.x - x; break; + case "bottom-left": y = size.y - y; break; + case "bottom-right": x = size.x - x; y = size.y - y; break; + } + var tx = "translate(" + x + "," + y + ")"; + if (panContainer) panContainer.setAttribute("transform", tx); + if (zoomContainer) zoomContainer.setAttribute("transform", tx); + for (var i in ticks) { + i == map.zoom() + ? ticks[i].setAttribute("class", "active") + : ticks[i].removeAttribute("class"); + } + } + + function draw() { + while (g.lastChild) g.removeChild(g.lastChild); + + g.appendChild(dragRect); + + if (panStyle != "none") { + panContainer = g.appendChild(po.svg("g")); + panContainer.setAttribute("class", "pan"); + + var back = panContainer.appendChild(po.svg("circle")); + back.setAttribute("class", "back"); + back.setAttribute("r", r); + + var s = panContainer.appendChild(pan({x: 0, y: -speed})); + s.setAttribute("transform", "rotate(0)"); + + var w = panContainer.appendChild(pan({x: speed, y: 0})); + w.setAttribute("transform", "rotate(90)"); + + var n = panContainer.appendChild(pan({x: 0, y: speed})); + n.setAttribute("transform", "rotate(180)"); + + var e = panContainer.appendChild(pan({x: -speed, y: 0})); + e.setAttribute("transform", "rotate(270)"); + + var fore = panContainer.appendChild(po.svg("circle")); + fore.setAttribute("fill", "none"); + fore.setAttribute("class", "fore"); + fore.setAttribute("r", r); + } else { + panContainer = null; + } + + if (zoomStyle != "none") { + zoomContainer = g.appendChild(po.svg("g")); + zoomContainer.setAttribute("class", "zoom"); + + var j = -.5; + if (zoomStyle == "big") { + ticks = {}; + for (var i = map.zoomRange()[0], j = 0; i <= map.zoomRange()[1]; i++, j++) { + (ticks[i] = zoomContainer.appendChild(tick(i))) + .setAttribute("transform", "translate(0," + (-(j + .75) * r * .4) + ")"); + } + } + + var p = panStyle == "none" ? .4 : 2; + zoomContainer.setAttribute("transform", "translate(0," + r * (/^top-/.test(position) ? (p + (j + .5) * .4) : -p) + ")"); + zoomContainer.appendChild(zoom(+1)).setAttribute("transform", "translate(0," + (-(j + .5) * r * .4) + ")"); + zoomContainer.appendChild(zoom(-1)).setAttribute("transform", "scale(-1)"); + } else { + zoomContainer = null; + } + + move(); + } + + compass.radius = function(x) { + if (!arguments.length) return r; + r = x; + if (map) draw(); + return compass; + }; + + compass.speed = function(x) { + if (!arguments.length) return r; + speed = x; + return compass; + }; + + compass.position = function(x) { + if (!arguments.length) return position; + position = x; + if (map) draw(); + return compass; + }; + + compass.pan = function(x) { + if (!arguments.length) return panStyle; + panStyle = x; + if (map) draw(); + return compass; + }; + + compass.zoom = function(x) { + if (!arguments.length) return zoomStyle; + zoomStyle = x; + if (map) draw(); + return compass; + }; + + compass.map = function(x) { + if (!arguments.length) return map; + if (map) { + container.removeEventListener("mousedown", mousedown, false); + container.removeChild(g); + container = null; + window.removeEventListener("mousemove", mousemove, false); + window.removeEventListener("mouseup", mouseup, false); + window = null; + map.off("move", move).off("resize", move); + } + if (map = x) { + container = map.container(); + container.appendChild(g); + container.addEventListener("mousedown", mousedown, false); + window = container.ownerDocument.defaultView; + window.addEventListener("mousemove", mousemove, false); + window.addEventListener("mouseup", mouseup, false); + map.on("move", move).on("resize", move); + draw(); + } + return compass; + }; + + return compass; +}; +po.grid = function() { + var grid = {}, + map, + g = po.svg("g"); + + g.setAttribute("class", "grid"); + + function move(e) { + var p, + line = g.firstChild, + size = map.size(), + nw = map.pointLocation(zero), + se = map.pointLocation(size), + step = Math.pow(2, 4 - Math.round(map.zoom())); + + // Round to step. + nw.lat = Math.floor(nw.lat / step) * step; + nw.lon = Math.ceil(nw.lon / step) * step; + + // Longitude ticks. + for (var x; (x = map.locationPoint(nw).x) <= size.x; nw.lon += step) { + if (!line) line = g.appendChild(po.svg("line")); + line.setAttribute("x1", x); + line.setAttribute("x2", x); + line.setAttribute("y1", 0); + line.setAttribute("y2", size.y); + line = line.nextSibling; + } + + // Latitude ticks. + for (var y; (y = map.locationPoint(nw).y) <= size.y; nw.lat -= step) { + if (!line) line = g.appendChild(po.svg("line")); + line.setAttribute("y1", y); + line.setAttribute("y2", y); + line.setAttribute("x1", 0); + line.setAttribute("x2", size.x); + line = line.nextSibling; + } + + // Remove extra ticks. + while (line) { + var next = line.nextSibling; + g.removeChild(line); + line = next; + } + } + + grid.map = function(x) { + if (!arguments.length) return map; + if (map) { + g.parentNode.removeChild(g); + map.off("move", move).off("resize", move); + } + if (map = x) { + map.on("move", move).on("resize", move); + map.container().appendChild(g); + map.dispatch({type: "move"}); + } + return grid; + }; + + return grid; +}; +po.stylist = function() { + var attrs = [], + styles = [], + title; + + function stylist(e) { + var ne = e.features.length, + na = attrs.length, + ns = styles.length, + f, // feature + d, // data + o, // element + x, // attr or style or title descriptor + v, // attr or style or title value + i, + j; + for (i = 0; i < ne; ++i) { + if (!(o = (f = e.features[i]).element)) continue; + d = f.data; + for (j = 0; j < na; ++j) { + v = (x = attrs[j]).value; + if (typeof v === "function") v = v.call(null, d); + v == null ? (x.name.local + ? o.removeAttributeNS(x.name.space, x.name.local) + : o.removeAttribute(x.name)) : (x.name.local + ? o.setAttributeNS(x.name.space, x.name.local, v) + : o.setAttribute(x.name, v)); + } + for (j = 0; j < ns; ++j) { + v = (x = styles[j]).value; + if (typeof v === "function") v = v.call(null, d); + v == null + ? o.style.removeProperty(x.name) + : o.style.setProperty(x.name, v, x.priority); + } + if (v = title) { + if (typeof v === "function") v = v.call(null, d); + while (o.lastChild) o.removeChild(o.lastChild); + if (v != null) o.appendChild(po.svg("title")).appendChild(document.createTextNode(v)); + } + } + } + + stylist.attr = function(n, v) { + attrs.push({name: ns(n), value: v}); + return stylist; + }; + + stylist.style = function(n, v, p) { + styles.push({name: n, value: v, priority: arguments.length < 3 ? null : p}); + return stylist; + }; + + stylist.title = function(v) { + title = v; + return stylist; + }; + + return stylist; +}; +})(org.polymaps); +// Wax Header var wax = wax || {}; // Instantiate objects based on a JSON "record". The record must be a statement @@ -334,7 +4021,10 @@ wax.Wax = { runFunction: function(fn_name, args, cur) { var fn_obj = this.getFunction(fn_name, cur); var fn_args = args.length ? wax.Wax.reify(args) : []; - if (cur) { + // @TODO: This is currently a stopgap measure that calls methods like + // `foo.bar()` in the context of `foo`. It will probably be necessary + // in the future to be able to call `foo.bar()` from other contexts. + if (cur && fn_name.indexOf('.') === -1) { return fn_obj[1].apply(cur, fn_args); } else { return fn_obj[1].apply(fn_obj[0], fn_args); diff --git a/build/wax.ol.min.js b/build/wax.ol.min.js index b7fb25b3..1eac2c1c 100644 --- a/build/wax.ol.min.js +++ b/build/wax.ol.min.js @@ -1,10 +1,126 @@ /* - * jQuery JSONP Core Plugin 2.1.4 (2010-11-17) - * - * http://code.google.com/p/jquery-jsonp/ + + OpenLayers.js -- OpenLayers Map Viewer Library + + Copyright 2005-2010 OpenLayers Contributors, released under the Clear BSD + license. Please see http://svn.openlayers.org/trunk/openlayers/license.txt + for the full text of the license. + + Includes compressed code under the following licenses: + + (For uncompressed versions of the code used please see the + OpenLayers SVN repository: ) + +*//* Contains portions of Prototype.js: + * + * Prototype JavaScript framework, version 1.4.0 + * (c) 2005 Sam Stephenson + * + * Prototype is freely distributable under the terms of an MIT-style license. + * For details, see the Prototype web site: http://prototype.conio.net/ + * + *--------------------------------------------------------------------------*//** +* +* Contains portions of Rico +* +* Copyright 2005 Sabre Airline Solutions +* +* Licensed under the Apache License, Version 2.0 (the "License"); you +* may not use this file except in compliance with the License. You +* may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +* implied. See the License for the specific language governing +* permissions and limitations under the License. +* +**//** + * Contains XMLHttpRequest.js + * Copyright 2007 Sergey Ilinsky (http://www.ilinsky.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + *//** + * Contains portions of Gears + * + * Copyright 2007, Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of Google Inc. nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. * - * Copyright (c) 2010 Julian Aubourg + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * This document is licensed as free software under the terms of the - * MIT License: http://www.opensource.org/licenses/mit-license.php - */(function(a,b){function B(m){function P(a){!(M++)&&b(function(){N(),G&&a!=u&&(x[I]=a),f(m.error,m,[m,a]),f(B,m,[m,a])},0)}function O(a){!(M++)&&b(function(){N(),G&&(x[I]={s:[a]}),C&&(a=C.apply(m,[a])),f(m.success,m,[a,t]),f(B,m,[m,t])},0)}m=a.extend({},A,m);var B=m.complete,C=m.dataFilter,D=m.callbackParameter,E=m.callback,F=m.cache,G=m.pageCache,H=m.charset,I=m.url,J=m.data,K=m.timeout,L,M=0,N=c;m.abort=function(){!(M++)&&N()};if(f(m.beforeSend,m,[m])===!1||M)return m;I=I||j,J=J?typeof J=="string"?J:a.param(J,m.traditional):j,I+=J?g(I)+J:j,D&&(I+=g(I)+encodeURIComponent(D)+"=?"),!F&&!G&&(I+=g(I)+"_"+(new Date).getTime()+"="),I=I.replace(/=\?(&|$)/,"="+E+"$1"),G&&(L=x[I])?L.s?O(L.s[0]):P(L):b(function(f,g,j){if(!M){j=K>0&&b(function(){P(u)},K),N=function(){j&&clearTimeout(j),f[q]=f[n]=f[p]=f[o]=null,w[r](f),g&&w[r](g)},window[E]=d,f=a(s)[0],f.id=l+y++,H&&(f[i]=H);function m(a){(f[n]||c)(),a=z,z=undefined,a?O(a[0]):P(k)}v.msie?(f.event=n,f.htmlFor=f.id,f[q]=function(){/loaded|complete/.test(f.readyState)&&m()}):(f[o]=f[p]=m,v.opera?(g=a(s)[0]).text="jQuery('#"+f.id+"')[0]."+o+"()":f[h]=h),f.src=I,e(f),g&&e(g)}},0);return m}function g(a){return/\?/.test(a)?"&":"?"}function f(a,b,c){return a&&a.apply(b.context||b,c)}function e(a){w.insertBefore(a,w.firstChild)}function d(a){z=[a]}function c(){}var h="async",i="charset",j="",k="error",l="_jqjsp",m="on",n=m+"click",o=m+k,p=m+"load",q=m+"readystatechange",r="removeChild",s="";else{var j=document.createElement("script");j.src=g+c[h];var k=document.getElementsByTagName("head").length?document.getElementsByTagName("head")[0]:document.body;k.appendChild(j)}e&&document.write(f.join(""))}})(),OpenLayers.VERSION_NUMBER="$Revision: 10862 $",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){var b=a.split("-"),c=b[0];for(var d=1,e=b.length;d0&&(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,b!=null&&(a=parseFloat(a.toFixed(b)));var e=a.toString().split(".");e.length==1&&b==null&&(b=0);var f=e[0];if(c){var g=/(-?[0-9]+)([0-9]{3})/;while(g.test(f))f=f.replace(g,"$1"+c+"$2")}var h;if(b==0)h=f;else{var i=e.length>1?e[1]:"0";b!=null&&(i=i+Array(b-i.length+1).join("0")),h=f+d+i}return h}},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)}},False:function(){return!1},True:function(){return!0}},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)}),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;f1){var e=[d,b].concat(Array.prototype.slice.call(arguments).slice(1,a-1),c);OpenLayers.inherit.apply(null,e)}else d.prototype=c;return d},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(a){var b=function(){a.call(this)},c=[b].concat(Array.prototype.slice.call(arguments));OpenLayers.inherit.apply(null,c);return b.prototype},OpenLayers.inherit=function(a,b){var c=function(){};c.prototype=b.prototype,a.prototype=new c;var d,e,f;for(d=2,e=arguments.length;d=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){if(typeof a.indexOf=="function")return a.indexOf(b);for(var c=0,d=a.length;c=0&&parseFloat(h)<1?(a.style.filter="alpha(opacity="+h*100+")",a.style.opacity=h):parseFloat(h)==1&&(a.style.filter="",a.style.opacity="")},OpenLayers.Util.createDiv=function(a,b,c,d,e,f,g,h){var i=document.createElement("div");d&&(i.style.backgroundImage="url("+d+")"),a||(a=OpenLayers.Util.createUniqueID("OpenLayersDiv")),e||(e="absolute"),OpenLayers.Util.modifyDOMElement(i,a,b,c,e,f,g,h);return i},OpenLayers.Util.createImage=function(a,b,c,d,e,f,g,h){var i=document.createElement("img");a||(a=OpenLayers.Util.createUniqueID("OpenLayersDiv")),e||(e="relative"),OpenLayers.Util.modifyDOMElement(i,a,b,c,e,f,null,g),h&&(i.style.display="none",OpenLayers.Event.observe(i,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,i)),OpenLayers.Event.observe(i,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,i))),i.style.alt=a,i.galleryImg="no",d&&(i.src=d);return i},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.display="";OpenLayers.Element.removeClass(this,"olImageLoadError")},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()),f=a[e];d=0;while(f==c&&d++<4)e=Math.floor(a.length*Math.random()),f=a[e];this.src=b.replace(c,f)}else this.src=this.src}else OpenLayers.Element.addClass(this,"olImageLoadError");this.style.display=""},OpenLayers.Util.alphaHackNeeded=null,OpenLayers.Util.alphaHack=function(){if(OpenLayers.Util.alphaHackNeeded==null){var a=navigator.appVersion.split("MSIE"),b=parseFloat(a[1]),c=!1;try{c=!!document.body.filters}catch(d){}OpenLayers.Util.alphaHackNeeded=c&&b>=5.5&&b<7}return OpenLayers.Util.alphaHackNeeded},OpenLayers.Util.modifyAlphaImageDiv=function(a,b,c,d,e,f,g,h,i){OpenLayers.Util.modifyDOMElement(a,b,c,d,f,null,null,i);var j=a.childNodes[0];e&&(j.src=e),OpenLayers.Util.modifyDOMElement(j,a.id+"_innerImage",null,d,"relative",g),OpenLayers.Util.alphaHack()&&(a.style.display!="none"&&(a.style.display="inline-block"),h==null&&(h="scale"),a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+j.src+"', "+"sizingMethod='"+h+"')",parseFloat(a.style.opacity)>=0&&parseFloat(a.style.opacity)<1&&(a.style.filter+=" alpha(opacity="+a.style.opacity*100+")"),j.style.filter="alpha(opacity=0)")},OpenLayers.Util.createAlphaImageDiv=function(a,b,c,d,e,f,g,h,i){var j=OpenLayers.Util.createDiv(),k=OpenLayers.Util.createImage(null,null,null,null,null,null,null,!1);j.appendChild(k),i&&(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,h);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];!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"){var e;if(typeof d=="object"&&d.constructor==Array){var f=[],g;for(var h=0,i=d.length;h0))return"";c||(c=0);if(d[c].childNodes.length>1)return d.childNodes[1].nodeValue;if(d[c].childNodes.length==1)return d[c].firstChild.nodeValue},OpenLayers.Util.getXmlNodeValue=function(a){var b=null;OpenLayers.Util.Try(function(){b=a.text,b||(b=a.textContent),b||(b=a.firstChild.nodeValue)},function(){b=a.textContent});return b},OpenLayers.Util.mouseLeft=function(a,b){var c=a.relatedTarget?a.relatedTarget:a.toElement;while(c!=b&&c!=null)c=c.parentNode;return c!=b},OpenLayers.Util.DEFAULT_PRECISION=14,OpenLayers.Util.toFloat=function(a,b){b==null&&(b=OpenLayers.Util.DEFAULT_PRECISION);var a;b==0?a=parseFloat(a):a=parseFloat(parseFloat(a).toPrecision(b));return a},OpenLayers.Util.rad=function(a){return a*Math.PI/180},OpenLayers.Util.deg=function(a){return a*180/Math.PI},OpenLayers.Util.VincentyConstants={a:6378137,b:6356752.3142,f:1/298.257223563},OpenLayers.Util.distVincenty=function(a,b){var c=OpenLayers.Util.VincentyConstants,d=c.a,e=c.b,f=c.f,g=OpenLayers.Util.rad(b.lon-a.lon),h=Math.atan((1-f)*Math.tan(OpenLayers.Util.rad(a.lat))),i=Math.atan((1-f)*Math.tan(OpenLayers.Util.rad(b.lat))),j=Math.sin(h),k=Math.cos(h),l=Math.sin(i),m=Math.cos(i),n=g,o=2*Math.PI,p=20;while(Math.abs(n-o)>1e-12&&--p>0){var q=Math.sin(n),r=Math.cos(n),s=Math.sqrt(m*q*m*q+(k*l-j*m*r)*(k*l-j*m*r));if(s==0)return 0;var t=j*l+k*m*r,u=Math.atan2(s,t),v=Math.asin(k*m*q/s),w=Math.cos(v)*Math.cos(v),x=t-2*j*l/w,y=f/16*w*(4+f*(4-3*w));o=n,n=g+(1-y)*f*Math.sin(v)*(u+y*s*(x+y*t*(-1+2*x*x)))}if(p==0)return NaN;var z=w*(d*d-e*e)/(e*e),A=1+z/16384*(4096+z*(-768+z*(320-175*z))),B=z/1024*(256+z*(-128+z*(74-47*z))),C=B*s*(x+B/4*(t*(-1+2*x*x)-B/6*x*(-3+4*s*s)*(-3+4*x*x))),D=e*A*(u-C),E=D.toFixed(3)/1e3;return E},OpenLayers.Util.destinationVincenty=function(a,b,c){var d=OpenLayers.Util,e=d.VincentyConstants,f=e.a,g=e.b,h=e.f,i=a.lon,j=a.lat,k=c,l=d.rad(b),m=Math.sin(l),n=Math.cos(l),o=(1-h)*Math.tan(d.rad(j)),p=1/Math.sqrt(1+o*o),q=o*p,r=Math.atan2(o,n),s=p*m,t=1-s*s,u=t*(f*f-g*g)/(g*g),v=1+u/16384*(4096+u*(-768+u*(320-175*u))),w=u/1024*(256+u*(-128+u*(74-47*u))),x=k/(g*v),y=2*Math.PI;while(Math.abs(x-y)>1e-12){var z=Math.cos(2*r+x),A=Math.sin(x),B=Math.cos(x),C=w*A*(z+w/4*(B*(-1+2*z*z)-w/6*z*(-3+4*A*A)*(-3+4*z*z)));y=x,x=k/(g*v)+C}var D=q*A-p*B*n,E=Math.atan2(q*B+p*A*n,(1-h)*Math.sqrt(s*s+D*D)),F=Math.atan2(A*m,p*B-q*A*n),G=h/16*t*(4+h*(4-3*t)),H=F-(1-G)*h*s*(x+G*A*(z+G*B*(-1+2*z*z))),I=Math.atan2(s,-D);return new OpenLayers.LonLat(i+d.deg(H),d.deg(E))},OpenLayers.Util.getParameters=function(a){a=a||window.location.href;var b="";if(OpenLayers.String.contains(a,"?")){var c=a.indexOf("?")+1,d=OpenLayers.String.contains(a,"#")?a.indexOf("#"):a.length;b=a.substring(c,d)}var e={},f=b.split(/[&;]/);for(var g=0,h=f.length;g1?1/a:a;return b},OpenLayers.Util.getResolutionFromScale=function(a,b){var c;if(a){b==null&&(b="degrees");var d=OpenLayers.Util.normalizeScale(a);c=1/(d*OpenLayers.INCHES_PER_UNIT[b]*OpenLayers.DOTS_PER_INCH)}return c},OpenLayers.Util.getScaleFromResolution=function(a,b){b==null&&(b="degrees");var c=a*OpenLayers.INCHES_PER_UNIT[b]*OpenLayers.DOTS_PER_INCH;return c},OpenLayers.Util.safeStopPropagation=function(a){OpenLayers.Event.stop(a,!0)},OpenLayers.Util.pagePosition=function(a){var b=[0,0],c=OpenLayers.Util.getViewportElement();if(!a||a==window||a==c)return b;var d=OpenLayers.IS_GECKO&&document.getBoxObjectFor&&OpenLayers.Element.getStyle(a,"position")=="absolute"&&(a.style.top==""||a.style.left==""),e=null,f;if(a.getBoundingClientRect){f=a.getBoundingClientRect();var g=c.scrollTop,h=c.scrollLeft;b[0]=f.left+h,b[1]=f.top+g}else if(document.getBoxObjectFor&&!d){f=document.getBoxObjectFor(a);var i=document.getBoxObjectFor(c);b[0]=f.screenX-i.screenX,b[1]=f.screenY-i.screenY}else{b[0]=a.offsetLeft,b[1]=a.offsetTop,e=a.offsetParent;if(e!=a)while(e)b[0]+=e.offsetLeft,b[1]+=e.offsetTop,e=e.offsetParent;var j=OpenLayers.BROWSER_NAME;if(j=="opera"||j=="safari"&&OpenLayers.Element.getStyle(a,"position")=="absolute")b[1]-=document.body.offsetTop;e=a.offsetParent;while(e&&e!=document.body){b[0]-=e.scrollLeft;if(j!="opera"||e.tagName!="TR")b[1]-=e.scrollTop;e=e.offsetParent}}return b},OpenLayers.Util.getViewportElement=function(){var a=arguments.callee.viewportElement;a==undefined&&(a=OpenLayers.BROWSER_NAME=="msie"&&document.compatMode!="CSS1Compat"?document.body:document.documentElement,arguments.callee.viewportElement=a);return a},OpenLayers.Util.isEquivalentUrl=function(a,b,c){c=c||{},OpenLayers.Util.applyDefaults(c,{ignoreCase:!0,ignorePort80:!0,ignoreHash:!0});var d=OpenLayers.Util.createUrlObject(a,c),e=OpenLayers.Util.createUrlObject(b,c);for(var f in d)if(f!=="args"&&d[f]!=e[f])return!1;for(var f in d.args){if(d.args[f]!=e.args[f])return!1;delete e.args[f]}for(var f in e.args)return!1;return!0},OpenLayers.Util.createUrlObject=function(a,b){b=b||{};if(!/^\w+:\/\//.test(a)){var c=window.location,d=c.port?":"+c.port:"",e=c.protocol+"//"+c.host.split(":").shift()+d;if(a.indexOf("/")===0)a=e+a;else{var f=c.pathname.split("/");f.pop(),a=e+f.join("/")+"/"+a}}b.ignoreCase&&(a=a.toLowerCase());var g=document.createElement("a");g.href=a;var h={};h.host=g.host.split(":").shift(),h.protocol=g.protocol,b.ignorePort80?h.port=g.port=="80"||g.port=="0"?"":g.port:h.port=g.port==""||g.port=="0"?"80":g.port,h.hash=b.ignoreHash||g.hash==="#"?"":g.hash;var i=g.search;if(!i){var j=a.indexOf("?");i=j!=-1?a.substr(j):""}h.args=OpenLayers.Util.getParameters(i),h.pathname=g.pathname.charAt(0)=="/"?g.pathname:"/"+g.pathname;return h},OpenLayers.Util.removeTail=function(a){var b=null,c=a.indexOf("?"),d=a.indexOf("#");c==-1?b=d!=-1?a.substr(0,d):a:b=d!=-1?a.substr(0,Math.min(c,d)):a.substr(0,c);return b},OpenLayers.IS_GECKO=function(){return navigator.userAgent.toLowerCase().indexOf("gecko")!=-1}(),OpenLayers.BROWSER_NAME=function(){var a="",b=navigator.userAgent.toLowerCase();b.indexOf("opera")!=-1?a="opera":b.indexOf("msie")!=-1?a="msie":b.indexOf("safari")!=-1?a="safari":b.indexOf("mozilla")!=-1&&(b.indexOf("firefox")!=-1?a="firefox":a="mozilla");return a}(),OpenLayers.Util.getBrowserName=function(){return OpenLayers.BROWSER_NAME},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;b&&(b.w?(d=b.w,f.style.width=d+"px"):b.h&&(e=b.h,f.style.height=e+"px")),c&&c.displayClass&&(f.className=c.displayClass);var h=document.createElement("div");h.innerHTML=a,h.style.overflow="visible";if(h.childNodes)for(var i=0,j=h.childNodes.length;i=0&&(f<10&&(f="0"+f),i+=f+"'",c.indexOf("dms")>=0&&(h<10&&(h="0"+h),i+=h+'"')),b=="lon"?i+=a<0?OpenLayers.i18n("W"):OpenLayers.i18n("E"):i+=a<0?OpenLayers.i18n("S"):OpenLayers.i18n("N");return i},OpenLayers.Rico=new Object,OpenLayers.Rico.Corner={round:function(a,b){a=OpenLayers.Util.getElement(a),this._setOptions(b);var c=this.options.color;this.options.color=="fromElement"&&(c=this._background(a));var d=this.options.bgColor;this.options.bgColor=="fromParent"&&(d=this._background(a.offsetParent)),this._roundCornersImpl(a,c,d)},changeColor:function(a,b){a.style.backgroundColor=b;var c=a.parentNode.getElementsByTagName("span");for(var d=0;d"+a.innerHTML+""},_roundTopCorners:function(a,b,c){var d=this._createCorner(c);for(var e=0;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";var g=this._borderColor(a,b);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=g):g&&(f.borderColor=g,f.borderStyle="solid",f.borderWidth="0px 1px"),!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:!0,border:!1,compact:!1},OpenLayers.Util.extend(this.options,a||{}),this.options.numSlices=this.options.compact?2:4,this._isTransparent()&&(this.options.blend=!1)},_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";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";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){var d=this._marginSize(b),e=c=="top"?this._whichSideTop():this._whichSideBottom();e=="left"?(a.style.marginLeft=d+"px",a.style.marginRight="0px"):e=="right"?(a.style.marginRight=d+"px",a.style.marginLeft="0px"):(a.style.marginLeft=d+"px",a.style.marginRight=d+"px")},_setBorder:function(a,b,c){var d=this._borderSize(b),e=c=="top"?this._whichSideTop():this._whichSideBottom();e=="left"?(a.style.borderLeftWidth=d+"px",a.style.borderRightWidth="0px"):e=="right"?(a.style.borderRightWidth=d+"px",a.style.borderLeftWidth="0px"):(a.style.borderLeftWidth=d+"px",a.style.borderRightWidth=d+"px"),this.options.border!=!1&&(a.style.borderLeftWidth=d+"px",a.style.borderRightWidth=d+"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;if(this.options.compact)return d[a];if(this.options.blend)return c[a];if(this.options.border)return e[a];if(this._isTransparent())return b[a];return 0},_hasString:function(a){for(var b=1;b=0)return!0;return!1},_blend:function(a,b){var c=OpenLayers.Rico.Color.createFromHex(a);c.blend(OpenLayers.Rico.Color.createFromHex(b));return c},_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.Element={visible:function(a){return OpenLayers.Util.getElement(a).style.display!="none"},toggle:function(){for(var a=0,b=arguments.length;a"+this.contentDiv.innerHTML+"",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{var f=new OpenLayers.Size;f.w=d.wa.w-this.map.paddingForPopups.right&&(c.x=a.w-this.map.paddingForPopups.right-this.size.w),b.ya.h-this.map.paddingForPopups.bottom&&(c.y=a.h-this.map.paddingForPopups.bottom-this.size.h);var d=b.x-c.x,e=b.y-c.y;this.map.pan(d,e)},registerEvents:function(){this.events=new OpenLayers.Events(this,this.div,null,!0),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=!0,OpenLayers.Event.stop(a,!0)},onmousemove:function(a){this.mousedown&&OpenLayers.Event.stop(a,!0)},onmouseup:function(a){this.mousedown&&(this.mousedown=!1,OpenLayers.Event.stop(a,!0))},onclick:function(a){OpenLayers.Event.stop(a,!0)},onmouseout:function(a){this.mousedown=!1},ondblclick:function(a){OpenLayers.Event.stop(a,!0)},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.Renderer=OpenLayers.Class({container:null,root:null,extent:null,locked:!1,size:null,resolution:null,map:null,initialize:function(a,b){this.container=OpenLayers.Util.getElement(a)},destroy:function(){this.container=null,this.extent=null,this.size=null,this.resolution=null,this.map=null},supported:function(){return!1},setExtent:function(a,b){this.extent=a.clone(),b&&(this.resolution=null)},setSize:function(a){this.size=a.clone(),this.resolution=null},getResolution:function(){this.resolution=this.resolution||this.map.getResolution();return this.resolution},drawFeature:function(a,b){b==null&&(b=a.style);if(a.geometry){var c=a.geometry.getBounds();if(c){c.intersectsBounds(this.extent)||(b={display:"none"});var d=this.drawGeometry(a.geometry,b,a.id);if(b.display!="none"&&b.label&&d!==!1){var e=a.geometry.getCentroid();if(b.labelXOffset||b.labelYOffset){xOffset=isNaN(b.labelXOffset)?0:b.labelXOffset,yOffset=isNaN(b.labelYOffset)?0:b.labelYOffset;var f=this.getResolution();e.move(xOffset*f,yOffset*f)}this.drawText(a.id,b,e)}else this.removeText(a.id);return d}}},drawGeometry:function(a,b,c){},drawText:function(a,b,c){},removeText:function(a){},clear:function(){},getFeatureIdFromEvent:function(a){},eraseFeatures:function(a){a instanceof Array||(a=[a]);for(var b=0,c=a.length;bthis.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){c==null&&(c=!0);if(a==null||b==null)return!1;a=OpenLayers.Util.toFloat(a),b=OpenLayers.Util.toFloat(b);var d=!1;c?d=a>=this.left&&a<=this.right&&b>=this.bottom&&b<=this.top:d=a>this.left&&athis.bottom&&b=this.bottom&&a.bottom<=this.top||this.bottom>=a.bottom&&this.bottom<=a.top,f=a.top>=this.bottom&&a.top<=this.top||this.top>a.bottom&&this.top=this.left&&a.left<=this.right||this.left>=a.left&&this.left<=a.right,h=a.right>=this.left&&a.right<=this.right||this.right>=a.left&&this.right<=a.right;c=(e||f)&&(g||h)}return c},containsBounds:function(a,b,c){b==null&&(b=!1),c==null&&(c=!0);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),g=this.contains(a.right,a.top,c);return b?d||e||f||g:d&&e&&f&&g},determineQuadrant:function(a){var b="",c=this.getCenterLonLat();b+=a.lat=a.right&&e.right>a.right)e=e.add(-a.getWidth(),0)}return e},CLASS_NAME:"OpenLayers.Bounds"}),OpenLayers.Bounds.fromString=function(a){var b=a.split(",");return OpenLayers.Bounds.fromArray(b)},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.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){var c=OpenLayers.i18n("lonlatAddError");OpenLayers.Console.error(c);return null}return new OpenLayers.LonLat(this.lon+OpenLayers.Util.toFloat(a), +this.lat+OpenLayers.Util.toFloat(b))},equals:function(a){var b=!1;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){var c=OpenLayers.Projection.transform({x:this.lon,y:this.lat},a,b);this.lon=c.x,this.lat=c.y;return this},wrapDateLine:function(a){var b=this.clone();if(a){while(b.lona.right)b.lon-=a.getWidth()}return b},CLASS_NAME:"OpenLayers.LonLat"}),OpenLayers.LonLat.fromString=function(a){var b=a.split(",");return new OpenLayers.LonLat(b[0],b[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=!1;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){var c=OpenLayers.i18n("pixelAddError");OpenLayers.Console.error(c);return null}return new OpenLayers.Pixel(this.x+a,this.y+b)},offset:function(a){var b=this.clone();a&&(b=this.add(a.x,a.y));return b},CLASS_NAME:"OpenLayers.Pixel"}),OpenLayers.Control=OpenLayers.Class({id:null,map:null,div:null,type:null,allowSelection:!1,displayClass:"",title:"",autoActivate:!1,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),this.id==null&&(this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_"))},destroy:function(){this.events&&(this.eventListeners&&this.events.un(this.eventListeners),this.events.destroy(),this.events=null),this.eventListeners=null,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}this.map&&(this.map.removeControl(this),this.map=null)},setMap:function(a){this.map=a,this.handler&&this.handler.setMap(a)},draw:function(a){this.div==null&&(this.div=OpenLayers.Util.createDiv(this.id),this.div.className=this.displayClass,this.allowSelection||(this.div.className+=" olControlNoSelect",this.div.setAttribute("unselectable","on",0),this.div.onselectstart=OpenLayers.Function.False),this.title!=""&&(this.div.title=this.title)),a!=null&&(this.position=a.clone()),this.moveTo(this.position);return this.div},moveTo:function(a){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!1;this.handler&&this.handler.activate(),this.active=!0,this.map&&OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active"),this.events.triggerEvent("activate");return!0},deactivate:function(){if(this.active){this.handler&&this.handler.deactivate(),this.active=!1,this.map&&OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active"),this.events.triggerEvent("deactivate");return!0}return!1},CLASS_NAME:"OpenLayers.Control"}),OpenLayers.Control.TYPE_BUTTON=1,OpenLayers.Control.TYPE_TOGGLE=2,OpenLayers.Control.TYPE_TOOL=3,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.BROWSER_NAME=="msie"?navigator.userLanguage:navigator.language);var c=a.split("-");c[0]=c[0].toLowerCase(),typeof OpenLayers.Lang[c[0]]=="object"&&(b=c[0]);if(c[1]){var d=c[0]+"-"+c[1].toUpperCase();typeof OpenLayers.Lang[d]=="object"&&(b=d)}b||(OpenLayers.Console.warn("Failed to find OpenLayers.Lang."+c.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()],d=c[a];d||(d=a),b&&(d=OpenLayers.String.format(d,b));return d}},OpenLayers.i18n=OpenLayers.Lang.translate,OpenLayers.Popup.Anchored=OpenLayers.Class(OpenLayers.Popup,{relativePosition:null,keepInMap:!0,anchor:null,initialize:function(a,b,c,d,e,f,g){var h=[a,b,c,d,f,g];OpenLayers.Popup.prototype.initialize.apply(this,h),this.anchor=e!=null?e:{size:new OpenLayers.Size(0,0),offset:new OpenLayers.Pixel(0,0)}},destroy:function(){this.anchor=null,this.relativePosition=null,OpenLayers.Popup.prototype.destroy.apply(this,arguments)},show:function(){this.updatePosition(),OpenLayers.Popup.prototype.show.apply(this,arguments)},moveTo:function(a){var b=this.relativePosition;this.relativePosition=this.calculateRelativePosition(a);var c=this.calculateNewPx(a),d=Array(c);OpenLayers.Popup.prototype.moveTo.apply(this,d),this.relativePosition!=b&&this.updateRelativePosition()},setSize:function(a){OpenLayers.Popup.prototype.setSize.apply(this,arguments);if(this.lonlat&&this.map){var b=this.map.getLayerPxFromLonLat(this.lonlat);this.moveTo(b)}},calculateRelativePosition:function(a){var b=this.map.getLonLatFromLayerPx(a),c=this.map.getExtent(),d=c.determineQuadrant(b);return OpenLayers.Bounds.oppositeQuadrant(d)},updateRelativePosition:function(){},calculateNewPx:function(a){var b=a.offset(this.anchor.offset),c=this.size||this.contentSize,d=this.relativePosition.charAt(0)=="t";b.y+=d?-(c.h+this.anchor.size.h):this.anchor.size.h;var e=this.relativePosition.charAt(1)=="l";b.x+=e?-(c.w+this.anchor.size.w):this.anchor.size.w;return b},CLASS_NAME:"OpenLayers.Popup.Anchored"}),OpenLayers.Renderer.Canvas=OpenLayers.Class(OpenLayers.Renderer,{canvas:null,features:null,initialize:function(a){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={}},eraseGeometry:function(a,b){this.eraseFeatures(this.features[b][0])},supported:function(){var a=document.createElement("canvas");return!!a.getContext},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){b=b||a.style,b=this.applyDefaultSymbolizer(b),this.features[a.id]=[a,b],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(var d=0;d1){e=parseInt((c+d)/2);var f=this.compare(this,a,OpenLayers.Util.getElement(this.order[e]));f>0?c=e:d=e}this.order.splice(d,0,b),this.indices[b]=this.getZIndex(a);return this.getNextElement(d)},remove:function(a){var b=a.id,c=OpenLayers.Util.indexOf(this.order,b);if(c>=0){this.order.splice(c,1),delete this.indices[b];if(this.order.length>0){var d=this.order[this.order.length-1];this.maxZIndex=this.indices[d]}else this.maxZIndex=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;b==null?(b=this.maxZIndex,a._style.graphicZIndex=b):b>this.maxZIndex&&(this.maxZIndex=b)},getNextElement:function(a){var b=a+1;if(bthis.duration&&this.stop()},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.Control.ArgParser=OpenLayers.Class(OpenLayers.Control,{center:null,zoom:null,layers:null,displayProjection:null,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,arguments)},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments);for(var b=0,c=this.map.controls.length;b=0;--a)this._removeButton(this.buttons[a])},doubleClick:function(a){OpenLayers.Event.stop(a);return!1},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()}OpenLayers.Event.stop(a)}},CLASS_NAME:"OpenLayers.Control.PanZoom"}),OpenLayers.Control.PanZoom.X=4,OpenLayers.Control.PanZoom.Y=4,OpenLayers.Control.Panel=OpenLayers.Class(OpenLayers.Control,{controls:null,autoActivate:!0,defaultControl:null,saveState:!1,activeState:null,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,[a]),this.controls=[],this.activeState={}},destroy:function(){OpenLayers.Control.prototype.destroy.apply(this,arguments);for(var a=this.controls.length-1;a>=0;a--)this.controls[a].events&&this.controls[a].events.un({activate:this.redraw,deactivate:this.redraw,scope:this}),OpenLayers.Event.stopObservingElement(this.controls[a].panel_div),this.controls[a].panel_div=null;this.activeState=null},activate:function(){if(OpenLayers.Control.prototype.activate.apply(this,arguments)){var a;for(var b=0,c=this.controls.length;b=0;b--)this.div.removeChild(this.div.childNodes[b]);this.div.innerHTML="";if(this.active)for(var b=0,c=this.controls.length;b5?e=5:d>2?e=2:e=1;return e*c},update:function(){var a=this.map.getResolution();if(!!a){var b=this.map.getUnits(),c=OpenLayers.INCHES_PER_UNIT,d=this.maxWidth*a*c[b],e=1;if(this.geodesic===!0){var f=(this.map.getGeodesicPixelSize().w||1e-6)*this.maxWidth,g=d/c.km;e=f/g,d*=e}var h,i;d>1e5?(h=this.topOutUnits,i=this.bottomOutUnits):(h=this.topInUnits,i=this.bottomInUnits);var j=d/c[h],k=d/c[i],l=this.getBarLen(j),m=this.getBarLen(k);j=l/c[b]*c[h],k=m/c[b]*c[i];var n=j/a/e,o=k/a/e;this.eBottom.style.visibility=="visible"&&(this.eBottom.style.width=Math.round(o)+"px",this.eBottom.innerHTML=m+" "+i),this.eTop.style.visibility=="visible"&&(this.eTop.style.width=Math.round(n)+"px",this.eTop.innerHTML=l+" "+h)}},CLASS_NAME:"OpenLayers.Control.ScaleLine"}),OpenLayers.Control.ZoomIn=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){this.map.zoomIn()},CLASS_NAME:"OpenLayers.Control.ZoomIn"}),OpenLayers.Control.ZoomOut=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){this.map.zoomOut()},CLASS_NAME:"OpenLayers.Control.ZoomOut"}),OpenLayers.Control.ZoomToMaxExtent=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){this.map&&this.map.zoomToMaxExtent()},CLASS_NAME:"OpenLayers.Control.ZoomToMaxExtent"}),OpenLayers.Event={observers:!1,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){b||(a.preventDefault?a.preventDefault():a.returnValue=!1),a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},findElement:function(a,b){var c=OpenLayers.Event.element(a);while(c.parentNode&&(!c.tagName||c.tagName.toUpperCase()!=b.toUpperCase()))c=c.parentNode;return c},observe:function(a,b,c,d){var e=OpenLayers.Util.getElement(a);d=d||!1,b=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||e.attachEvent)&&(b="keydown"),this.observers||(this.observers={});if(!e._eventCacheID){var f="eventCacheID_";e.id&&(f=e.id+"_"+f),e._eventCacheID=OpenLayers.Util.createUniqueID(f)}var g=e._eventCacheID;this.observers[g]||(this.observers[g]=[]),this.observers[g].push({element:e,name:b,observer:c,useCapture:d}),e.addEventListener?e.addEventListener(b,c,d):e.attachEvent&&e.attachEvent("on"+b,c)},stopObservingElement:function(a){var b=OpenLayers.Util.getElement(a),c=b._eventCacheID;this._removeElementObservers(OpenLayers.Event.observers[c])},_removeElementObservers:function(a){if(a)for(var b=a.length-1;b>=0;b--)var c=a[b],d=[c.element,c.name,c.observer,c.useCapture],e=OpenLayers.Event.stopObserving.apply(this,d)},stopObserving:function(a,b,c,d){d=d||!1;var e=OpenLayers.Util.getElement(a),f=e._eventCacheID;b=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||e.detachEvent)&&(b="keydown");var g=!1,h=OpenLayers.Event.observers[f];if(h){var i=0;while(!g&&i
To get rid of this message, select a new BaseLayer in the layer switcher in the upper-right corner.

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.

Developers: For help getting this working correctly, click here",getLayerWarning:"The ${layerType} Layer was unable to load correctly.

To get rid of this message, select a new BaseLayer in the layer switcher in the upper-right corner.

Most likely, this is because the ${layerLib} library script was not correctly included.

Developers: For help getting this working correctly, click here",scale:"Scale = 1 : ${scaleDenom}",W:"W",E:"E",N:"N",S:"S",graticule:"Graticule",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.",filterEvaluateNotImplemented:"evaluate is not implemented for this filter type.",end:""},OpenLayers.Popup.AnchoredBubble=OpenLayers.Class(OpenLayers.Popup.Anchored,{rounded:!1,initialize:function(a,b,c,d,e,f,g){this.padding=new OpenLayers.Bounds(0,OpenLayers.Popup.AnchoredBubble.CORNER_SIZE,0,OpenLayers.Popup.AnchoredBubble.CORNER_SIZE),OpenLayers.Popup.Anchored.prototype.initialize.apply(this,arguments)},draw:function(a){OpenLayers.Popup.Anchored.prototype.draw.apply(this,arguments),this.setContentHTML(),this.setBackgroundColor(),this.setOpacity();return this.div},updateRelativePosition:function(){this.setRicoCorners()},setSize:function(a){OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments),this.setRicoCorners()},setBackgroundColor:function(a){a!=undefined&&(this.backgroundColor=a),this.div!=null&&this.contentDiv!=null&&(this.div.style.background="transparent",OpenLayers.Rico.Corner.changeColor(this.groupDiv,this.backgroundColor))},setOpacity:function(a){OpenLayers.Popup.Anchored.prototype.setOpacity.call(this,a),this.div!=null&&this.groupDiv!=null&&OpenLayers.Rico.Corner.changeOpacity(this.groupDiv,this.opacity)},setBorder:function(a){this.border=0},setRicoCorners:function(){var a=this.getCornersToRound(this.relativePosition),b={corners:a,color:this.backgroundColor,bgColor:"transparent",blend:!1};this.rounded?(OpenLayers.Rico.Corner.reRound(this.groupDiv,b),this.setBackgroundColor(),this.setOpacity()):(OpenLayers.Rico.Corner.round(this.div,b),this.rounded=!0)},getCornersToRound:function(){var a=["tl","tr","bl","br"],b=OpenLayers.Bounds.oppositeQuadrant(this.relativePosition);OpenLayers.Util.removeItem(a,b);return a.join(" ")},CLASS_NAME:"OpenLayers.Popup.AnchoredBubble"}),OpenLayers.Popup.AnchoredBubble.CORNER_SIZE=5,OpenLayers.Projection=OpenLayers.Class({proj:null,projCode:null,titleRegEx:/\+title=[^\+]*/,initialize:function(a,b){OpenLayers.Util.extend(this,b),this.projCode=a,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){var b=a,c=!1;if(b)if(window.Proj4js&&this.proj.defData&&b.proj.defData)c=this.proj.defData.replace(this.titleRegEx,"")==b.proj.defData.replace(this.titleRegEx,"");else if(b.getCode){var d=this.getCode(),e=b.getCode();c=d==e||!!OpenLayers.Projection.transforms[d]&&OpenLayers.Projection.transforms[d][e]===OpenLayers.Projection.nullTransform}return c},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){b.proj&&c.proj?a=Proj4js.transform(b.proj,c.proj,a):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.Projection.nullTransform=function(a){return a},OpenLayers.Renderer.SVG=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"http://www.w3.org/2000/svg",xlinkns:"http://www.w3.org/1999/xlink",MAX_PIXEL:15e3,translationParameters:null,symbolMetrics:null,supportUse:null,initialize:function(a){!this.supported()||(OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments),this.translationParameters={x:0,y:0},this.supportUse=navigator.userAgent.toLowerCase().indexOf("applewebkit/5")==-1,this.symbolMetrics={})},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments)},supported:function(){var a="http://www.w3.org/TR/SVG11/feature#";return document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature(a+"SVG","1.1")||document.implementation.hasFeature(a+"BasicStructure","1.1"))},inValidRange:function(a,b,c){var d=a+(c?0:this.translationParameters.x),e=b+(c?0:this.translationParameters.y);return d>=-this.MAX_PIXEL&&d<=this.MAX_PIXEL&&e>=-this.MAX_PIXEL&&e<=this.MAX_PIXEL},setExtent:function(a,b){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var c=this.getResolution(),d=-a.left/c,e=a.top/c;if(b){this.left=d,this.top=e;var f="0 0 "+this.size.w+" "+this.size.h;this.rendererRoot.setAttributeNS(null,"viewBox",f),this.translate(0,0);return!0}var g=this.translate(d-this.left,e-this.top);g||this.setExtent(a,!0);return g},translate:function(a,b){if(!this.inValidRange(a,b,!0))return!1;var c="";if(a||b)c="translate("+a+","+b+")";this.root.setAttributeNS(null,"transform",c),this.translationParameters={x:a,y:b};return!0},setSize:function(a){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":b.externalGraphic?c="image":this.isComplexSymbol(b.graphicName)?c=this.supportUse===!1?"svg":"use":c="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:}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===!1)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");var g=b.graphicWidth||b.graphicHeight,h=b.graphicHeight||b.graphicWidth;g=g?g:b.pointRadius*2,h=h?h:b.pointRadius*2;var i=b.graphicXOffset!=undefined?b.graphicXOffset:-(.5*g),j=b.graphicYOffset!=undefined?b.graphicYOffset:-(.5*h),k=b.graphicOpacity||b.fillOpacity;a.setAttributeNS(null,"x",(f.x+i).toFixed()),a.setAttributeNS(null,"y",(f.y+j).toFixed()),a.setAttributeNS(null,"width",g),a.setAttributeNS(null,"height",h),a.setAttributeNS(this.xlinkns,"href",b.externalGraphic),a.setAttributeNS(null,"style","opacity: "+k)}else if(this.isComplexSymbol(b.graphicName)){var l=b.pointRadius*3,m=l*2,n=this.importSymbol(b.graphicName);f=this.getPosition(a),e=this.symbolMetrics[n][0]*3/m;var o=a.parentNode,p=a.nextSibling;o&&o.removeChild(a);if(this.supportUse===!1){var q=document.getElementById(n);a.firstChild&&a.removeChild(a.firstChild),a.appendChild(q.firstChild.cloneNode(!0)),a.setAttributeNS(null,"viewBox",q.getAttributeNS(null,"viewBox"))}else a.setAttributeNS(this.xlinkns,"href","#"+n);a.setAttributeNS(null,"width",m),a.setAttributeNS(null,"height",m),a.setAttributeNS(null,"x",f.x-l),a.setAttributeNS(null,"y",f.y-l),p?o.insertBefore(a,p):o&&o.appendChild(a)}else a.setAttributeNS(null,"r",b.pointRadius);var r=b.rotation;if((r!==undefined||a._rotation!==undefined)&&f){a._rotation=r,r|=0;if(a.nodeName!=="svg")a.setAttributeNS(null,"transform","rotate("+r+" "+f.x+" "+f.y+")");else{var s=this.symbolMetrics[n];a.firstChild.setAttributeNS(null,"transform","rotate("+b.rotation+" "+s[1]+" "+s[2]+")")}}}c.isFilled?(a.setAttributeNS(null,"fill",b.fillColor),a.setAttributeNS(null,"fill-opacity",b.fillOpacity)):a.setAttributeNS(null,"fill","none"),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||"round"),a.setAttributeNS(null,"stroke-linejoin","round"),b.strokeDashstyle&&a.setAttributeNS(null,"stroke-dasharray",this.dashStyle(b,e))):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){var c=a.strokeWidth*b,d=a.strokeDashstyle;switch(d){case"solid":return"none";case"dot":return[1,4*c].join();case"dash":return[4*c,4*c].join();case"dashdot":return[4*c,4*c,1,4*c].join();case"longdash":return[8*c,4*c].join();case"longdashdot":return[8*c,4*c,1,4*c].join();default:return OpenLayers.String.trim(d).replace(/\s+/g,",")}},createNode:function(a,b){var c=document.createElementNS(this.xmlns,a);b&&c.setAttributeNS(null,"id",b);return c},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,f=this.top-b.y/d;if(this.inValidRange(e,f)){a.setAttributeNS(null,"cx",e),a.setAttributeNS(null,"cy",f),a.setAttributeNS(null,"r",c);return a}return!1},drawLineString:function(a,b){var c=this.getComponentsString(b.components);if(c.path){a.setAttributeNS(null,"points",c.path);return c.complete?a:null}return!1},drawLinearRing:function(a,b){var c=this.getComponentsString(b.components);if(c.path){a.setAttributeNS(null,"points",c.path);return c.complete?a:null}return!1},drawPolygon:function(a,b){var c="",d=!0,e=!0,f,g;for(var h=0,i=b.components.length;h0&&this.getShortString(a[i-1])&&f.push(this.clipLine(a[i],a[i-1])),id)j=(i-g)/(h-f),h=h<0?-d:d,i=g+(h-f)*j;if(i<-e||i>e)j=(h-f)/(i-g),i=i<0?-e:e,h=f+(i-g)*j;return h+","+i},getShortString:function(a){var b=this.getResolution(),c=a.x/b+this.left,d=this.top-a.y/b;return this.inValidRange(c,d)?c+","+d:!1},getPosition:function(a){return{x:parseFloat(a.getAttributeNS(null,"cx")),y:parseFloat(a.getAttributeNS(null,"cy"))}},importSymbol:function(a){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)throw new Error(a+" is not a valid symbol name");var d=this.nodeFactory(b,"symbol"),e=this.nodeFactory(null,"polygon");d.appendChild(e);var f=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0),g=[],h,i;for(var j=0;j=2*c[1])return"longdash";return c[0]==1||c[1]==1?"dot":"dash"}if(c.length==4)return 1*c[0]>=2*c[1]?"longdashdot":"dashdot";return"solid"}},createNode:function(a,b){var c=document.createElement(a);b&&(c.id=b),c.unselectable="on",c.onselectstart=OpenLayers.Function.False;return c},nodeTypeCompare:function(a,b){var c=b,d=c.indexOf(":");d!=-1&&(c=c.substr(d+1));var e=a.nodeName;d=e.indexOf(":"),d!=-1&&(e=e.substr(d+1));return c==e},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|0)-c+"px",a.style.top=(b.y/d-this.offset.y|0)-c+"px";var e=c*2;a.style.width=e+"px",a.style.height=e+"px";return a}return!1},drawLineString:function(a,b){return this.drawLine(a,b,!1)},drawLinearRing:function(a,b){return this.drawLine(a,b,!0)},drawLine:function(a,b,c){this.setNodeDimension(a,b);var d=this.getResolution(),e=b.components.length,f=Array(e),g,h,i;for(var j=0;j0?(e.bottom=e.bottom-k,e.top=e.top+k):(e.left=e.left+k,e.right=e.right-k),c={path:j,size:e.getWidth(),left:e.left,bottom:e.bottom},this.symbolCache[b]=c;return c},CLASS_NAME:"OpenLayers.Renderer.VML"}),OpenLayers.Renderer.VML.LABEL_SHIFT={l:0,c:.5,r:1,t:0,m:.5,b:1},OpenLayers.Tile=OpenLayers.Class({EVENT_TYPES:["loadstart","loadend","reload","unload"],events:null,id:null,layer:null,url:null,bounds:null,size:null,position:null,isLoading:!1,initialize:function(a,b,c,d,e,f){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),OpenLayers.Util.extend(this,f)},unload:function(){this.isLoading&&(this.isLoading=!1,this.events.triggerEvent("unload"))},destroy:function(){this.layer=null,this.bounds=null,this.size=null,this.position=null,this.events.destroy(),this.events=null},clone:function(a){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,b=a&&this.bounds.intersectsBounds(a,!1);this.shouldDraw=b||this.layer.displayOutsideMaxExtent,this.clear();return this.shouldDraw},moveTo:function(a,b,c){c==null&&(c=!0),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);var c=this.layer.map.getLonLatFromLayerPx(a),d=a.clone();d.x+=this.size.w,d.y+=this.size.h;var e=this.layer.map.getLonLatFromLayerPx(d);c.lon>e.lon&&(c.lon<0?c.lon=-180-(c.lon+180):e.lon=180+e.lon+180);var f=new OpenLayers.Bounds(c.lon,e.lat,e.lon,c.lat);return f},showTile:function(){this.shouldDraw&&this.show()},show:function(){},hide:function(){},CLASS_NAME:"OpenLayers.Tile"}),OpenLayers.Control.PanZoomBar=OpenLayers.Class(OpenLayers.Control.PanZoom,{zoomStopWidth:18,zoomStopHeight:11,slider:null,sliderEvents:null,zoombarDiv:null,divEvents:null,zoomWorldIcon:!1,forceFixedZoomLevel:!1,mouseDragStart:null,zoomStart:null,initialize:function(){OpenLayers.Control.PanZoom.prototype.initialize.apply(this,arguments)},destroy:function(){this._removeZoomBar(),this.map.events.un({changebaselayer:this.redraw,scope:this}),OpenLayers.Control.PanZoom.prototype.destroy.apply(this,arguments),delete this.mouseDragStart,delete this.zoomStart},setMap:function(a){OpenLayers.Control.PanZoom.prototype.setMap.apply(this,arguments),this.map.events.register("changebaselayer",this,this.redraw)},redraw:function(){this.div!=null&&(this.removeButtons(),this._removeZoomBar()),this.draw()},draw:function(a){OpenLayers.Control.prototype.draw.apply(this,arguments),a=this.position.clone(),this.buttons=[];var b=new OpenLayers.Size(18,18),c=new OpenLayers.Pixel(a.x+b.w/2,a.y),d=b.w;this.zoomWorldIcon&&(c=new OpenLayers.Pixel(a.x+b.w,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.zoomWorldIcon&&(this._addButton("zoomworld","zoom-world-mini.png",a.add(b.w,0),b),d*=2),this._addButton("panright","east-mini.png",a.add(d,0),b),this._addButton("pandown","south-mini.png",c.add(0,b.h*2),b),this._addButton("zoomin","zoom-plus-mini.png",c.add(0,b.h*3+5),b),c=this._addZoomBar(c.add(0,b.h*4+5)),this._addButton("zoomout","zoom-minus-mini.png",c,b);return this.div},_addZoomBar:function(a){var b=OpenLayers.Util.getImagesLocation(),c=this.id+"_"+this.map.id,d=this.map.getNumZoomLevels()-1-this.map.getZoom(),e=OpenLayers.Util.createAlphaImageDiv(c,a.add(-1,d*this.zoomStopHeight),new OpenLayers.Size(20,9),b+"slider.png","absolute");this.slider=e,this.sliderEvents=new OpenLayers.Events(this,e,null,!0,{includeXY:!0}),this.sliderEvents.on({mousedown:this.zoomBarDown,mousemove:this.zoomBarDrag,mouseup:this.zoomBarUp,dblclick:this.doubleClick,click:this.doubleClick});var f=new OpenLayers.Size;f.h=this.zoomStopHeight*this.map.getNumZoomLevels(),f.w=this.zoomStopWidth;var g=null;if(OpenLayers.Util.alphaHack()){var c=this.id+"_"+this.map.id;g=OpenLayers.Util.createAlphaImageDiv(c,a,new OpenLayers.Size(f.w,this.zoomStopHeight),b+"zoombar.png","absolute",null,"crop"),g.style.height=f.h+"px"}else g=OpenLayers.Util.createDiv("OpenLayers_Control_PanZoomBar_Zoombar"+this.map.id,a,f,b+"zoombar.png");this.zoombarDiv=g,this.divEvents=new OpenLayers.Events(this,g,null,!0,{includeXY:!0}),this.divEvents.on({mousedown:this.divClick,mousemove:this.passEventToSlider,dblclick:this.doubleClick,click:this.doubleClick}),this.div.appendChild(g),this.startTop=parseInt(g.style.top),this.div.appendChild(e),this.map.events.register("zoomend",this,this.moveZoomBar),a=a.add(0,this.zoomStopHeight*this.map.getNumZoomLevels());return a},_removeZoomBar:function(){this.sliderEvents.un({mousedown:this.zoomBarDown,mousemove:this.zoomBarDrag,mouseup:this.zoomBarUp,dblclick:this.doubleClick,click:this.doubleClick}),this.sliderEvents.destroy(),this.divEvents.un({mousedown:this.divClick,mousemove:this.passEventToSlider,dblclick:this.doubleClick,click:this.doubleClick}),this.divEvents.destroy(),this.div.removeChild(this.zoombarDiv),this.zoombarDiv=null,this.div.removeChild(this.slider),this.slider=null,this.map.events.unregister("zoomend",this,this.moveZoomBar)},passEventToSlider:function(a){this.sliderEvents.handleBrowserEvent(a)},divClick:function(a){if(!!OpenLayers.Event.isLeftClick(a)){var b=a.xy.y/this.zoomStopHeight;if(this.forceFixedZoomLevel||!this.map.fractionalZoom)b=Math.floor(b);var c=this.map.getNumZoomLevels()-1-b;c=Math.min(Math.max(c,0),this.map.getNumZoomLevels()-1),this.map.zoomTo(c),OpenLayers.Event.stop(a)}},zoomBarDown:function(a){!OpenLayers.Event.isLeftClick(a)||(this.map.events.on({mousemove:this.passEventToSlider,mouseup:this.passEventToSlider,scope:this}),this.mouseDragStart=a.xy.clone(),this.zoomStart=a.xy.clone(),this.div.style.cursor="move",this.zoombarDiv.offsets=null,OpenLayers.Event.stop(a))},zoomBarDrag:function(a){if(this.mouseDragStart!=null){var b=this.mouseDragStart.y-a.xy.y,c=OpenLayers.Util.pagePosition(this.zoombarDiv);if(a.clientY-c[1]>0&&a.clientY-c[1]0&&c.push(","),c.push(this.writeNewline(),this.writeIndent(),b));this.level-=1,c.push(this.writeNewline(),this.writeIndent(),"]");return c.join("")},string:function(a){var b={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};if(/["\\\x00-\x1f]/.test(a))return'"'+a.replace(/([\x00-\x1f\\"])/g,function(a,c){var d=b[c];if(d)return d;d=c.charCodeAt();return"\\u00"+Math.floor(d/16).toString(16)+(d%16).toString(16)})+'"';return'"'+a+'"'},number:function(a){return isFinite(a)?String(a):"null"},"boolean":function(a){return String(a)},date:function(a){function b(a){return a<10?"0"+a:a}return'"'+a.getFullYear()+"-"+b(a.getMonth()+1)+"-"+b(a.getDate())+"T"+b(a.getHours())+":"+b(a.getMinutes())+":"+b(a.getSeconds())+'"'}},CLASS_NAME:"OpenLayers.Format.JSON"}),OpenLayers.Format.XML=OpenLayers.Class(OpenLayers.Format,{namespaces:null,namespaceAlias:null,defaultPrefix:null,readers:{},writers:{},xmldom:null,initialize:function(a){window.ActiveXObject&&(this.xmldom=new ActiveXObject("Microsoft.XMLDOM")),OpenLayers.Format.prototype.initialize.apply(this,[a]),this.namespaces=OpenLayers.Util.extend({},this.namespaces),this.namespaceAlias={};for(var b in this.namespaces)this.namespaceAlias[this.namespaces[b]]=b},destroy:function(){this.xmldom=null,OpenLayers.Format.prototype.destroy.apply(this,arguments)},setNamespace:function(a,b){this.namespaces[a]=b,this.namespaceAlias[b]=a},read:function(a){var b=a.indexOf("<");b>0&&(a=a.substring(b));var c=OpenLayers.Util.Try(OpenLayers.Function.bind(function(){var b;window.ActiveXObject&&!this.xmldom?b=new ActiveXObject("Microsoft.XMLDOM"):b=this.xmldom,b.loadXML(a);return b},this),function(){return(new DOMParser).parseFromString(a,"text/xml")},function(){var b=new XMLHttpRequest;b.open("GET","data:text/xml;charset=utf-8,"+encodeURIComponent(a),!1),b.overrideMimeType&&b.overrideMimeType("text/xml"),b.send(null);return b.responseXML});this.keepData&&(this.data=c);return c},write:function(a){var b;if(this.xmldom)b=a.xml;else{var c=new XMLSerializer;if(a.nodeType==1){var d=document.implementation.createDocument("","",null);d.importNode&&(a=d.importNode(a,!0)),d.appendChild(a),b=c.serializeToString(d)}else b=c.serializeToString(a)}return b},createElementNS:function(a,b){var c;this.xmldom?typeof a=="string"?c=this.xmldom.createNode(1,b,a):c=this.xmldom.createNode(1,b,""):c=document.createElementNS(a,b);return c},createTextNode:function(a){var b;typeof a!="string"&&(a=String(a)),this.xmldom?b=this.xmldom.createTextNode(a):b=document.createTextNode(a);return b},getElementsByTagNameNS:function(a,b,c){var d=[];if(a.getElementsByTagNameNS)d=a.getElementsByTagNameNS(b,c);else{var e=a.getElementsByTagName("*"),f,g;for(var h=0,i=e.length;h0?(d=a.substring(0,f),e=a.substring(f+1)):(c?d=this.namespaceAlias[c.namespaceURI]:d=this.defaultPrefix,e=a);var g=this.writers[d][e].apply(this,[b]);c&&c.appendChild(g);return g},getChildEl:function(a,b,c){return a&&this.getThisOrNextEl(a.firstChild,b,c)},getNextEl:function(a,b,c){return a&&this.getThisOrNextEl(a.nextSibling,b,c)},getThisOrNextEl:function(a,b,c){outer:for(var d=a;d;d=d.nextSibling)switch(d.nodeType){case 1:if((!b||b===(d.localName||d.nodeName.split(":").pop()))&&(!c||c===d.namespaceURI))break outer;d=null;break outer;case 3:if(/^\s*$/.test(d.nodeValue))break;case 4:case 6:case 12:case 10:case 11:d=null;break outer}return d||null},lookupNamespaceURI:function(a,b){var c=null;if(a)if(a.lookupNamespaceURI)c=a.lookupNamespaceURI(b);else outer:switch(a.nodeType){case 1:if(a.namespaceURI!==null&&a.prefix===b){c=a.namespaceURI;break outer}var d=a.attributes.length;if(d){var e;for(var f=0;f=0;--a)this.controls[a].destroy();this.controls=null}if(this.layers!=null){for(var a=this.layers.length-1;a>=0;--a)this.layers[a].destroy(!1);this.layers=null}this.viewPortDiv&&this.div.removeChild( +this.viewPortDiv),this.viewPortDiv=null,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",e=OpenLayers.Array.filter(this[a],function(a){return a[b]==c||d&&c.test(a[b])});return e},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){var b=null;for(var c=0,d=this.layers.length;cthis.layers.length&&(b=this.layers.length);if(c!=b){this.layers.splice(c,1),this.layers.splice(b,0,a);for(var d=0,e=this.layers.length;d=0;--c)this.removePopup(this.popups[c]);a.map=this,this.popups.push(a);var d=a.draw();d&&(d.style.zIndex=this.Z_INDEX_BASE.Popup+this.popups.length,this.layerContainerDiv.appendChild(d))},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;this.size!=null&&(a=this.size.clone());return a},updateSize:function(){var a=this.getCurrentSize();if(a&&!isNaN(a.h)&&!isNaN(a.w)){this.events.clearMouseCache();var b=this.getSize();b==null&&(this.size=b=a);if(!a.equals(b)){this.size=a;for(var c=0,d=this.layers.length;cthis.restrictedExtent.getWidth()?a=new OpenLayers.LonLat(i.lon,a.lat):h.leftthis.restrictedExtent.right&&(a=a.add(this.restrictedExtent.right-h.right,0)),h.getHeight()>this.restrictedExtent.getHeight()?a=new OpenLayers.LonLat(a.lon,i.lat):h.bottomthis.restrictedExtent.top&&(a=a.add(0,this.restrictedExtent.top-h.top))}}var j=e||this.isValidZoomLevel(b)&&b!=this.getZoom(),k=this.isValidLonLat(a)&&!a.equals(this.center);if(j||k||!d){!this.dragging&&!f&&this.events.triggerEvent("movestart"),k&&(!j&&this.center&&this.centerLayerContainer(a),this.center=a.clone());if(j||this.layerContainerOrigin==null)this.layerContainerOrigin=this.center.clone(),this.layerContainerDiv.style.left="0px",this.layerContainerDiv.style.top="0px";j&&(this.zoom=b,this.resolution=this.getResolutionForZoom(b),this.viewRequestID++);var l=this.getExtent();this.baseLayer.visibility&&(this.baseLayer.moveTo(l,j,d),d?this.baseLayer.events.triggerEvent("move"):this.baseLayer.events.triggerEvent("moveend",{zoomChanged:j})),l=this.baseLayer.getExtent();for(var m=0,n=this.layers.length;m=0&&a0&&(a=this.layers[0].getResolution());return a},getUnits:function(){var a=null;this.baseLayer!=null&&(a=this.baseLayer.units);return a},getScale:function(){var a=null;if(this.baseLayer!=null){var b=this.getResolution(),c=this.baseLayer.units;a=OpenLayers.Util.getScaleFromResolution(b,c)}return a},getZoomForExtent:function(a,b){var c=null;this.baseLayer!=null&&(c=this.baseLayer.getZoomForExtent(a,b));return c},getResolutionForZoom:function(a){var b=null;this.baseLayer&&(b=this.baseLayer.getResolutionForZoom(a));return b},getZoomForResolution:function(a,b){var c=null;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){var d=this.getMaxExtent();a=a.clone();while(a.right0){var f=d.indexOf("?")>-1?"&":"?";d+=f+e}}a.proxy&&d.indexOf("http")==0&&(typeof a.proxy=="function"?d=a.proxy(d):d=a.proxy+encodeURIComponent(d)),c.open(a.method,d,a.async,a.user,a.password);for(var g in a.headers)c.setRequestHeader(g,a.headers[g]);var h=this.events,i=this;c.onreadystatechange=function(){if(c.readyState==OpenLayers.Request.XMLHttpRequest.DONE){var b=h.triggerEvent("complete",{request:c,config:a,requestUrl:d});b!==!1&&i.runCallbacks({request:c,config:a,requestUrl:d})}},a.async===!1?c.send(a.data):window.setTimeout(function(){c._aborted!==!0&&c.send(a.data)},0);return c},runCallbacks:function(a){var b=a.request,c=a.config,d=c.scope?OpenLayers.Function.bind(c.callback,c.scope):c.callback,e;c.success&&(e=c.scope?OpenLayers.Function.bind(c.success,c.scope):c.success);var f;c.failure&&(f=c.scope?OpenLayers.Function.bind(c.failure,c.scope):c.failure),d(b);if(!b.status||b.status>=200&&b.status<300)this.events.triggerEvent("success",a),e&&e(b);b.status&&(b.status<200||b.status>=300)&&(this.events.triggerEvent("failure",a),f&&f(b))},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)}},OpenLayers.Tile.Image=OpenLayers.Class(OpenLayers.Tile,{url:null,imgDiv:null,frame:null,layerAlphaHack:null,isBackBuffer:!1,lastRatio:1,isFirstDraw:!0,backBufferTile:null,maxGetUrlLength:null,initialize:function(a,b,c,d,e,f){OpenLayers.Tile.prototype.initialize.apply(this,arguments),this.maxGetUrlLength!=null&&OpenLayers.Util.extend(this,OpenLayers.Tile.Image.IFrame),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()},destroy:function(){this.imgDiv!=null&&this.removeImgDiv(),this.imgDiv=null,this.frame!=null&&this.frame.parentNode==this.layer.div&&this.layer.div.removeChild(this.frame),this.frame=null,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){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(){this.layer!=this.layer.map.baseLayer&&this.layer.reproject&&(this.bounds=this.getBoundsFromBaseLayer(this.position));var a=OpenLayers.Tile.prototype.draw.apply(this,arguments);OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1||this.layer.singleTile?a?(this.backBufferTile||(this.backBufferTile=this.clone(),this.backBufferTile.hide(),this.backBufferTile.isBackBuffer=!0,this.events.register("loadend",this,this.resetBackBuffer),this.layer.events.register("loadend",this,this.resetBackBuffer)),this.startTransition()):this.backBufferTile&&this.backBufferTile.clear():a&&this.isFirstDraw&&(this.events.register("loadend",this,this.showTile),this.isFirstDraw=!1);if(!a)return!1;this.isLoading?this.events.triggerEvent("reload"):(this.isLoading=!0,this.events.triggerEvent("loadstart"));return this.renderTile()},resetBackBuffer:function(){this.showTile();if(this.backBufferTile&&(this.isFirstDraw||!this.layer.numLoadingTiles)){this.isFirstDraw=!1;var a=this.layer.maxExtent,b=a&&this.bounds.intersectsBounds(a,!1);b&&(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(){this.layer.async?(this.initImgDiv(),this.layer.getURLasync(this.bounds,this,"url",this.positionImage)):(this.url=this.layer.getURL(this.bounds),this.initImgDiv(),this.positionImage());return!0},positionImage:function(){if(this.layer!==null){OpenLayers.Util.modifyDOMElement(this.frame,null,this.position,this.size);var a=this.layer.getImageSize(this.bounds);this.layerAlphaHack?OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv,null,null,a,this.url):(OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,a),this.imgDiv.src=this.url)}},clear:function(){this.imgDiv&&(this.hide(),OpenLayers.Tile.Image.useBlankTile&&(this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif"))},initImgDiv:function(){if(this.imgDiv==null){var a=this.layer.imageOffset,b=this.layer.getImageSize(this.bounds);this.layerAlphaHack?this.imgDiv=OpenLayers.Util.createAlphaImageDiv(null,a,b,null,"relative",null,null,null,!0):this.imgDiv=OpenLayers.Util.createImage(null,a,b,null,"relative",null,null,!0),this.layer.url instanceof Array&&(this.imgDiv.urls=this.layer.url.slice()),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(){this.isLoading&&(this.isLoading=!1,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));var d=function(){this.imgDiv._attempts>OpenLayers.IMAGE_RELOAD_ATTEMPTS&&c.call(this)};OpenLayers.Event.observe(this.imgDiv,"error",OpenLayers.Function.bind(d,this))}this.imgDiv.viewRequestID=this.layer.map.viewRequestID},removeImgDiv:function(){OpenLayers.Event.stopObservingElement(this.imgDiv),this.imgDiv.parentNode==this.frame&&(this.frame.removeChild(this.imgDiv),this.imgDiv.map=null),this.imgDiv.urls=null;var a=this.imgDiv.firstChild;a?(OpenLayers.Event.stopObservingElement(a),this.imgDiv.removeChild(a),delete a):this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif"},checkImgURL:function(){if(this.layer){var a=this.layerAlphaHack?this.imgDiv.firstChild.src:this.imgDiv.src;OpenLayers.Util.isEquivalentUrl(a,this.url)||this.hide()}},startTransition:function(){if(!!this.backBufferTile&&!!this.backBufferTile.imgDiv){var a=1;this.backBufferTile.resolution&&(a=this.backBufferTile.resolution/this.layer.getResolution());if(a!=this.lastRatio){if(this.layer.transitionEffect=="resize"){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),d=this.layer.map.getLayerPxFromLonLat(b);OpenLayers.Util.modifyDOMElement(this.backBufferTile.frame,null,d,c);var e=this.backBufferTile.imageSize;e=new OpenLayers.Size(e.w*a,e.h*a);var f=this.backBufferTile.imageOffset;f&&(f=new OpenLayers.Pixel(f.x*a,f.y*a)),OpenLayers.Util.modifyDOMElement(this.backBufferTile.imgDiv,null,f,e),this.backBufferTile.show()}}else this.layer.singleTile?this.backBufferTile.show():this.backBufferTile.hide();this.lastRatio=a}},show:function(){this.frame.style.display="",OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1&&OpenLayers.IS_GECKO===!0&&(this.frame.scrollLeft=this.frame.scrollLeft)},hide:function(){this.frame.style.display="none"},CLASS_NAME:"OpenLayers.Tile.Image"}),OpenLayers.Tile.Image.useBlankTile=OpenLayers.BROWSER_NAME=="safari"||OpenLayers.BROWSER_NAME=="opera",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.layer!=null&&this.marker!=null&&this.layer.removeMarker(this.marker),this.layer=null,this.id=null,this.lonlat=null,this.data=null,this.marker!=null&&(this.destroyMarker(this.marker),this.marker=null),this.popup!=null&&(this.destroyPopup(this.popup),this.popup=null)},onScreen:function(){var a=!1;if(this.layer!=null&&this.layer.map!=null){var b=this.layer.map.getExtent();a=b.containsLonLat(this.lonlat)}return a},createMarker:function(){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;this.popup||(this.popup=new this.popupClass(b,this.lonlat,this.data.popupSize,this.data.popupContentHTML,c,a)),this.data.overflow!=null&&(this.popup.contentDiv.style.overflow=this.data.overflow),this.popup.feature=this}return this.popup},destroyPopup:function(){this.popup&&(this.popup.feature=null,this.popup.destroy(),this.popup=null)},CLASS_NAME:"OpenLayers.Feature"}),OpenLayers.Handler.Click=OpenLayers.Class(OpenLayers.Handler,{delay:300,single:!0,"double":!1,pixelTolerance:0,stopSingle:!1,stopDouble:!1,timerId:null,down:null,rightclickTimerId:null,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments),this.pixelTolerance!=null&&(this.mousedown=function(a){this.down=a.xy;return!0})},mousedown:null,mouseup:function(a){var b=!0;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}var b=this["double"]?OpenLayers.Util.extend({},a):this.callback("rightclick",[a]),c=OpenLayers.Function.bind(this.delayedRightCall,this,b);this.rightclickTimerId=window.setTimeout(c,this.delay)}return!this.stopSingle},delayedRightCall:function(a){this.rightclickTimerId=null,a&&this.callback("rightclick",[a]);return!this.stopSingle},dblclick:function(a){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{var b=this.single?OpenLayers.Util.extend({},a):null;this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,b),this.delay)}return!this.stopSingle},passesTolerance:function(a){var b=!0;if(this.pixelTolerance!=null&&this.down){var c=Math.sqrt(Math.pow(this.down.x-a.xy.x,2)+Math.pow(this.down.y-a.xy.y,2));c>this.pixelTolerance&&(b=!1)}return b},clearTimer:function(){this.timerId!=null&&(window.clearTimeout(this.timerId),this.timerId=null),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=!1;OpenLayers.Handler.prototype.deactivate.apply(this,arguments)&&(this.clearTimer(),this.down=null,a=!0);return a},CLASS_NAME:"OpenLayers.Handler.Click"}),OpenLayers.Handler.Drag=OpenLayers.Class(OpenLayers.Handler,{started:!1,stopDown:!0,dragging:!1,last:null,start:null,oldOnselectstart:null,interval:0,timeoutId:null,documentDrag:!1,documentEvents:null,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments)},down:function(a){},move:function(a){},up:function(a){},out:function(a){},mousedown:function(a){var b=!0;this.dragging=!1,this.checkModifiers(a)&&OpenLayers.Event.isLeftClick(a)?(this.started=!0,this.start=a.xy,this.last=a.xy,OpenLayers.Element.addClass(this.map.viewPortDiv,"olDragDown"),this.down(a),this.callback("down",[a.xy]),OpenLayers.Event.stop(a),this.oldOnselectstart||(this.oldOnselectstart=document.onselectstart?document.onselectstart:OpenLayers.Function.True),document.onselectstart=OpenLayers.Function.False,b=!this.stopDown):(this.started=!1,this.start=null,this.last=null);return b},mousemove:function(a){this.started&&!this.timeoutId&&(a.xy.x!=this.last.x||a.xy.y!=this.last.y)&&(this.documentDrag===!0&&this.documentEvents&&(a.element===document?(this.adjustXY(a),this.setEvent(a)):this.destroyDocumentEvents()),this.interval>0&&(this.timeoutId=setTimeout(OpenLayers.Function.bind(this.removeTimeout,this),this.interval)),this.dragging=!0,this.move(a),this.callback("move",[a.xy]),this.oldOnselectstart||(this.oldOnselectstart=document.onselectstart,document.onselectstart=OpenLayers.Function.False),this.last=this.evt.xy);return!0},removeTimeout:function(){this.timeoutId=null},mouseup:function(a){if(this.started){this.documentDrag===!0&&this.documentEvents&&(this.adjustXY(a),this.destroyDocumentEvents());var b=this.start!=this.last;this.started=!1,this.dragging=!1,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!0},mouseout:function(a){if(this.started&&OpenLayers.Util.mouseLeft(a,this.map.div))if(this.documentDrag===!0)this.documentEvents=new OpenLayers.Events(this,document,null,null,{includeXY:!0}),this.documentEvents.on({mousemove:this.mousemove,mouseup:this.mouseup}),OpenLayers.Element.addClass(document.body,"olDragDown");else{var b=this.start!=this.last;this.started=!1,this.dragging=!1,OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown"),this.out(a),this.callback("out",[]),b&&this.callback("done",[a.xy]),document.onselectstart&&(document.onselectstart=this.oldOnselectstart)}return!0},click:function(a){return this.start==this.last},activate:function(){var a=!1;OpenLayers.Handler.prototype.activate.apply(this,arguments)&&(this.dragging=!1,a=!0);return a},deactivate:function(){var a=!1;OpenLayers.Handler.prototype.deactivate.apply(this,arguments)&&(this.started=!1,this.dragging=!1,this.start=null,this.last=null,a=!0,OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown"));return a},adjustXY:function(a){var b=OpenLayers.Util.pagePosition(this.map.viewPortDiv);a.xy.x-=b[0],a.xy.y-=b[1]},destroyDocumentEvents:function(){OpenLayers.Element.removeClass(document.body,"olDragDown"),this.documentEvents.destroy(),this.documentEvents=null},CLASS_NAME:"OpenLayers.Handler.Drag"}),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:!0,stopDown:!0,stopUp:!1,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:!0},mouseup:function(a){this.up=a.xy;return this.handle(a)?!this.stopUp:!0},click:function(a){return this.handle(a)?!this.stopClick:!0},mousemove:function(a){if(!this.callbacks.over&&!this.callbacks.out)return!0;this.handle(a);return!0},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){this.feature&&!this.feature.layer&&(this.feature=null);var b=a.type,c=!1,d=!!this.feature,e=b=="click"||b=="dblclick";this.feature=this.layer.getFeatureFromEvent(a),this.feature&&!this.feature.layer&&(this.feature=null),this.lastFeature&&!this.lastFeature.layer&&(this.lastFeature=null);if(this.feature){var f=this.feature!=this.lastFeature;this.geometryTypeMatches(this.feature)?(d&&f?(this.lastFeature&&this.triggerCallback(b,"out",[this.lastFeature]),this.triggerCallback(b,"in",[this.feature])):(!d||e)&&this.triggerCallback(b,"in",[this.feature]),this.lastFeature=this.feature,c=!0):(this.lastFeature&&(d&&f||e)&&this.triggerCallback(b,"out",[this.lastFeature]),this.feature=null)}else this.lastFeature&&(d||e)&&this.triggerCallback(b,"out",[this.lastFeature]);return c},triggerCallback:function(a,b,c){var d=this.EVENTMAP[a][b];if(d)if(a=="click"&&this.up&&this.down){var e=Math.sqrt(Math.pow(this.up.x-this.down.x,2)+Math.pow(this.up.y-this.down.y,2));e<=this.clickTolerance&&this.callback(d,c)}else this.callback(d,c)},activate:function(){var a=!1;OpenLayers.Handler.prototype.activate.apply(this,arguments)&&(this.moveLayerToTop(),this.map.events.on({removelayer:this.handleMapEvents,changelayer:this.handleMapEvents,scope:this}),a=!0);return a},deactivate:function(){var a=!1;OpenLayers.Handler.prototype.deactivate.apply(this,arguments)&&(this.moveLayerBack(),this.feature=null,this.lastFeature=null,this.down= +null,this.up=null,this.map.events.un({removelayer:this.handleMapEvents,changelayer:this.handleMapEvents,scope:this}),a=!0);return a},handleMapEvents:function(a){(!a.property||a.property=="order")&&this.moveLayerToTop()},moveLayerToTop:function(){var a=Math.max(this.map.Z_INDEX_BASE.Feature-1,this.layer.getZIndex())+1;this.layer.setZIndex(a)},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.Hover=OpenLayers.Class(OpenLayers.Handler,{delay:500,pixelTolerance:null,stopMove:!1,px:null,timerId:null,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments)},mousemove:function(a){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){OpenLayers.Util.mouseLeft(a,this.map.div)&&(this.clearTimer(),this.callback("move",[a]));return!0},passesTolerance:function(a){var b=!0;if(this.pixelTolerance&&this.px){var c=Math.sqrt(Math.pow(this.px.x-a.x,2)+Math.pow(this.px.y-a.y,2));c=0){this.initResolutions();break}}},onMapResize:function(){},redraw:function(){var a=!1;if(this.map){this.inRange=this.calculateInRange();var b=this.getExtent();if(b&&this.inRange&&this.visibility){var c=!0;this.moveTo(b,c,!1),this.events.triggerEvent("moveend",{zoomChanged:c}),a=!0}}return a},moveTo:function(a,b,c){var d=this.visibility;this.isBaseLayer||(d=d&&this.inRange),this.display(d)},setMap:function(a){if(this.map==null){this.map=a,this.maxExtent=this.maxExtent||this.map.maxExtent,this.minExtent=this.minExtent||this.map.minExtent,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();var b=this.visibility&&this.inRange;this.div.style.display=b?"":"none"}this.setTileSize()}},afterAdd:function(){},removeMap:function(a){},getImageSize:function(a){return this.imageSize||this.tileSize},setTileSize:function(a){var b=a?a:this.tileSize?this.tileSize:this.map.getTileSize();this.tileSize=b,this.gutter&&(this.imageOffset=new OpenLayers.Pixel(-this.gutter,-this.gutter),this.imageSize=new OpenLayers.Size(b.w+2*this.gutter,b.h+2*this.gutter))},getVisibility:function(){return this.visibility},setVisibility:function(a){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){a!=(this.div.style.display!="none")&&(this.div.style.display=a&&this.calculateInRange()?"block":"none")},calculateInRange:function(){var a=!1;if(this.alwaysInRange)a=!0;else if(this.map){var b=this.map.getResolution();a=b>=this.minResolution&&b<=this.maxResolution}return a},setIsBaseLayer:function(a){a!=this.isBaseLayer&&(this.isBaseLayer=a,this.map!=null&&this.map.events.triggerEvent("changebaselayer",{layer:this}))},initResolutions:function(){var a,b,c={},d=!0;for(a=0,b=this.RESOLUTION_PROPERTIES.length;a=a&&(f=h,d=i);if(h<=a){g=h,e=i;break}}var k=f-g;k>0?c=d+(f-a)/k:c=d}else{var l,m=Number.POSITIVE_INFINITY;for(var i=0,j=this.resolutions.length;im)break;m=l}else if(this.resolutions[i]4?this._object.open(a,d,g,j,k):arguments.length>3?this._object.open(a,d,g,j):this._object.open(a,d,g),!b&&!c&&(this.readyState=e.OPENED,f(this)),this._object.onreadystatechange=function(){if(!b||!!g){l.readyState=l._object.readyState,h(l);if(l._aborted){l.readyState=e.UNSENT;return}l.readyState==e.DONE&&(i(l),c&&g&&window.detachEvent("onunload",n)),m!=l.readyState&&f(l),m=l.readyState}}},e.prototype.send=function(a){e.onsend&&e.onsend.apply(this,arguments),a&&a.nodeType&&(a=window.XMLSerializer?(new window.XMLSerializer).serializeToString(a):a.xml,this._headers["Content-Type"]||this._object.setRequestHeader("Content-Type","application/xml")),this._object.send(a);if(b&&!this._async){this.readyState=e.OPENED,h(this);while(this.readyStatee.UNSENT&&(this._aborted=!0),this._object.abort(),i(this)},e.prototype.getAllResponseHeaders=function(){return this._object.getAllResponseHeaders()},e.prototype.getResponseHeader=function(a){return this._object.getResponseHeader(a)},e.prototype.setRequestHeader=function(a,b){this._headers||(this._headers={}),this._headers[a]=b;return this._object.setRequestHeader(a,b)},e.prototype.addEventListener=function(a,b,c){for(var d=0,e;e=this._listeners[d];d++)if(e[0]==a&&e[1]==b&&e[2]==c)return;this._listeners.push([a,b,c])},e.prototype.removeEventListener=function(a,b,c){for(var d=0,e;e=this._listeners[d];d++)if(e[0]==a&&e[1]==b&&e[2]==c)break;e&&this._listeners.splice(d,1)},e.prototype.dispatchEvent=function(a){var b={type:a.type,target:this,currentTarget:this,eventPhase:2,bubbles:a.bubbles,cancelable:a.cancelable,timeStamp:a.timeStamp,stopPropagation:function(){},preventDefault:function(){},initEvent:function(){}};b.type=="readystatechange"&&this.onreadystatechange&&(this.onreadystatechange.handleEvent||this.onreadystatechange).apply(this,[b]);for(var c=0,d;d=this._listeners[c];c++)d[0]==b.type&&!d[2]&&(d[1].handleEvent||d[1]).apply(this,[b])},e.prototype.toString=function(){return"[object XMLHttpRequest]"},e.toString=function(){return"[XMLHttpRequest]"},window.Function.prototype.apply||(window.Function.prototype.apply=function(a,b){b||(b=[]),a.__func=this,a.__func(b[0],b[1],b[2],b[3],b[4]),delete a.__func}),OpenLayers.Request.XMLHttpRequest=e}(),OpenLayers.Control.DragPan=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,panned:!1,interval:25,documentDrag:!1,draw:function(){this.handler=new OpenLayers.Handler.Drag(this,{move:this.panMap,done:this.panMapDone},{interval:this.interval,documentDrag:this.documentDrag})},panMap:function(a){this.panned=!0,this.map.pan(this.handler.last.x-a.x,this.handler.last.y-a.y,{dragging:this.handler.dragging,animate:!1})},panMapDone:function(a){this.panned&&(this.panMap(a),this.panned=!1)},CLASS_NAME:"OpenLayers.Control.DragPan"}),OpenLayers.Control.KeyboardDefaults=OpenLayers.Class(OpenLayers.Control,{autoActivate:!0,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})},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:var b=this.map.getSize();this.map.pan(0,-0.75*b.h);break;case 34:var b=this.map.getSize();this.map.pan(0,.75*b.h);break;case 35:var b=this.map.getSize();this.map.pan(.75*b.w,0);break;case 36:var b=this.map.getSize();this.map.pan(-0.75*b.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()}},CLASS_NAME:"OpenLayers.Control.KeyboardDefaults"}),OpenLayers.State={UNKNOWN:"Unknown",INSERT:"Insert",UPDATE:"Update",DELETE:"Delete"},OpenLayers.Feature.Vector=OpenLayers.Class(OpenLayers.Feature,{fid:null,geometry:null,attributes:null,bounds:null,state:null,style:null,url:null,renderIntent:"default",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={},b&&(this.attributes=OpenLayers.Util.extend(this.attributes,b)),this.style=c?c:null},destroy:function(){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=!1;if(this.layer&&this.layer.map){var c=this.layer.map.getExtent();if(a){var d=this.geometry.getBounds();b=c.intersectsBounds(d)}else{var e=c.toGeometry();b=e.intersects(this.geometry)}}return b},getVisibility:function(){return!(this.style&&this.style.display=="none"||!this.layer||this.layer&&this.layer.styleMap&&this.layer.styleMap.createSymbolizer(this,this.renderIntent).display=="none"||this.layer&&!this.layer.getVisibility())},createMarker:function(){return null},destroyMarker:function(){},createPopup:function(){return null},atPoint:function(a,b,c){var d=!1;this.geometry&&(d=this.geometry.atPoint(a,b,c));return d},destroyPopup:function(){},move:function(a){if(!!this.layer&&!!this.geometry.move){var b;a.CLASS_NAME=="OpenLayers.LonLat"?b=this.layer.getViewPortPxFromLonLat(a):b=a;var c=this.layer.getViewPortPxFromLonLat(this.geometry.getBounds().getCenterLonLat()),d=this.layer.map.getResolution();this.geometry.move(d*(b.x-c.x),d*(c.y-b.y)),this.layer.drawFeature(this);return c}},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:}else if(a==OpenLayers.State.INSERT)switch(this.state){case OpenLayers.State.UNKNOWN:break;default:this.state=a}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}else a==OpenLayers.State.UNKNOWN&&(this.state=a)},CLASS_NAME:"OpenLayers.Feature.Vector"}),OpenLayers.Feature.Vector.style={"default":{fillColor:"#ee9900",fillOpacity:.4,hoverFillColor:"white",hoverFillOpacity:.8,strokeColor:"#ee9900",strokeOpacity:1,strokeWidth:1,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},select:{fillColor:"blue",fillOpacity:.4,hoverFillColor:"white",hoverFillOpacity:.8,strokeColor:"blue",strokeOpacity:1,strokeWidth:2,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"pointer"},temporary:{fillColor:"#66cccc",fillOpacity:.2,hoverFillColor:"white",hoverFillOpacity:.8,strokeColor:"#66cccc",strokeOpacity:1,strokeLinecap:"round",strokeWidth:2,strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},"delete":{display:"none"}},OpenLayers.Handler.Box=OpenLayers.Class(OpenLayers.Handler,{dragHandler:null,boxDivClassName:"olHandlerBoxZoomBox",boxCharacteristics:null,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments);var b={down:this.startBox,move:this.moveBox,out:this.removeBox,up:this.endBox};this.dragHandler=new OpenLayers.Handler.Drag(this,b,{keyMask:this.keyMask})},destroy:function(){this.dragHandler&&(this.dragHandler.destroy(),this.dragHandler=null),OpenLayers.Handler.prototype.destroy.apply(this,arguments)},setMap:function(a){OpenLayers.Handler.prototype.setMap.apply(this,arguments),this.dragHandler&&this.dragHandler.setMap(a)},startBox:function(a){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.xb&&(this.zoomBox.style.width=Math.max(1,d-f.xOffset)+"px"),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,d=Math.min(c.y,a.y),e=Math.max(c.y,a.y),f=Math.min(c.x,a.x),g=Math.max(c.x,a.x);b=new OpenLayers.Bounds(f,e,g,d)}else b=this.dragHandler.start.clone();this.removeBox(),this.callback("done",[b])},removeBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox),this.zoomBox=null,this.boxCharacteristics=null,OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDrawBox")},activate:function(){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragHandler.activate();return!0}return!1},deactivate:function(){if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.dragHandler.deactivate();return!0}return!1},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.BROWSER_NAME=="msie"?document.compatMode!="BackCompat":!0;this.boxCharacteristics={xOffset:a,yOffset:b,newBoxModel:c}}return this.boxCharacteristics},CLASS_NAME:"OpenLayers.Handler.Box"}),OpenLayers.Handler.RegularPolygon=OpenLayers.Class(OpenLayers.Handler.Drag,{sides:4,radius:null,snapAngle:null,snapToggle:"shiftKey",layerOptions:null,persist:!1,irregular:!1,angle:null,fixedRadius:!1,feature:null,layer:null,origin:null,initialize:function(a,b,c){c&&c.layerOptions&&c.layerOptions.styleMap||(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=!1;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){var b=OpenLayers.Util.extend({displayInLayerSwitcher:!1,calculateInRange:OpenLayers.Function.True},this.layerOptions);this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,b),this.map.addLayer(this.layer),a=!0}return a},deactivate:function(){var a=!1;OpenLayers.Handler.Drag.prototype.deactivate.apply(this,arguments)&&(this.dragging&&this.cancel(),this.layer.map!=null&&(this.layer.destroy(!1),this.feature&&this.feature.destroy()),this.layer=null,this.feature=null,a=!0);return a},down:function(a){this.fixedRadius=!!this.radius;var b=this.map.getLonLatFromPixel(a.xy);this.origin=new OpenLayers.Geometry.Point(b.lon,b.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:!0}),this.layer.drawFeature(this.feature,this.style)},move:function(a){var b=this.map.getLonLatFromPixel(a.xy),c=new OpenLayers.Geometry.Point(b.lon,b.lat);if(this.irregular){var d=Math.sqrt(2)*Math.abs(c.y-this.origin.y)/2;this.radius=Math.max(this.map.getResolution()/2,d)}else this.fixedRadius?this.origin=c:(this.calculateAngle(c,a),this.radius=Math.max(this.map.getResolution()/2,c.distanceTo(this.origin)));this.modifyGeometry();if(this.irregular){var e=c.x-this.origin.x,f=c.y-this.origin.y,g;f==0?g=e/(this.radius*Math.sqrt(2)):g=e/f,this.feature.geometry.resize(1,this.origin,g),this.feature.geometry.move(e/2,f/2)}this.layer.drawFeature(this.feature,this.style)},up:function(a){this.finalize(),this.start==this.last&&this.callback("done",[a.xy])},out:function(a){this.finalize()},createGeometry:function(){this.angle=Math.PI*(1/this.sides-.5),this.snapAngle&&(this.angle+=this.snapAngle*(Math.PI/180)),this.feature.geometry=OpenLayers.Geometry.Polygon.createRegularPolygon(this.origin,this.radius,this.sides,this.snapAngle)},modifyGeometry:function(){var a,b,c=this.feature.geometry.components[0];c.components.length!=this.sides+1&&(this.createGeometry(),c=this.feature.geometry.components[0]);for(var d=0;d0&&g.push(","),c=b[h].geometry,d=c.CLASS_NAME.split(".")[2].toLowerCase();if(!this.extract[d])return null;this.internalProjection&&this.externalProjection&&(c=c.clone(),c.transform(this.internalProjection,this.externalProjection)),e=this.extract[d].apply(this,[c]),g.push(d.toUpperCase()+"("+e+")")}f&&g.push(")");return g.join("")},extract:{point:function(a){return a.x+" "+a.y},multipoint:function(a){var b=[];for(var c=0,d=a.components.length;c=a.bottom-m*this.buffer||p=0&&h=0&&(i=this.grid[g][h]),i!=null&&!i.queued?(a.unshift(i),i.queued=!0,f=0,c=g,d=h):(e=(e+1)%4,f++)}for(var j=0,k=a.length;j-this.tileSize.w*(b-1))this.shiftColumn(!0);else if(d.x<-this.tileSize.w*b)this.shiftColumn(!1);else if(d.y>-this.tileSize.h*(b-1))this.shiftRow(!0);else if(d.y<-this.tileSize.h*b)this.shiftRow(!1);else break}},shiftRow:function(a){var b=a?0:this.grid.length-1,c=this.grid,d=c[b],e=this.map.getResolution(),f=a?-this.tileSize.h:this.tileSize.h,g=e*-f,h=a?c.pop():c.shift();for(var i=0,j=d.length;ia){var c=this.grid.pop();for(var d=0,e=c.length;db)for(var d=0,e=this.grid.length;d0){g=!0;for(var h=0,i=f.length;h0&&g==!1&&(b.display="none");return b},applySymbolizer:function(a,b,c){var d=c.geometry?this.getSymbolizerPrefix(c.geometry):OpenLayers.Style.SYMBOLIZER_PREFIXES[0],e=a.symbolizer[d]||a.symbolizer;if(this.defaultsPerSymbolizer===!0){var f=this.defaultStyle;OpenLayers.Util.applyDefaults(e,{pointRadius:f.pointRadius}),(e.stroke===!0||e.graphic===!0)&&OpenLayers.Util.applyDefaults(e,{strokeWidth:f.strokeWidth,strokeColor:f.strokeColor,strokeOpacity:f.strokeOpacity,strokeDashstyle:f.strokeDashstyle,strokeLinecap:f.strokeLinecap}),(e.fill===!0||e.graphic===!0)&&OpenLayers.Util.applyDefaults(e,{fillColor:f.fillColor,fillOpacity:f.fillOpacity}),e.graphic===!0&&OpenLayers.Util.applyDefaults(e,{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,e),c)},createLiterals:function(a,b){var c=OpenLayers.Util.extend({},b.attributes||b.data);OpenLayers.Util.extend(c,this.context);for(var d in this.propertyStyles)a[d]=OpenLayers.Style.createLiteral(a[d],c,b,d);return a},findPropertyStyles:function(){var a={},b=this.defaultStyle;this.addPropertyStyles(a,b);var c=this.rules,d,e;for(var f=0,g=c.length;f=0&&p<=1&&q>=0&&q<=1)if(!d)f=!0;else{var r=a.x1+p*i,s=a.y1+p*j;f=new OpenLayers.Geometry.Point(r,s)}}if(e){var t;if(f){if(d){var u=[a,b],v,r,s;outer:for(var w=0;w<2;++w){v=u[w];for(var x=1;x<3;++x){r=v["x"+x],s=v["y"+x],t=Math.sqrt(Math.pow(r-f.x,2)+Math.pow(s-f.y,2));if(t=1?(l=g,m=h):(l=e+k*i,m=f+k*j);return{distance:Math.sqrt(Math.pow(l-c,2)+Math.pow(m-d,2)),x:l,y:m}},OpenLayers.Layer.TMS=OpenLayers.Class(OpenLayers.Layer.Grid,{serviceVersion:"1.0.0",isBaseLayer:!0,tileOrigin:null,serverResolutions:null,zoomOffset:0,initialize:function(a,b,c){var d=[];d.push(a,b,{},c),OpenLayers.Layer.Grid.prototype.initialize.apply(this,d)},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments)},clone:function(a){a==null&&(a=new OpenLayers.Layer.TMS(this.name,this.url,this.getOptions())),a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a]);return a},getURL:function(a){a=this.adjustBounds(a);var b=this.map.getResolution(),c=Math.round((a.left-this.tileOrigin.lon)/(b*this.tileSize.w)),d=Math.round((a.bottom-this.tileOrigin.lat)/(b*this.tileSize.h)),e=this.serverResolutions!=null?OpenLayers.Util.indexOf(this.serverResolutions,b):this.map.getZoom()+this.zoomOffset,f=this.serviceVersion+"/"+this.layername+"/"+e+"/"+c+"/"+d+"."+this.type,g=this.url;g instanceof Array&&(g=this.selectUrl(f,g));return g+f},addTile:function(a,b){return new OpenLayers.Tile.Image(this,b,a,null,this.tileSize)},setMap:function(a){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments),this.tileOrigin||(this.tileOrigin=new OpenLayers.LonLat(this.map.maxExtent.left,this.map.maxExtent.bottom))},CLASS_NAME:"OpenLayers.Layer.TMS"}),OpenLayers.Layer.XYZ=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:!0,sphericalMercator:!1,zoomOffset:0,initialize:function(a,b,c){if(c&&c.sphericalMercator||this.sphericalMercator)c=OpenLayers.Util.extend({maxExtent:new OpenLayers.Bounds(-20037508.3392,-20037508.3392,20037508.3392,20037508.3392),maxResolution:156543.0339,numZoomLevels:19,units:"m",projection:"EPSG:900913"},c);b=b||this.url,a=a||this.name;var d=[a,b,{},c];OpenLayers.Layer.Grid.prototype.initialize.apply(this,d)},clone:function(a){a==null&&(a=new OpenLayers.Layer.XYZ(this.name,this.url,this.getOptions())),a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a]);return a},getURL:function(a){var b=this.map.getResolution(),c=Math.round((a.left-this.maxExtent.left)/(b*this.tileSize.w)),d=Math.round((this.maxExtent.top-a.top)/(b*this.tileSize.h)),e=this.map.getZoom()+this.zoomOffset,f=this.url,g=""+c+d+e;f instanceof Array&&(f=this.selectUrl(g,f));var h=OpenLayers.String.format(f,{x:c,y:d,z:e});return h},addTile:function(a,b){return new OpenLayers.Tile.Image(this,b,a,null,this.tileSize)},setMap:function(a){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments),this.tileOrigin||(this.tileOrigin=new OpenLayers.LonLat(this.maxExtent.left,this.maxExtent.bottom))},CLASS_NAME:"OpenLayers.Layer.XYZ"}),OpenLayers.Layer.OSM=OpenLayers.Class(OpenLayers.Layer.XYZ,{name:"OpenStreetMap",attribution:"Data CC-By-SA by OpenStreetMap",sphericalMercator:!0,url:"http://tile.openstreetmap.org/${z}/${x}/${y}.png",clone:function(a){a==null&&(a=new OpenLayers.Layer.OSM(this.name,this.url,this.getOptions())),a=OpenLayers.Layer.XYZ.prototype.clone.apply(this,[a]);return a},CLASS_NAME:"OpenLayers.Layer.OSM"}),OpenLayers.Rule=OpenLayers.Class({id:null,name:null,title:null,description:null,context:null,filter:null,elseFilter:!1,symbolizer:null,symbolizers:null,minScaleDenominator:null,maxScaleDenominator:null,initialize:function(a){this.symbolizer={},OpenLayers.Util.extend(this,a),this.symbolizers&&delete this.symbolizer,this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){for(var a in this.symbolizer)this.symbolizer[a]=null;this.symbolizer=null,delete this.symbolizers},evaluate:function(a){var b=this.getContext(a),c=!0;if(this.minScaleDenominator||this.maxScaleDenominator)var d=a.layer.map.getScale();this.minScaleDenominator&&(c=d>=OpenLayers.Style.createLiteral(this.minScaleDenominator,b)),c&&this.maxScaleDenominator&&(c=dthis.value;break;case OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO:b=c<=this.value;break;case OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO:b=c>=this.value;break;case OpenLayers.Filter.Comparison.BETWEEN:b=c>=this.lowerBoundary&&c<=this.upperBoundary;break;case OpenLayers.Filter.Comparison.LIKE:var e=new RegExp(this.value,"gi");b=e.test(c)}return b},value2regex:function(a,b,c){if(a=="."){var d="'.' is an unsupported wildCard character for OpenLayers.Filter.Comparison";OpenLayers.Console.error(d);return null}a=a?a:"*",b=b?b:".",c=c?c:"!",this.value=this.value.replace(new RegExp("\\"+c+"(.|$)","g"),"\\$1"),this.value=this.value.replace(new RegExp("\\"+b,"g"),"."),this.value=this.value.replace(new RegExp("\\"+a,"g"),".*"),this.value=this.value.replace(new RegExp("\\\\.\\*","g"),"\\"+a),this.value=this.value.replace(new RegExp("\\\\\\.","g"),"\\"+b);return this.value},regex2value:function(){var a=this.value;a=a.replace(/!/g,"!!"),a=a.replace(/(\\)?\\\./g,function(a,b){return b?a:"!."}),a=a.replace(/(\\)?\\\*/g,function(a,b){return b?a:"!*"}),a=a.replace(/\\\\/g,"\\"),a=a.replace(/\.\*/g,"*");return a},clone:function(){return OpenLayers.Util.extend(new OpenLayers.Filter.Comparison,this)},CLASS_NAME:"OpenLayers.Filter.Comparison"}),OpenLayers.Filter.Comparison.EQUAL_TO="==",OpenLayers.Filter.Comparison.NOT_EQUAL_TO="!=",OpenLayers.Filter.Comparison.LESS_THAN="<",OpenLayers.Filter.Comparison.GREATER_THAN=">",OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO="<=",OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO=">=",OpenLayers.Filter.Comparison.BETWEEN="..",OpenLayers.Filter.Comparison.LIKE="~",OpenLayers.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,OpenLayers.Geometry.prototype.destroy.apply(this,arguments)},clone:function(){var geometry=eval("new "+this.CLASS_NAME+"()");for(var i=0,len=this.components.length;i0){this.setBounds(this.components[0].getBounds());for(var a=1,b=this.components.length;a-1){if(b!=null&&b=0;--b)this.removeComponent(a[b])},removeComponent:function(a){OpenLayers.Util.removeItem(this.components,a),this.clearBounds()},getLength:function(){var a=0;for( +var b=0,c=this.components.length;b0?i:f,d.push(j)}b=c.length;if(e===0){for(var h=0;h=0;d--){d!=0&&a[d-1].geometry?this.renderer.locked=!0:this.renderer.locked=!1;var e=a[d];delete this.unrenderedFeatures[e.id],c&&this.events.triggerEvent("beforefeatureremoved",{feature:e}),this.features=OpenLayers.Util.removeItem(this.features,e),e.layer=null,e.geometry&&this.renderer.eraseFeatures(e),OpenLayers.Util.indexOf(this.selectedFeatures,e)!=-1&&OpenLayers.Util.removeItem(this.selectedFeatures,e),c&&this.events.triggerEvent("featureremoved",{feature:e})}c&&this.events.triggerEvent("featuresremoved",{features:a})}},removeAllFeatures:function(a){var b=!a||!a.silent,c=this.features;b&&this.events.triggerEvent("beforefeaturesremoved",{features:c});var d;for(var e=c.length-1;e>=0;e--)d=c[e],b&&this.events.triggerEvent("beforefeatureremoved",{feature:d}),d.layer=null,b&&this.events.triggerEvent("featureremoved",{feature:d});this.renderer.clear(),this.features=[],this.unrenderedFeatures={},this.selectedFeatures=[],b&&this.events.triggerEvent("featuresremoved",{features:c})},destroyFeatures:function(a,b){var c=a==undefined;c&&(a=this.features);if(a){this.removeFeatures(a,b);for(var d=a.length-1;d>=0;d--)a[d].destroy()}},drawFeature:function(a,b){if(!!this.drawn){if(typeof b!="object"){!b&&a.state===OpenLayers.State.DELETE&&(b="delete");var c=b||a.renderIntent;b=a.style||this.style,b||(b=this.styleMap.createSymbolizer(a,c))}this.renderer.drawFeature(a,b)?delete this.unrenderedFeatures[a.id]: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}var b=this.renderer.getFeatureIdFromEvent(a);return this.getFeatureById(b)},getFeatureBy:function(a,b){var c=null;for(var d=0,e=this.features.length;d0){a=new OpenLayers.Bounds;var c=null;for(var d=0,e=b.length;d=0;--f)d=c.selectedFeatures[f],(!a||a.except!=d)&&this.unselect(d)}},clickFeature:function(a){if(!this.hover){var b=OpenLayers.Util.indexOf(a.layer.selectedFeatures,a)>-1;b?this.toggleSelect()?this.unselect(a):this.multipleSelect()||this.unselectAll({except:a}):(this.multipleSelect()||this.unselectAll({except:a}),this.select(a))}},multipleSelect:function(){return this.multiple||this.handlers.feature.evt&&this.handlers.feature.evt[this.multipleKey]},toggleSelect:function(){return this.toggle||this.handlers.feature.evt&&this.handlers.feature.evt[this.toggleKey]},clickoutFeature:function(a){!this.hover&&this.clickout&&this.unselectAll()},overFeature:function(a){var b=a.layer;this.hover&&(this.highlightOnly?this.highlight(a):OpenLayers.Util.indexOf(b.selectedFeatures,a)==-1&&this.select(a))},outFeature:function(a){if(this.hover)if(this.highlightOnly){if(a._lastHighlighter==this.id)if(a._prevHighlighter&&a._prevHighlighter!=this.id){delete a._lastHighlighter;var b=this.map.getControl(a._prevHighlighter);b&&b.highlight(a)}else this.unhighlight(a)}else this.unselect(a)},highlight:function(a){var b=a.layer,c=this.events.triggerEvent("beforefeaturehighlighted",{feature:a});if(c!==!1){a._prevHighlighter=a._lastHighlighter,a._lastHighlighter=this.id;var d=this.selectStyle||this.renderIntent;b.drawFeature(a,d),this.events.triggerEvent("featurehighlighted",{feature:a})}},unhighlight:function(a){var b=a.layer;a._lastHighlighter=a._prevHighlighter,delete a._prevHighlighter,b.drawFeature(a,a.style||a.layer.style||"default"),this.events.triggerEvent("featureunhighlighted",{feature:a})},select:function(a){var b=this.onBeforeSelect.call(this.scope,a),c=a.layer;b!==!1&&(b=c.events.triggerEvent("beforefeatureselected",{feature:a}),b!==!1&&(c.selectedFeatures.push(a),this.highlight(a),this.handlers.feature.lastFeature||(this.handlers.feature.lastFeature=c.selectedFeatures[0]),c.events.triggerEvent("featureselected",{feature:a}),this.onSelect.call(this.scope,a)))},unselect:function(a){var b=a.layer;this.unhighlight(a),OpenLayers.Util.removeItem(b.selectedFeatures,a),b.events.triggerEvent("featureunselected",{feature:a}),this.onUnselect.call(this.scope,a)},selectBox:function(a){if(a instanceof OpenLayers.Bounds){var b=this.map.getLonLatFromPixel(new OpenLayers.Pixel(a.left,a.bottom)),c=this.map.getLonLatFromPixel(new OpenLayers.Pixel(a.right,a.top)),d=new OpenLayers.Bounds(b.lon,b.lat,c.lon,c.lat);this.multipleSelect()||this.unselectAll();var e=this.multiple;this.multiple=!0;var f=this.layers||[this.layer],g;for(var h=0;h-1)&&d.toGeometry().intersects(k.geometry)&&OpenLayers.Util.indexOf(g.selectedFeatures,k)==-1&&this.select(k)}}this.multiple=e}},setMap:function(a){this.handlers.feature.setMap(a),this.box&&this.handlers.box.setMap(a),OpenLayers.Control.prototype.setMap.apply(this,arguments)},setLayer:function(a){var b=this.active;this.unselectAll(),this.deactivate(),this.layers&&(this.layer.destroy(),this.layers=null),this.initLayer(a),this.handlers.feature.layer=this.layer,b&&this.activate()},CLASS_NAME:"OpenLayers.Control.SelectFeature"}),OpenLayers.Geometry.Curve=OpenLayers.Class(OpenLayers.Geometry.MultiPoint,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(a){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;b1){var e,f;for(var g=1,h=b.components.length;g2&&OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments)},intersects:function(a){var b=!1,c=a.CLASS_NAME;if(c=="OpenLayers.Geometry.LineString"||c=="OpenLayers.Geometry.LinearRing"||c=="OpenLayers.Geometry.Point"){var d=this.getSortedSegments(),e;c=="OpenLayers.Geometry.Point"?e=[{x1:a.x,y1:a.y,x2:a.x,y2:a.y}]:e=a.getSortedSegments();var f,g,h,i,j,k,l,m;outer:for(var n=0,o=d.length;nh)break;if(k.x2Math.max(i,j))continue;if(Math.max(l,m)0){var t=a.x10&&(n.unshift(s,1),Array.prototype.splice.apply(h,n),s+=n.length-2);if(d)for(var t=0,u=m.points.length;t0&&p.length>0&&(p.push(k.clone()),g.push(new OpenLayers.Geometry.LineString(p)))}else c=a.splitWith(this,b);h&&h.length>1?f=!0:h=[],g&&g.length>1?e=!0:g=[];if(f||e)d?c=[g,h]:c=h;return c},splitWith:function(a,b){return a.split(this,b)},getVertices:function(a){var b;a===!0?b=[this.components[0],this.components[this.components.length-1]]:a===!1?b=this.components.slice(1,this.components.length-1):b=this.components.slice();return b},distanceTo:function(a,b){var c=!b||b.edge!==!1,d=c&&b&&b.details,e,f={},g=Number.POSITIVE_INFINITY;if(a instanceof OpenLayers.Geometry.Point){var h=this.getSortedSegments(),i=a.x,j=a.y,k;for(var l=0,m=h.length;li&&(j>k.y1&&jk.y2))break}d?f={distance:f.distance,x0:f.x,y0:f.y,x1:i,y1:j}:f=f.distance}else if(a instanceof OpenLayers.Geometry.LineString){var n=this.getSortedSegments(),o=a.getSortedSegments(),p,q,r,s,t,u=o.length,v={point:!0};outer:for(var l=0,m=n.length;l4){this.components.pop(),OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);var b=this.components[0];OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[b])}},move:function(a,b){for(var c=0,d=this.components.length;c2){var a=0,b=0;for(var c=0;c2){var b=0;for(var c=0,d=this.components.length;c2){var f,g;for(var h=0;h=j&&d<=l||j>=l&&d<=j&&d>=l){p=-1;break}continue}n=b(f(e,j,k,l,m),c);if(n==d)if(k=k&&e<=m||k>m&&e<=k&&e>=m){p=-1;break}if(n<=d)continue;if(j!=l&&(nMath.max(j,l)))continue;(k=k&&em&&e=m)&&++p}var r=p==-1?1:!!(p&1);return r},intersects:function(a){var b=!1;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;c1?h=!0:j=[],k&&k.length>1?i=!0:k=[];if(h||i)d?c=[j,k]:c=k;return c},splitWith:function(a,b){var c=null,d=b&&b.mutual,e,f,g,h,i,j,k;if(a instanceof OpenLayers.Geometry.LineString){k=[],j=[a];for(var l=0,m=this.components.length;l1?h=!0:j=[],k&&k.length>1?i=!0:k=[];if(h||i)d?c=[j,k]:c=k;return c},CLASS_NAME:"OpenLayers.Geometry.MultiLineString"}),OpenLayers.Geometry.Polygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LinearRing"],initialize:function(a){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;b0){b+=Math.abs(this.components[0].getGeodesicArea(a));for(var c=1,d=this.components.length;c0){c=this.components[0].containsPoint(a);if(c!==1&&c&&b>1){var d;for(var e=1;e=this.maxDepth)return!1;var c=OpenLayers.Util.extend({},b);c.depth++;for(var d=0,e=a.length;d0){var k=j[0],l={features:[],feature:g};this.readNode(k,l),l.features.length>0&&c.push.apply(c,l.features)}}else c.push(g)}this.features=this.features.concat(c)},readers:{kml:{when:function(a,b){b.whens.push(OpenLayers.Date.parse(this.getChildValue(a)))},_trackPointAttribute:function(a,b){var c=a.nodeName.split(":").pop();b.attributes[c].push(this.getChildValue(a))}},gx:{Track:function(a,b){var c={whens:[],points:[],angles:[]};if(this.trackAttributes){var d;c.attributes={};for(var e=0,f=this.trackAttributes.length;e0;if(g&&c.whens.length!==c.angles.length)throw new Error("gx:Track with unequal number of when ("+c.whens.length+") and gx:angles ("+c.angles.length+") elements.");var h,i,j;for(var e=0,f=c.whens.length;e2&&(e.z=parseFloat(d[2])),b.points.push(e)},angles:function(a,b){var c=this.getChildValue(a),d=c.replace(this.regExes.trimSpace,"").split(/\s+/);b.angles.push(d)}}},parseFeature:function(a){var b=["MultiGeometry","Polygon","LineString","Point"],c,d,e,f;for(var g=0,h=b.length;g0){var f=this.parseGeometry[c.toLowerCase()];f?(e=f.apply(this,[d[0]]),this.internalProjection&&this.externalProjection&&e.transform(this.externalProjection,this.internalProjection)):OpenLayers.Console.error(OpenLayers.i18n("unsupportedGeometryType",{geomType:c}));break}}var i;this.extractAttributes&&(i=this.parseAttributes(a));var j=new OpenLayers.Feature.Vector(e,i),k=a.getAttribute("id")||a.getAttribute("name");k!=null&&(j.fid=k);return j},getStyle:function(a,b){var c=OpenLayers.Util.removeTail(a),d=OpenLayers.Util.extend({},b);d.depth++,d.styleBaseUrl=c;if(!this.styles[a]&&!OpenLayers.String.startsWith(a,"#")&&d.depth<=this.maxDepth&&!this.fetched[c]){var e=this.fetchLink(c);e&&this.parseData(e,d)}var f=OpenLayers.Util.extend({},this.styles[a]);return f},parseGeometry:{point:function(a){var b=this.getElementsByTagNameNS(a,this.internalns,"coordinates"),c=[];if(b.length>0){var d=b[0].firstChild.nodeValue;d=d.replace(this.regExes.removeSpace,""),c=d.split(",")}var e=null;if(c.length>1)c.length==2&&(c[2]=null),e=new OpenLayers.Geometry.Point(c[0],c[1],c[2]);else throw"Bad coordinate string: "+d;return e},linestring:function(a,b){var c=this.getElementsByTagNameNS(a,this.internalns,"coordinates"),d=null;if(c.length>0){var e=this.getChildValue(c[0]);e=e.replace(this.regExes.trimSpace,""),e=e.replace(this.regExes.trimComma,",");var f=e.split(this.regExes.splitSpace),g=f.length,h=Array(g),i,j;for(var k=0;k1)i.length==2&&(i[2]=null),h[k]=new OpenLayers.Geometry.Point(i[0],i[1],i[2]);else throw"Bad LineString point coordinates: "+f[k]}if(g)b?d=new OpenLayers.Geometry.LinearRing(h):d=new OpenLayers.Geometry.LineString(h);else throw"Bad LineString coordinates: "+e}return d},polygon:function(a){var b=this.getElementsByTagNameNS(a,this.internalns,"LinearRing"),c=b.length,d=Array(c);if(c>0){var e;for(var f=0,g=b.length;f=1&&e.length<=3){var f;switch(e.length){case 1:f=e[0];break;case 2:var j=e[0],k=e[1];f=j.nodeType==3||j.nodeType==4?j:k;break;case 3:default:f=e[1]}if(f.nodeType==3||f.nodeType==4){var l=d.prefix?d.nodeName.split(":")[1]:d.nodeName,m=OpenLayers.Util.getXmlNodeValue(f);m&&(m=m.replace(this.regExes.trimSpace,""),b[l]=m)}}}}return b},parseExtendedData:function(a){var b={},c,d,e,f,g=a.getElementsByTagName("Data");for(c=0,d=g.length;c0&&b(function(){P(u)},K),N=function(){j&&clearTimeout(j),f[q]=f[n]=f[p]=f[o]=null,w[r](f),g&&w[r](g)},window[E]=d,f=a(s)[0],f.id=l+y++,H&&(f[i]=H);function m(a){(f[n]||c)(),a=z,z=undefined,a?O(a[0]):P(k)}v.msie?(f.event=n,f.htmlFor=f.id,f[q]=function(){/loaded|complete/.test(f.readyState)&&m()}):(f[o]=f[p]=m,v.opera?(g=a(s)[0]).text="jQuery('#"+f.id+"')[0]."+o+"()":f[h]=h),f.src=I,e(f),g&&e(g)}},0);return m}function g(a){return/\?/.test(a)?"&":"?"}function f(a,b,c){return a&&a.apply(b.context||b,c)}function e(a){w.insertBefore(a,w.firstChild)}function d(a){z=[a]}function c(){}var h="async",i="charset",j="",k="error",l="_jqjsp",m="on",n=m+"click",o=m+k,p=m+"load",q=m+"readystatechange",r="removeChild",s="