/*
 * jQuery JavaScript Library v1.3.2
 * http://jquery.com/
 *
 * Copyright (c) 2009 John Resig
 * Dual licensed under the MIT and GPL licenses.
 * http://docs.jquery.com/License
 *
 * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
 * Revision: 6246
 */
(function(){var q=this,h,F=q.jQuery,u=q.$,t=q.jQuery=q.$=function(L,M){return new t.fn.init(L,M)},K=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,g=/^.[^:#\[\.,]*$/;t.fn=t.prototype={init:function(L,O){L=L||document;if(L.nodeType){this[0]=L;this.length=1;this.context=L;return this}if(typeof L==="string"){var N=K.exec(L);if(N&&(N[1]||!O)){if(N[1]){L=t.clean([N[1]],O)}else{var P=document.getElementById(N[3]);if(P&&P.id!=N[3]){return t().find(L)}var M=t(P||[]);M.context=document;M.selector=L;return M}}else{return t(O).find(L)}}else{if(t.isFunction(L)){return t(document).ready(L)}}if(L.selector&&L.context){this.selector=L.selector;this.context=L.context}return this.setArray(t.isArray(L)?L:t.makeArray(L))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(L){return L===h?Array.prototype.slice.call(this):this[L]},pushStack:function(M,O,L){var N=t(M);N.prevObject=this;N.context=this.context;if(O==="find"){N.selector=this.selector+(this.selector?" ":"")+L}else{if(O){N.selector=this.selector+"."+O+"("+L+")"}}return N},setArray:function(L){this.length=0;Array.prototype.push.apply(this,L);return this},each:function(M,L){return t.each(this,M,L)},index:function(L){return t.inArray(L&&L.jquery?L[0]:L,this)},attr:function(M,O,N){var L=M;if(typeof M==="string"){if(O===h){return this[0]&&t[N||"attr"](this[0],M)}else{L={};L[M]=O}}return this.each(function(P){for(M in L){t.attr(N?this.style:this,M,t.prop(this,L[M],N,P,M))}})},css:function(L,M){if((L=="width"||L=="height")&&parseFloat(M)<0){M=h}return this.attr(L,M,"curCSS")},text:function(M){if(typeof M!=="object"&&M!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(M))}var L="";t.each(M||this,function(){t.each(this.childNodes,function(){if(this.nodeType!=8){L+=this.nodeType!=1?this.nodeValue:t.fn.text([this])}})});return L},wrapAll:function(L){if(this[0]){var M=t(L,this[0].ownerDocument).clone();if(this[0].parentNode){M.insertBefore(this[0])}M.map(function(){var N=this;while(N.firstChild){N=N.firstChild}return N}).append(this)}return this},wrapInner:function(L){return this.each(function(){t(this).contents().wrapAll(L)})},wrap:function(L){return this.each(function(){t(this).wrapAll(L)})},append:function(){return this.domManip(arguments,true,function(L){if(this.nodeType==1){this.appendChild(L)}})},prepend:function(){return this.domManip(arguments,true,function(L){if(this.nodeType==1){this.insertBefore(L,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(L){this.parentNode.insertBefore(L,this)})},after:function(){return this.domManip(arguments,false,function(L){this.parentNode.insertBefore(L,this.nextSibling)})},end:function(){return this.prevObject||t([])},push:[].push,sort:[].sort,splice:[].splice,find:function(L){if(this.length===1){var M=this.pushStack([],"find",L);M.length=0;t.find(L,this[0],M);return M}else{return this.pushStack(t.unique(t.map(this,function(N){return t.find(L,N)})),"find",L)}},clone:function(N){var L=this.map(function(){if(!t.support.noCloneEvent&&!t.isXMLDoc(this)){var P=this.outerHTML;if(!P){var Q=this.ownerDocument.createElement("div");Q.appendChild(this.cloneNode(true));P=Q.innerHTML}return t.clean([P.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(N===true){var O=this.find("*").andSelf(),M=0;L.find("*").andSelf().each(function(){if(this.nodeName!==O[M].nodeName){return}var P=t.data(O[M],"events");for(var R in P){for(var Q in P[R]){t.event.add(this,R,P[R][Q],P[R][Q].data)}}M++})}return L},filter:function(L){return this.pushStack(t.isFunction(L)&&t.grep(this,function(N,M){return L.call(N,M)})||t.multiFilter(L,t.grep(this,function(M){return M.nodeType===1})),"filter",L)},closest:function(L){var N=t.expr.match.POS.test(L)?t(L):null,M=0;return this.map(function(){var O=this;while(O&&O.ownerDocument){if(N?N.index(O)>-1:t(O).is(L)){t.data(O,"closest",M);return O}O=O.parentNode;M++}})},not:function(L){if(typeof L==="string"){if(g.test(L)){return this.pushStack(t.multiFilter(L,this,true),"not",L)}else{L=t.multiFilter(L,this)}}var M=L.length&&L[L.length-1]!==h&&!L.nodeType;return this.filter(function(){return M?t.inArray(this,L)<0:this!=L})},add:function(L){return this.pushStack(t.unique(t.merge(this.get(),typeof L==="string"?t(L):t.makeArray(L))))},is:function(L){return !!L&&t.multiFilter(L,this).length>0},hasClass:function(L){return !!L&&this.is("."+L)},val:function(R){if(R===h){var L=this[0];if(L){if(t.nodeName(L,"option")){return(L.attributes.value||{}).specified?L.value:L.text}if(t.nodeName(L,"select")){var P=L.selectedIndex,S=[],T=L.options,O=L.type=="select-one";if(P<0){return null}for(var M=O?P:0,Q=O?P+1:T.length;M<Q;M++){var N=T[M];if(N.selected){R=t(N).val();if(O){return R}S.push(R)}}return S}return(L.value||"").replace(/\r/g,"")}return h}if(typeof R==="number"){R+=""}return this.each(function(){if(this.nodeType!=1){return}if(t.isArray(R)&&/radio|checkbox/.test(this.type)){this.checked=(t.inArray(this.value,R)>=0||t.inArray(this.name,R)>=0)}else{if(t.nodeName(this,"select")){var U=t.makeArray(R);t("option",this).each(function(){this.selected=(t.inArray(this.value,U)>=0||t.inArray(this.text,U)>=0)});if(!U.length){this.selectedIndex=-1}}else{this.value=R}}})},html:function(L){return L===h?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(L)},replaceWith:function(L){return this.after(L).remove()},eq:function(L){return this.slice(L,+L+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(L){return this.pushStack(t.map(this,function(N,M){return L.call(N,M,N)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(Q,T,S){if(this[0]){var P=(this[0].ownerDocument||this[0]).createDocumentFragment(),M=t.clean(Q,(this[0].ownerDocument||this[0]),P),O=P.firstChild;if(O){for(var N=0,L=this.length;N<L;N++){S.call(R(this[N],O),this.length>1||N>0?P.cloneNode(true):P)}}if(M){t.each(M,G)}}return this;function R(U,V){return T&&t.nodeName(U,"table")&&t.nodeName(V,"tr")?(U.getElementsByTagName("tbody")[0]||U.appendChild(U.ownerDocument.createElement("tbody"))):U}}};t.fn.init.prototype=t.fn;function G(L,M){if(M.src){t.ajax({url:M.src,async:false,dataType:"script"})}else{t.globalEval(M.text||M.textContent||M.innerHTML||"")}if(M.parentNode){M.parentNode.removeChild(M)}}function f(){return +new Date}t.extend=t.fn.extend=function(){var Q=arguments[0]||{},O=1,P=arguments.length,L=false,N;if(typeof Q==="boolean"){L=Q;Q=arguments[1]||{};O=2}if(typeof Q!=="object"&&!t.isFunction(Q)){Q={}}if(P==O){Q=this;--O}for(;O<P;O++){if((N=arguments[O])!=null){for(var M in N){var R=Q[M],S=N[M];if(Q===S){continue}if(L&&S&&typeof S==="object"&&!S.nodeType){Q[M]=t.extend(L,R||(S.length!=null?[]:{}),S)}else{if(S!==h){Q[M]=S}}}}}return Q};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,v=document.defaultView||{},z=Object.prototype.toString;t.extend({noConflict:function(L){q.$=u;if(L){q.jQuery=F}return t},isFunction:function(L){return z.call(L)==="[object Function]"},isArray:function(L){return z.call(L)==="[object Array]"},isXMLDoc:function(L){return L.nodeType===9&&L.documentElement.nodeName!=="HTML"||!!L.ownerDocument&&t.isXMLDoc(L.ownerDocument)},globalEval:function(N){if(N&&/\S/.test(N)){var M=document.getElementsByTagName("head")[0]||document.documentElement,L=document.createElement("script");L.type="text/javascript";if(t.support.scriptEval){L.appendChild(document.createTextNode(N))}else{L.text=N}M.insertBefore(L,M.firstChild);M.removeChild(L)}},nodeName:function(M,L){return M.nodeName&&M.nodeName.toUpperCase()==L.toUpperCase()},each:function(N,R,M){var L,O=0,P=N.length;if(M){if(P===h){for(L in N){if(R.apply(N[L],M)===false){break}}}else{for(;O<P;){if(R.apply(N[O++],M)===false){break}}}}else{if(P===h){for(L in N){if(R.call(N[L],L,N[L])===false){break}}}else{for(var Q=N[0];O<P&&R.call(Q,O,Q)!==false;Q=N[++O]){}}}return N},prop:function(O,P,N,M,L){if(t.isFunction(P)){P=P.call(O,M)}return typeof P==="number"&&N=="curCSS"&&!b.test(L)?P+"px":P},className:{add:function(L,M){t.each((M||"").split(/\s+/),function(N,O){if(L.nodeType==1&&!t.className.has(L.className,O)){L.className+=(L.className?" ":"")+O}})},remove:function(L,M){if(L.nodeType==1){L.className=M!==h?t.grep(L.className.split(/\s+/),function(N){return !t.className.has(M,N)}).join(" "):""}},has:function(M,L){return M&&t.inArray(L,(M.className||M).toString().split(/\s+/))>-1}},swap:function(O,N,P){var L={};for(var M in N){L[M]=O.style[M];O.style[M]=N[M]}P.call(O);for(var M in N){O.style[M]=L[M]}},css:function(O,M,Q,L){if(M=="width"||M=="height"){var S,N={position:"absolute",visibility:"hidden",display:"block"},R=M=="width"?["Left","Right"]:["Top","Bottom"];function P(){S=M=="width"?O.offsetWidth:O.offsetHeight;if(L==="border"){return}t.each(R,function(){if(!L){S-=parseFloat(t.curCSS(O,"padding"+this,true))||0}if(L==="margin"){S+=parseFloat(t.curCSS(O,"margin"+this,true))||0}else{S-=parseFloat(t.curCSS(O,"border"+this+"Width",true))||0}})}if(O.offsetWidth!==0){P()}else{t.swap(O,N,P)}return Math.max(0,Math.round(S))}return t.curCSS(O,M,Q)},curCSS:function(P,M,N){var S,L=P.style;if(M=="opacity"&&!t.support.opacity){S=t.attr(L,"opacity");return S==""?"1":S}if(M.match(/float/i)){M=D}if(!N&&L&&L[M]){S=L[M]}else{if(v.getComputedStyle){if(M.match(/float/i)){M="float"}M=M.replace(/([A-Z])/g,"-$1").toLowerCase();var T=v.getComputedStyle(P,null);if(T){S=T.getPropertyValue(M)}if(M=="opacity"&&S==""){S="1"}}else{if(P.currentStyle){var Q=M.replace(/\-(\w)/g,function(U,V){return V.toUpperCase()});S=P.currentStyle[M]||P.currentStyle[Q];if(!/^\d+(px)?$/i.test(S)&&/^\d/.test(S)){var O=L.left,R=P.runtimeStyle.left;P.runtimeStyle.left=P.currentStyle.left;L.left=S||0;S=L.pixelLeft+"px";L.left=O;P.runtimeStyle.left=R}}}}return S},clean:function(M,R,P){R=R||document;if(typeof R.createElement==="undefined"){R=R.ownerDocument||R[0]&&R[0].ownerDocument||document}if(!P&&M.length===1&&typeof M[0]==="string"){var O=/^<(\w+)\s*\/?>$/.exec(M[0]);if(O){return[R.createElement(O[1])]}}var N=[],L=[],S=R.createElement("div");t.each(M,function(W,Z){if(typeof Z==="number"){Z+=""}if(!Z){return}if(typeof Z==="string"){Z=Z.replace(/(<(\w+)[^>]*?)\/>/g,function(ab,ac,aa){return aa.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?ab:ac+"></"+aa+">"});var V=Z.replace(/^\s+/,"").substring(0,10).toLowerCase();var X=!V.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!V.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||V.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!V.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!V.indexOf("<td")||!V.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!V.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!t.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];S.innerHTML=X[1]+Z+X[2];while(X[0]--){S=S.lastChild}if(!t.support.tbody){var Y=/<tbody/i.test(Z),U=!V.indexOf("<table")&&!Y?S.firstChild&&S.firstChild.childNodes:X[1]=="<table>"&&!Y?S.childNodes:[];for(var T=U.length-1;T>=0;--T){if(t.nodeName(U[T],"tbody")&&!U[T].childNodes.length){U[T].parentNode.removeChild(U[T])}}}if(!t.support.leadingWhitespace&&/^\s/.test(Z)){S.insertBefore(R.createTextNode(Z.match(/^\s*/)[0]),S.firstChild)}Z=t.makeArray(S.childNodes)}if(Z.nodeType){N.push(Z)}else{N=t.merge(N,Z)}});if(P){for(var Q=0;N[Q];Q++){if(t.nodeName(N[Q],"script")&&(!N[Q].type||N[Q].type.toLowerCase()==="text/javascript")){L.push(N[Q].parentNode?N[Q].parentNode.removeChild(N[Q]):N[Q])}else{if(N[Q].nodeType===1){N.splice.apply(N,[Q+1,0].concat(t.makeArray(N[Q].getElementsByTagName("script"))))}P.appendChild(N[Q])}}return L}return N},attr:function(Q,N,R){if(!Q||Q.nodeType==3||Q.nodeType==8){return h}var O=!t.isXMLDoc(Q),S=R!==h;N=O&&t.props[N]||N;if(Q.tagName){var M=/href|src|style/.test(N);if(N=="selected"&&Q.parentNode){Q.parentNode.selectedIndex}if(N in Q&&O&&!M){if(S){if(N=="type"&&t.nodeName(Q,"input")&&Q.parentNode){throw"type property can't be changed"}Q[N]=R}if(t.nodeName(Q,"form")&&Q.getAttributeNode(N)){return Q.getAttributeNode(N).nodeValue}if(N=="tabIndex"){var P=Q.getAttributeNode("tabIndex");return P&&P.specified?P.value:Q.nodeName.match(/(button|input|object|select|textarea)/i)?0:Q.nodeName.match(/^(a|area)$/i)&&Q.href?0:h}return Q[N]}if(!t.support.style&&O&&N=="style"){return t.attr(Q.style,"cssText",R)}if(S){Q.setAttribute(N,""+R)}var L=!t.support.hrefNormalized&&O&&M?Q.getAttribute(N,2):Q.getAttribute(N);return L===null?h:L}if(!t.support.opacity&&N=="opacity"){if(S){Q.zoom=1;Q.filter=(Q.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(R)+""=="NaN"?"":"alpha(opacity="+R*100+")")}return Q.filter&&Q.filter.indexOf("opacity=")>=0?(parseFloat(Q.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}N=N.replace(/-([a-z])/ig,function(T,U){return U.toUpperCase()});if(S){Q[N]=R}return Q[N]},trim:function(L){return(L||"").replace(/^\s+|\s+$/g,"")},makeArray:function(N){var L=[];if(N!=null){var M=N.length;if(M==null||typeof N==="string"||t.isFunction(N)||N.setInterval){L[0]=N}else{while(M){L[--M]=N[M]}}}return L},inArray:function(N,O){for(var L=0,M=O.length;L<M;L++){if(O[L]===N){return L}}return -1},merge:function(O,L){var M=0,N,P=O.length;if(!t.support.getAll){while((N=L[M++])!=null){if(N.nodeType!=8){O[P++]=N}}}else{while((N=L[M++])!=null){O[P++]=N}}return O},unique:function(R){var M=[],L={};try{for(var N=0,O=R.length;N<O;N++){var Q=t.data(R[N]);if(!L[Q]){L[Q]=true;M.push(R[N])}}}catch(P){M=R}return M},grep:function(M,Q,L){var N=[];for(var O=0,P=M.length;O<P;O++){if(!L!=!Q(M[O],O)){N.push(M[O])}}return N},map:function(L,Q){var M=[];for(var N=0,O=L.length;N<O;N++){var P=Q(L[N],N);if(P!=null){M[M.length]=P}}return M.concat.apply([],M)}});var J=navigator.userAgent.toLowerCase();t.browser={version:(J.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(J),opera:/opera/.test(J),msie:/msie/.test(J)&&!/opera/.test(J),mozilla:/mozilla/.test(J)&&!/(compatible|webkit)/.test(J)};t.each({parent:function(L){return L.parentNode},parents:function(L){return t.dir(L,"parentNode")},next:function(L){return t.nth(L,2,"nextSibling")},prev:function(L){return t.nth(L,2,"previousSibling")},nextAll:function(L){return t.dir(L,"nextSibling")},prevAll:function(L){return t.dir(L,"previousSibling")},siblings:function(L){return t.sibling(L.parentNode.firstChild,L)},children:function(L){return t.sibling(L.firstChild)},contents:function(L){return t.nodeName(L,"iframe")?L.contentDocument||L.contentWindow.document:t.makeArray(L.childNodes)}},function(L,M){t.fn[L]=function(N){var O=t.map(this,M);if(N&&typeof N=="string"){O=t.multiFilter(N,O)}return this.pushStack(t.unique(O),L,N)}});t.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(L,M){t.fn[L]=function(N){var Q=[],S=t(N);for(var R=0,O=S.length;R<O;R++){var P=(R>0?this.clone(true):this).get();t.fn[M].apply(t(S[R]),P);Q=Q.concat(P)}return this.pushStack(Q,L,N)}});t.each({removeAttr:function(L){t.attr(this,L,"");if(this.nodeType==1){this.removeAttribute(L)}},addClass:function(L){t.className.add(this,L)},removeClass:function(L){t.className.remove(this,L)},toggleClass:function(M,L){if(typeof L!=="boolean"){L=!t.className.has(this,M)}t.className[L?"add":"remove"](this,M)},remove:function(L){if(!L||t.filter(L,[this]).length){t("*",this).add([this]).each(function(){t.event.remove(this);t.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){t(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(L,M){t.fn[L]=function(){return this.each(M,arguments)}});function o(L,M){return L[0]&&parseInt(t.curCSS(L[0],M,true),10)||0}var k="jQuery"+f(),C=0,H={};t.extend({cache:{},data:function(M,L,N){M=M==q?H:M;var O=M[k];if(!O){O=M[k]=++C}if(L&&!t.cache[O]){t.cache[O]={}}if(N!==h){t.cache[O][L]=N}return L?t.cache[O][L]:O},removeData:function(M,L){M=M==q?H:M;var O=M[k];if(L){if(t.cache[O]){delete t.cache[O][L];L="";for(L in t.cache[O]){break}if(!L){t.removeData(M)}}}else{try{delete M[k]}catch(N){if(M.removeAttribute){M.removeAttribute(k)}}delete t.cache[O]}},queue:function(M,L,O){if(M){L=(L||"fx")+"queue";var N=t.data(M,L);if(!N||t.isArray(O)){N=t.data(M,L,t.makeArray(O))}else{if(O){N.push(O)}}}return N},dequeue:function(O,N){var L=t.queue(O,N),M=L.shift();if(!N||N==="fx"){M=L[0]}if(M!==h){M.call(O)}}});t.fn.extend({data:function(L,N){var O=L.split(".");O[1]=O[1]?"."+O[1]:"";if(N===h){var M=this.triggerHandler("getData"+O[1]+"!",[O[0]]);if(M===h&&this.length){M=t.data(this[0],L)}return M===h&&O[1]?this.data(O[0]):M}else{return this.trigger("setData"+O[1]+"!",[O[0],N]).each(function(){t.data(this,L,N)})}},removeData:function(L){return this.each(function(){t.removeData(this,L)})},queue:function(L,M){if(typeof L!=="string"){M=L;L="fx"}if(M===h){return t.queue(this[0],L)}return this.each(function(){var N=t.queue(this,L,M);if(L=="fx"&&N.length==1){N[0].call(this)}})},dequeue:function(L){return this.each(function(){t.dequeue(this,L)})}});
/*
 * Sizzle CSS Selector Engine - v0.9.3
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
(function(){var Y=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,S=0,O=Object.prototype.toString;var M=function(af,ab,ai,aj){ai=ai||[];ab=ab||document;if(ab.nodeType!==1&&ab.nodeType!==9){return[]}if(!af||typeof af!=="string"){return ai}var ag=[],ad,am,ap,aa,ak,ac,ae=true;Y.lastIndex=0;while((ad=Y.exec(af))!==null){ag.push(ad[1]);if(ad[2]){ac=RegExp.rightContext;break}}if(ag.length>1&&T.exec(af)){if(ag.length===2&&P.relative[ag[0]]){am=Q(ag[0]+ag[1],ab)}else{am=P.relative[ag[0]]?[ab]:M(ag.shift(),ab);while(ag.length){af=ag.shift();if(P.relative[af]){af+=ag.shift()}am=Q(af,am)}}}else{var al=aj?{expr:ag.pop(),set:L(aj)}:M.find(ag.pop(),ag.length===1&&ab.parentNode?ab.parentNode:ab,X(ab));am=M.filter(al.expr,al.set);if(ag.length>0){ap=L(am)}else{ae=false}while(ag.length){var ao=ag.pop(),an=ao;if(!P.relative[ao]){ao=""}else{an=ag.pop()}if(an==null){an=ab}P.relative[ao](ap,an,X(ab))}}if(!ap){ap=am}if(!ap){throw"Syntax error, unrecognized expression: "+(ao||af)}if(O.call(ap)==="[object Array]"){if(!ae){ai.push.apply(ai,ap)}else{if(ab.nodeType===1){for(var ah=0;ap[ah]!=null;ah++){if(ap[ah]&&(ap[ah]===true||ap[ah].nodeType===1&&R(ab,ap[ah]))){ai.push(am[ah])}}}else{for(var ah=0;ap[ah]!=null;ah++){if(ap[ah]&&ap[ah].nodeType===1){ai.push(am[ah])}}}}}else{L(ap,ai)}if(ac){M(ac,ab,ai,aj);if(N){hasDuplicate=false;ai.sort(N);if(hasDuplicate){for(var ah=1;ah<ai.length;ah++){if(ai[ah]===ai[ah-1]){ai.splice(ah--,1)}}}}}return ai};M.matches=function(aa,ab){return M(aa,null,null,ab)};M.find=function(ah,aa,ai){var ag,ae;if(!ah){return[]}for(var ad=0,ac=P.order.length;ad<ac;ad++){var af=P.order[ad],ae;if((ae=P.match[af].exec(ah))){var ab=RegExp.leftContext;if(ab.substr(ab.length-1)!=="\\"){ae[1]=(ae[1]||"").replace(/\\/g,"");ag=P.find[af](ae,aa,ai);if(ag!=null){ah=ah.replace(P.match[af],"");break}}}}if(!ag){ag=aa.getElementsByTagName("*")}return{set:ag,expr:ah}};M.filter=function(ak,aj,an,ad){var ac=ak,ap=[],ah=aj,af,aa,ag=aj&&aj[0]&&X(aj[0]);while(ak&&aj.length){for(var ai in P.filter){if((af=P.match[ai].exec(ak))!=null){var ab=P.filter[ai],ao,am;aa=false;if(ah==ap){ap=[]}if(P.preFilter[ai]){af=P.preFilter[ai](af,ah,an,ap,ad,ag);if(!af){aa=ao=true}else{if(af===true){continue}}}if(af){for(var ae=0;(am=ah[ae])!=null;ae++){if(am){ao=ab(am,af,ae,ah);var al=ad^!!ao;if(an&&ao!=null){if(al){aa=true}else{ah[ae]=false}}else{if(al){ap.push(am);aa=true}}}}}if(ao!==h){if(!an){ah=ap}ak=ak.replace(P.match[ai],"");if(!aa){return[]}break}}}if(ak==ac){if(aa==null){throw"Syntax error, unrecognized expression: "+ak}else{break}}ac=ak}return ah};var P=M.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|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(aa){return aa.getAttribute("href")}},relative:{"+":function(ah,aa,ag){var ae=typeof aa==="string",ai=ae&&!/\W/.test(aa),af=ae&&!ai;if(ai&&!ag){aa=aa.toUpperCase()}for(var ad=0,ac=ah.length,ab;ad<ac;ad++){if((ab=ah[ad])){while((ab=ab.previousSibling)&&ab.nodeType!==1){}ah[ad]=af||ab&&ab.nodeName===aa?ab||false:ab===aa}}if(af){M.filter(aa,ah,true)}},">":function(ag,ab,ah){var ae=typeof ab==="string";if(ae&&!/\W/.test(ab)){ab=ah?ab:ab.toUpperCase();for(var ac=0,aa=ag.length;ac<aa;ac++){var af=ag[ac];if(af){var ad=af.parentNode;ag[ac]=ad.nodeName===ab?ad:false}}}else{for(var ac=0,aa=ag.length;ac<aa;ac++){var af=ag[ac];if(af){ag[ac]=ae?af.parentNode:af.parentNode===ab}}if(ae){M.filter(ab,ag,true)}}},"":function(ad,ab,af){var ac=S++,aa=Z;if(!ab.match(/\W/)){var ae=ab=af?ab:ab.toUpperCase();aa=W}aa("parentNode",ab,ac,ad,ae,af)},"~":function(ad,ab,af){var ac=S++,aa=Z;if(typeof ab==="string"&&!ab.match(/\W/)){var ae=ab=af?ab:ab.toUpperCase();aa=W}aa("previousSibling",ab,ac,ad,ae,af)}},find:{ID:function(ab,ac,ad){if(typeof ac.getElementById!=="undefined"&&!ad){var aa=ac.getElementById(ab[1]);return aa?[aa]:[]}},NAME:function(ac,af,ag){if(typeof af.getElementsByName!=="undefined"){var ab=[],ae=af.getElementsByName(ac[1]);for(var ad=0,aa=ae.length;ad<aa;ad++){if(ae[ad].getAttribute("name")===ac[1]){ab.push(ae[ad])}}return ab.length===0?null:ab}},TAG:function(aa,ab){return ab.getElementsByTagName(aa[1])}},preFilter:{CLASS:function(ad,ab,ac,aa,ag,ah){ad=" "+ad[1].replace(/\\/g,"")+" ";if(ah){return ad}for(var ae=0,af;(af=ab[ae])!=null;ae++){if(af){if(ag^(af.className&&(" "+af.className+" ").indexOf(ad)>=0)){if(!ac){aa.push(af)}}else{if(ac){ab[ae]=false}}}}return false},ID:function(aa){return aa[1].replace(/\\/g,"")},TAG:function(ab,aa){for(var ac=0;aa[ac]===false;ac++){}return aa[ac]&&X(aa[ac])?ab[1]:ab[1].toUpperCase()},CHILD:function(aa){if(aa[1]=="nth"){var ab=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(aa[2]=="even"&&"2n"||aa[2]=="odd"&&"2n+1"||!/\D/.test(aa[2])&&"0n+"+aa[2]||aa[2]);aa[2]=(ab[1]+(ab[2]||1))-0;aa[3]=ab[3]-0}aa[0]=S++;return aa},ATTR:function(ae,ab,ac,aa,af,ag){var ad=ae[1].replace(/\\/g,"");if(!ag&&P.attrMap[ad]){ae[1]=P.attrMap[ad]}if(ae[2]==="~="){ae[4]=" "+ae[4]+" "}return ae},PSEUDO:function(ae,ab,ac,aa,af){if(ae[1]==="not"){if(ae[3].match(Y).length>1||/^\w/.test(ae[3])){ae[3]=M(ae[3],null,null,ab)}else{var ad=M.filter(ae[3],ab,ac,true^af);if(!ac){aa.push.apply(aa,ad)}return false}}else{if(P.match.POS.test(ae[0])||P.match.CHILD.test(ae[0])){return true}}return ae},POS:function(aa){aa.unshift(true);return aa}},filters:{enabled:function(aa){return aa.disabled===false&&aa.type!=="hidden"},disabled:function(aa){return aa.disabled===true},checked:function(aa){return aa.checked===true},selected:function(aa){aa.parentNode.selectedIndex;return aa.selected===true},parent:function(aa){return !!aa.firstChild},empty:function(aa){return !aa.firstChild},has:function(ac,ab,aa){return !!M(aa[3],ac).length},header:function(aa){return/h\d/i.test(aa.nodeName)},text:function(aa){return"text"===aa.type},radio:function(aa){return"radio"===aa.type},checkbox:function(aa){return"checkbox"===aa.type},file:function(aa){return"file"===aa.type},password:function(aa){return"password"===aa.type},submit:function(aa){return"submit"===aa.type},image:function(aa){return"image"===aa.type},reset:function(aa){return"reset"===aa.type},button:function(aa){return"button"===aa.type||aa.nodeName.toUpperCase()==="BUTTON"},input:function(aa){return/input|select|textarea|button/i.test(aa.nodeName)}},setFilters:{first:function(ab,aa){return aa===0},last:function(ac,ab,aa,ad){return ab===ad.length-1},even:function(ab,aa){return aa%2===0},odd:function(ab,aa){return aa%2===1},lt:function(ac,ab,aa){return ab<aa[3]-0},gt:function(ac,ab,aa){return ab>aa[3]-0},nth:function(ac,ab,aa){return aa[3]-0==ab},eq:function(ac,ab,aa){return aa[3]-0==ab}},filter:{PSEUDO:function(ag,ac,ad,ah){var ab=ac[1],ae=P.filters[ab];if(ae){return ae(ag,ad,ac,ah)}else{if(ab==="contains"){return(ag.textContent||ag.innerText||"").indexOf(ac[3])>=0}else{if(ab==="not"){var af=ac[3];for(var ad=0,aa=af.length;ad<aa;ad++){if(af[ad]===ag){return false}}return true}}}},CHILD:function(aa,ad){var ag=ad[1],ab=aa;switch(ag){case"only":case"first":while(ab=ab.previousSibling){if(ab.nodeType===1){return false}}if(ag=="first"){return true}ab=aa;case"last":while(ab=ab.nextSibling){if(ab.nodeType===1){return false}}return true;case"nth":var ac=ad[2],aj=ad[3];if(ac==1&&aj==0){return true}var af=ad[0],ai=aa.parentNode;if(ai&&(ai.sizcache!==af||!aa.nodeIndex)){var ae=0;for(ab=ai.firstChild;ab;ab=ab.nextSibling){if(ab.nodeType===1){ab.nodeIndex=++ae}}ai.sizcache=af}var ah=aa.nodeIndex-aj;if(ac==0){return ah==0}else{return(ah%ac==0&&ah/ac>=0)}}},ID:function(ab,aa){return ab.nodeType===1&&ab.getAttribute("id")===aa},TAG:function(ab,aa){return(aa==="*"&&ab.nodeType===1)||ab.nodeName===aa},CLASS:function(ab,aa){return(" "+(ab.className||ab.getAttribute("class"))+" ").indexOf(aa)>-1},ATTR:function(af,ad){var ac=ad[1],aa=P.attrHandle[ac]?P.attrHandle[ac](af):af[ac]!=null?af[ac]:af.getAttribute(ac),ag=aa+"",ae=ad[2],ab=ad[4];return aa==null?ae==="!=":ae==="="?ag===ab:ae==="*="?ag.indexOf(ab)>=0:ae==="~="?(" "+ag+" ").indexOf(ab)>=0:!ab?ag&&aa!==false:ae==="!="?ag!=ab:ae==="^="?ag.indexOf(ab)===0:ae==="$="?ag.substr(ag.length-ab.length)===ab:ae==="|="?ag===ab||ag.substr(0,ab.length+1)===ab+"-":false},POS:function(ae,ab,ac,af){var aa=ab[2],ad=P.setFilters[aa];if(ad){return ad(ae,ac,ab,af)}}}};var T=P.match.POS;for(var V in P.match){P.match[V]=RegExp(P.match[V].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var L=function(ab,aa){ab=Array.prototype.slice.call(ab);if(aa){aa.push.apply(aa,ab);return aa}return ab};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(U){L=function(ae,ad){var ab=ad||[];if(O.call(ae)==="[object Array]"){Array.prototype.push.apply(ab,ae)}else{if(typeof ae.length==="number"){for(var ac=0,aa=ae.length;ac<aa;ac++){ab.push(ae[ac])}}else{for(var ac=0;ae[ac];ac++){ab.push(ae[ac])}}}return ab}}var N;if(document.documentElement.compareDocumentPosition){N=function(ab,aa){var ac=ab.compareDocumentPosition(aa)&4?-1:ab===aa?0:1;if(ac===0){hasDuplicate=true}return ac}}else{if("sourceIndex" in document.documentElement){N=function(ab,aa){var ac=ab.sourceIndex-aa.sourceIndex;if(ac===0){hasDuplicate=true}return ac}}else{if(document.createRange){N=function(ad,ab){var ac=ad.ownerDocument.createRange(),aa=ab.ownerDocument.createRange();ac.selectNode(ad);ac.collapse(true);aa.selectNode(ab);aa.collapse(true);var ae=ac.compareBoundaryPoints(Range.START_TO_END,aa);if(ae===0){hasDuplicate=true}return ae}}}}(function(){var ab=document.createElement("form"),ac="script"+(new Date).getTime();ab.innerHTML="<input name='"+ac+"'/>";var aa=document.documentElement;aa.insertBefore(ab,aa.firstChild);if(!!document.getElementById(ac)){P.find.ID=function(ae,af,ag){if(typeof af.getElementById!=="undefined"&&!ag){var ad=af.getElementById(ae[1]);return ad?ad.id===ae[1]||typeof ad.getAttributeNode!=="undefined"&&ad.getAttributeNode("id").nodeValue===ae[1]?[ad]:h:[]}};P.filter.ID=function(af,ad){var ae=typeof af.getAttributeNode!=="undefined"&&af.getAttributeNode("id");return af.nodeType===1&&ae&&ae.nodeValue===ad}}aa.removeChild(ab)})();(function(){var aa=document.createElement("div");aa.appendChild(document.createComment(""));if(aa.getElementsByTagName("*").length>0){P.find.TAG=function(ab,af){var ae=af.getElementsByTagName(ab[1]);if(ab[1]==="*"){var ad=[];for(var ac=0;ae[ac];ac++){if(ae[ac].nodeType===1){ad.push(ae[ac])}}ae=ad}return ae}}aa.innerHTML="<a href='#'></a>";if(aa.firstChild&&typeof aa.firstChild.getAttribute!=="undefined"&&aa.firstChild.getAttribute("href")!=="#"){P.attrHandle.href=function(ab){return ab.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var aa=M,ab=document.createElement("div");ab.innerHTML="<p class='TEST'></p>";if(ab.querySelectorAll&&ab.querySelectorAll(".TEST").length===0){return}M=function(af,ae,ac,ad){ae=ae||document;if(!ad&&ae.nodeType===9&&!X(ae)){try{return L(ae.querySelectorAll(af),ac)}catch(ag){}}return aa(af,ae,ac,ad)};M.find=aa.find;M.filter=aa.filter;M.selectors=aa.selectors;M.matches=aa.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var aa=document.createElement("div");aa.innerHTML="<div class='test e'></div><div class='test'></div>";if(aa.getElementsByClassName("e").length===0){return}aa.lastChild.className="e";if(aa.getElementsByClassName("e").length===1){return}P.order.splice(1,0,"CLASS");P.find.CLASS=function(ab,ac,ad){if(typeof ac.getElementsByClassName!=="undefined"&&!ad){return ac.getElementsByClassName(ab[1])}}})()}function W(ab,ag,af,ak,ah,aj){var ai=ab=="previousSibling"&&!aj;for(var ad=0,ac=ak.length;ad<ac;ad++){var aa=ak[ad];if(aa){if(ai&&aa.nodeType===1){aa.sizcache=af;aa.sizset=ad}aa=aa[ab];var ae=false;while(aa){if(aa.sizcache===af){ae=ak[aa.sizset];break}if(aa.nodeType===1&&!aj){aa.sizcache=af;aa.sizset=ad}if(aa.nodeName===ag){ae=aa;break}aa=aa[ab]}ak[ad]=ae}}}function Z(ab,ag,af,ak,ah,aj){var ai=ab=="previousSibling"&&!aj;for(var ad=0,ac=ak.length;ad<ac;ad++){var aa=ak[ad];if(aa){if(ai&&aa.nodeType===1){aa.sizcache=af;aa.sizset=ad}aa=aa[ab];var ae=false;while(aa){if(aa.sizcache===af){ae=ak[aa.sizset];break}if(aa.nodeType===1){if(!aj){aa.sizcache=af;aa.sizset=ad}if(typeof ag!=="string"){if(aa===ag){ae=true;break}}else{if(M.filter(ag,[aa]).length>0){ae=aa;break}}}aa=aa[ab]}ak[ad]=ae}}}var R=document.compareDocumentPosition?function(ab,aa){return ab.compareDocumentPosition(aa)&16}:function(ab,aa){return ab!==aa&&(ab.contains?ab.contains(aa):true)};var X=function(aa){return aa.nodeType===9&&aa.documentElement.nodeName!=="HTML"||!!aa.ownerDocument&&X(aa.ownerDocument)};var Q=function(aa,ah){var ad=[],ae="",af,ac=ah.nodeType?[ah]:ah;while((af=P.match.PSEUDO.exec(aa))){ae+=af[0];aa=aa.replace(P.match.PSEUDO,"")}aa=P.relative[aa]?aa+"*":aa;for(var ag=0,ab=ac.length;ag<ab;ag++){M(aa,ac[ag],ad)}return M.filter(ae,ad)};t.find=M;t.filter=M.filter;t.expr=M.selectors;t.expr[":"]=t.expr.filters;M.selectors.filters.hidden=function(aa){return aa.offsetWidth===0||aa.offsetHeight===0};M.selectors.filters.visible=function(aa){return aa.offsetWidth>0||aa.offsetHeight>0};M.selectors.filters.animated=function(aa){return t.grep(t.timers,function(ab){return aa===ab.elem}).length};t.multiFilter=function(ac,aa,ab){if(ab){ac=":not("+ac+")"}return M.matches(ac,aa)};t.dir=function(ac,ab){var aa=[],ad=ac[ab];while(ad&&ad!=document){if(ad.nodeType==1){aa.push(ad)}ad=ad[ab]}return aa};t.nth=function(ae,aa,ac,ad){aa=aa||1;var ab=0;for(;ae;ae=ae[ac]){if(ae.nodeType==1&&++ab==aa){break}}return ae};t.sibling=function(ac,ab){var aa=[];for(;ac;ac=ac.nextSibling){if(ac.nodeType==1&&ac!=ab){aa.push(ac)}}return aa};return;q.Sizzle=M})();t.event={add:function(P,M,O,R){if(P.nodeType==3||P.nodeType==8){return}if(P.setInterval&&P!=q){P=q}if(!O.guid){O.guid=this.guid++}if(R!==h){var N=O;O=this.proxy(N);O.data=R}var L=t.data(P,"events")||t.data(P,"events",{}),Q=t.data(P,"handle")||t.data(P,"handle",function(){return typeof t!=="undefined"&&!t.event.triggered?t.event.handle.apply(arguments.callee.elem,arguments):h});Q.elem=P;t.each(M.split(/\s+/),function(T,U){var V=U.split(".");U=V.shift();O.type=V.slice().sort().join(".");var S=L[U];if(t.event.specialAll[U]){t.event.specialAll[U].setup.call(P,R,V)}if(!S){S=L[U]={};if(!t.event.special[U]||t.event.special[U].setup.call(P,R,V)===false){if(P.addEventListener){P.addEventListener(U,Q,false)}else{if(P.attachEvent){P.attachEvent("on"+U,Q)}}}}S[O.guid]=O;t.event.global[U]=true});P=null},guid:1,global:{},remove:function(R,O,Q){if(R.nodeType==3||R.nodeType==8){return}var N=t.data(R,"events"),M,L;if(N){if(O===h||(typeof O==="string"&&O.charAt(0)==".")){for(var P in N){this.remove(R,P+(O||""))}}else{if(O.type){Q=O.handler;O=O.type}t.each(O.split(/\s+/),function(T,V){var X=V.split(".");V=X.shift();var U=RegExp("(^|\\.)"+X.slice().sort().join(".*\\.")+"(\\.|$)");if(N[V]){if(Q){delete N[V][Q.guid]}else{for(var W in N[V]){if(U.test(N[V][W].type)){delete N[V][W]}}}if(t.event.specialAll[V]){t.event.specialAll[V].teardown.call(R,X)}for(M in N[V]){break}if(!M){if(!t.event.special[V]||t.event.special[V].teardown.call(R,X)===false){if(R.removeEventListener){R.removeEventListener(V,t.data(R,"handle"),false)}else{if(R.detachEvent){R.detachEvent("on"+V,t.data(R,"handle"))}}}M=null;delete N[V]}}})}for(M in N){break}if(!M){var S=t.data(R,"handle");if(S){S.elem=null}t.removeData(R,"events");t.removeData(R,"handle")}}},trigger:function(P,R,O,L){var N=P.type||P;if(!L){P=typeof P==="object"?P[k]?P:t.extend(t.Event(N),P):t.Event(N);if(N.indexOf("!")>=0){P.type=N=N.slice(0,-1);P.exclusive=true}if(!O){P.stopPropagation();if(this.global[N]){t.each(t.cache,function(){if(this.events&&this.events[N]){t.event.trigger(P,R,this.handle.elem)}})}}if(!O||O.nodeType==3||O.nodeType==8){return h}P.result=h;P.target=O;R=t.makeArray(R);R.unshift(P)}P.currentTarget=O;var Q=t.data(O,"handle");if(Q){Q.apply(O,R)}if((!O[N]||(t.nodeName(O,"a")&&N=="click"))&&O["on"+N]&&O["on"+N].apply(O,R)===false){P.result=false}if(!L&&O[N]&&!P.isDefaultPrevented()&&!(t.nodeName(O,"a")&&N=="click")){this.triggered=true;try{O[N]()}catch(S){}}this.triggered=false;if(!P.isPropagationStopped()){var M=O.parentNode||O.ownerDocument;if(M){t.event.trigger(P,R,M,true)}}},handle:function(R){var Q,L;R=arguments[0]=t.event.fix(R||q.event);R.currentTarget=this;var S=R.type.split(".");R.type=S.shift();Q=!S.length&&!R.exclusive;var P=RegExp("(^|\\.)"+S.slice().sort().join(".*\\.")+"(\\.|$)");L=(t.data(this,"events")||{})[R.type];for(var N in L){var O=L[N];if(Q||P.test(O.type)){R.handler=O;R.data=O.data;var M=O.apply(this,arguments);if(M!==h){R.result=M;if(M===false){R.preventDefault();R.stopPropagation()}}if(R.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(O){if(O[k]){return O}var M=O;O=t.Event(M);for(var N=this.props.length,Q;N;){Q=this.props[--N];O[Q]=M[Q]}if(!O.target){O.target=O.srcElement||document}if(O.target.nodeType==3){O.target=O.target.parentNode}if(!O.relatedTarget&&O.fromElement){O.relatedTarget=O.fromElement==O.target?O.toElement:O.fromElement}if(O.pageX==null&&O.clientX!=null){var P=document.documentElement,L=document.body;O.pageX=O.clientX+(P&&P.scrollLeft||L&&L.scrollLeft||0)-(P.clientLeft||0);O.pageY=O.clientY+(P&&P.scrollTop||L&&L.scrollTop||0)-(P.clientTop||0)}if(!O.which&&((O.charCode||O.charCode===0)?O.charCode:O.keyCode)){O.which=O.charCode||O.keyCode}if(!O.metaKey&&O.ctrlKey){O.metaKey=O.ctrlKey}if(!O.which&&O.button){O.which=(O.button&1?1:(O.button&2?3:(O.button&4?2:0)))}return O},proxy:function(M,L){L=L||function(){return M.apply(this,arguments)};L.guid=M.guid=M.guid||L.guid||this.guid++;return L},special:{ready:{setup:I,teardown:function(){}}},specialAll:{live:{setup:function(L,M){t.event.add(this,M[0],c)},teardown:function(N){if(N.length){var L=0,M=RegExp("(^|\\.)"+N[0]+"(\\.|$)");t.each((t.data(this,"events").live||{}),function(){if(M.test(this.type)){L++}});if(L<1){t.event.remove(this,N[0],c)}}}}}};t.Event=function(L){if(!this.preventDefault){return new t.Event(L)}if(L&&L.type){this.originalEvent=L;this.type=L.type}else{this.type=L}this.timeStamp=f();this[k]=true};function p(){return false}function B(){return true}t.Event.prototype={preventDefault:function(){this.isDefaultPrevented=B;var L=this.originalEvent;if(!L){return}if(L.preventDefault){L.preventDefault()}L.returnValue=false},stopPropagation:function(){this.isPropagationStopped=B;var L=this.originalEvent;if(!L){return}if(L.stopPropagation){L.stopPropagation()}L.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=B;this.stopPropagation()},isDefaultPrevented:p,isPropagationStopped:p,isImmediatePropagationStopped:p};var a=function(M){var L=M.relatedTarget;while(L&&L!=this){try{L=L.parentNode}catch(N){L=this}}if(L!=this){M.type=M.data;t.event.handle.apply(this,arguments)}};t.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(M,L){t.event.special[L]={setup:function(){t.event.add(this,M,a,L)},teardown:function(){t.event.remove(this,M,a)}}});t.fn.extend({bind:function(M,N,L){return M=="unload"?this.one(M,N,L):this.each(function(){t.event.add(this,M,L||N,L&&N)})},one:function(N,O,M){var L=t.event.proxy(M||O,function(P){t(this).unbind(P,L);return(M||O).apply(this,arguments)});return this.each(function(){t.event.add(this,N,L,M&&O)})},unbind:function(M,L){return this.each(function(){t.event.remove(this,M,L)})},trigger:function(L,M){return this.each(function(){t.event.trigger(L,M,this)})},triggerHandler:function(L,N){if(this[0]){var M=t.Event(L);M.preventDefault();M.stopPropagation();t.event.trigger(M,N,this[0]);return M.result}},toggle:function(N){var L=arguments,M=1;while(M<L.length){t.event.proxy(N,L[M++])}return this.click(t.event.proxy(N,function(O){this.lastToggle=(this.lastToggle||0)%M;O.preventDefault();return L[this.lastToggle++].apply(this,arguments)||false}))},hover:function(L,M){return this.mouseenter(L).mouseleave(M)},ready:function(L){I();if(t.isReady){L.call(document,t)}else{t.readyList.push(L)}return this},live:function(N,M){var L=t.event.proxy(M);L.guid+=this.selector+N;t(document).bind(l(N,this.selector),this.selector,L);return this},die:function(M,L){t(document).unbind(l(M,this.selector),L?{guid:L.guid+this.selector+M}:null);return this}});function c(O){var L=RegExp("(^|\\.)"+O.type+"(\\.|$)"),N=true,M=[];t.each(t.data(this,"events").live||[],function(P,Q){if(L.test(Q.type)){var R=t(O.target).closest(Q.data)[0];if(R){M.push({elem:R,fn:Q})}}});M.sort(function(Q,P){return t.data(Q.elem,"closest")-t.data(P.elem,"closest")});t.each(M,function(){if(this.fn.call(this.elem,O,this.fn.data)===false){return(N=false)}});return N}function l(M,L){return["live",M,L.replace(/\./g,"`").replace(/ /g,"|")].join(".")}t.extend({isReady:false,readyList:[],ready:function(){if(!t.isReady){t.isReady=true;if(t.readyList){t.each(t.readyList,function(){this.call(document,t)});t.readyList=null}t(document).triggerHandler("ready")}}});var E=false;function I(){if(E){return}E=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);t.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);t.ready()}});if(document.documentElement.doScroll&&q==q.top){(function(){if(t.isReady){return}try{document.documentElement.doScroll("left")}catch(L){setTimeout(arguments.callee,0);return}t.ready()})()}}}t.event.add(q,"load",t.ready)}t.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(M,L){t.fn[L]=function(N){return N?this.bind(L,N):this.trigger(L)}});t(q).bind("unload",function(){for(var L in t.cache){if(L!=1&&t.cache[L].handle){t.event.remove(t.cache[L].handle.elem)}}});(function(){t.support={};var M=document.documentElement,N=document.createElement("script"),R=document.createElement("div"),Q="script"+(new Date).getTime();R.style.display="none";R.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var O=R.getElementsByTagName("*"),L=R.getElementsByTagName("a")[0];if(!O||!O.length||!L){return}t.support={leadingWhitespace:R.firstChild.nodeType==3,tbody:!R.getElementsByTagName("tbody").length,objectAll:!!R.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!R.getElementsByTagName("link").length,style:/red/.test(L.getAttribute("style")),hrefNormalized:L.getAttribute("href")==="/a",opacity:L.style.opacity==="0.5",cssFloat:!!L.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};N.type="text/javascript";try{N.appendChild(document.createTextNode("window."+Q+"=1;"))}catch(P){}M.insertBefore(N,M.firstChild);if(q[Q]){t.support.scriptEval=true;delete q[Q]}M.removeChild(N);if(R.attachEvent&&R.fireEvent){R.attachEvent("onclick",function(){t.support.noCloneEvent=false;R.detachEvent("onclick",arguments.callee)});R.cloneNode(true).fireEvent("onclick")}t(function(){var S=document.createElement("div");S.style.width=S.style.paddingLeft="1px";document.body.appendChild(S);t.boxModel=t.support.boxModel=S.offsetWidth===2;document.body.removeChild(S).style.display="none"})})();var D=t.support.cssFloat?"cssFloat":"styleFloat";t.props={"for":"htmlFor","class":"className","float":D,cssFloat:D,styleFloat:D,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};t.fn.extend({_load:t.fn.load,load:function(N,Q,R){if(typeof N!=="string"){return this._load(N)}var P=N.indexOf(" ");if(P>=0){var L=N.slice(P,N.length);N=N.slice(0,P)}var O="GET";if(Q){if(t.isFunction(Q)){R=Q;Q=null}else{if(typeof Q==="object"){Q=t.param(Q);O="POST"}}}var M=this;t.ajax({url:N,type:O,dataType:"html",data:Q,complete:function(T,S){if(S=="success"||S=="notmodified"){M.html(L?t("<div/>").append(T.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(L):T.responseText)}if(R){M.each(R,[T.responseText,S,T])}}});return this},serialize:function(){return t.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?t.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(L,M){var N=t(this).val();return N==null?null:t.isArray(N)?t.map(N,function(P,O){return{name:M.name,value:P}}):{name:M.name,value:N}}).get()}});t.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(L,M){t.fn[M]=function(N){return this.bind(M,N)}});var w=f();t.extend({get:function(L,N,O,M){if(t.isFunction(N)){O=N;N=null}return t.ajax({type:"GET",url:L,data:N,success:O,dataType:M})},getScript:function(L,M){return t.get(L,null,M,"script")},getJSON:function(L,M,N){return t.get(L,M,N,"json")},post:function(L,N,O,M){if(t.isFunction(N)){O=N;N={}}return t.ajax({type:"POST",url:L,data:N,success:O,dataType:M})},ajaxSetup:function(L){t.extend(t.ajaxSettings,L)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return q.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(T){T=t.extend(true,T,t.extend(true,{},t.ajaxSettings,T));var ad,M=/=\?(&|$)/g,Y,ac,N=T.type.toUpperCase();if(T.data&&T.processData&&typeof T.data!=="string"){T.data=t.param(T.data)}if(T.dataType=="jsonp"){if(N=="GET"){if(!T.url.match(M)){T.url+=(T.url.match(/\?/)?"&":"?")+(T.jsonp||"callback")+"=?"}}else{if(!T.data||!T.data.match(M)){T.data=(T.data?T.data+"&":"")+(T.jsonp||"callback")+"=?"}}T.dataType="json"}if(T.dataType=="json"&&(T.data&&T.data.match(M)||T.url.match(M))){ad="jsonp"+w++;if(T.data){T.data=(T.data+"").replace(M,"="+ad+"$1")}T.url=T.url.replace(M,"="+ad+"$1");T.dataType="script";q[ad]=function(ae){ac=ae;P();S();q[ad]=h;try{delete q[ad]}catch(af){}if(O){O.removeChild(aa)}}}if(T.dataType=="script"&&T.cache==null){T.cache=false}if(T.cache===false&&N=="GET"){var L=f();var ab=T.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+L+"$2");T.url=ab+((ab==T.url)?(T.url.match(/\?/)?"&":"?")+"_="+L:"")}if(T.data&&N=="GET"){T.url+=(T.url.match(/\?/)?"&":"?")+T.data;T.data=null}if(T.global&&!t.active++){t.event.trigger("ajaxStart")}var X=/^(\w+:)?\/\/([^\/?#]+)/.exec(T.url);if(T.dataType=="script"&&N=="GET"&&X&&(X[1]&&X[1]!=location.protocol||X[2]!=location.host)){var O=document.getElementsByTagName("head")[0];var aa=document.createElement("script");aa.src=T.url;if(T.scriptCharset){aa.charset=T.scriptCharset}if(!ad){var V=false;aa.onload=aa.onreadystatechange=function(){if(!V&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){V=true;P();S();aa.onload=aa.onreadystatechange=null;O.removeChild(aa)}}}O.appendChild(aa);return h}var R=false;var Q=T.xhr();if(T.username){Q.open(N,T.url,T.async,T.username,T.password)}else{Q.open(N,T.url,T.async)}try{if(T.data){Q.setRequestHeader("Content-Type",T.contentType)}if(T.ifModified){Q.setRequestHeader("If-Modified-Since",t.lastModified[T.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}Q.setRequestHeader("X-Requested-With","XMLHttpRequest");Q.setRequestHeader("Accept",T.dataType&&T.accepts[T.dataType]?T.accepts[T.dataType]+", */*":T.accepts._default)}catch(Z){}if(T.beforeSend&&T.beforeSend(Q,T)===false){if(T.global&&!--t.active){t.event.trigger("ajaxStop")}Q.abort();return false}if(T.global){t.event.trigger("ajaxSend",[Q,T])}var U=function(ae){if(Q.readyState==0){if(W){clearInterval(W);W=null;if(T.global&&!--t.active){t.event.trigger("ajaxStop")}}}else{if(!R&&Q&&(Q.readyState==4||ae=="timeout")){R=true;if(W){clearInterval(W);W=null}Y=ae=="timeout"?"timeout":!t.httpSuccess(Q)?"error":T.ifModified&&t.httpNotModified(Q,T.url)?"notmodified":"success";if(Y=="success"){try{ac=t.httpData(Q,T.dataType,T)}catch(ag){Y="parsererror"}}if(Y=="success"){var af;try{af=Q.getResponseHeader("Last-Modified")}catch(ag){}if(T.ifModified&&af){t.lastModified[T.url]=af}if(!ad){P()}}else{t.handleError(T,Q,Y)}S();if(ae){Q.abort()}if(T.async){Q=null}}}};if(T.async){var W=setInterval(U,13);if(T.timeout>0){setTimeout(function(){if(Q&&!R){U("timeout")}},T.timeout)}}try{Q.send(T.data)}catch(Z){t.handleError(T,Q,null,Z)}if(!T.async){U()}function P(){if(T.success){T.success(ac,Y)}if(T.global){t.event.trigger("ajaxSuccess",[Q,T])}}function S(){if(T.complete){T.complete(Q,Y)}if(T.global){t.event.trigger("ajaxComplete",[Q,T])}if(T.global&&!--t.active){t.event.trigger("ajaxStop")}}return Q},handleError:function(M,O,L,N){if(M.error){M.error(O,L,N)}if(M.global){t.event.trigger("ajaxError",[O,M,N])}},active:0,httpSuccess:function(M){try{return !M.status&&location.protocol=="file:"||(M.status>=200&&M.status<300)||M.status==304||M.status==1223}catch(L){}return false},httpNotModified:function(N,L){try{var O=N.getResponseHeader("Last-Modified");return N.status==304||O==t.lastModified[L]}catch(M){}return false},httpData:function(Q,O,N){var M=Q.getResponseHeader("content-type"),L=O=="xml"||!O&&M&&M.indexOf("xml")>=0,P=L?Q.responseXML:Q.responseText;if(L&&P.documentElement.tagName=="parsererror"){throw"parsererror"}if(N&&N.dataFilter){P=N.dataFilter(P,O)}if(typeof P==="string"){if(O=="script"){t.globalEval(P)}if(O=="json"){P=q["eval"]("("+P+")")}}return P},param:function(L){var N=[];function O(P,Q){N[N.length]=encodeURIComponent(P)+"="+encodeURIComponent(Q)}if(t.isArray(L)||L.jquery){t.each(L,function(){O(this.name,this.value)})}else{for(var M in L){if(t.isArray(L[M])){t.each(L[M],function(){O(M,this)})}else{O(M,t.isFunction(L[M])?L[M]():L[M])}}}return N.join("&").replace(/%20/g,"+")}});var r={},s,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function A(M,L){var N={};t.each(d.concat.apply([],d.slice(0,L)),function(){N[this]=M});return N}t.fn.extend({show:function(Q,S){if(Q){return this.animate(A("show",3),Q,S)}else{for(var O=0,M=this.length;O<M;O++){var L=t.data(this[O],"olddisplay");this[O].style.display=L||"";if(t.css(this[O],"display")==="none"){var N=this[O].tagName,R;if(r[N]){R=r[N]}else{var P=t("<"+N+" />").appendTo("body");R=P.css("display");if(R==="none"){R="block"}P.remove();r[N]=R}t.data(this[O],"olddisplay",R)}}for(var O=0,M=this.length;O<M;O++){this[O].style.display=t.data(this[O],"olddisplay")||""}return this}},hide:function(O,P){if(O){return this.animate(A("hide",3),O,P)}else{for(var N=0,M=this.length;N<M;N++){var L=t.data(this[N],"olddisplay");if(!L&&L!=="none"){t.data(this[N],"olddisplay",t.css(this[N],"display"))}}for(var N=0,M=this.length;N<M;N++){this[N].style.display="none"}return this}},_toggle:t.fn.toggle,toggle:function(N,M){var L=typeof N==="boolean";return t.isFunction(N)&&t.isFunction(M)?this._toggle.apply(this,arguments):N==null||L?this.each(function(){var O=L?N:t(this).is(":hidden");t(this)[O?"show":"hide"]()}):this.animate(A("toggle",3),N,M)},fadeTo:function(L,N,M){return this.animate({opacity:N},L,M)},animate:function(P,M,O,N){var L=t.speed(M,O,N);return this[L.queue===false?"each":"queue"](function(){var R=t.extend({},L),T,S=this.nodeType==1&&t(this).is(":hidden"),Q=this;for(T in P){if(P[T]=="hide"&&S||P[T]=="show"&&!S){return R.complete.call(this)}if((T=="height"||T=="width")&&this.style){R.display=t.css(this,"display");R.overflow=this.style.overflow}}if(R.overflow!=null){this.style.overflow="hidden"}R.curAnim=t.extend({},P);t.each(P,function(V,Z){var Y=new t.fx(Q,R,V);if(/toggle|show|hide/.test(Z)){Y[Z=="toggle"?S?"show":"hide":Z](P)}else{var X=Z.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),aa=Y.cur(true)||0;if(X){var U=parseFloat(X[2]),W=X[3]||"px";if(W!="px"){Q.style[V]=(U||1)+W;aa=((U||1)/Y.cur(true))*aa;Q.style[V]=aa+W}if(X[1]){U=((X[1]=="-="?-1:1)*U)+aa}Y.custom(aa,U,W)}else{Y.custom(aa,Z,"")}}});return true})},stop:function(M,L){var N=t.timers;if(M){this.queue([])}this.each(function(){for(var O=N.length-1;O>=0;O--){if(N[O].elem==this){if(L){N[O](true)}N.splice(O,1)}}});if(!L){this.dequeue()}return this}});t.each({slideDown:A("show",1),slideUp:A("hide",1),slideToggle:A("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(L,M){t.fn[L]=function(N,O){return this.animate(M,N,O)}});t.extend({speed:function(N,O,M){var L=typeof N==="object"?N:{complete:M||!M&&O||t.isFunction(N)&&N,duration:N,easing:M&&O||O&&!t.isFunction(O)&&O};L.duration=t.fx.off?0:typeof L.duration==="number"?L.duration:t.fx.speeds[L.duration]||t.fx.speeds._default;L.old=L.complete;L.complete=function(){if(L.queue!==false){t(this).dequeue()}if(t.isFunction(L.old)){L.old.call(this)}};return L},easing:{linear:function(N,O,L,M){return L+M*N},swing:function(N,O,L,M){return((-Math.cos(N*Math.PI)/2)+0.5)*M+L}},timers:[],fx:function(M,L,N){this.options=L;this.elem=M;this.prop=N;if(!L.orig){L.orig={}}}});t.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(t.fx.step[this.prop]||t.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(M){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var L=parseFloat(t.css(this.elem,this.prop,M));return L&&L>-10000?L:parseFloat(t.curCSS(this.elem,this.prop))||0},custom:function(P,O,N){this.startTime=f();this.start=P;this.end=O;this.unit=N||this.unit||"px";this.now=this.start;this.pos=this.state=0;var L=this;function M(Q){return L.step(Q)}M.elem=this.elem;if(M()&&t.timers.push(M)&&!s){s=setInterval(function(){var R=t.timers;for(var Q=0;Q<R.length;Q++){if(!R[Q]()){R.splice(Q--,1)}}if(!R.length){clearInterval(s);s=h}},13)}},show:function(){this.options.orig[this.prop]=t.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());t(this.elem).show()},hide:function(){this.options.orig[this.prop]=t.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(O){var N=f();if(O||N>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var L=true;for(var M in this.options.curAnim){if(this.options.curAnim[M]!==true){L=false}}if(L){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(t.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){t(this.elem).hide()}if(this.options.hide||this.options.show){for(var P in this.options.curAnim){t.attr(this.elem.style,P,this.options.orig[P])}}this.options.complete.call(this.elem)}return false}else{var Q=N-this.startTime;this.state=Q/this.options.duration;this.pos=t.easing[this.options.easing||(t.easing.swing?"swing":"linear")](this.state,Q,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};t.extend(t.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(L){t.attr(L.elem.style,"opacity",L.now)},_default:function(L){if(L.elem.style&&L.elem.style[L.prop]!=null){L.elem.style[L.prop]=L.now+L.unit}else{L.elem[L.prop]=L.now}}}});if(document.documentElement.getBoundingClientRect){t.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return t.offset.bodyOffset(this[0])}var N=this[0].getBoundingClientRect(),Q=this[0].ownerDocument,M=Q.body,L=Q.documentElement,S=L.clientTop||M.clientTop||0,R=L.clientLeft||M.clientLeft||0,P=N.top+(self.pageYOffset||t.boxModel&&L.scrollTop||M.scrollTop)-S,O=N.left+(self.pageXOffset||t.boxModel&&L.scrollLeft||M.scrollLeft)-R;return{top:P,left:O}}}else{t.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return t.offset.bodyOffset(this[0])}t.offset.initialized||t.offset.initialize();var Q=this[0],N=Q.offsetParent,M=Q,V=Q.ownerDocument,T,O=V.documentElement,R=V.body,S=V.defaultView,L=S.getComputedStyle(Q,null),U=Q.offsetTop,P=Q.offsetLeft;while((Q=Q.parentNode)&&Q!==R&&Q!==O){T=S.getComputedStyle(Q,null);U-=Q.scrollTop,P-=Q.scrollLeft;if(Q===N){U+=Q.offsetTop,P+=Q.offsetLeft;if(t.offset.doesNotAddBorder&&!(t.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(Q.tagName))){U+=parseInt(T.borderTopWidth,10)||0,P+=parseInt(T.borderLeftWidth,10)||0}M=N,N=Q.offsetParent}if(t.offset.subtractsBorderForOverflowNotVisible&&T.overflow!=="visible"){U+=parseInt(T.borderTopWidth,10)||0,P+=parseInt(T.borderLeftWidth,10)||0}L=T}if(L.position==="relative"||L.position==="static"){U+=R.offsetTop,P+=R.offsetLeft}if(L.position==="fixed"){U+=Math.max(O.scrollTop,R.scrollTop),P+=Math.max(O.scrollLeft,R.scrollLeft)}return{top:U,left:P}}}t.offset={initialize:function(){if(this.initialized){return}var S=document.body,M=document.createElement("div"),O,N,U,P,T,L,Q=S.style.marginTop,R='<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>';T={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(L in T){M.style[L]=T[L]}M.innerHTML=R;S.insertBefore(M,S.firstChild);O=M.firstChild,N=O.firstChild,P=O.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(N.offsetTop!==5);this.doesAddBorderForTableAndCells=(P.offsetTop===5);O.style.overflow="hidden",O.style.position="relative";this.subtractsBorderForOverflowNotVisible=(N.offsetTop===-5);S.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(S.offsetTop===0);S.style.marginTop=Q;S.removeChild(M);this.initialized=true},bodyOffset:function(L){t.offset.initialized||t.offset.initialize();var N=L.offsetTop,M=L.offsetLeft;if(t.offset.doesNotIncludeMarginInBodyOffset){N+=parseInt(t.curCSS(L,"marginTop",true),10)||0,M+=parseInt(t.curCSS(L,"marginLeft",true),10)||0}return{top:N,left:M}}};t.fn.extend({position:function(){var P=0,O=0,M;if(this[0]){var N=this.offsetParent(),Q=this.offset(),L=/^body|html$/i.test(N[0].tagName)?{top:0,left:0}:N.offset();Q.top-=o(this,"marginTop");Q.left-=o(this,"marginLeft");L.top+=o(N,"borderTopWidth");L.left+=o(N,"borderLeftWidth");M={top:Q.top-L.top,left:Q.left-L.left}}return M},offsetParent:function(){var L=this[0].offsetParent||document.body;while(L&&(!/^body|html$/i.test(L.tagName)&&t.css(L,"position")=="static")){L=L.offsetParent}return t(L)}});t.each(["Left","Top"],function(M,L){var N="scroll"+L;t.fn[N]=function(O){if(!this[0]){return null}return O!==h?this.each(function(){this==q||this==document?q.scrollTo(!M?O:t(q).scrollLeft(),M?O:t(q).scrollTop()):this[N]=O}):this[0]==q||this[0]==document?self[M?"pageYOffset":"pageXOffset"]||t.boxModel&&document.documentElement[N]||document.body[N]:this[0][N]}});t.each(["Height","Width"],function(P,N){var L=P?"Left":"Top",O=P?"Right":"Bottom",M=N.toLowerCase();t.fn["inner"+N]=function(){return this[0]?t.css(this[0],M,false,"padding"):null};t.fn["outer"+N]=function(R){return this[0]?t.css(this[0],M,false,R?"margin":"border"):null};var Q=N.toLowerCase();t.fn[Q]=function(R){return this[0]==q?document.compatMode=="CSS1Compat"&&document.documentElement["client"+N]||document.body["client"+N]:this[0]==document?Math.max(document.documentElement["client"+N],document.body["scroll"+N],document.documentElement["scroll"+N],document.body["offset"+N],document.documentElement["offset"+N]):R===h?(this.length?t.css(this[0],Q):null):this.css(Q,typeof R==="string"?R:R+"px")}})})();var $j=jQuery.noConflict();var OpenLayers={singleFile:true};(function(){var k=(typeof OpenLayers=="object"&&OpenLayers.singleFile);window.OpenLayers={_scriptName:(!k)?"lib/OpenLayers.js":"OpenLayers.js",_getScriptLocation:function(){var t="";var v=new RegExp("(^|(.*?\\/))("+OpenLayers._scriptName+")(\\?|$)");var q=document.getElementsByTagName("script");for(var s=0,h=q.length;s<h;s++){var u=q[s].getAttribute("src");if(u){var r=u.match(v);if(r){t=r[1];break}}}return t}};if(!k){var l=new Array("OpenLayers/Util.js","OpenLayers/BaseTypes.js","OpenLayers/BaseTypes/Class.js","OpenLayers/BaseTypes/Bounds.js","OpenLayers/BaseTypes/Element.js","OpenLayers/BaseTypes/LonLat.js","OpenLayers/BaseTypes/Pixel.js","OpenLayers/BaseTypes/Size.js","OpenLayers/Console.js","OpenLayers/Tween.js","Rico/Corner.js","Rico/Color.js","OpenLayers/Ajax.js","OpenLayers/Events.js","OpenLayers/Request.js","OpenLayers/Request/XMLHttpRequest.js","OpenLayers/Projection.js","OpenLayers/Map.js","OpenLayers/Layer.js","OpenLayers/Icon.js","OpenLayers/Marker.js","OpenLayers/Marker/Box.js","OpenLayers/Popup.js","OpenLayers/Tile.js","OpenLayers/Tile/Image.js","OpenLayers/Tile/WFS.js","OpenLayers/Layer/Image.js","OpenLayers/Layer/SphericalMercator.js","OpenLayers/Layer/EventPane.js","OpenLayers/Layer/FixedZoomLevels.js","OpenLayers/Layer/Google.js","OpenLayers/Layer/VirtualEarth.js","OpenLayers/Layer/Yahoo.js","OpenLayers/Layer/HTTPRequest.js","OpenLayers/Layer/Grid.js","OpenLayers/Layer/MapGuide.js","OpenLayers/Layer/MapServer.js","OpenLayers/Layer/MapServer/Untiled.js","OpenLayers/Layer/KaMap.js","OpenLayers/Layer/KaMapCache.js","OpenLayers/Layer/MultiMap.js","OpenLayers/Layer/Markers.js","OpenLayers/Layer/Text.js","OpenLayers/Layer/WorldWind.js","OpenLayers/Layer/ArcGIS93Rest.js","OpenLayers/Layer/WMS.js","OpenLayers/Layer/WMS/Untiled.js","OpenLayers/Layer/ArcIMS.js","OpenLayers/Layer/GeoRSS.js","OpenLayers/Layer/Boxes.js","OpenLayers/Layer/XYZ.js","OpenLayers/Layer/TMS.js","OpenLayers/Layer/TileCache.js","OpenLayers/Popup/Anchored.js","OpenLayers/Popup/AnchoredBubble.js","OpenLayers/Popup/Framed.js","OpenLayers/Popup/FramedCloud.js","OpenLayers/Feature.js","OpenLayers/Feature/Vector.js","OpenLayers/Feature/WFS.js","OpenLayers/Handler.js","OpenLayers/Handler/Click.js","OpenLayers/Handler/Hover.js","OpenLayers/Handler/Point.js","OpenLayers/Handler/Path.js","OpenLayers/Handler/Polygon.js","OpenLayers/Handler/Feature.js","OpenLayers/Handler/Drag.js","OpenLayers/Handler/RegularPolygon.js","OpenLayers/Handler/Box.js","OpenLayers/Handler/MouseWheel.js","OpenLayers/Handler/Keyboard.js","OpenLayers/Control.js","OpenLayers/Control/Attribution.js","OpenLayers/Control/Button.js","OpenLayers/Control/ZoomBox.js","OpenLayers/Control/ZoomToMaxExtent.js","OpenLayers/Control/DragPan.js","OpenLayers/Control/Navigation.js","OpenLayers/Control/MouseDefaults.js","OpenLayers/Control/MousePosition.js","OpenLayers/Control/OverviewMap.js","OpenLayers/Control/KeyboardDefaults.js","OpenLayers/Control/PanZoom.js","OpenLayers/Control/PanZoomBar.js","OpenLayers/Control/ArgParser.js","OpenLayers/Control/Permalink.js","OpenLayers/Control/Scale.js","OpenLayers/Control/ScaleLine.js","OpenLayers/Control/Snapping.js","OpenLayers/Control/Split.js","OpenLayers/Control/LayerSwitcher.js","OpenLayers/Control/DrawFeature.js","OpenLayers/Control/DragFeature.js","OpenLayers/Control/ModifyFeature.js","OpenLayers/Control/Panel.js","OpenLayers/Control/SelectFeature.js","OpenLayers/Control/NavigationHistory.js","OpenLayers/Control/Measure.js","OpenLayers/Control/WMSGetFeatureInfo.js","OpenLayers/Geometry.js","OpenLayers/Geometry/Rectangle.js","OpenLayers/Geometry/Collection.js","OpenLayers/Geometry/Point.js","OpenLayers/Geometry/MultiPoint.js","OpenLayers/Geometry/Curve.js","OpenLayers/Geometry/LineString.js","OpenLayers/Geometry/LinearRing.js","OpenLayers/Geometry/Polygon.js","OpenLayers/Geometry/MultiLineString.js","OpenLayers/Geometry/MultiPolygon.js","OpenLayers/Geometry/Surface.js","OpenLayers/Renderer.js","OpenLayers/Renderer/Elements.js","OpenLayers/Renderer/SVG.js","OpenLayers/Renderer/Canvas.js","OpenLayers/Renderer/VML.js","OpenLayers/Layer/Vector.js","OpenLayers/Layer/Vector/RootContainer.js","OpenLayers/Strategy.js","OpenLayers/Strategy/Fixed.js","OpenLayers/Strategy/Cluster.js","OpenLayers/Strategy/Paging.js","OpenLayers/Strategy/BBOX.js","OpenLayers/Strategy/Save.js","OpenLayers/Protocol.js","OpenLayers/Protocol/HTTP.js","OpenLayers/Protocol/SQL.js","OpenLayers/Protocol/SQL/Gears.js","OpenLayers/Protocol/WFS.js","OpenLayers/Protocol/WFS/v1.js","OpenLayers/Protocol/WFS/v1_0_0.js","OpenLayers/Protocol/WFS/v1_1_0.js","OpenLayers/Layer/PointTrack.js","OpenLayers/Layer/GML.js","OpenLayers/Style.js","OpenLayers/StyleMap.js","OpenLayers/Rule.js","OpenLayers/Filter.js","OpenLayers/Filter/FeatureId.js","OpenLayers/Filter/Logical.js","OpenLayers/Filter/Comparison.js","OpenLayers/Filter/Spatial.js","OpenLayers/Format.js","OpenLayers/Format/XML.js","OpenLayers/Format/ArcXML.js","OpenLayers/Format/ArcXML/Features.js","OpenLayers/Format/GML.js","OpenLayers/Format/GML/Base.js","OpenLayers/Format/GML/v2.js","OpenLayers/Format/GML/v3.js","OpenLayers/Format/KML.js","OpenLayers/Format/GeoRSS.js","OpenLayers/Format/WFS.js","OpenLayers/Format/WFSCapabilities.js","OpenLayers/Format/WFSCapabilities/v1.js","OpenLayers/Format/WFSCapabilities/v1_0_0.js","OpenLayers/Format/WFSCapabilities/v1_1_0.js","OpenLayers/Format/WFSDescribeFeatureType.js","OpenLayers/Format/WMSDescribeLayer.js","OpenLayers/Format/WMSDescribeLayer/v1_1.js","OpenLayers/Format/WKT.js","OpenLayers/Format/OSM.js","OpenLayers/Format/GPX.js","OpenLayers/Format/Filter.js","OpenLayers/Format/Filter/v1.js","OpenLayers/Format/Filter/v1_0_0.js","OpenLayers/Format/Filter/v1_1_0.js","OpenLayers/Format/SLD.js","OpenLayers/Format/SLD/v1.js","OpenLayers/Format/SLD/v1_0_0.js","OpenLayers/Format/SLD/v1.js","OpenLayers/Format/WFST.js","OpenLayers/Format/WFST/v1.js","OpenLayers/Format/WFST/v1_0_0.js","OpenLayers/Format/WFST/v1_1_0.js","OpenLayers/Format/Text.js","OpenLayers/Format/JSON.js","OpenLayers/Format/GeoJSON.js","OpenLayers/Format/WMC.js","OpenLayers/Format/WMC/v1.js","OpenLayers/Format/WMC/v1_0_0.js","OpenLayers/Format/WMC/v1_1_0.js","OpenLayers/Format/WMSCapabilities.js","OpenLayers/Format/WMSCapabilities/v1_1.js","OpenLayers/Format/WMSCapabilities/v1_1_0.js","OpenLayers/Format/WMSCapabilities/v1_1_1.js","OpenLayers/Format/WMSGetFeatureInfo.js","OpenLayers/Layer/WFS.js","OpenLayers/Control/GetFeature.js","OpenLayers/Control/MouseToolbar.js","OpenLayers/Control/NavToolbar.js","OpenLayers/Control/PanPanel.js","OpenLayers/Control/Pan.js","OpenLayers/Control/ZoomIn.js","OpenLayers/Control/ZoomOut.js","OpenLayers/Control/ZoomPanel.js","OpenLayers/Control/EditingToolbar.js","OpenLayers/Lang.js","OpenLayers/Lang/en.js");var b=navigator.userAgent;var d=(b.match("MSIE")||b.match("Safari"));if(d){var a=new Array(l.length)}var o=OpenLayers._getScriptLocation()+"lib/";for(var c=0,g=l.length;c<g;c++){if(d){a[c]="<script src='"+o+l[c]+"'><\/script>"}else{var p=document.createElement("script");p.src=o+l[c];var f=document.getElementsByTagName("head").length?document.getElementsByTagName("head")[0]:document.body;f.appendChild(p)}}if(d){document.write(a.join(""))}}})();OpenLayers.VERSION_NUMBER="OpenLayers 2.8 -- $Revision: 9492 $";OpenLayers.String={startsWith:function(b,a){return(b.indexOf(a)==0)},contains:function(b,a){return(b.indexOf(a)!=-1)},trim:function(a){return a.replace(/^\s\s*/,"").replace(/\s\s*$/,"")},camelize:function(g){var d=g.split("-");var b=d[0];for(var c=1,a=d.length;c<a;c++){var f=d[c];b+=f.charAt(0).toUpperCase()+f.substring(1)}return b},format:function(d,c,a){if(!c){c=window}var b=function(l,f){var k;var h=f.split(/\.+/);for(var g=0;g<h.length;g++){if(g==0){k=c}k=k[h[g]]}if(typeof k=="function"){k=a?k.apply(null,a):k()}if(typeof k=="undefined"){return"undefined"}else{return k}};return d.replace(OpenLayers.String.tokenRegEx,b)},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,c){var b=0;if(c>0){b=parseFloat(a.toPrecision(c))}return b},format:function(c,a,h,l){a=(typeof a!="undefined")?a:0;h=(typeof h!="undefined")?h:OpenLayers.Number.thousandsSeparator;l=(typeof l!="undefined")?l:OpenLayers.Number.decimalSeparator;if(a!=null){c=parseFloat(c.toFixed(a))}var b=c.toString().split(".");if(b.length==1&&a==null){a=0}var d=b[0];if(h){var f=/(-?[0-9]+)([0-9]{3})/;while(f.test(d)){d=d.replace(f,"$1"+h+"$2")}}var g;if(a==0){g=d}else{var k=b.length>1?b[1]:"0";if(a!=null){k=k+new Array(a-k.length+1).join("0")}g=d+l+k}return g}};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(c,b){var a=Array.prototype.slice.apply(arguments,[2]);return function(){var d=a.concat(Array.prototype.slice.apply(arguments,[0]));return c.apply(b,d)}},bindAsEventListener:function(b,a){return function(c){return b.call(a,c||window.event)}}};if(!Function.prototype.bind){Function.prototype.bind=function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Function.bind"}));Array.prototype.unshift.apply(arguments,[this]);return OpenLayers.Function.bind.apply(null,arguments)}}if(!Function.prototype.bindAsEventListener){Function.prototype.bindAsEventListener=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Function.bindAsEventListener"}));return OpenLayers.Function.bindAsEventListener(this,a)}}OpenLayers.Array={filter:function(h,g,b){var d=[];if(Array.prototype.filter){d=h.filter(g,b)}else{var a=h.length;if(typeof g!="function"){throw new TypeError()}for(var c=0;c<a;c++){if(c in h){var f=h[c];if(g.call(b,f,c,h)){d.push(f)}}}}return d}};OpenLayers.Class=function(){var d=function(){if(arguments&&arguments[0]!=OpenLayers.Class.isPrototype){this.initialize.apply(this,arguments)}};var c={};var g,b;for(var f=0,a=arguments.length;f<a;++f){if(typeof arguments[f]=="function"){if(f==0&&a>1){b=arguments[f].prototype.initialize;arguments[f].prototype.initialize=function(){};c=new arguments[f];if(b===undefined){delete arguments[f].prototype.initialize}else{arguments[f].prototype.initialize=b}}g=arguments[f].prototype}else{g=arguments[f]}OpenLayers.Util.extend(c,g)}d.prototype=c;return d};OpenLayers.Class.isPrototype=function(){};OpenLayers.Class.create=function(){return function(){if(arguments&&arguments[0]!=OpenLayers.Class.isPrototype){this.initialize.apply(this,arguments)}}};OpenLayers.Class.inherit=function(){var d=arguments[0];var f=new d(OpenLayers.Class.isPrototype);for(var c=1,a=arguments.length;c<a;c++){if(typeof arguments[c]=="function"){var b=arguments[c];arguments[c]=new b(OpenLayers.Class.isPrototype)}OpenLayers.Util.extend(f,arguments[c])}return f};OpenLayers.Util={};OpenLayers.Util.getElement=function(){var d=[];for(var c=0,a=arguments.length;c<a;c++){var b=arguments[c];if(typeof b=="string"){b=document.getElementById(b)}if(arguments.length==1){return b}d.push(b)}return d};if(typeof window.$==="undefined"){window.$=OpenLayers.Util.getElement}OpenLayers.Util.extend=function(a,f){a=a||{};if(f){for(var d in f){var c=f[d];if(c!==undefined){a[d]=c}}var b=typeof window.Event=="function"&&f instanceof window.Event;if(!b&&f.hasOwnProperty&&f.hasOwnProperty("toString")){a.toString=f.toString}}return a};OpenLayers.Util.removeItem=function(c,b){for(var a=c.length-1;a>=0;a--){if(c[a]==b){c.splice(a,1)}}return c};OpenLayers.Util.clearArray=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"array = []"}));a.length=0};OpenLayers.Util.indexOf=function(d,c){for(var b=0,a=d.length;b<a;b++){if(d[b]==c){return b}}return -1};OpenLayers.Util.modifyDOMElement=function(f,k,d,g,a,c,h,b){if(k){f.id=k}if(d){f.style.left=d.x+"px";f.style.top=d.y+"px"}if(g){f.style.width=g.w+"px";f.style.height=g.h+"px"}if(a){f.style.position=a}if(c){f.style.border=c}if(h){f.style.overflow=h}if(parseFloat(b)>=0&&parseFloat(b)<1){f.style.filter="alpha(opacity="+(b*100)+")";f.style.opacity=b}else{if(parseFloat(b)==1){f.style.filter="";f.style.opacity=""}}};OpenLayers.Util.createDiv=function(a,l,k,g,f,c,b,h){var d=document.createElement("div");if(g){d.style.backgroundImage="url("+g+")"}if(!a){a=OpenLayers.Util.createUniqueID("OpenLayersDiv")}if(!f){f="absolute"}OpenLayers.Util.modifyDOMElement(d,a,l,k,f,c,b,h);return d};OpenLayers.Util.createImage=function(a,k,h,f,d,c,g,l){var b=document.createElement("img");if(!a){a=OpenLayers.Util.createUniqueID("OpenLayersDiv")}if(!d){d="relative"}OpenLayers.Util.modifyDOMElement(b,a,k,h,d,c,null,g);if(l){b.style.display="none";OpenLayers.Event.observe(b,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,b));OpenLayers.Event.observe(b,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,b))}b.style.alt=a;b.galleryImg="no";if(f){b.src=f}return b};OpenLayers.Util.setOpacity=function(b,a){OpenLayers.Util.modifyDOMElement(b,null,null,null,null,null,null,a)};OpenLayers.Util.onImageLoad=function(){if(!this.viewRequestID||(this.map&&this.viewRequestID==this.map.viewRequestID)){this.style.backgroundColor="transparent";this.style.display=""}};OpenLayers.Util.onImageLoadErrorColor="pink";OpenLayers.IMAGE_RELOAD_ATTEMPTS=0;OpenLayers.Util.onImageLoadError=function(){this._attempts=(this._attempts)?(this._attempts+1):1;if(this._attempts<=OpenLayers.IMAGE_RELOAD_ATTEMPTS){var d=this.urls;if(d&&d instanceof Array&&d.length>1){var f=this.src.toString();var c,a;for(a=0;c=d[a];a++){if(f.indexOf(c)!=-1){break}}var g=Math.floor(d.length*Math.random());var b=d[g];a=0;while(b==c&&a++<4){g=Math.floor(d.length*Math.random());b=d[g]}this.src=f.replace(c,b)}else{this.src=this.src}}else{this.style.backgroundColor=OpenLayers.Util.onImageLoadErrorColor}this.style.display=""};OpenLayers.Util.alphaHackNeeded=null;OpenLayers.Util.alphaHack=function(){if(OpenLayers.Util.alphaHackNeeded==null){var d=navigator.appVersion.split("MSIE");var a=parseFloat(d[1]);var b=false;try{b=!!(document.body.filters)}catch(c){}OpenLayers.Util.alphaHackNeeded=(b&&(a>=5.5)&&(a<7))}return OpenLayers.Util.alphaHackNeeded};OpenLayers.Util.modifyAlphaImageDiv=function(a,b,o,l,h,g,c,d,k){OpenLayers.Util.modifyDOMElement(a,b,o,l,g,null,null,k);var f=a.childNodes[0];if(h){f.src=h}OpenLayers.Util.modifyDOMElement(f,a.id+"_innerImage",null,l,"relative",c);if(OpenLayers.Util.alphaHack()){if(a.style.display!="none"){a.style.display="inline-block"}if(d==null){d="scale"}a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+f.src+"', sizingMethod='"+d+"')";if(parseFloat(a.style.opacity)>=0&&parseFloat(a.style.opacity)<1){a.style.filter+=" alpha(opacity="+a.style.opacity*100+")"}f.style.filter="alpha(opacity=0)"}};OpenLayers.Util.createAlphaImageDiv=function(b,o,l,h,g,c,d,k,p){var a=OpenLayers.Util.createDiv();var f=OpenLayers.Util.createImage(null,null,null,null,null,null,null,false);a.appendChild(f);if(p){f.style.display="none";OpenLayers.Event.observe(f,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,a));OpenLayers.Event.observe(f,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,a))}OpenLayers.Util.modifyAlphaImageDiv(a,b,o,l,h,g,c,d,k);return a};OpenLayers.Util.upperCaseObject=function(b){var a={};for(var c in b){a[c.toUpperCase()]=b[c]}return a};OpenLayers.Util.applyDefaults=function(d,c){d=d||{};var b=typeof window.Event=="function"&&c instanceof window.Event;for(var a in c){if(d[a]===undefined||(!b&&c.hasOwnProperty&&c.hasOwnProperty(a)&&!d.hasOwnProperty(a))){d[a]=c[a]}}if(!b&&c&&c.hasOwnProperty&&c.hasOwnProperty("toString")&&!d.hasOwnProperty("toString")){d.toString=c.toString}return d};OpenLayers.Util.getParameterString=function(k){var h=[];for(var c in k){var f=k[c];if((f!=null)&&(typeof f!="function")){var b;if(typeof f=="object"&&f.constructor==Array){var g=[];for(var d=0,a=f.length;d<a;d++){g.push(encodeURIComponent(f[d]))}b=g.join(",")}else{b=encodeURIComponent(f)}h.push(encodeURIComponent(c)+"="+b)}}return h.join("&")};OpenLayers.ImgPath="";OpenLayers.Util.getImagesLocation=function(){return OpenLayers.ImgPath||(OpenLayers._getScriptLocation()+"img/")};OpenLayers.Util.Try=function(){var d=null;for(var c=0,a=arguments.length;c<a;c++){var b=arguments[c];try{d=b();break}catch(f){}}return d};OpenLayers.Util.getNodes=function(c,b){var a=OpenLayers.Util.Try(function(){return OpenLayers.Util._getNodes(c.documentElement.childNodes,b)},function(){return OpenLayers.Util._getNodes(c.childNodes,b)});return a};OpenLayers.Util._getNodes=function(c,f){var b=[];for(var d=0,a=c.length;d<a;d++){if(c[d].nodeName==f){b.push(c[d])}}return b};OpenLayers.Util.getTagText=function(c,d,b){var a=OpenLayers.Util.getNodes(c,d);if(a&&(a.length>0)){if(!b){b=0}if(a[b].childNodes.length>1){return a.childNodes[1].nodeValue}else{if(a[b].childNodes.length==1){return a[b].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,c){var b=(a.relatedTarget)?a.relatedTarget:a.toElement;while(b!=c&&b!=null){b=b.parentNode}return(b!=c)};OpenLayers.Util.DEFAULT_PRECISION=14;OpenLayers.Util.toFloat=function(b,a){if(a==null){a=OpenLayers.Util.DEFAULT_PRECISION}var b;if(a==0){b=parseFloat(b)}else{b=parseFloat(parseFloat(b).toPrecision(a))}return b};OpenLayers.Util.rad=function(a){return a*Math.PI/180};OpenLayers.Util.distVincenty=function(h,c){var S=6378137,R=6356752.3142,N=1/298.257223563;var r=OpenLayers.Util.rad(c.lon-h.lon);var Q=Math.atan((1-N)*Math.tan(OpenLayers.Util.rad(h.lat)));var P=Math.atan((1-N)*Math.tan(OpenLayers.Util.rad(c.lat)));var q=Math.sin(Q),l=Math.cos(Q);var p=Math.sin(P),k=Math.cos(P);var w=r,t=2*Math.PI;var v=20;while(Math.abs(w-t)>1e-12&&--v>0){var I=Math.sin(w),g=Math.cos(w);var T=Math.sqrt((k*I)*(k*I)+(l*p-q*k*g)*(l*p-q*k*g));if(T==0){return 0}var K=q*p+l*k*g;var H=Math.atan2(T,K);var o=Math.asin(l*k*I/T);var M=Math.cos(o)*Math.cos(o);var u=K-2*q*p/M;var E=N/16*M*(4+N*(4-3*M));t=w;w=r+(1-E)*N*Math.sin(o)*(H+E*T*(u+E*K*(-1+2*u*u)))}if(v==0){return NaN}var D=M*(S*S-R*R)/(R*R);var G=1+D/16384*(4096+D*(-768+D*(320-175*D)));var F=D/1024*(256+D*(-128+D*(74-47*D)));var J=F*T*(u+F/4*(K*(-1+2*u*u)-F/6*u*(-3+4*T*T)*(-3+4*u*u)));var z=R*G*(H-J);var O=z.toFixed(3)/1000;return O};OpenLayers.Util.getParameters=function(b){b=b||window.location.href;var a="";if(OpenLayers.String.contains(b,"?")){var c=b.indexOf("?")+1;var f=OpenLayers.String.contains(b,"#")?b.indexOf("#"):b.length;a=b.substring(c,f)}var r={};var d=a.split(/[&;]/);for(var k=0,l=d.length;k<l;++k){var h=d[k].split("=");if(h[0]){var p=decodeURIComponent(h[0]);var o=h[1]||"";o=o.split(",");for(var g=0,q=o.length;g<q;g++){o[g]=decodeURIComponent(o[g])}if(o.length==1){o=o[0]}r[p]=o}}return r};OpenLayers.Util.getArgs=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Util.getParameters"}));return OpenLayers.Util.getParameters(a)};OpenLayers.Util.lastSeqID=0;OpenLayers.Util.createUniqueID=function(a){if(a==null){a="id_"}OpenLayers.Util.lastSeqID+=1;return a+OpenLayers.Util.lastSeqID};OpenLayers.INCHES_PER_UNIT={inches:1,ft:12,mi:63360,m:39.3701,km:39370.1,dd:4374754,yd:36};OpenLayers.INCHES_PER_UNIT["in"]=OpenLayers.INCHES_PER_UNIT.inches;OpenLayers.INCHES_PER_UNIT.degrees=OpenLayers.INCHES_PER_UNIT.dd;OpenLayers.INCHES_PER_UNIT.nmi=1852*OpenLayers.INCHES_PER_UNIT.m;OpenLayers.METERS_PER_INCH=0.0254000508001016;OpenLayers.Util.extend(OpenLayers.INCHES_PER_UNIT,{Inch:OpenLayers.INCHES_PER_UNIT.inches,Meter:1/OpenLayers.METERS_PER_INCH,Foot:0.3048006096012192/OpenLayers.METERS_PER_INCH,IFoot:0.3048/OpenLayers.METERS_PER_INCH,ClarkeFoot:0.3047972651151/OpenLayers.METERS_PER_INCH,SearsFoot:0.30479947153867626/OpenLayers.METERS_PER_INCH,GoldCoastFoot:0.3047997101815088/OpenLayers.METERS_PER_INCH,IInch:0.0254/OpenLayers.METERS_PER_INCH,MicroInch:0.0000254/OpenLayers.METERS_PER_INCH,Mil:2.54e-8/OpenLayers.METERS_PER_INCH,Centimeter:0.01/OpenLayers.METERS_PER_INCH,Kilometer:1000/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.001/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":50000/OpenLayers.METERS_PER_INCH,"150kilometers":150000/OpenLayers.METERS_PER_INCH});OpenLayers.Util.extend(OpenLayers.INCHES_PER_UNIT,{mm:OpenLayers.INCHES_PER_UNIT.Meter/1000,cm:OpenLayers.INCHES_PER_UNIT.Meter/100,dm:OpenLayers.INCHES_PER_UNIT.Meter*100,km:OpenLayers.INCHES_PER_UNIT.Meter*1000,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(b){var a=(b>1)?(1/b):b;return a};OpenLayers.Util.getResolutionFromScale=function(d,a){if(a==null){a="degrees"}var c=OpenLayers.Util.normalizeScale(d);var b=1/(c*OpenLayers.INCHES_PER_UNIT[a]*OpenLayers.DOTS_PER_INCH);return b};OpenLayers.Util.getScaleFromResolution=function(b,a){if(a==null){a="degrees"}var c=b*OpenLayers.INCHES_PER_UNIT[a]*OpenLayers.DOTS_PER_INCH;return c};OpenLayers.Util.safeStopPropagation=function(a){OpenLayers.Event.stop(a,true)};OpenLayers.Util.pagePosition=function(f){var a=0,d=0;var b=f;var g=f;while(b){if(b==document.body){if(OpenLayers.Element.getStyle(g,"position")=="absolute"){break}}a+=b.offsetTop||0;d+=b.offsetLeft||0;g=b;try{b=b.offsetParent}catch(c){OpenLayers.Console.error(OpenLayers.i18n("pagePositionFailed",{elemId:b.id}));break}}b=f;while(b){a-=b.scrollTop||0;d-=b.scrollLeft||0;b=b.parentNode}return[d,a]};OpenLayers.Util.isEquivalentUrl=function(g,f,c){c=c||{};OpenLayers.Util.applyDefaults(c,{ignoreCase:true,ignorePort80:true,ignoreHash:true});var b=OpenLayers.Util.createUrlObject(g,c);var a=OpenLayers.Util.createUrlObject(f,c);for(var d in b){if(d!=="args"){if(b[d]!=a[d]){return false}}}for(var d in b.args){if(b.args[d]!=a.args[d]){return false}delete a.args[d]}for(var d in a.args){return false}return true};OpenLayers.Util.createUrlObject=function(c,p){p=p||{};if(!(/^\w+:\/\//).test(c)){var h=window.location;var f=h.port?":"+h.port:"";var k=h.protocol+"//"+h.host.split(":").shift()+f;if(c.indexOf("/")===0){c=k+c}else{var g=h.pathname.split("/");g.pop();c=k+g.join("/")+"/"+c}}if(p.ignoreCase){c=c.toLowerCase()}var l=document.createElement("a");l.href=c;var d={};d.host=l.host.split(":").shift();d.protocol=l.protocol;if(p.ignorePort80){d.port=(l.port=="80"||l.port=="0")?"":l.port}else{d.port=(l.port==""||l.port=="0")?"80":l.port}d.hash=(p.ignoreHash||l.hash==="#")?"":l.hash;var b=l.search;if(!b){var o=c.indexOf("?");b=(o!=-1)?c.substr(o):""}d.args=OpenLayers.Util.getParameters(b);d.pathname=(l.pathname.charAt(0)=="/")?l.pathname:"/"+l.pathname;return d};OpenLayers.Util.removeTail=function(b){var c=null;var a=b.indexOf("?");var d=b.indexOf("#");if(a==-1){c=(d!=-1)?b.substr(0,d):b}else{c=(d!=-1)?b.substr(0,Math.min(a,d)):b.substr(0,a)}return c};OpenLayers.Util.getBrowserName=function(){var b="";var a=navigator.userAgent.toLowerCase();if(a.indexOf("opera")!=-1){b="opera"}else{if(a.indexOf("msie")!=-1){b="msie"}else{if(a.indexOf("safari")!=-1){b="safari"}else{if(a.indexOf("mozilla")!=-1){if(a.indexOf("firefox")!=-1){b="firefox"}else{b="mozilla"}}}}}return b};OpenLayers.Util.getRenderedDimensions=function(b,s,t){var p,f;var a=document.createElement("div");a.style.visibility="hidden";var r=(t&&t.containerElement)?t.containerElement:document.body;if(s){if(s.w){p=s.w;a.style.width=p+"px"}else{if(s.h){f=s.h;a.style.height=f+"px"}}}if(t&&t.displayClass){a.className=t.displayClass}var g=document.createElement("div");g.innerHTML=b;g.style.overflow="visible";if(g.childNodes){for(var d=0,c=g.childNodes.length;d<c;d++){if(!g.childNodes[d].style){continue}g.childNodes[d].style.overflow="visible"}}a.appendChild(g);r.appendChild(a);var q=false;var o=a.parentNode;while(o&&o.tagName.toLowerCase()!="body"){var k=OpenLayers.Element.getStyle(o,"position");if(k=="absolute"){q=true;break}else{if(k&&k!="static"){break}}o=o.parentNode}if(!q){a.style.position="absolute"}if(!p){p=parseInt(g.scrollWidth);a.style.width=p+"px"}if(!f){f=parseInt(g.scrollHeight)}a.removeChild(g);r.removeChild(a);return new OpenLayers.Size(p,f)};OpenLayers.Util.getScrollbarWidth=function(){var c=OpenLayers.Util._scrollbarWidth;if(c==null){var f=null;var d=null;var a=0;var b=0;f=document.createElement("div");f.style.position="absolute";f.style.top="-1000px";f.style.left="-1000px";f.style.width="100px";f.style.height="50px";f.style.overflow="hidden";d=document.createElement("div");d.style.width="100%";d.style.height="200px";f.appendChild(d);document.body.appendChild(f);a=d.offsetWidth;f.style.overflow="scroll";b=d.offsetWidth;document.body.removeChild(document.body.lastChild);OpenLayers.Util._scrollbarWidth=(a-b);c=OpenLayers.Util._scrollbarWidth}return c};OpenLayers.Rico=new Object();OpenLayers.Rico.Corner={round:function(d,b){d=OpenLayers.Util.getElement(d);this._setOptions(b);var a=this.options.color;if(this.options.color=="fromElement"){a=this._background(d)}var c=this.options.bgColor;if(this.options.bgColor=="fromParent"){c=this._background(d.offsetParent)}this._roundCornersImpl(d,a,c)},changeColor:function(c,b){c.style.backgroundColor=b;var a=c.parentNode.getElementsByTagName("span");for(var d=0;d<a.length;d++){a[d].style.backgroundColor=b}},changeOpacity:function(c,g){var d=g;var a="alpha(opacity="+g*100+")";c.style.opacity=d;c.style.filter=a;var b=c.parentNode.getElementsByTagName("span");for(var f=0;f<b.length;f++){b[f].style.opacity=d;b[f].style.filter=a}},reRound:function(d,c){var b=d.parentNode.childNodes[0];var a=d.parentNode.childNodes[2];d.parentNode.removeChild(b);d.parentNode.removeChild(a);this.round(d.parentNode,c)},_roundCornersImpl:function(c,a,b){if(this.options.border){this._renderBorder(c,b)}if(this._isTopRounded()){this._roundTopCorners(c,a,b)}if(this._isBottomRounded()){this._roundBottomCorners(c,a,b)}},_renderBorder:function(d,f){var b="1px solid "+this._borderColor(f);var a="border-left: "+b;var g="border-right: "+b;var c="style='"+a+";"+g+"'";d.innerHTML="<div "+c+">"+d.innerHTML+"</div>"},_roundTopCorners:function(c,a,f){var d=this._createCorner(f);for(var b=0;b<this.options.numSlices;b++){d.appendChild(this._createCornerSlice(a,f,b,"top"))}c.style.paddingTop=0;c.insertBefore(d,c.firstChild)},_roundBottomCorners:function(c,a,f){var d=this._createCorner(f);for(var b=(this.options.numSlices-1);b>=0;b--){d.appendChild(this._createCornerSlice(a,f,b,"bottom"))}c.style.paddingBottom=0;c.appendChild(d)},_createCorner:function(b){var a=document.createElement("div");a.style.backgroundColor=(this._isTransparent()?"transparent":b);return a},_createCornerSlice:function(c,d,h,a){var f=document.createElement("span");var b=f.style;b.backgroundColor=c;b.display="block";b.height="1px";b.overflow="hidden";b.fontSize="1px";var g=this._borderColor(c,d);if(this.options.border&&h==0){b.borderTopStyle="solid";b.borderTopWidth="1px";b.borderLeftWidth="0px";b.borderRightWidth="0px";b.borderBottomWidth="0px";b.height="0px";b.borderColor=g}else{if(g){b.borderColor=g;b.borderStyle="solid";b.borderWidth="0px 1px"}}if(!this.options.compact&&(h==(this.options.numSlices-1))){b.height="2px"}this._setMargin(f,h,a);this._setBorder(f,h,a);return f},_setOptions:function(a){this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:true,border:false,compact:false};OpenLayers.Util.extend(this.options,a||{});this.options.numSlices=this.options.compact?2:4;if(this._isTransparent()){this.options.blend=false}},_whichSideTop:function(){if(this._hasString(this.options.corners,"all","top")){return""}if(this.options.corners.indexOf("tl")>=0&&this.options.corners.indexOf("tr")>=0){return""}if(this.options.corners.indexOf("tl")>=0){return"left"}else{if(this.options.corners.indexOf("tr")>=0){return"right"}}return""},_whichSideBottom:function(){if(this._hasString(this.options.corners,"all","bottom")){return""}if(this.options.corners.indexOf("bl")>=0&&this.options.corners.indexOf("br")>=0){return""}if(this.options.corners.indexOf("bl")>=0){return"left"}else{if(this.options.corners.indexOf("br")>=0){return"right"}}return""},_borderColor:function(a,b){if(a=="transparent"){return b}else{if(this.options.border){return this.options.border}else{if(this.options.blend){return this._blend(b,a)}else{return""}}}},_setMargin:function(d,f,b){var c=this._marginSize(f);var a=b=="top"?this._whichSideTop():this._whichSideBottom();if(a=="left"){d.style.marginLeft=c+"px";d.style.marginRight="0px"}else{if(a=="right"){d.style.marginRight=c+"px";d.style.marginLeft="0px"}else{d.style.marginLeft=c+"px";d.style.marginRight=c+"px"}}},_setBorder:function(d,f,b){var c=this._borderSize(f);var a=b=="top"?this._whichSideTop():this._whichSideBottom();if(a=="left"){d.style.borderLeftWidth=c+"px";d.style.borderRightWidth="0px"}else{if(a=="right"){d.style.borderRightWidth=c+"px";d.style.borderLeftWidth="0px"}else{d.style.borderLeftWidth=c+"px";d.style.borderRightWidth=c+"px"}}if(this.options.border!=false){d.style.borderLeftWidth=c+"px";d.style.borderRightWidth=c+"px"}},_marginSize:function(f){if(this._isTransparent()){return 0}var d=[5,3,2,1];var a=[3,2,1,0];var c=[2,1];var b=[1,0];if(this.options.compact&&this.options.blend){return b[f]}else{if(this.options.compact){return c[f]}else{if(this.options.blend){return a[f]}else{return d[f]}}}},_borderSize:function(f){var d=[5,3,2,1];var b=[2,1,1,1];var a=[1,0];var c=[0,2,0,0];if(this.options.compact&&(this.options.blend||this._isTransparent())){return 1}else{if(this.options.compact){return a[f]}else{if(this.options.blend){return b[f]}else{if(this.options.border){return c[f]}else{if(this._isTransparent()){return d[f]}}}}}return 0},_hasString:function(b){for(var a=1;a<arguments.length;a++){if(b.indexOf(arguments[a])>=0){return true}}return false},_blend:function(c,a){var b=OpenLayers.Rico.Color.createFromHex(c);b.blend(OpenLayers.Rico.Color.createFromHex(a));return b},_background:function(a){try{return OpenLayers.Rico.Color.createColorFromBackground(a).asHex()}catch(b){return"#ffffff"}},_isTransparent:function(){return this.options.color=="transparent"},_isTopRounded:function(){return this._hasString(this.options.corners,"all","top","tl","tr")},_isBottomRounded:function(){return this._hasString(this.options.corners,"all","bottom","bl","br")},_hasSingleTextChild:function(a){return a.childNodes.length==1&&a.childNodes[0].nodeType==3}};(function(){if(window.google&&google.gears){return}var a=null;if(typeof GearsFactory!="undefined"){a=new GearsFactory()}else{try{a=new ActiveXObject("Gears.Factory");if(a.getBuildInfo().indexOf("ie_mobile")!=-1){a.privateSetGlobalObject(this)}}catch(b){if((typeof navigator.mimeTypes!="undefined")&&navigator.mimeTypes["application/x-googlegears"]){a=document.createElement("object");a.style.display="none";a.width=0;a.height=0;a.type="application/x-googlegears";document.documentElement.appendChild(a)}}}if(!a){return}if(!window.google){google={}}if(!google.gears){google.gears={factory:a}}})();OpenLayers.Element={visible:function(a){return OpenLayers.Util.getElement(a).style.display!="none"},toggle:function(){for(var c=0,a=arguments.length;c<a;c++){var b=OpenLayers.Util.getElement(arguments[c]);var d=OpenLayers.Element.visible(b)?"hide":"show";OpenLayers.Element[d](b)}},hide:function(){for(var c=0,a=arguments.length;c<a;c++){var b=OpenLayers.Util.getElement(arguments[c]);b.style.display="none"}},show:function(){for(var c=0,a=arguments.length;c<a;c++){var b=OpenLayers.Util.getElement(arguments[c]);b.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(b){b=OpenLayers.Util.getElement(b);if(OpenLayers.Element.getStyle(b,"display")!="none"){return{width:b.offsetWidth,height:b.offsetHeight}}var a=b.style;var f=a.visibility;var c=a.position;a.visibility="hidden";a.position="absolute";a.display="";var g=b.clientWidth;var d=b.clientHeight;a.display="none";a.position=c;a.visibility=f;return{width:g,height:d}},hasClass:function(b,a){var c=b.className;return(!!c&&new RegExp("(^|\\s)"+a+"(\\s|$)").test(c))},addClass:function(b,a){if(!OpenLayers.Element.hasClass(b,a)){b.className+=(b.className?" ":"")+a}return b},removeClass:function(b,a){var c=b.className;if(c){b.className=OpenLayers.String.trim(c.replace(new RegExp("(^|\\s+)"+a+"(\\s+|$)")," "))}return b},toggleClass:function(b,a){if(OpenLayers.Element.hasClass(b,a)){OpenLayers.Element.removeClass(b,a)}else{OpenLayers.Element.addClass(b,a)}return b},getStyle:function(c,d){c=OpenLayers.Util.getElement(c);var f=null;if(c&&c.style){f=c.style[OpenLayers.String.camelize(d)];if(!f){if(document.defaultView&&document.defaultView.getComputedStyle){var b=document.defaultView.getComputedStyle(c,null);f=b?b.getPropertyValue(d):null}else{if(c.currentStyle){f=c.currentStyle[OpenLayers.String.camelize(d)]}}}var a=["left","top","right","bottom"];if(window.opera&&(OpenLayers.Util.indexOf(a,d)!=-1)&&(OpenLayers.Element.getStyle(c,"position")=="static")){f="auto"}}return f=="auto"?null:f}};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(b){var a=false;if(b!=null){a=((this.w==b.w&&this.h==b.h)||(isNaN(this.w)&&isNaN(this.h)&&isNaN(b.w)&&isNaN(b.h)))}return a},CLASS_NAME:"OpenLayers.Size"});OpenLayers.Console={log:function(){},debug:function(){},info:function(){},warn:function(){},error:function(){},userError:function(a){alert(a)},assert:function(){},dir:function(){},dirxml:function(){},trace:function(){},group:function(){},groupEnd:function(){},time:function(){},timeEnd:function(){},profile:function(){},profileEnd:function(){},count:function(){},CLASS_NAME:"OpenLayers.Console"};(function(){var b=document.getElementsByTagName("script");for(var c=0,a=b.length;c<a;++c){if(b[c].src.indexOf("firebug.js")!=-1){if(console){OpenLayers.Util.extend(OpenLayers.Console,console);break}}}})();OpenLayers.Icon=OpenLayers.Class({url:null,size:null,offset:null,calculateOffset:null,imageDiv:null,px:null,initialize:function(a,b,d,c){this.url=a;this.size=(b)?b:new OpenLayers.Size(20,20);this.offset=d?d:new OpenLayers.Pixel(-(this.size.w/2),-(this.size.h/2));this.calculateOffset=c;var f=OpenLayers.Util.createUniqueID("OL_Icon_");this.imageDiv=OpenLayers.Util.createAlphaImageDiv(f)},destroy:function(){this.erase();OpenLayers.Event.stopObservingElement(this.imageDiv.firstChild);this.imageDiv.innerHTML="";this.imageDiv=null},clone:function(){return new OpenLayers.Icon(this.url,this.size,this.offset,this.calculateOffset)},setSize:function(a){if(a!=null){this.size=a}this.draw()},setUrl:function(a){if(a!=null){this.url=a}this.draw()},draw:function(a){OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,null,this.size,this.url,"absolute");this.moveTo(a);return this.imageDiv},erase:function(){if(this.imageDiv!=null&&this.imageDiv.parentNode!=null){OpenLayers.Element.remove(this.imageDiv)}},setOpacity:function(a){OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,null,null,null,null,null,null,a)},moveTo:function(a){if(a!=null){this.px=a}if(this.imageDiv!=null){if(this.px==null){this.display(false)}else{if(this.calculateOffset){this.offset=this.calculateOffset(this.size)}var b=this.px.offset(this.offset);OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,b)}}},display:function(a){this.imageDiv.style.display=(a)?"":"none"},isDrawn:function(){var a=(this.imageDiv&&this.imageDiv.parentNode&&(this.imageDiv.parentNode.nodeType!=11));return a},CLASS_NAME:"OpenLayers.Icon"});OpenLayers.Popup=OpenLayers.Class({events:null,id:"",lonlat:null,div:null,contentSize:null,size:null,contentHTML:null,backgroundColor:"",opacity:"",border:"",contentDiv:null,groupDiv:null,closeDiv:null,autoSize:false,minSize:null,maxSize:null,displayClass:"olPopup",contentDisplayClass:"olPopupContent",padding:0,disableFirefoxOverflowHack:false,fixPadding:function(){if(typeof this.padding=="number"){this.padding=new OpenLayers.Bounds(this.padding,this.padding,this.padding,this.padding)}},panMapIfOutOfView:false,keepInMap:false,closeOnMove:false,map:null,initialize:function(h,c,g,b,f,d){if(h==null){h=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")}this.id=h;this.lonlat=c;this.contentSize=(g!=null)?g:new OpenLayers.Size(OpenLayers.Popup.WIDTH,OpenLayers.Popup.HEIGHT);if(b!=null){this.contentHTML=b}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;var a=this.id+"_GroupDiv";this.groupDiv=OpenLayers.Util.createDiv(a,null,null,null,"relative",null,"hidden");var h=this.div.id+"_contentDiv";this.contentDiv=OpenLayers.Util.createDiv(h,null,this.contentSize.clone(),null,"relative");this.contentDiv.className=this.contentDisplayClass;this.groupDiv.appendChild(this.contentDiv);this.div.appendChild(this.groupDiv);if(f){this.addCloseBox(d)}this.registerEvents()},destroy:function(){this.id=null;this.lonlat=null;this.size=null;this.contentHTML=null;this.backgroundColor=null;this.opacity=null;this.border=null;if(this.closeOnMove&&this.map){this.map.events.unregister("movestart",this,this.hide)}this.events.destroy();this.events=null;if(this.closeDiv){OpenLayers.Event.stopObservingElement(this.closeDiv);this.groupDiv.removeChild(this.closeDiv)}this.closeDiv=null;this.div.removeChild(this.groupDiv);this.groupDiv=null;if(this.map!=null){this.map.removePopup(this)}this.map=null;this.div=null;this.autoSize=null;this.minSize=null;this.maxSize=null;this.padding=null;this.panMapIfOutOfView=null},draw:function(a){if(a==null){if((this.lonlat!=null)&&(this.map!=null)){a=this.map.getLayerPxFromLonLat(this.lonlat)}}if(this.closeOnMove){this.map.events.register("movestart",this,this.hide)}if(!this.disableFirefoxOverflowHack&&OpenLayers.Util.getBrowserName()=="firefox"){this.map.events.register("movestart",this,function(){var b=document.defaultView.getComputedStyle(this.contentDiv,null);var c=b.getPropertyValue("overflow");if(c!="hidden"){this.contentDiv._oldOverflow=c;this.contentDiv.style.overflow="hidden"}});this.map.events.register("moveend",this,function(){var b=this.contentDiv._oldOverflow;if(b){this.contentDiv.style.overflow=b;this.contentDiv._oldOverflow=null}})}this.moveTo(a);if(!this.autoSize&&!this.size){this.setSize(this.contentSize)}this.setBackgroundColor();this.setOpacity();this.setBorder();this.setContentHTML();if(this.panMapIfOutOfView){this.panIntoView()}return this.div},updatePosition:function(){if((this.lonlat)&&(this.map)){var a=this.map.getLayerPxFromLonLat(this.lonlat);if(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(){if(this.visible()){this.hide()}else{this.show()}},show:function(){OpenLayers.Element.show(this.div);if(this.panMapIfOutOfView){this.panIntoView()}},hide:function(){OpenLayers.Element.hide(this.div)},setSize:function(c){this.size=c.clone();var b=this.getContentDivPadding();var a=b.left+b.right;var f=b.top+b.bottom;this.fixPadding();a+=this.padding.left+this.padding.right;f+=this.padding.top+this.padding.bottom;if(this.closeDiv){var d=parseInt(this.closeDiv.style.width);a+=d+b.right}this.size.w+=a;this.size.h+=f;if(OpenLayers.Util.getBrowserName()=="msie"){this.contentSize.w+=b.left+b.right;this.contentSize.h+=b.bottom+b.top}if(this.div!=null){this.div.style.width=this.size.w+"px";this.div.style.height=this.size.h+"px"}if(this.contentDiv!=null){this.contentDiv.style.width=c.w+"px";this.contentDiv.style.height=c.h+"px"}},updateSize:function(){var f="<div class='"+this.contentDisplayClass+"'>"+this.contentDiv.innerHTML+"</div>";var k=(this.map)?this.map.layerContainerDiv:document.body;var l=OpenLayers.Util.getRenderedDimensions(f,null,{displayClass:this.displayClass,containerElement:k});var h=this.getSafeContentSize(l);var g=null;if(h.equals(l)){g=l}else{var b=new OpenLayers.Size();b.w=(h.w<l.w)?h.w:null;b.h=(h.h<l.h)?h.h:null;if(b.w&&b.h){g=h}else{var d=OpenLayers.Util.getRenderedDimensions(f,b,{displayClass:this.contentDisplayClass,containerElement:k});var c=OpenLayers.Element.getStyle(this.contentDiv,"overflow");if((c!="hidden")&&(d.equals(h))){var a=OpenLayers.Util.getScrollbarWidth();if(b.w){d.h+=a}else{d.w+=a}}g=this.getSafeContentSize(d)}}this.setSize(g)},setBackgroundColor:function(a){if(a!=undefined){this.backgroundColor=a}if(this.div!=null){this.div.style.backgroundColor=this.backgroundColor}},setOpacity:function(a){if(a!=undefined){this.opacity=a}if(this.div!=null){this.div.style.opacity=this.opacity;this.div.style.filter="alpha(opacity="+this.opacity*100+")"}},setBorder:function(a){if(a!=undefined){this.border=a}if(this.div!=null){this.div.style.border=this.border}},setContentHTML:function(a){if(a!=null){this.contentHTML=a}if((this.contentDiv!=null)&&(this.contentHTML!=null)&&(this.contentHTML!=this.contentDiv.innerHTML)){this.contentDiv.innerHTML=this.contentHTML;if(this.autoSize){this.registerImageListeners();this.updateSize()}}},registerImageListeners:function(){var g=function(){this.popup.updateSize();if(this.popup.visible()&&this.popup.panMapIfOutOfView){this.popup.panIntoView()}OpenLayers.Event.stopObserving(this.img,"load",this.img._onImageLoad)};var b=this.contentDiv.getElementsByTagName("img");for(var f=0,a=b.length;f<a;f++){var c=b[f];if(c.width==0||c.height==0){var d={popup:this,img:c};c._onImgLoad=OpenLayers.Function.bind(g,d);OpenLayers.Event.observe(c,"load",c._onImgLoad)}}},getSafeContentSize:function(p){var d=p.clone();var l=this.getContentDivPadding();var o=l.left+l.right;var h=l.top+l.bottom;this.fixPadding();o+=this.padding.left+this.padding.right;h+=this.padding.top+this.padding.bottom;if(this.closeDiv){var c=parseInt(this.closeDiv.style.width);o+=c+l.right}if(this.minSize){d.w=Math.max(d.w,(this.minSize.w-o));d.h=Math.max(d.h,(this.minSize.h-h))}if(this.maxSize){d.w=Math.min(d.w,(this.maxSize.w-o));d.h=Math.min(d.h,(this.maxSize.h-h))}if(this.map&&this.map.size){var g=0,f=0;if(this.keepInMap&&!this.panMapIfOutOfView){var k=this.map.getPixelFromLonLat(this.lonlat);switch(this.relativePosition){case"tr":g=k.x;f=this.map.size.h-k.y;break;case"tl":g=this.map.size.w-k.x;f=this.map.size.h-k.y;break;case"bl":g=this.map.size.w-k.x;f=k.y;break;case"br":g=k.x;f=k.y;break;default:g=k.x;f=this.map.size.h-k.y;break}}var a=this.map.size.h-this.map.paddingForPopups.top-this.map.paddingForPopups.bottom-h-f;var b=this.map.size.w-this.map.paddingForPopups.left-this.map.paddingForPopups.right-o-g;d.w=Math.min(d.w,b);d.h=Math.min(d.h,a)}return d},getContentDivPadding:function(){var a=this._contentDivPadding;if(!a){if(this.div.parentNode==null){this.div.style.display="none";document.body.appendChild(this.div)}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"));this._contentDivPadding=a;if(this.div.parentNode==document.body){document.body.removeChild(this.div);this.div.style.display=""}}return a},addCloseBox:function(c){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);var a=c||function(d){this.hide();OpenLayers.Event.stop(d)};OpenLayers.Event.observe(this.closeDiv,"click",OpenLayers.Function.bindAsEventListener(a,this))},panIntoView:function(){var f=this.map.getSize();var d=this.map.getViewPortPxFromLayerPx(new OpenLayers.Pixel(parseInt(this.div.style.left),parseInt(this.div.style.top)));var c=d.clone();if(d.x<this.map.paddingForPopups.left){c.x=this.map.paddingForPopups.left}else{if((d.x+this.size.w)>(f.w-this.map.paddingForPopups.right)){c.x=f.w-this.map.paddingForPopups.right-this.size.w}}if(d.y<this.map.paddingForPopups.top){c.y=this.map.paddingForPopups.top}else{if((d.y+this.size.h)>(f.h-this.map.paddingForPopups.bottom)){c.y=f.h-this.map.paddingForPopups.bottom-this.size.h}}var b=d.x-c.x;var a=d.y-c.y;this.map.pan(b,a)},registerEvents:function(){this.events=new OpenLayers.Events(this,this.div,null,true);this.events.on({mousedown:this.onmousedown,mousemove:this.onmousemove,mouseup:this.onmouseup,click:this.onclick,mouseout:this.onmouseout,dblclick:this.ondblclick,scope:this})},onmousedown:function(a){this.mousedown=true;OpenLayers.Event.stop(a,true)},onmousemove:function(a){if(this.mousedown){OpenLayers.Event.stop(a,true)}},onmouseup:function(a){if(this.mousedown){this.mousedown=false;OpenLayers.Event.stop(a,true)}},onclick:function(a){OpenLayers.Event.stop(a,true)},onmouseout:function(a){this.mousedown=false},ondblclick:function(a){OpenLayers.Event.stop(a,true)},CLASS_NAME:"OpenLayers.Popup"});OpenLayers.Popup.WIDTH=200;OpenLayers.Popup.HEIGHT=200;OpenLayers.Popup.COLOR="white";OpenLayers.Popup.OPACITY=1;OpenLayers.Popup.BORDER="0px";OpenLayers.Protocol=OpenLayers.Class({format:null,options:null,autoDestroy:true,initialize:function(a){a=a||{};OpenLayers.Util.extend(this,a);this.options=a},destroy:function(){this.options=null;this.format=null},read:function(){},create:function(){},update:function(){},"delete":function(){},commit:function(){},abort:function(a){},CLASS_NAME:"OpenLayers.Protocol"});OpenLayers.Protocol.Response=OpenLayers.Class({code:null,requestType:null,last:true,features:null,reqFeatures:null,priv:null,initialize:function(a){OpenLayers.Util.extend(this,a)},success:function(){return this.code>0},CLASS_NAME:"OpenLayers.Protocol.Response"});OpenLayers.Protocol.Response.SUCCESS=1;OpenLayers.Protocol.Response.FAILURE=0;OpenLayers.Renderer=OpenLayers.Class({container:null,root:null,extent:null,locked:false,size:null,resolution:null,map:null,initialize:function(a,b){this.container=OpenLayers.Util.getElement(a)},destroy:function(){this.container=null;this.extent=null;this.size=null;this.resolution=null;this.map=null},supported:function(){return false},setExtent:function(a,b){this.extent=a.clone();if(b){this.resolution=null}},setSize:function(a){this.size=a.clone();this.resolution=null},getResolution:function(){this.resolution=this.resolution||this.map.getResolution();return this.resolution},drawFeature:function(a,b){if(b==null){b=a.style}if(a.geometry){var c=a.geometry.getBounds();if(c){if(!c.intersectsBounds(this.extent)){b={display:"none"}}var d=this.drawGeometry(a.geometry,b,a.id);if(b.display!="none"&&b.label&&d!==false){this.drawText(a.id,b,a.geometry.getCentroid())}else{this.removeText(a.id)}return d}}},drawGeometry:function(c,a,b){},drawText:function(c,b,a){},removeText:function(a){},clear:function(){},getFeatureIdFromEvent:function(a){},eraseFeatures:function(c){if(!(c instanceof Array)){c=[c]}for(var b=0,a=c.length;b<a;++b){this.eraseGeometry(c[b].geometry);this.removeText(c[b].id)}},eraseGeometry:function(a){},moveRoot:function(a){},getRenderLayerId:function(){return this.container.id},CLASS_NAME:"OpenLayers.Renderer"});OpenLayers.Strategy=OpenLayers.Class({layer:null,options:null,active:null,autoActivate:true,autoDestroy:true,initialize:function(a){OpenLayers.Util.extend(this,a);this.options=a;this.active=false},destroy:function(){this.deactivate();this.layer=null;this.options=null},setLayer:function(a){this.layer=a},activate:function(){if(!this.active){this.active=true;return true}return false},deactivate:function(){if(this.active){this.active=false;return true}return false},CLASS_NAME:"OpenLayers.Strategy"});OpenLayers.Rico.Color=OpenLayers.Class({initialize:function(c,b,a){this.rgb={r:c,g:b,b:a}},setRed:function(a){this.rgb.r=a},setGreen:function(a){this.rgb.g=a},setBlue:function(a){this.rgb.b=a},setHue:function(b){var a=this.asHSB();a.h=b;this.rgb=OpenLayers.Rico.Color.HSBtoRGB(a.h,a.s,a.b)},setSaturation:function(b){var a=this.asHSB();a.s=b;this.rgb=OpenLayers.Rico.Color.HSBtoRGB(a.h,a.s,a.b)},setBrightness:function(a){var c=this.asHSB();c.b=a;this.rgb=OpenLayers.Rico.Color.HSBtoRGB(c.h,c.s,c.b)},darken:function(b){var a=this.asHSB();this.rgb=OpenLayers.Rico.Color.HSBtoRGB(a.h,a.s,Math.max(a.b-b,0))},brighten:function(b){var a=this.asHSB();this.rgb=OpenLayers.Rico.Color.HSBtoRGB(a.h,a.s,Math.min(a.b+b,1))},blend:function(a){this.rgb.r=Math.floor((this.rgb.r+a.rgb.r)/2);this.rgb.g=Math.floor((this.rgb.g+a.rgb.g)/2);this.rgb.b=Math.floor((this.rgb.b+a.rgb.b)/2)},isBright:function(){var a=this.asHSB();return this.asHSB().b>0.5},isDark:function(){return !this.isBright()},asRGB:function(){return"rgb("+this.rgb.r+","+this.rgb.g+","+this.rgb.b+")"},asHex:function(){return"#"+this.rgb.r.toColorPart()+this.rgb.g.toColorPart()+this.rgb.b.toColorPart()},asHSB:function(){return OpenLayers.Rico.Color.RGBtoHSB(this.rgb.r,this.rgb.g,this.rgb.b)},toString:function(){return this.asHex()}});OpenLayers.Rico.Color.createFromHex=function(d){if(d.length==4){var b=d;var d="#";for(var c=1;c<4;c++){d+=(b.charAt(c)+b.charAt(c))}}if(d.indexOf("#")==0){d=d.substring(1)}var g=d.substring(0,2);var f=d.substring(2,4);var a=d.substring(4,6);return new OpenLayers.Rico.Color(parseInt(g,16),parseInt(f,16),parseInt(a,16))};OpenLayers.Rico.Color.createColorFromBackground=function(d){var b=RicoUtil.getElementsComputedStyle(OpenLayers.Util.getElement(d),"backgroundColor","background-color");if(b=="transparent"&&d.parentNode){return OpenLayers.Rico.Color.createColorFromBackground(d.parentNode)}if(b==null){return new OpenLayers.Rico.Color(255,255,255)}if(b.indexOf("rgb(")==0){var a=b.substring(4,b.length-1);var c=a.split(",");return new OpenLayers.Rico.Color(parseInt(c[0]),parseInt(c[1]),parseInt(c[2]))}else{if(b.indexOf("#")==0){return OpenLayers.Rico.Color.createFromHex(b)}else{return new OpenLayers.Rico.Color(255,255,255)}}};OpenLayers.Rico.Color.HSBtoRGB=function(l,g,r){var c=0;var d=0;var s=0;if(g==0){c=parseInt(r*255+0.5);d=c;s=c}else{var k=(l-Math.floor(l))*6;var o=k-Math.floor(k);var b=r*(1-g);var a=r*(1-g*o);var u=r*(1-(g*(1-o)));switch(parseInt(k)){case 0:c=(r*255+0.5);d=(u*255+0.5);s=(b*255+0.5);break;case 1:c=(a*255+0.5);d=(r*255+0.5);s=(b*255+0.5);break;case 2:c=(b*255+0.5);d=(r*255+0.5);s=(u*255+0.5);break;case 3:c=(b*255+0.5);d=(a*255+0.5);s=(r*255+0.5);break;case 4:c=(u*255+0.5);d=(b*255+0.5);s=(r*255+0.5);break;case 5:c=(r*255+0.5);d=(b*255+0.5);s=(a*255+0.5);break}}return{r:parseInt(c),g:parseInt(d),b:parseInt(s)}};OpenLayers.Rico.Color.RGBtoHSB=function(a,h,q){var k;var f;var p;var s=(a>h)?a:h;if(q>s){s=q}var l=(a<h)?a:h;if(q<l){l=q}p=s/255;if(s!=0){f=(s-l)/s}else{f=0}if(f==0){k=0}else{var c=(s-a)/(s-l);var o=(s-h)/(s-l);var d=(s-q)/(s-l);if(a==s){k=d-o}else{if(h==s){k=2+c-d}else{k=4+o-c}}k=k/6;if(k<0){k=k+1}}return{h:k,s:f,b:p}};OpenLayers.Bounds=OpenLayers.Class({left:null,bottom:null,right:null,top:null,centerLonLat:null,initialize:function(d,a,b,c){if(d!=null){this.left=OpenLayers.Util.toFloat(d)}if(a!=null){this.bottom=OpenLayers.Util.toFloat(a)}if(b!=null){this.right=OpenLayers.Util.toFloat(b)}if(c!=null){this.top=OpenLayers.Util.toFloat(c)}},clone:function(){return new OpenLayers.Bounds(this.left,this.bottom,this.right,this.top)},equals:function(b){var a=false;if(b!=null){a=((this.left==b.left)&&(this.right==b.right)&&(this.top==b.top)&&(this.bottom==b.bottom))}return a},toString:function(){return("left-bottom=("+this.left+","+this.bottom+") right-top=("+this.right+","+this.top+")")},toArray:function(){return[this.left,this.bottom,this.right,this.top]},toBBOX:function(a){if(a==null){a=6}var b=Math.pow(10,a);var c=Math.round(this.left*b)/b+","+Math.round(this.bottom*b)/b+","+Math.round(this.right*b)/b+","+Math.round(this.top*b)/b;return 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(g,k){if(k==null){k=this.getCenterLonLat()}var a=[];var f,d;if(k.CLASS_NAME=="OpenLayers.LonLat"){f=k.lon;d=k.lat}else{f=k.x;d=k.y}var c=(this.left-f)*g+f;var b=(this.bottom-d)*g+d;var l=(this.right-f)*g+f;var h=(this.top-d)*g+d;return new OpenLayers.Bounds(c,b,l,h)},add:function(a,c){if((a==null)||(c==null)){var b=OpenLayers.i18n("boundsAddError");OpenLayers.Console.error(b);return null}return new OpenLayers.Bounds(this.left+a,this.bottom+c,this.right+a,this.top+c)},extend:function(a){var b=null;if(a){switch(a.CLASS_NAME){case"OpenLayers.LonLat":b=new OpenLayers.Bounds(a.lon,a.lat,a.lon,a.lat);break;case"OpenLayers.Geometry.Point":b=new OpenLayers.Bounds(a.x,a.y,a.x,a.y);break;case"OpenLayers.Bounds":b=a;break}if(b){this.centerLonLat=null;if((this.left==null)||(b.left<this.left)){this.left=b.left}if((this.bottom==null)||(b.bottom<this.bottom)){this.bottom=b.bottom}if((this.right==null)||(b.right>this.right)){this.right=b.right}if((this.top==null)||(b.top>this.top)){this.top=b.top}}}},containsLonLat:function(b,a){return this.contains(b.lon,b.lat,a)},containsPixel:function(b,a){return this.contains(b.x,b.y,a)},contains:function(b,d,a){if(a==null){a=true}if(b==null||d==null){return false}b=OpenLayers.Util.toFloat(b);d=OpenLayers.Util.toFloat(d);var c=false;if(a){c=((b>=this.left)&&(b<=this.right)&&(d>=this.bottom)&&(d<=this.top))}else{c=((b>this.left)&&(b<this.right)&&(d>this.bottom)&&(d<this.top))}return c},intersectsBounds:function(f,b){if(b==null){b=true}var d=false;var k=(this.left==f.right||this.right==f.left||this.top==f.bottom||this.bottom==f.top);if(b||!k){var h=(((f.bottom>=this.bottom)&&(f.bottom<=this.top))||((this.bottom>=f.bottom)&&(this.bottom<=f.top)));var g=(((f.top>=this.bottom)&&(f.top<=this.top))||((this.top>f.bottom)&&(this.top<f.top)));var c=(((f.left>=this.left)&&(f.left<=this.right))||((this.left>=f.left)&&(this.left<=f.right)));var a=(((f.right>=this.left)&&(f.right<=this.right))||((this.right>=f.left)&&(this.right<=f.right)));d=((h||g)&&(c||a))}return d},containsBounds:function(h,b,a){if(b==null){b=false}if(a==null){a=true}var c=this.contains(h.left,h.bottom,a);var d=this.contains(h.right,h.bottom,a);var g=this.contains(h.left,h.top,a);var f=this.contains(h.right,h.top,a);return(b)?(c||d||g||f):(c&&d&&g&&f)},determineQuadrant:function(c){var b="";var a=this.getCenterLonLat();b+=(c.lat<a.lat)?"b":"t";b+=(c.lon<a.lon)?"l":"r";return b},transform:function(d,b){this.centerLonLat=null;var f=OpenLayers.Projection.transform({x:this.left,y:this.bottom},d,b);var a=OpenLayers.Projection.transform({x:this.right,y:this.bottom},d,b);var c=OpenLayers.Projection.transform({x:this.left,y:this.top},d,b);var g=OpenLayers.Projection.transform({x:this.right,y:this.top},d,b);this.left=Math.min(f.x,c.x);this.bottom=Math.min(f.y,a.y);this.right=Math.max(a.x,g.x);this.top=Math.max(c.y,g.y);return this},wrapDateLine:function(a,c){c=c||{};var d=c.leftTolerance||0;var b=c.rightTolerance||0;var f=this.clone();if(a){while(f.left<a.left&&(f.right-b)<=a.left){f=f.add(a.getWidth(),0)}while((f.left+d)>=a.right&&f.right>a.right){f=f.add(-a.getWidth(),0)}}return f},CLASS_NAME:"OpenLayers.Bounds"});OpenLayers.Bounds.fromString=function(b){var a=b.split(",");return OpenLayers.Bounds.fromArray(a)};OpenLayers.Bounds.fromArray=function(a){return new OpenLayers.Bounds(parseFloat(a[0]),parseFloat(a[1]),parseFloat(a[2]),parseFloat(a[3]))};OpenLayers.Bounds.fromSize=function(a){return new OpenLayers.Bounds(0,a.h,a.w,0)};OpenLayers.Bounds.oppositeQuadrant=function(a){var b="";b+=(a.charAt(0)=="t")?"b":"t";b+=(a.charAt(1)=="l")?"r":"l";return b};OpenLayers.LonLat=OpenLayers.Class({lon:0,lat:0,initialize:function(b,a){this.lon=OpenLayers.Util.toFloat(b);this.lat=OpenLayers.Util.toFloat(a)},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(c,a){if((c==null)||(a==null)){var b=OpenLayers.i18n("lonlatAddError");OpenLayers.Console.error(b);return null}return new OpenLayers.LonLat(this.lon+c,this.lat+a)},equals:function(b){var a=false;if(b!=null){a=((this.lon==b.lon&&this.lat==b.lat)||(isNaN(this.lon)&&isNaN(this.lat)&&isNaN(b.lon)&&isNaN(b.lat)))}return a},transform:function(c,b){var a=OpenLayers.Projection.transform({x:this.lon,y:this.lat},c,b);this.lon=a.x;this.lat=a.y;return this},wrapDateLine:function(a){var b=this.clone();if(a){while(b.lon<a.left){b.lon+=a.getWidth()}while(b.lon>a.right){b.lon-=a.getWidth()}}return b},CLASS_NAME:"OpenLayers.LonLat"});OpenLayers.LonLat.fromString=function(b){var a=b.split(",");return new OpenLayers.LonLat(parseFloat(a[0]),parseFloat(a[1]))};OpenLayers.Pixel=OpenLayers.Class({x:0,y:0,initialize:function(a,b){this.x=parseFloat(a);this.y=parseFloat(b)},toString:function(){return("x="+this.x+",y="+this.y)},clone:function(){return new OpenLayers.Pixel(this.x,this.y)},equals:function(a){var b=false;if(a!=null){b=((this.x==a.x&&this.y==a.y)||(isNaN(this.x)&&isNaN(this.y)&&isNaN(a.x)&&isNaN(a.y)))}return b},add:function(a,c){if((a==null)||(c==null)){var b=OpenLayers.i18n("pixelAddError");OpenLayers.Console.error(b);return null}return new OpenLayers.Pixel(this.x+a,this.y+c)},offset:function(a){var b=this.clone();if(a){b=this.add(a.x,a.y)}return b},CLASS_NAME:"OpenLayers.Pixel"});OpenLayers.Control=OpenLayers.Class({id:null,map:null,div:null,type:null,allowSelection:false,displayClass:"",title:"",active:null,handler:null,eventListeners:null,events:null,EVENT_TYPES:["activate","deactivate"],initialize:function(a){this.displayClass=this.CLASS_NAME.replace("OpenLayers.","ol").replace(/\./g,"");OpenLayers.Util.extend(this,a);this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES);if(this.eventListeners instanceof Object){this.events.on(this.eventListeners)}if(this.id==null){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")}},destroy:function(){if(this.events){if(this.eventListeners){this.events.un(this.eventListeners)}this.events.destroy();this.events=null}this.eventListeners=null;if(this.handler){this.handler.destroy();this.handler=null}if(this.handlers){for(var a in this.handlers){if(this.handlers.hasOwnProperty(a)&&typeof this.handlers[a].destroy=="function"){this.handlers[a].destroy()}}this.handlers=null}if(this.map){this.map.removeControl(this);this.map=null}},setMap:function(a){this.map=a;if(this.handler){this.handler.setMap(a)}},draw:function(a){if(this.div==null){this.div=OpenLayers.Util.createDiv(this.id);this.div.className=this.displayClass;if(!this.allowSelection){this.div.className+=" olControlNoSelect";this.div.setAttribute("unselectable","on",0);this.div.onselectstart=function(){return(false)}}if(this.title!=""){this.div.title=this.title}}if(a!=null){this.position=a.clone()}this.moveTo(this.position);return this.div},moveTo:function(a){if((a!=null)&&(this.div!=null)){this.div.style.left=a.x+"px";this.div.style.top=a.y+"px"}},activate:function(){if(this.active){return false}if(this.handler){this.handler.activate()}this.active=true;if(this.map){OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active")}this.events.triggerEvent("activate");return true},deactivate:function(){if(this.active){if(this.handler){this.handler.deactivate()}this.active=false;if(this.map){OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active")}this.events.triggerEvent("deactivate");return true}return false},CLASS_NAME:"OpenLayers.Control"});OpenLayers.Control.TYPE_BUTTON=1;OpenLayers.Control.TYPE_TOGGLE=2;OpenLayers.Control.TYPE_TOOL=3;OpenLayers.Lang={code:null,defaultCode:"en",getCode:function(){if(!OpenLayers.Lang.code){OpenLayers.Lang.setCode()}return OpenLayers.Lang.code},setCode:function(b){var d;if(!b){b=(OpenLayers.Util.getBrowserName()=="msie")?navigator.userLanguage:navigator.language}var c=b.split("-");c[0]=c[0].toLowerCase();if(typeof OpenLayers.Lang[c[0]]=="object"){d=c[0]}if(c[1]){var a=c[0]+"-"+c[1].toUpperCase();if(typeof OpenLayers.Lang[a]=="object"){d=a}}if(!d){OpenLayers.Console.warn("Failed to find OpenLayers.Lang."+c.join("-")+" dictionary, falling back to default language");d=OpenLayers.Lang.defaultCode}OpenLayers.Lang.code=d},translate:function(b,a){var d=OpenLayers.Lang[OpenLayers.Lang.getCode()];var c=d[b];if(!c){c=b}if(a){c=OpenLayers.String.format(c,a)}return c}};OpenLayers.i18n=OpenLayers.Lang.translate;OpenLayers.Popup.Anchored=OpenLayers.Class(OpenLayers.Popup,{relativePosition:null,keepInMap:true,anchor:null,initialize:function(k,d,h,c,b,g,f){var a=[k,d,h,c,g,f];OpenLayers.Popup.prototype.initialize.apply(this,a);this.anchor=(b!=null)?b:{size:new OpenLayers.Size(0,0),offset:new OpenLayers.Pixel(0,0)}},destroy:function(){this.anchor=null;this.relativePosition=null;OpenLayers.Popup.prototype.destroy.apply(this,arguments)},show:function(){this.updatePosition();OpenLayers.Popup.prototype.show.apply(this,arguments)},moveTo:function(c){var b=this.relativePosition;this.relativePosition=this.calculateRelativePosition(c);var d=this.calculateNewPx(c);var a=new Array(d);OpenLayers.Popup.prototype.moveTo.apply(this,a);if(this.relativePosition!=b){this.updateRelativePosition()}},setSize:function(b){OpenLayers.Popup.prototype.setSize.apply(this,arguments);if((this.lonlat)&&(this.map)){var a=this.map.getLayerPxFromLonLat(this.lonlat);this.moveTo(a)}},calculateRelativePosition:function(b){var d=this.map.getLonLatFromLayerPx(b);var c=this.map.getExtent();var a=c.determineQuadrant(d);return OpenLayers.Bounds.oppositeQuadrant(a)},updateRelativePosition:function(){},calculateNewPx:function(b){var f=b.offset(this.anchor.offset);var a=this.size||this.contentSize;var d=(this.relativePosition.charAt(0)=="t");f.y+=(d)?-a.h:this.anchor.size.h;var c=(this.relativePosition.charAt(1)=="l");f.x+=(c)?-a.w:this.anchor.size.w;return f},CLASS_NAME:"OpenLayers.Popup.Anchored"});OpenLayers.Protocol.WFS=function(b){b=OpenLayers.Util.applyDefaults(b,OpenLayers.Protocol.WFS.DEFAULTS);var a=OpenLayers.Protocol.WFS["v"+b.version.replace(/\./g,"_")];if(!a){throw"Unsupported WFS version: "+b.version}return new a(b)};OpenLayers.Protocol.WFS.fromWMSLayer=function(d,c){var a,f;var h=d.params.LAYERS;var g=(h instanceof Array?h[0]:h).split(":");if(g.length>1){f=g[0]}a=g.pop();var b={url:d.url,featureType:a,featurePrefix:f,srsName:d.projection&&d.projection.getCode()||d.map&&d.map.getProjectionObject().getCode(),version:"1.1.0"};return new OpenLayers.Protocol.WFS(OpenLayers.Util.applyDefaults(c,b))};OpenLayers.Protocol.WFS.DEFAULTS={version:"1.0.0"};OpenLayers.Renderer.Canvas=OpenLayers.Class(OpenLayers.Renderer,{canvas:null,features:null,geometryMap:null,initialize:function(a){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.root=document.createElement("canvas");this.container.appendChild(this.root);this.canvas=this.root.getContext("2d");this.features={};this.geometryMap={}},eraseGeometry:function(a){this.eraseFeatures(this.features[this.geometryMap[a.id]][0])},supported:function(){var a=document.createElement("canvas");return !!a.getContext},setExtent:function(a){this.extent=a.clone();this.resolution=null;this.redraw()},setSize:function(a){this.size=a.clone();this.root.style.width=a.w+"px";this.root.style.height=a.h+"px";this.root.width=a.w;this.root.height=a.h;this.resolution=null},drawFeature:function(a,b){if(b==null){b=a.style}b=OpenLayers.Util.extend({fillColor:"#000000",strokeColor:"#000000",strokeWidth:2,fillOpacity:1,strokeOpacity:1},b);this.features[a.id]=[a,b];if(a.geometry){this.geometryMap[a.geometry.id]=a.id}this.redraw()},drawGeometry:function(d,c){var b=d.CLASS_NAME;if((b=="OpenLayers.Geometry.Collection")||(b=="OpenLayers.Geometry.MultiPoint")||(b=="OpenLayers.Geometry.MultiLineString")||(b=="OpenLayers.Geometry.MultiPolygon")){for(var a=0;a<d.components.length;a++){this.drawGeometry(d.components[a],c)}return}switch(d.CLASS_NAME){case"OpenLayers.Geometry.Point":this.drawPoint(d,c);break;case"OpenLayers.Geometry.LineString":this.drawLineString(d,c);break;case"OpenLayers.Geometry.LinearRing":this.drawLinearRing(d,c);break;case"OpenLayers.Geometry.Polygon":this.drawPolygon(d,c);break;default:break}},drawExternalGraphic:function(l,a){var f=new Image();f.src=a.externalGraphic;if(a.graphicTitle){f.title=a.graphicTitle}var c=a.graphicWidth||a.graphicHeight;var k=a.graphicHeight||a.graphicWidth;c=c?c:a.pointRadius*2;k=k?k:a.pointRadius*2;var h=(a.graphicXOffset!=undefined)?a.graphicXOffset:-(0.5*c);var d=(a.graphicYOffset!=undefined)?a.graphicYOffset:-(0.5*k);var g=a.graphicOpacity||a.fillOpacity;var b={img:f,x:(l[0]+h),y:(l[1]+d),width:c,height:k,canvas:this.canvas};f.onload=OpenLayers.Function.bind(function(){this.canvas.drawImage(this.img,this.x,this.y,this.width,this.height)},b)},setCanvasStyle:function(b,a){if(b=="fill"){this.canvas.globalAlpha=a.fillOpacity;this.canvas.fillStyle=a.fillColor}else{if(b=="stroke"){this.canvas.globalAlpha=a.strokeOpacity;this.canvas.strokeStyle=a.strokeColor;this.canvas.lineWidth=a.strokeWidth}else{this.canvas.globalAlpha=0;this.canvas.lineWidth=1}}},drawPoint:function(c,a){if(a.graphic!==false){var b=this.getLocalXY(c);if(a.externalGraphic){this.drawExternalGraphic(b,a)}else{if(a.fill!==false){this.setCanvasStyle("fill",a);this.canvas.beginPath();this.canvas.arc(b[0],b[1],6,0,Math.PI*2,true);this.canvas.fill()}if(a.stroke!==false){this.setCanvasStyle("stroke",a);this.canvas.beginPath();this.canvas.arc(b[0],b[1],6,0,Math.PI*2,true);this.canvas.stroke();this.setCanvasStyle("reset")}}}},drawLineString:function(d,b){if(b.stroke!==false){this.setCanvasStyle("stroke",b);this.canvas.beginPath();var f=this.getLocalXY(d.components[0]);this.canvas.moveTo(f[0],f[1]);for(var a=1;a<d.components.length;a++){var c=this.getLocalXY(d.components[a]);this.canvas.lineTo(c[0],c[1])}this.canvas.stroke()}this.setCanvasStyle("reset")},drawLinearRing:function(f,c){if(c.fill!==false){this.setCanvasStyle("fill",c);this.canvas.beginPath();var g=this.getLocalXY(f.components[0]);this.canvas.moveTo(g[0],g[1]);for(var b=1;b<f.components.length-1;b++){var d=this.getLocalXY(f.components[b]);this.canvas.lineTo(d[0],d[1])}this.canvas.fill()}if(c.stroke!==false){var a=this.canvas.lineWidth;this.setCanvasStyle("stroke",c);this.canvas.beginPath();var g=this.getLocalXY(f.components[0]);this.canvas.moveTo(g[0],g[1]);for(var b=1;b<f.components.length;b++){var d=this.getLocalXY(f.components[b]);this.canvas.lineTo(d[0],d[1])}this.canvas.stroke()}this.setCanvasStyle("reset")},drawPolygon:function(c,b){this.drawLinearRing(c.components[0],b);for(var a=1;a<c.components.length;a++){this.drawLinearRing(c.components[a],{fillOpacity:0,strokeWidth:0,strokeOpacity:0,strokeColor:"#000000",fillColor:"#000000"})}},drawText:function(b,d){d=OpenLayers.Util.extend({fontColor:"#000000",labelAlign:"cm"},d);var f=this.getLocalXY(b);this.setCanvasStyle("reset");this.canvas.fillStyle=d.fontColor;this.canvas.globalAlpha=1;var g=d.fontWeight+" "+d.fontSize+" "+d.fontFamily;if(this.canvas.fillText){var c=OpenLayers.Renderer.Canvas.LABEL_ALIGN[d.labelAlign[0]]||"middle";this.canvas.font=g;this.canvas.textAlign=c;this.canvas.fillText(d.label,f[0],f[1])}else{if(this.canvas.mozDrawText){this.canvas.mozTextStyle=g;var a=this.canvas.mozMeasureText(d.label);switch(d.labelAlign[0]){case"l":break;case"r":f[0]-=a;break;case"c":default:f[0]-=a/2}this.canvas.translate(f[0],f[1]);this.canvas.mozDrawText(d.label);this.canvas.translate(-1*f[0],-1*f[1])}}this.setCanvasStyle("reset")},getLocalXY:function(b){var c=this.getResolution();var d=this.extent;var a=(b.x/c+(-d.left/c));var f=((d.top/c)-b.y/c);return[a,f]},clear:function(){this.canvas.clearRect(0,0,this.root.width,this.root.height)},getFeatureIdFromEvent:function(a){var g=this.map.getLonLatFromPixel(a.xy);var b=this.getResolution();var f=new OpenLayers.Bounds(g.lon-b*5,g.lat-b*5,g.lon+b*5,g.lat+b*5);var c=f.toGeometry();for(var d in this.features){if(!this.features.hasOwnProperty(d)){continue}if(this.features[d][0].geometry.intersects(c)){return d}}return null},eraseFeatures:function(b){if(!(b instanceof Array)){b=[b]}for(var a=0;a<b.length;++a){delete this.features[b[a].id]}this.redraw()},redraw:function(){if(!this.locked){this.clear();var f=[];var b,c;for(var g in this.features){if(!this.features.hasOwnProperty(g)){continue}b=this.features[g][0];c=this.features[g][1];if(!b.geometry){continue}this.drawGeometry(b.geometry,c);if(c.label){f.push([b,c])}}var d;for(var a=0;len=f.length,a<len;++a){d=f[a];this.drawText(d[0].geometry.getCentroid(),d[1])}}},CLASS_NAME:"OpenLayers.Renderer.Canvas"});OpenLayers.Renderer.Canvas.LABEL_ALIGN={l:"left",r:"right"};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(c){if(this.exists(c)){this.remove(c)}var g=c.id;this.determineZIndex(c);var d=-1;var f=this.order.length;var a;while(f-d>1){a=parseInt((d+f)/2);var b=this.compare(this,c,OpenLayers.Util.getElement(this.order[a]));if(b>0){d=a}else{f=a}}this.order.splice(f,0,g);this.indices[g]=this.getZIndex(c);return this.getNextElement(f)},remove:function(b){var d=b.id;var a=OpenLayers.Util.indexOf(this.order,d);if(a>=0){this.order.splice(a,1);delete this.indices[d];if(this.order.length>0){var c=this.order[this.order.length-1];this.maxZIndex=this.indices[c]}else{this.maxZIndex=0}}},clear:function(){this.order=[];this.indices={};this.maxZIndex=0},exists:function(a){return(this.indices[a.id]!=null)},getZIndex:function(a){return a._style.graphicZIndex},determineZIndex:function(a){var b=a._style.graphicZIndex;if(b==null){b=this.maxZIndex;a._style.graphicZIndex=b}else{if(b>this.maxZIndex){this.maxZIndex=b}}},getNextElement:function(b){var a=b+1;if(a<this.order.length){var c=OpenLayers.Util.getElement(this.order[a]);if(c==undefined){c=this.getNextElement(a)}return c}else{return null}},CLASS_NAME:"OpenLayers.ElementsIndexer"});OpenLayers.ElementsIndexer.IndexingMethods={Z_ORDER:function(f,d,b){var a=f.getZIndex(d);var g=0;if(b){var c=f.getZIndex(b);g=a-c}return g},Z_ORDER_DRAWING_ORDER:function(c,b,a){var d=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(c,b,a);if(a&&d==0){d=1}return d},Z_ORDER_Y_ORDER:function(g,f,b){var h=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(g,f,b);if(b&&h==0){var c=f._geometry.getBounds().bottom;var d=b._geometry.getBounds().bottom;var a=d-c;h=(a==0)?1:a}return h}};OpenLayers.Renderer.Elements=OpenLayers.Class(OpenLayers.Renderer,{rendererRoot:null,root:null,vectorRoot:null,textRoot:null,xmlns:null,indexer:null,BACKGROUND_ID_SUFFIX:"_background",LABEL_ID_SUFFIX:"_label",minimumSymbolizer:{strokeLinecap:"round",strokeOpacity:1,strokeDashstyle:"solid",fillOpacity:1,pointRadius:0},initialize:function(a,b){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.rendererRoot=this.createRenderRoot();this.root=this.createRoot("_root");this.vectorRoot=this.createRoot("_vroot");this.textRoot=this.createRoot("_troot");this.root.appendChild(this.vectorRoot);this.root.appendChild(this.textRoot);this.rendererRoot.appendChild(this.root);this.container.appendChild(this.rendererRoot);if(b&&(b.zIndexing||b.yOrdering)){this.indexer=new OpenLayers.ElementsIndexer(b.yOrdering)}},destroy:function(){this.clear();this.rendererRoot=null;this.root=null;this.xmlns=null;OpenLayers.Renderer.prototype.destroy.apply(this,arguments)},clear:function(){if(this.vectorRoot){while(this.vectorRoot.childNodes.length>0){this.vectorRoot.removeChild(this.vectorRoot.firstChild)}}if(this.textRoot){while(this.textRoot.childNodes.length>0){this.textRoot.removeChild(this.textRoot.firstChild)}}if(this.indexer){this.indexer.clear()}},getNodeType:function(b,a){},drawGeometry:function(h,d,g){var c=h.CLASS_NAME;var k=true;if((c=="OpenLayers.Geometry.Collection")||(c=="OpenLayers.Geometry.MultiPoint")||(c=="OpenLayers.Geometry.MultiLineString")||(c=="OpenLayers.Geometry.MultiPolygon")){for(var b=0,a=h.components.length;b<a;b++){k=this.drawGeometry(h.components[b],d,g)&&k}return k}k=false;if(d.display!="none"){if(d.backgroundGraphic){this.redrawBackgroundNode(h.id,h,d,g)}k=this.redrawNode(h.id,h,d,g)}if(k==false){var f=document.getElementById(h.id);if(f){if(f._style.backgroundGraphic){f.parentNode.removeChild(document.getElementById(h.id+this.BACKGROUND_ID_SUFFIX))}f.parentNode.removeChild(f)}}return k},redrawNode:function(h,g,b,f){var c=this.nodeFactory(h,this.getNodeType(g,b));c._featureId=f;c._geometry=g;c._geometryClass=g.CLASS_NAME;c._style=b;var a=this.drawGeometryNode(c,g,b);if(a===false){return false}c=a.node;if(this.indexer){var d=this.indexer.insert(c);if(d){this.vectorRoot.insertBefore(c,d)}else{this.vectorRoot.appendChild(c)}}else{if(c.parentNode!==this.vectorRoot){this.vectorRoot.appendChild(c)}}this.postDraw(c);return a.complete},redrawBackgroundNode:function(f,d,b,c){var a=OpenLayers.Util.extend({},b);a.externalGraphic=a.backgroundGraphic;a.graphicXOffset=a.backgroundXOffset;a.graphicYOffset=a.backgroundYOffset;a.graphicZIndex=a.backgroundGraphicZIndex;a.graphicWidth=a.backgroundWidth||a.graphicWidth;a.graphicHeight=a.backgroundHeight||a.graphicHeight;a.backgroundGraphic=null;a.backgroundXOffset=null;a.backgroundYOffset=null;a.backgroundGraphicZIndex=null;return this.redrawNode(f+this.BACKGROUND_ID_SUFFIX,d,a,null)},drawGeometryNode:function(c,f,b){b=b||c._style;OpenLayers.Util.applyDefaults(b,this.minimumSymbolizer);var a={isFilled:b.fill===undefined?true:b.fill,isStroked:b.stroke===undefined?!!b.strokeWidth:b.stroke};var d;switch(f.CLASS_NAME){case"OpenLayers.Geometry.Point":if(b.graphic===false){a.isFilled=false;a.isStroked=false}d=this.drawPoint(c,f);break;case"OpenLayers.Geometry.LineString":a.isFilled=false;d=this.drawLineString(c,f);break;case"OpenLayers.Geometry.LinearRing":d=this.drawLinearRing(c,f);break;case"OpenLayers.Geometry.Polygon":d=this.drawPolygon(c,f);break;case"OpenLayers.Geometry.Surface":d=this.drawSurface(c,f);break;case"OpenLayers.Geometry.Rectangle":d=this.drawRectangle(c,f);break;default:break}c._style=b;c._options=a;if(d!=false){return{node:this.setStyle(c,b,a,f),complete:d}}else{return false}},postDraw:function(a){},drawPoint:function(a,b){},drawLineString:function(a,b){},drawLinearRing:function(a,b){},drawPolygon:function(a,b){},drawRectangle:function(a,b){},drawCircle:function(a,b){},drawSurface:function(a,b){},removeText:function(b){var a=document.getElementById(b+this.LABEL_ID_SUFFIX);if(a){this.textRoot.removeChild(a)}},getFeatureIdFromEvent:function(a){var d=a.target;var b=d&&d.correspondingUseElement;var c=b?b:(d||a.srcElement);var f=c._featureId;return f},eraseGeometry:function(g){if((g.CLASS_NAME=="OpenLayers.Geometry.MultiPoint")||(g.CLASS_NAME=="OpenLayers.Geometry.MultiLineString")||(g.CLASS_NAME=="OpenLayers.Geometry.MultiPolygon")||(g.CLASS_NAME=="OpenLayers.Geometry.Collection")){for(var d=0,a=g.components.length;d<a;d++){this.eraseGeometry(g.components[d])}}else{var c=OpenLayers.Util.getElement(g.id);if(c&&c.parentNode){if(c.geometry){c.geometry.destroy();c.geometry=null}c.parentNode.removeChild(c);if(this.indexer){this.indexer.remove(c)}if(c._style.backgroundGraphic){var b=g.id+this.BACKGROUND_ID_SUFFIX;var f=OpenLayers.Util.getElement(b);if(f&&f.parentNode){f.parentNode.removeChild(f)}}}}},nodeFactory:function(c,a){var b=OpenLayers.Util.getElement(c);if(b){if(!this.nodeTypeCompare(b,a)){b.parentNode.removeChild(b);b=this.nodeFactory(c,a)}}else{b=this.createNode(a,c)}return b},nodeTypeCompare:function(b,a){},createNode:function(a,b){},moveRoot:function(b){var a=this.root;if(b.root.parentNode==this.rendererRoot){a=b.root}a.parentNode.removeChild(a);b.rendererRoot.appendChild(a)},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.Strategy.Cluster=OpenLayers.Class(OpenLayers.Strategy,{distance:20,threshold:null,features:null,clusters:null,clustering:false,resolution:null,initialize:function(a){OpenLayers.Strategy.prototype.initialize.apply(this,[a])},activate:function(){var a=OpenLayers.Strategy.prototype.activate.call(this);if(a){this.layer.events.on({beforefeaturesadded:this.cacheFeatures,moveend:this.cluster,scope:this})}return a},deactivate:function(){var a=OpenLayers.Strategy.prototype.deactivate.call(this);if(a){this.clearCache();this.layer.events.un({beforefeaturesadded:this.cacheFeatures,moveend:this.cluster,scope:this})}return a},cacheFeatures:function(b){var a=true;if(!this.clustering){this.clearCache();this.features=b.features;this.cluster();a=false}return a},clearCache:function(){this.features=null},cluster:function(a){if((!a||a.zoomChanged)&&this.features){var c=this.layer.map.getResolution();if(c!=this.resolution||!this.clustersExist()){this.resolution=c;var k=[];var p,b,l;for(var f=0;f<this.features.length;++f){p=this.features[f];if(p.geometry){b=false;for(var d=0;d<k.length;++d){l=k[d];if(this.shouldCluster(l,p)){this.addToCluster(l,p);b=true;break}}if(!b){k.push(this.createCluster(this.features[f]))}}}this.layer.destroyFeatures();if(k.length>0){if(this.threshold>1){var h=k.slice();k=[];var o;for(var f=0,g=h.length;f<g;++f){o=h[f];if(o.attributes.count<this.threshold){Array.prototype.push.apply(k,o.cluster)}else{k.push(o)}}}this.clustering=true;this.layer.addFeatures(k);this.clustering=false}this.clusters=k}}},clustersExist:function(){var b=false;if(this.clusters&&this.clusters.length>0&&this.clusters.length==this.layer.features.length){b=true;for(var a=0;a<this.clusters.length;++a){if(this.clusters[a]!=this.layer.features[a]){b=false;break}}}return b},shouldCluster:function(a,b){var f=a.geometry.getBounds().getCenterLonLat();var c=b.geometry.getBounds().getCenterLonLat();var d=(Math.sqrt(Math.pow((f.lon-c.lon),2)+Math.pow((f.lat-c.lat),2))/this.resolution);return(d<=this.distance)},addToCluster:function(a,b){a.cluster.push(b);a.attributes.count+=1},createCluster:function(c){var b=c.geometry.getBounds().getCenterLonLat();var a=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(b.lon,b.lat),{count:1});a.cluster=[c];return a},CLASS_NAME:"OpenLayers.Strategy.Cluster"});OpenLayers.Strategy.Fixed=OpenLayers.Class(OpenLayers.Strategy,{preload:false,initialize:function(a){OpenLayers.Strategy.prototype.initialize.apply(this,[a])},destroy:function(){OpenLayers.Strategy.prototype.destroy.apply(this,arguments)},activate:function(){if(OpenLayers.Strategy.prototype.activate.apply(this,arguments)){this.layer.events.on({refresh:this.load,scope:this});if(this.layer.visibility==true||this.preload){this.load()}else{this.layer.events.on({visibilitychanged:this.load,scope:this})}return true}return false},deactivate:function(){var a=OpenLayers.Strategy.prototype.deactivate.call(this);if(a){this.layer.events.un({refresh:this.load,visibilitychanged:this.load,scope:this})}return a},load:function(a){this.layer.events.triggerEvent("loadstart");this.layer.protocol.read(OpenLayers.Util.applyDefaults({callback:this.merge,scope:this},a));this.layer.events.un({visibilitychanged:this.load,scope:this})},merge:function(h){this.layer.destroyFeatures();var f=h.features;if(f&&f.length>0){var g=this.layer.projection;var d=this.layer.map.getProjectionObject();if(!d.equals(g)){var c;for(var b=0,a=f.length;b<a;++b){c=f[b].geometry;if(c){c.transform(g,d)}}}this.layer.addFeatures(f)}this.layer.events.triggerEvent("loadend")},CLASS_NAME:"OpenLayers.Strategy.Fixed"});OpenLayers.Strategy.Paging=OpenLayers.Class(OpenLayers.Strategy,{features:null,length:10,num:null,paging:false,initialize:function(a){OpenLayers.Strategy.prototype.initialize.apply(this,[a])},activate:function(){var a=OpenLayers.Strategy.prototype.activate.call(this);if(a){this.layer.events.on({beforefeaturesadded:this.cacheFeatures,scope:this})}return a},deactivate:function(){var a=OpenLayers.Strategy.prototype.deactivate.call(this);if(a){this.clearCache();this.layer.events.un({beforefeaturesadded:this.cacheFeatures,scope:this})}return a},cacheFeatures:function(a){if(!this.paging){this.clearCache();this.features=a.features;this.pageNext(a)}},clearCache:function(){if(this.features){for(var a=0;a<this.features.length;++a){this.features[a].destroy()}}this.features=null;this.num=null},pageCount:function(){var a=this.features?this.features.length:0;return Math.ceil(a/this.length)},pageNum:function(){return this.num},pageLength:function(a){if(a&&a>0){this.length=a}return this.length},pageNext:function(a){var b=false;if(this.features){if(this.num===null){this.num=-1}var c=(this.num+1)*this.length;b=this.page(c,a)}return b},pagePrevious:function(){var a=false;if(this.features){if(this.num===null){this.num=this.pageCount()}var b=(this.num-1)*this.length;a=this.page(b)}return a},page:function(f,c){var d=false;if(this.features){if(f>=0&&f<this.features.length){var a=Math.floor(f/this.length);if(a!=this.num){this.paging=true;var b=this.features.slice(f,f+this.length);this.layer.removeFeatures(this.layer.features);this.num=a;if(c&&c.features){c.features=b}else{this.layer.addFeatures(b)}this.paging=false;d=true}}}return d},CLASS_NAME:"OpenLayers.Strategy.Paging"});OpenLayers.Strategy.Save=OpenLayers.Class(OpenLayers.Strategy,{auto:false,timer:null,initialize:function(a){OpenLayers.Strategy.prototype.initialize.apply(this,[a])},activate:function(){var a=OpenLayers.Strategy.prototype.activate.call(this);if(a){if(this.auto){if(typeof this.auto==="number"){this.timer=window.setInterval(OpenLayers.Function.bind(this.save,this),this.auto*1000)}else{this.layer.events.on({featureadded:this.triggerSave,afterfeaturemodified:this.triggerSave,scope:this})}}}return a},deactivate:function(){var a=OpenLayers.Strategy.prototype.deactivate.call(this);if(a){if(this.auto){if(typeof this.auto==="number"){window.clearInterval(this.timer)}else{this.layer.events.un({featureadded:this.triggerSave,afterfeaturemodified:this.triggerSave,scope:this})}}}return a},triggerSave:function(b){var a=b.feature;if(a.state===OpenLayers.State.INSERT||a.state===OpenLayers.State.UPDATE||a.state===OpenLayers.State.DELETE){this.save([b.feature])}},save:function(d){if(!d){d=this.layer.features}var g=this.layer.projection;var c=this.layer.map.getProjectionObject();if(!c.equals(g)){var a=d.length;var f=new Array(a);var k,h;for(var b=0;b<a;++b){k=d[b];h=k.clone();h.fid=k.fid;h.state=k.state;h._original=k;h.geometry.transform(c,g);f[b]=h}d=f}this.layer.protocol.commit(d,{callback:this.onCommit,scope:this})},onCommit:function(d){if(d.success()){var b=d.reqFeatures;var a,l;var c=[];var k=d.insertIds||[];var f=0;for(var g=0,h=b.length;g<h;++g){l=b[g];l=l._original||l;a=l.state;if(a){if(a==OpenLayers.State.DELETE){c.push(l)}else{if(a==OpenLayers.State.INSERT){l.fid=k[f];++f}}l.state=null}}if(c.length>0){this.layer.destroyFeatures(c)}}},CLASS_NAME:"OpenLayers.Strategy.Save"});OpenLayers.Tween=OpenLayers.Class({INTERVAL:10,easing:null,begin:null,finish:null,duration:null,callbacks:null,time:null,interval:null,playing:false,initialize:function(a){this.easing=(a)?a:OpenLayers.Easing.Expo.easeOut},start:function(c,b,d,a){this.playing=true;this.begin=c;this.finish=b;this.duration=d;this.callbacks=a.callbacks;this.time=0;if(this.interval){window.clearInterval(this.interval);this.interval=null}if(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){return}if(this.callbacks&&this.callbacks.done){this.callbacks.done.call(this,this.finish)}window.clearInterval(this.interval);this.interval=null;this.playing=false},play:function(){var h={};for(var d in this.begin){var a=this.begin[d];var g=this.finish[d];if(a==null||g==null||isNaN(a)||isNaN(g)){OpenLayers.Console.error("invalid value for Tween")}var k=g-a;h[d]=this.easing.apply(this,[this.time,a,k,this.duration])}this.time++;if(this.callbacks&&this.callbacks.eachStep){this.callbacks.eachStep.call(this,h)}if(this.time>this.duration){if(this.callbacks&&this.callbacks.done){this.callbacks.done.call(this,this.finish);this.playing=false}window.clearInterval(this.interval);this.interval=null}},CLASS_NAME:"OpenLayers.Tween"});OpenLayers.Easing={CLASS_NAME:"OpenLayers.Easing"};OpenLayers.Easing.Linear={easeIn:function(f,a,h,g){return h*f/g+a},easeOut:function(f,a,h,g){return h*f/g+a},easeInOut:function(f,a,h,g){return h*f/g+a},CLASS_NAME:"OpenLayers.Easing.Linear"};OpenLayers.Easing.Expo={easeIn:function(f,a,h,g){return(f==0)?a:h*Math.pow(2,10*(f/g-1))+a},easeOut:function(f,a,h,g){return(f==g)?a+h:h*(-Math.pow(2,-10*f/g)+1)+a},easeInOut:function(f,a,h,g){if(f==0){return a}if(f==g){return a+h}if((f/=g/2)<1){return h/2*Math.pow(2,10*(f-1))+a}return h/2*(-Math.pow(2,-10*--f)+2)+a},CLASS_NAME:"OpenLayers.Easing.Expo"};OpenLayers.Easing.Quad={easeIn:function(f,a,h,g){return h*(f/=g)*f+a},easeOut:function(f,a,h,g){return -h*(f/=g)*(f-2)+a},easeInOut:function(f,a,h,g){if((f/=g/2)<1){return h/2*f*f+a}return -h/2*((--f)*(f-2)-1)+a},CLASS_NAME:"OpenLayers.Easing.Quad"};OpenLayers.Control.Button=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){},CLASS_NAME:"OpenLayers.Control.Button"});OpenLayers.Control.MouseDefaults=OpenLayers.Class(OpenLayers.Control,{performedDrag:false,wheelObserver:null,initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){if(this.handler){this.handler.destroy()}this.handler=null;this.map.events.un({click:this.defaultClick,dblclick:this.defaultDblClick,mousedown:this.defaultMouseDown,mouseup:this.defaultMouseUp,mousemove:this.defaultMouseMove,mouseout:this.defaultMouseOut,scope:this});OpenLayers.Event.stopObserving(window,"DOMMouseScroll",this.wheelObserver);OpenLayers.Event.stopObserving(window,"mousewheel",this.wheelObserver);OpenLayers.Event.stopObserving(document,"mousewheel",this.wheelObserver);this.wheelObserver=null;OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(){this.map.events.on({click:this.defaultClick,dblclick:this.defaultDblClick,mousedown:this.defaultMouseDown,mouseup:this.defaultMouseUp,mousemove:this.defaultMouseMove,mouseout:this.defaultMouseOut,scope:this});this.registerWheelEvents()},registerWheelEvents:function(){this.wheelObserver=OpenLayers.Function.bindAsEventListener(this.onWheelEvent,this);OpenLayers.Event.observe(window,"DOMMouseScroll",this.wheelObserver);OpenLayers.Event.observe(window,"mousewheel",this.wheelObserver);OpenLayers.Event.observe(document,"mousewheel",this.wheelObserver)},defaultClick:function(b){if(!OpenLayers.Event.isLeftClick(b)){return}var a=!this.performedDrag;this.performedDrag=false;return a},defaultDblClick:function(b){var a=this.map.getLonLatFromViewPortPx(b.xy);this.map.setCenter(a,this.map.zoom+1);OpenLayers.Event.stop(b);return false},defaultMouseDown:function(a){if(!OpenLayers.Event.isLeftClick(a)){return}this.mouseDragStart=a.xy.clone();this.performedDrag=false;if(a.shiftKey){this.map.div.style.cursor="crosshair";this.zoomBox=OpenLayers.Util.createDiv("zoomBox",this.mouseDragStart,null,null,"absolute","2px solid red");this.zoomBox.style.backgroundColor="white";this.zoomBox.style.filter="alpha(opacity=50)";this.zoomBox.style.opacity="0.50";this.zoomBox.style.fontSize="1px";this.zoomBox.style.zIndex=this.map.Z_INDEX_BASE.Popup-1;this.map.viewPortDiv.appendChild(this.zoomBox)}document.onselectstart=function(){return false};OpenLayers.Event.stop(a)},defaultMouseMove:function(f){this.mousePosition=f.xy.clone();if(this.mouseDragStart!=null){if(this.zoomBox){var d=Math.abs(this.mouseDragStart.x-f.xy.x);var b=Math.abs(this.mouseDragStart.y-f.xy.y);this.zoomBox.style.width=Math.max(1,d)+"px";this.zoomBox.style.height=Math.max(1,b)+"px";if(f.xy.x<this.mouseDragStart.x){this.zoomBox.style.left=f.xy.x+"px"}if(f.xy.y<this.mouseDragStart.y){this.zoomBox.style.top=f.xy.y+"px"}}else{var d=this.mouseDragStart.x-f.xy.x;var b=this.mouseDragStart.y-f.xy.y;var g=this.map.getSize();var a=new OpenLayers.Pixel(g.w/2+d,g.h/2+b);var c=this.map.getLonLatFromViewPortPx(a);this.map.setCenter(c,null,true);this.mouseDragStart=f.xy.clone();this.map.div.style.cursor="move"}this.performedDrag=true}},defaultMouseUp:function(a){if(!OpenLayers.Event.isLeftClick(a)){return}if(this.zoomBox){this.zoomBoxEnd(a)}else{if(this.performedDrag){this.map.setCenter(this.map.center)}}document.onselectstart=null;this.mouseDragStart=null;this.map.div.style.cursor=""},defaultMouseOut:function(a){if(this.mouseDragStart!=null&&OpenLayers.Util.mouseLeft(a,this.map.div)){if(this.zoomBox){this.removeZoomBox()}this.mouseDragStart=null}},defaultWheelUp:function(a){if(this.map.getZoom()<=this.map.getNumZoomLevels()){this.map.setCenter(this.map.getLonLatFromPixel(a.xy),this.map.getZoom()+1)}},defaultWheelDown:function(a){if(this.map.getZoom()>0){this.map.setCenter(this.map.getLonLatFromPixel(a.xy),this.map.getZoom()-1)}},zoomBoxEnd:function(b){if(this.mouseDragStart!=null){if(Math.abs(this.mouseDragStart.x-b.xy.x)>5||Math.abs(this.mouseDragStart.y-b.xy.y)>5){var k=this.map.getLonLatFromViewPortPx(this.mouseDragStart);var a=this.map.getLonLatFromViewPortPx(b.xy);var h=Math.max(k.lat,a.lat);var c=Math.min(k.lat,a.lat);var g=Math.min(k.lon,a.lon);var d=Math.max(k.lon,a.lon);var f=new OpenLayers.Bounds(g,c,d,h);this.map.zoomToExtent(f)}else{var a=this.map.getLonLatFromViewPortPx(b.xy);this.map.setCenter(new OpenLayers.LonLat((a.lon),(a.lat)),this.map.getZoom()+1)}this.removeZoomBox()}},removeZoomBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox);this.zoomBox=null},onWheelEvent:function(c){var b=false;var a=OpenLayers.Event.element(c);while(a!=null){if(this.map&&a==this.map.div){b=true;break}a=a.parentNode}if(b){var d=0;if(!c){c=window.event}if(c.wheelDelta){d=c.wheelDelta/120;if(window.opera&&window.opera.version()<9.2){d=-d}}else{if(c.detail){d=-c.detail/3}}if(d){c.xy=this.mousePosition;if(d<0){this.defaultWheelDown(c)}else{this.defaultWheelUp(c)}}OpenLayers.Event.stop(c)}},CLASS_NAME:"OpenLayers.Control.MouseDefaults"});OpenLayers.Control.MousePosition=OpenLayers.Class(OpenLayers.Control,{element:null,prefix:"",separator:", ",suffix:"",numDigits:5,granularity:10,lastXy:null,displayProjection:null,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){if(this.map){this.map.events.unregister("mousemove",this,this.redraw)}OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.div.left="";this.div.top="";this.element=this.div}this.redraw();return this.div},redraw:function(a){var c;if(a==null){c=new OpenLayers.LonLat(0,0)}else{if(this.lastXy==null||Math.abs(a.xy.x-this.lastXy.x)>this.granularity||Math.abs(a.xy.y-this.lastXy.y)>this.granularity){this.lastXy=a.xy;return}c=this.map.getLonLatFromPixel(a.xy);if(!c){return}if(this.displayProjection){c.transform(this.map.getProjectionObject(),this.displayProjection)}this.lastXy=a.xy}var b=this.formatOutput(c);if(b!=this.element.innerHTML){this.element.innerHTML=b}},formatOutput:function(b){var c=parseInt(this.numDigits);var a=this.prefix+b.lon.toFixed(c)+this.separator+b.lat.toFixed(c)+this.suffix;return a},setMap:function(){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.map.events.register("mousemove",this,this.redraw)},CLASS_NAME:"OpenLayers.Control.MousePosition"});OpenLayers.Control.Pan=OpenLayers.Class(OpenLayers.Control,{slideFactor:50,direction:null,type:OpenLayers.Control.TYPE_BUTTON,initialize:function(b,a){this.direction=b;this.CLASS_NAME+=this.direction;OpenLayers.Control.prototype.initialize.apply(this,[a])},trigger:function(){switch(this.direction){case OpenLayers.Control.Pan.NORTH:this.map.pan(0,-this.slideFactor);break;case OpenLayers.Control.Pan.SOUTH:this.map.pan(0,this.slideFactor);break;case OpenLayers.Control.Pan.WEST:this.map.pan(-this.slideFactor,0);break;case OpenLayers.Control.Pan.EAST:this.map.pan(this.slideFactor,0);break}},CLASS_NAME:"OpenLayers.Control.Pan"});OpenLayers.Control.Pan.NORTH="North";OpenLayers.Control.Pan.SOUTH="South";OpenLayers.Control.Pan.EAST="East";OpenLayers.Control.Pan.WEST="West";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(){OpenLayers.Control.prototype.destroy.apply(this,arguments);this.removeButtons();this.buttons=null;this.position=null},draw:function(b){OpenLayers.Control.prototype.draw.apply(this,arguments);b=this.position;this.buttons=[];var c=new OpenLayers.Size(18,18);var a=new OpenLayers.Pixel(b.x+c.w/2,b.y);this._addButton("panup","north-mini.png",a,c);b.y=a.y+c.h;this._addButton("panleft","west-mini.png",b,c);this._addButton("panright","east-mini.png",b.add(c.w,0),c);this._addButton("pandown","south-mini.png",a.add(0,c.h*2),c);this._addButton("zoomin","zoom-plus-mini.png",a.add(0,c.h*3+5),c);this._addButton("zoomworld","zoom-world-mini.png",a.add(0,c.h*4+5),c);this._addButton("zoomout","zoom-minus-mini.png",a.add(0,c.h*5+5),c);return this.div},_addButton:function(a,d,l,h){var g=OpenLayers.Util.getImagesLocation()+d;var b=OpenLayers.Util.createAlphaImageDiv(this.id+"_"+a,l,h,g,"absolute");this.div.appendChild(b);OpenLayers.Event.observe(b,"mousedown",OpenLayers.Function.bindAsEventListener(this.buttonDown,b));OpenLayers.Event.observe(b,"dblclick",OpenLayers.Function.bindAsEventListener(this.doubleClick,b));OpenLayers.Event.observe(b,"click",OpenLayers.Function.bindAsEventListener(this.doubleClick,b));b.action=a;b.map=this.map;if(!this.slideRatio){var c=this.slideFactor;var f=function(){return c}}else{var k=this.slideRatio;var f=function(o){return this.map.getSize()[o]*k}}b.getSlideFactor=f;this.buttons.push(b);return b},_removeButton:function(a){OpenLayers.Event.stopObservingElement(a);a.map=null;this.div.removeChild(a);OpenLayers.Util.removeItem(this.buttons,a)},removeButtons:function(){for(var a=this.buttons.length-1;a>=0;--a){this._removeButton(this.buttons[a])}},doubleClick:function(a){OpenLayers.Event.stop(a);return false},buttonDown:function(a){if(!OpenLayers.Event.isLeftClick(a)){return}switch(this.action){case"panup":this.map.pan(0,-this.getSlideFactor("h"));break;case"pandown":this.map.pan(0,this.getSlideFactor("h"));break;case"panleft":this.map.pan(-this.getSlideFactor("w"),0);break;case"panright":this.map.pan(this.getSlideFactor("w"),0);break;case"zoomin":this.map.zoomIn();break;case"zoomout":this.map.zoomOut();break;case"zoomworld":this.map.zoomToMaxExtent();break}OpenLayers.Event.stop(a)},CLASS_NAME:"OpenLayers.Control.PanZoom"});OpenLayers.Control.PanZoom.X=4;OpenLayers.Control.PanZoom.Y=4;OpenLayers.Control.Panel=OpenLayers.Class(OpenLayers.Control,{controls:null,defaultControl:null,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,[a]);this.controls=[]},destroy:function(){OpenLayers.Control.prototype.destroy.apply(this,arguments);for(var a=this.controls.length-1;a>=0;a--){if(this.controls[a].events){this.controls[a].events.un({activate:this.redraw,deactivate:this.redraw,scope:this})}OpenLayers.Event.stopObservingElement(this.controls[a].panel_div);this.controls[a].panel_div=null}},activate:function(){if(OpenLayers.Control.prototype.activate.apply(this,arguments)){for(var b=0,a=this.controls.length;b<a;b++){if(this.controls[b]==this.defaultControl){this.controls[b].activate()}}this.redraw();return true}else{return false}},deactivate:function(){if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)){for(var b=0,a=this.controls.length;b<a;b++){this.controls[b].deactivate()}return true}else{return false}},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);for(var b=0,a=this.controls.length;b<a;b++){this.map.addControl(this.controls[b]);this.controls[b].deactivate();this.controls[b].events.on({activate:this.redraw,deactivate:this.redraw,scope:this})}this.activate();return this.div},redraw:function(){this.div.innerHTML="";if(this.active){for(var c=0,a=this.controls.length;c<a;c++){var b=this.controls[c].panel_div;if(this.controls[c].active){b.className=this.controls[c].displayClass+"ItemActive"}else{b.className=this.controls[c].displayClass+"ItemInactive"}this.div.appendChild(b)}}},activateControl:function(c){if(!this.active){return false}if(c.type==OpenLayers.Control.TYPE_BUTTON){c.trigger();this.redraw();return}if(c.type==OpenLayers.Control.TYPE_TOGGLE){if(c.active){c.deactivate()}else{c.activate()}this.redraw();return}for(var b=0,a=this.controls.length;b<a;b++){if(this.controls[b]!=c){if(this.controls[b].type!=OpenLayers.Control.TYPE_TOGGLE){this.controls[b].deactivate()}}}c.activate()},addControls:function(b){if(!(b instanceof Array)){b=[b]}this.controls=this.controls.concat(b);for(var d=0,a=b.length;d<a;d++){var c=document.createElement("div");var f=document.createTextNode(" ");b[d].panel_div=c;if(b[d].title!=""){b[d].panel_div.title=b[d].title}OpenLayers.Event.observe(b[d].panel_div,"click",OpenLayers.Function.bind(this.onClick,this,b[d]));OpenLayers.Event.observe(b[d].panel_div,"mousedown",OpenLayers.Function.bindAsEventListener(OpenLayers.Event.stop))}if(this.map){for(var d=0,a=b.length;d<a;d++){this.map.addControl(b[d]);b[d].deactivate();b[d].events.on({activate:this.redraw,deactivate:this.redraw,scope:this})}this.redraw()}},onClick:function(b,a){OpenLayers.Event.stop(a?a:window.event);this.activateControl(b)},getControlsBy:function(c,a){var d=(typeof a.test=="function");var b=OpenLayers.Array.filter(this.controls,function(f){return f[c]==a||(d&&a.test(f[c]))});return b},getControlsByName:function(a){return this.getControlsBy("name",a)},getControlsByClass:function(a){return this.getControlsBy("CLASS_NAME",a)},CLASS_NAME:"OpenLayers.Control.Panel"});OpenLayers.Control.Scale=OpenLayers.Class(OpenLayers.Control,{element:null,initialize:function(b,a){OpenLayers.Control.prototype.initialize.apply(this,[a]);this.element=OpenLayers.Util.getElement(b)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.element=document.createElement("div");this.div.appendChild(this.element)}this.map.events.register("moveend",this,this.updateScale);this.updateScale();return this.div},updateScale:function(){var a=this.map.getScale();if(!a){return}if(a>=9500&&a<=950000){a=Math.round(a/1000)+"K"}else{if(a>=950000){a=Math.round(a/1000000)+"M"}else{a=Math.round(a)}}this.element.innerHTML=OpenLayers.i18n("scale",{scaleDenom:a})},CLASS_NAME:"OpenLayers.Control.Scale"});OpenLayers.Control.ScaleLine=OpenLayers.Class(OpenLayers.Control,{maxWidth:100,topOutUnits:"km",topInUnits:"m",bottomOutUnits:"mi",bottomInUnits:"ft",eTop:null,eBottom:null,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,[a])},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.eTop){this.div.style.display="block";this.div.style.position="absolute";this.eTop=document.createElement("div");this.eTop.className=this.displayClass+"Top";var a=this.topInUnits.length;this.div.appendChild(this.eTop);if((this.topOutUnits=="")||(this.topInUnits=="")){this.eTop.style.visibility="hidden"}else{this.eTop.style.visibility="visible"}this.eBottom=document.createElement("div");this.eBottom.className=this.displayClass+"Bottom";this.div.appendChild(this.eBottom);if((this.bottomOutUnits=="")||(this.bottomInUnits=="")){this.eBottom.style.visibility="hidden"}else{this.eBottom.style.visibility="visible"}}this.map.events.register("moveend",this,this.update);this.update();return this.div},getBarLen:function(b){var d=parseInt(Math.log(b)/Math.log(10));var a=Math.pow(10,d);var c=parseInt(b/a);var f;if(c>5){f=5}else{if(c>2){f=2}else{f=1}}return f*a},update:function(){var k=this.map.getResolution();if(!k){return}var q=this.map.getUnits();var c=OpenLayers.INCHES_PER_UNIT;var l=this.maxWidth*k*c[q];var a;var d;if(l>100000){a=this.topOutUnits;d=this.bottomOutUnits}else{a=this.topInUnits;d=this.bottomInUnits}var g=l/c[a];var o=l/c[d];var h=this.getBarLen(g);var f=this.getBarLen(o);g=h/c[q]*c[a];o=f/c[q]*c[d];var b=g/k;var p=o/k;if(this.eBottom.style.visibility=="visible"){this.eBottom.style.width=Math.round(p)+"px";this.eBottom.innerHTML=f+" "+d}if(this.eTop.style.visibility=="visible"){this.eTop.style.width=Math.round(b)+"px";this.eTop.innerHTML=h+" "+a}},CLASS_NAME:"OpenLayers.Control.ScaleLine"});OpenLayers.Control.ZoomIn=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){this.map.zoomIn()},CLASS_NAME:"OpenLayers.Control.ZoomIn"});OpenLayers.Control.ZoomOut=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){this.map.zoomOut()},CLASS_NAME:"OpenLayers.Control.ZoomOut"});OpenLayers.Event={observers:false,KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(a){return a.target||a.srcElement},isLeftClick:function(a){return(((a.which)&&(a.which==1))||((a.button)&&(a.button==1)))},isRightClick:function(a){return(((a.which)&&(a.which==3))||((a.button)&&(a.button==2)))},stop:function(b,a){if(!a){if(b.preventDefault){b.preventDefault()}else{b.returnValue=false}}if(b.stopPropagation){b.stopPropagation()}else{b.cancelBubble=true}},findElement:function(c,b){var a=OpenLayers.Event.element(c);while(a.parentNode&&(!a.tagName||(a.tagName.toUpperCase()!=b.toUpperCase()))){a=a.parentNode}return a},observe:function(b,d,c,a){var f=OpenLayers.Util.getElement(b);a=a||false;if(d=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||f.attachEvent)){d="keydown"}if(!this.observers){this.observers={}}if(!f._eventCacheID){var g="eventCacheID_";if(f.id){g=f.id+"_"+g}f._eventCacheID=OpenLayers.Util.createUniqueID(g)}var h=f._eventCacheID;if(!this.observers[h]){this.observers[h]=[]}this.observers[h].push({element:f,name:d,observer:c,useCapture:a});if(f.addEventListener){f.addEventListener(d,c,a)}else{if(f.attachEvent){f.attachEvent("on"+d,c)}}},stopObservingElement:function(a){var b=OpenLayers.Util.getElement(a);var c=b._eventCacheID;this._removeElementObservers(OpenLayers.Event.observers[c])},_removeElementObservers:function(f){if(f){for(var b=f.length-1;b>=0;b--){var c=f[b];var a=new Array(c.element,c.name,c.observer,c.useCapture);var d=OpenLayers.Event.stopObserving.apply(this,a)}}},stopObserving:function(k,a,h,b){b=b||false;var g=OpenLayers.Util.getElement(k);var d=g._eventCacheID;if(a=="keypress"){if(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||g.detachEvent){a="keydown"}}var o=false;var c=OpenLayers.Event.observers[d];if(c){var f=0;while(!o&&f<c.length){var l=c[f];if((l.name==a)&&(l.observer==h)&&(l.useCapture==b)){c.splice(f,1);if(c.length==0){delete OpenLayers.Event.observers[d]}o=true;break}f++}}if(o){if(g.removeEventListener){g.removeEventListener(a,h,b)}else{if(g&&g.detachEvent){g.detachEvent("on"+a,h)}}}return o},unloadCache:function(){if(OpenLayers.Event&&OpenLayers.Event.observers){for(var a in OpenLayers.Event.observers){var b=OpenLayers.Event.observers[a];OpenLayers.Event._removeElementObservers.apply(this,[b])}OpenLayers.Event.observers=false}},CLASS_NAME:"OpenLayers.Event"};OpenLayers.Event.observe(window,"unload",OpenLayers.Event.unloadCache,false);if(window.Event){OpenLayers.Util.applyDefaults(window.Event,OpenLayers.Event)}else{var Event=OpenLayers.Event}OpenLayers.Events=OpenLayers.Class({BROWSER_EVENTS:["mouseover","mouseout","mousedown","mouseup","mousemove","click","dblclick","rightclick","dblrightclick","resize","focus","blur"],listeners:null,object:null,element:null,eventTypes:null,eventHandler:null,fallThrough:null,includeXY:false,clearMouseListener:null,initialize:function(c,f,h,g,b){OpenLayers.Util.extend(this,b);this.object=c;this.fallThrough=g;this.listeners={};this.eventHandler=OpenLayers.Function.bindAsEventListener(this.handleBrowserEvent,this);this.clearMouseListener=OpenLayers.Function.bind(this.clearMouseCache,this);this.eventTypes=[];if(h!=null){for(var d=0,a=h.length;d<a;d++){this.addEventType(h[d])}}if(f!=null){this.attachToElement(f)}},destroy:function(){if(this.element){OpenLayers.Event.stopObservingElement(this.element);if(this.element.hasScrollEvent){OpenLayers.Event.stopObserving(window,"scroll",this.clearMouseListener)}}this.element=null;this.listeners=null;this.object=null;this.eventTypes=null;this.fallThrough=null;this.eventHandler=null},addEventType:function(a){if(!this.listeners[a]){this.eventTypes.push(a);this.listeners[a]=[]}},attachToElement:function(d){if(this.element){OpenLayers.Event.stopObservingElement(this.element)}this.element=d;for(var c=0,a=this.BROWSER_EVENTS.length;c<a;c++){var b=this.BROWSER_EVENTS[c];this.addEventType(b);OpenLayers.Event.observe(d,b,this.eventHandler)}OpenLayers.Event.observe(d,"dragstart",OpenLayers.Event.stop)},on:function(a){for(var b in a){if(b!="scope"){this.register(b,a.scope,a[b])}}},register:function(b,d,c){if((c!=null)&&(OpenLayers.Util.indexOf(this.eventTypes,b)!=-1)){if(d==null){d=this.object}var a=this.listeners[b];a.push({obj:d,func:c})}},registerPriority:function(b,d,c){if(c!=null){if(d==null){d=this.object}var a=this.listeners[b];if(a!=null){a.unshift({obj:d,func:c})}}},un:function(a){for(var b in a){if(b!="scope"){this.unregister(b,a.scope,a[b])}}},unregister:function(d,g,f){if(g==null){g=this.object}var c=this.listeners[d];if(c!=null){for(var b=0,a=c.length;b<a;b++){if(c[b].obj==g&&c[b].func==f){c.splice(b,1);break}}}},remove:function(a){if(this.listeners[a]!=null){this.listeners[a]=[]}},triggerEvent:function(f,b){var d=this.listeners[f];if(!d||d.length==0){return}if(b==null){b={}}b.object=this.object;b.element=this.element;if(!b.type){b.type=f}var d=d.slice(),g;for(var c=0,a=d.length;c<a;c++){var h=d[c];g=h.func.apply(h.obj,[b]);if((g!=undefined)&&(g==false)){break}}if(!this.fallThrough){OpenLayers.Event.stop(b,true)}return g},handleBrowserEvent:function(a){if(this.includeXY){a.xy=this.getMousePosition(a)}this.triggerEvent(a.type,a)},clearMouseCache:function(){this.element.scrolls=null;this.element.lefttop=null;this.element.offsets=null},getMousePosition:function(a){if(!this.includeXY){this.clearMouseCache()}else{if(!this.element.hasScrollEvent){OpenLayers.Event.observe(window,"scroll",this.clearMouseListener);this.element.hasScrollEvent=true}}if(!this.element.scrolls){this.element.scrolls=[(document.documentElement.scrollLeft||document.body.scrollLeft),(document.documentElement.scrollTop||document.body.scrollTop)]}if(!this.element.lefttop){this.element.lefttop=[(document.documentElement.clientLeft||0),(document.documentElement.clientTop||0)]}if(!this.element.offsets){this.element.offsets=OpenLayers.Util.pagePosition(this.element);this.element.offsets[0]+=this.element.scrolls[0];this.element.offsets[1]+=this.element.scrolls[1]}return new OpenLayers.Pixel((a.clientX+this.element.scrolls[0])-this.element.offsets[0]-this.element.lefttop[0],(a.clientY+this.element.scrolls[1])-this.element.offsets[1]-this.element.lefttop[1])},CLASS_NAME:"OpenLayers.Events"});OpenLayers.Format=OpenLayers.Class({options:null,externalProjection:null,internalProjection:null,data:null,keepData:false,initialize:function(a){OpenLayers.Util.extend(this,a);this.options=a},destroy:function(){},read:function(a){OpenLayers.Console.userError(OpenLayers.i18n("readNotImplemented"))},write:function(a){OpenLayers.Console.userError(OpenLayers.i18n("writeNotImplemented"))},CLASS_NAME:"OpenLayers.Format"});OpenLayers.Popup.AnchoredBubble=OpenLayers.Class(OpenLayers.Popup.Anchored,{rounded:false,initialize:function(h,c,g,b,a,f,d){this.padding=new OpenLayers.Bounds(0,OpenLayers.Popup.AnchoredBubble.CORNER_SIZE,0,OpenLayers.Popup.AnchoredBubble.CORNER_SIZE);OpenLayers.Popup.Anchored.prototype.initialize.apply(this,arguments)},draw:function(a){OpenLayers.Popup.Anchored.prototype.draw.apply(this,arguments);this.setContentHTML();this.setBackgroundColor();this.setOpacity();return this.div},updateRelativePosition:function(){this.setRicoCorners()},setSize:function(a){OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments);this.setRicoCorners()},setBackgroundColor:function(a){if(a!=undefined){this.backgroundColor=a}if(this.div!=null){if(this.contentDiv!=null){this.div.style.background="transparent";OpenLayers.Rico.Corner.changeColor(this.groupDiv,this.backgroundColor)}}},setOpacity:function(a){OpenLayers.Popup.Anchored.prototype.setOpacity.call(this,a);if(this.div!=null){if(this.groupDiv!=null){OpenLayers.Rico.Corner.changeOpacity(this.groupDiv,this.opacity)}}},setBorder:function(a){this.border=0},setRicoCorners:function(){var a=this.getCornersToRound(this.relativePosition);var b={corners:a,color:this.backgroundColor,bgColor:"transparent",blend:false};if(!this.rounded){OpenLayers.Rico.Corner.round(this.div,b);this.rounded=true}else{OpenLayers.Rico.Corner.reRound(this.groupDiv,b);this.setBackgroundColor();this.setOpacity()}},getCornersToRound:function(){var a=["tl","tr","bl","br"];var b=OpenLayers.Bounds.oppositeQuadrant(this.relativePosition);OpenLayers.Util.removeItem(a,b);return a.join(" ")},CLASS_NAME:"OpenLayers.Popup.AnchoredBubble"});OpenLayers.Popup.AnchoredBubble.CORNER_SIZE=5;OpenLayers.Popup.Framed=OpenLayers.Class(OpenLayers.Popup.Anchored,{imageSrc:null,imageSize:null,isAlphaImage:false,positionBlocks:null,blocks:null,fixedRelativePosition:false,initialize:function(h,c,g,b,a,f,d){OpenLayers.Popup.Anchored.prototype.initialize.apply(this,arguments);if(this.fixedRelativePosition){this.updateRelativePosition();this.calculateRelativePosition=function(k){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.imageSrc=null;this.imageSize=null;this.isAlphaImage=null;this.fixedRelativePosition=false;this.positionBlocks=null;for(var a=0;a<this.blocks.length;a++){var b=this.blocks[a];if(b.image){b.div.removeChild(b.image)}b.image=null;if(b.div){this.groupDiv.removeChild(b.div)}b.div=null}this.blocks=null;OpenLayers.Popup.Anchored.prototype.destroy.apply(this,arguments)},setBackgroundColor:function(a){},setBorder:function(){},setOpacity:function(a){},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);b=b.offset(this.positionBlocks[this.relativePosition].offset);return b},createBlocks:function(){this.blocks=[];var g=null;for(var f in this.positionBlocks){g=f;break}var a=this.positionBlocks[g];for(var d=0;d<a.blocks.length;d++){var k={};this.blocks.push(k);var b=this.id+"_FrameDecorationDiv_"+d;k.div=OpenLayers.Util.createDiv(b,null,null,null,"absolute",null,"hidden",null);var c=this.id+"_FrameDecorationImg_"+d;var h=(this.isAlphaImage)?OpenLayers.Util.createAlphaImageDiv:OpenLayers.Util.createImage;k.image=h(c,null,this.imageSize,this.imageSrc,"absolute",null,null,null);k.div.appendChild(k.image);this.groupDiv.appendChild(k.div)}},updateBlocks:function(){if(!this.blocks){this.createBlocks()}if(this.size&&this.relativePosition){var o=this.positionBlocks[this.relativePosition];for(var g=0;g<o.blocks.length;g++){var c=o.blocks[g];var f=this.blocks[g];var d=c.anchor.left;var p=c.anchor.bottom;var a=c.anchor.right;var s=c.anchor.top;var q=(isNaN(c.size.w))?this.size.w-(a+d):c.size.w;var k=(isNaN(c.size.h))?this.size.h-(p+s):c.size.h;f.div.style.width=(q<0?0:q)+"px";f.div.style.height=(k<0?0:k)+"px";f.div.style.left=(d!=null)?d+"px":"";f.div.style.bottom=(p!=null)?p+"px":"";f.div.style.right=(a!=null)?a+"px":"";f.div.style.top=(s!=null)?s+"px":"";f.image.style.left=c.position.x+"px";f.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.Projection=OpenLayers.Class({proj:null,projCode:null,initialize:function(b,a){OpenLayers.Util.extend(this,a);this.projCode=b;if(window.Proj4js){this.proj=new Proj4js.Proj(b)}},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){if(a&&a.getCode){return this.getCode()==a.getCode()}else{return false}},destroy:function(){delete this.proj;delete this.projCode},CLASS_NAME:"OpenLayers.Projection"});OpenLayers.Projection.transforms={};OpenLayers.Projection.addTransform=function(c,b,a){if(!OpenLayers.Projection.transforms[c]){OpenLayers.Projection.transforms[c]={}}OpenLayers.Projection.transforms[c][b]=a};OpenLayers.Projection.transform=function(a,c,b){if(c.proj&&b.proj){a=Proj4js.transform(c.proj,b.proj,a)}else{if(c&&b&&OpenLayers.Projection.transforms[c.getCode()]&&OpenLayers.Projection.transforms[c.getCode()][b.getCode()]){OpenLayers.Projection.transforms[c.getCode()][b.getCode()](a)}}return a};OpenLayers.Protocol.WFS.v1=OpenLayers.Class(OpenLayers.Protocol,{version:null,srsName:"EPSG:4326",featureType:null,featureNS:null,geometryName:"the_geom",schema:null,featurePrefix:"feature",formatOptions:null,initialize:function(b){OpenLayers.Protocol.prototype.initialize.apply(this,[b]);if(!b.format){this.format=OpenLayers.Format.WFST(OpenLayers.Util.extend({version:this.version,featureType:this.featureType,featureNS:this.featureNS,featurePrefix:this.featurePrefix,geometryName:this.geometryName,srsName:this.srsName,schema:this.schema},this.formatOptions))}if(!this.featureNS){var a=this.format.readNode;this.format.readNode=function(c,d){if(!this.featureNS&&c.prefix==this.featurePrefix){this.featureNS=c.namespaceURI;this.setNamespace("feature",this.featureNS)}return a.apply(this,arguments)}}},destroy:function(){if(this.options&&!this.options.format){this.format.destroy()}this.format=null;OpenLayers.Protocol.prototype.destroy.apply(this)},createCallback:function(c,a,b){return OpenLayers.Function.bind(function(){c.apply(this,[a,b])},this)},read:function(b){b=OpenLayers.Util.extend({},b);OpenLayers.Util.applyDefaults(b,this.options||{});var a=new OpenLayers.Protocol.Response({requestType:"read"});var c=OpenLayers.Format.XML.prototype.write.apply(this.format,[this.format.writeNode("wfs:GetFeature",b)]);a.priv=OpenLayers.Request.POST({url:b.url,callback:this.createCallback(this.handleRead,a,b),params:b.params,headers:b.headers,data:c});return a},handleRead:function(a,b){if(b.callback){var c=a.priv;if(c.status>=200&&c.status<300){a.features=this.parseFeatures(c);a.code=OpenLayers.Protocol.Response.SUCCESS}else{a.code=OpenLayers.Protocol.Response.FAILURE}b.callback.call(b.scope,a)}},parseFeatures:function(a){var b=a.responseXML;if(!b||!b.documentElement){b=a.responseText}if(!b||b.length<=0){return null}return this.format.read(b)},commit:function(c,b){b=OpenLayers.Util.extend({},b);OpenLayers.Util.applyDefaults(b,this.options);var a=new OpenLayers.Protocol.Response({requestType:"commit",reqFeatures:c});a.priv=OpenLayers.Request.POST({url:b.url,data:this.format.write(c,b),callback:this.createCallback(this.handleCommit,a,b)});return a},handleCommit:function(a,b){if(b.callback){var c=a.priv;var d=c.responseXML;if(!d||!d.documentElement){d=c.responseText}var f=this.format.read(d)||{};a.insertIds=f.insertIds||[];a.code=(f.success)?OpenLayers.Protocol.Response.SUCCESS:OpenLayers.Protocol.Response.FAILURE;b.callback.call(b.scope,a)}},filterDelete:function(f,c){c=OpenLayers.Util.extend({},c);OpenLayers.Util.applyDefaults(c,this.options);var b=new OpenLayers.Protocol.Response({requestType:"commit"});var a=this.format.createElementNSPlus("wfs:Transaction",{attributes:{service:"WFS",version:this.version}});var d=this.format.createElementNSPlus("wfs:Delete",{attributes:{typeName:(c.featureNS?this.featurePrefix+":":"")+c.featureType}});if(c.featureNS){d.setAttribute("xmlns:"+this.featurePrefix,c.featureNS)}var h=this.format.writeNode("ogc:Filter",f);d.appendChild(h);a.appendChild(d);var g=OpenLayers.Format.XML.prototype.write.apply(this.format,[a]);return OpenLayers.Request.POST({url:this.url,callback:c.callback||function(){},data:g})},abort:function(a){if(a){a.priv.abort()}},CLASS_NAME:"OpenLayers.Protocol.WFS.v1"});OpenLayers.Renderer.SVG=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"http://www.w3.org/2000/svg",xlinkns:"http://www.w3.org/1999/xlink",MAX_PIXEL:15000,translationParameters:null,symbolSize:{},isGecko:null,initialize:function(a){if(!this.supported()){return}OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments);this.translationParameters={x:0,y:0};this.isGecko=(navigator.userAgent.toLowerCase().indexOf("gecko/")!=-1)},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments)},supported:function(){var a="http://www.w3.org/TR/SVG11/feature#";return(document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature(a+"SVG","1.1")||document.implementation.hasFeature(a+"BasicStructure","1.1")))},inValidRange:function(a,f,b){var d=a+(b?0:this.translationParameters.x);var c=f+(b?0:this.translationParameters.y);return(d>=-this.MAX_PIXEL&&d<=this.MAX_PIXEL&&c>=-this.MAX_PIXEL&&c<=this.MAX_PIXEL)},setExtent:function(b,d){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var a=this.getResolution();var g=-b.left/a;var f=b.top/a;if(d){this.left=g;this.top=f;var c="0 0 "+this.size.w+" "+this.size.h;this.rendererRoot.setAttributeNS(null,"viewBox",c);this.translate(0,0);return true}else{var h=this.translate(g-this.left,f-this.top);if(!h){this.setExtent(b,true)}return h}},translate:function(a,c){if(!this.inValidRange(a,c,true)){return false}else{var b="";if(a||c){b="translate("+a+","+c+")"}this.root.setAttributeNS(null,"transform",b);this.translationParameters={x:a,y:c};return true}},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(c,b){var a=null;switch(c.CLASS_NAME){case"OpenLayers.Geometry.Point":if(b.externalGraphic){a="image"}else{if(this.isComplexSymbol(b.graphicName)){a="use"}else{a="circle"}}break;case"OpenLayers.Geometry.Rectangle":a="rect";break;case"OpenLayers.Geometry.LineString":a="polyline";break;case"OpenLayers.Geometry.LinearRing":a="polygon";break;case"OpenLayers.Geometry.Polygon":case"OpenLayers.Geometry.Curve":case"OpenLayers.Geometry.Surface":a="path";break;default:break}return a},setStyle:function(t,w,b){w=w||t._style;b=b||t._options;var l=parseFloat(t.getAttributeNS(null,"r"));var k=1;var d;if(t._geometryClass=="OpenLayers.Geometry.Point"&&l){t.style.visibility="";if(w.graphic===false){t.style.visibility="hidden"}else{if(w.externalGraphic){d=this.getPosition(t);if(w.graphicTitle){t.setAttributeNS(null,"title",w.graphicTitle)}if(w.graphicWidth&&w.graphicHeight){t.setAttributeNS(null,"preserveAspectRatio","none")}var s=w.graphicWidth||w.graphicHeight;var p=w.graphicHeight||w.graphicWidth;s=s?s:w.pointRadius*2;p=p?p:w.pointRadius*2;var z=(w.graphicXOffset!=undefined)?w.graphicXOffset:-(0.5*s);var f=(w.graphicYOffset!=undefined)?w.graphicYOffset:-(0.5*p);var a=w.graphicOpacity||w.fillOpacity;t.setAttributeNS(null,"x",(d.x+z).toFixed());t.setAttributeNS(null,"y",(d.y+f).toFixed());t.setAttributeNS(null,"width",s);t.setAttributeNS(null,"height",p);t.setAttributeNS(this.xlinkns,"href",w.externalGraphic);t.setAttributeNS(null,"style","opacity: "+a)}else{if(this.isComplexSymbol(w.graphicName)){var c=w.pointRadius*3;var o=c*2;var q=this.importSymbol(w.graphicName);var v="#"+q;d=this.getPosition(t);k=this.symbolSize[q]/o;var g=t.parentNode;var h=t.nextSibling;if(g){g.removeChild(t)}t.setAttributeNS(this.xlinkns,"href",v);t.setAttributeNS(null,"width",o);t.setAttributeNS(null,"height",o);t.setAttributeNS(null,"x",d.x-c);t.setAttributeNS(null,"y",d.y-c);if(h){g.insertBefore(t,h)}else{if(g){g.appendChild(t)}}}else{t.setAttributeNS(null,"r",w.pointRadius)}}}if(typeof w.rotation!="undefined"&&d){var u=OpenLayers.String.format("rotate(${0} ${1} ${2})",[w.rotation,d.x,d.y]);t.setAttributeNS(null,"transform",u)}}if(b.isFilled){t.setAttributeNS(null,"fill",w.fillColor);t.setAttributeNS(null,"fill-opacity",w.fillOpacity)}else{t.setAttributeNS(null,"fill","none")}if(b.isStroked){t.setAttributeNS(null,"stroke",w.strokeColor);t.setAttributeNS(null,"stroke-opacity",w.strokeOpacity);t.setAttributeNS(null,"stroke-width",w.strokeWidth*k);t.setAttributeNS(null,"stroke-linecap",w.strokeLinecap);t.setAttributeNS(null,"stroke-linejoin","round");t.setAttributeNS(null,"stroke-dasharray",this.dashStyle(w,k))}else{t.setAttributeNS(null,"stroke","none")}if(w.pointerEvents){t.setAttributeNS(null,"pointer-events",w.pointerEvents)}if(w.cursor!=null){t.setAttributeNS(null,"cursor",w.cursor)}return t},dashStyle:function(c,b){var a=c.strokeWidth*b;switch(c.strokeDashstyle){case"solid":return"none";case"dot":return[1,4*a].join();case"dash":return[4*a,4*a].join();case"dashdot":return[4*a,4*a,1,4*a].join();case"longdash":return[8*a,4*a].join();case"longdashdot":return[8*a,4*a,1,4*a].join();default:return c.strokeDashstyle.replace(/ /g,",")}},createNode:function(a,c){var b=document.createElementNS(this.xmlns,a);if(c){b.setAttributeNS(null,"id",c)}return b},nodeTypeCompare:function(b,a){return(a==b.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(d,f,b){var c=this.getResolution();var a=(f.x/c+this.left);var g=(this.top-f.y/c);if(this.inValidRange(a,g)){d.setAttributeNS(null,"cx",a);d.setAttributeNS(null,"cy",g);d.setAttributeNS(null,"r",b);return d}else{return false}},drawLineString:function(b,c){var a=this.getComponentsString(c.components);if(a.path){b.setAttributeNS(null,"points",a.path);return(a.complete?b:null)}else{return false}},drawLinearRing:function(b,c){var a=this.getComponentsString(c.components);if(a.path){b.setAttributeNS(null,"points",a.path);return(a.complete?b:null)}else{return false}},drawPolygon:function(b,k){var h="";var l=true;var a=true;var c,o;for(var f=0,g=k.components.length;f<g;f++){h+=" M";c=this.getComponentsString(k.components[f].components," ");o=c.path;if(o){h+=" "+o;a=c.complete&&a}else{l=false}}h+=" z";if(l){b.setAttributeNS(null,"d",h);b.setAttributeNS(null,"fill-rule","evenodd");return a?b:null}else{return false}},drawRectangle:function(c,d){var b=this.getResolution();var a=(d.x/b+this.left);var f=(this.top-d.y/b);if(this.inValidRange(a,f)){c.setAttributeNS(null,"x",a);c.setAttributeNS(null,"y",f);c.setAttributeNS(null,"width",d.width/b);c.setAttributeNS(null,"height",d.height/b);return c}else{return false}},drawSurface:function(g,k){var h=null;var b=true;for(var f=0,a=k.components.length;f<a;f++){if((f%3)==0&&(f/3)==0){var c=this.getShortString(k.components[f]);if(!c){b=false}h="M "+c}else{if((f%3)==1){var c=this.getShortString(k.components[f]);if(!c){b=false}h+=" C "+c}else{var c=this.getShortString(k.components[f]);if(!c){b=false}h+=" "+c}}}h+=" Z";if(b){g.setAttributeNS(null,"d",h);return g}else{return false}},drawText:function(c,a,l){var b=this.getResolution();var k=(l.x/b+this.left);var f=(l.y/b-this.top);var h=this.nodeFactory(c+this.LABEL_ID_SUFFIX,"text");var g=this.nodeFactory(c+this.LABEL_ID_SUFFIX+"_tspan","tspan");h.setAttributeNS(null,"x",k);h.setAttributeNS(null,"y",-f);h.setAttributeNS(null,"pointer-events","none");if(a.fontColor){h.setAttributeNS(null,"fill",a.fontColor)}if(a.fontFamily){h.setAttributeNS(null,"font-family",a.fontFamily)}if(a.fontSize){h.setAttributeNS(null,"font-size",a.fontSize)}if(a.fontWeight){h.setAttributeNS(null,"font-weight",a.fontWeight)}var d=a.labelAlign||"cm";h.setAttributeNS(null,"text-anchor",OpenLayers.Renderer.SVG.LABEL_ALIGN[d[0]]||"middle");if(this.isGecko){h.setAttributeNS(null,"dominant-baseline",OpenLayers.Renderer.SVG.LABEL_ALIGN[d[1]]||"central")}else{g.setAttributeNS(null,"baseline-shift",OpenLayers.Renderer.SVG.LABEL_VSHIFT[d[1]]||"-35%")}g.textContent=a.label;if(!h.parentNode){h.appendChild(g);this.textRoot.appendChild(h)}},getComponentsString:function(f,d){var h=[];var a=true;var g=f.length;var o=[];var k,l,b;for(var c=0;c<g;c++){l=f[c];h.push(l);k=this.getShortString(l);if(k){o.push(k)}else{if(c>0){if(this.getShortString(f[c-1])){o.push(this.clipLine(f[c],f[c-1]))}}if(c<g-1){if(this.getShortString(f[c+1])){o.push(this.clipLine(f[c],f[c+1]))}}a=false}}return{path:o.join(d||","),complete:a}},clipLine:function(f,l){if(l.equals(f)){return""}var g=this.getResolution();var b=this.MAX_PIXEL-this.translationParameters.x;var a=this.MAX_PIXEL-this.translationParameters.y;var d=l.x/g+this.left;var p=this.top-l.y/g;var c=f.x/g+this.left;var o=this.top-f.y/g;var h;if(c<-b||c>b){h=(o-p)/(c-d);c=c<0?-b:b;o=p+(c-d)*h}if(o<-a||o>a){h=(c-d)/(o-p);o=o<0?-a:a;c=d+(o-p)*h}return c+","+o},getShortString:function(b){var c=this.getResolution();var a=(b.x/c+this.left);var d=(this.top-b.y/c);if(this.inValidRange(a,d)){return a+","+d}else{return false}},getPosition:function(a){return({x:parseFloat(a.getAttributeNS(null,"cx")),y:parseFloat(a.getAttributeNS(null,"cy"))})},importSymbol:function(f){if(!this.defs){this.defs=this.createDefs()}var b=this.container.id+"-"+f;if(document.getElementById(b)!=null){return b}var d=OpenLayers.Renderer.symbol[f];if(!d){throw new Error(f+" is not a valid symbol name");return}var h=this.nodeFactory(b,"symbol");var c=this.nodeFactory(null,"polygon");h.appendChild(c);var q=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0);var o="";var l,k;for(var g=0;g<d.length;g=g+2){l=d[g];k=d[g+1];q.left=Math.min(q.left,l);q.bottom=Math.min(q.bottom,k);q.right=Math.max(q.right,l);q.top=Math.max(q.top,k);o+=" "+l+","+k}c.setAttributeNS(null,"points",o);var a=q.getWidth();var p=q.getHeight();var r=[q.left-a,q.bottom-p,a*3,p*3];h.setAttributeNS(null,"viewBox",r.join(" "));this.symbolSize[b]=Math.max(a,p)*3;this.defs.appendChild(h);return h.id},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.VML=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"urn:schemas-microsoft-com:vml",symbolCache:{},offset:null,initialize:function(b){if(!this.supported()){return}if(!document.namespaces.olv){document.namespaces.add("olv",this.xmlns);var f=document.createStyleSheet();var c=["shape","rect","oval","fill","stroke","imagedata","group","textbox"];for(var d=0,a=c.length;d<a;d++){f.addRule("olv\\:"+c[d],"behavior: url(#default#VML); position: absolute; display: inline-block;")}}OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments);this.offset={x:0,y:0}},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments)},supported:function(){return !!(document.namespaces)},setExtent:function(l,a){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var c=this.getResolution();var b=l.left/c;var g=l.top/c-this.size.h;if(a){this.offset={x:b,y:g};b=0;g=0}else{b=b-this.offset.x;g=g-this.offset.y}var p=b+" "+g;this.root.coordorigin=p;var k=[this.root,this.vectorRoot,this.textRoot];var h;for(var d=0,f=k.length;d<f;++d){h=k[d];var o=this.size.w+" "+this.size.h;h.coordsize=o}this.root.style.flip="y";return true},setSize:function(g){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);var d=[this.rendererRoot,this.root,this.vectorRoot,this.textRoot];var c=this.size.w+"px";var k=this.size.h+"px";var b;for(var f=0,a=d.length;f<a;++f){b=d[f];b.style.width=c;b.style.height=k}},getNodeType:function(c,b){var a=null;switch(c.CLASS_NAME){case"OpenLayers.Geometry.Point":if(b.externalGraphic){a="olv:rect"}else{if(this.isComplexSymbol(b.graphicName)){a="olv:shape"}else{a="olv:oval"}}break;case"OpenLayers.Geometry.Rectangle":a="olv:rect";break;case"OpenLayers.Geometry.LineString":case"OpenLayers.Geometry.LinearRing":case"OpenLayers.Geometry.Polygon":case"OpenLayers.Geometry.Curve":case"OpenLayers.Geometry.Surface":a="olv:shape";break;default:break}return a},setStyle:function(d,b,u,p){b=b||d._style;u=u||d._options;var l=1;if(d._geometryClass=="OpenLayers.Geometry.Point"){if(b.externalGraphic){if(b.graphicTitle){d.title=b.graphicTitle}var c=b.graphicWidth||b.graphicHeight;var q=b.graphicHeight||b.graphicWidth;c=c?c:b.pointRadius*2;q=q?q:b.pointRadius*2;var g=this.getResolution();var k=(b.graphicXOffset!=undefined)?b.graphicXOffset:-(0.5*c);var f=(b.graphicYOffset!=undefined)?b.graphicYOffset:-(0.5*q);d.style.left=((p.x/g-this.offset.x)+k).toFixed();d.style.top=((p.y/g-this.offset.y)-(f+q)).toFixed();d.style.width=c+"px";d.style.height=q+"px";d.style.flip="y";b.fillColor="none";u.isStroked=false}else{if(this.isComplexSymbol(b.graphicName)){var a=this.importSymbol(b.graphicName);d.path=a.path;d.coordorigin=a.left+","+a.bottom;var t=a.size;d.coordsize=t+","+t;this.drawCircle(d,p,b.pointRadius);d.style.flip="y"}else{this.drawCircle(d,p,b.pointRadius)}}}if(u.isFilled){d.fillcolor=b.fillColor}else{d.filled="false"}var o=d.getElementsByTagName("fill");var s=(o.length==0)?null:o[0];if(!u.isFilled){if(s){d.removeChild(s)}}else{if(!s){s=this.createNode("olv:fill",d.id+"_fill")}s.opacity=b.fillOpacity;if(d._geometryClass=="OpenLayers.Geometry.Point"&&b.externalGraphic){if(b.graphicOpacity){s.opacity=b.graphicOpacity}s.src=b.externalGraphic;s.type="frame";if(!(b.graphicWidth&&b.graphicHeight)){s.aspect="atmost"}}if(s.parentNode!=d){d.appendChild(s)}}if(typeof b.rotation!="undefined"){if(b.externalGraphic){this.graphicRotate(d,k,f);s.opacity=0}else{d.style.rotation=b.rotation}}if(u.isStroked){d.strokecolor=b.strokeColor;d.strokeweight=b.strokeWidth+"px"}else{d.stroked=false}var h=d.getElementsByTagName("stroke");var r=(h.length==0)?null:h[0];if(!u.isStroked){if(r){d.removeChild(r)}}else{if(!r){r=this.createNode("olv:stroke",d.id+"_stroke");d.appendChild(r)}r.opacity=b.strokeOpacity;r.endcap=!b.strokeLinecap||b.strokeLinecap=="butt"?"flat":b.strokeLinecap;r.dashstyle=this.dashStyle(b)}if(b.cursor!="inherit"&&b.cursor!=null){d.style.cursor=b.cursor}return d},graphicRotate:function(s,w,g){var v=v||s._style;var d=s._options;var a,o;if(!(v.graphicWidth&&v.graphicHeight)){var z=new Image();z.onreadystatechange=OpenLayers.Function.bind(function(){if(z.readyState=="complete"||z.readyState=="interactive"){a=z.width/z.height;o=Math.max(v.pointRadius*2,v.graphicWidth||0,v.graphicHeight||0);w=w*a;v.graphicWidth=o*a;v.graphicHeight=o;this.graphicRotate(s,w,g)}},this);z.src=v.externalGraphic;return}else{o=Math.max(v.graphicWidth,v.graphicHeight);a=v.graphicWidth/v.graphicHeight}var r=Math.round(v.graphicWidth||o*a);var p=Math.round(v.graphicHeight||o);s.style.width=r+"px";s.style.height=p+"px";var q=document.getElementById(s.id+"_image");if(!q){q=this.createNode("olv:imagedata",s.id+"_image");s.appendChild(q)}q.style.width=r+"px";q.style.height=p+"px";q.src=v.externalGraphic;q.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='', sizingMethod='scale')";var t=v.rotation*Math.PI/180;var k=Math.sin(t);var f=Math.cos(t);var h="progid:DXImageTransform.Microsoft.Matrix(M11="+f+",M12="+(-k)+",M21="+k+",M22="+f+",SizingMethod='auto expand')\n";var b=v.graphicOpacity||v.fillOpacity;if(b&&b!=1){h+="progid:DXImageTransform.Microsoft.BasicImage(opacity="+b+")\n"}s.style.filter=h;var u=new OpenLayers.Geometry.Point(-w,-g);var c=new OpenLayers.Bounds(0,0,r,p).toGeometry();c.rotate(v.rotation,u);var l=c.getBounds();s.style.left=Math.round(parseInt(s.style.left)+l.left)+"px";s.style.top=Math.round(parseInt(s.style.top)-l.bottom)+"px"},postDraw:function(a){var c=a._style.fillColor;var b=a._style.strokeColor;if(c=="none"&&a.fillcolor!=c){a.fillcolor=c}if(b=="none"&&a.strokecolor!=b){a.strokecolor=b}},setNodeDimension:function(b,f){var d=f.getBounds();if(d){var a=this.getResolution();var c=new OpenLayers.Bounds((d.left/a-this.offset.x).toFixed(),(d.bottom/a-this.offset.y).toFixed(),(d.right/a-this.offset.x).toFixed(),(d.top/a-this.offset.y).toFixed());b.style.left=c.left+"px";b.style.top=c.top+"px";b.style.width=c.getWidth()+"px";b.style.height=c.getHeight()+"px";b.coordorigin=c.left+" "+c.top;b.coordsize=c.getWidth()+" "+c.getHeight()}},dashStyle:function(a){var c=a.strokeDashstyle;switch(c){case"solid":case"dot":case"dash":case"dashdot":case"longdash":case"longdashdot":return c;default:var b=c.split(/[ ,]/);if(b.length==2){if(1*b[0]>=2*b[1]){return"longdash"}return(b[0]==1||b[1]==1)?"dot":"dash"}else{if(b.length==4){return(1*b[0]>=2*b[1])?"longdashdot":"dashdot"}}return"solid"}},createNode:function(a,c){var b=document.createElement(a);if(c){b.id=c}b.unselectable="on";b.onselectstart=function(){return(false)};return b},nodeTypeCompare:function(c,b){var d=b;var a=d.indexOf(":");if(a!=-1){d=d.substr(a+1)}var f=c.nodeName;a=f.indexOf(":");if(a!=-1){f=f.substr(a+1)}return(d==f)},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_vmlRoot","div")},createRoot:function(a){return this.nodeFactory(this.container.id+a,"olv:group")},drawPoint:function(a,b){return this.drawCircle(a,b,1)},drawCircle:function(d,f,a){if(!isNaN(f.x)&&!isNaN(f.y)){var b=this.getResolution();d.style.left=((f.x/b-this.offset.x).toFixed()-a)+"px";d.style.top=((f.y/b-this.offset.y).toFixed()-a)+"px";var c=a*2;d.style.width=c+"px";d.style.height=c+"px";return d}return false},drawLineString:function(a,b){return this.drawLine(a,b,false)},drawLinearRing:function(a,b){return this.drawLine(a,b,true)},drawLine:function(b,o,h){this.setNodeDimension(b,o);var c=this.getResolution();var a=o.components.length;var f=new Array(a);var k,p,l;for(var g=0;g<a;g++){k=o.components[g];p=(k.x/c-this.offset.x);l=(k.y/c-this.offset.y);f[g]=" "+p.toFixed()+","+l.toFixed()+" l "}var d=(h)?" x e":" e";b.path="m"+f.join("")+d;return b},drawPolygon:function(b,o){this.setNodeDimension(b,o);var c=this.getResolution();var q=[];var g,f,d,k,a,h,p,l;for(d=0,k=o.components.length;d<k;d++){g=o.components[d];q.push("m");for(f=0,a=g.components.length;f<a;f++){h=g.components[f];p=h.x/c-this.offset.x;l=h.y/c-this.offset.y;q.push(" "+p.toFixed()+","+l.toFixed());if(f==0){q.push(" l")}}q.push(" x ")}q.push("e");b.path=q.join("");return b},drawRectangle:function(b,c){var a=this.getResolution();b.style.left=(c.x/a-this.offset.x)+"px";b.style.top=(c.y/a-this.offset.y)+"px";b.style.width=c.width/a+"px";b.style.height=c.height/a+"px";return b},drawText:function(d,a,k){var h=this.nodeFactory(d+this.LABEL_ID_SUFFIX,"olv:rect");var g=this.nodeFactory(d+this.LABEL_ID_SUFFIX+"_textbox","olv:textbox");var c=this.getResolution();h.style.left=(k.x/c-this.offset.x).toFixed()+"px";h.style.top=(k.y/c-this.offset.y).toFixed()+"px";h.style.flip="y";g.innerText=a.label;if(a.fontColor){g.style.color=a.fontColor}if(a.fontFamily){g.style.fontFamily=a.fontFamily}if(a.fontSize){g.style.fontSize=a.fontSize}if(a.fontWeight){g.style.fontWeight=a.fontWeight}g.style.whiteSpace="nowrap";g.inset="1px,0px,0px,0px";if(!h.parentNode){h.appendChild(g);this.textRoot.appendChild(h)}var f=a.labelAlign||"cm";var l=g.clientWidth*(OpenLayers.Renderer.VML.LABEL_SHIFT[f.substr(0,1)]);var b=g.clientHeight*(OpenLayers.Renderer.VML.LABEL_SHIFT[f.substr(1,1)]);h.style.left=parseInt(h.style.left)-l-1+"px";h.style.top=parseInt(h.style.top)+b+"px"},drawSurface:function(a,h){this.setNodeDimension(a,h);var b=this.getResolution();var l=[];var d,k,g;for(var c=0,f=h.components.length;c<f;c++){d=h.components[c];k=d.x/b-this.offset.x;g=d.y/b-this.offset.y;if((c%3)==0&&(c/3)==0){l.push("m")}else{if((c%3)==1){l.push(" c")}}l.push(" "+k+","+g)}l.push(" x e");a.path=l.join("");return a},moveRoot:function(b){var a=this.map.getLayer(b.container.id);if(a instanceof OpenLayers.Layer.Vector.RootContainer){a=this.map.getLayer(this.container.id)}a&&a.renderer.clear();OpenLayers.Renderer.Elements.prototype.moveRoot.apply(this,arguments);a&&a.redraw()},importSymbol:function(d){var b=this.container.id+"-"+d;var a=this.symbolCache[b];if(a){return a}var c=OpenLayers.Renderer.symbol[d];if(!c){throw new Error(d+" is not a valid symbol name");return}var k=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0);var f=["m"];for(var g=0;g<c.length;g=g+2){x=c[g];y=c[g+1];k.left=Math.min(k.left,x);k.bottom=Math.min(k.bottom,y);k.right=Math.max(k.right,x);k.top=Math.max(k.top,y);f.push(x);f.push(y);if(g==0){f.push("l")}}f.push("x e");var l=f.join(" ");var h=(k.getWidth()-k.getHeight())/2;if(h>0){k.bottom=k.bottom-h;k.top=k.top+h}else{k.left=k.left-h;k.right=k.right+h}a={path:l,size:k.getWidth(),left:k.left,bottom:k.bottom};this.symbolCache[b]=a;return a},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.Tile=OpenLayers.Class({EVENT_TYPES:["loadstart","loadend","reload","unload"],events:null,id:null,layer:null,url:null,bounds:null,size:null,position:null,isLoading:false,initialize:function(d,a,f,b,c){this.layer=d;this.position=a.clone();this.bounds=f.clone();this.url=b;this.size=c.clone();this.id=OpenLayers.Util.createUniqueID("Tile_");this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES)},unload:function(){if(this.isLoading){this.isLoading=false;this.events.triggerEvent("unload")}},destroy:function(){this.layer=null;this.bounds=null;this.size=null;this.position=null;this.events.destroy();this.events=null},clone:function(a){if(a==null){a=new OpenLayers.Tile(this.layer,this.position,this.bounds,this.url,this.size)}OpenLayers.Util.applyDefaults(a,this);return a},draw:function(){var a=this.layer.maxExtent;var b=(a&&this.bounds.intersectsBounds(a,false));this.shouldDraw=(b||this.layer.displayOutsideMaxExtent);this.clear();return this.shouldDraw},moveTo:function(b,a,c){if(c==null){c=true}this.bounds=b.clone();this.position=a.clone();if(c){this.draw()}},clear:function(){},getBoundsFromBaseLayer:function(a){var g=OpenLayers.i18n("reprojectDeprecated",{layerName:this.layer.name});OpenLayers.Console.warn(g);var d=this.layer.map.getLonLatFromLayerPx(a);var c=a.clone();c.x+=this.size.w;c.y+=this.size.h;var b=this.layer.map.getLonLatFromLayerPx(c);if(d.lon>b.lon){if(d.lon<0){d.lon=-180-(d.lon+180)}else{b.lon=180+b.lon+180}}var f=new OpenLayers.Bounds(d.lon,b.lat,b.lon,d.lat);return f},showTile:function(){if(this.shouldDraw){this.show()}},show:function(){},hide:function(){},CLASS_NAME:"OpenLayers.Tile"});OpenLayers.Format.JSON=OpenLayers.Class(OpenLayers.Format,{indent:"    ",space:" ",newline:"\n",level:0,pretty:false,initialize:function(a){OpenLayers.Format.prototype.initialize.apply(this,[a])},read:function(json,filter){try{if(/^[\],:{}\s]*$/.test(json.replace(/\\["\\\/bfnrtu]/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){var object=eval("("+json+")");if(typeof filter==="function"){function walk(k,v){if(v&&typeof v==="object"){for(var i in v){if(v.hasOwnProperty(i)){v[i]=walk(i,v[i])}}}return filter(k,v)}object=walk("",object)}if(this.keepData){this.data=object}return object}}catch(e){}return null},write:function(f,c){this.pretty=!!c;var a=null;var b=typeof f;if(this.serialize[b]){try{a=this.serialize[b].apply(this,[f])}catch(d){OpenLayers.Console.error("Trouble serializing: "+d)}}return a},writeIndent:function(){var b=[];if(this.pretty){for(var a=0;a<this.level;++a){b.push(this.indent)}}return b.join("")},writeNewline:function(){return(this.pretty)?this.newline:""},writeSpace:function(){return(this.pretty)?this.space:""},serialize:{object:function(c){if(c==null){return"null"}if(c.constructor==Date){return this.serialize.date.apply(this,[c])}if(c.constructor==Array){return this.serialize.array.apply(this,[c])}var g=["{"];this.level+=1;var d,b,f;var a=false;for(d in c){if(c.hasOwnProperty(d)){b=OpenLayers.Format.JSON.prototype.write.apply(this,[d,this.pretty]);f=OpenLayers.Format.JSON.prototype.write.apply(this,[c[d],this.pretty]);if(b!=null&&f!=null){if(a){g.push(",")}g.push(this.writeNewline(),this.writeIndent(),b,":",this.writeSpace(),f);a=true}}}this.level-=1;g.push(this.writeNewline(),this.writeIndent(),"}");return g.join("")},array:function(f){var c;var d=["["];this.level+=1;for(var b=0,a=f.length;b<a;++b){c=OpenLayers.Format.JSON.prototype.write.apply(this,[f[b],this.pretty]);if(c!=null){if(b>0){d.push(",")}d.push(this.writeNewline(),this.writeIndent(),c)}}this.level-=1;d.push(this.writeNewline(),this.writeIndent(),"]");return d.join("")},string:function(b){var a={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};if(/["\\\x00-\x1f]/.test(b)){return'"'+b.replace(/([\x00-\x1f\\"])/g,function(f,d){var g=a[d];if(g){return g}g=d.charCodeAt();return"\\u00"+Math.floor(g/16).toString(16)+(g%16).toString(16)})+'"'}return'"'+b+'"'},number:function(a){return isFinite(a)?String(a):"null"},"boolean":function(a){return String(a)},date:function(a){function b(c){return(c<10)?"0"+c:c}return'"'+a.getFullYear()+"-"+b(a.getMonth()+1)+"-"+b(a.getDate())+"T"+b(a.getHours())+":"+b(a.getMinutes())+":"+b(a.getSeconds())+'"'}},CLASS_NAME:"OpenLayers.Format.JSON"});OpenLayers.Format.WFST=function(b){b=OpenLayers.Util.applyDefaults(b,OpenLayers.Format.WFST.DEFAULTS);var a=OpenLayers.Format.WFST["v"+b.version.replace(/\./g,"_")];if(!a){throw"Unsupported WFST version: "+b.version}return new a(b)};OpenLayers.Format.WFST.DEFAULTS={version:"1.0.0"};OpenLayers.Format.WMSCapabilities=OpenLayers.Class(OpenLayers.Format.XML,{defaultVersion:"1.1.1",version:null,parser:null,initialize:function(a){OpenLayers.Format.prototype.initialize.apply(this,[a]);this.options=a},read:function(f){if(typeof f=="string"){f=OpenLayers.Format.XML.prototype.read.apply(this,[f])}var c=f.documentElement;var b=this.version||c.getAttribute("version")||this.defaultVersion;if(!this.parser||this.parser.version!==b){var d=OpenLayers.Format.WMSCapabilities["v"+b.replace(/\./g,"_")];if(!d){throw"Can't find a WMS capabilities parser for version "+b}var g=new d(this.options)}var a=g.read(f);a.version=b;return a},CLASS_NAME:"OpenLayers.Format.WMSCapabilities"});OpenLayers.Format.XML=OpenLayers.Class(OpenLayers.Format,{namespaces:null,namespaceAlias:null,defaultPrefix:null,readers:{},writers:{},xmldom:null,initialize:function(a){if(window.ActiveXObject){this.xmldom=new ActiveXObject("Microsoft.XMLDOM")}OpenLayers.Format.prototype.initialize.apply(this,[a]);this.namespaces=OpenLayers.Util.extend({},this.namespaces);this.namespaceAlias={};for(var b in this.namespaces){this.namespaceAlias[this.namespaces[b]]=b}},destroy:function(){this.xmldom=null;OpenLayers.Format.prototype.destroy.apply(this,arguments)},setNamespace:function(a,b){this.namespaces[a]=b;this.namespaceAlias[b]=a},read:function(c){var a=c.indexOf("<");if(a>0){c=c.substring(a)}var b=OpenLayers.Util.Try(OpenLayers.Function.bind((function(){var d;if(window.ActiveXObject&&!this.xmldom){d=new ActiveXObject("Microsoft.XMLDOM")}else{d=this.xmldom}d.loadXML(c);return d}),this),function(){return new DOMParser().parseFromString(c,"text/xml")},function(){var d=new XMLHttpRequest();d.open("GET","data:text/xml;charset=utf-8,"+encodeURIComponent(c),false);if(d.overrideMimeType){d.overrideMimeType("text/xml")}d.send(null);return d.responseXML});if(this.keepData){this.data=b}return b},write:function(b){var c;if(this.xmldom){c=b.xml}else{var a=new XMLSerializer();if(b.nodeType==1){var d=document.implementation.createDocument("","",null);if(d.importNode){b=d.importNode(b,true)}d.appendChild(b);c=a.serializeToString(d)}else{c=a.serializeToString(b)}}return c},createElementNS:function(c,a){var b;if(this.xmldom){if(typeof c=="string"){b=this.xmldom.createNode(1,a,c)}else{b=this.xmldom.createNode(1,a,"")}}else{b=document.createElementNS(c,a)}return b},createTextNode:function(b){var a;if(this.xmldom){a=this.xmldom.createTextNode(b)}else{a=document.createTextNode(b)}return a},getElementsByTagNameNS:function(f,d,c){var a=[];if(f.getElementsByTagNameNS){a=f.getElementsByTagNameNS(d,c)}else{var b=f.getElementsByTagName("*");var l,g;for(var h=0,k=b.length;h<k;++h){l=b[h];g=(l.prefix)?(l.prefix+":"+c):c;if((c=="*")||(g==l.nodeName)){if((d=="*")||(d==l.namespaceURI)){a.push(l)}}}}return a},getAttributeNodeNS:function(c,b,a){var l=null;if(c.getAttributeNodeNS){l=c.getAttributeNodeNS(b,a)}else{var f=c.attributes;var k,d;for(var g=0,h=f.length;g<h;++g){k=f[g];if(k.namespaceURI==b){d=(k.prefix)?(k.prefix+":"+a):a;if(d==k.nodeName){l=k;break}}}}return l},getAttributeNS:function(f,d,a){var b="";if(f.getAttributeNS){b=f.getAttributeNS(d,a)||""}else{var c=this.getAttributeNodeNS(f,d,a);if(c){b=c.nodeValue}}return b},getChildValue:function(a,c){var b=c||"";if(a){for(var d=a.firstChild;d;d=d.nextSibling){switch(d.nodeType){case 3:case 4:b+=d.nodeValue}}}return b},concatChildValues:function(b,d){var c="";var f=b.firstChild;var a;while(f){a=f.nodeValue;if(a){c+=a}f=f.nextSibling}if(c==""&&d!=undefined){c=d}return c},isSimpleContent:function(a){var c=true;for(var b=a.firstChild;b;b=b.nextSibling){if(b.nodeType===1){c=false;break}}return c},contentType:function(c){var f=false,b=false;var a=OpenLayers.Format.XML.CONTENT_TYPE.EMPTY;for(var d=c.firstChild;d;d=d.nextSibling){switch(d.nodeType){case 1:b=true;break;case 8:break;default:f=true}if(b&&f){break}}if(b&&f){a=OpenLayers.Format.XML.CONTENT_TYPE.MIXED}else{if(b){return OpenLayers.Format.XML.CONTENT_TYPE.COMPLEX}else{if(f){return OpenLayers.Format.XML.CONTENT_TYPE.SIMPLE}}}return a},hasAttributeNS:function(c,b,a){var d=false;if(c.hasAttributeNS){d=c.hasAttributeNS(b,a)}else{d=!!this.getAttributeNodeNS(c,b,a)}return d},setAttributeNS:function(d,c,a,f){if(d.setAttributeNS){d.setAttributeNS(c,a,f)}else{if(this.xmldom){if(c){var b=d.ownerDocument.createNode(2,a,c);b.nodeValue=f;d.setAttributeNode(b)}else{d.setAttribute(a,f)}}else{throw"setAttributeNS not implemented"}}},createElementNSPlus:function(b,a){a=a||{};var d=a.uri||this.namespaces[a.prefix];if(!d){var g=b.indexOf(":");d=this.namespaces[b.substring(0,g)]}if(!d){d=this.namespaces[this.defaultPrefix]}var c=this.createElementNS(d,b);if(a.attributes){this.setAttributes(c,a.attributes)}var f=a.value;if(f!=null){if(typeof f=="boolean"){f=String(f)}c.appendChild(this.createTextNode(f))}return c},setAttributes:function(c,f){var d,b;for(var a in f){if(f[a]!=null&&f[a].toString){d=f[a].toString();b=this.namespaces[a.substring(0,a.indexOf(":"))]||null;this.setAttributeNS(c,b,a,d)}}},readNode:function(c,f){if(!f){f={}}var d=this.readers[this.namespaceAlias[c.namespaceURI]];if(d){var b=c.localName||c.nodeName.split(":").pop();var a=d[b]||d["*"];if(a){a.apply(this,[c,f])}}return f},readChildNodes:function(d,f){if(!f){f={}}var c=d.childNodes;var g;for(var b=0,a=c.length;b<a;++b){g=c[b];if(g.nodeType==1){this.readNode(g,f)}}return f},writeNode:function(a,g,d){var f,c;var b=a.indexOf(":");if(b>0){f=a.substring(0,b);c=a.substring(b+1)}else{if(d){f=this.namespaceAlias[d.namespaceURI]}else{f=this.defaultPrefix}c=a}var h=this.writers[f][c].apply(this,[g]);if(d){d.appendChild(h)}return h},getChildEl:function(c,a,b){return c&&this.getThisOrNextEl(c.firstChild,a,b)},getNextEl:function(c,a,b){return c&&this.getThisOrNextEl(c.nextSibling,a,b)},getThisOrNextEl:function(d,a,c){outer:for(var b=d;b;b=b.nextSibling){switch(b.nodeType){case 1:if((!a||a===(b.localName||b.nodeName.split(":").pop()))&&(!c||c===b.namespaceURI)){break outer}b=null;break outer;case 3:if(/^\s*$/.test(b.nodeValue)){break}case 4:case 6:case 12:case 10:case 11:b=null;break outer}}return b||null},lookupNamespaceURI:function(f,g){var d=null;if(f){if(f.lookupNamespaceURI){d=f.lookupNamespaceURI(g)}else{outer:switch(f.nodeType){case 1:if(f.namespaceURI!==null&&f.prefix===g){d=f.namespaceURI;break outer}var b=f.attributes.length;if(b){var a;for(var c=0;c<b;++c){a=f.attributes[c];if(a.prefix==="xmlns"&&a.name==="xmlns:"+g){d=a.value||null;break outer}else{if(a.name==="xmlns"&&g===null){d=a.value||null;break outer}}}}d=this.lookupNamespaceURI(f.parentNode,g);break outer;case 2:d=this.lookupNamespaceURI(f.ownerElement,g);break outer;case 9:d=this.lookupNamespaceURI(f.documentElement,g);break outer;case 6:case 12:case 10:case 11:break outer;default:d=this.lookupNamespaceURI(f.parentNode,g);break outer}}}return d},CLASS_NAME:"OpenLayers.Format.XML"});OpenLayers.Format.XML.CONTENT_TYPE={EMPTY:0,SIMPLE:1,COMPLEX:2,MIXED:3};OpenLayers.Format.XML.lookupNamespaceURI=OpenLayers.Function.bind(OpenLayers.Format.XML.prototype.lookupNamespaceURI,OpenLayers.Format.XML.prototype);OpenLayers.Handler=OpenLayers.Class({id:null,control:null,map:null,keyMask:null,active:false,evt:null,initialize:function(c,b,a){OpenLayers.Util.extend(this,a);this.control=c;this.callbacks=b;if(c.map){this.setMap(c.map)}OpenLayers.Util.extend(this,a);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},setMap:function(a){this.map=a},checkModifiers:function(a){if(this.keyMask==null){return true}var b=(a.shiftKey?OpenLayers.Handler.MOD_SHIFT:0)|(a.ctrlKey?OpenLayers.Handler.MOD_CTRL:0)|(a.altKey?OpenLayers.Handler.MOD_ALT:0);return(b==this.keyMask)},activate:function(){if(this.active){return false}var c=OpenLayers.Events.prototype.BROWSER_EVENTS;for(var b=0,a=c.length;b<a;b++){if(this[c[b]]){this.register(c[b],this[c[b]])}}this.active=true;return true},deactivate:function(){if(!this.active){return false}var c=OpenLayers.Events.prototype.BROWSER_EVENTS;for(var b=0,a=c.length;b<a;b++){if(this[c[b]]){this.unregister(c[b],this[c[b]])}}this.active=false;return true},callback:function(b,a){if(b&&this.callbacks[b]){this.callbacks[b].apply(this.control,a)}},register:function(a,b){this.map.events.registerPriority(a,this,b);this.map.events.registerPriority(a,this,this.setEvent)},unregister:function(a,b){this.map.events.unregister(a,this,b);this.map.events.unregister(a,this,this.setEvent)},setEvent:function(a){this.evt=a;return true},destroy:function(){this.deactivate();this.control=this.map=null},CLASS_NAME:"OpenLayers.Handler"});OpenLayers.Handler.MOD_NONE=0;OpenLayers.Handler.MOD_SHIFT=1;OpenLayers.Handler.MOD_CTRL=2;OpenLayers.Handler.MOD_ALT=4;OpenLayers.Map=OpenLayers.Class({Z_INDEX_BASE:{BaseLayer:100,Overlay:325,Feature:725,Popup:750,Control:1000},EVENT_TYPES:["preaddlayer","addlayer","removelayer","changelayer","movestart","move","moveend","zoomend","popupopen","popupclose","addmarker","removemarker","clearmarkers","mouseover","mouseout","mousemove","dragstart","drag","dragend","changebaselayer"],id:null,fractionalZoom:false,events:null,allOverlays:false,div:null,dragging:false,size:null,viewPortDiv:null,layerContainerOrigin:null,layerContainerDiv:null,layers:null,controls:null,popups:null,baseLayer:null,center:null,resolution:null,zoom:0,panRatio:1.5,viewRequestID:0,tileSize:null,projection:"EPSG:4326",units:"degrees",resolutions:null,maxResolution:1.40625,minResolution:null,maxScale:null,minScale:null,maxExtent:null,minExtent:null,restrictedExtent:null,numZoomLevels:16,theme:null,displayProjection:null,fallThrough:true,panTween:null,eventListeners:null,panMethod:OpenLayers.Easing.Expo.easeOut,panDuration:50,paddingForPopups:null,initialize:function(k,d){if(arguments.length===1&&typeof k==="object"){d=k;k=d&&d.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,d);this.id=OpenLayers.Util.createUniqueID("OpenLayers.Map_");this.div=OpenLayers.Util.getElement(k);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 h=this.div.id+"_OpenLayers_ViewPort";this.viewPortDiv=OpenLayers.Util.createDiv(h,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);h=this.div.id+"_OpenLayers_Container";this.layerContainerDiv=OpenLayers.Util.createDiv(h);this.layerContainerDiv.style.zIndex=this.Z_INDEX_BASE.Popup-1;this.viewPortDiv.appendChild(this.layerContainerDiv);this.events=new OpenLayers.Events(this,this.div,this.EVENT_TYPES,this.fallThrough,{includeXY:true});this.updateSize();if(this.eventListeners instanceof Object){this.events.on(this.eventListeners)}this.events.register("movestart",this,this.updateSize);if(OpenLayers.String.contains(navigator.appName,"Microsoft")){this.events.register("resize",this,this.updateSize)}else{this.updateSizeDestroy=OpenLayers.Function.bind(this.updateSize,this);OpenLayers.Event.observe(window,"resize",this.updateSizeDestroy)}if(this.theme){var g=true;var c=document.getElementsByTagName("link");for(var f=0,a=c.length;f<a;++f){if(OpenLayers.Util.isEquivalentUrl(c.item(f).href,this.theme)){g=false;break}}if(g){var b=document.createElement("link");b.setAttribute("rel","stylesheet");b.setAttribute("type","text/css");b.setAttribute("href",this.theme);document.getElementsByTagName("head")[0].appendChild(b)}}this.layers=[];if(this.controls==null){if(OpenLayers.Control!=null){this.controls=[new OpenLayers.Control.Navigation(),new OpenLayers.Control.PanZoom(),new OpenLayers.Control.ArgParser(),new OpenLayers.Control.Attribution()]}else{this.controls=[]}}for(var f=0,a=this.controls.length;f<a;f++){this.addControlToMap(this.controls[f])}this.popups=[];this.unloadDestroy=OpenLayers.Function.bind(this.destroy,this);OpenLayers.Event.observe(window,"unload",this.unloadDestroy)},render:function(a){this.div=OpenLayers.Util.getElement(a);OpenLayers.Element.addClass(this.div,"olMap");this.events.attachToElement(this.div);this.viewPortDiv.parentNode.removeChild(this.viewPortDiv);this.div.appendChild(this.viewPortDiv);this.updateSize()},unloadDestroy:null,updateSizeDestroy:null,destroy:function(){if(!this.unloadDestroy){return false}OpenLayers.Event.stopObserving(window,"unload",this.unloadDestroy);this.unloadDestroy=null;if(this.updateSizeDestroy){OpenLayers.Event.stopObserving(window,"resize",this.updateSizeDestroy)}else{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(var a=this.layers.length-1;a>=0;--a){this.layers[a].destroy(false)}this.layers=null}if(this.viewPortDiv){this.div.removeChild(this.viewPortDiv)}this.viewPortDiv=null;if(this.eventListeners){this.events.un(this.eventListeners);this.eventListeners=null}this.events.destroy();this.events=null},setOptions:function(a){OpenLayers.Util.extend(this,a)},getTileSize:function(){return this.tileSize},getBy:function(f,c,a){var d=(typeof a.test=="function");var b=OpenLayers.Array.filter(this[f],function(g){return g[c]==a||(d&&a.test(g[c]))});return b},getLayersBy:function(b,a){return this.getBy("layers",b,a)},getLayersByName:function(a){return this.getLayersBy("name",a)},getLayersByClass:function(a){return this.getLayersBy("CLASS_NAME",a)},getControlsBy:function(b,a){return this.getBy("controls",b,a)},getControlsByClass:function(a){return this.getControlsBy("CLASS_NAME",a)},getLayer:function(f){var b=null;for(var d=0,a=this.layers.length;d<a;d++){var c=this.layers[d];if(c.id==f){b=c;break}}return b},setLayerZIndex:function(b,a){b.setZIndex(this.Z_INDEX_BASE[b.isBaseLayer?"BaseLayer":"Overlay"]+a*5)},resetLayersZIndex:function(){for(var c=0,a=this.layers.length;c<a;c++){var b=this.layers[c];this.setLayerZIndex(b,c)}},addLayer:function(c){for(var b=0,a=this.layers.length;b<a;b++){if(this.layers[b]==c){var d=OpenLayers.i18n("layerAlreadyAdded",{layerName:c.name});OpenLayers.Console.warn(d);return false}}if(this.allOverlays){c.isBaseLayer=false}this.events.triggerEvent("preaddlayer",{layer:c});c.div.className="olLayerDiv";c.div.style.overflow="";this.setLayerZIndex(c,this.layers.length);if(c.isFixed){this.viewPortDiv.appendChild(c.div)}else{this.layerContainerDiv.appendChild(c.div)}this.layers.push(c);c.setMap(this);if(c.isBaseLayer||(this.allOverlays&&!this.baseLayer)){if(this.baseLayer==null){this.setBaseLayer(c)}else{c.setVisibility(false)}}else{c.redraw()}this.events.triggerEvent("addlayer",{layer:c});c.afterAdd()},addLayers:function(c){for(var b=0,a=c.length;b<a;b++){this.addLayer(c[b])}},removeLayer:function(c,f){if(f==null){f=true}if(c.isFixed){this.viewPortDiv.removeChild(c.div)}else{this.layerContainerDiv.removeChild(c.div)}OpenLayers.Util.removeItem(this.layers,c);c.removeMap(this);c.map=null;if(this.baseLayer==c){this.baseLayer=null;if(f){for(var b=0,a=this.layers.length;b<a;b++){var d=this.layers[b];if(d.isBaseLayer||this.allOverlays){this.setBaseLayer(d);break}}}}this.resetLayersZIndex();this.events.triggerEvent("removelayer",{layer:c})},getNumLayers:function(){return this.layers.length},getLayerIndex:function(a){return OpenLayers.Util.indexOf(this.layers,a)},setLayerIndex:function(d,b){var f=this.getLayerIndex(d);if(b<0){b=0}else{if(b>this.layers.length){b=this.layers.length}}if(f!=b){this.layers.splice(f,1);this.layers.splice(b,0,d);for(var c=0,a=this.layers.length;c<a;c++){this.setLayerZIndex(this.layers[c],c)}this.events.triggerEvent("changelayer",{layer:d,property:"order"});if(this.allOverlays){if(b===0){this.setBaseLayer(d)}else{if(this.baseLayer!==this.layers[0]){this.setBaseLayer(this.layers[0])}}}}},raiseLayer:function(b,c){var a=this.getLayerIndex(b)+c;this.setLayerIndex(b,a)},setBaseLayer:function(f){var d=null;if(this.baseLayer){d=this.baseLayer.getExtent()}if(f!=this.baseLayer){if(OpenLayers.Util.indexOf(this.layers,f)!=-1){if(this.baseLayer!=null&&!this.allOverlays){this.baseLayer.setVisibility(false)}this.baseLayer=f;this.viewRequestID++;if(!this.allOverlays){this.baseLayer.visibility=true}var a=this.getCenter();if(a!=null){var b=(d)?d.getCenterLonLat():a;var c=(d)?this.getZoomForExtent(d,true):this.getZoomForResolution(this.resolution,true);this.setCenter(b,c,false,true)}this.events.triggerEvent("changebaselayer",{layer:this.baseLayer})}}},addControl:function(b,a){this.controls.push(b);this.addControlToMap(b,a)},addControlToMap:function(b,a){b.outsideViewport=(b.div!=null);if(this.displayProjection&&!b.displayProjection){b.displayProjection=this.displayProjection}b.setMap(this);var c=b.draw(a);if(c){if(!b.outsideViewport){c.style.zIndex=this.Z_INDEX_BASE.Control+this.controls.length;this.viewPortDiv.appendChild(c)}}},getControl:function(f){var b=null;for(var c=0,a=this.controls.length;c<a;c++){var d=this.controls[c];if(d.id==f){b=d;break}}return b},removeControl:function(a){if((a)&&(a==this.getControl(a.id))){if(a.div&&(a.div.parentNode==this.viewPortDiv)){this.viewPortDiv.removeChild(a.div)}OpenLayers.Util.removeItem(this.controls,a)}},addPopup:function(a,d){if(d){for(var b=this.popups.length-1;b>=0;--b){this.removePopup(this.popups[b])}}a.map=this;this.popups.push(a);var c=a.draw();if(c){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;if(this.size!=null){a=this.size.clone()}return a},updateSize:function(){this.events.clearMouseCache();var c=this.getCurrentSize();var g=this.getSize();if(g==null){this.size=g=c}if(!c.equals(g)){this.size=c;for(var d=0,b=this.layers.length;d<b;d++){this.layers[d].onMapResize()}if(this.baseLayer!=null){var a=new OpenLayers.Pixel(c.w/2,c.h/2);var h=this.getLonLatFromViewPortPx(a);var f=this.getZoom();this.zoom=null;this.setCenter(this.getCenter(),f)}}},getCurrentSize:function(){var a=new OpenLayers.Size(this.div.clientWidth,this.div.clientHeight);if(a.w==0&&a.h==0||isNaN(a.w)&&isNaN(a.h)){var b=OpenLayers.Element.getDimensions(this.div);a.w=b.width;a.h=b.height}if(a.w==0&&a.h==0||isNaN(a.w)&&isNaN(a.h)){a.w=parseInt(this.div.style.width);a.h=parseInt(this.div.style.height)}return a},calculateBounds:function(a,b){var f=null;if(a==null){a=this.getCenter()}if(b==null){b=this.getResolution()}if((a!=null)&&(b!=null)){var d=this.getSize();var g=d.w*b;var c=d.h*b;f=new OpenLayers.Bounds(a.lon-g/2,a.lat-c/2,a.lon+g/2,a.lat+c/2)}return f},getCenter:function(){var a=null;if(this.center){a=this.center.clone()}return a},getZoom:function(){return this.zoom},pan:function(d,c,f){f=OpenLayers.Util.applyDefaults(f,{animate:true,dragging:false});var g=this.getViewPortPxFromLonLat(this.getCenter());var b=g.add(d,c);if(!f.dragging||!b.equals(g)){var a=this.getLonLatFromViewPortPx(b);if(f.animate){this.panTo(a)}else{this.setCenter(a,null,f.dragging)}}},panTo:function(b){if(this.panMethod&&this.getExtent().scale(this.panRatio).containsLonLat(b)){if(!this.panTween){this.panTween=new OpenLayers.Tween(this.panMethod)}var a=this.getCenter();if(b.lon==a.lon&&b.lat==a.lat){return}var d={lon:a.lon,lat:a.lat};var c={lon:b.lon,lat:b.lat};this.panTween.start(d,c,this.panDuration,{callbacks:{start:OpenLayers.Function.bind(function(f){this.events.triggerEvent("movestart")},this),eachStep:OpenLayers.Function.bind(function(f){f=new OpenLayers.LonLat(f.lon,f.lat);this.moveTo(f,this.zoom,{dragging:true,noEvent:true})},this),done:OpenLayers.Function.bind(function(f){f=new OpenLayers.LonLat(f.lon,f.lat);this.moveTo(f,this.zoom,{noEvent:true});this.events.triggerEvent("moveend")},this)}})}else{this.setCenter(b)}},setCenter:function(c,a,b,d){this.moveTo(c,a,{dragging:b,forceZoomChange:d,caller:"setCenter"})},moveTo:function(h,r,u){if(!u){u={}}var q=u.dragging;var c=u.forceZoomChange;var k=u.noEvent;if(this.panTween&&u.caller=="setCenter"){this.panTween.stop()}if(!this.center&&!this.isValidLonLat(h)){h=this.maxExtent.getCenterLonLat()}if(this.restrictedExtent!=null){if(h==null){h=this.getCenter()}if(r==null){r=this.getZoom()}var d=this.getResolutionForZoom(r);var s=this.calculateBounds(h,d);if(!this.restrictedExtent.containsBounds(s)){var t=this.restrictedExtent.getCenterLonLat();if(s.getWidth()>this.restrictedExtent.getWidth()){h=new OpenLayers.LonLat(t.lon,h.lat)}else{if(s.left<this.restrictedExtent.left){h=h.add(this.restrictedExtent.left-s.left,0)}else{if(s.right>this.restrictedExtent.right){h=h.add(this.restrictedExtent.right-s.right,0)}}}if(s.getHeight()>this.restrictedExtent.getHeight()){h=new OpenLayers.LonLat(h.lon,t.lat)}else{if(s.bottom<this.restrictedExtent.bottom){h=h.add(0,this.restrictedExtent.bottom-s.bottom)}else{if(s.top>this.restrictedExtent.top){h=h.add(0,this.restrictedExtent.top-s.top)}}}}}var b=c||((this.isValidZoomLevel(r))&&(r!=this.getZoom()));var f=(this.isValidLonLat(h))&&(!h.equals(this.center));if(b||f||!q){if(!this.dragging&&!k){this.events.triggerEvent("movestart")}if(f){if((!b)&&(this.center)){this.centerLayerContainer(h)}this.center=h.clone()}if((b)||(this.layerContainerOrigin==null)){this.layerContainerOrigin=this.center.clone();this.layerContainerDiv.style.left="0px";this.layerContainerDiv.style.top="0px"}if(b){this.zoom=r;this.resolution=this.getResolutionForZoom(r);this.viewRequestID++}var a=this.getExtent();if(this.baseLayer.visibility){this.baseLayer.moveTo(a,b,q);if(q){this.baseLayer.events.triggerEvent("move")}else{this.baseLayer.events.triggerEvent("moveend",{zoomChanged:b})}}a=this.baseLayer.getExtent();for(var g=0,o=this.layers.length;g<o;g++){var l=this.layers[g];if(l!==this.baseLayer&&!l.isBaseLayer){var p=l.calculateInRange();if(l.inRange!=p){l.inRange=p;if(!p){l.display(false)}this.events.triggerEvent("changelayer",{layer:l,property:"visibility"})}if(p&&l.visibility){l.moveTo(a,b,q);if(q){l.events.triggerEvent("move")}else{l.events.triggerEvent("moveend",{zoomChanged:b})}}}}if(b){for(var g=0,o=this.popups.length;g<o;g++){this.popups[g].updatePosition()}}this.events.triggerEvent("move");if(b){this.events.triggerEvent("zoomend")}}if(!q&&!k){this.events.triggerEvent("moveend")}this.dragging=!!q},centerLayerContainer:function(b){var a=this.getViewPortPxFromLonLat(this.layerContainerOrigin);var c=this.getViewPortPxFromLonLat(b);if((a!=null)&&(c!=null)){this.layerContainerDiv.style.left=Math.round(a.x-c.x)+"px";this.layerContainerDiv.style.top=Math.round(a.y-c.y)+"px"}},isValidZoomLevel:function(a){return((a!=null)&&(a>=0)&&(a<this.getNumZoomLevels()))},isValidLonLat:function(c){var b=false;if(c!=null){var a=this.getMaxExtent();b=a.containsLonLat(c)}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(b){var a=null;if(b&&b.restricted&&this.restrictedExtent){a=this.restrictedExtent}else{if(this.baseLayer!=null){a=this.baseLayer.maxExtent}}return a},getNumZoomLevels:function(){var a=null;if(this.baseLayer!=null){a=this.baseLayer.numZoomLevels}return a},getExtent:function(){var a=null;if(this.baseLayer!=null){a=this.baseLayer.getExtent()}return a},getResolution:function(){var a=null;if(this.baseLayer!=null){a=this.baseLayer.getResolution()}return a},getUnits:function(){var a=null;if(this.baseLayer!=null){a=this.baseLayer.units}return a},getScale:function(){var c=null;if(this.baseLayer!=null){var b=this.getResolution();var a=this.baseLayer.units;c=OpenLayers.Util.getScaleFromResolution(b,a)}return c},getZoomForExtent:function(c,b){var a=null;if(this.baseLayer!=null){a=this.baseLayer.getZoomForExtent(c,b)}return a},getResolutionForZoom:function(b){var a=null;if(this.baseLayer){a=this.baseLayer.getResolutionForZoom(b)}return a},getZoomForResolution:function(a,c){var b=null;if(this.baseLayer!=null){b=this.baseLayer.getZoomForResolution(a,c)}return b},zoomTo:function(a){if(this.isValidZoomLevel(a)){this.setCenter(null,a)}},zoomIn:function(){this.zoomTo(this.getZoom()+1)},zoomOut:function(){this.zoomTo(this.getZoom()-1)},zoomToExtent:function(d,c){var b=d.getCenterLonLat();if(this.baseLayer.wrapDateLine){var a=this.getMaxExtent();d=d.clone();while(d.right<d.left){d.right+=a.getWidth()}b=d.getCenterLonLat().wrapDateLine(a)}this.setCenter(b,this.getZoomForExtent(d,c))},zoomToMaxExtent:function(c){var b=(c)?c.restricted:true;var a=this.getMaxExtent({restricted:b});this.zoomToExtent(a)},zoomToScale:function(k,h){var d=OpenLayers.Util.getResolutionFromScale(k,this.baseLayer.units);var c=this.getSize();var g=c.w*d;var b=c.h*d;var a=this.getCenter();var f=new OpenLayers.Bounds(a.lon-g/2,a.lat-b/2,a.lon+g/2,a.lat+b/2);this.zoomToExtent(f,h)},getLonLatFromViewPortPx:function(a){var b=null;if(this.baseLayer!=null){b=this.baseLayer.getLonLatFromViewPortPx(a)}return b},getViewPortPxFromLonLat:function(b){var a=null;if(this.baseLayer!=null){a=this.baseLayer.getViewPortPxFromLonLat(b)}return a},getLonLatFromPixel:function(a){return this.getLonLatFromViewPortPx(a)},getPixelFromLonLat:function(b){var a=this.getViewPortPxFromLonLat(b);a.x=Math.round(a.x);a.y=Math.round(a.y);return a},getViewPortPxFromLayerPx:function(d){var c=null;if(d!=null){var b=parseInt(this.layerContainerDiv.style.left);var a=parseInt(this.layerContainerDiv.style.top);c=d.add(b,a)}return c},getLayerPxFromViewPortPx:function(c){var d=null;if(c!=null){var b=-parseInt(this.layerContainerDiv.style.left);var a=-parseInt(this.layerContainerDiv.style.top);d=c.add(b,a);if(isNaN(d.x)||isNaN(d.y)){d=null}}return d},getLonLatFromLayerPx:function(a){a=this.getViewPortPxFromLayerPx(a);return this.getLonLatFromViewPortPx(a)},getLayerPxFromLonLat:function(b){var a=this.getPixelFromLonLat(b);return this.getLayerPxFromViewPortPx(a)},CLASS_NAME:"OpenLayers.Map"});OpenLayers.Map.TILE_WIDTH=256;OpenLayers.Map.TILE_HEIGHT=256;OpenLayers.Marker=OpenLayers.Class({icon:null,lonlat:null,events:null,map:null,initialize:function(c,b){this.lonlat=c;var a=(b)?b:OpenLayers.Marker.defaultIcon();if(this.icon==null){this.icon=a}else{this.icon.url=a.url;this.icon.size=a.size;this.icon.offset=a.offset;this.icon.calculateOffset=a.calculateOffset}this.events=new OpenLayers.Events(this,this.icon.imageDiv,null)},destroy:function(){this.erase();this.map=null;this.events.destroy();this.events=null;if(this.icon!=null){this.icon.destroy();this.icon=null}},draw:function(a){return this.icon.draw(a)},erase:function(){if(this.icon!=null){this.icon.erase()}},moveTo:function(a){if((a!=null)&&(this.icon!=null)){this.icon.moveTo(a)}this.lonlat=this.map.getLonLatFromLayerPx(a)},isDrawn:function(){var a=(this.icon&&this.icon.isDrawn());return a},onScreen:function(){var b=false;if(this.map){var a=this.map.getExtent();b=a.containsLonLat(this.lonlat)}return b},inflate:function(b){if(this.icon){var a=new OpenLayers.Size(this.icon.size.w*b,this.icon.size.h*b);this.icon.setSize(a)}},setOpacity:function(a){this.icon.setOpacity(a)},setUrl:function(a){this.icon.setUrl(a)},display:function(a){this.icon.display(a)},CLASS_NAME:"OpenLayers.Marker"});OpenLayers.Marker.defaultIcon=function(){var a=OpenLayers.Util.getImagesLocation()+"marker.png";var b=new OpenLayers.Size(21,25);var c=function(d){return new OpenLayers.Pixel(-(d.w/2),-d.h)};return new OpenLayers.Icon(a,b,null,c)};OpenLayers.Popup.FramedCloud=OpenLayers.Class(OpenLayers.Popup.Framed,{contentDisplayClass:"olFramedCloudPopupContent",autoSize:true,panMapIfOutOfView:true,imageSize:new OpenLayers.Size(676,736),isAlphaImage:false,fixedRelativePosition:false,positionBlocks:{tl:{offset:new OpenLayers.Pixel(44,0),padding:new OpenLayers.Bounds(8,40,8,9),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,51,22,0),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,50,0,0),position:new OpenLayers.Pixel(-638,0)},{size:new OpenLayers.Size("auto",19),anchor:new OpenLayers.Bounds(0,32,22,null),position:new OpenLayers.Pixel(0,-631)},{size:new OpenLayers.Size(22,18),anchor:new OpenLayers.Bounds(null,32,0,null),position:new OpenLayers.Pixel(-638,-632)},{size:new OpenLayers.Size(81,35),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(0,-688)}]},tr:{offset:new OpenLayers.Pixel(-45,0),padding:new OpenLayers.Bounds(8,40,8,9),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,51,22,0),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,50,0,0),position:new OpenLayers.Pixel(-638,0)},{size:new OpenLayers.Size("auto",19),anchor:new OpenLayers.Bounds(0,32,22,null),position:new OpenLayers.Pixel(0,-631)},{size:new OpenLayers.Size(22,19),anchor:new OpenLayers.Bounds(null,32,0,null),position:new OpenLayers.Pixel(-638,-631)},{size:new OpenLayers.Size(81,35),anchor:new OpenLayers.Bounds(0,0,null,null),position:new OpenLayers.Pixel(-215,-687)}]},bl:{offset:new OpenLayers.Pixel(45,0),padding:new OpenLayers.Bounds(8,9,8,40),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,21,22,32),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,21,0,32),position:new OpenLayers.Pixel(-638,0)},{size:new OpenLayers.Size("auto",21),anchor:new OpenLayers.Bounds(0,0,22,null),position:new OpenLayers.Pixel(0,-629)},{size:new OpenLayers.Size(22,21),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(-638,-629)},{size:new OpenLayers.Size(81,33),anchor:new OpenLayers.Bounds(null,null,0,0),position:new OpenLayers.Pixel(-101,-674)}]},br:{offset:new OpenLayers.Pixel(-44,0),padding:new OpenLayers.Bounds(8,9,8,40),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,21,22,32),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,21,0,32),position:new OpenLayers.Pixel(-638,0)},{size:new OpenLayers.Size("auto",21),anchor:new OpenLayers.Bounds(0,0,22,null),position:new OpenLayers.Pixel(0,-629)},{size:new OpenLayers.Size(22,21),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(-638,-629)},{size:new OpenLayers.Size(81,33),anchor:new OpenLayers.Bounds(0,null,null,0),position:new OpenLayers.Pixel(-311,-674)}]}},minSize:new OpenLayers.Size(105,10),maxSize:new OpenLayers.Size(600,660),initialize:function(h,c,g,b,a,f,d){this.imageSrc=OpenLayers.Util.getImagesLocation()+"cloud-popup-relative.png";OpenLayers.Popup.Framed.prototype.initialize.apply(this,arguments);this.contentDiv.className=this.contentDisplayClass},destroy:function(){OpenLayers.Popup.Framed.prototype.destroy.apply(this,arguments)},CLASS_NAME:"OpenLayers.Popup.FramedCloud"});OpenLayers.Request={DEFAULT_CONFIG:{method:"GET",url:window.location.href,async:true,user:undefined,password:undefined,params:null,proxy:OpenLayers.ProxyHost,headers:{},data:null,callback:function(){},success:null,failure:null,scope:null},events:new OpenLayers.Events(this,null,["complete","success","failure"]),issue:function(d){var h=OpenLayers.Util.extend(this.DEFAULT_CONFIG,{proxy:OpenLayers.ProxyHost});d=OpenLayers.Util.applyDefaults(d,h);var g=new OpenLayers.Request.XMLHttpRequest();var a=d.url;if(d.params){var f=OpenLayers.Util.getParameterString(d.params);if(f.length>0){var l=(a.indexOf("?")>-1)?"&":"?";a+=l+f}}if(d.proxy&&(a.indexOf("http")==0)){a=d.proxy+encodeURIComponent(a)}g.open(d.method,a,d.async,d.user,d.password);for(var k in d.headers){g.setRequestHeader(k,d.headers[k])}var b=(d.scope)?OpenLayers.Function.bind(d.callback,d.scope):d.callback;var o;if(d.success){o=(d.scope)?OpenLayers.Function.bind(d.success,d.scope):d.success}var c;if(d.failure){c=(d.scope)?OpenLayers.Function.bind(d.failure,d.scope):d.failure}var p=this.events;g.onreadystatechange=function(){if(g.readyState==OpenLayers.Request.XMLHttpRequest.DONE){var q=p.triggerEvent("complete",{request:g,config:d,requestUrl:a});if(q!==false){b(g);if(!g.status||(g.status>=200&&g.status<300)){p.triggerEvent("success",{request:g,config:d,requestUrl:a});if(o){o(g)}}if(g.status&&(g.status<200||g.status>=300)){p.triggerEvent("failure",{request:g,config:d,requestUrl:a});if(c){c(g)}}}}};if(d.async===false){g.send(d.data)}else{window.setTimeout(function(){g.send(d.data)},0)}return g},GET:function(a){a=OpenLayers.Util.extend(a,{method:"GET"});return OpenLayers.Request.issue(a)},POST:function(a){a=OpenLayers.Util.extend(a,{method:"POST"});a.headers=a.headers?a.headers:{};if(!("CONTENT-TYPE" in OpenLayers.Util.upperCaseObject(a.headers))){a.headers["Content-Type"]="application/xml"}return OpenLayers.Request.issue(a)},PUT:function(a){a=OpenLayers.Util.extend(a,{method:"PUT"});a.headers=a.headers?a.headers:{};if(!("CONTENT-TYPE" in OpenLayers.Util.upperCaseObject(a.headers))){a.headers["Content-Type"]="application/xml"}return OpenLayers.Request.issue(a)},DELETE:function(a){a=OpenLayers.Util.extend(a,{method:"DELETE"});return OpenLayers.Request.issue(a)},HEAD:function(a){a=OpenLayers.Util.extend(a,{method:"HEAD"});return OpenLayers.Request.issue(a)},OPTIONS:function(a){a=OpenLayers.Util.extend(a,{method:"OPTIONS"});return OpenLayers.Request.issue(a)}};OpenLayers.Tile.Image=OpenLayers.Class(OpenLayers.Tile,{url:null,imgDiv:null,frame:null,layerAlphaHack:null,isBackBuffer:false,lastRatio:1,isFirstDraw:true,backBufferTile:null,initialize:function(d,a,f,b,c){OpenLayers.Tile.prototype.initialize.apply(this,arguments);this.url=b;this.frame=document.createElement("div");this.frame.style.overflow="hidden";this.frame.style.position="absolute";this.layerAlphaHack=this.layer.alpha&&OpenLayers.Util.alphaHack()},destroy:function(){if(this.imgDiv!=null){if(this.layerAlphaHack){OpenLayers.Event.stopObservingElement(this.imgDiv.childNodes[0].id)}OpenLayers.Event.stopObservingElement(this.imgDiv.id);if(this.imgDiv.parentNode==this.frame){this.frame.removeChild(this.imgDiv);this.imgDiv.map=null}this.imgDiv.urls=null;this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif"}this.imgDiv=null;if((this.frame!=null)&&(this.frame.parentNode==this.layer.div)){this.layer.div.removeChild(this.frame)}this.frame=null;if(this.backBufferTile){this.backBufferTile.destroy();this.backBufferTile=null}this.layer.events.unregister("loadend",this,this.resetBackBuffer);OpenLayers.Tile.prototype.destroy.apply(this,arguments)},clone:function(a){if(a==null){a=new OpenLayers.Tile.Image(this.layer,this.position,this.bounds,this.url,this.size)}a=OpenLayers.Tile.prototype.clone.apply(this,[a]);a.imgDiv=null;return a},draw:function(){if(this.layer!=this.layer.map.baseLayer&&this.layer.reproject){this.bounds=this.getBoundsFromBaseLayer(this.position)}var a=OpenLayers.Tile.prototype.draw.apply(this,arguments);if(OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1){if(a){if(!this.backBufferTile){this.backBufferTile=this.clone();this.backBufferTile.hide();this.backBufferTile.isBackBuffer=true;this.events.register("loadend",this,this.resetBackBuffer);this.layer.events.register("loadend",this,this.resetBackBuffer)}this.startTransition()}else{if(this.backBufferTile){this.backBufferTile.clear()}}}else{if(a&&this.isFirstDraw){this.events.register("loadend",this,this.showTile);this.isFirstDraw=false}}if(!a){return false}if(this.isLoading){this.events.triggerEvent("reload")}else{this.isLoading=true;this.events.triggerEvent("loadstart")}return this.renderTile()},resetBackBuffer:function(){this.showTile();if(this.backBufferTile&&(this.isFirstDraw||!this.layer.numLoadingTiles)){this.isFirstDraw=false;var a=this.layer.maxExtent;var b=(a&&this.bounds.intersectsBounds(a,false));if(b){this.backBufferTile.position=this.position;this.backBufferTile.bounds=this.bounds;this.backBufferTile.size=this.size;this.backBufferTile.imageSize=this.layer.imageSize||this.size;this.backBufferTile.imageOffset=this.layer.imageOffset;this.backBufferTile.resolution=this.layer.getResolution();this.backBufferTile.renderTile()}this.backBufferTile.hide()}},renderTile:function(){if(this.imgDiv==null){this.initImgDiv()}this.imgDiv.viewRequestID=this.layer.map.viewRequestID;if(this.layer.async){this.layer.getURLasync(this.bounds,this,"url",this.positionImage)}else{if(this.layer.url instanceof Array){this.imgDiv.urls=this.layer.url.slice()}this.url=this.layer.getURL(this.bounds);this.positionImage()}return true},positionImage:function(){if(this.layer==null){return}OpenLayers.Util.modifyDOMElement(this.frame,null,this.position,this.size);var a=this.layer.getImageSize();if(this.layerAlphaHack){OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv,null,null,a,this.url)}else{OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,a);this.imgDiv.src=this.url}},clear:function(){if(this.imgDiv){this.hide();if(OpenLayers.Tile.Image.useBlankTile){this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif"}}},initImgDiv:function(){var d=this.layer.imageOffset;var b=this.layer.getImageSize();if(this.layerAlphaHack){this.imgDiv=OpenLayers.Util.createAlphaImageDiv(null,d,b,null,"relative",null,null,null,true)}else{this.imgDiv=OpenLayers.Util.createImage(null,d,b,null,"relative",null,null,true)}this.imgDiv.className="olTileImage";this.frame.style.zIndex=this.isBackBuffer?0:1;this.frame.appendChild(this.imgDiv);this.layer.div.appendChild(this.frame);if(this.layer.opacity!=null){OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,null,null,null,null,this.layer.opacity)}this.imgDiv.map=this.layer.map;var c=function(){if(this.isLoading){this.isLoading=false;this.events.triggerEvent("loadend")}};if(this.layerAlphaHack){OpenLayers.Event.observe(this.imgDiv.childNodes[0],"load",OpenLayers.Function.bind(c,this))}else{OpenLayers.Event.observe(this.imgDiv,"load",OpenLayers.Function.bind(c,this))}var a=function(){if(this.imgDiv._attempts>OpenLayers.IMAGE_RELOAD_ATTEMPTS){c.call(this)}};OpenLayers.Event.observe(this.imgDiv,"error",OpenLayers.Function.bind(a,this))},checkImgURL:function(){if(this.layer){var a=this.layerAlphaHack?this.imgDiv.firstChild.src:this.imgDiv.src;if(!OpenLayers.Util.isEquivalentUrl(a,this.url)){this.hide()}}},startTransition:function(){if(!this.backBufferTile||!this.backBufferTile.imgDiv){return}var d=1;if(this.backBufferTile.resolution){d=this.backBufferTile.resolution/this.layer.getResolution()}if(d!=this.lastRatio){if(this.layer.transitionEffect=="resize"){var c=new OpenLayers.LonLat(this.backBufferTile.bounds.left,this.backBufferTile.bounds.top);var b=new OpenLayers.Size(this.backBufferTile.size.w*d,this.backBufferTile.size.h*d);var a=this.layer.map.getLayerPxFromLonLat(c);OpenLayers.Util.modifyDOMElement(this.backBufferTile.frame,null,a,b);var f=this.backBufferTile.imageSize;f=new OpenLayers.Size(f.w*d,f.h*d);var g=this.backBufferTile.imageOffset;if(g){g=new OpenLayers.Pixel(g.x*d,g.y*d)}OpenLayers.Util.modifyDOMElement(this.backBufferTile.imgDiv,null,g,f);this.backBufferTile.show()}}else{if(this.layer.singleTile){this.backBufferTile.show()}else{this.backBufferTile.hide()}}this.lastRatio=d},show:function(){this.frame.style.display="";if(OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1){if(navigator.userAgent.toLowerCase().indexOf("gecko")!=-1){this.frame.scrollLeft=this.frame.scrollLeft}}},hide:function(){this.frame.style.display="none"},CLASS_NAME:"OpenLayers.Tile.Image"});OpenLayers.Tile.Image.useBlankTile=(OpenLayers.Util.getBrowserName()=="safari"||OpenLayers.Util.getBrowserName()=="opera");OpenLayers.Control.OverviewMap=OpenLayers.Class(OpenLayers.Control,{element:null,ovmap:null,size:new OpenLayers.Size(180,90),layers:null,minRectSize:15,minRectDisplayClass:"RectReplacement",minRatio:8,maxRatio:32,mapOptions:null,autoPan:false,handlers:null,resolutionFactor:1,initialize:function(a){this.layers=[];this.handlers={};OpenLayers.Control.prototype.initialize.apply(this,[a])},destroy:function(){if(!this.mapDiv){return}this.handlers.click.destroy();this.mapDiv.removeChild(this.extentRectangle);this.extentRectangle=null;this.rectEvents.destroy();this.rectEvents=null;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 d=this.map.baseLayer.clone();this.layers=[d]}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=1000;this.extentRectangle.className=this.displayClass+"ExtentRectangle";this.mapDiv.appendChild(this.extentRectangle);this.element.appendChild(this.mapDiv);this.div.appendChild(this.element);if(!this.outsideViewport){this.div.className+=" "+this.displayClass+"Container";var f=OpenLayers.Util.getImagesLocation();var b=f+"layer-switcher-maximize.png";this.maximizeDiv=OpenLayers.Util.createAlphaImageDiv(this.displayClass+"MaximizeButton",null,new OpenLayers.Size(18,18),b,"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 b=f+"layer-switcher-minimize.png";this.minimizeDiv=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_minimizeDiv",null,new OpenLayers.Size(18,18),b,"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 g=["dblclick","mousedown"];for(var c=0,a=g.length;c<a;c++){OpenLayers.Event.observe(this.maximizeDiv,g[c],OpenLayers.Event.stop);OpenLayers.Event.observe(this.minimizeDiv,g[c],OpenLayers.Event.stop)}this.minimizeControl()}else{this.element.style.display=""}if(this.map.getExtent()){this.update()}this.map.events.register("moveend",this,this.update);return this.div},baseLayerDraw:function(){this.draw();this.map.events.unregister("changebaselayer",this,this.baseLayerDraw)},rectDrag:function(l){var d=this.handlers.drag.last.x-l.x;var b=this.handlers.drag.last.y-l.y;if(d!=0||b!=0){var h=this.rectPxBounds.top;var a=this.rectPxBounds.left;var f=Math.abs(this.rectPxBounds.getHeight());var c=this.rectPxBounds.getWidth();var g=Math.max(0,(h-b));g=Math.min(g,this.ovmap.size.h-this.hComp-f);var k=Math.max(0,(a-d));k=Math.min(k,this.ovmap.size.w-this.wComp-c);this.setRectPxBounds(new OpenLayers.Bounds(k,g+f,k+c,g))}},mapDivClick:function(l){var b=this.rectPxBounds.getCenterPixel();var f=l.xy.x-b.x;var d=l.xy.y-b.y;var h=this.rectPxBounds.top;var c=this.rectPxBounds.left;var o=Math.abs(this.rectPxBounds.getHeight());var a=this.rectPxBounds.getWidth();var g=Math.max(0,(h+d));g=Math.min(g,this.ovmap.size.h-o);var k=Math.max(0,(c+f));k=Math.min(k,this.ovmap.size.w-a);this.setRectPxBounds(new OpenLayers.Bounds(k,g+o,k+a,g));this.updateMapToRect()},maximizeControl:function(a){this.element.style.display="";this.showToggle(false);if(a!=null){OpenLayers.Event.stop(a)}},minimizeControl:function(a){this.element.style.display="none";this.showToggle(true);if(a!=null){OpenLayers.Event.stop(a)}},showToggle:function(a){this.maximizeDiv.style.display=a?"":"none";this.minimizeDiv.style.display=a?"none":""},update:function(){if(this.ovmap==null){this.createMap()}if(this.autoPan||!this.isSuitableOverview()){this.updateOverview()}this.updateRectToMap()},isSuitableOverview:function(){var b=this.map.getExtent();var a=this.map.maxExtent;var c=new OpenLayers.Bounds(Math.max(b.left,a.left),Math.max(b.bottom,a.bottom),Math.min(b.right,a.right),Math.min(b.top,a.top));if(this.ovmap.getProjection()!=this.map.getProjection()){c=c.transform(this.map.getProjectionObject(),this.ovmap.getProjectionObject())}var d=this.ovmap.getResolution()/this.map.getResolution();return((d>this.minRatio)&&(d<=this.maxRatio)&&(this.ovmap.getExtent().containsBounds(c)))},updateOverview:function(){var c=this.map.getResolution();var b=this.ovmap.getResolution();var d=b/c;if(d>this.maxRatio){b=this.minRatio*c}else{if(d<=this.minRatio){b=this.maxRatio*c}}var a;if(this.ovmap.getProjection()!=this.map.getProjection()){a=this.map.center.clone();a.transform(this.map.getProjectionObject(),this.ovmap.getProjectionObject())}else{a=this.map.center}this.ovmap.setCenter(a,this.ovmap.getZoomForResolution(b*this.resolutionFactor));this.updateRectToMap()},createMap:function(){var b=OpenLayers.Util.extend({controls:[],maxResolution:"auto",fallThrough:false},this.mapOptions);this.ovmap=new OpenLayers.Map(this.mapDiv,b);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(d){if(!this.handlers.drag.active&&!this.map.dragging){this.handlers.drag.activate()}});this.rectEvents.register("mouseout",this,function(d){if(!this.handlers.drag.dragging){this.handlers.drag.deactivate()}});if(this.ovmap.getProjection()!=this.map.getProjection()){var c=this.map.getProjectionObject().getUnits()||this.map.units||this.map.baseLayer.units;var a=this.ovmap.getProjectionObject().getUnits()||this.ovmap.units||this.ovmap.baseLayer.units;this.resolutionFactor=c&&a?OpenLayers.INCHES_PER_UNIT[c]/OpenLayers.INCHES_PER_UNIT[a]:1}},updateRectToMap:function(){var b;if(this.ovmap.getProjection()!=this.map.getProjection()){b=this.map.getExtent().transform(this.map.getProjectionObject(),this.ovmap.getProjectionObject())}else{b=this.map.getExtent()}var a=this.getRectBoundsFromMapBounds(b);if(a){this.setRectPxBounds(a)}},updateMapToRect:function(){var a=this.getMapBoundsFromRectBounds(this.rectPxBounds);if(this.ovmap.getProjection()!=this.map.getProjection()){a=a.transform(this.ovmap.getProjectionObject(),this.map.getProjectionObject())}this.map.panTo(a.getCenterLonLat())},setRectPxBounds:function(d){var h=Math.max(d.top,0);var f=Math.max(d.left,0);var b=Math.min(d.top+Math.abs(d.getHeight()),this.ovmap.size.h-this.hComp);var k=Math.min(d.left+d.getWidth(),this.ovmap.size.w-this.wComp);var c=Math.max(k-f,0);var l=Math.max(b-h,0);if(c<this.minRectSize||l<this.minRectSize){this.extentRectangle.className=this.displayClass+this.minRectDisplayClass;var g=f+(c/2)-(this.minRectSize/2);var a=h+(l/2)-(this.minRectSize/2);this.extentRectangle.style.top=Math.round(a)+"px";this.extentRectangle.style.left=Math.round(g)+"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(h)+"px";this.extentRectangle.style.left=Math.round(f)+"px";this.extentRectangle.style.height=Math.round(l)+"px";this.extentRectangle.style.width=Math.round(c)+"px"}this.rectPxBounds=new OpenLayers.Bounds(Math.round(f),Math.round(b),Math.round(k),Math.round(h))},getRectBoundsFromMapBounds:function(d){var a=new OpenLayers.LonLat(d.left,d.bottom);var g=new OpenLayers.LonLat(d.right,d.top);var c=this.getOverviewPxFromLonLat(a);var b=this.getOverviewPxFromLonLat(g);var f=null;if(c&&b){f=new OpenLayers.Bounds(c.x,c.y,b.x,b.y)}return f},getMapBoundsFromRectBounds:function(d){var c=new OpenLayers.Pixel(d.left,d.bottom);var b=new OpenLayers.Pixel(d.right,d.top);var a=this.getLonLatFromOverviewPx(c);var f=this.getLonLatFromOverviewPx(b);return new OpenLayers.Bounds(a.lon,a.lat,f.lon,f.lat)},getLonLatFromOverviewPx:function(g){var c=this.ovmap.size;var b=this.ovmap.getResolution();var a=this.ovmap.getExtent().getCenterLonLat();var f=g.x-(c.w/2);var d=g.y-(c.h/2);return new OpenLayers.LonLat(a.lon+f*b,a.lat-d*b)},getOverviewPxFromLonLat:function(d){var b=this.ovmap.getResolution();var c=this.ovmap.getExtent();var a=null;if(c){a=new OpenLayers.Pixel(Math.round(1/b*(d.lon-c.left)),Math.round(1/b*(c.top-d.lat)))}return a},CLASS_NAME:"OpenLayers.Control.OverviewMap"});OpenLayers.Feature=OpenLayers.Class({layer:null,id:null,lonlat:null,data:null,marker:null,popupClass:OpenLayers.Popup.AnchoredBubble,popup:null,initialize:function(a,c,b){this.layer=a;this.lonlat=c;this.data=(b!=null)?b:{};this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){if((this.layer!=null)&&(this.layer.map!=null)){if(this.popup!=null){this.layer.map.removePopup(this.popup)}}this.layer=null;this.id=null;this.lonlat=null;this.data=null;if(this.marker!=null){this.destroyMarker(this.marker);this.marker=null}if(this.popup!=null){this.destroyPopup(this.popup);this.popup=null}},onScreen:function(){var b=false;if((this.layer!=null)&&(this.layer.map!=null)){var a=this.layer.map.getExtent();b=a.containsLonLat(this.lonlat)}return b},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(b){if(this.lonlat!=null){var c=this.id+"_popup";var a=(this.marker)?this.marker.icon:null;if(!this.popup){this.popup=new this.popupClass(c,this.lonlat,this.data.popupSize,this.data.popupContentHTML,a,b)}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.Format.WFSCapabilities=OpenLayers.Class(OpenLayers.Format.XML,{defaultVersion:"1.1.0",version:null,initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a]);this.options=a},read:function(f){if(typeof f=="string"){f=OpenLayers.Format.XML.prototype.read.apply(this,[f])}var c=f.documentElement;var b=this.version;if(!b){b=c.getAttribute("version");if(!b){b=this.defaultVersion}}var d=OpenLayers.Format.WFSCapabilities["v"+b.replace(/\./g,"_")];if(!d){throw"Can't find a WFS capabilities parser for version "+b}var g=new d(this.options);var a=g.read(f);a.version=b;return a},CLASS_NAME:"OpenLayers.Format.WFSCapabilities"});OpenLayers.Format.WFSDescribeFeatureType=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{xsd:"http://www.w3.org/2001/XMLSchema"},initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},readers:{xsd:{schema:function(d,l){var f=[];var b={};var g={complexTypes:f,customTypes:b};this.readChildNodes(d,g);var h=d.attributes;var p,a;for(var k=0,o=h.length;k<o;++k){p=h[k];a=p.name;if(a.indexOf("xmlns")==0){this.setNamespace(a.split(":")[1]||"",p.value)}else{l[a]=p.value}}l.featureTypes=f;l.targetPrefix=this.namespaceAlias[l.targetNamespace];var q,c;for(var k=0,o=f.length;k<o;++k){q=f[k];c=b[q.typeName];if(b[q.typeName]){q.typeName=c.name}}},complexType:function(b,c){var a={typeName:b.getAttribute("name")};this.readChildNodes(b,a);c.complexTypes.push(a)},complexContent:function(a,b){this.readChildNodes(a,b)},extension:function(a,b){this.readChildNodes(a,b)},sequence:function(a,b){var c={elements:[]};this.readChildNodes(a,c);b.properties=c.elements},element:function(a,c){if(c.elements){var d={};var b=a.attributes;var h;for(var f=0,g=b.length;f<g;++f){h=b[f];d[h.name]=h.value}var k=d.type;if(!k){k={};this.readChildNodes(a,k);d.restriction=k;d.type=k.base}var o=k.base||k;d.localType=o.split(":").pop();c.elements.push(d)}if(c.complexTypes){var k=a.getAttribute("type");var l=k.split(":").pop();c.customTypes[l]={name:a.getAttribute("name"),type:k}}},simpleType:function(a,b){this.readChildNodes(a,b)},restriction:function(a,b){b.base=a.getAttribute("base");this.readRestriction(a,b)}}},readRestriction:function(d,g){var c=d.childNodes;var k,h,f;for(var b=0,a=c.length;b<a;++b){k=c[b];if(k.nodeType==1){h=k.nodeName.split(":").pop();f=k.getAttribute("value");if(!g[h]){g[h]=f}else{if(typeof g[h]=="string"){g[h]=[g[h]]}g[h].push(f)}}}},read:function(b){if(typeof b=="string"){b=OpenLayers.Format.XML.prototype.read.apply(this,[b])}if(b&&b.nodeType==9){b=b.documentElement}var a={};this.readNode(b,a);return a},CLASS_NAME:"OpenLayers.Format.WFSDescribeFeatureType"});OpenLayers.Format.WFST.v1=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance",wfs:"http://www.opengis.net/wfs",gml:"http://www.opengis.net/gml",ogc:"http://www.opengis.net/ogc"},defaultPrefix:"wfs",version:null,schemaLocations:null,srsName:null,extractAttributes:true,xy:true,stateName:null,initialize:function(a){this.stateName={};this.stateName[OpenLayers.State.INSERT]="wfs:Insert";this.stateName[OpenLayers.State.UPDATE]="wfs:Update";this.stateName[OpenLayers.State.DELETE]="wfs:Delete";OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},getSrsName:function(c,b){var a=b&&b.srsName;if(!a){if(c&&c.layer){a=c.layer.projection.getCode()}else{a=this.srsName}}return a},read:function(a){if(typeof a=="string"){a=OpenLayers.Format.XML.prototype.read.apply(this,[a])}if(a&&a.nodeType==9){a=a.documentElement}var b={};this.readNode(a,b);if(b.features){b=b.features}return b},readers:{wfs:{FeatureCollection:function(a,b){b.features=[];this.readChildNodes(a,b)}}},write:function(a){var b=this.writeNode("wfs:Transaction",a);var c=this.schemaLocationAttr();if(c){this.setAttributeNS(b,this.namespaces.xsi,"xsi:schemaLocation",c)}return OpenLayers.Format.XML.prototype.write.apply(this,[b])},writers:{wfs:{GetFeature:function(a){var b=this.createElementNSPlus("wfs:GetFeature",{attributes:{service:"WFS",version:this.version,maxFeatures:a&&a.maxFeatures,"xsi:schemaLocation":this.schemaLocationAttr(a)}});this.writeNode("Query",a,b);return b},Query:function(a){a=OpenLayers.Util.extend({featureNS:this.featureNS,featurePrefix:this.featurePrefix,featureType:this.featureType,srsName:this.srsName},a);var b=this.createElementNSPlus("wfs:Query",{attributes:{typeName:(a.featureNS?a.featurePrefix+":":"")+a.featureType,srsName:a.srsName}});if(a.featureNS){b.setAttribute("xmlns:"+a.featurePrefix,a.featureNS)}if(a.filter){this.setFilterProperty(a.filter);this.writeNode("ogc:Filter",a.filter,b)}return b},Transaction:function(f){var g=this.createElementNSPlus("wfs:Transaction",{attributes:{service:"WFS",version:this.version}});if(f){var b,d;for(var c=0,a=f.length;c<a;++c){d=f[c];b=this.stateName[d.state];if(b){this.writeNode(b,d,g)}}}return g},Insert:function(a){var b=this.createElementNSPlus("wfs:Insert");this.srsName=this.getSrsName(a);this.writeNode("feature:_typeName",a,b);return b},Update:function(b){var c=this.createElementNSPlus("wfs:Update",{attributes:{typeName:(this.featureNS?this.featurePrefix+":":"")+this.featureType}});if(this.featureNS){c.setAttribute("xmlns:"+this.featurePrefix,this.featureNS)}this.writeNode("Property",{name:this.geometryName,value:b},c);for(var a in b.attributes){this.writeNode("Property",{name:a,value:b.attributes[a]},c)}this.writeNode("ogc:Filter",new OpenLayers.Filter.FeatureId({fids:[b.fid]}),c);return c},Property:function(b){var a=this.createElementNSPlus("wfs:Property");this.writeNode("Name",b.name,a);this.writeNode("Value",b.value,a);return a},Name:function(a){return this.createElementNSPlus("wfs:Name",{value:a})},Value:function(c){var b;if(c instanceof OpenLayers.Feature.Vector){b=this.createElementNSPlus("wfs:Value");this.srsName=this.getSrsName(c);var a=this.writeNode("feature:_geometry",c.geometry).firstChild;b.appendChild(a)}else{b=this.createElementNSPlus("wfs:Value",{value:c})}return b},Delete:function(a){var b=this.createElementNSPlus("wfs:Delete",{attributes:{typeName:(this.featureNS?this.featurePrefix+":":"")+this.featureType}});if(this.featureNS){b.setAttribute("xmlns:"+this.featurePrefix,this.featureNS)}this.writeNode("ogc:Filter",new OpenLayers.Filter.FeatureId({fids:[a.fid]}),b);return b}}},schemaLocationAttr:function(a){a=OpenLayers.Util.extend({featurePrefix:this.featurePrefix,schema:this.schema},a);var g=OpenLayers.Util.extend({},this.schemaLocations);if(a.schema){g[a.featurePrefix]=a.schema}var f=[];var c;for(var b in g){c=this.namespaces[b];if(c){f.push(c+" "+g[b])}}var d=f.join(" ")||undefined;return d},setFilterProperty:function(c){if(c.filters){for(var b=0,a=c.filters.length;b<a;++b){this.setFilterProperty(c.filters[b])}}else{if(c instanceof OpenLayers.Filter.Spatial){c.property=this.geometryName}}},CLASS_NAME:"OpenLayers.Format.WFST.v1"});OpenLayers.Format.WMSCapabilities.v1_1=OpenLayers.Class(OpenLayers.Format.XML,{initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a]);this.options=a},read:function(c){if(typeof c=="string"){c=OpenLayers.Format.XML.prototype.read.apply(this,[c])}var a={};var b=c.documentElement;this.runChildNodes(a,b);return a},runChildNodes:function(g,f){var c=f.childNodes;var b,d;for(var a=0;a<c.length;++a){b=c[a];if(b.nodeType==1){d=this["read_cap_"+b.nodeName];if(d){d.apply(this,[g,b])}}}},read_cap_Capability:function(a,c){var b={layers:[]};this.runChildNodes(b,c);a.capability=b},read_cap_Request:function(c,b){var a={};this.runChildNodes(a,b);c.request=a},read_cap_GetMap:function(c,b){var a={formats:[]};this.runChildNodes(a,b);c.getmap=a},read_cap_Format:function(b,a){if(b.formats){b.formats.push(this.getChildValue(a))}},read_cap_DCPType:function(c,b){var a=b.getElementsByTagName("OnlineResource");if(a.length>0){this.read_cap_OnlineResource(c,a[0])}},read_cap_Service:function(b,c){var a={};this.runChildNodes(a,c);b.service=a},read_cap_Layer:function(b,f,g){var k={formats:b.request.getmap.formats||[],styles:[],queryable:(f.getAttribute("queryable")==="1"||f.getAttribute("queryable")==="true")};if(g){k.styles=k.styles.concat(g.styles);k.llbbox=g.llbbox;k.minScale=g.minScale;k.maxScale=g.maxScale}var c=f.childNodes;var a,o,d;for(var h=0;h<c.length;++h){a=c[h];o=a.nodeName;d=this["read_cap_"+a.nodeName];if(d){if(o=="Layer"){d.apply(this,[b,a,k])}else{d.apply(this,[k,a])}}}if(k.name){var l=k.name.indexOf(":");if(l>0){k.prefix=k.name.substring(0,l)}b.layers.push(k)}},read_cap_ScaleHint:function(f,g){var d=g.getAttribute("min");var a=g.getAttribute("max");var c=Math.pow(2,0.5);var b=OpenLayers.INCHES_PER_UNIT.m;f.maxScale=parseFloat(((c*d)*b*OpenLayers.DOTS_PER_INCH).toPrecision(13));f.minScale=parseFloat(((c*a)*b*OpenLayers.DOTS_PER_INCH).toPrecision(13))},read_cap_Name:function(c,b){var a=this.getChildValue(b);if(a){c.name=a}},read_cap_Title:function(b,a){var c=this.getChildValue(a);if(c){b.title=c}},read_cap_Abstract:function(c,b){var a=this.getChildValue(b);if(a){c["abstract"]=a}},read_cap_LatLonBoundingBox:function(a,b){a.llbbox=[parseFloat(b.getAttribute("minx")),parseFloat(b.getAttribute("miny")),parseFloat(b.getAttribute("maxx")),parseFloat(b.getAttribute("maxy"))]},read_cap_Style:function(a,c){var b={};this.runChildNodes(b,c);a.styles.push(b)},read_cap_LegendURL:function(c,d){var b={width:d.getAttribute("width"),height:d.getAttribute("height")};var a=d.getElementsByTagName("OnlineResource");if(a.length>0){this.read_cap_OnlineResource(b,a[0])}c.legend=b},read_cap_OnlineResource:function(b,a){b.href=this.getAttributeNS(a,"http://www.w3.org/1999/xlink","href")},CLASS_NAME:"OpenLayers.Format.WMSCapabilities.v1_1"});OpenLayers.Format.WMSDescribeLayer=OpenLayers.Class(OpenLayers.Format.XML,{defaultVersion:"1.1.1",version:null,initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a]);this.options=a},read:function(f){if(typeof f=="string"){f=OpenLayers.Format.XML.prototype.read.apply(this,[f])}var c=f.documentElement;var b=this.version;if(!b){b=c.getAttribute("version");if(!b){b=this.defaultVersion}}if(b=="1.1.1"||b=="1.1.0"){b="1.1"}var d=OpenLayers.Format.WMSDescribeLayer["v"+b.replace(/\./g,"_")];if(!d){throw"Can't find a WMS DescribeLayer parser for version "+b}var g=new d(this.options);var a=g.read(f);a.version=b;return a},CLASS_NAME:"OpenLayers.Format.WMSDescribeLayer"});OpenLayers.Format.WMSGetFeatureInfo=OpenLayers.Class(OpenLayers.Format.XML,{layerIdentifier:"_layer",featureIdentifier:"_feature",regExes:{trimSpace:(/^\s*|\s*$/g),removeSpace:(/\s*/g),splitSpace:(/\s+/),trimComma:(/\s*,\s*/g)},gmlFormat:null,initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,arguments);OpenLayers.Util.extend(this,a);this.options=a},read:function(f){var a;if(typeof f=="string"){f=OpenLayers.Format.XML.prototype.read.apply(this,[f])}var b=f.documentElement;if(b){var c=this;var d=this["read_"+b.nodeName];if(d){a=d.call(this,b)}else{a=new OpenLayers.Format.GML((this.options?this.options:{})).read(f)}}else{a=f}return a},read_msGMLOutput:function(h){var d=[];var b=this.getSiblingNodesByTagCriteria(h,this.layerIdentifier);if(b){for(var k=0,p=b.length;k<p;++k){var c=b[k];var l=c.nodeName;if(c.prefix){l=l.split(":")[1]}var l=l.replace(this.layerIdentifier,"");var o=this.getSiblingNodesByTagCriteria(c,this.featureIdentifier);if(o){for(var g=0;g<o.length;g++){var a=o[g];var q=this.parseGeometry(a);var f=this.parseAttributes(a);var r=new OpenLayers.Feature.Vector(q,f,null);r.type=l;d.push(r)}}}}return d},read_FeatureInfoResponse:function(g){var c=[];var k=this.getElementsByTagNameNS(g,"*","FIELDS");for(var h=0,l=k.length;h<l;h++){var a=k[h];var o=null;var f={};for(var d=0,p=a.attributes.length;d<p;d++){var b=a.attributes[d];f[b.nodeName]=b.nodeValue}c.push(new OpenLayers.Feature.Vector(o,f,null))}return c},getSiblingNodesByTagCriteria:function(g,o){var a=[];var c,f,d,h,b;if(g&&g.hasChildNodes()){c=g.childNodes;d=c.length;for(var l=0;l<d;l++){b=c[l];while(b&&b.nodeType!=1){b=b.nextSibling;l++}f=(b?b.nodeName:"");if(f.length>0&&f.indexOf(o)>-1){a.push(b)}else{h=this.getSiblingNodesByTagCriteria(b,o);if(h.length>0){(a.length==0)?a=h:a.push(h)}}}}return a},parseAttributes:function(d){var f={};if(d.nodeType==1){var c=d.childNodes;n=c.length;for(var g=0;g<n;++g){var b=c[g];if(b.nodeType==1){var l=b.childNodes;if(l.length==1){var k=l[0];if(k.nodeType==3||k.nodeType==4){var a=(b.prefix)?b.nodeName.split(":")[1]:b.nodeName;var h=k.nodeValue.replace(this.regExes.trimSpace,"");f[a]=h}}}}}return f},parseGeometry:function(b){if(!this.gmlFormat){this.gmlFormat=new OpenLayers.Format.GML()}var a=this.gmlFormat.parseFeature(b);var c=null;if(a&&a.geometry){c=a.geometry.clone();a.destroy()}return c},CLASS_NAME:"OpenLayers.Format.WMSGetFeatureInfo"});OpenLayers.Handler.Click=OpenLayers.Class(OpenLayers.Handler,{delay:300,single:true,"double":false,pixelTolerance:0,stopSingle:false,stopDouble:false,timerId:null,down:null,rightclickTimerId:null,initialize:function(c,b,a){OpenLayers.Handler.prototype.initialize.apply(this,arguments);if(this.pixelTolerance!=null){this.mousedown=function(d){this.down=d.xy;return true}}},mousedown:null,mouseup:function(b){var a=true;if(this.checkModifiers(b)&&this.control.handleRightClicks&&OpenLayers.Event.isRightClick(b)){a=this.rightclick(b)}return a},rightclick:function(b){if(this.passesTolerance(b)){if(this.rightclickTimerId!=null){this.clearTimer();this.callback("dblrightclick",[b]);return !this.stopDouble}else{var a=this["double"]?OpenLayers.Util.extend({},b):this.callback("rightclick",[b]);var c=OpenLayers.Function.bind(this.delayedRightCall,this,a);this.rightclickTimerId=window.setTimeout(c,this.delay)}}return !this.stopSingle},delayedRightCall:function(a){this.rightclickTimerId=null;if(a){this.callback("rightclick",[a])}return !this.stopSingle},dblclick:function(a){if(this.passesTolerance(a)){if(this["double"]){this.callback("dblclick",[a])}this.clearTimer()}return !this.stopDouble},click:function(b){if(this.passesTolerance(b)){if(this.timerId!=null){this.clearTimer()}else{var a=this.single?OpenLayers.Util.extend({},b):null;this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,a),this.delay)}}return !this.stopSingle},passesTolerance:function(b){var c=true;if(this.pixelTolerance!=null&&this.down){var a=Math.sqrt(Math.pow(this.down.x-b.xy.x,2)+Math.pow(this.down.y-b.xy.y,2));if(a>this.pixelTolerance){c=false}}return c},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;if(a){this.callback("click",[a])}},deactivate:function(){var a=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.clearTimer();this.down=null;a=true}return a},CLASS_NAME:"OpenLayers.Handler.Click"});OpenLayers.Handler.Drag=OpenLayers.Class(OpenLayers.Handler,{started:false,stopDown:true,dragging:false,last:null,start:null,oldOnselectstart:null,interval:0,timeoutId:null,initialize:function(c,b,a){OpenLayers.Handler.prototype.initialize.apply(this,arguments)},down:function(a){},move:function(a){},up:function(a){},out:function(a){},mousedown:function(b){var a=true;this.dragging=false;if(this.checkModifiers(b)&&OpenLayers.Event.isLeftClick(b)){this.started=true;this.start=b.xy;this.last=b.xy;OpenLayers.Element.addClass(this.map.viewPortDiv,"olDragDown");this.down(b);this.callback("down",[b.xy]);OpenLayers.Event.stop(b);if(!this.oldOnselectstart){this.oldOnselectstart=(document.onselectstart)?document.onselectstart:function(){return true};document.onselectstart=function(){return false}}a=!this.stopDown}else{this.started=false;this.start=null;this.last=null}return a},mousemove:function(a){if(this.started&&!this.timeoutId&&(a.xy.x!=this.last.x||a.xy.y!=this.last.y)){if(this.interval>0){this.timeoutId=setTimeout(OpenLayers.Function.bind(this.removeTimeout,this),this.interval)}this.dragging=true;this.move(a);this.callback("move",[a.xy]);if(!this.oldOnselectstart){this.oldOnselectstart=document.onselectstart;document.onselectstart=function(){return false}}this.last=this.evt.xy}return true},removeTimeout:function(){this.timeoutId=null},mouseup:function(b){if(this.started){var a=(this.start!=this.last);this.started=false;this.dragging=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.up(b);this.callback("up",[b.xy]);if(a){this.callback("done",[b.xy])}document.onselectstart=this.oldOnselectstart}return true},mouseout:function(b){if(this.started&&OpenLayers.Util.mouseLeft(b,this.map.div)){var a=(this.start!=this.last);this.started=false;this.dragging=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.out(b);this.callback("out",[]);if(a){this.callback("done",[b.xy])}if(document.onselectstart){document.onselectstart=this.oldOnselectstart}}return true},click:function(a){return(this.start==this.last)},activate:function(){var a=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragging=false;a=true}return a},deactivate:function(){var a=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.started=false;this.dragging=false;this.start=null;this.last=null;a=true;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown")}return a},CLASS_NAME:"OpenLayers.Handler.Drag"});OpenLayers.Handler.Feature=OpenLayers.Class(OpenLayers.Handler,{EVENTMAP:{click:{"in":"click",out:"clickout"},mousemove:{"in":"over",out:"out"},dblclick:{"in":"dblclick",out:null},mousedown:{"in":null,out:null},mouseup:{"in":null,out:null}},feature:null,lastFeature:null,down:null,up:null,clickTolerance:4,geometryTypes:null,stopClick:true,stopDown:true,stopUp:false,initialize:function(d,b,c,a){OpenLayers.Handler.prototype.initialize.apply(this,[d,c,a]);this.layer=b},mousedown:function(a){this.down=a.xy;return this.handle(a)?!this.stopDown:true},mouseup:function(a){this.up=a.xy;return this.handle(a)?!this.stopUp:true},click:function(a){return this.handle(a)?!this.stopClick:true},mousemove:function(a){if(!this.callbacks.over&&!this.callbacks.out){return true}this.handle(a);return true},dblclick:function(a){return !this.handle(a)},geometryTypeMatches:function(a){return this.geometryTypes==null||OpenLayers.Util.indexOf(this.geometryTypes,a.geometry.CLASS_NAME)>-1},handle:function(a){if(this.feature&&!this.feature.layer){this.feature=null}var c=a.type;var g=false;var f=!!(this.feature);var d=(c=="click"||c=="dblclick");this.feature=this.layer.getFeatureFromEvent(a);if(this.feature&&!this.feature.layer){this.feature=null}if(this.lastFeature&&!this.lastFeature.layer){this.lastFeature=null}if(this.feature){var b=(this.feature!=this.lastFeature);if(this.geometryTypeMatches(this.feature)){if(f&&b){if(this.lastFeature){this.triggerCallback(c,"out",[this.lastFeature])}this.triggerCallback(c,"in",[this.feature])}else{if(!f||d){this.triggerCallback(c,"in",[this.feature])}}this.lastFeature=this.feature;g=true}else{if(this.lastFeature&&(f&&b||d)){this.triggerCallback(c,"out",[this.lastFeature])}this.feature=null}}else{if(this.lastFeature&&(f||d)){this.triggerCallback(c,"out",[this.lastFeature])}}return g},triggerCallback:function(d,f,b){var c=this.EVENTMAP[d][f];if(c){if(d=="click"&&this.up&&this.down){var a=Math.sqrt(Math.pow(this.up.x-this.down.x,2)+Math.pow(this.up.y-this.down.y,2));if(a<=this.clickTolerance){this.callback(c,b)}}else{this.callback(c,b)}}},activate:function(){var a=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.moveLayerToTop();this.map.events.on({removelayer:this.handleMapEvents,changelayer:this.handleMapEvents,scope:this});a=true}return a},deactivate:function(){var a=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.moveLayerBack();this.feature=null;this.lastFeature=null;this.down=null;this.up=null;this.map.events.un({removelayer:this.handleMapEvents,changelayer:this.handleMapEvents,scope:this});a=true}return a},handleMapEvents:function(a){if(!a.property||a.property=="order"){this.moveLayerToTop()}},moveLayerToTop:function(){var a=Math.max(this.map.Z_INDEX_BASE.Feature-1,this.layer.getZIndex())+1;this.layer.setZIndex(a)},moveLayerBack:function(){var a=this.layer.getZIndex()-1;if(a>=this.map.Z_INDEX_BASE.Feature){this.layer.setZIndex(a)}else{this.map.setLayerZIndex(this.layer,this.map.getLayerIndex(this.layer))}},CLASS_NAME:"OpenLayers.Handler.Feature"});OpenLayers.Handler.Hover=OpenLayers.Class(OpenLayers.Handler,{delay:500,pixelTolerance:null,stopMove:false,px:null,timerId:null,initialize:function(c,b,a){OpenLayers.Handler.prototype.initialize.apply(this,arguments)},mousemove:function(a){if(this.passesTolerance(a.xy)){this.clearTimer();this.callback("move",[a]);this.px=a.xy;a=OpenLayers.Util.extend({},a);this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,a),this.delay)}return !this.stopMove},mouseout:function(a){if(OpenLayers.Util.mouseLeft(a,this.map.div)){this.clearTimer();this.callback("move",[a])}return true},passesTolerance:function(b){var c=true;if(this.pixelTolerance&&this.px){var a=Math.sqrt(Math.pow(this.px.x-b.x,2)+Math.pow(this.px.y-b.y,2));if(a<this.pixelTolerance){c=false}}return c},clearTimer:function(){if(this.timerId!=null){window.clearTimeout(this.timerId);this.timerId=null}},delayedCall:function(a){this.callback("pause",[a])},deactivate:function(){var a=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.clearTimer();a=true}return a},CLASS_NAME:"OpenLayers.Handler.Hover"});OpenLayers.Handler.Keyboard=OpenLayers.Class(OpenLayers.Handler,{KEY_EVENTS:["keydown","keyup"],eventListener:null,initialize:function(c,b,a){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 b=0,a=this.KEY_EVENTS.length;b<a;b++){OpenLayers.Event.observe(document,this.KEY_EVENTS[b],this.eventListener)}return true}else{return false}},deactivate:function(){var c=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){for(var b=0,a=this.KEY_EVENTS.length;b<a;b++){OpenLayers.Event.stopObserving(document,this.KEY_EVENTS[b],this.eventListener)}c=true}return c},handleKeyEvent:function(a){if(this.checkModifiers(a)){this.callback(a.type,[a])}},CLASS_NAME:"OpenLayers.Handler.Keyboard"});OpenLayers.Handler.MouseWheel=OpenLayers.Class(OpenLayers.Handler,{wheelListener:null,mousePosition:null,initialize:function(c,b,a){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(l){if(!this.map||!this.checkModifiers(l)){return}var g=false;var o=false;var f=false;var b=OpenLayers.Event.element(l);while((b!=null)&&!f&&!g){if(!g){try{if(b.currentStyle){c=b.currentStyle.overflow}else{var a=document.defaultView.getComputedStyle(b,null);var c=a.getPropertyValue("overflow")}g=(c&&(c=="auto")||(c=="scroll"))}catch(d){}}if(!o){for(var h=0,k=this.map.layers.length;h<k;h++){if(b==this.map.layers[h].div||b==this.map.layers[h].pane){o=true;break}}}f=(b==this.map.div);b=b.parentNode}if(!g&&f){if(o){this.wheelZoom(l)}OpenLayers.Event.stop(l)}},wheelZoom:function(a){var b=0;if(!a){a=window.event}if(a.wheelDelta){b=a.wheelDelta/120;if(window.opera&&window.opera.version()<9.2){b=-b}}else{if(a.detail){b=-a.detail/3}}if(b){if(this.mousePosition){a.xy=this.mousePosition}if(!a.xy){a.xy=this.map.getPixelFromLonLat(this.map.getCenter())}if(b<0){this.callback("down",[a,b])}else{this.callback("up",[a,b])}}},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 true}else{return false}},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 true}else{return false}},CLASS_NAME:"OpenLayers.Handler.MouseWheel"});OpenLayers.Layer=OpenLayers.Class({id:null,name:null,div:null,opacity:null,alwaysInRange:null,EVENT_TYPES:["loadstart","loadend","loadcancel","visibilitychanged","move","moveend"],events:null,map:null,isBaseLayer:false,alpha:false,displayInLayerSwitcher:true,visibility:true,attribution:null,inRange:false,imageSize:null,imageOffset:null,options:null,eventListeners:null,gutter:0,projection:null,units:null,scales:null,resolutions:null,maxExtent:null,minExtent:null,maxResolution:null,minResolution:null,numZoomLevels:null,minScale:null,maxScale:null,displayOutsideMaxExtent:false,wrapDateLine:false,transitionEffect:null,SUPPORTED_TRANSITIONS:["resize"],initialize:function(b,a){this.addOptions(a);this.name=b;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);if(this.eventListeners instanceof Object){this.events.on(this.eventListeners)}}if(this.wrapDateLine){this.displayOutsideMaxExtent=true}},destroy:function(a){if(a==null){a=true}if(this.map!=null){this.map.removeLayer(this,a)}this.projection=null;this.map=null;this.name=null;this.div=null;this.options=null;if(this.events){if(this.eventListeners){this.events.un(this.eventListeners)}this.events.destroy()}this.eventListeners=null;this.events=null},clone:function(a){if(a==null){a=new OpenLayers.Layer(this.name,this.options)}OpenLayers.Util.applyDefaults(a,this);a.map=null;return a},setName:function(a){if(a!=this.name){this.name=a;if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"name"})}}},addOptions:function(a){if(this.options==null){this.options={}}OpenLayers.Util.extend(this.options,a);OpenLayers.Util.extend(this,a)},onMapResize:function(){},redraw:function(){var b=false;if(this.map){this.inRange=this.calculateInRange();var c=this.getExtent();if(c&&this.inRange&&this.visibility){var a=true;this.moveTo(c,a,false);this.events.triggerEvent("moveend",{zoomChanged:a});b=true}}return b},moveTo:function(b,a,c){var d=this.visibility;if(!this.isBaseLayer){d=d&&this.inRange}this.display(d)},setMap:function(b){if(this.map==null){this.map=b;this.maxExtent=this.maxExtent||this.map.maxExtent;this.projection=this.projection||this.map.projection;if(this.projection&&typeof this.projection=="string"){this.projection=new OpenLayers.Projection(this.projection)}this.units=this.projection.getUnits()||this.units||this.map.units;this.initResolutions();if(!this.isBaseLayer){this.inRange=this.calculateInRange();var a=((this.visibility)&&(this.inRange));this.div.style.display=a?"":"none"}this.setTileSize()}},afterAdd:function(){},removeMap:function(a){},getImageSize:function(){return(this.imageSize||this.tileSize)},setTileSize:function(a){var b=(a)?a:((this.tileSize)?this.tileSize:this.map.getTileSize());this.tileSize=b;if(this.gutter){this.imageOffset=new OpenLayers.Pixel(-this.gutter,-this.gutter);this.imageSize=new OpenLayers.Size(b.w+(2*this.gutter),b.h+(2*this.gutter))}},getVisibility:function(){return this.visibility},setVisibility:function(a){if(a!=this.visibility){this.visibility=a;this.display(a);this.redraw();if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"visibility"})}this.events.triggerEvent("visibilitychanged")}},display:function(a){var b=this.calculateInRange();if(a!=(this.div.style.display!="none")){this.div.style.display=(a&&b)?"block":"none"}},calculateInRange:function(){var b=false;if(this.alwaysInRange){b=true}else{if(this.map){var a=this.map.getResolution();b=((a>=this.minResolution)&&(a<=this.maxResolution))}}return b},setIsBaseLayer:function(a){if(a!=this.isBaseLayer){this.isBaseLayer=a;if(this.map!=null){this.map.events.triggerEvent("changebaselayer",{layer:this})}}},initResolutions:function(){var r=new Array("projection","units","scales","resolutions","maxScale","minScale","maxResolution","minResolution","minExtent","maxExtent","numZoomLevels","maxZoomLevel");var b=["projection","units"];var f=false;var d={};for(var g=0,l=r.length;g<l;g++){var t=r[g];if(this.options[t]&&OpenLayers.Util.indexOf(b,t)==-1){f=true}d[t]=this.options[t]||this.map[t]}if(this.alwaysInRange==null){this.alwaysInRange=!f}if((this.options.minScale!=null||this.options.maxScale!=null)&&this.options.scales==null){d.scales=null}if((this.options.minResolution!=null||this.options.maxResolution!=null)&&this.options.resolutions==null){d.resolutions=null}if((!d.numZoomLevels)&&(d.maxZoomLevel)){d.numZoomLevels=d.maxZoomLevel+1}if((d.scales!=null)||(d.resolutions!=null)){if(d.scales!=null){d.resolutions=[];for(var g=0,l=d.scales.length;g<l;g++){var c=d.scales[g];d.resolutions[g]=OpenLayers.Util.getResolutionFromScale(c,d.units)}}d.numZoomLevels=d.resolutions.length}else{if(d.minScale){d.maxResolution=OpenLayers.Util.getResolutionFromScale(d.minScale,d.units)}else{if(d.maxResolution=="auto"){var s=this.map.getSize();var q=d.maxExtent.getWidth()/s.w;var k=d.maxExtent.getHeight()/s.h;d.maxResolution=Math.max(q,k)}}if(d.maxScale!=null){d.minResolution=OpenLayers.Util.getResolutionFromScale(d.maxScale,d.units)}else{if((d.minResolution=="auto")&&(d.minExtent!=null)){var s=this.map.getSize();var q=d.minExtent.getWidth()/s.w;var k=d.minExtent.getHeight()/s.h;d.minResolution=Math.max(q,k)}}if(d.minResolution!=null&&this.options.numZoomLevels==undefined){var p=d.maxResolution/d.minResolution;d.numZoomLevels=Math.floor(Math.log(p)/Math.log(2))+1}d.resolutions=new Array(d.numZoomLevels);var a=2;if(typeof d.minResolution=="number"&&d.numZoomLevels>1){a=Math.pow((d.maxResolution/d.minResolution),(1/(d.numZoomLevels-1)))}for(var g=0;g<d.numZoomLevels;g++){var o=d.maxResolution/Math.pow(a,g);d.resolutions[g]=o}}d.resolutions.sort(function(v,u){return(u-v)});this.resolutions=d.resolutions;this.maxResolution=d.resolutions[0];var h=d.resolutions.length-1;this.minResolution=d.resolutions[h];this.scales=[];for(var g=0,l=d.resolutions.length;g<l;g++){this.scales[g]=OpenLayers.Util.getScaleFromResolution(d.resolutions[g],d.units)}this.minScale=this.scales[0];this.maxScale=this.scales[this.scales.length-1];this.numZoomLevels=d.numZoomLevels},getResolution:function(){var a=this.map.getZoom();return this.getResolutionForZoom(a)},getExtent:function(){return this.map.calculateBounds()},getZoomForExtent:function(b,c){var d=this.map.getSize();var a=Math.max(b.getWidth()/d.w,b.getHeight()/d.h);return this.getZoomForResolution(a,c)},getDataExtent:function(){},getResolutionForZoom:function(c){c=Math.max(0,Math.min(c,this.resolutions.length-1));var b;if(this.map.fractionalZoom){var a=Math.floor(c);var d=Math.ceil(c);b=this.resolutions[a]-((c-a)*(this.resolutions[a]-this.resolutions[d]))}else{b=this.resolutions[Math.round(c)]}return b},getZoomForResolution:function(f,a){var r;if(this.map.fractionalZoom){var o=0;var c=this.resolutions.length-1;var d=this.resolutions[o];var b=this.resolutions[c];var l;for(var g=0,h=this.resolutions.length;g<h;++g){l=this.resolutions[g];if(l>=f){d=l;o=g}if(l<=f){b=l;c=g;break}}var k=d-b;if(k>0){r=o+((d-f)/k)}else{r=o}}else{var p;var q=Number.POSITIVE_INFINITY;for(var g=0,h=this.resolutions.length;g<h;g++){if(a){p=Math.abs(this.resolutions[g]-f);if(p>q){break}q=p}else{if(this.resolutions[g]<f){break}}}r=Math.max(0,g-1)}return r},getLonLatFromViewPortPx:function(b){var f=null;if(b!=null){var d=this.map.getSize();var a=this.map.getCenter();if(a){var c=this.map.getResolution();var h=b.x-(d.w/2);var g=b.y-(d.h/2);f=new OpenLayers.LonLat(a.lon+h*c,a.lat-g*c);if(this.wrapDateLine){f=f.wrapDateLine(this.maxExtent)}}}return f},getViewPortPxFromLonLat:function(d){var b=null;if(d!=null){var a=this.map.getResolution();var c=this.map.getExtent();b=new OpenLayers.Pixel((1/a*(d.lon-c.left)),(1/a*(c.top-d.lat)))}return b},setOpacity:function(b){if(b!=this.opacity){this.opacity=b;for(var d=0,a=this.div.childNodes.length;d<a;++d){var c=this.div.childNodes[d].firstChild;OpenLayers.Util.modifyDOMElement(c,null,null,null,null,null,null,b)}}},getZIndex:function(){return this.div.style.zIndex},setZIndex:function(a){this.div.style.zIndex=a},adjustBounds:function(b){if(this.gutter){var a=this.gutter*this.map.getResolution();b=new OpenLayers.Bounds(b.left-a,b.bottom-a,b.right+a,b.top+a)}if(this.wrapDateLine){var c={rightTolerance:this.getResolution()};b=b.wrapDateLine(this.maxExtent,c)}return b},CLASS_NAME:"OpenLayers.Layer"});(function(){var d=window.XMLHttpRequest;var k=!!window.controllers,f=window.document.all&&!window.opera;function c(){this._object=d?new d:new window.ActiveXObject("Microsoft.XMLHTTP")}if(k&&d.wrapped){c.wrapped=d.wrapped}c.UNSENT=0;c.OPENED=1;c.HEADERS_RECEIVED=2;c.LOADING=3;c.DONE=4;c.prototype.readyState=c.UNSENT;c.prototype.responseText="";c.prototype.responseXML=null;c.prototype.status=0;c.prototype.statusText="";c.prototype.onreadystatechange=null;c.onreadystatechange=null;c.onopen=null;c.onsend=null;c.onabort=null;c.prototype.open=function(q,t,p,u,o){this._async=p;var s=this,r=this.readyState;if(f){var l=function(){if(s._object.readyState!=c.DONE){a(s)}};if(p){window.attachEvent("onunload",l)}}this._object.onreadystatechange=function(){if(k&&!p){return}s.readyState=s._object.readyState;h(s);if(s._aborted){s.readyState=c.UNSENT;return}if(s.readyState==c.DONE){a(s);if(f&&p){window.detachEvent("onunload",l)}}if(r!=s.readyState){g(s)}r=s.readyState};if(c.onopen){c.onopen.apply(this,arguments)}this._object.open(q,t,p,u,o);if(!p&&k){this.readyState=c.OPENED;g(this)}};c.prototype.send=function(l){if(c.onsend){c.onsend.apply(this,arguments)}if(l&&l.nodeType){l=window.XMLSerializer?new window.XMLSerializer().serializeToString(l):l.xml;if(!this._headers["Content-Type"]){this._object.setRequestHeader("Content-Type","application/xml")}}this._object.send(l);if(k&&!this._async){this.readyState=c.OPENED;h(this);while(this.readyState<c.DONE){this.readyState++;g(this);if(this._aborted){return}}}};c.prototype.abort=function(){if(c.onabort){c.onabort.apply(this,arguments)}if(this.readyState>c.UNSENT){this._aborted=true}this._object.abort();a(this)};c.prototype.getAllResponseHeaders=function(){return this._object.getAllResponseHeaders()};c.prototype.getResponseHeader=function(l){return this._object.getResponseHeader(l)};c.prototype.setRequestHeader=function(l,o){if(!this._headers){this._headers={}}this._headers[l]=o;return this._object.setRequestHeader(l,o)};c.prototype.toString=function(){return"[object XMLHttpRequest]"};c.toString=function(){return"[XMLHttpRequest]"};function g(l){if(l.onreadystatechange){l.onreadystatechange.apply(l)}if(c.onreadystatechange){c.onreadystatechange.apply(l)}}function b(o){var l=o.responseXML;if(f&&l&&!l.documentElement&&o.getResponseHeader("Content-Type").match(/[^\/]+\/[^\+]+\+xml/)){l=new ActiveXObject("Microsoft.XMLDOM");l.loadXML(o.responseText)}if(l){if((f&&l.parseError!=0)||(l.documentElement&&l.documentElement.tagName=="parsererror")){return null}}return l}function h(l){try{l.responseText=l._object.responseText}catch(o){}try{l.responseXML=b(l._object)}catch(o){}try{l.status=l._object.status}catch(o){}try{l.statusText=l._object.statusText}catch(o){}}function a(l){l._object.onreadystatechange=new window.Function;delete l._headers}if(!window.Function.prototype.apply){window.Function.prototype.apply=function(l,o){if(!o){o=[]}l.__func=this;l.__func(o[0],o[1],o[2],o[3],o[4]);delete l.__func}}OpenLayers.Request.XMLHttpRequest=c})();OpenLayers.ProxyHost="";OpenLayers.nullHandler=function(a){OpenLayers.Console.userError(OpenLayers.i18n("unhandledRequest",{statusText:a.statusText}))};OpenLayers.loadURL=function(d,h,b,f,c){if(typeof h=="string"){h=OpenLayers.Util.getParameters(h)}var g=(f)?f:OpenLayers.nullHandler;var a=(c)?c:OpenLayers.nullHandler;return OpenLayers.Request.GET({url:d,params:h,success:g,failure:a,scope:b})};OpenLayers.parseXMLString=function(c){var a=c.indexOf("<");if(a>0){c=c.substring(a)}var b=OpenLayers.Util.Try(function(){var d=new ActiveXObject("Microsoft.XMLDOM");d.loadXML(c);return d},function(){return new DOMParser().parseFromString(c,"text/xml")},function(){var d=new XMLHttpRequest();d.open("GET","data:text/xml;charset=utf-8,"+encodeURIComponent(c),false);if(d.overrideMimeType){d.overrideMimeType("text/xml")}d.send(null);return d.responseXML});return b};OpenLayers.Ajax={emptyFunction:function(){},getTransport:function(){return OpenLayers.Util.Try(function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||false},activeRequestCount:0};OpenLayers.Ajax.Responders={responders:[],register:function(b){for(var a=0;a<this.responders.length;a++){if(b==this.responders[a]){return}}this.responders.push(b)},unregister:function(a){OpenLayers.Util.removeItem(this.reponders,a)},dispatch:function(g,c,f){var a;for(var b=0;b<this.responders.length;b++){a=this.responders[b];if(a[g]&&typeof a[g]=="function"){try{a[g].apply(a,[c,f])}catch(d){}}}}};OpenLayers.Ajax.Responders.register({onCreate:function(){OpenLayers.Ajax.activeRequestCount++},onComplete:function(){OpenLayers.Ajax.activeRequestCount--}});OpenLayers.Ajax.Base=OpenLayers.Class({initialize:function(a){this.options={method:"post",asynchronous:true,contentType:"application/xml",parameters:""};OpenLayers.Util.extend(this.options,a||{});this.options.method=this.options.method.toLowerCase();if(typeof this.options.parameters=="string"){this.options.parameters=OpenLayers.Util.getParameters(this.options.parameters)}}});OpenLayers.Ajax.Request=OpenLayers.Class(OpenLayers.Ajax.Base,{_complete:false,initialize:function(b,a){OpenLayers.Ajax.Base.prototype.initialize.apply(this,[a]);if(OpenLayers.ProxyHost&&OpenLayers.String.startsWith(b,"http")){b=OpenLayers.ProxyHost+encodeURIComponent(b)}this.transport=OpenLayers.Ajax.getTransport();this.request(b)},request:function(b){this.url=b;this.method=this.options.method;var d=OpenLayers.Util.extend({},this.options.parameters);if(this.method!="get"&&this.method!="post"){d._method=this.method;this.method="post"}this.parameters=d;if(d=OpenLayers.Util.getParameterString(d)){if(this.method=="get"){this.url+=((this.url.indexOf("?")>-1)?"&":"?")+d}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){d+="&_="}}}try{var a=new OpenLayers.Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(a)}OpenLayers.Ajax.Responders.dispatch("onCreate",this,a);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){window.setTimeout(OpenLayers.Function.bind(this.respondToReadyState,this,1),10)}this.transport.onreadystatechange=OpenLayers.Function.bind(this.onStateChange,this);this.setRequestHeaders();this.body=this.method=="post"?(this.options.postBody||d):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(c){this.dispatchException(c)}},onStateChange:function(){var a=this.transport.readyState;if(a>1&&!((a==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var f={"X-Requested-With":"XMLHttpRequest",Accept:"text/javascript, text/html, application/xml, text/xml, */*",OpenLayers:true};if(this.method=="post"){f["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){f.Connection="close"}}if(typeof this.options.requestHeaders=="object"){var c=this.options.requestHeaders;if(typeof c.push=="function"){for(var b=0,d=c.length;b<d;b+=2){f[c[b]]=c[b+1]}}else{for(var b in c){f[b]=c[b]}}}for(var a in f){this.transport.setRequestHeader(a,f[a])}},success:function(){var a=this.getStatus();return !a||(a>=200&&a<300)},getStatus:function(){try{return this.transport.status||0}catch(a){return 0}},respondToReadyState:function(a){var c=OpenLayers.Ajax.Request.Events[a];var b=new OpenLayers.Ajax.Response(this);if(c=="Complete"){try{this._complete=true;(this.options["on"+b.status]||this.options["on"+(this.success()?"Success":"Failure")]||OpenLayers.Ajax.emptyFunction)(b)}catch(d){this.dispatchException(d)}var f=b.getHeader("Content-type")}try{(this.options["on"+c]||OpenLayers.Ajax.emptyFunction)(b);OpenLayers.Ajax.Responders.dispatch("on"+c,this,b)}catch(d){this.dispatchException(d)}if(c=="Complete"){this.transport.onreadystatechange=OpenLayers.Ajax.emptyFunction}},getHeader:function(a){try{return this.transport.getResponseHeader(a)}catch(b){return null}},dispatchException:function(c){var d=this.options.onException;if(d){d(this,c);OpenLayers.Ajax.Responders.dispatch("onException",this,c)}else{var f=false;var a=OpenLayers.Ajax.Responders.responders;for(var b=0;b<a.length;b++){if(a[b].onException){f=true;break}}if(f){OpenLayers.Ajax.Responders.dispatch("onException",this,c)}else{throw c}}}});OpenLayers.Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];OpenLayers.Ajax.Response=OpenLayers.Class({status:0,statusText:"",initialize:function(c){this.request=c;var d=this.transport=c.transport,a=this.readyState=d.readyState;if((a>2&&!(!!(window.attachEvent&&!window.opera)))||a==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=d.responseText==null?"":String(d.responseText)}if(a==4){var b=d.responseXML;this.responseXML=b===undefined?null:b}},getStatus:OpenLayers.Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""}catch(a){return""}},getHeader:OpenLayers.Ajax.Request.prototype.getHeader,getResponseHeader:function(a){return this.transport.getResponseHeader(a)}});OpenLayers.Ajax.getElementsByTagNameNS=function(b,a,c,f){var d=null;if(b.getElementsByTagNameNS){d=b.getElementsByTagNameNS(a,f)}else{d=b.getElementsByTagName(c+":"+f)}return d};OpenLayers.Ajax.serializeXMLToString=function(a){var b=new XMLSerializer();var c=b.serializeToString(a);return c};OpenLayers.Control.ArgParser=OpenLayers.Class(OpenLayers.Control,{center:null,zoom:null,layers:null,displayProjection:null,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,arguments)},setMap:function(f){OpenLayers.Control.prototype.setMap.apply(this,arguments);for(var c=0,a=this.map.controls.length;c<a;c++){var d=this.map.controls[c];if((d!=this)&&(d.CLASS_NAME=="OpenLayers.Control.ArgParser")){if(d.displayProjection!=this.displayProjection){this.displayProjection=d.displayProjection}break}}if(c==this.map.controls.length){var b=OpenLayers.Util.getParameters();if(b.layers){this.layers=b.layers;this.map.events.register("addlayer",this,this.configureLayers);this.configureLayers()}if(b.lat&&b.lon){this.center=new OpenLayers.LonLat(parseFloat(b.lon),parseFloat(b.lat));if(b.zoom){this.zoom=parseInt(b.zoom)}this.map.events.register("changebaselayer",this,this.setCenter);this.setCenter()}}},setCenter:function(){if(this.map.baseLayer){this.map.events.unregister("changebaselayer",this,this.setCenter);if(this.displayProjection){this.center.transform(this.displayProjection,this.map.getProjectionObject())}this.map.setCenter(this.center,this.zoom)}},configureLayers:function(){if(this.layers.length==this.map.layers.length){this.map.events.unregister("addlayer",this,this.configureLayers);for(var d=0,a=this.layers.length;d<a;d++){var b=this.map.layers[d];var f=this.layers.charAt(d);if(f=="B"){this.map.setBaseLayer(b)}else{if((f=="T")||(f=="F")){b.setVisibility(f=="T")}}}}},CLASS_NAME:"OpenLayers.Control.ArgParser"});OpenLayers.Control.DragFeature=OpenLayers.Class(OpenLayers.Control,{geometryTypes:null,onStart:function(b,a){},onDrag:function(b,a){},onComplete:function(b,a){},layer:null,feature:null,dragCallbacks:{},featureCallbacks:{},lastPixel:null,initialize:function(b,a){OpenLayers.Control.prototype.initialize.apply(this,[a]);this.layer=b;this.handlers={drag:new OpenLayers.Handler.Drag(this,OpenLayers.Util.extend({down:this.downFeature,move:this.moveFeature,up:this.upFeature,out:this.cancel,done:this.doneDragging},this.dragCallbacks)),feature:new OpenLayers.Handler.Feature(this,this.layer,OpenLayers.Util.extend({over:this.overFeature,out:this.outFeature},this.featureCallbacks),{geometryTypes:this.geometryTypes})}},destroy:function(){this.layer=null;OpenLayers.Control.prototype.destroy.apply(this,[])},activate:function(){return(this.handlers.feature.activate()&&OpenLayers.Control.prototype.activate.apply(this,arguments))},deactivate:function(){this.handlers.drag.deactivate();this.handlers.feature.deactivate();this.feature=null;this.dragging=false;this.lastPixel=null;OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass+"Over");return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},overFeature:function(a){if(!this.handlers.drag.dragging){this.feature=a;this.handlers.drag.activate();this.over=true;OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass+"Over")}else{if(this.feature.id==a.id){this.over=true}else{this.over=false}}},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(a){if(!this.over){this.handlers.drag.deactivate()}},doneDragging:function(a){this.onComplete(this.feature,a)},outFeature:function(a){if(!this.handlers.drag.dragging){this.over=false;this.handlers.drag.deactivate();OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass+"Over");this.feature=null}else{if(this.feature.id==a.id){this.over=false}}},cancel:function(){this.handlers.drag.deactivate();this.over=false},setMap:function(a){this.handlers.drag.setMap(a);this.handlers.feature.setMap(a);OpenLayers.Control.prototype.setMap.apply(this,arguments)},CLASS_NAME:"OpenLayers.Control.DragFeature"});OpenLayers.Control.DragPan=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,panned:false,interval:25,draw:function(){this.handler=new OpenLayers.Handler.Drag(this,{move:this.panMap,done:this.panMapDone},{interval:this.interval})},panMap:function(a){this.panned=true;this.map.pan(this.handler.last.x-a.x,this.handler.last.y-a.y,{dragging:this.handler.dragging,animate:false})},panMapDone:function(a){if(this.panned){this.panMap(a);this.panned=false}},CLASS_NAME:"OpenLayers.Control.DragPan"});OpenLayers.Control.KeyboardDefaults=OpenLayers.Class(OpenLayers.Control,{slideFactor:75,initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){if(this.handler){this.handler.destroy()}this.handler=null;OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(){this.handler=new OpenLayers.Handler.Keyboard(this,{keydown:this.defaultKeyPress});this.activate()},defaultKeyPress:function(a){switch(a.keyCode){case OpenLayers.Event.KEY_LEFT:this.map.pan(-this.slideFactor,0);break;case OpenLayers.Event.KEY_RIGHT:this.map.pan(this.slideFactor,0);break;case OpenLayers.Event.KEY_UP:this.map.pan(0,-this.slideFactor);break;case OpenLayers.Event.KEY_DOWN:this.map.pan(0,this.slideFactor);break;case 33:var b=this.map.getSize();this.map.pan(0,-0.75*b.h);break;case 34:var b=this.map.getSize();this.map.pan(0,0.75*b.h);break;case 35:var b=this.map.getSize();this.map.pan(0.75*b.w,0);break;case 36:var b=this.map.getSize();this.map.pan(-0.75*b.w,0);break;case 43:case 61:case 187:case 107:this.map.zoomIn();break;case 45:case 109:case 189:case 95:this.map.zoomOut();break}},CLASS_NAME:"OpenLayers.Control.KeyboardDefaults"});OpenLayers.Control.WMSGetFeatureInfo=OpenLayers.Class(OpenLayers.Control,{hover:false,maxFeatures:10,layers:null,queryVisible:false,url:null,layerUrls:null,infoFormat:"text/html",vendorParams:{},format:null,formatOptions:null,handlerOptions:null,handler:null,hoverRequest:null,EVENT_TYPES:["getfeatureinfo"],initialize:function(a){this.EVENT_TYPES=OpenLayers.Control.WMSGetFeatureInfo.prototype.EVENT_TYPES.concat(OpenLayers.Control.prototype.EVENT_TYPES);a=a||{};a.handlerOptions=a.handlerOptions||{};OpenLayers.Control.prototype.initialize.apply(this,[a]);if(!this.format){this.format=new OpenLayers.Format.WMSGetFeatureInfo(a.formatOptions)}if(this.hover){this.handler=new OpenLayers.Handler.Hover(this,{move:this.cancelHover,pause:this.getInfoForHover},OpenLayers.Util.extend(this.handlerOptions.hover||{},{delay:250}))}else{this.handler=new OpenLayers.Handler.Click(this,{click:this.getInfoForClick},this.handlerOptions.click||{})}},activate:function(){if(!this.active){this.handler.activate()}return OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},getInfoForClick:function(a){OpenLayers.Element.addClass(this.map.viewPortDiv,"olCursorWait");this.request(a.xy,{})},getInfoForHover:function(a){this.request(a.xy,{hover:true})},cancelHover:function(){if(this.hoverRequest){this.hoverRequest.abort();this.hoverRequest=null}},findLayers:function(){var g=[];var f=this.layers||this.map.layers;var d,b;for(var c=0,a=f.length;c<a;++c){d=f[c];if(d instanceof OpenLayers.Layer.WMS&&(!this.queryVisible||d.getVisibility())){b=d.url instanceof Array?d.url[0]:d.url;if(!this.url){this.url=b}if(this.urlMatches(b)){g.push(d)}}}return g},urlMatches:function(b){var d=OpenLayers.Util.isEquivalentUrl(this.url,b);if(!d&&this.layerUrls){for(var c=0,a=this.layerUrls.length;c<a;++c){if(OpenLayers.Util.isEquivalentUrl(this.layerUrls[c],b)){d=true;break}}}return d},request:function(a,l){l=l||{};var g=[];var h=[];var c=this.findLayers();if(c.length>0){for(var d=0,f=c.length;d<f;d++){g=g.concat(c[d].params.LAYERS);if(c[d].params.STYLES){h=h.concat(c[d].params.STYLES)}else{if(c[d].params.LAYERS instanceof Array){h=h.concat(new Array(c[d].params.LAYERS.length))}else{h=h.concat(c[d].params.LAYERS.replace(/[^,]/g,""))}}}var k={url:this.url,params:OpenLayers.Util.applyDefaults({service:"WMS",version:"1.1.0",request:"GetFeatureInfo",layers:g,query_layers:g,styles:h,bbox:this.map.getExtent().toBBOX(),srs:this.map.getProjection(),feature_count:this.maxFeatures,x:a.x,y:a.y,height:this.map.getSize().h,width:this.map.getSize().w,info_format:this.infoFormat},this.vendorParams),callback:function(o){this.handleResponse(a,o)},scope:this};var b=OpenLayers.Request.GET(k);if(l.hover===true){this.hoverRequest=b.priv}}else{OpenLayers.Element.removeClass(this.map.viewPortDiv,"olCursorWait")}},handleResponse:function(d,b){var c=b.responseXML;if(!c||!c.documentElement){c=b.responseText}var a=this.format.read(c);this.events.triggerEvent("getfeatureinfo",{text:b.responseText,features:a,request:b,xy:d});OpenLayers.Element.removeClass(this.map.viewPortDiv,"olCursorWait")},setMap:function(a){this.handler.setMap(a);OpenLayers.Control.prototype.setMap.apply(this,arguments)},CLASS_NAME:"OpenLayers.Control.WMSGetFeatureInfo"});OpenLayers.State={UNKNOWN:"Unknown",INSERT:"Insert",UPDATE:"Update",DELETE:"Delete"};OpenLayers.Feature.Vector=OpenLayers.Class(OpenLayers.Feature,{fid:null,geometry:null,attributes:null,bounds:null,state:null,style:null,renderIntent:"default",initialize:function(c,a,b){OpenLayers.Feature.prototype.initialize.apply(this,[null,null,a]);this.lonlat=null;this.geometry=c?c:null;this.state=null;this.attributes={};if(a){this.attributes=OpenLayers.Util.extend(this.attributes,a)}this.style=b?b: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(d){var c=false;if(this.layer&&this.layer.map){var a=this.layer.map.getExtent();if(d){var b=this.geometry.getBounds();c=a.intersectsBounds(b)}else{var f=a.toGeometry();c=f.intersects(this.geometry)}}return c},createMarker:function(){return null},destroyMarker:function(){},createPopup:function(){return null},atPoint:function(b,d,c){var a=false;if(this.geometry){a=this.geometry.atPoint(b,d,c)}return a},destroyPopup:function(){},move:function(a){if(!this.layer||!this.geometry.move){return}var b;if(a.CLASS_NAME=="OpenLayers.LonLat"){b=this.layer.getViewPortPxFromLonLat(a)}else{b=a}var d=this.layer.getViewPortPxFromLonLat(this.geometry.getBounds().getCenterLonLat());var c=this.layer.map.getResolution();this.geometry.move(c*(b.x-d.x),c*(d.y-b.y));this.layer.drawFeature(this);return d},toState:function(a){if(a==OpenLayers.State.UPDATE){switch(this.state){case OpenLayers.State.UNKNOWN:case OpenLayers.State.DELETE:this.state=a;break;case OpenLayers.State.UPDATE:case OpenLayers.State.INSERT:break}}else{if(a==OpenLayers.State.INSERT){switch(this.state){case OpenLayers.State.UNKNOWN:break;default:this.state=a;break}}else{if(a==OpenLayers.State.DELETE){switch(this.state){case OpenLayers.State.INSERT:break;case OpenLayers.State.DELETE:break;case OpenLayers.State.UNKNOWN:case OpenLayers.State.UPDATE:this.state=a;break}}else{if(a==OpenLayers.State.UNKNOWN){this.state=a}}}}},CLASS_NAME:"OpenLayers.Feature.Vector"});OpenLayers.Feature.Vector.style={"default":{fillColor:"#ee9900",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#ee9900",strokeOpacity:1,strokeWidth:1,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},select:{fillColor:"blue",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"blue",strokeOpacity:1,strokeWidth:2,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"pointer"},temporary:{fillColor:"#66cccc",fillOpacity:0.2,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#66cccc",strokeOpacity:1,strokeLinecap:"round",strokeWidth:2,strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},"delete":{display:"none"}};OpenLayers.Feature.WFS=OpenLayers.Class(OpenLayers.Feature,{initialize:function(c,b){var a=arguments;var d=this.processXMLNode(b);a=new Array(c,d.lonlat,d);OpenLayers.Feature.prototype.initialize.apply(this,a);this.createMarker();this.layer.addMarker(this.marker)},destroy:function(){if(this.marker!=null){this.layer.removeMarker(this.marker)}OpenLayers.Feature.prototype.destroy.apply(this,arguments)},processXMLNode:function(b){var a=OpenLayers.Ajax.getElementsByTagNameNS(b,"http://www.opengis.net/gml","gml","Point");var d=OpenLayers.Util.getXmlNodeValue(OpenLayers.Ajax.getElementsByTagNameNS(a[0],"http://www.opengis.net/gml","gml","coordinates")[0]);var c=d.split(",");return{lonlat:new OpenLayers.LonLat(parseFloat(c[0]),parseFloat(c[1])),id:null}},CLASS_NAME:"OpenLayers.Feature.WFS"});OpenLayers.Format.WFSCapabilities.v1=OpenLayers.Class(OpenLayers.Format.WFSCapabilities,{initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a]);this.options=a},read:function(c){if(typeof c=="string"){c=OpenLayers.Format.XML.prototype.read.apply(this,[c])}var a={};var b=c.documentElement;this.runChildNodes(a,b);return a},runChildNodes:function(g,f){var c=f.childNodes;var b,d;for(var a=0;a<c.length;++a){b=c[a];if(b.nodeType==1){d=this["read_cap_"+b.nodeName];if(d){d.apply(this,[g,b])}}}},read_cap_FeatureTypeList:function(c,b){var a={featureTypes:[]};this.runChildNodes(a,b);c.featureTypeList=a},read_cap_FeatureType:function(a,d,b){var c={};this.runChildNodes(c,d);a.featureTypes.push(c)},read_cap_Name:function(c,b){var a=this.getChildValue(b);if(a){c.name=a}},read_cap_Title:function(b,a){var c=this.getChildValue(a);if(c){b.title=c}},read_cap_Abstract:function(c,b){var a=this.getChildValue(b);if(a){c["abstract"]=a}},CLASS_NAME:"OpenLayers.Format.WFSCapabilities.v1"});OpenLayers.Format.WMSCapabilities.v1_1_0=OpenLayers.Class(OpenLayers.Format.WMSCapabilities.v1_1,{version:"1.1.0",initialize:function(a){OpenLayers.Format.WMSCapabilities.v1_1.prototype.initialize.apply(this,[a])},CLASS_NAME:"OpenLayers.Format.WMSCapabilities.v1_1_0"});OpenLayers.Format.WMSCapabilities.v1_1_1=OpenLayers.Class(OpenLayers.Format.WMSCapabilities.v1_1,{version:"1.1.1",initialize:function(a){OpenLayers.Format.WMSCapabilities.v1_1.prototype.initialize.apply(this,[a])},CLASS_NAME:"OpenLayers.Format.WMSCapabilities.v1_1_1"});OpenLayers.Format.WMSDescribeLayer.v1_1=OpenLayers.Class(OpenLayers.Format.WMSDescribeLayer,{initialize:function(a){OpenLayers.Format.WMSDescribeLayer.prototype.initialize.apply(this,[a])},read:function(h){if(typeof h=="string"){h=OpenLayers.Format.XML.prototype.read.apply(this,[h])}var b=h.documentElement;var f=b.childNodes;var a=[];for(var d=0;d<f.length;++d){childNode=f[d];nodeName=childNode.nodeName;if(nodeName=="LayerDescription"){var k="";var g="";var c="";if(childNode.getAttribute("owsType")){k=childNode.getAttribute("owsType");g=childNode.getAttribute("owsURL")}else{if(childNode.getAttribute("wfs")!=""){k="WFS";g=childNode.getAttribute("wfs")}else{if(childNode.getAttribute("wcs")!=""){k="WCS";g=childNode.getAttribute("wcs")}}}query=childNode.getElementsByTagName("Query");if(query.length>0){c=query[0].getAttribute("typeName");if(!c){c=query[0].getAttribute("typename")}}a.push({owsType:k,owsURL:g,typeName:c})}}return a},CLASS_NAME:"OpenLayers.Format.WMSDescribeLayer.v1_1"});OpenLayers.Handler.Box=OpenLayers.Class(OpenLayers.Handler,{dragHandler:null,boxDivClassName:"olHandlerBoxZoomBox",boxCharacteristics:null,initialize:function(c,b,a){OpenLayers.Handler.prototype.initialize.apply(this,arguments);var b={down:this.startBox,move:this.moveBox,out:this.removeBox,up:this.endBox};this.dragHandler=new OpenLayers.Handler.Drag(this,b,{keyMask:this.keyMask})},setMap:function(a){OpenLayers.Handler.prototype.setMap.apply(this,arguments);if(this.dragHandler){this.dragHandler.setMap(a)}},startBox:function(a){this.zoomBox=OpenLayers.Util.createDiv("zoomBox",this.dragHandler.start);this.zoomBox.className=this.boxDivClassName;this.zoomBox.style.zIndex=this.map.Z_INDEX_BASE.Popup-1;this.map.viewPortDiv.appendChild(this.zoomBox);OpenLayers.Element.addClass(this.map.viewPortDiv,"olDrawBox")},moveBox:function(g){var d=this.dragHandler.start.x;var b=this.dragHandler.start.y;var c=Math.abs(d-g.x);var a=Math.abs(b-g.y);this.zoomBox.style.width=Math.max(1,c)+"px";this.zoomBox.style.height=Math.max(1,a)+"px";this.zoomBox.style.left=g.x<d?g.x+"px":d+"px";this.zoomBox.style.top=g.y<b?g.y+"px":b+"px";var f=this.getBoxCharacteristics();if(f.newBoxModel){if(g.x>d){this.zoomBox.style.width=Math.max(1,c-f.xOffset)+"px"}if(g.y>b){this.zoomBox.style.height=Math.max(1,a-f.yOffset)+"px"}}},endBox:function(b){var a;if(Math.abs(this.dragHandler.start.x-b.x)>5||Math.abs(this.dragHandler.start.y-b.y)>5){var h=this.dragHandler.start;var g=Math.min(h.y,b.y);var c=Math.max(h.y,b.y);var f=Math.min(h.x,b.x);var d=Math.max(h.x,b.x);a=new OpenLayers.Bounds(f,c,d,g)}else{a=this.dragHandler.start.clone()}this.removeBox();this.callback("done",[a])},removeBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox);this.zoomBox=null;this.boxCharacteristics=null;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDrawBox")},activate:function(){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragHandler.activate();return true}else{return false}},deactivate:function(){if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.dragHandler.deactivate();return true}else{return false}},getBoxCharacteristics:function(){if(!this.boxCharacteristics){var a=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-left-width"))+parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-right-width"))+1;var c=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-top-width"))+parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-bottom-width"))+1;var b=OpenLayers.Util.getBrowserName()=="msie"?document.compatMode!="BackCompat":true;this.boxCharacteristics={xOffset:a,yOffset:c,newBoxModel:b}}return this.boxCharacteristics},CLASS_NAME:"OpenLayers.Handler.Box"});OpenLayers.Handler.RegularPolygon=OpenLayers.Class(OpenLayers.Handler.Drag,{sides:4,radius:null,snapAngle:null,snapToggle:"shiftKey",persist:false,irregular:false,angle:null,fixedRadius:false,feature:null,layer:null,origin:null,initialize:function(c,b,a){this.style=OpenLayers.Util.extend(OpenLayers.Feature.Vector.style["default"],{});OpenLayers.Handler.prototype.initialize.apply(this,[c,b,a]);this.options=(a)?a:new Object()},setOptions:function(a){OpenLayers.Util.extend(this.options,a);OpenLayers.Util.extend(this,a)},activate:function(){var a=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){var b={displayInLayerSwitcher:false,calculateInRange:function(){return true}};this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,b);this.map.addLayer(this.layer);a=true}return a},deactivate:function(){var a=false;if(OpenLayers.Handler.Drag.prototype.deactivate.apply(this,arguments)){if(this.dragging){this.cancel()}if(this.layer.map!=null){this.layer.destroy(false);if(this.feature){this.feature.destroy()}}this.layer=null;this.feature=null;a=true}return a},down:function(a){this.fixedRadius=!!(this.radius);var b=this.map.getLonLatFromPixel(a.xy);this.origin=new OpenLayers.Geometry.Point(b.lon,b.lat);if(!this.fixedRadius||this.irregular){this.radius=this.map.getResolution()}if(this.persist){this.clear()}this.feature=new OpenLayers.Feature.Vector();this.createGeometry();this.callback("create",[this.origin,this.feature]);this.layer.addFeatures([this.feature],{silent:true});this.layer.drawFeature(this.feature,this.style)},move:function(c){var g=this.map.getLonLatFromPixel(c.xy);var a=new OpenLayers.Geometry.Point(g.lon,g.lat);if(this.irregular){var h=Math.sqrt(2)*Math.abs(a.y-this.origin.y)/2;this.radius=Math.max(this.map.getResolution()/2,h)}else{if(this.fixedRadius){this.origin=a}else{this.calculateAngle(a,c);this.radius=Math.max(this.map.getResolution()/2,a.distanceTo(this.origin))}}this.modifyGeometry();if(this.irregular){var d=a.x-this.origin.x;var b=a.y-this.origin.y;var f;if(b==0){f=d/(this.radius*Math.sqrt(2))}else{f=d/b}this.feature.geometry.resize(1,this.origin,f);this.feature.geometry.move(d/2,b/2)}this.layer.drawFeature(this.feature,this.style)},up:function(a){this.finalize();if(this.start==this.last){this.callback("done",[a.xy])}},out:function(a){this.finalize()},createGeometry:function(){this.angle=Math.PI*((1/this.sides)-(1/2));if(this.snapAngle){this.angle+=this.snapAngle*(Math.PI/180)}this.feature.geometry=OpenLayers.Geometry.Polygon.createRegularPolygon(this.origin,this.radius,this.sides,this.snapAngle)},modifyGeometry:function(){var g,c,b,a;var d=this.feature.geometry.components[0];if(d.components.length!=(this.sides+1)){this.createGeometry();d=this.feature.geometry.components[0]}for(var f=0;f<this.sides;++f){a=d.components[f];g=this.angle+(f*2*Math.PI/this.sides);a.x=this.origin.x+(this.radius*Math.cos(g));a.y=this.origin.y+(this.radius*Math.sin(g));a.clearBounds()}},calculateAngle:function(a,b){var d=Math.atan2(a.y-this.origin.y,a.x-this.origin.x);if(this.snapAngle&&(this.snapToggle&&!b[this.snapToggle])){var c=(Math.PI/180)*this.snapAngle;this.angle=Math.round(d/c)*c}else{this.angle=d}},cancel:function(){this.callback("cancel",null);this.finalize()},finalize:function(){this.origin=null;this.radius=this.options.radius},clear:function(){this.layer.renderer.clear();this.layer.destroyFeatures()},callback:function(b,a){if(this.callbacks[b]){this.callbacks[b].apply(this.control,[this.feature.geometry.clone()])}if(!this.persist&&(b=="done"||b=="cancel")){this.clear()}},CLASS_NAME:"OpenLayers.Handler.RegularPolygon"});OpenLayers.Layer.EventPane=OpenLayers.Class(OpenLayers.Layer,{smoothDragPan:true,isBaseLayer:true,isFixed:true,pane:null,mapObject:null,initialize:function(b,a){OpenLayers.Layer.prototype.initialize.apply(this,arguments);if(this.pane==null){this.pane=OpenLayers.Util.createDiv(this.div.id+"_EventPane")}},destroy:function(){this.mapObject=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},setMap:function(a){OpenLayers.Layer.prototype.setMap.apply(this,arguments);this.pane.style.zIndex=parseInt(this.div.style.zIndex)+1;this.pane.style.display=this.div.style.display;this.pane.style.width="100%";this.pane.style.height="100%";if(OpenLayers.Util.getBrowserName()=="msie"){this.pane.style.background="url("+OpenLayers.Util.getImagesLocation()+"blank.gif)"}if(this.isFixed){this.map.viewPortDiv.appendChild(this.pane)}else{this.map.layerContainerDiv.appendChild(this.pane)}this.loadMapObject();if(this.mapObject==null){this.loadWarningMessage()}},removeMap:function(a){if(this.pane&&this.pane.parentNode){this.pane.parentNode.removeChild(this.pane);this.pane=null}OpenLayers.Layer.prototype.removeMap.apply(this,arguments)},loadWarningMessage:function(){this.div.style.backgroundColor="darkblue";var h=this.map.getSize();var a=Math.min(h.w,300);var f=Math.min(h.h,200);var b=new OpenLayers.Size(a,f);var d=new OpenLayers.Pixel(h.w/2,h.h/2);var c=d.add(-b.w/2,-b.h/2);var g=OpenLayers.Util.createDiv(this.name+"_warning",c,b,null,null,null,"auto");g.style.padding="7px";g.style.backgroundColor="yellow";g.innerHTML=this.getWarningHTML();this.div.appendChild(g)},getWarningHTML:function(){return""},display:function(a){OpenLayers.Layer.prototype.display.apply(this,arguments);this.pane.style.display=this.div.style.display},setZIndex:function(a){OpenLayers.Layer.prototype.setZIndex.apply(this,arguments);this.pane.style.zIndex=parseInt(this.div.style.zIndex)+1},moveTo:function(c,d,o){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);if(this.mapObject!=null){var f=this.map.getCenter();var h=this.map.getZoom();if(f!=null){var g=this.getMapObjectCenter();var b=this.getOLLonLatFromMapObjectLonLat(g);var k=this.getMapObjectZoom();var r=this.getOLZoomFromMapObjectZoom(k);if(!(f.equals(b))||!(h==r)){if(o&&this.dragPanMapObject&&this.smoothDragPan){var l=this.map.getViewPortPxFromLonLat(b);var p=this.map.getViewPortPxFromLonLat(f);this.dragPanMapObject(p.x-l.x,l.y-p.y)}else{var a=this.getMapObjectLonLatFromOLLonLat(f);var q=this.getMapObjectZoomFromOLZoom(h);this.setMapObjectCenter(a,q,o)}}}}},getLonLatFromViewPortPx:function(a){var b=null;if((this.mapObject!=null)&&(this.getMapObjectCenter()!=null)){var d=this.getMapObjectPixelFromOLPixel(a);var c=this.getMapObjectLonLatFromMapObjectPixel(d);b=this.getOLLonLatFromMapObjectLonLat(c)}return b},getViewPortPxFromLonLat:function(b){var a=null;if((this.mapObject!=null)&&(this.getMapObjectCenter()!=null)){var d=this.getMapObjectLonLatFromOLLonLat(b);var c=this.getMapObjectPixelFromMapObjectLonLat(d);a=this.getOLPixelFromMapObjectPixel(c)}return a},getOLLonLatFromMapObjectLonLat:function(d){var a=null;if(d!=null){var c=this.getLongitudeFromMapObjectLonLat(d);var b=this.getLatitudeFromMapObjectLonLat(d);a=new OpenLayers.LonLat(c,b)}return a},getMapObjectLonLatFromOLLonLat:function(a){var b=null;if(a!=null){b=this.getMapObjectLonLatFromLonLat(a.lon,a.lat)}return b},getOLPixelFromMapObjectPixel:function(d){var b=null;if(d!=null){var a=this.getXFromMapObjectPixel(d);var c=this.getYFromMapObjectPixel(d);b=new OpenLayers.Pixel(a,c)}return b},getMapObjectPixelFromOLPixel:function(a){var b=null;if(a!=null){b=this.getMapObjectPixelFromXY(a.x,a.y)}return b},CLASS_NAME:"OpenLayers.Layer.EventPane"});OpenLayers.Layer.FixedZoomLevels=OpenLayers.Class({initialize:function(){},initResolutions:function(){var c=new Array("minZoomLevel","maxZoomLevel","numZoomLevels");for(var b=0,a=c.length;b<a;b++){var g=c[b];this[g]=(this.options[g]!=null)?this.options[g]:this.map[g]}if((this.minZoomLevel==null)||(this.minZoomLevel<this.MIN_ZOOM_LEVEL)){this.minZoomLevel=this.MIN_ZOOM_LEVEL}var h;var f=this.MAX_ZOOM_LEVEL-this.minZoomLevel+1;if(((this.options.numZoomLevels==null)&&(this.options.maxZoomLevel!=null))||((this.numZoomLevels==null)&&(this.maxZoomLevel!=null))){h=this.maxZoomLevel-this.minZoomLevel+1}else{h=this.numZoomLevels}if(h!=null){this.numZoomLevels=Math.min(h,f)}else{this.numZoomLevels=f}this.maxZoomLevel=this.minZoomLevel+this.numZoomLevels-1;if(this.RESOLUTIONS!=null){var d=0;this.resolutions=[];for(var b=this.minZoomLevel;b<=this.maxZoomLevel;b++){this.resolutions[d++]=this.RESOLUTIONS[b]}this.maxResolution=this.resolutions[0];this.minResolution=this.resolutions[this.resolutions.length-1]}},getResolution:function(){if(this.resolutions!=null){return OpenLayers.Layer.prototype.getResolution.apply(this,arguments)}else{var a=null;var c=this.map.getSize();var b=this.getExtent();if((c!=null)&&(b!=null)){a=Math.max(b.getWidth()/c.w,b.getHeight()/c.h)}return a}},getExtent:function(){var c=null;var b=this.map.getSize();var f=new OpenLayers.Pixel(0,0);var g=this.getLonLatFromViewPortPx(f);var a=new OpenLayers.Pixel(b.w,b.h);var d=this.getLonLatFromViewPortPx(a);if((g!=null)&&(d!=null)){c=new OpenLayers.Bounds(g.lon,d.lat,d.lon,g.lat)}return c},getZoomForResolution:function(a){if(this.resolutions!=null){return OpenLayers.Layer.prototype.getZoomForResolution.apply(this,arguments)}else{var b=OpenLayers.Layer.prototype.getExtent.apply(this,[]);return this.getZoomForExtent(b)}},getOLZoomFromMapObjectZoom:function(a){var b=null;if(a!=null){b=a-this.minZoomLevel}return b},getMapObjectZoomFromOLZoom:function(a){var b=null;if(a!=null){b=a+this.minZoomLevel}return b},CLASS_NAME:"OpenLayers.Layer.FixedZoomLevels"});OpenLayers.Layer.HTTPRequest=OpenLayers.Class(OpenLayers.Layer,{URL_HASH_FACTOR:(Math.sqrt(5)-1)/2,url:null,params:null,reproject:false,initialize:function(d,c,f,b){var a=arguments;a=[d,b];OpenLayers.Layer.prototype.initialize.apply(this,a);this.url=c;this.params=OpenLayers.Util.extend({},f)},destroy:function(){this.url=null;this.params=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(a){if(a==null){a=new OpenLayers.Layer.HTTPRequest(this.name,this.url,this.params,this.options)}a=OpenLayers.Layer.prototype.clone.apply(this,[a]);return a},setUrl:function(a){this.url=a},mergeNewParams:function(a){this.params=OpenLayers.Util.extend(this.params,a);return this.redraw()},redraw:function(a){if(a){return this.mergeNewParams({_olSalt:Math.random()})}else{return OpenLayers.Layer.prototype.redraw.apply(this,[])}},selectUrl:function(f,d){var c=1;for(var b=0,a=f.length;b<a;b++){c*=f.charCodeAt(b)*this.URL_HASH_FACTOR;c-=Math.floor(c)}return d[Math.floor(c*d.length)]},getFullRequestString:function(g,f){var b=f||this.url;var h=OpenLayers.Util.extend({},this.params);h=OpenLayers.Util.extend(h,g);var a=OpenLayers.Util.getParameterString(h);if(b instanceof Array){b=this.selectUrl(a,b)}var d=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(b));for(var k in h){if(k.toUpperCase() in d){delete h[k]}}a=OpenLayers.Util.getParameterString(h);var l=b;if(a!=""){var c=b.charAt(b.length-1);if((c=="&")||(c=="?")){l+=a}else{if(b.indexOf("?")==-1){l+="?"+a}else{l+="&"+a}}}return l},CLASS_NAME:"OpenLayers.Layer.HTTPRequest"});OpenLayers.Layer.Image=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:true,url:null,extent:null,size:null,tile:null,aspectRatio:null,initialize:function(c,b,f,d,a){this.url=b;this.extent=f;this.maxExtent=f;this.size=d;OpenLayers.Layer.prototype.initialize.apply(this,[c,a]);this.aspectRatio=(this.extent.getHeight()/this.size.h)/(this.extent.getWidth()/this.size.w)},destroy:function(){if(this.tile){this.removeTileMonitoringHooks(this.tile);this.tile.destroy();this.tile=null}OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(a){if(a==null){a=new OpenLayers.Layer.Image(this.name,this.url,this.extent,this.size,this.options)}a=OpenLayers.Layer.prototype.clone.apply(this,[a]);return 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(f,a,g){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);var b=(this.tile==null);if(a||b){this.setTileSize();var d=new OpenLayers.LonLat(this.extent.left,this.extent.top);var c=this.map.getLayerPxFromLonLat(d);if(b){this.tile=new OpenLayers.Tile.Image(this,c,this.extent,null,this.tileSize);this.addTileMonitoringHooks(this.tile)}else{this.tile.size=this.tileSize.clone();this.tile.position=c.clone()}this.tile.draw()}},setTileSize:function(){var b=this.extent.getWidth()/this.map.getResolution();var a=this.extent.getHeight()/this.map.getResolution();this.tileSize=new OpenLayers.Size(b,a)},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(a){return this.url},CLASS_NAME:"OpenLayers.Layer.Image"});OpenLayers.Layer.Markers=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:false,markers:null,drawn:false,initialize:function(b,a){OpenLayers.Layer.prototype.initialize.apply(this,arguments);this.markers=[]},destroy:function(){this.clearMarkers();this.markers=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},setOpacity:function(b){if(b!=this.opacity){this.opacity=b;for(var c=0,a=this.markers.length;c<a;c++){this.markers[c].setOpacity(this.opacity)}}},moveTo:function(d,b,f){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);if(b||!this.drawn){for(var c=0,a=this.markers.length;c<a;c++){this.drawMarker(this.markers[c])}this.drawn=true}},addMarker:function(a){this.markers.push(a);if(this.opacity!=null){a.setOpacity(this.opacity)}if(this.map&&this.map.getExtent()){a.map=this.map;this.drawMarker(a)}},removeMarker:function(a){if(this.markers&&this.markers.length){OpenLayers.Util.removeItem(this.markers,a);a.erase()}},clearMarkers:function(){if(this.markers!=null){while(this.markers.length>0){this.removeMarker(this.markers[0])}}},drawMarker:function(a){var b=this.map.getLayerPxFromLonLat(a.lonlat);if(b==null){a.display(false)}else{if(!a.isDrawn()){var c=a.draw(b);this.div.appendChild(c)}else{if(a.icon){a.icon.moveTo(b)}}}},getDataExtent:function(){var b=null;if(this.markers&&(this.markers.length>0)){var b=new OpenLayers.Bounds();for(var d=0,a=this.markers.length;d<a;d++){var c=this.markers[d];b.extend(c.lonlat)}}return b},CLASS_NAME:"OpenLayers.Layer.Markers"});OpenLayers.Layer.SphericalMercator={getExtent:function(){var a=null;if(this.sphericalMercator){a=this.map.calculateBounds()}else{a=OpenLayers.Layer.FixedZoomLevels.prototype.getExtent.apply(this)}return a},initMercatorParameters:function(){this.RESOLUTIONS=[];var a=156543.0339;for(var b=0;b<=this.MAX_ZOOM_LEVEL;++b){this.RESOLUTIONS[b]=a/Math.pow(2,b)}this.units="m";this.projection="EPSG:900913"},forwardMercator:function(c,b){var a=c*20037508.34/180;var d=Math.log(Math.tan((90+b)*Math.PI/360))/(Math.PI/180);d=d*20037508.34/180;return new OpenLayers.LonLat(a,d)},inverseMercator:function(a,d){var c=(a/20037508.34)*180;var b=(d/20037508.34)*180;b=180/Math.PI*(2*Math.atan(Math.exp(b*Math.PI/180))-Math.PI/2);return new OpenLayers.LonLat(c,b)},projectForward:function(a){var b=OpenLayers.Layer.SphericalMercator.forwardMercator(a.x,a.y);a.x=b.lon;a.y=b.lat;return a},projectInverse:function(a){var b=OpenLayers.Layer.SphericalMercator.inverseMercator(a.x,a.y);a.x=b.lon;a.y=b.lat;return a}};OpenLayers.Projection.addTransform("EPSG:4326","EPSG:900913",OpenLayers.Layer.SphericalMercator.projectForward);OpenLayers.Projection.addTransform("EPSG:900913","EPSG:4326",OpenLayers.Layer.SphericalMercator.projectInverse);OpenLayers.Tile.WFS=OpenLayers.Class(OpenLayers.Tile,{features:null,url:null,request:null,initialize:function(d,a,f,b,c){OpenLayers.Tile.prototype.initialize.apply(this,arguments);this.url=b;this.features=[]},destroy:function(){OpenLayers.Tile.prototype.destroy.apply(this,arguments);this.destroyAllFeatures();this.features=null;this.url=null;if(this.request){this.request.abort();this.request=null}},clear:function(){this.destroyAllFeatures()},draw:function(){if(OpenLayers.Tile.prototype.draw.apply(this,arguments)){if(this.isLoading){this.events.triggerEvent("reload")}else{this.isLoading=true;this.events.triggerEvent("loadstart")}this.loadFeaturesForRegion(this.requestSuccess)}},loadFeaturesForRegion:function(b,a){if(this.request){this.request.abort()}this.request=OpenLayers.Request.GET({url:this.url,success:b,failure:a,scope:this})},requestSuccess:function(b){if(this.features){var d=b.responseXML;if(!d||!d.documentElement){d=b.responseText}if(this.layer.vectorMode){this.layer.addFeatures(this.layer.formatObject.read(d))}else{var a=new OpenLayers.Format.XML();if(typeof d=="string"){d=a.read(d)}var c=a.getElementsByTagNameNS(d,"http://www.opengis.net/gml","featureMember");this.addResults(c)}}if(this.events){this.events.triggerEvent("loadend")}this.request=null},addResults:function(c){for(var b=0;b<c.length;b++){var a=new this.layer.featureClass(this.layer,c[b]);this.features.push(a)}},destroyAllFeatures:function(){while(this.features.length>0){var a=this.features.shift();a.destroy()}},CLASS_NAME:"OpenLayers.Tile.WFS"});OpenLayers.Control.DrawFeature=OpenLayers.Class(OpenLayers.Control,{layer:null,callbacks:null,EVENT_TYPES:["featureadded"],featureAdded:function(){},handlerOptions:null,initialize:function(b,c,a){this.EVENT_TYPES=OpenLayers.Control.DrawFeature.prototype.EVENT_TYPES.concat(OpenLayers.Control.prototype.EVENT_TYPES);OpenLayers.Control.prototype.initialize.apply(this,[a]);this.callbacks=OpenLayers.Util.extend({done:this.drawFeature,modify:function(g,f){this.layer.events.triggerEvent("sketchmodified",{vertex:g,feature:f})},create:function(g,f){this.layer.events.triggerEvent("sketchstarted",{vertex:g,feature:f})}},this.callbacks);this.layer=b;var d=this.layer.styleMap&&this.layer.styleMap.styles.temporary;if(d){this.handlerOptions=this.handlerOptions||{};this.handlerOptions.layerOptions=OpenLayers.Util.applyDefaults(this.handlerOptions.layerOptions,{styleMap:new OpenLayers.StyleMap({"default":d})})}this.handler=new c(this,this.callbacks,this.handlerOptions)},drawFeature:function(c){var a=new OpenLayers.Feature.Vector(c);var b=this.layer.events.triggerEvent("sketchcomplete",{feature:a});if(b!==false){a.state=OpenLayers.State.INSERT;this.layer.addFeatures([a]);this.featureAdded(a);this.events.triggerEvent("featureadded",{feature:a})}},CLASS_NAME:"OpenLayers.Control.DrawFeature"});OpenLayers.Control.Measure=OpenLayers.Class(OpenLayers.Control,{EVENT_TYPES:["measure","measurepartial"],handlerOptions:null,callbacks:null,displaySystem:"metric",geodesic:false,displaySystemUnits:{geographic:["dd"],english:["mi","ft","in"],metric:["km","m"]},partialDelay:300,delayedTrigger:null,persist:false,initialize:function(b,a){this.EVENT_TYPES=OpenLayers.Control.Measure.prototype.EVENT_TYPES.concat(OpenLayers.Control.prototype.EVENT_TYPES);OpenLayers.Control.prototype.initialize.apply(this,[a]);this.callbacks=OpenLayers.Util.extend({done:this.measureComplete,point:this.measurePartial},this.callbacks);this.handlerOptions=OpenLayers.Util.extend({persist:this.persist},this.handlerOptions);this.handler=new b(this,this.callbacks,this.handlerOptions)},cancel:function(){this.handler.cancel()},updateHandler:function(b,a){var c=this.active;if(c){this.deactivate()}this.handler=new b(this,this.callbacks,a);if(c){this.activate()}},measureComplete:function(a){if(this.delayedTrigger){window.clearTimeout(this.delayedTrigger)}this.measure(a,"measure")},measurePartial:function(a,b){this.delayedTrigger=window.setTimeout(OpenLayers.Function.bind(function(){this.measure(b,"measurepartial")},this),this.partialDelay)},measure:function(d,b){var c,a;if(d.CLASS_NAME.indexOf("LineString")>-1){c=this.getBestLength(d);a=1}else{c=this.getBestArea(d);a=2}this.events.triggerEvent(b,{measure:c[0],units:c[1],order:a,geometry:d})},getBestArea:function(g){var b=this.displaySystemUnits[this.displaySystem];var f,d;for(var c=0,a=b.length;c<a;++c){f=b[c];d=this.getArea(g,f);if(d>1){break}}return[d,f]},getArea:function(g,a){var b,c;if(this.geodesic){b=g.getGeodesicArea(this.map.getProjectionObject());c="m"}else{b=g.getArea();c=this.map.getUnits()}var f=OpenLayers.INCHES_PER_UNIT[a];if(f){var d=OpenLayers.INCHES_PER_UNIT[c];b*=Math.pow((d/f),2)}return b},getBestLength:function(g){var b=this.displaySystemUnits[this.displaySystem];var f,d;for(var c=0,a=b.length;c<a;++c){f=b[c];d=this.getLength(g,f);if(d>1){break}}return[d,f]},getLength:function(g,a){var b,c;if(this.geodesic){b=g.getGeodesicLength(this.map.getProjectionObject());c="m"}else{b=g.getLength();c=this.map.getUnits()}var f=OpenLayers.INCHES_PER_UNIT[a];if(f){var d=OpenLayers.INCHES_PER_UNIT[c];b*=(d/f)}return b},CLASS_NAME:"OpenLayers.Control.Measure"});OpenLayers.Control.ZoomBox=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,out:false,alwaysZoom:false,draw:function(){this.handler=new OpenLayers.Handler.Box(this,{done:this.zoomBox},{keyMask:this.keyMask})},zoomBox:function(k){if(k instanceof OpenLayers.Bounds){if(!this.out){var l=this.map.getLonLatFromPixel(new OpenLayers.Pixel(k.left,k.bottom));var r=this.map.getLonLatFromPixel(new OpenLayers.Pixel(k.right,k.top));var b=new OpenLayers.Bounds(l.lon,l.lat,r.lon,r.lat)}else{var h=Math.abs(k.right-k.left);var o=Math.abs(k.top-k.bottom);var f=Math.min((this.map.size.h/o),(this.map.size.w/h));var s=this.map.getExtent();var a=this.map.getLonLatFromPixel(k.getCenterPixel());var c=a.lon-(s.getWidth()/2)*f;var g=a.lon+(s.getWidth()/2)*f;var q=a.lat-(s.getHeight()/2)*f;var d=a.lat+(s.getHeight()/2)*f;var b=new OpenLayers.Bounds(c,q,g,d)}var p=this.map.getZoom();this.map.zoomToExtent(b);if(p==this.map.getZoom()&&this.alwaysZoom==true){this.map.zoomTo(p+(this.out?-1:1))}}else{if(!this.out){this.map.setCenter(this.map.getLonLatFromPixel(k),this.map.getZoom()+1)}else{this.map.setCenter(this.map.getLonLatFromPixel(k),this.map.getZoom()-1)}}},CLASS_NAME:"OpenLayers.Control.ZoomBox"});OpenLayers.Format.WFSCapabilities.v1_0_0=OpenLayers.Class(OpenLayers.Format.WFSCapabilities.v1,{initialize:function(a){OpenLayers.Format.WFSCapabilities.v1.prototype.initialize.apply(this,[a])},CLASS_NAME:"OpenLayers.Format.WFSCapabilities.v1_0_0"});OpenLayers.Format.WFSCapabilities.v1_1_0=OpenLayers.Class(OpenLayers.Format.WFSCapabilities.v1,{initialize:function(a){OpenLayers.Format.WFSCapabilities.v1.prototype.initialize.apply(this,[a])},CLASS_NAME:"OpenLayers.Format.WFSCapabilities.v1_1_0"});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(g){var f,d,k;var h=this.regExes.typeStr.exec(g);if(h){d=h[1].toLowerCase();k=h[2];if(this.parse[d]){f=this.parse[d].apply(this,[k])}if(this.internalProjection&&this.externalProjection){if(f&&f.CLASS_NAME=="OpenLayers.Feature.Vector"){f.geometry.transform(this.externalProjection,this.internalProjection)}else{if(f&&d!="geometrycollection"&&typeof f=="object"){for(var c=0,a=f.length;c<a;c++){var b=f[c];b.geometry.transform(this.externalProjection,this.internalProjection)}}}}}return f},write:function(a){var g,l,k,d,b;if(a.constructor==Array){g=a;b=true}else{g=[a];b=false}var c=[];if(b){c.push("GEOMETRYCOLLECTION(")}for(var f=0,h=g.length;f<h;++f){if(b&&f>0){c.push(",")}l=g[f].geometry;k=l.CLASS_NAME.split(".")[2].toLowerCase();if(!this.extract[k]){return null}if(this.internalProjection&&this.externalProjection){l=l.clone();l.transform(this.internalProjection,this.externalProjection)}d=this.extract[k].apply(this,[l]);c.push(k.toUpperCase()+"("+d+")")}if(b){c.push(")")}return c.join("")},extract:{point:function(a){return a.x+" "+a.y},multipoint:function(c){var d=[];for(var b=0,a=c.components.length;b<a;++b){d.push(this.extract.point.apply(this,[c.components[b]]))}return d.join(",")},linestring:function(b){var d=[];for(var c=0,a=b.components.length;c<a;++c){d.push(this.extract.point.apply(this,[b.components[c]]))}return d.join(",")},multilinestring:function(c){var d=[];for(var b=0,a=c.components.length;b<a;++b){d.push("("+this.extract.linestring.apply(this,[c.components[b]])+")")}return d.join(",")},polygon:function(c){var d=[];for(var b=0,a=c.components.length;b<a;++b){d.push("("+this.extract.linestring.apply(this,[c.components[b]])+")")}return d.join(",")},multipolygon:function(d){var c=[];for(var b=0,a=d.components.length;b<a;++b){c.push("("+this.extract.polygon.apply(this,[d.components[b]])+")")}return c.join(",")}},parse:{point:function(b){var a=OpenLayers.String.trim(b).split(this.regExes.spaces);return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(a[0],a[1]))},multipoint:function(f){var c=OpenLayers.String.trim(f).split(",");var d=[];for(var b=0,a=c.length;b<a;++b){d.push(this.parse.point.apply(this,[c[b]]).geometry)}return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPoint(d))},linestring:function(f){var c=OpenLayers.String.trim(f).split(",");var d=[];for(var b=0,a=c.length;b<a;++b){d.push(this.parse.point.apply(this,[c[b]]).geometry)}return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(d))},multilinestring:function(g){var c;var b=OpenLayers.String.trim(g).split(this.regExes.parenComma);var f=[];for(var d=0,a=b.length;d<a;++d){c=b[d].replace(this.regExes.trimParens,"$1");f.push(this.parse.linestring.apply(this,[c]).geometry)}return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiLineString(f))},polygon:function(k){var c,b,g;var h=OpenLayers.String.trim(k).split(this.regExes.parenComma);var f=[];for(var d=0,a=h.length;d<a;++d){c=h[d].replace(this.regExes.trimParens,"$1");b=this.parse.linestring.apply(this,[c]).geometry;g=new OpenLayers.Geometry.LinearRing(b.components);f.push(g)}return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon(f))},multipolygon:function(g){var d;var b=OpenLayers.String.trim(g).split(this.regExes.doubleParenComma);var f=[];for(var c=0,a=b.length;c<a;++c){d=b[c].replace(this.regExes.trimParens,"$1");f.push(this.parse.polygon.apply(this,[d]).geometry)}return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPolygon(f))},geometrycollection:function(f){f=f.replace(/,\s*([A-Za-z])/g,"|$1");var d=OpenLayers.String.trim(f).split("|");var c=[];for(var b=0,a=d.length;b<a;++b){c.push(OpenLayers.Format.WKT.prototype.read.apply(this,[d[b]]))}return c}},CLASS_NAME:"OpenLayers.Format.WKT"});OpenLayers.Layer.Boxes=OpenLayers.Class(OpenLayers.Layer.Markers,{initialize:function(b,a){OpenLayers.Layer.Markers.prototype.initialize.apply(this,arguments)},drawMarker:function(a){var d=a.bounds;var g=this.map.getLayerPxFromLonLat(new OpenLayers.LonLat(d.left,d.top));var c=this.map.getLayerPxFromLonLat(new OpenLayers.LonLat(d.right,d.bottom));if(c==null||g==null){a.display(false)}else{var f=new OpenLayers.Size(Math.max(1,c.x-g.x),Math.max(1,c.y-g.y));var b=a.draw(g,f);if(!a.drawn){this.div.appendChild(b);a.drawn=true}}},removeMarker:function(a){OpenLayers.Util.removeItem(this.markers,a);if((a.div!=null)&&(a.div.parentNode==this.div)){this.div.removeChild(a.div)}},CLASS_NAME:"OpenLayers.Layer.Boxes"});OpenLayers.Layer.GeoRSS=OpenLayers.Class(OpenLayers.Layer.Markers,{location:null,features:null,formatOptions:null,selectedFeature:null,icon:null,popupSize:null,useFeedTitle:true,initialize:function(c,a,b){OpenLayers.Layer.Markers.prototype.initialize.apply(this,[c,b]);this.location=a;this.features=[]},destroy:function(){OpenLayers.Layer.Markers.prototype.destroy.apply(this,arguments);this.clearFeatures();this.features=null},loadRSS:function(){if(!this.loaded){this.events.triggerEvent("loadstart");OpenLayers.Request.GET({url:this.location,success:this.parseData,scope:this});this.loaded=true}},moveTo:function(c,a,b){OpenLayers.Layer.Markers.prototype.moveTo.apply(this,arguments);if(this.visibility&&!this.loaded){this.loadRSS()}},parseData:function(l){var r=l.responseXML;if(!r||!r.documentElement){r=OpenLayers.Format.XML.prototype.read(l.responseText)}if(this.useFeedTitle){var a=null;try{a=r.getElementsByTagNameNS("*","title")[0].firstChild.nodeValue}catch(k){a=r.getElementsByTagName("title")[0].firstChild.nodeValue}if(a){this.setName(a)}}var v={};OpenLayers.Util.extend(v,this.formatOptions);if(this.map&&!this.projection.equals(this.map.getProjectionObject())){v.externalProjection=this.projection;v.internalProjection=this.map.getProjectionObject()}var s=new OpenLayers.Format.GeoRSS(v);var b=s.read(r);for(var g=0,h=b.length;g<h;g++){var f={};var u=b[g];if(!u.geometry){continue}var p=u.attributes.title?u.attributes.title:"Untitled";var t=u.attributes.description?u.attributes.description:"No description.";var o=u.attributes.link?u.attributes.link:"";var q=u.geometry.getBounds().getCenterLonLat();f.icon=this.icon==null?OpenLayers.Marker.defaultIcon():this.icon.clone();f.popupSize=this.popupSize?this.popupSize.clone():new OpenLayers.Size(250,120);if(p||t){f.title=p;f.description=t;var c='<div class="olLayerGeoRSSClose">[x]</div>';c+='<div class="olLayerGeoRSSTitle">';if(o){c+='<a class="link" href="'+o+'" target="_blank">'}c+=p;if(o){c+="</a>"}c+="</div>";c+='<div style="" class="olLayerGeoRSSDescription">';c+=t;c+="</div>";f.popupContentHTML=c}var u=new OpenLayers.Feature(this,q,f);this.features.push(u);var d=u.createMarker();d.events.register("click",u,this.markerClick);this.addMarker(d)}this.events.triggerEvent("loadend")},markerClick:function(c){var f=(this==this.layer.selectedFeature);this.layer.selectedFeature=(!f)?this:null;for(var d=0,a=this.layer.map.popups.length;d<a;d++){this.layer.map.removePopup(this.layer.map.popups[d])}if(!f){var b=this.createPopup();OpenLayers.Event.observe(b.div,"click",OpenLayers.Function.bind(function(){for(var h=0,g=this.layer.map.popups.length;h<g;h++){this.layer.map.removePopup(this.layer.map.popups[h])}},this));this.layer.map.addPopup(b)}OpenLayers.Event.stop(c)},clearFeatures:function(){if(this.features!=null){while(this.features.length>0){var a=this.features[0];OpenLayers.Util.removeItem(this.features,a);a.destroy()}}},CLASS_NAME:"OpenLayers.Layer.GeoRSS"});OpenLayers.Layer.Grid=OpenLayers.Class(OpenLayers.Layer.HTTPRequest,{tileSize:null,grid:null,singleTile:false,ratio:1.5,buffer:2,numLoadingTiles:0,initialize:function(c,b,d,a){OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,arguments);this.events.addEventType("tileloaded");this.grid=[]},destroy:function(){this.clearGrid();this.grid=null;this.tileSize=null;OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this,arguments)},clearGrid:function(){if(this.grid){for(var g=0,b=this.grid.length;g<b;g++){var f=this.grid[g];for(var c=0,a=f.length;c<a;c++){var d=f[c];this.removeTileMonitoringHooks(d);d.destroy()}}this.grid=[]}},clone:function(a){if(a==null){a=new OpenLayers.Layer.Grid(this.name,this.url,this.params,this.options)}a=OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this,[a]);if(this.tileSize!=null){a.tileSize=this.tileSize.clone()}a.grid=[];return a},moveTo:function(d,a,f){OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this,arguments);d=d||this.map.getExtent();if(d!=null){var c=!this.grid.length||a;var b=this.getTilesBounds();if(this.singleTile){if(c||(!f&&!b.containsBounds(d))){this.initSingleTile(d)}}else{if(c||!b.containsBounds(d,true)){this.initGriddedTiles(d)}else{this.moveGriddedTiles(d)}}}},setTileSize:function(a){if(this.singleTile){a=this.map.getSize().clone();a.h=parseInt(a.h*this.ratio);a.w=parseInt(a.w*this.ratio)}OpenLayers.Layer.HTTPRequest.prototype.setTileSize.apply(this,[a])},getGridBounds:function(){var a="The getGridBounds() function is deprecated. It will be removed in 3.0. Please use getTilesBounds() instead.";OpenLayers.Console.warn(a);return this.getTilesBounds()},getTilesBounds:function(){var f=null;if(this.grid.length){var a=this.grid.length-1;var d=this.grid[a][0];var b=this.grid[0].length-1;var c=this.grid[0][b];f=new OpenLayers.Bounds(d.bounds.left,d.bounds.bottom,c.bounds.right,c.bounds.top)}return f},initSingleTile:function(g){var a=g.getCenterLonLat();var k=g.getWidth()*this.ratio;var b=g.getHeight()*this.ratio;var h=new OpenLayers.Bounds(a.lon-(k/2),a.lat-(b/2),a.lon+(k/2),a.lat+(b/2));var d=new OpenLayers.LonLat(h.left,h.top);var c=this.map.getLayerPxFromLonLat(d);if(!this.grid.length){this.grid[0]=[]}var f=this.grid[0][0];if(!f){f=this.addTile(h,c);this.addTileMonitoringHooks(f);f.draw();this.grid[0][0]=f}else{f.moveTo(h,c)}this.removeExcessTiles(1,1)},calculateGridLayout:function(a,t,f){var p=f*this.tileSize.w;var c=f*this.tileSize.h;var l=a.left-t.left;var q=Math.floor(l/p)-this.buffer;var o=l/p-q;var g=-o*this.tileSize.w;var r=t.left+q*p;var b=a.top-(t.bottom+c);var k=Math.ceil(b/c)+this.buffer;var s=k-b/c;var d=-s*this.tileSize.h;var h=t.bottom+k*c;return{tilelon:p,tilelat:c,tileoffsetlon:r,tileoffsetlat:h,tileoffsetx:g,tileoffsety:d}},initGriddedTiles:function(l){var h=this.map.getSize();var C=Math.ceil(h.h/this.tileSize.h)+Math.max(1,2*this.buffer);var E=Math.ceil(h.w/this.tileSize.w)+Math.max(1,2*this.buffer);var t=this.maxExtent;var w=this.map.getResolution();var v=this.calculateGridLayout(l,t,w);var g=Math.round(v.tileoffsetx);var c=Math.round(v.tileoffsety);var p=v.tileoffsetlon;var s=v.tileoffsetlat;var f=v.tilelon;var o=v.tilelat;this.origin=new OpenLayers.Pixel(g,c);var B=g;var D=p;var A=0;var a=parseInt(this.map.layerContainerDiv.style.left);var z=parseInt(this.map.layerContainerDiv.style.top);do{var k=this.grid[A++];if(!k){k=[];this.grid.push(k)}p=D;g=B;var d=0;do{var b=new OpenLayers.Bounds(p,s,p+f,s+o);var r=g;r-=a;var q=c;q-=z;var u=new OpenLayers.Pixel(r,q);var F=k[d++];if(!F){F=this.addTile(b,u);this.addTileMonitoringHooks(F);k.push(F)}else{F.moveTo(b,u,false)}p+=f;g+=this.tileSize.w}while((p<=l.right+f*this.buffer)||d<E);s-=o;c+=this.tileSize.h}while((s>=l.bottom-o*this.buffer)||A<C);this.removeExcessTiles(A,d);this.spiralTileLoad()},spiralTileLoad:function(){var b=[];var k=["right","down","left","up"];var h=0;var a=-1;var o=OpenLayers.Util.indexOf(k,"right");var p=0;while(p<k.length){var l=h;var c=a;switch(k[o]){case"right":c++;break;case"down":l++;break;case"left":c--;break;case"up":l--;break}var g=null;if((l<this.grid.length)&&(l>=0)&&(c<this.grid[0].length)&&(c>=0)){g=this.grid[l][c]}if((g!=null)&&(!g.queued)){b.unshift(g);g.queued=true;p=0;h=l;a=c}else{o=(o+1)%4;p++}}for(var d=0,f=b.length;d<f;d++){var g=b[d];g.draw();g.queued=false}},addTile:function(b,a){},addTileMonitoringHooks:function(a){a.onLoadStart=function(){if(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");if(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(c){var b=this.buffer||1;while(true){var a=this.grid[0][0].position;var d=this.map.getViewPortPxFromLayerPx(a);if(d.x>-this.tileSize.w*(b-1)){this.shiftColumn(true)}else{if(d.x<-this.tileSize.w*b){this.shiftColumn(false)}else{if(d.y>-this.tileSize.h*(b-1)){this.shiftRow(true)}else{if(d.y<-this.tileSize.h*b){this.shiftRow(false)}else{break}}}}}},shiftRow:function(r){var c=(r)?0:(this.grid.length-1);var b=this.grid;var g=b[c];var f=this.map.getResolution();var k=(r)?-this.tileSize.h:this.tileSize.h;var h=f*-k;var q=(r)?b.pop():b.shift();for(var l=0,p=g.length;l<p;l++){var d=g[l];var a=d.bounds.clone();var o=d.position.clone();a.bottom=a.bottom+h;a.top=a.top+h;o.y=o.y+k;q[l].moveTo(a,o)}if(r){b.unshift(q)}else{b.push(q)}},shiftColumn:function(q){var d=(q)?-this.tileSize.w:this.tileSize.w;var c=this.map.getResolution();var o=c*d;for(var f=0,h=this.grid.length;f<h;f++){var p=this.grid[f];var l=(q)?0:(p.length-1);var b=p[l];var a=b.bounds.clone();var g=b.position.clone();a.left=a.left+o;a.right=a.right+o;g.x=g.x+d;var k=q?this.grid[f].pop():this.grid[f].shift();k.moveTo(a,g);if(q){p.unshift(k)}else{p.push(k)}}},removeExcessTiles:function(f,c){while(this.grid.length>f){var g=this.grid.pop();for(var b=0,a=g.length;b<a;b++){var d=g[b];this.removeTileMonitoringHooks(d);d.destroy()}}while(this.grid[0].length>c){for(var b=0,a=this.grid.length;b<a;b++){var g=this.grid[b];var d=g.pop();this.removeTileMonitoringHooks(d);d.destroy()}}},onMapResize:function(){if(this.singleTile){this.clearGrid();this.setTileSize()}},getTileBounds:function(d){var c=this.maxExtent;var g=this.getResolution();var f=g*this.tileSize.w;var b=g*this.tileSize.h;var k=this.getLonLatFromViewPortPx(d);var a=c.left+(f*Math.floor((k.lon-c.left)/f));var h=c.bottom+(b*Math.floor((k.lat-c.bottom)/b));return new OpenLayers.Bounds(a,h,a+f,h+b)},CLASS_NAME:"OpenLayers.Layer.Grid"});OpenLayers.Layer.MultiMap=OpenLayers.Class(OpenLayers.Layer.EventPane,OpenLayers.Layer.FixedZoomLevels,{MIN_ZOOM_LEVEL:1,MAX_ZOOM_LEVEL:17,RESOLUTIONS:[9,1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125],type:null,initialize:function(b,a){OpenLayers.Layer.EventPane.prototype.initialize.apply(this,arguments);OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,arguments);if(this.sphericalMercator){OpenLayers.Util.extend(this,OpenLayers.Layer.SphericalMercator);this.initMercatorParameters();this.RESOLUTIONS.unshift(10)}},loadMapObject:function(){try{this.mapObject=new MultimapViewer(this.div)}catch(a){}},getWarningHTML:function(){return OpenLayers.i18n("getLayerWarning",{layerType:"MM",layerLib:"MultiMap"})},setMapObjectCenter:function(a,b){this.mapObject.goToPosition(a,b)},getMapObjectCenter:function(){return this.mapObject.getCurrentPosition()},getMapObjectZoom:function(){return this.mapObject.getZoomFactor()},getMapObjectLonLatFromMapObjectPixel:function(a){a.x=a.x-(this.map.getSize().w/2);a.y=a.y-(this.map.getSize().h/2);return this.mapObject.getMapPositionAt(a)},getMapObjectPixelFromMapObjectLonLat:function(a){return this.mapObject.geoPosToContainerPixels(a)},getLongitudeFromMapObjectLonLat:function(a){return this.sphericalMercator?this.forwardMercator(a.lon,a.lat).lon:a.lon},getLatitudeFromMapObjectLonLat:function(a){return this.sphericalMercator?this.forwardMercator(a.lon,a.lat).lat:a.lat},getMapObjectLonLatFromLonLat:function(d,c){var a;if(this.sphericalMercator){var b=this.inverseMercator(d,c);a=new MMLatLon(b.lat,b.lon)}else{a=new MMLatLon(c,d)}return a},getXFromMapObjectPixel:function(a){return a.x},getYFromMapObjectPixel:function(a){return a.y},getMapObjectPixelFromXY:function(a,b){return new MMPoint(a,b)},CLASS_NAME:"OpenLayers.Layer.MultiMap"});OpenLayers.Layer.Text=OpenLayers.Class(OpenLayers.Layer.Markers,{location:null,features:null,formatOptions:null,selectedFeature:null,initialize:function(b,a){OpenLayers.Layer.Markers.prototype.initialize.apply(this,arguments);this.features=new Array()},destroy:function(){OpenLayers.Layer.Markers.prototype.destroy.apply(this,arguments);this.clearFeatures();this.features=null},loadText:function(){if(!this.loaded){if(this.location!=null){var a=function(b){this.events.triggerEvent("loadend")};this.events.triggerEvent("loadstart");OpenLayers.Request.GET({url:this.location,success:this.parseData,failure:a,scope:this});this.loaded=true}}},moveTo:function(c,a,b){OpenLayers.Layer.Markers.prototype.moveTo.apply(this,arguments);if(this.visibility&&!this.loaded){this.loadText()}},parseData:function(o){var q=o.responseText;var s={};OpenLayers.Util.extend(s,this.formatOptions);if(this.map&&!this.projection.equals(this.map.getProjectionObject())){s.externalProjection=this.projection;s.internalProjection=this.map.getProjectionObject()}var b=new OpenLayers.Format.Text(s);var c=b.read(q);for(var h=0,k=c.length;h<k;h++){var g={};var r=c[h];var p;var l,d;p=new OpenLayers.LonLat(r.geometry.x,r.geometry.y);if(r.style.graphicWidth&&r.style.graphicHeight){l=new OpenLayers.Size(r.style.graphicWidth,r.style.graphicHeight)}if(r.style.graphicXOffset!==undefined&&r.style.graphicYOffset!==undefined){d=new OpenLayers.Pixel(r.style.graphicXOffset,r.style.graphicYOffset)}if(r.style.externalGraphic!=null){g.icon=new OpenLayers.Icon(r.style.externalGraphic,l,d)}else{g.icon=OpenLayers.Marker.defaultIcon();if(l!=null){g.icon.setSize(l)}}if((r.attributes.title!=null)&&(r.attributes.description!=null)){g.popupContentHTML="<h2>"+r.attributes.title+"</h2><p>"+r.attributes.description+"</p>"}g.overflow=r.attributes.overflow||"auto";var a=new OpenLayers.Feature(this,p,g);this.features.push(a);var f=a.createMarker();if((r.attributes.title!=null)&&(r.attributes.description!=null)){f.events.register("click",a,this.markerClick)}this.addMarker(f)}this.events.triggerEvent("loadend")},markerClick:function(b){var d=(this==this.layer.selectedFeature);this.layer.selectedFeature=(!d)?this:null;for(var c=0,a=this.layer.map.popups.length;c<a;c++){this.layer.map.removePopup(this.layer.map.popups[c])}if(!d){this.layer.map.addPopup(this.createPopup())}OpenLayers.Event.stop(b)},clearFeatures:function(){if(this.features!=null){while(this.features.length>0){var a=this.features[0];OpenLayers.Util.removeItem(this.features,a);a.destroy()}}},CLASS_NAME:"OpenLayers.Layer.Text"});OpenLayers.Protocol.HTTP=OpenLayers.Class(OpenLayers.Protocol,{url:null,headers:null,params:null,callback:null,scope:null,readWithPOST:false,initialize:function(a){this.params={};this.headers={};OpenLayers.Protocol.prototype.initialize.apply(this,arguments)},destroy:function(){this.params=null;this.headers=null;OpenLayers.Protocol.prototype.destroy.apply(this)},createCallback:function(c,a,b){return OpenLayers.Function.bind(function(){c.apply(this,[a,b])},this)},read:function(a){a=OpenLayers.Util.applyDefaults(a,this.options);var b=(a.readWithPOST!==undefined)?a.readWithPOST:this.readWithPOST;var c=new OpenLayers.Protocol.Response({requestType:"read"});if(a.filter&&a.filter instanceof OpenLayers.Filter.Spatial){if(a.filter.type==OpenLayers.Filter.Spatial.BBOX){a.params=OpenLayers.Util.extend(a.params,{bbox:a.filter.value.toArray()})}}if(b){c.priv=OpenLayers.Request.POST({url:a.url,callback:this.createCallback(this.handleRead,c,a),data:OpenLayers.Util.getParameterString(a.params),headers:{"Content-Type":"application/x-www-form-urlencoded"}})}else{c.priv=OpenLayers.Request.GET({url:a.url,callback:this.createCallback(this.handleRead,c,a),params:a.params,headers:a.headers})}return c},handleRead:function(b,a){this.handleResponse(b,a)},create:function(b,a){a=OpenLayers.Util.applyDefaults(a,this.options);var c=new OpenLayers.Protocol.Response({reqFeatures:b,requestType:"create"});c.priv=OpenLayers.Request.POST({url:a.url,callback:this.createCallback(this.handleCreate,c,a),headers:a.headers,data:this.format.write(b)});return c},handleCreate:function(b,a){this.handleResponse(b,a)},update:function(c,b){var a=b.url||c.url||this.options.url;b=OpenLayers.Util.applyDefaults(b,this.options);var d=new OpenLayers.Protocol.Response({reqFeatures:c,requestType:"update"});d.priv=OpenLayers.Request.PUT({url:a,callback:this.createCallback(this.handleUpdate,d,b),headers:b.headers,data:this.format.write(c)});return d},handleUpdate:function(b,a){this.handleResponse(b,a)},"delete":function(c,b){var a=b.url||c.url||this.options.url;b=OpenLayers.Util.applyDefaults(b,this.options);var d=new OpenLayers.Protocol.Response({reqFeatures:c,requestType:"delete"});d.priv=OpenLayers.Request.DELETE({url:a,callback:this.createCallback(this.handleDelete,d,b),headers:b.headers});return d},handleDelete:function(b,a){this.handleResponse(b,a)},handleResponse:function(c,a){var b=c.priv;if(a.callback){if(b.status>=200&&b.status<300){if(c.requestType!="delete"){c.features=this.parseFeatures(b)}c.code=OpenLayers.Protocol.Response.SUCCESS}else{c.code=OpenLayers.Protocol.Response.FAILURE}a.callback.call(a.scope,c)}},parseFeatures:function(a){var b=a.responseXML;if(!b||!b.documentElement){b=a.responseText}if(!b||b.length<=0){return null}return this.format.read(b)},commit:function(b,u){u=OpenLayers.Util.applyDefaults(u,this.options);var d=[],q=0;var o={};o[OpenLayers.State.INSERT]=[];o[OpenLayers.State.UPDATE]=[];o[OpenLayers.State.DELETE]=[];var t,p,c=[];for(var f=0,l=b.length;f<l;++f){t=b[f];p=o[t.state];if(p){p.push(t);c.push(t)}}var h=(o[OpenLayers.State.INSERT].length>0?1:0)+o[OpenLayers.State.UPDATE].length+o[OpenLayers.State.DELETE].length;var s=true;var a=new OpenLayers.Protocol.Response({reqFeatures:c});function k(w){var v=w.features?w.features.length:0;var A=new Array(v);for(var z=0;z<v;++z){A[z]=w.features[z].fid}a.insertIds=A;r.apply(this,[w])}function r(v){this.callUserCallback(v,u);s=s&&v.success();q++;if(q>=h){if(u.callback){a.code=s?OpenLayers.Protocol.Response.SUCCESS:OpenLayers.Protocol.Response.FAILURE;u.callback.apply(u.scope,[a])}}}var g=o[OpenLayers.State.INSERT];if(g.length>0){d.push(this.create(g,OpenLayers.Util.applyDefaults({callback:k,scope:this},u.create)))}g=o[OpenLayers.State.UPDATE];for(var f=g.length-1;f>=0;--f){d.push(this.update(g[f],OpenLayers.Util.applyDefaults({callback:r,scope:this},u.update)))}g=o[OpenLayers.State.DELETE];for(var f=g.length-1;f>=0;--f){d.push(this["delete"](g[f],OpenLayers.Util.applyDefaults({callback:r,scope:this},u["delete"])))}return d},abort:function(a){if(a){a.priv.abort()}},callUserCallback:function(c,a){var b=a[c.requestType];if(b&&b.callback){b.callback.call(b.scope,c)}},CLASS_NAME:"OpenLayers.Protocol.HTTP"});OpenLayers.Style=OpenLayers.Class({name:null,title:null,description:null,layerName:null,isDefault:false,rules:null,context:null,defaultStyle:null,defaultsPerSymbolizer:false,propertyStyles:null,initialize:function(b,a){OpenLayers.Util.extend(this,a);this.rules=[];if(a&&a.rules){this.addRules(a.rules)}this.setDefaultStyle(b||OpenLayers.Feature.Vector.style["default"])},destroy:function(){for(var b=0,a=this.rules.length;b<a;b++){this.rules[b].destroy();this.rules[b]=null}this.rules=null;this.defaultStyle=null},createSymbolizer:function(o){var a=this.defaultsPerSymbolizer?{}:this.createLiterals(OpenLayers.Util.extend({},this.defaultStyle),o);var l=this.rules;var k,b;var c=[];var g=false;for(var d=0,f=l.length;d<f;d++){k=l[d];var h=k.evaluate(o);if(h){if(k instanceof OpenLayers.Rule&&k.elseFilter){c.push(k)}else{g=true;this.applySymbolizer(k,a,o)}}}if(g==false&&c.length>0){g=true;for(var d=0,f=c.length;d<f;d++){this.applySymbolizer(c[d],a,o)}}if(l.length>0&&g==false){a.display="none"}return a},applySymbolizer:function(g,d,b){var a=b.geometry?this.getSymbolizerPrefix(b.geometry):OpenLayers.Style.SYMBOLIZER_PREFIXES[0];var c=g.symbolizer[a]||g.symbolizer;if(this.defaultsPerSymbolizer===true){var f=this.defaultStyle;OpenLayers.Util.applyDefaults(c,{pointRadius:f.pointRadius});if(c.stroke===true||c.graphic===true){OpenLayers.Util.applyDefaults(c,{strokeWidth:f.strokeWidth,strokeColor:f.strokeColor,strokeOpacity:f.strokeOpacity,strokeDashstyle:f.strokeDashstyle,strokeLinecap:f.strokeLinecap})}if(c.fill===true||c.graphic===true){OpenLayers.Util.applyDefaults(c,{fillColor:f.fillColor,fillOpacity:f.fillOpacity})}if(c.graphic===true){OpenLayers.Util.applyDefaults(c,{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(d,c),b)},createLiterals:function(d,c){var b=this.context||c.attributes||c.data;for(var a in this.propertyStyles){d[a]=OpenLayers.Style.createLiteral(d[a],b,c)}return d},findPropertyStyles:function(){var d={};var g=this.defaultStyle;this.addPropertyStyles(d,g);var k=this.rules;var f,h;for(var c=0,a=k.length;c<a;c++){f=k[c].symbolizer;for(var b in f){h=f[b];if(typeof h=="object"){this.addPropertyStyles(d,h)}else{this.addPropertyStyles(d,f);break}}}return d},addPropertyStyles:function(b,c){var d;for(var a in c){d=c[a];if(typeof d=="string"&&d.match(/\$\{\w+\}/)){b[a]=true}}return b},addRules:function(a){this.rules=this.rules.concat(a);this.propertyStyles=this.findPropertyStyles()},setDefaultStyle:function(a){this.defaultStyle=a;this.propertyStyles=this.findPropertyStyles()},getSymbolizerPrefix:function(d){var c=OpenLayers.Style.SYMBOLIZER_PREFIXES;for(var b=0,a=c.length;b<a;b++){if(d.CLASS_NAME.indexOf(c[b])!=-1){return c[b]}}},CLASS_NAME:"OpenLayers.Style"});OpenLayers.Style.createLiteral=function(c,b,a){if(typeof c=="string"&&c.indexOf("${")!=-1){c=OpenLayers.String.format(c,b,[a]);c=(isNaN(c)||!c)?c:parseFloat(c)}return c};OpenLayers.Style.SYMBOLIZER_PREFIXES=["Point","Line","Polygon","Text"];OpenLayers.Control.Navigation=OpenLayers.Class(OpenLayers.Control,{dragPan:null,dragPanOptions:null,zoomBox:null,zoomWheelEnabled:true,handleRightClicks:false,zoomBoxKeyMask:OpenLayers.Handler.MOD_SHIFT,initialize:function(a){this.handlers={};OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.deactivate();if(this.dragPan){this.dragPan.destroy()}this.dragPan=null;if(this.zoomBox){this.zoomBox.destroy()}this.zoomBox=null;OpenLayers.Control.prototype.destroy.apply(this,arguments)},activate:function(){this.dragPan.activate();if(this.zoomWheelEnabled){this.handlers.wheel.activate()}this.handlers.click.activate();this.zoomBox.activate();return OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){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=function(){return false}}var a={dblclick:this.defaultDblClick,dblrightclick:this.defaultDblRightClick};var b={"double":true,stopDouble:true};this.handlers.click=new OpenLayers.Handler.Click(this,a,b);this.dragPan=new OpenLayers.Control.DragPan(OpenLayers.Util.extend({map:this.map},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.activate()},defaultDblClick:function(b){var a=this.map.getLonLatFromViewPortPx(b.xy);this.map.setCenter(a,this.map.zoom+1)},defaultDblRightClick:function(b){var a=this.map.getLonLatFromViewPortPx(b.xy);this.map.setCenter(a,this.map.zoom-1)},wheelChange:function(k,c){var g=this.map.getZoom()+c;if(!this.map.isValidZoomLevel(g)){return}var l=this.map.getSize();var f=l.w/2-k.xy.x;var d=k.xy.y-l.h/2;var h=this.map.baseLayer.getResolutionForZoom(g);var a=this.map.getLonLatFromPixel(k.xy);var b=new OpenLayers.LonLat(a.lon+f*h,a.lat+d*h);this.map.setCenter(b,g)},wheelUp:function(a){this.wheelChange(a,1)},wheelDown:function(a){this.wheelChange(a,-1)},disableZoomWheel:function(){this.zoomWheelEnabled=false;this.handlers.wheel.deactivate()},enableZoomWheel:function(){this.zoomWheelEnabled=true;if(this.active){this.handlers.wheel.activate()}},CLASS_NAME:"OpenLayers.Control.Navigation"});OpenLayers.Filter=OpenLayers.Class({initialize:function(a){OpenLayers.Util.extend(this,a)},destroy:function(){},evaluate:function(a){return true},clone:function(){return null},CLASS_NAME:"OpenLayers.Filter"});OpenLayers.Geometry=OpenLayers.Class({id:null,parent:null,bounds:null,initialize:function(){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){this.id=null;this.bounds=null},clone:function(){return new OpenLayers.Geometry()},setBounds:function(a){if(a){this.bounds=a.clone()}},clearBounds:function(){this.bounds=null;if(this.parent){this.parent.clearBounds()}},extendBounds:function(b){var a=this.getBounds();if(!a){this.setBounds(b)}else{this.bounds.extend(b)}},getBounds:function(){if(this.bounds==null){this.calculateBounds()}return this.bounds},calculateBounds:function(){},distanceTo:function(b,a){},getVertices:function(a){},atPoint:function(f,k,g){var c=false;var d=this.getBounds();if((d!=null)&&(f!=null)){var b=(k!=null)?k:0;var a=(g!=null)?g:0;var h=new OpenLayers.Bounds(this.bounds.left-b,this.bounds.bottom-a,this.bounds.right+b,this.bounds.top+a);c=h.containsLonLat(f)}return c},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(g){var h=arguments.callee.format;if(!h){h=new OpenLayers.Format.WKT();arguments.callee.format=h}var d;var b=h.read(g);if(b instanceof OpenLayers.Feature.Vector){d=b.geometry}else{if(b instanceof Array){var a=b.length;var f=new Array(a);for(var c=0;c<a;++c){f[c]=b[c].geometry}d=new OpenLayers.Geometry.Collection(f)}}return d};OpenLayers.Geometry.segmentsIntersect=function(a,K,b){var v=b&&b.point;var C=b&&b.tolerance;var g=false;var E=a.x1-K.x1;var I=a.y1-K.y1;var s=a.x2-a.x1;var B=a.y2-a.y1;var w=K.y2-K.y1;var o=K.x2-K.x1;var G=(w*s)-(o*B);var f=(o*I)-(w*E);var c=(s*I)-(B*E);if(G==0){if(f==0&&c==0){g=true}}else{var H=f/G;var F=c/G;if(H>=0&&H<=1&&F>=0&&F<=1){if(!v){g=true}else{var k=a.x1+(H*s);var h=a.y1+(H*B);g=new OpenLayers.Geometry.Point(k,h)}}}if(C){var u;if(g){if(v){var r=[a,K];var D,k,h;outer:for(var A=0;A<2;++A){D=r[A];for(var z=1;z<3;++z){k=D["x"+z];h=D["y"+z];u=Math.sqrt(Math.pow(k-g.x,2)+Math.pow(h-g.y,2));if(u<C){g.x=k;g.y=h;break outer}}}}}else{var r=[a,K];var t,J,k,h,q,l;outer:for(var A=0;A<2;++A){t=r[A];J=r[(A+1)%2];for(var z=1;z<3;++z){q={x:t["x"+z],y:t["y"+z]};l=OpenLayers.Geometry.distanceToSegment(q,J);if(l.distance<C){if(v){g=new OpenLayers.Geometry.Point(q.x,q.y)}else{g=true}break outer}}}}}return g};OpenLayers.Geometry.distanceToSegment=function(p,d){var c=p.x;var o=p.y;var b=d.x1;var l=d.y1;var a=d.x2;var g=d.y2;var r=a-b;var q=g-l;var k=((r*(c-b))+(q*(o-l)))/(Math.pow(r,2)+Math.pow(q,2));var h,f;if(k<=0){h=b;f=l}else{if(k>=1){h=a;f=g}else{h=b+k*r;f=l+k*q}}return{distance:Math.sqrt(Math.pow(h-c,2)+Math.pow(f-o,2)),x:h,y:f}};OpenLayers.Layer.ArcGIS93Rest=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{format:"png"},isBaseLayer:true,initialize:function(d,c,f,b){var a=[];f=OpenLayers.Util.upperCaseObject(f);a.push(d,c,f,b);OpenLayers.Layer.Grid.prototype.initialize.apply(this,a);OpenLayers.Util.applyDefaults(this.params,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS));if(this.params.TRANSPARENT&&this.params.TRANSPARENT.toString().toLowerCase()=="true"){if((b==null)||(!b.isBaseLayer)){this.isBaseLayer=false}if(this.params.FORMAT=="jpg"){this.params.FORMAT=OpenLayers.Util.alphaHack()?"gif":"png"}}},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments)},clone:function(a){if(a==null){a=new OpenLayers.Layer.ArcGIS93Rest(this.name,this.url,this.params,this.options)}a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a]);return a},getURL:function(f){f=this.adjustBounds(f);var d=this.projection.getCode().split(":");var c=d[d.length-1];var h=this.getImageSize();var k={BBOX:f.toBBOX(),SIZE:h.w+","+h.h,F:"image",BBOXSR:c,IMAGESR:c};if(this.layerDefs){var g=[];var a;for(a in this.layerDefs){if(this.layerDefs.hasOwnProperty(a)){if(this.layerDefs[a]){g.push(a);g.push(":");g.push(this.layerDefs[a]);g.push(";")}}}if(g.length>0){k.LAYERDEFS=g.join("")}}var b=this.getFullRequestString(k);return b},setLayerFilter:function(b,a){if(!this.layerDefs){this.layerDefs={}}if(a){this.layerDefs[b]=a}else{delete this.layerDefs[b]}},clearLayerFilter:function(a){if(a){delete this.layerDefs[a]}else{delete this.layerDefs}},mergeNewParams:function(c){var b=OpenLayers.Util.upperCaseObject(c);var a=[b];return OpenLayers.Layer.Grid.prototype.mergeNewParams.apply(this,a)},addTile:function(b,a){return new OpenLayers.Tile.Image(this,a,b,null,this.tileSize)},CLASS_NAME:"OpenLayers.Layer.ArcGIS93Rest"});OpenLayers.Layer.MapServer=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{mode:"map",map_imagetype:"png"},initialize:function(d,c,f,b){var a=[];a.push(d,c,f,b);OpenLayers.Layer.Grid.prototype.initialize.apply(this,a);this.params=OpenLayers.Util.applyDefaults(this.params,this.DEFAULT_PARAMS);if(b==null||b.isBaseLayer==null){this.isBaseLayer=((this.params.transparent!="true")&&(this.params.transparent!=true))}},clone:function(a){if(a==null){a=new OpenLayers.Layer.MapServer(this.name,this.url,this.params,this.options)}a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a]);return a},addTile:function(b,a){return new OpenLayers.Tile.Image(this,a,b,null,this.tileSize)},getURL:function(c){c=this.adjustBounds(c);var b=[c.left,c.bottom,c.right,c.top];var d=this.getImageSize();var a=this.getFullRequestString({mapext:b,imgext:b,map_size:[d.w,d.h],imgx:d.w/2,imgy:d.h/2,imgxy:[d.w,d.h]});return a},getFullRequestString:function(g,f){var b=(f==null)?this.url:f;var h=OpenLayers.Util.extend({},this.params);h=OpenLayers.Util.extend(h,g);var a=OpenLayers.Util.getParameterString(h);if(b instanceof Array){b=this.selectUrl(a,b)}var d=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(b));for(var k in h){if(k.toUpperCase() in d){delete h[k]}}a=OpenLayers.Util.getParameterString(h);var l=b;a=a.replace(/,/g,"+");if(a!=""){var c=b.charAt(b.length-1);if((c=="&")||(c=="?")){l+=a}else{if(b.indexOf("?")==-1){l+="?"+a}else{l+="&"+a}}}return l},CLASS_NAME:"OpenLayers.Layer.MapServer"});OpenLayers.Layer.TMS=OpenLayers.Class(OpenLayers.Layer.Grid,{serviceVersion:"1.0.0",isBaseLayer:true,tileOrigin:null,serverResolutions:null,initialize:function(d,c,b){var a=[];a.push(d,c,{},b);OpenLayers.Layer.Grid.prototype.initialize.apply(this,a)},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments)},clone:function(a){if(a==null){a=new OpenLayers.Layer.TMS(this.name,this.url,this.options)}a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a]);return a},getURL:function(d){d=this.adjustBounds(d);var c=this.map.getResolution();var a=Math.round((d.left-this.tileOrigin.lon)/(c*this.tileSize.w));var h=Math.round((d.bottom-this.tileOrigin.lat)/(c*this.tileSize.h));var g=this.serverResolutions!=null?OpenLayers.Util.indexOf(this.serverResolutions,c):this.map.getZoom();var f=this.serviceVersion+"/"+this.layername+"/"+g+"/"+a+"/"+h+"."+this.type;var b=this.url;if(b instanceof Array){b=this.selectUrl(f,b)}return b+f},addTile:function(b,a){return new OpenLayers.Tile.Image(this,a,b,null,this.tileSize)},setMap:function(a){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments);if(!this.tileOrigin){this.tileOrigin=new OpenLayers.LonLat(this.map.maxExtent.left,this.map.maxExtent.bottom)}},CLASS_NAME:"OpenLayers.Layer.TMS"});OpenLayers.Layer.TileCache=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:true,format:"image/png",serverResolutions:null,initialize:function(c,b,d,a){this.layername=d;OpenLayers.Layer.Grid.prototype.initialize.apply(this,[c,b,{},a]);this.extension=this.format.split("/")[1].toLowerCase();this.extension=(this.extension=="jpg")?"jpeg":this.extension},clone:function(a){if(a==null){a=new OpenLayers.Layer.TileCache(this.name,this.url,this.layername,this.options)}a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a]);return a},getURL:function(b){var g=this.map.getResolution();var h=this.maxExtent;var p=this.tileSize;var a=Math.round((b.left-h.left)/(g*p.w));var o=Math.round((b.bottom-h.bottom)/(g*p.h));var k=this.serverResolutions!=null?OpenLayers.Util.indexOf(this.serverResolutions,g):this.map.getZoom();function f(t,s){t=String(t);var q=[];for(var r=0;r<s;++r){q.push("0")}return q.join("").substring(0,s-t.length)+t}var d=[this.layername,f(k,2),f(parseInt(a/1000000),3),f((parseInt(a/1000)%1000),3),f((parseInt(a)%1000),3),f(parseInt(o/1000000),3),f((parseInt(o/1000)%1000),3),f((parseInt(o)%1000),3)+"."+this.extension];var l=d.join("/");var c=this.url;if(c instanceof Array){c=this.selectUrl(l,c)}c=(c.charAt(c.length-1)=="/")?c:c+"/";return c+l},addTile:function(c,a){var b=this.getURL(c);return new OpenLayers.Tile.Image(this,a,c,b,this.tileSize)},CLASS_NAME:"OpenLayers.Layer.TileCache"});OpenLayers.Layer.WMS=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{service:"WMS",version:"1.1.1",request:"GetMap",styles:"",exceptions:"application/vnd.ogc.se_inimage",format:"image/jpeg"},reproject:false,isBaseLayer:true,encodeBBOX:false,noMagic:false,initialize:function(d,c,f,b){var a=[];f=OpenLayers.Util.upperCaseObject(f);a.push(d,c,f,b);OpenLayers.Layer.Grid.prototype.initialize.apply(this,a);OpenLayers.Util.applyDefaults(this.params,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS));if(!this.noMagic&&this.params.TRANSPARENT&&this.params.TRANSPARENT.toString().toLowerCase()=="true"){if((b==null)||(!b.isBaseLayer)){this.isBaseLayer=false}if(this.params.FORMAT=="image/jpeg"){this.params.FORMAT=OpenLayers.Util.alphaHack()?"image/gif":"image/png"}}},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments)},clone:function(a){if(a==null){a=new OpenLayers.Layer.WMS(this.name,this.url,this.params,this.options)}a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a]);return a},getURL:function(b){b=this.adjustBounds(b);var c=this.getImageSize();var d={BBOX:this.encodeBBOX?b.toBBOX():b.toArray(),WIDTH:c.w,HEIGHT:c.h};var a=this.getFullRequestString(d);return a},addTile:function(b,a){return new OpenLayers.Tile.Image(this,a,b,null,this.tileSize)},mergeNewParams:function(c){var b=OpenLayers.Util.upperCaseObject(c);var a=[b];return OpenLayers.Layer.Grid.prototype.mergeNewParams.apply(this,a)},getFullRequestString:function(c,b){var a=this.map.getProjection();this.params.SRS=(a=="none")?null:a;return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments)},CLASS_NAME:"OpenLayers.Layer.WMS"});OpenLayers.Layer.XYZ=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:true,sphericalMercator:false,initialize:function(d,c,b){if(b&&b.sphericalMercator||this.sphericalMercator){b=OpenLayers.Util.extend({maxExtent:new OpenLayers.Bounds(-128*156543.0339,-128*156543.0339,128*156543.0339,128*156543.0339),maxResolution:156543.0339,numZoomLevels:19,units:"m",projection:"EPSG:900913"},b)}c=c||this.url;d=d||this.name;var a=[d,c,{},b];OpenLayers.Layer.Grid.prototype.initialize.apply(this,a)},clone:function(a){if(a==null){a=new OpenLayers.Layer.XYZ(this.name,this.url,this.options)}a=OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this,[a]);if(this.tileSize!=null){a.tileSize=this.tileSize.clone()}a.grid=[];return a},getURL:function(a){var d=this.map.getResolution();var h=Math.round((a.left-this.maxExtent.left)/(d*this.tileSize.w));var g=Math.round((this.maxExtent.top-a.top)/(d*this.tileSize.h));var f=this.map.getZoom();var c=Math.pow(2,f);var b=this.url;var l=""+h+g+f;if(b instanceof Array){b=this.selectUrl(l,b)}var k=OpenLayers.String.format(b,{x:h,y:g,z:f});return k},addTile:function(b,a){return new OpenLayers.Tile.Image(this,a,b,null,this.tileSize)},setMap:function(a){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments);if(!this.tileOrigin){this.tileOrigin=new OpenLayers.LonLat(this.maxExtent.left,this.maxExtent.bottom)}},CLASS_NAME:"OpenLayers.Layer.XYZ"});OpenLayers.Layer.OSM=OpenLayers.Class(OpenLayers.Layer.XYZ,{name:"OpenStreetMap",attribution:"Data CC-By-SA by <a href='http://openstreetmap.org/'>OpenStreetMap</a>",sphericalMercator:true,url:"http://tile.openstreetmap.org/${z}/${x}/${y}.png",CLASS_NAME:"OpenLayers.Layer.OSM"});OpenLayers.Rule=OpenLayers.Class({id:null,name:"default",title:null,description:null,context:null,filter:null,elseFilter:false,symbolizer:null,minScaleDenominator:null,maxScaleDenominator:null,initialize:function(a){this.symbolizer={};OpenLayers.Util.extend(this,a);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){for(var a in this.symbolizer){this.symbolizer[a]=null}this.symbolizer=null},evaluate:function(c){var b=this.getContext(c);var a=true;if(this.minScaleDenominator||this.maxScaleDenominator){var d=c.layer.map.getScale()}if(this.minScaleDenominator){a=d>=OpenLayers.Style.createLiteral(this.minScaleDenominator,b)}if(a&&this.maxScaleDenominator){a=d<OpenLayers.Style.createLiteral(this.maxScaleDenominator,b)}if(a&&this.filter){if(this.filter.CLASS_NAME=="OpenLayers.Filter.FeatureId"){a=this.filter.evaluate(c)}else{a=this.filter.evaluate(b)}}return a},getContext:function(b){var a=this.context;if(!a){a=b.attributes||b.data}if(typeof this.context=="function"){a=this.context(b)}return a},clone:function(){var a=OpenLayers.Util.extend({},this);a.symbolizer={};for(var b in this.symbolizer){value=this.symbolizer[b];type=typeof value;if(type==="object"){a.symbolizer[b]=OpenLayers.Util.extend({},value)}else{if(type==="string"){a.symbolizer[b]=value}}}a.filter=this.filter&&this.filter.clone();a.context=this.context&&OpenLayers.Util.extend({},this.context);return new OpenLayers.Rule(a)},CLASS_NAME:"OpenLayers.Rule"});OpenLayers.StyleMap=OpenLayers.Class({styles:null,extendDefault:true,initialize:function(c,a){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(c instanceof OpenLayers.Style){this.styles["default"]=c;this.styles.select=c;this.styles.temporary=c;this.styles["delete"]=c}else{if(typeof c=="object"){for(var b in c){if(c[b] instanceof OpenLayers.Style){this.styles[b]=c[b]}else{if(typeof c[b]=="object"){this.styles[b]=new OpenLayers.Style(c[b])}else{this.styles["default"]=new OpenLayers.Style(c);this.styles.select=new OpenLayers.Style(c);this.styles.temporary=new OpenLayers.Style(c);this.styles["delete"]=new OpenLayers.Style(c);break}}}}}OpenLayers.Util.extend(this,a)},destroy:function(){for(var a in this.styles){this.styles[a].destroy()}this.styles=null},createSymbolizer:function(b,c){if(!b){b=new OpenLayers.Feature.Vector()}if(!this.styles[c]){c="default"}b.renderIntent=c;var a={};if(this.extendDefault&&c!="default"){a=this.styles["default"].createSymbolizer(b)}return OpenLayers.Util.extend(a,this.styles[c].createSymbolizer(b))},addUniqueValueRules:function(b,d,g,a){var f=[];for(var c in g){f.push(new OpenLayers.Rule({symbolizer:g[c],context:a,filter:new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.EQUAL_TO,property:d,value:c})}))}this.styles[b].addRules(f)},CLASS_NAME:"OpenLayers.StyleMap"});OpenLayers.Filter.Comparison=OpenLayers.Class(OpenLayers.Filter,{type:null,property:null,value:null,matchCase:true,lowerBoundary:null,upperBoundary:null,initialize:function(a){OpenLayers.Filter.prototype.initialize.apply(this,[a])},evaluate:function(c){var a=false;switch(this.type){case OpenLayers.Filter.Comparison.EQUAL_TO:var b=c[this.property];var f=this.value;if(!this.matchCase&&typeof b=="string"&&typeof f=="string"){a=(b.toUpperCase()==f.toUpperCase())}else{a=(b==f)}break;case OpenLayers.Filter.Comparison.NOT_EQUAL_TO:var b=c[this.property];var f=this.value;if(!this.matchCase&&typeof b=="string"&&typeof f=="string"){a=(b.toUpperCase()!=f.toUpperCase())}else{a=(b!=f)}break;case OpenLayers.Filter.Comparison.LESS_THAN:a=c[this.property]<this.value;break;case OpenLayers.Filter.Comparison.GREATER_THAN:a=c[this.property]>this.value;break;case OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO:a=c[this.property]<=this.value;break;case OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO:a=c[this.property]>=this.value;break;case OpenLayers.Filter.Comparison.BETWEEN:a=(c[this.property]>=this.lowerBoundary)&&(c[this.property]<=this.upperBoundary);break;case OpenLayers.Filter.Comparison.LIKE:var d=new RegExp(this.value,"gi");a=d.test(c[this.property]);break}return a},value2regex:function(d,b,a){if(d=="."){var c="'.' is an unsupported wildCard character for OpenLayers.Filter.Comparison";OpenLayers.Console.error(c);return null}d=d?d:"*";b=b?b:".";a=a?a:"!";this.value=this.value.replace(new RegExp("\\"+a+"(.|$)","g"),"\\$1");this.value=this.value.replace(new RegExp("\\"+b,"g"),".");this.value=this.value.replace(new RegExp("\\"+d,"g"),".*");this.value=this.value.replace(new RegExp("\\\\.\\*","g"),"\\"+d);this.value=this.value.replace(new RegExp("\\\\\\.","g"),"\\"+b);return this.value},regex2value:function(){var a=this.value;a=a.replace(/!/g,"!!");a=a.replace(/(\\)?\\\./g,function(c,b){return b?c:"!."});a=a.replace(/(\\)?\\\*/g,function(c,b){return b?c:"!*"});a=a.replace(/\\\\/g,"\\");a=a.replace(/\.\*/g,"*");return a},clone:function(){return OpenLayers.Util.extend(new OpenLayers.Filter.Comparison(),this)},CLASS_NAME:"OpenLayers.Filter.Comparison"});OpenLayers.Filter.Comparison.EQUAL_TO="==";OpenLayers.Filter.Comparison.NOT_EQUAL_TO="!=";OpenLayers.Filter.Comparison.LESS_THAN="<";OpenLayers.Filter.Comparison.GREATER_THAN=">";OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO="<=";OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO=">=";OpenLayers.Filter.Comparison.BETWEEN="..";OpenLayers.Filter.Comparison.LIKE="~";OpenLayers.Filter.FeatureId=OpenLayers.Class(OpenLayers.Filter,{fids:null,initialize:function(a){this.fids=[];OpenLayers.Filter.prototype.initialize.apply(this,[a])},evaluate:function(c){for(var b=0,a=this.fids.length;b<a;b++){var d=c.fid||c.id;if(d==this.fids[b]){return true}}return false},clone:function(){var a=new OpenLayers.Filter.FeatureId();OpenLayers.Util.extend(a,this);a.fids=this.fids.slice();return a},CLASS_NAME:"OpenLayers.Filter.FeatureId"});OpenLayers.Filter.Logical=OpenLayers.Class(OpenLayers.Filter,{filters:null,type:null,initialize:function(a){this.filters=[];OpenLayers.Filter.prototype.initialize.apply(this,[a])},destroy:function(){this.filters=null;OpenLayers.Filter.prototype.destroy.apply(this)},evaluate:function(c){switch(this.type){case OpenLayers.Filter.Logical.AND:for(var b=0,a=this.filters.length;b<a;b++){if(this.filters[b].evaluate(c)==false){return false}}return true;case OpenLayers.Filter.Logical.OR:for(var b=0,a=this.filters.length;b<a;b++){if(this.filters[b].evaluate(c)==true){return true}}return false;case OpenLayers.Filter.Logical.NOT:return(!this.filters[0].evaluate(c))}},clone:function(){var c=[];for(var b=0,a=this.filters.length;b<a;++b){c.push(this.filters[b].clone())}return new OpenLayers.Filter.Logical({type:this.type,filters:c})},CLASS_NAME:"OpenLayers.Filter.Logical"});OpenLayers.Filter.Logical.AND="&&";OpenLayers.Filter.Logical.OR="||";OpenLayers.Filter.Logical.NOT="!";OpenLayers.Filter.Spatial=OpenLayers.Class(OpenLayers.Filter,{type:null,property:null,value:null,distance:null,distanceUnits:null,initialize:function(a){OpenLayers.Filter.prototype.initialize.apply(this,[a])},evaluate:function(c){var a=false;switch(this.type){case OpenLayers.Filter.Spatial.BBOX:case OpenLayers.Filter.Spatial.INTERSECTS:if(c.geometry){var b=this.value;if(this.value.CLASS_NAME=="OpenLayers.Bounds"){b=this.value.toGeometry()}if(c.geometry.intersects(b)){a=true}}break;default:OpenLayers.Console.error(OpenLayers.i18n("filterEvaluateNotImplemented"));break}return a},clone:function(){var a=OpenLayers.Util.applyDefaults({value:this.value&&this.value.clone&&this.value.clone()},this);return new OpenLayers.Filter.Spatial(a)},CLASS_NAME:"OpenLayers.Filter.Spatial"});OpenLayers.Filter.Spatial.BBOX="BBOX";OpenLayers.Filter.Spatial.INTERSECTS="INTERSECTS";OpenLayers.Filter.Spatial.DWITHIN="DWITHIN";OpenLayers.Filter.Spatial.WITHIN="WITHIN";OpenLayers.Filter.Spatial.CONTAINS="CONTAINS";OpenLayers.Geometry.Collection=OpenLayers.Class(OpenLayers.Geometry,{components:null,componentTypes:null,initialize:function(a){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.components=[];if(a!=null){this.addComponents(a)}},destroy:function(){this.components.length=0;this.components=null},clone:function(){var geometry=eval("new "+this.CLASS_NAME+"()");for(var i=0,len=this.components.length;i<len;i++){geometry.addComponent(this.components[i].clone())}OpenLayers.Util.applyDefaults(geometry,this);return geometry},getComponentsString:function(){var b=[];for(var c=0,a=this.components.length;c<a;c++){b.push(this.components[c].toShortString())}return b.join(",")},calculateBounds:function(){this.bounds=null;if(this.components&&this.components.length>0){this.setBounds(this.components[0].getBounds());for(var b=1,a=this.components.length;b<a;b++){this.extendBounds(this.components[b].getBounds())}}},addComponents:function(c){if(!(c instanceof Array)){c=[c]}for(var b=0,a=c.length;b<a;b++){this.addComponent(c[b])}},addComponent:function(b,a){var d=false;if(b){if(this.componentTypes==null||(OpenLayers.Util.indexOf(this.componentTypes,b.CLASS_NAME)>-1)){if(a!=null&&(a<this.components.length)){var f=this.components.slice(0,a);var c=this.components.slice(a,this.components.length);f.push(b);this.components=f.concat(c)}else{this.components.push(b)}b.parent=this;this.clearBounds();d=true}}return d},removeComponents:function(b){if(!(b instanceof Array)){b=[b]}for(var a=b.length-1;a>=0;--a){this.removeComponent(b[a])}},removeComponent:function(a){OpenLayers.Util.removeItem(this.components,a);this.clearBounds()},getLength:function(){var c=0;for(var b=0,a=this.components.length;b<a;b++){c+=this.components[b].getLength()}return c},getArea:function(){var c=0;for(var b=0,a=this.components.length;b<a;b++){c+=this.components[b].getArea()}return c},getGeodesicArea:function(b){var d=0;for(var c=0,a=this.components.length;c<a;c++){d+=this.components[c].getGeodesicArea(b)}return d},getCentroid:function(){return this.components.length&&this.components[0].getCentroid()},getGeodesicLength:function(b){var d=0;for(var c=0,a=this.components.length;c<a;c++){d+=this.components[c].getGeodesicLength(b)}return d},move:function(b,d){for(var c=0,a=this.components.length;c<a;c++){this.components[c].move(b,d)}},rotate:function(d,b){for(var c=0,a=this.components.length;c<a;++c){this.components[c].rotate(d,b)}},resize:function(d,a,c){for(var b=0;b<this.components.length;++b){this.components[b].resize(d,a,c)}return this},distanceTo:function(h,k){var b=!(k&&k.edge===false);var a=b&&k&&k.details;var l,c;var d=Number.POSITIVE_INFINITY;for(var f=0,g=this.components.length;f<g;++f){l=this.components[f].distanceTo(h,k);distance=a?l.distance:l;if(distance<d){d=distance;c=l;if(d==0){break}}}return c},equals:function(d){var b=true;if(!d||!d.CLASS_NAME||(this.CLASS_NAME!=d.CLASS_NAME)){b=false}else{if(!(d.components instanceof Array)||(d.components.length!=this.components.length)){b=false}else{for(var c=0,a=this.components.length;c<a;++c){if(!this.components[c].equals(d.components[c])){b=false;break}}}}return b},transform:function(f,c){if(f&&c){for(var d=0,a=this.components.length;d<a;d++){var b=this.components[d];b.transform(f,c)}this.bounds=null}return this},intersects:function(d){var b=false;for(var c=0,a=this.components.length;c<a;++c){b=d.intersects(this.components[c]);if(b){break}}return b},getVertices:function(b){var c=[];for(var d=0,a=this.components.length;d<a;++d){Array.prototype.push.apply(c,this.components[d].getVertices(b))}return c},CLASS_NAME:"OpenLayers.Geometry.Collection"});OpenLayers.Geometry.Point=OpenLayers.Class(OpenLayers.Geometry,{x:null,y:null,initialize:function(a,b){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.x=parseFloat(a);this.y=parseFloat(b)},clone:function(a){if(a==null){a=new OpenLayers.Geometry.Point(this.x,this.y)}OpenLayers.Util.applyDefaults(a,this);return a},calculateBounds:function(){this.bounds=new OpenLayers.Bounds(this.x,this.y,this.x,this.y)},distanceTo:function(g,o){var d=!(o&&o.edge===false);var a=d&&o&&o.details;var b,f,k,c,h,l;if(g instanceof OpenLayers.Geometry.Point){f=this.x;k=this.y;c=g.x;h=g.y;b=Math.sqrt(Math.pow(f-c,2)+Math.pow(k-h,2));l=!a?b:{x0:f,y0:k,x1:c,y1:h,distance:b}}else{l=g.distanceTo(this,o);if(a){l={x0:l.x1,y0:l.y1,x1:l.x0,y1:l.y0,distance:l.distance}}}return l},equals:function(a){var b=false;if(a!=null){b=((this.x==a.x&&this.y==a.y)||(isNaN(this.x)&&isNaN(this.y)&&isNaN(a.x)&&isNaN(a.y)))}return b},toShortString:function(){return(this.x+", "+this.y)},move:function(a,b){this.x=this.x+a;this.y=this.y+b;this.clearBounds()},rotate:function(d,b){d*=Math.PI/180;var a=this.distanceTo(b);var c=d+Math.atan2(this.y-b.y,this.x-b.x);this.x=b.x+(a*Math.cos(c));this.y=b.y+(a*Math.sin(c));this.clearBounds()},getCentroid:function(){return new OpenLayers.Geometry.Point(this.x,this.y)},resize:function(c,a,b){b=(b==undefined)?1:b;this.x=a.x+(c*b*(this.x-a.x));this.y=a.y+(c*(this.y-a.y));this.clearBounds();return this},intersects:function(b){var a=false;if(b.CLASS_NAME=="OpenLayers.Geometry.Point"){a=this.equals(b)}else{a=b.intersects(this)}return a},transform:function(b,a){if((b&&a)){OpenLayers.Projection.transform(this,b,a);this.bounds=null}return this},getVertices:function(a){return[this]},CLASS_NAME:"OpenLayers.Geometry.Point"});OpenLayers.Geometry.Rectangle=OpenLayers.Class(OpenLayers.Geometry,{x:null,y:null,width:null,height:null,initialize:function(b,d,c,a){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.x=b;this.y=d;this.width=c;this.height=a},calculateBounds:function(){this.bounds=new OpenLayers.Bounds(this.x,this.y,this.x+this.width,this.y+this.height)},getLength:function(){var a=(2*this.width)+(2*this.height);return a},getArea:function(){var a=this.width*this.height;return a},CLASS_NAME:"OpenLayers.Geometry.Rectangle"});OpenLayers.Geometry.Surface=OpenLayers.Class(OpenLayers.Geometry,{initialize:function(){OpenLayers.Geometry.prototype.initialize.apply(this,arguments)},CLASS_NAME:"OpenLayers.Geometry.Surface"});OpenLayers.Layer.MapServer.Untiled=OpenLayers.Class(OpenLayers.Layer.MapServer,{singleTile:true,initialize:function(c,b,f,a){OpenLayers.Layer.MapServer.prototype.initialize.apply(this,arguments);var d="The OpenLayers.Layer.MapServer.Untiled class is deprecated and will be removed in 3.0. Instead, you should use the normal OpenLayers.Layer.MapServer class, passing it the option 'singleTile' as true.";OpenLayers.Console.warn(d)},clone:function(a){if(a==null){a=new OpenLayers.Layer.MapServer.Untiled(this.name,this.url,this.params,this.options)}a=OpenLayers.Layer.MapServer.prototype.clone.apply(this,[a]);return a},CLASS_NAME:"OpenLayers.Layer.MapServer.Untiled"});OpenLayers.Layer.Vector=OpenLayers.Class(OpenLayers.Layer,{EVENT_TYPES:["beforefeatureadded","beforefeaturesadded","featureadded","featuresadded","beforefeatureremoved","featureremoved","featuresremoved","beforefeatureselected","featureselected","featureunselected","beforefeaturemodified","featuremodified","afterfeaturemodified","vertexmodified","sketchstarted","sketchmodified","sketchcomplete","refresh"],isBaseLayer:false,isFixed:false,isVector:true,features:null,selectedFeatures:null,unrenderedFeatures:null,reportError:true,style:null,styleMap:null,strategies:null,protocol:null,renderers:["SVG","VML","Canvas"],renderer:null,rendererOptions:null,geometryType:null,drawn:false,initialize:function(c,b){this.EVENT_TYPES=OpenLayers.Layer.Vector.prototype.EVENT_TYPES.concat(OpenLayers.Layer.prototype.EVENT_TYPES);OpenLayers.Layer.prototype.initialize.apply(this,arguments);if(!this.renderer||!this.renderer.supported()){this.assignRenderer()}if(!this.renderer||!this.renderer.supported()){this.renderer=null;this.displayError()}if(!this.styleMap){this.styleMap=new OpenLayers.StyleMap()}this.features=[];this.selectedFeatures=[];this.unrenderedFeatures={};if(this.strategies){for(var d=0,a=this.strategies.length;d<a;d++){this.strategies[d].setLayer(this)}}},destroy:function(){if(this.strategies){var c,b,a;for(b=0,a=this.strategies.length;b<a;b++){c=this.strategies[b];if(c.autoDestroy){c.destroy()}}this.strategies=null}if(this.protocol){if(this.protocol.autoDestroy){this.protocol.destroy()}this.protocol=null}this.destroyFeatures();this.features=null;this.selectedFeatures=null;this.unrenderedFeatures=null;if(this.renderer){this.renderer.destroy()}this.renderer=null;this.geometryType=null;this.drawn=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},refresh:function(a){if(this.calculateInRange()&&this.visibility){this.events.triggerEvent("refresh",a)}},assignRenderer:function(){for(var c=0,a=this.renderers.length;c<a;c++){var b=OpenLayers.Renderer[this.renderers[c]];if(b&&b.prototype.supported()){this.renderer=new b(this.div,this.rendererOptions);break}}},displayError:function(){if(this.reportError){OpenLayers.Console.userError(OpenLayers.i18n("browserNotSupported",{renderers:this.renderers.join("\n")}))}},setMap:function(a){OpenLayers.Layer.prototype.setMap.apply(this,arguments);if(!this.renderer){this.map.removeLayer(this)}else{this.renderer.map=this.map;this.renderer.setSize(this.map.getSize())}},afterAdd:function(){if(this.strategies){var c,b,a;for(b=0,a=this.strategies.length;b<a;b++){c=this.strategies[b];if(c.autoActivate){c.activate()}}}},removeMap:function(c){if(this.strategies){var d,b,a;for(b=0,a=this.strategies.length;b<a;b++){d=this.strategies[b];if(d.autoActivate){d.deactivate()}}}},onMapResize:function(){OpenLayers.Layer.prototype.onMapResize.apply(this,arguments);this.renderer.setSize(this.map.getSize())},moveTo:function(h,b,k){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);var f=true;if(!k){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";var g=this.map.getExtent();f=this.renderer.setExtent(g,b);this.renderer.root.style.visibility="visible";if(navigator.userAgent.toLowerCase().indexOf("gecko")!=-1){this.div.scrollLeft=this.div.scrollLeft}if(!b&&f){for(var d in this.unrenderedFeatures){var c=this.unrenderedFeatures[d];this.drawFeature(c)}}}if(!this.drawn||b||!f){this.drawn=true;var c;for(var d=0,a=this.features.length;d<a;d++){this.renderer.locked=(d!==(a-1));c=this.features[d];this.drawFeature(c)}}},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(b,l){if(!(b instanceof Array)){b=[b]}var h=!l||!l.silent;if(h){var a={features:b};var g=this.events.triggerEvent("beforefeaturesadded",a);if(g===false){return}b=a.features}for(var c=0,f=b.length;c<f;c++){if(c!=(b.length-1)){this.renderer.locked=true}else{this.renderer.locked=false}var k=b[c];if(this.geometryType&&!(k.geometry instanceof this.geometryType)){var d=OpenLayers.i18n("componentShouldBe",{geomType:this.geometryType.prototype.CLASS_NAME});throw d}this.features.push(k);k.layer=this;if(!k.style&&this.style){k.style=OpenLayers.Util.extend({},this.style)}if(h){if(this.events.triggerEvent("beforefeatureadded",{feature:k})===false){continue}this.preFeatureInsert(k)}this.drawFeature(k);if(h){this.events.triggerEvent("featureadded",{feature:k});this.onFeatureInsert(k)}}if(h){this.events.triggerEvent("featuresadded",{features:b})}},removeFeatures:function(f,a){if(!f||f.length===0){return}if(!(f instanceof Array)){f=[f]}if(f===this.features){f=f.slice()}var d=!a||!a.silent;for(var c=f.length-1;c>=0;c--){if(c!=0&&f[c-1].geometry){this.renderer.locked=true}else{this.renderer.locked=false}var b=f[c];delete this.unrenderedFeatures[b.id];if(d){this.events.triggerEvent("beforefeatureremoved",{feature:b})}this.features=OpenLayers.Util.removeItem(this.features,b);b.layer=null;if(b.geometry){this.renderer.eraseFeatures(b)}if(OpenLayers.Util.indexOf(this.selectedFeatures,b)!=-1){OpenLayers.Util.removeItem(this.selectedFeatures,b)}if(d){this.events.triggerEvent("featureremoved",{feature:b})}}if(d){this.events.triggerEvent("featuresremoved",{features:f})}},destroyFeatures:function(d,a){var c=(d==undefined);if(c){d=this.features}if(d){this.removeFeatures(d,a);for(var b=d.length-1;b>=0;b--){d[b].destroy()}}},drawFeature:function(a,b){if(!this.drawn){return}if(typeof b!="object"){if(!b&&a.state===OpenLayers.State.DELETE){b="delete"}var c=b||a.renderIntent;b=a.style||this.style;if(!b){b=this.styleMap.createSymbolizer(a,c)}}if(!this.renderer.drawFeature(a,b)){this.unrenderedFeatures[a.id]=a}else{delete this.unrenderedFeatures[a.id]}},eraseFeatures:function(a){this.renderer.eraseFeatures(a)},getFeatureFromEvent:function(a){if(!this.renderer){OpenLayers.Console.error(OpenLayers.i18n("getFeatureError"));return null}var b=this.renderer.getFeatureIdFromEvent(a);return this.getFeatureById(b)},getFeatureById:function(d){var c=null;for(var b=0,a=this.features.length;b<a;++b){if(this.features[b].id==d){c=this.features[b];break}}return c},onFeatureInsert:function(a){},preFeatureInsert:function(a){},getDataExtent:function(){var b=null;if(this.features&&(this.features.length>0)){b=new OpenLayers.Bounds();for(var c=0,a=this.features.length;c<a;c++){b.extend(this.features[c].geometry.getBounds())}}return b},CLASS_NAME:"OpenLayers.Layer.Vector"});OpenLayers.Layer.WMS.Untiled=OpenLayers.Class(OpenLayers.Layer.WMS,{singleTile:true,initialize:function(c,b,f,a){OpenLayers.Layer.WMS.prototype.initialize.apply(this,arguments);var d="The OpenLayers.Layer.WMS.Untiled class is deprecated and will be removed in 3.0. Instead, you should use the normal OpenLayers.Layer.WMS class, passing it the option 'singleTile' as true.";OpenLayers.Console.warn(d)},clone:function(a){if(a==null){a=new OpenLayers.Layer.WMS.Untiled(this.name,this.url,this.params,this.options)}a=OpenLayers.Layer.WMS.prototype.clone.apply(this,[a]);return a},CLASS_NAME:"OpenLayers.Layer.WMS.Untiled"});OpenLayers.Control.GetFeature=OpenLayers.Class(OpenLayers.Control,{protocol:null,multipleKey:null,toggleKey:null,modifiers:null,multiple:false,click:true,clickout:true,toggle:false,clickTolerance:5,hover:false,box:false,maxFeatures:10,features:null,hoverFeature:null,handlerOptions:null,handlers:null,hoverResponse:null,EVENT_TYPES:["featureselected","featureunselected","clickout","beforefeatureselected","hoverfeature","outfeature"],initialize:function(a){this.EVENT_TYPES=OpenLayers.Control.GetFeature.prototype.EVENT_TYPES.concat(OpenLayers.Control.prototype.EVENT_TYPES);a.handlerOptions=a.handlerOptions||{};OpenLayers.Control.prototype.initialize.apply(this,[a]);this.features={};this.handlers={};if(this.click){this.handlers.click=new OpenLayers.Handler.Click(this,{click:this.selectSingle},this.handlerOptions.click||{})}if(this.box){this.handlers.box=new OpenLayers.Handler.Box(this,{done:this.selectBox},OpenLayers.Util.extend(this.handlerOptions.box,{boxDivClassName:"olHandlerBoxSelectFeature"}))}if(this.hover){this.handlers.hover=new OpenLayers.Handler.Hover(this,{move:this.cancelHover,pause:this.selectHover},OpenLayers.Util.extend(this.handlerOptions.hover,{delay:250}))}},activate:function(){if(!this.active){for(var a in this.handlers){this.handlers[a].activate()}}return OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){if(this.active){for(var a in this.handlers){this.handlers[a].deactivate()}}return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},unselectAll:function(a){var c;for(var b=this.features.length-1;b>=0;--b){c=this.features[b];if(!a||a.except!=c){this.unselect(c)}}},selectSingle:function(a){OpenLayers.Element.addClass(this.map.viewPortDiv,"olCursorWait");var b=this.pixelToBounds(a.xy);this.setModifiers(a);this.request(b,{single:true})},selectBox:function(a){if(a instanceof OpenLayers.Bounds){var d=this.map.getLonLatFromPixel(new OpenLayers.Pixel(a.left,a.bottom));var b=this.map.getLonLatFromPixel(new OpenLayers.Pixel(a.right,a.top));var c=new OpenLayers.Bounds(d.lon,d.lat,b.lon,b.lat);this.setModifiers(this.handlers.box.dragHandler.evt);this.request(c)}},selectHover:function(a){var b=this.pixelToBounds(a.xy);this.request(b,{single:true,hover:true})},cancelHover:function(){if(this.hoverResponse){this.protocol.abort(this.hoverResponse);this.hoverResponse=null}},request:function(d,b){b=b||{};var c=new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.BBOX,value:d});var a=this.protocol.read({maxFeatures:b.single==true?this.maxFeatures:undefined,filter:c,callback:function(f){if(f.code==1){if(f.features.length){if(b.single==true){this.selectBestFeature(f.features,d.getCenterLonLat(),b)}else{this.select(f.features)}}else{if(b.hover){this.hoverSelect()}else{this.events.triggerEvent("clickout");if(this.clickout){this.unselectAll()}}}}OpenLayers.Element.removeClass(this.map.viewPortDiv,"olCursorWait")},scope:this});if(b.hover==true){this.hoverResponse=a}},selectBestFeature:function(b,a,l){l=l||{};if(b.length){var h=new OpenLayers.Geometry.Point(a.lon,a.lat);var k,d,f;var g=Number.MAX_VALUE;for(var c=0;c<b.length;++c){k=b[c];if(k.geometry){f=h.distanceTo(k.geometry,{edge:false});if(f<g){g=f;d=k;if(g==0){break}}}}if(l.hover==true){this.hoverSelect(d)}else{this.select(d||b)}}},setModifiers:function(a){this.modifiers={multiple:this.multiple||(this.multipleKey&&a[this.multipleKey]),toggle:this.toggle||(this.toggleKey&&a[this.toggleKey])}},select:function(d){if(!this.modifiers.multiple&&!this.modifiers.toggle){this.unselectAll()}if(!(d instanceof Array)){d=[d]}var c;for(var b=0,a=d.length;b<a;++b){c=d[b];if(this.features[c.fid||c.id]){if(this.modifiers.toggle){this.unselect(this.features[c.fid||c.id])}}else{cont=this.events.triggerEvent("beforefeatureselected",{feature:c});if(cont!==false){this.features[c.fid||c.id]=c;this.events.triggerEvent("featureselected",{feature:c})}}}},hoverSelect:function(a){var c=a?a.fid||a.id:null;var b=this.hoverFeature?this.hoverFeature.fid||this.hoverFeature.id:null;if(b&&b!=c){this.events.triggerEvent("outfeature",{feature:this.hoverFeature});this.hoverFeature=null}if(c&&c!=b){this.events.triggerEvent("hoverfeature",{feature:a});this.hoverFeature=a}},unselect:function(a){delete this.features[a.fid||a.id];this.events.triggerEvent("featureunselected",{feature:a})},unselectAll:function(){for(var a in this.features){this.unselect(this.features[a])}},setMap:function(b){for(var a in this.handlers){this.handlers[a].setMap(b)}OpenLayers.Control.prototype.setMap.apply(this,arguments)},pixelToBounds:function(b){var f=b.add(-this.clickTolerance/2,this.clickTolerance/2);var a=b.add(this.clickTolerance/2,-this.clickTolerance/2);var c=this.map.getLonLatFromPixel(f);var d=this.map.getLonLatFromPixel(a);return new OpenLayers.Bounds(c.lon,c.lat,d.lon,d.lat)},CLASS_NAME:"OpenLayers.Control.GetFeature"});OpenLayers.Control.Snapping=OpenLayers.Class(OpenLayers.Control,{EVENT_TYPES:["beforesnap","snap","unsnap"],DEFAULTS:{tolerance:10,node:true,edge:true,vertex:true},greedy:true,precedence:["node","vertex","edge"],resolution:null,geoToleranceCache:null,layer:null,feature:null,point:null,initialize:function(a){Array.prototype.push.apply(this.EVENT_TYPES,OpenLayers.Control.prototype.EVENT_TYPES);OpenLayers.Control.prototype.initialize.apply(this,[a]);this.options=a||{};if(this.options.layer){this.setLayer(this.options.layer)}var b=OpenLayers.Util.extend({},this.options.defaults);this.defaults=OpenLayers.Util.applyDefaults(b,this.DEFAULTS);this.setTargets(this.options.targets);if(this.targets.length===0&&this.layer){this.addTargetLayer(this.layer)}this.geoToleranceCache={}},setLayer:function(a){if(this.active){this.deactivate();this.layer=a;this.activate()}else{this.layer=a}},setTargets:function(b){this.targets=[];if(b&&b.length){var d;for(var c=0,a=b.length;c<a;++c){d=b[c];if(d instanceof OpenLayers.Layer.Vector){this.addTargetLayer(d)}else{this.addTarget(d)}}}},addTargetLayer:function(a){this.addTarget({layer:a})},addTarget:function(a){a=OpenLayers.Util.applyDefaults(a,this.defaults);a.nodeTolerance=a.nodeTolerance||a.tolerance;a.vertexTolerance=a.vertexTolerance||a.tolerance;a.edgeTolerance=a.edgeTolerance||a.tolerance;this.targets.push(a)},removeTargetLayer:function(b){var c;for(var a=this.targets.length-1;a>=0;--a){c=this.targets[a];if(c.layer===b){this.removeTarget(c)}}},removeTarget:function(a){return OpenLayers.Util.removeItem(this.targets,a)},activate:function(){var a=OpenLayers.Control.prototype.activate.call(this);if(a){if(this.layer&&this.layer.events){this.layer.events.on({sketchstarted:this.onSketchModified,sketchmodified:this.onSketchModified,vertexmodified:this.onVertexModified,scope:this})}}return a},deactivate:function(){var a=OpenLayers.Control.prototype.deactivate.call(this);if(a){if(this.layer&&this.layer.events){this.layer.events.un({sketchstarted:this.onSketchModified,sketchmodified:this.onSketchModified,vertexmodified:this.onVertexModified,scope:this})}}this.feature=null;this.point=null;return a},onSketchModified:function(a){this.feature=a.feature;this.considerSnapping(a.vertex,a.vertex)},onVertexModified:function(a){this.feature=a.feature;var b=this.layer.map.getLonLatFromViewPortPx(a.pixel);this.considerSnapping(a.vertex,new OpenLayers.Geometry.Point(b.lon,b.lat))},considerSnapping:function(k,d){var a={rank:Number.POSITIVE_INFINITY,dist:Number.POSITIVE_INFINITY,x:null,y:null};var c=false;var l,g;for(var b=0,f=this.targets.length;b<f;++b){g=this.targets[b];l=this.testTarget(g,d);if(l){if(this.greedy){a=l;a.target=g;c=true;break}else{if((l.rank<a.rank)||(l.rank===a.rank&&l.dist<a.dist)){a=l;a.target=g;c=true}}}}if(c){var h=this.events.triggerEvent("beforesnap",{point:k,x:a.x,y:a.y,distance:a.dist,layer:a.target.layer,snapType:this.precedence[a.rank]});if(h!==false){k.x=a.x;k.y=a.y;this.point=k;this.events.triggerEvent("snap",{point:k,snapType:this.precedence[a.rank],layer:a.target.layer,distance:a.dist})}else{c=false}}if(this.point&&!c){k.x=d.x;k.y=d.y;this.point=null;this.events.triggerEvent("unsnap",{point:k})}},testTarget:function(D,g){var B={node:this.getGeoTolerance(D.nodeTolerance),vertex:this.getGeoTolerance(D.vertexTolerance),edge:this.getGeoTolerance(D.edgeTolerance)};var h=Math.max(B.node,B.vertex,B.edge);var l={rank:Number.POSITIVE_INFINITY,dist:Number.POSITIVE_INFINITY};var f=false;var c=D.layer.features;var b,a,d,C,r,s,q;var p=this.precedence.length;var o=new OpenLayers.LonLat(g.x,g.y);for(var z=0,A=c.length;z<A;++z){b=c[z];if(b!==this.feature&&!b._sketch&&b.state!==OpenLayers.State.DELETE&&(!D.filter||D.filter.evaluate(b.attributes))){if(b.atPoint(o,h,h)){for(var w=0,t=Math.min(l.rank+1,p);w<t;++w){a=this.precedence[w];if(D[a]){if(a==="edge"){r=b.geometry.distanceTo(g,{details:true});s=r.distance;if(s<=B[a]&&s<l.dist){l={rank:w,dist:s,x:r.x0,y:r.y0};f=true;break}}else{d=b.geometry.getVertices(a==="node");q=false;for(var v=0,u=d.length;v<u;++v){C=d[v];s=C.distanceTo(g);if(s<=B[a]&&(w<l.rank||(w===l.rank&&s<l.dist))){l={rank:w,dist:s,x:C.x,y:C.y};f=true;q=true}}if(q){break}}}}}}}return f?l:null},getGeoTolerance:function(a){var b=this.layer.map.getResolution();if(b!==this.resolution){this.resolution=b;this.geoToleranceCache={}}var c=this.geoToleranceCache[a];if(c===undefined){c=a*b;this.geoToleranceCache[a]=c}return c},destroy:function(){if(this.active){this.deactivate()}delete this.layer;delete this.targets;OpenLayers.Control.prototype.destroy.call(this)},CLASS_NAME:"OpenLayers.Control.Snapping"});OpenLayers.Format.Filter=OpenLayers.Class(OpenLayers.Format.XML,{defaultVersion:"1.0.0",version:null,parser:null,initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},write:function(c,b){var a=(b&&b.version)||this.version||this.defaultVersion;if(!this.parser||this.parser.VERSION!=a){var d=OpenLayers.Format.Filter["v"+a.replace(/\./g,"_")];if(!d){throw"Can't find a Filter parser for version "+a}this.parser=new d(this.options)}return this.parser.write(c)},read:function(c){if(typeof c=="string"){c=OpenLayers.Format.XML.prototype.read.apply(this,[c])}var a=this.version;if(!a){a=this.defaultVersion}if(!this.parser||this.parser.VERSION!=a){var d=OpenLayers.Format.Filter["v"+a.replace(/\./g,"_")];if(!d){throw"Can't find a Filter parser for version "+a}this.parser=new d(this.options)}var b=this.parser.read(c);return b},CLASS_NAME:"OpenLayers.Format.Filter"});OpenLayers.Format.Text=OpenLayers.Class(OpenLayers.Format,{defaultStyle:null,extractStyles:true,initialize:function(a){a=a||{};if(a.extractStyles!==false){a.defaultStyle={externalGraphic:OpenLayers.Util.getImagesLocation()+"marker.png",graphicWidth:21,graphicHeight:25,graphicXOffset:-10.5,graphicYOffset:-12.5}}OpenLayers.Format.prototype.initialize.apply(this,[a])},read:function(o){var a=o.split("\n");var b;var h=[];for(var A=0;A<(a.length-1);A++){var z=a[A].replace(/^\s*/,"").replace(/\s*$/,"");if(z.charAt(0)!="#"){if(!b){b=z.split("\t")}else{var q=z.split("\t");var d=new OpenLayers.Geometry.Point(0,0);var k={};var u=this.defaultStyle?OpenLayers.Util.applyDefaults({},this.defaultStyle):null;var v,w,c,s;var p=false;for(var l=0;l<q.length;l++){if(q[l]){if(b[l]=="point"){var t=q[l].split(",");d.y=parseFloat(t[0]);d.x=parseFloat(t[1]);p=true}else{if(b[l]=="lat"){d.y=parseFloat(q[l]);p=true}else{if(b[l]=="lon"){d.x=parseFloat(q[l]);p=true}else{if(b[l]=="title"){k.title=q[l]}else{if(b[l]=="image"||b[l]=="icon"&&u){u.externalGraphic=q[l]}else{if(b[l]=="iconSize"&&u){var r=q[l].split(",");u.graphicWidth=parseFloat(r[0]);u.graphicHeight=parseFloat(r[1])}else{if(b[l]=="iconOffset"&&u){var g=q[l].split(",");u.graphicXOffset=parseFloat(g[0]);u.graphicYOffset=parseFloat(g[1])}else{if(b[l]=="description"){k.description=q[l]}else{if(b[l]=="overflow"){k.overflow=q[l]}else{k[b[l]]=q[l]}}}}}}}}}}}if(p){if(this.internalProjection&&this.externalProjection){d.transform(this.externalProjection,this.internalProjection)}var f=new OpenLayers.Feature.Vector(d,k,u);h.push(f)}}}}return h},CLASS_NAME:"OpenLayers.Format.Text"});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.Handler.Point=OpenLayers.Class(OpenLayers.Handler,{point:null,layer:null,multi:false,drawing:false,mouseDown:false,lastDown:null,lastUp:null,persist:false,layerOptions:null,initialize:function(c,b,a){if(!(a&&a.layerOptions&&a.layerOptions.styleMap)){this.style=OpenLayers.Util.extend(OpenLayers.Feature.Vector.style["default"],{})}OpenLayers.Handler.prototype.initialize.apply(this,arguments)},activate:function(){if(!OpenLayers.Handler.prototype.activate.apply(this,arguments)){return false}var a=OpenLayers.Util.extend({displayInLayerSwitcher:false,calculateInRange:function(){return true}},this.layerOptions);this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,a);this.map.addLayer(this.layer);return true},createFeature:function(a){var b=this.map.getLonLatFromPixel(a);this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(b.lon,b.lat));this.callback("create",[this.point.geometry,this.point]);this.point.geometry.clearBounds();this.layer.addFeatures([this.point],{silent:true})},deactivate:function(){if(!OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){return false}if(this.drawing){this.cancel()}this.destroyFeature();if(this.layer.map!=null){this.layer.destroy(false)}this.layer=null;return true},destroyFeature:function(){if(this.layer){this.layer.destroyFeatures()}this.point=null},finalize:function(b){var a=b?"cancel":"done";this.drawing=false;this.mouseDown=false;this.lastDown=null;this.lastUp=null;this.callback(a,[this.geometryClone()]);if(b||!this.persist){this.destroyFeature()}},cancel:function(){this.finalize(true)},click:function(a){OpenLayers.Event.stop(a);return false},dblclick:function(a){OpenLayers.Event.stop(a);return false},modifyFeature:function(a){var b=this.map.getLonLatFromPixel(a);this.point.geometry.x=b.lon;this.point.geometry.y=b.lat;this.callback("modify",[this.point.geometry,this.point]);this.point.geometry.clearBounds();this.drawFeature()},drawFeature:function(){this.layer.drawFeature(this.point,this.style)},getGeometry:function(){var a=this.point&&this.point.geometry;if(a&&this.multi){a=new OpenLayers.Geometry.MultiPoint([a])}return a},geometryClone:function(){var a=this.getGeometry();return a&&a.clone()},mousedown:function(a){if(!this.checkModifiers(a)){return true}if(this.lastDown&&this.lastDown.equals(a.xy)){return true}this.drawing=true;if(this.lastDown==null){if(this.persist){this.destroyFeature()}this.createFeature(a.xy)}else{this.modifyFeature(a.xy)}this.lastDown=a.xy;return false},mousemove:function(a){if(this.drawing){this.modifyFeature(a.xy)}return true},mouseup:function(a){if(this.drawing){this.finalize();return false}else{return true}},CLASS_NAME:"OpenLayers.Handler.Point"});OpenLayers.Layer.PointTrack=OpenLayers.Class(OpenLayers.Layer.Vector,{dataFrom:null,initialize:function(b,a){OpenLayers.Layer.Vector.prototype.initialize.apply(this,arguments)},addNodes:function(g){if(g.length<2){OpenLayers.Console.error("At least two point features have to be added to createa line from");return}var o=new Array(g.length-1);var h,a,k;for(var c=0,f=g.length;c<f;c++){h=g[c];k=h.geometry;if(!k){var d=h.lonlat;k=new OpenLayers.Geometry.Point(d.lon,d.lat)}else{if(k.CLASS_NAME!="OpenLayers.Geometry.Point"){OpenLayers.Console.error("Only features with point geometries are supported.");return}}if(c>0){var b=(this.dataFrom!=null)?(g[c+this.dataFrom].data||g[c+this.dataFrom].attributes):null;var l=new OpenLayers.Geometry.LineString([a,k]);o[c-1]=new OpenLayers.Feature.Vector(l,b)}a=k}this.addFeatures(o)},CLASS_NAME:"OpenLayers.Layer.PointTrack"});OpenLayers.Layer.PointTrack.dataFrom={SOURCE_NODE:-1,TARGET_NODE:0};OpenLayers.Layer.Vector.RootContainer=OpenLayers.Class(OpenLayers.Layer.Vector,{displayInLayerSwitcher:false,layers:null,initialize:function(b,a){OpenLayers.Layer.Vector.prototype.initialize.apply(this,arguments)},display:function(){},getFeatureFromEvent:function(a){var d=this.layers;var c;for(var b=0;b<d.length;b++){c=d[b].getFeatureFromEvent(a);if(c){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(){var b;for(var a=0;a<this.map.layers.length;++a){b=this.map.layers[a];if(OpenLayers.Util.indexOf(this.layers,b)!=-1){b.renderer.moveRoot(this.renderer)}}},resetRoots:function(){var b;for(var a=0;a<this.layers.length;++a){b=this.layers[a];if(this.renderer&&b.renderer.getRenderLayerId()==this.id){this.renderer.moveRoot(b.renderer)}}},handleChangeLayer:function(a){var b=a.layer;if(a.property=="order"&&OpenLayers.Util.indexOf(this.layers,b)!=-1){this.resetRoots();this.collectRoots()}},CLASS_NAME:"OpenLayers.Layer.Vector.RootContainer"});OpenLayers.Layer.WFS=OpenLayers.Class(OpenLayers.Layer.Vector,OpenLayers.Layer.Markers,{isBaseLayer:false,tile:null,ratio:2,DEFAULT_PARAMS:{service:"WFS",version:"1.0.0",request:"GetFeature"},featureClass:null,format:null,formatObject:null,formatOptions:null,vectorMode:true,encodeBBOX:false,extractAttributes:false,initialize:function(d,c,f,b){if(b==undefined){b={}}if(b.featureClass||!OpenLayers.Layer.Vector||!OpenLayers.Feature.Vector){this.vectorMode=false}OpenLayers.Util.extend(b,{reportError:false});var a=[];a.push(d,b);OpenLayers.Layer.Vector.prototype.initialize.apply(this,a);if(!this.renderer||!this.vectorMode){this.vectorMode=false;if(!b.featureClass){b.featureClass=OpenLayers.Feature.WFS}OpenLayers.Layer.Markers.prototype.initialize.apply(this,a)}if(this.params&&this.params.typename&&!this.options.typename){this.options.typename=this.params.typename}if(!this.options.geometry_column){this.options.geometry_column="the_geom"}this.params=OpenLayers.Util.applyDefaults(f,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS));this.url=c},destroy:function(){if(this.vectorMode){OpenLayers.Layer.Vector.prototype.destroy.apply(this,arguments)}else{OpenLayers.Layer.Markers.prototype.destroy.apply(this,arguments)}if(this.tile){this.tile.destroy()}this.tile=null;this.ratio=null;this.featureClass=null;this.format=null;if(this.formatObject&&this.formatObject.destroy){this.formatObject.destroy()}this.formatObject=null;this.formatOptions=null;this.vectorMode=null;this.encodeBBOX=null;this.extractAttributes=null},setMap:function(b){if(this.vectorMode){OpenLayers.Layer.Vector.prototype.setMap.apply(this,arguments);var a={extractAttributes:this.extractAttributes};OpenLayers.Util.extend(a,this.formatOptions);if(this.map&&!this.projection.equals(this.map.getProjectionObject())){a.externalProjection=this.projection;a.internalProjection=this.map.getProjectionObject()}this.formatObject=this.format?new this.format(a):new OpenLayers.Format.GML(a)}else{OpenLayers.Layer.Markers.prototype.setMap.apply(this,arguments)}},moveTo:function(a,b,s){if(this.vectorMode){OpenLayers.Layer.Vector.prototype.moveTo.apply(this,arguments)}else{OpenLayers.Layer.Markers.prototype.moveTo.apply(this,arguments)}if(s){return false}if(b){if(this.vectorMode){this.renderer.clear()}}if(this.options.minZoomLevel){OpenLayers.Console.warn(OpenLayers.i18n("minZoomLevelError"));if(this.map.getZoom()<this.options.minZoomLevel){return null}}if(a==null){a=this.map.getExtent()}var r=(this.tile==null);var h=(!r&&!this.tile.bounds.containsBounds(a));if(b||r||(!s&&h)){var c=a.getCenterLonLat();var q=a.getWidth()*this.ratio;var k=a.getHeight()*this.ratio;var o=new OpenLayers.Bounds(c.lon-(q/2),c.lat-(k/2),c.lon+(q/2),c.lat+(k/2));var t=this.map.getSize();t.w=t.w*this.ratio;t.h=t.h*this.ratio;var l=new OpenLayers.LonLat(o.left,o.top);var p=this.map.getLayerPxFromLonLat(l);var d=this.getFullRequestString();var g=null;var f=this.params.filter||this.params.FILTER;if(f){g={FILTER:f}}else{g={BBOX:this.encodeBBOX?o.toBBOX():o.toArray()}}if(this.map&&!this.projection.equals(this.map.getProjectionObject())){var u=o.clone();u.transform(this.map.getProjectionObject(),this.projection);if(!f){g.BBOX=this.encodeBBOX?u.toBBOX():u.toArray()}}d+="&"+OpenLayers.Util.getParameterString(g);if(!this.tile){this.tile=new OpenLayers.Tile.WFS(this,p,o,d,t);this.addTileMonitoringHooks(this.tile);this.tile.draw()}else{if(this.vectorMode){this.destroyFeatures();this.renderer.clear()}else{this.clearMarkers()}this.removeTileMonitoringHooks(this.tile);this.tile.destroy();this.tile=null;this.tile=new OpenLayers.Tile.WFS(this,p,o,d,t);this.addTileMonitoringHooks(this.tile);this.tile.draw()}}},addTileMonitoringHooks:function(a){a.onLoadStart=function(){if(this==this.layer.tile){this.layer.events.triggerEvent("loadstart")}};a.events.register("loadstart",a,a.onLoadStart);a.onLoadEnd=function(){if(this==this.layer.tile){this.layer.events.triggerEvent("tileloaded");this.layer.events.triggerEvent("loadend")}};a.events.register("loadend",a,a.onLoadEnd);a.events.register("unload",a,a.onLoadEnd)},removeTileMonitoringHooks:function(a){a.unload();a.events.un({loadstart:a.onLoadStart,loadend:a.onLoadEnd,unload:a.onLoadEnd,scope:a})},onMapResize:function(){if(this.vectorMode){OpenLayers.Layer.Vector.prototype.onMapResize.apply(this,arguments)}else{OpenLayers.Layer.Markers.prototype.onMapResize.apply(this,arguments)}},display:function(){if(this.vectorMode){OpenLayers.Layer.Vector.prototype.display.apply(this,arguments)}else{OpenLayers.Layer.Markers.prototype.display.apply(this,arguments)}},mergeNewParams:function(c){var b=OpenLayers.Util.upperCaseObject(c);var a=[b];return OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this,a)},clone:function(a){if(a==null){a=new OpenLayers.Layer.WFS(this.name,this.url,this.params,this.options)}if(this.vectorMode){a=OpenLayers.Layer.Vector.prototype.clone.apply(this,[a])}else{a=OpenLayers.Layer.Markers.prototype.clone.apply(this,[a])}return a},getFullRequestString:function(c,b){var a=this.projection.getCode()||this.map.getProjection();this.params.SRS=(a=="none")?null:a;return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments)},commit:function(){if(!this.writer){var a={};if(this.map&&!this.projection.equals(this.map.getProjectionObject())){a.externalProjection=this.projection;a.internalProjection=this.map.getProjectionObject()}this.writer=new OpenLayers.Format.WFS(a,this)}var b=this.writer.write(this.features);OpenLayers.Request.POST({url:this.url,data:b,success:this.commitSuccess,failure:this.commitFailure,scope:this})},commitSuccess:function(c){var a=c.responseText;if(a.indexOf("SUCCESS")!=-1){this.commitReport(OpenLayers.i18n("commitSuccess",{response:a}));for(var b=0;b<this.features.length;b++){this.features[b].state=null}}else{if(a.indexOf("FAILED")!=-1||a.indexOf("Exception")!=-1){this.commitReport(OpenLayers.i18n("commitFailed",{response:a}))}}},commitFailure:function(a){},commitReport:function(b,a){OpenLayers.Console.userError(b)},refresh:function(){if(this.tile){if(this.vectorMode){this.renderer.clear();this.features.length=0}else{this.clearMarkers();this.markers.length=0}this.tile.draw()}},getDataExtent:function(){var a;if(this.vectorMode){a=OpenLayers.Layer.Vector.prototype.getDataExtent.apply(this)}else{a=OpenLayers.Layer.Markers.prototype.getDataExtent.apply(this)}return a},setOpacity:function(a){if(this.vectorMode){OpenLayers.Layer.Vector.prototype.setOpacity.apply(this,[a])}else{OpenLayers.Layer.Markers.prototype.setOpacity.apply(this,[a])}},CLASS_NAME:"OpenLayers.Layer.WFS"});OpenLayers.Strategy.BBOX=OpenLayers.Class(OpenLayers.Strategy,{bounds:null,resolution:null,ratio:2,resFactor:null,response:null,initialize:function(a){OpenLayers.Strategy.prototype.initialize.apply(this,[a])},activate:function(){var a=OpenLayers.Strategy.prototype.activate.call(this);if(a){this.layer.events.on({moveend:this.update,scope:this});this.layer.events.on({refresh:this.update,scope:this})}return a},deactivate:function(){var a=OpenLayers.Strategy.prototype.deactivate.call(this);if(a){this.layer.events.un({moveend:this.update,scope:this});this.layer.events.un({refresh:this.update,scope:this})}return a},update:function(b){var a=this.getMapBounds();if((b&&b.force)||this.invalidBounds(a)){this.calculateBounds(a);this.resolution=this.layer.map.getResolution();this.triggerRead()}},getMapBounds:function(){var a=this.layer.map.getExtent();if(!this.layer.projection.equals(this.layer.map.getProjectionObject())){a=a.clone().transform(this.layer.map.getProjectionObject(),this.layer.projection)}return a},invalidBounds:function(a){if(!a){a=this.getMapBounds()}var c=!this.bounds||!this.bounds.containsBounds(a);if(!c&&this.resFactor){var b=this.resolution/this.layer.map.getResolution();c=(b>=this.resFactor||b<=(1/this.resFactor))}return c},calculateBounds:function(b){if(!b){b=this.getMapBounds()}var a=b.getCenterLonLat();var d=b.getWidth()*this.ratio;var c=b.getHeight()*this.ratio;this.bounds=new OpenLayers.Bounds(a.lon-(d/2),a.lat-(c/2),a.lon+(d/2),a.lat+(c/2))},triggerRead:function(){this.layer.protocol.abort(this.response);this.layer.events.triggerEvent("loadstart");this.response=this.layer.protocol.read({filter:this.createFilter(),callback:this.merge,scope:this})},createFilter:function(){var a=new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.BBOX,value:this.bounds,projection:this.layer.projection});if(this.layer.filter){a=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.AND,filters:[this.layer.filter,a]})}return a},merge:function(h){this.layer.destroyFeatures();var f=h.features;if(f&&f.length>0){var g=this.layer.projection;var d=this.layer.map.getProjectionObject();if(!d.equals(g)){var c;for(var b=0,a=f.length;b<a;++b){c=f[b].geometry;if(c){c.transform(g,d)}}}this.layer.addFeatures(f)}this.layer.events.triggerEvent("loadend")},CLASS_NAME:"OpenLayers.Strategy.BBOX"});OpenLayers.Control.SelectFeature=OpenLayers.Class(OpenLayers.Control,{EVENT_TYPES:["beforefeaturehighlighted","featurehighlighted","featureunhighlighted"],multipleKey:null,toggleKey:null,multiple:false,clickout:true,toggle:false,hover:false,highlightOnly:false,box:false,onBeforeSelect:function(){},onSelect:function(){},onUnselect:function(){},scope:null,geometryTypes:null,layer:null,layers:null,callbacks:null,selectStyle:null,renderIntent:"select",handlers:null,initialize:function(c,a){this.EVENT_TYPES=OpenLayers.Control.SelectFeature.prototype.EVENT_TYPES.concat(OpenLayers.Control.prototype.EVENT_TYPES);OpenLayers.Control.prototype.initialize.apply(this,[a]);if(this.scope===null){this.scope=this}if(c instanceof Array){this.layers=c;this.layer=new OpenLayers.Layer.Vector.RootContainer(this.id+"_container",{layers:c})}else{this.layer=c}var b={click:this.clickFeature,clickout:this.clickoutFeature};if(this.hover){b.over=this.overFeature;b.out=this.outFeature}this.callbacks=OpenLayers.Util.extend(b,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"})}},destroy:function(){OpenLayers.Control.prototype.destroy.apply(this,arguments);if(this.layers){this.layer.destroy()}},activate:function(){if(!this.active){if(this.layers){this.map.addLayer(this.layer)}this.handlers.feature.activate();if(this.box&&this.handlers.box){this.handlers.box.activate()}}return OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){if(this.active){this.handlers.feature.deactivate();if(this.handlers.box){this.handlers.box.deactivate()}if(this.layers){this.map.removeLayer(this.layer)}}return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},unselectAll:function(b){var g=this.layers||[this.layer];var f,d;for(var a=0;a<g.length;++a){f=g[a];for(var c=f.selectedFeatures.length-1;c>=0;--c){d=f.selectedFeatures[c];if(!b||b.except!=d){this.unselect(d)}}}},clickFeature:function(a){if(!this.hover){var b=(OpenLayers.Util.indexOf(a.layer.selectedFeatures,a)>-1);if(b){if(this.toggleSelect()){this.unselect(a)}else{if(!this.multipleSelect()){this.unselectAll({except:a})}}}else{if(!this.multipleSelect()){this.unselectAll({except:a})}this.select(a)}}},multipleSelect:function(){return this.multiple||(this.handlers.feature.evt&&this.handlers.feature.evt[this.multipleKey])},toggleSelect:function(){return this.toggle||(this.handlers.feature.evt&&this.handlers.feature.evt[this.toggleKey])},clickoutFeature:function(a){if(!this.hover&&this.clickout){this.unselectAll()}},overFeature:function(b){var a=b.layer;if(this.hover){if(this.highlightOnly){this.highlight(b)}else{if(OpenLayers.Util.indexOf(a.selectedFeatures,b)==-1){this.select(b)}}}},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);if(b){b.highlight(a)}}else{this.unhighlight(a)}}}else{this.unselect(a)}}},highlight:function(c){var b=c.layer;var a=this.events.triggerEvent("beforefeaturehighlighted",{feature:c});if(a!==false){c._prevHighlighter=c._lastHighlighter;c._lastHighlighter=this.id;var d=this.selectStyle||this.renderIntent;b.drawFeature(c,d);this.events.triggerEvent("featurehighlighted",{feature:c})}},unhighlight:function(b){var a=b.layer;b._lastHighlighter=b._prevHighlighter;delete b._prevHighlighter;a.drawFeature(b,b.style||b.layer.style||"default");this.events.triggerEvent("featureunhighlighted",{feature:b})},select:function(c){var a=this.onBeforeSelect.call(this.scope,c);var b=c.layer;if(a!==false){a=b.events.triggerEvent("beforefeatureselected",{feature:c});if(a!==false){b.selectedFeatures.push(c);this.highlight(c);b.events.triggerEvent("featureselected",{feature:c});this.onSelect.call(this.scope,c)}}},unselect:function(b){var a=b.layer;this.unhighlight(b);OpenLayers.Util.removeItem(a.selectedFeatures,b);a.events.triggerEvent("featureunselected",{feature:b});this.onUnselect.call(this.scope,b)},selectBox:function(f){if(f instanceof OpenLayers.Bounds){var k=this.map.getLonLatFromPixel(new OpenLayers.Pixel(f.left,f.bottom));var p=this.map.getLonLatFromPixel(new OpenLayers.Pixel(f.right,f.top));var a=new OpenLayers.Bounds(k.lon,k.lat,p.lon,p.lat);if(!this.multipleSelect()){this.unselectAll()}var o=this.multiple;this.multiple=true;var d=this.layers||[this.layer];var g;for(var b=0;b<d.length;++b){g=d[b];for(var c=0,h=g.features.length;c<h;++c){var q=g.features[c];if(this.geometryTypes==null||OpenLayers.Util.indexOf(this.geometryTypes,q.geometry.CLASS_NAME)>-1){if(a.toGeometry().intersects(q.geometry)){if(OpenLayers.Util.indexOf(g.selectedFeatures,q)==-1){this.select(q)}}}}}this.multiple=o}},setMap:function(a){this.handlers.feature.setMap(a);if(this.box){this.handlers.box.setMap(a)}OpenLayers.Control.prototype.setMap.apply(this,arguments)},CLASS_NAME:"OpenLayers.Control.SelectFeature"});OpenLayers.Format.Filter.v1=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{ogc:"http://www.opengis.net/ogc",gml:"http://www.opengis.net/gml",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance"},defaultPrefix:"ogc",schemaLocation:null,initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},read:function(a){var b={};this.readers.ogc.Filter.apply(this,[a,b]);return b.filter},readers:{ogc:{Filter:function(b,a){var c={fids:[],filters:[]};this.readChildNodes(b,c);if(c.fids.length>0){a.filter=new OpenLayers.Filter.FeatureId({fids:c.fids})}else{if(c.filters.length>0){a.filter=c.filters[0]}}},FeatureId:function(a,b){var c=a.getAttribute("fid");if(c){b.fids.push(c)}},And:function(b,c){var a=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.AND});this.readChildNodes(b,a);c.filters.push(a)},Or:function(b,c){var a=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.OR});this.readChildNodes(b,a);c.filters.push(a)},Not:function(b,c){var a=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.NOT});this.readChildNodes(b,a);c.filters.push(a)},PropertyIsLessThan:function(b,c){var a=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.LESS_THAN});this.readChildNodes(b,a);c.filters.push(a)},PropertyIsGreaterThan:function(b,c){var a=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.GREATER_THAN});this.readChildNodes(b,a);c.filters.push(a)},PropertyIsLessThanOrEqualTo:function(b,c){var a=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO});this.readChildNodes(b,a);c.filters.push(a)},PropertyIsGreaterThanOrEqualTo:function(b,c){var a=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO});this.readChildNodes(b,a);c.filters.push(a)},PropertyIsBetween:function(b,c){var a=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.BETWEEN});this.readChildNodes(b,a);c.filters.push(a)},PropertyIsLike:function(d,f){var c=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.LIKE});this.readChildNodes(d,c);var g=d.getAttribute("wildCard");var b=d.getAttribute("singleChar");var a=d.getAttribute("escape");c.value2regex(g,b,a);f.filters.push(c)},Literal:function(a,b){b.value=OpenLayers.String.numericIf(this.getChildValue(a))},PropertyName:function(b,a){a.property=this.getChildValue(b)},LowerBoundary:function(b,a){a.lowerBoundary=OpenLayers.String.numericIf(this.readOgcExpression(b))},UpperBoundary:function(b,a){a.upperBoundary=OpenLayers.String.numericIf(this.readOgcExpression(b))},Intersects:function(a,b){this.readSpatial(a,b,OpenLayers.Filter.Spatial.INTERSECTS)},Within:function(a,b){this.readSpatial(a,b,OpenLayers.Filter.Spatial.WITHIN)},Contains:function(a,b){this.readSpatial(a,b,OpenLayers.Filter.Spatial.CONTAINS)},DWithin:function(a,b){this.readSpatial(a,b,OpenLayers.Filter.Spatial.DWITHIN)},Distance:function(a,b){b.distance=parseInt(this.getChildValue(a));b.distanceUnits=a.getAttribute("units")}}},readSpatial:function(c,d,b){var a=new OpenLayers.Filter.Spatial({type:b});this.readChildNodes(c,a);a.value=a.components[0];delete a.components;d.filters.push(a)},readOgcExpression:function(a){var c={};this.readChildNodes(a,c);var b=c.value;if(!b){b=this.getChildValue(a)}return b},write:function(a){return this.writers.ogc.Filter.apply(this,[a])},writers:{ogc:{Filter:function(c){var d=this.createElementNSPlus("ogc:Filter");var b=c.CLASS_NAME.split(".").pop();if(b=="FeatureId"){for(var a=0;a<c.fids.length;++a){this.writeNode("FeatureId",c.fids[a],d)}}else{this.writeNode(this.getFilterType(c),c,d)}return d},FeatureId:function(a){return this.createElementNSPlus("ogc:FeatureId",{attributes:{fid:a}})},And:function(c){var d=this.createElementNSPlus("ogc:And");var b;for(var a=0;a<c.filters.length;++a){b=c.filters[a];this.writeNode(this.getFilterType(b),b,d)}return d},Or:function(c){var d=this.createElementNSPlus("ogc:Or");var b;for(var a=0;a<c.filters.length;++a){b=c.filters[a];this.writeNode(this.getFilterType(b),b,d)}return d},Not:function(b){var c=this.createElementNSPlus("ogc:Not");var a=b.filters[0];this.writeNode(this.getFilterType(a),a,c);return c},PropertyIsLessThan:function(a){var b=this.createElementNSPlus("ogc:PropertyIsLessThan");this.writeNode("PropertyName",a,b);this.writeNode("Literal",a.value,b);return b},PropertyIsGreaterThan:function(a){var b=this.createElementNSPlus("ogc:PropertyIsGreaterThan");this.writeNode("PropertyName",a,b);this.writeNode("Literal",a.value,b);return b},PropertyIsLessThanOrEqualTo:function(a){var b=this.createElementNSPlus("ogc:PropertyIsLessThanOrEqualTo");this.writeNode("PropertyName",a,b);this.writeNode("Literal",a.value,b);return b},PropertyIsGreaterThanOrEqualTo:function(a){var b=this.createElementNSPlus("ogc:PropertyIsGreaterThanOrEqualTo");this.writeNode("PropertyName",a,b);this.writeNode("Literal",a.value,b);return b},PropertyIsBetween:function(a){var b=this.createElementNSPlus("ogc:PropertyIsBetween");this.writeNode("PropertyName",a,b);this.writeNode("LowerBoundary",a,b);this.writeNode("UpperBoundary",a,b);return b},PropertyIsLike:function(a){var b=this.createElementNSPlus("ogc:PropertyIsLike",{attributes:{wildCard:"*",singleChar:".",escape:"!"}});this.writeNode("PropertyName",a,b);this.writeNode("Literal",a.regex2value(),b);return b},PropertyName:function(a){return this.createElementNSPlus("ogc:PropertyName",{value:a.property})},Literal:function(a){return this.createElementNSPlus("ogc:Literal",{value:a})},LowerBoundary:function(a){var b=this.createElementNSPlus("ogc:LowerBoundary");this.writeNode("Literal",a.lowerBoundary,b);return b},UpperBoundary:function(a){var b=this.createElementNSPlus("ogc:UpperBoundary");this.writeNode("Literal",a.upperBoundary,b);return b},INTERSECTS:function(a){return this.writeSpatial(a,"Intersects")},WITHIN:function(a){return this.writeSpatial(a,"Within")},CONTAINS:function(a){return this.writeSpatial(a,"Contains")},DWITHIN:function(a){var b=this.writeSpatial(a,"DWithin");this.writeNode("Distance",a,b);return b},Distance:function(a){return this.createElementNSPlus("ogc:Distance",{attributes:{units:a.distanceUnits},value:a.distance})}}},getFilterType:function(a){var b=this.filterMap[a.type];if(!b){throw"Filter writing not supported for rule type: "+a.type}return b},filterMap:{"&&":"And","||":"Or","!":"Not","==":"PropertyIsEqualTo","!=":"PropertyIsNotEqualTo","<":"PropertyIsLessThan",">":"PropertyIsGreaterThan","<=":"PropertyIsLessThanOrEqualTo",">=":"PropertyIsGreaterThanOrEqualTo","..":"PropertyIsBetween","~":"PropertyIsLike",BBOX:"BBOX",DWITHIN:"DWITHIN",WITHIN:"WITHIN",CONTAINS:"CONTAINS",INTERSECTS:"INTERSECTS"},CLASS_NAME:"OpenLayers.Format.Filter.v1"});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 c=0;if(this.components&&(this.components.length>1)){for(var b=1,a=this.components.length;b<a;b++){c+=this.components[b-1].distanceTo(this.components[b])}}return c},getGeodesicLength:function(b){var f=this;if(b){var c=new OpenLayers.Projection("EPSG:4326");if(!c.equals(b)){f=this.clone().transform(b,c)}}var g=0;if(f.components&&(f.components.length>1)){var k,h;for(var d=1,a=f.components.length;d<a;d++){k=f.components[d-1];h=f.components[d];g+=OpenLayers.Util.distVincenty({lon:k.x,lat:k.y},{lon:h.x,lat:h.y})}}return g*1000},CLASS_NAME:"OpenLayers.Geometry.Curve"});OpenLayers.Control.ModifyFeature=OpenLayers.Class(OpenLayers.Control,{geometryTypes:null,clickout:true,toggle:true,layer:null,feature:null,vertices:null,virtualVertices:null,selectControl:null,dragControl:null,handlers:null,deleteCodes:null,virtualStyle:null,mode:null,modified:false,radiusHandle:null,dragHandle:null,onModificationStart:function(){},onModification:function(){},onModificationEnd:function(){},initialize:function(d,c){this.layer=d;this.vertices=[];this.virtualVertices=[];this.virtualStyle=OpenLayers.Util.extend({},this.layer.style||this.layer.styleMap.createSymbolizer());this.virtualStyle.fillOpacity=0.3;this.virtualStyle.strokeOpacity=0.3;this.deleteCodes=[46,68];this.mode=OpenLayers.Control.ModifyFeature.RESHAPE;OpenLayers.Control.prototype.initialize.apply(this,[c]);if(!(this.deleteCodes instanceof Array)){this.deleteCodes=[this.deleteCodes]}var g=this;var a={geometryTypes:this.geometryTypes,clickout:this.clickout,toggle:this.toggle,onBeforeSelect:this.beforeSelectFeature,onSelect:this.selectFeature,onUnselect:this.unselectFeature,scope:this};this.selectControl=new OpenLayers.Control.SelectFeature(d,a);var b={geometryTypes:["OpenLayers.Geometry.Point"],snappingOptions:this.snappingOptions,onStart:function(k,h){g.dragStart.apply(g,[k,h])},onDrag:function(k,h){g.dragVertex.apply(g,[k,h])},onComplete:function(h){g.dragComplete.apply(g,[h])}};this.dragControl=new OpenLayers.Control.DragFeature(d,b);var f={keydown:this.handleKeypress};this.handlers={keyboard:new OpenLayers.Handler.Keyboard(this,f)}},destroy:function(){this.layer=null;this.selectControl.destroy();this.dragControl.destroy();OpenLayers.Control.prototype.destroy.apply(this,[])},activate:function(){return(this.selectControl.activate()&&this.handlers.keyboard.activate()&&OpenLayers.Control.prototype.activate.apply(this,arguments))},deactivate:function(){var a=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();if(this.feature&&this.feature.geometry&&this.feature.layer){this.selectControl.unselect.apply(this.selectControl,[this.feature])}this.selectControl.deactivate();this.handlers.keyboard.deactivate();a=true}return a},beforeSelectFeature:function(a){return this.layer.events.triggerEvent("beforefeaturemodified",{feature:a})},selectFeature:function(a){this.feature=a;this.modified=false;this.resetVertices();this.dragControl.activate();this.onModificationStart(this.feature)},unselectFeature:function(a){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(a);this.layer.events.triggerEvent("afterfeaturemodified",{feature:a,modified:this.modified});this.modified=false},dragStart:function(b,a){if(b!=this.feature&&!b.geometry.parent&&b!=this.dragHandle&&b!=this.radiusHandle){if(this.feature){this.selectControl.clickFeature.apply(this.selectControl,[this.feature])}if(this.geometryTypes==null||OpenLayers.Util.indexOf(this.geometryTypes,b.geometry.CLASS_NAME)!=-1){this.selectControl.clickFeature.apply(this.selectControl,[b]);this.dragControl.overFeature.apply(this.dragControl,[b]);this.dragControl.lastPixel=a;this.dragControl.handlers.drag.started=true;this.dragControl.handlers.drag.start=a;this.dragControl.handlers.drag.last=a}}},dragVertex:function(b,a){this.modified=true;if(this.feature.geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){if(this.feature!=b){this.feature=b}this.layer.events.triggerEvent("vertexmodified",{vertex:b.geometry,feature:this.feature,pixel:a})}else{if(b._index){b.geometry.parent.addComponent(b.geometry,b._index);delete b._index;OpenLayers.Util.removeItem(this.virtualVertices,b);this.vertices.push(b)}else{if(b==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(b!==this.radiusHandle){this.layer.events.triggerEvent("vertexmodified",{vertex:b.geometry,feature:this.feature,pixel:a})}}}if(this.virtualVertices.length>0){this.layer.destroyFeatures(this.virtualVertices,{silent:true});this.virtualVertices=[]}this.layer.drawFeature(this.feature,this.selectControl.renderIntent)}this.layer.drawFeature(b)},dragComplete:function(a){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&OpenLayers.Control.ModifyFeature.DRAG)){this.collectDragHandle()}if((this.mode&(OpenLayers.Control.ModifyFeature.ROTATE|OpenLayers.Control.ModifyFeature.RESIZE))){this.collectRadiusHandle()}if(this.mode&OpenLayers.Control.ModifyFeature.RESHAPE){if(!(this.mode&OpenLayers.Control.ModifyFeature.RESIZE)){this.collectVertices()}}}},handleKeypress:function(a){var b=a.keyCode;if(this.feature&&OpenLayers.Util.indexOf(this.deleteCodes,b)!=-1){var c=this.dragControl.feature;if(c&&OpenLayers.Util.indexOf(this.vertices,c)!=-1&&!this.dragControl.handlers.drag.dragging&&c.geometry.parent){c.geometry.parent.removeComponent(c.geometry);this.layer.drawFeature(this.feature,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 a=this;function b(k){var d,f,l,g;if(k.CLASS_NAME=="OpenLayers.Geometry.Point"){f=new OpenLayers.Feature.Vector(k);f._sketch=true;a.vertices.push(f)}else{var c=k.components.length;if(k.CLASS_NAME=="OpenLayers.Geometry.LinearRing"){c-=1}for(d=0;d<c;++d){l=k.components[d];if(l.CLASS_NAME=="OpenLayers.Geometry.Point"){f=new OpenLayers.Feature.Vector(l);f._sketch=true;a.vertices.push(f)}else{b(l)}}if(k.CLASS_NAME!="OpenLayers.Geometry.MultiPoint"){for(d=0,g=k.components.length;d<g-1;++d){var q=k.components[d];var r=k.components[d+1];if(q.CLASS_NAME=="OpenLayers.Geometry.Point"&&r.CLASS_NAME=="OpenLayers.Geometry.Point"){var o=(q.x+r.x)/2;var h=(q.y+r.y)/2;var p=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(o,h),null,a.virtualStyle);p.geometry.parent=k;p._index=d+1;p._sketch=true;a.virtualVertices.push(p)}}}}}b.call(this,this.feature.geometry);this.layer.addFeatures(this.virtualVertices,{silent:true});this.layer.addFeatures(this.vertices,{silent:true})},collectDragHandle:function(){var d=this.feature.geometry;var a=d.getBounds().getCenterLonLat();var c=new OpenLayers.Geometry.Point(a.lon,a.lat);var b=new OpenLayers.Feature.Vector(c);c.move=function(f,g){OpenLayers.Geometry.Point.prototype.move.call(this,f,g);d.move(f,g)};b._sketch=true;this.dragHandle=b;this.layer.addFeatures([this.dragHandle],{silent:true})},collectRadiusHandle:function(){var k=this.feature.geometry;var a=k.getBounds();var b=a.getCenterLonLat();var l=new OpenLayers.Geometry.Point(b.lon,b.lat);var h=new OpenLayers.Geometry.Point(a.right,a.bottom);var g=new OpenLayers.Feature.Vector(h);var c=(this.mode&OpenLayers.Control.ModifyFeature.RESIZE);var f=(this.mode&OpenLayers.Control.ModifyFeature.RESHAPE);var d=(this.mode&OpenLayers.Control.ModifyFeature.ROTATE);h.move=function(A,z){OpenLayers.Geometry.Point.prototype.move.call(this,A,z);var B=this.x-l.x;var u=this.y-l.y;var C=B-A;var v=u-z;if(d){var p=Math.atan2(v,C);var o=Math.atan2(u,B);var s=o-p;s*=180/Math.PI;k.rotate(s,l)}if(c){var r,w;if(f){r=u/v;w=(B/C)/r}else{var t=Math.sqrt((C*C)+(v*v));var q=Math.sqrt((B*B)+(u*u));r=q/t}k.resize(r,l,w)}};g._sketch=true;this.radiusHandle=g;this.layer.addFeatures([this.radiusHandle],{silent:true})},setMap:function(a){this.selectControl.setMap(a);this.dragControl.setMap(a);OpenLayers.Control.prototype.setMap.apply(this,arguments)},CLASS_NAME:"OpenLayers.Control.ModifyFeature"});OpenLayers.Control.ModifyFeature.RESHAPE=1;OpenLayers.Control.ModifyFeature.RESIZE=2;OpenLayers.Control.ModifyFeature.ROTATE=4;OpenLayers.Control.ModifyFeature.DRAG=8;OpenLayers.Geometry.LineString=OpenLayers.Class(OpenLayers.Geometry.Curve,{initialize:function(a){OpenLayers.Geometry.Curve.prototype.initialize.apply(this,arguments)},removeComponent:function(a){if(this.components&&(this.components.length>2)){OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments)}},intersects:function(p){var c=false;var o=p.CLASS_NAME;if(o=="OpenLayers.Geometry.LineString"||o=="OpenLayers.Geometry.LinearRing"||o=="OpenLayers.Geometry.Point"){var s=this.getSortedSegments();var q;if(o=="OpenLayers.Geometry.Point"){q=[{x1:p.x,y1:p.y,x2:p.x,y2:p.y}]}else{q=p.getSortedSegments()}var v,h,f,a,u,t,d,b;outer:for(var k=0,l=s.length;k<l;++k){v=s[k];h=v.x1;f=v.x2;a=v.y1;u=v.y2;inner:for(var g=0,r=q.length;g<r;++g){t=q[g];if(t.x1>f){break}if(t.x2<h){continue}d=t.y1;b=t.y2;if(Math.min(d,b)>Math.max(a,u)){continue}if(Math.max(d,b)<Math.min(a,u)){continue}if(OpenLayers.Geometry.segmentsIntersect(v,t)){c=true;break outer}}}}else{c=p.intersects(this)}return c},getSortedSegments:function(){var a=this.components.length-1;var b=new Array(a);for(var c=0;c<a;++c){point1=this.components[c];point2=this.components[c+1];if(point1.x<point2.x){b[c]={x1:point1.x,y1:point1.y,x2:point2.x,y2:point2.y}}else{b[c]={x1:point2.x,y1:point2.y,x2:point1.x,y2:point1.y}}}function d(g,f){return g.x1-f.x1}return b.sort(d)},splitWithSegment:function(v,b){var c=!(b&&b.edge===false);var s=b&&b.tolerance;var a=[];var z=this.getVertices();var r=[];var B=[];var k=false;var f,d,p;var l,u,A;var g={point:true,tolerance:s};var h=null;for(var q=0,o=z.length-2;q<=o;++q){f=z[q];r.push(f.clone());d=z[q+1];A={x1:f.x,y1:f.y,x2:d.x,y2:d.y};p=OpenLayers.Geometry.segmentsIntersect(v,A,g);if(p instanceof OpenLayers.Geometry.Point){if((p.x===v.x1&&p.y===v.y1)||(p.x===v.x2&&p.y===v.y2)||p.equals(f)||p.equals(d)){u=true}else{u=false}if(u||c){if(!p.equals(B[B.length-1])){B.push(p.clone())}if(q===0){if(p.equals(f)){continue}}if(p.equals(d)){continue}k=true;if(!p.equals(f)){r.push(p)}a.push(new OpenLayers.Geometry.LineString(r));r=[p.clone()]}}}if(k){r.push(d.clone());a.push(new OpenLayers.Geometry.LineString(r))}if(B.length>0){var t=v.x1<v.x2?1:-1;var w=v.y1<v.y2?1:-1;h={lines:a,points:B.sort(function(D,C){return(t*D.x-t*C.x)||(w*D.y-w*C.y)})}}return h},split:function(C,b){var q=null;var d=b&&b.mutual;var o,f,p,c;if(C instanceof OpenLayers.Geometry.LineString){var B=this.getVertices();var h,g,A,l,a,s;var v=[];p=[];for(var w=0,r=B.length-2;w<=r;++w){h=B[w];g=B[w+1];A={x1:h.x,y1:h.y,x2:g.x,y2:g.y};c=c||[C];if(d){v.push(h.clone())}for(var u=0;u<c.length;++u){l=c[u].splitWithSegment(A,b);if(l){a=l.lines;if(a.length>0){a.unshift(u,1);Array.prototype.splice.apply(c,a);u+=a.length-2}if(d){for(var t=0,z=l.points.length;t<z;++t){s=l.points[t];if(!s.equals(h)){v.push(s);p.push(new OpenLayers.Geometry.LineString(v));if(s.equals(g)){v=[]}else{v=[s.clone()]}}}}}}}if(d&&p.length>0&&v.length>0){v.push(g.clone());p.push(new OpenLayers.Geometry.LineString(v))}}else{q=C.splitWith(this,b)}if(c&&c.length>1){f=true}else{c=[]}if(p&&p.length>1){o=true}else{p=[]}if(f||o){if(d){q=[p,c]}else{q=c}}return q},splitWith:function(b,a){return b.split(this,a)},getVertices:function(a){var b;if(a===true){b=[this.components[0],this.components[this.components.length-1]]}else{if(a===false){b=this.components.slice(1,this.components.length-1)}else{b=this.components.slice()}}return b},distanceTo:function(k,h){var l=!(h&&h.edge===false);var E=l&&h&&h.details;var t,f={};var w=Number.POSITIVE_INFINITY;if(k instanceof OpenLayers.Geometry.Point){var u=this.getSortedSegments();var s=k.x;var r=k.y;var C;for(var A=0,B=u.length;A<B;++A){C=u[A];t=OpenLayers.Geometry.distanceToSegment(k,C);if(t.distance<w){w=t.distance;f=t;if(w===0){break}}else{if(C.x2>s&&((r>C.y1&&r<C.y2)||(r<C.y1&&r>C.y2))){break}}}if(E){f={distance:f.distance,x0:f.x,y0:f.y,x1:s,y1:r}}else{f=f.distance}}else{if(k instanceof OpenLayers.Geometry.LineString){var d=this.getSortedSegments();var c=k.getSortedSegments();var b,a,q,D,g;var p=c.length;var o={point:true};outer:for(var A=0,B=d.length;A<B;++A){b=d[A];D=b.x1;g=b.y1;for(var z=0;z<p;++z){a=c[z];q=OpenLayers.Geometry.segmentsIntersect(b,a,o);if(q){w=0;f={distance:0,x0:q.x,y0:q.y,x1:q.x,y1:q.y};break outer}else{t=OpenLayers.Geometry.distanceToSegment({x:D,y:g},a);if(t.distance<w){w=t.distance;f={distance:w,x0:D,y0:g,x1:t.x,y1:t.y}}}}}if(!E){f=f.distance}if(w!==0){if(b){t=k.distanceTo(new OpenLayers.Geometry.Point(b.x2,b.y2),h);var v=E?t.distance:t;if(v<w){if(E){f={distance:w,x0:t.x1,y0:t.y1,x1:t.x0,y1:t.y0}}else{f=v}}}}}else{f=k.distanceTo(this,h);if(E){f={distance:f.distance,x0:f.x1,y0:f.y1,x1:f.x0,y1:f.y0}}}}return f},CLASS_NAME:"OpenLayers.Geometry.LineString"});OpenLayers.Geometry.LinearRing=OpenLayers.Class(OpenLayers.Geometry.LineString,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(a){OpenLayers.Geometry.LineString.prototype.initialize.apply(this,arguments)},addComponent:function(a,b){var c=false;var d=this.components.pop();if(b!=null||!a.equals(d)){c=OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,arguments)}var f=this.components[0];OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[f]);return c},removeComponent:function(a){if(this.components.length>4){this.components.pop();OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);var b=this.components[0];OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[b])}},move:function(b,d){for(var c=0,a=this.components.length;c<a-1;c++){this.components[c].move(b,d)}},rotate:function(d,b){for(var c=0,a=this.components.length;c<a-1;++c){this.components[c].rotate(d,b)}},resize:function(f,b,d){for(var c=0,a=this.components.length;c<a-1;++c){this.components[c].resize(f,b,d)}return this},transform:function(f,c){if(f&&c){for(var d=0,a=this.components.length;d<a-1;d++){var b=this.components[d];b.transform(f,c)}this.bounds=null}return this},getCentroid:function(){if(this.components&&(this.components.length>2)){var k=0;var h=0;for(var f=0;f<this.components.length-1;f++){var d=this.components[f];var o=this.components[f+1];k+=(d.x+o.x)*(d.x*o.y-o.x*d.y);h+=(d.y+o.y)*(d.x*o.y-o.x*d.y)}var g=-1*this.getArea();var a=k/(6*g);var l=h/(6*g)}return new OpenLayers.Geometry.Point(a,l)},getArea:function(){var h=0;if(this.components&&(this.components.length>2)){var g=0;for(var f=0,d=this.components.length;f<d-1;f++){var a=this.components[f];var k=this.components[f+1];g+=(a.x+k.x)*(k.y-a.y)}h=-g/2}return h},getGeodesicArea:function(b){var d=this;if(b){var c=new OpenLayers.Projection("EPSG:4326");if(!c.equals(b)){d=this.clone().transform(b,c)}}var g=0;var a=d.components&&d.components.length;if(a>2){var k,h;for(var f=0;f<a-1;f++){k=d.components[f];h=d.components[f+1];g+=OpenLayers.Util.rad(h.x-k.x)*(2+Math.sin(OpenLayers.Util.rad(k.y))+Math.sin(OpenLayers.Util.rad(h.y)))}g=g*6378137*6378137/2}return g},containsPoint:function(q){var w=OpenLayers.Number.limitSigDigs;var p=14;var o=w(q.x,p);var l=w(q.y,p);function v(D,A,C,z,B){return(((A-z)*D)+((z*C)-(A*B)))/(C-B)}var a=this.components.length-1;var h,g,u,d,s,b,f,c;var k=0;for(var r=0;r<a;++r){h=this.components[r];u=w(h.x,p);d=w(h.y,p);g=this.components[r+1];s=w(g.x,p);b=w(g.y,p);if(d==b){if(l==d){if(u<=s&&(o>=u&&o<=s)||u>=s&&(o<=u&&o>=s)){k=-1;break}}continue}f=w(v(l,u,d,s,b),p);if(f==o){if(d<b&&(l>=d&&l<=b)||d>b&&(l<=d&&l>=b)){k=-1;break}}if(f<=o){continue}if(u!=s&&(f<Math.min(u,s)||f>Math.max(u,s))){continue}if(d<b&&(l>=d&&l<b)||d>b&&(l<d&&l>=b)){++k}}var t=(k==-1)?1:!!(k&1);return t},intersects:function(d){var b=false;if(d.CLASS_NAME=="OpenLayers.Geometry.Point"){b=this.containsPoint(d)}else{if(d.CLASS_NAME=="OpenLayers.Geometry.LineString"){b=d.intersects(this)}else{if(d.CLASS_NAME=="OpenLayers.Geometry.LinearRing"){b=OpenLayers.Geometry.LineString.prototype.intersects.apply(this,[d])}else{for(var c=0,a=d.components.length;c<a;++c){b=d.components[c].intersects(this);if(b){break}}}}}return b},getVertices:function(a){return(a===true)?[]:this.components.slice(0,this.components.length-1)},CLASS_NAME:"OpenLayers.Geometry.LinearRing"});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(q,v){var h=null;var u=v&&v.mutual;var r,a,t,p,b;var f=[];var s=[q];for(var g=0,l=this.components.length;g<l;++g){a=this.components[g];p=false;for(var d=0;d<s.length;++d){r=a.split(s[d],v);if(r){if(u){t=r[0];for(var c=0,o=t.length;c<o;++c){if(c===0&&f.length){f[f.length-1].addComponent(t[c])}else{f.push(new OpenLayers.Geometry.MultiLineString([t[c]]))}}p=true;r=r[1]}if(r.length){r.unshift(d,1);Array.prototype.splice.apply(s,r);break}}}if(!p){if(f.length){f[f.length-1].addComponent(a.clone())}else{f=[new OpenLayers.Geometry.MultiLineString(a.clone())]}}}if(f&&f.length>1){p=true}else{f=[]}if(s&&s.length>1){b=true}else{s=[]}if(p||b){if(u){h=[f,s]}else{h=s}}return h},splitWith:function(q,v){var h=null;var u=v&&v.mutual;var r,c,t,p,a,f,s;if(q instanceof OpenLayers.Geometry.LineString){s=[];f=[q];for(var g=0,l=this.components.length;g<l;++g){a=false;c=this.components[g];for(var d=0;d<f.length;++d){r=f[d].split(c,v);if(r){if(u){t=r[0];if(t.length){t.unshift(d,1);Array.prototype.splice.apply(f,t);d+=t.length-2}r=r[1];if(r.length===0){r=[c.clone()]}}for(var b=0,o=r.length;b<o;++b){if(b===0&&s.length){s[s.length-1].addComponent(r[b])}else{s.push(new OpenLayers.Geometry.MultiLineString([r[b]]))}}a=true}}if(!a){if(s.length){s[s.length-1].addComponent(c.clone())}else{s=[new OpenLayers.Geometry.MultiLineString([c.clone()])]}}}}else{h=q.split(this)}if(f&&f.length>1){p=true}else{f=[]}if(s&&s.length>1){a=true}else{s=[]}if(p||a){if(u){h=[f,s]}else{h=s}}return h},CLASS_NAME:"OpenLayers.Geometry.MultiLineString"});OpenLayers.Handler.Path=OpenLayers.Class(OpenLayers.Handler.Point,{line:null,freehand:false,freehandToggle:"shiftKey",initialize:function(c,b,a){OpenLayers.Handler.Point.prototype.initialize.apply(this,arguments)},createFeature:function(a){var b=this.control.map.getLonLatFromPixel(a);this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(b.lon,b.lat));this.line=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString([this.point.geometry]));this.callback("create",[this.point.geometry,this.getSketch()]);this.point.geometry.clearBounds();this.layer.addFeatures([this.line,this.point],{silent:true})},destroyFeature:function(){OpenLayers.Handler.Point.prototype.destroyFeature.apply(this);this.line=null},removePoint:function(){if(this.point){this.layer.removeFeatures([this.point])}},addPoint:function(a){this.layer.removeFeatures([this.point]);var b=this.control.map.getLonLatFromPixel(a);this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(b.lon,b.lat));this.line.geometry.addComponent(this.point.geometry,this.line.geometry.components.length);this.callback("point",[this.point.geometry,this.getGeometry()]);this.callback("modify",[this.point.geometry,this.getSketch()]);this.drawFeature()},freehandMode:function(a){return(this.freehandToggle&&a[this.freehandToggle])?!this.freehand:this.freehand},modifyFeature:function(a){var b=this.control.map.getLonLatFromPixel(a);this.point.geometry.x=b.lon;this.point.geometry.y=b.lat;this.callback("modify",[this.point.geometry,this.getSketch()]);this.point.geometry.clearBounds();this.drawFeature()},drawFeature:function(){this.layer.drawFeature(this.line,this.style);this.layer.drawFeature(this.point,this.style)},getSketch:function(){return this.line},getGeometry:function(){var a=this.line&&this.line.geometry;if(a&&this.multi){a=new OpenLayers.Geometry.MultiLineString([a])}return a},mousedown:function(a){if(this.lastDown&&this.lastDown.equals(a.xy)){return false}if(this.lastDown==null){if(this.persist){this.destroyFeature()}this.createFeature(a.xy)}else{if((this.lastUp==null)||!this.lastUp.equals(a.xy)){this.addPoint(a.xy)}}this.mouseDown=true;this.lastDown=a.xy;this.drawing=true;return false},mousemove:function(a){if(this.drawing){if(this.mouseDown&&this.freehandMode(a)){this.addPoint(a.xy)}else{this.modifyFeature(a.xy)}}return true},mouseup:function(a){this.mouseDown=false;if(this.drawing){if(this.freehandMode(a)){this.removePoint();this.finalize()}else{if(this.lastUp==null){this.addPoint(a.xy)}this.lastUp=a.xy}return false}return true},dblclick:function(a){if(!this.freehandMode(a)){var b=this.line.geometry.components.length-1;this.line.geometry.removeComponent(this.line.geometry.components[b]);this.removePoint();this.finalize()}return false},CLASS_NAME:"OpenLayers.Handler.Path"});OpenLayers.Control.Split=OpenLayers.Class(OpenLayers.Control,{EVENT_TYPES:["beforesplit","split","aftersplit"],layer:null,source:null,sourceOptions:null,tolerance:null,edge:true,deferDelete:false,mutual:true,targetFilter:null,sourceFilter:null,handler:null,initialize:function(a){Array.prototype.push.apply(this.EVENT_TYPES,OpenLayers.Control.prototype.EVENT_TYPES);OpenLayers.Control.prototype.initialize.apply(this,[a]);this.options=a||{};if(this.options.source){this.setSource(this.options.source)}},setSource:function(a){if(this.active){this.deactivate();if(this.handler){this.handler.destroy();delete this.handler}this.source=a;this.activate()}else{this.source=a}},activate:function(){var a=OpenLayers.Control.prototype.activate.call(this);if(a){if(!this.source){if(!this.handler){this.handler=new OpenLayers.Handler.Path(this,{done:function(b){this.onSketchComplete({feature:new OpenLayers.Feature.Vector(b)})}},{layerOptions:this.sourceOptions})}this.handler.activate()}else{if(this.source.events){this.source.events.on({sketchcomplete:this.onSketchComplete,afterfeaturemodified:this.afterFeatureModified,scope:this})}}}return a},deactivate:function(){var a=OpenLayers.Control.prototype.deactivate.call(this);if(a){if(this.source&&this.source.events){this.layer.events.un({sketchcomplete:this.onSketchComplete,afterfeaturemodified:this.afterFeatureModified,scope:this})}}return a},onSketchComplete:function(a){this.feature=null;return !this.considerSplit(a.feature)},afterFeatureModified:function(b){if(b.modified){var a=b.feature;if(a.geometry instanceof OpenLayers.Geometry.LineString||a.geometry instanceof OpenLayers.Geometry.MultiLineString){this.feature=b.feature;this.considerSplit(b.feature)}}},removeByGeometry:function(c,d){for(var b=0,a=c.length;b<a;++b){if(c[b].geometry===d){c.splice(b,1);break}}},isEligible:function(a){return(a.state!==OpenLayers.State.DELETE)&&(a.geometry instanceof OpenLayers.Geometry.LineString||a.geometry instanceof OpenLayers.Geometry.MultiLineString)&&(this.feature!==a)&&(!this.targetFilter||this.targetFilter.evaluate(a.attributes))},considerSplit:function(c){sourceSplit=false;targetSplit=false;if(!this.sourceFilter||this.sourceFilter.evaluate(c.attributes)){var g=this.layer&&this.layer.features||[];var C,r,h,a;var o=[],B=[];var d=(this.layer===this.source)&&this.mutual;var b={edge:this.edge,tolerance:this.tolerance,mutual:d};var l=[c.geometry];var q,f;var t,s;for(var z=0,A=g.length;z<A;++z){q=g[z];if(this.isEligible(q)){f=[q.geometry];for(var w=0;w<l.length;++w){t=l[w];for(var u=0;u<f.length;++u){C=f[u];if(t.getBounds().intersectsBounds(C.getBounds())){r=t.split(C,b);if(r){a=this.events.triggerEvent("beforesplit",{source:c,target:q});if(a!==false){if(d){s=r[0];if(s.length>1){s.unshift(w,1);Array.prototype.splice.apply(l,s);w+=s.length-3}r=r[1]}if(r.length>1){r.unshift(u,1);Array.prototype.splice.apply(f,r);u+=r.length-3}}}}}}if(f&&f.length>1){this.geomsToFeatures(q,f);this.events.triggerEvent("split",{original:q,features:f});Array.prototype.push.apply(o,f);B.push(q);targetSplit=true}}}if(l&&l.length>1){this.geomsToFeatures(c,l);this.events.triggerEvent("split",{original:c,features:l});Array.prototype.push.apply(o,l);B.push(c);sourceSplit=true}if(sourceSplit||targetSplit){if(this.deferDelete){var p,v=[];for(var z=0,A=B.length;z<A;++z){p=B[z];if(p.state===OpenLayers.State.INSERT){v.push(p)}else{p.state=OpenLayers.State.DELETE;this.layer.drawFeature(p)}}this.layer.destroyFeatures(v,{silent:true});for(var z=0,A=o.length;z<A;++z){o[z].state=OpenLayers.State.INSERT}}else{this.layer.destroyFeatures(B,{silent:true})}this.layer.addFeatures(o,{silent:true});this.events.triggerEvent("aftersplit",{source:c,features:o})}}return sourceSplit},geomsToFeatures:function(c,d){var g=c.clone();delete g.geometry;var f;for(var b=0,a=d.length;b<a;++b){f=g.clone();f.geometry=d[b];f.state=OpenLayers.State.INSERT;d[b]=f}},destroy:function(){if(this.active){this.deactivate()}OpenLayers.Control.prototype.destroy.call(this)},CLASS_NAME:"OpenLayers.Control.Split"});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 c=0;if(this.components&&(this.components.length>0)){c+=Math.abs(this.components[0].getArea());for(var b=1,a=this.components.length;b<a;b++){c-=Math.abs(this.components[b].getArea())}}return c},getGeodesicArea:function(b){var d=0;if(this.components&&(this.components.length>0)){d+=Math.abs(this.components[0].getGeodesicArea(b));for(var c=1,a=this.components.length;c<a;c++){d-=Math.abs(this.components[c].getGeodesicArea(b))}}return d},containsPoint:function(a){var f=this.components.length;var c=false;if(f>0){c=this.components[0].containsPoint(a);if(c!==1){if(c&&f>1){var d;for(var b=1;b<f;++b){d=this.components[b].containsPoint(a);if(d){if(d===1){c=1}else{c=false}break}}}}}return c},intersects:function(f){var b=false;var d,a;if(f.CLASS_NAME=="OpenLayers.Geometry.Point"){b=this.containsPoint(f)}else{if(f.CLASS_NAME=="OpenLayers.Geometry.LineString"||f.CLASS_NAME=="OpenLayers.Geometry.LinearRing"){for(d=0,a=this.components.length;d<a;++d){b=f.intersects(this.components[d]);if(b){break}}if(!b){for(d=0,a=f.components.length;d<a;++d){b=this.containsPoint(f.components[d]);if(b){break}}}}else{for(d=0,a=f.components.length;d<a;++d){b=this.intersects(f.components[d]);if(b){break}}}}if(!b&&f.CLASS_NAME=="OpenLayers.Geometry.Polygon"){var c=this.components[0];for(d=0,a=c.components.length;d<a;++d){b=f.containsPoint(c.components[d]);if(b){break}}}return b},distanceTo:function(d,b){var c=!(b&&b.edge===false);var a;if(!c&&this.intersects(d)){a=0}else{a=OpenLayers.Geometry.Collection.prototype.distanceTo.apply(this,[d,b])}return a},CLASS_NAME:"OpenLayers.Geometry.Polygon"});OpenLayers.Geometry.Polygon.createRegularPolygon=function(l,g,b,p){var c=Math.PI*((1/b)-(1/2));if(p){c+=(p/180)*Math.PI}var a,k,h;var o=[];for(var f=0;f<b;++f){a=c+(f*2*Math.PI/b);k=l.x+(g*Math.cos(a));h=l.y+(g*Math.sin(a));o.push(new OpenLayers.Geometry.Point(k,h))}var d=new OpenLayers.Geometry.LinearRing(o);return new OpenLayers.Geometry.Polygon([d])};OpenLayers.Format.GeoRSS=OpenLayers.Class(OpenLayers.Format.XML,{rssns:"http://backend.userland.com/rss2",featureNS:"http://mapserver.gis.umn.edu/mapserver",georssns:"http://www.georss.org/georss",geons:"http://www.w3.org/2003/01/geo/wgs84_pos#",featureTitle:"Untitled",featureDescription:"No Description",gmlParser:null,xy:false,initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},createGeometryFromItem:function(r){var q=this.getElementsByTagNameNS(r,this.georssns,"point");var h=this.getElementsByTagNameNS(r,this.geons,"lat");var a=this.getElementsByTagNameNS(r,this.geons,"long");var t=this.getElementsByTagNameNS(r,this.georssns,"line");var o=this.getElementsByTagNameNS(r,this.georssns,"polygon");var c=this.getElementsByTagNameNS(r,this.georssns,"where");var d=this.getElementsByTagNameNS(r,this.georssns,"box");if(q.length>0||(h.length>0&&a.length>0)){var p;if(q.length>0){p=OpenLayers.String.trim(q[0].firstChild.nodeValue).split(/\s+/);if(p.length!=2){p=OpenLayers.String.trim(q[0].firstChild.nodeValue).split(/\s*,\s*/)}}else{p=[parseFloat(h[0].firstChild.nodeValue),parseFloat(a[0].firstChild.nodeValue)]}var k=new OpenLayers.Geometry.Point(parseFloat(p[1]),parseFloat(p[0]))}else{if(t.length>0){var l=OpenLayers.String.trim(this.concatChildValues(t[0])).split(/\s+/);var f=[];var q;for(var b=0,g=l.length;b<g;b+=2){q=new OpenLayers.Geometry.Point(parseFloat(l[b+1]),parseFloat(l[b]));f.push(q)}k=new OpenLayers.Geometry.LineString(f)}else{if(o.length>0){var l=OpenLayers.String.trim(this.concatChildValues(o[0])).split(/\s+/);var f=[];var q;for(var b=0,g=l.length;b<g;b+=2){q=new OpenLayers.Geometry.Point(parseFloat(l[b+1]),parseFloat(l[b]));f.push(q)}k=new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing(f)])}else{if(c.length>0){if(!this.gmlParser){this.gmlParser=new OpenLayers.Format.GML({xy:this.xy})}var s=this.gmlParser.parseFeature(c[0]);k=s.geometry}else{if(d.length>0){var l=OpenLayers.String.trim(d[0].firstChild.nodeValue).split(/\s+/);var f=[];var q;if(l.length>3){q=new OpenLayers.Geometry.Point(parseFloat(l[1]),parseFloat(l[0]));f.push(q);q=new OpenLayers.Geometry.Point(parseFloat(l[1]),parseFloat(l[2]));f.push(q);q=new OpenLayers.Geometry.Point(parseFloat(l[3]),parseFloat(l[2]));f.push(q);q=new OpenLayers.Geometry.Point(parseFloat(l[3]),parseFloat(l[0]));f.push(q);q=new OpenLayers.Geometry.Point(parseFloat(l[1]),parseFloat(l[0]));f.push(q)}k=new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing(f)])}}}}}if(k&&this.internalProjection&&this.externalProjection){k.transform(this.externalProjection,this.internalProjection)}return k},createFeatureFromItem:function(k){var d=this.createGeometryFromItem(k);var g=this.getChildValue(k,"*","title",this.featureTitle);var h=this.getChildValue(k,"*","description",this.getChildValue(k,"*","content",this.getChildValue(k,"*","summary",this.featureDescription)));var f=this.getChildValue(k,"*","link");if(!f){try{f=this.getElementsByTagNameNS(k,"*","link")[0].getAttribute("href")}catch(c){f=null}}var a=this.getChildValue(k,"*","id",null);var b={title:g,description:h,link:f};var l=new OpenLayers.Feature.Vector(d,b);l.fid=a;return l},getChildValue:function(d,b,c,g){var f;var a=this.getElementsByTagNameNS(d,b,c);if(a&&a[0]&&a[0].firstChild&&a[0].firstChild.nodeValue){f=a[0].firstChild.nodeValue}else{f=(g==undefined)?"":g}return f},read:function(f){if(typeof f=="string"){f=OpenLayers.Format.XML.prototype.read.apply(this,[f])}var a=null;a=this.getElementsByTagNameNS(f,"*","item");if(a.length==0){a=this.getElementsByTagNameNS(f,"*","entry")}var c=a.length;var d=new Array(c);for(var b=0;b<c;b++){d[b]=this.createFeatureFromItem(a[b])}return d},write:function(c){var d;if(c instanceof Array){d=this.createElementNS(this.rssns,"rss");for(var b=0,a=c.length;b<a;b++){d.appendChild(this.createFeatureXML(c[b]))}}else{d=this.createFeatureXML(c)}return OpenLayers.Format.XML.prototype.write.apply(this,[d])},createFeatureXML:function(o){var g=this.buildGeometryNode(o.geometry);var a=this.createElementNS(this.rssns,"item");var d=this.createElementNS(this.rssns,"title");d.appendChild(this.createTextNode(o.attributes.title?o.attributes.title:""));var b=this.createElementNS(this.rssns,"description");b.appendChild(this.createTextNode(o.attributes.description?o.attributes.description:""));a.appendChild(d);a.appendChild(b);if(o.attributes.link){var k=this.createElementNS(this.rssns,"link");k.appendChild(this.createTextNode(o.attributes.link));a.appendChild(k)}for(var l in o.attributes){if(l=="link"||l=="title"||l=="description"){continue}var h=this.createTextNode(o.attributes[l]);var f=l;if(l.search(":")!=-1){f=l.split(":")[1]}var c=this.createElementNS(this.featureNS,"feature:"+f);c.appendChild(h);a.appendChild(c)}a.appendChild(g);return a},buildGeometryNode:function(b){if(this.internalProjection&&this.externalProjection){b=b.clone();b.transform(this.internalProjection,this.externalProjection)}var a;if(b.CLASS_NAME=="OpenLayers.Geometry.Polygon"){a=this.createElementNS(this.georssns,"georss:polygon");a.appendChild(this.buildCoordinatesNode(b.components[0]))}else{if(b.CLASS_NAME=="OpenLayers.Geometry.LineString"){a=this.createElementNS(this.georssns,"georss:line");a.appendChild(this.buildCoordinatesNode(b))}else{if(b.CLASS_NAME=="OpenLayers.Geometry.Point"){a=this.createElementNS(this.georssns,"georss:point");a.appendChild(this.buildCoordinatesNode(b))}else{throw"Couldn't parse "+b.CLASS_NAME}}}return a},buildCoordinatesNode:function(g){var c=null;if(g.components){c=g.components}var f;if(c){var b=c.length;var d=new Array(b);for(var a=0;a<b;a++){d[a]=c[a].y+" "+c[a].x}f=d.join(" ")}else{f=g.y+" "+g.x}return this.createTextNode(f)},CLASS_NAME:"OpenLayers.Format.GeoRSS"});OpenLayers.Format.KML=OpenLayers.Class(OpenLayers.Format.XML,{kmlns:"http://earth.google.com/kml/2.0",placemarksDesc:"No description available",foldersName:"OpenLayers export",foldersDesc:"Exported on "+new Date(),extractAttributes:true,extractStyles:false,internalns:null,features:null,styles:null,styleBaseUrl:"",fetched:null,maxDepth:0,initialize:function(a){this.regExes={trimSpace:(/^\s*|\s*$/g),removeSpace:(/\s*/g),splitSpace:(/\s+/),trimComma:(/\s*,\s*/g),kmlColor:(/(\w{2})(\w{2})(\w{2})(\w{2})/),kmlIconPalette:(/root:\/\/icons\/palette-(\d+)(\.\w+)/),straightBracket:(/\$\[(.*?)\]/g)};OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},read:function(b){this.features=[];this.styles={};this.fetched={};var a={depth:0,styleBaseUrl:this.styleBaseUrl};return this.parseData(b,a)},parseData:function(h,c){if(typeof h=="string"){h=OpenLayers.Format.XML.prototype.read.apply(this,[h])}var f=["Link","NetworkLink","Style","StyleMap","Placemark"];for(var d=0,a=f.length;d<a;++d){var g=f[d];var b=this.getElementsByTagNameNS(h,"*",g);if(b.length==0){continue}switch(g.toLowerCase()){case"link":case"networklink":this.parseLinks(b,c);break;case"style":if(this.extractStyles){this.parseStyles(b,c)}break;case"stylemap":if(this.extractStyles){this.parseStyleMaps(b,c)}break;case"placemark":this.parseFeatures(b,c);break}}return this.features},parseLinks:function(c,d){if(d.depth>=this.maxDepth){return false}var h=OpenLayers.Util.extend({},d);h.depth++;for(var f=0,a=c.length;f<a;f++){var b=this.parseProperty(c[f],"*","href");if(b&&!this.fetched[b]){this.fetched[b]=true;var g=this.fetchLink(b);if(g){this.parseData(g,h)}}}},fetchLink:function(a){var b=OpenLayers.Request.GET({url:a,async:false});if(b){return b.responseText}},parseStyles:function(b,c){for(var d=0,a=b.length;d<a;d++){var f=this.parseStyle(b[d]);if(f){styleName=(c.styleBaseUrl||"")+"#"+f.id;this.styles[styleName]=f}}},parseStyle:function(C){var N={};var L=["LineStyle","PolyStyle","IconStyle","BalloonStyle"];var V,o,p,z;for(var Q=0,s=L.length;Q<s;++Q){V=L[Q];styleTypeNode=this.getElementsByTagNameNS(C,"*",V)[0];if(!styleTypeNode){continue}switch(V.toLowerCase()){case"linestyle":var v=this.parseProperty(styleTypeNode,"*","color");if(v){var c=(v.toString()).match(this.regExes.kmlColor);var O=c[1];N.strokeOpacity=parseInt(O,16)/255;var U=c[2];var S=c[3];var M=c[4];N.strokeColor="#"+M+S+U}var a=this.parseProperty(styleTypeNode,"*","width");if(a){N.strokeWidth=a}case"polystyle":var v=this.parseProperty(styleTypeNode,"*","color");if(v){var c=(v.toString()).match(this.regExes.kmlColor);var O=c[1];N.fillOpacity=parseInt(O,16)/255;var U=c[2];var S=c[3];var M=c[4];N.fillColor="#"+M+S+U}var q=this.parseProperty(styleTypeNode,"*","fill");if(q=="0"){N.fillColor="none"}break;case"iconstyle":var D=parseFloat(this.parseProperty(styleTypeNode,"*","scale")||1);var a=32*D;var d=32*D;var f=this.getElementsByTagNameNS(styleTypeNode,"*","Icon")[0];if(f){var u=this.parseProperty(f,"*","href");if(u){var K=this.parseProperty(f,"*","w");var R=this.parseProperty(f,"*","h");var l="http://maps.google.com/mapfiles/kml";if(OpenLayers.String.startsWith(u,l)&&!K&&!R){K=64;R=64;D=D/2}K=K||R;R=R||K;if(K){a=parseInt(K)*D}if(R){d=parseInt(R)*D}var c=u.match(this.regExes.kmlIconPalette);if(c){var P=c[1];var t=c[2];var J=this.parseProperty(f,"*","x");var I=this.parseProperty(f,"*","y");var F=J?J/32:0;var E=I?(7-I/32):7;var B=E*8+F;u="http://maps.google.com/mapfiles/kml/pal"+P+"/icon"+B+t}N.graphicOpacity=1;N.externalGraphic=u}}var H=this.getElementsByTagNameNS(styleTypeNode,"*","hotSpot")[0];if(H){var J=parseFloat(H.getAttribute("x"));var I=parseFloat(H.getAttribute("y"));var A=H.getAttribute("xunits");if(A=="pixels"){N.graphicXOffset=-J*D}else{if(A=="insetPixels"){N.graphicXOffset=-a+(J*D)}else{if(A=="fraction"){N.graphicXOffset=-a*J}}}var k=H.getAttribute("yunits");if(k=="pixels"){N.graphicYOffset=-d+(I*D)+1}else{if(k=="insetPixels"){N.graphicYOffset=-(I*D)+1}else{if(k=="fraction"){N.graphicYOffset=-d*(1-I)+1}}}}N.graphicWidth=a;N.graphicHeight=d;break;case"balloonstyle":var T=OpenLayers.Util.getXmlNodeValue(styleTypeNode);if(T){N.balloonStyle=T.replace(this.regExes.straightBracket,"${$1}")}break;default:}}if(!N.strokeColor&&N.fillColor){N.strokeColor=N.fillColor}var G=C.getAttribute("id");if(G&&N){N.id=G}return N},parseStyleMaps:function(a,q){for(var h=0,k=a.length;h<k;h++){var d=a[h];var c=this.getElementsByTagNameNS(d,"*","Pair");var b=d.getAttribute("id");for(var g=0,p=c.length;g<p;g++){var f=c[g];var o=this.parseProperty(f,"*","key");var l=this.parseProperty(f,"*","styleUrl");if(l&&o=="normal"){this.styles[(q.styleBaseUrl||"")+"#"+b]=this.styles[(q.styleBaseUrl||"")+l]}if(l&&o=="highlight"){}}}},parseFeatures:function(a,l){var d=new Array(a.length);for(var f=0,g=a.length;f<g;f++){var b=a[f];var k=this.parseFeature.apply(this,[b]);if(k){if(this.extractStyles&&k.attributes&&k.attributes.styleUrl){k.style=this.getStyle(k.attributes.styleUrl,l)}if(this.extractStyles){var h=this.getElementsByTagNameNS(b,"*","Style")[0];if(h){var c=this.parseStyle(h);if(c){k.style=OpenLayers.Util.extend(k.style,c)}}}d[f]=k}else{throw"Bad Placemark: "+f}}this.features=this.features.concat(d)},parseFeature:function(b){var c=["MultiGeometry","Polygon","LineString","Point"];var l,f,o,a;for(var h=0,k=c.length;h<k;++h){l=c[h];this.internalns=b.namespaceURI?b.namespaceURI:this.kmlns;f=this.getElementsByTagNameNS(b,this.internalns,l);if(f.length>0){var a=this.parseGeometry[l.toLowerCase()];if(a){o=a.apply(this,[f[0]]);if(this.internalProjection&&this.externalProjection){o.transform(this.externalProjection,this.internalProjection)}}else{OpenLayers.Console.error(OpenLayers.i18n("unsupportedGeometryType",{geomType:l}))}break}}var g;if(this.extractAttributes){g=this.parseAttributes(b)}var p=new OpenLayers.Feature.Vector(o,g);var d=b.getAttribute("id")||b.getAttribute("name");if(d!=null){p.fid=d}return p},getStyle:function(b,a){var c=OpenLayers.Util.removeTail(b);var g=OpenLayers.Util.extend({},a);g.depth++;g.styleBaseUrl=c;if(!this.styles[b]&&!OpenLayers.String.startsWith(b,"#")&&g.depth<=this.maxDepth&&!this.fetched[c]){var f=this.fetchLink(c);if(f){this.parseData(f,g)}}var d=OpenLayers.Util.extend({},this.styles[b]);return d},parseGeometry:{point:function(d){var c=this.getElementsByTagNameNS(d,this.internalns,"coordinates");var f=[];if(c.length>0){var b=c[0].firstChild.nodeValue;b=b.replace(this.regExes.removeSpace,"");f=b.split(",")}var a=null;if(f.length>1){if(f.length==2){f[2]=null}a=new OpenLayers.Geometry.Point(f[0],f[1],f[2])}else{throw"Bad coordinate string: "+b}return a},linestring:function(c,f){var d=this.getElementsByTagNameNS(c,this.internalns,"coordinates");var p=null;if(d.length>0){var b=this.getChildValue(d[0]);b=b.replace(this.regExes.trimSpace,"");b=b.replace(this.regExes.trimComma,",");var a=b.split(this.regExes.splitSpace);var k=a.length;var o=new Array(k);var l,h;for(var g=0;g<k;++g){l=a[g].split(",");h=l.length;if(h>1){if(l.length==2){l[2]=null}o[g]=new OpenLayers.Geometry.Point(l[0],l[1],l[2])}else{throw"Bad LineString point coordinates: "+a[g]}}if(k){if(f){p=new OpenLayers.Geometry.LinearRing(o)}else{p=new OpenLayers.Geometry.LineString(o)}}else{throw"Bad LineString coordinates: "+b}}return p},polygon:function(g){var c=this.getElementsByTagNameNS(g,this.internalns,"LinearRing");var h=c.length;var f=new Array(h);if(h>0){var b;for(var d=0,a=c.length;d<a;++d){b=this.parseGeometry.linestring.apply(this,[c[d],true]);if(b){f[d]=b}else{throw"Bad LinearRing geometry: "+d}}}return new OpenLayers.Geometry.Polygon(f)},multigeometry:function(f){var k,h;var g=[];var c=f.childNodes;for(var b=0,a=c.length;b<a;++b){k=c[b];if(k.nodeType==1){var d=(k.prefix)?k.nodeName.split(":")[1]:k.nodeName;var h=this.parseGeometry[d.toLowerCase()];if(h){g.push(h.apply(this,[k]))}}}return new OpenLayers.Geometry.Collection(g)}},parseAttributes:function(d){var f={};var g=d.getElementsByTagName("ExtendedData");if(g.length){f=this.parseExtendedData(g[0])}var b,p,o;var c=d.childNodes;for(var h=0,k=c.length;h<k;++h){b=c[h];if(b.nodeType==1){p=b.childNodes;if(p.length==1||p.length==3){var o;switch(p.length){case 1:o=p[0];break;case 3:default:o=p[1];break}if(o.nodeType==3||o.nodeType==4){var a=(b.prefix)?b.nodeName.split(":")[1]:b.nodeName;var l=OpenLayers.Util.getXmlNodeValue(o);if(l){l=l.replace(this.regExes.trimSpace,"");f[a]=l}}}}}return f},parseExtendedData:function(b){var d={};var c=b.getElementsByTagName("Data");for(var g=0,k=c.length;g<k;g++){var f=c[g];var l=f.getAttribute("name");var h={};var o=f.getElementsByTagName("value");if(o.length){h.value=this.getChildValue(o[0])}var a=f.getElementsByTagName("displayName");if(a.length){h.displayName=this.getChildValue(a[0])}d[l]=h}return d},parseProperty:function(c,d,b){var f;var a=this.getElementsByTagNameNS(c,d,b);try{f=OpenLayers.Util.getXmlNodeValue(a[0])}catch(g){f=null}return f},write:function(d){if(!(d instanceof Array)){d=[d]}var b=this.createElementNS(this.kmlns,"kml");var f=this.createFolderXML();for(var c=0,a=d.length;c<a;++c){f.appendChild(this.createPlacemarkXML(d[c]))}b.appendChild(f);return OpenLayers.Format.XML.prototype.write.apply(this,[b])},createFolderXML:function(){var f=this.createElementNS(this.kmlns,"name");var d=this.createTextNode(this.foldersName);f.appendChild(d);var a=this.createElementNS(this.kmlns,"description");var b=this.createTextNode(this.foldersDesc);a.appendChild(b);var c=this.createElementNS(this.kmlns,"Folder");c.appendChild(f);c.appendChild(a);return c},createPlacemarkXML:function(f){var h=this.createElementNS(this.kmlns,"name");var c=(f.attributes.name)?f.attributes.name:f.id;h.appendChild(this.createTextNode(c));var d=this.createElementNS(this.kmlns,"description");var g=(f.attributes.description)?f.attributes.description:this.placemarksDesc;d.appendChild(this.createTextNode(g));var b=this.createElementNS(this.kmlns,"Placemark");if(f.fid!=null){b.setAttribute("id",f.fid)}b.appendChild(h);b.appendChild(d);var a=this.buildGeometryNode(f.geometry);b.appendChild(a);return b},buildGeometryNode:function(f){if(this.internalProjection&&this.externalProjection){f=f.clone();f.transform(this.internalProjection,this.externalProjection)}var c=f.CLASS_NAME;var b=c.substring(c.lastIndexOf(".")+1);var a=this.buildGeometry[b.toLowerCase()];var d=null;if(a){d=a.apply(this,[f])}return d},buildGeometry:{point:function(b){var a=this.createElementNS(this.kmlns,"Point");a.appendChild(this.buildCoordinatesNode(b));return a},multipoint:function(a){return this.buildGeometry.collection.apply(this,[a])},linestring:function(b){var a=this.createElementNS(this.kmlns,"LineString");a.appendChild(this.buildCoordinatesNode(b));return a},multilinestring:function(a){return this.buildGeometry.collection.apply(this,[a])},linearring:function(b){var a=this.createElementNS(this.kmlns,"LinearRing");a.appendChild(this.buildCoordinatesNode(b));return a},polygon:function(k){var b=this.createElementNS(this.kmlns,"Polygon");var h=k.components;var f,g,d;for(var c=0,a=h.length;c<a;++c){d=(c==0)?"outerBoundaryIs":"innerBoundaryIs";f=this.createElementNS(this.kmlns,d);g=this.buildGeometry.linearring.apply(this,[h[c]]);f.appendChild(g);b.appendChild(f)}return b},multipolygon:function(a){return this.buildGeometry.collection.apply(this,[a])},collection:function(d){var b=this.createElementNS(this.kmlns,"MultiGeometry");var f;for(var c=0,a=d.components.length;c<a;++c){f=this.buildGeometryNode.apply(this,[d.components[c]]);if(f){b.appendChild(f)}}return b}},buildCoordinatesNode:function(f){var a=this.createElementNS(this.kmlns,"coordinates");var l;var k=f.components;if(k){var h;var g=k.length;var c=new Array(g);for(var d=0;d<g;++d){h=k[d];c[d]=h.x+","+h.y}l=c.join(" ")}else{l=f.x+","+f.y}var b=this.createTextNode(l);a.appendChild(b);return a},CLASS_NAME:"OpenLayers.Format.KML"});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.Polygon=OpenLayers.Class(OpenLayers.Handler.Path,{polygon:null,initialize:function(c,b,a){OpenLayers.Handler.Path.prototype.initialize.apply(this,arguments)},createFeature:function(a){var b=this.control.map.getLonLatFromPixel(a);this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(b.lon,b.lat));this.line=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LinearRing([this.point.geometry]));this.polygon=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon([this.line.geometry]));this.callback("create",[this.point.geometry,this.getSketch()]);this.point.geometry.clearBounds();this.layer.addFeatures([this.polygon,this.point],{silent:true})},destroyFeature:function(){OpenLayers.Handler.Path.prototype.destroyFeature.apply(this);this.polygon=null},drawFeature:function(){this.layer.drawFeature(this.polygon,this.style);this.layer.drawFeature(this.point,this.style)},getSketch:function(){return this.polygon},getGeometry:function(){var a=this.polygon&&this.polygon.geometry;if(a&&this.multi){a=new OpenLayers.Geometry.MultiPolygon([a])}return a},dblclick:function(a){if(!this.freehandMode(a)){var b=this.line.geometry.components.length-2;this.line.geometry.removeComponent(this.line.geometry.components[b]);this.removePoint();this.finalize()}return false},CLASS_NAME:"OpenLayers.Handler.Polygon"});OpenLayers.Format.ArcXML=OpenLayers.Class(OpenLayers.Format.XML,{fontStyleKeys:["antialiasing","blockout","font","fontcolor","fontsize","fontstyle","glowing","interval","outline","printmode","shadow","transparency"],request:null,response:null,initialize:function(a){this.request=new OpenLayers.Format.ArcXML.Request();this.response=new OpenLayers.Format.ArcXML.Response();if(a){if(a.requesttype=="feature"){this.request.get_image=null;var c=this.request.get_feature.query;this.addCoordSys(c.featurecoordsys,a.featureCoordSys);this.addCoordSys(c.filtercoordsys,a.filterCoordSys);if(a.polygon){c.isspatial=true;c.spatialfilter.polygon=a.polygon}else{if(a.envelope){c.isspatial=true;c.spatialfilter.envelope={minx:0,miny:0,maxx:0,maxy:0};this.parseEnvelope(c.spatialfilter.envelope,a.envelope)}}}else{if(a.requesttype=="image"){this.request.get_feature=null;var b=this.request.get_image.properties;this.parseEnvelope(b.envelope,a.envelope);this.addLayers(b.layerlist,a.layers);this.addImageSize(b.imagesize,a.tileSize);this.addCoordSys(b.featurecoordsys,a.featureCoordSys);this.addCoordSys(b.filtercoordsys,a.filterCoordSys)}else{this.request=null}}}OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},parseEnvelope:function(b,a){if(a&&a.length==4){b.minx=a[0];b.miny=a[1];b.maxx=a[2];b.maxy=a[3]}},addLayers:function(d,c){for(var b=0,a=c.length;b<a;b++){d.push(c[b])}},addImageSize:function(b,a){if(a!==null){b.width=a.w;b.height=a.h;b.printwidth=a.w;b.printheight=a.h}},addCoordSys:function(a,b){if(typeof b=="string"){a.id=parseInt(b);a.string=b}else{if(typeof b=="object"&&b.proj!==null){a.id=b.proj.srsProjNumber;a.string=b.proj.srsCode}else{a=b}}},iserror:function(c){var a=null;if(!c){a=(this.response.error!=="")}else{c=OpenLayers.Format.XML.prototype.read.apply(this,[c]);var b=c.documentElement.getElementsByTagName("ERROR");a=(b!==null&&b.length>0)}return a},read:function(g){if(typeof g=="string"){g=OpenLayers.Format.XML.prototype.read.apply(this,[g])}var a=null;if(g&&g.documentElement){if(g.documentElement.nodeName=="ARCXML"){a=g.documentElement}else{a=g.documentElement.getElementsByTagName("ARCXML")[0]}}if(!a){var c,f;try{c=g.firstChild.nodeValue;f=g.firstChild.childNodes[1].firstChild.nodeValue}catch(d){}throw {message:"Error parsing the ArcXML request",error:c,source:f}}var b=this.parseResponse(a);return b},write:function(c){if(!c){c=this.request}var v=this.createElementNS("","ARCXML");v.setAttribute("version","1.1");var k=this.createElementNS("","REQUEST");if(c.get_image!=null){var p=this.createElementNS("","GET_IMAGE");k.appendChild(p);var o=this.createElementNS("","PROPERTIES");p.appendChild(o);var b=c.get_image.properties;if(b.featurecoordsys!=null){var t=this.createElementNS("","FEATURECOORDSYS");o.appendChild(t);if(b.featurecoordsys.id===0){t.setAttribute("string",b.featurecoordsys.string)}else{t.setAttribute("id",b.featurecoordsys.id)}}if(b.filtercoordsys!=null){var r=this.createElementNS("","FILTERCOORDSYS");o.appendChild(r);if(b.filtercoordsys.id===0){r.setAttribute("string",b.filtercoordsys.string)}else{r.setAttribute("id",b.filtercoordsys.id)}}if(b.envelope!=null){var B=this.createElementNS("","ENVELOPE");o.appendChild(B);B.setAttribute("minx",b.envelope.minx);B.setAttribute("miny",b.envelope.miny);B.setAttribute("maxx",b.envelope.maxx);B.setAttribute("maxy",b.envelope.maxy)}var z=this.createElementNS("","IMAGESIZE");o.appendChild(z);z.setAttribute("height",b.imagesize.height);z.setAttribute("width",b.imagesize.width);if(b.imagesize.height!=b.imagesize.printheight||b.imagesize.width!=b.imagesize.printwidth){z.setAttribute("printheight",b.imagesize.printheight);z.setArrtibute("printwidth",b.imagesize.printwidth)}if(b.background!=null){var a=this.createElementNS("","BACKGROUND");o.appendChild(a);a.setAttribute("color",b.background.color.r+","+b.background.color.g+","+b.background.color.b);if(b.background.transcolor!==null){a.setAttribute("transcolor",b.background.transcolor.r+","+b.background.transcolor.g+","+b.background.transcolor.b)}}if(b.layerlist!=null&&b.layerlist.length>0){var h=this.createElementNS("","LAYERLIST");o.appendChild(h);for(var u=0;u<b.layerlist.length;u++){var s=this.createElementNS("","LAYERDEF");h.appendChild(s);s.setAttribute("id",b.layerlist[u].id);s.setAttribute("visible",b.layerlist[u].visible);if(typeof b.layerlist[u].query=="object"){var g=b.layerlist[u].query;if(g.where.length<0){continue}var E=null;if(typeof g.spatialfilter=="boolean"&&g.spatialfilter){E=this.createElementNS("","SPATIALQUERY")}else{E=this.createElementNS("","QUERY")}E.setAttribute("where",g.where);if(typeof g.accuracy=="number"&&g.accuracy>0){E.setAttribute("accuracy",g.accuracy)}if(typeof g.featurelimit=="number"&&g.featurelimit<2000){E.setAttribute("featurelimit",g.featurelimit)}if(typeof g.subfields=="string"&&g.subfields!="#ALL#"){E.setAttribute("subfields",g.subfields)}if(typeof g.joinexpression=="string"&&g.joinexpression.length>0){E.setAttribute("joinexpression",g.joinexpression)}if(typeof g.jointables=="string"&&g.jointables.length>0){E.setAttribute("jointables",g.jointables)}s.appendChild(E)}if(typeof b.layerlist[u].renderer=="object"){this.addRenderer(s,b.layerlist[u].renderer)}}}}else{if(c.get_feature!=null){var p=this.createElementNS("","GET_FEATURES");p.setAttribute("outputmode","newxml");p.setAttribute("checkesc","true");if(c.get_feature.geometry){p.setAttribute("geometry",c.get_feature.geometry)}else{p.setAttribute("geometry","false")}if(c.get_feature.compact){p.setAttribute("compact",c.get_feature.compact)}if(c.get_feature.featurelimit=="number"){p.setAttribute("featurelimit",c.get_feature.featurelimit)}p.setAttribute("globalenvelope","true");k.appendChild(p);if(c.get_feature.layer!=null&&c.get_feature.layer.length>0){var C=this.createElementNS("","LAYER");C.setAttribute("id",c.get_feature.layer);p.appendChild(C)}var w=c.get_feature.query;if(w!=null){var A=null;if(w.isspatial){A=this.createElementNS("","SPATIALQUERY")}else{A=this.createElementNS("","QUERY")}p.appendChild(A);if(typeof w.accuracy=="number"){A.setAttribute("accuracy",w.accuracy)}if(w.featurecoordsys!=null){var f=this.createElementNS("","FEATURECOORDSYS");if(w.featurecoordsys.id==0){f.setAttribute("string",w.featurecoordsys.string)}else{f.setAttribute("id",w.featurecoordsys.id)}A.appendChild(f)}if(w.filtercoordsys!=null){var d=this.createElementNS("","FILTERCOORDSYS");if(w.filtercoordsys.id===0){d.setAttribute("string",w.filtercoordsys.string)}else{d.setAttribute("id",w.filtercoordsys.id)}A.appendChild(d)}if(w.buffer>0){var q=this.createElementNS("","BUFFER");q.setAttribute("distance",w.buffer);A.appendChild(q)}if(w.isspatial){var l=this.createElementNS("","SPATIALFILTER");l.setAttribute("relation",w.spatialfilter.relation);A.appendChild(l);if(w.spatialfilter.envelope){var D=this.createElementNS("","ENVELOPE");D.setAttribute("minx",w.spatialfilter.envelope.minx);D.setAttribute("miny",w.spatialfilter.envelope.miny);D.setAttribute("maxx",w.spatialfilter.envelope.maxx);D.setAttribute("maxy",w.spatialfilter.envelope.maxy);l.appendChild(D)}else{if(typeof w.spatialfilter.polygon=="object"){l.appendChild(this.writePolygonGeometry(w.spatialfilter.polygon))}}}if(w.where!=null&&w.where.length>0){A.setAttribute("where",w.where)}}}}v.appendChild(k);return OpenLayers.Format.XML.prototype.write.apply(this,[v])},addGroupRenderer:function(b,a){var f=this.createElementNS("","GROUPRENDERER");b.appendChild(f);for(var c=0;c<a.length;c++){var d=a[c];this.addRenderer(f,d)}},addRenderer:function(c,b){if(b instanceof Array){this.addGroupRenderer(c,b)}else{var a=this.createElementNS("",b.type.toUpperCase()+"RENDERER");c.appendChild(a);if(a.tagName=="VALUEMAPRENDERER"){this.addValueMapRenderer(a,b)}else{if(a.tagName=="VALUEMAPLABELRENDERER"){this.addValueMapLabelRenderer(a,b)}else{if(a.tagName=="SIMPLELABELRENDERER"){this.addSimpleLabelRenderer(a,b)}else{if(a.tagName=="SCALEDEPENDENTRENDERER"){this.addScaleDependentRenderer(a,b)}}}}}},addScaleDependentRenderer:function(a,b){if(typeof b.lower=="string"||typeof b.lower=="number"){a.setAttribute("lower",b.lower)}if(typeof b.upper=="string"||typeof b.upper=="number"){a.setAttribute("upper",b.upper)}this.addRenderer(a,b.renderer)},addValueMapLabelRenderer:function(k,h){k.setAttribute("lookupfield",h.lookupfield);k.setAttribute("labelfield",h.labelfield);if(typeof h.exacts=="object"){for(var a=0,o=h.exacts.length;a<o;a++){var f=h.exacts[a];var d=this.createElementNS("","EXACT");if(typeof f.value=="string"){d.setAttribute("value",f.value)}if(typeof f.label=="string"){d.setAttribute("label",f.label)}if(typeof f.method=="string"){d.setAttribute("method",f.method)}k.appendChild(d);if(typeof f.symbol=="object"){var b=null;if(f.symbol.type=="text"){b=this.createElementNS("","TEXTSYMBOL")}if(b!=null){var p=this.fontStyleKeys;for(var c=0,g=p.length;c<g;c++){var l=p[c];if(f.symbol[l]){b.setAttribute(l,f.symbol[l])}}d.appendChild(b)}}}}},addValueMapRenderer:function(o,l){o.setAttribute("lookupfield",l.lookupfield);if(typeof l.ranges=="object"){for(var a=0,b=l.ranges.length;a<b;a++){var h=l.ranges[a];var f=this.createElementNS("","RANGE");f.setAttribute("lower",h.lower);f.setAttribute("upper",h.upper);o.appendChild(f);if(typeof h.symbol=="object"){var d=null;if(h.symbol.type=="simplepolygon"){d=this.createElementNS("","SIMPLEPOLYGONSYMBOL")}if(d!=null){if(typeof h.symbol.boundarycolor=="string"){d.setAttribute("boundarycolor",h.symbol.boundarycolor)}if(typeof h.symbol.fillcolor=="string"){d.setAttribute("fillcolor",h.symbol.fillcolor)}if(typeof h.symbol.filltransparency=="number"){d.setAttribute("filltransparency",h.symbol.filltransparency)}f.appendChild(d)}}}}else{if(typeof l.exacts=="object"){for(var c=0,p=l.exacts.length;c<p;c++){var k=l.exacts[c];var g=this.createElementNS("","EXACT");if(typeof k.value=="string"){g.setAttribute("value",k.value)}if(typeof k.label=="string"){g.setAttribute("label",k.label)}if(typeof k.method=="string"){g.setAttribute("method",k.method)}o.appendChild(g);if(typeof k.symbol=="object"){var d=null;if(k.symbol.type=="simplemarker"){d=this.createElementNS("","SIMPLEMARKERSYMBOL")}if(d!=null){if(typeof k.symbol.antialiasing=="string"){d.setAttribute("antialiasing",k.symbol.antialiasing)}if(typeof k.symbol.color=="string"){d.setAttribute("color",k.symbol.color)}if(typeof k.symbol.outline=="string"){d.setAttribute("outline",k.symbol.outline)}if(typeof k.symbol.overlap=="string"){d.setAttribute("overlap",k.symbol.overlap)}if(typeof k.symbol.shadow=="string"){d.setAttribute("shadow",k.symbol.shadow)}if(typeof k.symbol.transparency=="number"){d.setAttribute("transparency",k.symbol.transparency)}if(typeof k.symbol.usecentroid=="string"){d.setAttribute("usecentroid",k.symbol.usecentroid)}if(typeof k.symbol.width=="number"){d.setAttribute("width",k.symbol.width)}g.appendChild(d)}}}}}},addSimpleLabelRenderer:function(g,k){g.setAttribute("field",k.field);var f=["featureweight","howmanylabels","labelbufferratio","labelpriorities","labelweight","linelabelposition","rotationalangles"];for(var d=0,a=f.length;d<a;d++){var c=f[d];if(k[c]){g.setAttribute(c,k[c])}}if(k.symbol.type=="text"){var h=k.symbol;var b=this.createElementNS("","TEXTSYMBOL");g.appendChild(b);var f=this.fontStyleKeys;for(var d=0,a=f.length;d<a;d++){var c=f[d];if(h[c]){b.setAttribute(c,k[c])}}}},writePolygonGeometry:function(h){if(!(h instanceof OpenLayers.Geometry.Polygon)){throw {message:"Cannot write polygon geometry to ArcXML with an "+h.CLASS_NAME+" object.",geometry:h}}var b=this.createElementNS("","POLYGON");for(var f=0,c=h.components.length;f<c;f++){var a=h.components[f];var l=this.createElementNS("","RING");for(var d=0,o=a.components.length;d<o;d++){var k=a.components[d];var g=this.createElementNS("","POINT");g.setAttribute("x",k.x);g.setAttribute("y",k.y);l.appendChild(g)}b.appendChild(l)}return b},parseResponse:function(G){if(typeof G=="string"){var s=new OpenLayers.Format.XML();G=s.read(G)}var a=new OpenLayers.Format.ArcXML.Response();var H=G.getElementsByTagName("ERROR");if(H!=null&&H.length>0){a.error=this.getChildValue(H,"Unknown error.")}else{var w=G.getElementsByTagName("RESPONSE");if(w==null||w.length==0){a.error="No RESPONSE tag found in ArcXML response.";return a}var v=w[0].firstChild.nodeName;if(v=="#text"){v=w[0].firstChild.nextSibling.nodeName}if(v=="IMAGE"){var c=G.getElementsByTagName("ENVELOPE");var D=G.getElementsByTagName("OUTPUT");if(c==null||c.length==0){a.error="No ENVELOPE tag found in ArcXML response."}else{if(D==null||D.length==0){a.error="No OUTPUT tag found in ArcXML response."}else{var B=this.parseAttributes(c[0]);var C=this.parseAttributes(D[0]);if(typeof C.type=="string"){a.image={envelope:B,output:{type:C.type,data:this.getChildValue(D[0])}}}else{a.image={envelope:B,output:C}}}}}else{if(v=="FEATURES"){var l=w[0].getElementsByTagName("FEATURES");var u=l[0].getElementsByTagName("FEATURECOUNT");a.features.featurecount=u[0].getAttribute("count");if(a.features.featurecount>0){var d=l[0].getElementsByTagName("ENVELOPE");a.features.envelope=this.parseAttributes(d[0],typeof(0));var E=l[0].getElementsByTagName("FEATURE");for(var r=0;r<E.length;r++){var k=new OpenLayers.Feature.Vector();var z=E[r].getElementsByTagName("FIELD");for(var g=0;g<z.length;g++){var h=z[g].getAttribute("name");var p=z[g].getAttribute("value");k.attributes[h]=p}var A=E[r].getElementsByTagName("POLYGON");if(A.length>0){var o=A[0].getElementsByTagName("RING");var f=[];for(var t=0;t<o.length;t++){var F=[];F.push(this.parsePointGeometry(o[t]));var q=o[t].getElementsByTagName("HOLE");for(var b=0;b<q.length;b++){F.push(this.parsePointGeometry(q[b]))}q=null;f.push(new OpenLayers.Geometry.Polygon(F));F=null}o=null;if(f.length==1){k.geometry=f[0]}else{k.geometry=new OpenLayers.Geometry.MultiPolygon(f)}}a.features.feature.push(k)}}}else{a.error="Unidentified response type."}}}return a},parseAttributes:function(d,c){var b={};for(var a=0;a<d.attributes.length;a++){if(c=="number"){b[d.attributes[a].nodeName]=parseFloat(d.attributes[a].nodeValue)}else{b[d.attributes[a].nodeName]=d.attributes[a].nodeValue}}return b},parsePointGeometry:function(d){var b=[];var f=d.getElementsByTagName("COORDS");if(f.length>0){var g=this.getChildValue(f[0]);g=g.split(/;/);for(var k=0;k<g.length;k++){var h=g[k].split(/ /);b.push(new OpenLayers.Geometry.Point(parseFloat(h[0]),parseFloat(h[1])))}f=null}else{var a=d.getElementsByTagName("POINT");if(a.length>0){for(var c=0;c<a.length;c++){b.push(new OpenLayers.Geometry.Point(parseFloat(a[c].getAttribute("x")),parseFloat(a[c].getAttribute("y"))))}}a=null}return new OpenLayers.Geometry.LinearRing(b)},CLASS_NAME:"OpenLayers.Format.ArcXML"});OpenLayers.Format.ArcXML.Request=OpenLayers.Class({initialize:function(b){var a={get_image:{properties:{background:null,draw:true,envelope:{minx:0,miny:0,maxx:0,maxy:0},featurecoordsys:{id:0,string:"",datumtransformid:0,datumtransformstring:""},filtercoordsys:{id:0,string:"",datumtransformid:0,datumtransformstring:""},imagesize:{height:0,width:0,dpi:96,printheight:0,printwidth:0,scalesymbols:false},layerlist:[],output:{baseurl:"",legendbaseurl:"",legendname:"",legendpath:"",legendurl:"",name:"",path:"",type:"jpg",url:""}}},get_feature:{layer:"",query:{isspatial:false,featurecoordsys:{id:0,string:"",datumtransformid:0,datumtransformstring:""},filtercoordsys:{id:0,string:"",datumtransformid:0,datumtransformstring:""},buffer:0,where:"",spatialfilter:{relation:"envelope_intersection",envelope:null}}},environment:{separators:{cs:" ",ts:";"}},layer:[],workspaces:[]};return OpenLayers.Util.extend(this,a)},CLASS_NAME:"OpenLayers.Format.ArcXML.Request"});OpenLayers.Format.ArcXML.Response=OpenLayers.Class({initialize:function(b){var a={image:{envelope:null,output:""},features:{featurecount:0,envelope:null,feature:[]},error:""};return OpenLayers.Util.extend(this,a)},CLASS_NAME:"OpenLayers.Format.ArcXML.Response"});OpenLayers.Format.GML=OpenLayers.Class(OpenLayers.Format.XML,{featureNS:"http://mapserver.gis.umn.edu/mapserver",featurePrefix:"feature",featureName:"featureMember",layerName:"features",geometryName:"geometry",collectionName:"FeatureCollection",gmlns:"http://www.opengis.net/gml",extractAttributes:true,xy:true,initialize:function(a){this.regExes={trimSpace:(/^\s*|\s*$/g),removeSpace:(/\s*/g),splitSpace:(/\s+/),trimComma:(/\s*,\s*/g)};OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},read:function(d){if(typeof d=="string"){d=OpenLayers.Format.XML.prototype.read.apply(this,[d])}var f=this.getElementsByTagNameNS(d.documentElement,this.gmlns,this.featureName);var c=[];for(var b=0;b<f.length;b++){var a=this.parseFeature(f[b]);if(a){c.push(a)}}return c},parseFeature:function(c){var d=["MultiPolygon","Polygon","MultiLineString","LineString","MultiPoint","Point","Envelope","Box"];var l,g,o,b;for(var k=0;k<d.length;++k){l=d[k];g=this.getElementsByTagNameNS(c,this.gmlns,l);if(g.length>0){var b=this.parseGeometry[l.toLowerCase()];if(b){o=b.apply(this,[g[0]]);if(this.internalProjection&&this.externalProjection){o.transform(this.externalProjection,this.internalProjection)}}else{OpenLayers.Console.error(OpenLayers.i18n("unsupportedGeometryType",{geomType:l}))}break}}var h;if(this.extractAttributes){h=this.parseAttributes(c)}var p=new OpenLayers.Feature.Vector(o,h);p.gml={featureType:c.firstChild.nodeName.split(":")[1],featureNS:c.firstChild.namespaceURI,featureNSPrefix:c.firstChild.prefix};var a=c.firstChild;var f;while(a){if(a.nodeType==1){f=a.getAttribute("fid")||a.getAttribute("id");if(f){break}}a=a.nextSibling}p.fid=f;return p},parseGeometry:{point:function(d){var b,a;var f=[];var b=this.getElementsByTagNameNS(d,this.gmlns,"pos");if(b.length>0){a=b[0].firstChild.nodeValue;a=a.replace(this.regExes.trimSpace,"");f=a.split(this.regExes.splitSpace)}if(f.length==0){b=this.getElementsByTagNameNS(d,this.gmlns,"coordinates");if(b.length>0){a=b[0].firstChild.nodeValue;a=a.replace(this.regExes.removeSpace,"");f=a.split(",")}}if(f.length==0){b=this.getElementsByTagNameNS(d,this.gmlns,"coord");if(b.length>0){var g=this.getElementsByTagNameNS(b[0],this.gmlns,"X");var c=this.getElementsByTagNameNS(b[0],this.gmlns,"Y");if(g.length>0&&c.length>0){f=[g[0].firstChild.nodeValue,c[0].firstChild.nodeValue]}}}if(f.length==2){f[2]=null}if(this.xy){return new OpenLayers.Geometry.Point(f[0],f[1],f[2])}else{return new OpenLayers.Geometry.Point(f[1],f[0],f[2])}},multipoint:function(f){var b=this.getElementsByTagNameNS(f,this.gmlns,"Point");var d=[];if(b.length>0){var a;for(var c=0;c<b.length;++c){a=this.parseGeometry.point.apply(this,[b[c]]);if(a){d.push(a)}}}return new OpenLayers.Geometry.MultiPoint(d)},linestring:function(c,f){var d,b;var q=[];var r=[];d=this.getElementsByTagNameNS(c,this.gmlns,"posList");if(d.length>0){b=this.getChildValue(d[0]);b=b.replace(this.regExes.trimSpace,"");q=b.split(this.regExes.splitSpace);var k=parseInt(d[0].getAttribute("dimension"));var g,p,o,l;for(var h=0;h<q.length/k;++h){g=h*k;p=q[g];o=q[g+1];l=(k==2)?null:q[g+2];if(this.xy){r.push(new OpenLayers.Geometry.Point(p,o,l))}else{r.push(new OpenLayers.Geometry.Point(o,p,l))}}}if(q.length==0){d=this.getElementsByTagNameNS(c,this.gmlns,"coordinates");if(d.length>0){b=this.getChildValue(d[0]);b=b.replace(this.regExes.trimSpace,"");b=b.replace(this.regExes.trimComma,",");var a=b.split(this.regExes.splitSpace);for(var h=0;h<a.length;++h){q=a[h].split(",");if(q.length==2){q[2]=null}if(this.xy){r.push(new OpenLayers.Geometry.Point(q[0],q[1],q[2]))}else{r.push(new OpenLayers.Geometry.Point(q[1],q[0],q[2]))}}}}var s=null;if(r.length!=0){if(f){s=new OpenLayers.Geometry.LinearRing(r)}else{s=new OpenLayers.Geometry.LineString(r)}}return s},multilinestring:function(f){var b=this.getElementsByTagNameNS(f,this.gmlns,"LineString");var d=[];if(b.length>0){var a;for(var c=0;c<b.length;++c){a=this.parseGeometry.linestring.apply(this,[b[c]]);if(a){d.push(a)}}}return new OpenLayers.Geometry.MultiLineString(d)},polygon:function(f){var b=this.getElementsByTagNameNS(f,this.gmlns,"LinearRing");var d=[];if(b.length>0){var a;for(var c=0;c<b.length;++c){a=this.parseGeometry.linestring.apply(this,[b[c],true]);if(a){d.push(a)}}}return new OpenLayers.Geometry.Polygon(d)},multipolygon:function(f){var a=this.getElementsByTagNameNS(f,this.gmlns,"Polygon");var d=[];if(a.length>0){var c;for(var b=0;b<a.length;++b){c=this.parseGeometry.polygon.apply(this,[a[b]]);if(c){d.push(c)}}}return new OpenLayers.Geometry.MultiPolygon(d)},envelope:function(b){var f=[];var a;var g;var o=this.getElementsByTagNameNS(b,this.gmlns,"lowerCorner");if(o.length>0){var k=[];if(o.length>0){a=o[0].firstChild.nodeValue;a=a.replace(this.regExes.trimSpace,"");k=a.split(this.regExes.splitSpace)}if(k.length==2){k[2]=null}if(this.xy){var d=new OpenLayers.Geometry.Point(k[0],k[1],k[2])}else{var d=new OpenLayers.Geometry.Point(k[1],k[0],k[2])}}var h=this.getElementsByTagNameNS(b,this.gmlns,"upperCorner");if(h.length>0){var k=[];if(h.length>0){a=h[0].firstChild.nodeValue;a=a.replace(this.regExes.trimSpace,"");k=a.split(this.regExes.splitSpace)}if(k.length==2){k[2]=null}if(this.xy){var l=new OpenLayers.Geometry.Point(k[0],k[1],k[2])}else{var l=new OpenLayers.Geometry.Point(k[1],k[0],k[2])}}if(d&&l){f.push(new OpenLayers.Geometry.Point(d.x,d.y));f.push(new OpenLayers.Geometry.Point(l.x,d.y));f.push(new OpenLayers.Geometry.Point(l.x,l.y));f.push(new OpenLayers.Geometry.Point(d.x,l.y));f.push(new OpenLayers.Geometry.Point(d.x,d.y));var c=new OpenLayers.Geometry.LinearRing(f);g=new OpenLayers.Geometry.Polygon([c])}return g}},parseAttributes:function(f){var g={};var a=f.firstChild;var d,h,c,o,l,b,k;while(a){if(a.nodeType==1){d=a.childNodes;for(h=0;h<d.length;++h){c=d[h];if(c.nodeType==1){o=c.childNodes;if(o.length==1){l=o[0];if(l.nodeType==3||l.nodeType==4){b=(c.prefix)?c.nodeName.split(":")[1]:c.nodeName;k=l.nodeValue.replace(this.regExes.trimSpace,"");g[b]=k}}else{g[c.nodeName.split(":").pop()]=null}}}break}a=a.nextSibling}return g},write:function(c){if(!(c instanceof Array)){c=[c]}var b=this.createElementNS("http://www.opengis.net/wfs","wfs:"+this.collectionName);for(var a=0;a<c.length;a++){b.appendChild(this.createFeatureXML(c[a]))}return OpenLayers.Format.XML.prototype.write.apply(this,[b])},createFeatureXML:function(o){var k=o.geometry;var f=this.buildGeometryNode(k);var l=this.createElementNS(this.featureNS,this.featurePrefix+":"+this.geometryName);l.appendChild(f);var a=this.createElementNS(this.gmlns,"gml:"+this.featureName);var p=this.createElementNS(this.featureNS,this.featurePrefix+":"+this.layerName);var c=o.fid||o.id;p.setAttribute("fid",c);p.appendChild(l);for(var h in o.attributes){var g=this.createTextNode(o.attributes[h]);var d=h.substring(h.lastIndexOf(":")+1);var b=this.createElementNS(this.featureNS,this.featurePrefix+":"+d);b.appendChild(g);p.appendChild(b)}a.appendChild(p);return a},buildGeometryNode:function(d){if(this.externalProjection&&this.internalProjection){d=d.clone();d.transform(this.internalProjection,this.externalProjection)}var c=d.CLASS_NAME;var b=c.substring(c.lastIndexOf(".")+1);var a=this.buildGeometry[b.toLowerCase()];return a.apply(this,[d])},buildGeometry:{point:function(b){var a=this.createElementNS(this.gmlns,"gml:Point");a.appendChild(this.buildCoordinatesNode(b));return a},multipoint:function(g){var d=this.createElementNS(this.gmlns,"gml:MultiPoint");var c=g.components;var b,f;for(var a=0;a<c.length;a++){b=this.createElementNS(this.gmlns,"gml:pointMember");f=this.buildGeometry.point.apply(this,[c[a]]);b.appendChild(f);d.appendChild(b)}return d},linestring:function(b){var a=this.createElementNS(this.gmlns,"gml:LineString");a.appendChild(this.buildCoordinatesNode(b));return a},multilinestring:function(g){var d=this.createElementNS(this.gmlns,"gml:MultiLineString");var a=g.components;var c,f;for(var b=0;b<a.length;++b){c=this.createElementNS(this.gmlns,"gml:lineStringMember");f=this.buildGeometry.linestring.apply(this,[a[b]]);c.appendChild(f);d.appendChild(c)}return d},linearring:function(b){var a=this.createElementNS(this.gmlns,"gml:LinearRing");a.appendChild(this.buildCoordinatesNode(b));return a},polygon:function(h){var d=this.createElementNS(this.gmlns,"gml:Polygon");var g=h.components;var c,f,b;for(var a=0;a<g.length;++a){b=(a==0)?"outerBoundaryIs":"innerBoundaryIs";c=this.createElementNS(this.gmlns,"gml:"+b);f=this.buildGeometry.linearring.apply(this,[g[a]]);c.appendChild(f);d.appendChild(c)}return d},multipolygon:function(g){var d=this.createElementNS(this.gmlns,"gml:MultiPolygon");var a=g.components;var f,b;for(var c=0;c<a.length;++c){f=this.createElementNS(this.gmlns,"gml:polygonMember");b=this.buildGeometry.polygon.apply(this,[a[c]]);f.appendChild(b);d.appendChild(f)}return d},bounds:function(b){var a=this.createElementNS(this.gmlns,"gml:Box");a.appendChild(this.buildCoordinatesNode(b));return a}},buildCoordinatesNode:function(g){var a=this.createElementNS(this.gmlns,"gml:coordinates");a.setAttribute("decimal",".");a.setAttribute("cs",",");a.setAttribute("ts"," ");var f=[];if(g instanceof OpenLayers.Bounds){f.push(g.left+","+g.bottom);f.push(g.right+","+g.top)}else{var c=(g.components)?g.components:[g];for(var b=0;b<c.length;b++){f.push(c[b].x+","+c[b].y)}}var d=this.createTextNode(f.join(" "));a.appendChild(d);return a},CLASS_NAME:"OpenLayers.Format.GML"});OpenLayers.Format.GeoJSON=OpenLayers.Class(OpenLayers.Format.JSON,{initialize:function(a){OpenLayers.Format.JSON.prototype.initialize.apply(this,[a])},read:function(l,h,a){h=(h)?h:"FeatureCollection";var d=null;var c=null;if(typeof l=="string"){c=OpenLayers.Format.JSON.prototype.read.apply(this,[l,a])}else{c=l}if(!c){OpenLayers.Console.error("Bad JSON: "+l)}else{if(typeof(c.type)!="string"){OpenLayers.Console.error("Bad GeoJSON - no type: "+l)}else{if(this.isValidType(c,h)){switch(h){case"Geometry":try{d=this.parseGeometry(c)}catch(b){OpenLayers.Console.error(b)}break;case"Feature":try{d=this.parseFeature(c);d.type="Feature"}catch(b){OpenLayers.Console.error(b)}break;case"FeatureCollection":d=[];switch(c.type){case"Feature":try{d.push(this.parseFeature(c))}catch(b){d=null;OpenLayers.Console.error(b)}break;case"FeatureCollection":for(var f=0,g=c.features.length;f<g;++f){try{d.push(this.parseFeature(c.features[f]))}catch(b){d=null;OpenLayers.Console.error(b)}}break;default:try{var k=this.parseGeometry(c);d.push(new OpenLayers.Feature.Vector(k))}catch(b){d=null;OpenLayers.Console.error(b)}}break}}}}return d},isValidType:function(c,a){var b=false;switch(a){case"Geometry":if(OpenLayers.Util.indexOf(["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon","Box","GeometryCollection"],c.type)==-1){OpenLayers.Console.error("Unsupported geometry type: "+c.type)}else{b=true}break;case"FeatureCollection":b=true;break;default:if(c.type==a){b=true}else{OpenLayers.Console.error("Cannot convert types from "+c.type+" to "+a)}}return b},parseFeature:function(d){var b,g,a,f;a=(d.properties)?d.properties:{};f=(d.geometry&&d.geometry.bbox)||d.bbox;try{g=this.parseGeometry(d.geometry)}catch(c){throw c}b=new OpenLayers.Feature.Vector(g,a);if(f){b.bounds=OpenLayers.Bounds.fromArray(f)}if(d.id){b.fid=d.id}return b},parseGeometry:function(f){if(f==null){return null}var h,g=false;if(f.type=="GeometryCollection"){if(!(f.geometries instanceof Array)){throw"GeometryCollection must have geometries array: "+f}var b=f.geometries.length;var d=new Array(b);for(var a=0;a<b;++a){d[a]=this.parseGeometry.apply(this,[f.geometries[a]])}h=new OpenLayers.Geometry.Collection(d);g=true}else{if(!(f.coordinates instanceof Array)){throw"Geometry must have coordinates array: "+f}if(!this.parseCoords[f.type.toLowerCase()]){throw"Unsupported geometry type: "+f.type}try{h=this.parseCoords[f.type.toLowerCase()].apply(this,[f.coordinates])}catch(c){throw c}}if(this.internalProjection&&this.externalProjection&&!g){h.transform(this.externalProjection,this.internalProjection)}return h},parseCoords:{point:function(a){if(a.length!=2){throw"Only 2D points are supported: "+a}return new OpenLayers.Geometry.Point(a[0],a[1])},multipoint:function(g){var c=[];var f=null;for(var b=0,a=g.length;b<a;++b){try{f=this.parseCoords.point.apply(this,[g[b]])}catch(d){throw d}c.push(f)}return new OpenLayers.Geometry.MultiPoint(c)},linestring:function(g){var c=[];var f=null;for(var b=0,a=g.length;b<a;++b){try{f=this.parseCoords.point.apply(this,[g[b]])}catch(d){throw d}c.push(f)}return new OpenLayers.Geometry.LineString(c)},multilinestring:function(g){var c=[];var b=null;for(var d=0,a=g.length;d<a;++d){try{b=this.parseCoords.linestring.apply(this,[g[d]])}catch(f){throw f}c.push(b)}return new OpenLayers.Geometry.MultiLineString(c)},polygon:function(h){var g=[];var f,b;for(var c=0,a=h.length;c<a;++c){try{b=this.parseCoords.linestring.apply(this,[h[c]])}catch(d){throw d}f=new OpenLayers.Geometry.LinearRing(b.components);g.push(f)}return new OpenLayers.Geometry.Polygon(g)},multipolygon:function(g){var b=[];var f=null;for(var c=0,a=g.length;c<a;++c){try{f=this.parseCoords.polygon.apply(this,[g[c]])}catch(d){throw d}b.push(f)}return new OpenLayers.Geometry.MultiPolygon(b)},box:function(a){if(a.length!=2){throw"GeoJSON box coordinates must have 2 elements"}return new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(a[0][0],a[0][1]),new OpenLayers.Geometry.Point(a[1][0],a[0][1]),new OpenLayers.Geometry.Point(a[1][0],a[1][1]),new OpenLayers.Geometry.Point(a[0][0],a[1][1]),new OpenLayers.Geometry.Point(a[0][0],a[0][1])])])}},write:function(f,d){var a={type:null};if(f instanceof Array){a.type="FeatureCollection";var h=f.length;a.features=new Array(h);for(var c=0;c<h;++c){var b=f[c];if(!b instanceof OpenLayers.Feature.Vector){var g="FeatureCollection only supports collections of features: "+b;throw g}a.features[c]=this.extract.feature.apply(this,[b])}}else{if(f.CLASS_NAME.indexOf("OpenLayers.Geometry")==0){a=this.extract.geometry.apply(this,[f])}else{if(f instanceof OpenLayers.Feature.Vector){a=this.extract.feature.apply(this,[f]);if(f.layer&&f.layer.projection){a.crs=this.createCRSObject(f)}}}}return OpenLayers.Format.JSON.prototype.write.apply(this,[a,d])},createCRSObject:function(b){var c=b.layer.projection.toString();var a={};if(c.match(/epsg:/i)){var d=parseInt(c.substring(c.indexOf(":")+1));if(d==4326){a={type:"OGC",properties:{urn:"urn:ogc:def:crs:OGC:1.3:CRS84"}}}else{a={type:"EPSG",properties:{code:d}}}}return a},extract:{feature:function(b){var a=this.extract.geometry.apply(this,[b.geometry]);return{type:"Feature",id:b.fid==null?b.id:b.fid,properties:b.attributes,geometry:a}},geometry:function(d){if(d==null){return null}if(this.internalProjection&&this.externalProjection){d=d.clone();d.transform(this.internalProjection,this.externalProjection)}var a=d.CLASS_NAME.split(".")[2];var c=this.extract[a.toLowerCase()].apply(this,[d]);var b;if(a=="Collection"){b={type:"GeometryCollection",geometries:c}}else{b={type:a,coordinates:c}}return b},point:function(a){return[a.x,a.y]},multipoint:function(c){var d=[];for(var b=0,a=c.components.length;b<a;++b){d.push(this.extract.point.apply(this,[c.components[b]]))}return d},linestring:function(b){var d=[];for(var c=0,a=b.components.length;c<a;++c){d.push(this.extract.point.apply(this,[b.components[c]]))}return d},multilinestring:function(c){var d=[];for(var b=0,a=c.components.length;b<a;++b){d.push(this.extract.linestring.apply(this,[c.components[b]]))}return d},polygon:function(c){var d=[];for(var b=0,a=c.components.length;b<a;++b){d.push(this.extract.linestring.apply(this,[c.components[b]]))}return d},multipolygon:function(d){var c=[];for(var b=0,a=d.components.length;b<a;++b){c.push(this.extract.polygon.apply(this,[d.components[b]]))}return c},collection:function(c){var a=c.components.length;var d=new Array(a);for(var b=0;b<a;++b){d[b]=this.extract.geometry.apply(this,[c.components[b]])}return d}},CLASS_NAME:"OpenLayers.Format.GeoJSON"});OpenLayers.Format.ArcXML.Features=OpenLayers.Class(OpenLayers.Format.XML,{initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},read:function(c){var b=new OpenLayers.Format.ArcXML();var a=b.read(c);return a.features.feature}});if(!OpenLayers.Format.GML){OpenLayers.Format.GML={}}OpenLayers.Format.GML.Base=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{gml:"http://www.opengis.net/gml",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance",wfs:"http://www.opengis.net/wfs"},defaultPrefix:"gml",schemaLocation:null,featureType:null,featureNS:null,geometryName:"geometry",extractAttributes:true,srsName:null,xy:true,geometryTypes:null,singleFeatureType:null,regExes:{trimSpace:(/^\s*|\s*$/g),removeSpace:(/\s*/g),splitSpace:(/\s+/),trimComma:(/\s*,\s*/g)},initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a]);this.setGeometryTypes();if(a&&a.featureNS){this.setNamespace("feature",a.featureNS)}this.singleFeatureType=!a||(typeof a.featureType==="string")},read:function(f){if(typeof f=="string"){f=OpenLayers.Format.XML.prototype.read.apply(this,[f])}if(f&&f.nodeType==9){f=f.documentElement}var c=[];this.readNode(f,{features:c});if(c.length==0){var d=this.getElementsByTagNameNS(f,this.namespaces.gml,"featureMember");if(d.length){for(var b=0,a=d.length;b<a;++b){this.readNode(d[b],{features:c})}}else{var d=this.getElementsByTagNameNS(f,this.namespaces.gml,"featureMembers");if(d.length){this.readNode(d[0],{features:c})}}}return c},readers:{gml:{featureMember:function(a,b){this.readChildNodes(a,b)},featureMembers:function(a,b){this.readChildNodes(a,b)},name:function(a,b){b.name=this.getChildValue(a)},boundedBy:function(b,c){var a={};this.readChildNodes(b,a);if(a.components&&a.components.length>0){c.bounds=a.components[0]}},Point:function(b,a){var c={points:[]};this.readChildNodes(b,c);if(!a.components){a.components=[]}a.components.push(c.points[0])},coordinates:function(f,h){var k=this.getChildValue(f).replace(this.regExes.trimSpace,"");k=k.replace(this.regExes.trimComma,",");var a=k.split(this.regExes.splitSpace);var g;var d=a.length;var c=new Array(d);for(var b=0;b<d;++b){g=a[b].split(",");if(this.xy){c[b]=new OpenLayers.Geometry.Point(g[0],g[1],g[2])}else{c[b]=new OpenLayers.Geometry.Point(g[1],g[0],g[2])}}h.points=c},coord:function(a,b){var c={};this.readChildNodes(a,c);if(!b.points){b.points=[]}b.points.push(new OpenLayers.Geometry.Point(c.x,c.y,c.z))},X:function(a,b){b.x=this.getChildValue(a)},Y:function(a,b){b.y=this.getChildValue(a)},Z:function(a,b){b.z=this.getChildValue(a)},MultiPoint:function(b,a){var c={components:[]};this.readChildNodes(b,c);a.components=[new OpenLayers.Geometry.MultiPoint(c.components)]},pointMember:function(a,b){this.readChildNodes(a,b)},LineString:function(b,a){var c={};this.readChildNodes(b,c);if(!a.components){a.components=[]}a.components.push(new OpenLayers.Geometry.LineString(c.points))},MultiLineString:function(b,a){var c={components:[]};this.readChildNodes(b,c);a.components=[new OpenLayers.Geometry.MultiLineString(c.components)]},lineStringMember:function(a,b){this.readChildNodes(a,b)},Polygon:function(b,a){var c={outer:null,inner:[]};this.readChildNodes(b,c);c.inner.unshift(c.outer);if(!a.components){a.components=[]}a.components.push(new OpenLayers.Geometry.Polygon(c.inner))},LinearRing:function(b,c){var a={};this.readChildNodes(b,a);c.components=[new OpenLayers.Geometry.LinearRing(a.points)]},MultiPolygon:function(b,a){var c={components:[]};this.readChildNodes(b,c);a.components=[new OpenLayers.Geometry.MultiPolygon(c.components)]},polygonMember:function(a,b){this.readChildNodes(a,b)},GeometryCollection:function(b,a){var c={components:[]};this.readChildNodes(b,c);a.components=[new OpenLayers.Geometry.Collection(c.components)]},geometryMember:function(a,b){this.readChildNodes(a,b)}},feature:{"*":function(c,d){var a;var b=c.localName||c.nodeName.split(":").pop();if(!this.singleFeatureType&&(OpenLayers.Util.indexOf(this.featureType,b)!=-1)){a="_typeName"}else{if(b==this.featureType){a="_typeName"}else{if(c.childNodes.length==0||(c.childNodes.length==1&&c.firstChild.nodeType==3)){if(this.extractAttributes){a="_attribute"}}else{a="_geometry"}}}if(a){this.readers.feature[a].apply(this,[c,d])}},_typeName:function(c,d){var a={components:[],attributes:{}};this.readChildNodes(c,a);if(a.name){a.attributes.name=a.name}var b=new OpenLayers.Feature.Vector(a.components[0],a.attributes);if(!this.singleFeatureType){b.type=c.nodeName.split(":").pop();b.namespace=c.namespaceURI}var f=c.getAttribute("fid")||this.getAttributeNS(c,this.namespaces.gml,"id");if(f){b.fid=f}if(this.internalProjection&&this.externalProjection&&b.geometry){b.geometry.transform(this.externalProjection,this.internalProjection)}if(a.bounds){b.geometry.bounds=a.bounds}d.features.push(b)},_geometry:function(a,b){this.readChildNodes(a,b)},_attribute:function(b,d){var a=b.localName||b.nodeName.split(":").pop();var c=this.getChildValue(b);d.attributes[a]=c}},wfs:{FeatureCollection:function(a,b){this.readChildNodes(a,b)}}},write:function(c){var b;if(c instanceof Array){b="featureMembers"}else{b="featureMember"}var a=this.writeNode("gml:"+b,c);this.setAttributeNS(a,this.namespaces.xsi,"xsi:schemaLocation",this.schemaLocation);return OpenLayers.Format.XML.prototype.write.apply(this,[a])},writers:{gml:{featureMember:function(a){var b=this.createElementNSPlus("gml:featureMember");this.writeNode("feature:_typeName",a,b);return b},MultiPoint:function(c){var b=this.createElementNSPlus("gml:MultiPoint");for(var a=0;a<c.components.length;++a){this.writeNode("pointMember",c.components[a],b)}return b},pointMember:function(b){var a=this.createElementNSPlus("gml:pointMember");this.writeNode("Point",b,a);return a},MultiLineString:function(c){var b=this.createElementNSPlus("gml:MultiLineString");for(var a=0;a<c.components.length;++a){this.writeNode("lineStringMember",c.components[a],b)}return b},lineStringMember:function(b){var a=this.createElementNSPlus("gml:lineStringMember");this.writeNode("LineString",b,a);return a},MultiPolygon:function(c){var b=this.createElementNSPlus("gml:MultiPolygon");for(var a=0;a<c.components.length;++a){this.writeNode("polygonMember",c.components[a],b)}return b},polygonMember:function(b){var a=this.createElementNSPlus("gml:polygonMember");this.writeNode("Polygon",b,a);return a},GeometryCollection:function(d){var c=this.createElementNSPlus("gml:GeometryCollection");for(var b=0,a=d.components.length;b<a;++b){this.writeNode("geometryMember",d.components[b],c)}return c},geometryMember:function(b){var a=this.createElementNSPlus("gml:geometryMember");var c=this.writeNode("feature:_geometry",b);a.appendChild(c.firstChild);return a}},feature:{_typeName:function(b){var c=this.createElementNSPlus("feature:"+this.featureType,{attributes:{fid:b.fid}});if(b.geometry){this.writeNode("feature:_geometry",b.geometry,c)}for(var a in b.attributes){var d=b.attributes[a];if(d!=null){this.writeNode("feature:_attribute",{name:a,value:d},c)}}return c},_geometry:function(c){if(this.externalProjection&&this.internalProjection){c=c.clone().transform(this.internalProjection,this.externalProjection)}var b=this.createElementNSPlus("feature:"+this.geometryName);var a=this.geometryTypes[c.CLASS_NAME];var d=this.writeNode("gml:"+a,c,b);if(this.srsName){d.setAttribute("srsName",this.srsName)}return b},_attribute:function(a){return this.createElementNSPlus("feature:"+a.name,{value:a.value})}},wfs:{FeatureCollection:function(c){var d=this.createElementNSPlus("wfs:FeatureCollection");for(var b=0,a=c.length;b<a;++b){this.writeNode("gml:featureMember",c[b],d)}return d}}},setGeometryTypes:function(){this.geometryTypes={"OpenLayers.Geometry.Point":"Point","OpenLayers.Geometry.MultiPoint":"MultiPoint","OpenLayers.Geometry.LineString":"LineString","OpenLayers.Geometry.MultiLineString":"MultiLineString","OpenLayers.Geometry.Polygon":"Polygon","OpenLayers.Geometry.MultiPolygon":"MultiPolygon","OpenLayers.Geometry.Collection":"GeometryCollection"}},CLASS_NAME:"OpenLayers.Format.GML.Base"});OpenLayers.Format.WFS=OpenLayers.Class(OpenLayers.Format.GML,{layer:null,wfsns:"http://www.opengis.net/wfs",ogcns:"http://www.opengis.net/ogc",initialize:function(a,b){OpenLayers.Format.GML.prototype.initialize.apply(this,[a]);this.layer=b;if(this.layer.featureNS){this.featureNS=this.layer.featureNS}if(this.layer.options.geometry_column){this.geometryName=this.layer.options.geometry_column}if(this.layer.options.typename){this.featureName=this.layer.options.typename}},write:function(b){var c=this.createElementNS(this.wfsns,"wfs:Transaction");c.setAttribute("version","1.0.0");c.setAttribute("service","WFS");for(var a=0;a<b.length;a++){switch(b[a].state){case OpenLayers.State.INSERT:c.appendChild(this.insert(b[a]));break;case OpenLayers.State.UPDATE:c.appendChild(this.update(b[a]));break;case OpenLayers.State.DELETE:c.appendChild(this.remove(b[a]));break}}return OpenLayers.Format.XML.prototype.write.apply(this,[c])},createFeatureXML:function(g){var c=this.buildGeometryNode(g.geometry);var h=this.createElementNS(this.featureNS,"feature:"+this.geometryName);h.appendChild(c);var b=this.createElementNS(this.featureNS,"feature:"+this.featureName);b.appendChild(h);for(var a in g.attributes){var k=this.createTextNode(g.attributes[a]);var d=a;if(a.search(":")!=-1){d=a.split(":")[1]}var f=this.createElementNS(this.featureNS,"feature:"+d);f.appendChild(k);b.appendChild(f)}return b},insert:function(b){var a=this.createElementNS(this.wfsns,"wfs:Insert");a.appendChild(this.createFeatureXML(b));return a},update:function(o){if(!o.fid){OpenLayers.Console.userError(OpenLayers.i18n("noFID"))}var g=this.createElementNS(this.wfsns,"wfs:Update");g.setAttribute("typeName",this.featurePrefix+":"+this.featureName);g.setAttribute("xmlns:"+this.featurePrefix,this.featureNS);var k=this.createElementNS(this.wfsns,"wfs:Property");var a=this.createElementNS(this.wfsns,"wfs:Name");var c=this.createTextNode(this.geometryName);a.appendChild(c);k.appendChild(a);var l=this.createElementNS(this.wfsns,"wfs:Value");var d=this.buildGeometryNode(o.geometry);if(o.layer){d.setAttribute("srsName",o.layer.projection.getCode())}l.appendChild(d);k.appendChild(l);g.appendChild(k);for(var f in o.attributes){k=this.createElementNS(this.wfsns,"wfs:Property");a=this.createElementNS(this.wfsns,"wfs:Name");a.appendChild(this.createTextNode(f));k.appendChild(a);l=this.createElementNS(this.wfsns,"wfs:Value");l.appendChild(this.createTextNode(o.attributes[f]));k.appendChild(l);g.appendChild(k)}var h=this.createElementNS(this.ogcns,"ogc:Filter");var b=this.createElementNS(this.ogcns,"ogc:FeatureId");b.setAttribute("fid",o.fid);h.appendChild(b);g.appendChild(h);return g},remove:function(b){if(!b.fid){OpenLayers.Console.userError(OpenLayers.i18n("noFID"));return false}var a=this.createElementNS(this.wfsns,"wfs:Delete");a.setAttribute("typeName",this.featurePrefix+":"+this.featureName);a.setAttribute("xmlns:"+this.featurePrefix,this.featureNS);var c=this.createElementNS(this.ogcns,"ogc:Filter");var d=this.createElementNS(this.ogcns,"ogc:FeatureId");d.setAttribute("fid",b.fid);c.appendChild(d);a.appendChild(c);return a},destroy:function(){this.layer=null},CLASS_NAME:"OpenLayers.Format.WFS"});OpenLayers.Layer.ArcIMS=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{ClientVersion:"9.2",ServiceName:""},tileSize:null,featureCoordSys:"4326",filterCoordSys:"4326",layers:null,async:true,name:"ArcIMS",isBaseLayer:true,DEFAULT_OPTIONS:{tileSize:new OpenLayers.Size(512,512),featureCoordSys:"4326",filterCoordSys:"4326",layers:null,isBaseLayer:true,async:true,name:"ArcIMS"},initialize:function(c,b,a){this.tileSize=new OpenLayers.Size(512,512);this.params=OpenLayers.Util.applyDefaults({ServiceName:a.serviceName},this.DEFAULT_PARAMS);this.options=OpenLayers.Util.applyDefaults(a,this.DEFAULT_OPTIONS);OpenLayers.Layer.Grid.prototype.initialize.apply(this,[c,b,this.params,a]);if(this.transparent){if(!this.isBaseLayer){this.isBaseLayer=false}if(this.format=="image/jpeg"){this.format=OpenLayers.Util.alphaHack()?"image/gif":"image/png"}}if(this.options.layers===null){this.options.layers=[]}},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments)},getURL:function(d){var a="";d=this.adjustBounds(d);var c=new OpenLayers.Format.ArcXML(OpenLayers.Util.extend(this.options,{requesttype:"image",envelope:d.toArray(),tileSize:this.tileSize}));var b=new OpenLayers.Request.POST({url:this.getFullRequestString(),data:c.write(),async:false});if(b!=null){var g=b.responseXML;if(!g||!g.documentElement){g=b.responseText}var f=new OpenLayers.Format.ArcXML();var h=f.read(g);a=this.getUrlOrImage(h.image.output)}return a},getURLasync:function(c,a,f,d){c=this.adjustBounds(c);var b=new OpenLayers.Format.ArcXML(OpenLayers.Util.extend(this.options,{requesttype:"image",envelope:c.toArray(),tileSize:this.tileSize}));OpenLayers.Request.POST({url:this.getFullRequestString(),async:true,data:b.write(),callback:function(g){var k=g.responseXML;if(!k||!k.documentElement){k=g.responseText}var h=new OpenLayers.Format.ArcXML();var l=h.read(k);a[f]=this.getUrlOrImage(l.image.output);d.apply(a)},scope:this})},getUrlOrImage:function(a){var b="";if(a.url){b=a.url}else{if(a.data){b="data:image/"+a.type+";base64,"+a.data}}return b},setLayerQuery:function(c,a){for(var b=0;b<this.options.layers.length;b++){if(c==this.options.layers[b].id){this.options.layers[b].query=a;return}}this.options.layers.push({id:c,visible:true,query:a})},getFeatureInfo:function(k,g,p){var b=p.buffer||1;var l=p.callback||function(){};var o=p.scope||window;var a={};OpenLayers.Util.extend(a,this.options);a.requesttype="feature";if(k instanceof OpenLayers.LonLat){a.polygon=null;a.envelope=[k.lon-b,k.lat-b,k.lon+b,k.lat+b]}else{if(k instanceof OpenLayers.Geometry.Polygon){a.envelope=null;a.polygon=k}}var f=new OpenLayers.Format.ArcXML(a);OpenLayers.Util.extend(f.request.get_feature,p);f.request.get_feature.layer=g.id;if(typeof g.query.accuracy=="number"){f.request.get_feature.query.accuracy=g.query.accuracy}else{var h=this.map.getCenter();var d=this.map.getViewPortPxFromLonLat(h);d.x++;var c=this.map.getLonLatFromPixel(d);f.request.get_feature.query.accuracy=c.lon-h.lon}f.request.get_feature.query.where=g.query.where;f.request.get_feature.query.spatialfilter.relation="area_intersection";OpenLayers.Request.POST({url:this.getFullRequestString({CustomService:"Query"}),data:f.write(),callback:function(r){var q=f.parseResponse(r.responseText);if(!f.iserror()){l.call(o,q.features)}else{l.call(o,null)}}})},addTile:function(b,a){return new OpenLayers.Tile.Image(this,a,b,null,this.tileSize)},CLASS_NAME:"OpenLayers.Layer.ArcIMS"});OpenLayers.Format.GML.v2=OpenLayers.Class(OpenLayers.Format.GML.Base,{schemaLocation:"http://www.opengis.net/gml http://schemas.opengis.net/gml/2.1.2/feature.xsd",initialize:function(a){OpenLayers.Format.GML.Base.prototype.initialize.apply(this,[a])},readers:{gml:OpenLayers.Util.applyDefaults({outerBoundaryIs:function(b,a){var c={};this.readChildNodes(b,c);a.outer=c.components[0]},innerBoundaryIs:function(b,a){var c={};this.readChildNodes(b,c);a.inner.push(c.components[0])},Box:function(d,b){var f={};this.readChildNodes(d,f);if(!b.components){b.components=[]}var c=f.points[0];var a=f.points[1];b.components.push(new OpenLayers.Bounds(c.x,c.y,a.x,a.y))}},OpenLayers.Format.GML.Base.prototype.readers.gml),feature:OpenLayers.Format.GML.Base.prototype.readers.feature,wfs:OpenLayers.Format.GML.Base.prototype.readers.wfs},write:function(c){var b;if(c instanceof Array){b="wfs:FeatureCollection"}else{b="gml:featureMember"}var a=this.writeNode(b,c);this.setAttributeNS(a,this.namespaces.xsi,"xsi:schemaLocation",this.schemaLocation);return OpenLayers.Format.XML.prototype.write.apply(this,[a])},writers:{gml:OpenLayers.Util.applyDefaults({Point:function(b){var a=this.createElementNSPlus("gml:Point");this.writeNode("coordinates",[b],a);return a},coordinates:function(d){var c=d.length;var f=new Array(c);var a;for(var b=0;b<c;++b){a=d[b];if(this.xy){f[b]=a.x+","+a.y}else{f[b]=a.y+","+a.x}if(a.z!=undefined){f[b]+=","+a.z}}return this.createElementNSPlus("gml:coordinates",{attributes:{decimal:".",cs:",",ts:" "},value:(c==1)?f[0]:f.join(" ")})},LineString:function(b){var a=this.createElementNSPlus("gml:LineString");this.writeNode("coordinates",b.components,a);return a},Polygon:function(c){var b=this.createElementNSPlus("gml:Polygon");this.writeNode("outerBoundaryIs",c.components[0],b);for(var a=1;a<c.components.length;++a){this.writeNode("innerBoundaryIs",c.components[a],b)}return b},outerBoundaryIs:function(a){var b=this.createElementNSPlus("gml:outerBoundaryIs");this.writeNode("LinearRing",a,b);return b},innerBoundaryIs:function(a){var b=this.createElementNSPlus("gml:innerBoundaryIs");this.writeNode("LinearRing",a,b);return b},LinearRing:function(a){var b=this.createElementNSPlus("gml:LinearRing");this.writeNode("coordinates",a.components,b);return b},Box:function(b){var a=this.createElementNSPlus("gml:Box");this.writeNode("coordinates",[{x:b.left,y:b.bottom},{x:b.right,y:b.top}],a);if(this.srsName){a.setAttribute("srsName",this.srsName)}return a}},OpenLayers.Format.GML.Base.prototype.writers.gml),feature:OpenLayers.Format.GML.Base.prototype.writers.feature,wfs:OpenLayers.Format.GML.Base.prototype.writers.wfs},CLASS_NAME:"OpenLayers.Format.GML.v2"});OpenLayers.Format.GML.v3=OpenLayers.Class(OpenLayers.Format.GML.Base,{schemaLocation:"http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd",curve:false,multiCurve:true,surface:false,multiSurface:true,initialize:function(a){OpenLayers.Format.GML.Base.prototype.initialize.apply(this,[a])},readers:{gml:OpenLayers.Util.applyDefaults({featureMembers:function(a,b){this.readChildNodes(a,b)},Curve:function(b,a){var c={points:[]};this.readChildNodes(b,c);if(!a.components){a.components=[]}a.components.push(new OpenLayers.Geometry.LineString(c.points))},segments:function(a,b){this.readChildNodes(a,b)},LineStringSegment:function(b,a){var c={};this.readChildNodes(b,c);if(c.points){Array.prototype.push.apply(a.points,c.points)}},pos:function(b,d){var f=this.getChildValue(b).replace(this.regExes.trimSpace,"");var c=f.split(this.regExes.splitSpace);var a;if(this.xy){a=new OpenLayers.Geometry.Point(c[0],c[1],c[2])}else{a=new OpenLayers.Geometry.Point(c[1],c[0],c[2])}d.points=[a]},posList:function(a,d){var k=this.getChildValue(a).replace(this.regExes.trimSpace,"");var p=k.split(this.regExes.splitSpace);var f=parseInt(a.getAttribute("dimension"))||2;var b,q,o,h;var l=p.length/f;var r=new Array(l);for(var c=0,g=p.length;c<g;c+=f){q=p[c];o=p[c+1];h=(f==2)?undefined:p[c+2];if(this.xy){r[c/f]=new OpenLayers.Geometry.Point(q,o,h)}else{r[c/f]=new OpenLayers.Geometry.Point(o,q,h)}}d.points=r},Surface:function(a,b){this.readChildNodes(a,b)},patches:function(a,b){this.readChildNodes(a,b)},PolygonPatch:function(a,b){this.readers.gml.Polygon.apply(this,[a,b])},exterior:function(b,a){var c={};this.readChildNodes(b,c);a.outer=c.components[0]},interior:function(b,a){var c={};this.readChildNodes(b,c);a.inner.push(c.components[0])},MultiCurve:function(b,a){var c={components:[]};this.readChildNodes(b,c);if(c.components.length>0){a.components=[new OpenLayers.Geometry.MultiLineString(c.components)]}},curveMember:function(a,b){this.readChildNodes(a,b)},MultiSurface:function(b,a){var c={components:[]};this.readChildNodes(b,c);if(c.components.length>0){a.components=[new OpenLayers.Geometry.MultiPolygon(c.components)]}},surfaceMember:function(a,b){this.readChildNodes(a,b)},surfaceMembers:function(a,b){this.readChildNodes(a,b)},pointMembers:function(a,b){this.readChildNodes(a,b)},lineStringMembers:function(a,b){this.readChildNodes(a,b)},polygonMembers:function(a,b){this.readChildNodes(a,b)},geometryMembers:function(a,b){this.readChildNodes(a,b)},Envelope:function(d,b){var f={points:new Array(2)};this.readChildNodes(d,f);if(!b.components){b.components=[]}var c=f.points[0];var a=f.points[1];b.components.push(new OpenLayers.Bounds(c.x,c.y,a.x,a.y))},lowerCorner:function(b,a){var c={};this.readers.gml.pos.apply(this,[b,c]);a.points[0]=c.points[0]},upperCorner:function(b,a){var c={};this.readers.gml.pos.apply(this,[b,c]);a.points[1]=c.points[0]}},OpenLayers.Format.GML.Base.prototype.readers.gml),feature:OpenLayers.Format.GML.Base.prototype.readers.feature,wfs:OpenLayers.Format.GML.Base.prototype.readers.wfs},write:function(c){var b;if(c instanceof Array){b="featureMembers"}else{b="featureMember"}var a=this.writeNode("gml:"+b,c);this.setAttributeNS(a,this.namespaces.xsi,"xsi:schemaLocation",this.schemaLocation);return OpenLayers.Format.XML.prototype.write.apply(this,[a])},writers:{gml:OpenLayers.Util.applyDefaults({featureMembers:function(c){var d=this.createElementNSPlus("gml:featureMembers");for(var b=0,a=c.length;b<a;++b){this.writeNode("feature:_typeName",c[b],d)}return d},Point:function(b){var a=this.createElementNSPlus("gml:Point");this.writeNode("pos",b,a);return a},pos:function(a){var b=(this.xy)?(a.x+" "+a.y):(a.y+" "+a.x);return this.createElementNSPlus("gml:pos",{value:b})},LineString:function(b){var a=this.createElementNSPlus("gml:LineString");this.writeNode("posList",b.components,a);return a},Curve:function(b){var a=this.createElementNSPlus("gml:Curve");this.writeNode("segments",b,a);return a},segments:function(b){var a=this.createElementNSPlus("gml:segments");this.writeNode("LineStringSegment",b,a);return a},LineStringSegment:function(b){var a=this.createElementNSPlus("gml:LineStringSegment");this.writeNode("posList",b.components,a);return a},posList:function(d){var b=d.length;var f=new Array(b);var a;for(var c=0;c<b;++c){a=d[c];if(this.xy){f[c]=a.x+" "+a.y}else{f[c]=a.y+" "+a.x}}return this.createElementNSPlus("gml:posList",{value:f.join(" ")})},Surface:function(b){var a=this.createElementNSPlus("gml:Surface");this.writeNode("patches",b,a);return a},patches:function(b){var a=this.createElementNSPlus("gml:patches");this.writeNode("PolygonPatch",b,a);return a},PolygonPatch:function(d){var c=this.createElementNSPlus("gml:PolygonPatch",{attributes:{interpolation:"planar"}});this.writeNode("exterior",d.components[0],c);for(var b=1,a=d.components.length;b<a;++b){this.writeNode("interior",d.components[b],c)}return c},Polygon:function(d){var c=this.createElementNSPlus("gml:Polygon");this.writeNode("exterior",d.components[0],c);for(var b=1,a=d.components.length;b<a;++b){this.writeNode("interior",d.components[b],c)}return c},exterior:function(a){var b=this.createElementNSPlus("gml:exterior");this.writeNode("LinearRing",a,b);return b},interior:function(a){var b=this.createElementNSPlus("gml:interior");this.writeNode("LinearRing",a,b);return b},LinearRing:function(a){var b=this.createElementNSPlus("gml:LinearRing");this.writeNode("posList",a.components,b);return b},MultiCurve:function(d){var c=this.createElementNSPlus("gml:MultiCurve");for(var b=0,a=d.components.length;b<a;++b){this.writeNode("curveMember",d.components[b],c)}return c},curveMember:function(b){var a=this.createElementNSPlus("gml:curveMember");if(this.curve){this.writeNode("Curve",b,a)}else{this.writeNode("LineString",b,a)}return a},MultiSurface:function(d){var c=this.createElementNSPlus("gml:MultiSurface");for(var b=0,a=d.components.length;b<a;++b){this.writeNode("surfaceMember",d.components[b],c)}return c},surfaceMember:function(a){var b=this.createElementNSPlus("gml:surfaceMember");if(this.surface){this.writeNode("Surface",a,b)}else{this.writeNode("Polygon",a,b)}return b},Envelope:function(b){var a=this.createElementNSPlus("gml:Envelope");this.writeNode("lowerCorner",b,a);this.writeNode("upperCorner",b,a);if(this.srsName){a.setAttribute("srsName",this.srsName)}return a},lowerCorner:function(a){var b=(this.xy)?(a.left+" "+a.bottom):(a.bottom+" "+a.left);return this.createElementNSPlus("gml:lowerCorner",{value:b})},upperCorner:function(a){var b=(this.xy)?(a.right+" "+a.top):(a.top+" "+a.right);return this.createElementNSPlus("gml:upperCorner",{value:b})}},OpenLayers.Format.GML.Base.prototype.writers.gml),feature:OpenLayers.Format.GML.Base.prototype.writers.feature,wfs:OpenLayers.Format.GML.Base.prototype.writers.wfs},setGeometryTypes:function(){this.geometryTypes={"OpenLayers.Geometry.Point":"Point","OpenLayers.Geometry.MultiPoint":"MultiPoint","OpenLayers.Geometry.LineString":(this.curve===true)?"Curve":"LineString","OpenLayers.Geometry.MultiLineString":(this.multiCurve===false)?"MultiLineString":"MultiCurve","OpenLayers.Geometry.Polygon":(this.surface===true)?"Surface":"Polygon","OpenLayers.Geometry.MultiPolygon":(this.multiSurface===false)?"MultiPolygon":"MultiSurface","OpenLayers.Geometry.Collection":"GeometryCollection"}},CLASS_NAME:"OpenLayers.Format.GML.v3"});OpenLayers.Format.Filter.v1_0_0=OpenLayers.Class(OpenLayers.Format.GML.v2,OpenLayers.Format.Filter.v1,{VERSION:"1.0.0",schemaLocation:"http://www.opengis.net/ogc/filter/1.0.0/filter.xsd",initialize:function(a){OpenLayers.Format.GML.v2.prototype.initialize.apply(this,[a])},readers:{ogc:OpenLayers.Util.applyDefaults({PropertyIsEqualTo:function(b,c){var a=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.EQUAL_TO});this.readChildNodes(b,a);c.filters.push(a)},PropertyIsNotEqualTo:function(b,c){var a=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.NOT_EQUAL_TO});this.readChildNodes(b,a);c.filters.push(a)}},OpenLayers.Format.Filter.v1.prototype.readers.ogc),gml:OpenLayers.Format.GML.v2.prototype.readers.gml,feature:OpenLayers.Format.GML.v2.prototype.readers.feature},writers:{ogc:OpenLayers.Util.applyDefaults({PropertyIsEqualTo:function(a){var b=this.createElementNSPlus("ogc:PropertyIsEqualTo");this.writeNode("PropertyName",a,b);this.writeNode("Literal",a.value,b);return b},PropertyIsNotEqualTo:function(a){var b=this.createElementNSPlus("ogc:PropertyIsNotEqualTo");this.writeNode("PropertyName",a,b);this.writeNode("Literal",a.value,b);return b},BBOX:function(a){var c=this.createElementNSPlus("ogc:BBOX");this.writeNode("PropertyName",a,c);var b=this.writeNode("gml:Box",a.value,c);if(a.projection){b.setAttribute("srsName",a.projection)}return c}},OpenLayers.Format.Filter.v1.prototype.writers.ogc),gml:OpenLayers.Format.GML.v2.prototype.writers.gml,feature:OpenLayers.Format.GML.v2.prototype.writers.feature},writeSpatial:function(b,a){var c=this.createElementNSPlus("ogc:"+a);this.writeNode("PropertyName",b,c);var d;if(b.value instanceof OpenLayers.Geometry){d=this.writeNode("feature:_geometry",b.value).firstChild}else{d=this.writeNode("gml:Box",b.value)}if(b.projection){d.setAttribute("srsName",b.projection)}c.appendChild(d);return c},CLASS_NAME:"OpenLayers.Format.Filter.v1_0_0"});OpenLayers.Format.Filter.v1_1_0=OpenLayers.Class(OpenLayers.Format.GML.v3,OpenLayers.Format.Filter.v1,{VERSION:"1.1.0",schemaLocation:"http://www.opengis.net/ogc/filter/1.1.0/filter.xsd",initialize:function(a){OpenLayers.Format.GML.v3.prototype.initialize.apply(this,[a])},readers:{ogc:OpenLayers.Util.applyDefaults({PropertyIsEqualTo:function(b,d){var c=b.getAttribute("matchCase");var a=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.EQUAL_TO,matchCase:!(c==="false"||c==="0")});this.readChildNodes(b,a);d.filters.push(a)},PropertyIsNotEqualTo:function(b,d){var c=b.getAttribute("matchCase");var a=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.NOT_EQUAL_TO,matchCase:!(c==="false"||c==="0")});this.readChildNodes(b,a);d.filters.push(a)}},OpenLayers.Format.Filter.v1.prototype.readers.ogc),gml:OpenLayers.Format.GML.v3.prototype.readers.gml,feature:OpenLayers.Format.GML.v3.prototype.readers.feature},writers:{ogc:OpenLayers.Util.applyDefaults({PropertyIsEqualTo:function(a){var b=this.createElementNSPlus("ogc:PropertyIsEqualTo",{attributes:{matchCase:a.matchCase}});this.writeNode("PropertyName",a,b);this.writeNode("Literal",a.value,b);return b},PropertyIsNotEqualTo:function(a){var b=this.createElementNSPlus("ogc:PropertyIsNotEqualTo",{attributes:{matchCase:a.matchCase}});this.writeNode("PropertyName",a,b);this.writeNode("Literal",a.value,b);return b},BBOX:function(a){var c=this.createElementNSPlus("ogc:BBOX");this.writeNode("PropertyName",a,c);var b=this.writeNode("gml:Envelope",a.value);if(a.projection){b.setAttribute("srsName",a.projection)}c.appendChild(b);return c}},OpenLayers.Format.Filter.v1.prototype.writers.ogc),gml:OpenLayers.Format.GML.v3.prototype.writers.gml,feature:OpenLayers.Format.GML.v3.prototype.writers.feature},writeSpatial:function(b,a){var c=this.createElementNSPlus("ogc:"+a);this.writeNode("PropertyName",b,c);var d;if(b.value instanceof OpenLayers.Geometry){d=this.writeNode("feature:_geometry",b.value).firstChild}else{d=this.writeNode("gml:Envelope",b.value)}if(b.projection){d.setAttribute("srsName",b.projection)}c.appendChild(d);return c},CLASS_NAME:"OpenLayers.Format.Filter.v1_1_0"});OpenLayers.Format.WFST.v1_0_0=OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0,OpenLayers.Format.WFST.v1,{version:"1.0.0",schemaLocations:{wfs:"http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd"},initialize:function(a){OpenLayers.Format.Filter.v1_0_0.prototype.initialize.apply(this,[a]);OpenLayers.Format.WFST.v1.prototype.initialize.apply(this,[a])},readers:{wfs:OpenLayers.Util.applyDefaults({WFS_TransactionResponse:function(a,b){b.insertIds=[];b.success=false;this.readChildNodes(a,b)},InsertResult:function(b,a){var c={fids:[]};this.readChildNodes(b,c);a.insertIds.push(c.fids[0])},TransactionResult:function(a,b){this.readChildNodes(a,b)},Status:function(a,b){this.readChildNodes(a,b)},SUCCESS:function(a,b){b.success=true}},OpenLayers.Format.WFST.v1.prototype.readers.wfs),gml:OpenLayers.Format.GML.v2.prototype.readers.gml,feature:OpenLayers.Format.GML.v2.prototype.readers.feature,ogc:OpenLayers.Format.Filter.v1_0_0.prototype.readers.ogc},writers:{wfs:OpenLayers.Util.applyDefaults({Query:function(b){b=OpenLayers.Util.extend({featureNS:this.featureNS,featurePrefix:this.featurePrefix,featureType:this.featureType,srsName:this.srsName},b);var d=this.createElementNSPlus("wfs:Query",{attributes:{typeName:(b.featureNS?b.featurePrefix+":":"")+b.featureType}});if(b.featureNS){d.setAttribute("xmlns:"+b.featurePrefix,b.featureNS)}if(b.propertyNames){for(var c=0,a=b.propertyNames.length;c<a;c++){this.writeNode("ogc:PropertyName",{property:b.propertyNames[c]},d)}}if(b.filter){this.setFilterProperty(b.filter);this.writeNode("ogc:Filter",b.filter,d)}return d}},OpenLayers.Format.WFST.v1.prototype.writers.wfs),gml:OpenLayers.Format.GML.v2.prototype.writers.gml,feature:OpenLayers.Format.GML.v2.prototype.writers.feature,ogc:OpenLayers.Format.Filter.v1_0_0.prototype.writers.ogc},CLASS_NAME:"OpenLayers.Format.WFST.v1_0_0"});OpenLayers.Format.WFST.v1_1_0=OpenLayers.Class(OpenLayers.Format.Filter.v1_1_0,OpenLayers.Format.WFST.v1,{version:"1.1.0",schemaLocations:{wfs:"http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"},initialize:function(a){OpenLayers.Format.Filter.v1_1_0.prototype.initialize.apply(this,[a]);OpenLayers.Format.WFST.v1.prototype.initialize.apply(this,[a])},readers:{wfs:OpenLayers.Util.applyDefaults({TransactionResponse:function(a,b){b.insertIds=[];b.success=false;this.readChildNodes(a,b)},TransactionSummary:function(a,b){b.success=true},InsertResults:function(a,b){this.readChildNodes(a,b)},Feature:function(b,a){var c={fids:[]};this.readChildNodes(b,c);a.insertIds.push(c.fids[0])}},OpenLayers.Format.WFST.v1.prototype.readers.wfs),gml:OpenLayers.Format.GML.v3.prototype.readers.gml,feature:OpenLayers.Format.GML.v3.prototype.readers.feature,ogc:OpenLayers.Format.Filter.v1_1_0.prototype.readers.ogc},writers:{wfs:OpenLayers.Util.applyDefaults({Query:function(b){b=OpenLayers.Util.extend({featureNS:this.featureNS,featurePrefix:this.featurePrefix,featureType:this.featureType,srsName:this.srsName},b);var d=this.createElementNSPlus("wfs:Query",{attributes:{typeName:(b.featureNS?b.featurePrefix+":":"")+b.featureType,srsName:b.srsName}});if(b.featureNS){d.setAttribute("xmlns:"+b.featurePrefix,b.featureNS)}if(b.propertyNames){for(var c=0,a=b.propertyNames.length;c<a;c++){this.writeNode("wfs:PropertyName",{property:b.propertyNames[c]},d)}}if(b.filter){this.setFilterProperty(b.filter);this.writeNode("ogc:Filter",b.filter,d)}return d},PropertyName:function(a){return this.createElementNSPlus("wfs:PropertyName",{value:a.property})}},OpenLayers.Format.WFST.v1.prototype.writers.wfs),gml:OpenLayers.Format.GML.v3.prototype.writers.gml,feature:OpenLayers.Format.GML.v3.prototype.writers.feature,ogc:OpenLayers.Format.Filter.v1_1_0.prototype.writers.ogc},CLASS_NAME:"OpenLayers.Format.WFST.v1_1_0"});OpenLayers.Protocol.WFS.v1_0_0=OpenLayers.Class(OpenLayers.Protocol.WFS.v1,{version:"1.0.0",CLASS_NAME:"OpenLayers.Protocol.WFS.v1_0_0"});OpenLayers.Protocol.WFS.v1_1_0=OpenLayers.Class(OpenLayers.Protocol.WFS.v1,{version:"1.1.0",CLASS_NAME:"OpenLayers.Protocol.WFS.v1_1_0"});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={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\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(d){var b=function(s){return s!==undefined&&s!==null};var r=function(u,s,t){b(u)&&u.apply(s,t)};var f=function(s){setTimeout(s,0)};var g="";var a="&";var p="?";var q="success";var h="error";var l=d("head");var k={};var c={cache:true,callback:"C",pageCache:false,url:location.href};var o=function(B){B=d.extend({},c,B);var z=B.beforeSend;var s=B.abort;var I=0;var A=0;B.abort=function(){if(A===0&&b(s)){s(B)}A=1;I=1};if(b(z)&&(z(B,B)===false||I)){return B}var w=B.success;var u=B.complete;var D=B.error;var L=B.dataFilter;var Q=B.callbackParameter;var E=B.callback;var M=B.cache;var t=B.pageCache;var C=B.url;var R=B.data;var F=B.timeout;var H,P,O,N;var C=b(C)?C:g;if(b(R)){R=(typeof R=="string")?R:d.param(R)}else{R=g}if(b(Q)){R+=(R==g?g:a)+encodeURIComponent(Q)+"=?"}if(!M&&!t){R+=(R==g?g:a)+"_"+(new Date()).getTime()+"="}H=C.split(p);if(R!=g){P=R.split(p);N=H.length-1;if(N){H[N]+=a+P.shift()}H=H.concat(P)}O=H.length-2;if(O>0){H[O]+=E+H.pop()}var v=H.join(p);var K=function(S){if(b(L)){S=L.apply(B,[S])}r(w,B,[S,q]);r(u,B,[B,q])};var G=function(S){r(D,B,[B,S]);r(u,B,[B,S])};var J=k[v];if(t&&b(J)){f(function(){b(J.s)?K(J.s):G(h)});return B}f(function(){if(I){return}var S=d("<iframe style='display:none' />").appendTo(l);var U=S[0];var W=U.contentWindow||U.contentDocument;var Y=W.document;var T;var Z;var ab=function(ac,ad){t&&!b(ad)&&(k[v]=g);T();G(b(ad)?ad:h)};var V=function(ad){W[ad]=undefined;try{delete W[ad]}catch(ac){}};var X=(E=="E")?"X":"E";if(!b(Y)){Y=W;W=Y.getParentNode()}Y.open();W[E]=function(ac){I=1;t&&(k[v]={s:ac});f(function(){if(A===0){T();K(ac)}})};W[X]=function(ac){if((!ac||ac=="complete")&&I===0){I++;f(ab)}};T=function(){A=1;clearTimeout(Z);V(X);V(E);if(Y&&Y.getElementsByTagName){var ac=Y.getElementsByTagName("body");if(ac&&ac.length>0){ac[0].innerHTML=g}var af=Y.getElementsByTagName("head");if(af&&af.length>0){af=af[0];try{af.innerHTML=g}catch(ag){var ae=af.childNodes;var ai;for(var ad=0,ah=ae.length;ad<ah;++ad){ai=ae[ad];try{if(ai.nodeName&&ai.nodeName.toLowerCase()==="title"){continue}af.removeChild(ai)}catch(ag){}}}}}S.remove()};var aa=B.abort;B.abort=function(){aa();T()};Y.write(["<html>","<head>",'<script src="',v,'" onload="if(typeof ',X,"==='function'){",X,'();}" onreadystatechange="if(typeof ',X,"==='function'){",X,'(this.readyState);}"><\/script>',"</head>",'<body onload="if(typeof ',X,"==='function'){",X,'();}"></body>',"</html>"].join(g));Y.close();if(F>0){Z=setTimeout(function(){!I&&ab(g,"timeout")},F)}});return B};o.setup=function(s){d.extend(c,s)};d.jsonp=o})(jQuery);(function(a){a.fn.caret=function(r,l){var b,f,p=this[0];if(typeof r==="object"&&typeof r.start==="number"&&typeof r.end==="number"){b=r.start;f=r.end}else{if(typeof r==="number"&&typeof l==="number"){b=r;f=l}else{if(typeof r==="string"){if((b=p.value.indexOf(r))>-1){f=b+r.length}else{b=null}}else{if(Object.prototype.toString.call(r)==="[object RegExp]"){var o=r.exec(p.value);if(o!=null){b=o.index;f=b+o[0].length}}}}}if(typeof b!="undefined"){if(a.browser.msie){var h=this[0].createTextRange();h.collapse(true);h.moveStart("character",b);h.moveEnd("character",f-b);h.select()}else{this[0].selectionStart=b;this[0].selectionEnd=f}this[0].focus();return this}else{if(a.browser.msie){var c=this.val();var g=document.selection.createRange().duplicate();g.moveEnd("character",c.length);var q=(g.text==""?c.length:c.lastIndexOf(g.text));g=document.selection.createRange().duplicate();g.moveStart("character",-c.length);var k=g.text.length}else{var q=p.selectionStart,k=p.selectionEnd}var d=p.value.substring(q,k);return{start:q,end:k,text:d,replace:function(s){return p.value.substring(0,q)+s+p.value.substring(k,p.value.length)}}}return this}})(jQuery);function NumberFormat(a,b){this.VERSION="Number Format v1.5.4";this.COMMA=",";this.PERIOD=".";this.DASH="-";this.LEFT_PAREN="(";this.RIGHT_PAREN=")";this.LEFT_OUTSIDE=0;this.LEFT_INSIDE=1;this.RIGHT_INSIDE=2;this.RIGHT_OUTSIDE=3;this.LEFT_DASH=0;this.RIGHT_DASH=1;this.PARENTHESIS=2;this.NO_ROUNDING=-1;this.num=undefined;this.numOriginal=undefined;this.hasSeparators=false;this.separatorValue=undefined;this.inputDecimalValue=undefined;this.decimalValue=undefined;this.negativeFormat=undefined;this.negativeRed=undefined;this.hasCurrency=undefined;this.currencyPosition=undefined;this.currencyValue=undefined;this.places=undefined;this.roundToPlaces=undefined;this.truncate=undefined;this.setNumber=setNumberNF;this.toUnformatted=toUnformattedNF;this.setInputDecimal=setInputDecimalNF;this.setSeparators=setSeparatorsNF;this.setCommas=setCommasNF;this.setNegativeFormat=setNegativeFormatNF;this.setNegativeRed=setNegativeRedNF;this.setCurrency=setCurrencyNF;this.setCurrencyPrefix=setCurrencyPrefixNF;this.setCurrencyValue=setCurrencyValueNF;this.setCurrencyPosition=setCurrencyPositionNF;this.setPlaces=setPlacesNF;this.toFormatted=toFormattedNF;this.toPercentage=toPercentageNF;this.getOriginal=getOriginalNF;this.moveDecimalRight=moveDecimalRightNF;this.moveDecimalLeft=moveDecimalLeftNF;this.getRounded=getRoundedNF;this.preserveZeros=preserveZerosNF;this.justNumber=justNumberNF;this.expandExponential=expandExponentialNF;this.getZeros=getZerosNF;this.moveDecimalAsString=moveDecimalAsStringNF;this.moveDecimal=moveDecimalNF;this.addSeparators=addSeparatorsNF;if(!b){this.setNumber(a,this.PERIOD)}else{this.setNumber(a,b)}this.setCommas(true);this.setNegativeFormat(this.LEFT_DASH);this.setNegativeRed(false);this.setCurrency(false);this.setCurrencyPrefix("$");this.setPlaces(2)}function setInputDecimalNF(a){this.inputDecimalValue=a}function setNumberNF(a,b){if(b){this.setInputDecimal(b)}this.numOriginal=a;this.num=this.justNumber(a)}function toUnformattedNF(){return(this.num)}function getOriginalNF(){return(this.numOriginal)}function setNegativeFormatNF(a){this.negativeFormat=a}function setNegativeRedNF(a){this.negativeRed=a}function setSeparatorsNF(b,c,a){this.hasSeparators=b;if(!c){c=this.COMMA}if(!a){a=this.PERIOD}if(c==a){this.decimalValue=(a==this.PERIOD)?this.COMMA:this.PERIOD}else{this.decimalValue=a}this.separatorValue=c}function setCommasNF(a){this.setSeparators(a,this.COMMA,this.PERIOD)}function setCurrencyNF(a){this.hasCurrency=a}function setCurrencyValueNF(a){this.currencyValue=a}function setCurrencyPrefixNF(a){this.setCurrencyValue(a);this.setCurrencyPosition(this.LEFT_OUTSIDE)}function setCurrencyPositionNF(a){this.currencyPosition=a}function setPlacesNF(b,a){this.roundToPlaces=!(b==this.NO_ROUNDING);this.truncate=!!a;this.places=(b<0)?0:b}function addSeparatorsNF(d,f,a,c){d+="";var g=d.indexOf(f);var h="";if(g!=-1){h=a+d.substring(g+1,d.length);d=d.substring(0,g)}var b=/(\d+)(\d{3})/;while(b.test(d)){d=d.replace(b,"$1"+c+"$2")}return d+h}function toFormattedNF(){var q;var r=this.num;var a;var b=[undefined,undefined];if(this.roundToPlaces){r=this.getRounded(r);a=this.preserveZeros(Math.abs(r))}else{a=this.expandExponential(Math.abs(r))}if(this.hasSeparators){a=this.addSeparators(a,this.PERIOD,this.decimalValue,this.separatorValue)}else{a=a.replace(new RegExp("\\"+this.PERIOD),this.decimalValue)}var g="";var p="";var f="";var o="";var k="";var d="";var h="";var c="";var s=(this.negativeFormat==this.PARENTHESIS)?this.LEFT_PAREN:this.DASH;var l=(this.negativeFormat==this.PARENTHESIS)?this.RIGHT_PAREN:this.DASH;if(this.currencyPosition==this.LEFT_OUTSIDE){if(r<0){if(this.negativeFormat==this.LEFT_DASH||this.negativeFormat==this.PARENTHESIS){o=s}if(this.negativeFormat==this.RIGHT_DASH||this.negativeFormat==this.PARENTHESIS){k=l}}if(this.hasCurrency){g=this.currencyValue}}else{if(this.currencyPosition==this.LEFT_INSIDE){if(r<0){if(this.negativeFormat==this.LEFT_DASH||this.negativeFormat==this.PARENTHESIS){p=s}if(this.negativeFormat==this.RIGHT_DASH||this.negativeFormat==this.PARENTHESIS){h=l}}if(this.hasCurrency){f=this.currencyValue}}else{if(this.currencyPosition==this.RIGHT_INSIDE){if(r<0){if(this.negativeFormat==this.LEFT_DASH||this.negativeFormat==this.PARENTHESIS){p=s}if(this.negativeFormat==this.RIGHT_DASH||this.negativeFormat==this.PARENTHESIS){h=l}}if(this.hasCurrency){d=this.currencyValue}}else{if(this.currencyPosition==this.RIGHT_OUTSIDE){if(r<0){if(this.negativeFormat==this.LEFT_DASH||this.negativeFormat==this.PARENTHESIS){o=s}if(this.negativeFormat==this.RIGHT_DASH||this.negativeFormat==this.PARENTHESIS){k=l}}if(this.hasCurrency){c=this.currencyValue}}}}}a=g+p+f+o+a+k+d+h+c;if(this.negativeRed&&r<0){a='<font color="red">'+a+"</font>"}return(a)}function toPercentageNF(){nNum=this.num*100;nNum=this.getRounded(nNum);return nNum+"%"}function getZerosNF(a){var c="";var b;for(b=0;b<a;b++){c+="0"}return c}function expandExponentialNF(b){if(isNaN(b)){return b}var d=parseFloat(b)+"";var h=d.toLowerCase().indexOf("e");if(h!=-1){var c;var a=d.toLowerCase().indexOf("+");var f=d.toLowerCase().indexOf("-",h);var g=d.substring(0,h);if(f!=-1){c=d.substring(f+1,d.length);g=this.moveDecimalAsString(g,true,parseInt(c,10))}else{if(a==-1){a=h}c=d.substring(a+1,d.length);g=this.moveDecimalAsString(g,false,parseInt(c,10))}d=g}return d}function moveDecimalRightNF(c,b){var a="";if(!b&&b!==0){a=this.moveDecimal(c,false)}else{a=this.moveDecimal(c,false,b)}return a}function moveDecimalLeftNF(c,b){var a="";if(!b&&b!==0){a=this.moveDecimal(c,true)}else{a=this.moveDecimal(c,true,b)}return a}function moveDecimalAsStringNF(d,f,a){var l=(arguments.length<3)?this.places:a;if(l<=0){return d}var b=d+"";var g=this.getZeros(l);var k=new RegExp("([0-9.]+)");var h;if(f){b=b.replace(k,g+"$1");h=new RegExp("(-?)([0-9]*)([0-9]{"+l+"})(\\.?)");b=b.replace(h,"$1$2.$3")}else{var c=k.exec(b);if(c!==null&&c!==undefined){b=b.substring(0,c.index)+c[1]+g+b.substring(c.index+c[0].length)}h=new RegExp("(-?)([0-9]*)(\\.?)([0-9]{"+l+"})");b=b.replace(h,"$1$2$4.")}b=b.replace(/\.$/,"");return b}function moveDecimalNF(d,c,b){var a="";if(!b&&b!==0){a=this.moveDecimalAsString(d,c)}else{a=this.moveDecimalAsString(d,c,b)}return parseFloat(a)}function getRoundedNF(a){a=this.moveDecimalRight(a);if(this.truncate){a=a>=0?Math.floor(a):Math.ceil(a)}else{a=Math.round(a)}a=this.moveDecimalLeft(a);return a}function preserveZerosNF(c){var b;c=this.expandExponential(c);if(this.places<=0){return c}var a=c.indexOf(".");if(a==-1){c+=".";for(b=0;b<this.places;b++){c+="0"}}else{var f=(c.length-1)-a;var d=this.places-f;for(b=0;b<d;b++){c+="0"}}return c}function justNumberNF(f){newVal=f+"";var d=false;if(newVal.indexOf("%")!=-1){newVal=newVal.replace(/\%/g,"");d=true}var b=new RegExp("[^\\"+this.inputDecimalValue+"\\d\\-\\+\\(\\)eE]","g");newVal=newVal.replace(b,"");var g=new RegExp("["+this.inputDecimalValue+"]","g");var c=g.exec(newVal);if(c!==null&&c!==undefined){var a=newVal.substring(c.index+c[0].length);newVal=newVal.substring(0,c.index)+this.PERIOD+a.replace(g,"")}if(newVal.charAt(newVal.length-1)==this.DASH){newVal=newVal.substring(0,newVal.length-1);newVal="-"+newVal}else{if(newVal.charAt(0)==this.LEFT_PAREN&&newVal.charAt(newVal.length-1)==this.RIGHT_PAREN){newVal=newVal.substring(1,newVal.length-1);newVal="-"+newVal}}newVal=parseFloat(newVal);if(!isFinite(newVal)){newVal=0}if(d){newVal=this.moveDecimalLeft(newVal,2)}return newVal}OpenLayers.Request.JSONP=function(c){var o=function(r,q){Eniro.AppEvents.triggerEvent(Eniro.Events.REQUEST_FAILURE,{options:r,status:q})};var d=function(r,q){Eniro.AppEvents.triggerEvent(Eniro.Events.REQUEST_SUCCESS,{json:r,status:q})};var k=function(r,q){Eniro.AppEvents.triggerEvent(Eniro.Events.REQUEST_COMPLETE,{options:r,status:q})};var a=function(q){Eniro.AppEvents.triggerEvent(Eniro.Events.REQUEST_BEFORE_SEND,{options:q})};var f=function(q){Eniro.AppEvents.triggerEvent(Eniro.Events.REQUEST_ABORT,{options:q})};var l,b,p,h,g;if(c.failure){l=c.scope?OpenLayers.Function.bind(c.failure,c.scope):c.failure}c.error=function(r,q){if(l){l(r,q)}o(r,q)};if(c.success){b=c.scope?OpenLayers.Function.bind(c.success,c.scope):c.success}c.success=function(r,q){if(b){b({responseText:r,status:q})}d(r,q)};if(c.complete){p=c.scope?OpenLayers.Function.bind(c.complete,c.scope):c.complete}c.complete=function(r,q){if(p){p(r,q)}k(r,q)};if(c.beforeSend){h=c.scope?OpenLayers.Function.bind(c.beforeSend,c.scope):c.beforeSend}c.beforeSend=function(q){if(h){h(q)}a(q)};if(c.abort){g=c.scope?OpenLayers.Function.bind(c.abort,c.scope):c.abort}c.abort=function(q){if(g){g(q)}f(q)};if(c.dataFilter){c.dataFilter=c.scope?OpenLayers.Function.bind(c.dataFilter,c.scope):c.dataFilter}else{c.dataFilter=function(q){return JSON.parse(JSON.stringify(q))}}if(c.params){c.data=c.params;delete c.params}c.callbackParameter=c.callbackParameter?c.callbackParameter:"callback";return jQuery.jsonp(c)};OpenLayers.Request.GET=OpenLayers.Request.JSONP;Proj4js={defaultDatum:"WGS84",proxyScript:null,defsLookupService:"http://spatialreference.org/ref",libPath:"../lib/",transform:function(d,b,a){if(!d.readyToUse||!b.readyToUse){this.reportError("Proj4js initialization for "+d.srsCode+" not yet complete");return}if(a.transformed){this.log("point already transformed");return}if((d.srsProjNumber=="900913"&&b.datumCode!="WGS84")||(b.srsProjNumber=="900913"&&d.datumCode!="WGS84")){var c=Proj4js.WGS84;this.transform(d,c,a);a.transformed=false;d=c}if(d.projName=="longlat"){a.x*=Proj4js.common.D2R;a.y*=Proj4js.common.D2R}else{if(d.to_meter){a.x*=d.to_meter;a.y*=d.to_meter}d.inverse(a)}if(d.from_greenwich){a.x+=d.from_greenwich}a=this.datum_transform(d.datum,b.datum,a);if(b.from_greenwich){a.x-=b.from_greenwich}if(b.projName=="longlat"){a.x*=Proj4js.common.R2D;a.y*=Proj4js.common.R2D}else{b.forward(a);if(b.to_meter){a.x/=b.to_meter;a.y/=b.to_meter}}a.transformed=true;return a},datum_transform:function(c,b,a){if(c.compare_datums(b)){return a}if(c.datum_type==Proj4js.common.PJD_NODATUM||b.datum_type==Proj4js.common.PJD_NODATUM){return a}if(c.datum_type==Proj4js.common.PJD_GRIDSHIFT){alert("ERROR: Grid shift transformations are not implemented yet.")}if(b.datum_type==Proj4js.common.PJD_GRIDSHIFT){alert("ERROR: Grid shift transformations are not implemented yet.")}if(c.es!=b.es||c.a!=b.a||c.datum_type==Proj4js.common.PJD_3PARAM||c.datum_type==Proj4js.common.PJD_7PARAM||b.datum_type==Proj4js.common.PJD_3PARAM||b.datum_type==Proj4js.common.PJD_7PARAM){c.geodetic_to_geocentric(a);if(c.datum_type==Proj4js.common.PJD_3PARAM||c.datum_type==Proj4js.common.PJD_7PARAM){c.geocentric_to_wgs84(a)}if(b.datum_type==Proj4js.common.PJD_3PARAM||b.datum_type==Proj4js.common.PJD_7PARAM){b.geocentric_from_wgs84(a)}b.geocentric_to_geodetic(a)}if(b.datum_type==Proj4js.common.PJD_GRIDSHIFT){alert("ERROR: Grid shift transformations are not implemented yet.")}return a},reportError:function(a){},log:function(a){},loadProjDefinition:function(c){if(this.defs[c.srsCode]){return this.defs[c.srsCode]}var b={method:"get",asynchronous:false,onSuccess:this.defsLoadedFromDisk.bind(this,c.srsCode)};var a=this.libPath+"defs/"+c.srsAuth.toUpperCase()+c.srsProjNumber+".js";new OpenLayers.Ajax.Request(a,b);if(this.defs[c.srsCode]){return this.defs[c.srsCode]}if(this.proxyScript){var a=this.proxyScript+this.defsLookupService+"/"+c.srsAuth+"/"+c.srsProjNumber+"/proj4";b.onSuccess=this.defsLoadedFromService.bind(this,c.srsCode);b.onFailure=this.defsFailed.bind(this,c.srsCode);new OpenLayers.Ajax.Request(a,b)}return this.defs[c.srsCode]},defsLoadedFromDisk:function(srsCode,transport){eval(transport.responseText)},defsLoadedFromService:function(a,b){this.defs[a]=b.responseText;Proj4js.defs[a]=b.responseText},defsFailed:function(a){this.reportError("failed to load projection definition for: "+a);OpenLayers.Util.extend(this.defs[a],this.defs.WGS84)},loadProjCode:function(c){if(this.Proj[c]){return}var b={method:"get",asynchronous:false,onSuccess:this.loadProjCodeSuccess.bind(this,c),onFailure:this.loadProjCodeFailure.bind(this,c)};var a=this.libPath+"projCode/"+c+".js";new OpenLayers.Ajax.Request(a,b)},loadProjCodeSuccess:function(projName,transport){eval(transport.responseText);if(this.Proj[projName].dependsOn){this.loadProjCode(this.Proj[projName].dependsOn)}},loadProjCodeFailure:function(a){Proj4js.reportError("failed to find projection file for: "+a)}};Proj4js.Proj=OpenLayers.Class({readyToUse:false,title:null,projName:null,units:null,datum:null,initialize:function(b){this.srsCode=b.toUpperCase();if(this.srsCode.indexOf("EPSG")==0){this.srsCode=this.srsCode;this.srsAuth="epsg";this.srsProjNumber=this.srsCode.substring(5)}else{this.srsAuth="";this.srsProjNumber=this.srsCode}var a=Proj4js.loadProjDefinition(this);if(a){this.parseDefs(a);Proj4js.loadProjCode(this.projName);this.callInit()}},callInit:function(){Proj4js.log("projection script loaded for:"+this.projName);OpenLayers.Util.extend(this,Proj4js.Proj[this.projName]);this.init();this.mapXYToLonLat=this.inverse;this.lonLatToMapXY=this.forward;this.readyToUse=true},parseDefs:function(b){this.defData=b;var f,c;var a=this.defData.split("+");for(var g=0;g<a.length;g++){var d=a[g].split("=");f=d[0].toLowerCase();c=d[1];switch(f.replace(/\s/gi,"")){case"":break;case"title":this.title=c;break;case"proj":this.projName=c.replace(/\s/gi,"");break;case"units":this.units=c.replace(/\s/gi,"");break;case"datum":this.datumCode=c.replace(/\s/gi,"");break;case"nadgrids":this.nagrids=c.replace(/\s/gi,"");break;case"ellps":this.ellps=c.replace(/\s/gi,"");break;case"a":this.a=parseFloat(c);break;case"b":this.b=parseFloat(c);break;case"lat_0":this.lat0=c*Proj4js.common.D2R;break;case"lat_1":this.lat1=c*Proj4js.common.D2R;break;case"lat_2":this.lat2=c*Proj4js.common.D2R;break;case"lat_ts":this.lat_ts=c*Proj4js.common.D2R;break;case"lon_0":this.long0=c*Proj4js.common.D2R;break;case"x_0":this.x0=parseFloat(c);break;case"y_0":this.y0=parseFloat(c);break;case"k_0":this.k0=parseFloat(c);break;case"k":this.k0=parseFloat(c);break;case"R_A":this.R=parseFloat(c);break;case"zone":this.zone=parseInt(c);break;case"south":this.utmSouth=true;break;case"towgs84":this.datum_params=c.split(",");break;case"to_meter":this.to_meter=parseFloat(c);break;case"from_greenwich":this.from_greenwich=c*Proj4js.common.D2R;break;case"pm":c=c.replace(/\s/gi,"");this.from_greenwich=Proj4js.PrimeMeridian[c]?Proj4js.PrimeMeridian[c]*Proj4js.common.D2R:0;break;case"no_defs":break;default:Proj4js.log("Unrecognized parameter: "+f)}}this.deriveConstants()},deriveConstants:function(){if(this.nagrids=="@null"){this.datumCode="none"}if(this.datumCode&&this.datumCode!="none"){var a=Proj4js.Datum[this.datumCode];if(a){this.datum_params=a.towgs84.split(",");this.ellps=a.ellipse;this.datumName=a.datumName}}if(!this.a){var b=Proj4js.Ellipsoid[this.ellps]?Proj4js.Ellipsoid[this.ellps]:Proj4js.Ellipsoid.WGS84;OpenLayers.Util.extend(this,b)}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.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);this.ep2=(this.a2-this.b2)/this.b2;if(!this.k0){this.k0=1}this.datum=new Proj4js.datum(this)}});Proj4js.Proj.longlat={init:function(){},forward:function(a){return a},inverse:function(a){return a}};Proj4js.defs={WGS84:"+title=long/lat:WGS84 +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees","EPSG:4326":"+title=long/lat:WGS84 +proj=longlat +a=6378137.0 +b=6356752.31424518 +ellps=WGS84 +datum=WGS84 +units=degrees","EPSG:4269":"+title=long/lat:NAD83 +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"};Proj4js.common={PI:Math.PI,HALF_PI:Math.PI*0.5,TWO_PI:Math.PI*2,FORTPI:0.7853981633974483,R2D:57.2957795131,D2R:0.0174532925199,SEC_TO_RAD:0.00000484813681109536,EPSLN:1e-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,msfnz:function(c,b,d){var a=c*b;return d/(Math.sqrt(1-a*a))},tsfnz:function(f,d,c){var a=f*c;var b=0.5*f;a=Math.pow(((1-a)/(1+a)),b);return(Math.tan(0.5*(this.HALF_PI-d))/a)},phi2z:function(g,f){var d=0.5*g;var a,b;var c=this.HALF_PI-2*Math.atan(f);for(i=0;i<=15;i++){a=g*Math.sin(c);b=this.HALF_PI-2*Math.atan(f*(Math.pow(((1-a)/(1+a)),d)))-c;c+=b;if(Math.abs(b)<=1e-10){return c}}alert("phi2z has NoConvergence");return(-9999)},qsfnz:function(c,b,d){var a;if(c>1e-7){a=c*b;return((1-c*c)*(b/(1-a*a)-(0.5/c)*Math.log((1-a)/(1+a))))}else{return(2*b)}},asinz:function(a){if(Math.abs(a)>1){a=(a>1)?1:-1}return Math.asin(a)},e0fn:function(a){return(1-0.25*a*(1+a/16*(3+1.25*a)))},e1fn:function(a){return(0.375*a*(1+0.25*a*(1+0.46875*a)))},e2fn:function(a){return(0.05859375*a*a*(1+0.75*a))},e3fn:function(a){return(a*a*a*(35/3072))},mlfn:function(f,d,c,b,a){return(f*a-d*Math.sin(2*a)+c*Math.sin(4*a)-b*Math.sin(6*a))},srat:function(a,b){return(Math.pow((1-a)/(1+a),b))},sign:function(a){if(a<0){return(-1)}else{return(1)}},adjust_lon:function(a){a=(Math.abs(a)<this.PI)?a:(a-(this.sign(a)*this.TWO_PI));return a}};Proj4js.datum=OpenLayers.Class({initialize:function(b){this.datum_type=Proj4js.common.PJD_WGS84;if(b.datumCode&&b.datumCode=="none"){this.datum_type=Proj4js.common.PJD_NODATUM}if(b&&b.datum_params){for(var a=0;a<b.datum_params.length;a++){b.datum_params[a]=parseFloat(b.datum_params[a])}if(b.datum_params[0]!=0||b.datum_params[1]!=0||b.datum_params[2]!=0){this.datum_type=Proj4js.common.PJD_3PARAM}if(b.datum_params.length>3){if(b.datum_params[3]!=0||b.datum_params[4]!=0||b.datum_params[5]!=0||b.datum_params[6]!=0){this.datum_type=Proj4js.common.PJD_7PARAM;b.datum_params[3]*=Proj4js.common.SEC_TO_RAD;b.datum_params[4]*=Proj4js.common.SEC_TO_RAD;b.datum_params[5]*=Proj4js.common.SEC_TO_RAD;b.datum_params[6]=(b.datum_params[6]/1000000)+1}}}if(b){this.a=b.a;this.b=b.b;this.es=b.es;this.ep2=b.ep2;this.datum_params=b.datum_params}},compare_datums:function(a){if(this.datum_type!=a.datum_type){return false}else{if(this.a!=a.a||Math.abs(this.es-a.es)>5e-11){return false}else{if(this.datum_type==Proj4js.common.PJD_3PARAM){return(this.datum_params[0]==a.datum_params[0]&&this.datum_params[1]==a.datum_params[1]&&this.datum_params[2]==a.datum_params[2])}else{if(this.datum_type==Proj4js.common.PJD_7PARAM){return(this.datum_params[0]==a.datum_params[0]&&this.datum_params[1]==a.datum_params[1]&&this.datum_params[2]==a.datum_params[2]&&this.datum_params[3]==a.datum_params[3]&&this.datum_params[4]==a.datum_params[4]&&this.datum_params[5]==a.datum_params[5]&&this.datum_params[6]==a.datum_params[6])}else{if(this.datum_type==Proj4js.common.PJD_GRIDSHIFT){return strcmp(pj_param(this.params,"snadgrids").s,pj_param(a.params,"snadgrids").s)==0}else{return true}}}}}},geodetic_to_geocentric:function(c){var r=c.x;var k=c.y;var d=c.z?c.z:0;var f;var b;var a;var o=0;var q;var l;var h;var g;if(k<-Proj4js.common.HALF_PI&&k>-1.001*Proj4js.common.HALF_PI){k=-Proj4js.common.HALF_PI}else{if(k>Proj4js.common.HALF_PI&&k<1.001*Proj4js.common.HALF_PI){k=Proj4js.common.HALF_PI}else{if((k<-Proj4js.common.HALF_PI)||(k>Proj4js.common.HALF_PI)){Proj4js.reportError("geocent:lat out of range:"+k);return null}}}if(r>Proj4js.common.PI){r-=(2*Proj4js.common.PI)}l=Math.sin(k);g=Math.cos(k);h=l*l;q=this.a/(Math.sqrt(1-this.es*h));f=(q+d)*g*Math.cos(r);b=(q+d)*g*Math.sin(r);a=((q*(1-this.es))+d)*l;c.x=f;c.y=b;c.z=a;return o},geocentric_to_geodetic:function(A){var F=1e-12;var B=(F*F);var g=30;var r;var k;var a;var t;var b;var s;var q;var E;var D;var o;var w;var v;var f;var C;var h=A.x;var d=A.y;var c=A.z?A.z:0;var l;var z;var u;f=false;r=Math.sqrt(h*h+d*d);k=Math.sqrt(h*h+d*d+c*c);if(r/this.a<F){f=true;l=0;if(k/this.a<F){z=Proj4js.common.HALF_PI;u=-this.b;return}}else{l=Math.atan2(d,h)}a=c/k;t=r/k;b=1/Math.sqrt(1-this.es*(2-this.es)*t*t);E=t*(1-this.es)*b;D=a*b;C=0;do{C++;q=this.a/Math.sqrt(1-this.es*D*D);u=r*E+c*D-q*(1-this.es*D*D);s=this.es*q/(q+u);b=1/Math.sqrt(1-s*(2-s)*t*t);o=t*(1-s)*b;w=a*b;v=w*E-o*D;E=o;D=w}while(v*v>B&&C<g);z=Math.atan(w/Math.abs(o));A.x=l;A.y=z;A.z=u;return A},geocentric_to_geodetic_noniter:function(z){var d=z.x;var c=z.y;var a=z.z?z.z:0;var h;var w;var r;var f;var t;var v;var s;var o;var k;var l;var C;var g;var B;var A;var u;var q;var b;d=parseFloat(d);c=parseFloat(c);a=parseFloat(a);b=false;if(d!=0){h=Math.atan2(c,d)}else{if(c>0){h=Proj4js.common.HALF_PI}else{if(c<0){h=-Proj4js.common.HALF_PI}else{b=true;h=0;if(a>0){w=Proj4js.common.HALF_PI}else{if(a<0){w=-Proj4js.common.HALF_PI}else{w=Proj4js.common.HALF_PI;r=-this.b;return}}}}}t=d*d+c*c;f=Math.sqrt(t);v=a*Proj4js.common.AD_C;o=Math.sqrt(v*v+t);l=v/o;g=f/o;C=l*l*l;s=a+this.b*this.ep2*C;q=f-this.a*this.es*g*g*g;k=Math.sqrt(s*s+q*q);B=s/k;A=q/k;u=this.a/Math.sqrt(1-this.es*B*B);if(A>=Proj4js.common.COS_67P5){r=f/A-u}else{if(A<=-Proj4js.common.COS_67P5){r=f/-A-u}else{r=a/B+u*(this.es-1)}}if(b==false){w=Math.atan(B/A)}z.x=h;z.y=w;z.z=r;return z},geocentric_to_wgs84:function(b){if(this.datum_type==Proj4js.common.PJD_3PARAM){b.x+=this.datum_params[0];b.y+=this.datum_params[1];b.z+=this.datum_params[2]}else{if(this.datum_type==Proj4js.common.PJD_7PARAM){var g=this.datum_params[0];var d=this.datum_params[1];var l=this.datum_params[2];var f=this.datum_params[3];var o=this.datum_params[4];var k=this.datum_params[5];var h=this.datum_params[6];var c=h*(b.x-k*b.y+o*b.z)+g;var a=h*(k*b.x+b.y-f*b.z)+d;var q=h*(-o*b.x+f*b.y+b.z)+l;b.x=c;b.y=a;b.z=q}}},geocentric_from_wgs84:function(c){if(this.datum_type==Proj4js.common.PJD_3PARAM){c.x-=this.datum_params[0];c.y-=this.datum_params[1];c.z-=this.datum_params[2]}else{if(this.datum_type==Proj4js.common.PJD_7PARAM){var h=this.datum_params[0];var d=this.datum_params[1];var o=this.datum_params[2];var g=this.datum_params[3];var q=this.datum_params[4];var l=this.datum_params[5];var k=this.datum_params[6];var f=(c.x-h)/k;var b=(c.y-d)/k;var a=(c.z-o)/k;c.x=f+l*b-q*a;c.y=-l*f+b+g*a;c.z=q*f-g*b+a}}}});Proj4js.Point=OpenLayers.Class({initialize:function(a,c,b){if(typeof a=="object"){this.x=a[0];this.y=a[1];this.z=a[2]||0}else{this.x=a;this.y=c;this.z=b||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:""},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.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.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=500000;this.y0=this.utmSouth?10000000: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.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(f){var g=f.x;var d=f.y;if(d*Proj4js.common.R2D>90&&d*Proj4js.common.R2D<-90&&g*Proj4js.common.R2D>180&&g*Proj4js.common.R2D<-180){Proj4js.reportError("merc:forward: llInputOutOfRange: "+g+" : "+d);return null}var a,h;if(Math.abs(Math.abs(d)-Proj4js.common.HALF_PI)<=Proj4js.common.EPSLN){Proj4js.reportError("merc:forward: ll2mAtPoles");return null}else{if(this.sphere){a=this.x0+this.a*this.k0*Proj4js.common.adjust_lon(g-this.long0);h=this.y0+this.a*this.k0*Math.log(Math.tan(Proj4js.common.FORTPI+0.5*d))}else{var c=Math.sin(d);var b=Proj4js.common.tsfnz(this.e,d,c);a=this.x0+this.a*this.k0*Proj4js.common.adjust_lon(g-this.long0);h=this.y0-this.a*this.k0*Math.log(b)}f.x=a;f.y=h;return f}},inverse:function(d){var a=d.x-this.x0;var g=d.y-this.y0;var f,c;if(this.sphere){c=Proj4js.common.HALF_PI-2*Math.atan(Math.exp(-g/this.a*this.k0))}else{var b=Math.exp(-g/(this.a*this.k0));c=Proj4js.common.phi2z(this.e,b);if(c==-9999){Proj4js.reportError("merc:inverse: lat = -9999");return null}}f=Proj4js.common.adjust_lon(this.long0+a/(this.a*this.k0));d.x=f;d.y=c;return d}};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(d){var a=d.x;var s=d.y;var h=Proj4js.common.adjust_lon(a-this.long0);var f;var A,w;var z=Math.sin(s);var q=Math.cos(s);if(this.sphere){var v=q*Math.sin(h);if((Math.abs(Math.abs(v)-1))<1e-10){Proj4js.reportError("tmerc:forward: Point projects into infinity");return(93)}else{A=0.5*this.a*this.k0*Math.log((1+v)/(1-v));f=Math.acos(q*Math.cos(h)/Math.sqrt(1-v*v));if(s<0){f=-f}w=this.a*this.k0*(f-this.lat0)}}else{var o=q*h;var l=Math.pow(o,2);var r=this.ep2*Math.pow(q,2);var u=Math.tan(s);var B=Math.pow(u,2);f=1-this.es*Math.pow(z,2);var g=this.a/Math.sqrt(f);var k=this.a*Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,s);A=this.k0*g*o*(1+l/6*(1-B+r+l/20*(5-18*B+Math.pow(B,2)+72*r-58*this.ep2)))+this.x0;w=this.k0*(k-this.ml0+g*u*(l*(0.5+l/24*(5-B+9*r+4*Math.pow(r,2)+l/30*(61-58*B+Math.pow(B,2)+600*r-330*this.ep2)))))+this.y0}d.x=A;d.y=w;return d},inverse:function(D){var o,k;var M;var F;var u=6;var s,l;if(this.sphere){var I=Math.exp(D.x/(this.a*this.k0));var H=0.5*(I-1/I);var K=this.lat0+D.y/(this.a*this.k0);var G=Math.cos(K);o=Math.sqrt((1-G*G)/(1+H*H));s=Proj4js.common.asinz(o);if(K<0){s=-s}if((H==0)&&(G==0)){l=this.long0}else{l=Proj4js.common.adjust_lon(Math.atan2(H,G)+this.long0)}}else{var w=D.x-this.x0;var v=D.y-this.y0;o=(this.ml0+v/this.k0)/this.a;k=o;for(F=0;true;F++){M=((o+this.e1*Math.sin(2*k)-this.e2*Math.sin(4*k)+this.e3*Math.sin(6*k))/this.e0)-k;k+=M;if(Math.abs(M)<=Proj4js.common.EPSLN){break}if(F>=u){Proj4js.reportError("tmerc:inverse: Latitude failed to converge");return(95)}}if(Math.abs(k)<Proj4js.common.HALF_PI){var b=Math.sin(k);var N=Math.cos(k);var z=Math.tan(k);var L=this.ep2*Math.pow(N,2);var q=Math.pow(L,2);var A=Math.pow(z,2);var a=Math.pow(A,2);o=1-this.es*Math.pow(b,2);var E=this.a/Math.sqrt(o);var B=E*(1-this.es)/o;var J=w/(E*this.k0);var C=Math.pow(J,2);s=k-(E*z*C/B)*(0.5-C/24*(5+3*A+10*L-4*q-9*this.ep2-C/30*(61+90*A+298*L+45*a-252*this.ep2-3*q)));l=Proj4js.common.adjust_lon(this.long0+(J*(1-C/6*(1+2*A+L-C/20*(5-2*L+28*A-3*q+8*this.ep2+24*a)))/N))}else{s=Proj4js.common.HALF_PI*Proj4js.common.sign(v);l=this.long0}}D.x=l;D.y=s;return D}};Proj4js.defs["EPSG:32632"]="+proj=utm +zone=32 +ellps=WGS84 +datum=WGS84 +units=m +no_defs ";Proj4js.defs["EPSG:32633"]="+proj=utm +zone=33 +ellps=WGS84 +datum=WGS84 +units=m +no_defs ";Proj4js.defs["EPSG:32634"]="+proj=utm +zone=34 +ellps=WGS84 +datum=WGS84 +units=m +no_defs ";Proj4js.defs["EPSG:32635"]="+proj=utm +zone=35 +ellps=WGS84 +datum=WGS84 +units=m +no_defs ";Proj4js.defs["EPSG:3021"]="+proj=tmerc +lat_0=0.000000000 +lon_0=15.8062845294444 +k=1.00000561024 +x_0=1500064.274 +y_0=-667.711 +ellps=WGS84 +units=m +no_defs ";Proj4js.defs["EPSG:3022"]="+proj=tmerc +lat_0=0 +lon_0=18.05827777777778 +k=1 +x_0=1500000 +y_0=0 +ellps=bessel +units=m +no_defs";Proj4js.defs["EPSG:3006"]="+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs";(function(){if(OpenLayers.Handler){function a(c,d){if(!c||!c.prototype[d]){return}c.prototype["_monkeypatch_"+d]=c.prototype[d];c.prototype[d]=function(f){return jQuery(OpenLayers.Event.element(f)).closest(".olEniroIgnoreHandlers").length?true:c.prototype["_monkeypatch_"+d].apply(this,arguments)}}a(OpenLayers.Handler.Drag,"mousedown");a(OpenLayers.Handler.Drag,"mouseup");a(OpenLayers.Handler.Drag,"click");a(OpenLayers.Handler.Click,"dblclick");a(OpenLayers.Handler.Click,"click");a(OpenLayers.Handler.Click,"mouseup");a(OpenLayers.Handler.Feature,"mouseup");a(OpenLayers.Handler.Feature,"mousedown");a(OpenLayers.Handler.Feature,"click")}if(OpenLayers.Events){OpenLayers.Events.prototype._monkeypatch_unregister=OpenLayers.Events.prototype.unregister;OpenLayers.Events.prototype.unregister=function(c,f,d){if(this.listeners){OpenLayers.Events.prototype._monkeypatch_unregister.apply(this,arguments)}};var b=function(){return"BROWSER_EVENTS"};OpenLayers.Events.prototype[b()].push("keyup","keydown","keypress")}OpenLayers.Format.GML=OpenLayers.Format.GML||function(){}})();OpenLayers.Util.getRenderedDimensions=function(b,s,t){var p,f;var a=document.createElement("div");a.style.visibility="hidden";var r=(t&&t.containerElement)?t.containerElement:document.body;if(s){if(s.w){p=s.w;a.style.width=p+"px"}else{if(s.h){f=s.h;a.style.height=f+"px"}}}if(t&&t.displayClass){a.className=t.displayClass}var g=document.createElement("div");g.innerHTML=b;g.style.overflow="visible";if(g.childNodes){for(var d=0,c=g.childNodes.length;d<c;d++){if(!g.childNodes[d].style){continue}g.childNodes[d].style.overflow="visible"}}a.appendChild(g);r.appendChild(a);var q=false;var o=a.parentNode;while(o&&o.tagName.toLowerCase()!="body"){var k=OpenLayers.Element.getStyle(o,"position");if(k=="absolute"){q=true;break}else{if(k&&k!="static"){break}}o=o.parentNode}if(!q){a.style.position="absolute"}if(!p){p=parseInt(g.scrollWidth+1,10);a.style.width=p+"px"}if(!f){f=parseInt(g.scrollHeight,10)}a.removeChild(g);r.removeChild(a);return new OpenLayers.Size(p,f)};if(!OpenLayers.Console.groupCollapsed){OpenLayers.Console.groupCollapsed=function(){this.group.apply(this,arguments)}}OpenLayers.Tile.Image.prototype._clear=OpenLayers.Tile.Image.prototype.clear;OpenLayers.Tile.Image.prototype.clear=function(){if(!this.layer.map.updatingSizeOnResize){OpenLayers.Tile.Image.prototype._clear.apply(this,arguments)}};var RTree=function(a){var c=3;var b=6;if(!isNaN(a)){c=Math.floor(a/2);b=a}var g={x:0,y:0,w:0,h:0,id:"root",nodes:[]};var o=function(t){return Object.prototype.toString.call(t)==="[object Array]"};var l=(function(){var t={};return(function(u){if(u&&u.length>0){return((t[u]?t[u]:t[u]=(function(w){var v=1;return(function(){return(w+"_"+v++)})})(u))())}})})();RTree.Rectangle.squarified_ratio=function(u,t,B){var A=(u+t)/2;var z=u*t;var v=z/(A*A);return(z*B/v)};var f=function(B,w,C){var D=[];var z=[];var E=[];var F=1;var H=false;if(!B||!RTree.Rectangle.overlap_rectangle(B,C)){return E}var u={x:B.x,y:B.y,w:B.w,h:B.h,target:w};z.push(C.nodes.length);D.push(C);do{var I=D.pop();var v=z.pop()-1;if("target" in u){while(v>=0){var A=I.nodes[v];if(RTree.Rectangle.overlap_rectangle(u,A)){if((u.target&&"leaf" in A&&A.leaf===u.target)||(!u.target&&("leaf" in A||RTree.Rectangle.contains_rectangle(A,u)))){if("nodes" in A){E=r(A,true,[],A);I.nodes.splice(v,1)}else{E=I.nodes.splice(v,1)}RTree.Rectangle.make_MBR(I.nodes,I);delete u.target;if(I.nodes.length<c){u.nodes=r(I,true,[],I)}break}else{if("nodes" in A){F+=1;z.push(v);D.push(I);I=A;v=A.nodes.length}}}v-=1}}else{if("nodes" in u){I.nodes.splice(v+1,1);if(I.nodes.length>0){RTree.Rectangle.make_MBR(I.nodes,I)}for(var G=0;G<u.nodes.length;G++){k(u.nodes[G],I)}u.nodes.length=0;if(D.length==0&&I.nodes.length<=1){u.nodes=r(I,true,u.nodes,I);I.nodes.length=0;D.push(I);z.push(1)}else{if(D.length>0&&I.nodes.length<c){u.nodes=r(I,true,u.nodes,I);I.nodes.length=0}else{delete u.nodes}}}else{RTree.Rectangle.make_MBR(I.nodes,I)}}F-=1}while(D.length>0);return(E)};var q=function(E,F){var A=-1;var D=[];var H;var v=b;var I=function(K,J){return(function(L){K._attach_data(J,L)})};D.push(F);var t=F.nodes;do{if(A!=-1){D.push(t[A]);var t=t[A].nodes;A=-1}for(var w=t.length-1;w>=0;w--){var C=t[w];if("leaf" in C){A=-1;break}var B=RTree.Rectangle.squarified_ratio(C.w,C.h,C.nodes.length+1);var z=Math.max(C.x+C.w,E.x+E.w)-Math.min(C.x,E.x);var u=Math.max(C.y+C.h,E.y+E.h)-Math.min(C.y,E.y);var G=RTree.Rectangle.squarified_ratio(z,u,C.nodes.length+2);if(A<0||Math.abs(G-B)<H){H=Math.abs(G-B);A=w}}}while(A!=-1);return(D)};var d=function(t){var u=p(t);while(t.length>0){h(t,u[0],u[1])}return(u)};var h=function(t,I,H){var z=RTree.Rectangle.squarified_ratio(I.w,I.h,I.nodes.length+1);var w=RTree.Rectangle.squarified_ratio(H.w,H.h,H.nodes.length+1);var v;var E;var J;for(var C=t.length-1;C>=0;C--){var u=t[C];var D={};D.x=Math.min(I.x,u.x);D.y=Math.min(I.y,u.y);D.w=Math.max(I.x+I.w,u.x+u.w)-D.x;D.h=Math.max(I.y+I.h,u.y+u.h)-D.y;var G=Math.abs(RTree.Rectangle.squarified_ratio(D.w,D.h,I.nodes.length+2)-z);var B={};B.x=Math.min(H.x,u.x);B.y=Math.min(H.y,u.y);B.w=Math.max(H.x+H.w,u.x+u.w)-B.x;B.h=Math.max(H.y+H.h,u.y+u.h)-B.y;var F=Math.abs(RTree.Rectangle.squarified_ratio(B.w,B.h,H.nodes.length+2)-w);if(!E||!v||Math.abs(F-G)<v){E=C;v=Math.abs(F-G);J=F<G?H:I}}var A=t.splice(E,1)[0];if(I.nodes.length+t.length+1<=c){I.nodes.push(A);RTree.Rectangle.expand_rectangle(I,A)}else{if(H.nodes.length+t.length+1<=c){H.nodes.push(A);RTree.Rectangle.expand_rectangle(H,A)}else{J.nodes.push(A);RTree.Rectangle.expand_rectangle(J,A)}}};var p=function(t){var v=t.length-1;var E=0;var u=t.length-1;var D=0;for(var z=t.length-2;z>=0;z--){var w=t[z];if(w.x>t[E].x){E=z}else{if(w.x+w.w<t[v].x+t[v].w){v=z}}if(w.y>t[D].y){D=z}else{if(w.y+w.h<t[u].y+t[u].h){u=z}}}var F=Math.abs((t[v].x+t[v].w)-t[E].x);var C=Math.abs((t[u].y+t[u].h)-t[D].y);if(F>C){if(v>E){var B=t.splice(v,1)[0];var A=t.splice(E,1)[0]}else{var A=t.splice(E,1)[0];var B=t.splice(v,1)[0]}}else{if(u>D){var B=t.splice(u,1)[0];var A=t.splice(D,1)[0]}else{var A=t.splice(D,1)[0];var B=t.splice(u,1)[0]}}return([{x:B.x,y:B.y,w:B.w,h:B.h,nodes:[B]},{x:A.x,y:A.y,w:A.w,h:A.h,nodes:[A]}])};var s=function(u,t){u.nodes=t.nodes;u.x=t.x;u.y=t.y;u.w=t.w;u.h=t.h;return(u)};var r=function(A,v,z,B){var C=[];if(!RTree.Rectangle.overlap_rectangle(A,B)){return(z)}var D=function(F,E){return(function(G){F._attach_data(E,G)})};C.push(B.nodes);do{var t=C.pop();for(var u=t.length-1;u>=0;u--){var w=t[u];if(RTree.Rectangle.overlap_rectangle(A,w)){if("nodes" in w){C.push(w.nodes)}else{if("leaf" in w){if(!v){z.push(w.leaf)}else{z.push(w)}}}}}}while(C.length>0);return(z)};var k=function(u,B){var z;if(B.nodes.length==0){B.x=u.x;B.y=u.y;B.w=u.w;B.h=u.h;B.nodes.push(u);return}var w=q(u,B);var v=u;do{if(z&&"nodes" in z&&z.nodes.length==0){var E=z;z=w.pop();for(var D=0;D<z.nodes.length;D++){if(z.nodes[D]===E||z.nodes[D].nodes.length==0){z.nodes.splice(D,1);break}}}else{z=w.pop()}if("leaf" in v||"nodes" in v||o(v)){if(o(v)){for(var A=0;A<v.length;A++){RTree.Rectangle.expand_rectangle(z,v[A])}z.nodes=z.nodes.concat(v)}else{RTree.Rectangle.expand_rectangle(z,v);z.nodes.push(v)}if(z.nodes.length<=b){v={x:z.x,y:z.y,w:z.w,h:z.h}}else{var C=d(z.nodes);v=C;if(w.length<1){z.nodes.push(C[0]);w.push(z);v=C[1]}}}else{RTree.Rectangle.expand_rectangle(z,v);v={x:z.x,y:z.y,w:z.w,h:z.h}}}while(w.length>0)};this.get_tree=function(){return g};this.set_tree=function(u,t){if(!t){t=g}return(s(t,u))};this.search=function(u,v,t){if(arguments.length<1){throw"Wrong number of arguments. RT.Search requires at least a bounding rectangle."}switch(arguments.length){case 1:arguments[1]=false;case 2:arguments[2]=[];case 3:arguments[3]=g;default:arguments.length=4}return(r.apply(this,arguments))};this.toJSON=function(E,J){var G=[];var B=[];var F={};var v=3;var H=1;var u="";if(E&&!RTree.Rectangle.overlap_rectangle(E,g)){return""}if(!J){B.push(g.nodes.length);G.push(g.nodes);u+="var main_tree = {x:"+g.x.toFixed()+",y:"+g.y.toFixed()+",w:"+g.w.toFixed()+",h:"+g.h.toFixed()+",nodes:["}else{v+=4;B.push(J.nodes.length);G.push(J.nodes);u+="var main_tree = {x:"+J.x.toFixed()+",y:"+J.y.toFixed()+",w:"+J.w.toFixed()+",h:"+J.h.toFixed()+",nodes:["}do{var t=G.pop();var A=B.pop()-1;if(A>=0&&A<t.length-1){u+=","}while(A>=0){var D=t[A];if(!E||RTree.Rectangle.overlap_rectangle(E,D)){if(D.nodes){if(H>=v){var C=F.length;var z=l("saved_subtree");u+="{x:"+D.x.toFixed()+",y:"+D.y.toFixed()+",w:"+D.w.toFixed()+",h:"+D.h.toFixed()+",load:'"+z+".js'}";F[z]=this.toJSON(E,D);if(A>0){u+=","}}else{u+="{x:"+D.x.toFixed()+",y:"+D.y.toFixed()+",w:"+D.w.toFixed()+",h:"+D.h.toFixed()+",nodes:[";H+=1;B.push(A);G.push(t);t=D.nodes;A=D.nodes.length}}else{if(D.leaf){var w=D.leaf.toJSON?D.leaf.toJSON():JSON.stringify(D.leaf);u+="{x:"+D.x.toFixed()+",y:"+D.y.toFixed()+",w:"+D.w.toFixed()+",h:"+D.h.toFixed()+",leaf:"+w+"}";if(A>0){u+=","}}else{if(D.load){u+="{x:"+D.x.toFixed()+",y:"+D.y.toFixed()+",w:"+D.w.toFixed()+",h:"+D.h.toFixed()+",load:'"+D.load+"'}";if(A>0){u+=","}}}}}A-=1}if(A<0){u+="]}";H-=1}}while(G.length>0);u+=";";for(var I in F){u+="\nvar "+I+" = function(){"+F[I]+" return(main_tree);};"}return(u)};this.remove=function(u,w){if(arguments.length<1){throw"Wrong number of arguments. RT.remove requires at least a bounding rectangle."}switch(arguments.length){case 1:arguments[1]=false;case 2:arguments[2]=g;default:arguments.length=3}if(arguments[1]===false){var t=0;var v=[];do{t=v.length;v=v.concat(f.apply(this,arguments))}while(t!=v.length);return v}else{return(f.apply(this,arguments))}};this.insert=function(t,u){if(arguments.length<2){throw"Wrong number of arguments. RT.Insert requires at least a bounding rectangle and an object."}return(k({x:t.x,y:t.y,w:t.w,h:t.h,leaf:u},g))}};RTree.Rectangle=function(c,b,d,p){if(c.x){var l=c.x;var k=c.y;if(c.w!==0&&!c.w&&c.x2){var o=c.x2-c.x;var f=c.y2-c.y}else{var o=c.w;var f=c.h}var a=l+o;var g=k+f}else{var l=c;var k=b;var o=d;var f=p;var a=l+o;var g=k+f}this.x1=this.x=function(){return l};this.y1=this.y=function(){return k};this.x2=function(){return a};this.y2=function(){return g};this.w=function(){return o};this.h=function(){return f};this.toJSON=function(){return('{"x":'+l.toString()+', "y":'+k.toString()+', "w":'+o.toString()+', "h":'+f.toString()+"}")};this.overlap=function(h){return(this.x()<h.x2()&&this.x2()>h.x()&&this.y()<h.y2()&&this.y2()>h.y())};this.expand=function(q){var h=Math.min(this.x(),q.x());var r=Math.min(this.y(),q.y());o=Math.max(this.x2(),q.x2())-h;f=Math.max(this.y2(),q.y2())-r;l=h;k=r;return(this)};this.setRect=function(s,r,t,C){if(s.x){var A=s.x;var z=s.y;if(s.w!==0&&!s.w&&s.x2){var B=s.x2-s.x;var u=s.y2-s.y}else{var B=s.w;var u=s.h}var q=A+B;var v=z+u}else{var A=s;var z=r;var B=t;var u=C;var q=A+B;var v=z+u}}};RTree.Rectangle.overlap_rectangle=function(d,c){return(d.x<(c.x+c.w)&&(d.x+d.w)>c.x&&d.y<(c.y+c.h)&&(d.y+d.h)>c.y)};RTree.Rectangle.contains_rectangle=function(d,c){return((d.x+d.w)<=(c.x+c.w)&&d.x>=c.x&&(d.y+d.h)<=(c.y+c.h)&&d.y>=c.y)};RTree.Rectangle.expand_rectangle=function(f,d){var c=Math.min(f.x,d.x);var g=Math.min(f.y,d.y);f.w=Math.max(f.x+f.w,d.x+d.w)-c;f.h=Math.max(f.y+f.h,d.y+d.h)-g;f.x=c;f.y=g;return(f)};RTree.Rectangle.make_MBR=function(a,c){if(a.length<1){return({x:0,y:0,w:0,h:0})}if(!c){c={x:a[0].x,y:a[0].y,w:a[0].w,h:a[0].h}}else{c.x=a[0].x}c.y=a[0].y;c.w=a[0].w;c.h=a[0].h;for(var b=a.length-1;b>0;b--){RTree.Rectangle.expand_rectangle(c,a[b])}return(c)};var Eniro=Eniro||{};Eniro.Init=Eniro.Init||null;Eniro.Request=Eniro.Request||{};Eniro.Util=Eniro.Util||{};Eniro.Events=Eniro.Events||{};Eniro.Tile=Eniro.Tile||{};Eniro.Layer=Eniro.Layer||{};Eniro.Constant=Eniro.Constant||{};Eniro.ControlID=Eniro.ControlID||{};Eniro.Feature=Eniro.Feature||{};Eniro.Handler=Eniro.Handler||{};Eniro.Sellable=Eniro.Sellable||{};Eniro.Search=Eniro.Search||{};Eniro.Campaign=Eniro.Campaign||{};Eniro.ControlID.SHOW_ON_MAP_CONTROL="showOnMap";Eniro.ControlID.GPS="gps";Eniro.ControlID.LAYERBAR="layerbar";Eniro.ControlID.TABNAVIGATOR_MAIN="main";Eniro.ControlID.TABVIEW_SEARCH="search";Eniro.ControlID.TABVIEW_ROUTE="route";Eniro.ControlID.TABVIEW_DRAW="draw";Eniro.ControlID.TOOLBARVIEW_COMMUNITY="community";Eniro.ControlID.CONTROLBAR_TOP="topbar";Eniro.ControlID.CONTROLBAR_ZOOM="zoom";Eniro.ControlID.CONTROLBAR_FOOTER="footer";Eniro.ControlID.ROUTE_CONTROLLER="routeController";Eniro.ControlID.OBLIQUE_LAYERBAR_BUTTON="oblique";Eniro.ControlID.OBLIQUE_CONTROLLER="obliqueController";Eniro.ControlID.STREET_VIEW_LAYERBAR_BUTTON="streetview";Eniro.ControlID.STREET_VIEW_LAYERBAR_BUTTON3D="streetview3d";Eniro.ControlID.STREET_VIEW_CONTROLLER="streetviewController";Eniro.ControlID.COMMUNITY_PRINT="community-print";Eniro.ControlID.COMMUNITY_SHARE="community-share";Eniro.ControlID.COMMUNITY_DA_MAPSTATE="da-mapstate";Eniro.ControlID.COMMUNITY_LINK="community-link";Eniro.ControlID.COMMUNITY_SEND_MAIL="community-mail";Eniro.ControlID.COMMUNITY_SEND_SMS="community-sms";Eniro.ControlID.URL_TRANSLATOR_CONTROLLER="urlTranslator";String.prototype.toInt=function(){return parseInt(this,10)};String.prototype.toFloat=function(){return parseFloat(this,10)};String.prototype.toDomElement=function(){var a=document.createElement("div");a.innerHTML=this;return a.firstChild};String.prototype.dash=function(){return this.replace(/([a-z])([A-Z])|([A-Z])([a-z])/g,"$1-$2$3$4").replace(/^-/,"").replace(/\.-/g,".").toLowerCase()};String.prototype.toNumber=function(){return this.replace(/([^\d]*)?([\d]+)(.*)?/,"$2")*1};String.prototype.wrap=function(b){if(this.length<=b){return this.toString()}var c=b;var a=this;while(c>0){if(a[c]==="-"||a[c]==="\n"){a=a.substring(0,c+1)+" "+a.substring(c+1);c++}if(a[c]===" "){return a.substring(0,c)+"<br/>"+a.substring(c+1).wrap(b)}c--}return a.substring(0,b)+"<br/>"+a.substring(b).wrap(b)};String.prototype.capitalize=function(){return this.charAt(0).toUpperCase()+this.slice(1)};Number.prototype.toFormatted=function(a){var b=Eniro.l10n.numberFormat(this);if(!a){a=0}b.setPlaces(a);return b.toFormatted()};Number.prototype.toDistance=function(a,b,f){var d=this;var c="m";if(!b){b=0}if(!a){a=1000}if(d>=a){d/=1000;c="km";b=(f)?f:1}return d.toFormatted(b)+" "+c};Number.prototype.toArea=function(a,b,f){var d=this;var c="m";if(!b){b=0}if(!a){a=1000}if(d>=a){d/=1000*1000;c="km";b=(f)?f:1}return d.toFormatted(b)+" "+c};Number.prototype.toDuration=function(){var c=this/60,b=0;if(c>=60){b=Math.floor(c/60);c-=b*60}var a=[];if(b){a.push(OpenLayers.i18n("l10n.hours",{hours:b.toFormatted()}))}if(c){a.push(OpenLayers.i18n("l10n.minutes",{minutes:c.toFormatted()}))}return a.join(" ")};Eniro.Constant.REGEX_URL=/\b(https?\:\/\/)?(?:[A-Z0-9\-]+\.)+[A-Z]{2,4}(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?\b/gi;Eniro.Constant.REGEX_EMAIL=/\b[A-Z0-9._%+\-]+@(?:[A-Z0-9\-]+\.)+[A-Z]{2,4}\b/gi;Eniro.Constant.REGEX_URL_AND_EMAIL=/\b([A-Z0-9._%+\-]+@(?:[A-Z0-9\-]+\.)+[A-Z]{2,4}|(https?\:\/\/)?(?:[A-Z0-9\-]+\.)+[A-Z]{2,4}(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)\b/gi;Eniro.Util.LinkParser={encode:function(c,b){if(!c){return c}var a;if(b==="url"){a=Eniro.Constant.REGEX_URL}else{if(b==="email"){a=Eniro.Constant.REGEX_EMAIL}else{a=Eniro.Constant.REGEX_URL_AND_EMAIL}}c=c.replace(a,function(f){var d=f;if(!!f.match("@")){if(!b||b==="email"){return'<a class="eniro-new" rel="nofollow" href="mailto:'+f+'">'+d+"</a>"}}else{if(!b||b==="url"){if(!f.match("^https?://")){f="http://"+f}return'<a class="eniro-new" rel="nofollow" href="'+f+'">'+d+"</a>"}}return d});return c},decode:function(a){return jQuery("<div>"+a+"</div>").text()}};Eniro.Util.FeatureUtils={getAddressAsString:function(d){if(!d){return null}var c=[];var b=d.attributes||d.properties;var h=this.getMappingData(b.source);if(b.source&&b.source.match(/_no/)){var a;if(b.postplaces){a=b.postplaces[0]}var g=b.street;if(typeof g==="object"){g=g.value}if(g){c.push(g)}if(b.streetNumber&&b.streetNumber!==""){c.push(" ");c.push(h.streetNumber)}if(c.length>0){c.push(",")}if(a){if(a.id&&a.id!==""){c.push(" ");c.push(a.id)}if(a.value&&a.value!==""){c.push(" ");c.push(a.value)}}else{if(b.nameOfPlace&&b.nameOfPlace!==""){c.push(" ");c.push(b.nameOfPlace);if(b.municipality&&b.municipality!==""){c.push(", ");c.push(b.municipality.value)}}}c=c.join("")}else{if(h){var f=b[h.addressObject]||b;if(Eniro.Util.isArray(f)&&f.length>0){f=f[0]}if(h.nestedObject){f=f[h.nestedObject]||f}if(f&&f[h.street]){c=[f[h.street]+(f[h.streetNumber]?" "+f[h.streetNumber]:""),(f[h.city]===""&&f[h.postArea]?f[h.postArea]:f[h.city])]}c=c.join(", ")}}return OpenLayers.String.trim(c)},getContentsForFeature:function(a){var b="";var c=this.getMappingData(a.attributes.source);if(c.contents){b=a.attributes[c.contents]}return b},getMappingData:function(c){var b=null;var a=Eniro.Profile.providers?Eniro.Profile.providers[c]:null;if(a&&a.properties){b=a.properties.data}return b},makeMultiLineString:function(b){var d=[];for(var c=0;c<b.length;c++){var f=[];for(var a=0;a<b[c].length;a++){f.push(new OpenLayers.Geometry.Point(b[c][a][0],b[c][a][1]))}d.push(new OpenLayers.Geometry.LineString(f))}return new OpenLayers.Geometry.MultiLineString(d)},getCompanyIcon:function(g){var l=null;var c=g["e:infopage"];var o=Eniro.Profile.providers[g.source];if(o&&Eniro.Profile.sellable[o.sellable]){var a=Eniro.Profile.sellable[o.sellable];var p=g.linkId;if(p&&a.options){for(var k=0,b=a.options.length;k<b;k++){var h=a.options[k];if(h.linkId===p&&h.imageUrl){l=h.imageUrl;break}}}}else{if(c){if(Eniro.Util.isArray(c)){for(var f=0,d=c.length;f<d;f++){var q=c[f];if(q["e:component"]&&q["e:component"]["@component_name"]==="logo_on_map"&&q["e:component"]["e:src"]){l=q["e:component"]["e:src"];break}}}else{if(c["e:component"]&&c["e:component"]["@component_name"]==="logo_on_map"&&c["e:component"]["e:src"]){l=c["e:component"]["e:src"]}}}}return l},formatNorwegianPhoneNo:function(a){if(a){if(a.match(/^[94]/)){a=a.replace(/^(\d{3})(\d{2})(\d+)/,"$1 $2 $3")}else{a=a.replace(/^(\d{2})(\d{2})(\d{2})(\d+)/,"$1 $2 $3 $4")}}return a},transformInfoListingUrl:function(f,k,h,b){if(!(f&&k&&h)){return null}var a=h+k.url;var d;var l;b=b||{};if(k.params&&k.params.length){for(var g=0,c=k.params.length;g<c;g++){d=k.params[g];l=d.seoParam?this.makeSeoFriendly(f[d.value]):f[d.value];if(d.name&&l){b[d.name]=l}}a=OpenLayers.i18n(a,b)}return a},makeSeoFriendly:function(a){return a?a.toLowerCase().replace(/\s/g,"-"):""}};Eniro.AppNode={appUrl:function(a){return this.appendToUrl(Eniro.Config["appnode.url"],a)},tileUrl:function(d){var b=Eniro.Config["appnode.alias"];var a;if(b.indexOf(",")>0){b=b.split(/\s*,\s*/);a=[];for(var c=0;c<b.length;c++){a.push(this.appendToUrl(b[c],d))}}else{a=this.appendToUrl(b,d)}return a},streetviewDataUrl:function(){return Eniro.Config["streetview.data.url"]},streetviewFrontdoorUrl:function(){return Eniro.Config["streetview.frontdoor.url"]},streetview3dDataUrl:function(){return Eniro.Config["streetview.3d.data.url"]},streetview3dRefUrl:function(){return Eniro.Config["streetview.3d.ref.url"]},obliqueDataUrl:function(){return Eniro.Config["oblique.data.url"]},searchTMSUrl:function(b){var a=this.getOptionalValue(Eniro.Config["search.tms.url"],Eniro.Config["appnode.url"]);return this.appendToUrl(a,b)},searchUrl:function(b){var a=this.getOptionalValue(Eniro.Config["search.url"],Eniro.Config["appnode.url"]);return this.appendToUrl(a,b)},appendToUrl:function(a,b){if(!OpenLayers.String.startsWith(b,"/")){b="/"+b}return a+b},getOptionalValue:function(b,a){if(b){return b}else{return a}}};Eniro.RequestWatcher=OpenLayers.Class({callback:null,requestsInProgress:0,watchProp:null,initialize:function(a){this.callback=a;this.watchProp="requestWatcher"+Math.random()},start:function(){this.requestsInProgress=0;this.isMarking=true;Eniro.AppEvents.register(Eniro.Events.REQUEST_BEFORE_SEND,this,this.onRequestBeforeSend);Eniro.AppEvents.register(Eniro.Events.REQUEST_COMPLETE,this,this.onRequestCompleteOrAbort);Eniro.AppEvents.register(Eniro.Events.REQUEST_ABORT,this,this.onRequestCompleteOrAbort)},stop:function(){if(this.isMarking){Eniro.AppEvents.unregister(Eniro.Events.REQUEST_BEFORE_SEND,this,this.onRequestBeforeSend);this.isMarking=false;this.checkRequests()}},checkRequests:function(){if(this.requestsInProgress===0&&!this.isMarking){this.callback();Eniro.AppEvents.unregister(Eniro.Events.REQUEST_BEFORE_SEND,this,this.onRequestBeforeSend);Eniro.AppEvents.unregister(Eniro.Events.REQUEST_COMPLETE,this,this.onRequestCompleteOrAbort);Eniro.AppEvents.unregister(Eniro.Events.REQUEST_ABORT,this,this.onRequestCompleteOrAbort)}},onRequestBeforeSend:function(a){a.options[this.watchProp]=true;this.requestsInProgress++},onRequestCompleteOrAbort:function(a){if(a.options[this.watchProp]&&this.requestsInProgress>0){this.requestsInProgress--;this.checkRequests()}}});if(!Array.prototype.indexOf){Array.prototype.indexOf=function(b,c){var a=this.length>>>0;var d=Number(c)||0;d=(d<0)?Math.ceil(d):Math.floor(d);if(d<0){d+=a}for(;d<a;d++){if(d in this&&this[d]===b){return d}}return -1}}if(!Array.prototype.remove){Array.prototype.remove=function(b,a){this.splice(b,!a||1+a-b+(!(a<0^b>=0)&&(a<0||-1)*this.length));return this.length}}OpenLayers.Event.KEY_SHIFT=16;OpenLayers.Event.KEY_CTRL=17;OpenLayers.Event.KEY_ALT=18;OpenLayers.Event.KEY_CAPS_LOCK=20;OpenLayers.Event.KEY_NUM_LOCK=144;OpenLayers.Event.KEY_SCROLL_LOCK=145;OpenLayers.Event.KEY_META=224;OpenLayers.Event.KEY_WIN_LEFT=91;OpenLayers.Event.KEY_WIN_RIGHT=92;Eniro.Util.mouseLeft=function(a,b){var d=(a.relatedTarget)?a.relatedTarget:a.toElement;while(d&&d!=b){try{d=d.parentNode}catch(c){break}}return(d!=b)};Eniro.Util.getImagesLocation=function(){return Eniro.ImgPath||"/"};Eniro.Util.createNonPositionedDiv=function(){return Eniro.Util.createDiv()};Eniro.Util.createDiv=function(f,a,d,b){var c=document.createElement("div");if(a){c.className=a}if(b){c.className+=" olControlNoSelect";c.setAttribute("unselectable","on",0);c.onselectstart=function(){return false}}if(d){c.title=d}OpenLayers.Util.modifyDOMElement(c,f);return c};Eniro.Util.createButton=function(d,a,b){var c=document.createElement("input");c.setAttribute("type","submit");c.setAttribute("value",b);if(a){c.className=a}OpenLayers.Util.modifyDOMElement(c,d);return c};Eniro.Util.isArray=function(a){return a&&typeof a==="object"&&a.constructor===Array};Eniro.Util.toHTMLAttributes=function(c){var a=[];for(var b in c){if(c[b]!==undefined){a.push(b+'="'+c[b]+'"')}}return a};Eniro.Util.stopArrowKeysEvent=function(a){switch(a.keyCode){case OpenLayers.Event.KEY_LEFT:case OpenLayers.Event.KEY_RIGHT:case OpenLayers.Event.KEY_UP:case OpenLayers.Event.KEY_DOWN:case 35:case 36:case 43:case 61:case 187:case 107:case 45:case 109:case 189:case 95:OpenLayers.Event.stop(a,true);break}};Eniro.Util.reflect=function(c,b){var d=this.getClass(c);var a=function(){if(b&&b[0]!=OpenLayers.Class.isPrototype){return d.apply(this,b)}};a.prototype=d.prototype;return new a()};Eniro.Util.getClass=function(a){return Eniro.Util.getDeepProperty(window,a)};Eniro.Util.getDeepProperty=function(d,a){var c=a.split(".");for(var b=0,f=c.length;b<f;b++){if(d[c[b]]){d=d[c[b]]}else{return null}}return d};Eniro.Util.getCssClassName=function(p,c,b,q){var a=[];var r=[];var t;var l;var o,f;a.push(p.CLASS_NAME);if(p.SUPER){var u=p.SUPER;do{if(typeof u==="string"&&u){u=Eniro.Util.getClass(u)}if(u){if(u.prototype.CLASS_NAME){a.push(u.prototype.CLASS_NAME)}if(u.prototype.SUPER){u=u.prototype.SUPER}else{u=null}}else{u=null}}while(u)}a=a.reverse();for(o=0,f=a.length;o<f;++o){t=a[o].replace(/^Eniro\.(Control\.)?|View$|Controller$|Tool$|Menu$/g,"");if(!t){t=a[o].replace(/^Eniro\.(Control\.)?/g,"")}t=t.replace(/\./g,"-").toLowerCase();if(o===(a.length-1)){l=t}r.push(t)}if(p.id&&!OpenLayers.String.startsWith(p.id,p.CLASS_NAME.replace(/\./g,""))){r.push(l+"-"+(p.id.replace(/[\. ,]/g,"-").dash()))}r=OpenLayers.String.trim([" "].concat(r).join(" eniro-"));if(c||c===""){c=c.split(" ")}else{c=[]}if(q){var d=[];var v=function(z,A){var w=[];for(o=0,f=z.length;o<f;++o){if(z[o]){w.push(z[o]+"-"+A)}else{w.push(A)}}return w};var s="";if(q.disabled||q.selected){if(q.disabled){s="disabled"}else{if(q.selected){s="selected"}}d=d.concat(v(c,s))}if(q.position){d=d.concat(v(c,q.position))}if((q.selected||q.disabled)&&q.position){var h="";if(s){h=s+"-"}h+=q.position;d=d.concat(v(c,h))}c=c.concat(d)}a=[];for(o=0,f=c.length;o<f;++o){if(c[o]){t=r.replace(/( |$)/gi,"-"+c[o]+"$1");if(b){t=t.split(" ");for(var k=0,g=t.length;k<g;++k){if(OpenLayers.String.contains(t[k],b||"")){a.push(t[k])}}}else{a.push(t)}}}if(q&&q.id){t=r.split(" ");t=t[0]+"-"+c[0]+"-"+(q.id.replace(/[\. ,]/gi,"-").dash());a.push(t);if(q.selected){a.push(t+"-selected")}}if(c[0]){className=(a.length>0)?a.join(" "):r}else{className=OpenLayers.String.trim(r+" "+a.join(" "))}return className};Eniro.Util.getSingleCssClassName=function(f,c,d,b){var a=Eniro.Util.getCssClassName(f,c,d,b);a=a.split(" ");return a[a.length-1]};Eniro.Util.copyToClipboard=function(a){if(window.clipboardData){window.clipboardData.setData("Text",a)}};Eniro.Util.enableInputCaption=function(c,b){var d=document.createElement("div");d.className=this.getCssClassName({CLASS_NAME:"Eniro.Input"},"caption");d.innerHTML=b;d.style.display="none";if(OpenLayers.Element.getStyle(c,"position")==="static"){c.parentNode.style.position="relative"}c.placeholder="";c.parentNode.insertBefore(d,c);OpenLayers.Event.observe(d,"click",function(f){var h=OpenLayers.Event.element(f);var g=h.nextSibling;if(g.nodeName&&g.nodeName.toLowerCase()==="input"){g.focus()}});var a=function(f){var g=OpenLayers.Event.element(f);var k=g.previousSibling;if(k.nodeName&&k.nodeName.toLowerCase()==="div"){var h;if(f.type==="keydown"){switch(f.keyCode){case OpenLayers.Event.KEY_BACKSPACE:case OpenLayers.Event.KEY_DELETE:case OpenLayers.Event.KEY_DOWN:case OpenLayers.Event.KEY_ESC:case OpenLayers.Event.KEY_LEFT:case OpenLayers.Event.KEY_RETURN:case OpenLayers.Event.KEY_RIGHT:case OpenLayers.Event.KEY_TAB:case OpenLayers.Event.KEY_UP:case OpenLayers.Event.KEY_SHIFT:case OpenLayers.Event.KEY_CTRL:case OpenLayers.Event.KEY_ALT:case OpenLayers.Event.KEY_CAPS_LOCK:case OpenLayers.Event.KEY_NUM_LOCK:case OpenLayers.Event.KEY_SCROLL_LOCK:case OpenLayers.Event.KEY_META:case OpenLayers.Event.KEY_WIN_LEFT:case OpenLayers.Event.KEY_WIN_RIGHT:break;default:h="hide"}}else{h=(g.value==="")?"show":"hide"}if(h){OpenLayers.Element[h](k)}}};OpenLayers.Event.observe(c,"blur",a);OpenLayers.Event.observe(c,"keydown",a);OpenLayers.Event.observe(c,"keyup",a);a({target:c})};OpenLayers.IMAGE_RELOAD_ATTEMPTS=3;Eniro.Util.ArgParser={getParameters:function(){var d="";if(window.location.hash&&window.location.hash!="#"){d=window.location.hash}else{if(/^\/(map.c|bigMap.c)/.test(location.pathname)||window.location.search){d=location.search}}var f={};var c="s";var k={0:"s",1:"s",2:"a",3:"h",4:"o"};var q="aq";var g={address:"aq",yellow:"yp",white:"wp"};if(d){d=d.replace(/^(#|\?)/,"");var r;try{r=decodeURIComponent(d)}catch(w){r=unescape(d)}var A=r.split(/[&;]/);for(var u=0,v=A.length;u<v;++u){var s=A[u].split("=");if(s[0]){var z=decodeURIComponent(s[0]);var p=s[1]||"";p=p.split(",");for(var t=0,l=p.length;t<l;t++){p[t]=decodeURIComponent(p[t])}if(p.length==1){p=p[0]}if(z==="layers"){values=p.split("");for(t=0,n=values.length;t<n;++t){if(values[t]==="B"){c=k[t];break}}}f[z]=p}}if(f.tab){q=g[f.tab]}}var h=new OpenLayers.LonLat(f.lon,f.lat);h.transform(new OpenLayers.Projection("EPSG:32632"),new OpenLayers.Projection("EPSG:4326"));var o=null;if(f.id){o=f.id.replace(/^(a_|c_|p_)/gi,"")}var a=parseInt(f.zoom,10);if(f.q||o){a=null}if(!c&&f.imgt){c=f.imgt.toLowerCase()}var b={offset:f.offset,search_word:f.q,mop:q,what:"map",advert_code:o,mapstate:{upperLeftX:f.w,upperLeftY:f.n,lowerRightX:f.e,lowerRightY:f.s,centerX:h.lon,centerY:h.lat,zoom:a,type:c}};return b}};Eniro.Util.openLinksInNewWindow=function(a){if(!(a.shiftKey||a.altKey||a.ctrlKey||a.metaKey)){var b=OpenLayers.Event.element(a);var c=jQuery(b).closest("a.eniro-new");if(c.size()>0&&!(c.attr("onclick")||c.attr("onClick"))){var d=window.open(c.attr("href"),"_blank");if(d){if(d.focus){d.focus()}d=null;OpenLayers.Event.stop(a);return false}}}return true};Eniro.Util.windowResizeHandler=function(a){var b=Eniro.map;if(b){b.updateSize(a)}};Eniro.Util.bearing=function(b,k){var g=b.lat*(Math.PI/180);var f=k.lat*(Math.PI/180);var c=(k.lon-b.lon)*(Math.PI/180);var h=Math.sin(c)*Math.cos(f);var a=Math.cos(g)*Math.sin(f)-Math.sin(g)*Math.cos(f)*Math.cos(c);var d=Math.atan2(h,a);return((d*(180/Math.PI))+360)%360};if(!!(document.all&&(/msie 6./i).test(navigator.appVersion)&&window.ActiveXObject)){try{document.execCommand("BackgroundImageCache",false,true)}catch(e){}}Eniro.Util.HTML5={};Eniro.Util.HTML5._supportedAttributes={};Eniro.Util.HTML5.attributeSupported=function(a,b){if(typeof this._supportedAttributes[b]==="undefined"){this._supportedAttributes[b]=(b in document.createElement(a));OpenLayers.Console.info('Supported HTML5 attribute "'+b+'" on element "'+a+'": '+this._supportedAttributes[b])}return this._supportedAttributes[b]};Eniro.Util.HTML5.getAttribute=function(b,f){var c=null;if(b[f]){c=b[f]}else{if(b.attributes){var d;if(b.attributes.getNamedItem){d=b.attributes.getNamedItem(f)}else{for(var a=0,g=b.attributes.length;a<g;++a){if(b.attributes[a].nodeName&&b.attributes[a].nodeName.toLowerCase()===f){d=elements.attributes[a];break}}}if(d){c=d.nodeValue}}}return c};Eniro.l10n={_separators:{en:[true,",","."],sv_se:[true," ",","],no_no:[true," ",","],da_dk:[true," ",","],fi_fi:[true," ",","]},numberFormat:function(a,b){var c=new NumberFormat(a,b);c.setSeparators.apply(c,Eniro.l10n._separators[OpenLayers.Lang.getCode()]);return c}};Eniro.Events.MODE_SWITCH="modeSwitch";Eniro.Events.STATE_SAVING_MODE_SWITCH="stateSavingModeSwitch";Eniro.Events.ZOOM_TO_LEVEL="zoomToLevel";Eniro.Events.ZOOM_TO_EXTENT="zoomToExtent";Eniro.Events.SET_CENTER="setCenter";Eniro.Events.CHANGE_BASE_LAYER="changeBaseLayer";Eniro.Events.ROUTE_CLEAR="routeClear";Eniro.Events.ROUTE_SEARCH_DO="routeSearchDo";Eniro.Events.ROUTE_SEARCH_FAILURE="routeSearchFailure";Eniro.Events.ROUTE_FORM_PERFORM_SEARCH="routeFormPerformSearch";Eniro.Events.ROUTE_DESCRIPTION_AVAILABLE="routeDescriptionAvailable";Eniro.Events.ROUTE_GEOMETRY_AVAILABLE="routeGeometryAvailable";Eniro.Events.ROUTE_WAYPOINT_NAME_AVAILABLE="routeWaypointNameAvailable";Eniro.Events.ROUTE_WAYPOINT_DATA_SET="routeWaypointDataSet";Eniro.Events.ROUTE_WAYPOINTS_UPDATED="routeWaypointsUpdated";Eniro.Events.ROUTE_VIAPOINT_ADD="routeViapointAdd";Eniro.Events.ROUTE_VIAPOINT_ADD_AFTER="routeViapointAddAfter";Eniro.Events.ROUTE_VIAPOINT_REMOVE="routeViapointRemove";Eniro.Events.ROUTE_VIAPOINT_REMOVE_AFTER="routeViapointRemoveAfter";Eniro.Events.ROUTE_SET_START="routeSetStart";Eniro.Events.ROUTE_SET_END="routeSetEnd";Eniro.Events.ROUTE_SET_VIA="routeSetVia";Eniro.Events.ROUTE_MARKER_MOVING="routeMarkerMoving";Eniro.Events.ROUTE_MARKER_MOVED="routeMarkerMoved";Eniro.Events.ROUTE_MARKERS_CLEARED="routeMarkersCleared";Eniro.Events.ROUTE_OPTIONS_TOGGLED="routeOptionsToggled";Eniro.Events.ROUTE_OPTIONS_CHANGED="routeOptionsChanged";Eniro.Events.ROUTE_FORM_SET_OPTIONS="routeFormSetOptions";Eniro.Events.ROUTE_ZOOM_TO_EXTENT="routeZoomToExtent";Eniro.Events.ROUTE_ZOOM_TO_WAYPOINT="routeZoomToWaypoint";Eniro.Events.CHANGE_ROUTE_DIRECTION="changeRouteDirection";Eniro.Events.MENU_TAB_OPENED="menuTabOpened";Eniro.Events.OPEN_MENU_TAB="openMenuTab";Eniro.Events.ACTIVATE_TOOL="activateTool";Eniro.Events.DISABLE_TOOL="disableTool";Eniro.Events.ENABLE_TOOL="enableTool";Eniro.Events.TOOL_TOGGLED="toolToggled";Eniro.Events.ADD_MENU_ITEM="addMenuItem";Eniro.Events.REMOVE_MENU_ITEM="removeMenuItem";Eniro.Events.MOUSE_OVER_MENU_ITEM="mouseOverMenuItem";Eniro.Events.MOUSE_OUT_MENU_ITEM="mouseOutMenuItem";Eniro.Events.MOUSE_CLICK_MENU_ITEM="mouseClickMenuItem";Eniro.Events.CONVERT_MARKER="convertMarker";Eniro.Events.SEARCH_RESULT_AVAILABLE="searchResultAvailable";Eniro.Events.SEARCH_UPDATED="searchUpdated";Eniro.Events.SEARCH_DO="searchDo";Eniro.Events.SEARCH_REDO="searchRedo";Eniro.Events.SEARCH_CLEAR="searchClear";Eniro.Events.SEARCH_FORM_IN_SINGLE_HIT_MODE="searchFormInSingleHitMode";Eniro.Events.MAP_TYPES_UPDATE="mapTypesUpdate";Eniro.Events.SET_SEARCH_FIELDS="setSearchFields";Eniro.Events.SEARCH_RESTORE="searchRestore";Eniro.Events.SEARCH_SET_PREDEFINED_STATUS="searchSetPredefinedStatus";Eniro.Events.HISTORY_SAVE="historySave";Eniro.Events.HISTORY_BACK="historyBack";Eniro.Events.HISTORY_BACK_TO_SEARCH_RESULT="historyBackToSearchResult";Eniro.Events.HISTORY_FORWARD="historyForward";Eniro.Events.HISTORY_RESET="historyReset";Eniro.Events.SEARCH_SELECT_ITEM="searchSelectItem";Eniro.Events.POI_LAYER_ACTIVATE="poiLayerActivate";Eniro.Events.POI_LAYER_DEACTIVATE="poiLayerDeactivate";Eniro.Events.POI_LAYER_MOUSE_CLICK="poiLayerMouseClick";Eniro.Events.POI_LAYER_MOUSE_OVER="poiLayerMouseOver";Eniro.Events.POI_CLICK="poiClick";Eniro.Events.POI_CLUSTER_CLICK="poiClusterClick";Eniro.Events.POI_POPUP_CLOSE="poiPopupClose";Eniro.Events.POI_POPUP_ZOOM="poiPopupZoom";Eniro.Events.POI_DATASTORE_SUCCESS="poiDatastoreSuccess";Eniro.Events.POI_DATASTORE_FAILURE="poiDatastoreFailure";Eniro.Events.POI_DATASTORE_REGION="poiDatastoreRegion";Eniro.Events.ROUTE_DESCRIPTION_ITEM_MOUSE_OVER="routeDescriptionItemMouseOver";Eniro.Events.ROUTE_DESCRIPTION_ITEM_MOUSE_OUT="routeDescriptionItemMouseOut";Eniro.Events.ROUTE_DESCRIPTION_ITEM_CLICK="routeDescriptionItemClick";Eniro.Events.ROUTE_POPUP_INSTRUCTION_PREV="routePopupInstructionPrev";Eniro.Events.ROUTE_POPUP_INSTRUCTION_NEXT="routePopupInstructionNext";Eniro.Events.ROUTE_POPUP_CLOSE="routePopupClose";Eniro.Events.DRAW_DISTANCE_START="drawDistanceStart";Eniro.Events.DRAW_CONTROL_ACTIVATED="drawControlActivated";Eniro.Events.DRAW_DISTANCE_END="drawDistanceEnd";Eniro.Events.STREETVIEW_UPDATE="streetViewUpdate";Eniro.Events.STREETVIEW_FLASH_START="streetViewScripting";Eniro.Events.STREETVIEW_FLASH_FAILED="streetViewFailed";Eniro.Events.STREETVIEW_FLASH_LOADED="streetViewLoaded";Eniro.Events.STREETVIEW_FLASH_DIRECTION="streetViewDirection";Eniro.Events.STREETVIEW_FLASH_NAVIGATE="streetViewNavigate";Eniro.Events.STREETVIEW_FLASH_NAVIGATE3D="streetView3DNavigate";Eniro.Events.STREETVIEW_FLASH_EXTENT3D="streetView3DExtent";Eniro.Events.STREETVIEW_FLASH_CURSOR="streetViewCursor";Eniro.Events.STREETVIEW_LIST_SELECT="streetViewListSelect";Eniro.Events.STREETVIEW_FLASH_ADDED_TO_DOM="streetViewFlashAddedToDom";Eniro.Events.STREETVIEW_FLASH_MODECHANGED="streetViewModeChanged";Eniro.Events.OBLIQUE_ACTIVATING="onObliqueActivating";Eniro.Events.OBLIQUE_DEACTIVATING="onObliqueDeactivating";Eniro.Events.OBLIQUE_UPDATE="onObliqueUpdate";Eniro.Events.OBLIQUE_LIST_SELECT="onObliqueListSelect";Eniro.Events.OBLIQUE_ORIENTATION_SWITCH="onObliqueOrientationSwitch";Eniro.Events.OBLIQUE_MISSING="onObliqueMissing";Eniro.Events.OBLIQUE_COPYRIGHT="onObliqueCopyright";Eniro.Events.OBLIQUE_ORIENTATION_MOUSEOVER="onObliqueOrientationMouseOver";Eniro.Events.OBLIQUE_ORIENTATION_MOUSEOUT="onObliqueOrientationMouseOut";Eniro.Events.OBLIQUE_INITIALISING="onObliqueInitialising";Eniro.Events.OBLIQUE_IMAGE_CHANGING="onObliqueImageChanging";Eniro.Events.OBLIQUE_LAYER_UPDATED="onObliqueLayerUpdated";Eniro.Events.REQUEST_SUCCESS="requestSuccess";Eniro.Events.REQUEST_FAILURE="requestFailure";Eniro.Events.REQUEST_COMPLETE="requestComplete";Eniro.Events.REQUEST_BEFORE_SEND="requestBeforeSend";Eniro.Events.REQUEST_ABORT="requestAbort";Eniro.Events.PROGRESS_SHOW="progressShow";Eniro.Events.PROGRESS_HIDE="progressHide";Eniro.Events.POPUP_OPENING="onPopupOpening";Eniro.Events.POPUP_OPENED="onPopupOpened";Eniro.Events.POPUP_CLOSING="onPopupClosing";Eniro.Events.POPUP_CLOSED="onPopupClosed";Eniro.Events.OPEN_PRINT_PAGE="onPrint";Eniro.Events.STATISTICS_LOG="statisticsLog";Eniro.Events.PARTNER_SET="partnerSet";Eniro.Events.AD_CONTEXT_SET="adContextSet";Eniro.Events.AD_DIMENSION_CHANGED="adDimensionChanged";Eniro.Events.SPONSOR_AD_ACTIVATE="sponsorBannerActivate";Eniro.Events.EVENT_TYPES=[];for(var i in Eniro.Events){if(i!=="EVENT_TYPES"){Eniro.Events.EVENT_TYPES.push(Eniro.Events[i])}}if(OpenLayers.Events){Eniro.AppEvents=new OpenLayers.Events(window,null,Eniro.Events.EVENT_TYPES)}Eniro.Crypto={crc32Table:[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],toUnsigned32:function(a){return(a<0)?(4294967296+a):a},crc32:function(c){var d,b=4294967295,a=c.length;for(d=0;d<a;d++){b=Eniro.Crypto.toUnsigned32(Eniro.Crypto.crc32Table[Eniro.Crypto.toUnsigned32(b^c.charCodeAt(d))&255]^((b>>8)&16777215))}return Eniro.Crypto.toUnsigned32(b^4294967295)}};Eniro.Request.Parameters={};var query=window.location.search;if(query){query=query.substr(1);var pairs=query.split("&");var values,value;for(i=0,n=pairs.length;i<n;++i){values=pairs[i].split("=");try{value=decodeURIComponent(values[1])}catch(e1){try{value=unescape(values[1])}catch(e2){value=values[1]}}Eniro.Request.Parameters[values[0]]=value.replace(/\+/g," ")}}jQuery(function(){var r=Eniro.Request.Parameters;Eniro.debug=r.debug==="1"||r.debug==="true";if(Eniro.Profile.languageCode){OpenLayers.Lang.setCode(Eniro.Profile.languageCode)}if(Eniro.Profile.sellable&&Eniro.Profile.sellable.preDefinedYP&&Eniro.Init&&Eniro.Init.preDefinedYPOptions){Eniro.Profile.sellable.preDefinedYP.options=Eniro.Init.preDefinedYPOptions}if(!Eniro.Init){return false}function l(t,D){var z=t;if(!(/^OpenLayers\./).test(t)&&!(/^Eniro\./).test(t)){z="Eniro."+t}if(!D||!D.id){var A=z.split(".");var u=A.reverse().join(".");for(var B=0,v=A.length;B<v;++B){var C=u.split(".",(B+1)).reverse().join("");C=C.dash().toUpperCase().replace(/-/g,"_");if(Eniro.ControlID[C]){D=D||{};D.id=Eniro.ControlID[C];break}}}var w=Eniro.Util.getClass(z);return new w(D)}function g(B){var C=true;var L,G,K,I;var z,M,F;var O=[];var w=[];var N={left:[],center:[],right:[]};var A=["left","center","right"];var J=false;var D,u,t;D=B.requestParameterTrigger;if(D){for(L=0,G=D.keys.length;L<G;++L){u=D.keys[L];t=D.values[L];if(t==="*"&&r[u]){J=true}else{if(t===null&&!r[u]){J=true}else{if(r[u]&&t===r[u]){J=true}}}}}else{J=true}if(!J){return null}var v;if(typeof B!=="string"){if(B.controls){if(Eniro.Util.isArray(B.controls)&&B.controls.length>0){for(L=0,G=B.controls.length;L<G;++L){v=g(B.controls[L]);if(v!==null){O.push(v)}}}else{if(B.controls.left||B.controls.center||B.controls.right){var E;for(L=0,G=A.length;L<G;++L){E=B.controls[A[L]];if(E&&E.length>0){for(K=0,I=E.length;K<I;++K){v=g(E[K]);if(v!==null){N[A[L]].push(v)}}}}}}}if(B.customControls&&B.customControls.length>0){for(L=0,G=B.customControls.length;L<G;++L){v=g(B.customControls[L]);if(v!==null){w.push(v)}}}}M=B;if(typeof B==="object"&&B.className){M=B.className;F=B.options||{};if(!F.id&&B.idKey){F.id=Eniro.ControlID[B.idKey]}if(B.activate===false){C=false}}z=l(M,F);var H;for(L=0,G=A.length;L<G;++L){H=N[A[L]];if(H.length>0){for(K=0,I=H.length;K<I;++K){z["add"+A[L].substr(0,1).toUpperCase()+A[L].substr(1)+"Control"](H[K])}}}if(O.length>0){for(L=0,G=O.length;L<G;++L){z.addControl(O[L])}}if(w.length>0){for(L=0,G=w.length;L<G;++L){z.addCustomControl(w[L])}}z._activateOnInit=C;return z}var p,f,o,k;if(Eniro.Init.observers){for(p in Eniro.Init.observers){if(Eniro.Init.observers.hasOwnProperty(p)){for(o in Eniro.Init.observers[p]){var d=jQuery(p).get(0);if(d){OpenLayers.Event.observe(d,o,Eniro.Util.getClass(Eniro.Init.observers[p][o]))}}}}}Eniro.map=new Eniro.Map("mymap");Eniro.map.historyController=new Eniro.HistoryController(Eniro.map.stateController);if(Eniro.Profile.controls.length>0){var q=[];var h=false;for(p=0,f=Eniro.Profile.controls.length;p<f;++p){h=g(Eniro.Profile.controls[p]);if(h){q.push(h)}}for(p=0,f=q.length;p<f;++p){Eniro.map.addControl(q[p])}for(p=0,f=q.length;p<f;++p){if(q[p]._activateOnInit){q[p].activate()}}}var s=[Eniro.map.getControl(Eniro.ControlID.TABNAVIGATOR_MAIN),Eniro.map.getControl(Eniro.ControlID.LAYERBAR),Eniro.map.getControl(Eniro.ControlID.CONTROLBAR_ZOOM)];Eniro.map.setOffsetControls.apply(Eniro.map,s);var a=r.ax||r.partner||r.partner_id||r.click_id||r.clickid;if(a){Eniro.AppEvents.triggerEvent(Eniro.Events.PARTNER_SET,a);Eniro.AppEvents.triggerEvent(Eniro.Events.STATISTICS_LOG,{scope:"init",event:"startup",data:{partner:a}})}Eniro.map.reset();Eniro.map.stateController.register("init",100,{saveState:function(){return null},applyState:function(){},applyStateComplete:function(){Eniro.map.displayLayersVisibleFromStart()}});if(Eniro.Init.stateId){Eniro.map.stateController.restore(Eniro.Init.stateId)}else{if(Eniro.Init.translation){var c=new Eniro.RequestWatcher(OpenLayers.Function.bind(Eniro.map.displayLayersVisibleFromStart,Eniro.map));c.start();var b=Eniro.map.getControl(Eniro.ControlID.URL_TRANSLATOR_CONTROLLER);b.translate(Eniro.Init.translation,Eniro.Init.translationType);c.stop()}else{if(!Eniro.Init.delegatedInit){Eniro.map.displayLayersVisibleFromStart()}}}Eniro.map.updateSize({type:"resize"})});Eniro.Control=OpenLayers.Class(OpenLayers.Control,{CSS_CLASS_NAME:undefined,ignoreHandlers:true,allowSelection:true,cssClasses:{},elements:{},initialize:function(){this.cssClasses={};this.elements={};if(!this.id){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME.replace(/\./g,"")+"_")}OpenLayers.Control.prototype.initialize.apply(this,arguments)},getCssClassName:function(b,c,a){return Eniro.Util.getCssClassName(this,b,c,a)},getSingleCssClassName:function(b,c,a){return Eniro.Util.getSingleCssClassName(this,b,c,a)},destroy:function(){if(this.elements){for(var a in this.elements){if(this.elements.hasOwnProperty(a)){this.elements[a]=null;delete this.elements[a]}}this.elements=null}if(this.cssClasses){this.cssClasses=null}if(this.div){OpenLayers.Event.stopObservingElement(this.div);this.div.innerHTML=""}if(this.divEvents){this.divEvents.destroy()}OpenLayers.Control.prototype.destroy.apply(this,arguments);if(this.div&&this.div.parentNode){this.div.parentNode.removeChild(this.div)}},observe:function(b,c,a){OpenLayers.Event.observe(b,c,OpenLayers.Function.bindAsEventListener(a,this))},triggerEvent:function(a,b){Eniro.AppEvents.triggerEvent(a,b)},on:function(a){Eniro.AppEvents.on(a)},register:function(a,b){Eniro.AppEvents.register(a,this,b)},registerPriority:function(a,b){Eniro.AppEvents.registerPriority(a,this,b)},unregister:function(a,b){Eniro.AppEvents.unregister(a,this,b)},un:function(a){Eniro.AppEvents.un(a)},draw:function(a){if(!this.div){this.div=this.createDiv(this.id.replace(/\./g,""),"",this.title,!this.allowSelection)}if(a){this.position=a.clone()}if(this.position){this.moveTo(this.position)}if(this.ignoreHandlers&&this.div){jQuery(this.div).addClass("olEniroIgnoreHandlers")}return this.div},toString:function(){return this.CLASS_NAME+":"+this.id},i18n:function(b,a){if(!this.i18nExclude){b=this.CLASS_NAME.dash()+"."+b}if(this.parent){return this.parent.i18n(b,a)}return OpenLayers.i18n(b.replace(/\.-/g,".").replace(/^eniro-|^eniro\.|\beniro-|\beniro\./g,""),a)},stopEvent:function(a){this.warn("Deprecated method. Use OpenLayers.Event#stop instead.");OpenLayers.Event.stop(a)},assignElements:function(f){var g;var b,h;var c=[];if(f){c=(typeof f==="string")?[f]:f}else{for(b in this.cssClasses){if(this.cssClasses.hasOwnProperty(b)){c.push(b)}}}var a;for(b=0,h=c.length;b<h;++b){a=c[b];g=this.cssClasses[a].split(" ");var d=jQuery(this.div).find("."+g[g.length-1]);if(d.size()>0){this.elements[a]=d.get();if(this.elements[a].length===1){this.elements[a]=this.elements[a][0]}}}},registerObservers:function(){if(this.ignoreHandlers&&this.div){this.observe(this.div,"keydown",this.onKeyDown)}},activate:function(){if(OpenLayers.Control.prototype.activate.apply(this,arguments)){this.assignElements();if(this.ignoreHandlers&&this.div){jQuery(this.div).addClass("olEniroIgnoreHandlers")}this.registerObservers();return true}return false},deactivate:function(){delete this.elements;if(this.div){OpenLayers.Event.stopObservingElement(this.div)}return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},log:function(){var a=Array.prototype.slice.call(arguments);OpenLayers.Console.log.apply(OpenLayers.Console,[this.toString()].concat(a))},onKeyDown:function(a){switch(a.keyCode){case (OpenLayers.Event.KEY_LEFT):OpenLayers.Event.stop(a,true);break;case (OpenLayers.Event.KEY_RIGHT):OpenLayers.Event.stop(a,true);break;case 38:OpenLayers.Event.stop(a,true);break;case 40:OpenLayers.Event.stop(a,true);break;case 33:OpenLayers.Event.stop(a,true);break;case 34:OpenLayers.Event.stop(a,true);break;case 35:OpenLayers.Event.stop(a,true);break;case 36:OpenLayers.Event.stop(a,true);break;case 107:OpenLayers.Event.stop(a,true);break;case 109:OpenLayers.Event.stop(a,true);break}},error:function(){var a=Array.prototype.slice.call(arguments);OpenLayers.Console.error.apply(OpenLayers.Console,[this.toString()].concat(a))},debug:function(){var a=Array.prototype.slice.call(arguments);OpenLayers.Console.debug.apply(OpenLayers.Console,[this.toString()].concat(a))},warn:function(){var a=Array.prototype.slice.call(arguments);OpenLayers.Console.warn.apply(OpenLayers.Console,[this.toString()].concat(a))},createDiv:function(d,a,c,b){return Eniro.Util.createDiv(d,this.getCssClassName(a),c,b)},find:function(a){OpenLayers.Console.warn("Deprecated method #find. Use jQuery#find() directly instead.");return jQuery(this.div).find(a)[0]},findAll:function(a){OpenLayers.Console.warn("Deprecated method #findAll. Use jQuery#findAll() directly instead.");return jQuery(this.div).find(a)},insertBefore:function(a,b){OpenLayers.Console.warn("Deprecated method #insertBefore. Use jQuery#insertBefore() directly instead.");jQuery(a).insertBefore(b)},insertAfter:function(a,b){OpenLayers.Console.warn("Deprecated method #insertAfter. Use jQuery#insertAfter directly instead.");jQuery(a).insertAfter(b)},closest:function(b,a){OpenLayers.Console.warn("Deprecated method #closest. Use jQuery#closest directly instead.");return jQuery(b).closest(a)[0]},toggleClass:function(a,b){OpenLayers.Console.warn("Deprecated method #toggleClass. Use jQuery#toggleClass directly instead.");jQuery(a).toggleClass(b)},addClass:function(a,b){OpenLayers.Console.warn("Deprecated method #addClass. Use jQuery#addClass directly instead.");jQuery(a).addClass(b)},removeClass:function(a,b){OpenLayers.Console.warn("Deprecated method #removeClass. Use jQuery#removeClass directly instead.");jQuery(a).removeClass(b)},remove:function(a){OpenLayers.Console.warn("Deprecated method #remove. Use jQuery#remove directly instead.");jQuery(a).remove()},findMatchingClass:function(a,b){OpenLayers.Console.warn("Deprecated method #findMatchingClass. Use jQuery.grep directly instead.");return jQuery.grep(a.className.split(" "),function(c){if(c.match(b)){return c}else{return null}})[0]},CLASS_NAME:"Eniro.Control"});Eniro.EventLogger=OpenLayers.Class(Eniro.Control,{logEvents:Eniro.Events.EVENT_TYPES,initialize:function(a){Eniro.Control.prototype.initialize.apply(this,arguments);this.init(a)},init:function(b){if(b){if(typeof b==="string"){this.logEvents=[b]}else{if(Eniro.Util.isArray(b)){this.logEvents=b}}}for(var a=0,c=this.logEvents.length;a<c;a++){this.registerPriority(this.logEvents[a],this.dump(this.logEvents[a]))}},dump:function(a){return function(b){OpenLayers.Console.log("eventName "+a,", eventArg: ",b)}},draw:function(){return null},CLASS_NAME:"Eniro.EventLogger"});Eniro.ScaleLine=OpenLayers.Class(OpenLayers.Control.ScaleLine,{maxWidth:200,bottomOutUnits:"",bottomInUnits:"",initialize:function(){OpenLayers.Control.ScaleLine.prototype.initialize.apply(this,arguments);Eniro.AppEvents.register(Eniro.Events.MODE_SWITCH,this,this.onModeSwitch)},onModeSwitch:function(a){if(a.mode==="streetview"||a.mode==="oblique"){jQuery(this.div).hide()}else{jQuery(this.div).show()}},getResolution:function(a,b){return this.map.maxResolution*Math.cos(OpenLayers.Util.rad(b))/Math.pow(2,a)},draw:function(){this.div=null;OpenLayers.Control.ScaleLine.prototype.draw.apply(this,arguments)},update:function(){var r=this.map.getZoom();var a=this.map.getCenter();if(!r||!a){return}a=a.transform(this.map.getProjectionObject(),this.map.backendProjection);var l=this.getResolution(r,a.lat);if(!l){return}var s=this.map.getUnits();var d=OpenLayers.INCHES_PER_UNIT;var p=this.maxWidth*l*d[s];var b;var f;if(p>100000){b=this.topOutUnits;f=this.bottomOutUnits}else{b=this.topInUnits;f=this.bottomInUnits}var h=p/d[b];var o=p/d[f];var k=this.getBarLen(h);var g=this.getBarLen(o);h=k/d[s]*d[b];o=g/d[s]*d[f];var c=h/l;var q=o/l;if(this.eBottom.style.visibility=="visible"){this.eBottom.style.width=Math.round(q)+"px";this.eBottom.innerHTML=g+" "+f}if(this.eTop.style.visibility=="visible"){this.eTop.style.width=Math.round(c)+"px";this.eTop.innerHTML=k+" "+b}},CLASS_NAME:"Eniro.ScaleLine"});Eniro.Control.FeatureEventDispatcher=OpenLayers.Class(OpenLayers.Control,{isStart:true,initialize:function(b,a){OpenLayers.Control.prototype.initialize.apply(this,[a]);this.layer=b;this.dragCallbacks={down:this.downFeature,move:this.moveFeature,up:this.upFeature,out:this.cancel,done:this.doneDragging};this.selectCallbacks={click:this.clickFeature,clickout:this.clickoutFeature,over:this.overFeature,out:this.outFeature};this.handlers={drag:new OpenLayers.Handler.Drag(this,this.dragCallbacks),feature:new OpenLayers.Handler.Feature(this,this.layer,this.selectCallbacks)}},destroy:function(){this.layer=null;this.feature=null;this.dragging=false;this.lastPixel=null;for(var b in this.dragCallbacks){if(this.dragCallbacks.hasOwnProperty(b)){this.dragCallbacks[b]=null}}for(var a in this.selectCallbacks){if(this.selectCallbacks.hasOwnProperty(a)){this.selectCallbacks[a]=null}}OpenLayers.Control.prototype.destroy.apply(this,arguments)},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.handlers.feature.setMap(a);this.handlers.drag.setMap(a)},activate:function(){return(this.handlers.feature.activate()&&OpenLayers.Control.prototype.activate.apply(this,arguments))},deactivate:function(){this.feature=null;this.dragging=false;this.lastPixel=null;return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},clickFeature:function(a){this.dispatchEvent(a,"click")},clickoutFeature:function(a){this.dispatchEvent(a,"clickout")},overFeature:function(a){if(a.draggable){if(!this.handlers.drag.dragging){this.feature=a;this.handlers.drag.activate();this.over=true;this.map.div.style.cursor="move"}else{if(this.feature.id==a.id){this.over=true}else{this.over=false}}}else{this.map.div.style.cursor="pointer"}this.dispatchEvent(a,"mouseover")},outFeature:function(a){if(a.draggable){if(!this.handlers.drag.dragging){this.over=false;this.handlers.drag.deactivate();this.feature=null}else{if(this.feature.id==a.id){this.over=false}}}this.map.div.style.cursor="default";this.dispatchEvent(a,"mouseout")},downFeature:function(a){this.lastPixel=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;if(this.isStart){this.dispatchEvent(this.feature,"dragstart",{pixel:a});this.isStart=false}else{this.dispatchEvent(this.feature,"dragmove",{pixel:a})}},upFeature:function(a){this.isStart=true},doneDragging:function(a){this.dispatchEvent(this.feature,"dragend",{pixel:a})},cancel:function(){this.handlers.drag.deactivate();this.over=false},dispatchEvent:function(a,b,d){if(a.events){var c={type:b,feature:a,dispatcher:this};OpenLayers.Util.extend(c,d);a.events.triggerEvent(b,c)}},draw:function(){return null},CLASS_NAME:"Eniro.Control.FeatureEventDispatcher"});Eniro.ShowOnMapControl=OpenLayers.Class(Eniro.Control,{wfsURL:null,minZoom:4,maxFeatures:3,layers:[],subLayers:[],clickHandler:null,popup:null,mouseLoc:null,visibleLayers:[],initialize:function(v){this.wfsURL=Eniro.AppNode.appUrl("/geoserver/wfs");v=v||{};Eniro.Control.prototype.initialize.apply(this,[v]);this.layers=[];if(Eniro.Profile&&Eniro.Profile.showOnMap&&Eniro.Profile.showOnMap.layers&&Eniro.Profile.showOnMap.layers.length>0){var g=this;if(Eniro.Profile.showOnMap.hemnet){this.hemnetLayer=new Eniro.Layer.Hemnet("hemnet",Eniro.AppNode.tileUrl("/hmn/tile"));var r=this.getCssClassName("hemnet-div");this.cssClasses.hemnetDiv=r;this.hemnetFakeLayer={};this.hemnetFakeLayer={id:"hemnet",visible:false,control:g,hemnetHouseItemActiveClass:"",hemnetHouseItemClass:"",hemnetFlatItemActiveClass:"",hemnetFlatItemClass:"",hemnetCottageItemActiveClass:"",hemnetCottageItemClass:"",flatSelected:false,houseSelected:false,cottageSelected:false,getVisibility:OpenLayers.Function.bind(function(){return this.hemnetFakeLayer.visible},this),setVisibility:OpenLayers.Function.bind(function(o){if(o){this.hemnetFakeLayer.visible=true;g.updateHemnetLayers(g.hemnetFakeLayer)}else{this.hemnetFakeLayer.visible=false;g.hideHemnetLayers()}},this),draw:function(){this.hemnetHouseItemActiveClass=g.getSingleCssClassName("hemnet-list-item",null,{id:"house",selected:true});this.hemnetHouseItemClass=g.getCssClassName("hemnet-list-item",null,{id:"house"});this.hemnetFlatItemActiveClass=g.getSingleCssClassName("hemnet-list-item",null,{id:"flat",selected:true});this.hemnetFlatItemClass=g.getCssClassName("hemnet-list-item",null,{id:"flat"});this.hemnetCottageItemActiveClass=g.getSingleCssClassName("hemnet-list-item",null,{id:"cottage",selected:true});this.hemnetCottageItemClass=g.getCssClassName("hemnet-list-item",null,{id:"cottage"});this.hemnetSelectProblem=g.getCssClassName("hemnet-select-problem");var o=['<div class="',r,'">','<ul class="',g.getCssClassName("item-hemnet-list"),'">','<li class="',this.hemnetHouseItemClass,'">','<a href="/'+new Date().getTime()+'"><span>'+g.i18n("hemnet_house")+"</span></a>","</li>",'<li class="',this.hemnetFlatItemClass,'">','<a href="/'+new Date().getTime()+'"><span>'+g.i18n("hemnet_flat")+"</span></a>","</li>",'<li class="',this.hemnetCottageItemClass,'">','<a href="/'+new Date().getTime()+'"><span>'+g.i18n("hemnet_cottage")+"</span></a>","</li>","</ul>","<form>",'<select class="',g.getCssClassName("hemnet-left-select"),'" name="hemnetSelect1">','<option value="0">0 ',g.i18n("hemnet_price_unit"),"</option>",'<option value="100000">100 ',g.i18n("hemnet_price_kunit"),"</option>",'<option value="200000">200 ',g.i18n("hemnet_price_kunit"),"</option>",'<option value="300000">300 ',g.i18n("hemnet_price_kunit"),"</option>",'<option value="500000">500 ',g.i18n("hemnet_price_kunit"),"</option>",'<option value="1000000">1 ',g.i18n("hemnet_price_munit"),"</option>",'<option value="2000000">2 ',g.i18n("hemnet_price_munit"),"</option>",'<option value="3000000">3 ',g.i18n("hemnet_price_munit"),"</option>",'<option value="4000000">4 ',g.i18n("hemnet_price_munit"),"</option>",'<option value="5000000">5 ',g.i18n("hemnet_price_munit"),"</option>",'<option value="8000000">8 ',g.i18n("hemnet_price_munit"),"</option>","</select>-",'<select class="',g.getCssClassName("hemnet-right-select"),'" name="hemnetSelect2">','<option value="0">0 ',g.i18n("hemnet_price_unit"),"</option>",'<option value="100000">100 ',g.i18n("hemnet_price_kunit"),"</option>",'<option value="200000">200 ',g.i18n("hemnet_price_kunit"),"</option>",'<option value="300000">300 ',g.i18n("hemnet_price_kunit"),"</option>",'<option value="500000">500 ',g.i18n("hemnet_price_kunit"),"</option>",'<option value="1000000">1 ',g.i18n("hemnet_price_munit"),"</option>",'<option value="2000000">2 ',g.i18n("hemnet_price_munit"),"</option>",'<option value="3000000">3 ',g.i18n("hemnet_price_munit"),"</option>",'<option value="4000000">4 ',g.i18n("hemnet_price_munit"),"</option>",'<option value="5000000">5 ',g.i18n("hemnet_price_munit"),"</option>",'<option value="8000000">8 ',g.i18n("hemnet_price_munit"),"</option>",'<option value="100000000" selected="selected">+8 ',g.i18n("hemnet_price_munit"),"</option>","</select>",'<select class="',g.getCssClassName("hemnet-left-select"),'" name="hemnetSelect3">','<option value="0">0 ',g.i18n("hemnet_space_unit"),"</option>",'<option value="50">50 ',g.i18n("hemnet_space_unit"),"</option>",'<option value="70">70 ',g.i18n("hemnet_space_unit"),"</option>",'<option value="100">100 ',g.i18n("hemnet_space_unit"),"</option>",'<option value="150">150 ',g.i18n("hemnet_space_unit"),"</option>",'<option value="250">250 ',g.i18n("hemnet_space_unit"),"</option>","</select>-",'<select class="',g.getCssClassName("hemnet-right-select"),'" name="hemnetSelect4">','<option value="0">0 ',g.i18n("hemnet_space_unit"),"</option>",'<option value="50">50 ',g.i18n("hemnet_space_unit"),"</option>",'<option value="70">70 ',g.i18n("hemnet_space_unit"),"</option>",'<option value="100">100 ',g.i18n("hemnet_space_unit"),"</option>",'<option value="150">150 ',g.i18n("hemnet_space_unit"),"</option>",'<option value="250">250 ',g.i18n("hemnet_space_unit"),"</option>",'<option value="1000000" selected="selected">+250 ',g.i18n("hemnet_space_unit"),"</option>","</select>",'<select class="',g.getCssClassName("hemnet-left-select"),'" name="hemnetSelect5">','<option value="1">1 ',g.i18n("hemnet_rooms_unit"),"</option>",'<option value="2">2 ',g.i18n("hemnet_rooms_unit"),"</option>",'<option value="3">3 ',g.i18n("hemnet_rooms_unit"),"</option>",'<option value="4">4 ',g.i18n("hemnet_rooms_unit"),"</option>",'<option value="5">5 ',g.i18n("hemnet_rooms_unit"),"</option>",'<option value="6">6 ',g.i18n("hemnet_rooms_unit"),"</option>",'<option value="7">7 ',g.i18n("hemnet_rooms_unit"),"</option>",'<option value="8">8 ',g.i18n("hemnet_rooms_unit"),"</option>","</select>-",'<select class="',g.getCssClassName("hemnet-right-select"),'" name="hemnetSelect6">','<option value="1">1 ',g.i18n("hemnet_rooms_unit"),"</option>",'<option value="2">2 ',g.i18n("hemnet_rooms_unit"),"</option>",'<option value="3">3 ',g.i18n("hemnet_rooms_unit"),"</option>",'<option value="4">4 ',g.i18n("hemnet_rooms_unit"),"</option>",'<option value="5">5 ',g.i18n("hemnet_rooms_unit"),"</option>",'<option value="6">6 ',g.i18n("hemnet_rooms_unit"),"</option>",'<option value="7">7 ',g.i18n("hemnet_rooms_unit"),"</option>",'<option value="8">8 ',g.i18n("hemnet_rooms_unit"),"</option>",'<option value="1000" selected="selected">+8 ',g.i18n("hemnet_rooms_unit"),"</option>","</select>","</form>","</div>"].join("");return o},showLayer:OpenLayers.Function.bind(function(){this.setVisibility(true)}),hideLayer:OpenLayers.Function.bind(function(){if(this.getVisibility()){this.setVisibility(false)}})};this.layers.push(this.hemnetFakeLayer)}if(Eniro.Profile.showOnMap.trafficLayers){var q;for(var h=0,d=Eniro.Profile.showOnMap.trafficLayers.length;h<d;++h){q=Eniro.Profile.showOnMap.trafficLayers[h];this.subLayers.push(new Eniro.Layer.ShowOnMap[q]())}this.trafficLayer={id:"traffic",visible:false,control:g,disturbanceSelected:false,tollSelected:false,roadcamSelected:false,speedcamSelected:false,reststopSelected:false,getVisibility:OpenLayers.Function.bind(function(){return this.trafficLayer.visible},this),setVisibility:OpenLayers.Function.bind(function(o){if(o){this.trafficLayer.visible=true;g.showTrafficLayers()}else{this.trafficLayer.visible=false;g.hideTrafficLayers()}},this),draw:function(){this.trafficDisturbanceItemActiveClass=g.getSingleCssClassName("traffic-list-item",null,{id:"disturbance",selected:true});this.trafficDisturbanceItemClass=g.getCssClassName("traffic-list-item",null,{id:"disturbance"});this.trafficTollItemActiveClass=g.getSingleCssClassName("traffic-list-item",null,{id:"toll",selected:true});this.trafficTollItemClass=g.getCssClassName("traffic-list-item",null,{id:"toll"});this.trafficRoadcamItemActiveClass=g.getSingleCssClassName("traffic-list-item",null,{id:"roadcam",selected:true});this.trafficRoadcamItemClass=g.getCssClassName("traffic-list-item",null,{id:"roadcam"});this.trafficSpeedcamItemActiveClass=g.getSingleCssClassName("traffic-list-item",null,{id:"speedcam",selected:true});this.trafficSpeedcamItemClass=g.getCssClassName("traffic-list-item",null,{id:"speedcam"});this.trafficReststopItemActiveClass=g.getSingleCssClassName("traffic-list-item",null,{id:"reststop",selected:true});this.trafficReststopItemClass=g.getCssClassName("traffic-list-item",null,{id:"reststop"});var o=["<div>",'<ul class="',g.getCssClassName("item-traffic-list"),'">','<li class="',this.trafficDisturbanceItemClass,'">','<a href="/'+new Date().getTime()+'"><span>'+g.i18n("se_traffic")+"</span></a>","</li>",'<li class="',this.trafficTollItemClass,'">','<a href="/'+new Date().getTime()+'"><span>'+g.i18n("se_toll")+"</span></a>","</li>",'<li class="',this.trafficRoadcamItemClass,'">','<a href="/'+new Date().getTime()+'"><span>'+g.i18n("se_camera")+"</span></a>","</li>",'<li class="',this.trafficSpeedcamItemClass,'">','<a href="/'+new Date().getTime()+'"><span>'+g.i18n("se_speedcamera")+"</span></a>","</li>",'<li class="',this.trafficReststopItemClass,'">','<a href="/'+new Date().getTime()+'"><span>'+g.i18n("se_reststop")+"</span></a>","</li>","</ul>","</div>"].join("");return o},showLayer:OpenLayers.Function.bind(function(){this.setVisibility(true)}),hideLayer:OpenLayers.Function.bind(function(){if(this.getVisibility()){this.setVisibility(false)}})};this.layers.push(this.trafficLayer)}var b;for(var f=0,a=Eniro.Profile.showOnMap.layers.length;f<a;++f){b=Eniro.Profile.showOnMap.layers[f];this.layers.push(new Eniro.Layer.ShowOnMap[b]())}if(Eniro.Profile.id==="se"){var u=this.i18n("election_heading_parliament");var k=this.i18n("election_parliament");var p=this.i18n("election_municipality");var c=this.i18n("election_district");var s=this.i18n("election_heading_municipality");var t=this.i18n("election_municipality_district");var l=this.getCssClassName("election-div");this.electionLayers={parliamentDivision:new Eniro.Layer.Election.ParliamentDivision(),parliamentMunicipal:new Eniro.Layer.Election.ParliamentMunicipal(),parliamentDistrict:new Eniro.Layer.Election.ParliamentDistrict()};this.electionLayer=this.electionLayers.parliamentDistrict;this.electionFakeLayer={id:"election",visible:false,control:g,getVisibility:OpenLayers.Function.bind(function(){return this.electionFakeLayer.visible},this),setVisibility:OpenLayers.Function.bind(function(o){if(o){this.electionFakeLayer.visible=true;g.showElectionLayer()}else{this.electionFakeLayer.visible=false;g.hideElectionLayer()}},this),draw:function(){var o=['<div class="',l,'">',"<fieldset>","<legend>",u,"</legend>",'<label><input type="radio" id="',g.electionLayers.parliamentDistrict.name,'_radio" checked="checked" name="election" value="parliamentDistrict">',c,"</label>",'<label><input type="radio" id="',g.electionLayers.parliamentMunicipal.name,'_radio" name="election" value="parliamentMunicipal">',p,"</label>",'<label><input type="radio" id="',g.electionLayers.parliamentDivision.name,'_radio" name="election" value="parliamentDivision">',k,"</label>","</fieldset>","</div>"].join("");return o},showLayer:OpenLayers.Function.bind(function(){this.setVisibility(true)}),hideLayer:OpenLayers.Function.bind(function(){if(this.getVisibility()){this.setVisibility(false)}})};this.layers.push(this.electionFakeLayer)}if(Eniro.Profile.id==="se_hemnet"||Eniro.Profile.id==="se_kommersiella"){this.layers.push({id:"restaurants",getVisibility:OpenLayers.Function.bind(function(){return this._restaurantsVisible},this),setVisibility:OpenLayers.Function.bind(function(o){this._restaurantsVisible=o;if(o){this.triggerEvent(Eniro.Events.SEARCH_DO,{p:"yp_se",ap:"yp_se",q:"Restauranger",pageSize:25})}else{this.triggerEvent(Eniro.Events.SEARCH_CLEAR)}},this)})}else{this.layers.push({id:"gps",getVisibility:OpenLayers.Function.bind(function(){var o=this.map.getControl(Eniro.ControlID.GPS);return o&&o.active},this),setVisibility:OpenLayers.Function.bind(function(o){var w=this.map.getControl(Eniro.ControlID.GPS);if(o){if(w.activate()){w.updatePosition(this.map.getCenter())}}else{w.deactivate()}},this)})}this.clickHandler=new OpenLayers.Handler.Click(this,{click:this.handleClick});this.register(Eniro.Events.MODE_SWITCH,this.onModeSwitch)}else{return false}},showElectionLayer:function(){if(this.electionLayer){this.showLayer(this.electionLayer)}},hideElectionLayer:function(){if(this.electionLayer){this.hideLayer(this.electionLayer)}},activate:function(){if(Eniro.Control.prototype.activate.apply(this,arguments)){if(this.clickHandler){this.clickHandler.activate()}if(Eniro.Profile.showOnMap&&Eniro.Profile.showOnMap.hemnet){this.showLayer(this.getLayerById("hemnet"))}return true}return false},deactivate:function(){if(Eniro.Control.prototype.deactivate.apply(this,arguments)){this.clickHandler.deactivate();return true}return false},registerObservers:function(){this.observe(this.div,"click",this.onClick);if(this.elements&&this.elements.hemnetDiv){var d=jQuery(this.elements.hemnetDiv).find("select");var c=this.getLayerById("hemnet");for(var b=0,f=d.length;b<f;++b){var a=d[b];this.registerObserver(a,c)}}},registerObserver:function(a,b){this.observe(a,"change",OpenLayers.Function.bind(function(){this.updateHemnetLayers(b)},this))},onModeSwitch:function(b){var a,c;if(b.mode==="streetview"||b.mode==="oblique"){jQuery(this.div).hide();if(this.visibleLayers.length===0){this.visibleLayers=this.getVisibleLayers()}for(a=0,c=this.layers.length;a<c;++a){if(this.layers[a].map){this.hideLayer(this.layers[a])}}this.hideElectionLayer()}else{jQuery(this.div).show();for(a=0,c=this.visibleLayers.length;a<c;++a){this.showLayer(this.visibleLayers[a])}this.visibleLayers=[]}},onClick:function(c){var d=this.doOnClick(c);var b=this.getVisibleLayers();var g=[];for(var f=0,a=b.length;f<a;f++){g.push(b[f].layername)}Eniro.AppEvents.triggerEvent(Eniro.Events.STATISTICS_LOG,{scope:"content",event:"showonmap",data:{layers:g}});return d},doOnClick:function(c){var h=OpenLayers.Event.element(c);var b=jQuery(h).parents("li:eq(0)");if(b.size()>0){if(b.get(0)===this.elements.header){OpenLayers.Event.stop(c);jQuery(this.elements.list).toggle();jQuery(this.elements.header).toggleClass(this.headerActiveClass);return false}else{if(jQuery.inArray(b.get(0),(Eniro.Util.isArray(this.elements.item)?this.elements.item:[this.elements.item]))>=0){if(jQuery(c.target).is("div")||jQuery(c.target).is("fieldset")||jQuery(c.target).is("legend")||jQuery(c.target).is("form")){return false}if(jQuery(h).is("label")){h=jQuery(h).find("input").get(0)}if(jQuery(h).is("option")||jQuery(h).is("select")){}else{if(this.electionLayer&&jQuery(h).is("input[type=radio]")){var a=this.electionLayers[h.value];if(a&&a!==this.electionLayer){this.hideElectionLayer();this.electionLayer=a;this.showElectionLayer()}}else{OpenLayers.Event.stop(c);var f=b.parent().children().index(b);var g=this.layers[f];var k=g.getVisibility();if(g.name){k=k&&this.map.getLayersByName(g.name).length>0}if(k){this.hideLayer(g)}else{this.showLayer(g)}}}return false}else{if(jQuery(this.elements.item).find("li").size()>0){OpenLayers.Event.stop(c);var d;if(jQuery(h).closest("li.eniro-showonmapcontrol-hemnet-list-item-flat").size()>0){d=this.getLayerById("hemnet");if(d.flatSelected===true){jQuery(b).removeClass(d.hemnetFlatItemActiveClass);d.flatSelected=false}else{jQuery(b).addClass(d.hemnetFlatItemActiveClass);d.flatSelected=true}this.updateHemnetLayers(d)}else{if(jQuery(h).closest("li.eniro-showonmapcontrol-hemnet-list-item-house").size()>0){d=this.getLayerById("hemnet");if(d.houseSelected===true){jQuery(b).removeClass(d.hemnetHouseItemActiveClass);d.houseSelected=false}else{jQuery(b).addClass(d.hemnetHouseItemActiveClass);d.houseSelected=true}this.updateHemnetLayers(d)}else{if(jQuery(h).closest("li.eniro-showonmapcontrol-hemnet-list-item-cottage").size()>0){d=this.getLayerById("hemnet");if(d.cottageSelected===true){jQuery(b).removeClass(d.hemnetCottageItemActiveClass);d.cottageSelected=false}else{jQuery(b).addClass(d.hemnetCottageItemActiveClass);d.cottageSelected=true}this.updateHemnetLayers(d)}else{if(jQuery(h).closest("li.eniro-showonmapcontrol-traffic-list-item-disturbance").size()>0){d=this.trafficLayer;if(d.disturbanceSelected===true){jQuery(b).removeClass(d.trafficDisturbanceItemActiveClass);d.disturbanceSelected=false}else{jQuery(b).addClass(d.trafficDisturbanceItemActiveClass);d.disturbanceSelected=true}this.showTrafficLayers()}else{if(jQuery(h).closest("li.eniro-showonmapcontrol-traffic-list-item-toll").size()>0){d=this.getLayerById("traffic");if(d.tollSelected===true){jQuery(b).removeClass(d.trafficTollItemActiveClass);d.tollSelected=false}else{jQuery(b).addClass(d.trafficTollItemActiveClass);d.tollSelected=true}this.showTrafficLayers()}else{if(jQuery(h).closest("li.eniro-showonmapcontrol-traffic-list-item-roadcam").size()>0){d=this.getLayerById("traffic");if(d.roadcamSelected===true){jQuery(b).removeClass(d.trafficRoadcamItemActiveClass);d.roadcamSelected=false}else{jQuery(b).addClass(d.trafficRoadcamItemActiveClass);d.roadcamSelected=true}this.showTrafficLayers()}else{if(jQuery(h).closest("li.eniro-showonmapcontrol-traffic-list-item-speedcam").size()>0){d=this.getLayerById("traffic");if(d.speedcamSelected===true){jQuery(b).removeClass(d.trafficSpeedcamItemActiveClass);d.speedcamSelected=false}else{jQuery(b).addClass(d.trafficSpeedcamItemActiveClass);d.speedcamSelected=true}this.showTrafficLayers()}else{if(jQuery(h).closest("li.eniro-showonmapcontrol-traffic-list-item-reststop").size()>0){d=this.getLayerById("traffic");if(d.reststopSelected===true){jQuery(b).removeClass(d.trafficReststopItemActiveClass);d.reststopSelected=false}else{jQuery(b).addClass(d.trafficReststopItemActiveClass);d.reststopSelected=true}this.showTrafficLayers()}}}}}}}}return false}}}}return true},updateHemnetLayers:function(d){var c=jQuery(this.elements.hemnetDiv).find("select");var a=jQuery(c).map(function(){return jQuery(this).val()});if(parseInt(a[0],10)>parseInt(a[1],10)){jQuery(c[0]).addClass(d.hemnetSelectProblem);jQuery(c[1]).addClass(d.hemnetSelectProblem)}else{jQuery(c[0]).removeClass(d.hemnetSelectProblem);jQuery(c[1]).removeClass(d.hemnetSelectProblem)}if(parseInt(a[2],10)>parseInt(a[3],10)){jQuery(c[2]).addClass(d.hemnetSelectProblem);jQuery(c[3]).addClass(d.hemnetSelectProblem)}else{jQuery(c[2]).removeClass(d.hemnetSelectProblem);jQuery(c[3]).removeClass(d.hemnetSelectProblem)}if(parseInt(a[4],10)>parseInt(a[5],10)){jQuery(c[4]).addClass(d.hemnetSelectProblem);jQuery(c[5]).addClass(d.hemnetSelectProblem)}else{jQuery(c[4]).removeClass(d.hemnetSelectProblem);jQuery(c[5]).removeClass(d.hemnetSelectProblem)}if(this.hemnetLayer.popup){this.hemnetLayer.popup.hide()}var b=this.getHemnetTypes(d);if(b.length>0){this.hemnetLayer.updateSearch({type:b.join(","),minprice:a[0],maxprice:a[1],minarea:a[2],maxarea:a[3],minrooms:a[4],maxrooms:a[5]});this.showLayer(this.hemnetLayer)}else{this.hideLayer(this.hemnetLayer)}},getHemnetTypes:function(b){var a=[];if(b.houseSelected){a.push(1)}if(b.cottageSelected){a.push(2)}if(b.flatSelected){a.push(4)}return a},showHemnetLayers:function(){if(this.hemnetLayer){this.showLayer(this.hemnetLayer)}},hideHemnetLayers:function(){if(this.hemnetLayer){this.hideLayer(this.hemnetLayer);this.hideLayer(this.hemnetFakeLayer)}},showTrafficLayers:function(){var c=this.getSubLayerByName("se_traffic");var a=this.getSubLayerByName("se_toll");var f=this.getSubLayerByName("se_camera");var d=this.getSubLayerByName("se_speedcamera");var b=this.getSubLayerByName("se_reststop");if(c&&this.trafficLayer.disturbanceSelected===true){this.showLayer(c)}else{if(c&&this.trafficLayer.disturbanceSelected===false){this.hideLayer(c)}}if(a&&this.trafficLayer.tollSelected===true){this.showLayer(a)}else{if(a&&this.trafficLayer.tollSelected===false){this.hideLayer(a)}}if(f&&this.trafficLayer.roadcamSelected===true){this.showLayer(f)}else{if(f&&this.trafficLayer.roadcamSelected===false){this.hideLayer(f)}}if(d&&this.trafficLayer.speedcamSelected===true){this.showLayer(d)}else{if(d&&this.trafficLayer.speedcamSelected===false){this.hideLayer(d)}}if(b&&this.trafficLayer.reststopSelected===true){this.showLayer(b)}else{if(b&&this.trafficLayer.reststopSelected===false){this.hideLayer(b)}}},hideTrafficLayers:function(){var c=this.getSubLayerByName("se_traffic");var a=this.getSubLayerByName("se_toll");var f=this.getSubLayerByName("se_camera");var d=this.getSubLayerByName("se_speedcamera");var b=this.getSubLayerByName("se_reststop");this.hideLayer(c);this.hideLayer(a);this.hideLayer(f);this.hideLayer(d);this.hideLayer(b)},handleClick:function(l){if(this.map.getZoom()<this.minZoom){return}var d=this.getVisibleLayers();if(d.length===0){return}this.mouseLoc=this.map.getLonLatFromPixel(l.xy);var k=this.getLayerNames(d);var g;var a="";for(var f=0;f<d.length;f++){g=d[f];a+=g.getBBOX(l.xy);if(g.getCQLFilter){layerCQL=g.getCQLFilter();if(layerCQL){a+=" AND ("+layerCQL+")"}}if(f<d.length-1){a+=";"}}var b=this.maxFeatures;var c=[];var h=this.getVisibleLayers();if(h.length==1&&this.electionLayer&&h[0]===this.electionLayer){b=1;c=this.electionLayer.getPropertyNames();a="CONTAINS(the_geom, POINT("+this.mouseLoc.lon+" "+this.mouseLoc.lat+"))"}OpenLayers.Request.GET({url:this.wfsURL,params:{SERVICE:"WFS",VERSION:"1.1.0",REQUEST:"GetFeature",TYPENAME:k.join(","),OUTPUTFORMAT:"JSON",PROPERTYNAME:c.join(","),MAXFEATURES:b,CQL_FILTER:a,format_options:"callback:C"},success:this.handleClickResponse,scope:this})},getElectionFeature:function(b){for(var a=0;a<b.length;a++){if(b[a].id.indexOf(this.electionLayer.name)===0){return b[a]}}return null},handleElectionClickResponse:function(c){var a=[this.electionLayer.getPopupHTML(c)];var d=new OpenLayers.LonLat(this.mouseLoc.lon,this.mouseLoc.lat);var b=this.map.getViewPortPxFromLonLat(d);if(this.popup===null){this.popup=new Eniro.Popup.ShowOnMap(d,a.join(""),{closeBox:true,resultType:"route"});this.map.addPopup(this.popup);OpenLayers.Event.observe(this.popup.contentDiv,"click",OpenLayers.Function.bind(this.onPopupClick,this.popup))}else{this.popup.lonlat=d;jQuery(this.popup.contentDiv).empty();jQuery(this.popup.contentDiv).html(a.join(""));this.popup.updateSize()}Eniro.AppEvents.triggerEvent(Eniro.Events.STATISTICS_LOG,{scope:"content",event:"showonmappopup",data:{features:[c.id]}});this.popup.show()},handleClickResponse:function(r){r=r.responseText;if(r.features.length===0){return}var g;var f=this.getVisibleLayers();if(this.electionLayer){var a=this.getElectionFeature(r.features);if(a){this.handleElectionClickResponse(a);return}}var t;var l;var s=[];var q=[0,0];var p="";if(this.popup===null){p=this.getSingleCssClassName("zoom")}else{p=this.popup.zoomLinkClass}for(g=0;g<r.features.length;g++){t=r.features[g];q[0]+=t.geometry.coordinates[0];q[1]+=t.geometry.coordinates[1]}var c=1;if(this.map.getZoom()>=13){c=r.features.length}var o=[];var k;for(g=0;g<c;g++){t=r.features[g];l=this.getLayerFromFeatureId(f,t);k=l.getPopupHTML(t);s.push(k);if(k!==null&&k!==""){o.push(t.id)}}if(this.map.getZoom()<13){s.push('<div class="'+this.getCssClassName("links")+'">');if(r.features.length>1){s.push('<span class="'+this.getCssClassName("more")+'">',this.i18n("more-hits"),"</span> ")}s.push('<a href="/'+new Date().getTime()+'" class="'+p+'">'+this.i18n("zoom-here")+"</a>");s.push("</div>")}if(l.namespace!=="eniro"){s.push('<img class="'+l.poweredbyClass+'" src="'+Eniro.Util.getImagesLocation()+l.namespace+"_logo.gif?v="+Eniro.Config["media.version"]+'" width="52" height="28" alt="" />')}var h=new OpenLayers.LonLat(q[1]/r.features.length,q[0]/r.features.length);var d=h.transform(this.map.backendProjection,this.map.getProjectionObject());var b=this.map.getViewPortPxFromLonLat(d);if(this.popup===null){this.popup=new Eniro.Popup.ShowOnMap(d,s.join(""),{closeBox:true,resultType:"route"});this.map.addPopup(this.popup);OpenLayers.Event.observe(this.popup.contentDiv,"click",OpenLayers.Function.bind(this.onPopupClick,this.popup))}else{this.popup.lonlat=h;jQuery(this.popup.contentDiv).empty();jQuery(this.popup.contentDiv).html(s.join(""));this.popup.updateSize()}Eniro.AppEvents.triggerEvent(Eniro.Events.STATISTICS_LOG,{scope:"content",event:"showonmappopup",data:{features:o}});this.popup.show();if(!this.popup.zoomLinkClass){this.popup.zoomLinkClass=p}},onPopupClick:function(c){var d=OpenLayers.Event.element(c);var b=jQuery(this.contentDiv).find("a."+this.zoomLinkClass).get(0);if(b){if(d===b){OpenLayers.Event.stop(c);this.map.setCenter(this.lonlat,13);this.hide();return false}}return true},popupDestroy:function(){if(this.popup){this.popup.destroy();this.popup=null}},setMap:function(a){if(this.clickHandler){this.clickHandler.setMap(a)}if(this.electionLayers){this.electionLayers.parliamentDivision.setVisibility(false);this.electionLayers.parliamentDistrict.setVisibility(false);this.electionLayers.parliamentMunicipal.setVisibility(false);a.addLayer(this.electionLayers.parliamentDivision);a.addLayer(this.electionLayers.parliamentDistrict);a.addLayer(this.electionLayers.parliamentMunicipal)}Eniro.Control.prototype.setMap.apply(this,arguments);this.map.stateController.register("showonmap",50,this)},getVisibleLayers:function(){var d=[];if(this.electionLayer&&this.electionLayer.map&&this.electionLayer.getVisibility()){d.push(this.electionLayer)}var c=this.layers;for(var b=0,a=c.length;b<a;++b){if(!c[b].name){continue}if(c[b].map&&c[b].getVisibility()){d.push(c[b])}}c=this.subLayers;for(b=0,a=c.length;b<a;++b){if(!c[b].name){continue}if(c[b].map&&c[b].getVisibility()){d.push(c[b])}}return d},getStateLayers:function(){var a=[];a=this.getVisibleLayers();if(this.hemnetLayer&&this.hemnetLayer.map&&this.hemnetLayer.getVisibility()){a.push(this.hemnetLayer)}return a},getLayerFromFeatureId:function(f,d){for(var c=0,a=f.length;c<a;++c){var b=this.getLayerName(f[c]);b=b.substr(b.indexOf(":")+1);if(d.id.substr(0,b.length)===b){return f[c]}}return null},getLayerFromName:function(b){var d=this.layers;for(var c=0,a=d.length;c<a;++c){if(this.getLayerName(d[c])===b){return d[c]}}return null},getLayerNames:function(d){var c=[];for(var b=0,a=d.length;b<a;++b){c.push(this.getLayerName(d[b]))}return c},getLayerById:function(c){for(var a=0,b=this.layers.length;a<b;++a){if(this.layers[a].id===c){return this.layers[a]}}return null},getLayerName:function(a){if(a.layername){return a.layername}else{return a.params.LAYERS}},hideLayer:function(b){if(b.getVisibility()){b.setVisibility(false);if(b.popupDestroy){b.popupDestroy()}this.popupDestroy()}if(b instanceof Eniro.Layer.Election){b=this.electionFakeLayer}var a=jQuery(this.div).find("."+b.itemClass);if(a.size()>0){a.removeClass(this.itemActiveClass).removeClass(b.itemActiveClass)}},showLayer:function(c){if(c.name){var d=this.map.getLayersByName(c.name).length>0;if(!d){this.map.addLayer(c)}}c.setVisibility(true);if(c instanceof Eniro.Layer.Election){var b=jQuery("#"+c.name+"_radio")[0];b.checked="checked";c=this.electionFakeLayer;c.visible=true}var a=jQuery(this.div).find("."+c.itemClass);a.addClass(this.itemActiveClass).addClass(c.itemActiveClass)},addItem:function(c,b){this.layers.splice(b,0,c);if(this.elements&&this.elements.list){var a=jQuery(this.drawLayerListItem(c)).get(0);if(b||b===0){jQuery(this.elements.list).children().eq(b).before(a)}else{jQuery(this.elements.list).append(a)}this.assignElements("item");return a}return null},drawLayerListItem:function(b){var c;if(!b.name&&b.id){c=b.id}else{if(b.name){c=b.name.replace(/\./gi,"_")}else{c=OpenLayers.Util.createUniqueID(this.id+"layer_")}}b.itemActiveClass=this.getSingleCssClassName("item",null,{id:c,selected:true});b.itemClass=this.getSingleCssClassName("item",null,{id:c});b.poweredbyClass=this.getSingleCssClassName("poweredby");var a='<li class="'+this.getCssClassName("item",null,{id:c})+'"><a href="/'+new Date().getTime()+'"><span>'+this.i18n(c)+"</span></a>";if(b.draw){a+=b.draw()}a+="</li>";return a},draw:function(){if(this.layers.length>0){this.div=this.createDiv();this.itemActiveClass=this.getSingleCssClassName("item",null,{selected:true});this.headerActiveClass=this.getSingleCssClassName("header-open");this.cssClasses.header=this.getCssClassName("header");this.cssClasses.item=this.getCssClassName("item");this.cssClasses.list=this.getCssClassName("list");var b=jQuery('<ul><li class="'+this.cssClasses.header+(Eniro.Profile.showOnMap.collapsed?"":" "+this.headerActiveClass)+'"><a href="/'+new Date().getTime()+'"><span>'+this.i18n("title")+"</span></a></li></ul>");if(this.layers.length>0){var c=['<ul class="'+this.cssClasses.list+'">'];for(var a=0,d=this.layers.length;a<d;++a){c.push(this.drawLayerListItem(this.layers[a]))}c.push("</ul>");c=jQuery(c.join(""));if(Eniro.Profile.showOnMap&&Eniro.Profile.showOnMap.collapsed){c.hide()}b.children().eq(0).append(c)}jQuery(this.div).append(b);return this.div}return null},saveState:function(){var g=this.getLayerNames(this.getStateLayers());var d={layerNames:g};if(this.hemnetLayer&&this.hemnetLayer.getVisibility()){var b=jQuery(this.elements.hemnetDiv).find("select");var a=jQuery(b).map(function(){return jQuery(this).val()});var f={flat:this.hemnetFakeLayer.flatSelected,house:this.hemnetFakeLayer.houseSelected,cottage:this.hemnetFakeLayer.cottageSelected,minPrice:a[0],maxPrice:a[1],minArea:a[2],maxArea:a[3],minRooms:a[4],maxRooms:a[5]};if(this.hemnetLayer.popup&&this.hemnetLayer.popup.items.length>0){f.popupIds=this.hemnetLayer.popup.getItemIds();if(this.hemnetLayer.popup.itemIndex||this.hemnetLayer.popup.itemIndex===0){f.popupIndex=this.hemnetLayer.popup.itemIndex}}d.hemnet=f}if(this.trafficLayer&&this.trafficLayer.getVisibility()){var c={disturbance:this.trafficLayer.disturbanceSelected,toll:this.trafficLayer.tollSelected,roadcam:this.trafficLayer.roadcamSelected,speedcam:this.trafficLayer.speedcamSelected,reststop:this.trafficLayer.reststopSelected};d.traffic=c}return d},applyState:function(d){var f=this.layers;for(var c=0;c<f.length;c++){if(OpenLayers.Util.indexOf(d.layerNames,f[c].name)>=0){this.showLayer(f[c])}else{this.hideLayer(f[c])}}if(this.electionLayers){for(c in this.electionLayers){var b=this.electionLayers[c];if((b instanceof Eniro.Layer.Election)&&(OpenLayers.Util.indexOf(d.layerNames,b.name)>=0)){this.electionLayer=b;this.showElectionLayer()}}}if(this.hemnetFakeLayer){this.showLayer(this.hemnetFakeLayer);if(this.hemnetLayer&&d.hemnet){this.hemnetFakeLayer.flatSelected=d.hemnet.flat;this.hemnetFakeLayer.houseSelected=d.hemnet.house;this.hemnetFakeLayer.cottageSelected=d.hemnet.cottage;if(this.hemnetFakeLayer.flatSelected){jQuery(this.elements.hemnetDiv).find("li.eniro-showonmapcontrol-hemnet-list-item-flat").addClass(this.hemnetFakeLayer.hemnetFlatItemActiveClass)}if(this.hemnetFakeLayer.houseSelected){jQuery(this.elements.hemnetDiv).find("li.eniro-showonmapcontrol-hemnet-list-item-house").addClass(this.hemnetFakeLayer.hemnetHouseItemActiveClass)}if(this.hemnetFakeLayer.cottageSelected){jQuery(this.elements.hemnetDiv).find("li.eniro-showonmapcontrol-hemnet-list-item-cottage").addClass(this.hemnetFakeLayer.hemnetCottageItemActiveClass)}var a=jQuery(this.elements.hemnetDiv).find("select");jQuery(a[0]).val(d.hemnet.minPrice);jQuery(a[1]).val(d.hemnet.maxPrice);jQuery(a[2]).val(d.hemnet.minArea);jQuery(a[3]).val(d.hemnet.maxArea);jQuery(a[4]).val(d.hemnet.minRooms);jQuery(a[5]).val(d.hemnet.maxRooms);this.updateHemnetLayers(this.hemnetFakeLayer);if(d.hemnet.popupIds){this.hemnetLayer.populatePopup(d.hemnet.popupIds,d.hemnet.popupIndex)}}}if(this.trafficLayer&&d.traffic){if(d.traffic.disturbance||d.traffic.toll||d.traffic.roadcam||d.traffic.speedcam||d.traffic.reststop){this.trafficLayer.disturbanceSelected=d.traffic.disturbance;this.trafficLayer.tollSelected=d.traffic.toll;this.trafficLayer.roadcamSelected=d.traffic.roadcam;this.trafficLayer.speedcamSelected=d.traffic.speedcam;this.trafficLayer.reststopSelected=d.traffic.reststop;this.showLayer(this.trafficLayer);if(this.trafficLayer.disturbanceSelected){jQuery(this.elements.trafficDiv).find("li.eniro-showonmapcontrol-traffic-list-item-disturbance").addClass(this.trafficLayer.trafficDisturbanceItemActiveClass)}if(this.trafficLayer.tollSelected){jQuery(this.elements.trafficDiv).find("li.eniro-showonmapcontrol-traffic-list-item-toll").addClass(this.trafficLayer.trafficTollItemActiveClass)}if(this.trafficLayer.roadcamSelected){jQuery(this.elements.trafficDiv).find("li.eniro-showonmapcontrol-traffic-list-item-roadcam").addClass(this.trafficLayer.trafficRoadcamItemActiveClass)}if(this.trafficLayer.speedcamSelected){jQuery(this.elements.trafficDiv).find("li.eniro-showonmapcontrol-traffic-list-item-speedcam").addClass(this.trafficLayer.trafficSpeedcamItemActiveClass)}if(this.trafficLayer.reststopSelected){jQuery(this.elements.trafficDiv).find("li.eniro-showonmapcontrol-traffic-list-item-reststop").addClass(this.trafficLayer.trafficReststopItemActiveClass)}}}},getSubLayerByName:function(c){var b=null;for(var f=0,a=this.subLayers.length;f<a;f++){var d=this.subLayers[f];if(d.layername==c){b=d;break}}return b},CLASS_NAME:"Eniro.ShowOnMapControl"});Eniro.StateController=OpenLayers.Class(Eniro.Control,{components:[],requestWatcher:null,initialize:function(){Eniro.Control.prototype.initialize.apply(this,arguments);this.components=[];this.requestWatcher=new Eniro.RequestWatcher(OpenLayers.Function.bind(this.invokeApplyStateComplete,this))},destroy:function(){Eniro.Control.prototype.destroy.apply(this,arguments)},register:function(b,c,a){if(typeof a.saveState!="function"){throw new Error("Component '"+b+"' does not have a function saveState().")}if(typeof a.applyState!="function"){throw new Error("Component '"+b+"' does not have a function applyState(obj).")}this.components[this.components.length]={key:b,prio:c,component:a};this.components.sort(function(f,d){return f.prio-d.prio})},saveState:function(){var d={errors:[]};for(var a=0;a<this.components.length;a++){var c=this.components[a];var b=c.component.saveState();if(!(b===null||typeof b==="object")){throw new Error("Component '"+c.key+"' did not return a state of expected type.")}d[c.key]=b;if(b&&b.error){d.errors.push(b.error)}}return d},applyState:function(c){this.requestWatcher.start();var b,a;for(a=0;a<this.components.length;a++){b=this.components[a];if(typeof b.component.applyStateBegin==="function"){b.component.applyStateBegin()}}for(a=0;a<this.components.length;a++){b=this.components[a];if(c[b.key]){b.component.applyState(c[b.key])}else{OpenLayers.Console.debug("No state provided for '"+b.key+"', ignoring.")}}this.requestWatcher.stop()},toJSON:function(a){var b=this.saveState();if(b.errors.length){a(b.errors)}return this.doJSONMarshall(b)},fromJSON:function(a){a=a.responseText;this.applyState(a)},save:function(d,a){var b=this.toJSON(a);var c=this.doPost(b,d);return c},restore:function(a){OpenLayers.Request.GET({url:Eniro.AppNode.appUrl("/mapstate/get"),params:{id:a},success:this.fromJSON,scope:this})},doJSONMarshall:function(a){var b=new OpenLayers.Format.JSON();return b.write(a)},doPost:function(a,b){jQuery.post("/appNodeProxy/mapstate/save",{mapstate:a},function(c){var d=JSON.parse(c);b(d)})},invokeApplyStateComplete:function(){for(var a=0;a<this.components.length;a++){var b=this.components[a];if(typeof b.component.applyStateComplete==="function"){b.component.applyStateComplete()}}},CLASS_NAME:"Eniro.StateController"});Eniro.HistoryController=OpenLayers.Class(Eniro.Control,{history:null,current:null,currentMode:null,currentSearch:null,stateController:null,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.stateController=a;Eniro.AppEvents.register(Eniro.Events.SEARCH_UPDATED,this,this.onSearchUpdated);Eniro.AppEvents.register(Eniro.Events.HISTORY_SAVE,this,this.onHistorySave);Eniro.AppEvents.register(Eniro.Events.HISTORY_BACK_TO_SEARCH_RESULT,this,this.onBackToSearchResult);if(window.location.toString().indexOf("historyDebug")>0){var b=jQuery('<div class="eniro-history-debug"></div>');this.debugDiv=jQuery("<div></div>");b.append(this.debugDiv);jQuery("body").append(b)}},destroy:function(){this.history=null;this.current=null;this.currentMode=null;this.currentSearch=null;this.stateController=null;Eniro.Control.prototype.destroy.apply(this,arguments);Eniro.AppEvents.unregister(Eniro.Events.SEARCH_UPDATED,this,this.onSearchUpdated);Eniro.AppEvents.unregister(Eniro.Events.HISTORY_SAVE,this,this.onHistorySave);Eniro.AppEvents.register(Eniro.Events.HISTORY_BACK_TO_SEARCH_RESULT,this,this.onBackToSearchResult)},onModeSwitch:function(a){this.happening="onModeSwitch";this.currentMode=a.mode;this.saveFirst();this.debugDump()},onSearchResult:function(a){this.happening="onSearchResult";var b={};jQuery.extend(true,b,a.search);this.currentSearch=b;this.saveFirst();this.debugDump()},onSearchUpdated:function(a){this.happening="onSearchUpdated";if(!a._enableBack){this.currentSearch=a;this.saveFirst();this.debugDump()}},onHistorySave:function(){this.saveHistory()},onHistoryBack:function(a){if(a.previousMode){this.backToPreviousMode()}else{if(a.previousSearch){this.backToPreviousSearch()}else{this.back()}}},onHistoryForward:function(){this.forward()},onHistoryReset:function(){this.reset()},init:function(){this.happening="init";if(!this.currentSearch){this.currentSearch={_forceEmpty:true}}this.saveFirst();this.debugDump()},saveFirst:function(){this.saveHistory()},saveHistory:function(){this.happening="saveHistory";if(!this.currentSearch){return}var a=this.buildToken();a.previous=this.current;this.history=a;this.current=a;this.debugDump()},back:function(){this.happening="back";if(this.current.previous){var a=this.current;this.current=this.current.previous;this.current.next=a;this.applyCurrent()}this.debugDump()},backToPreviousSearch:function(){this.happening="backToPreviousSearch";var a=this.current;while(this.searchEquals(a.search,this.currentSearch)&&a.previous){a=a.previous}if(!this.searchEquals(a.search,this.currentSearch)){this.current=a;this.applyCurrent()}this.debugDump()},onBackToSearchResult:function(){this.happening="backToSearchResult";var c=this.currentSearch;var a={};jQuery.extend(true,a,this.current.state);var b={happening:this.happening,mode:c.currentMode,search:c.search,state:{map:a.map,searchLayer:a.searchLayer},previous:this.current};this.history=b;this.current=b;this.applyCurrent();this.debugDump()},searchEquals:function(c,b){for(var a in c){if(c[a]!==b[a]){return false}}return true},backToPreviousMode:function(){this.happening="backToPreviousMode";var a=this.current;while(a.mode===this.currentMode&&a.previous){a=a.previous}if(a.mode!==this.currentMode){this.current=a;this.applyCurrent()}this.debugDump()},forward:function(){this.happening="forward";if(this.current.next){var a=this.current.next;this.current.next=null;this.current=a;this.applyCurrent()}this.debugDump()},reset:function(){this.happening="reset";var a=this.current;while(a.previous){a=a.previous}this.current=a;this.applyCurrent();this.debugDump()},applyCurrent:function(){this.currentSearch=this.current.search;this.currentMode=this.current.mode;var a={};jQuery.extend(true,a,this.current.state);this.stateController.applyState(a)},buildToken:function(){var a={};jQuery.extend(true,a,this.stateController.saveState());return{happening:this.happening,mode:this.currentMode,search:this.currentSearch,state:a}},debugDump:function(){if(this.debugDiv){$(this.debugDiv).empty();var a=[];if(this.history){var b=this.history;do{a.push('<ol class="eniro-history-debug-entry '+(b===this.current?"eniro-history-debug-current":"")+'">'+this.debugFormatState(b)+"</ol>");b=b.previous}while(b)}else{a.push('<div class="eniro-history-debug-entry">No history</div>')}a.push('<ol class="eniro-history-debug-entry"><li><b>happening:</b> '+this.happening+"</li><li><b>currentMode:</b> "+this.currentMode+"</li><li><b>currentSearch:</b></li>"+this.debugFormat(this.currentSearch)+"</ol>");a.reverse();$(this.debugDiv).html(a.join(""))}},debugFormatState:function(b){var a="";var c=b.state;if(b.happening){a+="<li><b>happening:</b> "+b.happening+"</li>";a+="<li><b>mode:</b> "+b.mode+"</li>"}if(c){if(c.searchLayer&&c.searchLayer.search){a+=this.debugFormat(c.searchLayer.search,null,true)}if(c.map){a+=this.debugFormat(c.map,["baseLayer","center","zoom"],true)}}return a},debugFormat:function(g,f,b){var d="";var a=f;if(!a){a=[];for(var c in g){a.push(c)}a.sort()}var h=true;jQuery.each(a,function(){var k=(g[this]+"").replace(/,/,",<br/>");d+="<li "+(b&&h?'class="eniro-debug-history-entry-section"':"")+"><b>"+this+":</b> "+k+"</li>";h=false});return d},CLASS_NAME:"Eniro.Control"});Eniro.Popup=OpenLayers.Class(OpenLayers.Popup.Framed,{contentDisplayClass:"olFramedCloudPopupContent olEniroIgnoreHandlers",autoSize:true,keepInMap:false,panMapIfOutOfView:false,imageSize:new OpenLayers.Size(700,912),isAlphaImage:true,fixedRelativePosition:false,minSize:new OpenLayers.Size(46,66),maxSize:new OpenLayers.Size(600,500),resultType:"draw",lineWrapLength:100,positionBlocks:{tl:{offset:new OpenLayers.Pixel(0,14),padding:new OpenLayers.Bounds(14,16,30,11),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,16,36,0),position:new OpenLayers.Pixel(-22,0)},{size:new OpenLayers.Size(14,"auto"),anchor:new OpenLayers.Bounds(null,48,22,null),position:new OpenLayers.Pixel(-22,0)},{size:new OpenLayers.Size("auto",16),anchor:new OpenLayers.Bounds(0,0,36,null),position:new OpenLayers.Pixel(-22,-255)},{size:new OpenLayers.Size(36,48),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(0,-131)}]},tr:{offset:new OpenLayers.Pixel(0,14),padding:new OpenLayers.Bounds(36,16,8,11),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,48,14,0),position:new OpenLayers.Pixel(-1,0)},{size:new OpenLayers.Size(14,"auto"),anchor:new OpenLayers.Bounds(null,16,0,null),position:new OpenLayers.Pixel(-22,0)},{size:new OpenLayers.Size("auto",48),anchor:new OpenLayers.Bounds(0,0,14,null),position:new OpenLayers.Pixel(-1,-193)},{size:new OpenLayers.Size(14,16),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(-22,-255)}]},bl:{offset:new OpenLayers.Pixel(0,-36),padding:new OpenLayers.Bounds(14,16,30,11),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,16,36,0),position:new OpenLayers.Pixel(-22,0)},{size:new OpenLayers.Size(36,48),anchor:new OpenLayers.Bounds(null,null,0,0),position:new OpenLayers.Pixel(0,-863)},{size:new OpenLayers.Size("auto",16),anchor:new OpenLayers.Bounds(0,0,36,null),position:new OpenLayers.Pixel(-22,-255)},{size:new OpenLayers.Size(14,"auto"),anchor:new OpenLayers.Bounds(null,0,22,48),position:new OpenLayers.Pixel(-22,-255)}]},br:{offset:new OpenLayers.Pixel(0,-36),padding:new OpenLayers.Bounds(36,16,8,11),blocks:[{size:new OpenLayers.Size("auto",48),anchor:new OpenLayers.Bounds(0,null,14,0),position:new OpenLayers.Pixel(-1,-794)},{size:new OpenLayers.Size(14,"auto"),anchor:new OpenLayers.Bounds(null,16,0,null),position:new OpenLayers.Pixel(-22,0)},{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,0,14,48),position:new OpenLayers.Pixel(-1,-255)},{size:new OpenLayers.Size(14,16),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(-22,-255)}]}},initialize:function(k,d,h,c,b,g,f,a){OpenLayers.Util.extend(this,a);if(!this.imageSrc){this.imageSrc=Eniro.Util.getImagesLocation()+"popup/"+this.resultType+"-popup.png?v="+Eniro.Config["media.version"]}OpenLayers.Popup.Framed.prototype.initialize.apply(this,[k,d,h,c,b,g,f])},updateSize:function(){var f="<div class='"+this.contentDisplayClass+"'>"+this.contentDiv.innerHTML+"</div>";var k=(this.map)?this.map.viewPortDiv:document.body;var l=OpenLayers.Util.getRenderedDimensions(f,null,{displayClass:this.displayClass,containerElement:k});var h=this.getSafeContentSize(l);var g=null;if(h.equals(l)){g=l}else{var b=new OpenLayers.Size();b.w=(h.w<l.w)?h.w:null;b.h=(h.h<l.h)?h.h:null;if(b.w&&b.h){g=h}else{var d=OpenLayers.Util.getRenderedDimensions(f,b,{displayClass:this.displayClass,containerElement:k});var c=OpenLayers.Element.getStyle(this.contentDiv,"overflow");if((c!="hidden")&&(d.equals(h))){var a=OpenLayers.Util.getScrollbarWidth();if(b.w){d.h+=a}else{d.w+=a}}g=this.getSafeContentSize(d)}}if(jQuery.browser.msie&&parseInt(jQuery.browser.version,10)<7){if(g.w%2===0){g.w+=1}if(g.h%2===0){g.h+=1}}this.setSize(g)},setSize:function(){OpenLayers.Popup.Framed.prototype.setSize.apply(this,arguments);this.groupDiv.style.height=this.div.style.height;var a=this.contentDiv.style.overflow;this.contentDiv.style.overflow="hidden";this.contentDiv.style.overflow=a},updateBlocks:function(){if(!this.blocks){this.createBlocks()}if(this.size&&this.relativePosition){var o=this.positionBlocks[this.relativePosition];for(var g=0;g<o.blocks.length;g++){var c=o.blocks[g];var f=this.blocks[g];var d=c.anchor.left;var q=c.anchor.bottom;var a=c.anchor.right;var v=c.anchor.top;var u=(isNaN(c.size.w))?this.size.w-(a+d):c.size.w;var k=(isNaN(c.size.h))?this.size.h-(q+v):c.size.h;f.div.style.width=(u<0?0:u)+"px";f.div.style.height=(k<0?0:k)+"px";f.div.style.left=(d!==null)?d+"px":"";f.div.style.bottom=(q!==null)?q+"px":"";f.div.style.right=(a!==null)?a+"px":"";f.div.style.top=(v!==null)?v+"px":"";var s="left";var p="top";if(g===2||g===3){p="bottom"}if(g===1||g===3){s="right"}f.image.style[s]=c.position.x+"px";f.image.style[p]=c.position.y+"px"}this.contentDiv.style.left=this.padding.left+"px";this.contentDiv.style.top=this.padding.top+"px"}},CLASS_NAME:"Eniro.Popup"});Eniro.Popup.Feature=OpenLayers.Class(Eniro.Popup,{initialize:function(c,b){b=b||{};var d;var g="";if(c.attributes){if(c.attributes.source&&Eniro.Profile.providers[c.attributes.source]){d=Eniro.Profile.providers[c.attributes.source]}if(c.attributes.id){g=c.attributes.id}}var a;if(b.resultType){a=b.resultType}else{if(d){if(d.popup){a=d.popup}else{if(d.icon){a=d.icon}}}}g=this.CLASS_NAME.replace(/\._/g,"-").toLowerCase()+"-"+g;if(jQuery("#"+g).size()>0){g+=OpenLayers.Util.createUniqueID("")}var f={id:g,lonlat:c.geometry.getBounds().getCenterLonLat(),contentSize:null,contentHTML:c.getPopupContents(),anchor:{offset:new OpenLayers.Pixel(2,-7),size:new OpenLayers.Size(0,0)},closeBox:true};OpenLayers.Util.extend(f,b);Eniro.Popup.prototype.initialize.apply(this,[f.id,f.lonlat,f.contentSize,f.contentHTML,f.anchor,f.closeBox,f.closeBoxCallback,{resultType:a}]);this.events.on({mouseover:this.onmouseover,scope:this});this.parent=c},onclick:function(a){var b=OpenLayers.Event.element(a);if(jQuery(b).hasClass("eniro-popup-title")){OpenLayers.Event.stop(a);Eniro.AppEvents.triggerEvent(Eniro.Events.SEARCH_SELECT_ITEM,{id:this.parent.fid||jQuery(b).attr("id"),provider:this.parent.attributes.source||null})}else{if(this.parent.onClick(a)){this.onmouseout();OpenLayers.Popup.Framed.prototype.onclick.apply(this,arguments);OpenLayers.Event.stop(a)}}},onmouseover:function(a){this.stuck=true;this.parent.onMouseOver()},onmouseout:function(a){OpenLayers.Popup.Framed.prototype.onmouseout.apply(this,arguments);if(Eniro.Util.mouseLeft(a,this.div)){this.stuck=false;this.parent.onMouseOut()}},addCloseBox:function(c){this.closeDiv=OpenLayers.Util.createDiv(this.id+"_close",null,new OpenLayers.Size(14,13));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);var a=c||function(d){this.hide();OpenLayers.Event.stop(d)};OpenLayers.Event.observe(this.closeDiv,"click",OpenLayers.Function.bindAsEventListener(a,this))},CLASS_NAME:"Eniro.Popup.Feature"});Eniro.HeadingPopup=OpenLayers.Class(Eniro.Popup.Feature,{heading:null,minSize:new OpenLayers.Size(350,200),feature:null,initialize:function(b,a){this.positionBlocks={tl:{offset:new OpenLayers.Pixel(0,10),padding:new OpenLayers.Bounds(14,15,29,11),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,15,35,0),position:new OpenLayers.Pixel(-21,0)},{size:new OpenLayers.Size(14,"auto"),anchor:new OpenLayers.Bounds(null,49,21,null),position:new OpenLayers.Pixel(-21,0)},{size:new OpenLayers.Size("auto",15),anchor:new OpenLayers.Bounds(0,0,35,null),position:new OpenLayers.Pixel(-21,-255)},{size:new OpenLayers.Size(35,49),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(0,-131)}]},tr:{offset:new OpenLayers.Pixel(0,10),padding:new OpenLayers.Bounds(35,15,8,11),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,49,14,0),position:new OpenLayers.Pixel(-1,0)},{size:new OpenLayers.Size(14,"auto"),anchor:new OpenLayers.Bounds(null,15,0,null),position:new OpenLayers.Pixel(-21,0)},{size:new OpenLayers.Size("auto",49),anchor:new OpenLayers.Bounds(0,0,14,null),position:new OpenLayers.Pixel(-1,-193)},{size:new OpenLayers.Size(14,15),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(-21,-255)}]},bl:{offset:new OpenLayers.Pixel(0,-40),padding:new OpenLayers.Bounds(14,15,29,11),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,15,35,0),position:new OpenLayers.Pixel(-21,0)},{size:new OpenLayers.Size(35,49),anchor:new OpenLayers.Bounds(null,null,0,0),position:new OpenLayers.Pixel(0,-863)},{size:new OpenLayers.Size("auto",15),anchor:new OpenLayers.Bounds(0,0,35,null),position:new OpenLayers.Pixel(-21,-255)},{size:new OpenLayers.Size(14,"auto"),anchor:new OpenLayers.Bounds(null,0,21,49),position:new OpenLayers.Pixel(-21,-255)}]},br:{offset:new OpenLayers.Pixel(0,-40),padding:new OpenLayers.Bounds(35,15,8,11),blocks:[{size:new OpenLayers.Size("auto",49),anchor:new OpenLayers.Bounds(0,null,14,0),position:new OpenLayers.Pixel(-1,-794)},{size:new OpenLayers.Size(14,"auto"),anchor:new OpenLayers.Bounds(null,15,0,null),position:new OpenLayers.Pixel(-21,0)},{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,0,14,49),position:new OpenLayers.Pixel(-1,-255)},{size:new OpenLayers.Size(14,15),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(-21,-255)}]}};this.feature=b;Eniro.Popup.Feature.prototype.initialize.apply(this,arguments);this.heading=a.heading;this.headingSize=OpenLayers.Util.getRenderedDimensions(this.heading,null,{displayClass:Eniro.Control.prototype.getCssClassName.apply(this,["header"])});var c=this.positionBlocks.tl.padding;this.positionBlocks.tl.padding=new OpenLayers.Bounds(c.left,c.bottom,c.right,c.top+this.headingSize.h);c=this.positionBlocks.tr.padding;this.positionBlocks.tr.padding=new OpenLayers.Bounds(c.left,c.bottom,c.right,c.top+this.headingSize.h);c=this.positionBlocks.bl.padding;this.positionBlocks.bl.padding=new OpenLayers.Bounds(c.left,c.bottom,c.right,c.top+this.headingSize.h);c=this.positionBlocks.br.padding;this.positionBlocks.br.padding=new OpenLayers.Bounds(c.left,c.bottom,c.right,c.top+this.headingSize.h);jQuery(this.contentDiv).click(function(d){var f=d.target.id;if(!f||f.length===0){f=d.target.parentNode.id}if(f!==null){var g=f.indexOf("_popupResultItem");if(g>0){var h=f.substring(0,g);OpenLayers.Event.stop(d);Eniro.AppEvents.triggerEvent(Eniro.Events.SEARCH_SELECT_ITEM,{id:h,provider:b.provider})}}})},setSize:function(b){var a=this.positionBlocks.tl.padding;b.w=Math.max(b.w,a.left+this.headingSize.w);Eniro.Popup.Feature.prototype.setSize.apply(this,arguments)},updateBlocks:function(){Eniro.Popup.Feature.prototype.updateBlocks.apply(this,arguments);var a=Eniro.Control.prototype.getCssClassName.apply(this,["header"]);if(!this.headingDiv){this.headingDiv=jQuery("<div></div>").addClass(a).html(this.heading).css({position:"absolute",top:this.positionBlocks[this.relativePosition].padding.top-this.headingSize.h,left:this.positionBlocks[this.relativePosition].padding.left}).get(0);jQuery(this.groupDiv).append(this.headingDiv)}},CLASS_NAME:"Eniro.HeadingPopup"});Eniro.Popup.ShowOnMap=OpenLayers.Class(Eniro.Popup,{maxSize:new OpenLayers.Size(360,500),resultType:"route",closeBox:false,initialize:function(a,c,b){this.positionBlocks=jQuery.extend(true,{},this.positionBlocks);this.positionBlocks.tl.offset=new OpenLayers.Pixel(0,36);this.positionBlocks.tr.offset=new OpenLayers.Pixel(0,36);this.positionBlocks.br.offset=new OpenLayers.Pixel(0,-14);this.positionBlocks.bl.offset=new OpenLayers.Pixel(0,-14);b=b||{};var d={id:OpenLayers.Util.createUniqueID(this.CLASS_NAME.replace(/[\._]/g,"-").toLowerCase()+"-"),lonlat:a,contentSize:null,contentHTML:c,anchor:{offset:new OpenLayers.Pixel(2,-7),size:new OpenLayers.Size(0,0)},closeBox:this.closeBox};OpenLayers.Util.extend(d,b);Eniro.Popup.prototype.initialize.apply(this,[d.id,d.lonlat,d.contentSize,d.contentHTML,d.anchor,d.closeBox,d.closeBoxCallback]);this.events.on({mouseover:this.onMouseOver,mouseout:this.onMouseOut,mousemove:this.onMouseMove,scope:this})},destroy:function(){this.events.un({mouseover:this.onMouseOver,mouseout:this.onMouseOut,mousemove:this.onMouseMove,scope:this});Eniro.Popup.prototype.destroy.apply(this,arguments)},onclick:function(){},onMouseOver:function(a){this.stuck=true},onMouseOut:function(a){OpenLayers.Popup.Framed.prototype.onmouseout.apply(this,arguments);if(Eniro.Util.mouseLeft(a,this.div)){this.stuck=false}},onMouseMove:function(a){OpenLayers.Event.stop(a,true)},CLASS_NAME:"Eniro.Popup.ShowOnMap"});Eniro.Popup.Hemnet=OpenLayers.Class(Eniro.Popup.ShowOnMap,{resultType:"person",closeBox:true,lonlat:null,items:null,itemIndex:0,initialize:function(a,c){var f=["container","backLink","navigationInfo","subject","navigation","multiSubject","properties","image","moreInfo","extra","prev","next","zoom","streetview","oblique","ad"];this.classNames={};for(var d=0,g=f.length;d<g;++d){this.classNames[f[d]]=Eniro.Util.getCssClassName(this,f[d].dash())}this.lonlat=a;OpenLayers.Util.extend(this,c);var b=[a,this.getPopupHTML(),c||{}];Eniro.Popup.ShowOnMap.prototype.initialize.apply(this,b)},destroy:function(){if(this.popup&&this.popup.contentDiv){OpenLayers.Event.stopObservingElement(this.popup.contentDiv)}this.ad=null;this.lonlat=null;this.items=null;this.streetViewPointSource=null;this.streetviewData=null;this.streetViewPointResult=null;this.streetviewHeading=null;Eniro.Popup.ShowOnMap.prototype.destroy.apply(this,arguments)},onZoomEnd:function(a){this.displayZoomLink()},onPopupClick:function(p){var k=OpenLayers.Event.element(p);var h=true;var b=false;var f=false;var g=-1;var o=jQuery(k).closest("."+this.classNames.prev).size()>0;var a=jQuery(k).closest("."+this.classNames.next).size()>0;if(jQuery(k).closest("."+this.classNames.backLink).size()>0){f=true}else{if(this.items&&this.items.length>1){var l=jQuery(this.div).find("."+this.classNames.multiSubject).find("a");if(o||a){if(o){g=this.itemIndex-1;if(g<0){g=this.items.length-1}}else{if(a){g=this.itemIndex+1;if(g>(this.items.length-1)){g=0}}}}else{g=l.index(k)}if(g>=0&&g<=(this.items.length-1)){this.itemIndex=g}}}var d;if(f||g>=0){h=false;this.setContentHTML(this.getPopupHTML(f))}else{if(jQuery(k).closest("."+this.classNames.zoom).size()>0){h=false;if(this.lonlat){if(this.map.getZoom()>=this.map.getRealZoom(10)){this.map.setCenter(this.lonlat,this.map.getRealZoom(13))}else{this.map.setCenter(this.lonlat,this.map.getRealZoom(10))}}}else{if(jQuery(k).closest("."+this.classNames.streetview).size()>0){h=false;if(this.lonlat||this.streetViewPointResult){if(this.streetViewPointResult){d=this.streetViewPointResult}else{d=this.lonlat.clone();d.transform(this.map.getProjectionObject(),this.map.backendProjection)}var c={};if(this.streetviewData){jQuery.extend(true,c,this.streetviewData);c.heading=Math.round(this.streetviewHeading)+180}Eniro.AppEvents.triggerEvent(Eniro.Events.STATE_SAVING_MODE_SWITCH,{mode:"streetview",_streetViewLonLat:d,_streetviewData:c})}}else{if(jQuery(k).closest("."+this.classNames.oblique).size()>0){h=false;if(this.lonlat){d=this.lonlat.clone();d.transform(this.map.getProjectionObject(),this.map.backendProjection);Eniro.AppEvents.triggerEvent(Eniro.Events.STATE_SAVING_MODE_SWITCH,{mode:"oblique",lonlat:d,searchParams:{}})}}}}}if(!h){OpenLayers.Event.stop(p)}return h},onStreetViewQuerySuccess:function(c,a){if(a&&a!="error"&&c&&c.length===1){this.streetviewData=c[0];this.streetViewPointResult=new OpenLayers.LonLat(this.streetviewData.e,this.streetviewData.n);var d=50;var b;if(this.items.length===1){b=this.items[0]}else{b=this.items[this.itemIndex]}if(b){switch(this.getHemnetType(b)){case"house":d=100;break;case"flat":d=50;break;case"cottage":d=75;break;default:d=50}}if(OpenLayers.Util.distVincenty(this.streetViewPointSource,this.streetViewPointResult)*1000<d){this.streetviewHeading=Eniro.Util.bearing(this.streetViewPointResult,this.streetViewPointSource);this.displayLinks({streetview:true})}}else{this.streetViewPointSource=null;this.streetviewData=null;this.streetViewPointResult=null;this.streetviewHeading=null;this.displayLinks({streetview:false})}},getPopupHTML:function(a){if(a&&this.items.length>1){this.itemIndex=-1}else{if(this.itemIndex<-1||this.itemIndex>(this.items.length-1)){this.itemIndex=0}}var h=[];var A=this.classNames;var u,s;var o=this.items;var w,v,B,b,c,k,d;if(a||this.itemIndex===-1){var l=[];var C;for(u=0,s=o.length;u<s;++u){w=o[u];d=w.broker_url;if(Eniro.Profile.id==="se"){d+="&partner_id=eniro"}c=decodeURIComponent(w.address).replace(/\+/g," ");B=Eniro.l10n.numberFormat(w.rooms,".");b=parseFloat(w.rooms)*10;B.setPlaces((b%10>0)?1:0);v=Eniro.l10n.numberFormat(w.area,".");v.setPlaces(0);C=B.toFormatted()+" rum "+v.toFormatted()+"m<sup>2</sup>";l.push('<div class="'+A.multiSubject+'">','<a href="'+d+'">'+c.substr(0,20)+((c.length>20)?"...":"")+"</a> "+C,"</div>")}h=[l.join("")].join("")}else{w=o[this.itemIndex];d=w.broker_url;if(Eniro.Profile.id==="se"){d+="&partner_id=eniro"}var p='<img src="'+w.image_url+'" width="128" height="85" alt="" />';var g={};c=decodeURIComponent(w.address).replace(/\+/g," ");if(c==="null"){c=OpenLayers.i18n("hemnet.popup.null")}var t=Eniro.l10n.numberFormat(w.price,".");t.setPlaces(0);var r=Eniro.l10n.numberFormat(w.fee,".");r.setPlaces(0);B=Eniro.l10n.numberFormat(w.rooms,".");b=parseFloat(w.rooms)*10;B.setPlaces((b%10>0)?1:0);v=Eniro.l10n.numberFormat(w.area,".");v.setPlaces(0);k=Eniro.l10n.numberFormat(w.lot_size,".");k.setPlaces(0);g[OpenLayers.i18n("hemnet.popup.price")]=t.toFormatted()+" kr";if(w.type>699){if(w.area>0){g[OpenLayers.i18n("hemnet.popup.commercial.area")]=v.toFormatted()+" m<sup>2</sup>"}if(w.shop_area>0){shoparea=Eniro.l10n.numberFormat(w.shop_area,".");shoparea.setPlaces(0);g[OpenLayers.i18n("hemnet.popup.commercial.shoparea")]=shoparea.toFormatted()+" m<sup>2</sup>"}if(w.office_area>0){officearea=Eniro.l10n.numberFormat(w.office_area,".");officearea.setPlaces(0);g[OpenLayers.i18n("hemnet.popup.commercial.officearea")]=officearea.toFormatted()+" m<sup>2</sup>"}if(w.storage_area>0){storagearea=Eniro.l10n.numberFormat(w.storage_area,".");storagearea.setPlaces(0);g[OpenLayers.i18n("hemnet.popup.commercial.storagearea")]=storagearea.toFormatted()+" m<sup>2</sup>"}if(w.workshop_area>0){workshoparea=Eniro.l10n.numberFormat(w.workshop_area,".");workshoparea.setPlaces(0);g[OpenLayers.i18n("hemnet.popup.commercial.workshoparea")]=workshoparea.toFormatted()+" m<sup>2</sup>"}if(w.compound_area>0){compoundarea=Eniro.l10n.numberFormat(w.compound_area,".");compoundarea.setPlaces(0);g[OpenLayers.i18n("hemnet.popup.commercial.compoundarea")]=compoundarea.toFormatted()+" m<sup>2</sup>"}}else{if(w.type==="500"){g[OpenLayers.i18n("hemnet.popup.lotSize")]=k.toFormatted()+" m<sup>2</sup>"}else{g[OpenLayers.i18n("hemnet.popup.fee")]=r.toFormatted()+" kr";g[OpenLayers.i18n("hemnet.popup.rooms")]=B.toFormatted();g[OpenLayers.i18n("hemnet.popup.area")]=v.toFormatted()+" m<sup>2</sup>"}}var q=[];for(u in g){if(g.hasOwnProperty(u)){q.push("<dt>"+u+":</dt><dd>"+g[u]+"</dd>")}}if(q.length>0){q=q.join("").replace(/ /g,"&nbsp;")}else{q=""}var z="";if(this.items.length>1){z='<a class="'+A.backLink+'" href="/'+new Date().getTime()+'">'+OpenLayers.i18n("hemnet.popup.back-to-list")+"</a>"}var f=['<div class="'+A.extra+'">','<a class="eniro-new '+A.moreInfo+'" href="'+d+'">'+OpenLayers.i18n("hemnet.popup.object-description").replace(/ /g,"&nbsp;")+"</a>",'<span class="'+A.streetview+'"></span>','<span class="'+A.oblique+'"></span>','<a class="'+A.zoom+'" href="/'+new Date().getTime()+'">'+OpenLayers.i18n("hemnet.popup.zoom-here")+"</a>","</div>"].join("");h=['<div class="'+A.container+'">','<div class="'+A.navigation+'"'+(z?"":' style="display:none;"')+">",'<span class="'+A.navigationInfo+'"></span>','<span class="'+A.prev+'"></span>','<span class="'+A.next+'"></span>',z,"</div>",'<div class="'+A.subject+'">','<a class="eniro-new" href="'+d+'">',c,"</a>","</div>",'<a class="eniro-new '+A.image+'" href="'+d+'">',p,"</a>",'<dl class="'+A.properties+'">',q,"</dl>",f,"</div>",'<div class="'+A.ad+'"><div style="height:60px;"></div></div>'].join("")}return h},updateContentHTML:function(a){OpenLayers.Util.extend(this,a);this.setContentHTML(this.getPopupHTML())},setContentHTML:function(a){Eniro.Popup.ShowOnMap.prototype.setContentHTML.apply(this,arguments);if(this.contentDiv&&this.contentHTML&&this.contentHTML!=this.contentDiv.innerHTML){this.ad=jQuery(this.contentDiv).find("."+this.classNames.ad).get(0);if(this.ad){Eniro.Emediate.loadBanner({cu:Eniro.Profile.sellable.hemnetPopup},this.ad,{success:OpenLayers.Function.bind(function(){jQuery(this.ad).find("iframe").css({visibility:"visible"})},this)})}}this.displayZoomLink();this.displayStreetviewLink();this.displayNavigationLinks()},displayZoomLink:function(){if(this.map&&this.div&&this.items){this.displayLinks({zoom:(this.items.length>0&&this.map.getZoom()<this.map.getRealZoom(13))})}},displayStreetviewLink:function(){var a=false;if(this.lonlat){var b=this.lonlat.clone();b.transform(this.map.getProjectionObject(),this.map.backendProjection);if(this.streetViewPointSource){if(b.equals(this.streetViewPointSource)){this.displayLinks({streetview:true})}else{a=true}}else{a=true}}if(a){this.streetViewPointSource=this.lonlat.clone();this.streetViewPointSource.transform(this.map.getProjectionObject(),this.map.backendProjection);jQuery.jsonp({url:Eniro.AppNode.appUrl("/streetview/search"),data:{north:this.streetViewPointSource.lat,east:this.streetViewPointSource.lon},callbackParameter:"callback",success:OpenLayers.Function.bind(this.onStreetViewQuerySuccess,this),error:OpenLayers.Function.bind(this.onStreetViewQuerySuccess,this)})}},displayNavigationLinks:function(){var a=jQuery(this.div).find("."+this.classNames.backLink).size()>0;if(a){jQuery(this.div).find("."+this.classNames.navigation).show();jQuery(this.div).find("."+this.classNames.navigationInfo).text(OpenLayers.i18n("hemnet.popup.navigation-info",{current:this.itemIndex+1,total:this.items.length}))}else{jQuery(this.div).find("."+this.classNames.navigation).hide()}this.displayLinks({prev:a,next:a})},displayLinks:function(f){var a=["zoom","streetview","next","prev"];var d,c;for(var b=0,g=a.length;b<g;++b){c=a[b];d=jQuery(this.div).find("."+this.classNames[c]);if(f[c]){if(d.size()>0){if(d.is("span")){d.replaceWith('<a class="'+this.classNames[c]+'" href="/'+new Date().getTime()+'">'+OpenLayers.i18n("hemnet.popup."+c)+"</a>")}else{d.show()}}}else{if(f[c]===false){d.hide()}}}},getHemnetType:function(c){var a={house:[100,110,120,130,190,210,330],flat:[220,400,410,430,440,450,130],cottage:[200,210,220,330]};var b=null;if(OpenLayers.Util.indexOf(a.house,c.type)>=0){b="house"}else{if(OpenLayers.Util.indexOf(a.flat,c.type)>=0){b="flat"}else{if(OpenLayers.Util.indexOf(a.cottage,c.type)>=0){b="cottage"}}}return b},draw:function(){Eniro.Popup.ShowOnMap.prototype.draw.apply(this,arguments);this.displayZoomLink();this.map.events.register("zoomend",this,this.onZoomEnd);if(this.items.length>0){OpenLayers.Event.observe(this.contentDiv,"click",OpenLayers.Function.bind(this.onPopupClick,this))}this.div.style.cursor="default";jQuery(this.contentDiv).css("overflow","hidden");jQuery(this.contentDiv).parent().parent().addClass("hemnetPopup");return this.div},getItemIds:function(){var a=[];for(var b=0,c=this.items.length;b<c;++b){a.push(this.items[b].id)}return a.join(",")},CLASS_NAME:"Eniro.Popup.Hemnet"});Eniro.Popup.Yellow=OpenLayers.Class(Eniro.Popup.ShowOnMap,{resultType:"yellow",closeBox:false,CLASS_NAME:"Eniro.Popup.Yellow"});Eniro.Feature.Label=OpenLayers.Class(OpenLayers.Feature.Vector,{draggable:false,width:0,offsetLeft:0,initialize:function(c,a,b){OpenLayers.Util.extend(this,b||{});if(c instanceof OpenLayers.LonLat){c=new OpenLayers.Geometry.Point(c.lon,c.lat)}if(!this.style){this.style={pointRadius:0,label:a.label?a.label.substring(0,2):"",fontWeight:"bold",fontSize:"12px",fontFamily:"Arial,Helvetica,sans-serif",fontColor:a.fontColor?a.fontColor:"#ffffff",zIndex:1000}}c.oldCentroid=c.getCentroid;c.getCentroid=OpenLayers.Function.bind(this.getCentroid,this);var d=jQuery('<div style="font-family:'+this.style.fontFamily+";font-weight:"+this.style.fontWeight+";font-size:"+this.style.fontSize+';"></div>').appendTo("body").get(0);this.width=OpenLayers.Util.getRenderedDimensions(this.style.label,null,{containerElement:d});jQuery(d).remove();if(b&&!isNaN(b.offsetLeft)){this.offsetLeft=b.offsetLeft}else{this.offsetLeft=(this.width%2===0)?0:1}OpenLayers.Feature.Vector.prototype.initialize.apply(this,[c,a,this.style])},setVisible:function(a){this.style.display=(a)?"":"none";if(this.geometry){this.move(new OpenLayers.LonLat(this.geometry.x,this.geometry.y))}},getCentroid:function(){var b=this.geometry.oldCentroid();var a=this.layer.map.getResolution();b.y=((b.y/a)+21)*a;b.x=((b.x/a)+this.offsetLeft)*a;return b},onRendered:function(){if(this.layer.renderer.CLASS_NAME==="OpenLayers.Renderer.SVG"){var a=document.getElementById(this.id+this.layer.renderer.LABEL_ID_SUFFIX);if(a){a.setAttributeNS(null,"y",Math.round(a.getAttribute("y")))}}},toggle:function(){this.setVisible(this.style.display==="none")},show:function(){this.setVisible(true)},hide:function(){this.setVisible(false)},CLASS_NAME:"Eniro.Feature.Vector"});Eniro.Feature.Vector=OpenLayers.Class(OpenLayers.Feature.Vector,{draggable:false,style:null,EVENT_TYPES:["mouseover","mouseout","click","clickout","dragstart","dragmove","dragend"],initialize:function(h,b,d){OpenLayers.Util.extend(this,d||{});if(h instanceof OpenLayers.LonLat){h=new OpenLayers.Geometry.Point(h.lon,h.lat)}if(!this.style){var a=this.defaultStyle||"blue";this.style={externalGraphic:Eniro.Util.getImagesLocation()+"markers/draw/"+a+".png",graphic:true,graphicZIndex:9001,graphicWidth:32,graphicHeight:35,graphicYOffset:-35,graphicXOffset:-9,pointRadius:0}}Eniro.Config=Eniro.Config||{"media.version":123};var c=["externalGraphic","backgroundGraphic"];var g;for(var f=0,k=c.length;f<k;++f){g=this.style[c[f]];if(g&&!/^http:\/\//.test(g)){this.style[c[f]]+=("?v="+Eniro.Config["media.version"])}}OpenLayers.Feature.Vector.prototype.initialize.apply(this,[h,b,this.style]);this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES)},setVisible:function(a){this.style.display=(a)?"":"none";if(this.geometry){this.move(new OpenLayers.LonLat(this.geometry.x,this.geometry.y))}},toggle:function(){this.setVisible(this.style.display==="none")},show:function(){this.setVisible(true)},hide:function(){this.setVisible(false)},CLASS_NAME:"Eniro.Feature.Vector"});Eniro.Feature.PopupFeature=OpenLayers.Class(Eniro.Feature.Vector,{popupContents:null,popupClass:Eniro.Popup.Feature,popupOptions:{},openOnMouseOver:true,mouseoverDelay:200,mouseoutDelay:50,popup:null,timer:null,stuck:false,initialize:function(c,a,b){Eniro.Feature.Vector.prototype.initialize.apply(this,arguments);this.constructorArgs=arguments;this.events.on({mouseover:this.onMouseOver,mouseout:this.onMouseOut,click:this.onClick})},destroy:function(){if(this.openTimer!==null){clearTimeout(this.openTimer);this.openTimer=null}if(this.closeTimer!==null){clearTimeout(this.closeTimer);this.closeTimer=null}this.closePopup();Eniro.Feature.Vector.prototype.destroy.apply(this,arguments)},onMouseOver:function(a){if(this.openOnMouseOver){if(this.openTimer!==null){clearTimeout(this.openTimer);this.openTimer=null}if(this.closeTimer!==null){clearTimeout(this.closeTimer);this.closeTimer=null}if(this.popup===null){this.openTimer=setTimeout(OpenLayers.Function.bind(this.openPopup,this),this.mouseoverDelay)}}},onMouseOut:function(a){if(this.openTimer!==null){clearTimeout(this.openTimer);this.openTimer=null}if(this.openOnMouseOver&&!(this.stuck||(this.popup&&this.popup.stuck))){this.closeTimer=setTimeout(OpenLayers.Function.bind(this.closePopup,this),this.mouseoutDelay)}},onClick:function(a){if(this.openTimer!==null){clearTimeout(this.openTimer);this.openTimer=null}if(this.closeTimer!==null){clearTimeout(this.closeTimer);this.closeTimer=null}this.stuck=true;this.openPopup()},onPopupCloseButton:function(a){OpenLayers.Event.stop(a);if(this.popup){this.popup.stuck=false}this.stuck=false;this.closePopup();return false},openPopup:function(){if(this.popup===null&&this.popupContents!==null){var a={};OpenLayers.Util.extend(a,this.popupOptions);if(!this.stuck){a.panMapIfOutOfView=false}this.popup=new this.popupClass(this,a);this.layer.map.addPopup(this.popup)}else{if(this.popup!==null){this.popup.show()}}if(this.popup){this.popup.stuck=this.stuck}},closePopup:function(){if(this.popup!==null){this.popup.map.removePopup(this.popup);this.popup.destroy();this.popup=null}},getPopupContents:function(){if(this.popupContents!==null){if(typeof this.popupContents=="string"){return OpenLayers.String.format(this.popupContents,this.attributes)}if(typeof this.popupContents=="function"){return this.popupContents(this.attributes)}}return null},setOriginalFeature:function(c,a){if(c.onMouseOut){c.onMouseOut()}this.backup=this.clone();var b=["map","layer","geometry"];for(var d in c){if((typeof c[d]==="function"||typeof c[d]==="object")&&(b.indexOf(d)===-1)){this[d]=c[d]}}this.style.externalGraphic=this.style.externalGraphic.replace(/-\d+\.(.*)$/,"-single.$1");this.move(new OpenLayers.LonLat(this.geometry.x,this.geometry.y));this.routeable=true},unsetOriginalFeature:function(){var a=this.backup||{};for(var b in this){if(a[b]){this[b]=a[b]}else{if(b!=="layer"&&b!=="map"){delete this[b]}}}if(a.style){this.style=a.style;this.move(this.geometry.getBounds().getCenterLonLat())}delete this.backup;this.routeable=false},getMarkerTitle:function(){return this.toString()},hide:function(){this.style.display="none";this.move(new OpenLayers.LonLat(this.geometry.x,this.geometry.y))},show:function(a){this.style.display="";if(!a){a=new OpenLayers.LonLat(this.geometry.x,this.geometry.y)}this.move(a)},clone:function(){var a=Eniro.Util.reflect(this.CLASS_NAME,this.constructorArgs);a.layer=this.layer;a.json=this.json;if(this.lonlat){a.lonlat=this.lonlat.clone()}else{if(this.geometry){a.lonlat=new OpenLayers.LonLat(this.geometry.x,this.geometry.y)}}return a},copyTo:function(a){a=this.clone()},CLASS_NAME:"Eniro.Feature.PopupFeature"});Eniro.Feature=Eniro.Feature||{};Eniro.Feature.WFSMarker=OpenLayers.Class(Eniro.Feature.PopupFeature,{markerType:undefined,aggregatedFeatures:null,parentAggregate:null,backgroundEmpty:null,backgroundSelected:null,listItems:[],initialize:function(f,a,b){var c=Eniro.Profile.providers[a.source].icon;if(a.singleHit){c+="-single"}else{c+="-"+a.ordinal}this.backgroundEmpty=Eniro.Util.getImagesLocation()+"markers/search/bg-empty.png";this.backgroundSelected=Eniro.Util.getImagesLocation()+"markers/search/bg-normal.png";var d={style:{externalGraphic:Eniro.Util.getImagesLocation()+"markers/search/"+c+".png",graphicWidth:27,graphicHeight:37,graphicXOffset:-11,graphicYOffset:-31,graphicZIndex:1000},mouseover:true};OpenLayers.Util.extend(d,b);Eniro.Feature.PopupFeature.prototype.initialize.apply(this,[f,a,d]);this.markerType=Eniro.Constant.MarkerTypes.fromProvider(a.source)},onMouseOver:function(a){Eniro.Feature.PopupFeature.prototype.onMouseOver.apply(this,arguments)},onMouseOut:function(a){Eniro.Feature.PopupFeature.prototype.onMouseOut.apply(this,arguments)},onClick:function(c){var b=jQuery(c.target).closest("a");if(jQuery(b).is("a.eniro-popup-homepage-link")){Eniro.AppEvents.triggerEvent(Eniro.Events.STATISTICS_LOG,{scope:"navigate",event:"itemHomepage",data:{addaxUrl:this.getEDataValue(this.attributes["e:statistics"],"@src"),provider:this.attributes.source}})}else{if(this.parentAggregate!==null){}else{Eniro.Feature.PopupFeature.prototype.onClick.apply(this,arguments)}}},popupContents:function(b){var a=this.attributes;switch(a.source){case"yp_no":return this.renderContentYpNo();case"wp_no":return this.renderContentWpNo();case"geo_no":return this.formatAddressNo();case"geo_fi":case"geo_se":case"geo_dk":case"geo_dk_krak":return this.formatAddress(a.address);case"yp_se":case"yp_fi":case"yp_ptr_se":case"yp_ptr_fi":case"yp_dk":case"yp_dk_krak":case"yp_ptr_dk_krak":return this.renderEdataContent();case"wp_se":case"wp_dk":case"wp_dk_krak":return this.renderEdataContent();case"aggregate":return this.renderEdataContent();default:return"&nbsp;"}},getMarkerTitle:function(a){switch(this.attributes.source){case"yp_no":return this.attributes.companyName+", "+this.formatAddressAsString(this.attributes.visitorAddress);case"wp_no":return this.getNameWpNo(this.attributes)+", "+this.formatAddressAsString(this.attributes);case"geo_no":case"geo_fi":case"geo_se":case"geo_dk":case"geo_dk_krak":return Eniro.Util.FeatureUtils.getAddressAsString(this);case"yp_se":case"yp_fi":case"yp_ptr_se":case"yp_ptr_fi":case"yp_dk":case"yp_dk_krak":return this.attributes.title["#text"].replace(/\s*$/,"")+", "+this.formatAddressAsString(this.getContentAsObject().address);case"wp_se":case"wp_dk":case"wp_dk_krak":return this.attributes.title["#text"].replace(/\s*$/,"")+", "+this.formatAddressAsString(this.getContentAsObject().address);case"aggregate":return this.aggregatedFeatures.length+this.i18n("number_of_companies")+this.formatAddressAsString(this.getContentAsObject().address);default:return""}},renderEdataContent:function(){var r=this.attributes;var q=[];var o=Eniro.Profile.providers[r.source].dataTransformers;var w="";if(r.link&&r.link["@href"]){w=' href="'+r.link["@href"]+'"'}q.push('<a class="eniro-new eniro-popup-title"'+w+">"+r.title["#text"]+"</a>");if(r["e:phone_numbers"]&&r["e:phone_numbers"]["e:phone_number"]){q.push('<span class="eniro-popup-tel">'+r["e:phone_numbers"]["e:phone_number"]["#text"]+"</span>")}var d=r["e:addresses"];var g=(d)?d:r;if(d&&d.length>0){for(var v=0,s=d.length;v<s;++v){if(d[v]["e:address"]["@match"]&&d[v]["e:address"]["@match"]=="true"){g=d[v];break}}}var k={streetName:g["e:address"]["e:street_name"],streetNumber:g["e:address"]["e:street_number"],postalCode:g["e:address"]["e:post_code"],city:g["e:address"]["e:post_area"]};q.push('<span class="eniro-popup-address">'+this.formatAddress(k)+"</span>");var c=[];if(r["e:homepage_url"]){var h=r["e:homepage_url"];if(h.substr(0,7)!=="http://"){h="http://"+h}c.push('<a class="eniro-new eniro-popup-homepage-link" href="'+h+'">'+OpenLayers.i18n("popup-website")+"</a>")}if(r["e:email"]){c.push('<a href="mailto:'+r["e:email"]+'">'+r["e:email"]+"</a>")}if(c.length>0){q.push('<span class="eniro-popup-links">'+c.join(" - ")+"</span>")}c=[];var z;var l;var p;var f={};var a=r.link&&r.link["@href"]?r.link["@href"].replace(/^(http:\/\/.*?)\/.*$/,"$1"):"http://gulasidorna.eniro.se";var t=a+OpenLayers.i18n("eniro.yp.company-seo");var A=this.getEData(r["e:infopage"],"e:component",{"@type":"text","@component_name":"book_table"});if(A&&A.length>0&&A[0]){z=this.getEDataValue(A[0],"e:url");l=this.getEDataValue(A[0],"e:label");p=true;if(o&&o.book_table){var u=o.book_table;f={searchData:"search_word="+r.title["#text"]};z=z.match(u.href.filter)?Eniro.Util.FeatureUtils.transformInfoListingUrl(r,u.href.rewrite,t,f):null;p=false}if(z&&l){c.push('<a href="'+z+'"'+(p?' class="eniro-new"':"")+">"+l+"</a>")}}A=this.getEData(r["e:infopage"],"e:component",{"@type":"text","@component_name":"booking_com"});if(A&&A.length>0&&A[0]){z=this.getEDataValue(A[0],"e:url");l=this.getEDataValue(A[0],"e:label");p=true;if(o&&o.booking_com){var b=o.booking_com;f={searchData:"search_word="+r.title["#text"]};z=z.match(b.href.filter)?Eniro.Util.FeatureUtils.transformInfoListingUrl(r,b.href.rewrite,t,f):null;p=false}if(z&&l){c.push('<a href="'+z+'"'+(p?' class="eniro-new"':"")+">"+l+"</a>")}}A=this.getEData(r["e:infopage"],"e:component",{"@type":"text","@component_name":"custom_book_and_order"});if(A&&A.length>0&&A[0]){z=this.getEDataValue(A[0],"e:url");l=this.getEDataValue(A[0],"e:label");if(z&&l){c.push('<a href="'+z+'" class="eniro-new">'+l+"</a>")}}if(c.length>0){q.push('<span class="eniro-popup-links">'+c.join(" - ")+"</span>")}return q.join("")},renderContentYpNo:function(){var c=this.attributes;var f=[];var d="";if(c.link){d=' href="'+c.link+'"'}f.push('<a class="eniro-new eniro-popup-title"'+d+">"+c.companyName+"</a>");if(c.telephoneNumber){f.push('<span class="eniro-popup-tel">'+Eniro.Util.FeatureUtils.formatNorwegianPhoneNo(c.telephoneNumber)+"</span>")}f.push('<span class="eniro-popup-address">'+this.formatAddress(c.visitorAddress)+"</span>");var a=[];if(c.homePage){var b=c.homePage;if(b.substr(0,7)!=="http://"){b="http://"+b}a.push('<a class="eniro-new eniro-popup-homepage-link" href="'+b+'">'+OpenLayers.i18n("popup-website")+"</a>")}if(c.eMail){a.push('<a href="mailto:'+c.eMail+'">'+c.eMail+"</a>")}if(a.length>0){f.push('<span class="eniro-popup-links">'+a.join(" - ")+"</span>")}return f.join("")},renderContentWpNo:function(){var b=this.attributes;var d=[];var a=this.getNameWpNo(b);var c="";if(b.link){c=' href="'+b.link+'"'}d.push('<a class="eniro-new eniro-popup-title"'+c+">"+a+"</a>");d.push('<span class="eniro-popup-address">'+this.formatAddress(b)+"</span>");return d.join("")},getNameWpNo:function(b){var a=[];if(b.firstName&&OpenLayers.String.trim(b.firstName)){a.push(b.firstName)}if(b.lastName&&OpenLayers.String.trim(b.lastName)){a.push(b.lastName)}return a.join(" ")},getContentAsObject:function(){var d=this.attributes;var c;if(d["e:phone_numbers"]&&d["e:phone_numbers"]["e:phone_number"]){c=d["e:phone_numbers"]["e:phone_number"]["#text"]}var h=d["e:addresses"];var b=(h)?h:d;if(h&&h.length>0){for(var f=0,k=h.length;f<k;++f){if(h[f]["e:address"]["@match"]&&h[f]["e:address"]["@match"]=="true"){b=h[f];break}}}var a=b?b["e:address"]["e:phone_numbers"]:undefined;if(!c&&a&&a["e:phone_number"]){if(a["e:phone_number"]["@match"]&&a["e:phone_number"]["@match"]=="true"){c=a["e:phone_number"]["#text"]}}var g={streetName:b["e:address"]["e:street_name"],streetNumber:b["e:address"]["e:street_number"],postalCode:b["e:address"]["e:post_code"],city:b["e:address"]["e:post_area"]};return{title:d.title["#text"],address:g,phoneNumber:c}},getEData:function(d,k,b){var o=[];if(d){if(d.constructor==Array){for(var f=0;f<d.length;f++){var c=d[f];if(!c.length){o=o.concat(this.getEData(c,k,b))}}}else{if(k&&d.hasOwnProperty(k)){d=d[k]}if(!b){o.push(d)}else{var g=true;for(var h in b){g=d.hasOwnProperty(h);if(g){var a=d[h];var l=b[h];g=(a===l)}if(!g){break}}if(g){o.push(d)}}}}return o},getEDataValue:function(d,a){var c=null;if(d){if(!a){if(d.hasOwnProperty("@type")){var b=d["@type"];if(b==="text/xml"){a="@href"}else{if(b==="picture"){a="e:src"}}}if(!a){a="#text"}}if(a&&d.hasOwnProperty(a)){c=d[a]}}return(typeof c==="string"&&c.indexOf("http")<0)?c.wrap(50):c},formatAddressNo:function(){var g=this.attributes;var d=[];var a;if(g.postplaces){a=g.postplaces[0]}var f=g.street;if(typeof f==="object"){f=f.value}if(f){var c=f;if(g.streetNumber){c+=" "+g.streetNumber}if(c.length>0){d.push(c)}}var b="";if(a){if(a.id){b+=a.id}if(a.value){b+=" "+a.value}}else{if(g.nameOfPlace){b=g.nameOfPlace;if(g.municipality){b+=", "+g.municipality.value}}}d.push(b);return this.formatAddress({addressLines:d})},formatAddress:function(b){var c;if(b.addressLines){c=b.addressLines.join("<br />")}else{var h="";if(b.streetName){h=b.streetName;if(b.streetNumber){h+=" "+b.streetNumber}}var f=b.postalCode?b.postalCode:"";var g=b.city?b.city:"";var a=b.postArea?b.postArea:"";var d=[];d=d.concat([h,(h!==""?"<br/>":""),f," ",(Eniro.Profile.providers[this.attributes.source].postAreaHasPrecedence?a:g)]);c=d.join("")}return c},formatAddressAsString:function(b){var c;if(b.addressLines){c=b.addressLines.join(", ");c=c.replace(/,\s*$/,"")}else{var h="";if(b.streetName){h=b.streetName;if(b.streetNumber){h+=" "+b.streetNumber}}var d=b.postalCode?b.postalCode:"";var g=b.city?b.city:"";var a=b.postArea?b.postArea:"";var f=[];f=f.concat([h,(h!==""?", ":""),d," ",(Eniro.Profile.providers[this.attributes.source].postAreaHasPrecedence?a:g)]);c=f.join("")}return c},CLASS_NAME:"Eniro.Feature.WFSMarker"});Eniro.Feature=Eniro.Feature||{};Eniro.Feature.AggregateWFSMarker=OpenLayers.Class(Eniro.Feature.PopupFeature,{aggregatedFeatures:null,parentAggregate:null,backgroundEmpty:null,backgroundSelected:null,containerDisplayClass:null,listItems:null,provider:null,initialize:function(f,a,b){this.listItems=[];this.provider=a.provider;this.backgroundEmpty=Eniro.Util.getImagesLocation()+"markers/search/bg-empty.png";this.backgroundSelected=Eniro.Util.getImagesLocation()+"markers/search/bg-normal.png";this.containerDisplayClass="aggregatePopupContainer";var c=Eniro.Profile.providers[this.provider].icon||"yellow";var d={style:{externalGraphic:Eniro.Util.getImagesLocation()+"markers/search/"+c+"-aggregate.png",graphicWidth:31,graphicHeight:40,graphicXOffset:-15,graphicYOffset:-35,graphicZIndex:1000,heading:true},mouseover:true};OpenLayers.Util.extend(d,b);Eniro.Feature.PopupFeature.prototype.initialize.apply(this,[f,a,d])},destroy:function(){this.listItems=null;this.parentAggregate=null;this.aggregatedFeatures=null;Eniro.Feature.PopupFeature.prototype.destroy.apply(this,arguments)},onMouseOver:function(a){Eniro.Feature.PopupFeature.prototype.onMouseOver.apply(this,arguments)},onMouseOut:function(a){Eniro.Feature.PopupFeature.prototype.onMouseOut.apply(this,arguments)},openPopup:function(){if(this.popup===null&&this.popupContents!==null){var d="";var b=this.aggregatedFeatures[0].attributes;if(b["e:addresses"]){d=b["e:addresses"]["e:address"]["e:street_name"]||""}else{if(b["e:address"]){d=b["e:address"]["e:street_name"]||""}else{if(b.streetName){d=b.streetName}else{if(b.visitorAddress&&b.visitorAddress.streetName){d=b.visitorAddress.streetName}}}}var c=this.provider.split("_")[0];var f=OpenLayers.i18n("aggregate-wfs-marker.popupHeading_"+c,{quantity:this.aggregatedFeatures.length,streetName:d});var a={heading:f};OpenLayers.Util.extend(a,this.popupOptions);if(!this.stuck){a.panMapIfOutOfView=false}this.popup=new Eniro.HeadingPopup(this,a);if(this.popup){this.popup.stuck=this.stuck}this.layer.map.addPopup(this.popup)}else{this.popup.show()}},popupContents:function(){var b=["<ul>"];for(var d=0,a=this.aggregatedFeatures.length;d<a;d++){var f=this.listItems[d];var c=f.div.innerHTML;var g=f.feature.id;b.push("<li id='"+g+"_popupResultItem' class='"+f.getCssClassName("listItem")+"'>"+c+"</li>")}b.push("</ul>");this.popupContents=b.join("");return this.popupContents},setAggregatedFeatures:function(d,g){this.aggregatedFeatures=new Array(d.length);this.listItems=new Array(d.length);for(var c=0,a=d.length;c<a;c++){var b=d[c];b.parentAggregate=this;b.hide();this.aggregatedFeatures[c]=b;var f=new Eniro.AggregatedPopupResultItem({index:this.aggregatedFeatures.length,feature:b.json,provider:g});f.draw();this.listItems[c]=f}},CLASS_NAME:"Eniro.Feature.AggregateWFSMarker"});Eniro.Feature.StaticLocationMarker=OpenLayers.Class(Eniro.Feature.PopupFeature,{backgroundEmpty:null,backgroundSelected:null,containerDisplayClass:null,initialize:function(k,d,g){this.backgroundEmpty=Eniro.Util.getImagesLocation()+"markers/search/bg-empty.png";this.backgroundSelected=Eniro.Util.getImagesLocation()+"markers/search/bg-normal.png";this.containerDisplayClass="staticLocationPopupContainer";var f=this.getDisplayType(d.type);var c=Eniro.Util.getImagesLocation()+"markers/";if(f==="route"){c+="route/route-instruction.png"}else{c+="search/"+f+"-single.png"}var h={style:{externalGraphic:c,graphicWidth:27,graphicHeight:37,graphicXOffset:-11,graphicYOffset:-31,graphicZIndex:1000,heading:true},mouseover:true};OpenLayers.Util.extend(h,g);this.popupContents=d.text||null;var b=k.clone();var a=k.clone();Eniro.Feature.PopupFeature.prototype.initialize.apply(this,[b,d,h]);if(d.label){this.label=new Eniro.Feature.Label(a,jQuery.extend(true,{fontColor:f==="yellow"?"#000000":"#ffffff"},d))}Eniro.AppEvents.register(Eniro.Events.SEARCH_RESULT_AVAILABLE,this,this.onSearchResultAvailable)},destroy:function(){Eniro.Feature.PopupFeature.prototype.destroy.apply(this,arguments)},onSearchResultAvailable:function(a){if(a.firstSearch){this.destroy()}},onAdded:function(a){if(this.label){this.layer.addFeatures(this.label);this.layer.events.on({beforefeatureremoved:this.onBeforeFeatureRemoved,scope:this})}},onBeforeFeatureRemoved:function(a){if(a.feature===this&&this.label){this.layer.removeFeatures(this.label);this.layer.events.un({beforefeatureremoved:this.onBeforeFeatureRemoved,scope:this})}},getDisplayType:function(b){var a="yellow";if(b){b=b.toLowerCase();if(b==="green"){a="person"}else{if(b==="red"){a="address"}else{if(b==="blue"){a="route"}}}}return a},CLASS_NAME:"Eniro.Feature.StaticLocationMarker"});Eniro.Feature.PredefinedMarker=OpenLayers.Class(Eniro.Feature.WFSMarker,{initialize:function(f,a,b){var c=this.getIcon(a);if(a.singleHit){c+="-single"}else{c+="-"+a.ordinal}this.backgroundEmpty=Eniro.Util.getImagesLocation()+"markers/search/bg-empty.png";this.backgroundSelected=Eniro.Util.getImagesLocation()+"markers/search/bg-normal.png";var d={mouseover:true};if(c.match(/^predefined/)){d.style={graphicWidth:Eniro.Profile.sellable.preDefinedYP.iconStyle.graphicWidth,graphicHeight:Eniro.Profile.sellable.preDefinedYP.iconStyle.graphicHeight,graphicXOffset:Eniro.Profile.sellable.preDefinedYP.iconStyle.graphicXOffset,graphicYOffset:Eniro.Profile.sellable.preDefinedYP.iconStyle.graphicYOffset}}else{d.style={graphicWidth:27,graphicHeight:37,graphicXOffset:-11,graphicYOffset:-31}}d.style.externalGraphic=Eniro.Util.getImagesLocation()+"markers/search/"+c+".png";d.style.graphicZIndex=1000;OpenLayers.Util.extend(d,b);Eniro.Feature.WFSMarker.prototype.initialize.apply(this,[f,a,d])},getIcon:function(a){var h=Eniro.Profile.providers[a.source];var d="yellow";if(h&&Eniro.Profile.sellable[h.sellable]){var f=Eniro.Profile.sellable[h.sellable];var g=a.linkId;if(g&&f.options){for(var b=0,k=f.options.length;b<k;b++){var c=f.options[b];if(c.linkId===g&&c.marker){d="predefined/"+c.marker;break}}}}return d},openPopup:function(){if(this.popup===null&&this.popupContents!==null){Eniro.AppEvents.triggerEvent(Eniro.Events.STATISTICS_LOG,{scope:"navigate",event:"openPredefinedYpPopup",data:{addaxUrl:this.getEDataValue(this.attributes["e:statistics"],"@src"),provider:this.attributes.source}})}Eniro.Feature.PopupFeature.prototype.openPopup.apply(this,arguments)},CLASS_NAME:"Eniro.Feature.PredefinedMarker"});Eniro.Feature=Eniro.Feature||{};Eniro.Feature.AggregatePredefinedMarker=OpenLayers.Class(Eniro.Feature.AggregateWFSMarker,{initialize:function(g,a,b){this.listItems=[];var c="yellow";if(a.features&&a.features.length>0){c=Eniro.Util.FeatureUtils.getCompanyIcon(a.features[0].attributes)}this.provider=a.provider;this.backgroundEmpty=Eniro.Util.getImagesLocation()+"markers/search/bg-empty.png";this.backgroundSelected=Eniro.Util.getImagesLocation()+"markers/search/bg-normal.png";this.containerDisplayClass="aggregatePopupContainer";var f={mouseover:true};var d;if(c){d={externalGraphic:c,graphicZIndex:1000,backgroundGraphic:Eniro.Util.getImagesLocation()+"markers/search/accentuated-aggregate.png",backgroundZIndex:999};OpenLayers.Util.extend(d,Eniro.Profile.marker.predefined.aggregateIconStyle);f.style=d}else{if(Eniro.Profile.sellable.preDefinedYP&&(Eniro.Profile.sellable.preDefinedYP.dynamicIcon===false)){d={externalGraphic:Eniro.Util.getImagesLocation()+"markers/search/"+this.getPredefinedIcon(a)+"-"+ordinal+".png",graphicZIndex:1000,backgroundZIndex:999};OpenLayers.Util.extend(d,Eniro.Profile.marker.accentuated.style);f.style=d}else{f.style={graphicWidth:31,graphicHeight:40,graphicXOffset:-15,graphicYOffset:-35,externalGraphic:Eniro.Util.getImagesLocation()+"markers/search/yellow-aggregate.png",graphicZIndex:1000}}}OpenLayers.Util.extend(f,b);Eniro.Feature.AggregateWFSMarker.prototype.initialize.apply(this,[g,a,f])},CLASS_NAME:"Eniro.Feature.AggregatePredefinedMarker"});Eniro.Feature.AccentuatedMarker=OpenLayers.Class(Eniro.Feature.WFSMarker,{initialize:function(g,b,c){var a=b.singleHit?"single":b.ordinal;var f={mouseover:true};var d={externalGraphic:Eniro.Util.FeatureUtils.getCompanyIcon(b),backgroundGraphic:Eniro.Util.getImagesLocation()+"markers/search/accentuated-"+a+".png",graphicZIndex:1000,backgroundZIndex:999};if(Eniro.Profile.sellable.preDefinedYP&&(Eniro.Profile.sellable.preDefinedYP.dynamicIcons===false)){d.externalGraphic=Eniro.Util.getImagesLocation()+"markers/search/"+this.getPredefinedIcon(b)+"-"+a+".png";delete d.backgroundGraphic}OpenLayers.Util.extend(d,Eniro.Profile.marker.accentuated.style);f.style=d;if(b.singleHit){f.style.backgroundXOffset=-12;f.style.backgroundYOffset=-33}else{f.style.backgroundXOffset=-21;f.style.backgroundYOffset=-33}OpenLayers.Util.extend(f,c);Eniro.Feature.WFSMarker.prototype.initialize.apply(this,[g,b,f])},openPopup:function(){if(this.popup===null&&this.popupContents!==null){Eniro.AppEvents.triggerEvent(Eniro.Events.STATISTICS_LOG,{scope:"navigate",event:"openAccentuatedYpPopup",data:{addaxUrl:this.getEDataValue(this.attributes["e:statistics"],"@src"),provider:this.attributes.source}})}Eniro.Feature.PopupFeature.prototype.openPopup.apply(this,arguments)},getPredefinedIcon:function(a){var h=Eniro.Profile.providers[a.source];var d="yellow";if(h&&Eniro.Profile.sellable[h.sellable]){var f=Eniro.Profile.sellable[h.sellable];var g=a.linkId;if(g&&f.options){for(var b=0,k=f.options.length;b<k;b++){var c=f.options[b];if(c.linkId===g&&c.name){d="predefined/"+c.name;break}}}}return d},CLASS_NAME:"Eniro.Feature.AccentuatedMarker"});Eniro.MetaGeoJSON=OpenLayers.Class(OpenLayers.Format.GeoJSON,{initialize:function(a){OpenLayers.Format.GeoJSON.prototype.initialize.apply(this,[a])},destroy:function(){OpenLayers.Format.GeoJSON.prototype.destroy.apply(this,arguments)},read:function(b){var c=[];for(var f in b.search){if(b.search[f]&&b.search[f].geoJSONResult){var d=b.search[f].geoJSONResult;if(d){this.currentProvider=b.search[f];this.currentProviderName=f;this._ord=0;this._lastGroup=null;var a=OpenLayers.Format.GeoJSON.prototype.read.apply(this,[d]);if(a){if(a.length!==undefined){c=c.concat(a)}else{c.push(a)}}}}}c=jQuery.grep(c,function(g){return g?true:false});return{features:c,json:b}},readFeature:function(b){this._ord=0;this.currentProvider.totalHits=1;var a=OpenLayers.Format.GeoJSON.prototype.read.apply(this,[b]);return a},parseFeature:function(f){var b,g,a;a=(f.properties)?f.properties:{};a.source=a.source||this.currentProviderName;var d=this.getMarkerType(a);if(this._lastGroup!==null&&a.groupID&&a.groupID==this._lastGroup){a.ordinal=this._ord}else{a.ordinal=++this._ord}if(a.groupID){this._lastGroup=a.groupID}a.singleHit=(!this.currentProvider.hasOwnProperty("totalHits")||this.currentProvider.totalHits==1);try{g=this.parseGeometry(f.geometry)}catch(c){throw c}if(g){if(g.CLASS_NAME=="OpenLayers.Geometry.Point"){b=new d(g,a)}else{b=new OpenLayers.Feature.Vector(g,a)}}else{if(a.lonlat){g=new OpenLayers.Geometry.Point(a.lonlat.lon,a.lonlat.lat);if(this.internalProjection&&this.externalProjection){g.transform(this.externalProjection,this.internalProjection)}b=new d(g,a)}else{return null}}if(f.id){b.fid=f.id}b.json=f;return b},getMarkerType:function(a){var b;if(Eniro.Util.FeatureUtils.getCompanyIcon(a)||Eniro.Profile.providers[a.source].sellable){b=Eniro.Feature.AccentuatedMarker}else{b=Eniro.Feature.WFSMarker}return b},CLASS_NAME:"Eniro.MetaGeoJSON"});Eniro.UrlTranslatorController=OpenLayers.Class(Eniro.Control,{MAX_WAYPOINTS:6,initTranslationDone:false,isGeoSearch:false,isYpWpSearch:false,initialize:function(){Eniro.Control.prototype.initialize.apply(this,arguments);this.projections={rt90:new OpenLayers.Projection("EPSG:3021"),wgs84:new OpenLayers.Projection("EPSG:4326"),mercator:new OpenLayers.Projection("EPSG:900913")};this.mapTypes={s:"map",a:"aerial",h:"hybrid",o:"oblique",n:"nautical"};this.imgModes={0:this.mapTypes.s,1:this.mapTypes.a,2:this.mapTypes.h,3:this.mapTypes.o,4:this.mapTypes.n};this.providers={yp:"company",wp:"person",aq:"address"};this.partnerData={hotel:["from_day","to_day","from_month","to_month"]};this.register(Eniro.Events.SEARCH_RESULT_AVAILABLE,this.onSearchResultAvailable)},onSearchResultAvailable:function(a){if(this.onModeSwitchSearch){var c=this.map.getCenter();c.transform(this.projections.mercator,this.projections.wgs84);var b=(a.features[0])?new Eniro.Feature.StaticLocationMarker(this.map.getCenter(),{type:this.providers.wp}):undefined;Eniro.AppEvents.triggerEvent(Eniro.Events.MODE_SWITCH,{mode:"oblique",lonlat:c,searchParams:a.search});this.onModeSwitchSearch=false}},translate:function(b,a){if(!this.initTranslationDone&&b){if(a==="userContent"){this.translateUserContent(b)}else{this.translateQuery(b)}this.initTranslationDone=true}},translateQuery:function(b){Eniro.AppEvents.triggerEvent(Eniro.Events.SEARCH_SET_PREDEFINED_STATUS,false);var a=b.ax||b.partner||b.partner_id||b.click_id||b.clickid;if(a){Eniro.AppEvents.triggerEvent(Eniro.Events.PARTNER_SET,a);Eniro.AppEvents.triggerEvent(Eniro.Events.STATISTICS_LOG,{scope:"page",event:"partner",data:{partner:a}})}this.mapMode="map";if(b.imgmode&&this.imgModes[b.imgmode]){this.mapMode=this.imgModes[b.imgmode]}else{if(b.mapstate&&b.mapstate.type&&this.mapTypes[b.mapstate.type]){this.mapMode=this.mapTypes[b.mapstate.type]}}if(b.mapcomp&&(!b.what||b.what==="map"||(b.what==="map_adr"&&!b.geo_area))){this.setMapMarker(b)}else{if(b.what==="route"||b.addr1){this.setRouteState(b)}else{if(b.what){if(b.what==="map_adr"){this.setGeoState(b)}else{this.setSearchState(b)}}if(b.mapstate){this.setMapState(b)}}}},translateUserContent:function(d){if(d){if(d.markers){var g=[];var a;for(var b=0,h=d.markers.length;b<h;b++){a=this.createMarker(d.markers[b]);if(a){g.push(a)}}this.map.searchLayer.addFeatures(g)}if(d.center&&d.center.lon&&d.center.lat){var c=this.map.getRealZoom(d.zoom)||this.map.getZoom();var f=new OpenLayers.LonLat(d.center.lon,d.center.lat);f.transform(this.projections.wgs84,this.map.getProjectionObject());this.map.setCenter(f,c)}else{if(d.zoom&&/\d+/.test(d.zoom)){this.map.zoomTo(this.map.getRealZoom(d.zoom))}}if(d.layer){this.map.setMapType(d.layer)}}},setMapMarker:function(c){if(c.mapcomp){var f=c.mapcomp;if(f.streetname&&f.city){var b=f.streetname+(f.streetnumber?" "+f.streetnumber:"")+", "+f.city;Eniro.AppEvents.triggerEvent(Eniro.Events.SET_SEARCH_FIELDS,{where:b})}Eniro.AppEvents.triggerEvent(Eniro.Events.MODE_SWITCH,{mode:"search"});var d;if(f.x&&f.y){d=new OpenLayers.LonLat(f.x,f.y);d.transform(this.projections.wgs84,this.projections.mercator);var a=new Eniro.Feature.StaticLocationMarker(d,{type:c.mop});this.map.searchLayer.addFeatures(a)}if(!c.mapstate&&d){c.mapstate={centerX:f.x,centerY:f.y}}this.setMapState(c)}},setMapState:function(d){if(d.mapstate){var k=d.mapstate;var g=this.mapTypes[k.type]||"map";var h=(k.zoomLevel&&Eniro.Profile[g])?Eniro.Profile[g].zoomLevels[k.zoomLevel]:15;if(d.mapstate.zoom){h=d.mapstate.zoom}if(k.centerX&&k.centerY){var f=new OpenLayers.LonLat(k.centerX,k.centerY);if(this.mapMode==="oblique"){if(!this.isYpWpSearch&&!this.isGeoSearch){Eniro.AppEvents.triggerEvent(Eniro.Events.MODE_SWITCH,{mode:"oblique",lonlat:f,marker:this.getMarker()})}}else{f.transform(this.projections.wgs84,this.projections.mercator);this.map.setCenter(f,h,false,true);this.setMapType(this.mapMode,d)}}else{if(k.upperLeftX&&k.upperLeftY&&k.lowerRightX&&k.lowerRightY){var a=new OpenLayers.LonLat(k.lowerRightX,k.lowerRightY);var c=new OpenLayers.LonLat(k.upperLeftX,k.upperLeftY);var b=new OpenLayers.Bounds(c.lon,a.lat,a.lon,c.lat);this.map.zoomToAdjustedExtent(b);this.setMapType(this.mapMode,d)}}}},setRouteState:function(o){var d=true;if(o.addr1||o.what==="route"){Eniro.AppEvents.triggerEvent(Eniro.Events.MODE_SWITCH,{mode:"route"});var a=this.map.getControl(Eniro.ControlID.ROUTE_CONTROLLER);if(o.what==="route"&&!o.addr2&&o.mapcomp){var k=o.mapcomp;o.addr2={x:k.x,y:k.y,address:k.streetname+(k.streetnumber?" "+k.streetnumber:"")+(k.city?", "+k.city:"")}}for(var f=1,b=this.MAX_WAYPOINTS;f<=b;f++){var c=o["addr"+f];if(c){var l={};var h=o["addr"+(f+1)]?(f-1):-1;if(c.x&&c.y){l.lonlat=new OpenLayers.LonLat(c.x,c.y)}l.name=c.address||c;d=d&&a&&a.setWaypointLocation(l,h)}else{if(f>2){break}}}var g={pref:o.calculationMode||"fastest",avoid:[]};if(o.nohiway){g.avoid.push("highway")}if(o.noferry){g.avoid.push("ferry")}if(a){a.setRouteOptions(g)}if(o.addr1&&o.addr2){a.performRouteFormSearch()}}return d},setGeoState:function(c){var b={};var a=c.geo_area||c.streetname;if(a){this.isGeoSearch=true;b.q=a;b.ap=Eniro.Profile.search.location.provider;b.p=Eniro.Profile.search.location.provider}this.setMapType(this.mapMode,c);this.search(b);return(b!=={})},setSearchState:function(l){var o;var a=l.search_word||l.searchword;var c=l.advert_code||l.ps_id;var g=l.geo_area||l.streetname;if(a||c||l.rating_target_id){this.isYpWpSearch=true;var h=this.getProvider(l);var k={q:a,ap:h,p:(l.mop||l.rating_target_id?h:this.getProviders()),where:g,id:c,ratingTargetId:l.rating_target_id,disable_bought_area:l.disable_bought_area?"1":"0",offset:l.offset};k.partner_type=l.rating_target_id?"rating":l.partner_type;var f=this.partnerData[k.partner_type];if(f){for(var d=0,b=f.length;d<b;d++){k[f[d]]=l[f[d]]}}this.search(k)}else{l.geo_area=g;o=this.setGeoState(l)}return o},getProvider:function(c){var b;var a;if(!c.mop&&c.what&&c.what.match(/^(\w+_)?(yp|wp|aq|geo|ypwp)(_\w+)?$/)){c.mop=c.what.replace("aq","geo").replace(/(map_|_profile)/,"")}if(c.mop&&this.providers[c.mop]){b=this.providers[c.mop];for(var d in Eniro.Profile.providers){if(Eniro.Profile.providers[d].id===b){a=d;break}}if(c.rating_target_id){a=a.replace(/(_\w+)$/,"_ptr$1")}}else{a=Eniro.Profile.search.defaultProvider}return a},getProviders:function(){var a=[];for(var b in Eniro.Profile.providers){a.push(b)}return a},search:function(a){if(a!=={}){Eniro.AppEvents.triggerEvent(Eniro.Events.MODE_SWITCH,{mode:"search"});if(this.mapMode==="oblique"){this.onModeSwitchSearch=true}if(!a.pageSize){a.pageSize=Eniro.Profile.search.fields.pageSize.value}Eniro.AppEvents.triggerEvent(Eniro.Events.SET_SEARCH_FIELDS,a);if(a.ratingTargetId){a.q=a.ratingTargetId}Eniro.AppEvents.triggerEvent(Eniro.Events.SEARCH_DO,a)}},setMapType:function(a,b){if(a==="oblique"){}else{this.map.setMapType(a)}},createMarker:function(b){var a;if(b&&b.lonLat){var c=new OpenLayers.LonLat(b.lonLat.lon,b.lonLat.lat);c.transform(this.projections.wgs84,this.map.getProjectionObject());a=new Eniro.Feature.StaticLocationMarker(c,{label:b.markerLabel,type:b.markerType,text:b.text})}return a},getMarker:function(){var a;if(this.map.searchLayer&&this.map.searchLayer.features&&this.map.searchLayer.features.length>0){var c=this.map.searchLayer.features;for(var b=0,d=c.length;b<d;b++){if(c[b].CLASS_NAME==="Eniro.Feature.StaticLocationMarker"){a=c[b];break}}}return a},draw:function(){return null},CLASS_NAME:"Eniro.UrlTranslatorController"});Eniro.Tile.PostDanmark=OpenLayers.Class(OpenLayers.Tile.Image,{initialize:function(){OpenLayers.Tile.Image.prototype.initialize.apply(this,arguments);this.events.register("loadend",this,this.read)},destroy:function(){this.events.unregister("loadend",this,this.read);OpenLayers.Tile.Image.prototype.destroy.apply(this,arguments)},read:function(){if(this.layer.map.getZoom()<6){return}var c=this.bounds.clone();var f=c.left+","+c.bottom+","+c.right+","+c.top;var d={bbox:f,zoom:this.layer.map.getZoom(),c:Eniro.Crypto.crc32(f),v:this.layer.options.tileVersion};var a=this.layer.url;if(a instanceof Array){a=this.layer.selectUrl(""+(new Date().getTime()),a)}a=a.replace(/tile/,"json");var b=OpenLayers.Request.GET({url:a,params:d,success:OpenLayers.Function.bind(this.handleRead,this)})},handleRead:function(p){var d=new RTree();try{var a=p.responseText;if(a){OpenLayers.Console.log("Received "+(a.length)+" stages!");var c=0;var k=this.layer.map.getResolution();for(var b=0,f=a.length;b<f;b++){var h=a[b];var o=h.center[0]-(k*34);var l=h.center[1]+(k*13);d.insert({x:o,y:l,w:(k*65),h:(k*19)},{name:h.name,number:h.number,start:h.start,finish:h.finish,center:h.center,min:h.min,max:h.max});c++}OpenLayers.Console.log("Loaded "+c+" stages!")}}catch(g){OpenLayers.Console.warn(g)}this.spatial=d},search:function(a){if(this.spatial){return this.spatial.search(a)}return[]},CLASS_NAME:"Eniro.Tile.PostDanmark"});Eniro.Tile.SearchTile=OpenLayers.Class(OpenLayers.Tile.WFS,{overrideCallback:null,search:null,initialize:function(f,a,h,b,d,g,c,k){OpenLayers.Tile.WFS.prototype.initialize.apply(this,[f,a,h,b,d]);this.overrideCallback=g;this.search=c;this.firstSearch=k},requestSuccess:function(c){if(this.features){var b=this.search._disableHistory;delete this.search._disableHistory;this.layer.firstSearch=false;var a=this.buildResult(c);if(this.overrideCallback){this.overrideCallback(a)}else{this.requestSuccessCallback(a)}}if(this.events){this.events.triggerEvent("loadend")}this.request=null},requestSuccessCallback:function(a){if(a.json.search){if(this.layer.destroyTransientFeaturesEnabled){this.layer.destroyTransientFeatures()}var b=Eniro.Util.isArray(a.features)?a.features.concat():[a.features];b.reverse();this.layer.addTransientFeatures(b);Eniro.AppEvents.triggerEvent(Eniro.Events.SEARCH_RESULT_AVAILABLE,a)}if(a.json.maptypes){Eniro.AppEvents.triggerEvent(Eniro.Events.MAP_TYPES_UPDATE,{maptypes:a.json.maptypes})}},draw:function(c){if(c||this.layer.doTileDraw()){OpenLayers.Tile.WFS.prototype.draw.apply(this,[])}else{if(this.search._forceEmpty&&!this.overrideCallback){if(this.layer.destroyTransientFeaturesEnabled){this.layer.destroyTransientFeatures()}var b=this.search._disableHistory;delete this.search._disableHistory;var a=this.buildResult(null);Eniro.AppEvents.triggerEvent(Eniro.Events.SEARCH_RESULT_AVAILABLE,a);if(!b){}}}},buildResult:function(b){var c;if(b){var a;if(b.responseJSON){a=b.responseJSON}else{a=b.responseText}if(a){c=this.formatResult(a)}}if(!c){c={};c.features=[];c.json={}}return{features:c.features,json:c.json,search:this.search,firstSearch:this.firstSearch}},formatResult:function(a){var b=this.layer.formatObject.read(a,this.layer);this.normalizeSearchJson(b.json.search);return b},normalizeSearchJson:function(b){for(var d in b){var a=b[d].geoJSONResult;if(typeof b[d].totalHits==="undefined"){var c=0;if(a&&a.type){if(a.type==="Feature"&&a.id&&a.geometry){c=1}else{if(a.type==="FeatureCollection"&&a.features){c=a.features.length}}}b[d].totalHits=c}}},CLASS_NAME:"Eniro.Tile.SearchTile"});Eniro.Tile.WFSDataStore=OpenLayers.Class(OpenLayers.Tile.WFS,{initialize:function(d,a,f,b,c){OpenLayers.Tile.prototype.initialize.apply(this,arguments);this.features=[]},requestSuccess:function(a){this.request=null},CLASS_NAME:"Eniro.Tile.WFSDataStore"});Eniro.Tile.Yellow=OpenLayers.Class(OpenLayers.Tile.Image,{initialize:function(){OpenLayers.Tile.Image.prototype.initialize.apply(this,arguments);this.events.register("loadend",this,this.read)},destroy:function(){this.events.unregister("loadend",this,this.read);this.splatter=null;OpenLayers.Tile.Image.prototype.destroy.apply(this,arguments)},read:function(){if(!this.layer.q){return}var c=this.bounds.clone();var d={format:"json",BBOX:c.left+","+c.bottom+","+c.right+","+c.top,zoom:this.layer.map.getZoom(),p:this.layer.p+"_sp",q:this.layer.q,c:Eniro.Crypto.crc32(this.layer.q),v:this.layer.options.tileVersion};var a=this.layer.url;if(a instanceof Array){a=this.layer.selectUrl(""+(new Date().getTime()),a)}var b=OpenLayers.Request.GET({url:a,params:d,success:OpenLayers.Function.bind(this.handleRead,this)})},handleRead:function(s){var r=new RTree();try{var c=s.responseText.features;if(c){var g=0;var h=this.layer.map.projection;var d=this.layer.map.backendProjection;for(var f=0,k=c.length;f<k;++f){var q=parseFloat(c[f].xcoord);var p=parseFloat(c[f].ycoord);var b=c[f].advert_code;var a=c[f].company_name;var o=(new OpenLayers.LonLat(q,p)).transform(d,h);r.insert({x:o.lon,y:o.lat,w:1,h:1},{id:b,name:a,x:o.lon,y:o.lat});g++}}}catch(l){OpenLayers.Console.warn(l)}this.splatter=r},search:function(a){if(this.splatter){return this.splatter.search(a)}return[]},CLASS_NAME:"Eniro.Tile.Yellow"});Eniro.Tile.Hemnet=OpenLayers.Class(OpenLayers.Tile.Image,{initialize:function(){OpenLayers.Tile.Image.prototype.initialize.apply(this,arguments);this.events.on({loadstart:this._onLoadStart,loadend:this.read,scope:this})},destroy:function(){this.events.un({loadend:this.read,loadstart:this._onLoadStart,scope:this});this.pois=null;if(this.addedNumTiles){this.layer.numLoadingTiles--}OpenLayers.Tile.Image.prototype.destroy.apply(this,arguments)},_onLoadStart:function(){this.loaded=false;if(this.layer){this.addedNumTiles=true;this.layer.numLoadingTiles++}},read:function(){var g=this.layer.params;var c=this.bounds.clone();var f=c.left+","+c.bottom+","+c.right+","+c.top;var h={bbox:f,zoom:this.layer.map.getZoom(),c:Eniro.Crypto.crc32(f),v:this.layer.options.tileVersion};var d=OpenLayers.Util.extend({},this.layer.params);d=OpenLayers.Util.extend(d,h);var a=this.layer.url;if(a instanceof Array){a=this.layer.selectUrl(""+(new Date().getTime()),a)}a=a.replace(/tile/,"json");var b=OpenLayers.Request.GET({url:a,params:d,success:OpenLayers.Function.bind(this.handleRead,this)})},handleRead:function(o){var f=new RTree();try{var b=o.responseText.features;if(b){var d=0;for(var c=0,g=b.length;c<g;c+=3){var a=b[c];var l=b[c+1];var k=b[c+2];f.insert({x:l,y:k,w:1,h:1},{id:a,x:l,y:k});d++}}}catch(h){OpenLayers.Console.warn(h)}this.spatial=f;this.loaded=true;if(this.layer){this.addedNumTiles=false;this.layer.numLoadingTiles--;if(this.layer.numLoadingTiles===0){this.layer.events.triggerEvent("loadend")}}},search:function(a){if(this.spatial){return this.spatial.search(a)}return[]},CLASS_NAME:"Eniro.Tile.Hemnet"});Eniro.Tile.CompanyOnMap=OpenLayers.Class(OpenLayers.Tile.Image,{initialize:function(){OpenLayers.Tile.Image.prototype.initialize.apply(this,arguments);this.events.register("loadend",this,this.read)},destroy:function(){this.events.unregister("loadend",this,this.read);OpenLayers.Tile.Image.prototype.destroy.apply(this,arguments)},read:function(){var c=this.bounds.clone();var f=c.left+","+c.bottom+","+c.right+","+c.top;var d={bbox:f,zoom:this.layer.map.getZoom(),c:Eniro.Crypto.crc32(f),v:this.layer.tileVersion};var a=this.layer.url;if(a instanceof Array){a=this.layer.selectUrl(""+(new Date().getTime()),a)}a=a.replace(/tile/,"json");var b=OpenLayers.Request.GET({url:a,params:d,success:OpenLayers.Function.bind(this.handleRead,this)})},handleRead:function(p){var f=new RTree();try{var k=p.responseText;if(k){var d=0;var h=this.layer.map.getResolution();var a=this.layer.itemSize.w*h;var l=this.layer.itemSize.h*h;for(var b=0,c=k.length;b<c;b++){var o=k[b];f.insert({x:o.pos[0]-a/2,y:o.pos[1]-l/2,w:a,h:l},{id:o.id,pos:[o.pos[0],o.pos[1]]});d++}}}catch(g){OpenLayers.Console.warn(g)}this.spatial=f},search:function(a){if(this.spatial){return this.spatial.search(a)}return[]},CLASS_NAME:"Eniro.Tile.CompanyOnMap"});Eniro.Layer.PostDanmark=OpenLayers.Class(OpenLayers.Layer.Grid,{buffer:0,tileSize:new OpenLayers.Size(512,512),popup:null,hoverItem:null,layername:"postDanmark",features:[],stageInfo:[{subject:"Etape 1: Holstebro – Holstebro",date:"4. august",length:"175 km",coordinates:{end:new OpenLayers.Geometry.Point(8.61492795869708,56.35611698962748)}},{subject:"Etape 2: Vildbjerg – Randers",date:"5. august",length:"170 km",coordinates:{end:new OpenLayers.Geometry.Point(10.013906992971897,56.46717997267842)}},{subject:"Etape 3: Hadsten - Vejle",date:"6. august",length:"185 km",coordinates:{end:new OpenLayers.Geometry.Point(9.526231940835714,55.69724692963064)}},{subject:"Etape 4: Nyborg – Odense",date:"7. august",length:"105 km",coordinates:{end:new OpenLayers.Geometry.Point(10.38552193902433,55.36724293604493)}},{subject:"Etape 5: Middelfart",date:"7. august",length:"19.4 km",coordinates:{end:new OpenLayers.Geometry.Point(9.7359399497509,55.505439983680844)}},{subject:"Etape 6: Høng – Rudersdal",date:"8. august",length:"185 km",coordinates:{end:new OpenLayers.Geometry.Point(12.477153958752751,55.80480099655688)}}],initialize:function(c,b,a){if(!c){c="postDanmark"}if(!b){b=Eniro.AppNode.tileUrl("/pdr/tile")}a=a||{};a.alpha=true;a.tileVersion=Eniro.Config["tile.version"];Eniro.AppEvents.register(Eniro.Events.MODE_SWITCH,this,this.onModeSwitch);this.classnames={container:Eniro.Util.getCssClassName(this,"popup"),subject:Eniro.Util.getCssClassName(this,"subject"),body:Eniro.Util.getCssClassName(this,"body"),moreInfo:Eniro.Util.getCssClassName(this,"more-info"),zoomToExtent:Eniro.Util.getCssClassName(this,"zoom-to-extent"),zoomToStart:Eniro.Util.getCssClassName(this,"zoom-to-start"),zoomToFinish:Eniro.Util.getCssClassName(this,"zoom-to-finish")};OpenLayers.Layer.Grid.prototype.initialize.apply(this,[c,b,{layername:this.layername},a])},destroy:function(){Eniro.AppEvents.unregister(Eniro.Events.MODE_SWITCH,this,this.onModeSwitch);if(this.map){this.map.events.un({mousemove:this.onMouseMove,click:this.onClick,scope:this})}this.popupDestroy();OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments)},setMap:function(a){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments);this.map.events.on({zoomend:this.onZoomEnd,mousemove:this.onMouseMove,click:this.onClick,scope:this})},onZoomEnd:function(b){var f,d,h;var c=(this.map.getZoom()>=this.map.getRealZoom(8));if(c&&this.features.length<1){var g=function(){if(this.layer&&this.layer.map){this.layer.map.div.style.cursor=""}};for(d=0,h=this.stageInfo.length;d<h;++d){var a=this.stageInfo[d].coordinates.end;a.transform(this.map.backendProjection,this.map.getProjectionObject());this.features[d]=new Eniro.Feature.Vector(a,{},{style:{externalGraphic:Eniro.Util.getImagesLocation()+"markers/campaign/post-danmark-rundt-finish.png",graphicWidth:49,graphicHeight:39,graphicXOffset:-16,graphicYOffset:-33,graphicZIndex:1000,pointRadius:0}});this.features[d].events.register("mouseover",this.features[d],g);this.map.wfs.addFeatures(this.features[d])}return}if(this.features.length>0){for(d=0,h=this.features.length;d<h;++d){this.features[d].style.display=(c?"":"none");this.features[d].layer.drawFeature(this.features[d])}}},onClick:function(f){var d=OpenLayers.Event.element(f);var a=false;if(this.popup){var c=jQuery(d).parents("div");for(var b=0,g=c.length;b<g;++b){if(c[b]===this.popup.div){a=true;break}}}if(!a&&this.hoverItem){this.populatePopup(this.hoverItem)}},onMouseMove:function(f){var g=OpenLayers.Event.element(f);for(var d=0,a=this.map.popups.length;d<a;++d){var k=jQuery.makeArray(jQuery(g).parents());for(var c=0,b=k.length;c<b;++c){if(this.map.popups[d].div===k[c]){this._onMouseMoveOut();return}}if(this.map.popups[d]!==this.popup&&this.map.popups[d].visible()){this._onMouseMoveOut();return}}var l=this.map.wfs.getFeatureFromEvent(f);if(l){this._onMouseMoveOut();return}var h=this.searchItems(f.xy);if(h.length>0){this._onMouseMoveOver(h)}else{if(h.length===0){this._onMouseMoveOut()}}},_onMouseMoveOver:function(a){this.hoverItem=a[0];jQuery(".olMapViewport").addClass("olCursorHoverFeature")},_onMouseMoveOut:function(){this.hoverItem=null;jQuery(".olMapViewport").removeClass("olCursorHoverFeature")},onModeSwitch:function(a){this.mode=a.mode;if(this.mode=="streetview"||this.mode=="oblique"){this.setVisibility(false);jQuery("#pdr-logo").hide();if(this.popup){this.popup.hide()}}else{if(a.previousMode){this.setVisibility(true);jQuery("#pdr-logo").show();if(this.popup){this.popup.show()}}}},populatePopup:function(g){var a=this.classnames;var c=this.map.getResolution();var h=new OpenLayers.LonLat(g.center[0],g.center[1]);var f=new OpenLayers.Bounds(g.min[0],g.min[1],g.max[0],g.max[1]);var k=this.stageInfo[g.number-1];var d=false;var b=['<div class="'+a.container+'">','<div class="'+a.subject+'">',k.subject,"</div>",'<div class="'+a.body+'">',"<ul>","<li>",k.date,"</li>","<li>",k.length,"</li>","</ul>",'<a class="eniro-new ',a.moreInfo,'" href="http://www.postdanmarkrundt.dk/index.php?p=menu/side.php&menu=4&side=5',g.number,'">',OpenLayers.i18n("postdanmark.popup.more-info"),"</a>",'<a class="',a.zoomToExtent,'" href="',new Date().getTime(),'">',OpenLayers.i18n("postdanmark.popup.zoom-to-extent"),"</a>",'<a class="',a.zoomToStart,'" href="',new Date().getTime(),'">',OpenLayers.i18n("postdanmark.popup.zoom-to-start"),"</a>",'<a class="',a.zoomToFinish,'" href="',new Date().getTime(),'">',OpenLayers.i18n("postdanmark.popup.zoom-to-finish"),"</a>","</div>","</div>"];if(this.popup===null){this.popup=new Eniro.Popup.ShowOnMap(h,b.join(""),{closeBox:true,resultType:"route"});this.popup.classnames=a;this.map.addPopup(this.popup);OpenLayers.Event.observe(this.popup.contentDiv,"click",OpenLayers.Function.bind(this.onPopupClick,this.popup))}else{this.popup.lonlat=h;jQuery(this.popup.contentDiv).empty();jQuery(this.popup.contentDiv).html(b.join(""));this.popup.updateSize()}this.popup.bounds=f;this.popup.start=new OpenLayers.LonLat(g.start[0],g.start[1]);this.popup.finish=new OpenLayers.LonLat(g.finish[0],g.finish[1]);this.popup.show()},onPopupClick:function(d){var c=OpenLayers.Event.element(d);var b=jQuery(this.contentDiv).find("a."+this.classnames.zoomToExtent).get(0);if(b){if(c===b){OpenLayers.Event.stop(d);this.map.zoomToExtent(this.bounds);this.hide();return false}}b=jQuery(this.contentDiv).find("a."+this.classnames.zoomToStart).get(0);if(b){if(c===b){OpenLayers.Event.stop(d);this.map.setCenter(this.start,12);this.hide();return false}}b=jQuery(this.contentDiv).find("a."+this.classnames.zoomToFinish).get(0);if(b){if(c===b){OpenLayers.Event.stop(d);this.map.setCenter(this.finish,12);this.hide();return false}}return false},popupDestroy:function(){if(this.popup){this.popup.parent=null;this.popup.destroy();this.popup=null}},addTile:function(b,a){return new Eniro.Tile.PostDanmark(this,a,b,null,this.tileSize)},getURL:function(b){if(this.map.getZoom()<6){return"/media/transparent.png?v="+Eniro.Config["media.version"]}b=b.clone();var d=b.left+","+b.bottom+","+b.right+","+b.top;var c=this.getImageSize();var f={bbox:d,width:c.w,height:c.h,zoom:this.map.getZoom(),c:Eniro.Crypto.crc32(d),v:this.options.tileVersion,layer:this.map.baseLayer.layerId};var a=OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,[f]);return a},searchItems:function(l){var g=[];if(this.grid.length>0){var f=this.map.getResolution();var c=2*f;var h=this.map.getLonLatFromViewPortPx(l);var a=this.grid;var k=a.length;var o=a[0].length;for(var d=0;d<k&&g.length===0;d++){for(var b=0;b<o&&g.length===0;b++){g=g.concat(a[d][b].search({x:h.lon-c,y:h.lat-c,w:2*c,h:2*c}))}}}return g},CLASS_NAME:"Eniro.Layer.PostDanmark"});Eniro.Layer.TiledBaseLayer=OpenLayers.Class(OpenLayers.Layer.Grid,{buffer:0,tileSize:new OpenLayers.Size(512,512),popup:null,hoverItem:null,features:[],minZoom:0,maxZoom:21,tileVersion:null,displayInLayerSwitcher:false,initialize:function(c,b,a,d){this.tileVersion=d;Eniro.AppEvents.register(Eniro.Events.MODE_SWITCH,this,this.changeVisibility);this.classnames={container:Eniro.Util.getCssClassName(this,"popup"),subject:Eniro.Util.getCssClassName(this,"subject"),body:Eniro.Util.getCssClassName(this,"body"),moreInfo:Eniro.Util.getCssClassName(this,"more-info")};OpenLayers.Layer.Grid.prototype.initialize.apply(this,[c,b,{},a])},destroy:function(){Eniro.AppEvents.unregister(Eniro.Events.MODE_SWITCH,this,this.changeVisibility);if(this.map){this.map.events.un({mousemove:this.onMouseMove,movestart:this.onMoveStart,moveend:this.onMoveEnd,click:this.onClick,zoomend:this.changeVisibility,changelayer:this.changeVisibility,scope:this})}this.popupDestroy();OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments)},setMap:function(a){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments);this.map.events.on({movestart:this.onMoveStart,moveend:this.onMoveEnd,mousemove:this.onMouseMove,click:this.onClick,zoomend:this.changeVisibility,changelayer:this.changeVisibility,scope:this})},onClick:function(h){if(this.getVisibility()){var b=OpenLayers.Event.element(h);var l=false;if(this.popup){var k=jQuery(b).parents("div");for(var g=0,c=k.length;g<c;++g){if(k[g]===this.popup.div){l=true;break}}}if(!l&&this.hoverItem){var a=this.getItemInfoURL();if(a instanceof Array){a=this.selectUrl(this.hoverItem.id,a)}var d={id:this.hoverItem.id};if(this.getProvider){d.p=this.getProvider()}var f=OpenLayers.Request.GET({url:a,params:d,success:OpenLayers.Function.bind(this.populatePopup,this)})}}},onMoveStart:function(){this.mapIsDragging=true},onMoveEnd:function(){this.mapIsDragging=false},onMouseMove:function(f){if(!this.mapIsDragging&&this.getVisibility()){var g=OpenLayers.Event.element(f);for(var d=0,a=this.map.popups.length;d<a;++d){var k=jQuery.makeArray(jQuery(g).parents());for(var c=0,b=k.length;c<b;++c){if(this.map.popups[d].div===k[c]){this._onMouseMoveOut();return}}if(this.map.popups[d]!==this.popup&&this.map.popups[d].visible()){this._onMouseMoveOut();return}}var l=this.map.wfs.getFeatureFromEvent(f);if(l){this._onMouseMoveOut();return}var h=this.searchItems(f.xy);if(h.length>0){this._onMouseMoveOver(h)}else{if(h.length===0){this._onMouseMoveOut()}}}},_onMouseMoveOver:function(a){this.hoverItem=a[0];jQuery(".olMapViewport").addClass("olCursorHoverFeature")},_onMouseMoveOut:function(){this.hoverItem=null;jQuery(".olMapViewport").removeClass("olCursorHoverFeature")},changeVisibility:function(){var a=this.testVisibility();if(this.getVisibility()!=a){this.setVisibility(a);if(!a&&this.popup){this.popup.hide()}}},testVisibility:function(){var a=(this.mode!=="streetview"&&this.mode!=="oblique"&&(this.map.baseLayer.layerId==="map"||(this.map.baseLayer.layerId==="aerial"&&this.map.getLayerByName("hybrid").getVisibility()))&&this.map.getZoom()>=this.minZoom&&this.map.getZoom()<=this.maxZoom);return a},populatePopup:function(c){var a=c.responseText;if(a&&a.length>0){var d=a[0];var f=new OpenLayers.LonLat(d.pos[0],d.pos[1]);var b=this.getHTML(d);if(this.popup===null){this.popup=new Eniro.Popup.ShowOnMap(f,b,{closeBox:true,resultType:"route"});this.popup.classnames=this.classnames;this.map.addPopup(this.popup);OpenLayers.Event.observe(this.popup.contentDiv,"click",OpenLayers.Function.bind(this.onPopupClick,this.popup))}else{this.popup.lonlat=f;jQuery(this.popup.contentDiv).empty();jQuery(this.popup.contentDiv).html(b);this.popup.updateSize()}this.popup.show()}},getItemInfoURL:function(){return this.url.replace(/tile/,"json")},getHTML:function(a){alert("Implement me!")},onPopupClick:function(a){alert("Implement me!")},getItemSize:function(a){alert("Implement me!")},popupDestroy:function(){if(this.popup){this.popup.parent=null;this.popup.destroy();this.popup=null}},getURL:function(b){b=b.clone();var d=b.left+","+b.bottom+","+b.right+","+b.top;var c=this.getImageSize();var f={bbox:d,width:c.w,height:c.h,zoom:this.map.getZoom(),c:Eniro.Crypto.crc32(d),v:this.tileVersion,layer:this.map.baseLayer.layerId};var a=OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,[f]);return a},searchItems:function(l){var g=[];if(this.grid.length>0){var f=this.map.getResolution();var h=this.map.getLonLatFromViewPortPx(l);var c=2*f;var a=this.grid;var k=a.length;var o=a[0].length;for(var d=0;d<k&&g.length===0;d++){for(var b=0;b<o&&g.length===0;b++){g=g.concat(a[d][b].search({x:h.lon-c,y:h.lat-c,w:2*c,h:2*c}))}}}return g},CLASS_NAME:"Eniro.Layer.TiledBaseLayer"});Eniro.Layer.CompanyOnMap=OpenLayers.Class(Eniro.Layer.TiledBaseLayer,{itemSize:new OpenLayers.Size(20,20),minZoom:16,getHTML:function(b){var a=['<div class="'+this.classnames.container+'">','<div class="'+this.classnames.subject+'">',b.name,"</div>",'<div class="'+this.classnames.body+'">',"<ul>","<li>","Category: ",b.category,"</li>","</ul>","</div>","</div>"];return a.join("")},populatePopup:function(d){var h=this.getProvider();var c=d.responseText.search[h].geoJSONResult;if(c&&c.geometry&&c.properties){var g=c.geometry.coordinates;var f=new OpenLayers.LonLat(g[0],g[1]).transform(this.map.backendProjection,this.map.baseLayer.projection);var k=new OpenLayers.Geometry.Point(f.lon,f.lat);var b=c.properties;OpenLayers.Util.extend(b,{source:h,ordinal:0,singleHit:true});var a=new Eniro.Feature.WFSMarker(k,b);if(this.popup===null){this.popup=new Eniro.Popup.ShowOnMap(f,a.getPopupContents(),{closeBox:true,resultType:"yellow"});this.popup.classnames=this.classnames;this.map.addPopup(this.popup);OpenLayers.Event.observe(this.popup.contentDiv,"click",OpenLayers.Function.bind(this.onPopupClick,this.popup))}else{jQuery(this.popup.contentDiv).empty();jQuery(this.popup.contentDiv).html(a.getPopupContents());this.popup.lonlat=f}this.popup.show();this.popup.updateSize()}},onPopupClick:function(b){var a=OpenLayers.Event.element(b);return false},addTile:function(b,a){return new Eniro.Tile.CompanyOnMap(this,a,b,null,this.tileSize)},getProvider:function(){return"yp_no"},getItemSize:function(a){return this.itemSize},getItemInfoURL:function(){return Eniro.AppNode.tileUrl("/search/search.json")},CLASS_NAME:"Eniro.Layer.CompanyOnMap"});Eniro.Layer.YellowSplatter=OpenLayers.Class(OpenLayers.Layer.Grid,{buffer:0,tileSize:new OpenLayers.Size(768,768),popup:null,topHits:[],hoverItem:null,isBaseLayer:false,displayInLayerSwitcher:false,initialize:function(c,b,a){if(!b){b=Eniro.AppNode.tileUrl("/search/ypsp")}a=a||{};a.alpha=true;a.tileVersion=Eniro.Config["tile.version"];this.classnames={container:Eniro.Util.getCssClassName(this,"popup"),subject:Eniro.Util.getCssClassName(this,"subject"),body:Eniro.Util.getCssClassName(this,"body")};OpenLayers.Layer.Grid.prototype.initialize.apply(this,[c,b,{},a]);Eniro.AppEvents.register(Eniro.Events.SEARCH_DO,this,this.onSearch);Eniro.AppEvents.register(Eniro.Events.SEARCH_CLEAR,this,this.onSearchClear);Eniro.AppEvents.register(Eniro.Events.SET_SEARCH_FIELDS,this,this.onSearch);Eniro.AppEvents.register(Eniro.Events.SEARCH_RESULT_AVAILABLE,this,this.onSearchResultAvailable);Eniro.AppEvents.register(Eniro.Events.MODE_SWITCH,this,this.onModeSwitch)},destroy:function(){Eniro.AppEvents.unregister(Eniro.Events.SEARCH_DO,this,this.onSearch);Eniro.AppEvents.unregister(Eniro.Events.SEARCH_RESULT_AVAILABLE,this,this.onSearchResultAvailable);Eniro.AppEvents.unregister(Eniro.Events.SET_SEARCH_FIELDS,this,this.onSearch);Eniro.AppEvents.unregister(Eniro.Events.MODE_SWITCH,this,this.onModeSwitch);if(this.map){this.map.events.un({mousemove:this.monitorMouseMove,movestart:this.onMoveStart,moveend:this.onMoveEnd,scope:this})}if(this.popup){this.popupDestroy()}OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments)},setMap:function(a){OpenLayers.Layer.WMS.prototype.setMap.apply(this,arguments);this.map.events.on({mousemove:this.monitorMouseMove,movestart:this.onMoveStart,moveend:this.onMoveEnd,scope:this})},onMoveStart:function(){this.mapIsDragging=true},onMoveEnd:function(){this.mapIsDragging=false},onModeSwitch:function(a){this.mode=a.mode;if(this.mode=="streetview"||this.mode=="oblique"){this.setVisibility(false);if(this.popup){this.popup.hide()}}},onSearchResultAvailable:function(a){var c=a.json&&a.json.search&&a.json.search[this.p]&&a.json.search[this.p].geoJSONResult;if(c&&this.mode!="streetview"&&this.mode!="oblique"){this.setVisibility(true);var b=[];jQuery.each(a.features,function(d,f){b.push(f.attributes["e:advert_code"])});this.topHits=b}else{this.setVisibility(false);if(this.popup){this.popup.hide()}}},onSearch:function(a){if(a.q&&a.ap&&a.ap.indexOf("yp")>-1&&a.ap.indexOf("yp_ptr")<0){this.q=a.q;this.p=a.ap;this.redraw()}},onSearchClear:function(a){this.setVisibility(false)},searchItems:function(l){var g=[];if(this.grid.length>0){var f=this.map.getResolution();var h=this.getGeographicXY(l);var c=f*this.radius()+2;var a=this.grid;var k=a.length;var o=a[0].length;for(var d=0;d<k&&g.length===0;d++){for(var b=0;b<o&&g.length===0;b++){g=a[d][b].search({x:h[0]-c,y:h[1]-c,w:c*2,h:c*2})}}}return g},monitorMouseMove:function(f){if(this.mapIsDragging||!this.q||!this.p||!this.getVisibility()){return}var g=OpenLayers.Event.element(f);for(var d=0,a=this.map.popups.length;d<a;++d){var k=jQuery.makeArray(jQuery(g).parents());for(var c=0,b=k.length;c<b;++c){if(this.map.popups[d].div===k[c]){this._monitorMouseMoveOut();return}}if(this.map.popups[d]!==this.popup&&this.map.popups[d].visible()){this._monitorMouseMoveOut();return}}var l=this.map.wfs.getFeatureFromEvent(f);if(l){this._monitorMouseMoveOut();return}var h=this.searchItems(f.xy);if(h.length>0){this._monitorMouseMoveOver(h[0])}else{if(h.length===0){this._monitorMouseMoveOut()}}},_monitorMouseMoveOver:function(a){if(this.hoverItem!==a){if(this.timeoutId){clearTimeout(this.timeoutId)}this.hoverItem=a;jQuery(".olMapViewport").addClass("olCursorHoverFeature");this.timeoutId=setTimeout(OpenLayers.Function.bind(function(){this.onMouseOver()},this),200)}},_monitorMouseMoveOut:function(){if(this.hoverItem!==null){if(this.timeoutId){clearTimeout(this.timeoutId)}this.hoverItem=null;jQuery(".olMapViewport").removeClass("olCursorHoverFeature");this.onMouseOut()}},monitorClick:function(b){if(!this.q||!this.p){return}var a=this.searchItems(b.xy);if(a.length>0){this.onClick(a)}},onClick:function(a){jQuery.getJSON(this.options.jsonURL,{p:this.p,id:a[0].id},OpenLayers.Function.bind(this.handleClickResponse,this))},handleClickResponse:function(d){var c=d.search[this.p].geoJSONResult;if(c&&c.geometry&&c.properties){var g=c.geometry.coordinates;var f=new OpenLayers.LonLat(g[0],g[1]).transform(this.map.backendProjection,this.map.baseLayer.projection);var h=new OpenLayers.Geometry.Point(f.lon,f.lat);var b=c.properties;OpenLayers.Util.extend(b,{source:this.p,ordinal:0,singleHit:true});var a=new Eniro.Feature.WFSMarker(h,b);jQuery(this.popup.contentDiv).empty();jQuery(this.popup.contentDiv).html(a.getPopupContents());this.popup.lonlat=f;this.popup.show();this.popup.updateSize()}},onMouseOver:function(){if(this.topHits.indexOf(this.hoverItem.id)>=0){return}var c=new OpenLayers.LonLat(this.hoverItem.x,this.hoverItem.y);var b=new Date().getTime();var a=['<div class="',this.classnames.container,'">','<a href="',b,'" class="eniro-popup-title">',this.hoverItem.name,"</a>"];if(this.map.getZoom()<13){a.push('<div class="eniro-popup-links">');a.push('<a href="'+b+'" class="zoom-here">',this.i18n("zoom-here"),"</a>");a.push("</div>")}a.push("</div>");if(!this.popup){this.popup=new Eniro.Popup.Yellow(c,a.join(""));OpenLayers.Event.observe(this.popup.contentDiv,"click",OpenLayers.Function.bind(this.onPopupClick,this));this.map.addPopup(this.popup)}this.popup.div.style.cursor="default";this.popup.lonlat=c;this.popup.itemId=this.hoverItem.id;this.popup.hide();jQuery(this.popup.contentDiv).html(a.join(""));this.popup.updateSize();this.popup.show()},onMouseOut:function(){if(this.popup){this.popup.div.style.cursor="";this.popup.hide()}},onPopupClick:function(a){var c=OpenLayers.Event.element(a);var d=jQuery(this.popup.contentDiv).find("a.zoom-here").get(0);if(c===d){OpenLayers.Event.stop(a);this.map.setCenter(this.popup.lonlat,13);this.popup.hide();return false}var b=jQuery(this.popup.contentDiv).find("a.eniro-popup-title").get(0);if(c===b){OpenLayers.Event.stop(a);this.popup.hide();Eniro.AppEvents.triggerEvent(Eniro.Events.SEARCH_SELECT_ITEM,{id:this.popup.itemId,provider:this.p});return false}return true},popupDestroy:function(){if(this.popup){this.popup.destroy();this.popup=null}},i18n:function(b,a){if(!this.i18nExclude){b=this.CLASS_NAME.dash()+"."+b}if(this.parent){return this.parent.i18n(b,a)}return OpenLayers.i18n(b.replace(/\.-/g,".").replace(/^eniro-|^eniro\.|\beniro-|\beniro\./g,""),a)},getGeographicXY:function(a){var b=this.map.getLonLatFromViewPortPx(a);return[Math.round(b.lon),Math.round(b.lat)]},radius:function(){var a=this.map.getZoom();if(a<=5){return 3}if(a<=8){return 4}return 5},addTile:function(b,a){return new Eniro.Tile.Yellow(this,a,b,null,this.tileSize)},getURL:function(b){b=b.clone();if(!this.q||!this.p){return"/media/transparent.png?v="+Eniro.Config["media.version"]}var c=this.getImageSize();var d={format:"png",BBOX:b.left+","+b.bottom+","+b.right+","+b.top,width:c.w,height:c.h,zoom:this.map.getZoom(),p:this.p+"_sp",q:this.q,c:Eniro.Crypto.crc32(this.q),v:this.options.tileVersion,r:this.radius()};var a=OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,[d]);return a},CLASS_NAME:"Eniro.Layer.YellowSplatter"});Eniro.Layer.Hemnet=OpenLayers.Class(OpenLayers.Layer.Grid,{MAX_ZOOM:15,buffer:0,tileSize:new OpenLayers.Size(256,256),popup:null,popupItemIndex:null,topHits:[],hoverItems:null,layername:"hemnet",features:null,loadedTiles:0,initialize:function(c,b,a){if(!b){b=Eniro.AppNode.tileUrl("/hmn/tile")}a=a||{};a.alpha=true;a.tileVersion=Eniro.Config["tile.version"];Eniro.AppEvents.register(Eniro.Events.MODE_SWITCH,this,this.onModeSwitch);OpenLayers.Layer.Grid.prototype.initialize.apply(this,[c,b,{layername:this.layername},a]);if(Eniro.Profile.id==="se_hemnet"||Eniro.Profile.id==="se_kommersiella"){this.noHitsTooltip=new Eniro.Tooltip({minOffset:{x:0,y:0}});this.events.on({loadstart:this.onLoadStart,loadend:this.onLoadEnd,scope:this})}},destroy:function(){Eniro.AppEvents.unregister(Eniro.Events.MODE_SWITCH,this,this.onModeSwitch);if(this.map){this.map.events.un({mousemove:this.onMouseMove,click:this.onClick,moveend:this.onMoveEnd,scope:this})}if(Eniro.Profile.id==="se_hemnet"||Eniro.Profile.id==="se_kommersiella"){this.map.events.un({moveend:this.hideNoHitsTooltip,zoomend:this.hideNoHitsTooltip,scope:this});this.events.un({loadstart:this.onLoadStart,loadend:this.onLoadEnd,scope:this})}this.popupDestroy();OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments)},setMap:function(a){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments);this.map.events.on({mousemove:this.onMouseMove,click:this.onClick,movestart:this.onMoveStart,moveend:this.onMoveEnd,scope:this});if(Eniro.Profile.id==="se_hemnet"||Eniro.Profile.id==="se_kommersiella"){this.map.events.on({moveend:this.hideNoHitsTooltip,zoomend:this.hideNoHitsTooltip,scope:this})}},onMoveStart:function(){this.mapIsDragging=true},onMoveEnd:function(a){this.mapIsDragging=false;if(this.params&&(this.params.municipality||this.params.region||this.params.countryCode)){delete this.params.municipality;delete this.params.region;delete this.params.countryCode;this.redraw()}},onClick:function(f){var d=OpenLayers.Event.element(f);var a=false;if(this.popup){var c=jQuery(d).parents("div");for(var b=0,g=c.length;b<g;++b){if(c[b]===this.popup.div){a=true;break}}}if(!a&&this.hoverItems&&this.hoverItems.length>0){this.populatePopup(this.getHoverItemsIDs().join(","))}},onMouseMove:function(f){if(this.mapIsDragging||!this.getVisibility()||!this.paramsUpdated){return}var g=OpenLayers.Event.element(f);for(var d=0,a=this.map.popups.length;d<a;++d){var k=jQuery.makeArray(jQuery(g).parents());for(var c=0,b=k.length;c<b;++c){if(this.map.popups[d].div===k[c]){this._onMouseMoveOut();return}}if(this.map.popups[d]!==this.popup&&this.map.popups[d].visible()){this._onMouseMoveOut();return}}var l=this.map.wfs.getFeatureFromEvent(f);if(l){this._onMouseMoveOut();return}var h=this.searchItems(f.xy);if(h.length>0){this._onMouseMoveOver(h)}else{if(h.length===0){this._onMouseMoveOut()}}},_onMouseMoveOver:function(a){this.hoverItems=a;jQuery(".olMapViewport").addClass("olCursorHoverFeature")},_onMouseMoveOut:function(){this.hoverItems=null;jQuery(".olMapViewport").removeClass("olCursorHoverFeature")},onModeSwitch:function(a){this.mode=a.mode;if(this.mode=="streetview"||this.mode=="oblique"){this.visibleOnPrevious=this.getVisibility();this.setVisibility(false);if(this.popup){this.popup.hide()}}else{if(a.previousMode){this.setVisibility(this.visibleOnPrevious);if(this.popup&&this.visibleOnPrevious){this.popup.show()}this.visibleOnPrevious=null}}},onLoadStart:function(a){this.hideNoHitsTooltip()},onLoadEnd:function(b){if(this.isFormSearch){var f=false;outer:for(var d=0,g=this.grid.length;d<g;++d){inner:for(var c=0,a=this.grid[d].length;c<a;++c){f=this.tileHasHits(this.grid[d][c]);if(f){break outer}}}if(!f){this.showNoHitsTooltip()}}},tileHasHits:function(b){if(b.spatial){var a=b.spatial.get_tree();return !(a.x===0&&a.y===0&&a.h===0&&a.w===0&&(!a.nodes||a.nodes.length===0))}return false},showNoHitsTooltip:function(){if(!this.noHitsTooltip.div){this.noHitsTooltip.draw();jQuery(this.map.viewPortDiv).append(this.noHitsTooltip.div);this.noHitsTooltip.div.style.cursor="pointer";OpenLayers.Event.observe(this.noHitsTooltip.div,"click",OpenLayers.Function.bind(this.hideNoHitsTooltip,this));this.noHitsTooltip.setContents(OpenLayers.i18n("hemnet.tile.no-hits"))}this.noHitsTooltip.show();var a=this.map.getSize();this.noHitsTooltip.setPosition(new OpenLayers.Pixel((a.w/2)-(jQuery(this.noHitsTooltip.div).outerWidth()/2),(a.h/2)))},hideNoHitsTooltip:function(){this.isFormSearch=false;this.noHitsTooltip.hide()},populatePopup:function(c,b){var a=this.url;if(a instanceof Array){a=this.selectUrl(""+(new Date().getTime()),a)}a=a.replace(/tile/,"json");if(b>=-1){this.popupItemIndex=b}OpenLayers.Request.GET({url:a,params:{id:c,verbose:true},success:OpenLayers.Function.bind(this.handleClickResponse,this)})},popupDestroy:function(){if(this.popup){this.popup.parent=null;this.popup.destroy();this.popup=null}},addTile:function(b,a){return new Eniro.Tile.Hemnet(this,a,b,null,this.tileSize)},updateSearch:function(c,b,a){this.isFormSearch=!!a;if(b){this.zoomToExtentAndUpdate(c)}else{this._updateSearch(c)}},_updateSearch:function(a){this.params=OpenLayers.Util.extend({},a);this.paramsUpdated=true;this.redraw()},zoomToExtentAndUpdate:function(d){var a=this.url;if(a instanceof Array){a=this.selectUrl(""+(new Date().getTime()),a)}a=a.replace(/tile/,"bbox");var c=OpenLayers.Util.extend({},d);c=OpenLayers.Util.extend(c,{zoom:this.map.getZoom(),v:this.options.tileVersion});var b=OpenLayers.Request.GET({url:a,params:c,success:OpenLayers.Function.bind(function(f){this._zoomToExtentAndUpdate(f,d)},this)})},_zoomToExtentAndUpdate:function(o,g){var f=this.isFormSearch;var h=o.responseText;var d,b,c,k;if(h.left&&h.bottom&&h.width&&h.height){d=parseFloat(h.left,10);b=parseFloat(h.bottom,10);c=parseFloat(h.width,10);k=parseFloat(h.height,10);if(c>0&&k>0){var a=new OpenLayers.Bounds(d,b,(d+c),(b+k));if(!this.map.getCenter()){var l=this.map.getZoomForExtent(a);this.map.setCenter(a.getCenterLonLat(),Math.min(l,this.MAX_ZOOM))}else{this.map.zoomToExtent(a,false,this.MAX_ZOOM)}}}else{this.map.reset()}this.isFormSearch=f;this._updateSearch(g)},getURL:function(a){if(!this.paramsUpdated){return"/media/transparent.png?v="+Eniro.Config["media.version"]}a=a.clone();var c=a.left+","+a.bottom+","+a.right+","+a.top;var b=this.getImageSize();var d={bbox:c,zoom:this.map.getZoom(),c:Eniro.Crypto.crc32(c),v:this.options.tileVersion,layer:this.map.baseLayer.layerId};return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,[d])},getHoverItemsIDs:function(){var b=[];for(var a=0,c=this.hoverItems.length;a<c;++a){if(this.hoverItems[a].id){b.push(this.hoverItems[a].id)}}return b},handleClickResponse:function(p){if(!p.responseText||!p.responseText.features||!p.responseText.features[0]){return}var q=p.responseText.features[0];var f=[];var l=[];var r;for(var h=0,b=p.responseText.features.length;h<b;++h){r=p.responseText.features[h];if(!r._normalized){r.broker_url="http://"+r.broker_url.replace(/^http:\/\//gi,"");if((Eniro.Profile.id==="se_hemnet"||Eniro.Profile.id==="se_kommersiella")&&r.broker_url.indexOf("?")>=0){var d=r.broker_url.split("?");var a=d[1].split("&");for(var g=0,c=a.length;g<c;++g){if(/^r=\d+$/.test(a[g])){a[g]="r=44"}}r.broker_url=d[0]+"?"+a.join("&")}r._normalized=true}if(h===0||(f.length>0&&r.pos[0]===f[0].pos[0]&&r.pos[1]===f[0].pos[1])){f.push(r);l.push("hemnet."+r.id)}}var k=new OpenLayers.LonLat(q.pos[0],q.pos[1]);var o=false;if(!this.popup){this.popup=new Eniro.Popup.Hemnet(k,{items:f,itemIndex:this.popupItemIndex||0});this.popup.parent=this;o=true;this.map.addPopup(this.popup)}this.popup.hide();if(!o){this.popup.lonlat=k;this.popup.updateContentHTML({items:f,itemIndex:this.popupItemIndex||0});this.popup.updatePosition()}OpenLayers.Element.addClass(this.div,"hemnetPopup");this.popupItemIndex=null;Eniro.AppEvents.triggerEvent(Eniro.Events.STATISTICS_LOG,{scope:"content",event:"showonmappopup",data:{features:l}});this.popup.show()},radius:function(){var a=this.map.getZoom();if(a<this.map.getRealZoom(10)){return 8}return 10},searchItems:function(l){var g=[];if(this.grid.length>0){var f=this.map.getResolution();var h=this.map.getLonLatFromViewPortPx(l);var c=f*this.radius()+2;var a=this.grid;var k=a.length;var o=a[0].length;for(var d=0;d<k&&g.length===0;d++){for(var b=0;b<o&&g.length===0;b++){g=g.concat(a[d][b].search({x:h.lon-c,y:h.lat-c,w:c*2,h:c*2}))}}}return g},CLASS_NAME:"Eniro.Layer.Hemnet"});Eniro.Layer.SearchTMS=OpenLayers.Class(OpenLayers.Layer.TMS,{isBaseLayer:false,visibility:false,setMap:function(a){OpenLayers.Layer.TMS.prototype.setMap.apply(this,arguments);Eniro.AppEvents.register(Eniro.Events.SEARCH_DO,this,this.onSearch)},destroy:function(){Eniro.AppEvents.unregister(Eniro.Events.SEARCH_DO,this,this.onSearch);OpenLayers.Layer.TMS.prototype.destroy.apply(this,arguments)},onSearch:function(a){this.mergeNewParams(a.parameters)},mergeNewParams:function(a){OpenLayers.Layer.TMS.prototype.mergeNewParams.apply(this,arguments);this.setVisibility(this.params.q?true:false)},getURL:function(b){var a=OpenLayers.Layer.TMS.prototype.getURL.apply(this,arguments);var d={};OpenLayers.Util.extend(d,this.params);if(Eniro.Profile.search.splatterMap&&Eniro.Profile.search.splatterMap[d.ap]){d.ap=Eniro.Profile.search.splatterMap[d.ap]}var c=Eniro.Crypto.crc32((d.q||""));d.c=c;return a+"?"+OpenLayers.Util.getParameterString(d)},CLASS_NAME:"Eniro.Layer.SearchTMS"});Eniro.Layer.TFSDataStore=OpenLayers.Class(OpenLayers.Layer.TMS,{serviceVersion:"1.0.0",isBaseLayer:false,initialize:function(d,c,b){var a=[];a.push(d,c,{},b);OpenLayers.Layer.TMS.prototype.initialize.apply(this,a)},destroy:function(){OpenLayers.Layer.TMS.prototype.destroy.apply(this,arguments)},clone:function(a){if(!a){a=new Eniro.Layer.TFSDataStore(this.name,this.url,this.options)}a=OpenLayers.Layer.TMS.prototype.clone.apply(this,[a]);return a},addTile:function(b,a){return new Eniro.Tile.WFSDataStore(this,a,b,this.url,this.tileSize)},setMap:function(a){OpenLayers.Layer.TMS.prototype.setMap.apply(this,arguments);if(!this.tileOrigin){this.tileOrigin=new OpenLayers.LonLat(this.map.maxExtent.left,this.map.maxExtent.bottom)}},CLASS_NAME:"Eniro.Layer.TFSDataStore"});Eniro.Layer.AutoLayers=OpenLayers.Class(Eniro.Control,OpenLayers.Layer.TMS,{wfsURL:null,type:"png",isBaseLayer:false,displayInLayerSwitcher:false,geometryColumn:"the_geom",CQLFilter:null,metaTileSize:3,alpha:true,buffer:0,namespace:"eniro",maxFeatures:3,lastZoom:0,minZoom:8,clickHandler:null,popup:null,mouseLoc:null,currentLayer:null,layerInfo:[{name:"no_auto_1",layers:"no_airport",minZoom:8,maxZoom:11},{name:"no_auto_2",layers:"no_airport,no_cabin,no_startingpoint",minZoom:12,maxZoom:12},{name:"no_auto_3",layers:"no_airport,no_cabin,no_startingpoint,no_train,no_subway",minZoom:13,maxZoom:13},{name:"no_auto_4",layers:"no_airport,no_cabin,no_startingpoint,no_train,no_subway,no_camping",minZoom:14,maxZoom:14},{name:"no_auto_5",layers:"no_airport,no_cabin,no_startingpoint,no_train,no_subway,no_camping,no_church,no_bicycleparking",minZoom:15,maxZoom:21}],initialize:function(c,b,a){if(!b){b=Eniro.AppNode.tileUrl("/geowebcache/service/tms")}this.wfsURL=Eniro.AppNode.appUrl("/geoserver/wfs");OpenLayers.Util.extend(a,{layername:"no_auto_1"});OpenLayers.Layer.TMS.prototype.initialize.apply(this,[c,b,a]);this.clickHandler=new OpenLayers.Handler.Click(this,{click:this.handleClick});this.register(Eniro.Events.MODE_SWITCH,this.checkVisibility);this.register(Eniro.Events.CHANGE_BASE_LAYER,this.checkVisibility)},setMap:function(){OpenLayers.Layer.TMS.prototype.setMap.apply(this,arguments);if(this.clickHandler){this.clickHandler.setMap(this.map);this.clickHandler.activate()}this.map.events.register("zoomend",this,this.checkVisibility);this.checkVisibility()},checkVisibility:function(){var b=this.map;if(b){var a=b.baseLayer.layerId;var c=b.getCurrentMode();this.setVisibility((a=="map"||a=="hybrid")&&c!="streetview"&&c!="oblique"&&b.getZoom()>=this.minZoom)}},handleClick:function(b){if(!this.currentLayer){return}this.mouseLoc=this.map.getLonLatFromPixel(b.xy);var a=this.getBBox(b.xy);OpenLayers.Request.GET({url:this.wfsURL,params:{SERVICE:"WFS",VERSION:"1.1.0",REQUEST:"GetFeature",TYPENAME:this.currentLayer.layers,OUTPUTFORMAT:"JSON",PROPERTYNAME:"",MAXFEATURES:this.maxFeatures,CQL_FILTER:a,format_options:"callback:C"},success:this.handleClickResponse,scope:this})},handleClickResponse:function(g){g=g.responseText;if(g.features.length===0){return}var f;var d;var a=[];var k=[0,0];for(f=0;f<g.features.length;f++){d=g.features[f];k[0]+=d.geometry.coordinates[0];k[1]+=d.geometry.coordinates[1];a.push(this.getPopupHTML(d))}var h=new OpenLayers.LonLat(k[1]/g.features.length,k[0]/g.features.length);var c=h.transform(this.map.backendProjection,this.map.getProjectionObject());var b=this.map.getViewPortPxFromLonLat(c);if(this.popup===null){this.popup=new Eniro.Popup.ShowOnMap(c,a.join(""),{resultType:"route",closeBox:true});this.map.addPopup(this.popup)}else{this.popup.lonlat=h;jQuery(this.popup.contentDiv).empty();jQuery(this.popup.contentDiv).html(a.join(""));this.popup.updateSize()}this.popup.show()},popupDestroy:function(a){if(this.popup){this.popup.destroy();this.popup=null}},getURL:function(g){var f=this.map.getZoom();if(f!=this.lastZoom){this.lastZoom=f;this.updateLayer(f)}if(!this.currentLayer){return"/media/transparent.png?v="+Eniro.Config["media.version"]}var b=OpenLayers.Layer.TMS.prototype.getURL.apply(this,arguments);var h="";var c=/.*\/([0-9]+)\/([0-9]+)\/([0-9]+)\.[a-z]+$/i.exec(b);if(c){var a=Math.floor(parseInt(c[2],10)/this.metaTileSize),k=Math.floor(parseInt(c[3],10)/this.metaTileSize);h="?c="+Eniro.Crypto.crc32(c[1]+"/"+a+"/"+k)}var d=Eniro.Config["tile.version"];return b+h+(!(d===null||d===undefined)?"&v="+d:"")},updateLayer:function(c){this.currentLayer=null;this.layername=null;for(var b=0;b<this.layerInfo.length;b++){var a=this.layerInfo[b];if(c>=a.minZoom&&c<=a.maxZoom){this.currentLayer=a;this.layername=a.name;break}}},getBBox:function(d){var c=this.map;var a=this.getBuffer(c.getZoom());llMin=c.getLonLatFromPixel(new OpenLayers.Pixel(d.x-a,d.y+a));llMax=c.getLonLatFromPixel(new OpenLayers.Pixel(d.x+a,d.y-a));var b=c.getProjectionObject();llMin.transform(b,c.backendProjection);llMax.transform(b,c.backendProjection);return"BBOX("+this.geometryColumn+", "+llMin.lat+","+llMin.lon+","+llMax.lat+","+llMax.lon+")"},getBuffer:function(a){return 11},getPopupHTML:function(b){var a={container:Eniro.Util.getCssClassName(this,"popup"),subject:Eniro.Util.getCssClassName(this,"subject"),info:Eniro.Util.getCssClassName(this,"info"),address:Eniro.Util.getCssClassName(this,"address")};var c=b.properties;if(b.id.indexOf("no_airport")>=0){return['<div class="'+a.container+'">','<div class="'+a.subject+'">',c.name,"</div>",'<div class="'+a.info+'">','<a href="',c.homepage,'" class="eniro-new">',c.homepage,"</a>","</div>",'<div class="'+a.address+'">',c.adress,"<br/>",OpenLayers.i18n("auto-layers.popup.tel"),": ",c.phone,"</div>","</div>"].join("")}if(b.id.indexOf("no_startingpoint")>=0){return['<div class="'+a.container+'">','<div class="'+a.subject+'">',c.name,"</div>",'<div class="'+a.info+'">',this.shorten(c.descr,200),"<br/>",'<a class="eniro-new" href="http://www.skiforeningen.no/markadb/showpoi.cgi?fromgs=1&id=',c.id,'">',OpenLayers.i18n("auto-layers.popup.read-more"),"</a><br/>",'<a class="eniro-new" href="http://skiforeningen.no/markadb/showf.cgi?fromgs=1&loyper=1&tbl=foreinarea&area_id=',c.area_id,'">',OpenLayers.i18n("auto-layers.popup.read-ski-info"),"</a><br/>",'<a class="eniro-new" href="http://www.skiforeningen.no/medlem/bli_medlem">',OpenLayers.i18n("auto-layers.popup.become-ski-member"),"</a>","</div>",'<div class="'+a.info+'">','<img title="Foreningen til Ski-Idrettens Fremme" src="',Eniro.Util.getImagesLocation(),'skiforr.gif" />',"</div>","</div>"].join("")}if(b.id.indexOf("no_cabin")>=0){return['<div class="'+a.container+'">','<div class="'+a.subject+'">',c.name,"</div>",'<div class="'+a.info+'">',this.shorten(c.descr,200),"<br/>",'<a class="eniro-new" href="http://www.skiforeningen.no/markadb/showstue.cgi?fromgs=1&id=',c.id,'">',OpenLayers.i18n("auto-layers.popup.read-more"),"</a><br/>",'<a class="eniro-new" href="http://skiforeningen.no/markadb/showf.cgi?fromgs=1&loyper=1&tbl=foreinarea&area_id=',c.area_id,'">',OpenLayers.i18n("auto-layers.popup.read-ski-info"),"</a><br/>",'<a class="eniro-new" href="http://www.skiforeningen.no/medlem/bli_medlem">',OpenLayers.i18n("auto-layers.popup.become-ski-member"),"</a><br/>","</div>",'<div class="'+a.info+'">','<img title="Foreningen til Ski-Idrettens Fremme" src="',Eniro.Util.getImagesLocation(),'skiforr.gif" />',"</div>","</div>"].join("")}if(b.id.indexOf("no_subway")>=0){return['<div class="'+a.container+'">','<div class="'+a.subject+'">',c.name,"</div>",'<div class="'+a.info+'">',"<p>",c.line,"</p>",'<a class="eniro-new" href="',c.link,'">'+OpenLayers.i18n("auto-layers.popup.subway-timetable")+"</a>","</div>","</div>"].join("")}if(b.id.indexOf("no_train")>=0){return['<div class="'+a.container+'">','<div class="'+a.subject+'">',c.name,"</div>",'<div class="'+a.info+'">',OpenLayers.i18n("auto-layers.popup.train-timetable"),': <a class="eniro-new" href="http://www.nsb.no">http://www.nsb.no</a>',"</div>","</div>"].join("")}if(b.id.indexOf("no_camping")>=0){return['<div class="'+a.container+'">','<div class="'+a.subject+'">',OpenLayers.i18n("auto-layers.camping"),"</div>","</div>"].join("")}if(b.id.indexOf("no_church")>=0){return['<div class="'+a.container+'">','<div class="'+a.subject+'">',OpenLayers.i18n("auto-layers.church"),"</div>","</div>"].join("")}if(b.id.indexOf("no_bicycleparking")>=0){return['<div class="'+a.container+'">','<div class="'+a.subject+'">',OpenLayers.i18n("auto-layers.bicycleparking"),"</div>",'<div class="'+a.info+'">',c.descr,"</div>","</div>"].join("")}if(b.id.indexOf("no_speedcamera")>=0){var d=Eniro.Util.getImagesLocation()+"speedlimit/"+c.speedlimit+".png?v="+Eniro.Config["media.version"];return['<div class="'+a.container+'">','<div class="'+a.subject+'">',OpenLayers.i18n("auto-layers.speedcamera"),"</div>",'<div class="'+a.info+'">',c.descr,'<img src="',Eniro.Util.getImagesLocation(),"speedlimit/",c.speedlimit,'.gif" />',"</div>","</div>"].join("")}return"<p>"+b.id+"</p>"},shorten:function(b,a){if(!b){return""}if(b.length>a){return b.substring(0,a-3)+"..."}return b},CLASS_NAME:"Eniro.Layer.AutoLayers"});Eniro.Layer.ShowOnMap=OpenLayers.Class(OpenLayers.Layer.WMS,{DEFAULT_PARAMS:{service:"WMS",version:"1.1.1",request:"GetMap",format:"image/png",transparent:"true"},proj:new OpenLayers.Projection("EPSG:4326"),geometryColumn:"the_geom",initialize:function(c,b,d,a){a=a||{};a.alpha=true;OpenLayers.Layer.WMS.prototype.initialize.apply(this,[c,b,d,a])},getBBOX:function(c){var b=this.map;var a=this.getBuffer(b.getZoom());llMin=b.getLonLatFromPixel(new OpenLayers.Pixel(c.x-a,c.y+a));llMax=b.getLonLatFromPixel(new OpenLayers.Pixel(c.x+a,c.y-a));llMin.transform(b.getProjectionObject(),this.proj);llMax.transform(b.getProjectionObject(),this.proj);return"BBOX("+this.geometryColumn+", "+llMin.lon+","+llMin.lat+","+llMax.lon+","+llMax.lat+")"},getCQLFilter:function(){return null},getPopupHTML:function(a){return"<p>"+a.id+"</p>"},getBuffer:function(a){return 2},getFullRequestString:function(){this.params.CQL_FILTER=this.getCQLFilter();return OpenLayers.Layer.WMS.prototype.getFullRequestString.apply(this,arguments)},CLASS_NAME:"Eniro.Layer.ShowOnMap"});Eniro.Layer.ShowOnMapTMS=OpenLayers.Class(OpenLayers.Layer.TMS,{type:"png",isBaseLayer:false,geometryColumn:"the_geom",CQLFilter:null,metaTileSize:3,alpha:true,buffer:0,namespace:"eniro",backendProjection:new OpenLayers.Projection("EPSG:4326"),initialize:function(c,b,a){OpenLayers.Layer.TMS.prototype.initialize.apply(this,arguments)},getURL:function(g){var c=OpenLayers.Layer.TMS.prototype.getURL.apply(this,arguments);var h="";var d=/.*\/([0-9]+)\/([0-9]+)\/([0-9]+)\.[a-z]+$/i.exec(c);if(d){var a=Math.floor(parseInt(d[2],10)/this.metaTileSize),k=Math.floor(parseInt(d[3],10)/this.metaTileSize);h="?c="+Eniro.Crypto.crc32(d[1]+"/"+a+"/"+k)}var f=Eniro.Config["tile.version"];var b=(this.CQLFilter===null)?"":"&CQL_FILTER="+this.CQLFilter;return c+h+(!(f===null||f===undefined)?"&v="+f:"")+b},getBBOX:function(d){var c=this.map;var a=this.getBuffer(c.getZoom());llMin=c.getLonLatFromPixel(new OpenLayers.Pixel(d.x-a,d.y+a));llMax=c.getLonLatFromPixel(new OpenLayers.Pixel(d.x+a,d.y-a));var b=c.getProjectionObject();llMin.transform(b,this.backendProjection);llMax.transform(b,this.backendProjection);return"BBOX("+this.geometryColumn+", "+llMin.lat+","+llMin.lon+","+llMax.lat+","+llMax.lon+")"},getPopupHTML:function(a){return"<p>"+a.id+"</p>"},getBuffer:function(a){if(a<=7){return 2}if(a<=10){return 5}return 11},getCQLFilter:function(){return this.CQLFilter},CLASS_NAME:"Eniro.Layer.ShowOnMap"});Eniro.Layer.ShowOnMap.SEDefibrillator=OpenLayers.Class(Eniro.Layer.ShowOnMapTMS,{initialize:function(){var b=Eniro.AppNode.tileUrl("/geowebcache/service/tms");var a="se_defibrillator";var c="se_defibrillator";Eniro.Layer.ShowOnMapTMS.prototype.initialize.apply(this,[a,b,{layername:c}])},getBuffer:function(a){if(a<=6){return 3}if(a<=12){return 6}return 11},getPopupHTML:function(b){var d=this.id;this.id="";var a={container:Eniro.Util.getCssClassName(this,"popup"),subject:Eniro.Util.getCssClassName(this,"subject"),info:Eniro.Util.getCssClassName(this,"info")};this.id=d;var c=b.properties;return['<div class="'+a.container+'">','<div class="'+a.subject+'">'+c.innehavare+"</div>",'<div class="'+a.info+'">',"<div>",c.adress,"</div>",'<div class="',a.info,'">',c.postnummer," ",c.ort,"</div>","<div>",OpenLayers.i18n("show-on-map.popup.floor",{value:c.vaning}),"</div>",'<div class="',a.info,'">',OpenLayers.i18n("show-on-map.popup.location",{value:c.plats}),"</div>",'<div class="',a.info,'">',OpenLayers.i18n("show-on-map.popup.opendetails",{value:c.oppettider}).replace(/, /g,",<br/>"),"</div>",'<div class="',a.info,'">',c.ovrig,"</div>",'<a class="eniro-new" href="',OpenLayers.i18n("show-on-map.popup.register-heartstarter-url"),'">',OpenLayers.i18n("show-on-map.popup.register-heartstarter"),"</a>","</div>","</div>"].join("")},CLASS_NAME:"Eniro.Layer.ShowOnMap.SEDefibrillator",SUPER:"Eniro.Layer.ShowOnMapTMS"});Eniro.Layer.ShowOnMap.SESchool=OpenLayers.Class(Eniro.Layer.ShowOnMapTMS,{initialize:function(){var b=Eniro.AppNode.tileUrl("/geowebcache/service/tms");var a="se_school";var c="se_school";Eniro.Layer.ShowOnMapTMS.prototype.initialize.apply(this,[a,b,{layername:c}])},getBuffer:function(a){if(a<=6){return 2}if(a<=12){return 5}return 11},getPopupHTML:function(b){var d=this.id;this.id="";var a={container:Eniro.Util.getCssClassName(this,"popup"),subject:Eniro.Util.getCssClassName(this,"subject"),info:Eniro.Util.getCssClassName(this,"info"),address:Eniro.Util.getCssClassName(this,"address")};this.id=d;var c=b.properties;return['<div class="'+a.container+'">','<div class="'+a.subject+'">',c.skolnamn,"</div>",'<div class="'+a.info+'">',c.skolform,", ",c.huvudmannatyp,"<br/>",OpenLayers.i18n("show-on-map.popup.municipality"),": ",c.kommun,"</div>",'<div class="'+a.address+'">',c.adress,"<br/>",c.postadress,"<br/>",OpenLayers.i18n("show-on-map.popup.tel"),": ",c.telefon,"</div>","</div>"].join("")},CLASS_NAME:"Eniro.Layer.ShowOnMap.SESchool",SUPER:"Eniro.Layer.ShowOnMapTMS"});Eniro.Layer.ShowOnMap.SEToll=OpenLayers.Class(Eniro.Layer.ShowOnMapTMS,{namespace:"info24",initialize:function(){var b=Eniro.AppNode.tileUrl("/geowebcache/service/tms");var a="se_toll";var c="se_toll";Eniro.Layer.ShowOnMapTMS.prototype.initialize.apply(this,[a,b,{layername:c}])},getBuffer:function(a){if(a<=6){return 2}if(a<=12){return 5}return 11},getPopupHTML:function(b){var d=this.id;this.id="";var a={container:Eniro.Util.getCssClassName(this,"popup"),subject:Eniro.Util.getCssClassName(this,"subject"),source:Eniro.Util.getCssClassName(this,"source"),body:Eniro.Util.getCssClassName(this,"body")};this.id=d;var c=b.properties;return['<div class="'+a.container+'">','<div class="'+a.subject+'">',c.Subject,"</div>",'<div class="'+a.body+'">',c.Body,"</div>",'<div class="'+a.source+'">',OpenLayers.i18n("show-on-map.popup.source"),": ",c.Source,"</div>","</div>"].join("")},CLASS_NAME:"Eniro.Layer.ShowOnMap.SEToll",SUPER:"Eniro.Layer.ShowOnMapTMS"});Eniro.Layer.ShowOnMap.SETraffic=OpenLayers.Class(Eniro.Layer.ShowOnMapTMS,{namespace:"info24",initialize:function(){var b=Eniro.AppNode.tileUrl("/geowebcache/service/tms");var a="se_traffic";var c="se_traffic";Eniro.Layer.ShowOnMapTMS.prototype.initialize.apply(this,[a,b,{layername:c}])},getBuffer:function(a){return 11},getPopupHTML:function(b){var d=this.id;this.id="";var a={container:Eniro.Util.getCssClassName(this,"popup"),subject:Eniro.Util.getCssClassName(this,"subject"),body:Eniro.Util.getCssClassName(this,"body"),source:Eniro.Util.getCssClassName(this,"source")};this.id=d;var c=b.properties;return['<div class="'+a.container+'">','<div class="'+a.subject+'">',c.Subject,"</div>",'<div class="'+a.body+'">',c.Body,"</div>",'<div class="'+a.source+'">',OpenLayers.i18n("show-on-map.popup.source"),": ",c.Source,"</div>","</div>"].join("")},CLASS_NAME:"Eniro.Layer.ShowOnMap.SETraffic",SUPER:"Eniro.Layer.ShowOnMapTMS"});Eniro.Layer.ShowOnMap.HemnetPOILayer=OpenLayers.Class(Eniro.Layer.ShowOnMapTMS,{minPrice:0,maxPrice:800000000,initialize:function(){var b="http://localhost:8080/geowebcache/service/tms";var a="hemnetpoi";var c="hemnetpoi";Eniro.Layer.ShowOnMapTMS.prototype.initialize.apply(this,[a,b,{layername:c}])},setPriceRange:function(a,b){this.minPrice=a;this.maxPrice=b;this.CQLFilter="price>="+this.minPrice+" AND price<="+this.maxPrice},getPopupHTML:function(a){return["<div>",a.properties.Body,"</div>"].join("")},getBuffer:function(a){return 11},getCQLFilter:function(){return this.CQLFilter},CLASS_NAME:"Eniro.Layer.ShowOnMap.HemnetPOILayer"});Eniro.Layer.ShowOnMap.SESubway=OpenLayers.Class(Eniro.Layer.ShowOnMapTMS,{namespace:"info24",initialize:function(){var b=Eniro.AppNode.tileUrl("/geowebcache/service/tms");var a="se_subway";var c="se_subway";Eniro.Layer.ShowOnMapTMS.prototype.initialize.apply(this,[a,b,{layername:c}])},getBuffer:function(a){if(a<=6){return 2}if(a<=12){return 5}return 11},getPopupHTML:function(l){var a=this.id;this.id="";var d={container:Eniro.Util.getCssClassName(this,"popup"),subject:Eniro.Util.getCssClassName(this,"subject"),body:Eniro.Util.getCssClassName(this,"body"),moreInfo:Eniro.Util.getCssClassName(this,"more-info"),source:Eniro.Util.getCssClassName(this,"source")};this.id=a;var g=l.properties;var c=g.StopPointImageOrientation;var f="";if(g.StopPointImageURL){var b,k;if(c.toLowerCase()==="landscape"){b=255;k=191}else{b=191;k=255}f='<img src="'+g.StopPointImageURL+'" width="'+b+'" height="'+k+'" />'}var h="";if(g.StopPointMoreInfoURL){h='<a class="eniro-new '+d.moreInfo+'" href="http://'+g.StopPointMoreInfoURL.replace(/^http:\/\//gi,"")+'">'+OpenLayers.i18n("show-on-map.popup.more-info")+"</a>"}return['<div class="'+d.container+'">','<div class="'+d.subject+'">',g.TerminalName,"</div>",f,'<div class="'+d.body+'">',g.Body,"</div>",h,'<div class="'+d.source+'">',OpenLayers.i18n("show-on-map.popup.source"),": ",g.Source,"</div>","</div>"].join("")},CLASS_NAME:"Eniro.Layer.ShowOnMap.SESubway",SUPER:"Eniro.Layer.ShowOnMapTMS"});Eniro.Layer.ShowOnMap.SEHarbour=OpenLayers.Class(Eniro.Layer.ShowOnMapTMS,{ICONS:{TOILETS:"roadsign_wc.gif",DISABLED_TOILETS:"roadsign_handicapwc.gif",BABY_CHANGING_ROOM:"roadsign_nursingroom.gif",RESTAURANTS:"roadsign_restaurant.gif",TOURIST_INFORMATION:"roadsign_touristinfo.gif",PETROL_STATION:"roadsign_gasstation.gif",DIESEL_STATION:"roadsign_gasstation.gif",MOTEL:"roadsign_motel.gif",PARKING_CARS:"roadsign_carpark.gif"},namespace:"info24",initialize:function(b,a,c){Eniro.Layer.ShowOnMapTMS.prototype.initialize.apply(this,[b,a,{layername:c}])},getPopupHTML:function(d){var p=this.id;this.id="";var r={container:Eniro.Util.getCssClassName(this,"popup"),subject:Eniro.Util.getCssClassName(this,"subject"),description:Eniro.Util.getCssClassName(this,"description"),operatedby:Eniro.Util.getCssClassName(this,"operatedby"),moreInfo:Eniro.Util.getCssClassName(this,"more-info"),services:Eniro.Util.getCssClassName(this,"services"),properties:Eniro.Util.getCssClassName(this,"properties"),icons:Eniro.Util.getCssClassName(this,"icons"),source:Eniro.Util.getCssClassName(this,"source")};this.id=p;var v,s;var b=d.properties;var o="";if(b.SiteImageURL){var t,l;if(b.SiteImageOrientation.toLowerCase()==="landscape"){t=255;l=191}else{t=191;l=255}o='<img src="'+b.SiteImageURL+'" width="'+t+'" height="'+l+'" />'}var g="";if(b.SourceURL){g='<a class="eniro-new '+r.moreInfo+'" href="http://'+b.SourceURL.replace(/^http:\/\//gi,"")+'">'+OpenLayers.i18n("show-on-map.popup.more-info")+"</a>"}var c=["OpenDetails","HarbourDepth","NumberOfBerths","Moorings","MooringFee"];var h=[];for(v=0,s=c.length;v<s;++v){if(b[c[v]]&&b[c[v]]!=="0"){h.push("<li>",OpenLayers.i18n("show-on-map.popup."+c[v].toLowerCase(),{value:b[c[v]]}),"</li>")}}if(h.length>0){h.unshift('<ul class="'+r.properties+'">');h.push("</ul>")}var w=["PetrolStation","DieselStation","Toilets","DisabledToilets","BabyChangingRooms","Restaurants","TouristInformation","Motel"];var u=[];var f="";for(v=0,s=w.length;v<s;++v){if(b[w[v]]==="1"){f=Eniro.Util.getImagesLocation()+"roadsign/"+this.ICONS[w[v].dash().toUpperCase().replace(/-/gi,"_")];u.push('<img src="'+f+"?v="+Eniro.Config["media.version"]+'" width="20" height="20" title="'+OpenLayers.i18n("show-on-map.popup."+w[v].toLowerCase())+'" />')}}if(u.length>0){u.unshift('<div class="'+r.icons+'">');u.push("</div>")}var k=["PetrolStation","DieselStation","Toilets","DisabledToilets","FreshWater","Showers","Sauna","PayPhone","ElectricalOutlets","WasteEmptying","LatrineEmptyingFixed","BoatYard","Dancing","BathPlace","Shops","TouristInformation","CurrencyExchange","Pharmacy"];var a=[];for(v=0,s=k.length;v<s;++v){if(b[k[v]]==="1"){a.push(OpenLayers.i18n("show-on-map.popup.services."+k[v].toLowerCase()))}}if(a.length>0){a=['<div class="'+r.services+'">',OpenLayers.i18n("show-on-map.popup.harbour-services",{value:a.join(", ")}),"</div>"]}var q=b.Source;if(/^www/.test(q)){q='<a href="http://'+q+'" class="eniro-new">'+b.Source+"</a>"}return['<div class="'+r.container+'">','<div class="'+r.subject+'">'+b.Subject+"</div>",o,'<div class="'+r.description+'">',b.SiteDescription,"</div>",'<div class="'+r.operatedby+'">',b.OperatedBy,"</div>",h.join(""),u.join(""),a.join(""),g,'<div class="'+r.source+'">',OpenLayers.i18n("show-on-map.popup.source"),": ",q,"</div>","</div>"].join("")},CLASS_NAME:"Eniro.Layer.ShowOnMap.SEHarbour",SUPER:"Eniro.Layer.ShowOnMapTMS"});Eniro.Layer.ShowOnMap.SECamera=OpenLayers.Class(Eniro.Layer.ShowOnMapTMS,{namespace:"info24",initialize:function(){var b=Eniro.AppNode.tileUrl("/geowebcache/service/tms");var a="se_camera";var c="se_camera";Eniro.Layer.ShowOnMapTMS.prototype.initialize.apply(this,[a,b,{layername:c}])},getBuffer:function(a){if(a<=6){return 2}if(a<=12){return 5}return 11},getPopupHTML:function(b){var f=this.id;this.id="";var a={container:Eniro.Util.getCssClassName(this,"popup"),subject:Eniro.Util.getCssClassName(this,"subject"),body:Eniro.Util.getCssClassName(this,"body"),source:Eniro.Util.getCssClassName(this,"source")};this.id=f;var c=b.properties;var d="";if(c.CameraURL){d='<img src="'+c.CameraURL+'" width="255" height="191" />'}return['<div class="'+a.container+'">','<div class="'+a.subject+'">',c.Subject,"</div>",d,'<div class="'+a.body+'">',c.Body,"</div>",'<div class="'+a.source+'">',OpenLayers.i18n("show-on-map.popup.source"),": ",c.Source,"</div>","</div>"].join("")},CLASS_NAME:"Eniro.Layer.ShowOnMap.SECamera",SUPER:"Eniro.Layer.ShowOnMapTMS"});Eniro.Layer.ShowOnMap.SESpeedCamera=OpenLayers.Class(Eniro.Layer.ShowOnMapTMS,{namespace:"info24",initialize:function(){var b=Eniro.AppNode.tileUrl("/geowebcache/service/tms");var a="se_speedcamera";var c="se_speedcamera";Eniro.Layer.ShowOnMapTMS.prototype.initialize.apply(this,[a,b,{layername:c}])},getBuffer:function(a){if(a<=5){return 2}if(a<=8){return 5}return 11},getPopupHTML:function(o){var a=this.id;this.id="";var c={container:Eniro.Util.getCssClassName(this,"popup"),subject:Eniro.Util.getCssClassName(this,"subject"),body:Eniro.Util.getCssClassName(this,"body"),source:Eniro.Util.getCssClassName(this,"source")};this.id=a;var h=o.properties;var d="";if(h.SiteImageUrl){var b,l;if(h.SiteImageOrientation==="Landscape"){b=255;l=191}else{b=191;l=255}d='<img src="'+h.SiteImageUrl+'" width="'+b+'" height="'+l+'" alt="" />'}var f="";if(h.SiteDescription){f=OpenLayers.i18n("show-on-map.popup.location",{value:h.SiteDescription})}var k="";if(h.RoadName){k=OpenLayers.i18n("show-on-map.popup.roadname",{value:h.RoadName})}var g="";if(h.SpeedLimit){g=OpenLayers.i18n("show-on-map.popup.speedlimit",{value:h.SpeedLimit})}return['<div class="'+c.container+'">','<div class="'+c.subject+'">',h.Subject,"</div>",'<div class="'+c.body+'">',"<div>",f,"</div>","<div>",k,"</div>","<div>",g,"</div>","</div>",'<div class="'+c.source+'">',OpenLayers.i18n("show-on-map.popup.source"),": ",h.Source,"</div>","</div>"].join("")},CLASS_NAME:"Eniro.Layer.ShowOnMap.SESpeedCamera",SUPER:"Eniro.Layer.ShowOnMapTMS"});Eniro.Layer.ShowOnMap.SERestStop=OpenLayers.Class(Eniro.Layer.ShowOnMapTMS,{ICONS:{TOILETS:"roadsign_wc.gif",DISABLED_TOILETS:"roadsign_handicapwc.gif",BABY_CHANGING_ROOM:"roadsign_nursingroom.gif",RESTAURANTS:"roadsign_restaurant.gif",TOURIST_INFORMATION:"roadsign_touristinfo.gif",PETROL_STATION:"roadsign_gasstation.gif",MOTEL:"roadsign_motel.gif",PARKING_CARS:"roadsign_carpark.gif"},namespace:"info24",initialize:function(){var b=Eniro.AppNode.tileUrl("/geowebcache/service/tms");var a="se_reststop";var c="se_reststop";Eniro.Layer.ShowOnMapTMS.prototype.initialize.apply(this,[a,b,{layername:c}])},getBuffer:function(a){if(a<=5){return 2}if(a<=8){return 5}return 11},getPopupHTML:function(v){var b=this.id;this.id="";var g={container:Eniro.Util.getCssClassName(this,"popup"),subject:Eniro.Util.getCssClassName(this,"subject"),description:Eniro.Util.getCssClassName(this,"description"),operatedby:Eniro.Util.getCssClassName(this,"operatedby"),moreInfo:Eniro.Util.getCssClassName(this,"more-info"),services:Eniro.Util.getCssClassName(this,"services"),properties:Eniro.Util.getCssClassName(this,"properties"),icons:Eniro.Util.getCssClassName(this,"icons"),source:Eniro.Util.getCssClassName(this,"source")};this.id=b;var k,f;var p=v.properties;var h="";if(p.SiteImageURL){var c,t;if(p.SiteImageOrientation.toLowerCase()==="landscape"){c=255;t=191}else{c=191;t=255}h='<img src="'+p.SiteImageURL+'" width="'+c+'" height="'+t+'" />'}var q="";if(p.SiteMoreInfoUrl){q='<a class="eniro-new '+g.moreInfo+'" href="http://'+p.SiteMoreInfoUrl.replace(/^http:\/\//gi,"")+'">'+OpenLayers.i18n("show-on-map.popup.more-info")+"</a>"}var u=["SitePhone","OpenDetails"];var o=[];for(k=0,f=u.length;k<f;++k){if(p[u[k]]&&p[u[k]]!=="0"){o.push("<li>",OpenLayers.i18n("show-on-map.popup."+u[k].toLowerCase(),{value:p[u[k]]}),"</li>")}}if(o.length>0){o.unshift('<ul class="'+g.properties+'">');o.push("</ul>")}var s=["Toilets","DisabledToilets","BabyChangingRoom","Restaurants","TouristInformation","PetrolStation","Motel","ParkingCars"];var d=[];var a="";for(k=0,f=s.length;k<f;++k){if(p[s[k]]==="1"){a=Eniro.Util.getImagesLocation()+"roadsign/"+this.ICONS[s[k].dash().toUpperCase().replace(/-/gi,"_")];d.push('<img src="'+a+"?v="+Eniro.Config["media.version"]+'" width="20" height="20" title="'+OpenLayers.i18n("show-on-map.popup."+s[k].toLowerCase())+'" />')}}if(d.length>0){d.unshift('<div class="'+g.icons+'">');d.push("</div>")}var l=["Shops","ChildrensPlayground","ParkingTrucks"];var r=[];for(k=0,f=l.length;k<f;++k){if(p[l[k]]==="1"){r.push(OpenLayers.i18n("show-on-map.popup.services."+l[k].toLowerCase()))}}if(r.length>0){r=['<div class="'+g.services+'">',OpenLayers.i18n("show-on-map.popup.rest-stop-services",{value:r.join(", ")}),"</div>"]}return['<div class="'+g.container+'">','<div class="'+g.subject+'">'+p.Subject+"</div>",h,'<div class="'+g.description+'">',p.SiteDescription,"</div>",q,o.join(""),d.join(""),r.join(""),'<div class="'+g.source+'">',OpenLayers.i18n("show-on-map.popup.source"),": ",p.Source,"</div>","</div>"].join("")},CLASS_NAME:"Eniro.Layer.ShowOnMap.SERestStop",SUPER:"Eniro.Layer.ShowOnMapTMS"});Eniro.Layer.ShowOnMap.SEGuestHarbour=OpenLayers.Class(Eniro.Layer.ShowOnMap.SEHarbour,{initialize:function(){var b=Eniro.AppNode.tileUrl("/geowebcache/service/tms");var a="se_guestharbour";var c="se_guestharbour";Eniro.Layer.ShowOnMap.SEHarbour.prototype.initialize.apply(this,[a,b,c])},getBuffer:function(a){if(a<=5){return 2}if(a<=8){return 5}return 11},CLASS_NAME:"Eniro.Layer.ShowOnMap.SEGuestHarbour"});Eniro.Layer.ShowOnMap.SEMunicipality=OpenLayers.Class(Eniro.Layer.ShowOnMapTMS,{initialize:function(){var b=Eniro.AppNode.tileUrl("/geowebcache/service/tms");var a="se_municipality";var c="se_municipality";Eniro.Layer.ShowOnMapTMS.prototype.initialize.apply(this,[a,b,{layername:c}])},getBuffer:function(a){if(a<=6){return 2}if(a<=12){return 5}return 11},getPopupHTML:function(b){var d=this.id;this.id="";var a={container:Eniro.Util.getCssClassName(this,"popup"),subject:Eniro.Util.getCssClassName(this,"subject"),info:Eniro.Util.getCssClassName(this,"info"),address:Eniro.Util.getCssClassName(this,"address")};this.id=d;var c=b.properties;return['<div class="'+a.container+'">','<div class="'+a.subject+'">',c.kommunnamn,"</div>",'<div class="'+a.info+'">',"<div>",c.postnummer," ",c.stad,"</div>","<div>",OpenLayers.i18n("show-on-map.popup.tel"),": ",c.telefon,"</div>","<div>",OpenLayers.i18n("show-on-map.popup.fax"),": ",c.fax,"</div>","<div>&nbsp;</div>","<div>",c.email,"</div>","<div>",c.hemsida,"</div>","</div>","</div>"].join("")},CLASS_NAME:"Eniro.Layer.ShowOnMap.SEMunicipality",SUPER:"Eniro.Layer.ShowOnMapTMS"});Eniro.Layer.ShowOnMap.SERestaurants=OpenLayers.Class(Eniro.Layer.ShowOnMapTMS,{initialize:function(){var b=Eniro.AppNode.tileUrl("/geowebcache/service/tms");var a="se_restaurants";var c="se_restaurants";Eniro.Layer.ShowOnMapTMS.prototype.initialize.apply(this,[a,b,{layername:c}])},getBuffer:function(a){if(a<=6){return 2}if(a<=12){return 5}return 11},getPopupHTML:function(b){var d=this.id;this.id="";var a={container:Eniro.Util.getCssClassName(this,"popup"),subject:Eniro.Util.getCssClassName(this,"subject"),info:Eniro.Util.getCssClassName(this,"info"),address:Eniro.Util.getCssClassName(this,"address")};this.id=d;var c=b.properties;return['<div class="'+a.container+'">','<div class="'+a.subject+'">',c.kommunnamn,"</div>",'<div class="'+a.info+'">',"<div>",c.postnummer," ",c.stad,"</div>","<div>",OpenLayers.i18n("show-on-map.popup.tel"),": ",c.telefon,"</div>","<div>",OpenLayers.i18n("show-on-map.popup.fax"),": ",c.fax,"</div>","<div>&nbsp;</div>","<div>",c.email,"</div>","<div>",c.hemsida,"</div>","</div>","</div>"].join("")},setVisibility:function(a){Eniro.Layer.ShowOnMapTMS.prototype.setVisibility.apply(this,arguments);if(a){Eniro.feedService.proccess()}else{Eniro.feedService.clear()}},CLASS_NAME:"Eniro.Layer.ShowOnMap.SERestaurants",SUPER:Eniro.Layer.ShowOnMapTMS});Eniro.Layer.ShowOnMap.SENaturalHarbour=OpenLayers.Class(Eniro.Layer.ShowOnMap.SEHarbour,{initialize:function(){var b=Eniro.AppNode.tileUrl("/geowebcache/service/tms");var a="se_naturalharbour";var c="se_naturalharbour";Eniro.Layer.ShowOnMap.SEHarbour.prototype.initialize.apply(this,[a,b,c])},getBuffer:function(a){return 11},CLASS_NAME:"Eniro.Layer.ShowOnMap.SENaturalHarbour"});Eniro.Layer.ShowOnMap.SESkiCam=OpenLayers.Class(Eniro.Layer.ShowOnMapTMS,{initialize:function(){var b=Eniro.AppNode.tileUrl("/geowebcache/service/tms");var a="se_skicam";var c="se_skicam";Eniro.Layer.ShowOnMapTMS.prototype.initialize.apply(this,[a,b,{layername:c}])},getBuffer:function(a){if(a<=6){return 4}if(a<=12){return 5}return 11},getPopupHTML:function(b){var h=this.id;this.id="";var a={container:Eniro.Util.getCssClassName(this,"popup"),subject:Eniro.Util.getCssClassName(this,"subject"),image:Eniro.Util.getCssClassName(this,"image"),caption:Eniro.Util.getCssClassName(this,"caption"),moreInfo:Eniro.Util.getCssClassName(this,"more-info")};this.id=h;var c=b.properties;var g="";if(c.BigThumbnailURL){g=c.BigThumbnailURL}else{if(c.SmallThumbnailURL){g=c.SmallThumbnailURL}}var f="";if(g){f='<img src="'+g+'" width="255" height="191"/>';f='<div class="'+a.image+'">'+f+"</div>"}var d="";if(c.CameraURL){d='<a class="eniro-new '+a.moreInfo+'" href="http://'+c.CameraURL.replace(/^http:\/\//gi,"")+'">'+OpenLayers.i18n("show-on-map.popup.more-info")+"</a>"}return['<div class="'+a.container+'">','<div class="'+a.subject+'">',c.SkiResort,"</div>",f,'<div class="'+a.caption+'">',c.Caption,"</div>",d,"</div>"].join("")},CLASS_NAME:"Eniro.Layer.ShowOnMap.SESkiCam",SUPER:"Eniro.Layer.ShowOnMapTMS"});Eniro.Layer.ShowOnMap.SEMailbox=OpenLayers.Class(Eniro.Layer.ShowOnMapTMS,{namespace:"eniro",initialize:function(){var b=Eniro.AppNode.tileUrl("/geowebcache/service/tms");var a="se_brevlador";var c="se_brevlador";Eniro.Layer.ShowOnMapTMS.prototype.initialize.apply(this,[a,b,{layername:c}])},getBuffer:function(a){return 11},getPopupHTML:function(b){var d=this.id;this.id="";var a={container:Eniro.Util.getCssClassName(this,"popup"),subject:Eniro.Util.getCssClassName(this,"subject"),body:Eniro.Util.getCssClassName(this,"body"),source:Eniro.Util.getCssClassName(this,"source")};this.id=d;var c=b.properties;return['<div class="'+a.container+'">','<div class="'+a.subject+'">',c.name,"</div>",'<div class="'+a.body+'">',c.description,"</div>","</div>"].join("")},CLASS_NAME:"Eniro.Layer.ShowOnMap.SEMailbox",SUPER:"Eniro.Layer.ShowOnMapTMS"});Eniro.Layer.ShowOnMap.SEBeach=OpenLayers.Class(Eniro.Layer.ShowOnMapTMS,{namespace:"eniro",initialize:function(){var b=Eniro.AppNode.tileUrl("/geowebcache/service/tms");var a="se_beach";var c="se_beach";Eniro.Layer.ShowOnMapTMS.prototype.initialize.apply(this,[a,b,{layername:c}])},getBuffer:function(a){return 11},getPopupHTML:function(b){var d=this.id;this.id="";var a={container:Eniro.Util.getCssClassName(this,"popup"),subject:Eniro.Util.getCssClassName(this,"subject"),body:Eniro.Util.getCssClassName(this,"body"),source:Eniro.Util.getCssClassName(this,"source")};this.id=d;var c=b.properties;return['<div class="'+a.container+'">','<div class="'+a.subject+'">',c.badplatsnamn,"</div>",'<div class="'+a.body+'">',c.ort,"</div>","</div>"].join("")},CLASS_NAME:"Eniro.Layer.ShowOnMap.SEBeach",SUPER:"Eniro.Layer.ShowOnMapTMS"});Eniro.Layer.ShowOnMap.FITraffic=OpenLayers.Class(Eniro.Layer.ShowOnMapTMS,{namespace:"info24",initialize:function(){var b=Eniro.AppNode.appUrl("/geowebcache/service/tms");var a="fi_traffic";var c="fi_traffic";Eniro.Layer.ShowOnMapTMS.prototype.initialize.apply(this,[a,b,{layername:c}])},getPopupHTML:function(a){return["<div>",a.properties.Body,"</div>"].join("")},getBuffer:function(a){return 11},CLASS_NAME:"Eniro.Layer.ShowOnMap.FITraffic"});Eniro.Layer.ShowOnMap.FICamera=OpenLayers.Class(Eniro.Layer.ShowOnMapTMS,{namespace:"info24",initialize:function(){var b=Eniro.AppNode.appUrl("/geowebcache/service/tms");var a="fi_camera";var c="fi_camera";Eniro.Layer.ShowOnMapTMS.prototype.initialize.apply(this,[a,b,{layername:c}])},getBuffer:function(a){if(a<=6){return 2}if(a<=12){return 5}return 11},getPopupHTML:function(b){var f=this.id;this.id="";var a={container:Eniro.Util.getCssClassName(this,"popup"),subject:Eniro.Util.getCssClassName(this,"subject"),body:Eniro.Util.getCssClassName(this,"body")};this.id=f;var c=b.properties;var d="";if(c.CameraURL){d='<img src="'+c.CameraURL+'" width="255" height="191" />'}return['<div class="'+a.container+'">','<div class="'+a.subject+'">',c.Subject,"</div>",d,'<div class="'+a.body+'">',c.Body,"</div>","</div>"].join("")},CLASS_NAME:"Eniro.Layer.ShowOnMap.FICamera",SUPER:"Eniro.Layer.ShowOnMapTMS"});Eniro.Layer.ShowOnMap.NOTraffic=OpenLayers.Class(Eniro.Layer.ShowOnMapTMS,{namespace:"eniro",initialize:function(){var b=Eniro.AppNode.tileUrl("/geowebcache/service/tms");var a="no_traffic";var c="no_traffic";Eniro.Layer.ShowOnMapTMS.prototype.initialize.apply(this,[a,b,{layername:c}])},getBuffer:function(a){return 11},getPopupHTML:function(b){var g=this.id;this.id="";var a={container:Eniro.Util.getCssClassName(this,"popup"),subject:Eniro.Util.getCssClassName(this,"subject"),body:Eniro.Util.getCssClassName(this,"body"),moreInfo:Eniro.Util.getCssClassName(this,"more-info"),source:Eniro.Util.getCssClassName(this,"source")};this.id=g;var c=b.properties;var d="";if(c.itemurl){d='<a class="eniro-new '+a.moreInfo+'" href="http://'+c.itemurl.replace(/^http:\/\//gi,"")+'">'+OpenLayers.i18n("show-on-map.popup.more-info")+"</a>"}var f='<img src="'+Eniro.Util.getImagesLocation()+"p4logo.png?v="+Eniro.Config["media.version"]+'" width="80" height="14" alt="P4" title="P4" />';return['<div class="'+a.container+'">','<div class="'+a.subject+'">',"Trafikkinfo","</div>",'<div class="'+a.body+'">',"Melding om ",c.subadcategorydesc,", ",c.itemheading,"</div>",'<div class="'+a.body+'">',c.itemdescription,"</div>",d,f,"</div>"].join("")},CLASS_NAME:"Eniro.Layer.ShowOnMap.NOTraffic",SUPER:"Eniro.Layer.ShowOnMapTMS"});Eniro.Layer.ShowOnMap.NOWebCam=OpenLayers.Class(Eniro.Layer.ShowOnMapTMS,{namespace:"eniro",initialize:function(){var b=Eniro.AppNode.tileUrl("/geowebcache/service/tms");var a="no_webcam";var c="no_webcam";Eniro.Layer.ShowOnMapTMS.prototype.initialize.apply(this,[a,b,{layername:c}])},getBuffer:function(a){return 11},getPopupHTML:function(b){var g=this.id;this.id="";var a={container:Eniro.Util.getCssClassName(this,"popup"),subject:Eniro.Util.getCssClassName(this,"subject"),body:Eniro.Util.getCssClassName(this,"body"),moreInfo:Eniro.Util.getCssClassName(this,"more-info")};this.id=g;var c=b.properties;var f="";if(c.itemurl){f='<img src="'+c.itemurl+'" width="255" height="191" />'}var d="";if(c.itemurl){d='<a class="eniro-new '+a.moreInfo+'" href="http://www.gulesider.no/webcam/selectedWebCamera.c?id='+c.adid+'">'+OpenLayers.i18n("show-on-map.popup.more-info")+"</a>"}return['<div class="'+a.container+'">','<div class="'+a.subject+'">',c.itemheading,"</div>",f,'<div class="'+a.body+'">',c.itemdescription,"</div>",d,"</div>"].join("")},CLASS_NAME:"Eniro.Layer.ShowOnMap.NOWebCam",SUPER:"Eniro.Layer.ShowOnMapTMS"});Eniro.Layer.ShowOnMap.NOSkiInfo=OpenLayers.Class(Eniro.Layer.ShowOnMapTMS,{namespace:"eniro",initialize:function(){var b=Eniro.AppNode.tileUrl("/geowebcache/service/tms");var a="no_skiinfo";var c="no_skiinfo";Eniro.Layer.ShowOnMapTMS.prototype.initialize.apply(this,[a,b,{layername:c}])},getBuffer:function(a){return 11},getPopupHTML:function(b){var f=this.id;this.id="";var a={container:Eniro.Util.getCssClassName(this,"popup"),subject:Eniro.Util.getCssClassName(this,"subject"),info:Eniro.Util.getCssClassName(this,"info"),moreInfo:Eniro.Util.getCssClassName(this,"more-info")};this.id=f;var c=b.properties;var d="";if(c.info_url){d='<a class="eniro-new '+a.moreInfo+'" href="http://'+c.info_url.replace(/^http:\/\//gi,"")+'">'+OpenLayers.i18n("show-on-map.popup.more-info")+"</a>"}return['<div class="'+a.container+'">','<div class="'+a.subject+'">',c.resort,"</div>",'<div class="'+a.info+'">',OpenLayers.i18n("show-on-map.popup.open",{value:c.open}),"<br/>",OpenLayers.i18n("show-on-map.popup.opendetails",{value:c.opening_hours}),"</div>",'<div class="'+a.info+'">',"Antall åpne bakker: ",c.openLifts," av ",c.TotLifts,"<br/>","Åpne bakker i lengde: ",c.km_open," km av ",c.km_total," km","</div>",'<div class="'+a.info+'">',"Snødybde bakke: ",c.snow_total_cm," cm","<br/>","Snødybde terreng: ",c.snow_terrain_cm," cm","<br/>","Siste snøfall: ",c.cm_snow_last_snowfall," cm, ",c.last_snowfall_date,"</div>",d,"</div>"].join("")},CLASS_NAME:"Eniro.Layer.ShowOnMap.NOSkiInfo",SUPER:"Eniro.Layer.ShowOnMapTMS"});Eniro.Layer.Election=OpenLayers.Class(OpenLayers.Layer.TMS,{type:"png",isBaseLayer:false,geometryColumn:"the_geom",metaTileSize:3,alpha:true,buffer:0,namespace:"eniro",backendProjection:new OpenLayers.Projection("EPSG:900913"),initialize:function(){OpenLayers.Layer.TMS.prototype.initialize.apply(this,arguments)},getBBOX:function(f){var d=this.map;var c=d.getLonLatFromPixel(new OpenLayers.Pixel(f.x,f.y));var a=d.getLonLatFromPixel(new OpenLayers.Pixel(f.x,f.y));var b=d.getProjectionObject();c.transform(b,this.backendProjection);a.transform(b,this.backendProjection);return"BBOX("+this.geometryColumn+", "+c.lon+","+c.lat+","+a.lon+","+a.lat+")"},getPopupHTML:function(q,d){var a={container:Eniro.Util.getCssClassName(this,"popup"),subject:Eniro.Util.getCssClassName(this,"subject"),body:Eniro.Util.getCssClassName(this,"body")};var k=q.properties;var f=['<div class="'+a.container+'">','<div class="'+a.subject+'">',d,"</div>",'<div class="'+a.body+'">','<table class="electionResult" cellspacing="1">',"<tr>",'<th class="label">Parti</th>','<th class="value" colspan="2">Resultat (%)</th>',"</tr>"];var g=["M","C","FP","KD","S","V","MP"];var h=0;for(var b=0;b<g.length;b++){var l=g[b];var o=(k[l+"_PROC"]);var p=Eniro.Util.getCssClassName(this,"graph",null,{id:g[b].toLowerCase()});var c=Eniro.Util.getSingleCssClassName(this,"graph-div",null,{id:g[b].toLowerCase()});f.push(["<tr>",'<td class="label">',l,"</td>",'<td class="value">',o.toFixed(2),"</td>",'<td class="',p,'"><div class="',c,'"><div style="width:',parseInt(o*1.3,10),'%"></div></div></td>',"</tr>"].join(""));h+=o}l="Övriga";o=100-h;p=Eniro.Util.getCssClassName(this,"graph",null,{id:"ovr"});c=Eniro.Util.getSingleCssClassName(this,"graph-div",null,{id:"ovr"});f.push(["<tr>",'<td class="label">',l,"</td>",'<td class="value">',o.toFixed(2),"</td>",'<td class="',p,'"><div class="',c,'"><div style="width:',parseInt(o*1.3,10),'%"></div></div></td>',"</tr>"].join(""));f.push("</table></div></div>");return f.join("")},getURL:function(f){var b=OpenLayers.Layer.TMS.prototype.getURL.apply(this,arguments);var g="";var c=/.*\/([0-9]+)\/([0-9]+)\/([0-9]+)\.[a-z]+$/i.exec(b);if(c){var a=Math.floor(parseInt(c[2],10)/this.metaTileSize),h=Math.floor(parseInt(c[3],10)/this.metaTileSize);g="?c="+Eniro.Crypto.crc32(c[1]+"/"+a+"/"+h)}var d=Eniro.Config["tile.version"];return b+g+(!(d===null||d===undefined)?"&v="+d:"")},CLASS_NAME:"Eniro.Layer.Election",SUPER:"Eniro.Layer.TMS"});Eniro.Layer.Election.ParliamentDivision=OpenLayers.Class(Eniro.Layer.Election,{initialize:function(){var b=Eniro.AppNode.tileUrl("/geowebcache/service/tms");var a="riksdagen_i_riksdagsvalkretsar";var c="riksdagen_i_riksdagsvalkretsar";Eniro.Layer.Election.prototype.initialize.apply(this,[a,b,{layername:c}])},getPropertyNames:function(){return["RVK_NAMN","M_PROC","FP_PROC","C_PROC","KD_PROC","S_PROC","MP_PROC","V_PROC"]},getPopupHTML:function(a){return Eniro.Layer.Election.prototype.getPopupHTML.apply(this,[a,"Riksdagsval "+a.properties.RVK_NAMN+" valkrets"])},CLASS_NAME:"Eniro.Layer.Election.ParliamentDivision",SUPER:"Eniro.Layer.Election"});Eniro.Layer.Election.ParliamentMunicipal=OpenLayers.Class(Eniro.Layer.Election,{initialize:function(){var b=Eniro.AppNode.tileUrl("/geowebcache/service/tms");var a="riksdagen_i_kommuner";var c="riksdagen_i_kommuner";Eniro.Layer.Election.prototype.initialize.apply(this,[a,b,{layername:c}])},getPropertyNames:function(){return["KOM_NAMN","M_PROC","FP_PROC","C_PROC","KD_PROC","S_PROC","MP_PROC","V_PROC"]},getPopupHTML:function(a){return Eniro.Layer.Election.prototype.getPopupHTML.apply(this,[a,"Riksdagsval "+a.properties.KOM_NAMN+" kommun"])},CLASS_NAME:"Eniro.Layer.Election.ParliamentMunicipal",SUPER:"Eniro.Layer.Election"});Eniro.Layer.Election.ParliamentDistrict=OpenLayers.Class(Eniro.Layer.Election,{initialize:function(){var b=Eniro.AppNode.tileUrl("/geowebcache/service/tms");var a="riksdagen_i_valdistrikt";var c="riksdagen_i_valdistrikt";Eniro.Layer.Election.prototype.initialize.apply(this,[a,b,{layername:c}])},getPropertyNames:function(){return["NAMN","M_PROC","FP_PROC","C_PROC","KD_PROC","S_PROC","MP_PROC","V_PROC"]},getPopupHTML:function(a){return Eniro.Layer.Election.prototype.getPopupHTML.apply(this,[a,"Riksdagsval "+a.properties.NAMN+" valdistrikt"])},CLASS_NAME:"Eniro.Layer.Election.ParliamentDistrict",SUPER:"Eniro.Layer.Election"});Eniro.Layer.TMS=OpenLayers.Class(OpenLayers.Layer.TMS,{metaTileSize:3,tileVersion:null,buffer:0,initialize:function(d,b,a,c){if(!b){b=Eniro.AppNode.tileUrl("/geowebcache/service/tms")}this.tileVersion=c;this.layerId=d;return OpenLayers.Layer.TMS.prototype.initialize.apply(this,[OpenLayers.i18n("map.layers."+d),b,a])},getURL:function(d){var b=OpenLayers.Layer.TMS.prototype.getURL.apply(this,arguments),f="";var c=/.*\/([0-9]+)\/([0-9]+)\/([0-9]+)\.[a-z]+$/i.exec(b);if(c){var a=Math.floor(parseInt(c[2],10)/this.metaTileSize),g=Math.floor(parseInt(c[3],10)/this.metaTileSize);f="?c="+Eniro.Crypto.crc32(c[1]+"/"+a+"/"+g)}return b+f+(!(this.tileVersion===null||this.tileVersion===undefined)?"&v="+this.tileVersion:"")},CLASS_NAME:"Eniro.Layer.TMS"});Eniro.Layer.SearchLayer=OpenLayers.Class(OpenLayers.Layer.WFS,{ratio:1,queriesEnabled:true,destroyTransientFeaturesEnabled:true,firstSearch:false,rendererOptions:{zIndexing:true},previousMode:null,currentSearch:null,PARAMS_TO_SERVER:[{applies:function(a){return true},filter:["p","ap","q","where","id","pageSize","linkId","offset","BBOX","zoom","partner_type","disable_bought_area","disableRankLogic"]},{applies:function(a){if(typeof a.reverseLookup!="undefined"){if(a._firstSearch){this.filter=this.filter_firstSearch}else{this.filter=this.filter_following}return true}return false},filter_firstSearch:["p","q","ap","reverseLookup","offset"],filter_following:["p","q","ap","reverseLookup","offset","zoom","BBOX"],filter:null},{applies:function(b){var a=b.ap;if(!a){a=b.p}if(a&&(a.indexOf("yp")===0||a.indexOf("wp")===0)&&b.where){if(b._firstSearch||b._redo){if(b._city21Hack){this.filter=this.filter_firstAndRedoCity21}else{this.filter=this.filter_firstAndRedo}}else{if(b._queriesEnabled){Eniro.AppEvents.triggerEvent(Eniro.Events.SET_SEARCH_FIELDS,{q:b.q,where:""})}this.filter=this.filter_else}return true}else{return false}},filter_firstAndRedoCity21:["p","ap","q","where","BBOX","id","pageSize","linkId","offset","zoom","partner_type","disable_bought_area"],filter_firstAndRedo:["p","ap","q","where","id","pageSize","linkId","offset","zoom","partner_type","disable_bought_area"],filter_else:["p","ap","q","BBOX","id","pageSize","linkId","offset","zoom","partner_type","disable_bought_area"],filter:null},{applies:function(a){return a.mapTypesUpdate},filter:["BBOX","zoom"]},{applies:function(b){var a=b.ap;if(!a){a=b.p}if(a){if(a.indexOf("geo")===0&&b.p===a){if(b._firstSearch){this.filter=this.filter_firstSearch}else{this.filter=this.filter_following}return true}}return false},filter_firstSearch:["p","ap","q","id","pageSize","offset","disableRankLogic"],filter_following:["BBOX","zoom"],filter:null}],initialize:function(b,c,f,a){var d={format:Eniro.MetaGeoJSON};this.url=c;OpenLayers.Util.extend(d,a);OpenLayers.Layer.WFS.prototype.initialize.apply(this,[b,c,f,d]);Eniro.AppEvents.register(Eniro.Events.MODE_SWITCH,this,this.onModeSwitch);Eniro.AppEvents.register(Eniro.Events.SEARCH_DO,this,this.onSearch);Eniro.AppEvents.register(Eniro.Events.SEARCH_REDO,this,this.onSearchRedo);Eniro.AppEvents.register(Eniro.Events.SEARCH_CLEAR,this,this.onSearchClear);Eniro.AppEvents.register(Eniro.Events.SEARCH_RESTORE,this,this.onSearchRestore)},destroy:function(){Eniro.AppEvents.unregister(Eniro.Events.SEARCH_DO,this,this.onSearch);Eniro.AppEvents.unregister(Eniro.Events.SEARCH_REDO,this,this.onSearchRedo);Eniro.AppEvents.unregister(Eniro.Events.SEARCH_CLEAR,this,this.onSearchClear);Eniro.AppEvents.unregister(Eniro.Events.SEARCH_RESTORE,this,this.onSearchRestore);if(this.projection){this.projection.destroy();this.projection=null}if(this.eventDispatcher){this.eventDispatcher.destroy();this.eventDispatcher=null}if(this.map){this.map.events.unregister("movestart",this,this.onMoveStart)}OpenLayers.Layer.WFS.prototype.destroy.apply(this,arguments)},onMoveStart:function(a){if(this.params&&this.params.offset){this.params.offset=0}},setMap:function(a){OpenLayers.Layer.WFS.prototype.setMap.apply(this,arguments);this.eventDispatcher=new Eniro.Control.FeatureEventDispatcher(this);this.map.addControl(this.eventDispatcher);this.eventDispatcher.activate();a.stateController.register(Eniro.Layer.SearchLayer.STATE_KEY,90,this);this.map.events.register("movestart",this,this.onMoveStart)},onModeSwitch:function(a){this.previousMode=a.mode},onSearch:function(f,h){var d={};jQuery.extend(d,f);delete d.object;delete d.cancelBubble;delete d.element;delete d.type;var g=true;if(typeof h==="boolean"){g=h}if(this.validateSearch(d)||d._forceEmpty){if(d&&(d.success||d.mapTypesUpdate)){var b=this.params;var c=this.firstSearch;var a=this.currentSearch;this.firstSearch=g;this.params={};this.params=this.filterServerParams(d);this.currentSearch={};if(d.mapTypesUpdate){this.tile=this.buildSearchTile(d,null)}else{this.tile=this.buildSearchTile(d,d.success)}this.tile.draw(true);this.params=b;this.firstSearch=c;this.currentSearch=a}else{if(d){this.firstSearch=g;this.currentSearch=d;this.applyCurrentSearch()}}}},onSearchRedo:function(a){a._redo=true;var d=this.getCurrentSearch();var b={};jQuery.extend(b,d);jQuery.extend(b,a);var c=a._firstSearch===true;this.onSearch(b,c)},onSearchClear:function(){this.clearParams();this.mergeNewParams();this.currentSearch={_forceEmpty:true};this.destroyTransientFeatures()},onSearchRestore:function(){if(this.currentSearch){this.onSearch(this.currentSearch)}},validateSearch:function(a){if(!a){OpenLayers.Console.log("Search is empty or null");return false}var b=function(c){if(a[c]){if(a[c] instanceof String){return jQuery.trim(a[c])!==""}else{return true}}else{return false}};if(!b("q")&&!b("id")&&!b("reverseLookup")&&!b("mapTypesUpdate")){return false}return true},getCurrentSearch:function(){return this.currentSearch?this.currentSearch:{}},applyCurrentSearch:function(){this.clearParams();this.mergeNewParams(this.currentSearch)},getTransientFeature:function(b){if(this.transientFeatures){for(var a=0;a<this.transientFeatures.length;a++){if(this.transientFeatures[a].fid==b){return this.transientFeatures[a]}}}return null},findTransientFeaturesByType:function(c){var b=[];if(this.transientFeatures){for(var a=0,d=this.transientFeatures.length;a<d;a++){if(this.transientFeatures[a].markerType===c){b.push(this.transientFeatures[a])}}}return b},destroyFeatures:function(d,a){var c=(!d);if(c){d=this.features.concat([])}if(d){this.removeFeatures(d,a);for(var b=d.length-1;b>=0;b--){d[b].destroy()}}},filterServerParams:function(h){if(!h){h={}}var f=this.PARAMS_TO_SERVER[0].filter;var g={};jQuery.extend(g,this.currentSearch);jQuery.extend(g,this.params);jQuery.extend(g,h);g._firstSearch=this.firstSearch;g._queriesEnabled=this.queriesEnabled;var d,a;for(d=1,a=this.PARAMS_TO_SERVER.length;d<a;d++){if(this.PARAMS_TO_SERVER[d].applies(g)){f=this.PARAMS_TO_SERVER[d].filter;break}}var b=null;if(f.length){b={};for(d=0,a=f.length;d<a;d++){var c=f[d];if(h[c]){b[c]=h[c]}}}if(Eniro.map.baseLayer.layerId){b.layer=Eniro.map.baseLayer.layerId;b.profile=Eniro.Profile.id}return b},mergeNewParams:function(b){var a=this.filterServerParams(b);return OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this,[a])},clearParams:function(){this.params={}},moveTo:function(d,a,f){OpenLayers.Layer.Vector.prototype.moveTo.apply(this,arguments);if(f){return false}if(this.options.minZoomLevel){OpenLayers.Console.warn(OpenLayers.i18n("minZoomLevelError"));if(this.map.getZoom()<this.options.minZoomLevel){return null}}if(d===null){d=this.map.getExtent()}var b=(this.title===null||this.title===undefined);var g=(!b&&!this.tile.bounds.containsBounds(d));if(a||b||(!f&&g)){d=this.map.getAdjustedExtent();var c=this.getCurrentSearch();if(this.tile){this.removeTileMonitoringHooks(this.tile);this.tile.destroy();this.tile=null}this.tile=this.buildSearchTile(c,null);this.addTileMonitoringHooks(this.tile);this.tile.draw()}},buildSearchTile:function(u,r){var g={};jQuery.extend(g,u);if(this._disableHistory){g._disableHistory=true}var a=this.map.getAdjustedExtent();var b=a.getCenterLonLat();var p=a.getWidth()*this.ratio;var h=a.getHeight()*this.ratio;var l=new OpenLayers.Bounds(b.lon-(p/2),b.lat-(h/2),b.lon+(p/2),b.lat+(h/2));var s=this.map.getAdjustedSize();s.w=s.w*this.ratio;s.h=s.h*this.ratio;var k=new OpenLayers.LonLat(l.left,l.top);var o=this.map.getLayerPxFromLonLat(k);var q=this.params;var f=null;var d=this.params.filter||this.params.FILTER;if(d){f={FILTER:d}}else{f={BBOX:this.encodeBBOX?l.toBBOX():l.toArray()}}f.zoom=this.map.getZoom();if(this.map&&!this.projection.equals(this.map.getProjectionObject())){var t=l.clone();t.transform(this.map.getProjectionObject(),this.projection);if(!d){f.BBOX=this.encodeBBOX?t.toBBOX():t.toArray()}}jQuery.extend(f,q);this.params=this.filterServerParams(f);var c=this.getFullRequestString();this.params=q;if(this.tile&&!r){this.removeTileMonitoringHooks(this.tile);this.tile.destroy();this.tile=null}return new Eniro.Tile.SearchTile(this,o,l,c,s,r,g,this.firstSearch)},refresh:function(){if(this.tile){this.tile.draw()}},addTransientFeatures:function(b){var a=this.aggregate(b);this.transientFeatures=a.concat([]);this.addFeatures(a)},aggregate:function(b){var l=[];var p=[];var f;for(var h=0,k=b.length;h<k;h++){var c=Eniro.Profile.providers[b[h].attributes.source].sellable?Eniro.Feature.AggregatePredefinedMarker:Eniro.Feature.AggregateWFSMarker;var q=b[h];l.push(q);var o=q.attributes.groupID;if(o){f=p[o];if(f===undefined||f===null){f={featureList:[],geometry:q.geometry.clone(),source:q.attributes.source};p[o]=f}f.featureList.push(q)}}for(var g=0,d=p.length;g<d;g++){f=p[g];if(f){if(f.featureList.length>1){var a=new c(f.geometry,{title:"aggregate",source:f.source,provider:f.source,features:f.featureList});a.setAggregatedFeatures(f.featureList,f.source);l.push(a)}else{if(f.length==1){l.push(f.featureList[0])}}}}return l},destroyTransientFeatures:function(){if(this.transientFeatures){this.destroyFeatures(this.transientFeatures);this.transientFeatures=null}},setQueriesEnabled:function(a){this.queriesEnabled=a},setDestroyTransientFeaturesEnabled:function(a){this.destroyTransientFeaturesEnabled=a},doTileDraw:function(){return this.queriesEnabled},onFeatureInsert:function(a){if(a.onAdded){a.onAdded()}},drawFeature:function(a,b){if(this.drawn){if(typeof b!="object"){if(!b&&a.state===OpenLayers.State.DELETE){b="delete"}var c=b||a.renderIntent;b=a.style||this.style;if(!b){b=this.styleMap.createSymbolizer(a,c)}}if(!this.renderer.drawFeature(a,b)){this.unrenderedFeatures[a.id]=a}else{delete this.unrenderedFeatures[a.id];if(a.onRendered&&typeof a.onRendered==="function"){a.onRendered()}}}},saveState:function(){var a={search:this.getCurrentSearch()};return a},applyState:function(a){if(a.search){var b=a.search;if(b.p&&b.p.indexOf("geo")!==-1&&b.id&&b.where){delete b.id;b.q=b.where}}Eniro.AppEvents.triggerEvent(Eniro.Events.SET_SEARCH_FIELDS,b);this._disableHistory=true;this.onSearch(b);this._disableHistory=false},CLASS_NAME:"Eniro.Layer.SearchLayer"});Eniro.Layer.SearchLayer.STATE_KEY="searchLayer";Eniro.ObliqueTransformer=OpenLayers.Class({map:null,utmProjections:{"32":"EPSG:32632","33":"EPSG:32633","34":"EPSG:32634","35":"EPSG:32635"},initialize:function(a){this.map=a},_groundToImage:function(l,c,g,d){var k,f,a;a=-(l.rotationMatrix[2][0]*(c-l.projectionCenterX)+l.rotationMatrix[2][1]*(g-l.projectionCenterY)+l.rotationMatrix[2][2]*(d-l.projectionCenterZ))/l.cameraConstant;k=(l.rotationMatrix[0][0]*(c-l.projectionCenterX)+l.rotationMatrix[0][1]*(g-l.projectionCenterY)+l.rotationMatrix[0][2]*(d-l.projectionCenterZ))/a;f=(l.rotationMatrix[1][0]*(c-l.projectionCenterX)+l.rotationMatrix[1][1]*(g-l.projectionCenterY)+l.rotationMatrix[1][2]*(d-l.projectionCenterZ))/a;var b=(k/l.pixelSize)+(l.columns/2);var h=(f/l.pixelSize)+(l.rows/2);return new OpenLayers.LonLat(b,h)},_imageToGround:function(o,b,k,c){var l,d,p,h,g;l=(b-(o.columns/2))*o.pixelSize;d=(k-(o.rows/2))*o.pixelSize;p=o.rotationMatrix[0][0]*l+o.rotationMatrix[1][0]*d-o.rotationMatrix[2][0]*o.cameraConstant;h=o.rotationMatrix[0][1]*l+o.rotationMatrix[1][1]*d-o.rotationMatrix[2][1]*o.cameraConstant;g=o.rotationMatrix[0][2]*l+o.rotationMatrix[1][2]*d-o.rotationMatrix[2][2]*o.cameraConstant;var a=p/g*(c-o.projectionCenterZ)+o.projectionCenterX;var f=h/g*(c-o.projectionCenterZ)+o.projectionCenterY;return new OpenLayers.LonLat(a,f)},pixelToWorld:function(g,f,a){if(!g||!g.rotationMatrix){return new OpenLayers.LonLat(0,0)}var c=f.lon;var k=f.lat;var d=this._imageToGround(g,c,k,0);var b=this.utmProjections[g.utmZone];var h=d.clone().transform(new OpenLayers.Projection(b),a||this.map.backendProjection);return h},worldToPixel:function(f,d,a){if(!f||!f.rotationMatrix){return new OpenLayers.LonLat(0,0)}var b=this.utmProjections[f.utmZone];var c=d.clone().transform(a||this.map.backendProjection,new OpenLayers.Projection(b));return this._groundToImage(f,c.lon,c.lat,0)},pixelToWorldMercator:function(b,a){return this.pixelToWorld(b,a,this.map.projection)},getProjection:function(a){return new OpenLayers.Projection(this.utmProjections[a.utmZone])},CLASS_NAME:"Eniro.ObliqueTransformer"});Eniro.ObliqueProjection=OpenLayers.Class({initialize:function(){},getCode:function(){return"eniro_oblique"},CLASS_NAME:"Eniro.ObliqueProjection"});Eniro.Layer.Oblique=OpenLayers.Class(Eniro.Layer.TMS,{maxZoomLevel:2,minZoomLevel:0,res:{se:[2,1,0.66666667],fi:[2,1,0.66666667],dk:[2,1,0.66666667],no:[2,1,0.5]},buffer:0,overviewMap:null,updatePercent:0.29,orientation:"N",obliqueActive:false,initialized:false,obeyChangeBaseLayer:false,previousZoomLevel:0,searchParams:{},obliqueProjection:new Eniro.ObliqueProjection(),initialize:function(f,c,b,d){var a={units:"pixels",displayOutsideMaxExtent:true,zoomOffset:0,type:"jpg",tileOrigin:new OpenLayers.LonLat(0,0)};OpenLayers.Util.extend(a,b);Eniro.AppEvents.register(Eniro.Events.OBLIQUE_ORIENTATION_SWITCH,this,this.onObliqueOrientationSwitch);Eniro.AppEvents.register(Eniro.Events.STATE_SAVING_MODE_SWITCH,this,this.onStateSavingModeSwitch);Eniro.AppEvents.register(Eniro.Events.MODE_SWITCH,this,this.onModeSwitch);Eniro.Layer.TMS.prototype.initialize.apply(this,[f,c,a,d])},destroy:function(){if(this.map&&this.map.events){this.map.events.unregister("moveend",this,this.onMoveEnd);if(this.obeyChangeBaseLayer){this.map.events.un({changebaselayer:this.onChangeBaseLayer,zoomend:this.onZoomChanged,scope:this})}}Eniro.AppEvents.unregister(Eniro.Events.OBLIQUE_ORIENTATION_SWITCH,this,this.onObliqueOrientationSwitch);Eniro.AppEvents.unregister(Eniro.Events.STATE_SAVING_MODE_SWITCH,this,this.onStateSavingModeSwitch);Eniro.AppEvents.unregister(Eniro.Events.MODE_SWITCH,this,this.onModeSwitch);Eniro.Layer.TMS.prototype.destroy.apply(this,arguments)},setMap:function(a){Eniro.Layer.TMS.prototype.setMap.apply(this,arguments);this.obliqueTransformer=new Eniro.ObliqueTransformer(this.map);this.map.events.register("moveend",this,this.onMoveEnd);if(this.obeyChangeBaseLayer){this.map.events.on({changebaselayer:this.onChangeBaseLayer,zoomend:this.onZoomChanged,scope:this})}OpenLayers.Projection.addTransform(this.map.projection,"eniro_oblique",OpenLayers.Function.bind(function(b){this._transformGeometry(b,this.map.projection)},this));OpenLayers.Projection.addTransform("eniro_oblique",this.map.projection,OpenLayers.Function.bind(function(b){this._transformGeometry(b,this.map.projection,true)},this))},_transformGeometry:function(f,d,c){var b;if(f instanceof OpenLayers.LonLat){b=c?this.obliqueTransformer.pixelToWorld(this.obliqueTileInfo,f,this.map.projection):this.obliqueTransformer.worldToPixel(this.obliqueTileInfo,f,this.map.projection);f.lon=b.lon;f.lat=b.lat}else{if(f instanceof OpenLayers.Geometry.Point){var a=new OpenLayers.LonLat(f.x,f.y);b=c?this.obliqueTransformer.pixelToWorld(this.obliqueTileInfo,a,this.map.projection):this.obliqueTransformer.worldToPixel(this.obliqueTileInfo,a,this.map.projection);f.x=b.lon;f.y=b.lat}}},getURL:function(a){var l,b;a=this.adjustBounds(a);var c=this.map.getResolution();var h=Math.round((a.left-this.maxExtent.left)/(c*this.tileSize.w));var f=Math.round((this.maxExtent.top-a.top)/(c*this.tileSize.h));var d=this.map.getZoomForResolution(c);var g=Math.ceil((this.cols/c)/this.tileSize.w);var k=Math.ceil((this.rows/c)/this.tileSize.h);b=this.url;if(f<k&&f>=0&&h<g&&h>=0){l=this.imagename+"/"+d+"_"+h+"_"+f+"."+this.type+"?v="+this.tileVersion+"&c="+Eniro.Crypto.crc32(this.imagename)}else{l="media/tile/oblique-bg.gif?v="+Eniro.Config["media.version"]}if(b instanceof Array){b=this.selectUrl(l,b)}return b+l},updateObliqueInfo:function(a){this.obliqueTileInfo=a;var o=this.map.getTileSize().w;var b=a.columns;var l=a.rows;var p=Math.ceil(l/o);var g=Math.ceil(b/o);var h=p*o;var k=g*o;var d="oblique-data/"+this.obliqueTileInfo.imagePath+"/"+this.obliqueTileInfo.imageName;var c=this.obliqueTileInfo.country||"se";var f=this.res[c];this.addOptions({rows:l,cols:b,maxExtent:new OpenLayers.Bounds(0,0,k,h),imagename:d,maxResolution:f[0],minResolution:f[2],resolutions:f});this.redraw()},changeObliqueImage:function(a){Eniro.AppEvents.triggerEvent(Eniro.Events.OBLIQUE_IMAGE_CHANGING,{});this.searchObj=a;jQuery.jsonp({url:Eniro.AppNode.appUrl("search/search"),data:this.searchObj,callbackParameter:"callback",success:OpenLayers.Function.bindAsEventListener(this.updateLayer,this),error:OpenLayers.Function.bind(function(b){},this),dataFilter:function(b){return JSON.parse(JSON.stringify(b))}})},updateLayer:function(d){if(d&&d.oblique){this.updateObliqueInfo(d.oblique);var c=this.searchObj.ob_coord.split(",");var a=new OpenLayers.LonLat(c[0],c[1]);var f=this.obliqueTransformer.worldToPixel(d.oblique,a);var b=this.searchObj.zoomLevel!==undefined?this.searchObj.zoomLevel:this.map.getZoom();this.map.setCenter(new OpenLayers.LonLat(Math.round(f.lon),Math.round(f.lat)),b);this.searchObj.zoomLevel=undefined;if(this.overviewMap){a=new OpenLayers.LonLat(d.oblique.centerX,d.oblique.centerY);this.overviewMap.onDragEnd(null,null,a)}Eniro.AppEvents.triggerEvent(Eniro.Events.OBLIQUE_LAYER_UPDATED,{data:d})}else{Eniro.AppEvents.triggerEvent(Eniro.Events.OBLIQUE_MISSING,this)}},onMoveEnd:function(g){if(this.initialized&&this.map.dragging){var p=this.map.getExtent();var l=this.map.getMaxExtent();var c=l.left-p.left;var h=p.right-l.right;var k=p.top-l.top;var f=l.bottom-p.bottom;var d=p.right-p.left;var b=p.top-p.bottom;this.searchObj=this.getSearchObj({extent:p});if((c/d>this.updatePercent||h/d>this.updatePercent)||(k/b>this.updatePercent||f/b>this.updatePercent)){this.changeObliqueImage(this.searchObj)}this.whoisdragging="main";if(this.overviewMap){var o=this.map.getCenter();var a=this.obliqueTransformer.pixelToWorld(this.obliqueTileInfo,o);this.overviewMap.onDragEnd(null,null,a)}}},getSearchObj:function(r){var l={zoom:14},E,w,G,f,D,s,k;var q=(r&&r.extent)?r.extent:null;var u=(r&&r.dir)?r.dir:null;var A=(r&&typeof r.city!=="undefined")?r.city:null;var d=(r&&r.searchParams)?r.searchParams:null;var o=(r&&r.lonlat)?r.lonlat:null;if(A!==null){A=Eniro.Profile.oblique.cities[r.city];var b=A.lon;var h=A.lat;f=b-0.001;D=b+0.001;s=h-0.001;k=h+0.001;l.ob_coord=b+","+h;l.ob_pol=[f,s,D,s,D,k,f,k].join(",");l.ob_or=A.orientation?A.orientation:Eniro.Profile.oblique.defaultOrientation}else{if(q!==null){var a=new OpenLayers.LonLat(q.left,q.top);var t=new OpenLayers.LonLat(q.right,q.top);var B=new OpenLayers.LonLat(q.right,q.bottom);var F=new OpenLayers.LonLat(q.left,q.bottom);var c=this.map.getCenter();var z=this.obliqueTransformer.pixelToWorld(this.obliqueTileInfo,a);var g=this.obliqueTransformer.pixelToWorld(this.obliqueTileInfo,t);var p=this.obliqueTransformer.pixelToWorld(this.obliqueTileInfo,B);var v=this.obliqueTransformer.pixelToWorld(this.obliqueTileInfo,F);var C=this.obliqueTransformer.pixelToWorld(this.obliqueTileInfo,c);f=z.lon;s=z.lat;D=p.lon;k=p.lat;if(u!==null){this.orientation=u;if(this.overviewMap){this.overviewMap.setOrientation(u)}}l.ob_coord=[C.lon,C.lat].join(",");l.ob_pol=[z.lon,z.lat,g.lon,g.lat,p.lon,p.lat,v.lon,v.lat].join(",");l.ob_or=this.getOrientation(u||this.orientation)}else{if(o!==null){f=o.lon-0.001;D=o.lon+0.001;s=o.lat-0.001;k=o.lat+0.001;l.ob_coord=[o.lon,o.lat].join(",");l.ob_pol=[f,s,D,s,D,k,f,k].join(",");l.ob_or="N"}}}if(d){this.searchParams=d}OpenLayers.Util.extend(l,this.searchParams);delete l.type;delete l.object;delete l.element;if(!l.BBOX){OpenLayers.Util.extend(l,{BBOX:[f,s,D,k].join(",")})}return l},getOrientation:function(a){var b;if(a==="eniro-orientation-north"){b="S"}else{if(a==="eniro-orientation-east"){b="W"}else{if(a==="eniro-orientation-west"){b="E"}else{if(a==="eniro-orientation-south"){b="N"}else{b=a}}}}return b},onObliqueAreaExists:function(c){if(c.oblique){this.updateObliqueInfo(c.oblique);var b=this.searchObj.ob_coord.split(",");var a=new OpenLayers.LonLat(b[0],b[1]);var f=a.clone();var d=this.obliqueTransformer.worldToPixel(c.oblique,a);this.map.center=new OpenLayers.LonLat(Math.round(d.lon),Math.round(d.lat));Eniro.AppEvents.triggerEvent(Eniro.Events.CHANGE_BASE_LAYER,this);this.map.moveTo(this.map.center,0);if(this.overviewMap){f.transform(new OpenLayers.Projection("EPSG:4326"),new OpenLayers.Projection("EPSG:900913"));this.overviewMap.setCenter(f,Eniro.Profile.oblique.overviewZoomLevels[this.map.zoom]);this.overviewMap.createExtentMarker()}Eniro.AppEvents.triggerEvent(Eniro.Events.OBLIQUE_INITIALISING,{data:c});Eniro.AppEvents.triggerEvent(Eniro.Events.OBLIQUE_COPYRIGHT,c);this.initialized=true}},onChangeBaseLayer:function(b){if(b.layer===this){this.onObliqueActivate({lonlat:this.map.getCenter().clone().transform(this.map.baseLayer.projection,this.map.backendProjection)});this.obliqueActive=true}else{if(this.obliqueActive){this.obliqueActive=false;this.onObliqueDeactivate();var a=this.obliqueTransformer.pixelToWorldMercator(this.obliqueTileInfo,this.map.getCenter());this.map.setCenter(a,this.previousZoomLevel)}}},onZoomChanged:function(a){if(!this.obliqueActive&&this.map.baseLayer!==this){this.previousZoomLevel=this.map.getZoom()}},onStateSavingModeSwitch:function(b){if(b&&b.mode==="oblique"){var a=b.previousMode;if(b&&b.previousMode&&this.savedState&&this.savedState.map){b={mode:(this.savedState.map.mode&&(this.savedState.map.mode!=="oblique")?this.savedState.map.mode:"search")}}else{if(!(b&&b.previousMode)){this.savedState=this.map.stateController.saveState()}else{b={mode:"search"}}}b.previousMode=a;Eniro.AppEvents.triggerEvent(Eniro.Events.MODE_SWITCH,b)}},onModeSwitch:function(d){var g=(d&&typeof d.city!=="undefined")?d.city:null;var c=(d&&d.lonlat)?d.lonlat:null;var f=(d&&d.searchParams)?d.searchParams:null;var b=(d&&d.state&&d.state.searchObj)?d.state.searchObj:null;var a=(d&&d.marker)?d.marker:null;if((d&&d.mode==="oblique")&&(g!==null||c!==null||f!==null||b!==null)){OpenLayers.Console.log([this.CLASS_NAME,"oblique - onModeSwitch",g,c,f,b]);this.onObliqueActivate({city:g,lonlat:c,searchParams:f,baselayer:this.map.baseLayer,searchObj:b,marker:a});this.obliqueActive=true}else{if(this.obliqueActive){this.obliqueActive=false;this.onObliqueDeactivate();if(this.savedState){this.map.stateController.applyState(this.savedState);this.savedState=null}else{this.map.reset();d.mode=this.map.getCurrentMode()}}}},onObliqueActivate:function(b){Eniro.AppEvents.triggerEvent(Eniro.Events.OBLIQUE_ACTIVATING,{state:b});if(b&&b.searchObj){this.searchObj=b.searchObj;if(b.searchObj.id){this.searchParams.id=b.searchObj.id}if(b.searchObj.q){this.searchParams.q=b.searchObj.q}if(b.searchObj.p){this.searchParams.p=b.searchObj.p}if(b.searchObj.ap){this.searchParams.ap=b.searchObj.ap}var c=parseFloat(b.searchObj.ob_coord.split(",")[0]);var a=parseFloat(b.searchObj.ob_coord.split(",")[1]);this.center=new OpenLayers.LonLat(c,a)}else{this.searchObj=this.getSearchObj(b)}jQuery.jsonp({url:Eniro.AppNode.appUrl("search/search"),data:this.searchObj,callbackParameter:"callback",success:OpenLayers.Function.bindAsEventListener(this.onObliqueAreaExists,this),error:function(d){Eniro.AppEvents.triggerEvent(Eniro.Events.MODE_SWITCH,{mode:"search"})},dataFilter:function(d){return JSON.parse(JSON.stringify(d))}})},onObliqueDeactivate:function(){Eniro.AppEvents.triggerEvent(Eniro.Events.OBLIQUE_DEACTIVATING,{});Eniro.AppEvents.triggerEvent(Eniro.Events.OBLIQUE_COPYRIGHT,null)},onObliqueOrientationSwitch:function(a){this.setOrientation(a.orientation)},setOrientation:function(a){var b=this.map.getExtent();this.searchObj=this.getSearchObj({extent:b,dir:a});this.changeObliqueImage(this.searchObj)},CLASS_NAME:"Eniro.Layer.Oblique"});Eniro.Layer.Oblique.ORIENTATION_NORTH="eniro-orientation-north";Eniro.Layer.Oblique.ORIENTATION_WEST="eniro-orientation-west";Eniro.Layer.Oblique.ORIENTATION_SOUTH="eniro-orientation-south";Eniro.Layer.Oblique.ORIENTATION_EAST="eniro-orientation-east";Eniro.ObliqueCopyright=OpenLayers.Class(Eniro.Control,{timer:null,timeout:3000,element:null,initialize:function(b,a){Eniro.Control.prototype.initialize.apply(this,arguments);this.register(Eniro.Events.OBLIQUE_COPYRIGHT,this.onMapTypesUpdate)},destroy:function(){this.unregister(Eniro.Events.OBLIQUE_COPYRIGHT,this.onMapTypesUpdate);Eniro.Control.prototype.destroy.apply(this,arguments)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.element=document.createElement("div");this.div.appendChild(this.element);jQuery(this.div).addClass("eniro-oblique-copyright")}return this.div},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.map=a},onMapTypesUpdate:function(a){if(a.maptypes&&a.maptypes.oblique&&a.maptypes.oblique[0].text!==this.type){this.type=a.maptypes.oblique[0].text;this.obliqueCopyright(this.type)}else{this.type="";jQuery(this.div).hide()}},obliqueCopyright:function(a){this.div.innerHTML="";if(a==="BLOM"){var b=Eniro.Util.getImagesLocation()+"oblique-blom-logotype.jpg?v="+Eniro.Config["media.version"];this.div.innerHTML='<img src="'+b+'" alt="Blom" />'}else{this.div.innerHTML=OpenLayers.i18n("oblique-copyright.cowi")}jQuery(this.div).show()},CLASS_NAME:"Eniro.ObliqueCopyright"});Eniro.Map=OpenLayers.Class(OpenLayers.Map,{MODES_CONSIDERED_PAGES:["oblique","streetview"],resizeTimeout:null,stateController:null,containerDiv:null,offsetControls:{},_enableMapMoves:true,_displayLayersVisibleFromStart:true,initialize:function(c,u){this.stateController=new Eniro.StateController();this.stateController.register(Eniro.Map.STATE_KEY,0,this);this.containerDiv=OpenLayers.Util.getElement(c);var q=jQuery('<div class="eniro-ol-viewport"></div>')[0];this.containerDiv.appendChild(q);this.profileClassName=((Eniro.Profile&&Eniro.Profile.id)?(Eniro.Profile.id.replace(/\,|\.|[^a-z0-9]/gi,"-")):"");jQuery(this.containerDiv).addClass("eniro");if(this.profileClassName){jQuery(this.containerDiv).addClass("eniro-"+this.profileClassName)}this.updateMapViewPortSize();var b={controls:[],theme:null,maxResolution:156543.03390625,minZoomLevel:0,numZoomLevels:21,maxZoomLevel:20,maxViapoints:6,projection:new OpenLayers.Projection("EPSG:900913"),backendProjection:new OpenLayers.Projection("EPSG:4326"),maxExtent:new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),panDuration:15};var t="tile.version";var o=Eniro.Config[t];OpenLayers.Util.extend(b,u);OpenLayers.Map.prototype.initialize.apply(this,[q,b]);this.events.addEventType("prechangebaselayer");var k=(Eniro.Profile&&Eniro.Profile.layers)?Eniro.Profile.layers:["LAYER_MAP"];var r={layerClassName:"TMS",buffer:0,type:"png",visibility:false,visibleFromStart:false,isBaseLayer:true,forceBaseLayer:null,minZoomLevel:4,maxZoomLevel:17,alpha:false,opacity:null,alwaysActive:false,displayInLayerSwitcher:true};var s={};s[Eniro.Map.LAYER_MAP]={visibleFromStart:true,alwaysActive:true};s[Eniro.Map.LAYER_AERIAL]={type:"jpeg"};s[Eniro.Map.LAYER_HYBRID]={isBaseLayer:false,forceBaseLayer:"LAYER_AERIAL",alpha:true};s[Eniro.Map.LAYER_NAUTICAL]={};s[Eniro.Map.LAYER_OBLIQUE]={layerClassName:"Oblique",type:"jpg",url:Eniro.AppNode.tileUrl(""),minZoomLevel:0,maxZoomLevel:2,displayInLayerSwitcher:false};s[Eniro.Map.LAYER_STREETVIEW]={isBaseLayer:false,alpha:true,displayInLayerSwitcher:false};s[Eniro.Map.LAYER_HEMNET]={layerClassName:"Hemnet",isBaseLayer:false,displayInLayerSwitcher:false};s[Eniro.Map.LAYER_YELLOWSPLATTER]={layerClassName:"YellowSplatter",isBaseLayer:false,displayInLayerSwitcher:false};s[Eniro.Map.LAYER_AUTOLAYERS]={layerClassName:"AutoLayers",isBaseLayer:false,displayInLayerSwitcher:false};s[Eniro.Map.LAYER_COMPANY_ON_MAP]={layerClassName:"CompanyOnMap",url:Eniro.AppNode.tileUrl("/companyonmap/tile"),isBaseLayer:false,alpha:true,displayInLayerSwitcher:false};for(var h=0;h<k.length;h++){if(Eniro.Profile.layersOptions&&Eniro.Profile.layersOptions[k[h]]){OpenLayers.Util.extend(s[Eniro.Map[k[h]]],Eniro.Profile.layersOptions[k[h]])}if(typeof k[h]==="string"){k[h]=Eniro.Map[k[h]]}}var l,g,p,d;for(h=0,n=k.length;h<n;++h){g=k[h];p=jQuery.extend({},r,s[g]);if(typeof p.forceBaseLayer==="string"){p.forceBaseLayer=Eniro.Map[p.forceBaseLayer]}d=p.layerClassName;delete p.layerClassName;if(Eniro.Profile&&Eniro.Profile.zoomLevels&&Eniro.Profile.zoomLevels[g]){p.minZoomLevel=Eniro.Profile.zoomLevels[g].min;p.maxZoomLevel=Eniro.Profile.zoomLevels[g].max}if(!p.layername){p.layername=g}var f=Eniro.Layer[d];l=new f(g,p.url,jQuery.extend({},p),o);this.addLayer(l)}var a=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style["default"]);a.strokeWidth=4;a.strokeOpacity=0.5;a.strokeColor="blue";this.wfs=new Eniro.Layer.SearchLayer(Eniro.Map.LAYER_SEARCH,Eniro.AppNode.appUrl("/search/search.json"),{},{layername:Eniro.Map.LAYER_SEARCH,projection:new OpenLayers.Projection("EPSG:4326"),style:a,displayInLayerSwitcher:false});this.addLayer(this.wfs);this.activateLayer(this.wfs);this.searchLayer=this.wfs;this.events.register("changelayer",this,this.onChangeLayer);this.events.register("moveend",this,this.onMoveEnd);Eniro.AppEvents.register(Eniro.Events.MODE_SWITCH,this,this.onModeSwitch);Eniro.AppEvents.register(Eniro.Events.CHANGE_BASE_LAYER,this,this.doChangeBaseLayer);Eniro.AppEvents.register(Eniro.Events.SET_CENTER,this,this.doSetCenter);Eniro.AppEvents.register(Eniro.Events.ZOOM_TO_LEVEL,this,this.onZoomToLevel);Eniro.AppEvents.register(Eniro.Events.ZOOM_TO_EXTENT,this,this.onZoomToExtent)},displayLayersVisibleFromStart:function(){if(this._displayLayersVisibleFromStart){for(var a=0,b=this.layers.length;a<b;++a){if(this.layers[a].visibleFromStart){this.layers[a].setVisibility(true)}delete this.layers[a].visibleFromStart}this._displayLayersVisibleFromStart=false;this.events.unregister("changelayer",this,this.onChangeLayer)}},reset:function(){var c=Eniro.Profile.init.coordinates;c=new OpenLayers.LonLat(c.lon,c.lat);c.transform(this.backendProjection,this.getProjectionObject());this.setCenter(c,Eniro.Profile.init.zoomLevel,false,false,true);Eniro.AppEvents.triggerEvent(Eniro.Events.SEARCH_DO,{mapTypesUpdate:true,_disableHistory:true});var f=Eniro.Profile.init.mode;if(Eniro.Profile.init.locationDependentMode){for(var a=0;a<Eniro.Profile.init.locationDependentMode.length;a++){var d=Eniro.Profile.init.locationDependentMode[a];var b=new RegExp(d.condition);if(b.test(window.location+"")){f=d.mode;break}}}Eniro.AppEvents.triggerEvent(Eniro.Events.MODE_SWITCH,{mode:f})},destroy:function(){if(this.popup){this.popup.destroy();this.popup=null}if(this.resizeTimeout){clearTimeout(this.resizeTimeout)}this.delayedUpdateSizeDestroy=null;this.events.unregister("moveend",this,this.onMoveEnd);Eniro.AppEvents.unregister(Eniro.Events.CHANGE_BASE_LAYER,this,this.doChangeBaseLayer);Eniro.AppEvents.unregister(Eniro.Events.MODE_SWITCH,this,this.onModeSwitch);Eniro.AppEvents.unregister(Eniro.Events.ZOOM_TO_LEVEL,this,this.onZoomToLevel);Eniro.AppEvents.unregister(Eniro.Events.ZOOM_TO_EXTENT,this,this.onZoomToExtent);OpenLayers.Map.prototype.destroy.apply(this,arguments);if(Eniro.AppEvents){Eniro.AppEvents.destroy()}if(this.wfs){this.wfs=null}this.stateController.destroy();this.stateController=null;jQuery(this.containerDiv).removeClass("eniro");if(this.profileClassName){jQuery(this.containerDiv).removeClass("eniro-"+this.profileClassName)}if(this.containerDiv.currentMode){jQuery(this.containerDiv).removeClass("eniro-mode-"+this.containerDiv.currentMode);if(this.profileClassName){jQuery(this.containerDiv).removeClass("eniro-"+this.profileClassName+"-mode-"+this.containerDiv.currentMode)}}this.containerDiv.currentMode=null;this.containerDiv.style.height="";this.containerDiv.innerHTML=""},doSetCenter:function(a){if(a.toAdjusted){this.setAdjustedCenter(a.lonlat,a.zoomLevel,a.dragging,a.forceZoomchange,a.suspendSearchLayer)}else{this.setCenter(a.lonlat,a.zoomLevel,a.dragging,a.forceZoomchange,a.suspendSearchLayer)}},doChangeBaseLayer:function(a,b){if(typeof a=="string"){a=this.getLayerById(a)}if(!b&&this.zoom>2&&a.CLASS_NAME==="Eniro.Layer.Oblique"){this.zoom=0}this.setBaseLayer(a)},onChangeLayer:function(a){if(a.property==="visibility"){delete a.layer.visibleFromStart}},onMoveEnd:function(a){if(this.getCurrentMode()){Eniro.AppEvents.triggerEvent(Eniro.Events.STATISTICS_LOG,{scope:"navigate",event:"mapmove",data:{mapstate:this.buildStatisticsMapState()}})}},buildStatisticsMapState:function(){var a=this.getCenter();var b=this.getZoom();var c=this.getCurrentMode();if(a&&b&&c){return{lat:a.lat,lng:a.lon,zoom:b,mode:c}}else{return null}},onModeSwitch:function(c){var f=this.containerDiv;var b=false;if(!f.currentMode){b=true}else{for(var a=0,d=this.MODES_CONSIDERED_PAGES.length;a<d;++a){if(c.mode===this.MODES_CONSIDERED_PAGES[a]){b=true;break}}}if(c.mode!==f.currentMode){if(f.currentMode){jQuery(f).removeClass("eniro-mode-"+f.currentMode);if(this.profileClassName){jQuery(f).removeClass("eniro-"+this.profileClassName+"-mode-"+f.currentMode)}}jQuery(f).addClass("eniro-mode-"+c.mode);if(this.profileClassName){jQuery(f).addClass("eniro-"+this.profileClassName+"-mode-"+c.mode)}f.currentMode=c.mode}Eniro.AppEvents.triggerEvent(Eniro.Events.STATISTICS_LOG,{scope:(b?"page":"navigate"),event:c.mode,data:{mapstate:this.buildStatisticsMapState()}})},getCurrentMode:function(){return this.containerDiv?this.containerDiv.currentMode:""},isValidZoomLevel:function(c){var b=this.baseLayer.minZoomLevel;var a=this.baseLayer.maxZoomLevel;if(!(/\d+/.test(b))){b=this.minZoomLevel}if(!(/\d+/.test(a))){a=this.maxZoomLevel}return((c!==null)&&(c>=b)&&(c<=a))},moveTo:function(f,c,b){if(c){var d=this.baseLayer.minZoomLevel;var a=this.baseLayer.maxZoomLevel;if(!d||!a){d=this.minZoomLevel;a=this.maxZoomLevel}if(c<d){c=d}else{if(c>a){c=a}}}if(this._enableMapMoves){OpenLayers.Map.prototype.moveTo.apply(this,[f,c,b])}},getCurrentSize:function(){var b=jQuery(this.div),a=0;if(this.baseLayer instanceof Eniro.Layer.Oblique){a=-360}return new OpenLayers.Size(b.width()+a,b.height())},_updateSize:function(){this.updatingSize=true;OpenLayers.Map.prototype.updateSize.apply(this,arguments);this.updatingSize=false;this.updatingSizeOnResize=false},updateMapViewPortSize:function(){var a=jQuery("body").height();var c=jQuery(this.containerDiv).offset();var b=Math.round(a-c.top);jQuery(this.containerDiv).height(b)},updateSize:function(a){this.updatingSizeOnResize=false;if(this.resizeTimeout){clearTimeout(this.resizeTimeout)}if(!this.delayedUpdateSizeDestroy){this.delayedUpdateSizeDestroy=OpenLayers.Function.bind(function(){this._updateSize()},this)}if(a&&a.type==="resize"){this.updatingSizeOnResize=true;this.updateMapViewPortSize();var b;if(jQuery.browser.msie&&jQuery.browser.version<8){b=300}else{b=200}}else{if(this.updatingSize){b=0}else{b=false}}if(b===false){this._updateSize.apply(this,arguments)}else{this.resizeTimeout=setTimeout(this.delayedUpdateSizeDestroy,b)}},activateLayer:function(a){this.setLayerIndex(a,this.getNumLayers()-1)},setOffsetControls:function(c,b,a){this.offsetControls={left:c,top:b,bottom:a}},_getOffsetWidth:function(){if(!this.offsetControls.left||(this.offsetControls.left instanceof Eniro.TabNavigatorView&&!this.offsetControls.left.getOpenTab())){return 0}var a=jQuery(this.offsetControls.left.div);return a.width()+a.position().left},_getControlBarHeight:function(a){return a.area?jQuery(a.area).height():jQuery(a.div).height()},_getOffsetTop:function(){if(!this.offsetControls.top||!this.offsetControls.top instanceof OpenLayers.Control){return 0}var a=jQuery(this.offsetControls.top.div);return((this.offsetControls.top instanceof Eniro.ControlBarView)?this._getControlBarHeight(this.offsetControls.top):a.height())+a.position().top+31},_getOffsetBottom:function(){if(!this.offsetControls.bottom||!this.offsetControls.bottom instanceof OpenLayers.Control){return 0}return this.getCurrentSize().h-jQuery(this.offsetControls.bottom.div).position().top},getAdjustedCenter:function(){var b=null;var a=this.getAdjustedExtent();if(a){b=a.getCenterLonLat()}return b},getAdjustedExtent:function(){return this.adjustExtent(this.getExtent(),true)},adjustExtent:function(p,k,o){var c=null;if(p){var g=o?this.getResolutionForZoom(o):this.getResolution();var l=this._getOffsetWidth()*g;if(p.getWidth()<l){l=0}var d=this._getOffsetTop()*g;if(p.getHeight()<d){d=0}var h=this._getOffsetBottom()*g;if(p.getHeight()<h){h=0}var b=p.right,a=p.bottom;var f=k?1:-1;c=p.add(f*l,-f*d);c.right=b;c.bottom=a+(f*h)}return c},zoomToExtent:function(g,f,c){var b=g.getCenterLonLat();if(this.baseLayer.wrapDateLine){var a=this.getMaxExtent();g=g.clone();while(g.right<g.left){g.right+=a.getWidth()}b=g.getCenterLonLat().wrapDateLine(a)}var d=this.getZoomForExtent(g,f);if(c&&d>c){d=c}this.setCenter(b,d)},getAdjustedSize:function(){var a=this.getSize();return new OpenLayers.Size(a.w-this._getOffsetWidth(),a.h-this._getOffsetTop())},zoomToAdjustedExtent:function(b,d,a){a=a||{};if(d){this.wfs.setQueriesEnabled(false);this.wfs.setDestroyTransientFeaturesEnabled(false);this.wfs._disableHistory=true}var c=this.getZoomForExtent(b);this.zoomToExtent(this.adjustExtent(b,false,c),false,a.maxZoom);if(d){this.wfs.setQueriesEnabled(true);this.wfs.setDestroyTransientFeaturesEnabled(true);this.wfs._disableHistory=false}},setCenter:function(c,a,b,f,d){if(d){this.wfs.setQueriesEnabled(false);this.wfs.setDestroyTransientFeaturesEnabled(false);this.wfs._disableHistory=true}if(this._enableMapMoves){OpenLayers.Map.prototype.setCenter.apply(this,arguments)}if(d){this.wfs.setQueriesEnabled(true);this.wfs.setDestroyTransientFeaturesEnabled(true);this.wfs._disableHistory=false}},setBaseLayer:function(q){var s=null;var r=null;if(this.baseLayer){s=this.baseLayer.getExtent();r=this.getProjectionObject()}var t;var c;if(!q.isBaseLayer&&q.forceBaseLayer){if(this._displayLayersVisibleFromStart){q.setVisibility(false);q.visibleFromStart=true}else{q.setVisibility(true)}t=q;q=this.getLayerById(q.forceBaseLayer)}else{for(var k=0,f=this.layers.length;k<f;++k){if(!this.layers[k].isBaseLayer&&this.layers[k].forceBaseLayer){this.layers[k].setVisibility(false)}}}if(q!=this.baseLayer){if(OpenLayers.Util.indexOf(this.layers,q)!=-1){this.events.triggerEvent("prechangebaselayer",{currentBaseLayer:this.baseLayer,newBaseLayer:q,overlayLayer:t});if(this.baseLayer!==null){this.baseLayer.setVisibility(false);if(this._displayLayersVisibleFromStart){this.baseLayer.visibleFromStart=false}if(this.baseLayer.forcedByOverlay){this.baseLayer.forcedByOverlay=null}}this.baseLayer=q;if(t){this.baseLayer.forcedByOverlay=t}this.viewRequestID++;if(this._displayLayersVisibleFromStart){this.baseLayer.visibility=false;this.baseLayer.visibleFromStart=true}else{this.baseLayer.visibility=true}var a=this.getCenter();if(!this._displayLayersVisibleFromStart&&a!==null){var d=(s)?s.getCenterLonLat():a;var b=s.clone();var g=this.getProjectionObject();if(!r.equals(g)){d.transform(r,g);b.transform(r,g)}var o=(b)?this.getZoomForExtent(b,true):this.getZoomForResolution(this.resolution,true);this.setCenter(d,o,false,true);if(!r.equals(g)){for(var h=0,p=this.layers.length;h<p;h++){if(this.layers[h].transform&&(typeof this.layers[h].transform=="function")){this.layers[h].transform(r,g)}}}}this.events.triggerEvent("changebaselayer",{layer:this.baseLayer,overlayLayer:t})}}},setAdjustedCenter:function(d,b,c,h,g){var a=this._getOffsetWidth()*this.getResolutionForZoom(b);var f=d.add(-a/2,0);this.setCenter.apply(this,[f,b,c,h,g])},setMapType:function(a,b){this.doChangeBaseLayer(a,b)},onZoomToLevel:function(a){OpenLayers.Console.warn("Deprecated. Use Eniro.Map#zoomTo instead.");this.zoomTo(a.zoomLevel)},onZoomToExtent:function(a){if(a.toAdjusted){this.zoomToAdjustedExtent(a.extent,a.suspendSearchLayer,a.options)}else{this.zoomToExtent(a.extent)}},getRealZoomLevel:function(a){OpenLayers.Console.warn("Deprecated. Use Eniro.Map#getRealZoom instead.");return this.getRealZoom(a)},getRealZoom:function(c){var b=null;if(isNaN(c)){c=this.getZoom()}var a=this.baseLayer;if(a.minZoomLevel===undefined||a.maxZoomLevel===undefined){this.warn('Zoom levels for layer "'+a.layername+'" is not defined, falling back on map.');a=this}b=(c-1)+a.minZoomLevel;return b},saveState:function(){var a={};a.mode=this.containerDiv.currentMode;a.center=this.getCenter();a.zoom=this.getZoom();a.baseLayer=this.baseLayer.layername;a.baseLayerId=this.baseLayer.layerId;a.overlayLayer=(this.baseLayer.forcedByOverlay&&this.baseLayer.forcedByOverlay.layername)?this.baseLayer.forcedByOverlay.layername:null;a._res=Math.round(this.getResolution());var b=this.getAdjustedExtent();a._bbox=b.transform(this.baseLayer.projection,this.backendProjection);return a},applyStateBegin:function(){this._enableMapMoves=false},applyStateComplete:function(){this._enableMapMoves=true},applyState:function(c){this.wfs.setQueriesEnabled(false);this.wfs.setDestroyTransientFeaturesEnabled(false);this.wfs._disableHistory=true;if(c.mode==="search"||c.mode==="route"||c.mode==="draw"){Eniro.AppEvents.triggerEvent(Eniro.Events.MODE_SWITCH,{mode:"search"});Eniro.AppEvents.triggerEvent(Eniro.Events.MODE_SWITCH,{mode:"route"});Eniro.AppEvents.triggerEvent(Eniro.Events.MODE_SWITCH,{mode:"draw"})}var a;if(c.overlayLayer){a=this.getLayerById(c.overlayLayer)}else{a=this.getLayerById(c.baseLayerId)}this.setMapType(a||c.baseLayer,true);this.wfs.setQueriesEnabled(true);this.wfs.setDestroyTransientFeaturesEnabled(true);this.wfs._disableHistory=false;var b=new OpenLayers.LonLat(c.center.lon,c.center.lat);this._enableMapMoves=true;this.setCenter(b,c.zoom,false,false,true);this._enableMapMoves=false;Eniro.AppEvents.triggerEvent(Eniro.Events.MODE_SWITCH,{mode:c.mode})},getLayerByName:function(c){var b=null;for(var f=0,a=this.layers.length;f<a;f++){var d=this.layers[f];if(d.layername==c){b=d;break}}return b},getLayerById:function(f){var b=null;if(f){for(var d=0,a=this.layers.length;d<a;d++){var c=this.layers[d];if(c.layerId==f){b=c;break}}}return b},getVisibleLayers:function(){var c=[];for(var b=0,a=this.layers.length;b<a;b++){if(this.layers[b].visibility){c[c.length]=this.layers[b]}}return c},CLASS_NAME:"Eniro.Map"});Eniro.Map.LAYER_MAP="map";Eniro.Map.LAYER_AERIAL="aerial";Eniro.Map.LAYER_HYBRID="hybrid";Eniro.Map.LAYER_NAUTICAL="nautical";Eniro.Map.LAYER_STREETVIEW="streetview";Eniro.Map.LAYER_STREETVIEW3D="streetview3d";Eniro.Map.LAYER_OBLIQUE="oblique";Eniro.Map.LAYER_SEARCH="search";Eniro.Map.LAYER_YELLOWSPLATTER="yellowSplatter";Eniro.Map.LAYER_AUTOLAYERS="autoLayers";Eniro.Map.LAYER_HEMNET="hemnet";Eniro.Map.LAYER_COMPANY_ON_MAP="companyonmap";Eniro.Map.STATE_KEY="map";Eniro.ControlBarView=OpenLayers.Class(Eniro.Control,{ALLOWED_PLACEMENTS:["left","center","right"],leftControls:[],centerControls:[],rightControls:[],initialize:function(b,a){this.ALLOWED_PLACEMENTS=["left","center","right"];this.leftControls=[];this.centerControls=[];this.rightControls=[];Eniro.Control.prototype.initialize.apply(this,[b]);this.div=true},destroy:function(){this.area=null;this.left=null;this.center=null;this.right=null;if(this.underlayDiv){OpenLayers.Event.stopObservingElement(this.underlayDiv);this.underlayDiv=null}Eniro.Control.prototype.destroy.apply(this,arguments)},activate:function(){if(Eniro.Control.prototype.activate.apply(this,arguments)){var c=0;var d,h,a;var k=this.div.className.split(" ")[0];switch(this.placement){case"top":el=jQuery(this.div).nextAll("."+k).get(0);break;case"bottom":el=jQuery(this.div).prevAll("."+k).get(0);if(!el){el=this.div}break;default:}if(el){d=jQuery.makeArray(jQuery(el).find("*"));for(h=0,a=d.length;h<a;++h){c=jQuery(d[h]).outerHeight();if(c){break}}}if(c){if(el===this.div){jQuery(this.div).height(c)}else{jQuery(this.div).css(this.placement,c)}}if(this.underlayDiv){OpenLayers.Event.observe(this.underlayDiv,"mousedown",OpenLayers.Event.stop);OpenLayers.Event.observe(this.underlayDiv,"mouseup",OpenLayers.Event.stop)}var f;var l;for(h=0,a=this.ALLOWED_PLACEMENTS.length;h<a;++h){f=this.ALLOWED_PLACEMENTS[h];l=this[f+"Controls"];for(var g=0,b=l.length;g<b;++g){l[g].activate()}}return true}return false},setMap:function(f){Eniro.Control.prototype.setMap.apply(this,arguments);var d;for(var c=0,g=this.ALLOWED_PLACEMENTS.length;c<g;++c){d=this.ALLOWED_PLACEMENTS[c];if(this[d+"Controls"]&&this[d+"Controls"].length>0){for(var b=0,a=this[d+"Controls"].length;b<a;++b){if(!this[d+"Controls"][b].map){this.map.addControl(this[d+"Controls"][b])}}}}},addControl:function(a,b){b.div=true;if(this[a+"Controls"]){this[a+"Controls"].push(b)}if(this.map){this.map.addControl(b);if(b.div&&b.div.tagName&&b.div.parentNode!=this[a]){this[a].appendChild(b.div)}}},addLeftControl:function(a){this.addControl("left",a)},addRightControl:function(a){this.addControl("right",a)},addCenterControl:function(a){this.addControl("center",a)},draw:function(){this.area=this.createDiv(null,"area");this.div=this.createDiv(null,this.placement);if(this.underlay){this.underlayDiv=this.createDiv(null,"underlay");this.div.appendChild(this.underlayDiv)}var d;for(var c=0,f=this.ALLOWED_PLACEMENTS.length;c<f;++c){d=this.ALLOWED_PLACEMENTS[c];this[d]=this.createDiv(null,d);if(this[d+"Controls"]&&this[d+"Controls"].length>0){for(var b=0,a=this[d+"Controls"].length;b<a;++b){if(this[d+"Controls"][b].div&&this[d+"Controls"][b].div.tagName){this[d].appendChild(this[d+"Controls"][b].div)}}}this.area.appendChild(this[d])}this.div.appendChild(this.area);this.map.containerDiv.insertBefore(this.div,this.map.div);return this.div},CLASS_NAME:"Eniro.ControlBarView"});Eniro.ButtonbarView=OpenLayers.Class(Eniro.Control,{controls:[],initialize:function(){this.controls=[];Eniro.Control.prototype.initialize.apply(this,arguments)},destroy:function(){if(this.controls){for(var a=0,b=this.controls.length;a<b;++a){if(typeof this.controls[a].destroy==="function"){this.controls[a].destroy()}this.controls[a]=null}this.controls=null}Eniro.Control.prototype.destroy.apply(this,arguments)},setMap:function(b){Eniro.Control.prototype.setMap.apply(this,arguments);if(this.controls&&this.controls.length>0){for(var a=0,c=this.controls.length;a<c;++a){if(typeof this.controls[a].setMap==="function"){this.controls[a].setMap(b)}}}},registerObservers:function(){this.observe(this.div,"click",this.onClick)},onClick:function(a){var d;var c=OpenLayers.Event.element(a);c=jQuery(c).closest("li").get(0);if(c){for(var b=0,f=this.controls.length;b<f;++b){if(c===this.elements[this.controls[b].id]){d=this.controls[b]}}if(d){OpenLayers.Event.stop(a);this.activateControl(d);this.executeControl(d);return false}}return true},getControlById:function(c){for(var a=0,b=this.controls.length;a<b;++a){if(this.controls[a].id===c){return this.controls[a]}}return null},getControlByIndex:function(a){if(a>=0&&a<this.controls.length){return this.controls[a]}return null},setControls:function(a){if(a.length===1){a[0].position="first-last"}else{a[0].position="first";a[a.length-1].position="last"}this.controls=a},setButtonClassName:function(a){jQuery(this.elements[a.id]).attr("class",this.getCssClassName("button",null,a))},executeControl:function(a){},disableControl:function(a){if(!a.selected){a.disabled=true;this.setButtonClassName(a);return true}return false},enableControl:function(a){a.disabled=false;this.setButtonClassName(a);return true},activateControl:function(a){if(a&&!a.disabled){this.inactivateControls();a.selected=true;this.setButtonClassName(a)}},inactivateControls:function(){for(var a=0,c=this.controls.length;a<c;++a){var b=this.controls[a];b.selected=false;this.setButtonClassName(b)}},removeControl:function(a){OpenLayers.Util.removeItem(this.controls,a);if(this.elements[a.id]){jQuery(this.elements[a.id]).remove()}},getButtonHTML:function(a){if(!this.cssClasses[a.id]){this.cssClasses[a.id]=this.getCssClassName("button",null,a)}return['<li class="',this.cssClasses[a.id],'">','<a href="">',"<span>",a.label||this.i18n(a.id),"</span>","</a>","</li>"].join("")},renderButtons:function(){var b=[];for(var a=0,c=this.controls.length;a<c;++a){b.push(this.getButtonHTML(this.controls[a]))}return b.join("")},draw:function(){this.div=this.createDiv();jQuery(this.div).html(['<div class="',this.getCssClassName("inner"),'">','<ul class="',this.getCssClassName("buttons"),'">',this.renderButtons(),"</ul>","</div>"].join(""));return this.div},CLASS_NAME:"Eniro.ButtonbarView"});Eniro.FooterView=OpenLayers.Class(Eniro.Control,{errorReportDialog:null,errorReportLink:null,initialize:function(){Eniro.Control.prototype.initialize.apply(this,arguments);this.register(Eniro.Events.MAP_TYPES_UPDATE,this.onMapTypesUpdate);this.div=true},destroy:function(){this.unregister(Eniro.Events.MAP_TYPES_UPDATE,this.onMapTypesUpdate);Eniro.Control.prototype.destroy.apply(this,arguments)},onMapTypesUpdate:function(a){if(this.elements.copyright&&a&&a.maptypes){var b=this.formatText(a.maptypes,this.map.getVisibleLayers());jQuery(this.elements.copyright).html("© "+b.replace(/©\s*/,""))}},formatText:function(a,p){var h="";for(var g=0,o=p.length;g<o;g++){var d=p[g];if(a[d.layername]){var k=a[d.layername];for(var f=0,b=k.length;f<b;f++){var c=k[f].text;if(c){if(c.length){h+=c.concat(". ")}else{h+=c+". "}}}}}return h},draw:function(){this.div=this.createDiv();this.cssClasses.copyright=this.getCssClassName("copyright");this.cssClasses.reportError=this.getCssClassName("report-error");var f=[];if(Eniro.Profile.id!="no"){var c,h,a,l,k;var g=["report-error","tips","publisher"];for(var d=0,b=g.length;d<b;++d){c="";k=g[d]+"-title-"+Eniro.Profile.id;h=OpenLayers.String.trim(this.i18n(k));if(!h.match(k)){c="<span>"+h+"</span>";k=g[d]+"-url-"+Eniro.Profile.id;a=OpenLayers.String.trim(this.i18n(k));if(!a.match(k)){l=(this.cssClasses[g[d]])?this.cssClasses[g[d]]:this.getCssClassName(g[d]);c='<a href="'+a+'" class="'+l+'">'+h+"</a> "}}if(c){f.push(c)}}}else{f=['<a href="',this.i18n("copy-url"),'" rel="nofollow">&copy;</a> ','<a href="',this.i18n("company-url"),'">',this.i18n("company-title"),"</a> ",this.i18n("publisher-title"),' | <a href="',this.i18n("contact-url"),'" rel="nofollow">',this.i18n("contact-title"),"</a> - ",this.i18n("phone"),' | <a onclick="window.open(this.href,\'pop\',\'width=460,height=450\')" target="pop" href="',this.i18n("rights-url"),'" rel="nofollow">',this.i18n("rights-title"),"</a>",' | <a href="',this.i18n("tips-url"),'">',this.i18n("tips-title"),"</a>"]}f.push('<span class="'+this.cssClasses.copyright+'"></span>');jQuery(this.div).html(f.join(""));return OpenLayers.Control.prototype.draw.apply(this,arguments)},assignElements:function(){Eniro.Control.prototype.assignElements.apply(this,arguments);if(this.elements.reportError){this.observe(this.elements.reportError,"click",this.openErrorReport)}},openErrorReport:function(a){OpenLayers.Event.stop(a);if(!this.errorReportDialog){this.errorReportDialog=new Eniro.SendErrorReportDialog(OpenLayers.Function.bind(this.errorReportCloseCallback,this));if(!this.errorReportDialog.drawn){this.errorReportDialog.parentId=this.id;var b=this.errorReportDialog.draw();if(b!==null){jQuery(this.map.div).append(b);this.errorReportDialog.adjustToFit()}this.errorReportDialog.drawn=true;this.errorReportDialog.activate();this.errorReportDialog.setMap(this.map)}}},errorReportCloseCallback:function(){delete this.errorReportDialog},CLASS_NAME:"Eniro.FooterView"});Eniro.ZoomBarView=OpenLayers.Class(Eniro.ButtonbarView,{initialize:function(){Eniro.ButtonbarView.prototype.initialize.apply(this,arguments)},destroy:function(){this.map.events.un({zoomend:this.onZoomEnd,changebaselayer:this.onChangeBaseLayer,scope:this});Eniro.ButtonbarView.prototype.destroy.apply(this,arguments)},setMap:function(a){Eniro.ButtonbarView.prototype.setMap.apply(this,arguments);this.map.events.on({zoomend:this.onZoomEnd,changebaselayer:this.onChangeBaseLayer,scope:this});var b=this.drawZoomLevels();this.setControls(b)},onChangeBaseLayer:function(a){this.entries=[];var c=this.drawZoomLevels();this.setControls(c);var b=jQuery(this.div).find("ul");if(b.get(0)){b.get(0).innerHTML=this.renderButtons()}this.assignElements();this.onZoomEnd()},drawZoomLevels:function(){var c=[];var f=this.map.getRealZoom();var a=this.map.baseLayer;if(a.minZoomLevel===undefined||a.maxZoomLevel===undefined){this.warn('Zoom levels for layer "'+a.layername+'" is not defined, falling back on map.');a=this.map}this.zoomFrom=a.minZoomLevel;this.zoomTo=a.maxZoomLevel;for(var b=this.zoomFrom,d=this.zoomTo;b<=d;++b){c.push({label:(b+1)-this.zoomFrom,id:"zoomlevel-"+b,zoomLevel:b,selected:(b==f)})}return c},onClick:function(a){if(Eniro.ButtonbarView.prototype.onClick.apply(this,arguments)){var c=OpenLayers.Event.element(a);var b=jQuery(c).closest("button").get(0);if(b){var f=this.map.getZoom();var d;if(this.elements.zoomIn===b&&(f+1)<=this.zoomTo){d=this.getControlById("zoomlevel-"+(f+1))}else{if(this.elements.zoomOut===b&&(f-1)>=this.zoomFrom){d=this.getControlById("zoomlevel-"+(f-1))}}if(d){this.activateControl(d);this.executeControl(d)}return false}}return true},onZoomEnd:function(a){var b=this.getControlById("zoomlevel-"+this.map.getZoom());if(b){this.inactivateControls();b.selected=true;this.setButtonClassName(b)}},executeControl:function(a){this.map.zoomTo(a.zoomLevel)},draw:function(){Eniro.ButtonbarView.prototype.draw.apply(this,arguments);this.cssClasses.zoomIn=this.getCssClassName("zoom-in");this.cssClasses.zoomOut=this.getCssClassName("zoom-out");jQuery(this.div).prepend(['<button class="eniro-button ',this.cssClasses.zoomOut,'" type="submit">','<span class="eniro-screen-reader">',this.i18n("zoom-out"),"</span>","</button>"].join(""));jQuery(this.div).append(['<button class="eniro-button ',this.cssClasses.zoomIn,'" type="submit">','<span class="eniro-screen-reader">',this.i18n("zoom-in"),"</span>","</button>"].join(""));return this.div},CLASS_NAME:"Eniro.ZoomBarView",SUPER:"Eniro.ButtonbarView"});Eniro.StatisticsController=OpenLayers.Class(Eniro.Control,{handlers:[],initialize:function(){Eniro.Control.prototype.initialize.apply(this,arguments);this.handlers=[];if(this.nocrud||window.location.toString().indexOf("nocrud")>0){this.nocrud=true}if(!this.nocrud&&Eniro.Profile&&Eniro.Profile.statistics){this.setupHandlers(Eniro.Profile.statistics);Eniro.AppEvents.register(Eniro.Events.STATISTICS_LOG,this,this.onStatisticsLog)}},destroy:function(){Eniro.AppEvents.unregister(Eniro.Events.STATISTICS_LOG,this,this.onStatisticsLog)},setupHandlers:function(a){if(typeof a!="object"||!a.length){OpenLayers.Console.error("statistics is not an array of handler definitions");return}var c=0;for(c=0;c<a.length;c++){var b=a[c];if(!b.type){OpenLayers.Console.error("statistics array["+c+"] missing type");continue}if(!b.events){OpenLayers.Console.error("statistics array["+c+"] missing events");continue}var f=Eniro.StatisticsController.handlerMap[b.type];var d=new f(b);this.handlers[this.handlers.length]=d}},onStatisticsLog:function(a){var b=this;setTimeout(function(){for(var c=0,d=b.handlers.length;c<d;++c){b.handlers[c].log(a.scope,a.event,a.data)}},300)},draw:function(){return null},CLASS_NAME:"Eniro.StatisticsController"});Eniro.StatisticsController.handlerMap={};Eniro.StatisticsHandler=OpenLayers.Class({DEFAULT_EVENT:"_default",queue:[],iframeQueue:[],initialize:function(a){if(typeof a=="object"){jQuery.extend(this,a)}this.queue=[];this.iframeQueue=[];this.destroyOnload=OpenLayers.Function.bind(this.processIframeQueue,this);OpenLayers.Event.observe(window,"load",this.destroyOnload)},destroy:function(){OpenLayers.Event.stopObserving(window,"load",this.destroyOnload);this.destroyOnload=null},initReady:function(){if(this.queue){for(var b=0;b<this.queue.length;b++){var a=this.queue[b];this.doLog.apply(this,a)}this.queue=null}},loadScript:function(b,c){var a={url:b,dataType:"script",cache:false,async:true};if(c){a.success=c}jQuery.ajax(a)},success:function(){this.iframe.contentWindow.document.close();this.callback()},failure:function(){this.success()},processIframeQueue:function(){for(var a=0,b=this.iframeQueue.length;a<b;++a){this._iframeLoadScript(this.iframeQueue[a].url,this.iframeQueue[a].callback)}},iframeLoadScript:function(a,b){this.iframeQueue.push({url:a,callback:b})},_iframeLoadScript:function(b,g){this.callback=g;var a=[];this.iframe=jQuery('<iframe scrolling="no" frameborder="no"></iframe>').get(0);jQuery("body").append(this.iframe);var f=this.iframe.contentWindow||this.iframe.contentDocument;var d=f;if(f.document){d=f.document}Eniro.StatisticsHandler.success=OpenLayers.Function.bind(this.success,this);Eniro.StatisticsHandler.failure=OpenLayers.Function.bind(this.failure,this);var c=['<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',"<html>","<head>",'<meta http-equiv="Content-Type" content="text/html; charset=utf-8">',"<title>Eniro ADForm loader</title>",'<script type="text/javascript" id="wcm1">',"var loadedScripts = 0;","function sload() {","loadedScripts++;",'var scripts = document.getElementsByTagName("script");',"var srcScripts = 0;","for (var i=0,n=scripts.length;i<n;++i) {","if (scripts[i].src) {","srcScripts++;","}","}","window.top.OpenLayers.Console.log(srcScripts, loadedScripts);","if (srcScripts === loadedScripts) {","setTimeout(loaded, 0);","}","};","function loaded() {","var i, n;",'var scripts = document.getElementsByTagName("script");',"for (n=scripts.length-1;n>=0;--n) {",'if (scripts[n].id != "wcm2" && scripts[n].parentNode === document.body) {',"scripts[n].parentNode.removeChild(scripts[n]);","}","}","var children = document.body.childNodes;","var child;","window.parent.OpenLayers.Console.debug(children);","var isOnlyComment = true;",'var commentText = "";',"for (i = 0,n=children.length;i<n;++i) {","child = children[i];",'if (child.id != "wcm1" && child.id != "wcm2" && child.nodeType != 8 && child.nodeType != 3) {',"isOnlyComment = false","}","else {","commentText += child.nodeValue;","}","}","if (isOnlyComment) {","window.parent.Eniro.StatisticsHandler.failure({","text: commentText","});","}","else {","window.parent.Eniro.StatisticsHandler.success();","}","};","function scriptLoad() {",'var scripts = document.getElementsByTagName("script");',"var script;","for (var i=0,n=scripts.length;i<n;++i) {","script = scripts[i];",'if (!script.src || script.id === "wcm1" || script.id === "wcm2") { continue; }','if ("\\v"=="v") {',"if (!script.isLoaded && !script.onreadystatechange) {","script.onreadystatechange = function () {",'window.parent.OpenLayers.Console.log(this.outerHTML + "\\n" + this.readyState);','if (this.readyState == "loaded" || this.readyState == "complete") {',"if (!this.isLoaded) {","this.isLoaded = true;","sload();","}","}","};","}","}","else {","if (!script.onload) {","script.onload = function() {","window.parent.OpenLayers.Console.log(this.src);","sload();","}","}","}","}","};","var w = document.write;","document.write = function() {","var args = Array.prototype.slice.call(arguments);",'if ("\\v"=="v") {','w(args.join(","));',"}","else {",'w.call(document, args.join(","));',"}","scriptLoad();","};","<\/script>",'<script type="text/javascript" src="'+b+'"><\/script>',"</head>","<body>",'<script type="text/javascript" id="wcm2">',"scriptLoad();","<\/script>","</body>","</html>"];c=c.join("\n");d.write(c)},loadImage:function(b){var a=jQuery('<img alt="" />').get(0);var c=function(d){OpenLayers.Event.stopObservingElement(this);jQuery(this).remove()};OpenLayers.Event.observe(a,"load",c);OpenLayers.Event.observe(a,"error",c);jQuery("body").append(a);a.src=b},log:function(b,c,d){var a=this.events[b];var f;if(!a){f=this.events[this.DEFAULT_EVENT]}else{if(c){f=a[c];if(!f){f=a[this.DEFAULT_EVENT]}}}if(f){if(this.queue){this.queue[this.queue.length]=[b,c,f,d]}else{this.doLog(b,c,f,d)}}},doLog:function(a,b,d,c){OpenLayers.Console.error("doLog() not overridden in: "+this.CLASS_NAME)},CLASS_NAME:"Eniro.StatisticsHandler"});Eniro.AddaxHandler=OpenLayers.Class(Eniro.StatisticsHandler,{initialize:function(){Eniro.StatisticsHandler.prototype.initialize.apply(this,arguments);this.initReady()},destroy:function(){Eniro.StatisticsHandler.prototype.destroy.apply(this,arguments)},doLog:function(a,b,d,c){if(a==="content"&&d==="search"){this.startAddax(c);this.logGenericAddax(c)}else{if(a==="contentItem"&&d==="search"){this.logAddax(c)}else{if(a==="navigate"){this.logAddax(c,d)}}}},addaxParams:{search_id:0,vhost:"kartor.eniro.se"},startAddax:function(a){if(a.result.firstSearch){this.addaxParams={}}if(!this.addaxParams.search_id){this.addaxParams.search_id=Math.floor(Math.random()*10000000001)}this.addaxParams.vhost=this.getHostname(a.provider);if(a.result&&a.result.search&&a.result.search.q){this.addaxParams.search_word=a.result.search.q}},logGenericAddax:function(c){var b;if(c&&c.result&&c.result.json&&c.result.json.search&&c.result.json.search[c.provider]&&c.result.json.search[c.provider].geoJSONResult&&c.result.json.search[c.provider].geoJSONResult.features&&c.result.json.search[c.provider].geoJSONResult.features[0]&&c.result.json.search[c.provider].geoJSONResult.features[0].properties&&c.result.json.search[c.provider].geoJSONResult.features[0].properties["e:statistics"]){b=c.result.json.search[c.provider].geoJSONResult.features[0].properties["e:statistics"]["@src"]||c.result.json.search[c.provider].geoJSONResult.features[0].properties["e:statistics"]["e:img"]["@src"]}if(b){var a={generic:1,customer_id:"",hits:c.result.json.search[c.provider].hits};if(c.result.search.where){a.geo_area=c.result.search.where}c.addaxUrl=b;this.logAddax(c,null,a)}},logAddax:function(d,a,c){c=c||{};if(a){c.page_type=a}else{if(this.isPredefined(d.provider)){if(c.generic&&c.generic===1){c.page_type="scnc"}else{c.page_type="scne"}}else{c.page_type="yp"}}if(d.addaxUrl&&d.addaxUrl.indexOf("area_code")>0&&(!c.generic||c.generic===0)){c.geo_area=d.addaxUrl.replace(/.*area_code=([^&]*).*/,"$1")}c.random=Math.floor(Math.random()*100001);var b=this.mergeUrlParams(d.addaxUrl,this.addaxParams);b=this.mergeUrlParams(b,c);this.loadImage(b)},isPredefined:function(a){return a.indexOf("_ptr_")>0},getHostname:function(b){var a="";if(b==="yp_se"||b==="yp_ptr_se"){a="kartor.eniro.se"}else{if(b==="yp_fi"||b==="yp_ptr_fi"){a="kartat.eniro.fi"}else{if(b==="yp_dk"||b==="yp_ptr_dk"){a="kort.eniro.dk"}else{if(b==="yp_dk_krak"||b==="yp_ptr_dk_krak"){a="map.krak.dk"}else{a=""}}}}return a},mergeUrlParams:function(b,d){for(var a in d){if(b.indexOf(a)>0){var c=new RegExp(a+"=[^&]*");b=b.replace(c,a+"="+d[a])}else{b+="&"+a+"="+d[a]}}return b},CLASS_NAME:"Eniro.AddaxHandler"});Eniro.StatisticsController.handlerMap.addax=Eniro.AddaxHandler;Eniro.ImgHandler=OpenLayers.Class(Eniro.StatisticsHandler,{initialize:function(){Eniro.StatisticsHandler.prototype.initialize.apply(this,arguments);this.initReady()},destroy:function(){Eniro.StatisticsHandler.prototype.destroy.apply(this,arguments)},doLog:function(a,b,d,c){this.loadImage(d)},CLASS_NAME:"Eniro.ImgHandler"});Eniro.StatisticsController.handlerMap.img=Eniro.ImgHandler;Eniro.NielsenHandler=OpenLayers.Class(Eniro.StatisticsHandler,{trac:{},initialize:function(){Eniro.StatisticsHandler.prototype.initialize.apply(this,arguments);var a=this;this.loadScript(this.script,function(){var b={cid:a.cid,content:a.start,server:a.server,page_url:window.location};a.trac=nol_t(b);a.initReady()})},destroy:function(){Eniro.StatisticsHandler.prototype.destroy.apply(this,arguments)},doLog:function(a,c,f,d){if(a==="init"){if(c==="startup"){this.trac.pageEvent(c,d.partner)}}else{if(a==="page"){this.trac.pageEvent(c,f)}else{if(a==="content"){var b=this.formatContent(d,c);this.trac.sectionEvent(b,f)}else{if(a==="print"){this.trac.downloadEvent(c,f)}else{if(a==="navigate"){this.trac.sectionEvent(b,f)}}}}}},formatContent:function(b,a){if(b&&b.result){b=b.result.search}if(b&&b.q){var d=[];d.push(b.q);if(b.where){d.push(b.where)}return d.join(":")}else{return a}},CLASS_NAME:"Eniro.NielsenHandler"});Eniro.StatisticsController.handlerMap.nielsen=Eniro.NielsenHandler;Eniro.TnsGallupGetTmqsHandler=OpenLayers.Class(Eniro.StatisticsHandler,{initialize:function(){Eniro.StatisticsHandler.prototype.initialize.apply(this,arguments);var a=this;this.loadScript(this.script,function(){a.initReady()})},destroy:function(){Eniro.StatisticsHandler.prototype.destroy.apply(this,arguments)},doLog:function(a,b,f,d){var c=f;setTimeout(function(){if(typeof getTMqs==="function"){getTMqs.apply(window,c)}},0)},CLASS_NAME:"Eniro.TnsGallupGetTmqsHandler"});Eniro.StatisticsController.handlerMap["tnsgallup-gettmqs"]=Eniro.TnsGallupGetTmqsHandler;Eniro.TnsGallupSpringHandler=OpenLayers.Class(Eniro.StatisticsHandler,{initialize:function(){Eniro.StatisticsHandler.prototype.initialize.apply(this,arguments);this.iframe=jQuery('<iframe scrolling="no" frameborder="no"></iframe>').get(0);jQuery("body").append(this.iframe);var c=this.iframe.contentWindow||this.iframe.contentDocument;var b=c;if(c.document){b=c.document}Eniro.TnsGallupSpringHandler.success=OpenLayers.Function.bind(this.initReady,this);var a=['<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',"<html>","<head>",'<meta http-equiv="Content-Type" content="text/html; charset=utf-8">',"<title>iFrame Loader</title>",'<script type="text/javascript" src="'+this.script+'"><\/script>','<script type="text/javascript">',"window.parent.Eniro.TnsGallupSpringHandler.success();","<\/script>","</head>","</html>"].join("");b.write(a)},destroy:function(){Eniro.StatisticsHandler.prototype.destroy.apply(this,arguments)},doLog:function(b,c,f,d){if(this.iframe.contentWindow.spring){var a={s:"eniro",cp:"Eniro/GuleSider/kart",url:document.location.href};this.iframe.contentWindow.spring.c(a)}},CLASS_NAME:"Eniro.TnsGallupSpringHandler"});Eniro.StatisticsController.handlerMap["tnsgallup-spring"]=Eniro.TnsGallupSpringHandler;Eniro.XGemiusHandler=OpenLayers.Class(Eniro.StatisticsHandler,{initialize:function(){Eniro.StatisticsHandler.prototype.initialize.apply(this,arguments);this.initReady()},destroy:function(){Eniro.StatisticsHandler.prototype.destroy.apply(this,arguments)},doLog:function(a,b,d,c){if(window.pp_gemius_hit&&typeof window.pp_gemius_hit==="function"){window.pp_gemius_hit(d)}else{window.pp_gemius_identifier=d;this.loadScript(this.script)}},CLASS_NAME:"Eniro.XGemiusHandler"});Eniro.StatisticsController.handlerMap.xgemius=Eniro.XGemiusHandler;Eniro.DefgoHandler=OpenLayers.Class(Eniro.StatisticsHandler,{firstRun:true,initialize:function(){Eniro.StatisticsHandler.prototype.initialize.apply(this,arguments);this.destroyInit=OpenLayers.Function.bind(this.initReady,this);OpenLayers.Event.observe(window,"load",this.destroyInit)},destroy:function(){OpenLayers.Event.stopObserving(window,"load",this.destroyInit);this.destroyInit=null;Eniro.StatisticsHandler.prototype.destroy.apply(this,arguments)},doLog:function(c,d,k,f){if(this.firstRun){this.firstRun=false;jQuery("body").append('<div style="display:none" id="defgonetmessage" class="defgoDivTag"></div>');jQuery("body").append('<div id="survey" style="z-index: 1000000"></div>');var b=jQuery('<iframe scrolling="no" frameborder="no" width="1"></iframe>').get(0);jQuery("#survey").append(b);var h=b.contentWindow||b.contentDocument;var g=h;if(h.document){g=h.document}var a=['<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',"<html>","<head>",'<meta http-equiv="Content-Type" content="text/html; charset=utf-8">',"<title>Defgo loader</title>",'<script type="text/javascript">',"var surveyOk=false;","var loaded=false;","<\/script>",'<script type="text/javascript" src="http://www.defgo.net/surveys/popup.asp?p='+k.p+"&t="+k.t+'" charset="UTF-8"><\/script>',"</head>",'<body onload="if (loaded) { PopUpWindow();}">','<img border="0" src="http://app01.defgosoftware.net/defgo/blank.gif" width="1" height="1" onload="surveyOk=true;">',"</body>","</html>"];a=a.join("\n");g.write(a);g.close()}},CLASS_NAME:"Eniro.DefgoHandler"});Eniro.StatisticsController.handlerMap.defgo=Eniro.DefgoHandler;Eniro.AdformHandler=OpenLayers.Class(Eniro.StatisticsHandler,{leads:[{trackpoint:[21552,76298],keywords:[2771705261,1152739986]},{trackpoint:[21552,76299],keywords:[2004639404,366852632],req:1},{trackpoint:[21552,76299],keywords:[2034281545,3288916321]},{trackpoint:[21552,76301],keywords:[313399036,3943409526]},{trackpoint:[21552,76302],keywords:[2478770364]},{trackpoint:[21552,76303],keywords:[3173463766]},{trackpoint:[21552,76303],keywords:[2906321920,4136544786]},{trackpoint:[21552,76303],keywords:[3441181474,16083495]},{trackpoint:[21552,76304],keywords:[3611011544,1289429810]},{trackpoint:[21552,76305],keywords:[2355711670]},{trackpoint:[21552,76305],keywords:[498629140,2366072709,2226203566,2322626082]}],regexp:new RegExp("[,\\s-]+"),initialize:function(){Eniro.StatisticsHandler.prototype.initialize.apply(this,arguments);this.iframeLoadScript(this.script,OpenLayers.Function.bind(function(){this.initReady()},this))},doLog:function(c,d,g,f){var b;if(d==="coords"){b=f.where}else{b=f.result.search.where}if(b){var a=this.match(b);if(a){this.iframe.contentWindow.ADFtrack.apply(window,a.trackpoint)}}},calcHits:function(f,d){var k=[];for(var g=0;g<f.length;g++){var h=f[g];if(this.inArray(h,d)&&!this.inArray(h,k)){k.push(h)}}return k},inArray:function(b,c){for(var a=0;a<c.length;a++){if(b===c[a]){return true}}return false},fixCRC:function(a){var c=[];a=a.split(this.regexp);for(var b=0;b<a.length;b++){c[b]=Eniro.Crypto.crc32(a[b].toLowerCase())}return c},match:function(c){c=this.fixCRC(c);var g=this.leads;for(var d=0;d<g.length;d++){var b=g[d];var a=this.calcHits(c,b.keywords).length;var f=b.req||b.keywords.length;if(a>=f){return b}}return null},CLASS_NAME:"Eniro.AdformHandler"});Eniro.StatisticsController.handlerMap.adform=Eniro.AdformHandler;Eniro.AdformHandler2=OpenLayers.Class(Eniro.StatisticsHandler,{initialize:function(){Eniro.StatisticsHandler.prototype.initialize.apply(this,arguments);this.iframeLoadScript(this.script,OpenLayers.Function.bind(function(){this.initReady()},this))},doLog:function(a,b,d,c){this.iframe.contentWindow.ADFtrack.apply(window,d)},CLASS_NAME:"Eniro.AdformHandler2"});Eniro.StatisticsController.handlerMap.adform2=Eniro.AdformHandler2;Eniro.UserReportHandler=OpenLayers.Class(Eniro.StatisticsHandler,{firstRun:true,initialize:function(){Eniro.StatisticsHandler.prototype.initialize.apply(this,arguments);this.loadScript(this.script,OpenLayers.Function.bind(this.initReady,this))},doLog:function(a,c,f,d){if(this.firstRun){if(a==="page"&&(c==="search"||c==="route")){this.firstRun=false;if(f[c]){try{_bvt.initSite(f[c])}catch(b){}}}}},CLASS_NAME:"Eniro.UserReportHandler"});Eniro.StatisticsController.handlerMap.userreport=Eniro.UserReportHandler;Eniro.MapStatsLibJs=OpenLayers.Class({MAX_EVENT_TIMEOUT:10000,source:null,baseUrl:null,queue:null,timer:null,initialize:function(b,a){if(!b){throw"source must be set"}if(!a){throw"baseUrl must be set"}this.source=b;this.baseUrl=a},logEvent:function(g,d){if(g===null){throw"statistics event is required"}var c=[g,this.source,d.profile,null,d.partnerId,d.arg0,d.arg1,d.arg2,d.arg3,d.arg4,d.startTime,d.stopTime,(d.count?d.count:"1")];for(var f=0,b=c.length;f<b;f++){var a=c[f];if(a===null||a===undefined){a=""}else{a=(a+"").replace(":","|");a=encodeURIComponent(a)}c[f]=a}this.checkAndAdd(c.join(":"))},checkAndAdd:function(a){if(this.queue!==null){if(this.queue.length+a.length>2000){dispatchEvent()}else{this.queue+="&e="+a}}if(this.queue===null){this.queue=this.baseUrl+"?e="+a}var b=this;if(this.timer===null){this.timer=setTimeout(function(){b.dispatchEvent()},this.MAX_EVENT_TIMEOUT)}},dispatchEvent:function(){if(this.timer!==null){clearTimeout(this.timer);this.timer=null}if(this.queue!==null){Eniro.StatisticsHandler.prototype.loadImage(this.queue);this.queue=null}},CLASS_NAME:"Eniro.MapStatsLibJs"});Eniro.MapStatsHandler=OpenLayers.Class(Eniro.StatisticsHandler,{statsLibJs:null,partner:null,sessId:null,initialize:function(){Eniro.StatisticsHandler.prototype.initialize.apply(this,arguments);var a=Eniro.AppNode.appUrl("/stats/log");this.statsLibJs=new Eniro.MapStatsLibJs("jsmap",a);this.partner=null;this.initReady();this.sessId=(new Date()).getTime()+Math.floor(Math.random()*1000);this.enabled=Eniro.Request.Parameters.forceMapStats==="1"||(this.sessId+"").match(/42$/)?true:false},destroy:function(){Eniro.StatisticsHandler.prototype.destroy.apply(this,arguments)},doLog:function(d,f,h,g){if(!this.enabled){return}if(d==="init"&&f==="startup"){this.partner=g.partner}else{var b={profile:Eniro.Profile.id,partnerId:this.partner,arg4:this.sessId};if(g&&g.mapstate){b.arg3=g.mapstate.mode+"|"+g.mapstate.zoom+"|"+g.mapstate.lat+"|"+g.mapstate.lng}if(d==="content"&&f==="showonmap"&&g&&g.layers){b.arg0=g.layers.join(",")}else{if(d==="content"&&f==="showonmappopup"&&g&&g.features){b.arg0=g.features.join(",")}else{if(d==="content"&&g&&g.provider){if(g.result&&g.result.search&&g.result.json){var c=g.result.search;var a=g.result.json;b.arg0="";if(g.result.firstSearch){b.arg0+="1"}b.arg0+="|";if(c.q){b.arg0+=c.q}b.arg0+="|";if(c.where){b.arg0+=c.where}b.arg1=g.provider;if(a.search&&a.search[g.provider]){b.arg2=a.search[g.provider].totalHits}}}}}this.statsLibJs.logEvent(d+"_"+f,b)}},CLASS_NAME:"Eniro.MapStatsHandler"});Eniro.StatisticsController.handlerMap.mapstats=Eniro.MapStatsHandler;Eniro.LayerBarView=OpenLayers.Class(Eniro.ButtonbarView,{customControls:[],initialize:function(){this.customControls=[];Eniro.ButtonbarView.prototype.initialize.apply(this,arguments);this.register(Eniro.Events.MAP_TYPES_UPDATE,this.onMapTypesUpdate)},destroy:function(){this.unregister(Eniro.Events.MAP_TYPES_UPDATE,this.onMapTypesUpdate);var a,b;for(a=0,b=this.controls.length;a<b;++a){this.controls[a].layer=null}for(a=0,b=this.customControls.length;a<b;++a){this.customControls[a].layerBarButton=null;this.customControls[a]=null}this.customControls=null;Eniro.ButtonbarView.prototype.destroy.apply(this,arguments)},activate:function(){if(Eniro.ButtonbarView.prototype.activate.apply(this,arguments)){for(var a=0,b=this.customControls.length;a<b;++a){if(!this.customControls[a].active){this.activateCustomControl(this.customControls[a])}}return true}return false},onChangeBaseLayer:function(a){for(var c=0,d=this.controls.length;c<d;++c){var b=a.overlayLayer?a.overlayLayer:a.layer;if(this.controls[c].layer===b){this.activateControl(this.controls[c]);break}}},setMap:function(f){Eniro.ButtonbarView.prototype.setMap.apply(this,arguments);var b,g;var d=[];var c=null;for(b=0,g=this.map.layers.length;b<g;++b){var a=this.map.layers[b];if(a.displayInLayerSwitcher){if(c===null&&(a.isBaseLayer&&(a.visibility||a.visibleFromStart))){c=a}d.push({label:a.name,id:a.layerId||a.layername,selected:c&&a.id===c.id,layer:a,baseLayer:(a.forceBaseLayer)?this.map.getLayerById(a.forceBaseLayer):a})}}this.setControls(d);if(this.customControls&&this.customControls.length>0){for(b=0,g=this.customControls.length;b<g;++b){this.customControls[b].setMap(f)}}this.map.events.on({changebaselayer:this.onChangeBaseLayer,scope:this})},activateControl:function(a){if(a.baseLayer===this.map.baseLayer){Eniro.ButtonbarView.prototype.activateControl.apply(this,arguments)}},executeControl:function(a){if(a&&!a.disabled){this.triggerEvent(Eniro.Events.CHANGE_BASE_LAYER,a.layer)}},activateCustomControl:function(a){if(!a.div&&a.draw){a.draw()}a.layerBarButton=this.addCustomControlToDom(a);if(a.activate){a.activate()}},getCustomControlByIndex:function(a){var b=null;if(this.customControls[index]){b=this.customControls[index]}return b},getCustomControlById:function(d){var b=null;for(var a=0,c=this.customControls.length;a<c;++a){if(this.customControls[a].id===d){b=this.customControls[a];break}}return b},disableCustomControl:function(a){a.selected=false;a.disabled=true;this.setButtonClassName(a);return true},enableCustomControl:function(a){a.disabled=false;this.setButtonClassName(a);return true},addCustomControl:function(c,b){this.addDivider();if(b){this.assignElements();var a=this.getControlById(c.id);if(a){this.removeControl(a)}a=this.getCustomControlById(c.id);if(a){this.removeControl(a)}}this.customControls.push(c);if(!c.map&&this.map){c.setMap(this.map)}if(this.active){this.activateCustomControl(c)}return c},removeCustomControl:function(a){OpenLayers.Util.removeItem(this.customControls,a);if(this.elements[a.id]){jQuery(this.elements[a.id]).remove()}},addCustomControlToDom:function(b){this.addDivider();var a;if(this.elements[b.id]){a=this.elements[b.id]}else{a=jQuery(this.getButtonHTML(b)).insertAfter(this.elements.divider).get(0)}return a},addDivider:function(){if(!this.elements.divider){var a=jQuery("."+this.cssClasses.divider);if(a.size()<1){this.elements.divider=jQuery('<li class="'+this.cssClasses.divider+'"></li>').appendTo(jQuery(this.div).find("ul:eq(0)")).get(0)}else{this.elements.divider=a}}},renderButtons:function(){this.cssClasses.divider=this.getCssClassName("button divider");var b=[Eniro.ButtonbarView.prototype.renderButtons.apply(this,arguments)];if(this.customControls.length>0){b.push('<li class="',this.getCssClassName("button divider"),'"></li>')}for(var a=0,c=this.customControls.length;a<c;++a){b.push(this.getButtonHTML(this.customControls[a]))}return b.join("")},onMapTypesUpdate:function(c){if(c.maptypes){var b,d,a;for(a=0,d=this.controls.length;a<d;++a){b=this.controls[a];if(!b.layer.alwaysActive){this.disableControl(b);if(c.maptypes[b.id]){this.enableControl(b)}}}for(a=0,d=this.customControls.length;a<d;++a){b=this.customControls[a];this.disableCustomControl(b);if(c.maptypes[b.id]&&(!b.showIfAllowed||b.showIfAllowed(this.map.getZoom()))){this.enableCustomControl(b)}}}},CLASS_NAME:"Eniro.LayerBarView",SUPER:"Eniro.ButtonbarView"});
/*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
var swfobject=function(){var K="undefined",w="object",Z="Shockwave Flash",ad="ShockwaveFlash.ShockwaveFlash",v="application/x-shockwave-flash",Y="SWFObjectExprInst",E="onreadystatechange",V=window,o=document,A=navigator,aa=false,ab=[],t=[],U=[],P=[],q,X,L,I,Q=false,a=false,s,N,r=true,T=function(){var ah=typeof o.getElementById!=K&&typeof o.getElementsByTagName!=K&&typeof o.createElement!=K,ao=A.userAgent.toLowerCase(),af=A.platform.toLowerCase(),al=af?/win/.test(af):/win/.test(ao),aj=af?/mac/.test(af):/mac/.test(ao),am=/webkit/.test(ao)?parseFloat(ao.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,ae=!+"\v1",an=[0,0,0],ai=null;if(typeof A.plugins!=K&&typeof A.plugins[Z]==w){ai=A.plugins[Z].description;if(ai&&!(typeof A.mimeTypes!=K&&A.mimeTypes[v]&&!A.mimeTypes[v].enabledPlugin)){aa=true;ae=false;ai=ai.replace(/^.*\s+(\S+\s+\S+$)/,"$1");an[0]=parseInt(ai.replace(/^(.*)\..*$/,"$1"),10);an[1]=parseInt(ai.replace(/^.*\.(.*)\s.*$/,"$1"),10);an[2]=/[a-zA-Z]/.test(ai)?parseInt(ai.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof V.ActiveXObject!=K){try{var ak=new ActiveXObject(ad);if(ak){ai=ak.GetVariable("$version");if(ai){ae=true;ai=ai.split(" ")[1].split(",");an=[parseInt(ai[0],10),parseInt(ai[1],10),parseInt(ai[2],10)]}}}catch(ag){}}}return{w3:ah,pv:an,wk:am,ie:ae,win:al,mac:aj}}(),p=function(){if(!T.w3){return}if((typeof o.readyState!=K&&o.readyState=="complete")||(typeof o.readyState==K&&(o.getElementsByTagName("body")[0]||o.body))){g()}if(!Q){if(typeof o.addEventListener!=K){o.addEventListener("DOMContentLoaded",g,false)}if(T.ie&&T.win){o.attachEvent(E,function(){if(o.readyState=="complete"){o.detachEvent(E,arguments.callee);g()}});if(V==top){(function(){if(Q){return}try{o.documentElement.doScroll("left")}catch(ae){setTimeout(arguments.callee,0);return}g()})()}}if(T.wk){(function(){if(Q){return}if(!/loaded|complete/.test(o.readyState)){setTimeout(arguments.callee,0);return}g()})()}z(g)}}();function g(){if(Q){return}try{var ag=o.getElementsByTagName("body")[0].appendChild(J("span"));ag.parentNode.removeChild(ag)}catch(ah){return}Q=true;var ae=ab.length;for(var af=0;af<ae;af++){ab[af]()}}function R(ae){if(Q){ae()}else{ab[ab.length]=ae}}function z(af){if(typeof V.addEventListener!=K){V.addEventListener("load",af,false)}else{if(typeof o.addEventListener!=K){o.addEventListener("load",af,false)}else{if(typeof V.attachEvent!=K){l(V,"onload",af)}else{if(typeof V.onload=="function"){var ae=V.onload;V.onload=function(){ae();af()}}else{V.onload=af}}}}}function k(){if(aa){ac()}else{O()}}function ac(){var ae=o.getElementsByTagName("body")[0];var ah=J(w);ah.setAttribute("type",v);var ag=ae.appendChild(ah);if(ag){var af=0;(function(){if(typeof ag.GetVariable!=K){var ai=ag.GetVariable("$version");if(ai){ai=ai.split(" ")[1].split(",");T.pv=[parseInt(ai[0],10),parseInt(ai[1],10),parseInt(ai[2],10)]}}else{if(af<10){af++;setTimeout(arguments.callee,10);return}}ae.removeChild(ah);ag=null;O()})()}else{O()}}function O(){var an=t.length;if(an>0){for(var am=0;am<an;am++){var af=t[am].id;var ai=t[am].callbackFn;var ah={success:false,id:af};if(T.pv[0]>0){var al=c(af);if(al){if(M(t[am].swfVersion)&&!(T.wk&&T.wk<312)){D(af,true);if(ai){ah.success=true;ah.ref=G(af);ai(ah)}}else{if(t[am].expressInstall&&H()){var ap={};ap.data=t[am].expressInstall;ap.width=al.getAttribute("width")||"0";ap.height=al.getAttribute("height")||"0";if(al.getAttribute("class")){ap.styleclass=al.getAttribute("class")}if(al.getAttribute("align")){ap.align=al.getAttribute("align")}var ao={};var ae=al.getElementsByTagName("param");var aj=ae.length;for(var ak=0;ak<aj;ak++){if(ae[ak].getAttribute("name").toLowerCase()!="movie"){ao[ae[ak].getAttribute("name")]=ae[ak].getAttribute("value")}}W(ap,ao,af,ai)}else{u(al);if(ai){ai(ah)}}}}}else{D(af,true);if(ai){var ag=G(af);if(ag&&typeof ag.SetVariable!=K){ah.success=true;ah.ref=ag}ai(ah)}}}}}function G(ah){var ae=null;var af=c(ah);if(af&&af.nodeName=="OBJECT"){if(typeof af.SetVariable!=K){ae=af}else{var ag=af.getElementsByTagName(w)[0];if(ag){ae=ag}}}return ae}function H(){return !a&&M("6.0.65")&&(T.win||T.mac)&&!(T.wk&&T.wk<312)}function W(ah,ai,ae,ag){a=true;L=ag||null;I={success:false,id:ae};var al=c(ae);if(al){if(al.nodeName=="OBJECT"){q=h(al);X=null}else{q=al;X=ae}ah.id=Y;if(typeof ah.width==K||(!/%$/.test(ah.width)&&parseInt(ah.width,10)<310)){ah.width="310"}if(typeof ah.height==K||(!/%$/.test(ah.height)&&parseInt(ah.height,10)<137)){ah.height="137"}o.title=o.title.slice(0,47)+" - Flash Player Installation";var ak=T.ie&&T.win?"ActiveX":"PlugIn",aj="MMredirectURL="+V.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ak+"&MMdoctitle="+o.title;if(typeof ai.flashvars!=K){ai.flashvars+="&"+aj}else{ai.flashvars=aj}if(T.ie&&T.win&&al.readyState!=4){var af=J("div");ae+="SWFObjectNew";af.setAttribute("id",ae);al.parentNode.insertBefore(af,al);al.style.display="none";(function(){if(al.readyState==4){al.parentNode.removeChild(al)}else{setTimeout(arguments.callee,10)}})()}B(ah,ai,ae)}}function u(af){if(T.ie&&T.win&&af.readyState!=4){var ae=J("div");af.parentNode.insertBefore(ae,af);ae.parentNode.replaceChild(h(af),ae);af.style.display="none";(function(){if(af.readyState==4){af.parentNode.removeChild(af)}else{setTimeout(arguments.callee,10)}})()}else{af.parentNode.replaceChild(h(af),af)}}function h(ai){var ah=J("div");if(T.win&&T.ie){ah.innerHTML=ai.innerHTML}else{var af=ai.getElementsByTagName(w)[0];if(af){var aj=af.childNodes;if(aj){var ae=aj.length;for(var ag=0;ag<ae;ag++){if(!(aj[ag].nodeType==1&&aj[ag].nodeName=="PARAM")&&!(aj[ag].nodeType==8)){ah.appendChild(aj[ag].cloneNode(true))}}}}}return ah}function B(ap,an,af){var ae,ah=c(af);if(T.wk&&T.wk<312){return ae}if(ah){if(typeof ap.id==K){ap.id=af}if(T.ie&&T.win){var ao="";for(var al in ap){if(ap[al]!=Object.prototype[al]){if(al.toLowerCase()=="data"){an.movie=ap[al]}else{if(al.toLowerCase()=="styleclass"){ao+=' class="'+ap[al]+'"'}else{if(al.toLowerCase()!="classid"){ao+=" "+al+'="'+ap[al]+'"'}}}}}var am="";for(var ak in an){if(an[ak]!=Object.prototype[ak]){am+='<param name="'+ak+'" value="'+an[ak]+'" />'}}ah.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ao+">"+am+"</object>";U[U.length]=ap.id;ae=c(ap.id)}else{var ag=J(w);ag.setAttribute("type",v);for(var aj in ap){if(ap[aj]!=Object.prototype[aj]){if(aj.toLowerCase()=="styleclass"){ag.setAttribute("class",ap[aj])}else{if(aj.toLowerCase()!="classid"){ag.setAttribute(aj,ap[aj])}}}}for(var ai in an){if(an[ai]!=Object.prototype[ai]&&ai.toLowerCase()!="movie"){f(ag,ai,an[ai])}}ah.parentNode.replaceChild(ag,ah);ae=ag}}return ae}function f(ag,ae,af){var ah=J("param");ah.setAttribute("name",ae);ah.setAttribute("value",af);ag.appendChild(ah)}function F(af){var ae=c(af);if(ae&&ae.nodeName=="OBJECT"){if(T.ie&&T.win){ae.style.display="none";(function(){if(ae.readyState==4){b(af)}else{setTimeout(arguments.callee,10)}})()}else{ae.parentNode.removeChild(ae)}}}function b(ag){var af=c(ag);if(af){for(var ae in af){if(typeof af[ae]=="function"){af[ae]=null}}af.parentNode.removeChild(af)}}function c(ag){var ae=null;try{ae=o.getElementById(ag)}catch(af){}return ae}function J(ae){return o.createElement(ae)}function l(ag,ae,af){ag.attachEvent(ae,af);P[P.length]=[ag,ae,af]}function M(ag){var af=T.pv,ae=ag.split(".");ae[0]=parseInt(ae[0],10);ae[1]=parseInt(ae[1],10)||0;ae[2]=parseInt(ae[2],10)||0;return(af[0]>ae[0]||(af[0]==ae[0]&&af[1]>ae[1])||(af[0]==ae[0]&&af[1]==ae[1]&&af[2]>=ae[2]))?true:false}function C(aj,af,ak,ai){if(T.ie&&T.mac){return}var ah=o.getElementsByTagName("head")[0];if(!ah){return}var ae=(ak&&typeof ak=="string")?ak:"screen";if(ai){s=null;N=null}if(!s||N!=ae){var ag=J("style");ag.setAttribute("type","text/css");ag.setAttribute("media",ae);s=ah.appendChild(ag);if(T.ie&&T.win&&typeof o.styleSheets!=K&&o.styleSheets.length>0){s=o.styleSheets[o.styleSheets.length-1]}N=ae}if(T.ie&&T.win){if(s&&typeof s.addRule==w){s.addRule(aj,af)}}else{if(s&&typeof o.createTextNode!=K){s.appendChild(o.createTextNode(aj+" {"+af+"}"))}}}function D(ag,ae){if(!r){return}var af=ae?"visible":"hidden";if(Q&&c(ag)){c(ag).style.visibility=af}else{C("#"+ag,"visibility:"+af,null,null)}}function S(af){var ag=/[\\\"<>\.;]/;var ae=ag.exec(af)!=null;return ae&&typeof encodeURIComponent!=K?encodeURIComponent(af):af}var d=function(){if(T.ie&&T.win){window.attachEvent("onunload",function(){var aj=P.length;for(var ai=0;ai<aj;ai++){P[ai][0].detachEvent(P[ai][1],P[ai][2])}var ag=U.length;for(var ah=0;ah<ag;ah++){F(U[ah])}for(var af in T){T[af]=null}T=null;for(var ae in swfobject){swfobject[ae]=null}swfobject=null})}}();return{registerObject:function(ai,ae,ah,ag){if(T.w3&&ai&&ae){var af={};af.id=ai;af.swfVersion=ae;af.expressInstall=ah;af.callbackFn=ag;t[t.length]=af;D(ai,false)}else{if(ag){ag({success:false,id:ai})}}},getObjectById:function(ae){if(T.w3){return G(ae)}},embedSWF:function(ai,ao,al,an,af,ah,ag,ak,am,aj){var ae={success:false,id:ao};if(T.w3&&!(T.wk&&T.wk<312)&&ai&&ao&&al&&an&&af){D(ao,false);R(function(){al+="";an+="";var aq={};if(am&&typeof am===w){for(var at in am){aq[at]=am[at]}}aq.data=ai;aq.width=al;aq.height=an;var au={};if(ak&&typeof ak===w){for(var ar in ak){au[ar]=ak[ar]}}if(ag&&typeof ag===w){for(var ap in ag){if(typeof au.flashvars!=K){au.flashvars+="&"+ap+"="+ag[ap]}else{au.flashvars=ap+"="+ag[ap]}}}if(M(af)){var av=B(aq,au,ao);if(aq.id==ao){D(ao,true)}ae.success=true;ae.ref=av}else{if(ah&&H()){aq.data=ah;W(aq,au,ao,aj);return}else{D(ao,true)}}if(aj){aj(ae)}})}else{if(aj){aj(ae)}}},switchOffAutoHideShow:function(){r=false},ua:T,getFlashPlayerVersion:function(){return{major:T.pv[0],minor:T.pv[1],release:T.pv[2]}},hasFlashPlayerVersion:M,createSWF:function(ag,af,ae){if(T.w3){return B(ag,af,ae)}else{return undefined}},showExpressInstall:function(ag,ah,ae,af){if(T.w3&&H()){W(ag,ah,ae,af)}},removeSWF:function(ae){if(T.w3){F(ae)}},createCSS:function(ah,ag,af,ae){if(T.w3){C(ah,ag,af,ae)}},addDomLoadEvent:R,addLoadEvent:z,getQueryParamValue:function(ah){var ag=o.location.search||o.location.hash;if(ag){if(/\?/.test(ag)){ag=ag.split("?")[1]}if(ah==null){return S(ag)}var af=ag.split("&");for(var ae=0;ae<af.length;ae++){if(af[ae].substring(0,af[ae].indexOf("="))==ah){return S(af[ae].substring((af[ae].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var ae=c(Y);if(ae&&q){ae.parentNode.replaceChild(q,ae);if(X){D(X,true);if(T.ie&&T.win){q.style.display="block"}}if(L){L(I)}}a=false}}}}();Eniro.Emediate={initialized:false,queue:[],loading:[],loaded:[],failed:[],canceled:[],isLoading:false,source:"/a?d=encoding=utf-8;cu=${cu};cre=mu;js=y",timeoutId:null,initialize:function(){this.initialized=true;this.processQueue()},processQueue:function(){if(!this.isLoading&&this.initialized&&this.queue.length>0){this.isLoading=true;if(Eniro.debug){OpenLayers.Console.groupCollapsed("Processing ads in queue");OpenLayers.Console.dir(this.queue);OpenLayers.Console.groupEnd()}var a=this.queue.shift();this._loadAd(a)}},handleCallbacks:function(d,c){var b=["success","failure","complete"];var g;for(var a=0,f=b.length;a<f;++a){g=b[a];if(d.callbacks[g]&&c.indexOf(g)>=0){if(Eniro.debug){OpenLayers.Console.group(g.capitalize()+" callbacks")}d.callbacks[g]();if(Eniro.debug){OpenLayers.Console.groupEnd()}}}},success:function(b){var a=this.getEntryByFrame(b.frame,"loading");b.frame=null;if(!a){a=this.getEntryByFrame(b.frame);OpenLayers.Console.groupCollapsed("Success invoked for previously failed entry");OpenLayers.Console.dir(a);OpenLayers.Console.groupEnd();return}clearTimeout(this.timeoutId);if(Eniro.debug){OpenLayers.Console.groupCollapsed("%s (%d) SUCCESS",a.name,a.data.cu);OpenLayers.Console.dir(a);OpenLayers.Console.groupCollapsed("Child nodes in iframe <body>");OpenLayers.Console.dir(b.childNodes);OpenLayers.Console.groupEnd()}this.handleCallbacks(a,["success","complete"]);if(Eniro.debug){OpenLayers.Console.groupEnd()}this.changeBannerStatus(a,"loaded");this.next()},failure:function(b){var a=this.getEntryByFrame(b.frame,"loading");b.frame=null;if(!a&&Eniro.debug){a=this.getEntryByFrame(b.frame);OpenLayers.Console.groupCollapsed("Failure invoked for previously failed entry");OpenLayers.Console.dir(a);OpenLayers.Console.groupEnd();return}clearTimeout(this.timeoutId);if(Eniro.debug){OpenLayers.Console.groupCollapsed("%s (%d) FAILURE - %s",a.name,a.data.cu,OpenLayers.String.trim(b.text));OpenLayers.Console.dir(a);OpenLayers.Console.groupCollapsed("Child nodes in iframe <body>");OpenLayers.Console.dir(b.childNodes);OpenLayers.Console.groupEnd()}this.handleCallbacks(a,["failure","complete"]);if(Eniro.debug){OpenLayers.Console.groupEnd()}if(a&&a.frame){a.frame.src="about:blank";if(a.frame.parentNode){a.frame.parentNode.removeChild(a.frame)}}this.changeBannerStatus(a,"failed");this.next(a)},next:function(a){if(a){a.frame=null;a.target=null;a.callbacks=null}this.isLoading=false;this.processQueue()},_loadAd:function(b){this.changeBannerStatus(b,"loading");var a=[];if(b.parameters){for(var d in b.parameters){a.push(["&",d,"=",b.parameters[d]].join(""))}}var c=OpenLayers.i18n(this.source,b.data)+a.join("");setTimeout(function(){if(!b.canceled){var f="";if(jQuery.browser.msie&&parseInt(jQuery.browser.version,10)<8){f=' width="1"'}b.target.innerHTML='<iframe scrolling="no" frameborder="0" src="'+c+'"'+f+"></iframe>";b.frame=jQuery(b.target).children("iframe").get(0);jQuery(b.frame).css({visibility:"hidden"})}},0);this.timeoutId=setTimeout(OpenLayers.Function.bind(function(){this.failure({text:"timeout",frame:b.frame})},this),5000)},loadBanner:function(f,g,d,c){var b={data:f,target:g,callbacks:d||{},parameters:c||{},frame:null,name:"",canceled:false};if(Eniro.debug&&Eniro.Profile.sellable){for(var a in Eniro.Profile.sellable){if(+Eniro.Profile.sellable[a]===+f.cu){b.name=a;break}}}this.queue.push(b);this.processQueue();return b},cancelBanner:function(b){var a,c;for(a=0,c=this.queue.length;a<c;++a){if(this.queue[a]===b){this.changeBannerStatus(b,"canceled");break}}for(a=0,c=this.loading.length;a<c;++a){if(this.loading[a]===b){this.changeBannerStatus(b,"canceled");break}}},changeBannerStatus:function(g,c){var h=["queue","loading","loaded","failure","canceled"];if(this[c]&&h.indexOf(c)>=0){if(c==="canceled"){g.canceled=true;this.failure({text:"cancel",frame:g.frame})}for(var f=0,k=h.length;f<k;++f){var b=this[h[f]];for(var d=0,a=b.length;d<a;++d){if(b[d]===g){b.remove(d);break}}}if((c==="queue"||c==="loading")||Eniro.debug){this[c].push(g)}}},getEntryByFrame:function(f,b){var d=null;var a;if(b){a=this[b]}else{a=this.queue.concat(this.loading.concat(this.loaded.concat(this.failed.concat(this.canceled))))}for(var c=0,g=a.length;c<g;++c){if(a[c].frame===f){d=a[c];break}}return d}};if(window.location.href.indexOf("nocrud")<0){OpenLayers.Event.observe(window,"load",function(){Eniro.Emediate.initialize()})}Eniro.Banner=OpenLayers.Class(Eniro.Control,{mode:null,layer:null,cu:null,isLoading:false,isLoaded:false,modes:[],baseLayers:[],zoomLevels:[],mapEventListeners:null,removable:true,activateTimeout:null,displayBeforeLoad:false,initialize:function(b,d,h,c,g,a){if(!d){d=[]}if(!h){h=[]}if(!c){c=[]}if(!g){g=[]}var f={cu:b,modes:d,baseLayers:h,overlayLayers:c,zoomLevels:g};this.mapEventListeners={zoomend:this.onZoomEnd,changelayer:this.onChangeLayer,changebaselayer:this.onChangeBaseLayer,scope:this};OpenLayers.Util.extend(f,a||{});Eniro.Control.prototype.initialize.apply(this,[f]);this.register(Eniro.Events.MODE_SWITCH,this.onModeSwitch)},destroy:function(){if(this.bannerEntry){this.bannerEntry=null}if(this.mapEventListeners&&this.map&&this.map.events){this.map.events.un(this.mapEventListeners);this.mapEventListeners=null}this.unregister(Eniro.Events.MODE_SWITCH,this.onModeSwitch);Eniro.Control.prototype.destroy.apply(this,arguments)},activate:function(){if(this.activateTimeout){clearTimeout(activateTimeout)}setTimeout(OpenLayers.Function.bind(function(){if(this.isShowAllowed()){Eniro.Control.prototype.activate.apply(this,arguments);this.loadBanner();this.showIfAllowed()}else{this.hide()}},this),1000);return true},deactivate:function(){if(Eniro.Control.prototype.deactivate.apply(this,arguments)){if(this.elements.ad){this.elements.ad.innerHTML=""}if(this.elements.close){OpenLayers.Event.stopObservingElement(this.elements.close)}return true}return false},setMap:function(a){Eniro.Control.prototype.setMap.apply(this,arguments);if(this.mapEventListeners&&this.map&&this.map.events){this.map.events.on(this.mapEventListeners)}},onModeSwitch:function(a){this.activate()},onChangeLayer:function(a){if((a.property==="order"&&a.map.getLayerIndex(a.layer)===this.map.layers.length)||(a.property==="visibility"&&a.layer.getVisibility())){this.activate()}},onChangeBaseLayer:function(a){this.activate()},onZoomEnd:function(){this.activate();this.showIfAllowed()},draw:function(){this.cssClasses.close=this.getCssClassName("close");this.cssClasses.ad=this.getCssClassName("ad");this.div=jQuery(['<div class="',this.getCssClassName(this.removable?" removable":"",null,{id:this.getName()}),'" style="display:none;">','<div style="overflow: hidden; height: 1px" class="',this.cssClasses.ad,'"></div>','<div class="',this.cssClasses.close,'"></div>',"</div>"].join("")).get(0);return this.div},registerObservers:function(){if(this.elements.close&&this.close){this.observe(this.elements.close,"click",this.close)}},close:function(){this.closeCalled=true;this.hide()},sizeIframe:function(){var f=jQuery(this.elements.ad).children("iframe").get(0);if(f&&f.contentWindow&&f.contentWindow.document&&f.contentWindow.document.body){this.show();var d=0;var a=0;var c=f.contentWindow.document.body.childNodes;for(var b=0,g=c.length;b<g;++b){if(c[b].nodeType===1){d=Math.max(c[b].height||0,c[b].offsetHeight||0,d);a=Math.max(c[b].width||0,c[b].offsetWidth||0,a)}}jQuery(f).width(a).height(d).css("display","block");jQuery(this.elements.ad).width(a).height(d);jQuery(f).css({visibility:""})}},show:function(){if(this.div&&this.isShowAllowed()&&jQuery(this.elements.ad).children().size()>0){jQuery(this.div).show();if(jQuery.browser.opera){var c=jQuery(this.elements.ad).children("iframe").get(0);if(c&&c.contentWindow&&c.contentWindow.document&&c.contentWindow.document.body){var b=c.contentWindow.document.body.childNodes;for(var a=0,d=b.length;a<d;++a){if(b[a].nodeType===1){OpenLayers.Console.log(b[a].style.display);b[a].style.display="";OpenLayers.Console.log(b[a].style.display)}}}}this.triggerEvent(Eniro.Events.AD_DIMENSION_CHANGED)}},hide:function(){if(this.elements.ad&&(this.isLoading||!this.isLoaded)){Eniro.Emediate.cancelBanner(this.bannerEntry)}if(this.div){jQuery(this.div).hide();if(jQuery.browser.opera){var c=jQuery(this.elements.ad).children("iframe").get(0);if(c&&c.contentWindow&&c.contentWindow.document&&c.contentWindow.document.body){var b=c.contentWindow.document.body.childNodes;for(var a=0,d=b.length;a<d;++a){if(b[a].nodeType===1){b[a].style.display="none"}}}}this.triggerEvent(Eniro.Events.AD_DIMENSION_CHANGED)}},loadBanner:function(a){if(!this.elements.ad||this.isLoaded||this.isLoading){return}if(this.displayBeforeLoad){jQuery(this.div).show()}this.isLoading=true;this.bannerEntry=Eniro.Emediate.loadBanner({cu:this.cu},this.elements.ad,{success:OpenLayers.Function.bind(this.onBannerLoad,this),failure:OpenLayers.Function.bind(this.onBannerFail,this)},a)},clearBanner:function(){if(this.elements&&this.elements.ad){jQuery(this.elements.ad).empty();this.isLoaded=false}},onBannerLoad:function(){this.isLoading=false;this.isLoaded=true;this.sizeIframe()},onBannerFail:function(){this.isLoading=false;this.isLoaded=true;this.hide()},showIfAllowed:function(){if(this.isShowAllowed()){this.show()}else{this.hide()}},isShowAllowed:function(){var d=this.map.getCurrentMode();var a=this.map.baseLayer.layername;var h=this.map.getZoom();var c=false;if(this.overlayLayers.length===0){c=true}else{for(var b=0,g=this.map.layers.length;b<g;++b){if(this.map.layers[b].layername&&!this.map.layers[b].isBaseLayer&&jQuery.inArray(this.map.layers[b].layername,this.overlayLayers)>-1&&this.map.layers[b].getVisibility()){c=true;break}}}var f=(this.div&&!this.closeCalled&&c&&(this.modes.length===0||jQuery.inArray(d,this.modes)>-1)&&(this.baseLayers.length===0||jQuery.inArray(a,this.baseLayers)>-1)&&(this.zoomLevels.length===0||jQuery.inArray(h,this.zoomLevels)>-1));return f},getName:function(){var a=null;if(Eniro.Profile.sellable){for(var b in Eniro.Profile.sellable){if(+Eniro.Profile.sellable[b]===+this.cu){a=b;break}}}return a},CLASS_NAME:"Eniro.Banner"});Eniro.Banner.EventAwareBanner=OpenLayers.Class(Eniro.Banner,{hideEvents:[],showEvents:[],initialize:function(h,b,k,g,f,l,a,o){Eniro.Banner.prototype.initialize.apply(this,arguments);if(!l){l=[]}if(!a){a=[]}this.hideEvents=l;this.showEvents=a;var d,c;for(d=0,c=this.hideEvents.length;d<c;++d){this.register(this.hideEvents[d],this.onHideEvents)}for(d=0,c=this.showEvents.length;d<c;++d){this.register(this.showEvents[d],this.onShowEvents)}},destroy:function(){var a,b;for(a=0,b=this.hideEvents.length;a<b;++a){this.unregister(this.hideEvents[a],this.onHideEvents)}for(a=0,b=this.showEvents.length;a<b;++a){this.unregister(this.showEvents[a],this.onShowEvents)}this.hideEvents=null;this.showEvents=null;Eniro.Banner.prototype.destroy.apply(this,arguments)},onHideEvents:function(a){this.hide()},onShowEvents:function(a){this.showIfAllowed()},CLASS_NAME:"Eniro.Banner.EventAwareBanner",SUPER:"Eniro.Banner"});Eniro.Banner.Context=OpenLayers.Class(Eniro.Banner.EventAwareBanner,{parameters:null,displayWithoutParameters:false,initialize:function(c,f,k,d,h,g,a,b){Eniro.Banner.EventAwareBanner.prototype.initialize.apply(this,arguments);this.mapEventListeners=null;this.register(Eniro.Events.AD_CONTEXT_SET,this.onAdContextSet)},destroy:function(){this.unregister(Eniro.Events.AD_CONTEXT_SET,this.onAdContextSet);Eniro.Banner.EventAwareBanner.prototype.destroy.apply(this,arguments)},hide:function(){Eniro.Banner.EventAwareBanner.prototype.hide.apply(this,arguments);this.clearBanner()},loadBanner:function(){var a=this.parameters;this.parameters=null;Eniro.Banner.EventAwareBanner.prototype.loadBanner.apply(this,[a])},onAdContextSet:function(a){if(a.id!==this.cu){return}this.closeCalled=false;this.parameters=a.params;this.isLoaded=false;this.activate()},isShowAllowed:function(){if(Eniro.Banner.EventAwareBanner.prototype.isShowAllowed.apply(this,arguments)){if(this.displayWithoutParameters||(this.parameters||this.isLoading||this.isLoaded)){return true}}return false},CLASS_NAME:"Eniro.Banner.Context",SUPER:"Eniro.Banner.EventAwareBanner"});Eniro.Banner.SearchRectangle=OpenLayers.Class(Eniro.Banner.EventAwareBanner,{hasSearch:false,initialize:function(c,f,k,d,h,g,a,b){Eniro.Banner.EventAwareBanner.prototype.initialize.apply(this,[c,f,k,d,h,[Eniro.Events.SEARCH_RESULT_AVAILABLE,Eniro.Events.SEARCH_DO],[Eniro.Events.SEARCH_CLEAR],b])},onHideEvents:function(a){if(!a.mapTypesUpdate){this.hasSearch=true;this.hide()}},onShowEvents:function(a){if(a.type===Eniro.Events.SEARCH_CLEAR){this.hasSearch=false;this.showIfAllowed()}},isShowAllowed:function(){if(Eniro.Banner.EventAwareBanner.prototype.isShowAllowed.apply(this,arguments)){return !this.hasSearch}return false},CLASS_NAME:"Eniro.Banner.SearchRectangle",SUPER:"Eniro.Banner.EventAwareBanner"});Eniro.Banner.RouteRectangle=OpenLayers.Class(Eniro.Banner.EventAwareBanner,{hasRoute:false,initialize:function(c,f,k,d,h,g,a,b){Eniro.Banner.EventAwareBanner.prototype.initialize.apply(this,[c,f,k,d,h,[Eniro.Events.ROUTE_DESCRIPTION_AVAILABLE,Eniro.Events.ROUTE_SEARCH_FAILURE],[Eniro.Events.ROUTE_CLEAR],b])},onHideEvents:function(a){this.hasRoute=true;this.hide()},onShowEvents:function(a){this.hasRoute=false;this.showIfAllowed()},isShowAllowed:function(){if(Eniro.Banner.EventAwareBanner.prototype.isShowAllowed.apply(this,arguments)){return !this.hasRoute}return false},CLASS_NAME:"Eniro.Banner.RouteRectangle",SUPER:"Eniro.Banner.EventAwareBanner"});Eniro.Banner.GeoResultRectangle=OpenLayers.Class(Eniro.Banner.Context,{initialize:function(c,f,k,d,h,g,a,b){Eniro.Banner.Context.prototype.initialize.apply(this,[c,f,k,d,h,[Eniro.Events.SEARCH_DO,Eniro.Events.SEARCH_CLEAR],[Eniro.Events.SEARCH_RESULT_AVAILABLE],b])},onHideEvents:function(a){if(!a.mapTypesUpdate){this.hide()}},onShowEvents:function(a){if(!a.mapTypesUpdate){if(a.features&&a.features.length<=4){this.showIfAllowed()}else{this.hide()}}},CLASS_NAME:"Eniro.Banner.GeoResultRectangle",SUPER:"Eniro.Banner.Context"});Eniro.TabNavigatorView=OpenLayers.Class(Eniro.Control,{i18nExclude:true,collapsible:true,controls:[],selectedTab:null,initialize:function(){this.controls=[];Eniro.Control.prototype.initialize.apply(this,arguments)},destroy:function(){for(var a=0,b=this.controls.length;a<b;++a){if(typeof this.controls[a].destroy==="function"){this.controls[a].destroy()}this.controls[a]=null;delete this.controls[a]}this.controls=null;this.parent=null;Eniro.Control.prototype.destroy.apply(this,arguments)},activate:function(){if(Eniro.Control.prototype.activate.apply(this,arguments)){this.redrawSelector();for(var a=0,b=this.controls.length;a<b;++a){if(this.controls[a].selected){this.controls[a].activate()}}jQuery(this.div).show();return true}return false},deactivate:function(){if(Eniro.Control.prototype.deactivate.apply(this,arguments)){for(var a=0,b=this.controls.length;a<b;a++){this.controls[a].deactivate()}jQuery(this.div).hide();return true}return false},registerObservers:function(){this.observe(this.div,"click",this.onClick)},getTabViewClassNamePattern:function(b){var a=["item"];if(b){if(b.useIcon){a.push("icon")}}return a.join(" ")},onClick:function(d){var c=OpenLayers.Event.element(d);if(jQuery(c).closest("ul").size()>0&&!jQuery(c).is("ul")){c=jQuery(c).closest("li").eq(0);if(c.parent().get(0)===this.elements.selector){var b=jQuery(c).parent().children().index(c);var a=this.controls[b].id;OpenLayers.Event.stop(d);if(!this.controls[b].getDisabled()){if(this.controls[b].selected){this.onClickToToggle(a)}else{if(a){this.onClickToSwitch(a)}}}return false}}return true},onClickToToggle:function(a){this.toggleTab(a)},onClickToSwitch:function(a){this.switchTab(a)},switchTab:function(a){var b=this.getTabView(a);if(b&&b.selected){return true}this.closeTabs();this.deselectTabs();if(b){this.openTab(a);this.selectTab(a)}},toggleTab:function(a){if(this.collapsible){var b=this.getTabView(a);if(b.selected){this.closeTab(a);this.deselectTabs();jQuery(".eniro-tabnavigator-container").hide()}else{jQuery(this.elements.container).show();this.openTab(a);this.selectTab(a)}}},openTab:function(a){jQuery(".eniro-tabnavigator-container").show();var b=this.getTabView(a);if(!b.active){this.drawTabView(b);if(!b.activate()){jQuery(b.div).hide()}}if(b.active){jQuery(b.div).show();if(this.parent&&typeof this.parent.onOpenTab==="function"){this.parent.onOpenTab(b)}b.onShow()}},closeTab:function(a){var b=this.getTabView(a);if(b){if(b.div){jQuery(b.div).hide()}if(this.parent&&typeof this.parent.onCloseTab==="function"){this.parent.onCloseTab(b)}b.onHide()}},closeTabs:function(){for(var a=0,b=this.controls.length;a<b;++a){this.closeTab(this.controls[a].id)}},selectTab:function(a){var d=this.getTabView(a);for(var b=0,f=this.controls.length;b<f;++b){if(this.controls[b].id===a){this.controls[b].selected=true;var c=this.getTabViewClassNamePattern(d);jQuery(this.elements.selector).children("li").eq(b).attr("class",this.getCssClassName(c,"",d));if(this.activeTabClass){jQuery(this.div).removeClass(this.activeTabClass)}this.activeTabClass=this.getSingleCssClassName(d.provider+"-selected");jQuery(this.div).addClass(this.activeTabClass);break}}},deselectTabs:function(){var b;for(var a=0,c=this.controls.length;a<c;++a){this.controls[a].selected=false;b=this.getTabViewClassNamePattern(this.controls[a]);jQuery(this.elements.selector).children("li").eq(a).attr("class",this.getCssClassName(b,"",this.controls[a]))}},getTabView:function(c){for(var a=0,b=this.controls.length;a<b;++a){if(this.controls[a].id===c){return this.controls[a]}}return null},getTabViews:function(){return this.controls},getOpenTab:function(){for(var a=0,b=this.controls.length;a<b;++a){if(this.controls[a].selected){return this.controls[a]}}return null},addControl:function(a){this.controls.push(a);this.setControls(this.controls);if(this.map){a.setMap(this.map)}if(this.selected){this.redrawSelector()}},setControls:function(a){for(var b=0,c=a.length;b<c;++b){a[b].parent=this;a[b].position=null}if(a.length===1){a[0].position="first-last"}else{a[0].position="first";a[a.length-1].position="last"}this.controls=a},setMap:function(b){Eniro.Control.prototype.setMap.apply(this,arguments);if(this.controls&&this.controls.length>0){for(var a=0,c=this.controls.length;a<c;++a){if(!this.controls[a].map){this.controls[a].setMap(b)}}}},draw:function(){this.div=this.createDiv(null,"");jQuery(this.div).append(this.getTabSelectorHTML().join(""));jQuery(this.div).append(this.getTabContainerHTML().join(""));jQuery(this.div).append(this.getTabFooterHTML().join(""));return Eniro.Control.prototype.draw.apply(this,arguments)},redraw:function(a){this.redrawSelector(a);this.redrawContent(a)},redrawSelector:function(){if(this.elements.selector){jQuery(this.elements.selector).html(jQuery(this.getTabSelectorHTML().join("")).html())}else{jQuery(this.div).prepend(this.getTabSelectorHTML().join(""))}this.assignElements()},redrawContent:function(a){var b=this.getTabView(a);if(b.div){b.redraw()}else{jQuery(this.elements.container).append(b.draw())}b.assignElements()},drawTabView:function(a){if(!a.div){jQuery(this.elements.container).append(a.draw());return true}return false},getTabContainerHTML:function(){this.cssClasses.container=this.getCssClassName("container");return['<div class="'+this.cssClasses.container+'"></div>']},getTabSelectorHTML:function(){if(this.controls.length<1){return[]}this.cssClasses.selector=this.getCssClassName("selector");var b=['<ul class="'+this.cssClasses.selector+'">'];var d;var g;var c;for(var a=0,f=this.controls.length;a<f;++a){d=this.controls[a];c=this.getTabViewClassNamePattern(d);b.push('<li class="'+this.getCssClassName(c)+'">');b=b.concat(d.getTabSelectorItemHTML());b.push("</li>")}b.push("</ul>");return b},getTabFooterHTML:function(){return[]},CLASS_NAME:"Eniro.TabNavigatorView"});Eniro.ModeSwitchingTabNavigatorView=OpenLayers.Class(Eniro.TabNavigatorView,{initialize:function(){Eniro.TabNavigatorView.prototype.initialize.apply(this,arguments);this.register(Eniro.Events.MODE_SWITCH,this.onModeSwitch)},destroy:function(){this.unregister(Eniro.Events.MODE_SWITCH,this.onModeSwitch);Eniro.TabNavigatorView.prototype.destroy.apply(this,arguments)},onModeSwitch:function(a){this.switchTab(a.mode)},onClickToSwitch:function(a){this.triggerEvent(Eniro.Events.MODE_SWITCH,{mode:a})},CLASS_NAME:"Eniro.ModeSwitchingTabNavigatorView",SUPER:"Eniro.TabNavigatorView"});Eniro.TabView=OpenLayers.Class(Eniro.Control,{useIcon:false,disabled:false,initialize:function(){Eniro.Control.prototype.initialize.apply(this,arguments);this.title=this.i18n("title")},destroy:function(){if(this.closeButton){OpenLayers.Event.stopObservingElement(this.closeButton);this.closeButton=null}Eniro.Control.prototype.destroy.apply(this,arguments)},activate:function(){if(this.disabled){return false}return Eniro.Control.prototype.activate.apply(this,arguments)},deactivate:function(){return Eniro.Control.prototype.deactivate.apply(this,arguments)},onShow:function(){},onHide:function(){},getDisabled:function(){return this.disabled},setDisabled:function(a){this.disabled=a},getTabSelectorItemHTML:function(){return['<a href=""><span>'+this.title+"</span></a>"]},getContent:function(){return["<div>This is the content of your "+this.id+" tab</div>"]},draw:function(){this.div=this.createDiv();var b=this.getContent();for(var a=0,c=b.length;a<c;++a){jQuery(this.div).append(b[a])}return this.div},redraw:function(){var b=this.getContent();jQuery(this.div).empty();for(var a=0,c=b.length;a<c;++a){jQuery(this.div).append(b[a])}return this.div},CLASS_NAME:"Eniro.TabView"});Eniro.ViewportDebugger=OpenLayers.Class(Eniro.Control,{viewportFrame:null,initialize:function(){Eniro.Control.prototype.initialize.apply(this,arguments)},setMap:function(a){Eniro.Control.prototype.setMap.apply(this,arguments);this.map.events.on({moveend:this.updateViewportFrame,scope:this});this.updateViewportFrame()},destroy:function(){this.destroyViewportFrame();this.map.events.un({moveend:this.updateViewportFrame,scope:this});Eniro.Control.prototype.destroy.apply(this,arguments)},destroyViewportFrame:function(){if(this.viewportFrame){if(this.map){this.map.searchLayer.destroyFeatures(this.viewportFrame)}this.viewportFrame=null}},updateViewportFrame:function(a){this.destroyViewportFrame();if(!this.map){return}this.viewportFrame=new OpenLayers.Feature.Vector(this.map.getAdjustedExtent().toGeometry());if(this.map){this.map.searchLayer.addFeatures([this.viewportFrame])}},CLASS_NAME:"Eniro.ViewportDebugger"});Eniro.Suggest=OpenLayers.Class(Eniro.Control,{_timer:null,_lastQuery:null,TIMEOUT:200,DOWN_KEY:40,UP_KEY:38,ENTER_KEY:13,ESC_KEY:27,TAB_KEY:9,blurred:false,callbacks:{},externalId:null,initialize:function(a,c,b){OpenLayers.Util.extend(this,b);this.dataSource=c;this.input=OpenLayers.Util.getElement(a);this.p=b.p;this.ap=b.ap;this.externalId=b.id;this.callbacks=b.callbacks||{};this._lastQuery=(b.currentQuery&&b.currentQuery!=="")?b.currentQuery:null;this._topChoice=null;jQuery(this.input).attr("autocomplete","off");this._events=new OpenLayers.Events(this,this.input);this.installListeners()},installListeners:function(){jQuery(this.input).keydown(OpenLayers.Function.bind(this.onKeyDown,this));this._events.on({keyup:this.onKeyUp,blur:this.onBlur,focus:this.onFocus,scope:this})},destroy:function(){this.dataSource.destroy();this.closePopup();this._events.un({keyup:this.onKeyUp,blur:this.onBlur,focus:this.onFocus,scope:this});this._events.destroy()},getQuery:function(){return jQuery(this.input).val()},onKeyDown:function(a){this.keyCode=a.keyCode;if(this.keyCode==this.ESC_KEY){this.closePopup()}else{if(this.keyCode==this.UP_KEY){OpenLayers.Event.stop(a);this.onCursorUp()}else{if(this.keyCode==this.DOWN_KEY){OpenLayers.Event.stop(a);this.onCursorDown()}else{if(this.keyCode==this.ENTER_KEY){this.onSelect(null,a)}else{if(this.keyCode==this.TAB_KEY){this.onSelect(null,a)}}}}}if(this.callbacks.keydown&&(typeof this.callbacks.keydown==="function")){this.callbacks.keydown(a,this)}},onKeyUp:function(a){var b=this.getQuery();if(b!==this._lastQuery){this._lastQuery=b;this.onQueryChanged()}if(this.callbacks.keyup&&(typeof this.callbacks.keyup==="function")){this.callbacks.keyup(a,this)}},onCursorUp:function(){if(!this.div){return}var a=jQuery(this.div);var d=a.find("li.selected");if(!d.size()){a.find("li:last").addClass("selected");return}d.removeClass("selected");var c=d.prev();if(c.size()){c.addClass("selected")}else{var b=a.find("li:last");if(b.is(".info")){b.prev().addClass("selected")}else{b.addClass("selected")}}},onCursorDown:function(){if(!this.div){this.onQueryChanged();return}var a=jQuery(this.div);var c=a.find("li.selected");if(!c.size()){a.find("li:first").addClass("selected");return}c.removeClass("selected");var b=c.next();if(b.size()&&b.is(".info")){a.find("li:first").addClass("selected")}else{if(b.size()){b.addClass("selected")}else{a.find("li:first").addClass("selected")}}},onQueryChanged:function(){this._topChoice="";this.setHiddenValue("",false);var a=this.getQuery();if(a.length<2){this.closePopup()}else{if(this._timer){clearTimeout(this._timer)}this._timer=setTimeout(OpenLayers.Function.bind(this.onQueryTimeout,this),this.TIMEOUT)}if(this.callbacks.querychanged&&(typeof this.callbacks.querychanged==="function")){this.callbacks.querychanged(this)}},onQueryTimeout:function(){this._timer=null;this.suggest(this.getQuery(),OpenLayers.Function.bind(this.onSuggestAvailable,this))},onSuggestAvailable:function(a){this._topChoice=a.suggests[0]||null;if(a.suggests.length&&this.keyCode!==this.ENTER_KEY&&this.keyCode!==this.TAB_KEY){this.openPopup();this.setResult(a)}else{this.closePopup()}},onSelect:function(b,c){if(this.div){var a=jQuery(this.input);var d=null;var g;var h;if(b){b=jQuery(b);if(!b.is(".eniro-suggest-info")){d=b}else{d=jQuery(this.div).find("li.selected span")}}else{d=jQuery(this.div).find("li.selected span")}var f=d.siblings();if(f!==undefined&&f!==null&&f.length>0){g=f[0].innerHTML;this.setHiddenValue(g,d)}if(f[1]){h=f[1].innerHTML}if(d!==null&&d.size()){a.val(d.html());this._lastQuery=this.getQuery()}this.closePopup();if(this.callbacks.select&&(typeof this.callbacks.select==="function")){this.callbacks.select({value:a.val(),geometry:g,id:h,externalId:this.externalId,event:c},this)}}},onFocus:function(a){OpenLayers.Event.stop(a);this.blurred=false;if(this.callbacks.focus&&(typeof this.callbacks.focus==="function")){this.callbacks.focus(a,this)}},onBlur:function(a){OpenLayers.Event.stop(a);this.blurred=true;this.closePopup();if(this.callbacks.blur&&(typeof this.callbacks.blur==="function")){this.callbacks.blur(a,this)}},openPopup:function(){if(this.div){return}this.createPopupDiv();if(this.div){jQuery(".eniro").append(this.div)}},closePopup:function(){if(this._timer){clearTimeout(this._timer);this._timer=null}if(this.div){OpenLayers.Element.remove(this.div);this.div=null}if(this.divEvents){this.divEvents.un({mouseover:this.onMouseOverPopupDiv,mouseout:this.onMouseOutPopupDiv,mousedown:this.onMouseDownPopupDiv,scope:this});this.divEvents.destroy();this.divEvents=null}},createPopupDiv:function(){var a=jQuery(this.input);if(!a.is(":visible")){return}this.div=OpenLayers.Util.createDiv();OpenLayers.Element.addClass(this.div,"suggest");var c=a.parent();var b=c.offset();b.top-=(c.outerHeight()-7);this.div.style.left=b.left+"px";this.div.style.top=b.top+"px";this.div.style.minWidth=c.width()+4+2;this.div.style.width=c.width()+4+2;this.divEvents=new OpenLayers.Events(this,this.div);this.divEvents.on({mouseover:this.onMouseOverPopupDiv,mouseout:this.onMouseOutPopupDiv,mousedown:this.onMouseDownPopupDiv,scope:this})},onMouseOverPopupDiv:function(a){OpenLayers.Event.stop(a);var b=OpenLayers.Event.element(a);if(jQuery(this.div).find("li")){jQuery(b).addClass("selected")}},onMouseOutPopupDiv:function(a){OpenLayers.Event.stop(a);var b=OpenLayers.Event.element(a);if(jQuery(this.div).find("li")){jQuery(b).removeClass("selected")}},onMouseDownPopupDiv:function(a){OpenLayers.Event.stop(a);var b=OpenLayers.Event.element(a);if(jQuery(this.div).find("span")){this.onSelect(b,a)}},isPopupClosed:function(){return !this.div},suggest:function(a,b){this.dataSource.suggest(a,b,this.p,this.ap)},setResult:function(a){var f=["<ul>"];var d=a.suggests;for(var c=0,b=d.length;c<b;c++){f=f.concat(['<li><a href="/'+new Date().getTime()+'"><span>',d[c].suggest,'</span><span style="display:none">',d[c].routeLonlat.lon,",",d[c].routeLonlat.lat,'</span><span style="display:none">',d[c].id,"</span></a></li>"])}f.push("</ul>");if(this.div){this.div.innerHTML=f.join("")}},setHiddenValue:function(b,c){var a=jQuery(this.input);if(jQuery(a).siblings().length>0&&(!c||jQuery(c).siblings().length>0)){jQuery(a).siblings()[0].value=b}},getTopChoice:function(){return this._topChoice},CLASS_NAME:"Eniro.Suggest"});Eniro.Suggest.DataSource=OpenLayers.Class({successCallback:null,errorCallback:null,initialize:function(a){this.url=Eniro.AppNode.appUrl("/search/search");OpenLayers.Util.extend(this,a);this.successCallback=OpenLayers.Function.bind(this.onSuggestQuerySuccess,this);this.errorCallback=OpenLayers.Function.bind(this.onSuggestQueryError,this)},destroy:function(){this.callback=null},suggest:function(c,f,d,a){this.callback=f;var b={q:c,p:d,ap:a};OpenLayers.Request.GET({url:this.url,data:b,success:this.successCallback,error:this.errorCallback})},onSuggestQuerySuccess:function(a){if(this.callback&&a&&a.responseText&&a.responseText.search){this.callback(a.responseText.search)}else{this.callback({})}},onSuggestQueryError:function(){OpenLayers.Console.warn("Suggest failed: "+arguments)},CLASS_NAME:"Eniro.Suggest.DataSource"});Eniro.Control.Crashers=OpenLayers.Class(Eniro.Control,{inputKeys:[],sequenceKeys:{},initialize:function(){Eniro.Control.prototype.initialize.apply(this,arguments);this.mv=Eniro.Config["media.version"];this.sequenceKeys={crashersquirrel:[38,38,40,40,37,39,37,39,66,65],longcat:[76,79,78,71,67,65,84,32,73,83,32,76,79,78,71],panda:[67,85,84,69,32,80,65,78,68,65,32,70,84,87]};this.handler=new OpenLayers.Handler.Keyboard(this,{keydown:this.onKeyDown});for(var a in this.sequenceKeys){if(this.sequenceKeys.hasOwnProperty(a)){this.cssClasses[a]=this.getCssClassName(a)}}},onKeyDown:function(b){if(b.keyCode===OpenLayers.Event.KEY_ESC){this.inputKeys=[];this.hide()}else{var f,g;this.inputKeys.push(b.keyCode);for(var d in this.sequenceKeys){f=true;g=d;for(var c=0,a=this.sequenceKeys[d].length;c<a;++c){if(this.inputKeys[c]!=this.sequenceKeys[d][c]){f=false;g=null;break}}if(f){this.inputKeys=[];break}}if(f&&g){this.show(g)}}},show:function(b){if(this.div){if(!this.elements[b]){var a=jQuery('<img class="'+this.cssClasses[b]+'" src="'+Eniro.Util.getImagesLocation()+b+".png?v="+this.mv+'" />');a.hide();a.load(OpenLayers.Function.bind(this.showImage,this,b));jQuery(this.div).append(a);this.assignElements()}}},hide:function(){if(this.div){jQuery(this.div).children().hide()}},showImage:function(a){this.warn(a);jQuery(this.elements[a]).slideDown("slow")},CLASS_NAME:"Eniro.Control.Crashers"});Eniro.Control.ArgParser=OpenLayers.Class(OpenLayers.Control.ArgParser,{setMap:function(f){OpenLayers.Control.prototype.setMap.apply(this,arguments);for(var c=0,a=this.map.controls.length;c<a;c++){var d=this.map.controls[c];if((d!=this)&&(d.CLASS_NAME=="OpenLayers.Control.ArgParser")){if(d.displayProjection!=this.displayProjection){this.displayProjection=d.displayProjection}break}}if(c==this.map.controls.length){var b=this.getParameters();if(b.layers){this.layers=b.layers;this.map.events.register("addlayer",this,this.configureLayers);this.configureLayers()}if(b.lat&&b.lon){this.center=new OpenLayers.LonLat(parseFloat(b.lon),parseFloat(b.lat));if(b.zoom){this.zoom=parseInt(b.zoom,10)}this.map.events.register("changebaselayer",this,this.setCenter);this.setCenter()}}},getParameters:function(){url=window.location.hash;var o={};if(url){url=url.replace(/^#/,"");var a=decodeURIComponent(url);var b=a.split(/[&;]/);for(var f=0,g=b.length;f<g;++f){var d=b[f].split("=");if(d[0]){var k=decodeURIComponent(d[0]);var h=d[1]||"";h=h.split(",");for(var c=0,l=h.length;c<l;c++){h[c]=decodeURIComponent(h[c])}if(h.length==1){h=h[0]}o[k]=h}}}return o},CLASS_NAME:"Eniro.Control.ArgParser"});Eniro.SearchResultItem=OpenLayers.Class(Eniro.Control,{index:0,feature:undefined,provider:undefined,searchItemLinkData:"",initialize:function(){Eniro.Control.prototype.initialize.apply(this,arguments);if(this.feature){if(this.feature.data&&!this.feature.properties){this.feature.properties=this.feature.data}if(this.feature.fid&&!this.feature.id){this.feature.id=this.feature.fid}}},destroy:function(){this.feature=null;this.provider=null;Eniro.Control.prototype.destroy.apply(this,arguments)},activate:function(){if(Eniro.Control.prototype.activate.apply(this,arguments)){if(this.onMouseOver){this.observe(this.div,"mouseover",this.onMouseOver)}if(this.onMouseOut){this.observe(this.div,"mouseout",this.onMouseOut)}if(this.onClick){this.observe(this.div,"click",this.onClick)}return true}return false},deactivate:function(){if(Eniro.Control.prototype.deactivate.apply(this,arguments)){var a=jQuery(this.div).find("a.fn");if(a.size()>0){OpenLayers.Event.stopObservingElement(a.get(0))}OpenLayers.Event.stopObservingElement(this.div);return true}return false},onClick:function(d){var g=OpenLayers.Event.element(d);var k=this.feature.id;var c=jQuery(g).closest("a").get(0);if(c){if(jQuery(c).is("a.rating")||jQuery(c).is("a.eniro-celeb")){return true}else{if(jQuery(c).is("a.fn")){OpenLayers.Event.stop(d);this.triggerEvent(Eniro.Events.SEARCH_SELECT_ITEM,{id:k,provider:this.provider});Eniro.AppEvents.triggerEvent(Eniro.Events.STATISTICS_LOG,{scope:"contentItem",event:"selected",data:{provider:this.provider,feature:this.feature}});return false}else{if(c===this.elements.sendGiftToggler){OpenLayers.Event.stop(d);var h=this;jQuery(this.elements.sendgifts).slideToggle("fast");return false}else{var b=jQuery(g).closest("li").get(0);if(b===this.elements.route){OpenLayers.Event.stop(d);Eniro.AppEvents.triggerEvent(Eniro.Events.STATISTICS_LOG,{scope:"navigate",event:"itemRoute",data:{addaxUrl:this.getEDataValue(this.getPropertyList()["e:statistics"],"@src"),provider:this.provider,feature:this.feature}});var f=this.map.wfs.getTransientFeature(k);if(f){this.convertMarker(f,Eniro.Constant.MarkerTypes.ROUTE)}return false}}}}}return true},onMouseOver:function(){var a=this.map.wfs.getTransientFeature(this.feature.id);if(a){a.onMouseOver()}},onMouseOut:function(a){var b=this.map.wfs.getTransientFeature(this.feature.id);if(b&&Eniro.Util.mouseLeft(a,this.div)){b.onMouseOut()}},convertMarker:function(a,c){var b;var f=a.attributes.routeLonlat||a.attributes.lonlat;if(!f){f=a.geometry.getBounds().getCenterLonLat()}else{f=new OpenLayers.LonLat(f.lon,f.lat).transform(this.map.backendProjection,this.map.baseLayer.projection)}if(a.CLASS_NAME==="OpenLayers.Feature.Vector"){var d=new OpenLayers.LonLat(f.lon,f.lat);b=new Eniro.Feature.WFSMarker(new OpenLayers.Geometry.Point(d.lon,d.lat),a.attributes);b.hide();this.map.wfs.addFeatures(b)}else{b=a.clone()}b.lonlat=f;this.triggerEvent(Eniro.Events.CONVERT_MARKER,{marker:b,type:c,ordinal:-1})},getEData:function(d,k,b){var o=[];if(d){if(d.constructor==Array){for(var f=0;f<d.length;f++){var c=d[f];if(!c.length){o=o.concat(this.getEData(c,k,b))}}}else{if(k&&d.hasOwnProperty(k)){d=d[k]}if(!b){o.push(d)}else{var g=true;for(var h in b){g=d.hasOwnProperty(h);if(g){var a=d[h];var l=b[h];g=(a===l)}if(!g){break}}if(g){o.push(d)}}}}return o},getEDataValue:function(d,a){var c=null;if(d){if(!a){if(d.hasOwnProperty("@type")){var b=d["@type"];if(b==="text/xml"){a="@href"}else{if(b==="picture"){a="e:src"}}}if(!a){a="#text"}}if(a&&d.hasOwnProperty(a)){c=d[a]}}return(typeof c==="string"&&c.indexOf("http")<0)?c.wrap(50):c},getPropertyList:function(a){a=a||this.feature;return a.properties||a.attributes},getCoordinates:function(b){var a=b["georss:point"];if(a&&a.length>0){a=a.split(" ")}else{if(b.lonlat){a=[b.lonlat.lat,b.lonlat.lon]}else{if(this.feature.geometry&&this.feature.geometry.type=="Point"){a=this.feature.geometry.coordinates}}}if(a&&a.length>0){coordinates=a}return a},getOrdinal:function(){if(this.feature){if(this.feature.feature&&this.feature.feature.attributes){return this.feature.feature.attributes.ordinal}else{if(this.feature.properties){return this.feature.properties.ordinal}}}return""},formatYpTitle:function(c,a,b){a=a||"/"+new Date().getTime();return'<a href="'+a+'" class="fn org'+(b?" eniro-new":"")+'">'+c+"</a>"},formatWpTitle:function(c,a,b){a=a||"/"+new Date().getTime();return'<a href="'+a+'" class="fn'+(b?" eniro-new":"")+'">'+c+"</a>"},formatGeoTitle:function(c,a,b){a=a||"/"+new Date().getTime();return'<a href="'+a+'" class="fn'+(b?" eniro-new":"")+'">'+c+"</a>"},formatCelebTitle:function(b,a){a=a||"/"+new Date().getTime();return'<a href="'+a+'" class="eniro-new eniro-celeb">'+b+"</a>"},formatPhone:function(a){return['<li class="tel">',a,"</li>"].join("")},formatPhoneNo:function(a){if(a){a=Eniro.Util.FeatureUtils.formatNorwegianPhoneNo(a)}return this.formatPhone(a)},formatAddress:function(a){var d=[];var b=[];if(Eniro.Util.isArray(a.phones)&&a.phones.length>0){for(var c=0,g=a.phones.length;c<g;++c){b.push(this.formatPhone(a.phones[c]))}}if(b.length>0){b=['<ul class="'+this.getCssClassName("address-phones")+'">',b.join(""),"</ul>"];d.push(b.join(""))}if(a.streetName){var f=a.streetName;if(a.streetNumber){f+=" "+a.streetNumber}d.push('<span class="street-address eniro-nowrap">','<span class="value">',f,"</span>,","</span>")}if(a.postalCode){d.push(' <span class="eniro-nowrap"><span class="postal-code">',a.postalCode,"</span>");if(!a.postArea){d.push("</span>")}}if(a.postArea){if(!a.postalCode){d.push(' <span class="eniro-nowrap">')}d.push(' <span class="locality">',a.postArea,"</span></span>")}if(d.length>0){d.unshift('<li class="adr">');d.push("</li>")}return d.join("")},formatCoordinates:function(b){var a=[];if(b&&b.length===2){a.push('<span class="geo">','<span class="longitude">',b[0],"</span>",'<span class="latitude">',b[1],"</span>","</span>")}return a.join("")},formatListItemLink:function(b,a,f,d){if(!b){return""}if(!f){f=this.i18n(b)}var c;if(this.cssClasses[b]){c=this.cssClasses[b]}else{c=this.getCssClassName(b)}return['<li class="',c,'">','<a href="',a,'"',(d?'class="eniro-new"':""),">","<span>",f,"</span>","</a>","</li>"].join("")},formatRating:function(d,c,h){if(!c){return""}d=d||"rejta";var a=[];if(isNaN(c.score)){return""}var b=[];if(c.score<0){b.push("eniro-norating")}else{b.push("eniro-rating")}var f=Math.floor(c.score);b.push("eniro-"+d+f+((c.score-f>=0.5)?"-5":""));if(c.url){b.push("eniro-new")}this.cssClasses.rating=b.join(" ");a.push('<span class="hreview"><a rel="nofollow" class="',this.cssClasses.rating,'"');if(h){a.push(' title="'+h+'"')}if(c.url){var g=OpenLayers.String.contains(c.url,"?")?"&":"?";var k=Eniro.Profile.providers[this.provider].ratingPartnerId?c.url+g+"partnerid="+Eniro.Profile.providers[this.provider].ratingPartnerId:c.url;a.push(' href="'+k+'"')}a.push('">'+this.i18n("rating")+" "+c.score+"</a></span>");return a.join("")},formatNoAddressString:function(b){if(typeof b!=="string"){return{street:"Fixmegatan 1337",postnumber:"1337 ",postname:"Fixme"}}var c=/, (\d+)/;var a={};var d=b.split(c,3);if(d.length>0){a.street=d[0]}if(d.length>1){a.postnumber=d[1]}if(d.length>2){a.postname=d[2]}return a},formatYpNo:function(){var a=this.buildYpNo();return['<li class="',this.getCssClassName("item"),' vcard">','<div class="',this.getCssClassName("title"),'">',"<em>"+this.getOrdinal()+".</em>","<h2>"+this.formatYpTitle(a.title,a.url,false)+"</h2>","</div>",'<div class="',this.getCssClassName("left"),'">',a.contactinfo.join(""),"</div>",((a.properties&&a.properties.length>0)?'<div class="'+this.getCssClassName("right")+'">'+a.properties.join("")+"</div>":""),a.links.join(""),"</li>"].join("")},buildYpNo:function(){var t=this.getPropertyList();var k=(t.link?t.link+this.getSearchItemLinkData("yp_no"):"/"+new Date().getTime());if(k[0]!=="/"&&k.indexOf("http://")!==0){k="http://"+k}var o=t.companyName;if(o&&o.length>20){var p=o.substr(20);o=o.substr(0,20)+p.replace(/( |\,|\.)/i,"$1<br/>")}var f;var b=[];if(t.telephoneNumber){b.push(this.formatPhoneNo(t.telephoneNumber))}var r=this.getCoordinates(t);var s=[];f=t.visitorAddress;if(f&&f.addressLines){if(f.addressLines[0]){f.streetName=f.addressLines[0]}if(f.addressLines[1]){f.postArea=f.addressLines[1]}s.push(this.formatAddress(f))}var u=[];var d=[];var a;var l;if(this.feature&&this.feature.geometry){this.cssClasses.route=this.getCssClassName("route");d.push(this.formatListItemLink("route","/"+new Date().getTime())+" ")}var g=[];var c=[];if(d&&d.length>0){u.push('<ul class="',this.getCssClassName("links"),'">');u=u.concat(d);u.push("</ul>")}var q=[];if((b&&b.length>0)||(s&&s.length>0)){q.push("<ul>");q=q.concat(b);q=q.concat(s);q.push("</ul>")}var h=[];if((q&&q.length>0)||(r&&r.length>0)){h=h.concat(q);h=h.concat(this.formatCoordinates(r))}f={hasUrl:(t.link&&t.link["@href"]),url:k,title:o,contactinfo:h,properties:g,phones:b,links:u};return f},drawWpNo:function(){var f=this.formatWpNo();var d=(f.properties&&f.properties.length>0);var b=[];if(f.phones.length>0){b=['<ul class="'+this.getCssClassName("phones")+'">',f.phones.join(""),"</ul>"]}var g=[];if(f.addresses.length>0){g=['<ul class="'+this.getCssClassName("addresses")+'">',f.addresses.join(""),"</ul>"]}var a=[];if(f.links.length>0){a=['<ul class="'+this.getCssClassName("links")+'">',f.links.join(""),"</ul>"]}var c=[];if(f.presentation.length>0){c=['<dl class="',this.getCssClassName("presentation"),'">',f.presentation.join(""),"</dl>"]}return['<li class="',this.getCssClassName("item"+(!d?" norightcol":"")),' vcard">','<div class="',this.getCssClassName("left"),'">','<div class="',this.getCssClassName("title"),'">',"<em>",this.getOrdinal(),".</em>","<h2>",(f.name||f.companyname),"</h2>","</div>",b.join(""),g.join(""),"</div>",c.join(""),a.join(""),(f.frontdoor?f.frontdoor.join(""):""),"</li>"].join("")},formatGeoNo:function(){var a=this.buildGeoNo();return['<li class="'+this.getCssClassName("item")+'">','<div class="'+this.getCssClassName("title")+'">',"<em>"+this.getOrdinal()+"</em>","<h2>"+this.formatGeoTitle(a.address)+"</h2>","</div>","</li>"].join("")},buildGeoNo:function(){var a={address:Eniro.Util.FeatureUtils.getAddressAsString(this.feature)};return a},formatWpNo:function(){var d=this.buildWpNo();this.cssClasses.route=this.getCssClassName("route");var c;if(d.name){if(d.isCelebrity){c=this.formatCelebTitle(d.name,d.url)}else{c=this.formatWpTitle(d.name,d.url,false)}}else{if(d.companyname){c=this.formatWpTitle(d.companyname,d.url,false)}else{c="-"}}var a=[];if(this.feature&&this.feature.geometry){a.push(this.formatListItemLink("route","/"+new Date().getTime()))}var b=[];if(d.phones.length>0){for(i=0,n=d.phones.length;i<n;++i){b.push(this.formatPhoneNo(d.phones[i].text))}}var g=[];if(d.address){g.push(this.formatAddress(d.address))}var f=this.formatCoordinates(d.coordinates);d={name:c,companyname:d.companyname,links:a,phones:b,addresses:g,coordinates:f,presentation:[]};return d},buildWpNo:function(){var f,g,d,l,q,h,b;var r=this.getPropertyList();var k=(r.link?r.link+this.getSearchItemLinkData("wp_no"):"/"+new Date().getTime());if(k[0]!=="/"&&k.indexOf("http://")!==0){k="http://"+k}var a=[];if(r.firstName&&OpenLayers.String.trim(r.firstName)){a.push(r.firstName)}if(r.lastName&&OpenLayers.String.trim(r.lastName)){a.push(r.lastName)}a=a.join(" ");var p=this.getCoordinates(r);var o={};f=r.addressLines;if(Eniro.Util.isArray(f)&&f.length>0){if(f[0]){o.streetName=f[0]}o.postArea="";for(g=1,d=f.length;g<d;g++){o.postArea+=f[g]+" "}OpenLayers.String.trim(o.postArea)}phones=[];f=r.contactEntries;if(Eniro.Util.isArray(f)&&f.length>0){for(g=0,d=f.length;g<d;++g){var c=f[g];if(c.text){phones.push(c)}}}return{phones:phones,address:o,url:k,name:a,coordinates:p,isCelebrity:false}},drawYpSe:function(){return this.formatYpSe()},formatYpSe:function(){var b=this.buildYpSe();var a=b.properties.length>0;return['<li class="',this.getCssClassName("item"+(!a?" norightcol":"")),' vcard">','<div class="',this.getCssClassName("title"),'">',"<em>"+this.getOrdinal()+".</em>","<h2>"+this.formatYpTitle(b.title,b.url,false)+"</h2>",this.formatRating("rejta",b.rating),"</div>",'<div class="',this.getCssClassName("left"),'">',b.contactinfo.join(""),"</div>",((b.properties.length>0)?'<div class="'+this.getCssClassName("right")+'">'+b.properties.join("")+"</div>":""),b.links.join(""),"</li>"].join("")},buildYpSe:function(){var s=Eniro.Profile.providers[this.provider].dataTransformers;var E=this.getPropertyList();var b=this.getSearchItemLinkData("yp_se");var q=(E.link&&E.link["@href"])?E.link["@href"]+b:"/"+new Date().getTime();if(q[0]!=="/"&&q.indexOf("http://")!==0){q="http://"+q}var G=this.getEDataValue(E.title);if(G&&G.length>20){var o=G.substr(20);G=G.substr(0,20)+o.replace(/( |\,|\.)/i,"$1<br/>")}var F;var k=[];F=this.getEData(E["e:phone_numbers"],"e:phone_number");if(F&&F.length>0&&F[0]){k.push(this.formatPhone(this.getEDataValue(F[0])))}var g=this.getCoordinates(E);var h=[];F=E["e:address"];if(F){F={streetName:this.getEDataValue(F,"e:street_name"),streetNumber:this.getEDataValue(F,"e:street_number"),postalCode:this.getEDataValue(F,"e:post_code"),postArea:this.getEDataValue(F,"e:post_area")};h.push(this.formatAddress(F))}var d=[];var D=[];var C;var r;var u;var a=E.link&&E.link["@href"]?E.link["@href"].replace(/^(http:\/\/.*?)\/.*$/,"$1"):"http://gulasidorna.eniro.se";var A=a+OpenLayers.i18n("eniro.yp.company-seo");if(this.feature&&this.feature.geometry){this.cssClasses.route=this.getCssClassName("route");D.push(this.formatListItemLink("route","/"+new Date().getTime())+" ")}F=this.getEData(E["e:infopage"],"e:component",{"@type":"text","@component_name":"book_table"});if(F&&F.length>0&&F[0]){C=this.getEDataValue(F[0],"e:url");r=this.getEDataValue(F[0],"e:label");u=true;var f={};if(s&&s.book_table){var B=s.book_table;f={searchData:b};C=C.match(B.href.filter)?Eniro.Util.FeatureUtils.transformInfoListingUrl(E,B.href.rewrite,A,f):null;u=false}if(C&&r){D.push(this.formatListItemLink("reserve-table",C,r,u)+" ")}}F=this.getEData(E["e:infopage"],"e:component",{"@type":"text","@component_name":"booking_com"});if(F&&F.length>0&&F[0]){C=this.getEDataValue(F[0],"e:url");r=this.getEDataValue(F[0],"e:label");u=true;if(s&&s.booking_com){var c=s.booking_com;f={searchData:b};C=C.match(c.href.filter)?Eniro.Util.FeatureUtils.transformInfoListingUrl(E,c.href.rewrite,A,f):null;u=false}if(C&&r){D.push(this.formatListItemLink("reserve-room",C,r,u)+" ")}}F=this.getEData(E["e:infopage"],"e:component",{"@type":"text","@component_name":"custom_book_and_order"});if(F&&F.length>0&&F[0]){C=this.getEDataValue(F[0],"e:url");r=this.getEDataValue(F[0],"e:label");if(C&&r){D.push(this.formatListItemLink("custom-book-and-order",C,r,true)+" ")}}this.cssClasses.links=this.getCssClassName("links");if(D&&D.length>0){d.push('<ul class="',this.cssClasses.links,'">');d=d.concat(D);d.push("</ul>")}var p=[];var w=[];F=this.getEData(E["e:infopage"],"e:component",{"@type":"picture","@component_name":"logo"});if(F&&F.length>0){w.push('<li class="',this.getCssClassName("logotype"),'"><a href="'+q+'"><img width="70" class="photo" src="',F[0]["e:src"],'" alt="" /></a></li>')}if(w&&w.length>0){p.push('<ul class="',this.getCssClassName("properties"),'">');p=p.concat(w);p.push("</ul>")}var z=[];if((k&&k.length>0)||(h&&h.length>0)){z.push("<ul>");z=z.concat(k);z=z.concat(h);z.push("</ul>")}var v=[];if((z&&z.length>0)||(g&&g.length>0)){v=v.concat(z);v=v.concat(this.formatCoordinates(g))}var t={score:E["e:average_rating"],url:E["e:rating_url"],ratings:E["e:number_of_ratings"],reviews:E["e:number_of_reviews"]};var l=this.provider.substring(0,this.provider.indexOf("_"));if(this.CLASS_NAME!=="Eniro.AggregatedPopupResultItem"){Eniro.AppEvents.triggerEvent(Eniro.Events.STATISTICS_LOG,{scope:"contentItem",event:l,data:{addaxUrl:this.getEDataValue(E["e:statistics"],"@src")||this.getEDataValue(E["e:statistics"]["e:img"],"@src"),provider:this.provider,feature:this.feature}})}F={hasUrl:(E.link&&E.link["@href"]),url:q,title:G,rating:t,contactinfo:v,phones:k,properties:p,links:d};return F},drawWpSe:function(){var h=this.formatWpSe();var f=(h.properties&&h.properties.length>0);var b=[];if(h.phones.length>0){b=['<ul class="'+this.getCssClassName("phones")+'">',h.phones.join(""),"</ul>"]}var k=[];if(h.addresses.length>0){k=['<ul class="'+this.getCssClassName("addresses")+'">',h.addresses.join(""),"</ul>"]}var c=[];if(h.properties.length>0){c=['<ul class="',this.getCssClassName("properties"),'">',h.properties.join(""),"</ul>"]}var a=[];if(h.links.length>0){a=['<ul class="'+this.getCssClassName("links")+'">',h.links.join(""),"</ul>"]}var g=[];if(h.partners.length>0){g=['<div class="'+this.getCssClassName("partners")+'">',h.partners.join(""),"</div>"]}var d=[];if(h.presentation.length>0){d=['<dl class="',this.getCssClassName("presentation"),'">',h.presentation.join(""),"</dl>"]}return['<li class="',this.getCssClassName("item"+(!f?" norightcol":"")),' vcard">','<div class="',this.getCssClassName("left"),'">','<div class="',this.getCssClassName("title"),'">',"<em>",this.getOrdinal(),".</em>","<h2>",(h.name||h.companyname),"</h2>","</div>",b.join(""),k.join(""),"</div>",((c.length>0)?'<div class="'+this.getCssClassName("right")+'">'+c.join("")+"</div>":""),d.join(""),a.join(""),(h.frontdoor?h.frontdoor.join(""):""),g.join(""),"</li>"].join("")},formatWpSe:function(){var g=this.buildWpSe();this.cssClasses.route=this.getCssClassName("route");var a;if(g.name){if(g.isCelebrity){a=this.formatCelebTitle(g.name,g.url)}else{a=this.formatWpTitle(g.name,g.url,false)}}else{if(g.companyname){a=this.formatWpTitle(g.companyname,g.url,false)}else{a="-"}}var o=[];if(this.feature&&this.feature.geometry){o.push(this.formatListItemLink("route","/"+new Date().getTime()))}var c=[];if(g.phones.length>0){for(i=0,n=g.phones.length;i<n;++i){c.push(this.formatPhone(g.phones[i]))}}var d=[];if(g.addresses.length>0){for(i=0,n=g.addresses.length;i<n;++i){d.push(this.formatAddress(g.addresses[i]))}}var k=this.formatCoordinates(g.coordinates);var h=[];if(g.presentation.image){var f='<li class="'+this.getCssClassName("logotype")+'">';if(g.url){f+='<a href="">'}f+='<img width="70" class="photo" src="'+g.presentation.image+'" alt="" />';if(g.url){f+="</a>"}f+="</li>";h.push(f)}var p=[];if(g.partnerLinks&&g.partnerLinks.length>0){var l="";var b;for(i=0,n=g.partnerLinks.length;i<n;i++){b=g.partnerLinks[i];if(b.href&&b.label){if(b.type&&b.type.toLowerCase()==="euroflorist"){l='<a class="eniro-new '+this.getCssClassName(b.type)+'" href="'+b.href+'"><span>'+this.i18n("send-flowers")+"</span></a>"}else{p.push('<a class="eniro-new '+this.getCssClassName(b.type)+'" href="'+b.href+'"><span>'+this.i18n(b.type)+"</span></a>")}}}if(l){p.unshift(l+" ")}}g={name:a,title:g.title,companyname:g.companyname,links:o,phones:c,addresses:d,coordinates:k,properties:h,partners:p,presentation:[]};return g},buildWpSe:function(){var A,t,p,k,q,c,u;var z=this.getPropertyList();var h=(z.link&&z.link["@href"])?z.link["@href"]+this.getSearchItemLinkData("wp_se"):"/"+new Date().getTime();if(h[0]!=="/"&&h.indexOf("http://")!==0){h="http://"+h}var D=[];if(OpenLayers.String.trim(z["e:first_name"])){D.push(z["e:first_name"])}if(OpenLayers.String.trim(z["e:last_name"])){D.push(z["e:last_name"])}D=D.join(" ");var C="";if(z["e:title"]&&OpenLayers.String.trim(z["e:title"])){C+=z["e:title"]}var s="";if(z["e:company_name"]&&OpenLayers.String.trim(z["e:company_name"])){s=z["e:company_name"]}var b=this.getCoordinates(z);var a=[];var f;var g=[];A=this.getEData(z["e:addresses"],"e:address");if(Eniro.Util.isArray(A)&&A.length>0){for(t=0,p=A.length;t<p;++t){var l=[];g=this.getEData(A[t]["e:phone_numbers"],"e:phone_number");if(Eniro.Util.isArray(g)&&g.length>0){for(j=0,m=g.length;j<m;++j){l.push(this.getEDataValue(g[j]))}}var d={streetName:this.getEDataValue(A[t],"e:street_name"),streetNumber:this.getEDataValue(A[t],"e:street_number"),postalCode:this.getEDataValue(A[t],"e:post_code"),postArea:this.getEDataValue(A[t],"e:post_area"),phones:l};a.push(d);if(A[t]["@match"]&&A[t]["@match"]==="true"){f=d}}}g=[];A=this.getEData(z["e:phones"],"e:phone_number");if(Eniro.Util.isArray(A)&&A.length>0){for(t=0,p=A.length;t<p;++t){var B=this.getEDataValue(A[t]);if(B){g.push(B)}}}var o=[];A=this.getEData(z["e:partners"],"e:partner");if(Eniro.Util.isArray(A)&&A.length>0){for(t=0,p=A.length;t<p;++t){u=this.getEDataValue(A[t],"e:url");k=this.getEDataValue(A[t],"e:label");c=this.getEDataValue(A[t],"@type");if(u&&k){o.push({href:u,label:k,type:c})}}}var w={};if(z["e:presentation"]&&typeof z["e:presentation"]!=="string"){for(t in z["e:presentation"]){if(OpenLayers.String.trim(z["e:presentation"][t])&&z["e:presentation"][t]){w[t.replace("e:","")]=z["e:presentation"][t]}}}var r=[];A=this.getEData(z["e:ealiases"],"e:ealias");if(Eniro.Util.isArray(A)&&A.length>0){for(t=0,p=A.length;t<p;++t){q=this.getEDataValue(A[t],"#text");c=this.getEDataValue(A[t],"@type");u="";var v=false;switch(c){case"email":u="mailto:"+q;break;case"linkedin":case"facebook":case"twitter":case"flickr":case"youtube":case"myspace":v=true;u=this.formatEAliasURL(c,q);break;default:u=this.formatEAliasURL(c,q)}r.push({type:c,href:u,value:q,icon:v})}}return{aliases:r,presentation:w,partnerLinks:o,phones:g,addresses:a,matchedAddress:f,url:h,name:D,title:C,companyname:s,coordinates:b,isCelebrity:(z["e:record_type"]&&z["e:record_type"]==="celebrity")}},formatGeoSe:function(){var a=this.buildGeoSe();return['<li class="'+this.getCssClassName("item")+'">','<div class="'+this.getCssClassName("title")+'">',"<em>"+this.getOrdinal()+"</em>","<h2>"+this.formatGeoTitle(a.address.join(""))+"</h2>","</div>","</li>"].join("")},buildGeoSe:function(){var c=this.getPropertyList();var b;var d=[];if(this.feature.geometry&&this.feature.geometry.coordinates){b=this.feature.geometry.coordinates}if(b.length>0){d.push(this.formatCoordinates(b))}b=c.address;var a=[];if(b.streetName){a.push(b.streetName)}if(b.streetNumber){a.push(" ");a.push(b.streetNumber)}if(a.length>0){a.push(",")}if(b.postalCode){a.push(" ");if(Eniro.Profile.postalCodeMinSize){while(b.postalCode.length<Eniro.Profile.postalCodeMinSize){b.postalCode="0"+b.postalCode}}a.push(b.postalCode)}if(b.postArea&&Eniro.Profile.providers[this.provider]&&Eniro.Profile.providers[this.provider].postAreaHasPrecedence){a.push(" ");a.push(b.postArea)}else{if(b.city){a.push(" ");a.push(b.city)}}b={address:a};return b},formatYpPtrSe:function(){return this.formatYpSe.apply(this,arguments)},formatYpFi:function(){var a=this.buildYpSe();return['<li class="',this.getCssClassName("item"),' vcard">','<div class="',this.getCssClassName("title"),'">',"<em>"+this.getOrdinal()+".</em>","<h2>"+this.formatYpTitle(a.title,a.url,false)+"</h2>",this.formatRating("star",a.rating),"</div>",'<div class="',this.getCssClassName("left"),'">',a.contactinfo.join(""),"</div>",((a.properties.length>0)?'<div class="'+this.getCssClassName("right")+'">'+a.properties.join("")+"</div>":""),a.links.join(""),"</li>"].join("")},drawWpFi:function(){return this.drawWpSe.apply(this,arguments)},formatWpFi:function(){return this.formatWpSe.apply(this,arguments)},formatGeoFi:function(){return this.formatGeoSe.apply(this,arguments)},formatYpPtrFi:function(){return this.formatYpFi.apply(this,arguments)},formatYpDk:function(){var b=this.buildYpSe();var a=b.properties.length>0;return['<li class="',this.getCssClassName("item"+(!a?" norightcol":"")),' vcard">','<div class="',this.getCssClassName("title"),'">',"<em>"+this.getOrdinal()+".</em>","<h2>"+this.formatYpTitle(b.title,b.url,false)+"</h2>","</div>",'<div class="',this.getCssClassName("left"),'">',b.contactinfo.join(""),"</div>",((b.properties.length>0)?'<div class="'+this.getCssClassName("right")+'">'+b.properties.join("")+"</div>":""),b.links.join(""),"</li>"].join("")},drawWpDk:function(){return this.drawWpSe.apply(this,arguments)},formatWpDk:function(){return this.formatWpSe.apply(this,arguments)},formatGeoDk:function(){return this.formatGeoSe.apply(this,arguments)},formatYpPtrDk:function(){return this.formatYpPtrSe.apply(this,arguments)},formatYpDkKrak:function(){return this.formatYpDk.apply(this,arguments)},drawWpDkKrak:function(){return this.drawWpDk.apply(this,arguments)},formatWpDkKrak:function(){return this.formatWpDk.apply(this,arguments)},formatGeoDkKrak:function(){return this.formatGeoDk.apply(this,arguments)},formatYpPtrDkKrak:function(){return this.formatYpPtrDk.apply(this,arguments)},formatEAliasURL:function(b,a){b=b.toLowerCase();if(/http[s]?[\/:][\/\/][\/\/]/.test(a)){return a}switch(b){case"linkedin":if(/^[a-z][a-z0-9]{5,30}$/i.test(a)){a="http://www.linkedin.com/in/"+a}else{if(/^[0-9]{2,}$/.test(a)){a="http://www.linkedin.com/profile?viewProfile=&key="+a}else{if(!/^www.linkedin.com/i.test(a)){if(/^[\/\/]/.test(a)){a="http://www.linkedin.com"+a}else{a="http://www.linkedin.com/"+a}}}}break;case"facebook":if(/^[a-z][a-z0-9.]{2,}$/i.test(a)){a="http://facebook.com/"+a}else{if(/^[0-9]{2,}$/.test(a)){a="http://www.facebook.com/profile.php?id="+a}else{if(!/^(www.)?facebook.([a-z]{2,}){1,}/i.test(a)){if(/^[\/\/]/.test(a)){a="http://www.facebook.com"+a}else{a="http://www.facebook.com/"+a}}}}break;case"twitter":if(/^[a-z0-9_]+$/i.test(a)){a="http://twitter.com/"+a}else{if(!/^(www.)?twitter.com/i.test(a)){if(/^[\/\/]/.test(a)){a="http://twitter.com"+a}else{a="http://twitter.com/"+a}}}break;case"homepage":case"blog":break;case"skype":return"skype:"+a;case"youtube":if(/^[a-z0-9.]+$/i.test(a)){a="http://youtube.com/"+a}else{if(!/^(www.)?youtube.com/i.test(a)){if(/^[\/\/]/i){a="http://youtube.com"+a}else{a="http://youtube.com/"+a}}}break;case"myspace":if(/^[0-9]+$/.test(a)){a="http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid="+a}else{if(/^[a-z0-9-_.]+$/i.test(a)){a="http://www.myspace.com/"+a}else{if(!/^([a-z0-9]+.)?myspace.com/i.test(a)){if(/^[\/\/]/.test(a)){a="http://www.myspace.com"+a}else{a="http://www.myspace.com/"+a}}}}break;case"flickr":if(/^[a-z0-9\/-_]+$/i.test(a)){a="http://www.flickr.com/"+a}else{if(!/^([a-z0-9]+.)?flickr.com/i.test(a)){if(/^[\/\/]/.test(a)){a="http://www.flickr.com"+a}else{a="http://www.flickr.com/"+a}}}break;case"bilddagboken":if(/^[a-z0-9\/\-]+$/i.test(a)){a="http://"+a+".bilddagboken.se/"}break;case"icq":if(/^[a-z0-9]+$/i.test(a)){a="http://www.icq.com/people/about_me.php?uin="+a}break;case"msn":if(/^[a-z0-9.\/_\/%+\/\-]+@(?:[a-z0-9\/\-]+.)+[a-z]{2,4}$/i.test(a)){a="http://spaces.live.com/profile.aspx?mem="+a}break}return this.prependProtocol(a)},prependProtocol:function(a,b){b=b||"http";if(OpenLayers.String.startsWith(a,b+"://")){return a}else{return b+"://"+a}},getSearchItemLinkData:function(b){var a="";if(this.searchItemLinkData&&this.searchItemLinkData!==""){switch(b){case"yp_se":case"yp_no":a="&"+this.searchItemLinkData;break;case"wp_se":case"wp_no":a="?"+this.searchItemLinkData;break;default:}}return a},draw:function(){var a=OpenLayers.String.camelize("draw-"+(this.provider.replace(/_/gi,"-")));if(!this[a]){a=OpenLayers.String.camelize("format-"+(this.provider.replace(/_/gi,"-")));if(!this[a]){this.error("Missing formatting function for provider: "+this.provider);return null}}this.div=this[a]().toDomElement();return null},hasStreetViewImage:function(){return this.provider&&this.provider.match(/^(geo|yp|wp)_(se|fi|no|dk|dk_krak)$/)},isStreetviewImageAllowed:function(){return this.provider&&this.provider.match(/^geo_(se|fi|no|dk|dk_krak)$/)},hasAtThisAddressInfo:function(){return this.provider&&this.provider.match(/geo/)&&this.feature.properties.cmpType!="21"&&Eniro.Profile.reverse_lookup_providers},CLASS_NAME:"Eniro.SearchResultItem"});Eniro.SearchResultItemInfo=OpenLayers.Class(Eniro.SearchResultItem,{streetviewData:null,initialize:function(){Eniro.SearchResultItem.prototype.initialize.apply(this,arguments);this.register(Eniro.Events.MAP_TYPES_UPDATE,this.onMapTypesUpdate)},destroy:function(){this.feature=null;this.provider=null;this.streetviewLink=null;if(this.streetviewFrontdoorImage){OpenLayers.Event.stopObserving(this.streetviewFrontdoorImage);this.streetviewFrontdoorImage=null}Eniro.SearchResultItem.prototype.destroy.apply(this,arguments)},activate:function(){if(Eniro.SearchResultItem.prototype.activate.apply(this,arguments)){this.checkForStreetView();this.checkForAddressInfo();return true}return false},onMapTypesUpdate:function(a){this.streetViewAvailable=(a&&a.maptypes&&a.maptypes.streetview);if(this.hasStreetViewImage()){this.checkForStreetView()}},onMouseOver:null,onMouseOut:null,onClick:function(b){var g=OpenLayers.Event.element(b);var a=jQuery(g).closest("li").get(0);var c=null;if(this.elements.atThisAddressItem){c=this.elements.atThisAddressItem.indexOf(a)}if(jQuery(g).closest("li.eniro-searchresultiteminfo-route").size()>0){OpenLayers.Event.stop(b);Eniro.AppEvents.triggerEvent(Eniro.Events.STATISTICS_LOG,{scope:"navigate",event:"itemRoute",data:{addaxUrl:this.getEDataValue(this.getPropertyList()["e:statistics"],"@src"),provider:this.provider,feature:this.feature}});var k=this.feature.id;var f=this.map.wfs.getTransientFeature(k);if(f){this.convertMarker(f,Eniro.Constant.MarkerTypes.ROUTE)}}else{if(jQuery(g).closest("a.eniro-searchresultiteminfo-homepage").size()>0){Eniro.AppEvents.triggerEvent(Eniro.Events.STATISTICS_LOG,{scope:"navigate",event:"itemHomepage",data:{addaxUrl:this.getEDataValue(this.getPropertyList()["e:statistics"],"@src"),provider:this.provider,feature:this.feature}})}else{if((this.streetviewData&&this.streetviewLink&&(g===this.streetviewLink||jQuery(g).parent().get(0)===this.streetviewLink))||this.streetviewFrontdoorImage===g){OpenLayers.Event.stop(b);var h={};jQuery.extend(true,h,this.streetviewData);h.heading=Math.round(this.streetviewHeading)+180;this.triggerEvent(Eniro.Events.STATE_SAVING_MODE_SWITCH,{mode:"streetview",_streetViewLonLat:this.streetViewPointResult,_streetviewData:h})}else{if(c!==null&&c>=0){OpenLayers.Event.stop(b);var d=Eniro.Profile.reverse_lookup_providers[c];this.triggerEvent(Eniro.Events.SEARCH_DO,{p:Eniro.Profile.reverse_lookup_providers,ap:d,q:Eniro.Util.FeatureUtils.getAddressAsString(this.feature),reverseLookup:1,_enableBack:"back-to-single-address"})}}}}},checkForAddressInfo:function(){if(this.hasAtThisAddressInfo()){this.triggerEvent(Eniro.Events.SEARCH_DO,{p:Eniro.Profile.reverse_lookup_providers,q:this.getAddressAsString(),reverseLookup:1,_disableHistory:true,success:OpenLayers.Function.bind(this.onCheckForAddressInfoSuccess,this),error:OpenLayers.Function.bind(this.onCheckForAddressInfoFailure,this),dataFilter:function(a){return JSON.parse(JSON.stringify(a))}})}},checkForStreetView:function(){if(this.hasStreetViewImage()&&!this.streetviewData&&this.streetViewAvailable){var a;if(this.feature.properties.lonlat){a=this.feature.properties.lonlat}else{if(this.feature.geometry&&this.feature.geometry.coordinates){a={lon:this.feature.geometry.coordinates[0],lat:this.feature.geometry.coordinates[1]}}}if(a){this.streetViewPointSource=new OpenLayers.LonLat(a.lon,a.lat);jQuery.jsonp({url:Eniro.AppNode.appUrl("/streetview/search"),data:{north:this.streetViewPointSource.lat,east:this.streetViewPointSource.lon},callbackParameter:"callback",success:OpenLayers.Function.bind(this.onStreetViewQuerySuccess,this),error:OpenLayers.Function.bind(this.onStreetViewQueryFailure,this)})}}},onCheckForAddressInfoSuccess:function(g,c){if(g&&g.json&&g.json.search){g=g.json.search;var h,a,b,f;for(var d=0,k=Eniro.Profile.reverse_lookup_providers.length;d<k;++d){h=Eniro.Profile.reverse_lookup_providers[d];a=(g[h]&&g[h].totalHits)?g[h].totalHits:0;b=Eniro.Profile.providers[h].id;this.appendLink("atThisAddressItem",b,null,null,{hits:a})}this.sizeToFit()}},onCheckForAddressInfoFailure:function(b,a){},onStreetViewQuerySuccess:function(g,b){if(g&&g.length===1){this.streetviewData=g[0];this.streetViewPointResult=new OpenLayers.LonLat(this.streetviewData.e,this.streetviewData.n);var k=50;if(this.feature.properties.cmpType){if(this.feature.properties.cmpType=="11"||this.feature.properties.cmpType=="12"){k=50}else{if(this.feature.properties.cmpType=="21"){k=200}else{if(this.feature.properties.cmpType=="22"||this.feature.properties.cmpType=="31"){k=100}}}}if(OpenLayers.Util.distVincenty(this.streetViewPointSource,this.streetViewPointResult)*1000<k){this.streetviewHeading=Eniro.Util.bearing(this.streetViewPointResult,this.streetViewPointSource);var c=this.streetviewData.url;var h=Eniro.AppNode.streetviewFrontdoorUrl();h=h+"?"+["path="+c,"lod=1","b="+Math.round(this.streetviewHeading),"p=0","w=330","h=130"].join("&");if(h){var a=jQuery(this.div).find("h2:eq(0)").text();var f=this.i18n("frontdoor-alt",{address:a});if(this.streetviewFrontdoorImage){OpenLayers.Event.stopObservingElement(this.streetviewFrontdoorImage);jQuery(this.streetviewFrontdoorImage).remove();this.streetviewFrontdoorImage=null}if(this.streetviewFrontdoorContainer){jQuery(this.streetviewFrontdoorContainer).remove()}if(this.isStreetviewImageAllowed()){this.streetviewFrontdoorImage=jQuery('<img class="'+this.getSingleCssClassName("frontdoor-image")+'" alt="'+f+'" title="'+f+'"/>').get(0);OpenLayers.Event.observe(this.streetviewFrontdoorImage,"load",OpenLayers.Function.bind(this.streetviewFrontdoorImageLoad,this));OpenLayers.Event.observe(this.streetviewFrontdoorImage,"error",OpenLayers.Function.bind(this.streetviewFrontdoorImageError,this))}if(this.streetviewFrontdoorImage){this.streetviewLink=jQuery('<a class="'+this.getSingleCssClassName("frontdoor-link")+'" href="/'+new Date().getTime()+'">'+this.i18n("frontdoor")+"</a>").get(0);this.streetviewFrontdoorContainer=jQuery('<div class="'+this.getSingleCssClassName("frontdoor-container")+'"></div>').get(0);jQuery(this.elements.frontdoor).html(this.streetviewFrontdoorContainer);jQuery(this.streetviewFrontdoorContainer).append(this.streetviewLink).append(this.streetviewFrontdoorImage);this.streetviewFrontdoorImage.src=h}else{if(!this.streetviewLink){if(this.elements.route){jQuery(this.elements.route).remove()}var d=this.getSingleCssClassName("frontdoor-link-noimage");this.appendLink("route","route");this.appendLink("frontdoor-link-noimage","frontdoor");this.streetviewLink=jQuery("."+d).get(0)}}}}}else{jQuery(this.elements.frontdoor).remove()}this.sizeToFit()},streetviewFrontdoorImageLoad:function(a){OpenLayers.Event.stopObservingElement(this.streetviewFrontdoorImage);this.sizeToFit()},streetviewFrontdoorImageError:function(a){OpenLayers.Event.stopObservingElement(this.streetviewFrontdoorImage);jQuery(this.elements.frontdoor).remove();this.streetviewFrontdoorImage=null;this.sizeToFit()},appendLink:function(b,h,a,g,d){this.cssClasses[b]=this.getCssClassName(b);var c=this.getCssClassName("links-item","last",{position:"last"});jQuery(this.elements.links).find("."+c.split(" ").join(".")).removeClass(c);if(!a){a="/"+new Date().getTime()}var f="";if(g){f=' class="eniro-new"'}jQuery(this.elements.links).append(['<li class="',this.getCssClassName("links-item",null,{position:"last"})," ",this.cssClasses[b],'">',"<a"+f+' href="'+a+'">',this.i18n(h||b,d),"</a>","</li>"].join(""));this.assignElements()},sizeToFit:function(){var a=this.map.getControl(Eniro.ControlID.TABNAVIGATOR_MAIN);if(a){a=a.getTabView("search");if(a){a.sizeToFit()}}},onStreetViewQueryFailure:function(b,a){},getAddressAsString:function(){var a=this.feature.feature||this.feature;if(!this.feature.feature){a.attributes=a.attributes||a.properties;a.attributes.source=this.provider}return Eniro.Util.FeatureUtils.getAddressAsString(a)},formatGeoSe:function(){var a=this.buildGeoSe();this.cssClasses.frontdoor=this.getCssClassName("frontdoor");this.cssClasses.links=this.getCssClassName("links");return['<li class="',this.getCssClassName("item"),'">',"<h2>",a.address.join(""),"</h2>",'<ul class="',this.cssClasses.links,'">','<li class="',this.getCssClassName("links-item",null,{id:"route",position:"last"})," ",this.getSingleCssClassName("route"),'">','<a href="/'+new Date().getTime()+'">',this.i18n("route"),"</a>","</li>","</ul>",'<div class="',this.cssClasses.frontdoor,'"></div>',"</li>"].join("")},buildYpSe:function(){var a=Eniro.SearchResultItem.prototype.buildYpSe.apply(this,arguments);var b=this.getPropertyList();a.infopage=b["e:infopage"];a.email=b["e:email"];a.website=b["e:homepage_url"];if(a.website.indexOf("http")<0){a.website="http://"+a.website}return a},formatYpSe:function(){var g=this.buildYpSe();this.cssClasses.frontdoor=this.getCssClassName("frontdoor");this.cssClasses.links=this.getCssClassName("links");var h=[];var d=["click_to_call"];if(g&&g.infopage&&g.infopage.length>0&&Eniro.Util.isArray(g.infopage)){for(var f=0,k=g.infopage.length;f<k;++f){var c=g.infopage[f]["e:component"];if(c&&jQuery.inArray(c["@component_name"],d)<0){if(c["@type"]==="text"&&c["#text"]){if(c["@component_name"]==="company_description"){h.unshift("<p>"+c["#text"]+"</p> ")}else{h.push("<p>"+c["#text"]+"</p> ")}}else{if(c["@type"]==="picture"){if(c["e:url"]){h.push('<a href="'+c["e:url"]+'" class="eniro-new">')}h.push('<img src="'+c["e:src"]+'" alt="" /> ');if(c["e:url"]){h.push("</a> ")}}}}}}if(h&&h.length>0){h.unshift('<div class="'+this.getCssClassName("info")+'">');h.push("</div>")}var b="";var a="";if(g.email){b='<a style="display:block;clear:left;" href="mailto:'+g.email+'" class="eniro-new">'+g.email+"</a>"}if(g.website){if(g.website!=="http://"){a='<a style="display:block;clear:left;" href="'+g.website+'" class="eniro-new '+this.getCssClassName("homepage")+'">'+this.i18n("homepage")+"</a>"}}return['<li class="',this.getCssClassName("item"),' vcard">','<div class="'+this.getCssClassName("rating rejta")+'">',this.formatRating("rejta",g.rating),(g.rating&&g.rating.url&&g.rating.ratings?'<a href="'+g.rating.url+'" class="eniro-new">'+g.rating.ratings+" "+this.i18n("ratings")+"</a> ":""),(g.rating&&g.rating.url?'<a href="'+g.rating.url+'" class="eniro-new">'+this.i18n("rate")+"</a>":""),"</div>",(g.title?'<div class="'+this.getCssClassName("title")+'"><h2>'+this.formatYpTitle(g.title,g.url,false)+"</h2></div>":""),'<div class="',this.getCssClassName("left"),'">',g.contactinfo.join(""),"</div>",'<div class="',this.getCssClassName("right"),'">',g.properties.join(""),"</div>",b,a,g.links.join(""),'<div class="',this.cssClasses.frontdoor,'"></div>',(g.hasUrl?'<a class="'+this.getCssClassName("more")+'" href="'+g.url+'">'+this.i18n("more-info")+" &raquo;</a>":""),h.join(""),"</li>"].join("")},buildWpSe:function(){return Eniro.SearchResultItem.prototype.buildWpSe.apply(this,arguments)},formatWpSe:function(){var f=this.buildWpSe();var d=Eniro.SearchResultItem.prototype.formatWpSe.apply(this,arguments);this.cssClasses.frontdoor=this.getCssClassName("frontdoor");this.cssClasses.links=this.getCssClassName("links");d.frontdoor=['<div class="',this.cssClasses.frontdoor,'"></div>'];var b=[];if(f.title){b.push('<dt class="'+this.getCssClassName("title")+'">'+this.i18n("title")+":</dt><dd>"+f.title+"</dd>")}if(f.presentation.employed_by){b.push('<dt class="'+this.getCssClassName("employed_by")+'">'+this.i18n("employed_by")+":</dt><dd>"+f.presentation.employed_by+"</dd>")}if(Eniro.Util.isArray(f.aliases)&&f.aliases.length>0){var o=[];var g;for(i=0,n=f.aliases.length;i<n;++i){g=f.aliases[i];if(g.icon){o.push('<a href="'+g.href+'" class="eniro-new '+this.getCssClassName("network "+g.type)+'"><span>'+g.value+"</span></a>")}}for(i=0,n=f.aliases.length;i<n;++i){g=f.aliases[i];if(g.type==="email"){continue}if(!g.icon){var p='<dt class="'+this.getCssClassName(g.type)+'">'+this.i18n(g.type)+":</dt><dd>";if(g.href){p+='<a href="'+g.href+'" class="eniro-new">'}p+=g.value;if(g.href){p+="</a>"}p+="</dd>";b.push(p)}}if(o.length>0){b.splice(1,0,"<dt>"+this.i18n("networks")+'</dt><dd class="'+this.getCssClassName("networks")+'">'+o.join("")+"</dd>")}}if(b.length>0){b=['<dl class="'+this.getCssClassName("aliases")+'">',b.join(""),"</dl>"]}var q=[];if(f.partnerLinks&&f.partnerLinks.length>0){for(i=0,n=f.partnerLinks.length;i<n;i++){var a=f.partnerLinks[i];if(a.href&&a.label){if(a.type&&a.type.toLowerCase()==="euroflorist"){q.unshift(this.formatListItemLink(a.type,a.href,a.label,true))}else{q.push(this.formatListItemLink(a.type,a.href,a.label,true))}}}}if(q.length>0){q=['<ul class="'+this.getCssClassName("partners")+'">',q.join(""),"</ul>"]}if(f.presentation.birthday){var l=f.presentation.birthday;var k,h;if(l.indexOf("-")>=0){l=f.presentation.birthday.split("-");k=l[1];h=l[2]}else{l=f.presentation.birthday.split("");k=l[4]+""+l[5];h=l[6]+""+l[7]}}if(Eniro.Profile.id!=="dk"&&Eniro.Profile.id!=="dk_krak"&&f.presentation.name_day){var c=f.presentation.name_day.split("");q.unshift('<span class="'+this.getCssClassName("nameday")+'">'+f.name+" "+this.i18n("nameday")+" "+parseInt(c[6]+""+c[7],10)+" "+this.i18n("month-"+c[4]+""+c[5])+"</span>")}q.unshift("<h3>"+this.i18n("send-flowers-gifts")+"</h3>");d.partners=q;if(b.length>0){d.presentation=d.presentation.concat(b)}if(Eniro.Profile.id==="se"){d.partners=d.partners.concat('<a href="'+f.url+'#person-abuse" class="eniro-new '+this.getCssClassName("abuse")+'">'+this.i18n("abuse")+"</a>")}return d},buildGeoSe:function(){var a=Eniro.SearchResultItem.prototype.buildGeoSe.apply(this,arguments);return a},formatYpFi:function(){var d=this.buildYpSe();this.cssClasses.frontdoor=this.getCssClassName("frontdoor");this.cssClasses.links=this.getCssClassName("links");var f=[];var b=["click_to_call"];if(d&&d.infopage&&d.infopage.length>0&&Eniro.Util.isArray(d.infopage)){for(var c=0,g=d.infopage.length;c<g;++c){var a=d.infopage[c]["e:component"];if(a&&jQuery.inArray(a["@component_name"],b)<0){if(a["@type"]==="text"&&a["#text"]){if(a["@component_name"]==="company_description"){f.unshift("<p>"+a["#text"]+"</p> ")}else{f.push("<p>"+a["#text"]+"</p> ")}}else{if(a["@type"]==="picture"){if(a["e:url"]){f.push('<a href="'+a["e:url"]+'" class="eniro-new">')}f.push('<img src="'+a["e:src"]+'" alt="" /> ');if(a["e:url"]){f.push("</a> ")}}}}}}if(f&&f.length>0){f.unshift('<div class="'+this.getCssClassName("info")+'">');f.push("</div>")}return['<li class="',this.getCssClassName("item"),' vcard">','<div class="',this.getCssClassName("title"),'">',(d.title?"<h2>"+this.formatYpTitle(d.title,d.url,false)+"</h2>":""),"</div>",'<div class="',this.getCssClassName("left"),'">',d.contactinfo.join(""),"</div>",'<div class="',this.getCssClassName("right"),'">',d.properties.join(""),"</div>",d.links.join(""),'<div class="',this.cssClasses.frontdoor,'"></div>',(d.hasUrl?'<a class="'+this.getCssClassName("more")+'" href="'+d.url+'">'+this.i18n("more-info")+" &raquo;</a>":""),f.join(""),"</li>"].join("")},formatYpDk:function(){var g=this.buildYpSe();this.cssClasses.frontdoor=this.getCssClassName("frontdoor");this.cssClasses.links=this.getCssClassName("links");var h=[];var d=["click_to_call"];if(g&&g.infopage&&g.infopage.length>0&&Eniro.Util.isArray(g.infopage)){for(var f=0,k=g.infopage.length;f<k;++f){var c=g.infopage[f]["e:component"];if(c&&jQuery.inArray(c["@component_name"],d)<0){if(c["@type"]==="text"&&c["#text"]){if(c["@component_name"]==="company_description"){h.unshift("<p>"+c["#text"]+"</p> ")}else{h.push("<p>"+c["#text"]+"</p> ")}}else{if(c["@type"]==="picture"){if(c["e:url"]){h.push('<a href="'+c["e:url"]+'" class="eniro-new">')}h.push('<img src="'+c["e:src"]+'" alt="" /> ');if(c["e:url"]){h.push("</a> ")}}}}}}if(h&&h.length>0){h.unshift('<div class="'+this.getCssClassName("info")+'">');h.push("</div>")}var b="";var a="";if(g.email){b='<a style="display:block;clear:left;" href="mailto:'+g.email+'" class="eniro-new">'+g.email+"</a>"}if(g.website){if(g.website!=="http://"){a='<a style="display:block;clear:left;" href="'+g.website+'" class="eniro-new '+this.getCssClassName("homepage")+'">'+this.i18n("homepage")+"</a>"}}return['<li class="',this.getCssClassName("item"),' vcard">','<div class="'+this.getCssClassName("rating rejta")+'">',(g.rating&&g.rating.url&&g.rating.ratings?'<a href="'+g.rating.url+'" class="eniro-new">'+g.rating.ratings+" "+this.i18n("ratings")+"</a> ":""),(g.rating&&g.rating.url?'<a href="'+g.rating.url+'" class="eniro-new">'+this.i18n("rate")+"</a>":""),"</div>",(g.title?'<div class="'+this.getCssClassName("title")+'"><h2>'+this.formatYpTitle(g.title,g.url,false)+"</h2></div>":""),'<div class="',this.getCssClassName("left"),'">',g.contactinfo.join(""),"</div>",'<div class="',this.getCssClassName("right"),'">',g.properties.join(""),"</div>",b,a,g.links.join(""),'<div class="',this.cssClasses.frontdoor,'"></div>',(g.hasUrl?'<a class="'+this.getCssClassName("more")+'" href="'+g.url+'">'+this.i18n("more-info")+" &raquo;</a>":""),h.join(""),"</li>"].join("")},buildYpNo:function(){var a=Eniro.SearchResultItem.prototype.buildYpNo.apply(this,arguments);var b=this.getPropertyList();a.email=b.eMail;a.website=b.homePage;if(a.website&&a.website.indexOf("http")<0){a.website="http://"+a.website}return a},formatYpNo:function(){var c=this.buildYpNo();this.cssClasses.frontdoor=this.getCssClassName("frontdoor");this.cssClasses.links=this.getCssClassName("links");var b="";var a="";if(c.email){b='<a style="display:block;clear:left;" href="mailto:'+c.email+'" class="eniro-new">'+c.email+"</a>"}if(c.website){if(c.website!=="http://"){a='<a style="display:block;clear:left;" href="'+c.website+'" class="eniro-new '+this.getCssClassName("homepage")+'">'+this.i18n("homepage")+"</a>"}}return['<li class="',this.getCssClassName("item"),' vcard">','<div class="',this.getCssClassName("title"),'">',(c.title?"<h2>"+this.formatYpTitle(c.title,c.url,false)+"</h2>":""),"</div>",'<div class="',this.getCssClassName("left"),'">',c.contactinfo.join(""),"</div>",'<div class="',this.getCssClassName("right"),'">',c.properties.join(""),"</div>",b,a,c.links.join(""),'<div class="',this.cssClasses.frontdoor,'"></div>',(c.hasUrl?'<a class="'+this.getCssClassName("more")+'" href="'+c.url+'">'+this.i18n("more-info")+" &raquo;</a>":""),"</li>"].join("")},formatGeoNo:function(){var a=this.buildGeoNo();this.cssClasses.frontdoor=this.getCssClassName("frontdoor");this.cssClasses.links=this.getCssClassName("links");return['<li class="'+this.getCssClassName("item")+'">','<div class="'+this.cssClasses.links+'">',"<h2>"+a.address+"</h2>",'<ul class="',this.cssClasses.links,'">','<li class="',this.getCssClassName("links-item",null,{position:"last"})," ",this.getCssClassName("route"),'">','<a href="/'+new Date().getTime()+'">',this.i18n("route"),"</a>","</li>",'<div class="',this.cssClasses.frontdoor,'"></div>',"</ul>","</div>","</li>"].join("")},formatWpNo:function(){var a=Eniro.SearchResultItem.prototype.formatWpNo.apply(this,arguments);this.cssClasses.frontdoor=this.getCssClassName("frontdoor");this.cssClasses.links=this.getCssClassName("links");a.frontdoor=['<div class="',this.cssClasses.frontdoor,'"></div>'];return a},CLASS_NAME:"Eniro.SearchResultItemInfo",SUPER:"Eniro.SearchResultItem"});Eniro.SearchResultTabView=OpenLayers.Class(Eniro.TabView,{provider:null,collapsible:false,listItems:null,isPaged:false,stylename:"search-[category]-result",json:null,search:null,lastFormSearch:{},initialize:function(b,a){if(!a){this.error("No provider provided to constructor");return false}this.id=b;Eniro.TabView.prototype.initialize.apply(this,arguments);this.provider=a;this.stylename="search-"+this.id+"-result";this.listItems=[];this.register(Eniro.Events.SEARCH_CLEAR,this.onSearchClear)},destroy:function(){OpenLayers.Event.stopObserving(window,"resize",this._sizeToFit);this._sizeToFit=null;this.json=null;this.search=null;Eniro.TabView.prototype.destroy.apply(this,arguments)},activate:function(){if(this.disabled){return false}if(Eniro.TabView.prototype.activate.apply(this,arguments)){this.sizeToFit();return true}return false},deactivate:function(){if(this.disabled){return false}if(Eniro.TabView.prototype.deactivate.apply(this,arguments)){this.clearItems();return true}return false},registerObservers:function(){this.observe(this.div,"click",this.onClick);this._sizeToFit=OpenLayers.Function.bind(this.sizeToFit,this);OpenLayers.Event.observe(window,"resize",this._sizeToFit)},onClick:function(a){var b=OpenLayers.Event.element(a);if(b===this.elements.prev){OpenLayers.Event.stop(a);this.parent.doSearch(this.id,(this.json.offset-this.json.pageSize)||0);return false}else{if(b===this.elements.next){OpenLayers.Event.stop(a);this.parent.doSearch(this.id,(this.json.offset+this.json.pageSize)||0);return false}}return true},onSearchClear:function(){this.clearItems()},addListItem:function(a,c){var b;if(c){b=new Eniro.SearchResultItemInfo({feature:a,provider:this.provider})}else{b=new Eniro.SearchResultItem({feature:a,provider:this.provider})}this.listItems.push(b);b.setMap(this.map)},getTabName:function(){return this.id+"-result"},getProvider:function(){return this.provider},setResult:function(g,f,c){this.search=f;this.json=g;this.isGeoRankLogic=c;var a=Eniro.Util.isArray(f.p)?f.p.join(""):f.p;if(f.q&&!f.id&&!a.match(/_ptr_/)){this.lastFormSearch={searchWord:f.q,geoArea:f.where||""}}if(g&&g.geoJSONResult){var d=0;if(g.geoJSONResult.type==="Feature"){this.addListItem(g.geoJSONResult,true)}else{if(g.geoJSONResult.type==="FeatureCollection"){if(g.hits===1){this.addListItem(g.geoJSONResult.features[0],true)}else{var b=c;for(n=g.geoJSONResult.features.length;d<n;++d){this.addListItem(g.geoJSONResult.features[d],b)}}}}Eniro.AppEvents.triggerEvent(Eniro.Events.SEARCH_UPDATED,f)}},sizeToFit:function(){var a=jQuery(this.div).height("auto");if(a.size()>0){var k=0;var g=this.map.getSize();var b=jQuery(this.map.containerDiv).offset();var d=Eniro.map.getControl(Eniro.ControlID.CONTROLBAR_FOOTER);var h=jQuery(d.div).outerHeight();var l=(Math.round(g.h)+Math.round(b.top))-Math.round(a.offset().top)-Math.round(h)-1;if(this.disclaimerDiv){l-=jQuery(this.disclaimerDiv).outerHeight()}if(a.height()>l){var o=jQuery.makeArray(a.find("li"));for(var f=0,c=o.length;f<c;++f){k=Math.max(k,jQuery(o[f]).outerHeight())}a.height(Math.max(l,k))}}},clearItems:function(){jQuery(this.div).scrollTop(0);while(this.listItems.length){this.listItems.pop().destroy()}this.listItems=[];if(this.div){jQuery(this.div).empty()}this.search=null;this.json=null},getContent:function(){var a=['<ol class="',this.getCssClassName("items"),'"></ol>'].join("").toDomElement();var c="";if(this.lastFormSearch&&this.lastFormSearch.searchWord){if(Eniro.Profile.id==="no"){c=["q=",this.lastFormSearch.searchWord].join("")}else{if(this.lastFormSearch.searchWord===this.lastFormSearch.geoArea){c=["geo_area=",this.lastFormSearch.searchWord].join("")}else{c=["search_word=",this.lastFormSearch.searchWord,"&geo_area=",this.lastFormSearch.geoArea].join("")}}}var b=0;while(b<this.listItems.length){var d=this.listItems[b];d.searchItemLinkData=c;if(d.div===null){d.draw();d.activate()}a.appendChild(d.div);b++}return[a,this.getPagingHTML().join("").toDomElement()]},onHide:function(){if(this.disclaimerDiv){jQuery(this.disclaimerDiv).hide()}},onShow:function(){if(this.listItems.length<1){jQuery(this.div).hide()}else{if(this.provider==="wp_se"){if(this.disclaimerDiv){jQuery(this.disclaimerDiv).show()}else{this.disclaimerDiv=jQuery('<div class="'+this.getCssClassName("wp-disclaimer")+'">'+this.i18n("wp-disclaimer")+"</div>").get(0);jQuery(this.div).after(this.disclaimerDiv)}}}},getTabSelectorItemHTML:function(){var b=this.json?this.json.totalHits:0;var a=b;if(b<10000){a="("+a+")"}if(b>0){return['<a href="/'+new Date().getTime()+'">',"<span>",this.i18n(this.provider+".title"),"</span> ",a,"</a>"]}return['<a href="/'+new Date().getTime()+'" class="eniro-tabnavigator-item-nohits">',"<span>",this.i18n(this.provider+".title"),"</span> ",a,"</a>"]},getPagingHTML:function(){var d=['<div class="',this.getCssClassName("paging"),'">'];this.isPaged=false;var c={};var a=this.json.hits||0;var g=this.json.offset||0;var b=this.json.pageSize||0;var f=this.json.totalHits||0;if(!this.isGeoRankLogic){if(a>0&&g>=b){this.cssClasses.prev=this.getCssClassName("prev");d=d.concat(['<a class="',this.cssClasses.prev,'" href="/'+new Date().getTime()+'">',"&laquo; ",this.i18n("previous",{hits:b}),"</a>"]);this.isPaged=true}if(a>0&&g<(f-b)){var h=this.getCssClassName("next");this.cssClasses.next=this.getCssClassName("next");d=d.concat(['<a class="',this.cssClasses.next,'" href="/'+new Date().getTime()+'">',this.i18n("next",{hits:b})," &raquo;","</a>"]);this.isPaged=true}}d.push("</div>");return d},CLASS_NAME:"Eniro.SearchResultTabView",SUPER:"Eniro.TabView"});Eniro.SearchResultTabNavigatorView=OpenLayers.Class(Eniro.TabNavigatorView,{collapsible:false,initialize:function(){this.controls=[];Eniro.TabNavigatorView.prototype.initialize.apply(this,arguments)},assignElements:function(){Eniro.TabNavigatorView.prototype.assignElements.apply(this,arguments)},onClickToSwitch:function(a){this.doSearch(a)},doSearch:function(a,h){var d=this.getTabView(a);var c=this.getTabViews();var f=[];for(var b=0,k=c.length;b<k;++b){if(!c[b].getDisabled()){f.push(c[b].getProvider())}}h=h||0;var g={p:f.join(","),ap:d.getProvider(),offset:h};if(d.getProvider()&&d.getProvider().indexOf("geo_")===0){g._firstSearch=true}this.triggerEvent(Eniro.Events.SEARCH_REDO,g)},drawTabView:function(a){if(a.div){this.redrawContent(a.id)}else{Eniro.TabNavigatorView.prototype.drawTabView.apply(this,arguments)}},CLASS_NAME:"Eniro.SearchResultTabNavigatorView",SUPER:"Eniro.TabNavigatorView"});Eniro.SearchTabView=OpenLayers.Class(Eniro.TabView,{providers:null,defaultProvider:null,pageSize:25,suggest:null,initialize:function(){if(!Eniro.Profile.search&&!Eniro.Profile.search.fields){this.error("The active application profile does not define map search.")}Eniro.TabView.prototype.initialize.apply(this,arguments);this.preDefinedYP=new Eniro.Sellable.PreDefinedYP();this.searchResultListView=new Eniro.SearchResultListView({id:"search-result"});if(Eniro.Profile.sellable&&Eniro.Profile.sellable.searchRectangle){this.ad=new Eniro.Banner.SearchRectangle(Eniro.Profile.sellable.searchRectangle,["search"],["map","aerial","hybrid"],[],[4,5,6,7])}if(Eniro.Profile.sellable&&Eniro.Profile.sellable.searchSkyscraper){this.skyscraper=new Eniro.Banner(Eniro.Profile.sellable.searchSkyscraper,["search"],["map","aerial","hybrid","nautical"],[],[4,5,6,7,8,9,10,11,12,13,14,15,16])}if(Eniro.Profile.sellable&&Eniro.Profile.sellable.geoResultRectangle){this.contextAd=new Eniro.Banner.GeoResultRectangle(Eniro.Profile.sellable.geoResultRectangle,["search"],["map","aerial","hybrid"],[],[])}if(Eniro.Profile.sellable&&Eniro.Profile.sellable.nauticalRectangle){this.nauticalAd=new Eniro.Banner.SearchRectangle(Eniro.Profile.sellable.nauticalRectangle,[],["nautical"],[],[4,5,6,7])}var a=Eniro.Profile.search.fields;if(a.p){this.providers=a.p.value}if(a.ap){this.defaultProvider=a.ap.value}if(a.pageSize){this.pageSize=a.pageSize.value}this.register(Eniro.Events.SET_SEARCH_FIELDS,this.onSetSearchFields);this.register(Eniro.Events.MODE_SWITCH,this.onModeSwitch);this.register(Eniro.Events.SEARCH_FORM_IN_SINGLE_HIT_MODE,this.onSearchFormInSingleHitMode)},destroy:function(){this.unregister(Eniro.Events.SET_SEARCH_FIELDS,this.onSetSearchFields);this.unregister(Eniro.Events.SEARCH_FORM_IN_SINGLE_HIT_MODE,this.onSearchFormInSingleHitMode);this.inputFields=null;for(var a in this.suggestControllers){if(this.suggestControllers.hasOwnProperty(a)){this.suggestControllers[a].destroy()}}this.suggestControllers=null;if(this.preDefinedYP&&typeof this.preDefinedYP.destroy==="function"){this.preDefinedYP.destroy()}this.preDefinedYP=null;if(this.searchResultListView&&typeof this.searchResultListView.destroy==="function"){this.searchResultListView.destroy()}this.searchResultListView=null;if(this.elements.form){OpenLayers.Event.stopObservingElement(this.elements.form)}Eniro.TabView.prototype.destroy.apply(this,arguments)},activate:function(){if(this.disabled){return false}if(Eniro.TabView.prototype.activate.apply(this,arguments)){this.preDefinedYP.activate();this.searchResultListView.activate();var c,f;var a=jQuery(this.div).find(":input").get();var d;for(c=0,f=a.length;c<f;++c){d=Eniro.Util.HTML5.getAttribute(a[c],"placeholder");if(d){Eniro.Util.enableInputCaption(a[c],d)}}var b=["ad","nauticalAd","contextAd","skyscraper"];for(c=0,f=b.length;c<f;++c){if(this[b[c]]){this[b[c]].activate()}}return true}return false},setMap:function(a){Eniro.TabView.prototype.setMap.apply(this,arguments);if(this.ad){this.ad.setMap(this.map)}if(this.nauticalAd){this.nauticalAd.setMap(this.map)}if(this.contextAd){this.contextAd.setMap(this.map)}if(this.skyscraper){this.skyscraper.setMap(this.map);this.map.getControl(Eniro.ControlID.LAYERBAR).addRightControl(this.skyscraper)}this.preDefinedYP.setMap(this.map);this.searchResultListView.setMap(this.map)},deactivate:function(){if(this.disabled){return false}if(Eniro.TabView.prototype.deactivate.apply(this,arguments)){return true}return false},assignElements:function(){Eniro.TabView.prototype.assignElements.apply(this,arguments);this.inputFields={};for(var b in Eniro.Profile.search.fields){if(Eniro.Profile.search.fields.hasOwnProperty(b)){var a=jQuery("input#"+b+'[type="text"]');if(a.size()>0){this.inputFields[b]=a.get(0)}}}},onModeSwitch:function(b){if(b.mode==="search"){var a=(Eniro.Profile.search.focus?Eniro.Profile.search.focus:"where");if(a){jQuery(this.div).find("input[name="+a+"]").focus()}}},onSearchFormInSingleHitMode:function(a){if(a){if(a.reset&&a.reset.length>0){for(var b=0;b<a.reset.length;b++){jQuery(this.div).find("input[name="+a.reset[b]+"]").attr("value","");jQuery(jQuery(this.div).find(".eniro-input-caption")[0]).show()}}if(a.focus&&typeof a.focus==="string"&&jQuery(this.div).find("input[name="+a.focus+"]")){jQuery(this.div).find("input[name="+a.focus+"]").focus()}}},registerObservers:function(){Eniro.TabView.prototype.registerObservers.apply(this,arguments);this.observe(this.elements.form,"submit",this.onSubmit);this.map.events.register("moveend",this.map,this.onMoveEnd);this.suggestControllers={};for(var a in this.inputFields){if(this.inputFields.hasOwnProperty(a)){if(Eniro.Profile.geoSuggest&&a==Eniro.Profile.geoSuggest.fieldId){this.suggestControllers[a]=new Eniro.Suggest(this.inputFields[a],new Eniro.Suggest.DataSource(),{p:Eniro.Profile.geoSuggest.provider,ap:Eniro.Profile.geoSuggest.provider,callbacks:{select:OpenLayers.Function.bind(this.onGeoSuggestSelect,this),querychanged:OpenLayers.Function.bind(this.onQueryChanged,this)}})}}}},onSubmit:function(l){OpenLayers.Event.stop(l);var p={offset:0};var c=Eniro.Profile.search.fields;var h;var b=this.map.getControl(Eniro.ControlID.GPS);var o=false;for(var k in c){if(c.hasOwnProperty(k)){h=jQuery(this.div).find("#"+k).val();if(k==="where"&&b.validate(OpenLayers.String.trim(h))){if(!b.activated){b.activate()}if(Eniro.Crypto.crc32(h.toLowerCase().replace(this.searchResultListView.regexp,""))=="2019958649"){this.searchResultListView.showit()}b.updatePositionAndCenter(OpenLayers.String.trim(h));Eniro.AppEvents.triggerEvent(Eniro.Events.STATISTICS_LOG,{scope:"navigate",event:"coords",data:{where:h}});o=true;break}if(!h){h=""}if(k==="pageSize"){h=parseInt(h,10)}p[k]=h}}if(!o){var d=!this.parameters||this.parameters.q!==p.q;this.parameters=p;var g=Eniro.Profile.search.location;var f=p.q;var a=g&&g.field?p[g.field]:null;if(f!==""){if(a&&a!==""){if(this.suggest!==null&&!Eniro.Profile.search.location.idDisabled){this.doRepositionGeoSearch({id:this.suggest.id},p)}else{this.doRepositionGeoSearch({q:p[g.field]},p)}}else{if(Eniro.Profile.geoSuggest&&Eniro.Profile.geoSuggest.apOverride){this._awaitSuggest=false;if(this.suggest!==null){p.ap=Eniro.Profile.search.location.provider;p.p=p.ap}}this.doSearch(p)}}else{if(a&&a!==""){if(this.suggest){delete p.q;p.id=this.suggest.id}else{p.q=a}p.p=g.provider;p.ap=g.provider;this.doSearch(p)}else{this.doSearch(null)}}}},onGeoSuggestSelect:function(a){if(a.id){this.suggest=a}},onQueryChanged:function(a){this.suggest=null},doRepositionGeoSearch:function(b,c){var a=Eniro.Profile.search.location;var d={p:a.provider,ap:a.provider,success:OpenLayers.Function.bind(this.onAddressQuerySuccess,this),_isId:b.hasOwnProperty("id"),_parameters:c};jQuery.extend(d,b);this.triggerEvent(Eniro.Events.SEARCH_DO,d)},onAddressQuerySuccess:function(f){var d=f.search._parameters;var a=f.json.search[Eniro.Profile.search.location.provider];if(a&&a.totalHits>0){var c=a.geoJSONResult;if(f.search._isId||c.features&&c.features[0]&&c.features[0].geometry){var b;if(f.search._isId){b=a.geoJSONResult;this.setFeatureCenter(b);d._city21Hack=true}else{b=a.geoJSONResult.features[0];if(b.properties.cmpType=="21"||b.properties.typeOfPlace==="BY"){d._city21Hack=true;this.setFeatureCenter(b)}}}}this.doSearch(d)},setFeatureCenter:function(b){var c=b.geometry;var d=this.translateScaleToZoom(b);var a;if(b.properties&&b.properties.lonlat){a=new OpenLayers.LonLat(b.properties.lonlat.lon,b.properties.lonlat.lat)}else{a=new OpenLayers.LonLat(c.coordinates[0],c.coordinates[1])}a.transform(this.map.backendProjection,this.map.baseLayer.projection);this.triggerEvent(Eniro.Events.SET_CENTER,{lonlat:a,zoomLevel:d,suspendSearchLayer:true})},translateScaleToZoom:function(a){var b=a.properties[Eniro.Profile.search.location.zoomLevelKey];return Eniro.Profile.search.location.zoomLevels[b]||15},doSearch:function(a){var b=null;if(a){b={p:this.providers,ap:this.defaultProvider,pageSize:this.pageSize};OpenLayers.Util.extend(b,a);if(b.p&&b.p.push&&b.p.indexOf&&(b.p.indexOf(b.ap)===-1)){b.p.push(b.ap)}}this.triggerEvent(Eniro.Events.SEARCH_DO,b)},onMoveEnd:function(b){var a=Eniro.Profile.search.location;if(b.object.dragging&&a&&a.reset&&a.field&&jQuery(this.div).find("input#q").val()!==""){jQuery(this.div).find("input#"+a.field).eq(0).val("")}},onSetSearchFields:function(f){if(!this.elements.form){return}var b=Eniro.Profile.search.location;var h=Eniro.Profile.sellable?Eniro.Profile.sellable.preDefinedYP:undefined;var g=jQuery(this.elements.form).find("input[name=q]").get(0);var d=jQuery(this.elements.form).find("input[name=where]").get(0);if(g){g.value=""}if(d){d.value="";this.suggest=null}if(b&&f.p===b.provider&&f.ap===b.provider){if(d&&f.q){d.value=f.q}}else{if(!(h&&f.p===h.provider)){if(g&&f.q){g.value=f.q}if(d&&f.where){d.value=f.where}}}if(g){try{g.focus();g.blur()}catch(c){}}if(d){try{d.focus();d.blur()}catch(a){}}},getFormHTML:function(){this.cssClasses.form=this.getCssClassName("form");var f=Eniro.Profile.search;var d=['<form method="get" class="',this.cssClasses.form,'" action="">',"<fieldset>"];if(f&&f.fields){d.push("<legend>","<strong>",this.i18n("map-search"),"</strong>","</legend>","<dl>");for(var k in f.fields){if(f.fields.hasOwnProperty(k)){var h=f.fields[k];if(h.type=="text"){d.push("<dt>",'<label for="',k,'">',this.i18n(k),"</label>","</dt>")}var a=['<input id="'+k+'" name="'+k+'"'];var g,b;for(var c in h){if(h.hasOwnProperty(c)){g=h[c];b=g.match(/^%\{([^\}]+)\}$/);if(b&&b[1]){g=this.i18n(b[1])}a.push(" "+c+'="'+g+'"')}}d.push('<dd class="'+this.getCssClassName(h.type,this.id)+'">');d.push(a.join(""));d.push("</dd>")}}d.push("</dl>");d.push('<button type="submit" class="eniro-button">',"<span>"+this.i18n("search")+"</span>","</button>")}d.push("</fieldset>","</form>");return d.join("")},getContent:function(){return[this.getFormHTML(),this.preDefinedYP.draw(),this.searchResultListView.draw(),(this.ad?this.ad.draw():""),(this.nauticalAd?this.nauticalAd.draw():""),(this.contextAd?this.contextAd.draw():"")]},onShow:function(){jQuery("#header-inner").removeClass("route");jQuery("#header-inner").addClass("map");this.sizeToFit()},isTopChoice:function(a){var b=this.suggestControllers[Eniro.Profile.geoSuggest.fieldId].getTopChoice();if(b!==null&&b.suggest&&b.suggest!==""){b=b.suggest.match(/(^[^\d,]+)/);if(b!==null&&b[0]&&a.toLowerCase()===b[0].trim().toLowerCase()){return true}}return false},sizeToFit:function(){this.searchResultListView.sizeToFit()},CLASS_NAME:"Eniro.SearchTabView"});Eniro.ResultTypeSelector=OpenLayers.Class(Eniro.Control,{initialize:function(){Eniro.Control.prototype.initialize.apply(this,arguments);this.register(Eniro.Events.SEARCH_RESULT_AVAILABLE,this.onSearchResultAvailable)},destroy:function(){this.unregister(Eniro.Events.SEARCH_RESULT_AVAILABLE,this.onSearchResultAvailable);Eniro.Control.prototype.destroy.apply(this,arguments)},onSearchResultAvailable:function(c){var b=false;var d=0;for(var f in c.json.search){d++}for(var h in c.json.search){if(h.indexOf("_")<0){OpenLayers.Console.log("Unable to handle result by provider: "+h);continue}if(c.json.search[h].geoJSONResult){var g=h.substring(h.lastIndexOf("_")+1);var a=this.isSingleHit(c.json.search[h]);this.onResult(c,h);b=true;this.onProviderResult(c,h,g,a,c.firstSearch);if(h.indexOf("yp_")===0){this.onYpResult(c,h,g,a,c.firstSearch,d)}else{if(h.indexOf("wp_")===0){this.onWpResult(c,h,g,a,c.firstSearch,d)}else{if(h.indexOf("geo_")===0){this.onGeoResult(c,h,g,a,c.firstSearch)}}}}}if(!b){this.onResult(c)}},isSingleHit:function(a){if(a&&a.geoJSONResult&&a.geoJSONResult.type){var c=a.geoJSONResult.type;var b=a.geoJSONResult.features;return c==="Feature"||c==="FeatureCollection"&&b&&b.length===1}return false},onResult:function(a){},onProviderResult:function(b,d,c,a){},onYpResult:function(b,f,d,a,c){},onWpResult:function(b,f,d,a,c){},onGeoResult:function(b,d,c,a){},CLASS_NAME:"Eniro.ResultTypeSelector"});Eniro.SearchResultListView=OpenLayers.Class(Eniro.ResultTypeSelector,{tabNavigatorView:undefined,initialize:function(b){Eniro.ResultTypeSelector.prototype.initialize.apply(this,arguments);this.tabNavigatorView=new Eniro.SearchResultTabNavigatorView({id:this.id,collapsible:false});var c,a,d;for(var f in Eniro.Profile.providers){if(!this.getTabViewByProvider(f)){a=Eniro.Profile.providers[f].id;a=a.charAt(0).toUpperCase()+a.substr(1);d=Eniro[a+"TabView"]||Eniro.Sellable[a+"TabView"]||Eniro.SearchResultTabView;c=new d(Eniro.Profile.providers[f].id,f);this.tabNavigatorView.addControl(c)}}this.regexp=new RegExp("[\\s,.-]","g");this.register(Eniro.Events.SEARCH_SELECT_ITEM,this.onSearchSelectItem);this.register(Eniro.Events.SEARCH_CLEAR,this.onSearchClear)},destroy:function(){this.unregister(Eniro.Events.SEARCH_SELECT_ITEM,this.onSearchSelectItem);this.tabNavigatorView.destroy();this.tabNavigatorView=null;this.result=null;this.provider=null;this.country=null;this.singleHit=null;Eniro.ResultTypeSelector.prototype.destroy.apply(this,arguments)},activate:function(){if(Eniro.ResultTypeSelector.prototype.activate.apply(this,arguments)){this.tabNavigatorView.activate();return true}return false},registerObservers:function(){this.observe(this.div,"click",this.onClick)},setMap:function(){Eniro.ResultTypeSelector.prototype.setMap.apply(this,arguments);this.tabNavigatorView.setMap(this.map)},onClick:function(a){var b=OpenLayers.Event.element(a);if(b===this.elements.backToList){OpenLayers.Event.stop(a);if(this.isGeoRankLogic){this.triggerEvent(Eniro.Events.SEARCH_REDO,{disableRankLogic:true,_firstSearch:true})}else{this.triggerEvent(Eniro.Events.HISTORY_BACK_TO_SEARCH_RESULT)}return false}return true},onResult:function(a,c){this.result=a;this.clearTabs();this.isGeoRankLogic=this.determineGeoRankLogic(a);this.doStatistics(a,c);if(a.json.search){for(var d in Eniro.Profile.providers){var b=this.getTabViewByProvider(d);if(b){b.setDisabled((a.json.search[d]===undefined));b.setResult(a.json.search[d],a.search,this.isGeoRankLogic)}}}if(a.features&&a.features.length===0){if(this.div){jQuery(this.div).hide()}}},onProviderResult:function(b,f,d,a){this.provider=f;this.country=d;this.singleHit=a;var c=this.getTabViewByProvider(f);this.drawResult(c)},onSearchClear:function(){this.clearTabs();jQuery(this.elements.header).hide()},doStatistics:function(a,c){if(c){var b=c.substring(0,c.indexOf("_"));Eniro.AppEvents.triggerEvent(Eniro.Events.STATISTICS_LOG,{scope:"content",event:b,data:{result:a,provider:c}})}},determineGeoRankLogic:function(a){if(!a.search.ap||a.search.ap.indexOf("geo_")!==0){return false}var c=a.search.ap;if(!a.json||!a.json.search[c]){return false}var b=a.json.search[c];return b.hits>1&&b.geoJSONResult.features.length===1},getTabViewByProvider:function(b){var a=Eniro.Profile.providers[b];if(!a){return null}else{return this.tabNavigatorView.getTabView(a.id)}},clearTabs:function(){var c=this.tabNavigatorView.getTabViews();for(var b=0,a=c.length;b<a;++b){c[b].clearItems()}this.tabNavigatorView.redrawSelector()},onSearchSelectItem:function(a){var b;if(a.provider.indexOf("_ptr")>0){b=a.provider.replace(/_ptr/,"")}else{b=a.provider}this.triggerEvent(Eniro.Events.SEARCH_DO,{p:b,id:a.id,_enableBack:"back-to-list"})},draw:function(){this.div=['<div class="',this.getCssClassName("result"),'" style="display:none;"></div>'].join("").toDomElement();this.cssClasses.header=this.getCssClassName("search-summary");jQuery(this.div).html('<div class="'+this.cssClasses.header+'"></div>');this.div.appendChild(this.tabNavigatorView.draw());return Eniro.Control.prototype.draw.apply(this,arguments)},showit:function(){jQuery(this.div).show();if(this.sauceDiv){this.sauceDiv.remove();this.sauceDiv=null}this.sauceDiv=jQuery('<div style="margin-top: 8px; margin-left: 13px; margin-bottom: 10px"><object width="320" height="265"><param name="movie" value="http://qstream-down.qbrick.com/01256/untitled_320x265.swf"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://kaffe.bahnhof.se/eniro/skattjakten/final_320x265.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="320" height="265"></embed></object></div>');jQuery(this.elements.header).hide().after(this.sauceDiv);jQuery(this.tabNavigatorView.div).hide()},drawResult:function(b){if(this.result.search._suppressList){jQuery(this.div).css({visibility:"hidden"})}else{jQuery(this.div).show()}this.drawHeader();if(this.sauceDiv){this.sauceDiv.remove();this.sauceDiv=null}if(this.result.search.q&&this.secretSauce[this.result.search.q.toLowerCase()]){var f=this.secretSauce[this.result.search.q.toLowerCase()];this.sauceDiv=jQuery('<div style="margin-top: 8px; margin-left: 13px; margin-bottom: 10px"><object width="320" height="265"><param name="movie" value="http://www.youtube-nocookie.com/v/'+f+'&hl=en_GB&fs=1&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube-nocookie.com/v/'+f+'&hl=en_GB&fs=1&rel=0&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="320" height="265"></embed></object></div>');jQuery(this.elements.header).hide().after(this.sauceDiv)}if(this.result.search.q&&(Eniro.Crypto.crc32(this.result.search.q.toLowerCase().replace(this.regexp,""))=="2355711670")){this.sauceDiv=jQuery('<div style="margin-top: 8px; margin-left: 13px; margin-bottom: 10px"><object width="320" height="265"><param name="movie" value="http://qstream-down.qbrick.com/01256/untitled_320x265.swf"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://qstream-down.qbrick.com/01256/untitled_320x265.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="320" height="265"></embed></object></div>');jQuery(this.elements.header).hide().after(this.sauceDiv)}if(this.result.search.q&&(Eniro.Crypto.crc32(this.result.search.q.toLowerCase().replace(this.regexp,""))=="2019958649")){this.sauceDiv=jQuery('<div style="margin-top: 8px; margin-left: 13px; margin-bottom: 10px"><object width="320" height="265"><param name="movie" value="http://qstream-down.qbrick.com/01256/untitled_320x265.swf"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://kaffe.bahnhof.se/eniro/skattjakten/final_320x265.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="320" height="265"></embed></object></div>');jQuery(this.elements.header).hide().after(this.sauceDiv)}var c=0;for(var a in this.result.json.search){c+=this.result.json.search[a].totalHits}var d=this.getSingleCssClassName("single");if(c==1||this.isGeoRankLogic){jQuery(this.tabNavigatorView.div).addClass(d)}else{jQuery(this.tabNavigatorView.div).removeClass(d)}if(c===0){jQuery(this.tabNavigatorView.div).hide()}else{jQuery(this.tabNavigatorView.div).show();this.tabNavigatorView.redrawSelector();this.tabNavigatorView.switchTab(b.id);if(b.selected){this.tabNavigatorView.selectTab(b.id)}this.tabNavigatorView.drawTabView(b);this.sizeToFit(b);jQuery(b.div).scrollTop(0)}this.assignElements();if(this.result.search._suppressList){jQuery(this.div).hide()}else{jQuery(this.div).css({visibility:""})}},drawHeader:function(){var d="";var b=this.result.search._enableBack;if(b||this.isGeoRankLogic){var a=0;if(this.provider&&this.result&&this.result.json&&this.result.json.search[this.provider]){a=this.result.json.search[this.provider].totalHits}var c=this.isGeoRankLogic?this.i18n("see-all-geo-hits",{hits:a}):this.i18n(b);this.cssClasses.backToList=this.getCssClassName(b);d='<a class="'+this.cssClasses.backToList+'" href="/'+new Date().getTime()+'">&laquo; '+c+"</a>"}else{if(this.result.json.search[this.provider].totalHits===0){d="<span>"+this.i18n("total-0")+"</span>"}}jQuery(this.elements.header).html(d).show()},sizeToFit:function(a){if(a){a.sizeToFit()}else{var b=this.tabNavigatorView.getOpenTab();if(b){b.sizeToFit()}}},secretSauce:{"rick astley":"N3L6-A_PjNs","dschinghis khan":"v1wG9g1wjSA",piblet:"i9SSOWORzw4","gary brolsma":"KmtzQCSh6xk",longcat:"5IXBt3CuHzY","keyboard cat":"wJh7EN8vB48","dramatic chipmunk":"xWWNG0JBMCg","tay zonday":"owZkdnJgl8U"},CLASS_NAME:"Eniro.SearchResultListView"});Eniro.SearchZoomController=OpenLayers.Class(Eniro.ResultTypeSelector,{DEFAULT_ZOOM:15,initialize:function(){Eniro.ResultTypeSelector.prototype.initialize.apply(this,arguments)},destroy:function(){Eniro.ResultTypeSelector.prototype.destroy.apply(this,arguments)},onYpResult:function(b,g,f,a,d,c){if(d&&!(b.search._suppressZoom)){if(a){this.onYpWpResultSingle(b.features[0])}else{if(b.json.search[g].hits>1){this.onYpWpResultMultiple(b.features,b.search,c)}}}},onWpResult:function(b,g,f,a,d,c){if(d&&!(b.search._suppressZoom)){if(a){this.onYpWpResultSingle(b.features[0])}else{if(b.json.search[g].hits>1){this.onYpWpResultMultiple(b.features,b.search,c)}}}},onYpWpResultSingle:function(b){var a=this.getAndTransformLonLat(b);if(a){Eniro.AppEvents.triggerEvent(Eniro.Events.SET_CENTER,{lonlat:a,zoomLevel:this.DEFAULT_ZOOM,suspendSearchLayer:true});this.doMapTypes()}},onGeoResult:function(r,o,b,l,c){if(c&&!(r.search._suppressZoom)){if(l){var h=(Eniro.Profile.search.focus?Eniro.Profile.search.focus:"where");Eniro.AppEvents.triggerEvent(Eniro.Events.SEARCH_FORM_IN_SINGLE_HIT_MODE,{focus:h,reset:[h]});if(r.features[0].geometry){this.onGeoResultSingle(r.features[0])}}else{if(r.json.search[o].hits>1){this.onGeoResultMultiple(r.features)}}if(r.features.length>0&&r.features.length<4){var g={};var q=1;for(var f=0;f<r.features.length;f++){var p=r.features[f];if(p.json&&Eniro.Profile.providers[o]&&Eniro.Profile.providers[o].properties&&Eniro.Profile.providers[o].properties.data){var d=Eniro.Profile.providers[o].properties.data;var a=p.json.properties[d.addressObject];var k=p.json.properties.lonlat;if(a){if(d.city&&a[d.city]){g["sw"+(q++)]=a[d.city]}if(d.city&&a[d.postalCode]){g["sw"+(q++)]=a[d.postalCode]}if(d.city&&a[d.streetName]){g["sw"+(q++)]=a[d.streetName]}if(k.lon&&k.lat){g["sw"+(q++)]=k.lon+"/"+k.lat}}}}this.triggerEvent(Eniro.Events.AD_CONTEXT_SET,{id:Eniro.Profile.sellable.geoResultRectangle,params:g})}}},onGeoResultSingle:function(a){if(a.geometry instanceof OpenLayers.Geometry.Point){this.onGeoResultSinglePoint(a)}else{this.onGeoResultSingleComplex(a)}},onGeoResultSinglePoint:function(b){var a=this.getAndTransformLonLat(b);if(a){var c=Eniro.SearchTabView.prototype.translateScaleToZoom(b.json);Eniro.AppEvents.triggerEvent(Eniro.Events.SET_CENTER,{lonlat:a,zoomLevel:c,suspendSearchLayer:true});this.doMapTypes()}},onGeoResultSingleComplex:function(a){var b=a.geometry.getBounds();Eniro.AppEvents.triggerEvent(Eniro.Events.ZOOM_TO_EXTENT,{extent:b,toAdjusted:true,suspendSearchLayer:true});this.doMapTypes()},onGeoResultMultiple:function(a){this.zoomToFeatures(a)},onYpWpResultMultiple:function(c,b,a){if(!b._city21Hack&&!b._predefinedyp&&(b.where||this.isPtrId(b)||a===1)){this.zoomToFeatures(c)}},zoomToFeatures:function(c){var d=new OpenLayers.Bounds();for(var b=0,a=c.length;b<a;b++){d.extend(c[b].geometry.getBounds())}Eniro.AppEvents.triggerEvent(Eniro.Events.ZOOM_TO_EXTENT,{extent:d,toAdjusted:true,suspendSearchLayer:true,options:{maxZoom:this.DEFAULT_ZOOM}});this.doMapTypes()},doMapTypes:function(){Eniro.AppEvents.triggerEvent(Eniro.Events.SEARCH_DO,{mapTypesUpdate:true,_disableHistory:true})},getAndTransformLonLat:function(c){if(!c){return null}var d=c.json.properties;var b=null;if("lonlat" in d){b=new OpenLayers.LonLat(c.json.properties.lonlat.lon,c.json.properties.lonlat.lat)}else{if("georss:point" in d){var a=d["georss:point"].split(" ");b=new OpenLayers.LonLat(a[1],a[0])}}if(b!==null){b.transform(this.map.backendProjection,this.map.baseLayer.projection)}return b},isPtrId:function(a){return a.ap.match(/_ptr_/)&&a.q},draw:function(){return null},CLASS_NAME:"Eniro.SearchZoomController"});Eniro.AggregatedPopupResultItem=OpenLayers.Class(Eniro.SearchResultItem,{initialize:function(a){Eniro.SearchResultItem.prototype.initialize.apply(this,arguments)},drawYpSe:function(){var b=this.buildYpSe();var a=b.properties.length>0;return['<li class="',this.getCssClassName("item"+(!a?" norightcol":"")),' vcard">','<div class="',this.getCssClassName("title"),'">',"<h2>"+this.formatYpTitle(b.title,b.url,true)+"</h2>","</div>",b.contactinfo.join(""),"</li>"].join("")},drawYpPtrSe:function(){var b=this.buildYpSe();var a=b.properties.length>0;return['<li class="',this.getCssClassName("item"+(!a?" norightcol":"")),' vcard">','<div class="',this.getCssClassName("title"),'">',"<h2>"+this.formatYpTitle(b.title,b.url,true)+"</h2>","</div>",b.contactinfo.join(""),"</li>"].join("")},drawYpDk:function(){var b=this.buildYpSe();var a=b.properties.length>0;return['<li class="',this.getCssClassName("item"+(!a?" norightcol":"")),' vcard">','<div class="',this.getCssClassName("title"),'">',"<h2>"+this.formatYpTitle(b.title,b.url,true)+"</h2>","</div>",b.contactinfo.join(""),"</li>"].join("")},drawYpDkKrak:function(){var b=this.buildYpSe();var a=b.properties.length>0;return['<li class="',this.getCssClassName("item"+(!a?" norightcol":"")),' vcard">','<div class="',this.getCssClassName("title"),'">',"<h2>"+this.formatYpTitle(b.title,b.url,true)+"</h2>","</div>",b.contactinfo.join(""),"</li>"].join("")},drawYpFi:function(){var b=this.buildYpSe();var a=b.properties.length>0;return['<li class="',this.getCssClassName("item"+(!a?" norightcol":"")),' vcard">','<div class="',this.getCssClassName("title"),'">',"<h2>"+this.formatYpTitle(b.title,b.url,true)+"</h2>","</div>",b.contactinfo.join(""),"</li>"].join("")},drawYpPtrFi:function(){var b=this.buildYpSe();var a=b.properties.length>0;return['<li class="',this.getCssClassName("item"+(!a?" norightcol":"")),' vcard">','<div class="',this.getCssClassName("title"),'">',"<h2>"+this.formatYpTitle(b.title,b.url,true)+"</h2>","</div>",b.contactinfo.join(""),"</li>"].join("")},drawYpNo:function(){var b=this.buildYpNo();var a=b.properties.length>0;return['<li class="',this.getCssClassName("item"+(!a?" norightcol":"")),' vcard">','<div class="',this.getCssClassName("title"),'">',"<h2>"+this.formatYpTitle(b.title,b.url,true)+"</h2>","</div>",b.contactinfo.join(""),"</li>"].join("")},drawWp:function(a){},drawWpSe:function(){var b=this.buildWpSe();var a=['<li class="',this.getCssClassName("item"),' vcard">','<div class="',this.getCssClassName("title"),'">','<a id="',this.feature.id,'" class="eniro-popup-title" href="/'+new Date().getTime()+'">',(b.name||b.companyname),"</a>","</div>"];a.push("</div></li>");return a.join("")},drawWpNo:function(){var b=this.buildWpNo();var a=['<li class="',this.getCssClassName("item"),' vcard">','<div class="',this.getCssClassName("title"),'">','<a id="',this.feature.id,'" class="eniro-popup-title" href="/'+new Date().getTime()+'">',(b.name||b.companyname),"</a>","</div>"];a.push("</div></li>");return a.join("")},formatYpFi:function(){return this.formatYpSe.apply(this,arguments)},formatWpFi:function(){return this.formatWpSe.apply(this,arguments)},formatYpNo:function(){return this.formatYpSe.apply(this,arguments)},formatYpDk:function(){return this.formatYpSe.apply(this,arguments)},formatWpDk:function(){return this.formatWpSe.apply(this,arguments)},formatYpDkKrak:function(){return this.formatYpSe.apply(this,arguments)},formatWpDkKrak:function(){return this.formatWpSe.apply(this,arguments)},destroy:function(){Eniro.SearchResultItem.prototype.destroy.apply(this,arguments)},CLASS_NAME:"Eniro.AggregatedPopupResultItem"});Eniro.Feature.WaypointMarker=OpenLayers.Class(Eniro.Feature.PopupFeature,{draggable:true,dragEventInterval:200,dragTimer:null,openOnMouseOver:false,initialize:function(a,b,c,d){this.ord=b;var g=this.getZIndex();var f={};if(d&&d.style){f.style=d.style}else{f.style={externalGraphic:Eniro.Util.getImagesLocation()+"markers/route/map-"+this.getType()+"-"+Eniro.Profile.id+".png",backgroundGraphic:Eniro.Util.getImagesLocation()+"markers/route/shadow.png",graphic:true,graphicZIndex:g,graphicWidth:54,graphicHeight:28,graphicYOffset:-25,graphicXOffset:-25,backgroundXOffset:0,backgroundYOffset:-28,backgroundGraphicZIndex:g-1,pointRadius:0}}OpenLayers.Util.extend(f,c);Eniro.Feature.PopupFeature.prototype.initialize.apply(this,[a,{},f]);this.events.on({dragstart:this.onDragStart,dragmove:this.onDragMove,dragend:this.onDragEnd})},stopDragTimer:function(){if(this.dragTimer!==null){clearTimeout(this.dragTimer)}},startDragTimer:function(){this.dragTimer=setTimeout(OpenLayers.Function.bind(this.onTimeout,this),this.dragEventInterval)},onDragEnd:function(a){this.stopDragTimer();this.isBeingDragged=false;this.triggerDragEvent(Eniro.Events.ROUTE_MARKER_MOVED,false)},onDragStart:function(a){this.stopDragTimer();this.isBeingDragged=true;this.prevPos={};this.startDragTimer()},onDragMove:function(a){this.isBeingDragged=true},onTimeout:function(){if(this.isBeingDragged){this.triggerDragEvent(Eniro.Events.ROUTE_MARKER_MOVING,true)}this.startDragTimer()},triggerDragEvent:function(a,b){var c=this.geometry.getCentroid();c=new OpenLayers.LonLat(c.x,c.y);c.transform(this.layer.map.baseLayer.projection,this.layer.map.backendProjection);if(!b||((c.lon!==this.prevPos.lon)||(c.lat!==this.prevPos.lat))){Eniro.AppEvents.triggerEvent(a,{marker:this,lonlat:c});this.prevPos=c}},updateOrdinal:function(a,b){this.style.display=(a===-1&&this.ord!==-1)?"none":"";this.ord=a;this.style.externalGraphic=(this.routeable?this.style.externalGraphic:Eniro.Util.getImagesLocation()+"markers/route/map-"+this.getType()+"-"+Eniro.Profile.id+".png");if(!this.isBeingDragged){this.move(b)}this.swapping=false},getType:function(){var a;if(this.ord===0){a="start"}else{if(this.ord===-1){a="stop"}else{a="via"+this.ord}}return a},getZIndex:function(){return parseInt(OpenLayers.Util.createUniqueID(""),10)},CLASS_NAME:"Eniro.Feature.WaypointMarker"});Eniro.Feature.RouteListMarker=OpenLayers.Class(Eniro.Feature.PopupFeature,{draggable:false,popupContents:function(c){var a=['<span class="route-popup-index">'+c.index+'.</span> <span class="route-popup-desc">'];var f=(c.desc)?c.desc.split(" "):"";var b="";for(var d=0,g=f.length;d<g;++d){if(b.length<60){if(d>0){b+=" "}b+=f[d]}else{a.push('<span class="route-popup-desc-part">'+b+"</span>");b=f[d]}}a.push('<span class="route-popup-desc-part">'+b+"</span>");a.push("</span>");if(c.sarData){a.push('<span class="route-popup-event">'+this.getSarMarkup(c.sarData)+"</span>")}a.push('<div class="route-popup-navigation">');a.push('<a class="route-popup-navigation-prev'+(c.index===1?"-first":"")+'" href="/'+new Date().getTime()+'">'+OpenLayers.i18n("route-list-marker.popup.prev")+"</a>");a.push('<a class="route-popup-navigation-next'+(c.isLast?"-last":"")+'" href="/'+new Date().getTime()+'">'+OpenLayers.i18n("route-list-marker.popup.next")+"</a>");a.push('<a class="route-popup-navigation-overview" href="/'+new Date().getTime()+'">'+OpenLayers.i18n("route-list-marker.popup.overview")+"</a>");a.push("</div>");return a.join("")},initialize:function(d,a,b){a=a||{};b=b||{};var c={externalGraphic:Eniro.Util.getImagesLocation()+"markers/route/route-instruction.png",graphic:true,graphicZIndex:9001,graphicWidth:27,graphicHeight:37,graphicXOffset:-11,graphicYOffset:-31,pointRadius:15};OpenLayers.Util.extend(c,b.style||{});b.style=c;this.index=a.index;Eniro.Feature.PopupFeature.prototype.initialize.apply(this,[d,a,b]);this.events.un({mouseover:this.onMouseOver,mouseout:this.onMouseOut,click:this.onClick});Eniro.AppEvents.register(Eniro.Events.ROUTE_SEARCH_DO,this,this.onPopupCloseButton)},onPopupClick:function(a){var b=OpenLayers.Event.element(a);if(jQuery(b).is(".route-popup-navigation-prev")){OpenLayers.Event.stop(a);Eniro.AppEvents.triggerEvent(Eniro.Events.ROUTE_POPUP_INSTRUCTION_PREV)}else{if(jQuery(b).is(".route-popup-navigation-next")){OpenLayers.Event.stop(a);Eniro.AppEvents.triggerEvent(Eniro.Events.ROUTE_POPUP_INSTRUCTION_NEXT)}else{if(jQuery(b).is(".route-popup-navigation-overview")){OpenLayers.Event.stop(a);Eniro.AppEvents.triggerEvent(Eniro.Events.ROUTE_ZOOM_TO_EXTENT)}else{if(jQuery(b).is("[class^=route-popup-navigation]")){OpenLayers.Event.stop(a)}}}}},onPopupCloseButton:function(){Eniro.Feature.PopupFeature.prototype.onPopupCloseButton.apply(this,arguments);Eniro.AppEvents.triggerEvent(Eniro.Events.ROUTE_POPUP_CLOSE)},openPopup:function(){Eniro.Feature.PopupFeature.prototype.openPopup.apply(this,arguments);OpenLayers.Event.observe(this.popup.contentDiv,"click",this.onPopupClick)},getSarMarkup:function(b){var a=[];for(var c in b){if(b[c].length>0){a=a.concat([OpenLayers.i18n("route-list-marker.popup.event."+c.toLowerCase()),": ",b[c].join("; "),"<br />"])}}return a.join("")},CLASS_NAME:"Eniro.Feature.RouteListMarker"});Eniro.RouteController=OpenLayers.Class(Eniro.Control,{activeData:null,waypoints:[],_ignoreRefreshRoute:false,lastRequestId:0,lastProcessedId:0,routeDescriptionSet:{},initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.register(Eniro.Events.ROUTE_SEARCH_DO,this.onRouteSearchDo);this.register(Eniro.Events.ROUTE_SET_START,this.onRouteSetStart);this.register(Eniro.Events.ROUTE_SET_END,this.onRouteSetEnd);this.register(Eniro.Events.ROUTE_SET_VIA,this.onRouteSetVia);this.register(Eniro.Events.ROUTE_MARKER_MOVING,this.onRouteMarkerMoving);this.register(Eniro.Events.ROUTE_MARKER_MOVED,this.onRouteMarkerMoved);this.register(Eniro.Events.ROUTE_ZOOM_TO_EXTENT,this.onZoomToExtent);this.register(Eniro.Events.ROUTE_VIAPOINT_REMOVE,this.onRouteViapointRemove);this.register(Eniro.Events.ROUTE_OPTIONS_CHANGED,this.onRouteOptionsChanged);this.register(Eniro.Events.CONVERT_MARKER,this.onConvertMarker);this.register(Eniro.Events.HISTORY_RESET,this.onHistoryReset)},destroy:function(){this.unregister(Eniro.Events.ROUTE_SEARCH_DO,this.onRouteSearchDo);this.unregister(Eniro.Events.ROUTE_SET_START,this.onRouteSetStart);this.unregister(Eniro.Events.ROUTE_SET_END,this.onRouteSetEnd);this.unregister(Eniro.Events.ROUTE_SET_VIA,this.onRouteSetVia);this.unregister(Eniro.Events.ROUTE_MARKER_MOVING,this.onRouteMarkerMoving);this.unregister(Eniro.Events.ROUTE_MARKER_MOVED,this.onRouteMarkerMoved);this.unregister(Eniro.Events.ROUTE_ZOOM_TO_EXTENT,this.onZoomToExtent);this.unregister(Eniro.Events.ROUTE_VIAPOINT_REMOVE,this.onRouteViapointRemove);this.unregister(Eniro.Events.ROUTE_OPTIONS_CHANGED,this.onRouteOptionsChanged);this.unregister(Eniro.Events.CONVERT_MARKER,this.onConvertMarker);this.unregister(Eniro.Events.HISTORY_RESET,this.onHistoryReset);Eniro.Control.prototype.destroy.apply(this,arguments)},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.map.events.register("zoomend",this,this.onZoom);if(this.map.stateController){this.map.stateController.register("routecontroller",1,this)}},onRouteViapointRemove:function(a){if(a.ordinal>0&&a.ordinal<(this.waypoints.length-1)){this.waypoints.remove(a.ordinal);this.triggerEvent(Eniro.Events.ROUTE_SEARCH_DO,{waypoints:this.waypoints,zoomToExtent:false,routeDescriptionRefresh:true})}},onRouteSetStart:function(a){this.setStartpoint(a.lonlat)},onRouteSetEnd:function(a){this.setEndpoint(a.lonlat)},onRouteSetVia:function(a){this.setViapoint(a.lonlat)},onRouteMarkerMoved:function(a){this.moveEnd=true;this.setWaypoint(a.marker.ord,a.lonlat,false,true);this.waypointsUpdated(a.marker.ord);this.triggerEvent(Eniro.Events.ROUTE_SEARCH_DO,{waypoints:this.waypoints,zoomToExtent:false,routeDescriptionRefresh:true})},onRouteMarkerMoving:function(a){this.moveEnd=false;this.setWaypoint(a.marker.ord,a.lonlat,false,false);this.triggerEvent(Eniro.Events.ROUTE_SEARCH_DO,{waypoints:this.waypoints,snapTo:false})},onRouteSearchDo:function(a){var b=Math.max(this.waypoints.length,a.waypoints.length);for(var c=0,d=b;c<d;c++){if(a.waypoints[c]){this.waypoints[c]=a.waypoints[c]}else{this.waypoints[c]=undefined}}this.searchOptions=a.options;this.refreshRoute(a.waypoints,a.zoomToExtent,a.routeDescriptionRefresh,a.snapTo)},onZoom:function(a){if(!this._ignoreRefreshRoute){this.refreshRoute(this.waypoints,false)}},onRouteQuerySuccess:function(b,a){if(!this._ignoreRefreshRoute){if(!b["request-id"]||((b["request-id"]*1)>this.lastProcessedId)&&(!this.moveEnd||(this.lastRequestId===(b["request-id"]*1)))){this.lastProcessedId=(b["request-id"]*1);this.activeData=b;if(b["route-geometries"]){this.waypoints=this.extractWaypoints(b["route-geometries"]);this.triggerEvent(Eniro.Events.ROUTE_GEOMETRY_AVAILABLE,{model:b["route-geometries"],waypoints:this.waypoints,snapTo:this.snapTo})}if(b["route-instructions"]&&b["route-instructions"][0].features.length>0){this.triggerEvent(Eniro.Events.ROUTE_DESCRIPTION_AVAILABLE,{model:b["route-instructions"]});if(this.zoomToExtent){this.triggerEvent(Eniro.Events.ROUTE_ZOOM_TO_EXTENT,{model:b["route-geometries"]})}else{if(!this.stateReset){this.stateReset=false}}Eniro.AppEvents.triggerEvent(Eniro.Events.STATISTICS_LOG,{scope:"content",event:"route"})}if(!(b["route-instructions"]||b["route-geometries"])){this.onRouteQueryError({data:b},a)}this.moveEnd=false}}if(b["request-id"]){delete this.routeDescriptionSet[b["request-id"]]}},onRouteQueryError:function(b,a){if((b.data&&b.data.instr)||(b.data["request-id"]&&this.routeDescriptionSet[b.data["request-id"]])){Eniro.AppEvents.triggerEvent(Eniro.Events.ROUTE_SEARCH_FAILURE,{request:b,status:a})}},onZoomToExtent:function(a){this.map.zoomToAdjustedExtent(OpenLayers.Bounds.fromArray(((a&&a.bbox)?a.bbox:this.activeData["route-geometries"].bbox)).transform(this.map.backendProjection,this.map.baseLayer.projection),true)},onRouteOptionsChanged:function(a){this.searchFormOptions=a.options},onConvertMarker:function(a){if(a.type===Eniro.Constant.MarkerTypes.ROUTE){var b=new OpenLayers.LonLat(a.marker.lonlat.lon,a.marker.lonlat.lat).transform(this.map.baseLayer.projection,this.map.backendProjection);this.waypoints=[undefined,[b.lon,b.lat].join(",")];if(a.getName){this.getPlacenameForWaypoint(-1)}}},onHistoryReset:function(){this._ignoreRefreshRoute=true},setStartpoint:function(a){this.setWaypoint(0,a,false,true);this.waypointsUpdated(0);this.triggerEvent(Eniro.Events.ROUTE_SEARCH_DO,{waypoints:this.waypoints,zoomToExtent:false,routeDescriptionRefresh:true})},setWaypointLocation:function(b,a){Eniro.AppEvents.triggerEvent(Eniro.Events.ROUTE_WAYPOINT_DATA_SET,{name:b.name,geometry:b.lonlat,ordinal:a});if(b.lonlat){this.setWaypoint(a,b.lonlat)}return(b.name||b.lonlat)},setEndpoint:function(a){this.setWaypoint(-1,a,false,true);this.waypointsUpdated(-1);this.triggerEvent(Eniro.Events.ROUTE_SEARCH_DO,{waypoints:this.waypoints,zoomToExtent:false,routeDescriptionRefresh:true})},setViapoint:function(a){if((this.waypoints.length-2)<this.map.maxViapoints){this.setWaypoint(this.waypoints.length-1,a,true,true);this.waypointsUpdated(this.waypoints.length-2);this.triggerEvent(Eniro.Events.ROUTE_SEARCH_DO,{waypoints:this.waypoints,zoomToExtent:false,routeDescriptionRefresh:true})}},waypointsUpdated:function(a){this.triggerEvent(Eniro.Events.ROUTE_WAYPOINTS_UPDATED,{waypoints:this.waypoints,ordinal:(!isNaN(a*1))?a:null})},refreshRoute:function(f,c,d,b){if(!(f[0]&&f[Math.max((f.length-1),1)])){return}this._ignoreRefreshRoute=false;this.snapTo=b||true;this.zoomToExtent=c||false;var a={waypoints:f.join(";"),res:Math.round(this.map.getResolution()),instr:d||false,requestId:(++this.lastRequestId)};if(d){a.poicat="SPEEDCAMERAS";a.poitol=10;this.routeDescriptionSet[a.requestId]=true}if(this.searchOptions){jQuery.extend(a,this.searchOptions)}if(this.searchFormOptions){jQuery.extend(a,this.searchFormOptions)}jQuery.jsonp({url:Eniro.AppNode.appUrl("/route/route.json"),data:a,callbackParameter:"callback",success:OpenLayers.Function.bind(this.onRouteQuerySuccess,this),error:OpenLayers.Function.bind(this.onRouteQueryError,this),dataFilter:function(g){return JSON.parse(JSON.stringify(g))}})},getPlacenameForWaypoint:function(a){var c=this.waypoints[(a===-1)?this.waypoints.length-1:a];var b=this.waypoints.length;jQuery.jsonp({url:Eniro.AppNode.appUrl("/route/revgc.json"),data:{coord:c},ordinal:a,waypointsUpdated:this.waypointsUpdated,callbackParameter:"callback",success:function(f,d){Eniro.AppEvents.triggerEvent(Eniro.Events.ROUTE_WAYPOINT_NAME_AVAILABLE,{name:f||OpenLayers.i18n("revgc.unknown-place"),ordinal:this.ordinal})},error:function(f,d){Eniro.AppEvents.triggerEvent(Eniro.Events.ROUTE_WAYPOINT_NAME_AVAILABLE,{name:OpenLayers.i18n("revgc.unknown-place"),ordinal:this.ordinal});if(b<2){Eniro.AppEvents.triggerEvent(Eniro.Events.HISTORY_SAVE)}},dataFilter:function(d){return JSON.parse(JSON.stringify(d))}})},extractWaypoints:function(d){var g=[];if(d.features){for(var a=0,f=d.features.length;a<f;++a){var c=d.features[a].geometry.coordinates;g.push(c[0][0][0]+","+c[0][0][1]);if(a===(f-1)){var b=c[c.length-1];g.push(b[b.length-1][0]+","+b[b.length-1][1])}}}return g},setWaypoint:function(b,d,a,c){if(a){this.waypoints.splice(this.waypoints.length-1,0,(Math.round(d.lon*1000000)/1000000)+","+(Math.round(d.lat*1000000)/1000000));b=(this.waypoints.length-2)}else{if(b===-1){this.waypoints[Math.max((this.waypoints.length-1),1)]=d.lon+","+d.lat}else{this.waypoints[b]=d.lon+","+d.lat}}if(c){this.getPlacenameForWaypoint(b)}},performRouteFormSearch:function(){this.triggerEvent(Eniro.Events.ROUTE_FORM_PERFORM_SEARCH)},setRouteOptions:function(a){this.triggerEvent(Eniro.Events.ROUTE_FORM_SET_OPTIONS,a)},saveState:function(){var a={};a.waypoints=this.waypoints;this.stateReset=false;return a},applyState:function(a){this._ignoreRefreshRoute=true;this.waypoints=a.waypoints||[];this.stateReset=true;if(this.waypoints.length<2||!this.waypoints[0]){this.triggerEvent(Eniro.Events.ROUTE_CLEAR)}this.map.setCenter(this.map.getCenter())},draw:function(){return null},CLASS_NAME:"Eniro.RouteController"});Eniro.RouteGeometryView=OpenLayers.Class(Eniro.Control,{routeFeature:null,renderedFeature:null,style:{graphicZIndex:0},initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,[a]);this.register(Eniro.Events.ROUTE_GEOMETRY_AVAILABLE,this.onRouteGeometryAvailable);this.register(Eniro.Events.ROUTE_SEARCH_FAILURE,this.onRouteSearchFailure);this.register(Eniro.Events.ROUTE_MARKERS_CLEARED,this.onRouteMarkersCleared)},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.register(Eniro.Events.ROUTE_SEARCH_DO,this.onRouteSearchDo)},clearGeometry:function(){if(this.routeFeature){this.map.wfs.destroyFeatures(this.routeFeature);this.routeFeature=null}},drawGeometry:function(){if(this.routeFeature){var a={};OpenLayers.Util.extend(a,this.map.wfs.style);OpenLayers.Util.extend(a,this.style);this.routeFeature.style=a;this.map.wfs.addFeatures(this.routeFeature)}},onRouteGeometryAvailable:function(c){this.clearGeometry();var g=new OpenLayers.Format.GeoJSON({externalProjection:new OpenLayers.Projection("EPSG:4326"),internalProjection:this.map.baseLayer.projection});var f={properties:{duration:0,length:0},type:"Feature",geometry:{type:"MultiLineString",coordinates:[]},bbox:c.model.bbox};var b;for(var a=0,d=c.model.features.length;a<d;++a){b=c.model.features[a];f.properties.duration+=b.properties.duration;f.properties.length+=b.properties.length;f.geometry.coordinates=f.geometry.coordinates.concat(b.geometry.coordinates)}this.routeFeature=g.read(f,"Feature");this.drawGeometry()},onRouteSearchFailure:function(a){this.clearGeometry()},onRouteMarkersCleared:function(a){this.clearGeometry()},draw:function(){return null},CLASS_NAME:"Eniro.RouteGeometryView"});Eniro.RouteMarkersView=OpenLayers.Class(Eniro.Control,{features:[],routeListMarker:null,routeListActiveMarker:null,convertedMarkers:[],initialize:function(a){this.features=[];Eniro.Control.prototype.initialize.apply(this,[a]);this.register(Eniro.Events.ROUTE_GEOMETRY_AVAILABLE,this.onRouteGeometryAvailable);this.register(Eniro.Events.ROUTE_WAYPOINTS_UPDATED,this.onRouteWaypointsUpdated);this.register(Eniro.Events.ROUTE_ZOOM_TO_WAYPOINT,this.onRouteZoomToWaypoint);this.register(Eniro.Events.ROUTE_DESCRIPTION_ITEM_MOUSE_OVER,this.onRouteDescriptionItemMouseOver);this.register(Eniro.Events.ROUTE_DESCRIPTION_ITEM_MOUSE_OUT,this.onRouteDescriptionItemMouseOut);this.register(Eniro.Events.ROUTE_DESCRIPTION_ITEM_CLICK,this.onRouteDescriptionItemClick);this.register(Eniro.Events.ROUTE_ZOOM_TO_EXTENT,this.onRouteZoomToExtent);this.register(Eniro.Events.ROUTE_POPUP_CLOSE,this.onRoutePopupClose);this.register(Eniro.Events.CONVERT_MARKER,this.onConvertMarker);this.register(Eniro.Events.CHANGE_ROUTE_DIRECTION,this.onRouteChangeDirection);this.register(Eniro.Events.ROUTE_SEARCH_DO,this.onRouteSearchDo);this.register(Eniro.Events.ROUTE_SEARCH_FAILURE,this.onRouteSearchFailure);this.register(Eniro.Events.ROUTE_CLEAR,this.clearMarkers)},destroy:function(){this.unregister(Eniro.Events.ROUTE_GEOMETRY_AVAILABLE,this.onRouteGeometryAvailable);this.unregister(Eniro.Events.ROUTE_WAYPOINTS_UPDATED,this.onRouteWaypointsUpdated);this.unregister(Eniro.Events.ROUTE_ZOOM_TO_WAYPOINT,this.onRouteZoomToWaypoint);this.unregister(Eniro.Events.ROUTE_DESCRIPTION_ITEM_MOUSE_OVER,this.onRouteDescriptionItemMouseOver);this.unregister(Eniro.Events.ROUTE_DESCRIPTION_ITEM_MOUSE_OUT,this.onRouteDescriptionItemMouseOut);this.unregister(Eniro.Events.ROUTE_DESCRIPTION_ITEM_CLICK,this.onRouteDescriptionItemClick);this.unregister(Eniro.Events.ROUTE_ZOOM_TO_EXTENT,this.onRouteZoomToExtent);this.unregister(Eniro.Events.ROUTE_POPUP_CLOSE,this.onRoutePopupClose);this.unregister(Eniro.Events.CONVERT_MARKER,this.onConvertMarker);this.unregister(Eniro.Events.CHANGE_ROUTE_DIRECTION,this.onRouteChangeDirection);this.unregister(Eniro.Events.ROUTE_SEARCH_DO,this.onRouteSearchDo);this.unregister(Eniro.Events.ROUTE_SEARCH_FAILURE,this.onRouteSearchFailure);this.unregister(Eniro.Events.ROUTE_CLEAR,this.clearMarkers);this.clearMarkers();Eniro.Control.prototype.destroy.apply(this,arguments)},clearMarkers:function(){if(this.features.length>0){if(this.features[0]===undefined){this.features.shift()}this.map.wfs.destroyFeatures(this.features);this.features=[];this.triggerEvent(Eniro.Events.ROUTE_MARKERS_CLEARED)}},onRouteGeometryAvailable:function(a){this.redrawWaypoints(a.waypoints,a.snapTo)},onRouteWaypointsUpdated:function(d){var a;if(d.ordinal===-1){a=this.features.length-1;if(this.features[a]){this.features[a].newStop=true}}else{a=d.ordinal}var b=this.features[a];if(b&&b.routeable&&d.ordinal<1){var c=OpenLayers.LonLat.fromString(d.waypoints[a]);c.transform(this.map.backendProjection,this.map.baseLayer.projection);this.map.wfs.removeFeatures(b);this.features[a]=new Eniro.Feature.WaypointMarker(c,d.ordinal);this.map.wfs.addFeatures(this.features[a]);this.features[a].updateOrdinal(d.ordinal,c)}this.redrawWaypoints(d.waypoints,true)},onRouteZoomToWaypoint:function(b){if(b<0){b=this.features.length+b}var a=this.features[b].geometry.getCentroid();this.map.setCenter(new OpenLayers.LonLat(a.x,a.y),14)},onRouteDescriptionItemMouseOver:function(c){if(!this.routeListMarker){this.routeListMarker=new Eniro.Feature.RouteListMarker(c.lonlat);this.map.wfs.addFeatures(this.routeListMarker)}else{var b;var a;this.routeListMarker.move(c.lonlat);if(this.routeListActiveMarker){b=new OpenLayers.LonLat(this.routeListMarker.geometry.x,this.routeListMarker.geometry.y);a=new OpenLayers.LonLat(this.routeListActiveMarker.geometry.x,this.routeListActiveMarker.geometry.y)}if(b&&b.equals(a)){this.routeListMarker.hide()}else{this.routeListMarker.show(c.lonlat)}}},onRouteDescriptionItemMouseOut:function(a){if(this.routeListMarker){this.routeListMarker.hide()}},onRouteDescriptionItemClick:function(a){this.map.setAdjustedCenter(a.lonlat,12);delete a.window;delete a.type;delete a.element;delete a.cancelBubble;if(!this.routeListActiveMarker){this.routeListActiveMarker=new Eniro.Feature.RouteListMarker(a.lonlat,a);this.map.wfs.addFeatures(this.routeListActiveMarker);this.routeListActiveMarker.openPopup()}else{this.routeListActiveMarker.attributes=a;this.routeListActiveMarker.data=a;this.routeListActiveMarker.style.display="";if(!this.routeListActiveMarker.popup){this.routeListActiveMarker.openPopup()}this.routeListActiveMarker.popup.moveTo(this.map.getLayerPxFromLonLat(a.lonlat));this.routeListActiveMarker.popup.lonlat=a.lonlat;this.routeListActiveMarker.popup.setContentHTML(this.routeListActiveMarker.popupContents(a));this.routeListActiveMarker.move(a.lonlat)}this.routeListActiveMarker.lonlat=a.lonlat},onRoutePopupClose:function(){if(this.routeListActiveMarker){this.routeListActiveMarker.hide()}},onRouteZoomToExtent:function(){if(this.routeListActiveMarker&&this.routeListActiveMarker.popup){this.routeListActiveMarker.popup.moveTo(this.map.getLayerPxFromLonLat(this.routeListActiveMarker.lonlat))}},onConvertMarker:function(a){if(a.type===Eniro.Constant.MarkerTypes.ROUTE){this.clearMarkers();var b=(a.ordinal===-1)?1:a.ordinal;var d=new OpenLayers.LonLat(a.marker.lonlat.lon,a.marker.lonlat.lat).transform(this.map.baseLayer.projection,this.map.backendProjection);var c=new Eniro.Feature.WaypointMarker(new OpenLayers.LonLat(a.marker.geometry.x,a.marker.geometry.y),a.ordinal,{},a.marker);this.map.wfs.addFeatures(c);c.setOriginalFeature(a.marker,false);c.draggable=false;c.mouseover=true;c.newStop=true;this.features[b]=c;var f=[];f[b]=[d.lon,d.lat].join(",");this.redrawWaypoints(f)}},onRouteChangeDirection:function(){var b=this.features.length;if(b===1){this.features[1]=undefined;b++}this.features.reverse();if(this.features[b-1]){this.features[b-1].ord=-1;this.features[b-1].newStop=true}for(var c=1,f=b,a=Math.floor(f/2);c<a;c++){this.swapFeatures(this.features[c],this.features[(f-1)-c])}if(this.features[0]){this.features[0].updateOrdinal(0,new OpenLayers.LonLat(this.features[0].geometry.x,this.features[0].geometry.y))}var d=this.features[this.features.length-1];if(d){d.updateOrdinal(-1,new OpenLayers.LonLat(d.geometry.x,d.geometry.y))}},onRouteSearchDo:function(a){if(a.submit){this.clearRoutableIfMoved(a.waypoints);if(a.waypoints[0]&&a.waypoints[Math.max(a.waypoints.length-1,1)]){if(this.features[this.features.length-1]){this.features[this.features.length-1].newStop=true}this.redrawWaypoints(a.waypoints)}}},onRouteSearchFailure:function(){},swapFeatures:function(d,c){var f=d.ord;d.ord=c.ord;c.ord=f},redrawWaypoints:function(h,g){if(g!==false&&h){var a=Math.max(h.length,this.features.length);for(var d=(a-1);d>=0;--d){if(h[d]){var f=OpenLayers.LonLat.fromString(h[d]);f.transform(this.map.backendProjection,this.map.getProjectionObject());var b=d;if(a>1&&d>(h.length-2)){b=-1}if(this.features[d]){if(this.features[d].ord<b){this.features[d].hide()}if(this.features[d].routeable){this.features[d].show()}else{if(!this.features[d].routeable&&(!(h[0]&&h.length>=2&&b===-1&&this.features[d].ord===-1)||this.features[d].newStop)){this.features[d].updateOrdinal(((b===-1)?-1:d),f);this.features[d].newStop=undefined}}}else{var c=new Eniro.Feature.WaypointMarker(f,b);if(this.features.length>1&&this.features[0]&&this.features[1]){this.features.splice(d-1,0,c)}else{this.features[d]=c}this.map.wfs.addFeatures(c)}}else{if(this.features[d]){if(d!==(this.features.length-1)){this.features[d].hide()}else{this.features[d].updateOrdinal(-1,new OpenLayers.LonLat(this.features[d].geometry.x,this.features[d].geometry.y))}}}}}},clearRoutableIfMoved:function(g){for(var b=0,f=g.length;b<f;b++){if(this.features[b]&&this.features[b].routeable){var d=this.features[b];var c=OpenLayers.LonLat.fromString(g[b]);c.transform(this.map.backendProjection,this.map.baseLayer.projection);if(!this.isAtSamePosition(d,c)){this.map.wfs.destroyFeatures(d);var a=((b===(g.length-1))?-1:b);this.features[b]=new Eniro.Feature.WaypointMarker(c,a);this.map.wfs.addFeatures(this.features[b]);this.features[b].updateOrdinal(a,c)}}}},isAtSamePosition:function(a,b){return(Math.round((a.geometry.x*10000))===Math.round(b.lon*10000))&&(Math.round((a.geometry.y*10000))===Math.round(b.lat*10000))},draw:function(){return null},CLASS_NAME:"Eniro.RouteMarkersView"});Eniro.RouteOptions=OpenLayers.Class(Eniro.Control,{initialize:function(){Eniro.Control.prototype.initialize.apply(this,arguments);this.tabNavigator=new Eniro.TabNavigatorView({collapsible:false,parent:this});this.byCarOptions=new Eniro.ByCarTabView({title:this.i18n("by-car"),id:"by-car"});this.tabNavigator.addControl(this.byCarOptions)},destroy:function(){Eniro.Control.prototype.destroy.apply(this,arguments)},activate:function(){if(!Eniro.Control.prototype.activate.apply(this,arguments)){return false}this.div.appendChild(this.tabNavigator.draw());this.tabNavigator.activate();this.tabNavigator.switchTab("by-car")},assignElements:function(){Eniro.Control.prototype.assignElements.apply(this,arguments);this.options=this._getOptions()},registerObservers:function(){this.observe(this.div,"click",this.onClick)},onClick:function(a){var b=OpenLayers.Event.element(a);if(jQuery(b).is("input")){this.onRouteOptionsChanged()}else{b=jQuery(b).closest("li").get(0);if(b===this.elements.extend){OpenLayers.Event.stop(a);this.triggerEvent(Eniro.Events.ROUTE_VIAPOINT_ADD)}else{if(b===this.elements.direction){OpenLayers.Event.stop(a);this.triggerEvent(Eniro.Events.CHANGE_ROUTE_DIRECTION)}}}},onRouteOptionsChanged:function(f){var g=this.options||{};var b=this._getOptions();var a=f||false;for(var d in b){if((typeof b[d]==="object")&&(typeof g[d]==="object")&&b[d].length){a=a||(g[d].length!==b[d].length);for(var c=0,h=b[d].length;c<h;c++){a=a||(g[d][c]!==b[d][c])}}else{a=a||(g[d]!==b[d])}if(a){break}}if(a){this.options=b;this.triggerEvent(Eniro.Events.ROUTE_OPTIONS_CHANGED,{options:this.options})}},_getOptions:function(){var c=(jQuery(this.div).find("input[name=mode]:checked").length>0)?jQuery(this.div).find("input[name=mode]:checked")[0].value:"FASTEST";var f=[];var b=jQuery(this.div).find("input[type=checkbox]:checked");for(var a=0,d=b.length;a<d;a++){f.push(b[a].value)}return{pref:c,avoid:(f.length>0)?f:undefined}},setOptions:function(a){this.byCarOptions.setOptions(a);this.options=a},toggle:function(){OpenLayers.Element.toggle(this.div);this.triggerEvent(Eniro.Events.ROUTE_OPTIONS_TOGGLED,{visible:OpenLayers.Element.visible(this.div)})},getHTML:function(){this.cssClasses.extend=this.getCssClassName("extend");this.cssClasses.direction=this.getCssClassName("direction");return['<fieldset class="',this.getCssClassName(),'" style="display:none">',"<legend>","<span>",this.i18n("legend"),"</span>","</legend>",'<ul class="',this.getCssClassName("manipulation"),'">','<li class="',this.cssClasses.extend,'">','<a href="/'+new Date().getTime()+'">',this.i18n("extend"),"</a>","</li>",'<li class="',this.cssClasses.direction,'">','<a href="/'+new Date().getTime()+'">',this.i18n("direction"),"</a>","</li>","</ul>","</fieldset>"].join("")},draw:function(){this.div=this.getHTML().toDomElement();return Eniro.Control.prototype.draw.apply(this,arguments)},CLASS_NAME:"Eniro.RouteOptions"});Eniro.RouteResult=OpenLayers.Class(Eniro.Control,{listItems:[],fromName:"",toName:"",sarMarkers:{SPEEDCAMERAS:"speedcamera1.png"},initialize:function(){this.listItems=[];this.fromName="";this.toName="";if(Eniro.Profile.sellable&&Eniro.Profile.sellable.routeDescriptionBanner){}Eniro.Control.prototype.initialize.apply(this,arguments);this.register(Eniro.Events.ROUTE_DESCRIPTION_AVAILABLE,this.sizeToFit);this.register(Eniro.Events.ROUTE_SEARCH_FAILURE,this.onRouteSearchFailure);this.register(Eniro.Events.ROUTE_OPTIONS_TOGGLED,this.sizeToFit);this.register(Eniro.Events.ROUTE_VIAPOINT_ADD_AFTER,this.sizeToFit);this.register(Eniro.Events.ROUTE_VIAPOINT_REMOVE_AFTER,this.sizeToFit);this.register(Eniro.Events.ROUTE_POPUP_INSTRUCTION_PREV,this.onRoutePopupNavigate);this.register(Eniro.Events.ROUTE_POPUP_INSTRUCTION_NEXT,this.onRoutePopupNavigate);this.register(Eniro.Events.AD_DIMENSION_CHANGED,this.sizeToFit)},destroy:function(){this.unregister(Eniro.Events.ROUTE_SEARCH_FAILURE,this.onRouteSearchFailure);this.unregister(Eniro.Events.ROUTE_OPTIONS_TOGGLED,this.sizeToFit);this.unregister(Eniro.Events.ROUTE_VIAPOINT_ADD_AFTER,this.sizeToFit);this.unregister(Eniro.Events.ROUTE_VIAPOINT_REMOVE_AFTER,this.sizeToFit);this.unregister(Eniro.Events.ROUTE_POPUP_INSTRUCTION_PREV,this.onRoutePopupNavigate);this.unregister(Eniro.Events.ROUTE_POPUP_INSTRUCTION_NEXT,this.onRoutePopupNavigate);this.unregister(Eniro.Events.ROUTE_POPUP_CLOSE,this.onRoutePopupClose);this.unregister(Eniro.Events.ROUTE_POPUP_INSTRUCTION_NEXT,this.onRoutePopupNavigate);OpenLayers.Event.stopObserving(window,"resize",this.sizeToFitDestroy);this.sizeToFitDestroy=null;Eniro.Control.prototype.destroy.apply(this,arguments)},registerObservers:function(){this.observe(this.div,"click",this.onClick);this.observe(this.div,"mouseover",this.onMouseOver);this.observe(this.div,"mouseout",this.onMouseOut);this.sizeToFitDestroy=OpenLayers.Function.bind(this.sizeToFit,this);OpenLayers.Event.observe(window,"resize",this.sizeToFitDestroy)},renderResult:function(a){jQuery(this.elements.error).hide().siblings().show();this.drawRouteDescription(a.model);jQuery(this.div).show();this.sizeToFit();if(this.routeDescriptionBanner){this.routeDescriptionBanner.activate()}},onRouteSearchFailure:function(a){jQuery(this.elements.error).show().siblings().hide();jQuery(this.div).show()},onRoutePopupNavigate:function(d){if(d.type===Eniro.Events.ROUTE_POPUP_INSTRUCTION_PREV||d.type===Eniro.Events.ROUTE_POPUP_INSTRUCTION_NEXT){var b=jQuery(this.elements.waypoints).children("."+this.waypointClassName);var c=jQuery(this.elements.waypoints).find("."+this.waypointSelectedClassName).eq(0);var a=b.index(c)+((d.type===Eniro.Events.ROUTE_POPUP_INSTRUCTION_PREV)?-1:1);c=b.get(a);if(c){this.triggerEvt(c,"click")}}},onRoutePopupClose:function(a){this.setActiveListItem()},onClick:function(o){var b=OpenLayers.Event.element(o);var p=jQuery(b).closest("li").get(0);var h=true;if(p===this.elements.quicklinkOverview){OpenLayers.Event.stop(o);h=false;this.triggerEvent(Eniro.Events.ROUTE_ZOOM_TO_EXTENT)}else{if(p===this.elements.quicklinkStart){OpenLayers.Event.stop(o);h=false;this.triggerEvent(Eniro.Events.ROUTE_ZOOM_TO_WAYPOINT,0)}else{if(p===this.elements.quicklinkGoal){OpenLayers.Event.stop(o);h=false;this.triggerEvent(Eniro.Events.ROUTE_ZOOM_TO_WAYPOINT,-1)}else{if(jQuery(b).closest("button").get(0)===this.elements.print){OpenLayers.Event.stop(o);this.triggerEvent(Eniro.Events.OPEN_PRINT_PAGE);h=false}else{var g=jQuery(this.elements.waypoints).children("."+this.waypointClassName).index(p);if(g>=0){OpenLayers.Event.stop(o);h=false;this.setActiveListItem(this.listItems[g].id);var l=jQuery(this.elements.scroll);var c=l.outerHeight();var f=l.offset().top;var d=l.scrollTop();var a=Math.round((jQuery(b).offset().top+d)-f);var k=jQuery(b).outerHeight();if((a-d)<0){l.scrollTop(a-1)}else{if(((a-d)+k)>c){l.scrollTop(a+k-c)}}this.triggerEvent(Eniro.Events.ROUTE_DESCRIPTION_ITEM_CLICK,this.getActiveListItem())}}}}}return h},onMouseOver:function(b){var d=OpenLayers.Event.element(b);var a=jQuery(d).closest("li").get(0);if(a&&!this.mouseover){this.mouseover=true;var c=jQuery(this.elements.waypoints).children("."+this.waypointClassName).index(a);if(c>=0){if(jQuery.browser.msie&&parseInt(jQuery.browser.version,10)<7){var f=this.getSingleCssClassName("waypoint-hover");jQuery(a).addClass(f).siblings("."+f).removeClass(f)}OpenLayers.Event.stop(b);this.triggerEvent(Eniro.Events.ROUTE_DESCRIPTION_ITEM_MOUSE_OVER,this.listItems[c]);return false}}return true},onMouseOut:function(b){var c=OpenLayers.Event.element(b);var a=jQuery(c).closest("li").get(0);if(a){if(Eniro.Util.mouseLeft(b,a)){if(jQuery.browser.msie&&parseInt(jQuery.browser.version,10)<7){var d=this.getSingleCssClassName("waypoint-hover");jQuery(this.elements.waypoints).children("."+this.waypointClassName).removeClass(d)}OpenLayers.Event.stop(b);this.mouseover=false;this.triggerEvent(Eniro.Events.ROUTE_DESCRIPTION_ITEM_MOUSE_OUT);return false}}return true},triggerEvt:function eventFire(b,c){if(b.fireEvent){b.fireEvent("on"+c)}else{var a=document.createEvent("Events");a.initEvent(c,true,false);b.dispatchEvent(a)}},getListItemById:function(c){for(var a=0,b=this.listItems.length;a<b;++a){if(this.listItems[a].id===c){return this.listItems[a]}}return null},getActiveListItem:function(){for(var a=0,b=this.listItems.length;a<b;++a){if(this.listItems[a].selected){return this.listItems[a]}}return null},getSarMarkup:function(a){var b=[];if(a){b.push("<br />");for(var c in a){b=b.concat(['<img class="sar-category-marker" src="'+Eniro.Util.getImagesLocation()+"markers/search/",this.sarMarkers[c]],"?v="+Eniro.Config["media.version"]+'" />')}}return b.join("")},setActiveListItem:function(d){var b=jQuery(this.elements.waypoints).children("."+this.waypointClassName);jQuery(b).removeClass(this.waypointSelectedClassName);for(var a=0,c=this.listItems.length;a<c;++a){if(this.listItems[a].id===d){this.listItems[a].selected=true;jQuery(b[a]).addClass(this.waypointSelectedClassName)}else{this.listItems[a].selected=false}}},parseSarMarkers:function(c){var a;if(c){a={};var d;for(var b=0,f=c.length;b<f;b++){if(c[b]&&c[b].category&&c[b].subject){if(!a[c[b].category]){a[c[b].category]=[]}d=a[c[b].category];if(d.indexOf(c[b].subject)===-1){d.push(c[b].subject)}}}}return a},parseRouteDescription:function(d,c){if(c.signData){var b=c.signData.split(/,\s*/);for(var a=0,f=b.length;a<f;a++){if(b[a].match(/^\d+$/)){b[a]=[this.i18n("road"),b[a]].join(" ")}}c.signData=b.join(", ")}if(c.road&&c.road.match(/^\d+/)){c.road=[this.i18n("road"),c.road].join(" ")}return OpenLayers.i18n("route."+d,c)},sizeToFit:function(){if(!this.map||!this.elements.scroll){return}var g=jQuery(this.elements.scroll).height("auto");if(g.size()>0){var k=0;var f=this.map.getSize();var a=jQuery(this.map.containerDiv).offset();var c=Eniro.map.getControl(Eniro.ControlID.CONTROLBAR_FOOTER);var h=jQuery(c.div).outerHeight();var l=(Math.round(f.h)+Math.round(a.top))-Math.round(g.offset().top)-Math.round(h)-1;if(g.height()>l){var o=jQuery.makeArray(g.find("li"));for(var d=0,b=o.length;d<b;++d){k=Math.max(k,jQuery(o[d]).outerHeight())}g.height(Math.max(l,k))}}},clear:function(){if(this.elements&&this.elements.waypoints){jQuery(this.elements.waypoints).empty()}this.listItems=[]},reset:function(){this.clear();jQuery(this.div).hide()},drawRouteDescription:function(a){var l=[];var t=0;var z=0;var f=0;var B,A,w,u,v,s;if(!a){}else{this.listItems=[];var d=this.getCssClassName("waypoint-description");var q="";if(this.routeDescriptionBanner){q=Eniro.Util.getSingleCssClassName(this.routeDescriptionBanner,"waypoint")}for(B=0,u=a.length;B<u;++B){var F=a[B];var r=F.id;for(A=0,v=F.features.length;A<v;++A){var h=r+"-"+B+"-"+A;var c=F.features[A];if(c.properties.ienc==="stop"){continue}var E=c.properties.iargs;t+=E.dist;z+=E.dur;var b=E.dist;E.dist=E.dist.toDistance(100);var C=this.parseRouteDescription(c.properties.ienc,E);var g=this.parseSarMarkers(c.properties.events);E.dist=b;var D={index:(f+1),id:h,desc:C,sarData:g,coordinates:c.geometry.coordinates,dist:t.toDistance(100),routeId:r,lonlat:new OpenLayers.LonLat(c.geometry.coordinates[0],c.geometry.coordinates[1]).transform(this.map.backendProjection,this.map.baseLayer.projection),events:c.properties.events||[],isLast:(A===v-2)};this.listItems.push(D);l.push(['<li class="',this.waypointClassName,'">','<span class="',this.getCssClassName("waypoint-index"),'">',(f+1),".</span>",'<em class="',this.getCssClassName("waypoint-dist"),'">',D.dist,"</em>",'<span class="',d,'">',D.desc,"</span>",this.getSarMarkup(g),"</li>"].join(""));if(g){l=l.concat([])}if(this.routeDescriptionBanner&&(f===3||(f<3&&B===u-1&&A===v-2))){l.push('<li class="',q,'"></li>')}f++}}}jQuery(this.elements.distance).text(t.toDistance());jQuery(this.elements.duration).text(z.toDuration());jQuery(this.elements.waypoints).html(l.join(""));if(this.routeDescriptionBanner){this.routeDescriptionBanner.deactivate();var p=(this.routeDescriptionBanner.div)?this.routeDescriptionBanner.div:this.routeDescriptionBanner.draw();jQuery(this.elements.waypoints).children("."+q).eq(0).append(p)}this.triggerEvent(Eniro.Events.AD_CONTEXT_SET,{id:Eniro.Profile.sellable.routeContextRectangle,params:{sw1:this.fromName,sw2:this.toName,EASInclude:this.fromName,EASInclude2:this.toName,EASInclude3:t,EASInclude4:z,EASInclude5:this.listItems[0].coordinates[0]+"/"+this.listItems[0].coordinates[1],EASInclude6:this.listItems[this.listItems.length-1].coordinates[0]+"/"+this.listItems[this.listItems.length-1].coordinates[1]}});this.triggerEvent(Eniro.Events.AD_CONTEXT_SET,{id:Eniro.Profile.sellable.routeSkyscraper,params:{sw1:this.fromName,sw2:this.toName,EASInclude:this.fromName,EASInclude2:this.toName,EASInclude3:t,EASInclude4:z,EASInclude5:this.listItems[0].coordinates[0]+"/"+this.listItems[0].coordinates[1],EASInclude6:this.listItems[this.listItems.length-1].coordinates[0]+"/"+this.listItems[this.listItems.length-1].coordinates[1]}})},draw:function(){this.div=this.createDiv();this.cssClasses.error=this.getCssClassName("error");jQuery(this.div).html('<div class="'+this.cssClasses.error+'" style="display:none;">'+this.i18n("route-error")+"</div>");this.cssClasses.print=this.getCssClassName("print");this.cssClasses.quicklinkStart=this.getCssClassName("quicklink-start");this.cssClasses.quicklinkGoal=this.getCssClassName("quicklink-goal");this.cssClasses.quicklinkOverview=this.getCssClassName("quicklink-overview");var b=this.createDiv(null,"quicklinks");jQuery(b).html(['<button class="eniro-button ',this.cssClasses.print,'" type="button" title="',this.i18n("print-tooltip"),'"><span><strong>',this.i18n("print"),"</strong></span></button>","<strong>",this.i18n("quicklinks-title"),":</strong>","<ul>",'<li class="',this.cssClasses.quicklinkStart,'"><a href="">',this.i18n("quicklinks-start"),"</a></li>",'<li class="',this.cssClasses.quicklinkGoal,'"><a href="">',this.i18n("quicklinks-goal"),"</a></li>",'<li class="',this.cssClasses.quicklinkOverview,'"><a href="">',this.i18n("quicklinks-overview"),"</a></li>","</ul>"].join(""));jQuery(this.div).append(b);this.cssClasses.distance=this.getCssClassName("distance");this.cssClasses.duration=this.getCssClassName("duration");jQuery(this.div).append(['<dl class="',this.getCssClassName("summary"),'">',"<dt>",this.i18n("total-length"),"</dt>","<dd>",'<strong class="',this.cssClasses.distance,'">0</strong>',"</dd>","<dt>",this.i18n("total-duration"),"</dt>","<dd>",'<strong class="',this.cssClasses.duration,'">0</strong>',"</dd>","</dl>"].join(""));this.cssClasses.scroll=this.getCssClassName("scroll");this.cssClasses.waypoints=this.getCssClassName("waypoints");var a=jQuery('<div class="'+this.cssClasses.scroll+'"></div>');jQuery(this.div).append(a);a.append('<ol class="'+this.cssClasses.waypoints+'"></ol>');this.waypointClassName=this.getSingleCssClassName("waypoint");this.waypointSelectedClassName=this.getSingleCssClassName("waypoint",null,{selected:true});a.append('<div class="'+this.getCssClassName("copyright")+'">'+this.i18n("route-copyright")+"</div>");return jQuery(this.div).hide()},setLocations:function(b,a){this.fromName=b;this.toName=a},CLASS_NAME:"Eniro.RouteResult"});Eniro.RouteForm=OpenLayers.Class(Eniro.Control,{defaultFields:[],mode:"standard",suggestControllers:{},waypoints:[],initialize:function(a){this.defaultFields=((a&&a.waypoints)?a.waypoints:[]);Eniro.Control.prototype.initialize.apply(this,arguments);if(!Eniro.Util.isArray(this.defaultFields)||this.defaultFields.length===0){this.defaultFields=[{label:this.i18n("start"),cssClass:"start",value:""},{label:this.i18n("end"),cssClass:"end",value:""}]}this.waypoints=jQuery.extend(true,[],this.defaultFields);this.options=new Eniro.RouteOptions();this.register(Eniro.Events.ROUTE_WAYPOINTS_UPDATED,this.onRouteWaypointsUpdated);this.register(Eniro.Events.CHANGE_ROUTE_DIRECTION,this.onChangeRouteDirection);this.register(Eniro.Events.ROUTE_VIAPOINT_ADD,this.onRouteViapointAdd);this.register(Eniro.Events.ROUTE_WAYPOINT_NAME_AVAILABLE,this.onRouteWaypointNameAvailable);this.register(Eniro.Events.ROUTE_WAYPOINT_DATA_SET,this.onRouteWaypointDataSet);this.register(Eniro.Events.ROUTE_FORM_PERFORM_SEARCH,this.onRouteFormPerformSearch);this.register(Eniro.Events.ROUTE_FORM_SET_OPTIONS,this.onRouteFormSetOptions)},destroy:function(){this.unregister(Eniro.Events.ROUTE_WAYPOINTS_UPDATED,this.onRouteMarkerMoved);this.unregister(Eniro.Events.CHANGE_ROUTE_DIRECTION,this.onChangeRouteDirection);this.unregister(Eniro.Events.ROUTE_VIAPOINT_ADD,this.onRouteViapointAdd);this.unregister(Eniro.Events.ROUTE_WAYPOINT_NAME_AVAILABLE,this.onRouteWaypointDataAvailable);this.unregister(Eniro.Events.ROUTE_WAYPOINT_DATA_SET,this.onRouteWaypointNameSet);this.unregister(Eniro.Events.ROUTE_FORM_PERFORM_SEARCH,this.onRouteFormPerformSearch);this.unregister(Eniro.Events.ROUTE_FORM_SET_OPTIONS,this.onRouteFormSetOptions);Eniro.Control.prototype.destroy.apply(this,arguments)},activate:function(){if(!Eniro.Control.prototype.activate.apply(this,arguments)){return false}this.options.activate();this.attachCaption();return true},assignElements:function(){Eniro.Control.prototype.assignElements.apply(this,arguments);this.options.div=jQuery(this.elements.actions).prev().get(0)},registerObservers:function(){Eniro.Control.prototype.registerObservers.apply(this,arguments);this.observe(this.div,"click",this.onClick);this.observe(this.div,"submit",this.submit);this.enableSuggest()},onRouteWaypointsUpdated:function(b){var a=(b.ordinal<0)?b.waypoints[b.waypoints.length-1]:b.waypoints[b.ordinal];this.setWaypoint(a,b.ordinal,b.redraw)},onChangeRouteDirection:function(){this.reverseWaypoints();this.submit(null,false,true,false)},onClick:function(b){var c=OpenLayers.Event.element(b);var a=jQuery(c).closest("li").get(0);if(jQuery(c).is("span."+this.closeButtonClass)){OpenLayers.Event.stop(b);this.onRouteViapointRemove(c)}else{if(a===this.elements.searchmode){OpenLayers.Event.stop(b);this.toggle()}else{if(a===this.elements.submit){OpenLayers.Event.stop(b);this.submit(b,true,true,true,true)}}}},onRouteWaypointNameAvailable:function(a){var c=a.name;var b=(a.ordinal===-1)?(this.waypoints.length-1):a.ordinal;if(this.waypoints[b]){this.waypoints[b].value=(c.match(/^\d+$/))?[this.i18n("road"),c].join(" "):c;this.redrawFields()}},onRouteWaypointDataSet:function(b){var a=[];if(b.fields){a=b.fields}else{a=[b]}var d;for(var c=0,f=a.length;c<f;++c){d=(a[c].geometry?(a[c].geometry.lon+","+a[c].geometry.lat):"");this.setWaypoint({geometry:d,value:a[c].name||d},a[c].ordinal,true)}},onRouteViapointAdd:function(c){if((this.getWaypoints()).length-2<this.map.maxViapoints){var a=this.waypoints.length-1;var b=this.getWaypoints();for(var d=0,f=b.length-1;d<f;d++){this.waypoints[d].value=b[d].value}b[a]="";this.onRouteWaypointsUpdated({ordinal:a,waypoints:b,redraw:true})}},onRouteViapointRemove:function(c){var b=this.getWaypoints();var a=b.index(jQuery(c).siblings("input[type=text]"));this.removeField(c);var d=this.waypoints.splice(a,1)[0];this.triggerEvent(Eniro.Events.ROUTE_VIAPOINT_REMOVE,{ordinal:a})},onSuggestSelect:function(c){if(c.externalId!==undefined){var b=jQuery(this.div).find("input[type=text]");var a=(c.externalId===(b.length-1)?-1:c.externalId);var d=jQuery(b[c.externalId]).siblings("input[type=hidden]").get(0);this.setWaypoint(c,a,false);if(c.event&&c.event.type==="mousedown"){this.redrawFields()}}},onSuggestKeyDown:function(b,c){var a=b.keyCode;if(a===13){if((c.externalId!==this.suggestControllers.length-1)||(c.externalId===(this.suggestControllers.length-1)&&((this.suggestControllers.first.value==="")||(this.suggestControllers.last.value==="")))){OpenLayers.Event.stop(b)}}},onSuggestKeyUp:function(b,c){var a=b.keyCode;if(a===13){this.updateFieldData(c.externalId,c);if(c.externalId===(this.suggestControllers.length-1)&&((this.suggestControllers.first.value==="")||(this.suggestControllers.last.value===""))){OpenLayers.Event.stop(b);this.focus((this.suggestControllers.first.value===""?0:-1))}else{if(c.externalId!==this.suggestControllers.length-1){OpenLayers.Event.stop(b);this.focus(c.externalId+1)}else{OpenLayers.Event.stop(b);this.redrawFields();this.submit(b,true,true,true,false)}}}},onSuggestBlur:function(a,b){this.updateFieldData(b.externalId,b)},onRouteFormPerformSearch:function(a){this.submit(a,true,true,true,false)},onRouteFormSetOptions:function(a){this.options.setOptions(a);this.options.onRouteOptionsChanged(true)},focus:function(a){var b=jQuery(this.div).find("input[type=text]")[(a===-1?this.waypoints.length-1:a)];if(b&&b.focus){b.focus()}},toggle:function(){this.options.toggle();if(this.mode==="standard"){jQuery(this.elements.searchmode).children(":eq(0)").html("&laquo; "+this.i18n("show-standard"));this.mode="advanced"}else{if(this.mode==="advanced"){jQuery(this.elements.searchmode).children(":eq(0)").html(this.i18n("show-advanced")+" &raquo;");this.mode="standard"}else{this.error("Mode not supported")}}},renderActions:function(){this.cssClasses.actions=this.getCssClassName("actions");this.cssClasses.searchmode=this.getCssClassName("searchmode");this.cssClasses.submit=this.getCssClassName("submit");return['<fieldset class="',this.cssClasses.actions,'">',"<ul>",'<li class="',this.cssClasses.searchmode,'">','<a href="/'+new Date().getTime()+'">',this.i18n("show-advanced")+" &raquo;","</a>","</li>",'<li class="',this.cssClasses.submit,'">','<button type="button" class="eniro-button">',"<span>",this.i18n("submit"),"</span>","</button>","</li>","</ul>","</fieldset>"].join("")},renderFields:function(){this.cssClasses.fields=this.getCssClassName("fields");this.cssClasses.waypoints=this.getCssClassName("waypoints");return['<fieldset class="',this.cssClasses.fields,'">',"<legend>","<strong>",this.i18n("waypoints"),"</strong>","</legend>",'<dl class="',this.cssClasses.waypoints,'">',this._renderFields(),"</dl>","</fieldset>"].join("")},_renderFields:function(c){var a=[];if(!c){c=this.defaultFields}for(var b=0,d=c.length;b<d;++b){a.push(this._renderField(c[b]))}return a.join("")},_renderField:function(b){var f=[];var c=[];var d="";if(!b.id){b.id=OpenLayers.Util.createUniqueID(this.id+"-field")}var a="";if(b.cssClass){a=' class="'+this.getCssClassName(b.cssClass)+'"'}b.value=b.value||"";f.push("<dt",a,'><label for="'+b.id,'">',b.label,"</label>","</dt>");c=Eniro.Util.toHTMLAttributes({id:b.id,name:b.id,type:"text",value:((b.value.match(/\w/)||b.value==="")?b.value:"")});d="<input "+Eniro.Util.toHTMLAttributes({type:"hidden",value:b.geometry||""}).join(" ")+" />";if(!this.closeButtonClass){this.closeButtonClass=this.getCssClassName("close-waypoint")}f.push("<dd",a,'><input class="eniro-input-text" ',c.join(" ")," />",d,(b.closebutton?'<span class="'+this.closeButtonClass+'"></span>':""),"</dd>");return f.join("")},setWaypoint:function(b,a,f){var d;var c=a;if(a===0){d=jQuery.extend(true,{},this.defaultFields[0])}else{if(a===-1){c=this.waypoints.length-1;d=jQuery.extend(true,{},this.defaultFields[this.defaultFields.length-1])}else{d={closebutton:true,cssClass:"waypoint",label:this.i18n("via")}}}d.value=((b.value!==undefined)?b.value:b);if(b.geometry!==undefined){d.geometry=b.geometry}else{if(typeof b==="string"){d.geometry=b}else{d.geometry=""}}if(a===(this.waypoints.length-1)){this.waypoints.splice((this.waypoints.length-1),0,d)}else{this.waypoints[c]=d}if(f){this.redrawFields()}},getWaypoints:function(){return jQuery(this.div).find("."+this.cssClasses.waypoints+" input[type=text]")},reset:function(){this.waypoints=jQuery.extend(true,[],this.defaultFields);this.redrawFields()},submit:function(r,s,o,k,g){if(r){OpenLayers.Event.stop(r)}var p=[];if(g){var h=jQuery(this.div).find("input[type=text]");var f=false;for(var d=0,a=h.length;d<a;d++){var q=h[d];if(this.waypoints[d]&&q&&jQuery("<div>"+this.waypoints[d].value+"</div>").text()!==jQuery(q).val()){var l=(d===((jQuery(this.div).find("input[type=text]")).length-1)?-1:d);this.setWaypoint({value:jQuery(q).val()},l,false);f=true}p.push(jQuery(q))}if(f){this.redrawFields()}}else{for(var c=0,b=this.waypoints.length;c<b;c++){if(this.waypoints[c]){p.push(this.waypoints[c].value)}}}var t=function(u){this.triggerEvent(Eniro.Events.ROUTE_SEARCH_DO,{waypoints:u,zoomToExtent:s,routeDescriptionRefresh:o,submit:k,waypointNames:p});this.redrawFields()};this.findWaypointsValues(OpenLayers.Function.bind(t,this));return false},addViapoint:function(a){jQuery(this.div).find("dt:last").before(this._renderField(a))},removeField:function(a){jQuery(a).closest("dd").prev("dt").remove().end().remove();this.triggerEvent(Eniro.Events.ROUTE_VIAPOINT_REMOVE_AFTER)},updateFieldData:function(d,c){var b=jQuery(this.div).find("input[type=text]").get(d);if(this.waypoints[d]&&b&&(jQuery("<div>"+this.waypoints[d].value+"</div>").text()!==jQuery(b).val())){var a=(d===((jQuery(this.div).find("input[type=text]")).length-1)?-1:d);this.setWaypoint({value:jQuery(b).val()},a,true)}},reverseWaypoints:function(){var c=this.getWaypoints();var g;var b;for(var d=0,f=c.length,a=Math.floor(f/2);d<f;d++){if(d<a){this.swapWaypoints(c[d],c[(f-1)-d]);g=this.waypoints[d].geometry;b=this.waypoints[d].value;this.waypoints[d].geometry=this.waypoints[(f-1)-d].geometry;this.waypoints[d].value=this.waypoints[(f-1)-d].value;this.waypoints[(f-1)-d].geometry=g;this.waypoints[(f-1)-d].value=b}}},swapWaypoints:function(h,d){var l=jQuery(h).val();var k=jQuery(d).val();var g=jQuery(h).siblings("[type=hidden]");var f=jQuery(d).siblings("[type=hidden]");var c=(g.length>0)?g.get(0).value:"";var o=(f.length>0)?f.get(0).value:"";jQuery(h).val(k);jQuery(d).val(l);g.get(0).value=o;f.get(0).value=c},findWaypointsValues:function(q){if(typeof q!=="function"){this.error("Callback for 'findWaypointsValues' was not a function");return}var p=[];var l=this.getWaypoints();var d=[];for(var g=0,b=l.length;g<b;++g){var o=l[g].value;var k=jQuery(l[g]).siblings("[type=hidden]");if(k.length>0&&k.get(0).value!==""){o=k.get(0).value}else{this.waypoints[g]=this.waypoints[g]||{};if(o.replace("\\s+","").match(/^(\d+(\.\d+)?)[,;\:](\d+(\.\d+)?)$/)){this.waypoints[g].value=o;o=o.replace("\\s+","").replace("[:;]",",");this.waypoints[g].geometry=o}else{if(o!==""){d.push({value:o,index:g,inputId:l[g].id})}else{o=undefined;this.waypoints[g].value="";this.waypoints[g].geometry=""}}}if(o){p.push(o)}}if(d.length){var h={lookups:d.length,waypoints:this.waypoints,values:p};var c=this.triggerEvent;var r=function(){c(Eniro.Events.ROUTE_SEARCH_FAILURE,{})};var a=function(u){if(u&&u.features&&u.features[0]){var s=u.features[0].attributes;var v=this.resultObject;var t=s.routeLonlat||s.lonlat;v.values[this.index]=t.lon+","+t.lat;v.waypoints[this.index].value=Eniro.Util.FeatureUtils.getAddressAsString(u.features[0]);v.waypoints[this.index].geometry=v.values[this.index];v.lookups--;if(v.lookups===0){q(v.values)}}else{r()}};for(g=0,b=d.length;g<b;g++){var f=d[g];this.triggerEvent(Eniro.Events.SEARCH_DO,{p:Eniro.Profile.search.location.provider,ap:Eniro.Profile.search.location.provider,q:f.value,pageSize:1,success:OpenLayers.Function.bind(a,{resultObject:h,index:d[g].index})})}}else{q(p)}},draw:function(){this.div=['<form method="get" class="',this.getCssClassName("form"),'" action="">',this.renderFields(),this.options.getHTML(),this.renderActions(),"</form>"].join("").toDomElement();return Eniro.Control.prototype.draw.apply(this,arguments)},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments)},enableSuggest:function(){this.disableSuggest();var b=jQuery(this.div).find("input[type=text]");this.suggestControllers={length:b.length};for(var a=0;a<b.length;a++){this.suggestControllers[b[a].id]=new Eniro.Suggest(b[a],new Eniro.Suggest.DataSource(),{p:"route_"+Eniro.Profile.id,ap:"route_"+Eniro.Profile.id,id:a,currentQuery:jQuery(b[a]).val(),callbacks:{select:OpenLayers.Function.bind(this.onSuggestSelect,this),keydown:OpenLayers.Function.bind(this.onSuggestKeyDown,this),keyup:OpenLayers.Function.bind(this.onSuggestKeyUp,this),blur:OpenLayers.Function.bind(this.onSuggestBlur,this)}});if(a===0){this.suggestControllers.first=this.suggestControllers[b[a].id]}else{if(a===(b.length-1)){this.suggestControllers.last=this.suggestControllers[b[a].id]}}}},disableSuggest:function(){for(var a in this.suggestControllers){if(this.suggestControllers[a].destroy){this.suggestControllers[a].destroy()}}},attachCaption:function(){var a=jQuery(this.div).find("input[type=text]");if(a.length>=2){Eniro.Util.enableInputCaption(a.get(0),this.i18n("caption-start"));Eniro.Util.enableInputCaption(a.get(a.length-1),this.i18n("caption-goal"))}},redrawFields:function(a){a=a||this.waypoints;this.disableSuggest();jQuery(this.elements.waypoints).html(this._renderFields(a));this.attachCaption();this.enableSuggest()},saveState:function(){var a={};a.waypoints=this.waypoints;a.options=this.options.options;return a},applyState:function(a){if(a.options){this.options.setOptions(a.options);this.options.onRouteOptionsChanged(true)}if(a.waypoints&&a.waypoints.length){this.waypoints=a.waypoints;this.redrawFields();this.submit(null,false,true,true)}},CLASS_NAME:"Eniro.RouteForm"});Eniro.RouteSkyscraper=OpenLayers.Class(Eniro.Banner,{initialize:function(){if(Eniro.Profile.sellable&&Eniro.Profile.sellable.routeSkyscraper){Eniro.Banner.prototype.initialize.apply(this,[Eniro.Profile.sellable.routeSkyscraper,["route"],["map","aerial","hybrid","nautical"]])}},destroy:function(){this.unregister(Eniro.Events.AD_CONTEXT_SET,this.onAdContextSet)},activate:function(){if(Eniro.Banner.prototype.activate.apply(this,arguments)){this.register(Eniro.Events.AD_CONTEXT_SET,this.onAdContextSet);this.map.events.register("zoomend",this,this.onZoomEnd);return true}return false},onZoomEnd:function(){this.showIfAllowed()},onAdContextSet:function(a){if(a.id!==this.cu){return}this.loadBanner(a.params)},isShowAllowed:function(){if(Eniro.Banner.prototype.isShowAllowed.apply(this,arguments)){return this.mode==="route"||this.map.getZoom()<13}return false},CLASS_NAME:"Eniro.RouteSkyscraper"});Eniro.RouteTabView=OpenLayers.Class(Eniro.TabView,{initialize:function(){Eniro.TabView.prototype.initialize.apply(this,arguments);this.form=new Eniro.RouteForm({parent:this});if(Eniro.Profile.sellable&&Eniro.Profile.sellable.routeRectangle){this.ad=new Eniro.Banner.RouteRectangle(Eniro.Profile.sellable.routeRectangle,["route"],["map","aerial","hybrid","nautical"],[],[4,5,6,7])}if(Eniro.Profile.sellable&&Eniro.Profile.sellable.routeContextRectangle){this.contextAd=new Eniro.Banner.Context(Eniro.Profile.sellable.routeContextRectangle,["route"],["map","aerial","hybrid","nautical"],[],[],[Eniro.Events.ROUTE_SEARCH_FAILURE,Eniro.Events.ROUTE_CLEAR],[Eniro.Events.ROUTE_DESCRIPTION_AVAILABLE],{id:"route-ad",displayBeforeLoad:true})}if(Eniro.Profile.sellable&&Eniro.Profile.sellable.routeSkyscraper){this.skyscraper=new Eniro.Banner.Context(Eniro.Profile.sellable.routeSkyscraper,["route"],["map","aerial","hybrid","nautical"],[],[4,5,6,7,8,9,10,11,12,13,14,15,16],{displayWithoutParameters:true})}this.result=new Eniro.RouteResult();this.register(Eniro.Events.ROUTE_DESCRIPTION_AVAILABLE,this.onRouteDescriptionAvailable);this.register(Eniro.Events.ROUTE_SET_START,this.onRouteSetWaypoint);this.register(Eniro.Events.ROUTE_SET_VIA,this.onRouteSetWaypoint);this.register(Eniro.Events.ROUTE_SET_END,this.onRouteSetWaypoint);this.register(Eniro.Events.CONVERT_MARKER,this.onConvertMarker);this.register(Eniro.Events.ROUTE_SEARCH_FAILURE,this.onRouteSearchFailure);this.register(Eniro.Events.ROUTE_SEARCH_DO,this.onRouteSearchDo);this.register(Eniro.Events.ROUTE_CLEAR,this.onRouteClear)},destroy:function(){this.unregister(Eniro.Events.ROUTE_SET_START,this.onRouteSetWaypoint);this.unregister(Eniro.Events.ROUTE_SET_VIA,this.onRouteSetWaypoint);this.unregister(Eniro.Events.ROUTE_SET_END,this.onRouteSetWaypoint);this.unregister(Eniro.Events.ROUTE_DESCRIPTION_AVAILABLE,this.onRouteDescriptionAvailable);this.unregister(Eniro.Events.CONVERT_MARKER,this.onConvertMarker);this.unregister(Eniro.Events.ROUTE_SEARCH_FAILURE,this.onRouteSearchFailure);this.unregister(Eniro.Events.ROUTE_SEARCH_DO,this.onRouteSearchDo);this.unregister(Eniro.Events.ROUTE_CLEAR,this.onRouteClear)},activate:function(){if(Eniro.TabView.prototype.activate.apply(this,arguments)){this.form.activate();if(this.ad){this.ad.activate()}if(this.contextAd){this.contextAd.activate()}if(this.skyscraper){this.skyscraper.activate()}this.result.activate();return true}return false},setMap:function(a){Eniro.TabView.prototype.setMap.apply(this,arguments);this.form.setMap(a);if(this.ad){this.ad.setMap(a)}if(this.contextAd){this.contextAd.setMap(a)}if(this.skyscraper){this.map.getControl(Eniro.ControlID.LAYERBAR).addRightControl(this.skyscraper)}this.result.setMap(a);if(this.map.stateController){this.map.stateController.register("route",10,this)}},onRouteSetWaypoint:function(){this.triggerEvent(Eniro.Events.MODE_SWITCH,{mode:this.id})},onConvertMarker:function(a){if(a.type===Eniro.Constant.MarkerTypes.ROUTE){this.triggerEvent(Eniro.Events.MODE_SWITCH,{mode:"route"});this.reset(true);if(this.form&&typeof this.form.setWaypoint==="function"){var b=new OpenLayers.LonLat(a.marker.lonlat.lon,a.marker.lonlat.lat).transform(this.map.baseLayer.projection,this.map.backendProjection);this.form.setWaypoint({geometry:b.lon+","+b.lat,value:a.marker.getMarkerTitle()||""},-1,true)}}},onRouteSearchFailure:function(a){this.triggerEvent(Eniro.Events.MODE_SWITCH,{mode:this.id});this.reset(false)},onRouteSearchDo:function(a){if(a.submit){this.reset(false)}},onShow:function(){if(this.form){this.form.focus(0)}jQuery("#header-inner").removeClass("map");jQuery("#header-inner").addClass("route")},onHide:function(){},onRouteClear:function(){this.reset(false)},getContent:function(){return[this.form.draw(),(this.ad?this.ad.draw():""),(this.contextAd?this.contextAd.draw():""),this.result.draw()]},reset:function(a){if(this.ad){this.ad.showIfAllowed()}if(this.contextAd){this.contextAd.showIfAllowed()}if(a){if(this.result&&typeof this.result.clear==="function"){this.result.reset()}if(this.form&&typeof this.form.reset==="function"){this.form.reset()}if(this.skyscraper){this.skyscraper.showIfAllowed()}this.triggerEvent(Eniro.Events.ROUTE_CLEAR)}else{if(this.result&&typeof this.result.clear==="function"){this.result.clear()}}},saveState:function(){var a={};a.form=this.form.saveState();a.mode=this.id;return a},applyState:function(a){if(this.active){if(a.form){if(a.form.waypoints[0].value===""||a.form.waypoints[1].value===""){this.reset(true)}this.form.applyState(a.form)}}},onRouteDescriptionAvailable:function(a){var d=this.form.waypoints;var c=d[0].value;var b=d[d.length-1].value;this.result.setLocations(c,b);this.result.renderResult(a)},CLASS_NAME:"Eniro.RouteTabView"});Eniro.RouteFormItem=OpenLayers.Class(Eniro.Control,{label:undefined,value:undefined,tabindex:undefined,accesskey:undefined,initialize:function(){Eniro.Control.prototype.initialize.apply(this,arguments)},draw:function(){var a=Eniro.Util.toHTMLAttributes({id:this.id,name:this.id,type:"text",accesskey:this.accesskey,tabindex:this.tabindex});this.div=["<dt>",'<label for="',this.id,'">',this.label,"</label>","</dt>"].join("").toDomElement();this.dd=["<dd>","<input ",a.join(" ")," />","</dd>"].join("").toDomElement();return[this.div,this.dd]},CLASS_NAME:"Eniro.RouteFormItem"});Eniro.RouteFormViaItem=OpenLayers.Class(Eniro.RouteFormItem,{id:undefined,label:undefined,value:undefined,tabindex:undefined,accesskey:undefined,CSS_PREFIX:"route-form-waypoint-",initialize:function(){Eniro.RouteFormItem.prototype.initialize.apply(this,arguments)},assignElements:function(){this.deleteButton=this.find("dd span")},registerObservers:function(){this.observe(this.div,"click",this.onClick)},onClick:function(a){var c=OpenLayers.Event.element(a);if(c===this.deleteButton){var b=this.closest(c,"span."+this.id);this.remove(b)}return false},draw:function(){var a=Eniro.RouteFormItem.prototype.draw.apply(this,arguments);a[0].className="waypoint";a[1].className="waypoint";this.addCloseButton(a[1]);return a},addCloseButton:function(a){a.appendChild("<span></span>".toDomElement())},CLASS_NAME:"Eniro.RouteFormViaItem"});Eniro.ByCarTabView=OpenLayers.Class(Eniro.TabView,{initialize:function(){Eniro.TabView.prototype.initialize.apply(this,arguments)},_renderFieldsets:function(){var b={length:2,data:[{label:"show",contents:[{id:"fastest",name:"mode",type:"radio",checked:"checked",value:"FASTEST"},{id:"shortest",name:"mode",type:"radio",value:"SHORTEST"}]},{label:"avoid",contents:[{id:"highway",name:"highway",type:"checkbox",value:"HIGHWAY"},{id:"ferry",name:"ferry",type:"checkbox",value:"FERRY"}]}]};var h=[];for(var f=0,k=b.length;f<k;f++){var g=b.data[f];h.push('<fieldset class="eniro-col-'+(f+1)+'">');h.push('<legend><span class="eniro-show eniro-strong">'+this.i18n(g.label)+"</span></legend>");for(var d=0,a=g.contents.length;d<a;d++){var c=g.contents[d];h.push('<label for="'+c.id+'">');h.push('<input id="'+c.id+'" type="'+c.type+(c.checked?'" checked="checked"':"")+'" value="'+c.value+'" name="'+c.name+'"/>');h.push(this.i18n(c.id)+"</label>")}h.push("</fieldset>")}return h.join("")},getContent:function(){return[['<fieldset class="eniro-two-col">',"<legend>","<span>",this.i18n("car"),"</span>","</legend>",this._renderFieldsets(),"</fieldset>"].join("")]},setOptions:function(b){var a;if(b.pref){a=jQuery(this.div).find("input[type=radio]").filter("#"+b.pref.toLowerCase());if(a.length){a[0].checked=true}}if(b.avoid){for(var c=0,d=b.avoid.length;c<d;c++){a=jQuery(this.div).find("input[type=checkbox]").filter("#"+b.avoid[c].toLowerCase());if(a.length){a[0].checked=true}}}},CLASS_NAME:"Eniro.ByCarTabView"});Eniro.DropDown=OpenLayers.Class(Eniro.Control,{items:[],columns:4,currentIndex:null,initialize:function(){this.items=[];this.currentIndex=0;Eniro.Control.prototype.initialize.apply(this,arguments)},destroy:function(){if(this.items){for(var a=0,b=this.items.length;a<b;++a){if(typeof this.items[a].destroy==="function"){this.items[a].destroy()}}}this.items=null;this.selector=null;this.view=null;Eniro.Control.prototype.destroy.apply(this,arguments)},selectItem:function(a){if(a>=0&&a<=(this.items.length-1)){this.currentIndex=a;return this.items[a]}this.error("Index out of bounds");return null},getCurrentItem:function(){return this.items[this.currentIndex]},toggle:function(){jQuery(this.div).toggleClass("dropdown-open")},open:function(){jQuery(this.div).addClass("dropdown-open")},close:function(){jQuery(this.div).removeClass("dropdown-open")},getViewContentHTML:function(){var a=["This is your view!"];return a.join("")},getSelectorHTML:function(){var a=["This is your selector!"];return a.join("")},draw:function(){this.div=Eniro.Util.createDiv("dropdown","dropdown");this.selector=Eniro.Util.createDiv(null,"dropdown-selector");this.selector.innerHTML=this.getSelectorHTML();this.view=Eniro.Util.createDiv(null,"dropdown-view");this.view.innerHTML=this.getViewContentHTML();this.div.appendChild(this.selector);this.div.appendChild(this.view);return this.div},CLASS_NAME:"Eniro.DropDown"});Eniro.Tooltip=OpenLayers.Class(Eniro.Control,{minOffset:{x:10,y:24},initialize:function(){Eniro.Control.prototype.initialize.apply(this,arguments)},draw:function(){this.div=this.createDiv();return this.div},show:function(){if(this.div){jQuery(this.div).show()}},hide:function(){if(this.div){jQuery(this.div).hide()}},visible:function(){return !(jQuery(this.div).is(":hidden"))},setPosition:function(a){var b=this.getOffset();a=a.clone();a.x+=b.x;a.y-=b.y;jQuery(this.div).css("top",a.y).css("left",a.x)},setContents:function(a){jQuery(this.div).html(a)},getContents:function(){return jQuery(this.div).html()},getOffset:function(){return{x:this.minOffset.x,y:jQuery(this.div).height()+this.minOffset.y}},CLASS_NAME:"Eniro.Tooltip"});Eniro.DrawState=OpenLayers.Class({pointsState:null,lineState:null,polygonState:null,activeControl:"point",initialize:function(){this.pointsState=[];this.lineState=[];this.polygonState=[]},addPoint:function(a){this.pointsState.push(a)},addPointToLine:function(a){this.lineState.push(a)},addPointToPolygon:function(a){this.polygonState.push(a)}});Eniro.DrawPoint=OpenLayers.Class({x:null,y:null,longlat:null,marker:null,calloutText:null,isPopupOpen:false,mode:null,initialize:function(b,g,c,d,a,f){this.x=b;this.y=g;this.longlat=new OpenLayers.LonLat(b,g);this.marker=c;this.calloutText=d;this.isPopupOpen=a;this.mode=f}});Eniro.DrawController=OpenLayers.Class(Eniro.Control,{measureControls:{},measurePopup:null,measureMarkers:null,measureMarkersInfo:null,currentType:null,isRegistered:false,maxAllowedLineLength:400,nagleTooltipPosition:null,nagle:"360 °",nagleTooltips:[],previousLineSegment:null,stateApplied:false,pointMarkers:[],initialize:function(){this.pointMarkers=[];this.measureMarkers=[];this.measureMarkersInfo=[];Eniro.Control.prototype.initialize.apply(this,arguments);Eniro.Config=Eniro.Config||{"media.version":123};var a={Point:{pointRadius:0,strokeWidth:0,externalGraphic:Eniro.Util.getImagesLocation()+"markers/draw/crosshair.png?v="+Eniro.Config["media.version"],graphicOpacity:1,graphicWidth:18,graphicHeight:18,graphicXOffset:-10,graphicYOffset:-10},Line:{strokeWidth:6,strokeOpacity:0.5,strokeColor:"#006fbd",strokeDashstyle:"solid"},Polygon:{strokeWidth:3,strokeOpacity:0.5,strokeColor:"#006fbd",fillColor:"white",fillOpacity:0.4}};var b=new OpenLayers.Style();b.addRules([new OpenLayers.Rule({symbolizer:a})]);var c=new OpenLayers.StyleMap({"default":b});this.measureControls={point:new OpenLayers.Control.Measure(Eniro.Handler.DrawHandlerPoint,{data:{type:"point"},handlerOptions:{layerOptions:{styleMap:c}},callbacks:{create:OpenLayers.Function.bind(this.onMeasureStart,this),mouseup:OpenLayers.Function.bind(this.onMeasureMouseUp,this),deactivate:OpenLayers.Function.bind(this.onDeactivate,this)},eventListeners:{measure:this.onMeasureComplete,scope:this},draw:function(){return null}}),line:new OpenLayers.Control.Measure(Eniro.Handler.DrawHandlerPath,{persist:true,geodesic:true,data:{type:"line"},handlerOptions:{layerOptions:{styleMap:c}},callbacks:{create:OpenLayers.Function.bind(this.onMeasureStart,this),modify:OpenLayers.Function.bind(this.onMeasureModify,this),mouseup:OpenLayers.Function.bind(this.onMeasureMouseUp,this),deactivate:OpenLayers.Function.bind(this.onDeactivate,this)},eventListeners:{measure:this.handleMeasurements,measurepartial:this.handleMeasurements,scope:this},getBestLength:function(o,g,d){var k=g?g:"m";var p=d?d:0;var h=this.getLength(o,k);h=h.toDistance(10000,p,2);h=h.split(" ");var f=h.length-1;k=g?g:h[f];return[h.slice(0,f).join(" "),k]},draw:function(){return null}}),polygon:new OpenLayers.Control.Measure(Eniro.Handler.DrawHandlerPolygon,{persist:true,geodesic:true,data:{type:"polygon"},handlerOptions:{layerOptions:{styleMap:c}},callbacks:{create:OpenLayers.Function.bind(this.onMeasureStart,this),modify:OpenLayers.Function.bind(this.onMeasureModify,this),mouseup:OpenLayers.Function.bind(this.onMeasureMouseUp,this)},eventListeners:{measure:this.handleMeasurements,measurepartial:this.handleMeasurements,scope:this},getBestArea:function(h){var g="m";var f=this.getArea(h,g);f=f.toArea(10000,0,2);f=f.split(" ");var d=f.length-1;return[f.slice(0,d).join(" "),f[d]]},draw:function(){return null}})};this.activeControlId="line";this.drawTooltip=new Eniro.DrawTooltip()},setMap:function(c){this.map=c;this.map.events.register("zoomend",this,this.refreshNagleTooltips);this.map.stateController.register("draw",10,this);var b;for(var a in this.measureControls){if(this.measureControls.hasOwnProperty(a)){b=this.measureControls[a];this.map.addControl(b)}}},refreshNagleTooltips:function(){if(this.previousLineSegment!==null){this.handleMeasurements(this.previousLineSegment)}if(this.stateApplied){var f=this.measureControls.line.handler;if(f.line.geometry){this.refresh(f)}if(f.drawingComplete){this.drawTooltip.hide()}}this.clearNagleTooltips();if((Eniro.map.baseLayer.layerId==="nautical")&&(this.currentType==="line")){var d=this.measureControls.line.handler.getGeometry();if(d){var b=d.components;_comp=b;if(b&&b.length>2){lineStringCount=0;while(lineStringCount<b.length-1){var a=b[lineStringCount];var c=new OpenLayers.Geometry.LineString([b[lineStringCount],b[lineStringCount+1]]);this.nagle=this.calculateNagle(c);this.createNagleTooltip(a);lineStringCount++}this.nagleTooltipPosition=d.components[d.components.length-2]}}}},calculateNagle:function(c){var a=0;var d=this.measureControls.line.getLength(c);var f="360 °";var b=c.components[0];var p=c.components[1];var o=p.x-b.x;var h=p.y-b.y;var g=c.clone();var l=new OpenLayers.Geometry.Point(b.x,p.y);g.components[1]=l;var k=this.measureControls.line.getLength(g);if(d===0){f="360 °"}else{if(o>0&&h>0){a=(Math.acos(k/d)*360)/(2*Math.PI);f=a.toFixed(1)+" °"}else{if(o>0&&h<=0){a=(Math.acos(-k/d)*360)/(2*Math.PI);f=a.toFixed(1)+" °"}else{if(o<=0&&h<0){a=(Math.acos(k/d)*360)/(2*Math.PI)+180;f=a.toFixed(1)+" °"}else{a=(Math.acos(-k/d)*360)/(2*Math.PI)+180;f=a.toFixed(1)+" °"}}}}return f},destroy:function(){this.clearMeasures();for(var b in this.measureMarkers){var a=this.measureMarkers[b];if(a&&(typeof a!=="function")){a.closePopup();a.hide();a.destroy();a=null}}for(var d in this.measureControls){if(this.measureControls.hasOwnProperty(d)){this.measureControls[d].destroy();delete this.measureControls[d]}}this.measureControls=null;this.destroyPointMarkers();this.drawTooltip.destroy();this.map.events.unregister("zoomend",this,this.refreshNagleTooltips);this.unregister(Eniro.Events.CHANGE_BASE_LAYER,this.refreshNagleTooltips)},activate:function(){if(this.activeControlId){this.toggleControl(this.activeControlId)}return Eniro.Control.prototype.activate.apply(this,arguments)},deactivate:function(){this.clearMeasures();this.destroyPointMarkers();this.drawTooltip.hide();var b=null;for(var a in this.measureControls){if(this.measureControls.hasOwnProperty(a)){b=this.measureControls[a];if(b.active){this.activeControlId=a}b.deactivate()}}return Eniro.Control.prototype.deactivate.apply(this,arguments)},onMeasureStart:function(a){this.hideMeasureMarker(this.currentType);if(this.measureMarkers[this.currentType]){this.measureMarkers[this.currentType].reset()}this.clearNagleTooltips()},clearNagleTooltips:function(){while(this.nagleTooltips.length>0){var a=this.nagleTooltips.pop();a.remove()}this.nagleTooltipPosition=null},onMeasureComplete:function(b){var f;var h;var g;var d=this.getGeometryType(b.geometry);var a=this.measureMarkers[d];if(this.isPoint(b.geometry)){h=b.geometry;g=new OpenLayers.LonLat(h.x,h.y);a=new Eniro.Feature.DrawPointMarker(g,{parent:this});this.pointMarkers.push(a);this.map.wfs.addFeatures(a);a.openPopup()}else{var c=this.measureMarkersInfo[d];if(this.isLine(b.geometry)){f=b.geometry.components;h=f[f.length-1]}else{if(this.isPolygon(b.geometry)){f=b.geometry.components[0].components;h=f[f.length-2]}}g=new OpenLayers.LonLat(h.x,h.y);if(!a){a=new Eniro.Feature.DrawMeasureMarker(g,{},{parent:this,geometryType:d});this.map.wfs.addFeatures(a);this.measureMarkers[d]=a}else{a.style.display="";a.move(g)}this.drawTooltip.hide();a.measure=b.measure;a.units=b.units;a.order=b.order;a.attributes=b;if(c){a.text=c.text;a.mode=c.mode}if(!c||(c&&c.isPopupOpen)){a.openPopup()}}},onMeasureModify:function(b,d){var k=0;if(this.nagleTooltipPosition===null){this.nagleTooltipPosition=b.clone()}if(d&&d.geometry){var a={};if(d.geometry.CLASS_NAME.indexOf("LineString")>-1){var g=d.geometry.clone().components;var f=["0 m"];if((Eniro.map.baseLayer.layerId==="nautical")&&(this.currentType==="line")){k=this.measureControls.line.getBestLength(d.geometry,"nmi",2)}else{k=this.measureControls.line.getBestLength(d.geometry)}if(g&&g.length>=2){var h=new OpenLayers.Geometry.LineString([g[g.length-2],g[g.length-1]]);if((Eniro.map.baseLayer.layerId==="nautical")&&(this.currentType==="line")){f=this.measureControls.line.getBestLength(h,"nmi",2);a.nagle=this.calculateNagle(h);this.nagle=a.nagle}else{f=this.measureControls.line.getBestLength(h)}}a.segmentLength=f.join(" ");a.totalLength=k.join(" ")}else{var c=this.measureControls.polygon.getBestArea(d.geometry);a={totalArea:[c.join(" ")].concat(["<sup>2</sup>"]).join("")}}if(!this.drawTooltip.visible()){this.drawTooltip.show()}this.drawTooltip.setFields(a);this.drawTooltip.setPosition(this.map.getLayerPxFromLonLat(new OpenLayers.LonLat(b.x,b.y)))}},createNagleTooltip:function(a){var b=new Eniro.DrawNagleTooltip();this.map.layerContainerDiv.appendChild(b.draw());b.show();b.setNagle(this.nagle);b.setPosition(this.map.getLayerPxFromLonLat(new OpenLayers.LonLat(a.x,a.y)));this.nagleTooltips.push(b)},onMeasureMouseUp:function(a){if(this.nagleTooltipPosition!==null&&Eniro.map.baseLayer.layerId==="nautical"&&this.currentType==="line"){this.createNagleTooltip(this.nagleTooltipPosition.clone());this.nagleTooltipPosition=null}var d=this.map.wfs.getFeatureFromEvent(a);for(var c in this.measureMarkers){if(this.measureMarkers[c]===d){this.toggleControl(c);Eniro.AppEvents.triggerEvent(Eniro.Events.DRAW_CONTROL_ACTIVATED,{type:c});this.measureMarkers[c].onClick(a);var f=this.measureControls[c].handler;a.object.data={type:c};a.geometry=f.getSketch().geometry;a.measure=this.measureMarkers[c].measure;a.units=this.measureMarkers[c].units;a.order=this.measureMarkers[c].order;this.handleMeasurements(a);return false}}if(this.pointMarkers&&this.pointMarkers.length>0){for(var b=0,g=this.pointMarkers.length;b<g;++b){if(d===this.pointMarkers[b]){this.toggleControl("point");Eniro.AppEvents.triggerEvent(Eniro.Events.DRAW_CONTROL_ACTIVATED,{type:"point"});this.pointMarkers[b].onClick(a);return false}}}if(d!==null){return false}return true},onDeactivate:function(a){if(!a){return}if(a==="point"){this.destroyPointMarkers()}},isLine:function(a){return(a&&a.CLASS_NAME==="OpenLayers.Geometry.LineString")},isPolygon:function(a){return(a&&a.CLASS_NAME==="OpenLayers.Geometry.Polygon")},isPoint:function(a){return(a&&a.CLASS_NAME==="OpenLayers.Geometry.Point")},getGeometryType:function(a){if(this.isPoint(a)){return"point"}else{if(this.isLine(a)){return"line"}else{if(this.isPolygon(a)){return"polygon"}else{OpenLayers.Console.error(this.CLASS_NAME,'Geometry: "',a,'" not supported')}}}return null},hideMarkers:function(){this.hideMeasureMarkers();this.hidePointMarkers()},hideMeasureMarkers:function(){for(var a in this.measureMarkers){if(this.measureMarkers[a].closePopup&&((typeof this.measureMarkers[a].closePopup)==="function")){this.measureMarkers[a].closePopup()}if(this.measureMarkers[a].hide&&((typeof this.measureMarkers[a].hide)==="function")){this.measureMarkers[a].hide()}}},hideMeasureMarker:function(b){var a=this.measureMarkers[b];if(a){a.closePopup();a.hide()}},hidePointMarkers:function(){if(this.pointMarkers&&this.pointMarkers.length>0){for(var a=0,b=this.pointMarkers.length;a<b;++a){this.pointMarkers[a].closePopup();this.pointMarkers[a].hide()}}},destroyPointMarkers:function(){if(this.pointMarkers&&this.pointMarkers.length>0){for(var a=0,b=this.pointMarkers.length;a<b;++a){this.pointMarkers[a].destroy()}this.pointMarkers=null}},undoMeasure:function(){var d=null;var h=this.getActiveMeasureControl();var c=h.handler;var g=c.getGeometry();if(g){var b=this.getGeometryType(g);if(c.drawn){var a=false;if(b==="polygon"){g=g.components[0];if(g&&g.components.length>3){if(g.components.length>4){g.removeComponent(g.components[g.components.length-3])}else{g.components.pop();OpenLayers.Geometry.Collection.prototype.removeComponent.apply(g,[g.components[g.components.length-2]]);OpenLayers.Geometry.Collection.prototype.addComponent.apply(g,[g.components[0]])}a=true}}else{if(b==="line"&&g.components.length>2){g.removeComponent(g.components[g.components.length-2]);d=this.nagleTooltips.pop();if(d){d.remove();this.nagleTooltipPosition=g.components[g.components.length-2]}a=true}}if(a){this.refresh(c)}else{c.removePoint();h.cancel();d=this.nagleTooltips.pop();if(d){d.remove();this.nagleTooltipPosition=null}this.drawTooltip.hide()}}else{this.hideMeasureMarker(b);if(b==="polygon"){g=g.components[0];g.removeComponent(g.components[g.components.length-3])}else{if(b=="line"){g.removeComponent(g.components[g.components.length-1])}}c.drawingComplete=false;c.drawn=true;c.drawing=false;c.dragged=false;c.wasFreehanded=false;c.clearMouseEvents();g._drawRefresh=true;var f=this.map.getPixelFromLonLat(new OpenLayers.LonLat(this.measureMarkers[b].geometry.x,this.measureMarkers[b].geometry.y));c.addPoint(f);c.lastUp=f}}},refresh:function(a){if(!a){a=this.getActiveMeasureControl().handler}var b=a.geometryClone();OpenLayers.Geometry.Collection.prototype.removeComponent.apply(b,[b.components[b.components.length-1]]);b._drawRefresh=true;a.callback("point",[a.point.geometry,b]);a.drawFeature()},resetMeasuring:function(b){b=b||this.currentType;this.clearMeasuresByType(b);this.hideMeasureMarker(b);this.drawTooltip.hide();this.clearNagleTooltips();delete this.measureMarkers[b];for(var a=0,c=this.tabNavigator.controls.length;a<c;++a){if(this.tabNavigator.controls[a].TYPE===b&&typeof this.tabNavigator.controls[a].reset==="function"){this.tabNavigator.controls[a].reset()}}},getActiveMeasureControl:function(){for(var a in this.measureControls){if(this.measureControls.hasOwnProperty(a)&&this.measureControls[a].active){return this.measureControls[a]}}},clearMeasures:function(){for(var a in this.measureControls){if(this.measureControls.hasOwnProperty(a)&&this.measureControls[a].handler){this.measureControls[a].handler.cancel(true)}}},clearMeasuresByType:function(a){var b=this.measureControls[a];b.handler.cancel(true)},toggleControl:function(d){this.currentType=d;for(var b in this.measureControls){if(this.measureControls.hasOwnProperty(b)){var f=this.measureControls[b];if(d==b){f.activate();var a=this.measureMarkers[d];if(a){var c=this.getTabViewByType(d);c.onMeasure({measure:a.measure,units:a.units,order:a.order})}}else{f.deactivate()}}}},toggleGeodesic:function(b){for(var a in this.measureControls){if(this.measureControls.hasOwnProperty(a)){this.measureControls[a].geodesic=b}}},getTabViewByType:function(a){return this.tabNavigator.getTabView("draw-"+a)},handleMeasurements:function(a){this.previousLineSegment=jQuery.extend({},a);if(!this.stateApplied){this.stateApplied=true}if((Eniro.map.baseLayer.layerId==="nautical")&&(this.currentType==="line")){a.measure=this.measureControls.line.getBestLength(a.geometry,"nmi",2)[0];a.units=this.measureControls.line.getBestLength(a.geometry,"nmi",2)[1]}var b=this.getTabViewByType(a.object.data.type);if((a.geometry&&a.geometry.CLASS_NAME==="OpenLayers.Geometry.Polygon")||(a.geometry.components.length>2)||((a.geometry._drawRefresh||a.type==="measure")&&a.geometry.components.length===2)){b.onMeasure(a)}else{b.reset()}if(a.type==="measure"){this.onMeasureComplete(a)}},getMarkerInfo:function(b){var a=this.measureMarkers[b];var c={};if(a){c.text=a.text;c.isPopupOpen=a.popup?true:false;c.mode=a.mode;c.measure=a.measure}return c},setMarkerInfo:function(c,g,a,f,b){var d={text:g,isPopupOpen:a,mode:f,measure:b};this.measureMarkersInfo[c]=d},saveState:function(){var o=new Eniro.DrawState();if(this.active){var q=[];for(var t in this.measureControls){if(this.measureControls.hasOwnProperty(t)){var g=this.measureControls[t];var r=g.handler.getGeometry();var c=this.getMarkerInfo(t);if(!r&&g.handler.ispoint){for(var h=0,d=this.pointMarkers.length;h<d;h++){var s=this.pointMarkers[h].geometry;o.addPoint(new Eniro.DrawPoint(s.x,s.y,this.pointMarkers[h].style.externalGraphic,this.pointMarkers[h].text,(this.pointMarkers[h].popup?true:false),this.pointMarkers[h].mode))}if(g.active){o.activeControl="point"}}else{if(this.isLine(r)){if(r.components.length<=this.maxAllowedLineLength){for(var f=0,a=r.components.length-1;f<=a;f++){var b=r.components[f];o.addPointToLine(new Eniro.DrawPoint(b.x,b.y,null,c.text,c.isPopupOpen,c.mode))}if(g.active){o.activeControl="line"}}else{q.push(OpenLayers.i18n("state.error.draw.too_much_data"))}}else{if(this.isPolygon(r)){r=r.components[0].components;if(r.length<=this.maxAllowedLineLength){for(var p=0,k=r.length;p<k;p++){var u=r[p];o.addPointToPolygon(new Eniro.DrawPoint(u.x,u.y,null,c.text,c.isPopupOpen,c.mode))}if(g.active){o.activeControl="polygon"}}else{q.push(OpenLayers.i18n("state.error.draw.too_much_data"))}}}}}}if(q.length){q=q.join(", ");o.error=OpenLayers.i18n("state.error.draw")+": "+q;if(!o.activeControl){o.activeControl="line"}}}return o},applyState:function(a){if(this.active){var b=a.activeControl||"line";if(a.pointsState.length||a.lineState.length||a.polygonState.length){this.setPointsState(a.pointsState,(b==="point"));this.setLineState(a.lineState,(b==="line"));this.setPolygonState(a.polygonState,(b==="polygon"));this.currentType=b;this.measureMarkersInfo=[];Eniro.AppEvents.triggerEvent(Eniro.Events.DRAW_CONTROL_ACTIVATED,{type:b})}}},setPointsState:function(f,g){if(f.length===0){return}this.currentType="point";this.measureControls.point.handler.deactivate(true);this.measureControls.point.handler.activate();for(var c=0,b=f.length;c<b;c++){var d=new OpenLayers.LonLat(f[c].x,f[c].y);var a=new Eniro.Feature.DrawPointMarker(d,{extGraphics:f[c].marker,popup:f[c].isPopupOpen,calloutText:f[c].calloutText,mode:f[c].mode});a.layer=this.measureControls.point.handler.layer;if(f[c].isPopupOpen){a.openPopup()}this.pointMarkers.push(a);this.map.wfs.addFeatures(a)}if(!g){this.measureControls.point.handler.deactivate()}},setLineState:function(c,d){var b=c.length;if(b===0){return}var a=c[b-1];this.currentType="line";this.setMarkerInfo(this.currentType,a.calloutText,a.isPopupOpen,a.mode,a.measure);this.measureControls.line.handler.deactivate(true,true);this.measureControls.line.handler.activate();this.measureControls.line.handler.drawPoints(c);this.refreshNagleTooltips();if(!d){this.measureControls.line.handler.deactivate()}},setPolygonState:function(c,d){var b=c.length;if(b===0){return}this.currentType="polygon";var a=c[b-1];this.setMarkerInfo(this.currentType,a.calloutText,a.isPopupOpen,a.mode,a.measure);this.measureControls.polygon.handler.activate();this.measureControls.polygon.handler.drawPoints(c);if(!d){this.measureControls.polygon.handler.deactivate()}},onRemovePopup:function(a){this.resetMeasuring(a)},onRemovePointMarker:function(a){for(var c=0,d=this.pointMarkers.length;c<d;++c){if(a===this.pointMarkers[c]){var b=this.pointMarkers.slice(0,c).concat(this.pointMarkers.slice(c+1,d));delete this.pointMarkers[c];this.pointMarkers=b;break}}},CLASS_NAME:"Eniro.DrawController"});Eniro.DrawPointMarkerDropDown=OpenLayers.Class(Eniro.DropDown,{columns:5,initialize:function(){Eniro.DropDown.prototype.initialize.apply(this,arguments);var a=Eniro.Config["media.version"];this.items=[Eniro.Util.getImagesLocation()+"markers/draw/blue.png?v="+a,Eniro.Util.getImagesLocation()+"markers/draw/red.png?v="+a,Eniro.Util.getImagesLocation()+"markers/draw/green.png?v="+a]},assignElements:function(){this.selector=jQuery(this.div).children("div.dropdown-selector").get(0);this.view=jQuery(this.div).children("div.dropdown-view").get(0)},onClick:function(a){var d=OpenLayers.Event.element(a);var c=jQuery(d).parents("div:not(.dropdown-view-row):eq(0)");if(c.is("div.dropdown-view")){OpenLayers.Event.stop(a);var b=c.children().children(":not(br)").index(d);this.selectItem(b);this.close();if(this.parent&&typeof this.parent.onDropDownSelect==="function"){this.parent.onDropDownSelect(this.getCurrentItem(),b,this.items)}}else{if(c.is("div.dropdown-selector")){OpenLayers.Event.stop(a);this.toggle()}}},selectItem:function(a){if(a>=0&&a<=(this.items.length-1)){this.currentIndex=a;jQuery(this.selector).find("img:eq(0)").attr("src",this.items[this.currentIndex]);return this.items[this.currentIndex]}this.error("Index out of bounds");return null},getViewContentHTML:function(){var b=['<div class="dropdown-view-row">'];if(this.items){for(var a=0,c=this.items.length;a<c;++a){b.push('<img src="'+this.items[a]+'" alt="" />');if(a>0&&((a+1)%this.columns===0)){b.push('</div><div class="dropdown-view-row">')}}}b.push("</div>");return b.join("").replace(/<div class="dropdown\-view\-row"><\/div>/gi,"")},getSelectorHTML:function(){var a=this.items?['<a href=""><img width="32" height="35" src="'+this.items[this.currentIndex]+'" alt="" /></a>']:[];return a.join("")},getHTML:function(){return jQuery("<div></div>").append(this.draw()).html()},setSelectorImage:function(d){for(var c=0,a=this.items.length;c<a;c++){var b=this.items[c];if(b===d){this.currentIndex=c;break}}},CLASS_NAME:"Eniro.DrawPointMarkerDropDown"});Eniro.Feature.DrawPointMarker=OpenLayers.Class(Eniro.Feature.PopupFeature,{dropdown:null,draggable:false,mode:"write",text:"",reassignedDropdownDiv:false,popupContents:function(a){return['<div class="draw-popup-write">','<div class="draw-popup-content">','<span class="draw-popup-title">',OpenLayers.i18n("draw-marker.popup.description"),"</span>",'<textarea rows="5" cols="20" onkeydown="Eniro.Util.stopArrowKeysEvent(event)" class="draw-popup-input">',Eniro.Util.LinkParser.decode(this.text),"</textarea>","</div>",'<div class="draw-popup-dropdown">',this.dropdown.getHTML(),"</div>",'<div class="draw-popup-buttons">','<input class="draw-popup-remove" type="submit" value="',OpenLayers.i18n("draw-marker.popup.button-remove"),'">','<input class="draw-popup-save" type="submit" value="',OpenLayers.i18n("draw-marker.popup.button-save"),'">',"</div>","</div>",'<div class="draw-popup-read">','<div class="draw-popup-content">',this.text,"</div>",'<div class="draw-popup-links">','<a href="/'+new Date().getTime()+'" class="draw-popup-route">',OpenLayers.i18n("draw-marker.popup.link-route"),"</a> ",'<a href="/'+new Date().getTime()+'" class="draw-popup-remove">',OpenLayers.i18n("draw-marker.popup.link-remove"),"</a> ",'<a href="/'+new Date().getTime()+'" class="draw-popup-edit">',OpenLayers.i18n("draw-marker.popup.link-edit"),"</a>","</div>","</div>"].join("")},initialize:function(g,a,b){this.parent=a.parent;this.dropdown=new Eniro.DrawPointMarkerDropDown({parent:this});a=a||{};b=b||{};var c=(a.extGraphics)?a.extGraphics:this.dropdown.getCurrentItem();this.text=(a.calloutText)?a.calloutText:"";this.mode=(a.mode)?a.mode:"write";this.dropdown.setSelectorImage(c);var d={externalGraphic:c,graphic:true,graphicZIndex:9001,graphicWidth:32,graphicHeight:35,graphicYOffset:-35,graphicXOffset:-9,pointRadius:0};OpenLayers.Util.extend(d,b.style||{});b.style=d;var f={resultType:"draw"};OpenLayers.Util.extend(f,b.popupOptions||{});b.popupOptions=f;this.div=true;Eniro.Feature.PopupFeature.prototype.initialize.apply(this,[g,a,b])},destroy:function(){if(this.dropdown&&typeof this.dropdown.destroy==="function"){this.dropdown.destroy()}if(this.popup&&this.popup.contentDiv){OpenLayers.Event.stopObservingElement(this.popup.contentDiv)}Eniro.Feature.PopupFeature.prototype.destroy.apply(this,arguments)},onDropDownSelect:function(c,b,a){this.style.externalGraphic=c;this.show()},onPopupClick:function(a){this.dropdown.onClick(a);var b=OpenLayers.Event.element(a);if(jQuery(b).is("input.draw-popup-save")){OpenLayers.Event.stop(a);this.savePopup()}else{if(jQuery(b).is("a.draw-popup-edit")){OpenLayers.Event.stop(a);this.editPopup()}else{if(jQuery(b).is("input.draw-popup-remove")||jQuery(b).is("a.draw-popup-remove")){OpenLayers.Event.stop(a);this.remove()}else{if(jQuery(b).is("a.draw-popup-route")){OpenLayers.Event.stop(a);this.lonlat=new OpenLayers.LonLat(this.geometry.x,this.geometry.y);this.setMode("route");Eniro.AppEvents.triggerEvent(Eniro.Events.CONVERT_MARKER,{marker:this.clone(),type:Eniro.Constant.MarkerTypes.ROUTE,ordinal:-1,getName:true})}else{return true}}}}},onPopupCloseButton:function(){this.reassignedDropdownDiv=false;Eniro.Feature.PopupFeature.prototype.onPopupCloseButton.apply(this,arguments)},savePopup:function(){this.processText();this.setMode("read");this.setPopupContent();this.popup.updateSize()},editPopup:function(){this.setMode("write");this.setPopupContent();this.popup.updateSize()},setPopupContent:function(a){if(this.mode==="read"){jQuery(this.popup.contentDiv).find(".draw-popup-read .draw-popup-content").html((a)?a:this.text)}else{if(this.mode==="write"){jQuery(this.popup.contentDiv).find(".draw-popup-write .draw-popup-content textarea").val(Eniro.Util.LinkParser.decode((a)?a:this.text))}}},processText:function(){this.text=Eniro.Util.LinkParser.encode(jQuery(this.popup.contentDiv).find(".draw-popup-write textarea.draw-popup-input").val())},setMode:function(a){if(a==="write"||a==="read"){this.mode=a;if(this.popup&&this.popup.contentDiv){jQuery(this.popup.contentDiv).find(".draw-popup-"+a).show().siblings().hide()}}else{if(a==="route"){this.mode=a}else{OpenLayers.Console.error(this.CLASS_NAME,'Mode: "',a,'" not supported')}}},remove:function(){if(this.parent&&typeof this.parent.onRemovePointMarker==="function"){this.parent.onRemovePointMarker(this)}this.destroy()},openPopup:function(){Eniro.Feature.PopupFeature.prototype.openPopup.apply(this,arguments);this.setMode(this.mode);OpenLayers.Event.observe(this.popup.contentDiv,"click",OpenLayers.Function.bind(this.onPopupClick,this));jQuery(this.popup.div).addClass("draw-popup");jQuery(this.popup.groupDiv).addClass("draw-popup-group");jQuery(this.popup.contentDiv).addClass("draw-popup-container");if(!this.reassignedDropdownDiv){this.dropdown.div=jQuery(this.popup.contentDiv).find("div.dropdown").get(0);this.dropdown.assignElements();this.reassignedDropdownDiv=true}this.popup.updateSize()},getMarkerTitle:function(){return Eniro.Util.LinkParser.decode(this.text)},clone:function(){var a=Eniro.Feature.PopupFeature.prototype.clone.apply(this,arguments);if(this.mode==="route"){a.popupContents=this.text}return a},CLASS_NAME:"Eniro.Feature.DrawPointMarker"});Eniro.DrawMeasurePopup=OpenLayers.Class(Eniro.Popup.Feature,{initialize:function(b,a){Eniro.Popup.Feature.prototype.initialize.apply(this,arguments);this.positionBlocks.tl.offset=new OpenLayers.Pixel(0,32);this.positionBlocks.tr.offset=new OpenLayers.Pixel(0,32);this.positionBlocks.bl.offset=new OpenLayers.Pixel(0,-15);this.positionBlocks.br.offset=new OpenLayers.Pixel(0,-15)},CLASS_NAME:"Eniro.DrawMeasurePopup"});Eniro.Feature.DrawMeasureMarker=OpenLayers.Class(Eniro.Feature.PopupFeature,{draggable:false,mode:"write",text:"",geometryType:"",popupContents:function(a){return['<div class="draw-popup-write">','<span class="draw-popup-title">',((a.order===2)?OpenLayers.i18n("draw-marker.popup.area"):OpenLayers.i18n("draw-marker.popup.length")),": <strong>",a.measure," ",a.units,((a.order===2)?"<sup>2</sup>":""),"</strong>","</span>",'<div class="draw-popup-content">','<textarea rows="5" cols="20" onkeydown="Eniro.Util.stopArrowKeysEvent(event)" class="draw-popup-input">',Eniro.Util.LinkParser.decode(this.text),"</textarea>","</div>",'<div class="draw-popup-buttons">','<input class="draw-popup-remove" type="submit" value="',OpenLayers.i18n("draw-marker.popup.button-remove"),'">','<input class="draw-popup-save" type="submit" value="',OpenLayers.i18n("draw-marker.popup.button-save"),'">',"</div>","</div>",'<div class="draw-popup-read">','<span class="draw-popup-title">',((a.order===2)?OpenLayers.i18n("draw-marker.popup.area"):OpenLayers.i18n("draw-marker.popup.length")),": <strong>",a.measure," ",a.units,"</strong>","</span>",'<div class="draw-popup-content">',this.text,"</div>",'<div class="draw-popup-links">','<a href="/'+new Date().getTime()+'" class="draw-popup-remove">',OpenLayers.i18n("draw-marker.popup.link-remove"),"</a> ",'<a href="/'+new Date().getTime()+'" class="draw-popup-edit">',OpenLayers.i18n("draw-marker.popup.link-edit"),"</a>","</div>","</div>"].join("")},popupClass:Eniro.DrawMeasurePopup,popupOptions:{resultType:"draw"},style:{pointRadius:0,strokeWidth:0,graphic:true,graphicZIndex:9100,graphicWidth:18,graphicHeight:18,graphicYOffset:-10,graphicXOffset:-10},initialize:function(c,a,b){this.style.externalGraphic=Eniro.Util.getImagesLocation()+"markers/draw/crosshair.png";a=a||{};b=b||{};b.style=b.style||{};b.popupOptions=b.popupOptions||{};OpenLayers.Util.extend(b.style,this.style);OpenLayers.Util.extend(b.popupOptions,this.popupOptions);this.div=true;Eniro.Feature.PopupFeature.prototype.initialize.apply(this,[c,a,b]);this.geometryType=b.geometryType},destroy:function(){if(this.popup&&this.popup.contentDiv){OpenLayers.Event.stopObservingElement(this.popup.contentDiv)}Eniro.Feature.PopupFeature.prototype.destroy.apply(this,arguments)},onDropDownSelect:function(c,b,a){this.style.externalGraphic=c;this.show()},onPopupClick:function(a){var b=OpenLayers.Event.element(a);if(jQuery(b).is("input.draw-popup-save")){OpenLayers.Event.stop(a);this.savePopup()}else{if(jQuery(b).is("a.draw-popup-edit")){OpenLayers.Event.stop(a);this.editPopup()}else{if(jQuery(b).is("input.draw-popup-remove")||jQuery(b).is("a.draw-popup-remove")){OpenLayers.Event.stop(a);this.remove()}else{return true}}}},savePopup:function(){this.processText();this.setMode("read");this.setPopupContent();this.popup.updateSize()},editPopup:function(){this.setMode("write");this.setPopupContent();this.popup.updateSize()},setPopupContent:function(a){if(this.mode==="read"){jQuery(this.popup.contentDiv).find(".draw-popup-read .draw-popup-content").html((a)?a:this.text)}else{if(this.mode==="write"){jQuery(this.popup.contentDiv).find(".draw-popup-write .draw-popup-content textarea").val(Eniro.Util.LinkParser.decode((a)?a:this.text))}}},processText:function(){this.text=Eniro.Util.LinkParser.encode(jQuery(this.popup.contentDiv).find(".draw-popup-write textarea.draw-popup-input").val())},setMode:function(a){if(a==="write"||a==="read"){this.mode=a;if(this.popup){jQuery(this.popup.contentDiv).find(".draw-popup-"+a).show().siblings().hide()}}else{OpenLayers.Console.error(this.CLASS_NAME,'Mode: "',a,'" not supported')}},remove:function(){if(this.parent&&typeof this.parent.onRemovePopup==="function"){this.parent.onRemovePopup(this.geometryType)}},reset:function(){this.text="";this.setMode("write")},openPopup:function(){Eniro.Feature.PopupFeature.prototype.openPopup.apply(this,arguments);this.setMode(this.mode);OpenLayers.Event.observe(this.popup.contentDiv,"click",OpenLayers.Function.bind(this.onPopupClick,this));jQuery(this.popup.div).addClass("draw-popup");jQuery(this.popup.groupDiv).addClass("draw-popup-group");jQuery(this.popup.contentDiv).addClass("draw-popup-container");this.popup.updateSize()},CLASS_NAME:"Eniro.Feature.DrawMeasureMarker"});Eniro.DrawTabView=OpenLayers.Class(Eniro.TabView,{drawController:null,initialize:function(){Eniro.TabView.prototype.initialize.apply(this,arguments);this.drawController=new Eniro.DrawController();this.tabNavigator=new Eniro.TabNavigatorView({collapsible:false,parent:this,id:"draw-type"});this.tabNavigator.addControl(new Eniro.DrawPointTabView({title:this.i18n("draw-point"),id:"draw-point"}));this.tabNavigator.addControl(new Eniro.DrawLineTabView({title:this.i18n("draw-line"),id:"draw-line"}));this.tabNavigator.addControl(new Eniro.DrawPolygonTabView({title:this.i18n("draw-polygon"),id:"draw-polygon"}));this.handler=new OpenLayers.Handler.Keyboard(this,{keydown:this.handleKeydown});if(Eniro.Profile.sellable&&Eniro.Profile.sellable.drawSkyscraper){this.skyscraper=new Eniro.Banner(Eniro.Profile.sellable.drawSkyscraper,["draw"],["map","aerial","hybrid","nautical"],[],[4,5,6,7,8,9,10,11,12,13,14,15,16])}this.register(Eniro.Events.DRAW_CONTROL_ACTIVATED,this.drawControlActivated)},destroy:function(){Eniro.TabView.prototype.destroy.apply(this,arguments);this.drawController.destroy()},activate:function(){if(Eniro.TabView.prototype.activate.apply(this,arguments)){this.drawController.activate();this.tabNavigator.activate();this.drawController.tabNavigator=this.tabNavigator;this.tabNavigator.switchTab("draw-line");if(this.skyscraper){this.skyscraper.activate()}return true}return false},deactivate:function(){if(Eniro.TabView.prototype.deactivate.apply(this,arguments)){this.drawController.deactivate();this.tabNavigator.deactivate();return true}return false},registerObservers:function(){Eniro.TabView.prototype.registerObservers.apply(this,arguments);this.observe(this.div,"click",this.onClick);this.observe(this.div,"mousedown",OpenLayers.Event.stop);this.observe(this.div,"mouseup",OpenLayers.Event.stop);this.observe(this.div,"dblclick",OpenLayers.Event.stop)},setMap:function(a){Eniro.TabView.prototype.setMap.apply(this,arguments);this.tabNavigator.setMap(a);this.drawController.setMap(a);if(this.skyscraper){this.skyscraper.setMap(a);this.map.getControl(Eniro.ControlID.LAYERBAR).addRightControl(this.skyscraper)}},onOpenTab:function(a){this.drawController.toggleControl(a.TYPE)},onClick:function(a){var b=OpenLayers.Event.element(a);var c=this.getTabByType(this.drawController.currentType);if(c.isUndo(b)){OpenLayers.Event.stop(a);this.drawController.undoMeasure()}else{if(c.isClear(b)){OpenLayers.Event.stop(a);this.drawController.resetMeasuring()}else{if(jQuery(b).closest("[class$=map-link]")[0]){OpenLayers.Event.stop(a);this.triggerEvent(Eniro.Events.ACTIVATE_TOOL,"community-link")}else{if(jQuery(b).closest("[class$=mail]")[0]){OpenLayers.Event.stop(a);this.triggerEvent(Eniro.Events.ACTIVATE_TOOL,"community-mail")}}}}},onShow:function(){if(this.active){this.drawController.activate()}},onHide:function(){this.drawController.deactivate()},getTabByType:function(c){for(var b=0,a=this.tabNavigator.controls.length;b<a;b++){var d=this.tabNavigator.controls[b];if(d.TYPE===c){return d}}},drawControlActivated:function(a){var b="draw-"+a.type;this.tabNavigator.switchTab(b)},onRemovePopup:function(){this.resetMeasuring()},getContent:function(){var a=this.drawController.drawTooltip.draw();this.map.layerContainerDiv.appendChild(a);return[this.getContentHTML(),this.tabNavigator.draw()]},getContentHTML:function(){return""},handleKeydown:function(a){if(a.keyCode==OpenLayers.Event.KEY_DELETE){this.drawController.undoMeasure()}},CLASS_NAME:"Eniro.DrawTabView"});Eniro.DrawTypeTabView=OpenLayers.Class(Eniro.TabView,{TYPE:null,useIcon:true,useFooter:true,defaultOutputValue:"",initialize:function(){Eniro.TabView.prototype.initialize.apply(this,arguments)},activate:function(){if(Eniro.TabView.prototype.activate.apply(this,arguments)){this.reset();return true}return false},onMeasure:function(a){this.setHTML(a.measure+" "+a.units+((a.order>1)?("<sup>"+a.order+"</sup>"):""))},reset:function(){this.setHTML(this.defaultOutputValue)},setHTML:function(a){if(this.elements.outputValue){jQuery(this.elements.outputValue).html(a)}},getContent:function(){var a=[].concat(this.getContentHTML());if(this.useFooter){a=a.concat(this.getFooterHTML())}return a},getContentHTML:function(){return[["Your content goes here."].join("")]},getFooterHTML:function(){this.cssClasses.linkToMap=[this.getCssClassName("footer-item","",{position:"first"}),this.getSingleCssClassName("map-link")].join(" ");this.cssClasses.mail=[this.getCssClassName("footer-item","",{position:"last"}),this.getSingleCssClassName("mail")].join(" ");return[['<ul class="',this.getCssClassName("footer"),'">','<li class="',this.cssClasses.linkToMap,'">','<a href="/'+new Date().getTime()+'">',this.i18n("link-to-map"),"</a>","</li>",'<li class="',this.cssClasses.mail,'">','<a href="/'+new Date().getTime()+'">',this.i18n("mail"),"</a>","</li>","</ul>"].join("")]},isUndo:function(a){return(a===this.elements.undo)},isClear:function(a){return(a===this.elements.clear)},CLASS_NAME:"Eniro.DrawTypeTabView"});Eniro.DrawPointTabView=OpenLayers.Class(Eniro.DrawTypeTabView,{TYPE:"point",initialize:function(){Eniro.TabView.prototype.initialize.apply(this,arguments)},getContentHTML:function(){return[['<div class="',this.getCssClassName("inner"),'">',"<ol>","<li>",this.i18n("step-1"),"</li>","<li>",this.i18n("step-2"),"</li>","<li>",this.i18n("step-3"),"</li>","</ol>","</div>"].join("")]},CLASS_NAME:"Eniro.DrawPointTabView"});Eniro.DrawPolygonTabView=OpenLayers.Class(Eniro.DrawTypeTabView,{TYPE:"polygon",defaultOutputValue:"0 m<sup>2</sup>",initialize:function(){Eniro.TabView.prototype.initialize.apply(this,arguments)},getContentHTML:function(){this.cssClasses.outputValue=this.getCssClassName("output-value");this.cssClasses.undo=this.getCssClassName("undo");this.cssClasses.clear=this.getCssClassName("clear");return[['<div class="',this.getCssClassName("type inner"),'">',"<ol>","<li>",this.i18n("step-1"),"<ul>","<li>",this.i18n("step-1-1"),"</li>","<li>",this.i18n("step-1-2"),"</li>","<li>",this.i18n("step-1-3"),"</li>","</ul>","</li>","<li>",this.i18n("step-2"),"</li>","<li>",this.i18n("step-3"),"</li>","</ol>",'<div class="',this.getCssClassName("output-wrapper"),'">','<span class="',this.getCssClassName("output"),'">',this.i18n("distance")+": ",'<strong class="',this.cssClasses.outputValue,'">',this.defaultOutputValue,"</strong>","</span>",'<div class="',this.getCssClassName("links"),'">','<a href="/'+new Date().getTime()+'" class="',this.cssClasses.undo,'">',this.i18n("undo"),"</a>",'<a href="/'+new Date().getTime()+'" class="',this.cssClasses.clear,'">',this.i18n("clear"),"</a>","</div>","</div>","</div>"].join("")]},CLASS_NAME:"Eniro.DrawPolygonTabView"});Eniro.DrawLineTabView=OpenLayers.Class(Eniro.DrawTypeTabView,{TYPE:"line",defaultOutputValue:"0 m",defaultOutputValueBicycle:"0 min",defaultOutputValueWalking:"0 min",defaultOutputValueSailboat:"0 min",defaultOutputValueMotorboat:"0 min",initialize:function(){Eniro.TabView.prototype.initialize.apply(this,arguments);this.register(Eniro.Events.CHANGE_BASE_LAYER,this.onChangeBaseLayer)},onChangeBaseLayer:function(a){if(this.elements&&this.elements.bicycle&&this.elements.walking&&this.elements.sailboat&&this.elements.motorboat){if(Eniro.map.baseLayer.layerId==="nautical"){jQuery(this.elements.bicycle).hide();jQuery(this.elements.walking).hide();jQuery(this.elements.sailboat).show();jQuery(this.elements.motorboat).show()}else{jQuery(this.elements.sailboat).hide();jQuery(this.elements.motorboat).hide();jQuery(this.elements.bicycle).show();jQuery(this.elements.walking).show()}}},onMeasure:function(a){Eniro.DrawTypeTabView.prototype.onMeasure.apply(this,arguments);var c={walking:0,bicycle:0,sailboat:0,motorboat:0};var b=parseFloat(a.measure.split(" ").join("").split(",").join("."),10);if(a.units==="m"){c.walking=(b/1000)/5;c.bicycle=(b/1000)/17}else{if(a.units==="km"){c.walking=b/5;c.bicycle=b/17}else{if(a.units==="nmi"){c.sailboat=b/5;c.motorboat=b/12}}}c.walking*=60*60;c.bicycle*=60*60;c.sailboat*=60*60;c.motorboat*=60*60;jQuery(this.elements.bicycleValue).html(c.bicycle.toDuration());jQuery(this.elements.walkingValue).html(c.walking.toDuration());jQuery(this.elements.sailboatValue).html(c.sailboat.toDuration());jQuery(this.elements.motorboatValue).html(c.motorboat.toDuration())},reset:function(){Eniro.DrawTypeTabView.prototype.reset.apply(this,arguments);jQuery(this.elements.bicycleValue).html(this.defaultOutputValueBicycle);jQuery(this.elements.walkingValue).html(this.defaultOutputValueWalking);jQuery(this.elements.sailboatValue).html(this.defaultOutputValueSailboat);jQuery(this.elements.motorboatValue).html(this.defaultOutputValueMotorboat);if(Eniro.map.baseLayer.layerId==="nautical"){jQuery(this.elements.bicycle).hide();jQuery(this.elements.walking).hide()}else{jQuery(this.elements.sailboat).hide();jQuery(this.elements.motorboat).hide()}},getContentHTML:function(){this.cssClasses.outputValue=this.getCssClassName("output-value");this.cssClasses.bicycleValue=this.getCssClassName("bicycle-value");this.cssClasses.walkingValue=this.getCssClassName("walking-value");this.cssClasses.sailboatValue=this.getCssClassName("sailboat-value");this.cssClasses.motorboatValue=this.getCssClassName("motorboat-value");this.cssClasses.undo=this.getCssClassName("undo");this.cssClasses.clear=this.getCssClassName("clear");this.cssClasses.bicycle=this.getCssClassName("bicycle");this.cssClasses.walking=this.getCssClassName("walking");this.cssClasses.sailboat=this.getCssClassName("sailboat");this.cssClasses.motorboat=this.getCssClassName("motorboat");return[['<div class="',this.getCssClassName("inner"),'">',"<ol>","<li>",this.i18n("step-1"),"<ul>","<li>",this.i18n("step-1-1"),"</li>","<li>",this.i18n("step-1-2"),"</li>","<li>",this.i18n("step-1-3"),"</li>","</ul>","</li>","<li>",this.i18n("step-2"),"</li>","<li>",this.i18n("step-3"),"</li>","</ol>",'<div class="',this.getCssClassName("output-wrapper"),'">','<span class="',this.getCssClassName("output"),'">',this.i18n("distance"),": ",'<strong class="',this.cssClasses.outputValue,'">',this.defaultOutputValue,"</strong>","</span>",'<span class="',this.cssClasses.bicycle,'">',this.i18n("travel-by-bicycle"),": ",'<span class="',this.cssClasses.bicycleValue,'">',this.defaultOutputValueBicycle,"</span>","</span>",'<span class="',this.cssClasses.walking,'">',this.i18n("travel-by-foot"),": ",'<span class="',this.cssClasses.walkingValue,'">',this.defaultOutputValueWalking,"</span>","</span>",'<span class="',this.cssClasses.sailboat,'">',this.i18n("travel-by-sailboat"),": ",'<span class="',this.cssClasses.sailboatValue,'">',this.defaultOutputValueSailboat,"</span>","</span>",'<span class="',this.cssClasses.motorboat,'">',this.i18n("travel-by-motorboat"),": ",'<span class="',this.cssClasses.motorboatValue,'">',this.defaultOutputValueMotorboat,"</span>","</span>",'<div class="',this.getCssClassName("links"),'">','<a href="/'+new Date().getTime()+'" class="',this.cssClasses.undo,'">',this.i18n("undo"),"</a>",'<a href="/'+new Date().getTime()+'" class="',this.cssClasses.clear,'">',this.i18n("clear"),"</a>","</div>","</div>","</div>"].join("")]},CLASS_NAME:"Eniro.DrawLineTabView"});Eniro.DrawTooltip=OpenLayers.Class(Eniro.Tooltip,{initialize:function(){Eniro.Tooltip.prototype.initialize.apply(this,arguments);this.register(Eniro.Events.CHANGE_BASE_LAYER,this.onChangeBaseLayer)},onChangeBaseLayer:function(a){if(jQuery(this.div).find("#nagle")&&Eniro.map.baseLayer.layerId!=="nautical"){jQuery(this.div).find("#nagle").closest("tr").remove()}else{if(jQuery(this.div).find("#nagle").length===0&&Eniro.map.baseLayer.layerId==="nautical"){var b=jQuery("<tr></tr>").append("<td>"+this.i18n("nagle")+':</td><td><em id="nagle"</em></td>');jQuery(this.div).find("#total").closest("tr").after(b)}}},setFields:function(a){if(a.segmentLength&&a.totalLength){if(!(this.segmentSpan&&this.totalSpan)){jQuery(this.div).html(this.getLineMeasureHTML().toDomElement());this.segmentSpan=jQuery(this.div).find("#segment")[0];this.totalSpan=jQuery(this.div).find("#total")[0];this.totalAreaSpan=undefined}jQuery(this.segmentSpan).html(a.segmentLength);jQuery(this.totalSpan).html(a.totalLength);if(a.nagle){this.nagleSpan=jQuery(this.div).find("#nagle")[0];jQuery(this.nagleSpan).html(a.nagle)}}else{if(a.totalArea){if(!this.totalAreaSpan){jQuery(this.div).html(this.getPolygonMeasureHTML().toDomElement());this.totalAreaSpan=jQuery(this.div).find("#area")[0];this.segmentSpan=undefined;this.totalSpan=undefined;this.nagleSpan=undefined}jQuery(this.totalAreaSpan).html(a.totalArea)}}},getLineMeasureHTML:function(){var a=["<div>","<table>","<tr>","<td>",this.i18n("segment-length"),": ","</td>",'<td><em id="segment">',"</em></td>","</tr>"];a=a.concat(["<tr>","<td>",this.i18n("total-length"),": ","</td>",'<td><em id="total">',"</em></td>","</tr>"]);if(Eniro.map.baseLayer.layerId==="nautical"){a=a.concat(["<tr>","<td>",this.i18n("nagle"),": ","</td>",'<td><em id="nagle">',"</em></td>","</tr>"])}a=a.concat(["</table>"]);a=a.concat(['<div class="close-info">',this.i18n("dblclick-to-close"),"</div>","</div>"]);return a.join("")},getPolygonMeasureHTML:function(){var a=["<div>","<table>","<tr>","<td>",this.i18n("total-area"),": ","</td>",'<td><em id="area">',"</em></td>","</tr>","</table>"];a=a.concat(['<div class="close-info">',this.i18n("dblclick-to-close"),"</div>","</div>"]);return a.join("")},CLASS_NAME:"Eniro.DrawTooltip",SUPER:"Eniro.Tooltip"});Eniro.DrawNagleTooltip=OpenLayers.Class(Eniro.Tooltip,{minOffset:{x:-10,y:0},initialize:function(){Eniro.Tooltip.prototype.initialize.apply(this,arguments)},setNagle:function(a){jQuery(this.div).html(a)},remove:function(){jQuery(this.div).remove()},CLASS_NAME:"Eniro.DrawNagleTooltip",SUPER:"Eniro.Tooltip"});Eniro.Handler.DrawHandlerPath=OpenLayers.Class(OpenLayers.Handler.Path,{dragged:false,drawn:false,wasFreehanded:false,drawingComplete:false,lastMouseUpDownEvent:"mouseup",mouseEvents:[],initialize:function(){OpenLayers.Handler.Path.prototype.initialize.apply(this,arguments)},callback:function(b,a){if(b&&this.callbacks[b]){return this.callbacks[b].apply(this.control,a)}},clearPath:function(){if(this.persist&&this.drawingComplete){this.destroyHandlerFeatures()}},mousedown:function(a){this.lastMouseUpDownEvent=a.type;this.dragged=false;this.drawing=true;this.wasFreehanded=false;if(!OpenLayers.Event.isRightClick(a)){Eniro.AppEvents.triggerEvent(Eniro.Events.DRAW_DISTANCE_START,{})}if(this.mouseEvents.length>4){this.mouseEvents.shift()}this.mouseEvents.push(a.type);return !this.freehandMode(a)},mousemove:function(a){if(this.drawing&&this.freehandMode(a)&&!this.dragged){this.wasFreehanded=true;if(!this.drawn){this.clearPath();this.createFeature(a.xy);this.drawingComplete=false;this.drawn=true}else{this.addPoint(a.xy)}}if(!this.drawing&&this.freehandMode(a)){return true}if(this.drawing&&!this.freehandMode(a)){if(this.wasFreehanded){this.modifyFeature(a.xy);return false}else{this.dragged=true;return true}}if(!this.drawing&&!this.freehandMode(a)&&this.drawn){this.modifyFeature(a.xy);return true}return true},mouseup:function(a){if(this.wasFreehanded){return true}this.drawing=false;if(this.dragged||!this.callback("mouseup",[a])||OpenLayers.Event.isRightClick(a)){this.dragged=false;this.drawing=false;return true}if(!this.drawn){this.clearPath();this.drawingComplete=false;this.createFeature(a.xy);this.drawn=true}this.addPoint(a.xy);this.lastUp=a.xy;this.drawing=false;if(a.type===this.lastMouseUpDownEvent){this.dblclick(a)}this.lastMouseUpDownEvent=a.type;if(this.mouseEvents.length>4){this.mouseEvents.shift()}this.mouseEvents.push(a.type);if(this.mouseEvents[0]===this.mouseEvents[2]&&this.mouseEvents[1]===this.mouseEvents[3]){this.dblclick(a)}setTimeout(OpenLayers.Function.bind(this.clearMouseEvents,this),200);return true},click:function(){return false},dblclick:function(a){if(this.drawn){OpenLayers.Handler.Path.prototype.dblclick.apply(this,arguments)}this.drawn=false;this.dragged=false;this.drawing=false;Eniro.AppEvents.triggerEvent(Eniro.Events.DRAW_DISTANCE_END,{});this.drawingComplete=true;return false},cancel:function(a){this.drawn=false;this.dragged=false;if(a){this.destroyHandlerFeatures()}else{this.finalize(true)}},drawFeaturePatch:function(a,b){if(b===null){b=a.style}if(a.geometry){var c=a.geometry.getBounds();if(c){var d=this.drawGeometry(a.geometry,b,a.id);if(b.display!="none"&&b.label&&d!==false){this.drawText(a.id,b,a.geometry.getCentroid())}else{this.removeText(a.id)}return d}}},activate:function(){if(!OpenLayers.Handler.prototype.activate.apply(this,arguments)){return false}var a=OpenLayers.Util.extend({displayInLayerSwitcher:false,calculateInRange:function(){return true}},this.layerOptions);if(!this.layer){this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,a);this.map.addLayer(this.layer)}this.layer.renderer.drawFeature=OpenLayers.Function.bind(this.drawFeaturePatch,this.layer.renderer);return true},deactivate:function(b,a){OpenLayers.Handler.prototype.deactivate.apply(this,arguments);if(this.drawing){this.cancel()}if(a){this.destroyFeature();if(this.layer.map!==null){this.layer.destroy(false)}this.layer=null}if(b){this.callback("deactivate",["line"])}return true},drawPoints:function(d){var a=d[0];this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(a.x,a.y));this.line=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString([this.point.geometry]));for(var c=1,b=d.length;c<b;c++){this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(d[c].x,d[c].y));this.line.geometry.addComponent(this.point.geometry,this.line.geometry.components.length)}this.drawFeature();this.drawn=false;this.drawing=false;this.drawingComplete=true;this.removePoint();this.finalize()},destroyHandlerFeatures:function(){if(!this.layer){return}var a=[];if(this.line){a.push(this.line)}if(this.point){a.push(this.point)}this.layer.destroyFeatures(a)},clearMouseEvents:function(){this.mouseEvents=[]},CLASS_NAME:"Eniro.Handler.DrawHandlerPath"});Eniro.Handler.DrawHandlerPoint=OpenLayers.Class(OpenLayers.Handler.Point,{dragged:false,ispoint:true,initialize:function(){OpenLayers.Handler.Point.prototype.initialize.apply(this,arguments)},callback:function(b,a){if(b&&this.callbacks[b]){return this.callbacks[b].apply(this.control,a)}},deactivate:function(a){OpenLayers.Handler.Point.prototype.deactivate.apply(this,[]);if(a){this.callback("deactivate",["point"])}},mousedown:function(a){this.drawing=true;this.dragged=false;if(!OpenLayers.Event.isRightClick(a)){Eniro.AppEvents.triggerEvent(Eniro.Events.DRAW_DISTANCE_START,{})}return true},mousemove:function(a){this.dragged=this.drawing;return true},mouseup:function(a){Eniro.AppEvents.triggerEvent(Eniro.Events.DRAW_DISTANCE_END,{});if(this.dragged||!this.callback("mouseup",[a])||OpenLayers.Event.isRightClick(a)){this.dragged=false;this.drawing=false;return true}this.dragged=false;this.createFeature(a.xy);this.finalize();return true},CLASS_NAME:"Eniro.Handler.DrawHandlerPoint"});Eniro.Handler.DrawHandlerPolygon=OpenLayers.Class(OpenLayers.Handler.Polygon,{dragged:false,drawn:false,wasFreehanded:false,drawingComplete:false,lastMouseUpDownEvent:"mouseup",mouseEvents:[],initialize:function(){OpenLayers.Handler.Polygon.prototype.initialize.apply(this,arguments)},callback:function(b,a){if(b&&this.callbacks[b]){return this.callbacks[b].apply(this.control,a)}},mousedown:function(a){this.lastMouseUpDownEvent=a.type;this.dragged=false;this.drawing=true;this.wasFreehanded=false;if(!OpenLayers.Event.isRightClick(a)){Eniro.AppEvents.triggerEvent(Eniro.Events.DRAW_DISTANCE_START,{})}if(this.mouseEvents.length>4){this.mouseEvents.shift()}this.mouseEvents.push(a.type);return !this.freehandMode(a)},mousemove:function(a){if(this.drawing&&this.freehandMode(a)&&!this.dragged){this.wasFreehanded=true;if(!this.drawn){this.clearPath();this.createFeature(a.xy);this.drawingComplete=false;this.drawn=true}else{this.addPoint(a.xy)}}if(!this.drawing&&this.freehandMode(a)){return true}if(this.drawing&&!this.freehandMode(a)){if(this.wasFreehanded){this.modifyFeature(a.xy);return false}else{this.dragged=true;return true}}if(!this.drawing&&!this.freehandMode(a)&&this.drawn){this.modifyFeature(a.xy);return true}return true},mouseup:function(a){if(this.wasFreehanded){return true}this.drawing=false;if(this.dragged||!this.callback("mouseup",[a])||OpenLayers.Event.isRightClick(a)){this.dragged=false;this.drawing=false;return true}if(!this.drawn){this.clearPath();this.drawingComplete=false;this.createFeature(a.xy);this.drawn=true}this.addPoint(a.xy);this.lastUp=a.xy;this.drawing=false;if(a.type===this.lastMouseUpDownEvent){this.dblclick(a)}this.lastMouseUpDownEvent=a.type;this.mouseEvents.push(a.type);if(this.mouseEvents[0]===this.mouseEvents[2]&&this.mouseEvents[1]===this.mouseEvents[3]){this.dblclick(a)}setTimeout(OpenLayers.Function.bind(this.clearMouseEvents,this),200);return true},cancel:function(a){this.drawn=false;this.dragged=false;if(a){this.destroyHandlerFeatures()}else{this.finalize(true)}},dblclick:function(a){if(this.drawn){OpenLayers.Handler.Polygon.prototype.dblclick.apply(this,arguments)}Eniro.AppEvents.triggerEvent(Eniro.Events.DRAW_DISTANCE_END,{});this.drawn=false;this.dragged=false;this.drawing=false;this.drawingComplete=true;return false},activate:function(){if(!OpenLayers.Handler.prototype.activate.apply(this,arguments)){return false}var a=OpenLayers.Util.extend({displayInLayerSwitcher:false,calculateInRange:function(){return true}},this.layerOptions);if(!this.layer){this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,a);this.map.addLayer(this.layer)}return true},deactivate:function(b,a){OpenLayers.Handler.prototype.deactivate.apply(this,arguments);if(this.drawing){this.cancel()}if(a){this.destroyFeature();if(this.layer.map!==null){this.layer.destroy(false)}this.layer=null}if(b){this.callback("deactivate",["polygon"])}this.drawn=false;return true},drawPoints:function(d){var a=d[0];this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(a.x,a.y));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]));for(var c=1,b=d.length;c<b;c++){this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(d[c].x,d[c].y));this.line.geometry.addComponent(this.point.geometry,this.line.geometry.components.length)}this.drawFeature();this.drawn=false;this.drawing=false;this.drawingComplete=true;this.removePoint();this.finalize()},clearPath:function(){if(this.persist&&this.drawingComplete){this.destroyHandlerFeatures()}},destroyHandlerFeatures:function(){if(!this.layer){return}var a=[];if(this.polygon){a.push(this.polygon)}if(this.point){a.push(this.point)}this.layer.destroyFeatures(a)},clearMouseEvents:function(){this.mouseEvents=[]},CLASS_NAME:"Eniro.Handler.DrawHandlerPolygon"});Eniro.Tool=OpenLayers.Class(Eniro.Control,{parentId:"",disabled:false,allowedModes:undefined,initialize:function(a){if(a){this.id=a.id;this.allowedModes=a.allowedModes}Eniro.Control.prototype.initialize.apply(this,arguments);this.register(Eniro.Events.ACTIVATE_TOOL,this.onActivateTool);this.register(Eniro.Events.MODE_SWITCH,this.onModeSwitch);this.activated=[]},draw:function(){return null},doOnClick:function(a){return false},onModeSwitch:function(a){this.activeMode=a.mode;if(this.allowedModes){if(!this.isToolAllowed()||!this.activated[this.activeMode]){this.disable()}else{if(this.disabled){this.enable()}}}},enable:function(){if(this.disabled&&this.isToolAllowed()){this.triggerEvent(Eniro.Events.ENABLE_TOOL,this.id);this.disabled=false;this.activated[this.activeMode]=true}},disable:function(){if(!this.disabled){this.triggerEvent(Eniro.Events.DISABLE_TOOL,this.id);this.disabled=true;this.activated[this.activeMode]=false}},isToolAllowed:function(){return(!this.allowedModes||(this.allowedModes.indexOf&&this.allowedModes.indexOf(this.activeMode)>-1))},CLASS_NAME:"Eniro.Tool"});Eniro.BackTool=OpenLayers.Class(Eniro.Tool,{initialize:function(){Eniro.Tool.prototype.initialize.apply(this,arguments)},destroy:function(){Eniro.Tool.prototype.destroy.apply(this,arguments)},doOnClick:function(a){this.triggerEvent(Eniro.Events.HISTORY_BACK)},CLASS_NAME:"Eniro.BackTool"});Eniro.ResetTool=OpenLayers.Class(Eniro.Tool,{initialize:function(){Eniro.Tool.prototype.initialize.apply(this,arguments)},destroy:function(){Eniro.Tool.prototype.destroy.apply(this,arguments)},doOnClick:function(a){this.triggerEvent(Eniro.Events.HISTORY_RESET)},CLASS_NAME:"Eniro.ResetTool"});Eniro.ExpandableTool=OpenLayers.Class(Eniro.Tool,{expandable:true,visible:false,initialize:function(){Eniro.Tool.prototype.initialize.apply(this,arguments);this.register(Eniro.Events.TOOL_TOGGLED,this.onToolToggled)},destroy:function(){this.unregister(Eniro.Events.TOOL_TOGGLED,this.onToolToggled);Eniro.Tool.prototype.destroy.apply(this,arguments)},drawControl:function(){return"tool has to be implemented".toDomElement()},doOnClick:function(a){return true},draw:function(){this.div=Eniro.Util.createDiv(null,"expandable-region");var a=Eniro.Util.createDiv(null,"expandable-container");this.div.appendChild(a);var c=this.drawControl();if(c&&Eniro.Util.isArray(c)){for(var b=0;b<c.length;b++){a.appendChild(c[b])}}else{if(c){a.appendChild(c)}}return this.div},onToolToggled:function(a){var b=a.tool;var c=a.parentId;if(!this.div||this.parentId!==c){return}if(b!==this&&typeof b.expandable!=="undefined"&&b.expandable){this.visible=false}else{if(b===this){this.visible=!this.visible}}},toggle:function(){jQuery(this.div).toggle()},CLASS_NAME:"Eniro.ExpandableTool"});Eniro.LinkTool=OpenLayers.Class(Eniro.ExpandableTool,{initialize:function(){Eniro.ExpandableTool.prototype.initialize.apply(this,arguments);this.dialog=new Eniro.LinkDialog()},destroy:function(){if(this.dialog){this.dialog.destroy()}Eniro.ExpandableTool.prototype.destroy.apply(this,arguments)},doOnClick:function(){this.dialog.url=null;this.map.stateController.save(OpenLayers.Function.bind(this.dialog.setContents,this.dialog),OpenLayers.Function.bind(this.dialog.setError,this.dialog));return true},drawControl:function(){return this.dialog.draw()},CLASS_NAME:"Eniro.LinkTool"});Eniro.MapStateTool=OpenLayers.Class(Eniro.ExpandableTool,{coordinates:[],currentSource:null,projection:new OpenLayers.Projection("EPSG:900913"),backendProjection:new OpenLayers.Projection("EPSG:4326"),initialize:function(){Eniro.ExpandableTool.prototype.initialize.apply(this,arguments);this.dialog=new Eniro.MapStateDialog(OpenLayers.Function.bind(this.getCoordinates,this));this.register(Eniro.Events.SEARCH_RESULT_AVAILABLE,this.onSearchResultAvailable);this.register(Eniro.Events.SEARCH_CLEAR,this.onSearchResultClear);this.register(Eniro.Events.ROUTE_SEARCH_DO,this.onRouteSearchDo)},destroy:function(){Eniro.ExpandableTool.prototype.destroy.apply(this,arguments);this.unregister(Eniro.Events.SEARCH_RESULT_AVAILABLE,this.onSearchResultAvailable);this.unregister(Eniro.Events.SEARCH_CLEAR,this.onSearchResultClear);this.unregister(Eniro.Events.ROUTE_GEOMETRY_AVAILABLE,this.onRouteGeometryAvailable);this.dialog.destroy()},onSearchResultAvailable:function(d){if(d.firstSearch&&d.features){this.coordinates=[];for(var b=0,f=d.features.length;b<f;b++){var a=d.features[b];if(a.geometry){var c=a.geometry.getBounds().getCenterLonLat().transform(this.projection,this.backendProjection);this.coordinates.push([c.lon,c.lat].join(","))}}}},onSearchResultClear:function(){if(this.currentSource==="search"){this.coordinates=[]}},onRouteSearchDo:function(a){if(a.waypoints){this.coordinates=a.waypoints}else{this.coordinates=[]}},doOnClick:function(){this.dialog.setCoordinates(this.coordinates.join(";"));return true},drawControl:function(){return this.dialog.draw()},CLASS_NAME:"Eniro.MapStateTool"});Eniro.ProgressWhirl=OpenLayers.Class(Eniro.Control,{initialize:function(){Eniro.Control.prototype.initialize.apply(this,arguments);this.register(Eniro.Events.PROGRESS_SHOW,this.onRequestBeforeSend);this.register(Eniro.Events.PROGRESS_HIDE,this.onRequestComplete);this.register(Eniro.Events.REQUEST_BEFORE_SEND,this.onRequestBeforeSend);this.register(Eniro.Events.REQUEST_COMPLETE,this.onRequestComplete)},destroy:function(){Eniro.Control.prototype.destroy.apply(this,arguments);this.unregister(Eniro.Events.REQUEST_BEFORE_SEND,this.onRequestBeforeSend);this.unregister(Eniro.Events.REQUEST_COMPLETE,this.onRequestComplete)},onRequestBeforeSend:function(){jQuery(this.div).show()},onRequestComplete:function(){jQuery(this.div).hide()},draw:function(){this.div=this.createDiv();return this.div},CLASS_NAME:"Eniro.ProgressWhirl"});Eniro.SendMailTool=OpenLayers.Class(Eniro.ExpandableTool,{data:{},initialize:function(){Eniro.ExpandableTool.prototype.initialize.apply(this,arguments);this.dialog=new Eniro.SendMailDialog(OpenLayers.Function.bind(this.onSubmit,this))},drawControl:function(){return this.dialog.draw()},onSubmit:function(a){this.data=a;this.map.stateController.save(OpenLayers.Function.bind(this.doPost,this),OpenLayers.Function.bind(this.displayError,this))},doPost:function(c){var a=[window.location.protocol,"//",window.location.host,"/m/"].join("");var b=OpenLayers.i18n("send-mail-tool.subject",{profileName:Eniro.Profile.name});jQuery.ajax({type:"POST",url:"/appNodeProxy/send/mailmapstate",data:{mailto:this.data.recipientMail,mailfrom:this.data.senderMail,sender:this.data.senderName,message:this.data.recipientMessage+"\n\n",subject:b,mapstate:c,url:a},success:OpenLayers.Function.bind(this.closeDialog,this),error:OpenLayers.Function.bind(this.displayError,this)})},closeDialog:function(a){this.triggerEvent(Eniro.Events.ACTIVATE_TOOL,"");this.visible=false;this.dialog.clearForm()},displayError:function(a){var b=a.responseText;if(b.indexOf("Invalid recipient email")>-1){this.dialog.displayError("recipientMail")}else{if(b.indexOf("Invalid sender email")>-1){this.dialog.displayError("senderMail")}else{this.dialog.displayError("unspecified")}}},CLASS_NAME:"Eniro.SendMailTool"});Eniro.SendSmsTool=OpenLayers.Class(Eniro.ExpandableTool,{smsSender:undefined,closeDelay:2500,initialize:function(a){a.allowedModes=["route","search"];Eniro.ExpandableTool.prototype.initialize.apply(this,arguments);this.dialog=new Eniro.SendSmsDialog(OpenLayers.Function.bind(this.onSubmit,this));this.register(Eniro.Events.PARTNER_SET,this.onSetPartner);this.register(Eniro.Events.SEARCH_DO,this.onSearchDo);this.register(Eniro.Events.SEARCH_CLEAR,this.disable);this.register(Eniro.Events.ROUTE_DESCRIPTION_AVAILABLE,this.enable);this.register(Eniro.Events.ROUTE_CLEAR,this.disable);this.smsSender=Eniro.Profile.name;this.disabled=true},drawControl:function(){return this.dialog.draw()},onSubmit:function(a){var b=this.generateQuery();b.number=a;jQuery.ajax({type:"GET",url:"/appNodeProxy/send/send_sms",data:b,success:OpenLayers.Function.bind(this.onSendSuccess,this),error:OpenLayers.Function.bind(this.displayError,this),dataType:"html"})},onSetPartner:function(a){this.smsSender=a},onSearchDo:function(a){if(!a.mapTypesUpdate){this.enable()}},closeDialog:function(a){this.triggerEvent(Eniro.Events.ACTIVATE_TOOL,"");this.visible=false;this.dialog.clearForm()},displayError:function(a){this.dialog.displaySpan("error",this.i18n("error"))},onSendSuccess:function(b){var a;if(b==="OK"){this.dialog.displaySpan("sent",this.i18n("message-sent"));setTimeout(OpenLayers.Function.bind(this.closeDialog,this),this.closeDelay)}else{if(b==="LIMIT_REACHED"){this.dialog.displaySpan("error",this.i18n("limit-reached"))}else{this.displayError()}}},generateQuery:function(){var g={};var a=this.map.stateController.saveState();var k={profile:Eniro.Profile.id};url=[];if(a.route&&a.route.form&&a.map.mode==="route"){var h=a.route.form.waypoints;var q=[];if(h&&h.length&&h[0].geometry&&h[h.length-1].geometry){url.push("what=mobroute&map=true");url.push(["&coord1=",h[0].geometry.replace(",",";"),"&from_addr=",h[0].value].join(""));q.push(h[0].value);url.push(["&coord",h.length,"=",h[h.length-1].geometry.replace(",",";"),"&to_addr=",h[h.length-1].value].join(""));q.push(h[h.length-1].value);for(var d=1,c=h.length-1;d<c;d++){var l=h[d];url.push(["&coord",d,"=",l.geometry.replace(",",";"),"&via",d,"=",l.value].join(""));q.push(l.value)}g.route=q}}else{if(a.searchLayer&&a.map&&a.map.mode==="search"){var b=this.map.searchLayer.features;var r=this.getSearchQuery(g);if(r===""){var f=a.searchLayer.search;var p=b.length?b[0].attributes.source:f.ap;var o;if(p.match(/^geo_/)){o="mobaddrlist"}else{if(p.match(/^yp_/)){o="mobcs"}else{if(p.match(/^wp_/)){o="mobwp"}else{o="moball"}}}if(f.q||f.where){url.push(["what=",o,"&search_word=",f.q,"&geo_area=",f.where,"&map=true"].join(""));g.search=f}}else{url.push(r)}}}k.query="query?"+url.join("");k.message=this.generateMessage(g);k.replace="${url}";return k},getSearchQuery:function(d){var f=this.map.searchLayer.features;var b=[];if(f.length>0){var k=f[0].attributes.source?f[0].attributes.source.replace(/_\w+$/,""):"yp";if(f.length===1&&(f[0].CLASS_NAME==="Eniro.Feature.WFSMarker"||f[0].CLASS_NAME==="Eniro.Feature.StaticLocationMarker")){var c=f[0];var g;var a;if(k==="geo"){a=Eniro.Util.FeatureUtils.getAddressAsString(c);b.push(["what=mobaddr","&xcoord=",c.attributes.lonlat.lon,"&ycoord=",c.attributes.lonlat.lat,"&paddr2=",Eniro.Util.FeatureUtils.getAddressAsString(c)].join(""))}else{var h=c.getContentAsObject();g=h.title;a=c.formatAddressAsString(h.address);if(k==="wp"){b.push(["what=mobwpinfo","&search_word=",g,"&geo_area=",a].join(""))}else{if(k==="yp"){b.push(["what=mobip","&search_word=",g,"&geo_area=",a,"&advert_code=",c.fid].join(""))}}}b.push("&map=true");d.search={q:g,where:a}}}return b.join("")},generateMessage:function(a){var b=[];if(a.route){b.push(this.i18n("route-header"))}if(a.search){b.push(this.i18n("search-header"))}b.push("\n${url}");b.push(this.smsSender&&this.smsSender.match(/Eniro/)?this.i18n("footer"):this.i18n("footer-"+this.smsSender));return b.join("\n")},CLASS_NAME:"Eniro.SendSmsTool"});Eniro.ShareTool=OpenLayers.Class(Eniro.ExpandableTool,{initialize:function(){Eniro.ExpandableTool.prototype.initialize.apply(this,arguments);this.dialog=new Eniro.ShareDialog(OpenLayers.Function.bind(this.onLinkClicked,this))},drawControl:function(){return this.dialog.draw()},doOnClick:function(){this.map.stateController.save(OpenLayers.Function.bind(this.dialog.setUrl,this.dialog));return true},CLASS_NAME:"Eniro.ShareTool"});Eniro.PrintTool=OpenLayers.Class(Eniro.Tool,{searchResultProvider:null,searchresult:null,routeresult:null,bbox:null,form:null,initialize:function(){Eniro.Tool.prototype.initialize.apply(this,arguments);this.register(Eniro.Events.OPEN_PRINT_PAGE,this.onOpenPrintPage);this.register(Eniro.Events.SEARCH_RESULT_AVAILABLE,this.onSearchResultAvailable);this.register(Eniro.Events.SEARCH_CLEAR,this.onSearchClear);this.register(Eniro.Events.ROUTE_DESCRIPTION_AVAILABLE,this.onRouteDescriptionAvailable)},destroy:function(){this.unregister(Eniro.Events.OPEN_PRINT_PAGE,this.onOpenPrintPage);this.unregister(Eniro.Events.SEARCH_RESULT_AVAILABLE,this.onSearchResultAvailable);this.unregister(Eniro.Events.SEARCH_CLEAR,this.onSearchClear);this.unregister(Eniro.Events.ROUTE_DESCRIPTION_AVAILABLE,this.onRouteDescriptionAvailable);Eniro.Tool.prototype.destroy.apply(this,arguments)},onOpenPrintPage:function(b){if(this.parent&&this.parent.activateControl){var a=jQuery("li#"+this.id)[0];this.parent.activateControl(this.id,a)}},doOnClick:function(a){var c=new OpenLayers.Format.JSON();Eniro.AppEvents.triggerEvent(Eniro.Events.STATISTICS_LOG,{scope:"print",event:this.map.getCurrentMode()});window.open("","printmap","width=850,height=1000,scrollbars=yes,resizable=yes, menubar=yes");var b=this.saveState();this.setValue("printstate",JSON.stringify(b));jQuery(this.form).submit()},saveState:function(){var h=this.map.stateController.saveState();var c={};c.mode=this.map.containerDiv.currentMode;if(Eniro.map.getLayerById(Eniro.Map.LAYER_HYBRID).getVisibility()){c.baseLayer=Eniro.Map.LAYER_HYBRID}else{c.baseLayer=h.map.baseLayerId}c.draw={};var k=new OpenLayers.Projection("EPSG:900913");var o=new OpenLayers.Projection("EPSG:4326");if(h.draw){if(h.draw.pointsState){c.draw.pointsState=[];for(i=0;i<h.draw.pointsState.length;i++){var d=h.draw.pointsState[i];c.draw.pointsState[i]={};c.draw.pointsState[i].marker=d.marker;var s=new OpenLayers.LonLat(d.longlat.lon,d.longlat.lat).transform(k,o);c.draw.pointsState[i].lon=s.lon;c.draw.pointsState[i].lat=s.lat}}if(h.draw.lineState){c.draw.lineState=[];for(i=0;i<h.draw.lineState.length;i++){var g=h.draw.lineState[i];c.draw.lineState[i]={};s=new OpenLayers.LonLat(g.longlat.lon,g.longlat.lat).transform(k,o);c.draw.lineState[i].lon=s.lon;c.draw.lineState[i].lat=s.lat}}if(h.draw.polygonState){c.draw.polygonState=[];for(i=0;i<h.draw.polygonState.length;i++){var b=h.draw.polygonState[i];c.draw.polygonState[i]={};s=new OpenLayers.LonLat(b.longlat.lon,b.longlat.lat).transform(k,o);c.draw.polygonState[i].lon=s.lon;c.draw.polygonState[i].lat=s.lat}}}var a=null;var f=null;var r=null;var q=null;if(c.mode==="streetview"&&h.streetView){c.path=h.streetView.path;c.heading=h.streetView.heading;c.pitch=h.streetView.pitch}else{if(c.mode==="oblique"&&h.oblique&&h.oblique.printObj){c.center=new OpenLayers.LonLat(h.oblique.printObj.center.lon,h.oblique.printObj.center.lat).transform(k,o);a=h.oblique.printObj._bbox.bottom;f=h.oblique.printObj._bbox.left;r=h.oblique.printObj._bbox.right;q=h.oblique.printObj._bbox.top;c.bbox=new OpenLayers.Bounds(f,a,r,q);c.zoom=JSON.parse(JSON.stringify(h.oblique.printObj.zoom))}else{c.center=new OpenLayers.LonLat(this.map.getCenter().lon,this.map.getCenter().lat).transform(k,o);a=this.map.getAdjustedExtent().bottom;f=this.map.getAdjustedExtent().left;r=this.map.getAdjustedExtent().right;q=this.map.getAdjustedExtent().top;c.bbox=new OpenLayers.Bounds(f,a,r,q).transform(k,o);c.zoom=JSON.parse(JSON.stringify(this.map.getZoom()))}}c.res=Math.round(this.map.getResolution());if(c.mode==="route"&&h.route.form&&h.route.form.options){c.route={};c.route.form=JSON.parse(JSON.stringify(h.route.form));c.route.result=JSON.parse(JSON.stringify(this.routeresult))}if(this.searchresult){c.searchResultProvider=this.searchResultProvider;c.searchResult=this.searchresult;c.icon=Eniro.Profile.providers[this.searchResultProvider].icon}return c},onSearchResultAvailable:function(a){for(var c in a.json.search){var b=a.json.search[c];if(b.geoJSONResult){this.searchresult=b;this.searchResultProvider=c;break}}},onSearchClear:function(){delete this.searchresult;delete this.searchResultProvider},onRouteDescriptionAvailable:function(a){this.routeresult=a.model},draw:function(){this.div=this.createDiv();this.form=document.createElement("form");this.form.setAttribute("id","print_form");this.form.setAttribute("action","/print?"+[(Eniro.debug?"debug=1":"")+(Eniro.Request.Parameters.eventLogger?"eventLogger=1":"")].join("&"));this.form.setAttribute("method","post");this.form.setAttribute("target","printmap");if(Eniro.debug){this.form.appendChild(this.createInput("debug","true"))}var a=this.saveState();this.form.appendChild(this.createInput("printstate"));this.form.appendChild(this.createInput("profile",Eniro.Profile.id));jQuery(this.div).html(this.form);jQuery(this.div).hide();return this.div},setValue:function(a,b){jQuery(this.div).find("#eniro_printtool_"+a).val(b)},createInput:function(b,d,c){if(!c){c="hidden"}var a=document.createElement("input");a.setAttribute("id","eniro_printtool_"+b);a.setAttribute("name",b);if(d){a.setAttribute("value",d)}a.setAttribute("type",c);return a},CLASS_NAME:"Eniro.PrintTool"});Eniro.ToolbarView=OpenLayers.Class(Eniro.Control,{controls:[],initialize:function(){this.controls=[];Eniro.Control.prototype.initialize.apply(this,arguments);this.register(Eniro.Events.ACTIVATE_TOOL,this.onActivateTool);this.register(Eniro.Events.DISABLE_TOOL,this.onDisableTool);this.register(Eniro.Events.ENABLE_TOOL,this.onEnableTool);this.register(Eniro.Events.MODE_SWITCH,this.onModeSwitch)},destroy:function(){if(this.controls){for(var a=0,b=this.controls.length;a<b;++a){if(typeof this.controls[a].destroy==="function"){this.controls[a].destroy()}this.controls[a].button=null;this.controls[a]=null}this.controls=null}Eniro.Control.prototype.destroy.apply(this,arguments)},draw:function(){this.div=['<div class="',this.getCssClassName(),'">','<div class="',this.getCssClassName("inner"),'">','<ul class="',this.getCssClassName("buttons"),'">',this.renderButtons(),"</ul>","</div>","</div>"].join("").toDomElement();return Eniro.Control.prototype.draw.apply(this,arguments)},registerObservers:function(){this.observe(this.div,"click",this.onButtonbarClick)},setMap:function(b){Eniro.Control.prototype.setMap.apply(this,arguments);if(this.map.stateController){this.map.stateController.register("toolbarview-"+this.id,50,this)}if(this.controls&&this.controls.length>0){for(var a=0,c=this.controls.length;a<c;++a){this.controls[a].setMap(b)}}},addControl:function(a){this.controls.push(a);this.setControls(this.controls)},setControls:function(a){for(var b=0,c=a.length;b<c;++b){a[b].parent=this;a[b].position=null}if(a.length===1){a[0].position="first-last"}else{a[0].position="first";a[a.length-1].position="last"}this.controls=a},getButton:function(b){for(var a=0,c=this.controls.length;a<c;++a){if(this.controls[a].id===b.id){return jQuery(this.div).find("ul:eq(0)").children("li").get(a)}}return null},getButtonHTML:function(b){var a=this.getCssClassName("button",null,b);return['<li id="'+b.id+'" class="',a,'">','<a href="">',"<span>",b.label||this.i18n(b.id),"</span>","</a>","</li>"].join("")},renderButtons:function(){var b=[];for(var a=0,c=this.controls.length;a<c;++a){if(!this.controls[a].isButtonVisible||this.controls[a].isButtonVisible()){b=b.concat(this.getButtonHTML(this.controls[a]))}}return b.join("")},onButtonbarClick:function(b){OpenLayers.Event.stop(b);var a=this.getClickedButton(OpenLayers.Event.element(b));if(!a){return}this.activateControl(a.id,a)},onActivateTool:function(c){var b=this.getControlById(c);if(b&&!b.disabled){var a=this.getButton(b);if(a){b.button=a;this.drawControl(b);this.clickAndToggle(c,b)}}else{this.inactivateAllButtons()}},onDisableTool:function(b){var a=this.getControlById(b);if(a&&!a.disabled){if(a.selected&&a.button){this.clickAndToggle(b,a)}a.disabled=true;this.setButtonClassName(a)}},onModeSwitch:function(a){var c=a.mode==="streetview"||a.mode==="oblique";for(var b=0,f=this.controls.length;b<f;++b){var d=this.controls[b];if(d.selected&&d.button){this.clickAndToggle(toolId,d)}d.disabled=c;this.setButtonClassName(d)}},onEnableTool:function(b){var a=this.getControlById(b);if(a&&a.disabled){a.disabled=false;this.setButtonClassName(a)}},clickAndToggle:function(b,a){if(a&&typeof this.doOnClick==="function"&&this.doOnClick(a)){this.toggleButton(b,a)}},getClickedButton:function(a){return jQuery(a).closest("li")[0]},activateControl:function(b,a){var c=this.getControlById(b);if(c&&!c.disabled){c.button=a;this.drawControl(c);if(typeof this.doOnClick==="function"&&this.doOnClick(c)){this.toggleButton(b,c)}}},toggleButton:function(a,b){this.inactivateAllButtons();if(!b.visible){this.activateButton(a)}this.triggerEvent(Eniro.Events.TOOL_TOGGLED,{tool:b,parentId:this.id})},getControlById:function(b){for(var a=0,c=this.controls.length;a<c;++a){if(this.controls[a].id===b){return this.controls[a]}}return null},getControlByIndex:function(a){for(var b=0,c=this.controls.length;b<c;++b){if(b===a){return this.controls[b]}}return null},setButtonClassName:function(b){var a=this.getButton(b);if(a){a.selected=b.selected;jQuery(a).attr("class",this.getCssClassName("button",null,b))}},inactivateAllButtons:function(){for(var a=0,c=this.controls.length;a<c;++a){var b=this.controls[a];b.selected=false;this.setButtonClassName(b)}return true},activateButton:function(b){var a=this.getControlById(b);if(a){a.selected=!a.selected;this.setButtonClassName(a);return true}return null},drawControl:function(b){if(!b.drawn){b.parentId=this.id;var a=b.draw();if(a!==null){b.button.appendChild(a)}b.activate();b.drawn=true;b.setMap(this.map)}},doOnClick:function(a){return a.doOnClick()},saveState:function(){var b={};var d={};for(var a=0,f=this.controls.length;a<f;a++){var c=this.controls[a];if(c.id){d[c.id]={id:c.id,disabled:c.disabled,activated:c.activated}}}b.controls=d;return b},applyState:function(b){if(b&&b.controls){for(var a in b.controls){var d=b.controls[a];if((d.disabled!==undefined)&&d.id){var c=this.getControlById(d.id);if(c){c.disabled=d.disabled;c.selected=false;c.activated=d.activated;this.setButtonClassName(c)}}}}},CLASS_NAME:"Eniro.ToolbarView",SUPER:"Eniro.ButtonbarView"});Eniro.ShowOnMapTool=OpenLayers.Class(Eniro.ExpandableTool,{initialize:function(){Eniro.ExpandableTool.prototype.initialize.apply(this,arguments);this.activeLayers=[];this.menu=new Eniro.TreeViewMenu({parent:this,controls:[]});var a=[];if(Eniro.POI){for(var c=0;c<Eniro.POI.meta.layers.length;c++){var b=Eniro.POI.meta.layers[c];a.push(new Eniro.ShowOnMapMenuItem({id:b.name,value:this.i18n(b.name)}))}}this.menu.controls=a},activate:function(){if(Eniro.ExpandableTool.prototype.activate.apply(this,arguments)){this.menu.activate();return true}return false},getActiveLayers:function(){var b=[];for(var a=0,c=this.menu.controls.length;a<c;++a){if(this.menu.controls[a].selected){b.push(this.menu.controls[a])}}return b},drawControl:function(){var a=[];var b=this.menu.draw();if(b){a.push(b)}return a},CLASS_NAME:"Eniro.ShowOnMapTool"});Eniro.StreetViewController=OpenLayers.Class(Eniro.Control,{initialized:false,allowPan:true,streetviewActive:false,streetview:{linearRing:undefined,lonlat:undefined,heading:undefined,fieldofview:undefined,pan:undefined,drag:undefined},state:{lonlat:undefined,heading:undefined,fieldofview:undefined,pan:undefined,drag:undefined},mediator:undefined,layer:undefined,layername:undefined,map:undefined,features:undefined,drag:undefined,overlay:undefined,move:false,initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.register(Eniro.Events.MODE_SWITCH,this.onModeSwitch);this.register(Eniro.Events.STATE_SAVING_MODE_SWITCH,this.onStateSavingModeSwitch);this.register(Eniro.Events.STREETVIEW_LIST_SELECT,this.onStreetViewListSelect);this.register(Eniro.Events.STREETVIEW_FLASH_MODECHANGED,this.onStreetViewModeChanged);this.layername="streetview-wfs";this.features=[]},destroy:function(){this.unregister(Eniro.Events.MODE_SWITCH,this.onModeSwitch);this.unregister(Eniro.Events.STATE_SAVING_MODE_SWITCH,this.onStateSavingModeSwitch);this.unregister(Eniro.Events.STREETVIEW_LIST_SELECT,this.onStreetViewListSelect);this.unregister(Eniro.Events.STREETVIEW_FLASH_MODECHANGED,this.onStreetViewModeChanged);OpenLayers.Control.prototype.destroy.apply(this,arguments)},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments);a.stateController.register("streetView",20,this)},onResize:function(){var a=jQuery(".eniro-streetviewsidebar");if(a.size()<1){a=jQuery(".eniro-streetview3dsidebar")}var b=jQuery("body").outerWidth()-a.outerWidth();var c=jQuery("body").outerHeight()-jQuery("#mymap").offset().top;jQuery(".eniro-streetviewholder").css({width:b,height:c})},onStateSavingModeSwitch:function(b){if(b&&b.mode==="streetview"){var a=b.previousMode;if(b&&b.previousMode&&this.savedState&&this.savedState.map){b.mode=this.savedState.map.mode||"search"}else{if(!(b&&b.previousMode)){this.savedState=this.map.stateController.saveState()}else{b={mode:"search"}}}b.previousMode=a;this.triggerEvent(Eniro.Events.MODE_SWITCH,b)}},onStreetViewModeChanged:function(a){var b=this.map.getCurrentMode();if(b==="streetview"&&this.overlay&&a){this.overlay.setVisibility(a.mode==="streetview")}},onModeSwitch:function(b){if(b.mode==="streetview"){if(Eniro.Profile.sellable&&Eniro.Profile.sellable.streetViewSponsor){this.triggerEvent(Eniro.Events.SPONSOR_AD_ACTIVATE,Eniro.Profile.sellable.streetViewSponsor)}var a;if(b.hasOwnProperty("_streetViewCityIndex")){a=Eniro.Profile.streetview.cities[b._streetViewCityIndex]}else{a=b._streetViewLonLat}this.streetViewActivate({lonlat:a,data:b._streetviewData,threeDMode:b.threeDMode});this.register(Eniro.Events.STREETVIEW_UPDATE,this.streetViewUpdate);this.streetviewActive=true}else{if(this.streetviewActive){this.streetViewDeactivate();this.allowPan=true;if(this.savedState){this.map.stateController.applyState(this.savedState)}else{this.map.reset();b.mode=this.map.getCurrentMode()}}}},streetViewActivate:function(b){this.mapstate=b;this.triggerEvent(Eniro.Events.CHANGE_BASE_LAYER,"map");this.triggerEvent(Eniro.Events.PROGRESS_SHOW);this.onResize();this.map.zoomTo(14);if(!this.initialized){this.mediator=new Eniro.StreetViewMediator({threeDMode:b.threeDMode});this.layer=new OpenLayers.Layer.Vector(this.layername,{projection:new OpenLayers.Projection("EPSG:4326")});this.map.addLayer(this.layer);this.map.activateLayer(this.layer);this.clickHandler=new OpenLayers.Handler.Click(this,{click:this.onClick});this.drag=new Eniro.StreetViewDragFeature(this.layer,{controller:this});this.map.addControl(this.drag);this.drag.activate();OpenLayers.Event.observe(window,"resize",this.onResize);this.map.events.register("zoomend",this,this.onZoomEnd);this.initialized=true}this.triggerEvent(Eniro.Events.SEARCH_CLEAR);this.triggerEvent(Eniro.Events.ROUTE_CLEAR);var a=this.map.getLayersByName(this.layername);if(a&&a.length>0){this.layer=a[0];this.layer.setVisibility(true)}a=this.map.getLayersBy("layername","streetview");if(a&&a.length>0){this.overlay=a[0];if(!b.threeDMode){this.overlay.setVisibility(true)}}this.drag.activate();this.clickHandler.activate();if(this.mediator&&b.lonlat){this.setLonLat(b.lonlat,b.data,b.threeDMode)}jQuery(this.map.viewPortDiv).css({visibility:"hidden"})},onZoomEnd:function(a){if(this.streetview.lonlat){this.streetview.pan=true;this.streetViewUpdate(this.streetview)}},onClick:function(a){if(!this.move){var b=this.map.getLonLatFromPixel(a.xy);b.transform(this.map.baseLayer.projection,new OpenLayers.Projection("EPSG:4326"));var c=this.degreePerPixel();if(this.mediator.threeDMode){this.mediator.setPosition({lonlat:b,threeDMode:true},false)}else{this.doSearch(b,c,OpenLayers.Function.bind(this.onSearchSuccess,this))}this.move=false}else{this.move=false}},doSearch:function(a,b,c){this.triggerEvent(Eniro.Events.PROGRESS_SHOW);jQuery.jsonp({url:Eniro.AppNode.appUrl("/streetview/search"),data:{north:a.lat,east:a.lon},callbackParameter:"callback",success:c,error:OpenLayers.Function.bind(this.onSearchFailure,this),dataFilter:function(d){return JSON.parse(JSON.stringify(d))}})},streetViewDeactivate:function(){this.map.events.unregister("zoomend",this,this.onZoomEnd);this.unregister(Eniro.Events.STREETVIEW_UPDATE,this.streetViewUpdate);this.layer.removeFeatures(this.features);this.features=[];this.streetviewActive=false;this.layer.setVisibility(false);this.overlay.setVisibility(false);this.drag.deactivate();this.clickHandler.deactivate();jQuery(this.map.viewPortDiv).css({visibility:"visible"});this.triggerEvent(Eniro.Events.PROGRESS_HIDE)},streetViewUpdate:function(h){if(!this.streetviewActive||(!h.drag&&this._isDraggingFeature)){return}this.streetview=h;if(!this.streetview.heading){this.streetview.heading=0}this.layer.removeFeatures(this.features);var b={};if(this.streetview.drag===false){b={externalGraphic:Eniro.Util.getImagesLocation()+"markers/streetview/fov.png",graphicWidth:82,graphicHeight:74,graphicXOffset:-40,graphicYOffset:-65}}else{b={externalGraphic:Eniro.Util.getImagesLocation()+"markers/streetview/marker.png",graphicWidth:20,graphicHeight:25,graphicXOffset:-10,graphicYOffset:-13}}var k={};OpenLayers.Util.extend(k,OpenLayers.Feature.Vector.style["default"]);OpenLayers.Util.extend(k,{externalGraphic:b.externalGraphic,graphic:true,graphicZIndex:9001,graphicWidth:b.graphicWidth,graphicHeight:b.graphicHeight,graphicXOffset:b.graphicXOffset,graphicYOffset:b.graphicYOffset,graphicOpacity:1,rotation:this.streetview.heading});var d={};OpenLayers.Util.extend(d,OpenLayers.Feature.Vector.style["default"]);OpenLayers.Util.extend(d,{graphic:false,fill:true,fillColor:"#fff",stroke:true,strokeColor:"#069",strokeOpacity:0.8,strokeWidth:2});this.features=[];var f;var c;if(this.mediator.threeDMode===true&&this.mediator.linearRing){f=this.mediator.linearRing;if(h.drag){c=f.getCentroid();var l=this.streetview.lonlat.lon-c.x;var g=this.streetview.lonlat.lat-c.y;f=f.clone();f.move(l,g)}var o=new Eniro.Feature.Vector(f,{},{style:d});this.features.push(o)}else{this.features.push(new Eniro.Feature.Vector(new OpenLayers.Geometry.Point(this.streetview.lonlat.lon,this.streetview.lonlat.lat),{},{style:k}))}this.layer.addFeatures(this.features);if(this.streetview.pan){if(this.allowPan){this.map.updateSize();var a;if(c){a=new OpenLayers.LonLat(c.x,c.y)}else{a=this.streetview.lonlat}this.map.setCenter(a);this.allowPan=false}this.state=this.streetview}jQuery(this.map.viewPortDiv).css({visibility:"visible"});this.triggerEvent(Eniro.Events.PROGRESS_HIDE)},degreePerPixel:function(){var a=new OpenLayers.Bounds();a.extend(this.map.getCenter());a.extend(this.map.getCenter().clone().add(this.map.getResolution(),this.map.getResolution()));a.transform(this.map.baseLayer.projection,new OpenLayers.Projection("EPSG:4326"));return{lat:(a.top-a.bottom),lon:(a.right-a.left)}},onSearchSuccess:function(b,a){if(b.length){if(b[0].url){this.state=this.streetview;this.mediator.setPosition({lonlat:new OpenLayers.LonLat(b[0].e,b[0].n),path:b[0].url,heading:b[0].destination,pitch:0,utmzone:b[0].utmzone,threeDMode:this.mediator.threeDMode})}}else{this.streetViewUpdate(this.state)}},onSearchFailure:function(){this.debug("Streetview query failed")},toggle3D:function(c){if(this.mediator.threeDMode===false){var d=(this.streetview&&this.streetview.lonlat&&this.streetview.lonlat.lat)?this.streetview.lonlat.lat:null;var f=(this.streetview&&this.streetview.lonlat&&this.streetview.lonlat.lon)?this.streetview.lonlat.lon:null;this.mediator.activate3D(d,f,c)}else{this.streetview.threeDMode=false;var b;if(this.mediator&&this.mediator.linearRing){var a=this.mediator.linearRing.getCentroid();b=new OpenLayers.LonLat(a.x,a.y)}else{b=new OpenLayers.LonLat(this.streetview.lonlat.lon,this.streetview.lonlat.lat)}b.transform(this.map.getProjectionObject(),this.map.backendProjection);this.setLonLat(b,null,false,c)}},setLonLat:function(b,d,g,c){lonlat=new OpenLayers.LonLat(b.lon,b.lat);if(d){this.state=this.streetview;var h={path:d.url,pitch:0,utmzone:d.utmzone,heading:d.heading||0,lonlat:lonlat,threeDMode:g};this.mediator.setPosition(h,c)}else{var f={lat:0.00017981852386839137,lon:0.0003433227535243333};var a=OpenLayers.Function.bind(function(l,k){if(l.length>0){if(l[0].url){this.state=this.streetview;var o={path:l[0].url,pitch:0,utmzone:l[0].utmzone,lonlat:lonlat,threeDMode:g};if(b.heading){o.heading=b.heading}this.mediator.setPosition(o,c)}}else{this.warn("No point data found for search: "+b.lon+" "+b.lat)}},this);if(g){this.mediator.setPosition({lonlat:lonlat,threeDMode:true},c)}else{this.doSearch(lonlat,f,a)}}},onStreetViewListSelect:function(a){this.allowPan=true;this.setLonLat(a.city);Eniro.AppEvents.triggerEvent(Eniro.Events.STATISTICS_LOG,{scope:"page",event:"streetview"})},saveState:function(){var a={};if(this.mediator){a={path:this.mediator.url,heading:this.mediator.heading,pitch:this.mediator.pitch,threeDMode:this.mediator.threeDMode}}return a},applyState:function(a){if(this.mediator){this.mediator.setPosition(a)}},draw:function(){return null},CLASS_NAME:"Eniro.StreetViewController"});Eniro.StreetViewDragFeature=OpenLayers.Class(Eniro.Control,{streetview:null,geometryTypes:null,onStart:function(b,a){},onDrag:function(b,a){},onComplete:function(b,a){},layer:null,feature:null,dragCallbacks:{},featureCallbacks:{},lastPixel:null,initialize:function(b,a){this.streetview=a.controller;OpenLayers.Control.prototype.initialize.apply(this,[a]);this.layer=b;this.handlers={drag:new OpenLayers.Handler.Drag(this,OpenLayers.Util.extend({down:this.downFeature,move:this.moveFeature,up:this.upFeature,out:this.cancel,done:this.doneDragging},this.dragCallbacks)),feature:new OpenLayers.Handler.Feature(this,this.layer,OpenLayers.Util.extend({over:this.overFeature,out:this.outFeature},this.featureCallbacks),{geometryTypes:this.geometryTypes})}},destroy:function(){this.layer=null;OpenLayers.Control.prototype.destroy.apply(this,[])},activate:function(){return(this.handlers.feature.activate()&&OpenLayers.Control.prototype.activate.apply(this,arguments))},deactivate:function(){this.handlers.drag.deactivate();this.handlers.feature.deactivate();this.feature=null;this.dragging=false;this.lastPixel=null;OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass+"Over");return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},overFeature:function(a){if(!this.handlers.drag.dragging){this.feature=a;this.handlers.drag.activate();this.over=true;OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass+"Over")}else{if(this.feature.id==a.id){this.over=true}else{this.over=false}}},downFeature:function(a){this.lastPixel=a;this.firstPixel=a;this.firstGeom=(this.feature.geometry.components)?this.feature.geometry.getCentroid():this.feature.geometry;this.streetview._isDraggingFeature=true},moveFeature:function(a){if(this.feature===null){return}var b=this.pixelToLonlat(a);this.streetview.streetViewUpdate({lonlat:b,heading:null,fieldofview:null,pan:false,drag:true});this.lastPixel=a},upFeature:function(a){if(!this.streetview){return}var c=this.streetview.degreePerPixel();var b=this.pixelToLonlat(a);b.transform(this.map.baseLayer.projection,new OpenLayers.Projection("EPSG:4326"));if(this.streetview.mediator.threeDMode){this.streetview.mediator.setPosition({lonlat:b,threeDMode:true},false)}else{jQuery.jsonp({url:Eniro.AppNode.appUrl("/streetview/search"),data:{north:b.lat,east:b.lon,nsize:(c.lat*8),esize:(c.lon*8)},callbackParameter:"callback",success:OpenLayers.Function.bind(this.streetview.onSearchSuccess,this.streetview),error:OpenLayers.Function.bind(this.streetview.onSearchFailure,this.streetview),dataFilter:function(d){return JSON.parse(JSON.stringify(d))}})}},doneDragging:function(a){if(!this.handlers.drag.dragging){this.handlers.drag.deactivate()}this.streetview._isDraggingFeature=false;this.onComplete(this.feature,a)},outFeature:function(a){if(!this.handlers.drag.dragging){this.over=false;this.handlers.drag.deactivate();OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass+"Over");this.feature=null}else{if(this.feature.id==a.id){this.over=false}}},cancel:function(){this.handlers.drag.deactivate();this.over=false},setMap:function(a){this.handlers.drag.setMap(a);this.handlers.feature.setMap(a);OpenLayers.Control.prototype.setMap.apply(this,arguments)},pixelToLonlat:function(b){var c=Eniro.map.getResolution();var a=c*(b.x-this.firstPixel.x)+this.firstGeom.x;var d=c*(this.firstPixel.y-b.y)+this.firstGeom.y;return new OpenLayers.LonLat(a,d)},CLASS_NAME:"Eniro.StreetViewDragFeature"});Eniro.StreetViewHolder=OpenLayers.Class(Eniro.Control,{flashobject:null,threeDMode:false,initialize:function(){Eniro.Control.prototype.initialize.apply(this,arguments);this.register(Eniro.Events.MODE_SWITCH,this.onModeSwitch);this.register(Eniro.Events.STREETVIEW_FLASH_DIRECTION,this.onFlashDirection);this.register(Eniro.Events.STREETVIEW_FLASH_NAVIGATE,this.onFlashNavigate);this.register(Eniro.Events.STREETVIEW_FLASH_ADDED_TO_DOM,this.onFlashAddedToDom)},destroy:function(){Eniro.Control.prototype.destroy.apply(this,arguments);this.unregister(Eniro.Events.MODE_SWITCH,this.onModeSwitch);this.unregister(Eniro.Events.STREETVIEW_FLASH_DIRECTION,this.onFlashDirection);this.unregister(Eniro.Events.STREETVIEW_FLASH_NAVIGATE,this.onFlashNavigate);this.unregister(Eniro.Events.STREETVIEW_FLASH_ADDED_TO_DOM,this.onFlashAddedToDom)},onFlashAddedToDom:function(a){this.flashobject=a.flashobject},onFlashNavigate:function(c){if(this.elements.lat){jQuery(this.elements.lat).html(c.latitude);jQuery(this.elements.lon).html(c.longitude);jQuery(this.elements.heading).html(c.heading);jQuery(this.elements.pitch).html(c.pitch);var a=c.url.indexOf("/streetview-data/");var b="";if(a>0){b=c.url.substring(a+17)}jQuery(this.elements.url).get(0).value=b}},onFlashDirection:function(a){if(this.elements.lat){jQuery(this.elements.heading).html(a.heading);jQuery(this.elements.pitch).html(a.pitch)}},onModeSwitch:function(a){if(a.mode==="streetview"&&!this.flashDrawn){this.threeDMode=a.threeDMode;this.streetviewDraw()}},draw:function(){this.div=this.createDiv();if(window.location.toString().indexOf("streetviewDebug")>0){this.cssClasses.lat=this.getCssClassName("debug-lat");this.cssClasses.lon=this.getCssClassName("debug-lon");this.cssClasses.heading=this.getCssClassName("debug-heading");this.cssClasses.pitch=this.getCssClassName("debug-pitch");this.cssClasses.url=this.getCssClassName("debug-url");this.debugDiv=jQuery('<div class="'+this.getCssClassName("debug")+'">lat: <span class="'+this.cssClasses.lat+'"></span><br/>lon: <span class="'+this.cssClasses.lon+'"></span><br/>heading: <span class="'+this.cssClasses.heading+'"></span><br/>pitch: <span class="'+this.cssClasses.pitch+'"></span><br/>url: <input type="text" class="'+this.cssClasses.url+'"/></div>').get(0);this.div.appendChild(this.debugDiv)}return this.div},streetviewDraw:function(){var f="/media/streetview/myvrviewer.swf?version=0.2&v="+Eniro.Config["media.version"];var c="/media/streetview/";if(Eniro.Profile){c+=Eniro.Profile.id}else{c+="eniro"}var a={config:"/media/streetview/config.xml",startscript:"Eniro.StreetViewMediator.StartScripting",startMode:this.threeDMode?"3dmap":"streetview",force8BitDepth:true,showDepthImage:false,navigationXmlPath:Eniro.AppNode.appUrl("/streetview/navigate.xml"),navigationBasePath:Eniro.AppNode.streetviewDataUrl()+"/",mediaPath:c};var g={bgcolor:"#c0c0c0",quality:"high",allowFullScreen:true,allowScriptAccess:"sameDomain",onmousedown:"OpenLayers.Event.stop(event, true)",wmode:"opaque"};var b={align:"middle"};var d="eniro_flash_"+Math.floor(Math.random()*100000000);jQuery(this.div).append('<div id="'+d+'" class="'+this.getCssClassName("replaced")+'">'+this.i18n("need-flash")+"</div>");var h=this;swfobject.embedSWF(f,d,"100%","100%","9.0.0","/media/expressInstall.swf",a,g,b,function(){h.triggerEvent(Eniro.Events.STREETVIEW_FLASH_ADDED_TO_DOM,{flashobject:jQuery("#"+d).get(0)})});this.flashDrawn=true},CLASS_NAME:"Eniro.StreetViewHolder"});Eniro.StreetViewMediator=OpenLayers.Class(Eniro.Control,{viewer:undefined,flashobject:undefined,started:false,reason:undefined,url:undefined,northings:undefined,eastings:undefined,elevation:undefined,heading:undefined,pitch:undefined,fieldofview:undefined,latitude:undefined,longitude:undefined,lonlat:undefined,viewport:undefined,initial:undefined,mode:"streetview",threeDMode:false,initialize:function(){this.viewer=OpenLayers.i18n("map.layers.streetview");this.register(Eniro.Events.STREETVIEW_FLASH_FAILED,this.streetViewFailed);this.register(Eniro.Events.STREETVIEW_FLASH_START,this.streetViewStart);this.register(Eniro.Events.STREETVIEW_FLASH_LOADED,this.streetViewLoaded);this.register(Eniro.Events.STREETVIEW_FLASH_DIRECTION,this.streetViewDirection);this.register(Eniro.Events.STREETVIEW_FLASH_NAVIGATE,this.streetViewNavigate);this.register(Eniro.Events.STREETVIEW_FLASH_NAVIGATE3D,this.streetViewNavigate3D);this.register(Eniro.Events.STREETVIEW_FLASH_EXTENT3D,this.streetViewExtent3D);this.register(Eniro.Events.STREETVIEW_FLASH_MODECHANGED,this.streetViewModeChanged);this.register(Eniro.Events.STREETVIEW_FLASH_CURSOR,this.streetViewCursor);this.register(Eniro.Events.STREETVIEW_FLASH_ADDED_TO_DOM,this.onStreetViewFlashAddedToDom);OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.unregister(Eniro.Events.STREETVIEW_FLASH_START,this.streetViewStart);this.unregister(Eniro.Events.STREETVIEW_FLASH_FAILED,this.streetViewFailed);this.unregister(Eniro.Events.STREETVIEW_FLASH_LOADED,this.streetViewLoaded);this.unregister(Eniro.Events.STREETVIEW_FLASH_DIRECTION,this.streetViewDirection);this.unregister(Eniro.Events.STREETVIEW_FLASH_NAVIGATE,this.streetViewNavigate);this.unregister(Eniro.Events.STREETVIEW_FLASH_NAVIGATE3D,this.streetViewNavigate3D);this.unregister(Eniro.Events.STREETVIEW_FLASH_EXTENT3D,this.streetViewExtent3D);this.unregister(Eniro.Events.STREETVIEW_FLASH_CURSOR,this.streetViewCursor);this.unregister(Eniro.Events.STREETVIEW_FLASH_ADDED_TO_DOM,this.onStreetViewFlashAddedToDom);this.unregister(Eniro.Events.STREETVIEW_FLASH_MODECHANGED,this.streetViewModeChanged);OpenLayers.Control.prototype.destroy.apply(this,arguments)},setPosition:function(d,a){if(!this.started||!this.flashobject){if(d.lonlat){this.initial=d;this.longitude=d.lonlat.lon;this.latitude=d.lonlat.lat}return}if(d.utmzone&&this.flashobject.SetUTMZone){this.flashobject.SetUTMZone(d.utmzone)}if(this.threeDMode===true&&(d.threeDMode===false||d.threeDMode===undefined)){this.threeDMode=false;this.mode="streetview";this.flashobject.SetMode(this.mode);Eniro.AppEvents.triggerEvent(Eniro.Events.STREETVIEW_FLASH_MODECHANGED,{mode:this.mode})}var b=(d&&d.lonlat)?d.lonlat.lat:null;var c=(d&&d.lonlat)?d.lonlat.lon:null;if(this.threeDMode===false&&d.threeDMode===true){this.threeDMode=true;this.activate3D(b,c,a);return}if(this.threeDMode===true&&d.threeDMode===true){this.flashobject.SetPosition3D(b,c,true)}if(d.path){this.setImage(d.path,d.heading)}if(d.pitch){this.setPitch(d.pitch)}},streetViewStart:function(b){var a;if(!this.flashobject){throw new Error("this.flashobject is not initialised, which indicates Events.STREETVIEW_FLASH_ADDED_TO_DOM was not done before streetViewStart()")}this.started=true;this.flashobject.SetMinPitch(-30);if(this.initial){if(this.threeDMode===false){this.setPosition(this.initial)}else{this.activate3D(this.initial.lonlat.lat,this.initial.lonlat.lon)}delete this.initial}if(this.initialHeading){this.setHeading(this.initialHeading)}},onStreetViewFlashAddedToDom:function(a){this.flashobject=a.flashobject;Eniro.StreetViewMediator.flashobject=a.flashobject},streetViewFailed:function(a){this.reason=a.reason},streetViewLoaded:function(a){this.url=a.url;this.northings=a.northings;this.eastings=a.eastings;this.elevation=a.elevation;this.heading=a.heading;this.pitch=a.pitch;this.fieldofview=a.fieldofview;Eniro.AppEvents.triggerEvent(Eniro.Events.STATISTICS_LOG,{scope:"content",event:"streetview"})},streetViewDirection:function(a){this.heading=a.heading;this.pitch=a.pitch;this.fieldofview=a.fieldofview;this.streetViewRedrawMarker()},streetViewNavigate:function(a){this.url=a.url;this.latitude=a.latitude;this.longitude=a.longitude;this.elevation=a.elevation;this.heading=a.heading;this.pitch=a.pitch;this.fieldofview=a.fieldofview;this.lonlat=new OpenLayers.LonLat(this.longitude,this.latitude);this.lonlat.transform(new OpenLayers.Projection("EPSG:4326"),Eniro.map.baseLayer.projection);this.streetViewRedrawMarker()},streetViewNavigate3D:function(f){var b=new OpenLayers.Geometry.Point(f.cameraposeastings,f.cameraposnorthings);b.transform(new OpenLayers.Projection("EPSG:32632"),new OpenLayers.Projection("EPSG:4326"));this.longitude=b.x;this.latitude=b.y;this.lonlat=new OpenLayers.LonLat(this.longitude,this.latitude);this.lonlat.transform(new OpenLayers.Projection("EPSG:4326"),Eniro.map.baseLayer.projection);this.elevation=f.centerelevation;var d=Math.abs(f.cameraposeastings-f.targetposeastings);var c=Math.abs(f.cameraposnorthings-f.targetposnorthings);var a=Math.atan(d/c);var g=a*(Math.PI/180);this.heading=g;this.streetViewRedrawMarker()},streetViewExtent3D:function(f){var h=f.array;var g=new OpenLayers.Geometry.Point(h[8][0],h[8][1]);var d=new OpenLayers.Geometry.Point(h[9][0],h[9][1]);var c=new OpenLayers.Geometry.Point(h[10][0],h[10][1]);var b=new OpenLayers.Geometry.Point(h[11][0],h[11][1]);var a=[g,d,c,b];this.linearRing=new OpenLayers.Geometry.LinearRing(a);this.linearRing.transform(new OpenLayers.Projection("EPSG:32632"),Eniro.map.baseLayer.projection);this.streetViewRedrawMarker()},streetViewCursor:function(a){this.northings=a.northings;this.eastings=a.eastings;this.elevation=a.elevation},streetViewRedrawMarker:function(){if(this.lonlat!==null){this.viewport=Eniro.map.getExtent();var a=Eniro.map.getResolution();this.viewport.left+=(a*40);this.viewport.right-=(a*40);this.viewport.bottom+=(a*90);this.viewport.top-=(a*40);var b=this.viewport.containsLonLat(this.lonlat);Eniro.AppEvents.triggerEvent(Eniro.Events.STREETVIEW_UPDATE,{linearRing:this.linearRing,lonlat:this.lonlat,heading:this.heading,fieldofview:this.fieldofview,pan:!b,drag:false})}},streetViewModeChanged:function(a){var b=a.mode;if(b=="3dmap"){}else{if(b=="streetview"){this.threeDMode=false;this.mode=b;this.streetViewRedrawMarker()}}},DATA_PATH_TOKEN:"/streetview-data/",setImage:function(b,d){if(b.indexOf("http://")<0){b=Eniro.AppNode.streetviewDataUrl()+"/"+b}if(this.flashobject&&this.flashobject.SetImageWithParams){var a=b.substring(b.indexOf(this.DATA_PATH_TOKEN)+this.DATA_PATH_TOKEN.length);a=a.substring(0,a.lastIndexOf("/"));var f=Eniro.Crypto.crc32(a);if(d){this.flashobject.SetImageWithParams(b,"?c="+f,d)}else{this.flashobject.SetImageWithParams(b,"?c="+f)}}},setHeading:function(a){if(this.flashobject&&this.flashobject.SetHeading){this.flashobject.SetHeading(a)}else{this.initialHeading=a}},setPitch:function(a){this.flashobject.SetPitch(a)},activate3D:function(c,d,b){this.threeDMode=true;this.mode="3dmap";this.flashobject.ChangeDataRoot3D(Eniro.AppNode.streetview3dDataUrl(),32);this.flashobject.ChangeRefMapRoot3D(Eniro.AppNode.streetview3dRefUrl());this.flashobject.SetStreetViewQueryPath3D(Eniro.AppNode.appUrl("/streetview/navigate.xml"));if(b){this.flashobject.ActionStreetView("GOTO3DMAP",true)}else{var f=c||this.latitude;var a=d||this.longitude;this.flashobject.SetMode(this.mode);this.flashobject.SetPosition3D(c,d,true);this.flashobject.SetHeading3D(this.heading);this.flashobject.SetPitch3D(20);this.flashobject.SetDistance3D(-1)}this.flashobject.DetectStreetView3D(true);Eniro.AppEvents.triggerEvent(Eniro.Events.STREETVIEW_FLASH_MODECHANGED,{mode:this.mode})},CLASS_NAME:"Eniro.StreetViewMediator"});Eniro.StreetViewMediator.StartScripting=function(b){var a=Eniro.StreetViewMediator.flashobject;a.RegisterCallback("LOADEDSV","Eniro.StreetViewMediator.StreetViewLoaded");a.RegisterCallback("DIRECTIONSV","Eniro.StreetViewMediator.OnStreetViewDirection");a.RegisterCallback("NAVIGATESV","Eniro.StreetViewMediator.OnStreetViewNavigate");a.RegisterCallback("NAVIGATE3D","Eniro.StreetViewMediator.On3DMapNavigate");a.RegisterCallback("EXTENT3D","Eniro.StreetViewMediator.On3DMapExtent");a.RegisterCallback("MODECHANGED","Eniro.StreetViewMediator.OnModeChanged");Eniro.AppEvents.triggerEvent(Eniro.Events.STREETVIEW_FLASH_START,{str:b})};Eniro.StreetViewMediator.OnModeChanged=function(a){Eniro.AppEvents.triggerEvent(Eniro.Events.STREETVIEW_FLASH_MODECHANGED,{mode:a})};Eniro.StreetViewMediator.On3DMapNavigate=function(h,d,c,a,f,b,g){Eniro.AppEvents.triggerEvent(Eniro.Events.STREETVIEW_FLASH_NAVIGATE3D,{cameraposnorthings:h,cameraposeastings:d,targetposnorthings:c,targetposeastings:a,centernorthings:f,centereastings:b,centerelevation:g})};Eniro.StreetViewMediator.On3DMapExtent=function(a){Eniro.AppEvents.triggerEvent(Eniro.Events.STREETVIEW_FLASH_EXTENT3D,{array:a})};Eniro.StreetViewMediator.StreetViewFailed=function(a){Eniro.AppEvents.triggerEvent(Eniro.Events.STREETVIEW_FLASH_FAILED,{reason:a})};Eniro.StreetViewMediator.StreetViewLoaded=function(c,f,a,d,h,g,b){Eniro.AppEvents.triggerEvent(Eniro.Events.STREETVIEW_FLASH_LOADED,{url:c,northings:f,eastings:a,elevation:d,heading:h,pitch:g,fieldofview:b})};Eniro.StreetViewMediator.OnStreetViewDirection=function(c,b,a){Eniro.AppEvents.triggerEvent(Eniro.Events.STREETVIEW_FLASH_DIRECTION,{heading:c,pitch:b,fieldofview:a})};Eniro.StreetViewMediator.OnStreetViewNavigate=function(b,h,d,c,g,f,a){Eniro.AppEvents.triggerEvent(Eniro.Events.STREETVIEW_FLASH_NAVIGATE,{url:b,latitude:h,longitude:d,elevation:c,heading:g,pitch:f,fieldofview:a})};Eniro.StreetViewSideBar=OpenLayers.Class(Eniro.Control,{list:null,backLink:null,sponsor:null,initialize:function(){Eniro.Control.prototype.initialize.apply(this,arguments);this.list=this.getList();if(Eniro.Profile.sellable&&Eniro.Profile.sellable.streetViewSponsor){this.sponsor=new Eniro.SponsorBanner(Eniro.Profile.sellable.streetViewSponsor,null,"streetview",{name:"streetview"})}},destroy:function(){if(this.list){this.list.destroy()}if(this.backLink){this.backLink.parentNode.removeChild(this.backLink)}if(this.sponsor){this.sponsor.destroy()}Eniro.Control.prototype.destroy.apply(this,arguments)},activate:function(){if(Eniro.Control.prototype.activate.apply(this,arguments)){if(this.list){this.list.activate()}if(this.sponsor){this.sponsor.activate()}return true}return false},registerObservers:function(){this.observe(this.backLink,"click",this.onClick)},onClick:function(a){var b=OpenLayers.Event.element(a);b=jQuery(b).closest("a").get(0);if(b===this.backLink){OpenLayers.Event.stop(a);this.triggerEvent(Eniro.Events.STATE_SAVING_MODE_SWITCH,{previousMode:true,mode:"streetview"});return false}return true},draw:function(){Eniro.Control.prototype.draw.apply(this,arguments);this.backLink=jQuery('<a href="/'+new Date().getTime()+'" class="'+this.getCssClassName("backlink")+'"><span>'+this.i18n("back-to-map")+"</span></a>").get(0);jQuery(this.map.containerDiv).append(this.backLink);if(Eniro.Profile.sellable&&Eniro.Profile.sellable.streetViewSponsor){this.sponsor.setMap(this.map);jQuery(this.map.containerDiv).append(this.sponsor.draw())}if(this.list){this.div.appendChild(this.list.draw())}return this.div},getList:function(){return new Eniro.StreetViewList({parent:this})},CLASS_NAME:"Eniro.StreetViewSideBar"});Eniro.Streetview3DSideBar=OpenLayers.Class(Eniro.StreetViewSideBar,{threeDLink:null,initialize:function(){Eniro.StreetViewSideBar.prototype.initialize.apply(this,arguments);this.register(Eniro.Events.STREETVIEW_FLASH_MODECHANGED,this.onStreetViewModeChanged);this.register(Eniro.Events.MAP_TYPES_UPDATE,this.onMapTypesUpdate)},destroy:function(){if(this.threeDLink){this.threeDLink.parentNode.removeChild(this.threeDLink)}this.unregister(Eniro.Events.STREETVIEW_FLASH_MODECHANGED,this.onStreetViewModeChanged);this.unregister(Eniro.Events.MAP_TYPES_UPDATE,this.onMapTypesUpdate);Eniro.StreetViewSideBar.prototype.destroy.apply(this,arguments)},registerObservers:function(){Eniro.StreetViewSideBar.prototype.registerObservers.apply(this,arguments);if(this.threeDLink){this.observe(this.threeDLink,"click",this.onClick)}},onStreetViewModeChanged:function(a){var b;if(a.mode==="3dmap"){b=this.i18n("streetview");this.list.hide()}else{b=this.i18n("3d");this.list.show()}this.threeDLink.childNodes[0].innerHTML=b},onMapTypesUpdate:function(b){var a=this.map.getControl(Eniro.ControlID.STREET_VIEW_CONTROLLER);var c=a.mediator&&a.mediator.threeDMode;if(b.maptypes&&(!c&&b.maptypes.streetview3d||c&&b.maptypes.streetview)){this.threeDLink.style.display=""}else{this.threeDLink.style.display="none"}},onClick:function(a){if(Eniro.StreetViewSideBar.prototype.onClick.apply(this,arguments)){var b=OpenLayers.Event.element(a);b=jQuery(b).closest("a").get(0);if(this.threeDLink&&b===this.threeDLink&&Eniro.Profile["3D"]){OpenLayers.Event.stop(a);var c=this.map.getControl(Eniro.ControlID.STREET_VIEW_CONTROLLER);c.toggle3D(true);return false}}return true},draw:function(){Eniro.StreetViewSideBar.prototype.draw.apply(this,arguments);if(Eniro.Profile["3D"]){this.threeDLink=document.createElement("a");this.threeDLink.href="/"+new Date().getTime();this.threeDLink.className=this.getCssClassName("3dlink");this.threeDLink.innerHTML="<span>"+this.i18n("3d")+"</span>";this.map.containerDiv.appendChild(this.threeDLink)}var a=this.map.getControl(Eniro.ControlID.STREET_VIEW_CONTROLLER);if(a.mediator&&a.mediator.threeDMode&&this.list){this.list.hide()}return this.div},CLASS_NAME:"Eniro.Streetview3DSideBar"});Eniro.StreetViewList=OpenLayers.Class(Eniro.Control,{initialize:function(){Eniro.Control.prototype.initialize.apply(this,arguments)},destroy:function(){Eniro.Control.prototype.destroy.apply(this,arguments)},registerObservers:function(){this.observe(this.div,"click",this.onClick);if(jQuery.browser.msie&&parseInt(jQuery.browser.version,10)<7){var a=this;jQuery(window).resize(function(){a.adjustIE6Height()});this.adjustIE6Height()}},adjustIE6Height:function(){var a=jQuery(window).height()-498;jQuery(this.div).height(a)},onClick:function(b){var d=OpenLayers.Event.element(b);var a=jQuery(d).closest("li");if(a.size()>0){var c=a.parent().children().index(a);if(c>=0&&c<=Eniro.Profile.streetview.cities.length){OpenLayers.Event.stop(b);this.triggerEvent(Eniro.Events.STREETVIEW_LIST_SELECT,{city:Eniro.Profile.streetview.cities[c]});return false}return true}return true},renderHeader:function(){return['<h2 class="'+this.getCssClassName("header")+'">',this.i18n("more-streetview"),"</h2>"].join("")},renderList:function(){this.cssClasses.item=this.getCssClassName("item");var c=Eniro.Profile.streetview.cities;var b=[];for(var a=0,d=c.length;a<d;++a){b.push('<li class="'+this.cssClasses.item+'">','<a href="/'+c[a].id+'">',OpenLayers.i18n("street-view-list."+c[a].id),"</a>","</li>")}return"<ul>"+b.join("")+"</ul>"},draw:function(){this.div=this.createDiv();this.cssClasses.inner=this.getCssClassName("inner");var a=jQuery('<div class="'+this.cssClasses.inner+'"></div>');a.append(this.renderHeader());a.append(this.renderList());jQuery(this.div).append(a);return this.div},hide:function(){if(this.div){this.div.style.display="none"}},show:function(){if(this.div){this.div.style.display=""}},CLASS_NAME:"Eniro.StreetViewList"});Eniro.StreetViewLayerbarButton=OpenLayers.Class(Eniro.Control,{selected:false,disabled:true,timer:null,timeout:200,initialize:function(){Eniro.Control.prototype.initialize.apply(this,arguments)},activate:function(){if(Eniro.Control.prototype.activate.apply(this,arguments)){jQuery(this.layerBarButton).append(this.div);return true}return false},registerObservers:function(){this.observe(this.layerBarButton,"mouseover",this.onMouseOver);this.observe(this.layerBarButton,"mouseout",this.onMouseOut);this.observe(this.layerBarButton,"click",this.onClick)},onMouseOver:function(a){if(this.timer){clearTimeout(this.timer)}if(this.disabled){this.showList()}return true},onMouseOut:function(a){if(Eniro.Util.mouseLeft(a,this.layerBarButton)){this.timer=setTimeout(OpenLayers.Function.bind(this.hideList,this),this.timeout)}return true},onClick:function(a){OpenLayers.Event.stop(a);var c=OpenLayers.Event.element(a);c=jQuery(c).closest("li");if(c.get(0)===this.layerBarButton&&!this.disabled){var d=this.map.getExtent().getCenterLonLat();d.transform(this.map.getProjectionObject(),this.map.backendProjection);this.triggerEvent(Eniro.Events.STATE_SAVING_MODE_SWITCH,{mode:"streetview",_streetViewLonLat:d});return false}var b=jQuery(this.div).find("ul").children().index(c);if(c.size()>0&&b>=0){this.triggerEvent(Eniro.Events.STATE_SAVING_MODE_SWITCH,{mode:"streetview",_streetViewCityIndex:b});return false}return true},showList:function(){jQuery(this.layerBarButton).find("ul").show()},hideList:function(){jQuery(this.layerBarButton).find("ul").hide()},draw:function(){this.div=this.createDiv();var c=this.getCities();if(c){var b=['<ul style="display:none;">'];for(var a=0,d=c.length;a<d;++a){b.push('<li><a href="/'+new Date().getTime()+'">'+OpenLayers.i18n("street-view-list."+c[a].id)+"</a></li>")}b.push("</ul>");jQuery(this.div).append(b.join(""))}return this.div},getCities:function(){var a=null;if(Eniro.Profile.streetview&&Eniro.Profile.streetview.cities){a=Eniro.Profile.streetview.cities}return a},CLASS_NAME:"Eniro.StreetViewLayerbarButton"});Eniro.StreetViewLayerbarButton3D=OpenLayers.Class(Eniro.StreetViewLayerbarButton,{triggerEvent:function(b,a){a.threeDMode=true;Eniro.StreetViewLayerbarButton.prototype.triggerEvent.call(this,b,a)},getCities:function(){var a=null;if(Eniro.Profile["3D"]&&Eniro.Profile["3D"].cities){a=Eniro.Profile["3D"].cities}return a},CLASS_NAME:"Eniro.StreetViewLayerbarButton3D"});Eniro.StreetViewView=OpenLayers.Class(Eniro.Control,{initialize:function(){Eniro.Control.prototype.initialize.apply(this,arguments);if(Eniro.Profile.id==="dk"||Eniro.Profile.id==="dk_krak"){this.sidebar=new Eniro.Streetview3DSideBar()}else{this.sidebar=new Eniro.StreetViewSideBar()}this.holder=new Eniro.StreetViewHolder();this.div=true},destroy:function(){if(this.sidebar){this.sidebar.destroy()}if(this.holder){this.holder.destroy()}Eniro.Control.prototype.destroy.apply(this,arguments)},activate:function(){if(Eniro.Control.prototype.activate.apply(this,arguments)){this.sidebar.activate();this.holder.activate();return true}return false},setMap:function(a){Eniro.Control.prototype.setMap.apply(this,arguments);this.sidebar.setMap(a);this.holder.setMap(a)},draw:function(){this.div=this.createDiv();this.div.appendChild(this.sidebar.draw());this.div.appendChild(this.holder.draw());this.map.containerDiv.insertBefore(this.div,this.map.div);return Eniro.Control.prototype.draw.apply(this,arguments)},CLASS_NAME:"Eniro.StreetViewView"});Eniro.MenuItem=OpenLayers.Class(Eniro.Control,{delimiter:false,value:"",disabled:false,initialize:function(){Eniro.Control.prototype.initialize.apply(this,arguments)},activate:function(){if(Eniro.Control.prototype.activate.apply(this,arguments)){this.stateChanged();jQuery(this.div).show();return true}return false},deactivate:function(){if(Eniro.Control.prototype.deactivate.apply(this,arguments)){this.stateChanged();jQuery(this.div).hide();return true}return false},onDisable:function(){this.stateChanged()},onEnable:function(){this.stateChanged()},stateChanged:function(){jQuery(this.div).attr("class",this.getCssClassName())},execute:function(a){},getCssClassName:function(){var a=Eniro.Control.prototype.getCssClassName.apply(this,arguments);if(this.delimiter){a+=" "+Eniro.Control.prototype.getCssClassName.apply(this,["delimiter"])}return a},draw:function(){this.div=jQuery(['<li class="',this.getCssClassName(),'">','<a href="/'+new Date().getTime()+'">',"<span>",this.value,"</span>","</a>","</li>"].join("")).get(0);return this.div},CLASS_NAME:"Eniro.MenuItem"});Eniro.FavoritesItem=OpenLayers.Class(Eniro.MenuItem,{initialize:function(){Eniro.MenuItem.prototype.initialize.apply(this,arguments)},assignElements:function(){Eniro.MenuItem.prototype.assignElements.apply(this,arguments);this.closeButton=this.find("span.close")},handleClickEvent:function(a){if(a===this.closeButton){this.triggerEvent(Eniro.Events.REMOVE_MENU_ITEM,this.div.id)}},draw:function(){Eniro.MenuItem.prototype.draw.apply(this,arguments);this.addRemoveItemButton();return this.div},addRemoveItemButton:function(){this.linkArea=this.find("a");var a='<span class="close">';this.linkArea.appendChild(a.toDomElement())},CLASS_NAME:"Eniro.FavoritesItem"});Eniro.ShowOnMapMenuItem=OpenLayers.Class(Eniro.MenuItem,{delimiter:false,parent:null,layerActive:false,initialize:function(){Eniro.MenuItem.prototype.initialize.apply(this,arguments)},execute:function(){if(this.layerActive){this.triggerEvent(Eniro.Events.POI_LAYER_DEACTIVATE,{layername:this.id});this.layerActive=false}else{this.triggerEvent(Eniro.Events.POI_LAYER_ACTIVATE,{layername:this.id});this.layerActive=true}},CLASS_NAME:"Eniro.ShowOnMapMenuItem",SUPER:"Eniro.MenuItem"});Eniro.MenuForm=OpenLayers.Class(Eniro.Control,{initialize:function(a){Eniro.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.form=null;this.input=null;this.submitButton=null;Eniro.Control.prototype.destroy.apply(this,arguments)},assignElements:function(){Eniro.Control.prototype.assignElements.apply(this,arguments);this.form=jQuery(this.div).find("form").get(0);this.input=jQuery(this.div).find("form [type=text]").get(0);this.submitButton=jQuery(this.div).find("form [type=submit]").get(0)},registerObservers:function(){this.observe(this.div,"click",this.onClick)},onClick:function(a){OpenLayers.Event.stop(a);var b=OpenLayers.Event.element(a);if(this.closest(b,"legend")){this.toggle()}else{if(b===this.submitButton){this.submit();this.clear()}}return false},toggle:function(a){this.toggleClass(this.form,"collapsed")},submit:function(){this.triggerEvent(Eniro.Events.ADD_MENU_ITEM,new Eniro.FavoritesItem({value:this.input.value}))},clear:function(){this.findAll(":input").val("")},draw:function(){var a=OpenLayers.Util.createUniqueID(this.CSS_CLASS_NAME);this.div=['<li id="',this.id,'" class="',this.CSS_CLASS_NAME,'">','<form class="collapsed" action="">',"<fieldset>","<legend><span>",this.i18n(this.id),"</span></legend>","<label>",'<input type="text" maxlength="30" value="" name="',a,'-add-name" id="',a,'-add-name">',"</label>",'<button type="submit" class="eniro-button"><span>',this.i18n("save"),"</span></button>","</fieldset>","</form>","</li>"].join("").toDomElement();return this.div},CLASS_NAME:"Eniro.MenuForm"});Eniro.Menu=OpenLayers.Class(Eniro.Control,{controls:[],allowRightClick:false,initialize:function(a){this.controls=[];this.allowRightClick=a||this.allowRightClick;Eniro.Control.prototype.initialize.apply(this,arguments)},destroy:function(){for(var a=0,b=this.controls.length;a<b;++a){this.controls[a].destroy();OpenLayers.Util.removeItem(this.controls,this.controls[a])}this.controls=null;Eniro.Control.prototype.destroy.apply(this,arguments)},activate:function(){if(Eniro.Control.prototype.activate.apply(this,arguments)){for(var a=0,d=this.controls.length;a<d;++a){var b=this.controls[a];if(!b.active){var c=b.draw();if(c){jQuery(this.elements.list).append(c)}b.activate()}}return true}return false},registerObservers:function(){this.observe(this.div,"click",this.onClick);this.observe(this.div,"mouseup",this.onMouseUp)},onClick:function(b){var d=OpenLayers.Event.element(b);d=jQuery(d).parents("li:eq(0)");if(d.size()>0){var c=jQuery(this.elements.list).children().index(d);var f=this.controls[c];if(c>=0&&f.disabled===false&&f.active){var a=f.execute();if(a===false){OpenLayers.Event.stop(b);return false}else{}}}return true},onMouseUp:function(a){if(this.allowRightClick&&OpenLayers.Event.isRightClick(a)){this.onClick(a)}},addItem:function(b){if(b.CLASS_NAME==="Eniro.MenuItem"){this.controls.push(b);if(this.elements.list){var a=b.draw();if(a){jQuery(this.elements.list).append(a)}b.activate()}}else{this.error('Only controls of type "Eniro.MenuItem" can be added.')}},disableItem:function(b){var a=this.getItemById(b);if(a){a.disabled=true;a.onDisable()}},enableItem:function(b){var a=this.getItemById(b);if(a){a.disabled=false;a.onEnable()}},getItemById:function(c){for(var a=0,b=this.controls.length;a<b;++a){if(this.controls[a].id===c){return this.controls[a]}}return null},draw:function(){this.div=this.createDiv();this.cssClasses.list=this.getCssClassName("list");jQuery(this.div).append(['<div class="',this.getCssClassName("inner"),'">','<ul class="',this.cssClasses.list,'">',"</ul>","</div>"].join(""));return Eniro.Control.prototype.draw.apply(this,arguments)},CLASS_NAME:"Eniro.Menu"});Eniro.FavoritesMenu=OpenLayers.Class(Eniro.Menu,{parent:null,initialize:function(){Eniro.Menu.prototype.initialize.apply(this,arguments);this.register(Eniro.Events.ADD_MENU_ITEM,this.addControl);this.register(Eniro.Events.REMOVE_MENU_ITEM,this.removeControl)},destroy:function(){this.unregister(Eniro.Events.ADD_MENU_ITEM,this.addControl);this.unregister(Eniro.Events.REMOVE_MENU_ITEM,this.removeControl);Eniro.Menu.prototype.destroy.apply(this,arguments)},removeControl:function(a){if(confirm(this.i18n("confirmation-text"))){Eniro.Menu.prototype.removeControl.apply(this,arguments)}},CLASS_NAME:"Eniro.FavoritesMenu"});Eniro.TreeViewMenu=OpenLayers.Class(Eniro.Menu,{initialize:function(){this.controls=[];Eniro.Menu.prototype.initialize.apply(this,arguments)},CLASS_NAME:"Eniro.TreeViewMenu",SUPER:"Eniro.Menu"});Eniro.ShowOnMapSubMenu=OpenLayers.Class(Eniro.TreeViewMenu,{initialize:function(){Eniro.TreeViewMenu.prototype.initialize.apply(this,arguments)},CLASS_NAME:"Eniro.ShowOnMapSubMenu"});Eniro.Dialog=OpenLayers.Class(Eniro.Control,{id:undefined,title:"Dialog",initialize:function(){Eniro.Control.prototype.initialize.apply(this,arguments)},draw:function(){this.div=['<div class="',this.getCssClassName(),'" />'].join("").toDomElement();if(this.fields){var c=['<form class="',this.getCssClassName("form"),'" action="" method="get">',"<fieldset>","<legend>",this.i18n(this.caption),"</legend>","<dl>"];for(var b=0,k=this.fields.length;b<k;b++){var g=this.fields[b];var f=g.type||"text";if(g.type=="text"&&!g.properties.noLabel){c.push("<dt>",'<label for="',g.id,'">',this.i18n(g.id),"</label>","</dt>")}var a=["<input ",' type="',f,'"'];var d=[];if(f){d.push("eniro-input-"+f)}for(var h in g){if(g.hasOwnProperty(h)&&g[h]){if(h==="className"){d.push(g[h])}else{if(h!=="properties"){a.push(" "+h+'="'+g[h]+'"')}}}}if(d.length>0){a.push(' class="',d.join(" "),'"')}a.push("/>");c.push("<dd");if(h.type&&h.type==="hidden"){c.push(hiddenClass)}c.push(">",a.join(""),"</dd>");c.push("</form>")}c.push("</dl>");this.div.appendChild(c.join("").toDomElement())}this.observe(this.div,"click",this.onClick);this.observe(this.div,"keyup",Eniro.Util.stopArrowKeysEvent);this.observe(this.div,"keydown",Eniro.Util.stopArrowKeysEvent);return this.div},onClick:function(a){OpenLayers.Event.stop(a)},CLASS_NAME:"Eniro.Dialog"});Eniro.SendErrorReportDialog=OpenLayers.Class(Eniro.Control,{TEXTAREA_MAX_LENGTH:1000,CORNER_SIZE:14,PADDING_SIZE:11,topLeftDiv:null,topRightDiv:null,bottomLeftDiv:null,bottomRightDiv:null,contentDiv:null,closeDiv:null,closeCallback:null,button:null,data:{},initialize:function(a){Eniro.Dialog.prototype.initialize.apply(this,arguments);jQuery(window).bind("resize",OpenLayers.Function.bind(this.centerDialog,this));this.closeCallback=a},destroy:function(){jQuery(this.window).unbind("resize",OpenLayers.Function.bind(this.centerDialog,this));Eniro.Control.prototype.destroy.apply(this,arguments)},onClick:function(a){OpenLayers.Event.stop(a);return false},drawCornerDecorator:function(d){var a=Eniro.Util.createDiv(null,this.getCssClassName(d+"-decorator"));var b=Eniro.Util.createDiv(null,this.getCssClassName(d+"-decorator-img-div"));var c=this.createDecoratorImageElement();b.appendChild(c);a.appendChild(b);return a},createDecoratorImageElement:function(){var b=Eniro.Util.getImagesLocation()+"popup/report-popup.png?v="+Eniro.Config["media.version"];var a=['<img src="'+b+'"></img>'].join("");return a.toDomElement()},centerDialog:function(){if(this.contentDiv){var d=jQuery(window);var a=((d.height()/2)-(this.contentDiv.offsetHeight/2+20));var c=Math.round((d.width()/2)-((this.contentDiv.offsetWidth+2*this.CORNER_SIZE)/2));var b=jQuery(this.div);if(a<50){a=50}if(c<0){c=0}b.css("left",c);b.css("top",a);return b}},adjustToFit:function(){this.observe(this.button,"click",this.onSubmit);this.observe(this.closeDiv,"click",this.close);var a=this.contentDiv.offsetWidth+this.CORNER_SIZE;var l=this.contentDiv.offsetHeight+this.PADDING_SIZE;var b=this.centerDialog();var k=jQuery(this.topLeftDiv);k.css("width",a);k.css("height",l);var d=jQuery(this.topRightDiv);d.css("height",l);var f=jQuery(this.bottomLeftDiv);f.css("width",a);var h=jQuery(this.contentDiv);h.css("width",this.contentDiv.offsetWidth);h.css("height",this.contentDiv.offsetHeight);var g=l+this.PADDING_SIZE;var c=a+this.CORNER_SIZE;b.css("height",g);b.css("width",c)},draw:function(){Eniro.Dialog.prototype.draw.apply(this,arguments);this.div=Eniro.Util.createDiv(null,this.getCssClassName("main"));this.contentDiv=Eniro.Util.createDiv(null,this.getCssClassName("content"));this.closeDiv=['<div class="',this.getCssClassName("close"),' olPopupCloseBox"/>'].join("").toDomElement();this.topLeftDiv=this.drawCornerDecorator("top-left");this.topRightDiv=this.drawCornerDecorator("top-right");this.bottomLeftDiv=this.drawCornerDecorator("bottom-left");this.bottomRightDiv=this.drawCornerDecorator("bottom-right");this.div.appendChild(this.topLeftDiv);this.div.appendChild(this.topRightDiv);this.div.appendChild(this.bottomLeftDiv);this.div.appendChild(this.bottomRightDiv);this.div.appendChild(this.closeDiv);this.div.appendChild(this.contentDiv);var b=this.addFormElements();if(Eniro.Util.isArray(b)){for(var a=0;a<b.length;a++){this.contentDiv.appendChild(b[a])}}else{if(b){this.contentDiv.appendChild(b)}}return this.div},addFormElements:function(){var b=["<div></div>"].join().toDomElement();var f=['<div class="',this.getCssClassName("header"),'">',this.i18n("header"),"</div>"].join("").toDomElement();var d=['<div class="',this.getCssClassName("info"),'">',this.i18n("info-message"),"</div>"].join("").toDomElement();var c=['<form class="',this.getCssClassName("form"),'" action="" method="get"></form>'].join("").toDomElement();var a=["<fieldset>","<dl>","<dt>",'<label for="error-description">','<span class="',this.getCssClassName("label"),'">',this.i18n("error-description"),"</span>",'<span class="',this.getCssClassName("hint"),'">(',this.i18n("error-description-max"),")</span>","</label>","</dt>","<dd>","<div>",'<textarea id="error-description" class="',this.getCssClassName("text"),'" cols="32" rows="3" name="error-description"></textarea>',"</div>",'<div class="',this.getCssClassName("error"),'" style="border:none;">',this.i18n("error-nomessage"),"</div>","</dd>","</dl>","<dl>","<dt>",'<label for="reporter-name">','<span class="',this.getCssClassName("label"),'">',this.i18n("reporter-name"),"</span>","</label>","</dt>","<dd>","<div>",'<input id="reporter-name" class="',this.getCssClassName("info"),'" type="text" name="reporter-name"/>',"</div>",'<div class="',this.getCssClassName("error"),'" style="border:none;">',this.i18n("error-noname"),"</div>","</dd>","</dl>","<dl>","<dt>",'<label for="reporter-email">','<span class="',this.getCssClassName("label"),'">',this.i18n("reporter-email"),"</span>","</label>","</dt>","<dd>","<div>",'<input id="reporter-email" class="',this.getCssClassName("info"),'" type="text" name="reporter-email"/>',"</div>",'<div class="',this.getCssClassName("error"),'" style="border:none;">',this.i18n("error-noaddress"),"</div>","</dd>","</dl>","<dl>","<dd>",'<div class="',this.getCssClassName("error"),'" style="border:none;">',this.i18n("error-mail"),"</div>","</dd>","</dl>","</fieldset>"].join("").toDomElement();this.button=['<button type="button" class="eniro-button ',this.getCssClassName("submit"),'">',"<span>",this.i18n("send"),"</span>","</button>"].join("").toDomElement();b.appendChild(f);b.appendChild(d);c.appendChild(a);c.appendChild(this.button);b.appendChild(c);return[f,d,c]},close:function(){jQuery(this.div).remove();this.closeCallback()},doSend:function(c){var a=[window.location.protocol,"//",window.location.host,"/m/"].join("");var b=this.i18n("subject",{profileName:Eniro.Profile.name});jQuery.ajax({type:"POST",url:"/appNodeProxy/send/mailmapstate",data:{mailto:this.i18n("supportMailAddress"),mailfrom:this.data.reporterEmail,sender:this.data.reporterName,message:this.data.errorDescription+"\n\n",subject:b,mapstate:c,url:a},success:OpenLayers.Function.bind(this.close,this),error:OpenLayers.Function.bind(this.displayError,this)})},onSubmit:function(){var a=jQuery(this.div).find("input[type=text], textarea:first");var h=jQuery(this.div).find("textarea:first");var b;var d={};for(var c=0,k=a.length;c<k;c++){var g=jQuery(a[c]).parent().siblings("div[class$=error]:first");if(g){if(a[c].value.length&&(a[c].type!=="textarea"||(a[c].type==="textarea"&&a[c].value.length<=this.TEXTAREA_MAX_LENGTH))){g.hide();d[a[c].id.camelize()]=a[c].value}else{g.show();b=true}}}var f=jQuery(this.div).find("div[class$=error]:last");if(f){f.hide()}if(!b){this.data=d;this.map.stateController.save(OpenLayers.Function.bind(this.doSend,this),OpenLayers.Function.bind(this.displayError,this))}},clearForm:function(){var a=jQuery(this.div).find("input[type=text], textarea:first");for(var b=0,f=a.length;b<f;b++){var d=jQuery(a[b]).parent().siblings("div[class$=error]:first");if(d){a[b].value="";d.hide()}}var c=jQuery(this.div).find("div[class$=error]:last");if(c){c.hide()}},displayError:function(g){var a=jQuery(this.div).find("input[type=text], textarea:first");for(var b=0,f=a.length;b<f;b++){var d=jQuery(a[b]).parent().siblings("div[class$=error]:first");if(d&&a[b].id.camelize()==g){d.show();return}}var c=jQuery(this.div).find("div[class$=error]:last");if(c){c.show()}},CLASS_NAME:"Eniro.SendErrorReportDialog"});Eniro.SendMailDialog=OpenLayers.Class(Eniro.Dialog,{TEXTAREA_MAX_LENGTH:300,initialize:function(a){Eniro.Dialog.prototype.initialize.apply(this,arguments);this.submitFunction=a},draw:function(){Eniro.Dialog.prototype.draw.apply(this,arguments);this.addFormElements();return this.div},addFormElements:function(){var a=['<div class="',this.getCssClassName("text"),'">',this.i18n("text"),"</div>"].join("").toDomElement();var f=['<form class="',this.getCssClassName("form"),'" action="" method="get"></form>'].join("").toDomElement();var d=["<fieldset>","<legend>","<string>",this.i18n("recipient"),"</string>","</legend>","<dl>","<dt>",'<label for="recipient-message">',this.i18n("recipient-message"),'<span class="',this.getCssClassName("info"),'">',this.i18n("info-message"),"</span>","</label>","</dt>","<dd>","<div>",'<textarea id="recipient-message" class="',this.getCssClassName("message"),'" rows="3" cols="30" name="recipient-message"></textarea>',"</div>",'<span class="',this.getCssClassName("error"),'">',this.i18n("error-nomessage"),"</span>","</dd>","</dl>","<dl>","<dt>",'<label for="recipient-mail">',this.i18n("recipient-mail"),"</label>","</dt>","<dd>","<div>",'<input id="recipient-mail" class="',this.getCssClassName("text"),'" type="text" name="recipient-mail"/>',"</div>",'<span class="',this.getCssClassName("help"),'">',this.i18n("help-recipients"),"</span>",'<span class="',this.getCssClassName("error"),'">',this.i18n("error-noaddress"),"</span>","</dd>","</dl>","</fieldset>"].join("").toDomElement();var b=["<fieldset>","<legend>","<string>",this.i18n("sender"),"</string>","</legend>","<dl>","<dt>",'<label for="sender-name">',this.i18n("sender-name"),"</label>","</dt>","<dd>","<div>",'<input id="sender-name" class="',this.getCssClassName("text"),'" type="text" name="sender-name"/>',"</div>",'<span class="',this.getCssClassName("error"),'">',this.i18n("error-noname"),"</span>","</dd>","</dl>","<dl>","<dt>",'<label for="sender-mail">',this.i18n("sender-mail"),"</label>","</dt>","<dd>","<div>",'<input id="sender-mail" class="',this.getCssClassName("text"),'" type="text" name="sender-mail"/>',"</div>",'<span class="',this.getCssClassName("error"),'">',this.i18n("error-noaddress"),"</span>","</dd>","</dl>","<dl>","<dd>",'<span class="',this.getCssClassName("error"),'">',this.i18n("error-mail"),"</span>","</dd>","</dl>","</fieldset>"].join("").toDomElement();var c=['<button type="submit" class="eniro-button ',this.getCssClassName("submit"),'">',"<span>",this.i18n("send"),"</span>","</button>"].join("").toDomElement();this.div.appendChild(a);this.div.appendChild(f);f.appendChild(d);f.appendChild(b);f.appendChild(c);this.observe(c,"click",this.onSubmit)},onSubmit:function(){var a=jQuery(this.div).find("input[type=text], textarea:first");var h=jQuery(this.div).find("textarea:first");var b;var d={};for(var c=0,k=a.length;c<k;c++){var g=jQuery(a[c]).parent().siblings("span[class$=error]:first");if(g){if(a[c].value.length&&(a[c].type!=="textarea"||(a[c].type==="textarea"&&a[c].value.length<=this.TEXTAREA_MAX_LENGTH))){g.hide();d[a[c].id.camelize()]=a[c].value}else{g.show();b=true}}}var f=jQuery(this.div).find("span[class$=error]:last");if(f){f.hide()}if(!b){this.submitFunction(d)}},clearForm:function(){var a=jQuery(this.div).find("input[type=text], textarea:first");for(var b=0,f=a.length;b<f;b++){var d=jQuery(a[b]).parent().siblings("span[class$=error]:first");if(d){a[b].value="";d.hide()}}var c=jQuery(this.div).find("span[class$=error]:last");if(c){c.hide()}},displayError:function(g){var a=jQuery(this.div).find("input[type=text], textarea:first");for(var b=0,f=a.length;b<f;b++){var d=jQuery(a[b]).parent().siblings("span[class$=error]:first");if(d&&a[b].id.camelize()==g){d.show();return}}var c=jQuery(this.div).find("span[class$=error]:last");if(c){c.show()}},CLASS_NAME:"Eniro.SendMailDialog"});Eniro.SendSmsDialog=OpenLayers.Class(Eniro.Dialog,{initialize:function(a){Eniro.Dialog.prototype.initialize.apply(this,arguments);this.submitFunction=a},draw:function(){Eniro.Dialog.prototype.draw.apply(this,arguments);this.addFormElements();return this.div},addFormElements:function(){var a=['<div class="',this.getCssClassName("text"),'">',this.i18n("text"),"</div>"].join("").toDomElement();var d=['<form class="',this.getCssClassName("form"),'" action="" method="get"></form>'].join("").toDomElement();var c=["<fieldset>","<legend>","<string></string>","</legend>","<dl>","<dt>",'<label for="recipient-number">',this.i18n("recipient-number"),"</label>","</dt>","<dd>","<div>",'<input id="recipient-cell" class="',this.getCssClassName("text"),'" type="text" name="recipient-cell"/>',"</div>",'<span class="',this.getCssClassName("info"),'">',this.i18n("info"),"</span>",'<span class="',this.getCssClassName("error"),'">',this.i18n("error-number"),"</span>",'<span class="',this.getCssClassName("sent"),'">',this.i18n("message-sent"),"</span>","</dd>","</dl>","</fieldset>"].join("").toDomElement();var b=['<button type="button" class="eniro-button ',this.getCssClassName("submit"),'">',"<span>",this.i18n("send"),"</span>","</button>"].join("").toDomElement();this.div.appendChild(a);this.div.appendChild(d);d.appendChild(c);d.appendChild(b);this.observe(b,"click",this.onSubmit);this.observe(d,"submit",this.onSubmit)},onSubmit:function(c){OpenLayers.Event.stop(c);var a=jQuery(this.div).find("input[type=text]:first")[0];var b=jQuery(a).parent().siblings("span[class$=error]:first");if(a.value&&a.value.match(/^(((\+\d{2,3})?\d{8,9})|\d{8,13})$/)){b.hide();this.submitFunction(a.value)}else{b.show()}},displaySpan:function(a,c){var b=jQuery(this.div).find("span[class$="+a+"]:last");if(b){if(c){jQuery(b).html(c)}b.show()}},clearForm:function(){var a=jQuery(this.div).find("input[type=text]");for(var b=0,f=a.length;b<f;b++){var c=jQuery(a[b]).parent().siblings("span[class$=error]:first");if(c){a[b].value="";c.hide()}}var d=jQuery(this.div).find("span[class$=sent]:last");if(d){d.hide()}},CLASS_NAME:"Eniro.SendSmsDialog"});Eniro.ShareDialog=OpenLayers.Class(Eniro.Dialog,{links:[{id:"facebook",url:"http://www.facebook.com/sharer.php?u=${url}&t=${title}"},{id:"myspace",url:"http://www.myspace.com/index.cfm?fuseaction=postto&t=${title}&u=${url}"},{id:"twitter",url:"http://twitter.com/home?status=${title}: ${url}"},{id:"delicious",url:"http://delicious.com/save?url=${url}&title=${title}"}],url:null,initialize:function(){Eniro.Dialog.prototype.initialize.apply(this,arguments)},draw:function(){Eniro.Dialog.prototype.draw.apply(this,arguments);var b=['<div class="',this.getCssClassName("text"),'">',this.i18n("text"),"</div>"].join("").toDomElement();var a=['<ul class="',this.getCssClassName("container"),'">'];for(var c=0,f=this.links.length;c<f;c++){var d=this.links[c];a.push(['<li class="',this.getSingleCssClassName("logo")," ",this.getSingleCssClassName(d.id),'">','<a href="/'+new Date().getTime()+'">',"<span>",d.id.substring(0,1).toUpperCase(),d.id.substring(1,d.id.length),"</span>","</a>","</li>"].join(""))}a.push("</ul>");this.div.appendChild(b);this.div.appendChild(a.join("").toDomElement());return this.div},onClick:function(a){OpenLayers.Event.stop(a);var d=OpenLayers.Event.element(a);if(this.url){for(var c=0,g=this.links.length;c<g;c++){var f=this.links[c];if(jQuery(d).closest("."+this.getSingleCssClassName(f.id))[0]){var b=f.url.replace("${url}",this.url).replace("${title}",encodeURIComponent(document.title));window.open(b);break}}}return false},setUrl:function(b){var a=window.location.href;var c=a.indexOf("/",10);a=a.substring(0,c);a+="/m/"+b+window.location.search;this.url=a},CLASS_NAME:"Eniro.ShareDialog"});Eniro.LinkDialog=OpenLayers.Class(Eniro.Dialog,{caption:null,initialize:function(){Eniro.Dialog.prototype.initialize.apply(this,arguments)},draw:function(){Eniro.Dialog.prototype.draw.apply(this,arguments);jQuery(this.div).html(this.i18n("text"));this.cssClasses.linkDiv=this.getCssClassName("link");this.cssClasses.errorDiv=this.getCssClassName("error");jQuery(this.div).append('<div class="'+this.cssClasses.linkDiv+'"/>');if(jQuery.browser.msie){var a=['<button class="eniro-button" type="submit">',"<span>",this.i18n("submit"),"</span>","</button>"].join("").toDomElement();this.div.appendChild(a);this.observe(a,"click",this.copyToClipboard)}return this.div},setContents:function(b){var c=jQuery(this.div).find("."+this.cssClasses.linkDiv)[0];if(c){var a=[window.location.protocol,"//",window.location.host,"/m/",b].join("");jQuery(c).html(a)}},setError:function(f){if(f.length){var b=["<strong>",OpenLayers.i18n("state.error.title"),"</strong>","<ol>"];for(var c=0,d=f.length;c<d;c++){b.push(["<li>",f[c],"</li>"].join(""))}b.push("</ol>");var a=['<div class="',this.cssClasses.errorDiv,'">',b.join(""),"</div>"].join("");jQuery(this.div).append(a)}},clearError:function(){var a=jQuery(this.div).find("."+this.cssClasses.errorDiv)[0];if(a){jQuery(a).remove()}},copyToClipboard:function(a){Eniro.Util.copyToClipboard(jQuery(this.div).find("."+this.cssClasses.linkDiv+":first").html())},CLASS_NAME:"Eniro.LinkDialog"});Eniro.MapStateDialog=OpenLayers.Class(Eniro.Dialog,{caption:null,initialize:function(){Eniro.Dialog.prototype.initialize.apply(this,arguments)},draw:function(){Eniro.Dialog.prototype.draw.apply(this,arguments);jQuery(this.div).html(this.i18n("text"));this.cssClasses.coordinatesDiv=this.getCssClassName("coordinates");this.cssClasses.errorDiv=this.getCssClassName("error");jQuery(this.div).append('<div class="'+this.cssClasses.coordinatesDiv+'"/>');if(jQuery.browser.msie){var a=['<button class="eniro-button" type="submit">',"<span>",this.i18n("submit"),"</span>","</button>"].join("").toDomElement();this.div.appendChild(a);this.observe(a,"click",this.copyToClipboard)}return this.div},setCoordinates:function(a){jQuery(this.div).find("."+this.cssClasses.coordinatesDiv+":first").html(a)},copyToClipboard:function(a){Eniro.Util.copyToClipboard(jQuery(this.div).find("."+this.cssClasses.coordinatesDiv+":first").html())},CLASS_NAME:"Eniro.MapStateDialog"});Eniro.RightClickHandler=OpenLayers.Class(Eniro.Control,{lonlat:null,position:null,defaultPosition:new OpenLayers.Pixel(0,0),lastDown:null,offsetX:3,offsetY:3,initialize:function(){Eniro.Control.prototype.initialize.apply(this,arguments);this.div=true;this.menu=new Eniro.Menu(true);var a=[{id:"set-start-point",value:this.i18n("set-start-point"),execute:function(){this.triggerEvent(Eniro.Events.ROUTE_SET_START,{lonlat:this.lonlat});this.hideContextMenu();return false}},{id:"set-end-point",value:this.i18n("set-end-point"),execute:function(){this.triggerEvent(Eniro.Events.ROUTE_SET_END,{lonlat:this.lonlat});this.hideContextMenu();return false}},{id:"set-via-point",value:this.i18n("set-via-point"),execute:function(){this.triggerEvent(Eniro.Events.ROUTE_SET_VIA,{lonlat:this.lonlat});this.hideContextMenu();return false}},{id:"search",value:this.i18n("search"),delimiter:true,execute:function(){this.triggerEvent(Eniro.Events.MODE_SWITCH,{mode:"search"});this.hideContextMenu();return false}},{id:"route",value:this.i18n("route"),delimiter:true,execute:function(){this.triggerEvent(Eniro.Events.MODE_SWITCH,{mode:"route"});this.hideContextMenu();return false}},{id:"draw",value:this.i18n("draw"),delimiter:true,execute:function(){this.triggerEvent(Eniro.Events.MODE_SWITCH,{mode:"draw"});this.hideContextMenu();return false}},{id:"zoomin",value:this.i18n("zoom-in"),delimiter:true,execute:function(){this.triggerEvent(Eniro.Events.SET_CENTER,{lonlat:this.lonlat.transform(this.map.backendProjection,this.map.getProjectionObject()),zoomLevel:this.map.getZoom()+1});this.hideContextMenu();return false}},{id:"zoomout",value:this.i18n("zoom-out"),execute:function(){this.map.zoomTo(this.map.getZoom()-1);this.hideContextMenu();return false}},{id:"gps",value:this.i18n("gps"),execute:function(){var d=this.map.getControl(Eniro.ControlID.GPS);d.activate();d.updatePosition(this.lonlat.transform(this.map.backendProjection,this.map.getProjectionObject()));this.hideContextMenu();return false}}];for(var b=0,c=a.length;b<c;++b){a[b].execute=OpenLayers.Function.bind(a[b].execute,this);this.menu.addItem(new Eniro.MenuItem(a[b]))}this.register(Eniro.Events.MODE_SWITCH,this.onModeSwitch);this.register(Eniro.Events.ROUTE_GEOMETRY_AVAILABLE,this.onRouteGeometryAvailable);this.register(Eniro.Events.ROUTE_MARKERS_CLEARED,this.onRouteMarkersCleared);this.register(Eniro.Events.DRAW_DISTANCE_START,this.deactivate);this.register(Eniro.Events.DRAW_DISTANCE_END,this.activate)},destroy:function(){this.unregister(Eniro.Events.ROUTE_GEOMETRY_AVAILABLE,this.onRouteGeometryAvailable);this.unregister(Eniro.Events.ROUTE_MARKERS_CLEARED,this.onRouteMarkersCleared);this.unregister(Eniro.Events.DRAW_DISTANCE_START,this.deactivate);this.unregister(Eniro.Events.DRAW_DISTANCE_END,this.activate);Eniro.Control.prototype.destroy.apply(this,arguments)},activate:function(){if(Eniro.Control.prototype.activate.apply(this,arguments)){if(this.menu.activate()){this.menu.getItemById("set-via-point").deactivate()}return true}return false},registerObservers:function(){Eniro.Control.prototype.registerObservers.apply(this,arguments);this.observe(this.map.div,"contextmenu",OpenLayers.Event.stop);this.observe(this.map.containerDiv,"contextmenu",this.hideContextMenu);this.map.events.registerPriority("mousedown",this,this.onMouseDown);this.map.events.registerPriority("mouseup",this,this.onMouseUp);this.observe(this.div,"mouseout",this.onMouseOut)},onMouseDown:function(a){this.lastDown=null;this.mouseout=false;var b=OpenLayers.Event.element(a);while((b!=this.map.viewPortDiv&&b!=this.div)&&(b.nodeName&&b.nodeName.toLowerCase()!="body")){b=b.parentNode}if(b===this.map.viewPortDiv){var c=this.map.getCurrentMode();if(c!="oblique"&&c!="streetview"&&OpenLayers.Event.isRightClick(a)||(jQuery.browser.safari&&a.ctrlKey)){this.lastDown=a.xy;this.lonlat=this.map.getLonLatFromPixel(this.lastDown);this.lonlat.transform(this.map.baseLayer.projection,this.map.backendProjection);this.showContextMenu()}else{this.hideContextMenu()}}else{if(b===this.div&&OpenLayers.Event.isRightClick(a)){this.menu.onClick(a)}}return true},onMouseUp:function(a){if(this.lastDown){if(this.lastDown.x!==a.xy.x&&this.lastDown.y!==a.xy.y){this.menu.onClick(a);this.hideContextMenu()}this.lastDown=null}return true},onMouseOut:function(a){this.mouseout=Eniro.Util.mouseLeft(a,this.div);return true},onModeSwitch:function(f){var b=[this.menu.getItemById("search"),this.menu.getItemById("route"),this.menu.getItemById("draw")];var a=false;var d;for(var c=0,g=b.length;c<g;++c){d=b[c];d.delimiter=false;d.deactivate();if(f.mode!==d.id){if(!a){b[c].delimiter=true;a=true}b[c].activate()}}if(f&&(f.mode==="oblique"||f.mode==="streetview")){this.hideContextMenu()}},onRouteGeometryAvailable:function(){this.menu.getItemById("set-via-point").activate()},onRouteMarkersCleared:function(){this.menu.getItemById("set-via-point").deactivate()},showContextMenu:function(c){c=c?c.clone():this.lastDown;var d=jQuery(this.div).outerWidth();var b=jQuery(this.div).outerHeight();var a=((c.x+d)>this.map.getSize().w)?-d-this.offsetX:this.offsetX;var f=((c.y+b)>this.map.getAdjustedSize().h?-b-this.offsetY:this.offsetY);this.moveTo(c.add(a,f));jQuery(this.div).show()},hideContextMenu:function(){this.moveTo(this.defaultPosition);jQuery(this.div).hide()},hideViaMenuItem:function(){this.menuItems["set-end-point"].setViaInsteadOfEnd=false;jQuery(this.menuItems["set-end-point"].div).find("span").text(this.i18n("set-end-point"));OpenLayers.Element.show(this.menuItems["set-start-point"].div)},draw:function(){this.div=this.createDiv();this.div.appendChild(this.menu.draw());this.map.containerDiv.insertBefore(this.div,this.map.div);return Eniro.Control.prototype.draw.apply(this,arguments)},CLASS_NAME:"Eniro.RightClickHandler"});Eniro.PoiController=OpenLayers.Class(Eniro.Control,{tfs:{layer:undefined,currentLayerName:undefined},activeLayerNames:{},map:undefined,poi:null,datastore:null,currentMouseOverKey:null,currentDrawnKey:null,dpp:null,select:undefined,zoomlevel:undefined,previouszoomlevel:undefined,debug:false,isMoving:false,initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.datastore=[];this.map=Eniro.map;this.degreePerPixel();this.register(Eniro.Events.POI_LAYER_ACTIVATE,this.onPoiLayerActivate);this.register(Eniro.Events.POI_LAYER_DEACTIVATE,this.onPoiLayerDeactivate);this.register(Eniro.Events.POI_DATASTORE_REGION,this.onPoiDatastoreRegion);this.debug=window.location.toString().indexOf("poiDebug")>0},destroy:function(){this.destroyDatastore();this.unregister(Eniro.Events.POI_LAYER_ACTIVATE,this.onPoiLayerActivate);this.unregister(Eniro.Events.POI_LAYER_DEACTIVATE,this.onPoiLayerDeactivate);this.unregister(Eniro.Events.POI_DATASTORE_REGION,this.onPoiDatastoreRegion);this.map.events.unregister("zoomend",this,this.onZoomEnd);this.map.wfs.events.unregister("click",this,this.onPoiLayerMouseClick);this.map.events.unregister("movestart",this,this.onMoveStart);this.map.events.unregister("moveend",this,this.onMoveEnd);Eniro.Control.prototype.destroy.apply(this,arguments)},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments)},onPoiLayerMouseClick:function(a){var d=this.getFeatureIdFromEvent(a);if(d){var b=this.map.wfs.features[d];if(b.attributes.total){Eniro.AppEvents.triggerEvent(Eniro.Events.POI_CLUSTER_CLICK,b)}else{var f=b.attributes.id;var c=this.datastore[this.currentDrawnKey].tile;jQuery.jsonp({url:Eniro.AppNode.appUrl("geowebcache/service/wfs?version=1.1.0&request=GetFeature&featureId="+f+"&outputFormat=json"),callbackParameter:"callback",success:OpenLayers.Function.bind(this.onPoiQuerySuccess,{controller:this,feature:b}),error:OpenLayers.Function.bind(this.onPoiQueryFailure,this),dataFilter:function(g){return JSON.parse(JSON.stringify(g))}})}}},getFeatureIdFromEvent:function(a){var c=new OpenLayers.Pixel(a.layerX,a.layerY);var k=this.map.getLonLatFromPixel(c);var b=this.map.getResolution();var h=new OpenLayers.Bounds(k.lon-b*5,k.lat-b*5,k.lon+b*5,k.lat+b*5);var d=h.toGeometry();var g="zoomlevel"+this.zoomlevel;for(var f in this.map.wfs.features){if(!this.map.wfs.features.hasOwnProperty(f)){continue}if(this.map.wfs.features[f].attributes.type==g){continue}if(this.map.wfs.features[f].geometry.intersects(d)){return f}}return null},onPoiQuerySuccess:function(b,a){Eniro.AppEvents.triggerEvent(Eniro.Events.POI_CLICK,{data:b,feature:this.feature})},onPoiQueryFailure:function(b,a){},getPoiLayerTile:function(b){var d=this.map.baseLayer.getTileBounds(b.xy);var c=this.map.getResolution();var a=Math.round((d.left-this.map.layers[0].tileOrigin.lon)/(c*this.map.layers[0].tileSize.w));var g=Math.round((d.bottom-this.map.layers[0].tileOrigin.lat)/(c*this.map.layers[0].tileSize.h));var f=this.serverResolutions!==null?OpenLayers.Util.indexOf(this.serverResolutions,c):this.map.getZoom();return{x:a,y:g,z:f}},onPoiLayerDeactivate:function(c){var a="poi_"+c.layername;var b=this.map.getLayersByName(a)[0];if(b){b.setVisibility(false)}this.activeLayerNames[c.layername]=false;this.updateTFSLayer()},onPoiLayerActivate:function(c){var a="poi_"+c.layername;var b=this.map.getLayersByName(a)[0];if(b){b.setVisibility(true)}else{b=new OpenLayers.Layer.TMS(a,Eniro.AppNode.appUrl("/geowebcache/service/tms"),{layername:c.layername,buffer:0,type:"png",isBaseLayer:false,visibility:true});this.map.addLayer(b)}this.previouszoomlevel=this.zoomlevel;this.zoomlevel=this.map.getZoom();this.activeLayerNames[c.layername]=true;this.updateTFSLayer()},calculateTFSLayerName:function(){var d=[];for(var c in this.activeLayerNames){if(this.activeLayerNames[c]){d[d.length]=c}}d.sort();var a="";for(var b=0;b<d.length;b++){a+=","+d[b]}return a===""?"":a.substring(1)},updateTFSLayer:function(){var a=this.calculateTFSLayerName();this.tfs.layer=this.map.getLayersByName("poitfs")[0];if(a!=this.tfs.currentLayerName){if(this.tfs.layer){this.map.removeLayer(this.tfs.layer);delete this.tfs.layer;this.tfs.layer=null;this.destroyDatastore();this.currentDrawnKey=null;this.map.events.unregister("zoomend",this,this.onPoiZoomEnd);this.map.wfs.events.unregister("click",this,this.onPoiLayerMouseClick);this.map.events.unregister("movestart",this,this.onMoveStart);this.map.events.unregister("moveend",this,this.onMoveEnd)}if(a.length>0){this.tfs.layer=new Eniro.PoiWFSGrid("poitfs",Eniro.AppNode.appUrl("/geowebcache/service/tfs1.0.0"),{layername:a,buffer:0,type:"json",isBaseLayer:false,visibility:true});this.map.addLayer(this.tfs.layer);this.map.events.register("zoomend",this,this.onPoiZoomEnd);this.map.wfs.events.register("click",this,this.onPoiLayerMouseClick);this.map.events.register("movestart",this,this.onMoveStart);this.map.events.register("moveend",this,this.onMoveEnd)}this.tfs.currentLayerName=a}},onPoiZoomEnd:function(a){this.previouszoomlevel=this.zoomlevel;this.zoomlevel=this.map.getZoom();this.resetPoiRegion(this.previouszoomlevel)},onMoveStart:function(a){if(this.currentDrawnKey){this.removeFeatures(this.currentDrawnKey)}this.isMoving=true},onMoveEnd:function(a){if(this.currentDrawnKey){this.addFeatures(this.currentDrawnKey)}this.isMoving=false},resetPoiRegion:function(b){b="zoomlevel"+b;var f,d;for(var a=0;a<20;a++){f=this.map.wfs.features;for(var c=0;c<f.length;c++){d=f[c];if(d.attributes.type==b){this.map.wfs.destroyFeatures(d)}}}},onPoiSelect:function(a){},getURL:function(f){var c=f.tile.bounds;var b=this.map.getResolution();var a=f.tile.layer;f.tile.x=Math.round((c.left-a.tileOrigin.lon)/(b*a.tileSize.w));f.tile.y=Math.round((c.bottom-a.tileOrigin.lat)/(b*a.tileSize.h));f.tile.z=this.map.getZoom();var d="/"+a.layername+"/"+f.tile.z+"/"+f.tile.x+"/"+f.tile.y+"."+a.type+"?srsName=EPSG:900913&propertyname=the_geom";f.tile.url=a.url+d;return f},onPoiDatastoreRegion:function(b){b=this.getURL(b);var a="x"+b.tile.x+"y"+b.tile.y+"z"+b.tile.z;if(!this.datastore[a]){this.datastore[a]={tile:b.tile,region:undefined,features:undefined,loadRequested:false};this.createPoiRegion(a)}},createPoiRegion:function(a){this.datastore[a].region=new Eniro.Feature.Vector(this.datastore[a].tile.bounds.toGeometry(),{type:"zoomlevel"+this.datastore[a].tile.z},{style:OpenLayers.Util.extend(OpenLayers.Feature.Vector.style["default"],{fillColor:"red",fillOpacity:this.debug?0.2:0,stroke:this.debug,strokeColor:"gray",graphicName:"square",rotation:0,pointRadius:15,cursor:"default"})});this.datastore[a].region.events.register("mouseover",{controller:this,key:a},function(c){this.controller.currentMouseOverKey=this.key;var f=this.controller.datastore[this.key];var d=f.features;var b=f.loadRequested;if(this.key!=this.controller.currentDrawnKey){if(!d&&!b){f.loadRequested=true;jQuery.jsonp({url:this.controller.datastore[this.key].tile.url,data:{},callbackParameter:"callback",success:OpenLayers.Function.bind(this.controller.onPoiDataQuerySuccess,{controller:this.controller,key:this.key}),error:OpenLayers.Function.bind(this.controller.onPoiDataQueryFailure,this.controller),dataFilter:function(g){return JSON.parse(JSON.stringify(g))}})}else{if(this.controller.currentDrawnKey!=this.key){if(!this.controller.isMoving){this.controller.removeFeatures(this.controller.currentDrawnKey);this.controller.addFeatures(this.key)}this.controller.currentDrawnKey=this.key}}}});this.map.wfs.addFeatures(this.datastore[a].region)},removeFeatures:function(a){if(!this.datastore[a]){return}var b=this.datastore[a].features;if(!b){return}this.map.wfs.removeFeatures(b)},removeRegion:function(a){if(!this.datastore[a]){return}var b=this.datastore[a].region;if(!b){return}this.map.wfs.removeFeatures(b)},destroyDatastore:function(){for(var a in this.datastore){this.removeFeatures(a);if(this.datastore[a].region){this.datastore[a].region.events.unregister("mouseover");this.removeRegion(a)}}delete this.datastore;this.datastore=[]},addFeatures:function(a){if(!this.datastore[a]){return}var b=this.datastore[a].features;if(!b){return}this.map.wfs.addFeatures(b)},onPoiDataQuerySuccess:function(d,b){var a=this.controller;var c=this.key;a.onPoiDataQuerySuccess_f.apply(a,[d,b,c])},onPoiDataQuerySuccess_f:function(p,l,t){var a=p;this.degreePerPixel();var f=[];var q,u,c,v,s,o,h,g;var b=OpenLayers.Util.extend(OpenLayers.Feature.Vector.style["default"],{fillColor:"red",fillOpacity:this.debug?0.5:0,stroke:false,graphicName:"square",rotation:0,pointRadius:15,cursor:"pointer"});var d=this.datastore[t].tile.layer.layername;for(o=0;o<a.map.length;o++){for(h=0;h<a.map[o].length;h++){v=a.map[o][h];if(!v){continue}for(g=0;g<v.length;g++){s=v[g];if(s){q=s.geometry.coordinates;u=s.bbox;c=s.id;var r=s.total;bounds=new OpenLayers.Bounds.fromArray([(q[0]+(u[0]*this.dpp.lat)),(q[1]+(u[1]*this.dpp.lon)),(q[0]+(u[2]*this.dpp.lat)),(q[1]+(u[3]*this.dpp.lon))]);f.push(new Eniro.Feature.Vector(bounds.toGeometry(),{id:c,total:r,type:d},{style:b}))}}}}this.datastore[t].features=f;if(t==this.currentMouseOverKey){if(!this.isMoving){this.removeFeatures(this.currentDrawnKey);this.addFeatures(t)}this.currentDrawnKey=t}},onPoiDataQueryFailure:function(b,a){this.key=null},degreePerPixel:function(){var a=new OpenLayers.Bounds();a.extend(this.map.getCenter());a.extend(this.map.getCenter().clone().add(this.map.getResolution(),this.map.getResolution()));this.dpp={lat:(a.top-a.bottom),lon:(a.right-a.left)}},CLASS_NAME:"Eniro.PoiController"});Eniro.Feature.PoiMarker=OpenLayers.Class(Eniro.Feature.PopupFeature,{draggable:false,lastGeometry:null,popupContentsZoom:function(b){var a=['<span class="route-popup-index"></span> <span class="route-popup-desc">'];a.push("Det finns <b>"+b.attributes.total+"</b> träffar i det här området.<br/>");this.lastGeometry=b.geometry;a.push("<br/>");a.push('<a class="poi-zoom" href="/'+new Date().getTime()+'">Zooma</a>');a.push("</span>");return a.join("")},popupContents:function(c){var a=['<span class="route-popup-index"></span> <span class="route-popup-desc">'];var f=(c.desc)?c.desc.split(" "):"";var b="";for(var d=0,g=f.length;d<g;++d){if(b.length<60){if(d>0){b+=" "}b+=f[d]}else{a.push('<span class="route-popup-desc-part">'+b+"</span>");b=f[d]}}b="The content of the PoiMarker goes here...";a.push('<span class="route-popup-desc-part">'+b+"</span>");a.push("</span>");if(c.sarDesc){a.push('<span class="route-popup-event">'+c.sarDesc+"</span>")}return a.join("")},initialize:function(c,a){a=a||{};var b={style:{graphic:false,fill:false}};Eniro.Feature.PopupFeature.prototype.initialize.apply(this,[c,a,b])},onPopupClick:function(a){var b=OpenLayers.Event.element(a);if(b.className=="poi-zoom"){Eniro.AppEvents.triggerEvent(Eniro.Events.POI_POPUP_ZOOM,this.lastGeometry.getBounds())}},onPopupCloseButton:function(){Eniro.Feature.PopupFeature.prototype.onPopupCloseButton.apply(this,arguments);Eniro.AppEvents.triggerEvent(Eniro.Events.POI_POPUP_CLOSE)},openPopup:function(){Eniro.Feature.PopupFeature.prototype.openPopup.apply(this,arguments);OpenLayers.Event.observe(this.popup.contentDiv,"click",OpenLayers.Function.bind(this.onPopupClick,this))},closePopup:function(){if(this.popup!==null){this.popup.map.removePopup(this.popup);this.popup=null;this.stopTimer()}},CLASS_NAME:"Eniro.Feature.PoiMarker"});Eniro.PoiMarkersView=OpenLayers.Class(Eniro.Control,{poiActiveMarker:null,initialize:function(a){Eniro.Control.prototype.initialize.apply(this,[a]);this.register(Eniro.Events.POI_CLICK,this.onPoiClick);this.register(Eniro.Events.POI_CLUSTER_CLICK,this.onPoiClusterClick);this.register(Eniro.Events.POI_POPUP_CLOSE,this.onPoiPopupClose);this.register(Eniro.Events.POI_POPUP_ZOOM,this.onPoiPopupZoom)},destroy:function(){this.unregister(Eniro.Events.POI_CLICK,this.onPoiClick);this.unregister(Eniro.Events.POI_CLUSTER_CLICK,this.onPoiClusterClick);this.unregister(Eniro.Events.POI_POPUP_CLOSE,this.onPoiPopupClose);this.unregister(Eniro.Events.POI_POPUP_ZOOM,this.onPoiPopupZoom);Eniro.Control.prototype.destroy.apply(this,arguments)},onPoiClusterClick:function(a){if(this.poiActiveMarker){this.removeMarker()}this.poiActiveMarker=new Eniro.Feature.PoiMarker(a.geometry);this.map.wfs.addFeatures(this.poiActiveMarker);if(!this.poiActiveMarker.popup){this.poiActiveMarker.openPopup()}this.poiActiveMarker.popup.setContentHTML(this.poiActiveMarker.popupContentsZoom(a))},onPoiClick:function(a){if(this.poiActiveMarker){this.removeMarker()}this.poiActiveMarker=new Eniro.Feature.PoiMarker(a.feature.geometry);this.map.wfs.addFeatures(this.poiActiveMarker);this.poiActiveMarker.attributes=a.feature.attributes;this.poiActiveMarker.data=a.data;this.poiActiveMarker.style.display="";if(!this.poiActiveMarker.popup){this.poiActiveMarker.openPopup()}this.poiActiveMarker.popup.setContentHTML(this.poiActiveMarker.popupContents(a.data))},onPoiPopupClose:function(){this.removeMarker()},onPoiPopupZoom:function(a){this.removeMarker();this.map.zoomToExtent(a,true)},removeMarker:function(){if(this.poiActiveMarker){if(this.poiActiveMarker.popup){this.poiActiveMarker.closePopup()}this.poiActiveMarker.hide();this.map.wfs.destroyFeatures(this.poiActiveMarker,{});delete this.poiActiveMarker;this.poiActiveMarker=null}},CLASS_NAME:"Eniro.PoiMarkersView"});Eniro.PoiWFSGrid=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:false,tileSize:new OpenLayers.Size(256,256),buffer:0,layername:undefined,type:"json",x:undefined,y:undefined,z:undefined,tileOrigin:null,url:undefined,initialize:function(d,c,b){this.layername=d;this.url=c;var a=[];a.push(d,c,{},b);OpenLayers.Layer.Grid.prototype.initialize.apply(this,a)},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments)},clone:function(a){if(a===null){a=new Eniro.PoiWFSGrid(this.name,this.url,this.options)}a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a]);return a},getURL:function(c){c=this.adjustBounds(c);var b=this.map.getResolution();this.x=Math.round((c.left-this.tileOrigin.lon)/(b*this.tileSize.w));this.y=Math.round((c.bottom-this.tileOrigin.lat)/(b*this.tileSize.h));this.z=this.map.getZoom();var d="/"+this.layername+"/"+this.z+"/"+this.x+"/"+this.y+"."+this.type+"?srsName=EPSG:900913&propertyname=the_geom";var a=this.url;if(a instanceof Array){a=this.selectUrl(d,a)}return a+d},moveTo:function(b,a,c){OpenLayers.Layer.Grid.prototype.moveTo.apply(this,arguments)},addTile:function(b,a){return new Eniro.PoiWFSTile(this,a,b,this.getURL(b),this.tileSize)},setMap:function(a){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:"Eniro.PoiWFSGrid"});Eniro.PoiWFSTile=OpenLayers.Class(OpenLayers.Tile,{features:null,request:null,url:null,bounds:null,x:undefined,y:undefined,z:undefined,initialize:function(d,a,f,b,c){OpenLayers.Tile.prototype.initialize.apply(this,arguments);this.url=b;this.x=this.layer.x;this.y=this.layer.y;this.z=this.layer.z;this.features=[]},destroy:function(){OpenLayers.Tile.prototype.destroy.apply(this,arguments);this.destroyAllFeatures();this.features=null;this.request=null;this.url=null},clear:function(){this.destroyAllFeatures()},draw:function(){if(OpenLayers.Tile.prototype.draw.apply(this,arguments)){if(this.isLoading){this.events.triggerEvent("reload")}else{this.isLoading=true;this.events.triggerEvent("loadstart")}this.loadFeaturesForRegion(this.requestSuccess)}},loadFeaturesForRegion:function(b,a){Eniro.AppEvents.triggerEvent(Eniro.Events.POI_DATASTORE_REGION,{success:b,failure:a,tile:this})},requestSuccess:function(a){if(this.events){this.events.triggerEvent("loadend")}this.request=null},addResults:function(c){for(var b=0;b<c.length;b++){var a=new this.layer.featureClass(this.layer,c[b]);this.features.push(a)}},destroyAllFeatures:function(){while(this.features.length>0){var a=this.features.shift();a.destroy()}},CLASS_NAME:"Eniro.PoiWFSTile"});Eniro.Constant.MarkerTypes=Eniro.Constant.MarkerTypes||{};Eniro.Constant.MarkerTypes.YELLOW="yellowMarker";Eniro.Constant.MarkerTypes.ADDRESS="addressMarker";Eniro.Constant.MarkerTypes.PERSON="personMarker";Eniro.Constant.MarkerTypes.ROUTE="routeMarker";Eniro.Constant.MarkerTypes.POI="poiMarker";Eniro.Constant.MarkerTypes.fromProvider=function(a){return Eniro.Constant.MarkerTypes.ByProvider[a]};Eniro.Constant.MarkerTypes.ByProvider={geo_se:Eniro.Constant.MarkerTypes.ADDRESS,geo_no:Eniro.Constant.MarkerTypes.ADDRESS,yp_se:Eniro.Constant.MarkerTypes.YELLOW,yp_no:Eniro.Constant.MarkerTypes.YELLOW,wp_se:Eniro.Constant.MarkerTypes.PERSON,wp_no:Eniro.Constant.MarkerTypes.PERSON};Eniro.ObliqueController=OpenLayers.Class(Eniro.Control,{initialized:false,mapstate:undefined,layer:undefined,layername:undefined,map:undefined,searchParams:{},maptypes:null,features:null,geometryStyle:null,inObliqueMode:false,initialize:function(){this.register(Eniro.Events.OBLIQUE_ACTIVATING,this.onObliqueActivating);this.register(Eniro.Events.OBLIQUE_DEACTIVATING,this.onObliqueDeactivating);this.register(Eniro.Events.OBLIQUE_UPDATE,this.onObliqueUpdate);this.register(Eniro.Events.OBLIQUE_LIST_SELECT,this.onObliqueListSelect);this.register(Eniro.Events.OBLIQUE_LAYER_UPDATED,this.onLayerUpdated);this.register(Eniro.Events.OBLIQUE_IMAGE_CHANGING,this.onImageChanging);this.register(Eniro.Events.OBLIQUE_INITIALISING,this.onObliqueInitialising);OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.unregister(Eniro.Events.OBLIQUE_ACTIVATING,this.onObliqueActivating);this.unregister(Eniro.Events.OBLIQUE_DEACTIVATING,this.onObliqueDeactivating);this.unregister(Eniro.Events.OBLIQUE_UPDATE,this.onObliqueUpdate);this.unregister(Eniro.Events.OBLIQUE_LIST_SELECT,this.onObliqueListSelect);this.unregister(Eniro.Events.OBLIQUE_LAYER_UPDATED,this.onLayerUpdated);this.unregister(Eniro.Events.OBLIQUE_IMAGE_CHANGING,this.onImageChanging);this.unregister(Eniro.Events.OBLIQUE_INITIALISING,this.onObliqueInitialising);if(this.overviewmap){this.overviewmap.destroy()}Eniro.Control.prototype.destroy.apply(this,arguments)},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.map=a;this.geometryStyle={graphic:false,fill:true,fillColor:"#fff",stroke:true,strokeColor:"#069",strokeOpacity:0.8,strokeWidth:4};this.map.stateController.register("oblique",20,this);this.layer=this.map.getLayerById(Eniro.Map.LAYER_OBLIQUE)},saveState:function(){if(this.inObliqueMode){var g=undefined;var o=this.layer.searchObj.ob_coord;var l=this.layer.searchObj.ob_pol;var d=o.split(",")[0];var h=o.split(",")[1];var c=l.split(",");var f=this.getMinArrayElement([c[0],c[2],c[4],c[6]]);var p=this.getMaxArrayElement([c[0],c[2],c[4],c[6]]);var b=this.getMinArrayElement([c[1],c[3],c[5],c[7]]);var k=this.getMaxArrayElement([c[1],c[3],c[5],c[7]]);if(f&&p&&b&&k){var q=new OpenLayers.Bounds(f,b,p,k);var a=new OpenLayers.LonLat(d,h);g={center:a.transform(this.map.backendProjection,this.map.projection),_bbox:q,zoom:14}}return{searchObj:this.layer.searchObj,printObj:g}}else{return{}}},applyState:function(a){if(a&&a.searchObj!==undefined&&!this.inObliqueMode){OpenLayers.Console.log([this.CLASS_NAME,"applyState",a]);this.triggerEvent(Eniro.Events.MODE_SWITCH,{mode:"oblique",state:a})}},getMinArrayElement:function(a){var b=false;if(a&&a.length>0){a.sort(function(d,c){return d-c});b=a[0]}return b},getMaxArrayElement:function(b){var a=false;if(b&&b.length>0){b.sort(function(d,c){return c-d});a=b[0]}return a},onLayerUpdated:function(a){jQuery("#mymap").addClass("oblique");this.showSearch(a.data.search)},showSearch:function(f){var b=null;var a=null;var d=null;var h=null;if(this.features!==null){this.map.wfs.removeFeatures(this.features)}if(f){var g=null;for(var c in f){b=f[c].geoJSONResult?f[c].geoJSONResult:false;g=(b&&b.features)?b.features:false;a=(b&&!g&&(b.geometry&&b.geometry.type==="Point"))?b:false;h=(b&&!g&&(b.geometry&&b.geometry.type==="MultiLineString"))?b.geometry.coordinates:false;if(h){this.addGeometry(h)}else{if(a){this.addSingleHit(a,c)}else{if(g){this.addFeatures(g,c)}}}this.features=this.map.wfs.features}}},onImageChanging:function(a){if(this.features!==null){this.map.wfs.removeFeatures(this.features)}},addGeometry:function(k){var h=k?k:null;if(h!==null){var a=[];for(var c=0;c<h.length;c++){var g=h[c];var d=[];for(var b=0;b<g.length;b++){var f=this.layer.obliqueTransformer.worldToPixel(this.layer.obliqueTileInfo,new OpenLayers.LonLat(g[b][0],g[b][1]));d.push(new OpenLayers.Geometry.Point(Math.round(f.lon),Math.round(f.lat)))}a.push(new Eniro.Feature.Vector(new OpenLayers.Geometry.MultiLineString([new OpenLayers.Geometry.LineString(d)]),{},{style:this.geometryStyle}))}this.map.wfs.addFeatures(a)}},addSingleHit:function(b,g){var a=b.geometry.coordinates?b.geometry.coordinates:null;if(a!==null){var f=this.layer.obliqueTransformer.worldToPixel(this.layer.obliqueTileInfo,new OpenLayers.LonLat(a[0],a[1]));var d=b.properties;if(d){OpenLayers.Util.extend(d,{source:g,ordinal:i+1,singleHit:true});var c=new Eniro.Feature.WFSMarker(new OpenLayers.Geometry.Point(f.lon,f.lat),d);this.map.wfs.addFeatures(c)}}},addFeatures:function(b,a){var g=null;var f=null;var c=null;var h=null;var k=false;for(var d=0;d<b.length;d++){var o=(b[d].geometry&&b[d].geometry.type==="Point"&&b[d].geometry.coordinates)?b[d].geometry.coordinates:false;var l=(b[d].geometry&&b[d].geometry.type==="MultiLineString"&&b[d].geometry.coordinates)?b[d].geometry.coordinates:false;if(o){f=this.layer.obliqueTransformer.worldToPixel(this.layer.obliqueTileInfo,new OpenLayers.LonLat(o[0],o[1]));c=b[d].properties;if(c){OpenLayers.Util.extend(c,{source:a,ordinal:d+1});h=new Eniro.Feature.WFSMarker(new OpenLayers.Geometry.Point(f.lon,f.lat),c);this.map.wfs.addFeatures(h)}}else{if(l){this.addGeometry(l)}}}},onObliqueActivating:function(b){this.mapstate=b.state;var a=(this.mapstate&&this.mapstate.marker)?this.mapstate.marker:null;if(!this.overviewmap){this.overviewmap=new Eniro.ObliqueOverviewMap(this);this.layer.overviewMap=this.overviewmap}if(this.overviewmap&&this.overviewmap&&this.overviewmap.div){this.overviewmap.div.style.width="";this.overviewmap.div.style.height=""}this.inObliqueMode=true;this.marker=a;if(Eniro.Profile.sellable&&Eniro.Profile.sellable.obliqueSponsor){this.triggerEvent(Eniro.Events.SPONSOR_AD_ACTIVATE,Eniro.Profile.sellable.obliqueSponsor)}},onObliqueDeactivating:function(a){if(this.overviewmap&&this.overviewmap&&this.overviewmap.div){this.overviewmap.div.style.width=0;this.overviewmap.div.style.height=0}this.marker=null;this.inObliqueMode=false},onObliqueInitialising:function(a){var c=a.data;if(c.maptypes){this.maptypes=c.maptypes}if(!this.initialized){this.initialized=true;Eniro.AppEvents.triggerEvent(Eniro.Events.STATISTICS_LOG,{scope:"content",event:"oblique"})}this.showSearch(c.search);if(this.marker&&this.marker.geometry){var b=new OpenLayers.LonLat(this.marker.geometry.x,this.marker.geometry.y);b.transform(this.map.projection,this.map.backendProjection);b=this.layer.obliqueTransformer.worldToPixel(this.layer.obliqueTileInfo,b);this.marker.move(b)}},onObliqueListSelect:function(a){this.overviewmap.switchOrientationClass("eniro-orientation-south");this.layer.searchObj=this.layer.getSearchObj(a);this.layer.searchObj.zoomLevel=this.MIN_ZOOMLEVEL;this.layer.changeObliqueImage(this.layer.searchObj)},draw:function(){return null},CLASS_NAME:"Eniro.ObliqueController"});Eniro.ObliqueLayerbarButton=OpenLayers.Class(Eniro.Control,{timer:null,timeout:200,cities:[],minimumZoomLevel:6,selected:false,disabled:true,initialize:function(){this.cities=[];Eniro.Control.prototype.initialize.apply(this,arguments)},activate:function(){if(Eniro.Control.prototype.activate.apply(this,arguments)){jQuery(this.layerBarButton).append(this.div);return true}return false},registerObservers:function(){this.observe(this.layerBarButton,"mouseover",this.onMouseOver);this.observe(this.layerBarButton,"mouseout",this.onMouseOut);this.observe(this.layerBarButton,"click",this.onClick)},onMouseOver:function(a){if(this.disabled){this.showList()}if(this.timer){clearTimeout(this.timer)}return true},onMouseOut:function(a){if(Eniro.Util.mouseLeft(a,this.layerBarButton)){this.timer=setTimeout(OpenLayers.Function.bind(this.hideList,this),this.timeout)}return true},onClick:function(a){OpenLayers.Event.stop(a);var d=OpenLayers.Event.element(a);d=jQuery(d).closest("li");if(d.get(0)===this.layerBarButton&&!this.disabled){var f=null;var h=this.map.wfs.params;var c=this.map.getAdjustedExtent();c.transform(this.map.baseLayer.projection,this.map.backendProjection);var g;if(((h.q||h.p)&&h.ap)||(h.id&&h.p)){g={q:h.q?h.q:"",p:h.p?h.p:"",ap:h.ap?h.ap:"",BBOX:c.toBBOX()}}else{g={}}if(h.id){g.id=h.id}f=this.map.getCenter();if(h.q&&this.map.wfs.transientFeatures.length>1){f=this.map.getAdjustedExtent().getCenterLonLat()}f.transform(this.map.baseLayer.projection,this.map.backendProjection);this.triggerEvent(Eniro.Events.STATE_SAVING_MODE_SWITCH,{mode:"oblique",lonlat:f,searchParams:g});return false}var b=jQuery(this.div).find("ul").children().index(d);if(d.size()>0&&b>=0){this.triggerEvent(Eniro.Events.STATE_SAVING_MODE_SWITCH,{mode:"oblique",city:b});return false}return true},showList:function(){jQuery(this.layerBarButton).find("ul").show()},hideList:function(){jQuery(this.layerBarButton).find("ul").hide()},draw:function(){this.div=this.createDiv();var b=['<ul style="display:none;">'];var c=Eniro.Profile.oblique.cities;if(c){for(var a=0,d=c.length;a<d;++a){this.cities.push(c[a]);b.push('<li><a href="/'+new Date().getTime()+'" >'+OpenLayers.i18n("oblique-list."+c[a].id)+"</a></li>")}}b.push("</ul>");jQuery(this.div).append(b.join(""));return this.div},showIfAllowed:function(a){if(a<=this.minimumZoomLevel){return false}return true},CLASS_NAME:"Eniro.ObliqueLayerbarButton"});Eniro.ObliqueSideBar=OpenLayers.Class(Eniro.Control,{initialize:function(){Eniro.Control.prototype.initialize.apply(this,arguments);this.list=new Eniro.ObliqueList({parent:this});if(Eniro.Profile.sellable&&Eniro.Profile.sellable.obliqueSponsor){this.sponsor=new Eniro.SponsorBanner(Eniro.Profile.sellable.obliqueSponsor,null,"oblique",{name:"oblique"})}},destroy:function(){if(this.backLink){this.backLink.parentNode.removeChild(this.backLink)}if(this.sponsor){this.sponsor.destroy()}if(this.list){this.list.destroy()}Eniro.Control.prototype.destroy.apply(this,arguments)},activate:function(){if(Eniro.Control.prototype.activate.apply(this,arguments)){if(this.list){this.list.activate()}if(this.sponsor){this.sponsor.activate()}return true}return false},registerObservers:function(){this.observe(this.div,"click",this.onClick);this.observe(this.backLink,"click",this.onBackLinkClick);this.observe(this.elements.orientation,"mouseover",this.onOrientationMouseOver);this.observe(this.elements.orientation,"mouseout",this.onOrientationMouseOut)},onOrientationMouseOver:function(b){var a=OpenLayers.Event.element(b);this.triggerEvent(Eniro.Events.OBLIQUE_ORIENTATION_MOUSEOVER,{dir:jQuery(a).attr("class")})},onOrientationMouseOut:function(b){var a=OpenLayers.Event.element(b);this.triggerEvent(Eniro.Events.OBLIQUE_ORIENTATION_MOUSEOUT,{dir:jQuery(a).attr("class")})},onBackLinkClick:function(a){var b=OpenLayers.Event.element(a);b=jQuery(b).closest("a").get(0);if(b===this.backLink){OpenLayers.Event.stop(a);this.triggerEvent(Eniro.Events.STATE_SAVING_MODE_SWITCH,{previousMode:true,mode:"oblique"});return false}else{return true}},onClick:function(a){var c=OpenLayers.Event.element(a);var b=jQuery(c).parent()[0];if(b===this.elements.orientation){this.triggerEvent(Eniro.Events.OBLIQUE_ORIENTATION_SWITCH,{orientation:jQuery(c).attr("class")});return false}else{return true}},draw:function(){this.div=this.createDiv();var a=jQuery('<a href="" class="'+this.getCssClassName("backlink")+'"><span>'+this.i18n("back-to-map")+"</span></a>");jQuery(this.map.containerDiv).append(a);this.backLink=a.get(0);if(Eniro.Profile.sellable&&Eniro.Profile.sellable.obliqueSponsor){this.sponsor.setMap(this.map);jQuery(this.map.containerDiv).append(this.sponsor.draw())}this.cssClasses.overviewMap=this.getCssClassName("overviewmap");jQuery(this.div).append('<div class="'+this.cssClasses.overviewMap+'"></div>');this.cssClasses.orientation=this.getCssClassName("orientation");jQuery(this.div).append(['<div class="',this.cssClasses.orientation,'">','<div class="',Eniro.Layer.Oblique.ORIENTATION_NORTH,'" title="',this.i18n("orientation-north"),'"></div>','<div class="',Eniro.Layer.Oblique.ORIENTATION_WEST,'" title="',this.i18n("orientation-west"),'"></div>','<div class="',Eniro.Layer.Oblique.ORIENTATION_EAST,'" title="',this.i18n("orientation-east"),'"></div>','<div class="',Eniro.Layer.Oblique.ORIENTATION_SOUTH,'" title="',this.i18n("orientation-south"),'"></div>',"</div>"].join(""));this.div.appendChild(this.list.draw());return Eniro.Control.prototype.draw.apply(this,arguments)},CLASS_NAME:"Eniro.ObliqueSideBar"});Eniro.ObliqueView=OpenLayers.Class(Eniro.Control,{ignoreHandlers:false,initialize:function(){Eniro.Control.prototype.initialize.apply(this,arguments);this.sidebar=new Eniro.ObliqueSideBar({ignoreHandlers:false});this.div=true},destroy:function(){},activate:function(){if(Eniro.Control.prototype.activate.apply(this,arguments)){this.sidebar.activate();return true}return false},setMap:function(a){Eniro.Control.prototype.setMap.apply(this,arguments);this.sidebar.setMap(a)},draw:function(){this.div=this.createDiv();this.div.appendChild(this.sidebar.draw());this.map.containerDiv.insertBefore(this.div,this.map.div);return this.div},CLASS_NAME:"Eniro.ObliqueView"});Eniro.ObliqueList=OpenLayers.Class(Eniro.Control,{initialize:function(){Eniro.Control.prototype.initialize.apply(this,arguments)},destroy:function(){Eniro.Control.prototype.destroy.apply(this,arguments)},registerObservers:function(){this.observe(this.div,"click",this.onListClicked);if(jQuery.browser.msie&&parseInt(jQuery.browser.version,10)<7){var a=this;jQuery(window).resize(function(){a.adjustIE6Height()});this.adjustIE6Height()}},adjustIE6Height:function(){var a=jQuery(window).height()-498;jQuery(this.div).height(a)},onListClicked:function(b){var c=OpenLayers.Event.element(b);var a=jQuery(c).parents("li").get(0);if(a){OpenLayers.Event.stop(b);var d=OpenLayers.Util.indexOf(this.elements.item,a);this.triggerEvent(Eniro.Events.OBLIQUE_LIST_SELECT,{city:d});return false}else{return true}},renderHeader:function(){this.cssClasses.header=this.getCssClassName("header");return(['<h2 class="'+this.cssClasses.header+'">',this.i18n("more-oblique"),"</h2>"].join(""))},renderList:function(){this.cssClasses.item=this.getCssClassName("item");var c=Eniro.Profile.oblique.cities;var b=[];b.push("<ul>");if(c){for(var a=0;a<c.length;a++){b.push('<li class="'+this.cssClasses.item+'"><a href="/'+c[a].id+'">'+OpenLayers.i18n("oblique-list."+c[a].id)+"</a></li>")}}b.push("</ul>");return b.join("")},draw:function(){this.div=this.createDiv();this.cssClasses.inner=this.getCssClassName("inner");var a=jQuery('<div class="'+this.cssClasses.inner+'"></div>');a.append(this.renderHeader());a.append(this.renderList());jQuery(this.div).append(a);return this.div},CLASS_NAME:"Eniro.ObliqueList"});Eniro.ObliqueMissing=OpenLayers.Class(Eniro.Control,{timer:null,timeout:3000,element:null,initialize:function(b,a){this.register(Eniro.Events.OBLIQUE_MISSING,this.updateTooltip);OpenLayers.Control.prototype.initialize.apply(this,[a])},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.element=document.createElement("div");this.div.appendChild(this.element);jQuery(this.div).addClass("eniro-oblique-tip");jQuery(this.div).css({position:"absolute",top:"45px",left:"10px",width:"300px",background:"transparent url(../media/tooltip/tooltip.png?v="+Eniro.Config["media.version"]+") repeat scroll 0 0",padding:"7px",zIndex:900,display:"none"});this.element.innerHTML=OpenLayers.i18n("oblique-missing.oblique-tooltip")}return this.div},destroy:function(){this.unregister(Eniro.Events.OBLIQUE_MISSING,this.updateTooltip);OpenLayers.Control.prototype.destroy.apply(this,arguments)},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.map=a},updateTooltip:function(){this.timer=setTimeout(OpenLayers.Function.bind(this.hideTooltip,this),this.timeout);jQuery(this.div).css({display:"block"})},hideTooltip:function(){jQuery(this.div).css({display:"none"})},CLASS_NAME:"Eniro.ObliqueMissing"});Eniro.ObliqueFunnel=OpenLayers.Class(OpenLayers.Control,{element:null,initialize:function(b,a){OpenLayers.Control.prototype.initialize.apply(this,[a]);this.element=OpenLayers.Util.getElement(b)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.element=document.createElement("div");this.div.appendChild(this.element);jQuery(this.div).addClass("eniro-oblique-funnel");var a=this;jQuery(".eniro-obliquesidebar-overviewmap .olMapViewport").bind("mouseover",{obj:a},this.onFunnelDeactive);jQuery(".eniro-obliquesidebar-overviewmap .olMapViewport").bind("mouseout",{obj:a},this.onFunnelActive)}return this.div},onFunnelDeactive:function(b){var a=b.data.obj;jQuery(a.div).css({display:"none"})},onFunnelActive:function(b){var a=b.data.obj;jQuery(a.div).css({display:"block"})},CLASS_NAME:"Eniro.ObliqueFunnel"});Eniro.ObliqueOverviewMap=OpenLayers.Class(OpenLayers.Map,{map:null,orientationClass:"eniro-orientation-south",orientation:"N",obliqueController:null,extentMarker:null,linearRing:null,initialize:function(a){Eniro.AppEvents.register(Eniro.Events.OBLIQUE_DEACTIVATING,this.onObliqueDeactivating);this.obliqueController=a;this.createMap();this.setEventHandlers();this.initializeExtentMarker();this.initializeOrientation()},destroy:function(){Eniro.AppEvents.unregister(Eniro.Events.OBLIQUE_DEACTIVATING,this.onObliqueDeactivating);if(this&&this.events){this.events.unregister("moveend",this,this.onMoveEnd)}if(this.obliqueController&&this.obliqueController.map&&this.obliqueController.map.events){this.obliqueController.map.events.unregister("zoomend",this,this.onZoomEnd)}Eniro.AppEvents.unregister(Eniro.Events.OBLIQUE_ORIENTATION_MOUSEOVER,this,this.onOrientationMouseOver);Eniro.AppEvents.unregister(Eniro.Events.OBLIQUE_ORIENTATION_MOUSEOUT,this,this.onOrientationMouseOut)},onObliqueDeactivating:function(){if(this.extentMarkerLayer){this.extentMarkerLayer.removeFeatures(this.extentMarkerLayer.features)}},createMap:function(){this.ovViewport=jQuery(".eniro-obliquesidebar-overviewmap")[0];var d={mapOptions:{maxResolution:156543.03390625,minZoomLevel:0,numZoomLevels:21,maxZoomLevel:20,units:"m",allowSelection:true,projection:new OpenLayers.Projection("EPSG:900913"),backendProjection:new OpenLayers.Projection("EPSG:4326"),maxExtent:new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),panDuration:15,activeLayers:[Eniro.Map.LAYER_MAP]},div:this.ovViewport};var b=OpenLayers.Util.extend({controls:[new OpenLayers.Control.Navigation()],maxResolution:"auto",fallThrough:false,theme:null},d.mapOptions);OpenLayers.Map.prototype.initialize.apply(this,[d.div,b]);var c=Eniro.Config["tile.version"];var a=new Eniro.Layer.TMS("overviewmap",Eniro.AppNode.tileUrl("/geowebcache/service/tms"),{layername:"map",buffer:0,type:"png"},c);this.addLayer(a);this.setBaseLayer(a);this.size=new OpenLayers.Size(0,0)},setEventHandlers:function(){this.events.register("moveend",this,this.onMoveEnd);this.obliqueController.map.events.register("zoomend",this,this.onZoomEnd);Eniro.AppEvents.register(Eniro.Events.OBLIQUE_ORIENTATION_MOUSEOVER,this,this.onOrientationMouseOver);Eniro.AppEvents.register(Eniro.Events.OBLIQUE_ORIENTATION_MOUSEOUT,this,this.onOrientationMouseOut)},initializeExtentMarker:function(){this.extentMarkerLayer=new OpenLayers.Layer.Vector("obliqueExtentMarker");var a=new OpenLayers.Control.DragFeature(this.extentMarkerLayer,{onComplete:OpenLayers.Function.bind(this.onDragEnd,this)});this.addControl(a);a.activate();this.addLayer(this.extentMarkerLayer)},initializeOrientation:function(){var a=new Eniro.ObliqueFunnel();this.addControl(a);a.activate();this.setOrientationClass(this.obliqueController.layer.orientation);jQuery(".olControlDragFeature").addClass("eniro-oblique-orientation")},setOrientationClass:function(a){jQuery(this.ovViewport).removeClass(this.orientationClass);if(a==="W"){this.orientationClass="eniro-orientation-east"}else{if(a==="E"){this.orientationClass="eniro-orientation-west"}else{if(a==="S"){this.orientationClass="eniro-orientation-north"}else{this.orientationClass="eniro-orientation-south"}}}jQuery(this.ovViewport).addClass(this.orientationClass)},addOrientationClass:function(a){jQuery(this.ovViewport).removeClass(this.orientationClass);jQuery(this.ovViewport).addClass(a)},removeOrientationClass:function(a){jQuery(this.ovViewport).removeClass(a);jQuery(this.ovViewport).addClass(this.orientationClass)},switchOrientationClass:function(a){jQuery(this.ovViewport).removeClass(this.orientationClass);this.orientationClass=a;jQuery(this.ovViewport).addClass(this.orientationClass)},setOrientation:function(a){if(a==="eniro-orientation-north"){this.orientation="S"}else{if(a==="eniro-orientation-east"){this.orientation="W"}else{if(a==="eniro-orientation-west"){this.orientation="E"}else{this.orientation="N"}}}this.setOrientationClass(this.orientation)},getOrientation:function(){return this.orientation},createExtentMarker:function(){if(this.extentMarker===null){if(this.extentMarkerLayer){this.extentMarkerLayer.removeFeatures(this.extentMarkerLayer.features);var a=[];this.linearRing=this.transformMapExtentToMercator();var b={};OpenLayers.Util.extend(b,OpenLayers.Feature.Vector.style["default"]);OpenLayers.Util.extend(b,{graphic:false,fill:true,fillColor:"#fff",stroke:true,strokeColor:"#069",strokeOpacity:0.8,strokeWidth:2});this.extentMarker=new Eniro.Feature.Vector(new OpenLayers.Geometry.Polygon([this.linearRing]),{},{style:b});a.push(this.extentMarker);this.extentMarkerLayer.addFeatures(a)}}else{this.redrawExtentMarker()}},transformMapExtentToMercator:function(){var p=this.obliqueController;var b=p.map.getExtent();var k=new OpenLayers.LonLat(b.left,b.bottom);var h=new OpenLayers.LonLat(b.left,b.top);var d=new OpenLayers.LonLat(b.right,b.top);var g=new OpenLayers.LonLat(b.right,b.bottom);var c=p.layer.obliqueTransformer.pixelToWorldMercator(p.map.baseLayer.obliqueTileInfo,k);var a=p.layer.obliqueTransformer.pixelToWorldMercator(p.map.baseLayer.obliqueTileInfo,h);var l=p.layer.obliqueTransformer.pixelToWorldMercator(p.map.baseLayer.obliqueTileInfo,d);var o=p.layer.obliqueTransformer.pixelToWorldMercator(p.map.baseLayer.obliqueTileInfo,g);var f=[];f.push(new OpenLayers.Geometry.Point(a.lon,a.lat));f.push(new OpenLayers.Geometry.Point(l.lon,l.lat));f.push(new OpenLayers.Geometry.Point(o.lon,o.lat));f.push(new OpenLayers.Geometry.Point(c.lon,c.lat));f.push(f[0]);return new OpenLayers.Geometry.LinearRing(f)},onOrientationMouseOver:function(a){this.addOrientationClass(a.dir)},onOrientationMouseOut:function(a){this.removeOrientationClass(a.dir)},onDragEnd:function(b,a,c){if(this.dragging||a){if(a!==null){c=this.getLonLatFromPixel(a)}this.updateObliqueData(c)}else{c.transform(new OpenLayers.Projection("EPSG:4326"),new OpenLayers.Projection("EPSG:900913"));this.setCenter(c,this.zoom)}this.redrawExtentMarker()},onZoomEnd:function(a){var b=0;if(this.obliqueController.map.zoom<3){b=this.obliqueController.map.zoom}if(this.getCenter()){this.moveTo(this.getCenter(),Eniro.Profile.oblique.overviewZoomLevels[b]);this.redrawExtentMarker()}},onMoveEnd:function(b){if(this.dragging){var a=this.getCenter();var c=new OpenLayers.LonLat(a.lon,a.lat);this.onDragEnd(null,null,c)}},redrawExtentMarker:function(a){if(this.extentMarker!==null){if(a){OpenLayers.Util.extend(this.extentMarker.style,a)}this.extentMarker.geometry.removeComponents([this.linearRing]);this.linearRing=this.transformMapExtentToMercator();this.extentMarker.geometry.addComponents([this.linearRing]);this.extentMarker.move(this.getCenter())}},updateObliqueData:function(f){var d=new OpenLayers.Bounds();d.extend(f);d.extend(f.clone().add(this.getResolution(),this.getResolution()));d.transform(this.baseLayer.projection,new OpenLayers.Projection("EPSG:4326"));var c=new OpenLayers.LonLat(d.left,d.top);var h=new OpenLayers.LonLat(d.right,d.top);var b=new OpenLayers.LonLat(d.right,d.bottom);var g=new OpenLayers.LonLat(d.left,d.bottom);f.transform(new OpenLayers.Projection("EPSG:900913"),new OpenLayers.Projection("EPSG:4326"));var a={ob_coord:[f.lon,f.lat].join(","),ob_pol:[c.lon,c.lat,h.lon,h.lat,b.lon,b.lat,g.lon,g.lat].join(","),ob_or:this.orientation};OpenLayers.Util.extend(a,this.obliqueController.layer.searchParams);this.obliqueController.map.baseLayer.changeObliqueImage(a)},CLASS_NAME:"Eniro.ObliqueOverviewMap"});Eniro.Banner.PrintRouteBanner=OpenLayers.Class(Eniro.Banner,{displayBeforeLoad:true,initialize:function(){if(Eniro.Profile.sellable&&Eniro.Profile.sellable.smallRouteBanner){Eniro.Banner.prototype.initialize.apply(this,[Eniro.Profile.sellable.smallRouteBanner])}},isShowAllowed:function(){return true},CLASS_NAME:"Eniro.Banner.PrintRouteBanner",SUPER:"Eniro.Banner"});Eniro.PrintRoute=OpenLayers.Class(Eniro.Control,{map:null,listItems:[],initialize:function(b,a){this.setMap(a);this.printState=b},activate:function(){this.active=true;Eniro.Control.prototype.activate.apply(this,arguments);if(Eniro.Profile.sellable&&Eniro.Profile.sellable.smallRouteBanner){this.contextAd=new Eniro.Banner.PrintRouteBanner()}this.setPrintState(printState);if(this.contextAd&&jQuery("."+this.cssClasses.distance).size()>0){jQuery("."+this.cssClasses.distance).after(this.contextAd.draw());this.contextAd.activate();this.contextAd.show()}return true},setPrintState:function(o){var a=o.route.form;var k=o.route.form.waypoints;var f={instr:true,poicat:"SPEEDCAMERAS",poitol:10,waypoints:""};if(a.options){if(a.options.pref){f.pref=a.options.pref}if(a.options.avoid){f.avoid=a.options.avoid}}if(o.res){f.res=o.res}var h=Eniro.Profile.id;for(var g=0;g<k.length;g++){var p=k[g];if(p.geometry){var d=p.geometry.split(",");var c=Eniro.AppNode.appUrl(Eniro.Util.getImagesLocation()+"markers/route/");var l="map-via"+g;if(g===0){l="map-start";jQuery(this.header).find("td.route-from").text(p.value)}else{if(g===k.length-1){l="map-stop";jQuery(this.header).find("td.route-to").text(p.value)}}if(f.waypoints){f.waypoints+=";"}f.waypoints+=p.geometry;if(this.printMap){c+=l+"-"+Eniro.Profile.id+".png?v="+Eniro.Config["media.version"];this.printMap.addWaypoint(d[1],d[0]);var b={};b[l]=c;this.printMap.addParameter(b);this.printMap.addPoint(d[1],d[0],l)}}}if(f.waypoints){b={};b.iheight=480;if(f.pref){b.pref=f.pref}if(f.avoid){b.avoid=f.avoid}this.printMap.addParameter(b);this.setRouteInstructions(o.route.result)}if(this.printMap){this.printMap.drawMap()}},resultAvailiable:function(a){this.originalObject.setResult(a)},setMap:function(a){this.printMap=a},setRouteInstructions:function(a){jQuery(this.div).append(this.renderRouteDescription(a))},renderRouteSummary:function(){this.cssClasses.header=this.getCssClassName("header");this.cssClasses.waypoints=this.getCssClassName("waypoints");this.cssClasses.distance=this.getCssClassName("distance");var a=['<div class="'+this.cssClasses.header+'">','<div class="',this.cssClasses.waypoints,'">',"<table>","<tr>",'<td class="route-title">',this.i18n("from"),":</td>",'<td class="route-from"></td>',"</tr>","<tr>",'<td class="route-title">',this.i18n("to"),":</td>",'<td class="route-to"></td>',"</tr>","</table>","</div>","</div>",'<div class="',this.cssClasses.distance,'">',"<table>","<tr>",'<td align="right">',this.i18n("total-distance"),': <strong class="route-distance">0</strong></td>',"</tr>","<tr>",'<td align="right">',this.i18n("total-duration"),': <strong class="route-duration">0</strong></td>',"</tr>","</table>","</div>"];return a.join("")},renderRouteDescription:function(a){var C=['<table id="routetable" width=100%>'];var h=[];var r=0;var w=0;var d=0;var B,z,v,s,u,q;if(!a){}else{this.listItems=[];for(B=0,s=a.length;B<s;++B){var G=a[B];var p=G.id;for(z=0,u=G.features.length;z<u;++z){var g=p+"-"+B+"-"+z;var c=G.features[z];if(c.properties.ienc==="stop"){continue}var F=c.properties.iargs;r+=F.dist;w+=F.dur;F.dist=F.dist.toDistance(100);var D=this.parseRouteDescription(c.properties.ienc,F);var f=this.parseSarMarkers(c.properties.events);var E={index:(d+1),id:g,desc:D,sarData:f,coordinates:c.geometry.coordinates,dist:r.toDistance(100),dur:this.time(F.dur),routeId:p,events:c.properties.events||[]};this.listItems.push(E);var l=["<tr>",'<td class="route-number" rowspan="2" valign="top"><b>',(d+1),".</b></td>",'<td class="route-direction" rowspan="2">'+this.getDirectionImage(c.properties.ienc)+"</td>",'<td colspan="2" class="route-description">',E.desc,"</td>","</tr>","<tr>",'<td class="grey-text">(',this.i18n("duration")," ",E.dur,")</td>",'<td align=right class="grey-text">',this.i18n("total")," ",E.dist," </td>","</tr>","<tr>",'<td colspan="4"><hr/></td>',"</tr>"];h=h.concat(l);if(f){h=h.concat([])}d++}}}C=C.concat(h).concat(["</table>"]);if(Eniro.Profile.id!=="dk"&&Eniro.Profile.id!=="dk_krak"){var b=['<div class="route-copyright" width="100%">',this.i18n("route-copyright"),"</div>"];C=C.concat(b)}var A=jQuery(this.header);if(A){var t=A.find("strong.route-distance");if(t){t.text(r.toDistance())}t=A.find("strong.route-duration");if(t){t.text(w.toDuration())}A.show()}return C.join("")},getDirClass:function(a){if(a.indexOf("start")===0){return"start"}return a.replace(/\./g,"-")},two:function(a){return((a===0||a>9)?"":"0")+a},time:function(c){var a=Math.round(c/60);c=c%60;if(a<1){return c+" "+this.i18n("seconds")}var b=Math.round(a/60);a=a%60;if(b<1){return a+" "+this.i18n("minutes")}b=b%60;return[b,this.i18n("hours"),a,this.i18n("minutes")].join(" ")},parseSarMarkers:function(c){var a;if(c){a={};var d;for(var b=0,f=c.length;b<f;b++){if(c[b]&&c[b].category&&c[b].subject){if(!a[c[b].category]){a[c[b].category]=[]}d=a[c[b].category];if(d.indexOf(c[b].subject)===-1){d.push(c[b].subject)}}}}return a},getSarMarkup:function(a){var b=[];if(a){b.push("<br />");for(var c in a){b=b.concat(['<img class="sar-category-marker" src="media/markers/',this.sarMarkers[c]],"?v="+Eniro.Config["media.version"]+'" />')}}return b.join("")},parseRouteDescription:function(d,c){if(c.signData){var b=c.signData.split(/,\s*/);for(var a=0,f=b.length;a<f;a++){if(b[a].match(/^\d+$/)){b[a]=[this.i18n("road"),b[a]].join(" ")}}c.signData=b.join(", ")}if(c.road&&c.road.match(/^\d+/)){c.road=[this.i18n("road"),c.road].join(" ")}return OpenLayers.i18n("route."+d,c)},sarMarkers:{SPEEDCAMERAS:"speedcamera.png"},getDirectionImage:function(a){var b="";if(/^start\..+/.test(a)){b="start"}else{if(/^round\.\d\.(cont|onto)?\.?right/.test(a)){b="round-right"}else{if(/^round\.\d\.(cont|onto)?\.?left/.test(a)){b="round-left"}else{if(/^round\.\d\.(cont|onto)?\.?straight/.test(a)){b="round-straight"}}}}if(!b){switch(a){case"dir.turn.right":case"dir.onto.turn.right":b="turn-right";break;case"dir.turn.left":case"dir.onto.turn.left":b="turn-left";break}}return(b)?'<img src="'+Eniro.Util.getImagesLocation()+"print/"+b+".png?v="+Eniro.Config["media.version"]+'" alt="" />':""},draw:function(a,b,c){if(!this.header){this.header=OpenLayers.Util.createDiv("routeheader",0,0,null,"relative");if(this.printMap){jQuery(this.printMap.div).before(this.header)}jQuery(this.header).html(this.renderRouteSummary());jQuery(this.header).hide()}if(!this.div){this.div=document.createElement("div");this.div.setAttribute("id","printroute")}return this.div},CLASS_NAME:"Eniro.PrintRoute"});Eniro.PrintSearch=OpenLayers.Class({id:null,map:null,printState:null,div:null,listItems:[],filters:{ptr:["q","p","ap"],search:["q","p","ap","offset","pageSize"],resolve:["id","p"]},initialize:function(b,a){this.printState=b;this.draw();this.setMap(a);this.setResult(b.searchResult)},setMap:function(a){this.map=a},setResult:function(c){var a=c;if(a){this.listItems=[];var b=0;if(a.geoJSONResult){if(a.geoJSONResult.type==="Feature"){this.addListItem(++b,a.geoJSONResult,true)}else{if(a.geoJSONResult.type==="FeatureCollection"){if(a.hits===1){this.addListItem(++b,a.geoJSONResult.features[0],true)}else{for(n=a.geoJSONResult.features.length;b<n;++b){this.addListItem(b+1,a.geoJSONResult.features[b],false)}}}}}}this.drawFeatures()},aggregates:[],addListItem:function(b,c,f){this.listItems.push(c);if(c.properties.hasOwnProperty("groupID")){var a=Number(c.properties.groupID);var d=this.aggregates[a];if(!this.aggregates[a]){this.aggregates[a]=[]}this.aggregates[a].push(this.listItems.length-1)}},draw:function(){this.div=document.createElement("div");this.div.setAttribute("id","printsearch");return this.div},drawFeatures:function(){var g="<table width=100%>";var a=0;var d=this.listItems.length;if(d>10&&OpenLayers.Util.getBrowserName()=="msie"){d=10}for(var c=0;c<d;c++){var b=this.listItems[c];if(!b.isDrawn){a++}g+=this.drawFeature(b,a)}g+="</table>";this.div.innerHTML=g;if(d>0){var f={};this.map.addParameter(f)}if(this.map){this.map.drawMap()}},drawFeature:function(v,h,u){if(v.isDrawn){return""}var t=[];var p=printState.icon;if(this.listItems.length==1){p+="-single"}else{p+="-"+h}var r=Eniro.AppNode.appUrl(Eniro.Util.getImagesLocation());if(this.map){var b={};b.prefix=r;this.map.addParameter(b)}var c="markers/search/"+p+".png?v="+Eniro.Config["media.version"];if(v.properties.hasOwnProperty("groupID")){var q=Number(v.properties.groupID);t=this.aggregates[q]}var o=[];var k=OpenLayers.String.camelize("build-"+(this.printState.searchResultProvider.replace(/_/gi,"-")));if(this[k]){var g=this[k](v);o=o.concat(['<tr><td rowspan=3><img src="',r,c,'"></td>']);o=o.concat(["<td>",g.title,"</td>"]);if(g.phones&&g.phones.length>0){o=o.concat(["<td>",g.phones[0],"</td>"])}o=o.concat(["</tr><tr>"]);var a="";if(g.address.streetName){a=g.address.streetName;if(g.address.streetNumber){a+=" "+g.address.streetNumber}}o=o.concat(["<td>",a,"</td>"]);if(g.phones&&g.phones.length>1){o=o.concat(["<td>",g.phones[1],"</td>"])}o=o.concat(["</tr><tr>"]);var s="";if(g.address.postalCode){s=g.address.postalCode}if(g.address.postArea){if(s){s+=" "}s+=g.address.postArea}o=o.concat(["<td>",s,"</td>"]);if(g.phones&&g.phones.length>2){o=o.concat(["<td>",g.phones[2],"</td>"])}o=o.concat(["</tr><tr><td colspan=3 width=100%><hr></td></tr>"])}if(this.map&&v.geometry&&v.geometry.type==="Point"){var f=v.geometry.coordinates;this.map.addPoint(f[1],f[0],p);var l={};l[p]=c;this.map.addParameter(l)}v.isDrawn=true;if(t.length>0){for(var d=0;d<t.length;d++){v=this.listItems[t[d]];o=o.concat([this.drawFeature(v,h,true)])}}++h;return o.join("")},buildYpNo:function(b){var c={title:"",phones:[],address:{}};var d=b.properties;c.title=d.companyName;if(c.title&&c.title.length>20){var a=c.title.substr(20);c.title=c.title.substr(0,20)+a.replace(/( |\,|\.)/i,"$1<br/>")}if(d.telephoneNumber){c.phones.push(this.formatPhoneNo(d.telephoneNumber))}if(d.visitorAddress&&d.visitorAddress.addressLines){if(d.visitorAddress.addressLines[0]){d.visitorAddress.streetName=d.visitorAddress.addressLines[0]}if(d.visitorAddress.addressLines[1]){d.visitorAddress.postArea=d.visitorAddress.addressLines[1]}c.address=d.visitorAddress}return c},buildWpNo:function(d){var f={title:"",phones:[],address:{}};var g=d.properties;var b=[];if(g.firstName&&OpenLayers.String.trim(g.firstName)){b.push(g.firstName)}if(g.lastName&&OpenLayers.String.trim(g.lastName)){b.push(g.lastName)}f.title=b.join(" ");var c,k;if(Eniro.Util.isArray(g.contactEntries)&&g.contactEntries.length>0){for(c=0,k=g.contactEntries.length;c<k;++c){var h=g.contactEntries[c];if(h.text){f.phones.push(this.formatPhoneNo(h.text))}}}var a={};if(Eniro.Util.isArray(g.addressLines)&&g.addressLines.length>0){if(g.addressLines[0]){a.streetName=g.addressLines[0]}a.postArea="";for(c=1,k=g.addressLines.length;c<k;c++){a.postArea+=g.addressLines[c]+" "}OpenLayers.String.trim(a.postArea);f.address=a}return f},buildGeoNo:function(a){var b={address:{}};b.address.postArea=Eniro.Util.FeatureUtils.getAddressAsString(a);return b},buildYpPtrSe:function(a){return this.buildWpSe.apply(this,arguments)},buildYpSe:function(a){return this.buildWpSe.apply(this,arguments)},buildWpSe:function(d){var f={title:"",phones:[],address:{}};var c=0;var g=d.properties;f.title=this.getEDataValue(g.title);var b=this.getEData(g["e:phone_numbers"],"e:phone_number");if(b.length){for(c=0;c<b.length;c++){f.phones.push(this.getEDataValue(b[c]))}}var a=this.getEData(g["e:addresses"],"e:address")[0];if(!a){a=g["e:address"]}if(a){f.address={streetName:this.getEDataValue(a,"e:street_name"),streetNumber:this.getEDataValue(a,"e:street_number"),postalCode:this.getEDataValue(a,"e:post_code"),postArea:this.getEDataValue(a,"e:post_area")};b=this.getEData(a["e:phone_numbers"],"e:phone_number");for(c=0;c<b.length;c++){f.phones.push(this.getEDataValue(b[c]))}}return f},buildGeoSe:function(b){var a=b.properties.address;if(a.city){a.postArea=a.city}var c={address:a};return c},buildYpFi:function(){return this.buildYpSe.apply(this,arguments)},buildWpFi:function(){return this.buildWpSe.apply(this,arguments)},buildGeoFi:function(){return this.buildGeoSe.apply(this,arguments)},buildYpDk:function(){return this.buildYpSe.apply(this,arguments)},buildWpDk:function(){return this.buildWpSe.apply(this,arguments)},buildGeoDk:function(){return this.buildGeoSe.apply(this,arguments)},buildYpDkKrak:function(){return this.buildYpSe.apply(this,arguments)},buildWpDkKrak:function(){return this.buildWpSe.apply(this,arguments)},buildGeoDkKrak:function(){return this.buildGeoSe.apply(this,arguments)},getEData:function(d,k,b){var o=[];if(d){if(d.constructor==Array){for(var f=0;f<d.length;f++){var c=d[f];if(!c.length){o=o.concat(this.getEData(c,k,b))}}}else{if(k&&d.hasOwnProperty(k)){d=d[k]}if(!b){o.push(d)}else{var g=true;for(var h in b){g=d.hasOwnProperty(h);if(g){var a=d[h];var l=b[h];g=(a===l)}if(!g){break}}if(g){o.push(d)}}}}return o},getEDataValue:function(d,a){var c=null;if(d){if(!a){if(d.hasOwnProperty("@type")){var b=d["@type"];if(b==="text/xml"){a="@href"}else{if(b==="picture"){a="e:src"}}}if(!a){a="#text"}}if(a&&d.hasOwnProperty(a)){c=d[a]}}return c},formatPhoneNo:function(a){if(a){a=Eniro.Util.FeatureUtils.formatNorwegianPhoneNo(a)}return a},CLASS_NAME:"Eniro.PrintSearch"});Eniro.PrintDraw=OpenLayers.Class(Eniro.Control,{map:null,listItems:[],initialize:function(b,a){this.setMap(a);this.setPrintState(b)},setPrintState:function(h){if(this.map===undefined){return}if(h.draw===undefined){this.map.drawMap();return}var q=h.draw.pointsState;var r=h.draw.lineState;var o=h.draw.polygonState;if(q){var l=Eniro.AppNode.appUrl(Eniro.Util.getImagesLocation()+"markers/draw/");var k="blue";l+=k;l+=".png?v="+Eniro.Config["media.version"];l+=",10,30";for(var d=0;d<q.length;d++){var b=q[d];var c={};c[k]=l;this.map.addParameter(c);var a=b.marker.lastIndexOf("/");var g=b.marker.lastIndexOf(".");var f=b.marker;if((a>-1)&&(g>-1)){f=b.marker.substring(a+1,g)}this.map.addPoint(b.lat,b.lon,f)}}if(r&&r.length>0){this.map.addGeometry(r)}if(o&&o.length>0){this.map.addGeometry(o)}if(this.map){if(this.map.drawMap()===false){this.showTooMuchDataError()}}},setMap:function(a){this.map=a},showTooMuchDataError:function(){if(!this.div){this.div=document.createElement("div");this.div.setAttribute("id","printdraw")}this.div.innerHTML=['<div class="draw-error-message" width="100%">',this.i18n("error.draw.too_much_data"),"</div>"];return this.div},CLASS_NAME:"Eniro.PrintDraw"});Eniro.PrintMap=OpenLayers.Class({params:{iheight:750,iwidth:750,bbox:{minlat:null,minlon:null,maxlat:null,maxlon:null},cc:{lat:null,lon:null},points:[],waypoints:[],geometry:[]},div:null,initialize:function(a){this.setPrintState(a);this.draw();this.drawMap()},draw:function(){this.div=jQuery('<div id="overviewmap"></div>').get(0);return this.div},addParameter:function(a){OpenLayers.Util.extend(this.params,a)},addPoint:function(c,d,b){var a=this.params.points.length;this.params.points[a]={lat:c,lon:d,symbol:b}},addGeometry:function(a){this.params.geometry[this.params.geometry.length]=a},addWaypoint:function(b,c){var a=this.params.waypoints.length;this.params.waypoints[a]={lat:b,lon:c}},setBbox:function(a){this.params.bbox.minlat=a.bottom;this.params.bbox.minlon=a.left;this.params.bbox.maxlat=a.top;this.params.bbox.maxlon=a.right},drawMap:function(){var a=false;var f='<img id="mapimg" src="';f+=Eniro.AppNode.appUrl("api/statmap?");var d=true;for(var c in this.params){if(this.params.hasOwnProperty(c)&&this.params[c]!==null){if(c==="bbox"){if(this.params.bbox.minlat&&this.params.bbox.minlon&&this.params.bbox.maxlat&&this.params.bbox.maxlon){if(d===false){f+="&"}f+=c+"=";f+=this.params.bbox.minlon+",";f+=this.params.bbox.minlat+";";f+=this.params.bbox.maxlon+",";f+=this.params.bbox.maxlat}}else{if(c==="cc"){if(this.params.cc.lat!==null&this.params.cc.lon!==null){if(d===false){f+="&"}f+=c+"=";f+=this.params.cc.lon+",";f+=this.params.cc.lat}}else{if(c==="points"){f+=this.pointsToHTML(this.params.points,"p",d)}else{if(c==="waypoints"){f+=this.waypointsToHTML(this.params.waypoints,"wp",d)}else{if(c==="geometry"){}else{if(d===false){f+="&"}f+=c+"=";f+=this.params[c].valueOf()}}}}}d=false}}for(var b=0;b<this.params.geometry.length;b++){geometryHTML=this.geometryToHTML(this.params.geometry[b],"g",d);if((geometryHTML.length+f.length)<2000){f+=geometryHTML}else{a=true}}f+='"/>';jQuery(this.div).html(f);if(a){return false}return true},setPrintState:function(a){this.params.cc=a.center;this.params.zoom=a.zoom;if(a.bbox){this.setBbox(a.bbox)}if((a.baseLayer==="nautical")||(a.baseLayer==="aerial")||(a.baseLayer==="hybrid")){this.params.itype=a.baseLayer}},pointsToHTML:function(b,f,g){var d="";for(var c=0;c<b.length;c++){if(g===false){d+="&"}var a=b[c];if(a.hasOwnProperty("lat")&&a.hasOwnProperty("lon")){d+=f+"=";d+=a.lon+",";d+=a.lat;if(a.hasOwnProperty("symbol")){d+=";";d+=a.symbol}}if(g===true){g=false}}return d},waypointsToHTML:function(a,b,c){return this.geometryToHTML(a,b,c)},geometryToHTML:function(b,f,g){var d="";if((b===undefined)||(b.length<1)){return d}if(g===false){d+="&"}d+=f+"=";for(var c=0;c<b.length;c++){var a=b[c];if(a.lat&&a.lon){d+=a.lon+",";d+=a.lat;if(c<(b.length-1)){d+=";"}}}return d},getIHeight:function(){return this.params.iheight},getIWidth:function(){return this.params.iwidth},CLASS_NAME:"Eniro.PrintMap"});Eniro.PrintStreetview=OpenLayers.Class(Eniro.Control,{params:{iheight:750,iwidth:750,lod:2,p:0,path:"",heading:"",pitch:0},initialize:function(a){this.setPrintState(a);this.draw();this.drawStreetviewImage()},setPrintState:function(b){var a=b.path.indexOf("/streetview-data/");if(a>0){this.params.path=b.path.substring(a+17)}this.params.heading=b.heading;this.params.pitch=b.pitch},draw:function(){this.div=jQuery('<div id="streetview-image-div"></div>').get(0);return this.div},drawStreetviewImage:function(){var a='<img id="streetview-image" src="';a+=Eniro.AppNode.appUrl("/api/streetview?path="+this.params.path+"&b="+(this.params.heading-180)+"&lod="+this.params.lod+"&p="+(this.params.pitch*-1)+"&iwidth="+this.params.iwidth+"&iheight="+this.params.iheight);a+='"/>';jQuery(this.div).html(a);return true},CLASS_NAME:"Eniro.PrintStreetview"});Eniro.Sellable.PreDefinedYP=OpenLayers.Class(Eniro.Control,{init:true,enabled:true,initialize:function(){Eniro.Control.prototype.initialize.apply(this,arguments);if(this.nocrud||window.location.toString().indexOf("nocrud")>0){this.nocrud=true}if(this.nocrud||!Eniro.Profile.sellable||!Eniro.Profile.sellable.preDefinedYP){return false}else{this.register(Eniro.Events.SEARCH_RESULT_AVAILABLE,this.onSearchResultAvailable);this.register(Eniro.Events.SEARCH_SET_PREDEFINED_STATUS,this.onSearchSetPredefinedStatus)}},destroy:function(){Eniro.Control.prototype.destroy.apply(this,arguments);this.unregister(Eniro.Events.SEARCH_RESULT_AVAILABLE,this.onSearchResultAvailable);this.unregister(Eniro.Events.SEARCH_SET_PREDEFINED_STATUS,this.onSearchSetPredefinedStatus)},setMap:function(a){Eniro.Control.prototype.setMap.apply(this,arguments);if(this.map.stateController){this.map.stateController.register(Eniro.Sellable.PreDefinedYP.STATE_KEY,20,this)}},deactivate:function(){if(Eniro.Control.prototype.deactivate.apply(this,arguments)){jQuery(this.div).hide();this.triggerEvent(Eniro.Events.SEARCH_CLEAR);return true}return false},registerObservers:function(){this.observe(this.div,"click",this.onClick)},assignElements:function(){Eniro.Control.prototype.assignElements.apply(this,arguments)},onClick:function(a){var b=OpenLayers.Event.element(a);if(b===this.elements.close){this.deactivate();this.triggerEvent(Eniro.Events.SEARCH_CLEAR)}else{if(jQuery(b).is("input[type=checkbox]")){if(b.checked){jQuery(this.div).find("input[type=checkbox]").not(b).each(function(d,f){f.checked=false});this.triggerEvent(Eniro.Events.SEARCH_DO,{q:jQuery(b).val(),p:Eniro.Profile.sellable.preDefinedYP.provider,ap:Eniro.Profile.sellable.preDefinedYP.provider,pageSize:20,_suppressHeader:false,_suppressList:false,_predefinedyp:true})}else{this.triggerEvent(Eniro.Events.SEARCH_CLEAR)}}else{OpenLayers.Event.stop(a);var c=jQuery(b).siblings("input[type=checkbox]").eq(0);if(c.size()>0){if(c.is(":checked")){jQuery(this.div).next().show()}else{c=c.get(0);c.checked=true;this.onClick({target:c})}}return false}}return true},onSearchResultAvailable:function(a){if(this.active){if(this.init&&a.firstSearch){this.init=false}if(a.search._forceEmpty||(a.search_predefinedyp&&this.enabled&&this.init&&this.map.getZoom()>=Eniro.Profile.sellable.preDefinedYP.minZoom)){jQuery(this.div).show()}else{if(!a.search._predefinedyp){jQuery(this.div).hide()}}}},onSearchSetPredefinedStatus:function(a){this.enabled=(a===true)},ellipsify:function(b,a){a=a||15;if(b.length<a){return b}return OpenLayers.String.trim(b.substr(0,a))+"..."},renderOptions:function(){var c=[];var a=Eniro.Profile.sellable.preDefinedYP.options;if(a&&a.length>0){for(var b=0,d=a.length;b<d;++b){c.push("<li>","<label>",'<input type="checkbox" value="',a[b].linkId,'" />','<img style="height: 16px; width: 16px" src="',a[b].imageUrl,'" alt="',this.i18n("logotype-for")," ",a[b].name,'" />','<a href="/'+new Date().getTime()+'">'+this.ellipsify(a[b].name)+"</a>","</label>","</li>")}this.cssClasses.container=this.getCssClassName("container");c.unshift('<ul class="',this.cssClasses.container,'">');c.push("</ul>")}return c.join("")},draw:function(){this.div=this.createDiv();if(this.nocrud||!Eniro.Profile.sellable||!Eniro.Profile.sellable.preDefinedYP){return this.div}this.cssClasses.close=this.getCssClassName("close");var a=['<div class="',this.cssClasses.close,'">',"</div>",this.renderOptions()];jQuery(this.div).html(a.join(""));jQuery(this.div).css("display","block");return this.div},toString:function(){return this.CLASS_NAME+":"+this.id},saveState:function(){var a={enabled:this.enabled,visible:!(jQuery(this.div).is(":hidden")),checkboxes:this.getCheckedStatus()};return a},applyState:function(g){if(!this.div){return}this.enabled=g.enabled;if(this.enabled&&g.visible){jQuery(this.div).show()}else{jQuery(this.div).hide()}if(g.checkboxes){for(var f in g.checkboxes){var a=jQuery(this.div).find("input[type=checkbox][value="+f+"]").get(0);if(a){a.checked=g.checkboxes[f]}}}else{var d=jQuery(this.div).find("input[type=checkbox]");for(var b=0,h=d.length;b<h;b++){var c=d[b];c.checked=false}}},getCheckedStatus:function(){var a={};var d=jQuery(this.div).find("input[type=checkbox]");if(d&&d.length>0){for(var b=0,f=d.length;b<f;b++){var c=d[b];a[c.value]=c.checked}}else{a=null}return a},CLASS_NAME:"Eniro.Sellable.PreDefinedYP"});Eniro.Sellable.PreDefinedYP.STATE_KEY="predefinedYP";Eniro.Sellable.PredefinedypTabView=OpenLayers.Class(Eniro.SearchResultTabView,{initialize:function(b,a){if(!Eniro.Profile.sellable.preDefinedYP){this.error("No options found for predefined yellow searches in current profile.");return false}this.id=b;Eniro.TabView.prototype.initialize.apply(this,arguments);this.provider=a;this.stylename="search-"+this.id+"-result";this.listItems=[];this.register(Eniro.Events.SEARCH_CLEAR,this.onSearchClear)},onSearchClear:function(){Eniro.SearchResultTabView.prototype.clearItems.apply(this,arguments);if(this.div){jQuery(this.div).hide()}},addListItem:function(a,b,c){Eniro.SearchResultTabView.prototype.addListItem.apply(this,arguments)},setResult:function(b,a){Eniro.SearchResultTabView.prototype.setResult.apply(this,arguments);if(this.div&&this.listItems&&this.listItems.length){jQuery(this.div).show()}},getContent:function(){return Eniro.SearchResultTabView.prototype.getContent.apply(this,arguments)},getTabSelectorItemHTML:function(){return[]},CLASS_NAME:"Eniro.Sellable.PredefinedypTabView",SUPER:"Eniro.SearchResultTabView"});Eniro.SponsorBanner=OpenLayers.Class(Eniro.Banner,{initialize:function(b,d,c,a){Eniro.Banner.prototype.initialize.apply(this,arguments);this.register(Eniro.Events.SPONSOR_AD_ACTIVATE,this.onSponsorAdActivate)},draw:function(){this.cssClasses.ad=this.getCssClassName("ad-"+this.name);this.div=jQuery(['<div class="',this.getCssClassName(),'" style="visibility:hidden">','<div class="',this.cssClasses.ad,'"></div>','<div class="',this.cssClasses.close,'"></div>',"</div>"].join("")).get(0);jQuery(this.div).hide();return this.div},destroy:function(){this.unregister(Eniro.Events.SPONSOR_AD_ACTIVATE,this.onSponsorAdActivate);Eniro.Banner.prototype.destroy.apply(this,arguments)},onSponsorAdActivate:function(a){if(this.cu!==a){return}this.loadBanner()},CLASS_NAME:"Eniro.SponsorBanner"});Eniro.GPSTooltip=OpenLayers.Class(Eniro.Tooltip,{initialize:function(){Eniro.Tooltip.prototype.initialize.apply(this,arguments)},draw:function(){Eniro.Tooltip.prototype.draw.apply(this,arguments);this.contentDiv=this.createDiv(null,"content");this.div.appendChild(this.contentDiv);this.closeDiv=this.createDiv(null,"close");this.div.appendChild(this.closeDiv);return this.div},setContents:function(a){jQuery(this.contentDiv).html(a)},CLASS_NAME:"Eniro.GPSTooltip",SUPER:"Eniro.Tooltip"});Eniro.Feature.GPSMarker=OpenLayers.Class(Eniro.Feature.PopupFeature,{draggable:true,initialize:function(b){var a={style:{externalGraphic:Eniro.Util.getImagesLocation()+"markers/draw/crosshair.png",pointRadius:0,strokeWidth:0,graphic:true,graphicZIndex:9200,graphicWidth:18,graphicHeight:18,graphicYOffset:-10,graphicXOffset:-10}};Eniro.Feature.PopupFeature.prototype.initialize.apply(this,[b,{},a]);this.events.un({mouseover:this.onMouseOver,mouseout:this.onMouseOut,click:this.onClick})},CLASS_NAME:"Eniro.Feature.GPSMarker"});Eniro.GPS=OpenLayers.Class(Eniro.Control,{marker:null,projections:{RT90:new OpenLayers.Projection("EPSG:3021"),SWEREF99:new OpenLayers.Projection("EPSG:3006")},regExp:{WGS84_DEC:/^([\-+]?\d{1,2}(\.\d+)?) *[,;: ] *([\-+]?\d{1,2}(\.\d+)?)$/,WGS84_DECMIN:/^([NnSs]? *\d{1,2}[°] *\d{1,2}((\.)\d{0,3}){0,1}[']?) *[,;: ] *([WwEe]? *\d{1,2}[°] *\d{1,2}((\.)\d{0,3}){0,1}[']?)$/,RT90:/^\d{7} *[,;: ] *\d{7}$/,SWEREF99:/^\d{7} *[,;: ] *\d{5,6}$/},initialize:function(a){Eniro.Control.prototype.initialize.apply(this,[a]);this.tooltip=new Eniro.GPSTooltip();this.register(Eniro.Events.MODE_SWITCH,this.onModeSwitch)},destroy:function(){this.clearMarker();this.tooltip.destroy();Eniro.Control.prototype.destroy.apply(this,arguments)},activate:function(){if(Eniro.Control.prototype.activate.apply(this,arguments)){var b=this.map.getControl(Eniro.ControlID.SHOW_ON_MAP_CONTROL);if(b){var a=b.getLayerById("gps");if(a){b.showLayer(a)}}if(this.tooltip){this.tooltip.activate()}return true}return false},deactivate:function(){if(Eniro.Control.prototype.deactivate.apply(this,arguments)){if(this.marker){this.marker.hide()}if(this.tooltip){this.tooltip.hide()}var b=this.map.getControl(Eniro.ControlID.SHOW_ON_MAP_CONTROL);var a=b.getLayerById("gps");b.hideLayer(a);return true}return false},setMap:function(a){Eniro.Control.prototype.setMap.apply(this,arguments);this.map.events.register("zoomend",this,this.onZoomEnd)},onZoomEnd:function(a){if(this.marker||this.tooltip.div){this.update({type:"zoomend"})}},onModeSwitch:function(a){if(a.mode==="streetview"||a.mode==="oblique"){this.deactivate()}},onContentClick:function(a){OpenLayers.Event.stop(a,true)},onCloseClick:function(a){this.deactivate()},clearMarker:function(){if(this.marker){this.map.wfs.destroyFeatures(this.marker);this.marker=null}},updatePosition:function(a){if(!this.marker){this.marker=new Eniro.Feature.GPSMarker(a);this.marker.events.on({dragstart:this.update,dragmove:this.update,dragend:this.update,scope:this});this.map.wfs.addFeatures(this.marker)}else{this.marker.style.display="";this.marker.move(a)}if(!this.tooltip.div){var b=this.tooltip.draw();if(b){this.map.layerContainerDiv.appendChild(b);OpenLayers.Event.observe(this.tooltip.closeDiv,"click",OpenLayers.Function.bindAsEventListener(this.onCloseClick,this));OpenLayers.Event.observe(this.tooltip.div,"mousedown",this.onContentClick);OpenLayers.Event.observe(this.tooltip.div,"mouseup",this.onContentClick)}}this.tooltip.show();this.update({type:"init"});this.update()},updatePositionAndCenter:function(c){var b,a;if(this.regExp.WGS84_DEC.test(c)){b=this.stringToLonLat(c);a=this.map.backendProjection}else{if(this.regExp.WGS84_DECMIN.test(c)){b=this.WGS84DegToDec(c);a=this.map.backendProjection}else{if(this.regExp.RT90.test(c)){b=this.stringToLonLat(c);a=this.projections.RT90}else{if(this.regExp.SWEREF99.test(c)){b=this.stringToLonLat(c);a=this.projections.SWEREF99}}}}if(a){this.updatePosition(b.transform(a,this.map.getProjectionObject()))}if(b){this.map.moveTo(b,this.map.getZoom(),false)}},update:function(d){if(this.tooltip){var k=new OpenLayers.LonLat(this.marker.geometry.x,this.marker.geometry.y);var b=this.map.getLayerPxFromLonLat(k);this.tooltip.setPosition(b);var o=this.map.getProjectionObject();var a=k.clone().transform(o,this.map.backendProjection);var f="N "+this.formatWGS84DecToDeg(a.lat)+", E "+this.formatWGS84DecToDeg(a.lon);var l=k.clone().transform(o,this.projections.RT90);var c=k.clone().transform(o,this.projections.SWEREF99);var p=this.getCssClassName("title");var h=this.getCssClassName("value");var g=["<strong>"+this.i18n("title")+"</strong>","<div>",'<span class="'+p+'">'+this.i18n("wgs84")+":</span>",'<span class="'+h+'">'+f+"</span>","</div>","<div>",'<span class="'+p+'">'+this.i18n("decimal")+":</span>",'<span class="'+h+'">'+this.formatLonLat(a,5)+"</span>","</div>"];if(Eniro.Profile.id==="se"){g.push("<div>",'<span class="'+p+'">'+this.i18n("rt90")+":</span>",'<span class="'+h+'">'+this.formatLonLat(l,0)+"</span>","</div>","<div>",'<span class="'+p+'">'+this.i18n("sweref99")+":</span>",'<span class="'+h+'">'+this.formatLonLat(c,0)+"</span>","</div>")}this.tooltip.setContents(g.join(""))}},validate:function(a){return(this.regExp.WGS84_DEC.test(a)||this.regExp.WGS84_DECMIN.test(a)||this.regExp.RT90.test(a)||this.regExp.SWEREF99.test(a))},stringToLonLat:function(b){var a=b.split(/ *[ ,;:] */);var d=parseFloat(a[1],10);var c=parseFloat(a[0],10);if(!isNaN(d)&&!isNaN(c)){return new OpenLayers.LonLat(d,c)}return null},formatLonLat:function(b,a){return b.lat.toFixed(a)+", "+b.lon.toFixed(a)},formatWGS84DecToDeg:function(g,c){if(typeof g!="string"){g=g.toString()}if(g.indexOf(".")>0){var b=g.split(".");var f=parseInt(b[0],10)+"°";var a=parseFloat("."+b[1]);var k=60*a;var d="";if(c){b=k.toString().split(".");k=parseInt(b[0],10)+"'";var h=parseFloat("."+b[1]);d=Math.round(60*h)+'"'}else{k=k.toFixed(3)+"'"}return OpenLayers.String.trim([f,k,d].join(" "))}return""},WGS84DegToDec:function(b){var a=b.split(/ *[ ,;:] */);var f={dir:a[3],deg:a[4].replace(/\D/,""),decMin:a[5].split("'")[0]};var c={dir:a[0],deg:a[1].replace(/\D/,""),decMin:a[2].split("'")[0]};var g=parseInt(f.deg,10)+(parseFloat(f.decMin,10)/60);g=(f.dir.toUpperCase()==="E")?g:g*(-1);var d=parseInt(c.deg,10)+(parseFloat(c.decMin,10)/60);d=(c.dir.toUpperCase()==="N")?d:d*(-1);if(!isNaN(g)&&!isNaN(d)){return new OpenLayers.LonLat(g,d)}return null},draw:function(){return null},CLASS_NAME:"Eniro.GPS"});