


var bbox_capa_zoom=new Array();var popupAnterior=null;function paxinar_listados(paxina,listado){var WEB_chamada='listados_index.php?paxina='+paxina+'&bandera_listado='+listado;var obxeto_listados=Crea_obx_HttpRequest();obxeto_listados.open('GET',WEB_chamada,true);obxeto_listados.onreadystatechange=function(){if(obxeto_listados.readyState==4){switch(listado){case"valorados":document.getElementById('id_listado_votos').innerHTML=obxeto_listados.responseText;break;case"visitados":document.getElementById('id_listado_visitas').innerHTML=obxeto_listados.responseText;break;case"recientes":document.getElementById('id_listado_novos').innerHTML=obxeto_listados.responseText;break;}}}
try{obxeto_listados.send('');}
catch(erro){alerta_erro(erro.description)};}
function mostra_por_interes(interes){if(document.getElementById('div_'+interes)!=null){if(document.getElementById('div_'+'votos')!=null){document.getElementById('div_'+'votos').className='inactive';}
if(document.getElementById('div_'+'visitas')!=null){document.getElementById('div_'+'visitas').className='inactive';}
if(document.getElementById('div_'+'novos')!=null){document.getElementById('div_'+'novos').className='inactive';}
document.getElementById('div_'+interes).className='active';}
if(document.getElementById('id_listado_'+interes)!=null){if(document.getElementById('id_listado_'+'votos')!=null){document.getElementById('id_listado_'+'votos').style.display='none';}
if(document.getElementById('id_listado_'+'visitas')!=null){document.getElementById('id_listado_'+'visitas').style.display='none';}
if(document.getElementById('id_listado_'+'novos')!=null){document.getElementById('id_listado_'+'novos').style.display='none';}
document.getElementById('id_listado_'+interes).style.display='block';}}
function crea_capas_do_mapa(){var raiz_capa='sixtema_';var i=0;var nome_capa=raiz_capa+i;var valor_matriz_0=null;var valor_matriz_1=null;var valor_matriz_2=null;var z_index_layer=null;var z_index_layer_ant=null;var id_da_capa_a_trocar=null;if(capasKML!=null){while(this.capasKML[nome_capa]!=null){this.capasKML[nome_capa].setVisibility(false);this.map.removeLayer(this.capasKML[nome_capa]);delete this.capasKML[nome_capa];i++;nome_capa=raiz_capa+i;}}
this.vector_orden_capas_kml=null;this.vector_orden_capas_kml=new Array();this.capasKML=null;this.capasKML=new Array();var nome_chamada=null;var ii=0;var nivel_transparencia='';var punto_max=null;var punto_min=null;var ncapasKML=0;for(i=0;i<vector_capas_sixtema.length;i++){punto_max=new OpenLayers.Geometry.Point(vector_capas_sixtema[i].maxx,vector_capas_sixtema[i].maxy);punto_min=new OpenLayers.Geometry.Point(vector_capas_sixtema[i].minx,vector_capas_sixtema[i].miny);punto_max.transform(new OpenLayers.Projection("EPSG:4326"),new OpenLayers.Projection("EPSG:900913"));punto_min.transform(new OpenLayers.Projection("EPSG:4326"),new OpenLayers.Projection("EPSG:900913"));valor_matriz_0=vector_capas_sixtema[i].mapa_id;valor_matriz_1=vector_capas_sixtema[i].capa_id;valor_matriz_2=vector_capas_sixtema[i].nome_capa;nivel_transparencia=vector_capas_sixtema[i].transp;nivel_transparencia=100-nivel_transparencia;nivel_transparencia=nivel_transparencia/100.0;if(this.ver_capa_id==valor_matriz_1||this.ver_capa_id==''){nome_capa=raiz_capa+ii;nome_chamada=www_server+'openlayers_kml.php?MAP='+valor_matriz_0+'&LAYERS='+valor_matriz_1+'&inicio=si&monotematico='+monotematico;capasKML[nome_capa]=new OpenLayers.Layer.GML(valor_matriz_2,nome_chamada,{format:OpenLayers.Format.KML,projection:new OpenLayers.Projection("EPSG:4326"),visibility:true,draw:true,formatOptions:{foldersName:'name',foldersDesc:'description',extractStyles:true,extractAttributes:true},opacity:nivel_transparencia});this.capasKML[nome_capa].events.register("loadend",this.capasKML[nome_capa],rematouKML);this.map.addLayer(capasKML[nome_capa]);ncapasKML++;bbox_capa_zoom[nome_capa]=new OpenLayers.Bounds();bbox_capa_zoom[nome_capa].extend(new OpenLayers.LonLat(punto_max.x,punto_max.y));bbox_capa_zoom[nome_capa].extend(new OpenLayers.LonLat(punto_min.x,punto_min.y));capasKML[nome_capa].setOpacity(nivel_transparencia);z_index_layer=parseInt(capasKML[nome_capa].getZIndex());if(z_index_layer_ant==null){z_index_layer_ant=z_index_layer;}
if(z_index_layer_ant>=z_index_layer){z_index_layer=z_index_layer_ant+1;z_index_layer_ant=z_index_layer;}
id_da_capa_a_trocar=capasKML[nome_capa].id;if(document.getElementById(id_da_capa_a_trocar)!=null){document.getElementById(id_da_capa_a_trocar).style.zIndex=z_index_layer;}
ii=ii+1;}}
var capas="[";for(i=0;i<ncapasKML;i++){capas+='capasKML["sixtema_'+i+'"] ,';}
var strLen=capas.length;capas=capas.slice(0,strLen-1);capas+="]";var capa1=capasKML['sixtema_0'];var capa2=capasKML['sixtema_1'];if(capas!="]"){var click1=new OpenLayers.Control.SelectFeature(eval(capas),{onSelect:seleccionarFeature,onUnselect:deseleccionarFeature,toggle:true});click1.handlers["feature"].stopDown=false;click1.handlers["feature"].stopUp=false;map.addControl(click1);click1.activate();}
else{document.getElementById('div_cargando').style.display="none";document.getElementById('div_cargando_iki').style.display="none";}
if(document.getElementById('div_capas_del_mapa')){document.getElementById('div_capas_del_mapa').innerHTML='<ol>'+texto_lenda_total+'</ol>';}}
function rematouKML(capa){var anchoImg=1;var proporcionImg=1;var listadoElementos="";for(i=0;i<capa.object.features.length;i++){capa.object.features[i].style.graphicOpacity=capa.object.features[i].style.fillOpacity;capa.object.features[i].style.cursor='pointer';if(!capa.object.features[i].data.description)
capa.object.features[i].data.description='';}
capa.object.redraw();document.getElementById("div_cargando_iki").style.display="block";document.getElementById("div_cargando").style.display="block";}
function deseleccionarFeature(feature){if(popupAnterior!=null){map.removePopup(popupAnterior);popupAnterior.destroy();popupAnterior=null;}}
function seleccionarFeature(feature){var coords=document.getElementById('OpenLayers.Control.MousePosition_8').innerHTML;coords=coords.split(",");var geometry=new OpenLayers.LonLat(coords[0],coords[1]);geometry.transform(new OpenLayers.Projection("EPSG:4326"),new OpenLayers.Projection("EPSG:900913"));texto_imprimir="<div style='cursor:default;height:100%;width:100%;overflow:auto;'>"+"<div style='margin-top:8px;margin-bottom:5px;font-size:15px;font-weight:bold;color:#336699;'>"+(feature.data.name?feature.data.name:"")+"</div>"+"<div>"+feature.data.description+"</div></div>";popup=new OpenLayers.Popup.FramedCloud("chicken",geometry,new OpenLayers.Size(100,100),texto_imprimir,null,true,deseleccionarFeature);popup.panMapIfOutOfView=false;popup.disableFirefoxOverflowHack=true;popup.positionBlocks.tl.padding=new OpenLayers.Bounds(20,20,8,9);popup.positionBlocks.tl.blocks[0].anchor=new OpenLayers.Bounds(0,31,22,0);popup.positionBlocks.tl.blocks[1].anchor=new OpenLayers.Bounds(null,30,0,0);popup.positionBlocks.tl.blocks[2].anchor=new OpenLayers.Bounds(0,12,22,null);popup.positionBlocks.tl.blocks[3].anchor=new OpenLayers.Bounds(null,12,0,null);popup.positionBlocks.tl.blocks[4].size=new OpenLayers.Size(81,15);popup.positionBlocks.bl.padding=new OpenLayers.Bounds(20,9,8,20);popup.positionBlocks.bl.blocks[0].anchor=new OpenLayers.Bounds(0,21,22,15);popup.positionBlocks.bl.blocks[1].anchor=new OpenLayers.Bounds(null,21,0,15);popup.positionBlocks.bl.blocks[2].anchor=new OpenLayers.Bounds(0,0,22,null);popup.positionBlocks.bl.blocks[3].anchor=new OpenLayers.Bounds(null,0,0,null);popup.positionBlocks.bl.blocks[4].size=new OpenLayers.Size(81,16);popup.positionBlocks.tr.padding=new OpenLayers.Bounds(20,22,8,9);popup.positionBlocks.tr.blocks[0].anchor=new OpenLayers.Bounds(0,32,22,0);popup.positionBlocks.tr.blocks[1].anchor=new OpenLayers.Bounds(null,31,0,0);popup.positionBlocks.tr.blocks[2].anchor=new OpenLayers.Bounds(0,13,22,null);popup.positionBlocks.tr.blocks[3].anchor=new OpenLayers.Bounds(null,13,0,null);popup.positionBlocks.tr.blocks[4].size=new OpenLayers.Size(81,16);popup.positionBlocks.br.padding=new OpenLayers.Bounds(20,9,8,20);popup.positionBlocks.br.blocks[0].anchor=new OpenLayers.Bounds(0,21,22,15);popup.positionBlocks.br.blocks[1].anchor=new OpenLayers.Bounds(null,21,0,15);popup.positionBlocks.br.blocks[2].anchor=new OpenLayers.Bounds(0,0,22,null);popup.positionBlocks.br.blocks[3].anchor=new OpenLayers.Bounds(null,0,0,null);popup.positionBlocks.br.blocks[4].size=new OpenLayers.Size(81,16);/*popup.events.register("mousedown",popup,onPopupMouseDown);popup.events.register("mouseover",popup,onPopupMouseOver);popup.events.register("mouseup",popup,onPopupMouseUp);map.events.register("mouseup",popup,onPopupMouseUp);map.events.register("mouseover",popup,onPopupMouseOver);*/feature.popup=popup;popup.autoSize=true;map.addPopup(popup);popup.registerImageListeners();popupAnterior=popup;/*document.getElementById('chicken_contentDiv').onmousedown=onContentMouseDown;document.getElementById('chicken_contentDiv').onmouseover=onContentMouseDown;*/}
var draguearMapa=false;function onPopupMouseOver(){if(draguearMapa==true){map.controls[1].mouseDragStart=true;}}
function onPopupMouseDown(){if(draguearMapa==true){map.controls[1].mouseDragStart=true;draguearMapa=true;}
else{draguearMapa=true;}}
function onPopupMouseUp()
{map.controls[1].performedDrag=true;draguearMapa=false;}
function onContentMouseDown(){draguearMapa=false;map.controls[1].performedDrag=true;}
function matriz_capas_do_mapa(mapa_id,capa_id,nome_capa,tipo_capa,color_rgb,transp,orde_capa,scale,icono,maxx,maxy,minx,miny){this.mapa_id=mapa_id;this.capa_id=capa_id;this.nome_capa=nome_capa;this.tipo_capa=tipo_capa;this.color_rgb=color_rgb;this.transp=transp;this.orde_capa=orde_capa;this.scale=scale;this.icono=icono;this.maxx=maxx;this.maxy=maxy;this.minx=minx;this.miny=miny;}
function Crea_obx_HttpRequest(){var obj;if(window.XMLHttpRequest){obj=new XMLHttpRequest();}
else{try{obj=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){alerta_erro(vector_de_traduccion['erro_objecto']);}}
return obj;}
function deslogueo(){var obxeto=Crea_obx_HttpRequest();obxeto.open('GET','deslogueo.php');obxeto.onreadystatechange=function(){if(obxeto.readyState==4){BorrarCookie('crrlctrnc');BorrarCookie('Password');document.location.href=www_server;}}
obxeto.send('');}
function cambia_idioma(idioma,iduser){var id_usuario=iduser;var pax_actual=document.location.href;var params="id_usuario="+id_usuario+"&idioma="+idioma;var WEB_chamada="cambiar_idioma.php?"+params;var obxeto_idioma=Crea_obx_HttpRequest();obxeto_idioma.open("POST",WEB_chamada,true);obxeto_idioma.setRequestHeader("Content-type","application/x-www-form-urlencoded; charset=utf-8");obxeto_idioma.setRequestHeader("Content-length",params.length);obxeto_idioma.setRequestHeader("Connection","close");obxeto_idioma.onreadystatechange=function(){if(obxeto_idioma.readyState==4){if(obxeto_idioma.status==200){document.location.reload();}}}
try{obxeto_idioma.send(params);}
catch(erro){error='<br/><strong>'+vector_de_traduccion['mns_erro_404_a']+' </strong>'+vector_de_traduccion['mns_erro_x']+' "'+erro.description+'"';alerta_erro(error);};}
function buscaenter(myfield,e){var keycode;if(window.event)keycode=window.event.keyCode;else if(e)keycode=e.which;else return true;if(keycode==13)
{if(myfield!=''){buscar(myfield.value);}
return false;}
else
return true;}
function buscar(texto,tag){if(tag&&tag!=""){var tags="&tag=1";}
else{var tags="";}
if(texto&&texto!=''){var texto2=texto;texto=texto.split(' ');var texto_fin='';for(var i=0;i<texto.length;i++){if(texto[i]!=''){texto_fin=texto_fin+' '+texto[i];}}
if(texto_fin.length<1){alerta_erro(vector_de_traduccion['error_palabra_corta']);}
else{if(document.getElementById('mapa_busqueda')){document.f_busqueda.sel_catego.value='';document.f_busqueda.bus_txt.value=texto_fin;valida_busq();}
else{document.location.href=www_server+'busqueda.php?t='+texto2+tags;}}}
else{var t=document.getElementById('inp_busca_general').value;var texto=t;texto=texto.split(' ');var texto_fin='';for(var i=0;i<texto.length;i++){if(texto[i]!=''){texto_fin=texto_fin+' '+texto[i];}}
if(texto_fin.length<1){alerta_erro(vector_de_traduccion['error_palabra_corta']);}
else{if(document.getElementById('mapa_busqueda')){document.f_busqueda.sel_catego.value='';document.f_busqueda.bus_txt.value=texto_fin;valida_busq();}
else{document.location.href=www_server+'busqueda.php?t='+t;}}}}
function BorrarCookie(nombre){document.cookie=nombre+"=; expires="+Caduca(-1)+"; path=/"}
function Caduca(dias){var hoy=new Date()
var msEnXDias=eval(dias)*24*60*60*1000
hoy.setTime(hoy.getTime()+msEnXDias)
return(hoy.toGMTString())}

(function(){var a=typeof OpenLayers=="object"&&OpenLayers.singleFile;a=true;var b;window.OpenLayers={_scriptName:!a?"js/OpenLayers.js":"OpenLayers.js",_getScriptLocation:function(){if(b!=undefined)return b;b="";for(var l=new RegExp("(^|(.*?\\/))("+OpenLayers._scriptName+")(\\?|$)"),m=document.getElementsByTagName("script"),o=0,p=m.length;o<p;o++){var q=m[o].getAttribute("src");if(q)if(q=q.match(l)){b=q[1];break}}return b}};if(!a){a=new Array("OpenLayers/proj4js-combined.js","OpenLayers/Util.js","OpenLayers/BaseTypes.js",
"OpenLayers/BaseTypes/Class.js","OpenLayers/BaseTypes/Bounds.js","OpenLayers/BaseTypes/Element.js","OpenLayers/BaseTypes/LonLat.js","OpenLayers/BaseTypes/Pixel.js","OpenLayers/BaseTypes/Size.js","OpenLayers/Console.js","OpenLayers/Tween.js","OpenLayers/Ajax.js","OpenLayers/Events.js","OpenLayers/Request.js","OpenLayers/Request/XMLHttpRequest.js","OpenLayers/Projection.js","OpenLayers/Map.js","OpenLayers/Layer.js","OpenLayers/Icon.js","OpenLayers/Popup.js","OpenLayers/Tile.js","OpenLayers/Tile/Image.js",
"OpenLayers/Tile/Image/IFrame.js","OpenLayers/Layer/SphericalMercator.js","OpenLayers/Layer/EventPane.js","OpenLayers/Layer/FixedZoomLevels.js","OpenLayers/Layer/Google.js","OpenLayers/Layer/HTTPRequest.js","OpenLayers/Layer/Grid.js","OpenLayers/Layer/WMS.js","OpenLayers/Layer/WMS/Untiled.js","OpenLayers/Layer/WMS/Post.js","OpenLayers/Layer/XYZ.js","OpenLayers/Popup/Anchored.js","OpenLayers/Popup/Framed.js","OpenLayers/Popup/FramedCloud.js","OpenLayers/Feature.js","OpenLayers/Feature/Vector.js","OpenLayers/Handler.js",
"OpenLayers/Handler/Click.js","OpenLayers/Handler/Feature.js","OpenLayers/Handler/Drag.js","OpenLayers/Handler/Box.js","OpenLayers/Control.js","OpenLayers/Control/ZoomBox.js","OpenLayers/Control/MouseDefaults.js","OpenLayers/Control/MousePosition.js","OpenLayers/Control/Panel.js","OpenLayers/Control/SelectFeature.js","OpenLayers/Geometry.js","OpenLayers/Geometry/Rectangle.js","OpenLayers/Geometry/Collection.js","OpenLayers/Geometry/Point.js","OpenLayers/Geometry/MultiPoint.js","OpenLayers/Geometry/Curve.js",
"OpenLayers/Geometry/LineString.js","OpenLayers/Geometry/LinearRing.js","OpenLayers/Geometry/Polygon.js","OpenLayers/Geometry/MultiLineString.js","OpenLayers/Geometry/MultiPolygon.js","OpenLayers/Geometry/Surface.js","OpenLayers/Renderer.js","OpenLayers/Renderer/Elements.js","OpenLayers/Renderer/SVG.js","OpenLayers/Renderer/Canvas.js","OpenLayers/Renderer/VML.js","OpenLayers/Layer/Vector.js","OpenLayers/Layer/Vector/RootContainer.js","OpenLayers/Filter.js","OpenLayers/Filter/Comparison.js","OpenLayers/Filter/Spatial.js",
"OpenLayers/Protocol.js","OpenLayers/Protocol/HTTP.js","OpenLayers/Layer/GML.js","OpenLayers/Style.js","OpenLayers/StyleMap.js","OpenLayers/Format.js","OpenLayers/Format/XML.js","OpenLayers/Format/GML.js","OpenLayers/Format/GML/Base.js","OpenLayers/Format/GML/v2.js","OpenLayers/Format/GML/v3.js","OpenLayers/Format/KML.js","OpenLayers/Format/OSM.js","OpenLayers/Projection.js","OpenLayers/LoadingPanel.js");var d=navigator.userAgent;if(d=d.match("MSIE")||d.match("Safari"))var e=new Array(a.length);for(var f=
OpenLayers._getScriptLocation()+"js/",g=0,h=a.length;g<h;g++)if(d)e[g]="<script src='"+f+a[g]+"'><\/script>";else{var j=document.createElement("script");j.src=f+a[g];(document.getElementsByTagName("head").length?document.getElementsByTagName("head")[0]:document.body).appendChild(j)}d&&document.write(e.join(""))}})();OpenLayers.VERSION_NUMBER="OpenLayers 2.9.1 -- $Revision: 10129 $";
Proj4js={defaultDatum:"WGS84",transform:function(a,b,d){if(!a.readyToUse||!b.readyToUse){this.reportError("Proj4js initialization for "+a.srsCode+" not yet complete");return d}if(a.srsProjNumber=="900913"&&b.datumCode!="WGS84"||b.srsProjNumber=="900913"&&a.datumCode!="WGS84"){var e=Proj4js.WGS84;this.transform(a,e,d);a=e}if(a.projName=="longlat"){d.x*=Proj4js.common.D2R;d.y*=Proj4js.common.D2R}else{if(a.to_meter){d.x*=a.to_meter;d.y*=a.to_meter}a.inverse(d)}if(a.from_greenwich)d.x+=a.from_greenwich;
d=this.datum_transform(a.datum,b.datum,d);if(b.from_greenwich)d.x-=b.from_greenwich;if(b.projName=="longlat"){d.x*=Proj4js.common.R2D;d.y*=Proj4js.common.R2D}else{b.forward(d);if(b.to_meter){d.x/=b.to_meter;d.y/=b.to_meter}}return d},datum_transform:function(a,b,d){if(a.compare_datums(b))return d;if(a.datum_type==Proj4js.common.PJD_NODATUM||b.datum_type==Proj4js.common.PJD_NODATUM)return d;a.datum_type==Proj4js.common.PJD_GRIDSHIFT&&alert("ERROR: Grid shift transformations are not implemented yet.");
b.datum_type==Proj4js.common.PJD_GRIDSHIFT&&alert("ERROR: Grid shift transformations are not implemented yet.");if(a.es!=b.es||a.a!=b.a||a.datum_type==Proj4js.common.PJD_3PARAM||a.datum_type==Proj4js.common.PJD_7PARAM||b.datum_type==Proj4js.common.PJD_3PARAM||b.datum_type==Proj4js.common.PJD_7PARAM){a.geodetic_to_geocentric(d);if(a.datum_type==Proj4js.common.PJD_3PARAM||a.datum_type==Proj4js.common.PJD_7PARAM)a.geocentric_to_wgs84(d);if(b.datum_type==Proj4js.common.PJD_3PARAM||b.datum_type==Proj4js.common.PJD_7PARAM)b.geocentric_from_wgs84(d);
b.geocentric_to_geodetic(d)}b.datum_type==Proj4js.common.PJD_GRIDSHIFT&&alert("ERROR: Grid shift transformations are not implemented yet.");return d},reportError:function(){},extend:function(a,b){a=a||{};if(b)for(var d in b){var e=b[d];if(e!==undefined)a[d]=e}return a},Class:function(){for(var a=function(){this.initialize.apply(this,arguments)},b={},d,e=0;e<arguments.length;++e){d=typeof arguments[e]=="function"?arguments[e].prototype:arguments[e];Proj4js.extend(b,d)}a.prototype=b;return a},bind:function(a,
b){var d=Array.prototype.slice.apply(arguments,[2]);return function(){var e=d.concat(Array.prototype.slice.apply(arguments,[0]));return a.apply(b,e)}},scriptName:"proj4js.js",defsLookupService:"http://spatialreference.org/ref",libPath:null,getScriptLocation:function(){if(this.libPath)return this.libPath;for(var a=this.scriptName,b=a.length,d=document.getElementsByTagName("script"),e=0;e<d.length;e++){var f=d[e].getAttribute("src");if(f){var g=f.lastIndexOf(a);if(g>-1&&g+b==f.length){this.libPath=
f.slice(0,-b);break}}}return this.libPath||""},loadScript:function(a,b,d,e){var f=document.createElement("script");f.defer=false;f.type="text/javascript";f.id=a;f.src=a;f.onload=b;f.onerror=d;f.loadCheck=e;if(/MSIE/.test(navigator.userAgent))f.onreadystatechange=this.checkReadyState;document.getElementsByTagName("head")[0].appendChild(f)},checkReadyState:function(){if(this.readyState=="loaded")this.loadCheck()?this.onload():this.onerror()}};
Proj4js.Proj=Proj4js.Class({readyToUse:false,title:null,projName:null,units:null,datum:null,initialize:function(a){this.srsCode=a.toUpperCase();if(this.srsCode.indexOf("EPSG")==0){this.srsCode=this.srsCode;this.srsAuth="epsg";this.srsProjNumber=this.srsCode.substring(5)}else if(this.srsCode.indexOf("IGNF")==0){this.srsCode=this.srsCode;this.srsAuth="IGNF";this.srsProjNumber=this.srsCode.substring(5)}else if(this.srsCode.indexOf("CRS")==0){this.srsCode=this.srsCode;this.srsAuth="CRS";this.srsProjNumber=
this.srsCode.substring(4)}else{this.srsAuth="";this.srsProjNumber=this.srsCode}this.loadProjDefinition()},loadProjDefinition:function(){if(Proj4js.defs[this.srsCode])this.defsLoaded();else{var a=Proj4js.getScriptLocation()+"defs/"+this.srsAuth.toUpperCase()+this.srsProjNumber+".js";Proj4js.loadScript(a,Proj4js.bind(this.defsLoaded,this),Proj4js.bind(this.loadFromService,this),Proj4js.bind(this.checkDefsLoaded,this))}},loadFromService:function(){Proj4js.loadScript(Proj4js.defsLookupService+"/"+this.srsAuth+
"/"+this.srsProjNumber+"/proj4js",Proj4js.bind(this.defsLoaded,this),Proj4js.bind(this.defsFailed,this),Proj4js.bind(this.checkDefsLoaded,this))},defsLoaded:function(){this.parseDefs();this.loadProjCode(this.projName)},checkDefsLoaded:function(){return Proj4js.defs[this.srsCode]?true:false},defsFailed:function(){Proj4js.reportError("failed to load projection definition for: "+this.srsCode);Proj4js.extend(Proj4js.defs[this.srsCode],Proj4js.defs.WGS84);this.defsLoaded()},loadProjCode:function(a){if(Proj4js.Proj[a])this.initTransforms();
else{var b=Proj4js.getScriptLocation()+"projCode/"+a+".js";Proj4js.loadScript(b,Proj4js.bind(this.loadProjCodeSuccess,this,a),Proj4js.bind(this.loadProjCodeFailure,this,a),Proj4js.bind(this.checkCodeLoaded,this,a))}},loadProjCodeSuccess:function(a){Proj4js.Proj[a].dependsOn?this.loadProjCode(Proj4js.Proj[a].dependsOn):this.initTransforms()},loadProjCodeFailure:function(a){Proj4js.reportError("failed to find projection file for: "+a)},checkCodeLoaded:function(a){return Proj4js.Proj[a]?true:false},
initTransforms:function(){Proj4js.extend(this,Proj4js.Proj[this.projName]);this.init();this.readyToUse=true},parseDefs:function(){this.defData=Proj4js.defs[this.srsCode];for(var a,b,d=this.defData.split("+"),e=0;e<d.length;e++){b=d[e].split("=");a=b[0].toLowerCase();b=b[1];switch(a.replace(/\s/gi,"")){case "":break;case "title":this.title=b;break;case "proj":this.projName=b.replace(/\s/gi,"");break;case "units":this.units=b.replace(/\s/gi,"");break;case "datum":this.datumCode=b.replace(/\s/gi,"");
break;case "nadgrids":this.nagrids=b.replace(/\s/gi,"");break;case "ellps":this.ellps=b.replace(/\s/gi,"");break;case "a":this.a=parseFloat(b);break;case "b":this.b=parseFloat(b);break;case "rf":this.rf=parseFloat(b);break;case "lat_0":this.lat0=b*Proj4js.common.D2R;break;case "lat_1":this.lat1=b*Proj4js.common.D2R;break;case "lat_2":this.lat2=b*Proj4js.common.D2R;break;case "lat_ts":this.lat_ts=b*Proj4js.common.D2R;break;case "lon_0":this.long0=b*Proj4js.common.D2R;break;case "alpha":this.alpha=
parseFloat(b)*Proj4js.common.D2R;break;case "lonc":this.longc=b*Proj4js.common.D2R;break;case "x_0":this.x0=parseFloat(b);break;case "y_0":this.y0=parseFloat(b);break;case "k_0":this.k0=parseFloat(b);break;case "k":this.k0=parseFloat(b);break;case "R_A":this.R=true;break;case "zone":this.zone=parseInt(b);break;case "south":this.utmSouth=true;break;case "towgs84":this.datum_params=b.split(",");break;case "to_meter":this.to_meter=parseFloat(b);break;case "from_greenwich":this.from_greenwich=b*Proj4js.common.D2R;
break;case "pm":b=b.replace(/\s/gi,"");this.from_greenwich=Proj4js.PrimeMeridian[b]?Proj4js.PrimeMeridian[b]:parseFloat(b);this.from_greenwich*=Proj4js.common.D2R;break;case "no_defs":break;default:}}this.deriveConstants()},deriveConstants:function(){if(this.nagrids=="@null")this.datumCode="none";if(this.datumCode&&this.datumCode!="none"){var a=Proj4js.Datum[this.datumCode];if(a){this.datum_params=a.towgs84.split(",");this.ellps=a.ellipse;this.datumName=a.datumName?a.datumName:this.datumCode}}this.a||
Proj4js.extend(this,Proj4js.Ellipsoid[this.ellps]?Proj4js.Ellipsoid[this.ellps]:Proj4js.Ellipsoid.WGS84);if(this.rf&&!this.b)this.b=(1-1/this.rf)*this.a;if(Math.abs(this.a-this.b)<Proj4js.common.EPSLN){this.sphere=true;this.b=this.a}this.a2=this.a*this.a;this.b2=this.b*this.b;this.es=(this.a2-this.b2)/this.a2;this.e=Math.sqrt(this.es);if(this.R_A){this.a*=1-this.es*(Proj4js.common.SIXTH+this.es*(Proj4js.RA4+this.es*Proj4js.RA6));this.a2=this.a*this.a;this.b2=this.b*this.b;this.es=0}this.ep2=(this.a2-
this.b2)/this.b2;if(!this.k0)this.k0=1;this.datum=new Proj4js.datum(this)}});Proj4js.Proj.longlat={init:function(){},forward:function(a){return a},inverse:function(a){return a}};Proj4js.defs={WGS84:"+title=long/lat:WGS84 +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees","EPSG:4326":"+title=long/lat:WGS84 +proj=longlat +a=6378137.0 +b=6356752.31424518 +ellps=WGS84 +datum=WGS84 +units=degrees","EPSG:4269":"+title=long/lat:NAD83 +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"};
Proj4js.common={PI:3.141592653589793,HALF_PI:1.5707963267948966,TWO_PI:6.283185307179586,FORTPI:0.7853981633974483,R2D:57.29577951308232,D2R:0.017453292519943295,SEC_TO_RAD:4.84813681109536E-6,EPSLN:1.0E-10,MAX_ITER:20,COS_67P5:0.3826834323650898,AD_C:1.0026,PJD_UNKNOWN:0,PJD_3PARAM:1,PJD_7PARAM:2,PJD_GRIDSHIFT:3,PJD_WGS84:4,PJD_NODATUM:5,SRS_WGS84_SEMIMAJOR:6378137,SIXTH:0.16666666666666666,RA4:0.04722222222222222,RA6:0.022156084656084655,RV4:0.06944444444444445,RV6:0.04243827160493827,msfnz:function(a,
b,d){a=a*b;return d/Math.sqrt(1-a*a)},tsfnz:function(a,b,d){d=a*d;d=Math.pow((1-d)/(1+d),0.5*a);return Math.tan(0.5*(this.HALF_PI-b))/d},phi2z:function(a,b){var d=0.5*a,e,f=this.HALF_PI-2*Math.atan(b);for(i=0;i<=15;i++){e=a*Math.sin(f);e=this.HALF_PI-2*Math.atan(b*Math.pow((1-e)/(1+e),d))-f;f+=e;if(Math.abs(e)<=1.0E-10)return f}alert("phi2z has NoConvergence");return-9999},qsfnz:function(a,b){var d;if(a>1.0E-7){d=a*b;return(1-a*a)*(b/(1-d*d)-0.5/a*Math.log((1-d)/(1+d)))}else return 2*b},asinz:function(a){if(Math.abs(a)>
1)a=a>1?1:-1;return Math.asin(a)},e0fn:function(a){return 1-0.25*a*(1+a/16*(3+1.25*a))},e1fn:function(a){return 0.375*a*(1+0.25*a*(1+0.46875*a))},e2fn:function(a){return 0.05859375*a*a*(1+0.75*a)},e3fn:function(a){return a*a*a*(35/3072)},mlfn:function(a,b,d,e,f){return a*f-b*Math.sin(2*f)+d*Math.sin(4*f)-e*Math.sin(6*f)},srat:function(a,b){return Math.pow((1-a)/(1+a),b)},sign:function(a){return a<0?-1:1},adjust_lon:function(a){return a=Math.abs(a)<this.PI?a:a-this.sign(a)*this.TWO_PI},adjust_lat:function(a){return a=
Math.abs(a)<this.HALF_PI?a:a-this.sign(a)*this.PI},latiso:function(a,b,d){if(Math.abs(b)>this.HALF_PI)return+Number.NaN;if(b==this.HALF_PI)return Number.POSITIVE_INFINITY;if(b==-1*this.HALF_PI)return-1*Number.POSITIVE_INFINITY;d=a*d;return Math.log(Math.tan((this.HALF_PI+b)/2))+a*Math.log((1-d)/(1+d))/2},fL:function(a,b){return 2*Math.atan(a*Math.exp(b))-this.HALF_PI},invlatiso:function(a,b){var d=this.fL(1,b),e=0,f=0;do{e=d;f=a*Math.sin(e);d=this.fL(Math.exp(a*Math.log((1+f)/(1-f))/2),b)}while(Math.abs(d-
e)>1.0E-12);return d},sinh:function(a){a=Math.exp(a);return(a-1/a)/2},cosh:function(a){a=Math.exp(a);return(a+1/a)/2},tanh:function(a){a=Math.exp(a);return(a-1/a)/(a+1/a)},asinh:function(a){return(a>=0?1:-1)*Math.log(Math.abs(a)+Math.sqrt(a*a+1))},acosh:function(a){return 2*Math.log(Math.sqrt((a+1)/2)+Math.sqrt((a-1)/2))},atanh:function(a){return Math.log((a-1)/(a+1))/2},gN:function(a,b,d){b=b*d;return a/Math.sqrt(1-b*b)}};
Proj4js.datum=Proj4js.Class({initialize:function(a){this.datum_type=Proj4js.common.PJD_WGS84;if(a.datumCode&&a.datumCode=="none")this.datum_type=Proj4js.common.PJD_NODATUM;if(a&&a.datum_params){for(var b=0;b<a.datum_params.length;b++)a.datum_params[b]=parseFloat(a.datum_params[b]);if(a.datum_params[0]!=0||a.datum_params[1]!=0||a.datum_params[2]!=0)this.datum_type=Proj4js.common.PJD_3PARAM;if(a.datum_params.length>3)if(a.datum_params[3]!=0||a.datum_params[4]!=0||a.datum_params[5]!=0||a.datum_params[6]!=
0){this.datum_type=Proj4js.common.PJD_7PARAM;a.datum_params[3]*=Proj4js.common.SEC_TO_RAD;a.datum_params[4]*=Proj4js.common.SEC_TO_RAD;a.datum_params[5]*=Proj4js.common.SEC_TO_RAD;a.datum_params[6]=a.datum_params[6]/1E6+1}}if(a){this.a=a.a;this.b=a.b;this.es=a.es;this.ep2=a.ep2;this.datum_params=a.datum_params}},compare_datums:function(a){return this.datum_type!=a.datum_type?false:this.a!=a.a||Math.abs(this.es-a.es)>5.0E-11?false:this.datum_type==Proj4js.common.PJD_3PARAM?this.datum_params[0]==a.datum_params[0]&&
this.datum_params[1]==a.datum_params[1]&&this.datum_params[2]==a.datum_params[2]:this.datum_type==Proj4js.common.PJD_7PARAM?this.datum_params[0]==a.datum_params[0]&&this.datum_params[1]==a.datum_params[1]&&this.datum_params[2]==a.datum_params[2]&&this.datum_params[3]==a.datum_params[3]&&this.datum_params[4]==a.datum_params[4]&&this.datum_params[5]==a.datum_params[5]&&this.datum_params[6]==a.datum_params[6]:this.datum_type==Proj4js.common.PJD_GRIDSHIFT?strcmp(pj_param(this.params,"snadgrids").s,pj_param(a.params,
"snadgrids").s)==0:true},geodetic_to_geocentric:function(a){var b=a.x,d=a.y,e=a.z?a.z:0,f,g,h;if(d<-Proj4js.common.HALF_PI&&d>-1.001*Proj4js.common.HALF_PI)d=-Proj4js.common.HALF_PI;else if(d>Proj4js.common.HALF_PI&&d<1.001*Proj4js.common.HALF_PI)d=Proj4js.common.HALF_PI;else if(d<-Proj4js.common.HALF_PI||d>Proj4js.common.HALF_PI){Proj4js.reportError("geocent:lat out of range:"+d);return null}if(b>Proj4js.common.PI)b-=2*Proj4js.common.PI;g=Math.sin(d);h=Math.cos(d);f=this.a/Math.sqrt(1-this.es*g*
g);d=(f+e)*h*Math.cos(b);b=(f+e)*h*Math.sin(b);e=(f*(1-this.es)+e)*g;a.x=d;a.y=b;a.z=e;return 0},geocentric_to_geodetic:function(a){var b,d,e,f,g,h,j,l,m,o,p=a.x;e=a.y;var q=a.z?a.z:0;b=Math.sqrt(p*p+e*e);d=Math.sqrt(p*p+e*e+q*q);if(b/this.a<1.0E-12){p=0;if(d/this.a<1.0E-12)return}else p=Math.atan2(e,p);e=q/d;f=b/d;g=1/Math.sqrt(1-this.es*(2-this.es)*f*f);j=f*(1-this.es)*g;l=e*g;o=0;do{o++;h=this.a/Math.sqrt(1-this.es*l*l);d=b*j+q*l-h*(1-this.es*l*l);h=this.es*h/(h+d);g=1/Math.sqrt(1-h*(2-h)*f*f);
h=f*(1-h)*g;g=e*g;m=g*j-h*l;j=h;l=g}while(m*m>1.0E-24&&o<30);b=Math.atan(g/Math.abs(h));a.x=p;a.y=b;a.z=d;return a},geocentric_to_geodetic_noniter:function(a){var b=a.x,d=a.y,e=a.z?a.z:0,f,g,h,j,l;b=parseFloat(b);d=parseFloat(d);e=parseFloat(e);l=false;if(b!=0)f=Math.atan2(d,b);else if(d>0)f=Proj4js.common.HALF_PI;else if(d<0)f=-Proj4js.common.HALF_PI;else{l=true;f=0;if(e>0)g=Proj4js.common.HALF_PI;else if(e<0)g=-Proj4js.common.HALF_PI;else return}h=b*b+d*d;b=Math.sqrt(h);d=e*Proj4js.common.AD_C;
h=Math.sqrt(d*d+h);d=d/h;h=b/h;d=e+this.b*this.ep2*d*d*d;j=b-this.a*this.es*h*h*h;h=Math.sqrt(d*d+j*j);d=d/h;h=j/h;j=this.a/Math.sqrt(1-this.es*d*d);e=h>=Proj4js.common.COS_67P5?b/h-j:h<=-Proj4js.common.COS_67P5?b/-h-j:e/d+j*(this.es-1);if(l==false)g=Math.atan(d/h);a.x=f;a.y=g;a.z=e;return a},geocentric_to_wgs84:function(a){if(this.datum_type==Proj4js.common.PJD_3PARAM){a.x+=this.datum_params[0];a.y+=this.datum_params[1];a.z+=this.datum_params[2]}else if(this.datum_type==Proj4js.common.PJD_7PARAM){var b=
this.datum_params[3],d=this.datum_params[4],e=this.datum_params[5],f=this.datum_params[6],g=f*(e*a.x+a.y-b*a.z)+this.datum_params[1];b=f*(-d*a.x+b*a.y+a.z)+this.datum_params[2];a.x=f*(a.x-e*a.y+d*a.z)+this.datum_params[0];a.y=g;a.z=b}},geocentric_from_wgs84:function(a){if(this.datum_type==Proj4js.common.PJD_3PARAM){a.x-=this.datum_params[0];a.y-=this.datum_params[1];a.z-=this.datum_params[2]}else if(this.datum_type==Proj4js.common.PJD_7PARAM){var b=this.datum_params[3],d=this.datum_params[4],e=this.datum_params[5],
f=this.datum_params[6],g=(a.x-this.datum_params[0])/f,h=(a.y-this.datum_params[1])/f;f=(a.z-this.datum_params[2])/f;a.x=g+e*h-d*f;a.y=-e*g+h+b*f;a.z=d*g-b*h+f}}});
Proj4js.Point=Proj4js.Class({initialize:function(a,b,d){if(typeof a=="object"){this.x=a[0];this.y=a[1];this.z=a[2]||0}else if(typeof a=="string"){a=a.split(",");this.x=parseFloat(a[0]);this.y=parseFloat(a[1]);this.z=parseFloat(a[2])||0}else{this.x=a;this.y=b;this.z=d||0}},clone:function(){return new Proj4js.Point(this.x,this.y,this.z)},toString:function(){return"x="+this.x+",y="+this.y},toShortString:function(){return this.x+", "+this.y}});
Proj4js.PrimeMeridian={greenwich:0,lisbon:-9.131906111111,paris:2.337229166667,bogota:-74.080916666667,madrid:-3.687938888889,rome:12.452333333333,bern:7.439583333333,jakarta:106.807719444444,ferro:-17.666666666667,brussels:4.367975,stockholm:18.058277777778,athens:23.7163375,oslo:10.722916666667};
Proj4js.Ellipsoid={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},"APL4.":{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},
andrae:{a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},clrk80:{a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},CPM:{a:6375738.7,rf:334.29,
ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},
fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},
new_intl:{a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:6355834.8467,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS72:{a:6378135,rf:298.26,ellipseName:"WGS 72"},WGS84:{a:6378137,rf:298.257223563,ellipseName:"WGS 84"},
sphere:{a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}};
Proj4js.Datum={WGS84:{towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},GGRS87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},NAD83:{towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},NAD27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0",
ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},OSGB36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"}};
Proj4js.WGS84=new Proj4js.Proj("WGS84");Proj4js.Datum.OSB36=Proj4js.Datum.OSGB36;
Proj4js.Proj.aea={init:function(){if(Math.abs(this.lat1+this.lat2)<Proj4js.common.EPSLN)Proj4js.reportError("aeaInitEqualLatitudes");else{this.temp=this.b/this.a;this.es=1-Math.pow(this.temp,2);this.e3=Math.sqrt(this.es);this.sin_po=Math.sin(this.lat1);this.cos_po=Math.cos(this.lat1);this.con=this.t1=this.sin_po;this.ms1=Proj4js.common.msfnz(this.e3,this.sin_po,this.cos_po);this.qs1=Proj4js.common.qsfnz(this.e3,this.sin_po,this.cos_po);this.sin_po=Math.sin(this.lat2);this.cos_po=Math.cos(this.lat2);
this.t2=this.sin_po;this.ms2=Proj4js.common.msfnz(this.e3,this.sin_po,this.cos_po);this.qs2=Proj4js.common.qsfnz(this.e3,this.sin_po,this.cos_po);this.sin_po=Math.sin(this.lat0);this.cos_po=Math.cos(this.lat0);this.t3=this.sin_po;this.qs0=Proj4js.common.qsfnz(this.e3,this.sin_po,this.cos_po);this.ns0=Math.abs(this.lat1-this.lat2)>Proj4js.common.EPSLN?(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.con;this.c=this.ms1*this.ms1+this.ns0*this.qs1;this.rh=this.a*Math.sqrt(this.c-this.ns0*
this.qs0)/this.ns0}},forward:function(a){var b=a.x,d=a.y;this.sin_phi=Math.sin(d);this.cos_phi=Math.cos(d);d=Proj4js.common.qsfnz(this.e3,this.sin_phi,this.cos_phi);d=this.a*Math.sqrt(this.c-this.ns0*d)/this.ns0;var e=this.ns0*Proj4js.common.adjust_lon(b-this.long0);b=d*Math.sin(e)+this.x0;d=this.rh-d*Math.cos(e)+this.y0;a.x=b;a.y=d;return a},inverse:function(a){var b,d,e;a.x-=this.x0;a.y=this.rh-a.y+this.y0;if(this.ns0>=0){b=Math.sqrt(a.x*a.x+a.y*a.y);d=1}else{b=-Math.sqrt(a.x*a.x+a.y*a.y);d=-1}e=
0;if(b!=0)e=Math.atan2(d*a.x,d*a.y);d=b*this.ns0/this.a;b=(this.c-d*d)/this.ns0;if(this.e3>=1.0E-10){d=1-0.5*(1-this.es)*Math.log((1-this.e3)/(1+this.e3))/this.e3;d=Math.abs(Math.abs(d)-Math.abs(b))>1.0E-10?this.phi1z(this.e3,b):b>=0?0.5*PI:-0.5*PI}else d=this.phi1z(e3,b);e=Proj4js.common.adjust_lon(e/this.ns0+this.long0);a.x=e;a.y=d;return a},phi1z:function(a,b){var d,e,f=Proj4js.common.asinz(0.5*b);if(a<Proj4js.common.EPSLN)return f;for(var g=a*a,h=1;h<=25;h++){sinphi=Math.sin(f);cosphi=Math.cos(f);
d=a*sinphi;e=1-d*d;d=0.5*e*e/cosphi*(b/(1-g)-sinphi/e+0.5/a*Math.log((1-d)/(1+d)));f+=d;if(Math.abs(d)<=1.0E-7)return f}Proj4js.reportError("aea:phi1z:Convergence error");return null}};
Proj4js.Proj.sterea={dependsOn:"gauss",init:function(){Proj4js.Proj.gauss.init.apply(this);if(this.rc){this.sinc0=Math.sin(this.phic0);this.cosc0=Math.cos(this.phic0);this.R2=2*this.rc;if(!this.title)this.title="Oblique Stereographic Alternative"}else Proj4js.reportError("sterea:init:E_ERROR_0")},forward:function(a){a.x=Proj4js.common.adjust_lon(a.x-this.long0);Proj4js.Proj.gauss.forward.apply(this,[a]);sinc=Math.sin(a.y);cosc=Math.cos(a.y);cosl=Math.cos(a.x);k=this.k0*this.R2/(1+this.sinc0*sinc+
this.cosc0*cosc*cosl);a.x=k*cosc*Math.sin(a.x);a.y=k*(this.cosc0*sinc-this.sinc0*cosc*cosl);a.x=this.a*a.x+this.x0;a.y=this.a*a.y+this.y0;return a},inverse:function(a){var b,d;a.x=(a.x-this.x0)/this.a;a.y=(a.y-this.y0)/this.a;a.x/=this.k0;a.y/=this.k0;if(rho=Math.sqrt(a.x*a.x+a.y*a.y)){c=2*Math.atan2(rho,this.R2);sinc=Math.sin(c);cosc=Math.cos(c);d=Math.asin(cosc*this.sinc0+a.y*sinc*this.cosc0/rho);b=Math.atan2(a.x*sinc,rho*this.cosc0*cosc-a.y*this.sinc0*sinc)}else{d=this.phic0;b=0}a.x=b;a.y=d;Proj4js.Proj.gauss.inverse.apply(this,
[a]);a.x=Proj4js.common.adjust_lon(a.x+this.long0);return a}};function phi4z(a,b,d,e,f,g,h,j,l){var m,o,p,q;l=g;for(q=1;q<=15;q++){j=Math.sin(l);tanphi=Math.tan(l);j=tanphi*Math.sqrt(1-a*j*j);m=Math.sin(2*l);o=b*l-d*m+e*Math.sin(4*l)-f*Math.sin(6*l);p=b-2*d*Math.cos(2*l)+4*e*Math.cos(4*l)-6*f*Math.cos(6*l);j=(2*o+j*(o*o+h)-2*g*(j*o+1))/(a*m*(o*o+h-2*g*o)/(2*j)+(2*(g-o)*(j*p-2/m)-2*p));l+=j;if(Math.abs(j)<=1.0E-10)return l}Proj4js.reportError("phi4z: No convergence");return null}
function e4fn(a){var b;b=1+a;a=1-a;return Math.sqrt(Math.pow(b,b)*Math.pow(a,a))}
Proj4js.Proj.poly={init:function(){if(this.lat0=0)this.lat0=90;this.temp=this.b/this.a;this.es=1-Math.pow(this.temp,2);this.e=Math.sqrt(this.es);this.e0=Proj4js.common.e0fn(this.es);this.e1=Proj4js.common.e1fn(this.es);this.e2=Proj4js.common.e2fn(this.es);this.e3=Proj4js.common.e3fn(this.es);this.ml0=Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(a){var b,d,e,f,g;e=a.y;d=Proj4js.common.adjust_lon(a.x-this.long0);if(Math.abs(e)<=1.0E-7){g=this.x0+this.a*d;b=this.y0-
this.a*this.ml0}else{b=Math.sin(e);d=Math.cos(e);e=Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,e);f=Proj4js.common.msfnz(this.e,b,d);d=b;g=this.x0+this.a*f*Math.sin(d)/b;b=this.y0+this.a*(e-this.ml0+f*(1-Math.cos(d))/b)}a.x=g;a.y=b;return a},inverse:function(a){var b,d;a.x-=this.x0;a.y-=this.y0;b=this.ml0+a.y/this.a;if(Math.abs(b)<=1.0E-7){b=a.x/this.a+this.long0;d=0}else{b=b*b+a.x/this.a*(a.x/this.a);b=phi4z(this.es,this.e0,this.e1,this.e2,this.e3,this.al,b,void 0,d);if(b!=1)return b;b=Proj4js.common.adjust_lon(asinz(a.x*
void 0/this.a)/Math.sin(d)+this.long0)}a.x=b;a.y=d;return a}};
Proj4js.Proj.equi={init:function(){if(!this.x0)this.x0=0;if(!this.y0)this.y0=0;if(!this.lat0)this.lat0=0;if(!this.long0)this.long0=0},forward:function(a){var b=a.y,d=this.x0+this.a*Proj4js.common.adjust_lon(a.x-this.long0)*Math.cos(this.lat0);b=this.y0+this.a*b;this.t1=d;this.t2=Math.cos(this.lat0);a.x=d;a.y=b;return a},inverse:function(a){a.x-=this.x0;a.y-=this.y0;var b=a.y/this.a;Math.abs(b)>Proj4js.common.HALF_PI&&Proj4js.reportError("equi:Inv:DataError");var d=Proj4js.common.adjust_lon(this.long0+
a.x/(this.a*Math.cos(this.lat0)));a.x=d;a.y=b}};
Proj4js.Proj.merc={init:function(){if(this.lat_ts)this.k0=this.sphere?Math.cos(this.lat_ts):Proj4js.common.msfnz(this.es,Math.sin(this.lat_ts),Math.cos(this.lat_ts))},forward:function(a){var b=a.x,d=a.y;if(d*Proj4js.common.R2D>90&&d*Proj4js.common.R2D<-90&&b*Proj4js.common.R2D>180&&b*Proj4js.common.R2D<-180){Proj4js.reportError("merc:forward: llInputOutOfRange: "+b+" : "+d);return null}if(Math.abs(Math.abs(d)-Proj4js.common.HALF_PI)<=Proj4js.common.EPSLN){Proj4js.reportError("merc:forward: ll2mAtPoles");return null}else{if(this.sphere){b=
this.x0+this.a*this.k0*Proj4js.common.adjust_lon(b-this.long0);d=this.y0+this.a*this.k0*Math.log(Math.tan(Proj4js.common.FORTPI+0.5*d))}else{d=Proj4js.common.tsfnz(this.e,d,Math.sin(d));b=this.x0+this.a*this.k0*Proj4js.common.adjust_lon(b-this.long0);d=this.y0-this.a*this.k0*Math.log(d)}a.x=b;a.y=d;return a}},inverse:function(a){var b=a.x-this.x0,d=a.y-this.y0;if(this.sphere)d=Proj4js.common.HALF_PI-2*Math.atan(Math.exp(-d/this.a*this.k0));else{d=Proj4js.common.phi2z(this.e,Math.exp(-d/(this.a*this.k0)));
if(d==-9999){Proj4js.reportError("merc:inverse: lat = -9999");return null}}b=Proj4js.common.adjust_lon(this.long0+b/(this.a*this.k0));a.x=b;a.y=d;return a}};Proj4js.Proj.utm={dependsOn:"tmerc",init:function(){if(this.zone){this.lat0=0;this.long0=(6*Math.abs(this.zone)-183)*Proj4js.common.D2R;this.x0=5E5;this.y0=this.utmSouth?1E7:0;this.k0=0.9996;Proj4js.Proj.tmerc.init.apply(this);this.forward=Proj4js.Proj.tmerc.forward;this.inverse=Proj4js.Proj.tmerc.inverse}else Proj4js.reportError("utm:init: zone must be specified for UTM")}};
Proj4js.Proj.eqdc={init:function(){if(!this.mode)this.mode=0;this.temp=this.b/this.a;this.es=1-Math.pow(this.temp,2);this.e=Math.sqrt(this.es);this.e0=Proj4js.common.e0fn(this.es);this.e1=Proj4js.common.e1fn(this.es);this.e2=Proj4js.common.e2fn(this.es);this.e3=Proj4js.common.e3fn(this.es);this.sinphi=Math.sin(this.lat1);this.cosphi=Math.cos(this.lat1);this.ms1=Proj4js.common.msfnz(this.e,this.sinphi,this.cosphi);this.ml1=Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,this.lat1);if(this.mode!=
0){Math.abs(this.lat1+this.lat2)<Proj4js.common.EPSLN&&Proj4js.reportError("eqdc:Init:EqualLatitudes");this.sinphi=Math.sin(this.lat2);this.cosphi=Math.cos(this.lat2);this.ms2=Proj4js.common.msfnz(this.e,this.sinphi,this.cosphi);this.ml2=Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,this.lat2);this.ns=Math.abs(this.lat1-this.lat2)>=Proj4js.common.EPSLN?(this.ms1-this.ms2)/(this.ml2-this.ml1):this.sinphi}else this.ns=this.sinphi;this.g=this.ml1+this.ms1/this.ns;this.ml0=Proj4js.common.mlfn(this.e0,
this.e1,this.e2,this.e3,this.lat0);this.rh=this.a*(this.g-this.ml0)},forward:function(a){var b=a.x,d=this.a*(this.g-Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,a.y)),e=this.ns*Proj4js.common.adjust_lon(b-this.long0);b=this.x0+d*Math.sin(e);d=this.y0+this.rh-d*Math.cos(e);a.x=b;a.y=d;return a},inverse:function(a){a.x-=this.x0;a.y=this.rh-a.y+this.y0;var b,d;if(this.ns>=0){d=Math.sqrt(a.x*a.x+a.y*a.y);b=1}else{d=-Math.sqrt(a.x*a.x+a.y*a.y);b=-1}var e=0;if(d!=0)e=Math.atan2(b*a.x,b*a.y);b=this.phi3z(this.ml,
this.e0,this.e1,this.e2,this.e3);e=Proj4js.common.adjust_lon(this.long0+e/this.ns);a.x=e;a.y=b;return a},phi3z:function(a,b,d,e,f){var g,h;g=a;for(var j=0;j<15;j++){h=(a+d*Math.sin(2*g)-e*Math.sin(4*g)+f*Math.sin(6*g))/b-g;g+=h;if(Math.abs(h)<=1.0E-10)return g}Proj4js.reportError("PHI3Z-CONV:Latitude failed to converge after 15 iterations");return null}};
Proj4js.Proj.tmerc={init:function(){this.e0=Proj4js.common.e0fn(this.es);this.e1=Proj4js.common.e1fn(this.es);this.e2=Proj4js.common.e2fn(this.es);this.e3=Proj4js.common.e3fn(this.es);this.ml0=this.a*Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(a){var b=a.y,d=Proj4js.common.adjust_lon(a.x-this.long0),e,f;e=Math.sin(b);var g=Math.cos(b);if(this.sphere){var h=g*Math.sin(d);if(Math.abs(Math.abs(h)-1)<1.0E-10){Proj4js.reportError("tmerc:forward: Point projects into infinity");
return 93}else{f=0.5*this.a*this.k0*Math.log((1+h)/(1-h));e=Math.acos(g*Math.cos(d)/Math.sqrt(1-h*h));if(b<0)e=-e;b=this.a*this.k0*(e-this.lat0)}}else{f=g*d;d=Math.pow(f,2);g=this.ep2*Math.pow(g,2);h=Math.tan(b);var j=Math.pow(h,2);e=1-this.es*Math.pow(e,2);e=this.a/Math.sqrt(e);b=this.a*Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,b);f=this.k0*e*f*(1+d/6*(1-j+g+d/20*(5-18*j+Math.pow(j,2)+72*g-58*this.ep2)))+this.x0;b=this.k0*(b-this.ml0+e*h*d*(0.5+d/24*(5-j+9*g+4*Math.pow(g,2)+d/30*(61-58*
j+Math.pow(j,2)+600*g-330*this.ep2))))+this.y0}a.x=f;a.y=b;return a},inverse:function(a){var b,d,e,f;if(this.sphere){d=Math.exp(a.x/(this.a*this.k0));var g=0.5*(d-1/d);e=this.lat0+a.y/(this.a*this.k0);f=Math.cos(e);b=Math.sqrt((1-f*f)/(1+g*g));d=Math.asinz(b);if(e<0)d=-d;b=g==0&&f==0?this.long0:Proj4js.common.adjust_lon(Math.atan2(g,f)+this.long0)}else{g=a.x-this.x0;var h=a.y-this.y0;d=b=(this.ml0+h/this.k0)/this.a;for(f=0;;f++){e=(b+this.e1*Math.sin(2*d)-this.e2*Math.sin(4*d)+this.e3*Math.sin(6*
d))/this.e0-d;d+=e;if(Math.abs(e)<=Proj4js.common.EPSLN)break;if(f>=6){Proj4js.reportError("tmerc:inverse: Latitude failed to converge");return 95}}if(Math.abs(d)<Proj4js.common.HALF_PI){b=Math.sin(d);e=Math.cos(d);var j=Math.tan(d);f=this.ep2*Math.pow(e,2);h=Math.pow(f,2);var l=Math.pow(j,2),m=Math.pow(l,2);b=1-this.es*Math.pow(b,2);var o=this.a/Math.sqrt(b);b=o*(1-this.es)/b;g=g/(o*this.k0);var p=Math.pow(g,2);d=d-o*j*p/b*(0.5-p/24*(5+3*l+10*f-4*h-9*this.ep2-p/30*(61+90*l+298*f+45*m-252*this.ep2-
3*h)));b=Proj4js.common.adjust_lon(this.long0+g*(1-p/6*(1+2*l+f-p/20*(5-2*f+28*l-3*h+8*this.ep2+24*m)))/e)}else{d=Proj4js.common.HALF_PI*Proj4js.common.sign(h);b=this.long0}}a.x=b;a.y=d;return a}};Proj4js.defs.GOOGLE="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs";Proj4js.defs["EPSG:900913"]=Proj4js.defs.GOOGLE;
Proj4js.Proj.gstmerc={init:function(){var a=this.b/this.a;this.e=Math.sqrt(1-a*a);this.lc=this.long0;this.rs=Math.sqrt(1+this.e*this.e*Math.pow(Math.cos(this.lat0),4)/(1-this.e*this.e));a=Math.sin(this.lat0);var b=Math.asin(a/this.rs);this.cp=Proj4js.common.latiso(0,b,Math.sin(b))-this.rs*Proj4js.common.latiso(this.e,this.lat0,a);this.n2=this.k0*this.a*Math.sqrt(1-this.e*this.e)/(1-this.e*this.e*a*a);this.xs=this.x0;this.ys=this.y0-this.n2*b;if(!this.title)this.title="Gauss Schreiber transverse mercator"},
forward:function(a){var b=a.y,d=this.rs*(a.x-this.lc);b=this.cp+this.rs*Proj4js.common.latiso(this.e,b,Math.sin(b));var e=Math.asin(Math.sin(d)/Proj4js.common.cosh(b));e=Proj4js.common.latiso(0,e,Math.sin(e));a.x=this.xs+this.n2*e;a.y=this.ys+this.n2*Math.atan(Proj4js.common.sinh(b)/Math.cos(d));return a},inverse:function(a){var b=a.x,d=a.y,e=Math.atan(Proj4js.common.sinh((b-this.xs)/this.n2)/Math.cos((d-this.ys)/this.n2));b=Math.asin(Math.sin((d-this.ys)/this.n2)/Proj4js.common.cosh((b-this.xs)/
this.n2));b=Proj4js.common.latiso(0,b,Math.sin(b));a.x=this.lc+e/this.rs;a.y=Proj4js.common.invlatiso(this.e,(b-this.cp)/this.rs);return a}};
Proj4js.Proj.ortho={init:function(){this.sin_p14=Math.sin(this.lat0);this.cos_p14=Math.cos(this.lat0)},forward:function(a){var b,d,e,f,g;d=a.y;e=Proj4js.common.adjust_lon(a.x-this.long0);b=Math.sin(d);d=Math.cos(d);f=Math.cos(e);g=this.sin_p14*b+this.cos_p14*d*f;if(g>0||Math.abs(g)<=Proj4js.common.EPSLN)var h=this.a*1*d*Math.sin(e),j=this.y0+this.a*1*(this.cos_p14*b-this.sin_p14*d*f);else Proj4js.reportError("orthoFwdPointError");a.x=h;a.y=j;return a},inverse:function(a){var b,d,e,f,g;a.x-=this.x0;
a.y-=this.y0;b=Math.sqrt(a.x*a.x+a.y*a.y);b>this.a+1.0E-7&&Proj4js.reportError("orthoInvDataError");d=Proj4js.common.asinz(b/this.a);e=Math.sin(d);cosi=Math.cos(d);f=this.long0;g=Proj4js.common.asinz(void 0*this.sin_p14+y*e*this.cos_p14/b);d=Math.abs(lat0)-Proj4js.common.HALF_PI;if(Math.abs(d)<=Proj4js.common.EPSLN)f=this.lat0>=0?Proj4js.common.adjust_lon(this.long0+Math.atan2(a.x,-a.y)):Proj4js.common.adjust_lon(this.long0-Math.atan2(-a.x,a.y));d=void 0-this.sin_p14*Math.sin(g);if(Math.abs(d)>=Proj4js.common.EPSLN||
Math.abs(x)>=Proj4js.common.EPSLN)f=Proj4js.common.adjust_lon(this.long0+Math.atan2(a.x*e*this.cos_p14,d*b));a.x=f;a.y=g;return a}};
Proj4js.Proj.somerc={init:function(){var a=this.lat0;this.lambda0=this.long0;var b=Math.sin(a),d=this.a,e=1/this.rf;e=2*e-Math.pow(e,2);var f=this.e=Math.sqrt(e);this.R=d*Math.sqrt(1-e)/(1-e*Math.pow(b,2));this.alpha=Math.sqrt(1+e/(1-e)*Math.pow(Math.cos(a),4));this.b0=Math.asin(b/this.alpha);this.K=Math.log(Math.tan(Math.PI/4+this.b0/2))-this.alpha*Math.log(Math.tan(Math.PI/4+a/2))+this.alpha*f/2*Math.log((1+f*b)/(1-f*b))},forward:function(a){var b=2*(Math.atan(Math.exp(-this.alpha*(Math.log(Math.tan(Math.PI/
4-a.y/2))+this.e/2*Math.log((1+this.e*Math.sin(a.y))/(1-this.e*Math.sin(a.y))))+this.K))-Math.PI/4),d=this.alpha*(a.x-this.lambda0),e=Math.atan(Math.sin(d)/(Math.sin(this.b0)*Math.tan(b)+Math.cos(this.b0)*Math.cos(d)));b=Math.asin(Math.cos(this.b0)*Math.sin(b)-Math.sin(this.b0)*Math.cos(b)*Math.cos(d));a.y=this.R/2*Math.log((1+Math.sin(b))/(1-Math.sin(b)))+this.y0;a.x=this.R*e+this.x0;return a},inverse:function(a){var b=(a.x-this.x0)/this.R,d=2*(Math.atan(Math.exp((a.y-this.y0)/this.R))-Math.PI/4),
e=Math.asin(Math.cos(this.b0)*Math.sin(d)+Math.sin(this.b0)*Math.cos(d)*Math.cos(b));b=this.lambda0+Math.atan(Math.sin(b)/(Math.cos(this.b0)*Math.cos(b)-Math.sin(this.b0)*Math.tan(d)))/this.alpha;d=0;for(var f=e,g=-1000,h=0;Math.abs(f-g)>1.0E-7;){if(++h>20){Proj4js.reportError("omercFwdInfinity");return}d=1/this.alpha*(Math.log(Math.tan(Math.PI/4+e/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(f))/2));g=f;f=2*Math.atan(Math.exp(d))-Math.PI/2}a.x=b;a.y=f;return a}};
Proj4js.Proj.stere={ssfn_:function(a,b,d){b*=d;return Math.tan(0.5*(Proj4js.common.HALF_PI+a))*Math.pow((1-b)/(1+b),0.5*d)},TOL:1.0E-8,NITER:8,CONV:1.0E-10,S_POLE:0,N_POLE:1,OBLIQ:2,EQUIT:3,init:function(){this.phits=this.lat_ts?this.lat_ts:Proj4js.common.HALF_PI;var a=Math.abs(this.lat0);this.mode=Math.abs(a)-Proj4js.common.HALF_PI<Proj4js.common.EPSLN?this.lat0<0?this.S_POLE:this.N_POLE:a>Proj4js.common.EPSLN?this.OBLIQ:this.EQUIT;this.phits=Math.abs(this.phits);if(this.es){var b;switch(this.mode){case this.N_POLE:case this.S_POLE:if(Math.abs(this.phits-
Proj4js.common.HALF_PI)<Proj4js.common.EPSLN)this.akm1=2*this.k0/Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e));else{a=Math.sin(this.phits);this.akm1=Math.cos(this.phits)/Proj4js.common.tsfnz(this.e,this.phits,a);a*=this.e;this.akm1/=Math.sqrt(1-a*a)}break;case this.EQUIT:this.akm1=2*this.k0;break;case this.OBLIQ:a=Math.sin(this.lat0);b=2*Math.atan(this.ssfn_(this.lat0,a,this.e))-Proj4js.common.HALF_PI;a*=this.e;this.akm1=2*this.k0*Math.cos(this.lat0)/Math.sqrt(1-a*a);this.sinX1=
Math.sin(b);this.cosX1=Math.cos(b);break}}else switch(this.mode){case this.OBLIQ:this.sinph0=Math.sin(this.lat0);this.cosph0=Math.cos(this.lat0);case this.EQUIT:this.akm1=2*this.k0;break;case this.S_POLE:case this.N_POLE:this.akm1=Math.abs(this.phits-Proj4js.common.HALF_PI)>=Proj4js.common.EPSLN?Math.cos(this.phits)/Math.tan(Proj4js.common.FORTPI-0.5*this.phits):2*this.k0;break}},forward:function(a){var b=a.x,d=a.y,e,f;if(this.sphere){var g,h,j;g=Math.sin(d);h=Math.cos(d);j=Math.cos(b);b=Math.sin(b);
switch(this.mode){case this.EQUIT:f=1+h*j;f=this.akm1/f;e=f*h*b;f*=g;break;case this.OBLIQ:f=1+this.sinph0*g+this.cosph0*h*j;f=this.akm1/f;e=f*h*b;f*=this.cosph0*g-this.sinph0*h*j;break;case this.N_POLE:j=-j;d=-d;case this.S_POLE:f=this.akm1*Math.tan(Proj4js.common.FORTPI+0.5*d);e=b*f;f*=j;break}}else{j=Math.cos(b);b=Math.sin(b);g=Math.sin(d);if(this.mode==this.OBLIQ||this.mode==this.EQUIT){X=2*Math.atan(this.ssfn_(d,g,this.e));sinX=Math.sin(X-Proj4js.common.HALF_PI);cosX=Math.cos(X)}switch(this.mode){case this.OBLIQ:A=
this.akm1/(this.cosX1*(1+this.sinX1*sinX+this.cosX1*cosX*j));f=A*(this.cosX1*sinX-this.sinX1*cosX*j);e=A*cosX;break;case this.EQUIT:A=2*this.akm1/(1+cosX*j);f=A*sinX;e=A*cosX;break;case this.S_POLE:d=-d;j=-j;g=-g;case this.N_POLE:e=this.akm1*Proj4js.common.tsfnz(this.e,d,g);f=-e*j;break}e*=b}a.x=e*this.a+this.x0;a.y=f*this.a+this.y0;return a},inverse:function(a){var b=(a.x-this.x0)/this.a,d=(a.y-this.y0)/this.a,e,f,g=0,h=0,j,l=f=0;if(this.sphere)switch(this.mode){case this.EQUIT:break;case this.OBLIQ:break;
case this.N_POLE:case this.S_POLE:break}else{j=Math.sqrt(b*b+d*d);switch(this.mode){case this.OBLIQ:case this.EQUIT:g=2*Math.atan2(j*this.cosX1,this.akm1);f=Math.cos(g);e=Math.sin(g);h=j==0?Math.asin(f*this.sinX1):Math.asin(f*this.sinX1+d*e*this.cosX1/j);g=Math.tan(0.5*(Proj4js.common.HALF_PI+h));b*=e;d=j*this.cosX1*f-d*this.sinX1*e;l=Proj4js.common.HALF_PI;f=0.5*this.e;break;case this.N_POLE:d=-d;case this.S_POLE:g=-j/this.akm1;h=Proj4js.common.HALF_PI-2*Math.atan(g);l=-Proj4js.common.HALF_PI;f=
-0.5*this.e;break}for(j=this.NITER;j--;h=e){e=this.e*Math.sin(h);e=2*Math.atan(g*Math.pow((1+e)/(1-e),f))-l;if(Math.abs(h-e)<this.CONV){if(this.mode==this.S_POLE)e=-e;b=b==0&&d==0?0:Math.atan2(b,d);a.x=b;a.y=e;return a}}}}};
Proj4js.Proj.nzmg={iterations:1,init:function(){this.A=[];this.A[1]=+0.6399175073;this.A[2]=-0.1358797613;this.A[3]=+0.063294409;this.A[4]=-0.02526853;this.A[5]=+0.0117879;this.A[6]=-0.0055161;this.A[7]=+0.0026906;this.A[8]=-0.001333;this.A[9]=+6.7E-4;this.A[10]=-3.4E-4;this.B_re=[];this.B_im=[];this.B_re[1]=+0.7557853228;this.B_im[1]=0;this.B_re[2]=+0.249204646;this.B_im[2]=+0.003371507;this.B_re[3]=-0.001541739;this.B_im[3]=+0.04105856;this.B_re[4]=-0.10162907;this.B_im[4]=+0.01727609;this.B_re[5]=
-0.26623489;this.B_im[5]=-0.36249218;this.B_re[6]=-0.6870983;this.B_im[6]=-1.1651967;this.C_re=[];this.C_im=[];this.C_re[1]=+1.3231270439;this.C_im[1]=0;this.C_re[2]=-0.577245789;this.C_im[2]=-0.007809598;this.C_re[3]=+0.508307513;this.C_im[3]=-0.112208952;this.C_re[4]=-0.15094762;this.C_im[4]=+0.18200602;this.C_re[5]=+1.01418179;this.C_im[5]=+1.64497696;this.C_re[6]=+1.9660549;this.C_im[6]=+2.5127645;this.D=[];this.D[1]=+1.5627014243;this.D[2]=+0.5185406398;this.D[3]=-0.03333098;this.D[4]=-0.1052906;
this.D[5]=-0.0368594;this.D[6]=+0.007317;this.D[7]=+0.0122;this.D[8]=+0.00394;this.D[9]=-0.0013},forward:function(a){var b=(a.y-this.lat0)/Proj4js.common.SEC_TO_RAD*1.0E-5,d=a.x-this.long0,e=1,f=0;for(n=1;n<=10;n++){e*=b;f+=this.A[n]*e}b=f;e=1;f=0;var g,h=0,j=0;for(n=1;n<=6;n++){g=f*b+e*d;e=e*b-f*d;f=g;h=h+this.B_re[n]*e-this.B_im[n]*f;j=j+this.B_im[n]*e+this.B_re[n]*f}x=j*this.a+this.x0;y=h*this.a+this.y0;a.x=x;a.y=y;return a},inverse:function(a){var b=(a.y-this.y0)/this.a,d=(a.x-this.x0)/this.a,
e=1,f=0,g,h=0,j=0;for(n=1;n<=6;n++){g=f*b+e*d;e=e*b-f*d;f=g;h=h+this.C_re[n]*e-this.C_im[n]*f;j=j+this.C_im[n]*e+this.C_re[n]*f}for(i=0;i<this.iterations;i++){var l=h,m=j,o;e=b;f=d;for(n=2;n<=6;n++){o=m*h+l*j;l=l*h-m*j;m=o;e+=(n-1)*(this.B_re[n]*l-this.B_im[n]*m);f+=(n-1)*(this.B_im[n]*l+this.B_re[n]*m)}l=1;m=0;g=this.B_re[1];var p=this.B_im[1];for(n=2;n<=6;n++){o=m*h+l*j;l=l*h-m*j;m=o;g+=n*(this.B_re[n]*l-this.B_im[n]*m);p+=n*(this.B_im[n]*l+this.B_re[n]*m)}j=g*g+p*p;h=(e*g+f*p)/j;j=(f*g-e*p)/j}b=
1;d=0;for(n=1;n<=9;n++){b*=h;d+=this.D[n]*b}h=this.lat0+d*Proj4js.common.SEC_TO_RAD*1E5;a.x=this.long0+j;a.y=h;return a}};
Proj4js.Proj.mill={init:function(){},forward:function(a){var b=a.y;dlon=Proj4js.common.adjust_lon(a.x-this.long0);var d=this.x0+this.a*dlon;b=this.y0+this.a*Math.log(Math.tan(Proj4js.common.PI/4+b/2.5))*1.25;a.x=d;a.y=b;return a},inverse:function(a){a.x-=this.x0;a.y-=this.y0;var b=Proj4js.common.adjust_lon(this.long0+a.x/this.a),d=2.5*(Math.atan(Math.exp(0.8*a.y/this.a))-Proj4js.common.PI/4);a.x=b;a.y=d;return a}};
Proj4js.Proj.sinu={init:function(){this.R=6370997},forward:function(a){var b,d;d=a.y;b=this.R*Proj4js.common.adjust_lon(a.x-this.long0)*Math.cos(d)+this.x0;d=this.R*d+this.y0;a.x=b;a.y=d;return a},inverse:function(a){var b,d;a.x-=this.x0;a.y-=this.y0;b=a.y/this.R;Math.abs(b)>Proj4js.common.HALF_PI&&Proj4js.reportError("sinu:Inv:DataError");d=Math.abs(b)-Proj4js.common.HALF_PI;if(Math.abs(d)>Proj4js.common.EPSLN){d=this.long0+a.x/(this.R*Math.cos(b));d=Proj4js.common.adjust_lon(d)}else d=this.long0;
a.x=d;a.y=b;return a}};var GEOCENT_LAT_ERROR=1,COS_67P5=0.3826834323650898,AD_C=1.0026;function cs_geodetic_to_geocentric(a,b){var d=b.x,e=b.y,f=b.z,g,h,j,l=0;if(e<-HALF_PI&&e>-1.001*HALF_PI)e=-HALF_PI;else if(e>HALF_PI&&e<1.001*HALF_PI)e=HALF_PI;else if(e<-HALF_PI||e>HALF_PI)l|=GEOCENT_LAT_ERROR;if(!l){if(d>PI)d-=2*PI;j=Math.sin(e);h=Math.cos(e);e=a.a/Math.sqrt(1-a.es*j*j);g=(e+f)*h*Math.cos(d);h=(e+f)*h*Math.sin(d);j=(e*(1-a.es)+f)*j}b.x=g;b.y=h;b.z=j;return l}
function cs_geocentric_to_geodetic(a,b){var d=b.x,e=b.y,f=b.z,g,h,j,l,m;d=parseFloat(d);e=parseFloat(e);f=parseFloat(f);m=false;if(d!=0)g=Math.atan2(e,d);else if(e>0)g=HALF_PI;else if(e<0)g=-HALF_PI;else{m=true;g=0;if(f>0)h=HALF_PI;else if(f<0)h=-HALF_PI;else return}j=d*d+e*e;d=Math.sqrt(j);e=f*AD_C;j=Math.sqrt(e*e+j);e=e/j;j=d/j;e=f+a.b*a.ep2*e*e*e;l=d-a.a*a.es*j*j*j;j=Math.sqrt(e*e+l*l);e=e/j;j=l/j;l=a.a/Math.sqrt(1-a.es*e*e);f=j>=COS_67P5?d/j-l:j<=-COS_67P5?d/-j-l:f/e+l*(a.es-1);if(m==false)h=
Math.atan(e/j);b.x=g;b.y=h;b.z=f;return 0}function cs_geocentric_to_wgs84(a,b){if(a.datum_type==PJD_3PARAM){b.x+=a.datum_params[0];b.y+=a.datum_params[1];b.z+=a.datum_params[2]}else{var d=a.datum_params[3],e=a.datum_params[4],f=a.datum_params[5],g=a.datum_params[6],h=g*(f*b.x+b.y-d*b.z)+a.datum_params[1];d=g*(-e*b.x+d*b.y+b.z)+a.datum_params[2];b.x=g*(b.x-f*b.y+e*b.z)+a.datum_params[0];b.y=h;b.z=d}}
function cs_geocentric_from_wgs84(a,b){if(a.datum_type==PJD_3PARAM){b.x-=a.datum_params[0];b.y-=a.datum_params[1];b.z-=a.datum_params[2]}else{var d=a.datum_params[3],e=a.datum_params[4],f=a.datum_params[5],g=a.datum_params[6],h=(b.x-a.datum_params[0])/g,j=(b.y-a.datum_params[1])/g;g=(b.z-a.datum_params[2])/g;b.x=h+f*j-e*g;b.y=-f*h+j+d*g;b.z=e*h-d*j+g}}
Proj4js.Proj.vandg={init:function(){this.R=6370997},forward:function(a){var b=a.y,d=Proj4js.common.adjust_lon(a.x-this.long0),e=Proj4js.common.asinz(2*Math.abs(b/Proj4js.common.PI)),f=0.5*Math.abs(Proj4js.common.PI/d-d/Proj4js.common.PI),g=f*f,h=Math.sin(e);e=Math.cos(e);e=e/(h+e-1);h=e*(2/h-1);h=h*h;g=Proj4js.common.PI*this.R*(f*(e-h)+Math.sqrt(g*(e-h)*(e-h)-(h+g)*(e*e-h)))/(h+g);if(d<0)g=-g;d=this.x0+g;g=Math.abs(g/(Proj4js.common.PI*this.R));b=b>=0?this.y0+Proj4js.common.PI*this.R*Math.sqrt(1-
g*g-2*f*g):this.y0-Proj4js.common.PI*this.R*Math.sqrt(1-g*g-2*f*g);a.x=d;a.y=b;return a},inverse:function(a){var b,d,e,f,g,h,j,l;a.x-=this.x0;a.y-=this.y0;f=Proj4js.common.PI*this.R;b=a.x/f;d=a.y/f;e=b*b+d*d;f=-Math.abs(d)*(1+e);g=f-2*d*d+b*b;h=-2*f+1+2*d*d+e*e;j=(f-g*g/3/h)/h;l=2*Math.sqrt(-j/3);f=3*(d*d/h+(2*g*g*g/h/h/h-9*f*g/h/h)/27)/j/l;if(Math.abs(f)>1)f=f>=0?1:-1;f=Math.acos(f)/3;lat=a.y>=0?(-l*Math.cos(f+Proj4js.common.PI/3)-g/3/h)*Proj4js.common.PI:-(-l*Math.cos(f+PI/3)-g/3/h)*Proj4js.common.PI;
if(Math.abs(b)<Proj4js.common.EPSLN)lon=this.long0;lon=Proj4js.common.adjust_lon(this.long0+Proj4js.common.PI*(e-1+Math.sqrt(1+2*(b*b-d*d)+e*e))/2/b);a.x=lon;a.y=lat;return a}};
Proj4js.Proj.eqc={init:function(){if(!this.x0)this.x0=0;if(!this.y0)this.y0=0;if(!this.lat0)this.lat0=0;if(!this.long0)this.long0=0;if(!this.lat_ts)this.lat_ts=0;if(!this.title)this.title="Equidistant Cylindrical (Plate Carre)";this.rc=Math.cos(this.lat_ts)},forward:function(a){var b=a.y,d=Proj4js.common.adjust_lon(a.x-this.long0);b=Proj4js.common.adjust_lat(b-this.lat0);a.x=this.x0+this.a*d*this.rc;a.y=this.y0+this.a*b;return a},inverse:function(a){var b=a.y;a.x=Proj4js.common.adjust_lon(this.long0+
(a.x-this.x0)/(this.a*this.rc));a.y=Proj4js.common.adjust_lat(this.lat0+(b-this.y0)/this.a);return a}};
Proj4js.Proj.gauss={init:function(){sphi=Math.sin(this.lat0);cphi=Math.cos(this.lat0);cphi*=cphi;this.rc=Math.sqrt(1-this.es)/(1-this.es*sphi*sphi);this.C=Math.sqrt(1+this.es*cphi*cphi/(1-this.es));this.phic0=Math.asin(sphi/this.C);this.ratexp=0.5*this.C*this.e;this.K=Math.tan(0.5*this.phic0+Proj4js.common.FORTPI)/(Math.pow(Math.tan(0.5*this.lat0+Proj4js.common.FORTPI),this.C)*Proj4js.common.srat(this.e*sphi,this.ratexp))},forward:function(a){var b=a.x,d=a.y;a.y=2*Math.atan(this.K*Math.pow(Math.tan(0.5*
d+Proj4js.common.FORTPI),this.C)*Proj4js.common.srat(this.e*Math.sin(d),this.ratexp))-Proj4js.common.HALF_PI;a.x=this.C*b;return a},inverse:function(a){var b=a.x/this.C,d=a.y;num=Math.pow(Math.tan(0.5*d+Proj4js.common.FORTPI)/this.K,1/this.C);for(var e=Proj4js.common.MAX_ITER;e>0;--e){d=2*Math.atan(num*Proj4js.common.srat(this.e*Math.sin(a.y),-0.5*this.e))-Proj4js.common.HALF_PI;if(Math.abs(d-a.y)<1.0E-14)break;a.y=d}if(!e){Proj4js.reportError("gauss:inverse:convergence failed");return null}a.x=b;
a.y=d;return a}};
Proj4js.Proj.omerc={init:function(){if(!this.mode)this.mode=0;if(!this.lon1){this.lon1=0;this.mode=1}if(!this.lon2)this.lon2=0;if(!this.lat2)this.lat2=0;var a=1-Math.pow(this.b/this.a,2);this.sin_p20=Math.sin(this.lat0);this.cos_p20=Math.cos(this.lat0);this.con=1-this.es*this.sin_p20*this.sin_p20;this.com=Math.sqrt(1-a);this.bl=Math.sqrt(1+this.es*Math.pow(this.cos_p20,4)/(1-a));this.al=this.a*this.bl*this.k0*this.com/this.con;if(Math.abs(this.lat0)<Proj4js.common.EPSLN)this.el=this.d=this.ts=1;else{this.ts=
Proj4js.common.tsfnz(this.e,this.lat0,this.sin_p20);this.con=Math.sqrt(this.con);this.d=this.bl*this.com/(this.cos_p20*this.con);this.f=this.d*this.d-1>0?this.lat0>=0?this.d+Math.sqrt(this.d*this.d-1):this.d-Math.sqrt(this.d*this.d-1):this.d;this.el=this.f*Math.pow(this.ts,this.bl)}if(this.mode!=0){this.g=0.5*(this.f-1/this.f);this.gama=Proj4js.common.asinz(Math.sin(this.alpha)/this.d);this.longc-=Proj4js.common.asinz(this.g*Math.tan(this.gama))/this.bl;this.con=Math.abs(this.lat0);if(this.con>Proj4js.common.EPSLN&&
Math.abs(this.con-Proj4js.common.HALF_PI)>Proj4js.common.EPSLN){this.singam=Math.sin(this.gama);this.cosgam=Math.cos(this.gama);this.sinaz=Math.sin(this.alpha);this.cosaz=Math.cos(this.alpha);this.u=this.lat0>=0?this.al/this.bl*Math.atan(Math.sqrt(this.d*this.d-1)/this.cosaz):-(this.al/this.bl)*Math.atan(Math.sqrt(this.d*this.d-1)/this.cosaz)}else Proj4js.reportError("omerc:Init:DataError")}else{this.sinphi=Math.sin(this.at1);this.ts1=Proj4js.common.tsfnz(this.e,this.lat1,this.sinphi);this.sinphi=
Math.sin(this.lat2);this.ts2=Proj4js.common.tsfnz(this.e,this.lat2,this.sinphi);this.h=Math.pow(this.ts1,this.bl);this.l=Math.pow(this.ts2,this.bl);this.f=this.el/this.h;this.g=0.5*(this.f-1/this.f);this.j=(this.el*this.el-this.l*this.h)/(this.el*this.el+this.l*this.h);this.p=(this.l-this.h)/(this.l+this.h);this.dlon=this.lon1-this.lon2;if(this.dlon<-Proj4js.common.PI)this.lon2-=2*Proj4js.common.PI;if(this.dlon>Proj4js.common.PI)this.lon2+=2*Proj4js.common.PI;this.dlon=this.lon1-this.lon2;this.longc=
0.5*(this.lon1+this.lon2)-Math.atan(this.j*Math.tan(0.5*this.bl*this.dlon)/this.p)/this.bl;this.dlon=Proj4js.common.adjust_lon(this.lon1-this.longc);this.gama=Math.atan(Math.sin(this.bl*this.dlon)/this.g);this.alpha=Proj4js.common.asinz(this.d*Math.sin(this.gama));if(Math.abs(this.lat1-this.lat2)<=Proj4js.common.EPSLN)Proj4js.reportError("omercInitDataError");else this.con=Math.abs(this.lat1);if(this.con<=Proj4js.common.EPSLN||Math.abs(this.con-HALF_PI)<=Proj4js.common.EPSLN)Proj4js.reportError("omercInitDataError");
else Math.abs(Math.abs(this.lat0)-Proj4js.common.HALF_PI)<=Proj4js.common.EPSLN&&Proj4js.reportError("omercInitDataError");this.singam=Math.sin(this.gam);this.cosgam=Math.cos(this.gam);this.sinaz=Math.sin(this.alpha);this.cosaz=Math.cos(this.alpha);this.u=this.lat0>=0?this.al/this.bl*Math.atan(Math.sqrt(this.d*this.d-1)/this.cosaz):-(this.al/this.bl)*Math.atan(Math.sqrt(this.d*this.d-1)/this.cosaz)}},forward:function(a){var b,d,e,f,g;e=a.x;d=a.y;b=Math.sin(d);f=Proj4js.common.adjust_lon(e-this.longc);
e=Math.sin(this.bl*f);if(Math.abs(Math.abs(d)-Proj4js.common.HALF_PI)>Proj4js.common.EPSLN){b=Proj4js.common.tsfnz(this.e,d,b);b=this.el/Math.pow(b,this.bl);g=0.5*(b-1/b);b=(g*this.singam-e*this.cosgam)/(0.5*(b+1/b));d=Math.cos(this.bl*f);if(Math.abs(d)<1.0E-7)e=this.al*this.bl*f;else{e=this.al*Math.atan((g*this.cosgam+e*this.singam)/d)/this.bl;if(d<0)e+=Proj4js.common.PI*this.al/this.bl}}else{b=d>=0?this.singam:-this.singam;e=this.al*d/this.bl}Math.abs(Math.abs(b)-1)<=Proj4js.common.EPSLN&&Proj4js.reportError("omercFwdInfinity");
f=0.5*this.al*Math.log((1-b)/(1+b))/this.bl;e-=this.u;b=this.y0+e*this.cosaz-f*this.sinaz;a.x=this.x0+f*this.cosaz+e*this.sinaz;a.y=b;return a},inverse:function(a){var b,d,e,f;a.x-=this.x0;a.y-=this.y0;b=a.x*this.cosaz-a.y*this.sinaz;e=a.y*this.cosaz+a.x*this.sinaz;e+=this.u;d=Math.exp(-this.bl*b/this.al);b=0.5*(d-1/d);e=Math.sin(this.bl*e/this.al);f=(e*this.cosgam+b*this.singam)/(0.5*(d+1/d));if(Math.abs(Math.abs(f)-1)<=Proj4js.common.EPSLN){lon=this.longc;lat=f>=0?Proj4js.common.HALF_PI:-Proj4js.common.HALF_PI}else{d=
1/this.bl;f=Math.pow(this.el/Math.sqrt((1+f)/(1-f)),d);lat=Proj4js.common.phi2z(this.e,f);b=this.longc-Math.atan2(b*this.cosgam-e*this.singam,d)/this.bl;lon=Proj4js.common.adjust_lon(b)}a.x=lon;a.y=lat;return a}};
Proj4js.Proj.lcc={init:function(){if(!this.lat2)this.lat2=this.lat0;if(!this.k0)this.k0=1;if(Math.abs(this.lat1+this.lat2)<Proj4js.common.EPSLN)Proj4js.reportError("lcc:init: Equal Latitudes");else{var a=this.b/this.a;this.e=Math.sqrt(1-a*a);a=Math.sin(this.lat1);var b=Proj4js.common.msfnz(this.e,a,Math.cos(this.lat1)),d=Proj4js.common.tsfnz(this.e,this.lat1,a),e=Math.sin(this.lat2),f=Proj4js.common.msfnz(this.e,e,Math.cos(this.lat2));e=Proj4js.common.tsfnz(this.e,this.lat2,e);var g=Proj4js.common.tsfnz(this.e,
this.lat0,Math.sin(this.lat0));this.ns=Math.abs(this.lat1-this.lat2)>Proj4js.common.EPSLN?Math.log(b/f)/Math.log(d/e):a;this.f0=b/(this.ns*Math.pow(d,this.ns));this.rh=this.a*this.f0*Math.pow(g,this.ns);if(!this.title)this.title="Lambert Conformal Conic"}},forward:function(a){var b=a.x,d=a.y;if(!(d<=90&&d>=-90&&b<=180&&b>=-180)){Proj4js.reportError("lcc:forward: llInputOutOfRange: "+b+" : "+d);return null}var e=Math.abs(Math.abs(d)-Proj4js.common.HALF_PI);if(e>Proj4js.common.EPSLN){d=Proj4js.common.tsfnz(this.e,
d,Math.sin(d));rh1=this.a*this.f0*Math.pow(d,this.ns)}else{e=d*this.ns;if(e<=0){Proj4js.reportError("lcc:forward: No Projection");return null}rh1=0}b=this.ns*Proj4js.common.adjust_lon(b-this.long0);a.x=this.k0*rh1*Math.sin(b)+this.x0;a.y=this.k0*(this.rh-rh1*Math.cos(b))+this.y0;return a},inverse:function(a){var b,d,e;x=(a.x-this.x0)/this.k0;y=this.rh-(a.y-this.y0)/this.k0;if(this.ns>0){b=Math.sqrt(x*x+y*y);d=1}else{b=-Math.sqrt(x*x+y*y);d=-1}e=0;if(b!=0)e=Math.atan2(d*x,d*y);if(b!=0||this.ns>0){d=
1/this.ns;b=Math.pow(b/(this.a*this.f0),d);b=Proj4js.common.phi2z(this.e,b);if(b==-9999)return null}else b=-Proj4js.common.HALF_PI;e=Proj4js.common.adjust_lon(e/this.ns+this.long0);a.x=e;a.y=b;return a}};
Proj4js.Proj.laea={init:function(){this.sin_lat_o=Math.sin(this.lat0);this.cos_lat_o=Math.cos(this.lat0)},forward:function(a){var b=a.y,d=Proj4js.common.adjust_lon(a.x-this.long0),e=Math.sin(b);b=Math.cos(b);var f=Math.sin(d);d=Math.cos(d);var g=this.sin_lat_o*e+this.cos_lat_o*b*d;if(g==-1){Proj4js.reportError("laea:fwd:Point projects to a circle of radius "+2*R);return null}g=this.a*Math.sqrt(2/(1+g));e=g*(this.cos_lat_o*e-this.sin_lat_o*b*d)+this.y0;a.x=g*b*f+this.x0;a.y=e;return a},inverse:function(a){a.x-=
this.x0;a.y-=this.y0;var b=Math.sqrt(a.x*a.x+a.y*a.y),d=b/(2*this.a);if(d>1){Proj4js.reportError("laea:Inv:DataError");return null}d=2*Proj4js.common.asinz(d);var e=Math.sin(d),f=Math.cos(d),g=this.long0;if(Math.abs(b)>Proj4js.common.EPSLN){var h=Proj4js.common.asinz(this.sin_lat_o*f+this.cos_lat_o*e*a.y/b);d=Math.abs(this.lat0)-Proj4js.common.HALF_PI;if(Math.abs(d)>Proj4js.common.EPSLN){d=f-this.sin_lat_o*Math.sin(h);if(d!=0)g=Proj4js.common.adjust_lon(this.long0+Math.atan2(a.x*e*this.cos_lat_o,
d*b))}else g=this.lat0<0?Proj4js.common.adjust_lon(this.long0-Math.atan2(-a.x,a.y)):Proj4js.common.adjust_lon(this.long0+Math.atan2(a.x,-a.y))}else h=this.lat0;a.x=g;a.y=h;return a}};
Proj4js.Proj.aeqd={init:function(){this.sin_p12=Math.sin(this.lat0);this.cos_p12=Math.cos(this.lat0)},forward:function(a){var b=a.x,d,e=Math.sin(a.y),f=Math.cos(a.y);b=Proj4js.common.adjust_lon(b-this.long0);var g=Math.cos(b),h=this.sin_p12*e+this.cos_p12*f*g;if(Math.abs(Math.abs(h)-1)<Proj4js.common.EPSLN){d=1;if(h<0){Proj4js.reportError("aeqd:Fwd:PointError");return}}else{d=Math.acos(h);d=d/Math.sin(d)}a.x=this.x0+this.a*d*f*Math.sin(b);a.y=this.y0+this.a*d*(this.cos_p12*e-this.sin_p12*f*g);return a},
inverse:function(a){a.x-=this.x0;a.y-=this.y0;var b=Math.sqrt(a.x*a.x+a.y*a.y);if(b>2*Proj4js.common.HALF_PI*this.a)Proj4js.reportError("aeqdInvDataError");else{var d=b/this.a,e=Math.sin(d);d=Math.cos(d);var f=this.long0,g;if(Math.abs(b)<=Proj4js.common.EPSLN)g=this.lat0;else{g=Proj4js.common.asinz(d*this.sin_p12+a.y*e*this.cos_p12/b);var h=Math.abs(this.lat0)-Proj4js.common.HALF_PI;if(Math.abs(h)<=Proj4js.common.EPSLN)f=lat0>=0?Proj4js.common.adjust_lon(this.long0+Math.atan2(a.x,-a.y)):Proj4js.common.adjust_lon(this.long0-
Math.atan2(-a.x,a.y));else{h=d-this.sin_p12*Math.sin(g);Math.abs(h)<Proj4js.common.EPSLN&&Math.abs(a.x)<Proj4js.common.EPSLN||(f=Proj4js.common.adjust_lon(this.long0+Math.atan2(a.x*e*this.cos_p12,h*b)))}}a.x=f;a.y=g;return a}}};
Proj4js.Proj.moll={init:function(){},forward:function(a){for(var b=a.y,d=Proj4js.common.adjust_lon(a.x-this.long0),e=b,f=Proj4js.common.PI*Math.sin(b),g=0;;g++){var h=-(e+Math.sin(e)-f)/(1+Math.cos(e));e+=h;if(Math.abs(h)<Proj4js.common.EPSLN)break;g>=50&&Proj4js.reportError("moll:Fwd:IterationError")}e/=2;if(Proj4js.common.PI/2-Math.abs(b)<Proj4js.common.EPSLN)d=0;b=0.900316316158*this.a*d*Math.cos(e)+this.x0;e=1.4142135623731*this.a*Math.sin(e)+this.y0;a.x=b;a.y=e;return a},inverse:function(a){var b;
a.x-=this.x0;b=a.y/(1.4142135623731*this.a);if(Math.abs(b)>0.999999999999)b=0.999999999999;b=Math.asin(b);var d=Proj4js.common.adjust_lon(this.long0+a.x/(0.900316316158*this.a*Math.cos(b)));if(d<-Proj4js.common.PI)d=-Proj4js.common.PI;if(d>Proj4js.common.PI)d=Proj4js.common.PI;b=(2*b+Math.sin(2*b))/Proj4js.common.PI;if(Math.abs(b)>1)b=1;b=Math.asin(b);a.x=d;a.y=b;return a}};OpenLayers.Util={};
OpenLayers.Util.getElement=function(){for(var a=[],b=0,d=arguments.length;b<d;b++){var e=arguments[b];if(typeof e=="string")e=document.getElementById(e);if(arguments.length==1)return e;a.push(e)}return a};OpenLayers.Util.isElement=function(a){return!!(a&&a.nodeType===1)};if(typeof window.$==="undefined")window.$=OpenLayers.Util.getElement;
OpenLayers.Util.extend=function(a,b){a=a||{};if(b){for(var d in b){var e=b[d];if(e!==undefined)a[d]=e}if(!(typeof window.Event=="function"&&b instanceof window.Event)&&b.hasOwnProperty&&b.hasOwnProperty("toString"))a.toString=b.toString}return a};OpenLayers.Util.removeItem=function(a,b){for(var d=a.length-1;d>=0;d--)a[d]==b&&a.splice(d,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);else{for(var d=0,e=a.length;d<e;d++)if(a[d]==b)return d;return-1}};
OpenLayers.Util.modifyDOMElement=function(a,b,d,e,f,g,h,j){if(b)a.id=b;if(d){a.style.left=d.x+"px";a.style.top=d.y+"px"}if(e){a.style.width=e.w+"px";a.style.height=e.h+"px"}if(f)a.style.position=f;if(g)a.style.border=g;if(h)a.style.overflow=h;if(parseFloat(j)>=0&&parseFloat(j)<1){a.style.filter="alpha(opacity="+j*100+")";a.style.opacity=j}else if(parseFloat(j)==1){a.style.filter="";a.style.opacity=""}};
OpenLayers.Util.createDiv=function(a,b,d,e,f,g,h,j){var l=document.createElement("div");if(e)l.style.backgroundImage="url("+e+")";a||(a=OpenLayers.Util.createUniqueID("OpenLayersDiv"));f||(f="absolute");OpenLayers.Util.modifyDOMElement(l,a,b,d,f,g,h,j);return l};
OpenLayers.Util.createImage=function(a,b,d,e,f,g,h,j){var l=document.createElement("img");a||(a=OpenLayers.Util.createUniqueID("OpenLayersDiv"));f||(f="relative");OpenLayers.Util.modifyDOMElement(l,a,b,d,f,g,null,h);if(j){l.style.display="none";OpenLayers.Event.observe(l,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,l));OpenLayers.Event.observe(l,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,l))}l.style.alt=a;l.galleryImg="no";if(e)l.src=e;return l};
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(),d,e;for(e=0;d=a[e];e++)if(b.indexOf(d)!=-1)break;var f=Math.floor(a.length*Math.random());f=a[f];for(e=0;f==d&&e++<4;){f=Math.floor(a.length*Math.random());f=a[f]}this.src=b.replace(d,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");a=parseFloat(a[1]);var b=false;try{b=!!document.body.filters}catch(d){}OpenLayers.Util.alphaHackNeeded=b&&a>=5.5&&a<7}return OpenLayers.Util.alphaHackNeeded};
OpenLayers.Util.modifyAlphaImageDiv=function(a,b,d,e,f,g,h,j,l){OpenLayers.Util.modifyDOMElement(a,b,d,e,g,null,null,l);b=a.childNodes[0];if(f)b.src=f;OpenLayers.Util.modifyDOMElement(b,a.id+"_innerImage",null,e,"relative",h);if(OpenLayers.Util.alphaHack()){if(a.style.display!="none")a.style.display="inline-block";if(j==null)j="scale";a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+b.src+"', sizingMethod='"+j+"')";if(parseFloat(a.style.opacity)>=0&&parseFloat(a.style.opacity)<
1)a.style.filter+=" alpha(opacity="+a.style.opacity*100+")";b.style.filter="alpha(opacity=0)"}};
OpenLayers.Util.createAlphaImageDiv=function(a,b,d,e,f,g,h,j,l){var m=OpenLayers.Util.createDiv(),o=OpenLayers.Util.createImage(null,null,null,null,null,null,null,false);m.appendChild(o);if(l){o.style.display="none";OpenLayers.Event.observe(o,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,m));OpenLayers.Event.observe(o,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,m))}OpenLayers.Util.modifyAlphaImageDiv(m,a,b,d,e,f,g,h,j);return m};
OpenLayers.Util.upperCaseObject=function(a){var b={};for(var d in a)b[d.toUpperCase()]=a[d];return b};OpenLayers.Util.applyDefaults=function(a,b){a=a||{};var d=typeof window.Event=="function"&&b instanceof window.Event;for(var e in b)if(a[e]===undefined||!d&&b.hasOwnProperty&&b.hasOwnProperty(e)&&!a.hasOwnProperty(e))a[e]=b[e];if(!d&&b&&b.hasOwnProperty&&b.hasOwnProperty("toString")&&!a.hasOwnProperty("toString"))a.toString=b.toString;return a};
OpenLayers.Util.getParameterString=function(a){var b=[];for(var d in a){var e=a[d];if(e!=null&&typeof e!="function"){if(typeof e=="object"&&e.constructor==Array){for(var f=[],g,h=0,j=e.length;h<j;h++){g=e[h];f.push(encodeURIComponent(g===null||g===undefined?"":g))}e=f.join(",")}else e=encodeURIComponent(e);b.push(encodeURIComponent(d)+"="+e)}}return b.join("&")};OpenLayers.Util.urlAppend=function(a,b){var d=a;if(b){var e=(a+" ").split(/[?&]/);d+=e.pop()===" "?b:e.length?"&"+b:"?"+b}return d};
OpenLayers.ImgPath="";OpenLayers.Util.getImagesLocation=function(){return OpenLayers.ImgPath||OpenLayers._getScriptLocation()+"imaxes/openlayers/"};OpenLayers.Util.Try=function(){for(var a=null,b=0,d=arguments.length;b<d;b++){var e=arguments[b];try{a=e();break}catch(f){}}return a};OpenLayers.Util.getNodes=function(a,b){return OpenLayers.Util.Try(function(){return OpenLayers.Util._getNodes(a.documentElement.childNodes,b)},function(){return OpenLayers.Util._getNodes(a.childNodes,b)})};
OpenLayers.Util._getNodes=function(a,b){for(var d=[],e=0,f=a.length;e<f;e++)a[e].nodeName==b&&d.push(a[e]);return d};OpenLayers.Util.getTagText=function(a,b,d){if((a=OpenLayers.Util.getNodes(a,b))&&a.length>0){d||(d=0);if(a[d].childNodes.length>1)return a.childNodes[1].nodeValue;else if(a[d].childNodes.length==1)return a[d].firstChild.nodeValue}else return""};
OpenLayers.Util.getXmlNodeValue=function(a){var b=null;OpenLayers.Util.Try(function(){b=a.text;if(!b)b=a.textContent;if(!b)b=a.firstChild.nodeValue},function(){b=a.textContent});return b};OpenLayers.Util.mouseLeft=function(a,b){for(var d=a.relatedTarget?a.relatedTarget:a.toElement;d!=b&&d!=null;)d=d.parentNode;return d!=b};OpenLayers.Util.DEFAULT_PRECISION=14;OpenLayers.Util.toFloat=function(a,b){if(b==null)b=OpenLayers.Util.DEFAULT_PRECISION;return a=b==0?parseFloat(a):parseFloat(parseFloat(a).toPrecision(b))};
OpenLayers.Util.rad=function(a){return a*Math.PI/180};
OpenLayers.Util.distVincenty=function(a,b){var d=1/298.257223563,e=OpenLayers.Util.rad(b.lon-a.lon),f=Math.atan((1-d)*Math.tan(OpenLayers.Util.rad(a.lat))),g=Math.atan((1-d)*Math.tan(OpenLayers.Util.rad(b.lat))),h=Math.sin(f);f=Math.cos(f);var j=Math.sin(g);g=Math.cos(g);for(var l=e,m=2*Math.PI,o=20;Math.abs(l-m)>1.0E-12&&--o>0;){var p=Math.sin(l),q=Math.cos(l),r=Math.sqrt(g*p*g*p+(f*j-h*g*q)*(f*j-h*g*q));if(r==0)return 0;q=h*j+f*g*q;var s=Math.atan2(r,q),t=Math.asin(f*g*p/r),v=Math.cos(t)*Math.cos(t);
p=q-2*h*j/v;var u=d/16*v*(4+d*(4-3*v));m=l;l=e+(1-u)*d*Math.sin(t)*(s+u*r*(p+u*q*(-1+2*p*p)))}if(o==0)return NaN;d=v*2.723316066819453E11/4.0408299984087055E13;e=d/1024*(256+d*(-128+d*(74-47*d)));return(6356752.3142*(1+d/16384*(4096+d*(-768+d*(320-175*d))))*(s-e*r*(p+e/4*(q*(-1+2*p*p)-e/6*p*(-3+4*r*r)*(-3+4*p*p))))).toFixed(3)/1E3};
OpenLayers.Util.getParameters=function(a){a=a||window.location.href;var b="";if(OpenLayers.String.contains(a,"?")){b=a.indexOf("?")+1;var d=OpenLayers.String.contains(a,"#")?a.indexOf("#"):a.length;b=a.substring(b,d)}a={};b=b.split(/[&;]/);d=0;for(var e=b.length;d<e;++d){var f=b[d].split("=");if(f[0]){var g=decodeURIComponent(f[0]);f=f[1]||"";f=decodeURIComponent(f.replace(/\+/g," ")).split(",");if(f.length==1)f=f[0];a[g]=f}}return a};
OpenLayers.Util.getArgs=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Util.getParameters"}));return OpenLayers.Util.getParameters(a)};OpenLayers.Util.lastSeqID=0;OpenLayers.Util.createUniqueID=function(a){if(a==null)a="id_";OpenLayers.Util.lastSeqID+=1;return a+OpenLayers.Util.lastSeqID};OpenLayers.INCHES_PER_UNIT={inches:1,ft:12,mi:63360,m:39.3701,km:39370.1,dd:4374754,yd:36};OpenLayers.INCHES_PER_UNIT["in"]=OpenLayers.INCHES_PER_UNIT.inches;
OpenLayers.INCHES_PER_UNIT.degrees=OpenLayers.INCHES_PER_UNIT.dd;OpenLayers.INCHES_PER_UNIT.nmi=1852*OpenLayers.INCHES_PER_UNIT.m;OpenLayers.METERS_PER_INCH=0.0254000508001016;
OpenLayers.Util.extend(OpenLayers.INCHES_PER_UNIT,{Inch:OpenLayers.INCHES_PER_UNIT.inches,Meter:1/OpenLayers.METERS_PER_INCH,Foot:0.3048006096012192/OpenLayers.METERS_PER_INCH,IFoot:0.3048/OpenLayers.METERS_PER_INCH,ClarkeFoot:0.3047972651151/OpenLayers.METERS_PER_INCH,SearsFoot:0.30479947153867626/OpenLayers.METERS_PER_INCH,GoldCoastFoot:0.3047997101815088/OpenLayers.METERS_PER_INCH,IInch:0.0254/OpenLayers.METERS_PER_INCH,MicroInch:2.54E-5/OpenLayers.METERS_PER_INCH,Mil:2.54E-8/OpenLayers.METERS_PER_INCH,
Centimeter:0.01/OpenLayers.METERS_PER_INCH,Kilometer:1E3/OpenLayers.METERS_PER_INCH,Yard:0.9144018288036576/OpenLayers.METERS_PER_INCH,SearsYard:0.914398414616029/OpenLayers.METERS_PER_INCH,IndianYard:0.9143985307444408/OpenLayers.METERS_PER_INCH,IndianYd37:0.91439523/OpenLayers.METERS_PER_INCH,IndianYd62:0.9143988/OpenLayers.METERS_PER_INCH,IndianYd75:0.9143985/OpenLayers.METERS_PER_INCH,IndianFoot:0.30479951/OpenLayers.METERS_PER_INCH,IndianFt37:0.30479841/OpenLayers.METERS_PER_INCH,IndianFt62:0.3047996/
OpenLayers.METERS_PER_INCH,IndianFt75:0.3047995/OpenLayers.METERS_PER_INCH,Mile:1609.3472186944373/OpenLayers.METERS_PER_INCH,IYard:0.9144/OpenLayers.METERS_PER_INCH,IMile:1609.344/OpenLayers.METERS_PER_INCH,NautM:1852/OpenLayers.METERS_PER_INCH,"Lat-66":110943.31648893273/OpenLayers.METERS_PER_INCH,"Lat-83":110946.25736872235/OpenLayers.METERS_PER_INCH,Decimeter:0.1/OpenLayers.METERS_PER_INCH,Millimeter:0.0010/OpenLayers.METERS_PER_INCH,Dekameter:10/OpenLayers.METERS_PER_INCH,Decameter:10/OpenLayers.METERS_PER_INCH,
Hectometer:100/OpenLayers.METERS_PER_INCH,GermanMeter:1.0000135965/OpenLayers.METERS_PER_INCH,CaGrid:0.999738/OpenLayers.METERS_PER_INCH,ClarkeChain:20.1166194976/OpenLayers.METERS_PER_INCH,GunterChain:20.11684023368047/OpenLayers.METERS_PER_INCH,BenoitChain:20.116782494375872/OpenLayers.METERS_PER_INCH,SearsChain:20.11676512155/OpenLayers.METERS_PER_INCH,ClarkeLink:0.201166194976/OpenLayers.METERS_PER_INCH,GunterLink:0.2011684023368047/OpenLayers.METERS_PER_INCH,BenoitLink:0.20116782494375873/OpenLayers.METERS_PER_INCH,
SearsLink:0.2011676512155/OpenLayers.METERS_PER_INCH,Rod:5.02921005842012/OpenLayers.METERS_PER_INCH,IntnlChain:20.1168/OpenLayers.METERS_PER_INCH,IntnlLink:0.201168/OpenLayers.METERS_PER_INCH,Perch:5.02921005842012/OpenLayers.METERS_PER_INCH,Pole:5.02921005842012/OpenLayers.METERS_PER_INCH,Furlong:201.1684023368046/OpenLayers.METERS_PER_INCH,Rood:3.778266898/OpenLayers.METERS_PER_INCH,CapeFoot:0.3047972615/OpenLayers.METERS_PER_INCH,Brealey:375/OpenLayers.METERS_PER_INCH,ModAmFt:0.304812252984506/
OpenLayers.METERS_PER_INCH,Fathom:1.8288/OpenLayers.METERS_PER_INCH,"NautM-UK":1853.184/OpenLayers.METERS_PER_INCH,"50kilometers":5E4/OpenLayers.METERS_PER_INCH,"150kilometers":15E4/OpenLayers.METERS_PER_INCH});
OpenLayers.Util.extend(OpenLayers.INCHES_PER_UNIT,{mm:OpenLayers.INCHES_PER_UNIT.Meter/1E3,cm:OpenLayers.INCHES_PER_UNIT.Meter/100,dm:OpenLayers.INCHES_PER_UNIT.Meter*100,km:OpenLayers.INCHES_PER_UNIT.Meter*1E3,kmi:OpenLayers.INCHES_PER_UNIT.nmi,fath:OpenLayers.INCHES_PER_UNIT.Fathom,ch:OpenLayers.INCHES_PER_UNIT.IntnlChain,link:OpenLayers.INCHES_PER_UNIT.IntnlLink,"us-in":OpenLayers.INCHES_PER_UNIT.inches,"us-ft":OpenLayers.INCHES_PER_UNIT.Foot,"us-yd":OpenLayers.INCHES_PER_UNIT.Yard,"us-ch":OpenLayers.INCHES_PER_UNIT.GunterChain,
"us-mi":OpenLayers.INCHES_PER_UNIT.Mile,"ind-yd":OpenLayers.INCHES_PER_UNIT.IndianYd37,"ind-ft":OpenLayers.INCHES_PER_UNIT.IndianFt37,"ind-ch":20.11669506/OpenLayers.METERS_PER_INCH});OpenLayers.DOTS_PER_INCH=72;OpenLayers.Util.normalizeScale=function(a){return a>1?1/a:a};OpenLayers.Util.getResolutionFromScale=function(a,b){var d;if(a){if(b==null)b="degrees";d=1/(OpenLayers.Util.normalizeScale(a)*OpenLayers.INCHES_PER_UNIT[b]*OpenLayers.DOTS_PER_INCH)}return d};
OpenLayers.Util.getScaleFromResolution=function(a,b){if(b==null)b="degrees";return a*OpenLayers.INCHES_PER_UNIT[b]*OpenLayers.DOTS_PER_INCH};OpenLayers.Util.safeStopPropagation=function(a){OpenLayers.Event.stop(a,true)};
OpenLayers.Util.pagePosition=function(a){for(var b=0,d=0,e=a,f=a;e;){if(e==document.body)if(OpenLayers.Element.getStyle(f,"position")=="absolute")break;b+=e.offsetTop||0;d+=e.offsetLeft||0;f=e;try{e=e.offsetParent}catch(g){OpenLayers.Console.error(OpenLayers.i18n("pagePositionFailed",{elemId:e.id}));break}}for(e=a;e;){b-=e.scrollTop||0;d-=e.scrollLeft||0;e=e.parentNode}return[d,b]};
OpenLayers.Util.isEquivalentUrl=function(a,b,d){d=d||{};OpenLayers.Util.applyDefaults(d,{ignoreCase:true,ignorePort80:true,ignoreHash:true});a=OpenLayers.Util.createUrlObject(a,d);b=OpenLayers.Util.createUrlObject(b,d);for(var e in a)if(e!=="args")if(a[e]!=b[e])return false;for(e in a.args){if(a.args[e]!=b.args[e])return false;delete b.args[e]}for(e in b.args)return false;return true};
OpenLayers.Util.createUrlObject=function(a,b){b=b||{};if(!/^\w+:\/\//.test(a)){var d=window.location,e=d.port?":"+d.port:"";e=d.protocol+"//"+d.host.split(":").shift()+e;if(a.indexOf("/")===0)a=e+a;else{d=d.pathname.split("/");d.pop();a=e+d.join("/")+"/"+a}}if(b.ignoreCase)a=a.toLowerCase();d=document.createElement("a");d.href=a;e={};e.host=d.host.split(":").shift();e.protocol=d.protocol;e.port=b.ignorePort80?d.port=="80"||d.port=="0"?"":d.port:d.port==""||d.port=="0"?"80":d.port;e.hash=b.ignoreHash||
d.hash==="#"?"":d.hash;var f=d.search;if(!f){f=a.indexOf("?");f=f!=-1?a.substr(f):""}e.args=OpenLayers.Util.getParameters(f);e.pathname=d.pathname.charAt(0)=="/"?d.pathname:"/"+d.pathname;return e};OpenLayers.Util.removeTail=function(a){var b=null;b=a.indexOf("?");var d=a.indexOf("#");return b=b==-1?d!=-1?a.substr(0,d):a:d!=-1?a.substr(0,Math.min(b,d)):a.substr(0,b)};
OpenLayers.Util.getBrowserName=function(){var a="",b=navigator.userAgent.toLowerCase();if(b.indexOf("opera")!=-1)a="opera";else if(b.indexOf("msie")!=-1)a="msie";else if(b.indexOf("safari")!=-1)a="safari";else if(b.indexOf("mozilla")!=-1)a=b.indexOf("firefox")!=-1?"firefox":"mozilla";return a};
OpenLayers.Util.getRenderedDimensions=function(a,b,d){var e,f,g=document.createElement("div");g.style.visibility="hidden";var h=d&&d.containerElement?d.containerElement:document.body;if(b)if(b.w){e=b.w;g.style.width=e+"px"}else if(b.h){f=b.h;g.style.height=f+"px"}if(d&&d.displayClass)g.className=d.displayClass;b=document.createElement("div");b.innerHTML=a;b.style.overflow="visible";if(b.childNodes){a=0;for(d=b.childNodes.length;a<d;a++)if(b.childNodes[a].style)b.childNodes[a].style.overflow="visible"}g.appendChild(b);
h.appendChild(g);a=false;for(d=g.parentNode;d&&d.tagName.toLowerCase()!="body";){var j=OpenLayers.Element.getStyle(d,"position");if(j=="absolute"){a=true;break}else if(j&&j!="static")break;d=d.parentNode}if(!a)g.style.position="absolute";if(!e){e=parseInt(b.scrollWidth);g.style.width=e+"px"}f||(f=parseInt(b.scrollHeight));g.removeChild(b);h.removeChild(g);return new OpenLayers.Size(e,f)};
OpenLayers.Util.getScrollbarWidth=function(){var a=OpenLayers.Util._scrollbarWidth;if(a==null){var b=null,d=null;b=a=0;b=document.createElement("div");b.style.position="absolute";b.style.top="-1000px";b.style.left="-1000px";b.style.width="100px";b.style.height="50px";b.style.overflow="hidden";d=document.createElement("div");d.style.width="100%";d.style.height="200px";b.appendChild(d);document.body.appendChild(b);a=d.offsetWidth;b.style.overflow="scroll";b=d.offsetWidth;document.body.removeChild(document.body.lastChild);
OpenLayers.Util._scrollbarWidth=a-b;a=OpenLayers.Util._scrollbarWidth}return a};OpenLayers.Util.getFormattedLonLat=function(a,b,d){d||(d="dms");var e=Math.abs(a),f=Math.floor(e),g=e=(e-f)/(1/60);e=Math.floor(e);g=(g-e)/(1/60);g=Math.round(g*10);g/=10;if(f<10)f="0"+f;f=f+" ";if(d.indexOf("dm")>=0){if(e<10)e="0"+e;f+=e+"'";if(d.indexOf("dms")>=0){if(g<10)g="0"+g;f+=g+'"'}}f+=b=="lon"?a<0?OpenLayers.i18n("W"):OpenLayers.i18n("E"):a<0?OpenLayers.i18n("S"):OpenLayers.i18n("N");return f};
OpenLayers.String={startsWith:function(a,b){return a.indexOf(b)==0},contains:function(a,b){return a.indexOf(b)!=-1},trim:function(a){return a.replace(/^\s\s*/,"").replace(/\s\s*$/,"")},camelize:function(a){a=a.split("-");for(var b=a[0],d=1,e=a.length;d<e;d++){var f=a[d];b+=f.charAt(0).toUpperCase()+f.substring(1)}return b},format:function(a,b,d){b||(b=window);return a.replace(OpenLayers.String.tokenRegEx,function(e,f){for(var g,h=f.split(/\.+/),j=0;j<h.length;j++){if(j==0)g=b;g=g[h[j]]}if(typeof g==
"function")g=d?g.apply(null,d):g();return typeof g=="undefined"?"undefined":g})},tokenRegEx:/\$\{([\w.]+?)\}/g,numberRegEx:/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,isNumeric:function(a){return OpenLayers.String.numberRegEx.test(a)},numericIf:function(a){return OpenLayers.String.isNumeric(a)?parseFloat(a):a}};
if(!String.prototype.startsWith)String.prototype.startsWith=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.String.startsWith"}));return OpenLayers.String.startsWith(this,a)};if(!String.prototype.contains)String.prototype.contains=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.String.contains"}));return OpenLayers.String.contains(this,a)};
if(!String.prototype.trim)String.prototype.trim=function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.String.trim"}));return OpenLayers.String.trim(this)};if(!String.prototype.camelize)String.prototype.camelize=function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.String.camelize"}));return OpenLayers.String.camelize(this)};
OpenLayers.Number={decimalSeparator:".",thousandsSeparator:",",limitSigDigs:function(a,b){var d=0;if(b>0)d=parseFloat(a.toPrecision(b));return d},format:function(a,b,d,e){b=typeof b!="undefined"?b:0;d=typeof d!="undefined"?d:OpenLayers.Number.thousandsSeparator;e=typeof e!="undefined"?e:OpenLayers.Number.decimalSeparator;if(b!=null)a=parseFloat(a.toFixed(b));var f=a.toString().split(".");if(f.length==1&&b==null)b=0;a=f[0];if(d)for(var g=/(-?[0-9]+)([0-9]{3})/;g.test(a);)a=a.replace(g,"$1"+d+"$2");
if(b==0)b=a;else{d=f.length>1?f[1]:"0";if(b!=null)d+=(new Array(b-d.length+1)).join("0");b=a+e+d}return b}};if(!Number.prototype.limitSigDigs)Number.prototype.limitSigDigs=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Number.limitSigDigs"}));return OpenLayers.Number.limitSigDigs(this,a)};
OpenLayers.Function={bind:function(a,b){var d=Array.prototype.slice.apply(arguments,[2]);return function(){var e=d.concat(Array.prototype.slice.apply(arguments,[0]));return a.apply(b,e)}},bindAsEventListener:function(a,b){return function(d){return a.call(b,d||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(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Function.bindAsEventListener"}));return OpenLayers.Function.bindAsEventListener(this,a)};OpenLayers.Array={filter:function(a,b,d){var e=[];if(Array.prototype.filter)e=a.filter(b,d);else{var f=a.length;if(typeof b!="function")throw new TypeError;for(var g=0;g<f;g++)if(g in a){var h=a[g];b.call(d,h,g,a)&&e.push(h)}}return e}};
OpenLayers.Class=function(){for(var a=function(){arguments&&arguments[0]!=OpenLayers.Class.isPrototype&&this.initialize.apply(this,arguments)},b={},d,e=0,f=arguments.length;e<f;++e){if(typeof arguments[e]=="function"){if(e==0&&f>1){d=arguments[e].prototype.initialize;arguments[e].prototype.initialize=function(){};b=new arguments[e];if(d===undefined)delete arguments[e].prototype.initialize;else arguments[e].prototype.initialize=d}d=arguments[e].prototype}else d=arguments[e];OpenLayers.Util.extend(b,
d)}a.prototype=b;return a};OpenLayers.Class.isPrototype=function(){};OpenLayers.Class.create=function(){return function(){arguments&&arguments[0]!=OpenLayers.Class.isPrototype&&this.initialize.apply(this,arguments)}};OpenLayers.Class.inherit=function(){for(var a=new arguments[0](OpenLayers.Class.isPrototype),b=1,d=arguments.length;b<d;b++){if(typeof arguments[b]=="function")arguments[b]=new arguments[b](OpenLayers.Class.isPrototype);OpenLayers.Util.extend(a,arguments[b])}return a};
OpenLayers.Bounds=OpenLayers.Class({left:null,bottom:null,right:null,top:null,centerLonLat:null,initialize:function(a,b,d,e){if(a!=null)this.left=OpenLayers.Util.toFloat(a);if(b!=null)this.bottom=OpenLayers.Util.toFloat(b);if(d!=null)this.right=OpenLayers.Util.toFloat(d);if(e!=null)this.top=OpenLayers.Util.toFloat(e)},clone:function(){return new OpenLayers.Bounds(this.left,this.bottom,this.right,this.top)},equals:function(a){var b=false;if(a!=null)b=this.left==a.left&&this.right==a.right&&this.top==
a.top&&this.bottom==a.bottom;return b},toString:function(){return"left-bottom=("+this.left+","+this.bottom+") right-top=("+this.right+","+this.top+")"},toArray:function(a){return a===true?[this.bottom,this.left,this.top,this.right]:[this.left,this.bottom,this.right,this.top]},toBBOX:function(a,b){if(a==null)a=6;var d=Math.pow(10,a),e=Math.round(this.left*d)/d,f=Math.round(this.bottom*d)/d,g=Math.round(this.right*d)/d;d=Math.round(this.top*d)/d;return b===true?f+","+e+","+d+","+g:e+","+f+","+g+","+
d},toGeometry:function(){return new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(this.left,this.bottom),new OpenLayers.Geometry.Point(this.right,this.bottom),new OpenLayers.Geometry.Point(this.right,this.top),new OpenLayers.Geometry.Point(this.left,this.top)])])},getWidth:function(){return this.right-this.left},getHeight:function(){return this.top-this.bottom},getSize:function(){return new OpenLayers.Size(this.getWidth(),this.getHeight())},getCenterPixel:function(){return new OpenLayers.Pixel((this.left+
this.right)/2,(this.bottom+this.top)/2)},getCenterLonLat:function(){if(!this.centerLonLat)this.centerLonLat=new OpenLayers.LonLat((this.left+this.right)/2,(this.bottom+this.top)/2);return this.centerLonLat},scale:function(a,b){if(b==null)b=this.getCenterLonLat();var d,e;if(b.CLASS_NAME=="OpenLayers.LonLat"){d=b.lon;e=b.lat}else{d=b.x;e=b.y}return new OpenLayers.Bounds((this.left-d)*a+d,(this.bottom-e)*a+e,(this.right-d)*a+d,(this.top-e)*a+e)},add:function(a,b){if(a==null||b==null){var d=OpenLayers.i18n("boundsAddError");
OpenLayers.Console.error(d);return null}return new OpenLayers.Bounds(this.left+a,this.bottom+b,this.right+a,this.top+b)},extend:function(a){var b=null;if(a){switch(a.CLASS_NAME){case "OpenLayers.LonLat":b=new OpenLayers.Bounds(a.lon,a.lat,a.lon,a.lat);break;case "OpenLayers.Geometry.Point":b=new OpenLayers.Bounds(a.x,a.y,a.x,a.y);break;case "OpenLayers.Bounds":b=a;break}if(b){this.centerLonLat=null;if(this.left==null||b.left<this.left)this.left=b.left;if(this.bottom==null||b.bottom<this.bottom)this.bottom=
b.bottom;if(this.right==null||b.right>this.right)this.right=b.right;if(this.top==null||b.top>this.top)this.top=b.top}}},containsLonLat:function(a,b){return this.contains(a.lon,a.lat,b)},containsPixel:function(a,b){return this.contains(a.x,a.y,b)},contains:function(a,b,d){if(d==null)d=true;if(a==null||b==null)return false;a=OpenLayers.Util.toFloat(a);b=OpenLayers.Util.toFloat(b);var e=false;return e=d?a>=this.left&&a<=this.right&&b>=this.bottom&&b<=this.top:a>this.left&&a<this.right&&b>this.bottom&&
b<this.top},intersectsBounds:function(a,b){if(b==null)b=true;var d=false,e=this.left==a.right||this.right==a.left||this.top==a.bottom||this.bottom==a.top;if(b||!e){d=a.top>=this.bottom&&a.top<=this.top||this.top>a.bottom&&this.top<a.top;e=a.left>=this.left&&a.left<=this.right||this.left>=a.left&&this.left<=a.right;var f=a.right>=this.left&&a.right<=this.right||this.right>=a.left&&this.right<=a.right;d=(a.bottom>=this.bottom&&a.bottom<=this.top||this.bottom>=a.bottom&&this.bottom<=a.top||d)&&(e||f)}return d},
containsBounds:function(a,b,d){if(b==null)b=false;if(d==null)d=true;var e=this.contains(a.left,a.bottom,d),f=this.contains(a.right,a.bottom,d),g=this.contains(a.left,a.top,d);a=this.contains(a.right,a.top,d);return b?e||f||g||a:e&&f&&g&&a},determineQuadrant:function(a){var b="",d=this.getCenterLonLat();b+=a.lat<d.lat?"b":"t";b+=a.lon<d.lon?"l":"r";return b},transform:function(a,b){this.centerLonLat=null;var d=OpenLayers.Projection.transform({x:this.left,y:this.bottom},a,b),e=OpenLayers.Projection.transform({x:this.right,
y:this.bottom},a,b),f=OpenLayers.Projection.transform({x:this.left,y:this.top},a,b),g=OpenLayers.Projection.transform({x:this.right,y:this.top},a,b);this.left=Math.min(d.x,f.x);this.bottom=Math.min(d.y,e.y);this.right=Math.max(e.x,g.x);this.top=Math.max(f.y,g.y);return this},wrapDateLine:function(a,b){b=b||{};var d=b.leftTolerance||0,e=b.rightTolerance||0,f=this.clone();if(a){for(;f.left<a.left&&f.right-e<=a.left;)f=f.add(a.getWidth(),0);for(;f.left+d>=a.right&&f.right>a.right;)f=f.add(-a.getWidth(),
0)}return f},CLASS_NAME:"OpenLayers.Bounds"});OpenLayers.Bounds.fromString=function(a){a=a.split(",");return OpenLayers.Bounds.fromArray(a)};OpenLayers.Bounds.fromArray=function(a){return new OpenLayers.Bounds(parseFloat(a[0]),parseFloat(a[1]),parseFloat(a[2]),parseFloat(a[3]))};OpenLayers.Bounds.fromSize=function(a){return new OpenLayers.Bounds(0,a.h,a.w,0)};OpenLayers.Bounds.oppositeQuadrant=function(a){var b="";b+=a.charAt(0)=="t"?"b":"t";b+=a.charAt(1)=="l"?"r":"l";return b};
OpenLayers.Element={visible:function(a){return OpenLayers.Util.getElement(a).style.display!="none"},toggle:function(){for(var a=0,b=arguments.length;a<b;a++){var d=OpenLayers.Util.getElement(arguments[a]),e=OpenLayers.Element.visible(d)?"hide":"show";OpenLayers.Element[e](d)}},hide:function(){for(var a=0,b=arguments.length;a<b;a++)OpenLayers.Util.getElement(arguments[a]).style.display="none"},show:function(){for(var a=0,b=arguments.length;a<b;a++)OpenLayers.Util.getElement(arguments[a]).style.display=
""},remove:function(a){a=OpenLayers.Util.getElement(a);a.parentNode.removeChild(a)},getHeight:function(a){a=OpenLayers.Util.getElement(a);return a.offsetHeight},getDimensions:function(a){a=OpenLayers.Util.getElement(a);if(OpenLayers.Element.getStyle(a,"display")!="none")return{width:a.offsetWidth,height:a.offsetHeight};var b=a.style,d=b.visibility,e=b.position,f=b.display;b.visibility="hidden";b.position="absolute";b.display="";var g=a.clientWidth;a=a.clientHeight;b.display=f;b.position=e;b.visibility=
d;return{width:g,height:a}},hasClass:function(a,b){var d=a.className;return!!d&&(new RegExp("(^|\\s)"+b+"(\\s|$)")).test(d)},addClass:function(a,b){OpenLayers.Element.hasClass(a,b)||(a.className+=(a.className?" ":"")+b);return a},removeClass:function(a,b){var d=a.className;if(d)a.className=OpenLayers.String.trim(d.replace(new RegExp("(^|\\s+)"+b+"(\\s+|$)")," "));return a},toggleClass:function(a,b){OpenLayers.Element.hasClass(a,b)?OpenLayers.Element.removeClass(a,b):OpenLayers.Element.addClass(a,
b);return a},getStyle:function(a,b){a=OpenLayers.Util.getElement(a);var d=null;if(a&&a.style){d=a.style[OpenLayers.String.camelize(b)];if(!d)if(document.defaultView&&document.defaultView.getComputedStyle)d=(d=document.defaultView.getComputedStyle(a,null))?d.getPropertyValue(b):null;else if(a.currentStyle)d=a.currentStyle[OpenLayers.String.camelize(b)];var e=["left","top","right","bottom"];if(window.opera&&OpenLayers.Util.indexOf(e,b)!=-1&&OpenLayers.Element.getStyle(a,"position")=="static")d="auto"}return d==
"auto"?null:d}};
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 d=OpenLayers.i18n("lonlatAddError");OpenLayers.Console.error(d);return null}return new OpenLayers.LonLat(this.lon+a,this.lat+b)},equals:function(a){var b=
false;if(a!=null)b=this.lon==a.lon&&this.lat==a.lat||isNaN(this.lon)&&isNaN(this.lat)&&isNaN(a.lon)&&isNaN(a.lat);return b},transform:function(a,b){var d=OpenLayers.Projection.transform({x:this.lon,y:this.lat},a,b);this.lon=d.x;this.lat=d.y;return this},wrapDateLine:function(a){var b=this.clone();if(a){for(;b.lon<a.left;)b.lon+=a.getWidth();for(;b.lon>a.right;)b.lon-=a.getWidth()}return b},CLASS_NAME:"OpenLayers.LonLat"});
OpenLayers.LonLat.fromString=function(a){a=a.split(",");return new OpenLayers.LonLat(parseFloat(a[0]),parseFloat(a[1]))};
OpenLayers.Pixel=OpenLayers.Class({x:0,y:0,initialize:function(a,b){this.x=parseFloat(a);this.y=parseFloat(b)},toString:function(){return"x="+this.x+",y="+this.y},clone:function(){return new OpenLayers.Pixel(this.x,this.y)},equals:function(a){var b=false;if(a!=null)b=this.x==a.x&&this.y==a.y||isNaN(this.x)&&isNaN(this.y)&&isNaN(a.x)&&isNaN(a.y);return b},add:function(a,b){if(a==null||b==null){var d=OpenLayers.i18n("pixelAddError");OpenLayers.Console.error(d);return null}return new OpenLayers.Pixel(this.x+
a,this.y+b)},offset:function(a){var b=this.clone();if(a)b=this.add(a.x,a.y);return b},CLASS_NAME:"OpenLayers.Pixel"});OpenLayers.Size=OpenLayers.Class({w:0,h:0,initialize:function(a,b){this.w=parseFloat(a);this.h=parseFloat(b)},toString:function(){return"w="+this.w+",h="+this.h},clone:function(){return new OpenLayers.Size(this.w,this.h)},equals:function(a){var b=false;if(a!=null)b=this.w==a.w&&this.h==a.h||isNaN(this.w)&&isNaN(this.h)&&isNaN(a.w)&&isNaN(a.h);return b},CLASS_NAME:"OpenLayers.Size"});
OpenLayers.Console={log:function(){},debug:function(){},info:function(){},warn:function(){},error:function(){},userError:function(a){alert(a)},assert:function(){},dir:function(){},dirxml:function(){},trace:function(){},group:function(){},groupEnd:function(){},time:function(){},timeEnd:function(){},profile:function(){},profileEnd:function(){},count:function(){},CLASS_NAME:"OpenLayers.Console"};
(function(){for(var a=document.getElementsByTagName("script"),b=0,d=a.length;b<d;++b)if(a[b].src.indexOf("firebug.js")!=-1)if(console){OpenLayers.Util.extend(OpenLayers.Console,console);break}})();
OpenLayers.Tween=OpenLayers.Class({INTERVAL:10,easing:null,begin:null,finish:null,duration:null,callbacks:null,time:null,interval:null,playing:false,initialize:function(a){this.easing=a?a:OpenLayers.Easing.Expo.easeOut},start:function(a,b,d,e){this.playing=true;this.begin=a;this.finish=b;this.duration=d;this.callbacks=e.callbacks;this.time=0;if(this.interval){window.clearInterval(this.interval);this.interval=null}this.callbacks&&this.callbacks.start&&this.callbacks.start.call(this,this.begin);this.interval=
window.setInterval(OpenLayers.Function.bind(this.play,this),this.INTERVAL)},stop:function(){if(this.playing){this.callbacks&&this.callbacks.done&&this.callbacks.done.call(this,this.finish);window.clearInterval(this.interval);this.interval=null;this.playing=false}},play:function(){var a={};for(var b in this.begin){var d=this.begin[b],e=this.finish[b];if(d==null||e==null||isNaN(d)||isNaN(e))OpenLayers.Console.error("invalid value for Tween");a[b]=this.easing.apply(this,[this.time,d,e-d,this.duration])}this.time++;
this.callbacks&&this.callbacks.eachStep&&this.callbacks.eachStep.call(this,a);if(this.time>this.duration){if(this.callbacks&&this.callbacks.done){this.callbacks.done.call(this,this.finish);this.playing=false}window.clearInterval(this.interval);this.interval=null}},CLASS_NAME:"OpenLayers.Tween"});OpenLayers.Easing={CLASS_NAME:"OpenLayers.Easing"};
OpenLayers.Easing.Linear={easeIn:function(a,b,d,e){return d*a/e+b},easeOut:function(a,b,d,e){return d*a/e+b},easeInOut:function(a,b,d,e){return d*a/e+b},CLASS_NAME:"OpenLayers.Easing.Linear"};
OpenLayers.Easing.Expo={easeIn:function(a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOut:function(a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOut:function(a,b,d,e){if(a==0)return b;if(a==e)return b+d;if((a/=e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},CLASS_NAME:"OpenLayers.Easing.Expo"};
OpenLayers.Easing.Quad={easeIn:function(a,b,d,e){return d*(a/=e)*a+b},easeOut:function(a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOut:function(a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},CLASS_NAME:"OpenLayers.Easing.Quad"};OpenLayers.ProxyHost="";OpenLayers.nullHandler=function(a){OpenLayers.Console.userError(OpenLayers.i18n("unhandledRequest",{statusText:a.statusText}))};
OpenLayers.loadURL=function(a,b,d,e,f){if(typeof b=="string")b=OpenLayers.Util.getParameters(b);return OpenLayers.Request.GET({url:a,params:b,success:e?e:OpenLayers.nullHandler,failure:f?f:OpenLayers.nullHandler,scope:d})};
OpenLayers.parseXMLString=function(a){var b=a.indexOf("<");if(b>0)a=a.substring(b);return OpenLayers.Util.Try(function(){var d=new ActiveXObject("Microsoft.XMLDOM");d.loadXML(a);return d},function(){return(new DOMParser).parseFromString(a,"text/xml")},function(){var d=new XMLHttpRequest;d.open("GET","data:text/xml;charset=utf-8,"+encodeURIComponent(a),false);d.overrideMimeType&&d.overrideMimeType("text/xml");d.send(null);return d.responseXML})};
OpenLayers.Ajax={emptyFunction:function(){},getTransport:function(){return OpenLayers.Util.Try(function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||false},activeRequestCount:0};
OpenLayers.Ajax.Responders={responders:[],register:function(a){for(var b=0;b<this.responders.length;b++)if(a==this.responders[b])return;this.responders.push(a)},unregister:function(a){OpenLayers.Util.removeItem(this.reponders,a)},dispatch:function(a,b,d){for(var e,f=0;f<this.responders.length;f++){e=this.responders[f];if(e[a]&&typeof e[a]=="function")try{e[a].apply(e,[b,d])}catch(g){}}}};OpenLayers.Ajax.Responders.register({onCreate:function(){OpenLayers.Ajax.activeRequestCount++},onComplete:function(){OpenLayers.Ajax.activeRequestCount--}});
OpenLayers.Ajax.Base=OpenLayers.Class({initialize:function(a){this.options={method:"post",asynchronous:true,contentType:"application/xml",parameters:""};OpenLayers.Util.extend(this.options,a||{});this.options.method=this.options.method.toLowerCase();if(typeof this.options.parameters=="string")this.options.parameters=OpenLayers.Util.getParameters(this.options.parameters)}});
OpenLayers.Ajax.Request=OpenLayers.Class(OpenLayers.Ajax.Base,{_complete:false,initialize:function(a,b){OpenLayers.Ajax.Base.prototype.initialize.apply(this,[b]);if(OpenLayers.ProxyHost&&OpenLayers.String.startsWith(a,"http"))a=OpenLayers.ProxyHost+encodeURIComponent(a);this.transport=OpenLayers.Ajax.getTransport();this.request(a)},request:function(a){this.url=a;this.method=this.options.method;a=OpenLayers.Util.extend({},this.options.parameters);if(this.method!="get"&&this.method!="post"){a._method=
this.method;this.method="post"}this.parameters=a;if(a=OpenLayers.Util.getParameterString(a))if(this.method=="get")this.url+=(this.url.indexOf("?")>-1?"&":"?")+a;else if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))a+="&_=";try{var b=new OpenLayers.Ajax.Response(this);this.options.onCreate&&this.options.onCreate(b);OpenLayers.Ajax.Responders.dispatch("onCreate",this,b);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);this.options.asynchronous&&window.setTimeout(OpenLayers.Function.bind(this.respondToReadyState,
this,1),10);this.transport.onreadystatechange=OpenLayers.Function.bind(this.onStateChange,this);this.setRequestHeaders();this.body=this.method=="post"?this.options.postBody||a:null;this.transport.send(this.body);!this.options.asynchronous&&this.transport.overrideMimeType&&this.onStateChange()}catch(d){this.dispatchException(d)}},onStateChange:function(){var a=this.transport.readyState;a>1&&!(a==4&&this._complete)&&this.respondToReadyState(this.transport.readyState)},setRequestHeaders:function(){var a=
{"X-Requested-With":"XMLHttpRequest",Accept:"text/javascript, text/html, application/xml, text/xml, */*",OpenLayers:true};if(this.method=="post"){a["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005)a.Connection="close"}if(typeof this.options.requestHeaders=="object"){var b=this.options.requestHeaders;if(typeof b.push=="function")for(var d=0,e=b.length;d<
e;d+=2)a[b[d]]=b[d+1];else for(d in b)a[d]=b[d]}for(var f in a)this.transport.setRequestHeader(f,a[f])},success:function(){var a=this.getStatus();return!a||a>=200&&a<300},getStatus:function(){try{return this.transport.status||0}catch(a){return 0}},respondToReadyState:function(a){a=OpenLayers.Ajax.Request.Events[a];var b=new OpenLayers.Ajax.Response(this);if(a=="Complete"){try{this._complete=true;(this.options["on"+b.status]||this.options["on"+(this.success()?"Success":"Failure")]||OpenLayers.Ajax.emptyFunction)(b)}catch(d){this.dispatchException(d)}b.getHeader("Content-type")}try{(this.options["on"+
a]||OpenLayers.Ajax.emptyFunction)(b);OpenLayers.Ajax.Responders.dispatch("on"+a,this,b)}catch(e){this.dispatchException(e)}if(a=="Complete")this.transport.onreadystatechange=OpenLayers.Ajax.emptyFunction},getHeader:function(a){try{return this.transport.getResponseHeader(a)}catch(b){return null}},dispatchException:function(a){var b=this.options.onException;if(b){b(this,a);OpenLayers.Ajax.Responders.dispatch("onException",this,a)}else{b=false;for(var d=OpenLayers.Ajax.Responders.responders,e=0;e<d.length;e++)if(d[e].onException){b=
true;break}if(b)OpenLayers.Ajax.Responders.dispatch("onException",this,a);else throw a;}}});OpenLayers.Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];
OpenLayers.Ajax.Response=OpenLayers.Class({status:0,statusText:"",initialize:function(a){this.request=a;a=this.transport=a.transport;var b=this.readyState=a.readyState;if(b>2&&!(window.attachEvent&&!window.opera)||b==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=a.responseText==null?"":String(a.responseText)}if(b==4){a=a.responseXML;this.responseXML=a===undefined?null:a}},getStatus:OpenLayers.Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||
""}catch(a){return""}},getHeader:OpenLayers.Ajax.Request.prototype.getHeader,getResponseHeader:function(a){return this.transport.getResponseHeader(a)}});OpenLayers.Ajax.getElementsByTagNameNS=function(a,b,d,e){var f=null;return f=a.getElementsByTagNameNS?a.getElementsByTagNameNS(b,e):a.getElementsByTagName(d+":"+e)};OpenLayers.Ajax.serializeXMLToString=function(a){return(new XMLSerializer).serializeToString(a)};
OpenLayers.Event={observers:false,KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(a){return a.target||a.srcElement},isLeftClick:function(a){return a.which&&a.which==1||a.button&&a.button==1},isRightClick:function(a){return a.which&&a.which==3||a.button&&a.button==2},stop:function(a,b){if(!b)if(a.preventDefault)a.preventDefault();else a.returnValue=false;if(a.stopPropagation)a.stopPropagation();else a.cancelBubble=true},
findElement:function(a,b){for(var d=OpenLayers.Event.element(a);d.parentNode&&(!d.tagName||d.tagName.toUpperCase()!=b.toUpperCase());)d=d.parentNode;return d},observe:function(a,b,d,e){a=OpenLayers.Util.getElement(a);e=e||false;if(b=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||a.attachEvent))b="keydown";if(!this.observers)this.observers={};if(!a._eventCacheID){var f="eventCacheID_";if(a.id)f=a.id+"_"+f;a._eventCacheID=OpenLayers.Util.createUniqueID(f)}f=a._eventCacheID;this.observers[f]||
(this.observers[f]=[]);this.observers[f].push({element:a,name:b,observer:d,useCapture:e});if(a.addEventListener)a.addEventListener(b,d,e);else a.attachEvent&&a.attachEvent("on"+b,d)},stopObservingElement:function(a){a=OpenLayers.Util.getElement(a)._eventCacheID;this._removeElementObservers(OpenLayers.Event.observers[a])},_removeElementObservers:function(a){if(a)for(var b=a.length-1;b>=0;b--){var d=a[b];OpenLayers.Event.stopObserving.apply(this,new Array(d.element,d.name,d.observer,d.useCapture))}},
stopObserving:function(a,b,d,e){e=e||false;a=OpenLayers.Util.getElement(a);var f=a._eventCacheID;if(b=="keypress")if(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||a.detachEvent)b="keydown";var g=false,h=OpenLayers.Event.observers[f];if(h)for(var j=0;!g&&j<h.length;){var l=h[j];if(l.name==b&&l.observer==d&&l.useCapture==e){h.splice(j,1);h.length==0&&delete OpenLayers.Event.observers[f];g=true;break}j++}if(g)if(a.removeEventListener)a.removeEventListener(b,d,e);else a&&a.detachEvent&&a.detachEvent("on"+
b,d);return g},unloadCache:function(){if(OpenLayers.Event&&OpenLayers.Event.observers){for(var a in OpenLayers.Event.observers)OpenLayers.Event._removeElementObservers.apply(this,[OpenLayers.Event.observers[a]]);OpenLayers.Event.observers=false}},CLASS_NAME:"OpenLayers.Event"};OpenLayers.Event.observe(window,"unload",OpenLayers.Event.unloadCache,false);if(window.Event)OpenLayers.Util.applyDefaults(window.Event,OpenLayers.Event);else var Event=OpenLayers.Event;
OpenLayers.Events=OpenLayers.Class({BROWSER_EVENTS:["mouseover","mouseout","mousedown","mouseup","mousemove","click","dblclick","rightclick","dblrightclick","resize","focus","blur"],listeners:null,object:null,element:null,eventTypes:null,eventHandler:null,fallThrough:null,includeXY:false,clearMouseListener:null,initialize:function(a,b,d,e,f){OpenLayers.Util.extend(this,f);this.object=a;this.fallThrough=e;this.listeners={};this.eventHandler=OpenLayers.Function.bindAsEventListener(this.handleBrowserEvent,
this);this.clearMouseListener=OpenLayers.Function.bind(this.clearMouseCache,this);this.eventTypes=[];if(d!=null){a=0;for(e=d.length;a<e;a++)this.addEventType(d[a])}b!=null&&this.attachToElement(b)},destroy:function(){if(this.element){OpenLayers.Event.stopObservingElement(this.element);this.element.hasScrollEvent&&OpenLayers.Event.stopObserving(window,"scroll",this.clearMouseListener)}this.eventHandler=this.fallThrough=this.eventTypes=this.object=this.listeners=this.element=null},addEventType:function(a){if(!this.listeners[a]){this.eventTypes.push(a);
this.listeners[a]=[]}},attachToElement:function(a){this.element&&OpenLayers.Event.stopObservingElement(this.element);this.element=a;for(var b=0,d=this.BROWSER_EVENTS.length;b<d;b++){var e=this.BROWSER_EVENTS[b];this.addEventType(e);OpenLayers.Event.observe(a,e,this.eventHandler)}OpenLayers.Event.observe(a,"dragstart",OpenLayers.Event.stop)},on:function(a){for(var b in a)b!="scope"&&this.register(b,a.scope,a[b])},register:function(a,b,d){if(d!=null&&OpenLayers.Util.indexOf(this.eventTypes,a)!=-1){if(b==
null)b=this.object;this.listeners[a].push({obj:b,func:d})}},registerPriority:function(a,b,d){if(d!=null){if(b==null)b=this.object;a=this.listeners[a];a!=null&&a.unshift({obj:b,func:d})}},un:function(a){for(var b in a)b!="scope"&&this.unregister(b,a.scope,a[b])},unregister:function(a,b,d){if(b==null)b=this.object;a=this.listeners[a];if(a!=null)for(var e=0,f=a.length;e<f;e++)if(a[e].obj==b&&a[e].func==d){a.splice(e,1);break}},remove:function(a){if(this.listeners[a]!=null)this.listeners[a]=[]},triggerEvent:function(a,
b){var d=this.listeners[a];if(!(!d||d.length==0)){if(b==null)b={};b.object=this.object;b.element=this.element;if(!b.type)b.type=a;d=d.slice();for(var e,f=0,g=d.length;f<g;f++){e=d[f];e=e.func.apply(e.obj,[b]);if(e!=undefined&&e==false)break}this.fallThrough||OpenLayers.Event.stop(b,true);return e}},handleBrowserEvent:function(a){if(this.includeXY)a.xy=this.getMousePosition(a);this.triggerEvent(a.type,a)},clearMouseCache:function(){this.element.scrolls=null;this.element.lefttop=null;this.element.offsets=
null},getMousePosition:function(a){if(this.includeXY){if(!this.element.hasScrollEvent){OpenLayers.Event.observe(window,"scroll",this.clearMouseListener);this.element.hasScrollEvent=true}}else this.clearMouseCache();if(!this.element.scrolls)this.element.scrolls=[document.documentElement.scrollLeft||document.body.scrollLeft,document.documentElement.scrollTop||document.body.scrollTop];if(!this.element.lefttop)this.element.lefttop=[document.documentElement.clientLeft||0,document.documentElement.clientTop||
0];if(!this.element.offsets){this.element.offsets=OpenLayers.Util.pagePosition(this.element);this.element.offsets[0]+=this.element.scrolls[0];this.element.offsets[1]+=this.element.scrolls[1]}return new OpenLayers.Pixel(a.clientX+this.element.scrolls[0]-this.element.offsets[0]-this.element.lefttop[0],a.clientY+this.element.scrolls[1]-this.element.offsets[1]-this.element.lefttop[1])},CLASS_NAME:"OpenLayers.Events"});
OpenLayers.Request={DEFAULT_CONFIG:{method:"GET",url:window.location.href,async:true,user:undefined,password:undefined,params:null,proxy:OpenLayers.ProxyHost,headers:{},data:null,callback:function(){},success:null,failure:null,scope:null},events:new OpenLayers.Events(this,null,["complete","success","failure"]),issue:function(a){var b=OpenLayers.Util.extend(this.DEFAULT_CONFIG,{proxy:OpenLayers.ProxyHost});a=OpenLayers.Util.applyDefaults(a,b);var d=new OpenLayers.Request.XMLHttpRequest,e=a.url;if(a.params){b=
OpenLayers.Util.getParameterString(a.params);if(b.length>0){var f=e.indexOf("?")>-1?"&":"?";e+=f+b}}if(a.proxy&&e.indexOf("http")==0)e=typeof a.proxy=="function"?a.proxy(e):a.proxy+encodeURIComponent(e);d.open(a.method,e,a.async,a.user,a.password);for(var g in a.headers)d.setRequestHeader(g,a.headers[g]);var h=this.events,j=this;d.onreadystatechange=function(){d.readyState==OpenLayers.Request.XMLHttpRequest.DONE&&h.triggerEvent("complete",{request:d,config:a,requestUrl:e})!==false&&j.runCallbacks({request:d,
config:a,requestUrl:e})};a.async===false?d.send(a.data):window.setTimeout(function(){d.send(a.data)},0);return d},runCallbacks:function(a){var b=a.request,d=a.config,e=d.scope?OpenLayers.Function.bind(d.callback,d.scope):d.callback,f;if(d.success)f=d.scope?OpenLayers.Function.bind(d.success,d.scope):d.success;var g;if(d.failure)g=d.scope?OpenLayers.Function.bind(d.failure,d.scope):d.failure;e(b);if(!b.status||b.status>=200&&b.status<300){this.events.triggerEvent("success",a);f&&f(b)}if(b.status&&
(b.status<200||b.status>=300)){this.events.triggerEvent("failure",a);g&&g(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)}};
(function(){function a(){this._object=f?new f:new window.ActiveXObject("Microsoft.XMLHTTP")}function b(j){j.onreadystatechange&&j.onreadystatechange.apply(j);a.onreadystatechange&&a.onreadystatechange.apply(j)}function d(j){try{j.responseText=j._object.responseText}catch(l){}try{var m;a:{var o=j._object,p=o.responseXML;if(h&&p&&!p.documentElement&&o.getResponseHeader("Content-Type").match(/[^\/]+\/[^\+]+\+xml/)){p=new ActiveXObject("Microsoft.XMLDOM");p.loadXML(o.responseText)}if(p)if(h&&p.parseError!=
0||p.documentElement&&p.documentElement.tagName=="parsererror"){m=null;break a}m=p}j.responseXML=m}catch(q){}try{j.status=j._object.status}catch(r){}try{j.statusText=j._object.statusText}catch(s){}}function e(j){j._object.onreadystatechange=new window.Function;delete j._headers}var f=window.XMLHttpRequest,g=!!window.controllers,h=window.document.all&&!window.opera;if(g&&f.wrapped)a.wrapped=f.wrapped;a.UNSENT=0;a.OPENED=1;a.HEADERS_RECEIVED=2;a.LOADING=3;a.DONE=4;a.prototype.readyState=a.UNSENT;a.prototype.responseText=
"";a.prototype.responseXML=null;a.prototype.status=0;a.prototype.statusText="";a.prototype.onreadystatechange=null;a.onreadystatechange=null;a.onopen=null;a.onsend=null;a.onabort=null;a.prototype.open=function(j,l,m,o,p){this._async=m;var q=this,r=this.readyState;if(h){var s=function(){q._object.readyState!=a.DONE&&e(q)};m&&window.attachEvent("onunload",s)}this._object.onreadystatechange=function(){if(!(g&&!m)){q.readyState=q._object.readyState;d(q);if(q._aborted)q.readyState=a.UNSENT;else{if(q.readyState==
a.DONE){e(q);h&&m&&window.detachEvent("onunload",s)}r!=q.readyState&&b(q);r=q.readyState}}};a.onopen&&a.onopen.apply(this,arguments);this._object.open(j,l,m,o,p);if(!m&&g){this.readyState=a.OPENED;b(this)}};a.prototype.send=function(j){a.onsend&&a.onsend.apply(this,arguments);if(j&&j.nodeType){j=window.XMLSerializer?(new window.XMLSerializer).serializeToString(j):j.xml;this._headers["Content-Type"]||this._object.setRequestHeader("Content-Type","application/xml")}this._object.send(j);if(g&&!this._async){this.readyState=
a.OPENED;for(d(this);this.readyState<a.DONE;){this.readyState++;b(this);if(this._aborted)return}}};a.prototype.abort=function(){a.onabort&&a.onabort.apply(this,arguments);if(this.readyState>a.UNSENT)this._aborted=true;this._object.abort();e(this)};a.prototype.getAllResponseHeaders=function(){return this._object.getAllResponseHeaders()};a.prototype.getResponseHeader=function(j){return this._object.getResponseHeader(j)};a.prototype.setRequestHeader=function(j,l){if(!this._headers)this._headers={};this._headers[j]=
l;return this._object.setRequestHeader(j,l)};a.prototype.toString=function(){return"[object XMLHttpRequest]"};a.toString=function(){return"[XMLHttpRequest]"};if(!window.Function.prototype.apply)window.Function.prototype.apply=function(j,l){l||(l=[]);j.__func=this;j.__func(l[0],l[1],l[2],l[3],l[4]);delete j.__func};OpenLayers.Request.XMLHttpRequest=a})();
OpenLayers.Projection=OpenLayers.Class({proj:null,projCode:null,initialize:function(a,b){OpenLayers.Util.extend(this,b);this.projCode=a;if(window.Proj4js)this.proj=new Proj4js.Proj(a)},getCode:function(){return this.proj?this.proj.srsCode:this.projCode},getUnits:function(){return this.proj?this.proj.units:null},toString:function(){return this.getCode()},equals:function(a){return a&&a.getCode?this.getCode()==a.getCode():false},destroy:function(){delete this.proj;delete this.projCode},CLASS_NAME:"OpenLayers.Projection"});
OpenLayers.Projection.transforms={};OpenLayers.Projection.addTransform=function(a,b,d){OpenLayers.Projection.transforms[a]||(OpenLayers.Projection.transforms[a]={});OpenLayers.Projection.transforms[a][b]=d};OpenLayers.Projection.transform=function(a,b,d){if(b.proj&&d.proj)a=Proj4js.transform(b.proj,d.proj,a);else b&&d&&OpenLayers.Projection.transforms[b.getCode()]&&OpenLayers.Projection.transforms[b.getCode()][d.getCode()]&&OpenLayers.Projection.transforms[b.getCode()][d.getCode()](a);return a};
OpenLayers.Map=OpenLayers.Class({Z_INDEX_BASE:{BaseLayer:100,Overlay:325,Feature:725,Popup:750,Control:1E3},EVENT_TYPES:["preaddlayer","addlayer","removelayer","changelayer","movestart","move","moveend","zoomend","popupopen","popupclose","addmarker","removemarker","clearmarkers","mouseover","mouseout","mousemove","dragstart","drag","dragend","changebaselayer"],id:null,fractionalZoom:false,events:null,allOverlays:false,div:null,dragging:false,size:null,viewPortDiv:null,layerContainerOrigin:null,layerContainerDiv:null,
layers:null,controls:null,popups:null,baseLayer:null,center:null,resolution:null,zoom:0,panRatio:1.5,viewRequestID:0,tileSize:null,projection:"EPSG:4326",units:"degrees",resolutions:null,maxResolution:1.40625,minResolution:null,maxScale:null,minScale:null,maxExtent:null,minExtent:null,restrictedExtent:null,numZoomLevels:16,theme:null,displayProjection:null,fallThrough:true,panTween:null,eventListeners:null,panMethod:OpenLayers.Easing.Expo.easeOut,panDuration:50,paddingForPopups:null,initialize:function(a,
b){if(arguments.length===1&&typeof a==="object")a=(b=a)&&b.div;this.tileSize=new OpenLayers.Size(OpenLayers.Map.TILE_WIDTH,OpenLayers.Map.TILE_HEIGHT);this.maxExtent=new OpenLayers.Bounds(-180,-90,180,90);this.paddingForPopups=new OpenLayers.Bounds(15,15,15,15);this.theme=OpenLayers._getScriptLocation()+"web_ikiMap/css/combine.php?type=css&files=openlayers_min.css";OpenLayers.Util.extend(this,b);this.layers=[];this.id=OpenLayers.Util.createUniqueID("OpenLayers.Map_");this.div=OpenLayers.Util.getElement(a);
if(!this.div){this.div=document.createElement("div");this.div.style.height="1px";this.div.style.width="1px"}OpenLayers.Element.addClass(this.div,"olMap");var d=this.id+"_OpenLayers_ViewPort";this.viewPortDiv=OpenLayers.Util.createDiv(d,null,null,null,"relative",null,"hidden");this.viewPortDiv.style.width="100%";this.viewPortDiv.style.height="100%";this.viewPortDiv.className="olMapViewport";this.div.appendChild(this.viewPortDiv);d=this.id+"_OpenLayers_Container";this.layerContainerDiv=OpenLayers.Util.createDiv(d);
this.layerContainerDiv.style.zIndex=this.Z_INDEX_BASE.Popup-1;this.viewPortDiv.appendChild(this.layerContainerDiv);this.events=new OpenLayers.Events(this,this.div,this.EVENT_TYPES,this.fallThrough,{includeXY:true});this.updateSize();this.eventListeners instanceof Object&&this.events.on(this.eventListeners);this.events.register("movestart",this,this.updateSize);if(OpenLayers.String.contains(navigator.appName,"Microsoft"))this.events.register("resize",this,this.updateSize);else{this.updateSizeDestroy=
OpenLayers.Function.bind(this.updateSize,this);OpenLayers.Event.observe(window,"resize",this.updateSizeDestroy)}if(this.theme){d=true;for(var e=document.getElementsByTagName("link"),f=0,g=e.length;f<g;++f)if(OpenLayers.Util.isEquivalentUrl(e.item(f).href,this.theme)){d=false;break}if(d){d=document.createElement("link");d.setAttribute("rel","stylesheet");d.setAttribute("type","text/css");d.setAttribute("href",this.theme);document.getElementsByTagName("head")[0].appendChild(d)}}if(this.controls==null)this.controls=
OpenLayers.Control!=null?[new OpenLayers.Control.Navigation,new OpenLayers.Control.PanZoom,new OpenLayers.Control.ArgParser,new OpenLayers.Control.Attribution]:[];f=0;for(g=this.controls.length;f<g;f++)this.addControlToMap(this.controls[f]);this.popups=[];this.unloadDestroy=OpenLayers.Function.bind(this.destroy,this);OpenLayers.Event.observe(window,"unload",this.unloadDestroy);if(b&&b.layers){this.addLayers(b.layers);b.center&&this.setCenter(b.center,b.zoom)}},render:function(a){this.div=OpenLayers.Util.getElement(a);
OpenLayers.Element.addClass(this.div,"olMap");this.events.attachToElement(this.div);this.viewPortDiv.parentNode.removeChild(this.viewPortDiv);this.div.appendChild(this.viewPortDiv);this.updateSize()},unloadDestroy:null,updateSizeDestroy:null,destroy:function(){if(!this.unloadDestroy)return false;this.panTween&&this.panTween.playing&&this.panTween.stop();OpenLayers.Event.stopObserving(window,"unload",this.unloadDestroy);this.unloadDestroy=null;this.updateSizeDestroy?OpenLayers.Event.stopObserving(window,
"resize",this.updateSizeDestroy):this.events.unregister("resize",this,this.updateSize);this.paddingForPopups=null;if(this.controls!=null){for(var a=this.controls.length-1;a>=0;--a)this.controls[a].destroy();this.controls=null}if(this.layers!=null){for(a=this.layers.length-1;a>=0;--a)this.layers[a].destroy(false);this.layers=null}this.viewPortDiv&&this.div.removeChild(this.viewPortDiv);this.viewPortDiv=null;if(this.eventListeners){this.events.un(this.eventListeners);this.eventListeners=null}this.events.destroy();
this.events=null},setOptions:function(a){OpenLayers.Util.extend(this,a)},getTileSize:function(){return this.tileSize},getBy:function(a,b,d){var e=typeof d.test=="function";return OpenLayers.Array.filter(this[a],function(f){return f[b]==d||e&&d.test(f[b])})},getLayersBy:function(a,b){return this.getBy("layers",a,b)},getLayersByName:function(a){return this.getLayersBy("name",a)},getLayersByClass:function(a){return this.getLayersBy("CLASS_NAME",a)},getControlsBy:function(a,b){return this.getBy("controls",
a,b)},getControlsByClass:function(a){return this.getControlsBy("CLASS_NAME",a)},getLayer:function(a){for(var b=null,d=0,e=this.layers.length;d<e;d++){var f=this.layers[d];if(f.id==a){b=f;break}}return b},setLayerZIndex:function(a,b){a.setZIndex(this.Z_INDEX_BASE[a.isBaseLayer?"BaseLayer":"Overlay"]+b*5)},resetLayersZIndex:function(){for(var a=0,b=this.layers.length;a<b;a++)this.setLayerZIndex(this.layers[a],a)},addLayer:function(a){for(var b=0,d=this.layers.length;b<d;b++)if(this.layers[b]==a){a=
OpenLayers.i18n("layerAlreadyAdded",{layerName:a.name});OpenLayers.Console.warn(a);return false}if(this.allOverlays)a.isBaseLayer=false;if(this.events.triggerEvent("preaddlayer",{layer:a})!==false){a.div.className="olLayerDiv";a.div.style.overflow="";this.setLayerZIndex(a,this.layers.length);a.isFixed?this.viewPortDiv.appendChild(a.div):this.layerContainerDiv.appendChild(a.div);this.layers.push(a);a.setMap(this);if(a.isBaseLayer||this.allOverlays&&!this.baseLayer)this.baseLayer==null?this.setBaseLayer(a):
a.setVisibility(false);else a.redraw();this.events.triggerEvent("addlayer",{layer:a});a.afterAdd()}},addLayers:function(a){for(var b=0,d=a.length;b<d;b++)this.addLayer(a[b])},removeLayer:function(a,b){if(b==null)b=true;a.isFixed?this.viewPortDiv.removeChild(a.div):this.layerContainerDiv.removeChild(a.div);OpenLayers.Util.removeItem(this.layers,a);a.removeMap(this);a.map=null;if(this.baseLayer==a){this.baseLayer=null;if(b)for(var d=0,e=this.layers.length;d<e;d++){var f=this.layers[d];if(f.isBaseLayer||
this.allOverlays){this.setBaseLayer(f);break}}}this.resetLayersZIndex();this.events.triggerEvent("removelayer",{layer:a})},getNumLayers:function(){return this.layers.length},getLayerIndex:function(a){return OpenLayers.Util.indexOf(this.layers,a)},setLayerIndex:function(a,b){var d=this.getLayerIndex(a);if(b<0)b=0;else if(b>this.layers.length)b=this.layers.length;if(d!=b){this.layers.splice(d,1);this.layers.splice(b,0,a);d=0;for(var e=this.layers.length;d<e;d++)this.setLayerZIndex(this.layers[d],d);
this.events.triggerEvent("changelayer",{layer:a,property:"order"});if(this.allOverlays)if(b===0)this.setBaseLayer(a);else this.baseLayer!==this.layers[0]&&this.setBaseLayer(this.layers[0])}},raiseLayer:function(a,b){var d=this.getLayerIndex(a)+b;this.setLayerIndex(a,d)},setBaseLayer:function(a){if(a!=this.baseLayer)if(OpenLayers.Util.indexOf(this.layers,a)!=-1){var b=this.getCenter(),d=OpenLayers.Util.getResolutionFromScale(this.getScale(),a.units);this.baseLayer!=null&&!this.allOverlays&&this.baseLayer.setVisibility(false);
this.baseLayer=a;this.viewRequestID++;if(!this.allOverlays||this.baseLayer.visibility)this.baseLayer.setVisibility(true);if(b!=null){a=this.getZoomForResolution(d||this.resolution,true);this.setCenter(b,a,false,true)}this.events.triggerEvent("changebaselayer",{layer:this.baseLayer})}},addControl:function(a,b){this.controls.push(a);this.addControlToMap(a,b)},addControls:function(a,b){for(var d=arguments.length===1?[]:b,e=0,f=a.length;e<f;e++)this.addControl(a[e],d[e]?d[e]:null)},addControlToMap:function(a,
b){a.outsideViewport=a.div!=null;if(this.displayProjection&&!a.displayProjection)a.displayProjection=this.displayProjection;a.setMap(this);var d=a.draw(b);if(d)if(!a.outsideViewport){d.style.zIndex=this.Z_INDEX_BASE.Control+this.controls.length;this.viewPortDiv.appendChild(d)}a.autoActivate&&a.activate()},getControl:function(a){for(var b=null,d=0,e=this.controls.length;d<e;d++){var f=this.controls[d];if(f.id==a){b=f;break}}return b},removeControl:function(a){if(a&&a==this.getControl(a.id)){a.div&&
a.div.parentNode==this.viewPortDiv&&this.viewPortDiv.removeChild(a.div);OpenLayers.Util.removeItem(this.controls,a)}},addPopup:function(a,b){if(b)for(var d=this.popups.length-1;d>=0;--d)this.removePopup(this.popups[d]);a.map=this;this.popups.push(a);if(d=a.draw()){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;if(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();if(b==null)this.size=b=a;if(!a.equals(b)){this.size=a;a=0;for(b=this.layers.length;a<b;a++)this.layers[a].onMapResize();a=this.getCenter();if(this.baseLayer!=null&&a!=null){b=this.getZoom();this.zoom=null;this.setCenter(a,b)}}}},getCurrentSize:function(){var a=new OpenLayers.Size(this.div.clientWidth,
this.div.clientHeight);if(a.w==0&&a.h==0||isNaN(a.w)&&isNaN(a.h)){a.w=this.div.offsetWidth;a.h=this.div.offsetHeight}if(a.w==0&&a.h==0||isNaN(a.w)&&isNaN(a.h)){a.w=parseInt(this.div.style.width);a.h=parseInt(this.div.style.height)}return a},calculateBounds:function(a,b){var d=null;if(a==null)a=this.getCenter();if(b==null)b=this.getResolution();if(a!=null&&b!=null){var e=this.getSize();d=e.w*b;e=e.h*b;d=new OpenLayers.Bounds(a.lon-d/2,a.lat-e/2,a.lon+d/2,a.lat+e/2)}return d},getCenter:function(){var a=
null;if(this.center)a=this.center.clone();return a},getZoom:function(){return this.zoom},pan:function(a,b,d){d=OpenLayers.Util.applyDefaults(d,{animate:true,dragging:false});var e=this.getViewPortPxFromLonLat(this.getCenter());a=e.add(a,b);if(!d.dragging||!a.equals(e)){e=this.getLonLatFromViewPortPx(a);d.animate?this.panTo(e):this.setCenter(e,null,d.dragging)}},panTo:function(a){if(this.panMethod&&this.getExtent().scale(this.panRatio).containsLonLat(a)){if(!this.panTween)this.panTween=new OpenLayers.Tween(this.panMethod);
var b=this.getCenter();a.lon==b.lon&&a.lat==b.lat||this.panTween.start({lon:b.lon,lat:b.lat},{lon:a.lon,lat:a.lat},this.panDuration,{callbacks:{start:OpenLayers.Function.bind(function(){this.events.triggerEvent("movestart")},this),eachStep:OpenLayers.Function.bind(function(d){d=new OpenLayers.LonLat(d.lon,d.lat);this.moveTo(d,this.zoom,{dragging:true,noEvent:true})},this),done:OpenLayers.Function.bind(function(d){d=new OpenLayers.LonLat(d.lon,d.lat);this.moveTo(d,this.zoom,{noEvent:true});this.events.triggerEvent("moveend")},
this)}})}else this.setCenter(a)},setCenter:function(a,b,d,e){this.moveTo(a,b,{dragging:d,forceZoomChange:e,caller:"setCenter"})},moveTo:function(a,b,d){d||(d={});if(b!=null){b=parseFloat(b);this.fractionalZoom||(b=Math.round(b))}var e=d.dragging,f=d.forceZoomChange,g=d.noEvent;this.panTween&&d.caller=="setCenter"&&this.panTween.stop();if(!this.center&&!this.isValidLonLat(a))a=this.maxExtent.getCenterLonLat();if(this.restrictedExtent!=null){if(a==null)a=this.getCenter();if(b==null)b=this.getZoom();
d=this.getResolutionForZoom(b);d=this.calculateBounds(a,d);if(!this.restrictedExtent.containsBounds(d)){var h=this.restrictedExtent.getCenterLonLat();if(d.getWidth()>this.restrictedExtent.getWidth())a=new OpenLayers.LonLat(h.lon,a.lat);else if(d.left<this.restrictedExtent.left)a=a.add(this.restrictedExtent.left-d.left,0);else if(d.right>this.restrictedExtent.right)a=a.add(this.restrictedExtent.right-d.right,0);if(d.getHeight()>this.restrictedExtent.getHeight())a=new OpenLayers.LonLat(a.lon,h.lat);
else if(d.bottom<this.restrictedExtent.bottom)a=a.add(0,this.restrictedExtent.bottom-d.bottom);else if(d.top>this.restrictedExtent.top)a=a.add(0,this.restrictedExtent.top-d.top)}}f=f||this.isValidZoomLevel(b)&&b!=this.getZoom();d=this.isValidLonLat(a)&&!a.equals(this.center);if(f||d||!e){!this.dragging&&!g&&this.events.triggerEvent("movestart");if(d){!f&&this.center&&this.centerLayerContainer(a);this.center=a.clone()}if(f||this.layerContainerOrigin==null){this.layerContainerOrigin=this.center.clone();
this.layerContainerDiv.style.left="0px";this.layerContainerDiv.style.top="0px"}if(f){this.zoom=b;this.resolution=this.getResolutionForZoom(b);this.viewRequestID++}a=this.getExtent();if(this.baseLayer.visibility){this.baseLayer.moveTo(a,f,e);e?this.baseLayer.events.triggerEvent("move"):this.baseLayer.events.triggerEvent("moveend",{zoomChanged:f})}a=this.baseLayer.getExtent();b=0;for(d=this.layers.length;b<d;b++){h=this.layers[b];if(h!==this.baseLayer&&!h.isBaseLayer){var j=h.calculateInRange();if(h.inRange!=
j){(h.inRange=j)||h.display(false);this.events.triggerEvent("changelayer",{layer:h,property:"visibility"})}if(j&&h.visibility){h.moveTo(a,f,e);e?h.events.triggerEvent("move"):h.events.triggerEvent("moveend",{zoomChanged:f})}}}if(f){b=0;for(d=this.popups.length;b<d;b++)this.popups[b].updatePosition()}this.events.triggerEvent("move");f&&this.events.triggerEvent("zoomend")}!e&&!g&&this.events.triggerEvent("moveend");this.dragging=!!e},centerLayerContainer:function(a){var b=this.getViewPortPxFromLonLat(this.layerContainerOrigin);
a=this.getViewPortPxFromLonLat(a);if(b!=null&&a!=null){this.layerContainerDiv.style.left=Math.round(b.x-a.x)+"px";this.layerContainerDiv.style.top=Math.round(b.y-a.y)+"px"}},isValidZoomLevel:function(a){return a!=null&&a>=0&&a<this.getNumZoomLevels()},isValidLonLat:function(a){var b=false;if(a!=null)b=this.getMaxExtent().containsLonLat(a);return b},getProjection:function(){var a=this.getProjectionObject();return a?a.getCode():null},getProjectionObject:function(){var a=null;if(this.baseLayer!=null)a=
this.baseLayer.projection;return a},getMaxResolution:function(){var a=null;if(this.baseLayer!=null)a=this.baseLayer.maxResolution;return a},getMaxExtent:function(a){var b=null;if(a&&a.restricted&&this.restrictedExtent)b=this.restrictedExtent;else if(this.baseLayer!=null)b=this.baseLayer.maxExtent;return b},getNumZoomLevels:function(){var a=null;if(this.baseLayer!=null)a=this.baseLayer.numZoomLevels;return a},getExtent:function(){var a=null;if(this.baseLayer!=null)a=this.baseLayer.getExtent();return a},
getResolution:function(){var a=null;if(this.baseLayer!=null)a=this.baseLayer.getResolution();else if(this.allOverlays===true&&this.layers.length>0)a=this.layers[0].getResolution();return a},getUnits:function(){var a=null;if(this.baseLayer!=null)a=this.baseLayer.units;return a},getScale:function(){var a=null;if(this.baseLayer!=null){a=this.getResolution();a=OpenLayers.Util.getScaleFromResolution(a,this.baseLayer.units)}return a},getZoomForExtent:function(a,b){var d=null;if(this.baseLayer!=null)d=this.baseLayer.getZoomForExtent(a,
b);return d},getResolutionForZoom:function(a){var b=null;if(this.baseLayer)b=this.baseLayer.getResolutionForZoom(a);return b},getZoomForResolution:function(a,b){var d=null;if(this.baseLayer!=null)d=this.baseLayer.getZoomForResolution(a,b);return d},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 d=a.getCenterLonLat();if(this.baseLayer.wrapDateLine){d=
this.getMaxExtent();for(a=a.clone();a.right<a.left;)a.right+=d.getWidth();d=a.getCenterLonLat().wrapDateLine(d)}this.setCenter(d,this.getZoomForExtent(a,b))},zoomToMaxExtent:function(a){this.zoomToExtent(this.getMaxExtent({restricted:a?a.restricted:true}))},zoomToScale:function(a,b){var d=OpenLayers.Util.getResolutionFromScale(a,this.baseLayer.units),e=this.getSize(),f=e.w*d;d=e.h*d;e=this.getCenter();this.zoomToExtent(new OpenLayers.Bounds(e.lon-f/2,e.lat-d/2,e.lon+f/2,e.lat+d/2),b)},getLonLatFromViewPortPx:function(a){var b=
null;if(this.baseLayer!=null)b=this.baseLayer.getLonLatFromViewPortPx(a);return b},getViewPortPxFromLonLat:function(a){var b=null;if(this.baseLayer!=null)b=this.baseLayer.getViewPortPxFromLonLat(a);return b},getLonLatFromPixel:function(a){return this.getLonLatFromViewPortPx(a)},getPixelFromLonLat:function(a){a=this.getViewPortPxFromLonLat(a);a.x=Math.round(a.x);a.y=Math.round(a.y);return a},getViewPortPxFromLayerPx:function(a){var b=null;if(a!=null){b=parseInt(this.layerContainerDiv.style.left);var d=
parseInt(this.layerContainerDiv.style.top);b=a.add(b,d)}return b},getLayerPxFromViewPortPx:function(a){var b=null;if(a!=null){b=-parseInt(this.layerContainerDiv.style.left);var d=-parseInt(this.layerContainerDiv.style.top);b=a.add(b,d);if(isNaN(b.x)||isNaN(b.y))b=null}return b},getLonLatFromLayerPx:function(a){a=this.getViewPortPxFromLayerPx(a);return this.getLonLatFromViewPortPx(a)},getLayerPxFromLonLat:function(a){return this.getLayerPxFromViewPortPx(this.getPixelFromLonLat(a))},CLASS_NAME:"OpenLayers.Map"});
OpenLayers.Map.TILE_WIDTH=256;OpenLayers.Map.TILE_HEIGHT=256;
OpenLayers.Layer=OpenLayers.Class({id:null,name:null,div:null,opacity:null,alwaysInRange:null,EVENT_TYPES:["loadstart","loadend","loadcancel","visibilitychanged","move","moveend"],events:null,map:null,isBaseLayer:false,alpha:false,displayInLayerSwitcher:true,visibility:true,attribution:null,inRange:false,imageSize:null,imageOffset:null,options:null,eventListeners:null,gutter:0,projection:null,units:null,scales:null,resolutions:null,maxExtent:null,minExtent:null,maxResolution:null,minResolution:null,
numZoomLevels:null,minScale:null,maxScale:null,displayOutsideMaxExtent:false,wrapDateLine:false,transitionEffect:null,SUPPORTED_TRANSITIONS:["resize"],initialize:function(a,b){this.addOptions(b);this.name=a;if(this.id==null){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");this.div=OpenLayers.Util.createDiv(this.id);this.div.style.width="100%";this.div.style.height="100%";this.div.dir="ltr";this.events=new OpenLayers.Events(this,this.div,this.EVENT_TYPES);this.eventListeners instanceof
Object&&this.events.on(this.eventListeners)}if(this.wrapDateLine)this.displayOutsideMaxExtent=true},destroy:function(a){if(a==null)a=true;this.map!=null&&this.map.removeLayer(this,a);this.options=this.div=this.name=this.map=this.projection=null;if(this.events){this.eventListeners&&this.events.un(this.eventListeners);this.events.destroy()}this.events=this.eventListeners=null},clone:function(a){if(a==null)a=new OpenLayers.Layer(this.name,this.getOptions());OpenLayers.Util.applyDefaults(a,this);a.map=
null;return a},getOptions:function(){var a={};for(var b in this.options)a[b]=this[b];return a},setName:function(a){if(a!=this.name){this.name=a;this.map!=null&&this.map.events.triggerEvent("changelayer",{layer:this,property:"name"})}},addOptions:function(a){if(this.options==null)this.options={};OpenLayers.Util.extend(this.options,a);OpenLayers.Util.extend(this,a)},onMapResize:function(){},redraw:function(){var a=false;if(this.map){this.inRange=this.calculateInRange();var b=this.getExtent();if(b&&
this.inRange&&this.visibility){this.moveTo(b,true,false);this.events.triggerEvent("moveend",{zoomChanged:true});a=true}}return a},moveTo:function(){var a=this.visibility;this.isBaseLayer||(a=a&&this.inRange);this.display(a)},setMap:function(a){if(this.map==null){this.map=a;this.maxExtent=this.maxExtent||this.map.maxExtent;if((this.projection=this.projection||this.map.projection)&&typeof this.projection=="string")this.projection=new OpenLayers.Projection(this.projection);this.units=this.projection.getUnits()||
this.units||this.map.units;this.initResolutions();if(!this.isBaseLayer){this.inRange=this.calculateInRange();this.div.style.display=this.visibility&&this.inRange?"":"none"}this.setTileSize()}},afterAdd:function(){},removeMap:function(){},getImageSize:function(){return this.imageSize||this.tileSize},setTileSize:function(a){this.tileSize=a=a?a:this.tileSize?this.tileSize:this.map.getTileSize();if(this.gutter){this.imageOffset=new OpenLayers.Pixel(-this.gutter,-this.gutter);this.imageSize=new OpenLayers.Size(a.w+
2*this.gutter,a.h+2*this.gutter)}},getVisibility:function(){return this.visibility},setVisibility:function(a){if(a!=this.visibility){this.visibility=a;this.display(a);this.redraw();this.map!=null&&this.map.events.triggerEvent("changelayer",{layer:this,property:"visibility"});this.events.triggerEvent("visibilitychanged")}},display:function(a){if(a!=(this.div.style.display!="none"))this.div.style.display=a&&this.calculateInRange()?"block":"none"},calculateInRange:function(){var a=false;if(this.alwaysInRange)a=
true;else if(this.map){a=this.map.getResolution();a=a>=this.minResolution&&a<=this.maxResolution}return a},setIsBaseLayer:function(a){if(a!=this.isBaseLayer){this.isBaseLayer=a;this.map!=null&&this.map.events.triggerEvent("changebaselayer",{layer:this})}},initResolutions:function(){for(var a=new Array("projection","units","scales","resolutions","maxScale","minScale","maxResolution","minResolution","minExtent","maxExtent","numZoomLevels","maxZoomLevel"),b=["projection","units"],d=false,e={},f=0,g=
a.length;f<g;f++){var h=a[f];if(this.options[h]&&OpenLayers.Util.indexOf(b,h)==-1)d=true;e[h]=this.options[h]||this.map[h]}if(this.alwaysInRange==null)this.alwaysInRange=!d;if((this.options.minScale!=null||this.options.maxScale!=null)&&this.options.scales==null)e.scales=null;if((this.options.minResolution!=null||this.options.maxResolution!=null)&&this.options.resolutions==null)e.resolutions=null;if(!e.numZoomLevels&&e.maxZoomLevel)e.numZoomLevels=e.maxZoomLevel+1;if(e.scales!=null||e.resolutions!=
null){if(e.scales!=null){e.resolutions=[];f=0;for(g=e.scales.length;f<g;f++)e.resolutions[f]=OpenLayers.Util.getResolutionFromScale(e.scales[f],e.units)}e.numZoomLevels=e.resolutions.length}else{if(e.minScale)e.maxResolution=OpenLayers.Util.getResolutionFromScale(e.minScale,e.units);else if(e.maxResolution=="auto"){a=this.map.getSize();f=e.maxExtent.getWidth()/a.w;a=e.maxExtent.getHeight()/a.h;e.maxResolution=Math.max(f,a)}if(e.maxScale!=null)e.minResolution=OpenLayers.Util.getResolutionFromScale(e.maxScale,
e.units);else if(e.minResolution=="auto"&&e.minExtent!=null){a=this.map.getSize();f=e.minExtent.getWidth()/a.w;a=e.minExtent.getHeight()/a.h;e.minResolution=Math.max(f,a)}if(e.minResolution!=null&&this.options.numZoomLevels==undefined)e.numZoomLevels=Math.floor(Math.log(e.maxResolution/e.minResolution)/Math.log(2))+1;e.resolutions=new Array(e.numZoomLevels);a=2;if(typeof e.minResolution=="number"&&e.numZoomLevels>1)a=Math.pow(e.maxResolution/e.minResolution,1/(e.numZoomLevels-1));for(f=0;f<e.numZoomLevels;f++)e.resolutions[f]=
e.maxResolution/Math.pow(a,f)}e.resolutions.sort(function(j,l){return l-j});this.resolutions=e.resolutions;this.maxResolution=e.resolutions[0];this.minResolution=e.resolutions[e.resolutions.length-1];this.scales=[];f=0;for(g=e.resolutions.length;f<g;f++)this.scales[f]=OpenLayers.Util.getScaleFromResolution(e.resolutions[f],e.units);this.minScale=this.scales[0];this.maxScale=this.scales[this.scales.length-1];this.numZoomLevels=e.numZoomLevels},getResolution:function(){return this.getResolutionForZoom(this.map.getZoom())},
getExtent:function(){return this.map.calculateBounds()},getZoomForExtent:function(a,b){var d=this.map.getSize();return this.getZoomForResolution(Math.max(a.getWidth()/d.w,a.getHeight()/d.h),b)},getDataExtent:function(){},getResolutionForZoom:function(a){a=Math.max(0,Math.min(a,this.resolutions.length-1));if(this.map.fractionalZoom){var b=Math.floor(a);a=this.resolutions[b]-(a-b)*(this.resolutions[b]-this.resolutions[Math.ceil(a)])}else a=this.resolutions[Math.round(a)];return a},getZoomForResolution:function(a,
b){var d;if(this.map.fractionalZoom){var e=0,f=this.resolutions[e],g=this.resolutions[this.resolutions.length-1],h;d=0;for(var j=this.resolutions.length;d<j;++d){h=this.resolutions[d];if(h>=a){f=h;e=d}if(h<=a){g=h;break}}d=f-g;d=d>0?e+(f-a)/d:e}else{f=Number.POSITIVE_INFINITY;d=0;for(j=this.resolutions.length;d<j;d++)if(b){e=Math.abs(this.resolutions[d]-a);if(e>f)break;f=e}else if(this.resolutions[d]<a)break;d=Math.max(0,d-1)}return d},getLonLatFromViewPortPx:function(a){var b=null;if(a!=null){var d=
this.map.getSize(),e=this.map.getCenter();if(e){b=this.map.getResolution();b=new OpenLayers.LonLat(e.lon+(a.x-d.w/2)*b,e.lat-(a.y-d.h/2)*b);if(this.wrapDateLine)b=b.wrapDateLine(this.maxExtent)}}return b},getViewPortPxFromLonLat:function(a){var b=null;if(a!=null){b=this.map.getResolution();var d=this.map.getExtent();b=new OpenLayers.Pixel(1/b*(a.lon-d.left),1/b*(d.top-a.lat))}return b},setOpacity:function(a){if(a!=this.opacity){this.opacity=a;for(var b=0,d=this.div.childNodes.length;b<d;++b)OpenLayers.Util.modifyDOMElement(this.div.childNodes[b].firstChild,
null,null,null,null,null,null,a);this.map!=null&&this.map.events.triggerEvent("changelayer",{layer:this,property:"opacity"})}},getZIndex:function(){return this.div.style.zIndex},setZIndex:function(a){this.div.style.zIndex=a},adjustBounds:function(a){if(this.gutter){var b=this.gutter*this.map.getResolution();a=new OpenLayers.Bounds(a.left-b,a.bottom-b,a.right+b,a.top+b)}if(this.wrapDateLine){b={rightTolerance:this.getResolution()};a=a.wrapDateLine(this.maxExtent,b)}return a},CLASS_NAME:"OpenLayers.Layer"});
OpenLayers.Icon=OpenLayers.Class({url:null,size:null,offset:null,calculateOffset:null,imageDiv:null,px:null,initialize:function(a,b,d,e){this.url=a;this.size=b?b:new OpenLayers.Size(20,20);this.offset=d?d:new OpenLayers.Pixel(-(this.size.w/2),-(this.size.h/2));this.calculateOffset=e;a=OpenLayers.Util.createUniqueID("OL_Icon_");this.imageDiv=OpenLayers.Util.createAlphaImageDiv(a)},destroy:function(){this.erase();OpenLayers.Event.stopObservingElement(this.imageDiv.firstChild);this.imageDiv.innerHTML=
"";this.imageDiv=null},clone:function(){return new OpenLayers.Icon(this.url,this.size,this.offset,this.calculateOffset)},setSize:function(a){if(a!=null)this.size=a;this.draw()},setUrl:function(a){if(a!=null)this.url=a;this.draw()},draw:function(a){OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,null,this.size,this.url,"absolute");this.moveTo(a);return this.imageDiv},erase:function(){this.imageDiv!=null&&this.imageDiv.parentNode!=null&&OpenLayers.Element.remove(this.imageDiv)},setOpacity:function(a){OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,
null,null,null,null,null,null,null,a)},moveTo:function(a){if(a!=null)this.px=a;if(this.imageDiv!=null)if(this.px==null)this.display(false);else{if(this.calculateOffset)this.offset=this.calculateOffset(this.size);a=this.px.offset(this.offset);OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,a)}},display:function(a){this.imageDiv.style.display=a?"":"none"},isDrawn:function(){return this.imageDiv&&this.imageDiv.parentNode&&this.imageDiv.parentNode.nodeType!=11},CLASS_NAME:"OpenLayers.Icon"});
OpenLayers.Popup=OpenLayers.Class({events:null,id:"",lonlat:null,div:null,contentSize:null,size:null,contentHTML:null,backgroundColor:"",opacity:"",border:"",contentDiv:null,groupDiv:null,closeDiv:null,autoSize:false,minSize:null,maxSize:null,displayClass:"olPopup",contentDisplayClass:"olPopupContent",padding:0,disableFirefoxOverflowHack:false,fixPadding:function(){if(typeof this.padding=="number")this.padding=new OpenLayers.Bounds(this.padding,this.padding,this.padding,this.padding)},panMapIfOutOfView:false,
keepInMap:false,closeOnMove:false,map:null,initialize:function(a,b,d,e,f,g){if(a==null)a=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");this.id=a;this.lonlat=b;this.contentSize=d!=null?d:new OpenLayers.Size(OpenLayers.Popup.WIDTH,OpenLayers.Popup.HEIGHT);if(e!=null)this.contentHTML=e;this.backgroundColor=OpenLayers.Popup.COLOR;this.opacity=OpenLayers.Popup.OPACITY;this.border=OpenLayers.Popup.BORDER;this.div=OpenLayers.Util.createDiv(this.id,null,null,null,null,null,"hidden");this.div.className=
this.displayClass;this.groupDiv=OpenLayers.Util.createDiv(this.id+"_GroupDiv",null,null,null,"relative",null,"hidden");a=this.div.id+"_contentDiv";this.contentDiv=OpenLayers.Util.createDiv(a,null,this.contentSize.clone(),null,"relative");this.contentDiv.className=this.contentDisplayClass;this.groupDiv.appendChild(this.contentDiv);this.div.appendChild(this.groupDiv);f&&this.addCloseBox(g);this.registerEvents()},destroy:function(){this.border=this.opacity=this.backgroundColor=this.contentHTML=this.size=
this.lonlat=this.id=null;this.closeOnMove&&this.map&&this.map.events.unregister("movestart",this,this.hide);this.events.destroy();this.events=null;if(this.closeDiv){OpenLayers.Event.stopObservingElement(this.closeDiv);this.groupDiv.removeChild(this.closeDiv)}this.closeDiv=null;this.div.removeChild(this.groupDiv);this.groupDiv=null;this.map!=null&&this.map.removePopup(this);this.panMapIfOutOfView=this.padding=this.maxSize=this.minSize=this.autoSize=this.div=this.map=null},draw:function(a){if(a==null)if(this.lonlat!=
null&&this.map!=null)a=this.map.getLayerPxFromLonLat(this.lonlat);this.closeOnMove&&this.map.events.register("movestart",this,this.hide);if(!this.disableFirefoxOverflowHack&&OpenLayers.Util.getBrowserName()=="firefox"){this.map.events.register("movestart",this,function(){var b=document.defaultView.getComputedStyle(this.contentDiv,null).getPropertyValue("overflow");if(b!="hidden"){this.contentDiv._oldOverflow=b;this.contentDiv.style.overflow="hidden"}});this.map.events.register("moveend",this,function(){var b=
this.contentDiv._oldOverflow;if(b){this.contentDiv.style.overflow=b;this.contentDiv._oldOverflow=null}})}this.moveTo(a);!this.autoSize&&!this.size&&this.setSize(this.contentSize);this.setBackgroundColor();this.setOpacity();this.setBorder();this.setContentHTML();this.panMapIfOutOfView&&this.panIntoView();return this.div},updatePosition:function(){if(this.lonlat&&this.map){var a=this.map.getLayerPxFromLonLat(this.lonlat);a&&this.moveTo(a)}},moveTo:function(a){if(a!=null&&this.div!=null){this.div.style.left=
a.x+"px";this.div.style.top=a.y+"px"}},visible:function(){return OpenLayers.Element.visible(this.div)},toggle:function(){this.visible()?this.hide():this.show()},show:function(){OpenLayers.Element.show(this.div);this.panMapIfOutOfView&&this.panIntoView()},hide:function(){OpenLayers.Element.hide(this.div)},setSize:function(a){this.size=a.clone();var b=this.getContentDivPadding(),d=b.left+b.right,e=b.top+b.bottom;this.fixPadding();d+=this.padding.left+this.padding.right;e+=this.padding.top+this.padding.bottom;
if(this.closeDiv){var f=parseInt(this.closeDiv.style.width);d+=f+b.right}this.size.w+=d;this.size.h+=e;if(OpenLayers.Util.getBrowserName()=="msie"){this.contentSize.w+=b.left+b.right;this.contentSize.h+=b.bottom+b.top}if(this.div!=null){this.div.style.width=this.size.w+"px";this.div.style.height=this.size.h+"px"}if(this.contentDiv!=null){this.contentDiv.style.width=a.w+"px";this.contentDiv.style.height=a.h+"px"}},updateSize:function(){var a="<div class='"+this.contentDisplayClass+"'>"+this.contentDiv.innerHTML+
"</div>",b=this.map?this.map.layerContainerDiv:document.body,d=OpenLayers.Util.getRenderedDimensions(a,null,{displayClass:this.displayClass,containerElement:b}),e=this.getSafeContentSize(d),f=null;if(e.equals(d))f=d;else{f=new OpenLayers.Size;f.w=e.w<d.w?e.w:null;f.h=e.h<d.h?e.h:null;if(f.w&&f.h)f=e;else{a=OpenLayers.Util.getRenderedDimensions(a,f,{displayClass:this.contentDisplayClass,containerElement:b});if(OpenLayers.Element.getStyle(this.contentDiv,"overflow")!="hidden"&&a.equals(e)){e=OpenLayers.Util.getScrollbarWidth();
if(f.w)a.h+=e;else a.w+=e}f=this.getSafeContentSize(a)}}this.setSize(f)},setBackgroundColor:function(a){if(a!=undefined)this.backgroundColor=a;if(this.div!=null)this.div.style.backgroundColor=this.backgroundColor},setOpacity:function(a){if(a!=undefined)this.opacity=a;if(this.div!=null){this.div.style.opacity=this.opacity;this.div.style.filter="alpha(opacity="+this.opacity*100+")"}},setBorder:function(a){if(a!=undefined)this.border=a;if(this.div!=null)this.div.style.border=this.border},setContentHTML:function(a){if(a!=
null)this.contentHTML=a;if(this.contentDiv!=null&&this.contentHTML!=null&&this.contentHTML!=this.contentDiv.innerHTML){this.contentDiv.innerHTML=this.contentHTML;if(this.autoSize){this.registerImageListeners();this.updateSize()}}},registerImageListeners:function(){for(var a=function(){this.popup.updateSize();this.popup.visible()&&this.popup.panMapIfOutOfView&&this.popup.panIntoView();OpenLayers.Event.stopObserving(this.img,"load",this.img._onImageLoad)},b=this.contentDiv.getElementsByTagName("img"),
d=0,e=b.length;d<e;d++){var f=b[d];if(f.width==0||f.height==0){f._onImgLoad=OpenLayers.Function.bind(a,{popup:this,img:f});OpenLayers.Event.observe(f,"load",f._onImgLoad)}}},getSafeContentSize:function(a){a=a.clone();var b=this.getContentDivPadding(),d=b.left+b.right,e=b.top+b.bottom;this.fixPadding();d+=this.padding.left+this.padding.right;e+=this.padding.top+this.padding.bottom;if(this.closeDiv){var f=parseInt(this.closeDiv.style.width);d+=f+b.right}if(this.minSize){a.w=Math.max(a.w,this.minSize.w-
d);a.h=Math.max(a.h,this.minSize.h-e)}if(this.maxSize){a.w=Math.min(a.w,this.maxSize.w-d);a.h=Math.min(a.h,this.maxSize.h-e)}if(this.map&&this.map.size){f=b=0;if(this.keepInMap&&!this.panMapIfOutOfView){f=this.map.getPixelFromLonLat(this.lonlat);switch(this.relativePosition){case "tr":b=f.x;f=this.map.size.h-f.y;break;case "tl":b=this.map.size.w-f.x;f=this.map.size.h-f.y;break;case "bl":b=this.map.size.w-f.x;f=f.y;break;case "br":b=f.x;f=f.y;break;default:b=f.x;f=this.map.size.h-f.y;break}}e=this.map.size.h-
this.map.paddingForPopups.top-this.map.paddingForPopups.bottom-e-f;a.w=Math.min(a.w,this.map.size.w-this.map.paddingForPopups.left-this.map.paddingForPopups.right-d-b);a.h=Math.min(a.h,e)}return a},getContentDivPadding:function(){var a=this._contentDivPadding;if(!a){if(this.div.parentNode==null){this.div.style.display="none";document.body.appendChild(this.div)}this._contentDivPadding=a=new OpenLayers.Bounds(OpenLayers.Element.getStyle(this.contentDiv,"padding-left"),OpenLayers.Element.getStyle(this.contentDiv,
"padding-bottom"),OpenLayers.Element.getStyle(this.contentDiv,"padding-right"),OpenLayers.Element.getStyle(this.contentDiv,"padding-top"));if(this.div.parentNode==document.body){document.body.removeChild(this.div);this.div.style.display=""}}return a},addCloseBox:function(a){this.closeDiv=OpenLayers.Util.createDiv(this.id+"_close",null,new OpenLayers.Size(17,17));this.closeDiv.className="olPopupCloseBox";var b=this.getContentDivPadding();this.closeDiv.style.right=b.right+"px";this.closeDiv.style.top=
b.top+"px";this.groupDiv.appendChild(this.closeDiv);OpenLayers.Event.observe(this.closeDiv,"click",OpenLayers.Function.bindAsEventListener(a||function(d){this.hide();OpenLayers.Event.stop(d)},this))},panIntoView:function(){var a=this.map.getSize(),b=this.map.getViewPortPxFromLayerPx(new OpenLayers.Pixel(parseInt(this.div.style.left),parseInt(this.div.style.top))),d=b.clone();if(b.x<this.map.paddingForPopups.left)d.x=this.map.paddingForPopups.left;else if(b.x+this.size.w>a.w-this.map.paddingForPopups.right)d.x=
a.w-this.map.paddingForPopups.right-this.size.w;if(b.y<this.map.paddingForPopups.top)d.y=this.map.paddingForPopups.top;else if(b.y+this.size.h>a.h-this.map.paddingForPopups.bottom)d.y=a.h-this.map.paddingForPopups.bottom-this.size.h;this.map.pan(b.x-d.x,b.y-d.y)},registerEvents:function(){this.events=new OpenLayers.Events(this,this.div,null,true);this.events.on({mousedown:this.onmousedown,mousemove:this.onmousemove,mouseup:this.onmouseup,click:this.onclick,mouseout:this.onmouseout,dblclick:this.ondblclick,
scope:this})},onmousedown:function(a){this.mousedown=true;OpenLayers.Event.stop(a,true)},onmousemove:function(a){this.mousedown&&OpenLayers.Event.stop(a,true)},onmouseup:function(a){if(this.mousedown){this.mousedown=false;OpenLayers.Event.stop(a,true)}},onclick:function(a){OpenLayers.Event.stop(a,true)},onmouseout:function(){this.mousedown=false},ondblclick:function(a){OpenLayers.Event.stop(a,true)},CLASS_NAME:"OpenLayers.Popup"});OpenLayers.Popup.WIDTH=200;OpenLayers.Popup.HEIGHT=200;
OpenLayers.Popup.COLOR="white";OpenLayers.Popup.OPACITY=1;OpenLayers.Popup.BORDER="0px";
OpenLayers.Tile=OpenLayers.Class({EVENT_TYPES:["loadstart","loadend","reload","unload"],events:null,id:null,layer:null,url:null,bounds:null,size:null,position:null,isLoading:false,initialize:function(a,b,d,e,f){this.layer=a;this.position=b.clone();this.bounds=d.clone();this.url=e;this.size=f.clone();this.id=OpenLayers.Util.createUniqueID("Tile_");this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES)},unload:function(){if(this.isLoading){this.isLoading=false;this.events.triggerEvent("unload")}},
destroy:function(){this.position=this.size=this.bounds=this.layer=null;this.events.destroy();this.events=null},clone:function(a){if(a==null)a=new OpenLayers.Tile(this.layer,this.position,this.bounds,this.url,this.size);OpenLayers.Util.applyDefaults(a,this);return a},draw:function(){var a=this.layer.maxExtent;this.shouldDraw=a&&this.bounds.intersectsBounds(a,false)||this.layer.displayOutsideMaxExtent;this.clear();return this.shouldDraw},moveTo:function(a,b,d){if(d==null)d=true;this.bounds=a.clone();
this.position=b.clone();d&&this.draw()},clear:function(){},getBoundsFromBaseLayer:function(a){var b=OpenLayers.i18n("reprojectDeprecated",{layerName:this.layer.name});OpenLayers.Console.warn(b);b=this.layer.map.getLonLatFromLayerPx(a);a=a.clone();a.x+=this.size.w;a.y+=this.size.h;a=this.layer.map.getLonLatFromLayerPx(a);if(b.lon>a.lon)if(b.lon<0)b.lon=-180-(b.lon+180);else a.lon=180+a.lon+180;return new OpenLayers.Bounds(b.lon,a.lat,a.lon,b.lat)},showTile:function(){this.shouldDraw&&this.show()},
show:function(){},hide:function(){},CLASS_NAME:"OpenLayers.Tile"});
OpenLayers.Tile.Image=OpenLayers.Class(OpenLayers.Tile,{url:null,imgDiv:null,frame:null,layerAlphaHack:null,isBackBuffer:false,lastRatio:1,isFirstDraw:true,backBufferTile:null,initialize:function(a,b,d,e){OpenLayers.Tile.prototype.initialize.apply(this,arguments);this.url=e;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.layerAlphaHack&&
OpenLayers.Event.stopObservingElement(this.imgDiv.childNodes[0]);OpenLayers.Event.stopObservingElement(this.imgDiv);if(this.imgDiv.parentNode==this.frame){this.frame.removeChild(this.imgDiv);this.imgDiv.map=null}this.imgDiv.urls=null;this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif"}this.imgDiv=null;this.frame!=null&&this.frame.parentNode==this.layer.div&&this.layer.div.removeChild(this.frame);this.frame=null;if(this.backBufferTile){this.backBufferTile.destroy();this.backBufferTile=
null}this.layer.events.unregister("loadend",this,this.resetBackBuffer);OpenLayers.Tile.prototype.destroy.apply(this,arguments)},clone:function(a){if(a==null)a=new OpenLayers.Tile.Image(this.layer,this.position,this.bounds,this.url,this.size);a=OpenLayers.Tile.prototype.clone.apply(this,[a]);a.imgDiv=null;return a},draw:function(){if(this.layer!=this.layer.map.baseLayer&&this.layer.reproject)this.bounds=this.getBoundsFromBaseLayer(this.position);var a=OpenLayers.Tile.prototype.draw.apply(this,arguments);
if(OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1)if(a){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 this.backBufferTile&&this.backBufferTile.clear();else if(a&&this.isFirstDraw){this.events.register("loadend",this,this.showTile);
this.isFirstDraw=false}if(!a)return false;if(this.isLoading)this.events.triggerEvent("reload");else{this.isLoading=true;this.events.triggerEvent("loadstart")}return this.renderTile()},resetBackBuffer:function(){this.showTile();if(this.backBufferTile&&(this.isFirstDraw||!this.layer.numLoadingTiles)){this.isFirstDraw=false;var a=this.layer.maxExtent;if(a&&this.bounds.intersectsBounds(a,false)){this.backBufferTile.position=this.position;this.backBufferTile.bounds=this.bounds;this.backBufferTile.size=
this.size;this.backBufferTile.imageSize=this.layer.getImageSize(this.bounds)||this.size;this.backBufferTile.imageOffset=this.layer.imageOffset;this.backBufferTile.resolution=this.layer.getResolution();this.backBufferTile.renderTile()}this.backBufferTile.hide()}},renderTile:function(){this.imgDiv==null&&this.initImgDiv();this.imgDiv.viewRequestID=this.layer.map.viewRequestID;if(this.layer.async)this.layer.getURLasync(this.bounds,this,"url",this.positionImage);else{if(this.layer.url instanceof Array)this.imgDiv.urls=
this.layer.url.slice();this.url=this.layer.getURL(this.bounds);this.positionImage()}return true},positionImage:function(){if(this.layer!=null){OpenLayers.Util.modifyDOMElement(this.frame,null,this.position,this.size);var a=this.layer.getImageSize(this.bounds);if(this.layerAlphaHack)OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv,null,null,a,this.url);else{OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,a);this.imgDiv.src=this.url}}},clear:function(){if(this.imgDiv){this.hide();if(OpenLayers.Tile.Image.useBlankTile)this.imgDiv.src=
OpenLayers.Util.getImagesLocation()+"blank.gif"}},initImgDiv:function(){var a=this.layer.imageOffset,b=this.layer.getImageSize(this.bounds);this.imgDiv=this.layerAlphaHack?OpenLayers.Util.createAlphaImageDiv(null,a,b,null,"relative",null,null,null,true):OpenLayers.Util.createImage(null,a,b,null,"relative",null,null,true);this.imgDiv.className="olTileImage";this.frame.style.zIndex=this.isBackBuffer?0:1;this.frame.appendChild(this.imgDiv);this.layer.div.appendChild(this.frame);this.layer.opacity!=null&&
OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,null,null,null,null,this.layer.opacity);this.imgDiv.map=this.layer.map;var d=function(){if(this.isLoading){this.isLoading=false;this.events.triggerEvent("loadend")}};this.layerAlphaHack?OpenLayers.Event.observe(this.imgDiv.childNodes[0],"load",OpenLayers.Function.bind(d,this)):OpenLayers.Event.observe(this.imgDiv,"load",OpenLayers.Function.bind(d,this));OpenLayers.Event.observe(this.imgDiv,"error",OpenLayers.Function.bind(function(){this.imgDiv._attempts>
OpenLayers.IMAGE_RELOAD_ATTEMPTS&&d.call(this)},this))},checkImgURL:function(){if(this.layer)OpenLayers.Util.isEquivalentUrl(this.layerAlphaHack?this.imgDiv.firstChild.src:this.imgDiv.src,this.url)||this.hide()},startTransition:function(){if(this.backBufferTile&&this.backBufferTile.imgDiv){var a=1;if(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),d=new OpenLayers.Size(this.backBufferTile.size.w*a,this.backBufferTile.size.h*a);b=this.layer.map.getLayerPxFromLonLat(b);OpenLayers.Util.modifyDOMElement(this.backBufferTile.frame,null,b,d);d=this.backBufferTile.imageSize;d=new OpenLayers.Size(d.w*a,d.h*a);if(b=this.backBufferTile.imageOffset)b=new OpenLayers.Pixel(b.x*a,b.y*a);OpenLayers.Util.modifyDOMElement(this.backBufferTile.imgDiv,null,b,d);this.backBufferTile.show()}}else this.layer.singleTile?this.backBufferTile.show():
this.backBufferTile.hide();this.lastRatio=a}},show:function(){this.frame.style.display="";if(OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1)if(navigator.userAgent.toLowerCase().indexOf("gecko")!=-1)this.frame.scrollLeft=this.frame.scrollLeft},hide:function(){this.frame.style.display="none"},CLASS_NAME:"OpenLayers.Tile.Image"});OpenLayers.Tile.Image.useBlankTile=OpenLayers.Util.getBrowserName()=="safari"||OpenLayers.Util.getBrowserName()=="opera";
OpenLayers.Tile.Image.IFrame=OpenLayers.Class(OpenLayers.Tile.Image,{initialize:function(){OpenLayers.Tile.Image.prototype.initialize.apply(this,arguments);this.layerAlphaHack=false},destroy:function(){this.imgDiv!=null&&OpenLayers.Event.stopObservingElement(this.imgDiv.firstChild);OpenLayers.Tile.Image.prototype.destroy.apply(this,arguments)},clear:function(){if(this.imgDiv){var a=this.imgDiv.firstChild;OpenLayers.Event.stopObservingElement(a);this.imgDiv.removeChild(a)}},clone:function(a){if(a==
null)a=new OpenLayers.Tile.Image.IFrame(this.layer,this.position,this.bounds,this.url,this.size);return a=OpenLayers.Tile.Image.prototype.clone.apply(this,[a])},renderTile:function(){if(OpenLayers.Tile.Image.prototype.renderTile.apply(this,arguments)){var a=this.createRequestForm();this.imgDiv.appendChild(a);a.submit();this.imgDiv.removeChild(a)}},initImgDiv:function(){this.imgDiv=this.createImgDiv();OpenLayers.Util.modifyDOMElement(this.imgDiv,this.id,null,this.layer.getImageSize(),"relative");this.imgDiv.className=
"olTileImage";this.frame.appendChild(this.imgDiv);this.layer.div.appendChild(this.frame);this.layer.opacity!=null&&OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,null,null,null,null,this.layer.opacity);this.imgDiv.map=this.layer.map},createImgDiv:function(){var a=document.createElement("div");if(OpenLayers.Util.getBrowserName()=="msie"){a.style.backgroundColor="#FFFFFF";a.style.filter="chroma(color=#FFFFFF)"}OpenLayers.Util.modifyDOMElement(a,null,new OpenLayers.Pixel(0,0),this.layer.getImageSize(),
"absolute");var b=document.createElement("div");b.appendChild(a);return b},createIFrame:function(){var a=this.id+"_iFrame",b;if(OpenLayers.Util.getBrowserName()=="msie"){b=document.createElement('<iframe name="'+a+'">');b.style.backgroundColor="#FFFFFF";b.style.filter="chroma(color=#FFFFFF)"}else{b=document.createElement("iframe");b.style.backgroundColor="transparent";b.name=a}b.id=a;b.scrolling="no";b.marginWidth="0px";b.marginHeight="0px";b.frameBorder="0";OpenLayers.Util.modifyDOMElement(b,a,new OpenLayers.Pixel(0,
0),this.layer.getImageSize(),"absolute");OpenLayers.Event.observe(b,"load",OpenLayers.Function.bind(function(){this.show();if(this.isLoading){this.isLoading=false;this.events.triggerEvent("loadend")}},this));return b},createRequestForm:function(){var a=document.createElement("form");a.method="POST";var b=this.layer.params._OLSALT;b=(b?b+"_":"")+this.bounds.toBBOX();a.action=OpenLayers.Util.urlAppend(this.layer.url,b);this.imgDiv.insertBefore(this.createIFrame(),this.imgDiv.firstChild);a.target=this.id+
"_iFrame";b=this.layer.getImageSize();b=OpenLayers.Util.extend({BBOX:this.encodeBBOX?this.bounds.toBBOX():this.bounds.toArray(),WIDTH:b.w,HEIGHT:b.h},this.layer.params);for(var d in b){var e=document.createElement("input");e.type="hidden";e.name=d;e.value=b[d];a.appendChild(e)}return a},CLASS_NAME:"OpenLayers.Tile.Image.IFrame"});
OpenLayers.Layer.SphericalMercator={getExtent:function(){var a=null;return a=this.sphericalMercator?this.map.calculateBounds():OpenLayers.Layer.FixedZoomLevels.prototype.getExtent.apply(this)},initMercatorParameters:function(){this.RESOLUTIONS=[];for(var a=0;a<=this.MAX_ZOOM_LEVEL;++a)this.RESOLUTIONS[a]=156543.0339/Math.pow(2,a);this.units="m";this.projection="EPSG:900913"},forwardMercator:function(a,b){var d=Math.log(Math.tan((90+b)*Math.PI/360))/(Math.PI/180);return new OpenLayers.LonLat(a*2.003750834E7/
180,d*2.003750834E7/180)},inverseMercator:function(a,b){var d=b/2.003750834E7*180;d=180/Math.PI*(2*Math.atan(Math.exp(d*Math.PI/180))-Math.PI/2);return new OpenLayers.LonLat(a/2.003750834E7*180,d)},projectForward:function(a){var b=OpenLayers.Layer.SphericalMercator.forwardMercator(a.x,a.y);a.x=b.lon;a.y=b.lat;return a},projectInverse:function(a){var b=OpenLayers.Layer.SphericalMercator.inverseMercator(a.x,a.y);a.x=b.lon;a.y=b.lat;return a}};
OpenLayers.Projection.addTransform("EPSG:4326","EPSG:900913",OpenLayers.Layer.SphericalMercator.projectForward);OpenLayers.Projection.addTransform("EPSG:900913","EPSG:4326",OpenLayers.Layer.SphericalMercator.projectInverse);
OpenLayers.Layer.EventPane=OpenLayers.Class(OpenLayers.Layer,{smoothDragPan:true,isBaseLayer:true,isFixed:true,pane:null,mapObject:null,initialize:function(){OpenLayers.Layer.prototype.initialize.apply(this,arguments);if(this.pane==null)this.pane=OpenLayers.Util.createDiv(this.div.id+"_EventPane")},destroy:function(){this.pane=this.mapObject=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},setMap:function(){OpenLayers.Layer.prototype.setMap.apply(this,arguments);this.pane.style.zIndex=
parseInt(this.div.style.zIndex)+1;this.pane.style.display=this.div.style.display;this.pane.style.width="100%";this.pane.style.height="100%";if(OpenLayers.Util.getBrowserName()=="msie")this.pane.style.background="url("+OpenLayers.Util.getImagesLocation()+"blank.gif)";this.isFixed?this.map.viewPortDiv.appendChild(this.pane):this.map.layerContainerDiv.appendChild(this.pane);this.loadMapObject();this.mapObject==null&&this.loadWarningMessage()},removeMap:function(){this.pane&&this.pane.parentNode&&this.pane.parentNode.removeChild(this.pane);
OpenLayers.Layer.prototype.removeMap.apply(this,arguments)},loadWarningMessage:function(){this.div.style.backgroundColor="darkblue";var a=this.map.getSize(),b=new OpenLayers.Size(Math.min(a.w,300),Math.min(a.h,200));a=(new OpenLayers.Pixel(a.w/2,a.h/2)).add(-b.w/2,-b.h/2);b=OpenLayers.Util.createDiv(this.name+"_warning",a,b,null,null,null,"auto");b.style.padding="7px";b.style.backgroundColor="yellow";b.innerHTML=this.getWarningHTML();this.div.appendChild(b)},getWarningHTML:function(){return""},display:function(){OpenLayers.Layer.prototype.display.apply(this,
arguments);this.pane.style.display=this.div.style.display},setZIndex:function(){OpenLayers.Layer.prototype.setZIndex.apply(this,arguments);this.pane.style.zIndex=parseInt(this.div.style.zIndex)+1},moveTo:function(a,b,d){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);if(this.mapObject!=null){var e=this.map.getCenter(),f=this.map.getZoom();if(e!=null){var g=this.getOLLonLatFromMapObjectLonLat(this.getMapObjectCenter()),h=this.getOLZoomFromMapObjectZoom(this.getMapObjectZoom());if(!e.equals(g)||
f!=h)if(d&&this.dragPanMapObject&&this.smoothDragPan){f=this.map.getViewPortPxFromLonLat(g);e=this.map.getViewPortPxFromLonLat(e);this.dragPanMapObject(e.x-f.x,f.y-e.y)}else{e=this.getMapObjectLonLatFromOLLonLat(e);f=this.getMapObjectZoomFromOLZoom(f);this.setMapObjectCenter(e,f,d)}}}},getLonLatFromViewPortPx:function(a){var b=null;if(this.mapObject!=null&&this.getMapObjectCenter()!=null)b=this.getOLLonLatFromMapObjectLonLat(this.getMapObjectLonLatFromMapObjectPixel(this.getMapObjectPixelFromOLPixel(a)));
return b},getViewPortPxFromLonLat:function(a){var b=null;if(this.mapObject!=null&&this.getMapObjectCenter()!=null)b=this.getOLPixelFromMapObjectPixel(this.getMapObjectPixelFromMapObjectLonLat(this.getMapObjectLonLatFromOLLonLat(a)));return b},getOLLonLatFromMapObjectLonLat:function(a){var b=null;if(a!=null){b=this.getLongitudeFromMapObjectLonLat(a);a=this.getLatitudeFromMapObjectLonLat(a);b=new OpenLayers.LonLat(b,a)}return b},getMapObjectLonLatFromOLLonLat:function(a){var b=null;if(a!=null)b=this.getMapObjectLonLatFromLonLat(a.lon,
a.lat);return b},getOLPixelFromMapObjectPixel:function(a){var b=null;if(a!=null){b=this.getXFromMapObjectPixel(a);a=this.getYFromMapObjectPixel(a);b=new OpenLayers.Pixel(b,a)}return b},getMapObjectPixelFromOLPixel:function(a){var b=null;if(a!=null)b=this.getMapObjectPixelFromXY(a.x,a.y);return b},CLASS_NAME:"OpenLayers.Layer.EventPane"});
OpenLayers.Layer.FixedZoomLevels=OpenLayers.Class({initialize:function(){},initResolutions:function(){for(var a=new Array("minZoomLevel","maxZoomLevel","numZoomLevels"),b=0,d=a.length;b<d;b++){var e=a[b];this[e]=this.options[e]!=null?this.options[e]:this.map[e]}if(this.minZoomLevel==null||this.minZoomLevel<this.MIN_ZOOM_LEVEL)this.minZoomLevel=this.MIN_ZOOM_LEVEL;a=this.MAX_ZOOM_LEVEL-this.minZoomLevel+1;b=this.options.numZoomLevels==null&&this.options.maxZoomLevel!=null||this.numZoomLevels==null&&
this.maxZoomLevel!=null?this.maxZoomLevel-this.minZoomLevel+1:this.numZoomLevels;this.numZoomLevels=b!=null?Math.min(b,a):a;this.maxZoomLevel=this.minZoomLevel+this.numZoomLevels-1;if(this.RESOLUTIONS!=null){a=0;this.resolutions=[];for(b=this.minZoomLevel;b<=this.maxZoomLevel;b++)this.resolutions[a++]=this.RESOLUTIONS[b];this.maxResolution=this.resolutions[0];this.minResolution=this.resolutions[this.resolutions.length-1]}},getResolution:function(){if(this.resolutions!=null)return OpenLayers.Layer.prototype.getResolution.apply(this,
arguments);else{var a=null,b=this.map.getSize(),d=this.getExtent();if(b!=null&&d!=null)a=Math.max(d.getWidth()/b.w,d.getHeight()/b.h);return a}},getExtent:function(){var a=null,b=this.map.getSize(),d=this.getLonLatFromViewPortPx(new OpenLayers.Pixel(0,0));b=this.getLonLatFromViewPortPx(new OpenLayers.Pixel(b.w,b.h));if(d!=null&&b!=null)a=new OpenLayers.Bounds(d.lon,b.lat,b.lon,d.lat);return a},getZoomForResolution:function(){return this.resolutions!=null?OpenLayers.Layer.prototype.getZoomForResolution.apply(this,
arguments):this.getZoomForExtent(OpenLayers.Layer.prototype.getExtent.apply(this,[]))},getOLZoomFromMapObjectZoom:function(a){var b=null;if(a!=null)b=a-this.minZoomLevel;return b},getMapObjectZoomFromOLZoom:function(a){var b=null;if(a!=null)b=a+this.minZoomLevel;return b},CLASS_NAME:"OpenLayers.Layer.FixedZoomLevels"});
OpenLayers.Layer.Google=OpenLayers.Class(OpenLayers.Layer.EventPane,OpenLayers.Layer.FixedZoomLevels,{MIN_ZOOM_LEVEL:0,MAX_ZOOM_LEVEL:21,RESOLUTIONS:[1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,6.866455078125E-4,3.4332275390625E-4,1.71661376953125E-4,8.58306884765625E-5,4.291534423828125E-5,2.145767211914062E-5,1.072883605957031E-5,5.36441802978515E-6,2.68220901489257E-6,1.341104507446289E-6,6.705522537231445E-7],
type:null,sphericalMercator:false,dragObject:null,termsOfUse:null,poweredBy:null,initialize:function(){OpenLayers.Layer.EventPane.prototype.initialize.apply(this,arguments);OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,arguments);this.addContainerPxFunction();if(this.sphericalMercator){OpenLayers.Util.extend(this,OpenLayers.Layer.SphericalMercator);this.initMercatorParameters()}},clone:function(){return new OpenLayers.Layer.Google(this.name,this.getOptions())},loadMapObject:function(){if(!this.type)this.type=
G_NORMAL_MAP;var a,b,d,e=OpenLayers.Layer.Google.cache[this.map.id];if(e){a=e.mapObject;b=e.termsOfUse;d=e.poweredBy;++e.count}else{e=this.map.viewPortDiv;var f=document.createElement("div");f.id=this.map.id+"_GMap2Container";f.style.position="absolute";f.style.width="100%";f.style.height="100%";e.appendChild(f);try{a=new GMap2(f);b=f.lastChild;e.appendChild(b);b.style.zIndex="1100";b.style.right="";b.style.bottom="";b.className="olLayerGoogleCopyright";d=f.lastChild;e.appendChild(d);d.style.zIndex=
"1100";d.style.right="";d.style.bottom="";d.className="olLayerGooglePoweredBy gmnoprint"}catch(g){OpenLayers.Console.error(g);return}OpenLayers.Layer.Google.cache[this.map.id]={mapObject:a,termsOfUse:b,poweredBy:d,count:1}}this.mapObject=a;this.termsOfUse=b;this.poweredBy=d;OpenLayers.Util.indexOf(this.mapObject.getMapTypes(),this.type)===-1&&this.mapObject.addMapType(this.type);if(typeof a.getDragObject=="function")this.dragObject=a.getDragObject();else this.dragPanMapObject=null;this.isBaseLayer===
false&&this.setGMapVisibility(this.div.style.display!=="none")},onMapResize:function(){if(this.visibility&&this.mapObject.isLoaded())this.mapObject.checkResize();else{if(!this._resized)var a=this,b=GEvent.addListener(this.mapObject,"load",function(){GEvent.removeListener(b);delete a._resized;a.mapObject.checkResize();a.moveTo(a.map.getCenter(),a.map.getZoom())});this._resized=true}},setVisibility:function(a){this.setGMapVisibility(a);var b=this.opacity==null?1:this.opacity;OpenLayers.Layer.EventPane.prototype.setVisibility.apply(this,
arguments);this.setOpacity(b)},setGMapVisibility:function(a){var b=OpenLayers.Layer.Google.cache[this.map.id];if(b){var d=this.mapObject.getContainer();if(a===true){this.mapObject.setMapType(this.type);d.style.display="";this.termsOfUse.style.left="";this.termsOfUse.style.display="";this.poweredBy.style.display="";b.displayed=this.id}else{b.displayed===this.id&&delete b.displayed;if(!b.displayed){d.style.display="none";this.termsOfUse.style.display="none";this.termsOfUse.style.left="-9999px";this.poweredBy.style.display=
"none"}}}},setOpacity:function(a){if(a!==this.opacity){this.map!=null&&this.map.events.triggerEvent("changelayer",{layer:this,property:"opacity"});this.opacity=a}if(this.getVisibility()){var b=this.mapObject.getContainer();OpenLayers.Util.modifyDOMElement(b,null,null,null,null,null,null,a)}},destroy:function(){if(this.map){this.setGMapVisibility(false);var a=OpenLayers.Layer.Google.cache[this.map.id];a&&a.count<=1&&this.removeGMapElements(false)}OpenLayers.Layer.EventPane.prototype.destroy.apply(this,
arguments)},removeGMapElements:function(){var a=OpenLayers.Layer.Google.cache[this.map.id];if(a){var b=this.mapObject&&this.mapObject.getContainer();b&&b.parentNode&&b.parentNode.removeChild(b);(b=a.termsOfUse)&&b.parentNode&&b.parentNode.removeChild(b);(a=a.poweredBy)&&a.parentNode&&a.parentNode.removeChild(a)}},removeMap:function(a){this.visibility&&this.mapObject&&this.setGMapVisibility(false);var b=OpenLayers.Layer.Google.cache[a.id];if(b)if(b.count<=1){this.removeGMapElements();delete OpenLayers.Layer.Google.cache[a.id]}else--b.count;
delete this.termsOfUse;delete this.poweredBy;delete this.mapObject;delete this.dragObject;OpenLayers.Layer.EventPane.prototype.removeMap.apply(this,arguments)},getOLBoundsFromMapObjectBounds:function(a){var b=null;if(a!=null){b=a.getSouthWest();a=a.getNorthEast();if(this.sphericalMercator){b=this.forwardMercator(b.lng(),b.lat());a=this.forwardMercator(a.lng(),a.lat())}else{b=new OpenLayers.LonLat(b.lng(),b.lat());a=new OpenLayers.LonLat(a.lng(),a.lat())}b=new OpenLayers.Bounds(b.lon,b.lat,a.lon,a.lat)}return b},
getMapObjectBoundsFromOLBounds:function(a){var b=null;if(a!=null){b=this.sphericalMercator?this.inverseMercator(a.bottom,a.left):new OpenLayers.LonLat(a.bottom,a.left);a=this.sphericalMercator?this.inverseMercator(a.top,a.right):new OpenLayers.LonLat(a.top,a.right);b=new GLatLngBounds(new GLatLng(b.lat,b.lon),new GLatLng(a.lat,a.lon))}return b},addContainerPxFunction:function(){if(typeof GMap2!="undefined"&&!GMap2.prototype.fromLatLngToContainerPixel)GMap2.prototype.fromLatLngToContainerPixel=function(a){a=
this.fromLatLngToDivPixel(a);var b=this.getContainer().firstChild.firstChild;a.x+=b.offsetLeft;a.y+=b.offsetTop;return a}},getWarningHTML:function(){return OpenLayers.i18n("googleWarning")},setMapObjectCenter:function(a,b){this.mapObject.setCenter(a,b)},dragPanMapObject:function(a,b){this.dragObject.moveBy(new GSize(-a,b))},getMapObjectCenter:function(){return this.mapObject.getCenter()},getMapObjectZoom:function(){return this.mapObject.getZoom()},getMapObjectLonLatFromMapObjectPixel:function(a){return this.mapObject.fromContainerPixelToLatLng(a)},
getMapObjectPixelFromMapObjectLonLat:function(a){return this.mapObject.fromLatLngToContainerPixel(a)},getMapObjectZoomFromMapObjectBounds:function(a){return this.mapObject.getBoundsZoomLevel(a)},getLongitudeFromMapObjectLonLat:function(a){return this.sphericalMercator?this.forwardMercator(a.lng(),a.lat()).lon:a.lng()},getLatitudeFromMapObjectLonLat:function(a){return this.sphericalMercator?this.forwardMercator(a.lng(),a.lat()).lat:a.lat()},getMapObjectLonLatFromLonLat:function(a,b){var d;if(this.sphericalMercator){d=
this.inverseMercator(a,b);d=new GLatLng(d.lat,d.lon)}else d=new GLatLng(b,a);return d},getXFromMapObjectPixel:function(a){return a.x},getYFromMapObjectPixel:function(a){return a.y},getMapObjectPixelFromXY:function(a,b){return new GPoint(a,b)},CLASS_NAME:"OpenLayers.Layer.Google"});OpenLayers.Layer.Google.cache={};
OpenLayers.Layer.HTTPRequest=OpenLayers.Class(OpenLayers.Layer,{URL_HASH_FACTOR:(Math.sqrt(5)-1)/2,url:null,params:null,reproject:false,initialize:function(a,b,d,e){var f=arguments;f=[a,e];OpenLayers.Layer.prototype.initialize.apply(this,f);this.url=b;this.params=OpenLayers.Util.extend({},d)},destroy:function(){this.params=this.url=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(a){if(a==null)a=new OpenLayers.Layer.HTTPRequest(this.name,this.url,this.params,this.getOptions());
return a=OpenLayers.Layer.prototype.clone.apply(this,[a])},setUrl:function(a){this.url=a},mergeNewParams:function(a){this.params=OpenLayers.Util.extend(this.params,a);a=this.redraw();this.map!=null&&this.map.events.triggerEvent("changelayer",{layer:this,property:"params"});return a},redraw:function(a){return a?this.mergeNewParams({_olSalt:Math.random()}):OpenLayers.Layer.prototype.redraw.apply(this,[])},selectUrl:function(a,b){for(var d=1,e=0,f=a.length;e<f;e++){d*=a.charCodeAt(e)*this.URL_HASH_FACTOR;
d-=Math.floor(d)}return b[Math.floor(d*b.length)]},getFullRequestString:function(a,b){var d=b||this.url,e=OpenLayers.Util.extend({},this.params);e=OpenLayers.Util.extend(e,a);var f=OpenLayers.Util.getParameterString(e);if(d instanceof Array)d=this.selectUrl(f,d);f=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(d));for(var g in e)g.toUpperCase()in f&&delete e[g];f=OpenLayers.Util.getParameterString(e);return OpenLayers.Util.urlAppend(d,f)},CLASS_NAME:"OpenLayers.Layer.HTTPRequest"});
OpenLayers.Layer.Grid=OpenLayers.Class(OpenLayers.Layer.HTTPRequest,{tileSize:null,grid:null,singleTile:false,ratio:1.5,buffer:2,numLoadingTiles:0,initialize:function(){OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,arguments);this.events.addEventType("tileloaded");this.grid=[]},destroy:function(){this.clearGrid();this.tileSize=this.grid=null;OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this,arguments)},clearGrid:function(){if(this.grid){for(var a=0,b=this.grid.length;a<b;a++)for(var d=
this.grid[a],e=0,f=d.length;e<f;e++){var g=d[e];this.removeTileMonitoringHooks(g);g.destroy()}this.grid=[]}},clone:function(a){if(a==null)a=new OpenLayers.Layer.Grid(this.name,this.url,this.params,this.getOptions());a=OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this,[a]);if(this.tileSize!=null)a.tileSize=this.tileSize.clone();a.grid=[];return a},moveTo:function(a,b,d){OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this,arguments);a=a||this.map.getExtent();if(a!=null){var e=!this.grid.length||
b,f=this.getTilesBounds();if(this.singleTile){if(e||!d&&!f.containsBounds(a))this.initSingleTile(a)}else e||!f.containsBounds(a,true)?this.initGriddedTiles(a):this.moveGriddedTiles(a)}},setTileSize:function(a){if(this.singleTile){a=this.map.getSize().clone();a.h=parseInt(a.h*this.ratio);a.w=parseInt(a.w*this.ratio)}OpenLayers.Layer.HTTPRequest.prototype.setTileSize.apply(this,[a])},getGridBounds:function(){OpenLayers.Console.warn("The getGridBounds() function is deprecated. It will be removed in 3.0. Please use getTilesBounds() instead.");
return this.getTilesBounds()},getTilesBounds:function(){var a=null;if(this.grid.length){a=this.grid[this.grid.length-1][0];var b=this.grid[0][this.grid[0].length-1];a=new OpenLayers.Bounds(a.bounds.left,a.bounds.bottom,b.bounds.right,b.bounds.top)}return a},initSingleTile:function(a){var b=a.getCenterLonLat(),d=a.getWidth()*this.ratio;a=a.getHeight()*this.ratio;b=new OpenLayers.Bounds(b.lon-d/2,b.lat-a/2,b.lon+d/2,b.lat+a/2);d=this.map.getLayerPxFromLonLat(new OpenLayers.LonLat(b.left,b.top));this.grid.length||
(this.grid[0]=[]);if(a=this.grid[0][0])a.moveTo(b,d);else{a=this.addTile(b,d);this.addTileMonitoringHooks(a);a.draw();this.grid[0][0]=a}this.removeExcessTiles(1,1)},calculateGridLayout:function(a,b,d){var e=d*this.tileSize.w;d=d*this.tileSize.h;var f=a.left-b.left,g=Math.floor(f/e)-this.buffer;f=-(f/e-g)*this.tileSize.w;g=b.left+g*e;a=a.top-(b.bottom+d);var h=Math.ceil(a/d)+this.buffer;return{tilelon:e,tilelat:d,tileoffsetlon:g,tileoffsetlat:b.bottom+h*d,tileoffsetx:f,tileoffsety:-(h-a/d)*this.tileSize.h}},
initGriddedTiles:function(a){var b=this.map.getSize(),d=Math.ceil(b.h/this.tileSize.h)+Math.max(1,2*this.buffer);b=Math.ceil(b.w/this.tileSize.w)+Math.max(1,2*this.buffer);var e=this.maxExtent,f=this.map.getResolution(),g=this.calculateGridLayout(a,e,f);e=Math.round(g.tileoffsetx);f=Math.round(g.tileoffsety);var h=g.tileoffsetlon,j=g.tileoffsetlat,l=g.tilelon;g=g.tilelat;this.origin=new OpenLayers.Pixel(e,f);var m=e,o=h,p=0,q=parseInt(this.map.layerContainerDiv.style.left),r=parseInt(this.map.layerContainerDiv.style.top);
do{var s=this.grid[p++];if(!s){s=[];this.grid.push(s)}h=o;e=m;var t=0;do{var v=new OpenLayers.Bounds(h,j,h+l,j+g),u=e;u-=q;var w=f;w-=r;u=new OpenLayers.Pixel(u,w);if(w=s[t++])w.moveTo(v,u,false);else{w=this.addTile(v,u);this.addTileMonitoringHooks(w);s.push(w)}h+=l;e+=this.tileSize.w}while(h<=a.right+l*this.buffer||t<b);j-=g;f+=this.tileSize.h}while(j>=a.bottom-g*this.buffer||p<d);this.removeExcessTiles(p,t);this.spiralTileLoad()},spiralTileLoad:function(){for(var a=[],b=["right","down","left","up"],
d=0,e=-1,f=OpenLayers.Util.indexOf(b,"right"),g=0;g<b.length;){var h=d,j=e;switch(b[f]){case "right":j++;break;case "down":h++;break;case "left":j--;break;case "up":h--;break}var l=null;if(h<this.grid.length&&h>=0&&j<this.grid[0].length&&j>=0)l=this.grid[h][j];if(l!=null&&!l.queued){a.unshift(l);l.queued=true;g=0;d=h;e=j}else{f=(f+1)%4;g++}}b=0;for(d=a.length;b<d;b++){l=a[b];l.draw();l.queued=false}},addTile:function(){},addTileMonitoringHooks:function(a){a.onLoadStart=function(){this.numLoadingTiles==
0&&this.events.triggerEvent("loadstart");this.numLoadingTiles++};a.events.register("loadstart",this,a.onLoadStart);a.onLoadEnd=function(){this.numLoadingTiles--;this.events.triggerEvent("tileloaded");this.numLoadingTiles==0&&this.events.triggerEvent("loadend")};a.events.register("loadend",this,a.onLoadEnd);a.events.register("unload",this,a.onLoadEnd)},removeTileMonitoringHooks:function(a){a.unload();a.events.un({loadstart:a.onLoadStart,loadend:a.onLoadEnd,unload:a.onLoadEnd,scope:this})},moveGriddedTiles:function(){for(var a=
this.buffer||1;;){var b=this.map.getViewPortPxFromLayerPx(this.grid[0][0].position);if(b.x>-this.tileSize.w*(a-1))this.shiftColumn(true);else if(b.x<-this.tileSize.w*a)this.shiftColumn(false);else if(b.y>-this.tileSize.h*(a-1))this.shiftRow(true);else if(b.y<-this.tileSize.h*a)this.shiftRow(false);else break}},shiftRow:function(a){var b=this.grid,d=b[a?0:this.grid.length-1],e=this.map.getResolution(),f=a?-this.tileSize.h:this.tileSize.h;e=e*-f;for(var g=a?b.pop():b.shift(),h=0,j=d.length;h<j;h++){var l=
d[h],m=l.bounds.clone();l=l.position.clone();m.bottom+=e;m.top+=e;l.y+=f;g[h].moveTo(m,l)}a?b.unshift(g):b.push(g)},shiftColumn:function(a){for(var b=a?-this.tileSize.w:this.tileSize.w,d=this.map.getResolution()*b,e=0,f=this.grid.length;e<f;e++){var g=this.grid[e],h=g[a?0:g.length-1],j=h.bounds.clone();h=h.position.clone();j.left+=d;j.right+=d;h.x+=b;var l=a?this.grid[e].pop():this.grid[e].shift();l.moveTo(j,h);a?g.unshift(l):g.push(l)}},removeExcessTiles:function(a,b){for(;this.grid.length>a;)for(var d=
this.grid.pop(),e=0,f=d.length;e<f;e++){var g=d[e];this.removeTileMonitoringHooks(g);g.destroy()}for(;this.grid[0].length>b;){e=0;for(f=this.grid.length;e<f;e++){d=this.grid[e];g=d.pop();this.removeTileMonitoringHooks(g);g.destroy()}}},onMapResize:function(){if(this.singleTile){this.clearGrid();this.setTileSize()}},getTileBounds:function(a){var b=this.maxExtent,d=this.getResolution(),e=d*this.tileSize.w;d=d*this.tileSize.h;var f=this.getLonLatFromViewPortPx(a);a=b.left+e*Math.floor((f.lon-b.left)/
e);b=b.bottom+d*Math.floor((f.lat-b.bottom)/d);return new OpenLayers.Bounds(a,b,a+e,b+d)},CLASS_NAME:"OpenLayers.Layer.Grid"});
OpenLayers.Layer.WMS=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{service:"WMS",version:"1.1.1",request:"GetMap",styles:"",exceptions:"application/vnd.ogc.se_inimage",format:"image/jpeg"},reproject:false,isBaseLayer:true,encodeBBOX:false,noMagic:false,yx:["EPSG:4326"],initialize:function(a,b,d,e){var f=[];d=OpenLayers.Util.upperCaseObject(d);f.push(a,b,d,e);OpenLayers.Layer.Grid.prototype.initialize.apply(this,f);OpenLayers.Util.applyDefaults(this.params,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS));
if(!this.noMagic&&this.params.TRANSPARENT&&this.params.TRANSPARENT.toString().toLowerCase()=="true"){if(e==null||!e.isBaseLayer)this.isBaseLayer=false;if(this.params.FORMAT=="image/jpeg")this.params.FORMAT=OpenLayers.Util.alphaHack()?"image/gif":"image/png"}},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments)},clone:function(a){if(a==null)a=new OpenLayers.Layer.WMS(this.name,this.url,this.params,this.getOptions());return a=OpenLayers.Layer.Grid.prototype.clone.apply(this,
[a])},reverseAxisOrder:function(){return parseFloat(this.params.VERSION)>=1.3&&OpenLayers.Util.indexOf(this.yx,this.map.getProjectionObject().getCode())!==-1},getURL:function(a){a=this.adjustBounds(a);var b=this.getImageSize(),d={},e=this.reverseAxisOrder();d.BBOX=this.encodeBBOX?a.toBBOX(null,e):a.toArray(e);d.WIDTH=b.w;d.HEIGHT=b.h;return this.getFullRequestString(d)},addTile:function(a,b){return new OpenLayers.Tile.Image(this,b,a,null,this.tileSize)},mergeNewParams:function(a){a=[OpenLayers.Util.upperCaseObject(a)];
return OpenLayers.Layer.Grid.prototype.mergeNewParams.apply(this,a)},getFullRequestString:function(){var a=this.map.getProjection();a=a=="none"?null:a;if(parseFloat(this.params.VERSION)>=1.3)this.params.CRS=a;else this.params.SRS=a;return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments)},CLASS_NAME:"OpenLayers.Layer.WMS"});
OpenLayers.Layer.WMS.Untiled=OpenLayers.Class(OpenLayers.Layer.WMS,{singleTile:true,initialize:function(){OpenLayers.Layer.WMS.prototype.initialize.apply(this,arguments);OpenLayers.Console.warn("The OpenLayers.Layer.WMS.Untiled class is deprecated and will be removed in 3.0. Instead, you should use the normal OpenLayers.Layer.WMS class, passing it the option 'singleTile' as true.")},clone:function(a){if(a==null)a=new OpenLayers.Layer.WMS.Untiled(this.name,this.url,this.params,this.getOptions());return a=
OpenLayers.Layer.WMS.prototype.clone.apply(this,[a])},CLASS_NAME:"OpenLayers.Layer.WMS.Untiled"});
OpenLayers.Layer.WMS.Post=OpenLayers.Class(OpenLayers.Layer.WMS,{tileClass:null,unsupportedBrowsers:["mozilla","firefox","opera"],SUPPORTED_TRANSITIONS:[],initialize:function(a,b,d,e){var f=[];f.push(a,b,d,e);OpenLayers.Layer.WMS.prototype.initialize.apply(this,f);this.tileClass=OpenLayers.Util.indexOf(this.unsupportedBrowsers,OpenLayers.Util.getBrowserName())!=-1?OpenLayers.Tile.Image:OpenLayers.Tile.Image.IFrame},addTile:function(a,b){return new this.tileClass(this,b,a,null,this.tileSize)},CLASS_NAME:"OpenLayers.Layer.WMS.Post"});
OpenLayers.Layer.XYZ=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:true,sphericalMercator:false,initialize:function(a,b,d){if(d&&d.sphericalMercator||this.sphericalMercator)d=OpenLayers.Util.extend({maxExtent:new OpenLayers.Bounds(-2.00375083392E7,-2.00375083392E7,2.00375083392E7,2.00375083392E7),maxResolution:156543.0339,numZoomLevels:19,units:"m",projection:"EPSG:900913"},d);b=b||this.url;a=a||this.name;OpenLayers.Layer.Grid.prototype.initialize.apply(this,[a,b,{},d])},clone:function(a){if(a==
null)a=new OpenLayers.Layer.XYZ(this.name,this.url,this.getOptions());a=OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this,[a]);if(this.tileSize!=null)a.tileSize=this.tileSize.clone();a.grid=[];return a},getURL:function(a){var b=this.map.getResolution(),d=Math.round((a.left-this.maxExtent.left)/(b*this.tileSize.w));a=Math.round((this.maxExtent.top-a.top)/(b*this.tileSize.h));b=this.map.getZoom();var e=this.url,f=""+d+a+b;if(e instanceof Array)e=this.selectUrl(f,e);return OpenLayers.String.format(e,
{x:d,y:a,z:b})},addTile:function(a,b){return new OpenLayers.Tile.Image(this,b,a,null,this.tileSize)},setMap:function(){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 <a href='http://openstreetmap.org/'>OpenStreetMap</a>",sphericalMercator:true,url:"http://tile.openstreetmap.org/${z}/${x}/${y}.png",CLASS_NAME:"OpenLayers.Layer.OSM"});
OpenLayers.Popup.Anchored=OpenLayers.Class(OpenLayers.Popup,{relativePosition:null,keepInMap:true,anchor:null,initialize:function(a,b,d,e,f,g,h){OpenLayers.Popup.prototype.initialize.apply(this,[a,b,d,e,g,h]);this.anchor=f!=null?f:{size:new OpenLayers.Size(0,0),offset:new OpenLayers.Pixel(0,0)}},destroy:function(){this.relativePosition=this.anchor=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);a=this.calculateNewPx(a);OpenLayers.Popup.prototype.moveTo.apply(this,new Array(a));this.relativePosition!=b&&this.updateRelativePosition()},setSize:function(){OpenLayers.Popup.prototype.setSize.apply(this,arguments);this.lonlat&&this.map&&this.moveTo(this.map.getLayerPxFromLonLat(this.lonlat))},calculateRelativePosition:function(a){a=this.map.getLonLatFromLayerPx(a);a=this.map.getExtent().determineQuadrant(a);
return OpenLayers.Bounds.oppositeQuadrant(a)},updateRelativePosition:function(){},calculateNewPx:function(a){a=a.offset(this.anchor.offset);var b=this.size||this.contentSize,d=this.relativePosition.charAt(0)=="t";a.y+=d?-b.h:this.anchor.size.h;d=this.relativePosition.charAt(1)=="l";a.x+=d?-b.w:this.anchor.size.w;return a},CLASS_NAME:"OpenLayers.Popup.Anchored"});
OpenLayers.Popup.Framed=OpenLayers.Class(OpenLayers.Popup.Anchored,{imageSrc:null,imageSize:null,isAlphaImage:false,positionBlocks:null,blocks:null,fixedRelativePosition:false,initialize:function(a,b,d,e,f,g){OpenLayers.Popup.Anchored.prototype.initialize.apply(this,arguments);if(this.fixedRelativePosition){this.updateRelativePosition();this.calculateRelativePosition=function(){return this.relativePosition}}this.contentDiv.style.position="absolute";this.contentDiv.style.zIndex=1;if(g)this.closeDiv.style.zIndex=
1;this.groupDiv.style.position="absolute";this.groupDiv.style.top="0px";this.groupDiv.style.left="0px";this.groupDiv.style.height="100%";this.groupDiv.style.width="100%"},destroy:function(){this.isAlphaImage=this.imageSize=this.imageSrc=null;this.fixedRelativePosition=false;this.positionBlocks=null;for(var a=0;a<this.blocks.length;a++){var b=this.blocks[a];b.image&&b.div.removeChild(b.image);b.image=null;b.div&&this.groupDiv.removeChild(b.div);b.div=null}this.blocks=null;OpenLayers.Popup.Anchored.prototype.destroy.apply(this,
arguments)},setBackgroundColor:function(){},setBorder:function(){},setOpacity:function(){},setSize:function(){OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments);this.updateBlocks()},updateRelativePosition:function(){this.padding=this.positionBlocks[this.relativePosition].padding;if(this.closeDiv){var a=this.getContentDivPadding();this.closeDiv.style.right=a.right+this.padding.right+"px";this.closeDiv.style.top=a.top+this.padding.top+"px"}this.updateBlocks()},calculateNewPx:function(){var a=
OpenLayers.Popup.Anchored.prototype.calculateNewPx.apply(this,arguments);return a=a.offset(this.positionBlocks[this.relativePosition].offset)},createBlocks:function(){this.blocks=[];var a=null;for(var b in this.positionBlocks){a=b;break}a=this.positionBlocks[a];for(b=0;b<a.blocks.length;b++){var d={};this.blocks.push(d);d.div=OpenLayers.Util.createDiv(this.id+"_FrameDecorationDiv_"+b,null,null,null,"absolute",null,"hidden",null);d.image=(this.isAlphaImage?OpenLayers.Util.createAlphaImageDiv:OpenLayers.Util.createImage)(this.id+
"_FrameDecorationImg_"+b,null,this.imageSize,this.imageSrc,"absolute",null,null,null);d.div.appendChild(d.image);this.groupDiv.appendChild(d.div)}},updateBlocks:function(){this.blocks||this.createBlocks();if(this.size&&this.relativePosition){for(var a=this.positionBlocks[this.relativePosition],b=0;b<a.blocks.length;b++){var d=a.blocks[b],e=this.blocks[b],f=d.anchor.left,g=d.anchor.bottom,h=d.anchor.right,j=d.anchor.top,l=isNaN(d.size.w)?this.size.w-(h+f):d.size.w,m=isNaN(d.size.h)?this.size.h-(g+
j):d.size.h;e.div.style.width=(l<0?0:l)+"px";e.div.style.height=(m<0?0:m)+"px";e.div.style.left=f!=null?f+"px":"";e.div.style.bottom=g!=null?g+"px":"";e.div.style.right=h!=null?h+"px":"";e.div.style.top=j!=null?j+"px":"";e.image.style.left=d.position.x+"px";e.image.style.top=d.position.y+"px"}this.contentDiv.style.left=this.padding.left+"px";this.contentDiv.style.top=this.padding.top+"px"}},CLASS_NAME:"OpenLayers.Popup.Framed"});
OpenLayers.Popup.FramedCloud=OpenLayers.Class(OpenLayers.Popup.Framed,{contentDisplayClass:"olFramedCloudPopupContent",autoSize:true,panMapIfOutOfView:true,imageSize:new OpenLayers.Size(676,736),isAlphaImage:false,fixedRelativePosition:false,positionBlocks:{tl:{offset:new OpenLayers.Pixel(44,0),padding:new OpenLayers.Bounds(8,40,8,9),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,51,22,0),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,
50,0,0),position:new OpenLayers.Pixel(-638,0)},{size:new OpenLayers.Size("auto",19),anchor:new OpenLayers.Bounds(0,32,22,null),position:new OpenLayers.Pixel(0,-631)},{size:new OpenLayers.Size(22,18),anchor:new OpenLayers.Bounds(null,32,0,null),position:new OpenLayers.Pixel(-638,-632)},{size:new OpenLayers.Size(81,35),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(0,-688)}]},tr:{offset:new OpenLayers.Pixel(-45,0),padding:new OpenLayers.Bounds(8,40,8,9),blocks:[{size:new OpenLayers.Size("auto",
"auto"),anchor:new OpenLayers.Bounds(0,51,22,0),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,50,0,0),position:new OpenLayers.Pixel(-638,0)},{size:new OpenLayers.Size("auto",19),anchor:new OpenLayers.Bounds(0,32,22,null),position:new OpenLayers.Pixel(0,-631)},{size:new OpenLayers.Size(22,19),anchor:new OpenLayers.Bounds(null,32,0,null),position:new OpenLayers.Pixel(-638,-631)},{size:new OpenLayers.Size(81,35),anchor:new OpenLayers.Bounds(0,
0,null,null),position:new OpenLayers.Pixel(-215,-687)}]},bl:{offset:new OpenLayers.Pixel(45,0),padding:new OpenLayers.Bounds(8,9,8,40),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,21,22,32),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,21,0,32),position:new OpenLayers.Pixel(-638,0)},{size:new OpenLayers.Size("auto",21),anchor:new OpenLayers.Bounds(0,0,22,null),position:new OpenLayers.Pixel(0,-629)},{size:new OpenLayers.Size(22,
21),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(-638,-629)},{size:new OpenLayers.Size(81,33),anchor:new OpenLayers.Bounds(null,null,0,0),position:new OpenLayers.Pixel(-101,-674)}]},br:{offset:new OpenLayers.Pixel(-44,0),padding:new OpenLayers.Bounds(8,9,8,40),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,21,22,32),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,21,0,32),position:new OpenLayers.Pixel(-638,
0)},{size:new OpenLayers.Size("auto",21),anchor:new OpenLayers.Bounds(0,0,22,null),position:new OpenLayers.Pixel(0,-629)},{size:new OpenLayers.Size(22,21),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(-638,-629)},{size:new OpenLayers.Size(81,33),anchor:new OpenLayers.Bounds(0,null,null,0),position:new OpenLayers.Pixel(-311,-674)}]}},minSize:new OpenLayers.Size(105,10),maxSize:new OpenLayers.Size(600,660),initialize:function(){this.imageSrc=OpenLayers.Util.getImagesLocation()+
"cloud-popup-relative.png";OpenLayers.Popup.Framed.prototype.initialize.apply(this,arguments);this.contentDiv.className=this.contentDisplayClass},destroy:function(){OpenLayers.Popup.Framed.prototype.destroy.apply(this,arguments)},CLASS_NAME:"OpenLayers.Popup.FramedCloud"});
OpenLayers.Feature=OpenLayers.Class({layer:null,id:null,lonlat:null,data:null,marker:null,popupClass:OpenLayers.Popup.AnchoredBubble,popup:null,initialize:function(a,b,d){this.layer=a;this.lonlat=b;this.data=d!=null?d:{};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.data=this.lonlat=this.id=
this.layer=null;if(this.marker!=null){this.destroyMarker(this.marker);this.marker=null}if(this.popup!=null){this.destroyPopup(this.popup);this.popup=null}},onScreen:function(){var a=false;if(this.layer!=null&&this.layer.map!=null)a=this.layer.map.getExtent().containsLonLat(this.lonlat);return a},createMarker:function(){if(this.lonlat!=null)this.marker=new OpenLayers.Marker(this.lonlat,this.data.icon);return this.marker},destroyMarker:function(){this.marker.destroy()},createPopup:function(a){if(this.lonlat!=
null){var b=this.id+"_popup",d=this.marker?this.marker.icon:null;if(!this.popup)this.popup=new this.popupClass(b,this.lonlat,this.data.popupSize,this.data.popupContentHTML,d,a);if(this.data.overflow!=null)this.popup.contentDiv.style.overflow=this.data.overflow;this.popup.feature=this}return this.popup},destroyPopup:function(){if(this.popup){this.popup.feature=null;this.popup.destroy();this.popup=null}},CLASS_NAME:"OpenLayers.Feature"});
OpenLayers.State={UNKNOWN:"Unknown",INSERT:"Insert",UPDATE:"Update",DELETE:"Delete"};
OpenLayers.Feature.Vector=OpenLayers.Class(OpenLayers.Feature,{fid:null,geometry:null,attributes:null,bounds:null,state:null,style:null,url:null,renderIntent:"default",initialize:function(a,b,d){OpenLayers.Feature.prototype.initialize.apply(this,[null,null,b]);this.lonlat=null;this.geometry=a?a:null;this.state=null;this.attributes={};if(b)this.attributes=OpenLayers.Util.extend(this.attributes,b);this.style=d?d:null},destroy:function(){if(this.layer){this.layer.removeFeatures(this);this.layer=null}this.geometry=
null;OpenLayers.Feature.prototype.destroy.apply(this,arguments)},clone:function(){return new OpenLayers.Feature.Vector(this.geometry?this.geometry.clone():null,this.attributes,this.style)},onScreen:function(a){var b=false;if(this.layer&&this.layer.map){b=this.layer.map.getExtent();if(a){a=this.geometry.getBounds();b=b.intersectsBounds(a)}else b=b.toGeometry().intersects(this.geometry)}return b},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,d){var e=false;if(this.geometry)e=this.geometry.atPoint(a,b,d);return e},destroyPopup:function(){},move:function(a){if(this.layer&&this.geometry.move){a=a.CLASS_NAME=="OpenLayers.LonLat"?this.layer.getViewPortPxFromLonLat(a):a;var b=this.layer.getViewPortPxFromLonLat(this.geometry.getBounds().getCenterLonLat()),
d=this.layer.map.getResolution();this.geometry.move(d*(a.x-b.x),d*(b.y-a.y));this.layer.drawFeature(this);return b}},toState:function(a){if(a==OpenLayers.State.UPDATE)switch(this.state){case OpenLayers.State.UNKNOWN:case OpenLayers.State.DELETE:this.state=a;break;case OpenLayers.State.UPDATE:case OpenLayers.State.INSERT:break}else if(a==OpenLayers.State.INSERT)switch(this.state){case OpenLayers.State.UNKNOWN:break;default:this.state=a;break}else if(a==OpenLayers.State.DELETE)switch(this.state){case OpenLayers.State.INSERT:break;
case OpenLayers.State.DELETE:break;case OpenLayers.State.UNKNOWN:case OpenLayers.State.UPDATE:this.state=a;break}else if(a==OpenLayers.State.UNKNOWN)this.state=a},CLASS_NAME:"OpenLayers.Feature.Vector"});
OpenLayers.Feature.Vector.style={"default":{fillColor:"#ee9900",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#ee9900",strokeOpacity:1,strokeWidth:1,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},select:{fillColor:"blue",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"blue",strokeOpacity:1,
strokeWidth:2,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"pointer"},temporary:{fillColor:"#66cccc",fillOpacity:0.2,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#66cccc",strokeOpacity:1,strokeLinecap:"round",strokeWidth:2,strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,
hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},"delete":{display:"none"}};
OpenLayers.Handler=OpenLayers.Class({id:null,control:null,map:null,keyMask:null,active:false,evt:null,initialize:function(a,b,d){OpenLayers.Util.extend(this,d);this.control=a;this.callbacks=b;a.map&&this.setMap(a.map);OpenLayers.Util.extend(this,d);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},setMap:function(a){this.map=a},checkModifiers:function(a){if(this.keyMask==null)return true;return((a.shiftKey?OpenLayers.Handler.MOD_SHIFT:0)|(a.ctrlKey?OpenLayers.Handler.MOD_CTRL:0)|(a.altKey?
OpenLayers.Handler.MOD_ALT:0))==this.keyMask},activate:function(){if(this.active)return false;for(var a=OpenLayers.Events.prototype.BROWSER_EVENTS,b=0,d=a.length;b<d;b++)this[a[b]]&&this.register(a[b],this[a[b]]);return this.active=true},deactivate:function(){if(!this.active)return false;for(var a=OpenLayers.Events.prototype.BROWSER_EVENTS,b=0,d=a.length;b<d;b++)this[a[b]]&&this.unregister(a[b],this[a[b]]);this.active=false;return true},callback:function(a,b){a&&this.callbacks[a]&&this.callbacks[a].apply(this.control,
b)},register:function(a,b){this.map.events.registerPriority(a,this,b);this.map.events.registerPriority(a,this,this.setEvent)},unregister:function(a,b){this.map.events.unregister(a,this,b);this.map.events.unregister(a,this,this.setEvent)},setEvent:function(a){this.evt=a;return true},destroy:function(){this.deactivate();this.control=this.map=null},CLASS_NAME:"OpenLayers.Handler"});OpenLayers.Handler.MOD_NONE=0;OpenLayers.Handler.MOD_SHIFT=1;OpenLayers.Handler.MOD_CTRL=2;OpenLayers.Handler.MOD_ALT=4;
OpenLayers.Handler.Click=OpenLayers.Class(OpenLayers.Handler,{delay:300,single:true,"double":false,pixelTolerance:0,stopSingle:false,stopDouble:false,timerId:null,down:null,rightclickTimerId:null,initialize:function(){OpenLayers.Handler.prototype.initialize.apply(this,arguments);if(this.pixelTolerance!=null)this.mousedown=function(a){this.down=a.xy;return true}},mousedown:null,mouseup:function(a){var b=true;if(this.checkModifiers(a)&&this.control.handleRightClicks&&OpenLayers.Event.isRightClick(a))b=
this.rightclick(a);return b},rightclick:function(a){if(this.passesTolerance(a))if(this.rightclickTimerId!=null){this.clearTimer();this.callback("dblrightclick",[a]);return!this.stopDouble}else{a=this["double"]?OpenLayers.Util.extend({},a):this.callback("rightclick",[a]);a=OpenLayers.Function.bind(this.delayedRightCall,this,a);this.rightclickTimerId=window.setTimeout(a,this.delay)}return!this.stopSingle},delayedRightCall:function(a){this.rightclickTimerId=null;a&&this.callback("rightclick",[a]);return!this.stopSingle},
dblclick:function(a){if(this.passesTolerance(a)){this["double"]&&this.callback("dblclick",[a]);this.clearTimer()}return!this.stopDouble},click:function(a){if(this.passesTolerance(a))if(this.timerId!=null)this.clearTimer();else{a=this.single?OpenLayers.Util.extend({},a):null;this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,a),this.delay)}return!this.stopSingle},passesTolerance:function(a){var b=true;if(this.pixelTolerance!=null&&this.down)if(Math.sqrt(Math.pow(this.down.x-
a.xy.x,2)+Math.pow(this.down.y-a.xy.y,2))>this.pixelTolerance)b=false;return b},clearTimer:function(){if(this.timerId!=null){window.clearTimeout(this.timerId);this.timerId=null}if(this.rightclickTimerId!=null){window.clearTimeout(this.rightclickTimerId);this.rightclickTimerId=null}},delayedCall:function(a){this.timerId=null;a&&this.callback("click",[a])},deactivate:function(){var a=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.clearTimer();this.down=null;a=true}return a},
CLASS_NAME:"OpenLayers.Handler.Click"});
OpenLayers.Handler.Feature=OpenLayers.Class(OpenLayers.Handler,{EVENTMAP:{click:{"in":"click",out:"clickout"},mousemove:{"in":"over",out:"out"},dblclick:{"in":"dblclick",out:null},mousedown:{"in":null,out:null},mouseup:{"in":null,out:null}},feature:null,lastFeature:null,down:null,up:null,clickTolerance:4,geometryTypes:null,stopClick:true,stopDown:true,stopUp:false,initialize:function(a,b,d,e){OpenLayers.Handler.prototype.initialize.apply(this,[a,d,e]);this.layer=b},mousedown:function(a){this.down=
a.xy;return this.handle(a)?!this.stopDown:true},mouseup:function(a){this.up=a.xy;return this.handle(a)?!this.stopUp:true},click:function(a){return this.handle(a)?!this.stopClick:true},mousemove:function(a){if(!this.callbacks.over&&!this.callbacks.out)return true;this.handle(a);return true},dblclick:function(a){return!this.handle(a)},geometryTypeMatches:function(a){return this.geometryTypes==null||OpenLayers.Util.indexOf(this.geometryTypes,a.geometry.CLASS_NAME)>-1},handle:function(a){if(this.feature&&
!this.feature.layer)this.feature=null;var b=a.type,d=false,e=!!this.feature,f=b=="click"||b=="dblclick";if((this.feature=this.layer.getFeatureFromEvent(a))&&!this.feature.layer)this.feature=null;if(this.lastFeature&&!this.lastFeature.layer)this.lastFeature=null;if(this.feature){a=this.feature!=this.lastFeature;if(this.geometryTypeMatches(this.feature)){if(e&&a){this.lastFeature&&this.triggerCallback(b,"out",[this.lastFeature]);this.triggerCallback(b,"in",[this.feature])}else if(!e||f)this.triggerCallback(b,
"in",[this.feature]);this.lastFeature=this.feature;d=true}else{if(this.lastFeature&&(e&&a||f))this.triggerCallback(b,"out",[this.lastFeature]);this.feature=null}}else if(this.lastFeature&&(e||f))this.triggerCallback(b,"out",[this.lastFeature]);return d},triggerCallback:function(a,b,d){if(b=this.EVENTMAP[a][b])if(a=="click"&&this.up&&this.down)Math.sqrt(Math.pow(this.up.x-this.down.x,2)+Math.pow(this.up.y-this.down.y,2))<=this.clickTolerance&&this.callback(b,d);else this.callback(b,d)},activate:function(){var a=
false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.moveLayerToTop();this.map.events.on({removelayer:this.handleMapEvents,changelayer:this.handleMapEvents,scope:this});a=true}return a},deactivate:function(){var a=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.moveLayerBack();this.up=this.down=this.lastFeature=this.feature=null;this.map.events.un({removelayer:this.handleMapEvents,changelayer:this.handleMapEvents,scope:this});a=true}return a},handleMapEvents:function(a){if(!a.property||
a.property=="order")this.moveLayerToTop()},moveLayerToTop:function(){this.layer.setZIndex(Math.max(this.map.Z_INDEX_BASE.Feature-1,this.layer.getZIndex())+1)},moveLayerBack:function(){var a=this.layer.getZIndex()-1;a>=this.map.Z_INDEX_BASE.Feature?this.layer.setZIndex(a):this.map.setLayerZIndex(this.layer,this.map.getLayerIndex(this.layer))},CLASS_NAME:"OpenLayers.Handler.Feature"});
OpenLayers.Handler.Drag=OpenLayers.Class(OpenLayers.Handler,{started:false,stopDown:true,dragging:false,last:null,start:null,oldOnselectstart:null,interval:0,timeoutId:null,documentDrag:false,documentEvents:null,initialize:function(){OpenLayers.Handler.prototype.initialize.apply(this,arguments)},down:function(){},move:function(){},up:function(){},out:function(){},mousedown:function(a){var b=true;this.dragging=false;if(this.checkModifiers(a)&&OpenLayers.Event.isLeftClick(a)){this.started=true;this.last=
this.start=a.xy;OpenLayers.Element.addClass(this.map.viewPortDiv,"olDragDown");this.down(a);this.callback("down",[a.xy]);OpenLayers.Event.stop(a);if(!this.oldOnselectstart){this.oldOnselectstart=document.onselectstart?document.onselectstart:OpenLayers.Function.True;document.onselectstart=OpenLayers.Function.False}b=!this.stopDown}else{this.started=false;this.last=this.start=null}return b},mousemove:function(a){if(this.started&&!this.timeoutId&&(a.xy.x!=this.last.x||a.xy.y!=this.last.y)){if(this.documentDrag===
true&&this.documentEvents)if(a.element===document){this.adjustXY(a);this.setEvent(a)}else this.destroyDocumentEvents();if(this.interval>0)this.timeoutId=setTimeout(OpenLayers.Function.bind(this.removeTimeout,this),this.interval);this.dragging=true;this.move(a);this.callback("move",[a.xy]);if(!this.oldOnselectstart){this.oldOnselectstart=document.onselectstart;document.onselectstart=OpenLayers.Function.False}this.last=this.evt.xy}return true},removeTimeout:function(){this.timeoutId=null},mouseup:function(a){if(this.started){if(this.documentDrag===
true&&this.documentEvents){this.adjustXY(a);this.destroyDocumentEvents()}var b=this.start!=this.last;this.dragging=this.started=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.up(a);this.callback("up",[a.xy]);b&&this.callback("done",[a.xy]);document.onselectstart=this.oldOnselectstart}return true},mouseout:function(a){if(this.started&&OpenLayers.Util.mouseLeft(a,this.map.div))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 b=this.start!=this.last;this.dragging=this.started=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.out(a);this.callback("out",[]);b&&this.callback("done",[a.xy]);if(document.onselectstart)document.onselectstart=this.oldOnselectstart}return true},click:function(){return this.start==this.last},activate:function(){var a=
false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragging=false;a=true}return a},deactivate:function(){var a=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.dragging=this.started=false;this.last=this.start=null;a=true;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown")}return a},adjustXY:function(a){var b=OpenLayers.Util.pagePosition(this.map.div);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.Box=OpenLayers.Class(OpenLayers.Handler,{dragHandler:null,boxDivClassName:"olHandlerBoxZoomBox",boxCharacteristics:null,initialize:function(a,b){OpenLayers.Handler.prototype.initialize.apply(this,arguments);b={down:this.startBox,move:this.moveBox,out:this.removeBox,up:this.endBox};this.dragHandler=new OpenLayers.Handler.Drag(this,b,{keyMask:this.keyMask})},setMap:function(a){OpenLayers.Handler.prototype.setMap.apply(this,arguments);this.dragHandler&&this.dragHandler.setMap(a)},
startBox:function(){this.zoomBox=OpenLayers.Util.createDiv("zoomBox",this.dragHandler.start);this.zoomBox.className=this.boxDivClassName;this.zoomBox.style.zIndex=this.map.Z_INDEX_BASE.Popup-1;this.map.viewPortDiv.appendChild(this.zoomBox);OpenLayers.Element.addClass(this.map.viewPortDiv,"olDrawBox")},moveBox:function(a){var b=this.dragHandler.start.x,d=this.dragHandler.start.y,e=Math.abs(b-a.x),f=Math.abs(d-a.y);this.zoomBox.style.width=Math.max(1,e)+"px";this.zoomBox.style.height=Math.max(1,f)+
"px";this.zoomBox.style.left=a.x<b?a.x+"px":b+"px";this.zoomBox.style.top=a.y<d?a.y+"px":d+"px";var g=this.getBoxCharacteristics();if(g.newBoxModel){if(a.x>b)this.zoomBox.style.width=Math.max(1,e-g.xOffset)+"px";if(a.y>d)this.zoomBox.style.height=Math.max(1,f-g.yOffset)+"px"}},endBox:function(a){if(Math.abs(this.dragHandler.start.x-a.x)>5||Math.abs(this.dragHandler.start.y-a.y)>5){var b=this.dragHandler.start,d=Math.min(b.y,a.y),e=Math.max(b.y,a.y);a=new OpenLayers.Bounds(Math.min(b.x,a.x),e,Math.max(b.x,
a.x),d)}else a=this.dragHandler.start.clone();this.removeBox();this.callback("done",[a])},removeBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox);this.boxCharacteristics=this.zoomBox=null;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDrawBox")},activate:function(){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragHandler.activate();return true}else return false},deactivate:function(){if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.dragHandler.deactivate();
return true}else return false},getBoxCharacteristics:function(){if(!this.boxCharacteristics){var a=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-left-width"))+parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-right-width"))+1,b=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-top-width"))+parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-bottom-width"))+1,d=OpenLayers.Util.getBrowserName()=="msie"?document.compatMode!="BackCompat":true;this.boxCharacteristics=
{xOffset:a,yOffset:b,newBoxModel:d}}return this.boxCharacteristics},CLASS_NAME:"OpenLayers.Handler.Box"});
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(a){this.displayClass=this.CLASS_NAME.replace("OpenLayers.","ol").replace(/\./g,"");OpenLayers.Util.extend(this,a);this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES);this.eventListeners instanceof Object&&this.events.on(this.eventListeners);
if(this.id==null)this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){if(this.events){this.eventListeners&&this.events.un(this.eventListeners);this.events.destroy();this.events=null}this.eventListeners=null;if(this.handler){this.handler.destroy();this.handler=null}if(this.handlers){for(var a in this.handlers)this.handlers.hasOwnProperty(a)&&typeof this.handlers[a].destroy=="function"&&this.handlers[a].destroy();this.handlers=null}if(this.map){this.map.removeControl(this);
this.map=null}},setMap:function(a){this.map=a;this.handler&&this.handler.setMap(a)},draw:function(a){if(this.div==null){this.div=OpenLayers.Util.createDiv(this.id);this.div.className=this.displayClass;if(!this.allowSelection){this.div.className+=" olControlNoSelect";this.div.setAttribute("unselectable","on",0);this.div.onselectstart=OpenLayers.Function.False}if(this.title!="")this.div.title=this.title}if(a!=null)this.position=a.clone();this.moveTo(this.position);return this.div},moveTo:function(a){if(a!=
null&&this.div!=null){this.div.style.left=a.x+"px";this.div.style.top=a.y+"px"}},activate:function(){if(this.active)return false;this.handler&&this.handler.activate();this.active=true;this.map&&OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active");this.events.triggerEvent("activate");return true},deactivate:function(){if(this.active){this.handler&&this.handler.deactivate();this.active=false;this.map&&OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,
"")+"Active");this.events.triggerEvent("deactivate");return true}return false},CLASS_NAME:"OpenLayers.Control"});OpenLayers.Control.TYPE_BUTTON=1;OpenLayers.Control.TYPE_TOGGLE=2;OpenLayers.Control.TYPE_TOOL=3;
OpenLayers.Control.ZoomBox=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,out:false,alwaysZoom:false,draw:function(){this.handler=new OpenLayers.Handler.Box(this,{done:this.zoomBox},{keyMask:this.keyMask})},zoomBox:function(a){if(a instanceof OpenLayers.Bounds){var b;if(this.out){b=Math.abs(a.right-a.left);b=Math.min(this.map.size.h/Math.abs(a.top-a.bottom),this.map.size.w/b);var d=this.map.getExtent(),e=this.map.getLonLatFromPixel(a.getCenterPixel());a=e.lon-d.getWidth()/
2*b;var f=e.lon+d.getWidth()/2*b,g=e.lat-d.getHeight()/2*b;b=e.lat+d.getHeight()/2*b;b=new OpenLayers.Bounds(a,g,f,b)}else{b=this.map.getLonLatFromPixel(new OpenLayers.Pixel(a.left,a.bottom));d=this.map.getLonLatFromPixel(new OpenLayers.Pixel(a.right,a.top));b=new OpenLayers.Bounds(b.lon,b.lat,d.lon,d.lat)}d=this.map.getZoom();this.map.zoomToExtent(b);if(d==this.map.getZoom()&&this.alwaysZoom==true)this.map.zoomTo(d+(this.out?-1:1))}else this.out?this.map.setCenter(this.map.getLonLatFromPixel(a),
this.map.getZoom()-1):this.map.setCenter(this.map.getLonLatFromPixel(a),this.map.getZoom()+1)},CLASS_NAME:"OpenLayers.Control.ZoomBox"});
OpenLayers.Control.MouseDefaults=OpenLayers.Class(OpenLayers.Control,{performedDrag:false,wheelObserver:null,initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.handler&&this.handler.destroy();this.handler=null;this.map.events.un({click:this.defaultClick,dblclick:this.defaultDblClick,mousedown:this.defaultMouseDown,mouseup:this.defaultMouseUp,mousemove:this.defaultMouseMove,mouseout:this.defaultMouseOut,scope:this});OpenLayers.Event.stopObserving(window,
"DOMMouseScroll",this.wheelObserver);OpenLayers.Event.stopObserving(window,"mousewheel",this.wheelObserver);OpenLayers.Event.stopObserving(document,"mousewheel",this.wheelObserver);this.wheelObserver=null;OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(){this.map.events.on({click:this.defaultClick,dblclick:this.defaultDblClick,mousedown:this.defaultMouseDown,mouseup:this.defaultMouseUp,mousemove:this.defaultMouseMove,mouseout:this.defaultMouseOut,scope:this});this.registerWheelEvents()},
registerWheelEvents:function(){this.wheelObserver=OpenLayers.Function.bindAsEventListener(this.onWheelEvent,this);OpenLayers.Event.observe(window,"DOMMouseScroll",this.wheelObserver);OpenLayers.Event.observe(window,"mousewheel",this.wheelObserver);OpenLayers.Event.observe(document,"mousewheel",this.wheelObserver)},defaultClick:function(a){if(OpenLayers.Event.isLeftClick(a)){a=!this.performedDrag;this.performedDrag=false;return a}},defaultDblClick:function(a){this.map.setCenter(this.map.getLonLatFromViewPortPx(a.xy),
this.map.zoom+1);OpenLayers.Event.stop(a);return false},defaultMouseDown:function(a){if(OpenLayers.Event.isLeftClick(a)){this.mouseDragStart=a.xy.clone();this.performedDrag=false;if(a.shiftKey){this.map.div.style.cursor="crosshair";this.zoomBox=OpenLayers.Util.createDiv("zoomBox",this.mouseDragStart,null,null,"absolute","2px solid red");this.zoomBox.style.backgroundColor="white";this.zoomBox.style.filter="alpha(opacity=50)";this.zoomBox.style.opacity="0.50";this.zoomBox.style.fontSize="1px";this.zoomBox.style.zIndex=
this.map.Z_INDEX_BASE.Popup-1;this.map.viewPortDiv.appendChild(this.zoomBox)}document.onselectstart=OpenLayers.Function.False;OpenLayers.Event.stop(a)}},defaultMouseMove:function(a){this.mousePosition=a.xy.clone();if(this.mouseDragStart!=null){if(this.zoomBox){var b=Math.abs(this.mouseDragStart.x-a.xy.x),d=Math.abs(this.mouseDragStart.y-a.xy.y);this.zoomBox.style.width=Math.max(1,b)+"px";this.zoomBox.style.height=Math.max(1,d)+"px";if(a.xy.x<this.mouseDragStart.x)this.zoomBox.style.left=a.xy.x+"px";
if(a.xy.y<this.mouseDragStart.y)this.zoomBox.style.top=a.xy.y+"px"}else{b=this.mouseDragStart.x-a.xy.x;d=this.mouseDragStart.y-a.xy.y;var e=this.map.getSize();this.map.setCenter(this.map.getLonLatFromViewPortPx(new OpenLayers.Pixel(e.w/2+b,e.h/2+d)),null,true);this.mouseDragStart=a.xy.clone();this.map.div.style.cursor="move"}this.performedDrag=true}},defaultMouseUp:function(a){if(OpenLayers.Event.isLeftClick(a)){if(this.zoomBox)this.zoomBoxEnd(a);else this.performedDrag&&this.map.setCenter(this.map.center);
this.mouseDragStart=document.onselectstart=null;this.map.div.style.cursor=""}},defaultMouseOut:function(a){if(this.mouseDragStart!=null&&OpenLayers.Util.mouseLeft(a,this.map.div)){this.zoomBox&&this.removeZoomBox();this.mouseDragStart=null}},defaultWheelUp:function(a){this.map.getZoom()<=this.map.getNumZoomLevels()&&this.map.setCenter(this.map.getLonLatFromPixel(a.xy),this.map.getZoom()+1)},defaultWheelDown:function(a){this.map.getZoom()>0&&this.map.setCenter(this.map.getLonLatFromPixel(a.xy),this.map.getZoom()-
1)},zoomBoxEnd:function(a){if(this.mouseDragStart!=null){if(Math.abs(this.mouseDragStart.x-a.xy.x)>5||Math.abs(this.mouseDragStart.y-a.xy.y)>5){var b=this.map.getLonLatFromViewPortPx(this.mouseDragStart);a=this.map.getLonLatFromViewPortPx(a.xy);var d=Math.max(b.lat,a.lat),e=Math.min(b.lat,a.lat);this.map.zoomToExtent(new OpenLayers.Bounds(Math.min(b.lon,a.lon),e,Math.max(b.lon,a.lon),d))}else{a=this.map.getLonLatFromViewPortPx(a.xy);this.map.setCenter(new OpenLayers.LonLat(a.lon,a.lat),this.map.getZoom()+
1)}this.removeZoomBox()}},removeZoomBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox);this.zoomBox=null},onWheelEvent:function(a){for(var b=false,d=OpenLayers.Event.element(a);d!=null;){if(this.map&&d==this.map.div){b=true;break}d=d.parentNode}if(b){b=0;if(!a)a=window.event;if(a.wheelDelta){b=a.wheelDelta/120;if(window.opera&&window.opera.version()<9.2)b=-b}else if(a.detail)b=-a.detail/3;if(b){a.xy=this.mousePosition;b<0?this.defaultWheelDown(a):this.defaultWheelUp(a)}OpenLayers.Event.stop(a)}},
CLASS_NAME:"OpenLayers.Control.MouseDefaults"});
OpenLayers.Control.MousePosition=OpenLayers.Class(OpenLayers.Control,{element:null,prefix:"",separator:", ",suffix:"",numDigits:5,granularity:10,emptyString:null,lastXy:null,displayProjection:null,initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.map&&this.map.events.unregister("mousemove",this,this.redraw);OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.div.left=
"";this.div.top="";this.element=this.div}this.redraw();return this.div},redraw:function(a){var b;if(a==null)this.reset();else if(this.lastXy==null||Math.abs(a.xy.x-this.lastXy.x)>this.granularity||Math.abs(a.xy.y-this.lastXy.y)>this.granularity)this.lastXy=a.xy;else if(b=this.map.getLonLatFromPixel(a.xy)){this.displayProjection&&b.transform(this.map.getProjectionObject(),this.displayProjection);this.lastXy=a.xy;a=this.formatOutput(b);if(a!=this.element.innerHTML)this.element.innerHTML=a}},reset:function(){if(this.emptyString!=
null)this.element.innerHTML=this.emptyString},formatOutput:function(a){var b=parseInt(this.numDigits);return this.prefix+a.lon.toFixed(b)+this.separator+a.lat.toFixed(b)+this.suffix},setMap:function(){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.map.events.register("mousemove",this,this.redraw);this.map.events.register("mouseout",this,this.reset)},CLASS_NAME:"OpenLayers.Control.MousePosition"});
OpenLayers.Control.Panel=OpenLayers.Class(OpenLayers.Control,{controls:null,autoActivate:true,defaultControl:null,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,[a]);this.controls=[]},destroy:function(){OpenLayers.Control.prototype.destroy.apply(this,arguments);for(var a=this.controls.length-1;a>=0;a--){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}},activate:function(){if(OpenLayers.Control.prototype.activate.apply(this,arguments)){for(var a=0,b=this.controls.length;a<b;a++)this.controls[a]==this.defaultControl&&this.controls[a].activate();this.redraw();return true}else return false},deactivate:function(){if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)){for(var a=0,b=this.controls.length;a<b;a++)this.controls[a].deactivate();return true}else return false},draw:function(){OpenLayers.Control.prototype.draw.apply(this,
arguments);for(var a=0,b=this.controls.length;a<b;a++){this.map.addControl(this.controls[a]);this.controls[a].deactivate();this.controls[a].events.on({activate:this.redraw,deactivate:this.redraw,scope:this})}return this.div},redraw:function(){this.div.innerHTML="";if(this.active)for(var a=0,b=this.controls.length;a<b;a++){var d=this.controls[a].panel_div;d.className=this.controls[a].active?this.controls[a].displayClass+"ItemActive":this.controls[a].displayClass+"ItemInactive";this.div.appendChild(d)}},
activateControl:function(a){if(!this.active)return false;if(a.type==OpenLayers.Control.TYPE_BUTTON){a.trigger();this.redraw()}else if(a.type==OpenLayers.Control.TYPE_TOGGLE){a.active?a.deactivate():a.activate();this.redraw()}else{for(var b=0,d=this.controls.length;b<d;b++)this.controls[b]!=a&&this.controls[b].type!=OpenLayers.Control.TYPE_TOGGLE&&this.controls[b].deactivate();a.activate()}},addControls:function(a){a instanceof Array||(a=[a]);this.controls=this.controls.concat(a);for(var b=0,d=a.length;b<
d;b++){var e=document.createElement("div");a[b].panel_div=e;if(a[b].title!="")a[b].panel_div.title=a[b].title;OpenLayers.Event.observe(a[b].panel_div,"click",OpenLayers.Function.bind(this.onClick,this,a[b]));OpenLayers.Event.observe(a[b].panel_div,"dblclick",OpenLayers.Function.bind(this.onDoubleClick,this,a[b]));OpenLayers.Event.observe(a[b].panel_div,"mousedown",OpenLayers.Function.bindAsEventListener(OpenLayers.Event.stop))}if(this.map){b=0;for(d=a.length;b<d;b++){this.map.addControl(a[b]);a[b].deactivate();
a[b].events.on({activate:this.redraw,deactivate:this.redraw,scope:this})}this.redraw()}},onClick:function(a,b){OpenLayers.Event.stop(b?b:window.event);this.activateControl(a)},onDoubleClick:function(a,b){OpenLayers.Event.stop(b?b:window.event)},getControlsBy:function(a,b){var d=typeof b.test=="function";return OpenLayers.Array.filter(this.controls,function(e){return e[a]==b||d&&b.test(e[a])})},getControlsByName:function(a){return this.getControlsBy("name",a)},getControlsByClass:function(a){return this.getControlsBy("CLASS_NAME",
a)},CLASS_NAME:"OpenLayers.Control.Panel"});
OpenLayers.Control.SelectFeature=OpenLayers.Class(OpenLayers.Control,{EVENT_TYPES:["beforefeaturehighlighted","featurehighlighted","featureunhighlighted"],multipleKey:null,toggleKey:null,multiple:false,clickout:true,toggle:false,hover:false,highlightOnly:false,box:false,onBeforeSelect:function(){},onSelect:function(){},onUnselect:function(){},scope:null,geometryTypes:null,layer:null,layers:null,callbacks:null,selectStyle:null,renderIntent:"select",handlers:null,initialize:function(a,b){this.EVENT_TYPES=
OpenLayers.Control.SelectFeature.prototype.EVENT_TYPES.concat(OpenLayers.Control.prototype.EVENT_TYPES);OpenLayers.Control.prototype.initialize.apply(this,[b]);if(this.scope===null)this.scope=this;this.initLayer(a);var d={click:this.clickFeature,clickout:this.clickoutFeature};if(this.hover){d.over=this.overFeature;d.out=this.outFeature}this.callbacks=OpenLayers.Util.extend(d,this.callbacks);this.handlers={feature:new OpenLayers.Handler.Feature(this,this.layer,this.callbacks,{geometryTypes:this.geometryTypes})};
if(this.box)this.handlers.box=new OpenLayers.Handler.Box(this,{done:this.selectBox},{boxDivClassName:"olHandlerBoxSelectFeature"})},initLayer:function(a){if(a instanceof Array){this.layers=a;this.layer=new OpenLayers.Layer.Vector.RootContainer(this.id+"_container",{layers:a})}else this.layer=a},destroy:function(){this.active&&this.layers&&this.map.removeLayer(this.layer);OpenLayers.Control.prototype.destroy.apply(this,arguments);this.layers&&this.layer.destroy()},activate:function(){if(!this.active){this.layers&&
this.map.addLayer(this.layer);this.handlers.feature.activate();this.box&&this.handlers.box&&this.handlers.box.activate()}return OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){if(this.active){this.handlers.feature.deactivate();this.handlers.box&&this.handlers.box.deactivate();this.layers&&this.map.removeLayer(this.layer)}return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},unselectAll:function(a){for(var b=this.layers||[this.layer],d,e,f=0;f<b.length;++f){d=
b[f];for(var g=d.selectedFeatures.length-1;g>=0;--g){e=d.selectedFeatures[g];if(!a||a.except!=e)this.unselect(e)}}},clickFeature:function(a){if(!this.hover)if(OpenLayers.Util.indexOf(a.layer.selectedFeatures,a)>-1)if(this.toggleSelect())this.unselect(a);else this.multipleSelect()||this.unselectAll({except:a});else{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(){!this.hover&&this.clickout&&this.unselectAll()},overFeature:function(a){var b=a.layer;if(this.hover)if(this.highlightOnly)this.highlight(a);else 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;if(this.events.triggerEvent("beforefeaturehighlighted",{feature:a})!==false){a._prevHighlighter=a._lastHighlighter;a._lastHighlighter=this.id;b.drawFeature(a,this.selectStyle||this.renderIntent);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),d=a.layer;if(b!==false){b=d.events.triggerEvent("beforefeatureselected",{feature:a});if(b!==false){d.selectedFeatures.push(a);this.highlight(a);if(!this.handlers.feature.lastFeature)this.handlers.feature.lastFeature=d.selectedFeatures[0];d.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));a=this.map.getLonLatFromPixel(new OpenLayers.Pixel(a.right,a.top));b=new OpenLayers.Bounds(b.lon,b.lat,a.lon,a.lat);this.multipleSelect()||this.unselectAll();a=this.multiple;this.multiple=
true;for(var d=this.layers||[this.layer],e,f=0;f<d.length;++f){e=d[f];for(var g=0,h=e.features.length;g<h;++g){var j=e.features[g];if(j.getVisibility())if(this.geometryTypes==null||OpenLayers.Util.indexOf(this.geometryTypes,j.geometry.CLASS_NAME)>-1)b.toGeometry().intersects(j.geometry)&&OpenLayers.Util.indexOf(e.selectedFeatures,j)==-1&&this.select(j)}}this.multiple=a}},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();if(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=OpenLayers.Class({id:null,parent:null,bounds:null,initialize:function(){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){this.bounds=this.id=null},clone:function(){return new OpenLayers.Geometry},setBounds:function(a){if(a)this.bounds=a.clone()},clearBounds:function(){this.bounds=null;this.parent&&this.parent.clearBounds()},extendBounds:function(a){this.getBounds()?this.bounds.extend(a):this.setBounds(a)},getBounds:function(){this.bounds==null&&this.calculateBounds();
return this.bounds},calculateBounds:function(){},distanceTo:function(){},getVertices:function(){},atPoint:function(a,b,d){var e=false;if(this.getBounds()!=null&&a!=null){b=b!=null?b:0;d=d!=null?d:0;e=(new OpenLayers.Bounds(this.bounds.left-b,this.bounds.bottom-d,this.bounds.right+b,this.bounds.top+d)).containsLonLat(a)}return e},getLength:function(){return 0},getArea:function(){return 0},getCentroid:function(){return null},toString:function(){return OpenLayers.Format.WKT.prototype.write(new OpenLayers.Feature.Vector(this))},
CLASS_NAME:"OpenLayers.Geometry"});OpenLayers.Geometry.fromWKT=function(a){var b=arguments.callee.format;if(!b){b=new OpenLayers.Format.WKT;arguments.callee.format=b}var d;b=b.read(a);if(b instanceof OpenLayers.Feature.Vector)d=b.geometry;else if(b instanceof Array){d=b.length;for(var e=new Array(d),f=0;f<d;++f)e[f]=b[f].geometry;d=new OpenLayers.Geometry.Collection(e)}return d};
OpenLayers.Geometry.segmentsIntersect=function(a,b,d){var e=d&&d.point;d=d&&d.tolerance;var f=false,g=a.x1-b.x1,h=a.y1-b.y1,j=a.x2-a.x1,l=a.y2-a.y1,m=b.y2-b.y1,o=b.x2-b.x1,p=m*j-o*l;m=o*h-m*g;h=j*h-l*g;if(p==0){if(m==0&&h==0)f=true}else{g=m/p;p=h/p;if(g>=0&&g<=1&&p>=0&&p<=1)if(e){j=a.x1+g*j;p=a.y1+g*l;f=new OpenLayers.Geometry.Point(j,p)}else f=true}if(d)if(f){if(e){a=[a,b];b=0;a:for(;b<2;++b){g=a[b];for(l=1;l<3;++l){j=g["x"+l];p=g["y"+l];e=Math.sqrt(Math.pow(j-f.x,2)+Math.pow(p-f.y,2));if(e<d){f.x=
j;f.y=p;break a}}}}}else{a=[a,b];b=0;a:for(;b<2;++b){j=a[b];p=a[(b+1)%2];for(l=1;l<3;++l){g={x:j["x"+l],y:j["y"+l]};h=OpenLayers.Geometry.distanceToSegment(g,p);if(h.distance<d){f=e?new OpenLayers.Geometry.Point(g.x,g.y):true;break a}}}}return f};
OpenLayers.Geometry.distanceToSegment=function(a,b){var d=a.x,e=a.y,f=b.x1,g=b.y1,h=b.x2,j=b.y2,l=h-f,m=j-g,o=(l*(d-f)+m*(e-g))/(Math.pow(l,2)+Math.pow(m,2));if(o<=0){f=f;g=g}else if(o>=1){f=h;g=j}else{f=f+o*l;g=g+o*m}return{distance:Math.sqrt(Math.pow(f-d,2)+Math.pow(g-e,2)),x:f,y:g}};
OpenLayers.Geometry.Rectangle=OpenLayers.Class(OpenLayers.Geometry,{x:null,y:null,width:null,height:null,initialize:function(a,b,d,e){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.x=a;this.y=b;this.width=d;this.height=e},calculateBounds:function(){this.bounds=new OpenLayers.Bounds(this.x,this.y,this.x+this.width,this.y+this.height)},getLength:function(){return 2*this.width+2*this.height},getArea:function(){return this.width*this.height},CLASS_NAME:"OpenLayers.Geometry.Rectangle"});
OpenLayers.Geometry.Collection=OpenLayers.Class(OpenLayers.Geometry,{components:null,componentTypes:null,initialize:function(a){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.components=[];a!=null&&this.addComponents(a)},destroy:function(){this.components.length=0;this.components=null},clone:function(){for(var a=eval("new "+this.CLASS_NAME+"()"),b=0,d=this.components.length;b<d;b++)a.addComponent(this.components[b].clone());OpenLayers.Util.applyDefaults(a,this);return a},getComponentsString:function(){for(var a=
[],b=0,d=this.components.length;b<d;b++)a.push(this.components[b].toShortString());return a.join(",")},calculateBounds:function(){this.bounds=null;if(this.components&&this.components.length>0){this.setBounds(this.components[0].getBounds());for(var a=1,b=this.components.length;a<b;a++)this.extendBounds(this.components[a].getBounds())}},addComponents:function(a){a instanceof Array||(a=[a]);for(var b=0,d=a.length;b<d;b++)this.addComponent(a[b])},addComponent:function(a,b){var d=false;if(a)if(this.componentTypes==
null||OpenLayers.Util.indexOf(this.componentTypes,a.CLASS_NAME)>-1){if(b!=null&&b<this.components.length){d=this.components.slice(0,b);var e=this.components.slice(b,this.components.length);d.push(a);this.components=d.concat(e)}else this.components.push(a);a.parent=this;this.clearBounds();d=true}return d},removeComponents:function(a){a instanceof Array||(a=[a]);for(var b=a.length-1;b>=0;--b)this.removeComponent(a[b])},removeComponent:function(a){OpenLayers.Util.removeItem(this.components,a);this.clearBounds()},
getLength:function(){for(var a=0,b=0,d=this.components.length;b<d;b++)a+=this.components[b].getLength();return a},getArea:function(){for(var a=0,b=0,d=this.components.length;b<d;b++)a+=this.components[b].getArea();return a},getGeodesicArea:function(a){for(var b=0,d=0,e=this.components.length;d<e;d++)b+=this.components[d].getGeodesicArea(a);return b},getCentroid:function(){return this.components.length&&this.components[0].getCentroid()},getGeodesicLength:function(a){for(var b=0,d=0,e=this.components.length;d<
e;d++)b+=this.components[d].getGeodesicLength(a);return b},move:function(a,b){for(var d=0,e=this.components.length;d<e;d++)this.components[d].move(a,b)},rotate:function(a,b){for(var d=0,e=this.components.length;d<e;++d)this.components[d].rotate(a,b)},resize:function(a,b,d){for(var e=0;e<this.components.length;++e)this.components[e].resize(a,b,d);return this},distanceTo:function(a,b){for(var d=!(b&&b.edge===false)&&b&&b.details,e,f,g,h=Number.POSITIVE_INFINITY,j=0,l=this.components.length;j<l;++j){e=
this.components[j].distanceTo(a,b);g=d?e.distance:e;if(g<h){h=g;f=e;if(h==0)break}}return f},equals:function(a){var b=true;if(!a||!a.CLASS_NAME||this.CLASS_NAME!=a.CLASS_NAME)b=false;else if(!(a.components instanceof Array)||a.components.length!=this.components.length)b=false;else for(var d=0,e=this.components.length;d<e;++d)if(!this.components[d].equals(a.components[d])){b=false;break}return b},transform:function(a,b){if(a&&b){for(var d=0,e=this.components.length;d<e;d++)this.components[d].transform(a,
b);this.bounds=null}return this},intersects:function(a){for(var b=false,d=0,e=this.components.length;d<e;++d)if(b=a.intersects(this.components[d]))break;return b},getVertices:function(a){for(var b=[],d=0,e=this.components.length;d<e;++d)Array.prototype.push.apply(b,this.components[d].getVertices(a));return b},CLASS_NAME:"OpenLayers.Geometry.Collection"});
OpenLayers.Geometry.Point=OpenLayers.Class(OpenLayers.Geometry,{x:null,y:null,initialize:function(a,b){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.x=parseFloat(a);this.y=parseFloat(b)},clone:function(a){if(a==null)a=new OpenLayers.Geometry.Point(this.x,this.y);OpenLayers.Util.applyDefaults(a,this);return a},calculateBounds:function(){this.bounds=new OpenLayers.Bounds(this.x,this.y,this.x,this.y)},distanceTo:function(a,b){var d=!(b&&b.edge===false)&&b&&b.details,e,f,g,h,j;if(a instanceof
OpenLayers.Geometry.Point){f=this.x;g=this.y;h=a.x;j=a.y;e=Math.sqrt(Math.pow(f-h,2)+Math.pow(g-j,2));e=!d?e:{x0:f,y0:g,x1:h,y1:j,distance:e}}else{e=a.distanceTo(this,b);if(d)e={x0:e.x1,y0:e.y1,x1:e.x0,y1:e.y0,distance:e.distance}}return e},equals:function(a){var b=false;if(a!=null)b=this.x==a.x&&this.y==a.y||isNaN(this.x)&&isNaN(this.y)&&isNaN(a.x)&&isNaN(a.y);return b},toShortString:function(){return this.x+", "+this.y},move:function(a,b){this.x+=a;this.y+=b;this.clearBounds()},rotate:function(a,
b){a*=Math.PI/180;var d=this.distanceTo(b),e=a+Math.atan2(this.y-b.y,this.x-b.x);this.x=b.x+d*Math.cos(e);this.y=b.y+d*Math.sin(e);this.clearBounds()},getCentroid:function(){return new OpenLayers.Geometry.Point(this.x,this.y)},resize:function(a,b,d){this.x=b.x+a*(d==undefined?1:d)*(this.x-b.x);this.y=b.y+a*(this.y-b.y);this.clearBounds();return this},intersects:function(a){var b=false;return b=a.CLASS_NAME=="OpenLayers.Geometry.Point"?this.equals(a):a.intersects(this)},transform:function(a,b){if(a&&
b){OpenLayers.Projection.transform(this,a,b);this.bounds=null}return this},getVertices:function(){return[this]},CLASS_NAME:"OpenLayers.Geometry.Point"});OpenLayers.Geometry.MultiPoint=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments)},addPoint:function(a,b){this.addComponent(a,b)},removePoint:function(a){this.removeComponent(a)},CLASS_NAME:"OpenLayers.Geometry.MultiPoint"});
OpenLayers.Geometry.Curve=OpenLayers.Class(OpenLayers.Geometry.MultiPoint,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(){OpenLayers.Geometry.MultiPoint.prototype.initialize.apply(this,arguments)},getLength:function(){var a=0;if(this.components&&this.components.length>1)for(var b=1,d=this.components.length;b<d;b++)a+=this.components[b-1].distanceTo(this.components[b]);return a},getGeodesicLength:function(a){var b=this;if(a){var d=new OpenLayers.Projection("EPSG:4326");d.equals(a)||
(b=this.clone().transform(a,d))}a=0;if(b.components&&b.components.length>1)for(var e,f=1,g=b.components.length;f<g;f++){d=b.components[f-1];e=b.components[f];a+=OpenLayers.Util.distVincenty({lon:d.x,lat:d.y},{lon:e.x,lat:e.y})}return a*1E3},CLASS_NAME:"OpenLayers.Geometry.Curve"});
OpenLayers.Geometry.LineString=OpenLayers.Class(OpenLayers.Geometry.Curve,{initialize:function(){OpenLayers.Geometry.Curve.prototype.initialize.apply(this,arguments)},removeComponent:function(){this.components&&this.components.length>2&&OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments)},intersects:function(a){var b=false,d=a.CLASS_NAME;if(d=="OpenLayers.Geometry.LineString"||d=="OpenLayers.Geometry.LinearRing"||d=="OpenLayers.Geometry.Point"){var e=this.getSortedSegments();
a=d=="OpenLayers.Geometry.Point"?[{x1:a.x,y1:a.y,x2:a.x,y2:a.y}]:a.getSortedSegments();var f,g,h,j,l,m,o,p=0,q=e.length;a:for(;p<q;++p){d=e[p];f=d.x1;g=d.x2;h=d.y1;j=d.y2;var r=0,s=a.length;for(;r<s;++r){l=a[r];if(l.x1>g)break;if(!(l.x2<f)){m=l.y1;o=l.y2;if(!(Math.min(m,o)>Math.max(h,j)))if(!(Math.max(m,o)<Math.min(h,j)))if(OpenLayers.Geometry.segmentsIntersect(d,l)){b=true;break a}}}}}else b=a.intersects(this);return b},getSortedSegments:function(){for(var a=this.components.length-1,b=new Array(a),
d,e,f=0;f<a;++f){d=this.components[f];e=this.components[f+1];b[f]=d.x<e.x?{x1:d.x,y1:d.y,x2:e.x,y2:e.y}:{x1:e.x,y1:e.y,x2:d.x,y2:d.y}}return b.sort(function(g,h){return g.x1-h.x1})},splitWithSegment:function(a,b){for(var d=!(b&&b.edge===false),e=b&&b.tolerance,f=[],g=this.getVertices(),h=[],j=[],l=false,m,o,p,q={point:true,tolerance:e},r=null,s=0,t=g.length-2;s<=t;++s){e=g[s];h.push(e.clone());m=g[s+1];o={x1:e.x,y1:e.y,x2:m.x,y2:m.y};o=OpenLayers.Geometry.segmentsIntersect(a,o,q);if(o instanceof OpenLayers.Geometry.Point)if((p=
o.x===a.x1&&o.y===a.y1||o.x===a.x2&&o.y===a.y2||o.equals(e)||o.equals(m)?true:false)||d){o.equals(j[j.length-1])||j.push(o.clone());if(s===0)if(o.equals(e))continue;if(!o.equals(m)){l=true;o.equals(e)||h.push(o);f.push(new OpenLayers.Geometry.LineString(h));h=[o.clone()]}}}if(l){h.push(m.clone());f.push(new OpenLayers.Geometry.LineString(h))}if(j.length>0){var v=a.x1<a.x2?1:-1,u=a.y1<a.y2?1:-1;r={lines:f,points:j.sort(function(w,z){return v*w.x-v*z.x||u*w.y-u*z.y})}}return r},split:function(a,b){var d=
null,e=b&&b.mutual,f,g,h,j;if(a instanceof OpenLayers.Geometry.LineString){var l=this.getVertices(),m,o,p,q,r,s=[];h=[];for(var t=0,v=l.length-2;t<=v;++t){m=l[t];o=l[t+1];p={x1:m.x,y1:m.y,x2:o.x,y2:o.y};j=j||[a];e&&s.push(m.clone());for(var u=0;u<j.length;++u)if(q=j[u].splitWithSegment(p,b)){r=q.lines;if(r.length>0){r.unshift(u,1);Array.prototype.splice.apply(j,r);u+=r.length-2}if(e)for(var w=0,z=q.points.length;w<z;++w){r=q.points[w];if(!r.equals(m)){s.push(r);h.push(new OpenLayers.Geometry.LineString(s));
s=r.equals(o)?[]:[r.clone()]}}}}if(e&&h.length>0&&s.length>0){s.push(o.clone());h.push(new OpenLayers.Geometry.LineString(s))}}else d=a.splitWith(this,b);if(j&&j.length>1)g=true;else j=[];if(h&&h.length>1)f=true;else h=[];if(g||f)d=e?[h,j]:j;return d},splitWith:function(a,b){return a.split(this,b)},getVertices:function(a){return a===true?[this.components[0],this.components[this.components.length-1]]:a===false?this.components.slice(1,this.components.length-1):this.components.slice()},distanceTo:function(a,
b){var d=!(b&&b.edge===false)&&b&&b.details,e,f={},g=Number.POSITIVE_INFINITY;if(a instanceof OpenLayers.Geometry.Point){for(var h=this.getSortedSegments(),j=a.x,l=a.y,m,o=0,p=h.length;o<p;++o){m=h[o];e=OpenLayers.Geometry.distanceToSegment(a,m);if(e.distance<g){g=e.distance;f=e;if(g===0)break}else if(m.x2>j&&(l>m.y1&&l<m.y2||l<m.y1&&l>m.y2))break}f=d?{distance:f.distance,x0:f.x,y0:f.y,x1:j,y1:l}:f.distance}else if(a instanceof OpenLayers.Geometry.LineString){h=this.getSortedSegments();j=a.getSortedSegments();
var q,r,s=j.length,t={point:true};o=0;p=h.length;a:for(;o<p;++o){l=h[o];m=l.x1;r=l.y1;for(var v=0;v<s;++v){e=j[v];if(q=OpenLayers.Geometry.segmentsIntersect(l,e,t)){g=0;f={distance:0,x0:q.x,y0:q.y,x1:q.x,y1:q.y};break a}else{e=OpenLayers.Geometry.distanceToSegment({x:m,y:r},e);if(e.distance<g){g=e.distance;f={distance:g,x0:m,y0:r,x1:e.x,y1:e.y}}}}}if(!d)f=f.distance;if(g!==0)if(l){e=a.distanceTo(new OpenLayers.Geometry.Point(l.x2,l.y2),b);o=d?e.distance:e;if(o<g)f=d?{distance:g,x0:e.x1,y0:e.y1,x1:e.x0,
y1:e.y0}:o}}else{f=a.distanceTo(this,b);if(d)f={distance:f.distance,x0:f.x1,y0:f.y1,x1:f.x0,y1:f.y0}}return f},CLASS_NAME:"OpenLayers.Geometry.LineString"});
OpenLayers.Geometry.LinearRing=OpenLayers.Class(OpenLayers.Geometry.LineString,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(){OpenLayers.Geometry.LineString.prototype.initialize.apply(this,arguments)},addComponent:function(a,b){var d=false,e=this.components.pop();if(b!=null||!a.equals(e))d=OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,arguments);OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[this.components[0]]);return d},removeComponent:function(){if(this.components.length>
4){this.components.pop();OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[this.components[0]])}},move:function(a,b){for(var d=0,e=this.components.length;d<e-1;d++)this.components[d].move(a,b)},rotate:function(a,b){for(var d=0,e=this.components.length;d<e-1;++d)this.components[d].rotate(a,b)},resize:function(a,b,d){for(var e=0,f=this.components.length;e<f-1;++e)this.components[e].resize(a,b,d);return this},
transform:function(a,b){if(a&&b){for(var d=0,e=this.components.length;d<e-1;d++)this.components[d].transform(a,b);this.bounds=null}return this},getCentroid:function(){if(this.components&&this.components.length>2){for(var a=0,b=0,d=0;d<this.components.length-1;d++){var e=this.components[d],f=this.components[d+1];a+=(e.x+f.x)*(e.x*f.y-f.x*e.y);b+=(e.y+f.y)*(e.x*f.y-f.x*e.y)}d=-1*this.getArea();return new OpenLayers.Geometry.Point(a/(6*d),b/(6*d))}else return null},getArea:function(){var a=0;if(this.components&&
this.components.length>2){for(var b=a=0,d=this.components.length;b<d-1;b++){var e=this.components[b],f=this.components[b+1];a+=(e.x+f.x)*(f.y-e.y)}a=-a/2}return a},getGeodesicArea:function(a){var b=this;if(a){var d=new OpenLayers.Projection("EPSG:4326");d.equals(a)||(b=this.clone().transform(a,d))}a=0;d=b.components&&b.components.length;if(d>2){for(var e,f,g=0;g<d-1;g++){e=b.components[g];f=b.components[g+1];a+=OpenLayers.Util.rad(f.x-e.x)*(2+Math.sin(OpenLayers.Util.rad(e.y))+Math.sin(OpenLayers.Util.rad(f.y)))}a=
a*6378137*6378137/2}return a},containsPoint:function(a){var b=OpenLayers.Number.limitSigDigs,d=b(a.x,14);a=b(a.y,14);for(var e=this.components.length-1,f,g,h,j,l,m=0,o=0;o<e;++o){f=this.components[o];h=b(f.x,14);f=b(f.y,14);g=this.components[o+1];j=b(g.x,14);g=b(g.y,14);if(f==g){if(a==f)if(h<=j&&d>=h&&d<=j||h>=j&&d<=h&&d>=j){m=-1;break}}else{l=b(((h-j)*a+(j*f-h*g))/(f-g),14);if(l==d)if(f<g&&a>=f&&a<=g||f>g&&a<=f&&a>=g){m=-1;break}if(!(l<=d))if(!(h!=j&&(l<Math.min(h,j)||l>Math.max(h,j))))if(f<g&&a>=
f&&a<g||f>g&&a<f&&a>=g)++m}}return m==-1?1:!!(m&1)},intersects:function(a){var b=false;if(a.CLASS_NAME=="OpenLayers.Geometry.Point")b=this.containsPoint(a);else if(a.CLASS_NAME=="OpenLayers.Geometry.LineString")b=a.intersects(this);else if(a.CLASS_NAME=="OpenLayers.Geometry.LinearRing")b=OpenLayers.Geometry.LineString.prototype.intersects.apply(this,[a]);else for(var d=0,e=a.components.length;d<e;++d)if(b=a.components[d].intersects(this))break;return b},getVertices:function(a){return a===true?[]:
this.components.slice(0,this.components.length-1)},CLASS_NAME:"OpenLayers.Geometry.LinearRing"});
OpenLayers.Geometry.Polygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LinearRing"],initialize:function(){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments)},getArea:function(){var a=0;if(this.components&&this.components.length>0){a+=Math.abs(this.components[0].getArea());for(var b=1,d=this.components.length;b<d;b++)a-=Math.abs(this.components[b].getArea())}return a},getGeodesicArea:function(a){var b=0;if(this.components&&this.components.length>
0){b+=Math.abs(this.components[0].getGeodesicArea(a));for(var d=1,e=this.components.length;d<e;d++)b-=Math.abs(this.components[d].getGeodesicArea(a))}return b},containsPoint:function(a){var b=this.components.length,d=false;if(b>0){d=this.components[0].containsPoint(a);if(d!==1)if(d&&b>1)for(var e,f=1;f<b;++f)if(e=this.components[f].containsPoint(a)){d=e===1?1:false;break}}return d},intersects:function(a){var b=false,d,e;if(a.CLASS_NAME=="OpenLayers.Geometry.Point")b=this.containsPoint(a);else if(a.CLASS_NAME==
"OpenLayers.Geometry.LineString"||a.CLASS_NAME=="OpenLayers.Geometry.LinearRing"){d=0;for(e=this.components.length;d<e;++d)if(b=a.intersects(this.components[d]))break;if(!b){d=0;for(e=a.components.length;d<e;++d)if(b=this.containsPoint(a.components[d]))break}}else{d=0;for(e=a.components.length;d<e;++d)if(b=this.intersects(a.components[d]))break}if(!b&&a.CLASS_NAME=="OpenLayers.Geometry.Polygon"){var f=this.components[0];d=0;for(e=f.components.length;d<e;++d)if(b=a.containsPoint(f.components[d]))break}return b},
distanceTo:function(a,b){return b&&b.edge===false&&this.intersects(a)?0:OpenLayers.Geometry.Collection.prototype.distanceTo.apply(this,[a,b])},CLASS_NAME:"OpenLayers.Geometry.Polygon"});OpenLayers.Geometry.Polygon.createRegularPolygon=function(a,b,d,e){var f=Math.PI*(1/d-0.5);if(e)f+=e/180*Math.PI;for(var g,h=[],j=0;j<d;++j){g=f+j*2*Math.PI/d;e=a.x+b*Math.cos(g);g=a.y+b*Math.sin(g);h.push(new OpenLayers.Geometry.Point(e,g))}a=new OpenLayers.Geometry.LinearRing(h);return new OpenLayers.Geometry.Polygon([a])};
OpenLayers.Geometry.MultiLineString=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LineString"],initialize:function(){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments)},split:function(a,b){for(var d=null,e=b&&b.mutual,f,g,h,j,l=[],m=[a],o=0,p=this.components.length;o<p;++o){g=this.components[o];h=false;for(var q=0;q<m.length;++q)if(f=g.split(m[q],b)){if(e){h=f[0];for(var r=0,s=h.length;r<s;++r)r===0&&l.length?l[l.length-1].addComponent(h[r]):
l.push(new OpenLayers.Geometry.MultiLineString([h[r]]));h=true;f=f[1]}if(f.length){f.unshift(q,1);Array.prototype.splice.apply(m,f);break}}if(!h)if(l.length)l[l.length-1].addComponent(g.clone());else l=[new OpenLayers.Geometry.MultiLineString(g.clone())]}if(l&&l.length>1)h=true;else l=[];if(m&&m.length>1)j=true;else m=[];if(h||j)d=e?[l,m]:m;return d},splitWith:function(a,b){var d=null,e=b&&b.mutual,f,g,h,j,l,m;if(a instanceof OpenLayers.Geometry.LineString){m=[];l=[a];for(var o=0,p=this.components.length;o<
p;++o){h=false;g=this.components[o];for(var q=0;q<l.length;++q)if(f=l[q].split(g,b)){if(e){h=f[0];if(h.length){h.unshift(q,1);Array.prototype.splice.apply(l,h);q+=h.length-2}f=f[1];if(f.length===0)f=[g.clone()]}h=0;for(var r=f.length;h<r;++h)h===0&&m.length?m[m.length-1].addComponent(f[h]):m.push(new OpenLayers.Geometry.MultiLineString([f[h]]));h=true}if(!h)if(m.length)m[m.length-1].addComponent(g.clone());else m=[new OpenLayers.Geometry.MultiLineString([g.clone()])]}}else d=a.split(this);if(l&&l.length>
1)j=true;else l=[];if(m&&m.length>1)h=true;else m=[];if(j||h)d=e?[l,m]:m;return d},CLASS_NAME:"OpenLayers.Geometry.MultiLineString"});OpenLayers.Geometry.MultiPolygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.Polygon"],initialize:function(){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments)},CLASS_NAME:"OpenLayers.Geometry.MultiPolygon"});
OpenLayers.Geometry.Surface=OpenLayers.Class(OpenLayers.Geometry,{initialize:function(){OpenLayers.Geometry.prototype.initialize.apply(this,arguments)},CLASS_NAME:"OpenLayers.Geometry.Surface"});
OpenLayers.Renderer=OpenLayers.Class({container:null,root:null,extent:null,locked:false,size:null,resolution:null,map:null,initialize:function(a){this.container=OpenLayers.Util.getElement(a)},destroy:function(){this.map=this.resolution=this.size=this.extent=this.container=null},supported:function(){return false},setExtent:function(a,b){this.extent=a.clone();if(b)this.resolution=null},setSize:function(a){this.size=a.clone();this.resolution=null},getResolution:function(){return this.resolution=this.resolution||
this.map.getResolution()},drawFeature:function(a,b){if(b==null)b=a.style;if(a.geometry){var d=a.geometry.getBounds();if(d){d.intersectsBounds(this.extent)||(b={display:"none"});d=this.drawGeometry(a.geometry,b,a.id);if(b.display!="none"&&b.label&&d!==false){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(){},drawText:function(){},removeText:function(){},clear:function(){},getFeatureIdFromEvent:function(){},eraseFeatures:function(a){a instanceof Array||(a=[a]);for(var b=0,d=a.length;b<d;++b){this.eraseGeometry(a[b].geometry);this.removeText(a[b].id)}},eraseGeometry:function(){},moveRoot:function(){},getRenderLayerId:function(){return this.container.id},CLASS_NAME:"OpenLayers.Renderer"});
OpenLayers.ElementsIndexer=OpenLayers.Class({maxZIndex:null,order:null,indices:null,compare:null,initialize:function(a){this.compare=a?OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_Y_ORDER:OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_DRAWING_ORDER;this.order=[];this.indices={};this.maxZIndex=0},insert:function(a){this.exists(a)&&this.remove(a);var b=a.id;this.determineZIndex(a);for(var d=-1,e=this.order.length,f;e-d>1;){f=parseInt((d+e)/2);if(this.compare(this,a,OpenLayers.Util.getElement(this.order[f]))>
0)d=f;else e=f}this.order.splice(e,0,b);this.indices[b]=this.getZIndex(a);return this.getNextElement(e)},remove:function(a){a=a.id;var b=OpenLayers.Util.indexOf(this.order,a);if(b>=0){this.order.splice(b,1);delete this.indices[a];this.maxZIndex=this.order.length>0?this.indices[this.order[this.order.length-1]]:0}},clear:function(){this.order=[];this.indices={};this.maxZIndex=0},exists:function(a){return this.indices[a.id]!=null},getZIndex:function(a){return a._style.graphicZIndex},determineZIndex:function(a){var b=
a._style.graphicZIndex;if(b==null){b=this.maxZIndex;a._style.graphicZIndex=b}else if(b>this.maxZIndex)this.maxZIndex=b},getNextElement:function(a){a=a+1;if(a<this.order.length){var b=OpenLayers.Util.getElement(this.order[a]);if(b==undefined)b=this.getNextElement(a);return b}else return null},CLASS_NAME:"OpenLayers.ElementsIndexer"});
OpenLayers.ElementsIndexer.IndexingMethods={Z_ORDER:function(a,b,d){b=a.getZIndex(b);var e=0;if(d){a=a.getZIndex(d);e=b-a}return e},Z_ORDER_DRAWING_ORDER:function(a,b,d){a=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(a,b,d);if(d&&a==0)a=1;return a},Z_ORDER_Y_ORDER:function(a,b,d){a=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(a,b,d);if(d&&a===0){b=d._boundsBottom-b._boundsBottom;a=b===0?1:b}return a}};
OpenLayers.Renderer.Elements=OpenLayers.Class(OpenLayers.Renderer,{rendererRoot:null,root:null,vectorRoot:null,textRoot:null,xmlns:null,indexer:null,BACKGROUND_ID_SUFFIX:"_background",LABEL_ID_SUFFIX:"_label",minimumSymbolizer:{strokeLinecap:"round",strokeOpacity:1,strokeDashstyle:"solid",fillOpacity:1,pointRadius:0},initialize:function(a,b){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.rendererRoot=this.createRenderRoot();this.root=this.createRoot("_root");this.vectorRoot=this.createRoot("_vroot");
this.textRoot=this.createRoot("_troot");this.root.appendChild(this.vectorRoot);this.root.appendChild(this.textRoot);this.rendererRoot.appendChild(this.root);this.container.appendChild(this.rendererRoot);if(b&&(b.zIndexing||b.yOrdering))this.indexer=new OpenLayers.ElementsIndexer(b.yOrdering)},destroy:function(){this.clear();this.xmlns=this.root=this.rendererRoot=null;OpenLayers.Renderer.prototype.destroy.apply(this,arguments)},clear:function(){if(this.vectorRoot)for(;this.vectorRoot.childNodes.length>
0;)this.vectorRoot.removeChild(this.vectorRoot.firstChild);if(this.textRoot)for(;this.textRoot.childNodes.length>0;)this.textRoot.removeChild(this.textRoot.firstChild);this.indexer&&this.indexer.clear()},getNodeType:function(){},drawGeometry:function(a,b,d){var e=a.CLASS_NAME,f=true;if(e=="OpenLayers.Geometry.Collection"||e=="OpenLayers.Geometry.MultiPoint"||e=="OpenLayers.Geometry.MultiLineString"||e=="OpenLayers.Geometry.MultiPolygon"){e=0;for(var g=a.components.length;e<g;e++)f=this.drawGeometry(a.components[e],
b,d)&&f;return f}f=false;if(b.display!="none"){b.backgroundGraphic&&this.redrawBackgroundNode(a.id,a,b,d);f=this.redrawNode(a.id,a,b,d)}if(f==false)if(b=document.getElementById(a.id)){b._style.backgroundGraphic&&b.parentNode.removeChild(document.getElementById(a.id+this.BACKGROUND_ID_SUFFIX));b.parentNode.removeChild(b)}return f},redrawNode:function(a,b,d,e){a=this.nodeFactory(a,this.getNodeType(b,d));a._featureId=e;a._boundsBottom=b.getBounds().bottom;a._geometryClass=b.CLASS_NAME;a._style=d;b=this.drawGeometryNode(a,
b,d);if(b===false)return false;a=b.node;if(this.indexer)(d=this.indexer.insert(a))?this.vectorRoot.insertBefore(a,d):this.vectorRoot.appendChild(a);else a.parentNode!==this.vectorRoot&&this.vectorRoot.appendChild(a);this.postDraw(a);return b.complete},redrawBackgroundNode:function(a,b,d){d=OpenLayers.Util.extend({},d);d.externalGraphic=d.backgroundGraphic;d.graphicXOffset=d.backgroundXOffset;d.graphicYOffset=d.backgroundYOffset;d.graphicZIndex=d.backgroundGraphicZIndex;d.graphicWidth=d.backgroundWidth||
d.graphicWidth;d.graphicHeight=d.backgroundHeight||d.graphicHeight;d.backgroundGraphic=null;d.backgroundXOffset=null;d.backgroundYOffset=null;d.backgroundGraphicZIndex=null;return this.redrawNode(a+this.BACKGROUND_ID_SUFFIX,b,d,null)},drawGeometryNode:function(a,b,d){d=d||a._style;OpenLayers.Util.applyDefaults(d,this.minimumSymbolizer);var e={isFilled:d.fill===undefined?true:d.fill,isStroked:d.stroke===undefined?!!d.strokeWidth:d.stroke},f;switch(b.CLASS_NAME){case "OpenLayers.Geometry.Point":if(d.graphic===
false){e.isFilled=false;e.isStroked=false}f=this.drawPoint(a,b);break;case "OpenLayers.Geometry.LineString":e.isFilled=false;f=this.drawLineString(a,b);break;case "OpenLayers.Geometry.LinearRing":f=this.drawLinearRing(a,b);break;case "OpenLayers.Geometry.Polygon":f=this.drawPolygon(a,b);break;case "OpenLayers.Geometry.Surface":f=this.drawSurface(a,b);break;case "OpenLayers.Geometry.Rectangle":f=this.drawRectangle(a,b);break;default:break}a._options=e;return f!=false?{node:this.setStyle(a,d,e,b),complete:f}:
false},postDraw:function(){},drawPoint:function(){},drawLineString:function(){},drawLinearRing:function(){},drawPolygon:function(){},drawRectangle:function(){},drawCircle:function(){},drawSurface:function(){},removeText:function(a){(a=document.getElementById(a+this.LABEL_ID_SUFFIX))&&this.textRoot.removeChild(a)},getFeatureIdFromEvent:function(a){var b=a.target,d=b&&b.correspondingUseElement;return(d?d:b||a.srcElement)._featureId},eraseGeometry:function(a){if(a.CLASS_NAME=="OpenLayers.Geometry.MultiPoint"||
a.CLASS_NAME=="OpenLayers.Geometry.MultiLineString"||a.CLASS_NAME=="OpenLayers.Geometry.MultiPolygon"||a.CLASS_NAME=="OpenLayers.Geometry.Collection")for(var b=0,d=a.components.length;b<d;b++)this.eraseGeometry(a.components[b]);else if((b=OpenLayers.Util.getElement(a.id))&&b.parentNode){if(b.geometry){b.geometry.destroy();b.geometry=null}b.parentNode.removeChild(b);this.indexer&&this.indexer.remove(b);if(b._style.backgroundGraphic)(a=OpenLayers.Util.getElement(a.id+this.BACKGROUND_ID_SUFFIX))&&a.parentNode&&
a.parentNode.removeChild(a)}},nodeFactory:function(a,b){var d=OpenLayers.Util.getElement(a);if(d){if(!this.nodeTypeCompare(d,b)){d.parentNode.removeChild(d);d=this.nodeFactory(a,b)}}else d=this.createNode(b,a);return d},nodeTypeCompare:function(){},createNode:function(){},moveRoot:function(a){var b=this.root;if(a.root.parentNode==this.rendererRoot)b=a.root;b.parentNode.removeChild(b);a.rendererRoot.appendChild(b)},getRenderLayerId:function(){return this.root.parentNode.parentNode.id},isComplexSymbol:function(a){return a!=
"circle"&&!!a},CLASS_NAME:"OpenLayers.Renderer.Elements"});OpenLayers.Renderer.symbol={star:[350,75,379,161,469,161,397,215,423,301,350,250,277,301,303,215,231,161,321,161,350,75],cross:[4,0,6,0,6,4,10,4,10,6,6,6,6,10,4,10,4,6,0,6,0,4,4,4,4,0],x:[0,0,25,0,50,35,75,0,100,0,65,50,100,100,75,100,50,65,25,100,0,100,35,50,0,0],square:[0,0,0,1,1,1,1,0,0,0],triangle:[0,10,10,10,5,0,0,10]};
OpenLayers.Renderer.SVG=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"http://www.w3.org/2000/svg",xlinkns:"http://www.w3.org/1999/xlink",MAX_PIXEL:15E3,translationParameters:null,symbolMetrics:null,isGecko:null,supportUse:null,initialize:function(){if(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.isGecko=navigator.userAgent.toLowerCase().indexOf("gecko/")!=
-1;this.symbolMetrics={}}},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments)},supported:function(){return document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#SVG","1.1")||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"))},inValidRange:function(a,b,d){a=a+(d?0:this.translationParameters.x);b=b+(d?0:this.translationParameters.y);
return a>=-this.MAX_PIXEL&&a<=this.MAX_PIXEL&&b>=-this.MAX_PIXEL&&b<=this.MAX_PIXEL},setExtent:function(a,b){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var d=this.getResolution(),e=-a.left/d;d=a.top/d;if(b){this.left=e;this.top=d;this.rendererRoot.setAttributeNS(null,"viewBox","0 0 "+this.size.w+" "+this.size.h);this.translate(0,0);return true}else{(e=this.translate(e-this.left,d-this.top))||this.setExtent(a,true);return e}},translate:function(a,b){if(this.inValidRange(a,
b,true)){var d="";if(a||b)d="translate("+a+","+b+")";this.root.setAttributeNS(null,"transform",d);this.translationParameters={x:a,y:b};return true}else return false},setSize:function(){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);this.rendererRoot.setAttributeNS(null,"width",this.size.w);this.rendererRoot.setAttributeNS(null,"height",this.size.h)},getNodeType:function(a,b){var d=null;switch(a.CLASS_NAME){case "OpenLayers.Geometry.Point":d=b.externalGraphic?"image":this.isComplexSymbol(b.graphicName)?
this.supportUse===false?"svg":"use":"circle";break;case "OpenLayers.Geometry.Rectangle":d="rect";break;case "OpenLayers.Geometry.LineString":d="polyline";break;case "OpenLayers.Geometry.LinearRing":d="polygon";break;case "OpenLayers.Geometry.Polygon":case "OpenLayers.Geometry.Curve":case "OpenLayers.Geometry.Surface":d="path";break;default:break}return d},setStyle:function(a,b,d){b=b||a._style;d=d||a._options;var e=parseFloat(a.getAttributeNS(null,"r")),f=1,g;if(a._geometryClass=="OpenLayers.Geometry.Point"&&
e){a.style.visibility="";if(b.graphic===false)a.style.visibility="hidden";else if(b.externalGraphic){g=this.getPosition(a);b.graphicTitle&&a.setAttributeNS(null,"title",b.graphicTitle);b.graphicWidth&&b.graphicHeight&&a.setAttributeNS(null,"preserveAspectRatio","none");e=b.graphicWidth||b.graphicHeight;var h=b.graphicHeight||b.graphicWidth;e=e?e:b.pointRadius*2;h=h?h:b.pointRadius*2;var j=b.graphicYOffset!=undefined?b.graphicYOffset:-(0.5*h),l=b.graphicOpacity||b.fillOpacity;a.setAttributeNS(null,
"x",(g.x+(b.graphicXOffset!=undefined?b.graphicXOffset:-(0.5*e))).toFixed());a.setAttributeNS(null,"y",(g.y+j).toFixed());a.setAttributeNS(null,"width",e);a.setAttributeNS(null,"height",h);a.setAttributeNS(this.xlinkns,"href",b.externalGraphic);a.setAttributeNS(null,"style","opacity: "+l)}else if(this.isComplexSymbol(b.graphicName)){e=b.pointRadius*3;h=e*2;var m=this.importSymbol(b.graphicName);g=this.getPosition(a);f=this.symbolMetrics[m][0]*3/h;j=a.parentNode;l=a.nextSibling;j&&j.removeChild(a);
if(this.supportUse===false){var o=document.getElementById(m);a.firstChild&&a.removeChild(a.firstChild);a.appendChild(o.firstChild.cloneNode(true));a.setAttributeNS(null,"viewBox",o.getAttributeNS(null,"viewBox"))}else a.setAttributeNS(this.xlinkns,"href","#"+m);a.setAttributeNS(null,"width",h);a.setAttributeNS(null,"height",h);a.setAttributeNS(null,"x",g.x-e);a.setAttributeNS(null,"y",g.y-e);if(l)j.insertBefore(a,l);else j&&j.appendChild(a)}else a.setAttributeNS(null,"r",b.pointRadius);e=b.rotation;
if((e!==undefined||a._rotation!==undefined)&&g){a._rotation=e;e|=0;if(a.nodeName!=="svg")a.setAttributeNS(null,"transform","rotate("+e+" "+g.x+" "+g.y+")");else{g=this.symbolMetrics[m];a.firstChild.setAttributeNS(null,"transform","rotate("+b.rotation+" "+g[1]+" "+g[2]+")")}}}if(d.isFilled){a.setAttributeNS(null,"fill",b.fillColor);a.setAttributeNS(null,"fill-opacity",b.fillOpacity)}else a.setAttributeNS(null,"fill","none");if(d.isStroked){a.setAttributeNS(null,"stroke",b.strokeColor);a.setAttributeNS(null,
"stroke-opacity",b.strokeOpacity);a.setAttributeNS(null,"stroke-width",b.strokeWidth*f);a.setAttributeNS(null,"stroke-linecap",b.strokeLinecap);a.setAttributeNS(null,"stroke-linejoin","round");a.setAttributeNS(null,"stroke-dasharray",this.dashStyle(b,f))}else a.setAttributeNS(null,"stroke","none");b.pointerEvents&&a.setAttributeNS(null,"pointer-events",b.pointerEvents);b.cursor!=null&&a.setAttributeNS(null,"cursor",b.cursor);return a},dashStyle:function(a,b){var d=a.strokeWidth*b,e=a.strokeDashstyle;
switch(e){case "solid":return"none";case "dot":return[1,4*d].join();case "dash":return[4*d,4*d].join();case "dashdot":return[4*d,4*d,1,4*d].join();case "longdash":return[8*d,4*d].join();case "longdashdot":return[8*d,4*d,1,4*d].join();default:return OpenLayers.String.trim(e).replace(/\s+/g,",")}},createNode:function(a,b){var d=document.createElementNS(this.xmlns,a);b&&d.setAttributeNS(null,"id",b);return d},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,d){var e=this.getResolution(),f=b.x/e+this.left;b=this.top-b.y/e;if(this.inValidRange(f,b)){a.setAttributeNS(null,"cx",f);a.setAttributeNS(null,"cy",b);a.setAttributeNS(null,"r",d);return a}else return false},
drawLineString:function(a,b){var d=this.getComponentsString(b.components);if(d.path){a.setAttributeNS(null,"points",d.path);return d.complete?a:null}else return false},drawLinearRing:function(a,b){var d=this.getComponentsString(b.components);if(d.path){a.setAttributeNS(null,"points",d.path);return d.complete?a:null}else return false},drawPolygon:function(a,b){for(var d="",e=true,f=true,g,h,j=0,l=b.components.length;j<l;j++){d+=" M";g=this.getComponentsString(b.components[j].components," ");if(h=g.path){d+=
" "+h;f=g.complete&&f}else e=false}d+=" z";if(e){a.setAttributeNS(null,"d",d);a.setAttributeNS(null,"fill-rule","evenodd");return f?a:null}else return false},drawRectangle:function(a,b){var d=this.getResolution(),e=b.x/d+this.left,f=this.top-b.y/d;if(this.inValidRange(e,f)){a.setAttributeNS(null,"x",e);a.setAttributeNS(null,"y",f);a.setAttributeNS(null,"width",b.width/d);a.setAttributeNS(null,"height",b.height/d);return a}else return false},drawSurface:function(a,b){for(var d=null,e=true,f=0,g=b.components.length;f<
g;f++)if(f%3==0&&f/3==0){var h=this.getShortString(b.components[f]);h||(e=false);d="M "+h}else if(f%3==1){(h=this.getShortString(b.components[f]))||(e=false);d+=" C "+h}else{(h=this.getShortString(b.components[f]))||(e=false);d+=" "+h}d+=" Z";if(e){a.setAttributeNS(null,"d",d);return a}else return false},drawText:function(a,b,d){var e=this.getResolution(),f=d.x/e+this.left,g=d.y/e-this.top;e=this.nodeFactory(a+this.LABEL_ID_SUFFIX,"text");var h=this.nodeFactory(a+this.LABEL_ID_SUFFIX+"_tspan","tspan");
e.setAttributeNS(null,"x",f);e.setAttributeNS(null,"y",-g);b.fontColor&&e.setAttributeNS(null,"fill",b.fontColor);b.fontOpacity&&e.setAttributeNS(null,"opacity",b.fontOpacity);b.fontFamily&&e.setAttributeNS(null,"font-family",b.fontFamily);b.fontSize&&e.setAttributeNS(null,"font-size",b.fontSize);b.fontWeight&&e.setAttributeNS(null,"font-weight",b.fontWeight);if(b.labelSelect===true){e.setAttributeNS(null,"pointer-events","visible");e._featureId=a;h._featureId=a;h._geometry=d;h._geometryClass=d.CLASS_NAME}else e.setAttributeNS(null,
"pointer-events","none");a=b.labelAlign||"cm";e.setAttributeNS(null,"text-anchor",OpenLayers.Renderer.SVG.LABEL_ALIGN[a[0]]||"middle");this.isGecko?e.setAttributeNS(null,"dominant-baseline",OpenLayers.Renderer.SVG.LABEL_ALIGN[a[1]]||"central"):h.setAttributeNS(null,"baseline-shift",OpenLayers.Renderer.SVG.LABEL_VSHIFT[a[1]]||"-35%");h.textContent=b.label;if(!e.parentNode){e.appendChild(h);this.textRoot.appendChild(e)}},getComponentsString:function(a,b){for(var d=[],e=true,f=a.length,g=[],h,j=0;j<
f;j++){h=a[j];d.push(h);if(h=this.getShortString(h))g.push(h);else{j>0&&this.getShortString(a[j-1])&&g.push(this.clipLine(a[j],a[j-1]));j<f-1&&this.getShortString(a[j+1])&&g.push(this.clipLine(a[j],a[j+1]));e=false}}return{path:g.join(b||","),complete:e}},clipLine:function(a,b){if(b.equals(a))return"";var d=this.getResolution(),e=this.MAX_PIXEL-this.translationParameters.x,f=this.MAX_PIXEL-this.translationParameters.y,g=b.x/d+this.left,h=this.top-b.y/d,j=a.x/d+this.left;d=this.top-a.y/d;var l;if(j<
-e||j>e){l=(d-h)/(j-g);j=j<0?-e:e;d=h+(j-g)*l}if(d<-f||d>f){l=(j-g)/(d-h);d=d<0?-f:f;j=g+(d-h)*l}return j+","+d},getShortString:function(a){var b=this.getResolution(),d=a.x/b+this.left;a=this.top-a.y/b;return this.inValidRange(d,a)?d+","+a:false},getPosition:function(a){return{x:parseFloat(a.getAttributeNS(null,"cx")),y:parseFloat(a.getAttributeNS(null,"cy"))}},importSymbol:function(a){if(!this.defs)this.defs=this.createDefs();var b=this.container.id+"-"+a;if(document.getElementById(b)!=null)return b;
var d=OpenLayers.Renderer.symbol[a];if(!d)throw new Error(a+" is not a valid symbol name");a=this.nodeFactory(b,"symbol");var e=this.nodeFactory(null,"polygon");a.appendChild(e);for(var f=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0),g="",h,j,l=0;l<d.length;l+=2){h=d[l];j=d[l+1];f.left=Math.min(f.left,h);f.bottom=Math.min(f.bottom,j);f.right=Math.max(f.right,h);f.top=Math.max(f.top,j);g+=" "+h+","+j}e.setAttributeNS(null,"points",g);d=f.getWidth();e=f.getHeight();a.setAttributeNS(null,
"viewBox",[f.left-d,f.bottom-e,d*3,e*3].join(" "));this.symbolMetrics[b]=[Math.max(d,e),f.getCenterLonLat().lon,f.getCenterLonLat().lat];this.defs.appendChild(a);return a.id},getFeatureIdFromEvent:function(a){var b=OpenLayers.Renderer.Elements.prototype.getFeatureIdFromEvent.apply(this,arguments);if(this.supportUse===false&&!b){b=a.target;b=b.parentNode&&b!=this.rendererRoot&&b.parentNode._featureId}return b},CLASS_NAME:"OpenLayers.Renderer.SVG"});
OpenLayers.Renderer.SVG.LABEL_ALIGN={l:"start",r:"end",b:"bottom",t:"hanging"};OpenLayers.Renderer.SVG.LABEL_VSHIFT={t:"-70%",b:"0"};
OpenLayers.Renderer.Canvas=OpenLayers.Class(OpenLayers.Renderer,{canvas:null,features:null,geometryMap:null,initialize:function(){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.root=document.createElement("canvas");this.container.appendChild(this.root);this.canvas=this.root.getContext("2d");this.features={};this.geometryMap={}},eraseGeometry:function(a){this.eraseFeatures(this.features[this.geometryMap[a.id]][0])},supported:function(){return!!document.createElement("canvas").getContext},
setExtent:function(a){this.extent=a.clone();this.resolution=null;this.redraw()},setSize:function(a){this.size=a.clone();this.root.style.width=a.w+"px";this.root.style.height=a.h+"px";this.root.width=a.w;this.root.height=a.h;this.resolution=null},drawFeature:function(a,b){if(b==null)b=a.style;b=OpenLayers.Util.extend({fillColor:"#000000",strokeColor:"#000000",strokeWidth:2,fillOpacity:1,strokeOpacity:1},b);this.features[a.id]=[a,b];if(a.geometry)this.geometryMap[a.geometry.id]=a.id;this.redraw()},
drawGeometry:function(a,b){var d=a.CLASS_NAME;if(d=="OpenLayers.Geometry.Collection"||d=="OpenLayers.Geometry.MultiPoint"||d=="OpenLayers.Geometry.MultiLineString"||d=="OpenLayers.Geometry.MultiPolygon")for(d=0;d<a.components.length;d++)this.drawGeometry(a.components[d],b);else switch(a.CLASS_NAME){case "OpenLayers.Geometry.Point":this.drawPoint(a,b);break;case "OpenLayers.Geometry.LineString":this.drawLineString(a,b);break;case "OpenLayers.Geometry.LinearRing":this.drawLinearRing(a,b);break;case "OpenLayers.Geometry.Polygon":this.drawPolygon(a,
b);break;default:break}},drawExternalGraphic:function(a,b){var d=new Image;d.src=b.externalGraphic;if(b.graphicTitle)d.title=b.graphicTitle;var e=b.graphicWidth||b.graphicHeight,f=b.graphicHeight||b.graphicWidth;e=e?e:b.pointRadius*2;f=f?f:b.pointRadius*2;d.onload=OpenLayers.Function.bind(function(){this.canvas.drawImage(this.img,this.x,this.y,this.width,this.height)},{img:d,x:a[0]+(b.graphicXOffset!=undefined?b.graphicXOffset:-(0.5*e)),y:a[1]+(b.graphicYOffset!=undefined?b.graphicYOffset:-(0.5*f)),
width:e,height:f,canvas:this.canvas})},setCanvasStyle:function(a,b){if(a=="fill"){this.canvas.globalAlpha=b.fillOpacity;this.canvas.fillStyle=b.fillColor}else if(a=="stroke"){this.canvas.globalAlpha=b.strokeOpacity;this.canvas.strokeStyle=b.strokeColor;this.canvas.lineWidth=b.strokeWidth}else{this.canvas.globalAlpha=0;this.canvas.lineWidth=1}},drawPoint:function(a,b){if(b.graphic!==false){var d=this.getLocalXY(a);if(b.externalGraphic)this.drawExternalGraphic(d,b);else{if(b.fill!==false){this.setCanvasStyle("fill",
b);this.canvas.beginPath();this.canvas.arc(d[0],d[1],b.pointRadius,0,Math.PI*2,true);this.canvas.fill()}if(b.stroke!==false){this.setCanvasStyle("stroke",b);this.canvas.beginPath();this.canvas.arc(d[0],d[1],b.pointRadius,0,Math.PI*2,true);this.canvas.stroke();this.setCanvasStyle("reset")}}}},drawLineString:function(a,b){if(b.stroke!==false){this.setCanvasStyle("stroke",b);this.canvas.beginPath();var d=this.getLocalXY(a.components[0]);this.canvas.moveTo(d[0],d[1]);for(d=1;d<a.components.length;d++){var e=
this.getLocalXY(a.components[d]);this.canvas.lineTo(e[0],e[1])}this.canvas.stroke()}this.setCanvasStyle("reset")},drawLinearRing:function(a,b){if(b.fill!==false){this.setCanvasStyle("fill",b);this.canvas.beginPath();var d=this.getLocalXY(a.components[0]);this.canvas.moveTo(d[0],d[1]);for(d=1;d<a.components.length-1;d++){var e=this.getLocalXY(a.components[d]);this.canvas.lineTo(e[0],e[1])}this.canvas.fill()}if(b.stroke!==false){this.setCanvasStyle("stroke",b);this.canvas.beginPath();d=this.getLocalXY(a.components[0]);
this.canvas.moveTo(d[0],d[1]);for(d=1;d<a.components.length;d++){e=this.getLocalXY(a.components[d]);this.canvas.lineTo(e[0],e[1])}this.canvas.stroke()}this.setCanvasStyle("reset")},drawPolygon:function(a,b){this.drawLinearRing(a.components[0],b);for(var d=1;d<a.components.length;d++)this.drawLinearRing(a.components[d],{fillOpacity:0,strokeWidth:0,strokeOpacity:0,strokeColor:"#000000",fillColor:"#000000"})},drawText:function(a,b){b=OpenLayers.Util.extend({fontColor:"#000000",labelAlign:"cm"},b);var d=
this.getLocalXY(a);this.setCanvasStyle("reset");this.canvas.fillStyle=b.fontColor;this.canvas.globalAlpha=b.fontOpacity||1;var e=b.fontWeight+" "+b.fontSize+" "+b.fontFamily;if(this.canvas.fillText){var f=OpenLayers.Renderer.Canvas.LABEL_ALIGN[b.labelAlign[0]]||"center";this.canvas.font=e;this.canvas.textAlign=f;this.canvas.fillText(b.label,d[0],d[1])}else if(this.canvas.mozDrawText){this.canvas.mozTextStyle=e;e=this.canvas.mozMeasureText(b.label);switch(b.labelAlign[0]){case "l":break;case "r":d[0]-=
e;break;case "c":default:d[0]-=e/2}this.canvas.translate(d[0],d[1]);this.canvas.mozDrawText(b.label);this.canvas.translate(-1*d[0],-1*d[1])}this.setCanvasStyle("reset")},getLocalXY:function(a){var b=this.getResolution(),d=this.extent;return[a.x/b+-d.left/b,d.top/b-a.y/b]},clear:function(){this.canvas.clearRect(0,0,this.root.width,this.root.height)},getFeatureIdFromEvent:function(a){a=this.map.getLonLatFromPixel(a.xy);var b=this.getResolution();a=(new OpenLayers.Bounds(a.lon-b*5,a.lat-b*5,a.lon+b*
5,a.lat+b*5)).toGeometry();for(var d in this.features)if(this.features.hasOwnProperty(d))if(this.features[d][0].geometry.intersects(a))return d;return null},eraseFeatures:function(a){a instanceof Array||(a=[a]);for(var b=0;b<a.length;++b)delete this.features[a[b].id];this.redraw()},redraw:function(){if(!this.locked){this.clear();var a=[],b,d;for(var e in this.features)if(this.features.hasOwnProperty(e)){b=this.features[e][0];d=this.features[e][1];if(b.geometry){this.drawGeometry(b.geometry,d);d.label&&
a.push([b,d])}}for(d=0;len=a.length,d<len;++d){b=a[d];this.drawText(b[0].geometry.getCentroid(),b[1])}}},CLASS_NAME:"OpenLayers.Renderer.Canvas"});OpenLayers.Renderer.Canvas.LABEL_ALIGN={l:"left",r:"right"};
OpenLayers.Renderer.VML=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"urn:schemas-microsoft-com:vml",symbolCache:{},offset:null,initialize:function(){if(this.supported()){if(!document.namespaces.olv){document.namespaces.add("olv",this.xmlns);for(var a=document.createStyleSheet(),b=["shape","rect","oval","fill","stroke","imagedata","group","textbox"],d=0,e=b.length;d<e;d++)a.addRule("olv\\:"+b[d],"behavior: url(#default#VML); position: absolute; display: inline-block;")}OpenLayers.Renderer.Elements.prototype.initialize.apply(this,
arguments)}},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments)},supported:function(){return!!document.namespaces},setExtent:function(a,b){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var d=this.getResolution(),e=a.left/d|0;d=a.top/d-this.size.h|0;if(b||!this.offset){this.offset={x:e,y:d};d=e=0}else{e-=this.offset.x;d-=this.offset.y}this.root.coordorigin=e+" "+d;e=[this.root,this.vectorRoot,this.textRoot];for(var f=0,g=e.length;f<g;++f){d=
e[f];d.coordsize=this.size.w+" "+this.size.h}this.root.style.flip="y";return true},setSize:function(){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);for(var a=[this.rendererRoot,this.root,this.vectorRoot,this.textRoot],b=this.size.w+"px",d=this.size.h+"px",e,f=0,g=a.length;f<g;++f){e=a[f];e.style.width=b;e.style.height=d}},getNodeType:function(a,b){var d=null;switch(a.CLASS_NAME){case "OpenLayers.Geometry.Point":d=b.externalGraphic?"olv:rect":this.isComplexSymbol(b.graphicName)?"olv:shape":
"olv:oval";break;case "OpenLayers.Geometry.Rectangle":d="olv:rect";break;case "OpenLayers.Geometry.LineString":case "OpenLayers.Geometry.LinearRing":case "OpenLayers.Geometry.Polygon":case "OpenLayers.Geometry.Curve":case "OpenLayers.Geometry.Surface":d="olv:shape";break;default:break}return d},setStyle:function(a,b,d,e){b=b||a._style;d=d||a._options;var f=b.fillColor;if(a._geometryClass==="OpenLayers.Geometry.Point")if(b.externalGraphic){if(b.graphicTitle)a.title=b.graphicTitle;f=b.graphicWidth||
b.graphicHeight;var g=b.graphicHeight||b.graphicWidth;f=f?f:b.pointRadius*2;g=g?g:b.pointRadius*2;var h=this.getResolution(),j=b.graphicXOffset!=undefined?b.graphicXOffset:-(0.5*f),l=b.graphicYOffset!=undefined?b.graphicYOffset:-(0.5*g);a.style.left=(e.x/h-this.offset.x+j|0)+"px";a.style.top=(e.y/h-this.offset.y-(l+g)|0)+"px";a.style.width=f+"px";a.style.height=g+"px";a.style.flip="y";f="none";d.isStroked=false}else if(this.isComplexSymbol(b.graphicName)){g=this.importSymbol(b.graphicName);a.path=
g.path;a.coordorigin=g.left+","+g.bottom;g=g.size;a.coordsize=g+","+g;this.drawCircle(a,e,b.pointRadius);a.style.flip="y"}else this.drawCircle(a,e,b.pointRadius);if(d.isFilled)a.fillcolor=f;else a.filled="false";e=a.getElementsByTagName("fill");e=e.length==0?null:e[0];if(d.isFilled){e||(e=this.createNode("olv:fill",a.id+"_fill"));e.opacity=b.fillOpacity;if(a._geometryClass==="OpenLayers.Geometry.Point"&&b.externalGraphic){if(b.graphicOpacity)e.opacity=b.graphicOpacity;e.src=b.externalGraphic;e.type=
"frame";if(!(b.graphicWidth&&b.graphicHeight))e.aspect="atmost"}e.parentNode!=a&&a.appendChild(e)}else e&&a.removeChild(e);f=b.rotation;if(f!==a._rotation){a._rotation=f;if(b.externalGraphic){this.graphicRotate(a,j,l,b);e.opacity=0}else if(a._geometryClass==="OpenLayers.Geometry.Point")a.style.rotation=f||0}if(d.isStroked){a.strokecolor=b.strokeColor;a.strokeweight=b.strokeWidth+"px"}else a.stroked=false;j=a.getElementsByTagName("stroke");j=j.length==0?null:j[0];if(d.isStroked){if(!j){j=this.createNode("olv:stroke",
a.id+"_stroke");a.appendChild(j)}j.opacity=b.strokeOpacity;j.endcap=!b.strokeLinecap||b.strokeLinecap=="butt"?"flat":b.strokeLinecap;j.dashstyle=this.dashStyle(b)}else j&&a.removeChild(j);if(b.cursor!="inherit"&&b.cursor!=null)a.style.cursor=b.cursor;return a},graphicRotate:function(a,b,d,e){e=e||a._style;var f=e.rotation||0,g,h;if(e.graphicWidth&&e.graphicHeight){h=Math.max(e.graphicWidth,e.graphicHeight);g=e.graphicWidth/e.graphicHeight;var j=Math.round(e.graphicWidth||h*g),l=Math.round(e.graphicHeight||
h);a.style.width=j+"px";a.style.height=l+"px";var m=document.getElementById(a.id+"_image");if(!m){m=this.createNode("olv:imagedata",a.id+"_image");a.appendChild(m)}m.style.width=j+"px";m.style.height=l+"px";m.src=e.externalGraphic;m.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='', sizingMethod='scale')";m=f*Math.PI/180;f=Math.sin(m);m=Math.cos(m);f="progid:DXImageTransform.Microsoft.Matrix(M11="+m+",M12="+-f+",M21="+f+",M22="+m+",SizingMethod='auto expand')\n";if((m=e.graphicOpacity||
e.fillOpacity)&&m!=1)f+="progid:DXImageTransform.Microsoft.BasicImage(opacity="+m+")\n";a.style.filter=f;f=new OpenLayers.Geometry.Point(-b,-d);j=(new OpenLayers.Bounds(0,0,j,l)).toGeometry();j.rotate(e.rotation,f);j=j.getBounds();a.style.left=Math.round(parseInt(a.style.left)+j.left)+"px";a.style.top=Math.round(parseInt(a.style.top)-j.bottom)+"px"}else{var o=new Image;o.onreadystatechange=OpenLayers.Function.bind(function(){if(o.readyState=="complete"||o.readyState=="interactive"){g=o.width/o.height;
h=Math.max(e.pointRadius*2,e.graphicWidth||0,e.graphicHeight||0);b*=g;e.graphicWidth=h*g;e.graphicHeight=h;this.graphicRotate(a,b,d,e)}},this);o.src=e.externalGraphic}},postDraw:function(a){a.style.visibility="visible";var b=a._style.fillColor,d=a._style.strokeColor;if(b=="none"&&a.fillcolor!=b)a.fillcolor=b;if(d=="none"&&a.strokecolor!=d)a.strokecolor=d},setNodeDimension:function(a,b){var d=b.getBounds();if(d){var e=this.getResolution();d=new OpenLayers.Bounds(d.left/e-this.offset.x|0,d.bottom/e-
this.offset.y|0,d.right/e-this.offset.x|0,d.top/e-this.offset.y|0);a.style.left=d.left+"px";a.style.top=d.top+"px";a.style.width=d.getWidth()+"px";a.style.height=d.getHeight()+"px";a.coordorigin=d.left+" "+d.top;a.coordsize=d.getWidth()+" "+d.getHeight()}},dashStyle:function(a){a=a.strokeDashstyle;switch(a){case "solid":case "dot":case "dash":case "dashdot":case "longdash":case "longdashdot":return a;default:a=a.split(/[ ,]/);if(a.length==2){if(1*a[0]>=2*a[1])return"longdash";return a[0]==1||a[1]==
1?"dot":"dash"}else if(a.length==4)return 1*a[0]>=2*a[1]?"longdashdot":"dashdot";return"solid"}},createNode:function(a,b){var d=document.createElement(a);if(b)d.id=b;d.unselectable="on";d.onselectstart=OpenLayers.Function.False;return d},nodeTypeCompare:function(a,b){var d=b,e=d.indexOf(":");if(e!=-1)d=d.substr(e+1);var f=a.nodeName;e=f.indexOf(":");if(e!=-1)f=f.substr(e+1);return d==f},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,d){if(!isNaN(b.x)&&!isNaN(b.y)){var e=this.getResolution();a.style.left=(b.x/e-this.offset.x|0)-d+"px";a.style.top=(b.y/e-this.offset.y|0)-d+"px";b=d*2;a.style.width=b+"px";a.style.height=b+"px";return a}return false},drawLineString:function(a,b){return this.drawLine(a,b,false)},drawLinearRing:function(a,b){return this.drawLine(a,b,true)},drawLine:function(a,b,d){this.setNodeDimension(a,b);for(var e=this.getResolution(),
f=b.components.length,g=new Array(f),h,j,l=0;l<f;l++){h=b.components[l];j=h.x/e-this.offset.x|0;h=h.y/e-this.offset.y|0;g[l]=" "+j+","+h+" l "}a.path="m"+g.join("")+(d?" x e":" e");return a},drawPolygon:function(a,b){this.setNodeDimension(a,b);var d=this.getResolution(),e=[],f,g,h,j,l,m,o;h=0;for(j=b.components.length;h<j;h++){f=b.components[h];e.push("m");g=0;for(l=f.components.length;g<l;g++){m=f.components[g];o=m.x/d-this.offset.x|0;m=m.y/d-this.offset.y|0;e.push(" "+o+","+m);g==0&&e.push(" l")}e.push(" x ")}e.push("e");
a.path=e.join("");return a},drawRectangle:function(a,b){var d=this.getResolution();a.style.left=(b.x/d-this.offset.x|0)+"px";a.style.top=(b.y/d-this.offset.y|0)+"px";a.style.width=(b.width/d|0)+"px";a.style.height=(b.height/d|0)+"px";return a},drawText:function(a,b,d){var e=this.nodeFactory(a+this.LABEL_ID_SUFFIX,"olv:rect"),f=this.nodeFactory(a+this.LABEL_ID_SUFFIX+"_textbox","olv:textbox"),g=this.getResolution();e.style.left=(d.x/g-this.offset.x|0)+"px";e.style.top=(d.y/g-this.offset.y|0)+"px";
e.style.flip="y";f.innerText=b.label;if(b.fontColor)f.style.color=b.fontColor;if(b.fontOpacity)f.style.filter="alpha(opacity="+b.fontOpacity*100+")";if(b.fontFamily)f.style.fontFamily=b.fontFamily;if(b.fontSize)f.style.fontSize=b.fontSize;if(b.fontWeight)f.style.fontWeight=b.fontWeight;if(b.labelSelect===true){e._featureId=a;f._featureId=a;f._geometry=d;f._geometryClass=d.CLASS_NAME}f.style.whiteSpace="nowrap";f.inset="1px,0px,0px,0px";if(!e.parentNode){e.appendChild(f);this.textRoot.appendChild(e)}b=
b.labelAlign||"cm";a=f.clientWidth*OpenLayers.Renderer.VML.LABEL_SHIFT[b[0]||"c"];f=f.clientHeight*OpenLayers.Renderer.VML.LABEL_SHIFT[b[1]||"m"];e.style.left=parseInt(e.style.left)-a-1+"px";e.style.top=parseInt(e.style.top)+f+"px"},drawSurface:function(a,b){this.setNodeDimension(a,b);for(var d=this.getResolution(),e=[],f,g,h=0,j=b.components.length;h<j;h++){f=b.components[h];g=f.x/d-this.offset.x|0;f=f.y/d-this.offset.y|0;if(h%3==0&&h/3==0)e.push("m");else h%3==1&&e.push(" c");e.push(" "+g+","+f)}e.push(" x e");
a.path=e.join("");return a},moveRoot:function(a){var b=this.map.getLayer(a.container.id);if(b instanceof OpenLayers.Layer.Vector.RootContainer)b=this.map.getLayer(this.container.id);b&&b.renderer.clear();OpenLayers.Renderer.Elements.prototype.moveRoot.apply(this,arguments);b&&b.redraw()},importSymbol:function(a){var b=this.container.id+"-"+a,d=this.symbolCache[b];if(d)return d;d=OpenLayers.Renderer.symbol[a];if(!d)throw new Error(a+" is not a valid symbol name");a=new OpenLayers.Bounds(Number.MAX_VALUE,
Number.MAX_VALUE,0,0);for(var e=["m"],f=0;f<d.length;f+=2){var g=d[f],h=d[f+1];a.left=Math.min(a.left,g);a.bottom=Math.min(a.bottom,h);a.right=Math.max(a.right,g);a.top=Math.max(a.top,h);e.push(g);e.push(h);f==0&&e.push("l")}e.push("x e");d=e.join(" ");e=(a.getWidth()-a.getHeight())/2;if(e>0){a.bottom-=e;a.top+=e}else{a.left+=e;a.right-=e}d={path:d,size:a.getWidth(),left:a.left,bottom:a.bottom};return this.symbolCache[b]=d},CLASS_NAME:"OpenLayers.Renderer.VML"});
OpenLayers.Renderer.VML.LABEL_SHIFT={l:0,c:0.5,r:1,t:0,m:0.5,b:1};
OpenLayers.Layer.Vector=OpenLayers.Class(OpenLayers.Layer,{EVENT_TYPES:["beforefeatureadded","beforefeaturesadded","featureadded","featuresadded","beforefeatureremoved","featureremoved","featuresremoved","beforefeatureselected","featureselected","featureunselected","beforefeaturemodified","featuremodified","afterfeaturemodified","vertexmodified","sketchstarted","sketchmodified","sketchcomplete","refresh"],isBaseLayer:false,isFixed:false,isVector:true,features:null,filter:null,selectedFeatures:null,
unrenderedFeatures:null,reportError:true,style:null,styleMap:null,strategies:null,protocol:null,renderers:["SVG","VML","Canvas"],renderer:null,rendererOptions:null,geometryType:null,drawn:false,initialize:function(){this.EVENT_TYPES=OpenLayers.Layer.Vector.prototype.EVENT_TYPES.concat(OpenLayers.Layer.prototype.EVENT_TYPES);OpenLayers.Layer.prototype.initialize.apply(this,arguments);if(!this.renderer||!this.renderer.supported())this.assignRenderer();if(!this.renderer||!this.renderer.supported()){this.renderer=
null;this.displayError()}if(!this.styleMap)this.styleMap=new OpenLayers.StyleMap;this.features=[];this.selectedFeatures=[];this.unrenderedFeatures={};if(this.strategies)for(var a=0,b=this.strategies.length;a<b;a++)this.strategies[a].setLayer(this)},destroy:function(){if(this.strategies){var a,b,d;b=0;for(d=this.strategies.length;b<d;b++){a=this.strategies[b];a.autoDestroy&&a.destroy()}this.strategies=null}if(this.protocol){this.protocol.autoDestroy&&this.protocol.destroy();this.protocol=null}this.destroyFeatures();
this.unrenderedFeatures=this.selectedFeatures=this.features=null;this.renderer&&this.renderer.destroy();this.drawn=this.geometryType=this.renderer=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(a){if(a==null)a=new OpenLayers.Layer.Vector(this.name,this.getOptions());a=OpenLayers.Layer.prototype.clone.apply(this,[a]);for(var b=this.features,d=b.length,e=new Array(d),f=0;f<d;++f)e[f]=b[f].clone();a.features=e;return a},refresh:function(a){this.calculateInRange()&&this.visibility&&
this.events.triggerEvent("refresh",a)},assignRenderer:function(){for(var a=0,b=this.renderers.length;a<b;a++){var d=OpenLayers.Renderer[this.renderers[a]];if(d&&d.prototype.supported()){this.renderer=new d(this.div,this.rendererOptions);break}}},displayError:function(){this.reportError&&OpenLayers.Console.userError(OpenLayers.i18n("browserNotSupported",{renderers:this.renderers.join("\n")}))},setMap:function(){OpenLayers.Layer.prototype.setMap.apply(this,arguments);if(this.renderer){this.renderer.map=
this.map;this.renderer.setSize(this.map.getSize())}else this.map.removeLayer(this)},afterAdd:function(){if(this.strategies){var a,b,d;b=0;for(d=this.strategies.length;b<d;b++){a=this.strategies[b];a.autoActivate&&a.activate()}}},removeMap:function(){if(this.strategies){var a,b,d;b=0;for(d=this.strategies.length;b<d;b++){a=this.strategies[b];a.autoActivate&&a.deactivate()}}},onMapResize:function(){OpenLayers.Layer.prototype.onMapResize.apply(this,arguments);this.renderer.setSize(this.map.getSize())},
moveTo:function(a,b,d){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);var e=true;if(!d){this.renderer.root.style.visibility="hidden";this.div.style.left=-parseInt(this.map.layerContainerDiv.style.left)+"px";this.div.style.top=-parseInt(this.map.layerContainerDiv.style.top)+"px";e=this.renderer.setExtent(this.map.getExtent(),b);this.renderer.root.style.visibility="visible";if(navigator.userAgent.toLowerCase().indexOf("gecko")!=-1)this.div.scrollLeft=this.div.scrollLeft;if(!b&&e)for(var f in this.unrenderedFeatures){var g=
this.unrenderedFeatures[f];this.drawFeature(g)}}if(!this.drawn||b||!e){this.drawn=true;f=0;for(e=this.features.length;f<e;f++){this.renderer.locked=f!==e-1;g=this.features[f];this.drawFeature(g)}}},display:function(){OpenLayers.Layer.prototype.display.apply(this,arguments);var a=this.div.style.display;if(a!=this.renderer.root.style.display)this.renderer.root.style.display=a},addFeatures:function(a,b){a instanceof Array||(a=[a]);var d=!b||!b.silent;if(d){var e={features:a};if(this.events.triggerEvent("beforefeaturesadded",
e)===false)return;a=e.features}e=0;for(var f=a.length;e<f;e++){this.renderer.locked=e!=a.length-1?true:false;var g=a[e];if(this.geometryType&&!(g.geometry instanceof this.geometryType))throw OpenLayers.i18n("componentShouldBe",{geomType:this.geometryType.prototype.CLASS_NAME});this.features.push(g);g.layer=this;if(!g.style&&this.style)g.style=OpenLayers.Util.extend({},this.style);if(d){if(this.events.triggerEvent("beforefeatureadded",{feature:g})===false)continue;this.preFeatureInsert(g)}this.drawFeature(g);
if(d){this.events.triggerEvent("featureadded",{feature:g});this.onFeatureInsert(g)}}d&&this.events.triggerEvent("featuresadded",{features:a})},removeFeatures:function(a,b){if(!(!a||a.length===0)){a instanceof Array||(a=[a]);if(a===this.features||a===this.selectedFeatures)a=a.slice();for(var d=!b||!b.silent,e=a.length-1;e>=0;e--){this.renderer.locked=e!=0&&a[e-1].geometry?true:false;var f=a[e];delete this.unrenderedFeatures[f.id];d&&this.events.triggerEvent("beforefeatureremoved",{feature:f});this.features=
OpenLayers.Util.removeItem(this.features,f);f.layer=null;f.geometry&&this.renderer.eraseFeatures(f);OpenLayers.Util.indexOf(this.selectedFeatures,f)!=-1&&OpenLayers.Util.removeItem(this.selectedFeatures,f);d&&this.events.triggerEvent("featureremoved",{feature:f})}d&&this.events.triggerEvent("featuresremoved",{features:a})}},destroyFeatures:function(a,b){if(a==undefined)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"){if(!b&&a.state===OpenLayers.State.DELETE)b="delete";var d=b||a.renderIntent;(b=a.style||this.style)||(b=this.styleMap.createSymbolizer(a,d))}if(this.renderer.drawFeature(a,b))delete this.unrenderedFeatures[a.id];else this.unrenderedFeatures[a.id]=a}},eraseFeatures:function(a){this.renderer.eraseFeatures(a)},getFeatureFromEvent:function(a){if(!this.renderer){OpenLayers.Console.error(OpenLayers.i18n("getFeatureError"));return null}return this.getFeatureById(this.renderer.getFeatureIdFromEvent(a))},
getFeatureById:function(a){for(var b=null,d=0,e=this.features.length;d<e;++d)if(this.features[d].id==a){b=this.features[d];break}return b},onFeatureInsert:function(){},preFeatureInsert:function(){},getDataExtent:function(){var a=null,b=this.features;if(b&&b.length>0){a=new OpenLayers.Bounds;for(var d=null,e=0,f=b.length;e<f;e++)(d=b[e].geometry)&&a.extend(d.getBounds())}return a},CLASS_NAME:"OpenLayers.Layer.Vector"});
OpenLayers.Layer.Vector.RootContainer=OpenLayers.Class(OpenLayers.Layer.Vector,{displayInLayerSwitcher:false,layers:null,initialize:function(){OpenLayers.Layer.Vector.prototype.initialize.apply(this,arguments)},display:function(){},getFeatureFromEvent:function(a){for(var b=this.layers,d,e=0;e<b.length;e++)if(d=b[e].getFeatureFromEvent(a))return d},setMap:function(a){OpenLayers.Layer.Vector.prototype.setMap.apply(this,arguments);this.collectRoots();a.events.register("changelayer",this,this.handleChangeLayer)},
removeMap:function(a){a.events.unregister("changelayer",this,this.handleChangeLayer);this.resetRoots();OpenLayers.Layer.Vector.prototype.removeMap.apply(this,arguments)},collectRoots:function(){for(var a,b=0;b<this.map.layers.length;++b){a=this.map.layers[b];OpenLayers.Util.indexOf(this.layers,a)!=-1&&a.renderer.moveRoot(this.renderer)}},resetRoots:function(){for(var a,b=0;b<this.layers.length;++b){a=this.layers[b];this.renderer&&a.renderer.getRenderLayerId()==this.id&&this.renderer.moveRoot(a.renderer)}},
handleChangeLayer:function(a){var b=a.layer;if(a.property=="order"&&OpenLayers.Util.indexOf(this.layers,b)!=-1){this.resetRoots();this.collectRoots()}},CLASS_NAME:"OpenLayers.Layer.Vector.RootContainer"});OpenLayers.Filter=OpenLayers.Class({initialize:function(a){OpenLayers.Util.extend(this,a)},destroy:function(){},evaluate:function(){return true},clone:function(){return null},CLASS_NAME:"OpenLayers.Filter"});
OpenLayers.Filter.Comparison=OpenLayers.Class(OpenLayers.Filter,{type:null,property:null,value:null,matchCase:true,lowerBoundary:null,upperBoundary:null,initialize:function(a){OpenLayers.Filter.prototype.initialize.apply(this,[a])},evaluate:function(a){var b=false;switch(this.type){case OpenLayers.Filter.Comparison.EQUAL_TO:a=a[this.property];b=this.value;b=!this.matchCase&&typeof a=="string"&&typeof b=="string"?a.toUpperCase()==b.toUpperCase():a==b;break;case OpenLayers.Filter.Comparison.NOT_EQUAL_TO:a=
a[this.property];b=this.value;b=!this.matchCase&&typeof a=="string"&&typeof b=="string"?a.toUpperCase()!=b.toUpperCase():a!=b;break;case OpenLayers.Filter.Comparison.LESS_THAN:b=a[this.property]<this.value;break;case OpenLayers.Filter.Comparison.GREATER_THAN:b=a[this.property]>this.value;break;case OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO:b=a[this.property]<=this.value;break;case OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO:b=a[this.property]>=this.value;break;case OpenLayers.Filter.Comparison.BETWEEN:b=
a[this.property]>=this.lowerBoundary&&a[this.property]<=this.upperBoundary;break;case OpenLayers.Filter.Comparison.LIKE:b=(new RegExp(this.value,"gi")).test(a[this.property]);break}return b},value2regex:function(a,b,d){if(a=="."){OpenLayers.Console.error("'.' is an unsupported wildCard character for OpenLayers.Filter.Comparison");return null}a=a?a:"*";b=b?b:".";this.value=this.value.replace(new RegExp("\\"+(d?d:"!")+"(.|$)","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);return this.value=this.value.replace(new RegExp("\\\\\\.","g"),"\\"+b)},regex2value:function(){var a=this.value;a=a.replace(/!/g,"!!");a=a.replace(/(\\)?\\\./g,function(b,d){return d?b:"!."});a=a.replace(/(\\)?\\\*/g,function(b,d){return d?b:"!*"});a=a.replace(/\\\\/g,"\\");return a=a.replace(/\.\*/g,"*")},clone:function(){return OpenLayers.Util.extend(new OpenLayers.Filter.Comparison,
this)},CLASS_NAME:"OpenLayers.Filter.Comparison"});OpenLayers.Filter.Comparison.EQUAL_TO="==";OpenLayers.Filter.Comparison.NOT_EQUAL_TO="!=";OpenLayers.Filter.Comparison.LESS_THAN="<";OpenLayers.Filter.Comparison.GREATER_THAN=">";OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO="<=";OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO=">=";OpenLayers.Filter.Comparison.BETWEEN="..";OpenLayers.Filter.Comparison.LIKE="~";
OpenLayers.Filter.Spatial=OpenLayers.Class(OpenLayers.Filter,{type:null,property:null,value:null,distance:null,distanceUnits:null,initialize:function(a){OpenLayers.Filter.prototype.initialize.apply(this,[a])},evaluate:function(a){var b=false;switch(this.type){case OpenLayers.Filter.Spatial.BBOX:case OpenLayers.Filter.Spatial.INTERSECTS:if(a.geometry){var d=this.value;if(this.value.CLASS_NAME=="OpenLayers.Bounds")d=this.value.toGeometry();if(a.geometry.intersects(d))b=true}break;default:OpenLayers.Console.error(OpenLayers.i18n("filterEvaluateNotImplemented"));
break}return b},clone:function(){var a=OpenLayers.Util.applyDefaults({value:this.value&&this.value.clone&&this.value.clone()},this);return new OpenLayers.Filter.Spatial(a)},CLASS_NAME:"OpenLayers.Filter.Spatial"});OpenLayers.Filter.Spatial.BBOX="BBOX";OpenLayers.Filter.Spatial.INTERSECTS="INTERSECTS";OpenLayers.Filter.Spatial.DWITHIN="DWITHIN";OpenLayers.Filter.Spatial.WITHIN="WITHIN";OpenLayers.Filter.Spatial.CONTAINS="CONTAINS";
OpenLayers.Protocol=OpenLayers.Class({format:null,options:null,autoDestroy:true,defaultFilter:null,initialize:function(a){a=a||{};OpenLayers.Util.extend(this,a);this.options=a},mergeWithDefaultFilter:function(a){if(a){if(this.defaultFilter)a=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.AND,filters:[this.defaultFilter,a]})}else a=this.defaultFilter;return a},destroy:function(){this.format=this.options=null},read:function(a){a=a||{};a.filter=this.mergeWithDefaultFilter(a.filter)},create:function(){},
update:function(){},"delete":function(){},commit:function(){},abort:function(){},createCallback:function(a,b,d){return OpenLayers.Function.bind(function(){a.apply(this,[b,d])},this)},CLASS_NAME:"OpenLayers.Protocol"});OpenLayers.Protocol.Response=OpenLayers.Class({code:null,requestType:null,last:true,features:null,reqFeatures:null,priv:null,initialize:function(a){OpenLayers.Util.extend(this,a)},success:function(){return this.code>0},CLASS_NAME:"OpenLayers.Protocol.Response"});
OpenLayers.Protocol.Response.SUCCESS=1;OpenLayers.Protocol.Response.FAILURE=0;
OpenLayers.Protocol.HTTP=OpenLayers.Class(OpenLayers.Protocol,{url:null,headers:null,params:null,callback:null,scope:null,readWithPOST:false,wildcarded:false,initialize:function(a){a=a||{};this.params={};this.headers={};OpenLayers.Protocol.prototype.initialize.apply(this,arguments)},destroy:function(){this.headers=this.params=null;OpenLayers.Protocol.prototype.destroy.apply(this)},read:function(a){OpenLayers.Protocol.prototype.read.apply(this,arguments);a=OpenLayers.Util.applyDefaults(a,this.options);
a.params=OpenLayers.Util.applyDefaults(a.params,this.options.params);if(a.filter)a.params=this.filterToParams(a.filter,a.params);var b=a.readWithPOST!==undefined?a.readWithPOST:this.readWithPOST,d=new OpenLayers.Protocol.Response({requestType:"read"});d.priv=b?OpenLayers.Request.POST({url:a.url,callback:this.createCallback(this.handleRead,d,a),data:OpenLayers.Util.getParameterString(a.params),headers:{"Content-Type":"application/x-www-form-urlencoded"}}):OpenLayers.Request.GET({url:a.url,callback:this.createCallback(this.handleRead,
d,a),params:a.params,headers:a.headers});return d},handleRead:function(a,b){this.handleResponse(a,b)},filterToParams:function(a,b){b=b||{};var d=a.CLASS_NAME;d=d.substring(d.lastIndexOf(".")+1);switch(d){case "Spatial":switch(a.type){case OpenLayers.Filter.Spatial.BBOX:b.bbox=a.value.toArray();break;case OpenLayers.Filter.Spatial.DWITHIN:b.tolerance=a.distance;case OpenLayers.Filter.Spatial.WITHIN:b.lon=a.value.x;b.lat=a.value.y;break;default:OpenLayers.Console.warn("Unknown spatial filter type "+
a.type)}break;case "Comparison":d=OpenLayers.Protocol.HTTP.COMP_TYPE_TO_OP_STR[a.type];if(d!==undefined){var e=a.value;if(a.type==OpenLayers.Filter.Comparison.LIKE){e=this.regex2value(e);if(this.wildcarded)e="%"+e+"%"}b[a.property+"__"+d]=e;b.queryable=b.queryable||[];b.queryable.push(a.property)}else OpenLayers.Console.warn("Unknown comparison filter type "+a.type);break;case "Logical":if(a.type===OpenLayers.Filter.Logical.AND){d=0;for(e=a.filters.length;d<e;d++)b=this.filterToParams(a.filters[d],
b)}else OpenLayers.Console.warn("Unsupported logical filter type "+a.type);break;default:OpenLayers.Console.warn("Unknown filter type "+d)}return b},regex2value:function(a){a=a.replace(/%/g,"\\%");a=a.replace(/\\\\\.(\*)?/g,function(b,d){return d?b:"\\\\_"});a=a.replace(/\\\\\.\*/g,"\\\\%");a=a.replace(/(\\)?\.(\*)?/g,function(b,d,e){return d||e?b:"_"});a=a.replace(/(\\)?\.\*/g,function(b,d){return d?b:"%"});a=a.replace(/\\\./g,".");return a=a.replace(/(\\)?\\\*/g,function(b,d){return d?b:"*"})},
create:function(a,b){b=OpenLayers.Util.applyDefaults(b,this.options);var d=new OpenLayers.Protocol.Response({reqFeatures:a,requestType:"create"});d.priv=OpenLayers.Request.POST({url:b.url,callback:this.createCallback(this.handleCreate,d,b),headers:b.headers,data:this.format.write(a)});return d},handleCreate:function(a,b){this.handleResponse(a,b)},update:function(a,b){b=b||{};var d=b.url||a.url||this.options.url+"/"+a.fid;b=OpenLayers.Util.applyDefaults(b,this.options);var e=new OpenLayers.Protocol.Response({reqFeatures:a,
requestType:"update"});e.priv=OpenLayers.Request.PUT({url:d,callback:this.createCallback(this.handleUpdate,e,b),headers:b.headers,data:this.format.write(a)});return e},handleUpdate:function(a,b){this.handleResponse(a,b)},"delete":function(a,b){b=b||{};var d=b.url||a.url||this.options.url+"/"+a.fid;b=OpenLayers.Util.applyDefaults(b,this.options);var e=new OpenLayers.Protocol.Response({reqFeatures:a,requestType:"delete"});e.priv=OpenLayers.Request.DELETE({url:d,callback:this.createCallback(this.handleDelete,
e,b),headers:b.headers});return e},handleDelete:function(a,b){this.handleResponse(a,b)},handleResponse:function(a,b){var d=a.priv;if(b.callback){if(d.status>=200&&d.status<300){if(a.requestType!="delete")a.features=this.parseFeatures(d);a.code=OpenLayers.Protocol.Response.SUCCESS}else a.code=OpenLayers.Protocol.Response.FAILURE;b.callback.call(b.scope,a)}},parseFeatures:function(a){var b=a.responseXML;if(!b||!b.documentElement)b=a.responseText;if(!b||b.length<=0)return null;return this.format.read(b)},
commit:function(a,b){function d(t){for(var v=t.features?t.features.length:0,u=new Array(v),w=0;w<v;++w)u[w]=t.features[w].fid;s.insertIds=u;e.apply(this,[t])}function e(t){this.callUserCallback(t,b);r=r&&t.success();g++;if(g>=q)if(b.callback){s.code=r?OpenLayers.Protocol.Response.SUCCESS:OpenLayers.Protocol.Response.FAILURE;b.callback.apply(b.scope,[s])}}b=OpenLayers.Util.applyDefaults(b,this.options);var f=[],g=0,h={};h[OpenLayers.State.INSERT]=[];h[OpenLayers.State.UPDATE]=[];h[OpenLayers.State.DELETE]=
[];for(var j,l,m=[],o=0,p=a.length;o<p;++o){j=a[o];if(l=h[j.state]){l.push(j);m.push(j)}}var q=(h[OpenLayers.State.INSERT].length>0?1:0)+h[OpenLayers.State.UPDATE].length+h[OpenLayers.State.DELETE].length,r=true,s=new OpenLayers.Protocol.Response({reqFeatures:m});j=h[OpenLayers.State.INSERT];j.length>0&&f.push(this.create(j,OpenLayers.Util.applyDefaults({callback:d,scope:this},b.create)));j=h[OpenLayers.State.UPDATE];for(o=j.length-1;o>=0;--o)f.push(this.update(j[o],OpenLayers.Util.applyDefaults({callback:e,
scope:this},b.update)));j=h[OpenLayers.State.DELETE];for(o=j.length-1;o>=0;--o)f.push(this["delete"](j[o],OpenLayers.Util.applyDefaults({callback:e,scope:this},b["delete"])));return f},abort:function(a){a&&a.priv.abort()},callUserCallback:function(a,b){var d=b[a.requestType];d&&d.callback&&d.callback.call(d.scope,a)},CLASS_NAME:"OpenLayers.Protocol.HTTP"});
(function(){var a=OpenLayers.Protocol.HTTP.COMP_TYPE_TO_OP_STR={};a[OpenLayers.Filter.Comparison.EQUAL_TO]="eq";a[OpenLayers.Filter.Comparison.NOT_EQUAL_TO]="ne";a[OpenLayers.Filter.Comparison.LESS_THAN]="lt";a[OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO]="lte";a[OpenLayers.Filter.Comparison.GREATER_THAN]="gt";a[OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO]="gte";a[OpenLayers.Filter.Comparison.LIKE]="ilike"})();
OpenLayers.Layer.GML=OpenLayers.Class(OpenLayers.Layer.Vector,{loaded:false,format:null,formatOptions:null,initialize:function(a,b,d){var e=[];e.push(a,d);OpenLayers.Layer.Vector.prototype.initialize.apply(this,e);this.url=b},setVisibility:function(){OpenLayers.Layer.Vector.prototype.setVisibility.apply(this,arguments);this.visibility&&!this.loaded&&this.loadGML()},moveTo:function(){OpenLayers.Layer.Vector.prototype.moveTo.apply(this,arguments);this.visibility&&!this.loaded&&this.loadGML()},loadGML:function(){if(!this.loaded){this.events.triggerEvent("loadstart");
OpenLayers.Request.GET({url:this.url,success:this.requestSuccess,failure:this.requestFailure,scope:this});this.loaded=true}},setUrl:function(a){this.url=a;this.destroyFeatures();this.loaded=false;this.loadGML()},requestSuccess:function(a){var b=a.responseXML;if(!b||!b.documentElement)b=a.responseText;a={};OpenLayers.Util.extend(a,this.formatOptions);if(this.map&&!this.projection.equals(this.map.getProjectionObject())){a.externalProjection=this.projection;a.internalProjection=this.map.getProjectionObject()}this.addFeatures((this.format?
new this.format(a):new OpenLayers.Format.GML(a)).read(b));this.events.triggerEvent("loadend")},requestFailure:function(){OpenLayers.Console.userError(OpenLayers.i18n("errorLoadingGML",{url:this.url}));this.events.triggerEvent("loadend")},CLASS_NAME:"OpenLayers.Layer.GML"});
OpenLayers.Style=OpenLayers.Class({name:null,title:null,description:null,layerName:null,isDefault:false,rules:null,context:null,defaultStyle:null,defaultsPerSymbolizer:false,propertyStyles:null,initialize:function(a,b){OpenLayers.Util.extend(this,b);this.rules=[];b&&b.rules&&this.addRules(b.rules);this.setDefaultStyle(a||OpenLayers.Feature.Vector.style["default"])},destroy:function(){for(var a=0,b=this.rules.length;a<b;a++){this.rules[a].destroy();this.rules[a]=null}this.defaultStyle=this.rules=null},
createSymbolizer:function(a){for(var b=this.defaultsPerSymbolizer?{}:this.createLiterals(OpenLayers.Util.extend({},this.defaultStyle),a),d=this.rules,e,f=[],g=false,h=0,j=d.length;h<j;h++){e=d[h];if(e.evaluate(a))if(e instanceof OpenLayers.Rule&&e.elseFilter)f.push(e);else{g=true;this.applySymbolizer(e,b,a)}}if(g==false&&f.length>0){g=true;h=0;for(j=f.length;h<j;h++)this.applySymbolizer(f[h],b,a)}if(d.length>0&&g==false)b.display="none";return b},applySymbolizer:function(a,b,d){var e=d.geometry?this.getSymbolizerPrefix(d.geometry):
OpenLayers.Style.SYMBOLIZER_PREFIXES[0];a=a.symbolizer[e]||a.symbolizer;if(this.defaultsPerSymbolizer===true){e=this.defaultStyle;OpenLayers.Util.applyDefaults(a,{pointRadius:e.pointRadius});if(a.stroke===true||a.graphic===true)OpenLayers.Util.applyDefaults(a,{strokeWidth:e.strokeWidth,strokeColor:e.strokeColor,strokeOpacity:e.strokeOpacity,strokeDashstyle:e.strokeDashstyle,strokeLinecap:e.strokeLinecap});if(a.fill===true||a.graphic===true)OpenLayers.Util.applyDefaults(a,{fillColor:e.fillColor,fillOpacity:e.fillOpacity});
a.graphic===true&&OpenLayers.Util.applyDefaults(a,{pointRadius:this.defaultStyle.pointRadius,externalGraphic:this.defaultStyle.externalGraphic,graphicName:this.defaultStyle.graphicName,graphicOpacity:this.defaultStyle.graphicOpacity,graphicWidth:this.defaultStyle.graphicWidth,graphicHeight:this.defaultStyle.graphicHeight,graphicXOffset:this.defaultStyle.graphicXOffset,graphicYOffset:this.defaultStyle.graphicYOffset})}return this.createLiterals(OpenLayers.Util.extend(b,a),d)},createLiterals:function(a,
b){var d=OpenLayers.Util.extend({},b.attributes||b.data);OpenLayers.Util.extend(d,this.context);for(var e in this.propertyStyles)a[e]=OpenLayers.Style.createLiteral(a[e],d,b,e);return a},findPropertyStyles:function(){var a={};this.addPropertyStyles(a,this.defaultStyle);for(var b=this.rules,d,e,f=0,g=b.length;f<g;f++){d=b[f].symbolizer;for(var h in d){e=d[h];if(typeof e=="object")this.addPropertyStyles(a,e);else{this.addPropertyStyles(a,d);break}}}return a},addPropertyStyles:function(a,b){var d;for(var e in b){d=
b[e];if(typeof d=="string"&&d.match(/\$\{\w+\}/))a[e]=true}return a},addRules:function(a){this.rules=this.rules.concat(a);this.propertyStyles=this.findPropertyStyles()},setDefaultStyle:function(a){this.defaultStyle=a;this.propertyStyles=this.findPropertyStyles()},getSymbolizerPrefix:function(a){for(var b=OpenLayers.Style.SYMBOLIZER_PREFIXES,d=0,e=b.length;d<e;d++)if(a.CLASS_NAME.indexOf(b[d])!=-1)return b[d]},CLASS_NAME:"OpenLayers.Style"});
OpenLayers.Style.createLiteral=function(a,b,d,e){if(typeof a=="string"&&a.indexOf("${")!=-1){a=OpenLayers.String.format(a,b,[d,e]);a=isNaN(a)||!a?a:parseFloat(a)}return a};OpenLayers.Style.SYMBOLIZER_PREFIXES=["Point","Line","Polygon","Text"];
OpenLayers.StyleMap=OpenLayers.Class({styles:null,extendDefault:true,initialize:function(a,b){this.styles={"default":new OpenLayers.Style(OpenLayers.Feature.Vector.style["default"]),select:new OpenLayers.Style(OpenLayers.Feature.Vector.style.select),temporary:new OpenLayers.Style(OpenLayers.Feature.Vector.style.temporary),"delete":new OpenLayers.Style(OpenLayers.Feature.Vector.style["delete"])};if(a instanceof OpenLayers.Style){this.styles["default"]=a;this.styles.select=a;this.styles.temporary=a;
this.styles["delete"]=a}else if(typeof a=="object")for(var d in a)if(a[d]instanceof OpenLayers.Style)this.styles[d]=a[d];else if(typeof a[d]=="object")this.styles[d]=new OpenLayers.Style(a[d]);else{this.styles["default"]=new OpenLayers.Style(a);this.styles.select=new OpenLayers.Style(a);this.styles.temporary=new OpenLayers.Style(a);this.styles["delete"]=new OpenLayers.Style(a);break}OpenLayers.Util.extend(this,b)},destroy:function(){for(var a in this.styles)this.styles[a].destroy();this.styles=null},
createSymbolizer:function(a,b){a||(a=new OpenLayers.Feature.Vector);this.styles[b]||(b="default");a.renderIntent=b;var d={};if(this.extendDefault&&b!="default")d=this.styles["default"].createSymbolizer(a);return OpenLayers.Util.extend(d,this.styles[b].createSymbolizer(a))},addUniqueValueRules:function(a,b,d,e){var f=[];for(var g in d)f.push(new OpenLayers.Rule({symbolizer:d[g],context:e,filter:new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.EQUAL_TO,property:b,value:g})}));this.styles[a].addRules(f)},
CLASS_NAME:"OpenLayers.StyleMap"});OpenLayers.Format=OpenLayers.Class({options:null,externalProjection:null,internalProjection:null,data:null,keepData:false,initialize:function(a){OpenLayers.Util.extend(this,a);this.options=a},destroy:function(){},read:function(){OpenLayers.Console.userError(OpenLayers.i18n("readNotImplemented"))},write:function(){OpenLayers.Console.userError(OpenLayers.i18n("writeNotImplemented"))},CLASS_NAME:"OpenLayers.Format"});
OpenLayers.Format.XML=OpenLayers.Class(OpenLayers.Format,{namespaces:null,namespaceAlias:null,defaultPrefix:null,readers:{},writers:{},xmldom:null,initialize:function(a){if(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("<");if(b>0)a=a.substring(b);b=OpenLayers.Util.Try(OpenLayers.Function.bind(function(){var d;d=window.ActiveXObject&&!this.xmldom?new ActiveXObject("Microsoft.XMLDOM"):this.xmldom;d.loadXML(a);return d},this),function(){return(new DOMParser).parseFromString(a,"text/xml")},function(){var d=new XMLHttpRequest;d.open("GET","data:text/xml;charset=utf-8,"+encodeURIComponent(a),false);
d.overrideMimeType&&d.overrideMimeType("text/xml");d.send(null);return d.responseXML});if(this.keepData)this.data=b;return b},write:function(a){if(this.xmldom)a=a.xml;else{var b=new XMLSerializer;if(a.nodeType==1){var d=document.implementation.createDocument("","",null);if(d.importNode)a=d.importNode(a,true);d.appendChild(a);a=b.serializeToString(d)}else a=b.serializeToString(a)}return a},createElementNS:function(a,b){return this.xmldom?typeof a=="string"?this.xmldom.createNode(1,b,a):this.xmldom.createNode(1,
b,""):document.createElementNS(a,b)},createTextNode:function(a){return this.xmldom?this.xmldom.createTextNode(a):document.createTextNode(a)},getElementsByTagNameNS:function(a,b,d){var e=[];if(a.getElementsByTagNameNS)e=a.getElementsByTagNameNS(b,d);else{a=a.getElementsByTagName("*");for(var f,g,h=0,j=a.length;h<j;++h){f=a[h];g=f.prefix?f.prefix+":"+d:d;if(d=="*"||g==f.nodeName)if(b=="*"||b==f.namespaceURI)e.push(f)}}return e},getAttributeNodeNS:function(a,b,d){var e=null;if(a.getAttributeNodeNS)e=
a.getAttributeNodeNS(b,d);else{a=a.attributes;for(var f,g,h=0,j=a.length;h<j;++h){f=a[h];if(f.namespaceURI==b){g=f.prefix?f.prefix+":"+d:d;if(g==f.nodeName){e=f;break}}}}return e},getAttributeNS:function(a,b,d){var e="";if(a.getAttributeNS)e=a.getAttributeNS(b,d)||"";else if(a=this.getAttributeNodeNS(a,b,d))e=a.nodeValue;return e},getChildValue:function(a,b){var d=b||"";if(a)for(var e=a.firstChild;e;e=e.nextSibling)switch(e.nodeType){case 3:case 4:d+=e.nodeValue}return d},concatChildValues:function(a,
b){for(var d="",e=a.firstChild,f;e;){if(f=e.nodeValue)d+=f;e=e.nextSibling}if(d==""&&b!=undefined)d=b;return d},isSimpleContent:function(a){var b=true;for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType===1){b=false;break}return b},contentType:function(a){var b=false,d=false,e=OpenLayers.Format.XML.CONTENT_TYPE.EMPTY;for(a=a.firstChild;a;a=a.nextSibling){switch(a.nodeType){case 1:d=true;break;case 8:break;default:b=true}if(d&&b)break}if(d&&b)e=OpenLayers.Format.XML.CONTENT_TYPE.MIXED;else if(d)return OpenLayers.Format.XML.CONTENT_TYPE.COMPLEX;
else if(b)return OpenLayers.Format.XML.CONTENT_TYPE.SIMPLE;return e},hasAttributeNS:function(a,b,d){var e=false;return e=a.hasAttributeNS?a.hasAttributeNS(b,d):!!this.getAttributeNodeNS(a,b,d)},setAttributeNS:function(a,b,d,e){if(a.setAttributeNS)a.setAttributeNS(b,d,e);else if(this.xmldom)if(b){b=a.ownerDocument.createNode(2,d,b);b.nodeValue=e;a.setAttributeNode(b)}else a.setAttribute(d,e);else throw"setAttributeNS not implemented";},createElementNSPlus:function(a,b){b=b||{};var d=b.uri||this.namespaces[b.prefix];
if(!d){d=a.indexOf(":");d=this.namespaces[a.substring(0,d)]}d||(d=this.namespaces[this.defaultPrefix]);d=this.createElementNS(d,a);b.attributes&&this.setAttributes(d,b.attributes);var e=b.value;if(e!=null){if(typeof e=="boolean")e=String(e);d.appendChild(this.createTextNode(e))}return d},setAttributes:function(a,b){var d,e;for(var f in b)if(b[f]!=null&&b[f].toString){d=b[f].toString();e=this.namespaces[f.substring(0,f.indexOf(":"))]||null;this.setAttributeNS(a,e,f,d)}},readNode:function(a,b){b||(b=
{});var d=this.readers[a.namespaceURI?this.namespaceAlias[a.namespaceURI]:this.defaultPrefix];if(d){var e=a.localName||a.nodeName.split(":").pop();(d=d[e]||d["*"])&&d.apply(this,[a,b])}return b},readChildNodes:function(a,b){b||(b={});for(var d=a.childNodes,e,f=0,g=d.length;f<g;++f){e=d[f];e.nodeType==1&&this.readNode(e,b)}return b},writeNode:function(a,b,d){var e,f=a.indexOf(":");if(f>0){e=a.substring(0,f);a=a.substring(f+1)}else{e=d?this.namespaceAlias[d.namespaceURI]:this.defaultPrefix;a=a}b=this.writers[e][a].apply(this,
[b]);d&&d.appendChild(b);return b},getChildEl:function(a,b,d){return a&&this.getThisOrNextEl(a.firstChild,b,d)},getNextEl:function(a,b,d){return a&&this.getThisOrNextEl(a.nextSibling,b,d)},getThisOrNextEl:function(a,b,d){a=a;a:for(;a;a=a.nextSibling)switch(a.nodeType){case 1:if((!b||b===(a.localName||a.nodeName.split(":").pop()))&&(!d||d===a.namespaceURI))break a;a=null;break a;case 3:if(/^\s*$/.test(a.nodeValue))break;case 4:case 6:case 12:case 10:case 11:a=null;break a}return a||null},lookupNamespaceURI:function(a,
b){var d=null;if(a)if(a.lookupNamespaceURI)d=a.lookupNamespaceURI(b);else a:switch(a.nodeType){case 1:if(a.namespaceURI!==null&&a.prefix===b){d=a.namespaceURI;break a}if(d=a.attributes.length)for(var e,f=0;f<d;++f){e=a.attributes[f];if(e.prefix==="xmlns"&&e.name==="xmlns:"+b){d=e.value||null;break a}else if(e.name==="xmlns"&&b===null){d=e.value||null;break a}}d=this.lookupNamespaceURI(a.parentNode,b);break a;case 2:d=this.lookupNamespaceURI(a.ownerElement,b);break a;case 9:d=this.lookupNamespaceURI(a.documentElement,
b);break a;case 6:case 12:case 10:case 11:break a;default:d=this.lookupNamespaceURI(a.parentNode,b);break a}return d},CLASS_NAME:"OpenLayers.Format.XML"});OpenLayers.Format.XML.CONTENT_TYPE={EMPTY:0,SIMPLE:1,COMPLEX:2,MIXED:3};OpenLayers.Format.XML.lookupNamespaceURI=OpenLayers.Function.bind(OpenLayers.Format.XML.prototype.lookupNamespaceURI,OpenLayers.Format.XML.prototype);
OpenLayers.Format.GML=OpenLayers.Class(OpenLayers.Format.XML,{featureNS:"http://mapserver.gis.umn.edu/mapserver",featurePrefix:"feature",featureName:"featureMember",layerName:"features",geometryName:"geometry",collectionName:"FeatureCollection",gmlns:"http://www.opengis.net/gml",extractAttributes:true,xy:true,initialize:function(a){this.regExes={trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g};OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},read:function(a){if(typeof a==
"string")a=OpenLayers.Format.XML.prototype.read.apply(this,[a]);a=this.getElementsByTagNameNS(a.documentElement,this.gmlns,this.featureName);for(var b=[],d=0;d<a.length;d++){var e=this.parseFeature(a[d]);e&&b.push(e)}return b},parseFeature:function(a){for(var b=["MultiPolygon","Polygon","MultiLineString","LineString","MultiPoint","Point","Envelope","Box"],d,e,f,g=0;g<b.length;++g){d=b[g];e=this.getElementsByTagNameNS(a,this.gmlns,d);if(e.length>0){if(b=this.parseGeometry[d.toLowerCase()]){f=b.apply(this,
[e[0]]);this.internalProjection&&this.externalProjection&&f.transform(this.externalProjection,this.internalProjection)}else OpenLayers.Console.error(OpenLayers.i18n("unsupportedGeometryType",{geomType:d}));break}}var h;if(this.extractAttributes)h=this.parseAttributes(a);d=new OpenLayers.Feature.Vector(f,h);d.gml={featureType:a.firstChild.nodeName.split(":")[1],featureNS:a.firstChild.namespaceURI,featureNSPrefix:a.firstChild.prefix};e=this.getElementsByTagNameNS(a,this.gmlns,"boundedBy");if(e.length===
1)if(b=this.parseGeometry.box)d.bounds=b.apply(this,[e[0]]);a=a.firstChild;for(var j;a;){if(a.nodeType==1)if(j=a.getAttribute("fid")||a.getAttribute("id"))break;a=a.nextSibling}d.fid=j;return d},parseGeometry:{point:function(a){var b,d;d=[];b=this.getElementsByTagNameNS(a,this.gmlns,"pos");if(b.length>0){d=b[0].firstChild.nodeValue;d=d.replace(this.regExes.trimSpace,"");d=d.split(this.regExes.splitSpace)}if(d.length==0){b=this.getElementsByTagNameNS(a,this.gmlns,"coordinates");if(b.length>0){d=b[0].firstChild.nodeValue;
d=d.replace(this.regExes.removeSpace,"");d=d.split(",")}}if(d.length==0){b=this.getElementsByTagNameNS(a,this.gmlns,"coord");if(b.length>0){a=this.getElementsByTagNameNS(b[0],this.gmlns,"X");b=this.getElementsByTagNameNS(b[0],this.gmlns,"Y");if(a.length>0&&b.length>0)d=[a[0].firstChild.nodeValue,b[0].firstChild.nodeValue]}}if(d.length==2)d[2]=null;return this.xy?new OpenLayers.Geometry.Point(d[0],d[1],d[2]):new OpenLayers.Geometry.Point(d[1],d[0],d[2])},multipoint:function(a){a=this.getElementsByTagNameNS(a,
this.gmlns,"Point");var b=[];if(a.length>0)for(var d,e=0;e<a.length;++e)(d=this.parseGeometry.point.apply(this,[a[e]]))&&b.push(d);return new OpenLayers.Geometry.MultiPoint(b)},linestring:function(a,b){var d,e;e=[];var f=[];d=this.getElementsByTagNameNS(a,this.gmlns,"posList");if(d.length>0){e=this.getChildValue(d[0]);e=e.replace(this.regExes.trimSpace,"");e=e.split(this.regExes.splitSpace);var g=parseInt(d[0].getAttribute("dimension")),h,j,l;for(d=0;d<e.length/g;++d){h=d*g;j=e[h];l=e[h+1];h=g==2?
null:e[h+2];this.xy?f.push(new OpenLayers.Geometry.Point(j,l,h)):f.push(new OpenLayers.Geometry.Point(l,j,h))}}if(e.length==0){d=this.getElementsByTagNameNS(a,this.gmlns,"coordinates");if(d.length>0){e=this.getChildValue(d[0]);e=e.replace(this.regExes.trimSpace,"");e=e.replace(this.regExes.trimComma,",");g=e.split(this.regExes.splitSpace);for(d=0;d<g.length;++d){e=g[d].split(",");if(e.length==2)e[2]=null;this.xy?f.push(new OpenLayers.Geometry.Point(e[0],e[1],e[2])):f.push(new OpenLayers.Geometry.Point(e[1],
e[0],e[2]))}}}e=null;if(f.length!=0)e=b?new OpenLayers.Geometry.LinearRing(f):new OpenLayers.Geometry.LineString(f);return e},multilinestring:function(a){a=this.getElementsByTagNameNS(a,this.gmlns,"LineString");var b=[];if(a.length>0)for(var d,e=0;e<a.length;++e)(d=this.parseGeometry.linestring.apply(this,[a[e]]))&&b.push(d);return new OpenLayers.Geometry.MultiLineString(b)},polygon:function(a){a=this.getElementsByTagNameNS(a,this.gmlns,"LinearRing");var b=[];if(a.length>0)for(var d,e=0;e<a.length;++e)(d=
this.parseGeometry.linestring.apply(this,[a[e],true]))&&b.push(d);return new OpenLayers.Geometry.Polygon(b)},multipolygon:function(a){a=this.getElementsByTagNameNS(a,this.gmlns,"Polygon");var b=[];if(a.length>0)for(var d,e=0;e<a.length;++e)(d=this.parseGeometry.polygon.apply(this,[a[e]]))&&b.push(d);return new OpenLayers.Geometry.MultiPolygon(b)},envelope:function(a){var b=[],d,e,f=this.getElementsByTagNameNS(a,this.gmlns,"lowerCorner");if(f.length>0){d=[];if(f.length>0){d=f[0].firstChild.nodeValue;
d=d.replace(this.regExes.trimSpace,"");d=d.split(this.regExes.splitSpace)}if(d.length==2)d[2]=null;var g=this.xy?new OpenLayers.Geometry.Point(d[0],d[1],d[2]):new OpenLayers.Geometry.Point(d[1],d[0],d[2])}a=this.getElementsByTagNameNS(a,this.gmlns,"upperCorner");if(a.length>0){d=[];if(a.length>0){d=a[0].firstChild.nodeValue;d=d.replace(this.regExes.trimSpace,"");d=d.split(this.regExes.splitSpace)}if(d.length==2)d[2]=null;var h=this.xy?new OpenLayers.Geometry.Point(d[0],d[1],d[2]):new OpenLayers.Geometry.Point(d[1],
d[0],d[2])}if(g&&h){b.push(new OpenLayers.Geometry.Point(g.x,g.y));b.push(new OpenLayers.Geometry.Point(h.x,g.y));b.push(new OpenLayers.Geometry.Point(h.x,h.y));b.push(new OpenLayers.Geometry.Point(g.x,h.y));b.push(new OpenLayers.Geometry.Point(g.x,g.y));b=new OpenLayers.Geometry.LinearRing(b);e=new OpenLayers.Geometry.Polygon([b])}return e},box:function(a){var b=this.getElementsByTagNameNS(a,this.gmlns,"coordinates");var d=a=null;if(b.length>0){b=b[0].firstChild.nodeValue;b=b.split(" ");if(b.length==
2){a=b[0].split(",");d=b[1].split(",")}}if(a!==null&&d!==null)return new OpenLayers.Bounds(parseFloat(a[0]),parseFloat(a[1]),parseFloat(d[0]),parseFloat(d[1]))}},parseAttributes:function(a){var b={};a=a.firstChild;for(var d,e,f;a;){if(a.nodeType==1){a=a.childNodes;for(d=0;d<a.length;++d){e=a[d];if(e.nodeType==1){f=e.childNodes;if(f.length==1){f=f[0];if(f.nodeType==3||f.nodeType==4){e=e.prefix?e.nodeName.split(":")[1]:e.nodeName;f=f.nodeValue.replace(this.regExes.trimSpace,"");b[e]=f}}else b[e.nodeName.split(":").pop()]=
null}}break}a=a.nextSibling}return b},write:function(a){a instanceof Array||(a=[a]);for(var b=this.createElementNS("http://www.opengis.net/wfs","wfs:"+this.collectionName),d=0;d<a.length;d++)b.appendChild(this.createFeatureXML(a[d]));return OpenLayers.Format.XML.prototype.write.apply(this,[b])},createFeatureXML:function(a){var b=this.buildGeometryNode(a.geometry),d=this.createElementNS(this.featureNS,this.featurePrefix+":"+this.geometryName);d.appendChild(b);b=this.createElementNS(this.gmlns,"gml:"+
this.featureName);var e=this.createElementNS(this.featureNS,this.featurePrefix+":"+this.layerName);e.setAttribute("fid",a.fid||a.id);e.appendChild(d);for(var f in a.attributes){d=this.createTextNode(a.attributes[f]);var g=this.createElementNS(this.featureNS,this.featurePrefix+":"+f.substring(f.lastIndexOf(":")+1));g.appendChild(d);e.appendChild(g)}b.appendChild(e);return b},buildGeometryNode:function(a){if(this.externalProjection&&this.internalProjection){a=a.clone();a.transform(this.internalProjection,
this.externalProjection)}var b=a.CLASS_NAME;return this.buildGeometry[b.substring(b.lastIndexOf(".")+1).toLowerCase()].apply(this,[a])},buildGeometry:{point:function(a){var b=this.createElementNS(this.gmlns,"gml:Point");b.appendChild(this.buildCoordinatesNode(a));return b},multipoint:function(a){var b=this.createElementNS(this.gmlns,"gml:MultiPoint");a=a.components;for(var d,e,f=0;f<a.length;f++){d=this.createElementNS(this.gmlns,"gml:pointMember");e=this.buildGeometry.point.apply(this,[a[f]]);d.appendChild(e);
b.appendChild(d)}return b},linestring:function(a){var b=this.createElementNS(this.gmlns,"gml:LineString");b.appendChild(this.buildCoordinatesNode(a));return b},multilinestring:function(a){var b=this.createElementNS(this.gmlns,"gml:MultiLineString");a=a.components;for(var d,e,f=0;f<a.length;++f){d=this.createElementNS(this.gmlns,"gml:lineStringMember");e=this.buildGeometry.linestring.apply(this,[a[f]]);d.appendChild(e);b.appendChild(d)}return b},linearring:function(a){var b=this.createElementNS(this.gmlns,
"gml:LinearRing");b.appendChild(this.buildCoordinatesNode(a));return b},polygon:function(a){var b=this.createElementNS(this.gmlns,"gml:Polygon");a=a.components;for(var d,e,f=0;f<a.length;++f){d=this.createElementNS(this.gmlns,"gml:"+(f==0?"outerBoundaryIs":"innerBoundaryIs"));e=this.buildGeometry.linearring.apply(this,[a[f]]);d.appendChild(e);b.appendChild(d)}return b},multipolygon:function(a){var b=this.createElementNS(this.gmlns,"gml:MultiPolygon");a=a.components;for(var d,e,f=0;f<a.length;++f){d=
this.createElementNS(this.gmlns,"gml:polygonMember");e=this.buildGeometry.polygon.apply(this,[a[f]]);d.appendChild(e);b.appendChild(d)}return b},bounds:function(a){var b=this.createElementNS(this.gmlns,"gml:Box");b.appendChild(this.buildCoordinatesNode(a));return b}},buildCoordinatesNode:function(a){var b=this.createElementNS(this.gmlns,"gml:coordinates");b.setAttribute("decimal",".");b.setAttribute("cs",",");b.setAttribute("ts"," ");var d=[];if(a instanceof OpenLayers.Bounds){d.push(a.left+","+a.bottom);
d.push(a.right+","+a.top)}else{a=a.components?a.components:[a];for(var e=0;e<a.length;e++)d.push(a[e].x+","+a[e].y)}d=this.createTextNode(d.join(" "));b.appendChild(d);return b},CLASS_NAME:"OpenLayers.Format.GML"});if(!OpenLayers.Format.GML)OpenLayers.Format.GML={};
OpenLayers.Format.GML.Base=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{gml:"http://www.opengis.net/gml",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance",wfs:"http://www.opengis.net/wfs"},defaultPrefix:"gml",schemaLocation:null,featureType:null,featureNS:null,geometryName:"geometry",extractAttributes:true,srsName:null,xy:true,geometryTypes:null,singleFeatureType:null,regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g},
initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a]);this.setGeometryTypes();a&&a.featureNS&&this.setNamespace("feature",a.featureNS);this.singleFeatureType=!a||typeof a.featureType==="string"},read:function(a){if(typeof a=="string")a=OpenLayers.Format.XML.prototype.read.apply(this,[a]);if(a&&a.nodeType==9)a=a.documentElement;var b=[];this.readNode(a,{features:b});if(b.length==0){var d=this.getElementsByTagNameNS(a,this.namespaces.gml,"featureMember");if(d.length){a=0;
for(var e=d.length;a<e;++a)this.readNode(d[a],{features:b})}else{d=this.getElementsByTagNameNS(a,this.namespaces.gml,"featureMembers");d.length&&this.readNode(d[0],{features:b})}}return b},readers:{gml:{featureMember:function(a,b){this.readChildNodes(a,b)},featureMembers:function(a,b){this.readChildNodes(a,b)},name:function(a,b){b.name=this.getChildValue(a)},boundedBy:function(a,b){var d={};this.readChildNodes(a,d);if(d.components&&d.components.length>0)b.bounds=d.components[0]},Point:function(a,
b){var d={points:[]};this.readChildNodes(a,d);if(!b.components)b.components=[];b.components.push(d.points[0])},coordinates:function(a,b){var d=this.getChildValue(a).replace(this.regExes.trimSpace,"");d=d.replace(this.regExes.trimComma,",");d=d.split(this.regExes.splitSpace);for(var e,f=d.length,g=new Array(f),h=0;h<f;++h){e=d[h].split(",");g[h]=this.xy?new OpenLayers.Geometry.Point(e[0],e[1],e[2]):new OpenLayers.Geometry.Point(e[1],e[0],e[2])}b.points=g},coord:function(a,b){var d={};this.readChildNodes(a,
d);if(!b.points)b.points=[];b.points.push(new OpenLayers.Geometry.Point(d.x,d.y,d.z))},X:function(a,b){b.x=this.getChildValue(a)},Y:function(a,b){b.y=this.getChildValue(a)},Z:function(a,b){b.z=this.getChildValue(a)},MultiPoint:function(a,b){var d={components:[]};this.readChildNodes(a,d);b.components=[new OpenLayers.Geometry.MultiPoint(d.components)]},pointMember:function(a,b){this.readChildNodes(a,b)},LineString:function(a,b){var d={};this.readChildNodes(a,d);if(!b.components)b.components=[];b.components.push(new OpenLayers.Geometry.LineString(d.points))},
MultiLineString:function(a,b){var d={components:[]};this.readChildNodes(a,d);b.components=[new OpenLayers.Geometry.MultiLineString(d.components)]},lineStringMember:function(a,b){this.readChildNodes(a,b)},Polygon:function(a,b){var d={outer:null,inner:[]};this.readChildNodes(a,d);d.inner.unshift(d.outer);if(!b.components)b.components=[];b.components.push(new OpenLayers.Geometry.Polygon(d.inner))},LinearRing:function(a,b){var d={};this.readChildNodes(a,d);b.components=[new OpenLayers.Geometry.LinearRing(d.points)]},
MultiPolygon:function(a,b){var d={components:[]};this.readChildNodes(a,d);b.components=[new OpenLayers.Geometry.MultiPolygon(d.components)]},polygonMember:function(a,b){this.readChildNodes(a,b)},GeometryCollection:function(a,b){var d={components:[]};this.readChildNodes(a,d);b.components=[new OpenLayers.Geometry.Collection(d.components)]},geometryMember:function(a,b){this.readChildNodes(a,b)}},feature:{"*":function(a,b){var d,e=a.localName||a.nodeName.split(":").pop();if(b.features)if(!this.singleFeatureType&&
OpenLayers.Util.indexOf(this.featureType,e)!==-1)d="_typeName";else{if(e===this.featureType)d="_typeName"}else if(a.childNodes.length==0||a.childNodes.length==1&&a.firstChild.nodeType==3){if(this.extractAttributes)d="_attribute"}else d="_geometry";d&&this.readers.feature[d].apply(this,[a,b])},_typeName:function(a,b){var d={components:[],attributes:{}};this.readChildNodes(a,d);if(d.name)d.attributes.name=d.name;var e=new OpenLayers.Feature.Vector(d.components[0],d.attributes);if(!this.singleFeatureType){e.type=
a.nodeName.split(":").pop();e.namespace=a.namespaceURI}var f=a.getAttribute("fid")||this.getAttributeNS(a,this.namespaces.gml,"id");if(f)e.fid=f;this.internalProjection&&this.externalProjection&&e.geometry&&e.geometry.transform(this.externalProjection,this.internalProjection);if(d.bounds)e.bounds=d.bounds;b.features.push(e)},_geometry:function(a,b){this.readChildNodes(a,b)},_attribute:function(a,b){var d=a.localName||a.nodeName.split(":").pop(),e=this.getChildValue(a);b.attributes[d]=e}},wfs:{FeatureCollection:function(a,
b){this.readChildNodes(a,b)}}},write:function(a){a=this.writeNode("gml:"+(a instanceof Array?"featureMembers":"featureMember"),a);this.setAttributeNS(a,this.namespaces.xsi,"xsi:schemaLocation",this.schemaLocation);return OpenLayers.Format.XML.prototype.write.apply(this,[a])},writers:{gml:{featureMember:function(a){var b=this.createElementNSPlus("gml:featureMember");this.writeNode("feature:_typeName",a,b);return b},MultiPoint:function(a){for(var b=this.createElementNSPlus("gml:MultiPoint"),d=0;d<a.components.length;++d)this.writeNode("pointMember",
a.components[d],b);return b},pointMember:function(a){var b=this.createElementNSPlus("gml:pointMember");this.writeNode("Point",a,b);return b},MultiLineString:function(a){for(var b=this.createElementNSPlus("gml:MultiLineString"),d=0;d<a.components.length;++d)this.writeNode("lineStringMember",a.components[d],b);return b},lineStringMember:function(a){var b=this.createElementNSPlus("gml:lineStringMember");this.writeNode("LineString",a,b);return b},MultiPolygon:function(a){for(var b=this.createElementNSPlus("gml:MultiPolygon"),
d=0;d<a.components.length;++d)this.writeNode("polygonMember",a.components[d],b);return b},polygonMember:function(a){var b=this.createElementNSPlus("gml:polygonMember");this.writeNode("Polygon",a,b);return b},GeometryCollection:function(a){for(var b=this.createElementNSPlus("gml:GeometryCollection"),d=0,e=a.components.length;d<e;++d)this.writeNode("geometryMember",a.components[d],b);return b},geometryMember:function(a){var b=this.createElementNSPlus("gml:geometryMember");a=this.writeNode("feature:_geometry",
a);b.appendChild(a.firstChild);return b}},feature:{_typeName:function(a){var b=this.createElementNSPlus("feature:"+this.featureType,{attributes:{fid:a.fid}});a.geometry&&this.writeNode("feature:_geometry",a.geometry,b);for(var d in a.attributes){var e=a.attributes[d];e!=null&&this.writeNode("feature:_attribute",{name:d,value:e},b)}return b},_geometry:function(a){if(this.externalProjection&&this.internalProjection)a=a.clone().transform(this.internalProjection,this.externalProjection);var b=this.createElementNSPlus("feature:"+
this.geometryName);a=this.writeNode("gml:"+this.geometryTypes[a.CLASS_NAME],a,b);this.srsName&&a.setAttribute("srsName",this.srsName);return b},_attribute:function(a){return this.createElementNSPlus("feature:"+a.name,{value:a.value})}},wfs:{FeatureCollection:function(a){for(var b=this.createElementNSPlus("wfs:FeatureCollection"),d=0,e=a.length;d<e;++d)this.writeNode("gml:featureMember",a[d],b);return b}}},setGeometryTypes:function(){this.geometryTypes={"OpenLayers.Geometry.Point":"Point","OpenLayers.Geometry.MultiPoint":"MultiPoint",
"OpenLayers.Geometry.LineString":"LineString","OpenLayers.Geometry.MultiLineString":"MultiLineString","OpenLayers.Geometry.Polygon":"Polygon","OpenLayers.Geometry.MultiPolygon":"MultiPolygon","OpenLayers.Geometry.Collection":"GeometryCollection"}},CLASS_NAME:"OpenLayers.Format.GML.Base"});
OpenLayers.Format.GML.v2=OpenLayers.Class(OpenLayers.Format.GML.Base,{schemaLocation:"http://www.opengis.net/gml http://schemas.opengis.net/gml/2.1.2/feature.xsd",initialize:function(a){OpenLayers.Format.GML.Base.prototype.initialize.apply(this,[a])},readers:{gml:OpenLayers.Util.applyDefaults({outerBoundaryIs:function(a,b){var d={};this.readChildNodes(a,d);b.outer=d.components[0]},innerBoundaryIs:function(a,b){var d={};this.readChildNodes(a,d);b.inner.push(d.components[0])},Box:function(a,b){var d=
{};this.readChildNodes(a,d);if(!b.components)b.components=[];var e=d.points[0];d=d.points[1];b.components.push(new OpenLayers.Bounds(e.x,e.y,d.x,d.y))}},OpenLayers.Format.GML.Base.prototype.readers.gml),feature:OpenLayers.Format.GML.Base.prototype.readers.feature,wfs:OpenLayers.Format.GML.Base.prototype.readers.wfs},write:function(a){a=this.writeNode(a instanceof Array?"wfs:FeatureCollection":"gml:featureMember",a);this.setAttributeNS(a,this.namespaces.xsi,"xsi:schemaLocation",this.schemaLocation);
return OpenLayers.Format.XML.prototype.write.apply(this,[a])},writers:{gml:OpenLayers.Util.applyDefaults({Point:function(a){var b=this.createElementNSPlus("gml:Point");this.writeNode("coordinates",[a],b);return b},coordinates:function(a){for(var b=a.length,d=new Array(b),e,f=0;f<b;++f){e=a[f];d[f]=this.xy?e.x+","+e.y:e.y+","+e.x;if(e.z!=undefined)d[f]+=","+e.z}return this.createElementNSPlus("gml:coordinates",{attributes:{decimal:".",cs:",",ts:" "},value:b==1?d[0]:d.join(" ")})},LineString:function(a){var b=
this.createElementNSPlus("gml:LineString");this.writeNode("coordinates",a.components,b);return b},Polygon:function(a){var b=this.createElementNSPlus("gml:Polygon");this.writeNode("outerBoundaryIs",a.components[0],b);for(var d=1;d<a.components.length;++d)this.writeNode("innerBoundaryIs",a.components[d],b);return b},outerBoundaryIs:function(a){var b=this.createElementNSPlus("gml:outerBoundaryIs");this.writeNode("LinearRing",a,b);return b},innerBoundaryIs:function(a){var b=this.createElementNSPlus("gml:innerBoundaryIs");
this.writeNode("LinearRing",a,b);return b},LinearRing:function(a){var b=this.createElementNSPlus("gml:LinearRing");this.writeNode("coordinates",a.components,b);return b},Box:function(a){var b=this.createElementNSPlus("gml:Box");this.writeNode("coordinates",[{x:a.left,y:a.bottom},{x:a.right,y:a.top}],b);this.srsName&&b.setAttribute("srsName",this.srsName);return b}},OpenLayers.Format.GML.Base.prototype.writers.gml),feature:OpenLayers.Format.GML.Base.prototype.writers.feature,wfs:OpenLayers.Format.GML.Base.prototype.writers.wfs},
CLASS_NAME:"OpenLayers.Format.GML.v2"});
OpenLayers.Format.GML.v3=OpenLayers.Class(OpenLayers.Format.GML.Base,{schemaLocation:"http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd",curve:false,multiCurve:true,surface:false,multiSurface:true,initialize:function(a){OpenLayers.Format.GML.Base.prototype.initialize.apply(this,[a])},readers:{gml:OpenLayers.Util.applyDefaults({featureMembers:function(a,b){this.readChildNodes(a,b)},Curve:function(a,b){var d={points:[]};this.readChildNodes(a,d);if(!b.components)b.components=
[];b.components.push(new OpenLayers.Geometry.LineString(d.points))},segments:function(a,b){this.readChildNodes(a,b)},LineStringSegment:function(a,b){var d={};this.readChildNodes(a,d);d.points&&Array.prototype.push.apply(b.points,d.points)},pos:function(a,b){var d=this.getChildValue(a).replace(this.regExes.trimSpace,"").split(this.regExes.splitSpace);d=this.xy?new OpenLayers.Geometry.Point(d[0],d[1],d[2]):new OpenLayers.Geometry.Point(d[1],d[0],d[2]);b.points=[d]},posList:function(a,b){for(var d=this.getChildValue(a).replace(this.regExes.trimSpace,
"").split(this.regExes.splitSpace),e=parseInt(a.getAttribute("dimension"))||2,f,g,h,j=new Array(d.length/e),l=0,m=d.length;l<m;l+=e){f=d[l];g=d[l+1];h=e==2?undefined:d[l+2];j[l/e]=this.xy?new OpenLayers.Geometry.Point(f,g,h):new OpenLayers.Geometry.Point(g,f,h)}b.points=j},Surface:function(a,b){this.readChildNodes(a,b)},patches:function(a,b){this.readChildNodes(a,b)},PolygonPatch:function(a,b){this.readers.gml.Polygon.apply(this,[a,b])},exterior:function(a,b){var d={};this.readChildNodes(a,d);b.outer=
d.components[0]},interior:function(a,b){var d={};this.readChildNodes(a,d);b.inner.push(d.components[0])},MultiCurve:function(a,b){var d={components:[]};this.readChildNodes(a,d);if(d.components.length>0)b.components=[new OpenLayers.Geometry.MultiLineString(d.components)]},curveMember:function(a,b){this.readChildNodes(a,b)},MultiSurface:function(a,b){var d={components:[]};this.readChildNodes(a,d);if(d.components.length>0)b.components=[new OpenLayers.Geometry.MultiPolygon(d.components)]},surfaceMember:function(a,
b){this.readChildNodes(a,b)},surfaceMembers:function(a,b){this.readChildNodes(a,b)},pointMembers:function(a,b){this.readChildNodes(a,b)},lineStringMembers:function(a,b){this.readChildNodes(a,b)},polygonMembers:function(a,b){this.readChildNodes(a,b)},geometryMembers:function(a,b){this.readChildNodes(a,b)},Envelope:function(a,b){var d={points:new Array(2)};this.readChildNodes(a,d);if(!b.components)b.components=[];var e=d.points[0];d=d.points[1];b.components.push(new OpenLayers.Bounds(e.x,e.y,d.x,d.y))},
lowerCorner:function(a,b){var d={};this.readers.gml.pos.apply(this,[a,d]);b.points[0]=d.points[0]},upperCorner:function(a,b){var d={};this.readers.gml.pos.apply(this,[a,d]);b.points[1]=d.points[0]}},OpenLayers.Format.GML.Base.prototype.readers.gml),feature:OpenLayers.Format.GML.Base.prototype.readers.feature,wfs:OpenLayers.Format.GML.Base.prototype.readers.wfs},write:function(a){a=this.writeNode("gml:"+(a instanceof Array?"featureMembers":"featureMember"),a);this.setAttributeNS(a,this.namespaces.xsi,
"xsi:schemaLocation",this.schemaLocation);return OpenLayers.Format.XML.prototype.write.apply(this,[a])},writers:{gml:OpenLayers.Util.applyDefaults({featureMembers:function(a){for(var b=this.createElementNSPlus("gml:featureMembers"),d=0,e=a.length;d<e;++d)this.writeNode("feature:_typeName",a[d],b);return b},Point:function(a){var b=this.createElementNSPlus("gml:Point");this.writeNode("pos",a,b);return b},pos:function(a){return this.createElementNSPlus("gml:pos",{value:this.xy?a.x+" "+a.y:a.y+" "+a.x})},
LineString:function(a){var b=this.createElementNSPlus("gml:LineString");this.writeNode("posList",a.components,b);return b},Curve:function(a){var b=this.createElementNSPlus("gml:Curve");this.writeNode("segments",a,b);return b},segments:function(a){var b=this.createElementNSPlus("gml:segments");this.writeNode("LineStringSegment",a,b);return b},LineStringSegment:function(a){var b=this.createElementNSPlus("gml:LineStringSegment");this.writeNode("posList",a.components,b);return b},posList:function(a){for(var b=
a.length,d=new Array(b),e,f=0;f<b;++f){e=a[f];d[f]=this.xy?e.x+" "+e.y:e.y+" "+e.x}return this.createElementNSPlus("gml:posList",{value:d.join(" ")})},Surface:function(a){var b=this.createElementNSPlus("gml:Surface");this.writeNode("patches",a,b);return b},patches:function(a){var b=this.createElementNSPlus("gml:patches");this.writeNode("PolygonPatch",a,b);return b},PolygonPatch:function(a){var b=this.createElementNSPlus("gml:PolygonPatch",{attributes:{interpolation:"planar"}});this.writeNode("exterior",
a.components[0],b);for(var d=1,e=a.components.length;d<e;++d)this.writeNode("interior",a.components[d],b);return b},Polygon:function(a){var b=this.createElementNSPlus("gml:Polygon");this.writeNode("exterior",a.components[0],b);for(var d=1,e=a.components.length;d<e;++d)this.writeNode("interior",a.components[d],b);return b},exterior:function(a){var b=this.createElementNSPlus("gml:exterior");this.writeNode("LinearRing",a,b);return b},interior:function(a){var b=this.createElementNSPlus("gml:interior");
this.writeNode("LinearRing",a,b);return b},LinearRing:function(a){var b=this.createElementNSPlus("gml:LinearRing");this.writeNode("posList",a.components,b);return b},MultiCurve:function(a){for(var b=this.createElementNSPlus("gml:MultiCurve"),d=0,e=a.components.length;d<e;++d)this.writeNode("curveMember",a.components[d],b);return b},curveMember:function(a){var b=this.createElementNSPlus("gml:curveMember");this.curve?this.writeNode("Curve",a,b):this.writeNode("LineString",a,b);return b},MultiSurface:function(a){for(var b=
this.createElementNSPlus("gml:MultiSurface"),d=0,e=a.components.length;d<e;++d)this.writeNode("surfaceMember",a.components[d],b);return b},surfaceMember:function(a){var b=this.createElementNSPlus("gml:surfaceMember");this.surface?this.writeNode("Surface",a,b):this.writeNode("Polygon",a,b);return b},Envelope:function(a){var b=this.createElementNSPlus("gml:Envelope");this.writeNode("lowerCorner",a,b);this.writeNode("upperCorner",a,b);this.srsName&&b.setAttribute("srsName",this.srsName);return b},lowerCorner:function(a){return this.createElementNSPlus("gml:lowerCorner",
{value:this.xy?a.left+" "+a.bottom:a.bottom+" "+a.left})},upperCorner:function(a){return this.createElementNSPlus("gml:upperCorner",{value:this.xy?a.right+" "+a.top:a.top+" "+a.right})}},OpenLayers.Format.GML.Base.prototype.writers.gml),feature:OpenLayers.Format.GML.Base.prototype.writers.feature,wfs:OpenLayers.Format.GML.Base.prototype.writers.wfs},setGeometryTypes:function(){this.geometryTypes={"OpenLayers.Geometry.Point":"Point","OpenLayers.Geometry.MultiPoint":"MultiPoint","OpenLayers.Geometry.LineString":this.curve===
true?"Curve":"LineString","OpenLayers.Geometry.MultiLineString":this.multiCurve===false?"MultiLineString":"MultiCurve","OpenLayers.Geometry.Polygon":this.surface===true?"Surface":"Polygon","OpenLayers.Geometry.MultiPolygon":this.multiSurface===false?"MultiPolygon":"MultiSurface","OpenLayers.Geometry.Collection":"GeometryCollection"}},CLASS_NAME:"OpenLayers.Format.GML.v3"});
OpenLayers.Format.KML=OpenLayers.Class(OpenLayers.Format.XML,{kmlns:"http://earth.google.com/kml/2.0",placemarksDesc:"No description available",foldersName:"OpenLayers export",foldersDesc:"Exported on "+new Date,extractAttributes:true,extractStyles:false,internalns:null,features:null,styles:null,styleBaseUrl:"",fetched:null,maxDepth:0,initialize:function(a){this.regExes={trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g,kmlColor:/(\w{2})(\w{2})(\w{2})(\w{2})/,kmlIconPalette:/root:\/\/icons\/palette-(\d+)(\.\w+)/,
straightBracket:/\$\[(.*?)\]/g};this.externalProjection=new OpenLayers.Projection("EPSG:4326");OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},read:function(a){this.features=[];this.styles={};this.fetched={};return this.parseData(a,{depth:0,styleBaseUrl:this.styleBaseUrl})},parseData:function(a,b){if(typeof a=="string")a=OpenLayers.Format.XML.prototype.read.apply(this,[a]);for(var d=["Link","NetworkLink","Style","StyleMap","Placemark"],e=0,f=d.length;e<f;++e){var g=d[e],h=this.getElementsByTagNameNS(a,
"*",g);if(h.length!=0)switch(g.toLowerCase()){case "link":case "networklink":this.parseLinks(h,b);break;case "style":this.extractStyles&&this.parseStyles(h,b);break;case "stylemap":this.extractStyles&&this.parseStyleMaps(h,b);break;case "placemark":this.parseFeatures(h,b);break}}return this.features},parseLinks:function(a,b){if(b.depth>=this.maxDepth)return false;var d=OpenLayers.Util.extend({},b);d.depth++;for(var e=0,f=a.length;e<f;e++){var g=this.parseProperty(a[e],"*","href");if(g&&!this.fetched[g]){this.fetched[g]=
true;(g=this.fetchLink(g))&&this.parseData(g,d)}}},fetchLink:function(a){if(a=OpenLayers.Request.GET({url:a,async:false}))return a.responseText},parseStyles:function(a,b){for(var d=0,e=a.length;d<e;d++){var f=this.parseStyle(a[d]);if(f)this.styles[(b.styleBaseUrl||"")+"#"+f.id]=f}},parseKmlColor:function(a){var b=null;if(a)if(a=a.match(this.regExes.kmlColor))b={color:"#"+a[4]+a[3]+a[2],opacity:parseInt(a[1],16)/255};return b},parseStyle:function(a){for(var b={},d=["LineStyle","PolyStyle","IconStyle",
"BalloonStyle","LabelStyle"],e,f=0,g=d.length;f<g;++f){e=d[f];if(styleTypeNode=this.getElementsByTagNameNS(a,"*",e)[0])switch(e.toLowerCase()){case "linestyle":e=this.parseProperty(styleTypeNode,"*","color");if(e=this.parseKmlColor(e)){b.strokeColor=e.color;b.strokeOpacity=e.opacity}if(e=this.parseProperty(styleTypeNode,"*","width"))b.strokeWidth=e;break;case "polystyle":e=this.parseProperty(styleTypeNode,"*","color");if(e=this.parseKmlColor(e)){b.fillOpacity=e.opacity;b.fillColor=e.color}if(this.parseProperty(styleTypeNode,
"*","fill")=="0")b.fillColor="none";if(this.parseProperty(styleTypeNode,"*","outline")=="0")b.strokeWidth="0";break;case "iconstyle":var h=parseFloat(this.parseProperty(styleTypeNode,"*","scale")||1);e=32*h;var j=32*h,l=this.getElementsByTagNameNS(styleTypeNode,"*","Icon")[0];if(l){var m=this.parseProperty(l,"*","href");if(m){var o=this.parseProperty(l,"*","w"),p=this.parseProperty(l,"*","h");if(OpenLayers.String.startsWith(m,"http://maps.google.com/mapfiles/kml")&&!o&&!p){p=o=64;h/=2}o=o||p;p=p||
o;if(o)e=parseInt(o)*h;if(p)j=parseInt(p)*h;if(p=m.match(this.regExes.kmlIconPalette)){o=p[1];p=p[2];m=this.parseProperty(l,"*","x");l=this.parseProperty(l,"*","y");m="http://maps.google.com/mapfiles/kml/pal"+o+"/icon"+((l?7-l/32:7)*8+(m?m/32:0))+p}b.graphicOpacity=1;b.externalGraphic=m}}if(o=this.getElementsByTagNameNS(styleTypeNode,"*","hotSpot")[0]){m=parseFloat(o.getAttribute("x"));l=parseFloat(o.getAttribute("y"));p=o.getAttribute("xunits");if(p=="pixels")b.graphicXOffset=-m*h;else if(p=="insetPixels")b.graphicXOffset=
-e+m*h;else if(p=="fraction")b.graphicXOffset=-e*m;m=o.getAttribute("yunits");if(m=="pixels")b.graphicYOffset=-j+l*h+1;else if(m=="insetPixels")b.graphicYOffset=-(l*h)+1;else if(m=="fraction")b.graphicYOffset=-j*(1-l)+1}b.graphicWidth=e;b.graphicHeight=j;break;case "balloonstyle":if(e=OpenLayers.Util.getXmlNodeValue(styleTypeNode))b.balloonStyle=e.replace(this.regExes.straightBracket,"${$1}");break;case "labelstyle":e=this.parseProperty(styleTypeNode,"*","color");if(e=this.parseKmlColor(e)){b.fontColor=
e.color;b.fontOpacity=e.opacity}break;default:}}if(!b.strokeColor&&b.fillColor)b.strokeColor=b.fillColor;if((a=a.getAttribute("id"))&&b)b.id=a;return b},parseStyleMaps:function(a,b){for(var d=0,e=a.length;d<e;d++){var f=a[d],g=this.getElementsByTagNameNS(f,"*","Pair");f=f.getAttribute("id");for(var h=0,j=g.length;h<j;h++){var l=g[h],m=this.parseProperty(l,"*","key");if((l=this.parseProperty(l,"*","styleUrl"))&&m=="normal")this.styles[(b.styleBaseUrl||"")+"#"+f]=this.styles[(b.styleBaseUrl||"")+l]}}},
parseFeatures:function(a,b){for(var d=new Array(a.length),e=0,f=a.length;e<f;e++){var g=a[e],h=this.parseFeature.apply(this,[g]);if(h){if(this.extractStyles&&h.attributes&&h.attributes.styleUrl)h.style=this.getStyle(h.attributes.styleUrl,b);if(this.extractStyles)if(g=this.getElementsByTagNameNS(g,"*","Style")[0])if(g=this.parseStyle(g))h.style=OpenLayers.Util.extend(h.style,g);d[e]=h}else throw"Bad Placemark: "+e;}this.features=this.features.concat(d)},parseFeature:function(a){for(var b=["MultiGeometry",
"Polygon","LineString","Point"],d,e,f,g=0,h=b.length;g<h;++g){d=b[g];this.internalns=a.namespaceURI?a.namespaceURI:this.kmlns;e=this.getElementsByTagNameNS(a,this.internalns,d);if(e.length>0){if(b=this.parseGeometry[d.toLowerCase()]){f=b.apply(this,[e[0]]);this.internalProjection&&this.externalProjection&&f.transform(this.externalProjection,this.internalProjection)}else OpenLayers.Console.error(OpenLayers.i18n("unsupportedGeometryType",{geomType:d}));break}}var j;if(this.extractAttributes)j=this.parseAttributes(a);
d=new OpenLayers.Feature.Vector(f,j);a=a.getAttribute("id")||a.getAttribute("name");if(a!=null)d.fid=a;return d},getStyle:function(a,b){var d=OpenLayers.Util.removeTail(a),e=OpenLayers.Util.extend({},b);e.depth++;e.styleBaseUrl=d;if(!this.styles[a]&&!OpenLayers.String.startsWith(a,"#")&&e.depth<=this.maxDepth&&!this.fetched[d])(d=this.fetchLink(d))&&this.parseData(d,e);return OpenLayers.Util.extend({},this.styles[a])},parseGeometry:{point:function(a){var b=this.getElementsByTagNameNS(a,this.internalns,
"coordinates");a=[];if(b.length>0){var d=b[0].firstChild.nodeValue;d=d.replace(this.regExes.removeSpace,"");a=d.split(",")}b=null;if(a.length>1){if(a.length==2)a[2]=null;b=new OpenLayers.Geometry.Point(a[0],a[1],a[2])}else throw"Bad coordinate string: "+d;return b},linestring:function(a,b){var d=this.getElementsByTagNameNS(a,this.internalns,"coordinates"),e=null;if(d.length>0){d=this.getChildValue(d[0]);d=d.replace(this.regExes.trimSpace,"");d=d.replace(this.regExes.trimComma,",");e=d.split(this.regExes.splitSpace);
for(var f=e.length,g=new Array(f),h,j,l=0;l<f;++l){h=e[l].split(",");j=h.length;if(j>1){if(h.length==2)h[2]=null;g[l]=new OpenLayers.Geometry.Point(h[0],h[1],h[2])}else throw"Bad LineString point coordinates: "+e[l];}if(f)e=b?new OpenLayers.Geometry.LinearRing(g):new OpenLayers.Geometry.LineString(g);else throw"Bad LineString coordinates: "+d;}return e},polygon:function(a){a=this.getElementsByTagNameNS(a,this.internalns,"LinearRing");var b=a.length,d=new Array(b);if(b>0)for(var e=0,f=a.length;e<f;++e)if(b=
this.parseGeometry.linestring.apply(this,[a[e],true]))d[e]=b;else throw"Bad LinearRing geometry: "+e;return new OpenLayers.Geometry.Polygon(d)},multigeometry:function(a){for(var b,d=[],e=a.childNodes,f=0,g=e.length;f<g;++f){a=e[f];if(a.nodeType==1)(b=this.parseGeometry[(a.prefix?a.nodeName.split(":")[1]:a.nodeName).toLowerCase()])&&d.push(b.apply(this,[a]))}return new OpenLayers.Geometry.Collection(d)}},parseAttributes:function(a){var b={},d=a.getElementsByTagName("ExtendedData");if(d.length)b=this.parseExtendedData(d[0]);
var e,f,g;a=a.childNodes;d=0;for(var h=a.length;d<h;++d){e=a[d];if(e.nodeType==1){f=e.childNodes;if(f.length>=1&&f.length<=3){switch(f.length){case 1:g=f[0];break;case 2:g=f[0];f=f[1];g=g.nodeType==3||g.nodeType==4?g:f;break;case 3:default:g=f[1];break}if(g.nodeType==3||g.nodeType==4){e=e.prefix?e.nodeName.split(":")[1]:e.nodeName;if(g=OpenLayers.Util.getXmlNodeValue(g)){g=g.replace(this.regExes.trimSpace,"");b[e]=g}}}}}return b},parseExtendedData:function(a){var b={},d,e,f,g,h=a.getElementsByTagName("Data");
d=0;for(e=h.length;d<e;d++){f=h[d];g=f.getAttribute("name");var j={},l=f.getElementsByTagName("value");if(l.length)j.value=this.getChildValue(l[0]);f=f.getElementsByTagName("displayName");if(f.length)j.displayName=this.getChildValue(f[0]);b[g]=j}a=a.getElementsByTagName("SimpleData");d=0;for(e=a.length;d<e;d++){j={};f=a[d];g=f.getAttribute("name");j.value=this.getChildValue(f);j.displayName=g;b[g]=j}return b},parseProperty:function(a,b,d){var e;a=this.getElementsByTagNameNS(a,b,d);try{e=OpenLayers.Util.getXmlNodeValue(a[0])}catch(f){e=
null}return e},write:function(a){a instanceof Array||(a=[a]);for(var b=this.createElementNS(this.kmlns,"kml"),d=this.createFolderXML(),e=0,f=a.length;e<f;++e)d.appendChild(this.createPlacemarkXML(a[e]));b.appendChild(d);return OpenLayers.Format.XML.prototype.write.apply(this,[b])},createFolderXML:function(){var a=this.createElementNS(this.kmlns,"Folder");if(this.foldersName){var b=this.createElementNS(this.kmlns,"name"),d=this.createTextNode(this.foldersName);b.appendChild(d);a.appendChild(b)}if(this.foldersDesc){b=
this.createElementNS(this.kmlns,"description");d=this.createTextNode(this.foldersDesc);b.appendChild(d);a.appendChild(b)}return a},createPlacemarkXML:function(a){var b=this.createElementNS(this.kmlns,"name");b.appendChild(this.createTextNode(a.style&&a.style.label?a.style.label:a.attributes.name||a.id));var d=this.createElementNS(this.kmlns,"description");d.appendChild(this.createTextNode(a.attributes.description||this.placemarksDesc));var e=this.createElementNS(this.kmlns,"Placemark");a.fid!=null&&
e.setAttribute("id",a.fid);e.appendChild(b);e.appendChild(d);a=this.buildGeometryNode(a.geometry);e.appendChild(a);return e},buildGeometryNode:function(a){if(this.internalProjection&&this.externalProjection){a=a.clone();a.transform(this.internalProjection,this.externalProjection)}var b=a.CLASS_NAME;b=this.buildGeometry[b.substring(b.lastIndexOf(".")+1).toLowerCase()];var d=null;if(b)d=b.apply(this,[a]);return d},buildGeometry:{point:function(a){var b=this.createElementNS(this.kmlns,"Point");b.appendChild(this.buildCoordinatesNode(a));
return b},multipoint:function(a){return this.buildGeometry.collection.apply(this,[a])},linestring:function(a){var b=this.createElementNS(this.kmlns,"LineString");b.appendChild(this.buildCoordinatesNode(a));return b},multilinestring:function(a){return this.buildGeometry.collection.apply(this,[a])},linearring:function(a){var b=this.createElementNS(this.kmlns,"LinearRing");b.appendChild(this.buildCoordinatesNode(a));return b},polygon:function(a){var b=this.createElementNS(this.kmlns,"Polygon");a=a.components;
for(var d,e,f=0,g=a.length;f<g;++f){d=this.createElementNS(this.kmlns,f==0?"outerBoundaryIs":"innerBoundaryIs");e=this.buildGeometry.linearring.apply(this,[a[f]]);d.appendChild(e);b.appendChild(d)}return b},multipolygon:function(a){return this.buildGeometry.collection.apply(this,[a])},collection:function(a){for(var b=this.createElementNS(this.kmlns,"MultiGeometry"),d,e=0,f=a.components.length;e<f;++e)(d=this.buildGeometryNode.apply(this,[a.components[e]]))&&b.appendChild(d);return b}},buildCoordinatesNode:function(a){var b=
this.createElementNS(this.kmlns,"coordinates"),d;if(d=a.components){for(var e=d.length,f=new Array(e),g=0;g<e;++g){a=d[g];f[g]=a.x+","+a.y}d=f.join(" ")}else d=a.x+","+a.y;d=this.createTextNode(d);b.appendChild(d);return b},CLASS_NAME:"OpenLayers.Format.KML"});
OpenLayers.Format.OSM=OpenLayers.Class(OpenLayers.Format.XML,{checkTags:false,interestingTagsExclude:null,areaTags:null,initialize:function(a){var b={interestingTagsExclude:["source","source_ref","source:ref","history","attribution","created_by"],areaTags:["area","building","leisure","tourism","ruins","historic","landuse","military","natural","sport"]};b=OpenLayers.Util.extend(b,a);var d={};for(a=0;a<b.interestingTagsExclude.length;a++)d[b.interestingTagsExclude[a]]=true;b.interestingTagsExclude=
d;d={};for(a=0;a<b.areaTags.length;a++)d[b.areaTags[a]]=true;b.areaTags=d;this.externalProjection=new OpenLayers.Projection("EPSG:4326");OpenLayers.Format.XML.prototype.initialize.apply(this,[b])},read:function(a){if(typeof a=="string")a=OpenLayers.Format.XML.prototype.read.apply(this,[a]);var b=this.getNodes(a),d=this.getWays(a);a=new Array(d.length);for(var e=0;e<d.length;e++){for(var f=new Array(d[e].nodes.length),g=this.isWayArea(d[e])?1:0,h=0;h<d[e].nodes.length;h++){var j=b[d[e].nodes[h]],l=
new OpenLayers.Geometry.Point(j.lon,j.lat);l.osm_id=parseInt(d[e].nodes[h]);f[h]=l;j.used=true}j=null;j=g?new OpenLayers.Geometry.Polygon(new OpenLayers.Geometry.LinearRing(f)):new OpenLayers.Geometry.LineString(f);this.internalProjection&&this.externalProjection&&j.transform(this.externalProjection,this.internalProjection);f=new OpenLayers.Feature.Vector(j,d[e].tags);f.osm_id=parseInt(d[e].id);f.fid="way."+f.osm_id;a[e]=f}for(var m in b){j=b[m];if(!j.used||this.checkTags){d=null;if(this.checkTags){d=
this.getTags(j.node,true);if(j.used&&!d[1])continue;d=d[0]}else d=this.getTags(j.node);f=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(j.lon,j.lat),d);this.internalProjection&&this.externalProjection&&f.geometry.transform(this.externalProjection,this.internalProjection);f.osm_id=parseInt(m);f.fid="node."+f.osm_id;a.push(f)}j.node=null}return a},getNodes:function(a){a=a.getElementsByTagName("node");for(var b={},d=0;d<a.length;d++){var e=a[d],f=e.getAttribute("id");b[f]={lat:e.getAttribute("lat"),
lon:e.getAttribute("lon"),node:e}}return b},getWays:function(a){a=a.getElementsByTagName("way");for(var b=[],d=0;d<a.length;d++){var e=a[d],f={id:e.getAttribute("id")};f.tags=this.getTags(e);e=e.getElementsByTagName("nd");f.nodes=new Array(e.length);for(var g=0;g<e.length;g++)f.nodes[g]=e[g].getAttribute("ref");b.push(f)}return b},getTags:function(a,b){for(var d=a.getElementsByTagName("tag"),e={},f=false,g=0;g<d.length;g++){var h=d[g].getAttribute("k");e[h]=d[g].getAttribute("v");if(b)this.interestingTagsExclude[h]||
(f=true)}return b?[e,f]:e},isWayArea:function(a){var b=false,d=false;if(a.nodes[0]==a.nodes[a.nodes.length-1])b=true;if(this.checkTags)for(var e in a.tags)if(this.areaTags[e]){d=true;break}return b&&(this.checkTags?d:true)},write:function(a){a instanceof Array||(a=[a]);this.osm_id=1;this.created_nodes={};var b=this.createElementNS(null,"osm");b.setAttribute("version","0.5");b.setAttribute("generator","OpenLayers "+OpenLayers.VERSION_NUMBER);for(var d=a.length-1;d>=0;d--)for(var e=this.createFeatureNodes(a[d]),
f=0;f<e.length;f++)b.appendChild(e[f]);return OpenLayers.Format.XML.prototype.write.apply(this,[b])},createFeatureNodes:function(a){var b=[],d=a.geometry.CLASS_NAME;d=d.substring(d.lastIndexOf(".")+1);d=d.toLowerCase();if(d=this.createXML[d])b=d.apply(this,[a]);return b},createXML:{point:function(a){var b=null,d=a.geometry?a.geometry:a,e=false;if(a.osm_id){b=a.osm_id;if(this.created_nodes[b])e=true}else{b=-this.osm_id;this.osm_id++}var f=e?this.created_nodes[b]:this.createElementNS(null,"node");this.created_nodes[b]=
f;f.setAttribute("id",b);f.setAttribute("lon",d.x);f.setAttribute("lat",d.y);a.attributes&&this.serializeTags(a,f);this.setState(a,f);return e?[]:[f]},linestring:function(a){var b=[],d=a.geometry;if(a.osm_id)id=a.osm_id;else{id=-this.osm_id;this.osm_id++}var e=this.createElementNS(null,"way");e.setAttribute("id",id);for(var f=0;f<d.components.length;f++){var g=this.createXML.point.apply(this,[d.components[f]]);if(g.length){g=g[0];var h=g.getAttribute("id");b.push(g)}else{h=d.components[f].osm_id;
g=this.created_nodes[h]}this.setState(a,g);g=this.createElementNS(null,"nd");g.setAttribute("ref",h);e.appendChild(g)}this.serializeTags(a,e);b.push(e);return b},polygon:function(a){var b=OpenLayers.Util.extend({area:"yes"},a.attributes);b=new OpenLayers.Feature.Vector(a.geometry.components[0],b);b.osm_id=a.osm_id;return this.createXML.linestring.apply(this,[b])}},serializeTags:function(a,b){for(var d in a.attributes){var e=this.createElementNS(null,"tag");e.setAttribute("k",d);e.setAttribute("v",
a.attributes[d]);b.appendChild(e)}},setState:function(a,b){if(a.state){var d=null;switch(a.state){case OpenLayers.State.UPDATE:case OpenLayers.State.DELETE:d="delete"}d&&b.setAttribute("action",d)}},CLASS_NAME:"OpenLayers.Format.OSM"});
OpenLayers.Projection=OpenLayers.Class({proj:null,projCode:null,initialize:function(a,b){OpenLayers.Util.extend(this,b);this.projCode=a;if(window.Proj4js)this.proj=new Proj4js.Proj(a)},getCode:function(){return this.proj?this.proj.srsCode:this.projCode},getUnits:function(){return this.proj?this.proj.units:null},toString:function(){return this.getCode()},equals:function(a){return a&&a.getCode?this.getCode()==a.getCode():false},destroy:function(){delete this.proj;delete this.projCode},CLASS_NAME:"OpenLayers.Projection"});
OpenLayers.Projection.transforms={};OpenLayers.Projection.addTransform=function(a,b,d){OpenLayers.Projection.transforms[a]||(OpenLayers.Projection.transforms[a]={});OpenLayers.Projection.transforms[a][b]=d};OpenLayers.Projection.transform=function(a,b,d){if(b.proj&&d.proj)a=Proj4js.transform(b.proj,d.proj,a);else b&&d&&OpenLayers.Projection.transforms[b.getCode()]&&OpenLayers.Projection.transforms[b.getCode()][d.getCode()]&&OpenLayers.Projection.transforms[b.getCode()][d.getCode()](a);return a};
OpenLayers.Control.LoadingPanel=OpenLayers.Class(OpenLayers.Control,{counter:0,maximized:false,visible:true,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,[a])},setVisible:function(a){(this.visible=a)?OpenLayers.Element.show(this.div):OpenLayers.Element.hide(this.div)},getVisible:function(){return this.visible},hide:function(){this.setVisible(false)},show:function(){this.setVisible(true)},toggle:function(){this.setVisible(!this.getVisible())},addLayer:function(a){if(a.layer){a.layer.events.register("loadstart",
this,this.increaseCounter);a.layer.events.register("loadend",this,this.decreaseCounter)}},setMap:function(){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.map.events.register("preaddlayer",this,this.addLayer);for(var a=0;a<this.map.layers.length;a++){var b=this.map.layers[a];b.events.register("loadstart",this,this.increaseCounter);b.events.register("loadend",this,this.decreaseCounter)}},increaseCounter:function(){this.counter++;this.counter>0&&!this.maximized&&this.visible&&this.maximizeControl()},
decreaseCounter:function(){this.counter>0&&this.counter--;this.counter==0&&this.maximized&&this.visible&&this.minimizeControl()},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);return this.div},minimizeControl:function(a){this.div.style.display="none";this.maximized=false;document.getElementById("div_cargando").style.display="none";document.getElementById("div_cargando_iki").style.display="none";a!=null&&OpenLayers.Event.stop(a)},maximizeControl:function(a){this.div.style.display=
"block";this.maximized=true;a!=null&&OpenLayers.Event.stop(a)},destroy:function(){if(this.map){this.map.events.unregister("preaddlayer",this,this.addLayer);if(this.map.layers)for(var a=0;a<this.map.layers.length;a++){var b=this.map.layers[a];b.events.unregister("loadstart",this,this.increaseCounter);b.events.unregister("loadend",this,this.decreaseCounter)}}OpenLayers.Control.prototype.destroy.apply(this,arguments)},CLASS_NAME:"OpenLayers.Control.LoadingPanel"});