﻿/*


	Beacon - Copyright 2003-2011 Schneider Corporation



*/


/*

  OpenLayers.js -- OpenLayers Map Viewer Library

  Copyright 2005-2010 OpenLayers Contributors, released under the Clear BSD
  license. Please see http://svn.openlayers.org/trunk/openlayers/license.txt
  for the full text of the license.

  Includes compressed code under the following licenses:

  (For uncompressed versions of the code used please see the
  OpenLayers SVN repository: <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
 */

/**
 * Contains portions of Gears <http://code.google.com/apis/gears/>
 *
 * Copyright 2007, Google Inc.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *  1. Redistributions of source code must retain the above copyright notice,
 *     this list of conditions and the following disclaimer.
 *  2. Redistributions in binary form must reproduce the above copyright notice,
 *     this list of conditions and the following disclaimer in the documentation
 *     and/or other materials provided with the distribution.
 *  3. Neither the name of Google Inc. nor the names of its contributors may be
 *     used to endorse or promote products derived from this software without
 *     specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Sets up google.gears.*, which is *the only* supported way to access Gears.
 *
 * Circumvent this file at your own risk!
 *
 * In the future, Gears may automatically define google.gears.* without this
 * file. Gears may use these objects to transparently fix bugs and compatibility
 * issues. Applications that use the code below will continue to work seamlessly
 * when that happens.
 */
/*!
 * jQuery JavaScript Library v1.6.1
 * http://jquery.com/
 *
 * Copyright 2011, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2011, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Thu May 12 15:04:36 2011 -0400
 */
(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!cj[a]){var b=f("<"+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),c.body.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write("<!doctype><html><body></body></html>");b=cl.createElement(a),cl.body.appendChild(b),d=f.css(b,"display"),c.body.removeChild(ck)}cj[a]=d}return cj[a]}function cu(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function ct(){cq=b}function cs(){setTimeout(ct,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function ca(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function b_(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bF.test(a)?d(a,e):b_(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)b_(a+"["+e+"]",b[e],c,d);else d(a,b)}function b$(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bU,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=b$(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=b$(a,c,d,e,"*",g));return l}function bZ(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bQ),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bD(a,b,c){var d=b==="width"?bx:by,e=b==="width"?a.offsetWidth:a.offsetHeight;if(c==="border")return e;f.each(d,function(){c||(e-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?e+=parseFloat(f.css(a,"margin"+this))||0:e-=parseFloat(f.css(a,"border"+this+"Width"))||0});return e}function bn(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bm(a){f.nodeName(a,"input")?bl(a):a.getElementsByTagName&&f.grep(a.getElementsByTagName("input"),bl)}function bl(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bk(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bj(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bi(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)f.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function bh(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function X(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(S.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function W(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function O(a,b){return(a&&a!=="*"?a+".":"")+b.replace(A,"`").replace(B,"&")}function N(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;i<s.length;i++)g=s[i],g.origType.replace(y,"")===a.type?q.push(g.selector):s.splice(i--,1);e=f(a.target).closest(q,a.currentTarget);for(j=0,k=e.length;j<k;j++){m=e[j];for(i=0;i<s.length;i++){g=s[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,d=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,d=f(a.relatedTarget).closest(g.selector)[0],d&&f.contains(h,d)&&(d=h);(!d||d!==h)&&p.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=p.length;j<k;j++){e=p[j];if(c&&e.level>c)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function L(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function F(){return!0}function E(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"$1-$2").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function H(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(H,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=d.userAgent,x,y,z,A=Object.prototype.toString,B=Object.prototype.hasOwnProperty,C=Array.prototype.push,D=Array.prototype.slice,E=String.prototype.trim,F=Array.prototype.indexOf,G={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.1",length:0,size:function(){return this.length},toArray:function(){return D.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?C.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(D.apply(this,arguments),"slice",D.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:C,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;y.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!y){y=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",z,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",z),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&H()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):G[A.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;if(a.constructor&&!B.call(a,"constructor")&&!B.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||B.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(b,c,d){a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),d=c.documentElement,(!d||!d.nodeName||d.nodeName==="parsererror")&&e.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:E?function(a){return a==null?"":E.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?C.call(c,a):e.merge(c,a)}return c},inArray:function(a,b){if(F)return F.call(b,a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=D.call(arguments,2),g=function(){return a.apply(c,f.concat(D.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=s.exec(a)||t.exec(a)||u.exec(a)||a.indexOf("compatible")<0&&v.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){G["[object "+b+"]"]=b.toLowerCase()}),x=e.uaMatch(w),x.browser&&(e.browser[x.browser]=!0,e.browser.version=x.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?z=function(){c.removeEventListener("DOMContentLoaded",z,!1),e.ready()}:c.attachEvent&&(z=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",z),e.ready())});return e}(),g="done fail isResolved isRejected promise then always pipe".split(" "),h=[].slice;f.extend({_Deferred:function(){var a=[],b,c,d,e={done:function(){if(!d){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=f.type(i),j==="array"?e.done.apply(e,i):j==="function"&&a.push(i);k&&e.resolveWith(k[0],k[1])}return this},resolveWith:function(e,f){if(!d&&!b&&!c){f=f||[],c=1;try{while(a[0])a.shift().apply(e,f)}finally{b=[e,f],c=0}}return this},resolve:function(){e.resolveWith(this,arguments);return this},isResolved:function(){return!!c||!!b},cancel:function(){d=1,a=[];return this}};return e},Deferred:function(a){var b=f._Deferred(),c=f._Deferred(),d;f.extend(b,{then:function(a,c){b.done(a).fail(c);return this},always:function(){return b.done.apply(b,arguments).fail.apply(this,arguments)},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,pipe:function(a,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[c,"reject"]},function(a,c){var e=c[0],g=c[1],h;f.isFunction(e)?b[a](function(){h=e.apply(this,arguments),h&&f.isFunction(h.promise)?h.promise().then(d.resolve,d.reject):d[g](h)}):b[a](d[g])})}).promise()},promise:function(a){if(a==null){if(d)return d;d=a={}}var c=g.length;while(c--)a[g[c]]=b[g[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){function i(a){return function(c){b[a]=arguments.length>1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c<d;c++)b[c]&&f.isFunction(b[c].promise)?b[c].promise().then(i(c),g.reject):--e;e||g.resolveWith(g,b)}else g!==a&&g.resolveWith(g,d?[a]:[]);return g.promise()}}),f.support=function(){var a=c.createElement("div"),b=c.documentElement,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;a.setAttribute("className","t"),a.innerHTML="   <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};f=c.createElement("select"),g=f.appendChild(c.createElement("option")),h=a.getElementsByTagName("input")[0],j={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},h.checked=!0,j.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,j.optDisabled=!g.disabled;try{delete a.test}catch(s){j.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function b(){j.noCloneEvent=!1,a.detachEvent("onclick",b)}),a.cloneNode(!0).fireEvent("onclick")),h=c.createElement("input"),h.value="t",h.setAttribute("type","radio"),j.radioValue=h.value==="t",h.setAttribute("checked","checked"),a.appendChild(h),k=c.createDocumentFragment(),k.appendChild(a.firstChild),j.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",l=c.createElement("body"),m={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};for(q in m)l.style[q]=m[q];l.appendChild(a),b.insertBefore(l,b.firstChild),j.appendChecked=h.checked,j.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,j.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",j.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",n=a.getElementsByTagName("td"),r=n[0].offsetHeight===0,n[0].style.display="",n[1].style.display="none",j.reliableHiddenOffsets=r&&n[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(i=c.createElement("div"),i.style.width="0",i.style.marginRight="0",a.appendChild(i),j.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(i,null)||{marginRight:0}).marginRight,10)||0)===0),l.innerHTML="",b.removeChild(l);if(a.attachEvent)for(q in{submit:1,change:1,focusin:1})p="on"+q,r=p in a,r||(a.setAttribute(p,"return;"),r=typeof a[p]=="function"),j[q+"Bubbles"]=r;return j}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([a-z])([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g=f.expando,h=typeof c=="string",i,j=a.nodeType,k=j?f.cache:a,l=j?a[f.expando]:a[f.expando]&&f.expando;if((!l||e&&l&&!k[l][g])&&h&&d===b)return;l||(j?a[f.expando]=l=++f.uuid:l=f.expando),k[l]||(k[l]={},j||(k[l].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?k[l][g]=f.extend(k[l][g],c):k[l]=f.extend(k[l],c);i=k[l],e&&(i[g]||(i[g]={}),i=i[g]),d!==b&&(i[f.camelCase(c)]=d);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[f.camelCase(c)]:i}},removeData:function(b,c,d){if(!!f.acceptData(b)){var e=f.expando,g=b.nodeType,h=g?f.cache:b,i=g?b[f.expando]:f.expando;if(!h[i])return;if(c){var j=d?h[i][e]:h[i];if(j){delete j[c];if(!l(j))return}}if(d){delete h[i][e];if(!l(h[i]))return}var k=h[i][e];f.support.deleteExpando||h!=a?delete h[i]:h[i]=null,k?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=k):g&&(f.support.deleteExpando?delete b[f.expando]:b.removeAttribute?b.removeAttribute(f.expando):b[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h<i;h++)g=e[h].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),k(this[0],g,d[g]))}}return d}if(typeof a=="object")return this.each(function(){f.data(this,a)});var j=a.split(".");j[1]=j[1]?"."+j[1]:"";if(c===b){d=this.triggerHandler("getData"+j[1]+"!",[j[0]]),d===b&&this.length&&(d=f.data(this[0],a),d=k(this[0],a,d));return d===b&&j[1]?this.data(j[0]):d}return this.each(function(){var b=f(this),d=[j[0],c];b.triggerHandler("setData"+j[1]+"!",d),f.data(this,a,c),b.triggerHandler("changeData"+j[1]+"!",d)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,c){a&&(c=(c||"fx")+"mark",f.data(a,c,(f.data(a,c,b,!0)||0)+1,!0))},_unmark:function(a,c,d){a!==!0&&(d=c,c=a,a=!1);if(c){d=d||"fx";var e=d+"mark",g=a?0:(f.data(c,e,b,!0)||1)-1;g?f.data(c,e,g,!0):(f.removeData(c,e,!0),m(c,d,"mark"))}},queue:function(a,c,d){if(a){c=(c||"fx")+"queue";var e=f.data(a,c,b,!0);d&&(!e||f.isArray(d)?e=f.data(a,c,f.makeArray(d),!0):e.push(d));return e||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e;d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),d.call(a,function(){f.dequeue(a,b)})),c.length||(f.removeData(a,b+"queue",!0),m(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){f.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f._Deferred(),!0))h++,l.done(m);m();return d.promise()}});var n=/[\n\t\r]/g,o=/\s+/,p=/\r/g,q=/^(?:button|input)$/i,r=/^(?:button|input|object|select|textarea)$/i,s=/^a(?:rea)?$/i,t=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,u=/\:/,v,w;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.addClass(a.call(this,b,c.attr("class")||""))});if(a&&typeof a=="string"){var b=(a||"").split(o);for(var c=0,d=this.length;c<d;c++){var e=this[c];if(e.nodeType===1)if(!e.className)e.className=a;else{var g=" "+e.className+" ",h=e.className;for(var i=0,j=b.length;i<j;i++)g.indexOf(" "+b[i]+" ")<0&&(h+=" "+b[i]);e.className=f.trim(h)}}}return this},removeClass:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.removeClass(a.call(this,b,c.attr("class")))});if(a&&typeof a=="string"||a===b){var c=(a||"").split(o);for(var d=0,e=this.length;d<e;d++){var g=this[d];if(g.nodeType===1&&g.className)if(a){var h=(" "+g.className+" ").replace(n," ");for(var i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){var d=f(this);d.toggleClass(a.call(this,c,d.attr("class"),b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(o);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if((" "+this[c].className+" ").replace(n," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;return(e.value||"").replace(p,"")}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h<i;h++){var j=e[h];if(j.selected&&(f.support.optDisabled?!j.disabled:j.getAttribute("disabled")===null)&&(!j.parentNode.disabled||!f.nodeName(j.parentNode,"optgroup"))){b=f(j).val();if(g)return b;d.push(b)}}if(g&&!d.length&&e.length)return f(e[c]).val();return d},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);c=j&&f.attrFix[c]||c,i=f.attrHooks[c],i||(!t.test(c)||typeof d!="boolean"&&d!==b&&d.toLowerCase()!==c.toLowerCase()?v&&(f.nodeName(a,"form")||u.test(c))&&(i=v):i=w);if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j)return i.get(a,c);h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.support.getSetAttribute?a.removeAttribute(b):(f.attr(a,b,""),a.removeAttributeNode(a.getAttributeNode(b))),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},tabIndex:{get:function(a){var c=a.getAttributeNode("tabIndex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);c=i&&f.propFix[c]||c,h=f.propHooks[c];return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==b?g:a[c]},propHooks:{}}),w={get:function(a,c){return a[f.propFix[c]||c]?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=b),a.setAttribute(c,c.toLowerCase()));return c}},f.attrHooks.value={get:function(a,b){if(v&&f.nodeName(a,"button"))return v.get(a,b);return a.value},set:function(a,b,c){if(v&&f.nodeName(a,"button"))return v.set(a,b,c);a.value=b}},f.support.getSetAttribute||(f.attrFix=f.propFix,v=f.attrHooks.name=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,c){var d=a.getAttributeNode(c);if(d){d.nodeValue=b;return b}}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var x=Object.prototype.hasOwnProperty,y=/\.(.*)$/,z=/^(?:textarea|input|select)$/i,A=/\./g,B=/ /g,C=/[^\w\s.|`]/g,D=function(a){return a.replace(C,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=E;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=E);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),D).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))f.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=f.event.special[h]||{};for(j=e||0;j<p.length;j++){q=p[j];if(d.guid===q.guid){if(l||n.test(q.namespace))e==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(e!=null)break}}if(p.length===0||e!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&f.removeEvent(a,h,s.handle),g=null,delete t[h]}if(f.isEmptyObject(t)){var u=s.handle;u&&(u.elem=null),delete s.events,delete s.handle,f.isEmptyObject(s)&&f.removeData(a,b,!0)}}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){var h=c.type||c,i=[],j;h.indexOf("!")>=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem
)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h<i;h++){var j=d[h];if(e||c.namespace_re.test(j.namespace)){c.handler=j.handler,c.data=j.data,c.handleObj=j;var k=j.handler.apply(this,g);k!==b&&(c.result=k,k===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[f.expando])return a;var d=a;a=f.Event(d);for(var e=this.props.length,g;e;)g=this.props[--e],a[g]=d[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=a.target.ownerDocument||c,i=h.documentElement,j=h.body;a.pageX=a.clientX+(i&&i.scrollLeft||j&&j.scrollLeft||0)-(i&&i.clientLeft||j&&j.clientLeft||0),a.pageY=a.clientY+(i&&i.scrollTop||j&&j.scrollTop||0)-(i&&i.clientTop||j&&j.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:f.proxy,special:{ready:{setup:f.bindReady,teardown:f.noop},live:{add:function(a){f.event.add(this,O(a.origType,a.selector),f.extend({},a,{handler:N,guid:a.handler.guid}))},remove:function(a){f.event.remove(this,O(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!this.preventDefault)return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?F:E):this.type=a,b&&f.extend(this,b),this.timeStamp=f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=F;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=F;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=F,this.stopPropagation()},isDefaultPrevented:E,isPropagationStopped:E,isImmediatePropagationStopped:E};var G=function(a){var b=a.relatedTarget;a.type=a.data;try{if(b&&b!==c&&!b.parentNode)return;while(b&&b!==this)b=b.parentNode;b!==this&&f.event.handle.apply(this,arguments)}catch(d){}},H=function(a){a.type=a.data,f.event.handle.apply(this,arguments)};f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={setup:function(c){f.event.add(this,b,c&&c.selector?H:G,a)},teardown:function(a){f.event.remove(this,b,a&&a.selector?H:G)}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(a,b){if(!f.nodeName(this,"form"))f.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=b.type;(c==="submit"||c==="image")&&f(b).closest("form").length&&L("submit",this,arguments)}),f.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=b.type;(c==="text"||c==="password")&&f(b).closest("form").length&&a.keyCode===13&&L("submit",this,arguments)});else return!1},teardown:function(a){f.event.remove(this,".specialSubmit")}});if(!f.support.changeBubbles){var I,J=function(a){var b=a.type,c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},K=function(c){var d=c.target,e,g;if(!!z.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=J(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:K,beforedeactivate:K,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&K.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&K.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",J(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in I)f.event.add(this,c+".specialChange",I[c]);return z.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return z.test(this.nodeName)}},I=f.event.special.change.filters,I.focus=I.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i<j;i++)f.event.add(this[i],a,g,d);return this}}),f.fn.extend({unbind:function(a,b){if(typeof a=="object"&&!a.preventDefault)for(var c in a)this.unbind(c,a[c]);else for(var d=0,e=this.length;d<e;d++)f.event.remove(this[d],a,b);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f.data(this,"lastToggle"+a.guid)||0)%d;f.data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var M={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};f.each(["live","die"],function(a,c){f.fn[c]=function(a,d,e,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:f(this.context);if(typeof a=="object"&&!a.preventDefault){for(var o in a)n[c](o,d,a[o],m);return this}if(c==="die"&&!a&&g&&g.charAt(0)==="."){n.unbind(g);return this}if(d===!1||f.isFunction(d))e=d||E,d=b;a=(a||"").split(" ");while((h=a[i++])!=null){j=y.exec(h),k="",j&&(k=j[0],h=h.replace(y,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,M[h]?(a.push(M[h]+k),h=h+k):h=(M[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)f.event.add(n[p],"live."+O(h,m),{data:d,selector:m,handler:e,origType:h,origHandler:e,preType:l});else n.unbind("live."+O(h,m),e)}return this}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(!f)g=o=!0;else if(f===!0)continue}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("parentNode",b,f,a,e,c)},"~":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("previousSibling",b,f,a,e,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c<f;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){if(a===b){g=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};f.find=k,f.expr=k.selectors,f.expr[":"]=f.expr.filters,f.unique=k.uniqueSort,f.text=k.getText,f.isXMLDoc=k.isXML,f.contains=k.contains}();var P=/Until$/,Q=/^(?:parents|prevUntil|prevAll)/,R=/,/,S=/^.[^:#\[\.,]*$/,T=Array.prototype.slice,U=f.expr.match.POS,V={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(X(this,a,!1),"not",a)},filter:function(a){return this.pushStack(X(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d<e;d++)i=a[d],j[i]||(j[i]=U.test(i)?f(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=U.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(l?l.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a=="string")return f.inArray(this[0],a?f(a):this.parent().children());return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(W(c[0])||W(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=T.call(arguments);P.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!V[a]?f.unique(e):e,(this.length>1||R.test(d))&&Q.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var Y=/ jQuery\d+="(?:\d+|null)"/g,Z=/^\s+/,$=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,_=/<([\w:]+)/,ba=/<tbody/i,bb=/<|&#?\w+;/,bc=/<(?:script|object|embed|option|style)/i,bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*<!(?:\[CDATA\[|\-\-)/,bg={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Y,""):null;if(typeof a=="string"&&!bc.test(a)&&(f.support.leadingWhitespace||!Z.test(a))&&!bg[(_.exec(a)||["",""])[1].toLowerCase()]){a=a.replace($,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bh(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bn)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i=b&&b[0]?b[0].ownerDocument||b[0]:c;a.length===1&&typeof a[0]=="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!bc.test(a[0])&&(f.support.checkClone||!bd.test(a[0]))&&(g=!0,h=f.fragments[a[0]],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[a[0]]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bj(a,d),e=bk(a),g=bk(d);for(h=0;e[h];++h)bj(e[h],g[h])}if(b){bi(a,d);if(c){e=bk(a),g=bk(d);for(h=0;e[h];++h)bi(e[h],g[h])}}return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||
b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!bb.test(k))k=b.createTextNode(k);else{k=k.replace($,"<$1></$2>");var l=(_.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=ba.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&Z.test(k)&&o.insertBefore(b.createTextNode(Z.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bm(k[i]);else bm(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||be.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.expando,g=f.event.special,h=f.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&f.noData[j.nodeName.toLowerCase()])continue;c=j[f.expando];if(c){b=d[c]&&d[c][e];if(b&&b.events){for(var k in b.events)g[k]?f.event.remove(j,k):f.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[f.expando]:j.removeAttribute&&j.removeAttribute(f.expando),delete d[c]}}}});var bo=/alpha\([^)]*\)/i,bp=/opacity=([^)]*)/,bq=/-([a-z])/ig,br=/([A-Z]|^ms)/g,bs=/^-?\d+(?:px)?$/i,bt=/^-?\d/,bu=/^[+\-]=/,bv=/[^+\-\.\de]+/g,bw={position:"absolute",visibility:"hidden",display:"block"},bx=["Left","Right"],by=["Top","Bottom"],bz,bA,bB,bC=function(a,b){return b.toUpperCase()};f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bz(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{zIndex:!0,fontWeight:!0,opacity:!0,zoom:!0,lineHeight:!0,widows:!0,orphans:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d;if(h==="number"&&isNaN(d)||d==null)return;h==="string"&&bu.test(d)&&(d=+d.replace(bv,"")+parseFloat(f.css(a,c))),h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bz)return bz(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]},camelCase:function(a){return a.replace(bq,bC)}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){a.offsetWidth!==0?e=bD(a,b,d):f.swap(a,bw,function(){e=bD(a,b,d)});if(e<=0){e=bz(a,b,b),e==="0px"&&bB&&(e=bB(a,b,b));if(e!=null)return e===""||e==="auto"?"0px":e}if(e<0||e==null){e=a.style[b];return e===""||e==="auto"?"0px":e}return typeof e=="string"?e:e+"px"}},set:function(a,b){if(!bs.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bp.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle;c.zoom=1;var e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.filter=bo.test(g)?g.replace(bo,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,c){var d,e,g;c=c.replace(br,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bs.test(d)&&bt.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bE=/%20/g,bF=/\[\]$/,bG=/\r?\n/g,bH=/#.*$/,bI=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bJ=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bK=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,bL=/^(?:GET|HEAD)$/,bM=/^\/\//,bN=/\?/,bO=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bP=/^(?:select|textarea)/i,bQ=/\s+/,bR=/([?&])_=[^&]*/,bS=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bT=f.fn.load,bU={},bV={},bW,bX;try{bW=e.href}catch(bY){bW=c.createElement("a"),bW.href="",bW=bW.href}bX=bS.exec(bW.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bT)return bT.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bO,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bP.test(this.nodeName)||bJ.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bG,"\r\n")}}):{name:b.name,value:c.replace(bG,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?f.extend(!0,a,f.ajaxSettings,b):(b=a,a=f.extend(!0,f.ajaxSettings,b));for(var c in{context:1,url:1})c in b?a[c]=b[c]:c in f.ajaxSettings&&(a[c]=f.ajaxSettings[c]);return a},ajaxSettings:{url:bW,isLocal:bK.test(bX[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML}},ajaxPrefilter:bZ(bU),ajaxTransport:bZ(bV),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a?4:0;var o,r,u,w=l?ca(d,v,l):b,x,y;if(a>=200&&a<300||a===304){if(d.ifModified){if(x=v.getResponseHeader("Last-Modified"))f.lastModified[k]=x;if(y=v.getResponseHeader("Etag"))f.etag[k]=y}if(a===304)c="notmodified",o=!0;else try{r=cb(d,w),c="success",o=!0}catch(z){c="parsererror",u=z}}else{u=c;if(!c||a)c="error",a<0&&(a=0)}v.status=a,v.statusText=c,o?h.resolveWith(e,[r,c,v]):h.rejectWith(e,[v,c,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,c]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bI.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bH,"").replace(bM,bX[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bQ),d.crossDomain==null&&(r=bS.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bX[1]&&r[2]==bX[2]&&(r[3]||(r[1]==="http:"?80:443))==(bX[3]||(bX[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bU,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bL.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bN.test(d.url)?"&":"?")+d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bR,"$1_="+x);d.url=y+(y===d.url?(bN.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", */*; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bV,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){status<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bE,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq,cr=a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cv(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cu("hide",3),a,b,c);for(var d=0,e=this.length;d<e;d++)if(this[d].style){var g=f.css(this[d],"display");g!=="none"&&!f._data(this[d],"olddisplay")&&f._data(this[d],"olddisplay",g)}for(d=0;d<e;d++)this[d].style&&(this[d].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cu("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return this[e.queue===!1?"each":"queue"](function(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(f.support.inlineBlockNeedsLayout?(j=cv(this.nodeName),j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)):this.style.display="inline-block"))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)k=new f.fx(this,b,i),h=a[i],cm.test(h)?k[h==="toggle"?d?"show":"hide":h]():(l=cn.exec(h),m=k.cur(),l?(n=parseFloat(l[2]),o=l[3]||(f.cssNumber[i]?"":"px"),o!=="px"&&(f.style(this,i,(n||1)+o),m=(n||1)/k.cur()*m,f.style(this,i,m+o)),l[1]&&(n=(l[1]==="-="?-1:1)*n+m),k.custom(m,n,o)):k.custom(m,h,""));return!0})},stop:function(a,b){a&&this.queue([]),this.each(function(){var a=f.timers,c=a.length;b||f._unmark(!0,this);while(c--)a[c].elem===this&&(b&&a[c](!0),a.splice(c,1))}),b||this.dequeue();return this}}),f.each({slideDown:cu("show",1),slideUp:cu("hide",1),slideToggle:cu("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default,d.old=d.complete,d.complete=function(a){d.queue!==!1?f.dequeue(this):a!==!1&&f._unmark(this),f.isFunction(d.old)&&d.old.call(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function h(a){return d.step(a)}var d=this,e=f.fx,g;this.startTime=cq||cs(),this.start=a,this.end=b,this.unit=c||this.unit||(f.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,h.elem=this.elem,h()&&f.timers.push(h)&&!co&&(cr?(co=1,g=function(){co&&(cr(g),e.tick())},cr(g)):co=setInterval(e.tick,e.interval))},show:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=cq||cs(),c=!0,d=this.elem,e=this.options,g,h;if(a||b>=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b<a.length;++b)a[b]()||a.splice(b--,1);a.length||f.fx.stop()},interval:13,stop:function(){clearInterval(co),co=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cy(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);f.offset.initialize();var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.offset.doesNotAddBorder&&(!f.offset.doesAddBorderForTableAndCells||!cw.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={initialize:function(){var a=c.body,b=c.createElement("div"),d,e,g,h,i=parseFloat(f.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){return this[0]?parseFloat(f.css(this[0],d,"padding")):null},f.fn["outer"+c]=function(a){return this[0]?parseFloat(f.css(this[0],d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c];return e.document.compatMode==="CSS1Compat"&&g||e.document.body["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var h=f.css(e,d),i=parseFloat(h);return f.isNaN(i)?h:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window);jQuery.cookie=function(name,value,options){if(typeof value!="undefined"){options=options||{};if(value===null){value="";options.expires=-1}var expires="";if(options.expires&&(typeof options.expires=="number"||options.expires.toUTCString)){var date;if(typeof options.expires=="number"){date=new Date;date.setTime(date.getTime()+options.expires*24*60*60*1E3)}else date=options.expires;expires="; expires="+date.toUTCString()}var path=options.path?"; path="+options.path:"";var domain=options.domain?"; domain="+
options.domain:"";var secure=options.secure?"; secure":"";document.cookie=[name,"=",encodeURIComponent(value),expires,path,domain,secure].join("")}else{var cookieValue=null;if(document.cookie&&document.cookie!=""){var cookies=document.cookie.split(";");for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==name+"="){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break}}}return cookieValue}};
(function($,document,window){var defaults={transition:"elastic",speed:300,width:false,initialWidth:"600",innerWidth:false,maxWidth:false,height:false,initialHeight:"450",innerHeight:false,maxHeight:false,scalePhotos:true,scrolling:true,inline:false,html:false,iframe:false,fastIframe:true,photo:false,href:false,title:false,rel:false,opacity:0.9,preloading:true,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:false,returnFocus:true,loop:true,slideshow:false,slideshowAuto:true,
slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:false,onLoad:false,onComplete:false,onCleanup:false,onClosed:false,overlayClose:true,escKey:true,arrowKey:true},colorbox="colorbox",prefix="cbox",event_open=prefix+"_open",event_load=prefix+"_load",event_complete=prefix+"_complete",event_cleanup=prefix+"_cleanup",event_closed=prefix+"_closed",event_purge=prefix+"_purge",isIE=$.browser.msie&&!$.support.opacity,isIE6=isIE&&$.browser.version<7,event_ie6=prefix+
"_IE6",$overlay,$box,$wrap,$content,$topBorder,$leftBorder,$rightBorder,$bottomBorder,$related,$window,$loaded,$loadingBay,$loadingOverlay,$title,$current,$slideshow,$next,$prev,$close,$groupControls,settings={},interfaceHeight,interfaceWidth,loadedHeight,loadedWidth,element,index,photo,open,active,closing=false,publicMethod,boxElement=prefix+"Element";function $div(id,cssText){var div=document.createElement("div");div.id=id?prefix+id:false;div.style.cssText=cssText||false;return $(div)}function setSize(size,
dimension){dimension=dimension==="x"?$window.width():$window.height();return typeof size==="string"?Math.round(/%/.test(size)?dimension/100*parseInt(size,10):parseInt(size,10)):size}function isImage(url){return settings.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(url)}function process(settings){for(var i in settings)if($.isFunction(settings[i])&&i.substring(0,2)!=="on")settings[i]=settings[i].call(element);settings.rel=settings.rel||element.rel||"nofollow";settings.href=$.trim(settings.href||
$(element).attr("href"));settings.title=settings.title||element.title}function trigger(event,callback){if(callback)callback.call(element);$.event.trigger(event)}function slideshow(){var timeOut,className=prefix+"Slideshow_",click="click."+prefix,start,stop,clear;if(settings.slideshow&&$related[1]){start=function(){$slideshow.text(settings.slideshowStop).unbind(click).bind(event_complete,function(){if(index<$related.length-1||settings.loop)timeOut=setTimeout(publicMethod.next,settings.slideshowSpeed)}).bind(event_load,
function(){clearTimeout(timeOut)}).one(click+" "+event_cleanup,stop);$box.removeClass(className+"off").addClass(className+"on");timeOut=setTimeout(publicMethod.next,settings.slideshowSpeed)};stop=function(){clearTimeout(timeOut);$slideshow.text(settings.slideshowStart).unbind([event_complete,event_load,event_cleanup,click].join(" ")).one(click,start);$box.removeClass(className+"on").addClass(className+"off")};if(settings.slideshowAuto)start();else stop()}}function launch(elem){if(!closing){element=
elem;process($.extend(settings,$.data(element,colorbox)));$related=$(element);index=0;if(settings.rel!=="nofollow"){$related=$("."+boxElement).filter(function(){var relRelated=$.data(this,colorbox).rel||this.rel;return relRelated===settings.rel});index=$related.index(element);if(index===-1){$related=$related.add(element);index=$related.length-1}}if(!open){open=active=true;$box.show();if(settings.returnFocus)try{element.blur();$(element).one(event_closed,function(){try{this.focus()}catch(e){}})}catch(e){}$overlay.css({opacity:+settings.opacity,
cursor:settings.overlayClose?"pointer":"auto"}).show();settings.w=setSize(settings.initialWidth,"x");settings.h=setSize(settings.initialHeight,"y");publicMethod.position(0);if(isIE6)$window.bind("resize."+event_ie6+" scroll."+event_ie6,function(){$overlay.css({width:$window.width(),height:$window.height(),top:$window.scrollTop(),left:$window.scrollLeft()})}).trigger("resize."+event_ie6);trigger(event_open,settings.onOpen);$groupControls.add($title).hide();$close.html(settings.close).show()}publicMethod.load(true)}}
publicMethod=$.fn[colorbox]=$[colorbox]=function(options,callback){var $this=this,autoOpen;if(!$this[0]&&$this.selector)return $this;options=options||{};if(callback)options.onComplete=callback;if(!$this[0]||$this.selector===undefined){$this=$("<a/>");options.open=true}$this.each(function(){$.data(this,colorbox,$.extend({},$.data(this,colorbox)||defaults,options));$(this).addClass(boxElement)});autoOpen=options.open;if($.isFunction(autoOpen))autoOpen=autoOpen.call($this);if(autoOpen)launch($this[0]);
return $this};publicMethod.init=function(){$window=$(window);$box=$div().attr({id:colorbox,"class":isIE?prefix+(isIE6?"IE6":"IE"):""});$overlay=$div("Overlay",isIE6?"position:absolute":"").hide();$wrap=$div("Wrapper");$content=$div("Content").append($loaded=$div("LoadedContent","width:0; height:0; overflow:hidden"),$loadingOverlay=$div("LoadingOverlay").add($div("LoadingGraphic")),$title=$div("Title"),$current=$div("Current"),$next=$div("Next"),$prev=$div("Previous"),$slideshow=$div("Slideshow").bind(event_open,
slideshow),$close=$div("Close"));$wrap.append($div().append($div("TopLeft"),$topBorder=$div("TopCenter"),$div("TopRight")),$div(false,"clear:left").append($leftBorder=$div("MiddleLeft"),$content,$rightBorder=$div("MiddleRight")),$div(false,"clear:left").append($div("BottomLeft"),$bottomBorder=$div("BottomCenter"),$div("BottomRight"))).children().children().css({"float":"left"});$loadingBay=$div(false,"position:absolute; width:9999px; visibility:hidden; display:none");$("body").prepend($overlay,$box.append($wrap,
$loadingBay));$content.children().hover(function(){$(this).addClass("hover")},function(){$(this).removeClass("hover")}).addClass("hover");interfaceHeight=$topBorder.height()+$bottomBorder.height()+$content.outerHeight(true)-$content.height();interfaceWidth=$leftBorder.width()+$rightBorder.width()+$content.outerWidth(true)-$content.width();loadedHeight=$loaded.outerHeight(true);loadedWidth=$loaded.outerWidth(true);$box.css({"padding-bottom":interfaceHeight,"padding-right":interfaceWidth}).hide();$next.click(function(){publicMethod.next()});
$prev.click(function(){publicMethod.prev()});$close.click(function(){publicMethod.close()});$groupControls=$next.add($prev).add($current).add($slideshow);$content.children().removeClass("hover");$("."+boxElement).live("click",function(e){if(!(e.button!==0&&typeof e.button!=="undefined"||e.ctrlKey||e.shiftKey||e.altKey)){e.preventDefault();launch(this)}});$overlay.click(function(){if(settings.overlayClose)publicMethod.close()});$(document).bind("keydown",function(e){if(open&&settings.escKey&&e.keyCode===
27){e.preventDefault();publicMethod.close()}if(open&&settings.arrowKey&&!active&&$related[1])if(e.keyCode===37&&(index||settings.loop)){e.preventDefault();$prev.click()}else if(e.keyCode===39&&(index<$related.length-1||settings.loop)){e.preventDefault();$next.click()}})};publicMethod.remove=function(){$box.add($overlay).remove();$("."+boxElement).die("click").removeData(colorbox).removeClass(boxElement)};publicMethod.position=function(speed,loadedCallback){var animate_speed,posTop=Math.max(document.documentElement.clientHeight-
settings.h-loadedHeight-interfaceHeight,0)/2+$window.scrollTop(),posLeft=Math.max($window.width()-settings.w-loadedWidth-interfaceWidth,0)/2+$window.scrollLeft();animate_speed=$box.width()===settings.w+loadedWidth&&$box.height()===settings.h+loadedHeight?0:speed;$wrap[0].style.width=$wrap[0].style.height="9999px";function modalDimensions(that){$topBorder[0].style.width=$bottomBorder[0].style.width=$content[0].style.width=that.style.width;$loadingOverlay[0].style.height=$loadingOverlay[1].style.height=
$content[0].style.height=$leftBorder[0].style.height=$rightBorder[0].style.height=that.style.height}$box.dequeue().animate({width:settings.w+loadedWidth,height:settings.h+loadedHeight,top:posTop,left:posLeft},{duration:animate_speed,complete:function(){modalDimensions(this);active=false;$wrap[0].style.width=settings.w+loadedWidth+interfaceWidth+"px";$wrap[0].style.height=settings.h+loadedHeight+interfaceHeight+"px";if(loadedCallback)loadedCallback()},step:function(){modalDimensions(this)}})};publicMethod.resize=
function(options){if(open){options=options||{};if(options.width)settings.w=setSize(options.width,"x")-loadedWidth-interfaceWidth;if(options.innerWidth)settings.w=setSize(options.innerWidth,"x");$loaded.css({width:settings.w});if(options.height)settings.h=setSize(options.height,"y")-loadedHeight-interfaceHeight;if(options.innerHeight)settings.h=setSize(options.innerHeight,"y");if(!options.innerHeight&&!options.height){var $child=$loaded.wrapInner("<div style='overflow:auto'></div>").children();settings.h=
$child.height();$child.replaceWith($child.children())}$loaded.css({height:settings.h});publicMethod.position(settings.transition==="none"?0:settings.speed)}};publicMethod.prep=function(object){if(!open)return;var speed=settings.transition==="none"?0:settings.speed;$window.unbind("resize."+prefix);$loaded.remove();$loaded=$div("LoadedContent").html(object);function getWidth(){settings.w=settings.w||$loaded.width();settings.w=settings.mw&&settings.mw<settings.w?settings.mw:settings.w;return settings.w}
function getHeight(){settings.h=settings.h||$loaded.height();settings.h=settings.mh&&settings.mh<settings.h?settings.mh:settings.h;return settings.h}$loaded.hide().appendTo($loadingBay.show()).css({width:getWidth(),overflow:settings.scrolling?"auto":"hidden"}).css({height:getHeight()}).prependTo($content);$loadingBay.hide();$(photo).css({"float":"none"});if(isIE6)$("select").not($box.find("select")).filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one(event_cleanup,
function(){this.style.visibility="inherit"});function setPosition(s){publicMethod.position(s,function(){var prev,prevSrc,next,nextSrc,total=$related.length,iframe,complete;if(!open)return;complete=function(){$loadingOverlay.hide();trigger(event_complete,settings.onComplete)};if(isIE)if(photo)$loaded.fadeIn(100);$title.html(settings.title).add($loaded).show();if(total>1){if(typeof settings.current==="string")$current.html(settings.current.replace(/\{current\}/,index+1).replace(/\{total\}/,total)).show();
$next[settings.loop||index<total-1?"show":"hide"]().html(settings.next);$prev[settings.loop||index?"show":"hide"]().html(settings.previous);prev=index?$related[index-1]:$related[total-1];next=index<total-1?$related[index+1]:$related[0];if(settings.slideshow)$slideshow.show();if(settings.preloading){nextSrc=$.data(next,colorbox).href||next.href;prevSrc=$.data(prev,colorbox).href||prev.href;nextSrc=$.isFunction(nextSrc)?nextSrc.call(next):nextSrc;prevSrc=$.isFunction(prevSrc)?prevSrc.call(prev):prevSrc;
if(isImage(nextSrc))$("<img/>")[0].src=nextSrc;if(isImage(prevSrc))$("<img/>")[0].src=prevSrc}}else $groupControls.hide();if(settings.iframe){iframe=$("<iframe frameborder=0/>").addClass(prefix+"Iframe")[0];if(settings.fastIframe)complete();else $(iframe).load(complete);iframe.name=prefix+ +new Date;iframe.src=settings.href;if(!settings.scrolling)iframe.scrolling="no";if(isIE)iframe.allowTransparency="true";$(iframe).appendTo($loaded).one(event_purge,function(){iframe.src="//about:blank"})}else complete();
if(settings.transition==="fade")$box.fadeTo(speed,1,function(){$box[0].style.filter=""});else $box[0].style.filter="";$window.bind("resize."+prefix,function(){publicMethod.position(0)})})}if(settings.transition==="fade")$box.fadeTo(speed,0,function(){setPosition(0)});else setPosition(speed)};publicMethod.load=function(launched){var href,setResize,prep=publicMethod.prep;active=true;photo=false;element=$related[index];if(!launched)process($.extend(settings,$.data(element,colorbox)));trigger(event_purge);
trigger(event_load,settings.onLoad);settings.h=settings.height?setSize(settings.height,"y")-loadedHeight-interfaceHeight:settings.innerHeight&&setSize(settings.innerHeight,"y");settings.w=settings.width?setSize(settings.width,"x")-loadedWidth-interfaceWidth:settings.innerWidth&&setSize(settings.innerWidth,"x");settings.mw=settings.w;settings.mh=settings.h;if(settings.maxWidth){settings.mw=setSize(settings.maxWidth,"x")-loadedWidth-interfaceWidth;settings.mw=settings.w&&settings.w<settings.mw?settings.w:
settings.mw}if(settings.maxHeight){settings.mh=setSize(settings.maxHeight,"y")-loadedHeight-interfaceHeight;settings.mh=settings.h&&settings.h<settings.mh?settings.h:settings.mh}href=settings.href;$loadingOverlay.show();if(settings.inline){$div().hide().insertBefore($(href)[0]).one(event_purge,function(){$(this).replaceWith($loaded.children())});prep($(href))}else if(settings.iframe)prep(" ");else if(settings.html)prep(settings.html);else if(isImage(href)){$(photo=new Image).addClass(prefix+"Photo").error(function(){settings.title=
false;prep($div("Error").text("This image could not be loaded"))}).load(function(){var percent;photo.onload=null;if(settings.scalePhotos){setResize=function(){photo.height-=photo.height*percent;photo.width-=photo.width*percent};if(settings.mw&&photo.width>settings.mw){percent=(photo.width-settings.mw)/photo.width;setResize()}if(settings.mh&&photo.height>settings.mh){percent=(photo.height-settings.mh)/photo.height;setResize()}}if(settings.h)photo.style.marginTop=Math.max(settings.h-photo.height,0)/
2+"px";if($related[1]&&(index<$related.length-1||settings.loop)){photo.style.cursor="pointer";photo.onclick=function(){publicMethod.next()}}if(isIE)photo.style.msInterpolationMode="bicubic";setTimeout(function(){prep(photo)},1)});setTimeout(function(){photo.src=href},1)}else if(href)$loadingBay.load(href,function(data,status,xhr){prep(status==="error"?$div("Error").text("Request unsuccessful: "+xhr.statusText):$(this).contents())})};publicMethod.next=function(){if(!active){index=index<$related.length-
1?index+1:0;publicMethod.load()}};publicMethod.prev=function(){if(!active){index=index?index-1:$related.length-1;publicMethod.load()}};publicMethod.close=function(){if(open&&!closing){closing=true;open=false;trigger(event_cleanup,settings.onCleanup);$window.unbind("."+prefix+" ."+event_ie6);$overlay.fadeTo(200,0);$box.stop().fadeTo(300,0,function(){$box.add($overlay).css({opacity:1,cursor:"auto"}).hide();trigger(event_purge);$loaded.remove();setTimeout(function(){closing=false;trigger(event_closed,
settings.onClosed)},1)})}};publicMethod.element=function(){return $(element)};publicMethod.settings=defaults;$(publicMethod.init)})(jQuery,document,this);
(function($){var $scrollTo=$.scrollTo=function(target,duration,settings){$(window).scrollTo(target,duration,settings)};$scrollTo.defaults={axis:"xy",duration:parseFloat($.fn.jquery)>=1.3?0:1};$scrollTo.window=function(scope){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var elem=this,isWin=!elem.nodeName||$.inArray(elem.nodeName.toLowerCase(),["iframe","#document","html","body"])!=-1;if(!isWin)return elem;var doc=(elem.contentWindow||elem).document||elem.ownerDocument||
elem;return $.browser.safari||doc.compatMode=="BackCompat"?doc.body:doc.documentElement})};$.fn.scrollTo=function(target,duration,settings){if(typeof duration=="object"){settings=duration;duration=0}if(typeof settings=="function")settings={onAfter:settings};if(target=="max")target=9E9;settings=$.extend({},$scrollTo.defaults,settings);duration=duration||settings.speed||settings.duration;settings.queue=settings.queue&&settings.axis.length>1;if(settings.queue)duration/=2;settings.offset=both(settings.offset);
settings.over=both(settings.over);return this._scrollable().each(function(){var elem=this,$elem=$(elem),targ=target,toff,attr={},win=$elem.is("html,body");switch(typeof targ){case "number":case "string":if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=$(targ,this);case "object":if(targ.is||targ.style)toff=(targ=$(targ)).offset()}$.each(settings.axis.split(""),function(i,axis){var Pos=axis=="x"?"Left":"Top",pos=Pos.toLowerCase(),key="scroll"+Pos,old=elem[key],max=$scrollTo.max(elem,
axis);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(settings.margin){attr[key]-=parseInt(targ.css("margin"+Pos))||0;attr[key]-=parseInt(targ.css("border"+Pos+"Width"))||0}attr[key]+=settings.offset[pos]||0;if(settings.over[pos])attr[key]+=targ[axis=="x"?"width":"height"]()*settings.over[pos]}else{var val=targ[pos];attr[key]=val.slice&&val.slice(-1)=="%"?parseFloat(val)/100*max:val}if(/^\d+$/.test(attr[key]))attr[key]=attr[key]<=0?0:Math.min(attr[key],max);if(!i&&settings.queue){if(old!=
attr[key])animate(settings.onAfterFirst);delete attr[key]}});animate(settings.onAfter);function animate(callback){$elem.animate(attr,duration,settings.easing,callback&&function(){callback.call(this,target,settings)})}}).end()};$scrollTo.max=function(elem,axis){var Dim=axis=="x"?"Width":"Height",scroll="scroll"+Dim;if(!$(elem).is("html,body"))return elem[scroll]-$(elem)[Dim.toLowerCase()]();var size="client"+Dim,html=elem.ownerDocument.documentElement,body=elem.ownerDocument.body;return Math.max(html[scroll],
body[scroll])-Math.min(html[size],body[size])};function both(val){return typeof val=="object"?val:{top:val,left:val}}})(jQuery);
var OpenLayers={VERSION_NUMBER:"Release 2.11-rc1",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=typeof c.initialize=="function"?c.initialize:function(){b.apply(this,arguments)};a>1?(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.Class.isPrototype=function(){};OpenLayers.Class.create=function(){return function(){arguments&&arguments[0]!=OpenLayers.Class.isPrototype&&this.initialize.apply(this,arguments)}};
OpenLayers.Class.inherit=function(a){var b=function(){a.call(this)},c=[b].concat(Array.prototype.slice.call(arguments));OpenLayers.inherit.apply(null,c);return b.prototype};OpenLayers.inherit=function(a,b){var c=function(){};c.prototype=b.prototype;a.prototype=new c;var d,e,c=2;for(d=arguments.length;c<d;c++){e=arguments[c];if(typeof e==="function")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];d!==void 0&&(a[c]=d)}if(!(typeof window.Event=="function"&&b instanceof window.Event)&&b.hasOwnProperty&&b.hasOwnProperty("toString"))a.toString=b.toString}return a};
OpenLayers.Console={log:function(){},debug:function(){},info:function(){},warn:function(){},error:function(){},userError:function(a){alert(a)},assert:function(){},dir:function(){},dirxml:function(){},trace:function(){},group:function(){},groupEnd:function(){},time:function(){},timeEnd:function(){},profile:function(){},profileEnd:function(){},count:function(){},CLASS_NAME:"OpenLayers.Console"};
(function(){for(var a=document.getElementsByTagName("script"),b=0,c=a.length;b<c;++b)if(a[b].src.indexOf("firebug.js")!=-1&&console){OpenLayers.Util.extend(OpenLayers.Console,console);break}})();
OpenLayers.Control=OpenLayers.Class({id:null,map:null,div:null,type:null,allowSelection:!1,displayClass:"",title:"",autoActivate:!1,active:null,handler:null,eventListeners:null,events:null,EVENT_TYPES:["activate","deactivate"],initialize:function(a){this.displayClass=this.CLASS_NAME.replace("OpenLayers.","ol").replace(/\./g,"");OpenLayers.Util.extend(this,a);this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES);if(this.eventListeners instanceof Object)this.events.on(this.eventListeners);if(this.id==
null)this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){if(this.events)this.eventListeners&&this.events.un(this.eventListeners),this.events.destroy(),this.events=null;this.eventListeners=null;if(this.handler)this.handler.destroy(),this.handler=null;if(this.handlers){for(var a in this.handlers)this.handlers.hasOwnProperty(a)&&typeof this.handlers[a].destroy=="function"&&this.handlers[a].destroy();this.handlers=null}if(this.map)this.map.removeControl(this),this.map=null;
this.div=null},setMap:function(a){this.map=a;this.handler&&this.handler.setMap(a)},draw:function(a){if(this.div==null){this.div=OpenLayers.Util.createDiv(this.id);this.div.className=this.displayClass;if(!this.allowSelection)this.div.className+=" olControlNoSelect",this.div.setAttribute("unselectable","on",0),this.div.onselectstart=OpenLayers.Function.False;if(this.title!="")this.div.title=this.title}if(a!=null)this.position=a.clone();this.moveTo(this.position);return this.div},moveTo:function(a){if(a!=
null&&this.div!=null)this.div.style.left=a.x+"px",this.div.style.top=a.y+"px"},activate:function(){if(this.active)return!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.Control.Panel=OpenLayers.Class(OpenLayers.Control,{controls:null,autoActivate:!0,defaultControl:null,saveState:!1,allowDepress:!1,activeState:null,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,[a]);this.controls=[];this.activeState={}},destroy:function(){OpenLayers.Control.prototype.destroy.apply(this,arguments);for(var a,b=this.controls.length-1;b>=0;b--)a=this.controls[b],a.events&&a.events.un({activate:this.iconOn,deactivate:this.iconOff}),OpenLayers.Event.stopObservingElement(a.panel_div),
a.panel_div=null;this.activeState=null},activate:function(){if(OpenLayers.Control.prototype.activate.apply(this,arguments)){for(var a,b=0,c=this.controls.length;b<c;b++)a=this.controls[b],(a===this.defaultControl||this.saveState&&this.activeState[a.id])&&a.activate();if(this.saveState===!0)this.defaultControl=null;this.redraw();return!0}else return!1},deactivate:function(){if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)){for(var a,b=0,c=this.controls.length;b<c;b++)a=this.controls[b],
this.activeState[a.id]=a.deactivate();this.redraw();return!0}else return!1},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.addControlsToMap(this.controls);return this.div},redraw:function(){for(var a=this.div.childNodes.length-1;a>=0;a--)this.div.removeChild(this.div.childNodes[a]);this.div.innerHTML="";if(this.active)for(var a=0,b=this.controls.length;a<b;a++)this.div.appendChild(this.controls[a].panel_div)},activateControl:function(a){if(!this.active)return!1;if(a.type==
OpenLayers.Control.TYPE_BUTTON)a.trigger();else if(a.type==OpenLayers.Control.TYPE_TOGGLE)a.active?a.deactivate():a.activate();else if(this.allowDepress&&a.active)a.deactivate();else{for(var b,c=0,d=this.controls.length;c<d;c++)b=this.controls[c],b!=a&&(b.type===OpenLayers.Control.TYPE_TOOL||b.type==null)&&b.deactivate();a.activate()}},addControls:function(a){a instanceof Array||(a=[a]);this.controls=this.controls.concat(a);for(var b=0,c=a.length;b<c;b++){var d=document.createElement("div");d.className=
a[b].displayClass+"ItemInactive";a[b].panel_div=d;if(a[b].title!="")a[b].panel_div.title=a[b].title;OpenLayers.Event.observe(a[b].panel_div,"click",OpenLayers.Function.bind(this.onClick,this,a[b]));OpenLayers.Event.observe(a[b].panel_div,"dblclick",OpenLayers.Function.bind(this.onDoubleClick,this,a[b]));OpenLayers.Event.observe(a[b].panel_div,"mousedown",OpenLayers.Function.bindAsEventListener(OpenLayers.Event.stop))}this.map&&(this.addControlsToMap(a),this.redraw())},addControlsToMap:function(a){for(var b,
c=0,d=a.length;c<d;c++)b=a[c],b.autoActivate===!0?(b.autoActivate=!1,this.map.addControl(b),b.autoActivate=!0):(this.map.addControl(b),b.deactivate()),b.events.on({activate:this.iconOn,deactivate:this.iconOff})},iconOn:function(){var a=this.panel_div;a.className=a.className.replace(/ItemInactive$/,"ItemActive")},iconOff:function(){var a=this.panel_div;a.className=a.className.replace(/ItemActive$/,"ItemInactive")},onClick:function(a,b){OpenLayers.Event.stop(b?b:window.event);this.activateControl(a)},
onDoubleClick:function(a,b){OpenLayers.Event.stop(b?b:window.event)},getControlsBy:function(a,b){var c=typeof b.test=="function";return OpenLayers.Array.filter(this.controls,function(d){return d[a]==b||c&&b.test(d[a])})},getControlsByName:function(a){return this.getControlsBy("name",a)},getControlsByClass:function(a){return this.getControlsBy("CLASS_NAME",a)},CLASS_NAME:"OpenLayers.Control.Panel"});
OpenLayers.Control.ZoomIn=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){this.map.zoomIn()},CLASS_NAME:"OpenLayers.Control.ZoomIn"});OpenLayers.Control.ZoomOut=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){this.map.zoomOut()},CLASS_NAME:"OpenLayers.Control.ZoomOut"});
OpenLayers.Control.ZoomToMaxExtent=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){this.map&&this.map.zoomToMaxExtent()},CLASS_NAME:"OpenLayers.Control.ZoomToMaxExtent"});OpenLayers.Control.ZoomPanel=OpenLayers.Class(OpenLayers.Control.Panel,{initialize:function(a){OpenLayers.Control.Panel.prototype.initialize.apply(this,[a]);this.addControls([new OpenLayers.Control.ZoomIn,new OpenLayers.Control.ZoomToMaxExtent,new OpenLayers.Control.ZoomOut])},CLASS_NAME:"OpenLayers.Control.ZoomPanel"});
OpenLayers.Control.PanZoom=OpenLayers.Class(OpenLayers.Control,{slideFactor:50,slideRatio:null,buttons:null,position:null,initialize:function(a){this.position=new OpenLayers.Pixel(OpenLayers.Control.PanZoom.X,OpenLayers.Control.PanZoom.Y);OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.removeButtons();this.position=this.buttons=null;OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(a){OpenLayers.Control.prototype.draw.apply(this,arguments);
a=this.position;this.buttons=[];var b=new OpenLayers.Size(18,18),c=new OpenLayers.Pixel(a.x+b.w/2,a.y);this._addButton("panup","north-mini.png",c,b);a.y=c.y+b.h;this._addButton("panleft","west-mini.png",a,b);this._addButton("panright","east-mini.png",a.add(b.w,0),b);this._addButton("pandown","south-mini.png",c.add(0,b.h*2),b);this._addButton("zoomin","zoom-plus-mini.png",c.add(0,b.h*3+5),b);this._addButton("zoomworld","zoom-world-mini.png",c.add(0,b.h*4+5),b);this._addButton("zoomout","zoom-minus-mini.png",
c.add(0,b.h*5+5),b);return this.div},_addButton:function(a,b,c,d){b=OpenLayers.Util.getImagesLocation()+b;c=OpenLayers.Util.createAlphaImageDiv(this.id+"_"+a,c,d,b,"absolute");c.style.cursor="pointer";this.div.appendChild(c);OpenLayers.Event.observe(c,"mousedown",OpenLayers.Function.bindAsEventListener(this.buttonDown,c));OpenLayers.Event.observe(c,"dblclick",OpenLayers.Function.bindAsEventListener(this.doubleClick,c));OpenLayers.Event.observe(c,"click",OpenLayers.Function.bindAsEventListener(this.doubleClick,
c));c.action=a;c.map=this.map;if(this.slideRatio)var e=this.slideRatio,a=function(a){return this.map.getSize()[a]*e};else var f=this.slideFactor,a=function(){return f};c.getSlideFactor=a;this.buttons.push(c);return c},_removeButton:function(a){OpenLayers.Event.stopObservingElement(a);a.map=null;a.getSlideFactor=null;this.div.removeChild(a);OpenLayers.Util.removeItem(this.buttons,a)},removeButtons:function(){for(var a=this.buttons.length-1;a>=0;--a)this._removeButton(this.buttons[a])},doubleClick:function(a){OpenLayers.Event.stop(a);
return!1},buttonDown:function(a){if(OpenLayers.Event.isLeftClick(a)){switch(this.action){case "panup":this.map.pan(0,-this.getSlideFactor("h"));break;case "pandown":this.map.pan(0,this.getSlideFactor("h"));break;case "panleft":this.map.pan(-this.getSlideFactor("w"),0);break;case "panright":this.map.pan(this.getSlideFactor("w"),0);break;case "zoomin":this.map.zoomIn();break;case "zoomout":this.map.zoomOut();break;case "zoomworld":this.map.zoomToMaxExtent()}OpenLayers.Event.stop(a)}},CLASS_NAME:"OpenLayers.Control.PanZoom"});
OpenLayers.Control.PanZoom.X=4;OpenLayers.Control.PanZoom.Y=4;
OpenLayers.Control.PanZoomBar=OpenLayers.Class(OpenLayers.Control.PanZoom,{zoomStopWidth:18,zoomStopHeight:11,slider:null,sliderEvents:null,zoombarDiv:null,divEvents:null,zoomWorldIcon:!1,panIcons:!0,forceFixedZoomLevel:!1,mouseDragStart:null,deltaY:null,zoomStart:null,destroy:function(){this._removeZoomBar();this.map.events.un({changebaselayer:this.redraw,scope:this});OpenLayers.Control.PanZoom.prototype.destroy.apply(this,arguments);delete this.mouseDragStart;delete this.zoomStart},setMap:function(a){OpenLayers.Control.PanZoom.prototype.setMap.apply(this,
arguments);this.map.events.register("changebaselayer",this,this.redraw)},redraw:function(){this.div!=null&&(this.removeButtons(),this._removeZoomBar());this.draw()},draw:function(a){OpenLayers.Control.prototype.draw.apply(this,arguments);a=this.position.clone();this.buttons=[];var b=new OpenLayers.Size(18,18);if(this.panIcons){var c=new OpenLayers.Pixel(a.x+b.w/2,a.y),d=b.w;this.zoomWorldIcon&&(c=new OpenLayers.Pixel(a.x+b.w,a.y));this._addButton("panup","north-mini.png",c,b);a.y=c.y+b.h;this._addButton("panleft",
"west-mini.png",a,b);this.zoomWorldIcon&&(this._addButton("zoomworld","zoom-world-mini.png",a.add(b.w,0),b),d*=2);this._addButton("panright","east-mini.png",a.add(d,0),b);this._addButton("pandown","south-mini.png",c.add(0,b.h*2),b);this._addButton("zoomin","zoom-plus-mini.png",c.add(0,b.h*3+5),b);c=this._addZoomBar(c.add(0,b.h*4+5));this._addButton("zoomout","zoom-minus-mini.png",c,b)}else this._addButton("zoomin","zoom-plus-mini.png",a,b),c=this._addZoomBar(a.add(0,b.h)),this._addButton("zoomout",
"zoom-minus-mini.png",c,b),this.zoomWorldIcon&&(c=c.add(0,b.h+3),this._addButton("zoomworld","zoom-world-mini.png",c,b));return this.div},_addZoomBar:function(a){var b=OpenLayers.Util.getImagesLocation(),c=this.id+"_"+this.map.id,d=this.map.getNumZoomLevels()-1-this.map.getZoom(),d=OpenLayers.Util.createAlphaImageDiv(c,a.add(-1,d*this.zoomStopHeight),new OpenLayers.Size(20,9),b+"slider.png","absolute");d.style.cursor="move";this.slider=d;this.sliderEvents=new OpenLayers.Events(this,d,null,!0,{includeXY:!0});
this.sliderEvents.on({touchstart:this.zoomBarDown,touchmove:this.zoomBarDrag,touchend:this.zoomBarUp,mousedown:this.zoomBarDown,mousemove:this.zoomBarDrag,mouseup:this.zoomBarUp,dblclick:this.doubleClick,click:this.doubleClick});var e=new OpenLayers.Size;e.h=this.zoomStopHeight*this.map.getNumZoomLevels();e.w=this.zoomStopWidth;c=null;OpenLayers.Util.alphaHack()?(c=this.id+"_"+this.map.id,c=OpenLayers.Util.createAlphaImageDiv(c,a,new OpenLayers.Size(e.w,this.zoomStopHeight),b+"zoombar.png","absolute",
null,"crop"),c.style.height=e.h+"px"):c=OpenLayers.Util.createDiv("OpenLayers_Control_PanZoomBar_Zoombar"+this.map.id,a,e,b+"zoombar.png");c.style.cursor="pointer";this.zoombarDiv=c;this.divEvents=new OpenLayers.Events(this,c,null,!0,{includeXY:!0});this.divEvents.on({touchmove:this.passEventToSlider,mousedown:this.divClick,mousemove:this.passEventToSlider,dblclick:this.doubleClick,click:this.doubleClick});this.div.appendChild(c);this.startTop=parseInt(c.style.top);this.div.appendChild(d);this.map.events.register("zoomend",
this,this.moveZoomBar);return a=a.add(0,this.zoomStopHeight*this.map.getNumZoomLevels())},_removeZoomBar:function(){this.sliderEvents.un({touchmove:this.zoomBarDrag,mousedown:this.zoomBarDown,mousemove:this.zoomBarDrag,mouseup:this.zoomBarUp,dblclick:this.doubleClick,click:this.doubleClick});this.sliderEvents.destroy();this.divEvents.un({touchmove:this.passEventToSlider,mousedown:this.divClick,mousemove:this.passEventToSlider,dblclick:this.doubleClick,click:this.doubleClick});this.divEvents.destroy();
this.div.removeChild(this.zoombarDiv);this.zoombarDiv=null;this.div.removeChild(this.slider);this.slider=null;this.map.events.unregister("zoomend",this,this.moveZoomBar)},passEventToSlider:function(a){this.sliderEvents.handleBrowserEvent(a)},divClick:function(a){if(OpenLayers.Event.isLeftClick(a)){var b=a.xy.y/this.zoomStopHeight;if(this.forceFixedZoomLevel||!this.map.fractionalZoom)b=Math.floor(b);b=this.map.getNumZoomLevels()-1-b;b=Math.min(Math.max(b,0),this.map.getNumZoomLevels()-1);this.map.zoomTo(b);
OpenLayers.Event.stop(a)}},zoomBarDown:function(a){if(OpenLayers.Event.isLeftClick(a)||OpenLayers.Event.isSingleTouch(a))this.map.events.on({touchmove:this.passEventToSlider,mousemove:this.passEventToSlider,mouseup:this.passEventToSlider,scope:this}),this.mouseDragStart=a.xy.clone(),this.zoomStart=a.xy.clone(),this.div.style.cursor="move",this.zoombarDiv.offsets=null,OpenLayers.Event.stop(a)},zoomBarDrag:function(a){if(this.mouseDragStart!=null){var b=this.mouseDragStart.y-a.xy.y,c=OpenLayers.Util.pagePosition(this.zoombarDiv);
if(a.clientY-c[1]>0&&a.clientY-c[1]<parseInt(this.zoombarDiv.style.height)-2)this.slider.style.top=parseInt(this.slider.style.top)-b+"px",this.mouseDragStart=a.xy.clone();this.deltaY=this.zoomStart.y-a.xy.y;OpenLayers.Event.stop(a)}},zoomBarUp:function(a){if((OpenLayers.Event.isLeftClick(a)||a.type==="touchend")&&this.mouseDragStart){this.div.style.cursor="";this.map.events.un({touchmove:this.passEventToSlider,mouseup:this.passEventToSlider,mousemove:this.passEventToSlider,scope:this});var b=this.map.zoom;
!this.forceFixedZoomLevel&&this.map.fractionalZoom?(b+=this.deltaY/this.zoomStopHeight,b=Math.min(Math.max(b,0),this.map.getNumZoomLevels()-1)):(b+=this.deltaY/this.zoomStopHeight,b=Math.max(Math.round(b),0));this.map.zoomTo(b);this.zoomStart=this.mouseDragStart=null;this.deltaY=0;OpenLayers.Event.stop(a)}},moveZoomBar:function(){this.slider.style.top=(this.map.getNumZoomLevels()-1-this.map.getZoom())*this.zoomStopHeight+this.startTop+1+"px"},CLASS_NAME:"OpenLayers.Control.PanZoomBar"});
OpenLayers.Lang={code:null,defaultCode:"en",getCode:function(){OpenLayers.Lang.code||OpenLayers.Lang.setCode();return OpenLayers.Lang.code},setCode:function(a){var b;a||(a=OpenLayers.BROWSER_NAME=="msie"?navigator.userLanguage:navigator.language);a=a.split("-");a[0]=a[0].toLowerCase();typeof OpenLayers.Lang[a[0]]=="object"&&(b=a[0]);if(a[1]){var c=a[0]+"-"+a[1].toUpperCase();typeof OpenLayers.Lang[c]=="object"&&(b=c)}if(!b)OpenLayers.Console.warn("Failed to find OpenLayers.Lang."+a.join("-")+" dictionary, falling back to default language"),
b=OpenLayers.Lang.defaultCode;OpenLayers.Lang.code=b},translate:function(a,b){var c=OpenLayers.Lang[OpenLayers.Lang.getCode()];(c=c&&c[a])||(c=a);b&&(c=OpenLayers.String.format(c,b));return c}};OpenLayers.i18n=OpenLayers.Lang.translate;
OpenLayers.String={startsWith:function(a,b){return a.indexOf(b)==0},contains:function(a,b){return a.indexOf(b)!=-1},trim:function(a){return a.replace(/^\s\s*/,"").replace(/\s\s*$/,"")},camelize:function(a){for(var a=a.split("-"),b=a[0],c=1,d=a.length;c<d;c++){var e=a[c];b+=e.charAt(0).toUpperCase()+e.substring(1)}return b},format:function(a,b,c){b||(b=window);return a.replace(OpenLayers.String.tokenRegEx,function(a,e){for(var f,g=e.split(/\.+/),h=0;h<g.length;h++)h==0&&(f=b),f=f[g[h]];typeof f=="function"&&
(f=c?f.apply(null,c):f());return typeof f=="undefined"?"undefined":f})},tokenRegEx:/\$\{([\w.]+?)\}/g,numberRegEx:/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,isNumeric:function(a){return OpenLayers.String.numberRegEx.test(a)},numericIf:function(a){return OpenLayers.String.isNumeric(a)?parseFloat(a):a}};
if(!String.prototype.startsWith)String.prototype.startsWith=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.String.startsWith"}));return OpenLayers.String.startsWith(this,a)};if(!String.prototype.contains)String.prototype.contains=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.String.contains"}));return OpenLayers.String.contains(this,a)};
if(!String.prototype.trim)String.prototype.trim=function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.String.trim"}));return OpenLayers.String.trim(this)};if(!String.prototype.camelize)String.prototype.camelize=function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.String.camelize"}));return OpenLayers.String.camelize(this)};
OpenLayers.Number={decimalSeparator:".",thousandsSeparator:",",limitSigDigs:function(a,b){var c=0;b>0&&(c=parseFloat(a.toPrecision(b)));return c},format:function(a,b,c,d){b=typeof b!="undefined"?b:0;c=typeof c!="undefined"?c:OpenLayers.Number.thousandsSeparator;d=typeof d!="undefined"?d:OpenLayers.Number.decimalSeparator;b!=null&&(a=parseFloat(a.toFixed(b)));var e=a.toString().split(".");e.length==1&&b==null&&(b=0);a=e[0];if(c)for(var f=/(-?[0-9]+)([0-9]{3})/;f.test(a);)a=a.replace(f,"$1"+c+"$2");
b==0?b=a:(c=e.length>1?e[1]:"0",b!=null&&(c+=Array(b-c.length+1).join("0")),b=a+d+c);return b}};if(!Number.prototype.limitSigDigs)Number.prototype.limitSigDigs=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Number.limitSigDigs"}));return OpenLayers.Number.limitSigDigs(this,a)};
OpenLayers.Function={bind:function(a,b){var c=Array.prototype.slice.apply(arguments,[2]);return function(){var d=c.concat(Array.prototype.slice.apply(arguments,[0]));return a.apply(b,d)}},bindAsEventListener:function(a,b){return function(c){return a.call(b,c||window.event)}},False:function(){return!1},True:function(){return!0},Void:function(){}};
if(!Function.prototype.bind)Function.prototype.bind=function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Function.bind"}));Array.prototype.unshift.apply(arguments,[this]);return OpenLayers.Function.bind.apply(null,arguments)};
if(!Function.prototype.bindAsEventListener)Function.prototype.bindAsEventListener=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Function.bindAsEventListener"}));return OpenLayers.Function.bindAsEventListener(this,a)};OpenLayers.Array={filter:function(a,b,c){var d=[];if(Array.prototype.filter)d=a.filter(b,c);else{var e=a.length;if(typeof b!="function")throw new TypeError;for(var f=0;f<e;f++)if(f in a){var g=a[f];b.call(c,g,f,a)&&d.push(g)}}return d}};
OpenLayers.Date={toISOString:function(){if("toISOString"in Date.prototype)return function(a){return a.toISOString()};else{var a=function(a,c){for(var d=a+"";d.length<c;)d="0"+d;return d};return function(b){return isNaN(b.getTime())?"Invalid Date":b.getUTCFullYear()+"-"+a(b.getUTCMonth()+1,2)+"-"+a(b.getUTCDate(),2)+"T"+a(b.getUTCHours(),2)+":"+a(b.getUTCMinutes(),2)+":"+a(b.getUTCSeconds(),2)+"."+a(b.getUTCMilliseconds(),3)+"Z"}}}(),parse:function(a){var b;if((a=a.match(/^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))?$/))&&
(a[1]||a[7])){b=parseInt(a[1],10)||0;var c=parseInt(a[2],10)-1||0,d=parseInt(a[3],10)||1;b=new Date(Date.UTC(b,c,d));if(c=a[7]){var d=parseInt(a[4],10),e=parseInt(a[5],10),f=parseFloat(a[6]),g=f|0;b.setUTCHours(d,e,g,Math.round(1E3*(f-g)));c!=="Z"&&(c=parseInt(c,10),a=parseInt(a[8],10)||0,b=new Date(b.getTime()+-1E3*(60*c*60+a*60)))}}else b=new Date("invalid");return b}};
OpenLayers.Bounds=OpenLayers.Class({left:null,bottom:null,right:null,top:null,centerLonLat:null,initialize:function(a,b,c,d){if(a!=null)this.left=OpenLayers.Util.toFloat(a);if(b!=null)this.bottom=OpenLayers.Util.toFloat(b);if(c!=null)this.right=OpenLayers.Util.toFloat(c);if(d!=null)this.top=OpenLayers.Util.toFloat(d)},clone:function(){return new OpenLayers.Bounds(this.left,this.bottom,this.right,this.top)},equals:function(a){var b=!1;a!=null&&(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 a===!0?[this.bottom,this.left,this.top,this.right]:[this.left,this.bottom,this.right,this.top]},toBBOX:function(a,b){a==null&&(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 b===!0?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){b==null&&(b=this.getCenterLonLat());var c,d;b.CLASS_NAME=="OpenLayers.LonLat"?(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(a==null||b==null){var c=OpenLayers.i18n("boundsAddError");OpenLayers.Console.error(c);return null}return new OpenLayers.Bounds(this.left+a,this.bottom+
b,this.right+a,this.top+b)},extend:function(a){var b=null;if(a){switch(a.CLASS_NAME){case "OpenLayers.LonLat":b=new OpenLayers.Bounds(a.lon,a.lat,a.lon,a.lat);break;case "OpenLayers.Geometry.Point":b=new OpenLayers.Bounds(a.x,a.y,a.x,a.y);break;case "OpenLayers.Bounds":b=a}if(b){this.centerLonLat=null;if(this.left==null||b.left<this.left)this.left=b.left;if(this.bottom==null||b.bottom<this.bottom)this.bottom=b.bottom;if(this.right==null||b.right>this.right)this.right=b.right;if(this.top==null||b.top>
this.top)this.top=b.top}}},containsLonLat:function(a,b){return this.contains(a.lon,a.lat,b)},containsPixel:function(a,b){return this.contains(a.x,a.y,b)},contains:function(a,b,c){c==null&&(c=!0);if(a==null||b==null)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){b==null&&(b=!0);var c=!1,d=this.left==a.right||this.right==
a.left||this.top==a.bottom||this.bottom==a.top;if(b||!d)var c=a.top>=this.bottom&&a.top<=this.top||this.top>a.bottom&&this.top<a.top,d=a.left>=this.left&&a.left<=this.right||this.left>=a.left&&this.left<=a.right,e=a.right>=this.left&&a.right<=this.right||this.right>=a.left&&this.right<=a.right,c=(a.bottom>=this.bottom&&a.bottom<=this.top||this.bottom>=a.bottom&&this.bottom<=a.top||c)&&(d||e);return c},containsBounds:function(a,b,c){b==null&&(b=!1);c==null&&(c=!0);var d=this.contains(a.left,a.bottom,
c),e=this.contains(a.right,a.bottom,c),f=this.contains(a.left,a.top,c),a=this.contains(a.right,a.top,c);return b?d||e||f||a:d&&e&&f&&a},determineQuadrant:function(a){var b="",c=this.getCenterLonLat();b+=a.lat<c.lat?"b":"t";b+=a.lon<c.lon?"l":"r";return b},transform:function(a,b){this.centerLonLat=null;var c=OpenLayers.Projection.transform({x:this.left,y:this.bottom},a,b),d=OpenLayers.Projection.transform({x:this.right,y:this.bottom},a,b),e=OpenLayers.Projection.transform({x:this.left,y:this.top},
a,b),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(;e.left<a.left&&e.right-d<=a.left;)e=e.add(a.getWidth(),0);for(;e.left+c>=a.right&&e.right>a.right;)e=e.add(-a.getWidth(),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 b===!0?new OpenLayers.Bounds(parseFloat(a[1]),parseFloat(a[0]),parseFloat(a[3]),parseFloat(a[2])):new OpenLayers.Bounds(parseFloat(a[0]),parseFloat(a[1]),parseFloat(a[2]),parseFloat(a[3]))};OpenLayers.Bounds.fromSize=function(a){return new OpenLayers.Bounds(0,a.h,a.w,0)};
OpenLayers.Bounds.oppositeQuadrant=function(a){var b="";b+=a.charAt(0)=="t"?"b":"t";b+=a.charAt(1)=="l"?"r":"l";return b};
OpenLayers.Element={visible:function(a){return OpenLayers.Util.getElement(a).style.display!="none"},toggle:function(){for(var a=0,b=arguments.length;a<b;a++){var c=OpenLayers.Util.getElement(arguments[a]),d=OpenLayers.Element.visible(c)?"hide":"show";OpenLayers.Element[d](c)}},hide:function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"element.style.display = 'none';"}));for(var a=0,b=arguments.length;a<b;a++){var c=OpenLayers.Util.getElement(arguments[a]);if(c)c.style.display=
"none"}},show:function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"element.style.display = '';"}));for(var a=0,b=arguments.length;a<b;a++){var c=OpenLayers.Util.getElement(arguments[a]);if(c)c.style.display=""}},remove:function(a){a=OpenLayers.Util.getElement(a);a.parentNode.removeChild(a)},getHeight:function(a){a=OpenLayers.Util.getElement(a);return a.offsetHeight},getDimensions:function(a){a=OpenLayers.Util.getElement(a);if(OpenLayers.Element.getStyle(a,"display")!=
"none")return{width:a.offsetWidth,height:a.offsetHeight};var b=a.style,c=b.visibility,d=b.position,e=b.display;b.visibility="hidden";b.position="absolute";b.display="";var f=a.clientWidth,a=a.clientHeight;b.display=e;b.position=d;b.visibility=c;return{width:f,height:a}},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&&OpenLayers.Util.indexOf(d,b)!=-1&&OpenLayers.Element.getStyle(a,"position")=="static"&&(c="auto")}return c=="auto"?null:c}};
OpenLayers.LonLat=OpenLayers.Class({lon:0,lat:0,initialize:function(a,b){this.lon=OpenLayers.Util.toFloat(a);this.lat=OpenLayers.Util.toFloat(b)},toString:function(){return"lon="+this.lon+",lat="+this.lat},toShortString:function(){return this.lon+", "+this.lat},clone:function(){return new OpenLayers.LonLat(this.lon,this.lat)},add:function(a,b){if(a==null||b==null){var c=OpenLayers.i18n("lonlatAddError");OpenLayers.Console.error(c);return null}return new OpenLayers.LonLat(this.lon+OpenLayers.Util.toFloat(a),
this.lat+OpenLayers.Util.toFloat(b))},equals:function(a){var b=!1;a!=null&&(b=this.lon==a.lon&&this.lat==a.lat||isNaN(this.lon)&&isNaN(this.lat)&&isNaN(a.lon)&&isNaN(a.lat));return b},transform:function(a,b){var c=OpenLayers.Projection.transform({x:this.lon,y:this.lat},a,b);this.lon=c.x;this.lat=c.y;return this},wrapDateLine:function(a){var b=this.clone();if(a){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.Pixel=OpenLayers.Class({x:0,y:0,initialize:function(a,b){this.x=parseFloat(a);this.y=parseFloat(b)},toString:function(){return"x="+this.x+",y="+this.y},clone:function(){return new OpenLayers.Pixel(this.x,this.y)},equals:function(a){var b=!1;a!=null&&(b=this.x==a.x&&this.y==a.y||isNaN(this.x)&&isNaN(this.y)&&isNaN(a.x)&&isNaN(a.y));return b},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(a==null||b==null){var c=OpenLayers.i18n("pixelAddError");
OpenLayers.Console.error(c);return null}return new OpenLayers.Pixel(this.x+a,this.y+b)},offset:function(a){var b=this.clone();a&&(b=this.add(a.x,a.y));return b},CLASS_NAME:"OpenLayers.Pixel"});
OpenLayers.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;a!=null&&(b=this.w==a.w&&this.h==a.h||isNaN(this.w)&&isNaN(this.h)&&isNaN(a.w)&&isNaN(a.h));return b},CLASS_NAME:"OpenLayers.Size"});OpenLayers.Util=OpenLayers.Util||{};
OpenLayers.Util.getElement=function(){for(var a=[],b=0,c=arguments.length;b<c;b++){var d=arguments[b];typeof d=="string"&&(d=document.getElementById(d));if(arguments.length==1)return d;a.push(d)}return a};OpenLayers.Util.isElement=function(a){return!!(a&&a.nodeType===1)};if(typeof window.$==="undefined")window.$=OpenLayers.Util.getElement;OpenLayers.Util.removeItem=function(a,b){for(var c=a.length-1;c>=0;c--)a[c]==b&&a.splice(c,1);return a};
OpenLayers.Util.clearArray=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"array = []"}));a.length=0};OpenLayers.Util.indexOf=function(a,b){if(typeof a.indexOf=="function")return a.indexOf(b);else{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(parseFloat(h)>=0&&parseFloat(h)<1)a.style.filter="alpha(opacity="+h*100+")",a.style.opacity=h;else if(parseFloat(h)==1)a.style.filter="",a.style.opacity=""};
OpenLayers.Util.createDiv=function(a,b,c,d,e,f,g,h){var i=document.createElement("div");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",OpenLayers.Event.observe(i,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,i)),OpenLayers.Event.observe(i,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,i));i.style.alt=a;i.galleryImg="no";if(d)i.src=d;return i};
OpenLayers.Util.setOpacity=function(a,b){OpenLayers.Util.modifyDOMElement(a,null,null,null,null,null,null,b)};OpenLayers.Util.onImageLoad=function(){if(!this.viewRequestID||this.map&&this.viewRequestID==this.map.viewRequestID)this.style.display="";OpenLayers.Element.removeClass(this,"olImageLoadError")};OpenLayers.IMAGE_RELOAD_ATTEMPTS=0;
OpenLayers.Util.onImageLoadError=function(){this._attempts=this._attempts?this._attempts+1:1;if(this._attempts<=OpenLayers.IMAGE_RELOAD_ATTEMPTS){var a=this.urls;if(a&&a instanceof Array&&a.length>1){var b=this.src.toString(),c,d;for(d=0;c=a[d];d++)if(b.indexOf(c)!=-1)break;var e=Math.floor(a.length*Math.random()),e=a[e];for(d=0;e==c&&d++<4;)e=Math.floor(a.length*Math.random()),e=a[e];this.src=b.replace(c,e)}else this.src=this.src}else OpenLayers.Element.addClass(this,"olImageLoadError");this.style.display=
""};OpenLayers.Util.alphaHackNeeded=null;OpenLayers.Util.alphaHack=function(){if(OpenLayers.Util.alphaHackNeeded==null){var a=navigator.appVersion.split("MSIE"),a=parseFloat(a[1]),b=!1;try{b=!!document.body.filters}catch(c){}OpenLayers.Util.alphaHackNeeded=b&&a>=5.5&&a<7}return OpenLayers.Util.alphaHackNeeded};
OpenLayers.Util.modifyAlphaImageDiv=function(a,b,c,d,e,f,g,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(a.style.display!="none")a.style.display="inline-block";h==null&&(h="scale");a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+b.src+"', sizingMethod='"+h+"')";parseFloat(a.style.opacity)>=0&&parseFloat(a.style.opacity)<
1&&(a.style.filter+=" alpha(opacity="+a.style.opacity*100+")");b.style.filter="alpha(opacity=0)"}};
OpenLayers.Util.createAlphaImageDiv=function(a,b,c,d,e,f,g,h,i){var j=OpenLayers.Util.createDiv(),k=OpenLayers.Util.createImage(null,null,null,null,null,null,null,!1);j.appendChild(k);if(i)k.style.display="none",OpenLayers.Event.observe(k,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,j)),OpenLayers.Event.observe(k,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,j));OpenLayers.Util.modifyAlphaImageDiv(j,a,b,c,d,e,f,g,h);return j};
OpenLayers.Util.upperCaseObject=function(a){var b={},c;for(c in a)b[c.toUpperCase()]=a[c];return b};OpenLayers.Util.applyDefaults=function(a,b){var a=a||{},c=typeof window.Event=="function"&&b instanceof window.Event,d;for(d in b)if(a[d]===void 0||!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(d!=null&&typeof d!="function"){if(typeof d=="object"&&d.constructor==Array){for(var e=[],f,g=0,h=d.length;g<h;g++)f=d[g],e.push(encodeURIComponent(f===null||f===void 0?"":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+=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.getNodes=function(a,b){return OpenLayers.Util.Try(function(){return OpenLayers.Util._getNodes(a.documentElement.childNodes,b)},function(){return OpenLayers.Util._getNodes(a.childNodes,b)})};
OpenLayers.Util._getNodes=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)a[d].nodeName==b&&c.push(a[d]);return c};OpenLayers.Util.getTagText=function(a,b,c){if((a=OpenLayers.Util.getNodes(a,b))&&a.length>0)if(c||(c=0),a[c].childNodes.length>1)return a.childNodes[1].nodeValue;else{if(a[c].childNodes.length==1)return a[c].firstChild.nodeValue}else return""};
OpenLayers.Util.getXmlNodeValue=function(a){var b=null;OpenLayers.Util.Try(function(){b=a.text;if(!b)b=a.textContent;if(!b)b=a.firstChild.nodeValue},function(){b=a.textContent});return b};OpenLayers.Util.mouseLeft=function(a,b){for(var c=a.relatedTarget?a.relatedTarget:a.toElement;c!=b&&c!=null;)c=c.parentNode;return c!=b};OpenLayers.Util.DEFAULT_PRECISION=14;
OpenLayers.Util.toFloat=function(a,b){if(b==null)b=OpenLayers.Util.DEFAULT_PRECISION;typeof a!=="number"&&(a=parseFloat(a));return b===0?a:parseFloat(a.toPrecision(b))};OpenLayers.Util.rad=function(a){return a*Math.PI/180};OpenLayers.Util.deg=function(a){return a*180/Math.PI};OpenLayers.Util.VincentyConstants={a:6378137,b:6356752.3142,f:1/298.257223563};
OpenLayers.Util.distVincenty=function(a,b){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),j=Math.sin(h),h=Math.cos(h),k=f,m=2*Math.PI,n=20;Math.abs(k-m)>1.0E-12&&--n>0;){var l=Math.sin(k),o=Math.cos(k),r=Math.sqrt(h*l*h*l+(g*j-i*h*o)*(g*j-i*h*o));if(r==0)return 0;var o=i*j+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*j/s,t=c/16*s*(4+c*(4-3*s)),m=k,k=f+(1-t)*c*Math.sin(p)*(q+t*r*(l+t*o*(-1+2*l*l)))}if(n==0)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,e=e.f,h=a.lon,i=a.lat,a=d.rad(b),b=Math.sin(a),a=Math.cos(a),j=(1-e)*Math.tan(d.rad(i)),i=1/Math.sqrt(1+j*j),k=j*i,m=Math.atan2(j,a),j=i*b,n=1-j*j,f=n*(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;Math.abs(f-r)>1.0E-12;)var q=Math.cos(2*m+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=k*p-i*s*a;c=Math.atan2(k*s+i*p*a,(1-e)*Math.sqrt(j*j+c*c));g=e/16*n*(4+e*(4-3*n));return new OpenLayers.LonLat(h+d.deg(Math.atan2(p*b,i*s-k*p*a)-(1-g)*e*j*(f+g*p*(q+g*s*(-1+2*q*q)))),d.deg(c))};
OpenLayers.Util.getParameters=function(a){var a=a||window.location.href,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(",");e.length==1&&(e=e[0]);a[f]=e}}return a};
OpenLayers.Util.getArgs=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Util.getParameters"}));return OpenLayers.Util.getParameters(a)};OpenLayers.Util.lastSeqID=0;OpenLayers.Util.createUniqueID=function(a){a==null&&(a="id_");OpenLayers.Util.lastSeqID+=1;return a+OpenLayers.Util.lastSeqID};OpenLayers.INCHES_PER_UNIT={inches:1,ft:12,mi:63360,m:39.3701,km:39370.1,dd:4374754,yd:36};OpenLayers.INCHES_PER_UNIT["in"]=OpenLayers.INCHES_PER_UNIT.inches;
OpenLayers.INCHES_PER_UNIT.degrees=OpenLayers.INCHES_PER_UNIT.dd;OpenLayers.INCHES_PER_UNIT.nmi=1852*OpenLayers.INCHES_PER_UNIT.m;OpenLayers.METERS_PER_INCH=0.0254000508001016;
OpenLayers.Util.extend(OpenLayers.INCHES_PER_UNIT,{Inch:OpenLayers.INCHES_PER_UNIT.inches,Meter:1/OpenLayers.METERS_PER_INCH,Foot:0.3048006096012192/OpenLayers.METERS_PER_INCH,IFoot:0.3048/OpenLayers.METERS_PER_INCH,ClarkeFoot:0.3047972651151/OpenLayers.METERS_PER_INCH,SearsFoot:0.30479947153867626/OpenLayers.METERS_PER_INCH,GoldCoastFoot:0.3047997101815088/OpenLayers.METERS_PER_INCH,IInch:0.0254/OpenLayers.METERS_PER_INCH,MicroInch:2.54E-5/OpenLayers.METERS_PER_INCH,Mil:2.54E-8/OpenLayers.METERS_PER_INCH,
Centimeter:0.01/OpenLayers.METERS_PER_INCH,Kilometer:1E3/OpenLayers.METERS_PER_INCH,Yard:0.9144018288036576/OpenLayers.METERS_PER_INCH,SearsYard:0.914398414616029/OpenLayers.METERS_PER_INCH,IndianYard:0.9143985307444408/OpenLayers.METERS_PER_INCH,IndianYd37:0.91439523/OpenLayers.METERS_PER_INCH,IndianYd62:0.9143988/OpenLayers.METERS_PER_INCH,IndianYd75:0.9143985/OpenLayers.METERS_PER_INCH,IndianFoot:0.30479951/OpenLayers.METERS_PER_INCH,IndianFt37:0.30479841/OpenLayers.METERS_PER_INCH,IndianFt62:0.3047996/
OpenLayers.METERS_PER_INCH,IndianFt75:0.3047995/OpenLayers.METERS_PER_INCH,Mile:1609.3472186944373/OpenLayers.METERS_PER_INCH,IYard:0.9144/OpenLayers.METERS_PER_INCH,IMile:1609.344/OpenLayers.METERS_PER_INCH,NautM:1852/OpenLayers.METERS_PER_INCH,"Lat-66":110943.31648893273/OpenLayers.METERS_PER_INCH,"Lat-83":110946.25736872235/OpenLayers.METERS_PER_INCH,Decimeter:0.1/OpenLayers.METERS_PER_INCH,Millimeter:0.0010/OpenLayers.METERS_PER_INCH,Dekameter:10/OpenLayers.METERS_PER_INCH,Decameter:10/OpenLayers.METERS_PER_INCH,
Hectometer:100/OpenLayers.METERS_PER_INCH,GermanMeter:1.0000135965/OpenLayers.METERS_PER_INCH,CaGrid:0.999738/OpenLayers.METERS_PER_INCH,ClarkeChain:20.1166194976/OpenLayers.METERS_PER_INCH,GunterChain:20.11684023368047/OpenLayers.METERS_PER_INCH,BenoitChain:20.116782494375872/OpenLayers.METERS_PER_INCH,SearsChain:20.11676512155/OpenLayers.METERS_PER_INCH,ClarkeLink:0.201166194976/OpenLayers.METERS_PER_INCH,GunterLink:0.2011684023368047/OpenLayers.METERS_PER_INCH,BenoitLink:0.20116782494375873/OpenLayers.METERS_PER_INCH,
SearsLink:0.2011676512155/OpenLayers.METERS_PER_INCH,Rod:5.02921005842012/OpenLayers.METERS_PER_INCH,IntnlChain:20.1168/OpenLayers.METERS_PER_INCH,IntnlLink:0.201168/OpenLayers.METERS_PER_INCH,Perch:5.02921005842012/OpenLayers.METERS_PER_INCH,Pole:5.02921005842012/OpenLayers.METERS_PER_INCH,Furlong:201.1684023368046/OpenLayers.METERS_PER_INCH,Rood:3.778266898/OpenLayers.METERS_PER_INCH,CapeFoot:0.3047972615/OpenLayers.METERS_PER_INCH,Brealey:375/OpenLayers.METERS_PER_INCH,ModAmFt:0.304812252984506/
OpenLayers.METERS_PER_INCH,Fathom:1.8288/OpenLayers.METERS_PER_INCH,"NautM-UK":1853.184/OpenLayers.METERS_PER_INCH,"50kilometers":5E4/OpenLayers.METERS_PER_INCH,"150kilometers":15E4/OpenLayers.METERS_PER_INCH});
OpenLayers.Util.extend(OpenLayers.INCHES_PER_UNIT,{mm:OpenLayers.INCHES_PER_UNIT.Meter/1E3,cm:OpenLayers.INCHES_PER_UNIT.Meter/100,dm:OpenLayers.INCHES_PER_UNIT.Meter*100,km:OpenLayers.INCHES_PER_UNIT.Meter*1E3,kmi:OpenLayers.INCHES_PER_UNIT.nmi,fath:OpenLayers.INCHES_PER_UNIT.Fathom,ch:OpenLayers.INCHES_PER_UNIT.IntnlChain,link:OpenLayers.INCHES_PER_UNIT.IntnlLink,"us-in":OpenLayers.INCHES_PER_UNIT.inches,"us-ft":OpenLayers.INCHES_PER_UNIT.Foot,"us-yd":OpenLayers.INCHES_PER_UNIT.Yard,"us-ch":OpenLayers.INCHES_PER_UNIT.GunterChain,
"us-mi":OpenLayers.INCHES_PER_UNIT.Mile,"ind-yd":OpenLayers.INCHES_PER_UNIT.IndianYd37,"ind-ft":OpenLayers.INCHES_PER_UNIT.IndianFt37,"ind-ch":20.11669506/OpenLayers.METERS_PER_INCH});OpenLayers.DOTS_PER_INCH=72;OpenLayers.Util.normalizeScale=function(a){return a>1?1/a:a};OpenLayers.Util.getResolutionFromScale=function(a,b){var c;a&&(b==null&&(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){b==null&&(b="degrees");return a*OpenLayers.INCHES_PER_UNIT[b]*OpenLayers.DOTS_PER_INCH};OpenLayers.Util.safeStopPropagation=function(a){OpenLayers.Event.stop(a,!0)};
OpenLayers.Util.pagePosition=function(a){var b=[0,0],c=OpenLayers.Util.getViewportElement();if(!a||a==window||a==c)return b;var d=OpenLayers.IS_GECKO&&document.getBoxObjectFor&&OpenLayers.Element.getStyle(a,"position")=="absolute"&&(a.style.top==""||a.style.left==""),e=null;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(c=="opera"||c=="safari"&&OpenLayers.Element.getStyle(a,"position")=="absolute")b[1]-=document.body.offsetTop;for(e=a.offsetParent;e&&e!=document.body;){b[0]-=e.scrollLeft;if(c!="opera"||e.tagName!="TR")b[1]-=e.scrollTop;e=e.offsetParent}}return b};
OpenLayers.Util.getViewportElement=function(){var a=arguments.callee.viewportElement;if(a==void 0)a=OpenLayers.BROWSER_NAME=="msie"&&document.compatMode!="CSS1Compat"?document.body:document.documentElement,arguments.callee.viewportElement=a;return a};
OpenLayers.Util.isEquivalentUrl=function(a,b,c){c=c||{};OpenLayers.Util.applyDefaults(c,{ignoreCase:!0,ignorePort80:!0,ignoreHash:!0});var a=OpenLayers.Util.createUrlObject(a,c),b=OpenLayers.Util.createUrlObject(b,c),d;for(d in a)if(d!=="args"&&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;a.indexOf("/")===0?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?c.port=="80"||c.port=="0"?"":c.port:c.port==""||c.port=="0"?"80":c.port;d.hash=b.ignoreHash||c.hash===
"#"?"":c.hash;var e=c.search;e||(e=a.indexOf("?"),e=e!=-1?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=b==-1?c!=-1?a.substr(0,c):a:c!=-1?a.substr(0,Math.min(b,c)):a.substr(0,b)};OpenLayers.IS_GECKO=function(){var a=navigator.userAgent.toLowerCase();return a.indexOf("webkit")==-1&&a.indexOf("gecko")!=-1}();
OpenLayers.BROWSER_NAME=function(){var a="",b=navigator.userAgent.toLowerCase();b.indexOf("opera")!=-1?a="opera":b.indexOf("msie")!=-1?a="msie":b.indexOf("safari")!=-1?a="safari":b.indexOf("mozilla")!=-1&&(a=b.indexOf("firefox")!=-1?"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&&c.tagName.toLowerCase()!="body";){var h=OpenLayers.Element.getStyle(c,"position");if(h=="absolute"){a=!0;break}else if(h&&h!="static")break;c=c.parentNode}if(!a)f.style.position="absolute";if(!d)d=parseInt(b.scrollWidth),f.style.width=d+"px";e||(e=parseInt(b.scrollHeight));f.removeChild(b);g.removeChild(f);return new OpenLayers.Size(d,e)};
OpenLayers.Util.getScrollbarWidth=function(){var a=OpenLayers.Util._scrollbarWidth;if(a==null){var b=null,c=null,b=a=0,b=document.createElement("div");b.style.position="absolute";b.style.top="-1000px";b.style.left="-1000px";b.style.width="100px";b.style.height="50px";b.style.overflow="hidden";c=document.createElement("div");c.style.width="100%";c.style.height="200px";b.appendChild(c);document.body.appendChild(b);a=c.offsetWidth;b.style.overflow="scroll";b=c.offsetWidth;document.body.removeChild(document.body.lastChild);
OpenLayers.Util._scrollbarWidth=a-b;a=OpenLayers.Util._scrollbarWidth}return a};
OpenLayers.Util.getFormattedLonLat=function(a,b,c){c||(c="dms");var d=Math.abs(a),e=Math.floor(d),f=d=(d-e)/(1/60),d=Math.floor(d),f=Math.round((f-d)/(1/60)*10);f/=10;f>=60&&(f-=60,d+=1,d>=60&&(d-=60,e+=1));e<10&&(e="0"+e);e+="\u00b0";c.indexOf("dm")>=0&&(d<10&&(d="0"+d),e+=d+"'",c.indexOf("dms")>=0&&(f<10&&(f="0"+f),e+=f+'"'));e+=b=="lon"?a<0?OpenLayers.i18n("W"):OpenLayers.i18n("E"):a<0?OpenLayers.i18n("S"):OpenLayers.i18n("N");return e};
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&&a.touches.length==1},isMultiTouch:function(a){return a.touches&&a.touches.length>1},isLeftClick:function(a){return a.which&&a.which==1||a.button&&a.button==1},isRightClick:function(a){return a.which&&a.which==3||a.button&&a.button==2},stop:function(a,b){if(!b)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(b=="keypress"&&(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;b>=0;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(b=="keypress"&&(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);g.length==0&&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);if(window.Event)OpenLayers.Util.applyDefaults(window.Event,OpenLayers.Event);else var Event=OpenLayers.Event;
OpenLayers.Events=OpenLayers.Class({BROWSER_EVENTS:["mouseover","mouseout","mousedown","mouseup","mousemove","click","dblclick","rightclick","dblrightclick","resize","focus","blur","touchstart","touchmove","touchend"],listeners:null,object:null,element:null,eventTypes: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={};this.eventHandler=OpenLayers.Function.bindAsEventListener(this.handleBrowserEvent,
this);this.clearMouseListener=OpenLayers.Function.bind(this.clearMouseCache,this);this.eventTypes=[];if(c!=null){a=0;for(d=c.length;a<d;a++)this.addEventType(c[a])}b!=null&&this.attachToElement(b)},destroy:function(){this.element&&(OpenLayers.Event.stopObservingElement(this.element),this.element.hasScrollEvent&&OpenLayers.Event.stopObserving(window,"scroll",this.clearMouseListener));this.eventHandler=this.fallThrough=this.eventTypes=this.object=this.listeners=this.element=null},addEventType:function(a){this.listeners[a]||
(this.eventTypes.push(a),this.listeners[a]=[])},attachToElement:function(a){this.element&&OpenLayers.Event.stopObservingElement(this.element);this.element=a;for(var b=0,c=this.BROWSER_EVENTS.length;b<c;b++){var d=this.BROWSER_EVENTS[b];this.addEventType(d);OpenLayers.Event.observe(a,d,this.eventHandler)}OpenLayers.Event.observe(a,"dragstart",OpenLayers.Event.stop)},on:function(a){for(var b in a)b!="scope"&&this.register(b,a.scope,a[b])},register:function(a,b,c){if(c!=null&&OpenLayers.Util.indexOf(this.eventTypes,
a)!=-1){if(b==null)b=this.object;this.listeners[a].push({obj:b,func:c})}},registerPriority:function(a,b,c){if(c!=null){if(b==null)b=this.object;a=this.listeners[a];a!=null&&a.unshift({obj:b,func:c})}},un:function(a){for(var b in a)b!="scope"&&this.unregister(b,a.scope,a[b])},unregister:function(a,b,c){if(b==null)b=this.object;a=this.listeners[a];if(a!=null)for(var d=0,e=a.length;d<e;d++)if(a[d].obj==b&&a[d].func==c){a.splice(d,1);break}},remove:function(a){this.listeners[a]!=null&&(this.listeners[a]=
[])},triggerEvent:function(a,b){var c=this.listeners[a];if(c&&c.length!=0){b==null&&(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;e++)if(d=c[e],d=d.func.apply(d.obj,[b]),d!=void 0&&d==!1)break;this.fallThrough||OpenLayers.Event.stop(b,!0);return d}},handleBrowserEvent:function(a){var b=a.type,c=this.listeners[b];if(c&&c.length!=0){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&&(!(a.scrollTop!=0||a.scrollLeft!=0)||!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.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];(c==null||d==null||isNaN(c)||isNaN(d))&&OpenLayers.Console.error("invalid value for Tween");a[b]=this.easing.apply(this,[this.time,c,d-c,this.duration])}this.time++;
this.callbacks&&this.callbacks.eachStep&&this.callbacks.eachStep.call(this,a);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 a==0?b:c*Math.pow(2,10*(a/d-1))+b},easeOut:function(a,b,c,d){return a==d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b},easeInOut:function(a,b,c,d){return a==0?b:a==d?b+c:(a/=d/2)<1?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(a/=d/2)<1?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b},CLASS_NAME:"OpenLayers.Easing.Quad"};
OpenLayers.Map=OpenLayers.Class({Z_INDEX_BASE:{BaseLayer:100,Overlay:325,Feature:725,Popup:750,Control:1E3},EVENT_TYPES:["preaddlayer","addlayer","removelayer","changelayer","movestart","move","moveend","zoomend","popupopen","popupclose","addmarker","removemarker","clearmarkers","mouseover","mouseout","mousemove","dragstart","drag","dragend","changebaselayer"],id:null,fractionalZoom:!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,viewRequestID:0,tileSize:null,projection:"EPSG:4326",units:"degrees",resolutions:null,maxResolution:1.40625,minResolution:null,maxScale:null,minScale:null,maxExtent:null,minExtent:null,restrictedExtent:null,numZoomLevels:16,theme:null,displayProjection:null,fallThrough:!0,panTween:null,eventListeners:null,panMethod:OpenLayers.Easing.Expo.easeOut,panDuration:50,paddingForPopups:null,minPx:null,maxPx:null,
initialize:function(a,b){arguments.length===1&&typeof a==="object"&&(a=(b=a)&&b.div);this.tileSize=new OpenLayers.Size(OpenLayers.Map.TILE_WIDTH,OpenLayers.Map.TILE_HEIGHT);this.maxExtent=new OpenLayers.Bounds(-180,-90,180,90);this.paddingForPopups=new OpenLayers.Bounds(15,15,15,15);this.theme=OpenLayers._getScriptLocation()+"theme/default/style.css";OpenLayers.Util.extend(this,b);this.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,this.EVENT_TYPES,this.fallThrough,{includeXY:!0});c=this.id+"_OpenLayers_Container";this.layerContainerDiv=OpenLayers.Util.createDiv(c);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(this.controls==null)this.controls=OpenLayers.Control!=null?[new OpenLayers.Control.Navigation,new OpenLayers.Control.PanZoom,new OpenLayers.Control.ArgParser,new OpenLayers.Control.Attribution]:[];e=0;for(f=this.controls.length;e<f;e++)this.addControlToMap(this.controls[e]);this.popups=[];this.unloadDestroy=OpenLayers.Function.bind(this.destroy,
this);OpenLayers.Event.observe(window,"unload",this.unloadDestroy);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(this.controls!=null){for(var a=this.controls.length-1;a>=0;--a)this.controls[a].destroy();this.controls=null}if(this.layers!=null){for(a=this.layers.length-1;a>=0;--a)this.layers[a].destroy(!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=typeof c.test=="function";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"]+b*5)},resetLayersZIndex:function(){for(var a=0,b=this.layers.length;a<b;a++)this.setLayerZIndex(this.layers[a],a)},addLayer:function(a){for(var b=0,c=this.layers.length;b<c;b++)if(this.layers[b]==a)return a=OpenLayers.i18n("layerAlreadyAdded",{layerName:a.name}),OpenLayers.Console.warn(a),!1;if(this.allOverlays)a.isBaseLayer=!1;if(this.events.triggerEvent("preaddlayer",{layer:a})!==!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?this.baseLayer==null?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){b==
null&&(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(b<0)b=0;else if(b>this.layers.length)b=this.layers.length;if(c!=b){this.layers.splice(c,1);this.layers.splice(b,0,a);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&&(b===0?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&&OpenLayers.Util.indexOf(this.layers,a)!=-1){var b=this.getCachedCenter(),c=OpenLayers.Util.getResolutionFromScale(this.getScale(),a.units);this.baseLayer!=null&&!this.allOverlays&&this.baseLayer.setVisibility(!1);this.baseLayer=a;this.viewRequestID++;(!this.allOverlays||this.baseLayer.visibility)&&this.baseLayer.setVisibility(!0);b!=null&&(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=arguments.length===1?[]:b,d=0,e=a.length;d<e;d++)this.addControl(a[d],c[d]?c[d]:null)},addControlToMap:function(a,b){a.outsideViewport=a.div!=null;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;c>=0;--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;this.size!=null&&(a=this.size.clone());return a},updateSize:function(){var a=this.getCurrentSize();if(a&&!isNaN(a.h)&&!isNaN(a.w)){this.events.clearMouseCache();var b=this.getSize();if(b==
null)this.size=b=a;if(!a.equals(b)){this.size=a;a=0;for(b=this.layers.length;a<b;a++)this.layers[a].onMapResize();a=this.getCachedCenter();if(this.baseLayer!=null&&a!=null)b=this.getZoom(),this.zoom=null,this.setCenter(a,b)}}},getCurrentSize:function(){var a=new OpenLayers.Size(this.div.clientWidth,this.div.clientHeight);if(a.w==0&&a.h==0||isNaN(a.w)&&isNaN(a.h))a.w=this.div.offsetWidth,a.h=this.div.offsetHeight;if(a.w==0&&a.h==0||isNaN(a.w)&&isNaN(a.h))a.w=parseInt(this.div.style.width),a.h=parseInt(this.div.style.height);
return a},calculateBounds:function(a,b){var c=null;a==null&&(a=this.getCachedCenter());b==null&&(b=this.getResolution());if(a!=null&&b!=null)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)(a!=0||b!=0)&&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={x:0,y: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.x,a.y-d.y);d.x=Math.round(a.x);d.y=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 a=Math.round(a),b=Math.round(b),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);c=f<=this.maxPx.y-i&&f>=this.minPx.y+i;d=this.minPx.x;f=this.maxPx.x;g||(c=c&&e<=this.maxPx.x-h&&e>=this.minPx.x+h);if(c){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,g&&(this.maxPx.x>f&&(this.maxPx.x-=f-d),this.minPx.x<d&&(this.minPx.x+=f-d));if(b)this.layerContainerDiv.style.top=parseInt(this.layerContainerDiv.style.top)-b+"px",this.minPx.y-=b,this.maxPx.y-=b;g=0;for(h=this.layers.length;g<h;++g)e=this.layers[g],e.visibility&&(e.moveByPx(a,b),e.events.triggerEvent("move"));this.events.triggerEvent("move")}},moveTo:function(a,b,c){c||(c={});
b!=null&&(b=parseFloat(b),this.fractionalZoom||(b=Math.round(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(this.restrictedExtent!=null){if(a==null)a=this.center;b==null&&(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||this.layerContainerOrigin==null){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,this.viewRequestID++;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;b>=0;--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(b!=null&&c!=null){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 a!=null&&a>=this.getRestrictedMinZoom()&&a<this.getNumZoomLevels()},isValidLonLat:function(a){var b=!1;a!=null&&(b=
this.getMaxExtent().containsLonLat(a));return b},getProjection:function(){var a=this.getProjectionObject();return a?a.getCode():null},getProjectionObject:function(){var a=null;if(this.baseLayer!=null)a=this.baseLayer.projection;return a},getMaxResolution:function(){var a=null;if(this.baseLayer!=null)a=this.baseLayer.maxResolution;return a},getMaxExtent:function(a){var b=null;if(a&&a.restricted&&this.restrictedExtent)b=this.restrictedExtent;else if(this.baseLayer!=null)b=this.baseLayer.maxExtent;return b},
getRestrictedMinZoom:function(){var a=null;if(this.baseLayer!=null)a=this.baseLayer.restrictedMinZoom;return a},getNumZoomLevels:function(){var a=null;if(this.baseLayer!=null)a=this.baseLayer.numZoomLevels;return a},getExtent:function(){var a=null;this.baseLayer!=null&&(a=this.baseLayer.getExtent());return a},getResolution:function(){var a=null;this.baseLayer!=null?a=this.baseLayer.getResolution():this.allOverlays===!0&&this.layers.length>0&&(a=this.layers[0].getResolution());return a},getUnits:function(){var a=
null;if(this.baseLayer!=null)a=this.baseLayer.units;return a},getScale:function(){var a=null;this.baseLayer!=null&&(a=this.getResolution(),a=OpenLayers.Util.getScaleFromResolution(a,this.baseLayer.units));return a},getZoomForExtent:function(a,b){var c=null;this.baseLayer!=null&&(c=this.baseLayer.getZoomForExtent(a,b));return c},getResolutionForZoom:function(a){var b=null;this.baseLayer&&(b=this.baseLayer.getResolutionForZoom(a));return b},getZoomForResolution:function(a,b){var c=null;this.baseLayer!=
null&&(c=this.baseLayer.getZoomForResolution(a,b));return c},zoomTo:function(a){this.isValidZoomLevel(a)&&this.setCenter(null,a)},zoomIn:function(){this.zoomTo(this.getZoom()+1)},zoomOut:function(){this.zoomTo(this.getZoom()-1)},zoomToExtent:function(a,b){var c=a.getCenterLonLat();if(this.baseLayer.wrapDateLine){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;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;this.baseLayer!=null&&(b=this.baseLayer.getLonLatFromViewPortPx(a));return b},getViewPortPxFromLonLat:function(a){var b=null;this.baseLayer!=null&&(b=this.baseLayer.getViewPortPxFromLonLat(a));return b},
getLonLatFromPixel:function(a){return this.getLonLatFromViewPortPx(a)},getPixelFromLonLat:function(a){a=this.getViewPortPxFromLonLat(a);a.x=Math.round(a.x);a.y=Math.round(a.y);return a},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(a!=null)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(a!=null){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&&(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.proj&&c.proj)a=Proj4js.transform(b.proj,c.proj,a);else if(b&&c&&OpenLayers.Projection.transforms[b.getCode()]&&OpenLayers.Projection.transforms[b.getCode()][c.getCode()])OpenLayers.Projection.transforms[b.getCode()][c.getCode()](a);return a};
OpenLayers.Projection.nullTransform=function(a){return a};
OpenLayers.Layer=OpenLayers.Class({id:null,name:null,div:null,opacity:null,alwaysInRange:null,EVENT_TYPES:["loadstart","loadend","loadcancel","visibilitychanged","move","moveend","added","removed"],RESOLUTION_PROPERTIES:["scales","resolutions","maxScale","minScale","maxResolution","minResolution","numZoomLevels","maxZoomLevel"],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,restrictedMinZoom:0,minScale:null,maxScale:null,displayOutsideMaxExtent:!1,wrapDateLine:!1,transitionEffect:null,SUPPORTED_TRANSITIONS:["resize"],metadata:{},initialize:function(a,b){this.addOptions(b);this.name=a;if(this.id==null&&(this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_"),this.div=OpenLayers.Util.createDiv(this.id),this.div.style.width=
"100%",this.div.style.height="100%",this.div.dir="ltr",this.events=new OpenLayers.Events(this,this.div,this.EVENT_TYPES),this.eventListeners instanceof Object))this.events.on(this.eventListeners);if(this.wrapDateLine)this.displayOutsideMaxExtent=!0},destroy:function(a){a==null&&(a=!0);this.map!=null&&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){a==null&&(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,this.map!=null&&this.map.events.triggerEvent("changelayer",{layer:this,property:"name"})},addOptions:function(a){if(this.options==null)this.options={};OpenLayers.Util.extend(this.options,a);OpenLayers.Util.extend(this,a);if(typeof this.projection==
"string")this.projection=new OpenLayers.Projection(this.projection);if(this.projection&&this.projection.getUnits())this.units=this.projection.getUnits();if(this.map){var b=this.RESOLUTION_PROPERTIES.concat(["projection","units","minExtent","maxExtent"]),c;for(c in a)if(a.hasOwnProperty(c)&&OpenLayers.Util.indexOf(b,c)>=0){this.initResolutions();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(this.map==null){this.map=a;this.maxExtent=this.maxExtent||this.map.maxExtent;this.minExtent=this.minExtent||this.map.minExtent;this.projection=this.projection||this.map.projection;if(typeof this.projection=="string")this.projection=new OpenLayers.Projection(this.projection);
this.units=this.projection.getUnits()||this.units||this.map.units;this.initResolutions();if(!this.isBaseLayer)this.inRange=this.calculateInRange(),this.div.style.display=this.visibility&&this.inRange?"":"none";this.setTileSize()}},afterAdd:function(){},removeMap:function(){},getImageSize:function(){return this.imageSize||this.tileSize},setTileSize:function(a){this.tileSize=a=a?a:this.tileSize?this.tileSize:this.map.getTileSize();if(this.gutter)this.imageOffset=new OpenLayers.Pixel(-this.gutter,-this.gutter),
this.imageSize=new OpenLayers.Size(a.w+2*this.gutter,a.h+2*this.gutter)},getVisibility:function(){return this.visibility},setVisibility:function(a){if(a!=this.visibility)this.visibility=a,this.display(a),this.redraw(),this.map!=null&&this.map.events.triggerEvent("changelayer",{layer:this,property:"visibility"}),this.events.triggerEvent("visibilitychanged")},display:function(a){if(a!=(this.div.style.display!="none"))this.div.style.display=a&&this.calculateInRange()?"block":"none"},calculateInRange:function(){var a=
!1;this.alwaysInRange?a=!0:this.map&&(a=this.map.getResolution(),a=this.map.getZoom()>=this.restrictedMinZoom&&a>=this.minResolution&&a<=this.maxResolution);return a},setIsBaseLayer:function(a){if(a!=this.isBaseLayer)this.isBaseLayer=a,this.map!=null&&this.map.events.triggerEvent("changebaselayer",{layer:this})},initResolutions:function(){var a,b,c,d={},e=!0;a=0;for(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(this.alwaysInRange==
null)this.alwaysInRange=e;if(d.resolutions==null)d.resolutions=this.resolutionsFromScales(d.scales);if(d.resolutions==null)d.resolutions=this.calculateResolutions(d);if(d.resolutions==null){a=0;for(b=this.RESOLUTION_PROPERTIES.length;a<b;a++)c=this.RESOLUTION_PROPERTIES[a],d[c]=this.options[c]!=null?this.options[c]:this.map[c];if(d.resolutions==null)d.resolutions=this.resolutionsFromScales(d.scales);if(d.resolutions==null)d.resolutions=this.calculateResolutions(d)}var f;if(this.options.maxResolution&&
this.options.maxResolution!=="auto")f=this.options.maxResolution;this.options.minScale&&(f=OpenLayers.Util.getResolutionFromScale(this.options.minScale,this.units));var g;if(this.options.minResolution&&this.options.minResolution!=="auto")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(a!=null){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;a.minScale!=null?d=OpenLayers.Util.getResolutionFromScale(a.minScale,this.units):d=="auto"&&this.maxExtent!=null&&(b=this.map.getSize(),c=this.maxExtent.getWidth()/b.w,b=this.maxExtent.getHeight()/b.h,d=Math.max(c,b));c=a.minResolution;a.maxScale!=null?c=OpenLayers.Util.getResolutionFromScale(a.maxScale,this.units):a.minResolution=="auto"&&this.minExtent!=null&&(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;typeof c==="number"&&typeof d==="number"&&a===void 0?a=Math.floor(Math.log(d/c)/Math.log(2))+1:a===void 0&&b!=null&&(a=b+1);if(!(typeof a!=="number"||a<=0||typeof d!=="number"&&typeof c!=="number")){b=Array(a);var e=2;typeof c=="number"&&typeof d=="number"&&(e=Math.pow(d/c,1/(a-1)));var f;if(typeof d==="number")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),a=this.resolutions[b]-(a-b)*(this.resolutions[b]-this.resolutions[Math.ceil(a)]);else a=this.resolutions[Math.round(a)];return a},getZoomForResolution:function(a,
b){var c,d;if(this.map.fractionalZoom){var e=0,f=this.resolutions[e],g=this.resolutions[this.resolutions.length-1],h;c=0;for(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=c>0?e+(f-a)/c:e}else{f=Number.POSITIVE_INFINITY;c=0;for(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 Math.max(this.restrictedMinZoom,c)},getLonLatFromViewPortPx:function(a){var b=
null,c=this.map;if(a!=null&&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){var b=null;if(a!=null)var b=this.map.getResolution(),c=this.map.getExtent(),b=new OpenLayers.Pixel(1/b*(a.lon-c.left),1/b*(c.top-a.lat));return b},setOpacity:function(a){if(a!=this.opacity){this.opacity=a;for(var b=0,c=this.div.childNodes.length;b<
c;++b)OpenLayers.Util.modifyDOMElement(this.div.childNodes[b].firstChild,null,null,null,null,null,null,a);this.map!=null&&this.map.events.triggerEvent("changelayer",{layer:this,property:"opacity"})}},getZIndex:function(){return this.div.style.zIndex},setZIndex:function(a){this.div.style.zIndex=a},adjustBounds:function(a){if(this.gutter)var b=this.gutter*this.map.getResolution(),a=new OpenLayers.Bounds(a.left-b,a.bottom-b,a.right+b,a.top+b);this.wrapDateLine&&(b={rightTolerance:this.getResolution(),
leftTolerance:this.getResolution()},a=a.wrapDateLine(this.maxExtent,b));return a},CLASS_NAME:"OpenLayers.Layer"});
OpenLayers.Tile=OpenLayers.Class({EVENT_TYPES:["loadstart","loadend","reload","unload"],events:null,id:null,layer:null,url:null,bounds:null,size:null,position:null,isLoading:!1,initialize:function(a,b,c,d,e,f){this.layer=a;this.position=b.clone();this.bounds=c.clone();this.url=d;this.size=e.clone();this.id=OpenLayers.Util.createUniqueID("Tile_");this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES);OpenLayers.Util.extend(this,f)},unload:function(){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},clone:function(a){a==null&&(a=new OpenLayers.Tile(this.layer,this.position,this.bounds,this.url,this.size));OpenLayers.Util.applyDefaults(a,this);return a},draw:function(){var a=this.layer.maxExtent;this.shouldDraw=a&&this.bounds.intersectsBounds(a,!1)||this.layer.displayOutsideMaxExtent;this.clear();return this.shouldDraw},moveTo:function(a,b,c){c==null&&(c=!0);this.bounds=a.clone();this.position=
b.clone();c&&this.draw()},clear:function(){},getBoundsFromBaseLayer:function(a){var b=OpenLayers.i18n("reprojectDeprecated",{layerName:this.layer.name});OpenLayers.Console.warn(b);b=this.layer.map.getLonLatFromLayerPx(a);a=a.clone();a.x+=this.size.w;a.y+=this.size.h;a=this.layer.map.getLonLatFromLayerPx(a);if(b.lon>a.lon)b.lon<0?b.lon=-180-(b.lon+180):a.lon=180+a.lon+180;return new OpenLayers.Bounds(b.lon,a.lat,a.lon,b.lat)},showTile:function(){this.shouldDraw&&this.show()},show:function(){},hide:function(){},
CLASS_NAME:"OpenLayers.Tile"});
OpenLayers.Tile.Image=OpenLayers.Class(OpenLayers.Tile,{url:null,imgDiv:null,frame:null,layerAlphaHack:null,isBackBuffer:!1,isFirstDraw:!0,backBufferTile:null,maxGetUrlLength:null,initialize:function(a,b,c,d,e,f){OpenLayers.Tile.prototype.initialize.apply(this,arguments);this.maxGetUrlLength!=null&&OpenLayers.Util.extend(this,OpenLayers.Tile.Image.IFrame);this.url=d;this.frame=document.createElement("div");this.frame.style.overflow="hidden";this.frame.style.position="absolute";this.layerAlphaHack=
this.layer.alpha&&OpenLayers.Util.alphaHack()},destroy:function(){this.imgDiv!=null&&this.removeImgDiv();this.imgDiv=null;this.frame!=null&&this.frame.parentNode==this.layer.div&&this.layer.div.removeChild(this.frame);this.frame=null;if(this.backBufferTile)this.backBufferTile.destroy(),this.backBufferTile=null;this.layer.events.unregister("loadend",this,this.resetBackBuffer);OpenLayers.Tile.prototype.destroy.apply(this,arguments)},clone:function(a){a==null&&(a=new OpenLayers.Tile.Image(this.layer,
this.position,this.bounds,this.url,this.size));a=OpenLayers.Tile.prototype.clone.apply(this,[a]);a.imgDiv=null;return a},draw:function(){if(this.layer!=this.layer.map.baseLayer&&this.layer.reproject)this.bounds=this.getBoundsFromBaseLayer(this.position);var a=OpenLayers.Tile.prototype.draw.apply(this,arguments);if(OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1||this.layer.singleTile)if(a){if(!this.backBufferTile)this.backBufferTile=this.clone(),this.backBufferTile.hide(),
this.backBufferTile.isBackBuffer=!0,this.events.register("loadend",this,this.resetBackBuffer),this.layer.events.register("loadend",this,this.resetBackBuffer);this.startTransition()}else this.backBufferTile&&this.backBufferTile.clear();else if(a&&this.isFirstDraw)this.events.register("loadend",this,this.showTile),this.isFirstDraw=!1;if(!a)return!1;this.isLoading?this.events.triggerEvent("reload"):(this.isLoading=!0,this.events.triggerEvent("loadstart"));return this.renderTile()},resetBackBuffer:function(){this.showTile();
if(this.backBufferTile&&(this.isFirstDraw||!this.layer.numLoadingTiles)){this.isFirstDraw=!1;var a=this.layer.maxExtent;if(a&&this.bounds.intersectsBounds(a,!1))this.backBufferTile.position=this.position,this.backBufferTile.bounds=this.bounds,this.backBufferTile.size=this.size,this.backBufferTile.imageSize=this.layer.getImageSize(this.bounds)||this.size,this.backBufferTile.imageOffset=this.layer.imageOffset,this.backBufferTile.resolution=this.layer.getResolution(),this.backBufferTile.renderTile();
this.backBufferTile.hide()}},renderTile:function(){this.layer.async?(this.initImgDiv(),this.layer.getURLasync(this.bounds,this,"url",this.positionImage)):(this.url=this.layer.getURL(this.bounds),this.initImgDiv(),this.positionImage());return!0},positionImage:function(){if(this.layer!==null){OpenLayers.Util.modifyDOMElement(this.frame,null,this.position,this.size);var a=this.layer.getImageSize(this.bounds);this.layerAlphaHack?OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv,null,null,a,this.url):(OpenLayers.Util.modifyDOMElement(this.imgDiv,
null,null,a),this.imgDiv.src=this.url)}},clear:function(){if(this.imgDiv&&(this.hide(),OpenLayers.Tile.Image.useBlankTile))this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif"},initImgDiv:function(){if(this.imgDiv==null){var a=this.layer.imageOffset,b=this.layer.getImageSize(this.bounds);this.imgDiv=this.layerAlphaHack?OpenLayers.Util.createAlphaImageDiv(null,a,b,null,"relative",null,null,null,!0):OpenLayers.Util.createImage(null,a,b,null,"relative",null,null,!0);if(this.layer.url instanceof
Array)this.imgDiv.urls=this.layer.url.slice();this.imgDiv.className="olTileImage";this.frame.style.zIndex=this.isBackBuffer?0:1;this.frame.appendChild(this.imgDiv);this.layer.div.appendChild(this.frame);this.layer.opacity!=null&&OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,null,null,null,null,this.layer.opacity);this.imgDiv.map=this.layer.map;var c=function(){if(this.isLoading)this.isLoading=!1,this.events.triggerEvent("loadend")};this.layerAlphaHack?OpenLayers.Event.observe(this.imgDiv.childNodes[0],
"load",OpenLayers.Function.bind(c,this)):OpenLayers.Event.observe(this.imgDiv,"load",OpenLayers.Function.bind(c,this));OpenLayers.Event.observe(this.imgDiv,"error",OpenLayers.Function.bind(function(){this.imgDiv._attempts>OpenLayers.IMAGE_RELOAD_ATTEMPTS&&c.call(this)},this))}this.imgDiv.viewRequestID=this.layer.map.viewRequestID},removeImgDiv:function(){OpenLayers.Event.stopObservingElement(this.imgDiv);if(this.imgDiv.parentNode==this.frame)this.frame.removeChild(this.imgDiv),this.imgDiv.map=null;
this.imgDiv.urls=null;var a=this.imgDiv.firstChild;a?(OpenLayers.Event.stopObservingElement(a),this.imgDiv.removeChild(a),delete a):this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif"},checkImgURL:function(){this.layer&&(OpenLayers.Util.isEquivalentUrl(this.layerAlphaHack?this.imgDiv.firstChild.src:this.imgDiv.src,this.url)||this.hide())},startTransition:function(){if(this.backBufferTile&&this.backBufferTile.imgDiv){var a=1;this.backBufferTile.resolution&&(a=this.backBufferTile.resolution/
this.layer.getResolution());if(a!=1){if(this.layer.transitionEffect=="resize"){var b=new OpenLayers.LonLat(this.backBufferTile.bounds.left,this.backBufferTile.bounds.top),c=new OpenLayers.Size(this.backBufferTile.size.w*a,this.backBufferTile.size.h*a),b=this.layer.map.getLayerPxFromLonLat(b);OpenLayers.Util.modifyDOMElement(this.backBufferTile.frame,null,b,c);c=this.backBufferTile.imageSize;c=new OpenLayers.Size(c.w*a,c.h*a);(b=this.backBufferTile.imageOffset)&&(b=new OpenLayers.Pixel(b.x*a,b.y*a));
OpenLayers.Util.modifyDOMElement(this.backBufferTile.imgDiv,null,b,c);this.backBufferTile.show()}}else this.layer.singleTile?this.backBufferTile.show():this.backBufferTile.hide()}},show:function(){this.frame.style.display="";if(OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1&&OpenLayers.IS_GECKO===!0)this.frame.scrollLeft=this.frame.scrollLeft},hide:function(){this.frame.style.display="none"},CLASS_NAME:"OpenLayers.Tile.Image"});
OpenLayers.Tile.Image.useBlankTile=OpenLayers.BROWSER_NAME=="safari"||OpenLayers.BROWSER_NAME=="opera";
OpenLayers.Layer.Image=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:!0,url:null,extent:null,size:null,tile:null,aspectRatio:null,initialize:function(a,b,c,d,e){this.url=b;this.maxExtent=this.extent=c;this.size=d;OpenLayers.Layer.prototype.initialize.apply(this,[a,e]);this.aspectRatio=this.extent.getHeight()/this.size.h/(this.extent.getWidth()/this.size.w)},destroy:function(){if(this.tile)this.removeTileMonitoringHooks(this.tile),this.tile.destroy(),this.tile=null;OpenLayers.Layer.prototype.destroy.apply(this,
arguments)},clone:function(a){a==null&&(a=new OpenLayers.Layer.Image(this.name,this.url,this.extent,this.size,this.getOptions()));return a=OpenLayers.Layer.prototype.clone.apply(this,[a])},setMap:function(a){if(this.options.maxResolution==null)this.options.maxResolution=this.aspectRatio*this.extent.getWidth()/this.size.w;OpenLayers.Layer.prototype.setMap.apply(this,arguments)},moveTo:function(a,b,c){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);var d=this.tile==null;if(b||d){this.setTileSize();
var e=this.map.getLayerPxFromLonLat(new OpenLayers.LonLat(this.extent.left,this.extent.top));d?(this.tile=new OpenLayers.Tile.Image(this,e,this.extent,null,this.tileSize),this.addTileMonitoringHooks(this.tile)):(this.tile.size=this.tileSize.clone(),this.tile.position=e.clone());this.tile.draw()}},setTileSize:function(){var a=this.extent.getWidth()/this.map.getResolution(),b=this.extent.getHeight()/this.map.getResolution();this.tileSize=new OpenLayers.Size(a,b)},addTileMonitoringHooks:function(a){a.onLoadStart=
function(){this.events.triggerEvent("loadstart")};a.events.register("loadstart",this,a.onLoadStart);a.onLoadEnd=function(){this.events.triggerEvent("loadend")};a.events.register("loadend",this,a.onLoadEnd);a.events.register("unload",this,a.onLoadEnd)},removeTileMonitoringHooks:function(a){a.unload();a.events.un({loadstart:a.onLoadStart,loadend:a.onLoadEnd,unload:a.onLoadEnd,scope:this})},setUrl:function(a){this.url=a;this.tile.draw()},getURL:function(){return this.url},CLASS_NAME:"OpenLayers.Layer.Image"});
OpenLayers.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(){OpenLayers.Console.userError(OpenLayers.i18n("readNotImplemented"))},write:function(){OpenLayers.Console.userError(OpenLayers.i18n("writeNotImplemented"))},CLASS_NAME:"OpenLayers.Format"});
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=c!=null?c:{};this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){this.layer!=null&&this.layer.map!=null&&this.popup!=null&&this.layer.map.removePopup(this.popup);this.layer!=null&&this.marker!=null&&this.layer.removeMarker(this.marker);this.data=this.lonlat=this.id=this.layer=null;if(this.marker!=
null)this.destroyMarker(this.marker),this.marker=null;if(this.popup!=null)this.destroyPopup(this.popup),this.popup=null},onScreen:function(){var a=!1;this.layer!=null&&this.layer.map!=null&&(a=this.layer.map.getExtent().containsLonLat(this.lonlat));return a},createMarker:function(){if(this.lonlat!=null)this.marker=new OpenLayers.Marker(this.lonlat,this.data.icon);return this.marker},destroyMarker:function(){this.marker.destroy()},createPopup:function(a){if(this.lonlat!=null){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(this.data.overflow!=null)this.popup.contentDiv.style.overflow=this.data.overflow;this.popup.feature=this}return this.popup},destroyPopup:function(){if(this.popup)this.popup.feature=null,this.popup.destroy(),this.popup=null},CLASS_NAME:"OpenLayers.Feature"});
OpenLayers.State={UNKNOWN:"Unknown",INSERT:"Insert",UPDATE:"Update",DELETE:"Delete"};
OpenLayers.Feature.Vector=OpenLayers.Class(OpenLayers.Feature,{fid:null,geometry:null,attributes:null,bounds:null,state:null,style:null,url:null,renderIntent:"default",initialize:function(a,b,c){OpenLayers.Feature.prototype.initialize.apply(this,[null,null,b]);this.lonlat=null;this.geometry=a?a:null;this.state=null;this.attributes={};if(b)this.attributes=OpenLayers.Util.extend(this.attributes,b);this.style=c?c:null},destroy:function(){if(this.layer)this.layer.removeFeatures(this),this.layer=null;
this.geometry=null;OpenLayers.Feature.prototype.destroy.apply(this,arguments)},clone:function(){return new OpenLayers.Feature.Vector(this.geometry?this.geometry.clone():null,this.attributes,this.style)},onScreen:function(a){var b=!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&&this.style.display=="none"||!this.layer||this.layer&&this.layer.styleMap&&
this.layer.styleMap.createSymbolizer(this,this.renderIntent).display=="none"||this.layer&&!this.layer.getVisibility())},createMarker:function(){return null},destroyMarker:function(){},createPopup:function(){return null},atPoint:function(a,b,c){var d=!1;this.geometry&&(d=this.geometry.atPoint(a,b,c));return d},destroyPopup:function(){},move:function(a){if(this.layer&&this.geometry.move){var a=a.CLASS_NAME=="OpenLayers.LonLat"?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.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;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&&b.CLASS_NAME==
"OpenLayers.Feature.Vector")b.geometry.transform(this.externalProjection,this.internalProjection);else if(b&&a!="geometrycollection"&&typeof b=="object"){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&&e>0&&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(b=="collection"?"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(this.regExes.parenComma),
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(){this.bounds==null&&this.calculateBounds();
return this.bounds},calculateBounds:function(){},distanceTo:function(){},getVertices:function(){},atPoint:function(a,b,c){var d=!1;this.getBounds()!=null&&a!=null&&(b=b!=null?b:0,c=c!=null?c:0,d=(new OpenLayers.Bounds(this.bounds.left-b,this.bounds.bottom-c,this.bounds.right+b,this.bounds.top+c)).containsLonLat(a));return d},getLength:function(){return 0},getArea:function(){return 0},getCentroid:function(){return null},toString:function(){return OpenLayers.Format.WKT.prototype.write(new OpenLayers.Feature.Vector(this))},
CLASS_NAME:"OpenLayers.Geometry"});OpenLayers.Geometry.fromWKT=function(a){var b=arguments.callee.format;if(!b)b=new OpenLayers.Format.WKT,arguments.callee.format=b;var c,b=b.read(a);if(b instanceof OpenLayers.Feature.Vector)c=b.geometry;else if(b instanceof Array){c=b.length;for(var d=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,j=b.y2-b.y1,k=b.x2-b.x1,m=j*h-k*i,j=k*g-j*f,g=h*g-i*f;m==0?j==0&&g==0&&(e=!0):(f=j/m,m=g/m,f>=0&&f<=1&&m>=0&&m<=1&&(d?(h=a.x1+f*h,m=a.y1+f*i,e=new OpenLayers.Geometry.Point(h,m)):e=!0));if(c)if(e){if(d){a=[a,b];b=0;a:for(;b<2;++b){f=a[b];for(i=1;i<3;++i)if(h=f["x"+i],m=f["y"+i],d=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(m-e.y,2)),d<c){e.x=h;e.y=m;break a}}}}else{a=
[a,b];b=0;a:for(;b<2;++b){h=a[b];m=a[(b+1)%2];for(i=1;i<3;++i)if(f={x:h["x"+i],y:h["y"+i]},g=OpenLayers.Geometry.distanceToSegment(f,m),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,j=h-f,k=(i*(c-e)+j*(d-f))/(Math.pow(i,2)+Math.pow(j,2));k<=0||(k>=1?(e=g,f=h):(e+=k*i,f+=k*j));return{distance:Math.sqrt(Math.pow(e-c,2)+Math.pow(f-d,2)),x:e,y:f}};
OpenLayers.Geometry.Collection=OpenLayers.Class(OpenLayers.Geometry,{components:null,componentTypes:null,initialize:function(a){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.components=[];a!=null&&this.addComponents(a)},destroy:function(){this.components.length=0;this.components=null;OpenLayers.Geometry.prototype.destroy.apply(this,arguments)},clone:function(){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());a.left!=null&&a.bottom!=null&&a.right!=null&&a.top!=null&&this.setBounds(a)},addComponents:function(a){a instanceof Array||(a=[a]);for(var b=0,c=a.length;b<
c;b++)this.addComponent(a[b])},addComponent:function(a,b){var c=!1;if(a&&(this.componentTypes==null||OpenLayers.Util.indexOf(this.componentTypes,a.CLASS_NAME)>-1)){if(b!=null&&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){a instanceof Array||(a=[a]);for(var b=a.length-1;b>=0;--b)this.removeComponent(a[b])},
removeComponent:function(a){OpenLayers.Util.removeItem(this.components,a);this.clearBounds()},getLength:function(){for(var a=0,b=0,c=this.components.length;b<c;b++)a+=this.components[b].getLength();return a},getArea:function(){for(var a=0,b=0,c=this.components.length;b<c;b++)a+=this.components[b].getArea();return a},getGeodesicArea:function(a){for(var b=0,c=0,d=this.components.length;c<d;c++)b+=this.components[c].getGeodesicArea(a);return b},getCentroid:function(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&&h>0?h:e,c.push(f))}a=b.length;if(d===0){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&&b.edge===!1)&&b&&b.details,d,e,f,g=Number.POSITIVE_INFINITY,h=0,i=this.components.length;h<
i;++h)if(d=this.components[h].distanceTo(a,b),f=c?d.distance:d,f<g&&(g=f,e=d,g==0))break;return e},equals:function(a){var b=!0;if(!a||!a.CLASS_NAME||this.CLASS_NAME!=a.CLASS_NAME)b=!1;else if(!(a.components instanceof Array)||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;++c)if(b=a.intersects(this.components[c]))break;return b},getVertices:function(a){for(var b=[],c=0,d=this.components.length;c<d;++c)Array.prototype.push.apply(b,this.components[c].getVertices(a));return b},CLASS_NAME:"OpenLayers.Geometry.Collection"});
OpenLayers.Geometry.Point=OpenLayers.Class(OpenLayers.Geometry,{x:null,y:null,initialize:function(a,b){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.x=parseFloat(a);this.y=parseFloat(b)},clone:function(a){a==null&&(a=new OpenLayers.Geometry.Point(this.x,this.y));OpenLayers.Util.applyDefaults(a,this);return a},calculateBounds:function(){this.bounds=new OpenLayers.Bounds(this.x,this.y,this.x,this.y)},distanceTo:function(a,b){var c=!(b&&b.edge===!1)&&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;a!=null&&(b=this.x==a.x&&this.y==a.y||isNaN(this.x)&&isNaN(this.y)&&isNaN(a.x)&&isNaN(a.y));return b},toShortString:function(){return this.x+", "+this.y},move:function(a,b){this.x+=a;this.y+=b;this.clearBounds()},rotate:function(a,b){a*=
Math.PI/180;var c=this.distanceTo(b),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*(c==void 0?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=a.CLASS_NAME=="OpenLayers.Geometry.Point"?this.equals(a):a.intersects(this)},transform:function(a,b){if(a&&b)OpenLayers.Projection.transform(this,
a,b),this.bounds=null;return this},getVertices:function(){return[this]},CLASS_NAME:"OpenLayers.Geometry.Point"});OpenLayers.Geometry.MultiPoint=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(a){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments)},addPoint:function(a,b){this.addComponent(a,b)},removePoint:function(a){this.removeComponent(a)},CLASS_NAME:"OpenLayers.Geometry.MultiPoint"});
OpenLayers.Geometry.Curve=OpenLayers.Class(OpenLayers.Geometry.MultiPoint,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(a){OpenLayers.Geometry.MultiPoint.prototype.initialize.apply(this,arguments)},getLength:function(){var a=0;if(this.components&&this.components.length>1)for(var b=1,c=this.components.length;b<c;b++)a+=this.components[b-1].distanceTo(this.components[b]);return a},getGeodesicLength:function(a){var b=this;if(a){var c=new OpenLayers.Projection("EPSG:4326");c.equals(a)||
(b=this.clone().transform(a,c))}a=0;if(b.components&&b.components.length>1)for(var d,e=1,f=b.components.length;e<f;e++)c=b.components[e-1],d=b.components[e],a+=OpenLayers.Util.distVincenty({lon:c.x,lat:c.y},{lon:d.x,lat:d.y});return a*1E3},CLASS_NAME:"OpenLayers.Geometry.Curve"});
OpenLayers.Geometry.LineString=OpenLayers.Class(OpenLayers.Geometry.Curve,{initialize:function(a){OpenLayers.Geometry.Curve.prototype.initialize.apply(this,arguments)},removeComponent:function(a){this.components&&this.components.length>2&&OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments)},intersects:function(a){var b=!1,c=a.CLASS_NAME;if(c=="OpenLayers.Geometry.LineString"||c=="OpenLayers.Geometry.LinearRing"||c=="OpenLayers.Geometry.Point"){var d=this.getSortedSegments(),
a=c=="OpenLayers.Geometry.Point"?[{x1:a.x,y1:a.y,x2:a.x,y2:a.y}]:a.getSortedSegments(),e,f,g,h,i,j,k,m=0,n=d.length;a:for(;m<n;++m){c=d[m];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)&&(j=i.y1,k=i.y2,!(Math.min(j,k)>Math.max(g,h))&&!(Math.max(j,k)<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&&b.edge===!1),d=b&&b.tolerance,e=[],f=this.getVertices(),g=[],h=[],i=!1,j,k,m,n={point:!0,tolerance:d},l=null,o=0,r=f.length-2;o<=r;++o)if(d=f[o],g.push(d.clone()),j=f[o+1],k={x1:d.x,y1:d.y,x2:j.x,y2:j.y},k=OpenLayers.Geometry.segmentsIntersect(a,k,n),k instanceof OpenLayers.Geometry.Point&&((m=
k.x===a.x1&&k.y===a.y1||k.x===a.x2&&k.y===a.y2||k.equals(d)||k.equals(j)?!0:!1)||c))k.equals(h[h.length-1])||h.push(k.clone()),!(o===0&&k.equals(d))&&!k.equals(j)&&(i=!0,k.equals(d)||g.push(k),e.push(new OpenLayers.Geometry.LineString(g)),g=[k.clone()]);i&&(g.push(j.clone()),e.push(new OpenLayers.Geometry.LineString(g)));if(h.length>0)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(),j,k,m,n,l,o=[];g=[];for(var r=0,q=i.length-2;r<=q;++r){j=i[r];k=i[r+1];m={x1:j.x,y1:j.y,x2:k.x,y2:k.y};h=h||[a];d&&o.push(j.clone());for(var p=0;p<h.length;++p)if(n=h[p].splitWithSegment(m,b))if(l=n.lines,l.length>0&&(l.unshift(p,1),Array.prototype.splice.apply(h,l),p+=l.length-2),d)for(var s=0,t=n.points.length;s<t;++s)l=n.points[s],l.equals(j)||(o.push(l),g.push(new OpenLayers.Geometry.LineString(o)),o=l.equals(k)?
[]:[l.clone()])}d&&g.length>0&&o.length>0&&(o.push(k.clone()),g.push(new OpenLayers.Geometry.LineString(o)))}else c=a.splitWith(this,b);h&&h.length>1?f=!0:h=[];g&&g.length>1?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 a===!0?[this.components[0],this.components[this.components.length-1]]:a===!1?this.components.slice(1,this.components.length-1):this.components.slice()},distanceTo:function(a,b){var c=!(b&&b.edge===!1)&&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,j,k=0,m=g.length;k<m;++k)if(j=g[k],d=OpenLayers.Geometry.distanceToSegment(a,j),d.distance<f){if(f=d.distance,e=d,f===0)break}else if(j.x2>h&&(i>j.y1&&i<j.y2||i<j.y1&&i>j.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(),n,l,o=h.length,r={point:!0},
k=0,m=g.length;a:for(;k<m;++k){i=g[k];j=i.x1;l=i.y1;for(var q=0;q<o;++q)if(d=h[q],n=OpenLayers.Geometry.segmentsIntersect(i,d,r)){f=0;e={distance:0,x0:n.x,y0:n.y,x1:n.x,y1:n.y};break a}else if(d=OpenLayers.Geometry.distanceToSegment({x:j,y:l},d),d.distance<f)f=d.distance,e={distance:f,x0:j,y0:l,x1:d.x,y1:d.y}}if(!c)e=e.distance;f!==0&&i&&(d=a.distanceTo(new OpenLayers.Geometry.Point(i.x2,i.y2),b),k=c?d.distance:d,k<f&&(e=c?{distance:f,x0:d.x1,y0:d.y1,x1:d.x0,y1:d.y0}:k))}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&&this!==null){var b=this.getVertices();if(b.length<3)return this;var c=function(a,b,d,i){for(var j=0,k=0,m=b,n;m<d;m++)n=Math.abs(0.5*(a[b].x*a[d].y+a[d].x*a[m].y+a[m].x*a[b].y-a[d].x*a[b].y-a[m].x*a[d].y-a[b].x*a[m].y))/Math.sqrt(Math.pow(a[b].x-a[d].x,2)+Math.pow(a[b].y-a[d].y,2))*2,n>j&&(j=n,k=m);j>i&&k!=b&&(e.push(k),c(a,b,k,i),c(a,k,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)}else return this},CLASS_NAME:"OpenLayers.Geometry.LineString"});
OpenLayers.Geometry.LinearRing=OpenLayers.Class(OpenLayers.Geometry.LineString,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(a){OpenLayers.Geometry.LineString.prototype.initialize.apply(this,arguments)},addComponent:function(a,b){var c=!1,d=this.components.pop();if(b!=null||!a.equals(d))c=OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,arguments);OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[this.components[0]]);return c},removeComponent:function(a){this.components.length>
3&&(this.components.pop(),OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments),OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[this.components[0]]))},move:function(a,b){for(var c=0,d=this.components.length;c<d-1;c++)this.components[c].move(a,b)},rotate:function(a,b){for(var c=0,d=this.components.length;c<d-1;++c)this.components[c].rotate(a,b)},resize:function(a,b,c){for(var d=0,e=this.components.length;d<e-1;++d)this.components[d].resize(a,b,c);return this},
transform:function(a,b){if(a&&b){for(var c=0,d=this.components.length;c<d-1;c++)this.components[c].transform(a,b);this.bounds=null}return this},getCentroid:function(){if(this.components&&this.components.length>2){for(var a=0,b=0,c=0;c<this.components.length-1;c++){var d=this.components[c],e=this.components[c+1];a+=(d.x+e.x)*(d.x*e.y-e.x*d.y);b+=(d.y+e.y)*(d.x*e.y-e.x*d.y)}c=-1*this.getArea();return new OpenLayers.Geometry.Point(a/(6*c),b/(6*c))}else return null},getArea:function(){var a=0;if(this.components&&
this.components.length>2){for(var b=a=0,c=this.components.length;b<c-1;b++){var d=this.components[b],e=this.components[b+1];a+=(d.x+e.x)*(e.y-d.y)}a=-a/2}return a},getGeodesicArea:function(a){var b=this;if(a){var c=new OpenLayers.Projection("EPSG:4326");c.equals(a)||(b=this.clone().transform(a,c))}a=0;c=b.components&&b.components.length;if(c>2){for(var d,e,f=0;f<c-1;f++)d=b.components[f],e=b.components[f+1],a+=OpenLayers.Util.rad(e.x-d.x)*(2+Math.sin(OpenLayers.Util.rad(d.y))+Math.sin(OpenLayers.Util.rad(e.y)));
a=a*40680631590769/2}return a},containsPoint:function(a){for(var b=OpenLayers.Number.limitSigDigs,c=b(a.x,14),a=b(a.y,14),d=this.components.length-1,e,f,g,h,i,j=0,k=0;k<d;++k)if(e=this.components[k],g=b(e.x,14),e=b(e.y,14),f=this.components[k+1],h=b(f.x,14),f=b(f.y,14),e==f){if(a==e&&(g<=h&&c>=g&&c<=h||g>=h&&c<=g&&c>=h)){j=-1;break}}else{i=b(((g-h)*a+(h*e-g*f))/(e-f),14);if(i==c&&(e<f&&a>=e&&a<=f||e>f&&a<=e&&a>=f)){j=-1;break}i<=c||g!=h&&(i<Math.min(g,h)||i>Math.max(g,h))||(e<f&&a>=e&&a<f||e>f&&a<
e&&a>=f)&&++j}return j==-1?1:!!(j&1)},intersects:function(a){var b=!1;if(a.CLASS_NAME=="OpenLayers.Geometry.Point")b=this.containsPoint(a);else if(a.CLASS_NAME=="OpenLayers.Geometry.LineString")b=a.intersects(this);else if(a.CLASS_NAME=="OpenLayers.Geometry.LinearRing")b=OpenLayers.Geometry.LineString.prototype.intersects.apply(this,[a]);else for(var c=0,d=a.components.length;c<d;++c)if(b=a.components[c].intersects(this))break;return b},getVertices:function(a){return a===!0?[]:this.components.slice(0,
this.components.length-1)},CLASS_NAME:"OpenLayers.Geometry.LinearRing"});
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 this.keyMask==null?!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.Point=OpenLayers.Class(OpenLayers.Handler,{point:null,layer:null,multi:!1,mouseDown:!1,stoppedDown:null,lastDown:null,lastUp:null,persist:!1,stopDown:!1,stopUp:!1,layerOptions:null,pixelTolerance:5,touch:!1,lastTouchPx:null,initialize:function(a,b,c){if(!c||!c.layerOptions||!c.layerOptions.styleMap)this.style=OpenLayers.Util.extend(OpenLayers.Feature.Vector.style["default"],{});OpenLayers.Handler.prototype.initialize.apply(this,arguments)},activate:function(){if(!OpenLayers.Handler.prototype.activate.apply(this,
arguments))return!1;var a=OpenLayers.Util.extend({displayInLayerSwitcher:!1,calculateInRange:OpenLayers.Function.True},this.layerOptions);this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,a);this.map.addLayer(this.layer);this.createFeature();return!0},createFeature:function(a){a?(a=this.map.getLonLatFromPixel(a),a=new OpenLayers.Geometry.Point(a.lon,a.lat)):a=new OpenLayers.Geometry.Point;this.point=new OpenLayers.Feature.Vector(a);this.callback("create",[this.point.geometry,this.point]);this.point.geometry.clearBounds();
this.layer.addFeatures([this.point],{silent:!0})},deactivate:function(){if(!OpenLayers.Handler.prototype.deactivate.apply(this,arguments))return!1;this.cancel(!0);this.layer.map!=null&&(this.destroyFeature(),this.layer.destroy(!1));this.layer=null;this.touch=!1;return!0},destroyFeature:function(){this.layer&&this.layer.destroyFeatures();this.point=null},destroyPersistedFeature:function(){var a=this.layer;a&&a.features.length>1&&this.layer.features[0].destroy()},finalize:function(a,b){var c;this.mouseDown=
this.drawing=!1;this.lastTouchPx=this.lastUp=this.lastDown=null;this.callback(a?"cancel":"done",[this.geometryClone()]);(a||!this.persist)&&this.destroyFeature();!b&&this.active&&this.createFeature()},cancel:function(a){this.finalize(!0,a)},click:function(a){OpenLayers.Event.stop(a);return!1},dblclick:function(a){OpenLayers.Event.stop(a);return!1},modifyFeature:function(a){a=this.map.getLonLatFromPixel(a);this.point.geometry.x=a.lon;this.point.geometry.y=a.lat;this.callback("modify",[this.point.geometry,
this.point,!1]);this.point.geometry.clearBounds();this.drawFeature()},drawFeature:function(){this.layer.drawFeature(this.point,this.style)},getGeometry:function(){var a=this.point&&this.point.geometry;a&&this.multi&&(a=new OpenLayers.Geometry.MultiPoint([a]));return a},geometryClone:function(){var a=this.getGeometry();return a&&a.clone()},mousedown:function(a){return this.down(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,dblclick:this.dblclick,scope:this});this.lastTouchPx=a.xy;return this.down(a)},mousemove:function(a){return this.move(a)},touchmove:function(a){this.lastTouchPx=a.xy;return this.move(a)},mouseup:function(a){return this.up(a)},touchend:function(a){a.xy=this.lastTouchPx;return this.up(a)},down:function(a){this.mouseDown=!0;this.lastDown=a.xy;this.touch||this.modifyFeature(a.xy);this.stoppedDown=this.stopDown;return!this.stopDown},move:function(a){!this.touch&&
(!this.mouseDown||this.stoppedDown)&&this.modifyFeature(a.xy);return!0},up:function(a){this.mouseDown=!1;this.stoppedDown=this.stopDown;return!this.checkModifiers(a)?!0:this.lastUp&&this.lastUp.equals(a.xy)?!0:this.lastDown&&this.passesTolerance(this.lastDown,a.xy,this.pixelTolerance)?(this.touch&&this.modifyFeature(a.xy),this.persist&&this.destroyPersistedFeature(),this.lastUp=a.xy,this.finalize(),!this.stopUp):!0},mouseout:function(a){if(OpenLayers.Util.mouseLeft(a,this.map.eventsDiv))this.stoppedDown=
this.stopDown,this.mouseDown=!1},passesTolerance:function(a,b,c){var d=!0;c!=null&&a&&b&&a.distanceTo(b)>c&&(d=!1);return d},CLASS_NAME:"OpenLayers.Handler.Point"});
OpenLayers.Handler.Path=OpenLayers.Class(OpenLayers.Handler.Point,{line:null,maxVertices:null,doubleTouchTolerance:20,freehand:!1,freehandToggle:"shiftKey",timerId:null,initialize:function(a,b,c){OpenLayers.Handler.Point.prototype.initialize.apply(this,arguments)},createFeature:function(a){a?(a=this.map.getLonLatFromPixel(a),a=new OpenLayers.Geometry.Point(a.lon,a.lat)):a=new OpenLayers.Geometry.Point;this.point=new OpenLayers.Feature.Vector(a);this.line=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString([this.point.geometry]));
this.callback("create",[this.point.geometry,this.getSketch()]);this.point.geometry.clearBounds();this.layer.addFeatures([this.line,this.point],{silent:!0})},destroyFeature:function(){OpenLayers.Handler.Point.prototype.destroyFeature.apply(this);this.line=null},destroyPersistedFeature:function(){var a=this.layer;a&&a.features.length>2&&this.layer.features[0].destroy()},removePoint:function(){this.point&&this.layer.removeFeatures([this.point])},addPoint:function(a){this.layer.removeFeatures([this.point]);
a=this.control.map.getLonLatFromPixel(a);this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(a.lon,a.lat));this.line.geometry.addComponent(this.point.geometry,this.line.geometry.components.length);this.layer.addFeatures([this.point]);this.callback("point",[this.point.geometry,this.getGeometry()]);this.callback("modify",[this.point.geometry,this.getSketch()]);this.drawFeature()},freehandMode:function(a){return this.freehandToggle&&a[this.freehandToggle]?!this.freehand:this.freehand},
modifyFeature:function(a,b){var c=this.control.map.getLonLatFromPixel(a);this.point.geometry.x=c.lon;this.point.geometry.y=c.lat;this.callback("modify",[this.point.geometry,this.getSketch(),b]);this.point.geometry.clearBounds();this.drawFeature()},drawFeature:function(){this.layer.drawFeature(this.line,this.style);this.layer.drawFeature(this.point,this.style)},getSketch:function(){return this.line},getGeometry:function(){var a=this.line&&this.line.geometry;a&&this.multi&&(a=new OpenLayers.Geometry.MultiLineString([a]));
return a},touchstart:function(a){if(this.timerId&&this.passesTolerance(this.lastTouchPx,a.xy,this.doubleTouchTolerance))return this.finishGeometry(),window.clearTimeout(this.timerId),this.timerId=null,!1;else{if(this.timerId)window.clearTimeout(this.timerId),this.timerId=null;this.timerId=window.setTimeout(OpenLayers.Function.bind(function(){this.timerId=null},this),300);return OpenLayers.Handler.Point.prototype.touchstart.call(this,a)}},down:function(a){var b=this.stopDown;this.freehandMode(a)&&
(b=!0);!this.touch&&(!this.lastDown||!this.passesTolerance(this.lastDown,a.xy,this.pixelTolerance))&&this.modifyFeature(a.xy,!!this.lastUp);this.mouseDown=!0;this.lastDown=a.xy;this.stoppedDown=b;return!b},move:function(a){if(this.stoppedDown&&this.freehandMode(a))return this.persist&&this.destroyPersistedFeature(),this.addPoint(a.xy),!1;!this.touch&&(!this.mouseDown||this.stoppedDown)&&this.modifyFeature(a.xy,!!this.lastUp);return!0},up:function(a){if(this.mouseDown&&(!this.lastUp||!this.lastUp.equals(a.xy)))if(this.stoppedDown&&
this.freehandMode(a))this.removePoint(),this.finalize();else if(this.passesTolerance(this.lastDown,a.xy,this.pixelTolerance))this.touch&&this.modifyFeature(a.xy),this.lastUp==null&&this.persist&&this.destroyPersistedFeature(),this.addPoint(a.xy),this.lastUp=a.xy,this.line.geometry.components.length===this.maxVertices+1&&this.finishGeometry();this.stoppedDown=this.stopDown;this.mouseDown=!1;return!this.stopUp},finishGeometry:function(){this.line.geometry.removeComponent(this.line.geometry.components[this.line.geometry.components.length-
1]);this.removePoint();this.finalize()},dblclick:function(a){this.freehandMode(a)||this.finishGeometry();return!1},CLASS_NAME:"OpenLayers.Handler.Path"});
OpenLayers.Geometry.Polygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LinearRing"],initialize:function(a){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments)},getArea:function(){var a=0;if(this.components&&this.components.length>0){a+=Math.abs(this.components[0].getArea());for(var b=1,c=this.components.length;b<c;b++)a-=Math.abs(this.components[b].getArea())}return a},getGeodesicArea:function(a){var b=0;if(this.components&&this.components.length>
0){b+=Math.abs(this.components[0].getGeodesicArea(a));for(var c=1,d=this.components.length;c<d;c++)b-=Math.abs(this.components[c].getGeodesicArea(a))}return b},containsPoint:function(a){var b=this.components.length,c=!1;if(b>0&&(c=this.components[0].containsPoint(a),c!==1&&c&&b>1))for(var d,e=1;e<b;++e)if(d=this.components[e].containsPoint(a)){c=d===1?1:!1;break}return c},intersects:function(a){var b=!1,c,d;if(a.CLASS_NAME=="OpenLayers.Geometry.Point")b=this.containsPoint(a);else if(a.CLASS_NAME==
"OpenLayers.Geometry.LineString"||a.CLASS_NAME=="OpenLayers.Geometry.LinearRing"){c=0;for(d=this.components.length;c<d;++c)if(b=a.intersects(this.components[c]))break;if(!b){c=0;for(d=a.components.length;c<d;++c)if(b=this.containsPoint(a.components[c]))break}}else{c=0;for(d=a.components.length;c<d;++c)if(b=this.intersects(a.components[c]))break}if(!b&&a.CLASS_NAME=="OpenLayers.Geometry.Polygon"){var e=this.components[0];c=0;for(d=e.components.length;c<d;++c)if(b=a.containsPoint(e.components[c]))break}return b},
distanceTo:function(a,b){return b&&b.edge===!1&&this.intersects(a)?0:OpenLayers.Geometry.Collection.prototype.distanceTo.apply(this,[a,b])},CLASS_NAME:"OpenLayers.Geometry.Polygon"});OpenLayers.Geometry.Polygon.createRegularPolygon=function(a,b,c,d){var e=Math.PI*(1/c-0.5);d&&(e+=d/180*Math.PI);for(var f,g=[],h=0;h<c;++h)f=e+h*2*Math.PI/c,d=a.x+b*Math.cos(f),f=a.y+b*Math.sin(f),g.push(new OpenLayers.Geometry.Point(d,f));a=new OpenLayers.Geometry.LinearRing(g);return new OpenLayers.Geometry.Polygon([a])};
OpenLayers.Handler.Polygon=OpenLayers.Class(OpenLayers.Handler.Path,{holeModifier:null,drawingHole:!1,polygon:null,initialize:function(a,b,c){OpenLayers.Handler.Path.prototype.initialize.apply(this,arguments)},createFeature:function(a){a?(a=this.map.getLonLatFromPixel(a),a=new OpenLayers.Geometry.Point(a.lon,a.lat)):a=new OpenLayers.Geometry.Point;this.point=new OpenLayers.Feature.Vector(a);this.line=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LinearRing([this.point.geometry]));this.polygon=
new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon([this.line.geometry]));this.callback("create",[this.point.geometry,this.getSketch()]);this.point.geometry.clearBounds();this.layer.addFeatures([this.polygon,this.point],{silent:!0})},addPoint:function(a){if(!this.drawingHole&&this.holeModifier&&this.evt&&this.evt[this.holeModifier])for(var b=this.point.geometry,c=this.control.layer.features,d,e=c.length-1;e>=0;--e)if(d=c[e].geometry,(d instanceof OpenLayers.Geometry.Polygon||d instanceof
OpenLayers.Geometry.MultiPolygon)&&d.intersects(b)){b=c[e];this.control.layer.removeFeatures([b],{silent:!0});this.control.layer.events.registerPriority("sketchcomplete",this,this.finalizeInteriorRing);this.control.layer.events.registerPriority("sketchmodified",this,this.enforceTopology);b.geometry.addComponent(this.line.geometry);this.polygon=b;this.drawingHole=!0;break}OpenLayers.Handler.Path.prototype.addPoint.apply(this,arguments)},enforceTopology:function(a){var a=a.vertex,b=this.line.geometry.components;
if(!this.polygon.geometry.intersects(a))b=b[b.length-3],a.x=b.x,a.y=b.y},finishGeometry:function(){this.line.geometry.removeComponent(this.line.geometry.components[this.line.geometry.components.length-2]);this.removePoint();this.finalize()},finalizeInteriorRing:function(){var a=this.line.geometry,b=a.getArea()!==0;if(b){for(var c=this.polygon.geometry.components,d=c.length-2;d>=0;--d)if(a.intersects(c[d])){b=!1;break}if(b){d=c.length-2;a:for(;d>0;--d)for(var e=c[d].components,f=0,g=e.length;f<g;++f)if(a.containsPoint(e[f])){b=
!1;break a}}}if(b){if(this.polygon.state!==OpenLayers.State.INSERT)this.polygon.state=OpenLayers.State.UPDATE}else this.polygon.geometry.removeComponent(a);this.restoreFeature();return!1},cancel:function(){this.drawingHole&&(this.polygon.geometry.removeComponent(this.line.geometry),this.restoreFeature(!0));return OpenLayers.Handler.Path.prototype.cancel.apply(this,arguments)},restoreFeature:function(a){this.control.layer.events.unregister("sketchcomplete",this,this.finalizeInteriorRing);this.control.layer.events.unregister("sketchmodified",
this,this.enforceTopology);this.layer.removeFeatures([this.polygon],{silent:!0});this.control.layer.addFeatures([this.polygon],{silent:!0});this.drawingHole=!1;a||this.control.layer.events.triggerEvent("sketchcomplete",{feature:this.polygon})},destroyFeature:function(){OpenLayers.Handler.Path.prototype.destroyFeature.apply(this);this.polygon=null},drawFeature:function(){this.layer.drawFeature(this.polygon,this.style);this.layer.drawFeature(this.point,this.style)},getSketch:function(){return this.polygon},
getGeometry:function(){var a=this.polygon&&this.polygon.geometry;a&&this.multi&&(a=new OpenLayers.Geometry.MultiPolygon([a]));return a},CLASS_NAME:"OpenLayers.Handler.Polygon"});
OpenLayers.Renderer=OpenLayers.Class({container:null,root:null,extent:null,locked:!1,size:null,resolution:null,map:null,initialize:function(a,b){this.container=OpenLayers.Util.getElement(a);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(b)this.resolution=null},setSize:function(a){this.size=a.clone();this.resolution=null},getResolution:function(){return this.resolution=
this.resolution||this.map.getResolution()},drawFeature:function(a,b){if(b==null)b=a.style;if(a.geometry){var c=a.geometry.getBounds();if(c){c.intersectsBounds(this.extent)||(b={display:"none"});c=this.drawGeometry(a.geometry,b,a.id);if(b.display!="none"&&b.label&&c!==!1){var 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}}},drawGeometry:function(){},drawText:function(){},removeText:function(){},clear:function(){},getFeatureIdFromEvent:function(){},eraseFeatures:function(a){a instanceof Array||(a=[a]);for(var b=0,c=a.length;b<c;++b){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);
a.stroke===!1&&(delete b.strokeWidth,delete b.strokeColor);a.fill===!1&&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.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")},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=b.display!=="none"&&a.geometry.getBounds().intersectsBounds(this.extent))?
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(d=="OpenLayers.Geometry.Collection"||d=="OpenLayers.Geometry.MultiPoint"||d=="OpenLayers.Geometry.MultiLineString"||d=="OpenLayers.Geometry.MultiPolygon")for(d=0;d<a.components.length;d++)this.drawGeometry(a.components[d],b,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:b.pointRadius*2,f=f?f:b.pointRadius*2,g=b.graphicXOffset!=void 0?b.graphicXOffset:-(0.5*e),h=b.graphicYOffset!=void 0?
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),k=b[0],b=b[1];if(!isNaN(k)&&!isNaN(b)){var k=k+g|0,b=b+h|0,m=this.canvas;m.globalAlpha=i;var n=OpenLayers.Renderer.Canvas.drawImageScaleFactor||(OpenLayers.Renderer.Canvas.drawImageScaleFactor=/android 2.1/.test(navigator.userAgent.toLowerCase())?320/window.screen.width:1);m.drawImage(d,k*n,b*n,e*n,f*n);this.hitDetection&&(this.setHitContextStyle("fill",
c),this.hitContext.fillRect(k,b,e,f))}}},this);d.src=b.externalGraphic},setCanvasStyle:function(a,b){a==="fill"?(this.canvas.globalAlpha=b.fillOpacity,this.canvas.fillStyle=b.fillColor):a==="stroke"?(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(a>=16777216)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);a=="fill"?(this.hitContext.globalAlpha=1,this.hitContext.fillStyle=b):a=="stroke"?(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(b.graphic!==!1)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=Math.PI*2,f=b.pointRadius;b.fill!==!1&&(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()));b.stroke!==!1&&(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){b.fill!==!1&&(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")));b.stroke!==!1&&(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]);e==="fill"?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]];
g==null&&(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]];h==null&&(h=-0.5);g=OpenLayers.Renderer.Canvas.LABEL_FACTOR[b.labelAlign[1]];g==null&&(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]),j=
c[1]+g*d;this.canvas.translate(i,j);this.canvas.mozDrawText(e[g]);this.canvas.translate(-i,-j)}}this.setCanvasStyle("reset")},getLocalXY:function(a){var b=this.getResolution(),c=this.extent;return[a.x/b+-c.left/b,c.top/b-a.y/b]},clear:function(){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,a[3]===255&&(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){a instanceof Array||(a=[a]);for(var b=0;b<a.length;++b)delete this.features[a[b].id];this.redraw()},redraw:function(){if(!this.locked){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;for(d in this.features)this.features.hasOwnProperty(d)&&(b=
this.features[d][0],c=this.features[d][1],this.drawGeometry(b.geometry,c,b.id),c.label&&a.push([b,c]));b=0;for(c=a.length;b<c;++b)d=a[b],this.drawText(d[0].geometry.getCentroid(),d[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.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);e!=null&&!d&&!b;){if(!b)try{var f=e.currentStyle?e.currentStyle.overflow:document.defaultView.getComputedStyle(e,null).getPropertyValue("overflow"),b=f&&f=="auto"||f=="scroll"}catch(g){}if(!c)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&&window.opera.version()<9.2&&(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());b<0?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}else 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}else return!1},CLASS_NAME:"OpenLayers.Handler.MouseWheel"});OpenLayers.Symbolizer=OpenLayers.Class({zIndex:0,initialize:function(a){OpenLayers.Util.extend(this,a)},clone:function(){return new (eval(this.CLASS_NAME))(OpenLayers.Util.extend({},this))},CLASS_NAME:"OpenLayers.Symbolizer"});
OpenLayers.Symbolizer.Raster=OpenLayers.Class(OpenLayers.Symbolizer,{initialize:function(a){OpenLayers.Symbolizer.prototype.initialize.apply(this,arguments)},CLASS_NAME:"OpenLayers.Symbolizer.Raster"});
OpenLayers.Geometry.MultiLineString=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LineString"],initialize:function(a){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments)},split:function(a,b){for(var c=null,d=b&&b.mutual,e,f,g,h,i=[],j=[a],k=0,m=this.components.length;k<m;++k){f=this.components[k];g=!1;for(var n=0;n<j.length;++n)if(e=f.split(j[n],b)){if(d){g=e[0];for(var l=0,o=g.length;l<o;++l)l===0&&i.length?i[i.length-1].addComponent(g[l]):
i.push(new OpenLayers.Geometry.MultiLineString([g[l]]));g=!0;e=e[1]}if(e.length){e.unshift(n,1);Array.prototype.splice.apply(j,e);break}}g||(i.length?i[i.length-1].addComponent(f.clone()):i=[new OpenLayers.Geometry.MultiLineString(f.clone())])}i&&i.length>1?g=!0:i=[];j&&j.length>1?h=!0:j=[];if(g||h)c=d?[i,j]:j;return c},splitWith:function(a,b){var c=null,d=b&&b.mutual,e,f,g,h,i,j;if(a instanceof OpenLayers.Geometry.LineString){j=[];i=[a];for(var k=0,m=this.components.length;k<m;++k){g=!1;f=this.components[k];
for(var n=0;n<i.length;++n)if(e=i[n].split(f,b)){d&&(g=e[0],g.length&&(g.unshift(n,1),Array.prototype.splice.apply(i,g),n+=g.length-2),e=e[1],e.length===0&&(e=[f.clone()]));g=0;for(var l=e.length;g<l;++g)g===0&&j.length?j[j.length-1].addComponent(e[g]):j.push(new OpenLayers.Geometry.MultiLineString([e[g]]));g=!0}g||(j.length?j[j.length-1].addComponent(f.clone()):j=[new OpenLayers.Geometry.MultiLineString([f.clone()])])}}else c=a.split(this);i&&i.length>1?h=!0:i=[];j&&j.length>1?g=!0:j=[];if(h||g)c=
d?[i,j]:j;return c},CLASS_NAME:"OpenLayers.Geometry.MultiLineString"});
OpenLayers.ElementsIndexer=OpenLayers.Class({maxZIndex:null,order:null,indices:null,compare:null,initialize:function(a){this.compare=a?OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_Y_ORDER:OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_DRAWING_ORDER;this.order=[];this.indices={};this.maxZIndex=0},insert:function(a){this.exists(a)&&this.remove(a);var b=a.id;this.determineZIndex(a);for(var c=-1,d=this.order.length,e;d-c>1;)e=parseInt((c+d)/2),this.compare(this,a,OpenLayers.Util.getElement(this.order[e]))>
0?c=e:d=e;this.order.splice(d,0,b);this.indices[b]=this.getZIndex(a);return this.getNextElement(d)},remove:function(a){var a=a.id,b=OpenLayers.Util.indexOf(this.order,a);if(b>=0)this.order.splice(b,1),delete this.indices[a],this.maxZIndex=this.order.length>0?this.indices[this.order[this.order.length-1]]:0},clear:function(){this.order=[];this.indices={};this.maxZIndex=0},exists:function(a){return this.indices[a.id]!=null},getZIndex:function(a){return a._style.graphicZIndex},determineZIndex:function(a){var b=
a._style.graphicZIndex;if(b==null)b=this.maxZIndex,a._style.graphicZIndex=b;else if(b>this.maxZIndex)this.maxZIndex=b},getNextElement:function(a){a+=1;if(a<this.order.length){var b=OpenLayers.Util.getElement(this.order[a]);b==void 0&&(b=this.getNextElement(a));return b}else 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&&a==0&&(a=1);return a},Z_ORDER_Y_ORDER:function(a,b,c){a=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(a,b,c);c&&a===0&&(b=c._boundsBottom-b._boundsBottom,a=b===0?1:b);return a}};
OpenLayers.Renderer.Elements=OpenLayers.Class(OpenLayers.Renderer,{rendererRoot:null,root:null,vectorRoot:null,textRoot:null,xmlns:null,indexer:null,BACKGROUND_ID_SUFFIX:"_background",LABEL_ID_SUFFIX:"_label",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()},getNodeType:function(){},
drawGeometry:function(a,b,c){var d=a.CLASS_NAME,e=!0;if(d=="OpenLayers.Geometry.Collection"||d=="OpenLayers.Geometry.MultiPoint"||d=="OpenLayers.Geometry.MultiLineString"||d=="OpenLayers.Geometry.MultiPolygon"){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;b.display!="none"&&(b.backgroundGraphic?this.redrawBackgroundNode(a.id,a,b,c):d=!0,e=this.redrawNode(a.id,a,b,c));if(e==!1&&(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(b===!1)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:c.fill===void 0?!0:c.fill,isStroked:c.stroke===void 0?!!c.strokeWidth:c.stroke},e;switch(b.CLASS_NAME){case "OpenLayers.Geometry.Point":if(c.graphic===!1)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.Surface":e=this.drawSurface(a,b);break;case "OpenLayers.Geometry.Rectangle":e=this.drawRectangle(a,b)}a._options=d;return e!=!1?{node:this.setStyle(a,c,d,b),complete:e}:!1},postDraw:function(){},drawPoint:function(){},drawLineString:function(){},drawLinearRing:function(){},drawPolygon:function(){},drawRectangle:function(){},drawCircle:function(){},drawSurface:function(){},removeText:function(a){(a=document.getElementById(a+this.LABEL_ID_SUFFIX))&&
this.textRoot.removeChild(a)},getFeatureIdFromEvent:function(a){var b=a.target,c=b&&b.correspondingUseElement;return(c?c:b||a.srcElement)._featureId},eraseGeometry:function(a,b){if(a.CLASS_NAME=="OpenLayers.Geometry.MultiPoint"||a.CLASS_NAME=="OpenLayers.Geometry.MultiLineString"||a.CLASS_NAME=="OpenLayers.Geometry.MultiPolygon"||a.CLASS_NAME=="OpenLayers.Geometry.Collection")for(var 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 a!="circle"&&!!a},CLASS_NAME:"OpenLayers.Renderer.Elements"});
OpenLayers.Renderer.symbol={star:[350,75,379,161,469,161,397,215,423,301,350,250,277,301,303,215,231,161,321,161,350,75],cross:[4,0,6,0,6,4,10,4,10,6,6,6,6,10,4,10,4,6,0,6,0,4,4,4,4,0],x:[0,0,25,0,50,35,75,0,100,0,65,50,100,100,75,100,50,65,25,100,0,100,35,50,0,0],square:[0,0,0,1,1,1,1,0,0,0],triangle:[0,10,10,10,5,0,0,10]};
OpenLayers.Geometry.MultiPolygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.Polygon"],initialize:function(a){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments)},CLASS_NAME:"OpenLayers.Geometry.MultiPolygon"});
OpenLayers.Handler.Feature=OpenLayers.Class(OpenLayers.Handler,{EVENTMAP:{click:{"in":"click",out:"clickout"},mousemove:{"in":"over",out:"out"},dblclick:{"in":"dblclick",out:null},mousedown:{"in":null,out:null},mouseup:{"in":null,out:null},touchstart:{"in":"click",out:"clickout"}},feature:null,lastFeature:null,down:null,up:null,touch:!1,clickTolerance:4,geometryTypes:null,stopClick:!0,stopDown:!0,stopUp:!1,initialize:function(a,b,c,d){OpenLayers.Handler.prototype.initialize.apply(this,[a,c,d]);this.layer=
b},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,dblclick:this.dblclick,scope:this});return OpenLayers.Event.isMultiTouch(a)?!0:this.mousedown(a)},touchmove:function(a){OpenLayers.Event.stop(a)},mousedown:function(a){this.down=a.xy;return this.handle(a)?!this.stopDown:!0},mouseup:function(a){this.up=a.xy;return this.handle(a)?!this.stopUp:!0},click:function(a){return this.handle(a)?!this.stopClick:
!0},mousemove:function(a){if(!this.callbacks.over&&!this.callbacks.out)return!0;this.handle(a);return!0},dblclick:function(a){return!this.handle(a)},geometryTypeMatches:function(a){return this.geometryTypes==null||OpenLayers.Util.indexOf(this.geometryTypes,a.geometry.CLASS_NAME)>-1},handle:function(a){if(this.feature&&!this.feature.layer)this.feature=null;var b=a.type,c=!1,d=!!this.feature,e=b=="click"||b=="dblclick"||b=="touchstart";if((this.feature=this.layer.getFeatureFromEvent(a))&&!this.feature.layer)this.feature=
null;if(this.lastFeature&&!this.lastFeature.layer)this.lastFeature=null;this.feature?(b==="touchstart"&&OpenLayers.Event.stop(a),a=this.feature!=this.lastFeature,this.geometryTypeMatches(this.feature)?(d&&a?(this.lastFeature&&this.triggerCallback(b,"out",[this.lastFeature]),this.triggerCallback(b,"in",[this.feature])):(!d||e)&&this.triggerCallback(b,"in",[this.feature]),this.lastFeature=this.feature,c=!0):(this.lastFeature&&(d&&a||e)&&this.triggerCallback(b,"out",[this.lastFeature]),this.feature=
null)):this.lastFeature&&(d||e)&&this.triggerCallback(b,"out",[this.lastFeature]);return c},triggerCallback:function(a,b,c){(b=this.EVENTMAP[a][b])&&(a=="click"&&this.up&&this.down?Math.sqrt(Math.pow(this.up.x-this.down.x,2)+Math.pow(this.up.y-this.down.y,2))<=this.clickTolerance&&this.callback(b,c):this.callback(b,c))},activate:function(){var a=!1;OpenLayers.Handler.prototype.activate.apply(this,arguments)&&(this.moveLayerToTop(),this.map.events.on({removelayer:this.handleMapEvents,changelayer:this.handleMapEvents,
scope:this}),a=!0);return a},deactivate:function(){var a=!1;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments))this.moveLayerBack(),this.up=this.down=this.lastFeature=this.feature=null,this.touch=!1,this.map.events.un({removelayer:this.handleMapEvents,changelayer:this.handleMapEvents,scope:this}),a=!0;return a},handleMapEvents:function(a){(!a.property||a.property=="order")&&this.moveLayerToTop()},moveLayerToTop:function(){this.layer.setZIndex(Math.max(this.map.Z_INDEX_BASE.Feature-1,
this.layer.getZIndex())+1)},moveLayerBack:function(){var a=this.layer.getZIndex()-1;a>=this.map.Z_INDEX_BASE.Feature?this.layer.setZIndex(a):this.map.setLayerZIndex(this.layer,this.map.getLayerIndex(this.layer))},CLASS_NAME:"OpenLayers.Handler.Feature"});
OpenLayers.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(f==!1&&e.length>0){f=!0;g=0;for(h=e.length;g<h;g++)this.applySymbolizer(e[g],b,a)}if(c.length>0&&f==!1)b.display="none";if(b.label&&typeof b.label!==
"string")b.label=String(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(this.defaultsPerSymbolizer===!0)d=this.defaultStyle,OpenLayers.Util.applyDefaults(a,{pointRadius:d.pointRadius}),(a.stroke===!0||a.graphic===!0)&&OpenLayers.Util.applyDefaults(a,{strokeWidth:d.strokeWidth,strokeColor:d.strokeColor,strokeOpacity:d.strokeOpacity,strokeDashstyle:d.strokeDashstyle,strokeLinecap:d.strokeLinecap}),
(a.fill===!0||a.graphic===!0)&&OpenLayers.Util.applyDefaults(a,{fillColor:d.fillColor,fillOpacity:d.fillOpacity}),a.graphic===!0&&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],typeof d=="object")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],typeof c=="string"&&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(a.CLASS_NAME.indexOf(b[c])!=-1)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){typeof a=="string"&&a.indexOf("${")!=-1&&(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.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(typeof a=="object")for(var c in a)if(a[c]instanceof OpenLayers.Style)this.styles[c]=a[c];else if(typeof a[c]=="object")this.styles[c]=new OpenLayers.Style(a[c]);else{this.styles["default"]=new OpenLayers.Style(a);this.styles.select=new OpenLayers.Style(a);this.styles.temporary=new OpenLayers.Style(a);this.styles["delete"]=new OpenLayers.Style(a);break}OpenLayers.Util.extend(this,b)},destroy:function(){for(var a in this.styles)this.styles[a].destroy();this.styles=null},createSymbolizer:function(a,
b){a||(a=new OpenLayers.Feature.Vector);this.styles[b]||(b="default");a.renderIntent=b;var c={};this.extendDefault&&b!="default"&&(c=this.styles["default"].createSymbolizer(a));return OpenLayers.Util.extend(c,this.styles[b].createSymbolizer(a))},addUniqueValueRules:function(a,b,c,d){var e=[],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,{EVENT_TYPES:["beforefeatureadded","beforefeaturesadded","featureadded","featuresadded","beforefeatureremoved","beforefeaturesremoved","featureremoved","featuresremoved","beforefeatureselected","featureselected","featureunselected","beforefeaturemodified","featuremodified","afterfeaturemodified","vertexmodified","vertexremoved","sketchstarted","sketchmodified","sketchcomplete","refresh"],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){this.EVENT_TYPES=OpenLayers.Layer.Vector.prototype.EVENT_TYPES.concat(OpenLayers.Layer.prototype.EVENT_TYPES);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;b=0;for(c=this.strategies.length;b<c;b++)a=this.strategies[b],a.autoDestroy&&a.destroy();this.strategies=null}if(this.protocol)this.protocol.autoDestroy&&this.protocol.destroy(),this.protocol=null;this.destroyFeatures();
this.unrenderedFeatures=this.selectedFeatures=this.features=null;this.renderer&&this.renderer.destroy();this.drawn=this.geometryType=this.renderer=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(a){a==null&&(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=typeof c=="function"?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;b=0;for(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;b=0;for(c=this.strategies.length;b<c;b++)a=this.strategies[b],a.autoActivate&&a.deactivate()}},onMapResize:function(){OpenLayers.Layer.prototype.onMapResize.apply(this,arguments);this.renderer.setSize(this.map.getSize())},
moveTo:function(a,b,c){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);var d=OpenLayers.Renderer.NG&&this.renderer instanceof OpenLayers.Renderer.NG;if(d)b&&this.renderer.updateDimensions();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(OpenLayers.IS_GECKO===!0)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){a instanceof Array||(a=[a]);var c=!b||!b.silent;if(c){var d={features:a};if(this.events.triggerEvent("beforefeaturesadded",d)===!1)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 OpenLayers.i18n("componentShouldBe",{geomType:this.geometryType.prototype.CLASS_NAME});
g.layer=this;if(!g.style&&this.style)g.style=OpenLayers.Util.extend({},this.style);if(c){if(this.events.triggerEvent("beforefeatureadded",{feature:g})===!1)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&&a.length!==0){if(a===this.features)return this.removeAllFeatures(b);a instanceof Array||
(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;d>=0;d--){this.renderer.locked=d!=0&&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);OpenLayers.Util.indexOf(this.selectedFeatures,e)!=-1&&OpenLayers.Util.removeItem(this.selectedFeatures,
e);c&&this.events.triggerEvent("featureremoved",{feature:e})}c&&this.events.triggerEvent("featuresremoved",{features:a})}},removeAllFeatures:function(a){var a=!a||!a.silent,b=this.features;a&&this.events.triggerEvent("beforefeaturesremoved",{features:b});for(var c,d=b.length-1;d>=0;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(a==void 0)a=this.features;if(a){this.removeFeatures(a,b);for(var c=a.length-1;c>=0;c--)a[c].destroy()}},drawFeature:function(a,b){if(this.drawn){if(typeof b!="object"){!b&&a.state===OpenLayers.State.DELETE&&(b="delete");var c=b||a.renderIntent;(b=a.style||this.style)||(b=this.styleMap.createSymbolizer(a,c))}c=this.renderer.drawFeature(a,b);c===!1||c===null?this.unrenderedFeatures[a.id]=a:delete this.unrenderedFeatures[a.id]}},
eraseFeatures:function(a){this.renderer.eraseFeatures(a)},getFeatureFromEvent:function(a){if(!this.renderer)return OpenLayers.Console.error(OpenLayers.i18n("getFeatureError")),null;var b=null;(a=this.renderer.getFeatureIdFromEvent(a))&&(b=typeof a==="string"?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&&b.length>0)for(var a=new OpenLayers.Bounds,c=null,d=0,e=b.length;d<e;d++)(c=b[d].geometry)&&a.extend(c.getBounds());return a},CLASS_NAME:"OpenLayers.Layer.Vector"});
OpenLayers.Layer.Vector.RootContainer=OpenLayers.Class(OpenLayers.Layer.Vector,{displayInLayerSwitcher:!1,layers:null,initialize:function(a,b){OpenLayers.Layer.Vector.prototype.initialize.apply(this,arguments)},display:function(){},getFeatureFromEvent:function(a){for(var b=this.layers,c,d=0;d<b.length;d++)if(c=b[d].getFeatureFromEvent(a))return c},setMap:function(a){OpenLayers.Layer.Vector.prototype.setMap.apply(this,arguments);this.collectRoots();a.events.register("changelayer",this,this.handleChangeLayer)},
removeMap:function(a){a.events.unregister("changelayer",this,this.handleChangeLayer);this.resetRoots();OpenLayers.Layer.Vector.prototype.removeMap.apply(this,arguments)},collectRoots:function(){for(var a,b=0;b<this.map.layers.length;++b)a=this.map.layers[b],OpenLayers.Util.indexOf(this.layers,a)!=-1&&a.renderer.moveRoot(this.renderer)},resetRoots:function(){for(var a,b=0;b<this.layers.length;++b)a=this.layers[b],this.renderer&&a.renderer.getRenderLayerId()==this.id&&this.renderer.moveRoot(a.renderer)},
handleChangeLayer:function(a){var b=a.layer;a.property=="order"&&OpenLayers.Util.indexOf(this.layers,b)!=-1&&(this.resetRoots(),this.collectRoots())},CLASS_NAME:"OpenLayers.Layer.Vector.RootContainer"});
OpenLayers.Control.SelectFeature=OpenLayers.Class(OpenLayers.Control,{EVENT_TYPES:["beforefeaturehighlighted","featurehighlighted","featureunhighlighted"],multipleKey:null,toggleKey:null,multiple:!1,clickout:!0,toggle:!1,hover:!1,highlightOnly:!1,box:!1,onBeforeSelect:function(){},onSelect:function(){},onUnselect:function(){},scope:null,geometryTypes:null,layer:null,layers:null,callbacks:null,selectStyle:null,renderIntent:"select",handlers:null,initialize:function(a,b){this.EVENT_TYPES=OpenLayers.Control.SelectFeature.prototype.EVENT_TYPES.concat(OpenLayers.Control.prototype.EVENT_TYPES);
OpenLayers.Control.prototype.initialize.apply(this,[b]);if(this.scope===null)this.scope=this;this.initLayer(a);var c={click:this.clickFeature,clickout:this.clickoutFeature};if(this.hover)c.over=this.overFeature,c.out=this.outFeature;this.callbacks=OpenLayers.Util.extend(c,this.callbacks);this.handlers={feature:new OpenLayers.Handler.Feature(this,this.layer,this.callbacks,{geometryTypes:this.geometryTypes})};if(this.box)this.handlers.box=new OpenLayers.Handler.Box(this,{done:this.selectBox},{boxDivClassName:"olHandlerBoxSelectFeature"})},
initLayer:function(a){a instanceof Array?(this.layers=a,this.layer=new OpenLayers.Layer.Vector.RootContainer(this.id+"_container",{layers:a})):this.layer=a},destroy:function(){this.active&&this.layers&&this.map.removeLayer(this.layer);OpenLayers.Control.prototype.destroy.apply(this,arguments);this.layers&&this.layer.destroy()},activate:function(){this.active||(this.layers&&this.map.addLayer(this.layer),this.handlers.feature.activate(),this.box&&this.handlers.box&&this.handlers.box.activate());return OpenLayers.Control.prototype.activate.apply(this,
arguments)},deactivate:function(){this.active&&(this.handlers.feature.deactivate(),this.handlers.box&&this.handlers.box.deactivate(),this.layers&&this.map.removeLayer(this.layer));return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},unselectAll:function(a){for(var b=this.layers||[this.layer],c,d,e=0;e<b.length;++e){c=b[e];for(var f=c.selectedFeatures.length-1;f>=0;--f)d=c.selectedFeatures[f],(!a||a.except!=d)&&this.unselect(d)}},clickFeature:function(a){this.hover||(OpenLayers.Util.indexOf(a.layer.selectedFeatures,
a)>-1?this.toggleSelect()?this.unselect(a):this.multipleSelect()||this.unselectAll({except:a}):(this.multipleSelect()||this.unselectAll({except:a}),this.select(a)))},multipleSelect:function(){return this.multiple||this.handlers.feature.evt&&this.handlers.feature.evt[this.multipleKey]},toggleSelect:function(){return this.toggle||this.handlers.feature.evt&&this.handlers.feature.evt[this.toggleKey]},clickoutFeature:function(){!this.hover&&this.clickout&&this.unselectAll()},overFeature:function(a){var b=
a.layer;this.hover&&(this.highlightOnly?this.highlight(a):OpenLayers.Util.indexOf(b.selectedFeatures,a)==-1&&this.select(a))},outFeature:function(a){if(this.hover)if(this.highlightOnly){if(a._lastHighlighter==this.id)if(a._prevHighlighter&&a._prevHighlighter!=this.id){delete a._lastHighlighter;var b=this.map.getControl(a._prevHighlighter);b&&b.highlight(a)}else this.unhighlight(a)}else this.unselect(a)},highlight:function(a){var b=a.layer;if(this.events.triggerEvent("beforefeaturehighlighted",{feature:a})!==
!1)a._prevHighlighter=a._lastHighlighter,a._lastHighlighter=this.id,b.drawFeature(a,this.selectStyle||this.renderIntent),this.events.triggerEvent("featurehighlighted",{feature:a})},unhighlight:function(a){var b=a.layer;if(a._prevHighlighter==void 0)delete a._lastHighlighter;else{if(a._prevHighlighter!=this.id)a._lastHighlighter=a._prevHighlighter;delete a._prevHighlighter}b.drawFeature(a,a.style||a.layer.style||"default");this.events.triggerEvent("featureunhighlighted",{feature:a})},select:function(a){var b=
this.onBeforeSelect.call(this.scope,a),c=a.layer;if(b!==!1&&(b=c.events.triggerEvent("beforefeatureselected",{feature:a}),b!==!1)){c.selectedFeatures.push(a);this.highlight(a);if(!this.handlers.feature.lastFeature)this.handlers.feature.lastFeature=c.selectedFeatures[0];c.events.triggerEvent("featureselected",{feature:a});this.onSelect.call(this.scope,a)}},unselect:function(a){var b=a.layer;this.unhighlight(a);OpenLayers.Util.removeItem(b.selectedFeatures,a);b.events.triggerEvent("featureunselected",
{feature:a});this.onUnselect.call(this.scope,a)},selectBox:function(a){if(a instanceof OpenLayers.Bounds){var b=this.map.getLonLatFromPixel(new OpenLayers.Pixel(a.left,a.bottom)),a=this.map.getLonLatFromPixel(new OpenLayers.Pixel(a.right,a.top)),b=new OpenLayers.Bounds(b.lon,b.lat,a.lon,a.lat);this.multipleSelect()||this.unselectAll();a=this.multiple;this.multiple=!0;for(var c=this.layers||[this.layer],d,e=0;e<c.length;++e){d=c[e];for(var f=0,g=d.features.length;f<g;++f){var h=d.features[f];h.getVisibility()&&
(this.geometryTypes==null||OpenLayers.Util.indexOf(this.geometryTypes,h.geometry.CLASS_NAME)>-1)&&b.toGeometry().intersects(h.geometry)&&OpenLayers.Util.indexOf(d.selectedFeatures,h)==-1&&this.select(h)}}this.multiple=a}},setMap:function(a){this.handlers.feature.setMap(a);this.box&&this.handlers.box.setMap(a);OpenLayers.Control.prototype.setMap.apply(this,arguments)},setLayer:function(a){var b=this.active;this.unselectAll();this.deactivate();if(this.layers)this.layer.destroy(),this.layers=null;this.initLayer(a);
this.handlers.feature.layer=this.layer;b&&this.activate()},CLASS_NAME:"OpenLayers.Control.SelectFeature"});
OpenLayers.Kinetic=OpenLayers.Class({threshold:0,interval:10,deceleration:0.0035,nbPoints:100,delay:200,points:void 0,timerId:void 0,initialize:function(a){OpenLayers.Util.extend(this,a)},begin:function(){clearInterval(this.timerId);this.timerId=void 0;this.points=[]},update:function(a){this.points.unshift({xy:a,tick:(new Date).getTime()});this.points.length>this.nbPoints&&this.points.pop()},end:function(a){for(var b,c=(new Date).getTime(),d=0,e=this.points.length,f;d<e;d++){f=this.points[d];if(c-
f.tick>this.delay)break;b=f}if(b&&(d=(new Date).getTime()-b.tick,c=Math.sqrt(Math.pow(a.x-b.xy.x,2)+Math.pow(a.y-b.xy.y,2)),d=c/d,!(d==0||d<this.threshold)))return c=Math.asin((a.y-b.xy.y)/c),b.xy.x<=a.x&&(c=Math.PI-c),{speed:d,theta:c}},move:function(a,b){var c=a.speed,d=Math.cos(a.theta),e=-Math.sin(a.theta),f=0,g=(new Date).getTime(),h=0,i=0;this.timerId=window.setInterval(OpenLayers.Function.bind(function(){if(this.timerId!=null){f+=this.interval;var a=(new Date).getTime()-g,a=(f+a)/2,k=-this.deceleration*
Math.pow(a,2)/2+c*a,m=k*d;k*=e;var n={end:!1};if(-this.deceleration*a+c<=0)clearInterval(this.timerId),this.timerId=null,n.end=!0;n.x=m-h;n.y=k-i;h=m;i=k;b(n.x,n.y,n.end)}},this),this.interval)},CLASS_NAME:"OpenLayers.Kinetic"});
OpenLayers.Popup=OpenLayers.Class({events:null,id:"",lonlat:null,div:null,contentSize:null,size:null,contentHTML:null,backgroundColor:"",opacity:"",border:"",contentDiv:null,groupDiv:null,closeDiv:null,autoSize:!1,minSize:null,maxSize:null,displayClass:"olPopup",contentDisplayClass:"olPopupContent",padding:0,disableFirefoxOverflowHack:!1,fixPadding:function(){if(typeof this.padding=="number")this.padding=new OpenLayers.Bounds(this.padding,this.padding,this.padding,this.padding)},panMapIfOutOfView:!1,
keepInMap:!1,closeOnMove:!1,map:null,initialize:function(a,b,c,d,e,f){a==null&&(a=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_"));this.id=a;this.lonlat=b;this.contentSize=c!=null?c:new OpenLayers.Size(OpenLayers.Popup.WIDTH,OpenLayers.Popup.HEIGHT);if(d!=null)this.contentHTML=d;this.backgroundColor=OpenLayers.Popup.COLOR;this.opacity=OpenLayers.Popup.OPACITY;this.border=OpenLayers.Popup.BORDER;this.div=OpenLayers.Util.createDiv(this.id,null,null,null,null,null,"hidden");this.div.className=this.displayClass;
this.groupDiv=OpenLayers.Util.createDiv(this.id+"_GroupDiv",null,null,null,"relative",null,"hidden");a=this.div.id+"_contentDiv";this.contentDiv=OpenLayers.Util.createDiv(a,null,this.contentSize.clone(),null,"relative");this.contentDiv.className=this.contentDisplayClass;this.groupDiv.appendChild(this.contentDiv);this.div.appendChild(this.groupDiv);e&&this.addCloseBox(f);this.registerEvents()},destroy:function(){this.border=this.opacity=this.backgroundColor=this.contentHTML=this.size=this.lonlat=this.id=
null;this.closeOnMove&&this.map&&this.map.events.unregister("movestart",this,this.hide);this.events.destroy();this.events=null;this.closeDiv&&(OpenLayers.Event.stopObservingElement(this.closeDiv),this.groupDiv.removeChild(this.closeDiv));this.closeDiv=null;this.div.removeChild(this.groupDiv);this.groupDiv=null;this.map!=null&&this.map.removePopup(this);this.panMapIfOutOfView=this.padding=this.maxSize=this.minSize=this.autoSize=this.div=this.map=null},draw:function(a){a==null&&this.lonlat!=null&&this.map!=
null&&(a=this.map.getLayerPxFromLonLat(this.lonlat));this.closeOnMove&&this.map.events.register("movestart",this,this.hide);!this.disableFirefoxOverflowHack&&OpenLayers.BROWSER_NAME=="firefox"&&(this.map.events.register("movestart",this,function(){var a=document.defaultView.getComputedStyle(this.contentDiv,null).getPropertyValue("overflow");if(a!="hidden")this.contentDiv._oldOverflow=a,this.contentDiv.style.overflow="hidden"}),this.map.events.register("moveend",this,function(){var a=this.contentDiv._oldOverflow;
if(a)this.contentDiv.style.overflow=a,this.contentDiv._oldOverflow=null}));this.moveTo(a);!this.autoSize&&!this.size&&this.setSize(this.contentSize);this.setBackgroundColor();this.setOpacity();this.setBorder();this.setContentHTML();this.panMapIfOutOfView&&this.panIntoView();return this.div},updatePosition:function(){if(this.lonlat&&this.map){var a=this.map.getLayerPxFromLonLat(this.lonlat);a&&this.moveTo(a)}},moveTo:function(a){if(a!=null&&this.div!=null)this.div.style.left=a.x+"px",this.div.style.top=
a.y+"px"},visible:function(){return OpenLayers.Element.visible(this.div)},toggle:function(){this.visible()?this.hide():this.show()},show:function(){this.div.style.display="";this.panMapIfOutOfView&&this.panIntoView()},hide:function(){this.div.style.display="none"},setSize:function(a){this.size=a.clone();var b=this.getContentDivPadding(),c=b.left+b.right,d=b.top+b.bottom;this.fixPadding();c+=this.padding.left+this.padding.right;d+=this.padding.top+this.padding.bottom;if(this.closeDiv){var e=parseInt(this.closeDiv.style.width);
c+=e+b.right}this.size.w+=c;this.size.h+=d;OpenLayers.BROWSER_NAME=="msie"&&(this.contentSize.w+=b.left+b.right,this.contentSize.h+=b.bottom+b.top);if(this.div!=null)this.div.style.width=this.size.w+"px",this.div.style.height=this.size.h+"px";if(this.contentDiv!=null)this.contentDiv.style.width=a.w+"px",this.contentDiv.style.height=a.h+"px"},updateSize:function(){var a="<div class='"+this.contentDisplayClass+"'>"+this.contentDiv.innerHTML+"</div>",b=this.map?this.map.layerContainerDiv:document.body,
c=OpenLayers.Util.getRenderedDimensions(a,null,{displayClass:this.displayClass,containerElement:b}),d=this.getSafeContentSize(c),e=null;d.equals(c)?e=c:(e=new OpenLayers.Size,e.w=d.w<c.w?d.w:null,e.h=d.h<c.h?d.h:null,e.w&&e.h?e=d:(a=OpenLayers.Util.getRenderedDimensions(a,e,{displayClass:this.contentDisplayClass,containerElement:b}),OpenLayers.Element.getStyle(this.contentDiv,"overflow")!="hidden"&&a.equals(d)&&(d=OpenLayers.Util.getScrollbarWidth(),e.w?a.h+=d:a.w+=d),e=this.getSafeContentSize(a)));
this.setSize(e)},setBackgroundColor:function(a){if(a!=void 0)this.backgroundColor=a;if(this.div!=null)this.div.style.backgroundColor=this.backgroundColor},setOpacity:function(a){if(a!=void 0)this.opacity=a;if(this.div!=null)this.div.style.opacity=this.opacity,this.div.style.filter="alpha(opacity="+this.opacity*100+")"},setBorder:function(a){if(a!=void 0)this.border=a;if(this.div!=null)this.div.style.border=this.border},setContentHTML:function(a){if(a!=null)this.contentHTML=a;if(this.contentDiv!=null&&
this.contentHTML!=null&&this.contentHTML!=this.contentDiv.innerHTML)this.contentDiv.innerHTML=this.contentHTML,this.autoSize&&(this.registerImageListeners(),this.updateSize())},registerImageListeners:function(){for(var a=function(){this.popup.updateSize();this.popup.visible()&&this.popup.panMapIfOutOfView&&this.popup.panIntoView();OpenLayers.Event.stopObserving(this.img,"load",this.img._onImageLoad)},b=this.contentDiv.getElementsByTagName("img"),c=0,d=b.length;c<d;c++){var e=b[c];if(e.width==0||e.height==
0)e._onImgLoad=OpenLayers.Function.bind(a,{popup:this,img:e}),OpenLayers.Event.observe(e,"load",e._onImgLoad)}},getSafeContentSize:function(a){var a=a.clone(),b=this.getContentDivPadding(),c=b.left+b.right,d=b.top+b.bottom;this.fixPadding();c+=this.padding.left+this.padding.right;d+=this.padding.top+this.padding.bottom;if(this.closeDiv){var e=parseInt(this.closeDiv.style.width);c+=e+b.right}if(this.minSize)a.w=Math.max(a.w,this.minSize.w-c),a.h=Math.max(a.h,this.minSize.h-d);if(this.maxSize)a.w=Math.min(a.w,
this.maxSize.w-c),a.h=Math.min(a.h,this.maxSize.h-d);if(this.map&&this.map.size){e=b=0;if(this.keepInMap&&!this.panMapIfOutOfView)switch(e=this.map.getPixelFromLonLat(this.lonlat),this.relativePosition){case "tr":b=e.x;e=this.map.size.h-e.y;break;case "tl":b=this.map.size.w-e.x;e=this.map.size.h-e.y;break;case "bl":b=this.map.size.w-e.x;e=e.y;break;case "br":b=e.x;e=e.y;break;default:b=e.x,e=this.map.size.h-e.y}d=this.map.size.h-this.map.paddingForPopups.top-this.map.paddingForPopups.bottom-d-e;a.w=
Math.min(a.w,this.map.size.w-this.map.paddingForPopups.left-this.map.paddingForPopups.right-c-b);a.h=Math.min(a.h,d)}return a},getContentDivPadding:function(){var a=this._contentDivPadding;if(!a){if(this.div.parentNode==null)this.div.style.display="none",document.body.appendChild(this.div);this._contentDivPadding=a=new OpenLayers.Bounds(OpenLayers.Element.getStyle(this.contentDiv,"padding-left"),OpenLayers.Element.getStyle(this.contentDiv,"padding-bottom"),OpenLayers.Element.getStyle(this.contentDiv,
"padding-right"),OpenLayers.Element.getStyle(this.contentDiv,"padding-top"));if(this.div.parentNode==document.body)document.body.removeChild(this.div),this.div.style.display=""}return a},addCloseBox:function(a){this.closeDiv=OpenLayers.Util.createDiv(this.id+"_close",null,new OpenLayers.Size(17,17));this.closeDiv.className="olPopupCloseBox";var b=this.getContentDivPadding();this.closeDiv.style.right=b.right+"px";this.closeDiv.style.top=b.top+"px";this.groupDiv.appendChild(this.closeDiv);OpenLayers.Event.observe(this.closeDiv,
"click",OpenLayers.Function.bindAsEventListener(a||function(a){this.hide();OpenLayers.Event.stop(a)},this))},panIntoView:function(){var a=this.map.getSize(),b=this.map.getViewPortPxFromLayerPx(new OpenLayers.Pixel(parseInt(this.div.style.left),parseInt(this.div.style.top))),c=b.clone();if(b.x<this.map.paddingForPopups.left)c.x=this.map.paddingForPopups.left;else if(b.x+this.size.w>a.w-this.map.paddingForPopups.right)c.x=a.w-this.map.paddingForPopups.right-this.size.w;if(b.y<this.map.paddingForPopups.top)c.y=
this.map.paddingForPopups.top;else if(b.y+this.size.h>a.h-this.map.paddingForPopups.bottom)c.y=a.h-this.map.paddingForPopups.bottom-this.size.h;this.map.pan(b.x-c.x,b.y-c.y)},registerEvents:function(){this.events=new OpenLayers.Events(this,this.div,null,!0);this.events.on({mousedown:this.onmousedown,mousemove:this.onmousemove,mouseup:this.onmouseup,click:this.onclick,mouseout:this.onmouseout,dblclick:this.ondblclick,scope:this})},onmousedown:function(a){this.mousedown=!0;OpenLayers.Event.stop(a,!0)},
onmousemove:function(a){this.mousedown&&OpenLayers.Event.stop(a,!0)},onmouseup:function(a){if(this.mousedown)this.mousedown=!1,OpenLayers.Event.stop(a,!0)},onclick:function(a){OpenLayers.Event.stop(a,!0)},onmouseout:function(){this.mousedown=!1},ondblclick:function(a){OpenLayers.Event.stop(a,!0)},CLASS_NAME:"OpenLayers.Popup"});OpenLayers.Popup.WIDTH=200;OpenLayers.Popup.HEIGHT=200;OpenLayers.Popup.COLOR="white";OpenLayers.Popup.OPACITY=1;OpenLayers.Popup.BORDER="0px";
OpenLayers.Popup.Anchored=OpenLayers.Class(OpenLayers.Popup,{relativePosition:null,keepInMap:!0,anchor:null,initialize:function(a,b,c,d,e,f,g){OpenLayers.Popup.prototype.initialize.apply(this,[a,b,c,d,f,g]);this.anchor=e!=null?e:{size:new OpenLayers.Size(0,0),offset:new OpenLayers.Pixel(0,0)}},destroy:function(){this.relativePosition=this.anchor=null;OpenLayers.Popup.prototype.destroy.apply(this,arguments)},show:function(){this.updatePosition();OpenLayers.Popup.prototype.show.apply(this,arguments)},
moveTo:function(a){var b=this.relativePosition;this.relativePosition=this.calculateRelativePosition(a);a=this.calculateNewPx(a);OpenLayers.Popup.prototype.moveTo.apply(this,Array(a));this.relativePosition!=b&&this.updateRelativePosition()},setSize:function(a){OpenLayers.Popup.prototype.setSize.apply(this,arguments);this.lonlat&&this.map&&this.moveTo(this.map.getLayerPxFromLonLat(this.lonlat))},calculateRelativePosition:function(a){a=this.map.getLonLatFromLayerPx(a);a=this.map.getExtent().determineQuadrant(a);
return OpenLayers.Bounds.oppositeQuadrant(a)},updateRelativePosition:function(){},calculateNewPx:function(a){var a=a.offset(this.anchor.offset),b=this.size||this.contentSize,c=this.relativePosition.charAt(0)=="t";a.y+=c?-b.h:this.anchor.size.h;c=this.relativePosition.charAt(1)=="l";a.x+=c?-b.w:this.anchor.size.w;return a},CLASS_NAME:"OpenLayers.Popup.Anchored"});
OpenLayers.Popup.Framed=OpenLayers.Class(OpenLayers.Popup.Anchored,{imageSrc:null,imageSize:null,isAlphaImage:!1,positionBlocks:null,blocks:null,fixedRelativePosition:!1,initialize:function(a,b,c,d,e,f,g){OpenLayers.Popup.Anchored.prototype.initialize.apply(this,arguments);if(this.fixedRelativePosition)this.updateRelativePosition(),this.calculateRelativePosition=function(){return this.relativePosition};this.contentDiv.style.position="absolute";this.contentDiv.style.zIndex=1;if(f)this.closeDiv.style.zIndex=
1;this.groupDiv.style.position="absolute";this.groupDiv.style.top="0px";this.groupDiv.style.left="0px";this.groupDiv.style.height="100%";this.groupDiv.style.width="100%"},destroy:function(){this.isAlphaImage=this.imageSize=this.imageSrc=null;this.fixedRelativePosition=!1;this.positionBlocks=null;for(var a=0;a<this.blocks.length;a++){var b=this.blocks[a];b.image&&b.div.removeChild(b.image);b.image=null;b.div&&this.groupDiv.removeChild(b.div);b.div=null}this.blocks=null;OpenLayers.Popup.Anchored.prototype.destroy.apply(this,
arguments)},setBackgroundColor:function(){},setBorder:function(){},setOpacity:function(){},setSize:function(a){OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments);this.updateBlocks()},updateRelativePosition:function(){this.padding=this.positionBlocks[this.relativePosition].padding;if(this.closeDiv){var a=this.getContentDivPadding();this.closeDiv.style.right=a.right+this.padding.right+"px";this.closeDiv.style.top=a.top+this.padding.top+"px"}this.updateBlocks()},calculateNewPx:function(a){var b=
OpenLayers.Popup.Anchored.prototype.calculateNewPx.apply(this,arguments);return b=b.offset(this.positionBlocks[this.relativePosition].offset)},createBlocks:function(){this.blocks=[];var a=null,b;for(b in this.positionBlocks){a=b;break}a=this.positionBlocks[a];for(b=0;b<a.blocks.length;b++){var c={};this.blocks.push(c);c.div=OpenLayers.Util.createDiv(this.id+"_FrameDecorationDiv_"+b,null,null,null,"absolute",null,"hidden",null);c.image=(this.isAlphaImage?OpenLayers.Util.createAlphaImageDiv:OpenLayers.Util.createImage)(this.id+
"_FrameDecorationImg_"+b,null,this.imageSize,this.imageSrc,"absolute",null,null,null);c.div.appendChild(c.image);this.groupDiv.appendChild(c.div)}},updateBlocks:function(){this.blocks||this.createBlocks();if(this.size&&this.relativePosition){for(var a=this.positionBlocks[this.relativePosition],b=0;b<a.blocks.length;b++){var c=a.blocks[b],d=this.blocks[b],e=c.anchor.left,f=c.anchor.bottom,g=c.anchor.right,h=c.anchor.top,i=isNaN(c.size.w)?this.size.w-(g+e):c.size.w,j=isNaN(c.size.h)?this.size.h-(f+
h):c.size.h;d.div.style.width=(i<0?0:i)+"px";d.div.style.height=(j<0?0:j)+"px";d.div.style.left=e!=null?e+"px":"";d.div.style.bottom=f!=null?f+"px":"";d.div.style.right=g!=null?g+"px":"";d.div.style.top=h!=null?h+"px":"";d.image.style.left=c.position.x+"px";d.image.style.top=c.position.y+"px"}this.contentDiv.style.left=this.padding.left+"px";this.contentDiv.style.top=this.padding.top+"px"}},CLASS_NAME:"OpenLayers.Popup.Framed"});
OpenLayers.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(this.documentDrag===!0){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)){this.documentDrag===!0&&this.documentEvents&&(a.element===document?(this.adjustXY(a),this.setEvent(a)):this.removeDocumentEvents());if(this.interval>0)this.timeoutId=setTimeout(OpenLayers.Function.bind(this.removeTimeout,this),this.interval);this.dragging=!0;this.move(a);this.callback("move",[a.xy]);if(!this.oldOnselectstart)this.oldOnselectstart=
document.onselectstart,document.onselectstart=OpenLayers.Function.False;this.last=a.xy}return!0},dragend:function(a){if(this.started){this.documentDrag===!0&&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(this.documentDrag===!0)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.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){if(Math.abs(this.dragHandler.start.x-a.x)>5||Math.abs(this.dragHandler.start.y-a.y)>5)var b=this.dragHandler.start,a=new OpenLayers.Bounds(Math.min(b.x,a.x),Math.max(b.y,a.y),Math.max(b.x,a.x),Math.min(b.y,a.y));else a=this.dragHandler.start.clone();
this.removeBox();this.callback("done",[a])},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=a.clientWidth==3;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:b===!1?a+c:0,height:b===!1?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,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.min(this.map.size.h/Math.abs(a.top-a.bottom),this.map.size.w/Math.abs(a.right-a.left));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()&&this.alwaysZoom==!0&&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:25,documentDrag:!1,kinetic:null,enableKinetic:!1,kineticInterval:10,draw:function(){if(this.enableKinetic){var a={interval:this.kineticInterval};typeof this.enableKinetic==="object"&&(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.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,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments)},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(this.rightclickTimerId!=null)return this.clearTimer(),this.callback("dblrightclick",[a]),!this.stopDouble;else a=this["double"]?OpenLayers.Util.extend({},a):this.callback("rightclick",[a]),a=OpenLayers.Function.bind(this.delayedRightCall,this,a),this.rightclickTimerId=window.setTimeout(a,this.delay);return!this.stopSingle},delayedRightCall:function(a){this.rightclickTimerId=null;a&&this.callback("rightclick",[a])},
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))this.timerId!=null?(this.last.touches&&this.last.touches.length===1&&(this["double"]&&OpenLayers.Event.stop(a),this.handleDouble(a)),(!this.last.touches||this.last.touches.length!==
2)&&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(this.pixelTolerance!=null&&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(this.timerId!=null)window.clearTimeout(this.timerId),this.timerId=null;if(this.rightclickTimerId!=null)window.clearTimeout(this.rightclickTimerId),
this.rightclickTimerId=null},delayedCall:function(a){this.timerId=null;a&&this.callback("click",[a])},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.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&&a.lastTouches.length==
2&&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.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){var e=arguments,e=[a,d];OpenLayers.Layer.prototype.initialize.apply(this,e);this.url=b;this.params=OpenLayers.Util.extend({},c)},destroy:function(){this.params=this.url=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(a){a==null&&(a=new OpenLayers.Layer.HTTPRequest(this.name,this.url,this.params,this.getOptions()));
return a=OpenLayers.Layer.prototype.clone.apply(this,[a])},setUrl:function(a){this.url=a},mergeNewParams:function(a){this.params=OpenLayers.Util.extend(this.params,a);a=this.redraw();this.map!=null&&this.map.events.triggerEvent("changelayer",{layer:this,property:"params"});return a},redraw:function(a){return a?this.mergeNewParams({_olSalt:Math.random()}):OpenLayers.Layer.prototype.redraw.apply(this,[])},selectUrl:function(a,b){for(var 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);c instanceof Array&&(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.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={}},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments)},supported:function(){return document.implementation&&
(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#SVG","1.1")||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"))},inValidRange:function(a,b,c){a+=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){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,
arguments);var c=this.getResolution(),d=-a.left/c,c=a.top/c;return b?(this.left=d,this.top=c,this.rendererRoot.setAttributeNS(null,"viewBox","0 0 "+this.size.w+" "+this.size.h),this.translate(0,0),!0):((d=this.translate(d-this.left,c-this.top))||this.setExtent(a,!0),d)},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}else 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":case "OpenLayers.Geometry.Surface":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(a._geometryClass=="OpenLayers.Geometry.Point"&&d){a.style.visibility="";if(b.graphic===!1)a.style.visibility="hidden";else if(b.externalGraphic){f=this.getPosition(a);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:b.pointRadius*2,g=g?g:b.pointRadius*2,h=b.graphicYOffset!=void 0?b.graphicYOffset:-(0.5*g),i=b.graphicOpacity||b.fillOpacity;a.setAttributeNS(null,"x",(f.x+(b.graphicXOffset!=void 0?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=b.pointRadius*3,g=d*2,j=this.importSymbol(b.graphicName);f=this.getPosition(a);e=this.symbolMetrics[j.id][0]*3/g;h=a.parentNode;i=a.nextSibling;h&&h.removeChild(a);a.firstChild&&a.removeChild(a.firstChild);a.appendChild(j.firstChild.cloneNode(!0));a.setAttributeNS(null,"viewBox",j.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((d!==void 0||a._rotation!==void 0)&&f)a._rotation=d,d|=0,a.nodeName!=="svg"?a.setAttributeNS(null,"transform","rotate("+d+" "+f.x+" "+f.y+")"):(f=this.symbolMetrics[j.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);
b.cursor!=null&&a.setAttributeNS(null,"cursor",b.cursor);return a},dashStyle:function(a,b){var c=a.strokeWidth*b,d=a.strokeDashstyle;switch(d){case "solid":return"none";case "dot":return[1,4*c].join();case "dash":return[4*c,4*c].join();case "dashdot":return[4*c,4*c,1,4*c].join();case "longdash":return[8*c,4*c].join();case "longdashdot":return[8*c,4*c,1,4*c].join();default:return OpenLayers.String.trim(d).replace(/\s+/g,",")}},createNode:function(a,b){var c=document.createElementNS(this.xmlns,a);b&&
c.setAttributeNS(null,"id",b);return c},nodeTypeCompare:function(a,b){return b==a.nodeName},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_svgRoot","svg")},createRoot:function(a){return this.nodeFactory(this.container.id+a,"g")},createDefs:function(){var a=this.nodeFactory(this.container.id+"_defs","defs");this.rendererRoot.appendChild(a);return a},drawPoint:function(a,b){return this.drawCircle(a,b,1)},drawCircle:function(a,b,c){var d=this.getResolution(),e=b.x/d+this.left,
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;c+=" z";return d?(a.setAttributeNS(null,"d",c),a.setAttributeNS(null,"fill-rule","evenodd"),e?a:null):!1},drawRectangle:function(a,b){var c=this.getResolution(),d=b.x/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},drawSurface:function(a,b){for(var c=null,d=!0,e=0,f=b.components.length;e<f;e++)if(e%3==0&&e/3==0){var g=this.getShortString(b.components[e]);g||(d=!1);c="M "+g}else e%3==1?((g=this.getShortString(b.components[e]))||(d=!1),c+=" C "+g):((g=this.getShortString(b.components[e]))||(d=!1),c+=" "+g);c+=" Z";return d?(a.setAttributeNS(null,"d",c),a):!1},drawText:function(a,b,c){var d=this.getResolution(),e=c.x/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);b.labelSelect===!0?(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");OpenLayers.IS_GECKO===!0&&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 j=this.nodeFactory(a+this.LABEL_ID_SUFFIX+"_tspan_"+i,"tspan");if(b.labelSelect===!0)j._featureId=a,j._geometry=c,j._geometryClass=
c.CLASS_NAME;OpenLayers.IS_GECKO===!1&&j.setAttributeNS(null,"baseline-shift",OpenLayers.Renderer.SVG.LABEL_VSHIFT[f[1]]||"-35%");j.setAttribute("x",e);if(i==0){var k=OpenLayers.Renderer.SVG.LABEL_VFACTOR[f[1]];k==null&&(k=-0.5);j.setAttribute("dy",k*(h-1)+"em")}else j.setAttribute("dy","1em");j.textContent=g[i]===""?" ":g[i];j.parentNode||d.appendChild(j)}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):(h>0&&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/c+this.left,g=this.top-b.y/c,h=a.x/c+this.left,c=this.top-a.y/c,i;if(h<-d||h>d)i=(c-g)/(h-f),h=h<0?-d:d,c=
g+(h-f)*i;if(c<-e||c>e)i=(h-f)/(c-g),c=c<0?-e:e,h=f+(c-g)*i;return h+","+c},getShortString:function(a){var b=this.getResolution(),c=a.x/b+this.left,a=this.top-a.y/b;return this.inValidRange(c,a)?c+","+a:!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(c!=null)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,d*3,e*3].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.Control.Button=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){},CLASS_NAME:"OpenLayers.Control.Button"});
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,timerId: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(this.timerId!=
null)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=[]}},clone:function(a){a==null&&(a=new OpenLayers.Layer.Grid(this.name,this.url,this.params,this.getOptions()));a=OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this,
[a]);if(this.tileSize!=null)a.tileSize=this.tileSize.clone();a.grid=[];return a},moveTo:function(a,b,c){OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this,arguments);a=a||this.map.getExtent();if(a!=null){var d=!this.grid.length||b,e=this.getTilesBounds();this.singleTile?(d||!c&&!e.containsBounds(a))&&this.initSingleTile(a):d||!e.containsBounds(a,!0)?this.initGriddedTiles(a):this.scheduleMoveGriddedTiles()}},moveByPx:function(){this.scheduleMoveGriddedTiles()},scheduleMoveGriddedTiles:function(){this.timerId!=
null&&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])},getGridBounds:function(){OpenLayers.Console.warn("The getGridBounds() function is deprecated. It will be removed in 3.0. Please use getTilesBounds() instead.");return this.getTilesBounds()},getTilesBounds:function(){var a=
null;if(this.grid.length)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)},calculateGridLayout:function(a,b,c){var d=c*this.tileSize.w;c*=this.tileSize.h;var e=a.left-b.lon,f=Math.floor(e/d)-this.buffer,a=a.top-(b.lat+c),g=Math.ceil(a/c)+this.buffer;return{tilelon:d,tilelat:c,tileoffsetlon:b.lon+f*d,tileoffsetlat:b.lat+g*c,tileoffsetx:-(e/d-f)*this.tileSize.w,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.map.getResolution(),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 j=d,k=g,m=0,n=parseInt(this.map.layerContainerDiv.style.left),l=parseInt(this.map.layerContainerDiv.style.top);do{var o=this.grid[m++];o||(o=[],this.grid.push(o));var g=k,d=j,r=0;do{var q=new OpenLayers.Bounds(g,h,g+i,h+f),p=d;p-=n;var s=e;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||m<c);this.removeExcessTiles(m,r);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&&g>=0&&h<this.grid[0].length&&h>=0&&(i=this.grid[g][h]);i!=null&&!i.queued?(a.unshift(i),i.queued=!0,f=0,
c=g,d=h):(e=(e+1)%4,f++)}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(){this.numLoadingTiles==0&&this.events.triggerEvent("loadstart");this.numLoadingTiles++};a.events.register("loadstart",this,a.onLoadStart);a.onLoadEnd=function(){this.numLoadingTiles--;this.events.triggerEvent("tileloaded");this.numLoadingTiles==0&&this.events.triggerEvent("loadend")};
a.events.register("loadend",this,a.onLoadEnd);a.events.register("unload",this,a.onLoadEnd)},removeTileMonitoringHooks:function(a){a.unload();a.events.un({loadstart:a.onLoadStart,loadend:a.onLoadEnd,unload:a.onLoadEnd,scope:this})},moveGriddedTiles:function(){var a=!0,b=this.buffer||1,c=this.grid[0][0].position,d=parseInt(this.map.layerContainerDiv.style.left),e=parseInt(this.map.layerContainerDiv.style.top),c=c.add(d,e);c.x>-this.tileSize.w*(b-1)?this.shiftColumn(!0):c.x<-this.tileSize.w*b?this.shiftColumn(!1):
c.y>-this.tileSize.h*(b-1)?this.shiftRow(!0):c.y<-this.tileSize.h*b?this.shiftRow(!1):a=!1;if(a)this.timerId=window.setTimeout(this._moveGriddedTiles,0)},shiftRow:function(a){var b=this.grid,c=b[a?0:this.grid.length-1],d=this.map.getResolution(),e=a?-this.tileSize.h:this.tileSize.h;d*=-e;for(var f=a?b.pop():b.shift(),g=0,h=c.length;g<h;g++){var i=c[g],j=i.bounds.clone(),i=i.position.clone();j.bottom+=d;j.top+=d;i.y+=e;f[g].moveTo(j,i)}a?b.unshift(f):b.push(f)},shiftColumn:function(a){for(var b=a?
-this.tileSize.w:this.tileSize.w,c=this.map.getResolution()*b,d=0,e=this.grid.length;d<e;d++){var f=this.grid[d],g=f[a?0:f.length-1],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*=this.tileSize.h;var e=this.getLonLatFromViewPortPx(a),a=b.left+d*Math.floor((e.lon-b.left)/d),b=b.bottom+c*Math.floor((e.lat-b.bottom)/c);return new OpenLayers.Bounds(a,b,a+d,b+c)},CLASS_NAME:"OpenLayers.Layer.Grid"});
OpenLayers.Control.DrawFeature=OpenLayers.Class(OpenLayers.Control,{layer:null,callbacks:null,EVENT_TYPES:["featureadded"],multi:!1,featureAdded:function(){},handlerOptions:null,initialize:function(a,b,c){this.EVENT_TYPES=OpenLayers.Control.DrawFeature.prototype.EVENT_TYPES.concat(OpenLayers.Control.prototype.EVENT_TYPES);OpenLayers.Control.prototype.initialize.apply(this,[c]);this.callbacks=OpenLayers.Util.extend({done:this.drawFeature,modify:function(a,b){this.layer.events.triggerEvent("sketchmodified",
{vertex:a,feature:b})},create:function(a,b){this.layer.events.triggerEvent("sketchstarted",{vertex:a,feature:b})}},this.callbacks);this.layer=a;this.handlerOptions=this.handlerOptions||{};if(!("multi"in this.handlerOptions))this.handlerOptions.multi=this.multi;if(a=this.layer.styleMap&&this.layer.styleMap.styles.temporary)this.handlerOptions.layerOptions=OpenLayers.Util.applyDefaults(this.handlerOptions.layerOptions,{styleMap:new OpenLayers.StyleMap({"default":a})});this.handler=new b(this,this.callbacks,
this.handlerOptions)},drawFeature:function(a){a=new OpenLayers.Feature.Vector(a);if(this.layer.events.triggerEvent("sketchcomplete",{feature:a})!==!1)a.state=OpenLayers.State.INSERT,this.layer.addFeatures([a]),this.featureAdded(a),this.events.triggerEvent("featureadded",{feature:a})},CLASS_NAME:"OpenLayers.Control.DrawFeature"});OpenLayers.Symbolizer.Point=OpenLayers.Class(OpenLayers.Symbolizer,{initialize:function(a){OpenLayers.Symbolizer.prototype.initialize.apply(this,arguments)},CLASS_NAME:"OpenLayers.Symbolizer.Point"});
OpenLayers.Symbolizer.Line=OpenLayers.Class(OpenLayers.Symbolizer,{initialize:function(a){OpenLayers.Symbolizer.prototype.initialize.apply(this,arguments)},CLASS_NAME:"OpenLayers.Symbolizer.Line"});OpenLayers.Symbolizer.Polygon=OpenLayers.Class(OpenLayers.Symbolizer,{initialize:function(a){OpenLayers.Symbolizer.prototype.initialize.apply(this,arguments)},CLASS_NAME:"OpenLayers.Symbolizer.Polygon"});
OpenLayers.Symbolizer.Text=OpenLayers.Class(OpenLayers.Symbolizer,{initialize:function(a){OpenLayers.Symbolizer.prototype.initialize.apply(this,arguments)},CLASS_NAME:"OpenLayers.Symbolizer.Text"});
OpenLayers.Rule=OpenLayers.Class({id:null,name:null,title:null,description:null,context:null,filter:null,elseFilter:!1,symbolizer:null,symbolizers:null,minScaleDenominator:null,maxScaleDenominator:null,initialize:function(a){this.symbolizer={};OpenLayers.Util.extend(this,a);this.symbolizers&&delete this.symbolizer;this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){for(var a in this.symbolizer)this.symbolizer[a]=null;this.symbolizer=null;delete this.symbolizers},evaluate:function(a){var b=
this.getContext(a),c=!0;if(this.minScaleDenominator||this.maxScaleDenominator)var d=a.layer.map.getScale();this.minScaleDenominator&&(c=d>=OpenLayers.Style.createLiteral(this.minScaleDenominator,b));c&&this.maxScaleDenominator&&(c=d<OpenLayers.Style.createLiteral(this.maxScaleDenominator,b));c&&this.filter&&(c=this.filter.CLASS_NAME=="OpenLayers.Filter.FeatureId"?this.filter.evaluate(a):this.filter.evaluate(b));return c},getContext:function(a){var b=this.context;b||(b=a.attributes||a.data);typeof this.context==
"function"&&(b=this.context(a));return b},clone:function(){var a=OpenLayers.Util.extend({},this);if(this.symbolizers){var b=this.symbolizers.length;a.symbolizers=Array(b);for(var c=0;c<b;++c)a.symbolizers[c]=this.symbolizers[c].clone()}else{a.symbolizer={};for(var d in this.symbolizer)b=this.symbolizer[d],c=typeof b,c==="object"?a.symbolizer[d]=OpenLayers.Util.extend({},b):c==="string"&&(a.symbolizer[d]=b)}a.filter=this.filter&&this.filter.clone();a.context=this.context&&OpenLayers.Util.extend({},
this.context);return new OpenLayers.Rule(a)},CLASS_NAME:"OpenLayers.Rule"});
OpenLayers.Handler.Pinch=OpenLayers.Class(OpenLayers.Handler,{started:!1,stopDown:!1,pinching:!1,last:null,start:null,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments)},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.Handler.Hover=OpenLayers.Class(OpenLayers.Handler,{delay:500,pixelTolerance:null,stopMove:!1,px:null,timerId:null,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments)},mousemove:function(a){if(this.passesTolerance(a.xy))this.clearTimer(),this.callback("move",[a]),this.px=a.xy,a=OpenLayers.Util.extend({},a),this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,a),this.delay);return!this.stopMove},mouseout:function(a){OpenLayers.Util.mouseLeft(a,
this.map.eventsDiv)&&(this.clearTimer(),this.callback("move",[a]));return!0},passesTolerance:function(a){var b=!0;this.pixelTolerance&&this.px&&Math.sqrt(Math.pow(this.px.x-a.x,2)+Math.pow(this.px.y-a.y,2))<this.pixelTolerance&&(b=!1);return b},clearTimer:function(){if(this.timerId!=null)window.clearTimeout(this.timerId),this.timerId=null},delayedCall:function(a){this.callback("pause",[a])},deactivate:function(){var a=!1;OpenLayers.Handler.prototype.deactivate.apply(this,arguments)&&(this.clearTimer(),
a=!0);return a},CLASS_NAME:"OpenLayers.Handler.Hover"});
OpenLayers.Control.NavigationHistory=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOGGLE,previous:null,previousOptions:null,next:null,nextOptions:null,limit:50,autoActivate:!0,clearOnDeactivate:!1,registry:null,nextStack:null,previousStack:null,listeners:null,restoring:!1,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,[a]);this.registry=OpenLayers.Util.extend({moveend:this.getState},this.registry);a={trigger:OpenLayers.Function.bind(this.previousTrigger,
this),displayClass:this.displayClass+" "+this.displayClass+"Previous"};OpenLayers.Util.extend(a,this.previousOptions);this.previous=new OpenLayers.Control.Button(a);a={trigger:OpenLayers.Function.bind(this.nextTrigger,this),displayClass:this.displayClass+" "+this.displayClass+"Next"};OpenLayers.Util.extend(a,this.nextOptions);this.next=new OpenLayers.Control.Button(a);this.clear()},onPreviousChange:function(a){a&&!this.previous.active?this.previous.activate():!a&&this.previous.active&&this.previous.deactivate()},
onNextChange:function(a){a&&!this.next.active?this.next.activate():!a&&this.next.active&&this.next.deactivate()},destroy:function(){OpenLayers.Control.prototype.destroy.apply(this);this.previous.destroy();this.next.destroy();this.deactivate();for(var a in this)this[a]=null},setMap:function(a){this.map=a;this.next.setMap(a);this.previous.setMap(a)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.next.draw();this.previous.draw()},previousTrigger:function(){var a=this.previousStack.shift(),
b=this.previousStack.shift();b!=void 0?(this.nextStack.unshift(a),this.previousStack.unshift(b),this.restoring=!0,this.restore(b),this.restoring=!1,this.onNextChange(this.nextStack[0],this.nextStack.length),this.onPreviousChange(this.previousStack[1],this.previousStack.length-1)):this.previousStack.unshift(a);return b},nextTrigger:function(){var a=this.nextStack.shift();if(a!=void 0)this.previousStack.unshift(a),this.restoring=!0,this.restore(a),this.restoring=!1,this.onNextChange(this.nextStack[0],
this.nextStack.length),this.onPreviousChange(this.previousStack[1],this.previousStack.length-1);return a},clear:function(){this.previousStack=[];this.previous.deactivate();this.nextStack=[];this.next.deactivate()},getState:function(){return{center:this.map.getCenter(),resolution:this.map.getResolution(),projection:this.map.getProjectionObject(),units:this.map.getProjectionObject().getUnits()||this.map.units||this.map.baseLayer.units}},restore:function(a){var b,c;if(this.map.getProjectionObject()==
a.projection)c=this.map.getZoomForResolution(a.resolution),b=a.center;else{b=a.center.clone();b.transform(a.projection,this.map.getProjectionObject());c=a.units;var d=this.map.getProjectionObject().getUnits()||this.map.units||this.map.baseLayer.units;c=this.map.getZoomForResolution((c&&d?OpenLayers.INCHES_PER_UNIT[c]/OpenLayers.INCHES_PER_UNIT[d]:1)*a.resolution)}this.map.setCenter(b,c)},setListeners:function(){this.listeners={};for(var a in this.registry)this.listeners[a]=OpenLayers.Function.bind(function(){if(!this.restoring){this.previousStack.unshift(this.registry[a].apply(this,
arguments));if(this.previousStack.length>1)this.onPreviousChange(this.previousStack[1],this.previousStack.length-1);this.previousStack.length>this.limit+1&&this.previousStack.pop();if(this.nextStack.length>0)this.nextStack=[],this.onNextChange(null,0)}return!0},this)},activate:function(){var a=!1;if(this.map&&OpenLayers.Control.prototype.activate.apply(this)){this.listeners==null&&this.setListeners();for(var b in this.listeners)this.map.events.register(b,this,this.listeners[b]);a=!0;this.previousStack.length==
0&&this.initStack()}return a},initStack:function(){this.map.getCenter()&&this.listeners.moveend()},deactivate:function(){var a=!1;if(this.map&&OpenLayers.Control.prototype.deactivate.apply(this)){for(var b in this.listeners)this.map.events.unregister(b,this,this.listeners[b]);this.clearOnDeactivate&&this.clear();a=!0}return a},CLASS_NAME:"OpenLayers.Control.NavigationHistory"});
OpenLayers.Format.JSON=OpenLayers.Class(OpenLayers.Format,{indent:"    ",space:" ",newline:"\n",level:0,pretty:!1,nativeJSON:function(){return!(!window.JSON||!(typeof JSON.parse=="function"&&typeof JSON.stringify=="function"))}(),read:function(a,b){var c;if(this.nativeJSON)c=JSON.parse(a,b);else try{if(/^[\],:{}\s]*$/.test(a.replace(/\\["\\\/bfnrtu]/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))&&(c=eval("("+a+")"),typeof b===
"function")){var d=function(a,c){if(c&&typeof c==="object")for(var e in c)c.hasOwnProperty(e)&&(c[e]=d(e,c[e]));return b(a,c)};c=d("",c)}}catch(e){}if(this.keepData)this.data=c;return c},write:function(a,b){this.pretty=!!b;var c=null,d=typeof a;if(this.serialize[d])try{c=!this.pretty&&this.nativeJSON?JSON.stringify(a):this.serialize[d].apply(this,[a])}catch(e){OpenLayers.Console.error("Trouble serializing: "+e)}return c},writeIndent:function(){var a=[];if(this.pretty)for(var b=0;b<this.level;++b)a.push(this.indent);
return a.join("")},writeNewline:function(){return this.pretty?this.newline:""},writeSpace:function(){return this.pretty?this.space:""},serialize:{object:function(a){if(a==null)return"null";if(a.constructor==Date)return this.serialize.date.apply(this,[a]);if(a.constructor==Array)return this.serialize.array.apply(this,[a]);var b=["{"];this.level+=1;var c,d,e,f=!1;for(c in a)a.hasOwnProperty(c)&&(d=OpenLayers.Format.JSON.prototype.write.apply(this,[c,this.pretty]),e=OpenLayers.Format.JSON.prototype.write.apply(this,
[a[c],this.pretty]),d!=null&&e!=null&&(f&&b.push(","),b.push(this.writeNewline(),this.writeIndent(),d,":",this.writeSpace(),e),f=!0));this.level-=1;b.push(this.writeNewline(),this.writeIndent(),"}");return b.join("")},array:function(a){var b,c=["["];this.level+=1;for(var d=0,e=a.length;d<e;++d)b=OpenLayers.Format.JSON.prototype.write.apply(this,[a[d],this.pretty]),b!=null&&(d>0&&c.push(","),c.push(this.writeNewline(),this.writeIndent(),b));this.level-=1;c.push(this.writeNewline(),this.writeIndent(),
"]");return c.join("")},string:function(a){var b={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return/["\\\x00-\x1f]/.test(a)?'"'+a.replace(/([\x00-\x1f\\"])/g,function(a,d){var e=b[d];if(e)return e;e=d.charCodeAt();return"\\u00"+Math.floor(e/16).toString(16)+(e%16).toString(16)})+'"':'"'+a+'"'},number:function(a){return isFinite(a)?String(a):"null"},"boolean":function(a){return String(a)},date:function(a){function b(a){return a<10?"0"+a:a}return'"'+a.getFullYear()+
"-"+b(a.getMonth()+1)+"-"+b(a.getDate())+"T"+b(a.getHours())+":"+b(a.getMinutes())+":"+b(a.getSeconds())+'"'}},CLASS_NAME:"OpenLayers.Format.JSON"});
OpenLayers.Control.PinchZoom=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,containerOrigin: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.updateContainerOrigin,
scope:this}),this.updateContainerOrigin());return a},deactivate:function(){var a=OpenLayers.Control.prototype.deactivate.apply(this,arguments);this.map&&this.map.events&&this.map.events.un({moveend:this.updateContainerOrigin,scope:this});return a},updateContainerOrigin:function(){var a=this.map.layerContainerDiv;this.containerOrigin={x:parseInt(a.style.left,10),y:parseInt(a.style.top,10)}},pinchStart:function(a){this.currentCenter=this.pinchOrigin=a.xy},pinchMove:function(a,b){var c=b.scale,d=this.containerOrigin,
e=this.pinchOrigin,f=a.xy;this.applyTransform("translate("+Math.round(f.x-e.x+(c-1)*(d.x-e.x))+"px, "+Math.round(f.y-e.y+(c-1)*(d.y-e.y))+"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&&a.lastTouches.length==2&&this.map.zoomOut()},defaultDblClick:function(a){this.map.setCenter(this.map.getLonLatFromViewPortPx(a.xy),
this.map.zoom+1)},CLASS_NAME:"OpenLayers.Control.TouchNavigation"});
OpenLayers.Handler.Keyboard=OpenLayers.Class(OpenLayers.Handler,{KEY_EVENTS:["keydown","keyup"],eventListener:null,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.eventListener=OpenLayers.Function.bindAsEventListener(this.handleKeyEvent,this)},destroy:function(){this.deactivate();this.eventListener=null;OpenLayers.Handler.prototype.destroy.apply(this,arguments)},activate:function(){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){for(var a=
0,b=this.KEY_EVENTS.length;a<b;a++)OpenLayers.Event.observe(document,this.KEY_EVENTS[a],this.eventListener);return!0}else return!1},deactivate:function(){var a=!1;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){for(var a=0,b=this.KEY_EVENTS.length;a<b;a++)OpenLayers.Event.stopObserving(document,this.KEY_EVENTS[a],this.eventListener);a=!0}return a},handleKeyEvent:function(a){this.checkModifiers(a)&&this.callback(a.type,[a])},CLASS_NAME:"OpenLayers.Handler.Keyboard"});
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"],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)}},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments)},supported:function(){return!!document.namespaces},setExtent:function(a,b){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var c=this.getResolution(),d=a.left/c|0,c=a.top/c-this.size.h|0;b||!this.offset?(this.offset={x:d,y:c},c=d=0):(d-=this.offset.x,c-=this.offset.y);this.root.coordorigin=d+" "+c;for(var d=[this.root,this.vectorRoot,this.textRoot],e=0,f=d.length;e<f;++e)c=d[e],
c.coordsize=this.size.w+" "+this.size.h;this.root.style.flip="y";return!0},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":case "OpenLayers.Geometry.Surface":c="olv:shape"}return c},setStyle:function(a,b,c,d){var b=b||a._style,c=c||a._options,e=b.fillColor;if(a._geometryClass==="OpenLayers.Geometry.Point")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:b.pointRadius*2,f=f?f:b.pointRadius*2,g=this.getResolution(),h=b.graphicXOffset!=void 0?b.graphicXOffset:-(0.5*e),i=b.graphicYOffset!=void 0?b.graphicYOffset:-(0.5*f);a.style.left=(d.x/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=d.length==0?null:d[0];if(c.isFilled){d||(d=this.createNode("olv:fill",a.id+"_fill"));d.opacity=b.fillOpacity;if(a._geometryClass==="OpenLayers.Geometry.Point"&&b.externalGraphic){if(b.graphicOpacity)d.opacity=b.graphicOpacity;d.src=b.externalGraphic;d.type="frame";if(!b.graphicWidth||!b.graphicHeight)d.aspect=
"atmost"}d.parentNode!=a&&a.appendChild(d)}else d&&a.removeChild(d);e=b.rotation;if(e!==void 0||a._rotation!==void 0)if(a._rotation=e,b.externalGraphic)this.graphicRotate(a,h,i,b),d.opacity=0;else if(a._geometryClass==="OpenLayers.Geometry.Point")a.style.rotation=e||0;h=a.getElementsByTagName("stroke");h=h.length==0?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=
b.strokeLinecap=="butt"?"flat":b.strokeLinecap||"round",b.strokeDashstyle)h.dashstyle=this.dashStyle(b)}else if(a.stroked=!1,h)h.on=!1;if(b.cursor!="inherit"&&b.cursor!=null)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(h.readyState=="complete"||h.readyState=="interactive")f=h.width/h.height,g=Math.max(d.pointRadius*2,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),j=Math.round(d.graphicHeight||g);a.style.width=i+"px";a.style.height=j+"px";var k=document.getElementById(a.id+"_image");k||(k=this.createNode("olv:imagedata",a.id+"_image"),a.appendChild(k));k.style.width=i+"px";k.style.height=j+"px";k.src=d.externalGraphic;
k.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='', sizingMethod='scale')";k=e*Math.PI/180;e=Math.sin(k);k=Math.cos(k);e="progid:DXImageTransform.Microsoft.Matrix(M11="+k+",M12="+-e+",M21="+e+",M22="+k+",SizingMethod='auto expand')\n";(k=d.graphicOpacity||d.fillOpacity)&&k!=1&&(e+="progid:DXImageTransform.Microsoft.BasicImage(opacity="+k+")\n");a.style.filter=e;e=new OpenLayers.Geometry.Point(-b,-c);i=(new OpenLayers.Bounds(0,0,i,j)).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(b=="none"&&a.fillcolor!=b)a.fillcolor=b;if(c=="none"&&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/d-this.offset.x|0,c.bottom/d-this.offset.y|0,c.right/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:a=a.split(/[ ,]/);if(a.length==2)return 1*a[0]>=2*a[1]?"longdash":a[0]==1||a[1]==1?"dot":"dash";else if(a.length==4)return 1*a[0]>=2*a[1]?
"longdashdot":"dashdot";return"solid"}},createNode:function(a,b){var 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(":");d!=-1&&(c=c.substr(d+1));var e=a.nodeName,d=e.indexOf(":");d!=-1&&(e=e.substr(d+1));return c==e},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_vmlRoot","div")},createRoot:function(a){return this.nodeFactory(this.container.id+a,"olv:group")},
drawPoint:function(a,b){return this.drawCircle(a,b,1)},drawCircle:function(a,b,c){if(!isNaN(b.x)&&!isNaN(b.y)){var d=this.getResolution();a.style.left=(b.x/d-this.offset.x|0)-c+"px";a.style.top=(b.y/d-this.offset.y|0)-c+"px";b=c*2;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/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,j,k,m,n,l;e=0;for(f=b.components.length;e<f;e++){d.push("m");g=b.components[e].components;h=e===0;j=i=null;k=0;for(m=g.length;k<m;k++)n=g[k],l=n.x/c-this.offset.x|0,n=n.y/c-this.offset.y|0,l=" "+l+","+n,d.push(l),k==0&&d.push(" l"),h||(i?i!=l&&
(j?j!=l&&(h=!0):j=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/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/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(b.cursor!="inherit"&&b.cursor!=null)e.style.cursor=b.cursor;if(b.fontColor)e.style.color=b.fontColor;if(b.fontOpacity)e.style.filter="alpha(opacity="+b.fontOpacity*100+")";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(b.labelSelect===!0)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";b.length==1&&(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"},drawSurface:function(a,b){this.setNodeDimension(a,b);for(var c=this.getResolution(),d=[],
e,f,g=0,h=b.components.length;g<h;g++)e=b.components[g],f=e.x/c-this.offset.x|0,e=e.y/c-this.offset.y|0,g%3==0&&g/3==0?d.push("m"):g%3==1&&d.push(" c"),d.push(" "+f+","+e);d.push(" x e");a.path=d.join("");return a},moveRoot:function(a){var b=this.map.getLayer(a.container.id);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);e==0&&d.push("l")}d.push("x e");c=d.join(" ");d=(a.getWidth()-a.getHeight())/2;d>0?(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.Protocol=OpenLayers.Class({format:null,options:null,autoDestroy:!0,defaultFilter:null,initialize:function(a){a=a||{};OpenLayers.Util.extend(this,a);this.options=a},mergeWithDefaultFilter:function(a){return a&&this.defaultFilter?new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.AND,filters:[this.defaultFilter,a]}):a||this.defaultFilter||void 0},destroy:function(){this.format=this.options=null},read:function(a){a=a||{};a.filter=this.mergeWithDefaultFilter(a.filter)},create:function(){},
update:function(){},"delete":function(){},commit:function(){},abort:function(){},createCallback:function(a,b,c){return OpenLayers.Function.bind(function(){a.apply(this,[b,c])},this)},CLASS_NAME:"OpenLayers.Protocol"});OpenLayers.Protocol.Response=OpenLayers.Class({code:null,requestType:null,last:!0,features:null,reqFeatures:null,priv:null,initialize:function(a){OpenLayers.Util.extend(this,a)},success:function(){return this.code>0},CLASS_NAME:"OpenLayers.Protocol.Response"});
OpenLayers.Protocol.Response.SUCCESS=1;OpenLayers.Protocol.Response.FAILURE=0;
OpenLayers.Control.DragFeature=OpenLayers.Class(OpenLayers.Control,{geometryTypes:null,onStart:function(){},onDrag:function(){},onComplete:function(){},onEnter:function(){},onLeave:function(){},documentDrag:!1,layer:null,feature:null,dragCallbacks:{},featureCallbacks:{},lastPixel:null,initialize:function(a,b){OpenLayers.Control.prototype.initialize.apply(this,[b]);this.layer=a;this.handlers={drag:new OpenLayers.Handler.Drag(this,OpenLayers.Util.extend({down:this.downFeature,move:this.moveFeature,
up:this.upFeature,out:this.cancel,done:this.doneDragging},this.dragCallbacks),{documentDrag:this.documentDrag}),feature:new OpenLayers.Handler.Feature(this,this.layer,OpenLayers.Util.extend({click:this.clickFeature,clickout:this.clickoutFeature,over:this.overFeature,out:this.outFeature},this.featureCallbacks),{geometryTypes:this.geometryTypes})}},clickFeature:function(a){if(!this.over&&this.overFeature(a))this.handlers.drag.dragstart(this.handlers.feature.evt),this.handlers.drag.stopDown=!1},clickoutFeature:function(a){if(this.over)this.outFeature(a),
this.handlers.drag.stopDown=!0},destroy:function(){this.layer=null;OpenLayers.Control.prototype.destroy.apply(this,[])},activate:function(){return this.handlers.feature.activate()&&OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){this.handlers.drag.deactivate();this.handlers.feature.deactivate();this.feature=null;this.dragging=!1;this.lastPixel=null;OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass+"Over");return OpenLayers.Control.prototype.deactivate.apply(this,
arguments)},overFeature:function(a){var b=!1;this.handlers.drag.dragging?this.over=this.feature.id==a.id?!0:!1:(this.feature=a,this.handlers.drag.activate(),this.over=b=!0,OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass+"Over"),this.onEnter(a));return b},downFeature:function(a){this.lastPixel=a;this.onStart(this.feature,a)},moveFeature:function(a){var b=this.map.getResolution();this.feature.geometry.move(b*(a.x-this.lastPixel.x),b*(this.lastPixel.y-a.y));this.layer.drawFeature(this.feature);
this.lastPixel=a;this.onDrag(this.feature,a)},upFeature:function(){this.over||this.handlers.drag.deactivate()},doneDragging:function(a){this.onComplete(this.feature,a)},outFeature:function(a){if(this.handlers.drag.dragging){if(this.feature.id==a.id)this.over=!1}else this.over=!1,this.handlers.drag.deactivate(),OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass+"Over"),this.onLeave(a),this.feature=null},cancel:function(){this.handlers.drag.deactivate();this.over=!1},setMap:function(a){this.handlers.drag.setMap(a);
this.handlers.feature.setMap(a);OpenLayers.Control.prototype.setMap.apply(this,arguments)},CLASS_NAME:"OpenLayers.Control.DragFeature"});
OpenLayers.Control.KeyboardDefaults=OpenLayers.Class(OpenLayers.Control,{autoActivate:!0,slideFactor:75,draw:function(){this.handler=new OpenLayers.Handler.Keyboard(this,{keydown:this.defaultKeyPress})},defaultKeyPress:function(a){switch(a.keyCode){case OpenLayers.Event.KEY_LEFT:this.map.pan(-this.slideFactor,0);break;case OpenLayers.Event.KEY_RIGHT:this.map.pan(this.slideFactor,0);break;case OpenLayers.Event.KEY_UP:this.map.pan(0,-this.slideFactor);break;case OpenLayers.Event.KEY_DOWN:this.map.pan(0,
this.slideFactor);break;case 33:a=this.map.getSize();this.map.pan(0,-0.75*a.h);break;case 34:a=this.map.getSize();this.map.pan(0,0.75*a.h);break;case 35:a=this.map.getSize();this.map.pan(0.75*a.w,0);break;case 36:a=this.map.getSize();this.map.pan(-0.75*a.w,0);break;case 43:case 61:case 187:case 107:this.map.zoomIn();break;case 45:case 109:case 189:case 95:this.map.zoomOut()}},CLASS_NAME:"OpenLayers.Control.KeyboardDefaults"});
Proj4js={defaultDatum:"WGS84",transform:function(source,dest,point){if(!source.readyToUse){this.reportError("Proj4js initialization for:"+source.srsCode+" not yet complete");return point}if(!dest.readyToUse){this.reportError("Proj4js initialization for:"+dest.srsCode+" not yet complete");return point}if(source.srsProjNumber=="900913"&&dest.datumCode!="WGS84"||dest.srsProjNumber=="900913"&&source.datumCode!="WGS84"){var wgs84=Proj4js.WGS84;this.transform(source,wgs84,point);source=wgs84}if(source.projName==
"longlat"){point.x*=Proj4js.common.D2R;point.y*=Proj4js.common.D2R}else{if(source.to_meter){point.x*=source.to_meter;point.y*=source.to_meter}source.inverse(point)}if(source.from_greenwich)point.x+=source.from_greenwich;point=this.datum_transform(source.datum,dest.datum,point);if(dest.from_greenwich)point.x-=dest.from_greenwich;if(dest.projName=="longlat"){point.x*=Proj4js.common.R2D;point.y*=Proj4js.common.R2D}else{dest.forward(point);if(dest.to_meter){point.x/=dest.to_meter;point.y/=dest.to_meter}}return point},
datum_transform:function(source,dest,point){if(source.compare_datums(dest))return point;if(source.datum_type==Proj4js.common.PJD_NODATUM||dest.datum_type==Proj4js.common.PJD_NODATUM)return point;if(source.datum_type==Proj4js.common.PJD_GRIDSHIFT)alert("ERROR: Grid shift transformations are not implemented yet.");if(dest.datum_type==Proj4js.common.PJD_GRIDSHIFT)alert("ERROR: Grid shift transformations are not implemented yet.");if(source.es!=dest.es||source.a!=dest.a||source.datum_type==Proj4js.common.PJD_3PARAM||
source.datum_type==Proj4js.common.PJD_7PARAM||dest.datum_type==Proj4js.common.PJD_3PARAM||dest.datum_type==Proj4js.common.PJD_7PARAM){source.geodetic_to_geocentric(point);if(source.datum_type==Proj4js.common.PJD_3PARAM||source.datum_type==Proj4js.common.PJD_7PARAM)source.geocentric_to_wgs84(point);if(dest.datum_type==Proj4js.common.PJD_3PARAM||dest.datum_type==Proj4js.common.PJD_7PARAM)dest.geocentric_from_wgs84(point);dest.geocentric_to_geodetic(point)}if(dest.datum_type==Proj4js.common.PJD_GRIDSHIFT)alert("ERROR: Grid shift transformations are not implemented yet.");
return point},reportError:function(msg){},extend:function(destination,source){destination=destination||{};if(source)for(var property in source){var value=source[property];if(value!==undefined)destination[property]=value}return destination},Class:function(){var Class=function(){this.initialize.apply(this,arguments)};var extended={};var parent;for(var i=0;i<arguments.length;++i){if(typeof arguments[i]=="function")parent=arguments[i].prototype;else parent=arguments[i];Proj4js.extend(extended,parent)}Class.prototype=
extended;return Class},bind:function(func,object){var args=Array.prototype.slice.apply(arguments,[2]);return function(){var newArgs=args.concat(Array.prototype.slice.apply(arguments,[0]));return func.apply(object,newArgs)}},scriptName:"proj4js-combined.js",defsLookupService:"http://spatialreference.org/ref",libPath:null,getScriptLocation:function(){if(this.libPath)return this.libPath;var scriptName=this.scriptName;var scriptNameLen=scriptName.length;var scripts=document.getElementsByTagName("script");
for(var i=0;i<scripts.length;i++){var src=scripts[i].getAttribute("src");if(src){var index=src.lastIndexOf(scriptName);if(index>-1&&index+scriptNameLen==src.length){this.libPath=src.slice(0,-scriptNameLen);break}}}return this.libPath||""},loadScript:function(url,onload,onfail,loadCheck){var script=document.createElement("script");script.defer=false;script.type="text/javascript";script.id=url;script.src=url;script.onload=onload;script.onerror=onfail;script.loadCheck=loadCheck;if(/MSIE/.test(navigator.userAgent))script.onreadystatechange=
this.checkReadyState;document.getElementsByTagName("head")[0].appendChild(script)},checkReadyState:function(){if(this.readyState=="loaded")if(!this.loadCheck())this.onerror();else this.onload()}};
Proj4js.Proj=Proj4js.Class({readyToUse:false,title:null,projName:null,units:null,datum:null,x0:0,y0:0,localCS:false,initialize:function(srsCode){this.srsCodeInput=srsCode;if(srsCode.indexOf("GEOGCS")>=0||srsCode.indexOf("GEOCCS")>=0||srsCode.indexOf("PROJCS")>=0||srsCode.indexOf("LOCAL_CS")>=0){this.parseWKT(srsCode);this.deriveConstants();this.loadProjCode(this.projName);return}if(srsCode.indexOf("urn:")==0){var urn=srsCode.split(":");if((urn[1]=="ogc"||urn[1]=="x-ogc")&&urn[2]=="def"&&urn[3]=="crs")srsCode=
urn[4]+":"+urn[urn.length-1]}else if(srsCode.indexOf("http://")==0){var url=srsCode.split("#");if(url[0].match(/epsg.org/))srsCode="EPSG:"+url[1];else if(url[0].match(/RIG.xml/))srsCode="IGNF:"+url[1]}this.srsCode=srsCode.toUpperCase();if(this.srsCode.indexOf("EPSG")==0){this.srsCode=this.srsCode;this.srsAuth="epsg";this.srsProjNumber=this.srsCode.substring(5)}else if(this.srsCode.indexOf("IGNF")==0){this.srsCode=this.srsCode;this.srsAuth="IGNF";this.srsProjNumber=this.srsCode.substring(5)}else if(this.srsCode.indexOf("CRS")==
0){this.srsCode=this.srsCode;this.srsAuth="CRS";this.srsProjNumber=this.srsCode.substring(4)}else{this.srsAuth="";this.srsProjNumber=this.srsCode}this.loadProjDefinition()},loadProjDefinition:function(){if(Proj4js.defs[this.srsCode]){this.defsLoaded();return}var url=Proj4js.getScriptLocation()+"defs/"+this.srsAuth.toUpperCase()+this.srsProjNumber+".js";Proj4js.loadScript(url,Proj4js.bind(this.defsLoaded,this),Proj4js.bind(this.loadFromService,this),Proj4js.bind(this.checkDefsLoaded,this))},loadFromService:function(){var url=
Proj4js.defsLookupService+"/"+this.srsAuth+"/"+this.srsProjNumber+"/proj4js/";Proj4js.loadScript(url,Proj4js.bind(this.defsLoaded,this),Proj4js.bind(this.defsFailed,this),Proj4js.bind(this.checkDefsLoaded,this))},defsLoaded:function(){this.parseDefs();this.loadProjCode(this.projName)},checkDefsLoaded:function(){if(Proj4js.defs[this.srsCode])return true;else return false},defsFailed:function(){Proj4js.reportError("failed to load projection definition for: "+this.srsCode);Proj4js.defs[this.srsCode]=
Proj4js.defs["WGS84"];this.defsLoaded()},loadProjCode:function(projName){if(Proj4js.Proj[projName]){this.initTransforms();return}var url=Proj4js.getScriptLocation()+"projCode/"+projName+".js";Proj4js.loadScript(url,Proj4js.bind(this.loadProjCodeSuccess,this,projName),Proj4js.bind(this.loadProjCodeFailure,this,projName),Proj4js.bind(this.checkCodeLoaded,this,projName))},loadProjCodeSuccess:function(projName){if(Proj4js.Proj[projName].dependsOn)this.loadProjCode(Proj4js.Proj[projName].dependsOn);else this.initTransforms()},
loadProjCodeFailure:function(projName){Proj4js.reportError("failed to find projection file for: "+projName)},checkCodeLoaded:function(projName){if(Proj4js.Proj[projName])return true;else return false},initTransforms:function(){Proj4js.extend(this,Proj4js.Proj[this.projName]);this.init();this.readyToUse=true},wktRE:/^(\w+)\[(.*)\]$/,parseWKT:function(wkt){var wktMatch=wkt.match(this.wktRE);if(!wktMatch)return;var wktObject=wktMatch[1];var wktContent=wktMatch[2];var wktTemp=wktContent.split(",");var wktName=
wktTemp.shift();wktName=wktName.replace(/^\"/,"");wktName=wktName.replace(/\"$/,"");var wktArray=new Array;var bkCount=0;var obj="";for(var i=0;i<wktTemp.length;++i){var token=wktTemp[i];for(var j=0;j<token.length;++j){if(token.charAt(j)=="[")++bkCount;if(token.charAt(j)=="]")--bkCount}obj+=token;if(bkCount===0){wktArray.push(obj);obj=""}else obj+=","}switch(wktObject){case "LOCAL_CS":this.projName="identity";this.localCS=true;this.srsCode=wktName;break;case "GEOGCS":this.projName="longlat";this.geocsCode=
wktName;if(!this.srsCode)this.srsCode=wktName;break;case "PROJCS":this.srsCode=wktName;break;case "GEOCCS":break;case "PROJECTION":this.projName=Proj4js.wktProjections[wktName];break;case "DATUM":this.datumName=wktName;break;case "LOCAL_DATUM":this.datumCode="none";break;case "SPHEROID":this.ellps=wktName;this.a=parseFloat(wktArray.shift());this.rf=parseFloat(wktArray.shift());break;case "PRIMEM":this.from_greenwich=parseFloat(wktArray.shift());break;case "UNIT":this.units=wktName;this.unitsPerMeter=
parseFloat(wktArray.shift());break;case "PARAMETER":var name=wktName.toLowerCase();var value=parseFloat(wktArray.shift());switch(name){case "false_easting":this.x0=value;break;case "false_northing":this.y0=value;break;case "scale_factor":this.k0=value;break;case "central_meridian":this.long0=value*Proj4js.common.D2R;break;case "latitude_of_origin":this.lat0=value*Proj4js.common.D2R;break;case "more_here":break;default:break}break;case "TOWGS84":this.datum_params=wktArray;break;case "MORE_HERE":break;
default:break}for(var i=0;i<wktArray.length;++i)this.parseWKT(wktArray[i])},parseDefs:function(){this.defData=Proj4js.defs[this.srsCode];var paramName,paramVal;if(!this.defData)return;var paramArray=this.defData.split("+");for(var prop=0;prop<paramArray.length;prop++){var property=paramArray[prop].split("=");paramName=property[0].toLowerCase();paramVal=property[1];switch(paramName.replace(/\s/gi,"")){case "":break;case "title":this.title=paramVal;break;case "proj":this.projName=paramVal.replace(/\s/gi,
"");break;case "units":this.units=paramVal.replace(/\s/gi,"");break;case "datum":this.datumCode=paramVal.replace(/\s/gi,"");break;case "nadgrids":this.nagrids=paramVal.replace(/\s/gi,"");break;case "ellps":this.ellps=paramVal.replace(/\s/gi,"");break;case "a":this.a=parseFloat(paramVal);break;case "b":this.b=parseFloat(paramVal);break;case "rf":this.rf=parseFloat(paramVal);break;case "lat_0":this.lat0=paramVal*Proj4js.common.D2R;break;case "lat_1":this.lat1=paramVal*Proj4js.common.D2R;break;case "lat_2":this.lat2=
paramVal*Proj4js.common.D2R;break;case "lat_ts":this.lat_ts=paramVal*Proj4js.common.D2R;break;case "lon_0":this.long0=paramVal*Proj4js.common.D2R;break;case "alpha":this.alpha=parseFloat(paramVal)*Proj4js.common.D2R;break;case "lonc":this.longc=paramVal*Proj4js.common.D2R;break;case "x_0":this.x0=parseFloat(paramVal);break;case "y_0":this.y0=parseFloat(paramVal);break;case "k_0":this.k0=parseFloat(paramVal);break;case "k":this.k0=parseFloat(paramVal);break;case "r_a":this.R_A=true;break;case "zone":this.zone=
parseInt(paramVal);break;case "south":this.utmSouth=true;break;case "towgs84":this.datum_params=paramVal.split(",");break;case "to_meter":this.to_meter=parseFloat(paramVal);break;case "from_greenwich":this.from_greenwich=paramVal*Proj4js.common.D2R;break;case "pm":paramVal=paramVal.replace(/\s/gi,"");this.from_greenwich=Proj4js.PrimeMeridian[paramVal]?Proj4js.PrimeMeridian[paramVal]:parseFloat(paramVal);this.from_greenwich*=Proj4js.common.D2R;break;case "no_defs":break;default:}}this.deriveConstants()},
deriveConstants:function(){if(this.nagrids=="@null")this.datumCode="none";if(this.datumCode&&this.datumCode!="none"){var datumDef=Proj4js.Datum[this.datumCode];if(datumDef){this.datum_params=datumDef.towgs84?datumDef.towgs84.split(","):null;this.ellps=datumDef.ellipse;this.datumName=datumDef.datumName?datumDef.datumName:this.datumCode}}if(!this.a){var ellipse=Proj4js.Ellipsoid[this.ellps]?Proj4js.Ellipsoid[this.ellps]:Proj4js.Ellipsoid["WGS84"];Proj4js.extend(this,ellipse)}if(this.rf&&!this.b)this.b=
(1-1/this.rf)*this.a;if(Math.abs(this.a-this.b)<Proj4js.common.EPSLN){this.sphere=true;this.b=this.a}this.a2=this.a*this.a;this.b2=this.b*this.b;this.es=(this.a2-this.b2)/this.a2;this.e=Math.sqrt(this.es);if(this.R_A){this.a*=1-this.es*(Proj4js.common.SIXTH+this.es*(Proj4js.common.RA4+this.es*Proj4js.common.RA6));this.a2=this.a*this.a;this.b2=this.b*this.b;this.es=0}this.ep2=(this.a2-this.b2)/this.b2;if(!this.k0)this.k0=1;this.datum=new Proj4js.datum(this)}});
Proj4js.Proj.longlat={init:function(){},forward:function(pt){return pt},inverse:function(pt){return pt}};Proj4js.Proj.identity=Proj4js.Proj.longlat;Proj4js.defs={WGS84:"+title=long/lat:WGS84 +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees","EPSG:4326":"+title=long/lat:WGS84 +proj=longlat +a=6378137.0 +b=6356752.31424518 +ellps=WGS84 +datum=WGS84 +units=degrees","EPSG:4269":"+title=long/lat:NAD83 +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees","EPSG:3785":"+title= Google Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"};
Proj4js.defs["GOOGLE"]=Proj4js.defs["EPSG:3785"];Proj4js.defs["EPSG:900913"]=Proj4js.defs["EPSG:3785"];Proj4js.defs["EPSG:102113"]=Proj4js.defs["EPSG:3785"];
Proj4js.common={PI:3.141592653589793,HALF_PI:1.5707963267948966,TWO_PI:6.283185307179586,FORTPI:0.7853981633974483,R2D:57.29577951308232,D2R:0.017453292519943295,SEC_TO_RAD:4.84813681109536E-6,EPSLN:1.0E-10,MAX_ITER:20,COS_67P5:0.3826834323650898,AD_C:1.0026,PJD_UNKNOWN:0,PJD_3PARAM:1,PJD_7PARAM:2,PJD_GRIDSHIFT:3,PJD_WGS84:4,PJD_NODATUM:5,SRS_WGS84_SEMIMAJOR:6378137,SIXTH:0.16666666666666666,RA4:0.04722222222222222,RA6:0.022156084656084655,RV4:0.06944444444444445,RV6:0.04243827160493827,msfnz:function(eccent,
sinphi,cosphi){var con=eccent*sinphi;return cosphi/Math.sqrt(1-con*con)},tsfnz:function(eccent,phi,sinphi){var con=eccent*sinphi;var com=0.5*eccent;con=Math.pow((1-con)/(1+con),com);return Math.tan(0.5*(this.HALF_PI-phi))/con},phi2z:function(eccent,ts){var eccnth=0.5*eccent;var con,dphi;var phi=this.HALF_PI-2*Math.atan(ts);for(var i=0;i<=15;i++){con=eccent*Math.sin(phi);dphi=this.HALF_PI-2*Math.atan(ts*Math.pow((1-con)/(1+con),eccnth))-phi;phi+=dphi;if(Math.abs(dphi)<=1.0E-10)return phi}alert("phi2z has NoConvergence");
return-9999},qsfnz:function(eccent,sinphi){var con;if(eccent>1.0E-7){con=eccent*sinphi;return(1-eccent*eccent)*(sinphi/(1-con*con)-0.5/eccent*Math.log((1-con)/(1+con)))}else return 2*sinphi},asinz:function(x){if(Math.abs(x)>1)x=x>1?1:-1;return Math.asin(x)},e0fn:function(x){return 1-0.25*x*(1+x/16*(3+1.25*x))},e1fn:function(x){return 0.375*x*(1+0.25*x*(1+0.46875*x))},e2fn:function(x){return 0.05859375*x*x*(1+0.75*x)},e3fn:function(x){return x*x*x*(35/3072)},mlfn:function(e0,e1,e2,e3,phi){return e0*
phi-e1*Math.sin(2*phi)+e2*Math.sin(4*phi)-e3*Math.sin(6*phi)},srat:function(esinp,exp){return Math.pow((1-esinp)/(1+esinp),exp)},sign:function(x){if(x<0)return-1;else return 1},adjust_lon:function(x){x=Math.abs(x)<this.PI?x:x-this.sign(x)*this.TWO_PI;return x},adjust_lat:function(x){x=Math.abs(x)<this.HALF_PI?x:x-this.sign(x)*this.PI;return x},latiso:function(eccent,phi,sinphi){if(Math.abs(phi)>this.HALF_PI)return+Number.NaN;if(phi==this.HALF_PI)return Number.POSITIVE_INFINITY;if(phi==-1*this.HALF_PI)return-1*
Number.POSITIVE_INFINITY;var con=eccent*sinphi;return Math.log(Math.tan((this.HALF_PI+phi)/2))+eccent*Math.log((1-con)/(1+con))/2},fL:function(x,L){return 2*Math.atan(x*Math.exp(L))-this.HALF_PI},invlatiso:function(eccent,ts){var phi=this.fL(1,ts);var Iphi=0;var con=0;do{Iphi=phi;con=eccent*Math.sin(Iphi);phi=this.fL(Math.exp(eccent*Math.log((1+con)/(1-con))/2),ts)}while(Math.abs(phi-Iphi)>1.0E-12);return phi},sinh:function(x){var r=Math.exp(x);r=(r-1/r)/2;return r},cosh:function(x){var r=Math.exp(x);
r=(r+1/r)/2;return r},tanh:function(x){var r=Math.exp(x);r=(r-1/r)/(r+1/r);return r},asinh:function(x){var s=x>=0?1:-1;return s*Math.log(Math.abs(x)+Math.sqrt(x*x+1))},acosh:function(x){return 2*Math.log(Math.sqrt((x+1)/2)+Math.sqrt((x-1)/2))},atanh:function(x){return Math.log((x-1)/(x+1))/2},gN:function(a,e,sinphi){var temp=e*sinphi;return a/Math.sqrt(1-temp*temp)}};
Proj4js.datum=Proj4js.Class({initialize:function(proj){this.datum_type=Proj4js.common.PJD_WGS84;if(proj.datumCode&&proj.datumCode=="none")this.datum_type=Proj4js.common.PJD_NODATUM;if(proj&&proj.datum_params){for(var i=0;i<proj.datum_params.length;i++)proj.datum_params[i]=parseFloat(proj.datum_params[i]);if(proj.datum_params[0]!=0||proj.datum_params[1]!=0||proj.datum_params[2]!=0)this.datum_type=Proj4js.common.PJD_3PARAM;if(proj.datum_params.length>3)if(proj.datum_params[3]!=0||proj.datum_params[4]!=
0||proj.datum_params[5]!=0||proj.datum_params[6]!=0){this.datum_type=Proj4js.common.PJD_7PARAM;proj.datum_params[3]*=Proj4js.common.SEC_TO_RAD;proj.datum_params[4]*=Proj4js.common.SEC_TO_RAD;proj.datum_params[5]*=Proj4js.common.SEC_TO_RAD;proj.datum_params[6]=proj.datum_params[6]/1E6+1}}if(proj){this.a=proj.a;this.b=proj.b;this.es=proj.es;this.ep2=proj.ep2;this.datum_params=proj.datum_params}},compare_datums:function(dest){if(this.datum_type!=dest.datum_type)return false;else if(this.a!=dest.a||Math.abs(this.es-
dest.es)>5.0E-11)return false;else if(this.datum_type==Proj4js.common.PJD_3PARAM)return this.datum_params[0]==dest.datum_params[0]&&this.datum_params[1]==dest.datum_params[1]&&this.datum_params[2]==dest.datum_params[2];else if(this.datum_type==Proj4js.common.PJD_7PARAM)return this.datum_params[0]==dest.datum_params[0]&&this.datum_params[1]==dest.datum_params[1]&&this.datum_params[2]==dest.datum_params[2]&&this.datum_params[3]==dest.datum_params[3]&&this.datum_params[4]==dest.datum_params[4]&&this.datum_params[5]==
dest.datum_params[5]&&this.datum_params[6]==dest.datum_params[6];else if(this.datum_type==Proj4js.common.PJD_GRIDSHIFT)return strcmp(pj_param(this.params,"snadgrids").s,pj_param(dest.params,"snadgrids").s)==0;else return true},geodetic_to_geocentric:function(p){var Longitude=p.x;var Latitude=p.y;var Height=p.z?p.z:0;var X;var Y;var Z;var Error_Code=0;var Rn;var Sin_Lat;var Sin2_Lat;var Cos_Lat;if(Latitude<-Proj4js.common.HALF_PI&&Latitude>-1.001*Proj4js.common.HALF_PI)Latitude=-Proj4js.common.HALF_PI;
else if(Latitude>Proj4js.common.HALF_PI&&Latitude<1.001*Proj4js.common.HALF_PI)Latitude=Proj4js.common.HALF_PI;else if(Latitude<-Proj4js.common.HALF_PI||Latitude>Proj4js.common.HALF_PI){Proj4js.reportError("geocent:lat out of range:"+Latitude);return null}if(Longitude>Proj4js.common.PI)Longitude-=2*Proj4js.common.PI;Sin_Lat=Math.sin(Latitude);Cos_Lat=Math.cos(Latitude);Sin2_Lat=Sin_Lat*Sin_Lat;Rn=this.a/Math.sqrt(1-this.es*Sin2_Lat);X=(Rn+Height)*Cos_Lat*Math.cos(Longitude);Y=(Rn+Height)*Cos_Lat*
Math.sin(Longitude);Z=(Rn*(1-this.es)+Height)*Sin_Lat;p.x=X;p.y=Y;p.z=Z;return Error_Code},geocentric_to_geodetic:function(p){var genau=1.0E-12;var genau2=genau*genau;var maxiter=30;var P;var RR;var CT;var ST;var RX;var RK;var RN;var CPHI0;var SPHI0;var CPHI;var SPHI;var SDPHI;var At_Pole;var iter;var X=p.x;var Y=p.y;var Z=p.z?p.z:0;var Longitude;var Latitude;var Height;At_Pole=false;P=Math.sqrt(X*X+Y*Y);RR=Math.sqrt(X*X+Y*Y+Z*Z);if(P/this.a<genau){At_Pole=true;Longitude=0;if(RR/this.a<genau){Latitude=
Proj4js.common.HALF_PI;Height=-this.b;return}}else Longitude=Math.atan2(Y,X);CT=Z/RR;ST=P/RR;RX=1/Math.sqrt(1-this.es*(2-this.es)*ST*ST);CPHI0=ST*(1-this.es)*RX;SPHI0=CT*RX;iter=0;do{iter++;RN=this.a/Math.sqrt(1-this.es*SPHI0*SPHI0);Height=P*CPHI0+Z*SPHI0-RN*(1-this.es*SPHI0*SPHI0);RK=this.es*RN/(RN+Height);RX=1/Math.sqrt(1-RK*(2-RK)*ST*ST);CPHI=ST*(1-RK)*RX;SPHI=CT*RX;SDPHI=SPHI*CPHI0-CPHI*SPHI0;CPHI0=CPHI;SPHI0=SPHI}while(SDPHI*SDPHI>genau2&&iter<maxiter);Latitude=Math.atan(SPHI/Math.abs(CPHI));
p.x=Longitude;p.y=Latitude;p.z=Height;return p},geocentric_to_geodetic_noniter:function(p){var X=p.x;var Y=p.y;var Z=p.z?p.z:0;var Longitude;var Latitude;var Height;var W;var W2;var T0;var T1;var S0;var S1;var Sin_B0;var Sin3_B0;var Cos_B0;var Sin_p1;var Cos_p1;var Rn;var Sum;var At_Pole;X=parseFloat(X);Y=parseFloat(Y);Z=parseFloat(Z);At_Pole=false;if(X!=0)Longitude=Math.atan2(Y,X);else if(Y>0)Longitude=Proj4js.common.HALF_PI;else if(Y<0)Longitude=-Proj4js.common.HALF_PI;else{At_Pole=true;Longitude=
0;if(Z>0)Latitude=Proj4js.common.HALF_PI;else if(Z<0)Latitude=-Proj4js.common.HALF_PI;else{Latitude=Proj4js.common.HALF_PI;Height=-this.b;return}}W2=X*X+Y*Y;W=Math.sqrt(W2);T0=Z*Proj4js.common.AD_C;S0=Math.sqrt(T0*T0+W2);Sin_B0=T0/S0;Cos_B0=W/S0;Sin3_B0=Sin_B0*Sin_B0*Sin_B0;T1=Z+this.b*this.ep2*Sin3_B0;Sum=W-this.a*this.es*Cos_B0*Cos_B0*Cos_B0;S1=Math.sqrt(T1*T1+Sum*Sum);Sin_p1=T1/S1;Cos_p1=Sum/S1;Rn=this.a/Math.sqrt(1-this.es*Sin_p1*Sin_p1);if(Cos_p1>=Proj4js.common.COS_67P5)Height=W/Cos_p1-Rn;else if(Cos_p1<=
-Proj4js.common.COS_67P5)Height=W/-Cos_p1-Rn;else Height=Z/Sin_p1+Rn*(this.es-1);if(At_Pole==false)Latitude=Math.atan(Sin_p1/Cos_p1);p.x=Longitude;p.y=Latitude;p.z=Height;return p},geocentric_to_wgs84:function(p){if(this.datum_type==Proj4js.common.PJD_3PARAM){p.x+=this.datum_params[0];p.y+=this.datum_params[1];p.z+=this.datum_params[2]}else if(this.datum_type==Proj4js.common.PJD_7PARAM){var Dx_BF=this.datum_params[0];var Dy_BF=this.datum_params[1];var Dz_BF=this.datum_params[2];var Rx_BF=this.datum_params[3];
var Ry_BF=this.datum_params[4];var Rz_BF=this.datum_params[5];var M_BF=this.datum_params[6];var x_out=M_BF*(p.x-Rz_BF*p.y+Ry_BF*p.z)+Dx_BF;var y_out=M_BF*(Rz_BF*p.x+p.y-Rx_BF*p.z)+Dy_BF;var z_out=M_BF*(-Ry_BF*p.x+Rx_BF*p.y+p.z)+Dz_BF;p.x=x_out;p.y=y_out;p.z=z_out}},geocentric_from_wgs84:function(p){if(this.datum_type==Proj4js.common.PJD_3PARAM){p.x-=this.datum_params[0];p.y-=this.datum_params[1];p.z-=this.datum_params[2]}else if(this.datum_type==Proj4js.common.PJD_7PARAM){var Dx_BF=this.datum_params[0];
var Dy_BF=this.datum_params[1];var Dz_BF=this.datum_params[2];var Rx_BF=this.datum_params[3];var Ry_BF=this.datum_params[4];var Rz_BF=this.datum_params[5];var M_BF=this.datum_params[6];var x_tmp=(p.x-Dx_BF)/M_BF;var y_tmp=(p.y-Dy_BF)/M_BF;var z_tmp=(p.z-Dz_BF)/M_BF;p.x=x_tmp+Rz_BF*y_tmp-Ry_BF*z_tmp;p.y=-Rz_BF*x_tmp+y_tmp+Rx_BF*z_tmp;p.z=Ry_BF*x_tmp-Rx_BF*y_tmp+z_tmp}}});
Proj4js.Point=Proj4js.Class({initialize:function(x,y,z){if(typeof x=="object"){this.x=x[0];this.y=x[1];this.z=x[2]||0}else if(typeof x=="string"){var coords=x.split(",");this.x=parseFloat(coords[0]);this.y=parseFloat(coords[1]);this.z=parseFloat(coords[2])||0}else{this.x=x;this.y=y;this.z=z||0}},clone:function(){return new Proj4js.Point(this.x,this.y,this.z)},toString:function(){return"x="+this.x+",y="+this.y},toShortString:function(){return this.x+", "+this.y}});
Proj4js.PrimeMeridian={greenwich:0,lisbon:-9.131906111111,paris:2.337229166667,bogota:-74.080916666667,madrid:-3.687938888889,rome:12.452333333333,bern:7.439583333333,jakarta:106.807719444444,ferro:-17.666666666667,brussels:4.367975,stockholm:18.058277777778,athens:23.7163375,oslo:10.722916666667};
Proj4js.Ellipsoid={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},"APL4.":{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},
andrae:{a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},clrk80:{a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},CPM:{a:6375738.7,rf:334.29,
ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},
fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},
new_intl:{a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:6355834.8467,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS72:{a:6378135,rf:298.26,ellipseName:"WGS 72"},WGS84:{a:6378137,rf:298.257223563,ellipseName:"WGS 84"},
sphere:{a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}};
Proj4js.Datum={WGS84:{towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},GGRS87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},NAD83:{towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},NAD27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0",
ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},OSGB36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"}};
Proj4js.WGS84=new Proj4js.Proj("WGS84");Proj4js.Datum["OSB36"]=Proj4js.Datum["OSGB36"];Proj4js.wktProjections={"Lambert Tangential Conformal Conic Projection":"lcc",Mercator:"merc",Transverse_Mercator:"tmerc","Transverse Mercator":"tmerc","Lambert Azimuthal Equal Area":"laea","Universal Transverse Mercator System":"utm"};
Proj4js.Proj.aea={init:function(){if(Math.abs(this.lat1+this.lat2)<Proj4js.common.EPSLN){Proj4js.reportError("aeaInitEqualLatitudes");return}this.temp=this.b/this.a;this.es=1-Math.pow(this.temp,2);this.e3=Math.sqrt(this.es);this.sin_po=Math.sin(this.lat1);this.cos_po=Math.cos(this.lat1);this.t1=this.sin_po;this.con=this.sin_po;this.ms1=Proj4js.common.msfnz(this.e3,this.sin_po,this.cos_po);this.qs1=Proj4js.common.qsfnz(this.e3,this.sin_po,this.cos_po);this.sin_po=Math.sin(this.lat2);this.cos_po=Math.cos(this.lat2);
this.t2=this.sin_po;this.ms2=Proj4js.common.msfnz(this.e3,this.sin_po,this.cos_po);this.qs2=Proj4js.common.qsfnz(this.e3,this.sin_po,this.cos_po);this.sin_po=Math.sin(this.lat0);this.cos_po=Math.cos(this.lat0);this.t3=this.sin_po;this.qs0=Proj4js.common.qsfnz(this.e3,this.sin_po,this.cos_po);if(Math.abs(this.lat1-this.lat2)>Proj4js.common.EPSLN)this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1);else this.ns0=this.con;this.c=this.ms1*this.ms1+this.ns0*this.qs1;this.rh=this.a*Math.sqrt(this.c-
this.ns0*this.qs0)/this.ns0},forward:function(p){var lon=p.x;var lat=p.y;this.sin_phi=Math.sin(lat);this.cos_phi=Math.cos(lat);var qs=Proj4js.common.qsfnz(this.e3,this.sin_phi,this.cos_phi);var rh1=this.a*Math.sqrt(this.c-this.ns0*qs)/this.ns0;var theta=this.ns0*Proj4js.common.adjust_lon(lon-this.long0);var x=rh1*Math.sin(theta)+this.x0;var y=this.rh-rh1*Math.cos(theta)+this.y0;p.x=x;p.y=y;return p},inverse:function(p){var rh1,qs,con,theta,lon,lat;p.x-=this.x0;p.y=this.rh-p.y+this.y0;if(this.ns0>=
0){rh1=Math.sqrt(p.x*p.x+p.y*p.y);con=1}else{rh1=-Math.sqrt(p.x*p.x+p.y*p.y);con=-1}theta=0;if(rh1!=0)theta=Math.atan2(con*p.x,con*p.y);con=rh1*this.ns0/this.a;qs=(this.c-con*con)/this.ns0;if(this.e3>=1.0E-10){con=1-0.5*(1-this.es)*Math.log((1-this.e3)/(1+this.e3))/this.e3;if(Math.abs(Math.abs(con)-Math.abs(qs))>1.0E-10)lat=this.phi1z(this.e3,qs);else if(qs>=0)lat=0.5*PI;else lat=-0.5*PI}else lat=this.phi1z(e3,qs);lon=Proj4js.common.adjust_lon(theta/this.ns0+this.long0);p.x=lon;p.y=lat;return p},
phi1z:function(eccent,qs){var con,com,dphi;var phi=Proj4js.common.asinz(0.5*qs);if(eccent<Proj4js.common.EPSLN)return phi;var eccnts=eccent*eccent;for(var i=1;i<=25;i++){sinphi=Math.sin(phi);cosphi=Math.cos(phi);con=eccent*sinphi;com=1-con*con;dphi=0.5*com*com/cosphi*(qs/(1-eccnts)-sinphi/com+0.5/eccent*Math.log((1-con)/(1+con)));phi=phi+dphi;if(Math.abs(dphi)<=1.0E-7)return phi}Proj4js.reportError("aea:phi1z:Convergence error");return null}};
Proj4js.Proj.sterea={dependsOn:"gauss",init:function(){Proj4js.Proj["gauss"].init.apply(this);if(!this.rc){Proj4js.reportError("sterea:init:E_ERROR_0");return}this.sinc0=Math.sin(this.phic0);this.cosc0=Math.cos(this.phic0);this.R2=2*this.rc;if(!this.title)this.title="Oblique Stereographic Alternative"},forward:function(p){p.x=Proj4js.common.adjust_lon(p.x-this.long0);Proj4js.Proj["gauss"].forward.apply(this,[p]);sinc=Math.sin(p.y);cosc=Math.cos(p.y);cosl=Math.cos(p.x);k=this.k0*this.R2/(1+this.sinc0*
sinc+this.cosc0*cosc*cosl);p.x=k*cosc*Math.sin(p.x);p.y=k*(this.cosc0*sinc-this.sinc0*cosc*cosl);p.x=this.a*p.x+this.x0;p.y=this.a*p.y+this.y0;return p},inverse:function(p){var lon,lat;p.x=(p.x-this.x0)/this.a;p.y=(p.y-this.y0)/this.a;p.x/=this.k0;p.y/=this.k0;if(rho=Math.sqrt(p.x*p.x+p.y*p.y)){c=2*Math.atan2(rho,this.R2);sinc=Math.sin(c);cosc=Math.cos(c);lat=Math.asin(cosc*this.sinc0+p.y*sinc*this.cosc0/rho);lon=Math.atan2(p.x*sinc,rho*this.cosc0*cosc-p.y*this.sinc0*sinc)}else{lat=this.phic0;lon=
0}p.x=lon;p.y=lat;Proj4js.Proj["gauss"].inverse.apply(this,[p]);p.x=Proj4js.common.adjust_lon(p.x+this.long0);return p}};
function phi4z(eccent,e0,e1,e2,e3,a,b,c,phi){var sinphi,sin2ph,tanph,ml,mlp,con1,con2,con3,dphi,i;phi=a;for(i=1;i<=15;i++){sinphi=Math.sin(phi);tanphi=Math.tan(phi);c=tanphi*Math.sqrt(1-eccent*sinphi*sinphi);sin2ph=Math.sin(2*phi);ml=e0*phi-e1*sin2ph+e2*Math.sin(4*phi)-e3*Math.sin(6*phi);mlp=e0-2*e1*Math.cos(2*phi)+4*e2*Math.cos(4*phi)-6*e3*Math.cos(6*phi);con1=2*ml+c*(ml*ml+b)-2*a*(c*ml+1);con2=eccent*sin2ph*(ml*ml+b-2*a*ml)/(2*c);con3=2*(a-ml)*(c*mlp-2/sin2ph)-2*mlp;dphi=con1/(con2+con3);phi+=dphi;
if(Math.abs(dphi)<=1.0E-10)return phi}Proj4js.reportError("phi4z: No convergence");return null}function e4fn(x){var con,com;con=1+x;com=1-x;return Math.sqrt(Math.pow(con,con)*Math.pow(com,com))}
Proj4js.Proj.poly={init:function(){var temp;if(this.lat0=0)this.lat0=90;this.temp=this.b/this.a;this.es=1-Math.pow(this.temp,2);this.e=Math.sqrt(this.es);this.e0=Proj4js.common.e0fn(this.es);this.e1=Proj4js.common.e1fn(this.es);this.e2=Proj4js.common.e2fn(this.es);this.e3=Proj4js.common.e3fn(this.es);this.ml0=Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(p){var sinphi,cosphi;var al;var c;var con,ml;var ms;var x,y;var lon=p.x;var lat=p.y;con=Proj4js.common.adjust_lon(lon-
this.long0);if(Math.abs(lat)<=1.0E-7){x=this.x0+this.a*con;y=this.y0-this.a*this.ml0}else{sinphi=Math.sin(lat);cosphi=Math.cos(lat);ml=Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,lat);ms=Proj4js.common.msfnz(this.e,sinphi,cosphi);con=sinphi;x=this.x0+this.a*ms*Math.sin(con)/sinphi;y=this.y0+this.a*(ml-this.ml0+ms*(1-Math.cos(con))/sinphi)}p.x=x;p.y=y;return p},inverse:function(p){var sin_phi,cos_phi;var al;var b;var c;var con,ml;var iflg;var lon,lat;p.x-=this.x0;p.y-=this.y0;al=this.ml0+p.y/
this.a;iflg=0;if(Math.abs(al)<=1.0E-7){lon=p.x/this.a+this.long0;lat=0}else{b=al*al+p.x/this.a*(p.x/this.a);iflg=phi4z(this.es,this.e0,this.e1,this.e2,this.e3,this.al,b,c,lat);if(iflg!=1)return iflg;lon=Proj4js.common.adjust_lon(Proj4js.common.asinz(p.x*c/this.a)/Math.sin(lat)+this.long0)}p.x=lon;p.y=lat;return p}};
Proj4js.Proj.equi={init:function(){if(!this.x0)this.x0=0;if(!this.y0)this.y0=0;if(!this.lat0)this.lat0=0;if(!this.long0)this.long0=0},forward:function(p){var lon=p.x;var lat=p.y;var dlon=Proj4js.common.adjust_lon(lon-this.long0);var x=this.x0+this.a*dlon*Math.cos(this.lat0);var y=this.y0+this.a*lat;this.t1=x;this.t2=Math.cos(this.lat0);p.x=x;p.y=y;return p},inverse:function(p){p.x-=this.x0;p.y-=this.y0;var lat=p.y/this.a;if(Math.abs(lat)>Proj4js.common.HALF_PI)Proj4js.reportError("equi:Inv:DataError");
var lon=Proj4js.common.adjust_lon(this.long0+p.x/(this.a*Math.cos(this.lat0)));p.x=lon;p.y=lat}};
Proj4js.Proj.merc={init:function(){if(this.lat_ts)if(this.sphere)this.k0=Math.cos(this.lat_ts);else this.k0=Proj4js.common.msfnz(this.es,Math.sin(this.lat_ts),Math.cos(this.lat_ts))},forward:function(p){var lon=p.x;var lat=p.y;if(lat*Proj4js.common.R2D>90&&lat*Proj4js.common.R2D<-90&&lon*Proj4js.common.R2D>180&&lon*Proj4js.common.R2D<-180){Proj4js.reportError("merc:forward: llInputOutOfRange: "+lon+" : "+lat);return null}var x,y;if(Math.abs(Math.abs(lat)-Proj4js.common.HALF_PI)<=Proj4js.common.EPSLN){Proj4js.reportError("merc:forward: ll2mAtPoles");
return null}else{if(this.sphere){x=this.x0+this.a*this.k0*Proj4js.common.adjust_lon(lon-this.long0);y=this.y0+this.a*this.k0*Math.log(Math.tan(Proj4js.common.FORTPI+0.5*lat))}else{var sinphi=Math.sin(lat);var ts=Proj4js.common.tsfnz(this.e,lat,sinphi);x=this.x0+this.a*this.k0*Proj4js.common.adjust_lon(lon-this.long0);y=this.y0-this.a*this.k0*Math.log(ts)}p.x=x;p.y=y;return p}},inverse:function(p){var x=p.x-this.x0;var y=p.y-this.y0;var lon,lat;if(this.sphere)lat=Proj4js.common.HALF_PI-2*Math.atan(Math.exp(-y/
this.a*this.k0));else{var ts=Math.exp(-y/(this.a*this.k0));lat=Proj4js.common.phi2z(this.e,ts);if(lat==-9999){Proj4js.reportError("merc:inverse: lat = -9999");return null}}lon=Proj4js.common.adjust_lon(this.long0+x/(this.a*this.k0));p.x=lon;p.y=lat;return p}};
Proj4js.Proj.utm={dependsOn:"tmerc",init:function(){if(!this.zone){Proj4js.reportError("utm:init: zone must be specified for UTM");return}this.lat0=0;this.long0=(6*Math.abs(this.zone)-183)*Proj4js.common.D2R;this.x0=5E5;this.y0=this.utmSouth?1E7:0;this.k0=0.9996;Proj4js.Proj["tmerc"].init.apply(this);this.forward=Proj4js.Proj["tmerc"].forward;this.inverse=Proj4js.Proj["tmerc"].inverse}};
Proj4js.Proj.eqdc={init:function(){if(!this.mode)this.mode=0;this.temp=this.b/this.a;this.es=1-Math.pow(this.temp,2);this.e=Math.sqrt(this.es);this.e0=Proj4js.common.e0fn(this.es);this.e1=Proj4js.common.e1fn(this.es);this.e2=Proj4js.common.e2fn(this.es);this.e3=Proj4js.common.e3fn(this.es);this.sinphi=Math.sin(this.lat1);this.cosphi=Math.cos(this.lat1);this.ms1=Proj4js.common.msfnz(this.e,this.sinphi,this.cosphi);this.ml1=Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,this.lat1);if(this.mode!=
0){if(Math.abs(this.lat1+this.lat2)<Proj4js.common.EPSLN)Proj4js.reportError("eqdc:Init:EqualLatitudes");this.sinphi=Math.sin(this.lat2);this.cosphi=Math.cos(this.lat2);this.ms2=Proj4js.common.msfnz(this.e,this.sinphi,this.cosphi);this.ml2=Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,this.lat2);if(Math.abs(this.lat1-this.lat2)>=Proj4js.common.EPSLN)this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1);else this.ns=this.sinphi}else this.ns=this.sinphi;this.g=this.ml1+this.ms1/this.ns;this.ml0=Proj4js.common.mlfn(this.e0,
this.e1,this.e2,this.e3,this.lat0);this.rh=this.a*(this.g-this.ml0)},forward:function(p){var lon=p.x;var lat=p.y;var ml=Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,lat);var rh1=this.a*(this.g-ml);var theta=this.ns*Proj4js.common.adjust_lon(lon-this.long0);var x=this.x0+rh1*Math.sin(theta);var y=this.y0+this.rh-rh1*Math.cos(theta);p.x=x;p.y=y;return p},inverse:function(p){p.x-=this.x0;p.y=this.rh-p.y+this.y0;var con,rh1;if(this.ns>=0){var rh1=Math.sqrt(p.x*p.x+p.y*p.y);var con=1}else{rh1=-Math.sqrt(p.x*
p.x+p.y*p.y);con=-1}var theta=0;if(rh1!=0)theta=Math.atan2(con*p.x,con*p.y);var ml=this.g-rh1/this.a;var lat=this.phi3z(ml,this.e0,this.e1,this.e2,this.e3);var lon=Proj4js.common.adjust_lon(this.long0+theta/this.ns);p.x=lon;p.y=lat;return p},phi3z:function(ml,e0,e1,e2,e3){var phi;var dphi;phi=ml;for(var i=0;i<15;i++){dphi=(ml+e1*Math.sin(2*phi)-e2*Math.sin(4*phi)+e3*Math.sin(6*phi))/e0-phi;phi+=dphi;if(Math.abs(dphi)<=1.0E-10)return phi}Proj4js.reportError("PHI3Z-CONV:Latitude failed to converge after 15 iterations");
return null}};
Proj4js.Proj.tmerc={init:function(){this.e0=Proj4js.common.e0fn(this.es);this.e1=Proj4js.common.e1fn(this.es);this.e2=Proj4js.common.e2fn(this.es);this.e3=Proj4js.common.e3fn(this.es);this.ml0=this.a*Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(p){var lon=p.x;var lat=p.y;var delta_lon=Proj4js.common.adjust_lon(lon-this.long0);var con;var x,y;var sin_phi=Math.sin(lat);var cos_phi=Math.cos(lat);if(this.sphere){var b=cos_phi*Math.sin(delta_lon);if(Math.abs(Math.abs(b)-1)<
1.0E-10){Proj4js.reportError("tmerc:forward: Point projects into infinity");return 93}else{x=0.5*this.a*this.k0*Math.log((1+b)/(1-b));con=Math.acos(cos_phi*Math.cos(delta_lon)/Math.sqrt(1-b*b));if(lat<0)con=-con;y=this.a*this.k0*(con-this.lat0)}}else{var al=cos_phi*delta_lon;var als=Math.pow(al,2);var c=this.ep2*Math.pow(cos_phi,2);var tq=Math.tan(lat);var t=Math.pow(tq,2);con=1-this.es*Math.pow(sin_phi,2);var n=this.a/Math.sqrt(con);var ml=this.a*Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,
lat);x=this.k0*n*al*(1+als/6*(1-t+c+als/20*(5-18*t+Math.pow(t,2)+72*c-58*this.ep2)))+this.x0;y=this.k0*(ml-this.ml0+n*tq*als*(0.5+als/24*(5-t+9*c+4*Math.pow(c,2)+als/30*(61-58*t+Math.pow(t,2)+600*c-330*this.ep2))))+this.y0}p.x=x;p.y=y;return p},inverse:function(p){var con,phi;var delta_phi;var i;var max_iter=6;var lat,lon;if(this.sphere){var f=Math.exp(p.x/(this.a*this.k0));var g=0.5*(f-1/f);var temp=this.lat0+p.y/(this.a*this.k0);var h=Math.cos(temp);con=Math.sqrt((1-h*h)/(1+g*g));lat=Proj4js.common.asinz(con);
if(temp<0)lat=-lat;if(g==0&&h==0)lon=this.long0;else lon=Proj4js.common.adjust_lon(Math.atan2(g,h)+this.long0)}else{var x=p.x-this.x0;var y=p.y-this.y0;con=(this.ml0+y/this.k0)/this.a;phi=con;for(i=0;true;i++){delta_phi=(con+this.e1*Math.sin(2*phi)-this.e2*Math.sin(4*phi)+this.e3*Math.sin(6*phi))/this.e0-phi;phi+=delta_phi;if(Math.abs(delta_phi)<=Proj4js.common.EPSLN)break;if(i>=max_iter){Proj4js.reportError("tmerc:inverse: Latitude failed to converge");return 95}}if(Math.abs(phi)<Proj4js.common.HALF_PI){var sin_phi=
Math.sin(phi);var cos_phi=Math.cos(phi);var tan_phi=Math.tan(phi);var c=this.ep2*Math.pow(cos_phi,2);var cs=Math.pow(c,2);var t=Math.pow(tan_phi,2);var ts=Math.pow(t,2);con=1-this.es*Math.pow(sin_phi,2);var n=this.a/Math.sqrt(con);var r=n*(1-this.es)/con;var d=x/(n*this.k0);var ds=Math.pow(d,2);lat=phi-n*tan_phi*ds/r*(0.5-ds/24*(5+3*t+10*c-4*cs-9*this.ep2-ds/30*(61+90*t+298*c+45*ts-252*this.ep2-3*cs)));lon=Proj4js.common.adjust_lon(this.long0+d*(1-ds/6*(1+2*t+c-ds/20*(5-2*c+28*t-3*cs+8*this.ep2+24*
ts)))/cos_phi)}else{lat=Proj4js.common.HALF_PI*Proj4js.common.sign(y);lon=this.long0}}p.x=lon;p.y=lat;return p}};Proj4js.defs["GOOGLE"]="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs";Proj4js.defs["EPSG:900913"]=Proj4js.defs["GOOGLE"];
Proj4js.Proj.gstmerc={init:function(){var temp=this.b/this.a;this.e=Math.sqrt(1-temp*temp);this.lc=this.long0;this.rs=Math.sqrt(1+this.e*this.e*Math.pow(Math.cos(this.lat0),4)/(1-this.e*this.e));var sinz=Math.sin(this.lat0);var pc=Math.asin(sinz/this.rs);var sinzpc=Math.sin(pc);this.cp=Proj4js.common.latiso(0,pc,sinzpc)-this.rs*Proj4js.common.latiso(this.e,this.lat0,sinz);this.n2=this.k0*this.a*Math.sqrt(1-this.e*this.e)/(1-this.e*this.e*sinz*sinz);this.xs=this.x0;this.ys=this.y0-this.n2*pc;if(!this.title)this.title=
"Gauss Schreiber transverse mercator"},forward:function(p){var lon=p.x;var lat=p.y;var L=this.rs*(lon-this.lc);var Ls=this.cp+this.rs*Proj4js.common.latiso(this.e,lat,Math.sin(lat));var lat1=Math.asin(Math.sin(L)/Proj4js.common.cosh(Ls));var Ls1=Proj4js.common.latiso(0,lat1,Math.sin(lat1));p.x=this.xs+this.n2*Ls1;p.y=this.ys+this.n2*Math.atan(Proj4js.common.sinh(Ls)/Math.cos(L));return p},inverse:function(p){var x=p.x;var y=p.y;var L=Math.atan(Proj4js.common.sinh((x-this.xs)/this.n2)/Math.cos((y-
this.ys)/this.n2));var lat1=Math.asin(Math.sin((y-this.ys)/this.n2)/Proj4js.common.cosh((x-this.xs)/this.n2));var LC=Proj4js.common.latiso(0,lat1,Math.sin(lat1));p.x=this.lc+L/this.rs;p.y=Proj4js.common.invlatiso(this.e,(LC-this.cp)/this.rs);return p}};
Proj4js.Proj.ortho={init:function(def){this.sin_p14=Math.sin(this.lat0);this.cos_p14=Math.cos(this.lat0)},forward:function(p){var sinphi,cosphi;var dlon;var coslon;var ksp;var g;var lon=p.x;var lat=p.y;dlon=Proj4js.common.adjust_lon(lon-this.long0);sinphi=Math.sin(lat);cosphi=Math.cos(lat);coslon=Math.cos(dlon);g=this.sin_p14*sinphi+this.cos_p14*cosphi*coslon;ksp=1;if(g>0||Math.abs(g)<=Proj4js.common.EPSLN){var x=this.a*ksp*cosphi*Math.sin(dlon);var y=this.y0+this.a*ksp*(this.cos_p14*sinphi-this.sin_p14*
cosphi*coslon)}else Proj4js.reportError("orthoFwdPointError");p.x=x;p.y=y;return p},inverse:function(p){var rh;var z;var sinz,cosz;var temp;var con;var lon,lat;p.x-=this.x0;p.y-=this.y0;rh=Math.sqrt(p.x*p.x+p.y*p.y);if(rh>this.a+1.0E-7)Proj4js.reportError("orthoInvDataError");z=Proj4js.common.asinz(rh/this.a);sinz=Math.sin(z);cosz=Math.cos(z);lon=this.long0;if(Math.abs(rh)<=Proj4js.common.EPSLN)lat=this.lat0;lat=Proj4js.common.asinz(cosz*this.sin_p14+p.y*sinz*this.cos_p14/rh);con=Math.abs(this.lat0)-
Proj4js.common.HALF_PI;if(Math.abs(con)<=Proj4js.common.EPSLN)if(this.lat0>=0)lon=Proj4js.common.adjust_lon(this.long0+Math.atan2(p.x,-p.y));else lon=Proj4js.common.adjust_lon(this.long0-Math.atan2(-p.x,p.y));con=cosz-this.sin_p14*Math.sin(lat);p.x=lon;p.y=lat;return p}};
Proj4js.Proj.somerc={init:function(){var phy0=this.lat0;this.lambda0=this.long0;var sinPhy0=Math.sin(phy0);var semiMajorAxis=this.a;var invF=this.rf;var flattening=1/invF;var e2=2*flattening-Math.pow(flattening,2);var e=this.e=Math.sqrt(e2);this.R=this.k0*semiMajorAxis*Math.sqrt(1-e2)/(1-e2*Math.pow(sinPhy0,2));this.alpha=Math.sqrt(1+e2/(1-e2)*Math.pow(Math.cos(phy0),4));this.b0=Math.asin(sinPhy0/this.alpha);this.K=Math.log(Math.tan(Math.PI/4+this.b0/2))-this.alpha*Math.log(Math.tan(Math.PI/4+phy0/
2))+this.alpha*e/2*Math.log((1+e*sinPhy0)/(1-e*sinPhy0))},forward:function(p){var Sa1=Math.log(Math.tan(Math.PI/4-p.y/2));var Sa2=this.e/2*Math.log((1+this.e*Math.sin(p.y))/(1-this.e*Math.sin(p.y)));var S=-this.alpha*(Sa1+Sa2)+this.K;var b=2*(Math.atan(Math.exp(S))-Math.PI/4);var I=this.alpha*(p.x-this.lambda0);var rotI=Math.atan(Math.sin(I)/(Math.sin(this.b0)*Math.tan(b)+Math.cos(this.b0)*Math.cos(I)));var rotB=Math.asin(Math.cos(this.b0)*Math.sin(b)-Math.sin(this.b0)*Math.cos(b)*Math.cos(I));p.y=
this.R/2*Math.log((1+Math.sin(rotB))/(1-Math.sin(rotB)))+this.y0;p.x=this.R*rotI+this.x0;return p},inverse:function(p){var Y=p.x-this.x0;var X=p.y-this.y0;var rotI=Y/this.R;var rotB=2*(Math.atan(Math.exp(X/this.R))-Math.PI/4);var b=Math.asin(Math.cos(this.b0)*Math.sin(rotB)+Math.sin(this.b0)*Math.cos(rotB)*Math.cos(rotI));var I=Math.atan(Math.sin(rotI)/(Math.cos(this.b0)*Math.cos(rotI)-Math.sin(this.b0)*Math.tan(rotB)));var lambda=this.lambda0+I/this.alpha;var S=0;var phy=b;var prevPhy=-1E3;var iteration=
0;while(Math.abs(phy-prevPhy)>1.0E-7){if(++iteration>20){Proj4js.reportError("omercFwdInfinity");return}S=1/this.alpha*(Math.log(Math.tan(Math.PI/4+b/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(phy))/2));prevPhy=phy;phy=2*Math.atan(Math.exp(S))-Math.PI/2}p.x=lambda;p.y=phy;return p}};
Proj4js.Proj.stere={ssfn_:function(phit,sinphi,eccen){sinphi*=eccen;return Math.tan(0.5*(Proj4js.common.HALF_PI+phit))*Math.pow((1-sinphi)/(1+sinphi),0.5*eccen)},TOL:1.0E-8,NITER:8,CONV:1.0E-10,S_POLE:0,N_POLE:1,OBLIQ:2,EQUIT:3,init:function(){this.phits=this.lat_ts?this.lat_ts:Proj4js.common.HALF_PI;var t=Math.abs(this.lat0);if(Math.abs(t)-Proj4js.common.HALF_PI<Proj4js.common.EPSLN)this.mode=this.lat0<0?this.S_POLE:this.N_POLE;else this.mode=t>Proj4js.common.EPSLN?this.OBLIQ:this.EQUIT;this.phits=
Math.abs(this.phits);if(this.es){var X;switch(this.mode){case this.N_POLE:case this.S_POLE:if(Math.abs(this.phits-Proj4js.common.HALF_PI)<Proj4js.common.EPSLN)this.akm1=2*this.k0/Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e));else{t=Math.sin(this.phits);this.akm1=Math.cos(this.phits)/Proj4js.common.tsfnz(this.e,this.phits,t);t*=this.e;this.akm1/=Math.sqrt(1-t*t)}break;case this.EQUIT:this.akm1=2*this.k0;break;case this.OBLIQ:t=Math.sin(this.lat0);X=2*Math.atan(this.ssfn_(this.lat0,
t,this.e))-Proj4js.common.HALF_PI;t*=this.e;this.akm1=2*this.k0*Math.cos(this.lat0)/Math.sqrt(1-t*t);this.sinX1=Math.sin(X);this.cosX1=Math.cos(X);break}}else switch(this.mode){case this.OBLIQ:this.sinph0=Math.sin(this.lat0);this.cosph0=Math.cos(this.lat0);case this.EQUIT:this.akm1=2*this.k0;break;case this.S_POLE:case this.N_POLE:this.akm1=Math.abs(this.phits-Proj4js.common.HALF_PI)>=Proj4js.common.EPSLN?Math.cos(this.phits)/Math.tan(Proj4js.common.FORTPI-0.5*this.phits):2*this.k0;break}},forward:function(p){var lon=
p.x;lon=Proj4js.common.adjust_lon(lon-this.long0);var lat=p.y;var x,y;if(this.sphere){var sinphi,cosphi,coslam,sinlam;sinphi=Math.sin(lat);cosphi=Math.cos(lat);coslam=Math.cos(lon);sinlam=Math.sin(lon);switch(this.mode){case this.EQUIT:y=1+cosphi*coslam;if(y<=Proj4js.common.EPSLN)F_ERROR;y=this.akm1/y;x=y*cosphi*sinlam;y*=sinphi;break;case this.OBLIQ:y=1+this.sinph0*sinphi+this.cosph0*cosphi*coslam;if(y<=Proj4js.common.EPSLN)F_ERROR;y=this.akm1/y;x=y*cosphi*sinlam;y*=this.cosph0*sinphi-this.sinph0*
cosphi*coslam;break;case this.N_POLE:coslam=-coslam;lat=-lat;case this.S_POLE:if(Math.abs(lat-Proj4js.common.HALF_PI)<this.TOL)F_ERROR;y=this.akm1*Math.tan(Proj4js.common.FORTPI+0.5*lat);x=sinlam*y;y*=coslam;break}}else{coslam=Math.cos(lon);sinlam=Math.sin(lon);sinphi=Math.sin(lat);if(this.mode==this.OBLIQ||this.mode==this.EQUIT){X=2*Math.atan(this.ssfn_(lat,sinphi,this.e));sinX=Math.sin(X-Proj4js.common.HALF_PI);cosX=Math.cos(X)}switch(this.mode){case this.OBLIQ:A=this.akm1/(this.cosX1*(1+this.sinX1*
sinX+this.cosX1*cosX*coslam));y=A*(this.cosX1*sinX-this.sinX1*cosX*coslam);x=A*cosX;break;case this.EQUIT:A=2*this.akm1/(1+cosX*coslam);y=A*sinX;x=A*cosX;break;case this.S_POLE:lat=-lat;coslam=-coslam;sinphi=-sinphi;case this.N_POLE:x=this.akm1*Proj4js.common.tsfnz(this.e,lat,sinphi);y=-x*coslam;break}x=x*sinlam}p.x=x*this.a+this.x0;p.y=y*this.a+this.y0;return p},inverse:function(p){var x=(p.x-this.x0)/this.a;var y=(p.y-this.y0)/this.a;var lon,lat;var cosphi,sinphi,tp=0,phi_l=0,rho,halfe=0,pi2=0;
var i;if(this.sphere){var c,rh,sinc,cosc;rh=Math.sqrt(x*x+y*y);c=2*Math.atan(rh/this.akm1);sinc=Math.sin(c);cosc=Math.cos(c);lon=0;switch(this.mode){case this.EQUIT:if(Math.abs(rh)<=Proj4js.common.EPSLN)lat=0;else lat=Math.asin(y*sinc/rh);if(cosc!=0||x!=0)lon=Math.atan2(x*sinc,cosc*rh);break;case this.OBLIQ:if(Math.abs(rh)<=Proj4js.common.EPSLN)lat=this.phi0;else lat=Math.asin(cosc*sinph0+y*sinc*cosph0/rh);c=cosc-sinph0*Math.sin(lat);if(c!=0||x!=0)lon=Math.atan2(x*sinc*cosph0,c*rh);break;case this.N_POLE:y=
-y;case this.S_POLE:if(Math.abs(rh)<=Proj4js.common.EPSLN)lat=this.phi0;else lat=Math.asin(this.mode==this.S_POLE?-cosc:cosc);lon=x==0&&y==0?0:Math.atan2(x,y);break}p.x=Proj4js.common.adjust_lon(lon+this.long0);p.y=lat}else{rho=Math.sqrt(x*x+y*y);switch(this.mode){case this.OBLIQ:case this.EQUIT:tp=2*Math.atan2(rho*this.cosX1,this.akm1);cosphi=Math.cos(tp);sinphi=Math.sin(tp);if(rho==0)phi_l=Math.asin(cosphi*this.sinX1);else phi_l=Math.asin(cosphi*this.sinX1+y*sinphi*this.cosX1/rho);tp=Math.tan(0.5*
(Proj4js.common.HALF_PI+phi_l));x*=sinphi;y=rho*this.cosX1*cosphi-y*this.sinX1*sinphi;pi2=Proj4js.common.HALF_PI;halfe=0.5*this.e;break;case this.N_POLE:y=-y;case this.S_POLE:tp=-rho/this.akm1;phi_l=Proj4js.common.HALF_PI-2*Math.atan(tp);pi2=-Proj4js.common.HALF_PI;halfe=-0.5*this.e;break}for(i=this.NITER;i--;phi_l=lat){sinphi=this.e*Math.sin(phi_l);lat=2*Math.atan(tp*Math.pow((1+sinphi)/(1-sinphi),halfe))-pi2;if(Math.abs(phi_l-lat)<this.CONV){if(this.mode==this.S_POLE)lat=-lat;lon=x==0&&y==0?0:Math.atan2(x,
y);p.x=Proj4js.common.adjust_lon(lon+this.long0);p.y=lat;return p}}}}};
Proj4js.Proj.nzmg={iterations:1,init:function(){this.A=new Array;this.A[1]=+0.6399175073;this.A[2]=-0.1358797613;this.A[3]=+0.063294409;this.A[4]=-0.02526853;this.A[5]=+0.0117879;this.A[6]=-0.0055161;this.A[7]=+0.0026906;this.A[8]=-0.001333;this.A[9]=+6.7E-4;this.A[10]=-3.4E-4;this.B_re=new Array;this.B_im=new Array;this.B_re[1]=+0.7557853228;this.B_im[1]=0;this.B_re[2]=+0.249204646;this.B_im[2]=+0.003371507;this.B_re[3]=-0.001541739;this.B_im[3]=+0.04105856;this.B_re[4]=-0.10162907;this.B_im[4]=
+0.01727609;this.B_re[5]=-0.26623489;this.B_im[5]=-0.36249218;this.B_re[6]=-0.6870983;this.B_im[6]=-1.1651967;this.C_re=new Array;this.C_im=new Array;this.C_re[1]=+1.3231270439;this.C_im[1]=0;this.C_re[2]=-0.577245789;this.C_im[2]=-0.007809598;this.C_re[3]=+0.508307513;this.C_im[3]=-0.112208952;this.C_re[4]=-0.15094762;this.C_im[4]=+0.18200602;this.C_re[5]=+1.01418179;this.C_im[5]=+1.64497696;this.C_re[6]=+1.9660549;this.C_im[6]=+2.5127645;this.D=new Array;this.D[1]=+1.5627014243;this.D[2]=+0.5185406398;
this.D[3]=-0.03333098;this.D[4]=-0.1052906;this.D[5]=-0.0368594;this.D[6]=+0.007317;this.D[7]=+0.0122;this.D[8]=+0.00394;this.D[9]=-0.0013},forward:function(p){var lon=p.x;var lat=p.y;var delta_lat=lat-this.lat0;var delta_lon=lon-this.long0;var d_phi=delta_lat/Proj4js.common.SEC_TO_RAD*1.0E-5;var d_lambda=delta_lon;var d_phi_n=1;var d_psi=0;for(n=1;n<=10;n++){d_phi_n=d_phi_n*d_phi;d_psi=d_psi+this.A[n]*d_phi_n}var th_re=d_psi;var th_im=d_lambda;var th_n_re=1;var th_n_im=0;var th_n_re1;var th_n_im1;
var z_re=0;var z_im=0;for(n=1;n<=6;n++){th_n_re1=th_n_re*th_re-th_n_im*th_im;th_n_im1=th_n_im*th_re+th_n_re*th_im;th_n_re=th_n_re1;th_n_im=th_n_im1;z_re=z_re+this.B_re[n]*th_n_re-this.B_im[n]*th_n_im;z_im=z_im+this.B_im[n]*th_n_re+this.B_re[n]*th_n_im}x=z_im*this.a+this.x0;y=z_re*this.a+this.y0;p.x=x;p.y=y;return p},inverse:function(p){var x=p.x;var y=p.y;var delta_x=x-this.x0;var delta_y=y-this.y0;var z_re=delta_y/this.a;var z_im=delta_x/this.a;var z_n_re=1;var z_n_im=0;var z_n_re1;var z_n_im1;var th_re=
0;var th_im=0;for(n=1;n<=6;n++){z_n_re1=z_n_re*z_re-z_n_im*z_im;z_n_im1=z_n_im*z_re+z_n_re*z_im;z_n_re=z_n_re1;z_n_im=z_n_im1;th_re=th_re+this.C_re[n]*z_n_re-this.C_im[n]*z_n_im;th_im=th_im+this.C_im[n]*z_n_re+this.C_re[n]*z_n_im}for(i=0;i<this.iterations;i++){var th_n_re=th_re;var th_n_im=th_im;var th_n_re1;var th_n_im1;var num_re=z_re;var num_im=z_im;for(n=2;n<=6;n++){th_n_re1=th_n_re*th_re-th_n_im*th_im;th_n_im1=th_n_im*th_re+th_n_re*th_im;th_n_re=th_n_re1;th_n_im=th_n_im1;num_re=num_re+(n-1)*
(this.B_re[n]*th_n_re-this.B_im[n]*th_n_im);num_im=num_im+(n-1)*(this.B_im[n]*th_n_re+this.B_re[n]*th_n_im)}th_n_re=1;th_n_im=0;var den_re=this.B_re[1];var den_im=this.B_im[1];for(n=2;n<=6;n++){th_n_re1=th_n_re*th_re-th_n_im*th_im;th_n_im1=th_n_im*th_re+th_n_re*th_im;th_n_re=th_n_re1;th_n_im=th_n_im1;den_re=den_re+n*(this.B_re[n]*th_n_re-this.B_im[n]*th_n_im);den_im=den_im+n*(this.B_im[n]*th_n_re+this.B_re[n]*th_n_im)}var den2=den_re*den_re+den_im*den_im;th_re=(num_re*den_re+num_im*den_im)/den2;th_im=
(num_im*den_re-num_re*den_im)/den2}var d_psi=th_re;var d_lambda=th_im;var d_psi_n=1;var d_phi=0;for(n=1;n<=9;n++){d_psi_n=d_psi_n*d_psi;d_phi=d_phi+this.D[n]*d_psi_n}var lat=this.lat0+d_phi*Proj4js.common.SEC_TO_RAD*1E5;var lon=this.long0+d_lambda;p.x=lon;p.y=lat;return p}};
Proj4js.Proj.mill={init:function(){},forward:function(p){var lon=p.x;var lat=p.y;var dlon=Proj4js.common.adjust_lon(lon-this.long0);var x=this.x0+this.a*dlon;var y=this.y0+this.a*Math.log(Math.tan(Proj4js.common.PI/4+lat/2.5))*1.25;p.x=x;p.y=y;return p},inverse:function(p){p.x-=this.x0;p.y-=this.y0;var lon=Proj4js.common.adjust_lon(this.long0+p.x/this.a);var lat=2.5*(Math.atan(Math.exp(0.8*p.y/this.a))-Proj4js.common.PI/4);p.x=lon;p.y=lat;return p}};
Proj4js.Proj.gnom={init:function(def){this.sin_p14=Math.sin(this.lat0);this.cos_p14=Math.cos(this.lat0);this.infinity_dist=1E3*this.a;this.rc=1},forward:function(p){var sinphi,cosphi;var dlon;var coslon;var ksp;var g;var lon=p.x;var lat=p.y;dlon=Proj4js.common.adjust_lon(lon-this.long0);sinphi=Math.sin(lat);cosphi=Math.cos(lat);coslon=Math.cos(dlon);g=this.sin_p14*sinphi+this.cos_p14*cosphi*coslon;ksp=1;if(g>0||Math.abs(g)<=Proj4js.common.EPSLN){x=this.x0+this.a*ksp*cosphi*Math.sin(dlon)/g;y=this.y0+
this.a*ksp*(this.cos_p14*sinphi-this.sin_p14*cosphi*coslon)/g}else{Proj4js.reportError("orthoFwdPointError");x=this.x0+this.infinity_dist*cosphi*Math.sin(dlon);y=this.y0+this.infinity_dist*(this.cos_p14*sinphi-this.sin_p14*cosphi*coslon)}p.x=x;p.y=y;return p},inverse:function(p){var rh;var z;var sinc,cosc;var c;var lon,lat;p.x=(p.x-this.x0)/this.a;p.y=(p.y-this.y0)/this.a;p.x/=this.k0;p.y/=this.k0;if(rh=Math.sqrt(p.x*p.x+p.y*p.y)){c=Math.atan2(rh,this.rc);sinc=Math.sin(c);cosc=Math.cos(c);lat=Proj4js.common.asinz(cosc*
this.sin_p14+p.y*sinc*this.cos_p14/rh);lon=Math.atan2(p.x*sinc,rh*this.cos_p14*cosc-p.y*this.sin_p14*sinc);lon=Proj4js.common.adjust_lon(this.long0+lon)}else{lat=this.phic0;lon=0}p.x=lon;p.y=lat;return p}};
Proj4js.Proj.sinu={init:function(){this.R=6370997},forward:function(p){var x,y,delta_lon;var lon=p.x;var lat=p.y;delta_lon=Proj4js.common.adjust_lon(lon-this.long0);x=this.R*delta_lon*Math.cos(lat)+this.x0;y=this.R*lat+this.y0;p.x=x;p.y=y;return p},inverse:function(p){var lat,temp,lon;p.x-=this.x0;p.y-=this.y0;lat=p.y/this.R;if(Math.abs(lat)>Proj4js.common.HALF_PI)Proj4js.reportError("sinu:Inv:DataError");temp=Math.abs(lat)-Proj4js.common.HALF_PI;if(Math.abs(temp)>Proj4js.common.EPSLN){temp=this.long0+
p.x/(this.R*Math.cos(lat));lon=Proj4js.common.adjust_lon(temp)}else lon=this.long0;p.x=lon;p.y=lat;return p}};
Proj4js.Proj.vandg={init:function(){this.R=6370997},forward:function(p){var lon=p.x;var lat=p.y;var dlon=Proj4js.common.adjust_lon(lon-this.long0);var x,y;if(Math.abs(lat)<=Proj4js.common.EPSLN){x=this.x0+this.R*dlon;y=this.y0}var theta=Proj4js.common.asinz(2*Math.abs(lat/Proj4js.common.PI));if(Math.abs(dlon)<=Proj4js.common.EPSLN||Math.abs(Math.abs(lat)-Proj4js.common.HALF_PI)<=Proj4js.common.EPSLN){x=this.x0;if(lat>=0)y=this.y0+Proj4js.common.PI*this.R*Math.tan(0.5*theta);else y=this.y0+Proj4js.common.PI*
this.R*-Math.tan(0.5*theta)}var al=0.5*Math.abs(Proj4js.common.PI/dlon-dlon/Proj4js.common.PI);var asq=al*al;var sinth=Math.sin(theta);var costh=Math.cos(theta);var g=costh/(sinth+costh-1);var gsq=g*g;var m=g*(2/sinth-1);var msq=m*m;var con=Proj4js.common.PI*this.R*(al*(g-msq)+Math.sqrt(asq*(g-msq)*(g-msq)-(msq+asq)*(gsq-msq)))/(msq+asq);if(dlon<0)con=-con;x=this.x0+con;con=Math.abs(con/(Proj4js.common.PI*this.R));if(lat>=0)y=this.y0+Proj4js.common.PI*this.R*Math.sqrt(1-con*con-2*al*con);else y=this.y0-
Proj4js.common.PI*this.R*Math.sqrt(1-con*con-2*al*con);p.x=x;p.y=y;return p},inverse:function(p){var dlon;var xx,yy,xys,c1,c2,c3;var al,asq;var a1;var m1;var con;var th1;var d;p.x-=this.x0;p.y-=this.y0;con=Proj4js.common.PI*this.R;xx=p.x/con;yy=p.y/con;xys=xx*xx+yy*yy;c1=-Math.abs(yy)*(1+xys);c2=c1-2*yy*yy+xx*xx;c3=-2*c1+1+2*yy*yy+xys*xys;d=yy*yy/c3+(2*c2*c2*c2/c3/c3/c3-9*c1*c2/c3/c3)/27;a1=(c1-c2*c2/3/c3)/c3;m1=2*Math.sqrt(-a1/3);con=3*d/a1/m1;if(Math.abs(con)>1)if(con>=0)con=1;else con=-1;th1=Math.acos(con)/
3;if(p.y>=0)lat=(-m1*Math.cos(th1+Proj4js.common.PI/3)-c2/3/c3)*Proj4js.common.PI;else lat=-(-m1*Math.cos(th1+Proj4js.common.PI/3)-c2/3/c3)*Proj4js.common.PI;if(Math.abs(xx)<Proj4js.common.EPSLN)lon=this.long0;lon=Proj4js.common.adjust_lon(this.long0+Proj4js.common.PI*(xys-1+Math.sqrt(1+2*(xx*xx-yy*yy)+xys*xys))/2/xx);p.x=lon;p.y=lat;return p}};
Proj4js.Proj.cea={init:function(){},forward:function(p){var lon=p.x;var lat=p.y;dlon=Proj4js.common.adjust_lon(lon-this.long0);var x=this.x0+this.a*dlon*Math.cos(this.lat_ts);var y=this.y0+this.a*Math.sin(lat)/Math.cos(this.lat_ts);p.x=x;p.y=y;return p},inverse:function(p){p.x-=this.x0;p.y-=this.y0;var lon=Proj4js.common.adjust_lon(this.long0+p.x/this.a/Math.cos(this.lat_ts));var lat=Math.asin(p.y/this.a*Math.cos(this.lat_ts));p.x=lon;p.y=lat;return p}};
Proj4js.Proj.eqc={init:function(){if(!this.x0)this.x0=0;if(!this.y0)this.y0=0;if(!this.lat0)this.lat0=0;if(!this.long0)this.long0=0;if(!this.lat_ts)this.lat_ts=0;if(!this.title)this.title="Equidistant Cylindrical (Plate Carre)";this.rc=Math.cos(this.lat_ts)},forward:function(p){var lon=p.x;var lat=p.y;var dlon=Proj4js.common.adjust_lon(lon-this.long0);var dlat=Proj4js.common.adjust_lat(lat-this.lat0);p.x=this.x0+this.a*dlon*this.rc;p.y=this.y0+this.a*dlat;return p},inverse:function(p){var x=p.x;var y=
p.y;p.x=Proj4js.common.adjust_lon(this.long0+(x-this.x0)/(this.a*this.rc));p.y=Proj4js.common.adjust_lat(this.lat0+(y-this.y0)/this.a);return p}};
Proj4js.Proj.cass={init:function(){if(!this.sphere){this.en=this.pj_enfn(this.es);this.m0=this.pj_mlfn(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en)}},C1:0.16666666666666666,C2:0.008333333333333333,C3:0.041666666666666664,C4:0.3333333333333333,C5:0.06666666666666667,forward:function(p){var x,y;var lam=p.x;var phi=p.y;lam=Proj4js.common.adjust_lon(lam-this.long0);if(this.sphere){x=Math.asin(Math.cos(phi)*Math.sin(lam));y=Math.atan2(Math.tan(phi),Math.cos(lam))-this.phi0}else{this.n=Math.sin(phi);
this.c=Math.cos(phi);y=this.pj_mlfn(phi,this.n,this.c,this.en);this.n=1/Math.sqrt(1-this.es*this.n*this.n);this.tn=Math.tan(phi);this.t=this.tn*this.tn;this.a1=lam*this.c;this.c*=this.es*this.c/(1-this.es);this.a2=this.a1*this.a1;x=this.n*this.a1*(1-this.a2*this.t*(this.C1-(8-this.t+8*this.c)*this.a2*this.C2));y-=this.m0-this.n*this.tn*this.a2*(0.5+(5-this.t+6*this.c)*this.a2*this.C3)}p.x=this.a*x+this.x0;p.y=this.a*y+this.y0;return p},inverse:function(p){p.x-=this.x0;p.y-=this.y0;var x=p.x/this.a;
var y=p.y/this.a;if(this.sphere){this.dd=y+this.lat0;phi=Math.asin(Math.sin(this.dd)*Math.cos(x));lam=Math.atan2(Math.tan(x),Math.cos(this.dd))}else{ph1=this.pj_inv_mlfn(this.m0+y,this.es,this.en);this.tn=Math.tan(ph1);this.t=this.tn*this.tn;this.n=Math.sin(ph1);this.r=1/(1-this.es*this.n*this.n);this.n=Math.sqrt(this.r);this.r*=(1-this.es)*this.n;this.dd=x/this.n;this.d2=this.dd*this.dd;phi=ph1-this.n*this.tn/this.r*this.d2*(0.5-(1+3*this.t)*this.d2*this.C3);lam=this.dd*(1+this.t*this.d2*(-this.C4+
(1+3*this.t)*this.d2*this.C5))/Math.cos(ph1)}p.x=Proj4js.common.adjust_lon(this.long0+lam);p.y=phi;return p},pj_enfn:function(es){en=new Array;en[0]=this.C00-es*(this.C02+es*(this.C04+es*(this.C06+es*this.C08)));en[1]=es*(this.C22-es*(this.C04+es*(this.C06+es*this.C08)));var t=es*es;en[2]=t*(this.C44-es*(this.C46+es*this.C48));t*=es;en[3]=t*(this.C66-es*this.C68);en[4]=t*es*this.C88;return en},pj_mlfn:function(phi,sphi,cphi,en){cphi*=sphi;sphi*=sphi;return en[0]*phi-cphi*(en[1]+sphi*(en[2]+sphi*(en[3]+
sphi*en[4])))},pj_inv_mlfn:function(arg,es,en){k=1/(1-es);phi=arg;for(i=Proj4js.common.MAX_ITER;i;--i){s=Math.sin(phi);t=1-es*s*s;t=(this.pj_mlfn(phi,s,Math.cos(phi),en)-arg)*t*Math.sqrt(t)*k;phi-=t;if(Math.abs(t)<Proj4js.common.EPSLN)return phi}Proj4js.reportError("cass:pj_inv_mlfn: Convergence error");return phi},C00:1,C02:0.25,C04:0.046875,C06:0.01953125,C08:0.01068115234375,C22:0.75,C44:0.46875,C46:0.013020833333333334,C48:0.007120768229166667,C66:0.3645833333333333,C68:0.005696614583333333,C88:0.3076171875};
Proj4js.Proj.gauss={init:function(){sphi=Math.sin(this.lat0);cphi=Math.cos(this.lat0);cphi*=cphi;this.rc=Math.sqrt(1-this.es)/(1-this.es*sphi*sphi);this.C=Math.sqrt(1+this.es*cphi*cphi/(1-this.es));this.phic0=Math.asin(sphi/this.C);this.ratexp=0.5*this.C*this.e;this.K=Math.tan(0.5*this.phic0+Proj4js.common.FORTPI)/(Math.pow(Math.tan(0.5*this.lat0+Proj4js.common.FORTPI),this.C)*Proj4js.common.srat(this.e*sphi,this.ratexp))},forward:function(p){var lon=p.x;var lat=p.y;p.y=2*Math.atan(this.K*Math.pow(Math.tan(0.5*
lat+Proj4js.common.FORTPI),this.C)*Proj4js.common.srat(this.e*Math.sin(lat),this.ratexp))-Proj4js.common.HALF_PI;p.x=this.C*lon;return p},inverse:function(p){var DEL_TOL=1.0E-14;var lon=p.x/this.C;var lat=p.y;num=Math.pow(Math.tan(0.5*lat+Proj4js.common.FORTPI)/this.K,1/this.C);for(var i=Proj4js.common.MAX_ITER;i>0;--i){lat=2*Math.atan(num*Proj4js.common.srat(this.e*Math.sin(p.y),-0.5*this.e))-Proj4js.common.HALF_PI;if(Math.abs(lat-p.y)<DEL_TOL)break;p.y=lat}if(!i){Proj4js.reportError("gauss:inverse:convergence failed");
return null}p.x=lon;p.y=lat;return p}};
Proj4js.Proj.omerc={init:function(){if(!this.mode)this.mode=0;if(!this.lon1){this.lon1=0;this.mode=1}if(!this.lon2)this.lon2=0;if(!this.lat2)this.lat2=0;var temp=this.b/this.a;var es=1-Math.pow(temp,2);var e=Math.sqrt(es);this.sin_p20=Math.sin(this.lat0);this.cos_p20=Math.cos(this.lat0);this.con=1-this.es*this.sin_p20*this.sin_p20;this.com=Math.sqrt(1-es);this.bl=Math.sqrt(1+this.es*Math.pow(this.cos_p20,4)/(1-es));this.al=this.a*this.bl*this.k0*this.com/this.con;if(Math.abs(this.lat0)<Proj4js.common.EPSLN){this.ts=
1;this.d=1;this.el=1}else{this.ts=Proj4js.common.tsfnz(this.e,this.lat0,this.sin_p20);this.con=Math.sqrt(this.con);this.d=this.bl*this.com/(this.cos_p20*this.con);if(this.d*this.d-1>0)if(this.lat0>=0)this.f=this.d+Math.sqrt(this.d*this.d-1);else this.f=this.d-Math.sqrt(this.d*this.d-1);else this.f=this.d;this.el=this.f*Math.pow(this.ts,this.bl)}if(this.mode!=0){this.g=0.5*(this.f-1/this.f);this.gama=Proj4js.common.asinz(Math.sin(this.alpha)/this.d);this.longc=this.longc-Proj4js.common.asinz(this.g*
Math.tan(this.gama))/this.bl;this.con=Math.abs(this.lat0);if(this.con>Proj4js.common.EPSLN&&Math.abs(this.con-Proj4js.common.HALF_PI)>Proj4js.common.EPSLN){this.singam=Math.sin(this.gama);this.cosgam=Math.cos(this.gama);this.sinaz=Math.sin(this.alpha);this.cosaz=Math.cos(this.alpha);if(this.lat0>=0)this.u=this.al/this.bl*Math.atan(Math.sqrt(this.d*this.d-1)/this.cosaz);else this.u=-(this.al/this.bl)*Math.atan(Math.sqrt(this.d*this.d-1)/this.cosaz)}else Proj4js.reportError("omerc:Init:DataError")}else{this.sinphi=
Math.sin(this.at1);this.ts1=Proj4js.common.tsfnz(this.e,this.lat1,this.sinphi);this.sinphi=Math.sin(this.lat2);this.ts2=Proj4js.common.tsfnz(this.e,this.lat2,this.sinphi);this.h=Math.pow(this.ts1,this.bl);this.l=Math.pow(this.ts2,this.bl);this.f=this.el/this.h;this.g=0.5*(this.f-1/this.f);this.j=(this.el*this.el-this.l*this.h)/(this.el*this.el+this.l*this.h);this.p=(this.l-this.h)/(this.l+this.h);this.dlon=this.lon1-this.lon2;if(this.dlon<-Proj4js.common.PI)this.lon2=this.lon2-2*Proj4js.common.PI;
if(this.dlon>Proj4js.common.PI)this.lon2=this.lon2+2*Proj4js.common.PI;this.dlon=this.lon1-this.lon2;this.longc=0.5*(this.lon1+this.lon2)-Math.atan(this.j*Math.tan(0.5*this.bl*this.dlon)/this.p)/this.bl;this.dlon=Proj4js.common.adjust_lon(this.lon1-this.longc);this.gama=Math.atan(Math.sin(this.bl*this.dlon)/this.g);this.alpha=Proj4js.common.asinz(this.d*Math.sin(this.gama));if(Math.abs(this.lat1-this.lat2)<=Proj4js.common.EPSLN)Proj4js.reportError("omercInitDataError");else this.con=Math.abs(this.lat1);
if(this.con<=Proj4js.common.EPSLN||Math.abs(this.con-HALF_PI)<=Proj4js.common.EPSLN)Proj4js.reportError("omercInitDataError");else if(Math.abs(Math.abs(this.lat0)-Proj4js.common.HALF_PI)<=Proj4js.common.EPSLN)Proj4js.reportError("omercInitDataError");this.singam=Math.sin(this.gam);this.cosgam=Math.cos(this.gam);this.sinaz=Math.sin(this.alpha);this.cosaz=Math.cos(this.alpha);if(this.lat0>=0)this.u=this.al/this.bl*Math.atan(Math.sqrt(this.d*this.d-1)/this.cosaz);else this.u=-(this.al/this.bl)*Math.atan(Math.sqrt(this.d*
this.d-1)/this.cosaz)}},forward:function(p){var theta;var sin_phi,cos_phi;var b;var c,t,tq;var con,n,ml;var q,us,vl;var ul,vs;var s;var dlon;var ts1;var lon=p.x;var lat=p.y;sin_phi=Math.sin(lat);dlon=Proj4js.common.adjust_lon(lon-this.longc);vl=Math.sin(this.bl*dlon);if(Math.abs(Math.abs(lat)-Proj4js.common.HALF_PI)>Proj4js.common.EPSLN){ts1=Proj4js.common.tsfnz(this.e,lat,sin_phi);q=this.el/Math.pow(ts1,this.bl);s=0.5*(q-1/q);t=0.5*(q+1/q);ul=(s*this.singam-vl*this.cosgam)/t;con=Math.cos(this.bl*
dlon);if(Math.abs(con)<1.0E-7)us=this.al*this.bl*dlon;else{us=this.al*Math.atan((s*this.cosgam+vl*this.singam)/con)/this.bl;if(con<0)us=us+Proj4js.common.PI*this.al/this.bl}}else{if(lat>=0)ul=this.singam;else ul=-this.singam;us=this.al*lat/this.bl}if(Math.abs(Math.abs(ul)-1)<=Proj4js.common.EPSLN)Proj4js.reportError("omercFwdInfinity");vs=0.5*this.al*Math.log((1-ul)/(1+ul))/this.bl;us=us-this.u;var x=this.x0+vs*this.cosaz+us*this.sinaz;var y=this.y0+us*this.cosaz-vs*this.sinaz;p.x=x;p.y=y;return p},
inverse:function(p){var delta_lon;var theta;var delta_theta;var sin_phi,cos_phi;var b;var c,t,tq;var con,n,ml;var vs,us,q,s,ts1;var vl,ul,bs;var dlon;var flag;p.x-=this.x0;p.y-=this.y0;flag=0;vs=p.x*this.cosaz-p.y*this.sinaz;us=p.y*this.cosaz+p.x*this.sinaz;us=us+this.u;q=Math.exp(-this.bl*vs/this.al);s=0.5*(q-1/q);t=0.5*(q+1/q);vl=Math.sin(this.bl*us/this.al);ul=(vl*this.cosgam+s*this.singam)/t;if(Math.abs(Math.abs(ul)-1)<=Proj4js.common.EPSLN){lon=this.longc;if(ul>=0)lat=Proj4js.common.HALF_PI;
else lat=-Proj4js.common.HALF_PI}else{con=1/this.bl;ts1=Math.pow(this.el/Math.sqrt((1+ul)/(1-ul)),con);lat=Proj4js.common.phi2z(this.e,ts1);theta=this.longc-Math.atan2(s*this.cosgam-vl*this.singam,con)/this.bl;lon=Proj4js.common.adjust_lon(theta)}p.x=lon;p.y=lat;return p}};
Proj4js.Proj.lcc={init:function(){if(!this.lat2)this.lat2=this.lat0;if(!this.k0)this.k0=1;if(Math.abs(this.lat1+this.lat2)<Proj4js.common.EPSLN){Proj4js.reportError("lcc:init: Equal Latitudes");return}var temp=this.b/this.a;this.e=Math.sqrt(1-temp*temp);var sin1=Math.sin(this.lat1);var cos1=Math.cos(this.lat1);var ms1=Proj4js.common.msfnz(this.e,sin1,cos1);var ts1=Proj4js.common.tsfnz(this.e,this.lat1,sin1);var sin2=Math.sin(this.lat2);var cos2=Math.cos(this.lat2);var ms2=Proj4js.common.msfnz(this.e,
sin2,cos2);var ts2=Proj4js.common.tsfnz(this.e,this.lat2,sin2);var ts0=Proj4js.common.tsfnz(this.e,this.lat0,Math.sin(this.lat0));if(Math.abs(this.lat1-this.lat2)>Proj4js.common.EPSLN)this.ns=Math.log(ms1/ms2)/Math.log(ts1/ts2);else this.ns=sin1;this.f0=ms1/(this.ns*Math.pow(ts1,this.ns));this.rh=this.a*this.f0*Math.pow(ts0,this.ns);if(!this.title)this.title="Lambert Conformal Conic"},forward:function(p){var lon=p.x;var lat=p.y;if(lat<=90&&lat>=-90&&lon<=180&&lon>=-180);else{Proj4js.reportError("lcc:forward: llInputOutOfRange: "+
lon+" : "+lat);return null}var con=Math.abs(Math.abs(lat)-Proj4js.common.HALF_PI);var ts,rh1;if(con>Proj4js.common.EPSLN){ts=Proj4js.common.tsfnz(this.e,lat,Math.sin(lat));rh1=this.a*this.f0*Math.pow(ts,this.ns)}else{con=lat*this.ns;if(con<=0){Proj4js.reportError("lcc:forward: No Projection");return null}rh1=0}var theta=this.ns*Proj4js.common.adjust_lon(lon-this.long0);p.x=this.k0*rh1*Math.sin(theta)+this.x0;p.y=this.k0*(this.rh-rh1*Math.cos(theta))+this.y0;return p},inverse:function(p){var rh1,con,
ts;var lat,lon;var x=(p.x-this.x0)/this.k0;var y=this.rh-(p.y-this.y0)/this.k0;if(this.ns>0){rh1=Math.sqrt(x*x+y*y);con=1}else{rh1=-Math.sqrt(x*x+y*y);con=-1}var theta=0;if(rh1!=0)theta=Math.atan2(con*x,con*y);if(rh1!=0||this.ns>0){con=1/this.ns;ts=Math.pow(rh1/(this.a*this.f0),con);lat=Proj4js.common.phi2z(this.e,ts);if(lat==-9999)return null}else lat=-Proj4js.common.HALF_PI;lon=Proj4js.common.adjust_lon(theta/this.ns+this.long0);p.x=lon;p.y=lat;return p}};
Proj4js.Proj.laea={S_POLE:1,N_POLE:2,EQUIT:3,OBLIQ:4,init:function(){var t=Math.abs(this.lat0);if(Math.abs(t-Proj4js.common.HALF_PI)<Proj4js.common.EPSLN)this.mode=this.lat0<0?this.S_POLE:this.N_POLE;else if(Math.abs(t)<Proj4js.common.EPSLN)this.mode=this.EQUIT;else this.mode=this.OBLIQ;if(this.es>0){var sinphi;this.qp=Proj4js.common.qsfnz(this.e,1);this.mmf=0.5/(1-this.es);this.apa=this.authset(this.es);switch(this.mode){case this.N_POLE:case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(0.5*
this.qp);this.dd=1/this.rq;this.xmf=1;this.ymf=0.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(0.5*this.qp);sinphi=Math.sin(this.lat0);this.sinb1=Proj4js.common.qsfnz(this.e,sinphi)/this.qp;this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1);this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*sinphi*sinphi)*this.rq*this.cosb1);this.ymf=(this.xmf=this.rq)/this.dd;this.xmf*=this.dd;break}}else if(this.mode==this.OBLIQ){this.sinph0=Math.sin(this.lat0);this.cosph0=Math.cos(this.lat0)}},forward:function(p){var x,
y;var lam=p.x;var phi=p.y;lam=Proj4js.common.adjust_lon(lam-this.long0);if(this.sphere){var coslam,cosphi,sinphi;sinphi=Math.sin(phi);cosphi=Math.cos(phi);coslam=Math.cos(lam);switch(this.mode){case this.OBLIQ:case this.EQUIT:y=this.mode==this.EQUIT?1+cosphi*coslam:1+this.sinph0*sinphi+this.cosph0*cosphi*coslam;if(y<=Proj4js.common.EPSLN){Proj4js.reportError("laea:fwd:y less than eps");return null}y=Math.sqrt(2/y);x=y*cosphi*Math.sin(lam);y*=this.mode==this.EQUIT?sinphi:this.cosph0*sinphi-this.sinph0*
cosphi*coslam;break;case this.N_POLE:coslam=-coslam;case this.S_POLE:if(Math.abs(phi+this.phi0)<Proj4js.common.EPSLN){Proj4js.reportError("laea:fwd:phi < eps");return null}y=Proj4js.common.FORTPI-phi*0.5;y=2*(this.mode==this.S_POLE?Math.cos(y):Math.sin(y));x=y*Math.sin(lam);y*=coslam;break}}else{var coslam,sinlam,sinphi,q,sinb=0,cosb=0,b=0;coslam=Math.cos(lam);sinlam=Math.sin(lam);sinphi=Math.sin(phi);q=Proj4js.common.qsfnz(this.e,sinphi);if(this.mode==this.OBLIQ||this.mode==this.EQUIT){sinb=q/this.qp;
cosb=Math.sqrt(1-sinb*sinb)}switch(this.mode){case this.OBLIQ:b=1+this.sinb1*sinb+this.cosb1*cosb*coslam;break;case this.EQUIT:b=1+cosb*coslam;break;case this.N_POLE:b=Proj4js.common.HALF_PI+phi;q=this.qp-q;break;case this.S_POLE:b=phi-Proj4js.common.HALF_PI;q=this.qp+q;break}if(Math.abs(b)<Proj4js.common.EPSLN){Proj4js.reportError("laea:fwd:b < eps");return null}switch(this.mode){case this.OBLIQ:case this.EQUIT:b=Math.sqrt(2/b);if(this.mode==this.OBLIQ)y=this.ymf*b*(this.cosb1*sinb-this.sinb1*cosb*
coslam);else y=(b=Math.sqrt(2/(1+cosb*coslam)))*sinb*this.ymf;x=this.xmf*b*cosb*sinlam;break;case this.N_POLE:case this.S_POLE:if(q>=0){x=(b=Math.sqrt(q))*sinlam;y=coslam*(this.mode==this.S_POLE?b:-b)}else x=y=0;break}}p.x=this.a*x+this.x0;p.y=this.a*y+this.y0;return p},inverse:function(p){p.x-=this.x0;p.y-=this.y0;var x=p.x/this.a;var y=p.y/this.a;if(this.sphere){var cosz=0,rh,sinz=0;rh=Math.sqrt(x*x+y*y);var phi=rh*0.5;if(phi>1){Proj4js.reportError("laea:Inv:DataError");return null}phi=2*Math.asin(phi);
if(this.mode==this.OBLIQ||this.mode==this.EQUIT){sinz=Math.sin(phi);cosz=Math.cos(phi)}switch(this.mode){case this.EQUIT:phi=Math.abs(rh)<=Proj4js.common.EPSLN?0:Math.asin(y*sinz/rh);x*=sinz;y=cosz*rh;break;case this.OBLIQ:phi=Math.abs(rh)<=Proj4js.common.EPSLN?this.phi0:Math.asin(cosz*sinph0+y*sinz*cosph0/rh);x*=sinz*cosph0;y=(cosz-Math.sin(phi)*sinph0)*rh;break;case this.N_POLE:y=-y;phi=Proj4js.common.HALF_PI-phi;break;case this.S_POLE:phi-=Proj4js.common.HALF_PI;break}lam=y==0&&(this.mode==this.EQUIT||
this.mode==this.OBLIQ)?0:Math.atan2(x,y)}else{var cCe,sCe,q,rho,ab=0;switch(this.mode){case this.EQUIT:case this.OBLIQ:x/=this.dd;y*=this.dd;rho=Math.sqrt(x*x+y*y);if(rho<Proj4js.common.EPSLN){p.x=0;p.y=this.phi0;return p}sCe=2*Math.asin(0.5*rho/this.rq);cCe=Math.cos(sCe);x*=sCe=Math.sin(sCe);if(this.mode==this.OBLIQ){ab=cCe*this.sinb1+y*sCe*this.cosb1/rho;q=this.qp*ab;y=rho*this.cosb1*cCe-y*this.sinb1*sCe}else{ab=y*sCe/rho;q=this.qp*ab;y=rho*cCe}break;case this.N_POLE:y=-y;case this.S_POLE:q=x*x+
y*y;if(!q){p.x=0;p.y=this.phi0;return p}ab=1-q/this.qp;if(this.mode==this.S_POLE)ab=-ab;break}lam=Math.atan2(x,y);phi=this.authlat(Math.asin(ab),this.apa)}p.x=Proj4js.common.adjust_lon(this.long0+lam);p.y=phi;return p},P00:0.3333333333333333,P01:0.17222222222222222,P02:0.10257936507936508,P10:0.06388888888888888,P11:0.0664021164021164,P20:0.016415012942191543,authset:function(es){var t;var APA=new Array;APA[0]=es*this.P00;t=es*es;APA[0]+=t*this.P01;APA[1]=t*this.P10;t*=es;APA[0]+=t*this.P02;APA[1]+=
t*this.P11;APA[2]=t*this.P20;return APA},authlat:function(beta,APA){var t=beta+beta;return beta+APA[0]*Math.sin(t)+APA[1]*Math.sin(t+t)+APA[2]*Math.sin(t+t+t)}};
Proj4js.Proj.aeqd={init:function(){this.sin_p12=Math.sin(this.lat0);this.cos_p12=Math.cos(this.lat0)},forward:function(p){var lon=p.x;var lat=p.y;var ksp;var sinphi=Math.sin(p.y);var cosphi=Math.cos(p.y);var dlon=Proj4js.common.adjust_lon(lon-this.long0);var coslon=Math.cos(dlon);var g=this.sin_p12*sinphi+this.cos_p12*cosphi*coslon;if(Math.abs(Math.abs(g)-1)<Proj4js.common.EPSLN){ksp=1;if(g<0){Proj4js.reportError("aeqd:Fwd:PointError");return}}else{var z=Math.acos(g);ksp=z/Math.sin(z)}p.x=this.x0+
this.a*ksp*cosphi*Math.sin(dlon);p.y=this.y0+this.a*ksp*(this.cos_p12*sinphi-this.sin_p12*cosphi*coslon);return p},inverse:function(p){p.x-=this.x0;p.y-=this.y0;var rh=Math.sqrt(p.x*p.x+p.y*p.y);if(rh>2*Proj4js.common.HALF_PI*this.a){Proj4js.reportError("aeqdInvDataError");return}var z=rh/this.a;var sinz=Math.sin(z);var cosz=Math.cos(z);var lon=this.long0;var lat;if(Math.abs(rh)<=Proj4js.common.EPSLN)lat=this.lat0;else{lat=Proj4js.common.asinz(cosz*this.sin_p12+p.y*sinz*this.cos_p12/rh);var con=Math.abs(this.lat0)-
Proj4js.common.HALF_PI;if(Math.abs(con)<=Proj4js.common.EPSLN)if(lat0>=0)lon=Proj4js.common.adjust_lon(this.long0+Math.atan2(p.x,-p.y));else lon=Proj4js.common.adjust_lon(this.long0-Math.atan2(-p.x,p.y));else{con=cosz-this.sin_p12*Math.sin(lat);if(Math.abs(con)<Proj4js.common.EPSLN&&Math.abs(p.x)<Proj4js.common.EPSLN);else{var temp=Math.atan2(p.x*sinz*this.cos_p12,con*rh);lon=Proj4js.common.adjust_lon(this.long0+Math.atan2(p.x*sinz*this.cos_p12,con*rh))}}}p.x=lon;p.y=lat;return p}};
Proj4js.Proj.moll={init:function(){},forward:function(p){var lon=p.x;var lat=p.y;var delta_lon=Proj4js.common.adjust_lon(lon-this.long0);var theta=lat;var con=Proj4js.common.PI*Math.sin(lat);for(var i=0;true;i++){var delta_theta=-(theta+Math.sin(theta)-con)/(1+Math.cos(theta));theta+=delta_theta;if(Math.abs(delta_theta)<Proj4js.common.EPSLN)break;if(i>=50)Proj4js.reportError("moll:Fwd:IterationError")}theta/=2;if(Proj4js.common.PI/2-Math.abs(lat)<Proj4js.common.EPSLN)delta_lon=0;var x=0.900316316158*
this.a*delta_lon*Math.cos(theta)+this.x0;var y=1.4142135623731*this.a*Math.sin(theta)+this.y0;p.x=x;p.y=y;return p},inverse:function(p){var theta;var arg;p.x-=this.x0;var arg=p.y/(1.4142135623731*this.a);if(Math.abs(arg)>0.999999999999)arg=0.999999999999;var theta=Math.asin(arg);var lon=Proj4js.common.adjust_lon(this.long0+p.x/(0.900316316158*this.a*Math.cos(theta)));if(lon<-Proj4js.common.PI)lon=-Proj4js.common.PI;if(lon>Proj4js.common.PI)lon=Proj4js.common.PI;arg=(2*theta+Math.sin(2*theta))/Proj4js.common.PI;
if(Math.abs(arg)>1)arg=1;var lat=Math.asin(arg);p.x=lon;p.y=lat;return p}};
Proj4js.defs["EPSG:3417"]="+proj=lcc +lat_1=43.26666666666667 +lat_2=42.06666666666667 +lat_0=41.5 +lon_0=-93.5 +x_0=1500000 +y_0=999999.9999898402 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs";Proj4js.defs["EPSG:3418"]="+proj=lcc +lat_1=41.78333333333333 +lat_2=40.61666666666667 +lat_0=40 +lon_0=-93.5 +x_0=500000.00001016 +y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs";Proj4js.defs["EPSG:26976"]="+proj=lcc +lat_1=41.78333333333333 +lat_2=40.61666666666667 +lat_0=40 +lon_0=-93.5 +x_0=500000 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs";
Proj4js.defs["EPSG:102672"]="+proj=tmerc +lat_0=36.66666666666666 +lon_0=-90.16666666666667 +k=0.9999411764705882 +x_0=700000 +y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs";Proj4js.defs["EPSG:102673"]="+proj=tmerc +lat_0=37.5 +lon_0=-85.66666666666667 +k=0.9999666666666667 +x_0=100000 +y_0=250000 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs";Proj4js.defs["EPSG:102674"]="+proj=tmerc +lat_0=37.5 +lon_0=-87.08333333333333 +k=0.9999666666666667 +x_0=900000.0000000001 +y_0=250000 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs";
Proj4js.defs["EPSG:102675"]="+proj=lcc +lat_1=42.06666666666667 +lat_2=43.26666666666667 +lat_0=41.5 +lon_0=-93.5 +x_0=1500000 +y_0=1000000 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs";Proj4js.defs["EPSG:102676"]="+proj=lcc +lat_1=40.61666666666667 +lat_2=41.78333333333333 +lat_0=40 +lon_0=-93.5 +x_0=500000.0000000002 +y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs";Proj4js.defs["EPSG:102677"]="+proj=lcc +lat_1=38.71666666666667 +lat_2=39.78333333333333 +lat_0=38.33333333333334 +lon_0=-98 +x_0=399999.9999999999 +y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs";
Proj4js.defs["EPSG:102678"]="+proj=lcc +lat_1=37.26666666666667 +lat_2=38.56666666666667 +lat_0=36.66666666666666 +lon_0=-98.5 +x_0=399999.9999999999 +y_0=399999.9999999999 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs";Proj4js.defs["EPSG:102696"]="+proj=tmerc +lat_0=35.83333333333334 +lon_0=-90.5 +k=0.9999333333333333 +x_0=250000 +y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs";Proj4js.defs["EPSG:102697"]="+proj=tmerc +lat_0=35.83333333333334 +lon_0=-92.5 +k=0.9999333333333333 +x_0=500000.0000000002 +y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs";
Proj4js.defs["EPSG:102698"]="+proj=tmerc +lat_0=36.16666666666666 +lon_0=-94.5 +k=0.9999411764705882 +x_0=850000 +y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs";Proj4js.defs["EPSG:102629"]="+proj=tmerc +lat_0=30.5 +lon_0=-85.83333333333333 +k=0.99996 +x_0=200000 +y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs";Proj4js.defs["EPSG:102630"]="+proj=tmerc +lat_0=30 +lon_0=-87.5 +k=0.9999333333333333 +x_0=600000.0000000001 +y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs";
Proj4js.defs["EPSG:2273"]="+proj=lcc +lat_1=34.83333333333334 +lat_2=32.5 +lat_0=31.83333333333333 +lon_0=-81 +x_0=609600 +y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048 +no_defs";Proj4js.defs["EPSG:102735"]="+proj=lcc +lat_1=42.83333333333334 +lat_2=44.4 +lat_0=42.33333333333334 +lon_0=-100.3333333333333 +x_0=600000.0000000001 +y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs";Proj4js.defs["EPSG:102734"]="+proj=lcc +lat_1=44.41666666666666 +lat_2=45.68333333333333 +lat_0=43.83333333333334 +lon_0=-100 +x_0=600000.0000000001 +y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs";
Proj4js.defs["EPSG:102690"]="+proj=lcc +lat_1=42.1 +lat_2=43.66666666666666 +lat_0=41.5 +lon_0=-84.36666666666666 +x_0=4000000 +y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs";Proj4js.defs["EPSG:102691"]="+proj=lcc +lat_1=47.03333333333333 +lat_2=48.63333333333333 +lat_0=46.5 +lon_0=-93.09999999999999 +x_0=799999.9999999999 +y_0=100000 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs";Proj4js.defs["EPSG:102692"]="+proj=lcc +lat_1=45.61666666666667 +lat_2=47.05 +lat_0=45 +lon_0=-94.25 +x_0=799999.9999999999 +y_0=100000 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs";
Proj4js.defs["EPSG:102693"]="+proj=lcc +lat_1=43.78333333333333 +lat_2=45.21666666666667 +lat_0=43 +lon_0=-94 +x_0=799999.9999999999 +y_0=100000 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs";Proj4js.defs["EPSG:26915"]="+proj=utm +zone=15 +ellps=GRS80 +datum=NAD83 +units=m +no_defs";Proj4js.defs["EPSG:103724"]="+proj=lcc +lat_1=43.9 +lat_2=44.16666666666666 +lat_0=43.84805555555556 +lon_0=-94.91666666666667 +x_0=152400.3048 +y_0=30480.06096 +a=6378514.953 +rf=298.2572221008827 +to_meter=0.3048006096012192 +no_defs";
Proj4js.defs["EPSG:103727"]="+proj=lcc +lat_1=43.88333333333333 +lat_2=44.13333333333333 +lat_0=43.83388888888889 +lon_0=-92.91666666666667 +x_0=152400.3048 +y_0=30480.06096 +a=6378481.425 +rf=298.2572221008827 +to_meter=0.3048006096012192 +no_defs";Proj4js.defs["EPSG:103735"]="+proj=lcc +lat_1=43.56666666666667 +lat_2=43.8 +lat_0=43.5 +lon_0=-91.46666666666667 +x_0=152400.3048 +y_0=30480.06096 +a=6378436.619 +rf=298.2572221008827 +to_meter=0.3048006096012192 +no_defs";
Proj4js.defs["EPSG:103747"]="+proj=lcc +lat_1=44.3 +lat_2=44.66666666666666 +lat_0=44.19472222222222 +lon_0=-93.13333333333334 +x_0=152400.3048 +y_0=30480.06096 +a=6378434.181 +rf=298.2572221008827 +to_meter=0.3048006096012192 +no_defs";Proj4js.defs["EPSG:103753"]="+proj=lcc +lat_1=43.56666666666667 +lat_2=43.8 +lat_0=43.5 +lon_0=-93.95 +x_0=152400.3048 +y_0=30480.06096 +a=6378521.049 +rf=298.2572221008827 +to_meter=0.3048006096012192 +no_defs";Proj4js.defs["EPSG:103755"]="+proj=lcc +lat_1=45.85 +lat_2=46.26666666666667 +lat_0=45.77388888888889 +lon_0=-94.2 +x_0=152400.3048 +y_0=30480.06096 +a=6378502.761 +rf=298.2572221008827 +to_meter=0.3048006096012192 +no_defs";
Proj4js.defs["EPSG:103772"]="+proj=lcc +lat_1=44.3 +lat_2=44.666666666666667 +lat_0=44.19472222222222 +lon_0=-93.13333333333334 +x_0=152400.3048 +y_0=30480.06096 +a=6378434.181 +rf=298.2572221008827 +to_meter=0.3048006096012192 +no_defs";Proj4js.defs["EPSG:103779"]="+proj=lcc +lat_1=45.03333333333333 +lat_2=45.46666666666667 +lat_0=44.9775 +lon_0=-93.88333333333334 +x_0=152400.3048 +y_0=30480.06096 +a=6378443.325 +rf=298.2572221008827 +to_meter=0.3048006096012192 +no_defs";
Proj4js.defs["EPSG:103781"]="+proj=lcc +lat_1=45.35 +lat_2=45.70 +lat_0=45.2827777777777778 +lon_0=-95.15 +x_0=152400.3048 +y_0=30480.06096 +a=6378502.761 +rf=298.2572221008827 +to_meter=0.3048006096012192 +no_defs";Proj4js.defs["EPSG:103792"]="+proj=lcc +lat_1=45.03333333333333 +lat_2=45.46666666666667 +lat_0=44.9775 +lon_0=-93.88333333333334 +x_0=152400.3048 +y_0=30480.06096 +a=6378443.325 +rf=298.2572221008827 +to_meter=0.3048006096012192 +no_defs";Proj4js.defs["EPSG:3857"]="+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=6378137 +b=6378137 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs";
Proj4js.defs["EPSG:102100"]="+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=6378137 +b=6378137 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs";
function printStackTrace(options){var ex=options&&options.e?options.e:null;var guess=options?!!options.guess:true;var p=new printStackTrace.implementation;var result=p.run(ex);return guess?p.guessFunctions(result):result}printStackTrace.implementation=function(){};
printStackTrace.implementation.prototype={run:function(ex){ex=ex||function(){try{var _err=__undef__<<1}catch(e){return e}}();var mode=this._mode||this.mode(ex);if(mode==="other")return this.other(arguments.callee);else return this[mode](ex)},mode:function(e){if(e["arguments"])return this._mode="chrome";else if(window.opera&&e.stacktrace)return this._mode="opera10";else if(e.stack)return this._mode="firefox";else if(window.opera&&!("stacktrace"in e))return this._mode="opera";return this._mode="other"},
instrumentFunction:function(context,functionName,callback){context=context||window;context["_old"+functionName]=context[functionName];context[functionName]=function(){callback.call(this,printStackTrace());return context["_old"+functionName].apply(this,arguments)};context[functionName]._instrumented=true},deinstrumentFunction:function(context,functionName){if(context[functionName].constructor===Function&&context[functionName]._instrumented&&context["_old"+functionName].constructor===Function)context[functionName]=
context["_old"+functionName]},chrome:function(e){return e.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@").split("\n")},firefox:function(e){return e.stack.replace(/(?:\n@:0)?\s+$/m,"").replace(/^\(/gm,"{anonymous}(").split("\n")},opera10:function(e){var stack=e.stacktrace;var lines=stack.split("\n"),ANON="{anonymous}",lineRE=/.*line (\d+), column (\d+) in ((<anonymous function\:?\s*(\S+))|([^\(]+)\([^\)]*\))(?: in )?(.*)\s*$/i,i,
j,len;for(i=2,j=0,len=lines.length;i<len-2;i++)if(lineRE.test(lines[i])){var location=RegExp.$6+":"+RegExp.$1+":"+RegExp.$2;var fnName=RegExp.$3;fnName=fnName.replace(/<anonymous function\:?\s?(\S+)?>/g,ANON);lines[j++]=fnName+"@"+location}lines.splice(j,lines.length-j);return lines},opera:function(e){var lines=e.message.split("\n"),ANON="{anonymous}",lineRE=/Line\s+(\d+).*script\s+(http\S+)(?:.*in\s+function\s+(\S+))?/i,i,j,len;for(i=4,j=0,len=lines.length;i<len;i+=2)if(lineRE.test(lines[i]))lines[j++]=
(RegExp.$3?RegExp.$3+"()@"+RegExp.$2+RegExp.$1:ANON+"()@"+RegExp.$2+":"+RegExp.$1)+" -- "+lines[i+1].replace(/^\s+/,"");lines.splice(j,lines.length-j);return lines},other:function(curr){var ANON="{anonymous}",fnRE=/function\s*([\w\-$]+)?\s*\(/i,stack=[],j=0,fn,args;var maxStackSize=10;while(curr&&stack.length<maxStackSize){fn=fnRE.test(curr.toString())?RegExp.$1||ANON:ANON;args=Array.prototype.slice.call(curr["arguments"]);stack[j++]=fn+"("+this.stringifyArguments(args)+")";curr=curr.caller}return stack},
stringifyArguments:function(args){for(var i=0;i<args.length;++i){var arg=args[i];if(arg===undefined)args[i]="undefined";else if(arg===null)args[i]="null";else if(arg.constructor)if(arg.constructor===Array)if(arg.length<3)args[i]="["+this.stringifyArguments(arg)+"]";else args[i]="["+this.stringifyArguments(Array.prototype.slice.call(arg,0,1))+"..."+this.stringifyArguments(Array.prototype.slice.call(arg,-1))+"]";else if(arg.constructor===Object)args[i]="#object";else if(arg.constructor===Function)args[i]=
"#function";else if(arg.constructor===String)args[i]='"'+arg+'"'}return args.join(",")},sourceCache:{},ajax:function(url){var req=this.createXMLHTTPObject();if(!req)return;req.open("GET",url,false);req.setRequestHeader("User-Agent","XMLHTTP/1.0");req.send("");return req.responseText},createXMLHTTPObject:function(){var xmlhttp,XMLHttpFactories=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}];
for(var i=0;i<XMLHttpFactories.length;i++)try{xmlhttp=XMLHttpFactories[i]();this.createXMLHTTPObject=XMLHttpFactories[i];return xmlhttp}catch(e){}},isSameDomain:function(url){return url.indexOf(location.hostname)!==-1},getSource:function(url){if(!(url in this.sourceCache))this.sourceCache[url]=this.ajax(url).split("\n");return this.sourceCache[url]},guessFunctions:function(stack){for(var i=0;i<stack.length;++i){var reStack=/\{anonymous\}\(.*\)@(\w+:\/\/([\-\w\.]+)+(:\d+)?[^:]+):(\d+):?(\d+)?/;var frame=
stack[i],m=reStack.exec(frame);if(m){var file=m[1],lineno=m[4];if(file&&this.isSameDomain(file)&&lineno){var functionName=this.guessFunctionName(file,lineno);stack[i]=frame.replace("{anonymous}",functionName)}}}return stack},guessFunctionName:function(url,lineNo){try{return this.guessFunctionNameFromLines(lineNo,this.getSource(url))}catch(e){return"getSource failed with url: "+url+", exception: "+e.toString()}},guessFunctionNameFromLines:function(lineNo,source){var reFunctionArgNames=/function ([^(]*)\(([^)]*)\)/;
var reGuessFunction=/['"]?([0-9A-Za-z_]+)['"]?\s*[:=]\s*(function|eval|new Function)/;var line="",maxLines=10;for(var i=0;i<maxLines;++i){line=source[lineNo-i]+line;if(line!==undefined){var m=reGuessFunction.exec(line);if(m&&m[1])return m[1];else{m=reFunctionArgNames.exec(line);if(m&&m[1])return m[1]}}}return"(?)"}};
if(!this.JSON)this.JSON={};
(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=
/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,
mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function")value=value.toJSON(key);if(typeof rep==="function")value=rep.call(holder,key,value);switch(typeof value){case "string":return quote(value);case "number":return isFinite(value)?String(value):"null";case "boolean":case "null":return String(value);case "object":if(!value)return"null";gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=
1)partial[i]=str(i,value)||"null";v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v)partial.push(quote(k)+(gap?": ":":")+v)}}}else for(k in value)if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v)partial.push(quote(k)+(gap?": ":":")+v)}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+
gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function")JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number")for(i=0;i<space;i+=1)indent+=" ";else if(typeof space==="string")indent=space;rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number"))throw new Error("JSON.stringify");return str("",{"":value})};if(typeof JSON.parse!=="function")JSON.parse=
function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object")for(k in value)if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined)value[k]=v;else delete value[k]}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text))text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)});if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse");}})();
function wcfServiceProxy(serviceUrl,extraQueryString){var _I=this;this.serviceUrl=serviceUrl;this.extraQueryString=extraQueryString;this.invoke=function(method,timeout,data,callback,error,bare,scope,scopeArgs){var json=JSON.stringify(data);var url=_I.serviceUrl+method+"?QPS="+_I.extraQueryString;$.ajax({url:url,data:json,type:"POST",processData:false,contentType:"application/json",timeout:timeout,dataType:"text",success:function(res){if(!callback)return;var result=JSON.parse(res);if(bare){callback.call(scope,
result,scopeArgs);return}for(var property in result){callback.call(scope,result[property],scopeArgs);break}},error:function(xhr){if(!error)return;try{var msg=xhr.status+" "+xhr.statusText;if(xhr.responseText)msg+=" -- "+xhr.responseText;error.call(scope,msg,scopeArgs)}catch(ex){error.call(scope,"Unknown server error.",scopeArgs)}return}})}};
Number.prototype.format=function(format){var hasComma=-1<format.indexOf(","),psplit=format.split("."),that=this;if(1<psplit.length)that=that.toFixed(psplit[1].length);else if(2<psplit.length)throw"NumberFormatException: invalid format, formats should have no more than 1 period: "+format;else that=that.toFixed(0);var fnum=that.toString();if(hasComma){psplit=fnum.split(".");var cnum=psplit[0],parr=[],j=cnum.length,m=Math.floor(j/3),n=cnum.length%3||3;for(var i=0;i<j;i+=n){if(i!=0)n=3;parr[parr.length]=
cnum.substr(i,n);m-=1}fnum=parr.join(",");if(psplit[1])fnum+="."+psplit[1]}return format.replace(/[\d,?\.?]+/,fnum)};Number.prototype.displayRounding=function(){if(this<10)return Math.round(this*1E3)/1E3;if(this<100)return Math.round(this*100)/100;if(this<1E3)return Math.round(this*10)/10;return Math.round(this)};
Number.prototype.addCommas=function(){var addCommas_rgx=/(\d+)(\d{3})/;nStr=this+"";x=nStr.split(".");x1=x[0];x2=x.length>1?"."+x[1]:"";while(addCommas_rgx.test(x1))x1=x1.replace(addCommas_rgx,"$1"+","+"$2");return x1+x2};
var Beacon={};Beacon.Control={};Beacon.Strategy={};Beacon.Layer={};Beacon.Popup={};Beacon.Handler={};Beacon.Protocol={};Beacon.Tile={};var _gaq=_gaq||[];if(!window.console)window.console={info:function(){},warn:function(){},error:function(){}};Beacon.GA={TrackEvent:function(category,action,label,value){if(!_gaq)_gaq=[];_gaq.push(["_trackEvent",category,action,label,value])},CLASS_NAME:"Beacon.GA"};
Beacon.EULA={Show:function(html){var confirmBtns="<div style='text-align:center; padding:20px;'>"+"<a id='eulabtn' href='#' title=''>I agree to the above terms and conditions</a>"+"</div>";var accepted=false;$().colorbox({title:"Disclaimer / Terms of service",innerWidth:"800px",innerHeight:"600px",html:html+confirmBtns,overlayClose:false,escKey:false,onClosed:function(){if(!accepted)Beacon.EULA.Show(html)}});$("#eulabtn").click(function(){accepted=true;$.cookie("EULA-"+mapConfig.AppId,"1",{expires:60});
$.colorbox.close()})},CLASS_NAME:"Beacon.EULA"};
Beacon.API={pBeaconCore:null,Initialize:function(){this.pBeaconCore=new wcfServiceProxy("/api/beaconCore.svc/json/",mapConfig.QPS)},UpdateMapExtent:function(ext,resolution,success,failure,scope,scopeArgs){this.pBeaconCore.invoke("UpdateMapExtent",15E3,{ext:{minx:ext.left,miny:ext.bottom,maxx:ext.right,maxy:ext.top},resolution:resolution,ts:(new Date).getTime()},success,failure,false,scope,scopeArgs)},SetResults:function(layerId,keys,success,failure,scope,scopeArgs){this.pBeaconCore.invoke("SetResults",
15E3,{keys:keys,layerId:layerId,ts:(new Date).getTime()},success,failure,false,scope,scopeArgs)},SetPrintUrl:function(url,success,failure,scope,scopeArgs){this.pBeaconCore.invoke("SetPrintUrl",15E3,{fromUrl:url},success,failure,false,scope,scopeArgs)},GetVectorLayer:function(layerId,useSelection,ext,wkt,spatialRelation,featureLimit,success,failure,scope,scopeArgs){this.pBeaconCore.invoke("GetVectorLayer",3E4,{layerId:layerId,useSelection:useSelection,ext:ext?{minx:ext.left,miny:ext.bottom,maxx:ext.right,
maxy:ext.top}:null,wkt:wkt,spatialRelation:spatialRelation,featureLimit:featureLimit},success,failure,false,scope,scopeArgs)},SpatialRelation:{None:0,Intersects:1,Contains:2,ContainsCentroid:3},QueryMapDetail:function(layerId,key,success,failure,scope,scopeArgs){this.pBeaconCore.invoke("QueryMapDetail",15E3,{layerId:layerId,key:key},success,failure,false,scope,scopeArgs)},BufferGeometry:function(wkts,distance,success,failure,scope,scopeArgs){this.pBeaconCore.invoke("BufferGeometry",31E3,{distance:distance,
wkt:wkts},success,failure,false,scope,scopeArgs)},ClearBufferGeometry:function(success,failure,scope,scopeArgs){this.pBeaconCore.invoke("ClearBufferGeometry",15E3,{},success,failure,false,scope,scopeArgs)},GetTabs:function(layerId,success,failure,scope,scopeArgs){this.pBeaconCore.invoke("GetTabs",15E3,{layerId:layerId},success,failure,false,scope,scopeArgs)},GetDisclaimers:function(layerIds,success,failure,scope,scopeArgs){this.pBeaconCore.invoke("GetDisclaimers",15E3,{layerIds:layerIds},success,
failure,false,scope,scopeArgs)},GetQuickZoomList:function(layerId,success,failure,scope,scopeArgs){this.pBeaconCore.invoke("GetQuickZoomList",15E3,{layerId:layerId},success,failure,false,scope,scopeArgs)},LogJsError:function(message,stacktrace,success,failure,scope,scopeArgs){this.pBeaconCore.invoke("LogJsError",6E4,{msg:message,stacktrace:stacktrace},success,failure,false,scope,scopeArgs)},Ping:function(success,failure,scope,scopeArgs){this.pBeaconCore.invoke("Ping",15E3,{},success,failure,false,
scope,scopeArgs)},SetLayerVisibility:function(layerId,visible,success,failure,scope,scopeArgs){this.pBeaconCore.invoke("SetLayerVisibility",15E3,{layerId:layerId,visible:visible},success,failure,false,scope,scopeArgs)},SaveMapMarkup:function(markup,success,failure,scope,scopeArgs){this.pBeaconCore.invoke("SaveMapMarkup",15E3,{markup:markup,ts:(new Date).getTime()},success,failure,false,scope,scopeArgs)},LoadMapMarkup:function(success,failure,scope,scopeArgs){this.pBeaconCore.invoke("LoadMapMarkup",
15E3,{},success,failure,false,scope,scopeArgs)}};
$(function(){Beacon.Icons.hoverize()});
$(function(){$(window).bind("beforeunload",ShowPleaseWaitDialog)});function CenterOnScreen(o){return{left:$(window).scrollLeft()+($(window).width()-o.width())/2,top:$(window).scrollTop()+($(window).height()-o.height())/2}}
function ShowPleaseWaitDialog(){if($("#bbDialog").is(":visible"))return;window.setTimeout(function(){$("SELECT").css("visibility","hidden");var bb=$("#bbDialog");bb.show();var p=CenterOnScreen(bb);bb.css("top",p.top);bb.css("left",p.left);$(window).resize(PleaseWaitDialog_OnScroll);$(window).scroll(PleaseWaitDialog_OnScroll);setTimeout(function(){var s=$("#bbDialog").attr("src");$("#bbDialog").attr("src",s)},50)},500)}
function DisablePleaseWaitDialog(){$(window).unbind("beforeunload",ShowPleaseWaitDialog)}function HidePleaseWaitDialog(){$(window).unbind("resize",PleaseWaitDialog_OnScroll);$(window).unbind("scroll",PleaseWaitDialog_OnScroll);$("#bbDialog").hide()}function PleaseWaitDialog_OnScroll(){var bb=$("#bbDialog");if(bb.is(":hidden"))return;var p=CenterOnScreen(bb);bb.animate({top:p.top,left:p.left},{duration:500,easing:"swing",queue:false})};
$(function(){$("IMG[GROUP]").each(function(){var grpId=$(this).attr("GROUP");if($.cookie(toc_cookiename(grpId))==1)toc_showgroup(grpId);else toc_hidegroup(grpId)})});function toc_toggle(btn,groupId){if($("#TocCell"+groupId).is(":visible")){toc_hidegroup(groupId);$.cookie(toc_cookiename(groupId),null)}else{toc_showgroup(groupId);$.cookie(toc_cookiename(groupId),1)}}function toc_cookiename(grpId){return"TOC-"+activeAppId+"-"+grpId}
function toc_showgroup(grpId){var div=$("#TocCell"+grpId);var btn=$("IMG[GROUP="+grpId+"]");div.show();btn.attr("src","/Icons/NodeMinus/NodeMinus-16-Active.gif")}function toc_hidegroup(grpId){var div=$("#TocCell"+grpId);var btn=$("IMG[GROUP="+grpId+"]");div.hide();btn.attr("src","/Icons/NodePlus/NodePlus-16-Active.gif")};
var lazySusan=null;var LL_timer=-1;var LL_cookie="ShowPhotos";var LL_buffer=200;$(function(){var chkShowPhotos=$(".showImageCheckBox");if(chkShowPhotos.length>0){chkShowPhotos.click(LazyLoader_CheckBoxHandler);if($.cookie(LL_cookie)=="YES"){chkShowPhotos.attr("checked","YES");LazyLoaderInit();Beacon.GA.TrackEvent("ShowPhotos","On")}else{LazyLoaderKill();Beacon.GA.TrackEvent("ShowPhotos","Off")}}});
function LazyLoader_CheckBoxHandler(){if($(this).is(":checked")){LazyLoaderInit();$.cookie(LL_cookie,"YES");Beacon.GA.TrackEvent("ShowPhotos","Turned On")}else{LazyLoaderKill();$.cookie(LL_cookie,null);Beacon.GA.TrackEvent("ShowPhotos","Turned Off")}}
function LazyLoaderInit(){if(lazySusan!=null)return;lazySusan=new Array;$("img[LAZYURL]").each(LazyLoaderInitInternal);$("input:image[LAZYURL]").each(LazyLoaderInitInternal);$(window).scroll(LazyLoaderTrigger);$(window).resize(LazyLoaderTrigger);LazyLoaderTrigger()}
function LazyLoaderInitInternal(){var parentDiv=$(this).parents("DIV.ScrollingPanel");var parentId;if(parentDiv.length==0){parentDiv=null;parentId="DOCUMENT"}else{parentDiv=parentDiv[0];parentId=parentDiv.id}if(lazySusan[parentId]==undefined){lazySusan[parentId]={parent:parentDiv,images:new Array};$(parentDiv).scroll(LazyLoaderTrigger);$(parentDiv).resize(LazyLoaderTrigger)}lazySusan[parentId].images.push({image:$(this),loaded:false});$(this).attr("src","/Images/white_pixel.png").height(48).width(48)}
function LazyLoaderTrigger(){if(LL_timer!=-1){clearTimeout(LL_timer);LL_timer=-1}LL_timer=setTimeout(LazyLoaderUpdate,100)}
function LazyLoaderKill(){if(lazySusan==null)return;if(LL_timer!=-1)clearTimeout(LL_timer);LL_timer=-1;$(window).unbind("scroll",LazyLoaderTrigger);$(window).unbind("resize",LazyLoaderTrigger);for(var divKey in lazySusan){var div=lazySusan[divKey];$(div).unbind("scroll",LazyLoaderTrigger);$(div).unbind("resize",LazyLoaderTrigger);for(var imgKey in div.images){var img=div.images[imgKey];img.image.attr("src","/Icons/Report/Report-16-Enabled.gif");img.image.height(16);img.image.width(16)}}lazySusan=
null}
function LazyLoaderUpdate(){var screenTop=$(window).scrollTop();var screenBottom=screenTop+$(window).height()+LL_buffer;var divTop;var divBot;for(var divKey in lazySusan){var div=lazySusan[divKey];if(div.parent!=null){divTop=$(div.parent).offset().top;divBot=divTop+$(div.parent).height()+LL_buffer}for(var imgKey in div.images){var img=div.images[imgKey];if(!img.loaded){var imgTop=img.image.offset().top;var imgBot=imgTop+img.image.height();if(imgTop>screenBottom)break;if(imgTop>divBot)break;var visInScrn=imgBot>=
screenTop&&imgTop<=screenBottom;var canSee;if(div.parent!=null){var visInDiv=imgBot>=divTop&&imgTop<=divBot;canSee=visInDiv&&visInScrn}else canSee=visInScrn;if(canSee){img.image.attr("src",img.image.attr("LAZYURL"));img.loaded=true}}}}};
function InitScrollingPanel(clientId,minHeight,category){var scroller=$("#"+clientId+"_scrollbox");var inner=$("#"+clientId,scroller);var splitter=$("#"+clientId+"_splitterBar");var splitterImg=$("#"+clientId+"_splitterImg");var containerHeight=minHeight;var innerHeight;if(inner.length==0)innerHeight=scroller.height();else innerHeight=inner.height();var bottomOffset=150;if(category=="RPT")bottomOffset=275;if(category=="RES")bottomOffset=275;if(category=="TOC")bottomOffset=400;var ch=$(window).height()-
bottomOffset;if(ch>containerHeight)containerHeight=ch;if(innerHeight==0){scroller.hide();splitter.hide()}else if(containerHeight>innerHeight){scroller.height(innerHeight+25);splitter.hide()}else if(category==undefined){scroller.height(containerHeight);splitter.hide()}else{splitter.show();splitter.hover(function(){$(this).addClass("SplitterBarHighlight")},function(){$(this).removeClass("SplitterBarHighlight")});var w=splitter.width()/2-5;splitterImg.css("left",w+"px");if(GetScrollCookie(category)){scroller.height(containerHeight);
splitterImg.attr("src","/Images/down-arrow.png");splitter.attr("title","Expand view");Beacon.GA.TrackEvent("Scrollbars","On",category)}else{scroller.height("");splitterImg.attr("src","/Images/up-arrow.png");splitter.attr("title","Collapse view");Beacon.GA.TrackEvent("Scrollbars","Off",category)}splitter.click(function(){if(GetScrollCookie(category)){scroller.height("");splitterImg.attr("src","/Images/up-arrow.png");splitter.attr("title","Collapse view");SetScrollCookie(category,false);Beacon.GA.TrackEvent("Scrollbars",
"Turned Off",category)}else{scroller.height(containerHeight);splitterImg.attr("src","/Images/down-arrow.png");splitter.attr("title","Expand view");$(window).scrollTop(0);SetScrollCookie(category,true);Beacon.GA.TrackEvent("Scrollbars","Turned On",category)}})}}function SetScrollCookie(category,value){if(value)$.cookie("SCR-"+category,1,{expires:60});else $.cookie("SCR-"+category,null)}
function GetScrollCookie(category){if(category=="UNK")return true;if($.cookie("SCR-"+category)==1)return true;else return false};
function LoadAsyncContent(data,moduleid){DisablePleaseWaitDialog();var ac=$(".AsyncContent_"+moduleid);var pu=$(".UserPrompt_"+moduleid);var pw=$("#PleaseWait_"+moduleid);var er=$("#ErrorMsg_"+moduleid);pu.hide();er.hide();pw.show();$.ajax({url:"/AsyncRenderer.aspx",type:"POST",data:data,timeout:6E4,success:function(data){ac.html(data)},error:function(req,status,errthrown){pw.hide();er.show()}});return false};
var pixellength=0;var pixelarea=0;var measurement_x;var measurement_y;var final_area_measurement="";var show_final_area_measurement=false;function projectionParameter(MinX,MaxY,UnitsPerPixelX,UnitsPerPixelY,Mode){this.minx=MinX;this.maxy=MaxY;this.unitsPerPixelX=UnitsPerPixelX;this.unitsPerPixelY=UnitsPerPixelY;this.mode=Mode}function DynamicMeasure(){MapDynamicMeasure(mainMapDivName);return false}
function RemoveMapDynamicMeasure(){if(document.getElementById("pnlMeasure").style.display=="none")return false;document.getElementById("pnlMeasure").style.display="none";MapDragRectangle(mainMapDivName,"ZoomIn",false);document.getElementsByName("Measure").className="Enabled";document.getElementsByName("ZoomIn").className="Active";ResetEsriMouseclickState();return false}
function ResetEsriMouseclickState(){try{vectorCount[areaDivName]=0;xycoord[areaDivName].x=new Array;xycoord[areaDivName].y=new Array;areaDivObj[areaDivName].onmousemove=null;areaDivObj[areaDivName].ondblclick=null;lineDivObj[areaDivName].onmousemove=null;lineDivObj[areaDivName].ondblclick=null;pix[areaDivName].lastX=-9999;pix[areaDivName].lastY=-9999}catch(ex){}}
function MapDynamicMeasure(divid,unused1,unused2){mapSetTool(divid,"measure",false,measureVectorClick,null,"crosshair",1,"visible","Measure - Click to start line. Click again to add vectors. Double-click to finish.");document.getElementById("pnlMeasure").style.display="";getMapDiv(null);areaDivObj[areaDivName].onmousemove=beaconDisplayXY;lineDivObj[areaDivName].onmousemove=beaconDisplayXY;return false}
function measureVectorClick(e){if(vectorCount[areaDivName]==0){getXY(e);getMapDiv(e);areaDivObj[areaDivName].onmousemove=measureVectorMove;areaDivObj[areaDivName].ondblclick=measureVectorEnd;lineDivObj[areaDivName].onmousemove=measureVectorMove;lineDivObj[areaDivName].ondblclick=measureVectorEnd;controlType="map"}var ctrl=isNav?e.modifiers&Event.CONTROL_MASK:window.event.ctrlKey;getXY(e);pix[areaDivName].x2=mouseX-eLeft;pix[areaDivName].y2=mouseY-eTop;if(pix[areaDivName].lastX==pix[areaDivName].x2&&
pix[areaDivName].lastY==pix[areaDivName].y2||ctrl)measureVectorEnd(e);else{if(vectorCount[areaDivName]==0){pix[areaDivName].x1=mouseX-eLeft;pix[areaDivName].y1=mouseY-eTop;xycoord[areaDivName].x=new Array;xycoord[areaDivName].y=new Array;xycoord[areaDivName].x[0]=pix[areaDivName].x1;xycoord[areaDivName].y[0]=pix[areaDivName].y1}else{var n=xycoord[areaDivName].x.length;xycoord[areaDivName].x[n]=pix[areaDivName].x2;xycoord[areaDivName].y[n]=pix[areaDivName].y2;vo[areaDivName].clearObjects();vo[areaDivName].polyline(xycoord[areaDivName].x,
xycoord[areaDivName].y);vo[areaDivName].drawObjects()}vectorCount[areaDivName]++;pix[areaDivName].lastX=pix[areaDivName].x2;pix[areaDivName].lastY=pix[areaDivName].y2;if(jumpToFinish)measureVectorEnd(e)}return false}
function measureVectorMove(e){getXY(e);adjustMapCoords();pix[areaDivName].x2=mouseX-eLeft;pix[areaDivName].y2=mouseY-eTop;beaconDisplayXY(e);measureCalculations(pix[areaDivName].x2,pix[areaDivName].y2);var n=xycoord[areaDivName].x.length-1;if(n==-1)return false;vo[areaDivName].clearObjects();if(vectorCount[areaDivName]>1){vo[areaDivName].polyline(xycoord[areaDivName].x,xycoord[areaDivName].y);vo[areaDivName].line(pix[areaDivName].x2,pix[areaDivName].y2,xycoord[areaDivName].x[n],xycoord[areaDivName].y[n]);
beacon_line_label(vo[areaDivName],pix[areaDivName].x2,pix[areaDivName].y2,xycoord[areaDivName].x[n],xycoord[areaDivName].y[n])}else if(vectorCount[areaDivName]>0){vo[areaDivName].line(pix[areaDivName].x1,pix[areaDivName].y1,pix[areaDivName].x2,pix[areaDivName].y2);beacon_line_label(vo[areaDivName],pix[areaDivName].x1,pix[areaDivName].y1,pix[areaDivName].x2,pix[areaDivName].y2)}vo[areaDivName].drawObjects();return false}
function measureVectorEnd(e){vo[areaDivName].clearObjects();vo[areaDivName].polyline(xycoord[areaDivName].x,xycoord[areaDivName].y);beacon_polyline_label(vo[areaDivName],xycoord[areaDivName].x,xycoord[areaDivName].y);measureCalculations(-1,-1);beacon_label_area(vo[areaDivName]);vo[areaDivName].drawObjects();vectorCount[areaDivName]=0;xycoord[areaDivName].x=new Array;xycoord[areaDivName].y=new Array;areaDivObj[areaDivName].onmousemove=beaconDisplayXY;areaDivObj[areaDivName].ondblclick=null;lineDivObj[areaDivName].onmousemove=
beaconDisplayXY;lineDivObj[areaDivName].ondblclick=null;pix[areaDivName].lastX=-9999;pix[areaDivName].lastY=-9999;return false}
function measureCalculations(x,y){pixellength=0;pixelarea=0;var measure_x1=1E8;var measure_x2=-1E8;var measure_y1=1E8;var measure_y2=-1E8;var n=xycoord[areaDivName].x.length;if(n>0)for(var i=1;i<n;i++){var x1=xycoord[areaDivName].x[i-1];var y1=xycoord[areaDivName].y[i-1];var x2=xycoord[areaDivName].x[i];var y2=xycoord[areaDivName].y[i];var seglenth=Math.sqrt(Math.pow(x2-x1,2)+Math.pow(y2-y1,2));pixellength+=seglenth;pixelarea+=x1*y2-x2*y1;measure_x1=Math.min(x1,measure_x1);measure_y1=Math.min(y1,
measure_y1);measure_x2=Math.max(x2,measure_x2);measure_y2=Math.max(y2,measure_y2)}if(x!=-1){var x1=xycoord[areaDivName].x[n-1];var y1=xycoord[areaDivName].y[n-1];var x2=x;var y2=y;var seglenth=Math.sqrt(Math.pow(x2-x1,2)+Math.pow(y2-y1,2));pixellength+=seglenth;pixelarea+=x1*y2-x2*y1;x1=x;y1=y;x2=xycoord[areaDivName].x[0];y2=xycoord[areaDivName].y[0];pixelarea+=x1*y2-x2*y1}if(n<2)pixelarea=0;pixelarea=Math.abs(pixelarea)/2;renderMeasurementDisplay();measurement_x=(measure_x1+measure_x2)/2;measurement_y=
(measure_y1+measure_y2)/2;show_final_area_measurement=false;if(n>3){var x1=xycoord[areaDivName].x[n-1];var y1=xycoord[areaDivName].y[n-1];var x2=xycoord[areaDivName].x[0];var y2=xycoord[areaDivName].y[0];var closure=Math.sqrt(Math.pow(x2-x1,2)+Math.pow(y2-y1,2));if(closure<16)show_final_area_measurement=true}return false}
function renderMeasurementDisplay(){var LU=document.getElementById("linearUnit");var length_ftperunit=parseFloat(LU.options[LU.selectedIndex].value);var AU=document.getElementById("areaUnit");var area_sqftperunit=parseFloat(AU.options[AU.selectedIndex].value);var length_map=pixellength*mapFeetPerPixel;var area_map=pixelarea*Math.pow(mapFeetPerPixel,2);var length_disp=length_map/length_ftperunit;var area_disp=area_map/area_sqftperunit;document.getElementById("lengthDisplay").value=addCommas(displayRounding(length_disp));
document.getElementById("areaDisplay").value=addCommas(displayRounding(area_disp));final_area_measurement=addCommas(displayRounding(area_disp))+" "+AU.options[AU.selectedIndex].text}function displayRounding(x){if(x<10)return Math.round(x*1E3)/1E3;if(x<100)return Math.round(x*100)/100;if(x<1E3)return Math.round(x*10)/10;return Math.round(x)}var addCommas_rgx=/(\d+)(\d{3})/;
function addCommas(nStr){nStr+="";x=nStr.split(".");x1=x[0];x2=x.length>1?"."+x[1]:"";while(addCommas_rgx.test(x1))x1=x1.replace(addCommas_rgx,"$1"+","+"$2");return x1+x2}
function beaconDisplayXY(e){getXY(e);adjustMapCoords();var pix_x=mouseX-eLeft;var pix_y=mouseY-eTop;var prj=displayPrjList[activeDisplayPrj];var map_x=prj.minx+pix_x*prj.unitsPerPixelX;var map_y=prj.maxy-pix_y*prj.unitsPerPixelY;if(prj.mode==1){map_x=Math.round(map_x*1E6)/1E6+String.fromCharCode(176);map_y=Math.round(map_y*1E6)/1E6+String.fromCharCode(176)}else if(prj.mode==2){map_x=formatAsDMS(map_x);map_y=formatAsDMS(map_y)}else{map_x=Math.round(map_x);map_y=Math.round(map_y)}document.getElementById("xyCoordDisplay").value=
"X/Y: "+map_x+", "+map_y}function formatAsDMS(x){var negFlag;if(x<0){negFlag=true;x=Math.abs(x)}else negFlag=false;var d=Math.floor(x);var m=Math.floor(x*60%60);var s=Math.floor(x*3600%60);var dd=d<10?"0"+d:d;var mm=m<10?"0"+m:m;var ss=s<10?"0"+s:s;if(negFlag)dd="-"+dd;return dd+String.fromCharCode(176)+" "+mm+"' "+ss+'"'}function UpdateSpatialReference(newItem){activeDisplayPrj=newItem}function ShowZoomToXYPanel(e){document.getElementById("ZoomToXYPanel").style.display=""}
function HideZoomToXYPanel(e){document.getElementById("ZoomToXYPanel").style.display="none"}function ShowCustomScalePanel(e){document.getElementById("CustomScalePanel").style.display=""}function HideCustomScalePanel(e){document.getElementById("CustomScalePanel").style.display="none"}function beacon_line_label(vectors,inX1,inY1,inX2,inY2){if(isIE)beacon_ie_line_label(vectors,inX1,inY1,inX2,inY2);else beacon_ff_line_label(vectors,inX1,inY1,inX2,inY2)}
function beacon_polyline_label(vectors,xArray,yArray){if(isIE)beacon_ie_polyline_label(vectors,xArray,yArray);else beacon_ff_polyline_label(vectors,xArray,yArray)}
function beacon_ie_line_label(vectors,inX1,inY1,inX2,inY2){var pixelLength=Math.sqrt(Math.pow(inX2-inX1,2)+Math.pow(inY2-inY1,2));var offset=8;if(inX1>inX2){var tmp;tmp=inX2;inX2=inX1;inX1=tmp;tmp=inY2;inY2=inY1;inY1=tmp}var ratio=offset/pixelLength;var dx=ratio*(inY1-inY2);var dy=ratio*(inX1-inX2);var x1=inX1-dx;var y1=inY1+dy;var x2=inX2-dx;var y2=inY2+dy;if(x1==x2)x2++;if(y1==y2)y2++;var LU=document.getElementById("linearUnit");var length_ftperunit=parseFloat(LU.options[LU.selectedIndex].value);
var length_map=pixelLength*mapFeetPerPixel;var length_disp=length_map/length_ftperunit;var label=addCommas(displayRounding(length_disp));vectors.objString+='<v:line strokecolor="red" from="'+x1+","+y1+'" to="'+x2+","+y2+'"><v:fill on="true" color="red" /><v:path textpathok="true" /><v:textpath on="true" string="'+label+'" style="font-size:12" fitshape="true" /></v:line>\n'}
function beacon_label_area(vectors){if(show_final_area_measurement){vectors.objString+='<div style="position:absolute;left:'+(measurement_x-60)+"px;top:"+(measurement_y-10)+"px;width:120px;height:20px;padding:3px;"+"font-size:12;text-align:center;vertical-align:middle;"+'font-weight:bold;color:red;">'+final_area_measurement+"</div>";post_measurement(true)}else post_measurement(false)}
function post_measurement(useLabel){var n=xycoord[areaDivName].x.length;var data="";var prj=displayPrjList[0];var LU=document.getElementById("linearUnit");var length_ftperunit=parseFloat(LU.options[LU.selectedIndex].value);for(var i=0;i<n-1;i++){var x1=xycoord[areaDivName].x[i];var y1=xycoord[areaDivName].y[i];var x2=xycoord[areaDivName].x[i+1];var y2=xycoord[areaDivName].y[i+1];var map_x=Math.round(prj.minx+x1*prj.unitsPerPixelX);var map_y=Math.round(prj.maxy-y1*prj.unitsPerPixelY);var pixelLength=
Math.sqrt(Math.pow(x1-x2,2)+Math.pow(y1-y2,2));var length_map=pixelLength*mapFeetPerPixel;var length_disp=length_map/length_ftperunit;var label=addCommas(displayRounding(length_disp));data+=map_x+"|"+map_y+"|"+label+" "}var map_x=Math.round(prj.minx+xycoord[areaDivName].x[n-1]*prj.unitsPerPixelX);var map_y=Math.round(prj.maxy-xycoord[areaDivName].y[n-1]*prj.unitsPerPixelY);data+=map_x+"|"+map_y+"|eof";var request={data:data,label:useLabel?final_area_measurement:""};$.post("/SaveMeasurement.aspx",
request,null,"html")}
function beacon_ff_line_label(vectors,inX1,inY1,inX2,inY2){var pixelLength=Math.sqrt(Math.pow(inX2-inX1,2)+Math.pow(inY2-inY1,2));var xMid=(inX1+inX2)/2;var yMid=(inY1+inY2)/2;var LU=document.getElementById("linearUnit");var length_ftperunit=parseFloat(LU.options[LU.selectedIndex].value);var length_map=pixelLength*mapFeetPerPixel;var length_disp=length_map/length_ftperunit;var label=addCommas(displayRounding(length_disp));vectors.objString+='<div style="position:absolute; left:'+xMid+"px; top:"+yMid+
'px; margin-left:-15px; margin-top:-7px; font-size:10pt; font-weight:bold; font-family:Arial; color:Black; vertical-align:middle; text-align:center">'+label+"</div>"}function beacon_ie_polyline_label(vectors,xArray,yArray){for(var i=1;i<xArray.length;i++)beacon_ie_line_label(vectors,xArray[i-1],yArray[i-1],xArray[i],yArray[i])}function beacon_ff_polyline_label(vectors,xArray,yArray){for(var i=xArray.length-1;i>0;i--)beacon_ff_line_label(vectors,xArray[i],yArray[i],xArray[i-1],yArray[i-1])}
function beacon_toolbar(op,toolstate,bId,bSketch){op(mainMapDivName,toolstate,false);if(bId){document.Identify.className="Enabled";document.Selection.className="Enabled"}if(bSketch)document.Point.className="Enabled";document.ZoomIn.className="Enabled";document.ZoomOut.className="Enabled";document.Pan.className="Enabled";document.Measure.className="Enabled";if(document.StreetView)document.StreetView.className="Enabled";if(document.CustomMapTool)document.CustomMapTool.className="Enabled";document.getElementsByName(toolstate).item(0).className=
"Active";if(toolstate!="Measure"){RemoveMapDynamicMeasure();TT_enabled=true}else TT_enabled=false;if(toolstate=="StreetView")TT_enabled=false;else TT_enabled=true;if(toolstate=="CustomMapTool")TT_enabled=false;else TT_enabled=true;if(toolstate=="Selection")ShowSelectTool();else RemoveSelectTool()}var defaultSelectToolMode="rect";function BeaconMapSelect(divname,toolname,showloading){ShowSelectTool(defaultSelectToolMode);PickSelectTool(defaultSelectToolMode);TT_enabled=true}
function ShowIdentifyTool(){TT_enabled=true;return false}function RemoveIdentifyTool(){return false}function ShowSelectTool(){document.getElementById("pnlSelect").style.display="";HiliteSelectTool(defaultSelectToolMode);HiliteSelectChange(document.getElementById("SelectionChangeMode").value);TT_enabled=true;return false}
function RemoveSelectTool(){if(document.getElementById("pnlSelect").style.display=="none")return false;document.getElementById("pnlSelect").style.display="none";ResetEsriMouseclickState();return false}
function HiliteSelectTool(tool){document.getElementById("selectByRectangle").style.fontWeight=tool=="rect"?"bold":"normal";document.getElementById("selectByLine").style.fontWeight=tool=="line"?"bold":"normal";document.getElementById("selectByPolygon").style.fontWeight=tool=="polygon"?"bold":"normal";defaultSelectToolMode=tool}
function HiliteSelectChange(mode){document.getElementById("selectNewSelection").style.fontWeight=mode=="NewSelection"?"bold":"normal";document.getElementById("selectAddToSelection").style.fontWeight=mode=="AddToSelection"?"bold":"normal";document.getElementById("selectRemoveFromSelection").style.fontWeight=mode=="RemoveFromSelection"?"bold":"normal";document.getElementById("SelectionChangeMode").value=mode;return false}
function PickSelectTool(tool){ResetEsriMouseclickState();if(tool=="rect")MapDragRectangle(mainMapDivName,"Selection",false);if(tool=="line")MapPolyline(mainMapDivName,"Selection",false);if(tool=="polygon")MapPolygon(mainMapDivName,"Selection",false);HiliteSelectTool(tool);return false}
function MapStreetView(divname,toolname,showloading){mapSetTool(divname,"StreetView",false,DoStreetview,null,"url(/Images/Streetview.cur),pointer","hidden",-1,"Click on a road to see Google Street View imagery");document.onmousemove=null;document.onmouseup=null;return false}
function DoStreetview(e){if(isLeftButton(e)){getXY(e);getMapDiv(e);adjustMapCoords();var pix_x=mouseX-eLeft;var pix_y=mouseY-eTop;var prj=null;for(var i=0;i<displayPrjList.length;i++)if(displayPrjList[i].mode==1)prj=displayPrjList[i];if(!prj){alert("Street View error");return}var map_x=prj.minx+pix_x*prj.unitsPerPixelX;var map_y=prj.maxy-pix_y*prj.unitsPerPixelY;panoClient=new GStreetviewClient;var p1=new GLatLng(map_y,map_x);panoClient.getNearestPanoramaLatLng(p1,function(g){if(g)window.open("StreetView.aspx?x="+
map_x+"&y="+map_y,"streetview","status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,scrollbars=0,height=600,width=800");else{var areaDiv=document.getElementById(areaDivName);areaDiv.style.cursor="not-allowed";setTimeout(function(){areaDiv.style.cursor="url(/Images/Streetview.cur),pointer"},1E3)}})}return false};
function Click_ShowMapTips(){if($("#chkEnableMapTips").is(":checked"))$.cookie("DisableMapTips",null);else $.cookie("DisableMapTips","YES",{expires:60})}
$(function(){if(window.tipLayerId===undefined)return;if(jQuery.cookie("DisableMapTips")=="YES")$("#chkEnableMapTips").attr("checked",false);else $("#chkEnableMapTips").attr("checked",true);if(tipLayerId==-1){$("#mapTipsPanel").hide();return}var objMapDiv=$("#MapImage_"+mainMapDivName.replace(/\$/g,"\\$"));objMapDiv.mousemove(TT_mouseTracking);objMapDiv.mouseout(TT_removeFromView);objMapDiv.click(TT_removeFromView);$("#Form1").submit(TT_disable);var toolmode=document.forms["Form1"].elements[mainMapDivName+
"_mode"].value;TT_enabled=toolmode!="Measure";$(window).bind("beforeunload",TT_disable)});var TT_TimerID=-1;var TT_lastX=-100;var TT_lastY=-100;var TT_enabled=false;
function TT_mouseTracking(event){if(!TT_enabled)return;var offset=$(event.target).offset();var x=event.clientX-offset.left+$(window).scrollLeft();var y=event.clientY-offset.top+$(window).scrollTop();var px=event.pageX;var py=event.pageY;if(Math.abs(TT_lastX-x)>3||Math.abs(TT_lastY-y)>3){TT_remove();if(TT_TimerID!=-1){clearTimeout(TT_TimerID);TT_TimerID=-1}TT_TimerID=setTimeout(function(){TT_show(x,y,px,py)},750);TT_lastX=x;TT_lastY=y}}
function TT_disable(event){TT_enabled=false;TT_removeFromView(event)}function TT_removeFromView(event){if(TT_TimerID!=-1){clearTimeout(TT_TimerID);TT_TimerID=-1}TT_remove()}function TT_remove(){$("#BT").remove()}
function TT_show(mapX,mapY,pageX,pageY){if(!TT_enabled)return;if(!$("#chkEnableMapTips").is(":checked"))return;if(TT_TimerID==-1)return;var url="/maptipservice.aspx?layerid="+tipLayerId+"&x="+mapX+"&y="+mapY;var title="Loading data...";TT_remove();var tipWidth=320;var act_left=pageX;var act_width=330;var left=act_left+act_width+12;var top=pageY;var arrowDir="left";var arrowLeft=-10;var arrowTop=-3;var shadowTop=-7;var shadowLeft=-7;if(mapX>250){arrowDir="right";left=act_left-12-tipWidth-10;arrowLeft=
tipWidth;arrowTop=-1;if(document.all)arrowLeft-=2}else{arrowTop=-2;left=act_left+12+10}top-=12;arrowDir="title_"+arrowDir;var tthtml="<div id='BT' class='BT_shadow0' style='top:"+(top-shadowTop-8)+"px; left:"+(left-shadowLeft-8)+"px;display:none;'>"+"<div class='BT_shadow1'>"+"<div class='BT_shadow2'>"+"<div id='BT_main' style='width:"+tipWidth+"px; top:"+shadowTop+"px; left:"+shadowLeft+"px; height:100%'>"+"<div id='BT_arrow_"+arrowDir+"' style='top: "+arrowTop+"px; left:"+arrowLeft+"px;'></div>"+
"<div id='BT_title'>"+title+"</div>"+"<div style='padding-left:5px'>"+"<div id='BT_content'>"+"<div class='BT_loader' style='padding:5px'></div>"+"</div>"+"</div>"+"</div></div></div></div>";$("body").append(tthtml);$("#BT").show();$.ajax({url:url,timeout:1E4,type:"GET",dataType:"html",cache:false,success:function(response,status){if(!$("#BT"))return;$("#BT_content").html(response);var objPid=$(".MapTip_ParcelId");var parcelid=objPid.length>0?objPid.html():"";if(parcelid=="")$("#BT_title").html("&nbsp;");
else{$("#BT_title").html("Parcel ID: "+parcelid);$("#ttPidLine").remove()}try{}catch(ex){}return response},error:function(){if(!$("#BT"))return;$("#BT_title").html("&nbsp;");$("#BT_content").html("&nbsp;&nbsp;<br>An error has occurred while requesting data<br>");try{}catch(ex){}}});TT_TimerID=-1};
var parcelId="";var ddlWexfordAction;var wexford;function Wexford_Action(){var actionId=ddlWexfordAction.value;if(actionId==-1)return false;try{wexford.Show(parcelId,actionId)}catch(ex){alert("Unable to display: "+ex)}ddlWexfordAction.options[0].selected=true;return false}function Wexford_SetMenuVisibility(visible){if(visible)document.getElementById("wexfordActionDiv").style.display="";else document.getElementById("wexfordActionDiv").style.display="none"}
function Wexford_ParseURL(){var url=document.location;var r=/keyvalue=([^\&\s]+)/i;var a=r.exec(url);if(a){parcelId=a[1];return true}else return false}
function Wexford_Init(){ddlWexfordAction=document.getElementById("ddlWexfordAction");try{if(Wexford_ParseURL()==false){Wexford_SetMenuVisibility(false);return false}try{wexford=new ActiveXObject("ripple.BrowserExtension.ActionInvoker")}catch(ex){}if(!wexford)wexford=new ActiveXObject("Wexford.BrowserExtension.ActionInvoker");var actionCount=wexford.GetActionCount();if(actionCount==0){Wexford_SetMenuVisibility(false);return false}for(i=0;i<actionCount;i++){var oOption=document.createElement("OPTION");
ddlWexfordAction.add(oOption);oOption.innerText=wexford.GetActionName(i);oOption.value=i}Wexford_SetMenuVisibility(true)}catch(ex){Wexford_SetMenuVisibility(false);return false}};
function JohnsonCountyIA_Invoke(lng,lat,x,y){window.open("/Pictometry/PictometryViewer.aspx?x="+lng+"&y="+lat,"pictometry","status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,scrollbars=0,height=600,width=800")}function ActivateCustomMapTool(divname,toolname,showloading){mapSetTool(divname,"CustomMapTool",false,DoCustomToolAction,null,"crosshair","hidden",-1,customMapToolName);document.onmousemove=null;document.onmouseup=null;return false}
function DoCustomToolAction(e){if(isLeftButton(e)){getXY(e);getMapDiv(e);adjustMapCoords();var pix_x=mouseX-eLeft;var pix_y=mouseY-eTop;var prjLatLong=null;for(var i=0;i<displayPrjList.length;i++)if(displayPrjList[i].mode==1)prjLatLong=displayPrjList[i];if(!prjLatLong){alert("Custom map tool error");return}var ll_x=prjLatLong.minx+pix_x*prjLatLong.unitsPerPixelX;var ll_y=prjLatLong.maxy-pix_y*prjLatLong.unitsPerPixelY;var prjMap=displayPrjList[0];if(!prjMap){alert("Custom map tool error");return}var map_x=
prjMap.minx+pix_x*prjMap.unitsPerPixelX;var map_y=prjMap.maxy-pix_y*prjMap.unitsPerPixelY;eval(activeAppName+"_Invoke(ll_x, ll_y, map_x, map_y);")}return false};
var loadingFile="loading.gif";var loadBannerWidth=120;var loadBannerHeight=24;var loadingSettings=new Array;var isNav=window.navigator.appName.toLowerCase().indexOf("netscape")>=0;var isIE=window.navigator.appName.toLowerCase().indexOf("microsoft")>=0;var userAgent=navigator.userAgent;var navType="IE";var nav70=false;
if(isNav){nav70=userAgent.indexOf("Netscape/7.0")!=-1;if(userAgent.indexOf("FireFox")!=-1)navType="FireFox";else if(userAgent.indexOf("Opera")!=-1)navType="Opera";else if(userAgent.indexOf("Safari")!=-1)navType="Safari";else if(userAgent.indexOf("Netscape")!=-1)navType="Netscape";else navType="Mozilla"}if(isIE){document.writeln('<xml:namespace ns="urn:schemas-microsoft-com:vml" prefix="v"/>\n');document.writeln('<style type="text/css"> v\\:* { behavior: url(#default#VML);} </style>\n')}var doc=document;
var mouseX=0;var mouseY=0;var x1=0;var y1=0;var x2=0;var y2=0;var zleft=0;var ztop=0;var zright=0;var zbottom=0;var drawBox=false;var dragImage=false;var lineWidth=3;var docFormID="0";var divWidth=500;var divHeight=500;var divLeft=0;var divTop=0;var divObj;var divId;var divIndex=0;var divControl;var divParentIndex=0;var divParentLeft=0;var divParentTop=0;var leftButton=1;var rightButton=2;if(isNav){leftButton=1;rightButton=3}var mapCounter=0;var pageCounter=1;var Maps=new Array;var Pages=new Array;
Pages[0]="";var mapURL=new Array;var pageURL=new Array;var pageIndex;var pageMapIndex;var Toolbars=new Array;var ToolbarGroups=new Array;var winWidth=getWinWidth();var winHeight=getWinHeight();var promptString="";var savedCursor="pointer";var zoomBoxStyle="";var zoomBoxOpacity=35;var eLeft=0;var eTop=0;var eWidth=0;var eHeight=0;var hasMarkup=false;var hasPanels=false;var hasMagnify=false;var objString="";var divColor="#FF0000";var xycoords=new Array;var vo=new Array;var vectorMode=new Array;
var vectorCount=new Array;var pix=new Array;var xycoord=new Array;var areaDivName="MapDiv_Map1";var lineDivName="LineDiv";var areaDivObj=new Array;var lineDivObj=new Array;var jumpToFinish=false;var coordString="";var statusString="";var controlType="Map";var vectortoolbar="VectorToolbar";
function MapCreation(controlname,parentindex,index,left,top,width,height,uniquedivid,dragBoxColor,dragLineWidth){if(dragLineWidth==null)dragLineWidth=3;this.controlname=controlname;this.parentindex=parentindex;this.index=index;this.left=left;this.top=top;this.width=width;this.height=height;this.right=left+width;this.bottom=top+height;this.UniqueDivID=uniquedivid;this.DragBoxColor=dragBoxColor;this.DragLineWidth=dragLineWidth}
function createLayer(name,inleft,intop,width,height,visible,content,classname){document.write('<div id="'+name+'" style="background-color:transparent; position:absolute; overflow:hidden; left:'+inleft+"px; top:"+intop+"px; width:"+width+"px; height:"+height+"px;"+";  visibility:"+(visible?"visible;":"hidden;")+'"');if(classname!=null&&classname!="")document.write(' class="'+classname+'"');document.writeln(">");document.writeln(content);document.writeln("</div>")}
function createLayerWithStyle(name,inleft,intop,width,height,visible,content,classname,style){document.write('<div id="'+name+'" style=" position:absolute; overflow:hidden; left:'+inleft+"px; top:"+intop+"px; width:"+width+"px; height:"+height+"px;"+";  visibility:"+(visible?"visible;":"hidden;")+style+'"');if(classname!=null&&classname!="")document.write(' class="'+classname+'"');document.writeln(">");document.writeln(content);document.writeln("</div>")}
function createLayerWithEvents(name,inleft,intop,width,height,visible,content,classname,mousedownevt,mouseupevt,mousemoveevt,mouseoverevt,mouseoutevt){document.write('<div id="'+name+'" style="background-color:transparent; position:absolute; overflow:hidden; left:'+inleft+"px; top:"+intop+"px; width:"+width+"px; height:"+height+"px;"+";  visibility:"+(visible?"visible;":"hidden;")+'"');if(classname!=null&&classname!="")document.write(' class="'+classname+'"');if(mousedownevt!=null&&mousedownevt!=
"")document.write(' onmousedown="'+mousedownevt+'"');if(mouseupevt!=null&&mouseupevt!="")document.write(' onmouseup="'+mouseupevt+'"');if(mousemoveevt!=null&&mousemoveevt!="")document.write(' onmousemove="'+mousemoveevt+'"');if(mouseoverevt!=null&&mouseoverevt!="")document.write(' onmouseover="'+mouseoverevt+'"');if(mouseoutevt!=null&&mouseoutevt!="")document.write(' onmouseout="'+mouseoutevt+'"');document.writeln(">");document.writeln(content);document.writeln("</div>")}
function getLayer(name){var theObj=document.getElementById(name);if(theObj!=null)return theObj.style;else return null}function setLayerBackgroundColor(name,color){var layer=getLayer(name);layer.backgroundColor=color}function setDivZOrder(name,zvalue){var layer=getLayer(name);layer.zIndex=zvalue}function hideLayer(name){var layer=getLayer(name);if(layer!=null)layer.visibility="hidden";return false}
function showLayer(name){var layer=getLayer(name);if(layer!=null)layer.visibility="visible";return false}function moveLayer(name,x,y){var layer=getLayer(name);if(layer!=null){layer.left=x+"px";layer.top=y+"px"}return false}function replaceLayerContent(name,content){var theObj=document.getElementById(name);if(theObj!=null)theObj.innerHTML=content}
function getXY(e){if(isNav){mouseX=e.pageX;mouseY=e.pageY}else{var theDoc=document;var theBody=theDoc.body;mouseX=event.clientX+theBody.scrollLeft;mouseY=event.clientY+theBody.scrollTop}return false}function clipLayer(name,clipleft,cliptop,clipright,clipbottom){var layer=getLayer(name);if(layer!=null){var newWidth=clipright-clipleft;var newHeight=clipbottom-cliptop;layer.height=newHeight;layer.width=newWidth;layer.top=cliptop+"px";layer.left=clipleft+"px"}return false}
function panClipLayer(name,clipleft,cliptop,clipright,clipbottom){var layer=getLayer(name);if(layer!=null)layer.clip="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")";return false}function getWinWidth(){var mapFrameWidth=window.innerWidth;if(mapFrameWidth==null)mapFrameWidth=document.body.clientWidth;return mapFrameWidth}function getWinHeight(){var mapFrameHeight=window.innerHeight;if(mapFrameHeight==null)mapFrameHeight=document.body.clientHeight;return mapFrameHeight}
function adjustMapCoords(){var blurb="";zleft=mouseX-(divParentLeft+divLeft);ztop=mouseY-(divParentTop+divTop);blurb="Map: "+divId+"\nX="+zleft+"\nY="+ztop;return blurb}function isLeftButton(e){var theButton=0;var isLeft=false;if(isNav)theButton=e.which;else theButton=window.event.button;if(theButton==leftButton)isLeft=true;return isLeft}
function convertNSrgb(color){var h=color;if(h.indexOf("rgb")!=-1){var re=/%20/gi;var h2=h.replace(re,"");endpos=h2.indexOf(")");var h3=h2.substring(4,endpos);var ha=h3.split(",");var r=parseInt(ha[0]).toString(16);if(r.length==1)r="0"+r;var g=parseInt(ha[1]).toString(16);if(g.length==1)g="0"+g;var b=parseInt(ha[2]).toString(16);if(b.length==1)b="0"+b;color=r+g+b}return color}
function checkPrompt(mode){var cancel=false;switch(mode.toLowerCase()){case "markupdeletebox":case "markupdeleterectangle":cancel=!confirm("This will delete all Markup elements completely within the box.\nContinue?",true);break}return cancel}
function calcElementPosition(elementId){var element=document.getElementById(elementId);eLeft=0;eTop=0;var eLeftBorder,eTopBorder;eWidth=parseInt(element.style.width);eHeight=parseInt(element.style.height);while(element!=null){eLeftBorder=0;eTopBorder=0;eLeft+=element.offsetLeft;eTop+=element.offsetTop;if(element.style.borderWidth!=""){eLeftBorder=parseInt(element.style.borderWidth);eTopBorder=parseInt(element.style.borderWidth)}else if(element.style.borderLeftWidth!=""){eLeftBorder=parseInt(element.style.borderLeftWidth);
eTopBorder=parseInt(element.style.borderTopWidth)}if(isNaN(eLeftBorder))eLeftBorder=0;if(isNaN(eTopBorder))eTopBorder=0;eLeft+=eLeftBorder;eTop+=eTopBorder;element=element.offsetParent}}function postBack(control,eventArg){__doPostBack(control,eventArg);var mode=document.forms[docFormID].elements[control+"_mode"].value;var showLoading=loadingSettings[control+mode];if(showLoading)ShowLoading()}
function tocAutoLayerVisibility(e){var o;if(isNav&&e!=null)o=e.target;else o=window.event.srcElement;if(o.tagName=="INPUT"&&o.type=="checkbox"&&o.name!=null&&o.name.indexOf("CheckBox")>-1)__doPostBack("","")}function checkForFormElement(formId,elemName){var hasIt=false;if(document.forms[formId].elements[elemName]!=null)hasIt=true;return hasIt}
function LoadDiv(imagePath){if(imagePath==null)imagePath="/aspnet_client/esri_arcgis_server_webcontrols/9_2/images";winWidth=getWinWidth();winHeight=getWinHeight();var loadBannerLeft=parseInt((winWidth-loadBannerWidth)/2);var loadBannerTop=parseInt((winHeight-loadBannerHeight)/2);var content='<img src="'+imagePath+"/"+loadingFile+'" width="'+loadBannerWidth+'" height="'+loadBannerHeight+'" border="0" alt="" align="absmiddle" hspace="0" vspace="0">';createLayerWithStyle("Loading",loadBannerLeft,loadBannerTop,
loadBannerWidth,loadBannerHeight,false,content,"","Z-INDEX: 9999;")}function ShowLoading(){showLayer("Loading")}function HideLoading(){hideLayer("Loading")}
function ZoomBoxDiv(image){if(image==null)image="/aspnet_client/esri_arcgis_server_webcontrols/9_2/images/pixel.gif";content='<img name="zoomImagmaxY" src='+image+" width=1 height=1>";var style="border-color:Black;border-width:3px;border-style:Solid;";var zbo=zoomBoxOpacity/100;var platform=navigator.platform;if(platform=="Win32"||platform=="MacPPC"&&!isIE)if(navigator.userAgent.indexOf("Opera")==-1)style+="background-color: White; opacity: "+zbo+"; -moz-opacity: "+zbo+"; filter: alpha(opacity="+
zoomBoxOpacity+");";createLayerWithStyle("zoomBoxTop",-1,-1,1,1,false,content,null,style);setDivZOrder("zoomBoxTop",9991)}function setClip(inSize){if(inSize==null)inSize=3;var lSize=parseInt(inSize)-1;if(lSize<1)lSize=1;var tempX=x1;var tempY=y1;if(x1>x2){zright=x1;zleft=x2}else{zleft=x1;zright=x2}if(y1>y2){zbottom=y1;ztop=y2}else{ztop=y1;zbottom=y2}if(x1!=x2&&y1!=y2)clipZoomBox(zleft,ztop,zright,zbottom,null,inSize);return false}
function displayZoomBox(left,top,right,bottom,color,size){clipZoomBox(left,top,right,bottom,color,size);showLayer("zoomBoxTop")}function hideZoomBox(){window.scrollTo(0,0);hideLayer("zoomBoxTop");hideLayer("mapTop")}
function clipZoomBox(left,top,right,bottom,color,size){var obj=getLayer("zoomBoxTop");if(obj!=null){if(size==null)if(pageIndex>0)size=Pages[pageIndex].DragLineWidth;else size=Maps[divIndex].DragLineWidth;var w=right-left;var h=bottom-top;if(isNav){w-=size*2;h-=size*2}if(w<1)w=1;if(h<1)h=1;obj.left=left+"px";obj.top=top+"px";obj.width=w+"px";obj.height=h+"px";if(color!=null)obj.borderColor=color;obj.borderWidth=size+"px";obj.cursor="crosshair"}}
function DeleteVector(){if(vectorMode[areaDivName]==1||vectorMode[areaDivName]==2){vo[areaDivName].clearObjects();if(vectorCount[areaDivName]>0)vectorCount[areaDivName]--;if(xycoord[areaDivName].x.length>0){var n=xycoord[areaDivName].x.length-1;xycoord[areaDivName].x.length=n;xycoord[areaDivName].y.length=n;if(vectorMode[areaDivName]==1)vo[areaDivName].polyline(xycoord[areaDivName].x,xycoord[areaDivName].y);else if(vectorCount[areaDivName]>2)vo[areaDivName].polygon(xycoord[areaDivName].x,xycoord[areaDivName].y);
else vo[areaDivName].polyline(xycoord[areaDivName].x,xycoord[areaDivName].y);vo[areaDivName].drawObjects()}}}function RestartVectors(){vectorCount[areaDivName]=0;xycoord[areaDivName].x=new Array;xycoord[areaDivName].y=new Array;areaDivObj.onmousemove=null;areaDivObj.ondblclick=null;lineDivObj.onmousemove=null;lineDivObj.ondblclick=null;vo[areaDivName].clearObjects();vo[areaDivName].drawObjects()}
function CancelVectors(){vectorCount[areaDivName]=0;xycoord[areaDivName].x=new Array;xycoord[areaDivName].y=new Array;areaDivObj.onmousemove=null;areaDivObj.ondblclick=null;areaDivObj.onclick=null;lineDivObj.onmousemove=null;lineDivObj.ondblclick=null;lineDivObj.onclick=null;vo[areaDivName].clearObjects();vo[areaDivName].drawObjects()}function clearObjects(){this.objString=""}function drawObjects(){this.divObj.innerHTML=this.objString}function setObjectColor(color){this.divColor=color}
function addToObject(divleft,divtop,divwidth,divheight){this.objString+='<div style="position: absolute;left: '+divleft+"px;top: "+divtop+"px;width: "+divwidth+"px;height: "+divheight+"px;overflow:hidden;background-color: "+this.divColor+';"></div>'}
function addToObjectColor(divleft,divtop,divwidth,divheight,divcolor){if(divcolor==null||divcolor=="")divcolor=this.divColor;this.objString+='<div style="position: absolute;left: '+divleft+"px;top: "+divtop+"px;width: "+divwidth+"px;height: "+divheight+"px;overflow:hidden;background-color: "+divcolor+';"></div>'}
function line(inX1,inY1,inX2,inY2){if(this.lineWidth<1)this.lineWidth=1;if(inX1>inX2){var tempX=inX2;var tempY=inY2;inX2=inX1;inY2=inY1;inX1=tempX;inY1=tempY}var pwidth=inX2-inX1;var pheight=Math.abs(inY2-inY1);var x=inX1;var y=inY1;var increment=1;if(inY1>inY2)increment=-1;var xoffset=x;var yoffset=y;var size=this.lineWidth;var flex_size=size;var size_adjust=0;var rl1=pheight*2;var rl2=rl1-pwidth*2;var rl3=rl1-pwidth;if(pwidth>=pheight){if(size>1){if(size>3){flex_size=(size*pwidth*Math.sqrt(1+pheight*
pheight/(pwidth*pwidth))-pwidth-(size>>1)*pheight)/pwidth;flex_size=(!(size>4)?Math.ceil(flex_size):Math.round(flex_size))+1}size_adjust=Math.ceil(size/2)}while(pwidth>0){++x;if(rl3>0){this.addToObject(xoffset,y,x-xoffset+size_adjust,flex_size);y+=increment;rl3+=rl2;xoffset=x}else rl3+=rl1;pwidth--}this.addToObject(xoffset,y,inX2-xoffset+size_adjust+1,flex_size)}else{size_adjust=1;if(size>1){if(size>3){flex_size=(size*pheight*Math.sqrt(1+pwidth*pwidth/(pheight*pheight))-(size>>1)*pwidth-pheight)/
pheight;flex_size=(!(size>4)?Math.ceil(flex_size):Math.round(flex_size))+1}size_adjust=Math.round(size/2)}rl1=pwidth*2;rl2=rl1-pheight*2;rl3=rl1-pheight;if(inY2<=inY1){while(pheight>0){if(rl3>0){this.addToObject(x,y,flex_size,yoffset-y+size_adjust);x++;y+=increment;rl3+=rl2;yoffset=y}else{y+=increment;rl3+=rl1}pheight--}this.addToObject(inX2,inY2,flex_size,yoffset-inY2+size_adjust)}else{if(size==1)size_adjust=0;while(pheight>0){y+=increment;if(rl3>0){this.addToObject(x,yoffset,flex_size,y-yoffset+
size_adjust);x++;rl3+=rl2;yoffset=y}else rl3+=rl1;pheight--}this.addToObject(inX2,yoffset,flex_size,inY2-yoffset+size_adjust+1)}}}function ie_line(inX1,inY1,inX2,inY2){if(this.lineWidth<1)this.lineWidth=1;this.objString+='<v:line from="'+inX1+","+inY1+'" to="'+inX2+","+inY2+'"><v:stroke weight="'+this.lineWidth+'px" color="'+this.divColor+'" /></v:line>\n'}function polyline(xArray,yArray){for(var i=xArray.length-1;i>0;i--)this.line(xArray[i],yArray[i],xArray[i-1],yArray[i-1])}
function ie_polyline(xArray,yArray){var str="";for(var i=0;i<xArray.length;i++){if(i>0)str+=" ";str+=xArray[i]+" "+yArray[i]}this.objString+='<v:polyline points="'+str+'"><v:stroke weight="'+this.lineWidth+'px" color="'+this.divColor+'" /><v:fill on="false" opacity="0.0" /></v:polyline>\n'}function polygon(xArray,yArray){var lastVector=xArray.length-1;this.polyline(xArray,yArray);this.line(xArray[lastVector],yArray[lastVector],xArray[0],yArray[0])}
function ie_polygon(xArray,yArray){var str="";for(var i=0;i<xArray.length;i++){if(i>0)str+=" ";str+=xArray[i]+" "+yArray[i]}str+=" "+xArray[0]+" "+yArray[0];this.objString+='<v:polyline points="'+str+'"><v:stroke weight="'+this.lineWidth+'px" color="'+this.divColor+'" /><v:fill on="false" opacity="0.0" /></v:polyline>\n'}
function oval(ovleft,ovtop,inwidth,inheight){if(this.lineWidth<1)this.lineWidth=1;var size=this.lineWidth;var ovwidth=inwidth+size-1;var ovheight=inheight+size-1;var halfwidth=Math.floor(ovwidth/2);var halfheight=Math.floor(ovheight/2);var ovw=ovwidth&1;var ovh=(ovheight&1)+1;var centerx=ovleft+halfwidth;var centery=ovtop+halfheight;var x=0;var y=halfheight;var w;var h;var xoff=0;var yoff=halfheight;var hwsq=halfwidth*halfwidth*2;var hhsq=halfheight*halfheight*2;var chpoint=Math.floor(hwsq/2)*(1-
halfheight*2)+hhsq;var chpoint2=Math.floor(hhsq/2)-hwsq*(halfheight*2-1);if(size==1||inwidth<=1||inheight-size<=1){do if(chpoint<0){chpoint+=hhsq*(x*2+3);x++;chpoint2+=hhsq*2*x}else if(chpoint2<0){chpoint+=hhsq*(x*2+3)-hwsq*2*(y-1);x++;chpoint2+=hhsq*2*x-hwsq*(y*2-3);y--;w=x-xoff;h=yoff-y;if(w&2&&h&2){this.addToOval(centerx,centery,-x+1,xoff+ovw,-yoff,yoff-h+1+ovh,w,1);this.addToOval(centerx,centery,-x+1,x-1+ovw,-y-1,y+ovh,1,1)}else this.addToOval(centerx,centery,-x+1,xoff+ovw,-yoff,yoff-h+ovh,w,
h);xoff=x;yoff=y}else{chpoint2-=hwsq*(y*2-3);y--;chpoint-=hwsq*2*y}while(y>0);this.addToObject(centerx-halfwidth,centery-yoff,halfwidth-xoff+1,yoff*2+ovh);this.addToObject(centerx+xoff+ovw,centery-yoff,halfwidth-xoff+1,yoff*2+ovh)}else{var left_point,top_point,bottom_point,right_point;if(size<3&&(size>2||ovwidth>33&&ovheight>33)){do if(chpoint<0){chpoint+=hhsq*(x*2+3);x++;chpoint2+=hhsq*2*x}else if(chpoint2<0){chpoint+=hhsq*(x*2+3)-hwsq*2*(y-1);x++;chpoint2+=hhsq*2*x-hwsq*(y*2-3);y--;w=x-xoff;h=yoff-
y;if(w-1){right_point=w+1+(size&1);h=size}else if(h-1){right_point=size;h+=1+(size&1)}else{right_point=size;h=size}this.addToOval(centerx,centery,-x+1,xoff-right_point+w+ovw,-yoff,-h+yoff+ovh,right_point,h);xoff=x;yoff=y}else{chpoint2-=hwsq*(y*2-3);y--;chpoint-=hwsq*2*y}while(y>0);this.addToObject(centerx-halfwidth,centery-yoff,size,yoff*2+ovh);this.addToObject(centerx+halfwidth+ovw-size+1,centery-yoff,size,yoff*2+ovh)}else{var hw=Math.floor((ovwidth-(size-1)*2)/2);var hh=Math.floor((ovheight-(size-
1)*2)/2);var xx=0;var yy=hh;var hwsq2=hw*hw*2;var hhsq2=hh*hh*2;var chpoint3=Math.floor(hwsq2/2)*(1-hh*2)+hhsq2;var chpoint4=Math.floor(hhsq2/2)-hwsq2*(hh*2-1);left_point=new Array;top_point=new Array;bottom_point=new Array;left_point[0]=0;top_point[0]=halfheight;bottom_point[0]=hh-1;do{if(chpoint<0){chpoint+=hhsq*(x*2+3);x++;chpoint2+=hhsq*2*x;left_point[left_point.length]=x;top_point[top_point.length]=y}else if(chpoint2<0){chpoint+=hhsq*(x*2+3)-hwsq*2*(y-1);x++;chpoint2+=hhsq*2*x-hwsq*(y*2-3);y--;
left_point[left_point.length]=x;top_point[top_point.length]=y}else{chpoint2-=hwsq*(y*2-3);y--;chpoint-=hwsq*2*y}if(yy>0)if(chpoint3<0){chpoint3+=hhsq2*(xx*2+3);xx++;chpoint4+=hhsq2*2*xx;bottom_point[bottom_point.length]=yy-1}else if(chpoint4<0){chpoint3+=hhsq2*(xx*2+3)-hwsq2*2*(yy-1);xx++;chpoint4+=hhsq2*2*xx-hwsq2*(yy*2-3);yy--;bottom_point[bottom_point.length]=yy-1}else{chpoint4-=hwsq2*(yy*2-3);yy--;chpoint3-=hwsq2*2*yy;bottom_point[bottom_point.length-1]--}}while(y>0);var yoff2=bottom_point[0];
var l=left_point.length;for(var i=0;i<l;i++)if(bottom_point[i]!=null){if(bottom_point[i]<yoff2||top_point[i]<yoff){x=left_point[i];this.addToOval(centerx,centery,-x+1,xoff+ovw,-yoff,yoff2+ovh,x-xoff,yoff-yoff2);xoff=x;yoff=top_point[i];yoff2=bottom_point[i]}}else{x=left_point[i];this.addToObject(centerx-x+1,centery-yoff,1,yoff*2+ovh);this.addToObject(centerx+xoff+ovw,centery-yoff,1,yoff*2+ovh);xoff=x;yoff=top_point[i]}this.addToObject(centerx-halfwidth,centery-yoff,1,yoff*2+ovh);this.addToObject(centerx+
xoff+ovw,centery-yoff,1,yoff*2+ovh)}}}function ie_oval(ovleft,ovtop,inwidth,inheight){this.objString+='<v:oval style="width:'+inwidth+"px; height:"+inheight+"px; position:absolute; top:"+ovtop+"px; left:"+ovleft+'px;">';this.objString+='<v:fill on="false" opacity="0.0" /><v:stroke weight="'+this.lineWidth+'px" color="'+this.divColor+'" /></v:oval>'}
function addToOval(centerx,centery,dleft,dright,dtop,dbottom,dwidth,dheight){this.addToObject(centerx+dleft,centery+dtop,dwidth,dheight);this.addToObject(centerx+dright,centery+dtop,dwidth,dheight);this.addToObject(centerx+dright,centery+dbottom,dwidth,dheight);this.addToObject(centerx+dleft,centery+dbottom,dwidth,dheight)}
function circle(centerX,centerY,radius,addcrosshair){var ovwidth=radius*2;var ovleft=centerX-radius;var ovtop=centerY-radius;if(addcrosshair)if(isIE){this.line(centerX-4,centerY,centerX+4,centerY);this.line(centerX,centerY-4,centerX,centerY+4)}else{this.addToObject(centerX-4,centerY,9,1);this.addToObject(centerX,centerY-4,1,9)}this.oval(ovleft,ovtop,ovwidth,ovwidth)}
function box(leftX,topY,rightX,bottomY){var xArray=new Array;var yArray=new Array;xArray[0]=leftX;yArray[0]=topY;xArray[1]=rightX;yArray[1]=topY;xArray[2]=rightX;yArray[2]=bottomY;xArray[3]=leftX;yArray[3]=bottomY;this.polygon(xArray,yArray)}
function vectorObjects(divid){this.objString="";this.divColor=divColor;this.divId=divid;this.divObj=document.getElementById(divid);this.lineWidth=lineWidth;this.clearObjects=clearObjects;this.drawObjects=drawObjects;this.setObjectColor=setObjectColor;this.circle=circle;this.box=box;if(isIE){this.addToObject=null;this.line=ie_line;this.polyline=ie_polyline;this.polygon=ie_polygon;this.oval=ie_oval;this.addToOval=null}else{this.addToObject=addToObject;this.line=line;this.polyline=polyline;this.polygon=
polygon;this.oval=oval;this.addToOval=addToOval}}function pixelObject(controlname,inleft,intop,inwidth,inheight){this.x1=0;this.y1=0;this.x2=0;this.y2=0;this.lastX=-99999;this.lastY=-99999;this.divLeft=inleft;this.divTop=intop;this.divWidth=inwidth;this.divHeight=inheight;this.controlname=controlname}function coordList(){this.x=new Array;this.y=new Array};
function MakeMapDiv(mapIndex,control,imageurl,cellname,tooltip){var d="MapDiv_"+control;var di="MapImage_"+control;var m=Maps[mapIndex];var imgwidth=m.width;var imgheight=m.height;var s="";if(cellname==null||cellname=="")s+="<table cellspacing=0 cellpadding=0 width="+m.width+'><tr><td id="MapCell_'+control+'">';s+='<div id="MapControlDiv_'+control+'" style=" position: relative; width: '+m.width+"px; height: "+m.height+'px; overflow:hidden;">\n';s+='<div id="'+d+'" style="position: absolute; left: 0px; top: 0px; background-color: White; width: '+
imgwidth+"px; height: "+imgheight+'px; overflow:hidden;">\n';s+='\t<img id="'+di+'" alt="'+tooltip+'"  title="'+tooltip+'" src="'+imageurl+'" width="'+imgwidth+'" height="'+imgheight+'" hspace="0" vspace="0" border="0">\n';s+="</div>\n";var ldiv="LineDiv_"+control;s+='<div id="'+ldiv+'" style="background-color:transparent; position:absolute; left:0px; top:0px; visibility: hidden; overflow:hidden; width:'+m.width+"px; height:"+m.height+'px;"></div>';s+="</div>\n";if(cellname==null||cellname==""){s+=
"</td></tr></table>";document.writeln(s)}else{var obj=document.getElementById(cellname);obj.innerHTML=s}setDivZOrder(ldiv,950+mapIndex);vo[d]=new vectorObjects(ldiv);vo[d].lineWidth=m.DragLineWidth;vo[d].divColor=m.DragBoxColor;pix[d]=new pixelObject(control,m.left,m.top,m.width,m.height);xycoord[d]=new coordList}
function ClearVectorEvents(divid){var linedivname="LineDiv_"+divid;var areadivname="MapDiv_"+divid;areaDivName=areadivname;lineDivName=linedivname;hideLayer(lineDivName);var vd=document.getElementById(areaDivName);if(vd!=null){vd.onclick=null;vd.onmousedown=null;vd.onmousemove=null;vd.ondblclick=null}}function MapDragImage(divid,mode,showLoading){mapSetTool(divid,mode,showLoading,mapDragImageStart,null,"move",-1,"hidden","")}
function MapDragRectangle(divid,mode,showLoading){mapSetTool(divid,mode,showLoading,mapDragRectangleStart,null,"crosshair",-1,"hidden","")}function MapPoint(divid,mode,showLoading){mapSetTool(divid,mode,showLoading,mapPointClick,null,"pointer","hidden",-1,"");document.onmousemove=null;document.onmouseup=null}
function MapLine(divid,mode,showLoading){mapSetTool(divid,mode,showLoading,null,mapVectorClick,"crosshair",0,"hidden","Line - Click to start line. Move cursor to change line and angle. Click again to finish line.")}function MapPolyline(divid,mode,showLoading){mapSetTool(divid,mode,showLoading,mapVectorClick,null,"crosshair",1,"visible","Polyline - Click to start line. Click again to add vectors. Press Ctrl key while clicking, or double-click to add last vector and complete polyline.")}
function MapPolygon(divid,mode,showLoading){mapSetTool(divid,mode,showLoading,mapVectorClick,null,"crosshair",2,"visible","Polygon - Click to start line. Click again to add vectors. Press Ctrl key while clicking, or double-click to add last vector and complete polygon.")}function MapCircle(divid,mode,showLoading){mapSetTool(divid,mode,showLoading,null,mapVectorClick,"crosshair",3,"hidden","Circle - Click for center of circle. Move cursor to resize circle. Click again to complete circle.")}
function MapDragCircle(divid,mode,showLoading){mapSetTool(divid,mode,showLoading,mapVectorMouseDown,null,"crosshair",3,"hidden","")}function MapOval(divid,mode,showLoading){mapSetTool(divid,mode,showLoading,null,mapVectorClick,"crosshair",4,"hidden","Oval - Click for start of oval. Move cursor to resize oval. Click again to complete oval.")}function MapDragOval(divid,mode,showLoading){mapSetTool(divid,mode,showLoading,mapVectorMouseDown,null,"crosshair",4,"hidden","")}
function MapBox(divid,mode,showLoading){mapSetTool(divid,mode,showLoading,null,mapVectorClick,"crosshair",5,"hidden","Box - Click for start of box. Move cursor to resize box. Click again to complete box.")}function MapDragBox(divid,mode,showLoading){mapSetTool(divid,mode,showLoading,mapVectorMouseDown,null,"crosshair",5,"hidden","")}
function mapSetTool(divid,mode,showLoading,mouseDownFunction,clickFunction,cursor,vectormode,vectorToolbarState,statusMessage){if(divid==null||divid=="")divid="Map1";areaDivName="MapDiv_"+divid;lineDivName="LineDiv_"+divid;var areaDiv=document.getElementById(areaDivName);areaDiv.style.visibility="visible";areaDiv.onclick=clickFunction;areaDiv.onmousedown=mouseDownFunction;areaDiv.style.cursor=cursor;showLayer(areaDivName);if(vectormode>-1){showLayer(lineDivName);var lineDiv=document.getElementById(lineDivName);
lineDiv.onclick=clickFunction;lineDiv.onmousedown=mouseDownFunction;lineDiv.style.cursor=cursor;areaDivObj[areaDivName]=areaDiv;lineDivObj[areaDivName]=lineDiv;vectorMode[areaDivName]=vectormode;vectorCount[areaDivName]=0;var tb=document.getElementById(vectortoolbar);if(tb!=null)tb.style.visibility=vectorToolbarState;hideLayer("PageMaskDiv_"+divid)}else hideLayer(lineDivName);drawBox=false;dragImage=false;var m=divid+"_mode";document.forms[docFormID].elements[m].value=mode;if(showLoading==null)showLoading=
true;loadingSettings[divid+mode]=showLoading;window.status=statusMessage;var hyperDivName="HyperlinkDiv_"+divid;hideLayer(hyperDivName);hideLayer("InfoPopUp");promptString=""}function mapDragImageStart(e){if(isLeftButton(e)){drawBox=false;if(!dragImage){dragImage=true;getXY(e);getMapDiv(e);x1=mouseX;y1=mouseY;x2=x1+1;y2=y1+1;document.onmousemove=mapDragImageMove;document.onmouseup=mapDragImageUp}}return false}
function mapDragRectangleStart(e){if(isLeftButton(e)){dragImage=false;if(!drawBox){drawBox=true;getXY(e);getMapDiv(e);x1=mouseX;y1=mouseY;x2=x1+1;y2=y1+1;displayZoomBox(x1,y1,x2,y2,Maps[divIndex].DragBoxColor);document.onmousemove=mapDragRectangleMove;document.onmouseup=mapDragRectangleUp}}return false}
function mapPointClick(e){if(isLeftButton(e)){getXY(e);getMapDiv(e);divObj.style.cursor="wait";adjustMapCoords();var f=document.forms[docFormID];f.minx.value=zleft;f.miny.value=ztop;postBack(Maps[divIndex].controlname,"point")}return false}
function mapVectorClick(e){if(vectorCount[areaDivName]==0){getXY(e);getMapDiv(e);areaDivObj[areaDivName].onmousemove=mapVectorMove;areaDivObj[areaDivName].ondblclick=mapVectorEnd;lineDivObj[areaDivName].onmousemove=mapVectorMove;lineDivObj[areaDivName].ondblclick=mapVectorEnd;controlType="map"}var ctrl=isNav?e.modifiers&Event.CONTROL_MASK:window.event.ctrlKey;getXY(e);pix[areaDivName].x2=mouseX-eLeft;pix[areaDivName].y2=mouseY-eTop;if(pix[areaDivName].lastX==pix[areaDivName].x2&&pix[areaDivName].lastY==
pix[areaDivName].y2||ctrl)mapVectorEnd(e);else{if(vectorCount[areaDivName]==0){pix[areaDivName].x1=mouseX-eLeft;pix[areaDivName].y1=mouseY-eTop;xycoord[areaDivName].x=new Array;xycoord[areaDivName].y=new Array;xycoord[areaDivName].x[0]=pix[areaDivName].x1;xycoord[areaDivName].y[0]=pix[areaDivName].y1}else switch(vectorMode[areaDivName]){case 0:vo[areaDivName].clearObjects();vo[areaDivName].line(pix[areaDivName].x1,pix[areaDivName].y1,pix[areaDivName].x2,pix[areaDivName].y2);vo[areaDivName].drawObjects();
jumpToFinish=true;break;case 1:var n=xycoord[areaDivName].x.length;xycoord[areaDivName].x[n]=pix[areaDivName].x2;xycoord[areaDivName].y[n]=pix[areaDivName].y2;vo[areaDivName].clearObjects();vo[areaDivName].polyline(xycoord[areaDivName].x,xycoord[areaDivName].y);vo[areaDivName].drawObjects();break;case 2:var n=xycoord[areaDivName].x.length;xycoord[areaDivName].x[n]=pix[areaDivName].x2;xycoord[areaDivName].y[n]=pix[areaDivName].y2;vo[areaDivName].clearObjects();if(vectorCount[areaDivName]>2)vo[areaDivName].polygon(xycoord[areaDivName].x,
xycoord[areaDivName].y);else vo[areaDivName].polyline(xycoord[areaDivName].x,xycoord[areaDivName].y);vo[areaDivName].drawObjects();break;case 3:var dwidth=Math.abs(pix[areaDivName].x2-pix[areaDivName].x1);var dheight=Math.abs(pix[areaDivName].y2-pix[areaDivName].y1);var dradius;if(dwidth==0||dheight==0)dradius=dwidth==0?dheight:dwidth;else dradius=Math.sqrt(dwidth*dwidth+dheight*dheight);vo[areaDivName].clearObjects();vo[areaDivName].circle(pix[areaDivName].x1,pix[areaDivName].y1,dradius,true);vo[areaDivName].drawObjects();
jumpToFinish=true;break;case 4:var dwidth=Math.abs(pix[areaDivName].x2-pix[areaDivName].x1);var dheight=Math.abs(pix[areaDivName].y2-pix[areaDivName].y1);var dleft=pix[areaDivName].x1<pix[areaDivName].x2?pix[areaDivName].x1:pix[areaDivName].x2;var dtop=pix[areaDivName].y2<pix[areaDivName].y1?pix[areaDivName].y2:pix[areaDivName].y1;vo[areaDivName].clearObjects();vo[areaDivName].oval(dleft,dtop,dwidth,dheight);vo[areaDivName].drawObjects();jumpToFinish=true;break;case 5:var dwidth=Math.abs(pix[areaDivName].x2-
pix[areaDivName].x1);var dheight=Math.abs(pix[areaDivName].y2-pix[areaDivName].y1);var dleft=pix[areaDivName].x1<pix[areaDivName].x2?pix[areaDivName].x1:pix[areaDivName].x2;var dtop=pix[areaDivName].y2<pix[areaDivName].y1?pix[areaDivName].y2:pix[areaDivName].y1;vo[areaDivName].clearObjects();vo[areaDivName].box(dleft,dtop,dleft+dwidth,dtop+dheight);vo[areaDivName].drawObjects();jumpToFinish=true;break}vectorCount[areaDivName]++;pix[areaDivName].lastX=pix[areaDivName].x2;pix[areaDivName].lastY=pix[areaDivName].y2;
if(jumpToFinish)mapVectorEnd(e)}return false}
function getMapDiv(e){divLeft=0;divTop=0;divWidth=0;divHeight=0;for(var i=0;i<Maps.length;i++){var dc=Maps[i];calcElementPosition("MapDiv_"+dc.controlname);if(mouseX>=eLeft&&mouseX<=eLeft+eWidth&&mouseY>=eTop&&mouseY<=eTop+eHeight){divIndex=i;divLeft=eLeft;divTop=eTop;divWidth=eWidth;divHeight=eHeight;divParentIndex=0;divParentLeft=0;divParentTop=0;divId="MapDiv_"+dc.controlname;divControl=dc.controlname;lineWidth=dc.DragBoxWidth;divObj=document.getElementById("MapDiv_"+dc.controlname);areaDivName=
"MapDiv_"+dc.controlname;lineDivName="LineDiv_"+dc.controlname;break}}}
function mapDragImageMove(e){if(dragImage){getXY(e);x2=mouseX;y2=mouseY;if(x2<divLeft+divParentLeft)x2=divLeft+divParentLeft;if(x2>divWidth+divLeft+divParentLeft)x2=divWidth+divLeft+divParentLeft;if(y2<divTop+divParentTop)y2=divTop+divParentTop;if(y2>divHeight+divTop+divParentTop)y2=divHeight+divTop+divParentTop;var xMove=x2-x1;var yMove=y2-y1;if(divParentIndex==0){var cLeft=-xMove;var cTop=-yMove;var cRight=divWidth;var cBottom=divHeight;if(xMove>0){cLeft=0;cRight=divWidth-xMove}if(yMove>0){cTop=
0;cBottom=divHeight-yMove}moveLayer(divId,xMove,yMove);panClipLayer(divId,cLeft,cTop,cRight,cBottom)}else{var cLeft=divLeft-xMove;var cTop=divTop-yMove;var cRight=divLeft+divWidth;var cBottom=divTop+divHeight;if(xMove>0){cLeft=divLeft;cRight=divLeft+divWidth-xMove}if(yMove>0){cTop=divTop;cBottom=divTop+divHeight-yMove}moveLayer(divId,xMove+divParentLeft,yMove+divParentTop);panClipLayer(divId,cLeft,cTop,cRight,cBottom)}}return false}
function mapDragRectangleMove(e){if(drawBox){getXY(e);x2=mouseX;y2=mouseY;if(x2<divLeft)x2=divLeft;if(x2>divWidth+divLeft)x2=divWidth+divLeft;if(y2<divTop)y2=divTop;if(y2>divHeight+divTop)y2=divHeight+divTop;setClip(Maps[divIndex].DragLineWidth)}return false}
function mapVectorMove(e){getXY(e);adjustMapCoords();pix[areaDivName].x2=mouseX-eLeft;pix[areaDivName].y2=mouseY-eTop;switch(vectorMode[areaDivName]){case 0:vo[areaDivName].clearObjects();vo[areaDivName].line(pix[areaDivName].x1,pix[areaDivName].y1,pix[areaDivName].x2,pix[areaDivName].y2);vo[areaDivName].drawObjects();break;case 1:var n=xycoord[areaDivName].x.length-1;vo[areaDivName].clearObjects();if(vectorCount[areaDivName]>1){vo[areaDivName].polyline(xycoord[areaDivName].x,xycoord[areaDivName].y);
vo[areaDivName].line(pix[areaDivName].x2,pix[areaDivName].y2,xycoord[areaDivName].x[n],xycoord[areaDivName].y[n])}else if(vectorCount[areaDivName]>0)vo[areaDivName].line(pix[areaDivName].x1,pix[areaDivName].y1,pix[areaDivName].x2,pix[areaDivName].y2);vo[areaDivName].drawObjects();break;case 2:var n=vectorCount[areaDivName];if(vectorCount[areaDivName]>0)if(vectorCount[areaDivName]==1){vo[areaDivName].clearObjects();vo[areaDivName].line(xycoord[areaDivName].x[0],xycoord[areaDivName].y[0],pix[areaDivName].x2,
pix[areaDivName].y2);vo[areaDivName].drawObjects()}else if(vectorCount[areaDivName]>0){var tempx=xycoord[areaDivName].x;var tempy=xycoord[areaDivName].y;tempx[n]=pix[areaDivName].x2;tempy[n]=pix[areaDivName].y2;vo[areaDivName].clearObjects();vo[areaDivName].polygon(tempx,tempy);vo[areaDivName].drawObjects()}vo[areaDivName].drawObjects();break;case 3:var dwidth=Math.abs(pix[areaDivName].x2-pix[areaDivName].x1);var dheight=Math.abs(pix[areaDivName].y2-pix[areaDivName].y1);var dradius;if(dwidth==0||
dheight==0)dradius=dwidth==0?dheight:dwidth;else dradius=Math.sqrt(dwidth*dwidth+dheight*dheight);vo[areaDivName].clearObjects();vo[areaDivName].circle(pix[areaDivName].x1,pix[areaDivName].y1,dradius,true);vo[areaDivName].drawObjects();break;case 4:var dwidth=Math.abs(pix[areaDivName].x2-pix[areaDivName].x1);var dheight=Math.abs(pix[areaDivName].y2-pix[areaDivName].y1);var dleft=pix[areaDivName].x1<pix[areaDivName].x2?pix[areaDivName].x1:pix[areaDivName].x2;var dtop=pix[areaDivName].y1<pix[areaDivName].y2?
pix[areaDivName].y1:pix[areaDivName].y2;vo[areaDivName].clearObjects();vo[areaDivName].oval(dleft,dtop,dwidth,dheight);vo[areaDivName].drawObjects();break;case 5:var dwidth=Math.abs(pix[areaDivName].x2-pix[areaDivName].x1);var dheight=Math.abs(pix[areaDivName].y2-pix[areaDivName].y1);var dleft=pix[areaDivName].x1<pix[areaDivName].x2?pix[areaDivName].x1:pix[areaDivName].x2;var dtop=pix[areaDivName].y2<pix[areaDivName].y1?pix[areaDivName].y2:pix[areaDivName].y1;vo[areaDivName].clearObjects();vo[areaDivName].box(dleft,
dtop,dleft+dwidth,dtop+dheight);vo[areaDivName].drawObjects();break}return false}
function mapDragImageUp(e){if(dragImage){dragImage=false;divObj.style.cursor="wait";getXY(e);document.onmousemove=null;document.onmouseup=null;var ixOffset=x2-x1;var iyOffset=y2-y1;var centerx;var centery;var newX;var newY;var dfBlurb="";centerx=Math.round(divWidth/2);centery=Math.round(divHeight/2);newX=centerx-ixOffset;newY=centery-iyOffset;var f=document.forms[docFormID];f.minx.value=newX;f.miny.value=newY;postBack(Maps[divIndex].controlname,"dragimage")}return false}
function mapDragRectangleUp(e){if(drawBox){drawBox=false;divObj.style.cursor="wait";getXY(e);document.onmousemove=null;document.onmouseup=null;hideZoomBox();setClip(Maps[divIndex].DragLineWidth);zleft-=divLeft;zright-=divLeft;zbottom-=divTop;ztop-=divTop;var f=document.forms[docFormID];f.maxx.value=zright;f.maxy.value=zbottom;f.minx.value=zleft;f.miny.value=ztop;var mode=f.elements[Maps[divIndex].controlname+"_mode"].value;var cancel=checkPrompt(mode);if(!cancel){if(checkForFormElement(docFormID,
"PostBackMode"))f.PostBackMode.value=mode;postBack(Maps[divIndex].controlname,"dragrectangle")}else divObj.style.cursor=savedCursor;return false}}
function mapVectorEnd(e){divObj.style.cursor="wait";var restart=false;var clientaction="line";switch(vectorMode[areaDivName]){case 0:coordString=pix[areaDivName].x1+":"+pix[areaDivName].y1+"|"+pix[areaDivName].x2+":"+pix[areaDivName].y2;restart=true;break;case 1:var blurb="PolyLine:\n";coordString="";for(var i=0;i<xycoord[areaDivName].x.length;i++){blurb+="["+(i+1)+"] "+xycoord[areaDivName].x[i]+", "+xycoord[areaDivName].y[i]+"\n";if(i>0)coordString+="|";coordString+=xycoord[areaDivName].x[i]+":"+
xycoord[areaDivName].y[i]}restart=true;clientaction="polyline";break;case 2:var n=xycoord[areaDivName].x.length-1;var m=n-1;if(xycoord[areaDivName].x[m]==xycoord[areaDivName].x[n]&&xycoord[areaDivName].y[m]==xycoord[areaDivName].y[n]){xycoord[areaDivName].x.length=n;xycoord[areaDivName].y.length=n}if(vectorCount[areaDivName]>2){var blurb="Polygon:\n";coordString="";for(var i=0;i<xycoord[areaDivName].x.length;i++){blurb+="["+(i+1)+"] "+xycoord[areaDivName].x[i]+", "+xycoord[areaDivName].y[i]+"\n";
if(i>0)coordString+="|";coordString+=xycoord[areaDivName].x[i]+":"+xycoord[areaDivName].y[i]}coordString+="|"+xycoord[areaDivName].x[0]+":"+xycoord[areaDivName].y[0];restart=true;clientaction="polygon"}else alert("A Polygon needs at least three vectors.");break;case 3:var dwidth=Math.abs(pix[areaDivName].x2-pix[areaDivName].x1);var dheight=Math.abs(pix[areaDivName].y2-pix[areaDivName].y1);var dradius;if(dwidth==0||dheight==0)dradius=dwidth==0?dheight:dwidth;else dradius=Math.sqrt(dwidth*dwidth+dheight*
dheight);coordString=pix[areaDivName].x1+":"+pix[areaDivName].y1+":"+dradius;restart=true;clientaction="circle";break;case 4:var dwidth=Math.abs(pix[areaDivName].x2-pix[areaDivName].x1);var dheight=Math.abs(pix[areaDivName].y2-pix[areaDivName].y1);var dleft=pix[areaDivName].x1<pix[areaDivName].x2?pix[areaDivName].x1:pix[areaDivName].x2;var dtop=pix[areaDivName].y1<pix[areaDivName].y2?pix[areaDivName].y1:pix[areaDivName].y2;var centerX=dleft+dwidth/2;var centerY=dtop+dheight/2;coordString=centerX+
":"+centerY+":"+dwidth+":"+dheight;restart=true;clientaction="oval";break;case 5:var dwidth=Math.abs(pix[areaDivName].x2-pix[areaDivName].x1);var dheight=Math.abs(pix[areaDivName].y2-pix[areaDivName].y1);var dleft=pix[areaDivName].x1<pix[areaDivName].x2?pix[areaDivName].x1:pix[areaDivName].x2;var dtop=pix[areaDivName].y2<pix[areaDivName].y1?pix[areaDivName].y2:pix[areaDivName].y1;coordString=dleft+":"+dtop+"|"+(dleft+dwidth)+":"+(dtop+dheight);restart=true;clientaction="rectangle";break}if(restart){vectorCount[areaDivName]=
0;xycoord[areaDivName].x=new Array;xycoord[areaDivName].y=new Array;areaDivObj[areaDivName].onmousemove=null;areaDivObj[areaDivName].ondblclick=null;lineDivObj[areaDivName].onmousemove=null;lineDivObj[areaDivName].ondblclick=null;pix[areaDivName].lastX=-9999;pix[areaDivName].lastY=-9999;document.forms[docFormID].coords.value=coordString;if(checkForFormElement(docFormID,"PostBackMode"))document.forms[docFormID].PostBackMode.value=document.forms[docFormID].elements[Maps[divIndex].controlname+"_mode"].value;
postBack(pix[areaDivName].controlname,clientaction)}jumpToFinish=false;return false}
function mapVectorMouseDown(e){getXY(e);getMapDiv(e);areaDivObj[areaDivName].onclick=null;areaDivObj[areaDivName].ondblclick=null;areaDivObj[areaDivName].onmousemove=mapVectorMove;areaDivObj[areaDivName].onmouseup=mapVectorMouseUp;lineDivObj[areaDivName].onclick=null;lineDivObj[areaDivName].ondblclick=null;lineDivObj[areaDivName].onmousemove=mapVectorMove;lineDivObj[areaDivName].onmouseup=mapVectorMouseUp;document.onmousemove=mapVectorMove;document.onmouseup=mapVectorMouseUp;controlType="map";pix[areaDivName].x1=
mouseX-eLeft;pix[areaDivName].y1=mouseY-eTop;vectorCount[areaDivName]=1;pix[areaDivName].lastX=pix[areaDivName].x1;pix[areaDivName].lastY=pix[areaDivName].y1;return false}
function mapVectorMouseUp(e){divObj.style.cursor="wait";var restart=false;var clientaction="line";switch(vectorMode[areaDivName]){case 3:var dwidth=Math.abs(pix[areaDivName].x2-pix[areaDivName].x1);var dheight=Math.abs(pix[areaDivName].y2-pix[areaDivName].y1);var dradius;if(dwidth==0||dheight==0)dradius=dwidth==0?dheight:dwidth;else dradius=Math.sqrt(dwidth*dwidth+dheight*dheight);coordString=pix[areaDivName].x1+":"+pix[areaDivName].y1+":"+dradius;restart=true;clientaction="circle";break;case 5:var dwidth=
Math.abs(pix[areaDivName].x2-pix[areaDivName].x1);var dheight=Math.abs(pix[areaDivName].y2-pix[areaDivName].y1);var dleft=pix[areaDivName].x1<pix[areaDivName].x2?pix[areaDivName].x1:pix[areaDivName].x2;var dtop=pix[areaDivName].y2<pix[areaDivName].y1?pix[areaDivName].y2:pix[areaDivName].y1;coordString=dleft+":"+dtop+"|"+(dleft+dwidth)+":"+(dtop+dheight);restart=true;clientaction="rectangle";break}vectorCount[areaDivName]=0;xycoord[areaDivName].x=new Array;xycoord[areaDivName].y=new Array;areaDivObj[areaDivName].onmousemove=
null;areaDivObj[areaDivName].ondblclick=null;lineDivObj[areaDivName].onmousemove=null;lineDivObj[areaDivName].ondblclick=null;document.onmousemove=null;document.onmouseup=null;pix[areaDivName].lastX=-9999;pix[areaDivName].lastY=-9999;var m=pix[areaDivName].controlname+"_mode";if(checkForFormElement(docFormID,"PostBackMode"))document.forms[docFormID].PostBackMode.value=document.forms[docFormID].elements[m].value;document.forms[docFormID].coords.value=coordString;postBack(pix[areaDivName].controlname,
document.forms[docFormID].elements[m].value);return false};
Beacon.BrowserCompatibility={unsupportedBrowser:false,limitResults:0,inCompatMode:false,isMobile:false,isSmallScreen:false,Detect:function(){var v;var ua=navigator.userAgent;if(/MSIE (\d+\.\d+);/.test(ua)){v=new Number(RegExp.$1);if(document.documentMode)Beacon.BrowserCompatibility.inCompatMode=document.documentMode<8;if(v&&v<9)Beacon.BrowserCompatibility.limitResults=25;Beacon.BrowserCompatibility.unsupportedBrowser=v<7;var msg=""}Beacon.BrowserCompatibility.isMobile=/Mobile/.test(ua);Beacon.BrowserCompatibility.isSmallScreen=
window.screen.height<600||window.screen.width<600},Notify:function(){if(Beacon.BrowserCompatibility.unsupportedBrowser)msg="Internet Explorer 6 is not suitable for viewing this site.  <a href='http://beacongis.com/browser'>Please consider upgrading to a modern browser</a>.";if(Beacon.BrowserCompatibility.inCompatMode){if(msg)msg+="<br>";msg+="It looks like you've enabled Internet Explorer Compatibility View.  Beacon works best if you turn this off.  <a href='http://beacongis.com/browser'>Learn how</a>"}if(msg){var n=
$("#headerNotifications");var n1=$("#headerNotification1");n1.html(msg);n.show()}}};
Beacon.Protocol.BeaconFeature=OpenLayers.Class(OpenLayers.Protocol,{callback:null,scope:null,bounds:null,useSelection:true,wktParser:null,initialize:function(options){options=options||{};OpenLayers.Protocol.prototype.initialize.apply(this,arguments);this.wktParser=new OpenLayers.Format.WKT},destroy:function(){OpenLayers.Protocol.prototype.destroy.apply(this);this.wktParser.destroy()},read:function(options){OpenLayers.Protocol.prototype.read.apply(this,arguments);options=OpenLayers.Util.applyDefaults(options,
this.options);var resp=new OpenLayers.Protocol.Response({requestType:"read"});var ext=null;if(options.filter&&options.filter.type=="BBOX"){var b=options.filter.value;ext=b}this.readFeatures(this.useSelection,ext,Beacon.API.SpatialRelation.Intersects,null,function(features){resp.features=features;resp.code=OpenLayers.Protocol.Response.SUCCESS;options.callback.call(options.scope,resp)},function(e){resp.code=OpenLayers.Protocol.Response.FAILURE;options.callback.call(options.scope,resp)},this);return resp},
readFeatures:function(useSelection,geom,spatialRelation,maxFeatures,success,failure,scope,scopeArgs){var t=this;var extent=null;var wkt=null;if(geom)if(geom instanceof OpenLayers.Bounds)extent=geom;else wkt=this.wktParser.write({geometry:geom});var featureLimit=Beacon.BrowserCompatibility.limitResults||maxFeatures||0;Beacon.API.GetVectorLayer(mapConfig.LayerId,useSelection,extent,wkt,spatialRelation,featureLimit,function(result){var features=t.processQueryResult(result);var args=[features];if(scopeArgs)args=
args.concat(scopeArgs);success.apply(scope,args)},function(e){var args=[e];if(scopeArgs)args=args.concat(scopeArgs);failure.apply(scope,args)},scope,scopeArgs)},processQueryResult:function(results){var featureCount=results.length;var features=[];for(var i=0;i<featureCount;i++){var f1=results[i];var feature=this.wktParser.read(f1.WktGeometry);if(feature);else feature=new OpenLayers.Feature.Vector(null);feature.attributes={key:f1.Key};feature.fid=f1.Key;feature.html=f1.ResultHtml;feature.tipHtml=f1.TipHtml;
feature.parentId=f1.ParentId;feature.childIds=f1.ChildIds;features.push(feature)}return features},CLASS_NAME:"Beacon.Protocol.BeaconFeature"});
Beacon.Layer.AgsCache=OpenLayers.Class(OpenLayers.Layer.Grid,{serviceVersion:"1.0.0",isBaseLayer:true,tileOrigin:null,initialize:function(name,url,options){var base=mapConfig.TileHost;var url2;if(url.charAt(0)=="/"&&base)url2=["http://i0."+base+url,"http://i1."+base+url,"http://i2."+base+url,"http://i3."+base+url];else url2=url;var newArguments=[];newArguments.push(name,url2,{},options);OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments)},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,
arguments)},clone:function(obj){if(obj==null)obj=new Beacon.Layer.AgsCache(this.name,this.url,this.getOptions());obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj},bestLevel:function(res){for(var level=0;level<this.resolutions.length;level++)if(res>=this.resolutions[level])return level;return this.resolutions.length-1},calculateGridLayout:function(bounds,extent,resolution){var tilelon=resolution*this.tileSize.w;var tilelat=resolution*this.tileSize.h;var offsetlon=bounds.left-
this.tileOrigin.lon;var tilecol=Math.floor(offsetlon/tilelon)-this.buffer;var tilecolremain=offsetlon/tilelon-tilecol;var tileoffsetx=-tilecolremain*this.tileSize.w;var tileoffsetlon=this.tileOrigin.lon+tilecol*tilelon;var offsetlat=this.tileOrigin.lat-bounds.top;var tilerow=Math.floor(offsetlat/tilelat)-this.buffer;var tilerowremain=tilerow-offsetlat/tilelat;var tileoffsety=tilerowremain*this.tileSize.h;var tileoffsetlat=this.tileOrigin.lat-tilerow*tilelat-tilelat;return{tilelon:tilelon,tilelat:tilelat,
tileoffsetlon:tileoffsetlon,tileoffsetlat:tileoffsetlat,tileoffsetx:tileoffsetx,tileoffsety:tileoffsety}},getURL:function(bounds){bounds=this.adjustBounds(bounds);var res=this.map.getResolution();var z=this.resolutions!=null?OpenLayers.Util.indexOf(this.resolutions,res):this.map.getZoom();var x=Math.round((bounds.left-this.tileOrigin.lon)/(res*this.tileSize.w));var y=Math.round((this.tileOrigin.lat-bounds.top)/(res*this.tileSize.h));var path;path="/tile/"+z+"/"+y+"/"+x;var url;if(this.url instanceof
Array)url=this.selectUrl(path,this.url);else url=this.url;return url+path},addTile:function(bounds,position){return new OpenLayers.Tile.Image(this,position,bounds,null,this.tileSize)},setMap:function(map){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments);if(!this.tileOrigin)this.tileOrigin=new OpenLayers.LonLat(this.map.maxExtent.left,this.map.maxExtent.bottom)},CLASS_NAME:"Beacon.Layer.AgsCache"});
Beacon.Layer.Beacon=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{},beaconServerId:null,beaconLayerIds:null,singleLayerSource:false,serverType:null,tileSize:null,async:true,name:"Beacon",isBaseLayer:true,overview:false,eventDelay:null,drawable:true,DEFAULT_OPTIONS:{tileSize:new OpenLayers.Size(512,512),isBaseLayer:true,async:true,name:"Beacon"},initialize:function(name,url,options){this.tileSize=new OpenLayers.Size(512,512);this.params=OpenLayers.Util.applyDefaults({},this.DEFAULT_PARAMS);
this.options=OpenLayers.Util.applyDefaults(options,this.DEFAULT_OPTIONS);OpenLayers.Layer.Grid.prototype.initialize.apply(this,[name,url,this.params,options]);if(this.transparent){if(!this.isBaseLayer)this.isBaseLayer=false;if(this.format=="image/jpeg")this.format=OpenLayers.Util.alphaHack()?"image/gif":"image/png"}},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments)},getURL:function(bounds){Beacon.TOC.onZoomEnd(this.map.getResolution());var visibleLayers=Beacon.TOC.getVisibleLayerIdsForServerId(this.beaconServerId);
if(visibleLayers.length==0||!this.drawable)return"/Images/blank.gif";bounds=this.adjustBounds(bounds);var newUrl=this.getFullRequestString({QPS:mapConfig.QPS,svr:this.beaconServerId,minx:bounds.left,miny:bounds.bottom,maxx:bounds.right,maxy:bounds.top,w:this.tileSize.w,h:this.tileSize.h,dpi:96,OV:this.overview?"1":null});return newUrl},addTile:function(bounds,position){return new Beacon.Tile.Image(this,position,bounds,null,this.tileSize)},clone:function(obj){if(obj==null)obj=new Beacon.Layer.Beacon(this.name,
this.url,this.getOptions());obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj},CLASS_NAME:"Beacon.Layer.Beacon"});
Beacon.Layer.SelectionLayer=OpenLayers.Class(OpenLayers.Layer.Vector,{visibility:true,keyFeature:null,keyValue:null,rendererOptions:{zIndexing:true},styleMap:new OpenLayers.StyleMap({"default":new OpenLayers.Style({strokeWidth:2,graphicZIndex:1}),selected:new OpenLayers.Style({strokeWidth:2,graphicZIndex:2}),hovering:new OpenLayers.Style({strokeWidth:2,graphicZIndex:4}),buffer:new OpenLayers.Style({strokeWidth:2,graphicZIndex:3})},{extendDefault:true}),eventDelay:null,initialize:function(keyValue,
options){OpenLayers.Layer.Vector.prototype.initialize.apply(this,arguments);this.setStyleFromConfig("default",options.symbology.selection);this.setStyleFromConfig("selected",options.symbology.key);this.setStyleFromConfig("hovering",options.symbology.hover);this.setStyleFromConfig("buffer",options.symbology.buffer);this.eventDelay=new Beacon.DelayedFunction(this.sendSelectionSetToServer,this,423);this.loadSelectedFeaturesFromServer(keyValue);this.events.register("featureremoved",this,this.removePopupByFeature)},
destroy:function(){this.eventDelay.destroy();this.eventDelay=null},setMap:function(map){OpenLayers.Layer.Vector.prototype.setMap.apply(this,arguments)},sendSelectionSetToServer:function(){var keylist=[];for(i=0;i<this.features.length;i++)keylist.push(this.features[i].fid);Beacon.API.SetResults(mapConfig.LayerId,keylist)},addFeatures:function(features,options){OpenLayers.Layer.Vector.prototype.addFeatures.apply(this,arguments);var feature;for(var i=0,len=features.length;i<len;++i){feature=features[i];
Beacon.ResultsPane.addToSelection(feature.fid,feature.parentId,feature.html,this.onFeatureHover,this.onFeatureClick,this)}this.eventDelay.delayedInvoke()},removeFeatures:function(features,options){var feature;for(var i=0,len=features.length;i<len;++i){feature=features[i];if(feature.fid==this.keyValue)this.setKeyFeature(null);Beacon.ResultsPane.removeFromSelection(feature.fid)}OpenLayers.Layer.Vector.prototype.removeFeatures.apply(this,arguments);this.eventDelay.delayedInvoke()},selectFeatures:function(features,
appendSelection,toggleSelection){if(!appendSelection&&!toggleSelection)this.clearSelection();var selectedFeatures=[];var feature;var existingFeature;for(var i=0,len=features.length;i<len;++i){feature=features[i];existingFeature=this.findFeatureById(feature.fid);if(existingFeature){if(toggleSelection)this.removeFeatures([existingFeature])}else this.addFeatures([feature])}if(this.features.length==1)if(this.keyValue!=this.features[0].fid)this.setKeyFeature(this.features[0]);this.stealParentsGeometry();
Beacon.ResultsPane.updateDisplay(this.features.length,this.keyValue);Beacon.Tabs.generateTabStrip(this.features.length,this.keyValue)},clearSelection:function(){this.destroyFeatures();this.setKeyFeature(null);Beacon.ResultsPane.updateDisplay(this.features.length,this.keyValue);Beacon.Tabs.generateTabStrip(this.features.length,this.keyValue)},setKeyFeature:function(feature){if(!feature&&!this.keyFeature)return;if(feature)if(feature.fid==this.keyValue)return;var old=this.keyFeature;this.keyFeature=
feature;if(feature)this.keyValue=feature.fid;else this.keyValue=null;if(this.keyFeature)this.setSelectionStyle(this.keyFeature,true);if(old)this.setSelectionStyle(old,false);if(this.keyFeature)Beacon.ResultsPane.setKeyFeatureId(this.keyValue);Beacon.Tabs.generateTabStrip(this.features.length,this.keyValue);var updateMapFunction=this.updateMapDetails;var kv=this.keyValue;setTimeout(function(){updateMapFunction(kv)},650)},updateMapDetails:function(keyValue){if(keyValue)Beacon.API.QueryMapDetail(mapConfig.LayerId,
keyValue,function(html){if(html=="")html="No data is available";$("#mapJsDetailDiv").html(html);$("#mapJsDetailDiv").slideDown()},function(err){$("#mapJsDetailDiv").html("Server request failed.");$("#mapJsDetailDiv").slideDown()},this);else $("#mapJsDetailDiv").slideUp()},setSelectionStyle:function(feature,selected){this.drawFeature(feature,selected?"selected":"default")},stealParentsGeometry:function(){for(var i=0,len=this.features.length;i<len;++i){var feature=this.features[i];if(!feature.geometry&&
feature.parentId){var parentFeature=this.findFeatureById(feature.parentId);if(parentFeature)feature.geometry=parentFeature.geometry}}},loadSelectedFeaturesFromServer:function(keyValue){Beacon.MapJS.showActivity("Retrieving selected items");var bfp=new Beacon.Protocol.BeaconFeature;bfp.readFeatures(true,null,Beacon.API.SpatialRelation.None,null,function(features){this.selectFeatures(features,false,false);this.setKeyFeature(this.findFeatureById(keyValue));if(this.keyFeature){if(this.keyFeature.geometry&&
this.keyFeature.geometry.bounds)this.map.zoomToExtent(this.keyFeature.geometry.bounds,false)}else{var ext=this.getDataExtent();if(ext)this.map.zoomToExtent(ext,false)}Beacon.MapJS.enableDynamicLayers();Beacon.MapJS.hideActivity()},function(e){Beacon.MapJS.showRetryActivity()},this)},findFeatureById:function(featureId){for(var i=0,len=this.features.length;i<len;++i)if(this.features[i].fid==featureId)return this.features[i];return null},onFeatureHover:function(featureId,hovering){var feature=this.findFeatureById(featureId);
if(feature)if(hovering)this.drawFeature(feature,"hovering");else this.setSelectionStyle(feature,featureId==this.keyValue)},onFeatureClick:function(featureId){var feature=this.findFeatureById(featureId);if(feature){if(feature.geometry){var pt=feature.geometry.getCentroid();var lonlat=new OpenLayers.LonLat(pt.x,pt.y);Beacon.MapJS.map.zoomToExtent(feature.geometry.getBounds(),false);this.clearPopups();this.showPopupForFeature(feature,null)}if(!feature.geometry)if(feature.parentId)alert("no geom, I should look at "+
feature.parentId);this.setKeyFeature(feature)}},handleMapHoverOver:function(feature){this.drawFeature(feature,"hovering");Beacon.ResultsPane.onFeatureMouseOver(feature.fid)},handleMapHoverOut:function(feature){this.setSelectionStyle(feature,feature.fid==this.keyValue);Beacon.ResultsPane.onFeatureMouseOut(feature.fid)},setStyleFromConfig:function(name,rgba){var style=this.styleMap.styles[name].defaultStyle;style.fillColor="rgb("+rgba.R+","+rgba.G+","+rgba.B+")";style.strokeColor=style.fillColor;style.fillOpacity=
rgba.A;style.strokeOpacity=0.9;style.pointRadius=3;style.graphicName="square"},showPopupForFeature:function(feature,popup){if(!feature)return;var p;if(!popup){var pt=feature.geometry.getCentroid();var lonlat=new OpenLayers.LonLat(pt.x,pt.y);p=new Beacon.Popup.MapTipFrame("maptip2",lonlat,null,"<div class='title'>Loading Information...</div><div class='loader'></div>",{size:new OpenLayers.Size(0,0),offset:new OpenLayers.Pixel(0,0)},true);this.map.addPopup(p)}else p=popup;p.setFeature(feature)},clearPopups:function(){for(var i=
this.map.popups.length-1;i>=0;i--){var p=this.map.popups[i];if(!p.pinned)this.map.removePopup(p)}},clearAllPopups:function(){for(var i=this.map.popups.length-1;i>=0;i--){var p=this.map.popups[i];this.map.removePopup(p)}},removePopupByFeature:function(e){for(var i=this.map.popups.length-1;i>=0;i--){var p=this.map.popups[i];if(p.fid==e.feature.fid&&!p.pinned)this.map.removePopup(p)}},CLASS_NAME:"Beacon.Layer.SelectionLayer"});
Beacon.Popup.MapTipFrame=OpenLayers.Class(OpenLayers.Popup.Framed,{loadMessage:"<div class='title'>Loading Information...</div><div class='loader'></div>",pinned:false,pinDiv:null,fid:null,contentDisplayClass:"olMapTipFrameContent",autoSize:true,panMapIfOutOfView:true,imageSize:new OpenLayers.Size(600,600),isAlphaImage:true,fixedRelativePosition:false,positionBlocks:{bl:{offset:new OpenLayers.Pixel(0,-10),padding:new OpenLayers.Bounds(20,20,30,0),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(20,
20,30,0),position:new OpenLayers.Pixel(-41,-40)},{size:new OpenLayers.Size(30,"auto"),anchor:new OpenLayers.Bounds(null,20,0,0),position:new OpenLayers.Pixel(-536,-40)},{size:new OpenLayers.Size("auto",20),anchor:new OpenLayers.Bounds(20,0,30,null),position:new OpenLayers.Pixel(-41,-384)},{size:new OpenLayers.Size(30,20),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(-536,-384)},{size:new OpenLayers.Size(30,34),anchor:new OpenLayers.Bounds(null,null,0,0),position:new OpenLayers.Pixel(-66,
-430)}]},br:{offset:new OpenLayers.Pixel(0,-10),padding:new OpenLayers.Bounds(20,20,30,0),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(20,20,30,0),position:new OpenLayers.Pixel(-41,-40)},{size:new OpenLayers.Size(30,"auto"),anchor:new OpenLayers.Bounds(null,20,0,0),position:new OpenLayers.Pixel(-536,-40)},{size:new OpenLayers.Size("auto",20),anchor:new OpenLayers.Bounds(20,0,30,null),position:new OpenLayers.Pixel(-41,-384)},{size:new OpenLayers.Size(30,20),anchor:new OpenLayers.Bounds(null,
0,0,null),position:new OpenLayers.Pixel(-536,-384)},{size:new OpenLayers.Size(21,34),anchor:new OpenLayers.Bounds(0,null,null,0),position:new OpenLayers.Pixel(-10,-430)}]}},calculateRelativePosition:function(px){var lonlat=this.map.getLonLatFromLayerPx(px);var extent=this.map.getExtent();var quadrant=extent.determineQuadrant(lonlat);var q=OpenLayers.Bounds.oppositeQuadrant(quadrant);q="b"+q.charAt(1);return q},minSize:new OpenLayers.Size(350-50,50),maxSize:new OpenLayers.Size(300+50-50,346+20),initialize:function(id,
lonlat,contentSize,contentHTML,anchor,closeBox,closeBoxCallback,showUnderMouse){if(showUnderMouse){this.positionBlocks.bl.offset.x=20;this.positionBlocks.br.offset.x=-10}else{this.positionBlocks.bl.offset.x=0;this.positionBlocks.br.offset.x=0}this.imageSrc=OpenLayers.ImgPath+"BeaconMapTip.png";OpenLayers.Popup.Framed.prototype.initialize.apply(this,[id,lonlat,contentSize,contentHTML,anchor,false,null]);this.contentDiv.className=this.contentDisplayClass;this.addCloseBox()},destroy:function(){OpenLayers.Popup.Framed.prototype.destroy.apply(this,
arguments)},registerEvents:function(){OpenLayers.Popup.Framed.prototype.registerEvents.apply(this,arguments);this.events.on({touchstart:this.onmousedown,touchend:this.onmouseup,touchmove:this.onmousemove,scope:this})},setFeature:function(feature){this.fid=feature.fid;if(feature.tipHtml){var tiphtml=feature.tipHtml;tiphtml+=Beacon.Tabs.getReportLinksHtml(feature.fid);this.setContent((feature.fid.length<=6?"Feature data: ":"")+feature.fid,tiphtml)}},setContent:function(titleString,contentHtml){var html=
"<div class='title'><b>"+titleString+"</b></div>";html+="<div class='content'>"+contentHtml+"</div>";this.setContentHTML(html)},togglePin:function(e){if(this.pinDiv.className=="olMaptipPinDown"){this.pinned=false;this.pinDiv.className="olMaptipPinUp"}else{this.pinned=true;this.pinDiv.className="olMaptipPinDown"}},addCloseBox:function(callback){this.closeDiv2=OpenLayers.Util.createDiv(this.id+"_close",null,new OpenLayers.Size(15,15));this.closeDiv2.className="olMaptipCloseBox";this.pinDiv=OpenLayers.Util.createDiv(this.id+
"_pin",null,new OpenLayers.Size(15,15));this.pinDiv.className="olMaptipPinUp";this.groupDiv.appendChild(this.closeDiv2);this.groupDiv.appendChild(this.pinDiv);var closePopup=callback||function(e){this.hide();OpenLayers.Event.stop(e)};OpenLayers.Event.observe(this.closeDiv2,"click",OpenLayers.Function.bindAsEventListener(closePopup,this));OpenLayers.Event.observe(this.pinDiv,"click",OpenLayers.Function.bindAsEventListener(this.togglePin,this))},CLASS_NAME:"Beacon.Popup.MapTipFrame"});
Beacon.Control.ClearMap=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,selectionLayer:null,trigger:function(){try{this.ClearSelection();this.ClearPopups();this.ClearBuffer();Beacon.MapJS.bufferLayer.removeAllFeatures()}catch(e){Beacon.MapJS.showRetryActivity(e,"ClearMap.Trigger")}},ClearSelection:function(){this.selectionLayer.clearSelection()},ClearPopups:function(){for(var i=this.map.popups.length-1;i>=0;i--)this.map.removePopup(this.map.popups[i])},ClearBuffer:function(){if(Beacon.MapJS.bufferLayer.features.length>
0){Beacon.MapJS.bufferLayer.removeAllFeatures();Beacon.API.ClearBufferGeometry()}},initialize:function(selectionLayer,options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.selectionLayer=selectionLayer},destroy:function(){this.selectionLayer=null;OpenLayers.Control.prototype.destroy.apply(this,[])},CLASS_NAME:"Beacon.Control.ClearMap"});
Beacon.Control.ZoomToSelection=OpenLayers.Class(OpenLayers.Control,{selectionLayer:null,type:OpenLayers.Control.TYPE_BUTTON,initialize:function(selectionLayer,options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.selectionLayer=selectionLayer;this.deactivate();this.selectionLayer.events.register("featuresadded",this,this.onFeaturesAdded);this.selectionLayer.events.register("featuresremoved",this,this.onFeaturesRemoved)},trigger:function(){try{if(this.active){var ext=this.selectionLayer.getDataExtent();
if(ext)this.map.zoomToExtent(ext,false)}}catch(e){Beacon.MapJS.showRetryActivity(e,"ZoomToSelection")}},onFeaturesAdded:function(){if(!this.active)this.activate()},onFeaturesRemoved:function(){if(this.active){var hasFeatures=this.selectionLayer.features&&this.selectionLayer.features.length>0;if(!hasFeatures)this.deactivate()}},CLASS_NAME:"Beacon.Control.ZoomToSelection"});
Beacon.DelayedFunction=OpenLayers.Class({timerId:null,callback:null,timeout:null,scope:null,initialize:function(callback,scope,timeout){this.callback=callback;this.timeout=timeout;this.scope=scope},destroy:function(){if(this.timerId){clearTimeout(this.timerId);this.timerId=null}this.callback=null;this.scope=null},delayedInvoke:function(){if(this.timerId){clearTimeout(this.timerId);this.timerId=null}var invcb=this.invoke;var me=this;this.timerId=setTimeout(function(){invcb.call(me)},this.timeout)},
invoke:function(){this.callback.call(this.scope);this.timerId=null},CLASS_NAME:"Beacon.DelayedFunction"});
Beacon.Control.EventSink=OpenLayers.Class({initialize:function(options){},register:function(div){this.events=new OpenLayers.Events(this,div,null,true);this.events.on({mousedown:this.onmousedown,mousemove:this.onmousemove,mouseup:this.onmouseup,mouseout:this.onmouseout,click:this.ignore,dblclick:this.ignore,scope:this})},onmousedown:function(evt){this.mousedown=true;OpenLayers.Event.stop(evt,true)},onmousemove:function(evt){if(this.mousedown)OpenLayers.Event.stop(evt,true)},onmouseup:function(evt){if(this.mousedown){this.mousedown=
false;OpenLayers.Event.stop(evt,true)}},ignore:function(evt){OpenLayers.Event.stop(evt,true)},onmouseout:function(evt){this.mousedown=false},CLASS_NAME:"Beacon.Control.EventSink"});
Beacon.Control.ToolWithAuxControl=OpenLayers.Class(OpenLayers.Control,{useActiveIcon:null,dangle_div:null,contentControl:null,contentControlVisible:false,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.contentControlVisible=false},setMap:function(map){OpenLayers.Control.prototype.setMap.apply(this,arguments)},activate:function(){if(!this.active)this.showContentControl();else this.toggleContentControl();return OpenLayers.Control.prototype.activate.apply(this,
arguments)},deactivate:function(){if(this.active){this.hideContentControl();this.contentControl.deactivate()}return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},createPanel:function(){var vport=$(this.map.viewPortDiv).offset();var ctrl=$(this.panel_div).offset();var spacer=4;var posDangle=new OpenLayers.Pixel(ctrl.left-vport.left-2,ctrl.top-vport.top+28);this.dangle_div=OpenLayers.Util.createDiv(this.id+"dangle",posDangle,new OpenLayers.Size(30,spacer));this.dangle_div.className=
"mapToolbarDangle";this.dangle_div.className+=" olControlNoSelect";this.dangle_div.setAttribute("unselectable","on",0);this.dangle_div.onselectstart=OpenLayers.Function.False;this.dangle_div.style.zIndex=1020;this.map.viewPortDiv.appendChild(this.dangle_div);$(this.dangle_div).hide();var posContainer=new OpenLayers.Pixel(ctrl.left-vport.left-2,ctrl.top-vport.top+28+spacer);this.map.addControl(this.contentControl,posContainer);this.contentControl.deactivate();$(this.contentControl.div).hide();Beacon.Icons.hoverizeToolbar(this.contentControl.div);
if(this.contentControl.controls){var ctrls=this.contentControl.controls;for(var i=0;i<ctrls.length;i++){var c=ctrls[i];if(c.type&&c.type==OpenLayers.Control.TYPE_TOOL)c.events.register("activate",this,this.onSubToolActivate)}if(this.useActiveIcon)this.panel_div.className=ctrls[0].panel_div.className}if(this.useExecuteCompleted){this.contentControl.executeCompleted=this.onSubToolExecuteCompleted;this.contentControl.executeCompletedScope=this}},onSubToolExecuteCompleted:function(){this.hideContentControl()},
onSubToolActivate:function(e){if(this.useActiveIcon){var subTool=e.object;this.panel_div.className=subTool.panel_div.className}},showContentControl:function(){if(!this.contentControlVisible){this.contentControlVisible=true;var t=this;$(this.contentControl.div).hide().slideDown(200);$(this.dangle_div).show();this.contentControl.activate()}},hideContentControl:function(){if(this.contentControlVisible){this.contentControlVisible=false;var t=this;$(this.contentControl.div).slideUp(200,function(){$(t.dangle_div).hide()})}},
toggleContentControl:function(){if(this.contentControlVisible)this.hideContentControl();else this.showContentControl()},CLASS_NAME:"Beacon.Control.ToolWithAuxControl"});
Beacon.Control.HoverSupport=OpenLayers.Class(OpenLayers.Control,{selectionLayer:null,hover:null,enableHovering:true,lastFeature:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,arguments);if(this.enableHovering)this.hover=new OpenLayers.Handler.Feature(this,this.selectionLayer,{over:function(e){this.selectionLayer.handleMapHoverOver.call(this.selectionLayer,e);this.lastFeature=e},out:function(e){this.selectionLayer.handleMapHoverOut.call(this.selectionLayer,e);
this.lastFeature=null}},{stopClick:false,stopUp:false,stopDown:false})},setMap:function(map){OpenLayers.Control.prototype.setMap.apply(this,arguments);if(this.hover)this.hover.setMap(map)},activate:function(){if(!this.active&&this.hover){this.hover.activate();this.lastFeature=null}return OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){if(this.active&&this.hover){this.hover.deactivate();this.lastFeature=null}return OpenLayers.Control.prototype.deactivate.apply(this,
arguments)},stopHovering:function(){if(this.lastFeature){this.selectionLayer.handleMapHoverOut.call(this.selectionLayer,this.lastFeature);this.lastFeature=null}if(this.hover)this.hover.deactivate()},startHovering:function(){if(this.hover)this.hover.activate()},destroy:function(){if(this.hover){this.hover.destroy();this.hover=null}OpenLayers.Control.prototype.destroy.apply(this,arguments)},CLASS_NAME:"Beacon.Control.HoverSupport"});
Beacon.Control.Scalebar=OpenLayers.Class(OpenLayers.Control,{lineDiv:null,sink:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,[options])},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.lineDiv=document.createElement("div");this.lineDiv.className=this.displayClass+"Line";this.div.appendChild(this.lineDiv);this.sink=new Beacon.Control.EventSink;this.sink.register(this.div);this.map.events.register("moveend",this,this.update);this.update();
return this.div},update:function(){var res=this.map.getResolution();if(!res)return;var curMapUnits=this.map.getUnits();var scale=OpenLayers.Util.getScaleFromResolution(res,curMapUnits);this.lineDiv.innerHTML=this.getDisplayScale(scale)},getDisplayScale:function(scale){var ftScale=scale/12;if(ftScale<25)return Math.round(10*ftScale)/10+" ft";if(ftScale<2640)return Math.round(ftScale)+" ft";return Math.round(10*ftScale/5280)/10+" mi"},CLASS_NAME:"Beacon.Control.Scalebar"});
Beacon.Control.Measure=OpenLayers.Class(OpenLayers.Control,{partialDelay:10,delayedTrigger:null,persist:true,html:null,sink:null,ddlLinearUnit:null,ddlAreaUnit:null,btnMeasureDone:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.handler=new Beacon.Handler.MeasuredPath2(this,{done:this.measureComplete,point:this.measureAddPoint,modify:this.measureMove},{persist:this.persist,layerOptions:{styleMap:this.setupDrawingStyle()}});this.ddlLinearUnit=document.getElementById("linearUnit");
this.ddlAreaUnit=document.getElementById("areaUnit");this.btnMeasureDone=document.getElementById("btnMeasureDone");this.html=$("#measureOverlay").detach()},cancel:function(){this.handler.cancel()},measureComplete:function(geometry){if(this.delayedTrigger){window.clearTimeout(this.delayedTrigger);this.delayedTrigger=null}this.measure(geometry,"measure");Beacon.GA.TrackEvent("Measure","Used");this.post_measurement(geometry,this.handler.areaLabel)},measureAddPoint:function(point,geometry){if(this.delayedTrigger){window.clearTimeout(this.delayedTrigger);
this.delayedTrigger=null}this.measure(geometry,true)},measureMove:function(point,sketch){if(this.delayedTrigger)return;this.delayedTrigger=window.setTimeout(OpenLayers.Function.bind(function(){this.measure(sketch.geometry,false);this.delayedTrigger=null},this),this.partialDelay)},measure:function(geometry,pointAdded){if(!geometry)return;var length=this.handler.getLength(geometry);if(length==0){this.hideFinishBtn();return}this.showFinishBtn();var ls=new OpenLayers.Geometry.LinearRing(geometry.components);
ls.addPoint(ls.components[0]);var area=Math.abs(this.handler.getArea(ls));this.updateMeasurement(length.displayRounding().addCommas(),area.displayRounding().addCommas())},activate:function(){var r=OpenLayers.Control.prototype.activate.apply(this);if(r){this.show();this.updateMeasurement(0,0);OpenLayers.Event.observe(this.ddlLinearUnit,"change",OpenLayers.Function.bindAsEventListener(function(){var o=this.ddlLinearUnit.options[this.ddlLinearUnit.selectedIndex];this.changeLinearUnits(o.value,o.text)},
this));OpenLayers.Event.observe(this.ddlAreaUnit,"change",OpenLayers.Function.bindAsEventListener(function(){var o=this.ddlAreaUnit.options[this.ddlAreaUnit.selectedIndex];this.changeAreaUnits(o.value,o.text)},this));OpenLayers.Event.observe(this.btnMeasureDone,"click",OpenLayers.Function.bindAsEventListener(function(){this.onFinishPushed()},this));$("BODY").addClass("disableTextSelection")}return r},deactivate:function(){var r=OpenLayers.Control.prototype.deactivate.apply(this);if(r){this.hide();
OpenLayers.Event.stopObservingElement(this.ddlLinearUnit);OpenLayers.Event.stopObservingElement(this.ddlAreaUnit);$("BODY").removeClass("disableTextSelection");this.clear_measurement()}return r},show:function(){},hide:function(){},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.element=document.createElement("div");this.element.id=this.id+"_frame";OpenLayers.Element.addClass(this.element,this.displayClass+"Frame");$(this.element).append(this.html);this.html.show()}this.div.appendChild(this.element);
this.sink=new Beacon.Control.EventSink;this.sink.register(this.div);return this.div},detachEvents:function(){},updateMeasurement:function(length,area){$("#lengthDisplay").attr("value",length);$("#areaDisplay").attr("value",area)},setupDrawingStyle:function(){var sketchSymbolizers={Point:{pointRadius:4,graphicName:"square",fillColor:"white",fillOpacity:0,strokeWidth:1,strokeOpacity:1,strokeColor:"#d00"},Line:{strokeWidth:2,strokeOpacity:1,strokeColor:"#d00"},Polygon:{strokeWidth:2,strokeOpacity:1,
strokeColor:"#666666",fillColor:"white",fillOpacity:0.3}};var style=new OpenLayers.Style;style.addRules([new OpenLayers.Rule({symbolizer:sketchSymbolizers})]);var styleMap=new OpenLayers.StyleMap({"default":style});return styleMap},changeLinearUnits:function(factor,unitname){this.handler.setLinearUnits(factor,unitname);this.measure(this.handler.getGeometry(),false)},changeAreaUnits:function(factor,unitname){this.handler.setAreaUnits(factor,unitname);this.measure(this.handler.getGeometry(),false)},
clear_measurement:function(){var request={data:"",label:""};$.post("/SaveMeasurement.aspx",request,null,"html")},post_measurement:function(geometry,areaLabel){var pts=geometry.getVertices();var n=pts.length;var data="";for(var i=0;i<n-1;i++){var p1=pts[i];var p2=pts[i+1];var d=p1.distanceTo(p2);var label=d.displayRounding().addCommas();data+=p1.x+"|"+p1.y+"|"+label+" "}data+=pts[n-1].x+"|"+pts[n-1].y+"|eof";var request={data:data,label:areaLabel?areaLabel:""};$.post("/SaveMeasurement.aspx",request,
null,"html")},showFinishBtn:function(){$(this.btnMeasureDone).show()},hideFinishBtn:function(){$(this.btnMeasureDone).hide()},onFinishPushed:function(){this.hideFinishBtn();this.handler.forceComplete();this.handler.dblclick();this.hideFinishBtn()},CLASS_NAME:"Beacon.Control.Measure"});
Beacon.Handler.MeasuredPath2=OpenLayers.Class(OpenLayers.Handler.Path,{tempLabel:null,linearUnits:"ft",linearFactor:1,areaUnits:"acres",areaFactor:43560,areaLabel:null,freehand:false,freehandToggle:null,doubleTouchTolerance:50,persist:true,initialize:function(){OpenLayers.Handler.Path.prototype.initialize.apply(this,arguments)},createFeature:function(pixel){OpenLayers.Handler.Path.prototype.createFeature.apply(this,arguments);this.areaLabel=null},addPoint:function(pixel){OpenLayers.Handler.Path.prototype.addPoint.apply(this,
arguments);if(this.tempLabel){this.layer.removeFeatures([this.tempLabel]);this.tempLabel=null}var pts=this.line.geometry.getVertices();if(pts.length>2){var lastPoint=pts[pts.length-3];this.labelLineSegment(this.point.geometry,lastPoint)}},modifyFeature:function(pixel,drawing){var lonlat=this.control.map.getLonLatFromPixel(pixel);var pt;if(this.line.geometry.components.length>2)pt=this.snapToSelf(lonlat);else pt=lonlat;this.point.geometry.x=pt.lon;this.point.geometry.y=pt.lat;this.callback("modify",
[this.point.geometry,this.getSketch()]);this.point.geometry.clearBounds();this.line.geometry.clearBounds();if(this.tempLabel){this.layer.destroyFeatures([this.tempLabel]);this.tempLabel=null}var pts=this.line.geometry.getVertices();if(pts.length>1){var lastPoint=pts[pts.length-2];this.tempLabel=this.labelLineSegment(this.point.geometry,lastPoint)}this.drawFeature()},destroyPersistedFeature:function(){var features=this.layer.features;for(var i=features.length-1;i>=0;i--){var f=features[i];if(!(f==
this.line||f==this.point))this.layer.removeFeatures([f])}},finishGeometry:function(){var index=this.line.geometry.components.length-1;this.line.geometry.removeComponent(this.line.geometry.components[index]);this.removePoint();this.layer.drawFeature(this.line,this.style);this.labelArea(this.line.geometry);this.finalize()},dblclick:function(evt){OpenLayers.Handler.Path.prototype.dblclick.apply(this,arguments);return false},forceComplete:function(){if(this.tempLabel){this.layer.removeFeatures([this.tempLabel]);
this.tempLabel=null}},labelLineSegment:function(pointA,pointB){var labelFeature=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point((pointA.x+pointB.x)/2,(pointA.y+pointB.y)/2));var length=this.getLength(new OpenLayers.Geometry.LineString([pointA,pointB]));if(length==0)return null;labelFeature.style={label:length.displayRounding().addCommas(),fontWeight:"bold"};this.layer.addFeatures([labelFeature],{silent:true});return labelFeature},labelArea:function(geometry){var ls=new OpenLayers.Geometry.LinearRing(geometry.components);
ls.addPoint(ls.components[0]);var pt1=geometry.components[0];var ptN=geometry.components[geometry.components.length-1];var dClosure=pt1.distanceTo(ptN);if(dClosure==0){var area=Math.abs(this.getArea(ls));var labelFeature=new OpenLayers.Feature.Vector(ls.getCentroid());this.areaLabel=area.displayRounding().addCommas()+" "+this.areaUnits;labelFeature.style={label:this.areaLabel,fontWeight:"bold"};this.layer.addFeatures([labelFeature],{silent:true})}else this.areaLabel=null},getArea:function(geometry){var area,
geomUnits;area=geometry.getArea();geomUnits=this.map.getUnits();var inPerDisplayUnit;inPerDisplayUnit=OpenLayers.INCHES_PER_UNIT["ft"];if(inPerDisplayUnit){var inPerMapUnit=OpenLayers.INCHES_PER_UNIT[geomUnits];area*=Math.pow(inPerMapUnit/inPerDisplayUnit,2)/this.areaFactor}return area},getLength:function(geometry){var length,geomUnits;length=geometry.getLength();geomUnits=this.map.getUnits();var inPerDisplayUnit=OpenLayers.INCHES_PER_UNIT["ft"]*this.linearFactor;if(inPerDisplayUnit){var inPerMapUnit=
OpenLayers.INCHES_PER_UNIT[geomUnits];length*=inPerMapUnit/inPerDisplayUnit}return length},snapToSelf:function(lonlat){var tolerance=this.map.getResolution()*20;var pt=new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat);if(this.line.geometry.components.length>0){var pt1=this.line.geometry.components[0];if(pt1.distanceTo(pt)<tolerance)return new OpenLayers.LonLat(pt1.x,pt1.y)}return lonlat},setLinearUnits:function(factor,unit){this.linearUnits=unit;this.linearFactor=factor},setAreaUnits:function(factor,
unit){this.areaUnits=unit;this.areaFactor=factor},CLASS_NAME:"Beacon.Handler.MeasuredPath2"});
Beacon.Control.Identify=OpenLayers.Class(Beacon.Control.HoverSupport,{wizardName:null,hoverMode:true,initialize:function(options){Beacon.Control.HoverSupport.prototype.initialize.apply(this,arguments);this.initHoverMode()},setMap:function(map){Beacon.Control.HoverSupport.prototype.setMap.apply(this,arguments);this.clickHandler=new OpenLayers.Handler.Click(this,{click:this.onClick});this.hoverHander=new OpenLayers.Handler.Hover(this,{move:this.onHoverMove,pause:this.onHoverPause},{delay:750,pixelTolerance:4})},
activate:function(){if(!this.active){this.clickHandler.activate();this.hoverHander.activate();$("#tdMapOptionsJS").show()}return Beacon.Control.HoverSupport.prototype.activate.apply(this,arguments)},deactivate:function(){if(this.active){this.clickHandler.deactivate();this.hoverHander.deactivate();$("#tdMapOptionsJS").hide()}return Beacon.Control.HoverSupport.prototype.deactivate.apply(this,arguments)},onClick:function(evt){try{if(this.isWizardLayer()){var pt=this.map.getLonLatFromPixel(evt.xy);this.showCitizenInput(pt);
Beacon.GA.TrackEvent("CitizenInput","Click")}else if(!this.hoverMode){this.plantTip(evt,5,this.hoverMode);Beacon.GA.TrackEvent("Identify","Click")}}catch(e){Beacon.MapJS.showRetryActivity(e,"Identify.onClick")}},onHoverMove:function(evt){if(this.hoverMode&&!this.isWizardLayer()){var tgt=evt.target||evt.srcElement;if(this.isDescendentOf(this.map.layerContainerDiv,tgt))this.selectionLayer.clearPopups()}},onHoverPause:function(evt){if(this.hoverMode&&!this.isWizardLayer())if(Beacon.TOC.activeLayer.isLayerInScale()&&
Beacon.TOC.activeLayer.isLayerChecked()){var tgt=evt.target||evt.srcElement;if(this.isDescendentOf(this.map.layerContainerDiv,tgt)){Beacon.GA.TrackEvent("Identify","Hover");this.plantTip(evt,5,false)}}},isWizardLayer:function(){return Beacon.Tabs.hasPageType(5)},isDescendentOf:function(parent,child){if(!child)return false;if(child.parentNode===parent)return true;else return this.isDescendentOf(parent,child.parentNode)},plantTip:function(evt,tolerance,bePinned){var lonlat=this.map.getLonLatFromPixel(evt.xy);
var pix=evt.xy;if(!this.hoverMode||this.isWizardLayer()){this.selectionLayer.clearPopups();this.selectionLayer.clearSelection()}var popup=new Beacon.Popup.MapTipFrame("maptip2",lonlat,null,"<div class='title'>Loading Information...</div><div class='loader'></div>",{size:new OpenLayers.Size(0,0),offset:new OpenLayers.Pixel(0,0)},null,null,this.hoverMode);this.map.addPopup(popup);if(bePinned)popup.togglePin();if(this.hoverMode&&!this.isWizardLayer()){var hoverHandler=this.hoverHander;popup.events.on({mousemove:function(e){hoverHandler.clearTimer();
OpenLayers.Event.stop(e,true)},scope:this})}var cached=this.selectionLayer.getFeatureFromEvent(evt);if(cached&&this.hoverMode&&!this.isWizardLayer())this.displayResult([cached],popup,lonlat);else{var px1=pix.add(-tolerance,-tolerance);var px2=pix.add(tolerance,tolerance);var ext=new OpenLayers.Bounds;ext.extend(this.map.getLonLatFromPixel(px1));ext.extend(this.map.getLonLatFromPixel(px2));var reader=new Beacon.Protocol.BeaconFeature({});reader.readFeatures(false,ext,Beacon.API.SpatialRelation.Intersects,
25,this.displayResult,this.displayError,this,[popup,lonlat]);Beacon.MapJS.showActivity("Identifying item")}},displayError:function(errorMessage,popup){Beacon.MapJS.showRetryActivity();if(!popup)return;popup.setContent("No information available","An error has occurred while requesting map data.")},displayResult:function(results,popup,clickPoint){if(!popup)return;if(results.length>0){var result=this.findBestFeature(results,clickPoint);if(!this.hoverMode||this.isWizardLayer())this.selectionLayer.selectFeatures([result],
false,false);popup.setFeature(result)}else popup.setContent("No information is available","&nbsp;");Beacon.MapJS.hideActivity()},findBestFeature:function(features,clickPosition){if(features.length){var point=new OpenLayers.Geometry.Point(clickPosition.lon,clickPosition.lat);var feature,resultFeature,dist;var minDist=Number.MAX_VALUE;for(var i=0;i<features.length;++i){feature=features[i];if(feature.geometry){dist=point.distanceTo(feature.geometry,{edge:false});if(dist<minDist){minDist=dist;resultFeature=
feature;if(minDist==0)break}}}return resultFeature||features}},showCitizenInput:function(pt){var tiphtml="<div class='title'>"+this.wizardName+"</div>";tiphtml+=Beacon.Tabs.getReportLinksHtml(null,5,"Which form would you like to complete?<br>","<br>","&X="+pt.lon+"&Y="+pt.lat);var popup=new Beacon.Popup.MapTipFrame("maptip2",pt,null,tiphtml,{size:new OpenLayers.Size(0,0),offset:new OpenLayers.Pixel(0,0)},null);this.map.addPopup(popup)},updateOnLayerChange:function(){if(this.isWizardLayer()){var lyr=
Beacon.MapJS.getBeaconLayer(mapConfig.LayerId);this.wizardName=lyr.Name;this.panel_div.title=this.wizardName;this.displayClass="citizeninput"}else{this.panel_div.title="Identify";this.displayClass="identify"}},initHoverMode:function(){if(jQuery.cookie("EHM")=="1"){$("#chkEnableHoverMode")[0].checked=true;this.hoverMode=true}else{$("#chkEnableHoverMode")[0].checked=false;this.hoverMode=false}var that=this;$("#chkEnableHoverMode").change(function(e){that.onHoverModeChanged.apply(that)});Beacon.GA.TrackEvent("HoverMode",
this.hoverMode?"On":"Off")},onHoverModeChanged:function(){if($("#chkEnableHoverMode")[0].checked){$.cookie("EHM","1",{expires:60});this.hoverMode=true}else{$.cookie("EHM",null);this.hoverMode=false}Beacon.GA.TrackEvent("HoverMode",this.hoverMode?"Turned on":"Turned off")},CLASS_NAME:"Beacon.Control.Identify"});
Beacon.Control.Select=OpenLayers.Class(OpenLayers.Control,{modifiers:null,multipleKey:"shiftKey",toggleKey:"ctrlKey",clickTolerance:5,mode:"normal",type:OpenLayers.Control.TYPE_TOOL,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.modifiers={multiple:false,toggle:false};var handlerStyle={pointRadius:4,fillColor:"#fff",fillOpacity:0.1};switch(this.mode){case "normal":this.handler=new OpenLayers.Handler.Box(this,{done:this.onBox},{boxDivClassName:"olHandlerBoxSelectFeature"});
break;case "polygon":this.handler=new OpenLayers.Handler.Polygon(this,{done:this.onPolygon},{freehand:false,freehandToggle:null,doubleTouchTolerance:30,style:{strokeColor:"#00f",strokeWidth:2,pointRadius:4,fillColor:"#fff",fillOpacity:0.3}});break;case "line":this.handler=new OpenLayers.Handler.Path(this,{done:this.onLine},{freehand:false,freehandToggle:null,doubleTouchTolerance:30,style:{strokeColor:"#00f",strokeWidth:2,pointRadius:4,fillColor:"#fff",fillOpacity:0.3}});break;case "freehand":this.handler=
new OpenLayers.Handler.Path(this,{done:this.onLine},{freehand:true,freehandToggle:null,style:{strokeColor:"#00f",strokeWidth:2,pointRadius:4,fillColor:"#fff",fillOpacity:0.3}});var h=this.handler;h.addPoint=function(pixel){this.layer.removeFeatures([this.point]);var lonlat=this.control.map.getLonLatFromPixel(pixel);if(!this.point.geometry.x){this.point.geometry.x=lonlat.lon;this.point.geometry.y=lonlat.lat;this.point.geometry.clearBounds();this.line.geometry.clearBounds()}this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(lonlat.lon,
lonlat.lat));this.line.geometry.addComponent(this.point.geometry,this.line.geometry.components.length);this.layer.addFeatures([this.point]);this.callback("point",[this.point.geometry,this.getGeometry()]);this.callback("modify",[this.point.geometry,this.getSketch()]);this.drawFeature()};break}},onBox:function(position){Beacon.GA.TrackEvent("Select","BoxOrClick");var bounds;if(position instanceof OpenLayers.Bounds){var minXY=this.map.getLonLatFromPixel(new OpenLayers.Pixel(position.left,position.bottom));
var maxXY=this.map.getLonLatFromPixel(new OpenLayers.Pixel(position.right,position.top));bounds=new OpenLayers.Bounds(minXY.lon,minXY.lat,maxXY.lon,maxXY.lat)}else bounds=this.pixelToBounds(position);this.setModifiers(this.handler.dragHandler.evt);this.request(bounds)},onPolygon:function(polygon){this.setModifiers(this.handler.evt);var pts=polygon.components[0].components;if(pts.length==4)if(pts[1].distanceTo(pts[2])==0){var line=new OpenLayers.Geometry.LineString([pts[0],pts[1]]);this.request(line);
Beacon.GA.TrackEvent("Select","Polygon (2pt)");return}if(pts.length==2){var res=this.map.getResolution();bounds=new OpenLayers.Bounds(pts[0].x,pts[0].y,pts[0].x+res,pts[0].y+res);this.request(bounds);Beacon.GA.TrackEvent("Select","Polygon (1pt)");return}this.request(polygon);Beacon.GA.TrackEvent("Select","Polygon");return},onLine:function(line){this.setModifiers(this.handler.evt);var pts=line.components;if(pts.length==1||pts.length==2&&pts[0].distanceTo(pts[1])==0){var res=this.map.getResolution();
bounds=new OpenLayers.Bounds(pts[0].x,pts[0].y,pts[0].x+res,pts[0].y+res);this.request(bounds);Beacon.GA.TrackEvent("Select","Line (1pt)");return}this.request(line);Beacon.GA.TrackEvent("Select","Line")},request:function(geom){Beacon.MapJS.showActivity("Selecting items");var reader=new Beacon.Protocol.BeaconFeature({});reader.readFeatures(false,geom,Beacon.API.SpatialRelation.Intersects,null,this.gotFeatures,function(){Beacon.MapJS.showRetryActivity()},this)},gotFeatures:function(features){try{this.selectionLayer.selectFeatures(features,
this.modifiers.multiple,this.modifiers.toggle);Beacon.MapJS.hideActivity()}catch(e){Beacon.MapJS.showRetryActivity(e,"Select.gotFeatures")}},setModifiers:function(evt){this.modifiers={multiple:evt[this.multipleKey],toggle:evt[this.toggleKey]}},pixelToBounds:function(pixel){var llPx=pixel.add(-this.clickTolerance/2,this.clickTolerance/2);var urPx=pixel.add(this.clickTolerance/2,-this.clickTolerance/2);var ll=this.map.getLonLatFromPixel(llPx);var ur=this.map.getLonLatFromPixel(urPx);return new OpenLayers.Bounds(ll.lon,
ll.lat,ur.lon,ur.lat)},CLASS_NAME:"Beacon.Control.Select"});
Beacon.Control.GoogleStreetview=OpenLayers.Class(OpenLayers.Control,{handler:null,hover:null,cbTimer:null,lastPt:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.handler=new OpenLayers.Handler.Click(this,{click:this.click});this.hover=new OpenLayers.Handler.Hover(this,{move:this.onMove},{pixelTolerance:null,delay:250})},setMap:function(map){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.hover.setMap(map)},activate:function(){if(!this.active){this.loadScript();
this.handler.activate();this.hover.activate();var t=this;this.cbTimer=setInterval(function(){t.onInterval.call(t)},250)}return OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){if(this.active){this.handler.deactivate();this.hover.deactivate();$(this.map.viewPortDiv).removeClass("olCursorNotAllowed");if(this.cbTimer)clearInterval(this.cbTimer);this.cbTimer=null}return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},click:function(evt){Beacon.GA.TrackEvent("Streetview",
"Click");try{var pt=this.unproject(evt.xy);this.isPanoAvailable(pt,this,function(available){if(available)$().colorbox({title:"Google Streetview",iframe:true,innerWidth:"800px",innerHeight:"600px",href:"/Streetview.aspx?x="+pt.lon+"&y="+pt.lat})})}catch(e){Beacon.MapJS.showRetryActivity(e,"GoogleStreetview.Click")}},onMove:function(e){this.lastPt=e.xy},onInterval:function(){if(!this.lastPt)return;var d=this.map.viewPortDiv;var pt=this.unproject(this.lastPt);this.lastPt=null;this.isPanoAvailable(pt,
this,function(available){if(available||!this.active)$(d).removeClass("olCursorNotAllowed");else $(d).addClass("olCursorNotAllowed")})},unproject:function(xy){var pt=this.map.getLonLatFromPixel(xy);var prjLL=new OpenLayers.Projection("EPSG:4326");pt.transform(this.map.projection,prjLL);return pt},isPanoAvailable:function(pt,scope,callback){panoClient=new google.maps.StreetViewService;var p1=new google.maps.LatLng(pt.lat,pt.lon);panoClient.getPanoramaByLocation(p1,50,function(data,status){callback.call(scope,
status==google.maps.StreetViewStatus.OK)})},loadScript:function(){if(window.google&&window.google.maps)return;var script=document.createElement("script");script.type="text/javascript";script.src="http://maps.googleapis.com/maps/api/js?key=AIzaSyCqnu2Xqty28uuX6eMYuvdluSBh3Jxnz-c&sensor=false&callback=gminit1122";document.body.appendChild(script)},CLASS_NAME:"Beacon.Control.GoogleStreetview"});function gminit1122(){};
Beacon.Control.BingMaps=OpenLayers.Class(Beacon.Control.HoverSupport,{clickHandler:null,featureHandler:null,bingGeoRssUrl:"http://www.bing.com/maps/default.aspx?style=b&mapurl=",bingYxUrl:"http://www.bing.com/maps/default.aspx?style=b&lvl=20&cp=",initialize:function(options){Beacon.Control.HoverSupport.prototype.initialize.apply(this,[options]);this.featureHandler=new OpenLayers.Handler.Feature(this,this.selectionLayer,{click:this.showFeature},{stopClick:true,stopDown:true});this.clickHandler=new OpenLayers.Handler.Click(this,
{click:this.click})},setMap:function(map){Beacon.Control.HoverSupport.prototype.setMap.apply(this,arguments);this.featureHandler.setMap(map);this.clickHandler.setMap(map)},activate:function(){if(!this.active){this.clickHandler.activate();this.featureHandler.activate()}return Beacon.Control.HoverSupport.prototype.activate.apply(this,arguments)},deactivate:function(){if(this.active){this.featureHandler.deactivate();this.clickHandler.deactivate()}return Beacon.Control.HoverSupport.prototype.deactivate.apply(this,
arguments)},click:function(evt){try{if(this.hoverGotIt){this.hoverGotIt=false;return}var pt=this.map.getLonLatFromPixel(evt.xy);this.showPoint(pt)}catch(e){Beacon.MapJS.showRetryActivity(e,"BingMaps.Click")}},showFeature:function(feature){Beacon.GA.TrackEvent("BingMaps","Feature");var pfUrl="http://"+document.location.hostname+"/BingParcelFeed.ashx?QPS="+mapConfig.QPS+"&KV="+escape(feature.fid);var url=this.bingGeoRssUrl+escape(pfUrl);window.open(url,"_blank")},showPoint:function(pt){Beacon.GA.TrackEvent("BingMaps",
"Point");var prjLL=new OpenLayers.Projection("EPSG:4326");pt.transform(this.map.projection,prjLL);var url=this.bingYxUrl+pt.lat+"~"+pt.lon;var r=window.open(url,"_blank")},CLASS_NAME:"Beacon.Control.BingMaps"});
Beacon.Control.Pictometry=OpenLayers.Class(Beacon.Control.HoverSupport,{clickHandler:null,featureHandler:null,initialize:function(options){Beacon.Control.HoverSupport.prototype.initialize.apply(this,[options]);this.featureHandler=new OpenLayers.Handler.Feature(this,this.selectionLayer,{click:this.showFeature},{stopClick:true,stopDown:true});this.clickHandler=new OpenLayers.Handler.Click(this,{click:this.click})},setMap:function(map){Beacon.Control.HoverSupport.prototype.setMap.apply(this,arguments);
this.featureHandler.setMap(map);this.clickHandler.setMap(map)},activate:function(){if(!this.active){this.clickHandler.activate();this.featureHandler.activate()}return Beacon.Control.HoverSupport.prototype.activate.apply(this,arguments)},deactivate:function(){if(this.active){this.featureHandler.deactivate();this.clickHandler.deactivate()}return Beacon.Control.HoverSupport.prototype.deactivate.apply(this,arguments)},click:function(evt){Beacon.GA.TrackEvent("Pictometry","Click");Beacon.polFeature=null;
try{var pt=this.map.getLonLatFromPixel(evt.xy);var prjLL=new OpenLayers.Projection("EPSG:4326");pt.transform(this.map.projection,prjLL);var url="/Pictometry/Viewer.aspx?QPS="+mapConfig.QPS+"&x="+pt.lon+"&y="+pt.lat;$().colorbox({title:"Pictometry Image Navigator",iframe:true,innerWidth:"804px",innerHeight:"585px",href:url})}catch(e){Beacon.MapJS.showRetryActivity(e,"Pictometry.click")}},showFeature:function(feature){Beacon.GA.TrackEvent("Pictometry","Feature");var geom=feature.geometry.clone();var prjLL=
new OpenLayers.Projection("EPSG:4326");geom.transform(this.map.projection,prjLL);var pt=geom.getCentroid();var bnds=geom.getBounds();var size=bnds.getWidth()>bnds.getHeight()?bnds.getWidth():bnds.getHeight();Beacon.polFeature=null;if(/MultiPolygon/.test(geom.CLASS_NAME)){var mpGeom=$.map(geom.components,function(polygon){return[$.map(polygon.components,function(ring){return[$.map(ring.components,function(vertex){return{x:vertex.x,y:vertex.y}})]})]});Beacon.polFeature={type:"polygon",size:size,points:mpGeom}}if(/MultiLineString/.test(geom.CLASS_NAME)){var mlGeom=
$.map(geom.components,function(linestring){return[$.map(linestring.components,function(vertex){return{x:vertex.x,y:vertex.y}})]});Beacon.polFeature={type:"line",size:size,points:mlGeom}}if(/MultiPoint/.test(geom.CLASS_NAME)){var mpGeom=$.map(geom.components,function(vertex){return{x:vertex.x,y:vertex.y}});Beacon.polFeature={type:"point",size:null,points:mpGeom}}if(!Beacon.polFeature);var url="/Pictometry/Viewer.aspx?QPS="+mapConfig.QPS+"&x="+pt.x+"&y="+pt.y;$().colorbox({title:"Pictometry Online Viewer",
iframe:true,innerWidth:"804px",innerHeight:"585px",href:url})},CLASS_NAME:"Beacon.Control.Pictometry"});
Beacon.Control.OverviewMap=OpenLayers.Class(OpenLayers.Control,{element:null,ovmap:null,size:new OpenLayers.Size(180,90),layers:null,minRectSize:15,minRectDisplayClass:"RectReplacement",mapOptions:null,handlers:null,maximized:false,initialize:function(options){this.layers=[];this.handlers={};OpenLayers.Control.prototype.initialize.apply(this,[options])},destroy:function(){if(!this.mapDiv)return;if(this.handlers.click)this.handlers.click.destroy();if(this.handlers.drag)this.handlers.drag.destroy();
this.mapDiv.removeChild(this.extentRectangle);this.extentRectangle=null;if(this.rectEvents){this.rectEvents.destroy();this.rectEvents=null}if(this.ovmap){this.ovmap.destroy();this.ovmap=null}this.element.removeChild(this.mapDiv);this.mapDiv=null;this.div.removeChild(this.element);this.element=null;if(this.maximizeDiv){OpenLayers.Event.stopObservingElement(this.maximizeDiv);this.div.removeChild(this.maximizeDiv);this.maximizeDiv=null}if(this.minimizeDiv){OpenLayers.Event.stopObservingElement(this.minimizeDiv);
this.div.removeChild(this.minimizeDiv);this.minimizeDiv=null}this.map.events.un({moveend:this.update,changebaselayer:this.baseLayerDraw,scope:this});OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!(this.layers.length>0))if(this.map.baseLayer){var layer=this.map.baseLayer.clone();this.layers=[layer]}else{this.map.events.register("changebaselayer",this,this.baseLayerDraw);return this.div}this.element=document.createElement("div");
this.element.className=this.displayClass+"Element";this.element.style.display="none";this.mapDiv=document.createElement("div");this.mapDiv.style.width=this.size.w+"px";this.mapDiv.style.height=this.size.h+"px";this.mapDiv.style.position="relative";this.mapDiv.style.overflow="hidden";this.mapDiv.id=OpenLayers.Util.createUniqueID("overviewMap");this.extentRectangle=document.createElement("div");this.extentRectangle.style.position="absolute";this.extentRectangle.style.zIndex=1E3;this.extentRectangle.className=
this.displayClass+"ExtentRectangle";this.element.appendChild(this.mapDiv);this.div.appendChild(this.element);if(!this.outsideViewport){this.div.className+=" "+this.displayClass+"Container";var imgLocation=OpenLayers.Util.getImagesLocation();var img=imgLocation+"layer-switcher-maximize.png";this.maximizeDiv=OpenLayers.Util.createAlphaImageDiv(this.displayClass+"MaximizeButton",null,new OpenLayers.Size(18,18),img,"absolute");this.maximizeDiv.style.display="none";this.maximizeDiv.className=this.displayClass+
"MaximizeButton";OpenLayers.Event.observe(this.maximizeDiv,"click",OpenLayers.Function.bindAsEventListener(this.maximizeControl,this));this.div.appendChild(this.maximizeDiv);var img=imgLocation+"layer-switcher-minimize.png";this.minimizeDiv=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_minimizeDiv",null,new OpenLayers.Size(18,18),img,"absolute");this.minimizeDiv.style.display="none";this.minimizeDiv.className=this.displayClass+"MinimizeButton";OpenLayers.Event.observe(this.minimizeDiv,"click",
OpenLayers.Function.bindAsEventListener(this.minimizeControl,this));this.div.appendChild(this.minimizeDiv);var eventsToStop=["dblclick","mousedown"];for(var i=0,len=eventsToStop.length;i<len;i++){OpenLayers.Event.observe(this.maximizeDiv,eventsToStop[i],OpenLayers.Event.stop);OpenLayers.Event.observe(this.minimizeDiv,eventsToStop[i],OpenLayers.Event.stop)}this.minimizeControl()}else this.element.style.display="";if(this.map.getExtent())this.update();this.map.events.register("moveend",this,this.update);
if(this.maximized)this.maximizeControl();return this.div},baseLayerDraw:function(){this.draw();this.map.events.unregister("changebaselayer",this,this.baseLayerDraw)},rectDrag:function(px){var deltaX=this.handlers.drag.last.x-px.x;var deltaY=this.handlers.drag.last.y-px.y;if(deltaX!=0||deltaY!=0){var rectTop=this.rectPxBounds.top;var rectLeft=this.rectPxBounds.left;var rectHeight=Math.abs(this.rectPxBounds.getHeight());var rectWidth=this.rectPxBounds.getWidth();var newTop=Math.max(0,rectTop-deltaY);
newTop=Math.min(newTop,this.ovmap.size.h-this.hComp-rectHeight);var newLeft=Math.max(0,rectLeft-deltaX);newLeft=Math.min(newLeft,this.ovmap.size.w-this.wComp-rectWidth);this.setRectPxBounds(new OpenLayers.Bounds(newLeft,newTop+rectHeight,newLeft+rectWidth,newTop))}},mapDivClick:function(evt){var pxCenter=this.rectPxBounds.getCenterPixel();var deltaX=evt.xy.x-pxCenter.x;var deltaY=evt.xy.y-pxCenter.y;var top=this.rectPxBounds.top;var left=this.rectPxBounds.left;var height=Math.abs(this.rectPxBounds.getHeight());
var width=this.rectPxBounds.getWidth();var newTop=Math.max(0,top+deltaY);newTop=Math.min(newTop,this.ovmap.size.h-height);var newLeft=Math.max(0,left+deltaX);newLeft=Math.min(newLeft,this.ovmap.size.w-width);this.setRectPxBounds(new OpenLayers.Bounds(newLeft,newTop+height,newLeft+width,newTop));this.updateMapToRect()},maximizeControl:function(e){this.element.style.display="";this.showToggle(false);if(e!=null)OpenLayers.Event.stop(e)},minimizeControl:function(e){this.element.style.display="none";this.showToggle(true);
if(e!=null)OpenLayers.Event.stop(e)},showToggle:function(minimize){this.maximizeDiv.style.display=minimize?"":"none";this.minimizeDiv.style.display=minimize?"none":""},update:function(){if(this.ovmap==null)this.createMap();if(this.autoPan||!this.isSuitableOverview())this.updateOverview();this.updateRectToMap()},isSuitableOverview:function(){return true},updateOverview:function(){this.updateRectToMap()},createMap:function(){var options=OpenLayers.Util.extend({controls:[],maxResolution:"auto",fallThrough:false},
this.mapOptions);this.ovmap=new OpenLayers.Map(this.mapDiv,options);this.ovmap.eventsDiv.appendChild(this.extentRectangle);OpenLayers.Event.stopObserving(window,"unload",this.ovmap.unloadDestroy);this.ovmap.addLayers(this.layers);this.ovmap.zoomToMaxExtent();this.wComp=parseInt(OpenLayers.Element.getStyle(this.extentRectangle,"border-left-width"))+parseInt(OpenLayers.Element.getStyle(this.extentRectangle,"border-right-width"));this.wComp=this.wComp?this.wComp:2;this.hComp=parseInt(OpenLayers.Element.getStyle(this.extentRectangle,
"border-top-width"))+parseInt(OpenLayers.Element.getStyle(this.extentRectangle,"border-bottom-width"));this.hComp=this.hComp?this.hComp:2;this.handlers.drag=new OpenLayers.Handler.Drag(this,{move:this.rectDrag,done:this.updateMapToRect},{map:this.ovmap});this.handlers.click=new OpenLayers.Handler.Click(this,{click:this.mapDivClick},{single:true,"double":false,stopSingle:true,stopDouble:true,pixelTolerance:1,map:this.ovmap});this.handlers.click.activate();this.rectEvents=new OpenLayers.Events(this,
this.extentRectangle,null,true);this.rectEvents.register("mouseover",this,function(e){if(!this.handlers.drag.active&&!this.map.dragging)this.handlers.drag.activate()});this.rectEvents.register("mouseout",this,function(e){if(!this.handlers.drag.dragging)this.handlers.drag.deactivate()})},updateRectToMap:function(){var bounds;if(this.ovmap.getProjection()!=this.map.getProjection())bounds=this.map.getExtent().transform(this.map.getProjectionObject(),this.ovmap.getProjectionObject());else bounds=this.map.getExtent();
var pxBounds=this.getRectBoundsFromMapBounds(bounds);if(pxBounds)this.setRectPxBounds(pxBounds)},updateMapToRect:function(){var lonLatBounds=this.getMapBoundsFromRectBounds(this.rectPxBounds);if(this.ovmap.getProjection()!=this.map.getProjection())lonLatBounds=lonLatBounds.transform(this.ovmap.getProjectionObject(),this.map.getProjectionObject());this.map.panTo(lonLatBounds.getCenterLonLat())},setRectPxBounds:function(pxBounds){var top=Math.max(pxBounds.top,0);var left=Math.max(pxBounds.left,0);var bottom=
Math.min(pxBounds.top+Math.abs(pxBounds.getHeight()),this.ovmap.size.h-this.hComp);var right=Math.min(pxBounds.left+pxBounds.getWidth(),this.ovmap.size.w-this.wComp);var width=Math.max(right-left,0);var height=Math.max(bottom-top,0);if(width<this.minRectSize||height<this.minRectSize){this.extentRectangle.className=this.displayClass+this.minRectDisplayClass;var rLeft=left+width/2-this.minRectSize/2;var rTop=top+height/2-this.minRectSize/2;this.extentRectangle.style.top=Math.round(rTop)+"px";this.extentRectangle.style.left=
Math.round(rLeft)+"px";this.extentRectangle.style.height=this.minRectSize+"px";this.extentRectangle.style.width=this.minRectSize+"px"}else{this.extentRectangle.className=this.displayClass+"ExtentRectangle";this.extentRectangle.style.top=Math.round(top)+"px";this.extentRectangle.style.left=Math.round(left)+"px";this.extentRectangle.style.height=Math.round(height)+"px";this.extentRectangle.style.width=Math.round(width)+"px"}this.rectPxBounds=new OpenLayers.Bounds(Math.round(left),Math.round(bottom),
Math.round(right),Math.round(top))},getRectBoundsFromMapBounds:function(lonLatBounds){var leftBottomLonLat=new OpenLayers.LonLat(lonLatBounds.left,lonLatBounds.bottom);var rightTopLonLat=new OpenLayers.LonLat(lonLatBounds.right,lonLatBounds.top);var leftBottomPx=this.getOverviewPxFromLonLat(leftBottomLonLat);var rightTopPx=this.getOverviewPxFromLonLat(rightTopLonLat);var bounds=null;if(leftBottomPx&&rightTopPx)bounds=new OpenLayers.Bounds(leftBottomPx.x,leftBottomPx.y,rightTopPx.x,rightTopPx.y);return bounds},
getMapBoundsFromRectBounds:function(pxBounds){var leftBottomPx=new OpenLayers.Pixel(pxBounds.left,pxBounds.bottom);var rightTopPx=new OpenLayers.Pixel(pxBounds.right,pxBounds.top);var leftBottomLonLat=this.getLonLatFromOverviewPx(leftBottomPx);var rightTopLonLat=this.getLonLatFromOverviewPx(rightTopPx);return new OpenLayers.Bounds(leftBottomLonLat.lon,leftBottomLonLat.lat,rightTopLonLat.lon,rightTopLonLat.lat)},getLonLatFromOverviewPx:function(overviewMapPx){var size=this.ovmap.size;var res=this.ovmap.getResolution();
var center=this.ovmap.getExtent().getCenterLonLat();var delta_x=overviewMapPx.x-size.w/2;var delta_y=overviewMapPx.y-size.h/2;return new OpenLayers.LonLat(center.lon+delta_x*res,center.lat-delta_y*res)},getOverviewPxFromLonLat:function(lonlat){var res=this.ovmap.getResolution();var extent=this.ovmap.getExtent();var px=null;if(extent)px=new OpenLayers.Pixel(Math.round(1/res*(lonlat.lon-extent.left)),Math.round(1/res*(extent.top-lonlat.lat)));return px},CLASS_NAME:"Beacon.Control.OverviewMap"});
Beacon.Control.ZoomToXY=OpenLayers.Class(OpenLayers.Control,{sink:null,btnOk:null,ddl:null,lastSrid:null,btnGps:null,lastPosition:null,executeCompleted:null,executeCompletedScope:null,html:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.btnOk=$("#btnZoomToXY")[0];this.ddl=$("#ddlZoomToXyCoordSys")[0];this.btnGps=$("#btnZoomToGps")[0];this.html=$("#ZoomToXYPanel").detach()},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);
if(!this.element){this.element=document.createElement("div");this.element.id=this.id+"_frame";OpenLayers.Element.addClass(this.element,this.displayClass+"Frame");$(this.element).append(this.html);this.html.show();this.populate()}this.div.appendChild(this.element);this.sink=new Beacon.Control.EventSink;this.sink.register(this.div);return this.div},activate:function(){var r=OpenLayers.Control.prototype.activate.apply(this);if(r){if(navigator.geolocation)$(this.btnGps).show();else $(this.btnGps).hide();
Beacon.MapJS.controls.kbdNavigation.deactivate();OpenLayers.Event.observe(this.btnOk,"click",OpenLayers.Function.bindAsEventListener(this.clickOk,this));OpenLayers.Event.observe(this.ddl,"change",OpenLayers.Function.bindAsEventListener(this.sridChanged,this));OpenLayers.Event.observe(this.btnGps,"click",OpenLayers.Function.bindAsEventListener(this.clickUseGps,this));this.lastSrid=this.ddl.value;this.ddl.selectedIndex=0;var pt=this.map.getCenter();$("#txtXpos").attr("value",pt.lon.format("0.00"));
$("#txtYpos").attr("value",pt.lat.format("0.00"));$("BODY").addClass("disableTextSelection")}return r},deactivate:function(){var r=OpenLayers.Control.prototype.deactivate.apply(this);if(r){OpenLayers.Event.stopObservingElement(this.btnOk);OpenLayers.Event.stopObservingElement(this.ddl);OpenLayers.Event.stopObservingElement(this.btnGps);$("BODY").removeClass("disableTextSelection");Beacon.MapJS.controls.kbdNavigation.activate()}return r},populate:function(){for(var i=0,len=mapConfig.Projections.length;i<
len;i++){var prj=mapConfig.Projections[i];var o=document.createElement("OPTION");this.ddl.options.add(o);o.text=prj.Name;o.value=prj.SRID}},sridChanged:function(){$("#txtXpos").attr("value","");$("#txtYpos").attr("value","")},clickOk:function(){Beacon.GA.TrackEvent("ZoomXY","Click");var srid=this.ddl.value;var x;var y;if(srid==4326){x=this.parseDMS($("#txtXpos").attr("value"));y=this.parseDMS($("#txtYpos").attr("value"))}else{x=parseFloat($("#txtXpos").attr("value"));y=parseFloat($("#txtYpos").attr("value"))}var pt=
new OpenLayers.LonLat(x,y);var prj=new OpenLayers.Projection("EPSG:"+srid);pt.transform(prj,this.map.getProjectionObject());if(this.map.getMaxExtent().containsLonLat(pt))this.map.panTo(pt);else alert("The coordinates you've entered are outside of this map's area.");if(this.executeCompleted)this.executeCompleted.apply(this.executeCompletedScope)},parseDMS:function(dms){var a=dms.split(" ");var d=0,m=0,s=0;if(a.length>=1)d=parseFloat(a[0]);if(a.length>=2)m=parseFloat(a[1]);if(a.length>=3)s=parseFloat(a[2]);
if(d<0)return d-m/60-s/3600;else return d+m/60+s/3600},warmUpGps:function(){this.lastPosition=null;if(navigator.geolocation){var that=this;$(that.btnGps).text("wait");navigator.geolocation.getCurrentPosition(function(position){that.lastPosition=position;$(that.btnGps).show().text("[GPS]").attr("title","Current position: "+position.coords.latitude+" "+position.coords.longitude+" (accuracy="+(position.coords.accuracy*3.2808399).displayRounding().addCommas()+" ft)");var pt=new OpenLayers.LonLat(position.coords.longitude,
position.coords.latitude);var srid=that.ddl.value;var prjLL=new OpenLayers.Projection("EPSG:4326");var prjUser=new OpenLayers.Projection("EPSG:"+srid);pt.transform(prjLL,prjUser);$("#txtXpos").attr("value",pt.lon);$("#txtYpos").attr("value",pt.lat)},function(error){that.lastPosition=null;$(that.btnGps).text("failed")},{maximumAge:15E3,responseTime:25,timeout:3E4,enableHighAccuracy:true})}else;},clickUseGps:function(){this.warmUpGps();Beacon.GA.TrackEvent("ZoomXY","GPS")},CLASS_NAME:"Beacon.Control.ZoomToXY"});
Beacon.Control.DisplayXY=OpenLayers.Class(OpenLayers.Control,{autoActivate:true,element:null,toggleElement:null,granularity:10,lastXy:null,digits:0,hidden:true,sink:null,displayProjection:null,displayProjectionIndex:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.deactivate();OpenLayers.Control.prototype.destroy.apply(this,arguments)},activate:function(){if(OpenLayers.Control.prototype.activate.apply(this,arguments)){this.map.events.register("mousemove",
this,this.redraw);this.map.events.register("mouseout",this,this.reset);this.redraw();return true}else return false},deactivate:function(){if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)){this.map.events.unregister("mousemove",this,this.redraw);this.map.events.unregister("mouseout",this,this.reset);this.element.innerHTML="";return true}else return false},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.toggleElement=document.createElement("div");
this.toggleElement.className=this.displayClass+"Toggle";this.toggleElement.title="Change coordinate system";this.div.appendChild(this.toggleElement);this.element=document.createElement("div");this.element.className=this.displayClass+"Text";this.div.appendChild(this.element)}this.sink=new Beacon.Control.EventSink;this.sink.register(this.div);OpenLayers.Event.observe(this.toggleElement,"click",OpenLayers.Function.bindAsEventListener(this.onClick,this));this.displayProjectionIndex=-1;this.toggleProjection();
return this.div},redraw:function(evt){if(this.map.dragging)return;var lonLat;if(evt==null){this.reset();return}if(this.lastXy==null||Math.abs(evt.xy.x-this.lastXy.x)>this.granularity||Math.abs(evt.xy.y-this.lastXy.y)>this.granularity){this.lastXy=evt.xy;return}this.lastXy=evt.xy;this.lastLatLon=this.map.getLonLatFromPixel(evt.xy);this.updateDisplay()},updateDisplay:function(){if(!this.lastLatLon)return;var lonLat=this.lastLatLon.clone();if(this.displayProjection)lonLat.transform(this.map.getProjectionObject(),
this.displayProjection);var newHtml=this.formatOutput(lonLat);if(newHtml!=this.element.innerHTML){this.element.innerHTML=newHtml;$(this.div).width(250);$(this.div).width($(this.element).width()+16)}},reset:function(evt){},formatOutput:function(lonLat){if(!this.digits)return this.formatDMS(lonLat.lon,true)+", "+this.formatDMS(lonLat.lat,false);else return lonLat.lon.toFixed(this.digits)+", "+lonLat.lat.toFixed(this.digits)},onClick:function(){this.toggleProjection();Beacon.GA.TrackEvent("DisplayXY",
"Click")},toggleProjection:function(){try{this.displayProjectionIndex++;if(this.displayProjectionIndex>=mapConfig.Projections.length)this.displayProjectionIndex=0;var prjInfo=mapConfig.Projections[this.displayProjectionIndex];this.displayProjection=new OpenLayers.Projection("EPSG:"+prjInfo.SRID);this.element.title=prjInfo.Name;if(prjInfo.Name=="dd mm ss")this.digits=0;else this.digits=prjInfo.SRID==4326?6:2;this.updateDisplay()}catch(e){Beacon.MapJS.showRetryActivity(e,"DisplayXY.toggleProjection")}},
formatDMS:function(coordinate,axis){var abscoordinate=Math.abs(coordinate);var coordinatedegrees=Math.floor(abscoordinate);var coordinateminutes=(abscoordinate-coordinatedegrees)/(1/60);var tempcoordinateminutes=coordinateminutes;coordinateminutes=Math.floor(coordinateminutes);var coordinateseconds=(tempcoordinateminutes-coordinateminutes)/(1/60);coordinateseconds=Math.round(coordinateseconds*10)/10;var s=[];s.push(coordinatedegrees);s.push("\u00b0 ");if(coordinateminutes<10)s.push("0");s.push(coordinateminutes);
s.push("' ");if(coordinateseconds<10)s.push("0");s.push(coordinateseconds.toFixed(1));s.push('" ');if(axis)s.push(coordinate<0?"W":"E");else s.push(coordinate<0?"S":"N");return s.join("")},CLASS_NAME:"Beacon.Control.DisplayXY"});
Beacon.Control.SpatialSelection=OpenLayers.Class(OpenLayers.Control,{sink:null,html:null,element:null,executeCompleted:null,executeCompletedScope:null,initialize:function(selectionLayer,options){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.html=$("#SpatialSelectPanel").detach();this.selectionLayer=selectionLayer;this.deactivate()},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.element=document.createElement("div");this.element.id=
this.id+"_frame";OpenLayers.Element.addClass(this.element,this.displayClass+"Frame");$(this.element).append(this.html);this.html.show()}this.div.appendChild(this.element);this.sink=new Beacon.Control.EventSink;this.sink.register(this.div);return this.div},activate:function(){var r=OpenLayers.Control.prototype.activate.apply(this);if(r){Beacon.MapJS.controls.kbdNavigation.deactivate();Beacon.MapJS.bufferLayer.removeAllFeatures();Beacon.MapJS.bufferLayer.setVisibility(true);Beacon.API.ClearBufferGeometry();
this.buildLayerDropdown($("#SpatialSelection_layers")[0],mapConfig.LayerId);$("#SpatialSelection_layerName").text(this.getNameForLayer(mapConfig.LayerId));OpenLayers.Event.observe($("#SpatialSelection_button")[0],"click",OpenLayers.Function.bindAsEventListener(this.executeOperation,this));OpenLayers.Event.observe($("#SpatialSelection_buff")[0],"click",OpenLayers.Function.bindAsEventListener(this.changeSelectionMode,this));OpenLayers.Event.observe($("#SpatialSelection_sel")[0],"click",OpenLayers.Function.bindAsEventListener(this.changeSelectionMode,
this));OpenLayers.Event.observe($("#SpatialSelection_dist")[0],"change",OpenLayers.Function.bindAsEventListener(this.updateButtonVis,this));OpenLayers.Event.observe($("#SpatialSelection_dist")[0],"propertychange",OpenLayers.Function.bindAsEventListener(this.updateButtonVis,this));OpenLayers.Event.observe($("#SpatialSelection_dist")[0],"input",OpenLayers.Function.bindAsEventListener(this.updateButtonVis,this));OpenLayers.Event.observe($("#SpatialSelection_dist")[0],"keydown",OpenLayers.Function.bindAsEventListener(this.onKeyDown,
this));Beacon.MapJS.events.on({changelayer:this.changeActiveLayer,scope:this});this.changeSelectionMode()}return r},deactivate:function(){var r=OpenLayers.Control.prototype.deactivate.apply(this);if(r){Beacon.MapJS.bufferLayer.setVisibility(true);OpenLayers.Event.stopObservingElement($("#SpatialSelection_button")[0]);OpenLayers.Event.stopObservingElement($("#SpatialSelection_buff")[0]);OpenLayers.Event.stopObservingElement($("#SpatialSelection_sel")[0]);OpenLayers.Event.stopObservingElement($("#SpatialSelection_dist")[0]);
Beacon.MapJS.controls.kbdNavigation.activate()}return r},setMap:function(map){OpenLayers.Control.prototype.setMap.apply(this,arguments)},updateButtonVis:function(e){var s=$("#SpatialSelection_dist").val();var d=parseFloat(s);if(this.isInBufferMode()&&(isNaN(d)||d<=0))$("#SpatialSelection_button")[0].disabled=true;else $("#SpatialSelection_button")[0].disabled=false},buildLayerDropdown:function(sel,defaultLayerId){var o;var lyrs=mapConfig.Layers;for(var i=0;i<lyrs.length;i++){var lyr=lyrs[i];if(lyr.Query){o=
document.createElement("option");sel.options.add(o);o.text=lyr.Name;o.value=lyr.LayerId;o.selected=lyr.LayerId==defaultLayerId}}},changeActiveLayer:function(){$("#SpatialSelection_layerName").text(this.getNameForLayer(mapConfig.LayerId))},getNameForLayer:function(layerId){var lyrs=mapConfig.Layers;for(var i=0;i<lyrs.length;i++){var lyr=lyrs[i];if(lyr.LayerId==layerId)return lyr.Name}return"Unknown"},isInBufferMode:function(){return $("#SpatialSelection_buff")[0].checked},changeSelectionMode:function(){if(this.isInBufferMode()){$("#SpatialSelection_spanBuffer").show();
$("#SpatialSelection_spanSelect").hide();$("#SpatialSelection_button").attr("value","Buffer")}else{$("#SpatialSelection_spanBuffer").hide();$("#SpatialSelection_spanSelect").show();$("#SpatialSelection_button").attr("value","Select")}this.updateButtonVis()},executeOperation:function(){try{if(Beacon.MapJS.selectionLayer.features.length==0){alert("You have no features selected");return}var targetLayerId=$("#SpatialSelection_layers").val();this.disableUi();if(this.isInBufferMode()){var bufferDistance=
parseFloat($("#SpatialSelection_dist").val())*parseFloat($("#SpatialSelection_units").val());this.buffer(bufferDistance,targetLayerId,Beacon.API.SpatialRelation.Intersects);Beacon.GA.TrackEvent("SpatialSelection","Buffer")}else{this.buffer(0,targetLayerId,$("#SpatialSelection_relation").val());Beacon.GA.TrackEvent("SpatialSelection","Select")}}catch(e){Beacon.MapJS.showRetryActivity(e,"SpatialSelection.execute")}},buffer:function(distance,layerid,spatialRelation){Beacon.MapJS.bufferLayer.removeAllFeatures();
var f=Beacon.MapJS.selectionLayer.features;var wktParser=new OpenLayers.Format.WKT;var wkts=[];for(var i=0;i<f.length;i++){var feature=f[i];if(feature.geometry)wkts.push(wktParser.write(feature))}Beacon.API.BufferGeometry(wkts,distance,this.bufferComplete,this.bufferFailure,this,{layerid:layerid,spatialRelation:spatialRelation});if(distance==0)Beacon.MapJS.showActivity("Selecting feature(s)");else Beacon.MapJS.showActivity("Buffering feature(s)")},bufferComplete:function(polyWkt,params){try{var wktParser=
new OpenLayers.Format.WKT;var polyFeature=wktParser.read(polyWkt);polyFeature.fid="buffertest";Beacon.MapJS.bufferLayer.addFeatures([polyFeature]);if(mapConfig.LayerId!=params.layerid)Beacon.MapJS.changeActiveLayer(params.layerid);this.requestFeatures(polyFeature.geometry,params.spatialRelation)}catch(e){Beacon.MapJS.showRetryActivity(e,"SpatialSelection.bufferComplete")}},bufferFailure:function(msg){Beacon.MapJS.showRetryActivity();this.enableUi()},requestFeatures:function(geom,spatialRelation){Beacon.MapJS.showActivity("Fetching data");
var reader=new Beacon.Protocol.BeaconFeature({});reader.readFeatures(false,geom,spatialRelation,null,this.gotFeatures,function(){Beacon.MapJS.showRetryActivity();this.enableUi()},this)},gotFeatures:function(features){try{Beacon.MapJS.selectionLayer.selectFeatures(features,false,false);var ext=Beacon.MapJS.selectionLayer.getDataExtent();if(ext)this.map.zoomToExtent(ext,false);Beacon.MapJS.hideActivity("");this.enableUi();if(this.executeCompleted)this.executeCompleted.apply(this.executeCompletedScope)}catch(e){Beacon.MapJS.showRetryActivity(e,
"SpatialSelection.gotFeatures")}},disableUi:function(){$(this.element).fadeTo(200,0.25);$("#SpatialSelection_button")[0].disabled=true},enableUi:function(){$(this.element).fadeTo(200,1);$("#SpatialSelection_button")[0].disabled=false},onKeyDown:function(e){if(e.keyCode==13)OpenLayers.Event.stop(e)},CLASS_NAME:"Beacon.Control.SpatialSelection"});
Beacon.Control.QuickZoom=OpenLayers.Class(OpenLayers.Control,{element:null,ddl:null,sink:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.div=document.getElementById("mapJsQuickzoom")},draw:function(px){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.element=document.createElement("div");this.element.className=this.displayClass;this.div.appendChild(this.element)}$(this.element).hide();this.ddl=document.createElement("select");
this.element.appendChild(this.ddl);OpenLayers.Event.observe(this.ddl,"change",OpenLayers.Function.bindAsEventListener(this.selectClicked,this));Beacon.MapJS.events.register("changelayer",this,this.populateDropdown);return this.div},populateDropdown:function(evt){try{$(this.element).hide();var zoomable=this.isQuickZoomable(evt.layerId);if(zoomable){this.clearDropdown();Beacon.API.GetQuickZoomList(evt.layerId,function(d){try{this.clearDropdown();if(d&&d.length>0){this.addToDropdown("Quick Zoom ->",
-1);for(var i=0;i<d.length;i++)this.addToDropdown(d[i].Display,d[i].Key);$(this.element).show()}else;}catch(e){Beacon.MapJS.logException(e,"QuickZoom.populateCallback")}},function(fail){Beacon.MapJS.showRetryActivity()},this,evt.layerId)}else this.clearDropdown()}catch(e){Beacon.MapJS.logException(e,"Quickzoom.populateDropdown")}},isQuickZoomable:function(layerId){var lyrs=mapConfig.Layers;for(var i=0;i<lyrs.length;i++){var lyr=lyrs[i];if(lyr.QuickZoom&&lyr.LayerId==layerId)return true}return false},
addToDropdown:function(text,value){var o=document.createElement("OPTION");this.ddl.options.add(o);o.innerText=text;o.value=value},clearDropdown:function(){while(this.ddl.options.length)this.ddl.options.remove(0)},selectClicked:function(){this.request(this.ddl.value)},request:function(key){try{if(!key||key==-1)return;Beacon.MapJS.showActivity("Performing zoom");Beacon.API.SetResults(mapConfig.LayerId,[key],function(){var reader=new Beacon.Protocol.BeaconFeature({});reader.readFeatures(true,null,Beacon.API.SpatialRelation.None,
null,this.gotFeatures,function(){Beacon.MapJS.showRetryActivity()},this)},function(){Beacon.MapJS.hideActivity()},this)}catch(e){Beacon.MapJS.logException(e,"QuickZoom.request")}},gotFeatures:function(features){try{Beacon.MapJS.selectionLayer.selectFeatures(features,false,false);var ext=Beacon.MapJS.selectionLayer.getDataExtent();if(ext)this.map.zoomToExtent(ext,false);Beacon.MapJS.hideActivity()}catch(e){Beacon.MapJS.showRetryActivity(e,"QuickZoom.gotFeatures")}},CLASS_NAME:"Beacon.Control.QuickZoom"});
Beacon.Control.PanZoomBarScaleHint=OpenLayers.Class(OpenLayers.Control,{buddyDiv:null,sliderDiv:null,initialize:function(buddy,slider,options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.buddyDiv=buddy;this.sliderDiv=slider},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.div.style.height=this.buddyDiv.style.height;this.populateDropdown();this.map.events.register("changebaselayer",this,this.populateDropdown);var elmt=this.div;$([this.buddyDiv,this.sliderDiv]).hover(function(){$(elmt).show()},
function(){$(elmt).hide()});return this.div},populateDropdown:function(){var levels=this.map.getNumZoomLevels();var units=this.map.baseLayer.units;$(this.div).empty();for(var i=levels-1;i>=0;i--){var res=this.map.getResolutionForZoom(i);var scale=OpenLayers.Util.getScaleFromResolution(res,units);var o=document.createElement("div");o.className=this.displayClass+"item";$(o).text(this.getDisplayScale(scale));this.div.appendChild(o)}},getDisplayScale:function(scale){var ftScale=scale/12;if(ftScale<25)return'1" = '+
Math.round(10*ftScale)/10+"ft";if(ftScale<2640)return'1" = '+Math.round(ftScale)+"ft";return'1" = '+Math.round(10*ftScale/5280)/10+"mi"},CLASS_NAME:"Beacon.Control.PanZoomBarScaleHint"});
Beacon.Control.DataExtract=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(evt){try{var url=Beacon.Tabs.getUrl(mapConfig.LayerId,mapConfig.PageTypeId,mapConfig.PageId,null,"ExtractData.aspx")+"&BBOX="+this.map.getExtent().toBBOX();$().colorbox({title:"Map Data Extract",iframe:true,innerWidth:"440px",innerHeight:"390px",href:url,onClosed:function(){window.location=window.location}})}catch(e){Beacon.MapJS.showRetryActivity(e,"DataExtract.trigger")}},CLASS_NAME:"Beacon.Control.DataExtract"});
Beacon.Control.ModifyFeature=OpenLayers.Class(OpenLayers.Control,{geometryTypes:null,clickout:true,toggle:true,standalone:false,layer:null,feature:null,vertices:null,virtualVertices:null,selectControl:null,dragControl:null,handlers:null,deleteCodes:null,virtualStyle:null,vertexStyle:null,dragStyle:null,mode:null,modified:false,radiusHandle:null,dragHandle:null,onModificationStart:function(){},onModification:function(){},onModificationEnd:function(){},initialize:function(layer,options){options=options||
{};this.layer=layer;this.vertices=[];this.virtualVertices=[];this.deleteCodes=[46,68];this.mode=Beacon.Control.ModifyFeature.RESHAPE;OpenLayers.Control.prototype.initialize.apply(this,[options]);if(!(this.deleteCodes instanceof Array))this.deleteCodes=[this.deleteCodes];var control=this;var selectOptions={geometryTypes:this.geometryTypes,clickout:this.clickout,toggle:this.toggle,onBeforeSelect:this.beforeSelectFeature,onSelect:this.selectFeature,onUnselect:this.unselectFeature,scope:this};if(this.standalone===
false)this.selectControl=new OpenLayers.Control.SelectFeature(layer,selectOptions);var dragOptions={geometryTypes:["OpenLayers.Geometry.Point"],snappingOptions:this.snappingOptions,onStart:function(feature,pixel){control.dragStart.apply(control,[feature,pixel])},onDrag:function(feature,pixel){control.dragVertex.apply(control,[feature,pixel])},onComplete:function(feature){control.dragComplete.apply(control,[feature])},featureCallbacks:{over:function(feature){if(control.standalone!==true||feature._sketch||
control.feature===feature)control.dragControl.overFeature.apply(control.dragControl,[feature])}}};this.dragControl=new OpenLayers.Control.DragFeature(layer,dragOptions);var keyboardOptions={keydown:this.handleKeypress};this.handlers={keyboard:new OpenLayers.Handler.Keyboard(this,keyboardOptions)}},destroy:function(){this.layer=null;this.standalone||this.selectControl.destroy();this.dragControl.destroy();OpenLayers.Control.prototype.destroy.apply(this,[])},activate:function(){return(this.standalone||
this.selectControl.activate())&&this.handlers.keyboard.activate()&&OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){var deactivated=false;if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)){this.layer.removeFeatures(this.vertices,{silent:true});this.layer.removeFeatures(this.virtualVertices,{silent:true});this.vertices=[];this.dragControl.deactivate();var feature=this.feature;var valid=feature&&feature.geometry&&feature.layer;if(this.standalone===false){if(valid)this.selectControl.unselect.apply(this.selectControl,
[feature]);this.selectControl.deactivate()}else if(valid)this.unselectFeature(feature);this.handlers.keyboard.deactivate();deactivated=true}return deactivated},beforeSelectFeature:function(feature){return this.layer.events.triggerEvent("beforefeaturemodified",{feature:feature})},selectFeature:function(feature){this.feature=feature;this.modified=false;this.resetVertices();this.dragControl.activate();this.onModificationStart(this.feature)},unselectFeature:function(feature){this.layer.removeFeatures(this.vertices,
{silent:true});this.vertices=[];this.layer.destroyFeatures(this.virtualVertices,{silent:true});this.virtualVertices=[];if(this.dragHandle){this.layer.destroyFeatures([this.dragHandle],{silent:true});delete this.dragHandle}if(this.radiusHandle){this.layer.destroyFeatures([this.radiusHandle],{silent:true});delete this.radiusHandle}this.feature=null;this.dragControl.deactivate();this.onModificationEnd(feature);this.layer.events.triggerEvent("afterfeaturemodified",{feature:feature,modified:this.modified});
this.modified=false},dragStart:function(feature,pixel){if(feature!=this.feature&&!feature.geometry.parent&&feature!=this.dragHandle&&feature!=this.radiusHandle){if(this.standalone===false&&this.feature)this.selectControl.clickFeature.apply(this.selectControl,[this.feature]);if(this.geometryTypes==null||OpenLayers.Util.indexOf(this.geometryTypes,feature.geometry.CLASS_NAME)!=-1){this.standalone||this.selectControl.clickFeature.apply(this.selectControl,[feature]);this.dragControl.overFeature.apply(this.dragControl,
[feature]);this.dragControl.lastPixel=pixel;this.dragControl.handlers.drag.started=true;this.dragControl.handlers.drag.start=pixel;this.dragControl.handlers.drag.last=pixel}}},dragVertex:function(vertex,pixel){this.modified=true;if(this.feature.geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){if(this.feature!=vertex)this.feature=vertex;this.layer.events.triggerEvent("vertexmodified",{vertex:vertex.geometry,feature:this.feature,pixel:pixel})}else{if(vertex._index){vertex.geometry.parent.addComponent(vertex.geometry,
vertex._index);delete vertex._index;OpenLayers.Util.removeItem(this.virtualVertices,vertex);this.vertices.push(vertex)}else if(vertex==this.dragHandle){this.layer.removeFeatures(this.vertices,{silent:true});this.vertices=[];if(this.radiusHandle){this.layer.destroyFeatures([this.radiusHandle],{silent:true});this.radiusHandle=null}}else if(vertex!==this.radiusHandle)this.layer.events.triggerEvent("vertexmodified",{vertex:vertex.geometry,feature:this.feature,pixel:pixel});if(this.virtualVertices.length>
0){this.layer.destroyFeatures(this.virtualVertices,{silent:true});this.virtualVertices=[]}this.layer.drawFeature(this.feature,this.standalone?undefined:this.selectControl.renderIntent)}this.layer.drawFeature(vertex)},dragComplete:function(vertex){this.resetVertices();this.setFeatureState();this.onModification(this.feature);this.layer.events.triggerEvent("featuremodified",{feature:this.feature})},setFeatureState:function(){if(this.feature.state!=OpenLayers.State.INSERT&&this.feature.state!=OpenLayers.State.DELETE)this.feature.state=
OpenLayers.State.UPDATE},resetVertices:function(){if(this.dragControl.feature)this.dragControl.outFeature(this.dragControl.feature);if(this.vertices.length>0){this.layer.removeFeatures(this.vertices,{silent:true});this.vertices=[]}if(this.virtualVertices.length>0){this.layer.removeFeatures(this.virtualVertices,{silent:true});this.virtualVertices=[]}if(this.dragHandle){this.layer.destroyFeatures([this.dragHandle],{silent:true});this.dragHandle=null}if(this.radiusHandle){this.layer.destroyFeatures([this.radiusHandle],
{silent:true});this.radiusHandle=null}if(this.feature&&this.feature.geometry.CLASS_NAME!="OpenLayers.Geometry.Point"){if(this.mode&Beacon.Control.ModifyFeature.DRAG)this.collectDragHandle();if(this.mode&(Beacon.Control.ModifyFeature.ROTATE|Beacon.Control.ModifyFeature.RESIZE))this.collectRadiusHandle();if(this.mode&Beacon.Control.ModifyFeature.RESHAPE)if(!(this.mode&Beacon.Control.ModifyFeature.RESIZE))this.collectVertices()}},handleKeypress:function(evt){var code=evt.keyCode;if(this.feature&&OpenLayers.Util.indexOf(this.deleteCodes,
code)!=-1){var vertex=this.dragControl.feature;if(vertex&&OpenLayers.Util.indexOf(this.vertices,vertex)!=-1&&!this.dragControl.handlers.drag.dragging&&vertex.geometry.parent){vertex.geometry.parent.removeComponent(vertex.geometry);this.layer.events.triggerEvent("vertexremoved",{vertex:vertex.geometry,feature:this.feature,pixel:evt.xy});this.layer.drawFeature(this.feature,this.standalone?undefined:this.selectControl.renderIntent);this.resetVertices();this.setFeatureState();this.onModification(this.feature);
this.layer.events.triggerEvent("featuremodified",{feature:this.feature})}}},collectVertices:function(){this.vertices=[];this.virtualVertices=[];var control=this;function collectComponentVertices(geometry){var i,vertex,component,len;if(geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){vertex=new OpenLayers.Feature.Vector(geometry,null,control.vertexStyle);vertex._sketch=true;control.vertices.push(vertex)}else{var numVert=geometry.components.length;if(geometry.CLASS_NAME=="OpenLayers.Geometry.LinearRing")numVert-=
1;for(i=0;i<numVert;++i){component=geometry.components[i];if(component.CLASS_NAME=="OpenLayers.Geometry.Point"){vertex=new OpenLayers.Feature.Vector(component,null,control.vertexStyle);vertex._sketch=true;control.vertices.push(vertex)}else collectComponentVertices(component)}if(geometry.CLASS_NAME!="OpenLayers.Geometry.MultiPoint")for(i=0,len=geometry.components.length;i<len-1;++i){var prevVertex=geometry.components[i];var nextVertex=geometry.components[i+1];if(prevVertex.CLASS_NAME=="OpenLayers.Geometry.Point"&&
nextVertex.CLASS_NAME=="OpenLayers.Geometry.Point"){var x=(prevVertex.x+nextVertex.x)/2;var y=(prevVertex.y+nextVertex.y)/2;var point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(x,y),null,control.virtualStyle);point.geometry.parent=geometry;point._index=i+1;point._sketch=true;control.virtualVertices.push(point)}}}}collectComponentVertices.call(this,this.feature.geometry);this.layer.addFeatures(this.virtualVertices,{silent:true});this.layer.addFeatures(this.vertices,{silent:true})},
collectDragHandle:function(){var geometry=this.feature.geometry;var center=geometry.getBounds().getCenterLonLat();var originGeometry=new OpenLayers.Geometry.Point(center.lon,center.lat);var origin=new OpenLayers.Feature.Vector(originGeometry,null,this.dragStyle);originGeometry.move=function(x,y){OpenLayers.Geometry.Point.prototype.move.call(this,x,y);geometry.move(x,y)};origin._sketch=true;this.dragHandle=origin;this.layer.addFeatures([this.dragHandle],{silent:true})},collectRadiusHandle:function(){var geometry=
this.feature.geometry;var bounds=geometry.getBounds();var center=bounds.getCenterLonLat();var originGeometry=new OpenLayers.Geometry.Point(center.lon,center.lat);var radiusGeometry=new OpenLayers.Geometry.Point(bounds.right,bounds.bottom);var radius=new OpenLayers.Feature.Vector(radiusGeometry);var resize=this.mode&Beacon.Control.ModifyFeature.RESIZE;var reshape=this.mode&Beacon.Control.ModifyFeature.RESHAPE;var rotate=this.mode&Beacon.Control.ModifyFeature.ROTATE;radiusGeometry.move=function(x,y){OpenLayers.Geometry.Point.prototype.move.call(this,
x,y);var dx1=this.x-originGeometry.x;var dy1=this.y-originGeometry.y;var dx0=dx1-x;var dy0=dy1-y;if(rotate){var a0=Math.atan2(dy0,dx0);var a1=Math.atan2(dy1,dx1);var angle=a1-a0;angle*=180/Math.PI;geometry.rotate(angle,originGeometry)}if(resize){var scale,ratio;if(reshape){scale=dy1/dy0;ratio=dx1/dx0/scale}else{var l0=Math.sqrt(dx0*dx0+dy0*dy0);var l1=Math.sqrt(dx1*dx1+dy1*dy1);scale=l1/l0}geometry.resize(scale,originGeometry,ratio)}};radius._sketch=true;this.radiusHandle=radius;this.layer.addFeatures([this.radiusHandle],
{silent:true})},setMap:function(map){this.standalone||this.selectControl.setMap(map);this.dragControl.setMap(map);OpenLayers.Control.prototype.setMap.apply(this,arguments)},CLASS_NAME:"Beacon.Control.ModifyFeature"});Beacon.Control.ModifyFeature.RESHAPE=1;Beacon.Control.ModifyFeature.RESIZE=2;Beacon.Control.ModifyFeature.ROTATE=4;Beacon.Control.ModifyFeature.DRAG=8;
Beacon.Control.MapMarkup=OpenLayers.Class(OpenLayers.Control,{html:null,currentTool:null,tools:null,divs:null,markupLayer:null,ddlColor:null,ddlSize:null,ddlPointType:null,txtTextbox:null,delayedSave:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,[options]);try{var that=this;this.delayedSave=new Beacon.DelayedFunction(function(){that.saveMarkup()},that,537);this.markupLayer=new OpenLayers.Layer.Vector("Markup Layer",{styleMap:new OpenLayers.StyleMap({temporary:OpenLayers.Util.applyDefaults({pointRadius:16},
OpenLayers.Feature.Vector.style.temporary)})});this.markupLayer.events.register("beforefeatureadded",this,this.onFeatureAdded);this.markupLayer.events.register("beforefeaturemodified",this,this.onFeatureSelected);var vertexStyle=OpenLayers.Util.applyDefaults({fill:true,fillColor:"#fff",fillOpacity:0.1,stroke:true,strokeColor:"#000",strokeWidth:1.5,strokeOpacity:0.75,graphic:true,graphicName:"square",pointRadius:5},OpenLayers.Feature.Vector.style["default"]);var vertexStyle2=OpenLayers.Util.applyDefaults({fill:true,
fillColor:"#fff",fillOpacity:0.1,stroke:true,strokeColor:"#444",strokeWidth:1,strokeOpacity:0.75,graphic:true,graphicName:"square",pointRadius:4},OpenLayers.Feature.Vector.style["default"]);var dragStyle=OpenLayers.Util.applyDefaults({fill:false,fillColor:"#000",fillOpacity:0.75,stroke:false,graphic:true,externalGraphic:"/Images/Hover-Move-Arrows.png",graphicWidth:19,graphicHeight:19,pointRadius:5},OpenLayers.Feature.Vector.style["default"]);var handlerStyle={pointRadius:4,fillColor:"#fff",fillOpacity:0.1};
this.tools={modify:new Beacon.Control.ModifyFeature(this.markupLayer,{toggle:true,mode:Beacon.Control.ModifyFeature.RESHAPE|Beacon.Control.ModifyFeature.DRAG,virtualStyle:vertexStyle2,vertexStyle:vertexStyle,dragStyle:dragStyle,onModificationStart:function(f){that.featureSelected(f)},onModificationEnd:function(f){that.featureUnselected(f)}}),point:new OpenLayers.Control.DrawFeature(this.markupLayer,OpenLayers.Handler.Point,{handlerOptions:{style:handlerStyle}}),line:new OpenLayers.Control.DrawFeature(this.markupLayer,
OpenLayers.Handler.Path,{handlerOptions:{style:handlerStyle,doubleTouchTolerance:30}}),polygon:new OpenLayers.Control.DrawFeature(this.markupLayer,OpenLayers.Handler.Polygon,{handlerOptions:{style:handlerStyle,doubleTouchTolerance:30}}),freehand:new OpenLayers.Control.DrawFeature(this.markupLayer,OpenLayers.Handler.Path,{handlerOptions:{freehand:true,style:handlerStyle}}),text:new OpenLayers.Control.DrawFeature(this.markupLayer,OpenLayers.Handler.Point,{handlerOptions:{style:handlerStyle}})};var h=
this.tools.freehand.handler;h.addPoint=function(pixel){this.layer.removeFeatures([this.point]);var lonlat=this.control.map.getLonLatFromPixel(pixel);if(!this.point.geometry.x){this.point.geometry.x=lonlat.lon;this.point.geometry.y=lonlat.lat;this.point.geometry.clearBounds();this.line.geometry.clearBounds()}this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat));this.line.geometry.addComponent(this.point.geometry,this.line.geometry.components.length);this.layer.addFeatures([this.point]);
this.callback("point",[this.point.geometry,this.getGeometry()]);this.callback("modify",[this.point.geometry,this.getSketch()]);this.drawFeature()};this.divs={modify:$("#mmModify")[0],point:$("#mmPoint")[0],line:$("#mmLine")[0],polygon:$("#mmPolygon")[0],freehand:$("#mmFreehand")[0],text:$("#mmText")[0],deleteFeature:$("#mmDeleteFeature")[0],copySelection:$("#mmCopySelection")[0],clearAll:$("#mmClearAll")[0]};this.ddlColor=$("#mmColor2")[0];this.ddlPointType=$("#mmPointType2")[0];this.ddlSize=$("#mmSize")[0];
this.txtTextbox=$("#mmTextbox")[0];this.html=$("#MapMarkupPanel").detach()}catch(e){Beacon.MapJS.logException(e,"MapMarkup.init")}},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.element=document.createElement("div");this.element.id=this.id+"_frame";OpenLayers.Element.addClass(this.element,this.displayClass+"Frame");$(this.element).append(this.html);this.html.show()}this.div.appendChild(this.element);this.sink=new Beacon.Control.EventSink;this.sink.register(this.div);
return this.div},setMap:function(map){OpenLayers.Control.prototype.setMap.apply(this,[map]);this.map.addLayers([this.markupLayer]);for(key in this.tools)this.tools[key].setMap(map);this.loadMarkup()},activate:function(){try{var r=OpenLayers.Control.prototype.activate.apply(this);if(r){Beacon.MapJS.controls.kbdNavigation.deactivate();OpenLayers.Event.observe(this.divs.modify,"click",OpenLayers.Function.bindAsEventListener(function(){this.activateTool(this.tools.modify)},this));OpenLayers.Event.observe(this.divs.point,
"click",OpenLayers.Function.bindAsEventListener(function(){this.activateTool(this.tools.point)},this));OpenLayers.Event.observe(this.divs.line,"click",OpenLayers.Function.bindAsEventListener(function(){this.activateTool(this.tools.line)},this));OpenLayers.Event.observe(this.divs.polygon,"click",OpenLayers.Function.bindAsEventListener(function(){this.activateTool(this.tools.polygon)},this));OpenLayers.Event.observe(this.divs.freehand,"click",OpenLayers.Function.bindAsEventListener(function(){this.activateTool(this.tools.freehand)},
this));OpenLayers.Event.observe(this.divs.text,"click",OpenLayers.Function.bindAsEventListener(function(){this.activateTool(this.tools.text)},this));OpenLayers.Event.observe(this.divs.deleteFeature,"click",OpenLayers.Function.bindAsEventListener(this.deleteFeature,this));OpenLayers.Event.observe(this.divs.copySelection,"click",OpenLayers.Function.bindAsEventListener(this.copySelection,this));OpenLayers.Event.observe(this.divs.clearAll,"click",OpenLayers.Function.bindAsEventListener(this.clearAll,
this));if(this.currentTool)this.activateTool(this.currentTool);else this.activateTool(this.tools.modify);var that=this;var parentCtrl=$("#mmColor2");var childCtrl=$("#mmColorPicker");var pos=parentCtrl.position();var height=parentCtrl.height();childCtrl.css("left",pos.left);childCtrl.css("top",pos.top+height+4);parentCtrl.click(function(){childCtrl.slideToggle(200)});$(".mmColorSwatch").click(function(){var newColor=$(this).css("background-color");parentCtrl.css("background-color",newColor);childCtrl.hide();
that.onChangeColor.apply(that)});var markerButton=$("#mmPointType2");var markerPos=markerButton.position();var markerHeight=markerButton.height();var markerPalette=$("#mmMarkerPicker");markerPalette.css("left",markerPos.left);markerPalette.css("top",markerPos.top+markerHeight+4);markerButton.click(function(){markerPalette.slideToggle(200)});$(".mmMarkerSwatch").click(function(){var newMarker=$(this).attr("marker");var newImage=$(this).css("background-image");markerButton.attr("marker",newMarker);
markerButton.css("background-image",newImage);markerPalette.hide();that.onChangePointType.apply(that)});OpenLayers.Event.observe(this.ddlSize,"change",OpenLayers.Function.bindAsEventListener(this.onChangeSize,this));OpenLayers.Event.observe(this.txtTextbox,"change",OpenLayers.Function.bindAsEventListener(this.onChangeText,this));OpenLayers.Event.observe(this.txtTextbox,"keydown",OpenLayers.Function.bindAsEventListener(this.onKeyDown,this));$("BODY").addClass("disableTextSelection");this.featureUnselected();
Beacon.GA.TrackEvent("MapMarkup","Opened")}return r}catch(e){Beacon.MapJS.logException(e,"MapMarkup.activate")}},deactivate:function(){try{var r=OpenLayers.Control.prototype.deactivate.apply(this);if(r){for(key in this.divs){var toolDiv=this.divs[key];var toolControl=this.tools[key];if(toolControl)toolControl.deactivate();OpenLayers.Event.stopObservingElement(toolDiv)}$("BODY").removeClass("disableTextSelection");$("#mmColor2").unbind();$(".mmColorSwatch").unbind();$("#mmPointType2").unbind();$(".mmMarkerSwatch").unbind();
Beacon.MapJS.controls.kbdNavigation.activate()}return r}catch(e){Beacon.MapJS.logException(e,"MapMarkup.deactivate")}},activateTool:function(newTool){try{for(key in this.tools){var control=this.tools[key];var toolDiv=this.divs[key];if(newTool==control){control.activate();$(toolDiv).addClass("mmActive")}else{control.deactivate();$(toolDiv).removeClass("mmActive")}}this.currentTool=newTool;this.updateStyleOnCurrentTool();if(this.currentTool==this.tools.point||this.currentTool==this.tools.modify);else;
}catch(e){Beacon.MapJS.logException(e,"MapMarkup.activateTool")}},deleteFeature:function(){try{var f=this.tools.modify.feature;if(f){this.tools.modify.unselectFeature(f);this.markupLayer.removeFeatures([f]);this.featureUnselected()}}catch(e){Beacon.MapJS.logException(e,"MapMarkup.delete")}},clearAll:function(){try{this.markupLayer.removeAllFeatures()}catch(e){Beacon.MapJS.logException(e,"MapMarkup.clear")}},copySelection:function(){try{var slyr=Beacon.MapJS.selectionLayer;var features=slyr.features;
var settings=this.getStyleSettingsFromUi();if(features.length==0)return;slyr.removeFeatures(features);this.markupLayer.addFeatures(features);var geomClass=features[0].geometry.CLASS_NAME;var newStyle;var splitParts;if(geomClass=="OpenLayers.Geometry.Point"||geomClass=="OpenLayers.Geometry.MultiPoint"){newStyle=this.getStyleFromUiFor("MARKER",settings);splitParts=true}else{newStyle=this.getStyleFromUiFor("GEOMETRY",settings);splitParts=false}for(var i=0;i<features.length;i++){var f=features[i];if(splitParts){var ptGeom=
f.geometry.components[0];f.geometry=ptGeom}f.style=OpenLayers.Util.applyDefaults(newStyle,OpenLayers.Feature.Vector.style["default"]);this.markupLayer.drawFeature(f)}}catch(e){Beacon.MapJS.logException(e,"MapMarkup.copy")}},updateStyleOnCurrentTool:function(){var s=this.getStyleSettingsFromUi();if(this.currentTool&&this.currentTool.handler){this.currentTool.handler.style.strokeColor=s.color;this.currentTool.handler.style.strokeWidth=s.linewidth}},updateStyleOnFeature:function(f){try{if(f){var settings=
this.getStyleSettingsFromUi();var newStyle=this.getStyleFromUiFor(f.style.annoType,settings);f.style=newStyle;this.markupLayer.drawFeature(f)}this.delayedSave.delayedInvoke()}catch(e){Beacon.MapJS.logException(e,"MapMarkup.updateStyle")}},getStyleSettingsFromUi:function(){return this.calculateStyleSettings($(this.ddlColor).css("background-color"),$(this.ddlSize).val(),$(this.ddlPointType).attr("marker"),$(this.txtTextbox).val())},calculateStyleSettings:function(color,size,pointType,label){return{color:color,
linewidth:size,fontsize:8+size*2+"px",graphictype:pointType,graphicradius:size*3,label:label,labelOffset:size*3+5}},getStyleFromUiFor:function(annoType,settings){var newStyle;var s=settings;if(annoType=="TEXT")newStyle={fillColor:"#fff",fillOpacity:0.1,strokeColor:s.color,strokeWidth:2,graphic:false,graphicName:"",label:s.label,labelAlign:"cm",labelYOffset:0,fontColor:s.color,fontSize:s.fontsize,fontWeight:"bold",labelSelect:true,annoType:"TEXT",annoSize:s.linewidth};if(annoType=="MARKER")newStyle=
{fillColor:"#fff",fillOpacity:0.1,strokeColor:s.color,strokeWidth:2,graphic:true,graphicName:s.graphictype,pointRadius:s.graphicradius,label:s.label,labelAlign:"cb",labelYOffset:s.labelOffset,fontColor:s.color,fontSize:s.fontsize,fontWeight:"bold",labelSelect:false,annoType:"MARKER",annoSize:s.linewidth};if(annoType=="GEOMETRY")newStyle={fillColor:"#fff",fillOpacity:0.1,strokeColor:s.color,strokeWidth:s.linewidth,graphic:false,label:s.label,fontColor:s.color,fontSize:s.fontsize,fontWeight:"bold",
labelSelect:false,annoType:"GEOMETRY",annoSize:s.linewidth};return newStyle},onFeatureAdded:function(e){var f=e.feature;if(f.style)return;var newStyle;var settings=this.getStyleSettingsFromUi();if(this.currentTool==this.tools.text)newStyle=this.getStyleFromUiFor("TEXT",settings);if(this.currentTool==this.tools.point)newStyle=this.getStyleFromUiFor("MARKER",settings);if(this.currentTool==this.tools.line||this.currentTool==this.tools.freehand||this.currentTool==this.tools.polygon)newStyle=this.getStyleFromUiFor("GEOMETRY",
settings);f.style=OpenLayers.Util.applyDefaults(newStyle,OpenLayers.Feature.Vector.style["default"]);return true},onFeatureSelected:function(e){var f=e.feature;var s=f.style;$(this.ddlColor).css("background-color",s.strokeColor);$(this.ddlSize).val(s.annoSize);$(this.txtTextbox).val(s.label);if(s.annoType!="TEXT"){var swatch=$("DIV.mmMarkerSwatch[marker="+s.graphicName+"]");if(swatch.length>0){$(this.ddlPointType).attr("marker",s.graphicName);$(this.ddlPointType).css("background-image",swatch.css("background-image"))}}},
onChangeColor:function(){if(this.currentTool==this.tools.modify){var f=this.tools.modify.feature;this.updateStyleOnFeature(f)}this.updateStyleOnCurrentTool()},onChangePointType:function(){if(this.currentTool==this.tools.modify){var f=this.tools.modify.feature;this.updateStyleOnFeature(f)}this.updateStyleOnCurrentTool()},onChangeSize:function(){if(this.currentTool==this.tools.modify){var f=this.tools.modify.feature;this.updateStyleOnFeature(f)}this.updateStyleOnCurrentTool()},onChangeText:function(){if(this.currentTool==
this.tools.modify){var f=this.tools.modify.feature;this.updateStyleOnFeature(f)}this.updateStyleOnCurrentTool()},onKeyDown:function(e){if(e.keyCode==13||e.keyCode==9){this.onChangeText();this.txtTextbox.select();OpenLayers.Event.stop(e)}},loadMarkup:function(){try{var slyr=Beacon.MapJS.selectionLayer;var features=slyr.features;var wktWriter=new OpenLayers.Format.WKT;Beacon.API.LoadMapMarkup(function(d){if(d)for(var i=0;i<d.Features.length;i++){var f=d.Features[i];var v=wktWriter.read(f.WKT);var settings=
this.calculateStyleSettings(f.Color,f.Size,f.PointType,f.Label);var newStyle=this.getStyleFromUiFor(f.AnnoType,settings);v.style=OpenLayers.Util.applyDefaults(newStyle,OpenLayers.Feature.Vector.style["default"]);this.markupLayer.addFeatures([v])}this.doneLoading()},function(){Beacon.MapJS.showRetryActivity();this.doneLoading()},this)}catch(e){Beacon.MapJS.logException(e,"MapMarkup.load")}},doneLoading:function(){this.markupLayer.events.register("featuresadded",this,function(){this.delayedSave.delayedInvoke()});
this.markupLayer.events.register("featuresremoved",this,function(){this.delayedSave.delayedInvoke()});this.markupLayer.events.register("featuremodified",this,function(){this.delayedSave.delayedInvoke()})},saveMarkup:function(){try{var markupFeatures=[];var markupData={Features:markupFeatures};var wktWriter=new OpenLayers.Format.WKT;var features=this.markupLayer.features;for(var i=0;i<features.length;i++){var f=features[i];if(f.style&&f.style.annoType){var s=f.style;var markupFeature={WKT:wktWriter.write(f),
Label:s.label,Color:s.strokeColor,Size:s.annoSize,AnnoType:s.annoType,PointType:s.graphicName||null};markupFeatures.push(markupFeature)}}Beacon.API.SaveMapMarkup(markupData,function(){},function(){Beacon.MapJS.showRetryActivity()},this)}catch(e){Beacon.MapJS.logException(e,"MapMarkup.save")}},featureSelected:function(feature){this.divs.deleteFeature.style.backgroundImage="url("+Beacon.Icons.enabledUrl("MarkupDelete")+")";if(feature.style.annoType=="MARKER");else;},featureUnselected:function(){this.divs.deleteFeature.style.backgroundImage=
"url("+Beacon.Icons.disabledUrl("MarkupDelete")+")"},CLASS_NAME:"Beacon.Control.MapMarkup"});
Beacon.Ping={timerId:null,interval:29,init:function(){if(mapConfig){this.serialNumber=mapConfig.Serial;this.timerId=setInterval(this.onTimer,this.interval*1E3)}},dispose:function(){clearInterval(this.timerId)},onTimer:function(){Beacon.API.Ping(function(sn){if(mapConfig.Serial!=sn)if(Beacon.MapJS)window.location.reload()})},CLASS_NAME:"Beacon.Ping"};$(function(){Beacon.Ping.init()});
Beacon.Tile.Image=OpenLayers.Class(OpenLayers.Tile.Image,{opacityOnTransition:0.5,initialize:function(layer,position,bounds,url,size){OpenLayers.Tile.Image.prototype.initialize.apply(this,arguments)},startTransition:function(){if(this.backBufferTile&&this.backBufferTile.imgDiv)OpenLayers.Util.modifyDOMElement(this.backBufferTile.imgDiv,null,null,null,null,null,null,this.opacityOnTransition);OpenLayers.Tile.Image.prototype.startTransition.apply(this,arguments)},CLASS_NAME:"Beacon.Tile.Image"});
Beacon.Icons={base:"/Icons/",hover_rgx1:/(.*)-Active.gif/,hover_rgx2:/(.*)-Enabled.gif/,url:function(name,state,locked){var a=[this.base,name,"/",name,"-16-"];if(locked)a.push("Locked-");a.push(state,".gif");return a.join("")},enabledUrl:function(name,locked){return this.url(name,"Enabled",locked)},disabledUrl:function(name,locked){return this.url(name,"Disabled",locked)},activeUrl:function(name,locked){return this.url(name,"Active",locked)},ajax16:"/Images/ajax-loader-small.gif",ajax32:"/Images/ajax-loader-big.gif",
hoverize:function(){$("IMG[hover]").hover(this.iconHoverOverHandler,this.iconHoverOutHandler).removeAttr("hover");$("INPUT:image[hover]").hover(this.iconHoverOverHandler,this.iconHoverOutHandler).removeAttr("hover")},iconHoverOverHandler:function(){var src=$(this).attr("src");var src2=src.replace(Beacon.Icons.hover_rgx2,"$1-Active.gif");$(this).css("cursor","hand");$(this).attr("src",src2)},iconHoverOutHandler:function(){var src=$(this).attr("src");var src2=src.replace(Beacon.Icons.hover_rgx1,"$1-Enabled.gif");
$(this).attr("src",src2)},hoverizeToolbar:function(div){$("div",div).hover(function(){var src=$(this).css("background-image");if(Beacon.Icons.hover_rgx2.test(src)){var src2=src.replace(Beacon.Icons.hover_rgx2,"$1-Active.gif");$(this).css("background-image",src2)}},function(){var src=$(this).css("background-image");if(Beacon.Icons.hover_rgx1.test(src))$(this).css("background-image","")})},CLASS_NAME:"Beacon.Icons"};
Beacon.MapJS={map:null,events:null,EVENT_TYPES:["changelayer"],cssVer:2,selectionLayer:null,bufferLayer:null,layerSources:null,spatialServers:null,pageUnloading:null,controls:{mouseNavigation:null,kbdNavigation:null,identify:null,selectmenu:null,citizeninput:null,mainpanel:null},initOlMap:function(){try{Beacon.BrowserCompatibility.Detect();Beacon.BrowserCompatibility.Notify()}catch(e){}try{this.buildMap()}catch(e){this.showRetryActivity(e,"buildMap")}this.layerSources={};this.spatialServers={};try{this.addOsmLayers()}catch(e){this.showRetryActivity(e,
"addOsmLayers")}try{this.addTileCacheLayers()}catch(e){this.showRetryActivity(e,"addTileCacheLayers")}try{this.addDynamicLayers()}catch(e){this.showRetryActivity(e,"addDynamicLayers")}try{this.addSelectionLayer()}catch(e){this.showRetryActivity(e,"addSelectionLayer")}try{this.addBufferLayer()}catch(e){this.showRetryActivity(e,"addBufferLayer")}try{this.addToolsAndControls()}catch(e){this.showRetryActivity(e,"addToolsAndControls")}try{var mapExtDly=new Beacon.DelayedFunction(function(){var ext=this.getExtent();
var res=this.getResolution();Beacon.API.UpdateMapExtent(ext,res)},this.map,1013);this.map.events.register("moveend",mapExtDly,mapExtDly.delayedInvoke)}catch(e){this.showRetryActivity(e,"setup extent tracking")}try{this.controls.identify.updateOnLayerChange();this.controls.mainpanel.redraw();Beacon.TOC.onPageLoad()}catch(e){this.showRetryActivity(e,"toc page load")}try{this.map.events.register("zoomend",this,this.onZoomEnd);Beacon.TOC.events.register("refreshServer",this,this.onLayerNeedsRefresh)}catch(e){this.showRetryActivity(e,
"wire up events")}try{var initExtentStpl=new OpenLayers.Bounds(mapConfig.CurrentExtent.minx,mapConfig.CurrentExtent.miny,mapConfig.CurrentExtent.maxx,mapConfig.CurrentExtent.maxy);this.map.zoomToExtent(initExtentStpl,false);this.onZoomEnd()}catch(e){this.showRetryActivity(e,"initial zoom")}try{this.addOverviewMap()}catch(e){this.showRetryActivity(e,"addOverviewMap")}if(Beacon.BrowserCompatibility.isSmallScreen)this.addMobileZoombar();else this.addPanZoomOverlay();var that=this;$(window).bind("beforeunload",
function(){that.pageUnloading=true;that.hideActivity()})},buildMap:function(){OpenLayers.IMAGE_RELOAD_ATTEMPTS=1;OpenLayers.DOTS_PER_INCH=96;OpenLayers.ImgPath="/App_Themes/OL/img/";this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES,false,{});var maxExtentStpl=new OpenLayers.Bounds(mapConfig.MaxExtent.minx,mapConfig.MaxExtent.miny,mapConfig.MaxExtent.maxx,mapConfig.MaxExtent.maxy);var stpl=new OpenLayers.Projection("EPSG:"+mapConfig.SRID);this.controls.kbdNavigation=new OpenLayers.Control.KeyboardDefaults;
this.controls.mouseNavigation=new OpenLayers.Control.Navigation({mouseWheelOptions:{interval:333,cumulative:false},dragPanOptions:{enableKinetic:true}});var mapOptions={projection:stpl,units:mapConfig.Units,fractionalZoom:false,displayProjection:stpl,maxExtent:maxExtentStpl,restrictedExtent:maxExtentStpl,allOverlays:true,maxResolution:maxExtentStpl.getWidth()/250,minResolution:0.2,fallThrough:false,theme:"/"+this.cssVer+"/App_Themes/OL/style.css",controls:[this.controls.mouseNavigation,this.controls.kbdNavigation]};
this.map=new OpenLayers.Map("olMap",mapOptions)},addOsmLayers:function(){for(var i=0;i<mapConfig.OsmTileLayers.length;i++){var cfg=mapConfig.OsmTileLayers[i];var osmLayer=new OpenLayers.Layer.OSM("OSM"+i);osmLayer.beaconServerId=cfg.beaconServerId;osmLayer.beaconLayerIds=cfg.beaconLayerIds;osmLayer.singleLayerSource=true;osmLayer.transitionEffect="resize";osmLayer.buffer=1;osmLayer.isBaseLayer=false;osmLayer.visibility=cfg.visibility;osmLayer.opacity=cfg.opacity;this.spatialServers[cfg.beaconServerId]=
osmLayer;for(var j=0;j<cfg.beaconLayerIds.length;j++)this.layerSources[cfg.beaconLayerIds[j]]=osmLayer;this.map.addLayer(osmLayer);osmLayer.events.on({loadstart:function(){Beacon.TOC.onLayerLoadStart(this.beaconServerId)},loadend:function(){Beacon.TOC.onLayerLoadEnd(this.beaconServerId)},loadcancel:function(){Beacon.TOC.onLayerLoadEnd(this.beaconServerId)},visibilitychanged:function(){Beacon.TOC.onLayerVisibilityChanged(this.beaconServerId,this.getVisibility())},scope:osmLayer})}},addTileCacheLayers:function(){for(var i=
0;i<mapConfig.AgsTileLayers.length;i++){var cfg=mapConfig.AgsTileLayers[i];var agsLayer=new Beacon.Layer.AgsCache("AGS"+i,cfg.url,{beaconServerId:cfg.beaconServerId,beaconLayerIds:cfg.beaconLayerIds,singleLayerSource:true,transitionEffect:"resize",buffer:0,isBaseLayer:false,visibility:cfg.visibility,resolutions:cfg.resolutions,opacity:cfg.opacity,tileSize:new OpenLayers.Size(cfg.tileSize,cfg.tileSize),tileOrigin:new OpenLayers.LonLat(cfg.tileOriginX,cfg.tileOriginY)});this.spatialServers[cfg.beaconServerId]=
agsLayer;for(var j=0;j<cfg.beaconLayerIds.length;j++)this.layerSources[cfg.beaconLayerIds[j]]=agsLayer;this.map.addLayer(agsLayer);agsLayer.events.on({loadstart:function(){Beacon.TOC.onLayerLoadStart(this.beaconServerId)},loadend:function(){Beacon.TOC.onLayerLoadEnd(this.beaconServerId)},loadcancel:function(){Beacon.TOC.onLayerLoadEnd(this.beaconServerId)},visibilitychanged:function(){Beacon.TOC.onLayerVisibilityChanged(this.beaconServerId,this.getVisibility())},scope:agsLayer})}},addDynamicLayers:function(){var baseResolutions=
null;if(this.map.baseLayer)baseResolutions=this.map.baseLayer.resolutions;for(var i=0;i<mapConfig.BeaconLayers.length;i++){var cfg=mapConfig.BeaconLayers[i];var beaconLayer=new Beacon.Layer.Beacon("Beacon"+i,"/API/RenderMap.ashx",{beaconServerId:cfg.beaconServerId,beaconLayerIds:cfg.beaconLayerIds,serverType:cfg.serverType,drawable:cfg.drawable,singleLayerSource:false,transitionEffect:"resize",visibility:false,alpha:true,isBaseLayer:false,singleTile:true,resolutions:baseResolutions,ratio:1.2,buffer:0,
opacity:cfg.opacity,async:false});this.spatialServers[cfg.beaconServerId]=beaconLayer;for(var j=0;j<cfg.beaconLayerIds.length;j++)this.layerSources[cfg.beaconLayerIds[j]]=beaconLayer;this.map.addLayer(beaconLayer);beaconLayer.events.on({loadstart:function(){Beacon.TOC.onLayerLoadStart(this.beaconServerId)},loadend:function(){Beacon.TOC.onLayerLoadEnd(this.beaconServerId)},loadcancel:function(){Beacon.TOC.onLayerLoadEnd(this.beaconServerId)},scope:beaconLayer})}},addSelectionLayer:function(){this.selectionLayer=
new Beacon.Layer.SelectionLayer(mapConfig.KeyValue,{strategies:[],symbology:{selection:mapConfig.SelectionSymbology,key:mapConfig.KeySymbology,hover:mapConfig.HoverSymbology,buffer:mapConfig.BufferSymbology}});this.map.addLayer(this.selectionLayer)},addBufferLayer:function(){var rgba=mapConfig.BufferSymbology;this.bufferLayer=new OpenLayers.Layer.Vector("buffer layer",{visibility:false,style:{fillColor:"rgb("+rgba.R+","+rgba.G+","+rgba.B+")",strokeColor:"rgb("+rgba.R+","+rgba.G+","+rgba.B+")",fillOpacity:rgba.A,
strokeOpacity:0.9,strokeWidth:2,graphicZIndex:3}});this.map.addLayer(this.bufferLayer)},addToolsAndControls:function(){this.map.addControls([new Beacon.Control.Scalebar({displayClass:"bScalebar"}),new Beacon.Control.DisplayXY({displayClass:"bControlDisplayXY"})]);var panel=new OpenLayers.Control.Panel({displayClass:"mapToolbar",position:new OpenLayers.Pixel(60,8)});this.controls.mainpanel=panel;this.controls.identify=new Beacon.Control.Identify({title:"Identify",displayClass:"identify",selectionLayer:this.selectionLayer});
panel.addControls(this.controls.identify);var selectToolPanel=new OpenLayers.Control.Panel({displayClass:"mapToolbar",saveState:true});selectToolPanel.addControls([new Beacon.Control.Select({mode:"normal",title:"Select by click / rectangle",displayClass:"selectByRect",selectionLayer:this.selectionLayer}),new Beacon.Control.Select({mode:"polygon",enableHovering:false,title:"Select by polygon",displayClass:"selectByPoly",selectionLayer:this.selectionLayer}),new Beacon.Control.Select({mode:"line",enableHovering:false,
title:"Select by line",displayClass:"selectByLine",selectionLayer:this.selectionLayer}),new Beacon.Control.Select({mode:"freehand",enableHovering:false,title:"Select by freehand drawing",displayClass:"selectByFreehand",selectionLayer:this.selectionLayer})]);selectToolPanel.defaultControl=selectToolPanel.controls[0];var selectTools=new Beacon.Control.ToolWithAuxControl({title:"Selection Tools",displayClass:"select",useActiveIcon:true,useExecuteCompleted:false,contentControl:selectToolPanel});panel.addControls(selectTools);
var nav=new OpenLayers.Control.NavigationHistory({previousOptions:{title:"Zoom previous",displayClass:"zoomprevious"},nextOptions:{title:"Zoom next",displayClass:"zoomnext"}});this.map.addControl(nav);var zoomToolPanel=new OpenLayers.Control.Panel({displayClass:"mapToolbar",saveState:true});zoomToolPanel.addControls([new OpenLayers.Control.ZoomBox({title:"Zoom in",out:false,alwaysZoom:true,displayClass:"zoomin"}),new OpenLayers.Control.ZoomBox({title:"Zoom out",out:true,alwaysZoom:true,displayClass:"zoomout"}),
new OpenLayers.Control.ZoomToMaxExtent({title:"Full extent",displayClass:"zoomextent"}),new Beacon.Control.ZoomToSelection(this.selectionLayer,{title:"Zoom to selection",displayClass:"zoomselection"}),nav.previous,nav.next]);zoomToolPanel.defaultControl=zoomToolPanel.controls[0];var zoomTools=new Beacon.Control.ToolWithAuxControl({title:"Zoom Tools",displayClass:"zoomPanel",useActiveIcon:true,useExecuteCompleted:false,contentControl:zoomToolPanel});panel.addControls(zoomTools);panel.addControls(new OpenLayers.Control({title:"Default mouse mode",
displayClass:"pan"}));panel.addControls(new Beacon.Control.ClearMap(this.selectionLayer,{title:"Clear Selection",displayClass:"clearmap"}));var bufferControl=new Beacon.Control.SpatialSelection({displayClass:"spatialselectionPane"});var bufferTool=new Beacon.Control.ToolWithAuxControl({title:"Spatial selection tool",displayClass:"spatialselection",useActiveIcon:false,useExecuteCompleted:true,contentControl:bufferControl});panel.addControls(bufferTool);var externalTools=new OpenLayers.Control.Panel({displayClass:"mapToolbar",
autoActivate:false,saveState:true});var externalServicesPanel=null;if(mapConfig.Permissions.Streetview)externalTools.addControls(new Beacon.Control.GoogleStreetview({title:"Google Streetview",displayClass:"streetview",autoActivate:false}));if(mapConfig.Permissions.Bing)externalTools.addControls(new Beacon.Control.BingMaps({title:"Bing Maps",displayClass:"bingmaps",selectionLayer:this.selectionLayer}));if(mapConfig.Permissions.Pictometry)externalTools.addControls(new Beacon.Control.Pictometry({title:"Pictometry Image Navigator",
displayClass:"pictometry",selectionLayer:this.selectionLayer}));if(externalTools.controls.length>=2){externalTools.defaultControl=externalTools.controls[0];externalServicesPanel=new Beacon.Control.ToolWithAuxControl({title:"External services",displayClass:"externalsvcs",useActiveIcon:false,useExecuteCompleted:false,contentControl:externalTools});panel.addControls(externalServicesPanel)}if(externalTools.controls.length==1)panel.addControls(externalTools.controls[0]);var measureControl=new Beacon.Control.Measure({title:"Measure",
displayClass:"measurePane"});var measureTool=new Beacon.Control.ToolWithAuxControl({title:"Measure",displayClass:"measure",useActiveIcon:false,useExecuteCompleted:false,contentControl:measureControl});panel.addControls(measureTool);var zoomXyControl=new Beacon.Control.ZoomToXY({title:"Zoom to XY",displayClass:"zoomtoxypPane"});var zoomXyTool=new Beacon.Control.ToolWithAuxControl({title:"Zoom to XY",displayClass:"zoomtoxy",useActiveIcon:false,useExecuteCompleted:true,contentControl:zoomXyControl});
panel.addControls(zoomXyTool);var mapMarkupControl=new Beacon.Control.MapMarkup({displayClass:"mapmarkup"});var mapMarkupTool=new Beacon.Control.ToolWithAuxControl({title:"Map Markup Tools",displayClass:"mapmarkup",useActiveIcon:false,useExecuteCompleted:false,contentControl:mapMarkupControl});panel.addControls(mapMarkupTool);if(mapConfig.Permissions.ExtractMapData)panel.addControls(new Beacon.Control.DataExtract({title:"Data Extract",displayClass:"dataextract"}));panel.addControls(new OpenLayers.Control.Button({title:"Toggle map size",
displayClass:"resizemap",trigger:Beacon.MapJS.maximizeMap}));panel.addControls(new OpenLayers.Control.Button({title:"Print Setup",displayClass:"printsetup",trigger:Beacon.MapJS.printMapSetup}));panel.addControls(new OpenLayers.Control.Button({title:"Print",displayClass:"print",trigger:Beacon.MapJS.printMap}));panel.addControls(new OpenLayers.Control.Button({title:"Download Map Image",displayClass:"exportmap",trigger:Beacon.MapJS.exportMap}));panel.defaultControl=panel.controls[0];this.map.addControl(panel);
zoomTools.createPanel();selectTools.createPanel();measureTool.createPanel();bufferTool.createPanel();zoomXyTool.createPanel();mapMarkupTool.createPanel();if(externalServicesPanel)externalServicesPanel.createPanel();var quickZoomControl=new Beacon.Control.QuickZoom({title:"Quick Zoom",displayClass:"quickzoom"});this.map.addControl(quickZoomControl);setTimeout(function(){quickZoomControl.populateDropdown({layerId:mapConfig.LayerId})},500);Beacon.Icons.hoverizeToolbar(panel.div)},addOverviewMap:function(){var ext=
new OpenLayers.Bounds(mapConfig.OverviewExtent.minx,mapConfig.OverviewExtent.miny,mapConfig.OverviewExtent.maxx,mapConfig.OverviewExtent.maxy);var ovLayer=new OpenLayers.Layer.Image("Overview",mapConfig.OverviewUrl,ext,new OpenLayers.Size(160,160));var ovMap=new Beacon.Control.OverviewMap({layers:[ovLayer],autoPan:false,size:new OpenLayers.Size(160,160),displayClass:"bControlOverviewMap",div:document.getElementById("overviewJsMapPane"),mapOptions:{projection:this.map.projection,units:this.map.units,
numZoomLevels:1,displayProjection:this.map.displayProjection,minExtent:ext,maxExtent:ext,restrictedExtent:ext,theme:"/"+this.cssVer+"/App_Themes/OL/style.css"}});this.map.addControl(ovMap)},addPanZoomOverlay:function(){var panZoomBarControl=new OpenLayers.Control.PanZoomBar;this.map.addControl(panZoomBarControl);this.map.addControl(new Beacon.Control.PanZoomBarScaleHint(panZoomBarControl.zoombarDiv,panZoomBarControl.slider,{displayClass:"scalehint"}))},addMobileZoombar:function(){this.map.addControl(new OpenLayers.Control.ZoomPanel({displayClass:"bMobileZoomPanel"}))},
changeActiveLayer:function(layerId){try{this.showActivity("Changing layers");Beacon.TOC.changeActiveLayer(layerId);mapConfig.LayerId=layerId;this.selectionLayer.clearAllPopups();this.selectionLayer.clearSelection();Beacon.GA.TrackEvent("ChangeLayers","Click")}catch(e){Beacon.MapJS.showRetryActivity(e,"changeActiveLayer")}Beacon.API.GetTabs(layerId,function(tabs){try{mapConfig.Tabs=tabs;Beacon.Tabs.generateTabStrip(0,null);this.controls.identify.updateOnLayerChange();this.controls.mainpanel.redraw();
this.hideActivity();this.events.triggerEvent("changelayer",{layerId:layerId})}catch(e){Beacon.MapJS.showRetryActivity(e,"changeActiveLayer.callback")}},function(){Beacon.MapJS.showRetryActivity()},this,null)},onZoomEnd:function(){Beacon.TOC.onZoomEnd(this.map.getResolution());Beacon.TOC.updateLegend()},onLayerNeedsRefresh:function(e){var multiLayerSource=false;var lyrSrc=this.spatialServers[e.serverId];if(lyrSrc.CLASS_NAME=="Beacon.Layer.Beacon")multiLayerSource=true;else if(lyrSrc.CLASS_NAME=="Beacon.Layer.AgsCache")multiLayerSource=
false;if(multiLayerSource)lyrSrc.redraw(true);if(!multiLayerSource)lyrSrc.setVisibility(e.visible)},getBeaconLayer:function(layerId){var lyrs=mapConfig.Layers;for(var i=0;i<lyrs.length;i++){var lyr=lyrs[i];if(lyr.LayerId==layerId)return lyr}return null},enableDynamicLayers:function(){for(var i=0;i<this.map.layers.length;i++){var lyr=this.map.layers[i];if(lyr.CLASS_NAME=="Beacon.Layer.Beacon")lyr.setVisibility(true)}},maximizeMap:function(){var mapdiv=$("#olMap");var tocdiv=$("#leftPaneMap");var tocbtn=
$("#btnLeftPaneMap");if(mapdiv.css("position")=="fixed"){mapdiv.css({top:"",left:"",bottom:"",right:"",width:"100%",height:"500px",position:"relative"});$("BODY").css("overflow","");Beacon.GA.TrackEvent("MaximizeMap","Off");tocdiv.css({top:"",bottom:"",left:"",width:"",position:"relative",zIndex:"",border:"",backgroundColor:""});tocdiv.stop().stop().stop().unbind("mouseenter").unbind("mouseleave");tocbtn.unbind("click").hide()}else{mapdiv.css({top:"0px",left:"0px",bottom:"0px",right:"0px",width:"100%",
height:"100%",backgroundColor:"White",position:"fixed"});tocdiv.css({top:"0px",bottom:"0px",left:"-167px",width:"160px",position:"fixed",zIndex:"10",border:"1px solid black",borderRight:"4px solid #939292",backgroundColor:"#d2d2d2"});tocbtn.show().removeClass("close").addClass("open");tocbtn.click(function(){if(this.tocOpen){tocdiv.stop().stop().stop().animate({left:"-167px"},666);$("#btnLeftPaneMap").removeClass("close").addClass("open");this.tocOpen=null}else{tocdiv.stop().stop().stop().animate({left:"0px"},
666);$("#btnLeftPaneMap").removeClass("open").addClass("close");this.tocOpen=true}});$("BODY").css("overflow","hidden");Beacon.GA.TrackEvent("MaximizeMap","On")}Beacon.MapJS.map.updateSize()},printMap:function(){var url=Beacon.Tabs.getUrl(mapConfig.LayerId,mapConfig.PageTypeId,mapConfig.PageId,Beacon.MapJS.selectionLayer.keyValue,"RenderPdf.aspx")+"&Direct=1"+"&Q="+(new Date).getTime();window.open(url,"_blank");Beacon.GA.TrackEvent("PrintMap","Click")},exportMap:function(){var url="/API/"+Beacon.Tabs.getUrl(mapConfig.LayerId,
mapConfig.PageTypeId,mapConfig.PageId,Beacon.MapJS.selectionLayer.keyValue,"DownloadMap.ashx")+"&bbox="+this.map.getExtent().toBBOX(0)+"&w="+this.map.getSize().w+"&h="+this.map.getSize().h+"&Q="+(new Date).getTime();window.open(url,"_blank");Beacon.GA.TrackEvent("ExportMap","Click")},printMapSetup:function(){var urlCurrent=Beacon.Tabs.getUrl(mapConfig.LayerId,mapConfig.PageTypeId,mapConfig.PageId,Beacon.MapJS.selectionLayer.keyValue,"~").substring(3);var urlPrintSetup=Beacon.Tabs.getUrl(mapConfig.LayerId,
17,0,Beacon.MapJS.selectionLayer.keyValue);Beacon.API.SetPrintUrl(urlCurrent,function(){window.location=urlPrintSetup},function(){Beacon.MapJS.showRetryActivity()},this);Beacon.GA.TrackEvent("PrintMapSetup","Click")},showActivity:function(msg,extra){$("#activityIndicator").text(msg);if(!extra)extra="";$("#activityIndicator").attr("title",extra);$("#activityIndicator").animate({top:"0px"},1E3,"swing")},hideActivity:function(){$("#activityIndicator").stop().animate({top:"-40px"},500,"swing")},showRetryActivity:function(ex,
message){if(this.pageUnloading)return;$("#activityIndicator").html("Communications error <a href='#' id='actIndRetry'>RETRY</a>");$("#activityIndicator").attr("title","A problem communicating with the server has prevented this operation from working.  Click retry to reload the page and try again.");$("#activityIndicator").animate({top:"0px"},1E3,"swing");$("#actIndRetry").click(function(){window.location.reload()});Beacon.MapJS.logException(ex,message)},logException:function(ex,message){if(ex){var st=
printStackTrace({e:ex});var stacktrace=st.join("\n");console.error(stacktrace);Beacon.API.LogJsError(message,stacktrace)}},CLASS_NAME:"Beacon.MapJS"};
Beacon.TOC={layers:[],groups:[],layerSources:{},serverLayers:{},activeLayer:null,legendDly:null,EVENT_TYPES:["refreshServer"],events:null,onPageLoad:function(){this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES);this.layerSources={};this.serverLayers={};this.populateLayerServiceLookup(mapConfig.BeaconLayers);this.populateLayerServiceLookup(mapConfig.AgsTileLayers);this.populateLayerServiceLookup(mapConfig.OsmTileLayers);Beacon.TOC.layers=[];Beacon.TOC.groups=[];$(".toc .checkbox").each(function(){var img=
$(this);var lyr=new Beacon.TOC.Layer(img);Beacon.TOC.layers[lyr.layerId]=lyr});for(var o in Beacon.TOC.groups){var group=Beacon.TOC.groups[o];group.connectToUI()}this.activeLayer=this.layers[mapConfig.LayerId];this.activeLayer.forceGroupVisible();this.legendDly=new Beacon.DelayedFunction(function(){this.updateLegendInternal()},this,1E3);this.updateLegend();this.updateDisclaimers()},onZoomEnd:function(resolution){for(var o in this.layers){var layer=this.layers[o];layer.updateScale(resolution)}},populateLayerServiceLookup:function(layers){for(var i=
0;i<layers.length;i++){var layer=layers[i];this.serverLayers[layer.beaconServerId]=layer.beaconLayerIds;for(var j=0;j<layer.beaconLayerIds.length;j++)this.layerSources[layer.beaconLayerIds[j]]=layer.beaconServerId}},onLayerLoadStart:function(serverId){var layerIds=Beacon.TOC.serverLayers[serverId];for(var i=0;i<layerIds.length;i++){var id=layerIds[i];var layer=Beacon.TOC.layers[id];if(layer)layer.onLayerLoadStart.apply(layer)}},onLayerLoadEnd:function(serverId){var layerIds=Beacon.TOC.serverLayers[serverId];
for(var i=0;i<layerIds.length;i++){var id=layerIds[i];var layer=Beacon.TOC.layers[id];if(layer)layer.onLayerLoadEnd.apply(layer)}},onLayerVisibilityChanged:function(serverId,visibility){if(!visibility){var layerIds=Beacon.TOC.serverLayers[serverId];for(var i=0;i<layerIds.length;i++){var id=layerIds[i];var layer=Beacon.TOC.layers[id];if(layer)layer.onLayerVisibilityChanged.apply(layer)}}},changeActiveLayer:function(layerId){var layer=this.layers[layerId];this.activeLayer.unsetActive();this.activeLayer=
layer;layer.setActive();this.updateLegend()},getVisibleLayerIds:function(){var a=[];for(var o in this.layers){var layer=this.layers[o];if(layer.willLayerDraw())a.push(layer.layerId)}return a},getVisibleLayerIdsForServerId:function(serverId){var a=[];for(var o in this.layers){var layer=this.layers[o];if(layer.layerSourceId==serverId)if(layer.willLayerDraw())a.push(layer.layerId)}return a},updateDisclaimers:function(){var layerIds=this.getVisibleLayerIds();var disclaimerDiv=$("#mapJsDisclaimers");Beacon.API.GetDisclaimers(layerIds,
function(html){disclaimerDiv.html(html)},function(){},this,null)},updateLegendInternal:function(){if(this.isLegendVisible()){var map=Beacon.MapJS.map;var ext=map.getExtent();var layerIds=this.getVisibleLayerIds().join("|");var res=map.getResolution();var url="/API/RenderLegend.ashx?"+"&AppId="+mapConfig.AppId+"&Layers="+layerIds+"&res="+res;$("#legendJsMapPane").load(url)}},updateLegend:function(){this.legendDly.delayedInvoke()},isLegendVisible:function(){return $.cookie("LGND")=="YES"},initUiStateOnPageload:function(){if(this.isLegendVisible()){this.showLegendPane();
Beacon.GA.TrackEvent("TOC","Legend")}else{this.showLayerListPane();Beacon.GA.TrackEvent("TOC","Layers")}},showLegendPane:function(){$("#tocJsMapPane").hide();$("#legendJsMapPane").show();Beacon.TOC.updateLegend();$("#btnShowLegendPane").css("font-weight","bold");$("#btnShowTocPane").css("font-weight","normal");$.cookie("LGND","YES")},showLayerListPane:function(){$("#legendJsMapPane").hide();$("#tocJsMapPane").show();$("#btnShowLegendPane").css("font-weight","normal");$("#btnShowTocPane").css("font-weight",
"bold");$.cookie("LGND",null)},toggleLongLegend:function(o){var layerId=o.attributes["layerid"].value;var divExtras=$("#legendExtra_"+layerId);if(o.innerText!="more..."){o.innerText="more...";divExtras.slideUp()}else{o.innerText="less...";divExtras.slideDown()}},CLASS_NAME:"Beacon.TOC"};
Beacon.TOC.Layer=OpenLayers.Class({layerId:null,layerSource:null,layerSourceId:null,groupId:null,group:null,visible:null,minScale:null,maxScale:null,checkboxImg:null,layerDiv:null,initialize:function(img){this.layerId=img.attr("layerid");this.groupId=img.attr("groupid");this.group=null;this.visible=img.attr("v");this.minScale=img.attr("minscale");this.maxScale=img.attr("maxscale");this.checkboxImg=img;this.layerDiv=img.parent();if(this.groupId){var grp=Beacon.TOC.groups[this.groupId];if(!grp){grp=
new Beacon.TOC.Group(this.groupId);Beacon.TOC.groups[this.groupId]=grp}grp.layers[this.layerId]=this;this.group=grp}this.updateLayerCheckbox();var o=this;this.checkboxImg.click(function(){o.toggleLayerVisibility()});this.layerSourceId=Beacon.TOC.layerSources[this.layerId]},destroy:function(){this.checkboxImg=null;this.layerDiv=null;this.group=null},toggleLayerVisibility:function(){var newVisibility=null;if(this.visible==1)newVisibility=2;if(this.visible==2)newVisibility=1;if(this.visible==-1)newVisibility=
-2;if(this.visible==-2)newVisibility=-1;if(newVisibility){this.visible=newVisibility;this.spinLayerCheckbox();var layerId=this.layerId;Beacon.API.SetLayerVisibility(layerId,this.isLayerChecked(),function(){this.updateMapLayer();Beacon.TOC.updateLegend();Beacon.TOC.updateDisclaimers()},function(){Beacon.MapJS.showRetryActivity()},this)}},updateMapLayer:function(){if(this.isLayerInScale()){var event={serverId:this.layerSourceId,visible:this.isLayerChecked()};Beacon.TOC.events.triggerEvent("refreshServer",
event)}else this.updateLayerCheckbox()},onLayerLoadStart:function(){if(this.willLayerDraw())this.spinLayerCheckbox()},onLayerLoadEnd:function(){this.updateLayerCheckbox()},onLayerVisibilityChanged:function(){this.updateLayerCheckbox()},updateLayerCheckbox:function(){var newIcon=null;if(this.visible==1)newIcon="NodeUncheck";if(this.visible==2)newIcon="NodeCheck";if(this.visible==0)newIcon="PadLock";if(this.visible==-1)newIcon="NodeUncheck2";if(this.visible==-2)newIcon="NodeCheck2";this.checkboxImg.attr("src",
Beacon.Icons.enabledUrl(newIcon))},setActive:function(){this.layerDiv.addClass("active");this.forceGroupVisible();if(this.isLayerChecked()==false)this.toggleLayerVisibility();var url=Beacon.Icons.activeUrl("InformationCircle");$(".subname,.name",this.layerDiv).prepend("<img hover=1 src='"+url+"'>");Beacon.Icons.hoverize()},unsetActive:function(){this.layerDiv.removeClass("active");$(".subname>IMG,.name>IMG",this.layerDiv).remove()},spinLayerCheckbox:function(){this.checkboxImg.attr("src",Beacon.Icons.ajax16)},
forceGroupVisible:function(){if(this.group)this.group.showGroupLayer()},updateScale:function(scale){var inScale=true;if(this.minScale!=0&&scale<this.minScale)inScale=false;if(this.maxScale!=0&&scale>this.maxScale)inScale=false;var newState=this.visible;if(this.visible==-1&&inScale)newState=1;if(this.visible==-2&&inScale)newState=2;if(this.visible==1&&!inScale)newState=-1;if(this.visible==2&&!inScale)newState=-2;if(this.visible!=newState){this.visible=newState;this.updateLayerCheckbox()}},willLayerDraw:function(){return this.visible==
2},isLayerChecked:function(){return Math.abs(this.visible)==2},isLayerInScale:function(){return this.visible>0},CLASS_NAME:"Beacon.TOC.Layer"});
Beacon.TOC.Group=OpenLayers.Class({groupId:null,toggleImg:null,expanded:false,layers:null,originalHeight:null,initialize:function(groupId){this.groupId=groupId;this.expanded=false;this.layers=[]},destroy:function(){this.layers=[];this.toggleImg=null},updateGroupLayerIcon:function(){if(this.expanded){this.toggleImg.attr("src",Beacon.Icons.enabledUrl("NodeMinus"));this.setCookie(1)}else{this.toggleImg.attr("src",Beacon.Icons.enabledUrl("NodePlus"));this.setCookie(null)}for(var o in this.layers){var layer=
this.layers[o];if(this.expanded)layer.layerDiv.show();else layer.layerDiv.hide()}},toggleGroupLayer:function(){this.expanded=!this.expanded;this.updateGroupLayerIcon()},showGroupLayer:function(){this.expanded=true;this.updateGroupLayerIcon()},connectToUI:function(){this.toggleImg=$('.grouptoggle[groupid="'+this.groupId+'"]');this.originalHeight=this.toggleImg.parent().height();this.expanded=this.getCookie()?true:false;this.updateGroupLayerIcon();var o=this;this.toggleImg.click(function(){o.toggleGroupLayer()})},
getCookieName:function(){return"TOC-"+activeAppId+"-"+this.groupId},setCookie:function(flag){$.cookie(this.getCookieName(),flag)},getCookie:function(){return $.cookie(this.getCookieName())},CLASS_NAME:"Beacon.TOC.Group"});
Beacon.ResultsPane={infoPaneDiv:null,resultsPaneDiv:null,warningPaneDiv:null,wireup:function(){if(!this.infoPaneDiv)this.infoPaneDiv=$("#RightPane1_Info1_pnlInfo");if(!this.resultsPaneDiv){this.resultsPaneDiv=$("#ResultsPaneDiv");this.isVisible=this.resultsPaneDiv.is(":visible")}},isVisible:false,regx:/[\.\s]/g,getsafeid:function(featureId){return"resId_"+featureId.replace(this.regx,"")},addToSelection:function(featureId,parentId,featureHtml,hoverCallback,clickCallback,callbackScope){this.wireup();
if(!this.isVisible){this.infoPaneDiv.hide();this.resultsPaneDiv.show();this.isVisible=true}var id=this.getsafeid(featureId);var html='<div id="'+id+'" class="resultitem">'+featureHtml;if(parentId)html+='<div style="font-size:7pt;">[multi-parcel feature]</div>';html+='<div style="font-size:7pt;">'+Beacon.Tabs.getReportLinksHtml(featureId)+"</div>";html+="</div>";this.resultsPaneDiv.append(html);var fdiv=$("#"+id,this.resultsPaneDiv);$("A",fdiv).click(function(e){e.stopPropagation()});fdiv.hover(function(){fdiv.addClass("resultitemhover");
if(hoverCallback)hoverCallback.call(callbackScope,featureId,true);if(Beacon.MapSV.map)Beacon.MapSV.map.OnResultPaneFeatureHover(featureId,true)},function(){fdiv.removeClass("resultitemhover");if(hoverCallback)hoverCallback.call(callbackScope,featureId,false);if(Beacon.MapSV.map)Beacon.MapSV.map.OnResultPaneFeatureHover(featureId,false)});fdiv.click(function(){if(clickCallback)clickCallback.call(callbackScope,featureId);if(Beacon.MapSV.map)Beacon.MapSV.map.OnResultPaneFeatureClick(featureId)})},removeFromSelection:function(featureId){this.wireup();
var id=this.getsafeid(featureId);var fdiv=$("#"+id,this.resultsPaneDiv);if(fdiv)fdiv.remove();this.updateDisplay(0,null)},removeAll:function(){if(this.resultsPaneDiv)this.resultsPaneDiv.empty()},setKeyFeatureId:function(featureId){$(".resultitemkey",this.resultsPaneDiv).removeClass("resultitemkey");var id=this.getsafeid(featureId);var fdiv=$("#"+id,this.resultsPaneDiv);var firstDiv;if($("#resultsWarningPane").length==0)firstDiv=$("DIV:first",this.resultsPaneDiv);else firstDiv=$("DIV:not(#resultsWarningPane):first",
this.resultsPaneDiv);if(fdiv[0].id==firstDiv[0].id)return;if(fdiv){var rp=this.resultsPaneDiv;fdiv.insertBefore(firstDiv);$(this.resultsPaneDiv).scrollTo("0%",200)}fdiv.addClass("resultitemkey")},updateDisplay:function(featureCount){this.wireup();if(featureCount>0){if(!this.isVisible){this.infoPaneDiv.hide();this.resultsPaneDiv.show();this.isVisible=true}}else if(this.isVisible){this.infoPaneDiv.show();this.resultsPaneDiv.hide();this.isVisible=false}if(Beacon.BrowserCompatibility.limitResults)if(featureCount>=
Beacon.BrowserCompatibility.limitResults){if($("#resultsWarningPane").length==0){var html="<div id='resultsWarningPane'>"+"<span style='color:Red; font-weight:bold'>Warning!</span> "+"&nbsp;Due to performance issues, your browser is limited to selecting a maximum of "+Beacon.BrowserCompatibility.limitResults+" items on the map. "+"Upgrade to a modern browser to remove this limit. "+"<a href='http://beacongis.com/browser'>Learn more</a>"+"</div>";this.resultsPaneDiv.prepend(html)}}else $("#resultsWarningPane").remove()},
onFeatureMouseOver:function(featureid){var id=this.getsafeid(featureid);var fdiv=$("#"+id,this.resultsPaneDiv);fdiv.addClass("resultitemhover")},onFeatureMouseOut:function(featureid){var id=this.getsafeid(featureid);var fdiv=$("#"+id,this.resultsPaneDiv);fdiv.removeClass("resultitemhover")},CLASS_NAME:"Beacon.ResultsPane"};
Beacon.Tabs={hasPageType:function(pagetype){for(var i=0,len=mapConfig.Tabs.length;i<len;i++){var tab=mapConfig.Tabs[i];if(tab.PageTypeId==pagetype)return true}return false},getReportLinks:function(key,pagetype){if(!pagetype)pagetype=4;var reports=[];for(var i=0,len=mapConfig.Tabs.length;i<len;i++){var tab=mapConfig.Tabs[i];if(tab.PageTypeId==pagetype)reports.push({name:tab.Name,url:this.getUrl(mapConfig.LayerId,tab.PageTypeId,tab.PageId,key)})}return reports},getReportLinksHtml:function(key,pagetype,
listPrefix,listSeparator,extraParams){if(!listPrefix)listPrefix="View: ";if(!listSeparator)listSeparator="&nbsp;|&nbsp;";if(!pagetype)pagetype=4;if(!extraParams)extraParams="";var reports=Beacon.Tabs.getReportLinks(key,pagetype);if(reports.length>0){var reportLinks=$.map(reports,function(d){return'<a href="'+d.url+extraParams+'">'+d.name+"</a>"});return listPrefix+reportLinks.join(listSeparator)}else return""},generateTabStrip:function(bItemSelected,keyValue){var tabs=mapConfig.Tabs;var activeTabIndex;
if(keyValue=="")keyValue=null;var activePageId=mapConfig.PageId;var activePageTypeId=mapConfig.PageTypeId;var h=[];h.push("L");for(var i=0,len=tabs.length;i<len;i++){h.push("C");h.push("S");if(tabs[i].PageId==activePageId&&tabs[i].PageTypeId==activePageTypeId)activeTabIndex=i}h.pop();h.push("R");var idx=activeTabIndex*2+1;var idxL=idx-1;var idxR=idx+1;var idxLast=h.length-1;h[idxL]=idxL==0?"LA":"SR";h[idx]="CA";h[idxR]=idxR==idxLast?"RA":"SL";var html=[];var hasKey=keyValue!=null;var keyValueParam=
"";for(var i=0,len=h.length;i<len;i++){html.push('<div class="tab ');html.push(h[i]);if(i==idx)html.push(" tabactive");html.push('">');if(h[i].charAt(0)=="C"){var tab=tabs[(i-1)/2];if((!tab.nr||bItemSelected)&&(!tab.nk||hasKey)){html.push('<a href="');html.push(this.getUrl(mapConfig.LayerId,tab.PageTypeId,tab.PageId));if(hasKey){html.push("&KeyValue=");html.push(escape(keyValue))}html.push('">');html.push('<img hover=1 src="');html.push(Beacon.Icons.enabledUrl(tab.Icon,!tab.p));html.push('" />');
html.push("</a>");html.push('<a href="');html.push(this.getUrl(mapConfig.LayerId,tab.PageTypeId,tab.PageId));if(hasKey){html.push("&KeyValue=");html.push(escape(keyValue))}html.push('">');html.push("<span>");html.push(tab.Name);html.push("</span>");html.push("</a>")}else{html.push('<img src="');html.push(Beacon.Icons.disabledUrl(tab.Icon,!tab.p));html.push('" /><span>');html.push(tab.Name);html.push("</span>")}}html.push("</div>");html.push("\n");$("#TabStripContainer").html(html.join(""))}Beacon.Icons.hoverize()},
getUrl:function(layerId,pageTypeId,pageId,key,specialPage){var a=["/",specialPage||"Application.aspx","?AppID=",mapConfig.AppId,"&LayerID=",layerId,"&PageTypeID=",pageTypeId,"&PageID=",pageId];if(key&&key!=""){a.push("&KeyValue=");a.push(escape(key))}return a.join("")},CLASS_NAME:"Beacon.Tabs"};
Beacon.MapSV={map:null,pluginControl:null,onSilverlightControlLoad:function(sender,args){this.pluginControl=sender.getHost();this.map=this.pluginControl.Content.MainPage;$(function(){Beacon.TOC.onPageLoad();Beacon.TOC.events.register("refreshServer",this,function(e){Beacon.MapSV.map.onLayerNeedsRefresh(e.serverId,e.visible)});Beacon.MapSV.map.InitializeMap()})},CLASS_NAME:"Beacon.MapSV"};

