/*

  OpenLayers.js -- OpenLayers Map Viewer Library

  Copyright 2005-2011 OpenLayers Contributors, released under the FreeBSD
  license. Please see http://svn.openlayers.org/trunk/openlayers/license.txt
  for the full text of the license.

  Includes compressed code under the following licenses:

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

*/

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

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

/**
 * Contains XMLHttpRequest.js <http://code.google.com/p/xmlhttprequest/>
 * Copyright 2007 Sergey Ilinsky (http://www.ilinsky.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 */

/**
 * OpenLayers.Util.pagePosition is based on Yahoo's getXY method, which is
 * Copyright (c) 2006, Yahoo! Inc.
 * All rights reserved.
 * 
 * Redistribution and use of this software in source and binary forms, with or
 * without modification, are permitted provided that the following conditions
 * are met:
 * 
 * * Redistributions of source code must retain the above copyright notice,
 *   this list of conditions and the following disclaimer.
 * 
 * * Redistributions in binary form must reproduce the above copyright notice,
 *   this list of conditions and the following disclaimer in the documentation
 *   and/or other materials provided with the distribution.
 * 
 * * Neither the name of Yahoo! Inc. nor the names of its contributors may be
 *   used to endorse or promote products derived from this software without
 *   specific prior written permission of Yahoo! Inc.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 * POSSIBILITY OF SUCH DAMAGE.
 */
var OpenLayers={VERSION_NUMBER:"$Revision$",singleFile:!0,_getScriptLocation:function(){for(var a=/(^|(.*?\/))(OpenLayers.js)(\?|$)/,b=document.getElementsByTagName("script"),c,d="",e=0,f=b.length;e<f;e++)if(c=b[e].getAttribute("src"))if(c=c.match(a)){d=c[1];break}return function(){return d}}()};
OpenLayers.Class=function(){var a=arguments.length,b=arguments[0],c=arguments[a-1],d="function"==typeof c.initialize?c.initialize:function(){b.prototype.initialize.apply(this,arguments)};1<a?(a=[d,b].concat(Array.prototype.slice.call(arguments).slice(1,a-1),c),OpenLayers.inherit.apply(null,a)):d.prototype=c;return d};
OpenLayers.inherit=function(a,b){var c=function(){};c.prototype=b.prototype;a.prototype=new c;var d,e;for(c=2,d=arguments.length;c<d;c++){e=arguments[c];if("function"===typeof e)e=e.prototype;OpenLayers.Util.extend(a.prototype,e)}};OpenLayers.Util=OpenLayers.Util||{};OpenLayers.Util.extend=function(a,b){a=a||{};if(b){for(var c in b){var d=b[c];void 0!==d&&(a[c]=d)}if(!("function"==typeof window.Event&&b instanceof window.Event)&&b.hasOwnProperty&&b.hasOwnProperty("toString"))a.toString=b.toString}return a};
OpenLayers.String={startsWith:function(a,b){return 0==a.indexOf(b)},contains:function(a,b){return-1!=a.indexOf(b)},trim:function(a){return a.replace(/^\s\s*/,"").replace(/\s\s*$/,"")},camelize:function(a){for(var a=a.split("-"),b=a[0],c=1,d=a.length;c<d;c++)var e=a[c],b=b+(e.charAt(0).toUpperCase()+e.substring(1));return b},format:function(a,b,c){b||(b=window);return a.replace(OpenLayers.String.tokenRegEx,function(a,e){for(var f,g=e.split(/\.+/),h=0;h<g.length;h++)0==h&&(f=b),f=f[g[h]];"function"==
typeof f&&(f=c?f.apply(null,c):f());return"undefined"==typeof f?"undefined":f})},tokenRegEx:/\$\{([\w.]+?)\}/g,numberRegEx:/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,isNumeric:function(a){return OpenLayers.String.numberRegEx.test(a)},numericIf:function(a){return OpenLayers.String.isNumeric(a)?parseFloat(a):a}};
OpenLayers.Number={decimalSeparator:".",thousandsSeparator:",",limitSigDigs:function(a,b){var c=0;0<b&&(c=parseFloat(a.toPrecision(b)));return c},format:function(a,b,c,d){b="undefined"!=typeof b?b:0;c="undefined"!=typeof c?c:OpenLayers.Number.thousandsSeparator;d="undefined"!=typeof d?d:OpenLayers.Number.decimalSeparator;null!=b&&(a=parseFloat(a.toFixed(b)));var e=a.toString().split(".");1==e.length&&null==b&&(b=0);a=e[0];if(c)for(var f=/(-?[0-9]+)([0-9]{3})/;f.test(a);)a=a.replace(f,"$1"+c+"$2");
0==b?b=a:(c=1<e.length?e[1]:"0",null!=b&&(c+=Array(b-c.length+1).join("0")),b=a+d+c);return b}};OpenLayers.Function={bind:function(a,b){var c=Array.prototype.slice.apply(arguments,[2]);return function(){var d=c.concat(Array.prototype.slice.apply(arguments,[0]));return a.apply(b,d)}},bindAsEventListener:function(a,b){return function(c){return a.call(b,c||window.event)}},False:function(){return!1},True:function(){return!0},Void:function(){}};
OpenLayers.Array={filter:function(a,b,c){var d=[];if(Array.prototype.filter)d=a.filter(b,c);else{var e=a.length;if("function"!=typeof b)throw new TypeError;for(var f=0;f<e;f++)if(f in a){var g=a[f];b.call(c,g,f,a)&&d.push(g)}}return d}};
OpenLayers.Bounds=OpenLayers.Class({left:null,bottom:null,right:null,top:null,centerLonLat:null,initialize:function(a,b,c,d){OpenLayers.Util.isArray(a)&&(d=a[3],c=a[2],b=a[1],a=a[0]);if(null!=a)this.left=OpenLayers.Util.toFloat(a);if(null!=b)this.bottom=OpenLayers.Util.toFloat(b);if(null!=c)this.right=OpenLayers.Util.toFloat(c);if(null!=d)this.top=OpenLayers.Util.toFloat(d)},clone:function(){return new OpenLayers.Bounds(this.left,this.bottom,this.right,this.top)},equals:function(a){var b=!1;null!=
a&&(b=this.left==a.left&&this.right==a.right&&this.top==a.top&&this.bottom==a.bottom);return b},toString:function(){return[this.left,this.bottom,this.right,this.top].join()},toArray:function(a){return!0===a?[this.bottom,this.left,this.top,this.right]:[this.left,this.bottom,this.right,this.top]},toBBOX:function(a,b){null==a&&(a=6);var c=Math.pow(10,a),d=Math.round(this.left*c)/c,e=Math.round(this.bottom*c)/c,f=Math.round(this.right*c)/c,c=Math.round(this.top*c)/c;return!0===b?e+","+d+","+c+","+f:d+
","+e+","+f+","+c},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){null==b&&(b=this.getCenterLonLat());var c,d;"OpenLayers.LonLat"==b.CLASS_NAME?(c=b.lon,d=b.lat):(c=b.x,d=b.y);return new OpenLayers.Bounds((this.left-c)*a+c,(this.bottom-d)*a+d,(this.right-c)*a+c,(this.top-d)*
a+d)},add:function(a,b){if(null==a||null==b)throw new TypeError("Bounds.add cannot receive null values");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}if(b){this.centerLonLat=null;if(null==this.left||b.left<this.left)this.left=
b.left;if(null==this.bottom||b.bottom<this.bottom)this.bottom=b.bottom;if(null==this.right||b.right>this.right)this.right=b.right;if(null==this.top||b.top>this.top)this.top=b.top}}},containsLonLat:function(a,b){"boolean"===typeof b&&(b={inclusive:b});var b=b||{},c=this.contains(a.lon,a.lat,b.inclusive),d=b.worldBounds;d&&!c&&(c=d.getWidth(),a=a.clone(),d=Math.round((a.lon-(d.left+d.right)/2)/c),a.lon-=d*c,c=this.containsLonLat(a,{inclusive:b.inclusive}));return c},containsPixel:function(a,b){return this.contains(a.x,
a.y,b)},contains:function(a,b,c){null==c&&(c=!0);if(null==a||null==b)return!1;var a=OpenLayers.Util.toFloat(a),b=OpenLayers.Util.toFloat(b),d=!1;return d=c?a>=this.left&&a<=this.right&&b>=this.bottom&&b<=this.top:a>this.left&&a<this.right&&b>this.bottom&&b<this.top},intersectsBounds:function(a,b){"boolean"===typeof b&&(b={inclusive:b});b=b||{};if(b.worldBounds)var c=this.wrapDateLine(b.worldBounds),a=a.wrapDateLine(b.worldBounds);else c=this;if(null==b.inclusive)b.inclusive=!0;var d=!1,e=c.left==
a.right||c.right==a.left||c.top==a.bottom||c.bottom==a.top;if(b.inclusive||!e)var d=a.top>=c.bottom&&a.top<=c.top||c.top>a.bottom&&c.top<a.top,e=a.left>=c.left&&a.left<=c.right||c.left>=a.left&&c.left<=a.right,f=a.right>=c.left&&a.right<=c.right||c.right>=a.left&&c.right<=a.right,d=(a.bottom>=c.bottom&&a.bottom<=c.top||c.bottom>=a.bottom&&c.bottom<=a.top||d)&&(e||f);if(b.worldBounds&&!d){var g=b.worldBounds,e=g.getWidth(),f=!g.containsBounds(c),g=!g.containsBounds(a);f&&!g?(a=a.add(-e,0),d=c.intersectsBounds(a,
{inclusive:b.inclusive})):g&&!f&&(c=c.add(-e,0),d=a.intersectsBounds(c,{inclusive:b.inclusive}))}return d},containsBounds:function(a,b,c){null==b&&(b=!1);null==c&&(c=!0);var d=this.contains(a.left,a.bottom,c),e=this.contains(a.right,a.bottom,c),f=this.contains(a.left,a.top,c),a=this.contains(a.right,a.top,c);return b?d||e||f||a:d&&e&&f&&a},determineQuadrant:function(a){var b="",c=this.getCenterLonLat(),b=b+(a.lat<c.lat?"b":"t");return b+=a.lon<c.lon?"l":"r"},transform:function(a,b){this.centerLonLat=
null;var c=OpenLayers.Projection.transform({x:this.left,y:this.bottom},a,b),d=OpenLayers.Projection.transform({x:this.right,y:this.bottom},a,b),e=OpenLayers.Projection.transform({x:this.left,y:this.top},a,b),f=OpenLayers.Projection.transform({x:this.right,y:this.top},a,b);this.left=Math.min(c.x,e.x);this.bottom=Math.min(c.y,d.y);this.right=Math.max(d.x,f.x);this.top=Math.max(e.y,f.y);return this},wrapDateLine:function(a,b){var b=b||{},c=b.leftTolerance||0,d=b.rightTolerance||0,e=this.clone();if(a){for(var f=
a.getWidth();e.left<a.left&&e.right-d<=a.left;)e=e.add(f,0);for(;e.left+c>=a.right&&e.right>a.right;)e=e.add(-f,0);c=e.left+c;c<a.right&&c>a.left&&e.right-d>a.right&&(e=e.add(-f,0))}return e},CLASS_NAME:"OpenLayers.Bounds"});OpenLayers.Bounds.fromString=function(a,b){var c=a.split(",");return OpenLayers.Bounds.fromArray(c,b)};OpenLayers.Bounds.fromArray=function(a,b){return!0===b?new OpenLayers.Bounds(a[1],a[0],a[3],a[2]):new OpenLayers.Bounds(a[0],a[1],a[2],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=""+("t"==a.charAt(0)?"b":"t");return b+="l"==a.charAt(1)?"r":"l"};
OpenLayers.Element={visible:function(a){return"none"!=OpenLayers.Util.getElement(a).style.display},toggle:function(){for(var a=0,b=arguments.length;a<b;a++){var c=OpenLayers.Util.getElement(arguments[a]),d=OpenLayers.Element.visible(c)?"none":"";c.style.display=d}},remove:function(a){a=OpenLayers.Util.getElement(a);a.parentNode.removeChild(a)},getHeight:function(a){a=OpenLayers.Util.getElement(a);return a.offsetHeight},hasClass:function(a,b){var c=a.className;return!!c&&RegExp("(^|\\s)"+b+"(\\s|$)").test(c)},
addClass:function(a,b){OpenLayers.Element.hasClass(a,b)||(a.className+=(a.className?" ":"")+b);return a},removeClass:function(a,b){var c=a.className;if(c)a.className=OpenLayers.String.trim(c.replace(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){var a=OpenLayers.Util.getElement(a),c=null;if(a&&a.style){c=a.style[OpenLayers.String.camelize(b)];
c||(document.defaultView&&document.defaultView.getComputedStyle?c=(c=document.defaultView.getComputedStyle(a,null))?c.getPropertyValue(b):null:a.currentStyle&&(c=a.currentStyle[OpenLayers.String.camelize(b)]));var d=["left","top","right","bottom"];window.opera&&-1!=OpenLayers.Util.indexOf(d,b)&&"static"==OpenLayers.Element.getStyle(a,"position")&&(c="auto")}return"auto"==c?null:c}};
OpenLayers.LonLat=OpenLayers.Class({lon:0,lat:0,initialize:function(a,b){OpenLayers.Util.isArray(a)&&(b=a[1],a=a[0]);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(null==a||null==b)throw new TypeError("LonLat.add cannot receive null values");return new OpenLayers.LonLat(this.lon+
OpenLayers.Util.toFloat(a),this.lat+OpenLayers.Util.toFloat(b))},equals:function(a){var b=!1;null!=a&&(b=this.lon==a.lon&&this.lat==a.lat||isNaN(this.lon)&&isNaN(this.lat)&&isNaN(a.lon)&&isNaN(a.lat));return b},transform:function(a,b){var c=OpenLayers.Projection.transform({x:this.lon,y:this.lat},a,b);this.lon=c.x;this.lat=c.y;return this},wrapDateLine:function(a){var b=this.clone();if(a){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(a[0],a[1])};OpenLayers.LonLat.fromArray=function(a){var b=OpenLayers.Util.isArray(a);return new OpenLayers.LonLat(b&&a[0],b&&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=!1;null!=a&&(b=this.x==a.x&&this.y==a.y||isNaN(this.x)&&isNaN(this.y)&&isNaN(a.x)&&isNaN(a.y));return b},distanceTo:function(a){return Math.sqrt(Math.pow(this.x-a.x,2)+Math.pow(this.y-a.y,2))},add:function(a,b){if(null==a||null==b)throw new TypeError("Pixel.add cannot receive null values");
return new OpenLayers.Pixel(this.x+a,this.y+b)},offset:function(a){var b=this.clone();a&&(b=this.add(a.x,a.y));return b},CLASS_NAME:"OpenLayers.Pixel"});
OpenLayers.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=!1;null!=a&&(b=this.w==a.w&&this.h==a.h||isNaN(this.w)&&isNaN(this.h)&&isNaN(a.w)&&isNaN(a.h));return b},CLASS_NAME:"OpenLayers.Size"});
OpenLayers.Console={log:function(){},debug:function(){},info:function(){},warn:function(){},error:function(){},userError:function(a){alert(a)},assert:function(){},dir:function(){},dirxml:function(){},trace:function(){},group:function(){},groupEnd:function(){},time:function(){},timeEnd:function(){},profile:function(){},profileEnd:function(){},count:function(){},CLASS_NAME:"OpenLayers.Console"};
(function(){for(var a=document.getElementsByTagName("script"),b=0,c=a.length;b<c;++b)if(-1!=a[b].src.indexOf("firebug.js")&&console){OpenLayers.Util.extend(OpenLayers.Console,console);break}})();
OpenLayers.Lang={code:null,defaultCode:"en",getCode:function(){OpenLayers.Lang.code||OpenLayers.Lang.setCode();return OpenLayers.Lang.code},setCode:function(a){var b;a||(a="msie"==OpenLayers.BROWSER_NAME?navigator.userLanguage:navigator.language);a=a.split("-");a[0]=a[0].toLowerCase();"object"==typeof OpenLayers.Lang[a[0]]&&(b=a[0]);if(a[1]){var c=a[0]+"-"+a[1].toUpperCase();"object"==typeof OpenLayers.Lang[c]&&(b=c)}if(!b)OpenLayers.Console.warn("Failed to find OpenLayers.Lang."+a.join("-")+" dictionary, falling back to default language"),
b=OpenLayers.Lang.defaultCode;OpenLayers.Lang.code=b},translate:function(a,b){var c=OpenLayers.Lang[OpenLayers.Lang.getCode()];(c=c&&c[a])||(c=a);b&&(c=OpenLayers.String.format(c,b));return c}};OpenLayers.i18n=OpenLayers.Lang.translate;OpenLayers.Util=OpenLayers.Util||{};OpenLayers.Util.getElement=function(){for(var a=[],b=0,c=arguments.length;b<c;b++){var d=arguments[b];"string"==typeof d&&(d=document.getElementById(d));if(1==arguments.length)return d;a.push(d)}return a};
OpenLayers.Util.isElement=function(a){return!!(a&&1===a.nodeType)};OpenLayers.Util.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)};if("undefined"===typeof window.$)window.$=OpenLayers.Util.getElement;OpenLayers.Util.removeItem=function(a,b){for(var c=a.length-1;0<=c;c--)a[c]==b&&a.splice(c,1);return a};OpenLayers.Util.indexOf=function(a,b){if("function"==typeof a.indexOf)return a.indexOf(b);for(var c=0,d=a.length;c<d;c++)if(a[c]==b)return c;return-1};
OpenLayers.Util.modifyDOMElement=function(a,b,c,d,e,f,g,h){if(b)a.id=b;if(c)a.style.left=c.x+"px",a.style.top=c.y+"px";if(d)a.style.width=d.w+"px",a.style.height=d.h+"px";if(e)a.style.position=e;if(f)a.style.border=f;if(g)a.style.overflow=g;if(0<=parseFloat(h)&&1>parseFloat(h))a.style.filter="alpha(opacity="+100*h+")",a.style.opacity=h;else if(1==parseFloat(h))a.style.filter="",a.style.opacity=""};
OpenLayers.Util.createDiv=function(a,b,c,d,e,f,g,h){var i=document.createElement("div");if(d)i.style.backgroundImage="url("+d+")";a||(a=OpenLayers.Util.createUniqueID("OpenLayersDiv"));e||(e="absolute");OpenLayers.Util.modifyDOMElement(i,a,b,c,e,f,g,h);return i};
OpenLayers.Util.createImage=function(a,b,c,d,e,f,g,h){var i=document.createElement("img");a||(a=OpenLayers.Util.createUniqueID("OpenLayersDiv"));e||(e="relative");OpenLayers.Util.modifyDOMElement(i,a,b,c,e,f,null,g);if(h)i.style.display="none",b=function(){i.style.display="";OpenLayers.Event.stopObservingElement(i)},OpenLayers.Event.observe(i,"load",b),OpenLayers.Event.observe(i,"error",b);i.style.alt=a;i.galleryImg="no";if(d)i.src=d;return i};OpenLayers.IMAGE_RELOAD_ATTEMPTS=0;
OpenLayers.Util.alphaHackNeeded=null;OpenLayers.Util.alphaHack=function(){if(null==OpenLayers.Util.alphaHackNeeded){var a=navigator.appVersion.split("MSIE"),a=parseFloat(a[1]),b=!1;try{b=!!document.body.filters}catch(c){}OpenLayers.Util.alphaHackNeeded=b&&5.5<=a&&7>a}return OpenLayers.Util.alphaHackNeeded};
OpenLayers.Util.modifyAlphaImageDiv=function(a,b,c,d,e,f,g,h,i){OpenLayers.Util.modifyDOMElement(a,b,c,d,f,null,null,i);b=a.childNodes[0];if(e)b.src=e;OpenLayers.Util.modifyDOMElement(b,a.id+"_innerImage",null,d,"relative",g);if(OpenLayers.Util.alphaHack()){if("none"!=a.style.display)a.style.display="inline-block";null==h&&(h="scale");a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+b.src+"', sizingMethod='"+h+"')";0<=parseFloat(a.style.opacity)&&1>parseFloat(a.style.opacity)&&
(a.style.filter+=" alpha(opacity="+100*a.style.opacity+")");b.style.filter="alpha(opacity=0)"}};OpenLayers.Util.createAlphaImageDiv=function(a,b,c,d,e,f,g,h,i){var k=OpenLayers.Util.createDiv(),i=OpenLayers.Util.createImage(null,null,null,null,null,null,null,i);k.appendChild(i);OpenLayers.Util.modifyAlphaImageDiv(k,a,b,c,d,e,f,g,h);return k};OpenLayers.Util.upperCaseObject=function(a){var b={},c;for(c in a)b[c.toUpperCase()]=a[c];return b};
OpenLayers.Util.applyDefaults=function(a,b){var a=a||{},c="function"==typeof window.Event&&b instanceof window.Event,d;for(d in b)if(void 0===a[d]||!c&&b.hasOwnProperty&&b.hasOwnProperty(d)&&!a.hasOwnProperty(d))a[d]=b[d];if(!c&&b&&b.hasOwnProperty&&b.hasOwnProperty("toString")&&!a.hasOwnProperty("toString"))a.toString=b.toString;return a};
OpenLayers.Util.getParameterString=function(a){var b=[],c;for(c in a){var d=a[c];if(null!=d&&"function"!=typeof d){if("object"==typeof d&&d.constructor==Array){for(var e=[],f,g=0,h=d.length;g<h;g++)f=d[g],e.push(encodeURIComponent(null===f||void 0===f?"":f));d=e.join(",")}else d=encodeURIComponent(d);b.push(encodeURIComponent(c)+"="+d)}}return b.join("&")};OpenLayers.Util.urlAppend=function(a,b){var c=a;if(b)var d=(a+" ").split(/[?&]/),c=c+(" "===d.pop()?b:d.length?"&"+b:"?"+b);return c};
OpenLayers.ImgPath="";OpenLayers.Util.getImagesLocation=function(){return OpenLayers.ImgPath||OpenLayers._getScriptLocation()+"img/"};OpenLayers.Util.Try=function(){for(var a=null,b=0,c=arguments.length;b<c;b++){var d=arguments[b];try{a=d();break}catch(e){}}return a};OpenLayers.Util.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 c=a.relatedTarget?a.relatedTarget:a.toElement;c!=b&&null!=c;)c=c.parentNode;return c!=b};OpenLayers.Util.DEFAULT_PRECISION=14;OpenLayers.Util.toFloat=function(a,b){if(null==b)b=OpenLayers.Util.DEFAULT_PRECISION;"number"!==typeof a&&(a=parseFloat(a));return 0===b?a:parseFloat(a.toPrecision(b))};OpenLayers.Util.rad=function(a){return a*Math.PI/180};OpenLayers.Util.deg=function(a){return 180*a/Math.PI};
OpenLayers.Util.VincentyConstants={a:6378137,b:6356752.3142,f:1/298.257223563};
OpenLayers.Util.distVincenty=function(a,b){for(var c=OpenLayers.Util.VincentyConstants,d=c.a,e=c.b,c=c.f,f=OpenLayers.Util.rad(b.lon-a.lon),g=Math.atan((1-c)*Math.tan(OpenLayers.Util.rad(a.lat))),h=Math.atan((1-c)*Math.tan(OpenLayers.Util.rad(b.lat))),i=Math.sin(g),g=Math.cos(g),k=Math.sin(h),h=Math.cos(h),j=f,n=2*Math.PI,m=20;1.0E-12<Math.abs(j-n)&&0<--m;){var l=Math.sin(j),o=Math.cos(j),r=Math.sqrt(h*l*h*l+(g*k-i*h*o)*(g*k-i*h*o));if(0==r)return 0;var o=i*k+g*h*o,q=Math.atan2(r,o),p=Math.asin(g*
h*l/r),s=Math.cos(p)*Math.cos(p),l=o-2*i*k/s,t=c/16*s*(4+c*(4-3*s)),n=j,j=f+(1-t)*c*Math.sin(p)*(q+t*r*(l+t*o*(-1+2*l*l)))}if(0==m)return NaN;d=s*(d*d-e*e)/(e*e);c=d/1024*(256+d*(-128+d*(74-47*d)));return(e*(1+d/16384*(4096+d*(-768+d*(320-175*d))))*(q-c*r*(l+c/4*(o*(-1+2*l*l)-c/6*l*(-3+4*r*r)*(-3+4*l*l))))).toFixed(3)/1E3};
OpenLayers.Util.destinationVincenty=function(a,b,c){for(var d=OpenLayers.Util,e=d.VincentyConstants,f=e.a,g=e.b,h=e.f,e=a.lon,a=a.lat,i=d.rad(b),b=Math.sin(i),i=Math.cos(i),a=(1-h)*Math.tan(d.rad(a)),k=1/Math.sqrt(1+a*a),j=a*k,n=Math.atan2(a,i),a=k*b,m=1-a*a,f=m*(f*f-g*g)/(g*g),l=1+f/16384*(4096+f*(-768+f*(320-175*f))),o=f/1024*(256+f*(-128+f*(74-47*f))),f=c/(g*l),r=2*Math.PI;1.0E-12<Math.abs(f-r);)var q=Math.cos(2*n+f),p=Math.sin(f),s=Math.cos(f),t=o*p*(q+o/4*(s*(-1+2*q*q)-o/6*q*(-3+4*p*p)*(-3+4*
q*q))),r=f,f=c/(g*l)+t;c=j*p-k*s*i;g=Math.atan2(j*s+k*p*i,(1-h)*Math.sqrt(a*a+c*c));b=Math.atan2(p*b,k*s-j*p*i);i=h/16*m*(4+h*(4-3*m));q=b-(1-i)*h*a*(f+i*p*(q+i*s*(-1+2*q*q)));Math.atan2(a,-c);return new OpenLayers.LonLat(e+d.deg(q),d.deg(g))};
OpenLayers.Util.getParameters=function(a){var a=null===a||void 0===a?window.location.href:a,b="";if(OpenLayers.String.contains(a,"?"))var b=a.indexOf("?")+1,c=OpenLayers.String.contains(a,"#")?a.indexOf("#"):a.length,b=a.substring(b,c);for(var a={},b=b.split(/[&;]/),c=0,d=b.length;c<d;++c){var e=b[c].split("=");if(e[0]){var f=e[0];try{f=decodeURIComponent(f)}catch(g){f=unescape(f)}e=(e[1]||"").replace(/\+/g," ");try{e=decodeURIComponent(e)}catch(h){e=unescape(e)}e=e.split(",");1==e.length&&(e=e[0]);
a[f]=e}}return a};OpenLayers.Util.lastSeqID=0;OpenLayers.Util.createUniqueID=function(a){null==a&&(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:100*OpenLayers.INCHES_PER_UNIT.Meter,km:1E3*OpenLayers.INCHES_PER_UNIT.Meter,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 1<a?1/a:a};OpenLayers.Util.getResolutionFromScale=function(a,b){var c;a&&(null==b&&(b="degrees"),c=1/(OpenLayers.Util.normalizeScale(a)*OpenLayers.INCHES_PER_UNIT[b]*OpenLayers.DOTS_PER_INCH));return c};
OpenLayers.Util.getScaleFromResolution=function(a,b){null==b&&(b="degrees");return a*OpenLayers.INCHES_PER_UNIT[b]*OpenLayers.DOTS_PER_INCH};
OpenLayers.Util.pagePosition=function(a){var b=[0,0],c=OpenLayers.Util.getViewportElement();if(!a||a==window||a==c)return b;var d=OpenLayers.IS_GECKO&&document.getBoxObjectFor&&"absolute"==OpenLayers.Element.getStyle(a,"position")&&(""==a.style.top||""==a.style.left),e=null;if(a.getBoundingClientRect)a=a.getBoundingClientRect(),e=c.scrollTop,b[0]=a.left+c.scrollLeft,b[1]=a.top+e;else if(document.getBoxObjectFor&&!d)a=document.getBoxObjectFor(a),c=document.getBoxObjectFor(c),b[0]=a.screenX-c.screenX,
b[1]=a.screenY-c.screenY;else{b[0]=a.offsetLeft;b[1]=a.offsetTop;e=a.offsetParent;if(e!=a)for(;e;)b[0]+=e.offsetLeft,b[1]+=e.offsetTop,e=e.offsetParent;c=OpenLayers.BROWSER_NAME;if("opera"==c||"safari"==c&&"absolute"==OpenLayers.Element.getStyle(a,"position"))b[1]-=document.body.offsetTop;for(e=a.offsetParent;e&&e!=document.body;){b[0]-=e.scrollLeft;if("opera"!=c||"TR"!=e.tagName)b[1]-=e.scrollTop;e=e.offsetParent}}return b};
OpenLayers.Util.getViewportElement=function(){var a=arguments.callee.viewportElement;if(void 0==a)a="msie"==OpenLayers.BROWSER_NAME&&"CSS1Compat"!=document.compatMode?document.body:document.documentElement,arguments.callee.viewportElement=a;return a};
OpenLayers.Util.isEquivalentUrl=function(a,b,c){c=c||{};OpenLayers.Util.applyDefaults(c,{ignoreCase:!0,ignorePort80:!0,ignoreHash:!0});var a=OpenLayers.Util.createUrlObject(a,c),b=OpenLayers.Util.createUrlObject(b,c),d;for(d in a)if("args"!==d&&a[d]!=b[d])return!1;for(d in a.args){if(a.args[d]!=b.args[d])return!1;delete b.args[d]}for(d in b.args)return!1;return!0};
OpenLayers.Util.createUrlObject=function(a,b){b=b||{};if(!/^\w+:\/\//.test(a)){var c=window.location,d=c.port?":"+c.port:"",d=c.protocol+"//"+c.host.split(":").shift()+d;0===a.indexOf("/")?a=d+a:(c=c.pathname.split("/"),c.pop(),a=d+c.join("/")+"/"+a)}b.ignoreCase&&(a=a.toLowerCase());c=document.createElement("a");c.href=a;d={};d.host=c.host.split(":").shift();d.protocol=c.protocol;d.port=b.ignorePort80?"80"==c.port||"0"==c.port?"":c.port:""==c.port||"0"==c.port?"80":c.port;d.hash=b.ignoreHash||"#"===
c.hash?"":c.hash;var e=c.search;e||(e=a.indexOf("?"),e=-1!=e?a.substr(e):"");d.args=OpenLayers.Util.getParameters(e);d.pathname="/"==c.pathname.charAt(0)?c.pathname:"/"+c.pathname;return d};OpenLayers.Util.removeTail=function(a){var b=null,b=a.indexOf("?"),c=a.indexOf("#");return b=-1==b?-1!=c?a.substr(0,c):a:-1!=c?a.substr(0,Math.min(b,c)):a.substr(0,b)};OpenLayers.IS_GECKO=function(){var a=navigator.userAgent.toLowerCase();return-1==a.indexOf("webkit")&&-1!=a.indexOf("gecko")}();
OpenLayers.BROWSER_NAME=function(){var a="",b=navigator.userAgent.toLowerCase();-1!=b.indexOf("opera")?a="opera":-1!=b.indexOf("msie")?a="msie":-1!=b.indexOf("safari")?a="safari":-1!=b.indexOf("mozilla")&&(a=-1!=b.indexOf("firefox")?"firefox":"mozilla");return a}();OpenLayers.Util.getBrowserName=function(){return OpenLayers.BROWSER_NAME};
OpenLayers.Util.getRenderedDimensions=function(a,b,c){var d,e,f=document.createElement("div");f.style.visibility="hidden";var g=c&&c.containerElement?c.containerElement:document.body;if(b)if(b.w)d=b.w,f.style.width=d+"px";else if(b.h)e=b.h,f.style.height=e+"px";if(c&&c.displayClass)f.className=c.displayClass;b=document.createElement("div");b.innerHTML=a;b.style.overflow="visible";if(b.childNodes){a=0;for(c=b.childNodes.length;a<c;a++)if(b.childNodes[a].style)b.childNodes[a].style.overflow="visible"}f.appendChild(b);
g.appendChild(f);a=!1;for(c=f.parentNode;c&&"body"!=c.tagName.toLowerCase();){var h=OpenLayers.Element.getStyle(c,"position");if("absolute"==h){a=!0;break}else if(h&&"static"!=h)break;c=c.parentNode}if(!a)f.style.position="absolute";if(!d)d=parseInt(b.scrollWidth),f.style.width=d+"px";e||(e=parseInt(b.scrollHeight));f.removeChild(b);g.removeChild(f);return new OpenLayers.Size(d,e)};
OpenLayers.Util.getScrollbarWidth=function(){var a=OpenLayers.Util._scrollbarWidth;if(null==a){var b=null,c=null,b=a=0,b=document.createElement("div");b.style.position="absolute";b.style.top="-1000px";b.style.left="-1000px";b.style.width="100px";b.style.height="50px";b.style.overflow="hidden";c=document.createElement("div");c.style.width="100%";c.style.height="200px";b.appendChild(c);document.body.appendChild(b);a=c.offsetWidth;b.style.overflow="scroll";b=c.offsetWidth;document.body.removeChild(document.body.lastChild);
OpenLayers.Util._scrollbarWidth=a-b;a=OpenLayers.Util._scrollbarWidth}return a};
OpenLayers.Util.getFormattedLonLat=function(a,b,c){c||(c="dms");var a=(a+540)%360-180,d=Math.abs(a),e=Math.floor(d),f=d=(d-e)/(1/60),d=Math.floor(d),f=Math.round(10*((f-d)/(1/60))),f=f/10;60<=f&&(f-=60,d+=1,60<=d&&(d-=60,e+=1));10>e&&(e="0"+e);e+="\u00b0";0<=c.indexOf("dm")&&(10>d&&(d="0"+d),e+=d+"'",0<=c.indexOf("dms")&&(10>f&&(f="0"+f),e+=f+'"'));return e="lon"==b?e+(0>a?OpenLayers.i18n("W"):OpenLayers.i18n("E")):e+(0>a?OpenLayers.i18n("S"):OpenLayers.i18n("N"))};
OpenLayers.Feature=OpenLayers.Class({layer:null,id:null,lonlat:null,data:null,marker:null,popupClass:null,popup:null,initialize:function(a,b,c){this.layer=a;this.lonlat=b;this.data=null!=c?c:{};this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){null!=this.layer&&null!=this.layer.map&&null!=this.popup&&this.layer.map.removePopup(this.popup);null!=this.layer&&null!=this.marker&&this.layer.removeMarker(this.marker);this.data=this.lonlat=this.id=this.layer=null;if(null!=this.marker)this.destroyMarker(this.marker),
this.marker=null;if(null!=this.popup)this.destroyPopup(this.popup),this.popup=null},onScreen:function(){var a=!1;null!=this.layer&&null!=this.layer.map&&(a=this.layer.map.getExtent().containsLonLat(this.lonlat));return a},createMarker:function(){if(null!=this.lonlat)this.marker=new OpenLayers.Marker(this.lonlat,this.data.icon);return this.marker},destroyMarker:function(){this.marker.destroy()},createPopup:function(a){if(null!=this.lonlat){if(!this.popup)this.popup=new (this.popupClass?this.popupClass:
OpenLayers.Popup.AnchoredBubble)(this.id+"_popup",this.lonlat,this.data.popupSize,this.data.popupContentHTML,this.marker?this.marker.icon:null,a);if(null!=this.data.overflow)this.popup.contentDiv.style.overflow=this.data.overflow;this.popup.feature=this}return this.popup},destroyPopup:function(){if(this.popup)this.popup.feature=null,this.popup.destroy(),this.popup=null},CLASS_NAME:"OpenLayers.Feature"});OpenLayers.State={UNKNOWN:"Unknown",INSERT:"Insert",UPDATE:"Update",DELETE:"Delete"};
OpenLayers.Feature.Vector=OpenLayers.Class(OpenLayers.Feature,{fid:null,geometry:null,attributes:null,bounds:null,state:null,style:null,url:null,renderIntent:"default",modified:null,initialize:function(a,b,c){OpenLayers.Feature.prototype.initialize.apply(this,[null,null,b]);this.lonlat=null;this.geometry=a?a:null;this.state=null;this.attributes={};if(b)this.attributes=OpenLayers.Util.extend(this.attributes,b);this.style=c?c:null},destroy:function(){if(this.layer)this.layer.removeFeatures(this),this.layer=
null;this.modified=this.geometry=null;OpenLayers.Feature.prototype.destroy.apply(this,arguments)},clone:function(){return new OpenLayers.Feature.Vector(this.geometry?this.geometry.clone():null,this.attributes,this.style)},onScreen:function(a){var b=!1;this.layer&&this.layer.map&&(b=this.layer.map.getExtent(),a?(a=this.geometry.getBounds(),b=b.intersectsBounds(a)):b=b.toGeometry().intersects(this.geometry));return b},getVisibility:function(){return!(this.style&&"none"==this.style.display||!this.layer||
this.layer&&this.layer.styleMap&&"none"==this.layer.styleMap.createSymbolizer(this,this.renderIntent).display||this.layer&&!this.layer.getVisibility())},createMarker:function(){return null},destroyMarker:function(){},createPopup:function(){return null},atPoint:function(a,b,c){var d=!1;this.geometry&&(d=this.geometry.atPoint(a,b,c));return d},destroyPopup:function(){},move:function(a){if(this.layer&&this.geometry.move){var a="OpenLayers.LonLat"==a.CLASS_NAME?this.layer.getViewPortPxFromLonLat(a):a,
b=this.layer.getViewPortPxFromLonLat(this.geometry.getBounds().getCenterLonLat()),c=this.layer.map.getResolution();this.geometry.move(c*(a.x-b.x),c*(b.y-a.y));this.layer.drawFeature(this);return b}},toState:function(a){if(a==OpenLayers.State.UPDATE)switch(this.state){case OpenLayers.State.UNKNOWN:case OpenLayers.State.DELETE:this.state=a}else if(a==OpenLayers.State.INSERT)switch(this.state){case OpenLayers.State.UNKNOWN:break;default:this.state=a}else if(a==OpenLayers.State.DELETE)switch(this.state){case OpenLayers.State.UNKNOWN:case OpenLayers.State.UPDATE:this.state=
a}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.Style=OpenLayers.Class({id:null,name:null,title:null,description:null,layerName:null,isDefault:!1,rules:null,context:null,defaultStyle:null,defaultsPerSymbolizer:!1,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"]);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){for(var a=0,b=this.rules.length;a<b;a++)this.rules[a].destroy(),
this.rules[a]=null;this.defaultStyle=this.rules=null},createSymbolizer:function(a){for(var b=this.defaultsPerSymbolizer?{}:this.createLiterals(OpenLayers.Util.extend({},this.defaultStyle),a),c=this.rules,d,e=[],f=!1,g=0,h=c.length;g<h;g++)d=c[g],d.evaluate(a)&&(d instanceof OpenLayers.Rule&&d.elseFilter?e.push(d):(f=!0,this.applySymbolizer(d,b,a)));if(!1==f&&0<e.length){f=!0;g=0;for(h=e.length;g<h;g++)this.applySymbolizer(e[g],b,a)}if(0<c.length&&!1==f)b.display="none";if(null!=b.label&&"string"!==
typeof b.label)b.label=""+b.label;return b},applySymbolizer:function(a,b,c){var d=c.geometry?this.getSymbolizerPrefix(c.geometry):OpenLayers.Style.SYMBOLIZER_PREFIXES[0],a=a.symbolizer[d]||a.symbolizer;if(!0===this.defaultsPerSymbolizer)d=this.defaultStyle,OpenLayers.Util.applyDefaults(a,{pointRadius:d.pointRadius}),(!0===a.stroke||!0===a.graphic)&&OpenLayers.Util.applyDefaults(a,{strokeWidth:d.strokeWidth,strokeColor:d.strokeColor,strokeOpacity:d.strokeOpacity,strokeDashstyle:d.strokeDashstyle,strokeLinecap:d.strokeLinecap}),
(!0===a.fill||!0===a.graphic)&&OpenLayers.Util.applyDefaults(a,{fillColor:d.fillColor,fillOpacity:d.fillOpacity}),!0===a.graphic&&OpenLayers.Util.applyDefaults(a,{pointRadius:this.defaultStyle.pointRadius,externalGraphic:this.defaultStyle.externalGraphic,graphicName:this.defaultStyle.graphicName,graphicOpacity:this.defaultStyle.graphicOpacity,graphicWidth:this.defaultStyle.graphicWidth,graphicHeight:this.defaultStyle.graphicHeight,graphicXOffset:this.defaultStyle.graphicXOffset,graphicYOffset:this.defaultStyle.graphicYOffset});
return this.createLiterals(OpenLayers.Util.extend(b,a),c)},createLiterals:function(a,b){var c=OpenLayers.Util.extend({},b.attributes||b.data);OpenLayers.Util.extend(c,this.context);for(var d in this.propertyStyles)a[d]=OpenLayers.Style.createLiteral(a[d],c,b,d);return a},findPropertyStyles:function(){var a={};this.addPropertyStyles(a,this.defaultStyle);for(var b=this.rules,c,d,e=0,f=b.length;e<f;e++){c=b[e].symbolizer;for(var g in c)if(d=c[g],"object"==typeof d)this.addPropertyStyles(a,d);else{this.addPropertyStyles(a,
c);break}}return a},addPropertyStyles:function(a,b){var c,d;for(d in b)c=b[d],"string"==typeof c&&c.match(/\$\{\w+\}/)&&(a[d]=!0);return a},addRules:function(a){Array.prototype.push.apply(this.rules,a);this.propertyStyles=this.findPropertyStyles()},setDefaultStyle:function(a){this.defaultStyle=a;this.propertyStyles=this.findPropertyStyles()},getSymbolizerPrefix:function(a){for(var b=OpenLayers.Style.SYMBOLIZER_PREFIXES,c=0,d=b.length;c<d;c++)if(-1!=a.CLASS_NAME.indexOf(b[c]))return b[c]},clone:function(){var a=
OpenLayers.Util.extend({},this);if(this.rules){a.rules=[];for(var b=0,c=this.rules.length;b<c;++b)a.rules.push(this.rules[b].clone())}a.context=this.context&&OpenLayers.Util.extend({},this.context);b=OpenLayers.Util.extend({},this.defaultStyle);return new OpenLayers.Style(b,a)},CLASS_NAME:"OpenLayers.Style"});OpenLayers.Style.createLiteral=function(a,b,c,d){"string"==typeof a&&-1!=a.indexOf("${")&&(a=OpenLayers.String.format(a,b,[c,d]),a=isNaN(a)||!a?a:parseFloat(a));return a};
OpenLayers.Style.SYMBOLIZER_PREFIXES=["Point","Line","Polygon","Text","Raster"];
OpenLayers.Renderer=OpenLayers.Class({container:null,root:null,extent:null,locked:!1,size:null,resolution:null,map:null,featureDx:0,initialize:function(a,b){this.container=OpenLayers.Util.getElement(a);OpenLayers.Util.extend(this,b)},destroy:function(){this.map=this.resolution=this.size=this.extent=this.container=null},supported:function(){return!1},setExtent:function(a,b){this.extent=a.clone();if(this.map.baseLayer&&this.map.baseLayer.wrapDateLine)this.extent=a.wrapDateLine(this.map.getMaxExtent());
if(b)this.resolution=null;return!0},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(null==b)b=a.style;if(a.geometry){var c=a.geometry.getBounds();if(c){var d;this.map.baseLayer&&this.map.baseLayer.wrapDateLine&&(d=this.map.getMaxExtent());c.intersectsBounds(this.extent,{worldBounds:d})?this.calculateFeatureDx(c,d):b={display:"none"};c=this.drawGeometry(a.geometry,b,
a.id);if("none"!=b.display&&b.label&&!1!==c){d=a.geometry.getCentroid();if(b.labelXOffset||b.labelYOffset){var e=isNaN(b.labelXOffset)?0:b.labelXOffset,f=isNaN(b.labelYOffset)?0:b.labelYOffset,g=this.getResolution();d.move(e*g,f*g)}this.drawText(a.id,b,d)}else this.removeText(a.id);return c}}},calculateFeatureDx:function(a,b){this.featureDx=0;if(b){var c=b.getWidth();this.featureDx=Math.round(((a.left+a.right)/2-(this.extent.left+this.extent.right)/2)/c)*c}},drawGeometry:function(){},drawText:function(){},
removeText:function(){},clear:function(){},getFeatureIdFromEvent:function(){},eraseFeatures:function(a){OpenLayers.Util.isArray(a)||(a=[a]);for(var b=0,c=a.length;b<c;++b){var d=a[b];this.eraseGeometry(d.geometry,d.id);this.removeText(d.id)}},eraseGeometry:function(){},moveRoot:function(){},getRenderLayerId:function(){return this.container.id},applyDefaultSymbolizer:function(a){var b=OpenLayers.Util.extend({},OpenLayers.Renderer.defaultSymbolizer);!1===a.stroke&&(delete b.strokeWidth,delete b.strokeColor);
!1===a.fill&&delete b.fillColor;OpenLayers.Util.extend(b,a);return b},CLASS_NAME:"OpenLayers.Renderer"});OpenLayers.Renderer.defaultSymbolizer={fillColor:"#000000",strokeColor:"#000000",strokeWidth:2,fillOpacity:1,strokeOpacity:1,pointRadius:0};
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.clear()},insert:function(a){this.exists(a)&&this.remove(a);var b=a.id;this.determineZIndex(a);for(var c=-1,d=this.order.length,e;1<d-c;)e=parseInt((c+d)/2),0<this.compare(this,a,OpenLayers.Util.getElement(this.order[e]))?c=e:d=e;this.order.splice(d,
0,b);this.indices[b]=this.getZIndex(a);return this.getNextElement(d)},remove:function(a){var a=a.id,b=OpenLayers.Util.indexOf(this.order,a);if(0<=b)this.order.splice(b,1),delete this.indices[a],this.maxZIndex=0<this.order.length?this.indices[this.order[this.order.length-1]]:0},clear:function(){this.order=[];this.indices={};this.maxZIndex=0},exists:function(a){return null!=this.indices[a.id]},getZIndex:function(a){return a._style.graphicZIndex},determineZIndex:function(a){var b=a._style.graphicZIndex;
if(null==b)b=this.maxZIndex,a._style.graphicZIndex=b;else if(b>this.maxZIndex)this.maxZIndex=b},getNextElement:function(a){a+=1;if(a<this.order.length){var b=OpenLayers.Util.getElement(this.order[a]);void 0==b&&(b=this.getNextElement(a));return b}return null},CLASS_NAME:"OpenLayers.ElementsIndexer"});
OpenLayers.ElementsIndexer.IndexingMethods={Z_ORDER:function(a,b,c){var b=a.getZIndex(b),d=0;c&&(a=a.getZIndex(c),d=b-a);return d},Z_ORDER_DRAWING_ORDER:function(a,b,c){a=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(a,b,c);c&&0==a&&(a=1);return a},Z_ORDER_Y_ORDER:function(a,b,c){a=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(a,b,c);c&&0===a&&(b=c._boundsBottom-b._boundsBottom,a=0===b?1:b);return a}};
OpenLayers.Renderer.Elements=OpenLayers.Class(OpenLayers.Renderer,{rendererRoot:null,root:null,vectorRoot:null,textRoot:null,xmlns:null,xOffset:0,indexer:null,BACKGROUND_ID_SUFFIX:"_background",LABEL_ID_SUFFIX:"_label",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(){var a,b=this.vectorRoot;if(b)for(;a=b.firstChild;)b.removeChild(a);if(b=this.textRoot)for(;a=b.firstChild;)b.removeChild(a);this.indexer&&
this.indexer.clear()},setExtent:function(a,b){var c=OpenLayers.Renderer.prototype.setExtent.apply(this,arguments),d=this.getResolution();if(this.map.baseLayer&&this.map.baseLayer.wrapDateLine){var c=0===this.featureDx,e,f=this.map.getMaxExtent();f.right>a.left&&f.right<a.right?e=!0:f.left>a.left&&f.left<a.right&&(e=!1);if(e!==this.rightOfDateLine||b)c=!1,this.xOffset=!0===e?f.getWidth()/d:0;this.rightOfDateLine=e}return c},getNodeType:function(){},drawGeometry:function(a,b,c){var d=a.CLASS_NAME,e=
!0;if("OpenLayers.Geometry.Collection"==d||"OpenLayers.Geometry.MultiPoint"==d||"OpenLayers.Geometry.MultiLineString"==d||"OpenLayers.Geometry.MultiPolygon"==d){for(var d=0,f=a.components.length;d<f;d++)e=this.drawGeometry(a.components[d],b,c)&&e;return e}d=e=!1;"none"!=b.display&&(b.backgroundGraphic?this.redrawBackgroundNode(a.id,a,b,c):d=!0,e=this.redrawNode(a.id,a,b,c));if(!1==e&&(b=document.getElementById(a.id)))b._style.backgroundGraphic&&(d=!0),b.parentNode.removeChild(b);d&&(b=document.getElementById(a.id+
this.BACKGROUND_ID_SUFFIX))&&b.parentNode.removeChild(b);return e},redrawNode:function(a,b,c,d){c=this.applyDefaultSymbolizer(c);a=this.nodeFactory(a,this.getNodeType(b,c));a._featureId=d;a._boundsBottom=b.getBounds().bottom;a._geometryClass=b.CLASS_NAME;a._style=c;b=this.drawGeometryNode(a,b,c);if(!1===b)return!1;a=b.node;this.indexer?(c=this.indexer.insert(a))?this.vectorRoot.insertBefore(a,c):this.vectorRoot.appendChild(a):a.parentNode!==this.vectorRoot&&this.vectorRoot.appendChild(a);this.postDraw(a);
return b.complete},redrawBackgroundNode:function(a,b,c){c=OpenLayers.Util.extend({},c);c.externalGraphic=c.backgroundGraphic;c.graphicXOffset=c.backgroundXOffset;c.graphicYOffset=c.backgroundYOffset;c.graphicZIndex=c.backgroundGraphicZIndex;c.graphicWidth=c.backgroundWidth||c.graphicWidth;c.graphicHeight=c.backgroundHeight||c.graphicHeight;c.backgroundGraphic=null;c.backgroundXOffset=null;c.backgroundYOffset=null;c.backgroundGraphicZIndex=null;return this.redrawNode(a+this.BACKGROUND_ID_SUFFIX,b,
c,null)},drawGeometryNode:function(a,b,c){var c=c||a._style,d={isFilled:void 0===c.fill?!0:c.fill,isStroked:void 0===c.stroke?!!c.strokeWidth:c.stroke},e;switch(b.CLASS_NAME){case "OpenLayers.Geometry.Point":if(!1===c.graphic)d.isFilled=!1,d.isStroked=!1;e=this.drawPoint(a,b);break;case "OpenLayers.Geometry.LineString":d.isFilled=!1;e=this.drawLineString(a,b);break;case "OpenLayers.Geometry.LinearRing":e=this.drawLinearRing(a,b);break;case "OpenLayers.Geometry.Polygon":e=this.drawPolygon(a,b);break;
case "OpenLayers.Geometry.Rectangle":e=this.drawRectangle(a,b)}a._options=d;return!1!=e?{node:this.setStyle(a,c,d,b),complete:e}:!1},postDraw:function(){},drawPoint:function(){},drawLineString:function(){},drawLinearRing:function(){},drawPolygon:function(){},drawRectangle:function(){},drawCircle:function(){},removeText:function(a){(a=document.getElementById(a+this.LABEL_ID_SUFFIX))&&this.textRoot.removeChild(a)},getFeatureIdFromEvent:function(a){var b=a.target,c=b&&b.correspondingUseElement;return(c?
c:b||a.srcElement)._featureId},eraseGeometry:function(a,b){if("OpenLayers.Geometry.MultiPoint"==a.CLASS_NAME||"OpenLayers.Geometry.MultiLineString"==a.CLASS_NAME||"OpenLayers.Geometry.MultiPolygon"==a.CLASS_NAME||"OpenLayers.Geometry.Collection"==a.CLASS_NAME)for(var c=0,d=a.components.length;c<d;c++)this.eraseGeometry(a.components[c],b);else if((c=OpenLayers.Util.getElement(a.id))&&c.parentNode){if(c.geometry)c.geometry.destroy(),c.geometry=null;c.parentNode.removeChild(c);this.indexer&&this.indexer.remove(c);
c._style.backgroundGraphic&&(c=OpenLayers.Util.getElement(a.id+this.BACKGROUND_ID_SUFFIX))&&c.parentNode&&c.parentNode.removeChild(c)}},nodeFactory:function(a,b){var c=OpenLayers.Util.getElement(a);c?this.nodeTypeCompare(c,b)||(c.parentNode.removeChild(c),c=this.nodeFactory(a,b)):c=this.createNode(b,a);return c},nodeTypeCompare:function(){},createNode:function(){},moveRoot:function(a){var b=this.root;if(a.root.parentNode==this.rendererRoot)b=a.root;b.parentNode.removeChild(b);a.rendererRoot.appendChild(b)},
getRenderLayerId:function(){return this.root.parentNode.parentNode.id},isComplexSymbol:function(a){return"circle"!=a&&!!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.VML=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"urn:schemas-microsoft-com:vml",symbolCache:{},offset:null,initialize:function(a){if(this.supported()){if(!document.namespaces.olv){document.namespaces.add("olv",this.xmlns);for(var b=document.createStyleSheet(),c="shape,rect,oval,fill,stroke,imagedata,group,textbox".split(","),d=0,e=c.length;d<e;d++)b.addRule("olv\\:"+c[d],"behavior: url(#default#VML); position: absolute; display: inline-block;")}OpenLayers.Renderer.Elements.prototype.initialize.apply(this,
arguments)}},supported:function(){return!!document.namespaces},setExtent:function(a,b){var c=OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments),d=this.getResolution(),e=a.left/d|0,d=a.top/d-this.size.h|0;b||!this.offset?(this.offset={x:e,y:d},d=e=0):(e-=this.offset.x,d-=this.offset.y);this.root.coordorigin=e-this.xOffset+" "+d;for(var e=[this.root,this.vectorRoot,this.textRoot],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 c},
setSize:function(a){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);for(var b=[this.rendererRoot,this.root,this.vectorRoot,this.textRoot],c=this.size.w+"px",d=this.size.h+"px",e,f=0,g=b.length;f<g;++f)e=b[f],e.style.width=c,e.style.height=d},getNodeType:function(a,b){var c=null;switch(a.CLASS_NAME){case "OpenLayers.Geometry.Point":c=b.externalGraphic?"olv:rect":this.isComplexSymbol(b.graphicName)?"olv:shape":"olv:oval";break;case "OpenLayers.Geometry.Rectangle":c="olv:rect";break;case "OpenLayers.Geometry.LineString":case "OpenLayers.Geometry.LinearRing":case "OpenLayers.Geometry.Polygon":case "OpenLayers.Geometry.Curve":c=
"olv:shape"}return c},setStyle:function(a,b,c,d){var b=b||a._style,c=c||a._options,e=b.fillColor;if("OpenLayers.Geometry.Point"===a._geometryClass)if(b.externalGraphic){c.isFilled=!0;if(b.graphicTitle)a.title=b.graphicTitle;var e=b.graphicWidth||b.graphicHeight,f=b.graphicHeight||b.graphicWidth,e=e?e:2*b.pointRadius,f=f?f:2*b.pointRadius,g=this.getResolution(),h=void 0!=b.graphicXOffset?b.graphicXOffset:-(0.5*e),i=void 0!=b.graphicYOffset?b.graphicYOffset:-(0.5*f);a.style.left=((d.x-this.featureDx)/
g-this.offset.x+h|0)+"px";a.style.top=(d.y/g-this.offset.y-(i+f)|0)+"px";a.style.width=e+"px";a.style.height=f+"px";a.style.flip="y";e="none";c.isStroked=!1}else this.isComplexSymbol(b.graphicName)?(f=this.importSymbol(b.graphicName),a.path=f.path,a.coordorigin=f.left+","+f.bottom,f=f.size,a.coordsize=f+","+f,this.drawCircle(a,d,b.pointRadius),a.style.flip="y"):this.drawCircle(a,d,b.pointRadius);c.isFilled?a.fillcolor=e:a.filled="false";d=a.getElementsByTagName("fill");d=0==d.length?null:d[0];if(c.isFilled){d||
(d=this.createNode("olv:fill",a.id+"_fill"));d.opacity=b.fillOpacity;if("OpenLayers.Geometry.Point"===a._geometryClass&&b.externalGraphic){if(b.graphicOpacity)d.opacity=b.graphicOpacity;d.src=b.externalGraphic;d.type="frame";if(!b.graphicWidth||!b.graphicHeight)d.aspect="atmost"}d.parentNode!=a&&a.appendChild(d)}else d&&a.removeChild(d);e=b.rotation;if(void 0!==e||void 0!==a._rotation)if(a._rotation=e,b.externalGraphic)this.graphicRotate(a,h,i,b),d.opacity=0;else if("OpenLayers.Geometry.Point"===
a._geometryClass)a.style.rotation=e||0;h=a.getElementsByTagName("stroke");h=0==h.length?null:h[0];if(c.isStroked){if(h||(h=this.createNode("olv:stroke",a.id+"_stroke"),a.appendChild(h)),h.on=!0,h.color=b.strokeColor,h.weight=b.strokeWidth+"px",h.opacity=b.strokeOpacity,h.endcap="butt"==b.strokeLinecap?"flat":b.strokeLinecap||"round",b.strokeDashstyle)h.dashstyle=this.dashStyle(b)}else if(a.stroked=!1,h)h.on=!1;if("inherit"!=b.cursor&&null!=b.cursor)a.style.cursor=b.cursor;return a},graphicRotate:function(a,
b,c,d){var d=d||a._style,e=d.rotation||0,f,g;if(!d.graphicWidth||!d.graphicHeight){var h=new Image;h.onreadystatechange=OpenLayers.Function.bind(function(){if("complete"==h.readyState||"interactive"==h.readyState)f=h.width/h.height,g=Math.max(2*d.pointRadius,d.graphicWidth||0,d.graphicHeight||0),b*=f,d.graphicWidth=g*f,d.graphicHeight=g,this.graphicRotate(a,b,c,d)},this);h.src=d.externalGraphic}else{g=Math.max(d.graphicWidth,d.graphicHeight);f=d.graphicWidth/d.graphicHeight;var i=Math.round(d.graphicWidth||
g*f),k=Math.round(d.graphicHeight||g);a.style.width=i+"px";a.style.height=k+"px";var j=document.getElementById(a.id+"_image");j||(j=this.createNode("olv:imagedata",a.id+"_image"),a.appendChild(j));j.style.width=i+"px";j.style.height=k+"px";j.src=d.externalGraphic;j.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='', sizingMethod='scale')";j=e*Math.PI/180;e=Math.sin(j);j=Math.cos(j);e="progid:DXImageTransform.Microsoft.Matrix(M11="+j+",M12="+-e+",M21="+e+",M22="+j+",SizingMethod='auto expand')\n";
(j=d.graphicOpacity||d.fillOpacity)&&1!=j&&(e+="progid:DXImageTransform.Microsoft.BasicImage(opacity="+j+")\n");a.style.filter=e;e=new OpenLayers.Geometry.Point(-b,-c);i=(new OpenLayers.Bounds(0,0,i,k)).toGeometry();i.rotate(d.rotation,e);i=i.getBounds();a.style.left=Math.round(parseInt(a.style.left)+i.left)+"px";a.style.top=Math.round(parseInt(a.style.top)-i.bottom)+"px"}},postDraw:function(a){a.style.visibility="visible";var b=a._style.fillColor,c=a._style.strokeColor;if("none"==b&&a.fillcolor!=
b)a.fillcolor=b;if("none"==c&&a.strokecolor!=c)a.strokecolor=c},setNodeDimension:function(a,b){var c=b.getBounds();if(c){var d=this.getResolution(),c=new OpenLayers.Bounds((c.left-this.featureDx)/d-this.offset.x|0,c.bottom/d-this.offset.y|0,(c.right-this.featureDx)/d-this.offset.x|0,c.top/d-this.offset.y|0);a.style.left=c.left+"px";a.style.top=c.top+"px";a.style.width=c.getWidth()+"px";a.style.height=c.getHeight()+"px";a.coordorigin=c.left+" "+c.top;a.coordsize=c.getWidth()+" "+c.getHeight()}},dashStyle:function(a){a=
a.strokeDashstyle;switch(a){case "solid":case "dot":case "dash":case "dashdot":case "longdash":case "longdashdot":return a;default:return a=a.split(/[ ,]/),2==a.length?1*a[0]>=2*a[1]?"longdash":1==a[0]||1==a[1]?"dot":"dash":4==a.length?1*a[0]>=2*a[1]?"longdashdot":"dashdot":"solid"}},createNode:function(a,b){var c=document.createElement(a);if(b)c.id=b;c.unselectable="on";c.onselectstart=OpenLayers.Function.False;return c},nodeTypeCompare:function(a,b){var c=b,d=c.indexOf(":");-1!=d&&(c=c.substr(d+
1));var e=a.nodeName,d=e.indexOf(":");-1!=d&&(e=e.substr(d+1));return c==e},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_vmlRoot","div")},createRoot:function(a){return this.nodeFactory(this.container.id+a,"olv:group")},drawPoint:function(a,b){return this.drawCircle(a,b,1)},drawCircle:function(a,b,c){if(!isNaN(b.x)&&!isNaN(b.y)){var d=this.getResolution();a.style.left=((b.x-this.featureDx)/d-this.offset.x|0)-c+"px";a.style.top=(b.y/d-this.offset.y|0)-c+"px";b=2*c;a.style.width=
b+"px";a.style.height=b+"px";return a}return!1},drawLineString:function(a,b){return this.drawLine(a,b,!1)},drawLinearRing:function(a,b){return this.drawLine(a,b,!0)},drawLine:function(a,b,c){this.setNodeDimension(a,b);for(var d=this.getResolution(),e=b.components.length,f=Array(e),g,h,i=0;i<e;i++)g=b.components[i],h=(g.x-this.featureDx)/d-this.offset.x|0,g=g.y/d-this.offset.y|0,f[i]=" "+h+","+g+" l ";a.path="m"+f.join("")+(c?" x e":" e");return a},drawPolygon:function(a,b){this.setNodeDimension(a,
b);var c=this.getResolution(),d=[],e,f,g,h,i,k,j,n,m,l;for(e=0,f=b.components.length;e<f;e++){d.push("m");g=b.components[e].components;h=0===e;k=i=null;for(j=0,n=g.length;j<n;j++)m=g[j],l=(m.x-this.featureDx)/c-this.offset.x|0,m=m.y/c-this.offset.y|0,l=" "+l+","+m,d.push(l),0==j&&d.push(" l"),h||(i?i!=l&&(k?k!=l&&(h=!0):k=l):i=l);d.push(h?" x ":" ")}d.push("e");a.path=d.join("");return a},drawRectangle:function(a,b){var c=this.getResolution();a.style.left=((b.x-this.featureDx)/c-this.offset.x|0)+
"px";a.style.top=(b.y/c-this.offset.y|0)+"px";a.style.width=(b.width/c|0)+"px";a.style.height=(b.height/c|0)+"px";return a},drawText:function(a,b,c){var d=this.nodeFactory(a+this.LABEL_ID_SUFFIX,"olv:rect"),e=this.nodeFactory(a+this.LABEL_ID_SUFFIX+"_textbox","olv:textbox"),f=this.getResolution();d.style.left=((c.x-this.featureDx)/f-this.offset.x|0)+"px";d.style.top=(c.y/f-this.offset.y|0)+"px";d.style.flip="y";e.innerText=b.label;if("inherit"!=b.cursor&&null!=b.cursor)e.style.cursor=b.cursor;if(b.fontColor)e.style.color=
b.fontColor;if(b.fontOpacity)e.style.filter="alpha(opacity="+100*b.fontOpacity+")";if(b.fontFamily)e.style.fontFamily=b.fontFamily;if(b.fontSize)e.style.fontSize=b.fontSize;if(b.fontWeight)e.style.fontWeight=b.fontWeight;if(b.fontStyle)e.style.fontStyle=b.fontStyle;if(!0===b.labelSelect)d._featureId=a,e._featureId=a,e._geometry=c,e._geometryClass=c.CLASS_NAME;e.style.whiteSpace="nowrap";e.inset="1px,0px,0px,0px";d.parentNode||(d.appendChild(e),this.textRoot.appendChild(d));b=b.labelAlign||"cm";1==
b.length&&(b+="m");a=e.clientWidth*OpenLayers.Renderer.VML.LABEL_SHIFT[b.substr(0,1)];e=e.clientHeight*OpenLayers.Renderer.VML.LABEL_SHIFT[b.substr(1,1)];d.style.left=parseInt(d.style.left)-a-1+"px";d.style.top=parseInt(d.style.top)+e+"px"},moveRoot:function(a){var b=this.map.getLayer(a.container.id);b instanceof OpenLayers.Layer.Vector.RootContainer&&(b=this.map.getLayer(this.container.id));b&&b.renderer.clear();OpenLayers.Renderer.Elements.prototype.moveRoot.apply(this,arguments);b&&b.redraw()},
importSymbol:function(a){var b=this.container.id+"-"+a,c=this.symbolCache[b];if(c)return c;c=OpenLayers.Renderer.symbol[a];if(!c)throw Error(a+" is not a valid symbol name");for(var a=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0),d=["m"],e=0;e<c.length;e+=2){var f=c[e],g=c[e+1];a.left=Math.min(a.left,f);a.bottom=Math.min(a.bottom,g);a.right=Math.max(a.right,f);a.top=Math.max(a.top,g);d.push(f);d.push(g);0==e&&d.push("l")}d.push("x e");c=d.join(" ");d=(a.getWidth()-a.getHeight())/2;
0<d?(a.bottom-=d,a.top+=d):(a.left+=d,a.right-=d);c={path:c,size:a.getWidth(),left:a.left,bottom:a.bottom};return this.symbolCache[b]=c},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.Tween=OpenLayers.Class({INTERVAL:10,easing:null,begin:null,finish:null,duration:null,callbacks:null,time:null,interval:null,playing:!1,initialize:function(a){this.easing=a?a:OpenLayers.Easing.Expo.easeOut},start:function(a,b,c,d){this.playing=!0;this.begin=a;this.finish=b;this.duration=c;this.callbacks=d.callbacks;this.time=0;if(this.interval)window.clearInterval(this.interval),this.interval=null;this.callbacks&&this.callbacks.start&&this.callbacks.start.call(this,this.begin);this.interval=
window.setInterval(OpenLayers.Function.bind(this.play,this),this.INTERVAL)},stop:function(){if(this.playing)this.callbacks&&this.callbacks.done&&this.callbacks.done.call(this,this.finish),window.clearInterval(this.interval),this.interval=null,this.playing=!1},play:function(){var a={},b;for(b in this.begin){var c=this.begin[b],d=this.finish[b];if(null==c||null==d||isNaN(c)||isNaN(d))throw new TypeError("invalid value for Tween");a[b]=this.easing.apply(this,[this.time,c,d-c,this.duration])}this.time++;
this.callbacks&&this.callbacks.eachStep&&this.callbacks.eachStep.call(this,a);this.time>this.duration&&this.stop()},CLASS_NAME:"OpenLayers.Tween"});OpenLayers.Easing={CLASS_NAME:"OpenLayers.Easing"};OpenLayers.Easing.Linear={easeIn:function(a,b,c,d){return c*a/d+b},easeOut:function(a,b,c,d){return c*a/d+b},easeInOut:function(a,b,c,d){return c*a/d+b},CLASS_NAME:"OpenLayers.Easing.Linear"};
OpenLayers.Easing.Expo={easeIn:function(a,b,c,d){return 0==a?b:c*Math.pow(2,10*(a/d-1))+b},easeOut:function(a,b,c,d){return a==d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b},easeInOut:function(a,b,c,d){return 0==a?b:a==d?b+c:1>(a/=d/2)?c/2*Math.pow(2,10*(a-1))+b:c/2*(-Math.pow(2,-10*--a)+2)+b},CLASS_NAME:"OpenLayers.Easing.Expo"};
OpenLayers.Easing.Quad={easeIn:function(a,b,c,d){return c*(a/=d)*a+b},easeOut:function(a,b,c,d){return-c*(a/=d)*(a-2)+b},easeInOut:function(a,b,c,d){return 1>(a/=d/2)?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b},CLASS_NAME:"OpenLayers.Easing.Quad"};
OpenLayers.Control=OpenLayers.Class({id:null,map:null,div:null,type:null,allowSelection:!1,displayClass:"",title:"",autoActivate:!1,active:null,handler:null,eventListeners:null,events:null,initialize:function(a){this.displayClass=this.CLASS_NAME.replace("OpenLayers.","ol").replace(/\./g,"");OpenLayers.Util.extend(this,a);this.events=new OpenLayers.Events(this);if(this.eventListeners instanceof Object)this.events.on(this.eventListeners);if(null==this.id)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)&&"function"==typeof this.handlers[a].destroy&&this.handlers[a].destroy();this.handlers=null}if(this.map)this.map.removeControl(this),this.map=null;this.div=null},setMap:function(a){this.map=a;this.handler&&
this.handler.setMap(a)},draw:function(a){if(null==this.div){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(null!=a)this.position=a.clone();this.moveTo(this.position);return this.div},moveTo:function(a){if(null!=a&&null!=this.div)this.div.style.left=a.x+"px",this.div.style.top=
a.y+"px"},activate:function(){if(this.active)return!1;this.handler&&this.handler.activate();this.active=!0;this.map&&OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active");this.events.triggerEvent("activate");return!0},deactivate:function(){return this.active?(this.handler&&this.handler.deactivate(),this.active=!1,this.map&&OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active"),this.events.triggerEvent("deactivate"),
!0):!1},CLASS_NAME:"OpenLayers.Control"});OpenLayers.Control.TYPE_BUTTON=1;OpenLayers.Control.TYPE_TOGGLE=2;OpenLayers.Control.TYPE_TOOL=3;
OpenLayers.Event={observers:!1,KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(a){return a.target||a.srcElement},isSingleTouch:function(a){return a.touches&&1==a.touches.length},isMultiTouch:function(a){return a.touches&&1<a.touches.length},isLeftClick:function(a){return a.which&&1==a.which||a.button&&1==a.button},isRightClick:function(a){return a.which&&3==a.which||a.button&&2==a.button},stop:function(a,b){if(!b)a.preventDefault?
a.preventDefault():a.returnValue=!1;a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},findElement:function(a,b){for(var c=OpenLayers.Event.element(a);c.parentNode&&(!c.tagName||c.tagName.toUpperCase()!=b.toUpperCase());)c=c.parentNode;return c},observe:function(a,b,c,d){a=OpenLayers.Util.getElement(a);d=d||!1;if("keypress"==b&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||a.attachEvent))b="keydown";if(!this.observers)this.observers={};if(!a._eventCacheID){var e="eventCacheID_";a.id&&
(e=a.id+"_"+e);a._eventCacheID=OpenLayers.Util.createUniqueID(e)}e=a._eventCacheID;this.observers[e]||(this.observers[e]=[]);this.observers[e].push({element:a,name:b,observer:c,useCapture:d});a.addEventListener?a.addEventListener(b,c,d):a.attachEvent&&a.attachEvent("on"+b,c)},stopObservingElement:function(a){a=OpenLayers.Util.getElement(a)._eventCacheID;this._removeElementObservers(OpenLayers.Event.observers[a])},_removeElementObservers:function(a){if(a)for(var b=a.length-1;0<=b;b--){var c=a[b];OpenLayers.Event.stopObserving.apply(this,
[c.element,c.name,c.observer,c.useCapture])}},stopObserving:function(a,b,c,d){var d=d||!1,a=OpenLayers.Util.getElement(a),e=a._eventCacheID;if("keypress"==b&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||a.detachEvent))b="keydown";var f=!1,g=OpenLayers.Event.observers[e];if(g)for(var h=0;!f&&h<g.length;){var i=g[h];if(i.name==b&&i.observer==c&&i.useCapture==d){g.splice(h,1);0==g.length&&delete OpenLayers.Event.observers[e];f=!0;break}h++}f&&(a.removeEventListener?a.removeEventListener(b,
c,d):a&&a.detachEvent&&a.detachEvent("on"+b,c));return f},unloadCache:function(){if(OpenLayers.Event&&OpenLayers.Event.observers){for(var a in OpenLayers.Event.observers)OpenLayers.Event._removeElementObservers.apply(this,[OpenLayers.Event.observers[a]]);OpenLayers.Event.observers=!1}},CLASS_NAME:"OpenLayers.Event"};OpenLayers.Event.observe(window,"unload",OpenLayers.Event.unloadCache,!1);
OpenLayers.Events=OpenLayers.Class({BROWSER_EVENTS:"mouseover,mouseout,mousedown,mouseup,mousemove,click,dblclick,rightclick,dblrightclick,resize,focus,blur,touchstart,touchmove,touchend".split(","),listeners:null,object:null,element:null,eventHandler:null,fallThrough:null,includeXY:!1,clearMouseListener:null,initialize:function(a,b,c,d,e){OpenLayers.Util.extend(this,e);this.object=a;this.fallThrough=d;this.listeners={};if(null!=b)this.eventHandler=OpenLayers.Function.bindAsEventListener(this.handleBrowserEvent,
this),this.clearMouseListener=OpenLayers.Function.bind(this.clearMouseCache,this),this.attachToElement(b)},destroy:function(){this.element&&(OpenLayers.Event.stopObservingElement(this.element),this.element.hasScrollEvent&&OpenLayers.Event.stopObserving(window,"scroll",this.clearMouseListener));this.eventHandler=this.fallThrough=this.object=this.listeners=this.element=null},addEventType:function(){},attachToElement:function(a){this.element&&OpenLayers.Event.stopObservingElement(this.element);this.element=
a;for(var b=0,c=this.BROWSER_EVENTS.length;b<c;b++)OpenLayers.Event.observe(a,this.BROWSER_EVENTS[b],this.eventHandler);OpenLayers.Event.observe(a,"dragstart",OpenLayers.Event.stop)},on:function(a){for(var b in a)"scope"!=b&&a.hasOwnProperty(b)&&this.register(b,a.scope,a[b])},register:function(a,b,c,d){if(null!=c){if(null==b)b=this.object;var e=this.listeners[a];e||(e=[],this.listeners[a]=e);d?e.unshift({obj:b,func:c}):e.push({obj:b,func:c})}},registerPriority:function(a,b,c){this.register(a,b,c,
!0)},un:function(a){for(var b in a)"scope"!=b&&a.hasOwnProperty(b)&&this.unregister(b,a.scope,a[b])},unregister:function(a,b,c){if(null==b)b=this.object;a=this.listeners[a];if(null!=a)for(var d=0,e=a.length;d<e;d++)if(a[d].obj==b&&a[d].func==c){a.splice(d,1);break}},remove:function(a){null!=this.listeners[a]&&(this.listeners[a]=[])},triggerEvent:function(a,b){var c=this.listeners[a];if(c&&0!=c.length){null==b&&(b={});b.object=this.object;b.element=this.element;if(!b.type)b.type=a;for(var c=c.slice(),
d,e=0,f=c.length;e<f&&!(d=c[e],d=d.func.apply(d.obj,[b]),void 0!=d&&!1==d);e++);this.fallThrough||OpenLayers.Event.stop(b,!0);return d}},handleBrowserEvent:function(a){var b=a.type,c=this.listeners[b];if(c&&0!=c.length){if((c=a.touches)&&c[0]){for(var d=0,e=0,f=c.length,g,h=0;h<f;++h)g=c[h],d+=g.clientX,e+=g.clientY;a.clientX=d/f;a.clientY=e/f}if(this.includeXY)a.xy=this.getMousePosition(a);this.triggerEvent(b,a)}},clearMouseCache:function(){this.element.scrolls=null;this.element.lefttop=null;var a=
document.body;if(a&&(!(0!=a.scrollTop||0!=a.scrollLeft)||!navigator.userAgent.match(/iPhone/i)))this.element.offsets=null},getMousePosition:function(a){if(this.includeXY){if(!this.element.hasScrollEvent)OpenLayers.Event.observe(window,"scroll",this.clearMouseListener),this.element.hasScrollEvent=!0}else this.clearMouseCache();if(!this.element.scrolls){var b=OpenLayers.Util.getViewportElement();this.element.scrolls=[b.scrollLeft,b.scrollTop]}if(!this.element.lefttop)this.element.lefttop=[document.documentElement.clientLeft||
0,document.documentElement.clientTop||0];if(!this.element.offsets)this.element.offsets=OpenLayers.Util.pagePosition(this.element);return new OpenLayers.Pixel(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.Map=OpenLayers.Class({Z_INDEX_BASE:{BaseLayer:100,Overlay:325,Feature:725,Popup:750,Control:1E3},id:null,fractionalZoom:!1,events:null,allOverlays:!1,div:null,dragging:!1,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,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:!0,panTween:null,eventListeners:null,panMethod:OpenLayers.Easing.Expo.easeOut,panDuration:50,paddingForPopups:null,minPx:null,maxPx:null,initialize:function(a,b){1===arguments.length&&"object"===typeof a&&(a=(b=a)&&b.div);this.tileSize=new OpenLayers.Size(OpenLayers.Map.TILE_WIDTH,OpenLayers.Map.TILE_HEIGHT);this.maxExtent=new OpenLayers.Bounds(-180,-90,180,90);this.paddingForPopups=new OpenLayers.Bounds(15,
15,15,15);this.theme=OpenLayers._getScriptLocation()+"theme/default/style.css";OpenLayers.Util.extend(this,b);if(this.maxExtent&&!(this.maxExtent instanceof OpenLayers.Bounds))this.maxExtent=new OpenLayers.Bounds(this.maxExtent);if(this.restrictedExtent&&!(this.restrictedExtent instanceof OpenLayers.Bounds))this.restrictedExtent=new OpenLayers.Bounds(this.restrictedExtent);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 c=this.id+"_OpenLayers_ViewPort";this.viewPortDiv=OpenLayers.Util.createDiv(c,null,null,null,"relative",null,"hidden");this.viewPortDiv.style.width="100%";this.viewPortDiv.style.height="100%";this.viewPortDiv.className="olMapViewport";this.div.appendChild(this.viewPortDiv);c=document.createElement("div");c.id=this.id+"_events";c.style.position="absolute";c.style.width=
"100%";c.style.height="100%";c.style.zIndex=this.Z_INDEX_BASE.Control-1;this.viewPortDiv.appendChild(c);this.eventsDiv=c;this.events=new OpenLayers.Events(this,this.eventsDiv,null,this.fallThrough,{includeXY:!0});c=this.id+"_OpenLayers_Container";this.layerContainerDiv=OpenLayers.Util.createDiv(c);this.layerContainerDiv.style.width="100px";this.layerContainerDiv.style.height="100px";this.layerContainerDiv.style.zIndex=this.Z_INDEX_BASE.Popup-1;this.eventsDiv.appendChild(this.layerContainerDiv);this.updateSize();
if(this.eventListeners instanceof Object)this.events.on(this.eventListeners);this.events.register("movestart",this,this.updateSize);OpenLayers.String.contains(navigator.appName,"Microsoft")?this.events.register("resize",this,this.updateSize):(this.updateSizeDestroy=OpenLayers.Function.bind(this.updateSize,this),OpenLayers.Event.observe(window,"resize",this.updateSizeDestroy));if(this.theme){for(var c=!0,d=document.getElementsByTagName("link"),e=0,f=d.length;e<f;++e)if(OpenLayers.Util.isEquivalentUrl(d.item(e).href,
this.theme)){c=!1;break}c&&(c=document.createElement("link"),c.setAttribute("rel","stylesheet"),c.setAttribute("type","text/css"),c.setAttribute("href",this.theme),document.getElementsByTagName("head")[0].appendChild(c))}if(null==this.controls)this.controls=null!=OpenLayers.Control?[new OpenLayers.Control.Navigation,new OpenLayers.Control.PanZoom,new OpenLayers.Control.ArgParser,new OpenLayers.Control.Attribution]:[];e=0;for(f=this.controls.length;e<f;e++)this.addControlToMap(this.controls[e]);this.popups=
[];this.unloadDestroy=OpenLayers.Function.bind(this.destroy,this);OpenLayers.Event.observe(window,"unload",this.unloadDestroy);b&&b.layers&&(delete this.center,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.viewPortDiv.parentNode.removeChild(this.viewPortDiv);this.div.appendChild(this.viewPortDiv);this.updateSize()},unloadDestroy:null,updateSizeDestroy:null,destroy:function(){if(!this.unloadDestroy)return!1;
if(this.panTween)this.panTween.stop(),this.panTween=null;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(null!=this.controls){for(var a=this.controls.length-1;0<=a;--a)this.controls[a].destroy();this.controls=null}if(null!=this.layers){for(a=this.layers.length-1;0<=a;--a)this.layers[a].destroy(!1);
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){var b=this.minPx&&a.restrictedExtent!=this.restrictedExtent;OpenLayers.Util.extend(this,a);b&&this.moveTo(this.getCachedCenter(),this.zoom,{forceZoomChange:!0})},getTileSize:function(){return this.tileSize},getBy:function(a,b,c){var d="function"==typeof c.test;
return OpenLayers.Array.filter(this[a],function(a){return a[b]==c||d&&c.test(a[b])})},getLayersBy:function(a,b){return this.getBy("layers",a,b)},getLayersByName:function(a){return this.getLayersBy("name",a)},getLayersByClass:function(a){return this.getLayersBy("CLASS_NAME",a)},getControlsBy:function(a,b){return this.getBy("controls",a,b)},getControlsByClass:function(a){return this.getControlsBy("CLASS_NAME",a)},getLayer:function(a){for(var b=null,c=0,d=this.layers.length;c<d;c++){var e=this.layers[c];
if(e.id==a){b=e;break}}return b},setLayerZIndex:function(a,b){a.setZIndex(this.Z_INDEX_BASE[a.isBaseLayer?"BaseLayer":"Overlay"]+5*b)},resetLayersZIndex:function(){for(var a=0,b=this.layers.length;a<b;a++)this.setLayerZIndex(this.layers[a],a)},addLayer:function(a){for(var b=0,c=this.layers.length;b<c;b++)if(this.layers[b]==a)throw Error("You tried to add the layer: "+a.name+" to the map, but it has already been added");if(!1!==this.events.triggerEvent("preaddlayer",{layer:a})){if(this.allOverlays)a.isBaseLayer=
!1;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);a.isBaseLayer||this.allOverlays&&!this.baseLayer?null==this.baseLayer?this.setBaseLayer(a):a.setVisibility(!1):a.redraw();this.events.triggerEvent("addlayer",{layer:a});a.events.triggerEvent("added",{map:this,layer:a});a.afterAdd()}},addLayers:function(a){for(var b=0,c=a.length;b<
c;b++)this.addLayer(a[b])},removeLayer:function(a,b){if(!1!==this.events.triggerEvent("preremovelayer",{layer:a})){null==b&&(b=!0);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,b))for(var c=0,d=this.layers.length;c<d;c++){var e=this.layers[c];if(e.isBaseLayer||this.allOverlays){this.setBaseLayer(e);break}}this.resetLayersZIndex();this.events.triggerEvent("removelayer",
{layer:a});a.events.triggerEvent("removed",{map:this,layer:a})}},getNumLayers:function(){return this.layers.length},getLayerIndex:function(a){return OpenLayers.Util.indexOf(this.layers,a)},setLayerIndex:function(a,b){var c=this.getLayerIndex(a);if(0>b)b=0;else if(b>this.layers.length)b=this.layers.length;if(c!=b){this.layers.splice(c,1);this.layers.splice(b,0,a);for(var c=0,d=this.layers.length;c<d;c++)this.setLayerZIndex(this.layers[c],c);this.events.triggerEvent("changelayer",{layer:a,property:"order"});
this.allOverlays&&(0===b?this.setBaseLayer(a):this.baseLayer!==this.layers[0]&&this.setBaseLayer(this.layers[0]))}},raiseLayer:function(a,b){var c=this.getLayerIndex(a)+b;this.setLayerIndex(a,c)},setBaseLayer:function(a){if(a!=this.baseLayer&&-1!=OpenLayers.Util.indexOf(this.layers,a)){var b=this.getCachedCenter(),c=OpenLayers.Util.getResolutionFromScale(this.getScale(),a.units);null!=this.baseLayer&&!this.allOverlays&&this.baseLayer.setVisibility(!1);this.baseLayer=a;(!this.allOverlays||this.baseLayer.visibility)&&
this.baseLayer.setVisibility(!0);null!=b&&(a=this.getZoomForResolution(c||this.resolution,!0),this.setCenter(b,a,!1,!0));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 c=1===arguments.length?[]:b,d=0,e=a.length;d<e;d++)this.addControl(a[d],c[d]?c[d]:null)},addControlToMap:function(a,b){a.outsideViewport=null!=a.div;if(this.displayProjection&&!a.displayProjection)a.displayProjection=
this.displayProjection;a.setMap(this);var c=a.draw(b);if(c&&!a.outsideViewport)c.style.zIndex=this.Z_INDEX_BASE.Control+this.controls.length,this.viewPortDiv.appendChild(c);a.autoActivate&&a.activate()},getControl:function(a){for(var b=null,c=0,d=this.controls.length;c<d;c++){var e=this.controls[c];if(e.id==a){b=e;break}}return b},removeControl:function(a){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 c=this.popups.length-1;0<=c;--c)this.removePopup(this.popups[c]);a.map=this;this.popups.push(a);if(c=a.draw())c.style.zIndex=this.Z_INDEX_BASE.Popup+this.popups.length,this.layerContainerDiv.appendChild(c)},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;null!=this.size&&(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(null==b)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.getCachedCenter();if(null!=this.baseLayer&&null!=a)b=this.getZoom(),this.zoom=null,this.setCenter(a,b)}}},getCurrentSize:function(){var a=new OpenLayers.Size(this.div.clientWidth,this.div.clientHeight);if(0==a.w&&0==a.h||isNaN(a.w)&&isNaN(a.h))a.w=this.div.offsetWidth,a.h=this.div.offsetHeight;
if(0==a.w&&0==a.h||isNaN(a.w)&&isNaN(a.h))a.w=parseInt(this.div.style.width),a.h=parseInt(this.div.style.height);return a},calculateBounds:function(a,b){var c=null;null==a&&(a=this.getCachedCenter());null==b&&(b=this.getResolution());if(null!=a&&null!=b)var d=this.getSize(),c=d.w*b,d=d.h*b,c=new OpenLayers.Bounds(a.lon-c/2,a.lat-d/2,a.lon+c/2,a.lat+d/2);return c},getCenter:function(){var a=null,b=this.getCachedCenter();b&&(a=b.clone());return a},getCachedCenter:function(){if(!this.center&&this.size)this.center=
this.getLonLatFromViewPortPx(new OpenLayers.Pixel(this.size.w/2,this.size.h/2));return this.center},getZoom:function(){return this.zoom},pan:function(a,b,c){c=OpenLayers.Util.applyDefaults(c,{animate:!0,dragging:!1});if(c.dragging)(0!=a||0!=b)&&this.moveByPx(a,b);else{var d=this.getViewPortPxFromLonLat(this.getCachedCenter()),a=d.add(a,b);if(this.dragging||!a.equals(d))d=this.getLonLatFromViewPortPx(a),c.animate?this.panTo(d):(this.moveTo(d),this.dragging=!1,this.events.triggerEvent("moveend"))}},
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.getCachedCenter();if(!a.equals(b)){var b=this.getPixelFromLonLat(b),c=this.getPixelFromLonLat(a),d=0,e=0;this.panTween.start({x:0,y:0},{x:c.x-b.x,y:c.y-b.y},this.panDuration,{callbacks:{eachStep:OpenLayers.Function.bind(function(a){this.moveByPx(a.x-d,a.y-e);d=Math.round(a.x);e=Math.round(a.y)},this),done:OpenLayers.Function.bind(function(){this.moveTo(a);
this.dragging=!1;this.events.triggerEvent("moveend")},this)}})}}else this.setCenter(a)},setCenter:function(a,b,c,d){this.panTween&&this.panTween.stop();this.moveTo(a,b,{dragging:c,forceZoomChange:d})},moveByPx:function(a,b){var c=this.size.w/2,d=this.size.h/2,e=c+a,f=d+b,g=this.baseLayer.wrapDateLine,h=0,i=0;this.restrictedExtent&&(h=c,i=d,g=!1);a=g||e<=this.maxPx.x-h&&e>=this.minPx.x+h?Math.round(a):0;b=f<=this.maxPx.y-i&&f>=this.minPx.y+i?Math.round(b):0;if(a||b){if(!this.dragging)this.dragging=
!0,this.events.triggerEvent("movestart");this.center=null;if(a)this.layerContainerDiv.style.left=parseInt(this.layerContainerDiv.style.left)-a+"px",this.minPx.x-=a,this.maxPx.x-=a;if(b)this.layerContainerDiv.style.top=parseInt(this.layerContainerDiv.style.top)-b+"px",this.minPx.y-=b,this.maxPx.y-=b;for(d=0,e=this.layers.length;d<e;++d)if(c=this.layers[d],c.visibility&&(c===this.baseLayer||c.inRange))c.moveByPx(a,b),c.events.triggerEvent("move");this.events.triggerEvent("move")}},adjustZoom:function(a){var b=
this.baseLayer.resolutions,c=this.getMaxExtent().getWidth()/this.getSize().w;if(this.getResolutionForZoom(a)>c)for(var d=a|0,e=b.length;d<e;++d)if(b[d]<=c){a=d;break}return a},moveTo:function(a,b,c){a instanceof OpenLayers.LonLat||(a=new OpenLayers.LonLat(a));c||(c={});null!=b&&(b=parseFloat(b),this.fractionalZoom||(b=Math.round(b)));this.baseLayer.wrapDateLine&&(b=this.adjustZoom(b));var d=c.dragging||this.dragging,e=c.forceZoomChange;if(!this.getCachedCenter()&&!this.isValidLonLat(a))a=this.maxExtent.getCenterLonLat(),
this.center=a.clone();if(null!=this.restrictedExtent){if(null==a)a=this.center;null==b&&(b=this.getZoom());var f=this.getResolutionForZoom(b),f=this.calculateBounds(a,f);if(!this.restrictedExtent.containsBounds(f)){var g=this.restrictedExtent.getCenterLonLat();f.getWidth()>this.restrictedExtent.getWidth()?a=new OpenLayers.LonLat(g.lon,a.lat):f.left<this.restrictedExtent.left?a=a.add(this.restrictedExtent.left-f.left,0):f.right>this.restrictedExtent.right&&(a=a.add(this.restrictedExtent.right-f.right,
0));f.getHeight()>this.restrictedExtent.getHeight()?a=new OpenLayers.LonLat(a.lon,g.lat):f.bottom<this.restrictedExtent.bottom?a=a.add(0,this.restrictedExtent.bottom-f.bottom):f.top>this.restrictedExtent.top&&(a=a.add(0,this.restrictedExtent.top-f.top))}}e=e||this.isValidZoomLevel(b)&&b!=this.getZoom();f=this.isValidLonLat(a)&&!a.equals(this.center);if(e||f||d){d||this.events.triggerEvent("movestart");if(f)!e&&this.center&&this.centerLayerContainer(a),this.center=a.clone();a=e?this.getResolutionForZoom(b):
this.getResolution();if(e||null==this.layerContainerOrigin){this.layerContainerOrigin=this.getCachedCenter();this.layerContainerDiv.style.left="0px";this.layerContainerDiv.style.top="0px";var h=this.getMaxExtent({restricted:!0}),f=h.getCenterLonLat(),g=this.center.lon-f.lon,i=f.lat-this.center.lat,f=Math.round(h.getWidth()/a),h=Math.round(h.getHeight()/a),g=(this.size.w-f)/2-g/a,i=(this.size.h-h)/2-i/a;this.minPx=new OpenLayers.Pixel(g,i);this.maxPx=new OpenLayers.Pixel(g+f,i+h)}if(e)this.zoom=b,
this.resolution=a;a=this.getExtent();this.baseLayer.visibility&&(this.baseLayer.moveTo(a,e,c.dragging),c.dragging||this.baseLayer.events.triggerEvent("moveend",{zoomChanged:e}));a=this.baseLayer.getExtent();for(b=this.layers.length-1;0<=b;--b)if(f=this.layers[b],f!==this.baseLayer&&!f.isBaseLayer){g=f.calculateInRange();if(f.inRange!=g)(f.inRange=g)||f.display(!1),this.events.triggerEvent("changelayer",{layer:f,property:"visibility"});g&&f.visibility&&(f.moveTo(a,e,c.dragging),c.dragging||f.events.triggerEvent("moveend",
{zoomChanged:e}))}this.events.triggerEvent("move");d||this.events.triggerEvent("moveend");if(e){b=0;for(c=this.popups.length;b<c;b++)this.popups[b].updatePosition();this.events.triggerEvent("zoomend")}}},centerLayerContainer:function(a){var b=this.getViewPortPxFromLonLat(this.layerContainerOrigin),c=this.getViewPortPxFromLonLat(a);if(null!=b&&null!=c){var d=parseInt(this.layerContainerDiv.style.left),a=parseInt(this.layerContainerDiv.style.top),e=Math.round(b.x-c.x),b=Math.round(b.y-c.y);this.layerContainerDiv.style.left=
e+"px";this.layerContainerDiv.style.top=b+"px";d-=e;a-=b;this.minPx.x-=d;this.maxPx.x-=d;this.minPx.y-=a;this.maxPx.y-=a}},isValidZoomLevel:function(a){return null!=a&&0<=a&&a<this.getNumZoomLevels()},isValidLonLat:function(a){var b=!1;null!=a&&(b=this.getMaxExtent(),b=b.containsLonLat(a,{worldBounds:this.baseLayer.wrapDateLine&&b}));return b},getProjection:function(){var a=this.getProjectionObject();return a?a.getCode():null},getProjectionObject:function(){var a=null;if(null!=this.baseLayer)a=this.baseLayer.projection;
return a},getMaxResolution:function(){var a=null;if(null!=this.baseLayer)a=this.baseLayer.maxResolution;return a},getMaxExtent:function(a){var b=null;if(a&&a.restricted&&this.restrictedExtent)b=this.restrictedExtent;else if(null!=this.baseLayer)b=this.baseLayer.maxExtent;return b},getNumZoomLevels:function(){var a=null;if(null!=this.baseLayer)a=this.baseLayer.numZoomLevels;return a},getExtent:function(){var a=null;null!=this.baseLayer&&(a=this.baseLayer.getExtent());return a},getResolution:function(){var a=
null;null!=this.baseLayer?a=this.baseLayer.getResolution():!0===this.allOverlays&&0<this.layers.length&&(a=this.layers[0].getResolution());return a},getUnits:function(){var a=null;if(null!=this.baseLayer)a=this.baseLayer.units;return a},getScale:function(){var a=null;null!=this.baseLayer&&(a=this.getResolution(),a=OpenLayers.Util.getScaleFromResolution(a,this.baseLayer.units));return a},getZoomForExtent:function(a,b){var c=null;null!=this.baseLayer&&(c=this.baseLayer.getZoomForExtent(a,b));return c},
getResolutionForZoom:function(a){var b=null;this.baseLayer&&(b=this.baseLayer.getResolutionForZoom(a));return b},getZoomForResolution:function(a,b){var c=null;null!=this.baseLayer&&(c=this.baseLayer.getZoomForResolution(a,b));return c},zoomTo:function(a){this.isValidZoomLevel(a)&&this.setCenter(null,a)},zoomIn:function(){this.zoomTo(this.getZoom()+1)},zoomOut:function(){this.zoomTo(this.getZoom()-1)},zoomToExtent:function(a,b){a instanceof OpenLayers.Bounds||(a=new OpenLayers.Bounds(a));var c=a.getCenterLonLat();
if(this.baseLayer.wrapDateLine){c=this.getMaxExtent();for(a=a.clone();a.right<a.left;)a.right+=c.getWidth();c=a.getCenterLonLat().wrapDateLine(c)}this.setCenter(c,this.getZoomForExtent(a,b))},zoomToMaxExtent:function(a){this.zoomToExtent(this.getMaxExtent({restricted:a?a.restricted:!0}))},zoomToScale:function(a,b){var c=OpenLayers.Util.getResolutionFromScale(a,this.baseLayer.units),d=this.getSize(),e=d.w*c,c=d.h*c,d=this.getCachedCenter();this.zoomToExtent(new OpenLayers.Bounds(d.lon-e/2,d.lat-c/
2,d.lon+e/2,d.lat+c/2),b)},getLonLatFromViewPortPx:function(a){var b=null;null!=this.baseLayer&&(b=this.baseLayer.getLonLatFromViewPortPx(a));return b},getViewPortPxFromLonLat:function(a){var b=null;null!=this.baseLayer&&(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},getGeodesicPixelSize:function(a){var b=
a?this.getLonLatFromPixel(a):this.getCachedCenter()||new OpenLayers.LonLat(0,0),c=this.getResolution(),a=b.add(-c/2,0),d=b.add(c/2,0),e=b.add(0,-c/2),b=b.add(0,c/2),c=new OpenLayers.Projection("EPSG:4326"),f=this.getProjectionObject()||c;f.equals(c)||(a.transform(f,c),d.transform(f,c),e.transform(f,c),b.transform(f,c));return new OpenLayers.Size(OpenLayers.Util.distVincenty(a,d),OpenLayers.Util.distVincenty(e,b))},getViewPortPxFromLayerPx:function(a){var b=null;if(null!=a)var b=parseInt(this.layerContainerDiv.style.left),
c=parseInt(this.layerContainerDiv.style.top),b=a.add(b,c);return b},getLayerPxFromViewPortPx:function(a){var b=null;if(null!=a){var b=-parseInt(this.layerContainerDiv.style.left),c=-parseInt(this.layerContainerDiv.style.top),b=a.add(b,c);if(isNaN(b.x)||isNaN(b.y))b=null}return b},getLonLatFromLayerPx:function(a){a=this.getViewPortPxFromLayerPx(a);return this.getLonLatFromViewPortPx(a)},getLayerPxFromLonLat:function(a){return this.getLayerPxFromViewPortPx(this.getPixelFromLonLat(a))},CLASS_NAME:"OpenLayers.Map"});
OpenLayers.Map.TILE_WIDTH=256;OpenLayers.Map.TILE_HEIGHT=256;
OpenLayers.Projection=OpenLayers.Class({proj:null,projCode:null,titleRegEx:/\+title=[^\+]*/,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){var b=!1;a&&(a instanceof OpenLayers.Projection||(a=new OpenLayers.Projection(a)),window.Proj4js&&
this.proj.defData&&a.proj.defData?b=this.proj.defData.replace(this.titleRegEx,"")==a.proj.defData.replace(this.titleRegEx,""):a.getCode&&(b=this.getCode(),a=a.getCode(),b=b==a||!!OpenLayers.Projection.transforms[b]&&OpenLayers.Projection.transforms[b][a]===OpenLayers.Projection.nullTransform));return b},destroy:function(){delete this.proj;delete this.projCode},CLASS_NAME:"OpenLayers.Projection"});OpenLayers.Projection.transforms={};
OpenLayers.Projection.addTransform=function(a,b,c){OpenLayers.Projection.transforms[a]||(OpenLayers.Projection.transforms[a]={});OpenLayers.Projection.transforms[a][b]=c};
OpenLayers.Projection.transform=function(a,b,c){if(b&&c)if(b instanceof OpenLayers.Projection||(b=new OpenLayers.Projection(b)),c instanceof OpenLayers.Projection||(c=new OpenLayers.Projection(c)),b.proj&&c.proj)a=Proj4js.transform(b.proj,c.proj,a);else if(OpenLayers.Projection.transforms[b.getCode()]&&OpenLayers.Projection.transforms[b.getCode()][c.getCode()])OpenLayers.Projection.transforms[b.getCode()][c.getCode()](a);return a};OpenLayers.Projection.nullTransform=function(a){return a};
OpenLayers.Layer=OpenLayers.Class({id:null,name:null,div:null,opacity:1,alwaysInRange:null,RESOLUTION_PROPERTIES:"scales,resolutions,maxScale,minScale,maxResolution,minResolution,numZoomLevels,maxZoomLevel".split(","),events:null,map:null,isBaseLayer:!1,alpha:!1,displayInLayerSwitcher:!0,visibility:!0,attribution:null,inRange:!1,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:!1,wrapDateLine:!1,transitionEffect:null,metadata:{},initialize:function(a,b){this.addOptions(b);this.name=a;if(null==this.id&&(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.eventListeners instanceof Object))this.events.on(this.eventListeners);
if(this.wrapDateLine)this.displayOutsideMaxExtent=!0},destroy:function(a){null==a&&(a=!0);null!=this.map&&this.map.removeLayer(this,a);this.options=this.div=this.name=this.map=this.projection=null;this.events&&(this.eventListeners&&this.events.un(this.eventListeners),this.events.destroy());this.events=this.eventListeners=null},clone:function(a){null==a&&(a=new OpenLayers.Layer(this.name,this.getOptions()));OpenLayers.Util.applyDefaults(a,this);a.map=null;return a},getOptions:function(){var a={},b;
for(b in this.options)a[b]=this[b];return a},setName:function(a){if(a!=this.name)this.name=a,null!=this.map&&this.map.events.triggerEvent("changelayer",{layer:this,property:"name"})},addOptions:function(a,b){if(null==this.options)this.options={};if(a){if(a.maxExtent&&!(a.maxExtent instanceof OpenLayers.Bounds))a.maxExtent=new OpenLayers.Bounds(a.maxExtent);if(a.minExtent&&!(a.minExtent instanceof OpenLayers.Bounds))a.minExtent=new OpenLayers.Bounds(a.minExtent)}OpenLayers.Util.extend(this.options,
a);OpenLayers.Util.extend(this,a);if("string"==typeof this.projection)this.projection=new OpenLayers.Projection(this.projection);if(this.projection&&this.projection.getUnits())this.units=this.projection.getUnits();if(this.map){var c=this.map.getResolution(),d=this.RESOLUTION_PROPERTIES.concat(["projection","units","minExtent","maxExtent"]),e;for(e in a)if(a.hasOwnProperty(e)&&0<=OpenLayers.Util.indexOf(d,e)){this.initResolutions();b&&this.map.baseLayer===this&&(this.map.setCenter(this.map.getCenter(),
this.map.getZoomForResolution(c),!1,!0),this.map.events.triggerEvent("changebaselayer",{layer:this}));break}}},onMapResize:function(){},redraw:function(){var a=!1;if(this.map){this.inRange=this.calculateInRange();var b=this.getExtent();b&&this.inRange&&this.visibility&&(this.moveTo(b,!0,!1),this.events.triggerEvent("moveend",{zoomChanged:!0}),a=!0)}return a},moveTo:function(){var a=this.visibility;this.isBaseLayer||(a=a&&this.inRange);this.display(a)},moveByPx:function(){},setMap:function(a){if(null==
this.map){this.map=a;this.maxExtent=this.maxExtent||this.map.maxExtent;this.minExtent=this.minExtent||this.map.minExtent;this.projection=this.projection||this.map.projection;if("string"==typeof this.projection)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(),null!=this.map&&this.map.events.triggerEvent("changelayer",
{layer:this,property:"visibility"}),this.events.triggerEvent("visibilitychanged")},display:function(a){if(a!=("none"!=this.div.style.display))this.div.style.display=a&&this.calculateInRange()?"block":"none"},calculateInRange:function(){var a=!1;this.alwaysInRange?a=!0: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,null!=this.map&&this.map.events.triggerEvent("changebaselayer",{layer:this})},
initResolutions:function(){var a,b,c,d={},e=!0;for(a=0,b=this.RESOLUTION_PROPERTIES.length;a<b;a++)c=this.RESOLUTION_PROPERTIES[a],d[c]=this.options[c],e&&this.options[c]&&(e=!1);if(null==this.alwaysInRange)this.alwaysInRange=e;if(null==d.resolutions)d.resolutions=this.resolutionsFromScales(d.scales);if(null==d.resolutions)d.resolutions=this.calculateResolutions(d);if(null==d.resolutions){for(a=0,b=this.RESOLUTION_PROPERTIES.length;a<b;a++)c=this.RESOLUTION_PROPERTIES[a],d[c]=null!=this.options[c]?
this.options[c]:this.map[c];if(null==d.resolutions)d.resolutions=this.resolutionsFromScales(d.scales);if(null==d.resolutions)d.resolutions=this.calculateResolutions(d)}var f;if(this.options.maxResolution&&"auto"!==this.options.maxResolution)f=this.options.maxResolution;this.options.minScale&&(f=OpenLayers.Util.getResolutionFromScale(this.options.minScale,this.units));var g;if(this.options.minResolution&&"auto"!==this.options.minResolution)g=this.options.minResolution;this.options.maxScale&&(g=OpenLayers.Util.getResolutionFromScale(this.options.maxScale,
this.units));d.resolutions&&(d.resolutions.sort(function(a,b){return b-a}),f||(f=d.resolutions[0]),g||(g=d.resolutions[d.resolutions.length-1]));if(this.resolutions=d.resolutions){b=this.resolutions.length;this.scales=Array(b);for(a=0;a<b;a++)this.scales[a]=OpenLayers.Util.getScaleFromResolution(this.resolutions[a],this.units);this.numZoomLevels=b}if(this.minResolution=g)this.maxScale=OpenLayers.Util.getScaleFromResolution(g,this.units);if(this.maxResolution=f)this.minScale=OpenLayers.Util.getScaleFromResolution(f,
this.units)},resolutionsFromScales:function(a){if(null!=a){var b,c,d;d=a.length;b=Array(d);for(c=0;c<d;c++)b[c]=OpenLayers.Util.getResolutionFromScale(a[c],this.units);return b}},calculateResolutions:function(a){var b,c,d=a.maxResolution;null!=a.minScale?d=OpenLayers.Util.getResolutionFromScale(a.minScale,this.units):"auto"==d&&null!=this.maxExtent&&(b=this.map.getSize(),c=this.maxExtent.getWidth()/b.w,b=this.maxExtent.getHeight()/b.h,d=Math.max(c,b));c=a.minResolution;null!=a.maxScale?c=OpenLayers.Util.getResolutionFromScale(a.maxScale,
this.units):"auto"==a.minResolution&&null!=this.minExtent&&(b=this.map.getSize(),c=this.minExtent.getWidth()/b.w,b=this.minExtent.getHeight()/b.h,c=Math.max(c,b));b=a.maxZoomLevel;a=a.numZoomLevels;"number"===typeof c&&"number"===typeof d&&void 0===a?a=Math.floor(Math.log(d/c)/Math.log(2))+1:void 0===a&&null!=b&&(a=b+1);if(!("number"!==typeof a||0>=a||"number"!==typeof d&&"number"!==typeof c)){b=Array(a);var e=2;"number"==typeof c&&"number"==typeof d&&(e=Math.pow(d/c,1/(a-1)));var f;if("number"===
typeof d)for(f=0;f<a;f++)b[f]=d/Math.pow(e,f);else for(f=0;f<a;f++)b[a-1-f]=c*Math.pow(e,f);return b}},getResolution:function(){return this.getResolutionForZoom(this.map.getZoom())},getExtent:function(){return this.map.calculateBounds()},getZoomForExtent:function(a,b){var c=this.map.getSize();return this.getZoomForResolution(Math.max(a.getWidth()/c.w,a.getHeight()/c.h),b)},getDataExtent:function(){},getResolutionForZoom:function(a){a=Math.max(0,Math.min(a,this.resolutions.length-1));if(this.map.fractionalZoom)var b=
Math.floor(a),c=Math.ceil(a),a=this.resolutions[b]-(a-b)*(this.resolutions[b]-this.resolutions[c]);else a=this.resolutions[Math.round(a)];return a},getZoomForResolution:function(a,b){var c,d;if(this.map.fractionalZoom){var e=0,f=this.resolutions[e],g=this.resolutions[this.resolutions.length-1],h;for(c=0,d=this.resolutions.length;c<d;++c)if(h=this.resolutions[c],h>=a&&(f=h,e=c),h<=a){g=h;break}c=f-g;c=0<c?e+(f-a)/c:e}else{f=Number.POSITIVE_INFINITY;for(c=0,d=this.resolutions.length;c<d;c++)if(b){e=
Math.abs(this.resolutions[c]-a);if(e>f)break;f=e}else if(this.resolutions[c]<a)break;c=Math.max(0,c-1)}return c},getLonLatFromViewPortPx:function(a){var b=null,c=this.map;if(null!=a&&c.minPx){var b=c.getResolution(),d=c.getMaxExtent({restricted:!0}),b=new OpenLayers.LonLat((a.x-c.minPx.x)*b+d.left,(c.minPx.y-a.y)*b+d.top);this.wrapDateLine&&(b=b.wrapDateLine(this.maxExtent))}return b},getViewPortPxFromLonLat:function(a,b){var c=null;null!=a&&(b=b||this.map.getResolution(),c=this.map.calculateBounds(null,
b),c=new OpenLayers.Pixel(1/b*(a.lon-c.left),1/b*(c.top-a.lat)));return c},setOpacity:function(a){if(a!=this.opacity){this.opacity=a;for(var b=0,c=this.div.childNodes.length;b<c;++b)OpenLayers.Util.modifyDOMElement(this.div.childNodes[b].firstChild,null,null,null,null,null,null,a);null!=this.map&&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);this.wrapDateLine&&(b={rightTolerance:this.getResolution(),leftTolerance:this.getResolution()},a=a.wrapDateLine(this.maxExtent,b));return a},CLASS_NAME:"OpenLayers.Layer"});
OpenLayers.Layer.HTTPRequest=OpenLayers.Class(OpenLayers.Layer,{URL_HASH_FACTOR:(Math.sqrt(5)-1)/2,url:null,params:null,reproject:!1,initialize:function(a,b,c,d){OpenLayers.Layer.prototype.initialize.apply(this,[a,d]);this.url=b;this.params=OpenLayers.Util.extend({},c)},destroy:function(){this.params=this.url=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(a){null==a&&(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();null!=this.map&&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 c=1,d=0,e=a.length;d<e;d++)c*=a.charCodeAt(d)*this.URL_HASH_FACTOR,c-=Math.floor(c);return b[Math.floor(c*b.length)]},
getFullRequestString:function(a,b){var c=b||this.url,d=OpenLayers.Util.extend({},this.params),d=OpenLayers.Util.extend(d,a),e=OpenLayers.Util.getParameterString(d);OpenLayers.Util.isArray(c)&&(c=this.selectUrl(e,c));var e=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(c)),f;for(f in d)f.toUpperCase()in e&&delete d[f];e=OpenLayers.Util.getParameterString(d);return OpenLayers.Util.urlAppend(c,e)},CLASS_NAME:"OpenLayers.Layer.HTTPRequest"});
OpenLayers.Tile=OpenLayers.Class({events:null,id:null,layer:null,url:null,bounds:null,size:null,position:null,isLoading:!1,initialize:function(a,b,c,d,e,f){this.layer=a;this.position=b.clone();this.setBounds(c);this.url=d;if(e)this.size=e.clone();this.id=OpenLayers.Util.createUniqueID("Tile_");this.events=new OpenLayers.Events(this);OpenLayers.Util.extend(this,f)},unload:function(){if(this.isLoading)this.isLoading=!1,this.events.triggerEvent("unload")},destroy:function(){this.position=this.size=this.bounds=
this.layer=null;this.events.destroy();this.events=null},draw:function(){this.clear();return this.shouldDraw()},shouldDraw:function(){var a=!1,b=this.layer.maxExtent;if(b){var c=this.layer.map,c=c.baseLayer.wrapDateLine&&c.getMaxExtent();this.bounds.intersectsBounds(b,{inclusive:!1,worldBounds:c})&&(a=!0)}return a||this.layer.displayOutsideMaxExtent},setBounds:function(a){a=a.clone();if(this.layer.map.baseLayer.wrapDateLine)var b=this.layer.map.getMaxExtent(),c=this.layer.map.getResolution(),a=a.wrapDateLine(b,
{leftTolerance:c,rightTolerance:c});this.bounds=a},moveTo:function(a,b,c){null==c&&(c=!0);this.setBounds(a);this.position=b.clone();c&&this.draw()},clear:function(){},CLASS_NAME:"OpenLayers.Tile"});
OpenLayers.Tile.Image=OpenLayers.Class(OpenLayers.Tile,{url:null,imgDiv:null,frame:null,imageReloadAttempts:null,layerAlphaHack:null,asyncRequestId:null,blankImageUrl:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAQAIBRAA7",maxGetUrlLength:null,initialize:function(a,b,c,d,e,f){OpenLayers.Tile.prototype.initialize.apply(this,arguments);this.url=d;this.frame=document.createElement("div");this.frame.style.position="absolute";this.frame.style.overflow="hidden";this.layerAlphaHack=
this.layer.alpha&&OpenLayers.Util.alphaHack();null!=this.maxGetUrlLength&&OpenLayers.Util.extend(this,OpenLayers.Tile.Image.IFrame)},destroy:function(){if(null!=this.frame)this.clear(),this.frame=this.imgDiv=null;this.asyncRequestId=null;OpenLayers.Tile.prototype.destroy.apply(this,arguments)},draw:function(){var a=OpenLayers.Tile.prototype.draw.apply(this,arguments);if(a){if(this.layer!=this.layer.map.baseLayer&&this.layer.reproject)this.bounds=this.getBoundsFromBaseLayer(this.position);this.isLoading?
this.events.triggerEvent("reload"):(this.isLoading=!0,this.events.triggerEvent("loadstart"));this.positionTile();this.renderTile()}else this.unload();return a},renderTile:function(){this.layer.div.appendChild(this.frame);if(this.layer.async){var a=this.asyncRequestId=(this.asyncRequestId||0)+1;this.layer.getURLasync(this.bounds,this,"url",function(){a==this.asyncRequestId&&this.initImage()})}else this.url=this.layer.getURL(this.bounds),this.initImage()},positionTile:function(){var a=this.frame.style;
a.left=this.position.x+"%";a.top=this.position.y+"%";a.width=this.size.w+"%";a.height=this.size.h+"%"},clear:function(){var a=this.imgDiv;if(a){OpenLayers.Event.stopObservingElement(a);this.frame.parentNode===this.layer.div&&this.layer.div.removeChild(this.frame);this.setImgSrc();if(!0===this.layerAlphaHack)a.style.filter="";OpenLayers.Element.removeClass(a,"olImageLoadError")}},createImage:function(){var a=document.createElement("img");this.imgDiv=a;a.className="olTileImage";a.galleryImg="no";var b=
a.style,c=this.layer.gutter;if(c){var d=this.layer.tileSize,e=100*(c/d.w),c=100*(c/d.h);b.left=-e+"%";b.top=-c+"%";b.width=2*e+100+"%";b.height=2*c+100+"%";b.position="absolute"}else b.width="100%",b.height="100%";b.display="none";1>this.layer.opacity&&OpenLayers.Util.modifyDOMElement(a,null,null,null,null,null,null,this.layer.opacity);if(this.layerAlphaHack)b.paddingTop=b.height,b.height="0";this.frame.appendChild(a);return a},initImage:function(){var a=this.imgDiv||this.createImage();if(this.url&&
a.getAttribute("src")==this.url)this.onImageLoad();else{var b=OpenLayers.Function.bind(function(){OpenLayers.Event.stopObservingElement(a);OpenLayers.Event.observe(a,"load",OpenLayers.Function.bind(this.onImageLoad,this));OpenLayers.Event.observe(a,"error",OpenLayers.Function.bind(this.onImageError,this));this.imageReloadAttempts=0;this.setImgSrc(this.url)},this);a.getAttribute("src")==this.blankImageUrl?b():(OpenLayers.Event.observe(a,"load",b),OpenLayers.Event.observe(a,"error",b),a.src=this.blankImageUrl)}},
setImgSrc:function(a){var b=this.imgDiv;b.style.display="none";if(a)b.src=a},getTile:function(){return this.frame},createBackBuffer:function(){if(this.imgDiv&&!this.isLoading){var a=this.frame.cloneNode(!1);a.appendChild(this.imgDiv);this.imgDiv=null;return a}},onImageLoad:function(){var a=this.imgDiv;OpenLayers.Event.stopObservingElement(a);a.style.display="";this.isLoading=!1;this.events.triggerEvent("loadend");if(7>parseFloat(navigator.appVersion.split("MSIE")[1])&&this.layer&&this.layer.div){var b=
document.createElement("span");b.style.display="none";var c=this.layer.div;c.appendChild(b);window.setTimeout(function(){b.parentNode===c&&b.parentNode.removeChild(b)},0)}if(!0===this.layerAlphaHack)a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+a.src+"', sizingMethod='scale')"},onImageError:function(){var a=this.imgDiv;null!=a.src&&(this.imageReloadAttempts++,this.imageReloadAttempts<=OpenLayers.IMAGE_RELOAD_ATTEMPTS?this.setImgSrc(this.layer.getURL(this.bounds)):(OpenLayers.Element.addClass(a,
"olImageLoadError"),this.onImageLoad()))},CLASS_NAME:"OpenLayers.Tile.Image"});
OpenLayers.Layer.Grid=OpenLayers.Class(OpenLayers.Layer.HTTPRequest,{tileSize:null,tileOriginCorner:"bl",tileOrigin:null,tileOptions:null,grid:null,singleTile:!1,ratio:1.5,buffer:0,numLoadingTiles:0,tileLoadingDelay:100,serverResolutions:null,timerId:null,backBuffer:null,gridResolution:null,backBufferResolution:null,backBufferLonLat:null,initialize:function(a,b,c,d){OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,arguments);this.events.addEventType("tileloaded");this.grid=[];this._moveGriddedTiles=
OpenLayers.Function.bind(this.moveGriddedTiles,this)},removeMap:function(){if(null!=this.timerId)window.clearTimeout(this.timerId),this.timerId=null},destroy:function(){this.clearGrid();this.tileSize=this.grid=null;OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this,arguments)},clearGrid:function(){if(this.grid){for(var a=0,b=this.grid.length;a<b;a++)for(var c=this.grid[a],d=0,e=c.length;d<e;d++){var f=c[d];this.removeTileMonitoringHooks(f);f.destroy()}this.grid=[];this.gridResolution=null}},
clone:function(a){null==a&&(a=new OpenLayers.Layer.Grid(this.name,this.url,this.params,this.getOptions()));a=OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this,[a]);if(null!=this.tileSize)a.tileSize=this.tileSize.clone();a.grid=[];a.gridResolution=null;return a},moveTo:function(a,b,c){OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this,arguments);a=a||this.map.getExtent();if(null!=a){var d=!this.grid.length||b,e=this.getTilesBounds(),f=this.map.getResolution(),g=this.getServerResolution(f);
if(this.singleTile){if(d||!c&&!e.containsBounds(a))b&&"resize"!==this.transitionEffect&&this.removeBackBuffer(),(!b||"resize"===this.transitionEffect)&&this.applyBackBuffer(g),this.initSingleTile(a)}else d=d||!e.containsBounds(a,!0),f!==g?(a=this.map.calculateBounds(null,g),d&&this.transformDiv(g/f)):(this.div.style.width="100%",this.div.style.height="100%",this.div.style.left="0%",this.div.style.top="0%"),d?(b&&"resize"===this.transitionEffect&&this.applyBackBuffer(g),this.initGriddedTiles(a)):this.scheduleMoveGriddedTiles()}},
getServerResolution:function(a){a=a||this.map.getResolution();if(this.serverResolutions&&-1===OpenLayers.Util.indexOf(this.serverResolutions,a)){var b,c;for(b=this.serverResolutions.length-1;0<=b;b--)if(c=this.serverResolutions[b],c>a){a=c;break}if(-1===b)throw"no appropriate resolution in serverResolutions";}return a},getServerZoom:function(){return this.map.getZoomForResolution(this.getServerResolution())},transformDiv:function(a){this.div.style.width=100*a+"%";this.div.style.height=100*a+"%";var b=
this.map.getSize(),c=parseInt(this.map.layerContainerDiv.style.left,10),d=(parseInt(this.map.layerContainerDiv.style.top,10)-b.h/2)*(a-1);this.div.style.left=(c-b.w/2)*(a-1)+"%";this.div.style.top=d+"%"},getResolutionScale:function(){return parseInt(this.div.style.width,10)/100},applyBackBuffer:function(a){var b=this.backBuffer;if(!b){b=this.createBackBuffer();if(!b)return;this.div.insertBefore(b,this.div.firstChild);this.backBuffer=b;var c=this.grid[0][0].bounds;this.backBufferLonLat={lon:c.left,
lat:c.top};this.backBufferResolution=this.gridResolution}var c=b.style,d=this.backBufferResolution/a;c.width=100*d+"%";c.height=100*d+"%";a=this.getViewPortPxFromLonLat(this.backBufferLonLat,a);c=parseInt(this.map.layerContainerDiv.style.left,10);d=parseInt(this.map.layerContainerDiv.style.top,10);b.style.left=a.x-c+"%";b.style.top=a.y-d+"%"},createBackBuffer:function(){var a;if(0<this.grid.length){a=document.createElement("div");a.id=this.div.id+"_bb";a.className="olBackBuffer";a.style.position=
"absolute";a.style.width="100%";a.style.height="100%";for(var b=0,c=this.grid.length;b<c;b++)for(var d=0,e=this.grid[b].length;d<e;d++){var f=this.grid[b][d].createBackBuffer();if(f)f.style.top=b*this.tileSize.h+"%",f.style.left=d*this.tileSize.w+"%",a.appendChild(f)}}return a},removeBackBuffer:function(){if(this.backBuffer&&this.backBuffer.parentNode)this.div.removeChild(this.backBuffer),this.backBufferResolution=this.backBuffer=null},moveByPx:function(){this.singleTile||this.scheduleMoveGriddedTiles()},
scheduleMoveGriddedTiles:function(){null!=this.timerId&&window.clearTimeout(this.timerId);this.timerId=window.setTimeout(this._moveGriddedTiles,this.tileLoadingDelay)},setTileSize:function(a){if(this.singleTile)a=this.map.getSize(),a.h=parseInt(a.h*this.ratio),a.w=parseInt(a.w*this.ratio);OpenLayers.Layer.HTTPRequest.prototype.setTileSize.apply(this,[a])},getTilesBounds:function(){var a=null;if(this.grid.length)var a=this.grid[this.grid.length-1][0],b=this.grid[0][this.grid[0].length-1],a=new OpenLayers.Bounds(a.bounds.left,
a.bounds.bottom,b.bounds.right,b.bounds.top);return a},initSingleTile:function(a){var b=a.getCenterLonLat(),c=a.getWidth()*this.ratio,a=a.getHeight()*this.ratio,b=new OpenLayers.Bounds(b.lon-c/2,b.lat-a/2,b.lon+c/2,b.lat+a/2),c=this.map.getLayerPxFromLonLat(new OpenLayers.LonLat(b.left,b.top));this.grid.length||(this.grid[0]=[]);(a=this.grid[0][0])?a.moveTo(b,c):(a=this.addTile(b,c),this.addTileMonitoringHooks(a),a.draw(),this.grid[0][0]=a);this.removeExcessTiles(1,1);this.gridResolution=this.getServerResolution()},
calculateGridLayout:function(a,b,c){var a=a.clone(),d=this.map;d.wrapDateLine&&(a=a.wrapDateLine(d.getMaxExtent()));var d=c*this.tileSize.w,c=c*this.tileSize.h,e=a.left-b.lon,f=Math.floor(e/d)-this.buffer,e=-(e/d-f)*this.tileSize.w,f=b.lon+f*d,a=a.top-(b.lat+c),g=Math.ceil(a/c)+this.buffer;return{tilelon:d,tilelat:c,tileoffsetlon:f,tileoffsetlat:b.lat+g*c,tileoffsetx:e,tileoffsety:-(g-a/c)*this.tileSize.h}},getTileOrigin:function(){var a=this.tileOrigin;if(!a)var a=this.getMaxExtent(),b={tl:["left",
"top"],tr:["right","top"],bl:["left","bottom"],br:["right","bottom"]}[this.tileOriginCorner],a=new OpenLayers.LonLat(a[b[0]],a[b[1]]);return a},initGriddedTiles:function(a){var b=this.map.getSize(),c=Math.ceil(b.h/this.tileSize.h)+Math.max(1,2*this.buffer),b=Math.ceil(b.w/this.tileSize.w)+Math.max(1,2*this.buffer),d=this.getTileOrigin(),e=this.getServerResolution(),f=this.calculateGridLayout(a,d,e),d=Math.round(f.tileoffsetx),e=Math.round(f.tileoffsety),g=f.tileoffsetlon,h=f.tileoffsetlat,i=f.tilelon,
f=f.tilelat;this.origin=new OpenLayers.Pixel(d,e);var k=d,j=g,n=0,m=parseInt(this.map.layerContainerDiv.style.left),l=parseInt(this.map.layerContainerDiv.style.top);do{var o=this.grid[n++];o||(o=[],this.grid.push(o));var g=j,d=k,r=0;do{var q=new OpenLayers.Bounds(g,h,g+i,h+f),p=d,p=p-m,s=e,s=s-l,p=new OpenLayers.Pixel(p,s);(s=o[r++])?s.moveTo(q,p,!1):(s=this.addTile(q,p),this.addTileMonitoringHooks(s),o.push(s));g+=i;d+=this.tileSize.w}while(g<=a.right+i*this.buffer||r<b);h-=f;e+=this.tileSize.h}while(h>=
a.bottom-f*this.buffer||n<c);this.removeExcessTiles(n,r);this.gridResolution=this.getServerResolution();this.spiralTileLoad()},getMaxExtent:function(){return this.maxExtent},spiralTileLoad:function(){for(var a=[],b=["right","down","left","up"],c=0,d=-1,e=OpenLayers.Util.indexOf(b,"right"),f=0;f<b.length;){var g=c,h=d;switch(b[e]){case "right":h++;break;case "down":g++;break;case "left":h--;break;case "up":g--}var i=null;g<this.grid.length&&0<=g&&h<this.grid[0].length&&0<=h&&(i=this.grid[g][h]);null!=
i&&!i.queued?(a.unshift(i),i.queued=!0,f=0,c=g,d=h):(e=(e+1)%4,f++)}b=0;for(c=a.length;b<c;b++)i=a[b],i.draw(),i.queued=!1},addTile:function(a,b){return new OpenLayers.Tile.Image(this,b,a,null,this.tileSize,this.tileOptions)},addTileMonitoringHooks:function(a){a.onLoadStart=function(){0==this.numLoadingTiles&&this.events.triggerEvent("loadstart");this.numLoadingTiles++};a.events.register("loadstart",this,a.onLoadStart);a.onLoadEnd=function(){this.numLoadingTiles--;this.events.triggerEvent("tileloaded");
0==this.numLoadingTiles&&(this.events.triggerEvent("loadend"),this.removeBackBuffer())};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(){var a=!0,b=this.buffer||1,c=this.getResolutionScale(),d=this.grid[0][0].position.clone();d.x*=c;d.y*=c;var d=d.add(parseInt(this.div.style.left,10),parseInt(this.div.style.top,
10)),e=parseInt(this.map.layerContainerDiv.style.left),f=parseInt(this.map.layerContainerDiv.style.top),d=d.add(e,f),e=this.tileSize.clone();e.w*=c;e.h*=c;d.x>-e.w*(b-1)?this.shiftColumn(!0):d.x<-e.w*b?this.shiftColumn(!1):d.y>-e.h*(b-1)?this.shiftRow(!0):d.y<-e.h*b?this.shiftRow(!1):a=!1;if(a)this.timerId=window.setTimeout(this._moveGriddedTiles,0)},shiftRow:function(a){for(var b=this.grid,c=b[a?0:this.grid.length-1],d=this.getServerResolution(),e=a?-this.tileSize.h:this.tileSize.h,d=d*-e,f=a?b.pop():
b.shift(),g=0,h=c.length;g<h;g++){var i=c[g],k=i.bounds.clone(),i=i.position.clone();k.bottom+=d;k.top+=d;i.y+=e;f[g].moveTo(k,i)}a?b.unshift(f):b.push(f)},shiftColumn:function(a){for(var b=a?-this.tileSize.w:this.tileSize.w,c=this.getServerResolution()*b,d=0,e=this.grid.length;d<e;d++){var f=this.grid[d],g=f[a?0:f.length-1],h=g.bounds.clone(),g=g.position.clone();h.left+=c;h.right+=c;g.x+=b;var i=a?this.grid[d].pop():this.grid[d].shift();i.moveTo(h,g);a?f.unshift(i):f.push(i)}},removeExcessTiles:function(a,
b){for(;this.grid.length>a;)for(var c=this.grid.pop(),d=0,e=c.length;d<e;d++){var f=c[d];this.removeTileMonitoringHooks(f);f.destroy()}for(;this.grid[0].length>b;){d=0;for(e=this.grid.length;d<e;d++)c=this.grid[d],f=c.pop(),this.removeTileMonitoringHooks(f),f.destroy()}},onMapResize:function(){this.singleTile&&(this.clearGrid(),this.setTileSize())},getTileBounds:function(a){var b=this.maxExtent,c=this.getResolution(),d=c*this.tileSize.w,c=c*this.tileSize.h,e=this.getLonLatFromViewPortPx(a),a=b.left+
d*Math.floor((e.lon-b.left)/d),b=b.bottom+c*Math.floor((e.lat-b.bottom)/c);return new OpenLayers.Bounds(a,b,a+d,b+c)},CLASS_NAME:"OpenLayers.Layer.Grid"});
OpenLayers.Layer.SphericalMercator={getExtent:function(){var a=null;return a=this.sphericalMercator?this.map.calculateBounds():OpenLayers.Layer.FixedZoomLevels.prototype.getExtent.apply(this)},getLonLatFromViewPortPx:function(a){return OpenLayers.Layer.prototype.getLonLatFromViewPortPx.apply(this,arguments)},getViewPortPxFromLonLat:function(a){return OpenLayers.Layer.prototype.getViewPortPxFromLonLat.apply(this,arguments)},initMercatorParameters:function(){this.RESOLUTIONS=[];for(var a=0;a<=this.MAX_ZOOM_LEVEL;++a)this.RESOLUTIONS[a]=
156543.03390625/Math.pow(2,a);this.units="m";this.projection=this.projection||"EPSG:900913"},forwardMercator:function(a,b){var c=2.003750834E7*a/180,d=Math.log(Math.tan((90+b)*Math.PI/360))/(Math.PI/180);return new OpenLayers.LonLat(c,2.003750834E7*d/180)},inverseMercator:function(a,b){var c=180*(a/2.003750834E7),d;d=180/Math.PI*(2*Math.atan(Math.exp(180*(b/2.003750834E7)*Math.PI/180))-Math.PI/2);return new OpenLayers.LonLat(c,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}};(function(){var a=["EPSG:900913","EPSG:3857","EPSG:102113","EPSG:102100"],b=OpenLayers.Projection.addTransform,c=OpenLayers.Layer.SphericalMercator,d=OpenLayers.Projection.nullTransform,e,f,g,h,i;for(e=0,f=a.length;e<f;++e){g=a[e];b("EPSG:4326",g,c.projectForward);b(g,"EPSG:4326",c.projectInverse);for(i=e+1;i<f;++i)h=a[i],b(g,h,d),b(h,g,d)}})();
OpenLayers.Layer.EventPane=OpenLayers.Class(OpenLayers.Layer,{smoothDragPan:!0,isBaseLayer:!0,isFixed:!0,pane:null,mapObject:null,initialize:function(a,b){OpenLayers.Layer.prototype.initialize.apply(this,arguments);if(null==this.pane)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(a){OpenLayers.Layer.prototype.setMap.apply(this,arguments);this.pane.style.zIndex=
parseInt(this.div.style.zIndex)+1;this.pane.style.display=this.div.style.display;this.pane.style.width="100%";this.pane.style.height="100%";if("msie"==OpenLayers.BROWSER_NAME)this.pane.style.background="url("+OpenLayers.Util.getImagesLocation()+"blank.gif)";this.isFixed?this.map.eventsDiv.appendChild(this.pane):this.map.layerContainerDiv.appendChild(this.pane);this.loadMapObject();null==this.mapObject&&this.loadWarningMessage()},removeMap:function(a){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=Math.min(a.w,300),c=Math.min(a.h,200),b=new OpenLayers.Size(b,c),a=(new OpenLayers.Pixel(a.w/2,a.h/2)).add(-b.w/2,-b.h/2),a=OpenLayers.Util.createDiv(this.name+"_warning",a,b,null,null,null,"auto");a.style.padding="7px";a.style.backgroundColor="yellow";a.innerHTML=this.getWarningHTML();this.div.appendChild(a)},getWarningHTML:function(){return""},
display:function(a){OpenLayers.Layer.prototype.display.apply(this,arguments);this.pane.style.display=this.div.style.display},setZIndex:function(a){OpenLayers.Layer.prototype.setZIndex.apply(this,arguments);this.pane.style.zIndex=parseInt(this.div.style.zIndex)+1},moveByPx:function(a,b){OpenLayers.Layer.prototype.moveByPx.apply(this,arguments);this.dragPanMapObject?this.dragPanMapObject(a,-b):this.moveTo(this.map.getCachedCenter())},moveTo:function(a,b,c){OpenLayers.Layer.prototype.moveTo.apply(this,
arguments);if(null!=this.mapObject){var d=this.map.getCenter(),e=this.map.getZoom();if(null!=d){var f=this.getOLLonLatFromMapObjectLonLat(this.getMapObjectCenter()),g=this.getOLZoomFromMapObjectZoom(this.getMapObjectZoom());if(!d.equals(f)||e!=g)!b&&f&&this.dragPanMapObject&&this.smoothDragPan?(e=this.map.getViewPortPxFromLonLat(f),d=this.map.getViewPortPxFromLonLat(d),this.dragPanMapObject(d.x-e.x,e.y-d.y)):(d=this.getMapObjectLonLatFromOLLonLat(d),e=this.getMapObjectZoomFromOLZoom(e),this.setMapObjectCenter(d,
e,c))}}},getLonLatFromViewPortPx:function(a){var b=null;null!=this.mapObject&&null!=this.getMapObjectCenter()&&(b=this.getOLLonLatFromMapObjectLonLat(this.getMapObjectLonLatFromMapObjectPixel(this.getMapObjectPixelFromOLPixel(a))));return b},getViewPortPxFromLonLat:function(a){var b=null;null!=this.mapObject&&null!=this.getMapObjectCenter()&&(b=this.getOLPixelFromMapObjectPixel(this.getMapObjectPixelFromMapObjectLonLat(this.getMapObjectLonLatFromOLLonLat(a))));return b},getOLLonLatFromMapObjectLonLat:function(a){var b=
null;null!=a&&(b=this.getLongitudeFromMapObjectLonLat(a),a=this.getLatitudeFromMapObjectLonLat(a),b=new OpenLayers.LonLat(b,a));return b},getMapObjectLonLatFromOLLonLat:function(a){var b=null;null!=a&&(b=this.getMapObjectLonLatFromLonLat(a.lon,a.lat));return b},getOLPixelFromMapObjectPixel:function(a){var b=null;null!=a&&(b=this.getXFromMapObjectPixel(a),a=this.getYFromMapObjectPixel(a),b=new OpenLayers.Pixel(b,a));return b},getMapObjectPixelFromOLPixel:function(a){var b=null;null!=a&&(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=["minZoomLevel","maxZoomLevel","numZoomLevels"],b=0,c=a.length;b<c;b++){var d=a[b];this[d]=null!=this.options[d]?this.options[d]:this.map[d]}if(null==this.minZoomLevel||this.minZoomLevel<this.MIN_ZOOM_LEVEL)this.minZoomLevel=this.MIN_ZOOM_LEVEL;a=this.MAX_ZOOM_LEVEL-this.minZoomLevel+1;b=null==this.options.numZoomLevels&&null!=this.options.maxZoomLevel||null==this.numZoomLevels&&null!=this.maxZoomLevel?
this.maxZoomLevel-this.minZoomLevel+1:this.numZoomLevels;this.numZoomLevels=null!=b?Math.min(b,a):a;this.maxZoomLevel=this.minZoomLevel+this.numZoomLevels-1;if(null!=this.RESOLUTIONS){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(null!=this.resolutions)return OpenLayers.Layer.prototype.getResolution.apply(this,
arguments);var a=null,b=this.map.getSize(),c=this.getExtent();null!=b&&null!=c&&(a=Math.max(c.getWidth()/b.w,c.getHeight()/b.h));return a},getExtent:function(){var a=null,b=this.map.getSize(),c=this.getLonLatFromViewPortPx(new OpenLayers.Pixel(0,0)),b=this.getLonLatFromViewPortPx(new OpenLayers.Pixel(b.w,b.h));null!=c&&null!=b&&(a=new OpenLayers.Bounds(c.lon,b.lat,b.lon,c.lat));return a},getZoomForResolution:function(a){return null!=this.resolutions?OpenLayers.Layer.prototype.getZoomForResolution.apply(this,
arguments):this.getZoomForExtent(OpenLayers.Layer.prototype.getExtent.apply(this,[]))},getOLZoomFromMapObjectZoom:function(a){var b=null;null!=a&&(b=a-this.minZoomLevel,this.map.baseLayer!==this&&(b=this.map.baseLayer.getZoomForResolution(this.getResolutionForZoom(b))));return b},getMapObjectZoomFromOLZoom:function(a){var b=null;null!=a&&(b=a+this.minZoomLevel,this.map.baseLayer!==this&&(b=this.getZoomForResolution(this.map.baseLayer.getResolutionForZoom(b))));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,wrapDateLine:!0,sphericalMercator:!1,version:null,initialize:function(a,b){b=b||{};if(!b.version)b.version="function"===typeof GMap2?"2":"3";var c=OpenLayers.Layer.Google["v"+b.version.replace(/\./g,"_")];if(c)OpenLayers.Util.applyDefaults(b,c);else throw"Unsupported Google Maps API version: "+b.version;OpenLayers.Util.applyDefaults(b,c.DEFAULTS);if(b.maxExtent)b.maxExtent=b.maxExtent.clone();OpenLayers.Layer.EventPane.prototype.initialize.apply(this,[a,b]);OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,
[a,b]);this.sphericalMercator&&(OpenLayers.Util.extend(this,OpenLayers.Layer.SphericalMercator),this.initMercatorParameters())},clone:function(){return new OpenLayers.Layer.Google(this.name,this.getOptions())},setVisibility:function(a){var b=null==this.opacity?1:this.opacity;OpenLayers.Layer.EventPane.prototype.setVisibility.apply(this,arguments);this.setOpacity(b)},display:function(a){this._dragging||this.setGMapVisibility(a);OpenLayers.Layer.EventPane.prototype.display.apply(this,arguments)},moveTo:function(a,
b,c){this._dragging=c;OpenLayers.Layer.EventPane.prototype.moveTo.apply(this,arguments);delete this._dragging},setOpacity:function(a){if(a!==this.opacity)null!=this.map&&this.map.events.triggerEvent("changelayer",{layer:this,property:"opacity"}),this.opacity=a;if(this.getVisibility()){var b=this.getMapContainer();OpenLayers.Util.modifyDOMElement(b,null,null,null,null,null,null,a)}},destroy:function(){if(this.map){this.setGMapVisibility(!1);var a=OpenLayers.Layer.Google.cache[this.map.id];a&&1>=a.count&&
this.removeGMapElements()}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.getMapContainer();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(!1);var b=OpenLayers.Layer.Google.cache[a.id];
b&&(1>=b.count?(this.removeGMapElements(),delete OpenLayers.Layer.Google.cache[a.id]):--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;null!=a&&(b=a.getSouthWest(),a=a.getNorthEast(),this.sphericalMercator?(b=this.forwardMercator(b.lng(),b.lat()),a=this.forwardMercator(a.lng(),a.lat())):(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},getWarningHTML:function(){return OpenLayers.i18n("googleWarning")},getMapObjectCenter:function(){return this.mapObject.getCenter()},getMapObjectZoom:function(){return this.mapObject.getZoom()},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()},getXFromMapObjectPixel:function(a){return a.x},getYFromMapObjectPixel:function(a){return a.y},CLASS_NAME:"OpenLayers.Layer.Google"});OpenLayers.Layer.Google.cache={};
OpenLayers.Layer.Google.v2={termsOfUse:null,poweredBy:null,dragObject:null,loadMapObject:function(){if(!this.type)this.type=G_NORMAL_MAP;var a,b,c,d=OpenLayers.Layer.Google.cache[this.map.id];if(d)a=d.mapObject,b=d.termsOfUse,c=d.poweredBy,++d.count;else{var d=this.map.viewPortDiv,e=document.createElement("div");e.id=this.map.id+"_GMap2Container";e.style.position="absolute";e.style.width="100%";e.style.height="100%";d.appendChild(e);try{a=new GMap2(e),b=e.lastChild,d.appendChild(b),b.style.zIndex=
"1100",b.style.right="",b.style.bottom="",b.className="olLayerGoogleCopyright",c=e.lastChild,d.appendChild(c),c.style.zIndex="1100",c.style.right="",c.style.bottom="",c.className="olLayerGooglePoweredBy gmnoprint"}catch(f){throw f;}OpenLayers.Layer.Google.cache[this.map.id]={mapObject:a,termsOfUse:b,poweredBy:c,count:1}}this.mapObject=a;this.termsOfUse=b;this.poweredBy=c;-1===OpenLayers.Util.indexOf(this.mapObject.getMapTypes(),this.type)&&this.mapObject.addMapType(this.type);"function"==typeof a.getDragObject?
this.dragObject=a.getDragObject():this.dragPanMapObject=null;!1===this.isBaseLayer&&this.setGMapVisibility("none"!==this.div.style.display)},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=!0}},setGMapVisibility:function(a){var b=OpenLayers.Layer.Google.cache[this.map.id];
if(b){var c=this.mapObject.getContainer();if(!0===a)this.mapObject.setMapType(this.type),c.style.display="",this.termsOfUse.style.left="",this.termsOfUse.style.display="",this.poweredBy.style.display="",b.displayed=this.id;else if(b.displayed===this.id&&delete b.displayed,!b.displayed)c.style.display="none",this.termsOfUse.style.display="none",this.termsOfUse.style.left="-9999px",this.poweredBy.style.display="none"}},getMapContainer:function(){return this.mapObject.getContainer()},getMapObjectBoundsFromOLBounds:function(a){var b=
null;null!=a&&(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},setMapObjectCenter:function(a,b){this.mapObject.setCenter(a,b)},dragPanMapObject:function(a,b){this.dragObject.moveBy(new GSize(-a,b))},getMapObjectLonLatFromMapObjectPixel:function(a){return this.mapObject.fromContainerPixelToLatLng(a)},
getMapObjectPixelFromMapObjectLonLat:function(a){return this.mapObject.fromLatLngToContainerPixel(a)},getMapObjectZoomFromMapObjectBounds:function(a){return this.mapObject.getBoundsZoomLevel(a)},getMapObjectLonLatFromLonLat:function(a,b){var c;this.sphericalMercator?(c=this.inverseMercator(a,b),c=new GLatLng(c.lat,c.lon)):c=new GLatLng(b,a);return c},getMapObjectPixelFromXY:function(a,b){return new GPoint(a,b)}};
OpenLayers.Control.Attribution=OpenLayers.Class(OpenLayers.Control,{separator:", ",destroy:function(){this.map.events.un({removelayer:this.updateAttribution,addlayer:this.updateAttribution,changelayer:this.updateAttribution,changebaselayer:this.updateAttribution,scope:this});OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.map.events.on({changebaselayer:this.updateAttribution,changelayer:this.updateAttribution,
addlayer:this.updateAttribution,removelayer:this.updateAttribution,scope:this});this.updateAttribution();return this.div},updateAttribution:function(){var a=[];if(this.map&&this.map.layers){for(var b=0,c=this.map.layers.length;b<c;b++){var d=this.map.layers[b];d.attribution&&d.getVisibility()&&-1===OpenLayers.Util.indexOf(a,d.attribution)&&a.push(d.attribution)}this.div.innerHTML=a.join(this.separator)}},CLASS_NAME:"OpenLayers.Control.Attribution"});
OpenLayers.Handler=OpenLayers.Class({id:null,control:null,map:null,keyMask:null,active:!1,evt:null,initialize:function(a,b,c){OpenLayers.Util.extend(this,c);this.control=a;this.callbacks=b;(a=this.map||a.map)&&this.setMap(a);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},setMap:function(a){this.map=a},checkModifiers:function(a){return null==this.keyMask?!0:((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!1;for(var a=OpenLayers.Events.prototype.BROWSER_EVENTS,b=0,c=a.length;b<c;b++)this[a[b]]&&this.register(a[b],this[a[b]]);return this.active=!0},deactivate:function(){if(!this.active)return!1;for(var a=OpenLayers.Events.prototype.BROWSER_EVENTS,b=0,c=a.length;b<c;b++)this[a[b]]&&this.unregister(a[b],this[a[b]]);this.active=!1;return!0},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!0},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:!0,"double":!1,pixelTolerance:0,dblclickTolerance:13,stopSingle:!1,stopDouble:!1,timerId:null,touch:!1,down:null,last:null,first:null,rightclickTimerId:null,touchstart:function(a){if(!this.touch)this.unregisterMouseListeners(),this.touch=!0;this.down=this.getEventInfo(a);this.last=this.getEventInfo(a);return!0},touchmove:function(a){this.last=this.getEventInfo(a);return!0},touchend:function(a){if(this.down)a.xy=this.last.xy,
a.lastTouches=this.last.touches,this.handleSingle(a),this.down=null;return!0},unregisterMouseListeners:function(){this.map.events.un({mousedown:this.mousedown,mouseup:this.mouseup,click:this.click,dblclick:this.dblclick,scope:this})},mousedown:function(a){this.down=this.getEventInfo(a);this.last=this.getEventInfo(a);return!0},mouseup:function(a){var b=!0;this.checkModifiers(a)&&this.control.handleRightClicks&&OpenLayers.Event.isRightClick(a)&&(b=this.rightclick(a));return b},rightclick:function(a){if(this.passesTolerance(a)){if(null!=
this.rightclickTimerId)return this.clearTimer(),this.callback("dblrightclick",[a]),!this.stopDouble;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])},click:function(a){if(!this.last)this.last=this.getEventInfo(a);this.handleSingle(a);return!this.stopSingle},
dblclick:function(a){this.handleDouble(a);return!this.stopDouble},handleDouble:function(a){this["double"]&&this.passesDblclickTolerance(a)&&this.callback("dblclick",[a])},handleSingle:function(a){if(this.passesTolerance(a))null!=this.timerId?(this.last.touches&&1===this.last.touches.length&&(this["double"]&&OpenLayers.Event.stop(a),this.handleDouble(a)),(!this.last.touches||2!==this.last.touches.length)&&this.clearTimer()):(this.first=this.getEventInfo(a),this.queuePotentialClick(this.single?OpenLayers.Util.extend({},
a):null))},queuePotentialClick:function(a){this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,a),this.delay)},passesTolerance:function(a){var b=!0;if(null!=this.pixelTolerance&&this.down&&this.down.xy&&(b=this.pixelTolerance>=this.down.xy.distanceTo(a.xy))&&this.touch&&this.down.touches.length===this.last.touches.length)for(var a=0,c=this.down.touches.length;a<c;++a)if(this.getTouchDistance(this.down.touches[a],this.last.touches[a])>this.pixelTolerance){b=!1;break}return b},
getTouchDistance:function(a,b){return Math.sqrt(Math.pow(a.clientX-b.clientX,2)+Math.pow(a.clientY-b.clientY,2))},passesDblclickTolerance:function(){var a=!0;this.down&&this.first&&(a=this.down.xy.distanceTo(this.first.xy)<=this.dblclickTolerance);return a},clearTimer:function(){if(null!=this.timerId)window.clearTimeout(this.timerId),this.timerId=null;if(null!=this.rightclickTimerId)window.clearTimeout(this.rightclickTimerId),this.rightclickTimerId=null},delayedCall:function(a){this.timerId=null;
a&&this.callback("click",[a])},getEventInfo:function(a){var b;if(a.touches){var c=a.touches.length;b=Array(c);for(var d,e=0;e<c;e++)d=a.touches[e],b[e]={clientX:d.clientX,clientY:d.clientY}}return{xy:a.xy,touches:b}},deactivate:function(){var a=!1;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments))this.clearTimer(),this.last=this.first=this.down=null,this.touch=!1,a=!0;return a},CLASS_NAME:"OpenLayers.Handler.Click"});
OpenLayers.Format=OpenLayers.Class({options:null,externalProjection:null,internalProjection:null,data:null,keepData:!1,initialize:function(a){OpenLayers.Util.extend(this,a);this.options=a},destroy:function(){},read:function(){throw Error("Read not implemented.");},write:function(){throw Error("Write not implemented.");},CLASS_NAME:"OpenLayers.Format"});
OpenLayers.Format.WKT=OpenLayers.Class(OpenLayers.Format,{initialize:function(a){this.regExes={typeStr:/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,spaces:/\s+/,parenComma:/\)\s*,\s*\(/,doubleParenComma:/\)\s*\)\s*,\s*\(\s*\(/,trimParens:/^\s*\(?(.*?)\)?\s*$/};OpenLayers.Format.prototype.initialize.apply(this,[a])},read:function(a){var b,c,a=a.replace(/[\n\r]/g," ");if(c=this.regExes.typeStr.exec(a))if(a=c[1].toLowerCase(),c=c[2],this.parse[a]&&(b=this.parse[a].apply(this,[c])),this.internalProjection&&this.externalProjection)if(b&&
"OpenLayers.Feature.Vector"==b.CLASS_NAME)b.geometry.transform(this.externalProjection,this.internalProjection);else if(b&&"geometrycollection"!=a&&"object"==typeof b){a=0;for(c=b.length;a<c;a++)b[a].geometry.transform(this.externalProjection,this.internalProjection)}return b},write:function(a){var b,c;a.constructor==Array?c=!0:(a=[a],c=!1);var d=[];c&&d.push("GEOMETRYCOLLECTION(");for(var e=0,f=a.length;e<f;++e)c&&0<e&&d.push(","),b=a[e].geometry,d.push(this.extractGeometry(b));c&&d.push(")");return d.join("")},
extractGeometry:function(a){var b=a.CLASS_NAME.split(".")[2].toLowerCase();if(!this.extract[b])return null;this.internalProjection&&this.externalProjection&&(a=a.clone(),a.transform(this.internalProjection,this.externalProjection));return("collection"==b?"GEOMETRYCOLLECTION":b.toUpperCase())+"("+this.extract[b].apply(this,[a])+")"},extract:{point:function(a){return a.x+" "+a.y},multipoint:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push("("+this.extract.point.apply(this,[a.components[c]])+
")");return b.join(",")},linestring:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push(this.extract.point.apply(this,[a.components[c]]));return b.join(",")},multilinestring:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push("("+this.extract.linestring.apply(this,[a.components[c]])+")");return b.join(",")},polygon:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push("("+this.extract.linestring.apply(this,[a.components[c]])+")");return b.join(",")},multipolygon:function(a){for(var b=
[],c=0,d=a.components.length;c<d;++c)b.push("("+this.extract.polygon.apply(this,[a.components[c]])+")");return b.join(",")},collection:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push(this.extractGeometry.apply(this,[a.components[c]]));return b.join(",")}},parse:{point:function(a){a=OpenLayers.String.trim(a).split(this.regExes.spaces);return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(a[0],a[1]))},multipoint:function(a){for(var b=OpenLayers.String.trim(a).split(","),
c=[],d=0,e=b.length;d<e;++d)a=b[d].replace(this.regExes.trimParens,"$1"),c.push(this.parse.point.apply(this,[a]).geometry);return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPoint(c))},linestring:function(a){for(var a=OpenLayers.String.trim(a).split(","),b=[],c=0,d=a.length;c<d;++c)b.push(this.parse.point.apply(this,[a[c]]).geometry);return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(b))},multilinestring:function(a){for(var b=OpenLayers.String.trim(a).split(this.regExes.parenComma),
c=[],d=0,e=b.length;d<e;++d)a=b[d].replace(this.regExes.trimParens,"$1"),c.push(this.parse.linestring.apply(this,[a]).geometry);return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiLineString(c))},polygon:function(a){for(var b,a=OpenLayers.String.trim(a).split(this.regExes.parenComma),c=[],d=0,e=a.length;d<e;++d)b=a[d].replace(this.regExes.trimParens,"$1"),b=this.parse.linestring.apply(this,[b]).geometry,b=new OpenLayers.Geometry.LinearRing(b.components),c.push(b);return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon(c))},
multipolygon:function(a){for(var b=OpenLayers.String.trim(a).split(this.regExes.doubleParenComma),c=[],d=0,e=b.length;d<e;++d)a=b[d].replace(this.regExes.trimParens,"$1"),c.push(this.parse.polygon.apply(this,[a]).geometry);return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPolygon(c))},geometrycollection:function(a){for(var a=a.replace(/,\s*([A-Za-z])/g,"|$1"),a=OpenLayers.String.trim(a).split("|"),b=[],c=0,d=a.length;c<d;++c)b.push(OpenLayers.Format.WKT.prototype.read.apply(this,[a[c]]));
return b}},CLASS_NAME:"OpenLayers.Format.WKT"});
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(){null==this.bounds&&this.calculateBounds();
return this.bounds},calculateBounds:function(){},distanceTo:function(){},getVertices:function(){},atPoint:function(a,b,c){var d=!1;null!=this.getBounds()&&null!=a&&(b=null!=b?b:0,c=null!=c?c:0,d=(new OpenLayers.Bounds(this.bounds.left-b,this.bounds.bottom-c,this.bounds.right+b,this.bounds.top+c)).containsLonLat(a));return d},getLength:function(){return 0},getArea:function(){return 0},getCentroid:function(){return null},toString:function(){return OpenLayers.Format.WKT.prototype.write(new OpenLayers.Feature.Vector(this))},
CLASS_NAME:"OpenLayers.Geometry"});OpenLayers.Geometry.fromWKT=function(a){var b=arguments.callee.format;if(!b)b=new OpenLayers.Format.WKT,arguments.callee.format=b;var c,b=b.read(a);if(b instanceof OpenLayers.Feature.Vector)c=b.geometry;else if(OpenLayers.Util.isArray(b)){c=b.length;for(var d=Array(c),e=0;e<c;++e)d[e]=b[e].geometry;c=new OpenLayers.Geometry.Collection(d)}return c};
OpenLayers.Geometry.segmentsIntersect=function(a,b,c){var d=c&&c.point,c=c&&c.tolerance,e=!1,f=a.x1-b.x1,g=a.y1-b.y1,h=a.x2-a.x1,i=a.y2-a.y1,k=b.y2-b.y1,j=b.x2-b.x1,n=k*h-j*i,k=j*g-k*f,g=h*g-i*f;0==n?0==k&&0==g&&(e=!0):(f=k/n,n=g/n,0<=f&&1>=f&&0<=n&&1>=n&&(d?(h=a.x1+f*h,n=a.y1+f*i,e=new OpenLayers.Geometry.Point(h,n)):e=!0));if(c)if(e){if(d){a=[a,b];b=0;a:for(;2>b;++b){f=a[b];for(i=1;3>i;++i)if(h=f["x"+i],n=f["y"+i],d=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(n-e.y,2)),d<c){e.x=h;e.y=n;break a}}}}else{a=
[a,b];b=0;a:for(;2>b;++b){h=a[b];n=a[(b+1)%2];for(i=1;3>i;++i)if(f={x:h["x"+i],y:h["y"+i]},g=OpenLayers.Geometry.distanceToSegment(f,n),g.distance<c){e=d?new OpenLayers.Geometry.Point(f.x,f.y):!0;break a}}}return e};OpenLayers.Geometry.distanceToSegment=function(a,b){var c=a.x,d=a.y,e=b.x1,f=b.y1,g=b.x2,h=b.y2,i=g-e,k=h-f,j=(i*(c-e)+k*(d-f))/(Math.pow(i,2)+Math.pow(k,2));0>=j||(1<=j?(e=g,f=h):(e+=j*i,f+=j*k));return{distance:Math.sqrt(Math.pow(e-c,2)+Math.pow(f-d,2)),x:e,y:f}};
OpenLayers.Handler.Drag=OpenLayers.Class(OpenLayers.Handler,{started:!1,stopDown:!0,dragging:!1,touch:!1,last:null,start:null,lastMoveEvt:null,oldOnselectstart:null,interval:0,timeoutId:null,documentDrag:!1,documentEvents:null,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments);if(!0===this.documentDrag){var d=this;this._docMove=function(a){d.mousemove({xy:{x:a.clientX,y:a.clientY},element:document})};this._docUp=function(a){d.mouseup({xy:{x:a.clientX,y:a.clientY}})}}},
dragstart:function(a){var b=!0;this.dragging=!1;if(this.checkModifiers(a)&&(OpenLayers.Event.isLeftClick(a)||OpenLayers.Event.isSingleTouch(a))){this.started=!0;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=
!1,this.last=this.start=null;return b},dragmove:function(a){this.lastMoveEvt=a;if(this.started&&!this.timeoutId&&(a.xy.x!=this.last.x||a.xy.y!=this.last.y)){!0===this.documentDrag&&this.documentEvents&&(a.element===document?(this.adjustXY(a),this.setEvent(a)):this.removeDocumentEvents());if(0<this.interval)this.timeoutId=setTimeout(OpenLayers.Function.bind(this.removeTimeout,this),this.interval);this.dragging=!0;this.move(a);this.callback("move",[a.xy]);if(!this.oldOnselectstart)this.oldOnselectstart=
document.onselectstart,document.onselectstart=OpenLayers.Function.False;this.last=a.xy}return!0},dragend:function(a){if(this.started){!0===this.documentDrag&&this.documentEvents&&(this.adjustXY(a),this.removeDocumentEvents());var b=this.start!=this.last;this.dragging=this.started=!1;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.up(a);this.callback("up",[a.xy]);b&&this.callback("done",[a.xy]);document.onselectstart=this.oldOnselectstart}return!0},down:function(){},move:function(){},
up:function(){},out:function(){},mousedown:function(a){return this.dragstart(a)},touchstart:function(a){if(!this.touch)this.touch=!0,this.map.events.un({mousedown:this.mousedown,mouseup:this.mouseup,mousemove:this.mousemove,click:this.click,scope:this});return this.dragstart(a)},mousemove:function(a){return this.dragmove(a)},touchmove:function(a){return this.dragmove(a)},removeTimeout:function(){this.timeoutId=null;this.dragging&&this.mousemove(this.lastMoveEvt)},mouseup:function(a){return this.dragend(a)},
touchend:function(a){a.xy=this.last;return this.dragend(a)},mouseout:function(a){if(this.started&&OpenLayers.Util.mouseLeft(a,this.map.eventsDiv))if(!0===this.documentDrag)this.addDocumentEvents();else{var b=this.start!=this.last;this.dragging=this.started=!1;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!0},click:function(){return this.start==
this.last},activate:function(){var a=!1;if(OpenLayers.Handler.prototype.activate.apply(this,arguments))this.dragging=!1,a=!0;return a},deactivate:function(){var a=!1;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments))this.dragging=this.started=this.touch=!1,this.last=this.start=null,a=!0,OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");return a},adjustXY:function(a){var b=OpenLayers.Util.pagePosition(this.map.viewPortDiv);a.xy.x-=b[0];a.xy.y-=b[1]},addDocumentEvents:function(){OpenLayers.Element.addClass(document.body,
"olDragDown");this.documentEvents=!0;OpenLayers.Event.observe(document,"mousemove",this._docMove);OpenLayers.Event.observe(document,"mouseup",this._docUp)},removeDocumentEvents:function(){OpenLayers.Element.removeClass(document.body,"olDragDown");this.documentEvents=!1;OpenLayers.Event.stopObserving(document,"mousemove",this._docMove);OpenLayers.Event.stopObserving(document,"mouseup",this._docUp)},CLASS_NAME:"OpenLayers.Handler.Drag"});
OpenLayers.Handler.Box=OpenLayers.Class(OpenLayers.Handler,{dragHandler:null,boxDivClassName:"olHandlerBoxZoomBox",boxOffsets:null,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.dragHandler=new OpenLayers.Handler.Drag(this,{down:this.startBox,move:this.moveBox,out:this.removeBox,up:this.endBox},{keyMask:this.keyMask})},destroy:function(){OpenLayers.Handler.prototype.destroy.apply(this,arguments);if(this.dragHandler)this.dragHandler.destroy(),this.dragHandler=
null},setMap:function(a){OpenLayers.Handler.prototype.setMap.apply(this,arguments);this.dragHandler&&this.dragHandler.setMap(a)},startBox:function(){this.callback("start",[]);this.zoomBox=OpenLayers.Util.createDiv("zoomBox",new OpenLayers.Pixel(-9999,-9999));this.zoomBox.className=this.boxDivClassName;this.zoomBox.style.zIndex=this.map.Z_INDEX_BASE.Popup-1;this.map.eventsDiv.appendChild(this.zoomBox);OpenLayers.Element.addClass(this.map.eventsDiv,"olDrawBox")},moveBox:function(a){var b=this.dragHandler.start.x,
c=this.dragHandler.start.y,d=Math.abs(b-a.x),e=Math.abs(c-a.y),f=this.getBoxOffsets();this.zoomBox.style.width=d+f.width+1+"px";this.zoomBox.style.height=e+f.height+1+"px";this.zoomBox.style.left=(a.x<b?b-d-f.left:b-f.left)+"px";this.zoomBox.style.top=(a.y<c?c-e-f.top:c-f.top)+"px"},endBox:function(a){var b;if(5<Math.abs(this.dragHandler.start.x-a.x)||5<Math.abs(this.dragHandler.start.y-a.y)){var c=this.dragHandler.start;b=Math.min(c.y,a.y);var d=Math.max(c.y,a.y),e=Math.min(c.x,a.x),a=Math.max(c.x,
a.x);b=new OpenLayers.Bounds(e,d,a,b)}else b=this.dragHandler.start.clone();this.removeBox();this.callback("done",[b])},removeBox:function(){this.map.eventsDiv.removeChild(this.zoomBox);this.boxOffsets=this.zoomBox=null;OpenLayers.Element.removeClass(this.map.eventsDiv,"olDrawBox")},activate:function(){return OpenLayers.Handler.prototype.activate.apply(this,arguments)?(this.dragHandler.activate(),!0):!1},deactivate:function(){return OpenLayers.Handler.prototype.deactivate.apply(this,arguments)?(this.dragHandler.deactivate()&&
this.zoomBox&&this.removeBox(),!0):!1},getBoxOffsets:function(){if(!this.boxOffsets){var a=document.createElement("div");a.style.position="absolute";a.style.border="1px solid black";a.style.width="3px";document.body.appendChild(a);var b=3==a.clientWidth;document.body.removeChild(a);var a=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-left-width")),c=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-right-width")),d=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-top-width")),
e=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-bottom-width"));this.boxOffsets={left:a,right:c,top:d,bottom:e,width:!1===b?a+c:0,height:!1===b?d+e:0}}return this.boxOffsets},CLASS_NAME:"OpenLayers.Handler.Box"});
OpenLayers.Control.ZoomBox=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,out:!1,keyMask:null,alwaysZoom:!1,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);var c=Math.abs(a.top-a.bottom);b=Math.min(this.map.size.h/c,this.map.size.w/b);var c=this.map.getExtent(),d=this.map.getLonLatFromPixel(a.getCenterPixel()),a=d.lon-
c.getWidth()/2*b,e=d.lon+c.getWidth()/2*b,f=d.lat-c.getHeight()/2*b;b=d.lat+c.getHeight()/2*b;b=new OpenLayers.Bounds(a,f,e,b)}else b=this.map.getLonLatFromPixel(new OpenLayers.Pixel(a.left,a.bottom)),c=this.map.getLonLatFromPixel(new OpenLayers.Pixel(a.right,a.top)),b=new OpenLayers.Bounds(b.lon,b.lat,c.lon,c.lat);c=this.map.getZoom();this.map.zoomToExtent(b);c==this.map.getZoom()&&!0==this.alwaysZoom&&this.map.zoomTo(c+(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.DragPan=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,panned:!1,interval:1,documentDrag:!1,kinetic:null,enableKinetic:!1,kineticInterval:10,draw:function(){if(this.enableKinetic){var a={interval:this.kineticInterval};"object"===typeof this.enableKinetic&&(a=OpenLayers.Util.extend(a,this.enableKinetic));this.kinetic=new OpenLayers.Kinetic(a)}this.handler=new OpenLayers.Handler.Drag(this,{move:this.panMap,done:this.panMapDone,down:this.panMapStart},{interval:this.interval,
documentDrag:this.documentDrag})},panMapStart:function(){this.kinetic&&this.kinetic.begin()},panMap:function(a){this.kinetic&&this.kinetic.update(a);this.panned=!0;this.map.pan(this.handler.last.x-a.x,this.handler.last.y-a.y,{dragging:!0,animate:!1})},panMapDone:function(a){if(this.panned){var b=null;this.kinetic&&(b=this.kinetic.end(a));this.map.pan(this.handler.last.x-a.x,this.handler.last.y-a.y,{dragging:!!b,animate:!1});if(b){var c=this;this.kinetic.move(b,function(a,b,f){c.map.pan(a,b,{dragging:!f,
animate:!1})})}this.panned=!1}},CLASS_NAME:"OpenLayers.Control.DragPan"});
OpenLayers.Handler.MouseWheel=OpenLayers.Class(OpenLayers.Handler,{wheelListener:null,mousePosition:null,interval:0,delta:0,cumulative:!0,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.wheelListener=OpenLayers.Function.bindAsEventListener(this.onWheelEvent,this)},destroy:function(){OpenLayers.Handler.prototype.destroy.apply(this,arguments);this.wheelListener=null},onWheelEvent:function(a){if(this.map&&this.checkModifiers(a)){for(var b=!1,c=!1,d=!1,e=
OpenLayers.Event.element(a);null!=e&&!d&&!b;){if(!b)try{var f=e.currentStyle?e.currentStyle.overflow:document.defaultView.getComputedStyle(e,null).getPropertyValue("overflow"),b=f&&"auto"==f||"scroll"==f}catch(g){}if(!c)for(var d=0,h=this.map.layers.length;d<h;d++)if(e==this.map.layers[d].div||e==this.map.layers[d].pane){c=!0;break}d=e==this.map.div;e=e.parentNode}if(!b&&d){if(c){b=0;if(!a)a=window.event;a.wheelDelta?(b=a.wheelDelta/120,window.opera&&9.2>window.opera.version()&&(b=-b)):a.detail&&
(b=-a.detail/3);this.delta+=b;this.interval?(window.clearTimeout(this._timeoutId),this._timeoutId=window.setTimeout(OpenLayers.Function.bind(function(){this.wheelZoom(a)},this),this.interval)):this.wheelZoom(a)}OpenLayers.Event.stop(a)}}},wheelZoom:function(a){var b=this.delta;this.delta=0;if(b){if(this.mousePosition)a.xy=this.mousePosition;if(!a.xy)a.xy=this.map.getPixelFromLonLat(this.map.getCenter());0>b?this.callback("down",[a,this.cumulative?b:-1]):this.callback("up",[a,this.cumulative?b:1])}},
mousemove:function(a){this.mousePosition=a.xy},activate:function(a){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){var b=this.wheelListener;OpenLayers.Event.observe(window,"DOMMouseScroll",b);OpenLayers.Event.observe(window,"mousewheel",b);OpenLayers.Event.observe(document,"mousewheel",b);return!0}return!1},deactivate:function(a){if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){var b=this.wheelListener;OpenLayers.Event.stopObserving(window,"DOMMouseScroll",b);OpenLayers.Event.stopObserving(window,
"mousewheel",b);OpenLayers.Event.stopObserving(document,"mousewheel",b);return!0}return!1},CLASS_NAME:"OpenLayers.Handler.MouseWheel"});
OpenLayers.Control.Navigation=OpenLayers.Class(OpenLayers.Control,{dragPan:null,dragPanOptions:null,pinchZoom:null,pinchZoomOptions:null,documentDrag:!1,zoomBox:null,zoomBoxEnabled:!0,zoomWheelEnabled:!0,mouseWheelOptions:null,handleRightClicks:!1,zoomBoxKeyMask:OpenLayers.Handler.MOD_SHIFT,autoActivate:!0,initialize:function(a){this.handlers={};OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.deactivate();this.dragPan&&this.dragPan.destroy();this.dragPan=null;
this.zoomBox&&this.zoomBox.destroy();this.zoomBox=null;this.pinchZoom&&this.pinchZoom.destroy();this.pinchZoom=null;OpenLayers.Control.prototype.destroy.apply(this,arguments)},activate:function(){this.dragPan.activate();this.zoomWheelEnabled&&this.handlers.wheel.activate();this.handlers.click.activate();this.zoomBoxEnabled&&this.zoomBox.activate();this.pinchZoom&&this.pinchZoom.activate();return OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){this.pinchZoom&&this.pinchZoom.deactivate();
this.zoomBox.deactivate();this.dragPan.deactivate();this.handlers.click.deactivate();this.handlers.wheel.deactivate();return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},draw:function(){if(this.handleRightClicks)this.map.viewPortDiv.oncontextmenu=OpenLayers.Function.False;this.handlers.click=new OpenLayers.Handler.Click(this,{click:this.defaultClick,dblclick:this.defaultDblClick,dblrightclick:this.defaultDblRightClick},{"double":!0,stopDouble:!0});this.dragPan=new OpenLayers.Control.DragPan(OpenLayers.Util.extend({map:this.map,
documentDrag:this.documentDrag},this.dragPanOptions));this.zoomBox=new OpenLayers.Control.ZoomBox({map:this.map,keyMask:this.zoomBoxKeyMask});this.dragPan.draw();this.zoomBox.draw();this.handlers.wheel=new OpenLayers.Handler.MouseWheel(this,{up:this.wheelUp,down:this.wheelDown},this.mouseWheelOptions);if(OpenLayers.Control.PinchZoom)this.pinchZoom=new OpenLayers.Control.PinchZoom(OpenLayers.Util.extend({map:this.map},this.pinchZoomOptions))},defaultClick:function(a){a.lastTouches&&2==a.lastTouches.length&&
this.map.zoomOut()},defaultDblClick:function(a){this.map.setCenter(this.map.getLonLatFromViewPortPx(a.xy),this.map.zoom+1)},defaultDblRightClick:function(a){this.map.setCenter(this.map.getLonLatFromViewPortPx(a.xy),this.map.zoom-1)},wheelChange:function(a,b){var c=this.map.getZoom(),d=this.map.getZoom()+Math.round(b),d=Math.max(d,0),d=Math.min(d,this.map.getNumZoomLevels());if(d!==c){var e=this.map.getSize(),c=e.w/2-a.xy.x,e=a.xy.y-e.h/2,f=this.map.baseLayer.getResolutionForZoom(d),g=this.map.getLonLatFromPixel(a.xy);
this.map.setCenter(new OpenLayers.LonLat(g.lon+c*f,g.lat+e*f),d)}},wheelUp:function(a,b){this.wheelChange(a,b||1)},wheelDown:function(a,b){this.wheelChange(a,b||-1)},disableZoomBox:function(){this.zoomBoxEnabled=!1;this.zoomBox.deactivate()},enableZoomBox:function(){this.zoomBoxEnabled=!0;this.active&&this.zoomBox.activate()},disableZoomWheel:function(){this.zoomWheelEnabled=!1;this.handlers.wheel.deactivate()},enableZoomWheel:function(){this.zoomWheelEnabled=!0;this.active&&this.handlers.wheel.activate()},
CLASS_NAME:"OpenLayers.Control.Navigation"});
OpenLayers.Handler.Pinch=OpenLayers.Class(OpenLayers.Handler,{started:!1,stopDown:!1,pinching:!1,last:null,start:null,touchstart:function(a){var b=!0;this.pinching=!1;OpenLayers.Event.isMultiTouch(a)?(this.started=!0,this.last=this.start={distance:this.getDistance(a.touches),delta:0,scale:1},this.callback("start",[a,this.start]),b=!this.stopDown):(this.started=!1,this.last=this.start=null);OpenLayers.Event.stop(a);return b},touchmove:function(a){if(this.started&&OpenLayers.Event.isMultiTouch(a)){this.pinching=
!0;var b=this.getPinchData(a);this.callback("move",[a,b]);this.last=b;OpenLayers.Event.stop(a)}return!0},touchend:function(a){if(this.started)this.pinching=this.started=!1,this.callback("done",[a,this.start,this.last]),this.last=this.start=null;return!0},activate:function(){var a=!1;if(OpenLayers.Handler.prototype.activate.apply(this,arguments))this.pinching=!1,a=!0;return a},deactivate:function(){var a=!1;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments))this.pinching=this.started=
!1,this.last=this.start=null,a=!0;return a},getDistance:function(a){var b=a[0],a=a[1];return Math.sqrt(Math.pow(b.clientX-a.clientX,2)+Math.pow(b.clientY-a.clientY,2))},getPinchData:function(a){a=this.getDistance(a.touches);return{distance:a,delta:this.last.distance-a,scale:a/this.start.distance}},CLASS_NAME:"OpenLayers.Handler.Pinch"});
OpenLayers.Control.PinchZoom=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,containerCenter:null,pinchOrigin:null,currentCenter:null,autoActivate:!0,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.handler=new OpenLayers.Handler.Pinch(this,{start:this.pinchStart,move:this.pinchMove,done:this.pinchDone},this.handlerOptions)},activate:function(){var a=OpenLayers.Control.prototype.activate.apply(this,arguments);a&&(this.map.events.on({moveend:this.updateContainerCenter,
scope:this}),this.updateContainerCenter());return a},deactivate:function(){var a=OpenLayers.Control.prototype.deactivate.apply(this,arguments);this.map&&this.map.events&&this.map.events.un({moveend:this.updateContainerCenter,scope:this});return a},updateContainerCenter:function(){var a=this.map.layerContainerDiv;this.containerCenter={x:parseInt(a.style.left,10)+50,y:parseInt(a.style.top,10)+50}},pinchStart:function(a){this.currentCenter=this.pinchOrigin=a.xy},pinchMove:function(a,b){var c=b.scale,
d=this.containerCenter,e=this.pinchOrigin,f=a.xy,g=Math.round(f.x-e.x+(c-1)*(d.x-e.x)),d=Math.round(f.y-e.y+(c-1)*(d.y-e.y));this.applyTransform("translate("+g+"px, "+d+"px) scale("+c+")");this.currentCenter=f},applyTransform:function(a){var b=this.map.layerContainerDiv.style;b["-webkit-transform"]=a;b["-moz-transform"]=a},pinchDone:function(a,b,c){this.applyTransform("");a=this.map.getZoomForResolution(this.map.getResolution()/c.scale,!0);if(a!==this.map.getZoom()||!this.currentCenter.equals(this.pinchOrigin)){var b=
this.map.getResolutionForZoom(a),c=this.map.getLonLatFromPixel(this.pinchOrigin),d=this.currentCenter,e=this.map.getSize();c.lon+=b*(e.w/2-d.x);c.lat-=b*(e.h/2-d.y);this.map.setCenter(c,a)}},CLASS_NAME:"OpenLayers.Control.PinchZoom"});
OpenLayers.Control.TouchNavigation=OpenLayers.Class(OpenLayers.Control,{dragPan:null,dragPanOptions:null,pinchZoom:null,pinchZoomOptions:null,clickHandlerOptions:null,documentDrag:!1,autoActivate:!0,initialize:function(a){this.handlers={};OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.deactivate();this.dragPan&&this.dragPan.destroy();this.dragPan=null;this.pinchZoom&&(this.pinchZoom.destroy(),delete this.pinchZoom);OpenLayers.Control.prototype.destroy.apply(this,
arguments)},activate:function(){return OpenLayers.Control.prototype.activate.apply(this,arguments)?(this.dragPan.activate(),this.handlers.click.activate(),this.pinchZoom.activate(),!0):!1},deactivate:function(){return OpenLayers.Control.prototype.deactivate.apply(this,arguments)?(this.dragPan.deactivate(),this.handlers.click.deactivate(),this.pinchZoom.deactivate(),!0):!1},draw:function(){var a={click:this.defaultClick,dblclick:this.defaultDblClick},b=OpenLayers.Util.extend({"double":!0,stopDouble:!0,
pixelTolerance:2},this.clickHandlerOptions);this.handlers.click=new OpenLayers.Handler.Click(this,a,b);this.dragPan=new OpenLayers.Control.DragPan(OpenLayers.Util.extend({map:this.map,documentDrag:this.documentDrag},this.dragPanOptions));this.dragPan.draw();this.pinchZoom=new OpenLayers.Control.PinchZoom(OpenLayers.Util.extend({map:this.map},this.pinchZoomOptions))},defaultClick:function(a){a.lastTouches&&2==a.lastTouches.length&&this.map.zoomOut()},defaultDblClick:function(a){this.map.setCenter(this.map.getLonLatFromViewPortPx(a.xy),
this.map.zoom+1)},CLASS_NAME:"OpenLayers.Control.TouchNavigation"});
OpenLayers.StyleMap=OpenLayers.Class({styles:null,extendDefault:!0,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("object"==typeof a)for(var c in a)if(a[c]instanceof OpenLayers.Style)this.styles[c]=a[c];else if("object"==typeof a[c])this.styles[c]=new OpenLayers.Style(a[c]);else{this.styles["default"]=new OpenLayers.Style(a);this.styles.select=new OpenLayers.Style(a);this.styles.temporary=new OpenLayers.Style(a);this.styles["delete"]=new OpenLayers.Style(a);break}OpenLayers.Util.extend(this,b)},destroy:function(){for(var a in this.styles)this.styles[a].destroy();this.styles=null},createSymbolizer:function(a,
b){a||(a=new OpenLayers.Feature.Vector);this.styles[b]||(b="default");a.renderIntent=b;var c={};this.extendDefault&&"default"!=b&&(c=this.styles["default"].createSymbolizer(a));return OpenLayers.Util.extend(c,this.styles[b].createSymbolizer(a))},addUniqueValueRules:function(a,b,c,d){var e=[],f;for(f in c)e.push(new OpenLayers.Rule({symbolizer:c[f],context:d,filter:new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.EQUAL_TO,property:b,value:f})}));this.styles[a].addRules(e)},CLASS_NAME:"OpenLayers.StyleMap"});
OpenLayers.Layer.Vector=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:!1,isFixed:!1,features:null,filter:null,selectedFeatures:null,unrenderedFeatures:null,reportError:!0,style:null,styleMap:null,strategies:null,protocol:null,renderers:["SVG","VML","Canvas"],renderer:null,rendererOptions:null,geometryType:null,drawn:!1,initialize:function(a,b){OpenLayers.Layer.prototype.initialize.apply(this,arguments);(!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 c=0,d=this.strategies.length;c<d;c++)this.strategies[c].setLayer(this)},destroy:function(){if(this.strategies){var a,b,c;for(b=0,c=this.strategies.length;b<c;b++)a=this.strategies[b],a.autoDestroy&&a.destroy();this.strategies=null}if(this.protocol)this.protocol.autoDestroy&&this.protocol.destroy(),this.protocol=null;this.destroyFeatures();
this.unrenderedFeatures=this.selectedFeatures=this.features=null;this.renderer&&this.renderer.destroy();this.drawn=this.geometryType=this.renderer=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(a){null==a&&(a=new OpenLayers.Layer.Vector(this.name,this.getOptions()));for(var a=OpenLayers.Layer.prototype.clone.apply(this,[a]),b=this.features,c=b.length,d=Array(c),e=0;e<c;++e)d[e]=b[e].clone();a.features=d;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 c=this.renderers[a];if((c="function"==typeof c?c:OpenLayers.Renderer[c])&&c.prototype.supported()){this.renderer=new c(this.div,this.rendererOptions);break}}},displayError:function(){this.reportError&&OpenLayers.Console.userError(OpenLayers.i18n("browserNotSupported",{renderers:this.renderers.join("\n")}))},setMap:function(a){OpenLayers.Layer.prototype.setMap.apply(this,arguments);this.renderer?
(this.renderer.map=this.map,this.renderer.setSize(this.map.getSize())):this.map.removeLayer(this)},afterAdd:function(){if(this.strategies){var a,b,c;for(b=0,c=this.strategies.length;b<c;b++)a=this.strategies[b],a.autoActivate&&a.activate()}},removeMap:function(){this.drawn=!1;if(this.strategies){var a,b,c;for(b=0,c=this.strategies.length;b<c;b++)a=this.strategies[b],a.autoActivate&&a.deactivate()}},onMapResize:function(){OpenLayers.Layer.prototype.onMapResize.apply(this,arguments);this.renderer.setSize(this.map.getSize())},
moveTo:function(a,b,c){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);var d=OpenLayers.Renderer.NG&&this.renderer instanceof OpenLayers.Renderer.NG;if(d)c||this.renderer.updateDimensions(b);else{var e=!0;if(!c){this.renderer.root.style.visibility="hidden";this.div.style.left=-parseInt(this.map.layerContainerDiv.style.left)+"px";this.div.style.top=-parseInt(this.map.layerContainerDiv.style.top)+"px";e=this.renderer.setExtent(this.map.getExtent(),b);this.renderer.root.style.visibility="visible";
if(!0===OpenLayers.IS_GECKO)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||!d&&(b||!e)){this.drawn=!0;f=0;for(d=this.features.length;f<d;f++)this.renderer.locked=f!==d-1,g=this.features[f],this.drawFeature(g)}},redraw:function(){if(OpenLayers.Renderer.NG&&this.renderer instanceof OpenLayers.Renderer.NG)this.drawn=!1;return OpenLayers.Layer.prototype.redraw.apply(this,arguments)},display:function(a){OpenLayers.Layer.prototype.display.apply(this,
arguments);var b=this.div.style.display;if(b!=this.renderer.root.style.display)this.renderer.root.style.display=b},addFeatures:function(a,b){OpenLayers.Util.isArray(a)||(a=[a]);var c=!b||!b.silent;if(c){var d={features:a};if(!1===this.events.triggerEvent("beforefeaturesadded",d))return;a=d.features}for(var d=[],e=0,f=a.length;e<f;e++){this.renderer.locked=e!=a.length-1?!0:!1;var g=a[e];if(this.geometryType&&!(g.geometry instanceof this.geometryType))throw new TypeError("addFeatures: component should be an "+
this.geometryType.prototype.CLASS_NAME);g.layer=this;if(!g.style&&this.style)g.style=OpenLayers.Util.extend({},this.style);if(c){if(!1===this.events.triggerEvent("beforefeatureadded",{feature:g}))continue;this.preFeatureInsert(g)}d.push(g);this.features.push(g);this.drawFeature(g);c&&(this.events.triggerEvent("featureadded",{feature:g}),this.onFeatureInsert(g))}c&&this.events.triggerEvent("featuresadded",{features:d})},removeFeatures:function(a,b){if(a&&0!==a.length){if(a===this.features)return this.removeAllFeatures(b);
OpenLayers.Util.isArray(a)||(a=[a]);a===this.selectedFeatures&&(a=a.slice());var c=!b||!b.silent;c&&this.events.triggerEvent("beforefeaturesremoved",{features:a});for(var d=a.length-1;0<=d;d--){this.renderer.locked=0!=d&&a[d-1].geometry?!0:!1;var e=a[d];delete this.unrenderedFeatures[e.id];c&&this.events.triggerEvent("beforefeatureremoved",{feature:e});this.features=OpenLayers.Util.removeItem(this.features,e);e.layer=null;e.geometry&&this.renderer.eraseFeatures(e);-1!=OpenLayers.Util.indexOf(this.selectedFeatures,
e)&&OpenLayers.Util.removeItem(this.selectedFeatures,e);c&&this.events.triggerEvent("featureremoved",{feature:e})}c&&this.events.triggerEvent("featuresremoved",{features:a})}},removeAllFeatures:function(a){var a=!a||!a.silent,b=this.features;a&&this.events.triggerEvent("beforefeaturesremoved",{features:b});for(var c,d=b.length-1;0<=d;d--)c=b[d],a&&this.events.triggerEvent("beforefeatureremoved",{feature:c}),c.layer=null,a&&this.events.triggerEvent("featureremoved",{feature:c});this.renderer.clear();
this.features=[];this.unrenderedFeatures={};this.selectedFeatures=[];a&&this.events.triggerEvent("featuresremoved",{features:b})},destroyFeatures:function(a,b){if(void 0==a)a=this.features;if(a){this.removeFeatures(a,b);for(var c=a.length-1;0<=c;c--)a[c].destroy()}},drawFeature:function(a,b){if(this.drawn){if("object"!=typeof b){!b&&a.state===OpenLayers.State.DELETE&&(b="delete");var c=b||a.renderIntent;(b=a.style||this.style)||(b=this.styleMap.createSymbolizer(a,c))}c=this.renderer.drawFeature(a,
b);!1===c||null===c?this.unrenderedFeatures[a.id]=a:delete this.unrenderedFeatures[a.id]}},eraseFeatures:function(a){this.renderer.eraseFeatures(a)},getFeatureFromEvent:function(a){if(!this.renderer)throw Error("getFeatureFromEvent called on layer with no renderer. This usually means you destroyed a layer, but not some handler which is associated with it.");var b=null;(a=this.renderer.getFeatureIdFromEvent(a))&&(b="string"===typeof a?this.getFeatureById(a):a);return b},getFeatureBy:function(a,b){for(var c=
null,d=0,e=this.features.length;d<e;++d)if(this.features[d][a]==b){c=this.features[d];break}return c},getFeatureById:function(a){return this.getFeatureBy("id",a)},getFeatureByFid:function(a){return this.getFeatureBy("fid",a)},getFeaturesByAttribute:function(a,b){var c,d,e=this.features.length,f=[];for(c=0;c<e;c++)(d=this.features[c])&&d.attributes&&d.attributes[a]===b&&f.push(d);return f},onFeatureInsert:function(){},preFeatureInsert:function(){},getDataExtent:function(){var a=null,b=this.features;
if(b&&0<b.length)for(var c=null,d=0,e=b.length;d<e;d++)if(c=b[d].geometry)null===a&&(a=new OpenLayers.Bounds),a.extend(c.getBounds());return a},CLASS_NAME:"OpenLayers.Layer.Vector"});
OpenLayers.Layer.XYZ=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:!0,sphericalMercator:!1,zoomOffset:0,serverResolutions:null,initialize:function(a,b,c){if(c&&c.sphericalMercator||this.sphericalMercator)c=OpenLayers.Util.extend({maxExtent:new OpenLayers.Bounds(-2.003750834E7,-2.003750834E7,2.003750834E7,2.003750834E7),maxResolution:156543.03390625,numZoomLevels:19,units:"m",projection:"EPSG:900913"},c);b=b||this.url;a=a||this.name;OpenLayers.Layer.Grid.prototype.initialize.apply(this,[a,b,
{},c])},clone:function(a){null==a&&(a=new OpenLayers.Layer.XYZ(this.name,this.url,this.getOptions()));return a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a])},getURL:function(a){var a=this.getXYZ(a),b=this.url;OpenLayers.Util.isArray(b)&&(b=this.selectUrl(""+a.x+a.y+a.z,b));return OpenLayers.String.format(b,a)},getXYZ:function(a){var b=this.getServerResolution(),c=Math.round((a.left-this.maxExtent.left)/(b*this.tileSize.w)),a=Math.round((this.maxExtent.top-a.top)/(b*this.tileSize.h)),d=this.serverResolutions||
this.resolutions,b=0==this.zoomOffset?OpenLayers.Util.indexOf(d,b):this.getServerZoom()+this.zoomOffset,d=Math.pow(2,b);this.wrapDateLine&&(c=(c%d+d)%d);return{x:c,y:a,z:b}},setMap:function(a){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:!0,url:"http://tile.openstreetmap.org/${z}/${x}/${y}.png",clone:function(a){null==a&&(a=new OpenLayers.Layer.OSM(this.name,this.url,this.getOptions()));return a=OpenLayers.Layer.XYZ.prototype.clone.apply(this,[a])},wrapDateLine:!0,CLASS_NAME:"OpenLayers.Layer.OSM"});
OpenLayers.Renderer.Canvas=OpenLayers.Class(OpenLayers.Renderer,{hitDetection:!0,hitOverflow:0,canvas:null,features:null,pendingRedraw:!1,initialize:function(a,b){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.root=document.createElement("canvas");this.container.appendChild(this.root);this.canvas=this.root.getContext("2d");this.features={};if(this.hitDetection)this.hitCanvas=document.createElement("canvas"),this.hitContext=this.hitCanvas.getContext("2d")},setExtent:function(){OpenLayers.Renderer.prototype.setExtent.apply(this,
arguments);return!1},eraseGeometry:function(a,b){this.eraseFeatures(this.features[b][0])},supported:function(){return!!document.createElement("canvas").getContext},setSize:function(a){this.size=a.clone();var b=this.root;b.style.width=a.w+"px";b.style.height=a.h+"px";b.width=a.w;b.height=a.h;this.resolution=null;if(this.hitDetection)b=this.hitCanvas,b.style.width=a.w+"px",b.style.height=a.h+"px",b.width=a.w,b.height=a.h},drawFeature:function(a,b){var c;if(a.geometry){b=this.applyDefaultSymbolizer(b||
a.style);c=a.geometry.getBounds();var d;this.map.baseLayer&&this.map.baseLayer.wrapDateLine&&(d=this.map.getMaxExtent());d=c&&c.intersectsBounds(this.extent,{worldBounds:d});(c="none"!==b.display&&!!c&&d)?this.features[a.id]=[a,b]:delete this.features[a.id];this.pendingRedraw=!0}if(this.pendingRedraw&&!this.locked)this.redraw(),this.pendingRedraw=!1;return c},drawGeometry:function(a,b,c){var d=a.CLASS_NAME;if("OpenLayers.Geometry.Collection"==d||"OpenLayers.Geometry.MultiPoint"==d||"OpenLayers.Geometry.MultiLineString"==
d||"OpenLayers.Geometry.MultiPolygon"==d)for(d=0;d<a.components.length;d++)this.drawGeometry(a.components[d],b,c);else switch(a.CLASS_NAME){case "OpenLayers.Geometry.Point":this.drawPoint(a,b,c);break;case "OpenLayers.Geometry.LineString":this.drawLineString(a,b,c);break;case "OpenLayers.Geometry.LinearRing":this.drawLinearRing(a,b,c);break;case "OpenLayers.Geometry.Polygon":this.drawPolygon(a,b,c)}},drawExternalGraphic:function(a,b,c){var d=new Image;if(b.graphicTitle)d.title=b.graphicTitle;var e=
b.graphicWidth||b.graphicHeight,f=b.graphicHeight||b.graphicWidth,e=e?e:2*b.pointRadius,f=f?f:2*b.pointRadius,g=void 0!=b.graphicXOffset?b.graphicXOffset:-(0.5*e),h=void 0!=b.graphicYOffset?b.graphicYOffset:-(0.5*f),i=b.graphicOpacity||b.fillOpacity;d.onload=OpenLayers.Function.bind(function(){if(this.features[c]){var b=this.getLocalXY(a),j=b[0],b=b[1];if(!isNaN(j)&&!isNaN(b)){var j=j+g|0,b=b+h|0,n=this.canvas;n.globalAlpha=i;var m=OpenLayers.Renderer.Canvas.drawImageScaleFactor||(OpenLayers.Renderer.Canvas.drawImageScaleFactor=
/android 2.1/.test(navigator.userAgent.toLowerCase())?320/window.screen.width:1);n.drawImage(d,j*m,b*m,e*m,f*m);this.hitDetection&&(this.setHitContextStyle("fill",c),this.hitContext.fillRect(j,b,e,f))}}},this);d.src=b.externalGraphic},setCanvasStyle:function(a,b){"fill"===a?(this.canvas.globalAlpha=b.fillOpacity,this.canvas.fillStyle=b.fillColor):"stroke"===a?(this.canvas.globalAlpha=b.strokeOpacity,this.canvas.strokeStyle=b.strokeColor,this.canvas.lineWidth=b.strokeWidth):(this.canvas.globalAlpha=
0,this.canvas.lineWidth=1)},featureIdToHex:function(a){a=Number(a.split("_").pop())+1;if(16777216<=a)this.hitOverflow=a-16777215,a=a%16777216+1;var a="000000"+a.toString(16),b=a.length;return a="#"+a.substring(b-6,b)},setHitContextStyle:function(a,b,c){b=this.featureIdToHex(b);"fill"==a?(this.hitContext.globalAlpha=1,this.hitContext.fillStyle=b):"stroke"==a?(this.hitContext.globalAlpha=1,this.hitContext.strokeStyle=b,this.hitContext.lineWidth=c.strokeWidth+2):(this.hitContext.globalAlpha=0,this.hitContext.lineWidth=
1)},drawPoint:function(a,b,c){if(!1!==b.graphic)if(b.externalGraphic)this.drawExternalGraphic(a,b,c);else{var d=this.getLocalXY(a),a=d[0],d=d[1];if(!isNaN(a)&&!isNaN(d)){var e=2*Math.PI,f=b.pointRadius;!1!==b.fill&&(this.setCanvasStyle("fill",b),this.canvas.beginPath(),this.canvas.arc(a,d,f,0,e,!0),this.canvas.fill(),this.hitDetection&&(this.setHitContextStyle("fill",c,b),this.hitContext.beginPath(),this.hitContext.arc(a,d,f,0,e,!0),this.hitContext.fill()));!1!==b.stroke&&(this.setCanvasStyle("stroke",
b),this.canvas.beginPath(),this.canvas.arc(a,d,f,0,e,!0),this.canvas.stroke(),this.hitDetection&&(this.setHitContextStyle("stroke",c,b),this.hitContext.beginPath(),this.hitContext.arc(a,d,f,0,e,!0),this.hitContext.stroke()),this.setCanvasStyle("reset"))}}},drawLineString:function(a,b,c){b=OpenLayers.Util.applyDefaults({fill:!1},b);this.drawLinearRing(a,b,c)},drawLinearRing:function(a,b,c){!1!==b.fill&&(this.setCanvasStyle("fill",b),this.renderPath(this.canvas,a,b,c,"fill"),this.hitDetection&&(this.setHitContextStyle("fill",
c,b),this.renderPath(this.hitContext,a,b,c,"fill")));!1!==b.stroke&&(this.setCanvasStyle("stroke",b),this.renderPath(this.canvas,a,b,c,"stroke"),this.hitDetection&&(this.setHitContextStyle("stroke",c,b),this.renderPath(this.hitContext,a,b,c,"stroke")));this.setCanvasStyle("reset")},renderPath:function(a,b,c,d,e){b=b.components;c=b.length;a.beginPath();var d=this.getLocalXY(b[0]),f=d[1];if(!isNaN(d[0])&&!isNaN(f)){a.moveTo(d[0],d[1]);for(d=1;d<c;++d)f=this.getLocalXY(b[d]),a.lineTo(f[0],f[1]);"fill"===
e?a.fill():a.stroke()}},drawPolygon:function(a,b,c){var a=a.components,d=a.length;this.drawLinearRing(a[0],b,c);for(var e=1;e<d;++e){this.canvas.globalCompositeOperation="destination-out";if(this.hitDetection)this.hitContext.globalCompositeOperation="destination-out";this.drawLinearRing(a[e],OpenLayers.Util.applyDefaults({stroke:!1,fillOpacity:1},b),c);this.canvas.globalCompositeOperation="source-over";if(this.hitDetection)this.hitContext.globalCompositeOperation="source-over";this.drawLinearRing(a[e],
OpenLayers.Util.applyDefaults({fill:!1},b),c)}},drawText:function(a,b){var b=OpenLayers.Util.extend({fontColor:"#000000",labelAlign:"cm"},b),c=this.getLocalXY(a);this.setCanvasStyle("reset");this.canvas.fillStyle=b.fontColor;this.canvas.globalAlpha=b.fontOpacity||1;var d=[b.fontStyle?b.fontStyle:"normal","normal",b.fontWeight?b.fontWeight:"normal",b.fontSize?b.fontSize:"1em",b.fontFamily?b.fontFamily:"sans-serif"].join(" "),e=b.label.split("\n"),f=e.length;if(this.canvas.fillText){this.canvas.font=
d;this.canvas.textAlign=OpenLayers.Renderer.Canvas.LABEL_ALIGN[b.labelAlign[0]]||"center";this.canvas.textBaseline=OpenLayers.Renderer.Canvas.LABEL_ALIGN[b.labelAlign[1]]||"middle";var g=OpenLayers.Renderer.Canvas.LABEL_FACTOR[b.labelAlign[1]];null==g&&(g=-0.5);d=this.canvas.measureText("Mg").height||this.canvas.measureText("xx").width;c[1]+=d*g*(f-1);for(g=0;g<f;g++)this.canvas.fillText(e[g],c[0],c[1]+d*g)}else if(this.canvas.mozDrawText){this.canvas.mozTextStyle=d;var h=OpenLayers.Renderer.Canvas.LABEL_FACTOR[b.labelAlign[0]];
null==h&&(h=-0.5);g=OpenLayers.Renderer.Canvas.LABEL_FACTOR[b.labelAlign[1]];null==g&&(g=-0.5);d=this.canvas.mozMeasureText("xx");c[1]+=d*(1+g*f);for(g=0;g<f;g++){var i=c[0]+h*this.canvas.mozMeasureText(e[g]),k=c[1]+g*d;this.canvas.translate(i,k);this.canvas.mozDrawText(e[g]);this.canvas.translate(-i,-k)}}this.setCanvasStyle("reset")},getLocalXY:function(a){var b=this.getResolution(),c=this.extent;return[(a.x-this.featureDx)/b+-c.left/b,c.top/b-a.y/b]},clear:function(){var a=this.root.height,b=this.root.width;
this.canvas.clearRect(0,0,b,a);this.features={};this.hitDetection&&this.hitContext.clearRect(0,0,b,a)},getFeatureIdFromEvent:function(a){var b=null;if(this.hitDetection&&!this.map.dragging)a=a.xy,a=this.hitContext.getImageData(a.x|0,a.y|0,1,1).data,255===a[3]&&(a=a[2]+256*(a[1]+256*a[0]))&&(b=this.features["OpenLayers.Feature.Vector_"+(a-1+this.hitOverflow)][0]);return b},eraseFeatures:function(a){OpenLayers.Util.isArray(a)||(a=[a]);for(var b=0;b<a.length;++b)delete this.features[a[b].id];this.redraw()},
redraw:function(){if(!this.locked){var a=this.root.height,b=this.root.width;this.canvas.clearRect(0,0,b,a);this.hitDetection&&this.hitContext.clearRect(0,0,b,a);var a=[],c,d,e=this.map.baseLayer&&this.map.baseLayer.wrapDateLine&&this.map.getMaxExtent(),f;for(f in this.features)if(this.features.hasOwnProperty(f))b=this.features[f][0],c=b.geometry,this.calculateFeatureDx(c.getBounds(),e),d=this.features[f][1],this.drawGeometry(c,d,b.id),d.label&&a.push([b,d]);b=0;for(c=a.length;b<c;++b)f=a[b],this.drawText(f[0].geometry.getCentroid(),
f[1])}},CLASS_NAME:"OpenLayers.Renderer.Canvas"});OpenLayers.Renderer.Canvas.LABEL_ALIGN={l:"left",r:"right",t:"top",b:"bottom"};OpenLayers.Renderer.Canvas.LABEL_FACTOR={l:0,r:-1,t:0,b:-1};OpenLayers.Renderer.Canvas.drawImageScaleFactor=null;
OpenLayers.Renderer.SVG=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"http://www.w3.org/2000/svg",xlinkns:"http://www.w3.org/1999/xlink",MAX_PIXEL:15E3,translationParameters:null,symbolMetrics:null,initialize:function(a){if(this.supported())OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments),this.translationParameters={x:0,y:0},this.symbolMetrics={}},supported:function(){return document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#SVG",
"1.1")||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"))},inValidRange:function(a,b,c){a+=c?0:this.translationParameters.x;b+=c?0:this.translationParameters.y;return a>=-this.MAX_PIXEL&&a<=this.MAX_PIXEL&&b>=-this.MAX_PIXEL&&b<=this.MAX_PIXEL},setExtent:function(a,b){var c=OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments),d=this.getResolution(),e=-a.left/d,d=a.top/d;if(b)return this.left=e,this.top=d,this.rendererRoot.setAttributeNS(null,
"viewBox","0 0 "+this.size.w+" "+this.size.h),this.translate(this.xOffset,0),!0;(e=this.translate(e-this.left+this.xOffset,d-this.top))||this.setExtent(a,!0);return c&&e},translate:function(a,b){if(this.inValidRange(a,b,!0)){var c="";if(a||b)c="translate("+a+","+b+")";this.root.setAttributeNS(null,"transform",c);this.translationParameters={x:a,y:b};return!0}return!1},setSize:function(a){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);this.rendererRoot.setAttributeNS(null,"width",this.size.w);
this.rendererRoot.setAttributeNS(null,"height",this.size.h)},getNodeType:function(a,b){var c=null;switch(a.CLASS_NAME){case "OpenLayers.Geometry.Point":c=b.externalGraphic?"image":this.isComplexSymbol(b.graphicName)?"svg":"circle";break;case "OpenLayers.Geometry.Rectangle":c="rect";break;case "OpenLayers.Geometry.LineString":c="polyline";break;case "OpenLayers.Geometry.LinearRing":c="polygon";break;case "OpenLayers.Geometry.Polygon":case "OpenLayers.Geometry.Curve":c="path"}return c},setStyle:function(a,
b,c){var b=b||a._style,c=c||a._options,d=parseFloat(a.getAttributeNS(null,"r")),e=1,f;if("OpenLayers.Geometry.Point"==a._geometryClass&&d){a.style.visibility="";if(!1===b.graphic)a.style.visibility="hidden";else if(b.externalGraphic){f=this.getPosition(a);if(b.graphicTitle)a.setAttributeNS(null,"title",b.graphicTitle),d=this.nodeFactory(null,"title"),d.textContent=b.graphicTitle,a.appendChild(d);b.graphicWidth&&b.graphicHeight&&a.setAttributeNS(null,"preserveAspectRatio","none");var d=b.graphicWidth||
b.graphicHeight,g=b.graphicHeight||b.graphicWidth,d=d?d:2*b.pointRadius,g=g?g:2*b.pointRadius,h=void 0!=b.graphicYOffset?b.graphicYOffset:-(0.5*g),i=b.graphicOpacity||b.fillOpacity;a.setAttributeNS(null,"x",(f.x+(void 0!=b.graphicXOffset?b.graphicXOffset:-(0.5*d))).toFixed());a.setAttributeNS(null,"y",(f.y+h).toFixed());a.setAttributeNS(null,"width",d);a.setAttributeNS(null,"height",g);a.setAttributeNS(this.xlinkns,"href",b.externalGraphic);a.setAttributeNS(null,"style","opacity: "+i);a.onclick=OpenLayers.Renderer.SVG.preventDefault}else if(this.isComplexSymbol(b.graphicName)){var d=
3*b.pointRadius,g=2*d,k=this.importSymbol(b.graphicName);f=this.getPosition(a);e=3*this.symbolMetrics[k.id][0]/g;h=a.parentNode;i=a.nextSibling;h&&h.removeChild(a);a.firstChild&&a.removeChild(a.firstChild);a.appendChild(k.firstChild.cloneNode(!0));a.setAttributeNS(null,"viewBox",k.getAttributeNS(null,"viewBox"));a.setAttributeNS(null,"width",g);a.setAttributeNS(null,"height",g);a.setAttributeNS(null,"x",f.x-d);a.setAttributeNS(null,"y",f.y-d);i?h.insertBefore(a,i):h&&h.appendChild(a)}else a.setAttributeNS(null,
"r",b.pointRadius);d=b.rotation;if((void 0!==d||void 0!==a._rotation)&&f)a._rotation=d,d|=0,"svg"!==a.nodeName?a.setAttributeNS(null,"transform","rotate("+d+" "+f.x+" "+f.y+")"):(f=this.symbolMetrics[k.id],a.firstChild.setAttributeNS(null,"transform","rotate("+d+" "+f[1]+" "+f[2]+")"))}c.isFilled?(a.setAttributeNS(null,"fill",b.fillColor),a.setAttributeNS(null,"fill-opacity",b.fillOpacity)):a.setAttributeNS(null,"fill","none");c.isStroked?(a.setAttributeNS(null,"stroke",b.strokeColor),a.setAttributeNS(null,
"stroke-opacity",b.strokeOpacity),a.setAttributeNS(null,"stroke-width",b.strokeWidth*e),a.setAttributeNS(null,"stroke-linecap",b.strokeLinecap||"round"),a.setAttributeNS(null,"stroke-linejoin","round"),b.strokeDashstyle&&a.setAttributeNS(null,"stroke-dasharray",this.dashStyle(b,e))):a.setAttributeNS(null,"stroke","none");b.pointerEvents&&a.setAttributeNS(null,"pointer-events",b.pointerEvents);null!=b.cursor&&a.setAttributeNS(null,"cursor",b.cursor);return a},dashStyle:function(a,b){var c=a.strokeWidth*
b,d=a.strokeDashstyle;switch(d){case "solid":return"none";case "dot":return[1,4*c].join();case "dash":return[4*c,4*c].join();case "dashdot":return[4*c,4*c,1,4*c].join();case "longdash":return[8*c,4*c].join();case "longdashdot":return[8*c,4*c,1,4*c].join();default:return OpenLayers.String.trim(d).replace(/\s+/g,",")}},createNode:function(a,b){var c=document.createElementNS(this.xmlns,a);b&&c.setAttributeNS(null,"id",b);return c},nodeTypeCompare:function(a,b){return b==a.nodeName},createRenderRoot:function(){return this.nodeFactory(this.container.id+
"_svgRoot","svg")},createRoot:function(a){return this.nodeFactory(this.container.id+a,"g")},createDefs:function(){var a=this.nodeFactory(this.container.id+"_defs","defs");this.rendererRoot.appendChild(a);return a},drawPoint:function(a,b){return this.drawCircle(a,b,1)},drawCircle:function(a,b,c){var d=this.getResolution(),e=(b.x-this.featureDx)/d+this.left,b=this.top-b.y/d;return this.inValidRange(e,b)?(a.setAttributeNS(null,"cx",e),a.setAttributeNS(null,"cy",b),a.setAttributeNS(null,"r",c),a):!1},
drawLineString:function(a,b){var c=this.getComponentsString(b.components);return c.path?(a.setAttributeNS(null,"points",c.path),c.complete?a:null):!1},drawLinearRing:function(a,b){var c=this.getComponentsString(b.components);return c.path?(a.setAttributeNS(null,"points",c.path),c.complete?a:null):!1},drawPolygon:function(a,b){for(var c="",d=!0,e=!0,f,g,h=0,i=b.components.length;h<i;h++)c+=" M",f=this.getComponentsString(b.components[h].components," "),(g=f.path)?(c+=" "+g,e=f.complete&&e):d=!1;return d?
(a.setAttributeNS(null,"d",c+" z"),a.setAttributeNS(null,"fill-rule","evenodd"),e?a:null):!1},drawRectangle:function(a,b){var c=this.getResolution(),d=(b.x-this.featureDx)/c+this.left,e=this.top-b.y/c;return this.inValidRange(d,e)?(a.setAttributeNS(null,"x",d),a.setAttributeNS(null,"y",e),a.setAttributeNS(null,"width",b.width/c),a.setAttributeNS(null,"height",b.height/c),a):!1},drawText:function(a,b,c){var d=this.getResolution(),e=(c.x-this.featureDx)/d+this.left,f=c.y/d-this.top,d=this.nodeFactory(a+
this.LABEL_ID_SUFFIX,"text");d.setAttributeNS(null,"x",e);d.setAttributeNS(null,"y",-f);b.fontColor&&d.setAttributeNS(null,"fill",b.fontColor);b.fontOpacity&&d.setAttributeNS(null,"opacity",b.fontOpacity);b.fontFamily&&d.setAttributeNS(null,"font-family",b.fontFamily);b.fontSize&&d.setAttributeNS(null,"font-size",b.fontSize);b.fontWeight&&d.setAttributeNS(null,"font-weight",b.fontWeight);b.fontStyle&&d.setAttributeNS(null,"font-style",b.fontStyle);!0===b.labelSelect?(d.setAttributeNS(null,"pointer-events",
"visible"),d._featureId=a):d.setAttributeNS(null,"pointer-events","none");f=b.labelAlign||"cm";d.setAttributeNS(null,"text-anchor",OpenLayers.Renderer.SVG.LABEL_ALIGN[f[0]]||"middle");!0===OpenLayers.IS_GECKO&&d.setAttributeNS(null,"dominant-baseline",OpenLayers.Renderer.SVG.LABEL_ALIGN[f[1]]||"central");for(var g=b.label.split("\n"),h=g.length;d.childNodes.length>h;)d.removeChild(d.lastChild);for(var i=0;i<h;i++){var k=this.nodeFactory(a+this.LABEL_ID_SUFFIX+"_tspan_"+i,"tspan");if(!0===b.labelSelect)k._featureId=
a,k._geometry=c,k._geometryClass=c.CLASS_NAME;!1===OpenLayers.IS_GECKO&&k.setAttributeNS(null,"baseline-shift",OpenLayers.Renderer.SVG.LABEL_VSHIFT[f[1]]||"-35%");k.setAttribute("x",e);if(0==i){var j=OpenLayers.Renderer.SVG.LABEL_VFACTOR[f[1]];null==j&&(j=-0.5);k.setAttribute("dy",j*(h-1)+"em")}else k.setAttribute("dy","1em");k.textContent=""===g[i]?" ":g[i];k.parentNode||d.appendChild(k)}d.parentNode||this.textRoot.appendChild(d)},getComponentsString:function(a,b){for(var c=[],d=!0,e=a.length,f=
[],g,h=0;h<e;h++)g=a[h],c.push(g),(g=this.getShortString(g))?f.push(g):(0<h&&this.getShortString(a[h-1])&&f.push(this.clipLine(a[h],a[h-1])),h<e-1&&this.getShortString(a[h+1])&&f.push(this.clipLine(a[h],a[h+1])),d=!1);return{path:f.join(b||","),complete:d}},clipLine:function(a,b){if(b.equals(a))return"";var c=this.getResolution(),d=this.MAX_PIXEL-this.translationParameters.x,e=this.MAX_PIXEL-this.translationParameters.y,f=(b.x-this.featureDx)/c+this.left,g=this.top-b.y/c,h=(a.x-this.featureDx)/c+
this.left,c=this.top-a.y/c,i;if(h<-d||h>d)i=(c-g)/(h-f),h=0>h?-d:d,c=g+(h-f)*i;if(c<-e||c>e)i=(h-f)/(c-g),c=0>c?-e:e,h=f+(c-g)*i;return h+","+c},getShortString:function(a){var b=this.getResolution(),c=(a.x-this.featureDx)/b+this.left,a=this.top-a.y/b;return this.inValidRange(c,a)?c+","+a:!1},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,c=document.getElementById(b);if(null!=c)return c;var d=OpenLayers.Renderer.symbol[a];if(!d)throw Error(a+" is not a valid symbol name");var a=this.nodeFactory(b,"symbol"),e=this.nodeFactory(null,"polygon");a.appendChild(e);for(var c=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0),f=[],g,h,i=0;i<d.length;i+=2)g=d[i],h=d[i+1],c.left=Math.min(c.left,g),c.bottom=Math.min(c.bottom,h),c.right=Math.max(c.right,g),c.top=Math.max(c.top,h),f.push(g,",",h);e.setAttributeNS(null,"points",f.join(" "));
d=c.getWidth();e=c.getHeight();a.setAttributeNS(null,"viewBox",[c.left-d,c.bottom-e,3*d,3*e].join(" "));this.symbolMetrics[b]=[Math.max(d,e),c.getCenterLonLat().lon,c.getCenterLonLat().lat];this.defs.appendChild(a);return a},getFeatureIdFromEvent:function(a){var b=OpenLayers.Renderer.Elements.prototype.getFeatureIdFromEvent.apply(this,arguments);if(!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.SVG.LABEL_VFACTOR={t:0,b:-1};OpenLayers.Renderer.SVG.preventDefault=function(a){a.preventDefault&&a.preventDefault()};
OpenLayers.Geometry.Collection=OpenLayers.Class(OpenLayers.Geometry,{components:null,componentTypes:null,initialize:function(a){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.components=[];null!=a&&this.addComponents(a)},destroy:function(){this.components.length=0;this.components=null;OpenLayers.Geometry.prototype.destroy.apply(this,arguments)},clone:function(){for(var a=eval("new "+this.CLASS_NAME+"()"),b=0,c=this.components.length;b<c;b++)a.addComponent(this.components[b].clone());
OpenLayers.Util.applyDefaults(a,this);return a},getComponentsString:function(){for(var a=[],b=0,c=this.components.length;b<c;b++)a.push(this.components[b].toShortString());return a.join(",")},calculateBounds:function(){this.bounds=null;var a=new OpenLayers.Bounds,b=this.components;if(b)for(var c=0,d=b.length;c<d;c++)a.extend(b[c].getBounds());null!=a.left&&null!=a.bottom&&null!=a.right&&null!=a.top&&this.setBounds(a)},addComponents:function(a){OpenLayers.Util.isArray(a)||(a=[a]);for(var b=0,c=a.length;b<
c;b++)this.addComponent(a[b])},addComponent:function(a,b){var c=!1;if(a&&(null==this.componentTypes||-1<OpenLayers.Util.indexOf(this.componentTypes,a.CLASS_NAME))){if(null!=b&&b<this.components.length){var c=this.components.slice(0,b),d=this.components.slice(b,this.components.length);c.push(a);this.components=c.concat(d)}else this.components.push(a);a.parent=this;this.clearBounds();c=!0}return c},removeComponents:function(a){var b=!1;OpenLayers.Util.isArray(a)||(a=[a]);for(var c=a.length-1;0<=c;--c)b=
this.removeComponent(a[c])||b;return b},removeComponent:function(a){OpenLayers.Util.removeItem(this.components,a);this.clearBounds();return!0},getLength:function(){for(var a=0,b=0,c=this.components.length;b<c;b++)a+=this.components[b].getLength();return a},getArea:function(){for(var a=0,b=0,c=this.components.length;b<c;b++)a+=this.components[b].getArea();return a},getGeodesicArea:function(a){for(var b=0,c=0,d=this.components.length;c<d;c++)b+=this.components[c].getGeodesicArea(a);return b},getCentroid:function(a){if(!a)return this.components.length&&
this.components[0].getCentroid();a=this.components.length;if(!a)return!1;for(var b=[],c=[],d=0,e=Number.MAX_VALUE,f,g=0;g<a;++g){f=this.components[g];var h=f.getArea();f=f.getCentroid(!0);!isNaN(h)&&!isNaN(f.x)&&!isNaN(f.y)&&(b.push(h),d+=h,e=h<e&&0<h?h:e,c.push(f))}a=b.length;if(0===d){for(g=0;g<a;++g)b[g]=1;d=b.length}else{for(g=0;g<a;++g)b[g]/=e;d/=e}for(var i=e=0,g=0;g<a;++g)f=c[g],h=b[g],e+=f.x*h,i+=f.y*h;return new OpenLayers.Geometry.Point(e/d,i/d)},getGeodesicLength:function(a){for(var b=
0,c=0,d=this.components.length;c<d;c++)b+=this.components[c].getGeodesicLength(a);return b},move:function(a,b){for(var c=0,d=this.components.length;c<d;c++)this.components[c].move(a,b)},rotate:function(a,b){for(var c=0,d=this.components.length;c<d;++c)this.components[c].rotate(a,b)},resize:function(a,b,c){for(var d=0;d<this.components.length;++d)this.components[d].resize(a,b,c);return this},distanceTo:function(a,b){for(var c=!(b&&!1===b.edge)&&b&&b.details,d,e,f,g=Number.POSITIVE_INFINITY,h=0,i=this.components.length;h<
i&&!(d=this.components[h].distanceTo(a,b),f=c?d.distance:d,f<g&&(g=f,e=d,0==g));++h);return e},equals:function(a){var b=!0;if(!a||!a.CLASS_NAME||this.CLASS_NAME!=a.CLASS_NAME)b=!1;else if(!OpenLayers.Util.isArray(a.components)||a.components.length!=this.components.length)b=!1;else for(var c=0,d=this.components.length;c<d;++c)if(!this.components[c].equals(a.components[c])){b=!1;break}return b},transform:function(a,b){if(a&&b){for(var c=0,d=this.components.length;c<d;c++)this.components[c].transform(a,
b);this.bounds=null}return this},intersects:function(a){for(var b=!1,c=0,d=this.components.length;c<d&&!(b=a.intersects(this.components[c]));++c);return b},getVertices:function(a){for(var b=[],c=0,d=this.components.length;c<d;++c)Array.prototype.push.apply(b,this.components[c].getVertices(a));return b},CLASS_NAME:"OpenLayers.Geometry.Collection"});
OpenLayers.Geometry.Point=OpenLayers.Class(OpenLayers.Geometry,{x:null,y:null,initialize:function(a,b){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.x=parseFloat(a);this.y=parseFloat(b)},clone:function(a){null==a&&(a=new OpenLayers.Geometry.Point(this.x,this.y));OpenLayers.Util.applyDefaults(a,this);return a},calculateBounds:function(){this.bounds=new OpenLayers.Bounds(this.x,this.y,this.x,this.y)},distanceTo:function(a,b){var c=!(b&&!1===b.edge)&&b&&b.details,d,e,f,g,h;a instanceof
OpenLayers.Geometry.Point?(e=this.x,f=this.y,g=a.x,h=a.y,d=Math.sqrt(Math.pow(e-g,2)+Math.pow(f-h,2)),d=!c?d:{x0:e,y0:f,x1:g,y1:h,distance:d}):(d=a.distanceTo(this,b),c&&(d={x0:d.x1,y0:d.y1,x1:d.x0,y1:d.y0,distance:d.distance}));return d},equals:function(a){var b=!1;null!=a&&(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){var a=
a*(Math.PI/180),c=this.distanceTo(b),d=a+Math.atan2(this.y-b.y,this.x-b.x);this.x=b.x+c*Math.cos(d);this.y=b.y+c*Math.sin(d);this.clearBounds()},getCentroid:function(){return new OpenLayers.Geometry.Point(this.x,this.y)},resize:function(a,b,c){this.x=b.x+a*(void 0==c?1:c)*(this.x-b.x);this.y=b.y+a*(this.y-b.y);this.clearBounds();return this},intersects:function(a){var b=!1;return b="OpenLayers.Geometry.Point"==a.CLASS_NAME?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"],addPoint:function(a,b){this.addComponent(a,b)},removePoint:function(a){this.removeComponent(a)},CLASS_NAME:"OpenLayers.Geometry.MultiPoint"});
OpenLayers.Layer.Google.v3={DEFAULTS:{maxExtent:new OpenLayers.Bounds(-2.003750834E7,-2.003750834E7,2.003750834E7,2.003750834E7),sphericalMercator:!0,maxResolution:156543.03390625,units:"m",projection:"EPSG:900913"},animationEnabled:!0,loadMapObject:function(){if(!this.type)this.type=google.maps.MapTypeId.ROADMAP;var a,b=OpenLayers.Layer.Google.cache[this.map.id];b?(a=b.mapObject,++b.count):(b=this.map.viewPortDiv,a=document.createElement("div"),a.id=this.map.id+"_GMapContainer",a.style.position=
"absolute",a.style.width="100%",a.style.height="100%",b.appendChild(a),b=this.map.getCenter(),a=new google.maps.Map(a,{center:b?new google.maps.LatLng(b.lat,b.lon):new google.maps.LatLng(0,0),zoom:this.map.getZoom()||0,mapTypeId:this.type,disableDefaultUI:!0,keyboardShortcuts:!1,draggable:!1,disableDoubleClickZoom:!0,scrollwheel:!1,streetViewControl:!1}),b={mapObject:a,count:1},OpenLayers.Layer.Google.cache[this.map.id]=b,this.repositionListener=google.maps.event.addListenerOnce(a,"center_changed",
OpenLayers.Function.bind(this.repositionMapElements,this)));this.mapObject=a;this.setGMapVisibility(this.visibility)},repositionMapElements:function(){google.maps.event.trigger(this.mapObject,"resize");var a=this.mapObject.getDiv().firstChild;if(!a||3>a.childNodes.length)return this.repositionTimer=window.setTimeout(OpenLayers.Function.bind(this.repositionMapElements,this),250),!1;for(var b=OpenLayers.Layer.Google.cache[this.map.id],c=this.map.viewPortDiv;"none"==a.lastChild.style.display||"gmnoscreen"==a.lastChild.className;)c.appendChild(a.lastChild);
var d=a.lastChild;c.appendChild(d);d.style.zIndex="1100";d.style.bottom="";d.className="olLayerGoogleCopyright olLayerGoogleV3";d.style.display="";b.termsOfUse=d;a=a.lastChild;c.appendChild(a);a.style.zIndex="1100";a.style.bottom="";a.className="olLayerGooglePoweredBy olLayerGoogleV3 gmnoprint";a.style.display="";b.poweredBy=a;this.setGMapVisibility(this.visibility)},onMapResize:function(){if(this.visibility)google.maps.event.trigger(this.mapObject,"resize");else{var a=OpenLayers.Layer.Google.cache[this.map.id];
if(!a.resized){var b=this;google.maps.event.addListenerOnce(this.mapObject,"tilesloaded",function(){google.maps.event.trigger(b.mapObject,"resize");b.moveTo(b.map.getCenter(),b.map.getZoom());delete a.resized})}a.resized=!0}},setGMapVisibility:function(a){var b=OpenLayers.Layer.Google.cache[this.map.id];if(b){for(var c=this.type,d=this.map.layers,e,f=d.length-1;0<=f;--f)if(e=d[f],e instanceof OpenLayers.Layer.Google&&!0===e.visibility&&!0===e.inRange){c=e.type;a=!0;break}d=this.mapObject.getDiv();
if(!0===a){this.mapObject.setMapTypeId(c);d.style.left="";if(b.termsOfUse&&b.termsOfUse.style)b.termsOfUse.style.left="",b.termsOfUse.style.display="",b.poweredBy.style.display="";b.displayed=this.id}else if(delete b.displayed,d.style.left="-9999px",b.termsOfUse&&b.termsOfUse.style)b.termsOfUse.style.display="none",b.termsOfUse.style.left="-9999px",b.poweredBy.style.display="none"}},getMapContainer:function(){return this.mapObject.getDiv()},getMapObjectBoundsFromOLBounds:function(a){var b=null;null!=
a&&(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 google.maps.LatLngBounds(new google.maps.LatLng(b.lat,b.lon),new google.maps.LatLng(a.lat,a.lon)));return b},getMapObjectLonLatFromMapObjectPixel:function(a){var b=this.map.getSize(),c=this.getLongitudeFromMapObjectLonLat(this.mapObject.center),d=this.getLatitudeFromMapObjectLonLat(this.mapObject.center),
e=this.map.getResolution(),a=new OpenLayers.LonLat(c+(a.x-b.w/2)*e,d-(a.y-b.h/2)*e);this.wrapDateLine&&(a=a.wrapDateLine(this.maxExtent));return this.getMapObjectLonLatFromLonLat(a.lon,a.lat)},getMapObjectPixelFromMapObjectLonLat:function(a){var b=this.getLongitudeFromMapObjectLonLat(a),a=this.getLatitudeFromMapObjectLonLat(a),c=this.map.getResolution(),d=this.map.getExtent(),b=new OpenLayers.Pixel(1/c*(b-d.left),1/c*(d.top-a));return this.getMapObjectPixelFromXY(b.x,b.y)},setMapObjectCenter:function(a,
b){if(!1===this.animationEnabled&&b!=this.mapObject.zoom){var c=this.getMapContainer();google.maps.event.addListenerOnce(this.mapObject,"idle",function(){c.style.visibility=""});c.style.visibility="hidden"}this.mapObject.setOptions({center:a,zoom:b})},getMapObjectZoomFromMapObjectBounds:function(a){return this.mapObject.getBoundsZoomLevel(a)},getMapObjectLonLatFromLonLat:function(a,b){var c;this.sphericalMercator?(c=this.inverseMercator(a,b),c=new google.maps.LatLng(c.lat,c.lon)):c=new google.maps.LatLng(b,
a);return c},getMapObjectPixelFromXY:function(a,b){return new google.maps.Point(a,b)},destroy:function(){this.repositionListener&&google.maps.event.removeListener(this.repositionListener);this.repositionTimer&&window.clearTimeout(this.repositionTimer);OpenLayers.Layer.Google.prototype.destroy.apply(this,arguments)}};
OpenLayers.Geometry.Curve=OpenLayers.Class(OpenLayers.Geometry.MultiPoint,{componentTypes:["OpenLayers.Geometry.Point"],getLength:function(){var a=0;if(this.components&&1<this.components.length)for(var b=1,c=this.components.length;b<c;b++)a+=this.components[b-1].distanceTo(this.components[b]);return a},getGeodesicLength:function(a){var b=this;if(a){var c=new OpenLayers.Projection("EPSG:4326");c.equals(a)||(b=this.clone().transform(a,c))}a=0;if(b.components&&1<b.components.length)for(var d,e=1,f=b.components.length;e<
f;e++)c=b.components[e-1],d=b.components[e],a+=OpenLayers.Util.distVincenty({lon:c.x,lat:c.y},{lon:d.x,lat:d.y});return 1E3*a},CLASS_NAME:"OpenLayers.Geometry.Curve"});
OpenLayers.Geometry.LineString=OpenLayers.Class(OpenLayers.Geometry.Curve,{removeComponent:function(a){var b=this.components&&2<this.components.length;b&&OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);return b},intersects:function(a){var b=!1,c=a.CLASS_NAME;if("OpenLayers.Geometry.LineString"==c||"OpenLayers.Geometry.LinearRing"==c||"OpenLayers.Geometry.Point"==c){var d=this.getSortedSegments(),a="OpenLayers.Geometry.Point"==c?[{x1:a.x,y1:a.y,x2:a.x,y2:a.y}]:a.getSortedSegments(),
e,f,g,h,i,k,j,n=0,m=d.length;a:for(;n<m;++n){c=d[n];e=c.x1;f=c.x2;g=c.y1;h=c.y2;var l=0,o=a.length;for(;l<o;++l){i=a[l];if(i.x1>f)break;if(!(i.x2<e)&&(k=i.y1,j=i.y2,!(Math.min(k,j)>Math.max(g,h))&&!(Math.max(k,j)<Math.min(g,h))&&OpenLayers.Geometry.segmentsIntersect(c,i))){b=!0;break a}}}}else b=a.intersects(this);return b},getSortedSegments:function(){for(var a=this.components.length-1,b=Array(a),c,d,e=0;e<a;++e)c=this.components[e],d=this.components[e+1],b[e]=c.x<d.x?{x1:c.x,y1:c.y,x2:d.x,y2:d.y}:
{x1:d.x,y1:d.y,x2:c.x,y2:c.y};return b.sort(function(a,b){return a.x1-b.x1})},splitWithSegment:function(a,b){for(var c=!(b&&!1===b.edge),d=b&&b.tolerance,e=[],f=this.getVertices(),g=[],h=[],i=!1,k,j,n,m={point:!0,tolerance:d},l=null,o=0,r=f.length-2;o<=r;++o)if(d=f[o],g.push(d.clone()),k=f[o+1],j={x1:d.x,y1:d.y,x2:k.x,y2:k.y},j=OpenLayers.Geometry.segmentsIntersect(a,j,m),j instanceof OpenLayers.Geometry.Point&&((n=j.x===a.x1&&j.y===a.y1||j.x===a.x2&&j.y===a.y2||j.equals(d)||j.equals(k)?!0:!1)||c))j.equals(h[h.length-
1])||h.push(j.clone()),!(0===o&&j.equals(d))&&!j.equals(k)&&(i=!0,j.equals(d)||g.push(j),e.push(new OpenLayers.Geometry.LineString(g)),g=[j.clone()]);i&&(g.push(k.clone()),e.push(new OpenLayers.Geometry.LineString(g)));if(0<h.length)var q=a.x1<a.x2?1:-1,p=a.y1<a.y2?1:-1,l={lines:e,points:h.sort(function(a,b){return q*a.x-q*b.x||p*a.y-p*b.y})};return l},split:function(a,b){var c=null,d=b&&b.mutual,e,f,g,h;if(a instanceof OpenLayers.Geometry.LineString){var i=this.getVertices(),k,j,n,m,l,o=[];g=[];
for(var r=0,q=i.length-2;r<=q;++r){k=i[r];j=i[r+1];n={x1:k.x,y1:k.y,x2:j.x,y2:j.y};h=h||[a];d&&o.push(k.clone());for(var p=0;p<h.length;++p)if(m=h[p].splitWithSegment(n,b))if(l=m.lines,0<l.length&&(l.unshift(p,1),Array.prototype.splice.apply(h,l),p+=l.length-2),d)for(var s=0,t=m.points.length;s<t;++s)l=m.points[s],l.equals(k)||(o.push(l),g.push(new OpenLayers.Geometry.LineString(o)),o=l.equals(j)?[]:[l.clone()])}d&&0<g.length&&0<o.length&&(o.push(j.clone()),g.push(new OpenLayers.Geometry.LineString(o)))}else c=
a.splitWith(this,b);h&&1<h.length?f=!0:h=[];g&&1<g.length?e=!0:g=[];if(f||e)c=d?[g,h]:h;return c},splitWith:function(a,b){return a.split(this,b)},getVertices:function(a){return!0===a?[this.components[0],this.components[this.components.length-1]]:!1===a?this.components.slice(1,this.components.length-1):this.components.slice()},distanceTo:function(a,b){var c=!(b&&!1===b.edge)&&b&&b.details,d,e={},f=Number.POSITIVE_INFINITY;if(a instanceof OpenLayers.Geometry.Point){for(var g=this.getSortedSegments(),
h=a.x,i=a.y,k,j=0,n=g.length;j<n;++j)if(k=g[j],d=OpenLayers.Geometry.distanceToSegment(a,k),d.distance<f){if(f=d.distance,e=d,0===f)break}else if(k.x2>h&&(i>k.y1&&i<k.y2||i<k.y1&&i>k.y2))break;e=c?{distance:e.distance,x0:e.x,y0:e.y,x1:h,y1:i}:e.distance}else if(a instanceof OpenLayers.Geometry.LineString){var g=this.getSortedSegments(),h=a.getSortedSegments(),m,l,o=h.length,r={point:!0},j=0,n=g.length;a:for(;j<n;++j){i=g[j];k=i.x1;l=i.y1;for(var q=0;q<o;++q)if(d=h[q],m=OpenLayers.Geometry.segmentsIntersect(i,
d,r)){f=0;e={distance:0,x0:m.x,y0:m.y,x1:m.x,y1:m.y};break a}else if(d=OpenLayers.Geometry.distanceToSegment({x:k,y:l},d),d.distance<f)f=d.distance,e={distance:f,x0:k,y0:l,x1:d.x,y1:d.y}}if(!c)e=e.distance;0!==f&&i&&(d=a.distanceTo(new OpenLayers.Geometry.Point(i.x2,i.y2),b),j=c?d.distance:d,j<f&&(e=c?{distance:f,x0:d.x1,y0:d.y1,x1:d.x0,y1:d.y0}:j))}else e=a.distanceTo(this,b),c&&(e={distance:e.distance,x0:e.x1,y0:e.y1,x1:e.x0,y1:e.y0});return e},simplify:function(a){if(this&&null!==this){var b=this.getVertices();
if(3>b.length)return this;var c=function(a,b,d,i){for(var k=0,j=0,n=b,m;n<d;n++){m=a[b];var l=a[d],o=a[n],o=Math.abs(0.5*(m.x*l.y+l.x*o.y+o.x*m.y-l.x*m.y-o.x*l.y-m.x*o.y));m=Math.sqrt(Math.pow(m.x-l.x,2)+Math.pow(m.y-l.y,2));m=2*(o/m);m>k&&(k=m,j=n)}k>i&&j!=b&&(e.push(j),c(a,b,j,i),c(a,j,d,i))},d=b.length-1,e=[];e.push(0);for(e.push(d);b[0].equals(b[d]);)d--,e.push(d);c(b,0,d,a);a=[];e.sort(function(a,b){return a-b});for(d=0;d<e.length;d++)a.push(b[e[d]]);return new OpenLayers.Geometry.LineString(a)}return this},
CLASS_NAME:"OpenLayers.Geometry.LineString"});

/*
  MTK.js -- Toursrpung MapToolkit Library

  Copyright 2008-2012 Toursrpung
*/

var a,MTK={version:"v8",language:"en",charset:"utf8",location:{loaded:false},getMap:function(b){return MTK.maps[b]},init:function(b){if(b.charset)MTK.charset=b.charset;if(b.api_key)MTK.api_key=b.api_key;if(b.language)MTK.language=b.language;return this},createMap:function(b,c,d){if(MTK.maps[b])throw"MTK already defined for div '"+b+"'";var e=jQuery("#"+b).get(0);e.style.overflow=e.style.overflow||"hidden";e.style.zIndex=e.style.zIndex||"50";MTK.resizeDiv(b,false,c.map.size);if(c.map.location.geolocation){e=
function(){jQuery.getScript("http://j.maxmind.com/app/geoip.js",function(){MTK.location.loaded=true;MTK.location.lat=geoip_latitude();MTK.location.lng=geoip_longitude();MTK.location.country=geoip_country_code().toLowerCase();var f=MTK.maps[b]=new MTK.Map(b,c);d&&d(f)},true)};navigator.userAgent.toLowerCase().match(/iphone|android|ipad/)&&navigator.geolocation?navigator.geolocation.getCurrentPosition(function(f){MTK.location.lat=f.coords.latitude;MTK.location.lng=f.coords.longitude;jQuery.getScript("http://j.maxmind.com/app/country.js",
function(){MTK.location.loaded=true;MTK.location.country=geoip_country_code().toLowerCase();var j=MTK.maps[b]=new MTK.Map(b,c);d&&d(j)},true)},e,{timeout:3E3}):e()}else{e=MTK.maps[b]=new MTK.Map(b,c);d&&d(e)}},isTouchDevice:function(){return navigator.userAgent.match(/iphone|android|ipad/i)},host:"http://mtk2.toursprung.com",itemHost:"http://mtk2.toursprung.com",staticHost:"http://static.toursprung.com",polylineHost:"http://polyline.toursprung.com",maps:{},proj:new OpenLayers.Projection("EPSG:4326"),
mapProj:new OpenLayers.Projection("EPSG:900913"),resizeDiv:function(b,c,d){b=jQuery("#"+b);if(c)b.css({position:"fixed",top:"0px",left:"0px",width:jQuery(window).width(),height:jQuery(window).height()});else{b.css({position:"relative",top:"",left:""});if(d.width&&d.height)b.css({width:d.width+"px",height:d.height+"px"});else d.offsetBottom!=null&&b.height(jQuery(window).height()-b.offset().top-d.offsetBottom)}},isIE7:function(){if(!window.navigator)return false;if(!navigator.appVersion)return false;
return navigator.appVersion.match(/MSIE 7/)},rest:function(b,c,d){jQuery.getJSONP(b,jQuery.extend({api_key:MTK.api_key+"#anonymous",token:"anonymous"},c),d)},preventDefault:function(b){b=b||window.event;if(b.preventDefault)b.preventDefault();else b.returnValue=false},stopPropagation:function(b){b=b||window.event;if(b.stopPropagation)b.stopPropagation();else b.cancelBubble=true},log:function(b){window.console?console.log(b):alert(b)}},MapToolkit=MTK;MTK.language="de";
MTK.i18n={runmap2:"Runmap Routen",oetztal_orte:"Orte",mp_aerokurier_vereine:"Vereine",runmap:"Runmap Routen","maptype hybrid short":"Hybrid",oewstate:"OEW - The Austrian 9 Regions",ubimet:"Weather (by Ubimet)",mp_reiten:"Reittouren",oetztal_huettenalmen:"H\u00fctten/Almen",oew_abcn_bestof:"ABCN - Best of Austria",wlan_hotspots:"WLAN Hotspots",wandern_com_routes:"wandern.com Routen","maptype roadmap short":"Roadmap",gqmspoi:"GQ POIs",skuhn_bikepark:"Bikepark",skuhn_hotels:"Unterk\u00fcnfte",sentres_info:"Sentres.com Info",
ls_treadly_routes:"treadly.com routes",oewarticle:"OEW - Holiday Tips",oetztal_wandern:"Wandern",cmt_poi:"CheckMyTour POIs",mp_motorrad_shell:"Shell-Tankstellen",oetztal_gipfelaussicht:"Gipfel/Aussichtsberge",mp_mountainbike:"Mountainbiketouren",tiscover:"Tiscover Hotels","maptype terrain":"Terrain",mp_laufstrecken:"Laufstrecken",oewlandingpages:"OEW - Landingpages",weather:"Wetter",oewbestof:"OEW - Best of Austria","maptype terrain short":"Terrain",mp_wandern:"Wandertouren",oewkulinarikblog:"OEW - Kulinarik Blog",
bikemap2:"Bikemap Routen",wandermap2:"Wandermap Routen",oewwanderdoerfer:"OEW - Wanderdorfrouten",mp_promobil:"Prombil-Stellpl\u00e4tze",oewstuff:"OEW - Redaktionelle POIs",inlinemap2:"Inlinemap Routen",rh_hotels:"Hotel",skuhn_tourist_info:"Tourist-Information",skuhn_bikeshop:"Bikeshop / -verleih",wandermap:"Wandermap Routen",oetztal_wegpunkte:"Wegpunkte",wandern_com_destination:"Ausflugsziele",biketrap:"Radfalle.de",wetter_com:"Weather (by Wetter.com)",rh_winzer:"Weingut/Winzer",bikemap:"Bikemap Routen",
eybl_routes:"Eybl Routes",oew_brochure2:"OEW - Br. f. States",skuhn_bustop:"BusTOP europe",skuhn_alpenhuetten:"Alpenh\u00fctten",oew_bestof_gastronomie:"OEW - food & drink",mp_motorrad_filialen:"Louis-Shops","maptype roadmap":"Roadmap",oewads:"OEW - Holiday Offers",motorpresse:"Motorpresse.de",wandern_com_pois:"wandern.com POIs",biodiesel:"Biodiesel Tankstellen",panoramio:"Panoramio Fotos",rh_appartements:"Ferienwohnung",oetztal_bergseen:"Bergseen",oew_abcn_venues:"ABCN - Venues",oewbrochure:"OEW - Brochures",
gqmsbounds:"GQ Strassen",wandern_com_gastronomy:"Restaurants",skuhn_alpenpaesse:"Alpenp\u00e4sse",cmt_route:"CheckMyTour Routes","maptype satellite short":"Satellite",mp_tourwerk:"Tourwerk",oewiski:"OEW - ISki",oew_bestof_unterkuenfte:"OEW - Accommodation",mopedmap:"Mopedmap Routen",sentres_pois:"Sentres.com POIs",eybl_pois:"Eybl POIs",mtbmagazin:"MTB-magazin.de","maptype hybrid":"Hybrid",oew_bestof_kultur:"OEW - Culture",mp_tourentipps:"Tourentipps",mp_motorrad_vartaguide:"Hotels",mp_motorrad:"Motorrad",
wr_routes:"Weisser Riese Routes",freewave:"Freewave Hotspots",mp_rennrad:"Rennradtouren",gqprojects:"GQ Projecte","maptype satellite":"Satellite",ns_tour:"TMN Tour",jugendherbergen:"Jugendherbergen",oetztal_rad:"Rad",ns_fahrradvermieter:"TMN Fahrrad Vermieter",skuhn_bikespot:"Bikespot",gqmsarea:"GQ Bezirke",oewknowhow:"OEW - Wissensbasis",suncompany:"Sun Company",ns_addressbase:"TMN Addressbase",wikipedia:"Wikipedia Artikel",mp_laufevents:"Laufevents (Filter unten)",ns_cmsarticle:"TMN CMSArticle",
oetztal_webcams:"Webcams",skuhn_alpenvereinshuette:"Alpenvereinsh\u00fctte",sentres_routes:"Sentres.com Routes",sentres_photo:"Sentres.com Photos",mapdata:"Kartendaten ",mopedmap2:"Mopedmap Routen",oew_media:"OEW - Media",mp_motorrad_haendler:"Motorradh\u00e4ndler",oew_winzer:"OEW - Winzer",mp_kletterhallen:"Kletterhallen",oew_bestof_erlebnisse:"OEW - Experiences",wandern_com_tour:"Wandertouren",more:"Mehr",wlanmap:"wlanmap.com",mp_reisereportagen:"Reise Reportagen",mp_stellplatz:"<i>promobil</i>-Stellpl\u00e4tze",
skuhn_campingplatz:"Campingplatz",oew_abcn_article:"ABCN - Our Top Picks",servustv_pois:"ServusTV POIs",clusters_naming:"Eintr\u00e4ge",mp_tourwerk_test:"Tourwerk Test",oew_abcn_brochure:"ABCN - Brochures",bauernbund:"Bauernbund-B\u00fcros",inlinemap:"Inlinemap Routen",rh_infoseiten:"Infoseiten",wr_pois:"Weisser Riese POIs",oetztal_regionen:"Regionen",mp_motorrad_test:"Motorrad Test",skuhn_touren:"Touren & Trails",flickr:"Flickr Fotos",ns_eventlocation:"TMN Eventlocation",workshop:"Werkst\u00e4tten (nur de)",
bestfewo:"Ferienwohnungen (nur de)",wandern_com_accommodation:"Quartiere",oetztal_sportfun:"Sport/Fun","no geolocation available":"No geolocation Service available",mp_motorrad_bikertreffs:"Bikertreffs",skuhn_bergbahn:"Bergbahn",qype:"qype.com",wandern_com_city:"Orte",servustv_routes:"ServusTV Routes",oetztal_kulturelles:"Sehenswertes/Kulturelles",wandern_com_housing:"Gastgeber",oew_abcn_brochure2:"ABCN - Br. f. States",mp_klettern:"Klettertouren",lovo:"Lovo.cc",webcams:"Webcams",ns_offer:"TMN Offer"};jQuery.extend({getScript:function(b,c,d){jQuery.ajax({url:b,success:c,dataType:"script",cache:d||false})},getJSONP:function(b,c,d,e,f){jQuery.ajax({url:b,data:c,success:d,error:f,dataType:"jsonp",crossDomain:true,cache:e||false})},getCSS:function(b){jQuery("link").appendTo("head").attr({rel:"stylesheet",type:"text/css",href:b})},keys:function(b){var c=[];for(var d in b)c.push(d);return c},quoteString:function(b){var c=/["\\\x00-\x1f\x7f-\x9f]/g;meta={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f",
"\r":"\\r",'"':'\\"',"\\":"\\\\"};if(b.match(c))return'"'+b.replace(c,function(d){var e=meta[d];if(typeof e==="string")return e;e=d.charCodeAt();return"\\u00"+Math.floor(e/16).toString(16)+(e%16).toString(16)})+'"';return'"'+b+'"'},toJSON:function(b){var c=typeof b;if(b===null)return"null";if(c!="undefined"){if(c=="number"||c=="boolean")return b+"";if(c=="string")return jQuery.quoteString(b);if(c=="object")if(b.__toJSON)return b.__toJSON();else if(b.constructor===Array){for(var d=[],e=0;e<b.length;e++)d.push(jQuery.toJSON(b[e])||
"null");return"["+d.join(",")+"]"}else{d=[];for(e in b){c=typeof e;if(c=="number")c='"'+e+'"';else if(c=="string")c=jQuery.quoteString(e);else continue;if(typeof b[e]!="function"){var f=jQuery.toJSON(b[e]);d.push(c+":"+f)}}return"{"+d.join(",")+"}"}}},processTemplate:function(b,c){return b.replace(/\$\{(\w+)\}/g,function(){return c[RegExp.$1]})}});
function $P(b,c){if(b instanceof OpenLayers.LonLat)return b;if(b!=null&&c!=null)return(new OpenLayers.LonLat(c,b)).transform(MTK.proj,MTK.mapProj);if(typeof b=="object"){if(b[0]!=null&&b[1]!=null)return $P(b[0],b[1]);if(b.lat!=null&&b.lng!=null)return $P(b.lat,b.lng)}throw"invalid argument to $P "+b+", "+c;}function $B(b){if(b.north!=null)return(new OpenLayers.Bounds(b.west,b.south,b.east,b.north)).transform(MTK.proj,MTK.mapProj)}
OpenLayers.LonLat.prototype.t=function(){return this.transform(MTK.mapProj,MTK.proj)};OpenLayers.LonLat.prototype.distanceFrom=function(b){var c=this.clone().t(),d=b.clone().t();b=c.lat;var e=d.lat,f=(e-b)*Math.PI/180;c=(d.lon-c.lon)*Math.PI/180;c=Math.sin(f/2)*Math.sin(f/2)+Math.cos(b*Math.PI/180)*Math.cos(e*Math.PI/180)*Math.sin(c/2)*Math.sin(c/2);return 6371E3*2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c))};MTK.event={id:0,events:{},addListener:function(b,c,d){b.__mtk_events=b.__mtk_events||{};b.__mtk_events[++this.id]=[c,d];this.events[this.id]=b;return this.id},trigger:function(b,c,d,e,f){if(b.__mtk_events)for(var j in b.__mtk_events)b.__mtk_events[j][0]==c&&b.__mtk_events[j][1](d,e,f)},clearInstanceListeners:function(b){for(var c in b.__mtk_events)delete this.events[c];b.__mtk_events=null},removeListener:function(b){this.events[b]&&this.events[b].__mtk_events&&delete this.events[b].__mtk_events[b];
delete this.events[b]}};MTK.Search={requestId:0,timeout:null,weights:false,createJobs:function(b){for(var c=[],d=false,e=MTK.isIE7()?50:200;!d;){d=true;var f={},j=0;for(var i in b)if(j+b[i].length>e){var u=e-j;j+=u;if(u>=b[i].length)u=b[i].length-1;f[i]=b[i].splice(0,u)}else{f[i]=b[i];j+=b[i].length;delete b[i]}c.push(f);for(i in b)d=false}return c},convertTile:function(b){for(var c={resource:b.shift(),x:b.shift(),y:b.shift(),key:b.shift(),lat:parseFloat(b.shift()),lng:parseFloat(b.shift()),north:parseFloat(b.shift()),east:parseFloat(b.shift()),
south:parseFloat(b.shift()),west:parseFloat(b.shift()),time:parseInt(b.shift()),async:parseInt(b.shift()),count:parseInt(b.shift()),items:[]};b.length;)c.items.push({lat:parseFloat(b.shift()),lng:parseFloat(b.shift()),id:b.shift(),remoteid:b.shift(),resource:c.resource});c.xy=[c.x,c.y].join(",");c.id=[c.resource,c.x,c.y,c.key].join(",");return c},tiles:function(b){var c=this,d=++this.requestId;this.timeout&&clearTimeout(this.timeout);this.timeout=setTimeout(function(){var e={};jQuery.each(b.resources,
function(u,m){e[u]=m.filter&&m.filter.ids||[]});var f,j=c.createJobs(e),i=function(u){var m={},q=b.map.map.getExtent().transform(MTK.mapProj,MTK.proj);jQuery.each(b.resources,function(n){m[n]=b.resources[n];m[n].filter.ids=u[n].length?u[n]:null});jQuery.getJSONP(MapToolkit.itemHost+"/tiles.json",{version:MTK.version,charset:MTK.charset,api_key:MTK.api_key,weights:MTK.Search.weights?1:1,language:MTK.language,request_id:d,resources:jQuery.toJSON(m),zoom:b.map.map.getZoom(),south:q.bottom,west:q.left,
num_x:parseInt(b.map.size.width/128)+2,num_y:parseInt(b.map.size.height/128)+2},function(n){for(var k={},h=0;h<n.tiles.length;h++){var p=MTK.Search.convertTile(n.tiles[h]);k[p.id]=p}n.tiles=k;if(f){for(h in n.tiles)if(f.tiles[h]){k=f.tiles[h];p=n.tiles[h];k.count+=p.count;k.items=k.items.concat(p.items);if(p.north>k.north)k.north=p.north;if(p.east>k.east)k.east=p.east;if(p.south<k.south)k.south=p.south;if(p.west<k.west)k.west=p.west}else f.tiles[h]=n.tiles[h];for(h in n.weights)if(f.weights[h]){f.weights[h][0]=
(f.weights[h][0]||0)+(n.weights[h][0]||0);f.weights[h][1]=(f.weights[h][1]||0)+(n.weights[h][1]||0);f.weights[h][2]=(f.weights[h][2]||0)+(n.weights[h][2]||0);f.weights[h][3]=(f.weights[h][3]||0)+(n.weights[h][3]||0)}else f.weights[h]=n.weights[h];for(h in n.clusters)f.clusters[h]=f.clusters[h]?f.clusters[h].concat(n.clusters[h]):n.clusters[h];for(h in n.icons)f.icons[h]=n.icons[h]}else f=n;if(j.length)i(j.shift());else{k=[];for(h in f.tiles)k.push(f.tiles[h]);f.tiles=k;b.callback(f)}})};i(j.shift())},
200)},items:function(b){var c=b.map.config,d={},e={},f=this.requestId;for(var j in c.resources){if(c.resources[j].template)d[j]=c.resources[j].template;if(c.resources[j].templates)e[j]=c.resources[j].templates}var i={icons:{},items:[]},u=this.createJobs(b.ids),m=function(q){jQuery.getJSONP(MTK.itemHost+"/items.json",{version:MTK.version,api_key:MTK.api_key,charset:MTK.charset,language:MTK.language,request_id:f,nocache:b.map.config.nocache?1:0,template:jQuery.toJSON(d),templates:jQuery.toJSON(e),ids:jQuery.toJSON(q),
static_map_v3:b.staticMap?jQuery.toJSON(b.staticMap):""},function(n){if(n.items){for(var k=0;k<n.items.length;k++){for(var h=n.items[k],p={_default:h.details.length&&h.details[0][1]},y=0;y<h.details.length;y++)p[h.details[y][0]]=h.details[y][1];h.details=p}for(k in n.icons)i.icons[k]=n.icons[k];i={icons:i.icons,requestId:n.requestId,items:i.items.concat(n.items)};u.length?m(u.shift()):b.callback(i)}})};m(u.shift())},aroundMe:function(b){jQuery.getJSONP(MTK.itemHost+"/tiles.json",{version:MTK.version,
charset:MTK.charset,api_key:MTK.api_key,language:MTK.language,resources:jQuery.toJSON(b.resources),south:b.latLng.lat()-10/111,west:b.latLng.lng()-10/Math.abs(Math.cos(b.latLng.lng()*Math.PI/180))/111,zoom:14,num_x:16,num_y:16},function(c){if(c.tiles){var d={};jQuery.each(c.tiles,function(f,j){j=MTK.Search.convertTile(j);jQuery.each(j.items,function(i,u){u.distance=b.latLng.distanceFrom($P(u))});d[j.resource]=(d[j.resource]||[]).concat(j.items)});for(var e in d)d[e]=d[e].sort(function(f,j){return f.distance-
j.distance});b.callback&&b.callback(d)}})},ids:function(b){for(var c={ids:{}},d=this.createJobs(b.ids),e=0;e<d.length;e++)for(var f in d[e])d[e][f]={ids:d[e][f]};var j=function(i){jQuery.getJSONP(MTK.itemHost+"/ids.json",{ids:jQuery.toJSON(i),api_key:MTK.api_key},function(u){jQuery.each(u.ids,function(m){c.ids[m]=c.ids[m]||{};jQuery.each(u.ids[m],function(q){c.ids[m][q]=u.ids[m][q]})});d.length?j(d.shift()):b.callback(c)})};j(d.shift())}};MTK.Icon=function(b){b=b||{url:"http://static.toursprung.com/images/marker/iphone.png",size:[14,26],anchor:[7,26]};var c=b.image||b.url;if(MTK.Icon.icons[c])return MTK.Icon.icons[c];var d=b.iconSize||b.size,e=b.iconAnchor||b.anchor;this.url=c;this.size={width:d[0],height:d[1]};this.offset=b.offset||{x:0,y:0};this.anchor=e?{x:e[0],y:e[1]}:{x:parseInt(e[0])/2,y:e[1]};this.title=b.title;this.__toJSON=function(){return jQuery.toJSON(b)};return MTK.Icon.icons[b.url]=this};
MTK.Shadow=function(b){if(b&&b.shadow)return new MTK.Icon({url:b.shadow,size:b.shadowSize,anchor:b.shadowAnchor||b.iconAnchor})};MTK.Icon.icons={};MTK.Icon.Options={url:null,size:null,anchor:null,offset:null};MTK.Panes=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:false,moveTo:function(){OpenLayers.Layer.prototype.moveTo.apply(this,arguments)},CLASS_NAME:"MTK.Panes"});MTK.Panes.overlayShadow=OpenLayers.Class(MTK.Panes,{isBaseLayer:false,CLASS_NAME:"MTK.Panes.overlayShadow"});MTK.Panes.overlayImage=OpenLayers.Class(MTK.Panes,{isBaseLayer:false,CLASS_NAME:"MTK.Panes.overlayImage"});MTK.Panes.floatShadow=OpenLayers.Class(MTK.Panes,{isBaseLayer:false,CLASS_NAME:"MTK.Panes.floatShadow"});
MTK.Panes.floatPane=OpenLayers.Class(MTK.Panes,{isBaseLayer:false,CLASS_NAME:"MTK.Panes.floatPane"});MTK.MapTypeId={OSM:"osm",google:{TERRAIN:"terrain",ROADMAP:"roadmap",HYBRID:"hybrid",SATELLITE:"satellite"},test:{SUEDTIROL:"suedtirol",LINZ:"linz",SCHLADMING:"schladming",ZELL:"zell",ISTANBUL:"istanbul",TOURSPRUNG:"toursprung"}};
MTK.TileServers=function(b){return["http://tile0.maptoolkit.net/"+b+"/${z}/${x}/${y}.png","http://tile1.maptoolkit.net/"+b+"/${z}/${x}/${y}.png","http://tile2.maptoolkit.net/"+b+"/${z}/${x}/${y}.png","http://tile3.maptoolkit.net/"+b+"/${z}/${x}/${y}.png","http://tile4.maptoolkit.net/"+b+"/${z}/${x}/${y}.png","http://tile5.maptoolkit.net/"+b+"/${z}/${x}/${y}.png","http://tile6.maptoolkit.net/"+b+"/${z}/${x}/${y}.png","http://tile7.maptoolkit.net/"+b+"/${z}/${x}/${y}.png","http://tile8.maptoolkit.net/"+
b+"/${z}/${x}/${y}.png","http://tile9.maptoolkit.net/"+b+"/${z}/${x}/${y}.png"]};
MTK.MapType={osm:function(){return new OpenLayers.Layer.OSM("OSM Map")},terrain:function(){return new OpenLayers.Layer.Google("Google Physical",{type:google.maps.MapTypeId.TERRAIN,numZoomLevels:15})},roadmap:function(){return new OpenLayers.Layer.Google("Google Streets",{type:google.maps.MapTypeId.ROADMAP,numZoomLevels:18})},hybrid:function(){return new OpenLayers.Layer.Google("Google Hybrid",{type:google.maps.MapTypeId.HYBRID,numZoomLevels:19})},satellite:function(){return new OpenLayers.Layer.Google("Google Satellite",
{type:google.maps.MapTypeId.SATELLITE,numZoomLevels:19})},suedtirol:function(){return new OpenLayers.Layer.XYZ("suedtirol","http://www.ancalime.de/download/render-toursprung/suedtirol/${z}/${x}/${y}.png",{sphericalMercator:true,numZoomLevels:17,wrapDateLine:true,attribution:"Map \u00a9 <a href='http://www.toursprung.com'>Toursprung GmbH</a> - Data: <a href='http://www.openstreetmap.org'>OSM</a> <a href='http://creativecommons.org/licenses/by-sa/2.0'>CC-BY-SA</a>"})},linz:function(){return new OpenLayers.Layer.XYZ("linz",
"http://www.ancalime.de/download/render-toursprung/linz/${z}/${x}/${y}.png",{sphericalMercator:true,numZoomLevels:17,wrapDateLine:true,attribution:"Map \u00a9 <a href='http://www.toursprung.com'>Toursprung GmbH</a> - Data: <a href='http://www.openstreetmap.org'>OSM</a> <a href='http://creativecommons.org/licenses/by-sa/2.0'>CC-BY-SA</a>"})},schladming:function(){return new OpenLayers.Layer.XYZ("schladming","http://www.ancalime.de/download/render-toursprung/schladming/${z}/${x}/${y}.png",{sphericalMercator:true,
numZoomLevels:17,wrapDateLine:true,attribution:"Map \u00a9 <a href='http://www.toursprung.com'>Toursprung GmbH</a> - Data: <a href='http://www.openstreetmap.org'>OSM</a> <a href='http://creativecommons.org/licenses/by-sa/2.0'>CC-BY-SA</a>"})},zell:function(){return new OpenLayers.Layer.XYZ("zell","http://www.ancalime.de/download/render-toursprung/zell/${z}/${x}/${y}.png",{sphericalMercator:true,numZoomLevels:17,wrapDateLine:true,attribution:"Map \u00a9 <a href='http://www.toursprung.com'>Toursprung GmbH</a> - Data: <a href='http://www.openstreetmap.org'>OSM</a> <a href='http://creativecommons.org/licenses/by-sa/2.0'>CC-BY-SA</a>"})},
istanbul:function(){return new OpenLayers.Layer.XYZ("istanbul","http://www.ancalime.de/download/render-toursprung/istanbul/${z}/${x}/${y}.png",{sphericalMercator:true,numZoomLevels:17,wrapDateLine:true,attribution:"Map \u00a9 <a href='http://www.toursprung.com'>Toursprung GmbH</a> - Data: <a href='http://www.openstreetmap.org'>OSM</a> <a href='http://creativecommons.org/licenses/by-sa/2.0'>CC-BY-SA</a>"})},toursprung:function(){return new OpenLayers.Layer.XYZ("toursprung",MTK.TileServers("karwendel"),
{sphericalMercator:true,numZoomLevels:18,wrapDateLine:true,attribution:"Map \u00a9 <a href='http://www.toursprung.com'>Toursprung GmbH</a> - Data: <a href='http://www.openstreetmap.org'>OSM</a> <a href='http://creativecommons.org/licenses/by-sa/2.0'>CC-BY-SA</a>"})}};MTK.Map=function(b,c){var d=this,e,f,j=location.hash=="#"?"":location.hash,i={visible:{},pending:{},objs:{}},u,m={},q={},n=null,k=false,h={},p=null;h={};var y,G={},I={},l=[],w=c.clusters&&c.clusters.threshold?c.clusters.threshold:10,H=c.clusters&&c.clusters.className?c.clusters.className:MTK.Cluster;c.clusters&&delete c.clusters.className;H&&H.init&&H.init();var F=function(g){if(g.id){if(!g.id.toString().match(/^remote_/))return g.id;I[g.resource]=I[g.resource]||{};return I[g.resource][g.id]}},N=
function(){var g=jQuery.map(jQuery.keys(G),function(r){return G[r].id});if(g.length){var o=MTK.Search.requestId;jQuery.getJSONP(MTK.itemHost+"/async.json",{api_key:MTK.api_key,version:MTK.version,tileIds:jQuery.toJSON(g)},function(r){r=jQuery.map(r.tiles,function(x){x=MTK.Search.convertTile(x);if(G[x.id]&&!x.async){delete G[x.id];if(x.count)return x}});if(r.length){for(var C in i.visible)i.pending[C]=i.visible[C];ba(r,{},o)}y=jQuery.keys(G).length?setTimeout(N,3E3):null})}},W=function(g){var o=g.id+
","+g.count;if(i.visible[o])i.pending[o]=i.visible[o];else{g=new H(jQuery.extend(g,c.clusters||{}));i.pending[o]=g}},O=function(g){var o=F(g);if(o)if(i.visible[o]&&!o.toString().match(/^tmp_/))i.pending[o]=i.visible[o];else i.pending[o]||(i.pending[o]={params:g})},ca=function(){for(var g in c.resources)for(var o=c.resources[g].ids||[],r=0;r<o.length;r++)O({resource:g,id:o[r]})},Z=function(g,o){for(var r in i.visible)if(i.pending[r]&&!r.toString().match(/^tmp_/))delete i.pending[r];else{i.visible[r].hideDetails&&
i.visible[r].hideDetails();i.visible[r].setMap&&i.visible[r].setMap(null);delete i.visible[r]}var C=[];for(r in i.pending){var x=i.visible[r]=i.pending[r];x instanceof MTK.OverlayView?x.setMap(d):C.push(x)}if(C.length){x={};for(r=0;r<C.length;r++){var v=C[r],D=C[r].params.resource;x[D]=x[D]||[];x[D].push(v.params.id)}oa(x,g,o)}else o&&o();i.pending={}},oa=function(g,o,r){MTK.Search.items({map:d,ids:g,callback:function(C){if(!(o<MTK.Search.requestId)){for(var x=e.getExtent(),v=[[]],D=0;D<C.items.length;D++){v[v.length-
1].length>50&&v.push([]);v[v.length-1].push(C.items[D])}var A=function(E){if(E.length){var L=E.shift();for(J=0;J<L.length;J++){var B=L[J],t=i.visible[B.id]||i.visible["tmp_"+B.id];if(t){var s=c.resources[t.params.resource];t=t.params;var K=jQuery.extend({href:B.href,opacity:s.opacity,handleClick:s.handleInfoWindowClick,text:B.details[s.template]||B.details._default},s.details||{}),P=typeof s.title=="function"?s.title(B):s.title?B.description:null;if(B.type=="route"&&s.renderAs=="kml")t=new MTK.Kml(jQuery.extend({item:B,
params:t},s,{details:K}));else if(B.type=="route"&&s.renderAs=="polyline"){if(s.styleI==null)s.styleI=0;P=jQuery.isArray(s.style)?s.style[s.styleI%s.style.length]:s.style;t=new MTK.Polyline(jQuery.extend({item:B,params:t},s,{style:P,details:K}));s.styleI++}else if(B.type=="cluster")t=new MTK.Polygon(jQuery.extend({item:B,params:t},s,{details:K}));else{try{var S=$P(t)}catch(Y){S=$P(B)}if(!x.containsLonLat(S))continue;var T=jQuery.isFunction(s.icon)?s.icon(B,d):s.icon,U=jQuery.isFunction(s.shadow)?
s.shadow(B,d):s.shadow;T=new MTK.Icon(T||B.icon||C.icons[t.resource]);U=U?new MTK.Icon(U):MTK.Shadow(B.icon||C.icons[t.resource]);t=new MTK.Marker(jQuery.extend({position:S,item:B,params:t},s,{icon:T,shadow:U,details:K,title:P}))}if(!(s.onrender&&s.onrender(t)==false)){t.setMap(d);i.visible[B.id]=t;MTK.event.addListener(t,"click",function(z,R){_preventDefault=true;z.preventDefault=function(){_preventDefault=false};MTK.event.trigger(d,"overlayClicked",z,R);if(_preventDefault)if(MTK.isTouchDevice())d.bunchMarkers.expand(z)||
z.showDetails(R);else z.showDetails(R)});t._noRouteOnMouseOver=s.noRouteOnMouseOver;MTK.event.addListener(t,"mouseover",function(z){if(h.timeout){clearTimeout(h.timeout);try{h.polyline.setMap(null)}catch(R){}h={}}if(!z._noRouteOnMouseOver&&z.item.type=="route")h.timeout=setTimeout(function(){h.polyline=new MTK.Polyline.newWithId({id:z.item.id,map:d})},350);MTK.event.trigger(d,"overlayMouseOver",z)});MTK.event.addListener(t,"mouseout",function(z){if(h.timeout){clearTimeout(h.timeout);try{h.polyline.setMap(null)}catch(R){}h=
{}}MTK.event.trigger(d,"overlayMouseOut",z)})}}}setTimeout(function(){A(E)},10)}else{for(var J in i.visible)i.visible[J]instanceof MTK.OverlayView||delete i.visible[J];r&&r(C)}};A(v)}}})},ba=function(g,o,r,C){for(var x={},v=[],D=0;D<g.length;D++){var A=g[D];if(e.getZoom()<15&&c.resources[A.resource].clusters){A.isClustered=true;x[A.xy]=x[A.xy]||[];x[A.xy].push(A)}else v.push([A])}for(D in x)v.push(x[D]);g=[[]];for(D=0;D<v.length;D++){g[g.length-1].length>5&&g.push([]);g[g.length-1].push(v[D])}var E=
function(L){if(!(r<MTK.Search.requestId))if(L.length){for(var B=L.shift(),t=0;t<B.length;t++){for(var s=B[t],K=0,P=-999,S=-999,Y=999,T=999,U=[0,0,0,0],J=0;J<s.length;J++){var z=s[J],R=z.resource+","+z.xy;K+=z.count;if(z.north>P)P=z.north;if(z.east>S)S=z.east;if(z.south<Y)Y=z.south;if(z.west<T)T=z.west;for(z=0;z<4;z++)U[z]+=parseInt(o[R]&&o[R][z])||0}if(s[0].isClustered&&K>=w)W({id:s[0].xy,count:K,lat:s[0].lat,lng:s[0].lng,north:P,east:S,south:Y,west:T,weights:U});else for(J=0;J<s.length;J++){z=s[J];
K=z.items;if((P=c.resources[z.resource].markerLimitPerTile)&&K.length>P)K=K.splice(0,P);for(z=0;z<K.length;z++)O(K[z])}}setTimeout(function(){E(L)},10)}else Z(r,C)};E(g)},da=function(){if(location.hash.length<2)return null;for(var g={},o=location.hash.substr(1).split("&"),r=0;r<o.length;r++){var C=o[r];if(C.match(/^(.+?)=(\d+)$/))g[RegExp.$1]=parseInt(RegExp.$2);else if(C.match(/^(.+?)=(\d+\.\d+)$/))g[RegExp.$1]=parseFloat(RegExp.$2);else if(C.match(/^(.+?)=(.*)$/))g[RegExp.$1]=decodeURIComponent(RegExp.$2)}return g},
ea=function(g){var o=[];for(var r in g)o.push(encodeURIComponent(r)+"="+encodeURIComponent(g[r]));g=o.length?"#"+o.join("&"):"";if(j!=g)location.hash=j=g},fa=function(){var g=location.hash=="#"?"":location.hash;if(j!=g){j=g;g=da()||f;e.setCenter($P(g));e.zoomTo(g.zoom);d.setMapTypeId(g.maptype)}setTimeout(function(){fa()},500)},ga=function(){var g=e.getCenter().clone().t();return{lat:g.lat,lng:g.lon,zoom:e.zoom,maptype:d.getMapTypeId()}},ha=function(){if(c.map.locationHash){var g=ga();g.lat==f.lat&&
g.lng==f.lng&&g.zoom==f.zoom&&g.maptype==f.maptype?ea({}):ea(ga())}};d.map=d.gmap=e;d.config=c;d.div=b;d.isFullscreen=false;d.size={};d.getOverlays=function(){var g=[];for(var o in i.visible)g.push(i.visible[o]);return g};d.getOverlayById=function(g,o){return(o=F({resource:g,id:o}))&&i.visible[o]};d.reset=function(){for(var g in c.resources)c.resources[g].styleI=null;i.pending={};MTK.Search.requestId++;Z();d.infoWindow.hide();h.timeout&&clearTimeout(h.timeout);try{h.polyline.setMap(null)}catch(o){}h=
{}};d.openHref=function(g){location.href=g};d.setMapTypeId=function(g){u=g;e.setBaseLayer(m[g])};d.getMapTypeId=function(){return u};d.refresh=function(g){var o={},r=false;for(var C in c.resources){var x=c.resources[C],v=[];if(x.ids)for(var D=0;D<x.ids.length;D++){var A=x.ids[D];A&&A.toString().match(/^remote_/)&&!F({resource:C,id:A})&&v.push(A)}if(x.filter&&x.filter.ids)for(D=0;D<x.filter.ids.length;D++)(A=x.filter.ids[D])&&A.toString().match(/^remote_/)&&!F({resource:C,id:A})&&v.push(A);if(v.length)r=
true;if(v.length)o[C]=jQuery.map(v,function(E){return E})}r?MTK.Search.ids({ids:o,callback:function(E){I=E.ids;for(var L in c.resources){E=c.resources[L];if(E.ids){for(var B=[],t=0;t<E.ids.length;t++){var s=F({resource:L,id:E.ids[t]});s&&B.push(s)}E.ids=B}if(E.filter&&E.filter.ids){B=[];for(t=0;t<E.filter.ids.length;t++)(s=F({resource:L,id:E.filter.ids[t]}))&&B.push(s);E.filter.ids=B}}d._refresh(g)}}):d._refresh(g)};d._refresh=function(g){MTK.event.trigger(d,"beforeRefesh");var o={};for(var r in c.resources){var C=
e.zoom,x=c.resources[r];if((x.show==undefined||x.show=="all")&&(!x.zoom||x.zoom[0]<=C&&x.zoom[1]>=C))o[r]={filter:x.filter||{},clusters:x.clusters||false}}MTK.Search.tiles({map:d,resources:o,callback:function(v){if(v.status==403)return alert("invalid MTK api_key for host "+location.hostname);if(MTK.Search.requestId==v.requestId){q={};G={};for(var D=e.getExtent(),A=0;A<v.tiles.length;A++){for(var E=v.tiles[A],L=q[E.resource]=q[E.resource]||{count:0,items:[]},B=0,t=0;t<E.items.length;t++)if(D.containsLonLat($P(E.items[t]))){B++;
L.items.push(E.items[t])}L.count+=D.intersectsBounds($B(E))?E.count:B}if(!v.tiles.length&&!jQuery.keys(v.clusters).length){i.pending={};ca();Z();MTK.event.trigger(d,"refreshDone",q,v,{});g&&g(jQuery.keys(v.icons))}else{for(A=0;A<v.tiles.length;A++)if(v.tiles[A].async)G[v.tiles[A].id]=v.tiles[A];if(jQuery.keys(G).length&&!y)y=setTimeout(N,3E3);ca();for(A in v.clusters)for(t=0;t<v.clusters[A].length;t++)O({resource:A,id:v.clusters[A][t]});ba(v.tiles,v.weights,v.requestId,function(s){MTK.event.trigger(d,
"refreshDone",q,v,s||{});g&&g(jQuery.keys(v.icons))})}MTK.event.trigger(d,"refresh",q,v)}else g&&g(jQuery.keys(v.icons))}})};d.setFullscreen=function(g){d.isFullscreen=g;d.resize("force");MTK.event.trigger(d,"setFullscreen",g)};d.resize=function(g){if(!(!g&&c.map.size.offsetBottom==null&&!d.isFullscreen)){g=jQuery("#"+b);if(g.is(":visible")){MTK.resizeDiv(b,d.isFullscreen,c.map.size);d.size.width=g.width();d.size.height=g.height();setTimeout(function(){e.updateSize();for(var o in i.objs)i.objs[o].draw();
MTK.event.trigger(d,"resize")},1)}}};d.updateResource=function(g,o,r){if(c.resources[g].show!="ids"){c.resources[g].show=o?"all":"optional";d.refresh(r)}};d.addFeatures=function(g){if(d.featureLayer)d.featureLayer.addFeatures(g);else l=l.concat(g)};d.removeFeatures=function(g){if(d.featureLayer)d.featureLayer.removeFeatures(g);else l=jQuery.grep(l,function(o){return jQuery.inArray(o,g)==-1})};c.resources=c.resources||{};c.map.controls=c.map.controls||[];c.map.mapType=c.map.mapType||MTK.MapTypeId.OSM;
c.map.mapTypes=c.map.mapTypes||[MTK.MapTypeId.OSM];d.size.width=jQuery("#"+b).width();d.size.height=jQuery("#"+b).height();MTK.event.trigger(window,"MTK.Map.beforeInit",d);var Q=c.map.location,V=c.map.locationHash&&da(),aa=Q.bounds?Q.bounds.getCenter():MTK.location.loaded?$P(MTK.location):$P(Q.center),ia=MTK.location.loaded?c.map.location.geolocationZoom||15:Q.zoom||10,ja=u=V?V.maptype:c.map.mapType;f={lat:aa.lat,lng:aa.lon,zoom:ia,maptype:c.map.mapType};var M=c.map.options||{};if(M.maxZoom==null)M.maxZoom=
19;jQuery("#"+b).addClass("mtk-map");d.map=d.gmap=e=new OpenLayers.Map(b,{theme:null,controls:[new OpenLayers.Control.Navigation,new OpenLayers.Control.Attribution],maxExtent:new OpenLayers.Bounds(-2.003750834E7,-2.003750834E7,2.003750834E7,2.003750834E7),maxResolution:156543.03390625,numZoomLevels:19,restrictedExtent:c.map.restrictedExtent,units:"m",projection:"EPSG:900913",eventListeners:{moveend:function(){if(!k)return k=true;if(n!=e.zoom){d.reset();for(var g in i.objs)i.objs[g].draw()}ha();d.refresh();
n=e.zoom},changebaselayer:function(){k&&ha()}}});e.setCenter=function(g,o,r,C){if(c.map.minZoom&&c.map.minZoom>o)o=c.map.minZoom;if(c.map.maxZoom&&c.map.maxZoom<o)o=c.map.maxZoom;OpenLayers.Map.prototype.setCenter.call(e,g,o,r,C)};e.updateSizeDestroy?OpenLayers.Event.stopObserving(window,"resize",e.updateSizeDestroy):e.events.unregister("resize",e,e.updateSize);M=function(){d.featureLayer=new OpenLayers.Layer.Vector("features");e.addLayer(d.featureLayer);d.featureLayer.setZIndex(320);l.length&&d.featureLayer.addFeatures(l)};
jQuery.isReady?M():jQuery(window).load(M);M=new MTK.Panes.overlayShadow;var ka=new MTK.Panes.overlayImage,la=new MTK.Panes.floatShadow,ma=new MTK.Panes.floatPane;e.addLayer(M);e.addLayer(ka);e.addLayer(la);e.addLayer(ma);d.panes={overlayShadow:M.div,overlayImage:ka.div,floatShadow:la.div,floatPane:ma.div};_others=[];for(var X in c.map.mapTypes){M=c.map.mapTypes[X];m[M]=MTK.MapType[M](d);ja!=M&&_others.push(m[M])}e.addLayer(m[ja]);e.addLayers(_others);n=V?V.zoom:ia;e.setCenter(V?$P(V):aa,n);if(!V&&
Q.bounds){e.zoomToExtent(Q.bounds);f.zoom=e.getZoom()}c.map.locationHash&&fa();d.refresh();jQuery(window).bind("resize",function(){p&&clearTimeout(p);p=setTimeout(function(){d.resize()},200)});d.bunchMarkers=new MTK.BunchMarkers(d);d.infoWindow=new MTK.InfoWindow(d);d.controls=new MTK.Control.createControls(d);var na=new MTK.Control.MTK(d,1009);for(X=0;X<(c.map.controls.length||[]);X++)try{new c.map.controls[X](d)}catch(pa){alert("cannot add control, details: "+pa+"'")}MTK.event.trigger(window,"MTK.Map.init",
d);Q=new MTK.Control.Click({trigger:function(g){var o=false;g.preventDefault=function(){o=true};g.latLng=g.lonLat=e.getLonLatFromPixel(g.xy);MTK.event.trigger(d,"click",g);if(!o){d.infoWindow.hide();d.bunchMarkers.restore()}}});e.addControl(Q);Q.activate();e.events.register("changebaselayer",null,function(){for(var g in i.objs)i.objs[g].draw();for(g in MTK.MapTypeId.google)if(u==MTK.MapTypeId.google[g])return na.hide();na.show()});d.overlays=i;return d};MTK.BunchMarkers=function(b){var c=this,d={},e,f,j=0,i,u=function(k,h){return Math.sqrt(Math.pow(h.x-k.x,2)+Math.pow(h.y-k.y,2))},m,q=function(k){if(k&&k.xy)m=k.xy;if(!(!e||b.infoWindow.isVisible()||f)){d&&clearTimeout(d);m&&u(m,e.center)>e.radius&&c.restore()}},n=function(){q();setTimeout(n,1E3)};n();if(!MTK.isTouchDevice()){MTK.event.addListener(b,"overlayMouseOver",function(k){d&&clearTimeout(d);d=setTimeout(function(){c.expand(k)},300)});b.map.events.register("mousemove",c,q)}c.expand=function(k){if(!(k instanceof
MTK.Marker))return false;if(e)for(var h in e.overlays)if(k==e.overlays[h])return false;if(e)for(h in e.transparent)if(k==e.transparent[h])return false;e&&c.restore();c.cancelRestoreAsync();var p=k.icon.anchor.y,y=k.icon.size.width,G=k.icon.size.height,I=b.map.getViewPortPxFromLonLat(k.position),l=[],w={},H=b.getOverlays();for(h=0;h<H.length;h++){var F=H[h];if(F instanceof MTK.Marker){var N=b.map.getViewPortPxFromLonLat(F.position);if(u(I,N)<=F.icon.size.height/3*MTK.BunchMarkers.expansionSensity){l.push(F);
w[F.item.id]=1}}}if(l.length<2)return false;MTK.event.trigger(k,"mouseout");MTK.event.trigger(b,"BunchMarkers.expand");b.infoWindow.hide();j++;var W=true,O=Math.round(l.length/4*G*MTK.BunchMarkers.radiusFactor+G/2);y=G/y<2?G/(G/y):G/2;h=new OpenLayers.Pixel(I.x,I.y-G/2+(G-p));e={overlay:k,overlays:l,transparent:[],radius:O+y,center:h};for(h=0;h<H.length;h++){F=H[h];if(F instanceof MTK.Marker){N=b.map.getViewPortPxFromLonLat(F.position);k=u(I,N);if(!w[F.item.id]&&k<2*(O+y)){e.transparent.push(F);F.dimm()}}}w=
e.overlays.length;i=w<5?150:w*30;H=2*Math.PI/w;angle=w==3?Math.PI/2:0;for(h=0;h<w;h++){angle+=H;newX=I.x+O*Math.cos(angle);newY=I.y+O*Math.sin(angle);e.overlays[h].panTo(b.map.getLonLatFromPixel(new OpenLayers.Pixel(newX,newY)),i)}setTimeout(function(){W=false},i);return true};c.restore=function(){if(e){MTK.event.trigger(b,"BunchMarkers.restore");for(var k=0;k<e.transparent.length;k++)e.transparent[k].restore(i);for(k=0;k<e.overlays.length;k++)e.overlays[k].restore(i);b.infoWindow.hide();e=null}};
c.restoreAsync=function(){var k=j;f=setTimeout(function(){k==j&&c.restore()},3E3)};c.cancelRestoreAsync=function(){clearTimeout(f);f=0}};MTK.BunchMarkers.radiusFactor=0.5;MTK.BunchMarkers.expansionSensity=1;MTK.Geocoder={engine:"geonames",ENGINE_GEONAMES:"geonames",ENGINE_CLOUDMADE:"cloudmade",STATUS_OK:"ok",STATUS_ERROR:"error",geocode:function(b,c){if(this.engine==this.ENGINE_GEONAMES)return this.geocodeGeonames(b,c);else if(this.engine==this.ENGINE_CLOUDMADE)return this.geocodeCloudmade(b,c)},geocodeGeonames:function(b,c){if(b.address)jQuery.getJSONP("http://api.geonames.org/searchJSON",{name_startsWith:b.address,username:"prozessor13",country:b.country,lang:MTK.language,featureClass:"P",maxRows:10},
function(e){c(jQuery.map(e.geonames,function(f){return{name:f.name,lat:f.lat,lng:f.lng,country:{code:f.countryCode.toLowerCase(),name:f.countryName},address:f.name+", "+f.adminName1+", "+f.countryName}}),MTK.Geocoder.STATUS_OK)},false,function(){c(null,MTK.Geocoder.STATUS_ERROR)});else if(b.location){var d=b.location.clone().t();jQuery.getJSONP("http://api.geonames.org/findNearbyPlaceNameJSON",{lat:d.lat,lng:d.lon,style:"FULL",lang:MTK.language,username:"prozessor13"},function(e){e=e.geonames[0];
if(!e)return c(null,MTK.Geocoder.STATUS_ERROR);var f={name:e.name,lat:e.lat,lng:e.lng,country:{code:e.countryCode.toLowerCase(),name:e.countryName},address:e.name+", "+e.adminName1+", "+e.countryName};jQuery.getJSONP("http://api.geonames.org/findNearbyStreetsOSMJSON",{lat:d.lat,lng:d.lon,style:"SHORT",lang:MTK.language,username:"prozessor13"},function(j){if(j.streetSegment[0]){f.street=j.streetSegment[0].name;f.address=f.street+", "+f.address}c([f],MTK.Geocoder.STATUS_OK)},false,function(){c([f],
MTK.Geocoder.STATUS_OK)})},false,function(){c(null,MTK.Geocoder.STATUS_ERROR)})}},geocodeCloudmade:function(b,c){c(null,MTK.Geocoder.STATUS_ERROR)}};MTK.TreeMenu=function(b,c,d){d=d||{};var e={},f=d.entry||MTK.staticHost+"/images/treemenu/entry.png",j=d.entrySelected||MTK.staticHost+"/images/treemenu/entry_selected.png",i=d.opened||MTK.staticHost+"/images/treemenu/open.png",u=d.closed||MTK.staticHost+"/images/treemenu/closed.png",m=d.loading||MTK.staticHost+"/images/loader.gif";b=jQuery(b).addClass("mtk-treemenu");var q=function(k,h,p){p=p||"icon";if(typeof k[p]=="string")return k[p];return k[p][h]},n=function(k,h,p){var y="mtk-treemenu-level"+
h,G=jQuery("<ul />");jQuery.each(k,function(I,l){var w=jQuery("<li />").addClass(l.className).addClass(y).mouseover(function(){l.icon&&!l.children&&!l.isLoading&&w.find(".mtk-treemenu-icon").attr("src",q(l,1))}).mouseout(function(){l.icon&&!l.children&&!l._checked&&!l.isLoading&&w.find(".mtk-treemenu-icon").attr("src",q(l,0))});l.visible!=null&&!l.visible&&w.hide();if(l.name)e[l.name]=w;G.append(w);w._parent=p;if(l.children){I=jQuery("<div />").addClass("mtk-treemenu-node-title").html(l.title||"");
w.addClass(y+"-node");l.icon=l.icon===undefined?[u,i]:l.icon;var H=n(l.children,h+1,w);G.append(H.hide());l.check=function(F){l._checked=w._checked=l._checked?0:1;l._checked?w.addClass(y+"-checked mtk-treemenu-checked"):w.removeClass(y+"-checked mtk-treemenu-checked");if(F!=false){H.show();l.icon&&w.find(".mtk-treemenu-icon").attr("src",q(l,l._checked))}};w.click(function(){l.check(false);l._checked?H.slideDown(100):H.slideUp(100);l.icon&&w.find(".mtk-treemenu-icon").attr("src",q(l,l._checked));l.checkbox&&
w.find(".mtk-treemenu-checkbox").attr("src",q(l,l._checked,"checkbox"));l.onclick&&l.onclick(l._checked,function(){})})}else{I=jQuery("<div />").addClass("mtk-treemenu-title").html(l.title||"");l.icon=l.icon===undefined?[f,j]:l.icon;l.check=function(F){l._checked=w._checked=l._checked?0:1;l._checked?w.addClass(y+"-checked mtk-treemenu-checked"):w.removeClass(y+"-checked mtk-treemenu-checked");for(var N=w._parent,W=h-1;N;){var O="mtk-treemenu-level"+W;l._checked?N.addClass(O+"-child-checked mtk-treemenu-child-checked"):
N.removeClass(O+"-child-checked mtk-treemenu-child-checked");N=N._parent;W--}if(F!=false){l.checkbox&&w.find(".mtk-treemenu-checkbox").attr("src",q(l,l._checked,"checkbox"));l.icon&&w.find(".mtk-treemenu-icon").attr("src",q(l,l._checked))}};w.click(function(){l.check(false);if(l.checkbox)w.find(".mtk-treemenu-checkbox").attr("src",m);else l.icon&&w.find(".mtk-treemenu-icon").attr("src",m);if(l.onclick){l.isLoading=true;l.onclick(l._checked,function(){l.isLoading=false;l.checkbox&&w.find(".mtk-treemenu-checkbox").attr("src",
q(l,l._checked,"checkbox"));l.icon&&w.find(".mtk-treemenu-icon").attr("src",q(l,l._checked))})}})}if(l.checkbox)w.append(jQuery("<img />").css("float","left").addClass("mtk-treemenu-checkbox").attr("src",q(l,0,"checkbox")));else l.children||w.append(jQuery("<img />").css("float","left").addClass("mtk-treemenu-space").attr("src","http://static.toursprung.com/images/t.gif"));l.icon&&w.append(jQuery("<img />").css("float","left").addClass("mtk-treemenu-icon").attr("src",q(l,0)));w.append(I).append(jQuery("<div />").css("clear",
"both"));l.checked&&l.check()});return G};b.addClass("mtk-treemenu").append(n(c,0));return e};MTK.OverlayView=function(){this._map=null;return this};MTK.OverlayView.id=0;a=MTK.OverlayView.prototype;a.setMap=function(b){if(b){this._map=b;if(!this._id)this._id=++MTK.OverlayView.id;b.overlays.objs[this._id]=this;this.onAdd();this.draw()}else if(this._map){delete this._map.overlays.objs[this._id];this.onRemove();this._map=null}};a.getMap=function(){return this._map};a.onAdd=function(){throw"MTK.OverlayView.onAdd: interface method. define method in subclass";};
a.onRemove=function(){throw"MTK.OverlayView.onRemove: interface method. define method in subclass";};a.draw=function(){return null};a.getPanes=function(){return this._map.panes};MTK.Marker=function(b){this._isVisible=true;this._hasDetails=false;this._params=b;this._handleEvents=true;if(!(b.icon instanceof MTK.Icon))b.icon=new MTK.Icon(b.icon);b.style=b.style||{};b.opacity=b.opacity||1;this.item=b.item||{};this.icon=b.icon;this.position=b.position;b.map&&this.setMap(b.map);if(b.draggable)this._isDraggable=false};MTK.Marker.prototype=new MTK.OverlayView;a=MTK.Marker.prototype;
a.setMap=function(b){MTK.OverlayView.prototype.setMap.call(this,b);b&&this._params.draggable&&!this._isDraggable&&this.setDraggable()};a.setIcon=function(b){this.icon=b;if(this._marker)this._marker.style.background="url("+b.url+")";if(this._printMarker)this._printMarker.src=b.url};a.setDetails=function(b){this._params.details=b};
a.showDetails=function(){var b=this;b._map.infoWindow.show(jQuery.extend({position:b._position||b.position,icon:b._params.icon,onclose:function(){b._hasDetails=false}},b._params.details));b._hasDetails=true};a.hideDetails=function(){if(this._hasDetails){this._hasDetails=false;this._map.infoWindow.hide()}};a.setPosition=function(b){this.position=b;this._marker&&this.draw()};
a.panTo=function(b,c){var d=this;c=c||100;d._position=b;d._marker.style.zIndex=d._zIndex+5E3;var e=this.getMap().map.getLayerPxFromLonLat(d._position);if(d._shadow)d._shadow.style.display="none";jQuery(this._marker).animate({left:Math.floor(e.x)-d._params.icon.anchor.x,top:Math.floor(e.y)-d._params.icon.anchor.y},c,"linear");d._expandTimeout=setTimeout(function(){d._polyline=new MTK.Polyline({path:[d.position,d._position],strokeColor:"#555555",strokeOpacity:0.8,strokeWidth:2,map:d.getMap()});if(d._shadow){d._shadow.style.display=
"block";d._shadow.style.left=Math.floor(e.x)-d._params.shadow.anchor.x+"px";d._shadow.style.top=Math.floor(e.y)-d._params.shadow.anchor.y+"px"}},c)};a.dimm=function(b){this._opacity=b||0.25;this._handleEvents=false;if(this._shadow)this._shadow.style.display="none";jQuery(this._marker).css({opacity:this._opacity})};
a.setDraggable=function(){this._isDraggable=true;if(jQuery.fn.draggable){var b=this,c={},d={};jQuery(b._marker).bind("touchstart mousedown",function(e){e.stopPropagation();c.x=e.pageX;c.y=e.pageY;b._shadow&&jQuery(b._shadow).hide(200);jQuery(b._marker).animate({top:"-=15"},200,"linear")});jQuery(b._marker).bind("touchend mouseup",function(){b._shadow&&jQuery(b._shadow).show(200);jQuery(b._marker).animate({top:"+=15"},200,"linear")});jQuery(this._marker).draggable({start:function(){MTK.event.trigger(b,
"dragstart")},stop:function(e){d.x=e.originalEvent.pageX-c.x;d.y=e.originalEvent.pageY-c.y;e=b.getMap().map.getLayerPxFromLonLat(b.position);e.x+=d.x;e.y+=d.y;b.setPosition(b.getMap().map.getLonLatFromLayerPx(e));MTK.event.trigger(b,"dragend")}})}else MTK.log("ERROR: jQuery.draggable not installed")};
a.restore=function(b){var c=this;b=b||100;if(this.getMap()){clearTimeout(c._expandTimeout);if(c._polyline){c._polyline.setMap(null);c._polyline=null}if(c._position){var d=c.getMap().map.getLayerPxFromLonLat(c.position);c._handleEvents=false;if(c._shadow)c._shadow.style.display="none";jQuery(c._marker).animate({left:Math.floor(d.x)-c._params.icon.anchor.x,top:Math.floor(d.y)-c._params.icon.anchor.y},b,"linear",function(){this.style.zIndex=c._zIndex});setTimeout(function(){c._handleEvents=true;if(c._shadow){c._shadow.style.display=
"block";c._shadow.style.left=Math.floor(d.x)-c._params.shadow.anchor.x+"px";c._shadow.style.top=Math.floor(d.y)-c._params.shadow.anchor.y+"px"}},b);c._position=null}if(c._opacity){jQuery(c._marker).css({opacity:c._params.opacity,filter:""});c._handleEvents=true;if(c._shadow)c._shadow.style.display="block";c._opacity=null}}};
a.setVisible=function(b){this._isVisible=b;if(this._printMarker)this._printMarker.style.display=b?"":"none !important";if(this._marker)this._marker.style.display=b?"block":"none";if(this._shadow)this._shadow.style.display=b?"block":"none"};
a.onAdd=function(){var b=this,c=this.getMap().map.getLayerPxFromLonLat(b.position);if(!(Math.abs(c.x)>4E3||Math.abs(c.y)>4E3)){b._zIndex=parseInt(Math.floor(c.y)+b._params.icon.anchor.y);b._marker=document.createElement("div");b._marker.className=b._params.className||"mtk-marker";for(var d in b._params.style)b._marker.style[d]=b._params.style[d];b._marker.style.position="absolute";b._marker.style.zIndex=b._zIndex;b._marker.style.width=b._params.icon.size.width+"px";b._marker.style.height=b._params.icon.size.height+
"px";b._marker.style.cursor="pointer";b._marker.ontouchstart=function(e){b._handleEvents&&MTK.event.trigger(b,"click",b);MTK.stopPropagation(e);MTK.preventDefault(e)};b._marker.ontouchend=function(e){MTK.stopPropagation(e);MTK.preventDefault(e)};b._marker.onclick=function(e){b._handleEvents&&MTK.event.trigger(b,"click",b);MTK.stopPropagation(e)};b._marker.onmouseover=function(){b._handleEvents&&MTK.event.trigger(b,"mouseover",b)};b._marker.onmouseout=function(){b._handleEvents&&MTK.event.trigger(b,
"mouseout",b)};if(b._params.title)b._marker.title=b._params.title;b.setIcon(b._params.icon);if(b.getMap().config.map.printable&&!MTK.isTouchDevice()){b._printMarker=document.createElement("img");b._printMarker.src=b._params.icon.url;b._printMarker.className="mtk-print-marker";b._printMarker.style.position="absolute";b._printMarker.style.zIndex=b._marker.style.zIndex;b._printMarker.style.width=b._marker.style.width;b._printMarker.style.height=b._marker.style.height}if(b._params.shadow){b._shadow=document.createElement("div");
b._shadow.className="mtk-marker-shadow";b._shadow.style.position="absolute";b._shadow.style.background="url("+b._params.shadow.url+")";b._shadow.style.width=b._params.shadow.size.width+"px";b._shadow.style.height=b._params.shadow.size.height+"px";b._shadow.style.zIndex=b._zIndex}b.setVisible(b._isVisible);b._printMarker&&b.getPanes().overlayImage.appendChild(b._printMarker);b.getPanes().overlayImage.appendChild(b._marker);b._shadow&&b.getPanes().overlayShadow.appendChild(b._shadow);b._params.opacity=
jQuery(b._marker).css("opacity");if(c=b._marker.style.borderWidth)b.icon.border=parseInt(c.substr(0,c.length-2))}};
a.draw=function(){if(this._marker){var b=this.getMap().map.getLayerPxFromLonLat(this._position||this.position),c=Math.floor(b.x)-this._params.icon.anchor.x+"px",d=Math.floor(b.y)-this._params.icon.anchor.y+"px";if(!(this._marker.style.left==c&&this._marker.style.top==d)){this._marker.style.left=c;this._marker.style.top=d;if(this._printMarker){this._printMarker.style.left=c;this._printMarker.style.top=d}if(this._shadow){this._shadow.style.left=Math.floor(b.x)-this._params.shadow.anchor.x+"px";this._shadow.style.top=
Math.floor(b.y)-this._params.shadow.anchor.y+"px"}}}};a.onRemove=function(){if(this._marker){this.hideDetails();this._marker.parentNode.removeChild(this._marker);this._printMarker&&this._printMarker.parentNode.removeChild(this._printMarker);this._shadow&&this._shadow.parentNode.removeChild(this._shadow);this._polyline&&this._polyline.setMap(null);this._polyline=this._marker=this._shadow=this._printMarker=null}};
MTK.Marker.Options={map:null,position:null,icon:null,shadow:null,style:null,className:null,details:null};MTK.Polyline=function(b){this.style={strokeColor:b.strokeColor||"#0000FF",strokeOpacity:b.strokeOpacity||0.6,strokeWidth:b.strokeWidth||3};b.path&&this.setPath(b.path);b.map&&this.setMap(b.map);return this};MTK.Polyline.prototype=new MTK.OverlayView;MTK.Polyline.newWithId=function(b){var c=new MTK.Polyline(b);jQuery.getJSONP(MTK.polylineHost,{id:b.id},function(d){for(var e=[],f=0;f<d.length;f++)e.push($P(d[f]));e&&c.setPath(e);c.getMap()&&c.onAdd()});return c};
MTK.Polyline.newFromKML=function(b){var c=new MTK.Polyline(b);jQuery.getJSONP(MTK.polylineHost,{href:b.kml},function(d){for(var e=[],f=0;f<d.length;f++)e.push($P(d[f]));e&&c.setPath(e);c.getMap()&&c.onAdd()});return c};MTK.Polyline.prototype.setPath=function(b){for(var c=[],d=0;d<b.length;d++){var e=b[d];c.push(new OpenLayers.Geometry.Point(e.lon,e.lat))}this._line=new OpenLayers.Geometry.LineString(c);this._feature=new OpenLayers.Feature.Vector(this._line,null,this.style)};
MTK.Polyline.prototype.onAdd=function(){this._feature&&this._map.addFeatures([this._feature])};MTK.Polyline.prototype.onRemove=function(){this._feature&&this._map.removeFeatures([this._feature])};MTK.InfoWindow=function(b){var c=function(){var e,f,j,i;this.isVisible=false;var u=function(){var m={width:e.outerWidth(),height:e.outerHeight()},q={width:jQuery("#"+b.div).width(),height:jQuery("#"+b.div).height()},n=params.paddingTop||30,k=b.map.getLayerPxFromLonLat(params.position);k.x=Math.floor(k.x);k.y=Math.floor(k.y);var h=b.map.getViewPortPxFromLonLat(params.position);h.x=Math.floor(h.x);h.y=Math.floor(h.y);if(params.onTop||q.width<600){var p={x:0,y:0};if(h.x<n)p.x-=n-h.x;if(h.x>q.width-n)p.x+=
n-(q.width-h.x);if(h.y<m.height+n+15+(params.icon?params.icon.anchor.y:0))p.y-=m.height+n+15+(params.icon?params.icon.anchor.y:0)-h.y;b.map.pan(p.x,p.y);p={x:parseInt(k.x-m.width/2),y:k.y-(params.icon?params.icon.anchor.y:0)-m.height-10};m={left:m.width/2-h.x,right:m.width/2-q.width+h.x};if(m.left>0)p.x+=m.left+10;if(m.right>0)p.x-=m.right+10;f.css({width:20,height:9,left:k.x-10,top:k.y-10-(params.icon?params.icon.anchor.y:0),background:"url('"+MTK.host+"/arrow.svg?color="+e.css("border-bottom-color")+
"&orientation=bottom')"})}else{p={x:0,y:0};var y=(params.icon?params.icon.size.height:0)+n+10;if(h.y<y)p.y-=y-h.y;if(h.y>q.height-10)p.y+=10-(q.height-h.y);b.map.pan(p.x,p.y);p=params.icon?Math.floor(params.icon.size.height/3):0;if(h.x<q.width/2){y={x:k.x,y:k.y};if(params.icon){y.x+=params.icon.size.width-params.icon.anchor.x+1+(params.icon.border?params.icon.border*2:0);y.y-=params.icon.anchor.y-1}f.css({width:9,height:20,left:y.x,top:y.y+p-10+(params.arrowOffsetY||0),background:"url('"+MTK.host+
"/arrow.svg?color="+e.css("border-right-color")+"&orientation=left')"});p={x:y.x+9,y:y.y-m.height/2+10+p}}else{y={x:k.x,y:k.y};if(params.icon){y.x-=params.icon.anchor.x+10;y.y-=params.icon.anchor.y-1}f.css({width:9,height:20,left:y.x,top:y.y+p-10+(params.arrowOffsetY||0),background:"url('"+MTK.host+"/arrow.svg?color="+e.css("border-left-color")+"&orientation=right')"});p={x:y.x-m.width,y:y.y-m.height/2+10+p}}if(m.height<50)p.y-=10;m={top:p.y-(k.y-h.y),bottom:p.y-(k.y-h.y)+m.height-q.height};if(m.top<
n)p.y+=n-m.top;if(m.bottom>-15)p.y-=m.bottom+15}return p};this.show=function(m){this.isVisible=true;if(!(i>0)){if(m)params=m;this.setMap(b)}};this.hide=function(m){this.isVisible=false;if(m)params=m;if(e){var q=this;e.animate({opacity:0},300,function(){q.isVisible||q.setMap(null)});f.animate({opacity:0},300);j&&j.animate({opacity:0},300)}};this.update=function(m){if(m)params=m;e&&this.setMap(null);var q=false;e=jQuery(document.createElement("div")).addClass(params.className||"mtk-infowindow").css("position",
"absolute").css(params.style||{}).bind("mouseover",function(n){for(var k=b.map.getControlsByClass("OpenLayers.Control.Navigation"),h=0;h<k.length;h++)k[h].disableZoomWheel();MTK.event.trigger(b,"InfoWindow.mouseOver",n)}).bind("mouseout",function(n){MTK.event.trigger(b,"InfoWindow.mouseOut",n);n=b.map.getControlsByClass("OpenLayers.Control.Navigation");for(var k=0;k<n.length;k++)n[k].enableZoomWheel()}).bind("touchstart click",function(n){if(!q){q=true;setTimeout(function(){q=false},100);n.stopPropagation();
MTK.event.trigger(b,"InfoWindow.clicked");params.handleClick!=false&&params.href&&b.openHref(params.href)}}).bind("mousedown",function(n){n.stopPropagation()});params.content?e.append(jQuery(params.content)):e.html(params.text||"&nbsp;");i=0;_this=this;e.find(".mtk-preload").each(function(){if(this.src.match(/\.(gif|png|jpeg|jpg|ico|tif|tiff)$/)){var n=this.src;this.src="";i++;jQuery(this).bind("error load",function(){i<=0||setTimeout(function(){i--;_this.show()},10)});this.src=n}});j=params.shadow&&
jQuery(document.createElement("img")).attr("src",params.shadow.src).css("position","absolute");f=jQuery(document.createElement("div")).css("position","absolute");if(params.closeButton!=false){q=false;e.append(jQuery(document.createElement("div")).addClass("mtk-infowindow-close").bind("touchstart click",function(n){n.preventDefault();n.stopPropagation();if(!q){q=true;setTimeout(function(){q=false},100);b.infoWindow.hide();b.bunchMarkers.restoreAsync()}}).html("&nbsp"));b.bunchMarkers.cancelRestoreAsync()}this.onclose=
params.onclose};this.onAdd=function(){if(params.position){jQuery(e).css("opacity");this.getPanes().floatPane.appendChild(e.get(0));this.getPanes().floatPane.appendChild(f.get(0));j&&this.getPanes().floatShadow.appendChild(j.get(0));e.hide();f.hide();j&&j.hide();var m=u();e.css({left:m.x,top:m.y});j&&j.css({left:m.x+5,top:m.y+e.outerHeight()-params.shadow.height+10});jQuery(f).css("opacity",0).show().animate({opacity:params.opacity||1},300);j&&jQuery(j).css("opacity",0).show().animate({opacity:params.opacity||
1},300,function(){if((params.opacity||1)==1)this.style.filter=""});jQuery(e).css("opacity",0).show().animate({opacity:params.opacity||1},300,function(){if((params.opacity||1)==1)this.style.filter=""})}};this.onRemove=function(){MTK.event.clearInstanceListeners(e);e.remove();f.remove();j&&j.remove()};this.draw=function(){if(params.position){var m=u();e.css({left:m.x+"px",top:m.y+"px"})}}};c.prototype=new MTK.OverlayView;var d=new c;return{isVisible:function(){return d.isVisible},show:function(e){d.onclose&&
d.onclose();b.checkMapClick=false;d.update(e);d.show(e);MTK.event.trigger(b,"InfoWindow.show")},hide:function(e){d.onclose&&d.onclose();d.hide(e);MTK.event.trigger(b,"InfoWindow.hide")}}};MTK.InfoWindow.Options={map:null,className:null,style:null,position:null,icon:null,text:null,content:null,handleClick:null,href:null,onTop:null,closeButton:null,opacity:null,onclose:null};MTK.Cluster=function(b){for(var c=this,d,e,f=$B(b),j=[],i=0;i<4;i++)j[i]=b.weights[i]/b.count;var u=(1+j[1]+j[3]-j[0]-j[2])/2,m=(1+j[2]+j[3]-j[0]-j[1])/2;j=b.levels||[0,99,199,999,9999];var q=b.classNames||["mtk-cluster1","mtk-cluster2","mtk-cluster3","mtk-cluster4","mtk-cluster5"],n=q[0];for(i=0;i<j.length;i++)if(b.count>=j[i])n=q[i];c.init=function(){MTK.Search.weights=1};c.onAdd=function(){d=document.createElement("div");d.className="mtk-cluster "+n;d.style.zIndex=-100000;var k=false;d.onclick=
d.ontouchstart=function(){if(!k){k=true;setTimeout(function(){k=false},100);b.onclick?b.onclick(f):c.getMap().map.zoomToExtent(f)}};e=document.createElement("span");e.innerHTML=b.count;d.style.display="none";d.appendChild(e);this.getPanes().overlayImage.appendChild(d)};c.draw=function(){var k=c.getMap().map.getLayerPxFromLonLat($P(b)),h=$(d).height(),p=$(d).width();h=Math.floor(k.y+70*m-35-h/2);k=Math.floor(k.x+70*u-35-p/2);d.style.left=k+"px";d.style.top=h+"px";d.style.display="block"};c.onRemove=
function(){d.parentNode.removeChild(d)};b.map&&c.setMap(b.map)};MTK.Cluster.prototype=new MTK.OverlayView;MTK.Control={TOP_LEFT:"tl",LEFT_TOP:"lt",TOP_RIGHT:"tr",RIGHT_TOP:"rt",BOTTOM_RIGHT:"br",RIGHT_BOTTOM:"rb",BOTTOM_LEFT:"bl",LEFT_BOTTOM:"lb",zIndex:1010,Control:function(b,c,d,e){var f=[];this.push=function(j){var i=0;j=jQuery(j);f.push(j.css("position","absolute").css(c,0).css("z-index",MTK.Control.zIndex++).css(e));jQuery(b.map.viewPortDiv).append(j);f=f.sort(function(u,m){return parseInt(u.attr("index"))-parseInt(m.attr("index"))});for(j=0;j<f.length;j++){f[j].css(c,i);i+=f[j][d](true)}};this.pop=
function(j){if(j)f=jQuery.grep(f,function(i){return i!==j});else j=f.pop();j.remove()}},createControls:function(b){return{tl:new MTK.Control.Control(b,"left","outerWidth",{top:0}),lt:new MTK.Control.Control(b,"top","outerHeight",{left:0}),tr:new MTK.Control.Control(b,"right","outerWidth",{top:0}),rt:new MTK.Control.Control(b,"top","outerHeight",{right:0}),br:new MTK.Control.Control(b,"right","outerWidth",{bottom:0}),rb:new MTK.Control.Control(b,"bottom","outerHeight",{right:0}),bl:new MTK.Control.Control(b,
"left","outerWidth",{bottom:0}),lb:new MTK.Control.Control(b,"bottom","outerHeight",{left:0})}}};MTK.Control.Click=OpenLayers.Class(OpenLayers.Control,{defaultHandlerOptions:{single:true,"double":false,pixelTolerance:0,stopSingle:false,stopDouble:false},initialize:function(){this.handlerOptions=OpenLayers.Util.extend({},this.defaultHandlerOptions);OpenLayers.Control.prototype.initialize.apply(this,arguments);this.handler=new OpenLayers.Handler.Click(this,{click:this.trigger},this.handlerOptions)}});MTK.Control.Zoom=function(b){var c=jQuery("<div />").addClass("mtk-control-zoom").append(jQuery("<img src='http://static.toursprung.com/images/v8/controls/zoom/plus.png' />").click(function(){b.map.zoomIn()})).append(jQuery("<img src='http://static.toursprung.com/images/v8/controls/zoom/minus.png' />").click(function(){b.map.zoomOut()}));c.get(0).index=10;b.controls[MTK.Control.LEFT_TOP].push(c.get(0))};MTK.Control.Fullscreen=function(b){var c=function(){return b.isFullscreen?"http://static.toursprung.com/images/v8/controls/fullscreen/close.png":"http://static.toursprung.com/images/v8/controls/fullscreen/open.png"},d=jQuery("<img />").attr("src",c()),e=jQuery("<div />").addClass("mtk-control-container mtk-control-button mtk-control-fullscreen").css("opacity",0.85).append(d).click(function(){b.setFullscreen(!b.isFullscreen);d.attr("src",c())});e.get(0).index=10;b.controls[MTK.Control.TOP_RIGHT].push(e.get(0))};MTK.Control.MapTypes=function(b){var c=function(i){return MTK.Control.MapTypes.i18n[i]||i},d=jQuery("<ul />"),e=jQuery("<span />").html(c(b.getMapTypeId())),f=function(i){b.setMapTypeId(i);e.html(c(i));d.hide()};for(var j in b.config.map.mapTypes)(function(i){d.append(jQuery("<li />").html(c(i)).click(function(){f(i)}))})(b.config.map.mapTypes[j]);j=jQuery("<div />").addClass("mtk-control-container mtk-control-maptypes").append(jQuery("<div />").addClass("mtk-control-button").css("opacity",0.85).append(jQuery(e)).append(jQuery("<div />").addClass("mtk-control-button-arrow").html("&#9660;")).click(function(){d.slideToggle(200)})).append(d.addClass("mtk-control-maptypes-others"));
j.get(0).index=20;b.controls[MTK.Control.TOP_RIGHT].push(j.get(0))};MTK.Control.MapTypes.i18n={osm:"openstreetmap",terrain:"google terrain",roadmap:"google maps",hybrid:"google hybrid",satellite:"satellite"};MTK.Control.LocationSearch=function(b){var c=null,d=jQuery("<input id='mtk-searchinput' type='text' />").autocomplete({delay:500,minLength:3,source:function(f,j){MTK.Geocoder.geocode({address:f.term,country:b.config.country},function(i,u){c=null;if(u==MTK.Geocoder.STATUS_OK){i=jQuery.map(i,function(m){$P(m);return{label:m.address,center:$P(m)}});c=i[0];j(i)}else j([])})},focus:function(f,j){c=j.item},select:function(f,j){b.map.setCenter(j.item.center);b.map.zoomTo(13)}}),e=jQuery("<div class='mtk-searchfield' />").append(jQuery("<form onsubmit='return false' />").append(jQuery("<a href='#' class='mtk-location'>Location</a>").click(function(){if(navigator.geolocation){jQuery(this).addClass("mtk-location-spinner");
navigator.geolocation.getCurrentPosition(function(f){try{jQuery(this).removeClass("mtk-location-spinner");MTK.location.lat=f.coords.latitude;MTK.location.lng=f.coords.longitude;b.map.setCenter($P(MTK.location));b.map.zoomTo(b.config.map.location.geolocationZoom||15);MTK.Geocoder.geocode({location:$P(MTK.location)},function(i,u){u==MTK.Geocoder.STATUS_OK&&d.val(i[0].address)})}catch(j){}},function(){jQuery(this).removeClass("mtk-location-spinner");alert(MTK.i18n["no geolocation available"])},{timeout:3E3})}else alert(MTK.i18n["no geolocation available"]);
return false})).append(d).append(jQuery("<a class='mtk-submitbutton' href='#'/>").click(function(){b.map.setCenter(c.center);b.map.zoomTo(13);d.val(c.label);d.autocomplete("close");return false})));e.get(0).index=99;b.controls[MTK.Control.TOP_LEFT].push(e.get(0))};MTK.Control.MTK=function(b,c){var d=jQuery("<div />").css({zIndex:c,margin:"2px 5px"}).append(jQuery("<img src='http://static.toursprung.com/images/mtk.png' />").click(function(){window.open("http://www.maptoolkit.net")}).css({width:85,height:20,cursor:"pointer"}));for(var e in MTK.MapTypeId.google)b.getMapTypeId()==MTK.MapTypeId.google[e]&&d.hide();d.get(0).index=10;b.controls[MTK.Control.BOTTOM_LEFT].push(d.get(0));return{show:function(){$(d).show()},hide:function(){$(d).hide()}}};

