var Prototype={Version:"1.7",Browser:(function(){var b=navigator.userAgent;var a=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!a,Opera:a,WebKit:b.indexOf("AppleWebKit/")>-1,Gecko:b.indexOf("Gecko")>-1&&b.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile/.test(b)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var a=window.Element||window.HTMLElement;return !!(a&&a.prototype)})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var d=document.createElement("div"),b=document.createElement("form"),a=false;if(d.__proto__&&(d.__proto__!==b.__proto__)){a=true}d=b=null;return a})()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(a){return a}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Abstract={};var Try={these:function(){var d;for(var b=0,f=arguments.length;b<f;b++){var a=arguments[b];try{d=a();break}catch(g){}}return d}};var Class=(function(){var e=(function(){for(var f in {toString:1}){if(f==="toString"){return false}}return true})();function a(){}function b(){var j=null,h=$A(arguments);if(Object.isFunction(h[0])){j=h.shift()}function f(){this.initialize.apply(this,arguments)}Object.extend(f,Class.Methods);f.superclass=j;f.subclasses=[];if(j){a.prototype=j.prototype;f.prototype=new a;j.subclasses.push(f)}for(var g=0,k=h.length;g<k;g++){f.addMethods(h[g])}if(!f.prototype.initialize){f.prototype.initialize=Prototype.emptyFunction}f.prototype.constructor=f;return f}function d(m){var h=this.superclass&&this.superclass.prototype,g=Object.keys(m);if(e){if(m.toString!=Object.prototype.toString){g.push("toString")}if(m.valueOf!=Object.prototype.valueOf){g.push("valueOf")}}for(var f=0,j=g.length;f<j;f++){var l=g[f],k=m[l];this.prototype[l]=k}return this}return{create:b,Methods:{addMethods:d}}})();(function(){var G=Object.prototype.toString,F="Null",q="Undefined",z="Boolean",g="Number",v="String",L="Object",w="[object Function]",C="[object Boolean]",h="[object Number]",n="[object String]",j="[object Array]",B="[object Date]",k=window.JSON&&typeof JSON.stringify==="function"&&JSON.stringify(0)==="0"&&typeof JSON.stringify(Prototype.K)==="undefined";function m(N){switch(N){case null:return F;case (void 0):return q}var M=typeof N;switch(M){case"boolean":return z;case"number":return g;case"string":return v}return L}function D(M,O){for(var N in O){M[N]=O[N]}return M}function K(M){try{if(d(M)){return"undefined"}if(M===null){return"null"}return M.inspect?M.inspect():String(M)}catch(N){if(N instanceof RangeError){return"..."}throw N}}function H(M){return J("",{"":M},[])}function J(V,S,T){var U=S[V],R=typeof U;if(m(U)===L&&typeof U.toJSON==="function"){U=U.toJSON(V)}var O=G.call(U);switch(O){case h:case C:case n:U=U.valueOf()}switch(U){case null:return"null";case true:return"true";case false:return"false"}R=typeof U;switch(R){case"string":return U.inspect(true);case"number":return isFinite(U)?String(U):"null";case"object":for(var N=0,M=T.length;N<M;N++){if(T[N]===U){throw new TypeError()}}T.push(U);var Q=[];if(O===j){for(var N=0,M=U.length;N<M;N++){var P=J(N,U,T);Q.push(typeof P==="undefined"?"null":P)}Q="["+Q.join(",")+"]"}else{var W=Object.keys(U);for(var N=0,M=W.length;N<M;N++){var V=W[N],P=J(V,U,T);if(typeof P!=="undefined"){Q.push(V.inspect(true)+":"+P)}}Q="{"+Q.join(",")+"}"}T.pop();return Q}}function A(M){return JSON.stringify(M)}function l(M){return $H(M).toQueryString()}function s(M){return M&&M.toHTML?M.toHTML():String.interpret(M)}function u(M){if(m(M)!==L){throw new TypeError()}var N=[];for(var O in M){if(M.hasOwnProperty(O)){N.push(O)}}return N}function e(M){var N=[];for(var O in M){N.push(M[O])}return N}function E(M){return D({},M)}function x(M){return !!(M&&M.nodeType==1)}function o(M){return G.call(M)===j}var b=(typeof Array.isArray=="function")&&Array.isArray([])&&!Array.isArray({});if(b){o=Array.isArray}function f(M){return M instanceof Hash}function a(M){return G.call(M)===w}function p(M){return G.call(M)===n}function t(M){return G.call(M)===h}function I(M){return G.call(M)===B}function d(M){return typeof M==="undefined"}D(Object,{extend:D,inspect:K,toJSON:k?A:H,toQueryString:l,toHTML:s,keys:Object.keys||u,values:e,clone:E,isElement:x,isArray:o,isHash:f,isFunction:a,isString:p,isNumber:t,isDate:I,isUndefined:d})})();Object.extend(Function.prototype,(function(){var m=Array.prototype.slice;function e(q,n){var p=q.length,o=n.length;while(o--){q[p+o]=n[o]}return q}function k(o,n){o=m.call(o,0);return e(o,n)}function h(){var n=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g,"").replace(/\s+/g,"").split(",");return n.length==1&&!n[0]?[]:n}function j(p){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this}var n=this,o=m.call(arguments,1);return function(){var q=k(o,arguments);return n.apply(p,q)}}function g(p){var n=this,o=m.call(arguments,1);return function(s){var q=e([s||window.event],o);return n.apply(p,q)}}function l(){if(!arguments.length){return this}var n=this,o=m.call(arguments,0);return function(){var p=k(o,arguments);return n.apply(this,p)}}function f(p){var n=this,o=m.call(arguments,1);p=p*1000;return window.setTimeout(function(){return n.apply(n,o)},p)}function a(){var n=e([0.01],arguments);return this.delay.apply(this,n)}function d(o){var n=this;return function(){var p=e([n.bind(this)],arguments);return o.apply(this,p)}}function b(){if(this._methodized){return this._methodized}var n=this;return this._methodized=function(){var o=e([this],arguments);return n.apply(null,o)}}return{argumentNames:h,bind:j,bindAsEventListener:g,curry:l,delay:f,defer:a,wrap:d,methodize:b}})());(function(d){function b(){return this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+"Z"}function a(){return this.toISOString()}if(!d.toISOString){d.toISOString=b}if(!d.toJSON){d.toJSON=a}})(Date.prototype);RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};var PeriodicalExecuter=Class.create({initialize:function(b,a){this.callback=b;this.frequency=a;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},execute:function(){this.callback(this)},stop:function(){if(!this.timer){return}clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute();this.currentlyExecuting=false}catch(a){this.currentlyExecuting=false;throw a}}}});Object.extend(String,{interpret:function(a){return a==null?"":String(a)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,(function(){var NATIVE_JSON_PARSE_SUPPORT=window.JSON&&typeof JSON.parse==="function"&&JSON.parse('{"test": true}').test;function prepareReplacement(replacement){if(Object.isFunction(replacement)){return replacement}var template=new Template(replacement);return function(match){return template.evaluate(match)}}function gsub(pattern,replacement){var result="",source=this,match;replacement=prepareReplacement(replacement);if(Object.isString(pattern)){pattern=RegExp.escape(pattern)}if(!(pattern.length||pattern.source)){replacement=replacement("");return replacement+source.split("").join(replacement)+replacement}while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length)}else{result+=source,source=""}}return result}function sub(pattern,replacement,count){replacement=prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(match){if(--count<0){return match[0]}return replacement(match)})}function scan(pattern,iterator){this.gsub(pattern,iterator);return String(this)}function truncate(length,truncation){length=length||30;truncation=Object.isUndefined(truncation)?"...":truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this)}function strip(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}function stripTags(){return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,"")}function stripScripts(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")}function extractScripts(){var matchAll=new RegExp(Prototype.ScriptFragment,"img"),matchOne=new RegExp(Prototype.ScriptFragment,"im");return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||["",""])[1]})}function evalScripts(){return this.extractScripts().map(function(script){return eval(script)})}function escapeHTML(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function unescapeHTML(){return this.stripTags().replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}function toQueryParams(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match){return{}}return match[1].split(separator||"&").inject({},function(hash,pair){if((pair=pair.split("="))[0]){var key=decodeURIComponent(pair.shift()),value=pair.length>1?pair.join("="):pair[0];if(value!=undefined){value=decodeURIComponent(value)}if(key in hash){if(!Object.isArray(hash[key])){hash[key]=[hash[key]]}hash[key].push(value)}else{hash[key]=value}}return hash})}function toArray(){return this.split("")}function succ(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)}function times(count){return count<1?"":new Array(count+1).join(this)}function camelize(){return this.replace(/-+(.)?/g,function(match,chr){return chr?chr.toUpperCase():""})}function capitalize(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()}function underscore(){return this.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/-/g,"_").toLowerCase()}function dasherize(){return this.replace(/_/g,"-")}function inspect(useDoubleQuotes){var escapedString=this.replace(/[\x00-\x1f\\]/g,function(character){if(character in String.specialChar){return String.specialChar[character]}return"\\u00"+character.charCodeAt().toPaddedString(2,16)});if(useDoubleQuotes){return'"'+escapedString.replace(/"/g,'\\"')+'"'}return"'"+escapedString.replace(/'/g,"\\'")+"'"}function unfilterJSON(filter){return this.replace(filter||Prototype.JSONFilter,"$1")}function isJSON(){var str=this;if(str.blank()){return false}str=str.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@");str=str.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]");str=str.replace(/(?:^|:|,)(?:\s*\[)+/g,"");return(/^[\],:{}\s]*$/).test(str)}function evalJSON(sanitize){var json=this.unfilterJSON(),cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;if(cx.test(json)){json=json.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())}function parseJSON(){var json=this.unfilterJSON();return JSON.parse(json)}function include(pattern){return this.indexOf(pattern)>-1}function startsWith(pattern){return this.lastIndexOf(pattern,0)===0}function endsWith(pattern){var d=this.length-pattern.length;return d>=0&&this.indexOf(pattern,d)===d}function empty(){return this==""}function blank(){return/^\s*$/.test(this)}function interpolate(object,pattern){return new Template(this,pattern).evaluate(object)}return{gsub:gsub,sub:sub,scan:scan,truncate:truncate,strip:String.prototype.trim||strip,stripTags:stripTags,stripScripts:stripScripts,extractScripts:extractScripts,evalScripts:evalScripts,escapeHTML:escapeHTML,unescapeHTML:unescapeHTML,toQueryParams:toQueryParams,parseQuery:toQueryParams,toArray:toArray,succ:succ,times:times,camelize:camelize,capitalize:capitalize,underscore:underscore,dasherize:dasherize,inspect:inspect,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:NATIVE_JSON_PARSE_SUPPORT?parseJSON:evalJSON,include:include,startsWith:startsWith,endsWith:endsWith,empty:empty,blank:blank,interpolate:interpolate}})());var Template=Class.create({initialize:function(a,b){this.template=a.toString();this.pattern=b||Template.Pattern},evaluate:function(a){if(a&&Object.isFunction(a.toTemplateReplacements)){a=a.toTemplateReplacements()}return this.template.gsub(this.pattern,function(e){if(a==null){return(e[1]+"")}var g=e[1]||"";if(g=="\\"){return e[2]}var b=a,h=e[3],f=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;e=f.exec(h);if(e==null){return g}while(e!=null){var d=e[1].startsWith("[")?e[2].replace(/\\\\]/g,"]"):e[1];b=b[d];if(null==b||""==e[3]){break}h=h.substring("["==e[3]?e[1].length:e[0].length);e=f.exec(h)}return g+String.interpret(b)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable=(function(){function d(C,B){var A=0;try{this._each(function(E){C.call(B,E,A++)})}catch(D){if(D!=$break){throw D}}return this}function u(D,C,B){var A=-D,E=[],F=this.toArray();if(D<1){return F}while((A+=D)<F.length){E.push(F.slice(A,A+D))}return E.collect(C,B)}function b(C,B){C=C||Prototype.K;var A=true;this.each(function(E,D){A=A&&!!C.call(B,E,D);if(!A){throw $break}});return A}function k(C,B){C=C||Prototype.K;var A=false;this.each(function(E,D){if(A=!!C.call(B,E,D)){throw $break}});return A}function l(C,B){C=C||Prototype.K;var A=[];this.each(function(E,D){A.push(C.call(B,E,D))});return A}function w(C,B){var A;this.each(function(E,D){if(C.call(B,E,D)){A=E;throw $break}});return A}function j(C,B){var A=[];this.each(function(E,D){if(C.call(B,E,D)){A.push(E)}});return A}function h(D,C,B){C=C||Prototype.K;var A=[];if(Object.isString(D)){D=new RegExp(RegExp.escape(D))}this.each(function(F,E){if(D.match(F)){A.push(C.call(B,F,E))}});return A}function a(A){if(Object.isFunction(this.indexOf)){if(this.indexOf(A)!=-1){return true}}var B=false;this.each(function(C){if(C==A){B=true;throw $break}});return B}function t(B,A){A=Object.isUndefined(A)?null:A;return this.eachSlice(B,function(C){while(C.length<B){C.push(A)}return C})}function n(A,C,B){this.each(function(E,D){A=C.call(B,A,E,D)});return A}function z(B){var A=$A(arguments).slice(1);return this.map(function(C){return C[B].apply(C,A)})}function s(C,B){C=C||Prototype.K;var A;this.each(function(E,D){E=C.call(B,E,D);if(A==null||E>=A){A=E}});return A}function p(C,B){C=C||Prototype.K;var A;this.each(function(E,D){E=C.call(B,E,D);if(A==null||E<A){A=E}});return A}function f(D,B){D=D||Prototype.K;var C=[],A=[];this.each(function(F,E){(D.call(B,F,E)?C:A).push(F)});return[C,A]}function g(B){var A=[];this.each(function(C){A.push(C[B])});return A}function e(C,B){var A=[];this.each(function(E,D){if(!C.call(B,E,D)){A.push(E)}});return A}function o(B,A){return this.map(function(D,C){return{value:D,criteria:B.call(A,D,C)}}).sort(function(F,E){var D=F.criteria,C=E.criteria;return D<C?-1:D>C?1:0}).pluck("value")}function q(){return this.map()}function v(){var B=Prototype.K,A=$A(arguments);if(Object.isFunction(A.last())){B=A.pop()}var C=[this].concat(A).map($A);return this.map(function(E,D){return B(C.pluck(D))})}function m(){return this.toArray().length}function x(){return"#<Enumerable:"+this.toArray().inspect()+">"}return{each:d,eachSlice:u,all:b,every:b,any:k,some:k,collect:l,map:l,detect:w,findAll:j,select:j,filter:j,grep:h,include:a,member:a,inGroupsOf:t,inject:n,invoke:z,max:s,min:p,partition:f,pluck:g,reject:e,sortBy:o,toArray:q,entries:q,zip:v,size:m,inspect:x,find:w}})();function $A(d){if(!d){return[]}if("toArray" in Object(d)){return d.toArray()}var b=d.length||0,a=new Array(b);while(b--){a[b]=d[b]}return a}function $w(a){if(!Object.isString(a)){return[]}a=a.strip();return a?a.split(/\s+/):[]}Array.from=$A;(function(){var u=Array.prototype,o=u.slice,q=u.forEach;function b(A,z){for(var x=0,B=this.length>>>0;x<B;x++){if(x in this){A.call(z,this[x],x,this)}}}if(!q){q=b}function n(){this.length=0;return this}function e(){return this[0]}function h(){return this[this.length-1]}function k(){return this.select(function(x){return x!=null})}function w(){return this.inject([],function(z,x){if(Object.isArray(x)){return z.concat(x.flatten())}z.push(x);return z})}function j(){var x=o.call(arguments,0);return this.select(function(z){return !x.include(z)})}function g(x){return(x===false?this.toArray():this)._reverse()}function m(x){return this.inject([],function(B,A,z){if(0==z||(x?B.last()!=A:!B.include(A))){B.push(A)}return B})}function s(x){return this.uniq().findAll(function(z){return x.detect(function(A){return z===A})})}function t(){return o.call(this,0)}function l(){return this.length}function v(){return"["+this.map(Object.inspect).join(", ")+"]"}function a(A,x){x||(x=0);var z=this.length;if(x<0){x=z+x}for(;x<z;x++){if(this[x]===A){return x}}return -1}function p(z,x){x=isNaN(x)?this.length:(x<0?this.length+x:x)+1;var A=this.slice(0,x).reverse().indexOf(z);return(A<0)?A:x-A-1}function d(){var D=o.call(this,0),B;for(var z=0,A=arguments.length;z<A;z++){B=arguments[z];if(Object.isArray(B)&&!("callee" in B)){for(var x=0,C=B.length;x<C;x++){D.push(B[x])}}else{D.push(B)}}return D}Object.extend(u,Enumerable);if(!u._reverse){u._reverse=u.reverse}Object.extend(u,{_each:q,clear:n,first:e,last:h,compact:k,flatten:w,without:j,reverse:g,uniq:m,intersect:s,clone:t,toArray:t,size:l,inspect:v});var f=(function(){return[].concat(arguments)[0][0]!==1})(1,2);if(f){u.concat=d}if(!u.indexOf){u.indexOf=a}if(!u.lastIndexOf){u.lastIndexOf=p}})();function $H(a){return new Hash(a)}var Hash=Class.create(Enumerable,(function(){function f(s){this._object=Object.isHash(s)?s.toObject():Object.clone(s)}function g(t){for(var s in this._object){var u=this._object[s],v=[s,u];v.key=s;v.value=u;t(v)}}function l(s,t){return this._object[s]=t}function d(s){if(this._object[s]!==Object.prototype[s]){return this._object[s]}}function o(s){var t=this._object[s];delete this._object[s];return t}function q(){return Object.clone(this._object)}function p(){return this.pluck("key")}function n(){return this.pluck("value")}function h(t){var s=this.detect(function(u){return u.value===t});return s&&s.key}function k(s){return this.clone().update(s)}function e(s){return new Hash(s).inject(this,function(t,u){t.set(u.key,u.value);return t})}function b(s,t){if(Object.isUndefined(t)){return s}return s+"="+encodeURIComponent(String.interpret(t))}function a(){return this.inject([],function(w,A){var v=encodeURIComponent(A.key),t=A.value;if(t&&typeof t=="object"){if(Object.isArray(t)){var z=[];for(var u=0,s=t.length,x;u<s;u++){x=t[u];z.push(b(v,x))}return w.concat(z)}}else{w.push(b(v,t))}return w}).join("&")}function m(){return"#<Hash:{"+this.map(function(s){return s.map(Object.inspect).join(": ")}).join(", ")+"}>"}function j(){return new Hash(this)}return{initialize:f,_each:g,set:l,get:d,unset:o,toObject:q,toTemplateReplacements:q,keys:p,values:n,index:h,merge:k,update:e,toQueryString:a,inspect:m,toJSON:q,clone:j}})());Hash.from=$H;Object.extend(Number.prototype,(function(){function e(){return this.toPaddedString(2,16)}function b(){return this+1}function j(l,k){$R(0,this,true).each(l,k);return this}function h(m,l){var k=this.toString(l||10);return"0".times(m-k.length)+k}function a(){return Math.abs(this)}function d(){return Math.round(this)}function f(){return Math.ceil(this)}function g(){return Math.floor(this)}return{toColorPart:e,succ:b,times:j,toPaddedString:h,abs:a,round:d,ceil:f,floor:g}})());function $R(d,a,b){return new ObjectRange(d,a,b)}var ObjectRange=Class.create(Enumerable,(function(){function b(g,e,f){this.start=g;this.end=e;this.exclusive=f}function d(e){var f=this.start;while(this.include(f)){e(f);f=f.succ()}}function a(e){if(e<this.start){return false}if(this.exclusive){return e<this.end}return e<=this.end}return{initialize:b,_each:d,include:a}})());var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||false},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(a){this.responders._each(a)},register:function(a){if(!this.include(a)){this.responders.push(a)}},unregister:function(a){this.responders=this.responders.without(a)},dispatch:function(e,b,d,a){this.each(function(f){if(Object.isFunction(f[e])){try{f[e].apply(f,[b,d,a])}catch(g){}}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(a){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};Object.extend(this.options,a||{});this.options.method=this.options.method.toLowerCase();if(Object.isHash(this.options.parameters)){this.options.parameters=this.options.parameters.toObject()}}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function(b,a){Ajax.Base.prototype.initialize.apply(this,[a]);this.transport=Ajax.getTransport();this.request(b)},request:function(b){this.url=b;this.method=this.options.method;var f=Object.isString(this.options.parameters)?this.options.parameters:Object.toQueryString(this.options.parameters);if(!["get","post"].include(this.method)){f+=(f?"&":"")+"_method="+this.method;this.method="post"}if(f&&this.method==="get"){this.url+=(this.url.include("?")?"&":"?")+f}this.parameters=f.toQueryParams();try{var a=new Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(a)}Ajax.Responders.dispatch("onCreate",this,a);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){this.respondToReadyState.bind(this).defer(1)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?(this.options.postBody||f):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(d){this.dispatchException(d)}},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","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};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 d=this.options.requestHeaders;if(Object.isFunction(d.push)){for(var b=0,e=d.length;b<e;b+=2){f[d[b]]=d[b+1]}}else{$H(d).each(function(g){f[g.key]=g.value})}}for(var a in f){this.transport.setRequestHeader(a,f[a])}},success:function(){var a=this.getStatus();return !a||(a>=200&&a<300)||a==304},getStatus:function(){try{if(this.transport.status===1223){return 204}return this.transport.status||0}catch(a){return 0}},respondToReadyState:function(a){var d=Ajax.Request.Events[a],b=new Ajax.Response(this);if(d=="Complete"){try{this._complete=true;(this.options["on"+b.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(b,b.headerJSON)}catch(f){this.dispatchException(f)}var g=b.getHeader("Content-type");if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&g&&g.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse()}}try{(this.options["on"+d]||Prototype.emptyFunction)(b,b.headerJSON);Ajax.Responders.dispatch("on"+d,this,b,b.headerJSON)}catch(f){this.dispatchException(f)}if(d=="Complete"){this.transport.onreadystatechange=null}},isSameOrigin:function(){var a=this.url.match(/^\s*https?:\/\/[^\/]*/);return !a||(a[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""}))},getHeader:function(a){try{return this.transport.getResponseHeader(a)||null}catch(b){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(a){(this.options.onException||Prototype.emptyFunction)(this,a);Ajax.Responders.dispatch("onException",this,a)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Response=Class.create({initialize:function(d){this.request=d;var e=this.transport=d.transport,a=this.readyState=e.readyState;if((a>2&&!Prototype.Browser.IE)||a==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(e.responseText);this.headerJSON=this._getHeaderJSON()}if(a==4){var b=e.responseXML;this.responseXML=Object.isUndefined(b)?null:b;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""}catch(a){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(a){return null}},getResponseHeader:function(a){return this.transport.getResponseHeader(a)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var a=this.getHeader("X-JSON");if(!a){return null}a=decodeURIComponent(escape(a));try{return a.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}},_getResponseJSON:function(){var a=this.request.options;if(!a.evalJSON||(a.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json"))||this.responseText.blank()){return null}try{return this.responseText.evalJSON(a.sanitizeJSON||!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function(a,d,b){this.container={success:(a.success||a),failure:(a.failure||(a.success?null:a))};b=Object.clone(b);var e=b.onComplete;b.onComplete=(function(f,g){this.updateContent(f.responseText);if(Object.isFunction(e)){e(f,g)}}).bind(this);Ajax.Request.prototype.initialize.apply(this,[d,b])},updateContent:function(e){var d=this.container[this.success()?"success":"failure"],a=this.options;if(!a.evalScripts){e=e.stripScripts()}if(d=$(d)){if(a.insertion){if(Object.isString(a.insertion)){var b={};b[a.insertion]=e;d.insert(b)}else{a.insertion(d,e)}}else{d.update(e)}}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function(a,d,b){Ajax.Base.prototype.initialize.apply(this,[b]);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=a;this.url=d;this.start()},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent()},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments)},updateComplete:function(a){if(this.options.decay){this.decay=(a.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=a.responseText}this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});function $(b){if(arguments.length>1){for(var a=0,e=[],d=arguments.length;a<d;a++){e.push($(arguments[a]))}return e}if(Object.isString(b)){b=document.getElementById(b)}return Element.extend(b)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(g,a){var d=[];var f=document.evaluate(g,$(a)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var b=0,e=f.snapshotLength;b<e;b++){d.push(Element.extend(f.snapshotItem(b)))}return d}}if(!Node){var Node={}}if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12})}(function(d){function e(g,f){if(g==="select"){return false}if("type" in f){return false}return true}var b=(function(){try{var f=document.createElement('<input name="x">');return f.tagName.toLowerCase()==="input"&&f.name==="x"}catch(g){return false}})();var a=d.Element;d.Element=function(h,g){g=g||{};h=h.toLowerCase();var f=Element.cache;if(b&&g.name){h="<"+h+' name="'+g.name+'">';delete g.name;return Element.writeAttribute(document.createElement(h),g)}if(!f[h]){f[h]=Element.extend(document.createElement(h))}var j=e(h,g)?f[h].cloneNode(false):document.createElement(h);return Element.writeAttribute(j,g)};Object.extend(d.Element,a||{});if(a){d.Element.prototype=a.prototype}})(this);Element.idCounter=1;Element.cache={};Element._purgeElement=function(b){var a=b._prototypeUID;if(a){Element.stopObserving(b);b._prototypeUID=void 0;delete Element.Storage[a]}};Element.Methods={visible:function(a){return $(a).style.display!="none"},toggle:function(a){a=$(a);Element[Element.visible(a)?"hide":"show"](a);return a},hide:function(a){a=$(a);a.style.display="none";return a},show:function(a){a=$(a);a.style.display="";return a},remove:function(a){a=$(a);a.parentNode.removeChild(a);return a},update:(function(){var e=(function(){var h=document.createElement("select"),j=true;h.innerHTML='<option value="test">test</option>';if(h.options&&h.options[0]){j=h.options[0].nodeName.toUpperCase()!=="OPTION"}h=null;return j})();var b=(function(){try{var h=document.createElement("table");if(h&&h.tBodies){h.innerHTML="<tbody><tr><td>test</td></tr></tbody>";var k=typeof h.tBodies[0]=="undefined";h=null;return k}}catch(j){return true}})();var a=(function(){try{var h=document.createElement("div");h.innerHTML="<link>";var k=(h.childNodes.length===0);h=null;return k}catch(j){return true}})();var d=e||b||a;var g=(function(){var h=document.createElement("script"),k=false;try{h.appendChild(document.createTextNode(""));k=!h.firstChild||h.firstChild&&h.firstChild.nodeType!==3}catch(j){k=true}h=null;return k})();function f(m,n){m=$(m);var h=Element._purgeElement;var o=m.getElementsByTagName("*"),l=o.length;while(l--){h(o[l])}if(n&&n.toElement){n=n.toElement()}if(Object.isElement(n)){return m.update().insert(n)}n=Object.toHTML(n);var k=m.tagName.toUpperCase();if(k==="SCRIPT"&&g){m.text=n;return m}if(d){if(k in Element._insertionTranslations.tags){while(m.firstChild){m.removeChild(m.firstChild)}Element._getContentFromAnonymousElement(k,n.stripScripts()).each(function(p){m.appendChild(p)})}else{if(a&&Object.isString(n)&&n.indexOf("<link")>-1){while(m.firstChild){m.removeChild(m.firstChild)}var j=Element._getContentFromAnonymousElement(k,n.stripScripts(),true);j.each(function(p){m.appendChild(p)})}else{m.innerHTML=n.stripScripts()}}}else{m.innerHTML=n.stripScripts()}n.evalScripts.bind(n).defer();return m}return f})(),replace:function(b,d){b=$(b);if(d&&d.toElement){d=d.toElement()}else{if(!Object.isElement(d)){d=Object.toHTML(d);var a=b.ownerDocument.createRange();a.selectNode(b);d.evalScripts.bind(d).defer();d=a.createContextualFragment(d.stripScripts())}}b.parentNode.replaceChild(d,b);return b},insert:function(d,f){d=$(d);if(Object.isString(f)||Object.isNumber(f)||Object.isElement(f)||(f&&(f.toElement||f.toHTML))){f={bottom:f}}var e,g,b,h;for(var a in f){e=f[a];a=a.toLowerCase();g=Element._insertionTranslations[a];if(e&&e.toElement){e=e.toElement()}if(Object.isElement(e)){g(d,e);continue}e=Object.toHTML(e);b=((a=="before"||a=="after")?d.parentNode:d).tagName.toUpperCase();h=Element._getContentFromAnonymousElement(b,e.stripScripts());if(a=="top"||a=="after"){h.reverse()}h.each(g.curry(d));e.evalScripts.bind(e).defer()}return d},wrap:function(b,d,a){b=$(b);if(Object.isElement(d)){$(d).writeAttribute(a||{})}else{if(Object.isString(d)){d=new Element(d,a)}else{d=new Element("div",d)}}if(b.parentNode){b.parentNode.replaceChild(d,b)}d.appendChild(b);return d},inspect:function(b){b=$(b);var a="<"+b.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(g){var f=g.first(),d=g.last(),e=(b[f]||"").toString();if(e){a+=" "+d+"="+e.inspect(true)}});return a+">"},recursivelyCollect:function(a,d,e){a=$(a);e=e||-1;var b=[];while(a=a[d]){if(a.nodeType==1){b.push(Element.extend(a))}if(b.length==e){break}}return b},ancestors:function(a){return Element.recursivelyCollect(a,"parentNode")},descendants:function(a){return Element.select(a,"*")},firstDescendant:function(a){a=$(a).firstChild;while(a&&a.nodeType!=1){a=a.nextSibling}return $(a)},immediateDescendants:function(b){var a=[],d=$(b).firstChild;while(d){if(d.nodeType===1){a.push(Element.extend(d))}d=d.nextSibling}return a},previousSiblings:function(a,b){return Element.recursivelyCollect(a,"previousSibling")},nextSiblings:function(a){return Element.recursivelyCollect(a,"nextSibling")},siblings:function(a){a=$(a);return Element.previousSiblings(a).reverse().concat(Element.nextSiblings(a))},match:function(b,a){b=$(b);if(Object.isString(a)){return Prototype.Selector.match(b,a)}return a.match(b)},up:function(b,e,a){b=$(b);if(arguments.length==1){return $(b.parentNode)}var d=Element.ancestors(b);return Object.isNumber(e)?d[e]:Prototype.Selector.find(d,e,a)},down:function(b,d,a){b=$(b);if(arguments.length==1){return Element.firstDescendant(b)}return Object.isNumber(d)?Element.descendants(b)[d]:Element.select(b,d)[a||0]},previous:function(b,d,a){b=$(b);if(Object.isNumber(d)){a=d,d=false}if(!Object.isNumber(a)){a=0}if(d){return Prototype.Selector.find(b.previousSiblings(),d,a)}else{return b.recursivelyCollect("previousSibling",a+1)[a]}},next:function(b,e,a){b=$(b);if(Object.isNumber(e)){a=e,e=false}if(!Object.isNumber(a)){a=0}if(e){return Prototype.Selector.find(b.nextSiblings(),e,a)}else{var d=Object.isNumber(a)?a+1:1;return b.recursivelyCollect("nextSibling",a+1)[a]}},select:function(a){a=$(a);var b=Array.prototype.slice.call(arguments,1).join(", ");return Prototype.Selector.select(b,a)},adjacent:function(a){a=$(a);var b=Array.prototype.slice.call(arguments,1).join(", ");return Prototype.Selector.select(b,a.parentNode).without(a)},identify:function(a){a=$(a);var b=Element.readAttribute(a,"id");if(b){return b}do{b="anonymous_element_"+Element.idCounter++}while($(b));Element.writeAttribute(a,"id",b);return b},readAttribute:function(d,a){d=$(d);if(Prototype.Browser.IE){var b=Element._attributeTranslations.read;if(b.values[a]){return b.values[a](d,a)}if(b.names[a]){a=b.names[a]}if(a.include(":")){return(!d.attributes||!d.attributes[a])?null:d.attributes[a].value}}return d.getAttribute(a)},writeAttribute:function(f,d,g){f=$(f);var b={},e=Element._attributeTranslations.write;if(typeof d=="object"){b=d}else{b[d]=Object.isUndefined(g)?true:g}for(var a in b){d=e.names[a]||a;g=b[a];if(e.values[a]){d=e.values[a](f,g)}if(g===false||g===null){f.removeAttribute(d)}else{if(g===true){f.setAttribute(d,d)}else{f.setAttribute(d,g)}}}return f},getHeight:function(a){return Element.getDimensions(a).height},getWidth:function(a){return Element.getDimensions(a).width},classNames:function(a){return new Element.ClassNames(a)},hasClassName:function(a,b){if(!(a=$(a))){return}var d=a.className;return(d.length>0&&(d==b||new RegExp("(^|\\s)"+b+"(\\s|$)").test(d)))},addClassName:function(a,b){if(!(a=$(a))){return}if(!Element.hasClassName(a,b)){a.className+=(a.className?" ":"")+b}return a},removeClassName:function(a,b){if(!(a=$(a))){return}a.className=a.className.replace(new RegExp("(^|\\s+)"+b+"(\\s+|$)")," ").strip();return a},toggleClassName:function(a,b){if(!(a=$(a))){return}return Element[Element.hasClassName(a,b)?"removeClassName":"addClassName"](a,b)},cleanWhitespace:function(b){b=$(b);var d=b.firstChild;while(d){var a=d.nextSibling;if(d.nodeType==3&&!/\S/.test(d.nodeValue)){b.removeChild(d)}d=a}return b},empty:function(a){return $(a).innerHTML.blank()},descendantOf:function(b,a){b=$(b),a=$(a);if(b.compareDocumentPosition){return(b.compareDocumentPosition(a)&8)===8}if(a.contains){return a.contains(b)&&a!==b}while(b=b.parentNode){if(b==a){return true}}return false},scrollTo:function(a){a=$(a);var b=Element.cumulativeOffset(a);window.scrollTo(b[0],b[1]);return a},getStyle:function(b,d){b=$(b);d=d=="float"?"cssFloat":d.camelize();var e=b.style[d];if(!e||e=="auto"){var a=document.defaultView.getComputedStyle(b,null);e=a?a[d]:null}if(d=="opacity"){return e?parseFloat(e):1}return e=="auto"?null:e},getOpacity:function(a){return $(a).getStyle("opacity")},setStyle:function(b,d){b=$(b);var f=b.style,a;if(Object.isString(d)){b.style.cssText+=";"+d;return d.include("opacity")?b.setOpacity(d.match(/opacity:\s*(\d?\.?\d*)/)[1]):b}for(var e in d){if(e=="opacity"){b.setOpacity(d[e])}else{f[(e=="float"||e=="cssFloat")?(Object.isUndefined(f.styleFloat)?"cssFloat":"styleFloat"):e]=d[e]}}return b},setOpacity:function(a,b){a=$(a);a.style.opacity=(b==1||b==="")?"":(b<0.00001)?0:b;return a},makePositioned:function(a){a=$(a);var b=Element.getStyle(a,"position");if(b=="static"||!b){a._madePositioned=true;a.style.position="relative";if(Prototype.Browser.Opera){a.style.top=0;a.style.left=0}}return a},undoPositioned:function(a){a=$(a);if(a._madePositioned){a._madePositioned=undefined;a.style.position=a.style.top=a.style.left=a.style.bottom=a.style.right=""}return a},makeClipping:function(a){a=$(a);if(a._overflow){return a}a._overflow=Element.getStyle(a,"overflow")||"auto";if(a._overflow!=="hidden"){a.style.overflow="hidden"}return a},undoClipping:function(a){a=$(a);if(!a._overflow){return a}a.style.overflow=a._overflow=="auto"?"":a._overflow;a._overflow=null;return a},clonePosition:function(b,e){var a=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});e=$(e);var f=Element.viewportOffset(e),g=[0,0],d=null;b=$(b);if(Element.getStyle(b,"position")=="absolute"){d=Element.getOffsetParent(b);g=Element.viewportOffset(d)}if(d==document.body){g[0]-=document.body.offsetLeft;g[1]-=document.body.offsetTop}if(a.setLeft){b.style.left=(f[0]-g[0]+a.offsetLeft)+"px"}if(a.setTop){b.style.top=(f[1]-g[1]+a.offsetTop)+"px"}if(a.setWidth){b.style.width=e.offsetWidth+"px"}if(a.setHeight){b.style.height=e.offsetHeight+"px"}return b}};Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(e,b,d){switch(d){case"height":case"width":if(!Element.visible(b)){return null}var f=parseInt(e(b,d),10);if(f!==b["offset"+d.capitalize()]){return f+"px"}var a;if(d==="height"){a=["border-top-width","padding-top","padding-bottom","border-bottom-width"]}else{a=["border-left-width","padding-left","padding-right","border-right-width"]}return a.inject(f,function(g,h){var j=e(b,h);return j===null?g:g-parseInt(j,10)})+"px";default:return e(b,d)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(d,a,b){if(b==="title"){return a.title}return d(a,b)})}else{if(Prototype.Browser.IE){Element.Methods.getStyle=function(a,b){a=$(a);b=(b=="float"||b=="cssFloat")?"styleFloat":b.camelize();var d=a.style[b];if(!d&&a.currentStyle){d=a.currentStyle[b]}if(b=="opacity"){if(d=(a.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(d[1]){return parseFloat(d[1])/100}}return 1}if(d=="auto"){if((b=="width"||b=="height")&&(a.getStyle("display")!="none")){return a["offset"+b.capitalize()]+"px"}return null}return d};Element.Methods.setOpacity=function(b,f){function g(h){return h.replace(/alpha\([^\)]*\)/gi,"")}b=$(b);var a=b.currentStyle;if((a&&!a.hasLayout)||(!a&&b.style.zoom=="normal")){b.style.zoom=1}var e=b.getStyle("filter"),d=b.style;if(f==1||f===""){(e=g(e))?d.filter=e:d.removeAttribute("filter");return b}else{if(f<0.00001){f=0}}d.filter=g(e)+"alpha(opacity="+(f*100)+")";return b};Element._attributeTranslations=(function(){var b="className",a="for",d=document.createElement("div");d.setAttribute(b,"x");if(d.className!=="x"){d.setAttribute("class","x");if(d.className==="x"){b="class"}}d=null;d=document.createElement("label");d.setAttribute(a,"x");if(d.htmlFor!=="x"){d.setAttribute("htmlFor","x");if(d.htmlFor==="x"){a="htmlFor"}}d=null;return{read:{names:{"class":b,className:b,"for":a,htmlFor:a},values:{_getAttr:function(e,f){return e.getAttribute(f)},_getAttr2:function(e,f){return e.getAttribute(f,2)},_getAttrNode:function(e,g){var f=e.getAttributeNode(g);return f?f.value:""},_getEv:(function(){var e=document.createElement("div"),h;e.onclick=Prototype.emptyFunction;var g=e.getAttribute("onclick");if(String(g).indexOf("{")>-1){h=function(f,j){j=f.getAttribute(j);if(!j){return null}j=j.toString();j=j.split("{")[1];j=j.split("}")[0];return j.strip()}}else{if(g===""){h=function(f,j){j=f.getAttribute(j);if(!j){return null}return j.strip()}}}e=null;return h})(),_flag:function(e,f){return $(e).hasAttribute(f)?f:null},style:function(e){return e.style.cssText.toLowerCase()},title:function(e){return e.title}}}}})();Element._attributeTranslations.write={names:Object.extend({cellpadding:"cellPadding",cellspacing:"cellSpacing"},Element._attributeTranslations.read.names),values:{checked:function(a,b){a.checked=!!b},style:function(a,b){a.style.cssText=b?b:""}}};Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder").each(function(a){Element._attributeTranslations.write.names[a.toLowerCase()]=a;Element._attributeTranslations.has[a.toLowerCase()]=a});(function(a){Object.extend(a,{href:a._getAttr2,src:a._getAttr2,type:a._getAttr,action:a._getAttrNode,disabled:a._flag,checked:a._flag,readonly:a._flag,multiple:a._flag,onload:a._getEv,onunload:a._getEv,onclick:a._getEv,ondblclick:a._getEv,onmousedown:a._getEv,onmouseup:a._getEv,onmouseover:a._getEv,onmousemove:a._getEv,onmouseout:a._getEv,onfocus:a._getEv,onblur:a._getEv,onkeypress:a._getEv,onkeydown:a._getEv,onkeyup:a._getEv,onsubmit:a._getEv,onreset:a._getEv,onselect:a._getEv,onchange:a._getEv})})(Element._attributeTranslations.read.values);if(Prototype.BrowserFeatures.ElementExtensions){(function(){function a(f){var b=f.getElementsByTagName("*"),e=[];for(var d=0,g;g=b[d];d++){if(g.tagName!=="!"){e.push(g)}}return e}Element.Methods.down=function(d,e,b){d=$(d);if(arguments.length==1){return d.firstDescendant()}return Object.isNumber(e)?a(d)[e]:Element.select(d,e)[b||0]}})()}}else{if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=(b==1)?0.999999:(b==="")?"":(b<0.00001)?0:b;return a}}else{if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=(b==1||b==="")?"":(b<0.00001)?0:b;if(b==1){if(a.tagName.toUpperCase()=="IMG"&&a.width){a.width++;a.width--}else{try{var f=document.createTextNode(" ");a.appendChild(f);a.removeChild(f)}catch(d){}}}return a}}}}}if("outerHTML" in document.documentElement){Element.Methods.replace=function(d,f){d=$(d);if(f&&f.toElement){f=f.toElement()}if(Object.isElement(f)){d.parentNode.replaceChild(f,d);return d}f=Object.toHTML(f);var e=d.parentNode,b=e.tagName.toUpperCase();if(Element._insertionTranslations.tags[b]){var g=d.next(),a=Element._getContentFromAnonymousElement(b,f.stripScripts());e.removeChild(d);if(g){a.each(function(h){e.insertBefore(h,g)})}else{a.each(function(h){e.appendChild(h)})}}else{d.outerHTML=f.stripScripts()}f.evalScripts.bind(f).defer();return d}}Element._returnOffset=function(b,d){var a=[b,d];a.left=b;a.top=d;return a};Element._getContentFromAnonymousElement=function(f,e,g){var h=new Element("div"),d=Element._insertionTranslations.tags[f];var a=false;if(d){a=true}else{if(g){a=true;d=["","",0]}}if(a){h.innerHTML="&nbsp;"+d[0]+e+d[1];h.removeChild(h.firstChild);for(var b=d[2];b--;){h=h.firstChild}}else{h.innerHTML=e}return $A(h.childNodes)};Element._insertionTranslations={before:function(a,b){a.parentNode.insertBefore(b,a)},top:function(a,b){a.insertBefore(b,a.firstChild)},bottom:function(a,b){a.appendChild(b)},after:function(a,b){a.parentNode.insertBefore(b,a.nextSibling)},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};(function(){var a=Element._insertionTranslations.tags;Object.extend(a,{THEAD:a.TBODY,TFOOT:a.TBODY,TH:a.TD})})();Element.Methods.Simulated={hasAttribute:function(a,d){d=Element._attributeTranslations.has[d]||d;var b=$(a).getAttributeNode(d);return !!(b&&b.specified)}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);(function(a){if(!Prototype.BrowserFeatures.ElementExtensions&&a.__proto__){window.HTMLElement={};window.HTMLElement.prototype=a.__proto__;Prototype.BrowserFeatures.ElementExtensions=true}a=null})(document.createElement("div"));Element.extend=(function(){function d(h){if(typeof window.Element!="undefined"){var k=window.Element.prototype;if(k){var m="_"+(Math.random()+"").slice(2),j=document.createElement(h);k[m]="x";var l=(j[m]!=="x");delete k[m];j=null;return l}}return false}function b(j,h){for(var l in h){var k=h[l];if(Object.isFunction(k)&&!(l in j)){j[l]=k.methodize()}}}var e=d("object");if(Prototype.BrowserFeatures.SpecificElementExtensions){if(e){return function(j){if(j&&typeof j._extendedByPrototype=="undefined"){var h=j.tagName;if(h&&(/^(?:object|applet|embed)$/i.test(h))){b(j,Element.Methods);b(j,Element.Methods.Simulated);b(j,Element.Methods.ByTag[h.toUpperCase()])}}return j}}return Prototype.K}var a={},f=Element.Methods.ByTag;var g=Object.extend(function(k){if(!k||typeof k._extendedByPrototype!="undefined"||k.nodeType!=1||k==window){return k}var h=Object.clone(a),j=k.tagName.toUpperCase();if(f[j]){Object.extend(h,f[j])}b(k,h);k._extendedByPrototype=Prototype.emptyFunction;return k},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(a,Element.Methods);Object.extend(a,Element.Methods.Simulated)}}});g.refresh();return g})();if(document.documentElement.hasAttribute){Element.hasAttribute=function(a,b){return a.hasAttribute(b)}}else{Element.hasAttribute=Element.Methods.Simulated.hasAttribute}Element.addMethods=function(d){var k=Prototype.BrowserFeatures,e=Element.Methods.ByTag;if(!d){Object.extend(Form,Form.Methods);Object.extend(Form.Element,Form.Element.Methods);Object.extend(Element.Methods.ByTag,{FORM:Object.clone(Form.Methods),INPUT:Object.clone(Form.Element.Methods),SELECT:Object.clone(Form.Element.Methods),TEXTAREA:Object.clone(Form.Element.Methods),BUTTON:Object.clone(Form.Element.Methods)})}if(arguments.length==2){var b=d;d=arguments[1]}if(!b){Object.extend(Element.Methods,d||{})}else{if(Object.isArray(b)){b.each(h)}else{h(b)}}function h(m){m=m.toUpperCase();if(!Element.Methods.ByTag[m]){Element.Methods.ByTag[m]={}}Object.extend(Element.Methods.ByTag[m],d)}function a(o,n,m){m=m||false;for(var q in o){var p=o[q];if(!Object.isFunction(p)){continue}if(!m||!(q in n)){n[q]=p.methodize()}}}function f(p){var m;var o={OPTGROUP:"OptGroup",TEXTAREA:"TextArea",P:"Paragraph",FIELDSET:"FieldSet",UL:"UList",OL:"OList",DL:"DList",DIR:"Directory",H1:"Heading",H2:"Heading",H3:"Heading",H4:"Heading",H5:"Heading",H6:"Heading",Q:"Quote",INS:"Mod",DEL:"Mod",A:"Anchor",IMG:"Image",CAPTION:"TableCaption",COL:"TableCol",COLGROUP:"TableCol",THEAD:"TableSection",TFOOT:"TableSection",TBODY:"TableSection",TR:"TableRow",TH:"TableCell",TD:"TableCell",FRAMESET:"FrameSet",IFRAME:"IFrame"};if(o[p]){m="HTML"+o[p]+"Element"}if(window[m]){return window[m]}m="HTML"+p+"Element";if(window[m]){return window[m]}m="HTML"+p.capitalize()+"Element";if(window[m]){return window[m]}var n=document.createElement(p),q=n.__proto__||n.constructor.prototype;n=null;return q}var j=window.HTMLElement?HTMLElement.prototype:Element.prototype;if(k.ElementExtensions){a(Element.Methods,j);a(Element.Methods.Simulated,j,true)}if(k.SpecificElementExtensions){for(var l in Element.Methods.ByTag){var g=f(l);if(Object.isUndefined(g)){continue}a(e[l],g.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh){Element.extend.refresh()}Element.cache={}};document.viewport={getDimensions:function(){return{width:this.getWidth(),height:this.getHeight()}},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};(function(b){var h=Prototype.Browser,f=document,d,e={};function a(){if(h.WebKit&&!f.evaluate){return document}if(h.Opera&&window.parseFloat(window.opera.version())<9.5){return document.body}return document.documentElement}function g(j){if(!d){d=a()}e[j]="client"+j;b["get"+j]=function(){return d[e[j]]};return b["get"+j]()}b.getWidth=g.curry("Width");b.getHeight=g.curry("Height")})(document.viewport);Element.Storage={UID:1};Element.addMethods({getStorage:function(b){if(!(b=$(b))){return}var a;if(b===window){a=0}else{if(typeof b._prototypeUID==="undefined"){b._prototypeUID=Element.Storage.UID++}a=b._prototypeUID}if(!Element.Storage[a]){Element.Storage[a]=$H()}return Element.Storage[a]},store:function(b,a,d){if(!(b=$(b))){return}if(arguments.length===2){Element.getStorage(b).update(a)}else{Element.getStorage(b).set(a,d)}return b},retrieve:function(d,b,a){if(!(d=$(d))){return}var f=Element.getStorage(d),e=f.get(b);if(Object.isUndefined(e)){f.set(b,a);e=a}return e},clone:function(d,a){if(!(d=$(d))){return}var f=d.cloneNode(a);f._prototypeUID=void 0;if(a){var e=Element.select(f,"*"),b=e.length;while(b--){e[b]._prototypeUID=void 0}}return Element.extend(f)},purge:function(d){if(!(d=$(d))){return}var a=Element._purgeElement;a(d);var e=d.getElementsByTagName("*"),b=e.length;while(b--){a(e[b])}return null}});(function(){function j(z){var x=z.match(/^(\d+)%?$/i);if(!x){return null}return(Number(x[1])/100)}function q(J,K,z){var C=null;if(Object.isElement(J)){C=J;J=C.getStyle(K)}if(J===null){return null}if((/^(?:-)?\d+(\.\d+)?(px)?$/i).test(J)){return window.parseFloat(J)}var E=J.include("%"),A=(z===document.viewport);if(/\d/.test(J)&&C&&C.runtimeStyle&&!(E&&A)){var x=C.style.left,I=C.runtimeStyle.left;C.runtimeStyle.left=C.currentStyle.left;C.style.left=J||0;J=C.style.pixelLeft;C.style.left=x;C.runtimeStyle.left=I;return J}if(C&&E){z=z||C.parentNode;var B=j(J);var F=null;var D=C.getStyle("position");var H=K.include("left")||K.include("right")||K.include("width");var G=K.include("top")||K.include("bottom")||K.include("height");if(z===document.viewport){if(H){F=document.viewport.getWidth()}else{if(G){F=document.viewport.getHeight()}}}else{if(H){F=$(z).measure("width")}else{if(G){F=$(z).measure("height")}}}return(F===null)?0:F*B}return 0}function h(x){if(Object.isString(x)&&x.endsWith("px")){return x}return x+"px"}function l(z){var x=z;while(z&&z.parentNode){var A=z.getStyle("display");if(A==="none"){return false}z=$(z.parentNode)}return true}var e=Prototype.K;if("currentStyle" in document.documentElement){e=function(x){if(!x.currentStyle.hasLayout){x.style.zoom=1}return x}}function g(x){if(x.include("border")){x=x+"-width"}return x.camelize()}Element.Layout=Class.create(Hash,{initialize:function(z,x){Hash.prototype.initialize.apply(this);this.element=$(z);Element.Layout.PROPERTIES.each(function(A){this._set(A,null)},this);if(x){this._preComputing=true;this._begin();Element.Layout.PROPERTIES.each(this._compute,this);this._end();this._preComputing=false}},_set:function(z,x){return Hash.prototype.set.call(this,z,x)},set:function(z,x){throw"Properties of Element.Layout are read-only."},get:function(z){var x=Hash.prototype.get.apply(this,[z]);return x===null?this._compute(z):x},_begin:function(){if(this._prepared){return}var C=this.element;if(l(C)){this._prepared=true;return}var E={position:C.style.position||"",width:C.style.width||"",visibility:C.style.visibility||"",display:C.style.display||""};C.store("prototype_original_styles",E);var F=C.getStyle("position"),x=C.getStyle("width");if(x==="0px"||x===null){C.style.display="block";x=C.getStyle("width")}var z=(F==="fixed")?document.viewport:C.parentNode;C.setStyle({position:"absolute",visibility:"hidden",display:"block"});var A=C.getStyle("width");var B;if(x&&(A===x)){B=q(C,"width",z)}else{if(F==="absolute"||F==="fixed"){B=q(C,"width",z)}else{var G=C.parentNode,D=$(G).getLayout();B=D.get("width")-this.get("margin-left")-this.get("border-left")-this.get("padding-left")-this.get("padding-right")-this.get("border-right")-this.get("margin-right")}}C.setStyle({width:B+"px"});this._prepared=true},_end:function(){var z=this.element;var x=z.retrieve("prototype_original_styles");z.store("prototype_original_styles",null);z.setStyle(x);this._prepared=false},_compute:function(z){var x=Element.Layout.COMPUTATIONS;if(!(z in x)){throw"Property not found."}return this._set(z,x[z].call(this,this.element))},toObject:function(){var x=$A(arguments);var z=(x.length===0)?Element.Layout.PROPERTIES:x.join(" ").split(" ");var A={};z.each(function(B){if(!Element.Layout.PROPERTIES.include(B)){return}var C=this.get(B);if(C!=null){A[B]=C}},this);return A},toHash:function(){var x=this.toObject.apply(this,arguments);return new Hash(x)},toCSS:function(){var x=$A(arguments);var A=(x.length===0)?Element.Layout.PROPERTIES:x.join(" ").split(" ");var z={};A.each(function(B){if(!Element.Layout.PROPERTIES.include(B)){return}if(Element.Layout.COMPOSITE_PROPERTIES.include(B)){return}var C=this.get(B);if(C!=null){z[g(B)]=C+"px"}},this);return z},inspect:function(){return"#<Element.Layout>"}});Object.extend(Element.Layout,{PROPERTIES:$w("height width top left right bottom border-left border-right border-top border-bottom padding-left padding-right padding-top padding-bottom margin-top margin-bottom margin-left margin-right padding-box-width padding-box-height border-box-width border-box-height margin-box-width margin-box-height"),COMPOSITE_PROPERTIES:$w("padding-box-width padding-box-height margin-box-width margin-box-height border-box-width border-box-height"),COMPUTATIONS:{height:function(A){if(!this._preComputing){this._begin()}var x=this.get("border-box-height");if(x<=0){if(!this._preComputing){this._end()}return 0}var B=this.get("border-top"),z=this.get("border-bottom");var D=this.get("padding-top"),C=this.get("padding-bottom");if(!this._preComputing){this._end()}return x-B-z-D-C},width:function(A){if(!this._preComputing){this._begin()}var z=this.get("border-box-width");if(z<=0){if(!this._preComputing){this._end()}return 0}var D=this.get("border-left"),x=this.get("border-right");var B=this.get("padding-left"),C=this.get("padding-right");if(!this._preComputing){this._end()}return z-D-x-B-C},"padding-box-height":function(z){var x=this.get("height"),B=this.get("padding-top"),A=this.get("padding-bottom");return x+B+A},"padding-box-width":function(x){var z=this.get("width"),A=this.get("padding-left"),B=this.get("padding-right");return z+A+B},"border-box-height":function(z){if(!this._preComputing){this._begin()}var x=z.offsetHeight;if(!this._preComputing){this._end()}return x},"border-box-width":function(x){if(!this._preComputing){this._begin()}var z=x.offsetWidth;if(!this._preComputing){this._end()}return z},"margin-box-height":function(z){var x=this.get("border-box-height"),A=this.get("margin-top"),B=this.get("margin-bottom");if(x<=0){return 0}return x+A+B},"margin-box-width":function(A){var z=this.get("border-box-width"),B=this.get("margin-left"),x=this.get("margin-right");if(z<=0){return 0}return z+B+x},top:function(x){var z=x.positionedOffset();return z.top},bottom:function(x){var B=x.positionedOffset(),z=x.getOffsetParent(),A=z.measure("height");var C=this.get("border-box-height");return A-C-B.top},left:function(x){var z=x.positionedOffset();return z.left},right:function(A){var C=A.positionedOffset(),B=A.getOffsetParent(),x=B.measure("width");var z=this.get("border-box-width");return x-z-C.left},"padding-top":function(x){return q(x,"paddingTop")},"padding-bottom":function(x){return q(x,"paddingBottom")},"padding-left":function(x){return q(x,"paddingLeft")},"padding-right":function(x){return q(x,"paddingRight")},"border-top":function(x){return q(x,"borderTopWidth")},"border-bottom":function(x){return q(x,"borderBottomWidth")},"border-left":function(x){return q(x,"borderLeftWidth")},"border-right":function(x){return q(x,"borderRightWidth")},"margin-top":function(x){return q(x,"marginTop")},"margin-bottom":function(x){return q(x,"marginBottom")},"margin-left":function(x){return q(x,"marginLeft")},"margin-right":function(x){return q(x,"marginRight")}}});if("getBoundingClientRect" in document.documentElement){Object.extend(Element.Layout.COMPUTATIONS,{right:function(z){var A=e(z.getOffsetParent());var B=z.getBoundingClientRect(),x=A.getBoundingClientRect();return(x.right-B.right).round()},bottom:function(z){var A=e(z.getOffsetParent());var B=z.getBoundingClientRect(),x=A.getBoundingClientRect();return(x.bottom-B.bottom).round()}})}Element.Offset=Class.create({initialize:function(z,x){this.left=z.round();this.top=x.round();this[0]=this.left;this[1]=this.top},relativeTo:function(x){return new Element.Offset(this.left-x.left,this.top-x.top)},inspect:function(){return"#<Element.Offset left: #{left} top: #{top}>".interpolate(this)},toString:function(){return"[#{left}, #{top}]".interpolate(this)},toArray:function(){return[this.left,this.top]}});function u(z,x){return new Element.Layout(z,x)}function b(x,z){return $(x).getLayout().get(z)}function p(z){z=$(z);var D=Element.getStyle(z,"display");if(D&&D!=="none"){return{width:z.offsetWidth,height:z.offsetHeight}}var A=z.style;var x={visibility:A.visibility,position:A.position,display:A.display};var C={visibility:"hidden",display:"block"};if(x.position!=="fixed"){C.position="absolute"}Element.setStyle(z,C);var B={width:z.offsetWidth,height:z.offsetHeight};Element.setStyle(z,x);return B}function n(x){x=$(x);if(f(x)||d(x)||o(x)||m(x)){return $(document.body)}var z=(Element.getStyle(x,"display")==="inline");if(!z&&x.offsetParent){return $(x.offsetParent)}while((x=x.parentNode)&&x!==document.body){if(Element.getStyle(x,"position")!=="static"){return m(x)?$(document.body):$(x)}}return $(document.body)}function w(z){z=$(z);var x=0,A=0;if(z.parentNode){do{x+=z.offsetTop||0;A+=z.offsetLeft||0;z=z.offsetParent}while(z)}return new Element.Offset(A,x)}function s(z){z=$(z);var A=z.getLayout();var x=0,C=0;do{x+=z.offsetTop||0;C+=z.offsetLeft||0;z=z.offsetParent;if(z){if(o(z)){break}var B=Element.getStyle(z,"position");if(B!=="static"){break}}}while(z);C-=A.get("margin-top");x-=A.get("margin-left");return new Element.Offset(C,x)}function a(z){var x=0,A=0;do{x+=z.scrollTop||0;A+=z.scrollLeft||0;z=z.parentNode}while(z);return new Element.Offset(A,x)}function v(C){z=$(z);var x=0,B=0,A=document.body;var z=C;do{x+=z.offsetTop||0;B+=z.offsetLeft||0;if(z.offsetParent==A&&Element.getStyle(z,"position")=="absolute"){break}}while(z=z.offsetParent);z=C;do{if(z!=A){x-=z.scrollTop||0;B-=z.scrollLeft||0}}while(z=z.parentNode);return new Element.Offset(B,x)}function t(x){x=$(x);if(Element.getStyle(x,"position")==="absolute"){return x}var C=n(x);var B=x.viewportOffset(),z=C.viewportOffset();var D=B.relativeTo(z);var A=x.getLayout();x.store("prototype_absolutize_original_styles",{left:x.getStyle("left"),top:x.getStyle("top"),width:x.getStyle("width"),height:x.getStyle("height")});x.setStyle({position:"absolute",top:D.top+"px",left:D.left+"px",width:A.get("width")+"px",height:A.get("height")+"px"});return x}function k(z){z=$(z);if(Element.getStyle(z,"position")==="relative"){return z}var x=z.retrieve("prototype_absolutize_original_styles");if(x){z.setStyle(x)}return z}if(Prototype.Browser.IE){n=n.wrap(function(A,z){z=$(z);if(f(z)||d(z)||o(z)||m(z)){return $(document.body)}var x=z.getStyle("position");if(x!=="static"){return A(z)}z.setStyle({position:"relative"});var B=A(z);z.setStyle({position:x});return B});s=s.wrap(function(B,z){z=$(z);if(!z.parentNode){return new Element.Offset(0,0)}var x=z.getStyle("position");if(x!=="static"){return B(z)}var A=z.getOffsetParent();if(A&&A.getStyle("position")==="fixed"){e(A)}z.setStyle({position:"relative"});var C=B(z);z.setStyle({position:x});return C})}else{if(Prototype.Browser.Webkit){w=function(z){z=$(z);var x=0,A=0;do{x+=z.offsetTop||0;A+=z.offsetLeft||0;if(z.offsetParent==document.body){if(Element.getStyle(z,"position")=="absolute"){break}}z=z.offsetParent}while(z);return new Element.Offset(A,x)}}}Element.addMethods({getLayout:u,measure:b,getDimensions:p,getOffsetParent:n,cumulativeOffset:w,positionedOffset:s,cumulativeScrollOffset:a,viewportOffset:v,absolutize:t,relativize:k});function o(x){return x.nodeName.toUpperCase()==="BODY"}function m(x){return x.nodeName.toUpperCase()==="HTML"}function f(x){return x.nodeType===Node.DOCUMENT_NODE}function d(x){return x!==document.body&&!Element.descendantOf(x,document.body)}if("getBoundingClientRect" in document.documentElement){Element.addMethods({viewportOffset:function(x){x=$(x);if(d(x)){return new Element.Offset(0,0)}var z=x.getBoundingClientRect(),A=document.documentElement;return new Element.Offset(z.left-A.clientLeft,z.top-A.clientTop)}})}})();window.$$=function(){var a=$A(arguments).join(", ");return Prototype.Selector.select(a,document)};Prototype.Selector=(function(){function a(){throw new Error('Method "Prototype.Selector.select" must be defined.')}function d(){throw new Error('Method "Prototype.Selector.match" must be defined.')}function e(m,n,j){j=j||0;var h=Prototype.Selector.match,l=m.length,g=0,k;for(k=0;k<l;k++){if(h(m[k],n)&&j==g++){return Element.extend(m[k])}}}function f(j){for(var g=0,h=j.length;g<h;g++){Element.extend(j[g])}return j}var b=Prototype.K;return{select:a,match:d,find:e,extendElements:(Element.extend===b)?b:f,extendElement:Element.extend}})();Prototype._original_property=window.Sizzle;
/*!
 * Sizzle CSS Selector Engine - v1.0
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
(function(){var t=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,l=0,f=Object.prototype.toString,q=false,k=true;[0,0].sort(function(){k=false;return 0});var b=function(I,x,F,A){F=F||[];var e=x=x||document;if(x.nodeType!==1&&x.nodeType!==9){return[]}if(!I||typeof I!=="string"){return F}var G=[],H,D,M,L,E,w,v=true,B=s(x),K=I;while((t.exec(""),H=t.exec(K))!==null){K=H[3];G.push(H[1]);if(H[2]){w=H[3];break}}if(G.length>1&&m.exec(I)){if(G.length===2&&g.relative[G[0]]){D=h(G[0]+G[1],x)}else{D=g.relative[G[0]]?[x]:b(G.shift(),x);while(G.length){I=G.shift();if(g.relative[I]){I+=G.shift()}D=h(I,D)}}}else{if(!A&&G.length>1&&x.nodeType===9&&!B&&g.match.ID.test(G[0])&&!g.match.ID.test(G[G.length-1])){var N=b.find(G.shift(),x,B);x=N.expr?b.filter(N.expr,N.set)[0]:N.set[0]}if(x){var N=A?{expr:G.pop(),set:a(A)}:b.find(G.pop(),G.length===1&&(G[0]==="~"||G[0]==="+")&&x.parentNode?x.parentNode:x,B);D=N.expr?b.filter(N.expr,N.set):N.set;if(G.length>0){M=a(D)}else{v=false}while(G.length){var z=G.pop(),C=z;if(!g.relative[z]){z=""}else{C=G.pop()}if(C==null){C=x}g.relative[z](M,C,B)}}else{M=G=[]}}if(!M){M=D}if(!M){throw"Syntax error, unrecognized expression: "+(z||I)}if(f.call(M)==="[object Array]"){if(!v){F.push.apply(F,M)}else{if(x&&x.nodeType===1){for(var J=0;M[J]!=null;J++){if(M[J]&&(M[J]===true||M[J].nodeType===1&&j(x,M[J]))){F.push(D[J])}}}else{for(var J=0;M[J]!=null;J++){if(M[J]&&M[J].nodeType===1){F.push(D[J])}}}}}else{a(M,F)}if(w){b(w,e,F,A);b.uniqueSort(F)}return F};b.uniqueSort=function(v){if(d){q=k;v.sort(d);if(q){for(var e=1;e<v.length;e++){if(v[e]===v[e-1]){v.splice(e--,1)}}}}return v};b.matches=function(e,v){return b(e,null,null,v)};b.find=function(C,e,D){var B,z;if(!C){return[]}for(var x=0,w=g.order.length;x<w;x++){var A=g.order[x],z;if((z=g.leftMatch[A].exec(C))){var v=z[1];z.splice(1,1);if(v.substr(v.length-1)!=="\\"){z[1]=(z[1]||"").replace(/\\/g,"");B=g.find[A](z,e,D);if(B!=null){C=C.replace(g.match[A],"");break}}}}if(!B){B=e.getElementsByTagName("*")}return{set:B,expr:C}};b.filter=function(F,E,I,x){var w=F,K=[],C=E,A,e,B=E&&E[0]&&s(E[0]);while(F&&E.length){for(var D in g.filter){if((A=g.match[D].exec(F))!=null){var v=g.filter[D],J,H;e=false;if(C==K){K=[]}if(g.preFilter[D]){A=g.preFilter[D](A,C,I,K,x,B);if(!A){e=J=true}else{if(A===true){continue}}}if(A){for(var z=0;(H=C[z])!=null;z++){if(H){J=v(H,A,z,C);var G=x^!!J;if(I&&J!=null){if(G){e=true}else{C[z]=false}}else{if(G){K.push(H);e=true}}}}}if(J!==undefined){if(!I){C=K}F=F.replace(g.match[D],"");if(!e){return[]}break}}}if(F==w){if(e==null){throw"Syntax error, unrecognized expression: "+F}else{break}}w=F}return C};var g=b.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\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")}},relative:{"+":function(C,e,B){var z=typeof e==="string",D=z&&!/\W/.test(e),A=z&&!D;if(D&&!B){e=e.toUpperCase()}for(var x=0,w=C.length,v;x<w;x++){if((v=C[x])){while((v=v.previousSibling)&&v.nodeType!==1){}C[x]=A||v&&v.nodeName===e?v||false:v===e}}if(A){b.filter(e,C,true)}},">":function(B,v,C){var z=typeof v==="string";if(z&&!/\W/.test(v)){v=C?v:v.toUpperCase();for(var w=0,e=B.length;w<e;w++){var A=B[w];if(A){var x=A.parentNode;B[w]=x.nodeName===v?x:false}}}else{for(var w=0,e=B.length;w<e;w++){var A=B[w];if(A){B[w]=z?A.parentNode:A.parentNode===v}}if(z){b.filter(v,B,true)}}},"":function(x,v,A){var w=l++,e=u;if(!/\W/.test(v)){var z=v=A?v:v.toUpperCase();e=p}e("parentNode",v,w,x,z,A)},"~":function(x,v,A){var w=l++,e=u;if(typeof v==="string"&&!/\W/.test(v)){var z=v=A?v:v.toUpperCase();e=p}e("previousSibling",v,w,x,z,A)}},find:{ID:function(v,w,x){if(typeof w.getElementById!=="undefined"&&!x){var e=w.getElementById(v[1]);return e?[e]:[]}},NAME:function(w,A,B){if(typeof A.getElementsByName!=="undefined"){var v=[],z=A.getElementsByName(w[1]);for(var x=0,e=z.length;x<e;x++){if(z[x].getAttribute("name")===w[1]){v.push(z[x])}}return v.length===0?null:v}},TAG:function(e,v){return v.getElementsByTagName(e[1])}},preFilter:{CLASS:function(x,v,w,e,B,C){x=" "+x[1].replace(/\\/g,"")+" ";if(C){return x}for(var z=0,A;(A=v[z])!=null;z++){if(A){if(B^(A.className&&(" "+A.className+" ").indexOf(x)>=0)){if(!w){e.push(A)}}else{if(w){v[z]=false}}}}return false},ID:function(e){return e[1].replace(/\\/g,"")},TAG:function(v,e){for(var w=0;e[w]===false;w++){}return e[w]&&s(e[w])?v[1]:v[1].toUpperCase()},CHILD:function(e){if(e[1]=="nth"){var v=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(e[2]=="even"&&"2n"||e[2]=="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(v[1]+(v[2]||1))-0;e[3]=v[3]-0}e[0]=l++;return e},ATTR:function(z,v,w,e,A,B){var x=z[1].replace(/\\/g,"");if(!B&&g.attrMap[x]){z[1]=g.attrMap[x]}if(z[2]==="~="){z[4]=" "+z[4]+" "}return z},PSEUDO:function(z,v,w,e,A){if(z[1]==="not"){if((t.exec(z[3])||"").length>1||/^\w/.test(z[3])){z[3]=b(z[3],null,null,v)}else{var x=b.filter(z[3],v,w,true^A);if(!w){e.push.apply(e,x)}return false}}else{if(g.match.POS.test(z[0])||g.match.CHILD.test(z[0])){return true}}return z},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){e.parentNode.selectedIndex;return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(w,v,e){return !!b(e[3],w).length},header:function(e){return/h\d/i.test(e.nodeName)},text:function(e){return"text"===e.type},radio:function(e){return"radio"===e.type},checkbox:function(e){return"checkbox"===e.type},file:function(e){return"file"===e.type},password:function(e){return"password"===e.type},submit:function(e){return"submit"===e.type},image:function(e){return"image"===e.type},reset:function(e){return"reset"===e.type},button:function(e){return"button"===e.type||e.nodeName.toUpperCase()==="BUTTON"},input:function(e){return/input|select|textarea|button/i.test(e.nodeName)}},setFilters:{first:function(v,e){return e===0},last:function(w,v,e,x){return v===x.length-1},even:function(v,e){return e%2===0},odd:function(v,e){return e%2===1},lt:function(w,v,e){return v<e[3]-0},gt:function(w,v,e){return v>e[3]-0},nth:function(w,v,e){return e[3]-0==v},eq:function(w,v,e){return e[3]-0==v}},filter:{PSEUDO:function(B,w,x,C){var v=w[1],z=g.filters[v];if(z){return z(B,x,w,C)}else{if(v==="contains"){return(B.textContent||B.innerText||"").indexOf(w[3])>=0}else{if(v==="not"){var A=w[3];for(var x=0,e=A.length;x<e;x++){if(A[x]===B){return false}}return true}}}},CHILD:function(e,x){var B=x[1],v=e;switch(B){case"only":case"first":while((v=v.previousSibling)){if(v.nodeType===1){return false}}if(B=="first"){return true}v=e;case"last":while((v=v.nextSibling)){if(v.nodeType===1){return false}}return true;case"nth":var w=x[2],E=x[3];if(w==1&&E==0){return true}var A=x[0],D=e.parentNode;if(D&&(D.sizcache!==A||!e.nodeIndex)){var z=0;for(v=D.firstChild;v;v=v.nextSibling){if(v.nodeType===1){v.nodeIndex=++z}}D.sizcache=A}var C=e.nodeIndex-E;if(w==0){return C==0}else{return(C%w==0&&C/w>=0)}}},ID:function(v,e){return v.nodeType===1&&v.getAttribute("id")===e},TAG:function(v,e){return(e==="*"&&v.nodeType===1)||v.nodeName===e},CLASS:function(v,e){return(" "+(v.className||v.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(A,x){var w=x[1],e=g.attrHandle[w]?g.attrHandle[w](A):A[w]!=null?A[w]:A.getAttribute(w),B=e+"",z=x[2],v=x[4];return e==null?z==="!=":z==="="?B===v:z==="*="?B.indexOf(v)>=0:z==="~="?(" "+B+" ").indexOf(v)>=0:!v?B&&e!==false:z==="!="?B!=v:z==="^="?B.indexOf(v)===0:z==="$="?B.substr(B.length-v.length)===v:z==="|="?B===v||B.substr(0,v.length+1)===v+"-":false},POS:function(z,v,w,A){var e=v[2],x=g.setFilters[e];if(x){return x(z,w,v,A)}}}};var m=g.match.POS;for(var o in g.match){g.match[o]=new RegExp(g.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source);g.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+g.match[o].source)}var a=function(v,e){v=Array.prototype.slice.call(v,0);if(e){e.push.apply(e,v);return e}return v};try{Array.prototype.slice.call(document.documentElement.childNodes,0)}catch(n){a=function(z,x){var v=x||[];if(f.call(z)==="[object Array]"){Array.prototype.push.apply(v,z)}else{if(typeof z.length==="number"){for(var w=0,e=z.length;w<e;w++){v.push(z[w])}}else{for(var w=0;z[w];w++){v.push(z[w])}}}return v}}var d;if(document.documentElement.compareDocumentPosition){d=function(v,e){if(!v.compareDocumentPosition||!e.compareDocumentPosition){if(v==e){q=true}return 0}var w=v.compareDocumentPosition(e)&4?-1:v===e?0:1;if(w===0){q=true}return w}}else{if("sourceIndex" in document.documentElement){d=function(v,e){if(!v.sourceIndex||!e.sourceIndex){if(v==e){q=true}return 0}var w=v.sourceIndex-e.sourceIndex;if(w===0){q=true}return w}}else{if(document.createRange){d=function(x,v){if(!x.ownerDocument||!v.ownerDocument){if(x==v){q=true}return 0}var w=x.ownerDocument.createRange(),e=v.ownerDocument.createRange();w.setStart(x,0);w.setEnd(x,0);e.setStart(v,0);e.setEnd(v,0);var z=w.compareBoundaryPoints(Range.START_TO_END,e);if(z===0){q=true}return z}}}}(function(){var v=document.createElement("div"),w="script"+(new Date).getTime();v.innerHTML="<a name='"+w+"'/>";var e=document.documentElement;e.insertBefore(v,e.firstChild);if(!!document.getElementById(w)){g.find.ID=function(z,A,B){if(typeof A.getElementById!=="undefined"&&!B){var x=A.getElementById(z[1]);return x?x.id===z[1]||typeof x.getAttributeNode!=="undefined"&&x.getAttributeNode("id").nodeValue===z[1]?[x]:undefined:[]}};g.filter.ID=function(A,x){var z=typeof A.getAttributeNode!=="undefined"&&A.getAttributeNode("id");return A.nodeType===1&&z&&z.nodeValue===x}}e.removeChild(v);e=v=null})();(function(){var e=document.createElement("div");e.appendChild(document.createComment(""));if(e.getElementsByTagName("*").length>0){g.find.TAG=function(v,A){var z=A.getElementsByTagName(v[1]);if(v[1]==="*"){var x=[];for(var w=0;z[w];w++){if(z[w].nodeType===1){x.push(z[w])}}z=x}return z}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){g.attrHandle.href=function(v){return v.getAttribute("href",2)}}e=null})();if(document.querySelectorAll){(function(){var e=b,w=document.createElement("div");w.innerHTML="<p class='TEST'></p>";if(w.querySelectorAll&&w.querySelectorAll(".TEST").length===0){return}b=function(B,A,x,z){A=A||document;if(!z&&A.nodeType===9&&!s(A)){try{return a(A.querySelectorAll(B),x)}catch(C){}}return e(B,A,x,z)};for(var v in e){b[v]=e[v]}w=null})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var e=document.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}g.order.splice(1,0,"CLASS");g.find.CLASS=function(v,w,x){if(typeof w.getElementsByClassName!=="undefined"&&!x){return w.getElementsByClassName(v[1])}};e=null})()}function p(v,B,A,F,C,E){var D=v=="previousSibling"&&!E;for(var x=0,w=F.length;x<w;x++){var e=F[x];if(e){if(D&&e.nodeType===1){e.sizcache=A;e.sizset=x}e=e[v];var z=false;while(e){if(e.sizcache===A){z=F[e.sizset];break}if(e.nodeType===1&&!E){e.sizcache=A;e.sizset=x}if(e.nodeName===B){z=e;break}e=e[v]}F[x]=z}}}function u(v,B,A,F,C,E){var D=v=="previousSibling"&&!E;for(var x=0,w=F.length;x<w;x++){var e=F[x];if(e){if(D&&e.nodeType===1){e.sizcache=A;e.sizset=x}e=e[v];var z=false;while(e){if(e.sizcache===A){z=F[e.sizset];break}if(e.nodeType===1){if(!E){e.sizcache=A;e.sizset=x}if(typeof B!=="string"){if(e===B){z=true;break}}else{if(b.filter(B,[e]).length>0){z=e;break}}}e=e[v]}F[x]=z}}}var j=document.compareDocumentPosition?function(v,e){return v.compareDocumentPosition(e)&16}:function(v,e){return v!==e&&(v.contains?v.contains(e):true)};var s=function(e){return e.nodeType===9&&e.documentElement.nodeName!=="HTML"||!!e.ownerDocument&&e.ownerDocument.documentElement.nodeName!=="HTML"};var h=function(e,C){var x=[],z="",A,w=C.nodeType?[C]:C;while((A=g.match.PSEUDO.exec(e))){z+=A[0];e=e.replace(g.match.PSEUDO,"")}e=g.relative[e]?e+"*":e;for(var B=0,v=w.length;B<v;B++){b(e,w[B],x)}return b.filter(z,x)};window.Sizzle=b})();(function(d){var e=Prototype.Selector.extendElements;function a(f,g){return e(d(f,g||document))}function b(g,f){return d.matches(f,[g]).length==1}Prototype.Selector.engine=d;Prototype.Selector.select=a;Prototype.Selector.match=b})(Sizzle);window.Sizzle=Prototype._original_property;delete Prototype._original_property;var Form={reset:function(a){a=$(a);a.reset();return a},serializeElements:function(j,e){if(typeof e!="object"){e={hash:!!e}}else{if(Object.isUndefined(e.hash)){e.hash=true}}var f,h,a=false,g=e.submit,b,d;if(e.hash){d={};b=function(k,l,m){if(l in k){if(!Object.isArray(k[l])){k[l]=[k[l]]}k[l].push(m)}else{k[l]=m}return k}}else{d="";b=function(k,l,m){return k+(k?"&":"")+encodeURIComponent(l)+"="+encodeURIComponent(m)}}return j.inject(d,function(k,l){if(!l.disabled&&l.name){f=l.name;h=$(l).getValue();if(h!=null&&l.type!="file"&&(l.type!="submit"||(!a&&g!==false&&(!g||f==g)&&(a=true)))){k=b(k,f,h)}}return k})}};Form.Methods={serialize:function(b,a){return Form.serializeElements(Form.getElements(b),a)},getElements:function(f){var g=$(f).getElementsByTagName("*"),e,a=[],d=Form.Element.Serializers;for(var b=0;e=g[b];b++){a.push(e)}return a.inject([],function(h,j){if(d[j.tagName.toLowerCase()]){h.push(Element.extend(j))}return h})},getInputs:function(h,d,e){h=$(h);var a=h.getElementsByTagName("input");if(!d&&!e){return $A(a).map(Element.extend)}for(var f=0,j=[],g=a.length;f<g;f++){var b=a[f];if((d&&b.type!=d)||(e&&b.name!=e)){continue}j.push(Element.extend(b))}return j},disable:function(a){a=$(a);Form.getElements(a).invoke("disable");return a},enable:function(a){a=$(a);Form.getElements(a).invoke("enable");return a},findFirstElement:function(b){var d=$(b).getElements().findAll(function(e){return"hidden"!=e.type&&!e.disabled});var a=d.findAll(function(e){return e.hasAttribute("tabIndex")&&e.tabIndex>=0}).sortBy(function(e){return e.tabIndex}).first();return a?a:d.find(function(e){return/^(?:input|select|textarea)$/i.test(e.tagName)})},focusFirstElement:function(b){b=$(b);var a=b.findFirstElement();if(a){a.activate()}return b},request:function(b,a){b=$(b),a=Object.clone(a||{});var e=a.parameters,d=b.readAttribute("action")||"";if(d.blank()){d=window.location.href}a.parameters=b.serialize(true);if(e){if(Object.isString(e)){e=e.toQueryParams()}Object.extend(a.parameters,e)}if(b.hasAttribute("method")&&!a.method){a.method=b.method}return new Ajax.Request(d,a)}};Form.Element={focus:function(a){$(a).focus();return a},select:function(a){$(a).select();return a}};Form.Element.Methods={serialize:function(a){a=$(a);if(!a.disabled&&a.name){var b=a.getValue();if(b!=undefined){var d={};d[a.name]=b;return Object.toQueryString(d)}}return""},getValue:function(a){a=$(a);var b=a.tagName.toLowerCase();return Form.Element.Serializers[b](a)},setValue:function(a,b){a=$(a);var d=a.tagName.toLowerCase();Form.Element.Serializers[d](a,b);return a},clear:function(a){$(a).value="";return a},present:function(a){return $(a).value!=""},activate:function(a){a=$(a);try{a.focus();if(a.select&&(a.tagName.toLowerCase()!="input"||!(/^(?:button|reset|submit)$/i.test(a.type)))){a.select()}}catch(b){}return a},disable:function(a){a=$(a);a.disabled=true;return a},enable:function(a){a=$(a);a.disabled=false;return a}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers=(function(){function b(j,k){switch(j.type.toLowerCase()){case"checkbox":case"radio":return g(j,k);default:return f(j,k)}}function g(j,k){if(Object.isUndefined(k)){return j.checked?j.value:null}else{j.checked=!!k}}function f(j,k){if(Object.isUndefined(k)){return j.value}else{j.value=k}}function a(l,o){if(Object.isUndefined(o)){return(l.type==="select-one"?d:e)(l)}var k,m,p=!Object.isArray(o);for(var j=0,n=l.length;j<n;j++){k=l.options[j];m=this.optionValue(k);if(p){if(m==o){k.selected=true;return}}else{k.selected=o.include(m)}}}function d(k){var j=k.selectedIndex;return j>=0?h(k.options[j]):null}function e(m){var j,n=m.length;if(!n){return null}for(var l=0,j=[];l<n;l++){var k=m.options[l];if(k.selected){j.push(h(k))}}return j}function h(j){return Element.hasAttribute(j,"value")?j.value:j.text}return{input:b,inputSelector:g,textarea:f,select:a,selectOne:d,selectMany:e,optionValue:h,button:f}})();Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function(a,b,d){PeriodicalExecuter.prototype.initialize.apply(this,[d,b]);this.element=$(a);this.lastValue=this.getValue()},execute:function(){var a=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(a)?this.lastValue!=a:String(this.lastValue)!=String(a)){this.callback(this.element,a);this.lastValue=a}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element)}});Abstract.EventObserver=Class.create({initialize:function(a,b){this.element=$(a);this.callback=b;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()}else{this.registerCallback(this.element)}},onElementEvent:function(){var a=this.getValue();if(this.lastValue!=a){this.callback(this.element,a);this.lastValue=a}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)},registerCallback:function(a){if(a.type){switch(a.type.toLowerCase()){case"checkbox":case"radio":Event.observe(a,"click",this.onElementEvent.bind(this));break;default:Event.observe(a,"change",this.onElementEvent.bind(this));break}}}});Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)}});(function(){var G={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,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,cache:{}};var g=document.documentElement;var H="onmouseenter" in g&&"onmouseleave" in g;var a=function(I){return false};if(window.attachEvent){if(window.addEventListener){a=function(I){return !(I instanceof window.Event)}}else{a=function(I){return true}}}var u;function E(J,I){return J.which?(J.which===I+1):(J.button===I)}var q={0:1,1:4,2:2};function C(J,I){return J.button===q[I]}function F(J,I){switch(I){case 0:return J.which==1&&!J.metaKey;case 1:return J.which==2||(J.which==1&&J.metaKey);case 2:return J.which==3;default:return false}}if(window.attachEvent){if(!window.addEventListener){u=C}else{u=function(J,I){return a(J)?C(J,I):E(J,I)}}}else{if(Prototype.Browser.WebKit){u=F}else{u=E}}function z(I){return u(I,0)}function w(I){return u(I,1)}function p(I){return u(I,2)}function e(K){K=G.extend(K);var J=K.target,I=K.type,L=K.currentTarget;if(L&&L.tagName){if(I==="load"||I==="error"||(I==="click"&&L.tagName.toLowerCase()==="input"&&L.type==="radio")){J=L}}if(J.nodeType==Node.TEXT_NODE){J=J.parentNode}return Element.extend(J)}function s(J,K){var I=G.element(J);if(!K){return I}while(I){if(Object.isElement(I)&&Prototype.Selector.match(I,K)){return Element.extend(I)}I=I.parentNode}}function v(I){return{x:d(I),y:b(I)}}function d(K){var J=document.documentElement,I=document.body||{scrollLeft:0};return K.pageX||(K.clientX+(J.scrollLeft||I.scrollLeft)-(J.clientLeft||0))}function b(K){var J=document.documentElement,I=document.body||{scrollTop:0};return K.pageY||(K.clientY+(J.scrollTop||I.scrollTop)-(J.clientTop||0))}function t(I){G.extend(I);I.preventDefault();I.stopPropagation();I.stopped=true}G.Methods={isLeftClick:z,isMiddleClick:w,isRightClick:p,element:e,findElement:s,pointer:v,pointerX:d,pointerY:b,stop:t};var B=Object.keys(G.Methods).inject({},function(I,J){I[J]=G.Methods[J].methodize();return I});if(window.attachEvent){function k(J){var I;switch(J.type){case"mouseover":case"mouseenter":I=J.fromElement;break;case"mouseout":case"mouseleave":I=J.toElement;break;default:return null}return Element.extend(I)}var x={stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}};G.extend=function(J,I){if(!J){return false}if(!a(J)){return J}if(J._extendedByPrototype){return J}J._extendedByPrototype=Prototype.emptyFunction;var K=G.pointer(J);Object.extend(J,{target:J.srcElement||I,relatedTarget:k(J),pageX:K.x,pageY:K.y});Object.extend(J,B);Object.extend(J,x);return J}}else{G.extend=Prototype.K}if(window.addEventListener){G.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(G.prototype,B)}function o(M,L,N){var K=Element.retrieve(M,"prototype_event_registry");if(Object.isUndefined(K)){f.push(M);K=Element.retrieve(M,"prototype_event_registry",$H())}var I=K.get(L);if(Object.isUndefined(I)){I=[];K.set(L,I)}if(I.pluck("handler").include(N)){return false}var J;if(L.include(":")){J=function(O){if(Object.isUndefined(O.eventName)){return false}if(O.eventName!==L){return false}G.extend(O,M);N.call(M,O)}}else{if(!H&&(L==="mouseenter"||L==="mouseleave")){if(L==="mouseenter"||L==="mouseleave"){J=function(P){G.extend(P,M);var O=P.relatedTarget;while(O&&O!==M){try{O=O.parentNode}catch(Q){O=M}}if(O===M){return}N.call(M,P)}}}else{J=function(O){G.extend(O,M);N.call(M,O)}}}J.handler=N;I.push(J);return J}function j(){for(var I=0,J=f.length;I<J;I++){G.stopObserving(f[I]);f[I]=null}}var f=[];if(Prototype.Browser.IE){window.attachEvent("onunload",j)}if(Prototype.Browser.WebKit){window.addEventListener("unload",Prototype.emptyFunction,false)}var n=Prototype.K,h={mouseenter:"mouseover",mouseleave:"mouseout"};if(!H){n=function(I){return(h[I]||I)}}function A(L,K,M){L=$(L);var J=o(L,K,M);if(!J){return L}if(K.include(":")){if(L.addEventListener){L.addEventListener("dataavailable",J,false)}else{L.attachEvent("ondataavailable",J);L.attachEvent("onlosecapture",J)}}else{var I=n(K);if(L.addEventListener){L.addEventListener(I,J,false)}else{L.attachEvent("on"+I,J)}}return L}function m(O,L,P){O=$(O);var K=Element.retrieve(O,"prototype_event_registry");if(!K){return O}if(!L){K.each(function(R){var Q=R.key;m(O,Q)});return O}var M=K.get(L);if(!M){return O}if(!P){M.each(function(Q){m(O,L,Q.handler)});return O}var N=M.length,J;while(N--){if(M[N].handler===P){J=M[N];break}}if(!J){return O}if(L.include(":")){if(O.removeEventListener){O.removeEventListener("dataavailable",J,false)}else{O.detachEvent("ondataavailable",J);O.detachEvent("onlosecapture",J)}}else{var I=n(L);if(O.removeEventListener){O.removeEventListener(I,J,false)}else{O.detachEvent("on"+I,J)}}K.set(L,M.without(J));return O}function D(L,K,J,I){L=$(L);if(Object.isUndefined(I)){I=true}if(L==document&&document.createEvent&&!L.dispatchEvent){L=document.documentElement}var M;if(document.createEvent){M=document.createEvent("HTMLEvents");M.initEvent("dataavailable",I,true)}else{M=document.createEventObject();M.eventType=I?"ondataavailable":"onlosecapture"}M.eventName=K;M.memo=J||{};if(document.createEvent){L.dispatchEvent(M)}else{L.fireEvent(M.eventType,M)}return G.extend(M)}G.Handler=Class.create({initialize:function(K,J,I,L){this.element=$(K);this.eventName=J;this.selector=I;this.callback=L;this.handler=this.handleEvent.bind(this)},start:function(){G.observe(this.element,this.eventName,this.handler);return this},stop:function(){G.stopObserving(this.element,this.eventName,this.handler);return this},handleEvent:function(J){var I=G.findElement(J,this.selector);if(I){this.callback.call(this.element,J,I)}}});function l(K,J,I,L){K=$(K);if(Object.isFunction(I)&&Object.isUndefined(L)){L=I,I=null}return new G.Handler(K,J,I,L).start()}Object.extend(G,G.Methods);Object.extend(G,{fire:D,observe:A,stopObserving:m,on:l});Element.addMethods({fire:D,observe:A,stopObserving:m,on:l});Object.extend(document,{fire:D.methodize(),observe:A.methodize(),stopObserving:m.methodize(),on:l.methodize(),loaded:false});if(window.Event){Object.extend(window.Event,G)}else{window.Event=G}})();(function(){var e;function a(){if(document.loaded){return}if(e){window.clearTimeout(e)}document.loaded=true;document.fire("dom:loaded")}function d(){if(document.readyState==="complete"){document.stopObserving("readystatechange",d);a()}}function b(){try{document.documentElement.doScroll("left")}catch(f){e=b.defer();return}a()}if(document.addEventListener){document.addEventListener("DOMContentLoaded",a,false)}else{document.observe("readystatechange",d);if(window==top){e=b.defer()}}Event.observe(window,"load",a)})();Element.addMethods();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(a,b){return Element.insert(a,{before:b})},Top:function(a,b){return Element.insert(a,{top:b})},Bottom:function(a,b){return Element.insert(a,{bottom:b})},After:function(a,b){return Element.insert(a,{after:b})}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},within:function(b,a,d){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(b,a,d)}this.xcomp=a;this.ycomp=d;this.offset=Element.cumulativeOffset(b);return(d>=this.offset[1]&&d<this.offset[1]+b.offsetHeight&&a>=this.offset[0]&&a<this.offset[0]+b.offsetWidth)},withinIncludingScrolloffsets:function(b,a,e){var d=Element.cumulativeScrollOffset(b);this.xcomp=a+d[0]-this.deltaX;this.ycomp=e+d[1]-this.deltaY;this.offset=Element.cumulativeOffset(b);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+b.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+b.offsetWidth)},overlap:function(b,a){if(!b){return 0}if(b=="vertical"){return((this.offset[1]+a.offsetHeight)-this.ycomp)/a.offsetHeight}if(b=="horizontal"){return((this.offset[0]+a.offsetWidth)-this.xcomp)/a.offsetWidth}},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(a){Position.prepare();return Element.absolutize(a)},relativize:function(a){Position.prepare();return Element.relativize(a)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(b,d,a){a=a||{};return Element.clonePosition(d,b,a)}};if(!document.getElementsByClassName){document.getElementsByClassName=function(b){function a(d){return d.blank()?null:"[contains(concat(' ', @class, ' '), ' "+d+" ')]"}b.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(d,f){f=f.toString().strip();var e=/\s/.test(f)?$w(f).map(a).join(""):a(f);return e?document._getElementsByXPath(".//*"+e,d):[]}:function(f,g){g=g.toString().strip();var h=[],j=(/\s/.test(g)?$w(g):null);if(!j&&!g){return h}var d=$(f).getElementsByTagName("*");g=" "+g+" ";for(var e=0,l,k;l=d[e];e++){if(l.className&&(k=" "+l.className+" ")&&(k.include(g)||(j&&j.all(function(m){return !m.toString().blank()&&k.include(" "+m+" ")})))){h.push(Element.extend(l))}}return h};return function(e,d){return $(d||document.body).getElementsByClassName(e)}}(Element.Methods)}Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(a){this.element=$(a)},_each:function(a){this.element.className.split(/\s+/).select(function(b){return b.length>0})._each(a)},set:function(a){this.element.className=a},add:function(a){if(this.include(a)){return}this.set($A(this).concat(a).join(" "))},remove:function(a){if(!this.include(a)){return}this.set($A(this).without(a).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);(function(){window.Selector=Class.create({initialize:function(a){this.expression=a.strip()},findElements:function(a){return Prototype.Selector.select(this.expression,a)},match:function(a){return Prototype.Selector.match(a,this.expression)},toString:function(){return this.expression},inspect:function(){return"#<Selector: "+this.expression+">"}});Object.extend(Selector,{matchElements:function(g,h){var a=Prototype.Selector.match,e=[];for(var d=0,f=g.length;d<f;d++){var b=g[d];if(a(b,h)){e.push(Element.extend(b))}}return e},findElement:function(g,h,b){b=b||0;var a=0,e;for(var d=0,f=g.length;d<f;d++){e=g[d];if(Prototype.Selector.match(e,h)&&b===a++){return Element.extend(e)}}},findChildElements:function(b,d){var a=d.toArray().join(", ");return Prototype.Selector.select(a,b||document)}})})();(function(){var b;var a=false;window.OpenLayers={_getScriptLocation:function(){if(b!=undefined){return b}b="";var j=new RegExp("(^|(.*?\\/))("+OpenLayers._scriptName+")(\\?|$)");var e=document.getElementsByTagName("script");for(var g=0,d=e.length;g<d;g++){var h=e[g].getAttribute("src");if(h){var f=h.match(j);if(f){b=f[1];break}}}return b},VERSION_NUMBER:"OpenLayers 2.9.1 -- $Revision: 10129 $"}})();OpenLayers.Util={};OpenLayers.Util.getElement=function(){var e=[];for(var d=0,a=arguments.length;d<a;d++){var b=arguments[d];if(typeof b=="string"){b=document.getElementById(b)}if(arguments.length==1){return b}e.push(b)}return e};OpenLayers.Util.isElement=function(a){return !!(a&&a.nodeType===1)};if(typeof window.$==="undefined"){window.$=OpenLayers.Util.getElement}OpenLayers.Util.extend=function(a,f){a=a||{};if(f){for(var e in f){var d=f[e];if(d!==undefined){a[e]=d}}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(d,b){for(var a=d.length-1;a>=0;a--){if(d[a]==b){d.splice(a,1)}}return d};OpenLayers.Util.clearArray=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"array = []"}));a.length=0};OpenLayers.Util.indexOf=function(e,d){if(typeof e.indexOf=="function"){return e.indexOf(d)}else{for(var b=0,a=e.length;b<a;b++){if(e[b]==d){return b}}return -1}};OpenLayers.Util.modifyDOMElement=function(f,j,e,g,a,d,h,b){if(j){f.id=j}if(e){f.style.left=e.x+"px";f.style.top=e.y+"px"}if(g){f.style.width=g.w+"px";f.style.height=g.h+"px"}if(a){f.style.position=a}if(d){f.style.border=d}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,k,j,g,f,d,b,h){var e=document.createElement("div");if(g){e.style.backgroundImage="url("+g+")"}if(!a){a=OpenLayers.Util.createUniqueID("OpenLayersDiv")}if(!f){f="absolute"}OpenLayers.Util.modifyDOMElement(e,a,k,j,f,d,b,h);return e};OpenLayers.Util.createImage=function(a,j,h,f,e,d,g,k){var b=document.createElement("img");if(!a){a=OpenLayers.Util.createUniqueID("OpenLayersDiv")}if(!e){e="relative"}OpenLayers.Util.modifyDOMElement(b,a,j,h,e,d,null,g);if(k){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.display=""}OpenLayers.Element.removeClass(this,"olImageLoadError")};OpenLayers.IMAGE_RELOAD_ATTEMPTS=0;OpenLayers.Util.onImageLoadError=function(){this._attempts=(this._attempts)?(this._attempts+1):1;if(this._attempts<=OpenLayers.IMAGE_RELOAD_ATTEMPTS){var e=this.urls;if(e&&e instanceof Array&&e.length>1){var f=this.src.toString();var d,a;for(a=0;d=e[a];a++){if(f.indexOf(d)!=-1){break}}var g=Math.floor(e.length*Math.random());var b=e[g];a=0;while(b==d&&a++<4){g=Math.floor(e.length*Math.random());b=e[g]}this.src=f.replace(d,b)}else{this.src=this.src}}else{OpenLayers.Element.addClass(this,"olImageLoadError")}this.style.display=""};OpenLayers.Util.alphaHackNeeded=null;OpenLayers.Util.alphaHack=function(){if(OpenLayers.Util.alphaHackNeeded==null){var f=navigator.appVersion.split("MSIE");var a=parseFloat(f[1]);var b=false;try{b=!!(document.body.filters)}catch(d){}OpenLayers.Util.alphaHackNeeded=(b&&(a>=5.5)&&(a<7))}return OpenLayers.Util.alphaHackNeeded};OpenLayers.Util.modifyAlphaImageDiv=function(a,b,l,k,h,g,d,e,j){OpenLayers.Util.modifyDOMElement(a,b,l,k,g,null,null,j);var f=a.childNodes[0];if(h){f.src=h}OpenLayers.Util.modifyDOMElement(f,a.id+"_innerImage",null,k,"relative",d);if(OpenLayers.Util.alphaHack()){if(a.style.display!="none"){a.style.display="inline-block"}if(e==null){e="scale"}a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+f.src+"', sizingMethod='"+e+"')";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,l,k,h,g,d,e,j,m){var a=OpenLayers.Util.createDiv();var f=OpenLayers.Util.createImage(null,null,null,null,null,null,null,false);a.appendChild(f);if(m){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,l,k,h,g,d,e,j);return a};OpenLayers.Util.upperCaseObject=function(b){var a={};for(var d in b){a[d.toUpperCase()]=b[d]}return a};OpenLayers.Util.applyDefaults=function(e,d){e=e||{};var b=typeof window.Event=="function"&&d instanceof window.Event;for(var a in d){if(e[a]===undefined||(!b&&d.hasOwnProperty&&d.hasOwnProperty(a)&&!e.hasOwnProperty(a))){e[a]=d[a]}}if(!b&&d&&d.hasOwnProperty&&d.hasOwnProperty("toString")&&!e.hasOwnProperty("toString")){e.toString=d.toString}return e};OpenLayers.Util.getParameterString=function(d){var b=[];for(var j in d){var h=d[j];if((h!=null)&&(typeof h!="function")){var e;if(typeof h=="object"&&h.constructor==Array){var f=[];var k;for(var a=0,g=h.length;a<g;a++){k=h[a];f.push(encodeURIComponent((k===null||k===undefined)?"":k))}e=f.join(",")}else{e=encodeURIComponent(h)}b.push(encodeURIComponent(j)+"="+e)}}return b.join("&")};OpenLayers.Util.urlAppend=function(a,b){var e=a;if(b){var d=(a+" ").split(/[?&]/);e+=(d.pop()===" "?b:d.length?"&"+b:"?"+b)}return e};OpenLayers.ImgPath="";OpenLayers.Util.getImagesLocation=function(){return OpenLayers.ImgPath||(OpenLayers._getScriptLocation()+"img/")};OpenLayers.Util.Try=function(){var f=null;for(var d=0,a=arguments.length;d<a;d++){var b=arguments[d];try{f=b();break}catch(g){}}return f};OpenLayers.Util.getNodes=function(d,b){var a=OpenLayers.Util.Try(function(){return OpenLayers.Util._getNodes(d.documentElement.childNodes,b)},function(){return OpenLayers.Util._getNodes(d.childNodes,b)});return a};OpenLayers.Util._getNodes=function(d,f){var b=[];for(var e=0,a=d.length;e<a;e++){if(d[e].nodeName==f){b.push(d[e])}}return b};OpenLayers.Util.getTagText=function(d,e,b){var a=OpenLayers.Util.getNodes(d,e);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,d){var b=(a.relatedTarget)?a.relatedTarget:a.toElement;while(b!=d&&b!=null){b=b.parentNode}return(b!=d)};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,e){var P=6378137,O=6356752.3142,J=1/298.257223563;var o=OpenLayers.Util.rad(e.lon-h.lon);var N=Math.atan((1-J)*Math.tan(OpenLayers.Util.rad(h.lat)));var M=Math.atan((1-J)*Math.tan(OpenLayers.Util.rad(e.lat)));var n=Math.sin(N),k=Math.cos(N);var m=Math.sin(M),j=Math.cos(M);var u=o,p=2*Math.PI;var t=20;while(Math.abs(u-p)>1e-12&&--t>0){var F=Math.sin(u),g=Math.cos(u);var Q=Math.sqrt((j*F)*(j*F)+(k*m-n*j*g)*(k*m-n*j*g));if(Q==0){return 0}var H=n*m+k*j*g;var E=Math.atan2(Q,H);var l=Math.asin(k*j*F/Q);var I=Math.cos(l)*Math.cos(l);var q=H-2*n*m/I;var x=J/16*I*(4+J*(4-3*I));p=u;u=o+(1-x)*J*Math.sin(l)*(E+x*Q*(q+x*H*(-1+2*q*q)))}if(t==0){return NaN}var w=I*(P*P-O*O)/(O*O);var D=1+w/16384*(4096+w*(-768+w*(320-175*w)));var z=w/1024*(256+w*(-128+w*(74-47*w)));var G=z*Q*(q+z/4*(H*(-1+2*q*q)-z/6*q*(-3+4*Q*Q)*(-3+4*q*q)));var v=O*D*(E-G);var K=v.toFixed(3)/1000;return K};OpenLayers.Util.getParameters=function(b){b=b||window.location.href;var a="";if(OpenLayers.String.contains(b,"?")){var d=b.indexOf("?")+1;var f=OpenLayers.String.contains(b,"#")?b.indexOf("#"):b.length;a=b.substring(d,f)}var m={};var e=a.split(/[&;]/);for(var h=0,j=e.length;h<j;++h){var g=e[h].split("=");if(g[0]){var l=decodeURIComponent(g[0]);var k=g[1]||"";k=decodeURIComponent(k.replace(/\+/g," ")).split(",");if(k.length==1){k=k[0]}m[l]=k}}return m};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(e,a){var b;if(e){if(a==null){a="degrees"}var d=OpenLayers.Util.normalizeScale(e);b=1/(d*OpenLayers.INCHES_PER_UNIT[a]*OpenLayers.DOTS_PER_INCH)}return b};OpenLayers.Util.getScaleFromResolution=function(b,a){if(a==null){a="degrees"}var d=b*OpenLayers.INCHES_PER_UNIT[a]*OpenLayers.DOTS_PER_INCH;return d};OpenLayers.Util.safeStopPropagation=function(a){OpenLayers.Event.stop(a,true)};OpenLayers.Util.pagePosition=function(g){var a=0,f=0;var b=g;var h=g;while(b){if(b==document.body){if(OpenLayers.Element.getStyle(h,"position")=="absolute"){break}}a+=b.offsetTop||0;f+=b.offsetLeft||0;h=b;try{b=b.offsetParent}catch(d){OpenLayers.Console.error(OpenLayers.i18n("pagePositionFailed",{elemId:b.id}));break}}b=g;while(b){a-=b.scrollTop||0;f-=b.scrollLeft||0;b=b.parentNode}return[f,a]};OpenLayers.Util.isEquivalentUrl=function(g,f,d){d=d||{};OpenLayers.Util.applyDefaults(d,{ignoreCase:true,ignorePort80:true,ignoreHash:true});var b=OpenLayers.Util.createUrlObject(g,d);var a=OpenLayers.Util.createUrlObject(f,d);for(var e in b){if(e!=="args"){if(b[e]!=a[e]){return false}}}for(var e in b.args){if(b.args[e]!=a.args[e]){return false}delete a.args[e]}for(var e in a.args){return false}return true};OpenLayers.Util.createUrlObject=function(d,m){m=m||{};if(!(/^\w+:\/\//).test(d)){var h=window.location;var f=h.port?":"+h.port:"";var j=h.protocol+"//"+h.host.split(":").shift()+f;if(d.indexOf("/")===0){d=j+d}else{var g=h.pathname.split("/");g.pop();d=j+g.join("/")+"/"+d}}if(m.ignoreCase){d=d.toLowerCase()}var k=document.createElement("a");k.href=d;var e={};e.host=k.host.split(":").shift();e.protocol=k.protocol;if(m.ignorePort80){e.port=(k.port=="80"||k.port=="0")?"":k.port}else{e.port=(k.port==""||k.port=="0")?"80":k.port}e.hash=(m.ignoreHash||k.hash==="#")?"":k.hash;var b=k.search;if(!b){var l=d.indexOf("?");b=(l!=-1)?d.substr(l):""}e.args=OpenLayers.Util.getParameters(b);e.pathname=(k.pathname.charAt(0)=="/")?k.pathname:"/"+k.pathname;return e};OpenLayers.Util.removeTail=function(b){var d=null;var a=b.indexOf("?");var e=b.indexOf("#");if(a==-1){d=(e!=-1)?b.substr(0,e):b}else{d=(e!=-1)?b.substr(0,Math.min(a,e)):b.substr(0,a)}return d};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,p,q){var m,f;var a=document.createElement("div");a.style.visibility="hidden";var o=(q&&q.containerElement)?q.containerElement:document.body;if(p){if(p.w){m=p.w;a.style.width=m+"px"}else{if(p.h){f=p.h;a.style.height=f+"px"}}}if(q&&q.displayClass){a.className=q.displayClass}var g=document.createElement("div");g.innerHTML=b;g.style.overflow="visible";if(g.childNodes){for(var e=0,d=g.childNodes.length;e<d;e++){if(!g.childNodes[e].style){continue}g.childNodes[e].style.overflow="visible"}}a.appendChild(g);o.appendChild(a);var n=false;var k=a.parentNode;while(k&&k.tagName.toLowerCase()!="body"){var j=OpenLayers.Element.getStyle(k,"position");if(j=="absolute"){n=true;break}else{if(j&&j!="static"){break}}k=k.parentNode}if(!n){a.style.position="absolute"}if(!m){m=parseInt(g.scrollWidth);a.style.width=m+"px"}if(!f){f=parseInt(g.scrollHeight)}a.removeChild(g);o.removeChild(a);return new OpenLayers.Size(m,f)};OpenLayers.Util.getScrollbarWidth=function(){var d=OpenLayers.Util._scrollbarWidth;if(d==null){var f=null;var e=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";e=document.createElement("div");e.style.width="100%";e.style.height="200px";f.appendChild(e);document.body.appendChild(f);a=e.offsetWidth;f.style.overflow="scroll";b=e.offsetWidth;document.body.removeChild(document.body.lastChild);OpenLayers.Util._scrollbarWidth=(a-b);d=OpenLayers.Util._scrollbarWidth}return d};OpenLayers.Util.getFormattedLonLat=function(j,b,f){if(!f){f="dms"}var e=Math.abs(j);var k=Math.floor(e);var a=(e-k)/(1/60);var d=a;a=Math.floor(a);var h=(d-a)/(1/60);h=Math.round(h*10);h/=10;if(k<10){k="0"+k}var g=k+" ";if(f.indexOf("dm")>=0){if(a<10){a="0"+a}g+=a+"'";if(f.indexOf("dms")>=0){if(h<10){h="0"+h}g+=h+'"'}}if(b=="lon"){g+=j<0?OpenLayers.i18n("W"):OpenLayers.i18n("E")}else{g+=j<0?OpenLayers.i18n("S"):OpenLayers.i18n("N")}return g};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 e=g.split("-");var b=e[0];for(var d=1,a=e.length;d<a;d++){var f=e[d];b+=f.charAt(0).toUpperCase()+f.substring(1)}return b},format:function(e,d,a){if(!d){d=window}var b=function(k,f){var j;var h=f.split(/\.+/);for(var g=0;g<h.length;g++){if(g==0){j=d}j=j[h[g]]}if(typeof j=="function"){j=a?j.apply(null,a):j()}if(typeof j=="undefined"){return"undefined"}else{return j}};return e.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,d){var b=0;if(d>0){b=parseFloat(a.toPrecision(d))}return b},format:function(d,a,h,k){a=(typeof a!="undefined")?a:0;h=(typeof h!="undefined")?h:OpenLayers.Number.thousandsSeparator;k=(typeof k!="undefined")?k:OpenLayers.Number.decimalSeparator;if(a!=null){d=parseFloat(d.toFixed(a))}var b=d.toString().split(".");if(b.length==1&&a==null){a=0}var e=b[0];if(h){var f=/(-?[0-9]+)([0-9]{3})/;while(f.test(e)){e=e.replace(f,"$1"+h+"$2")}}var g;if(a==0){g=e}else{var j=b.length>1?b[1]:"0";if(a!=null){j=j+new Array(a-j.length+1).join("0")}g=e+k+j}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(d,b){var a=Array.prototype.slice.apply(arguments,[2]);return function(){var e=a.concat(Array.prototype.slice.apply(arguments,[0]));return d.apply(b,e)}},bindAsEventListener:function(b,a){return function(d){return b.call(a,d||window.event)}},False:function(){return false},True:function(){return true}};if(!Function.prototype.bind){Function.prototype.bind=function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Function.bind"}));Array.prototype.unshift.apply(arguments,[this]);return OpenLayers.Function.bind.apply(null,arguments)}}if(!Function.prototype.bindAsEventListener){Function.prototype.bindAsEventListener=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Function.bindAsEventListener"}));return OpenLayers.Function.bindAsEventListener(this,a)}}OpenLayers.Array={filter:function(h,g,b){var e=[];if(Array.prototype.filter){e=h.filter(g,b)}else{var a=h.length;if(typeof g!="function"){throw new TypeError()}for(var d=0;d<a;d++){if(d in h){var f=h[d];if(g.call(b,f,d,h)){e.push(f)}}}}return e}};OpenLayers.Class=function(){var e=function(){if(arguments&&arguments[0]!=OpenLayers.Class.isPrototype){this.initialize.apply(this,arguments)}};var d={};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(){};d=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(d,g)}e.prototype=d;return e};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 e=arguments[0];var f=new e(OpenLayers.Class.isPrototype);for(var d=1,a=arguments.length;d<a;d++){if(typeof arguments[d]=="function"){var b=arguments[d];arguments[d]=new b(OpenLayers.Class.isPrototype)}OpenLayers.Util.extend(f,arguments[d])}return f};OpenLayers.Bounds=OpenLayers.Class({left:null,bottom:null,right:null,top:null,centerLonLat:null,initialize:function(e,a,b,d){if(e!=null){this.left=OpenLayers.Util.toFloat(e)}if(a!=null){this.bottom=OpenLayers.Util.toFloat(a)}if(b!=null){this.right=OpenLayers.Util.toFloat(b)}if(d!=null){this.top=OpenLayers.Util.toFloat(d)}},clone:function(){return new OpenLayers.Bounds(this.left,this.bottom,this.right,this.top)},equals:function(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(a){if(a===true){return[this.bottom,this.left,this.top,this.right]}else{return[this.left,this.bottom,this.right,this.top]}},toBBOX:function(b,f){if(b==null){b=6}var h=Math.pow(10,b);var g=Math.round(this.left*h)/h;var e=Math.round(this.bottom*h)/h;var d=Math.round(this.right*h)/h;var a=Math.round(this.top*h)/h;if(f===true){return e+","+g+","+a+","+d}else{return g+","+e+","+d+","+a}},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(f,d){if(d==null){d=this.getCenterLonLat()}var a,j;if(d.CLASS_NAME=="OpenLayers.LonLat"){a=d.lon;j=d.lat}else{a=d.x;j=d.y}var h=(this.left-a)*f+a;var b=(this.bottom-j)*f+j;var e=(this.right-a)*f+a;var g=(this.top-j)*f+j;return new OpenLayers.Bounds(h,b,e,g)},add:function(a,d){if((a==null)||(d==null)){var b=OpenLayers.i18n("boundsAddError");OpenLayers.Console.error(b);return null}return new OpenLayers.Bounds(this.left+a,this.bottom+d,this.right+a,this.top+d)},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,e,a){if(a==null){a=true}if(b==null||e==null){return false}b=OpenLayers.Util.toFloat(b);e=OpenLayers.Util.toFloat(e);var d=false;if(a){d=((b>=this.left)&&(b<=this.right)&&(e>=this.bottom)&&(e<=this.top))}else{d=((b>this.left)&&(b<this.right)&&(e>this.bottom)&&(e<this.top))}return d},intersectsBounds:function(f,b){if(b==null){b=true}var e=false;var j=(this.left==f.right||this.right==f.left||this.top==f.bottom||this.bottom==f.top);if(b||!j){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 d=(((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)));e=((h||g)&&(d||a))}return e},containsBounds:function(h,b,a){if(b==null){b=false}if(a==null){a=true}var d=this.contains(h.left,h.bottom,a);var e=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)?(d||e||g||f):(d&&e&&g&&f)},determineQuadrant:function(d){var b="";var a=this.getCenterLonLat();b+=(d.lat<a.lat)?"b":"t";b+=(d.lon<a.lon)?"l":"r";return b},transform:function(e,b){this.centerLonLat=null;var f=OpenLayers.Projection.transform({x:this.left,y:this.bottom},e,b);var a=OpenLayers.Projection.transform({x:this.right,y:this.bottom},e,b);var d=OpenLayers.Projection.transform({x:this.left,y:this.top},e,b);var g=OpenLayers.Projection.transform({x:this.right,y:this.top},e,b);this.left=Math.min(f.x,d.x);this.bottom=Math.min(f.y,a.y);this.right=Math.max(a.x,g.x);this.top=Math.max(d.y,g.y);return this},wrapDateLine:function(a,d){d=d||{};var e=d.leftTolerance||0;var b=d.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+e)>=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.Element={visible:function(a){return OpenLayers.Util.getElement(a).style.display!="none"},toggle:function(){for(var d=0,a=arguments.length;d<a;d++){var b=OpenLayers.Util.getElement(arguments[d]);var e=OpenLayers.Element.visible(b)?"hide":"show";OpenLayers.Element[e](b)}},hide:function(){for(var d=0,a=arguments.length;d<a;d++){var b=OpenLayers.Util.getElement(arguments[d]);b.style.display="none"}},show:function(){for(var d=0,a=arguments.length;d<a;d++){var b=OpenLayers.Util.getElement(arguments[d]);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(d){d=OpenLayers.Util.getElement(d);if(OpenLayers.Element.getStyle(d,"display")!="none"){return{width:d.offsetWidth,height:d.offsetHeight}}var b=d.style;var g=b.visibility;var e=b.position;var a=b.display;b.visibility="hidden";b.position="absolute";b.display="";var h=d.clientWidth;var f=d.clientHeight;b.display=a;b.position=e;b.visibility=g;return{width:h,height:f}},hasClass:function(b,a){var d=b.className;return(!!d&&new RegExp("(^|\\s)"+a+"(\\s|$)").test(d))},addClass:function(b,a){if(!OpenLayers.Element.hasClass(b,a)){b.className+=(b.className?" ":"")+a}return b},removeClass:function(b,a){var d=b.className;if(d){b.className=OpenLayers.String.trim(d.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(d,e){d=OpenLayers.Util.getElement(d);var f=null;if(d&&d.style){f=d.style[OpenLayers.String.camelize(e)];if(!f){if(document.defaultView&&document.defaultView.getComputedStyle){var b=document.defaultView.getComputedStyle(d,null);f=b?b.getPropertyValue(e):null}else{if(d.currentStyle){f=d.currentStyle[OpenLayers.String.camelize(e)]}}}var a=["left","top","right","bottom"];if(window.opera&&(OpenLayers.Util.indexOf(a,e)!=-1)&&(OpenLayers.Element.getStyle(d,"position")=="static")){f="auto"}}return f=="auto"?null:f}};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(d,a){if((d==null)||(a==null)){var b=OpenLayers.i18n("lonlatAddError");OpenLayers.Console.error(b);return null}return new OpenLayers.LonLat(this.lon+d,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(d,b){var a=OpenLayers.Projection.transform({x:this.lon,y:this.lat},d,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,d){if((a==null)||(d==null)){var b=OpenLayers.i18n("pixelAddError");OpenLayers.Console.error(b);return null}return new OpenLayers.Pixel(this.x+a,this.y+d)},offset:function(a){var b=this.clone();if(a){b=this.add(a.x,a.y)}return b},CLASS_NAME:"OpenLayers.Pixel"});OpenLayers.Size=OpenLayers.Class({w:0,h:0,initialize:function(a,b){this.w=parseFloat(a);this.h=parseFloat(b)},toString:function(){return("w="+this.w+",h="+this.h)},clone:function(){return new OpenLayers.Size(this.w,this.h)},equals:function(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.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(d,b,e,a){this.playing=true;this.begin=d;this.finish=b;this.duration=e;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 g={};for(var d in this.begin){var a=this.begin[d];var e=this.finish[d];if(a==null||e==null||isNaN(a)||isNaN(e)){OpenLayers.Console.error("invalid value for Tween")}var h=e-a;g[d]=this.easing.apply(this,[this.time,a,h,this.duration])}this.time++;if(this.callbacks&&this.callbacks.eachStep){this.callbacks.eachStep.call(this,g)}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(e,a,g,f){return g*e/f+a},easeOut:function(e,a,g,f){return g*e/f+a},easeInOut:function(e,a,g,f){return g*e/f+a},CLASS_NAME:"OpenLayers.Easing.Linear"};OpenLayers.Easing.Expo={easeIn:function(e,a,g,f){return(e==0)?a:g*Math.pow(2,10*(e/f-1))+a},easeOut:function(e,a,g,f){return(e==f)?a+g:g*(-Math.pow(2,-10*e/f)+1)+a},easeInOut:function(e,a,g,f){if(e==0){return a}if(e==f){return a+g}if((e/=f/2)<1){return g/2*Math.pow(2,10*(e-1))+a}return g/2*(-Math.pow(2,-10*--e)+2)+a},CLASS_NAME:"OpenLayers.Easing.Expo"};OpenLayers.Easing.Quad={easeIn:function(e,a,g,f){return g*(e/=f)*e+a},easeOut:function(e,a,g,f){return -g*(e/=f)*(e-2)+a},easeInOut:function(e,a,g,f){if((e/=f/2)<1){return g/2*e*e+a}return -g/2*((--e)*(e-2)-1)+a},CLASS_NAME:"OpenLayers.Easing.Quad"};OpenLayers.Rico=new Object();OpenLayers.Rico.Corner={round:function(f,b){f=OpenLayers.Util.getElement(f);this._setOptions(b);var a=this.options.color;if(this.options.color=="fromElement"){a=this._background(f)}var d=this.options.bgColor;if(this.options.bgColor=="fromParent"){d=this._background(f.offsetParent)}this._roundCornersImpl(f,a,d)},changeColor:function(d,b){d.style.backgroundColor=b;var a=d.parentNode.getElementsByTagName("span");for(var e=0;e<a.length;e++){a[e].style.backgroundColor=b}},changeOpacity:function(d,g){var e=g;var a="alpha(opacity="+g*100+")";d.style.opacity=e;d.style.filter=a;var b=d.parentNode.getElementsByTagName("span");for(var f=0;f<b.length;f++){b[f].style.opacity=e;b[f].style.filter=a}},reRound:function(e,d){var b=e.parentNode.childNodes[0];var a=e.parentNode.childNodes[2];e.parentNode.removeChild(b);e.parentNode.removeChild(a);this.round(e.parentNode,d)},_roundCornersImpl:function(d,a,b){if(this.options.border){this._renderBorder(d,b)}if(this._isTopRounded()){this._roundTopCorners(d,a,b)}if(this._isBottomRounded()){this._roundBottomCorners(d,a,b)}},_renderBorder:function(e,f){var b="1px solid "+this._borderColor(f);var a="border-left: "+b;var g="border-right: "+b;var d="style='"+a+";"+g+"'";e.innerHTML="<div "+d+">"+e.innerHTML+"</div>"},_roundTopCorners:function(d,a,f){var e=this._createCorner(f);for(var b=0;b<this.options.numSlices;b++){e.appendChild(this._createCornerSlice(a,f,b,"top"))}d.style.paddingTop=0;d.insertBefore(e,d.firstChild)},_roundBottomCorners:function(d,a,f){var e=this._createCorner(f);for(var b=(this.options.numSlices-1);b>=0;b--){e.appendChild(this._createCornerSlice(a,f,b,"bottom"))}d.style.paddingBottom=0;d.appendChild(e)},_createCorner:function(b){var a=document.createElement("div");a.style.backgroundColor=(this._isTransparent()?"transparent":b);return a},_createCornerSlice:function(d,e,h,a){var f=document.createElement("span");var b=f.style;b.backgroundColor=d;b.display="block";b.height="1px";b.overflow="hidden";b.fontSize="1px";var g=this._borderColor(d,e);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(e,f,b){var d=this._marginSize(f);var a=b=="top"?this._whichSideTop():this._whichSideBottom();if(a=="left"){e.style.marginLeft=d+"px";e.style.marginRight="0px"}else{if(a=="right"){e.style.marginRight=d+"px";e.style.marginLeft="0px"}else{e.style.marginLeft=d+"px";e.style.marginRight=d+"px"}}},_setBorder:function(e,f,b){var d=this._borderSize(f);var a=b=="top"?this._whichSideTop():this._whichSideBottom();if(a=="left"){e.style.borderLeftWidth=d+"px";e.style.borderRightWidth="0px"}else{if(a=="right"){e.style.borderRightWidth=d+"px";e.style.borderLeftWidth="0px"}else{e.style.borderLeftWidth=d+"px";e.style.borderRightWidth=d+"px"}}if(this.options.border!=false){e.style.borderLeftWidth=d+"px";e.style.borderRightWidth=d+"px"}},_marginSize:function(f){if(this._isTransparent()){return 0}var e=[5,3,2,1];var a=[3,2,1,0];var d=[2,1];var b=[1,0];if(this.options.compact&&this.options.blend){return b[f]}else{if(this.options.compact){return d[f]}else{if(this.options.blend){return a[f]}else{return e[f]}}}},_borderSize:function(f){var e=[5,3,2,1];var b=[2,1,1,1];var a=[1,0];var d=[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 d[f]}else{if(this._isTransparent()){return e[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(d,a){var b=OpenLayers.Rico.Color.createFromHex(d);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}};OpenLayers.Rico.Color=OpenLayers.Class({initialize:function(d,b,a){this.rgb={r:d,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 d=this.asHSB();d.b=a;this.rgb=OpenLayers.Rico.Color.HSBtoRGB(d.h,d.s,d.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(e){if(e.length==4){var b=e;var e="#";for(var d=1;d<4;d++){e+=(b.charAt(d)+b.charAt(d))}}if(e.indexOf("#")==0){e=e.substring(1)}var g=e.substring(0,2);var f=e.substring(2,4);var a=e.substring(4,6);return new OpenLayers.Rico.Color(parseInt(g,16),parseInt(f,16),parseInt(a,16))};OpenLayers.Rico.Color.createColorFromBackground=function(e){var b=RicoUtil.getElementsComputedStyle(OpenLayers.Util.getElement(e),"backgroundColor","background-color");if(b=="transparent"&&e.parentNode){return OpenLayers.Rico.Color.createColorFromBackground(e.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 d=a.split(",");return new OpenLayers.Rico.Color(parseInt(d[0]),parseInt(d[1]),parseInt(d[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(k,g,m){var d=0;var e=0;var n=0;if(g==0){d=parseInt(m*255+0.5);e=d;n=d}else{var j=(k-Math.floor(k))*6;var l=j-Math.floor(j);var b=m*(1-g);var a=m*(1-g*l);var o=m*(1-(g*(1-l)));switch(parseInt(j)){case 0:d=(m*255+0.5);e=(o*255+0.5);n=(b*255+0.5);break;case 1:d=(a*255+0.5);e=(m*255+0.5);n=(b*255+0.5);break;case 2:d=(b*255+0.5);e=(m*255+0.5);n=(o*255+0.5);break;case 3:d=(b*255+0.5);e=(a*255+0.5);n=(m*255+0.5);break;case 4:d=(o*255+0.5);e=(b*255+0.5);n=(m*255+0.5);break;case 5:d=(m*255+0.5);e=(b*255+0.5);n=(a*255+0.5);break}}return{r:parseInt(d),g:parseInt(e),b:parseInt(n)}};OpenLayers.Rico.Color.RGBtoHSB=function(a,h,n){var j;var f;var m;var o=(a>h)?a:h;if(n>o){o=n}var k=(a<h)?a:h;if(n<k){k=n}m=o/255;if(o!=0){f=(o-k)/o}else{f=0}if(f==0){j=0}else{var d=(o-a)/(o-k);var l=(o-h)/(o-k);var e=(o-n)/(o-k);if(a==o){j=e-l}else{if(h==o){j=2+d-e}else{j=4+l-d}}j=j/6;if(j<0){j=j+1}}return{h:j,s:f,b:m}};OpenLayers.ProxyHost="";OpenLayers.nullHandler=function(a){OpenLayers.Console.userError(OpenLayers.i18n("unhandledRequest",{statusText:a.statusText}))};OpenLayers.loadURL=function(e,h,b,f,d){if(typeof h=="string"){h=OpenLayers.Util.getParameters(h)}var g=(f)?f:OpenLayers.nullHandler;var a=(d)?d:OpenLayers.nullHandler;return OpenLayers.Request.GET({url:e,params:h,success:g,failure:a,scope:b})};OpenLayers.parseXMLString=function(d){var a=d.indexOf("<");if(a>0){d=d.substring(a)}var b=OpenLayers.Util.Try(function(){var e=new ActiveXObject("Microsoft.XMLDOM");e.loadXML(d);return e},function(){return new DOMParser().parseFromString(d,"text/xml")},function(){var e=new XMLHttpRequest();e.open("GET","data:text/xml;charset=utf-8,"+encodeURIComponent(d),false);if(e.overrideMimeType){e.overrideMimeType("text/xml")}e.send(null);return e.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(h,d,g){var a;for(var b=0;b<this.responders.length;b++){a=this.responders[b];if(a[h]&&typeof a[h]=="function"){try{a[h].apply(a,[d,g])}catch(f){}}}}};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 f=OpenLayers.Util.extend({},this.options.parameters);if(this.method!="get"&&this.method!="post"){f._method=this.method;this.method="post"}this.parameters=f;if(f=OpenLayers.Util.getParameterString(f)){if(this.method=="get"){this.url+=((this.url.indexOf("?")>-1)?"&":"?")+f}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){f+="&_="}}}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||f):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(d){this.dispatchException(d)}},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 d=this.options.requestHeaders;if(typeof d.push=="function"){for(var b=0,e=d.length;b<e;b+=2){f[d[b]]=d[b+1]}}else{for(var b in d){f[b]=d[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 d=OpenLayers.Ajax.Request.Events[a];var b=new OpenLayers.Ajax.Response(this);if(d=="Complete"){try{this._complete=true;(this.options["on"+b.status]||this.options["on"+(this.success()?"Success":"Failure")]||OpenLayers.Ajax.emptyFunction)(b)}catch(f){this.dispatchException(f)}var g=b.getHeader("Content-type")}try{(this.options["on"+d]||OpenLayers.Ajax.emptyFunction)(b);OpenLayers.Ajax.Responders.dispatch("on"+d,this,b)}catch(f){this.dispatchException(f)}if(d=="Complete"){this.transport.onreadystatechange=OpenLayers.Ajax.emptyFunction}},getHeader:function(a){try{return this.transport.getResponseHeader(a)}catch(b){return null}},dispatchException:function(d){var e=this.options.onException;if(e){e(this,d);OpenLayers.Ajax.Responders.dispatch("onException",this,d)}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,d)}else{throw d}}}});OpenLayers.Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];OpenLayers.Ajax.Response=OpenLayers.Class({status:0,statusText:"",initialize:function(d){this.request=d;var e=this.transport=d.transport,a=this.readyState=e.readyState;if((a>2&&!(!!(window.attachEvent&&!window.opera)))||a==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=e.responseText==null?"":String(e.responseText)}if(a==4){var b=e.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,d,f){var e=null;if(b.getElementsByTagNameNS){e=b.getElementsByTagNameNS(a,f)}else{e=b.getElementsByTagName(d+":"+f)}return e};OpenLayers.Ajax.serializeXMLToString=function(a){var b=new XMLSerializer();var d=b.serializeToString(a);return d};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(d,b){var a=OpenLayers.Event.element(d);while(a.parentNode&&(!a.tagName||(a.tagName.toUpperCase()!=b.toUpperCase()))){a=a.parentNode}return a},observe:function(b,e,d,a){var f=OpenLayers.Util.getElement(b);a=a||false;if(e=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||f.attachEvent)){e="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:e,observer:d,useCapture:a});if(f.addEventListener){f.addEventListener(e,d,a)}else{if(f.attachEvent){f.attachEvent("on"+e,d)}}},stopObservingElement:function(a){var b=OpenLayers.Util.getElement(a);var d=b._eventCacheID;this._removeElementObservers(OpenLayers.Event.observers[d])},_removeElementObservers:function(f){if(f){for(var b=f.length-1;b>=0;b--){var d=f[b];var a=new Array(d.element,d.name,d.observer,d.useCapture);var e=OpenLayers.Event.stopObserving.apply(this,a)}}},stopObserving:function(j,a,h,b){b=b||false;var g=OpenLayers.Util.getElement(j);var e=g._eventCacheID;if(a=="keypress"){if(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||g.detachEvent){a="keydown"}}var l=false;var d=OpenLayers.Event.observers[e];if(d){var f=0;while(!l&&f<d.length){var k=d[f];if((k.name==a)&&(k.observer==h)&&(k.useCapture==b)){d.splice(f,1);if(d.length==0){delete OpenLayers.Event.observers[e]}l=true;break}f++}}if(l){if(g.removeEventListener){g.removeEventListener(a,h,b)}else{if(g&&g.detachEvent){g.detachEvent("on"+a,h)}}}return l},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(d,f,h,g,b){OpenLayers.Util.extend(this,b);this.object=d;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 e=0,a=h.length;e<a;e++){this.addEventType(h[e])}}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(e){if(this.element){OpenLayers.Event.stopObservingElement(this.element)}this.element=e;for(var d=0,a=this.BROWSER_EVENTS.length;d<a;d++){var b=this.BROWSER_EVENTS[d];this.addEventType(b);OpenLayers.Event.observe(e,b,this.eventHandler)}OpenLayers.Event.observe(e,"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,e,d){if((d!=null)&&(OpenLayers.Util.indexOf(this.eventTypes,b)!=-1)){if(e==null){e=this.object}var a=this.listeners[b];a.push({obj:e,func:d})}},registerPriority:function(b,e,d){if(d!=null){if(e==null){e=this.object}var a=this.listeners[b];if(a!=null){a.unshift({obj:e,func:d})}}},un:function(a){for(var b in a){if(b!="scope"){this.unregister(b,a.scope,a[b])}}},unregister:function(e,g,f){if(g==null){g=this.object}var d=this.listeners[e];if(d!=null){for(var b=0,a=d.length;b<a;b++){if(d[b].obj==g&&d[b].func==f){d.splice(b,1);break}}}},remove:function(a){if(this.listeners[a]!=null){this.listeners[a]=[]}},triggerEvent:function(f,b){var e=this.listeners[f];if(!e||e.length==0){return}if(b==null){b={}}b.object=this.object;b.element=this.element;if(!b.type){b.type=f}var e=e.slice(),g;for(var d=0,a=e.length;d<a;d++){var h=e[d];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.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(b){var f=OpenLayers.Util.extend(this.DEFAULT_CONFIG,{proxy:OpenLayers.ProxyHost});b=OpenLayers.Util.applyDefaults(b,f);var e=new OpenLayers.Request.XMLHttpRequest();var a=b.url;if(b.params){var d=OpenLayers.Util.getParameterString(b.params);if(d.length>0){var h=(a.indexOf("?")>-1)?"&":"?";a+=h+d}}if(b.proxy&&(a.indexOf("http")==0)){if(typeof b.proxy=="function"){a=b.proxy(a)}else{a=b.proxy+encodeURIComponent(a)}}e.open(b.method,a,b.async,b.user,b.password);for(var g in b.headers){e.setRequestHeader(g,b.headers[g])}var k=this.events;var j=this;e.onreadystatechange=function(){if(e.readyState==OpenLayers.Request.XMLHttpRequest.DONE){var l=k.triggerEvent("complete",{request:e,config:b,requestUrl:a});if(l!==false){j.runCallbacks({request:e,config:b,requestUrl:a})}}};if(b.async===false){e.send(b.data)}else{window.setTimeout(function(){e.send(b.data)},0)}return e},runCallbacks:function(e){var f=e.request;var d=e.config;var a=(d.scope)?OpenLayers.Function.bind(d.callback,d.scope):d.callback;var g;if(d.success){g=(d.scope)?OpenLayers.Function.bind(d.success,d.scope):d.success}var b;if(d.failure){b=(d.scope)?OpenLayers.Function.bind(d.failure,d.scope):d.failure}a(f);if(!f.status||(f.status>=200&&f.status<300)){this.events.triggerEvent("success",e);if(g){g(f)}}if(f.status&&(f.status<200||f.status>=300)){this.events.triggerEvent("failure",e);if(b){b(f)}}},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)}};(function(){var e=window.XMLHttpRequest;var j=!!window.controllers,f=window.document.all&&!window.opera;function d(){this._object=e?new e:new window.ActiveXObject("Microsoft.XMLHTTP")}if(j&&e.wrapped){d.wrapped=e.wrapped}d.UNSENT=0;d.OPENED=1;d.HEADERS_RECEIVED=2;d.LOADING=3;d.DONE=4;d.prototype.readyState=d.UNSENT;d.prototype.responseText="";d.prototype.responseXML=null;d.prototype.status=0;d.prototype.statusText="";d.prototype.onreadystatechange=null;d.onreadystatechange=null;d.onopen=null;d.onsend=null;d.onabort=null;d.prototype.open=function(n,q,m,s,l){this._async=m;var p=this,o=this.readyState;if(f){var k=function(){if(p._object.readyState!=d.DONE){a(p)}};if(m){window.attachEvent("onunload",k)}}this._object.onreadystatechange=function(){if(j&&!m){return}p.readyState=p._object.readyState;h(p);if(p._aborted){p.readyState=d.UNSENT;return}if(p.readyState==d.DONE){a(p);if(f&&m){window.detachEvent("onunload",k)}}if(o!=p.readyState){g(p)}o=p.readyState};if(d.onopen){d.onopen.apply(this,arguments)}this._object.open(n,q,m,s,l);if(!m&&j){this.readyState=d.OPENED;g(this)}};d.prototype.send=function(k){if(d.onsend){d.onsend.apply(this,arguments)}if(k&&k.nodeType){k=window.XMLSerializer?new window.XMLSerializer().serializeToString(k):k.xml;if(!this._headers["Content-Type"]){this._object.setRequestHeader("Content-Type","application/xml")}}this._object.send(k);if(j&&!this._async){this.readyState=d.OPENED;h(this);while(this.readyState<d.DONE){this.readyState++;g(this);if(this._aborted){return}}}};d.prototype.abort=function(){if(d.onabort){d.onabort.apply(this,arguments)}if(this.readyState>d.UNSENT){this._aborted=true}this._object.abort();a(this)};d.prototype.getAllResponseHeaders=function(){return this._object.getAllResponseHeaders()};d.prototype.getResponseHeader=function(k){return this._object.getResponseHeader(k)};d.prototype.setRequestHeader=function(k,l){if(!this._headers){this._headers={}}this._headers[k]=l;return this._object.setRequestHeader(k,l)};d.prototype.toString=function(){return"[object XMLHttpRequest]"};d.toString=function(){return"[XMLHttpRequest]"};function g(k){if(k.onreadystatechange){k.onreadystatechange.apply(k)}if(d.onreadystatechange){d.onreadystatechange.apply(k)}}function b(l){var k=l.responseXML;if(f&&k&&!k.documentElement&&l.getResponseHeader("Content-Type").match(/[^\/]+\/[^\+]+\+xml/)){k=new ActiveXObject("Microsoft.XMLDOM");k.loadXML(l.responseText)}if(k){if((f&&k.parseError!=0)||(k.documentElement&&k.documentElement.tagName=="parsererror")){return null}}return k}function h(k){try{k.responseText=k._object.responseText}catch(l){}try{k.responseXML=b(k._object)}catch(l){}try{k.status=k._object.status}catch(l){}try{k.statusText=k._object.statusText}catch(l){}}function a(k){k._object.onreadystatechange=new window.Function;delete k._headers}if(!window.Function.prototype.apply){window.Function.prototype.apply=function(k,l){if(!l){l=[]}k.__func=this;k.__func(l[0],l[1],l[2],l[3],l[4]);delete k.__func}}OpenLayers.Request.XMLHttpRequest=d})();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(d,b,a){if(!OpenLayers.Projection.transforms[d]){OpenLayers.Projection.transforms[d]={}}OpenLayers.Projection.transforms[d][b]=a};OpenLayers.Projection.transform=function(a,d,b){if(d.proj&&b.proj){a=Proj4js.transform(d.proj,b.proj,a)}else{if(d&&b&&OpenLayers.Projection.transforms[d.getCode()]&&OpenLayers.Projection.transforms[d.getCode()][b.getCode()]){OpenLayers.Projection.transforms[d.getCode()][b.getCode()](a)}}return a};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(j,e){if(arguments.length===1&&typeof j==="object"){e=j;j=e&&e.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,e);this.layers=[];this.id=OpenLayers.Util.createUniqueID("OpenLayers.Map_");this.div=OpenLayers.Util.getElement(j);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.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.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 d=document.getElementsByTagName("link");for(var f=0,a=d.length;f<a;++f){if(OpenLayers.Util.isEquivalentUrl(d.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)}}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);if(e&&e.layers){this.addLayers(e.layers);if(e.center){this.setCenter(e.center,e.zoom)}}},render:function(a){this.div=OpenLayers.Util.getElement(a);OpenLayers.Element.addClass(this.div,"olMap");this.events.attachToElement(this.div);this.viewPortDiv.parentNode.removeChild(this.viewPortDiv);this.div.appendChild(this.viewPortDiv);this.updateSize()},unloadDestroy:null,updateSizeDestroy:null,destroy:function(){if(!this.unloadDestroy){return false}if(this.panTween&&this.panTween.playing){this.panTween.stop()}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,d,a){var e=(typeof a.test=="function");var b=OpenLayers.Array.filter(this[f],function(g){return g[d]==a||(e&&a.test(g[d]))});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 e=0,a=this.layers.length;e<a;e++){var d=this.layers[e];if(d.id==f){b=d;break}}return b},setLayerZIndex:function(b,a){b.setZIndex(this.Z_INDEX_BASE[b.isBaseLayer?"BaseLayer":"Overlay"]+a*5)},resetLayersZIndex:function(){for(var d=0,a=this.layers.length;d<a;d++){var b=this.layers[d];this.setLayerZIndex(b,d)}},addLayer:function(d){for(var b=0,a=this.layers.length;b<a;b++){if(this.layers[b]==d){var e=OpenLayers.i18n("layerAlreadyAdded",{layerName:d.name});OpenLayers.Console.warn(e);return false}}if(this.allOverlays){d.isBaseLayer=false}if(this.events.triggerEvent("preaddlayer",{layer:d})===false){return}d.div.className="olLayerDiv";d.div.style.overflow="";this.setLayerZIndex(d,this.layers.length);if(d.isFixed){this.viewPortDiv.appendChild(d.div)}else{this.layerContainerDiv.appendChild(d.div)}this.layers.push(d);d.setMap(this);if(d.isBaseLayer||(this.allOverlays&&!this.baseLayer)){if(this.baseLayer==null){this.setBaseLayer(d)}else{d.setVisibility(false)}}else{d.redraw()}this.events.triggerEvent("addlayer",{layer:d});d.afterAdd()},addLayers:function(d){for(var b=0,a=d.length;b<a;b++){this.addLayer(d[b])}},removeLayer:function(d,f){if(f==null){f=true}if(d.isFixed){this.viewPortDiv.removeChild(d.div)}else{this.layerContainerDiv.removeChild(d.div)}OpenLayers.Util.removeItem(this.layers,d);d.removeMap(this);d.map=null;if(this.baseLayer==d){this.baseLayer=null;if(f){for(var b=0,a=this.layers.length;b<a;b++){var e=this.layers[b];if(e.isBaseLayer||this.allOverlays){this.setBaseLayer(e);break}}}}this.resetLayersZIndex();this.events.triggerEvent("removelayer",{layer:d})},getNumLayers:function(){return this.layers.length},getLayerIndex:function(a){return OpenLayers.Util.indexOf(this.layers,a)},setLayerIndex:function(e,b){var f=this.getLayerIndex(e);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,e);for(var d=0,a=this.layers.length;d<a;d++){this.setLayerZIndex(this.layers[d],d)}this.events.triggerEvent("changelayer",{layer:e,property:"order"});if(this.allOverlays){if(b===0){this.setBaseLayer(e)}else{if(this.baseLayer!==this.layers[0]){this.setBaseLayer(this.layers[0])}}}}},raiseLayer:function(b,d){var a=this.getLayerIndex(b)+d;this.setLayerIndex(b,a)},setBaseLayer:function(d){if(d!=this.baseLayer){if(OpenLayers.Util.indexOf(this.layers,d)!=-1){var a=this.getCenter();var e=OpenLayers.Util.getResolutionFromScale(this.getScale(),d.units);if(this.baseLayer!=null&&!this.allOverlays){this.baseLayer.setVisibility(false)}this.baseLayer=d;this.viewRequestID++;if(!this.allOverlays||this.baseLayer.visibility){this.baseLayer.setVisibility(true)}if(a!=null){var b=this.getZoomForResolution(e||this.resolution,true);this.setCenter(a,b,false,true)}this.events.triggerEvent("changebaselayer",{layer:this.baseLayer})}}},addControl:function(b,a){this.controls.push(b);this.addControlToMap(b,a)},addControls:function(b,h){var f=(arguments.length===1)?[]:h;for(var e=0,a=b.length;e<a;e++){var g=b[e];var d=(f[e])?f[e]:null;this.addControl(g,d)}},addControlToMap:function(b,a){b.outsideViewport=(b.div!=null);if(this.displayProjection&&!b.displayProjection){b.displayProjection=this.displayProjection}b.setMap(this);var d=b.draw(a);if(d){if(!b.outsideViewport){d.style.zIndex=this.Z_INDEX_BASE.Control+this.controls.length;this.viewPortDiv.appendChild(d)}}if(b.autoActivate){b.activate()}},getControl:function(f){var b=null;for(var d=0,a=this.controls.length;d<a;d++){var e=this.controls[d];if(e.id==f){b=e;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,e){if(e){for(var b=this.popups.length-1;b>=0;--b){this.removePopup(this.popups[b])}}a.map=this;this.popups.push(a);var d=a.draw();if(d){d.style.zIndex=this.Z_INDEX_BASE.Popup+this.popups.length;this.layerContainerDiv.appendChild(d)}},removePopup:function(a){OpenLayers.Util.removeItem(this.popups,a);if(a.div){try{this.layerContainerDiv.removeChild(a.div)}catch(b){}}a.map=null},getSize:function(){var a=null;if(this.size!=null){a=this.size.clone()}return a},updateSize:function(){var d=this.getCurrentSize();if(d&&!isNaN(d.h)&&!isNaN(d.w)){this.events.clearMouseCache();var g=this.getSize();if(g==null){this.size=g=d}if(!d.equals(g)){this.size=d;for(var e=0,b=this.layers.length;e<b;e++){this.layers[e].onMapResize()}var a=this.getCenter();if(this.baseLayer!=null&&a!=null){var f=this.getZoom();this.zoom=null;this.setCenter(a,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)){a.w=this.div.offsetWidth;a.h=this.div.offsetHeight}if(a.w==0&&a.h==0||isNaN(a.w)&&isNaN(a.h)){a.w=parseInt(this.div.style.width);a.h=parseInt(this.div.style.height)}return a},calculateBounds:function(a,b){var f=null;if(a==null){a=this.getCenter()}if(b==null){b=this.getResolution()}if((a!=null)&&(b!=null)){var e=this.getSize();var g=e.w*b;var d=e.h*b;f=new OpenLayers.Bounds(a.lon-g/2,a.lat-d/2,a.lon+g/2,a.lat+d/2)}return f},getCenter:function(){var a=null;if(this.center){a=this.center.clone()}return a},getZoom:function(){return this.zoom},pan:function(e,d,f){f=OpenLayers.Util.applyDefaults(f,{animate:true,dragging:false});var g=this.getViewPortPxFromLonLat(this.getCenter());var b=g.add(e,d);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 e={lon:a.lon,lat:a.lat};var d={lon:b.lon,lat:b.lat};this.panTween.start(e,d,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(d,a,b,e){this.moveTo(d,a,{dragging:b,forceZoomChange:e,caller:"setCenter"})},moveTo:function(h,o,s){if(!s){s={}}if(o!=null){o=parseFloat(o);if(!this.fractionalZoom){o=Math.round(o)}}var n=s.dragging;var d=s.forceZoomChange;var j=s.noEvent;if(this.panTween&&s.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(o==null){o=this.getZoom()}var e=this.getResolutionForZoom(o);var p=this.calculateBounds(h,e);if(!this.restrictedExtent.containsBounds(p)){var q=this.restrictedExtent.getCenterLonLat();if(p.getWidth()>this.restrictedExtent.getWidth()){h=new OpenLayers.LonLat(q.lon,h.lat)}else{if(p.left<this.restrictedExtent.left){h=h.add(this.restrictedExtent.left-p.left,0)}else{if(p.right>this.restrictedExtent.right){h=h.add(this.restrictedExtent.right-p.right,0)}}}if(p.getHeight()>this.restrictedExtent.getHeight()){h=new OpenLayers.LonLat(h.lon,q.lat)}else{if(p.bottom<this.restrictedExtent.bottom){h=h.add(0,this.restrictedExtent.bottom-p.bottom)}else{if(p.top>this.restrictedExtent.top){h=h.add(0,this.restrictedExtent.top-p.top)}}}}}var b=d||((this.isValidZoomLevel(o))&&(o!=this.getZoom()));var f=(this.isValidLonLat(h))&&(!h.equals(this.center));if(b||f||!n){if(!this.dragging&&!j){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=o;this.resolution=this.getResolutionForZoom(o);this.viewRequestID++}var a=this.getExtent();if(this.baseLayer.visibility){this.baseLayer.moveTo(a,b,n);if(n){this.baseLayer.events.triggerEvent("move")}else{this.baseLayer.events.triggerEvent("moveend",{zoomChanged:b})}}a=this.baseLayer.getExtent();for(var g=0,l=this.layers.length;g<l;g++){var k=this.layers[g];if(k!==this.baseLayer&&!k.isBaseLayer){var m=k.calculateInRange();if(k.inRange!=m){k.inRange=m;if(!m){k.display(false)}this.events.triggerEvent("changelayer",{layer:k,property:"visibility"})}if(m&&k.visibility){k.moveTo(a,b,n);if(n){k.events.triggerEvent("move")}else{k.events.triggerEvent("moveend",{zoomChanged:b})}}}}if(b){for(var g=0,l=this.popups.length;g<l;g++){this.popups[g].updatePosition()}}this.events.triggerEvent("move");if(b){this.events.triggerEvent("zoomend")}}if(!n&&!j){this.events.triggerEvent("moveend")}this.dragging=!!n},centerLayerContainer:function(b){var a=this.getViewPortPxFromLonLat(this.layerContainerOrigin);var d=this.getViewPortPxFromLonLat(b);if((a!=null)&&(d!=null)){this.layerContainerDiv.style.left=Math.round(a.x-d.x)+"px";this.layerContainerDiv.style.top=Math.round(a.y-d.y)+"px"}},isValidZoomLevel:function(a){return((a!=null)&&(a>=0)&&(a<this.getNumZoomLevels()))},isValidLonLat:function(d){var b=false;if(d!=null){var a=this.getMaxExtent();b=a.containsLonLat(d)}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()}else{if(this.allOverlays===true&&this.layers.length>0){a=this.layers[0].getResolution()}}return a},getUnits:function(){var a=null;if(this.baseLayer!=null){a=this.baseLayer.units}return a},getScale:function(){var d=null;if(this.baseLayer!=null){var b=this.getResolution();var a=this.baseLayer.units;d=OpenLayers.Util.getScaleFromResolution(b,a)}return d},getZoomForExtent:function(d,b){var a=null;if(this.baseLayer!=null){a=this.baseLayer.getZoomForExtent(d,b)}return a},getResolutionForZoom:function(b){var a=null;if(this.baseLayer){a=this.baseLayer.getResolutionForZoom(b)}return a},getZoomForResolution:function(a,d){var b=null;if(this.baseLayer!=null){b=this.baseLayer.getZoomForResolution(a,d)}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(e,d){var b=e.getCenterLonLat();if(this.baseLayer.wrapDateLine){var a=this.getMaxExtent();e=e.clone();while(e.right<e.left){e.right+=a.getWidth()}b=e.getCenterLonLat().wrapDateLine(a)}this.setCenter(b,this.getZoomForExtent(e,d))},zoomToMaxExtent:function(d){var b=(d)?d.restricted:true;var a=this.getMaxExtent({restricted:b});this.zoomToExtent(a)},zoomToScale:function(j,h){var e=OpenLayers.Util.getResolutionFromScale(j,this.baseLayer.units);var d=this.getSize();var g=d.w*e;var b=d.h*e;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(e){var d=null;if(e!=null){var b=parseInt(this.layerContainerDiv.style.left);var a=parseInt(this.layerContainerDiv.style.top);d=e.add(b,a)}return d},getLayerPxFromViewPortPx:function(d){var e=null;if(d!=null){var b=-parseInt(this.layerContainerDiv.style.left);var a=-parseInt(this.layerContainerDiv.style.top);e=d.add(b,a);if(isNaN(e.x)||isNaN(e.y)){e=null}}return e},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.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.getOptions())}OpenLayers.Util.applyDefaults(a,this);a.map=null;return a},getOptions:function(){var a={};for(var b in this.options){a[b]=this[b]}return a},setName:function(a){if(a!=this.name){this.name=a;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 d=this.getExtent();if(d&&this.inRange&&this.visibility){var a=true;this.moveTo(d,a,false);this.events.triggerEvent("moveend",{zoomChanged:a});b=true}}return b},moveTo:function(b,a,d){var e=this.visibility;if(!this.isBaseLayer){e=e&&this.inRange}this.display(e)},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(a){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){if(a!=(this.div.style.display!="none")){this.div.style.display=(a&&this.calculateInRange())?"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 o=new Array("projection","units","scales","resolutions","maxScale","minScale","maxResolution","minResolution","minExtent","maxExtent","numZoomLevels","maxZoomLevel");var b=["projection","units"];var f=false;var e={};for(var g=0,k=o.length;g<k;g++){var q=o[g];if(this.options[q]&&OpenLayers.Util.indexOf(b,q)==-1){f=true}e[q]=this.options[q]||this.map[q]}if(this.alwaysInRange==null){this.alwaysInRange=!f}if((this.options.minScale!=null||this.options.maxScale!=null)&&this.options.scales==null){e.scales=null}if((this.options.minResolution!=null||this.options.maxResolution!=null)&&this.options.resolutions==null){e.resolutions=null}if((!e.numZoomLevels)&&(e.maxZoomLevel)){e.numZoomLevels=e.maxZoomLevel+1}if((e.scales!=null)||(e.resolutions!=null)){if(e.scales!=null){e.resolutions=[];for(var g=0,k=e.scales.length;g<k;g++){var d=e.scales[g];e.resolutions[g]=OpenLayers.Util.getResolutionFromScale(d,e.units)}}e.numZoomLevels=e.resolutions.length}else{if(e.minScale){e.maxResolution=OpenLayers.Util.getResolutionFromScale(e.minScale,e.units)}else{if(e.maxResolution=="auto"){var p=this.map.getSize();var n=e.maxExtent.getWidth()/p.w;var j=e.maxExtent.getHeight()/p.h;e.maxResolution=Math.max(n,j)}}if(e.maxScale!=null){e.minResolution=OpenLayers.Util.getResolutionFromScale(e.maxScale,e.units)}else{if((e.minResolution=="auto")&&(e.minExtent!=null)){var p=this.map.getSize();var n=e.minExtent.getWidth()/p.w;var j=e.minExtent.getHeight()/p.h;e.minResolution=Math.max(n,j)}}if(e.minResolution!=null&&this.options.numZoomLevels==undefined){var m=e.maxResolution/e.minResolution;e.numZoomLevels=Math.floor(Math.log(m)/Math.log(2))+1}e.resolutions=new Array(e.numZoomLevels);var a=2;if(typeof e.minResolution=="number"&&e.numZoomLevels>1){a=Math.pow((e.maxResolution/e.minResolution),(1/(e.numZoomLevels-1)))}for(var g=0;g<e.numZoomLevels;g++){var l=e.maxResolution/Math.pow(a,g);e.resolutions[g]=l}}e.resolutions.sort(function(t,s){return(s-t)});this.resolutions=e.resolutions;this.maxResolution=e.resolutions[0];var h=e.resolutions.length-1;this.minResolution=e.resolutions[h];this.scales=[];for(var g=0,k=e.resolutions.length;g<k;g++){this.scales[g]=OpenLayers.Util.getScaleFromResolution(e.resolutions[g],e.units)}this.minScale=this.scales[0];this.maxScale=this.scales[this.scales.length-1];this.numZoomLevels=e.numZoomLevels},getResolution:function(){var a=this.map.getZoom();return this.getResolutionForZoom(a)},getExtent:function(){return this.map.calculateBounds()},getZoomForExtent:function(b,d){var e=this.map.getSize();if(e){var a=Math.max(b.getWidth()/e.w,b.getHeight()/e.h);return this.getZoomForResolution(a,d)}return null},getDataExtent:function(){},getResolutionForZoom:function(d){d=Math.max(0,Math.min(d,this.resolutions.length-1));var b;if(this.map.fractionalZoom){var a=Math.floor(d);var e=Math.ceil(d);b=this.resolutions[a]-((d-a)*(this.resolutions[a]-this.resolutions[e]))}else{b=this.resolutions[Math.round(d)]}return b},getZoomForResolution:function(f,a){var o;if(this.map.fractionalZoom){var l=0;var d=this.resolutions.length-1;var e=this.resolutions[l];var b=this.resolutions[d];var k;for(var g=0,h=this.resolutions.length;g<h;++g){k=this.resolutions[g];if(k>=f){e=k;l=g}if(k<=f){b=k;d=g;break}}var j=e-b;if(j>0){o=l+((e-f)/j)}else{o=l}}else{var m;var n=Number.POSITIVE_INFINITY;for(var g=0,h=this.resolutions.length;g<h;g++){if(a){m=Math.abs(this.resolutions[g]-f);if(m>n){break}n=m}else{if(this.resolutions[g]<f){break}}}o=Math.max(0,g-1)}return o},getLonLatFromViewPortPx:function(b){var f=null;if(b!=null){var e=this.map.getSize();var a=this.map.getCenter();if(a){var d=this.map.getResolution();var h=b.x-(e.w/2);var g=b.y-(e.h/2);f=new OpenLayers.LonLat(a.lon+h*d,a.lat-g*d);if(this.wrapDateLine){f=f.wrapDateLine(this.maxExtent)}}}return f},getViewPortPxFromLonLat:function(e){var b=null;if(e!=null){var a=this.map.getResolution();var d=this.map.getExtent();b=new OpenLayers.Pixel((1/a*(e.lon-d.left)),(1/a*(d.top-e.lat)))}return b},setOpacity:function(b){if(b!=this.opacity){this.opacity=b;for(var e=0,a=this.div.childNodes.length;e<a;++e){var d=this.div.childNodes[e].firstChild;OpenLayers.Util.modifyDOMElement(d,null,null,null,null,null,null,b)}if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"opacity"})}}},getZIndex:function(){return this.div.style.zIndex},setZIndex:function(a){this.div.style.zIndex=a},adjustBounds:function(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 d={rightTolerance:this.getResolution()};b=b.wrapDateLine(this.maxExtent,d)}return b},CLASS_NAME:"OpenLayers.Layer"});OpenLayers.Icon=OpenLayers.Class({url:null,size:null,offset:null,calculateOffset:null,imageDiv:null,px:null,initialize:function(a,b,e,d){this.url=a;this.size=(b)?b:new OpenLayers.Size(20,20);this.offset=e?e:new OpenLayers.Pixel(-(this.size.w/2),-(this.size.h/2));this.calculateOffset=d;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.Marker=OpenLayers.Class({icon:null,lonlat:null,events:null,map:null,initialize:function(d,b){this.lonlat=d;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 d=function(e){return new OpenLayers.Pixel(-(e.w/2),-e.h)};return new OpenLayers.Icon(a,b,null,d)};OpenLayers.Marker.Label=OpenLayers.Class(OpenLayers.Marker,{alignment:null,labelDiv:null,label:null,mouseOver:false,labelClass:"olMarkerLabel",events:null,div:null,onlyOnMouseOver:false,mouseover:false,mousedownTimeout:null,isMoving:false,cursorcache:null,markerStartXY:null,mouseStartXY:null,initialize:function(f,e,d,b){var a=[];OpenLayers.Util.extend(this,b);a.push(f,e,d);OpenLayers.Marker.prototype.initialize.apply(this,a);this.label=d;this.mousedownTimeout=null;this.isMoving=false;this.cursorcache=null;this.mouseStartXY=null;this.markerStartXY=null;this.events.includeXY=true;this.events.addEventType("moveend");this.events.addEventType("movestart");this.events.addEventType("markerclicked");this.labelDiv=OpenLayers.Util.createDiv(this.icon.id+"_Text",null,null);this.labelDiv.className=this.labelClass;this.labelDiv.innerHTML=d;this.labelDiv.style.top="0px";if(this.alignment=="left"){this.labelDiv.style.right=""+((this.icon)?(this.icon.size.w+5):0)+"px";this.labelDiv.style.textAlign="right"}else{this.labelDiv.style.left=""+((this.icon)?(this.icon.size.w+5):0)+"px"}},beginmove:function(){if(this.div){this.cursorcache=this.div.style.cursor;this.div.style.cursor="move"}if(this.mouseOver===true){this.events.unregister("mouseover",this,this.onmouseover);this.events.unregister("mouseout",this,this.onmouseout)}this.events.triggerEvent("movestart",this);this.isMoving=true;this.map.events.register("mousemove",this,this.onmousemove)},destroy:function(){this.label=null;this.labelDiv=null;OpenLayers.Marker.prototype.destroy.apply(this,arguments)},draw:function(a){this.div=OpenLayers.Marker.prototype.draw.apply(this,arguments);this.div.style.cursor="pointer";this.div.appendChild(this.labelDiv,this.div.firstChild);this.labelDiv.style.display="block";if(this.mouseOver===true){this.labelDiv.style.display="none";this.events.register("mouseover",this,this.onmouseover);this.events.register("mouseout",this,this.onmouseout)}this.events.register("mousedown",this,this.onmousedown);this.events.register("mouseup",this,this.onmouseup);return this.div},onmousedown:function(a){this.isMoving=false;if(this.mousedownTimeout){clearTimeout(this.mousedownTimeout);this.mousedownTimeout=null}this.mouseStartXY=this.map.events.getMousePosition(a);this.markerStartXY=this.icon.px.clone();this.mousedownTimeout=setTimeout(this.beginmove.bind(this),200);OpenLayers.Event.stop(a,true)},onmousemove:function(a){if((a)&&(a.xy)){var b=a.xy.add(-this.mouseStartXY.x,-this.mouseStartXY.y);if((this.icon)&&(this.icon.px)){this.moveTo(this.markerStartXY.add(b.x,b.y))}}},onmouseover:function(a){if(!this.mouseover){this.labelDiv.style.display=(this.labelDiv.style.display=="none"?"block":"none");this.mouseover=true}OpenLayers.Event.stop(a,true)},onmouseout:function(a){this.mouseover=false;this.labelDiv.style.display="none";OpenLayers.Event.stop(a,true)},onmouseup:function(a){if(this.mousedownTimeout){clearTimeout(this.mousedownTimeout);this.mousedownTimeout=null}this.map.events.unregister("mousemove",this,this.onmousemove);if(this.isMoving===true){if(this.div){this.div.style.cursor=this.cursorcache}if(this.mouseOver===true){this.events.register("mouseover",this,this.onmouseover);this.events.register("mouseout",this,this.onmouseout)}this.events.triggerEvent("moveend",this)}else{this.events.triggerEvent("markerclicked",this)}this.isMoving=false},CLASS_NAME:"OpenLayers.Marker.Label"});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,d,g,b,f,e){if(h==null){h=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")}this.id=h;this.lonlat=d;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(e)}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 d=b.getPropertyValue("overflow");if(d!="hidden"){this.contentDiv._oldOverflow=d;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(d){this.size=d.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 e=parseInt(this.closeDiv.style.width);a+=e+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=d.w+"px";this.contentDiv.style.height=d.h+"px"}},updateSize:function(){var f="<div class='"+this.contentDisplayClass+"'>"+this.contentDiv.innerHTML+"</div>";var j=(this.map)?this.map.layerContainerDiv:document.body;var k=OpenLayers.Util.getRenderedDimensions(f,null,{displayClass:this.displayClass,containerElement:j});var h=this.getSafeContentSize(k);var g=null;if(h.equals(k)){g=k}else{var b=new OpenLayers.Size();b.w=(h.w<k.w)?h.w:null;b.h=(h.h<k.h)?h.h:null;if(b.w&&b.h){g=h}else{var e=OpenLayers.Util.getRenderedDimensions(f,b,{displayClass:this.contentDisplayClass,containerElement:j});var d=OpenLayers.Element.getStyle(this.contentDiv,"overflow");if((d!="hidden")&&(e.equals(h))){var a=OpenLayers.Util.getScrollbarWidth();if(b.w){e.h+=a}else{e.w+=a}}g=this.getSafeContentSize(e)}}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 d=b[f];if(d.width==0||d.height==0){var e={popup:this,img:d};d._onImgLoad=OpenLayers.Function.bind(g,e);OpenLayers.Event.observe(d,"load",d._onImgLoad)}}},getSafeContentSize:function(m){var e=m.clone();var k=this.getContentDivPadding();var l=k.left+k.right;var h=k.top+k.bottom;this.fixPadding();l+=this.padding.left+this.padding.right;h+=this.padding.top+this.padding.bottom;if(this.closeDiv){var d=parseInt(this.closeDiv.style.width);l+=d+k.right}if(this.minSize){e.w=Math.max(e.w,(this.minSize.w-l));e.h=Math.max(e.h,(this.minSize.h-h))}if(this.maxSize){e.w=Math.min(e.w,(this.maxSize.w-l));e.h=Math.min(e.h,(this.maxSize.h-h))}if(this.map&&this.map.size){var g=0,f=0;if(this.keepInMap&&!this.panMapIfOutOfView){var j=this.map.getPixelFromLonLat(this.lonlat);switch(this.relativePosition){case"tr":g=j.x;f=this.map.size.h-j.y;break;case"tl":g=this.map.size.w-j.x;f=this.map.size.h-j.y;break;case"bl":g=this.map.size.w-j.x;f=j.y;break;case"br":g=j.x;f=j.y;break;default:g=j.x;f=this.map.size.h-j.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-l-g;e.w=Math.min(e.w,b);e.h=Math.min(e.h,a)}return e},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(d){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=d||function(f){this.hide();OpenLayers.Event.stop(f)};OpenLayers.Event.observe(this.closeDiv,"click",OpenLayers.Function.bindAsEventListener(a,this))},panIntoView:function(){var f=this.map.getSize();var e=this.map.getViewPortPxFromLayerPx(new OpenLayers.Pixel(parseInt(this.div.style.left),parseInt(this.div.style.top)));var d=e.clone();if(e.x<this.map.paddingForPopups.left){d.x=this.map.paddingForPopups.left}else{if((e.x+this.size.w)>(f.w-this.map.paddingForPopups.right)){d.x=f.w-this.map.paddingForPopups.right-this.size.w}}if(e.y<this.map.paddingForPopups.top){d.y=this.map.paddingForPopups.top}else{if((e.y+this.size.h)>(f.h-this.map.paddingForPopups.bottom)){d.y=f.h-this.map.paddingForPopups.bottom-this.size.h}}var b=e.x-d.x;var a=e.y-d.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.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(e,a,f,b,d){this.layer=e;this.position=a.clone();this.bounds=f.clone();this.url=b;this.size=d.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,d){if(d==null){d=true}this.bounds=b.clone();this.position=a.clone();if(d){this.draw()}},clear:function(){},getBoundsFromBaseLayer:function(a){var g=OpenLayers.i18n("reprojectDeprecated",{layerName:this.layer.name});OpenLayers.Console.warn(g);var e=this.layer.map.getLonLatFromLayerPx(a);var d=a.clone();d.x+=this.size.w;d.y+=this.size.h;var b=this.layer.map.getLonLatFromLayerPx(d);if(e.lon>b.lon){if(e.lon<0){e.lon=-180-(e.lon+180)}else{b.lon=180+b.lon+180}}var f=new OpenLayers.Bounds(e.lon,b.lat,b.lon,e.lat);return f},showTile:function(){if(this.shouldDraw){this.show()}},show:function(){},hide:function(){},CLASS_NAME:"OpenLayers.Tile"});OpenLayers.Tile.Image=OpenLayers.Class(OpenLayers.Tile,{url:null,imgDiv:null,frame:null,layerAlphaHack:null,isBackBuffer:false,lastRatio:1,isFirstDraw:true,backBufferTile:null,initialize:function(e,a,f,b,d){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])}OpenLayers.Event.stopObservingElement(this.imgDiv);if(this.imgDiv.parentNode==this.frame){this.frame.removeChild(this.imgDiv);this.imgDiv.map=null}this.imgDiv.urls=null;this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif"}this.imgDiv=null;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.getImageSize(this.bounds)||this.size;this.backBufferTile.imageOffset=this.layer.imageOffset;this.backBufferTile.resolution=this.layer.getResolution();this.backBufferTile.renderTile()}this.backBufferTile.hide()}},renderTile:function(){if(this.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}var a=this.frame.style;a.left=this.position.x+"px";a.top=this.position.y+"px";a.height=this.size.h+"px";a.width=this.size.w+"px";var b=this.layer.getImageSize(this.bounds);if(this.layerAlphaHack){OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv,null,null,b,this.url)}else{this.imgDiv.style.height=b.h+"px";this.imgDiv.style.width=b.w+"px";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 e=this.layer.imageOffset;var b=this.layer.getImageSize(this.bounds);if(this.layerAlphaHack){this.imgDiv=OpenLayers.Util.createAlphaImageDiv(null,e,b,null,"relative",null,null,null,true)}else{this.imgDiv=OpenLayers.Util.createImage(null,e,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 d=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(d,this))}else{OpenLayers.Event.observe(this.imgDiv,"load",OpenLayers.Function.bind(d,this))}var a=function(){if(this.imgDiv._attempts>OpenLayers.IMAGE_RELOAD_ATTEMPTS){d.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 e=1;if(this.backBufferTile.resolution){e=this.backBufferTile.resolution/this.layer.getResolution()}if(e!=this.lastRatio){if(this.layer.transitionEffect=="resize"){var d=new OpenLayers.LonLat(this.backBufferTile.bounds.left,this.backBufferTile.bounds.top);var b=new OpenLayers.Size(this.backBufferTile.size.w*e,this.backBufferTile.size.h*e);var a=this.layer.map.getLayerPxFromLonLat(d);OpenLayers.Util.modifyDOMElement(this.backBufferTile.frame,null,a,b);var f=this.backBufferTile.imageSize;f=new OpenLayers.Size(f.w*e,f.h*e);var g=this.backBufferTile.imageOffset;if(g){g=new OpenLayers.Pixel(g.x*e,g.y*e)}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=e},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.Layer.Image=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:true,url:null,extent:null,size:null,tile:null,aspectRatio:null,initialize:function(d,b,f,e,a){this.url=b;this.extent=f;this.maxExtent=f;this.size=e;OpenLayers.Layer.prototype.initialize.apply(this,[d,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.getOptions())}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 e=new OpenLayers.LonLat(this.extent.left,this.extent.top);var d=this.map.getLayerPxFromLonLat(e);if(b){this.tile=new OpenLayers.Tile.Image(this,d,this.extent,null,this.tileSize);this.addTileMonitoringHooks(this.tile)}else{this.tile.size=this.tileSize.clone();this.tile.position=d.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.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(d,b){var a=d*20037508.34/180;var e=Math.log(Math.tan((90+b)*Math.PI/360))/(Math.PI/180);e=e*20037508.34/180;return new OpenLayers.LonLat(a,e)},inverseMercator:function(a,e){var d=(a/20037508.34)*180;var b=(e/20037508.34)*180;b=180/Math.PI*(2*Math.atan(Math.exp(b*Math.PI/180))-Math.PI/2);return new OpenLayers.LonLat(d,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.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;this.pane=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)}OpenLayers.Layer.prototype.removeMap.apply(this,arguments)},loadWarningMessage:function(){this.div.style.backgroundColor="darkblue";var h=this.map.getSize();if(!h){h={w:300,h:200}}var a=Math.min(h.w,300);var f=Math.min(h.h,200);var b=new OpenLayers.Size(a,f);var e=new OpenLayers.Pixel(h.w/2,h.h/2);var d=e.add(-b.w/2,-b.h/2);var g=OpenLayers.Util.createDiv(this.name+"_warning",d,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(d,e,l){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 j=this.getMapObjectZoom();var o=this.getOLZoomFromMapObjectZoom(j);if(!(f.equals(b))||!(h==o)){if(l&&this.dragPanMapObject&&this.smoothDragPan){var k=this.map.getViewPortPxFromLonLat(b);var m=this.map.getViewPortPxFromLonLat(f);this.dragPanMapObject(m.x-k.x,k.y-m.y)}else{var a=this.getMapObjectLonLatFromOLLonLat(f);var n=this.getMapObjectZoomFromOLZoom(h);this.setMapObjectCenter(a,n,l)}}}}},getLonLatFromViewPortPx:function(a){var b=null;if((this.mapObject!=null)&&(this.getMapObjectCenter()!=null)){var e=this.getMapObjectPixelFromOLPixel(a);var d=this.getMapObjectLonLatFromMapObjectPixel(e);b=this.getOLLonLatFromMapObjectLonLat(d)}return b},getViewPortPxFromLonLat:function(b){var a=null;if((this.mapObject!=null)&&(this.getMapObjectCenter()!=null)){var e=this.getMapObjectLonLatFromOLLonLat(b);var d=this.getMapObjectPixelFromMapObjectLonLat(e);a=this.getOLPixelFromMapObjectPixel(d)}return a},getOLLonLatFromMapObjectLonLat:function(e){var a=null;if(e!=null){var d=this.getLongitudeFromMapObjectLonLat(e);var b=this.getLatitudeFromMapObjectLonLat(e);a=new OpenLayers.LonLat(d,b)}return a},getMapObjectLonLatFromOLLonLat:function(a){var b=null;if(a!=null){b=this.getMapObjectLonLatFromLonLat(a.lon,a.lat)}return b},getOLPixelFromMapObjectPixel:function(e){var b=null;if(e!=null){var a=this.getXFromMapObjectPixel(e);var d=this.getYFromMapObjectPixel(e);b=new OpenLayers.Pixel(a,d)}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 d=new Array("minZoomLevel","maxZoomLevel","numZoomLevels");for(var b=0,a=d.length;b<a;b++){var g=d[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 e=0;this.resolutions=[];for(var b=this.minZoomLevel;b<=this.maxZoomLevel;b++){this.resolutions[e++]=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 d=this.map.getSize();var b=this.getExtent();if((d!=null)&&(b!=null)){a=Math.max(b.getWidth()/d.w,b.getHeight()/d.h)}return a}},getExtent:function(){var d=null;var b=this.map.getSize();if(b){var f=new OpenLayers.Pixel(0,0);var g=this.getLonLatFromViewPortPx(f);var a=new OpenLayers.Pixel(b.w,b.h);var e=this.getLonLatFromViewPortPx(a);if((g!=null)&&(e!=null)){d=new OpenLayers.Bounds(g.lon,e.lat,e.lon,g.lat)}}return d},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.Google=OpenLayers.Class(OpenLayers.Layer.EventPane,OpenLayers.Layer.FixedZoomLevels,{MIN_ZOOM_LEVEL:0,MAX_ZOOM_LEVEL:21,RESOLUTIONS:[1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125,0.00002145767211914062,0.00001072883605957031,0.00000536441802978515,0.00000268220901489257,0.000001341104507446289,6.705522537231445e-7],type:null,sphericalMercator:false,dragObject:null,termsOfUse:null,poweredBy:null,initialize:function(b,a){OpenLayers.Layer.EventPane.prototype.initialize.apply(this,arguments);OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,arguments);this.addContainerPxFunction();if(this.sphericalMercator){OpenLayers.Util.extend(this,OpenLayers.Layer.SphericalMercator);this.initMercatorParameters()}},clone:function(){return new OpenLayers.Layer.Google(this.name,this.getOptions())},loadMapObject:function(){if(!this.type){this.type=G_NORMAL_MAP}var h,f,a;var d=OpenLayers.Layer.Google.cache[this.map.id];if(d){h=d.mapObject;f=d.termsOfUse;a=d.poweredBy;++d.count}else{var b=this.map.viewPortDiv;var j=document.createElement("div");j.id=this.map.id+"_GMap2Container";j.style.position="absolute";j.style.width="100%";j.style.height="100%";b.appendChild(j);try{h=new GMap2(j);f=j.lastChild;b.appendChild(f);f.style.zIndex="1100";f.style.right="";f.style.bottom="";f.className="olLayerGoogleCopyright";a=j.lastChild;b.appendChild(a);a.style.zIndex="1100";a.style.right="";a.style.bottom="";a.className="olLayerGooglePoweredBy gmnoprint"}catch(g){OpenLayers.Console.error(g);return}OpenLayers.Layer.Google.cache[this.map.id]={mapObject:h,termsOfUse:f,poweredBy:a,count:1}}this.mapObject=h;this.termsOfUse=f;this.poweredBy=a;if(OpenLayers.Util.indexOf(this.mapObject.getMapTypes(),this.type)===-1){this.mapObject.addMapType(this.type)}if(typeof h.getDragObject=="function"){this.dragObject=h.getDragObject()}else{this.dragPanMapObject=null}if(this.isBaseLayer===false){this.setGMapVisibility(this.div.style.display!=="none")}},onMapResize:function(){if(this.visibility&&this.mapObject.isLoaded()){this.mapObject.checkResize()}else{if(!this._resized){var a=this;var b=GEvent.addListener(this.mapObject,"load",function(){GEvent.removeListener(b);delete a._resized;a.mapObject.checkResize();a.moveTo(a.map.getCenter(),a.map.getZoom())})}this._resized=true}},setVisibility:function(b){this.setGMapVisibility(b);var a=this.opacity==null?1:this.opacity;OpenLayers.Layer.EventPane.prototype.setVisibility.apply(this,arguments);this.setOpacity(a)},setGMapVisibility:function(d){var b=OpenLayers.Layer.Google.cache[this.map.id];if(b){var a=this.mapObject.getContainer();if(d===true){this.mapObject.setMapType(this.type);a.style.display="";this.termsOfUse.style.left="";this.termsOfUse.style.display="";this.poweredBy.style.display="";b.displayed=this.id}else{if(b.displayed===this.id){delete b.displayed}if(!b.displayed){a.style.display="none";this.termsOfUse.style.display="none";this.termsOfUse.style.left="-9999px";this.poweredBy.style.display="none"}}}},setOpacity:function(b){if(b!==this.opacity){if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"opacity"})}this.opacity=b}if(this.getVisibility()){var a=this.mapObject.getContainer();OpenLayers.Util.modifyDOMElement(a,null,null,null,null,null,null,b)}},destroy:function(){if(this.map){this.setGMapVisibility(false);var a=OpenLayers.Layer.Google.cache[this.map.id];if(a&&a.count<=1){this.removeGMapElements(false)}}OpenLayers.Layer.EventPane.prototype.destroy.apply(this,arguments)},removeGMapElements:function(){var e=OpenLayers.Layer.Google.cache[this.map.id];if(e){var b=this.mapObject&&this.mapObject.getContainer();if(b&&b.parentNode){b.parentNode.removeChild(b)}var d=e.termsOfUse;if(d&&d.parentNode){d.parentNode.removeChild(d)}var a=e.poweredBy;if(a&&a.parentNode){a.parentNode.removeChild(a)}}},removeMap:function(b){if(this.visibility&&this.mapObject){this.setGMapVisibility(false)}var a=OpenLayers.Layer.Google.cache[b.id];if(a){if(a.count<=1){this.removeGMapElements();delete OpenLayers.Layer.Google.cache[b.id]}else{--a.count}}delete this.termsOfUse;delete this.poweredBy;delete this.mapObject;delete this.dragObject;OpenLayers.Layer.EventPane.prototype.removeMap.apply(this,arguments)},getOLBoundsFromMapObjectBounds:function(b){var d=null;if(b!=null){var a=b.getSouthWest();var e=b.getNorthEast();if(this.sphericalMercator){a=this.forwardMercator(a.lng(),a.lat());e=this.forwardMercator(e.lng(),e.lat())}else{a=new OpenLayers.LonLat(a.lng(),a.lat());e=new OpenLayers.LonLat(e.lng(),e.lat())}d=new OpenLayers.Bounds(a.lon,a.lat,e.lon,e.lat)}return d},getMapObjectBoundsFromOLBounds:function(d){var b=null;if(d!=null){var a=this.sphericalMercator?this.inverseMercator(d.bottom,d.left):new OpenLayers.LonLat(d.bottom,d.left);var e=this.sphericalMercator?this.inverseMercator(d.top,d.right):new OpenLayers.LonLat(d.top,d.right);b=new GLatLngBounds(new GLatLng(a.lat,a.lon),new GLatLng(e.lat,e.lon))}return b},addContainerPxFunction:function(){if((typeof GMap2!="undefined")&&!GMap2.prototype.fromLatLngToContainerPixel){GMap2.prototype.fromLatLngToContainerPixel=function(b){var a=this.fromLatLngToDivPixel(b);var d=this.getContainer().firstChild.firstChild;a.x+=d.offsetLeft;a.y+=d.offsetTop;return a}}},getWarningHTML:function(){return OpenLayers.i18n("googleWarning")},setMapObjectCenter:function(a,b){this.mapObject.setCenter(a,b)},dragPanMapObject:function(b,a){this.dragObject.moveBy(new GSize(-b,a))},getMapObjectCenter:function(){return this.mapObject.getCenter()},getMapObjectZoom:function(){return this.mapObject.getZoom()},getMapObjectLonLatFromMapObjectPixel:function(a){return this.mapObject.fromContainerPixelToLatLng(a)},getMapObjectPixelFromMapObjectLonLat:function(a){return this.mapObject.fromLatLngToContainerPixel(a)},getMapObjectZoomFromMapObjectBounds:function(a){return this.mapObject.getBoundsZoomLevel(a)},getLongitudeFromMapObjectLonLat:function(a){return this.sphericalMercator?this.forwardMercator(a.lng(),a.lat()).lon:a.lng()},getLatitudeFromMapObjectLonLat:function(b){var a=this.sphericalMercator?this.forwardMercator(b.lng(),b.lat()).lat:b.lat();return a},getMapObjectLonLatFromLonLat:function(e,b){var d;if(this.sphericalMercator){var a=this.inverseMercator(e,b);d=new GLatLng(a.lat,a.lon)}else{d=new GLatLng(b,e)}return d},getXFromMapObjectPixel:function(a){return a.x},getYFromMapObjectPixel:function(a){return a.y},getMapObjectPixelFromXY:function(a,b){return new GPoint(a,b)},CLASS_NAME:"OpenLayers.Layer.Google"});OpenLayers.Layer.Google.cache={};OpenLayers.Layer.HTTPRequest=OpenLayers.Class(OpenLayers.Layer,{URL_HASH_FACTOR:(Math.sqrt(5)-1)/2,url:null,params:null,reproject:false,initialize:function(e,d,f,b){var a=arguments;a=[e,b];OpenLayers.Layer.prototype.initialize.apply(this,a);this.url=d;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.getOptions())}a=OpenLayers.Layer.prototype.clone.apply(this,[a]);return a},setUrl:function(a){this.url=a},mergeNewParams:function(b){this.params=OpenLayers.Util.extend(this.params,b);var a=this.redraw();if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"params"})}return a},redraw:function(a){if(a){return this.mergeNewParams({_olSalt:Math.random()})}else{return OpenLayers.Layer.prototype.redraw.apply(this,[])}},selectUrl:function(f,e){var d=1;for(var b=0,a=f.length;b<a;b++){d*=f.charCodeAt(b)*this.URL_HASH_FACTOR;d-=Math.floor(d)}return e[Math.floor(d*e.length)]},getFullRequestString:function(h,e){var b=e||this.url;var g=OpenLayers.Util.extend({},this.params);g=OpenLayers.Util.extend(g,h);var f=OpenLayers.Util.getParameterString(g);if(b instanceof Array){b=this.selectUrl(f,b)}var a=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(b));for(var d in g){if(d.toUpperCase() in a){delete g[d]}}f=OpenLayers.Util.getParameterString(g);return OpenLayers.Util.urlAppend(b,f)},CLASS_NAME:"OpenLayers.Layer.HTTPRequest"});OpenLayers.Layer.Grid=OpenLayers.Class(OpenLayers.Layer.HTTPRequest,{tileSize:null,tileOriginCorner:"bl",tileOrigin:null,tileOptions:null,grid:null,singleTile:false,ratio:1.5,buffer:0,numLoadingTiles:0,tileLoadingDelay:100,timerId:null,initialize:function(d,b,e,a){OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,arguments);this.events.addEventType("tileloaded");this.grid=[];this._moveGriddedTiles=OpenLayers.Function.bind(this.moveGriddedTiles,this)},removeMap:function(a){if(this.timerId!=null){window.clearTimeout(this.timerId);this.timerId=null}},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 d=0,a=f.length;d<a;d++){var e=f[d];this.removeTileMonitoringHooks(e);e.destroy()}}this.grid=[]}},clone:function(a){if(a==null){a=new OpenLayers.Layer.Grid(this.name,this.url,this.params,this.getOptions())}a=OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this,[a]);if(this.tileSize!=null){a.tileSize=this.tileSize.clone()}a.grid=[];return a},moveTo:function(e,a,f){OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this,arguments);e=e||this.map.getExtent();if(e!=null){var d=!this.grid.length||a;var b=this.getTilesBounds();if(this.singleTile){if(d||(!f&&!b.containsBounds(e))){this.initSingleTile(e)}}else{if(d||!b.containsBounds(e,true)){this.initGriddedTiles(e)}else{this.scheduleMoveGriddedTiles()}}}},moveByPx:function(b,a){this.scheduleMoveGriddedTiles()},scheduleMoveGriddedTiles:function(){if(this.timerId!=null){window.clearTimeout(this.timerId)}this.timerId=window.setTimeout(this._moveGriddedTiles,this.tileLoadingDelay)},setTileSize:function(b){if(this.singleTile){var a=this.map.getSize();if(a){b=a.clone();b.h=parseInt(b.h*this.ratio);b.w=parseInt(b.w*this.ratio)}}OpenLayers.Layer.HTTPRequest.prototype.setTileSize.apply(this,[b])},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 e=this.grid[a][0];var b=this.grid[0].length-1;var d=this.grid[0][b];f=new OpenLayers.Bounds(e.bounds.left,e.bounds.bottom,d.bounds.right,d.bounds.top)}return f},initSingleTile:function(g){var a=g.getCenterLonLat();var j=g.getWidth()*this.ratio;var b=g.getHeight()*this.ratio;var h=new OpenLayers.Bounds(a.lon-(j/2),a.lat-(b/2),a.lon+(j/2),a.lat+(b/2));var e=new OpenLayers.LonLat(h.left,h.top);var d=this.map.getLayerPxFromLonLat(e);if(!this.grid.length){this.grid[0]=[]}var f=this.grid[0][0];if(!f){f=this.addTile(h,d);this.addTileMonitoringHooks(f);f.draw();this.grid[0][0]=f}else{f.moveTo(h,d)}this.removeExcessTiles(1,1)},calculateGridLayout:function(a,p,f){var m=f*this.tileSize.w;var d=f*this.tileSize.h;var k=a.left-p.lon;var n=Math.floor(k/m)-this.buffer;var l=k/m-n;var g=-l*this.tileSize.w;var o=p.lon+n*m;var b=a.top-(p.lat+d);var j=Math.ceil(b/d)+this.buffer;var q=j-b/d;var e=-q*this.tileSize.h;var h=p.lat+j*d;return{tilelon:m,tilelat:d,tileoffsetlon:o,tileoffsetlat:h,tileoffsetx:g,tileoffsety:e}},getTileOrigin:function(){var b=this.tileOrigin;if(!b){var d=this.getMaxExtent();var a=({tl:["left","top"],tr:["right","top"],bl:["left","bottom"],br:["right","bottom"]})[this.tileOriginCorner];b=new OpenLayers.LonLat(d[a[0]],d[a[1]])}return b},initGriddedTiles:function(k){var h=this.map.getSize();var z=Math.ceil(h.h/this.tileSize.h)+Math.max(1,2*this.buffer);var B=Math.ceil(h.w/this.tileSize.w)+Math.max(1,2*this.buffer);var D=this.getTileOrigin();var t=this.map.getResolution();var s=this.calculateGridLayout(k,D,t);var g=Math.round(s.tileoffsetx);var d=Math.round(s.tileoffsety);var m=s.tileoffsetlon;var p=s.tileoffsetlat;var f=s.tilelon;var l=s.tilelat;this.origin=new OpenLayers.Pixel(g,d);var w=g;var A=m;var v=0;var a=parseInt(this.map.layerContainerDiv.style.left);var u=parseInt(this.map.layerContainerDiv.style.top);do{var j=this.grid[v++];if(!j){j=[];this.grid.push(j)}m=A;g=w;var e=0;do{var b=new OpenLayers.Bounds(m,p,m+f,p+l);var o=g;o-=a;var n=d;n-=u;var q=new OpenLayers.Pixel(o,n);var C=j[e++];if(!C){C=this.addTile(b,q);this.addTileMonitoringHooks(C);j.push(C)}else{C.moveTo(b,q,false)}m+=f;g+=this.tileSize.w}while((m<=k.right+f*this.buffer)||e<B);p-=l;d+=this.tileSize.h}while((p>=k.bottom-l*this.buffer)||v<z);this.removeExcessTiles(v,e);this.spiralTileLoad()},getMaxExtent:function(){return this.maxExtent},spiralTileLoad:function(){var b=[];var j=["right","down","left","up"];var h=0;var a=-1;var l=OpenLayers.Util.indexOf(j,"right");var m=0;while(m<j.length){var k=h;var d=a;switch(j[l]){case"right":d++;break;case"down":k++;break;case"left":d--;break;case"up":k--;break}var g=null;if((k<this.grid.length)&&(k>=0)&&(d<this.grid[0].length)&&(d>=0)){g=this.grid[k][d]}if((g!=null)&&(!g.queued)){b.unshift(g);g.queued=true;m=0;h=k;a=d}else{l=(l+1)%4;m++}}for(var e=0,f=b.length;e<f;e++){var g=b[e];g.draw();g.queued=false}},addTile:function(b,a){return new OpenLayers.Tile.Image(this,a,b,null,this.tileSize,this.tileOptions)},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(){var e=true;var d=this.buffer||1;var b=this.grid[0][0].position;var a=parseInt(this.map.layerContainerDiv.style.left);var g=parseInt(this.map.layerContainerDiv.style.top);var f=b.add(a,g);if(f.x>-this.tileSize.w*(d-1)){this.shiftColumn(true)}else{if(f.x<-this.tileSize.w*d){this.shiftColumn(false)}else{if(f.y>-this.tileSize.h*(d-1)){this.shiftRow(true)}else{if(f.y<-this.tileSize.h*d){this.shiftRow(false)}else{e=false}}}}if(e){this.timerId=window.setTimeout(this._moveGriddedTiles,0)}},shiftRow:function(o){var d=(o)?0:(this.grid.length-1);var b=this.grid;var g=b[d];var f=this.map.getResolution();var j=(o)?-this.tileSize.h:this.tileSize.h;var h=f*-j;var n=(o)?b.pop():b.shift();for(var k=0,m=g.length;k<m;k++){var e=g[k];var a=e.bounds.clone();var l=e.position.clone();a.bottom=a.bottom+h;a.top=a.top+h;l.y=l.y+j;n[k].moveTo(a,l)}if(o){b.unshift(n)}else{b.push(n)}},shiftColumn:function(n){var e=(n)?-this.tileSize.w:this.tileSize.w;var d=this.map.getResolution();var l=d*e;for(var f=0,h=this.grid.length;f<h;f++){var m=this.grid[f];var k=(n)?0:(m.length-1);var b=m[k];var a=b.bounds.clone();var g=b.position.clone();a.left=a.left+l;a.right=a.right+l;g.x=g.x+e;var j=n?this.grid[f].pop():this.grid[f].shift();j.moveTo(a,g);if(n){m.unshift(j)}else{m.push(j)}}},removeExcessTiles:function(f,d){while(this.grid.length>f){var g=this.grid.pop();for(var b=0,a=g.length;b<a;b++){var e=g[b];this.removeTileMonitoringHooks(e);e.destroy()}}while(this.grid[0].length>d){for(var b=0,a=this.grid.length;b<a;b++){var g=this.grid[b];var e=g.pop();this.removeTileMonitoringHooks(e);e.destroy()}}},onMapResize:function(){if(this.singleTile){this.clearGrid();this.setTileSize()}},getTileBounds:function(e){var d=this.maxExtent;var g=this.getResolution();var f=g*this.tileSize.w;var b=g*this.tileSize.h;var j=this.getLonLatFromViewPortPx(e);var a=d.left+(f*Math.floor((j.lon-d.left)/f));var h=d.bottom+(b*Math.floor((j.lat-d.bottom)/b));return new OpenLayers.Bounds(a,h,a+f,h+b)},CLASS_NAME:"OpenLayers.Layer.Grid"});OpenLayers.Layer.MapServer=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{mode:"map",map_imagetype:"png"},initialize:function(e,d,f,b){var a=[];a.push(e,d,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.getOptions())}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(d){d=this.adjustBounds(d);var b=[d.left,d.bottom,d.right,d.top];var e=this.getImageSize();var a=this.getFullRequestString({mapext:b,imgext:b,map_size:[e.w,e.h],imgx:e.w/2,imgy:e.h/2,imgxy:[e.w,e.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 e=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(b));for(var j in h){if(j.toUpperCase() in e){delete h[j]}}a=OpenLayers.Util.getParameterString(h);var k=b;a=a.replace(/,/g,"+");if(a!=""){var d=b.charAt(b.length-1);if((d=="&")||(d=="?")){k+=a}else{if(b.indexOf("?")==-1){k+="?"+a}else{k+="&"+a}}}return k},CLASS_NAME:"OpenLayers.Layer.MapServer"});OpenLayers.Layer.SRCMapServer=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{rt:"bc"},initialize:function(e,d,f,b){var a=[];a.push(e,d,f,b);OpenLayers.Layer.Grid.prototype.initialize.apply(this,a);if(arguments.length>0){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.SRCMapServer(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(d){d=this.adjustBounds(d);var b=[d.left,d.bottom,d.right,d.top];var e=this.getImageSize();var a=this.getFullRequestString({minx:d.left,miny:d.bottom,maxx:d.right,maxy:d.top,w:e.w,h:e.h});return a},getFullRequestString:function(h,e){var b=(e==null)?this.url:e;var g=OpenLayers.Util.extend({},this.params);g=OpenLayers.Util.extend(g,h);var f=aw.Object.toQueryString(g);if(b instanceof Array){b=this.selectUrl(f,b)}var a=b;if(f!=""){var d=b.charAt(b.length-1);if((d=="&")||(d=="?")){a+=f}else{if(b.indexOf("?")==-1){a+="?"+f}else{a+="&"+f}}}return a},CLASS_NAME:"OpenLayers.Layer.SRCMapServer"});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(e,d){var a;if(this.sphericalMercator){var b=this.inverseMercator(e,d);a=new MMLatLon(b.lat,b.lon)}else{a=new MMLatLon(d,e)}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.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 d=0,a=this.markers.length;d<a;d++){this.markers[d].setOpacity(this.opacity)}}},moveTo:function(e,b,f){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);if(b||!this.drawn){for(var d=0,a=this.markers.length;d<a;d++){this.drawMarker(this.markers[d])}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 d=a.draw(b);this.div.appendChild(d)}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 e=0,a=this.markers.length;e<a;e++){var d=this.markers[e];b.extend(d.lonlat)}}return b},CLASS_NAME:"OpenLayers.Layer.Markers"});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(d,a,b){OpenLayers.Layer.Markers.prototype.moveTo.apply(this,arguments);if(this.visibility&&!this.loaded){this.loadText()}},parseData:function(l){var n=l.responseText;var p={};OpenLayers.Util.extend(p,this.formatOptions);if(this.map&&!this.projection.equals(this.map.getProjectionObject())){p.externalProjection=this.projection;p.internalProjection=this.map.getProjectionObject()}var b=new OpenLayers.Format.Text(p);var d=b.read(n);for(var h=0,j=d.length;h<j;h++){var g={};var o=d[h];var m;var k,e;m=new OpenLayers.LonLat(o.geometry.x,o.geometry.y);if(o.style.graphicWidth&&o.style.graphicHeight){k=new OpenLayers.Size(o.style.graphicWidth,o.style.graphicHeight)}if(o.style.graphicXOffset!==undefined&&o.style.graphicYOffset!==undefined){e=new OpenLayers.Pixel(o.style.graphicXOffset,o.style.graphicYOffset)}if(o.style.externalGraphic!=null){g.icon=new OpenLayers.Icon(o.style.externalGraphic,k,e)}else{g.icon=OpenLayers.Marker.defaultIcon();if(k!=null){g.icon.setSize(k)}}if((o.attributes.title!=null)&&(o.attributes.description!=null)){g.popupContentHTML="<h2>"+o.attributes.title+"</h2><p>"+o.attributes.description+"</p>"}g.overflow=o.attributes.overflow||"auto";var a=new OpenLayers.Feature(this,m,g);this.features.push(a);var f=a.createMarker();if((o.attributes.title!=null)&&(o.attributes.description!=null)){f.events.register("click",a,this.markerClick)}this.addMarker(f)}this.events.triggerEvent("loadend")},markerClick:function(b){var e=(this==this.layer.selectedFeature);this.layer.selectedFeature=(!e)?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(!e){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.Layer.ArcGIS93Rest=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{format:"png"},isBaseLayer:true,initialize:function(e,d,f,b){var a=[];f=OpenLayers.Util.upperCaseObject(f);a.push(e,d,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.getOptions())}a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a]);return a},getURL:function(f){f=this.adjustBounds(f);var e=this.projection.getCode().split(":");var d=e[e.length-1];var h=this.getImageSize();var j={BBOX:f.toBBOX(),SIZE:h.w+","+h.h,F:"image",BBOXSR:d,IMAGESR:d};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){j.LAYERDEFS=g.join("")}}var b=this.getFullRequestString(j);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(d){var b=OpenLayers.Util.upperCaseObject(d);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.Boxes=OpenLayers.Class(OpenLayers.Layer.Markers,{initialize:function(b,a){OpenLayers.Layer.Markers.prototype.initialize.apply(this,arguments)},drawMarker:function(a){var e=a.bounds;var g=this.map.getLayerPxFromLonLat(new OpenLayers.LonLat(e.left,e.top));var d=this.map.getLayerPxFromLonLat(new OpenLayers.LonLat(e.right,e.bottom));if(d==null||g==null){a.display(false)}else{var f=new OpenLayers.Size(Math.max(1,d.x-g.x),Math.max(1,d.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.XYZ=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:true,sphericalMercator:false,zoomOffset:0,serverResolutions:null,initialize:function(e,d,b){if(b&&b.sphericalMercator||this.sphericalMercator){b=OpenLayers.Util.extend({maxExtent:new OpenLayers.Bounds(-128*156543.03390625,-128*156543.03390625,128*156543.03390625,128*156543.03390625),maxResolution:156543.03390625,numZoomLevels:19,units:"m",projection:"EPSG:900913"},b)}d=d||this.url;e=e||this.name;var a=[e,d,{},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.getOptions())}a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a]);return a},getURL:function(e){var a=this.getXYZ(e);var b=this.url;if(b instanceof Array){var d=""+a.x+a.y+a.z;b=this.selectUrl(d,b)}return OpenLayers.String.format(b,a)},getXYZ:function(e){var d=this.map.getResolution();var a=Math.round((e.left-this.maxExtent.left)/(d*this.tileSize.w));var g=Math.round((this.maxExtent.top-e.top)/(d*this.tileSize.h));var f=this.serverResolutions!=null?OpenLayers.Util.indexOf(this.serverResolutions,d):this.map.getZoom()+this.zoomOffset;var b=Math.pow(2,f);if(this.wrapDateLine){a=((a%b)+b)%b}return{x:a,y:g,z:f}},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",clone:function(a){if(a==null){a=new OpenLayers.Layer.OSM(this.name,this.url,this.getOptions())}a=OpenLayers.Layer.XYZ.prototype.clone.apply(this,[a]);return a},wrapDateLine:true,CLASS_NAME:"OpenLayers.Layer.OSM"});OpenLayers.Layer.Bing=OpenLayers.Class(OpenLayers.Layer.XYZ,{attributionTemplate:'<span class="olBingAttribution ${type}"><div><a target="_blank" href="http://www.bing.com/maps/"><img src="${logo}" /></a></div>${copyrights}<a style="white-space: nowrap" target="_blank" href="http://www.microsoft.com/maps/product/terms.html">Terms of Use</a></span>',metadata:null,type:"Road",metadataParams:null,initialize:function(d){d=OpenLayers.Util.applyDefaults({restrictedMinZoom:1,sphericalMercator:true},d);var b=d.name||"Bing "+(d.type||this.type);var a=[b,null,d];OpenLayers.Layer.XYZ.prototype.initialize.apply(this,a);this.loadMetadata()},loadMetadata:function(){this._callbackId="_callback_"+this.id.replace(/\./g,"_");window[this._callbackId]=OpenLayers.Function.bind(OpenLayers.Layer.Bing.processMetadata,this);var d=OpenLayers.Util.applyDefaults({key:this.key,jsonp:this._callbackId,include:"ImageryProviders"},this.metadataParams);var b="http://dev.virtualearth.net/REST/v1/Imagery/Metadata/"+this.type+"?"+OpenLayers.Util.getParameterString(d);var a=document.createElement("script");a.type="text/javascript";a.src=b;a.id=this._callbackId;document.getElementsByTagName("head")[0].appendChild(a)},initLayer:function(){var d=this.metadata.resourceSets[0].resources[0];var a=d.imageUrl.replace("{quadkey}","${quadkey}");this.url=[];for(var b=0;b<d.imageUrlSubdomains.length;++b){this.url.push(a.replace("{subdomain}",d.imageUrlSubdomains[b]))}this.addOptions({restrictedMinZoom:d.zoomMin,numZoomLevels:d.zoomMax+1});this.updateAttribution();this.redraw()},getURL:function(a){if(!this.url){return OpenLayers.Util.getImagesLocation()+"blank.gif"}var h=this.getXYZ(a),l=h.x,j=h.y,g=h.z;var d=[];for(var e=g;e>0;--e){var k="0";var m=1<<(e-1);if((l&m)!=0){k++}if((j&m)!=0){k++;k++}d.push(k)}var f=d.join("");var b=this.selectUrl(""+l+j+g,this.url);return OpenLayers.String.format(b,{quadkey:f})},updateAttribution:function(){var h=this.metadata;if(!h||!this.map||!this.map.center){return}var g=h.resourceSets[0].resources[0];var p=this.map.getExtent().transform(this.map.getProjectionObject(),new OpenLayers.Projection("EPSG:4326"));var d=g.imageryProviders,o=this.map.getZoom()+1,a="",k,e,n,b,f,m,l;for(e=0,n=d.length;e<n;++e){k=d[e];for(b=0,f=k.coverageAreas.length;b<f;++b){l=k.coverageAreas[b];m=OpenLayers.Bounds.fromArray(l.bbox);if(p.intersectsBounds(m)&&o<=l.zoomMax&&o>=l.zoomMin){a+=k.attribution+" "}}}this.attribution=OpenLayers.String.format(this.attributionTemplate,{type:this.type.toLowerCase(),logo:h.brandLogoUri,copyrights:a});this.map&&this.map.events.triggerEvent("changelayer",{layer:this})},setMap:function(){OpenLayers.Layer.XYZ.prototype.setMap.apply(this,arguments);this.updateAttribution();this.map.events.register("moveend",this,this.updateAttribution)},clone:function(a){if(a==null){a=new OpenLayers.Layer.Bing(this.options)}a=OpenLayers.Layer.XYZ.prototype.clone.apply(this,[a]);return a},destroy:function(){this.map&&this.map.events.unregister("moveend",this,this.updateAttribution);OpenLayers.Layer.XYZ.prototype.destroy.apply(this,arguments)},CLASS_NAME:"OpenLayers.Layer.Bing"});OpenLayers.Layer.Bing.processMetadata=function(b){this.metadata=b;this.initLayer();var a=document.getElementById(this._callbackId);a.parentNode.removeChild(a);window[this._callbackId]=undefined;delete this._callbackId};OpenLayers.Layer.TileCache=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:true,format:"image/png",serverResolutions:null,initialize:function(d,b,e,a){this.layername=e;OpenLayers.Layer.Grid.prototype.initialize.apply(this,[d,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.getOptions())}a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a]);return a},getURL:function(b){var g=this.map.getResolution();var h=this.maxExtent;var m=this.tileSize;var a=Math.round((b.left-h.left)/(g*m.w));var l=Math.round((b.bottom-h.bottom)/(g*m.h));var j=this.serverResolutions!=null?OpenLayers.Util.indexOf(this.serverResolutions,g):this.map.getZoom();function f(q,p){q=String(q);var n=[];for(var o=0;o<p;++o){n.push("0")}return n.join("").substring(0,p-q.length)+q}var e=[this.layername,f(j,2),f(parseInt(a/1000000),3),f((parseInt(a/1000)%1000),3),f((parseInt(a)%1000),3),f(parseInt(l/1000000),3),f((parseInt(l/1000)%1000),3),f((parseInt(l)%1000),3)+"."+this.extension];var k=e.join("/");var d=this.url;if(d instanceof Array){d=this.selectUrl(k,d)}d=(d.charAt(d.length-1)=="/")?d:d+"/";return d+k},addTile:function(d,a){var b=this.getURL(d);return new OpenLayers.Tile.Image(this,a,d,b,this.tileSize)},CLASS_NAME:"OpenLayers.Layer.TileCache"});OpenLayers.Layer.Zoomify=OpenLayers.Class(OpenLayers.Layer.Grid,{url:null,size:null,isBaseLayer:true,standardTileSize:256,numberOfTiers:0,tileCountUpToTier:new Array(),tierSizeInTiles:new Array(),tierImageSize:new Array(),initialize:function(e,d,f,b){this.initializeZoomify(f);var a=[];a.push(e,d,f,{},b);OpenLayers.Layer.Grid.prototype.initialize.apply(this,a)},initializeZoomify:function(d){var e=d.clone();var a=new OpenLayers.Size(Math.ceil(e.w/this.standardTileSize),Math.ceil(e.h/this.standardTileSize));this.tierSizeInTiles.push(a);this.tierImageSize.push(e);while(e.w>this.standardTileSize||e.h>this.standardTileSize){e=new OpenLayers.Size(Math.floor(e.w/2),Math.floor(e.h/2));a=new OpenLayers.Size(Math.ceil(e.w/this.standardTileSize),Math.ceil(e.h/this.standardTileSize));this.tierSizeInTiles.push(a);this.tierImageSize.push(e)}this.tierSizeInTiles.reverse();this.tierImageSize.reverse();this.numberOfTiers=this.tierSizeInTiles.length;this.tileCountUpToTier[0]=0;for(var b=1;b<this.numberOfTiers;b++){this.tileCountUpToTier.push(this.tierSizeInTiles[b-1].w*this.tierSizeInTiles[b-1].h+this.tileCountUpToTier[b-1])}},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments);this.tileCountUpToTier.length=0;this.tierSizeInTiles.length=0;this.tierImageSize.length=0},clone:function(a){if(a==null){a=new OpenLayers.Layer.Zoomify(this.name,this.url,this.size,this.options)}a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a]);return a},getURL:function(e){e=this.adjustBounds(e);var d=this.map.getResolution();var a=Math.round((e.left-this.tileOrigin.lon)/(d*this.tileSize.w));var j=Math.round((this.tileOrigin.lat-e.top)/(d*this.tileSize.h));var h=this.map.getZoom();var g=a+j*this.tierSizeInTiles[h].w+this.tileCountUpToTier[h];var f="TileGroup"+Math.floor((g)/256)+"/"+h+"-"+a+"-"+j+".jpg";var b=this.url;if(b instanceof Array){b=this.selectUrl(f,b)}return b+f},getImageSize:function(){if(arguments.length>0){bounds=this.adjustBounds(arguments[0]);var d=this.map.getResolution();var a=Math.round((bounds.left-this.tileOrigin.lon)/(d*this.tileSize.w));var g=Math.round((this.tileOrigin.lat-bounds.top)/(d*this.tileSize.h));var f=this.map.getZoom();var b=this.standardTileSize;var e=this.standardTileSize;if(a==this.tierSizeInTiles[f].w-1){var b=this.tierImageSize[f].w%this.standardTileSize}if(g==this.tierSizeInTiles[f].h-1){var e=this.tierImageSize[f].h%this.standardTileSize}return(new OpenLayers.Size(b,e))}else{return this.tileSize}},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);this.tileOrigin=new OpenLayers.LonLat(this.map.maxExtent.left,this.map.maxExtent.top)},calculateGridLayout:function(a,q,f){var m=f*this.tileSize.w;var d=f*this.tileSize.h;var k=a.left-q.left;var n=Math.floor(k/m)-this.buffer;var l=k/m-n;var g=-l*this.tileSize.w;var o=q.left+n*m;var b=q.top-a.top+d;var j=Math.floor(b/d)-this.buffer;var p=j-b/d;var e=p*this.tileSize.h;var h=q.top-d*j;return{tilelon:m,tilelat:d,tileoffsetlon:o,tileoffsetlat:h,tileoffsetx:g,tileoffsety:e}},CLASS_NAME:"OpenLayers.Layer.Zoomify"});OpenLayers.Popup.Anchored=OpenLayers.Class(OpenLayers.Popup,{relativePosition:null,keepInMap:true,anchor:null,initialize:function(j,e,h,d,b,g,f){var a=[j,e,h,d,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(d){var b=this.relativePosition;this.relativePosition=this.calculateRelativePosition(d);var e=this.calculateNewPx(d);var a=new Array(e);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 e=this.map.getLonLatFromLayerPx(b);var d=this.map.getExtent();var a=d.determineQuadrant(e);return OpenLayers.Bounds.oppositeQuadrant(a)},updateRelativePosition:function(){},calculateNewPx:function(b){var f=b.offset(this.anchor.offset);var a=this.size||this.contentSize;var e=(this.relativePosition.charAt(0)=="t");f.y+=(e)?-a.h:this.anchor.size.h;var d=(this.relativePosition.charAt(1)=="l");f.x+=(d)?-a.w:this.anchor.size.w;return f},CLASS_NAME:"OpenLayers.Popup.Anchored"});OpenLayers.Popup.AnchoredBubble=OpenLayers.Class(OpenLayers.Popup.Anchored,{rounded:false,initialize:function(h,d,g,b,a,f,e){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.Annotation=OpenLayers.Class(OpenLayers.Popup.Anchored,{displayClass:"olPopupAnnotation",initialize:function(f,e,d,b){OpenLayers.Popup.Anchored.prototype.initialize.apply(this,[f,e,new OpenLayers.Size(300,150),d,b,false,null]);this.div=OpenLayers.Util.createDiv(this.id,null,this.contentSize,null,null,null,"hidden");this.div.className=this.displayClass;this.div.innerHTML='<div class="t"><div class="l"></div><div class="c"></div><div class="r"></div></div><div class="m"><div class="l"></div><div class="c"></div><div class="r"></div></div><div class="b"><div class="l"></div><div class="c"></div><div class="r"></div></div>';this.contentDiv=OpenLayers.Util.createDiv();this.contentDiv.className=this.contentDisplayClass;this.div.appendChild(this.contentDiv);this.arrowdiv=OpenLayers.Util.createDiv();this.arrowdiv.className="arrow";this.div.appendChild(this.arrowdiv);this.closeDiv=OpenLayers.Util.createDiv();this.closeDiv.className="olPopupCloseBox";this.div.appendChild(this.closeDiv);var a=function(g){this.hide();OpenLayers.Event.stop(g)};OpenLayers.Event.observe(this.closeDiv,"click",OpenLayers.Function.bindAsEventListener(a,this))},setSize:function(d){this.size=d.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 e=parseInt(this.closeDiv.style.width);if(!isNaN(e)){a+=e+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"}},setBackgroundColor:function(a){if(a!=undefined){this.backgroundColor=a}if(this.contentDiv!==null){this.contentDiv.style.backgroundColor=this.backgroundColor}},updateRelativePosition:function(){var a="";switch(this.relativePosition){case"tl":a="br";break;case"tr":a="bl";break;case"bl":a="tr";break;case"br":a="tl";break}if(this.div){this.div.className=this.displayClass+" "+this.relativePosition}if(this.arrowdiv){this.arrowdiv.className="arrow "+a}},CLASS_NAME:"OpenLayers.Popup.Annotation"});OpenLayers.Feature=OpenLayers.Class({layer:null,id:null,lonlat:null,data:null,marker:null,popupClass:OpenLayers.Popup.AnchoredBubble,popup:null,initialize:function(a,d,b){this.layer=a;this.lonlat=d;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)}}if(this.layer!=null&&this.marker!=null){this.layer.removeMarker(this.marker)}this.layer=null;this.id=null;this.lonlat=null;this.data=null;if(this.marker!=null){this.destroyMarker(this.marker);this.marker=null}if(this.popup!=null){this.destroyPopup(this.popup);this.popup=null}},onScreen:function(){var 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 d=this.id+"_popup";var a=(this.marker)?this.marker.icon:null;if(!this.popup){this.popup=new this.popupClass(d,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.State={UNKNOWN:"Unknown",INSERT:"Insert",UPDATE:"Update",DELETE:"Delete"};OpenLayers.Feature.Vector=OpenLayers.Class(OpenLayers.Feature,{fid:null,geometry:null,attributes:null,bounds:null,state:null,style:null,url:null,renderIntent:"default",initialize:function(d,a,b){OpenLayers.Feature.prototype.initialize.apply(this,[null,null,a]);this.lonlat=null;this.geometry=d?d: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(e){var d=false;if(this.layer&&this.layer.map){var a=this.layer.map.getExtent();if(e){var b=this.geometry.getBounds();d=a.intersectsBounds(b)}else{var f=a.toGeometry();d=f.intersects(this.geometry)}}return d},getVisibility:function(){return !(this.style&&this.style.display=="none"||!this.layer||this.layer&&this.layer.styleMap&&this.layer.styleMap.createSymbolizer(this,this.renderIntent).display=="none"||this.layer&&!this.layer.getVisibility())},createMarker:function(){return null},destroyMarker:function(){},createPopup:function(){return null},atPoint:function(b,e,d){var a=false;if(this.geometry){a=this.geometry.atPoint(b,e,d)}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 e=this.layer.getViewPortPxFromLonLat(this.geometry.getBounds().getCenterLonLat());var d=this.layer.map.getResolution();this.geometry.move(d*(b.x-e.x),d*(e.y-b.y));this.layer.drawFeature(this);return e},toState:function(a){if(a==OpenLayers.State.UPDATE){switch(this.state){case OpenLayers.State.UNKNOWN:case OpenLayers.State.DELETE:this.state=a;break;case OpenLayers.State.UPDATE:case OpenLayers.State.INSERT:break}}else{if(a==OpenLayers.State.INSERT){switch(this.state){case OpenLayers.State.UNKNOWN:break;default:this.state=a;break}}else{if(a==OpenLayers.State.DELETE){switch(this.state){case OpenLayers.State.INSERT:break;case OpenLayers.State.DELETE:break;case OpenLayers.State.UNKNOWN:case OpenLayers.State.UPDATE:this.state=a;break}}else{if(a==OpenLayers.State.UNKNOWN){this.state=a}}}}},CLASS_NAME:"OpenLayers.Feature.Vector"});OpenLayers.Feature.Vector.style={"default":{fillColor:"#ee9900",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#ee9900",strokeOpacity:1,strokeWidth:1,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},select:{fillColor:"blue",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"blue",strokeOpacity:1,strokeWidth:2,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"pointer"},temporary:{fillColor:"#66cccc",fillOpacity:0.2,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#66cccc",strokeOpacity:1,strokeLinecap:"round",strokeWidth:2,strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},"delete":{display:"none"}};OpenLayers.Handler=OpenLayers.Class({id:null,control:null,map:null,keyMask:null,active:false,evt:null,initialize:function(d,b,a){OpenLayers.Util.extend(this,a);this.control=d;this.callbacks=b;if(d.map){this.setMap(d.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 d=OpenLayers.Events.prototype.BROWSER_EVENTS;for(var b=0,a=d.length;b<a;b++){if(this[d[b]]){this.register(d[b],this[d[b]])}}this.active=true;return true},deactivate:function(){if(!this.active){return false}var d=OpenLayers.Events.prototype.BROWSER_EVENTS;for(var b=0,a=d.length;b<a;b++){if(this[d[b]]){this.unregister(d[b],this[d[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.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(d,b,a){OpenLayers.Handler.prototype.initialize.apply(this,arguments);if(this.pixelTolerance!=null){this.mousedown=function(e){this.down=e.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 d=OpenLayers.Function.bind(this.delayedRightCall,this,a);this.rightclickTimerId=window.setTimeout(d,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 d=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){d=false}}return d},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.Hover=OpenLayers.Class(OpenLayers.Handler,{delay:500,pixelTolerance:null,stopMove:false,px:null,timerId:null,initialize:function(d,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 d=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){d=false}}return d},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.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(d,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:OpenLayers.Function.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.Handler.Path=OpenLayers.Class(OpenLayers.Handler.Point,{line:null,freehand:false,freehandToggle:"shiftKey",initialize:function(d,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.Handler.Polygon=OpenLayers.Class(OpenLayers.Handler.Path,{polygon:null,initialize:function(d,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.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(e,b,d,a){OpenLayers.Handler.prototype.initialize.apply(this,[e,d,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 d=a.type;var g=false;var f=!!(this.feature);var e=(d=="click"||d=="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(d,"out",[this.lastFeature])}this.triggerCallback(d,"in",[this.feature])}else{if(!f||e){this.triggerCallback(d,"in",[this.feature])}}this.lastFeature=this.feature;g=true}else{if(this.lastFeature&&(f&&b||e)){this.triggerCallback(d,"out",[this.lastFeature])}this.feature=null}}else{if(this.lastFeature&&(f||e)){this.triggerCallback(d,"out",[this.lastFeature])}}return g},triggerCallback:function(e,f,b){var d=this.EVENTMAP[e][f];if(d){if(e=="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(d,b)}}else{this.callback(d,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.Drag=OpenLayers.Class(OpenLayers.Handler,{started:false,stopDown:true,dragging:false,last:null,start:null,oldOnselectstart:null,interval:0,timeoutId:null,documentDrag:false,documentEvents:null,initialize:function(d,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:OpenLayers.Function.True;document.onselectstart=OpenLayers.Function.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.documentDrag===true&&this.documentEvents){if(a.element===document){this.adjustXY(a);this.setEvent(a)}else{this.destroyDocumentEvents()}}if(this.interval>0){this.timeoutId=setTimeout(OpenLayers.Function.bind(this.removeTimeout,this),this.interval)}this.dragging=true;this.move(a);this.callback("move",[a.xy]);if(!this.oldOnselectstart){this.oldOnselectstart=document.onselectstart;document.onselectstart=OpenLayers.Function.False}this.last=this.evt.xy}return true},removeTimeout:function(){this.timeoutId=null},mouseup:function(b){if(this.started){if(this.documentDrag===true&&this.documentEvents){this.adjustXY(b);this.destroyDocumentEvents()}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)){if(this.documentDrag===true){this.documentEvents=new OpenLayers.Events(this,document,null,null,{includeXY:true});this.documentEvents.on({mousemove:this.mousemove,mouseup:this.mouseup});OpenLayers.Element.addClass(document.body,"olDragDown")}else{var 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},adjustXY:function(a){var b=OpenLayers.Util.pagePosition(this.map.div);a.xy.x-=b[0];a.xy.y-=b[1]},destroyDocumentEvents:function(){OpenLayers.Element.removeClass(document.body,"olDragDown");this.documentEvents.destroy();this.documentEvents=null},CLASS_NAME:"OpenLayers.Handler.Drag"});OpenLayers.Handler.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(d,b,a){this.style=OpenLayers.Util.extend(OpenLayers.Feature.Vector.style["default"],{});OpenLayers.Handler.prototype.initialize.apply(this,[d,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:OpenLayers.Function.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)&&(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(d){var g=this.map.getLonLatFromPixel(d.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,d);this.radius=Math.max(this.map.getResolution()/2,a.distanceTo(this.origin))}}this.modifyGeometry();if(this.irregular){var e=a.x-this.origin.x;var b=a.y-this.origin.y;var f;if(b==0){f=e/(this.radius*Math.sqrt(2))}else{f=e/b}this.feature.geometry.resize(1,this.origin,f);this.feature.geometry.move(e/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,d,b,a;var e=this.feature.geometry.components[0];if(e.components.length!=(this.sides+1)){this.createGeometry();e=this.feature.geometry.components[0]}for(var f=0;f<this.sides;++f){a=e.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 e=Math.atan2(a.y-this.origin.y,a.x-this.origin.x);if(this.snapAngle&&(this.snapToggle&&!b[this.snapToggle])){var d=(Math.PI/180)*this.snapAngle;this.angle=Math.round(e/d)*d}else{this.angle=e}},cancel:function(){this.callback("cancel",null);this.finalize()},finalize:function(){this.origin=null;this.radius=this.options.radius},clear:function(){if(this.layer){if(this.layer.renderer){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.Handler.Box=OpenLayers.Class(OpenLayers.Handler,{dragHandler:null,boxDivClassName:"olHandlerBoxZoomBox",boxCharacteristics:null,initialize:function(d,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 e=this.dragHandler.start.x;var b=this.dragHandler.start.y;var d=Math.abs(e-g.x);var a=Math.abs(b-g.y);this.zoomBox.style.width=Math.max(1,d)+"px";this.zoomBox.style.height=Math.max(1,a)+"px";this.zoomBox.style.left=g.x<e?g.x+"px":e+"px";this.zoomBox.style.top=g.y<b?g.y+"px":b+"px";var f=this.getBoxCharacteristics();if(f.newBoxModel){if(g.x>e){this.zoomBox.style.width=Math.max(1,d-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 d=Math.max(h.y,b.y);var f=Math.min(h.x,b.x);var e=Math.max(h.x,b.x);a=new OpenLayers.Bounds(f,d,e,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 d=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:d,newBoxModel:b}}return this.boxCharacteristics},CLASS_NAME:"OpenLayers.Handler.Box"});OpenLayers.Handler.MouseWheel=OpenLayers.Class(OpenLayers.Handler,{wheelListener:null,mousePosition:null,interval:0,delta:0,cumulative:true,initialize:function(d,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 h=false;var n=false;var g=false;var b=OpenLayers.Event.element(l);while((b!=null)&&!g&&!h){if(!h){try{if(b.currentStyle){d=b.currentStyle.overflow}else{var a=document.defaultView.getComputedStyle(b,null);var d=a.getPropertyValue("overflow")}h=(d&&(d=="auto")||(d=="scroll"))}catch(f){}}if(!n){for(var j=0,k=this.map.layers.length;j<k;j++){if(b==this.map.layers[j].div||b==this.map.layers[j].pane){n=true;break}}}g=(b==this.map.div);b=b.parentNode}if(!h&&g){if(n){var m=0;if(!l){l=window.event}if(l.wheelDelta){m=l.wheelDelta/120;if(window.opera&&window.opera.version()<9.2){m=-m}}else{if(l.detail){m=-l.detail/3}}this.delta=this.delta+m;if(this.interval){window.clearTimeout(this._timeoutId);this._timeoutId=window.setTimeout(OpenLayers.Function.bind(function(){this.wheelZoom(l)},this),this.interval)}else{this.wheelZoom(l)}}OpenLayers.Event.stop(l)}},wheelZoom:function(a){var b=this.delta;this.delta=0;if(b){if(this.mousePosition){a.xy=this.mousePosition}if(!a.xy){a.xy=this.map.getPixelFromLonLat(this.map.getCenter())}if(b<0){this.callback("down",[a,this.cumulative?b:-1])}else{this.callback("up",[a,this.cumulative?b:1])}}},mousemove:function(a){this.mousePosition=a.xy},activate:function(a){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){var b=this.wheelListener;OpenLayers.Event.observe(window,"DOMMouseScroll",b);OpenLayers.Event.observe(window,"mousewheel",b);OpenLayers.Event.observe(document,"mousewheel",b);return 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.Handler.Keyboard=OpenLayers.Class(OpenLayers.Handler,{KEY_EVENTS:["keydown","keyup"],eventListener:null,initialize:function(d,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 d=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)}d=true}return d},handleKeyEvent:function(a){if(this.checkModifiers(a)){this.callback(a.type,[a])}},CLASS_NAME:"OpenLayers.Handler.Keyboard"});OpenLayers.Control=OpenLayers.Class({id:null,map:null,div:null,type:null,allowSelection:false,displayClass:"",title:"",autoActivate:false,active:null,handler:null,eventListeners:null,events:null,EVENT_TYPES:["activate","deactivate"],initialize:function(a){this.displayClass=this.CLASS_NAME.replace("OpenLayers.","ol").replace(/\./g,"");OpenLayers.Util.extend(this,a);this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES);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=OpenLayers.Function.False}if(this.title!=""){this.div.title=this.title}}if(a!=null){this.position=a.clone()}this.moveTo(this.position);return this.div},moveTo:function(a){if((a!=null)&&(this.div!=null)){this.div.style.left=a.x+"px";this.div.style.top=a.y+"px"}},activate:function(){if(this.active){return false}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.Control.Attribution=OpenLayers.Class(OpenLayers.Control,{separator:", ",initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.map.events.un({removelayer:this.updateAttribution,addlayer:this.updateAttribution,changelayer:this.updateAttribution,changebaselayer:this.updateAttribution,scope:this});OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.map.events.on({changebaselayer:this.updateAttribution,changelayer:this.updateAttribution,addlayer:this.updateAttribution,removelayer:this.updateAttribution,scope:this});this.updateAttribution();return this.div},updateAttribution:function(){var e=[];if(this.map&&this.map.layers){for(var d=0,a=this.map.layers.length;d<a;d++){var b=this.map.layers[d];if(b.attribution&&b.getVisibility()){if(OpenLayers.Util.indexOf(e,b.attribution)===-1){e.push(b.attribution)}}}this.div.innerHTML=e.join(this.separator)}},CLASS_NAME:"OpenLayers.Control.Attribution"});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(j){if(j instanceof OpenLayers.Bounds){var b;if(!this.out){var k=this.map.getLonLatFromPixel(new OpenLayers.Pixel(j.left,j.bottom));var o=this.map.getLonLatFromPixel(new OpenLayers.Pixel(j.right,j.top));b=new OpenLayers.Bounds(k.lon,k.lat,o.lon,o.lat)}else{var h=Math.abs(j.right-j.left);var l=Math.abs(j.top-j.bottom);var f=Math.min((this.map.size.h/l),(this.map.size.w/h));var p=this.map.getExtent();var a=this.map.getLonLatFromPixel(j.getCenterPixel());var d=a.lon-(p.getWidth()/2)*f;var g=a.lon+(p.getWidth()/2)*f;var n=a.lat-(p.getHeight()/2)*f;var e=a.lat+(p.getHeight()/2)*f;b=new OpenLayers.Bounds(d,n,g,e)}var m=this.map.getZoom();this.map.zoomToExtent(b);if(m==this.map.getZoom()&&this.alwaysZoom==true){this.map.zoomTo(m+(this.out?-1:1))}}else{if(!this.out){this.map.setCenter(this.map.getLonLatFromPixel(j),this.map.getZoom()+1)}else{this.map.setCenter(this.map.getLonLatFromPixel(j),this.map.getZoom()-1)}}},CLASS_NAME:"OpenLayers.Control.ZoomBox"});OpenLayers.Control.ZoomToMaxExtent=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){if(this.map){this.map.zoomToMaxExtent()}},CLASS_NAME:"OpenLayers.Control.ZoomToMaxExtent"});OpenLayers.Control.DragPan=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,panned:false,interval:25,documentDrag:false,draw:function(){this.handler=new OpenLayers.Handler.Drag(this,{move:this.panMap,done:this.panMapDone},{interval:this.interval,documentDrag:this.documentDrag})},panMap:function(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.Navigation=OpenLayers.Class(OpenLayers.Control,{dragPan:null,dragPanOptions:null,documentDrag:false,zoomBox:null,zoomBoxEnabled:true,zoomWheelEnabled:true,mouseWheelOptions:null,handleRightClicks:false,zoomBoxKeyMask:OpenLayers.Handler.MOD_SHIFT,autoActivate:true,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();if(this.zoomBoxEnabled){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=OpenLayers.Function.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,documentDrag:this.documentDrag},this.dragPanOptions));this.zoomBox=new OpenLayers.Control.ZoomBox({map:this.map,keyMask:this.zoomBoxKeyMask});this.dragPan.draw();this.zoomBox.draw();this.handlers.wheel=new OpenLayers.Handler.MouseWheel(this,{up:this.wheelUp,down:this.wheelDown},this.mouseWheelOptions)},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,d){var j=this.map.getZoom();var g=this.map.getZoom()+Math.round(d);g=Math.max(g,0);g=Math.min(g,this.map.getNumZoomLevels());if(g===j){return}var l=this.map.getSize();var f=l.w/2-k.xy.x;var e=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+e*h);this.map.setCenter(b,g)},wheelUp:function(a,b){this.wheelChange(a,b||1)},wheelDown:function(a,b){this.wheelChange(a,b||-1)},disableZoomBox:function(){this.zoomBoxEnabled=false;this.zoomBox.deactivate()},enableZoomBox:function(){this.zoomBoxEnabled=true;if(this.active){this.zoomBox.activate()}},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.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=OpenLayers.Function.False;OpenLayers.Event.stop(a)},defaultMouseMove:function(f){this.mousePosition=f.xy.clone();if(this.mouseDragStart!=null){if(this.zoomBox){var e=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,e)+"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 e=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+e,g.h/2+b);var d=this.map.getLonLatFromViewPortPx(a);this.map.setCenter(d,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 j=this.map.getLonLatFromViewPortPx(this.mouseDragStart);var a=this.map.getLonLatFromViewPortPx(b.xy);var h=Math.max(j.lat,a.lat);var d=Math.min(j.lat,a.lat);var g=Math.min(j.lon,a.lon);var e=Math.max(j.lon,a.lon);var f=new OpenLayers.Bounds(g,d,e,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(d){var b=false;var a=OpenLayers.Event.element(d);while(a!=null){if(this.map&&a==this.map.div){b=true;break}a=a.parentNode}if(b){var f=0;if(!d){d=window.event}if(d.wheelDelta){f=d.wheelDelta/120;if(window.opera&&window.opera.version()<9.2){f=-f}}else{if(d.detail){f=-d.detail/3}}if(f){d.xy=this.mousePosition;if(f<0){this.defaultWheelDown(d)}else{this.defaultWheelUp(d)}}OpenLayers.Event.stop(d)}},CLASS_NAME:"OpenLayers.Control.MouseDefaults"});OpenLayers.Control.MousePosition=OpenLayers.Class(OpenLayers.Control,{element:null,prefix:"",separator:", ",suffix:"",numDigits:5,granularity:10,emptyString:null,lastXy:null,displayProjection:null,initialize:function(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 d;if(a==null){this.reset();return}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}d=this.map.getLonLatFromPixel(a.xy);if(!d){return}if(this.displayProjection){d.transform(this.map.getProjectionObject(),this.displayProjection)}this.lastXy=a.xy}var b=this.formatOutput(d);if(b!=this.element.innerHTML){this.element.innerHTML=b}},reset:function(a){if(this.emptyString!=null){this.element.innerHTML=this.emptyString}},formatOutput:function(b){var d=parseInt(this.numDigits);var a=this.prefix+b.lon.toFixed(d)+this.separator+b.lat.toFixed(d)+this.suffix;return a},setMap:function(){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.map.events.register("mousemove",this,this.redraw);this.map.events.register("mouseout",this,this.reset)},CLASS_NAME:"OpenLayers.Control.MousePosition"});OpenLayers.Control.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}if(this.handlers.click){this.handlers.click.destroy()}if(this.handlers.drag){this.handlers.drag.destroy()}this.mapDiv.removeChild(this.extentRectangle);this.extentRectangle=null;if(this.rectEvents){this.rectEvents.destroy();this.rectEvents=null}if(this.ovmap){this.ovmap.destroy();this.ovmap=null}this.element.removeChild(this.mapDiv);this.mapDiv=null;this.div.removeChild(this.element);this.element=null;if(this.maximizeDiv){OpenLayers.Event.stopObservingElement(this.maximizeDiv);this.div.removeChild(this.maximizeDiv);this.maximizeDiv=null}if(this.minimizeDiv){OpenLayers.Event.stopObservingElement(this.minimizeDiv);this.div.removeChild(this.minimizeDiv);this.minimizeDiv=null}this.map.events.un({moveend:this.update,changebaselayer:this.baseLayerDraw,scope:this});OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!(this.layers.length>0)){if(this.map.baseLayer){var e=this.map.baseLayer.clone();this.layers=[e]}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 d=0,a=g.length;d<a;d++){OpenLayers.Event.observe(this.maximizeDiv,g[d],OpenLayers.Event.stop);OpenLayers.Event.observe(this.minimizeDiv,g[d],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(k){var e=this.handlers.drag.last.x-k.x;var b=this.handlers.drag.last.y-k.y;if(e!=0||b!=0){var h=this.rectPxBounds.top;var a=this.rectPxBounds.left;var f=Math.abs(this.rectPxBounds.getHeight());var d=this.rectPxBounds.getWidth();var g=Math.max(0,(h-b));g=Math.min(g,this.ovmap.size.h-this.hComp-f);var j=Math.max(0,(a-e));j=Math.min(j,this.ovmap.size.w-this.wComp-d);this.setRectPxBounds(new OpenLayers.Bounds(j,g+f,j+d,g))}},mapDivClick:function(k){var b=this.rectPxBounds.getCenterPixel();var f=k.xy.x-b.x;var e=k.xy.y-b.y;var h=this.rectPxBounds.top;var d=this.rectPxBounds.left;var l=Math.abs(this.rectPxBounds.getHeight());var a=this.rectPxBounds.getWidth();var g=Math.max(0,(h+e));g=Math.min(g,this.ovmap.size.h-l);var j=Math.max(0,(d+f));j=Math.min(j,this.ovmap.size.w-a);this.setRectPxBounds(new OpenLayers.Bounds(j,g+l,j+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 d=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()){d=d.transform(this.map.getProjectionObject(),this.ovmap.getProjectionObject())}var e=this.ovmap.getResolution()/this.map.getResolution();return((e>this.minRatio)&&(e<=this.maxRatio)&&(this.ovmap.getExtent().containsBounds(d)))},updateOverview:function(){var d=this.map.getResolution();var b=this.ovmap.getResolution();var e=b/d;if(e>this.maxRatio){b=this.minRatio*d}else{if(e<=this.minRatio){b=this.maxRatio*d}}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(f){if(!this.handlers.drag.active&&!this.map.dragging){this.handlers.drag.activate()}});this.rectEvents.register("mouseout",this,function(f){if(!this.handlers.drag.dragging){this.handlers.drag.deactivate()}});if(this.ovmap.getProjection()!=this.map.getProjection()){var d=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=d&&a?OpenLayers.INCHES_PER_UNIT[d]/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(e){var h=Math.max(e.top,0);var f=Math.max(e.left,0);var b=Math.min(e.top+Math.abs(e.getHeight()),this.ovmap.size.h-this.hComp);var j=Math.min(e.left+e.getWidth(),this.ovmap.size.w-this.wComp);var d=Math.max(j-f,0);var k=Math.max(b-h,0);if(d<this.minRectSize||k<this.minRectSize){this.extentRectangle.className=this.displayClass+this.minRectDisplayClass;var g=f+(d/2)-(this.minRectSize/2);var a=h+(k/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(k)+"px";this.extentRectangle.style.width=Math.round(d)+"px"}this.rectPxBounds=new OpenLayers.Bounds(Math.round(f),Math.round(b),Math.round(j),Math.round(h))},getRectBoundsFromMapBounds:function(e){var a=new OpenLayers.LonLat(e.left,e.bottom);var g=new OpenLayers.LonLat(e.right,e.top);var d=this.getOverviewPxFromLonLat(a);var b=this.getOverviewPxFromLonLat(g);var f=null;if(d&&b){f=new OpenLayers.Bounds(d.x,d.y,b.x,b.y)}return f},getMapBoundsFromRectBounds:function(e){var d=new OpenLayers.Pixel(e.left,e.bottom);var b=new OpenLayers.Pixel(e.right,e.top);var a=this.getLonLatFromOverviewPx(d);var f=this.getLonLatFromOverviewPx(b);return new OpenLayers.Bounds(a.lon,a.lat,f.lon,f.lat)},getLonLatFromOverviewPx:function(g){var d=this.ovmap.size;var b=this.ovmap.getResolution();var a=this.ovmap.getExtent().getCenterLonLat();var f=g.x-(d.w/2);var e=g.y-(d.h/2);return new OpenLayers.LonLat(a.lon+f*b,a.lat-e*b)},getOverviewPxFromLonLat:function(e){var b=this.ovmap.getResolution();var d=this.ovmap.getExtent();var a=null;if(d){a=new OpenLayers.Pixel(Math.round(1/b*(e.lon-d.left)),Math.round(1/b*(d.top-e.lat)))}return a},CLASS_NAME:"OpenLayers.Control.OverviewMap"});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 d=new OpenLayers.Size(18,18);var a=new OpenLayers.Pixel(b.x+d.w/2,b.y);this._addButton("panup","north-mini.png",a,d);b.y=a.y+d.h;this._addButton("panleft","west-mini.png",b,d);this._addButton("panright","east-mini.png",b.add(d.w,0),d);this._addButton("pandown","south-mini.png",a.add(0,d.h*2),d);this._addButton("zoomin","zoom-plus-mini.png",a.add(0,d.h*3+5),d);this._addButton("zoomworld","zoom-world-mini.png",a.add(0,d.h*4+5),d);this._addButton("zoomout","zoom-minus-mini.png",a.add(0,d.h*5+5),d);return this.div},_addButton:function(a,e,k,h){var g=OpenLayers.Util.getImagesLocation()+e;var b=OpenLayers.Util.createAlphaImageDiv(this.id+"_"+a,k,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 d=this.slideFactor;var f=function(){return d}}else{var j=this.slideRatio;var f=function(l){return this.map.getSize()[l]*j}}b.getSlideFactor=f;this.buttons.push(b);return b},_removeButton:function(a){OpenLayers.Event.stopObservingElement(a);a.map=null;a.getSlideFactor=null;this.div.removeChild(a);OpenLayers.Util.removeItem(this.buttons,a)},removeButtons:function(){for(var a=this.buttons.length-1;a>=0;--a){this._removeButton(this.buttons[a])}},doubleClick:function(a){OpenLayers.Event.stop(a);return 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.PanZoomBar=OpenLayers.Class(OpenLayers.Control.PanZoom,{zoomStopWidth:18,zoomStopHeight:11,slider:null,sliderEvents:null,zoombarDiv:null,divEvents:null,zoomWorldIcon:false,forceFixedZoomLevel:false,mouseDragStart:null,zoomStart:null,initialize:function(){OpenLayers.Control.PanZoom.prototype.initialize.apply(this,arguments)},destroy:function(){this._removeZoomBar();this.map.events.un({changebaselayer:this.redraw,scope:this});OpenLayers.Control.PanZoom.prototype.destroy.apply(this,arguments);delete this.mouseDragStart;delete this.zoomStart},setMap:function(a){OpenLayers.Control.PanZoom.prototype.setMap.apply(this,arguments);this.map.events.register("changebaselayer",this,this.redraw)},redraw:function(){if(this.div!=null){this.removeButtons();this._removeZoomBar()}this.draw()},draw:function(b){OpenLayers.Control.prototype.draw.apply(this,arguments);b=this.position.clone();this.buttons=[];var e=new OpenLayers.Size(18,18);var a=new OpenLayers.Pixel(b.x+e.w/2,b.y);var d=e.w;if(this.zoomWorldIcon){a=new OpenLayers.Pixel(b.x+e.w,b.y)}this._addButton("panup","north-mini.png",a,e);b.y=a.y+e.h;this._addButton("panleft","west-mini.png",b,e);if(this.zoomWorldIcon){this._addButton("zoomworld","zoom-world-mini.png",b.add(e.w,0),e);d*=2}this._addButton("panright","east-mini.png",b.add(d,0),e);this._addButton("pandown","south-mini.png",a.add(0,e.h*2),e);this._addButton("zoomin","zoom-plus-mini.png",a.add(0,e.h*3+5),e);a=this._addZoomBar(a.add(0,e.h*4+5));this._addButton("zoomout","zoom-minus-mini.png",a,e);return this.div},_addZoomBar:function(a){var f=OpenLayers.Util.getImagesLocation();var h=this.id+"_"+this.map.id;var b=this.map.getNumZoomLevels()-1-this.map.getZoom();var d=OpenLayers.Util.createAlphaImageDiv(h,a.add(-1,b*this.zoomStopHeight),new OpenLayers.Size(20,9),f+"slider.png","absolute");this.slider=d;this.sliderEvents=new OpenLayers.Events(this,d,null,true,{includeXY:true});this.sliderEvents.on({mousedown:this.zoomBarDown,mousemove:this.zoomBarDrag,mouseup:this.zoomBarUp,dblclick:this.doubleClick,click:this.doubleClick});var e=new OpenLayers.Size();e.h=this.zoomStopHeight*this.map.getNumZoomLevels();e.w=this.zoomStopWidth;var g=null;if(OpenLayers.Util.alphaHack()){var h=this.id+"_"+this.map.id;g=OpenLayers.Util.createAlphaImageDiv(h,a,new OpenLayers.Size(e.w,this.zoomStopHeight),f+"zoombar.png","absolute",null,"crop");g.style.height=e.h+"px"}else{g=OpenLayers.Util.createDiv("OpenLayers_Control_PanZoomBar_Zoombar"+this.map.id,a,e,f+"zoombar.png")}this.zoombarDiv=g;this.divEvents=new OpenLayers.Events(this,g,null,true,{includeXY:true});this.divEvents.on({mousedown:this.divClick,mousemove:this.passEventToSlider,dblclick:this.doubleClick,click:this.doubleClick});this.div.appendChild(g);this.startTop=parseInt(g.style.top);this.div.appendChild(d);this.map.events.register("zoomend",this,this.moveZoomBar);a=a.add(0,this.zoomStopHeight*this.map.getNumZoomLevels());return a},_removeZoomBar:function(){this.sliderEvents.un({mousedown:this.zoomBarDown,mousemove:this.zoomBarDrag,mouseup:this.zoomBarUp,dblclick:this.doubleClick,click:this.doubleClick});this.sliderEvents.destroy();this.divEvents.un({mousedown:this.divClick,mousemove:this.passEventToSlider,dblclick:this.doubleClick,click:this.doubleClick});this.divEvents.destroy();this.div.removeChild(this.zoombarDiv);this.zoombarDiv=null;this.div.removeChild(this.slider);this.slider=null;this.map.events.unregister("zoomend",this,this.moveZoomBar)},passEventToSlider:function(a){this.sliderEvents.handleBrowserEvent(a)},divClick:function(a){if(!OpenLayers.Event.isLeftClick(a)){return}var f=a.xy.y;var e=OpenLayers.Util.pagePosition(a.object)[1];var d=(f-e)/this.zoomStopHeight;if(this.forceFixedZoomLevel||!this.map.fractionalZoom){d=Math.floor(d)}var b=(this.map.getNumZoomLevels()-1)-d;b=Math.min(Math.max(b,0),this.map.getNumZoomLevels()-1);this.map.zoomTo(b);OpenLayers.Event.stop(a)},zoomBarDown:function(a){if(!OpenLayers.Event.isLeftClick(a)){return}this.map.events.on({mousemove:this.passEventToSlider,mouseup:this.passEventToSlider,scope:this});this.mouseDragStart=a.xy.clone();this.zoomStart=a.xy.clone();this.div.style.cursor="move";this.zoombarDiv.offsets=null;OpenLayers.Event.stop(a)},zoomBarDrag:function(b){if(this.mouseDragStart!=null){var a=this.mouseDragStart.y-b.xy.y;var e=OpenLayers.Util.pagePosition(this.zoombarDiv);if((b.clientY-e[1])>0&&(b.clientY-e[1])<parseInt(this.zoombarDiv.style.height)-2){var d=parseInt(this.slider.style.top)-a;this.slider.style.top=d+"px";this.mouseDragStart=b.xy.clone()}OpenLayers.Event.stop(b)}},zoomBarUp:function(b){if(!OpenLayers.Event.isLeftClick(b)){return}if(this.mouseDragStart){this.div.style.cursor="";this.map.events.un({mouseup:this.passEventToSlider,mousemove:this.passEventToSlider,scope:this});var a=this.zoomStart.y-b.xy.y;var d=this.map.zoom;if(!this.forceFixedZoomLevel&&this.map.fractionalZoom){d+=a/this.zoomStopHeight;d=Math.min(Math.max(d,0),this.map.getNumZoomLevels()-1)}else{d+=Math.round(a/this.zoomStopHeight)}this.map.zoomTo(d);this.mouseDragStart=null;this.zoomStart=null;OpenLayers.Event.stop(b)}},moveZoomBar:function(){var a=((this.map.getNumZoomLevels()-1)-this.map.getZoom())*this.zoomStopHeight+this.startTop+1;this.slider.style.top=a+"px"},CLASS_NAME:"OpenLayers.Control.PanZoomBar"});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 d=0,a=this.map.controls.length;d<a;d++){var e=this.map.controls[d];if((e!=this)&&(e.CLASS_NAME=="OpenLayers.Control.ArgParser")){if(e.displayProjection!=this.displayProjection){this.displayProjection=e.displayProjection}break}}if(d==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 e=this.layers.charAt(d);if(e=="B"){this.map.setBaseLayer(b)}else{if((e=="T")||(e=="F")){b.setVisibility(e=="T")}}}}},CLASS_NAME:"OpenLayers.Control.ArgParser"});OpenLayers.Control.Permalink=OpenLayers.Class(OpenLayers.Control,{argParserClass:OpenLayers.Control.ArgParser,element:null,base:"",displayProjection:null,initialize:function(b,d,a){OpenLayers.Control.prototype.initialize.apply(this,[a]);this.element=OpenLayers.Util.getElement(b);this.base=d||document.location.href},destroy:function(){if(this.element.parentNode==this.div){this.div.removeChild(this.element)}this.element=null;this.map.events.unregister("moveend",this,this.updateLink);OpenLayers.Control.prototype.destroy.apply(this,arguments)},setMap:function(e){OpenLayers.Control.prototype.setMap.apply(this,arguments);for(var b=0,a=this.map.controls.length;b<a;b++){var d=this.map.controls[b];if(d.CLASS_NAME==this.argParserClass.CLASS_NAME){if(d.displayProjection!=this.displayProjection){this.displayProjection=d.displayProjection}break}}if(b==this.map.controls.length){this.map.addControl(new this.argParserClass({displayProjection:this.displayProjection}))}},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.div.className=this.displayClass;this.element=document.createElement("a");this.element.innerHTML=OpenLayers.i18n("permalink");this.element.href="";this.div.appendChild(this.element)}this.map.events.on({moveend:this.updateLink,changelayer:this.updateLink,changebaselayer:this.updateLink,scope:this});this.updateLink();return this.div},updateLink:function(){var a=this.base;if(a.indexOf("?")!=-1){a=a.substring(0,a.indexOf("?"))}a+="?"+OpenLayers.Util.getParameterString(this.createParams());this.element.href=a},createParams:function(a,l,f){a=a||this.map.getCenter();var e=OpenLayers.Util.getParameters(this.base);if(a){e.zoom=l||this.map.getZoom();var k=a.lat;var b=a.lon;if(this.displayProjection){var d=OpenLayers.Projection.transform({x:b,y:k},this.map.getProjectionObject(),this.displayProjection);b=d.x;k=d.y}e.lat=Math.round(k*100000)/100000;e.lon=Math.round(b*100000)/100000;f=f||this.map.layers;e.layers="";for(var g=0,j=f.length;g<j;g++){var h=f[g];if(h.isBaseLayer){e.layers+=(h==this.map.baseLayer)?"B":"0"}else{e.layers+=(h.getVisibility())?"T":"F"}}}return e},CLASS_NAME:"OpenLayers.Control.Permalink"});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,geodesic:false,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,[a])},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.eTop){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 e=parseInt(Math.log(b)/Math.log(10));var a=Math.pow(10,e);var d=parseInt(b/a);var f;if(d>5){f=5}else{if(d>2){f=2}else{f=1}}return f*a},update:function(){var l=this.map.getResolution();if(!l){return}var q=this.map.getUnits();var f=OpenLayers.INCHES_PER_UNIT;var n=this.maxWidth*l*f[q];var p=1;if(this.geodesic===true){var b=this.getGeodesicLength(this.maxWidth);var g=n/f.km;p=b/g;n*=p}var a;var e;if(n>100000){a=this.topOutUnits;e=this.bottomOutUnits}else{a=this.topInUnits;e=this.bottomInUnits}var j=n/f[a];var m=n/f[e];var k=this.getBarLen(j);var h=this.getBarLen(m);j=k/f[q]*f[a];m=h/f[q]*f[e];var d=j/l/p;var o=m/l/p;if(this.eBottom.style.visibility=="visible"){this.eBottom.style.width=Math.round(o)+"px";this.eBottom.innerHTML=h+" "+e}if(this.eTop.style.visibility=="visible"){this.eTop.style.width=Math.round(d)+"px";this.eTop.innerHTML=k+" "+a}},getGeodesicLength:function(h){var g=this.map;var d=g.getPixelFromLonLat(g.getCenter());var a=g.getLonLatFromPixel(d.add(0,-h/2));var f=g.getLonLatFromPixel(d.add(0,h/2));var e=g.getProjectionObject();var b=new OpenLayers.Projection("EPSG:4326");if(!e.equals(b)){a.transform(e,b);f.transform(e,b)}return OpenLayers.Util.distVincenty(a,f)},CLASS_NAME:"OpenLayers.Control.ScaleLine"});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 e;for(var d=0,a=b.length;d<a;++d){e=b[d];if(e instanceof OpenLayers.Layer.Vector){this.addTargetLayer(e)}else{this.addTarget(e)}}}},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 d;for(var a=this.targets.length-1;a>=0;--a){d=this.targets[a];if(d.layer===b){this.removeTarget(d)}}},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(j,e){var a={rank:Number.POSITIVE_INFINITY,dist:Number.POSITIVE_INFINITY,x:null,y:null};var d=false;var k,g;for(var b=0,f=this.targets.length;b<f;++b){g=this.targets[b];k=this.testTarget(g,e);if(k){if(this.greedy){a=k;a.target=g;d=true;break}else{if((k.rank<a.rank)||(k.rank===a.rank&&k.dist<a.dist)){a=k;a.target=g;d=true}}}}if(d){var h=this.events.triggerEvent("beforesnap",{point:j,x:a.x,y:a.y,distance:a.dist,layer:a.target.layer,snapType:this.precedence[a.rank]});if(h!==false){j.x=a.x;j.y=a.y;this.point=j;this.events.triggerEvent("snap",{point:j,snapType:this.precedence[a.rank],layer:a.target.layer,distance:a.dist})}else{d=false}}if(this.point&&!d){j.x=e.x;j.y=e.y;this.point=null;this.events.triggerEvent("unsnap",{point:j})}},testTarget:function(B,g){var z={node:this.getGeoTolerance(B.nodeTolerance),vertex:this.getGeoTolerance(B.vertexTolerance),edge:this.getGeoTolerance(B.edgeTolerance)};var h=Math.max(z.node,z.vertex,z.edge);var l={rank:Number.POSITIVE_INFINITY,dist:Number.POSITIVE_INFINITY};var f=false;var d=B.layer.features;var b,a,e,A,p,q,o;var n=this.precedence.length;var m=new OpenLayers.LonLat(g.x,g.y);for(var w=0,x=d.length;w<x;++w){b=d[w];if(b!==this.feature&&!b._sketch&&b.state!==OpenLayers.State.DELETE&&(!B.filter||B.filter.evaluate(b.attributes))){if(b.atPoint(m,h,h)){for(var v=0,s=Math.min(l.rank+1,n);v<s;++v){a=this.precedence[v];if(B[a]){if(a==="edge"){p=b.geometry.distanceTo(g,{details:true});q=p.distance;if(q<=z[a]&&q<l.dist){l={rank:v,dist:q,x:p.x0,y:p.y0};f=true;break}}else{e=b.geometry.getVertices(a==="node");o=false;for(var u=0,t=e.length;u<t;++u){A=e[u];q=A.distanceTo(g);if(q<=z[a]&&(v<l.rank||(v===l.rank&&q<l.dist))){l={rank:v,dist:q,x:A.x,y:A.y};f=true;o=true}}if(o){break}}}}}}}return f?l:null},getGeoTolerance:function(a){var b=this.layer.map.getResolution();if(b!==this.resolution){this.resolution=b;this.geoToleranceCache={}}var d=this.geoToleranceCache[a];if(d===undefined){d=a*b;this.geoToleranceCache[a]=d}return d},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.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(d,e){for(var b=0,a=d.length;b<a;++b){if(d[b].geometry===e){d.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(d){sourceSplit=false;targetSplit=false;if(!this.sourceFilter||this.sourceFilter.evaluate(d.attributes)){var g=this.layer&&this.layer.features||[];var A,p,h,a;var m=[],z=[];var e=(this.layer===this.source)&&this.mutual;var b={edge:this.edge,tolerance:this.tolerance,mutual:e};var l=[d.geometry];var o,f;var s,q;for(var w=0,x=g.length;w<x;++w){o=g[w];if(this.isEligible(o)){f=[o.geometry];for(var v=0;v<l.length;++v){s=l[v];for(var t=0;t<f.length;++t){A=f[t];if(s.getBounds().intersectsBounds(A.getBounds())){p=s.split(A,b);if(p){a=this.events.triggerEvent("beforesplit",{source:d,target:o});if(a!==false){if(e){q=p[0];if(q.length>1){q.unshift(v,1);Array.prototype.splice.apply(l,q);v+=q.length-3}p=p[1]}if(p.length>1){p.unshift(t,1);Array.prototype.splice.apply(f,p);t+=p.length-3}}}}}}if(f&&f.length>1){this.geomsToFeatures(o,f);this.events.triggerEvent("split",{original:o,features:f});Array.prototype.push.apply(m,f);z.push(o);targetSplit=true}}}if(l&&l.length>1){this.geomsToFeatures(d,l);this.events.triggerEvent("split",{original:d,features:l});Array.prototype.push.apply(m,l);z.push(d);sourceSplit=true}if(sourceSplit||targetSplit){if(this.deferDelete){var n,u=[];for(var w=0,x=z.length;w<x;++w){n=z[w];if(n.state===OpenLayers.State.INSERT){u.push(n)}else{n.state=OpenLayers.State.DELETE;this.layer.drawFeature(n)}}this.layer.destroyFeatures(u,{silent:true});for(var w=0,x=m.length;w<x;++w){m[w].state=OpenLayers.State.INSERT}}else{this.layer.destroyFeatures(z,{silent:true})}this.layer.addFeatures(m,{silent:true});this.events.triggerEvent("aftersplit",{source:d,features:m})}}return sourceSplit},geomsToFeatures:function(d,e){var g=d.clone();delete g.geometry;var f;for(var b=0,a=e.length;b<a;++b){f=g.clone();f.geometry=e[b];f.state=OpenLayers.State.INSERT;e[b]=f}},destroy:function(){if(this.active){this.deactivate()}OpenLayers.Control.prototype.destroy.call(this)},CLASS_NAME:"OpenLayers.Control.Split"});OpenLayers.Control.DrawFeature=OpenLayers.Class(OpenLayers.Control,{layer:null,callbacks:null,EVENT_TYPES:["featureadded"],multi:false,featureAdded:function(){},handlerOptions:null,initialize:function(b,d,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;this.handlerOptions=this.handlerOptions||{};if(!("multi" in this.handlerOptions)){this.handlerOptions.multi=this.multi}var e=this.layer.styleMap&&this.layer.styleMap.styles.temporary;if(e){this.handlerOptions.layerOptions=OpenLayers.Util.applyDefaults(this.handlerOptions.layerOptions,{styleMap:new OpenLayers.StyleMap({"default":e})})}this.handler=new d(this,this.callbacks,this.handlerOptions)},drawFeature:function(d){var a=new OpenLayers.Feature.Vector(d);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.DragFeature=OpenLayers.Class(OpenLayers.Control,{geometryTypes:null,onStart:function(b,a){},onDrag:function(b,a){},onComplete:function(b,a){},documentDrag:false,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),{documentDrag:this.documentDrag}),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.ModifyFeature=OpenLayers.Class(OpenLayers.Control,{geometryTypes:null,clickout:true,toggle:true,standalone:false,layer:null,feature:null,vertices:null,virtualVertices:null,selectControl:null,dragControl:null,handlers:null,deleteCodes:null,virtualStyle:null,mode:null,modified:false,radiusHandle:null,dragHandle:null,onModificationStart:function(){},onModification:function(){},onModificationEnd:function(){},initialize:function(e,d){this.layer=e;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,[d]);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};if(this.standalone===false){this.selectControl=new OpenLayers.Control.SelectFeature(e,a)}var b={geometryTypes:["OpenLayers.Geometry.Point"],snappingOptions:this.snappingOptions,onStart:function(j,h){g.dragStart.apply(g,[j,h])},onDrag:function(j,h){g.dragVertex.apply(g,[j,h])},onComplete:function(h){g.dragComplete.apply(g,[h])},featureCallbacks:{over:function(h){if(g.standalone!==true||h._sketch||g.feature===h){g.dragControl.overFeature.apply(g.dragControl,[h])}}}};this.dragControl=new OpenLayers.Control.DragFeature(e,b);var f={keydown:this.handleKeypress};this.handlers={keyboard:new OpenLayers.Handler.Keyboard(this,f)}},destroy:function(){this.layer=null;this.standalone||this.selectControl.destroy();this.dragControl.destroy();OpenLayers.Control.prototype.destroy.apply(this,[])},activate:function(){return((this.standalone||this.selectControl.activate())&&this.handlers.keyboard.activate()&&OpenLayers.Control.prototype.activate.apply(this,arguments))},deactivate:function(){var d=false;if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)){this.layer.removeFeatures(this.vertices,{silent:true});this.layer.removeFeatures(this.virtualVertices,{silent:true});this.vertices=[];this.dragControl.deactivate();var a=this.feature;var b=a&&a.geometry&&a.layer;if(this.standalone===false){if(b){this.selectControl.unselect.apply(this.selectControl,[a])}this.selectControl.deactivate()}else{if(b){this.unselectFeature(a)}}this.handlers.keyboard.deactivate();d=true}return d},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.standalone===false&&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.standalone||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.standalone?undefined: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 d=this.dragControl.feature;if(d&&OpenLayers.Util.indexOf(this.vertices,d)!=-1&&!this.dragControl.handlers.drag.dragging&&d.geometry.parent){d.geometry.parent.removeComponent(d.geometry);this.layer.drawFeature(this.feature,this.standalone?undefined:this.selectControl.renderIntent);this.resetVertices();this.setFeatureState();this.onModification(this.feature);this.layer.events.triggerEvent("featuremodified",{feature:this.feature})}}},collectVertices:function(){this.vertices=[];this.virtualVertices=[];var a=this;function b(j){var e,f,k,g;if(j.CLASS_NAME=="OpenLayers.Geometry.Point"){f=new OpenLayers.Feature.Vector(j);f._sketch=true;a.vertices.push(f)}else{var d=j.components.length;if(j.CLASS_NAME=="OpenLayers.Geometry.LinearRing"){d-=1}for(e=0;e<d;++e){k=j.components[e];if(k.CLASS_NAME=="OpenLayers.Geometry.Point"){f=new OpenLayers.Feature.Vector(k);f._sketch=true;a.vertices.push(f)}else{b(k)}}if(j.CLASS_NAME!="OpenLayers.Geometry.MultiPoint"){for(e=0,g=j.components.length;e<g-1;++e){var n=j.components[e];var o=j.components[e+1];if(n.CLASS_NAME=="OpenLayers.Geometry.Point"&&o.CLASS_NAME=="OpenLayers.Geometry.Point"){var l=(n.x+o.x)/2;var h=(n.y+o.y)/2;var m=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(l,h),null,a.virtualStyle);m.geometry.parent=j;m._index=e+1;m._sketch=true;a.virtualVertices.push(m)}}}}}b.call(this,this.feature.geometry);this.layer.addFeatures(this.virtualVertices,{silent:true});this.layer.addFeatures(this.vertices,{silent:true})},collectDragHandle:function(){var e=this.feature.geometry;var a=e.getBounds().getCenterLonLat();var d=new OpenLayers.Geometry.Point(a.lon,a.lat);var b=new OpenLayers.Feature.Vector(d);d.move=function(f,g){OpenLayers.Geometry.Point.prototype.move.call(this,f,g);e.move(f,g)};b._sketch=true;this.dragHandle=b;this.layer.addFeatures([this.dragHandle],{silent:true})},collectRadiusHandle:function(){var j=this.feature.geometry;var a=j.getBounds();var b=a.getCenterLonLat();var k=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 d=(this.mode&OpenLayers.Control.ModifyFeature.RESIZE);var f=(this.mode&OpenLayers.Control.ModifyFeature.RESHAPE);var e=(this.mode&OpenLayers.Control.ModifyFeature.ROTATE);h.move=function(w,v){OpenLayers.Geometry.Point.prototype.move.call(this,w,v);var z=this.x-k.x;var s=this.y-k.y;var A=z-w;var t=s-v;if(e){var m=Math.atan2(t,A);var l=Math.atan2(s,z);var p=l-m;p*=180/Math.PI;j.rotate(p,k)}if(d){var o,u;if(f){o=s/t;u=(z/A)/o}else{var q=Math.sqrt((A*A)+(t*t));var n=Math.sqrt((z*z)+(s*s));o=n/q}j.resize(o,k,u)}};g._sketch=true;this.radiusHandle=g;this.layer.addFeatures([this.radiusHandle],{silent:true})},setMap:function(a){this.standalone||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.Control.Panel=OpenLayers.Class(OpenLayers.Control,{controls:null,autoActivate:true,defaultControl:null,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,[a]);this.controls=[]},destroy:function(){OpenLayers.Control.prototype.destroy.apply(this,arguments);for(var a=this.controls.length-1;a>=0;a--){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})}return this.div},redraw:function(){this.div.innerHTML="";if(this.active){for(var d=0,a=this.controls.length;d<a;d++){var b=this.controls[d].panel_div;if(this.controls[d].active){b.className=this.controls[d].displayClass+"ItemActive"}else{b.className=this.controls[d].displayClass+"ItemInactive"}this.div.appendChild(b)}}},activateControl:function(d){if(!this.active){return false}if(d.type==OpenLayers.Control.TYPE_BUTTON){d.trigger();this.redraw();return}if(d.type==OpenLayers.Control.TYPE_TOGGLE){if(d.active){d.deactivate()}else{d.activate()}this.redraw();return}for(var b=0,a=this.controls.length;b<a;b++){if(this.controls[b]!=d){if(this.controls[b].type!=OpenLayers.Control.TYPE_TOGGLE){this.controls[b].deactivate()}}}d.activate()},addControls:function(b){if(!(b instanceof Array)){b=[b]}this.controls=this.controls.concat(b);for(var e=0,a=b.length;e<a;e++){var d=document.createElement("div");b[e].panel_div=d;if(b[e].title!=""){b[e].panel_div.title=b[e].title}OpenLayers.Event.observe(b[e].panel_div,"click",OpenLayers.Function.bind(this.onClick,this,b[e]));OpenLayers.Event.observe(b[e].panel_div,"dblclick",OpenLayers.Function.bind(this.onDoubleClick,this,b[e]));OpenLayers.Event.observe(b[e].panel_div,"mousedown",OpenLayers.Function.bindAsEventListener(OpenLayers.Event.stop))}if(this.map){for(var e=0,a=b.length;e<a;e++){this.map.addControl(b[e]);b[e].deactivate();b[e].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)},onDoubleClick:function(b,a){OpenLayers.Event.stop(a?a:window.event)},getControlsBy:function(d,a){var e=(typeof a.test=="function");var b=OpenLayers.Array.filter(this.controls,function(f){return f[d]==a||(e&&a.test(f[d]))});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.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(d,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}this.initLayer(d);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"})}},initLayer:function(a){if(a instanceof Array){this.layers=a;this.layer=new OpenLayers.Layer.Vector.RootContainer(this.id+"_container",{layers:a})}else{this.layer=a}},destroy:function(){if(this.active&&this.layers){this.map.removeLayer(this.layer)}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,e;for(var a=0;a<g.length;++a){f=g[a];for(var d=f.selectedFeatures.length-1;d>=0;--d){e=f.selectedFeatures[d];if(!b||b.except!=e){this.unselect(e)}}}},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(d){var b=d.layer;var a=this.events.triggerEvent("beforefeaturehighlighted",{feature:d});if(a!==false){d._prevHighlighter=d._lastHighlighter;d._lastHighlighter=this.id;var e=this.selectStyle||this.renderIntent;b.drawFeature(d,e);this.events.triggerEvent("featurehighlighted",{feature:d})}},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(d){var a=this.onBeforeSelect.call(this.scope,d);var b=d.layer;if(a!==false){a=b.events.triggerEvent("beforefeatureselected",{feature:d});if(a!==false){b.selectedFeatures.push(d);this.highlight(d);if(!this.handlers.feature.lastFeature){this.handlers.feature.lastFeature=b.selectedFeatures[0]}b.events.triggerEvent("featureselected",{feature:d});this.onSelect.call(this.scope,d)}}},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 j=this.map.getLonLatFromPixel(new OpenLayers.Pixel(f.left,f.bottom));var m=this.map.getLonLatFromPixel(new OpenLayers.Pixel(f.right,f.top));var a=new OpenLayers.Bounds(j.lon,j.lat,m.lon,m.lat);if(!this.multipleSelect()){this.unselectAll()}var k=this.multiple;this.multiple=true;var e=this.layers||[this.layer];var g;for(var b=0;b<e.length;++b){g=e[b];for(var d=0,h=g.features.length;d<h;++d){var n=g.features[d];if(!n.getVisibility()){continue}if(this.geometryTypes==null||OpenLayers.Util.indexOf(this.geometryTypes,n.geometry.CLASS_NAME)>-1){if(a.toGeometry().intersects(n.geometry)){if(OpenLayers.Util.indexOf(g.selectedFeatures,n)==-1){this.select(n)}}}}}this.multiple=k}},setMap:function(a){this.handlers.feature.setMap(a);if(this.box){this.handlers.box.setMap(a)}OpenLayers.Control.prototype.setMap.apply(this,arguments)},setLayer:function(b){var a=this.active;this.unselectAll();this.deactivate();if(this.layers){this.layer.destroy();this.layers=null}this.initLayer(b);this.handlers.feature.layer=this.layer;if(a){this.activate()}},CLASS_NAME:"OpenLayers.Control.SelectFeature"});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 d=this.active;if(d){this.deactivate()}this.handler=new b(this,this.callbacks,a);if(d){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(e,b){var d,a;if(e.CLASS_NAME.indexOf("LineString")>-1){d=this.getBestLength(e);a=1}else{d=this.getBestArea(e);a=2}this.events.triggerEvent(b,{measure:d[0],units:d[1],order:a,geometry:e})},getBestArea:function(g){var b=this.displaySystemUnits[this.displaySystem];var f,e;for(var d=0,a=b.length;d<a;++d){f=b[d];e=this.getArea(g,f);if(e>1){break}}return[e,f]},getArea:function(g,a){var b,d;if(this.geodesic){b=g.getGeodesicArea(this.map.getProjectionObject());d="m"}else{b=g.getArea();d=this.map.getUnits()}var f=OpenLayers.INCHES_PER_UNIT[a];if(f){var e=OpenLayers.INCHES_PER_UNIT[d];b*=Math.pow((e/f),2)}return b},getBestLength:function(g){var b=this.displaySystemUnits[this.displaySystem];var f,e;for(var d=0,a=b.length;d<a;++d){f=b[d];e=this.getLength(g,f);if(e>1){break}}return[e,f]},getLength:function(g,a){var b,d;if(this.geodesic){b=g.getGeodesicLength(this.map.getProjectionObject());d="m"}else{b=g.getLength();d=this.map.getUnits()}var f=OpenLayers.INCHES_PER_UNIT[a];if(f){var e=OpenLayers.INCHES_PER_UNIT[d];b*=(e/f)}return b},CLASS_NAME:"OpenLayers.Control.Measure"});OpenLayers.Control.Graticule=OpenLayers.Class(OpenLayers.Control,{intervals:[45,30,20,10,5,2,1,0.5,0.2,0.1,0.05,0.01,0.005,0.002,0.001],displayInLayerSwitcher:true,visible:true,numPoints:50,targetSize:200,layerName:"Graticule",labelled:true,labelFormat:"dm",lineSymbolizer:{strokeColor:"#333",strokeWidth:1,strokeOpacity:0.5},labelSymbolizer:{},gratLayer:null,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,[a]);this.labelSymbolizer.stroke=false;this.labelSymbolizer.fill=false;this.labelSymbolizer.label="${label}";this.labelSymbolizer.labelAlign="${labelAlign}";this.labelSymbolizer.labelXOffset="${xOffset}";this.labelSymbolizer.labelYOffset="${yOffset}"},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.gratLayer){var a=new OpenLayers.Style({},{rules:[new OpenLayers.Rule({symbolizer:{Point:this.labelSymbolizer,Line:this.lineSymbolizer}})]});this.gratLayer=new OpenLayers.Layer.Vector(this.layerName,{styleMap:new OpenLayers.StyleMap({"default":a}),visibility:this.visible,displayInLayerSwitcher:this.displayInLayerSwitcher});this.map.addLayer(this.gratLayer)}this.map.events.register("moveend",this,this.update);this.update();return this.div},update:function(){var l=this.map.getExtent();if(!l){return}this.gratLayer.destroyFeatures();var m=new OpenLayers.Projection("EPSG:4326");var J=this.map.getProjectionObject();var h=this.map.getResolution();if(J.proj&&J.proj.projName=="longlat"){this.numPoints=1}var M=this.map.getCenter();var F=new OpenLayers.Pixel(M.lon,M.lat);OpenLayers.Projection.transform(F,J,m);var A=this.targetSize*h;A*=A;var q;for(var E=0;E<this.intervals.length;++E){q=this.intervals[E];var K=q/2;var e=F.offset(new OpenLayers.Pixel(-K,-K));var b=F.offset(new OpenLayers.Pixel(K,K));OpenLayers.Projection.transform(e,m,J);OpenLayers.Projection.transform(b,m,J);var f=(e.x-b.x)*(e.x-b.x)+(e.y-b.y)*(e.y-b.y);if(f<=A){break}}F.x=Math.floor(F.x/q)*q;F.y=Math.floor(F.y/q)*q;var D=0;var s=[F.clone()];var p=F.clone();var B;do{p=p.offset(new OpenLayers.Pixel(0,q));B=OpenLayers.Projection.transform(p.clone(),m,J);s.unshift(p)}while(l.containsPixel(B)&&++D<1000);p=F.clone();do{p=p.offset(new OpenLayers.Pixel(0,-q));B=OpenLayers.Projection.transform(p.clone(),m,J);s.push(p)}while(l.containsPixel(B)&&++D<1000);D=0;var x=[F.clone()];p=F.clone();do{p=p.offset(new OpenLayers.Pixel(-q,0));B=OpenLayers.Projection.transform(p.clone(),m,J);x.unshift(p)}while(l.containsPixel(B)&&++D<1000);p=F.clone();do{p=p.offset(new OpenLayers.Pixel(q,0));B=OpenLayers.Projection.transform(p.clone(),m,J);x.push(p)}while(l.containsPixel(B)&&++D<1000);var a=[];for(var E=0;E<x.length;++E){var g=x[E].x;var w=[];var L=null;var G=Math.min(s[0].y,90);var o=Math.max(s[s.length-1].y,-90);var d=(G-o)/this.numPoints;var k=o;for(var C=0;C<=this.numPoints;++C){var H=new OpenLayers.Geometry.Point(g,k);H.transform(m,J);w.push(H);k+=d;if(H.y>=l.bottom&&!L){L=H}}if(this.labelled){var u=new OpenLayers.Geometry.Point(L.x,l.bottom);var I={value:g,label:this.labelled?OpenLayers.Util.getFormattedLonLat(g,"lon",this.labelFormat):"",labelAlign:"cb",xOffset:0,yOffset:2};this.gratLayer.addFeatures(new OpenLayers.Feature.Vector(u,I))}var v=new OpenLayers.Geometry.LineString(w);a.push(new OpenLayers.Feature.Vector(v))}for(var C=0;C<s.length;++C){k=s[C].y;if(k<-90||k>90){continue}var w=[];var z=x[0].x;var t=x[x.length-1].x;var n=(t-z)/this.numPoints;var g=z;var L=null;for(var E=0;E<=this.numPoints;++E){var H=new OpenLayers.Geometry.Point(g,k);H.transform(m,J);w.push(H);g+=n;if(H.x<l.right){L=H}}if(this.labelled){var u=new OpenLayers.Geometry.Point(l.right,L.y);var I={value:k,label:this.labelled?OpenLayers.Util.getFormattedLonLat(k,"lat",this.labelFormat):"",labelAlign:"rb",xOffset:-2,yOffset:2};this.gratLayer.addFeatures(new OpenLayers.Feature.Vector(u,I))}var v=new OpenLayers.Geometry.LineString(w);a.push(new OpenLayers.Feature.Vector(v))}this.gratLayer.addFeatures(a)},CLASS_NAME:"OpenLayers.Control.Graticule"});OpenLayers.Control.TransformFeature=OpenLayers.Class(OpenLayers.Control,{EVENT_TYPES:["beforesetfeature","setfeature","beforetransform","transform","transformcomplete"],geometryTypes:null,layer:null,preserveAspectRatio:false,rotate:true,feature:null,renderIntent:"temporary",rotationHandleSymbolizer:null,box:null,center:null,scale:1,ratio:1,rotation:0,handles:null,rotationHandles:null,dragControl:null,initialize:function(b,a){this.EVENT_TYPES=OpenLayers.Control.TransformFeature.prototype.EVENT_TYPES.concat(OpenLayers.Control.prototype.EVENT_TYPES);OpenLayers.Control.prototype.initialize.apply(this,[a]);this.layer=b;if(!this.rotationHandleSymbolizer){this.rotationHandleSymbolizer={stroke:false,pointRadius:10,fillOpacity:0,cursor:"pointer"}}this.createBox();this.createControl()},activate:function(){var a=false;if(OpenLayers.Control.prototype.activate.apply(this,arguments)){this.dragControl.activate();this.layer.addFeatures([this.box]);this.rotate&&this.layer.addFeatures(this.rotationHandles);this.layer.addFeatures(this.handles);a=true}return a},deactivate:function(){var a=false;if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)){this.layer.removeFeatures(this.handles);this.rotate&&this.layer.removeFeatures(this.rotationHandles);this.layer.removeFeatures([this.box]);this.dragControl.deactivate();a=true}return a},setMap:function(a){this.dragControl.setMap(a);OpenLayers.Control.prototype.setMap.apply(this,arguments)},setFeature:function(l,d){d=OpenLayers.Util.applyDefaults(d,{rotation:0,scale:1,ratio:1});var k={feature:l};var f=this.rotation;var a=this.center;OpenLayers.Util.extend(this,d);if(this.events.triggerEvent("beforesetfeature",k)===false){return}this.feature=l;this.activate();this._setfeature=true;var b=this.feature.geometry.getBounds();this.box.move(b.getCenterLonLat());this.box.geometry.rotate(-f,a);this._angle=0;var g;if(this.rotation){var h=l.geometry.clone();h.rotate(-this.rotation,this.center);var e=new OpenLayers.Feature.Vector(h.getBounds().toGeometry());e.geometry.rotate(this.rotation,this.center);this.box.geometry.rotate(this.rotation,this.center);this.box.move(e.geometry.getBounds().getCenterLonLat());var j=e.geometry.components[0].components[0];g=j.getBounds().getCenterLonLat()}else{g=new OpenLayers.LonLat(b.left,b.bottom)}this.handles[0].move(g);delete this._setfeature;this.events.triggerEvent("setfeature",k)},createBox:function(){var f=this;this.center=new OpenLayers.Geometry.Point(0,0);var g=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString([new OpenLayers.Geometry.Point(-1,-1),new OpenLayers.Geometry.Point(0,-1),new OpenLayers.Geometry.Point(1,-1),new OpenLayers.Geometry.Point(1,0),new OpenLayers.Geometry.Point(1,1),new OpenLayers.Geometry.Point(0,1),new OpenLayers.Geometry.Point(-1,1),new OpenLayers.Geometry.Point(-1,0),new OpenLayers.Geometry.Point(-1,-1)]),null,typeof this.renderIntent=="string"?null:this.renderIntent);g.geometry.move=function(p,q){f._moving=true;OpenLayers.Geometry.LineString.prototype.move.apply(this,arguments);f.center.move(p,q);delete f._moving};var a=function(p,q){OpenLayers.Geometry.Point.prototype.move.apply(this,arguments);this._rotationHandle&&this._rotationHandle.geometry.move(p,q);this._handle.geometry.move(p,q)};var o=function(s,p,q){OpenLayers.Geometry.Point.prototype.resize.apply(this,arguments);this._rotationHandle&&this._rotationHandle.geometry.resize(s,p,q);this._handle.geometry.resize(s,p,q)};var m=function(q,p){OpenLayers.Geometry.Point.prototype.rotate.apply(this,arguments);this._rotationHandle&&this._rotationHandle.geometry.rotate(q,p);this._handle.geometry.rotate(q,p)};var j=function(D,B){var I=this.x,F=this.y;OpenLayers.Geometry.Point.prototype.move.call(this,D,B);if(f._moving){return}var G=f.dragControl.handlers.drag.evt;var p=!f._setfeature&&f.preserveAspectRatio;var u=!p&&!(G&&G.shiftKey);var C=new OpenLayers.Geometry.Point(I,F);var z=f.center;this.rotate(-f.rotation,z);C.rotate(-f.rotation,z);var E=this.x-z.x;var v=this.y-z.y;var H=E-(this.x-C.x);var w=v-(this.y-C.y);this.x=I;this.y=F;var s,A=1;if(u){s=Math.abs(w)<0.00001?1:v/w;A=(Math.abs(H)<0.00001?1:(E/H))/s}else{var t=Math.sqrt((H*H)+(w*w));var q=Math.sqrt((E*E)+(v*v));s=q/t}f._moving=true;f.box.geometry.rotate(-f.rotation,z);delete f._moving;f.box.geometry.resize(s,z,A);f.box.geometry.rotate(f.rotation,z);f.transformFeature({scale:s,ratio:A})};var d=function(A,w){var G=this.x,D=this.y;OpenLayers.Geometry.Point.prototype.move.call(this,A,w);if(f._moving){return}var E=f.dragControl.handlers.drag.evt;var z=(E&&E.shiftKey)?45:1;var v=f.center;var C=this.x-v.x;var t=this.y-v.y;var F=C-A;var u=t-w;this.x=G;this.y=D;var q=Math.atan2(u,F);var p=Math.atan2(t,C);var s=p-q;s*=180/Math.PI;f._angle=(f._angle+s)%360;var B=f.rotation%z;if(Math.abs(f._angle)>=z||B!==0){s=Math.round(f._angle/z)*z-B;f._angle=0;f.box.geometry.rotate(s,v);f.transformFeature({rotation:s})}};var n=new Array(8);var k=new Array(4);var l,h,b;for(var e=0;e<8;++e){l=g.geometry.components[e];h=new OpenLayers.Feature.Vector(l.clone(),null,typeof this.renderIntent=="string"?null:this.renderIntent);if(e%2==0){b=new OpenLayers.Feature.Vector(l.clone(),null,typeof this.rotationHandleSymbolizer=="string"?null:this.rotationHandleSymbolizer);b.geometry.move=d;l._rotationHandle=b;k[e/2]=b}l.move=a;l.resize=o;l.rotate=m;h.geometry.move=j;l._handle=h;n[e]=h}this.box=g;this.rotationHandles=k;this.handles=n},createControl:function(){var a=this;this.dragControl=new OpenLayers.Control.DragFeature(this.layer,{documentDrag:true,moveFeature:function(b){if(this.feature===a.feature){this.feature=a.box}OpenLayers.Control.DragFeature.prototype.moveFeature.apply(this,arguments)},onDrag:function(e,b){var d=e.geometry;if(e===a.box){a.transformFeature({center:a.center});a.drawHandles()}},onStart:function(f,d){var b=!a.geometryTypes||OpenLayers.Util.indexOf(a.geometryTypes,f.geometry.CLASS_NAME)!==-1;var e=OpenLayers.Util.indexOf(a.handles,f);e+=OpenLayers.Util.indexOf(a.rotationHandles,f);if(f!==a.feature&&f!==a.box&&e==-2&&b){a.setFeature(f)}},onComplete:function(d,b){a.events.triggerEvent("transformcomplete",{feature:d})}})},drawHandles:function(){var b=this.layer;for(var a=0;a<8;++a){if(this.rotate&&a%2===0){b.drawFeature(this.rotationHandles[a/2],this.rotationHandleSymbolizer)}b.drawFeature(this.handles[a],this.renderIntent)}},transformFeature:function(f){if(!this._setfeature){this.scale*=(f.scale||1);this.ratio*=(f.ratio||1);var b=this.rotation;this.rotation=(this.rotation+(f.rotation||0))%360;if(this.events.triggerEvent("beforetransform",f)!==false){var e=this.feature;var d=e.geometry;var a=this.center;d.rotate(-b,a);if(f.scale||f.ratio){d.resize(f.scale,a,f.ratio)}else{if(f.center){e.move(f.center.getBounds().getCenterLonLat())}}d.rotate(this.rotation,a);this.layer.drawFeature(e);e.toState(OpenLayers.State.UPDATE);this.events.triggerEvent("transform",f)}}this.layer.drawFeature(this.box,this.renderIntent);this.drawHandles()},destroy:function(){var b;for(var a=0;a<8;++a){b=this.box.geometry.components[a];b._handle.destroy();b._handle=null;b._rotationHandle&&b._rotationHandle.destroy();b._rotationHandle=null}this.box.destroy();this.box=null;this.layer=null;this.dragControl.destroy();OpenLayers.Control.prototype.destroy.apply(this,arguments)},CLASS_NAME:"OpenLayers.Control.TransformFeature"});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,j,g){var d=false;var e=this.getBounds();if((e!=null)&&(f!=null)){var b=(j!=null)?j: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);d=h.containsLonLat(f)}return d},getLength:function(){return 0},getArea:function(){return 0},getCentroid:function(){return null},toString:function(){return OpenLayers.Format.WKT.prototype.write(new OpenLayers.Feature.Vector(this))},CLASS_NAME:"OpenLayers.Geometry"});OpenLayers.Geometry.fromWKT=function(g){var h=arguments.callee.format;if(!h){h=new OpenLayers.Format.WKT();arguments.callee.format=h}var e;var b=h.read(g);if(b instanceof OpenLayers.Feature.Vector){e=b.geometry}else{if(b instanceof Array){var a=b.length;var f=new Array(a);for(var d=0;d<a;++d){f[d]=b[d].geometry}e=new OpenLayers.Geometry.Collection(f)}}return e};OpenLayers.Geometry.segmentsIntersect=function(a,J,b){var u=b&&b.point;var B=b&&b.tolerance;var g=false;var D=a.x1-J.x1;var H=a.y1-J.y1;var q=a.x2-a.x1;var A=a.y2-a.y1;var v=J.y2-J.y1;var m=J.x2-J.x1;var F=(v*q)-(m*A);var f=(m*H)-(v*D);var e=(q*H)-(A*D);if(F==0){if(f==0&&e==0){g=true}}else{var G=f/F;var E=e/F;if(G>=0&&G<=1&&E>=0&&E<=1){if(!u){g=true}else{var k=a.x1+(G*q);var h=a.y1+(G*A);g=new OpenLayers.Geometry.Point(k,h)}}}if(B){var t;if(g){if(u){var o=[a,J];var C,k,h;outer:for(var z=0;z<2;++z){C=o[z];for(var w=1;w<3;++w){k=C["x"+w];h=C["y"+w];t=Math.sqrt(Math.pow(k-g.x,2)+Math.pow(h-g.y,2));if(t<B){g.x=k;g.y=h;break outer}}}}}else{var o=[a,J];var s,I,k,h,n,l;outer:for(var z=0;z<2;++z){s=o[z];I=o[(z+1)%2];for(var w=1;w<3;++w){n={x:s["x"+w],y:s["y"+w]};l=OpenLayers.Geometry.distanceToSegment(n,I);if(l.distance<B){if(u){g=new OpenLayers.Geometry.Point(n.x,n.y)}else{g=true}break outer}}}}}return g};OpenLayers.Geometry.distanceToSegment=function(m,e){var d=m.x;var l=m.y;var b=e.x1;var k=e.y1;var a=e.x2;var g=e.y2;var o=a-b;var n=g-k;var j=((o*(d-b))+(n*(l-k)))/(Math.pow(o,2)+Math.pow(n,2));var h,f;if(j<=0){h=b;f=k}else{if(j>=1){h=a;f=g}else{h=b+j*o;f=k+j*n}}return{distance:Math.sqrt(Math.pow(h-d,2)+Math.pow(f-l,2)),x:h,y:f}};OpenLayers.Geometry.Rectangle=OpenLayers.Class(OpenLayers.Geometry,{x:null,y:null,width:null,height:null,initialize:function(b,e,d,a){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.x=b;this.y=e;this.width=d;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.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 d=0,a=this.components.length;d<a;d++){b.push(this.components[d].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(d){if(!(d instanceof Array)){d=[d]}for(var b=0,a=d.length;b<a;b++){this.addComponent(d[b])}},addComponent:function(b,a){var e=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 d=this.components.slice(a,this.components.length);f.push(b);this.components=f.concat(d)}else{this.components.push(b)}b.parent=this;this.clearBounds();e=true}}return e},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 d=0;for(var b=0,a=this.components.length;b<a;b++){d+=this.components[b].getLength()}return d},getArea:function(){var d=0;for(var b=0,a=this.components.length;b<a;b++){d+=this.components[b].getArea()}return d},getGeodesicArea:function(b){var e=0;for(var d=0,a=this.components.length;d<a;d++){e+=this.components[d].getGeodesicArea(b)}return e},getCentroid:function(){return this.components.length&&this.components[0].getCentroid()},getGeodesicLength:function(b){var e=0;for(var d=0,a=this.components.length;d<a;d++){e+=this.components[d].getGeodesicLength(b)}return e},move:function(b,e){for(var d=0,a=this.components.length;d<a;d++){this.components[d].move(b,e)}},rotate:function(e,b){for(var d=0,a=this.components.length;d<a;++d){this.components[d].rotate(e,b)}},resize:function(e,a,d){for(var b=0;b<this.components.length;++b){this.components[b].resize(e,a,d)}return this},distanceTo:function(j,k){var d=!(k&&k.edge===false);var a=d&&k&&k.details;var l,e,b;var f=Number.POSITIVE_INFINITY;for(var g=0,h=this.components.length;g<h;++g){l=this.components[g].distanceTo(j,k);b=a?l.distance:l;if(b<f){f=b;e=l;if(f==0){break}}}return e},equals:function(e){var b=true;if(!e||!e.CLASS_NAME||(this.CLASS_NAME!=e.CLASS_NAME)){b=false}else{if(!(e.components instanceof Array)||(e.components.length!=this.components.length)){b=false}else{for(var d=0,a=this.components.length;d<a;++d){if(!this.components[d].equals(e.components[d])){b=false;break}}}}return b},transform:function(f,d){if(f&&d){for(var e=0,a=this.components.length;e<a;e++){var b=this.components[e];b.transform(f,d)}this.bounds=null}return this},intersects:function(e){var b=false;for(var d=0,a=this.components.length;d<a;++d){b=e.intersects(this.components[d]);if(b){break}}return b},getVertices:function(b){var d=[];for(var e=0,a=this.components.length;e<a;++e){Array.prototype.push.apply(d,this.components[e].getVertices(b))}return d},CLASS_NAME:"OpenLayers.Geometry.Collection"});OpenLayers.Geometry.Point=OpenLayers.Class(OpenLayers.Geometry,{x:null,y:null,initialize:function(a,d,b){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);if(b!==false){this.x=parseFloat(a);this.y=parseFloat(d)}else{this.x=a;this.y=d}},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,l){var e=!(l&&l.edge===false);var a=e&&l&&l.details;var b,f,j,d,h,k;if(g instanceof OpenLayers.Geometry.Point){f=this.x;j=this.y;d=g.x;h=g.y;b=Math.sqrt(Math.pow(f-d,2)+Math.pow(j-h,2));k=!a?b:{x0:f,y0:j,x1:d,y1:h,distance:b}}else{k=g.distanceTo(this,l);if(a){k={x0:k.x1,y0:k.y1,x1:k.x0,y1:k.y0,distance:k.distance}}}return k},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(e,b){e*=Math.PI/180;var a=this.distanceTo(b);var d=e+Math.atan2(this.y-b.y,this.x-b.x);this.x=b.x+(a*Math.cos(d));this.y=b.y+(a*Math.sin(d));this.clearBounds()},getCentroid:function(){return new OpenLayers.Geometry.Point(this.x,this.y)},resize:function(d,a,b){b=(b==undefined)?1:b;this.x=a.x+(d*b*(this.x-a.x));this.y=a.y+(d*(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.MultiPoint=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(a){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments)},addPoint:function(a,b){this.addComponent(a,b)},removePoint:function(a){this.removeComponent(a)},CLASS_NAME:"OpenLayers.Geometry.MultiPoint"});OpenLayers.Geometry.Curve=OpenLayers.Class(OpenLayers.Geometry.MultiPoint,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(a){OpenLayers.Geometry.MultiPoint.prototype.initialize.apply(this,arguments)},getLength:function(){var d=0;if(this.components&&(this.components.length>1)){for(var b=1,a=this.components.length;b<a;b++){d+=this.components[b-1].distanceTo(this.components[b])}}return d},getGeodesicLength:function(b){var f=this;if(b){var d=new OpenLayers.Projection("EPSG:4326");if(!d.equals(b)){f=this.clone().transform(b,d)}}var g=0;if(f.components&&(f.components.length>1)){var j,h;for(var e=1,a=f.components.length;e<a;e++){j=f.components[e-1];h=f.components[e];g+=OpenLayers.Util.distVincenty({lon:j.x,lat:j.y},{lon:h.x,lat:h.y})}}return g*1000},CLASS_NAME:"OpenLayers.Geometry.Curve"});OpenLayers.Geometry.LineString=OpenLayers.Class(OpenLayers.Geometry.Curve,{initialize:function(a){OpenLayers.Geometry.Curve.prototype.initialize.apply(this,arguments)},removeComponent:function(a){if(this.components&&(this.components.length>2)){OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments)}},intersects:function(n){var d=false;var m=n.CLASS_NAME;if(m=="OpenLayers.Geometry.LineString"||m=="OpenLayers.Geometry.LinearRing"||m=="OpenLayers.Geometry.Point"){var q=this.getSortedSegments();var o;if(m=="OpenLayers.Geometry.Point"){o=[{x1:n.x,y1:n.y,x2:n.x,y2:n.y}]}else{o=n.getSortedSegments()}var u,h,f,a,t,s,e,b;outer:for(var k=0,l=q.length;k<l;++k){u=q[k];h=u.x1;f=u.x2;a=u.y1;t=u.y2;inner:for(var g=0,p=o.length;g<p;++g){s=o[g];if(s.x1>f){break}if(s.x2<h){continue}e=s.y1;b=s.y2;if(Math.min(e,b)>Math.max(a,t)){continue}if(Math.max(e,b)<Math.min(a,t)){continue}if(OpenLayers.Geometry.segmentsIntersect(u,s)){d=true;break outer}}}}else{d=n.intersects(this)}return d},getSortedSegments:function(){var a=this.components.length-1;var b=new Array(a),f,e;for(var d=0;d<a;++d){f=this.components[d];e=this.components[d+1];if(f.x<e.x){b[d]={x1:f.x,y1:f.y,x2:e.x,y2:e.y}}else{b[d]={x1:e.x,y1:e.y,x2:f.x,y2:f.y}}}function g(j,h){return j.x1-h.x1}return b.sort(g)},splitWithSegment:function(t,b){var d=!(b&&b.edge===false);var p=b&&b.tolerance;var a=[];var v=this.getVertices();var o=[];var x=[];var j=false;var f,e,m;var k,s,w;var g={point:true,tolerance:p};var h=null;for(var n=0,l=v.length-2;n<=l;++n){f=v[n];o.push(f.clone());e=v[n+1];w={x1:f.x,y1:f.y,x2:e.x,y2:e.y};m=OpenLayers.Geometry.segmentsIntersect(t,w,g);if(m instanceof OpenLayers.Geometry.Point){if((m.x===t.x1&&m.y===t.y1)||(m.x===t.x2&&m.y===t.y2)||m.equals(f)||m.equals(e)){s=true}else{s=false}if(s||d){if(!m.equals(x[x.length-1])){x.push(m.clone())}if(n===0){if(m.equals(f)){continue}}if(m.equals(e)){continue}j=true;if(!m.equals(f)){o.push(m)}a.push(new OpenLayers.Geometry.LineString(o));o=[m.clone()]}}}if(j){o.push(e.clone());a.push(new OpenLayers.Geometry.LineString(o))}if(x.length>0){var q=t.x1<t.x2?1:-1;var u=t.y1<t.y2?1:-1;h={lines:a,points:x.sort(function(A,z){return(q*A.x-q*z.x)||(u*A.y-u*z.y)})}}return h},split:function(A,b){var o=null;var e=b&&b.mutual;var m,f,n,d;if(A instanceof OpenLayers.Geometry.LineString){var z=this.getVertices();var h,g,x,l,a,q;var u=[];n=[];for(var v=0,p=z.length-2;v<=p;++v){h=z[v];g=z[v+1];x={x1:h.x,y1:h.y,x2:g.x,y2:g.y};d=d||[A];if(e){u.push(h.clone())}for(var t=0;t<d.length;++t){l=d[t].splitWithSegment(x,b);if(l){a=l.lines;if(a.length>0){a.unshift(t,1);Array.prototype.splice.apply(d,a);t+=a.length-2}if(e){for(var s=0,w=l.points.length;s<w;++s){q=l.points[s];if(!q.equals(h)){u.push(q);n.push(new OpenLayers.Geometry.LineString(u));if(q.equals(g)){u=[]}else{u=[q.clone()]}}}}}}}if(e&&n.length>0&&u.length>0){u.push(g.clone());n.push(new OpenLayers.Geometry.LineString(u))}}else{o=A.splitWith(this,b)}if(d&&d.length>1){f=true}else{d=[]}if(n&&n.length>1){m=true}else{n=[]}if(f||m){if(e){o=[n,d]}else{o=d}}return o},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 D=l&&h&&h.details;var s,f={};var v=Number.POSITIVE_INFINITY;if(k instanceof OpenLayers.Geometry.Point){var t=this.getSortedSegments();var q=k.x;var p=k.y;var B;for(var z=0,A=t.length;z<A;++z){B=t[z];s=OpenLayers.Geometry.distanceToSegment(k,B);if(s.distance<v){v=s.distance;f=s;if(v===0){break}}else{if(B.x2>q&&((p>B.y1&&p<B.y2)||(p<B.y1&&p>B.y2))){break}}}if(D){f={distance:f.distance,x0:f.x,y0:f.y,x1:q,y1:p}}else{f=f.distance}}else{if(k instanceof OpenLayers.Geometry.LineString){var e=this.getSortedSegments();var d=k.getSortedSegments();var b,a,o,C,g;var n=d.length;var m={point:true};outer:for(var z=0,A=e.length;z<A;++z){b=e[z];C=b.x1;g=b.y1;for(var w=0;w<n;++w){a=d[w];o=OpenLayers.Geometry.segmentsIntersect(b,a,m);if(o){v=0;f={distance:0,x0:o.x,y0:o.y,x1:o.x,y1:o.y};break outer}else{s=OpenLayers.Geometry.distanceToSegment({x:C,y:g},a);if(s.distance<v){v=s.distance;f={distance:v,x0:C,y0:g,x1:s.x,y1:s.y}}}}}if(!D){f=f.distance}if(v!==0){if(b){s=k.distanceTo(new OpenLayers.Geometry.Point(b.x2,b.y2),h);var u=D?s.distance:s;if(u<v){if(D){f={distance:v,x0:s.x1,y0:s.y1,x1:s.x0,y1:s.y0}}else{f=u}}}}}else{f=k.distanceTo(this,h);if(D){f={distance:f.distance,x0:f.x1,y0:f.y1,x1:f.x0,y1:f.y0}}}}return f},CLASS_NAME:"OpenLayers.Geometry.LineString"});OpenLayers.Geometry.LinearRing=OpenLayers.Class(OpenLayers.Geometry.LineString,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(a){OpenLayers.Geometry.LineString.prototype.initialize.apply(this,arguments)},addComponent:function(a,b){var d=false;var e=this.components.pop();if(b!=null||!a.equals(e)){d=OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,arguments)}var f=this.components[0];OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[f]);return d},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,e){for(var d=0,a=this.components.length;d<a-1;d++){this.components[d].move(b,e)}},rotate:function(e,b){for(var d=0,a=this.components.length;d<a-1;++d){this.components[d].rotate(e,b)}},resize:function(f,b,e){for(var d=0,a=this.components.length;d<a-1;++d){this.components[d].resize(f,b,e)}return this},transform:function(f,d){if(f&&d){for(var e=0,a=this.components.length;e<a-1;e++){var b=this.components[e];b.transform(f,d)}this.bounds=null}return this},getCentroid:function(){if(this.components&&(this.components.length>2)){var h=0;var g=0;for(var e=0;e<this.components.length-1;e++){var d=this.components[e];var k=this.components[e+1];h+=(d.x+k.x)*(d.x*k.y-k.x*d.y);g+=(d.y+k.y)*(d.x*k.y-k.x*d.y)}var f=-1*this.getArea();var a=h/(6*f);var j=g/(6*f);return new OpenLayers.Geometry.Point(a,j)}else{return null}},getArea:function(){var g=0;if(this.components&&(this.components.length>2)){var f=0;for(var e=0,d=this.components.length;e<d-1;e++){var a=this.components[e];var h=this.components[e+1];f+=(a.x+h.x)*(h.y-a.y)}g=-f/2}return g},getGeodesicArea:function(b){var e=this;if(b){var d=new OpenLayers.Projection("EPSG:4326");if(!d.equals(b)){e=this.clone().transform(b,d)}}var g=0;var a=e.components&&e.components.length;if(a>2){var j,h;for(var f=0;f<a-1;f++){j=e.components[f];h=e.components[f+1];g+=OpenLayers.Util.rad(h.x-j.x)*(2+Math.sin(OpenLayers.Util.rad(j.y))+Math.sin(OpenLayers.Util.rad(h.y)))}g=g*6378137*6378137/2}return g},containsPoint:function(n){var u=OpenLayers.Number.limitSigDigs;var m=14;var l=u(n.x,m);var k=u(n.y,m);function t(A,w,z,v,x){return(((w-v)*A)+((v*z)-(w*x)))/(z-x)}var a=this.components.length-1;var h,g,s,e,p,b,f,d;var j=0;for(var o=0;o<a;++o){h=this.components[o];s=u(h.x,m);e=u(h.y,m);g=this.components[o+1];p=u(g.x,m);b=u(g.y,m);if(e==b){if(k==e){if(s<=p&&(l>=s&&l<=p)||s>=p&&(l<=s&&l>=p)){j=-1;break}}continue}f=u(t(k,s,e,p,b),m);if(f==l){if(e<b&&(k>=e&&k<=b)||e>b&&(k<=e&&k>=b)){j=-1;break}}if(f<=l){continue}if(s!=p&&(f<Math.min(s,p)||f>Math.max(s,p))){continue}if(e<b&&(k>=e&&k<b)||e>b&&(k<e&&k>=b)){++j}}var q=(j==-1)?1:!!(j&1);return q},intersects:function(e){var b=false;if(e.CLASS_NAME=="OpenLayers.Geometry.Point"){b=this.containsPoint(e)}else{if(e.CLASS_NAME=="OpenLayers.Geometry.LineString"){b=e.intersects(this)}else{if(e.CLASS_NAME=="OpenLayers.Geometry.LinearRing"){b=OpenLayers.Geometry.LineString.prototype.intersects.apply(this,[e])}else{for(var d=0,a=e.components.length;d<a;++d){b=e.components[d].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.Polygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LinearRing"],initialize:function(a){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments)},getArea:function(){var d=0;if(this.components&&(this.components.length>0)){d+=Math.abs(this.components[0].getArea());for(var b=1,a=this.components.length;b<a;b++){d-=Math.abs(this.components[b].getArea())}}return d},getGeodesicArea:function(b){var e=0;if(this.components&&(this.components.length>0)){e+=Math.abs(this.components[0].getGeodesicArea(b));for(var d=1,a=this.components.length;d<a;d++){e-=Math.abs(this.components[d].getGeodesicArea(b))}}return e},containsPoint:function(a){var f=this.components.length;var d=false;if(f>0){d=this.components[0].containsPoint(a);if(d!==1){if(d&&f>1){var e;for(var b=1;b<f;++b){e=this.components[b].containsPoint(a);if(e){if(e===1){d=1}else{d=false}break}}}}}return d},intersects:function(f){var b=false;var e,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(e=0,a=this.components.length;e<a;++e){b=f.intersects(this.components[e]);if(b){break}}if(!b){for(e=0,a=f.components.length;e<a;++e){b=this.containsPoint(f.components[e]);if(b){break}}}}else{for(e=0,a=f.components.length;e<a;++e){b=this.intersects(f.components[e]);if(b){break}}}}if(!b&&f.CLASS_NAME=="OpenLayers.Geometry.Polygon"){var d=this.components[0];for(e=0,a=d.components.length;e<a;++e){b=f.containsPoint(d.components[e]);if(b){break}}}return b},distanceTo:function(e,b){var d=!(b&&b.edge===false);var a;if(!d&&this.intersects(e)){a=0}else{a=OpenLayers.Geometry.Collection.prototype.distanceTo.apply(this,[e,b])}return a},CLASS_NAME:"OpenLayers.Geometry.Polygon"});OpenLayers.Geometry.Polygon.createRegularPolygon=function(k,g,b,m){var d=Math.PI*((1/b)-(1/2));if(m){d+=(m/180)*Math.PI}var a,j,h;var l=[];for(var f=0;f<b;++f){a=d+(f*2*Math.PI/b);j=k.x+(g*Math.cos(a));h=k.y+(g*Math.sin(a));l.push(new OpenLayers.Geometry.Point(j,h))}var e=new OpenLayers.Geometry.LinearRing(l);return new OpenLayers.Geometry.Polygon([e])};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(o,u){var h=null;var t=u&&u.mutual;var p,a,s,n,b;var f=[];var q=[o];for(var g=0,l=this.components.length;g<l;++g){a=this.components[g];n=false;for(var e=0;e<q.length;++e){p=a.split(q[e],u);if(p){if(t){s=p[0];for(var d=0,m=s.length;d<m;++d){if(d===0&&f.length){f[f.length-1].addComponent(s[d])}else{f.push(new OpenLayers.Geometry.MultiLineString([s[d]]))}}n=true;p=p[1]}if(p.length){p.unshift(e,1);Array.prototype.splice.apply(q,p);break}}}if(!n){if(f.length){f[f.length-1].addComponent(a.clone())}else{f=[new OpenLayers.Geometry.MultiLineString(a.clone())]}}}if(f&&f.length>1){n=true}else{f=[]}if(q&&q.length>1){b=true}else{q=[]}if(n||b){if(t){h=[f,q]}else{h=q}}return h},splitWith:function(o,u){var h=null;var t=u&&u.mutual;var p,d,s,n,a,f,q;if(o instanceof OpenLayers.Geometry.LineString){q=[];f=[o];for(var g=0,l=this.components.length;g<l;++g){a=false;d=this.components[g];for(var e=0;e<f.length;++e){p=f[e].split(d,u);if(p){if(t){s=p[0];if(s.length){s.unshift(e,1);Array.prototype.splice.apply(f,s);e+=s.length-2}p=p[1];if(p.length===0){p=[d.clone()]}}for(var b=0,m=p.length;b<m;++b){if(b===0&&q.length){q[q.length-1].addComponent(p[b])}else{q.push(new OpenLayers.Geometry.MultiLineString([p[b]]))}}a=true}}if(!a){if(q.length){q[q.length-1].addComponent(d.clone())}else{q=[new OpenLayers.Geometry.MultiLineString([d.clone()])]}}}}else{h=o.split(this)}if(f&&f.length>1){n=true}else{f=[]}if(q&&q.length>1){a=true}else{q=[]}if(n||a){if(t){h=[f,q]}else{h=q}}return h},CLASS_NAME:"OpenLayers.Geometry.MultiLineString"});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.Geometry.Surface=OpenLayers.Class(OpenLayers.Geometry,{initialize:function(){OpenLayers.Geometry.prototype.initialize.apply(this,arguments)},CLASS_NAME:"OpenLayers.Geometry.Surface"});OpenLayers.Renderer=OpenLayers.Class({container:null,root:null,extent:null,locked:false,size:null,resolution:null,map:null,initialize:function(a,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(d,e){if(e==null){e=d.style}if(d.geometry){var f=d.geometry.getBounds();if(f){if(!f.intersectsBounds(this.extent)){e={display:"none"}}var g=this.drawGeometry(d.geometry,e,d.id);if(e.display!="none"&&e.label&&g!==false){var a=d.geometry.getCentroid();if(e.labelXOffset||e.labelYOffset){xOffset=isNaN(e.labelXOffset)?0:e.labelXOffset;yOffset=isNaN(e.labelYOffset)?0:e.labelYOffset;var b=this.getResolution();a.move(xOffset*b,yOffset*b)}this.drawText(d.id,e,a)}else{this.removeText(d.id)}return g}}},drawGeometry:function(d,a,b){},drawText:function(d,b,a){},removeText:function(a){},clear:function(){},getFeatureIdFromEvent:function(a){},eraseFeatures:function(d){if(!(d instanceof Array)){d=[d]}for(var b=0,a=d.length;b<a;++b){this.eraseGeometry(d[b].geometry);this.removeText(d[b].id)}},eraseGeometry:function(a){},moveRoot:function(a){},getRenderLayerId:function(){return this.container.id},CLASS_NAME:"OpenLayers.Renderer"});OpenLayers.ElementsIndexer=OpenLayers.Class({maxZIndex:null,order:null,indices:null,compare:null,initialize:function(a){this.compare=a?OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_Y_ORDER:OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_DRAWING_ORDER;this.order=[];this.indices={};this.maxZIndex=0},insert:function(d){if(this.exists(d)){this.remove(d)}var g=d.id;this.determineZIndex(d);var e=-1;var f=this.order.length;var a;while(f-e>1){a=parseInt((e+f)/2);var b=this.compare(this,d,OpenLayers.Util.getElement(this.order[a]));if(b>0){e=a}else{f=a}}this.order.splice(f,0,g);this.indices[g]=this.getZIndex(d);return this.getNextElement(f)},remove:function(b){var e=b.id;var a=OpenLayers.Util.indexOf(this.order,e);if(a>=0){this.order.splice(a,1);delete this.indices[e];if(this.order.length>0){var d=this.order[this.order.length-1];this.maxZIndex=this.indices[d]}else{this.maxZIndex=0}}},clear:function(){this.order=[];this.indices={};this.maxZIndex=0},exists:function(a){return(this.indices[a.id]!=null)},getZIndex:function(a){return a._style.graphicZIndex},determineZIndex:function(a){var b=a._style.graphicZIndex;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 d=OpenLayers.Util.getElement(this.order[a]);if(d==undefined){d=this.getNextElement(a)}return d}else{return null}},CLASS_NAME:"OpenLayers.ElementsIndexer"});OpenLayers.ElementsIndexer.IndexingMethods={Z_ORDER:function(f,e,b){var a=f.getZIndex(e);var g=0;if(b){var d=f.getZIndex(b);g=a-d}return g},Z_ORDER_DRAWING_ORDER:function(d,b,a){var e=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(d,b,a);if(a&&e==0){e=1}return e},Z_ORDER_Y_ORDER:function(e,d,b){var f=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(e,d,b);if(b&&f===0){var a=b._boundsBottom-d._boundsBottom;f=(a===0)?1:a}return f}};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,e,g){var d=h.CLASS_NAME;var j=true;if((d=="OpenLayers.Geometry.Collection")||(d=="OpenLayers.Geometry.MultiPoint")||(d=="OpenLayers.Geometry.MultiLineString")||(d=="OpenLayers.Geometry.MultiPolygon")){for(var b=0,a=h.components.length;b<a;b++){j=this.drawGeometry(h.components[b],e,g)&&j}return j}j=false;if(e.display!="none"){if(e.backgroundGraphic){this.redrawBackgroundNode(h.id,h,e,g)}j=this.redrawNode(h.id,h,e,g)}if(j==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 j},redrawNode:function(h,g,b,f){var d=this.nodeFactory(h,this.getNodeType(g,b));d._featureId=f;d._boundsBottom=g.getBounds().bottom;d._geometryClass=g.CLASS_NAME;d._style=b;var a=this.drawGeometryNode(d,g,b);if(a===false){return false}d=a.node;if(this.indexer){var e=this.indexer.insert(d);if(e){this.vectorRoot.insertBefore(d,e)}else{this.vectorRoot.appendChild(d)}}else{if(d.parentNode!==this.vectorRoot){this.vectorRoot.appendChild(d)}}this.postDraw(d);return a.complete},redrawBackgroundNode:function(f,e,b,d){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,e,a,null)},drawGeometryNode:function(d,f,b){b=b||d._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 e;switch(f.CLASS_NAME){case"OpenLayers.Geometry.Point":if(b.graphic===false){a.isFilled=false;a.isStroked=false}e=this.drawPoint(d,f);break;case"OpenLayers.Geometry.LineString":a.isFilled=false;e=this.drawLineString(d,f);break;case"OpenLayers.Geometry.LinearRing":e=this.drawLinearRing(d,f);break;case"OpenLayers.Geometry.Polygon":e=this.drawPolygon(d,f);break;case"OpenLayers.Geometry.Surface":e=this.drawSurface(d,f);break;case"OpenLayers.Geometry.Rectangle":e=this.drawRectangle(d,f);break;default:break}d._options=a;if(e!=false){return{node:this.setStyle(d,b,a,f),complete:e}}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 e=a.target;var b=e&&e.correspondingUseElement;var d=b?b:(e||a.srcElement);var f=d._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 e=0,a=g.components.length;e<a;e++){this.eraseGeometry(g.components[e])}}else{var d=OpenLayers.Util.getElement(g.id);if(d&&d.parentNode){if(d.geometry){d.geometry.destroy();d.geometry=null}d.parentNode.removeChild(d);if(this.indexer){this.indexer.remove(d)}if(d._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(d,a){var b=OpenLayers.Util.getElement(d);if(b){if(!this.nodeTypeCompare(b,a)){b.parentNode.removeChild(b);b=this.nodeFactory(d,a)}}else{b=this.createNode(a,d)}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.Renderer.SVG=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"http://www.w3.org/2000/svg",xlinkns:"http://www.w3.org/1999/xlink",MAX_PIXEL:15000,translationParameters:null,symbolMetrics:null,isGecko:null,supportUse:null,initialize:function(a){if(!this.supported()){return}OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments);this.translationParameters={x:0,y:0};this.supportUse=(navigator.userAgent.toLowerCase().indexOf("applewebkit/5")==-1);this.isGecko=(navigator.userAgent.toLowerCase().indexOf("gecko/")!=-1);this.symbolMetrics={}},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments)},supported:function(){var a="http://www.w3.org/TR/SVG11/feature#";return(document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature(a+"SVG","1.1")||document.implementation.hasFeature(a+"BasicStructure","1.1")))},inValidRange:function(a,f,b){var e=a+(b?0:this.translationParameters.x);var d=f+(b?0:this.translationParameters.y);return(e>=-this.MAX_PIXEL&&e<=this.MAX_PIXEL&&d>=-this.MAX_PIXEL&&d<=this.MAX_PIXEL)},setExtent:function(b,e){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var a=this.getResolution();var g=-b.left/a;var f=b.top/a;if(e){this.left=g;this.top=f;if(this.size){var d="0 0 "+this.size.w+" "+this.size.h;this.rendererRoot.setAttributeNS(null,"viewBox",d);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,d){if(!this.inValidRange(a,d,true)){return false}else{var b="";if(a||d){b="translate("+a+","+d+")"}this.root.setAttributeNS(null,"transform",b);this.translationParameters={x:a,y:d};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(d,b){var a=null;switch(d.CLASS_NAME){case"OpenLayers.Geometry.Point":if(b.externalGraphic){a="image"}else{if(this.isComplexSymbol(b.graphicName)){a=this.supportUse===false?"svg":"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(q,u,b){u=u||q._style;b=b||q._options;var l=parseFloat(q.getAttributeNS(null,"r"));var k=1;var e;if(q._geometryClass=="OpenLayers.Geometry.Point"&&l){q.style.visibility="";if(u.graphic===false){q.style.visibility="hidden"}else{if(u.externalGraphic){e=this.getPosition(q);if(u.graphicTitle){q.setAttributeNS(null,"title",u.graphicTitle)}if(u.graphicWidth&&u.graphicHeight){q.setAttributeNS(null,"preserveAspectRatio","none")}var p=u.graphicWidth||u.graphicHeight;var n=u.graphicHeight||u.graphicWidth;p=p?p:u.pointRadius*2;n=n?n:u.pointRadius*2;var v=(u.graphicXOffset!=undefined)?u.graphicXOffset:-(0.5*p);var g=(u.graphicYOffset!=undefined)?u.graphicYOffset:-(0.5*n);var a=u.graphicOpacity||u.fillOpacity;q.setAttributeNS(null,"x",(e.x+v).toFixed());q.setAttributeNS(null,"y",(e.y+g).toFixed());q.setAttributeNS(null,"width",p);q.setAttributeNS(null,"height",n);q.setAttributeNS(this.xlinkns,"href",u.externalGraphic);q.setAttributeNS(null,"style","opacity: "+a)}else{if(this.isComplexSymbol(u.graphicName)){var d=u.pointRadius*3;var m=d*2;var o=this.importSymbol(u.graphicName);e=this.getPosition(q);k=this.symbolMetrics[o][0]*3/m;var h=q.parentNode;var j=q.nextSibling;if(h){h.removeChild(q)}if(this.supportUse===false){var f=document.getElementById(o);q.firstChild&&q.removeChild(q.firstChild);q.appendChild(f.firstChild.cloneNode(true));q.setAttributeNS(null,"viewBox",f.getAttributeNS(null,"viewBox"))}else{q.setAttributeNS(this.xlinkns,"href","#"+o)}q.setAttributeNS(null,"width",m);q.setAttributeNS(null,"height",m);q.setAttributeNS(null,"x",e.x-d);q.setAttributeNS(null,"y",e.y-d);if(j){h.insertBefore(q,j)}else{if(h){h.appendChild(q)}}}else{q.setAttributeNS(null,"r",u.pointRadius)}}}var t=u.rotation;if((t!==undefined||q._rotation!==undefined)&&e){q._rotation=t;t|=0;if(q.nodeName!=="svg"){q.setAttributeNS(null,"transform","rotate("+t+" "+e.x+" "+e.y+")")}else{var s=this.symbolMetrics[o];q.firstChild.setAttributeNS(null,"transform","rotate("+u.rotation+" "+s[1]+" "+s[2]+")")}}}if(b.isFilled){q.setAttributeNS(null,"fill",u.fillColor);q.setAttributeNS(null,"fill-opacity",u.fillOpacity)}else{q.setAttributeNS(null,"fill","none")}if(b.isStroked){q.setAttributeNS(null,"stroke",u.strokeColor);q.setAttributeNS(null,"stroke-opacity",u.strokeOpacity);q.setAttributeNS(null,"stroke-width",u.strokeWidth*k);q.setAttributeNS(null,"stroke-linecap",u.strokeLinecap);q.setAttributeNS(null,"stroke-linejoin","round");q.setAttributeNS(null,"stroke-dasharray",this.dashStyle(u,k))}else{q.setAttributeNS(null,"stroke","none")}if(u.pointerEvents){q.setAttributeNS(null,"pointer-events",u.pointerEvents)}if(u.cursor!=null){q.setAttributeNS(null,"cursor",u.cursor)}return q},dashStyle:function(d,b){var a=d.strokeWidth*b;var e=d.strokeDashstyle;switch(e){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 OpenLayers.String.trim(e).replace(/\s+/g,",")}},createNode:function(a,d){var b=document.createElementNS(this.xmlns,a);if(d){b.setAttributeNS(null,"id",d)}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(e,f,b){var d=this.getResolution();var a=(f.x/d+this.left);var g=(this.top-f.y/d);if(this.inValidRange(a,g)){e.setAttributeNS(null,"cx",a);e.setAttributeNS(null,"cy",g);e.setAttributeNS(null,"r",b);return e}else{return false}},drawLineString:function(b,d){var a=this.getComponentsString(d.components);if(a.path){b.setAttributeNS(null,"points",a.path);return(a.complete?b:null)}else{return false}},drawLinearRing:function(b,d){var a=this.getComponentsString(d.components);if(a.path){b.setAttributeNS(null,"points",a.path);return(a.complete?b:null)}else{return false}},drawPolygon:function(b,l){var k="";var m=true;var a=true;var e,n;var g=l.components;var h=g.length;var f=0;if(l.path){k=l.path}else{for(f=0;f<h;f++){k+=" M";e=this.getComponentsString(g[f].components," ");n=e.path;if(n){k+=" "+n;a=e.complete&&a}else{m=false}}k+=" z"}if(m){b.setAttributeNS(null,"d",k);b.setAttributeNS(null,"fill-rule","evenodd");return a?b:null}else{return false}},drawRectangle:function(d,e){var b=this.getResolution();var a=(e.x/b+this.left);var f=(this.top-e.y/b);if(this.inValidRange(a,f)){d.setAttributeNS(null,"x",a);d.setAttributeNS(null,"y",f);d.setAttributeNS(null,"width",e.width/b);d.setAttributeNS(null,"height",e.height/b);return d}else{return false}},drawSurface:function(h,k){var j=null;var b=true;var f=this.getResolution();for(var g=0,a=k.components.length;g<a;g++){if((g%3)==0&&(g/3)==0){var e=this.getShortString(k.components[g],f);if(!e){b=false}j="M "+e}else{if((g%3)==1){var e=this.getShortString(k.components[g],f);if(!e){b=false}j+=" C "+e}else{var e=this.getShortString(k.components[g],f);if(!e){b=false}j+=" "+e}}}j+=" Z";if(b){h.setAttributeNS(null,"d",j);return h}else{return false}},drawText:function(d,a,k){var b=this.getResolution();var j=(k.x/b+this.left);var f=(k.y/b-this.top);var h=this.nodeFactory(d+this.LABEL_ID_SUFFIX,"text");var g=this.nodeFactory(d+this.LABEL_ID_SUFFIX+"_tspan","tspan");h.setAttributeNS(null,"x",j);h.setAttributeNS(null,"y",-f);if(a.fontColor){h.setAttributeNS(null,"fill",a.fontColor)}if(a.fontOpacity){h.setAttributeNS(null,"opacity",a.fontOpacity)}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)}if(a.labelSelect===true){h.setAttributeNS(null,"pointer-events","visible");h._featureId=d;g._featureId=d;g._geometry=k;g._geometryClass=k.CLASS_NAME}else{h.setAttributeNS(null,"pointer-events","none")}var e=a.labelAlign||"cm";h.setAttributeNS(null,"text-anchor",OpenLayers.Renderer.SVG.LABEL_ALIGN[e[0]]||"middle");if(this.isGecko){h.setAttributeNS(null,"dominant-baseline",OpenLayers.Renderer.SVG.LABEL_ALIGN[e[1]]||"central")}else{g.setAttributeNS(null,"baseline-shift",OpenLayers.Renderer.SVG.LABEL_VSHIFT[e[1]]||"-35%")}g.textContent=a.label;if(!h.parentNode){h.appendChild(g);this.textRoot.appendChild(h)}},getComponentsString:function(g,f){var k=[];var a=true;var h=g.length;var n=[];var l,m,d;var b=this.getResolution();for(var e=0;e<h;e++){m=g[e];k.push(m);l=this.getShortString(m,b);if(l){n.push(l)}else{if(e>0){if(this.getShortString(g[e-1],b)){n.push(this.clipLine(m,g[e-1]))}}if(e<h-1){if(this.getShortString(g[e+1],b)){n.push(this.clipLine(m,g[e+1]))}}a=false}}return{path:n.join(f||","),complete:a}},clipLine:function(f,j){if(j.equals(f)){return""}var g=this.getResolution();var b=this.MAX_PIXEL-this.translationParameters.x;var a=this.MAX_PIXEL-this.translationParameters.y;var e=j.x/g+this.left;var m=this.top-j.y/g;var d=f.x/g+this.left;var l=this.top-f.y/g;var h;if(d<-b||d>b){h=(l-m)/(d-e);d=d<0?-b:b;l=m+(d-e)*h}if(l<-a||l>a){h=(d-e)/(l-m);l=l<0?-a:a;d=e+(l-m)*h}return d+","+l},getShortString:function(b,d){var a=(b.x/d+this.left);var e=(this.top-b.y/d);if(this.inValidRange(a,e)){return a+","+e}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 e=OpenLayers.Renderer.symbol[f];if(!e){throw new Error(f+" is not a valid symbol name");return}var h=this.nodeFactory(b,"symbol");var d=this.nodeFactory(null,"polygon");h.appendChild(d);var n=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0);var l="";var k,j;for(var g=0;g<e.length;g=g+2){k=e[g];j=e[g+1];n.left=Math.min(n.left,k);n.bottom=Math.min(n.bottom,j);n.right=Math.max(n.right,k);n.top=Math.max(n.top,j);l+=" "+k+","+j}d.setAttributeNS(null,"points",l);var a=n.getWidth();var m=n.getHeight();var o=[n.left-a,n.bottom-m,a*3,m*3];h.setAttributeNS(null,"viewBox",o.join(" "));this.symbolMetrics[b]=[Math.max(a,m),n.getCenterLonLat().lon,n.getCenterLonLat().lat];this.defs.appendChild(h);return h.id},getFeatureIdFromEvent:function(a){var d=OpenLayers.Renderer.Elements.prototype.getFeatureIdFromEvent.apply(this,arguments);if(this.supportUse===false&&!d){var b=a.target;d=b.parentNode&&b!=this.rendererRoot&&b.parentNode._featureId}return d},CLASS_NAME:"OpenLayers.Renderer.SVG"});OpenLayers.Renderer.SVG.LABEL_ALIGN={l:"start",r:"end",b:"bottom",t:"hanging"};OpenLayers.Renderer.SVG.LABEL_VSHIFT={t:"-70%",b:"0"};OpenLayers.Renderer.Canvas=OpenLayers.Class(OpenLayers.Renderer,{canvas:null,features:null,geometryMap:null,initialize:function(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(e,d){var b=e.CLASS_NAME;if((b=="OpenLayers.Geometry.Collection")||(b=="OpenLayers.Geometry.MultiPoint")||(b=="OpenLayers.Geometry.MultiLineString")||(b=="OpenLayers.Geometry.MultiPolygon")){for(var a=0;a<e.components.length;a++){this.drawGeometry(e.components[a],d)}return}switch(e.CLASS_NAME){case"OpenLayers.Geometry.Point":this.drawPoint(e,d);break;case"OpenLayers.Geometry.LineString":this.drawLineString(e,d);break;case"OpenLayers.Geometry.LinearRing":this.drawLinearRing(e,d);break;case"OpenLayers.Geometry.Polygon":this.drawPolygon(e,d);break;default:break}},drawExternalGraphic:function(k,a){var f=new Image();f.src=a.externalGraphic;if(a.graphicTitle){f.title=a.graphicTitle}var d=a.graphicWidth||a.graphicHeight;var j=a.graphicHeight||a.graphicWidth;d=d?d:a.pointRadius*2;j=j?j:a.pointRadius*2;var h=(a.graphicXOffset!=undefined)?a.graphicXOffset:-(0.5*d);var e=(a.graphicYOffset!=undefined)?a.graphicYOffset:-(0.5*j);var g=a.graphicOpacity||a.fillOpacity;var b={img:f,x:(k[0]+h),y:(k[1]+e),width:d,height:j,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(d,a){if(a.graphic!==false){var b=this.getLocalXY(d);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],a.pointRadius,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],a.pointRadius,0,Math.PI*2,true);this.canvas.stroke();this.setCanvasStyle("reset")}}}},drawLineString:function(e,b){if(b.stroke!==false){this.setCanvasStyle("stroke",b);this.canvas.beginPath();var f=this.getLocalXY(e.components[0]);this.canvas.moveTo(f[0],f[1]);for(var a=1;a<e.components.length;a++){var d=this.getLocalXY(e.components[a]);this.canvas.lineTo(d[0],d[1])}this.canvas.stroke()}this.setCanvasStyle("reset")},drawLinearRing:function(f,d){if(d.fill!==false){this.setCanvasStyle("fill",d);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 e=this.getLocalXY(f.components[b]);this.canvas.lineTo(e[0],e[1])}this.canvas.fill()}if(d.stroke!==false){var a=this.canvas.lineWidth;this.setCanvasStyle("stroke",d);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 e=this.getLocalXY(f.components[b]);this.canvas.lineTo(e[0],e[1])}this.canvas.stroke()}this.setCanvasStyle("reset")},drawPolygon:function(d,b){this.drawLinearRing(d.components[0],b);for(var a=1;a<d.components.length;a++){this.drawLinearRing(d.components[a],{fillOpacity:0,strokeWidth:0,strokeOpacity:0,strokeColor:"#000000",fillColor:"#000000"})}},drawText:function(b,e){e=OpenLayers.Util.extend({fontColor:"#000000",labelAlign:"cm"},e);var f=this.getLocalXY(b);this.setCanvasStyle("reset");this.canvas.fillStyle=e.fontColor;this.canvas.globalAlpha=e.fontOpacity||1;var g=e.fontWeight+" "+e.fontSize+" "+e.fontFamily;if(this.canvas.fillText){var d=OpenLayers.Renderer.Canvas.LABEL_ALIGN[e.labelAlign[0]]||"center";this.canvas.font=g;this.canvas.textAlign=d;this.canvas.fillText(e.label,f[0],f[1])}else{if(this.canvas.mozDrawText){this.canvas.mozTextStyle=g;var a=this.canvas.mozMeasureText(e.label);switch(e.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(e.label);this.canvas.translate(-1*f[0],-1*f[1])}}this.setCanvasStyle("reset")},getLocalXY:function(b){var d=this.getResolution();var e=this.extent;var a=(b.x/d+(-e.left/d));var f=((e.top/d)-b.y/d);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 d=f.toGeometry();for(var e in this.features){if(!this.features.hasOwnProperty(e)){continue}if(this.features[e][0].geometry.intersects(d)){return e}}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,d;for(var g in this.features){if(!this.features.hasOwnProperty(g)){continue}b=this.features[g][0];d=this.features[g][1];if(!b.geometry){continue}this.drawGeometry(b.geometry,d);if(d.label){f.push([b,d])}}var e;for(var a=0;len=f.length,a<len;++a){e=f[a];this.drawText(e[0].geometry.getCentroid(),e[1])}}},CLASS_NAME:"OpenLayers.Renderer.Canvas"});OpenLayers.Renderer.Canvas.LABEL_ALIGN={l:"left",r:"right"};OpenLayers.Renderer.VML=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"urn:schemas-microsoft-com:vml",symbolCache:{},offset:null,initialize:function(b){if(!this.supported()){return}if(!document.namespaces.olv){document.namespaces.add("olv",this.xmlns);var f=document.createStyleSheet();var d=["shape","rect","oval","fill","stroke","imagedata","group","textbox"];for(var e=0,a=d.length;e<a;e++){f.addRule("olv\\:"+d[e],"behavior: url(#default#VML); position: absolute; display: inline-block;")}}OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments)},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments)},supported:function(){return !!(document.namespaces)},setExtent:function(k,a){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var d=this.getResolution();if(this.size){var b=(k.left/d)|0;var g=(k.top/d-this.size.h)|0;if(a||!this.offset){this.offset={x:b,y:g};b=0;g=0}else{b=b-this.offset.x;g=g-this.offset.y}var m=b+" "+g;this.root.coordorigin=m;var j=[this.root,this.vectorRoot,this.textRoot];var h;for(var e=0,f=j.length;e<f;++e){h=j[e];var l=this.size.w+" "+this.size.h;h.coordsize=l}this.root.style.flip="y"}return true},setSize:function(g){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);var e=[this.rendererRoot,this.root,this.vectorRoot,this.textRoot];var d=this.size.w+"px";var j=this.size.h+"px";var b;for(var f=0,a=e.length;f<a;++f){b=e[f];b.style.width=d;b.style.height=j}},getNodeType:function(d,b){var a=null;switch(d.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(n,s,a,d){s=s||n._style;a=a||n._options;var h=1;var b=s.fillColor;if(n._geometryClass==="OpenLayers.Geometry.Point"){if(s.externalGraphic){if(s.graphicTitle){n.title=s.graphicTitle}var m=s.graphicWidth||s.graphicHeight;var k=s.graphicHeight||s.graphicWidth;m=m?m:s.pointRadius*2;k=k?k:s.pointRadius*2;var p=this.getResolution();var u=(s.graphicXOffset!=undefined)?s.graphicXOffset:-(0.5*m);var f=(s.graphicYOffset!=undefined)?s.graphicYOffset:-(0.5*k);n.style.left=(((d.x/p-this.offset.x)+u)|0)+"px";n.style.top=(((d.y/p-this.offset.y)-(f+k))|0)+"px";n.style.width=m+"px";n.style.height=k+"px";n.style.flip="y";b="none";a.isStroked=false}else{if(this.isComplexSymbol(s.graphicName)){var g=this.importSymbol(s.graphicName);n.path=g.path;n.coordorigin=g.left+","+g.bottom;var j=g.size;n.coordsize=j+","+j;this.drawCircle(n,d,s.pointRadius);n.style.flip="y"}else{this.drawCircle(n,d,s.pointRadius)}}}if(a.isFilled){n.fillcolor=b}else{n.filled="false"}var l=n.getElementsByTagName("fill");var q=(l.length==0)?null:l[0];if(!a.isFilled){if(q){n.removeChild(q)}}else{if(!q){q=this.createNode("olv:fill",n.id+"_fill")}q.opacity=s.fillOpacity;if(n._geometryClass==="OpenLayers.Geometry.Point"&&s.externalGraphic){if(s.graphicOpacity){q.opacity=s.graphicOpacity}q.src=s.externalGraphic;q.type="frame";if(!(s.graphicWidth&&s.graphicHeight)){q.aspect="atmost"}}if(q.parentNode!=n){n.appendChild(q)}}var o=s.rotation;if(o!==n._rotation){n._rotation=o;if(s.externalGraphic){this.graphicRotate(n,u,f,s);q.opacity=0}else{if(n._geometryClass==="OpenLayers.Geometry.Point"){n.style.rotation=o||0}}}if(a.isStroked){n.strokecolor=s.strokeColor;n.strokeweight=s.strokeWidth+"px"}else{n.stroked=false}var t=n.getElementsByTagName("stroke");var e=(t.length==0)?null:t[0];if(!a.isStroked){if(e){n.removeChild(e)}}else{if(!e){e=this.createNode("olv:stroke",n.id+"_stroke");n.appendChild(e)}e.opacity=s.strokeOpacity;e.endcap=!s.strokeLinecap||s.strokeLinecap=="butt"?"flat":s.strokeLinecap;e.dashstyle=this.dashStyle(s)}if(s.cursor!="inherit"&&s.cursor!=null){n.style.cursor=s.cursor}return n},graphicRotate:function(q,v,g,u){var u=u||q._style;var e=q._options;var t=u.rotation||0;var a,m;if(!(u.graphicWidth&&u.graphicHeight)){var w=new Image();w.onreadystatechange=OpenLayers.Function.bind(function(){if(w.readyState=="complete"||w.readyState=="interactive"){a=w.width/w.height;m=Math.max(u.pointRadius*2,u.graphicWidth||0,u.graphicHeight||0);v=v*a;u.graphicWidth=m*a;u.graphicHeight=m;this.graphicRotate(q,v,g,u)}},this);w.src=u.externalGraphic;return}else{m=Math.max(u.graphicWidth,u.graphicHeight);a=u.graphicWidth/u.graphicHeight}var p=Math.round(u.graphicWidth||m*a);var n=Math.round(u.graphicHeight||m);q.style.width=p+"px";q.style.height=n+"px";var o=document.getElementById(q.id+"_image");if(!o){o=this.createNode("olv:imagedata",q.id+"_image");q.appendChild(o)}o.style.width=p+"px";o.style.height=n+"px";o.src=u.externalGraphic;o.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='', sizingMethod='scale')";var h=t*Math.PI/180;var k=Math.sin(h);var f=Math.cos(h);var j="progid:DXImageTransform.Microsoft.Matrix(M11="+f+",M12="+(-k)+",M21="+k+",M22="+f+",SizingMethod='auto expand')\n";var b=u.graphicOpacity||u.fillOpacity;if(b&&b!=1){j+="progid:DXImageTransform.Microsoft.BasicImage(opacity="+b+")\n"}q.style.filter=j;var s=new OpenLayers.Geometry.Point(-v,-g);var d=new OpenLayers.Bounds(0,0,p,n).toGeometry();d.rotate(u.rotation,s);var l=d.getBounds();q.style.left=Math.round(parseInt(q.style.left)+l.left)+"px";q.style.top=Math.round(parseInt(q.style.top)-l.bottom)+"px"},postDraw:function(a){a.style.visibility="visible";var d=a._style.fillColor;var b=a._style.strokeColor;if(d=="none"&&a.fillcolor!=d){a.fillcolor=d}if(b=="none"&&a.strokecolor!=b){a.strokecolor=b}},setNodeDimension:function(b,f){var e=f.getBounds();if(e&&this.offset){var a=this.getResolution();var d=new OpenLayers.Bounds((e.left/a-this.offset.x)|0,(e.bottom/a-this.offset.y)|0,(e.right/a-this.offset.x)|0,(e.top/a-this.offset.y)|0);b.style.left=d.left+"px";b.style.top=d.top+"px";b.style.width=d.getWidth()+"px";b.style.height=d.getHeight()+"px";b.coordorigin=d.left+" "+d.top;b.coordsize=d.getWidth()+" "+d.getHeight()}},dashStyle:function(a){var d=a.strokeDashstyle;switch(d){case"solid":case"dot":case"dash":case"dashdot":case"longdash":case"longdashdot":return d;default:var b=d.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,d){var b=document.createElement(a);if(d){b.id=d}b.unselectable="on";b.onselectstart=OpenLayers.Function.False;return b},nodeTypeCompare:function(d,b){var e=b;var a=e.indexOf(":");if(a!=-1){e=e.substr(a+1)}var f=d.nodeName;a=f.indexOf(":");if(a!=-1){f=f.substr(a+1)}return(e==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(e,f,a){if(!isNaN(f.x)&&!isNaN(f.y)){var b=this.getResolution();e.style.left=(((f.x/b-this.offset.x)|0)-a)+"px";e.style.top=(((f.y/b-this.offset.y)|0)-a)+"px";var d=a*2;e.style.width=d+"px";e.style.height=d+"px";return e}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,l,h){this.setNodeDimension(b,l);var d=this.getResolution();var a=l.components.length;var f=new Array(a);var j,m,k;for(var g=0;g<a;g++){j=l.components[g];m=(j.x/d-this.offset.x)|0;k=(j.y/d-this.offset.y)|0;f[g]=" "+m+","+k+" l "}var e=(h)?" x e":" e";b.path="m"+f.join("")+e;return b},drawPolygon:function(b,m){this.setNodeDimension(b,m);if(m.path){b.path=m.path}else{var d=this.getResolution();var o=[];var g,f,e,k,a,h,n,l;for(e=0,k=m.components.length;e<k;e++){g=m.components[e];o.push("m");for(f=0,a=g.components.length;f<a;f++){h=g.components[f];n=(h.x/d-this.offset.x)|0;l=(h.y/d-this.offset.y)|0;o.push(" "+n+","+l);if(f==0){o.push(" l")}}o.push(" x ")}o.push("e");b.path=o.join("")}return b},drawRectangle:function(b,d){var a=this.getResolution();b.style.left=((d.x/a-this.offset.x)|0)+"px";b.style.top=((d.y/a-this.offset.y)|0)+"px";b.style.width=((d.width/a)|0)+"px";b.style.height=((d.height/a)|0)+"px";return b},drawText:function(e,a,j){var h=this.nodeFactory(e+this.LABEL_ID_SUFFIX,"olv:rect");var g=this.nodeFactory(e+this.LABEL_ID_SUFFIX+"_textbox","olv:textbox");var d=this.getResolution();h.style.left=((j.x/d-this.offset.x)|0)+"px";h.style.top=((j.y/d-this.offset.y)|0)+"px";h.style.flip="y";g.innerText=a.label;if(a.fontColor){g.style.color=a.fontColor}if(a.fontOpacity){g.style.filter="alpha(opacity="+(a.fontOpacity*100)+")"}if(a.fontFamily){g.style.fontFamily=a.fontFamily}if(a.fontSize){g.style.fontSize=a.fontSize}if(a.fontWeight){g.style.fontWeight=a.fontWeight}if(a.labelSelect===true){h._featureId=e;g._featureId=e;g._geometry=j;g._geometryClass=j.CLASS_NAME}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 k=g.clientWidth*(OpenLayers.Renderer.VML.LABEL_SHIFT[f[0]||"c"]);var b=g.clientHeight*(OpenLayers.Renderer.VML.LABEL_SHIFT[f[1]||"m"]);h.style.left=parseInt(h.style.left)-k-1+"px";h.style.top=parseInt(h.style.top)+b+"px"},drawSurface:function(a,h){this.setNodeDimension(a,h);var b=this.getResolution();var k=[];var e,j,g;for(var d=0,f=h.components.length;d<f;d++){e=h.components[d];j=(e.x/b-this.offset.x)|0;g=(e.y/b-this.offset.y)|0;if((d%3)==0&&(d/3)==0){k.push("m")}else{if((d%3)==1){k.push(" c")}}k.push(" "+j+","+g)}k.push(" x e");a.path=k.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(e){var b=this.container.id+"-"+e;var a=this.symbolCache[b];if(a){return a}var d=OpenLayers.Renderer.symbol[e];if(!d){throw new Error(e+" is not a valid symbol name");return}var l=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0);var f=["m"];for(var g=0;g<d.length;g=g+2){var j=d[g];var h=d[g+1];l.left=Math.min(l.left,j);l.bottom=Math.min(l.bottom,h);l.right=Math.max(l.right,j);l.top=Math.max(l.top,h);f.push(j);f.push(h);if(g==0){f.push("l")}}f.push("x e");var m=f.join(" ");var k=(l.getWidth()-l.getHeight())/2;if(k>0){l.bottom=l.bottom-k;l.top=l.top+k}else{l.left=l.left+k;l.right=l.right-k}a={path:m,size:l.getWidth(),left:l.left,bottom:l.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.Layer.Vector=OpenLayers.Class(OpenLayers.Layer,{EVENT_TYPES:["beforefeatureadded","beforefeaturesadded","featureadded","featuresadded","beforefeatureremoved","featureremoved","featuresremoved","beforefeatureselected","featureselected","featureunselected","beforefeaturemodified","featuremodified","afterfeaturemodified","vertexmodified","sketchstarted","sketchmodified","sketchcomplete","refresh"],isBaseLayer:false,isFixed:false,isVector:true,features:null,filter:null,selectedFeatures:null,unrenderedFeatures:null,reportError:true,style:null,styleMap:null,strategies:null,protocol:null,renderers:["SVG","VML","Canvas"],renderer:null,rendererOptions:null,geometryType:null,drawn:false,initialize:function(d,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 e=0,a=this.strategies.length;e<a;e++){this.strategies[e].setLayer(this)}}},destroy:function(){if(this.strategies){var d,b,a;for(b=0,a=this.strategies.length;b<a;b++){d=this.strategies[b];if(d.autoDestroy){d.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)},clone:function(f){if(f==null){f=new OpenLayers.Layer.Vector(this.name,this.getOptions())}f=OpenLayers.Layer.prototype.clone.apply(this,[f]);var d=this.features;var a=d.length;var e=new Array(a);for(var b=0;b<a;++b){e[b]=d[b].clone()}f.features=e;return f},refresh:function(a){if(this.calculateInRange()&&this.visibility){this.events.triggerEvent("refresh",a)}},assignRenderer:function(){for(var d=0,a=this.renderers.length;d<a;d++){var b=OpenLayers.Renderer[this.renderers[d]];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(b){OpenLayers.Layer.prototype.setMap.apply(this,arguments);if(!this.renderer){this.map.removeLayer(this)}else{this.renderer.map=this.map;var a=this.map.getSize();if(a){this.renderer.setSize(this.map.getSize())}}},afterAdd:function(){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.activate()}}}},removeMap:function(d){if(this.strategies){var e,b,a;for(b=0,a=this.strategies.length;b<a;b++){e=this.strategies[b];if(e.autoActivate){e.deactivate()}}}},onMapResize:function(){OpenLayers.Layer.prototype.onMapResize.apply(this,arguments);this.renderer.setSize(this.map.getSize())},moveTo:function(h,b,j){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);var f=true;if(!j){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 e in this.unrenderedFeatures){var d=this.unrenderedFeatures[e];this.drawFeature(d)}}}if(!this.drawn||b||!f){this.drawn=true;var d;for(var e=0,a=this.features.length;e<a;e++){this.renderer.locked=(e!==(a-1));d=this.features[e];this.drawFeature(d)}}},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,k){if(!(b instanceof Array)){b=[b]}var h=!k||!k.silent;if(h){var a={features:b};var g=this.events.triggerEvent("beforefeaturesadded",a);if(g===false){return}b=a.features}for(var d=0,f=b.length;d<f;d++){if(d!=(b.length-1)){this.renderer.locked=true}else{this.renderer.locked=false}var j=b[d];if(this.geometryType&&!(j.geometry instanceof this.geometryType)){var e=OpenLayers.i18n("componentShouldBe",{geomType:this.geometryType.prototype.CLASS_NAME});throw e}this.features.push(j);j.layer=this;if(!j.style&&this.style){j.style=OpenLayers.Util.extend({},this.style)}if(h){if(this.events.triggerEvent("beforefeatureadded",{feature:j})===false){continue}this.preFeatureInsert(j)}this.drawFeature(j);if(h){this.events.triggerEvent("featureadded",{feature:j});this.onFeatureInsert(j)}}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===this.selectedFeatures){f=f.slice()}var e=!a||!a.silent;for(var d=f.length-1;d>=0;d--){if(d!=0&&f[d-1].geometry){this.renderer.locked=true}else{this.renderer.locked=false}var b=f[d];delete this.unrenderedFeatures[b.id];if(e){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(e){this.events.triggerEvent("featureremoved",{feature:b})}}if(e){this.events.triggerEvent("featuresremoved",{features:f})}},destroyFeatures:function(e,a){var d=(e==undefined);if(d){e=this.features}if(e){this.removeFeatures(e,a);for(var b=e.length-1;b>=0;b--){e[b].destroy()}}},drawFeature:function(a,b){if(!this.drawn){return}if(typeof b!="object"){if(!b&&a.state===OpenLayers.State.DELETE){b="delete"}var d=b||a.renderIntent;b=a.style||this.style;if(!b){b=this.styleMap.createSymbolizer(a,d)}}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(e){var d=null;for(var b=0,a=this.features.length;b<a;++b){if(this.features[b].id==e){d=this.features[b];break}}return d},onFeatureInsert:function(a){},preFeatureInsert:function(a){},getDataExtent:function(){var b=null;var e=this.features;if(e&&(e.length>0)){b=new OpenLayers.Bounds();var f=null;for(var d=0,a=e.length;d<a;d++){f=e[d].geometry;if(f){b.extend(f.getBounds())}}}return b},CLASS_NAME:"OpenLayers.Layer.Vector"});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 e=this.layers;var d;for(var b=0;b<e.length;b++){d=e[b].getFeatureFromEvent(a);if(d){return d}}},addLayer:function(a){this.layers.push(a);this.collectRoots()},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.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.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,filter:this.layer.filter,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 e=this.layer.map.getProjectionObject();if(!e.equals(g)){var d;for(var b=0,a=f.length;b<a;++b){d=f[b].geometry;if(d){d.transform(g,e)}}}this.layer.addFeatures(f)}this.layer.events.triggerEvent("loadend")},CLASS_NAME:"OpenLayers.Strategy.Fixed"});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 d=this.layer.map.getResolution();if(d!=this.resolution||!this.clustersExist()){this.resolution=d;var k=[];var n,b,l;for(var f=0;f<this.features.length;++f){n=this.features[f];if(n.geometry){b=false;for(var e=0;e<k.length;++e){l=k[e];if(this.shouldCluster(l,n)){this.addToCluster(l,n);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 m;for(var f=0,g=h.length;f<g;++f){m=h[f];if(m.attributes.count<this.threshold){Array.prototype.push.apply(k,m.cluster)}else{k.push(m)}}}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 d=b.geometry.getBounds().getCenterLonLat();var e=(Math.sqrt(Math.pow((f.lon-d.lon),2)+Math.pow((f.lat-d.lat),2))/this.resolution);return(e<=this.distance)},addToCluster:function(a,b){a.cluster.push(b);a.attributes.count+=1},createCluster:function(d){var b=d.geometry.getBounds().getCenterLonLat();var a=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(b.lon,b.lat),{count:1});a.cluster=[d];return a},CLASS_NAME:"OpenLayers.Strategy.Cluster"});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 d=(this.num+1)*this.length;b=this.page(d,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,d){var e=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(d&&d.features){d.features=b}else{this.layer.addFeatures(b)}this.paging=false;e=true}}}return e},CLASS_NAME:"OpenLayers.Strategy.Paging"});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 d=!this.bounds||!this.bounds.containsBounds(a);if(!d&&this.resFactor){var b=this.resolution/this.layer.map.getResolution();d=(b>=this.resFactor||b<=(1/this.resFactor))}return d},calculateBounds:function(b){if(!b){b=this.getMapBounds()}var a=b.getCenterLonLat();var e=b.getWidth()*this.ratio;var d=b.getHeight()*this.ratio;this.bounds=new OpenLayers.Bounds(a.lon-(e/2),a.lat-(d/2),a.lon+(e/2),a.lat+(d/2))},triggerRead:function(){if(this.response){this.layer.protocol.abort(this.response);this.layer.events.triggerEvent("loadend")}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 e=this.layer.map.getProjectionObject();if(!e.equals(g)){var d;for(var b=0,a=f.length;b<a;++b){d=f[b].geometry;if(d){d.transform(g,e)}}}this.layer.addFeatures(f)}this.response=null;this.layer.events.triggerEvent("loadend")},CLASS_NAME:"OpenLayers.Strategy.BBOX"});OpenLayers.Strategy.Save=OpenLayers.Class(OpenLayers.Strategy,{EVENT_TYPES:["start","success","fail"],events:null,auto:false,timer:null,initialize:function(a){OpenLayers.Strategy.prototype.initialize.apply(this,[a]);this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES)},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(e){if(!e){e=this.layer.features}this.events.triggerEvent("start",{features:e});var g=this.layer.projection;var d=this.layer.map.getProjectionObject();if(!d.equals(g)){var a=e.length;var f=new Array(a);var j,h;for(var b=0;b<a;++b){j=e[b];h=j.clone();h.fid=j.fid;h.state=j.state;if(j.url){h.url=j.url}h._original=j;h.geometry.transform(d,g);f[b]=h}e=f}this.layer.protocol.commit(e,{callback:this.onCommit,scope:this})},onCommit:function(e){var l={response:e};if(e.success()){var b=e.reqFeatures;var a,m;var d=[];var k=e.insertIds||[];var f=0;for(var g=0,h=b.length;g<h;++g){m=b[g];m=m._original||m;a=m.state;if(a){if(a==OpenLayers.State.DELETE){d.push(m)}else{if(a==OpenLayers.State.INSERT){m.fid=k[f];++f}}m.state=null}}if(d.length>0){this.layer.destroyFeatures(d)}this.events.triggerEvent("success",l)}else{this.events.triggerEvent("fail",l)}},CLASS_NAME:"OpenLayers.Strategy.Save"});OpenLayers.Strategy.Refresh=OpenLayers.Class(OpenLayers.Strategy,{force:false,interval:0,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.layer.visibility===true){this.start()}this.layer.events.on({visibilitychanged:this.reset,scope:this})}return a},deactivate:function(){var a=OpenLayers.Strategy.prototype.deactivate.call(this);if(a){this.stop()}return a},reset:function(){if(this.layer.visibility===true){this.start()}else{this.stop()}},start:function(){if(this.interval&&typeof this.interval==="number"&&this.interval>0){this.timer=window.setInterval(OpenLayers.Function.bind(this.refresh,this),this.interval)}},refresh:function(){if(this.layer&&this.layer.refresh&&typeof this.layer.refresh=="function"){this.layer.refresh({force:this.force})}},stop:function(){if(this.timer!==null){window.clearInterval(this.timer);this.timer=null}},CLASS_NAME:"OpenLayers.Strategy.Refresh"});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.Filter.FeatureId=OpenLayers.Class(OpenLayers.Filter,{fids:null,initialize:function(a){this.fids=[];OpenLayers.Filter.prototype.initialize.apply(this,[a])},evaluate:function(d){for(var b=0,a=this.fids.length;b<a;b++){var e=d.fid||d.id;if(e==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(d){switch(this.type){case OpenLayers.Filter.Logical.AND:for(var b=0,a=this.filters.length;b<a;b++){if(this.filters[b].evaluate(d)==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(d)==true){return true}}return false;case OpenLayers.Filter.Logical.NOT:return(!this.filters[0].evaluate(d))}},clone:function(){var d=[];for(var b=0,a=this.filters.length;b<a;++b){d.push(this.filters[b].clone())}return new OpenLayers.Filter.Logical({type:this.type,filters:d})},CLASS_NAME:"OpenLayers.Filter.Logical"});OpenLayers.Filter.Logical.AND="&&";OpenLayers.Filter.Logical.OR="||";OpenLayers.Filter.Logical.NOT="!";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(d){var a=false;switch(this.type){case OpenLayers.Filter.Comparison.EQUAL_TO:var b=d[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=d[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=d[this.property]<this.value;break;case OpenLayers.Filter.Comparison.GREATER_THAN:a=d[this.property]>this.value;break;case OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO:a=d[this.property]<=this.value;break;case OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO:a=d[this.property]>=this.value;break;case OpenLayers.Filter.Comparison.BETWEEN:a=(d[this.property]>=this.lowerBoundary)&&(d[this.property]<=this.upperBoundary);break;case OpenLayers.Filter.Comparison.LIKE:var e=new RegExp(this.value,"gi");a=e.test(d[this.property]);break}return a},value2regex:function(e,b,a){if(e=="."){var d="'.' is an unsupported wildCard character for OpenLayers.Filter.Comparison";OpenLayers.Console.error(d);return null}e=e?e:"*";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("\\"+e,"g"),".*");this.value=this.value.replace(new RegExp("\\\\.\\*","g"),"\\"+e);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(d,b){return b?d:"!."});a=a.replace(/(\\)?\\\*/g,function(d,b){return b?d:"!*"});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.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(d){var a=false;switch(this.type){case OpenLayers.Filter.Spatial.BBOX:case OpenLayers.Filter.Spatial.INTERSECTS:if(d.geometry){var b=this.value;if(this.value.CLASS_NAME=="OpenLayers.Bounds"){b=this.value.toGeometry()}if(d.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.Protocol=OpenLayers.Class({format:null,options:null,autoDestroy:true,defaultFilter:null,initialize:function(a){a=a||{};OpenLayers.Util.extend(this,a);this.options=a},mergeWithDefaultFilter:function(a){if(a){if(this.defaultFilter){a=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.AND,filters:[this.defaultFilter,a]})}}else{a=this.defaultFilter}return a},destroy:function(){this.options=null;this.format=null},read:function(a){a=a||{};a.filter=this.mergeWithDefaultFilter(a.filter)},create:function(){},update:function(){},"delete":function(){},commit:function(){},abort:function(a){},createCallback:function(d,a,b){return OpenLayers.Function.bind(function(){d.apply(this,[a,b])},this)},CLASS_NAME:"OpenLayers.Protocol"});OpenLayers.Protocol.Response=OpenLayers.Class({code:null,requestType:null,last:true,features:null,reqFeatures:null,priv:null,initialize:function(a){OpenLayers.Util.extend(this,a)},success:function(){return this.code>0},CLASS_NAME:"OpenLayers.Protocol.Response"});OpenLayers.Protocol.Response.SUCCESS=1;OpenLayers.Protocol.Response.FAILURE=0;OpenLayers.Protocol.HTTP=OpenLayers.Class(OpenLayers.Protocol,{url:null,headers:null,params:null,callback:null,scope:null,readWithPOST:false,wildcarded:false,initialize:function(a){a=a||{};this.params={};this.headers={};OpenLayers.Protocol.prototype.initialize.apply(this,arguments)},destroy:function(){this.params=null;this.headers=null;OpenLayers.Protocol.prototype.destroy.apply(this)},read:function(a){OpenLayers.Protocol.prototype.read.apply(this,arguments);a=OpenLayers.Util.applyDefaults(a,this.options);a.params=OpenLayers.Util.applyDefaults(a.params,this.options.params);if(a.filter){a.params=this.filterToParams(a.filter,a.params)}var b=(a.readWithPOST!==undefined)?a.readWithPOST:this.readWithPOST;var d=new OpenLayers.Protocol.Response({requestType:"read"});if(b){d.priv=OpenLayers.Request.POST({url:a.url,callback:this.createCallback(this.handleRead,d,a),data:OpenLayers.Util.getParameterString(a.params),headers:{"Content-Type":"application/x-www-form-urlencoded"}})}else{d.priv=OpenLayers.Request.GET({url:a.url,callback:this.createCallback(this.handleRead,d,a),params:a.params,headers:a.headers})}return d},handleRead:function(b,a){this.handleResponse(b,a)},filterToParams:function(e,h){h=h||{};var d=e.CLASS_NAME;var f=d.substring(d.lastIndexOf(".")+1);switch(f){case"Spatial":switch(e.type){case OpenLayers.Filter.Spatial.BBOX:h.bbox=e.value.toArray();break;case OpenLayers.Filter.Spatial.DWITHIN:h.tolerance=e.distance;case OpenLayers.Filter.Spatial.WITHIN:h.lon=e.value.x;h.lat=e.value.y;break;default:OpenLayers.Console.warn("Unknown spatial filter type "+e.type)}break;case"Comparison":var j=OpenLayers.Protocol.HTTP.COMP_TYPE_TO_OP_STR[e.type];if(j!==undefined){var g=e.value;if(e.type==OpenLayers.Filter.Comparison.LIKE){g=this.regex2value(g);if(this.wildcarded){g="%"+g+"%"}}h[e.property+"__"+j]=g;h.queryable=h.queryable||[];h.queryable.push(e.property)}else{OpenLayers.Console.warn("Unknown comparison filter type "+e.type)}break;case"Logical":if(e.type===OpenLayers.Filter.Logical.AND){for(var b=0,a=e.filters.length;b<a;b++){h=this.filterToParams(e.filters[b],h)}}else{OpenLayers.Console.warn("Unsupported logical filter type "+e.type)}break;default:OpenLayers.Console.warn("Unknown filter type "+f)}return h},regex2value:function(a){a=a.replace(/%/g,"\\%");a=a.replace(/\\\\\.(\*)?/g,function(d,b){return b?d:"\\\\_"});a=a.replace(/\\\\\.\*/g,"\\\\%");a=a.replace(/(\\)?\.(\*)?/g,function(d,b,e){return b||e?d:"_"});a=a.replace(/(\\)?\.\*/g,function(d,b){return b?d:"%"});a=a.replace(/\\\./g,".");a=a.replace(/(\\)?\\\*/g,function(d,b){return b?d:"*"});return a},create:function(b,a){a=OpenLayers.Util.applyDefaults(a,this.options);var d=new OpenLayers.Protocol.Response({reqFeatures:b,requestType:"create"});d.priv=OpenLayers.Request.POST({url:a.url,callback:this.createCallback(this.handleCreate,d,a),headers:a.headers,data:this.format.write(b)});return d},handleCreate:function(b,a){this.handleResponse(b,a)},update:function(d,b){b=b||{};var a=b.url||d.url||this.options.url+"/"+d.fid;b=OpenLayers.Util.applyDefaults(b,this.options);var e=new OpenLayers.Protocol.Response({reqFeatures:d,requestType:"update"});e.priv=OpenLayers.Request.PUT({url:a,callback:this.createCallback(this.handleUpdate,e,b),headers:b.headers,data:this.format.write(d)});return e},handleUpdate:function(b,a){this.handleResponse(b,a)},"delete":function(d,b){b=b||{};var a=b.url||d.url||this.options.url+"/"+d.fid;b=OpenLayers.Util.applyDefaults(b,this.options);var e=new OpenLayers.Protocol.Response({reqFeatures:d,requestType:"delete"});e.priv=OpenLayers.Request.DELETE({url:a,callback:this.createCallback(this.handleDelete,e,b),headers:b.headers});return e},handleDelete:function(b,a){this.handleResponse(b,a)},handleResponse:function(d,a){var b=d.priv;if(a.callback){if(b.status>=200&&b.status<300){if(d.requestType!="delete"){d.features=this.parseFeatures(b)}d.code=OpenLayers.Protocol.Response.SUCCESS}else{d.code=OpenLayers.Protocol.Response.FAILURE}a.callback.call(a.scope,d)}},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,s){s=OpenLayers.Util.applyDefaults(s,this.options);var e=[],n=0;var l={};l[OpenLayers.State.INSERT]=[];l[OpenLayers.State.UPDATE]=[];l[OpenLayers.State.DELETE]=[];var q,m,d=[];for(var f=0,k=b.length;f<k;++f){q=b[f];m=l[q.state];if(m){m.push(q);d.push(q)}}var h=(l[OpenLayers.State.INSERT].length>0?1:0)+l[OpenLayers.State.UPDATE].length+l[OpenLayers.State.DELETE].length;var p=true;var a=new OpenLayers.Protocol.Response({reqFeatures:d});function j(u){var t=u.features?u.features.length:0;var w=new Array(t);for(var v=0;v<t;++v){w[v]=u.features[v].fid}a.insertIds=w;o.apply(this,[u])}function o(t){this.callUserCallback(t,s);p=p&&t.success();n++;if(n>=h){if(s.callback){a.code=p?OpenLayers.Protocol.Response.SUCCESS:OpenLayers.Protocol.Response.FAILURE;s.callback.apply(s.scope,[a])}}}var g=l[OpenLayers.State.INSERT];if(g.length>0){e.push(this.create(g,OpenLayers.Util.applyDefaults({callback:j,scope:this},s.create)))}g=l[OpenLayers.State.UPDATE];for(var f=g.length-1;f>=0;--f){e.push(this.update(g[f],OpenLayers.Util.applyDefaults({callback:o,scope:this},s.update)))}g=l[OpenLayers.State.DELETE];for(var f=g.length-1;f>=0;--f){e.push(this["delete"](g[f],OpenLayers.Util.applyDefaults({callback:o,scope:this},s["delete"])))}return e},abort:function(a){if(a){a.priv.abort()}},callUserCallback:function(d,a){var b=a[d.requestType];if(b&&b.callback){b.callback.call(b.scope,d)}},CLASS_NAME:"OpenLayers.Protocol.HTTP"});(function(){var a=OpenLayers.Protocol.HTTP.COMP_TYPE_TO_OP_STR={};a[OpenLayers.Filter.Comparison.EQUAL_TO]="eq";a[OpenLayers.Filter.Comparison.NOT_EQUAL_TO]="ne";a[OpenLayers.Filter.Comparison.LESS_THAN]="lt";a[OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO]="lte";a[OpenLayers.Filter.Comparison.GREATER_THAN]="gt";a[OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO]="gte";a[OpenLayers.Filter.Comparison.LIKE]="ilike"})();OpenLayers.Layer.GML=OpenLayers.Class(OpenLayers.Layer.Vector,{loaded:false,format:null,formatOptions:null,initialize:function(e,d,b){var a=[];a.push(e,b);OpenLayers.Layer.Vector.prototype.initialize.apply(this,a);this.url=d},setVisibility:function(a,b){OpenLayers.Layer.Vector.prototype.setVisibility.apply(this,arguments);if(this.visibility&&!this.loaded){this.loadGML()}},moveTo:function(d,a,b){OpenLayers.Layer.Vector.prototype.moveTo.apply(this,arguments);if(this.visibility&&!this.loaded){this.loadGML()}},loadGML:function(){if(!this.loaded){this.events.triggerEvent("loadstart");OpenLayers.Request.GET({url:this.url,success:this.requestSuccess,failure:this.requestFailure,scope:this});this.loaded=true}},setUrl:function(a){this.url=a;this.destroyFeatures();this.loaded=false;this.loadGML()},requestSuccess:function(d){var e=d.responseXML;if(!e||!e.documentElement){e=d.responseText}var a={};OpenLayers.Util.extend(a,this.formatOptions);if(this.map&&!this.projection.equals(this.map.getProjectionObject())){a.externalProjection=this.projection;a.internalProjection=this.map.getProjectionObject()}var b=this.format?new this.format(a):new OpenLayers.Format.GML(a);this.addFeatures(b.read(e));this.events.triggerEvent("loadend")},requestFailure:function(a){OpenLayers.Console.userError(OpenLayers.i18n("errorLoadingGML",{url:this.url}));this.events.triggerEvent("loadend")},CLASS_NAME:"OpenLayers.Layer.GML"});OpenLayers.Style=OpenLayers.Class({name:null,title:null,description:null,layerName:null,isDefault:false,rules:null,context:null,defaultStyle:null,defaultsPerSymbolizer:false,propertyStyles:null,initialize:function(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(l){var a=this.defaultsPerSymbolizer?{}:this.createLiterals(OpenLayers.Util.extend({},this.defaultStyle),l);var k=this.rules;var j,b;var d=[];var g=false;for(var e=0,f=k.length;e<f;e++){j=k[e];var h=j.evaluate(l);if(h){if(j instanceof OpenLayers.Rule&&j.elseFilter){d.push(j)}else{g=true;this.applySymbolizer(j,a,l)}}}if(g==false&&d.length>0){g=true;for(var e=0,f=d.length;e<f;e++){this.applySymbolizer(d[e],a,l)}}if(k.length>0&&g==false){a.display="none"}return a},applySymbolizer:function(g,e,b){var a=b.geometry?this.getSymbolizerPrefix(b.geometry):OpenLayers.Style.SYMBOLIZER_PREFIXES[0];var d=g.symbolizer[a]||g.symbolizer;if(this.defaultsPerSymbolizer===true){var f=this.defaultStyle;OpenLayers.Util.applyDefaults(d,{pointRadius:f.pointRadius});if(d.stroke===true||d.graphic===true){OpenLayers.Util.applyDefaults(d,{strokeWidth:f.strokeWidth,strokeColor:f.strokeColor,strokeOpacity:f.strokeOpacity,strokeDashstyle:f.strokeDashstyle,strokeLinecap:f.strokeLinecap})}if(d.fill===true||d.graphic===true){OpenLayers.Util.applyDefaults(d,{fillColor:f.fillColor,fillOpacity:f.fillOpacity})}if(d.graphic===true){OpenLayers.Util.applyDefaults(d,{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(e,d),b)},createLiterals:function(e,d){var b=OpenLayers.Util.extend({},d.attributes||d.data);OpenLayers.Util.extend(b,this.context);for(var a in this.propertyStyles){e[a]=OpenLayers.Style.createLiteral(e[a],b,d,a)}return e},findPropertyStyles:function(){var e={};var g=this.defaultStyle;this.addPropertyStyles(e,g);var j=this.rules;var f,h;for(var d=0,a=j.length;d<a;d++){f=j[d].symbolizer;for(var b in f){h=f[b];if(typeof h=="object"){this.addPropertyStyles(e,h)}else{this.addPropertyStyles(e,f);break}}}return e},addPropertyStyles:function(b,d){var e;for(var a in d){e=d[a];if(typeof e=="string"&&e.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(e){var d=OpenLayers.Style.SYMBOLIZER_PREFIXES;for(var b=0,a=d.length;b<a;b++){if(e.CLASS_NAME.indexOf(d[b])!=-1){return d[b]}}},CLASS_NAME:"OpenLayers.Style"});OpenLayers.Style.createLiteral=function(e,b,a,d){if(typeof e=="string"&&e.indexOf("${")!=-1){e=OpenLayers.String.format(e,b,[a,d]);e=(isNaN(e)||!e)?e:parseFloat(e)}return e};OpenLayers.Style.SYMBOLIZER_PREFIXES=["Point","Line","Polygon","Text"];OpenLayers.StyleMap=OpenLayers.Class({styles:null,extendDefault:true,initialize:function(d,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(d instanceof OpenLayers.Style){this.styles["default"]=d;this.styles.select=d;this.styles.temporary=d;this.styles["delete"]=d}else{if(typeof d=="object"){for(var b in d){if(d[b] instanceof OpenLayers.Style){this.styles[b]=d[b]}else{if(typeof d[b]=="object"){this.styles[b]=new OpenLayers.Style(d[b])}else{this.styles["default"]=new OpenLayers.Style(d);this.styles.select=new OpenLayers.Style(d);this.styles.temporary=new OpenLayers.Style(d);this.styles["delete"]=new OpenLayers.Style(d);break}}}}}OpenLayers.Util.extend(this,a)},destroy:function(){for(var a in this.styles){this.styles[a].destroy()}this.styles=null},createSymbolizer:function(b,d){if(!b){b=new OpenLayers.Feature.Vector()}if(!this.styles[d]){d="default"}b.renderIntent=d;var a={};if(this.extendDefault&&d!="default"){a=this.styles["default"].createSymbolizer(b)}return OpenLayers.Util.extend(a,this.styles[d].createSymbolizer(b))},addUniqueValueRules:function(b,e,g,a){var f=[];for(var d in g){f.push(new OpenLayers.Rule({symbolizer:g[d],context:a,filter:new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.EQUAL_TO,property:e,value:d})}))}this.styles[b].addRules(f)},CLASS_NAME:"OpenLayers.StyleMap"});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(d){var b=this.getContext(d);var a=true;if(this.minScaleDenominator||this.maxScaleDenominator){var e=d.layer.map.getScale()}if(this.minScaleDenominator){a=e>=OpenLayers.Style.createLiteral(this.minScaleDenominator,b)}if(a&&this.maxScaleDenominator){a=e<OpenLayers.Style.createLiteral(this.maxScaleDenominator,b)}if(a&&this.filter){if(this.filter.CLASS_NAME=="OpenLayers.Filter.FeatureId"){a=this.filter.evaluate(d)}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.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.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(l){var a=l.split("\n");var b;var h=[];for(var w=0;w<(a.length-1);w++){var v=a[w].replace(/^\s*/,"").replace(/\s*$/,"");if(v.charAt(0)!="#"){if(!b){b=v.split("\t")}else{var n=v.split("\t");var e=new OpenLayers.Geometry.Point(0,0);var j={};var s=this.defaultStyle?OpenLayers.Util.applyDefaults({},this.defaultStyle):null;var t,u,d,p;var m=false;for(var k=0;k<n.length;k++){if(n[k]){if(b[k]=="point"){var q=n[k].split(",");e.y=parseFloat(q[0]);e.x=parseFloat(q[1]);m=true}else{if(b[k]=="lat"){e.y=parseFloat(n[k]);m=true}else{if(b[k]=="lon"){e.x=parseFloat(n[k]);m=true}else{if(b[k]=="title"){j.title=n[k]}else{if(b[k]=="image"||b[k]=="icon"&&s){s.externalGraphic=n[k]}else{if(b[k]=="iconSize"&&s){var o=n[k].split(",");s.graphicWidth=parseFloat(o[0]);s.graphicHeight=parseFloat(o[1])}else{if(b[k]=="iconOffset"&&s){var g=n[k].split(",");s.graphicXOffset=parseFloat(g[0]);s.graphicYOffset=parseFloat(g[1])}else{if(b[k]=="description"){j.description=n[k]}else{if(b[k]=="overflow"){j.overflow=n[k]}else{j[b[k]]=n[k]}}}}}}}}}}}if(m){if(this.internalProjection&&this.externalProjection){e.transform(this.externalProjection,this.internalProjection)}var f=new OpenLayers.Feature.Vector(e,j,s);h.push(f)}}}}return h},CLASS_NAME:"OpenLayers.Format.Text"});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,d){this.pretty=!!d;var a=null;var b=typeof f;if(this.serialize[b]){try{a=this.serialize[b].apply(this,[f])}catch(e){OpenLayers.Console.error("Trouble serializing: "+e)}}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(d){if(d==null){return"null"}if(d.constructor==Date){return this.serialize.date.apply(this,[d])}if(d.constructor==Array){return this.serialize.array.apply(this,[d])}var g=["{"];this.level+=1;var e,b,f;var a=false;for(e in d){if(d.hasOwnProperty(e)){b=OpenLayers.Format.JSON.prototype.write.apply(this,[e,this.pretty]);f=OpenLayers.Format.JSON.prototype.write.apply(this,[d[e],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 d;var e=["["];this.level+=1;for(var b=0,a=f.length;b<a;++b){d=OpenLayers.Format.JSON.prototype.write.apply(this,[f[b],this.pretty]);if(d!=null){if(b>0){e.push(",")}e.push(this.writeNewline(),this.writeIndent(),d)}}this.level-=1;e.push(this.writeNewline(),this.writeIndent(),"]");return e.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(e,d){var f=a[d];if(f){return f}f=d.charCodeAt();return"\\u00"+Math.floor(f/16).toString(16)+(f%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(d){return(d<10)?"0"+d:d}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.GeoJSON=OpenLayers.Class(OpenLayers.Format.JSON,{ignoreExtraDims:false,initialize:function(a){OpenLayers.Format.JSON.prototype.initialize.apply(this,[a])},read:function(k,h,a){h=(h)?h:"FeatureCollection";var e=null;var d=null;if(typeof k=="string"){d=OpenLayers.Format.JSON.prototype.read.apply(this,[k,a])}else{d=k}if(!d){OpenLayers.Console.error("Bad JSON: "+k)}else{if(typeof(d.type)!="string"){OpenLayers.Console.error("Bad GeoJSON - no type: "+k)}else{if(this.isValidType(d,h)){switch(h){case"Geometry":try{e=this.parseGeometry(d)}catch(b){OpenLayers.Console.error(b)}break;case"Feature":try{e=this.parseFeature(d);e.type="Feature"}catch(b){OpenLayers.Console.error(b)}break;case"FeatureCollection":e=[];switch(d.type){case"Feature":try{e.push(this.parseFeature(d))}catch(b){e=null;OpenLayers.Console.error(b)}break;case"FeatureCollection":for(var f=0,g=d.features.length;f<g;++f){try{e.push(this.parseFeature(d.features[f]))}catch(b){e=null;OpenLayers.Console.error(b)}}break;default:try{var j=this.parseGeometry(d);e.push(new OpenLayers.Feature.Vector(j))}catch(b){e=null;OpenLayers.Console.error(b)}}break}}}}return e},isValidType:function(d,a){var b=false;switch(a){case"Geometry":if(OpenLayers.Util.indexOf(["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon","Box","GeometryCollection"],d.type)==-1){OpenLayers.Console.error("Unsupported geometry type: "+d.type)}else{b=true}break;case"FeatureCollection":b=true;break;default:if(d.type==a){b=true}else{OpenLayers.Console.error("Cannot convert types from "+d.type+" to "+a)}}return b},parseFeature:function(e){var b,g,a,f;a=(e.properties)?e.properties:{};f=(e.geometry&&e.geometry.bbox)||e.bbox;try{g=this.parseGeometry(e.geometry)}catch(d){throw d}b=new OpenLayers.Feature.Vector(g,a);if(f){b.bounds=OpenLayers.Bounds.fromArray(f)}if(e.id){b.fid=e.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 e=new Array(b);for(var a=0;a<b;++a){e[a]=this.parseGeometry.apply(this,[f.geometries[a]])}h=new OpenLayers.Geometry.Collection(e);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(d){throw d}}if(this.internalProjection&&this.externalProjection&&!g){h.transform(this.externalProjection,this.internalProjection)}return h},parseCoords:{point:function(a){if(this.ignoreExtraDims==false&&a.length!=2){throw"Only 2D points are supported: "+a}return new OpenLayers.Geometry.Point(a[0],a[1])},multipoint:function(g){var d=[];var f=null;for(var b=0,a=g.length;b<a;++b){try{f=this.parseCoords.point.apply(this,[g[b]])}catch(e){throw e}d.push(f)}return new OpenLayers.Geometry.MultiPoint(d)},linestring:function(g){var d=[];var f=null;for(var b=0,a=g.length;b<a;++b){try{f=this.parseCoords.point.apply(this,[g[b]])}catch(e){throw e}d.push(f)}return new OpenLayers.Geometry.LineString(d)},multilinestring:function(g){var d=[];var b=null;for(var e=0,a=g.length;e<a;++e){try{b=this.parseCoords.linestring.apply(this,[g[e]])}catch(f){throw f}d.push(b)}return new OpenLayers.Geometry.MultiLineString(d)},polygon:function(h){var g=[];var f,b;for(var d=0,a=h.length;d<a;++d){try{b=this.parseCoords.linestring.apply(this,[h[d]])}catch(e){throw e}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 d=0,a=g.length;d<a;++d){try{f=this.parseCoords.polygon.apply(this,[g[d]])}catch(e){throw e}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,e){var a={type:null};if(f instanceof Array){a.type="FeatureCollection";var h=f.length;a.features=new Array(h);for(var d=0;d<h;++d){var b=f[d];if(!b instanceof OpenLayers.Feature.Vector){var g="FeatureCollection only supports collections of features: "+b;throw g}a.features[d]=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,e])},createCRSObject:function(b){var d=b.layer.projection.toString();var a={};if(d.match(/epsg:/i)){var e=parseInt(d.substring(d.indexOf(":")+1));if(e==4326){a={type:"OGC",properties:{urn:"urn:ogc:def:crs:OGC:1.3:CRS84"}}}else{a={type:"EPSG",properties:{code:e}}}}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(e){if(e==null){return null}if(this.internalProjection&&this.externalProjection){e=e.clone();e.transform(this.internalProjection,this.externalProjection)}var a=e.CLASS_NAME.split(".")[2];var d=this.extract[a.toLowerCase()].apply(this,[e]);var b;if(a=="Collection"){b={type:"GeometryCollection",geometries:d}}else{b={type:a,coordinates:d}}return b},point:function(a){return[a.x,a.y]},multipoint:function(d){var e=[];for(var b=0,a=d.components.length;b<a;++b){e.push(this.extract.point.apply(this,[d.components[b]]))}return e},linestring:function(b){var e=[];for(var d=0,a=b.components.length;d<a;++d){e.push(this.extract.point.apply(this,[b.components[d]]))}return e},multilinestring:function(d){var e=[];for(var b=0,a=d.components.length;b<a;++b){e.push(this.extract.linestring.apply(this,[d.components[b]]))}return e},polygon:function(d){var e=[];for(var b=0,a=d.components.length;b<a;++b){e.push(this.extract.linestring.apply(this,[d.components[b]]))}return e},multipolygon:function(e){var d=[];for(var b=0,a=e.components.length;b<a;++b){d.push(this.extract.polygon.apply(this,[e.components[b]]))}return d},collection:function(d){var a=d.components.length;var e=new Array(a);for(var b=0;b<a;++b){e[b]=this.extract.geometry.apply(this,[d.components[b]])}return e}},CLASS_NAME:"OpenLayers.Format.GeoJSON"});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,filterType:OpenLayers.Filter.Spatial.BBOX,EVENT_TYPES:["featureselected","featuresselected","featureunselected","clickout","beforefeatureselected","beforefeaturesselected","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)},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){var d;if(a instanceof OpenLayers.Bounds){var e=this.map.getLonLatFromPixel(new OpenLayers.Pixel(a.left,a.bottom));var b=this.map.getLonLatFromPixel(new OpenLayers.Pixel(a.right,a.top));d=new OpenLayers.Bounds(e.lon,e.lat,b.lon,b.lat)}else{if(this.click){return}d=this.pixelToBounds(a)}this.setModifiers(this.handlers.box.dragHandler.evt);this.request(d)},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(e,b){b=b||{};var d=new OpenLayers.Filter.Spatial({type:this.filterType,value:e});var a=this.protocol.read({maxFeatures:b.single==true?this.maxFeatures:undefined,filter:d,callback:function(f){if(f.success()){if(f.features.length){if(b.single==true){this.selectBestFeature(f.features,e.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,k){k=k||{};if(b.length){var h=new OpenLayers.Geometry.Point(a.lon,a.lat);var j,e,f;var g=Number.MAX_VALUE;for(var d=0;d<b.length;++d){j=b[d];if(j.geometry){f=h.distanceTo(j.geometry,{edge:false});if(f<g){g=f;e=j;if(g==0){break}}}}if(k.hover==true){this.hoverSelect(e)}else{this.select(e||b)}}},setModifiers:function(a){this.modifiers={multiple:this.multiple||(this.multipleKey&&a[this.multipleKey]),toggle:this.toggle||(this.toggleKey&&a[this.toggleKey])}},select:function(f){if(!this.modifiers.multiple&&!this.modifiers.toggle){this.unselectAll()}if(!(f instanceof Array)){f=[f]}var b=this.events.triggerEvent("beforefeaturesselected",{features:f});if(b!==false){var g=[];var e;for(var d=0,a=f.length;d<a;++d){e=f[d];if(this.features[e.fid||e.id]){if(this.modifiers.toggle){this.unselect(this.features[e.fid||e.id])}}else{b=this.events.triggerEvent("beforefeatureselected",{feature:e});if(b!==false){this.features[e.fid||e.id]=e;g.push(e);this.events.triggerEvent("featureselected",{feature:e})}}}this.events.triggerEvent("featuresselected",{features:g})}},hoverSelect:function(a){var d=a?a.fid||a.id:null;var b=this.hoverFeature?this.hoverFeature.fid||this.hoverFeature.id:null;if(b&&b!=d){this.events.triggerEvent("outfeature",{feature:this.hoverFeature});this.hoverFeature=null}if(d&&d!=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 d=this.map.getLonLatFromPixel(f);var e=this.map.getLonLatFromPixel(a);return new OpenLayers.Bounds(d.lon,d.lat,e.lon,e.lat)},CLASS_NAME:"OpenLayers.Control.GetFeature"});OpenLayers.Control.PanPanel=OpenLayers.Class(OpenLayers.Control.Panel,{slideFactor:50,initialize:function(a){OpenLayers.Control.Panel.prototype.initialize.apply(this,[a]);this.addControls([new OpenLayers.Control.Pan(OpenLayers.Control.Pan.NORTH,{slideFactor:this.slideFactor}),new OpenLayers.Control.Pan(OpenLayers.Control.Pan.SOUTH,{slideFactor:this.slideFactor}),new OpenLayers.Control.Pan(OpenLayers.Control.Pan.EAST,{slideFactor:this.slideFactor}),new OpenLayers.Control.Pan(OpenLayers.Control.Pan.WEST,{slideFactor:this.slideFactor})])},CLASS_NAME:"OpenLayers.Control.PanPanel"});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.ZoomIn=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){this.map.zoomIn()},CLASS_NAME:"OpenLayers.Control.ZoomIn"});OpenLayers.Control.ZoomOut=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){this.map.zoomOut()},CLASS_NAME:"OpenLayers.Control.ZoomOut"});OpenLayers.Control.ZoomPanel=OpenLayers.Class(OpenLayers.Control.Panel,{initialize:function(a){OpenLayers.Control.Panel.prototype.initialize.apply(this,[a]);this.addControls([new OpenLayers.Control.ZoomIn(),new OpenLayers.Control.ZoomToMaxExtent(),new OpenLayers.Control.ZoomOut()])},CLASS_NAME:"OpenLayers.Control.ZoomPanel"});OpenLayers.Lang={code:null,defaultCode:"en",getCode:function(){if(!OpenLayers.Lang.code){OpenLayers.Lang.setCode()}return OpenLayers.Lang.code},setCode:function(b){var e;if(!b){b=(OpenLayers.Util.getBrowserName()=="msie")?navigator.userLanguage:navigator.language}var d=b.split("-");d[0]=d[0].toLowerCase();if(typeof OpenLayers.Lang[d[0]]=="object"){e=d[0]}if(d[1]){var a=d[0]+"-"+d[1].toUpperCase();if(typeof OpenLayers.Lang[a]=="object"){e=a}}if(!e){OpenLayers.Console.warn("Failed to find OpenLayers.Lang."+d.join("-")+" dictionary, falling back to default language");e=OpenLayers.Lang.defaultCode}OpenLayers.Lang.code=e},translate:function(b,a){var e=OpenLayers.Lang[OpenLayers.Lang.getCode()];var d=e[b];if(!d){d=b}if(a){d=OpenLayers.String.format(d,a)}return d}};OpenLayers.i18n=OpenLayers.Lang.translate;OpenLayers.Lang.en={unhandledRequest:"Unhandled request return ${statusText}",permalink:"Permalink",overlays:"Overlays",baseLayer:"Base Layer",sameProjection:"The overview map only works when it is in the same projection as the main map",readNotImplemented:"Read not implemented.",writeNotImplemented:"Write not implemented.",noFID:"Can't update a feature for which there is no FID.",errorLoadingGML:"Error in loading GML file ${url}",browserNotSupported:"Your browser does not support vector rendering. Currently supported renderers are:\n${renderers}",componentShouldBe:"addFeatures : component should be an ${geomType}",getFeatureError:"getFeatureFromEvent called on layer with no renderer. This usually means you destroyed a layer, but not some handler which is associated with it.",minZoomLevelError:"The minZoomLevel property is only intended for use with the FixedZoomLevels-descendent layers. That this wfs layer checks for minZoomLevel is a relic of thepast. We cannot, however, remove it without possibly breaking OL based applications that may depend on it. Therefore we are deprecating it -- the minZoomLevel check below will be removed at 3.0. Please instead use min/max resolution setting as described here: http://trac.openlayers.org/wiki/SettingZoomLevels",commitSuccess:"WFS Transaction: SUCCESS ${response}",commitFailed:"WFS Transaction: FAILED ${response}",googleWarning:"The Google Layer was unable to load correctly.<br><br>To get rid of this message, select a new BaseLayer in the layer switcher in the upper-right corner.<br><br>Most likely, this is because the Google Maps library script was either not included, or does not contain the correct API key for your site.<br><br>Developers: For help getting this working correctly, <a href='http://trac.openlayers.org/wiki/Google' target='_blank'>click here</a>",getLayerWarning:"The ${layerType} Layer was unable to load correctly.<br><br>To get rid of this message, select a new BaseLayer in the layer switcher in the upper-right corner.<br><br>Most likely, this is because the ${layerLib} library script was not correctly included.<br><br>Developers: For help getting this working correctly, <a href='http://trac.openlayers.org/wiki/${layerLib}' target='_blank'>click here</a>",scale:"Scale = 1 : ${scaleDenom}",W:"W",E:"E",N:"N",S:"S",layerAlreadyAdded:"You tried to add the layer: ${layerName} to the map, but it has already been added",reprojectDeprecated:"You are using the 'reproject' option on the ${layerName} layer. This option is deprecated: its use was designed to support displaying data over commercial basemaps, but that functionality should now be achieved by using Spherical Mercator support. More information is available from http://trac.openlayers.org/wiki/SphericalMercator.",methodDeprecated:"This method has been deprecated and will be removed in 3.0. Please use ${newMethod} instead.",boundsAddError:"You must pass both x and y values to the add function.",lonlatAddError:"You must pass both lon and lat values to the add function.",pixelAddError:"You must pass both x and y values to the add function.",unsupportedGeometryType:"Unsupported geometry type: ${geomType}",pagePositionFailed:"OpenLayers.Util.pagePosition failed: element with id ${elemId} may be misplaced.",end:"",filterEvaluateNotImplemented:"evaluate is not implemented for this filter type."};aw=Class.create({eventRegistry:[],id:null,_destroy_fx:null,initialize:function(a){this.id=this.getId();this.eventRegistry=[];if(a){for(var b in a){this.registerEvent(b,a[b])}}},createCookie:function(b,e,g){var a="";if(g){var f=new Date();f.setTime(f.getTime()+(g*24*60*60*1000));a="; expires="+f.toGMTString()}document.cookie=""+b+"="+e+a+";path=/"},clearCookie:function(a){this.createCookie(a,"",-1)},derivesFrom:function(b){if(this.CLASS_NAME==b){return true}if(!this._superclass()){return false}var d=this._superclass();d=new d();if(d){var a=d.derivesFrom(b);d.destroy();d=null;return a}return false},destroy:function(){aw.EventManager.clearBySource(this);aw.EventManager.clearByTarget(this)},getId:function(a){var b=new Date();return(a||"aw")+"_"+b.getHours()+""+b.getMinutes()+""+b.getSeconds()+""+b.getMilliseconds()+""+Math.round(Math.random()*10000)},readCookie:function(a,l){var k=document.cookie.split(";");var d=null,b=null,h=null,j=null,f=null,g=[];for(var e=0;b=k[e];e++){while(b.charAt(0)==" "){b=b.substring(1,b.length)}h=b.split("=");j=h.shift();f=h.join("=");if((j)&&(!j.toLowerCase().match("__ut"))){d=new RegExp("^"+a.replace(/\./ig,"\\.").replace(/\*/ig,".*")+"$","ig");if(d.test(j)){g.push({name:j,value:f})}}}if((g.length==1)&&(l!==true)){return g[0].value}else{if(g.length>0){return g}else{return null}}},registerEvent:function(a,h,d){var g=null,f=this.EVENTS,a=a.toLowerCase();for(var b=f.length;b--;){g=f[b];if(g.toLowerCase()==a){aw.EventManager.register(this,a,h,d);return true}}return false},triggerEvent:function(){if((arguments)&&(arguments.length>0)){var a=arguments[0];Array.prototype.unshift.call(arguments,this);aw.EventManager.trigger.apply(aw.EventManager,arguments)}},unregisterEvent:function(a,b){aw.EventManager.unregister(this,a,b)},_superclass:function(){return eval("("+this.CLASS_NAME+".superclass)")},EVENTS:[],CLASS_NAME:"aw"});var namespace={separator:".",create:function(a){return a.split(namespace.separator).inject(window,function(b,d){return b[d]=b[d]||{}})}};document.getURLParameters=function(a){a=a||window.location.href;var k="",d={},b=null;if(a.indexOf("?")>0){k=a.substring((a.indexOf("?")>0?a.indexOf("?")+1:0),(a.indexOf("#")>0?a.indexOf("#"):a.length))}var e=k.split(/[&;]/);for(var f=0;b=e[f];f++){var g=b.split("=");if(g[0]){var j=decodeURIComponent(g[0]);var h=decodeURIComponent(g[1]||"");if(d[j]){if(typeof(d[j])=="string"){d[j]=[d[j]]}d[j].push(h)}else{d[j]=h}}}return d};Array.prototype.sortNum=function(){return this.sort(function(e,d){return e-d})};Array.prototype.sortBy=function(b,a){this.sort(function(g,f){var e,d;if(g&&f&&typeof g==="object"&&typeof f==="object"){e=(g[b].toLowerCase)?g[b].toLowerCase():g[b];d=(f[b].toLowerCase)?f[b].toLowerCase():f[b];if(e===d){return typeof a==="function"?a(g,f):0}if(typeof e===typeof d){return e<d?-1:1}return typeof e<typeof d?-1:1}else{throw {name:"Error",message:"Expected an Object when sorting by "+b}}})};Math.boundsIntersect=function(e,d,f){if(((!e)||(!d))||((e.l>=d.r)||(e.r<=d.l))||((e.t>=d.b)||(e.b<=d.t))){return false}if((!f)||(f===0)){return true}var b=Math.calculateArea(Math.findIntersection(e,d));if((b>=Math.calculateArea(e)*f)||(b>=Math.calculateArea(d)*f)){b=null;return true}b=null;return false};Math.findIntersection=function(b,a){if((!b)||(!a)){return null}return{t:((b.t>a.t)&&(b.t<a.b))?b.t:a.t,r:((b.r<a.r)&&(b.r>a.l))?b.r:a.r,b:((b.b<a.b)&&(b.b>a.t))?b.b:a.b,l:((b.l>a.l)&&(b.l<a.r))?b.l:a.l}};Math.calculateArea=function(a){if(!a){return 0}return((a.r-a.l)*(a.b-a.t))};Number.prototype.addCommas=function(){var f="";var g=this.toString();var a=g.split(".");var e=a[0];var b=a.length>1?"."+a[1]:"";var d=/(\d+)(\d{3})/;while(d.test(e)){e=e.replace(d,"$1,$2")}return e+b};Number.prototype.roundTo=function(a){return Math.round(this*Math.pow(10,a))/Math.pow(10,a)};String.prototype.parse=function(b,h){var d=this;b=b||",";h=(h===true?true:false);var g=false;var f=[];var k=0;while((k<d.length)&&(d.length>0)){var j=d.substr(k,1);if(j==b){if((h)||((!h)&&(!g))){var a=d.substr(0,k).replace(/^\s*|\s*$/gi,"");a=(h?a:a.replace(/^"|"$/gi,""));f.push(a);d=d.substring(k+1);k=0;continue}}if(j=='"'){g=!g;k++;continue}k++}if(d.length>0){d=d.replace(/^\s*|\s*$/gi,"");d=(h?d:d.replace(/^"|"$/gi,""));f.push(d)}return f};aw.base=Class.create(aw,{componentBus:null,_onAuthenticationSuccess_fx:null,_onAuthenticationFailure_fx:null,initialize:function(b,a){this._onAuthenticationSuccess_fx=null;this._onAuthenticationFailure_fx=null;aw.prototype.initialize.apply(this,[a]);this.componentBus=null;this.applyProperties(b)},applyProperties:function(d){if((this.VALID_PROPERTIES)&&(this.VALID_PROPERTIES.length>0)&&(d)){var b=null,e=null;for(var a=this.VALID_PROPERTIES.length;a--;){b=this.VALID_PROPERTIES[a];e=d[b];if(typeof e!=="undefined"){if(b.toLowerCase()=="componentbus"){e.registerComponent(this)}else{this[b]=e}}}}},clearComponentBus:function(){if((!arguments)||(!arguments.length>0)||(arguments[0]!==false)){if(this.componentBus){if(this._onAuthenticationFailure_fx){this.componentBus.unregisterEvent("onauthenticationfailure",this._onAuthenticationFailure_fx);this._onAuthenticationFailure_fx=null}if(this._onAuthenticationSuccess_fx){this.componentBus.unregisterEvent("onauthenticationsuccess",this._onAuthenticationSuccess_fx);this._onAuthenticationSuccess_fx=null}this.componentBus.unregisterComponent(this)}}this.componentBus=null},clearRecordStore:function(a){if(!this.componentBus){return}this.componentBus.clearRecordStore(a)},debug:function(){return{}},destroy:function(){this.clearComponentBus();aw.prototype.destroy.apply(this)},getCSSClassName:function(){return this.CLASS_NAME.replace(/\./gi,"_")},getRecordStore:function(a,b){if(!this.componentBus){return}this.componentBus.getRecordStore(a,b)},isSessionValidated:function(){return((this.componentBus)&&(this.componentBus.isSessionValidated))?this.componentBus.isSessionValidated():false},isValidating:function(){return((this.componentBus)&&(this.componentBus.isValidating))?this.componentBus.isValidating():false},onAuthenticationFailure:function(){},onAuthenticationSuccess:function(){},request:function(a,e,b,d){this._request(a,e,b,d,0)},setComponentBus:function(a){if(!a){return}this.componentBus=a;this._onAuthenticationSuccess_fx=this.onAuthenticationSuccess.bind(this);this._onAuthenticationFailure_fx=this.onAuthenticationFailure.bind(this);this.componentBus.registerEvent("onauthenticationfailure",this._onAuthenticationFailure_fx);this.componentBus.registerEvent("onauthenticationsuccess",this._onAuthenticationSuccess_fx)},setRecordStore:function(a){if(!this.componentBus){return}this.componentBus.setRecordStore(a)},_request:function(b,f,d,e,a){if(!this.componentBus){return}a=a||0;if(a>=40){throw"The component ["+this.CLASS_NAME+"] has not been registered with a valid aw.ComponentBus class."}if(this.componentBus.isValidating()===true){a++;this._request.bind(this,b,f,d,e,a).delay(0.5);return}d=d||this.componentBus._componentServer;this.componentBus.request(b,f,d,e)},CLASS_NAME:"aw.base",VALID_PROPERTIES:["componentBus"]});aw.AccountManager=Class.create(aw.base,{_hashEngine:null,initialize:function(b,a){aw.base.prototype.initialize.apply(this,[b,a]);this._hashEngine=new aw.Hash.SHA1()},addUsersToGroup:function(a,d,e){if((!a)||(!d)||(d.length<1)){return}d=(d instanceof Array)?d:[d];var b={cn:"SRC.Web.Client.Handler.GroupHandler",service:"addUsers",id:a,uid:d};this.request(b,function(p,h,g){if((!g)||(!g.payload)){return}var k,l=g.payload.length,j;var m=[],f=[];for(k=0;k<l;k++){j=g.payload[k];if(j.status=="success"){m.push(j.message)}else{if(j.status=="failure"){f.push(j.message)}}}var n=(f.length>0||m.length<1)?"failure":"success";if(p){p(n,m,f)}}.bind(this,e))},addWizardsToGroups:function(a,d,e){if((!a)||(!d)||(a.length<1)||(d.length<1)){return}a=(a instanceof Array)?a:[a];d=(d instanceof Array)?d:[d];var b={cn:"SRC.Web.Client.Handler.GroupHandler",service:"addWizards",id:a,wizard_guid:d};this.request(b,function(p,h,g){if((!g)||(!g.payload)){return}var k,l=g.payload.length,j;var m=[],f=[];for(k=0;k<l;k++){j=g.payload[k];if(j.status=="success"){m.push(j.message)}else{if(j.status=="failure"){f.push(((!j.message)||(j.message.length<1))?"An unknown error has occurred.":j.message)}}}var n=(f.length>0||m.length<1)?"failure":"success";if(p){p(n,m,f)}}.bind(this,e))},createAccount:function(a,b){if(!a){return}this._createUpdateAccount("createUserAccount",a,b)},createGroup:function(a,d){if(!a){return}var b={cn:"SRC.Web.Client.Handler.GroupHandler",service:"create",name:a};this.request(b,function(k,h,j){if((!j)||(!j.payload)){return}var g=j.payload,e=g.status,f=g.message;this.triggerEvent("oncreategroup"+e,f);if(typeof k=="function"){k(j.payload)}}.bind(this,d))},deleteGroup:function(a){if(!a){return}var b={cn:"SRC.Web.Client.Handler.GroupHandler",service:"delete",id:a};this.request(b,function(d,e){if((!e)||(!e.payload)){return}if(e.payload.status=="success"){this.triggerEvent("ongroupdeleted")}else{new aw.ui.Dialog.Error({title:"Error!",content:e.payload.message||"An unknown error has occurred."})}}.bind(this))},getActivationMessage:function(a,d){if((!a)||(!a.match("success|failure"))){return}var b={cn:"SRC.Web.Client.Handler.AccountManagementHandler",service:(a+"Message")};this.request(b,function(g,e,f){if((!f)||(!f.payload)){return}if(g){g(f.payload)}}.bind(this,d))},removeUsersFromGroup:function(a,d,e){if((!a)||(!d)||(d.length<1)){return}d=(d instanceof Array)?d:[d];var b={cn:"SRC.Web.Client.Handler.GroupHandler",service:"removeUsers",id:a,uid:d};this.request(b,function(p,h,g){if((!g)||(!g.payload)){return}var k,l=g.payload.length,j;var m=[],f=[];for(k=0;k<l;k++){j=g.payload[k];if(j.status=="success"){m.push(j.message)}else{if(j.status=="failure"){f.push(j.message)}}}var n=(f.length>0||m.length<1)?"failure":"success";if(p){p(n,m,f)}}.bind(this,e))},removeWizardsFromGroups:function(a,d,e){if((!a)||(!d)||(a.length<1)||(d.length<1)){return}a=(a instanceof Array)?a:[a];d=(d instanceof Array)?d:[d];var b={cn:"SRC.Web.Client.Handler.GroupHandler",service:"removeWizards",id:a,wizard_guid:d};this.request(b,function(p,h,g){if((!g)||(!g.payload)){return}var k,l=g.payload.length,j;var m=[],f=[];for(k=0;k<l;k++){j=g.payload[k];if(j.status=="success"){m.push(j.message)}else{if(j.status=="failure"){f.push(j.message)}}}var n=(f.length>0||m.length<1)?"failure":"success";if(p){p(n,m,f)}}.bind(this,e))},renameGroup:function(b,a,e){if((!b)||(!a)){return}var d={cn:"SRC.Web.Client.Handler.GroupHandler",service:"rename",id:b,name:a};this.request(d,function(h,f,g){if((!g)||(!g.payload)){return}if(g.payload.status=="success"){this.triggerEvent("ongrouprenamed")}if(typeof h=="function"){h(g.payload.status,g.payload.message)}}.bind(this,e))},resendActivationEmail:function(a,d){if(!a){return}var b={cn:"SRC.Web.Client.Handler.AccountManagementHandler",service:"resendactivationemail",email:a};this.request(b,function(g,e,f){if(!f||!f.payload){return}if(g){g(f.payload)}}.bind(this,d))},retrieveAccountInfo:function(){var a,d;if(arguments.length>1){d=arguments[0];a=arguments[1]}else{a=arguments[0]}var b={cn:"SRC.Web.Client.Handler.AccountManagementHandler",service:"accountManifest"};if(d){b.email=d}this.request(b,function(e,g,h){if((!h)||(!h.payload)){return}var f={cn:"SRC.Web.Client.Handler.AccountManagementHandler",service:"userManifest"};if(d){f.email=d}this.request(f,function(j,k,l,m){if((!m)||(!m.payload)){return}if(j){j(k.concat(m.payload))}}.bind(this,e,h.payload))}.bind(this,a))},retrieveAvailablePartNumbers:function(b){var a={cn:"SRC.Web.Client.Handler.AccountManagementHandler",service:"partnumbermanifest"};this.request(a,function(f,d,e){if((!e)||(!e.payload)){return}if(f){f(e.payload)}}.bind(this,b))},updateAccount:function(a,b){if((!a)||(this.isSessionValidated()!==true)){return}this._createUpdateAccount("updateUserAccount",a,b)},updateUserPermissions:function(b,e,a,f){if((!b)||(b.length<1)||((!e||e.length<1)&&(!a||a.length<1))){return}e=(e instanceof Array)?e:[e];a=(a instanceof Array)?a:[a];var d={cn:"SRC.Web.Client.Handler.AccountManagementHandler",service:"updateuserpermissions",userId:b,add:e,remove:a};this.request(d,function(q,j,h){if((!h)||(!h.payload)){return}var l,m=h.payload.length,k;var n=[],g=[];for(l=0;l<m;l++){k=h.payload[l];if(k.status=="success"){n.push(k.message)}else{if(k.status=="failure"){g.push(k.message)}}}var p=(g.length>0||n.length<1)?"failure":"success";if(q){q(p,n,g)}}.bind(this,f))},_createUpdateAccount:function(a,e,f){if((!a)||(!e)){return}var b={cn:"SRC.Web.Client.Handler.AccountManagementHandler",service:a};for(var d in e){if((d)&&((d.toLowerCase()=="password")||(d.toLowerCase()=="passwordconfirm"))){e[d]=this._hashEngine.toHex(e[d])}b[d]=e[d]}this.request(b,function(g,n,l,m){if((!m)||(!m.payload)){return}var k=m.payload;var j=k.errorMessage||false;var h=k.confirmationMessage||"";if(j){this.triggerEvent(((g=="createUserAccount")?"oncreateaccountfailure":"onupdateaccountfailure"),j);if(n){n("failure",j)}return}this.triggerEvent(((g=="createUserAccount")?"oncreateaccountsuccess":"onupdateaccountsuccess"),h);if(n){n("success",h,k.userId)}}.bind(this,a,f))},EVENTS:["oncreateaccountfailure","oncreateaccountsuccess","onupdateaccountfailure","onupdateaccountsuccess","oncreategroupsuccess","oncreategroupfailure","ongroupdeleted","ongrouprenamed"],CLASS_NAME:"aw.AccountManager"});aw.AnnotationManager=Class.create(aw.base,{activeAnnotationSet:null,annotationSets:[],defaultSet:{name:"Default Set",style:{fontFamily:"tahoma",fontSize:"16pt",fontWeight:"bold",fontColor:"003300",fontStyle:"italic",fontDecoration:"underline",mouseOver:false,icon:"aws:icon:server:Pushpin (Red).png"}},_onUserDataActionExecuted_fx:null,initialize:function(b,a){this.activeAnnotationSet=null;this.annotationSets=[];aw.base.prototype.initialize.apply(this,[b,a]);if(this.componentBus){this.componentBus.getComponentReferences("aw.UserDataManager",function(d){if((d)&&(d.length>0)){this._onUserDataActionExecuted_fx=this._onUserDataActionExecuted.bind(this);d[0].registerEvent("onactionexecuted",this._onUserDataActionExecuted_fx)}}.bind(this),false)}this._initializeAnnotationSets()},createAnnotation:function(j,a,g,h,d,b){if((!j)||(!j.name)||(!j.style)||(!a)||(!g)||(!h)){return}if((h>180)||(h<-180)||(g>90)||(g<-90)){return}var f={label:a,x:h,y:g,pointData:[{type:1,name:"some text",value:d}],style:b};var e=this.componentBus.getComponentReferences("aw.UserDataManager");if((!e)||(!e.length>0)){return}e=e[0];e.executeAction({action:"save",datatype:"AnnotationLayer",name:j.name,params:{style:Object.toJSON(j.style),type:"user",content:"["+Object.toJSON(f)+"]"}})},createAnnotationSet:function(a,b){if((!a)||(a==="")){return}var d=this.componentBus.getComponentReferences("aw.UserDataManager");if((!d)||(!d.length>0)){return}d=d[0];d.executeAction({action:"save",datatype:"AnnotationLayer",name:a,params:{style:Object.toJSON(b),type:"user",content:Object.toJSON([])}})},deleteAnnotation:function(b,a){if((!b)||(!b.name)||(!a)){return}new aw.ui.Dialog.Confirm({title:"Confirm Delete",content:"Are you certain you want to delete the selected annotation(s)? This action cannot be undone."},{onconfirm:this._deleteAnnotation.bind(this,b,a)})},destroy:function(){if(this.componentBus){var a=this.componentBus.getComponentReferences("aw.UserDataManager");if((a)&&(a.length>0)){a=a[0];if(this._onUserDataActionExecuted_fx){a.unregisterEvent("onactionexecuted",this._onUserDataActionExecuted_fx);this._onUserDataActionExecuted_fx=null}}a=null}aw.base.prototype.destroy.apply(this)},getAnnotationData:function(b,a,e){var d=this.componentBus.getComponentReferences("aw.UserDataManager");if((!d)||(!d.length>0)){return}d[0].retrieveData("AnnotationLayer",b,null,this._onAnnotationDataReceived.bind(this,e),{child:a.key})},getAnnotationsBySet:function(j,b,a,f,e,h){if((!j)||(!j.name)||(!b)||(!a)||(!f)||(!e)){return}var g={minx:parseFloat(b),miny:parseFloat(a),maxx:parseFloat(f),maxy:parseFloat(e)};var d=this.componentBus.getComponentReferences("aw.UserDataManager");if((!d)||(!d.length>0)){return}d[0].retrieveData("AnnotationLayer",j.name,null,this._onAnnotationsReceived.bind(this,j.name,h),g)},getAnnotationsBySetKey:function(d,b,a,f,e,g){this.getAnnotationsBySet(this.getAnnotationSetByKey(d),b,a,f,e,g)},getAnnotationsBySetName:function(d,b,a,f,e,g){this.getAnnotationsBySet(this.getAnnotationSetByName(d),b,a,f,e,g)},getAnnotationSetByKey:function(d){var e=this.annotationSets||[];if((!d)||(!e)||(!e.length>0)){return null}var b;var a=null;for(b=0;a=e[b];b++){if(a.key===d){return a}}return null},getAnnotationSetByName:function(b){var e=this.annotationSets||[];if((!b)||(!e)||(!e.length>0)){return null}var d;var a=null;for(d=0;a=e[d];d++){if(a.name==b){return a}}return null},moveAnnotation:function(f,a,d,e){if((!f)||(!a)||(!d)||(!e)){return}if((!f.name)||(!a.key)){return}if((e>180)||(e<-180)||(d>90)||(d<-90)){return}a.x=e;a.y=d;var b=this.componentBus.getComponentReferences("aw.UserDataManager");if((!b)||(!b.length>0)){return}b=b[0];b.executeAction({action:"save",datatype:"AnnotationLayer",name:f.name,params:{style:Object.toJSON(f.style),type:"user",content:"["+Object.toJSON(a)+"]"}})},onAuthenticationFailure:function(){aw.base.prototype.onAuthenticationFailure.apply(this);this._initializeAnnotationSets()},onAuthenticationSuccess:function(){aw.base.prototype.onAuthenticationSuccess.apply(this);this._initializeAnnotationSets()},setActiveAnnotationSet:function(a){if((!a)||(this.activeAnnotationSet===a)){return}this.activeAnnotationSet=a;this.triggerEvent("onactiveannotationsetchanged",a);if(this.isSessionValidated()===true){this.setRecordStore({key:"Maps.ActiveAnnotationSet",content:{name:a.name}})}this._retrieveAnnotationSetDetails(a)},setActiveAnnotationSetByKey:function(b){var a=this.getAnnotationSetByKey(b);if(!a){return false}this.setActiveAnnotationSet(a);return true},setActiveAnnotationSetByName:function(b){var a=this.getAnnotationSetByName(b);if(!a){return false}this.setActiveAnnotationSet(a);return true},updateAnnotation:function(j,a,b,g,h,f,d){if((!j)||(!a)||(!b)||(!g)||(!h)){return}if((h>180)||(h<-180)||(g>90)||(g<-90)){return}a.label=b||a.label;a.x=h;a.y=g;a.pointData=[{key:f[0].key||"",type:1,name:"some text",value:f[0].value||""}];a.style=d;var e=this.componentBus.getComponentReferences("aw.UserDataManager");if((!e)||(!e.length>0)){return}e=e[0];e.executeAction({action:"save",datatype:"AnnotationLayer",name:j.name,params:{style:Object.toJSON(j.style),type:"user",content:"["+Object.toJSON(a)+"]"}})},updateAnnotationSet:function(d,a){if((!d)||(!d.name)){return}var b=this.componentBus.getComponentReferences("aw.UserDataManager");if((!b)||(!b.length>0)){return}b=b[0];b.executeAction({action:"save",datatype:"AnnotationLayer",name:d.name,params:{style:Object.toJSON(a),type:"user",content:Object.toJSON([])}})},_deleteAnnotation:function(d,b){if((!d)||(!d.name)||(!b)){return}var a=this.componentBus.getComponentReferences("aw.UserDataManager");if((!a)||(!a.length>0)){return}a=a[0];a.executeAction({action:"delete",datatype:"AnnotationLayer",name:d.name,params:{child:b}})},_getActiveAnnotationSet:function(){this.getRecordStore("Maps.ActiveAnnotationSet",function(b){var a;var e;var d=this.annotationSets;if((b)&&(b.length>0)){a=b[0];if(a.content){e=this.getAnnotationSetByName(a.content.name);if(!e&&d&&(d.length>0)){e=d[0]}this.setActiveAnnotationSet(e)}}else{if(!e&&d&&(d.length>0)){e=d[0]}this.setActiveAnnotationSet(e)}}.bind(this))},_initializeAnnotationSets:function(){this.annotationSets=[];this.activeAnnotationSet=null;this._retrieveAnnotationSets()},_onAnnotationDataReceived:function(e,b){if((!b)||(!b.length>0)){return}var a=b[0];var d=a.annotations;if((!d)||(d.length!==1)){return}if(e){e(d[0].data)}},_onAnnotationSetsReceived:function(a){if((!a)||(!a.length>0)){this.annotationSets=[this.defaultSet]}else{this.annotationSets=a}this.triggerEvent("onannotationsetschanged",this.annotationSets);if((!this.activeAnnotationSet)||(this.setActiveAnnotationSetByName(this.activeAnnotationSet.name)!==true)){this._getActiveAnnotationSet()}},_onAnnotationSetDetailsReceived:function(d,b){if((!b)||(!b.length>0)){return}var a=this.getAnnotationSetByName(d);var b=b[0];if(a){a.numberOfAnnotations=b.numberOfAnnotations;a.style=b.style}this.triggerEvent("onannotationsetdetailssreceived",a)},_onAnnotationsReceived:function(d,e,b){var a=this.getAnnotationSetByName(d);if((a)&&(b)&&(b.length>0)){a.annotations=b[0].annotations}if(e){e(a)}this.triggerEvent("onannotationsreceived",a)},_onUserDataActionExecuted:function(k){if(k.datatype!="AnnotationLayer"){return}switch(k.action){case"save":var a=k.name;var h=this.getAnnotationSetByName(a);if(h&&h.hasOwnProperty("key")){this._retrieveAnnotationSetDetails(h);this.triggerEvent("onannotationsetchanged",h)}else{this.activeAnnotationSet={name:a};this._retrieveAnnotationSets()}break;case"delete":var d;var b=this.annotationSets;var e=b.length;var a=k.name;var h=null;var f=[];var j=false;var g=null;if(b&&(e>0)){if(k.hasOwnProperty("params")&&k.params.hasOwnProperty("child")){h=this.getAnnotationSetByName(a);this.triggerEvent("onannotationsetchanged",h)}else{for(d=e;d--;){h=b[d];if(h.name!==a){f.push(h)}else{g=h;j=true}}if(j===true){if(f.length===0){f=[this.defaultSet]}this.annotationSets=f;this.triggerEvent("onannotationsetdeleted",g);if((this.activeAnnotationSet)&&(this.activeAnnotationSet.name===g.name)){this.setActiveAnnotationSet(this.annotationSets[0])}}}}break;case"rename":case"copy":this._initializeAnnotationSets();break;default:return}},_retrieveAnnotationSetDetails:function(a){if(!a){return}var b=this.componentBus.getComponentReferences("aw.UserDataManager");if((b)&&(b.length>0)){b[0].retrieveData("AnnotationLayer",a.name,null,this._onAnnotationSetDetailsReceived.bind(this,a.name))}},_retrieveAnnotationSets:function(){if(this.componentBus){var a=this.componentBus.getComponentReferences("aw.UserDataManager");if((a)&&(a.length>0)){a[0].retrieveData("AnnotationLayer",null,null,this._onAnnotationSetsReceived.bind(this));return}}this.triggerEvent("onannotationsetschanged",this.annotationSets)},EVENTS:["onannotationsreceived","onannotationsetschanged","onannotationsetdetailssreceived","onactiveannotationsetchanged","onannotationsetdeleted","onannotationsetchanged"],VALID_PROPERTIES:["componentBus"],CLASS_NAME:"aw.AnnotationManager"});aw.Color={hexToHSV:function(b){var a=aw.Color.hexToRGB.apply(this,[b]);return aw.Color.rgbToHSV.apply(this,a)},hexToRGB:function(e){if(!e||!e.match(/^#?[0-9a-f]{1,2}[0-9a-f]{1,2}[0-9a-f]{1,2}$/ig)){return null}e=e.replace(/#/ig,"");if((e.length!=3)&&(e.length!=6)){return null}var f=(e.length==3)?1:2;var d=[],a=null;for(var b=0;b<e.length;b=b+f){a=e.substring(b,b+f)+""+((f==1)?e.substring(b,b+f):"");d.push(parseInt(a,16))}return d},hsvToHex:function(e,d,a){var b=aw.Color.hsvToRGB.apply(this,[e,d,a]);return aw.Color.rgbToHex.apply(this,b)},hsvToRGB:function(k,w,o){var j,m,e,d,u,a,l,n;w/=100;o/=100;if(w===0){return[Math.round(o*255),Math.round(o*255),Math.round(o*255)]}k/=60;j=Math.floor(k);m=k-j;e=o*(1-w);d=o*(1-w*m);u=o*(1-w*(1-m));switch(j){case 0:a=o;l=u;n=e;break;case 1:a=d;l=o;n=e;break;case 2:a=e;l=o;n=u;break;case 3:a=e;l=d;n=o;break;case 4:a=u;l=e;n=o;break;default:a=o;l=e;n=d;break}return[Math.round(a*255),Math.round(l*255),Math.round(n*255)]},random:function(){var b=[];for(var a=0;a<3;a++){b.push(Math.floor(Math.random()*256))}return aw.Color.rgbToHex.apply(this,b)},rgbToHex:function(h,f,a){if(typeof h=="undefined"||typeof f=="undefined"||typeof a=="undefined"||(typeof h!="number")||(typeof f!="number")||(typeof a!="number")||(h<0||h>255)||(f<0||f>255)||(a<0||a>255)){throw new TypeError("RGB values must be a number between 0 and 255")}var e=[h||"0",f||"0",a||"0"];for(var d=0;d<e.length;d++){e[d]=parseInt(e[d],10).toString(16).toLowerCase();e[d]=(e[d].length===1)?("0"+e[d]):e[d]}return e.join("")},rgbToHSV:function(a,f,k){a=a/255;f=f/255;k=k/255;var h=Math.min(a,f,k);var m=Math.max(a,f,k);var n=m-h;var j=[0,0,m];if(n===0){j[0]=0;j[1]=0}else{j[1]=n/m;var e=(((m-a)/6)+(n/2))/n;var l=(((m-f)/6)+(n/2))/n;var d=(((m-k)/6)+(n/2))/n;if(a==m){j[0]=d-l}else{if(f==m){j[0]=(1/3)+e-d}else{if(k==m){j[0]=(2/3)+l-e}}}if(j[0]<0){j[0]+=1}if(j[0]>1){j[0]-=1}}j[0]=Math.floor(j[0]*360);j[1]=Math.floor(j[1]*100);j[2]=Math.floor(j[2]*100);return j},CLASS_NAME:"aw.Color"};aw.ComponentBus=Class.create(aw,{sessionLength:720,sessionWarningThreshold:1,_server:null,_serverMethod:null,_componentServer:null,_mapSourcePools:null,_authMethod:null,_callbackRegistry:[],_clearDebugTrackTimeout:null,_debugMode:false,_debugSequence:[38,38,40,40,37,39,37,39,66,65],_debugSequenceTrack:[],_jsonpBuffer:20,_jsonpRegistry:[],_hashEngine:null,_lang:null,_maxQueryLength:500,_appKey:null,_sessionKey:null,_isValidating:false,_userEmail:null,_userPassword:null,_userSalt:null,_user:null,_requestRegistry:[],_sessionTimeout:null,_onKeyDown_fx:null,initialize:function(f,e){aw.prototype.initialize.apply(this,[e]);this.sessionLength=720;this.sessionWarningThreshold=1;this.applyProperties(f);this._authMethod=null;this._callbackRegistry=[];if(!_awServer){throw"No _awServer parameter specified in client configuration file!"}if(!_awHTTPMethod){throw"No _awHTTPMethod specified in client configuration file!"}if(!_awComponentServer){throw"No _awComponentServer specified in client configuration file!"}if(!_awMapSourcePools){throw"No _awMapSourcePools specified in client configuration file!"}this._serverMethod=_awHTTPMethod;this._hashEngine=new aw.Hash.SHA1();this._lang=null;this._maxQueryLength=500;this._appKey=null;this._sessionKey=null;this._userEmail=null;this._userPassword=null;this._userSalt=null;this._user=null;this._requestRegistry=[];this._sessionTimeout=null;this._clearDebugTrackTimeout=null;this._debugMode=false;this._debugSequenceTrack=[];var h=window.location.href.replace(/^(http|https):\/\//gi,"").replace(/(:\d+\/|\/).*$/gi,"");this._server=new Template(_awServer).evaluate({servername:h});this._componentServer=new Template(_awComponentServer).evaluate({servername:h});if(window.location.href.match("https://")){this._server=this._server.replace(/http:\/\//gi,"https://");this._componentServer=this._componentServer.replace(/http:\/\//gi,"https://")}var g={};for(var d in _awMapSourcePools){if(_awMapSourcePools[d]){g[d]=[];if(_awMapSourcePools[d] instanceof Array){var a=null;for(var b=0;a=_awMapSourcePools[d][b];b++){g[d].push(new Template(a).evaluate({servername:h}))}}else{g[d].push(new Template(_awMapSourcePools[d]).evaluate({servername:h}))}}}this._mapSourcePools=g;this._sessionKey="";this._unloadUser(false,false);this._isValidating=false;new aw.RecordStore({componentBus:this});this._onKeyDown_fx=this._onKeyDown.bindAsEventListener(this);aw.EventManager.register(document,"keydown",this._onKeyDown_fx)},applyProperties:function(d){if((this.VALID_PROPERTIES)&&(this.VALID_PROPERTIES.length>0)&&(d)){var b=null;for(var a=0;b=this.VALID_PROPERTIES[a];a++){if(typeof d[b]!=="undefined"){if(b.toLowerCase()=="componentbus"){d[b].registerComponent(this)}else{this[b]=d[b]}}}}},clearRecordStore:function(b){var a=this.getComponentReferences("aw.RecordStore");if((a)&&(a.length>0)){a[0].clearRecordStore(b)}},destroy:function(){var b,a;if(_awComponentRegistry){a=_awComponentRegistry.length;for(b=a;b>0;b--){if(_awComponentRegistry[b-1].destroy){_awComponentRegistry[b-1].destroy()}_awComponentRegistry.splice(b-1,1)}_awComponentRegistry=[]}if(this._onKeyDown_fx){aw.EventManager.unregister(document,"keydown",this._onKeyDown_fx);this._onKeyDown_fx=null}},getApplicationKey:function(){return this._appKey||null},getAuthenticationMethod:function(){return this._authMethod},getComponentById:function(b){for(var a=0;c=_awComponentRegistry[a];a++){if(c.id===b){return c}}return null},getComponentReferences:function(d,g,e){var b=[];var f=null;e=(e===false)?false:true;for(var a=0;f=_awComponentRegistry[a];a++){if(f.CLASS_NAME.toLowerCase()==d.toLowerCase()){b.push(f)}}if(g){g(b);if((!b)||(!b.length>0)||(e===true)){this._callbackRegistry.push({id:this.getId(),type:"componentReference",classname:d,callback:g,maintain:e})}}return b},getComponentRegistry:function(){return _awComponentRegistry},getComponentServer:function(){return this._componentServer||null},getLang:function(a){if(!this._lang){return null}var b=this._lang[this.CLASS_NAME];if((b)&&(b[a])){return b[a]}if(this._lang[a]){return this._lang[a]}return null},getMapSourcePool:function(a){if((!a)||(!this._mapSourcePools)||(!this._mapSourcePools[a])){return null}return this._mapSourcePools[a]},getRecordStore:function(b,d){var a=this.getComponentReferences("aw.RecordStore");if((a)&&(a.length>0)){a[0].getRecordStore(b,d)}},getRequestRegistry:function(){return this._requestRegistry||[]},getServer:function(){return this._server||null},getServerMethod:function(){return this._serverMethod||null},getSessionKey:function(){return this._sessionKey||null},getUserEmail:function(){return(this._user)?this._user.username:null},getUserId:function(){return(this._user)?this._user.id:null},getUserType:function(){return(this._user)?this._user.type:null},isSessionValidated:function(){if((this._sessionKey!=="")&&(this._appKey!=="")){return true}return false},isValidating:function(){return(this._isValidating===true)},listComponents:function(){return _awComponentRegistry||[]},loadLanguage:function(a){this.loadScript(a,this._languageLoaded.bind(this))},loadScript:function(d,e){var a=document.getElementsByTagName("head");if((!a)||(!a.length>0)){return}a=a[0];var b=document.createElement("script");b.type="text/javascript";b.src=d+((d.indexOf("?")>-1)?"&":"?")+this.getId();b._loaded=false;if(e){b.onload=function(){if(this._loaded!==true){e(this);this._loaded=true;this.onload=null}};b.onreadystatechange=function(){if(this._loaded!==true){if((this.readyState=="loaded")||(this.readyState=="complete")){e(this);this._loaded=true;this.onreadystatechange=null}}}}a.appendChild(b);a=null;b=null},loadUser:function(b,a){this._unloadUser(false,true);this._isValidating=true;this._userEmail=b||"";this._userPassword=this._hashEngine.toHex(a||"");this.triggerEvent("onloaduser",(b||""),(a||""));this.request({rc:"usalt",u:(""+this._userEmail+"")})},registerComponent:function(b){if(!b){return}if(!b.setComponentBus){throw"Component does not contain a valid setComponentBus method. Component registration failed."}b.setComponentBus(this);_awComponentRegistry.push(b);if((this._callbackRegistry)&&(this._callbackRegistry.length>0)){var d,a,f=null,e=[];for(d=0,a=this._callbackRegistry.length;d<a;d++){f=this._callbackRegistry[d];if((f.type=="componentReference")&&(f.classname)&&(b.CLASS_NAME.toLowerCase()==f.classname.toLowerCase())){f.callback([b]);if(f.maintain===true){e.push(f)}}else{e.push(f)}}this._callbackRegistry=e}this.triggerEvent("oncomponentregistered",b)},request:function(l,k,b,a){b=b||this._server;a=a||this._serverMethod;if(!l){l={}}l.seqId=this.getId("");if((!l.akey)&&(this._appKey!=="")){l.akey=this._appKey}if((!l.skey)&&(this._sessionKey!=="")){l.skey=this._sessionKey}if((!l.reqId)||(l.reqId==="")){l.reqId=this.getId("")}if(k){this._callbackRegistry.push({id:l.reqId,type:"request",callback:k})}if(this._debugMode===true){this._requestRegistry.push({id:l.reqId,server:b,method:a,parameters:l,initiateTime:new Date()})}this.triggerEvent("onrequestinitialized",l,b,a);if(this._sessionKey!==""){clearTimeout(this._sessionTimeout);this._sessionTimeout=setTimeout(this._onSessionTimeout.bind(this),1000*60*this.sessionLength);clearTimeout(this._warningTimeout);this._warningTimeout=setTimeout(this._onSessionWarning.bind(this),1000*60*(this.sessionLength-this.sessionWarningThreshold))}if(a.toLowerCase()=="jsonp"){var g=aw.Object.toQueryString(l);var h=[];var j={key:this.getId("awjpr"),callback:k,parameters:l,fragments:[]};while((g)&&(g.length>0)){if(g.length>this._jsonpBuffer){j.fragments.push({key:this.getId("awjpf"),query:g.substring(0,this._jsonpBuffer-1)});g=g.substring(this._jsonpBuffer-1)}else{j.fragments.push({key:this.getId("awjpf"),query:g});g=""}}this._jsonpRegistry.push(j);for(var e=0,f=j.fragments.length;e<f;e++){this.loadScript("http://corvus/services/server/JSONPTester.ashx?page="+(e+1)+":"+f+"&pageMarker="+j.fragments[e].query,this._onJSONPFragmentResponse.bind(this,j.key,j.fragments[e].key))}}else{var d={method:(aw.Object.toQueryString(l).length>this._maxQueryLength)?"post":a,parameters:l,onSuccess:this._onResponseSuccess.bind(this),onFailure:this._onResponseFailure.bind(this)};new Ajax.Request(b,d)}},setApplicationKey:function(a){this._appKey=a||"";this._validateSession()},setRecordStore:function(b){var a=this.getComponentReferences("aw.RecordStore");if((a)&&(a.length>0)){a[0].setRecordStore(b)}},unloadUser:function(){this._unloadUser(true,true)},unregisterComponent:function(b){if(!b){return false}var d,g,a,e=false,f=[];for(d=0,a=_awComponentRegistry.length;d<a;d++){g=_awComponentRegistry[d];if(g===b){if(typeof g.clearComponentBus!="function"){throw"Component does not contain a valid clearComponentBus method. Component unregistration failed."}g.clearComponentBus(false);e=true}else{f.push(g)}}_awComponentRegistry=f;return e},validateSession:function(d){var a=null;if(d){a=this.getId("");this._callbackRegistry.push({id:a,type:"request",callback:d})}var b=(((this._sessionKey!==null)&&(this._sessionKey!==""))?this._sessionKey:this.readCookie("sk"));this.request({rc:"validate",id:a,skey:b})},_clearDebugTrack:function(a){if(this._clearDebugTrackTimeout){clearTimeout(this._clearDebugTrackTimeout);this._clearDebugTrackTimeout=null}if(a===true){this._debugSequenceTrack=[];return}this._clearDebugTrackTimeout=setTimeout(this._clearDebugTrack.bind(this,true),3000)},_languageLoaded:function(){if(!awlang){return}this._lang=awlang},_loadDebugMode:function(){this._debugMode=true;new aw.ui.Debug({componentBus:this})},_onJSONPFragmentResponse:function(h,m,b){if((!h)||(!m)||(!this._jsonpRegistry)||(!this._jsonpRegistry.length>0)){return}var e=null,l=null;for(var g=0,k=this._jsonpRegistry.length;g<k;g++){e=this._jsonpRegistry[g];if(e.key==h){for(var f=0,d=e.fragments.length;f<d;f++){l=e.fragments[f];if(l.key==m){e.fragments.splice(f,1);break}}if(e.fragments.length===0){var a=window.pagedRequest;if((a)&&(a[e.parameters.reqId])){this._processJSONResponse(a[e.parameters.reqId].response)}this._jsonpRegistry.splice(g,1);break}}}if(b){$(b).remove()}},_onKeyDown:function(d){this._debugSequenceTrack.push(d.keyCode);if((this._debugSequenceTrack.length>0)&&(this._debugSequenceTrack.length==this._debugSequence.length)){var a=false;for(var b=0;b<this._debugSequenceTrack.length;b++){if((!this._debugSequence[b])||(this._debugSequence[b]!=this._debugSequenceTrack[b])){a=true}}if(a!==true){this._loadDebugMode()}}this._clearDebugTrack()},_onResponseSuccess:function(b){var a=null;if(this._debugMode===true){this._updateRequestRegistry((((b)&&(b.request)&&(b.request.parameters))?b.request.parameters.reqId:null),b.responseText)}this.triggerEvent("onrequestcompleted");a=b.responseText.evalJSON(true);this._processJSONResponse(a,((b&&b.request&&b.request.parameters)?b.request.parameters:null))},_onResponseFailure:function(b){var a=null;if(this._debugMode===true){this._updateRequestRegistry(((b)&&(b.request)&&(b.request.parameters))?b.request.parameters.reqId:null,(b)?b.responseText:"")}this.triggerEvent("onrequestcompleted");if((b)&&(b.responseText)&&(b.responseText.unfilterJSON().isJSON())){a=b.responseText.evalJSON(true);if((a.classname)&&(a.response)){if(a.response.error){if((a.response.errorType)&&(a.response.errorType=="InvalidSession")){new aw.ui.Dialog.Alert({title:"Error!",content:a.response.error});this._unloadUser(true,true);return}new aw.ui.Dialog.Error({title:"Error!",content:a.response.error});return}}}new aw.ui.Dialog.Error({title:"Asynchronous transfer failed",content:b.statusText+"<br /><br />Status code: ["+b.status+"]"})},_onSessionTimeout:function(){if(this._sessionTimeout){clearTimeout(this._sessionTimeout);this._sessionTimeout=null}new aw.ui.Dialog.Alert({title:"Logged out",content:"You have been logged out due to inactivity."});this._unloadUser(true,true)},_onSessionWarning:function(){this.triggerEvent("sessionwarning")},_processJSONResponse:function(m,l){if(m){var k=null,f=null,a=[];if(m.action){if((m.action=="vack")&&(m.salt)){var b=this._hashEngine.toHex((""+this._userSalt+"_"+this._userPassword+""));b=this._hashEngine.toHex((""+b+""+m.salt+""));this.request({rc:"vsyn",rid:m.requestId,u:this._userEmail,p:b});this._isValidating=true}else{if(m.action=="usalt"){if(m.userSalt==-1){this._isValidating=false;this.clearCookie("username");this._unloadUser(true,true);this.triggerEvent("onloginfailure","The supplied email address does not exist or has not yet been validated. Please try again.<br /><br />If you created an account with this email address, please be certain you have followed the validation instructions in the message sent to your email.");return}this._userSalt=m.userSalt;this.request({rc:"vack"})}else{if(m.action=="vsyn"){this._authMethod=null;this._isValidating=false;if((!m.sessionKey)||(m.sessionKey==="")){this._sessionKey=null;this._user=null;this.clearCookie("username");this._unloadUser(true,true);this.triggerEvent("onloginfailure",(m.user.isExpired===false)?"Your email address or password is incorrect.  Please try again.":'Your account has expired. Please contact <a href="mailto:GeoSupport@javelingroup.com">GeoSupport@javelingroup.com</a>.')}else{this._sessionKey=m.sessionKey;this._authMethod=(m.authentication=="Windows")?"windowsAuthentication":"alteryxWebAuthentication";this._user=m.user;this.createCookie("sk",this._sessionKey,180);this.createCookie("username",this._userEmail,180);this.triggerEvent("onloginsuccess");this.triggerEvent("onauthenticationsuccess")}}else{if(m.action=="vsack"){this._isValidating=false;if(m.valid===true){this._sessionKey=m.sessionKey;this._authMethod=(m.authentication=="Windows")?"windowsAuthentication":"alteryxWebAuthentication";this._user=m.user;this.triggerEvent("onvalidationsuccess")}else{this.triggerEvent("onvalidationfailure")}}else{if(m.action=="validate"){if((m.id)&&(m.id!=="")){for(var e=0;f=this._callbackRegistry[e];e++){if((m.id==f.id)&&(f.type=="request")){k=f.callback}else{a.push(f)}}this._callbackRegistry=a}if(m.valid===false){this._unloadUser(true,true)}if(k){k(m.valid)}}}}}}this._isValidating=false}else{if((m.classname)&&(m.response)){if((m.response.error)&&(m.response.errorType)&&(m.response.errorType=="InvalidSession")){new aw.ui.Dialog.Alert({title:"Error!",content:m.response.error});this._unloadUser(true,true);return}if((this._callbackRegistry)&&(this._callbackRegistry.length>0)&&(m.response.reqId)){for(var d=0;f=this._callbackRegistry[d];d++){if((f.id==m.response.reqId)&&(f.type=="request")){k=f.callback}else{a.push(f)}}this._callbackRegistry=a}if(k){k(m.classname,m.response,l)}else{var h=null;for(var g=0;h=_awComponentRegistry[g];g++){if(h.response){h.response(m.classname,m.response,l)}}}}this._isValidating=false}}},_unloadUser:function(a,b){a=(a===false?false:true);b=(b===true?true:false);this._isValidating=false;var d=((this._sessionKey)&&(this._sessionKey!==""))?true:false;this._userEmail="";this._userSalt=-1;this._userPassword="";this._sessionKey="";this._authMethod=null;this._user=null;if(b===true){this.clearCookie("sk")}if((a===true)&&(d===true)){this.triggerEvent("onauthenticationfailure")}},_updateRequestRegistry:function(d,a){if((d)&&(this._requestRegistry)&&(this._debugMode===true)){for(var b=0;b<this._requestRegistry.length;b++){if(d==this._requestRegistry[b].id){Object.extend(this._requestRegistry[b],{response:a,completeTime:new Date()})}}}},_validateSession:function(){this._isValidating=true;var a=this._sessionKey;if((!a)||(a==="")){a=this.readCookie("sk")}if((!a)||(a==="")){var b=document.getURLParameters();if((b)&&(b.skey)&&(b.skey!=="")){a=b.skey}}this.request({rc:"vsack",skey:a})},REQUEST_STATES:{pending:"Pending",processing:"Processing",complete:"Complete"},EVENTS:["onauthenticationfailure","onauthenticationsuccess","onvalidationfailure","onvalidationsuccess","oncomponentregistered","oncomponentunregistered","onloginfailure","onloginsuccess","onloaduser","onrequestinitialized","onrequestcompleted","sessionwarning"],VALID_PROPERTIES:["sessionLength","warningThreshold"],CLASS_NAME:"aw.ComponentBus"});_awComponentRegistry=[];aw.CustomPolygonManager=Class.create(aw.base,{polygonSets:[],activePolygonSet:null,_onUserSettingsReceived_fx:null,_onUserDataActionExecuted_fx:null,initialize:function(b,a){this.polygonSets=[];this.activePolygonSet=null;aw.base.prototype.initialize.apply(this,[b,a]);if(this.componentBus){this.componentBus.getComponentReferences("aw.UserDataManager",function(d){if((d)&&(d.length>0)){var e=d[0];this._onUserSettingsReceived_fx=this._onUserSettingsReceived.bind(this);this._onUserDataActionExecuted_fx=this._onUserDataActionExecuted.bind(this);e.registerEvent("onusersettingsreceived",this._onUserSettingsReceived_fx);e.registerEvent("onactionexecuted",this._onUserDataActionExecuted_fx);if(e.userSettings){this._onUserSettingsReceived(e.userSettings)}}}.bind(this),false)}},createPolygonSet:function(a){if((!a)||(a==="")){new aw.ui.Dialog.Prompt({title:"Create Polygon Set",content:"Please enter the name you would like for this polygon set."},{onsubmit:this.createPolygonSet.bind(this)});return}var b=this.componentBus.getComponentReferences("aw.UserDataManager");if((!b)||(!b.length>0)){return}b=b[0];b.executeAction({action:"save",datatype:"CustomPolygon",name:a})},deletePolygons:function(a){if((!a)||(!a.length>0)){return}new aw.ui.Dialog.Confirm({title:"Confirm Delete",content:"Are you certain you want to delete the selected polygon(s)? This action cannot be undone."},{onconfirm:this._deletePolygons.bind(this,a)})},destroy:function(){if(this.componentBus){var a=this.componentBus.getComponentReferences("aw.UserDataManager");if((a)&&(a.length>0)){a=a[0];if(this._onUserSettingsReceived_fx){a.unregisterEvent("onusersettingsreceived",this._onUserSettingsReceived_fx);this._onUserSettingsReceived_fx=null}if(this._onUserDataActionExecuted_fx){a.unregisterEvent("onactionexecuted",this._onUserDataActionExecuted_fx);this._onUserDataActionExecuted_fx=null}}a=null}this.polygonSets=[];this.activePolygonSet=null;aw.base.prototype.destroy.apply(this)},getPolygonByName:function(b){var f=this.activePolygonSet||null;var a=f.polygons||null;if((!b)||(!f)||(!a)||(a.length<1)){return null}var e;var d=null;for(e=0;d=a[e];e++){if(d.name==b){return d}}return null},getPolygonSetByKey:function(d){var a=this.polygonSets||[];if((!d)||(!a)||(a.length<1)){return null}var b;var e=null;for(b=0;e=a[b];b++){if(e.key==d){return e}}return null},getPolygonSetByName:function(b){var a=this.polygonSets||[];if((!b)||(!a)||(a.length<1)){return null}var d;var e=null;for(d=0;e=a[d];d++){if(e.name==b){return e}}return null},onAuthenticationFailure:function(){aw.base.prototype.onAuthenticationFailure.apply(this);this._initializeCustomPolygons()},renamePolygon:function(b,a){if((!b)||(!this.activePolygonSet)){return}var d=this.getPolygonByName(b);if(!d){return}if((!a)||(a==="")){new aw.ui.Dialog.Prompt({title:"Rename Polygon",content:"Please enter the new name for the polygon.",defaultValue:b},{onsubmit:this.renamePolygon.bind(this,b)});return}var f=new OpenLayers.Format.GeoJSON().read(d.geoDef,"Geometry");f.attributes={key:this.getId("awp"),name:a};var e=this.componentBus.getComponentReferences("aw.UserDataManager");if((!e)||(!e.length>0)){return}e=e[0];e.executeAction({action:"save",datatype:"CustomPolygon",name:this.activePolygonSet.name,params:{deletePolygon:b,polygonName:a,geoJSON:new OpenLayers.Format.GeoJSON().write(f)},overwrite:true})},savePolygon:function(e,d){if((!e)||(!this.activePolygonSet)){return}var g=null,b=null;if(typeof e=="string"){g=e}else{if((e.geoJSON)||(e.geoDef)){g=e.geoJSON;b=e.geoDef}else{return}}if((!d)||(d==="")){new aw.ui.Dialog.Prompt({title:"Save Polygon",content:"Please enter the name you would like for this polygon."},{onsubmit:this.savePolygon.bind(this,e)});return}var f=this.componentBus.getComponentReferences("aw.UserDataManager");if((!f)||(!f.length>0)){return}f=f[0];var a={action:"save",datatype:"CustomPolygon",name:this.activePolygonSet.name,params:{polygonName:d},overwrite:true};if(g){a.params.geoJSON=g}if(b){a.params.geoDef=b}f.executeAction(a)},setActivePolygonSet:function(a){if((!a)||(this.activePolygonSet===a)){return}this.activePolygonSet=a;this.triggerEvent("onactivepolygonsetchanged",a);if(this.isSessionValidated()===true){this.setRecordStore({key:"Maps.ActivePolygonSet",content:{name:a.name}})}this._getCustomPolygons(a)},setActivePolygonSetByKey:function(a){var b=this.getPolygonSetByKey(a);if(!b){return false}this.setActivePolygonSet(b);return true},setActivePolygonSetByName:function(a){var b=this.getPolygonSetByName(a);if(!b){return false}this.setActivePolygonSet(b);return true},_deletePolygons:function(b){var e=this.componentBus.getComponentReferences("aw.UserDataManager");if((e)&&(e.length>0)){e=e[0];var d;var a=this.activePolygonSet.name;for(var d=b.length;d--;){e.executeAction({action:"save",datatype:"CustomPolygon",name:a,params:{deletePolygon:b[d].name},overwrite:true})}}},_getActivePolygonSet:function(){this.getRecordStore("Maps.ActivePolygonSet",function(b){var a;var e;var d=this.polygonSets;if((b)&&(b.length>0)){a=b[0];if(a.content){e=this.getPolygonSetByName(a.content.name);if(!e&&d&&(d.length>0)){e=d[0]}this.setActivePolygonSet(e);return}}this.setActivePolygonSetByName("Default Set")}.bind(this))},_getCustomPolygons:function(d){if(!d){return}var a=d.name;var b=this.componentBus.getComponentReferences("aw.UserDataManager");if((b)&&(b.length>0)){b=b[0];b.retrieveData("CustomPolygon",a,null,this._onCustomPolygonsReceived.bind(this,a))}},_getCustomPolygonSets:function(){if(this.componentBus){var a=this.componentBus.getComponentReferences("aw.UserDataManager");if((a)&&(a.length>0)){a=a[0];if((a.userSettings)&&(a.userSettings.enableCustomPolygons===true)){a.retrieveData("CustomPolygon",null,null,this._onCustomPolygonSetsReceived.bind(this));return}}}this.triggerEvent("onpolygonsetschanged",this.polygonSets)},_initializeCustomPolygons:function(){this.polygonSets=[];this.activePolygonSet=null;this._getCustomPolygonSets()},_onCustomPolygonSetsReceived:function(a){if((!a)||(!a.length>0)){this.polygonSets=[{name:"Default Set"}]}else{this.polygonSets=a}this.triggerEvent("onpolygonsetschanged",this.polygonSets);if((!this.activePolygonSet)||(this.setActivePolygonSetByName(this.activePolygonSet.name)!==true)){this._getActivePolygonSet()}},_onCustomPolygonsReceived:function(d,a){if((!a)||(!a.length>0)){return}var b=this.getPolygonSetByName(d);if(b){b.polygons=a[0].polygons}this.triggerEvent("onpolygonsreceived",b)},_onCustomPolygonCreated:function(b){if(!b){return}var a=this.activePolygonSet||null;if((a)&&(a.name==b.name)){this._getCustomPolygons(a)}},_onCustomPolygonDeleted:function(b){if(!b){return}var a=this.activePolygonSet||null;if((a)&&(a.name==b.name)){this._getCustomPolygons(a)}},_onUserDataActionExecuted:function(h){if(h.datatype!="CustomPolygon"){return}switch(h.action){case"save":var g=this.activePolygonSet||null;var b=h.name;var j=this.getPolygonSetByName(b);if((!j)||(!j.key)){if(h.params){this._initializeCustomPolygons()}else{this.activePolygonSet={name:b};this._getCustomPolygonSets()}}else{if(h.params){if((g)&&(g.name==b)){this._getCustomPolygons(g)}this.triggerEvent("onpolygonsetchanged",this.getPolygonSetByName(b))}else{this.activePolygonSet={name:b};this._getCustomPolygonSets()}}break;case"delete":var e;var j=null;var a=[];var f=false;var d=null;if((this.polygonSets)&&(this.polygonSets.length>0)){for(e=0;j=this.polygonSets[e];e++){if(j.name!=h.name){a.push(j)}else{d=j;f=true}}if(f===true){if(a.length===0){a=[{name:"Default Set"}]}this.polygonSets=a;this.triggerEvent("onpolygonsetdeleted",d);if((this.activePolygonSet)&&(this.activePolygonSet.name==d.name)){this.setActivePolygonSet(this.polygonSets[0])}}}break;case"rename":case"copy":this._initializeCustomPolygons();break;default:return}},_onUserSettingsReceived:function(a){this._initializeCustomPolygons()},EVENTS:["onactivepolygonsetchanged","onpolygonsetschanged","onpolygonsetchanged","onpolygonsetdeleted","onpolygonsreceived"],VALID_PROPERTIES:["componentBus"],CLASS_NAME:"aw.CustomPolygonManager"});aw.Element={getParentNode:function(f,e,d){var a=f.parentNode,b=true;while(a){b=true;if(a.nodeType==1){b=((e)&&(a.tagName.toLowerCase()!=e.toLowerCase()))?false:true;if(b===true){b=((d)&&((!a.className)||(!a.className.toLowerCase().match(d.toLowerCase()))))?false:true}if(b===true){return a}}a=a.parentNode}return null},empty:function(a){a.innerHTML=""},insert:function(a,b){if(b){if(typeof b=="string"){var e=document.createElement("div");e.innerHTML=b;var d=e.childNodes;while(d.length>0){a.appendChild(d[0])}e.innerHTML="";e=null}else{a.appendChild(b)}}},remove:function(b){var a=document.createElement("div");a.appendChild(b);a.innerHTML=""},setOpacity:function(b,a){b.style.opacity=a;b.style.filter="alpha(opacity="+a*100+")"},update:function(a,b){a.innerHTML="";if(b){if(typeof b=="string"){a.innerHTML=b}else{a.appendChild(b)}}}};aw.EventManager={_events:{},_DOMEvents:[],clear:function(){this._events={};var a=this._DOMEvents;for(var b=a.length;b--;){this._removeEvent(a[b])}this._DOMEvents=[];Prototype.emptyFunction=null},clearBySource:function(g){var h=this._events,a=this._DOMEvents,d=null,b=null,f=0;for(var e in h){d=h[e];if(d){for(f=d.length;f--;){if(d[f].source===g){d.splice(f,1)}}}}for(f=a.length;f--;){b=a[f];if(b.source===g){this._removeEvent(b);a.splice(f,1)}}},clearByTarget:function(f){if((f.removeEventListener)||(f.dettachEvent)){var a=this._DOMEvents,b=null,d=0;for(d=a.length;d--;){b=a[d];if(b.target===f){this._removeEvent(b);a.splice(d,1)}}}else{if(f.id){var e=this._events;if(e[f.id]){delete e[f.id]}}}},getEvent:function(b){b=b||window.event;var a={target:null,pointerX:null,pointerY:null,keyCode:null,ctrlKey:null,shiftKey:null,altKey:null,stop:function(){if((this._event)&&(this._event.stopPropagation)){this._event.stopPropagation()}else{if(this._event){this._event.cancelBubble=true}}},_event:b};if(!b){return a}a.keyCode=b.keyCode;a.ctrlKey=b.ctrlKey;a.shiftKey=b.shiftKey;a.altKey=b.altKey;if(b.target){a.target=b.target}else{if(b.srcElement){a.target=b.srcElement}}if(a.target){if(a.target.nodeType==3){a.target=target.parentNode}a.target=$(a.target)}if(b.pageX||b.pageY){a.pointerX=b.pageX;a.pointerY=b.pageY}else{if(b.clientX||b.clientY){a.pointerX=b.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;a.pointerY=b.clientY+document.body.scrollTop+document.documentElement.scrollTop}}return a},register:function(e,b,f,d){if((!e)||(!b)||(!f)){return}b=b.toLowerCase();if((e.addEventListener)||(e.attachEvent)){this._DOMEvents.push({target:e,eventName:b,callback:f,source:d});if(e.addEventListener){e.addEventListener(b,f,false)}else{if(e.attachEvent){e.attachEvent("on"+b,f)}}}else{if(e.id){var a={eventName:b,callback:f,source:d};if(this._events[e.id]){this._events[e.id].push(a)}else{this._events[e.id]=[a]}}}},trigger:function(k,b){var g=false;if((!k)||(!b)||(!this._events)){return g}b=b.toLowerCase();var j=this._events[k.id];if((!j)||(j.length<1)){return g}var h=null,d=(Array.prototype.slice.call(arguments,2)||null),f=0,a=j.length;for(f=0;f<a;f++){h=j[f];if((h)&&(h.eventName==b)){h.callback.apply(this,d);g=true}}return g},unregister:function(h,e,j){var f=0;e=e.toLowerCase();if((h.removeEventListener)||(h.detachEvent)){var a=this._DOMEvents;var d;for(f=a.length;f--;){d=a[f];if((d.eventName===e)&&(d.callback===j)&&(d.target===h)){this._removeEvent(d);a.splice(f,1)}}}else{if(h.id){var b=this._events[h.id];var g;if(b){for(f=b.length;f--;){g=b[f];if((g.eventName==e)&&(g.callback===j)){b.splice(f,1)}}if((!b)||(b.length<1)){delete this._events[h.id]}}}}},_removeEvent:function(a){if(a.target){if(a.target.removeEventListener){a.target.removeEventListener(a.eventName,a.callback,false)}else{if(a.target.detachEvent){a.target.detachEvent("on"+a.eventName,a.callback)}}}}};aw.EventManager.register(window,"unload",aw.EventManager.clear.bind(aw.EventManager));aw.FileManager=Class.create(aw.base,{initialize:function(b,a){aw.base.prototype.initialize.apply(this,[b,a])},getFiles:function(b){if(!b){return}var a={cn:"SRC.Web.Client.Handler.UserDataHandler",service:"files"};if(this.isSessionValidated()===true){this.request(a,this._onFiles_received.bind(this,b))}else{if(this.isValidating()===true){this.getFiles(this,b).delay(0.5)}}},_onFiles_received:function(b,d,e,a){if((!b)||(!e)||(!e.payload)){return}this.triggerEvent("onfilesreceived",b,e.payload);if(b.callback){b.callback(b,e.payload)}},EVENTS:["onfilesreceived"],VALID_PROPERTIES:["componentBus"],CLASS_NAME:"aw.FileManager"});aw.FileUploader=Class.create(aw.base,{fileName:null,formObj:null,validExtensions:[],_uploadKey:null,initialize:function(e,d){this.fileName=null;this.formObj=null;this.validExtensions=[];aw.base.prototype.initialize.apply(this,arguments);this._uploadKey=this.getId("awuk");if(!this.formObj){throw"Could not locate form object."}var b={akey:this.componentBus.getApplicationKey(),skey:this.componentBus.getSessionKey(),rc:"upload",upload_key:this._uploadKey};var a=null;for(var f in b){a=this.formObj.down('input[name="'+f+'"]');if(a){a.value=b[f]}else{this.formObj.insert('<input type="hidden" name="'+f+'" value="'+b[f]+'" />')}}this._submitUpload()},_importFileUpload:function(d,b){var a={cn:"SRC.Web.Client.Handler.AlteryxHandler",service:"importContent",file:d,sheet:b,filename:this.fileName,type:"FileUpload"};this.request(a,function(e,f){if((!f)||(!f.payload)){return}this.triggerEvent("success",f.payload)}.bind(this))},_onTableSelectionReceived:function(b,a){alert(b+"|"+a)},_submitUpload:function(){var a=this.formObj.select('input[type="file"]');if((!a)||(!a.length>0)){throw"No file field types were found within the form object."}for(var b=0;b<a.length;b++){if(this._validateFileName(a[b].value)!==true){this.triggerEvent("failure","Invalid file "+a[b].value+". Please be certain to include a valid file"+(((this.validExtensions)&&(this.validExtensions.length>0))?(" with one of the following extensions: "+this.validExtensions.join(", ")):"")+".");return}var d=this.getId("awf");var g=null;try{g=document.createElement('<iframe name="'+d+'">');g.id=d}catch(f){g=document.createElement("iframe");g.name=d;g.id=d}if(!g){return}document.getElementsByTagName("body")[0].appendChild(g);$(g).hide();aw.EventManager.register(g,"load",function(h){var e={cn:"SRC.Web.Client.Handler.UserDataHandler",service:"validateUpload",upload_key:this._uploadKey,load:false,schema:false};this.request(e,function(l,m){if((!m)||(!m.payload)){return}if((!m.payload.fileExists)||(m.payload.fileExists!==true)){this.triggerEvent("failure","Could not validate file upload.");return}if((m.payload.tables)&&(m.payload.tables.length>0)){var j=[];for(var k=0;k<m.payload.tables.length;k++){j.push({value:m.payload.tables[k],label:m.payload.tables[k]})}new aw.ui.Dialog.Prompt({title:"Select Table",content:"Please select the table/sheet you would like to use from the uploaded file.",type:"select",options:j},{onsubmit:this._importFileUpload.bind(this,m.payload.fileName)});return}this._importFileUpload(m.payload.fileName)}.bind(this));if(h){h.remove.bind(h).delay(0.5)}}.bind(this,g),this);this.formObj.target=d;this.formObj.encoding="multipart/form-data";this.formObj.method="POST";this.formObj.action=this.componentBus.getServer();this.formObj.submit()}},_validateFileName:function(b){if((!b)||(b==="")){return false}if((!this.validExtensions)||(!this.validExtensions.length>0)){return true}var a=b.substr(b.lastIndexOf(".")+1);return this.validExtensions.include(a)},EVENTS:["failure","success","tablesreceived"],VALID_PROPERTIES:["componentBus","formObj","validExtensions","fileName"],CLASS_NAME:"aw.FileUploader"});aw.Geocoder=Class.create(aw.base,{initialize:function(b,a){aw.base.prototype.initialize.apply(this,arguments)},geocodeFile:function(e,a,d){if((!e)||(!a)){return}var b={cn:"SRC.Web.Client.Handler.AlteryxHandler",service:"geocodeUserLocationFile",inputFile:e,outputFile:e,address:a.address,city:a.city,state:a.state,postal:a.postal,acceptZip:d||false};this.request(b,function(h,g,f){if((!f)||(!f.payload)){return}var l=f.payload.total||0;var n=f.payload.unmatched||0;var m=0;var j=0;if(f.payload.results){if(f.payload.results.Exact){for(var k in f.payload.results.Exact){m+=f.payload.results.Exact[k]}}if(f.payload.results.Multiple){for(var p in f.payload.results.Multiple){j+=f.payload.results.Multiple[p]}}}this.triggerEvent("filegeocoded",h,{total:l,matched:m,unmatched:n,multipleMatched:j})}.bind(this,e))},EVENTS:["filegeocoded"],CLASS_NAME:"aw.Geocoder"});aw.Geography=Class.create(aw.base,{bounds:null,count:-1,dataset:null,key:null,label:null,name:null,_serverRender:false,_serverGuid:null,_serverUser:null,initialize:function(d,b,a){this.setKey(d);this.setName(b);this.setLabel(a);this.setDataset("*");this._serverRender=false;this._serverGuid=null;this._serverUser=null;this.count=-1},setKey:function(a){this.key=a||this.getId("svg")},setName:function(a){this.name=a||"Geography"},setLabel:function(a){this.label=a||"Geography"},setDataset:function(a){this.dataset=a||"*"},getDataset:function(){return this.dataset||"*"},getGeographyDefinition:function(){return""},getGeographyCount:function(){return 0},isValid:function(){return false},isServerRendered:function(){return this._serverRender},getServerGuid:function(){return this._serverGuid},getServerUser:function(){return this._serverUser},setBounds:function(a){if((a)&&(a.minx)&&(a.miny)&&(a.maxx)&&(a.maxy)){this.bounds=a}},getBounds:function(){return this.bounds},setCount:function(a){this.count=a},getCount:function(){if(this.isValid){return this.count}return -1},isBoundsValid:function(){if(!this.bounds){return false}if((!this.bounds.minx)||(!this.bounds.miny)||(!this.bounds.maxx)||(!this.bounds.maxy)){return false}if((this.bounds.minx<-180)||(this.bounds.miny<-90)||(this.bounds.maxx>180)||(this.bounds.maxy>90)){return false}return true},parseGeographyDefinition:function(h,f,b,a,g,e,d){return null},CLASS_NAME:"aw.Geography"});aw.Geography.Custom=Class.create(aw.Geography,{geoJson:null,initialize:function(e,d,b,a){aw.Geography.prototype.initialize.apply(this,arguments);this._serverRender=true;this.setGeoJson(a)},setGeoJson:function(b){if(b){if(b instanceof Object){var a=new OpenLayers.Format.GeoJSON();var d=a.read(b,"Geometry");b=a.write(d)}this.geoJson=b}},getGeographyDefinition:function(){if(this.isValid()){if((this._serverGuid)&&(this._serverUser)){return"ServerGuid("+this._serverGuid+", "+this._serverUser+")"}else{return'Geography(PolygonFile, "gjsn:'+this.geoJson+'", 27, 1, 0)'}}return null},isValid:function(){return this.geoJson!==null},parseGeographyDefinition:function(geoDef,dataset,minx,miny,maxx,maxy,useKey){var geos=[];dataset=dataset||"*";if((!geoDef)||(typeof(geoDef)!=="string")||(geoDef==="")){return null}var sGeos=geoDef.split("\n").without("");var sGeo=null;var len=sGeos.length;for(var i=0;i<len;i++){sGeo=sGeos[i];sGeo=sGeo.replace(/^.*Geography\(\s*PolygonFile\s*,/gi,"");sGeo=sGeo.replace(/\)\s*$/gi,"");var geoElements=sGeo.parse();if(geoElements.length!=4){return null}if(geoElements[0].search(/^gjsn\:\{/)!==0){return null}var o=null;try{o=eval("("+geoElements[0].replace(/^gjsn\:/,"")+")")}catch(e){return null}var g=new aw.Geography.Custom(o.key,o.name,o.name,geoElements[0].replace(/^gjsn\:/,""));g.setBounds({minx:minx,miny:miny,maxx:maxx,maxy:maxy});geos.push(g)}return geos},CLASS_NAME:"aw.Geography.Custom"});aw.Geography.Radius=Class.create(aw.Geography,{radius:null,centroid:null,units:null,initialize:function(g,f,e,b,a,h,d){aw.Geography.prototype.initialize.apply(this,arguments);this._serverRender=true;this.centroid={x:0,y:0};this.units="Miles";this.setRadius(b);this.setCentroid(a,h);this.setUnits(d);this.setCount(1)},setRadius:function(a){a=parseFloat(a);this.radius=a},getRadius:function(){return this.radius||0},setCentroid:function(a,b){a=parseFloat(a);b=parseFloat(b);this.centroid={x:a,y:b}},getCentroid:function(){return this.centroid||{x:0,y:0}},setUnits:function(a){if(a){if(a.toLowerCase()=="miles"){this.units="Miles"}else{if(a.toLowerCase()=="kilometers"){this.units="Kilometers"}}}},getUnits:function(){return this.units},isValid:function(){var b=parseFloat(this.radius);var a=parseFloat(this.centroid.x);var d=parseFloat(this.centroid.y);return((b>0)&&(b<=500)&&(a>=-180)&&(a<=180)&&(d>=-90)&&(d<=90)&&((this.units=="Miles")||(this.units=="Kilometers")))},getGeographyDefinition:function(){if(this.isValid()){if((this._serverGuid)&&(this._serverUser)){return"ServerGuid("+this._serverGuid+", "+this._serverUser+")"}else{return"Geography(Radius, "+this.centroid.y.roundTo(6)+", "+this.centroid.x.roundTo(6)+', "'+this.radius+'", "'+this.label+'", '+this.units+")"}}return null},parseGeographyDefinition:function(a,b,s,q,n,m,e){var h=[];b=b||"*";if((!a)||(typeof(a)!=="string")||(a==="")){return null}var p=a.split("\n").without("");var f=null;var l=p.length;for(var d=0;d<l;d++){f=p[d];f=f.replace(/^.*Geography\(\s*/gi,"");f=f.replace(/\)\s*$/gi,"");var k=f.parse();if(k.length==6){if(k[0].toLowerCase()!="radius"){return null}if((k[5]!="Miles")&&(k[5]!="Kilometers")){return null}var o=y=r=0;o=parseFloat(k[2]);y=parseFloat(k[1]);r=parseFloat(k[3]);var j=new aw.Geography.Radius(null,k[4],k[4],r,o,y,k[5]);j.setBounds({minx:s,miny:q,maxx:n,maxy:m});h.push(j)}}return h},CLASS_NAME:"aw.Geography.Radius"});aw.Geography.Drivetime=Class.create(aw.Geography.Radius,{initialize:function(g,f,e,b,a,j,d,h){aw.Geography.Radius.prototype.initialize.apply(this,arguments);this._serverRender=true;this.centroid={x:0,y:0};this.units="Minutes";this.setRadius(b);this.setCentroid(a,j);this.setUnits(d);this.setDataset(h)},isValid:function(){try{var b=parseFloat(this.radius);var a=parseFloat(this.centroid.x);var f=parseFloat(this.centroid.y);return((b>0)&&(b<=120)&&(a>=-180)&&(a<=180)&&(f>=-90)&&(f<=90)&&((this.units=="Minutes")||(this.units=="Miles")))}catch(d){return false}},setUnits:function(a){if(a){if(a.toLowerCase()=="miles"){this.units="Miles"}else{if(a.toLowerCase()=="minutes"){this.units="Minutes"}}}},getGeographyDefinition:function(){if(this.isValid()){if((this._serverGuid)&&(this._serverUser)){return"ServerGuid("+this._serverGuid+", "+this._serverUser+")"}else{return"Geography(Radius, "+this.centroid.y.roundTo(6)+", "+this.centroid.x.roundTo(6)+', "'+this.radius+'", "'+this.label+'", '+this.units+")"}}return""},parseGeographyDefinition:function(a,b,u,t,p,o,f){var j=[];b=b||"*";if((!a)||(typeof(a)!=="string")||(a==="")){return null}var s=a.split("\n").without("");var h=null;var m=s.length;for(var d=0;d<m;d++){h=s[d];h=h.replace(/^.*Geography\(\s*/gi,"");h=h.replace(/\)\s*$/gi,"");var l=h.parse();if(l.length==6){if((l[0].toLowerCase()!="radius")&&(l[0].toLowerCase()!="drivetime")){return null}if(l[5]!="Minutes"){return null}var q=y=r=0;try{q=parseFloat(l[2]);y=parseFloat(l[1]);r=parseFloat(l[3])}catch(n){return null}var k=new aw.Geography.Drivetime(null,l[4],l[4],r,q,y,l[5],b);k.setBounds({minx:u,miny:t,maxx:p,maxy:o});j.push(k)}}return j},CLASS_NAME:"aw.Geography.Drivetime"});aw.Geography.Standard=Class.create(aw.Geography,{shortGeoName:null,geoKey:null,anchor:null,initialize:function(d,b,a,e,f,g){aw.Geography.prototype.initialize.apply(this,arguments);this._serverRender=false;this.anchor=null;this.setShortGeoName(e);this.setGeoKey(f);this.setDataset(g)},setShortGeoName:function(a){if(a){this.shortGeoName=a;this.geoKey="*"}},setGeoKey:function(a){if(a){this.geoKey=a}},getGeographyDefinition:function(){if(this.shortGeoName){return"Geography("+this.shortGeoName+", "+(this.geoKey?this.geoKey:"*")+")"}return null},isValid:function(){if((this.shortGeoName)&&(this.geoKey)){return true}return false},parseGeographyDefinition:function(a,b,t,s,p,o,f){var j=[];b=b||"*";if((!a)||(typeof(a)!=="string")||(a==="")){return null}var q=a.split("\n").without("");var n=null;var h=null;var m=q.length;for(var e=0;e<m;e++){h=q[e];if(!n){if(h.search(/.*dataset=.+;/gi)>=0){n=h.replace(/^.*dataset=/gi,"").replace(/;.*$/gi,"")}}h=h.replace(/^.*Geography\(\s*/gi,"");h=h.replace(/\)\s*$/gi,"");var l=h.parse();if(l.length==2){n=n||b;var k=new aw.Geography.Standard(null,"Standard Geography","Standard Geography",l[0],l[1],n);k.setBounds({minx:t,miny:s,maxx:p,maxy:o});j.push(k)}}return j},CLASS_NAME:"aw.Geography.Standard"});aw.GeographyCollection=Class.create(aw.base,{anchor:null,geoCount:null,geos:[],key:null,label:null,name:null,_geoKey:null,_isDefault:false,_savedGeo:false,_savedGeoName:null,_sumRadii:false,initialize:function(e,d,b,a){aw.base.prototype.initialize.apply(this,arguments);this.setKey(e);this.setName(d);this.setLabel(b);this.setAnchor(a);this.setGeographyCount(0);this.geos=[];this._geoKey=null;this._sumRadii=false;this._savedGeo=false;this._savedGeoName=null;this._isDefault=false},addGeography:function(f){this._setGeoUpdated();var h=null;var e=null;for(var b=0,a=this.geos.length;b<a;b++){e=this.geos[b];if((e.dataset)&&(e.dataset!="*")&&(e.CLASS_NAME!=="aw.Geography.Drivetime")&&(e.CLASS_NAME!=="aw.Geography.Radius")){h=e.dataset}}h=h||"*";if((f._superclass()===aw.Geography)||(f._superclass()===aw.Geography.Radius)){if((h==="*")||(f.dataset==="*")||(f.dataset.toLowerCase()===h.toLowerCase())||(e.CLASS_NAME!=="aw.Geography.Drivetime")||(e.CLASS_NAME!=="aw.Geography.Radius")){this.geos.push(f);return true}else{throw"Geographies referencing disparate datasets may not be combined."}}else{throw"An invalid object type was supplied."}return false},contains:function(d){var e=d.toLowerCase();for(var b=0,a=this.geos.length;b<a;b++){if(this.geos[b].CLASS_NAME.toLowerCase()===e){return true}}return false},generateLabel:function(){if((this.geos)&&(this.geos.length>0)){var f=this._aggregateGeographies();var e=null,g=[];for(var d=0;e=f[d];d++){g.push(e.name)}var b="";if(g.length==1){b=g[0]}else{for(var a=0;a<g.length;a++){if(b.length===0){b=g[a]}else{if((b.length+g[a].length)>40){b+=",...";break}else{b+=", "+g[a]}}}}this.label=b;this.name=b}},getBounds:function(){var d={minx:0,miny:0,maxx:0,maxy:0};var f=null;for(var e=0,a=this.geos.length;e<a;e++){f=this.geos[e];if((f.isServerRendered())&&(f.bounds)){d.minx=(d.minx===0?f.bounds.minx:Math.min(f.bounds.minx,d.minx));d.miny=(d.miny===0?f.bounds.miny:Math.min(f.bounds.miny,d.miny));d.maxx=(d.maxx===0?f.bounds.maxx:Math.max(f.bounds.maxx,d.maxx));d.maxy=(d.maxy===0?f.bounds.maxy:Math.max(f.bounds.maxy,d.maxy))}}return d},getGeographyByIndex:function(a){var b=null;if((a<=0)&&(a>this.geos.length)){b=this.geos[a]}return b},getGeographyByKey:function(d){for(var b=0,a=this.geos.length;b<a;b++){if(this.geos[b].key==d){return this.geos[b]}}return null},getGeographyCount:function(){return this.geoCount||0},getGeographyDefinition:function(){var m="";var j="";var b="";var e="";if((!this.geos)||(this.geos.length<=0)){m="";j="";b="";e=""}else{var l=this.geos;if(this._sumRadii===true){l=this._aggregateGeographies()}var k=null;var f=null;for(var g=0,h=l.length;g<h;g++){f=l[g];if((!k)&&(f.dataset)&&(f.dataset!="*")){k=f.dataset}var a=f.getGeographyDefinition();if(a){if(f.CLASS_NAME=="aw.Geography.Custom"){if(a.indexOf("ServerGuid")===0){b+=a+"^^";continue}else{if(a.indexOf("Geography")===0){j+=a+"\n";continue}else{e+=a+"^^";continue}}}if(k){if((f.dataset=="*")||(f.dataset.toLowerCase()===k.toLowerCase())){if(a.indexOf("Geography")===0){j+=a+"\n"}else{if(a.indexOf("ServerGuid")===0){b+=a+"^^"}}}}else{if(a.indexOf("Geography")===0){j+=a+"\n"}else{if(a.indexOf("ServerGuid")===0){b+=a+"^^"}}}}else{alert("The geography could not be deserialized.")}}if(!k){k="*"}if(j!==""){m+="allocate:dataset="+k+";workspace="+j}if(b!==""){while(b.substr(b.length-1)=="^"){b=b.substring(0,b.length-1)}m+=(m.length>0?"^^":"")+b}if(e!==""){e="geojson:"+e}}return{geodef:m,geojson:e}},getGeographyKeys:function(){var d=[];for(var b=0,a=this.geos.length;b<a;b++){d.push(this.geos[b].key)}return d},getGeographyTypes:function(){var e={};if((this.geos)&&(this.geos.length>0)){var f=null;for(var d=0;f=this.geos[d];d++){e[f.CLASS_NAME]=true}}var b=[];for(var a in e){b.push(a)}return b},getRadiiInfo:function(){var g=[];var d=null;var b=null;var f=null;if((this.geos)&&(this.geos.length>0)){for(var e=0,a=this.geos.length;e<a;e++){f=this.geos[e];g.push(f.getRadius());d=f.getUnits();b=f.getDataset()}}return{sizes:g.flatten().uniq(),units:d,dataset:b}},getSavedGeoName:function(){return this._savedGeoName||""},invalidateServerGeographies:function(){for(var b=0,a=this.geos.length;b<a;b++){this.geos[b]._serverGuid=null}},isDefault:function(){return this._isDefault||false},parseGeoDefinition:function(b,f,s,q,p,o,k,d){if(!d){d=aw.Geography.subclasses}k=(k===true?true:false);var a=null;for(var h=0;a=d[h];h++){var m=new a;var l=m.parseGeographyDefinition(b,f,s,q,p,o,k);if((l)&&(l.length)&&(l.length>0)){for(var e=0,n=l.length;e<n;e++){this.addGeography(l[e])}return l}if(a.subclasses&&a.subclasses.length>0){this.parseGeoDefinition(b,f,s,q,p,o,k,a.subclasses)}}},removeAllGeographies:function(){this._setGeoUpdated();this.geos=[]},removeGeography:function(d){if(!d){return false}var f=[];var e=false;var h=null;for(var b=0,a=this.geos.length;b<a;b++){h=this.geos[b];if(h.key==d){e=true}else{f.push(h)}}this.geos=f;if(e===true){this._setGeoUpdated()}return e},requiresServerGeography:function(){var d=false;var f=null;for(var e=0,a=this.geos.length;e<a;e++){f=this.geos[e];if(f.isServerRendered()){d=true}}return d},requiresServerSave:function(){var a=false;if(this._savedGeo===true&&this._savedGeoName!==""&&this._geoUpdated===true){a=true}return a},serialize:function(){var d="";d+="name:'"+this.name+"'\r\n";d+="label:'"+this.label+"'\r\n";d+="count:'"+this.geoCount+"'\r\n";if((this.anchor)){d+="anchor: {x: "+this.anchor.x+", y: "+this.anchor.y+"}\r\n"}else{d+="anchor: null\r\n"}for(var b=0,a=this.geos.length;b<a;b++){d+=this.geos[b].serialize()+"\r\n"}return d},serverGeographiesComplete:function(){var d=true;var f=null;for(var e=0,a=this.geos.length;e<a;e++){f=this.geos[e];if((f.isServerRendered())&&(!f.getServerGuid())){d=false}}return d},setAnchor:function(a){if(!a){this.anchor=null;return}if((a.x)&&(a.y)){this.anchor={x:a.x,y:a.y}}else{this.anchor=null}},setDefault:function(a){this._isDefault=(a===true)?true:false},setGeographyCount:function(a){this.geoCount=a||0},setKey:function(a){this.key=a||this.getId("svg")},setLabel:function(a){this.label=a||"Geography"},setName:function(a){this.name=a||"Geography"},setRadiiAttributes:function(b){var h=null;var a=[];if(b.r){h=this._aggregateGeographies();this.removeAllGeographies()}else{h=this.geos}var j=null;var f,k;k=h.length;for(f=0;f<k;f++){j=h[f];var l=null;var e=null;var d=null;if(b.u){if(b.u.indexOf("DT|")!=-1){l=b.u.split("|")[1];e=b.u.split("|")[2];d=aw.Geography.Drivetime;geoClassName="aw.Geography.Drivetime"}else{l=b.u;d=aw.Geography.Radius;geoClassName="aw.Geography.Radius"}}else{l=j.getUnits();e=j.getDataset();if(j.CLASS_NAME=="aw.Geography.Radius"){d=aw.Geography.Radius;geoClassName="aw.Geography.Radius"}else{if(j.CLASS_NAME=="aw.Geography.Drivetime"){d=aw.Geography.Drivetime;geoClassName="aw.Geography.Drivetime"}}}if(l&&d){var m=j.getCentroid();var n=j.label;if(b.r){b.r.each(function(g){n=g+" "+((geoClassName=="aw.Geography.Drivetime")?"Minute Drivetime":((l.toLowerCase()=="kilometers")?"Kilometer Radius":"Mile Radius"));this.addGeography(new d(null,j.name,n,g,m.x,m.y,l,e))},this)}else{n=j.radius+" "+((geoClassName=="aw.Geography.Drivetime")?"Minute Drivetime":((l.toLowerCase()=="kilometers")?"Kilometer Radius":"Mile Radius"));this.addGeography(new d(null,j.name,j.label,j.radius,m.x,m.y,l,e));a.push(j.key)}}}if(a.length>0){k=a.length;for(f=0;f<k;f++){this.removeGeography(a[f])}}},setSavedGeo:function(a,b){if(a===true&&b!==""){this._savedGeo=true;this._savedGeoName=b}},summarizeRadii:function(a){this._sumRadii=(a===true?true:false)},_aggregateGeographies:function(){var e=[];var b=this.geos.slice(0);for(var d=0,a=b.length;d<a;d++){b[d].include=false}for(var h=0;h<b.length;h++){if((b[h].CLASS_NAME==="aw.Geography.Radius")||(b[h].CLASS_NAME==="aw.Geography.Drivetime")){var k=b[h].getCentroid();var f=b[h].getRadius();var d=this._containsCentroid(e,b[h].CLASS_NAME,k);if(d<0){e.push({type:b[h].CLASS_NAME,x:k.x,y:k.y,radius:f,index:h})}else{if(f>e[d].radius){e[d].radius=f;e[d].index=h}}}else{b[h].include=true}}for(var d=0,a=e.length;d<a;d++){b[e[d].index].include=true}var j=[],h=null;for(var d=0,a=b.length;d<a;d++){h=b[d];if(h.include===true){j.push(h)}}return j},_containsCentroid:function(a,f,e){var b=-1;for(var d=0;d<a.length;d++){if((f==a[d].type)&&(a[d].x.roundTo(6)==e.x.roundTo(6))&&(a[d].y.roundTo(6)==e.y.roundTo(6))){b=d;break}}return b},_setGeoUpdated:function(){this._geoUpdated=true},CLASS_NAME:"aw.GeographyCollection"});aw.GeographyManager=Class.create(aw.base,{allocateDataset:null,guzzlerDataset:null,activeGeography:null,activeIndexBase:null,defaultGeography:null,searchKey:null,geographySettings:null,_allocateDatasets:[],_guzzlerDatasets:[],_geographyPermissions:null,_savedGeographies:[],_historyGeographies:[],initialize:function(b,a){this.allocateDataset=null;this.guzzlerDataset=null;this.activeGeography=null;this.activeIndexBase=null;this.defaultGeography=null;this.searchKey=null;this.geographySettings=null;this._allocateDatasets=[];this._guzzlerDatasets=[];this._geographyPermissions=null;this._savedGeographies=[];this._historyGeographies=[];aw.base.prototype.initialize.apply(this,[b,a]);this.componentBus.getComponentReferences("aw.UserDataManager",function(d){if((d)&&(d.length>0)){var e=d[0];this._onUserDataActionExecuted_fx=this._onUserDataActionExecuted.bind(this);e.registerEvent("onactionexecuted",this._onUserDataActionExecuted_fx)}}.bind(this),false);this._initializeGeographies()},computeBounds:function(b){var l=[],e=[];var h=b.geos;if((!b)||(!h)||(h.length<=0)){l="";e=""}else{var j=true;var d=null;var f=null;for(var g=0;f=h[g];g++){if((!d)&&(f.dataset)&&(f.dataset!="*")){d=f.dataset}if(!f.isServerRendered()){j=false}if(d){if((f.dataset=="*")||(f.dataset.toLowerCase()==d.toLowerCase())){l.push((f.getGeographyDefinition()+"\n"))}}else{if(f.CLASS_NAME.indexOf("aw.Geography.Custom")>-1){e.push(f.getGeographyDefinition())}else{l.push((f.getGeographyDefinition()+"\n"))}}}if(!d){d="*"}if(l.length>0){l="allocate:dataset="+d+";workspace="+l.join("")}if(e.length>0){e="geojson:"+e.join("")}}if(j===true){var a=b.getBounds();this._computeBounds_received(null,null,{payload:{minx:a.minx,miny:a.miny,maxx:a.maxx,maxy:a.maxy}});return}var k={cn:"SRC.Web.Client.Handler.AllocateHandler"+(((this.allocateDataset.variant!==null)&&(this.allocateDataset.variant!==""))?("|"+this.allocateDataset.variant):""),service:"computeBounds",geodef:l};this.request(k,this._computeBounds_received.bind(this,b))},debug:function(){var f=aw.base.prototype.debug.apply(this);f=f||{};f["Allocate Datasets"]=[];f["Active Allocate Dataset"]=null;f["Guzzler Datasets"]=[];f["Active Guzzler Dataset"]=null;var e=0;var a;var d=this._allocateDatasets;if((d)&&(d.length>0)){a=d.length;for(e=0;e<a;e++){f["Allocate Datasets"].push(d[e].variant+" ("+d[e].key+")")}}f["Allocate Datasets"]=f["Allocate Datasets"].join("<br />");if(this.allocateDataset){f["Active Allocate Dataset"]=this.allocateDataset.variant+" ("+this.allocateDataset.key+")"}var b=this._guzzlerDatasets;if((b)&&(b.length>0)){a=b.length;for(e=0;e<a;e++){f["Guzzler Datasets"].push(_guzzlerDatasets[e].description+" ("+_guzzlerDatasets[e].key+")")}}f["Guzzler Datasets"]=f["Guzzler Datasets"].join("<br />");if(this.guzzlerDataset){f["Active Guzzler Dataset"]=this.guzzlerDataset.description+" ("+this.guzzlerDataset.key+")"}return f},destroy:function(){if(this.componentBus){var a=this.componentBus.getComponentReferences("aw.UserDataManager");if((a)&&(a.length>0)){a=a[0];if(this._onUserDataActionExecuted_fx){a.unregisterEvent("onactionexecuted",this._onUserDataActionExecuted_fx);this._onUserDataActionExecuted_fx=null}}a=null}this.allocateDataset=null;this.activeGeography=null;this.activeIndexBase=null;this._allocateDatasets=null;this._guzzlerDatasets=null;aw.base.prototype.destroy.apply(this)},getAllocateDatasetByKey:function(d){if(!d){return null}var b=this._allocateDatasets;if((!b)||(b.length<1)){return null}var e=null;for(var a=0;e=b[a];a++){if(e.key==d){return e}}return null},getAllocateDatasetByVariant:function(d){if(!d){return null}var b=this._allocateDatasets;if((!b)||(b.length<1)){return null}var e=null;for(var a=0;e=b[a];a++){if(e.variant==d){return e}}return null},getAllHistoryGeographies:function(){return this._historyGeographies||[]},getGeographyByKey:function(d){if((!d)&&(!this._historyGeographies)&&(!this._savedGeographies)){return null}var b;var f=null;var a=this._historyGeographies;var e=this._savedGeographies;for(b=0;f=a[b];b++){if(f.key==d){return f}}for(b=0;f=e[b];b++){if(f.key==d){return f}}return null},onAuthenticationSuccess:function(){aw.base.prototype.onAuthenticationSuccess.apply(this);this._initializeGeographies()},onAuthenticationFailure:function(){aw.base.prototype.onAuthenticationFailure.apply(this);this._initializeGeographies()},saveActiveGeography:function(a){if(!this.activeGeography){return}if((!a)||(a.replace(/^\s*|\s*$/gi,"")==="")){new aw.ui.Dialog.Prompt({title:"Save Active Geography",content:"Please enter the name you would like to save your active geography with.",defaultValue:this.activeGeography.name},{onsubmit:function(b){this.saveActiveGeography(b)}.bind(this)})}else{this.saveGeography(a,this.activeGeography,"SavedGeography")}},saveGeography:function(a,e,b){if((!a)||(a.replace(/^\s*|\s*$/gi,"")==="")||(!e)){return}b=b||"SavedGeography";var d=this.componentBus.getComponentReferences("aw.UserDataManager");if((d)&&(d.length>0)){d[0].executeAction({action:"save",datatype:b,name:a,params:e.getGeographyDefinition()})}},search:function(a,d){if((!a)||(a.replace(/\W/gi,"")==="")){return}var b={cn:"SRC.Web.Client.Handler.GeographyHandler",service:"search",search:a,wkey:this.searchKey};this.request(b,function(g,e,f){if(!g){this.triggerEvent("onsearchreceived",f.payload);return}g(f.payload)}.bind(this,d))},setActiveGeography:function(j,f,e,d,h,g){if(!j){return}if((j.requiresServerGeography())&&(!j.serverGeographiesComplete())){this._generateServerGeographies(j,this.setActiveGeography.bind(this,j,f,e,d,h,g));return}this.activeGeography=j;if((this.isSessionValidated()===true)||(this.isValidating()===true)){this.saveGeography(j.name,j,"HistoryGeography")}var a=j.getBounds();e=(a.minx===0?e:Math.min(a.minx,e));d=(a.miny===0?d:Math.min(a.miny,d));h=(a.maxx===0?h:Math.max(a.maxx,h));g=(a.maxy===0?g:Math.max(a.maxy,g));this.triggerEvent("onactivegeographychanged",j,f,e,d,h,g)},setActiveIndexBase:function(a){if(!a){this.activeIndexBase=null}else{if((a.requiresServerGeography())&&(!a.serverGeographiesComplete())){this._generateServerGeographies(a,this.setActiveIndexBase.bind(this,a));return}this.activeIndexBase=a;this.triggerEvent("onactiveindexbasechanged",a)}},setAllocateDataset:function(e){if(!e){return}var b=this._allocateDatasets;if((!b)||(b.length<1)){return}var f=null;for(var a=0;f=b[a];a++){if(f===e){this.allocateDataset=f;this.triggerEvent("onallocatedatasetchanged",this.allocateDataset);this._getHistoryGeographies();return}}throw"Could not locate dataset!"},setAllocateDatasetByKey:function(a){this.setAllocateDataset(this.getAllocateDatasetByKey(a))},setAllocateDatasetByVariant:function(a){this.setAllocateDataset(this.getAllocateDatasetByVariant(a))},setGuzzlerDataset:function(e){if(!e){return}var a=this._guzzlerDatasets;if((!a)||(a.length<1)){return}var f=null;for(var b=0;f=a[b];b++){if(f===e){this.guzzlerDataset=f;this.triggerEvent("onguzzlerdatasetchanged",this.guzzlerDataset);return}}throw"Could not locate dataset!"},validateRadii:function(e,s){if((!e)||(e==="")||(!s)){return{isGood:false,message:"Ranges or units not specified."}}var u;var b=100;var j=0;var k=125;var p=2;var d=90;var l=32000;var g=50000;var q=26000;var v=(s.toLowerCase().indexOf("dt|")===0);var t=(s.toLowerCase()=="kilometers");var f=v?d:((t)?k:b);var a=v?p:j;var n=v?q:((t)?g:l);var m=(v?"minutes":s).toLowerCase();e=e.replace(/[^\d|\,|\.]*/gi,"").split(",");var o=[];var h=0;for(u=0;range=e[u];u++){if((range==="")||(!isNaN(range))){if((parseFloat(range)<a)||(parseFloat(range)>f)){return{isGood:false,message:(v?"Drivetimes":"Radii")+" must be between "+a+" and "+f+" "+m+"."}}o.push(parseFloat(range));h+=(parseFloat(range)*parseFloat(range)*Math.PI)}else{return{isGood:false,message:"The "+(v?"drivetime":"radius")+' "'+range+'" is not valid.'}}}if((!o)||(!o.length>0)){return{isGood:false,message:"No valid ranges specified."}}if(h>n){return{isGood:false,message:(v?"You have exceeded the maximum total Drivetime size. Please select fewer points or smaller drivetimes.":("The maximum square "+s.toLowerCase()+" allowed for a point radii geography is "+n+" while your current geography is "+Math.floor(h)+" square "+s.toLowerCase()+". Please select fewer points or smaller radii."))}}return{isGood:true,ranges:o.sortNum()}},_computeBounds_received:function(d,e,a){if((!a)||(!a.payload)){return}var j=a.payload;var l=j.minx;var k=j.miny;var g=j.maxx;var f=j.maxy;if(d){var h=d.getBounds();l=(h.minx===0?l:Math.min(h.minx,l));k=(h.miny===0?k:Math.min(h.miny,k));g=(h.maxx===0?g:Math.max(h.maxx,g));f=(h.maxy===0?f:Math.max(h.maxy,f))}this.triggerEvent("onboundschanged",l,k,g,f)},_generateServerGeographies:function(b,o){if(!b){return}var f=null;var k=b.geos;for(var h=0;f=k[h];h++){if(f.isServerRendered()){if(f.derivesFrom("aw.Geography.Radius")===true){var p=(f.derivesFrom("aw.Geography.Drivetime")===true)?true:false;var e={cn:"SRC.Web.Client.Handler.GuzzlerHandler"+((p===true)?("|"+((f.getDataset()&&f.getDataset()!="*")?f.getDataset():this.guzzlerDataset.key)):""),service:(p===true)?"generateDrivetime":"generateRadius",key:f.key,x:f.getCentroid().x,y:f.getCentroid().y,u:f.getUnits(),label:f.name,writeFile:true};if(p===true){e.t=f.getRadius()}else{e.r=f.getRadius()}this.request(e,this._serverGeography_created.bind(this,b,o))}else{if(f.derivesFrom("aw.Geography.Custom")===true){var q=new OpenLayers.Format.GeoJSON();var l=q.read(f.geoJson,"Geometry");var a=null;if(l instanceof Array){var s=null;var m=l.length;for(var d=0;d<m;d++){s=l[d];if(s.geometry){if(!a){a=s.geometry.getBounds()}else{a=a.extend(s.geometry.getBounds())}}}}else{a=l.getBounds()}var n=a.toArray();this.request({cn:"SRC.Web.Client.Handler.AlteryxHandler",service:"generatePolygonFromGeoJson",key:f.key,name:f.name,geojson:q.write(l),bl:n[0],bb:n[1],br:n[2],bt:n[3],writeFile:true},this._serverGeography_created.bind(this,b,o))}}}}},_getAllocateDatasets:function(){this._allocateDatasets=[];this.allocateDataset=null;var a={cn:"SRC.Web.Client.Handler.AllocateHandler",service:"listDatasets"};this.request(a,function(f,g){if((g)&&(g.payload)&&(g.payload.length>0)){var e=null;var d=g.payload;for(var b=0;e=d[b];b++){this._allocateDatasets.push(e)}this.triggerEvent("onallocatedatasetschanged",this._allocateDatasets);if(!this.allocateDataset){this.setAllocateDataset(this._allocateDatasets[0])}}}.bind(this))},_getGeographyPermissions:function(){var a={cn:"SRC.Web.Client.Handler.GeographyHandler",service:"getUserSettings"};this.request(a,function(f,h){if((!h)||(!h.payload)){return}var e=h.payload;this.geographySettings=e;this.triggerEvent("ongeographysettingsreceived",e);if((e.enableDrivetimeGeography!==true)&&(this.activeGeography)&&(this.activeGeography.contains("aw.Geography.Drivetime"))){var d=null;var g=this.activeGeography.geos;for(var b=0;d=g[b];b++){if(d.CLASS_NAME=="aw.Geography.Drivetime"){d=new aw.Geography.Radius(null,d.name,d.label,d.radius,d.centroid.x,d.centroid.y,"Miles")}}this.setActiveGeography(this.activeGeography,false)}}.bind(this))},_getGuzzlerDatasets:function(){this._guzzlerDatasets=[];this.guzzlerDataset=null;var a={cn:"SRC.Web.Client.Handler.GuzzlerHandler",service:"listDatasets"};this.request(a,function(f,g){if(!g||!g.payload){return}var e=g.payload;if(e.length>0){var d=null;for(var b=0;d=e[b];b++){this._guzzlerDatasets.push(d)}this.triggerEvent("onguzzlerdatasetschanged",this._guzzlerDatasets);if(!this.guzzlerDataset){this.setGuzzlerDataset(this._guzzlerDatasets[0])}}}.bind(this))},_getHistoryGeographies:function(){this.componentBus.getComponentReferences("aw.UserDataManager",function(a){if((a)&&(a.length>0)){a[0].retrieveData("HistoryGeography",null,null,function(b){this._historyGeographies=b||[];this.triggerEvent("onhistorygeographieschanged",this._historyGeographies)}.bind(this))}}.bind(this),false)},_getSavedGeographies:function(){this.componentBus.getComponentReferences("aw.UserDataManager",function(a){if((a)&&(a.length>0)){a[0].retrieveData("SavedGeography",null,null,function(b){this._savedGeographies=b||[];this.triggerEvent("onsavedgeographieschanged",this._savedGeographies)}.bind(this))}}.bind(this),false)},_initializeGeographies:function(){this._getAllocateDatasets();this._getGuzzlerDatasets();this._getGeographyPermissions()},_onUserDataActionExecuted:function(a){if(!a){return}if(a.datatype=="HistoryGeography"){this._getHistoryGeographies()}else{if(((a.datatype=="CustomPolygon")||(a.datatype=="SavedGeography"))&&(a.action=="Make Active Geography")){this.setActiveGeography(a.params.geoCollection,true)}}},_serverGeography_created:function(b,k,d,a){var f=null;var g=b.geos;var h=a.payload;var j=false;for(var e=0;f=g[e];e++){if(h.key==f.key){f._serverUser=(h.user?h.user:"");f._serverGuid=(h.guid?h.guid:"-1");f.setBounds(h.bounds);j=true}}if((j===true)&&(b.serverGeographiesComplete())&&(k)){k()}},EVENTS:["onactivegeographychanged","onactiveindexbasechanged","onallocatedatasetchanged","onallocatedatasetschanged","onboundschanged","ongeographysettingsreceived","onguzzlerdatasetchanged","onguzzlerdatasetschanged","onhistorygeographieschanged","onsavedgeographieschanged","onsearchreceived"],VALID_PROPERTIES:["componentBus","defaultGeography","searchKey"],CLASS_NAME:"aw.GeographyManager"});namespace.create("aw.Hash");aw.Hash.SHA1=Class.create({_hexcase:0,_b64pad:"",_chrsz:8,initialize:function(){},toHex:function(a){return this._binb2hex(this._core_sha1(this._str2binb(a),a.length*this._chrsz))},toBase64:function(a){return this._binb2b64(this._core_sha1(this._str2binb(a),a.length*this._chrsz))},toStr:function(a){return this._binb2str(this._core_sha1(this._str2binb(a),a.length*this._chrsz))},_test:function(){return this.toHex("abc")=="a9993e364706816aba3e25717850c26c9cd0d89d"},_core_sha1:function(z,o){z[o>>5]|=128<<(24-o%32);z[((o+64>>9)<<4)+15]=o;var A=Array(80);var v=1732584193;var u=-271733879;var s=-1732584194;var q=271733878;var p=-1009589776;for(var l=0;l<z.length;l+=16){var n=v;var m=u;var k=s;var h=q;var f=p;for(var g=0;g<80;g++){if(g<16){A[g]=z[l+g]}else{A[g]=this._rol(A[g-3]^A[g-8]^A[g-14]^A[g-16],1)}var B=this._safe_add(this._safe_add(this._rol(v,5),this._sha1_ft(g,u,s,q)),this._safe_add(this._safe_add(p,A[g]),this._sha1_kt(g)));p=q;q=s;s=this._rol(u,30);u=v;v=B}v=this._safe_add(v,n);u=this._safe_add(u,m);s=this._safe_add(s,k);q=this._safe_add(q,h);p=this._safe_add(p,f)}return Array(v,u,s,q,p)},_sha1_ft:function(e,a,g,f){if(e<20){return(a&g)|((~a)&f)}if(e<40){return a^g^f}if(e<60){return(a&g)|(a&f)|(g&f)}return a^g^f},_sha1_kt:function(a){return(a<20)?1518500249:(a<40)?1859775393:(a<60)?-1894007588:-899497514},_core_hmac_sha1:function(d,g){var f=this._str2binb(d);if(f.length>16){f=this._core_sha1(f,d.length*this._chrsz)}var a=Array(16),e=Array(16);for(var b=0;b<16;b++){a[b]=f[b]^909522486;e[b]=f[b]^1549556828}var h=this._core_sha1(a.concat(this._str2binb(g)),512+g.length*this._chrsz);return this._core_sha1(e.concat(h),512+160)},_safe_add:function(a,e){var d=(a&65535)+(e&65535);var b=(a>>16)+(e>>16)+(d>>16);return(b<<16)|(d&65535)},_rol:function(a,b){return(a<<b)|(a>>>(32-b))},_str2binb:function(e){var d=Array();var a=(1<<this._chrsz)-1;for(var b=0;b<e.length*this._chrsz;b+=this._chrsz){d[b>>5]|=(e.charCodeAt(b/this._chrsz)&a)<<(32-this._chrsz-b%32)}return d},_binb2str:function(d){var e="";var a=(1<<this._chrsz)-1;for(var b=0;b<d.length*32;b+=this._chrsz){e+=String.fromCharCode((d[b>>5]>>>(32-this._chrsz-b%32))&a)}return e},_binb2hex:function(d){var b=this._hexcase?"0123456789ABCDEF":"0123456789abcdef";var e="";for(var a=0;a<d.length*4;a++){e+=b.charAt((d[a>>2]>>((3-a%4)*8+4))&15)+b.charAt((d[a>>2]>>((3-a%4)*8))&15)}return e},_binb2b64:function(e){var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var g="";for(var b=0;b<e.length*4;b+=3){var f=(((e[b>>2]>>8*(3-b%4))&255)<<16)|(((e[b+1>>2]>>8*(3-(b+1)%4))&255)<<8)|((e[b+2>>2]>>8*(3-(b+2)%4))&255);for(var a=0;a<4;a++){if(b*8+a*6>e.length*32){g+=this._b64pad}else{g+=d.charAt((f>>6*(3-a))&63)}}}return g},CLASS_NAME:"aw.Hash.SHA1"});aw.HelpManager=Class.create(aw.base,{helpContent:[],initialize:function(b,a){this.helpContent=[];aw.base.prototype.initialize.apply(this,[b,a])},clearHelpContent:function(){this.helpContent=[];this.triggerEvent("helpcontentcleared")},getTopicByTitle:function(h){if((!h)||(!this.helpContent)||(!this.helpContent.length>0)){return null}var d;var b,g;var j=((arguments)&&(arguments.length==2))?arguments[1]:this.helpContent;var a=j.length;var f=h.split(":");var e=f.splice(0,1)[0];for(d=0;d<a;d++){b=j[d];g=b.topics;if(e.toLowerCase()==b.title.toLowerCase()){if((f.length>0)&&(g)&&(g.length>0)){return this.getTopicByTitle(f.join(":"),g)}else{return b}}}return null},loadHelpContent:function(a){this.helpContent=((this.helpContent)&&(this.helpContent.length>0))?this.helpContent.concat(a):(a||[]);this.triggerEvent("helpcontentloaded",this.helpContent)},loadHelpFile:function(b,a){if((!this.componentBus)||(!b)||(!a)){return}if(window[a]){throw"Loading this help document will result in overriding an existing variable namespace."}this.componentBus.loadScript(b,this._helpFileLoaded.bind(this,a))},_helpFileLoaded:function(b,d){if((!b)||(!window[b])){return}var a=window[b];this.loadHelpContent(a);if(d){Element.remove(d)}delete window[b]},EVENTS:["helpcontentcleared","helpcontentloaded"],CLASS_NAME:"aw.HelpManager"});aw.Icon=Class.create(aw.base,{name:null,src:null,akey:null,skey:null,server:null,initialize:function(b,a){this.name=null;this.src=null;this.akey=null;this.skey=null;this.server=null;aw.base.prototype.initialize.apply(this,arguments)},getType:function(){if(!this.src){return null}var a=this.src.split(":");if(a){if(a[0].toLowerCase().match("http|https")){return"url"}else{if((a.length>2)&&(a[2].toLowerCase().match("server"))){return a[2]}}}return"unknown"},getIcon:function(){if(!this.src){return null}var a=this.src.split(":");if((a)&&(a.length>3)){return a[3]}return null},toURL:function(){if((!this.src)||(this.src==="")){return null}var a=this.getType();var b=null;switch(a){case"server":b=this.server+"?cn=SRC.Web.Client.Handler.ImageHandler&service=streamimage&name="+this.src+"&akey="+this.akey+((this.skey)?("&skey="+this.skey):"");break;case"url":b=this.src;break;default:throw"Unknown icon type"}return b},VALID_PROPERTIES:["name","src","server","skey","akey"],CLASS_NAME:"aw.Icon"});aw.IconManager=Class.create(aw.base,{initialize:function(b,a){aw.base.prototype.initialize.apply(this,[b,a]);this._initializeIcons()},onAuthenticationSuccess:function(){aw.base.prototype.onAuthenticationSuccess.apply(this);this._initializeIcons()},onAuthenticationFailure:function(){aw.base.prototype.onAuthenticationFailure.apply(this);this._initializeIcons()},_initializeIcons:function(){aw.icons=[];var a={cn:"SRC.Web.Client.Handler.ImageHandler",service:"retrieve"};this.request(a,function(g,h){if((!h)||(!h.payload)||(!h.payload.icons)){return}var f;var d=null;var e=h.payload.icons;var b=e.length;for(f=0;f<b;f++){d=new aw.Icon({name:e[f].name,src:e[f].value,server:this.componentBus.getComponentServer(),skey:this.componentBus.getSessionKey(),akey:this.componentBus.getApplicationKey()});aw.icons.push(d)}}.bind(this))},VALID_PROPERTIES:["componentBus"],CLASS_NAME:"aw.IconManager"});aw.icons=[];aw.Messenger=Class.create(aw.base,{_messages:[],initialize:function(b,a){this._messages=[];aw.base.prototype.initialize.apply(this,arguments)},getMessages:function(){return this._messages||[]},loadMessageFile:function(b,a){if((!this.componentBus)||(!b)||(!a)){return}if(window[a]){throw"Loading this message file will result in overriding an existing variable namespace."}this.componentBus.loadScript(b,this._messageFileLoaded.bind(this,a))},loadMessages:function(e){this._messages=e;this.triggerEvent("messagesloaded",this._messages);var f=[];if((this._messages)&&(this._messages.length>0)){var a=null,g=new Date();for(var b=0;b<this._messages.length;b++){a=this._messages[b];id=new Date(a.startDate).getTime()+new Date(a.endDate).getTime();c=this.readCookie("awm"+id);if((a.active===true)&&((!a.startDate)||(new Date(a.startDate)<g))&&((!a.endDate)||(new Date(a.endDate)>g))){if((c)&&((c=="true")||(c===true))){a.shown=true}f.push(a);var g=(a.endDate)?(parseInt(new Date(a.endDate).getTime()-new Date().getTime(),10)/1000/60/60/24):30;this.createCookie("awm"+id,"true",g)}}if((f)&&(f.length>0)){this.triggerEvent("activemessages",f)}}},_messageFileLoaded:function(b,a){if((!b)||(!window[b])){return}this.loadMessages(window[b]);if(a){aw.Element.remove(a);a=null}},EVENTS:["messagesloaded","activemessages"],VALID_PROPERTIES:["componentBus"],CLASS_NAME:"aw.Messenger"});aw.Object={toQueryString:function(h){var j=[],g=null,b=null,d=null;for(var f in h){g=encodeURIComponent(f);b=h[f];d=typeof b;if((b)&&(d==="object")){if(b instanceof Array){for(var e=0,a=b.length;e<a;e++){j.push(g+"="+encodeURIComponent(b[e]))}}}else{if(b){j.push(g+"="+encodeURIComponent(b))}}}return j.join("&")}};aw.Query=Class.create(aw.base,{count:-1,initialize:function(b,a){this.count=-1;aw.base.prototype.initialize.apply(this,arguments)},serialize:function(){return""},CLASS_NAME:"aw.Query"});aw.Query.Filter=Class.create(aw.Query,{inverse:false,name:"",label:"",verb:null,_supportedTypes:[],initialize:function(b,a){this.inverse=false;this.name="";this.label="";this.verb=null;this._supportTypes=[];aw.Query.prototype.initialize.apply(this,arguments)},getSummaryLabel:function(){return""},supportsType:function(d){if((!d)||(!this._supportedTypes)||(!this._supportedTypes.length>0)){return false}var a=false;for(var b=0;b<this._supportedTypes.length;b++){if(this._supportedTypes[b].toLowerCase()==d.toLowerCase()){a=true}}return a},CLASS_NAME:"aw.Query.Filter"});aw.Query.Filter.Begins=Class.create(aw.Query.Filter,{value:null,initialize:function(b,a){this.value=null;aw.Query.Filter.prototype.initialize.apply(this,arguments);this.verb="begins";this._supportedTypes=["Contains","AString","WString"]},getSummaryLabel:function(){return(""+(this.inverse===true?"Not: ":"")+this.label+" begins with "+this.value+" ("+parseFloat(this.count).addCommas()+")")},serialize:function(){var a=[];if(this.inverse===true){a.push("<Not>")}a.push('<Field name="'+this.name.replace(/&/gi,"&#38;")+'" id="'+this.id+'" type="begin" value="'+this.value.replace(/&/gi,"&#38;")+'" />');if(this.inverse===true){a.push("</Not>")}return a.join("")},setValue:function(a){this.value=a},VALID_PROPERTIES:["name","label","value"],CLASS_NAME:"aw.Query.Filter.Begins"});aw.Query.Filter.Contains=Class.create(aw.Query.Filter,{value:null,initialize:function(b,a){this.value=null;aw.Query.Filter.prototype.initialize.apply(this,arguments);this.verb="contains";this._supportedTypes=["Contains"]},getSummaryLabel:function(){return(""+(this.inverse===true?"Not: ":"")+this.label+" contains "+this.value+" ("+parseFloat(this.count).addCommas()+")")},serialize:function(){var a=[];if(this.inverse===true){a.push("<Not>")}a.push('<Field name="'+this.name.replace(/&/gi,"&#38;")+'" id="'+this.id+'" type="contains" value="'+this.value.replace(/&/gi,"&#38;")+'" />');if(this.inverse===true){a.push("</Not>")}return a.join("")},setValue:function(a){this.value=a},VALID_PROPERTIES:["name","label","value"],CLASS_NAME:"aw.Query.Filter.Contains"});aw.Query.Filter.Ends=Class.create(aw.Query.Filter,{value:null,initialize:function(b,a){this.value=null;aw.Query.Filter.prototype.initialize.apply(this,arguments);this.verb="ends";this._supportedTypes=["Contains","AString","WString"]},getSummaryLabel:function(){return(""+(this.inverse===true?"Not: ":"")+this.label+" ends with "+this.value+" ("+parseFloat(this.count).addCommas()+")")},serialize:function(){var a=[];if(this.inverse===true){a.push("<Not>")}a.push('<Field name="'+this.name.replace(/&/gi,"&#38;")+'" id="'+this.id+'" type="end" value="'+this.value.replace(/&/gi,"&#38;")+'" />');if(this.inverse===true){a.push("</Not>")}return a.join("")},setValue:function(a){this.value=a},VALID_PROPERTIES:["name","label","value"],CLASS_NAME:"aw.Query.Filter.Ends"});aw.Query.Filter.Is=Class.create(aw.Query.Filter,{value:null,initialize:function(b,a){this.value=null;aw.Query.Filter.prototype.initialize.apply(this,arguments);this.verb="is";this._supportedTypes=["Contains","AString","WString","Double","Byte","Int64","Int16","Float"]},getSummaryLabel:function(){return(""+(this.inverse===true?"Not: ":"")+this.label+" is "+this.value+" ("+parseFloat(this.count).addCommas()+")")},serialize:function(){var a=[];if(this.inverse===true){a.push("<Not>")}a.push('<Field name="'+this.name.replace(/&/gi,"&#38;")+'" id="'+this.id+'" type="value" value="'+this.value.replace(/&/gi,"&#38;")+'" />');if(this.inverse===true){a.push("</Not>")}return a.join("")},setValue:function(a){this.value=a},VALID_PROPERTIES:["name","label","value"],CLASS_NAME:"aw.Query.Filter.Is"});aw.Query.Filter.List=Class.create(aw.Query.Filter,{values:[],initialize:function(b,a){this.values=[];aw.Query.Filter.prototype.initialize.apply(this,arguments);this.verb="list";this._supportedTypes=["Contains","AString","WString","Double","Byte","Int64","Int16","Float"]},addValue:function(a){if(!a){return}this.values.push(a)},clear:function(){this.values=[]},getSummaryLabel:function(){if(this.values.length==1){return(""+((this.inverse===true)?"Not: ":"")+this.label+" is "+this.values[0]+" ("+parseFloat(this.count).addCommas()+")")}else{if(this.values.length>1){var d=[];var a=this.values.length-1;for(var b=0;b<a;b++){d.push(this.values[b])}d=d.join(", ")+" or "+this.values[a];return(""+((this.inverse===true)?"Not: ":"")+this.label+" is "+d+" ("+parseFloat(this.count).addCommas()+")")}}return""},removeValue:function(d){if((!d)||(!this.values)||(!this.values.length>0)){return}var a=[];for(var b=0;b<this.values.length;b++){if(this.values[b]!=d){a.push(this.values[b])}}this.values=a},serialize:function(){var b=[];if((this.values)&&(this.values.length>0)){b.push(('<Field name="'+this.name.replace(/&/gi,"&#38;")+'" id="'+this.id+'" type="list">'));for(var a=0;a<this.values.length;a++){b.push(("<value>"+this.values[a].replace(/&/gi,"&#38;")+"</value>"))}b.push("</Field>")}return""+((this.inverse===true)?"<Not>":"")+b.join("")+((this.inverse===true)?"</Not>":"")},VALID_PROPERTIES:["name","label","values"],CLASS_NAME:"aw.Query.Filter.List"});aw.Query.Filter.ListBegin=Class.create(aw.Query.Filter.List,{values:[],initialize:function(b,a){this.values=[];aw.Query.Filter.List.prototype.initialize.apply(this,arguments);this.verb="listBegin";this._supportedTypes=["Contains","AString","WString","Double","Byte","Int64","Int16","Float"]},getSummaryLabel:function(){if(this.values.length==1){return(""+((this.inverse===true)?"Not: ":"")+this.label+" begins with "+this.values[0]+" ("+parseFloat(this.count).addCommas()+")")}else{if(this.values.length>1){var d=[];var a=this.values.length-1;for(var b=0;b<a;b++){d.push(this.values[b])}d=d.join(", ")+" or "+this.values[a];return(""+((this.inverse===true)?"Not: ":"")+this.label+" begins with "+d+" ("+parseFloat(this.count).addCommas()+")")}}return""},serialize:function(){var b=[];if((this.values)&&(this.values.length>0)){b.push(('<Field name="'+this.name.replace(/&/gi,"&#38;")+'" id="'+this.id+'" type="listBegin">'));for(var a=0;a<this.values.length;a++){b.push(("<value>"+this.values[a].replace(/&/gi,"&#38;")+"</value>"))}b.push("</Field>")}return""+((this.inverse===true)?"<Not>":"")+b.join("")+((this.inverse===true)?"</Not>":"")},CLASS_NAME:"aw.Query.Filter.ListBegin"});aw.Query.Filter.Null=Class.create(aw.Query.Filter,{initialize:function(b,a){aw.Query.Filter.prototype.initialize.apply(this,arguments);this.verb="null";this._supportedTypes=["Contains","AString","WString","Double","Byte","Int64","Int16","Float"]},getSummaryLabel:function(){return(""+(this.inverse===true?"Not: ":"")+this.label+" is null ("+parseFloat(this.count).addCommas()+")")},serialize:function(){var a=[];if(this.inverse===true){a.push("<Not>")}a.push('<Field name="'+this.name.replace(/&/gi,"&#38;")+'" id="'+this.id+'" type="isNull" />');if(this.inverse===true){a.push("</Not>")}return a.join("")},VALID_PROPERTIES:["name","label","value"],CLASS_NAME:"aw.Query.Filter.Null"});aw.Query.Filter.Range=Class.create(aw.Query.Filter,{begins:null,ends:null,includeBegins:true,includeEnds:true,initialize:function(b,a){this.begins=null;this.ends=null;this.includeBegins=true;this.includeEnds=true;aw.Query.Filter.prototype.initialize.apply(this,arguments);this.verb="range";this._supportedTypes=["AString","WString","Double","Byte","Int64","Int16","Float"]},getSummaryLabel:function(){var b=(isNaN(parseFloat(this.begins))?this.begins:parseFloat(this.begins).addCommas());var a=(isNaN(parseFloat(this.ends))?this.ends:parseFloat(this.ends).addCommas());return(""+(this.inverse===true?"Not: ":"")+this.label+" is between "+b+" and "+a+" ("+parseFloat(this.count).addCommas()+")")},serialize:function(){var a=[];if(this.inverse===true){a.push("<Not>")}a.push('<Field name="'+this.name.replace(/&/gi,"&#38;")+'" id="'+this.id+'" type="range" begin="'+this.begins+'" includeBegin="'+this.includeBegins+'" end="'+this.ends+'" includeEnd="'+this.includeEnds+'" />');if(this.inverse===true){a.push("</Not>")}return a.join("")},setRangeBegin:function(b,a){this.begins=parseFloat(b);this.includeBegins=(a===false)?false:true},setRangeEnd:function(b,a){this.ends=parseFloat(b);this.includeEnds=(a===false)?false:true},VALID_PROPERTIES:["name","label","begins","ends"],CLASS_NAME:"aw.Query.Filter.Range"});aw.Query.Filter.Spatial=Class.create(aw.Query.Filter,{geoCollection:null,initialize:function(b,a){this.geoCollection=null;aw.Query.Filter.prototype.initialize.apply(this,arguments)},getSummaryLabel:function(){return(""+((this.inverse===true)?"Not: ":"")+"Records are within "+this.geoCollection.name+" ("+parseInt(this.count,10).addCommas()+")")},serialize:function(){var a=[];if(this.inverse===true){a.push("<Not>")}a.push('<SpatialField name="SpatialObj" id="'+this.id+'"/>');if(this.inverse===true){a.push("</Not>")}return a.join("")},VALID_PROPERTIES:["geoCollection"],CLASS_NAME:"aw.Query.Filter.Spatial"});aw.Query.Operator=Class.create(aw.Query,{operator:null,items:[],initialize:function(b,a){this.operator=null;this.items=[];aw.Query.prototype.initialize.apply(this,arguments);if((!this.operator)||((this.operator!="And")&&(this.operator!="Or"))){throw"An invalid query operator was provided."}},add:function(a){if((!a)||(a.derivesFrom("aw.Query")!==true)){return}this.items.push(a)},clear:function(){this.items=[]},getFilterBy:function(f){if(!f){return null}var e=true,b=null;for(b in f){if(this[b]!==f[b]){e=false}}if(e===true){return this}if((!this.items)||(!this.items.length>0)){return null}var d=null;for(var a=0;d=this.items[a];a++){e=true;for(b in f){if((b=="supports")&&(d.supportsType)){if(d.supportsType(f[b])!==true){e=false}}else{if(d[b]!==f[b]){e=false}}}if(e===true){return d}if((d.getFilterBy)&&(d.getFilterBy(f))){return d.getFilterBy(f)}}return null},getItemsByClassName:function(g){if((!g)||(!this.items)||(!this.items.length>0)){return null}var a=[],h=[];var f=null,e=null;for(var d=0;f=this.items[d];d++){if(f.derivesFrom(g)){a.push(f)}if(f.getItemsByClassName){h=f.getItemsByClassName(g);if((h)&&(h.length>0)){for(var b=0;e=h[b];b++){a.push(e)}}}}return a},getItemById:function(f){if((!f)||(!this.items)||(!this.items.length>0)){return null}var e=null,d=null;for(var b=0;e=this.items[b];b++){if(e.id==f){return e}if((e.items)&&(e.items.length>0)){for(var a=0;d=e.items[a];a++){if(d.id==f){return d}}}}return null},remove:function(e){if((!e)||(!this.items)||(!this.items.length>0)){return}var b=[];for(var d=0,a=this.items.length;d<a;d++){if(this.items[d]!==e){b.push(this.items[d])}}this.items=b},serialize:function(){var b=[];if((this.items)&&(this.items.length>0)){b.push("<"+this.operator+' id="'+this.id+'">');var d=null;for(var a=0;d=this.items[a];a++){b.push(d.serialize())}b.push("</"+this.operator+">")}else{b.push("<"+this.operator+' id="'+this.id+'" />')}return b.join("")},VALID_PROPERTIES:["operator","items"],CLASS_NAME:"aw.Query.Operator"});aw.QueryManager=Class.create(aw.base,{activeQuery:null,activeQueryDataset:null,activeFieldIndex:null,_queryDatasets:[],_fieldIndices:null,_datasetIsSpatial:false,_countRequestTimeout:null,initialize:function(b,a){this.activeQuery=null;this.activeQueryDataset=null;this.activeFieldIndex=null;this._queryDatasets=[];this._datasetMetadata=null;this._datasetIsSpatial=false;this._fieldIndices=null;this._countRequestTimeout=null;aw.base.prototype.initialize.apply(this,[b,a]);this._initializeQueries()},buildQueryObject:function(a){return this._buildQueryObject(a)},clearActiveQuery:function(){this.activeQuery=null;this.triggerEvent("onactivequerychanged",null)},getAllQueryDatasets:function(){return this._queryDatasets||[]},getFieldIndexByName:function(b){if((!b)||(!this._fieldIndices)){return null}var d;var f=null;var a;var e;var g=this._fieldIndices;b=b.toLowerCase();for(e in g){a=g[e].fields;for(d=0;f=a[d];d++){if(f.name.toLowerCase()==b){return f}}}return null},getFieldIndexByShortName:function(b){if((!name)||(!this._fieldIndices)){return null}var d;var f=null;var a;var e;var g=this._fieldIndices;b=b.toLowerCase();for(var e in g){a=g[e].fields;for(d=0;f=a[d];d++){if(f.shortName.toLowerCase()==b){return f}}}return null},getFilterClassByVerb:function(f){if(!f){return null}var b;var a=aw.Query.Filter.subclasses;var e=null;var d=null;f=f.toLowerCase();if((a)&&(a.length>0)){for(b=0;e=a[b];b++){d=new e;if((d.verb)&&(d.verb.toLowerCase()==f)){return d}}}return null},getQueryDatasetByKey:function(b){if((!b)||(!this._queryDatasets)||(!this._queryDatasets.length>0)){return null}var a;var e=null;var d=this._queryDatasets;for(a=0;e=d[a];a++){if(e.key==b){return e}}return null},getQueryDatasetByName:function(a){if((!a)||(!this._queryDatasets)||(!this._queryDatasets.length>0)){return null}var b;var e=null;var d=this._queryDatasets;for(b=0;e=d[b];b++){if(e.name==a){return e}}return null},onAuthenticationSuccess:function(){aw.base.prototype.onAuthenticationSuccess.apply(this);this._initializeQueries()},onAuthenticationFailure:function(){aw.base.prototype.onAuthenticationFailure.apply(this);this._initializeQueries()},saveActiveQuery:function(a){if(!this.activeQuery){return}if((!a)||(a.replace(/^\s*|\s*$/gi,"")==="")){new aw.ui.Dialog.Prompt({title:"Save Active Query",content:"Please enter the name you would like to save your active query with.",defaultValue:this.activeQuery.name},{onsubmit:function(b){this.saveActiveQuery(b)}.bind(this)})}else{this.saveQuery(a,this.activeQuery)}},saveQuery:function(a,d){if((!a)||(a.replace(/^\s*|\s*$/gi,"")==="")||(!d)){return}var b=this.componentBus.getComponentReferences("aw.UserDataManager");if((b)&&(b.length>0)){b[0].executeAction({action:"save",datatype:"CalgaryListFilter",name:a,variant:this.activeQueryDataset.key,params:{query:d.serialize()},callback:function(f,e){this.triggerEvent("onquerysaved",f,e)}.bind(this,d,a)})}},setActiveFieldIndex:function(a){if(!a){return}this.activeFieldIndex=a},setActiveFieldIndexByName:function(a){this.setActiveFieldIndex(this.getFieldIndexByName(a))},setActiveQuery:function(b,a){if(!b){return}this.activeQuery=b;if(a){this.activeQuery.filterName=a}this.triggerEvent("onactivequerychanged",this.activeQuery);if(this._countRequestTimeout){clearTimeout(this._countRequestTimeout);this._countRequestTimeout=null}this._countRequestTimeout=setTimeout(this._getActiveQueryCount.bind(this),300)},setActiveQueryDataset:function(e){if(!e){return}if((!this._queryDatasets)||(!this._queryDatasets.length>0)){return}var a;var f=null;var b=this._queryDatasets;for(a=0;f=b[a];a++){if(f===e){this.activeQueryDataset=f;this.triggerEvent("onquerydatasetchanged",f);this._getDatasetMetadata();return}}throw"Could not locate dataset!"},setActiveQueryDatasetByKey:function(a){this.setActiveQueryDataset(this.getQueryDatasetByKey(a))},_buildQueryObject:function(g,a){if(!g){alert("Invalid [query] parameter/object.");return null}if(!g.operator){alert("The top query element is not a valid <aw.Query.Operator>.");return null}a=(!a)?new aw.Query.Operator({operator:g.operator}):a;var e;var j=null;var d=g.children;var b;var h=null;var f=null;for(e=0;j=d[e];e++){if(j.operator){b=this.buildQueryObject(j,a);if(b){a.add(b)}}else{h=this.getFieldIndexByName(j.name);switch(j.type){case"range":f=new aw.Query.Filter.Range({name:j.name,label:h.shortName,inverse:j.inverse,begins:j.begin,ends:j.end,includeBegins:j.includeBegin,includeEnds:j.includeEnd});break;case"value":f=new aw.Query.Filter.Is({name:j.name,label:h.shortName,value:j.value,inverse:j.inverse});break;case"begin":f=new aw.Query.Filter.Begins({name:j.name,label:h.shortName,value:j.value,inverse:j.inverse});break;case"end":f=new aw.Query.Filter.Ends({name:j.name,label:h.shortName,value:j.value,inverse:j.inverse});break;case"contains":f=new aw.Query.Filter.Contains({name:j.name,label:h.shortName,value:j.value,inverse:j.inverse});break;case"list":f=new aw.Query.Filter.List({name:j.name,label:h.shortName,values:j.values,inverse:j.inverse});break;case"listBegin":f=new aw.Query.Filter.ListBegin({name:j.name,label:h.shortName,values:j.values,inverse:j.inverse});break;case"isNull":f=new aw.Query.Filter.Null({name:j.name,label:h.shortName,inverse:j.inverse});break}if(f){a.add(f)}}}return a},_getActiveQueryCount:function(){var f={cn:("SRC.Web.Client.Handler.CalgaryHandler"+((this.activeQueryDataset)?("|"+this.activeQueryDataset.key):"")),service:"count",query:this.activeQuery.serialize()};var b;var e;var d=this.activeQuery.getItemsByClassName("aw.Query.Filter.Spatial");var a;var g;if((d)&&(d.length>0)){for(b=0;e=d[b];b++){a=e.geoCollection.getGeographyDefinition();for(g in a){f[g]=a[g]}}}this.request(f,function(n,p){if((!p)||(!p.payload)){return}var m=p.payload;var j;var h;var l=null;var k=null;if((m.counts)&&(m.counts.length>0)){j=m.counts;for(h=0;l=j[h];h++){k=this.activeQuery.getItemById(l.id);if(k){k.count=l.count}if(l.id===this.activeQuery.id){this.activeQuery.count=l.count}}}this.triggerEvent("onquerycountreceived",m.query)}.bind(this));if(this._countRequestTimeout){clearTimeout(this._countRequestTimeout);this._countRequestTimeout=null}},_getDatasetMetadata:function(){var a={cn:("SRC.Web.Client.Handler.CalgaryHandler"+((this.activeQueryDataset)?("|"+this.activeQueryDataset.key):"")),service:"getMetadata"};this.request(a,function(d,e){if((e)&&(e.payload)){var b=e.payload;this._fieldIndices=b.indexInfo;this._datasetIsSpatial=b.isSpatial;this.triggerEvent("ondatasetmetadatareceived",this._fieldIndices,this._datasetIsSpatial)}}.bind(this))},_getQueryDatasets:function(){var a={cn:"SRC.Web.Client.Handler.CalgaryHandler",service:"listDatasets"};this.request(a,function(f,g){this._queryDatasets=[];this.activeQueryDataset=null;if((g)&&(g.payload)&&(g.payload.length>0)){var b;var e=null;var d=g.payload;for(b=0;e=d[b];b++){this._queryDatasets.push(e)}this._sortQueryDatasets();this.triggerEvent("onquerydatasetschanged",this._queryDatasets);if(!this.activeQueryDataset){this.setActiveQueryDataset(this._queryDatasets[0])}}}.bind(this))},_initializeQueries:function(){this._getQueryDatasets()},_sortQueryDatasets:function(){if((!this._queryDatasets)||(!this._queryDatasets.length>0)){return}this._queryDatasets=this._queryDatasets.sort(function(f,e){var h=((f)&&(f.name))?String(""+f.name+"").toLowerCase():"";var g=((e)&&(e.name))?String(""+e.name+"").toLowerCase():"";return(h==g)?0:(h<g)?-1:1})},CLASS_NAME:"aw.QueryManager",EVENTS:["onactivequerychanged","ondatasetmetadatareceived","onquerycountreceived","onquerydatasetchanged","onquerydatasetschanged","onquerysaved"]});aw.ReportManager=Class.create(aw.base,{activeReport:null,reportDataset:null,_reportDatasets:[],_reports:[],initialize:function(b,a){this.activeReport=null;this.reportDataset=null;this._reportDatasets=[];this._reports=[];aw.base.prototype.initialize.apply(this,[b,a]);this._initializeReports()},addReport:function(a,b){if(!a){return}this._addReport(a);if(b!==false){this.triggerEvent("onreportschanged",this._reports)}},addReports:function(b,d){if((!b)||(!b.length>0)){return}var e;var a=null;for(e=0;a=b[e];e++){this._addReport(a)}if(d!==false){this.triggerEvent("onreportschanged",this._reports)}},getAllReports:function(){return this._reports||[]},getReportsBy:function(g){if((!this._reports)||(!this._reports.length>0)||(!g)){return null}var e;var d;var b=[];var h=this._reports;var a=null;var f=true;for(e=0;a=h[e];e++){f=true;for(d in g){if(a[d]!==g[d]){f=false}}if(f===true){b.push(a)}}return b},getReportsByFormat:function(e){if((!e)||(!this._reports)||(!this._reports.length>0)){return null}var d;var b=[];var f=this._reports;var a=null;e=e.toLowerCase();for(d=0;a=f[d];d++){if(a.format.toLowerCase()==e){b.push(a)}}return b},getReportByKey:function(d){if((!d)||(!this._reports)||(!this._reports.length>0)){return null}var b;var a=null;var e=this._reports;for(b=0;a=e[b];b++){if(a.key==d){return a}}return null},onAuthenticationSuccess:function(){aw.base.prototype.onAuthenticationSuccess.apply(this);this._initializeReports()},onAuthenticationFailure:function(){aw.base.prototype.onAuthenticationFailure.apply(this);this._initializeReports()},removeReport:function(a,b){if(!a){return}if((this._removeReport(a)===true)&&(b!==false)){this.triggerEvent("onreportschanged",this._reports)}},removeReports:function(d,e){if((!d)||(!d.length>0)){return}var f;var b=null;var a=true;for(f=0;b=d[f];f++){if(this._removeReport(b)!==true){a=false}}if((a===true)&&(e!==false)){this.triggerEvent("onreportschanged",this._reports)}},saveActiveReport:function(a){if(!this.activeReport){return}if((!a)||(a.replace(/^\s*|\s*$/gi,"")==="")){new aw.ui.Dialog.Prompt({title:"Save Active Report",content:"Please enter the name you would like to save your active report with.",defaultValue:this.activeReport.label},{onsubmit:function(b){this.saveActiveReport(b)}.bind(this)})}else{this.saveReport(a,this.activeReport,"SavedReport")}},saveReport:function(b,a,d){if((!b)||(b.replace(/^\s*|\s*$/gi,"")==="")||(!a)){return}d=d||"SavedReport";var e=this.componentBus.getComponentReferences("aw.UserDataManager");if((e)&&(e.length>0)){e[0].executeAction({action:"save",datatype:d,name:b})}},setActiveReport:function(a){if(!a){return}this.activeReport=a;this.triggerEvent("onactivereportchanged",a)},setActiveReportByKey:function(a){this.setActiveReport(this.getReportByKey(a))},setReportDataset:function(e){if(!e){return}if((!this._reportDatasets)||(!this._reportDatasets.length>0)){return}var a;var f=null;var b=this._reportDatasets;for(a=0;f=b[a];a++){if(f===e){this.reportDataset=f;this.triggerEvent("onreportdatasetchanged",f);this._getReports();return}}throw"Could not locate dataset!"},_addReport:function(a){if(!a){return}a.key=this.getId("awr");a.label=(a.label)?a.label:a.name;this._reports.push(a)},_getReportDatasets:function(){this._reportDatasets=[];this.reportDataset=null;this._reports=[];this.activeReport=null;var a={cn:"SRC.Web.Client.Handler.ReportHandler",service:"listDatasets"};this.request(a,function(f,g){if((g)&&(g.payload)&&(g.payload.length>0)){var b;var e=null;var d=g.payload;for(b=0;e=d[b];b++){this._reportDatasets.push(e)}this.triggerEvent("onreportdatasetschanged",this._reportDatasets);if(!this.reportDataset){this.setReportDataset(this._reportDatasets[0])}}}.bind(this))},_getReports:function(){if((!this.reportDataset)||(!this.reportDataset.variant)){return}this._reports=[];this.activeReport=null;var a={cn:"SRC.Web.Client.Handler.ReportHandler|"+this.reportDataset.variant,service:"listReports"};this.request(a,function(j,k){var g=k.variant;if((k)&&(k.payload)&&(k.payload.length>0)){var f;var b=null;var e=null;var h=k.payload;for(f=0;b=h[f];f++){b.variant=g;b.label=b.name.replace(/\.rptx$/i,"").replace(/\.yxwz$/i,"");this._addReport(b);if((!e)&&(b.format=="Comparison")&&(b.listOnly===false)){e=b}}this.triggerEvent("onreportschanged",this._reports);if(this.activeReport){var d=this.getReportsBy({format:this.activeReport.format,type:this.activeReport.type,name:this.activeReport.name});if((d)&&(d.length>0)){e=d[0]}}if(e){this.setActiveReport(e)}}}.bind(this))},_initializeReports:function(){this._getReportDatasets()},_removeReport:function(d){if((!d)||(!this._reports)||(!this._reports.length>0)){return false}var f;var e=[];var g=this._reports;var a=g.length;var b=false;for(f=0;f<a;f++){if(d===g[f]){b=true}else{e.push(g[f])}}this._reports=e;return b},EVENTS:["onactivereportchanged","onreportdatasetchanged","onreportdatasetschanged","onreportschanged"],VALID_PROPERTIES:["componentBus"],CLASS_NAME:"aw.ReportManager"});aw.RecordStore=Class.create(aw.base,{initialize:function(b,a){aw.base.prototype.initialize.apply(this,arguments)},clearRecordStore:function(d){if(this.isSessionValidated()!==true){if(this.isValidating()===true){this.clearRecordStore.bind(this,d).delay(0.5)}else{if(d){var g=(d instanceof Array)?d:[d];if((g)&&(g.length>0)){var f=null;for(var b=0;b<g.length;b++){f=this.readCookie("RecordSet."+g[b],true);if((f)&&(f.length>0)){for(var a=0;a<f.length;a++){this.clearCookie(f[a].name)}}}}}}return}var e={cn:"SRC.Web.Client.Handler.StorageHandler",service:"clear"};if(d){Object.extend(e,{recordKey:d})}this.request(e,function(h,j){if((!j)||(!j.payload)||(!j.payload.status)){return}if(j.payload.status.toLowerCase()=="failure"){new aw.ui.Dialog.Error({title:"Record Store Error!",content:j.payload.error||"An unknown error has occurred."});return}this.triggerEvent("recordstorecleared")}.bind(this))},getRecordStore:function(a,d){if(this.isSessionValidated()!==true){if(this.isValidating()===true){this.getRecordStore.bind(this,a,d).delay(0.5)}else{if(d){d(this._deserializeRecords(this.readCookie("RecordSet."+a,true)))}}return}var b={cn:"SRC.Web.Client.Handler.StorageHandler",service:"read",recordKey:a};this.request(b,function(g,e,f){if((!f)||(!f.payload)){return}if(g){g(this._deserializeRecords(f.payload))}}.bind(this,d))},setRecordStore:function(a){a=(a instanceof Array)?a:[a];if((!a)||(!a.length>0)){return}var e=[],b=0;for(b=0;b<a.length;b++){if(!a[b].key){throw"Record set missing key property!"}e.push({key:a[b].key,content:a[b].content})}if(this.isSessionValidated()!==true){if(this.isValidating()===true){this.setRecordStore.bind(this,a).delay(0.5)}else{for(b=0;b<e.length;b++){this.createCookie("RecordSet."+e[b].key,this._serializeRecords(e[b].content),30)}}return}var d={cn:"SRC.Web.Client.Handler.StorageHandler",service:"write",records:this._serializeRecords(e)};this.request(d,function(f,g){if((!g)||(!g.payload)||(!g.payload.status)){return}if(g.payload.status.toLowerCase()=="failure"){new aw.ui.Dialog.Error({title:"Record Store Error!",content:g.payload.error||"An unknown error has occurred."});return}this.triggerEvent("recordstoreset")}.bind(this),null,"post")},_deserializeRecords:function(b){if(b){b=(b instanceof Array)?b:[b];if((b)&&(b.length>0)){var d=[];for(var a=0;a<b.length;a++){d.push({key:(b[a].key||b[a].name),content:b[a].content||b[a].value})}return d}}return null},_serializeRecords:function(a){if(a instanceof String){return a}return Object.toJSON(a)},CLASS_NAME:"aw.RecordStore"});aw.ThematicsManager=Class.create(aw.base,{activeThematic:null,geographyLevels:[],palettes:[],thematics:[],variables:[],_allocateDataset:null,initialize:function(b,a){this._allocateDataset=null;aw.base.prototype.initialize.apply(this,[b,a])},getGeographyLevelsByScale:function(j){if((!j)||(!this.geographyLevels)||(!this.geographyLevels.length>0)){return null}var e=[];var d=null;var b=this.geographyLevels;var g=null;for(var f=0,a=b.length;f<a;f++){g=b[f];if((j>=g.minScale)&&(j<=g.maxScale)){e.push(g)}}e.sortBy("maxScale");var h=this.getAutoGeographyLevel(j);if(h){e.unshift(h)}return e},getAutoGeographyLevel:function(g){if((!g)||(!this.geographyLevels)||(!this.geographyLevels.length>0)){return null}var e,d;var f=null;var b=null;var a=this.geographyLevels;for(e=0,d=a.length;e<d;e++){b=a[e];if((g>=b.minScale)&&(b.maxScale>=g)){if(f){if(((g-f.minScale)<=(g-b.minScale))||(b.minScale===-1)){if((f.maxScale-g)>(b.maxScale-g)){f=b}}}else{f=b}}}if(f){return{key:"auto",name:"Auto-Select ("+f.name+")",geography:f.key}}return null},getGeographyLevelByKey:function(d){if((!d)||(!this.geographyLevels)||(!this.geographyLevels.length>0)){return null}var b;var e;var a=this.geographyLevels;for(b=a.length;b--;){e=a[b];if(e.key==d){return e}}return null},getPaletteByKey:function(d){if((!d)||(!this.palettes)||(!this.palettes.length>0)){return null}var b;var a;var e=this.palettes;for(b=e.length;b--;){a=e[b];if(a.key==d){return a}}return null},getVariableByKey:function(d){if((!d)||(!this.variables)||(!this.variables.length>0)){return null}var b;var a;var e=this.variables;for(b=e.length;b--;){a=e[b];if(a.variableKey==d){return a}}return null},setAllocateDataset:function(a){this._allocateDataset=a;this._initializeThematics()},setActiveThematic:function(a){this.activeThematic=a;this.triggerEvent("activethematicchanged",a)},setActiveThematicGeography:function(a){if((!a)||(!this.activeThematic)){return}this.activeThematic.geography=a.key},setActiveThematicPalette:function(a){if((!a)||(!this.activeThematic)){return}this.activeThematic.palette=a.key},setActiveThematicVariable:function(d){if((!d)||(!this.activeThematic)){return}this.activeThematic.variable=d.variableKey;var f;var g=false;var h=[];var e;var b=this.variables;var a=b.length;if((b)&&(a>0)){for(f=0;f<a;f++){e=b[f];if(e.variableKey==d.variableKey){g=true}else{h.push(e)}}if(g!==true){h.pop()}h.unshift(d);this.variables=h;this.triggerEvent("variableschanged",h)}},_addGeographyLevel:function(a){this.geographyLevels.push(a)},_addPalette:function(a){this.palettes.push(a)},_addThematic:function(a){a.dataset=this._allocateDataset;this.thematics.push(a)},_addVariable:function(a){this.variables.push(a)},_initializeThematics:function(){this.activeThematic=null;this.variables=[];this.geographyLevels=[];this.palettes=[];this._getThematics()},_getThematics:function(){var a=this._allocateDataset.variant;var b={cn:"SRC.Web.Client.Handler.MapUIHandler|"+a,service:"initThematic"};this.request(b,function(j,k){if((k)&&(k.payload)){var h=k.payload;if(h.palettes){this._onPalettesReceived(h.palettes)}this.request({cn:"SRC.Web.Client.Handler.AllocateHandler|"+a,service:"getVariableInfo",varKey:h.variables},function(l,m){this._onVariablesReceived(m.payload.variables)}.bind(this));var f;var e=[];var d=null;var g=h.layerdefinitions;for(f=0;d=g[f];f++){e.push(d.name)}this.request({cn:"SRC.Web.Client.Handler.AllocateHandler|"+a,service:"getGeographyInfo",geoType:e},function(n,l,m){this._onGeographiesReceived(n,m.payload.geographies)}.bind(this,h.layerdefinitions));if(h.themes){this._onThematicsReceived(h.themes)}}}.bind(this))},_onGeographiesReceived:function(d,h){this.geographyLevels=[];if((d)&&(d.length>0)&&(h)&&(h.length>0)){var g,f,b,o;var e={};var m=false;var k=null;var n=null;var a;var l;for(g=0,b=d.length;g<b;g++){k=d[g];m=false;a=k.name.toLowerCase();for(f=0,o=h.length;f<o;f++){n=h[f];l=n.key;if(l.toLowerCase()==a){m=true;e={key:l,name:n.name,geography:l,minScale:k.minScale,maxScale:k.maxScale}}}if(m===true){this.geographyLevels.push(e)}}this.triggerEvent("geographylevelschanged",this.geographyLevels)}},_onPalettesReceived:function(a){this.palettes=[];if((a)&&(a.length>0)){this.palettes=a;this.triggerEvent("paletteschanged",this.palettes)}},_onThematicsReceived:function(a){this.thematics=[];if((a)&&(a.length>0)){var b;var d=null;var e=null;for(b=0;d=a[b];b++){this._addThematic(d);if(!e){e=d}}this.triggerEvent("thematicschanged",this.thematics);if(e){this.setActiveThematic(e)}}},_onVariablesReceived:function(a){this.variables=[];if((a)&&(a.length>0)){this.variables=a.slice(0,5);this.triggerEvent("variableschanged",this.variables)}},EVENTS:["activethematicchanged","geographylevelschanged","paletteschanged","thematicschanged","variableschanged"],VALID_PROPERTIES:["componentBus"],CLASS_NAME:"aw.ThematicsManager"});aw.ui=Class.create(aw.base,{canvas:null,container:null,cssClass:null,inheritCSS:false,initialize:function(b,a){this.canvas=null;this.container=null;aw.base.prototype.initialize.apply(this,arguments);this.setContainer(this.container)},afterDraw:function(){},destroy:function(){this.erase();if(this.container){this.container=null}aw.base.prototype.destroy.apply(this)},draw:function(){if(!this.canvas){this.canvas=$(document.createElement("div"));this.canvas.id=""+this.id+"";if(this.inheritCSS===true){this._applyInheritCSS(this.canvas)}this.canvas.addClassName(this.getCSSClassName());if(this.cssClass){this.canvas.addClassName(this.cssClass)}}var a=this.evaluateTemplate("ui",this);if(a){aw.Element.update(this.canvas,a)}a=null;setTimeout(this.afterDraw.bind(this),10);return this.canvas},erase:function(){if((this.canvas)&&(this.canvas.parentNode)){this.canvas.parentNode.removeChild(this.canvas)}this.canvas=null},evaluateTemplate:function(a,d){var b=null;if((this._templates)&&(this._templates[a])){b=this._templates[a];if(b.evaluate){return b.evaluate((d||{}))}else{return b}}return null},hide:function(a){if(this.canvas){this.canvas.hide()}if(a!==false){this.triggerEvent("onhide",this)}},isVisible:function(){if((this.canvas)&&(this.canvas.visible()===true)){return true}return false},setContainer:function(a){if(!a){return}this.container=$(a);aw.Element.insert(this.container,this.draw())},show:function(a){if(!this.canvas){if(this.container){this.container.appendChild(this.draw())}}else{this.canvas.show()}if(a!==false){this.triggerEvent("onshow",this)}},toggle:function(){if(this.isVisible()===true){this.hide()}else{this.show()}},_applyInheritCSS:function(a){if((!a)||(!this._superclass())){return}var b=this._superclass();b=new b();if(b.getCSSClassName){a.addClassName(b.getCSSClassName())}if(b.inheritCSS===true){b._applyInheritCSS(a)}b.destroy();b=null},_templates:{},EVENTS:["onhide","onshow"],CLASS_NAME:"aw.ui",VALID_PROPERTIES:["container","cssClass","componentBus","inheritCSS"]});aw.ui.Container=Class.create(aw.ui,{height:null,width:null,items:[],_resizeTimeout:null,initialize:function(d,b){this.height=null;this.width=null;this.items=[];this._resizeTimeout=null;if((d)&&(d.items)&&(d.items.length>0)){var e=null;for(var a=0;e=d.items[a];a++){this.add(e,false)}}aw.ui.prototype.initialize.apply(this,arguments)},add:function(d){var a=(d instanceof Array)?d:[d];for(var b=0;b<a.length;b++){if(this.orientation=="vertical"){this.childMinHeight+=Math.max(parseInt(a[b].minHeight||0,10),parseInt(a[b].childMinHeight||0,10))}else{if(this.orientation=="horizontal"){this.childMinWidth+=Math.max(parseInt(a[b].minWidth||0,10),parseInt(a[b].childMinWidth||0,10))}}this.minWidth=Math.max(parseInt(this.minWidth,10),Math.max(parseInt(a[b].minWidth||0,10),parseInt(a[b].childMinWidth||0,10)));this.minHeight=Math.max(parseInt(this.minHeight,10),Math.max(parseInt(a[b].minHeight||0,10),parseInt(a[b].childMinHeight||0,10)));this.items.push(a[b]);if((!arguments.length>1)||(arguments[1]!==false)){this.drawItem(a[b])}}},clear:function(){if((this.items)&&(this.items.length>0)){for(var a=0;a<this.items.length;a++){if(this.items[a].destroy){this.items[a].destroy()}}}this.items=[]},destroy:function(){if((this.items)&&(this.items.length>0)){for(var a=0;a<this.items.length;a++){if(this.items[a].destroy){this.items[a].destroy()}}}this.items=[];this.height=null;this.width=null;aw.ui.prototype.destroy.apply(this)},draw:function(){aw.ui.prototype.draw.apply(this);if((this.items)&&(this.items.length>0)){for(var b=0,a=this.items.length;b<a;b++){this.drawItem(this.items[b])}}return this.canvas},drawItem:function(a){a.setContainer(this.canvas)},erase:function(){if((this.items)&&(this.items.length>0)){for(var b=0,a=this.items.length;b<a;b++){this.eraseItem(this.items[b])}}aw.ui.prototype.erase.apply(this)},eraseItem:function(a){if((a)&&(a.erase)){a.erase()}},getItemBy:function(h){if((!h)||(!this.items)){return null}var e=null,f=true,g=this.items;var a=this.items.length;for(var d=0;d<a;d++){e=g[d];f=true;for(var b in h){if(e[b]!==h[b]){f=false}}if(f===true){return e}}return null},getItemById:function(f){if((!f)||(!this.items)){return null}var d=null,e=this.items;var a=e.length;for(var b=0;b<a;b++){d=e[b];if(d.id==f){return d}}return null},getSize:function(){var b=this.height;var a=this.width;this.height=((b)&&(b>0))?b:((this.canvas)?this.canvas.getHeight():0);this.width=((a)&&(a>0))?a:((this.canvas)?this.canvas.getWidth():0);return{height:this.height,width:this.width}},setSize:function(a,d){if((!this.canvas)||((!a)&&(!d))){return}var b={};if(a>0){this.height=a;b.height=""+a+"px"}if(d>0){this.width=d;b.width=""+d+"px"}this.canvas.setStyle(b)},setPosition:function(b){if((!this.canvas)||(!b)){return}var d=["position","top","right","left","bottom"],a={},f=false;var e=d.length;while(e--){if(b[d[e]]){f=true;a[d[e]]=b[d[e]]}}if(f===true){this.canvas.setStyle(a)}},update:function(d){var a=(d instanceof Array)?d:[d];this.clear();if((a)&&(a.length>0)){for(var b=0;b<a.length;b++){this.add(a[b])}}},CLASS_NAME:"aw.ui.Container",VALID_PROPERTIES:["container","cssClass","componentBus","height","items","width"]});aw.ui.Control=Class.create(aw.ui,{label:"",disabled:false,hasFocus:false,required:false,validation:null,initialize:function(b,a){this.label="";this.disabled=false;this.hasFocus=false;this.required=false;this.validation=null;aw.ui.prototype.initialize.apply(this,arguments)},blur:function(){this.hasFocus=false},disable:function(){if(this.disabled===true){return}this.disabled=true;if(this.canvas){this.canvas.addClassName("disabled")}},draw:function(){aw.ui.prototype.draw.apply(this);if(this.canvas){if(this.required===true){Element.addClassName(this.canvas,"required")}if(this.disabled===true){Element.addClassName(this.canvas,"disabled")}}return this.canvas},enable:function(){if(this.disabled!==true){return}this.disabled=false;if(this.canvas){this.canvas.removeClassName("disabled")}},getValue:function(){return null},focus:function(){this.hasFocus=true},setInvalid:function(a){if(this.canvas){if(a===true){Element.addClassName(this.canvas,"invalid")}else{Element.removeClassName(this.canvas,"invalid")}}},setRequired:function(a){this.required=(a===true)?true:false;if(this.canvas){if(this.required===true){Element.addClassName(this.canvas,"required")}else{Element.removeClassName(this.canvas,"required")}}},update:function(){},validate:function(a){if(this.required===true){var b=this.getValue();if((!b)||(b==="")){return false}}if(this.validation){return this.validation(this,a)}return true},CLASS_NAME:"aw.ui.Control",VALID_PROPERTIES:["container","cssClass","disabled","label","hasFocus","required","validation"]});aw.ui.Control.Button=Class.create(aw.ui.Control,{alt:"",label:"",url:"",icon:"",_onClick_fx:null,initialize:function(b,a){this.label="";this.url="";this.icon="";this.alt="";this._onClick_fx=null;aw.ui.Control.prototype.initialize.apply(this,[b,a])},draw:function(){if((!this.alt)||(this.alt==="")){this.alt=this.label}aw.ui.Control.prototype.draw.apply(this);var a=this.canvas.down("div span span");if(a){if((this.url)&&(this.url!=="")){a.innerHTML='<a href="'+this.url+'" title="'+this.alt+'">'+this.label+"</a>"}if((this.icon)&&(this.icon!=="")){a.addClassName("icon");a.setStyle({backgroundImage:"url('"+this.icon+"')"})}}a=null;this._onClick_fx=this.onClick.bind(this);aw.EventManager.register(this.canvas,"click",this._onClick_fx);if(this.disabled===true){this.canvas.addClassName("disabled")}return this.canvas},disable:function(){aw.ui.Control.prototype.disable.apply(this)},enable:function(){aw.ui.Control.prototype.enable.apply(this)},erase:function(){if(this.canvas){if(this._onClick_fx){aw.EventManager.unregister(this.canvas,"click",this._onClick_fx);this._onClick_fx=null}}aw.ui.Control.prototype.erase.apply(this)},onClick:function(b){if(this.disabled!==true){this.triggerEvent("click",this)}var a=aw.EventManager.getEvent(b);if(a){a.stop()}},setLabel:function(a){var d=this.label;if(d!=a){this.label=a;var b=null;if(!this.alt||this.alt===""||this.alt===d){this.alt=a;this.canvas.firstChild.title=a}if((this.url)&&(this.url!=="")){b=this.canvas.down("div span a");b.title=this.alt}else{b=this.canvas.down("div span span")}if(b){b.innerHTML=a}b=null}},_templates:{ui:new Template('<div title="#{alt}"><span><span>#{label}</span></span></div>')},VALID_PROPERTIES:["alt","container","cssClass","label","align","disabled","icon","url"],EVENTS:["click"],CLASS_NAME:"aw.ui.Control.Button"});aw.ui.Control.Button.Drop=Class.create(aw.ui.Control.Button,{items:[],_onDropDownClick_fx:null,initialize:function(b,a){this.items=[];this._onDropDownClick_fx=null;aw.ui.Control.Button.prototype.initialize.apply(this,[b,a])},add:function(g){var b=this.items;var e=null,a=[],f=b.length-1;for(var d=0;e=b[d];d++){a[d]=e.disabled;if(d===f&&(a.indexOf(false)<0)){this.disable()}}b.push(g)},clear:function(){this.items=[];if(this.canvas){var a=this.canvas.down("ul");if(a){aw.Element.empty(a)}a=null}},getItemById:function(e){var a=this.items;if((!e)||(!a)||(!a.length>0)){return null}var d=null;for(var b=0;d=a[b];b++){if(d.id==e){return d}}return null},getItemByLabel:function(b){var a=this.items;if((!b)||(!a)||(!a.length>0)){return null}var e=null;for(var d=0;e=a[d];d++){if(e.label==b){return e}}return null},onClick:function(g){var f=aw.EventManager.getEvent(g);var b=f.target;if(!b||this.disabled===true){return}var a=null;if((b.tagName)&&(b.tagName.toLowerCase()!="li")&&(aw.Element.getParentNode(b,"li"))){b=$(aw.Element.getParentNode(b,"li"))}if((b.tagName)&&(b.tagName.toLowerCase()=="li")){var d=this.getItemById(b.readAttribute("key"));if(d&&d.disabled!==true){if(d.derivesFrom("aw.ui.Control.Button.Toggle")===true){d.setToggled(!d.toggled)}else{d.triggerEvent("click",d)}}d=null;a=this.canvas.down("div.items");if(a){a.hide()}a=null}else{if((b.tagName)&&(((b.tagName.toLowerCase()=="span")||(b.tagName.toLowerCase()=="a"))||((b.tagName.toLowerCase()=="div")&&(b.hasClassName("expand"))))){if(this._optionsContainer){this._hideOptions()}else{this._showOptions()}}}b=null},remove:function(f){var g=this.items;if((!f)||(!g)||(!g.length>0)){return}var e=false,b=[];for(var d=0,a=g.length;d<a;d++){if(g[d]===f){e=true}else{b.push(g[d])}}if(e===true){g=b}},_hideOptions:function(){if(this._optionsContainer){this._optionsContainer.remove();this._optionsContainer=null;if(this._onDropDownClick_fx){aw.EventManager.unregister(document.getElementsByTagName("body")[0],"click",this._onDropDownClick_fx)}}},_onDropDownClick:function(){this._hideOptions()},_showOptions:function(){var n=this.items;if((!n)||(!n.length>0)){return}var h=$(document.getElementsByTagName("body")[0]);var a=this.getId();h.insert(this._templates.options.evaluate({id:a}));this._onDropDownClick_fx=this._onDropDownClick.bind(this);aw.EventManager.register.bind(aw.EventManager,h,"click",this._onDropDownClick_fx).delay(0.1);this._optionsContainer=$(document.getElementById(a));if(this._optionsContainer){var j=this._optionsContainer.down("ul");if(j){aw.EventManager.register(j,"click",this.onClick.bind(this));var p=null,g=null,l=null,s=null;for(var e=0;p=n[e];e++){g=((p.url)&&(p.url!==""))?('<a href="'+p.url+'">'+p.label+"</a>"):p.label;l=((p.icon)&&(p.icon!==""))?("url('"+p.icon+"')"):"none";s=(p.toggled===true)?"toggled":"";itemClass=(p.disabled)?"disabled":"";j.insert(this._templates.item.evaluate({id:p.id,option:g,icon:l,cssClass:s,itemClass:itemClass}))}}j=null;var b=this.canvas.cumulativeOffset();var o=this.canvas.getDimensions();var m=this._optionsContainer.getDimensions();var q=document.viewport.getDimensions();var k=(b.top+o.height),d=b.left;var f={};if(k+m.height>q.height){f.top=""+(b.top-m.height)+"px"}else{f.top=""+k+"px"}if(d+m.width>q.width){f.right="0px"}else{f.left=""+d+"px"}this._optionsContainer.setStyle(f)}h=null},_templates:{ui:new Template('<div><span><span class="active">#{label}</span><div class="expand"></div></span></div></div>'),options:new Template('<div id="#{id}" class="aw_ui_Control_Button_Drop_Options"><ul></ul></div>'),item:new Template('<li key="#{id}" class="#{itemClass}" style="background-image: #{icon};"><div class="#{cssClass}">#{option}</div></li>')},VALID_PROPERTIES:["container","cssClass","label","items","align","disabled","alt"],CLASS_NAME:"aw.ui.Control.Button.Drop"});aw.ui.Control.Button.Group=Class.create(aw.ui.Container,{maxActive:1,minActive:1,_activeItem:null,initialize:function(b,a){this.maxActive=1;this.minActive=1;this._activeItem=null;aw.ui.Container.prototype.initialize.apply(this,[b,a])},clear:function(){aw.ui.Container.prototype.clear.apply();if(this.canvas){this.draw()}},disable:function(){var a=this.items;if((!a)||(!a.length>0)){return}for(var b=0;item=a[b];b++){if(item.disabled===true){continue}item.disable()}},drawItem:function(b){if(!this.canvas){return}var a=this.items;b.registerEvent("toggle",this._onButtonToggle.bind(this));if(b.toggled===true){this._activeItem=b}var d=b.draw();if(d){if((a)&&(a[0]==b)){d.addClassName("first")}if((a)&&(a[a.length-1]==b)){d.addClassName("last")}this.canvas.insert(d)}d=null},enable:function(){var a=this.items;if((!a)||(!a.length>0)){return}for(var b=0;item=a[b];b++){if(item.disabled!==true){continue}item.enable()}},_onButtonToggle:function(e){var a=this.items;if((!e)||(!a)||(!a.length>0)){return}if((this._activeItem===e)&&(e.toggled!==true)&&(this.minActive===1)){e.setToggled(true);return}if((this._activeItem!==e)&&(e.toggled===true)){this._activeItem=e;var d=null;for(var b=0;d=a[b];b++){if((d!==e)&&(d.setToggled)){d.setToggled(false)}}}this.triggerEvent("toggle",this,e)},_templates:{item:new Template('<div key="#{id}"><span><span title="#{label}">#{label}</span></span></div>')},VALID_PROPERTIES:["container","cssClass","items","align","maxActive","minActive"],EVENTS:["toggle"],CLASS_NAME:"aw.ui.Control.Button.Group"});aw.ui.Control.Button.Split=Class.create(aw.ui.Control.Button,{items:[],_activeItem:null,_onDropDownClick_fx:null,initialize:function(b,a){this.items=[];this._activeItem=null;this._onDropDownClick_fx=null;aw.ui.Control.Button.prototype.initialize.apply(this,[b,a])},draw:function(){aw.ui.Control.Button.prototype.draw.apply(this);var b=this.items;if((b)&&(b.length>0)){var f=null,a=[],e=b.length-1;for(var d=0;f=b[d];d++){a[d]=f.disabled;if(d===e&&(a.indexOf(false)<0)){this.disable();f.disabled=false}this.drawItem(f)}}return this.canvas},drawItem:function(a){if(!this.canvas){return}if(!this._activeItem&&a.disabled!==true){this.setActiveItem(a)}},add:function(a){this.items.push(a);this.drawItem(a)},clear:function(){this.items=[];this._activeItem=null;if(this.canvas){var a=this.canvas.down("ul");if(a){aw.Element.empty(a)}a=null}},getItemById:function(d){if((!d)||(!this.items)||(!this.items.length>0)){return null}var b=null;for(var a=0;b=this.items[a];a++){if(b.id==d){return b}}return null},setActiveItem:function(d){if(!d){return}this._activeItem=d;if(this.canvas){var b=this.canvas.down("div span.active");if(b){aw.Element.update(b,((d.url)&&(d.url!==""))?('<a href="'+d.url+'">'+d.label+"</a>"):d.label);var a=((this._activeItem.icon)&&(this._activeItem.icon!==""))?("url('"+this._activeItem.icon+"')"):"none";b.setStyle({backgroundImage:a});if((this._activeItem.icon)&&(this._activeItem.icon!=="")){b.addClassName("icon")}else{b.removeClassName("icon")}}b=null}},setActiveItemById:function(a){this.setActiveItem(this.getItemById(a))},onClick:function(g){var f=aw.EventManager.getEvent(g);var b=f.target;if(!b||this.disabled===true){return}var a=null;if((b.tagName)&&(b.tagName.toLowerCase()!="li")&&(aw.Element.getParentNode(b,"li"))){b=$(aw.Element.getParentNode(b,"li"))}if((b.tagName)&&(b.tagName.toLowerCase()=="li")){var d=this.getItemById(b.readAttribute("key"));if(d&&d.disabled!==true){this.setActiveItem(d);d.triggerEvent("click",d)}d=null;a=this.canvas.down("div.items");if(a){a.hide()}a=null}else{if((b.tagName)&&((b.tagName.toLowerCase()=="span")||(b.tagName.toLowerCase()=="a"))&&(this._activeItem)){this._activeItem.triggerEvent("click",this._activeItem)}else{if((b.tagName)&&(b.tagName.toLowerCase()=="div")&&(b.hasClassName("expand"))){if(this._optionsContainer){this._hideOptions()}else{this._showOptions()}}}}b=null},_hideOptions:function(){if(this._optionsContainer){this._optionsContainer.remove();this._optionsContainer=null;if(this._onDropDownClick_fx){aw.EventManager.unregister(document.getElementsByTagName("body")[0],"click",this._onDropDownClick_fx)}}},_onDropDownClick:function(){this._hideOptions()},_showOptions:function(){var h=$(document.getElementsByTagName("body")[0]);var a=this.getId();h.insert(this._templates.options.evaluate({id:a}));this._onDropDownClick_fx=this._onDropDownClick.bind(this);aw.EventManager.register.bind(aw.EventManager,h,"click",this._onDropDownClick_fx).delay(0.1);this._optionsContainer=$(document.getElementById(a));if(this._optionsContainer){var j=this._optionsContainer.down("ul");if(j){aw.EventManager.register(j,"click",this.onClick.bind(this));var o=null,g=null,l=null;for(var e=0;o=this.items[e];e++){g=((o.url)&&(o.url!==""))?('<a href="'+o.url+'">'+o.label+"</a>"):o.label;l=((o.icon)&&(o.icon!==""))?("url('"+o.icon+"')"):"none";itemClass=(o.disabled)?"disabled":"";j.insert(this._templates.item.evaluate({id:o.id,option:g,icon:l,itemClass:itemClass}))}}j=null;var b=this.canvas.cumulativeOffset();var n=this.canvas.getDimensions();var m=this._optionsContainer.getDimensions();var p=document.viewport.getDimensions();var k=(b.top+n.height),d=b.left;var f={};if(k+m.height>p.height){f.top=""+(b.top-m.height)+"px"}else{f.top=""+k+"px"}if(d+m.width>p.width){f.right="0px"}else{f.left=""+d+"px"}this._optionsContainer.setStyle(f)}h=null},_templates:{ui:new Template('<div><span><span class="active">#{label}</span><div class="expand"></div></span></div></div>'),options:new Template('<div id="#{id}" class="aw_ui_Control_Button_Split_Options"><ul></ul></div>'),item:new Template('<li key="#{id}" class="#{itemClass}" style="background-image: #{icon};"><div>#{option}</div></li>')},VALID_PROPERTIES:["container","cssClass","items","align","disabled","alt"],CLASS_NAME:"aw.ui.Control.Button.Split"});aw.ui.Control.Button.Toggle=Class.create(aw.ui.Control.Button,{toggled:false,initialize:function(b,a){this.toggled=false;aw.ui.Control.Button.prototype.initialize.apply(this,[b,a])},draw:function(){aw.ui.Control.Button.prototype.draw.apply(this);if(this.toggled===true){this.canvas.addClassName("toggled")}return this.canvas},setToggled:function(b,a){b=(b===true)?true:false;if(this.toggled===b){return}this.toggled=b;if(this.canvas){if(this.toggled===true){this.canvas.addClassName("toggled")}else{this.canvas.removeClassName("toggled")}}if(a!==false){this.triggerEvent("toggle",this)}},onClick:function(b){aw.ui.Control.Button.prototype.onClick.apply(this,[b]);var a=aw.EventManager.getEvent(b);if((a)&&(a.stop)){a.stop()}if(this.disabled!==true){this.setToggled(!this.toggled)}},CLASS_NAME:"aw.ui.Control.Button.Toggle",EVENTS:["click","toggle"],VALID_PROPERTIES:["container","cssClass","name","label","toggled","disabled","icon","alt"]});aw.ui.Control.Checkbox=Class.create(aw.ui.Control,{value:null,checked:false,_onClick_fx:null,initialize:function(b,a){this.value=null;this.checked=false;this.label="";this._onClick_fx=null;aw.ui.Control.prototype.initialize.apply(this,[b,a])},disable:function(){var a=this.canvas.getElementsByTagName("input")[0];if(a){a.disabled=true}aw.ui.Control.prototype.disable.apply(this)},draw:function(){aw.ui.Control.prototype.draw.apply(this);var a=this.canvas.getElementsByTagName("input")[0];var b=this.checked;if(a){if((b===true)||((typeof b=="string")&&(b.toLowerCase()=="true"))){b=true;a.checked=true}if(this.disabled){this.canvas.addClassName("disabled");a.disabled=true}this._onClick_fx=this.onClick.bind(this);aw.EventManager.register(a,"click",this._onClick_fx)}return this.canvas},enable:function(){aw.ui.Control.prototype.enable.apply(this);var a=this.canvas.getElementsByTagName("input")[0];if(a){a.disabled=false}},erase:function(){if(this.canvas){var a=this.canvas.getElementsByTagName("input")[0];if((a)&&(this._onClick_fx)){aw.EventManager.unregister(a,"click",this._onClick_fx);this._onClick_fx=null}}aw.ui.Control.prototype.erase.apply(this)},getValue:function(){var a=this.value;if(this.checked===true){return a||"true"}if((!a)||((typeof a=="string")&&(a.toLowerCase()!="false"))){return"false"}return null},onClick:function(b){var a=this.canvas.getElementsByTagName("input")[0];if(a){if(a.checked!==this.checked){this.checked=a.checked;this.triggerEvent("change",this)}}a=null},setChecked:function(b,d){b=((b)&&((b===true)||((typeof b=="string")&&(b.toLowerCase()=="true"))))?true:false;if(b===this.checked){return}this.checked=(b===true)?true:false;var a=this.canvas.getElementsByTagName("input")[0];if(a){a.checked=this.checked}d=d||false;if(d){this.triggerEvent("change",this)}},_templates:{ui:new Template('<label><input type="checkbox" value="#{value}" name="#{name}" /> #{label}</label>')},CLASS_NAME:"aw.ui.Control.Checkbox",VALID_PROPERTIES:["container","cssClass","name","label","value","checked","required","validation","disabled"],EVENTS:["change"]});aw.ui.Control.CheckboxGroup=Class.create(aw.ui.Control,{checkbox:null,checked:null,items:[],_onChange_fx:null,initialize:function(b,a){this.items=[];this.checked=false;this._onChange_fx=null;aw.ui.Control.prototype.initialize.apply(this,[b,a]);this.group=this.group||"defaultGroup"},add:function(a){if(!a){return}this.items.push(a);if(this.canvas){this.canvas.addClassName("border")}this.drawItem(a)},afterDraw:function(){if((this.checked===true)||((typeof this.checked=="string")&&(this.checked.toLowerCase()=="true"))){if(this.checkbox){this.checkbox.checked=true}this.checked=true}else{if(this.checkbox){this.checkbox.checked=false}this.checked=false}this.update()},check:function(){if((this.checked===true)||(this.disabled===true)){return}this.checked=true;if(this.checkbox){this.checkbox.checked=true}this.update();this.triggerEvent("change",this)},clear:function(){this.items=[];this.draw()},disable:function(){aw.ui.Control.prototype.disable.apply(this);if(this.checkbox){this.checkbox.disabled=true}this.update()},draw:function(){aw.ui.Control.prototype.draw.apply(this);var f=this.canvas.down('input[type="checkbox"]');var e=this.checked,b=this.items;if(f){this.checkbox=f;this._onChange_fx=this.onChange.bind(this);aw.EventManager.register(f,"click",this._onChange_fx);if((e===true)||((typeof e=="string")&&(e.toLowerCase()=="true"))){e=true;f.checked=true}}if((b)&&(b.length>0)){for(var d=0,a=b.length;d<a;d++){this.drawItem(b[d])}this.canvas.addClassName("border")}else{this.canvas.removeClassName("border")}this.update();return this.canvas},drawItem:function(b){if((this.canvas)&&(b)&&(b.draw)){var a=this.canvas.down("div.contents");if(a){a.insert(b.draw())}a=null}},enable:function(){aw.ui.Control.prototype.enable.apply(this);if(this.checkbox){this.checkbox.disabled=false}this.update()},erase:function(){if(this.checkbox){if(this._onChange_fx){aw.EventManager.unregister(this.checkbox,"click",this._onChange_fx);this._onChange_fx=null}this.checkbox.remove();this.checkbox=null}aw.ui.Control.prototype.erase.apply(this)},getKey:function(){return this.key},getValue:function(){var a=this.value;if(this.checked===true){return a||"true"}if((!a)||((typeof a=="string")&&(a.toLowerCase()!="false"))){return"false"}return null},onChange:function(d){var b=aw.EventManager.getEvent(d);var a=b.target;if(!a){return}this.selected=a.checked;this.triggerEvent("change",this)},uncheck:function(){if((this.checked===false)||(this.disabled===true)){return}this.checked=false;if(this.checkbox){this.checkbox.checked=false}this.update();this.triggerEvent("change",this)},update:function(){if(this.checkbox){this.disabled=this.checkbox.disabled;this.checked=this.checkbox.checked}if((!this.items)||(!this.items.length>0)){return}for(var b=0,a=this.items.length;b<a;b++){if(((this.disabled)||(!this.checked))&&(this.items[b].disable)){this.items[b].disable()}else{if(this.items[b].enable){this.items[b].enable()}}}},_templates:{ui:new Template('<div class="fieldlabel"><input type="checkbox" name="#{group}" key="#{key}" /> #{label}</div><div class="contents"></div>')},CLASS_NAME:"aw.ui.Control.CheckboxGroup",VALID_PROPERTIES:["container","cssClass","group","name","key","label","items","checked"],EVENTS:["change"]});aw.ui.Control.Color=Class.create(aw.ui.Control,{hasFocus:false,value:"ff0000",_blur_fx:null,_hsv:[0,100,100],_hueSlider:null,_maxX:200,_maxY:200,_mousedown_fx:null,_mousemove_fx:null,_mouseup_fx:null,_phsv:[0,100,100],_popupId:null,_startLeft:null,_startTop:null,_startX:null,_startY:null,initialize:function(b,a){this.hasFocus=false;this.value="ff0000";this._hsv=[0,100,100];this._phsv=[0,100,100];this._hueSlider=null;this._maxX=200;this._maxY=200;this._minX=0;this._minY=0;this._mousedown_fx=null;this._mousemove_fx=null;this._mouseup_fx=null;this._popupId=null;this._startLeft=null;this._startTop=null;this._startX=null;this._startY=null;aw.ui.Control.prototype.initialize.apply(this,arguments);this._blur_fx=this._onBlur.bind(this);this._mousedown_fx=this._onMouseDown.bind(this);this._mousemove_fx=this._onMouseMove.bind(this);this._mouseup_fx=this._onMouseUp.bind(this)},disable:function(){this.canvas.setOpacity("0.5");aw.ui.Control.prototype.disable.apply(this)},draw:function(){aw.ui.Control.prototype.draw.apply(this);var a=this.canvas,d=this.value,b=this._hsv;if(d){b=aw.Color.hexToHSV(d)}if(a){aw.EventManager.register(a,"click",this._onClick.bind(this));if(this.disabled===true){a.addClassName("disabled");a.setOpacity("0.5")}this._setColor(b[0],b[1],b[2])}return a},enable:function(){this.canvas.setOpacity("1");aw.ui.Control.prototype.enable.apply(this)},getValue:function(){var a=this._hsv;return aw.Color.hsvToHex(a[0],a[1],a[2])},setValueByHex:function(d){var b=[0,0,0];var a=true;if(d.length!=6){a=false}else{if(d.match(/[^0-9a-fA-F]/ig)){a=false}}if(a===true){b=aw.Color.hexToHSV(d);this._setColor.apply(this,b);return true}return false},_calculatePreviewColor:function(f,a){var b=this._hdims;if((!f)||(!a)){var e=$(this._popupId);if(e){var d=e.down("div.handle").positionedOffset();f=d.top+Math.round(b.height/2);a=d.left+Math.round(b.width/2)}}this._phsv=[this._phsv[0],Math.round((a/(this._maxX-this._minX))*100),100-Math.round((f/(this._maxY-this._minY))*100)]},_onBlur:function(d){var b=aw.EventManager.getEvent(d);var a=b.target;if(!a){return}if(this.canvas){if((a)&&(a.id==this.canvas.id)||(a.up('div[id="'+this.canvas.id+'"]'))){return}}if((a.hasClassName("popup"))||(a.up('div[class="aw_ui_Control_Color popup"]'))){return}if(this.hasFocus===true){if(this._blur_fx){aw.EventManager.unregister(document.getElementsByTagName("body")[0],"mousedown",this._blur_fx)}this._togglePopup();return}},_onClick:function(){if(!this.disabled){this._togglePopup()}},_onHexTextChange:function(d){var e=d.getValue();var a=true;if(e.length!=6){a=false}else{if(e.match(/[^0-9a-fA-F]/ig)){a=false}}if(a===true){d.setInvalid(false);var b=aw.Color.hexToHSV(e);this._setPreviewColor(b[0],b[1],b[2])}else{d.setInvalid(true)}},_onHueSlide:function(b){var a=this._phsv;this._setPreviewColor(b,a[1],a[2],false)},_onMouseDown:function(h){var f=aw.EventManager.getEvent(h);var a=this._hdims,b=this._ppos;if((f.target)&&(f.target.className=="patch")){var d=f.pointerX-Math.round(a.width/2)-b.left;var j=f.pointerY-Math.round(a.height/2)-b.top;$(this._popupId).down("div.handle").setStyle({top:""+j+"px",left:""+d+"px"})}this._calculatePreviewColor();this._setPreviewColor(null,null,null,false);this._startX=f.pointerX;this._startY=f.pointerY;var g=$(this._popupId).down("div.handle");this._startTop=parseInt(g.style.top.replace("px",""),10);this._startLeft=parseInt(g.style.left.replace("px",""),10);g=null;aw.EventManager.register(document,"mousemove",this._mousemove_fx);aw.EventManager.register(document,"mouseup",this._mouseup_fx);Event.stop(h)},_onMouseMove:function(d){var b=aw.EventManager.getEvent(d);var f=(this._startTop+(b.pointerY-this._startY));var a=(this._startLeft+(b.pointerX-this._startX));f=(f<this._minY)?this._minY:(f>this._maxY)?this._maxY:f;a=(a<this._minX)?this._minX:(a>this._maxX)?this._maxX:a;$(this._popupId).down("div.handle").setStyle({top:""+f+"px",left:""+a+"px"});this._calculatePreviewColor();this._setPreviewColor(null,null,null,false);Event.stop(d)},_onMouseUp:function(a){this._startX=null;this._startY=null;this._startTop=null;this._startLeft=null;aw.EventManager.unregister(document,"mousemove",this._mousemove_fx);aw.EventManager.unregister(document,"mouseup",this._mouseup_fx)},_onOKClick:function(){this._setColor.apply(this,this._phsv);this._togglePopup();this.triggerEvent("change",this)},_onRGBTextChange:function(g){var e=[],h=null,a=true;var f=this._rgbInputs;for(var d=0;d<f.length;d++){h=parseInt(f[d].getValue(),10);if((isNaN(h))||(h<0)||(h>255)){a=false;f[d].setInvalid(true)}else{f[d].setInvalid(false)}e.push(parseInt(f[d].getValue(),10))}if(a===true){var b=aw.Color.rgbToHSV(e[0],e[1],e[2]);this._setPreviewColor(b[0],b[1],b[2])}},_setColor:function(d,b,a){this._hsv=[d,b,a];if(this.canvas){this.canvas.down("div").setStyle({backgroundColor:"rgb("+aw.Color.hsvToRGB(d,b,a).join(",")+")"})}},_setPreviewColor:function(e,p,j,g){if((!isNaN(parseInt(e,10)))&&(!isNaN(parseInt(p,10)))&&(!isNaN(parseInt(j,10)))){this._phsv=[e,p,j]}var a=$(this._popupId),o=this._phsv,f=this._rgbInputs,b=this._pdims,m=this._hdims;if(a){a.down("div.preview .new").setStyle({backgroundColor:"rgb("+aw.Color.hsvToRGB(o[0],o[1],o[2]).join(",")+")"});a.down("div.patch").setStyle({backgroundColor:"rgb("+aw.Color.hsvToRGB(o[0],100,100).join(",")+")"});if(this._hueSlider){this._hueSlider.setValue(o[0],0,false)}if(f){var k=aw.Color.hsvToRGB(o[0],o[1],o[2]);for(var d=0;d<k.length;d++){f[d].setValue(k[d])}}if(this._hexInput){this._hexInput.setValue(aw.Color.hsvToHex(o[0],o[1],o[2]))}if(g!==false){var l=(b.height-(Math.round((o[2]/100)*b.height)+Math.round(m.height/2)));var n=(Math.round((o[1]/100)*b.width)-Math.round(m.width/2));a.down("div.handle").setStyle({top:""+l+"px",left:""+n+"px"})}}},_togglePopup:function(){var g=$(this._popupId);if(g){g.remove();g=null;this._popupId=null;this._hueSlider=null;this.hasFocus=false;return}this._popupId=this.getId("awcpu");Element.insert(document.getElementsByTagName("body")[0],this._templates.popup.evaluate({id:this._popupId,cssClass:this.getCSSClassName()}));var f=this.canvas.getDimensions();var a=this.canvas.cumulativeOffset();g=$(this._popupId);g.setStyle({top:""+(a.top+f.height)+"px",left:""+(a.left)+"px"});this._pdims=g.down("div.patch").getDimensions();this._ppos=g.down("div.patch").cumulativeOffset();this._hdims=g.down("div.handle").getDimensions();this._minX=0-Math.round(this._hdims.width/2);this._maxX=this._pdims.width-Math.round(this._hdims.width/2);this._minY=0-Math.round(this._hdims.height/2);this._maxY=this._pdims.height-Math.round(this._hdims.height/2);this._hueSlider=new aw.ui.Control.Slider({container:g.down("div.hue"),orientation:"vertical",range:[0,360],sliderValue:0},{onslide:this._onHueSlide.bind(this),onchange:this._onHueSlide.bind(this)});var e=g.down("div.fields");var d=["R","G","B"];this._rgbInputs=[];for(var b=0;b<d.length;b++){this._rgbInputs.push(new aw.ui.Control.TextBox({container:e,label:d[b]+":",cssClass:"rgbinput",maxlength:"3"},{change:this._onRGBTextChange.bind(this)}))}this._hexInput=new aw.ui.Control.TextBox({container:e,label:"#:",cssClass:"hexinput",maxlength:"6"},{change:this._onHexTextChange.bind(this)});this._setPreviewColor.bind(this,this._hsv[0],this._hsv[1],this._hsv[2]).delay(0.02);g.down("div.preview .old").setStyle({backgroundColor:"rgb("+aw.Color.hsvToRGB(this._hsv[0],this._hsv[1],this._hsv[2]).join(",")+")"});new aw.ui.Control.Button({container:g.down("div.buttons"),label:"Cancel"},{click:this._togglePopup.bind(this)});new aw.ui.Control.Button({container:g.down("div.buttons"),label:"OK"},{click:this._onOKClick.bind(this)});this.hasFocus=true;aw.EventManager.register(g.down("div.patch"),"mousedown",this._mousedown_fx);aw.EventManager.register(document.getElementsByTagName("body")[0],"mousedown",this._blur_fx)},_templates:{ui:new Template('<label>#{label}</label><div class="color"></div>'),popup:new Template('<div id="#{id}" class="#{cssClass} popup"><div class="patch"><div class="handle"></div></div><div class="hue"></div><div class="preview"><div class="new"></div><div class="old"></div></div><div class="fields"></div><div class="buttons"></div></div>')},VALID_PROPERTIES:["container","cssClass","disabled","label","hasFocus","required","validation","value"],EVENTS:["change"],CLASS_NAME:"aw.ui.Control.Color"});aw.ui.Control.ComboBox=Class.create(aw.ui.Control,{label:"",value:null,options:[],selectedIndex:-1,select:null,input:null,_blur_fx:null,initialize:function(b,a){this.label="";this.value=null;this.options=[];this.selectedIndex=-1;this.select=null;this.input=null;this._blur_fx=this.onBlur.bind(this);aw.ui.Control.prototype.initialize.apply(this,[b,a])},addOption:function(d,a){d=d||"";a=a||"";var b={key:this.getId("awcbo"),value:d,label:a};this.options.push(b);if((this.selectedIndex<0)||(this.selectedIndex>=this.options.length)){this._selectByKey(b.key,false)}if(this.select){this.select.down("ul").insert(this.evaluateTemplate("option",b))}},addOptions:function(a){if((a)&&(a.length>0)){var d=null;for(var b=0;d=a[b];b++){this.addOption(d.value,d.label)}}},clear:function(){this.options=[];if(this.select){this.select.getElementsByTagName("ul")[0].innerHTML=""}this.selectedIndex=-1;this.value=null},draw:function(){aw.ui.Control.prototype.draw.apply(this);var a=null;var g=this.canvas.down("div.options");if(g){this.select=g}var b=this.canvas.down("input");if(b){this.input=b;aw.EventManager.register(this.input,"change",this.onChange.bind(this))}if((this.options)&&(this.options.length>0)){var d=[];var f=null;for(var e=0;f=this.options[e];e++){d.push(f)}this.clear();this.addOptions(d)}aw.EventManager.register(this.canvas,"click",this.onClick.bind(this));return this.canvas},getValue:function(){return this.value||null},selectByIndex:function(a){if((!this.options)||(!this.options.length>0)||(!a)||(a>=this.options.length)||(a<0)){return}this._selectByKey(this.options[a].key)},selectByLabel:function(a){if((!a)||(!this.options)||(!this.options.length>0)){return}var d=null;for(var b=0;d=this.options[b];b++){if(d.label==a){this._selectByKey(d.key);return}}},selectByValue:function(d){if((!d)||(!this.options)||(!this.options.length>0)){return false}var b=null;for(var a=0;b=this.options[a];a++){if(b.value==d){this._selectByKey(b.key);return true}}return false},setValue:function(a){if(!this.selectByValue(a)){this.value=a;this.selectedIndex=-1;if(this.input){this.input.value=a}}},onBlur:function(d){var b=aw.EventManager.getEvent(d);var a=b.target;if(!a){return}if((a)&&(a.id==this.canvas.id)||(a.up('div[id="'+this.canvas.id+'"]'))){return}this._hideOptions()},onChange:function(){if(this.input){this.value=this.input.value}this.triggerEvent("change",this)},onClick:function(f){var d=aw.EventManager.getEvent(f);var a=d.target;if((!a)||(!a.tagName)){return}if((a.tagName.toLowerCase()=="span")||(a.tagName.toLowerCase()=="input")){this._toggleOptions();return}else{if(a.tagName.toLowerCase()=="li"){var b=a.readAttribute("key");if(b){this._selectByKey(b)}}}this._hideOptions()},_hideOptions:function(){if(this.select){this.select.hide()}if(this.input){this.input.blur()}aw.EventManager.unregister(document,"click",this._blur_fx)},_selectByKey:function(e,a){if((!e)||(!this.options)||(!this.options.length>0)){return}var h=null;for(var d=0;h=this.options[d];d++){if(h.key==e){if(this.selectedIndex==d){return}this.selectedIndex=d;if(this.input){this.input.value=h.label}this.value=h.value;if(this.select){var j=this.select.select("li.selected");if((j)&&(j.length>0)){var b=null;for(var g=0;b=j[g];g++){b.removeClassName("selected")}}var f=this.select.down('li[key="'+h.key+'"]');if(f){f.addClassName("selected")}}if(a!==false){this.triggerEvent("change",this)}return}}this.value=null},_showOptions:function(){if(this.select){var d=this.canvas.down("span");var e=d.getDimensions();var a=d.positionedOffset();this.select.setStyle({width:""+e.width+"px",top:""+(e.height+a.top)+"px",left:""+a.left+"px"});this.select.show();var b=this.select.down("ul").getDimensions();this.select.setStyle({height:""+Math.min((b.height+5),60)+"px"})}if(this.input){this.input.focus()}aw.EventManager.register(document,"click",this._blur_fx)},_toggleOptions:function(){if(this.select){if(this.select.visible()){this._hideOptions()}else{this._showOptions()}}},_templates:{ui:new Template('#{label} <span><input type="text" value="#{value}" /></span><div class="options" style="display: none;"><div><ul></ul></div></div>'),option:new Template('<li key="#{key}">#{label}</li>')},CLASS_NAME:"aw.ui.Control.ComboBox",VALID_PROPERTIES:["container","cssClass","label","options","selectedIndex","value"],EVENTS:["change"]});aw.ui.Control.Date=Class.create(aw.ui.Control,{customSerialize:{},hideInput:true,_calDate:null,_date:null,_days:[31,0,31,30,31,30,31,31,30,31,30,31],_months:["January","February","March","April","May","June","July","August","September","October","November","December"],_today:null,_weekDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],_onchange_fx:null,_onclick_fx:null,initialize:function(b,a){this.customSerialize={};this.hideInput=true;this._date=null;this._calDate=null;this._onchange_fx=this._onchange.bind(this);this._onclick_fx=this._onclick.bind(this);aw.ui.Control.prototype.initialize.apply(this,[b,a])},draw:function(){aw.ui.Control.prototype.draw.apply(this);if(this.value){this.setDate((this.value instanceof Date)?this.value:new Date(this.value))}else{this.setDate(new Date())}this.setDate(this._date);if(this.canvas){aw.EventManager.register(this.canvas,"click",this._onclick_fx);var b=this.canvas.down("input");if(b){aw.EventManager.register(b,"change",this._onchange_fx);if(this.hideInput===false){b.className="";var a=this.canvas.down("img");if(a){a.className=""}}}b=null}this._today=this.getFormattedDate(new Date());this._renderCalendar();return this.canvas},erase:function(){if(this.canvas){if(this._onclick_fx){aw.EventManager.unregister(this.canvas,"click",this._onclick_fx);this._onclick_fx=null}var a=this.canvas.down("input");if((a)&&(this._onchange_fx)){aw.EventManager.unregister(a,"change",this._onchange_fx);this._onchange_fx=null}}aw.ui.Control.prototype.erase.apply(this)},getDate:function(){if((this._date)&&(this._date instanceof Date)){return this._date}return null},getFormattedDate:function(a){if(a&&!(a instanceof Date)){throw new TypeError("date must be instance of Date")}a=a||this._date;if((a)&&(a instanceof Date)){return""+(a.getMonth()+1)+"/"+(a.getDate())+"/"+(a.getFullYear())+""}return null},getISODate:function(){if((this._date)&&(this._date instanceof Date)){return""+(this._date.getFullYear())+"-"+(this._date.getMonth()+1)+"-"+(this._date.getDate())+""}return null},getValue:function(){return this.getISODate()},setDate:function(a){if((a)&&(a instanceof Date)){this._date=a;if(this.canvas){var b=this.canvas.getElementsByTagName("input");if((b)&&(b.length>0)){b[0].value=this.getFormattedDate()||""}b=null}this.value=this.getFormattedDate()||""}},_compareDates:function(b,a){if((!b)||(!a)){return false}if(!(b instanceof Date)||!(a instanceof Date)){throw new TypeError("arguments must be of type Date()")}if(b.getDate()!=a.getDate()){return false}if(b.getMonth()!=a.getMonth()){return false}if(b.getFullYear()!=a.getFullYear()){return false}return true},_destroyCalendar:function(){if(this.hideInput){return}if(this.canvas){var a=this.canvas.down("div.calendar");if(a){Element.remove(a)}a=null}aw.EventManager.unregister(document,"click",this._onclick_fx);aw.EventManager.register.bind(aw.EventManager,this.canvas,"click",this._onclick_fx).delay(0.1)},_onchange:function(){if(this.canvas){i=this.canvas.down("input");if(i){if(isNaN(Date.parse(i.value))){i.value=this.value}this.value=i.value;this._date=new Date(i.value);this._renderCalendar();this.triggerEvent("change",this)}}},_onclick:function(f){if(this.disabled===true){f.preventDefault?f.preventDefault():f.returnValue=false;return false}var d=aw.EventManager.getEvent(f);var a=d.target;if((a)&&(a.tagName)){if(a.tagName.match(/^a$/i)){if(a.getAttribute("date")){this._selectDate(a.getAttribute("date"));if(a.className.match(/^setToday$/)){this._renderCalendar();f.preventDefault?f.preventDefault():f.returnValue=false;return}var b=this.canvas.down(".selected");if(b){b.className=b.className.replace(/\s?selected/,"");b.setAttribute("aria-selected",false)}a.className+=((a.className==="")?"":" ")+"selected";a.setAttribute("aria-selected",true)}else{if(a.className.match("next")){this._onNextClick()}else{if(a.className.match("prev")){this._onPreviousClick()}}}f.preventDefault?f.preventDefault():f.returnValue=false;return}}},_onNextClick:function(){var b=this._calDate.getMonth();var a=this._calDate.getFullYear();if(b==11){b=0;a++}else{b++}this._calDate.setMonth(b);this._calDate.setFullYear(a);this._renderCalendar(this._calDate)},_onPreviousClick:function(){var b=this._calDate.getMonth();var a=this._calDate.getFullYear();if(b===0){b=11;a--}else{b--}this._calDate.setMonth(b);this._calDate.setFullYear(a);this._renderCalendar(this._calDate)},_renderCalendar:function(e){this._calDate=((e)&&(e instanceof Date))?e:new Date(""+(this._date.getMonth()+1)+"/"+(this._date.getDate())+"/"+(this._date.getFullYear())+"");this._calDate.setDate(1);this._days[1]=(((this._calDate.getFullYear()%100!==0)&&(this._calDate.getFullYear()%4===0))||(this._calDate.getFullYear()%400===0))?29:28;var p=this._calDate.getDay();var f=['<table cellspacing="0" cellpadding="0"><thead><tr><th class="month" colspan="7" scope="col"><a class="prev" href="#" title="Previous Month">&#x25C0;</a>',this._months[this._calDate.getMonth()]," ",this._calDate.getFullYear(),'<a class="next" href="#" title="Next Month">&#x25B6;</a></th></tr><tr class="weekdays">'];for(var g=0;g<this._weekDays.length;g++){f.push('<th scope="col">'+this._weekDays[g]+"</th>")}f.push("</tr></thead><tbody><tr>");var d=true;var k,o,a;var m=this._calDate.getFullYear(),b=this._calDate.getMonth(),l=null;for(var h=1;h<=42;h++){if((h>=(p-(-1)))&&(h<=(p-(-this._days[this._calDate.getMonth()])))){o=(this._compareDates(new Date(this._today),new Date(""+(b+1)+"/"+(h-p)+"/"+m+""))===true)?"today":"";k=(this._compareDates(this._date,new Date(""+(b+1)+"/"+(h-p)+"/"+m+""))===true)?" selected":"";a=((o||k)?o+k:"").replace(/^\s/,"");l='<a aria-selected="'+(k===""?"false":"true")+'"'+(a?' class="'+a+'"':"")+' date="'+((b+1)+"-"+(h-p)+"-"+m)+'" href="#" title="'+(this._months[b]+" "+(h-p)+", "+m)+'">'+(h-p)+"</a>"}else{l="<span>&#160;</span>";if(h>7){d=false}}f.push("<td>");f.push(l);f.push("</td>");if((h%7===0)&&(h<36)){if(d===true){f.push("</tr><tr>")}else{h=43}}}f.push('</tr><tr class="todayRow"><td colspan="7"><span class="dispToday">&nbsp;</span><a class="setToday" date="');f.push(this._today);f.push('" href="#" title="Use today\'s date">Today: ');f.push(this._today);f.push("</a></td></tr></tbody></table>");var n=this.canvas.down("div.calendar");if(n){aw.Element.update(n,f.join(""))}else{aw.Element.insert(this.canvas,'<div class="calendar">'+f.join("")+"</div>");n=this.canvas.down("div.calendar")}},_selectDate:function(a){this.setDate(new Date(a.replace(/\-/ig,"/")))},_templates:{ui:new Template('<label for="#{name}">#{label}</label><input type="text" name="#{name}" class="hidden" /><img class="hidden" src="./core/img/Control/Date/calendar.png" alt="Date Picker" />')},VALID_PROPERTIES:["container","cssClass","customSerialize","label","hasFocus","required","validation","name","value","hideInput"],CLASS_NAME:"aw.ui.Control.Date"});aw.ui.Control.DropDown=Class.create(aw.ui.Control,{alt:"",options:[],selectedIndex:-1,select:null,_onChange_fx:null,initialize:function(b,a){this.alt="";this.options=[];this.selectedIndex=-1;this.select=null;this._onChange_fx=null;aw.ui.Control.prototype.initialize.apply(this,[b,a]);if((this.selectedIndex<0)&&(this.options.length>0)){this.selectedIndex=0}},addOption:function(j,a,h,g){j=j||"";a=a||"";var f={value:j,label:a,disabled:h,selected:g};this.options.push(f);if(((this.selectedIndex<0)||(g===true)||(this.selectedIndex>=this.options.length))&&(h!==true)){this.selectedIndex=this.options.length-1}var d=this.canvas.getElementsByTagName("select")[0];if(d){var b=document.createElement("option");b.text=f.label;b.value=f.value;b.disabled=(f.disabled===true)?"disabled":null;b.className=(f.disabled===true)?"disabled":null;try{d.add(b,null)}catch(k){d.add(b)}b=null;d.selectedIndex=this.selectedIndex}d=null},addOptions:function(a){if((a)&&(a.length>0)){var d=null;for(var b=0;d=a[b];b++){this.addOption(d.value,d.label,d.disabled,d.selected)}}},clear:function(){this.options=[];var a=this.canvas.getElementsByTagName("select")[0];if(a){a.options.length=0}a=null;this.selectedIndex=-1},destroy:function(){this.options=null;this.alt=null;this.selectedIndex=null;aw.ui.Control.prototype.destroy.apply(this)},draw:function(){aw.ui.Control.prototype.draw.apply(this);var g=$(this.canvas.getElementsByTagName("select")[0]);if(g){if((this.options)&&(this.options.length>0)){if(this.selectedIndex<0){this.selectedIndex=0}var d=[],f=null,b=[];for(var e=0;f=this.options[e];e++){if(f.selected===true){this.selectedIndex=e;b.push(' selected="selected"')}if(f.disabled===true){b.push(' disabled="disabled"')}if(b.length>0){f.flags=b.join("")}d.push(this._templates.option.evaluate(f))}g.update(d.join(""))}g.selectedIndex=this.selectedIndex;g.title=this.alt;this._onChange_fx=this.onChange.bind(this);aw.EventManager.register(g,"change",this._onChange_fx);if(this.disabled===true){g.disabled=true}}g=null;if(this.required===true){var a=this.canvas.getElementsByTagName("label")[0];a.innerHTML=this.label+"<span>*</span>";a=null}return this.canvas},erase:function(){var a=this.canvas.getElementsByTagName("select")[0];if(a){if(this._onChange_fx){aw.EventManager.unregister(a,"change",this._onChange_fx);this._onChange_fx=null}Element.remove(a);a=null}aw.ui.Control.prototype.erase.apply(this)},getValue:function(){var b=null;if(this.canvas){var a=this.canvas.getElementsByTagName("select")[0];if(a){b=a.value}a=null}else{if((this.options)&&(this.selectedIndex>-1)&&(this.options[this.selectedIndex])){b=this.options[this.selectedIndex].value}}return b},enable:function(){aw.ui.Control.prototype.enable.apply(this);var a=this.canvas.getElementsByTagName("select")[0];if(a){a.disabled=false}a=null},disable:function(){aw.ui.Control.prototype.disable.apply(this);var a=this.canvas.getElementsByTagName("select")[0];if(a){a.disabled=true}a=null},selectByIndex:function(b,a){b=parseInt(b,10);if((b>=0)&&(this.options)&&(b<this.options.length)){var e=this.options[b];if(e.disabled===true){return false}this.selectedIndex=b;if(this.canvas){var d=this.canvas.getElementsByTagName("select")[0];if(d){d.selectedIndex=b}d=null}if(a!==false){this.triggerEvent("change",this)}return true}return false},selectByPartialValue:function(f,b){if((typeof f=="undefined")||(f===null)||(!this.options)||(!this.options.length>0)){return false}f=f.toLowerCase();var g=f.length;var d=0,a=this.options.length,e=null;for(d=0;d<a;d++){e=this.options[d];if((typeof e!="undefined")&&(e.value!==null)&&(e.value.substr(0,g).toLowerCase()==f)){return this.selectByIndex(d,b)}}return false},selectByValue:function(e,a){if((typeof e=="undefined")||(e===null)||(!this.options)||(!this.options.length>0)){return false}var d=null;for(var b=0;d=this.options[b];b++){if((typeof d.value!="undefined")&&(d.value!==null)&&(d.value.toLowerCase()==e.toLowerCase())){return this.selectByIndex(b,a)}}return false},selectByLabel:function(b,a){if((!b)||(!this.options)||(!this.options.length>0)){return false}var e=null;for(var d=0;e=this.options[d];d++){if(e.label==b){return this.selectByIndex(d,a)}}return false},selectByPartialLabel:function(d,b){if((!d)||(!this.options)||(!this.options.length>0)){return false}d=d.toLowerCase();var g=d.length;var e=0,a=this.options.length,f=null;for(e=0;e<a;e++){f=this.options[e];if((typeof f!="undefined")&&(f.label!==null)&&(f.label.substr(0,g).toLowerCase()==d)){return this.selectByIndex(e,b)}}return false},setAlt:function(b){this.alt=b;var a=this.canvas.getElementsByTagName("select")[0];if(a){a.title=b}a=null},setRequired:function(b){aw.ui.Control.prototype.setRequired.apply(this,[b]);if(this.canvas){var a=this.canvas.getElementsByTagName("label");if((a)&&(a.length>0)){a[0].innerHTML=this.label+((this.required===true)?"<span>*</span>":"")}a=null}},onChange:function(){var a=this.canvas.getElementsByTagName("select")[0];if(!a){return}if(!this.selectByIndex(a.selectedIndex)){a.selectedIndex=this.selectedIndex}a=null},_templates:{ui:new Template('<label for="#{name}">#{label}</label><select name="#{name}">#{options}</select>'),option:new Template('<option value="#{value}"#{flags}>#{label}</option>')},CLASS_NAME:"aw.ui.Control.DropDown",VALID_PROPERTIES:["alt","container","cssClass","name","label","options","selectedIndex","required","validation","disabled"],EVENTS:["change"]});aw.ui.Control.FileBrowse=Class.create(aw.ui.Control,{_bb:null,value:"",fieldMap:[],fields:[],_fieldMapDropDowns:[],initialize:function(b,a){this.value="";this.fieldMap=[];this.fields=[];this._fieldMapDropDowns=[];aw.ui.Control.prototype.initialize.apply(this,[b,a])},disable:function(){if(this.canvas){this._bb.disable();var d=this.canvas.down("div.fileTextBox").down("input");if(d){d.disabled=true}d=null;if((this._fieldMapDropDowns)&&(this._fieldMapDropDowns.length>0)){for(var b=0,a=this._fieldMapDropDowns.length;b<a;b++){this._fieldMapDropDowns[b].disable()}}}aw.ui.Control.prototype.disable.apply(this)},draw:function(){aw.ui.Control.prototype.draw.apply(this);var f=this.canvas.down("div.fileButton");if(f){this._bb=new aw.ui.Control.Button({label:"Browse...",width:"30",container:f},{click:this._onBrowseButtonClick.bind(this)})}if((this.fieldMap)&&(this.fieldMap.length>0)){var d=null,a=null;var b=[];if((this.fields)&&(this.fields.length>0)){b.push({label:"Select a Field",value:""});a=this.fields.length;for(d=0;d<a;d++){b.push({label:this.fields[d].name+" ("+this.fields[d].type+")",value:this.fields[d].name})}}var e=this.canvas.down(".fileBrowse");if(e){a=this.fieldMap.length;for(d=0;d<a;d++){this._fieldMapDropDowns.push(new aw.ui.Control.DropDown({container:e,name:this.fieldMap[d].name,label:"Choose "+this.fieldMap[d].name+" ("+this.fieldMap[d].type+") Field",options:b}))}}}this.setValue(this.value);return this.canvas},enable:function(){if(this.canvas){this._bb.enable();var d=this.canvas.down("div.fileTextBox").down("input");if(d){d.disabled=false}d=null;if((this._fieldMapDropDowns)&&(this._fieldMapDropDowns.length>0)){for(var b=0,a=this._fieldMapDropDowns.length;b<a;b++){this._fieldMapDropDowns[b].enable()}}}aw.ui.Control.prototype.enable.apply(this)},erase:function(){if((this._fieldMapDropDowns)&&(this._fieldMapDropDowns.length>0)){for(var b=0,a=this._fieldMapDropDowns.length;b<a;b++){this._fieldMapDropDowns[b].destroy()}this._fieldMapDropDowns=[]}if(this._bb){this._bb.destroy();this._bb=null}aw.ui.Control.prototype.erase.apply(this)},getValue:function(){var b=this.canvas.down("div.fileTextBox").down("input");var e=(b)?b.value:"";if((b.value)&&(b.value!=="")){if((this._fieldMapDropDowns)&&(this._fieldMapDropDowns.length>0)){for(var d=0,a=this._fieldMapDropDowns.length;d<a;d++){e+="\n"+this._fieldMapDropDowns[d].name+"="+this._fieldMapDropDowns[d].getValue()}}}return e},setValue:function(b){this.value=b;b=(b||"").split("\n");var d=this.canvas.down("div.fileTextBox").down("input");if(d){d.value=b[0]}if((this._fieldMapDropDowns)&&(this._fieldMapDropDowns.length>0)){for(var d=0,a=this._fieldMapDropDowns.length;d<a;d++){this._fieldMapDropDowns[d].selectByValue(this._getFieldMapValue(this._fieldMapDropDowns[d].name))}}},_getFieldMapValue:function(e){if(!this.value){return null}var a=this.value.split("\n");if((!a)||(a.length<2)){return null}var d=null;for(var b=1;b<a.length;b++){d=a[b].split("=");if((d.length==2)&&(d[0]==e)){return d[1]}}return null},_onBrowseButtonClick:function(){if(this.disabled!==true){this.triggerEvent("click",this.canvas.down("div.fileTextBox").down("input"))}},_templates:{ui:new Template('<div class="fileBrowse" key="#{name}"><div class="label">#{label}</div><div class="fileTextBox"><input type="text" name="fbFile" id="fbFile" /></div><div class="fileButton"></div></div><div style="clear:both;"/>')},CLASS_NAME:"aw.ui.Control.FileBrowse",VALID_PROPERTIES:["componentBus","container","cssClass","name","label","value","checked","fieldMap","fields"],EVENTS:["click"]});aw.ui.Control.FileUpload=Class.create(aw.ui.Control,{value:"",name:"",input:null,_guid:null,_formId:null,_us:null,initialize:function(b,a){this.name="";this.value="";this.input=null;this._formId=this.getId("awucfu");this._guid=null;this._us=null;aw.ui.Control.prototype.initialize.apply(this,[b,a])},clear:function(){this.value="";if(this.input){this.input.value=""}},draw:function(){aw.ui.Control.prototype.draw.apply(this);var a=this.canvas.down("input");if(a){this.input=a;this._onChange_fx=this._onChange.bind(this);aw.EventManager.register(this.input,"change",this._onChange_fx)}var b=this.canvas.down("iframe");if(b){this._iframe_loaded_fx=this._iframe_loaded.bind(this);aw.EventManager.register(b,"load",this._iframe_loaded_fx)}return this.canvas},erase:function(){if(this.canvas){if((this.input)&&(this._onChange_fx)){aw.EventManager.unregister(this.input,"change",this._onChange_fx);this._onChange_fx=null}var a=this.canvas.down("iframe");if((a)&&(this._iframe_loaded_fx)){aw.EventManager.unregister(a,"load",this._iframe_loaded_fx);this._iframe_loaded_fx=null}}aw.ui.Control.prototype.erase.apply(this)},_iframe_loaded:function(){if(this._us){this._us.stop();this._us=null;this.triggerEvent("fileuploadcomplete",this._guid)}},getValue:function(){return(this.input)?this.input.value:null},disable:function(){if(this.input){this.input.disabled=true}},enable:function(){if(this.input){this.input.disabled=false}},upload:function(h,d,a){if((!h)||(h==="")){return}var g=document.getElementById(this._formId);if(g){this._guid=this.getId("awufui");this.input.name=this._guid+"_file";g.action=h+"?akey="+d+"&skey="+a;g.encoding="multipart/form-data";g.method="POST";g.target=this._formId+"_frame";g.submit();this._us=new Ajax.PeriodicalUpdater("",h+"?guid="+this._guid+"_file",{method:"get",frequency:"1",decay:"2",onSuccess:this._status_received.bind(this)});var b=g.getElementsByTagName("input");if((b)&&(b.length>0)){for(var e=0;e<b.length;e++){if((b[e].type)&&(b[e].type.toLowerCase()=="file")){b[e].value=""}}}}},_onChange:function(){this.triggerEvent("change",this)},_status_received:function(a){if(this._us){var b=null;if(a.responseText.unfilterJSON().isJSON()){b=a.responseText.evalJSON(true);if((b)&&(b.uploadStatus)&&(b.uploadStatus.percentComplete)){this.triggerEvent("uploadstatus",b.uploadStatus.percentComplete)}}}},_templates:{ui:new Template('<form id="#{_formId}" action="#"><div style="position:relative; top:0px; left:0px; border:none; display:none; width:2px; height:2px; overflow:hidden;"><iframe id="#{_formId}_frame" name="#{_formId}_frame" src=""></iframe></div><label>#{label}<input type="file" /></label></form>')},CLASS_NAME:"aw.ui.Control.FileUpload",VALID_PROPERTIES:["container","label","name","value"],EVENTS:["uploadstatus","fileuploadcomplete","change"]});aw.ui.Control.GeoInput=Class.create(aw.ui.Control.Button,{multiple:false,name:"",type:null,value:null,initialize:function(b,a){this.multiple=false;this.name="";this.type=null;this.value=null;this.inheritCSS=true;aw.ui.Control.Button.prototype.initialize.apply(this,arguments)},getValue:function(){return this.value},setValue:function(a){this.value=a},VALID_PROPERTIES:["alt","container","cssClass","label","align","disabled","icon","url","value","type","name","mulitple"],CLASS_NAME:"aw.ui.Control.GeoInput"});aw.ui.Control.Icon=Class.create(aw.ui.Control,{hasFocus:false,icons:[],selectedIndex:0,_blur_fx:null,_icons:[],initialize:function(b,a){this.hasFocus=false;this.icons=[];this.selectedIndex=0;this._icons=aw.icons;if((b)&&(b.icons)){this._icons=aw.icons.concat(b.icons)}aw.ui.Control.prototype.initialize.apply(this,arguments);this._blur_fx=this._onBlur.bind(this)},addIcon:function(a){this._icons.push(a)},addIcons:function(b){if((!b)||(!b.length>0)){return}for(var a=0;a<b.length;a++){this.addIcon(b[a])}},draw:function(){aw.ui.Control.prototype.draw.apply(this);if(this.canvas){aw.EventManager.register(this.canvas,"click",this._onClick.bind(this));if((!this.value)||(!this.selectByValue(this.value,false))){this.selectByIndex(this.selectedIndex,false)}}return this.canvas},getIconByKey:function(b){if((!b)||(b==="")||(!this._icons)||(!this._icons.length>0)){return null}for(var a=0;a<this._icons.length;a++){if(this._icons[a].id==b){return this._icons[a]}}return null},getSelectedIcon:function(){if((this._icons)&&(this._icons.length>0)&&(this.selectedIndex>-1)&&(this._icons[this.selectedIndex])){return this._icons[this.selectedIndex]}return null},getValue:function(){return this.value},selectByIndex:function(d,e){d=parseInt(d,10);if((isNaN(d))||(d<0)||(d>this._icons.length>0)||(!this._icons[d])){return false}this.selectedIndex=d;this.value=this._icons[d].src;if(this.canvas){var a=this.canvas.down("div.icon > span");var b=this.getSelectedIcon();if((a)&&(b)){a.setStyle({backgroundImage:"url('"+b.toURL()+"')"})}a=null;b=null}if(e!==false){this.triggerEvent("change",this)}return true},selectByKey:function(b,d){if((!b)||(b==="")||(!this._icons)||(!this._icons.length>0)){return false}for(var a=0;a<this._icons.length;a++){if(this._icons[a].id==b){return this.selectByIndex(a,d)}}return false},selectByValue:function(d,b){if((!d)||(d==="")||(!this._icons)||(!this._icons.length>0)){return false}for(var a=0;a<this._icons.length;a++){if(this._icons[a].src==d){return this.selectByIndex(a,b)}}return false},_onBlur:function(d){var b=aw.EventManager.getEvent(d);var a=b.target;if(!a){return}if(this.canvas){if((a)&&(a.id==this.canvas.id)||(a.up('div[id="'+this.canvas.id+'"]'))){return}}if((a.hasClassName("popup"))||(a.up('div[class="aw_ui_Control_Icon popup"]'))){return}if(this.hasFocus===true){if(this._blur_fx){aw.EventManager.unregister(document.getElementsByTagName("body")[0],"mousedown",this._blur_fx)}this._togglePopup();return}},_onClick:function(){this._togglePopup()},_onPopupClick:function(f){var d=aw.EventManager.getEvent(f);var a=d.target;if((a)&&(a.tagName)&&(a.tagName.toLowerCase()=="li")){var b=a.getAttribute("key");if(b){this.selectByKey(b);this._togglePopup()}}else{if((a)&&(!a.up("div."+this.getCSSClassName()))){this._togglePopup()}}},_togglePopup:function(){var f=$(this._popupId);if(f){if(this._onpopupclick_fx){aw.EventManager.unregister(document,"click",this._onpopupclick_fx);this._onpopupclick_fx=null}f.remove();f=null;this._popupId=null;this.hasFocus=false;return}this._popupId=this.getId("awcpu");Element.insert(document.getElementsByTagName("body")[0],this._templates.popup.evaluate({id:this._popupId,cssClass:this.getCSSClassName()}));var e=this.canvas.getDimensions();var a=this.canvas.cumulativeOffset();f=$(this._popupId);var g=[];if((this._icons)&&(this._icons.length>0)){for(var b=0;b<this._icons.length;b++){g.push('<li key="'+this._icons[b].id+'" style="background-image: url(\''+this._icons[b].toURL()+"');\""+((b==this.selectedIndex)?' class="active"':"")+">&#160;</li>")}f.insert("<ul>"+g.join("")+"</ul>")}var d=f.getDimensions();f.setStyle({top:""+(a.top+e.height)+"px",left:""+(a.left)+"px",height:""+((d.height>150)?"200px":"auto")+""});this.hasFocus=true;this._onpopupclick_fx=this._onPopupClick.bind(this);aw.EventManager.register.bind(aw.EventManager,document,"click",this._onpopupclick_fx).delay(0.1);aw.EventManager.register(document.getElementsByTagName("body")[0],"mousedown",this._blur_fx)},_templates:{ui:new Template('<label>#{label}</label><div class="icon"><span></span></div>'),popup:new Template('<div id="#{id}" class="#{cssClass} popup"></div>')},EVENTS:["change"],VALID_PROPERTIES:["container","hasFocus","icons","label","name","value","selectedIndex"],CLASS_NAME:"aw.ui.Control.Icon"});aw.ui.Control.Label=Class.create(aw.ui.Control,{label:"",value:"",initialize:function(b,a){this.label="";this.value="";aw.ui.Control.prototype.initialize.apply(this,[b,a])},setLabel:function(a){this.label=a;if(this.canvas){var b=this.canvas.down("span.label");if(b){b.innerHTML=this.label}}},setValue:function(b){this.value=b;if(this.canvas){var a=this.canvas.down("span.value");if(a){a.innerHTML=this.value}}},_templates:{ui:new Template('<span class="label">#{label}</span><span class="value">#{value}</span>')},VALID_PROPERTIES:["container","cssClass","name","label","value"],CLASS_NAME:"aw.ui.Control.Label"});aw.ui.Control.LabelGroup=Class.create(aw.ui.Control,{label:null,items:[],initialize:function(b,a){this.items=[];this.label="";aw.ui.Control.prototype.initialize.apply(this,[b,a])},add:function(a){if(!a){return}this.items.push(a);this.drawItem(a)},clear:function(){this.items=[];this.draw()},draw:function(){aw.ui.Control.prototype.draw.apply(this);if((this.items)&&(this.items.length>0)){for(var b=0,a=this.items.length;b<a;b++){this.drawItem(this.items[b])}}return this.canvas},drawItem:function(b){if((this.canvas)&&(b)&&(b.draw)){var a=this.canvas.down("div.group");if(a){var d=b.draw();a.insert(d)}}},_templates:{ui:new Template('<div class="label">#{label}</div><div class="group"></div>')},CLASS_NAME:"aw.ui.Control.LabelGroup",VALID_PROPERTIES:["container","cssClass","name","label","items"],EVENTS:[]});aw.ui.Control.Link=Class.create(aw.ui.Control,{label:"",url:"javascript:void(0);",_onClick_fx:null,initialize:function(b,a){this.label="";this.url="javascript:void(0);";this._onClick_fx=null;aw.ui.Control.prototype.initialize.apply(this,[b,a])},disable:function(){aw.ui.Control.prototype.disable.apply(this);var b=this.canvas.getElementsByTagName("a")[0];if(b){b.href="javascript:void(0)"}return true},draw:function(){aw.ui.Control.prototype.draw.apply(this);var b=this.canvas.getElementsByTagName("a")[0];if(b){this._onClick_fx=this._onClick.bind(this);aw.EventManager.register(b,"click",this._onClick_fx)}b=null;return this.canvas},enable:function(){aw.ui.Control.prototype.enable.apply(this);var b=this.canvas.getElementsByTagName("a")[0];if(b){b.href=this.url}return true},erase:function(){if(this.canvas){var b=this.canvas.getElementsByTagName("a")[0];if((b)&&(this._onClick_fx)){aw.EventManager.unregister(b,"click",this._onClick_fx);this._onClick_fx=null}b=null}aw.ui.Control.prototype.erase.apply(this)},setLabel:function(d){this.label=d;if(this.canvas){var b=this.canvas.getElementsByTagName("a")[0];if(b){b.innerHTML=this.label}b=null}},setURL:function(d){this.url=d;if(this.canvas){var b=this.canvas.getElementsByTagName("a")[0];if(b){b.href=this.url}b=null}},_onClick:function(){if(this.disabled){return}this.triggerEvent("click",this)},_templates:{ui:new Template('<a href="#{url}">#{label}</a>')},VALID_PROPERTIES:["container","cssClass","name","label","url"],EVENTS:["click"],CLASS_NAME:"aw.ui.Control.Link"});aw.ui.Control.MultiSelectListBox=Class.create(aw.ui.Control,{options:[],multipleCustom:false,multipleStart:null,multipleEnd:null,multipleSeparator:null,defaultAllChecked:false,initialize:function(b,a){this.options=[];this.multipleCustom=false;this.multipleStart="";this.multipleEnd="";this.multipleSeparator=",";this.defaultAllChecked=false;aw.ui.Control.prototype.initialize.apply(this,[b,a])},addOption:function(e,a,d){e=e||"";a=a||"";d=(d===true)?true:false;var b={value:e,label:a,selected:(d|this.defaultAllChecked)};this.options.push(b);var f=this.canvas.down("div.options");if(f){f.insert('<input type="checkbox" value="'+b.value+'"'+((b.selected)?' checked="checked"':"")+"/> "+b.label+"<br/>")}},addOptions:function(a){if((a)&&(a.length>0)){var d=null;for(var b=0;d=a[b];b++){this.addOption(d.value,d.label,d.selected)}}},clear:function(){this.options=[];while(this.canvas.firstDescendant()){this.canvas.firstDescendant().remove()}},draw:function(){aw.ui.Control.prototype.draw.apply(this);var d=this.canvas.down("a.all");if(d){this._selectAll_fx=this.selectAll.bind(this);aw.EventManager.register(d,"click",this._selectAll_fx)}d=this.canvas.down("a.none");if(d){this._deselectAll_fx=this.deselectAll.bind(this);aw.EventManager.register(d,"click",this._deselectAll_fx)}var h=this.canvas.down("div.options");if(h){if((this.options)&&(this.options.length>0)){var e=[];var g=null;for(var f=0,b=this.options.length;f<b;f++){g=this.options[f];e.push('<input type="checkbox" value="'+g.value+'"'+((g.selected|this.defaultAllChecked)?' checked="checked"':"")+"/> "+g.label+"<br/>")}h.innerHTML=e.join("")}}h=null;return this.canvas},erase:function(){if(this.canvas){var b=this.canvas.down("a.all");if((b)&&(this._selectAll_fx)){aw.EventManager.unregister(b,"click",this._selectAll_fx);this._selectAll_fx=null}b=this.canvas.down("a.none");if((b)&&(this._deselectAll_fx)){aw.EventManager.unregister(b,"click",this._deselectAll_fx);this._deselectAll_fx=null}}aw.ui.Control.prototype.erase.apply(this)},getValue:function(){var e=this.canvas.select('input[type="checkbox"]');if(!e){return null}var d=[];for(var b=0,a=e.length;b<a;b++){if(this.multipleCustom===true){if(e[b].checked){d.push(e[b].value)}}else{d.push(e[b].value+"="+e[b].checked)}}if(this.multipleCustom){return this.multipleStart+d.join(this.multipleSeparator)+this.multipleEnd}else{return d.join(",")}},enable:function(){aw.ui.Control.prototype.enable.apply(this);var d=this.canvas.getElementsByTagName("input");if((d)&&(d.length>0)){for(var b=0,a=d.length;b<a;b++){d[b].disabled=false}}d=null;return true},disable:function(){aw.ui.Control.prototype.disable.apply(this);var d=this.canvas.getElementsByTagName("input");if((d)&&(d.length>0)){for(var b=0,a=d.length;b<a;b++){d[b].disabled=true}}d=null;return true},selectAll:function(){if(this.disabled){return false}var d=this.canvas.getElementsByTagName("input");if((d)&&(d.length>0)){for(var b=0,a=d.length;b<a;b++){d[b].checked=true}}d=null;return true},deselectAll:function(){if(this.disabled){return false}var d=this.canvas.getElementsByTagName("input");if((d)&&(d.length>0)){for(var b=0,a=d.length;b<a;b++){d[b].checked=false}}d=null;return true},selectByIndex:function(a){},selectByValue:function(a){},_templates:{ui:new Template('<div class="label">#{label}</div><div class="allNoneOption"><a class="all">All</a> | <a class="none">None</a></div><div style="clear:both;"></div><div class="options"></div>')},CLASS_NAME:"aw.ui.Control.MultiSelectListBox",VALID_PROPERTIES:["container","cssClass","name","label","options","defaultAllChecked","multipleCustom","multipleStart","multipleSeparator","multipleEnd"],EVENTS:[]});aw.ui.Control.NumericUpDown=Class.create(aw.ui.Control,{defaultValue:null,label:"",value:null,input:null,initialize:function(f,e){var d=null;var g=true,h=true;this._withinMinMax=true;this.label="";this.value=null;this.input=null;aw.ui.Control.prototype.initialize.apply(this,[f,e]);var b=this.minimum;var a=this.maximum;this.defaultValue=this.defaultValue||0;d=this.defaultValue;this.increment=parseFloat(this.increment)||1;if(!isNaN(d)){this._validInput=true;if((b||(b===0))||(a||(a===0))){if(b||(b===0)){if(d<b){g=false}}if(a||(a===0)){if(d>a){h=false}}if(!g||!h){this._withinMinMax=false}if(this._withinMinMax){this.value=d}}else{this.value=d}}},disable:function(){if(this.input){this.input.disabled=true}},draw:function(){aw.ui.Control.prototype.draw.apply(this);var a=this.canvas.down("input");if(a){this.input=a;this.input.value=this.defaultValue;this._onchange_fx=this._onchange.bind(this);aw.EventManager.register(this.input,"change",this._onchange_fx);var d=this.canvas.down("a.up");var b=this.canvas.down("a.down");if((d)&&(b)){this._up_onclick_fx=this._up_onclick.bind(this);this._down_onclick_fx=this._down_onclick.bind(this);aw.EventManager.register(d,"click",this._up_onclick_fx);aw.EventManager.register(b,"click",this._down_onclick_fx)}}return this.canvas},enable:function(){if(this.input){this.input.disabled=false}},erase:function(){if(this.canvas){var a=this.canvas.down("a.down");if((a)&&(this._down_onclick_fx)){aw.EventManager.unregister(a,"click",this._down_onclick_fx);this._down_onclick_fx=null}a=null;var b=this.canvas.down("a.up");if((b)&&(this._up_onclick)){aw.EventManager.unregister(b,"click",this._up_onclick_fx);this._up_onclick=null}b=null;if((this.input)&&(this._onchange_fx)){aw.EventManager.unregister(this.input,"change",this._onchange_fx);this._onchange_fx=null}}aw.ui.Control.prototype.erase.apply(this)},getValue:function(){var a=parseFloat((this.input)?this.input.value:this.value);return isNaN(a)?0:a},update:function(){if(!this.input){return}this.input.value=this.value},_down_onclick:function(g){var f,a,d,b;if(this.input.disabled===true){return}if(!this._validInput){if(!isNaN(this.value)){this._validInput=true}return}f=parseFloat(this.minimum);a=parseFloat(this.maximum);d=this.increment;b=parseFloat(this.input.value);if(b>a){this.value=a;this.update();return}if(b-d>=f){b-=d}else{b=f}this.value=b;this.update()},_onchange:function(){var a=this.input.value;if(isNaN(a)){this._validInput=false;this.update();return}else{this._validInput=true}if((this.minimum||(this.minimum===0))&&(a<this.minimum)){this.value=this.minimum;this.update();return}if((this.maximum)&&(a>this.maximum)){this.value=this.maximum;this.update();return}this.value=a;this.update()},_up_onclick:function(g){var a,f,d,b;if(this.input.disabled===true){return}if(!this._validInput){if(!isNaN(this.value)){this._validInput=true}return}a=parseFloat(this.maximum);f=parseFloat(this.minimum);d=this.increment;b=parseFloat(this.input.value);if(b<f){this.value=f;this.update();return}if(b+d<=a){b+=d}else{b=a}this.value=b;this.update()},_templates:{ui:new Template('<label for="#{name}">#{label}</label><div class="numeric"><input type="text" name="#{name}" /><a class="up"/><a class="down"/></div><div style="clear:both;"/>')},CLASS_NAME:"aw.ui.Control.NumericUpDown",VALID_PROPERTIES:["container","cssClass","label","name","decimalPlaces","defaultValue","increment","maximum","minimum"],EVENTS:["change"]});aw.ui.Control.Radiobox=Class.create(aw.ui.Control,{value:null,check:null,checked:false,_onClick_fx:null,initialize:function(b,a){this.value=null;this.check=null;this.checked=false;this.label="";this._onClick_fx=null;aw.ui.Control.prototype.initialize.apply(this,[b,a])},disable:function(){aw.ui.Control.prototype.disable.apply(this);if(this.check){this.check.disabled=true}},draw:function(){this._checked=(this.checked===true)?' checked="checked"':"";aw.ui.Control.prototype.draw.apply(this);var a=this.canvas.down('input[type="radio"]');if(a){this.check=a;if(this.checked===true){this.check.checked=true}this._onClick_fx=this.onClick.bind(this);aw.EventManager.register(this.check,"click",this._onClick_fx)}return this.canvas},enable:function(){aw.ui.Control.prototype.enable.apply(this);if(this.check){this.check.disabled=false}},erase:function(){if(this.check){if(this._onClick_fx){aw.EventManager.unregister(this.check,"click",this._onClick_fx);this._onClick_fx=null}}aw.ui.Control.prototype.erase.apply(this)},getValue:function(){if((this.checked===true)&&((!this.check)||(this.check.checked===true))){return this.value}return null},onClick:function(d){var b=aw.EventManager.getEvent(d);var a=b.target;if((!a)||(!a.tagName)||(a.tagName.toLowerCase()!="input")){return}this.setChecked(a.checked)},setChecked:function(a){if(a!==this.checked){this.checked=a;this.triggerEvent("change",this)}},_templates:{ui:new Template('<input type="radio" name="#{name}" value="#{value}" id="#{id}"#{_checked} /> #{label}')},CLASS_NAME:"aw.ui.Control.Radiobox",VALID_PROPERTIES:["container","cssClass","name","label","value","checked"],EVENTS:["change"]});aw.ui.Control.RadioGroup=Class.create(aw.ui.Control,{checked:null,group:"",items:[],radio:null,_onChange_fx:null,initialize:function(b,a){this.items=[];this.checked=false;this.group="";this._onChange_fx=null;if(b){this.group=b.group||b.name}aw.ui.Control.prototype.initialize.apply(this,[b,a])},add:function(a){if(!a){return}this.items.push(a);if(this.canvas){this.canvas.addClassName("border")}this.drawItem(a)},afterDraw:function(){if((this.checked===true)||((typeof this.checked=="string")&&(this.checked.toLowerCase()=="true"))){if(this.radio){this.radio.checked=true}this.checked=true}else{if(this.radio){this.radio.checked=false}this.checked=false}this.update()},check:function(){if((this.checked===true)||(this.disabled===true)){return}this.checked=true;if(this.radio){this.radio.checked=true}this.update();this.triggerEvent("change",this)},clear:function(){this.items=[];this.draw()},disable:function(){aw.ui.Control.prototype.disable.apply(this);if(this.radio){this.radio.disabled=true}this.update()},draw:function(){aw.ui.Control.prototype.draw.apply(this);var b=this.canvas.down('input[type="radio"]');if(b){this.radio=b;this._onChange_fx=this.onChange.bind(this);aw.EventManager.register(this.radio,"click",this._onChange_fx);if((this.checked===true)||((typeof this.checked=="string")&&(this.checked.toLowerCase()=="true"))){this.checked=true;this.radio.checked=true}}if((this.items)&&(this.items.length>0)){for(var d=0,a=this.items.length;d<a;d++){this.drawItem(this.items[d])}this.canvas.addClassName("border")}else{this.canvas.removeClassName("border")}this.update();return this.canvas},drawItem:function(b){if((this.canvas)&&(b)&&(b.draw)){var a=this.canvas.down("div.contents");if(a){a.insert(b.draw())}a=null}},enable:function(){aw.ui.Control.prototype.enable.apply(this);if(this.radio){this.radio.disabled=false}this.update()},erase:function(){if(this.radio){if(this._onChange_fx){aw.EventManager.unregister(this.radio,"click",this._onChange_fx);this._onChange_fx=null}this.radio.remove();this.radio=null}aw.ui.Control.prototype.erase.apply(this)},getKey:function(){return this.key},getValue:function(){return this.checked||false},onChange:function(d){var b=aw.EventManager.getEvent(d);var a=b.target;if(!a){return}this.checked=a.checked;this.triggerEvent("change",this)},uncheck:function(){if((this.checked===false)||(this.disabled===true)){return}this.checked=false;if(this.radio){this.radio.checked=false}this.update();this.triggerEvent("change",this)},update:function(){if(this.radio){this.disabled=this.radio.disabled;this.checked=this.radio.checked}if((!this.items)||(!this.items.length>0)){return}for(var b=0,a=this.items.length;b<a;b++){if(((this.disabled)||(!this.checked))&&(this.items[b].disable)){this.items[b].disable()}else{if(this.items[b].enable){this.items[b].enable()}}}},_templates:{ui:new Template('<div class="fieldlabel"><input type="radio" name="#{group}" key="#{key}" /> #{label}</div><div class="contents"></div>')},CLASS_NAME:"aw.ui.Control.RadioGroup",VALID_PROPERTIES:["container","cssClass","group","name","key","label","items","checked"],EVENTS:["change"]});aw.ui.Control.Slider=Class.create(aw.ui.Control,{disabled:false,handleCount:null,orientation:"",range:null,sliderValue:null,_handleLength:null,_handles:null,_isActive:false,_isSliding:false,_track:null,_trackLength:null,_value:null,_values:[],_mousedown_fx:null,_mousemove_fx:null,_mouseup_fx:null,_onchange_fx:null,_onslide_fx:null,initialize:function(b,a){this.disabled=false;this.handleCount=1;this.orientation="horizontal";this.range=[0,100];this.sliderValue=0;this._handleLength=null;this._handles=null;this._isActive=false;this._isSliding=false;this._track=null;this._trackLength=null;this._value=null;this._values=[];this._mousedown_fx=this._onslidestart.bindAsEventListener(this);this._mousemove_fx=this._onslideupdate.bindAsEventListener(this);this._mouseup_fx=this._onslidestop.bindAsEventListener(this);this._onchange_fx=this._onchange;this._onslide_fx=this._onslide;aw.ui.Control.prototype.initialize.apply(this,[b,a])},afterDraw:function(){aw.ui.Control.prototype.afterDraw.apply(this);this.setRange(this.range);var d=this;var a=this.canvas.down("div.sliderTrack_"+this.orientation);this._track=a;if(this._track){for(var b=0;this.handleCount>b;b++){this._track.insert('<span class="sliderHandle_'+this.orientation+'"></span>')}if(this.disabled===true){this.disable()}}if(this.handleCount>0){this._handles=this.canvas.select(".sliderHandle_"+this.orientation);if(!this._handleLength||!this._trackLength){if(this.testVertical()){this._handleLength=this._handles[0].offsetHeight;this._trackLength=this._track.offsetHeight}else{this._handleLength=this._handles[0].offsetWidth;this._trackLength=this._track.offsetWidth}}this._handles.each(function(f,e){e=d._handles.length-1-e;d.setValue(parseFloat((Object.isArray(d.sliderValue)?d.sliderValue[e]:d.sliderValue)||d.range.start),e);aw.EventManager.register(f,"mousedown",d._mousedown_fx,this)});aw.EventManager.register(this._track,"mousedown",this._mousedown_fx,this);aw.EventManager.register(document,"mouseup",this._mouseup_fx,this);aw.EventManager.register(document,"mousemove",this._mousemove_fx,this)}},changeHandleStyle:function(){var a=null;if(!this.disabled){a="selected_"+this.orientation;this._handles.each(function(b){Element.removeClassName(b,a)})}else{a="disabled"}Element.addClassName(this.activeHandle,a)},disable:function(){if(this.disabled===true){return}this.disabled=true;this.changeHandleStyle()},drawSlider:function(b){this._event=b;var d=[Event.pointerX(b),Event.pointerY(b)];var a=this._track.cumulativeOffset();d[0]-=this.offsetX+a[0];d[1]-=this.offsetY+a[1];this.setValue(this.translateValue(this.testVertical()?d[1]:d[0]));if(this._onslide_fx){this._onslide_fx(this._values.length>1?this._values:this._value,this)}},finishSlide:function(){this._isActive=false;this._isSliding=false;this.updateDone()},getValue:function(a){if(a<this.range.start){return this.range.start}if(a>this.range.end){return this.range.end}return a},setRange:function(b){if(b){this.range=$R(b[0],b[1]);if(this.range){if(this.range.start>this.range.end){var a=this.range.end;this.range.end=this.range.start;this.range.start=a}}}},setValue:function(d,a,b){if(!this._isActive){this.activeHandleIndex=a||0;this.activeHandle=this._handles[this.activeHandleIndex];this.changeHandleStyle()}a=a||this.activeHandleIndex||0;d=this.getValue(d);this._values[a]=d;this._value=this._values[0];this._handles[a].style[this.testVertical()?"top":"left"]=this.translatePixels(d);if((!this._isSliding||!this._event)&&b!==false){this.updateDone()}},testVertical:function(){return(this.orientation==="vertical")},translatePixels:function(a){return Math.ceil(((this._trackLength-this._handleLength)/(this.range.end-this.range.start))*(a-this.range.start))+"px"},translateValue:function(a){return Math.ceil((a/(this._trackLength-this._handleLength)*(this.range.end-this.range.start))+this.range.start)},updateDone:function(){if(this._onchange_fx){this._onchange_fx(this._values.length>1?this._values:this._value,this)}this._event=null},_onchange:function(a,b){this.triggerEvent("onchange",a,b)},_onslide:function(a,b){this.triggerEvent("onslide",a,b)},_onslidestart:function(f){if(!f){return}if(Event.isLeftClick(f)){if(!this.disabled){this._isActive=true;var d=Event.findElement(f);var b;var g=[Event.pointerX(f),Event.pointerY(f)];var a=d;if(a==this._track){b=this._track.cumulativeOffset();this._event=f;this.setValue(this.translateValue((this.testVertical()?g[1]-b[1]:g[0]-b[0])-(this._handleLength/2)));b=this.activeHandle.cumulativeOffset();this.offsetX=(g[0]-b[0]);this.offsetY=(g[1]-b[1])}else{while((this._handles.indexOf(d)==-1)&&(d.parentNode)){d=d.parentNode}if(this._handles.indexOf(d)!=-1){this.activeHandle=d;this.activeHandleIndex=this._handles.indexOf(this.activeHandle);this.changeHandleStyle();b=this.activeHandle.cumulativeOffset();this.offsetX=(g[0]-b[0]);this.offsetY=(g[1]-b[1])}}}Event.stop(f)}},_onslidestop:function(a){if(this._isActive&&this._isSliding){this.finishSlide(a,true);Event.stop(a)}this._isActive=false;this._isSliding=false},_onslideupdate:function(a){if(this._isActive){if(!this._isSliding){this._isSliding=true}this.drawSlider(a);if(Prototype.Browser.Webkit){window.scrollBy(0,0)}Event.stop(a)}},_templates:{ui:new Template('<div class="sliderTrack_#{orientation}"></div>')},CLASS_NAME:"aw.ui.Control.Slider",EVENTS:["onchange","onslide"],VALID_PROPERTIES:["container","disabled","handleCount","orientation","range","sliderValue","cssClass"]});aw.ui.Control.TextBox=Class.create(aw.ui.Control,{changeDelay:-1,input:null,maxlength:null,multiline:false,name:"",type:"text",value:"",_changeDelayTimeout:null,_onChange_fx:null,_onKeyDown_fx:null,initialize:function(b,a){this.changeDelay=-1;this.input=null;this.maxlength=null;this.multiline=false;this.name="";this.type="text";this.value="";this._changeDelayTimeout=null;this._onChange_fx=null;this._onKeyDown_fx=null;aw.ui.Control.prototype.initialize.apply(this,[b,a])},afterDraw:function(){aw.ui.Control.prototype.afterDraw.apply(this);if(this.hasFocus===true){var a=this.canvas.down((this.multiline===true)?"textarea":"input");if(a){a.focus()}a=null}},blur:function(){if(this.hasFocus!==true){return}aw.ui.Control.prototype.blur.apply(this);var a=this.canvas.getElementsByTagName((this.multiline===true)?"textarea":"input")[0];if(a){a.blur()}a=null},clear:function(){this.value="";var a=this.canvas.getElementsByTagName((this.multiline===true)?"textarea":"input")[0];if(a){a.value=""}a=null},draw:function(){aw.ui.Control.prototype.draw.apply(this);if(this.multiline===true){this.canvas.insert('<textarea name="'+this.name+'">'+(this.value||"")+"</textarea>")}else{this.canvas.insert('<input type="'+this.type+'" name="'+this.name+'" value="'+(this.value||"")+'" maxlength="'+this.maxlength+'" />')}var b=this.canvas.getElementsByTagName((this.multiline===true)?"textarea":"input")[0];if(b){this._onChange_fx=this._onChange.bind(this,(this.changeDelay>-1)?false:true);this._onKeyDown_fx=this._onKeyDown.bind(this);aw.EventManager.register(b,"change",this._onChange_fx);aw.EventManager.register(b,"keydown",this._onKeyDown_fx);if(this.disabled===true){b.disabled=true}}b=null;if(this.required===true){var a=this.canvas.getElementsByTagName("label")[0];a.innerHTML=this.label+"<span>*</span>";a=null}return this.canvas},disable:function(){aw.ui.Control.prototype.disable.apply(this);var a=this.canvas.getElementsByTagName((this.multiline===true)?"textarea":"input")[0];if(a){a.disabled=true}a=null},enable:function(){aw.ui.Control.prototype.enable.apply(this);var a=this.canvas.getElementsByTagName((this.multiline===true)?"textarea":"input")[0];if(a){a.disabled=false}a=null},erase:function(){var a=this.canvas.getElementsByTagName((this.multiline===true)?"textarea":"input")[0];if(a){if(this._onChange_fx){aw.EventManager.unregister(a,"change",this._onChange_fx);this._onChange_fx=null}if(this._onKeyDown_fx){aw.EventManager.unregister(a,"keydown",this._onKeyDown_fx);this._onKeyDown_fx=null}Element.remove(a);a=null}aw.ui.Control.prototype.erase.apply(this)},focus:function(){if(this.hasFocus===true){return}aw.ui.Control.prototype.focus.apply(this);var a=this.canvas.getElementsByTagName((this.multiline===true)?"textarea":"input")[0];if(a){a.focus()}a=null},getValue:function(){var b=this.value;if(this.canvas){var a=this.canvas.getElementsByTagName((this.multiline===true)?"textarea":"input")[0];if(a){b=a.value}a=null}return b},serialize:function(){var a=this.getValue();return'<Value name="'+this.name+'"><![CDATA['+(a===null?"":a.replace(/\]/gi,"]]>]<![CDATA["))+"]]></Value>"},setRequired:function(b){aw.ui.Control.prototype.setRequired.apply(this,[b]);if(this.canvas){var a=this.canvas.getElementsByTagName("label");if((a)&&(a.length>0)){a[0].innerHTML=this.label+((this.required===true)?"<span>*</span>":"")}a=null}},setValue:function(b){this.value=b;if(this.canvas){var a=this.canvas.getElementsByTagName((this.multiline===true)?"textarea":"input")[0];if(a){a.value=b}a=null}},_onChange:function(b){if(this.canvas){var a=this.canvas.getElementsByTagName((this.multiline===true)?"textarea":"input")[0];if((!a)||(this.value==a.value)){return}this.value=a.value;if(b===true){this.triggerEvent("change",this)}}},_onKeyDown:function(f){var d=aw.EventManager.getEvent(f);var a=d.target;if(this._changeDelayTimeout){clearTimeout(this._changeDelayTimeout);this._changeDelayTimeout=null}this._changeDelayTimeout=setTimeout(this._onChange.bind(this,true),this.changeDelay);var b=this.canvas.getElementsByTagName((this.multiline===true)?"textarea":"input")[0];if(b){this.value=b.value}if(d.keyCode==13){this.triggerEvent("enter",this)}},_templates:{ui:new Template('<label for="#{name}">#{label}</label>')},CLASS_NAME:"aw.ui.Control.TextBox",VALID_PROPERTIES:["container","changeDelay","cssClass","label","name","value","type","hasFocus","cssClass","multiline","required","validation","maxlength","disabled"],EVENTS:["change","enter"]});aw.ui.Control.Tree=Class.create(aw.ui.Control,{name:"",numberOfLines:0,tree:null,value:[],customSerialize:{},initialize:function(b,a){this.name="";this.numberOfLines=0;this.tree=null;this.value=[];this.customSerialize={};aw.ui.Control.prototype.initialize.apply(this,[b,a])},clear:function(){this.value=[];if(this.tree){this.tree.clearSelection()}},disable:function(){aw.ui.Control.prototype.disable.apply(this);if(this.tree){return this.tree.disable()}return true},draw:function(){aw.ui.Control.prototype.draw.apply(this);this.canvas.insert("<label>"+this.label+'</label><div class="treecontainer" style="position: relative; height: '+(this.numberOfLines*18)+'px;"></div>');if(this.tree){if((this.tree.baseRequest)&&(this.value)&&(this.value.length>0)){Object.extend(this.tree.baseRequest,{k:this.value})}this.tree.disabled=this.disabled;this._onTreeSelectionChanged_fx=this._onTreeSelectionChanged.bind(this);this._onTreeNodesAdded_fx=this._onTreeNodesAdded.bind(this);this.tree.registerEvent("onselectionchanged",this._onTreeSelectionChanged_fx);this.tree.registerEvent("onnodesadded",this._onTreeNodesAdded_fx);this.tree.setContainer(this.canvas.getElementsByTagName("div")[0])}return this.canvas},enable:function(){aw.ui.Control.prototype.enable.apply(this);if(this.tree){return this.tree.enable()}return true},erase:function(){if(this.tree){this.tree.erase();if(this._onTreeNodesAdded_fx){this.tree.unregisterEvent("onnodesadded",this._onTreeNodesAdded_fx);this._onTreeNodesAdded_fx=null}if(this._onTreeSelectionChanged_fx){this.tree.unregisterEvent("onselectionchanged",this._onTreeSelectionChanged_fx);this._onTreeSelectionChanged_fx=null}}aw.ui.Control.prototype.erase.apply(this)},getValue:function(){return this.value},serialize:function(){var a=this.getValue();return'<Value name="'+this.name+'"><![CDATA['+(a===null?"":a.replace(/\]/gi,"]]>]<![CDATA["))+"]]></Value>"},setValue:function(a){this.value=a},_onTreeNodesAdded:function(){this._onTreeSelectionChanged(this.tree)},_onTreeSelectionChanged:function(a){this.value=a.getSelectedKeys();this.triggerEvent("ontreeselectionchanged",this,a)},CLASS_NAME:"aw.ui.Control.Tree",VALID_PROPERTIES:["container","cssClass","label","name","numberOfLines","value","tree","customSerialize"],EVENTS:["ontreeselectionchanged"]});aw.ui.Dialog=Class.create(aw.ui,{title:"",centerable:false,closeable:true,items:[],moveable:true,width:null,content:null,_buttons:[],_mousemove_fx:null,_mousedown_fx:null,_mouseup_fx:null,_onclose_fx:null,_selectstart_fx:null,initialize:function(d,b){this.title="";this.closeable=true;this.items=[];this.moveable=true;this.width=null;this.content=null;this.centerable=false;this._buttons=[];this._mousemove_fx=null;this._mousedown_fx=this._onmousedown.bind(this);this._mouseup_fx=null;this._onclose_fx=null;this._selectstart_fx=null;this._constraints={t:0,r:0,b:0,l:0};if((d)&&(d.items)&&(d.items.length>0)){var e=null;for(var a=0;a<d.items.length;a++){e=d.items[a];this.add(e,false)}}aw.ui.prototype.initialize.apply(this,[d,b]);this.draw()},add:function(d){var a=(d instanceof Array)?d:[d];for(var b=0;b<a.length;b++){this.items.push(a[b]);this.drawItem(a[b])}if(this.centerable===true){this.centerDialog()}},centerDialog:function(){if(this.canvas){this.canvas.setStyle({left:($(document.viewport.getWidth())/2)-(this.canvas.getWidth()/2)+"px",top:($(document.viewport.getHeight())/2)-(this.canvas.getHeight()/2)+"px"})}},close:function(){this.erase()},draw:function(){aw.ui.prototype.draw.apply(this);if((this.width)&&(this.width>0)){this.canvas.setStyle({width:this.width+"px"})}if(this.content){var e=this.canvas.down(".contents");if(e){aw.Element.update(e,this.content)}e=null}if(this.moveable===true){var g=this.canvas.down("div.header");if(g){aw.EventManager.register(g,"mousedown",this._mousedown_fx,this);this._selectstart_fx=function(){return false};aw.EventManager.register(g,"selectstart",this._selectstart_fx,this);if(typeof g.style.MozUserSelect!="undefined"){g.style.MozUserSelect="none"}}g=null}this.container=document.getElementsByTagName("body")[0];var f=this.canvas.down("div.close");if((f)&&(this.closeable!==true)){f.hide()}else{if(f){this._onclose_fx=this._onclose.bind(this);aw.EventManager.register(f,"click",this._onclose_fx,this)}}f=null;aw.Element.insert(this.container,this._templates.background.evaluate({cssClass:("aw_ui_Dialog background"),id:this.id}));var d=$(document.getElementById(this.id+"_background"));if(d){d.setOpacity(0.5);d=null}aw.Element.insert(this.container,this.canvas);if((this.items)&&(this.items.length>0)){for(var b=0,a=this.items.length;b<a;b++){this.drawItem(this.items[b])}}if(this.centerable===true){this.centerDialog()}return this.canvas},drawItem:function(b){if((b)&&(b.draw)&&(this.canvas)){var a=this.canvas.down("div.contents");b.setContainer(a);a=null}},erase:function(){if(this.canvas){var d=this.canvas.down("div.header");if(d){if(this._mousedown_fx){aw.EventManager.unregister(d,"mousedown",this._mousedown_fx);this._mousedown_fx=null}if(this._selectstart_fx){aw.EventManager.unregister(d,"selectstart",this._selectstart_fx);this._selectstart_fx=null}}d=null;var b=this.canvas.down("div.close");if((b)&&(this._onclose_fx)){aw.EventManager.unregister(b,"click",this._onclose_fx);this._onclose_fx=null}b=null}if(this._mousemove_fx){aw.EventManager.unregister(document,"mousemove",this._mousemove_fx)}if(this._mouseup_fx){aw.EventManager.unregister(document,"mouseup",this._mouseup_fx)}this._clearButtons();var a=$(document.getElementById(this.id+"_background"));if(a){a.remove()}a=null;aw.ui.prototype.erase.apply(this)},hide:function(){aw.ui.prototype.hide.apply(this);if(!this.canvas){return}var a=$(document.getElementById(this.id+"_background"));if(a){a.hide()}a=null},setContent:function(b){this.content=b;var a=this.canvas.down("div.contents");if(a){aw.Element.update(a,this.content)}a=null;if(this.centerable===true){this.centerDialog()}},setTitle:function(b){this.title=b;if(this.canvas){var a=this.canvas.down("div.m.c > div.header > span");if(a){a.innerHTML=this.title}a=null}},show:function(){aw.ui.prototype.show.apply(this);var a=$(document.getElementById(this.id+"_background"));if(a){a.show()}a=null},_clearButtons:function(){if((this._buttons)&&(this._buttons.length>0)){for(var a=0;a<this._buttons.length;a++){this._buttons[a].destroy()}this._buttons=[]}},_onclose:function(){this.close()},_onmousedown:function(h){var g=aw.EventManager.getEvent(h);var f=g.target;this._onmouseup();if((!f)||(!f.tagName)||(f.tagName.toLowerCase()!="div")){return}if(this.container){var d=$(this.container).cumulativeOffset();var b=this.container.getDimensions();this._constraints={t:d.top+5,r:d.left+b.width-5,b:d.top+b.height-5,l:d.left+5}}if(f.hasClassName("header")){var j={x:g.pointerX,y:g.pointerY};var a=this.canvas.positionedOffset();this._mousemove_fx=this._onmousemove.bind(this,j,a);this._mouseup_fx=this._onmouseup.bind(this);aw.EventManager.register(document,"mousemove",this._mousemove_fx);aw.EventManager.register(document,"mouseup",this._mouseup_fx)}},_onmousemove:function(h,a,g){var d=aw.EventManager.getEvent(g);var f=d.pointerX;var b=d.pointerY;var j={};if(((b>this._constraints.t)||(this._constraints.t<0))&&((b<this._constraints.b)||(this._constraints.b<0))){Object.extend(j,{top:""+parseInt(a.top,10)-(h.y-b)+"px"})}if(((f>this._constraints.l)||(this._constraints.l<0))&&((f<this._constraints.r)||(this._constraints.r<0))){Object.extend(j,{left:""+parseInt(a.left,10)-(h.x-f)+"px"})}this.canvas.setStyle(j)},_onmouseup:function(){if(this._mousemove_fx){aw.EventManager.unregister(document,"mousemove",this._mousemove_fx);this._mousemove_fx=null}if(this._mouseup_fx){aw.EventManager.unregister(document,"mouseup",this._mouseup_fx);this._mouseup_fx=null}},_renderButton:function(b,e){if(!this.canvas){return null}var a=this.canvas.down("div.buttons");if(a){var d=new aw.ui.Control.Button({label:b,container:a},{click:e});a=null;this._buttons.push(d);return d}return null},_templates:{ui:new Template('<div class="t l"><div class="t r"><div class="t c"></div></div></div><div class="m l"><div class="m r"><div class="m c"><div class="header"><span>#{title}</span><div class="close"></div></div><div class="contents"></div><div class="buttons-wrap"><div class="buttons"></div></div></div></div></div><div class="b l"><div class="b r"><div class="b c"></div></div></div>'),background:new Template('<div class="#{cssClass}" id="#{id}_background"></div>')},VALID_PROPERTIES:["title","dialog","closeable","content","items","moveable","centerable","cssClass","componentBus","width"],CLASS_NAME:"aw.ui.Dialog"});aw.ui.Dialog.Alert=Class.create(aw.ui.Dialog,{_onKeyDown_fx:null,initialize:function(b,a){this._onKeyDown_fx=null;aw.ui.Dialog.prototype.initialize.apply(this,arguments)},draw:function(){aw.ui.Dialog.prototype.draw.apply(this);this._renderButton("OK",function(){this.close()}.bind(this));this._onKeyDown_fx=this._onKeyDown.bind(this);aw.EventManager.register(document,"keydown",this._onKeyDown_fx);return this.canvas},erase:function(){if(this._onKeyDown_fx){aw.EventManager.unregister(document,"keydown",this._onKeyDown_fx);this._onKeyDown_fx=null}aw.ui.Dialog.prototype.erase.apply(this)},_onKeyDown:function(b){var a=aw.EventManager.getEvent(b);if(a.keyCode==13){this.close()}},CLASS_NAME:"aw.ui.Dialog.Alert"});aw.ui.Dialog.Annotation=Class.create(aw.ui.Dialog,{annotation:null,create:false,data:[],fontFamilies:[],fontSizes:[],lat:null,lon:null,label:"",set:null,style:{},_annotStyle:{},_dataKeys:[],_defaultStyle:{},initialize:function(b,a){this.annotation=null;this.create=false;this.data=[];this.fontFamilies=[{value:"arial",label:"Arial"},{value:"verdana",label:"Verdana"},{value:"georgia",label:"Georgia"},{value:"tahoma",label:"Tahoma"}];this.fontSizes=[{value:"9pt",label:"9"},{value:"10pt",label:"10"},{value:"11pt",label:"11"},{value:"12pt",label:"12"},{value:"13pt",label:"13"},{value:"14pt",label:"14"},{value:"15pt",label:"15"},{value:"16pt",label:"16"}];this.lat=null;this.lon=null;this.label="";this.set=null;this.style={};this._annotStyle={};this._dataKeys=[];this._defaultStyle={};b.title="Map Annotation";b.centerable=true;aw.ui.Dialog.prototype.initialize.apply(this,[b,a])},draw:function(){aw.ui.Dialog.prototype.draw.apply(this);var f=this.set;if((f)&&(f.style)){f.style.useDefault=true;this._defaultStyle=f.style}if(this.annotation){this._annotStyle=this.annotation.style}if(this.create){this._setStyle(this._defaultStyle)}else{if(!this.annotation.style){this._setStyle(this._defaultStyle)}else{this._setStyle(this._annotStyle)}}var e=this.data;var b=this.style;var d=this.canvas.down("div.contents");var a="";if(!d){return null}this._iconPicker=new aw.ui.Control.Icon({},{change:this._renderPreview.bind(this)});this._iconPicker.selectByValue(b.icon,false);a="color:#"+b.fontColor+";font:"+b.fontStyle+" "+b.fontWeight+" "+b.fontSize+" "+b.fontFamily+";text-decoration:"+b.fontDecoration+";"+((b.mouseOver)?"display:none;":"");this._label=new aw.ui.Control.TextBox({label:"Name: ",value:this.label,name:"name"});if(!this.create){this._label.value=this.annotation.label}this._content=new aw.ui.Control.TextBox({label:"Description:",multiline:true,name:"description",value:this._getDescriptionContent(e)});this._style=new aw.ui.HTML({html:this._local_templates.style});this._preview=new aw.ui.HTML({html:'<div class="preview"><label>Preview:</label><div class="previewPane"><img src="'+this._iconPicker.getSelectedIcon().toURL()+'" alt="icon" title="Sample Label" /><span style="'+a+'">Sample Label</span></div></div>'});this._toggleMouseOver=new aw.ui.Control.Checkbox({label:"Only Show Label on Hover",checked:b.mouseOver},{change:this._renderPreview.bind(this)});this.add([this._iconPicker,this._label,this._content,this._style,this._preview,this._toggleMouseOver]);this._renderStyleElements(d);this._renderButton("OK",this._onOkClick.bind(this));this._renderButton("Cancel",this.close.bind(this));return this.canvas},erase:function(){var a=this._iconPicker,b=this._fontColor;if(a){a.destroy();a=null}if(b){b.destroy();b=null}aw.ui.Dialog.prototype.erase.apply(this)},_getDescriptionContent:function(d){if(!d){return}if(d.length===0){return}var a=[];if((d)&&(d.length>0)){for(var b=0;b<d.length;b++){if(d[b].type==="1"){a.push(d[b].value)}this._dataKeys.push(d[b].key)}}return a.join("")},_getFormStyle:function(){return{fontColor:this._fontColor.getValue(),fontDecoration:(this._fontStyleUnderline.toggled)?"underline":"none",fontFamily:this._fontFamilyDropDown.getValue(),fontSize:this._fontSizeDropDown.getValue(),fontStyle:(this._fontStyleItalics.toggled)?"italic":"normal",fontWeight:(this._fontStyleBold.toggled)?"bold":"normal",icon:this._iconPicker.getValue(),mouseOver:(this._toggleMouseOver.checked),useDefault:this.style.useDefault}},_getFormValues:function(a){var b="";if(a===false){b=this._getFormStyle()}return{label:this._label.getValue(),content:this._content.getValue(),style:b}},_onOkClick:function(){var e=this.componentBus.getComponentReferences("aw.AnnotationManager");if((!e)||(e.length<1)){return}var f=this._getFormValues(this.style.useDefault);if(this.create===true){e[0].createAnnotation(this.set,f.label,this.lat,this.lon,f.content,f.style)}else{var d=this.data;var a=0;if(d.length>0){for(var b=0;b<d.length;b++){if(d[b].type==="1"){d[b].value=f.content;d[b].key=this._dataKeys[a];a++}}if(d.length>1){d=[d[0]]}}e[0].updateAnnotation(this.set,this.annotation,f.label,this.lat,this.lon,d,f.style)}this.close()},_onUseCustomLabelSetStyle:function(b){if(!b){return}var d=this._defaultStyle;var a=this._getFormStyle();if(b.checked===true){this._fontFamilyDropDown.disable();this._fontSizeDropDown.disable();this._fontStyleBold.disable();this._fontStyleUnderline.disable();this._fontStyleItalics.disable();this._fontColor.disable();d.useDefault=true;this._setStyle(d);this._updatePreview(d)}else{this._fontFamilyDropDown.enable();this._fontSizeDropDown.enable();this._fontStyleBold.enable();this._fontStyleUnderline.enable();this._fontStyleItalics.enable();this._fontColor.enable();a.useDefault=false;this._setStyle(a);this._updatePreview(a)}},_renderPreview:function(d){this.style.useDefault=false;this._toggleSetStyle.enable();var b=this.canvas.down(".preview > .previewPane > img");var a=b.next();switch(d.CLASS_NAME){case"aw.ui.Control.DropDown":a.style[d.name]=d.getValue();break;case"aw.ui.Control.Icon":b.src=d.getSelectedIcon().toURL();break;case"aw.ui.Control.Button.Toggle":switch(d.label){case"B":a.style.fontWeight=(d.toggled)?"bold":"normal";break;case"U":a.style.textDecoration=(d.toggled)?"underline":"none";break;case"I":a.style.fontStyle=(d.toggled)?"italic":"normal";break;default:return}break;case"aw.ui.Control.Color":a.style.color="#"+d.getValue();break;case"aw.ui.Control.Checkbox":a.style.display=(d.checked)?"none":"inline";break;default:return}},_renderStyleElements:function(b){var a=this.style;this._fontFamilyDropDown=new aw.ui.Control.DropDown({name:"fontFamily",options:this.fontFamilies,container:b.down("div.fontFamilySize")},{change:this._renderPreview.bind(this)});if(a.fontFamily){this._fontFamilyDropDown.selectByValue(a.fontFamily,false)}this._fontSizeDropDown=new aw.ui.Control.DropDown({name:"fontSize",options:this.fontSizes,container:b.down("div.fontFamilySize")},{change:this._renderPreview.bind(this)});if(a.fontSize){this._fontSizeDropDown.selectByValue(a.fontSize,false)}this._fontStyleBold=new aw.ui.Control.Button.Toggle({container:b.down("div.fontStyles"),label:"B",toggled:(a.fontWeight&&a.fontWeight==="bold")},{toggle:this._renderPreview.bind(this)});this._fontStyleUnderline=new aw.ui.Control.Button.Toggle({container:b.down("div.fontStyles"),label:"U",toggled:(a.fontDecoration&&a.fontDecoration==="underline")},{toggle:this._renderPreview.bind(this)});this._fontStyleItalics=new aw.ui.Control.Button.Toggle({container:b.down("div.fontStyles"),label:"I",toggled:(a.fontStyle&&a.fontStyle==="italic")},{toggle:this._renderPreview.bind(this)});this._fontColor=new aw.ui.Control.Color({container:b.down("div.styleControls")},{change:this._renderPreview.bind(this)});if(a.fontColor){this._fontColor.setValueByHex(a.fontColor)}this._toggleSetStyle=new aw.ui.Control.Checkbox({label:"Revert to Set Style",container:b.down("div.style")},{change:this._onUseCustomLabelSetStyle.bind(this)});if(a.useDefault===true){this._toggleSetStyle.disable()}},_setStyle:function(a){if(a){this.style={fontFamily:a.fontFamily,fontWeight:a.fontWeight,fontDecoration:a.fontDecoration,fontStyle:a.fontStyle,fontSize:a.fontSize,fontColor:a.fontColor,icon:a.icon,mouseOver:(a.hasOwnProperty("mouseOver")&&a.mouseOver===true),useDefault:a.useDefault}}},_updatePreview:function(e){if(e){var d=this.canvas.down(".preview > .previewPane > img");var b=d.next();var a=this.componentBus;d.src=new aw.Icon({src:e.icon,server:a.getComponentServer(),skey:a.getSessionKey(),akey:a.getApplicationKey()}).toURL();b.style.fontSize=e.fontSize;b.style.fontFamily=e.fontFamily;b.style.fontWeight=e.fontWeight;b.style.textDecoration=e.fontDecoration;b.style.fontStyle=e.fontStyle;b.style.color="#"+e.fontColor;b.style.display=e.mouseOver}},_local_templates:{style:'<div class="style customLabelGroup"><h2>Style</h2><div class="styleControls"><div class="fontFamilySize"></div><div class="fontStyles"></div></div></div>'},VALID_PROPERTIES:["annotation","centerable","closeable","componentBus","data","create","dialog","items","label","lat","lon","moveable","set","style","title"],CLASS_NAME:"aw.ui.Dialog.Annotation"});aw.ui.Dialog.AnnotationSet=Class.create(aw.ui.Dialog,{create:false,fontFamilies:[],fontSizes:[],set:{name:"",style:{icon:"",fontFamily:"",fontWeight:"",fontDecoration:"",fontStyle:"",fontSize:"",fontColor:"",mouseOver:false}},initialize:function(b,a){this.create=false;this.fontFamilies=[{value:"arial",label:"Arial"},{value:"verdana",label:"Verdana"},{value:"georgia",label:"Georgia"},{value:"tahoma",label:"Tahoma"}];this.fontSizes=[{value:"9pt",label:"9"},{value:"10pt",label:"10"},{value:"11pt",label:"11"},{value:"12pt",label:"12"},{value:"13pt",label:"13"},{value:"14pt",label:"14"},{value:"15pt",label:"15"},{value:"16pt",label:"16"}];this.set={name:"",style:{icon:"",fontFamily:"",fontWeight:"",fontDecoration:"",fontStyle:"",fontSize:"",fontColor:"",mouseOver:false}};b.title="Map Annotations Set";b.centerable=true;aw.ui.Dialog.prototype.initialize.apply(this,[b,a])},draw:function(){aw.ui.Dialog.prototype.draw.apply(this);var g=this.set;var a=g.name;var d=g.style;var f=(d.hasOwnProperty("mouseOver")&&d.mouseOver===true);var e=this.canvas.down("div.contents");var b="";if(!e){return null}this._iconPicker=new aw.ui.Control.Icon({},{change:this._renderPreview.bind(this)});this._iconPicker.selectByValue("aws:icon:server:Place (Red).png",false);if(this.create){this._name=new aw.ui.Control.TextBox({label:"Name: ",value:a,name:"name"})}else{this._name=new aw.ui.HTML({html:'<div class="aw_ui_Control_TextBox"><label>Name: </label><b>'+a+"</b>"});this._iconPicker.selectByValue(d.icon,false);b="color:#"+d.fontColor+";font:"+d.fontStyle+" "+d.fontWeight+" "+d.fontSize+" "+d.fontFamily+";text-decoration:"+d.fontDecoration+";"+((f)?"display:none;":"")}this._style=new aw.ui.HTML({html:this._local_templates.style});this._preview=new aw.ui.HTML({html:'<div class="preview"><label>Preview:</label><div class="previewPane"><img src="'+this._iconPicker.getSelectedIcon().toURL()+'" alt="icon" title="Sample Label" /><span style="'+b+'">Sample Label</span></div></div>'});this._toggleMouseOver=new aw.ui.Control.Checkbox({label:"Only Show Label on Hover",checked:f},{change:this._renderPreview.bind(this)});this.add([this._iconPicker,this._name,this._style,this._preview,this._toggleMouseOver]);this._renderStyleElements(e);if(this.create){this._renderPreview(this._fontColor)}this._renderButton("OK",this._onOkClick.bind(this));this._renderButton("Cancel",this.close.bind(this));return this.canvas},erase:function(){if(this._iconPicker){this._iconPicker.destroy();this._iconPicker=null}if(this._fontColor){this._fontColor.destroy();this._fontColor=null}aw.ui.Dialog.prototype.erase.apply(this)},getStyle:function(){return{fontColor:this._fontColor.getValue(),fontDecoration:(this._fontStyleUnderline.toggled)?"underline":"none",fontFamily:this._fontFamilyDropDown.getValue(),fontSize:this._fontSizeDropDown.getValue(),fontStyle:(this._fontStyleItalics.toggled)?"italic":"normal",fontWeight:(this._fontStyleBold.toggled)?"bold":"normal",icon:this._iconPicker.getValue(),mouseOver:(this._toggleMouseOver.checked)}},_onOkClick:function(){var b=this.componentBus.getComponentReferences("aw.AnnotationManager");if((!b)||(b.length<1)){return}var a=this.getStyle();if(this.create===true){b[0].createAnnotationSet(this._name.getValue(),a)}else{b[0].updateAnnotationSet(this.set,a)}this.close()},_renderPreview:function(d){var b=this.canvas.down(".preview > .previewPane > img");var a=b.next();switch(d.CLASS_NAME){case"aw.ui.Control.DropDown":a.style[d.name]=d.getValue();break;case"aw.ui.Control.Icon":b.src=d.getSelectedIcon().toURL();break;case"aw.ui.Control.Button.Toggle":switch(d.label){case"B":a.style.fontWeight=(d.toggled)?"bold":"normal";break;case"U":a.style.textDecoration=(d.toggled)?"underline":"none";break;case"I":a.style.fontStyle=(d.toggled)?"italic":"normal";break;default:return}break;case"aw.ui.Control.Color":a.style.color="#"+d.getValue();break;case"aw.ui.Control.Checkbox":a.style.display=(d.checked)?"none":"inline";break;default:return}},_renderStyleElements:function(b){var d=this.set;var a=d.style;this._fontFamilyDropDown=new aw.ui.Control.DropDown({name:"fontFamily",options:this.fontFamilies,container:b.down("div.fontFamilySize")},{change:this._renderPreview.bind(this)});if(a.fontFamily){this._fontFamilyDropDown.selectByValue(a.fontFamily)}this._fontSizeDropDown=new aw.ui.Control.DropDown({name:"fontSize",options:this.fontSizes,container:b.down("div.fontFamilySize")},{change:this._renderPreview.bind(this)});if(a.fontSize){this._fontSizeDropDown.selectByValue(a.fontSize)}this._fontStyleBold=new aw.ui.Control.Button.Toggle({container:b.down("div.fontStyles"),label:"B",toggled:(a.fontWeight&&a.fontWeight==="bold")},{toggle:this._renderPreview.bind(this)});this._fontStyleUnderline=new aw.ui.Control.Button.Toggle({container:b.down("div.fontStyles"),label:"U",toggled:(a.fontDecoration&&a.fontDecoration==="underline")},{toggle:this._renderPreview.bind(this)});this._fontStyleItalics=new aw.ui.Control.Button.Toggle({container:b.down("div.fontStyles"),label:"I",toggled:(a.fontStyle&&a.fontStyle==="italic")},{toggle:this._renderPreview.bind(this)});this._fontColor=new aw.ui.Control.Color({container:b.down("div.styleControls")},{change:this._renderPreview.bind(this)});if(a.fontColor){this._fontColor.setValueByHex(a.fontColor)}},_local_templates:{style:'<div class="style customLabelGroup"><h2>Style</h2><div class="styleControls"><div class="fontFamilySize"></div><div class="fontStyles"></div></div></div>'},VALID_PROPERTIES:["centerable","closeable","componentBus","content","create","dialog","items","moveable","set","title","fontFamilies","fontSizes"],CLASS_NAME:"aw.ui.Dialog.AnnotationSet"});aw.ui.Dialog.Confirm=Class.create(aw.ui.Dialog,{initialize:function(b,a){aw.ui.Dialog.prototype.initialize.apply(this,arguments)},draw:function(){aw.ui.Dialog.prototype.draw.apply(this);this._renderButton("OK",this._onclick.bind(this,"ok"));this._renderButton("Cancel",this._onclick.bind(this,"cancel"));return this.canvas},_onclick:function(a){if(a){if(a=="ok"){this.triggerEvent("onconfirm");this.close()}else{if(a=="cancel"){this.triggerEvent("ondecline");this.close()}}}},EVENTS:["onconfirm","ondecline"],CLASS_NAME:"aw.ui.Dialog.Confirm"});aw.ui.Dialog.Error=Class.create(aw.ui.Dialog,{_onKeyDown_fx:null,initialize:function(b,a){this._onKeyDown_fx=null;aw.ui.Dialog.prototype.initialize.apply(this,arguments)},draw:function(){aw.ui.Dialog.prototype.draw.apply(this);this._renderButton("OK",function(){this.close()}.bind(this));this._onKeyDown_fx=this._onKeyDown.bind(this);aw.EventManager.register(document,"keydown",this._onKeyDown_fx);return this.canvas},erase:function(){if(this._onKeyDown_fx){aw.EventManager.unregister(document,"keydown",this._onKeyDown_fx);this._onKeyDown_fx=null}aw.ui.Dialog.prototype.erase.apply(this)},_onKeyDown:function(b){var a=aw.EventManager.getEvent(b);if(a.keyCode==13){this.close()}},CLASS_NAME:"aw.ui.Dialog.Error"});aw.ui.Dialog.ExportMap=Class.create(aw.ui.Dialog,{formats:[],map:null,margins:null,pageSizes:[],_loadingDialog:null,_titleTextBox:null,_formatDropDown:null,_printSizeDropDown:null,_screenExportCheck:null,_includeLegendCheck:null,_pageOrientationRadioboxes:null,initialize:function(b,a){this.formats=[{value:"pdf",label:"PDF"},{value:"docx",label:"Word (DocX)"}];this.map=null;this.margins="0.5,0.5,0.5,0.5";this.pageSizes=[{value:"8.5x11",label:"Letter (8.5 x 11 in)"},{value:"8.27x11.69",label:"A4 (210 x 297 mm)"},{value:"11x17",label:"Ledger (11 x 17 in)"}];this.inheritCSS=true;Object.extend(b,{title:"Export Map"});aw.ui.Dialog.prototype.initialize.apply(this,arguments);this._loadingDialog=null},draw:function(){aw.ui.Dialog.prototype.draw.apply(this);var a=this.canvas.down("div.contents");if(!a){return null}a.update(this._local_templates.ui);this._exportForm=new aw.ui.Form();this._titleTextBox=this._exportForm.add(new aw.ui.Control.TextBox({name:"title",value:"Demographic Map",container:a.down("div.title")}));this._formatDropDown=this._exportForm.add(new aw.ui.Control.DropDown({name:"format",options:this.formats,container:a.down("div.format")}));this._printSizeDropDown=this._exportForm.add(new aw.ui.Control.DropDown({label:"Paper Size:",name:"printSize",options:this.pageSizes,container:a.down("div.printSize")}));this._screenExportCheck=this._exportForm.add(new aw.ui.Control.Checkbox({label:"Screen Export",name:"screenExport",value:true,container:a.down("div.printSize")},{change:this._onScreenExportCheckChange.bind(this)}));this._includeLegendCheck=this._exportForm.add(new aw.ui.Control.Checkbox({label:"Include Legend",name:"includeLegend",value:true,container:a.down("div.printSize")}));this._pageOrientationRadioboxes=[this._exportForm.add(new aw.ui.Control.Radiobox({label:"Portrait",name:"orientation",value:"portrait",container:a.down("div.pageOrientation")})),this._exportForm.add(new aw.ui.Control.Radiobox({label:"Landscape",name:"orientation",value:"landscape",checked:true,container:a.down("div.pageOrientation")}))];this._renderButton("OK",this._onOkClick.bind(this));this._renderButton("Cancel",this.close.bind(this));return this.canvas},erase:function(){this._destroyControls();this._exportForm=null;if(this._errorDialog){this._errorDialog.destroy();this._errorDialog=null}this._destroyLoadingDialog();aw.ui.Dialog.prototype.erase.apply(this)},_compileLayerInfo:function(g,f){f=f||{info:{legendH:0,legendW:220},index:0};if((!g)||(g.length<1)){return f}var b=null;var j=null,h=false;for(var e=0,a=g.length;e<a;e++){j=g[e];h=false;if(j.visible===true){h=true;if((j.CLASS_NAME=="aw.ui.Map.Layer.Label")&&((!j._layerObj)||(j._layerObj.getVisibility()!==true))){h=false}}if(h){b=j.getParameters();if((j.showInLegend!==false)||(j.layers)){if(j.derivesFrom("aw.ui.Map.Layer.Thematic")===true){f.info.legendH+=270}else{f.info.legendH+=30}}if((b)&&(j.derivesFrom("aw.ui.Map.Layer.Group")!==true)){for(var d in b){if(!d.toLowerCase().match("akey")){if(d=="rt"){f.info.rt=b[d]}else{if(d=="service"){f.info["layer"+f.index]=b[d]}else{if(j.derivesFrom("aw.ui.Map.Layer.Thematic")===true){if(d=="layer"){f.info["themeLayer"+f.index]=b[d];f.info["themeLongLayer"+f.index]=j.geography.name}else{if(d.toLowerCase()=="themevar"){f.info["themeVar"+f.index]=b[d];f.info["themeLongVar"+f.index]=j.variable.namePath}else{f.info[d+f.index]=b[d]}}}else{f.info[d+f.index]=b[d]}}}}}if(j.derivesFrom("aw.ui.Map.Layer.Annotation")===true){f.info["layer"+f.index]="annotation"}if(j.opacity){f.info["opacity"+f.index]=j.opacity}if(j.label){f.info["name"+f.index]=j.label}f.info["showInLegend"+f.index]=j.showInLegend||false;f.index++}if(j.layers){f.info["layer"+f.index]="group";f.info["name"+f.index]=j.label;f.info["showInLegend"+f.index]=true;f.index++;f=this._compileLayerInfo(j.layers,f)}}}return f},_destroyControls:function(){var a=[];if(this._titleTextBox){a.push(this._titleTextBox)}if(this._formatDropDown){a.push(this._formatDropDown)}if(this._printSizeDropDown){a.push(this._printSizeDropDown)}if(this._screenExportCheck){a.push(this._screenExportCheck)}if(this._includeLegendCheck){a.push(this._includeLegendCheck)}if(this._pageOrientationRadioboxes&&this._pageOrientationRadioboxes[0]){a.push(this._pageOrientationRadioboxes[0])}if(this._pageOrientationRadioboxes&&this._pageOrientationRadioboxes[1]){a.push(this._pageOrientationRadioboxes[1])}for(var b=a.length;b>0;b--){if((a[b-1])&&(a[b-1].destroy)){a[b-1].destroy();a[b-1]=null}}this._titleTextBox=null;this._formatDropDown=null;this._printSizeDropDown=null;this._screenExportCheck=null;this._includeLegendCheck=null;this._pageOrientationRadioboxes=null},_destroyLoadingDialog:function(){if(this._loadingDialog){this._loadingDialog.destroy();this._loadingDialog.close();this._loadingDialog=null}},_onOkClick:function(){if(!this.map){return}var e=this.componentBus.getComponentReferences("aw.GeographyManager");if((!e)||(e.length<1)||(!e[0].allocateDataset)){return}e=e[0];var k=this._exportForm.serialize();var a=this.map.getExtent().toArray();var f=this.map.getMapSize();var b=k.orientation;var g=k.printSize.split("x");var d=0,j=0;if(b=="portrait"){d=g[1];j=g[0]}else{d=g[0];j=g[1]}if(k.screenExport===true){d=f.h/96;j=f.w/96}var h={cn:"SRC.Web.Client.Handler.MapUIHandler|"+e.allocateDataset.variant,service:"exportmap",minx:a[0],maxx:a[2],miny:a[1],maxy:a[3],h:f.h,w:f.w,margin:this.margins,pageH:d,pageW:j,screenExport:k.screenExport||false};this._destroyLoadingDialog();this._loadingDialog=new aw.ui.Dialog.Loading({message:"Rendering map..."});Object.extend(h,this._compileLayerInfo(this.map.layers).info);Object.extend(h,{legendLeft:Math.max((f.w-(h.legendW+10)),0),legendTop:Math.max((f.h-(h.legendH+10)),0)});this.request(h,function(n,p,m){if((!p)||(!p.payload)){this._destroyLoadingDialog();this._errorDialog=new aw.ui.Dialog.Error({title:"Error!",content:p.error||"An unknown error has occurred."});return}var l={cn:"SRC.Web.Client.Handler.AlteryxHandler",service:"executeMapExport",title:this._titleTextBox.getValue(),pageH:m.pageH,pageW:m.pageW,layout:"H",showLegend:(m.legendH>0)?(this._includeLegendCheck.getValue()||false):false,screenExport:this._screenExportCheck.getValue()||false,margin:this.margins,guid:(p.payload.guid)?p.payload.guid:null,mapW:(p.payload.width)?p.payload.width:null};this.request(l,function(u,v){if((!v)||(!v.payload)){this._destroyLoadingDialog();this._errorDialog=new aw.ui.Dialog.Error({title:"Error!",content:v.error||"An unknown error has occurred."});return}var q=[];q.push("cn=SRC.Web.Client.Handler.ReportHandler");q.push("service=render");q.push("report=Active Map");q.push("type=ActiveMap");q.push("format="+this._formatDropDown.getValue()||"pdf");q.push("seqId="+this.getId(""));if(this.componentBus.getApplicationKey()){q.push("akey="+this.componentBus.getApplicationKey())}if(this.componentBus.getSessionKey()){q.push("skey="+this.componentBus.getSessionKey())}this._destroyLoadingDialog();this._destroyControls();var t=this.canvas.down("div.contents");if(t){t.update(this._local_templates.download.evaluate({url:(this.componentBus.getComponentServer()+"?"+q.join("&"))}));var s=t.down("a");if(s){aw.EventManager.register(s,"click",this.close.bind(this),this)}this._clearButtons()}}.bind(this))}.bind(this))},_onScreenExportCheckChange:function(a){if(!a){return}if(a.checked===true){this._printSizeDropDown.disable();this._pageOrientationRadioboxes[0].disable();this._pageOrientationRadioboxes[1].disable()}else{this._printSizeDropDown.enable();this._pageOrientationRadioboxes[0].enable();this._pageOrientationRadioboxes[1].enable()}},_local_templates:{ui:'<div class="exportForm"><div class="title exportGroup"><h2>Title</h2></div><div class="format exportGroup"><h2>Format</h2></div><div class="printSettings exportGroup"><h2>Print Settings</h2><div class="printSize"></div><div class="pageOrientation"><h3>Orientation:</h3></div><div style="clear: both;"></div></div></div>',download:new Template('<div class="download"><a href="#{url}" target="_blank">Click here to download your map.</a></div>')},VALID_PROPERTIES:["title","closeable","content","moveable","cssClass","componentBus","map","formats","pageSizes","margins"],CLASS_NAME:"aw.ui.Dialog.ExportMap"});aw.ui.Dialog.FileManager=Class.create(aw.ui.Dialog,{_fileUploadInput:null,_progressDialog:null,_selectedFileLabel:null,initialize:function(b,a){this._fileUploadInput=null;this._progressDialog=null;this._selectedFileLabel=null;this.inheritCSS=true;Object.extend(b,{title:"Select File"});aw.ui.Dialog.prototype.initialize.apply(this,[b,a])},afterDraw:function(){aw.ui.Dialog.prototype.afterDraw.apply(this);this._retrieveFiles()},draw:function(){aw.ui.Dialog.prototype.draw.apply(this);var a=this.canvas.down("div.contents");if(!a){return null}this._uploadTree=new aw.ui.Tree({mode:"single"});this._userDataTree=new aw.ui.Tree({mode:"single"});this._uploadTree.registerEvent("onselectionchanged",this._onFileSelected.bind(this,this._userDataTree));this._userDataTree.registerEvent("onselectionchanged",this._onFileSelected.bind(this,this._uploadTree));this._tabPanel=new aw.ui.Panel.Tab({container:a,height:300,titleVisibility:false,items:[new aw.ui.Toolbar({height:25,region:"bottom",items:[new aw.ui.Toolbar.Row({items:[this._selectedFileLabel=new aw.ui.Control.Label({label:"Selected File:"})]})]}),this._uploadedPanel=new aw.ui.Panel({title:"Uploaded Files",cssClass:"uploaded_files",items:[new aw.ui.Toolbar({height:30,items:[new aw.ui.Toolbar.Row({items:[this._fileUploadInput=new aw.ui.Control.FileUpload({label:"Upload File:"},{change:this._onFileUploadChanged.bind(this),fileuploadcomplete:this._onFileUploadComplete.bind(this),uploadstatus:this._onFileUploadStatusChanged.bind(this)})]})]}),this._uploadTree]}),new aw.ui.Panel({title:"Saved Files",items:[this._userDataTree]})]});this._renderButton("OK",this._onOkClick.bind(this));this._renderButton("Cancel",this.close.bind(this));return this.canvas},erase:function(){if(this._tabPanel){this._tabPanel.showDebug=true;this._tabPanel.destroy();this._tabPanel=null}if(this._progressDialog){this._progressDialog.destroy();this._progressDialog=null}aw.ui.Dialog.prototype.erase.apply(this)},_buildTreeNodes:function(k,e){if((!k)||(!k.length>0)){return[]}e=e||"";var b=[];var h=null,a=null,g=null;for(var f=0;f<k.length;f++){a=k[f].fileDirectory;h={key:e+"|"+a.name,parentKey:e,label:a.name,type:"branch",selectable:false,expanded:true,children:[]};if((a.directories)&&(a.directories.length>0)){h.children=this._buildTreeNodes(a.directories,e+"|"+a.name)}if((a.files)&&(a.files.length>0)){for(var d=0;d<a.files.length;d++){g=a.files[d];h.children.push({key:e+"|"+a.name+"|"+g,parentKey:e+"|"+a.name,label:g,type:"leaf",selectable:true})}}b.push(h)}return b},_onFileSelected:function(b,k){if(!this.componentBus){return}var a,e,g;if((k)&&(k.getSelectedNodes)){a=k.getSelectedNodes();if((a)&&(a.length===1)){this._selectedFilePath="."+a[0].key.replace(/\|/gi,"\\");this._setSelectedFileLabel(this._selectedFilePath);if(k===this._uploadTree){var h=a[0].key;var f=a[0].label;var d=((h.length)-(f.length));var j=h.slice(0,d);if((j.indexOf("|"))||(j.lastIndexOf("|"))){j=j.substring(((j.indexOf("|"))+1),(j.lastIndexOf("|")))}e={cn:"SRC.Web.Client.Handler.FileInfoHandler",service:"gettablenames",fn:f,path:j};this.request(e,function(l,m){if((!m)||(!m.payload)){return}this._onSubsetsReceived(m.payload)}.bind(this))}if(b){b.clearSelection()}}}},_onFilesReceived:function(b,a){if(!a){return}if((a.userDataDirectories)&&(this._userDataTree)){this._userDataTree.clear();this._userDataTree.addNodes(this._buildTreeNodes(a.userDataDirectories))}if((a.sessionTempDirectory)&&(this._uploadTree)){this._uploadTree.clear();this._uploadTree.addNodes(this._buildTreeNodes(a.sessionTempDirectory))}},_onFileUploadChanged:function(a){this._fileUploadInput.upload(this.componentBus.getComponentServer().replace(/ComponentHandler.ashx/gi,"UploadHandler.ashx"),this.componentBus.getApplicationKey(),this.componentBus.getSessionKey())},_onFileUploadComplete:function(){this._retrieveFiles();if(this._progressDialog){this._progressDialog.destroy();this._progressDialog=null}},_onFileUploadStatusChanged:function(a){if(!this._progressDialog){this._progressDialog=new aw.ui.Dialog.Progress({title:"Upload Progress",closeable:false})}if(this._progressDialog){if((a>=0)&&(a<=100)){this._progressDialog.setPercentComplete(a)}}},_onOkClick:function(){if(this._subsets){this._uploadedPanel.clear();this.selectTable=new aw.ui.Control.DropDown({name:"fileSheetSelection",label:"Please select a table:"},{change:this._onSelectTableChanged.bind(this)});this._uploadedPanel.add(this.selectTable);this.selectTable.addOptions(this._subsets);this._onSelectTableChanged()}else{var a=this._selectedFileLabel.value;if((a)&&(a!=="")){a=a.replace(/^\s*|\s*$/gi,"");if(a!==""){this.triggerEvent("onfileselected",a);this.close()}}}},_onSelectTableChanged:function(){var a=this.selectTable.getValue();this._setSelectedFileLabel(this._selectedFilePath,a);this._subsets=null},_onSubsetsReceived:function(a){if(!a){return}if(a.tables.length===0){this._subsets=null;return}if(a.tables.length===1){this._setSelectedFileLabel(this._selectedFilePath,a.tables[0]);this._subsets=null;return}var b=[],f,e;for(var d=0;d<a.tables.length;d++){f=a.tables[d];e={label:f,value:f};b.push(e)}this._subsets=b},_retrieveFiles:function(){if(!this.componentBus){return}var b=this.componentBus.getComponentReferences("aw.UserDataManager");if((b)&&(b.length>0)){var a={callback:this._onFilesReceived.bind(this)};if(this.wizardGuid){Object.extend(a,{wizardGuid:this.wizardGuid})}b[0].getFiles(a)}},_setSelectedFileLabel:function(a,b){if(!a&&!b){return}if(a&&!b){this._selectedFileLabel.setValue(a);return}if(a&&b){this._selectedFileLabel.setValue(a+"|"+b)}},EVENTS:["onfileselected"],CLASS_NAME:"aw.ui.Dialog.FileManager"});aw.ui.Dialog.ForgotPassword=Class.create(aw.ui.Dialog,{initialize:function(b,a){Object.extend(b,{title:"Reset Password"});aw.ui.Dialog.prototype.initialize.apply(this,arguments)},draw:function(){aw.ui.Dialog.prototype.draw.apply(this);var a=this.canvas.down("div.contents");if(a){a.update("Please provide the email address associated with your current account.");this._emailTextbox=new aw.ui.Control.TextBox({label:"Email:",value:(this.defaultEmail||this.readCookie("username"))||"",container:a},{enter:this._onResetClick.bind(this)})}this._renderButton("OK",this._onResetClick.bind(this));this._renderButton("Cancel",this.close.bind(this));return this.canvas},_onResetClick:function(){if((!this._emailTextbox)||(!this._emailTextbox.getValue())){return}var a=this._emailTextbox.getValue();var b=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;if(!b.test(a)){new aw.ui.Dialog.Error({title:"Error!",content:"You must enter a valid email address."});return}var d={cn:"SRC.Web.Client.Handler.AccountManagementHandler",service:"reset",em:a};this.request(d,function(e,f){if((!f)||(!f.payload)){return}if((f.payload.errorMessage)||((f.payload.status)&&(f.payload.status=="failure"))){new aw.ui.Dialog.Error({title:"Error",content:(f.payload.errorMessage||"An unknown error has occurred.")})}else{new aw.ui.Dialog.Alert({title:"Success",content:"Thank you, your password has been reset.  You should receive an email shortly with your new password."});this.close()}}.bind(this))},VALID_PROPERTIES:["title","closeable","content","moveable","cssClass","componentBus","defaultEmail"],CLASS_NAME:"aw.ui.Dialog.ForgotPassword"});aw.ui.Dialog.Geocode=Class.create(aw.ui.Dialog,{_fileName:null,_form:null,_loadingDialog:null,_nextButton:null,_step:null,_onFileGeocoded_fx:null,initialize:function(b,a){this._fileName=null;this._form=new aw.ui.Form();this._loadingDialog=null;this._onFileGeocoded_fx=null;this._nextButton=null;this._step="upload";Object.extend(b,{title:"Upload File to Geocode"});aw.ui.Dialog.prototype.initialize.apply(this,arguments);if(this.componentBus){var d=this.componentBus.getComponentReferences("aw.Geocoder",function(e){if((e)&&(e.length>0)){this._onFileGeocoded_fx=this._onFileGeocoded.bind(this);e[0].registerEvent("filegeocoded",this._onFileGeocoded_fx)}}.bind(this),false)}},destroy:function(){if(this.componentBus){var a=this.componentBus.getComponentReferences("aw.Geocoder");if((a)&&(a.length>0)){a=a[0];if(this._onFileGeocoded_fx){a.unregisterEvent("filegeocoded",this._onFileGeocoded_fx);this._onFileGeocoded_fx=null}}}aw.ui.Dialog.prototype.destroy.apply(this)},draw:function(){aw.ui.Dialog.prototype.draw.apply(this);this._nextButton=this._renderButton("Next",this._onNextClick.bind(this));this._draw();return this.canvas},_destroyLoadingDialog:function(){if(this._loadingDialog){this._loadingDialog.destroy();this._loadingDialog.close();this._loadingDialog=null}},_draw:function(){if(this._step=="upload"){this.setTitle("Upload File to Geocode")}else{if(this._step=="reconcile"){this.setTitle("Reconcile Fields")}}var a=this.canvas.down("div.contents");if(a){a.update(this._local_templates[this._step])}if((this._step=="complete")&&(this._nextButton)){this._nextButton.setLabel("Close")}},_geocodeFile:function(){var b=this.componentBus.getComponentReferences("aw.Geocoder");if((!b)||(!b.length>0)){return}var a=this._form.serialize();b[0].geocodeFile(this._fileName,a,a.acceptZip);this._destroyLoadingDialog();this._loadingDialog=new aw.ui.Dialog.Loading({message:"Geocoding file..."})},_onFileGeocoded:function(d,a){var b="Your file has been successfully geocoded. The match statistics are detailed below.<br /><br /><strong>Total Records:</strong> "+parseFloat(a.total).addCommas()+"<br />Exact Matches: "+parseFloat(a.matched).addCommas()+"<br />Unmatched: "+parseFloat(a.unmatched).addCommas();this._destroyLoadingDialog();new aw.ui.Dialog.Alert({title:"Success!",content:b});this.close();this.destroy()},_onNextClick:function(){if(this._step=="complete"){this.close();return}if(this._step=="upload"){this._fileName=this.canvas.down('input[name="upload_filename"]').value;if((!this._fileName)||(this._fileName==="")){new aw.ui.Dialog.Error({title:"Error!",content:"You must include a file name!"});return}this._destroyLoadingDialog();this._loadingDialog=new aw.ui.Dialog.Loading({message:"Uploading file..."});new aw.FileUploader({componentBus:this.componentBus,formObj:this.canvas.down('form[id="uploadForm"]'),validExtensions:["csv","yxdb","dbf"],fileName:this._fileName},{failure:function(a){this._destroyLoadingDialog();new aw.ui.Dialog.Error({title:"Error",content:a})}.bind(this),success:function(a){this._destroyLoadingDialog();this._reconcileFields(a.schema)}.bind(this)})}else{if(this._step=="reconcile"){this._geocodeFile()}}},_reconcileFields:function(g){this._step="reconcile";this._draw();var a=[{label:"Address",name:"address",matchString:"addr"},{label:"City",name:"city",matchString:"city"},{label:"State",name:"state",matchString:"st"},{label:"ZIP",name:"postal",matchString:"zip|post"}];var b=this.canvas.down("div.reconcileFields");if(b){this._form.clear();var d=[],j=null;for(var h=0;h<a.length;h++){j=new aw.ui.Control.DropDown({label:a[h].label,name:a[h].name,container:b});d=[];for(var e=0;e<g.length;e++){d.push({value:g[e],label:g[e],selected:(g[e].toLowerCase().match(a[h].matchString))?true:false})}j.addOptions(d);this._form.add(j)}this._form.add(new aw.ui.Control.Checkbox({label:"Mark ZIP-5 geocodes as successful matches.",name:"acceptZip",value:true}))}},_local_templates:{upload:'Please select the CSV, DBF or YXDB file you would like to geocode. Enter a file name so that you can reference this file later.<form id="uploadForm" name="uploadForm"><div class="formRow"><label>File:</label><input type="file" name="upload_file" id="upload_file" /></div><div class="formRow"><label>Name:</label><input type="text" name="upload_filename" id="upload_filename" /></div></form>',reconcile:'Please identify the fields in your file to be used for geocoding purposes.<div class="reconcileFields"></div>',complete:'Your file has been successfully geocoded. The match statistics are detailed below.<div class="results"></div>'},CLASS_NAME:"aw.ui.Dialog.Geocode"});aw.ui.Dialog.Loading=Class.create(aw.ui.Dialog,{message:null,initialize:function(b,a){this.message="Loading...";Object.extend(b,{closeable:false});aw.ui.Dialog.prototype.initialize.apply(this,arguments)},draw:function(){aw.ui.Dialog.prototype.draw.apply(this);var a=this.canvas.down("div.contents");if(!a){return null}a.update(this._local_templates.ui.evaluate({message:this.message}));return this.canvas},setMessage:function(a){this.message=a||"Loading...";if(this.canvas){var b=this.canvas.down("div.contents div.message");if(!b){return}b.update(a)}},_local_templates:{ui:new Template('<div class="loading"></div><div class="message">#{message}</div>')},VALID_PROPERTIES:["message","cssClass","closeable","title","moveable","centerable"],CLASS_NAME:"aw.ui.Dialog.Loading"});aw.ui.Dialog.Login=Class.create(aw.ui.Dialog,{initialize:function(b,a){Object.extend(b,{title:"Login"});aw.ui.Dialog.prototype.initialize.apply(this,arguments);if(this.componentBus){this._onLoginFailure_fx=this._onLoginFailure.bind(this);this.componentBus.registerEvent("onloginfailure",this._onLoginFailure_fx);this._onLoginSuccess_fx=this._onLoginSuccess.bind(this);this.componentBus.registerEvent("onloginsuccess",this._onLoginSuccess_fx)}},destroy:function(){if(this.componentBus){if(this._onLoginFailure_fx){this.componentBus.unregisterEvent("onloginfailure",this._onLoginFailure_fx);this._onLoginFailure_fx=null}if(this._onLoginSuccess_fx){this.componentBus.unregisterEvent("onloginsuccess",this._onLoginSuccess_fx);this._onLoginSuccess_fx=null}}aw.ui.Dialog.prototype.destroy.apply(this)},draw:function(){aw.ui.Dialog.prototype.draw.apply(this);var a=this.canvas.down("div.contents");if(!a){return null}a.innerHTML+='<div class="failure"></div>';var b=this.readCookie("username");this._userTextbox=new aw.ui.Control.TextBox({label:"Email:",value:b,container:a,hasFocus:((b)&&(b!==""))?false:true},{enter:this._onLoginClick.bind(this)});this._passTextbox=new aw.ui.Control.TextBox({label:"Password:",type:"password",container:a,hasFocus:((b)&&(b!==""))?true:false},{enter:this._onLoginClick.bind(this)});this._renderButton("Login",this._onLoginClick.bind(this));if(this.closeable!==false){this._renderButton("Cancel",this.close.bind(this))}return this.canvas},_onLoginClick:function(){if(!this.componentBus){return}this.componentBus.loadUser(this._userTextbox.value,this._passTextbox.value)},_onLoginFailure:function(b){if(!this.canvas){return}var a=this.canvas.down("div.contents div.failure");if(a){a.update(b)}},_onLoginSuccess:function(){this.destroy();this.close()},CLASS_NAME:"aw.ui.Dialog.Login"});aw.ui.Dialog.Progress=Class.create(aw.ui.Dialog,{_pb:null,_file:null,initialize:function(b,a){aw.ui.Dialog.prototype.initialize.apply(this,arguments)},draw:function(){aw.ui.Dialog.prototype.draw.apply(this);var a=this.canvas.down("div.contents");if(a){a.insert('<div class="title">Progress</div><div class="container"><div class="bar">&nbsp;</div>')}this._file=a.down("div.title");this._pb=a.down("div.container").down("div.bar");return this.canvas},afterDraw:function(){aw.ui.Dialog.prototype.afterDraw.apply(this);this.setPercentComplete(0)},setFile:function(a){if(!a){return}if(this._file){this._file.update(a)}},setPercentComplete:function(a){if(a==100){this.close()}if((a>=0)&&(a<100)&&(this._pb)){this._pb.setStyle({width:""+a+"%"})}},_cancel_onclick:function(a){this.triggerEvent("oncancel");this.close()},EVENTS:["oncancel"],VALID_PROPERTIES:["title","closeable","content","moveable","defaultValue"],CLASS_NAME:"aw.ui.Dialog.Progress"});aw.ui.Dialog.Prompt=Class.create(aw.ui.Dialog,{defaultValue:null,options:[],type:"text",_promptControl:null,initialize:function(b,a){this.defaultValue=null;this.options=[];this.type="text";this._promptControl=null;aw.ui.Dialog.prototype.initialize.apply(this,arguments)},draw:function(){aw.ui.Dialog.prototype.draw.apply(this);var b=this.canvas.down("div.contents");var a=-1;if(b){if(this.type=="select"){a=this.selectedIndex||a;this._promptControl=new aw.ui.Control.DropDown({name:"promptControl",container:b,options:this.options,selectedIndex:a})}else{this._promptControl=new aw.ui.Control.TextBox({name:"promptControl",value:this.defaultValue,container:b,hasFocus:true},{enter:function(){this._onclick("ok")}.bind(this)})}}this._renderButton("OK",this._onclick.bind(this,"ok"));this._renderButton("Cancel",this._onclick.bind(this,"cancel"));return this.canvas},erase:function(){if(this._promptControl){this._promptControl.destroy();this._promptControl=null}aw.ui.Dialog.prototype.erase.apply(this)},_onclick:function(a){if(a){if(a=="ok"){this.triggerEvent("onsubmit",this._promptControl.getValue());this.close()}else{if(a=="cancel"){this.triggerEvent("oncancel");this.close()}}}},EVENTS:["onsubmit","oncancel"],VALID_PROPERTIES:["title","closeable","content","moveable","defaultValue","type","options","selectedIndex"],CLASS_NAME:"aw.ui.Dialog.Prompt"});aw.ui.Dialog.Signup=Class.create(aw.ui.Dialog,{_form:null,initialize:function(b,a){this._form=null;this.inheritCSS=true;Object.extend(b,{title:"Sign-Up"});aw.ui.Dialog.prototype.initialize.apply(this,arguments)},afterDraw:function(){var a=this.componentBus.getComponentReferences("aw.AccountManager");if((a)&&(a.length>0)){a=a[0]}else{return}a.retrieveAccountInfo(this._manifestReceived.bind(this))},draw:function(){aw.ui.Dialog.prototype.draw.apply(this);var a=this.canvas.down("div.contents");if(a){a.update("Loading...")}this._renderButton("Sign-up",this._onSignupClick.bind(this));this._renderButton("Cancel",this.close.bind(this));return this.canvas},_manifestReceived:function(a){if((!a)||(!a.length>0)){return}var d=this.canvas.down("div.contents");if(!d){return}d.update("");this._form=new aw.ui.Form();var b=null,e=null,f,l=null;for(var h=0;b=a[h];h++){e=this.getId();d.insert(this._local_templates.category.evaluate({key:e,category:b.category}));f=d.down('div[key="'+e+'"]');for(var g=0;l=b.fields[g];g++){if((l.type=="text")||(l.type=="password")){this._form.add(new aw.ui.Control.TextBox({type:l.type,label:l.label+((l.required===true)?"*":""),name:l.name,value:l.defaultValue,container:f}));if(l.type=="password"){pwConfirm=l;pwConfirm.name="passwordConfirm";pwConfirm.label="Password Confirmation";this._form.add(new aw.ui.Control.TextBox({type:pwConfirm.type,label:pwConfirm.label+((l.required===true)?"*":""),name:pwConfirm.name,value:pwConfirm.defaultValue,container:f}))}}else{if(l.type=="select"){l.values.unshift({value:"",label:"-- Select One --"});var k=new aw.ui.Control.DropDown({label:l.label+((l.required===true)?"*":""),name:l.name,options:l.values,container:f});if((l.defaultValue)&&(l.defaultValue!=="")){k.selectByValue(l.defaultValue)}this._form.add(k)}}}}},_onSignupClick:function(){if(!this._form){return}var a=this.componentBus.getComponentReferences("aw.AccountManager");if((a)&&(a.length>0)){a=a[0]}else{return}var b=this._form.serialize();a.createAccount(b,function(d,e){if(d=="failure"){new aw.ui.Dialog.Error({title:"Error!",content:e})}else{new aw.ui.Dialog.Alert({title:"Success!",content:e});this.close()}}.bind(this))},_local_templates:{category:new Template('<div class="category" key="#{key}"><h1>#{category}</h1><div class="fields"></div></div>')},CLASS_NAME:"aw.ui.Dialog.Signup"});aw.ui.Dialog.Tip=Class.create(aw.ui.Dialog,{_onKeyDown_fx:null,initialize:function(b,a){this._onKeyDown_fx=null;aw.ui.Dialog.prototype.initialize.apply(this,arguments)},close:function(){if((this._checkControl)&&(this.tipKey)){if(this._checkControl.checked===true){this.createCookie("aw.Tip"+this.tipKey,"true",30)}}this.triggerEvent("oncontinue");aw.ui.Dialog.prototype.close.apply(this)},draw:function(){if(this.tipKey){var b=this.readCookie("aw.Tip"+this.tipKey);if((b)&&((b===true)||(b=="true"))){this.triggerEvent("oncontinue");this.destroy();return null}}aw.ui.Dialog.prototype.draw.apply(this);var a=this.canvas.down("div.contents");if(a){this._checkControl=new aw.ui.Control.Checkbox({name:"checkControl",label:"Don't show this message again.",value:"true",container:a})}this._renderButton("OK",function(){this.close()}.bind(this));this._onKeyDown_fx=this._onKeyDown.bind(this);aw.EventManager.register(document,"keydown",this._onKeyDown_fx);return this.canvas},erase:function(){if(this._onKeyDown_fx){aw.EventManager.unregister(document,"keydown",this._onKeyDown_fx);this._onKeyDown_fx=null}aw.ui.Dialog.prototype.erase.apply(this)},_onKeyDown:function(b){var a=aw.EventManager.getEvent(b);if(a.keyCode==13){this.close()}},VALID_PROPERTIES:["title","closeable","content","moveable","centerable","cssClass","componentBus","width","tipKey"],EVENTS:["oncontinue"],CLASS_NAME:"aw.ui.Dialog.Tip"});aw.ui.Form=Class.create(aw.ui,{items:[],initialize:function(b,a){this.items=[];aw.ui.prototype.initialize.apply(this,arguments)},add:function(a){if((!a)||(!a.CLASS_NAME)||(a.CLASS_NAME.indexOf("aw.ui.Control")<0)){return null}this.items.push(a);return a},clear:function(){this.items=[]},getFieldByLabel:function(a){if((!a)||(!this.items)||(!this.items.length>0)){return null}for(var b=0;b<this.items.length;b++){if((this.items[b].label)&&(this.items[b].label.toLowerCase()==a.toLowerCase())){return this.items[b]}}return null},getFieldByName:function(a){if((!a)||(!this.items)||(!this.items.length>0)){return null}for(var b=0;b<this.items.length;b++){if((this.items[b].name)&&(this.items[b].name.toLowerCase()==a.toLowerCase())){return this.items[b]}}return null},reset:function(){if(!this.items){return}var b=this.items;var e;var a;for(var d=b.length;d--;){e=b[d];e.setInvalid(false);a=e.CLASS_NAME.substring(e.CLASS_NAME.lastIndexOf(".")+1);switch(a){case"Checkbox":e.setChecked(false);break;case"Color":e.setValueByHex("000000");break;case"ComboBox":e.selectByIndex(0);break;case"Date":e.setDate(new Date());break;case"DropDown":e.selectByIndex(0);break;case"FileBrowse":e.value="";break;case"FileUpload":e.clear();break;case"Icon":e.selectByIndex(0);break;case"MultiSelectListBox":e.deselectAll();break;case"Radiobox":e.setChecked(false);break;case"TextBox":e.setValue("");break;default:e.initialize();break}}},serialize:function(h,a,l,g){h=((h)&&(h.toLowerCase().match("json|query|string|xml")))?h.toLowerCase():"json";l=(l)?new Template(l):null;g=(g===false)?false:true;if((!this.items)||(!this.items.length>0)){return null}if((g===true)&&(this.validate()!==true)){return null}var m=null;var b={},n=null;for(var e=0;m=this.items[e];e++){if(m.getValue){n=((h)&&(m.customSerialize)&&(m.customSerialize[h]))?m.customSerialize[h](m):m.getValue();if(n!==null){if(b[m.name]){if((a)&&(a!=="")){b[m.name]+=(a+""+n)}else{if(typeof b[m.name]=="object"){b[m.name].push(n)}else{b[m.name]=[b[m.name],n]}}}else{b[m.name]=n}}}}if(h=="json"){return b}var f=[];for(m in b){if(typeof b[m]=="object"){var k=null;for(var d=0;k=b[m][d];d++){f.push(this._serializeFragment(m,k,h,l))}}else{f.push(this._serializeFragment(m,b[m],h,l))}}if(h=="query"){return f.join("&")}else{return f.join("")}},update:function(){for(var b=0,a=this.items.length;b<a;b++){if((this.items[b])&&(this.items[b].update)){this.items[b].update()}}},validate:function(){var b=true;this._resetInvalidFields();if((this.items)&&(this.items.length>0)){for(var a=0;a<this.items.length;a++){if(this.items[a].validate(this)!==true){this.items[a].setInvalid(true);b=false}}}if(b===false){this.triggerEvent("formvalidationfailure")}return b},_resetInvalidFields:function(){if((this.items)&&(this.items.length>0)){for(var a=0;a<this.items.length;a++){this.items[a].setInvalid(false)}}},_serializeFragment:function(a,d,e,b){var f="";if(e=="query"){f=a+"="+d}else{if((e=="xml")&&(b)&&(b.evaluate)){f=b.evaluate({name:a.toString().replace(/\&/gi,"&amp;"),value:"<![CDATA["+d.toString().replace(/\]\]\>&/gi,"]]>]]<![CDATA[>")+"]]>"})}else{if((e=="string")&&(b)&&(b.evaluate)){f=b.evaluate({name:a,value:d})}}}return f},VALID_PROPERTIES:["container","items"],EVENTS:["formvalidationfailure"],CLASS_NAME:"aw.ui.Form"});aw.ui.GeographyBar=Class.create(aw.ui,{standardOptions:[],_searchBar:null,_rangesInput:null,_unitsSelect:null,_editButton:null,_saveButton:null,_onActiveGeographyChanged_fx:null,_onGeographySettingsReceived_fx:null,_onGuzzlerDatasetsChanged_fx:null,_onDropDownClick_fx:null,_onSearchBarKeydown_fx:null,_onUnitsSelectChanged_fx:null,_onRangesChanged_fx:null,initialize:function(b,a){this.standardOptions=[];this._searchBar=null;this._rangesInput=null;this._unitsSelect=null;this._editButton=null;this._saveButton=null;this._onActiveGeographyChanged_fx=null;this._onGeographySettingsReceived_fx=null;this._onGuzzlerDatasetsChanged_fx=null;this._onDropDownClick_fx=null;this._onSearchBarKeydown_fx=null;this._onUnitsSelectChanged_fx=null;this._onRangesChanged_fx=null;aw.ui.prototype.initialize.apply(this,arguments);if(this.componentBus){this.componentBus.getComponentReferences("aw.GeographyManager",function(d){if((d)&&(d.length>0)){var e=d[0];this._onActiveGeographyChanged_fx=this._onActiveGeographyChanged.bind(this);this._onGeographySettingsReceived_fx=this._buildUnitSelect.bind(this,false);this._onGuzzlerDatasetsChanged_fx=this._buildUnitSelect.bind(this,true);e.registerEvent("onactivegeographychanged",this._onActiveGeographyChanged_fx);e.registerEvent("ongeographysettingsreceived",this._onGeographySettingsReceived_fx);e.registerEvent("onguzzlerdatasetchanged",this._onGuzzlerDatasetsChanged_fx)}}.bind(this));this.componentBus.registerEvent("onauthenticationfailure",this._onAuthenticationFailure.bind(this));this.componentBus.registerEvent("onauthenticationsuccess",this._onAuthenticationSuccess.bind(this));this.componentBus.registerEvent("onvalidationfailure",this._onAuthenticationFailure.bind(this));this.componentBus.registerEvent("onvalidationsuccess",this._onAuthenticationSuccess.bind(this))}},destroy:function(){if(this.componentBus){var a=this.componentBus.getComponentReferences("aw.GeographyManager");if((a)&&(a.length>0)){a=a[0];if(this._onActiveGeographyChanged_fx){a.unregisterEvent("onactivegeographychanged",this._onActiveGeographyChanged_fx);this._onActiveGeographyChanged_fx=null}if(this._onGeographySettingsReceived_fx){a.unregisterEvent("ongeographysettingsreceived",this._onGeographySettingsReceived_fx);this._onGeographySettingsReceived_fx=null}if(this._onGuzzlerDatasetsChanged_fx){a.unregisterEvent("onguzzlerdatasetchanged",this._onGuzzlerDatasetsChanged_fx);this._onGuzzlerDatasetsChanged_fx=null}}}aw.ui.prototype.destroy.apply(this)},draw:function(){aw.ui.prototype.draw.apply(this);this._searchBar=this.canvas.down('input[id="search"]');if(this._searchBar){this._onSearchBarKeydown_fx=this._onSearchBarKeydown.bind(this);aw.EventManager.register(this._searchBar,"keydown",this._onSearchBarKeydown_fx)}this._rangesInput=this.canvas.down('input[id="radii"]');if(this._rangesInput){this._onRangesChanged_fx=this._onRangesChanged.bind(this);aw.EventManager.register(this._rangesInput,"change",this._onRangesChanged_fx)}var a=this.canvas.down("#units");if(a){this._onUnitsSelectChanged_fx=this._onUnitsSelectChanged.bind(this);aw.EventManager.register(a,"change",this._onUnitsSelectChanged_fx);a=null}var b=this.canvas.down("div.edit");if(b){this._editButton=new aw.ui.Control.Button({label:"Edit",container:b},{click:this._onEditButtonClick.bind(this)})}b=null;var e=this.canvas.down("div.save");if(e){this._saveButton=new aw.ui.Control.Button({label:"Save",container:e,disabled:true},{click:this._onSaveButtonClick.bind(this)})}e=null;var d=this.canvas.down("div.search");if(d){aw.EventManager.register(d,"click",this._onClick.bind(this))}d=null;return this.canvas},erase:function(){if(this._searchBar){if(this._onSearchBarKeydown_fx){aw.EventManager.unregister(this._searchBar,"keydown",this._onSearchBarKeydown_fx);this._onSearchBarKeydown_fx=null}Element.remove(this._searchBar);this._searchBar=null}if(this._rangesInput){if(this._onRangesChanged_fx){aw.EventManager.unregister(this._rangesInput,"change",this._onRangesChanged_fx);this._onRangesChanged_fx=null}Element.remove(this._rangesInput);this._rangesInput=null}if(this._onUnitsSelectChanged_fx){var a=this.canvas.down("#units");if(a){aw.EventManager.unregister(a,"change",this._onUnitsSelectChanged_fx);this._onUnitsSelectChanged_fx=null;Element.remove(a);a=null}}aw.ui.prototype.erase.apply(this)},_buildUnitSelect:function(l){var d=this.componentBus.getComponentReferences("aw.GeographyManager");if((d)&&(d.length>0)&&(d[0].geographySettings)){d=d[0]}else{return}var a=d.geographySettings;var b=d.guzzlerDataset;var f;if((a.enableDrivetimeGeography===true)&&(!b)){return}var h=this.canvas.down("#units");if(h){h.options.length=0;var k=[{key:"Miles",label:"Miles"},{key:"Kilometers",label:"Kilometers"}];if(a.enableDrivetimeGeography===true){if((b.speeds)&&(b.speeds.length>0)){for(f=0;f<b.speeds.length;f++){k.push({key:"DT|Minutes|"+b.name+"."+b.speeds[f],label:"Minutes ("+b.speeds[f]+")"})}}else{k.push({key:"DT|Minutes",label:"Minutes (Drivetime)"})}}for(f=0;f<k.length;f++){var g=document.createElement("option");g.text=k[f].label;g.value=k[f].key;try{h.add(g,null)}catch(j){h.add(g)}g=null}if(d.activeGeography){this._loadGeographyInfo(d.activeGeography)}}h=null},_hideOptions:function(){if(this._resultsContainer){this._resultsContainer.remove();this._resultsContainer=null;if(this._onDropDownClick_fx){aw.EventManager.unregister(document.getElementsByTagName("body")[0],"click",this._onDropDownClick_fx)}}},_loadGeographyInfo:function(a){if((!a)||(!a.geos)||(!a.geos.length>0)){return}if(this._searchBar){this._searchBar.value=a.name}var h=this.canvas.down("#units");if(!h){return}if((this._rangesInput)&&(h)){var j=a.getGeographyTypes();var d=this.canvas.down(".rangesTextBox");if((j.length>1)||((j[0]!="aw.Geography.Radius")&&(j[0]!="aw.Geography.Drivetime"))){if(d){d.hide()}h.hide();return}if(d){d.show()}h.show();var k=a.getRadiiInfo();this._rangesInput.value=k.sizes;var f,m=h.options,b=m.length,e,g;for(f=0;f<b;f++){g=m[f].value;e=k.dataset;if(g.match(k.units)){if((!e)||(e=="*")||(g.match(e))){h.selectedIndex=f;return}}}h=null;j=null;d=null;k=null;g=null}},_onActiveGeographyChanged:function(a){this._loadGeographyInfo(a)},_onAuthenticationFailure:function(){if(this._saveButton){this._saveButton.disable()}},_onAuthenticationSuccess:function(){if(this._saveButton){this._saveButton.enable()}},_onClick:function(d){var b=aw.EventManager.getEvent(d);var a=b.target;if(!a){return}if((!a.tagName)||(a.tagName.toLowerCase()!="div")){return}if(a.className=="search"){this._onExpandArrowClicked()}else{if(a.className=="submit"){this._onSubmitClicked()}}a=null},_onDropDownClick:function(){this._hideOptions()},_onEditButtonClick:function(a){alert("Edit")},_onExpandArrowClicked:function(){if(this._resultsContainer){this._hideOptions();return}var a=[];var e=this.componentBus.getComponentReferences("aw.GeographyManager");if((e)&&(e.length>0)){e=e[0];var f=e.getAllHistoryGeographies();if((f)&&(f.length>0)){var d=null;for(var b=0;((d=f[b])&&(b<5));b++){a.push({label:((d.name)&&(d.name.length>40))?(d.name.substring(0,40)+"..."):d.name,callback:this._onHistoryGeographyClicked.bind(this,d),icon:"./core/img/GeographyBar/geography.png"})}}else{a.push({label:"No historical geographies found."})}}this._showOptions(a)},_onHistoryGeographyClicked:function(d){if(!d){return}var b=this.componentBus.getComponentReferences("aw.GeographyManager");if((b)&&(b.length>0)){b=b[0]}else{return}if(d.geoCollection){b.setActiveGeography(d.geoCollection);return}else{var a=this.componentBus.getComponentReferences("aw.UserDataManager");if((a)&&(a.length>0)){a[0].retrieveData("HistoryGeography",d.name,null,function(f,e){if((e)&&(e.length>0)&&(e[0].geoCollection)){f.setActiveGeography(e[0].geoCollection)}}.bind(this,b))}}},_onRangesChanged:function(){if((!this._rangesInput)){return}var a=this.canvas.down("#units");if(!a){return}var d=this.componentBus.getComponentReferences("aw.GeographyManager");if((d)&&(d.length>0)){d=d[0];var b=d.validateRadii(this._rangesInput.value,a.value);if(b.isGood!==true){new aw.ui.Dialog.Error({title:"Error",content:b.message});return}else{if(d.activeGeography){d.activeGeography.setRadiiAttributes({r:b.ranges});d.setActiveGeography(d.activeGeography)}}}a=null},_onSaveButtonClick:function(b){if(this.isSessionValidated()===true){var a=this.componentBus.getComponentReferences("aw.GeographyManager");if((a)&&(a.length>0)){a[0].saveActiveGeography()}}else{new aw.ui.Dialog.Error({title:"Access Denied",content:"You must be logged in to access this functionality."})}},_onSearchBarKeydown:function(b){var a=aw.EventManager.getEvent(b);if(a.keyCode==13){this._onSubmitClicked();return}},_onSearchGeographyClicked:function(k){if(!k){return}var d=this.componentBus.getComponentReferences("aw.GeographyManager");if((d)&&(d.length>0)){d=d[0]}else{return}var j=null;var g=(k.Label?k.Label:(k.Name?k.Name:k.name));var h=(k.Longitude?k.Longitude:(k.Lon?k.Lon:null));var f=(k.Latitude?k.Latitude:(k.Lat?k.Lat:null));if(k.MatchType=="Address"){var e=this.canvas.down("#units");var a=d.validateRadii(this._rangesInput.value,e.value);if(a.isGood!==true){new aw.ui.Dialog.Error({title:"Error!",content:a.message});return}j=new aw.GeographyCollection(null,g,"Address",{x:h,y:f});if((a.ranges)&&(a.ranges.length>0)){for(var b=0;range=a.ranges[b];b++){if(e.value.indexOf("DT|")!=-1){j.addGeography(new aw.Geography.Drivetime(null,g,g,range,h,f,"Minutes"))}else{j.addGeography(new aw.Geography.Radius(null,g,g,range,h,f,"Miles"))}}}}else{if(k.MatchType=="StandardGeography"){j=new aw.GeographyCollection(null,g,"",null);j.addGeography(new aw.Geography.Standard(null,g,g,k.ShortGeoName,k.GeoKey,d.allocateDataset.key))}}d.setActiveGeography(j)},_onSearchReceived:function(e){var b=[];var a=null;if((e)&&(e.length>0)){if(e.length===1){this._onSearchGeographyClicked(e[0]);return}for(var d=0;a=e[d];d++){b.push({label:"<h3>"+(((a.Name)&&(a.Name.length>40))?(a.Name.substring(0,40)+"..."):a.Name)+"</h3>"+((a.TypeGeo)?a.TypeGeo:""),callback:this._onSearchGeographyClicked.bind(this,a),icon:"./core/img/GeographyBar/geography.png",cssClass:"search"})}}else{b.push({label:"No matches found...."})}this._showOptions(b)},_onSubmitClicked:function(){if((!this._searchBar)||(!this._searchBar.value)){return}var a=this.componentBus.getComponentReferences("aw.GeographyManager");if((a)&&(a.length>0)){a[0].search(this._searchBar.value,this._onSearchReceived.bind(this))}},_onUnitsSelectChanged:function(){var a=this.canvas.down("#units");if(!a){return}var b=this.componentBus.getComponentReferences("aw.GeographyManager");if((b)&&(b.length>0)){b=b[0];if(b.activeGeography){b.activeGeography.setRadiiAttributes({u:a.value});b.setActiveGeography(b.activeGeography)}}a=null},_renderOption:function(d,b){var a=this.getId("awok");var f=b.label;if(b.icon){f='<div class="icon" style="background-image: url(\''+b.icon+"');\">"+f+"</div>"}f='<li key="'+a+'" class="item'+((b.disabled)?" disabled":"")+((b.cssClass)?(" "+b.cssClass):"")+'">'+f+"</li>";d.insert(f);if((b.callback)&&(b.disabled!==true)){var e=d.down('li[key="'+a+'"]');if(e){aw.EventManager.register(e,"click",b.callback)}}},_showOptions:function(m){if((!m)||(!m.length>0)){return}this._hideOptions();var g=$(document.getElementsByTagName("body")[0]);var a=this.getId();g.insert(this._templates.results.evaluate({id:a}));this._onDropDownClick_fx=this._onDropDownClick.bind(this);aw.EventManager.register.bind(aw.EventManager,g,"click",this._onDropDownClick_fx).delay(0.1);this._resultsContainer=$(document.getElementById(a));if(this._resultsContainer){var b=this._searchBar.cumulativeOffset();var l=this._searchBar.getDimensions();this._resultsContainer.setStyle({top:""+(b.top+l.height)+"px",left:""+(b.left)+"px"});var h=$(this._resultsContainer.getElementsByTagName("ul")[0]);var f=null;h.insert('<li><div class="header">Geographies</div></li>');for(var e=0;f=m[e];e++){this._renderOption(h,f)}if((this.standardOptions)&&(this.standardOptions.length>0)){h.insert('<li><div class="header">Other Options</div></li>');for(var d=0;f=this.standardOptions[d];d++){this._renderOption(h,f)}}h=null;var k=this._resultsContainer.getDimensions();if(k.height>400){this._resultsContainer.setStyle({overflow:"auto",height:"400px"})}}},_templates:{ui:new Template('<div class="right"><div class="mid"><div class="search"><input type="text" name="search" id="search" /><div class="submit"></div></div><div class="details"><div class="rangesTextBox">Ranges:<input type="text" name="radii" id="radii" /></div><div class="unitsDropDown"><select name="units" id="units"></select></div><div class="save"></div><div class="edit"></div></div></div></div>'),results:new Template('<div id="#{id}" class="aw_ui_GeographyBar_Results"><ul></ul></div>')},VALID_PROPERTIES:["container","cssClass","componentBus","inheritCSS","standardOptions"],CLASS_NAME:"aw.ui.GeographyBar"});aw.ui.Grid=Class.create(aw.ui,{baseRequest:null,checkboxes:false,columns:[],data:[],detailTemplate:null,filter:null,recordPath:null,recordsPerPage:0,selectMultiple:true,server:null,showHeaders:true,showFooters:true,userSetRecordsPerPage:false,_currentPage:0,_lastSelectedKey:null,_onClick_fx:null,_pageSelectAll:[],_selectedKeys:[],_totalPages:0,_totalRows:0,initialize:function(b,a){this.checkboxes=false;this.columns=[];this.data=[];this.detailTemplate=null;this.filter=null;this.recordsPerPage=null;this.searchable=false;this.selectMultiple=true;this.showHeaders=true;this.showFooters=true;this.userSetRecordsPerPage=false;this._currentPage=0;this._totalPages=0;this._totalRows=0;this._lastSelectedKey=null;this._onClick_fx=null;this._pageSelectAll=[];this._searchValue=null;this._selectedKeys=[];aw.ui.prototype.initialize.apply(this,arguments)},clearSelection:function(){if(!this.canvas){return}var e=this.getSelectedRecords();var a=null;var d=false;if((e)&&(e.length>0)){for(var b=0;a=e[b];b++){this._deselectRecord(a,false);d=true}}if((arguments)&&(arguments.length>0)&&(arguments[0]!==false)&&(d===true)){this.triggerEvent("onselectionchanged",[])}},draw:function(){aw.ui.prototype.draw.apply(this);if(this.baseRequest){this._retrieveRecords(this._currentPage)}else{this._renderTable()}this._onClick_fx=this._onclick.bind(this);aw.EventManager.register(this.canvas,"click",this._onClick_fx);return this.canvas},erase:function(){if(this.canvas){if(this._onClick_fx){aw.EventManager.unregister(this.canvas,"click",this._onClick_fx);this._onClick_fx=null}}aw.ui.prototype.erase.apply(this)},getColumnByIndex:function(b){if((!this.columns)||(!this.columns.length>0)||(!b)){return null}var a=null;for(var d=0;a=this.columns[d];d++){if(a.index==b){return a}}return null},getColumnByLabel:function(b){if((!this.columns)||(!this.columns.length>0)||(!b)){return null}var a=null;for(var d=0;a=this.columns[d];d++){if(a.label==b){return a}}return null},getRecordBy:function(f){if((!this.data)||(!this.data.length>0)||(!f)){return null}var a=null;var e=true;for(var d=0;a=this.data[d];d++){e=true;for(var b in f){if(a[b]!==f[b]){e=false}break}if(e===true){return a}}return null},getRecordByIndex:function(a){if((!this.data)||(!this.data.length>0)||(a===false)){return null}return this.data[a]||null},getRecordSet:function(){return this.data||[]},getSelectedKeys:function(){var d=[];if((!this.data)||(!this.data.length>0)){return d}for(var b=0,a=this.data.length;b<a;b++){if(this.data[b]._selected===true){d.push(this.data[b]._key)}}return d},getSelectedRecords:function(){var b=[];if((!this.data)||(!this.data.length>0)){return b}for(var d=0,a=this.data.length;d<a;d++){if(this.data[d]._selected===true){b.push(this.data[d])}}return b},loadData:function(b){if(!(b instanceof Array)){throw new TypeError("data is not an array")}this.data=b;var a=this._getSortedColumn();if(a){this._sortData(a,a.sortDirection)}this._renderTable()},selectRecordByIndex:function(a){this._selectRecord(this.getRecordByIndex(a))},selectRecordBy:function(a){this._selectRecord(this.getRecordBy(a))},setFilter:function(a){this.filter=a;this._renderTable()},sortByColumnIndex:function(a,b){if(!a){return}this._sortByColumn(this.getColumnByIndex(a),b)},sortByColumnLabel:function(a,b){if(!a){return}this._sortByColumn(this.getColumnByLabel(a),b)},_deselectRecord:function(a,b){if((!a)||(!this.data)||(!this.data.length>0)){return}a._selected=null;var d=this.canvas.down('table tbody tr[key="'+a._key+'"].selected');if(d){d.removeClassName("selected");if(this.checkboxes){d.down("input[type=checkbox]").checked=false}if(b!==false){this._onSelectionChanged()}}},_getSortedColumn:function(){if((this.columns)&&(this.columns.length>0)){for(var a=0;a<this.columns.length;a++){if(this.columns[a].sorted===true){return this.columns[a]}}}return null},_getRecordByElement:function(a){if((!a)||(!this.data)||(!this.data.length>0)){return null}var d=(a.tagName)?a.tagName.toLowerCase():null;if((!d)||(d!="tr")){a=$(aw.Element.getParentNode(a,"tr","record"))}if(!a){return null}var b=a.readAttribute("key");return this._getRecordByKey(b)},_getRecordByKey:function(d){if((!d)||(!this.data)||(!this.data.length>0)){return null}var a=null;for(var b=this.data.length;b--;){if(this.data[b]._key==d){return this.data[b]}}return null},_gotoPage:function(a){switch(a){case"aw_ui_Grid_next":if(this._currentPage===(this._totalPages-1)){return}++this._currentPage;break;case"aw_ui_Grid_prev":if(this._currentPage===0){return}--this._currentPage;break;case"aw_ui_Grid_first":this._currentPage=0;break;case"aw_ui_Grid_last":this._currentPage=this._totalPages-1;break;default:break}if(this.baseRequest){this._retrieveRecords(this._currentPage)}else{this._renderTable()}},_isRecordSelected:function(a){if((!a)||(!this.canvas)){return false}if(a._selected===true){return true}var b=this.canvas.down('table tbody tr[key="'+a._key+'"]');if(b){return b.hasClassName("selected")}return false},_onclick:function(k){var j=aw.EventManager.getEvent(k);var b=j.target;if(!b){return}var d=(b.tagName)?b.tagName.toLowerCase():null;var a=this._getRecordByElement(b);if(a){if((d=="td")&&((b.hasClassName("expand"))||(b.hasClassName("collapse")))){b.className=(b.hasClassName("expand"))?"collapse":"expand";this._toggleRecordDetails(a)}else{if((j.shiftKey)&&(this.selectMultiple===true)&&(this._lastSelectedKey)){this.clearSelection(false);var g=this.canvas.down('tr[key="'+a._key+'"]');var h=[g],f=null;while((g)&&(g=g.previousSibling)){if((g)&&(g.nodeType==1)&&(g.tagName)&&(g.tagName.toLowerCase()=="tr")){f=g.getAttribute("key");h.push(g);if((f)&&(f==this._lastSelectedKey)){this._selectRecords(h);this.triggerEvent("onselectionchanged",this.getSelectedRecords());return}}}g=this.canvas.down('tr[key="'+a._key+'"]');h=[g];while((g)&&(g=g.nextSibling)){if((g)&&(g.nodeType==1)&&(g.tagName)&&(g.tagName.toLowerCase()=="tr")){f=g.getAttribute("key");h.push(g);if((f)&&(f==this._lastSelectedKey)){this._selectRecords(h);this.triggerEvent("onselectionchanged",this.getSelectedRecords());return}}}}if((j.ctrlKey||d==="input")&&(this._isRecordSelected(a))){this._deselectRecord(a);return}if((!j.ctrlKey&&d!=="input")||(this.selectMultiple!==true)){this.clearSelection(false)}if(this._isRecordSelected(a)){this._deselectRecord(a)}else{this._selectRecord(a)}this._lastSelectedKey=a._key}}else{if(d==="a"){this._gotoPage(b.className)}if(this.selectMultiple){if(d==="input"&&b.parentNode.nodeName==="TH"){this._toggleSelectAll(b.checked,true)}else{if(d==="th"&&b.hasClassName("checkbox")){this._toggleSelectAll(!b.down("input[type=checkbox]").checked,true)}}}if((d!="th")&&(!b.hasClassName("column"))&&(aw.Element.getParentNode(b,"th","column"))){b=$(aw.Element.getParentNode(b,"th","column"));if((b)&&(b.tagName)){d=b.tagName.toLowerCase()}}if((d=="th")&&(b.hasClassName("column"))&&(b.hasClassName("sortable"))){if(b.hasClassName("asc")){this.sortByColumnIndex(b.readAttribute("key"),"desc")}else{this.sortByColumnIndex(b.readAttribute("key"),"asc")}}}j.stop()},_onRecordsReceived:function(b,e){if((!e)||(!e.payload)){return}var a=(((this.recordPath)&&(this.recordPath!==""))?this.recordPath:"").split(".");var d=e.payload;while((d)&&(a)&&(a.length>0)&&(a[0]!=="")){d=d[a.shift()]}if(!d){return}this._totalRows=d.totalRecords;this._currentPage=d.page;this.columns=d.columns;this.data=d.records;this._renderTable()},_onSelectionChanged:function(){var b=false;var d=this.getSelectedKeys();if(d.length!=this._selectedKeys.length){b=true}else{for(var a=0;a<this._selectedKeys.length;a++){if((!d[a])||(d[a]!=this._selectedKeys[a])){b=true}}}if(b===true){this._selectedKeys=d;this.triggerEvent("onselectionchanged",this.getSelectedRecords())}},_renderTable:function(){if((!this.canvas)||(!this.columns)||(!this.columns.length>0)){return}var q=0,p=0,o=0;var b=[],w=[],a=[],v=[];var m=null;if(this.checkboxes){b.push('<th class="column checkbox" title="Select All"><input type="checkbox" /></th>')}if(this.detailTemplate){b.push('<th class="column expand">&#160;</th>')}if((this.recordsPerPage>0)&&(this.showFooters)){w=b.slice(0)}for(q=0;q<this.columns.length;q++){m=this.columns[q];m.sortable=(!this.baseRequest)?true:false;b.push('<th class="column'+((m.sorted===true)?(" "+m.sortDirection):"")+((m.sortable!==false)?" sortable":"")+'" key="'+m.index+'"><div>'+m.label+"</div></th>");if((this.recordsPerPage>0)&&(this.showFooters)){w.push('<th class="column">'+m.label+"</th>")}}if((this.data)&&(this.data.length>0)){var l=null,n=null;var d=[];if(this.filter){var s=this.data.length;for(q=0;q<s;q++){if(this.filter(this.data[q])){d.push(this.data[q])}}}else{d=this.data}var t=0,e=d.length;var u=false;var f=false;var g="";if((this.recordsPerPage>0)&&(!this.baseRequest)){t=this._currentPage*this.recordsPerPage;e=t+this.recordsPerPage}for(q=t;q<e;q++){g="";l=d[q];if(!l){break}if(!l._key){l._key=this.getId("awgr")}f=l.disabled||false;if(f===true){u=false}else{u=l._selected||false}a.push('<tr class="record'+((u)?" selected":"")+((f)?" disabled":"")+'" key="'+l._key+'">');if(this.checkboxes){a.push('<td class="checkbox"><input type="checkbox"'+(u?' checked="checked"':"")+" /></td>")}if(this.detailTemplate){a.push('<td class="expand">&#160;</td>')}for(p=0;p<this.columns.length;p++){m=this.columns[p];n=l[m.index];a.push('<td key="'+m.index+'"'+((m.cssClass)?(' class="'+m.cssClass+'"'):"")+">");if(n instanceof Array){for(o=0;o<n.length;o++){if((m.hasOwnProperty("truncate"))&&(typeof m.truncate=="number")&&((typeof l.truncate!="boolean")||(typeof l.truncate=="boolean"&&l.truncate===true))){if(n[o].length>m.truncate){n[o]=n[o].slice(0,m.truncate)+"..."}}if(n[o].draw){v.push({record:l._key,column:m.index,data:n[o]})}else{a.push(n[o])}}}else{if(n){if((m.hasOwnProperty("truncate"))&&(typeof m.truncate=="number")&&((typeof l.truncate!="boolean")||(typeof l.truncate=="boolean"&&l.truncate===true))){if(n.length>m.truncate){n=n.slice(0,m.truncate)+"..."}}if(n.draw){v.push({record:l._key,column:m.index,data:n})}else{a.push(n)}}}a.push("</td>")}a.push("</tr>")}}this.canvas.innerHTML='<table cellspacing="0" cellpadding="0" onselectstart="return false;">'+((this.showHeaders)?'<thead class="columns"><tr>'+b.join("")+"</tr></thead>":"")+(((a)&&(a.length>0))?"<tbody>"+a.join("")+"</tbody>":"")+(((this.recordsPerPage>0)&&(this.showFooters))?'<tfoot class="columns"><tr>'+w.join("")+"</tr></tfoot>":"")+"</table>";if(this.recordsPerPage>0){var h=[];this._renderPageLinks();if(this.showHeaders&&this.checkboxes){if(this._pageSelectAll[this._currentPage]===true){h=this.canvas.select(".columns>tr>.checkbox>input:not(:checked)");if(h){for(q=h.length;q--;){h[q].checked=true}}}else{h=this.canvas.select(".columns>tr>.checkbox>input:checked");if(h){for(q=h.length;q--;){h[q].checked=false}}}}}this._renderSpecials(v);this._onSelectionChanged()},_renderPageLinks:function(){if(!this.canvas){return}var f;var d="";var b=false;var e=false;var g=this.canvas.select("ul.pager");if((g)&&(g.length>0)){for(f=0;f<g.length;f++){g[0].remove()}}if(!this.baseRequest){this._totalRows=(this.data)?this.data.length:0}this._totalPages=Math.ceil(this._totalRows/this.recordsPerPage);if(this._pageSelectAll.length===0){for(f=this._totalPages;f--;){this._pageSelectAll.push(false)}}b=(this._currentPage===0);e=(this._currentPage===(this._totalPages-1));d+='<ul class="pager"><li class="summary">Showing page ';d+=this._currentPage+1;d+=" of ";d+=(this._totalPages===0)?"1":this._totalPages;d+='.</li><li class="pagelinks">';d+=(b)?'<span class="aw_ui_Grid_first disabled"></span> <span class="aw_ui_Grid_prev disabled"></span> ':'<a class="aw_ui_Grid_first" href="javascript:void(0);" title="First Page"></a> <a class="aw_ui_Grid_prev" href="javascript:void(0);" title="Previous Page"></a> ';d+=(e)?'<span class="aw_ui_Grid_next disabled"></span> <span class="aw_ui_Grid_last disabled"></span>':'<a class="aw_ui_Grid_next" href="javascript:void(0);" title="Next Page"></a> <a class="aw_ui_Grid_last" href="javascript:void(0);" title="Last Page"></a>';d+="</li></ul>";this.canvas.insert({top:d});this.canvas.insert({bottom:d});if(this.userSetRecordsPerPage){this.canvas.insert({bottom:'<div id="recordsPerPage"></div>'});var a=this.canvas.down("#recordsPerPage");this._numRecords=new aw.ui.Control.TextBox({container:a,label:"Rows per page:",maxlength:3,name:"numRecordsDisplayed",value:this.recordsPerPage},{enter:this._updateRecordsPerPage.bind(this)});if((this._currentPage+1)>(this._totalPages)){this._gotoPage("aw_ui_Grid_prev")}}},_renderSpecials:function(d){if((!d)||(!d.length>0)){return}var e=null;for(var f=0,b=d.length;f<b;f++){e=d[f];if((e.record)&&(e.column)&&(e.data)&&(e.data.draw)){var a=this.canvas.down('tr[key="'+e.record+'"] td[key="'+e.column+'"]');if(a){a.appendChild(e.data.draw())}a=null}}},_retrieveRecords:function(b){if(!this.baseRequest){return}var a=Object.clone(this.baseRequest);a.page=b;a.records=this.recordsPerPage;this.request(a,this._onRecordsReceived.bind(this),this.server)},_selectRecord:function(a,b){if((!a)||(a.disabled)||(!this.data)||(!this.data.length>0)){return}if(this.selectMultiple!==true){this.clearSelection(false)}a._selected=true;var d=this.canvas.down('table tbody tr[key="'+a._key+'"]');if(d){d.addClassName("selected");if(this.checkboxes){d.down("input[type=checkbox]").checked=true}}d=null;if(b!==false){this._onSelectionChanged()}},_selectRecords:function(a,d){if((!a)||(!a.length>0)){return}for(var b=0;b<a.length;b++){this._selectRecord(this.getRecordBy({_key:a[b].getAttribute("key")}),false)}if(d!==false){this._onSelectionChanged()}},_sortByColumn:function(a,b){if(!a){return}b=(b==="desc")?"desc":"asc";if((this.columns)&&(this.columns.length>0)){for(var d=0;d<this.columns.length;d++){this.columns[d].sorted=false;this.columns[d].sortDirection=null}}a.sorted=true;a.sortDirection=b;this._sortData(a,b);if(this.checkboxes&&this._pageSelectAll.length>0){for(i=this._pageSelectAll.length;i--;){this._pageSelectAll[i]=false}}this._renderTable()},_sortData:function(a,b){this.data=this.data.sort(this._sortFunction(a.index,a.type,b))},_sortFunction:function(a,b,d){if(b=="numeric"){if(d=="desc"){return function(e,f){var h=((f)&&(f[a]))?Number(f[a]):0;var g=((e)&&(e[a]))?Number(e[a]):0;return h-g}}else{return function(f,e){var h=((f)&&(f[a]))?Number(f[a]):0;var g=((e)&&(e[a]))?Number(e[a]):0;return h-g}}}else{if(b=="date"){if(d=="desc"){return function(e,f){var h=((f)&&(f[a]))?new Date(f[a]):0;var g=((e)&&(e[a]))?new Date(e[a]):0;return h-g}}else{return function(f,e){var h=((f)&&(f[a]))?new Date(f[a]):0;var g=((e)&&(e[a]))?new Date(e[a]):0;return h-g}}}else{if(b=="currency"){if(d=="desc"){return function(e,f){var h=((f)&&(f[a]))?Number(f[a].replace(/\D*/gi,"")):0;var g=((e)&&(e[a]))?Number(e[a].replace(/\D*/gi,"")):0;return h-g}}else{return function(f,e){var h=((f)&&(f[a]))?Number(f[a].replace(/\D*/gi,"")):0;var g=((e)&&(e[a]))?Number(e[a].replace(/\D*/gi,"")):0;return h-g}}}else{if(d=="desc"){return function(e,f){var h=((f)&&(f[a]))?String(""+f[a]+"").toLowerCase():"";var g=((e)&&(e[a]))?String(""+e[a]+"").toLowerCase():"";return(h==g)?0:(h<g)?-1:1}}else{return function(f,e){var h=((f)&&(f[a]))?String(""+f[a]+"").toLowerCase():"";var g=((e)&&(e[a]))?String(""+e[a]+"").toLowerCase():"";return(h==g)?0:(h<g)?-1:1}}}}}return null},_toggleRecordDetails:function(a){var d=this.canvas.down('table tbody tr[key="'+a._key+'"].record');var b=this.canvas.down('table tbody tr[key="'+a._key+'"].details');if(b){b.remove();return}if(d){d.insert({after:'<tr key="'+a._key+'" class="details"><td class="expand_child">&#160;</td><td colspan="'+(this.columns.length)+'">'+this.detailTemplate.evaluate(a)+"</td></tr>"})}},_toggleSelectAll:function(b,h){if(!this.selectMultiple){throw"Multiple selection is disabled."}var e,g,d;var a=((this.recordsPerPage>0)&&this.showHeaders);var f=(b)?".columns>tr>.checkbox>input:not(:checked)":".columns>tr>.checkbox>input:checked";var j=(b)?"tr.record:not(.selected)":"tr.record.selected";if(a){g=this.canvas.select(f);if(g){for(e=g.length;e--;){g[e].checked=b}}}this._pageSelectAll[this._currentPage]=b;d=this.canvas.select(j);if(b){for(e=d.length;e--;){this._selectRecord(this.getRecordBy({_key:d[e].getAttribute("key")}),false)}}else{for(e=d.length;e--;){this._deselectRecord(this.getRecordBy({_key:d[e].getAttribute("key")}),false)}}if(h){this._onSelectionChanged()}},_updateRecordsPerPage:function(){if(this._numRecords){var a=this._numRecords;if((a.value==="")||(a.value==="0")){return}this.recordsPerPage=parseInt(a.value,10);if(this.baseRequest){this._retrieveRecords(this._currentPage)}else{this._renderTable()}}},_templates:{ui:new Template('<table cellspacing="0" cellpadding="0"><thead class="columns"></thead><tbody></tbody><tfoot class="columns"></tfoot></table>')},EVENTS:["onselectionchanged"],VALID_PROPERTIES:["checkboxes","container","columns","data","recordsPerPage","detailTemplate","selectMultiple","showHeaders","showFooters","userSetRecordsPerPage","cssClass","filter","baseRequest","recordPath","server","componentBus"],CLASS_NAME:"aw.ui.Grid"});aw.ui.HTML=Class.create(aw.ui,{html:null,initialize:function(b,a){this.html=null;aw.ui.prototype.initialize.apply(this,arguments)},draw:function(){return this.html.replace(/\n/gi,"<br/>")},CLASS_NAME:"aw.ui.HTML",VALID_PROPERTIES:["container","html"]});aw.ui.Map=Class.create(aw.ui.Container,{controls:[],controlGroups:{},layers:[],inProj:null,outProj:null,maxExtent:null,service:null,_layerChangedTimeout:null,_layerInfo:null,_map:null,_mapBounds:null,_mapCenter:null,_mapZoom:null,_persistInfoTimeout:null,_setMapSizeTimeout:null,_updateLayerIndexTimeout:null,_clickControl:null,_canvasDims:null,initialize:function(b,a){this.controls=[];this.controlGroups={};this.layers=[];this.inProj=new OpenLayers.Projection("EPSG:4326");this.outProj=new OpenLayers.Projection("EPSG:900913");this.maxExtent=new OpenLayers.Bounds(-20037508,-20037508,20037508,20037508.34);this.service="src";this._clickControl=null;this._canvasDims=null;this._layerInfo=null;this._layerChangedTimeout=null;this._map=null;this._mapBounds=null;this._mapCenter=null;this._mapZoom=null;this._setMapSizeTimeout=null;this._persistInfoTimeout=null;this._updateLayerIndexTimeout=null;aw.ui.Container.prototype.initialize.apply(this,arguments);this._retrieveLayerInfo()},addControl:function(a){if(!a){return}this.controls.push(a);if((a.CLASS_NAME)&&(a.CLASS_NAME.indexOf("OpenLayers.Control")>-1)&&(this._map)){this._map.addControl(a)}this._addControl(a)},addControls:function(a){if((!a)||(!a.length>0)){return}var d=null;for(var b=0;d=a[b];b++){this.addControl(d)}},addLayer:function(d){if((!d)||(!d.CLASS_NAME.toLowerCase().match("aw.ui.map.layer"))){return null}var a=false;for(var b=0;b<this.layers.length;b++){if(d.drawPriority<this.layers[b].drawPriority){this.layers.splice(b,0,d);a=true;break}}if(a!==true){this.layers.push(d)}this._addLayer(d);return d},afterDraw:function(){aw.ui.Container.prototype.afterDraw.apply(this);if(this._rootContainer){this._rootContainer.onMapResize()}},draw:function(){aw.ui.Container.prototype.draw.apply(this);var e={projection:this.outProj,displayProjection:this.inProj,units:"m",maxResolution:11181.645,maxZoomLevel:18,numZoomLevels:18,allOverlays:true,maxExtent:this.maxExtent,theme:null,controls:[new OpenLayers.Control.Navigation({handleRightClicks:true,mouseWheelOptions:{interval:300}}),new OpenLayers.Control.Attribution(),new OpenLayers.Control.PanPanel(),new OpenLayers.Control.ZoomPanel()]};this.canvas.setStyle({overflow:"hidden"});this._map=new OpenLayers.Map(this.canvas,e);this._map.events.on({zoomend:this._onMapZoomEnd,scope:this});this._map.events.on({moveend:this._onMapMoveEnd,scope:this});this._clickControl=new aw.ui.Map.ClickControl({inProj:this.inProj,outProj:this.outProj});this._map.addControl(this._clickControl);if((this.layers)&&(this.layers.length>0)){var d=false,h=[];for(var f=0;f<this.layers.length;f++){d=false;for(var b=0;b<h.length;b++){if(this.layers[f].drawPriority<h[b].drawPriority){h.splice(b,0,this.layers[f]);d=true;break}}if(d!==true){h.push(this.layers[f])}this._addLayer(this.layers[f])}this.layers=h}if((this.controls)&&(this.controls.length>0)){var g=null;for(var a=0;a<this.controls.length;a++){g=this.controls[a];if((g.CLASS_NAME)&&(g.CLASS_NAME.indexOf("OpenLayers.Control")>-1)){this._map.addControl(g)}else{this._addControl(this.controls[a])}}}return this.canvas},getAllLayers:function(){var d=this.layers;var b=[];if((arguments)&&(arguments.length>0)){if(arguments[0].length>0){d=arguments[0]}}for(var a=0;a<d.length;a++){if(!d[a].CLASS_NAME.toLowerCase().match("aw.ui.map.layer.group")){b.push(d[a])}if((d[a].layers)&&(d[a].layers.length>0)){b=b.concat(this.getAllLayers(d[a].layers))}}return b},getExtent:function(){if(!this._map){return null}return this._map.getExtent()},getLayerBy:function(a){return this._getLayerBy(a,this.layers)},getLayerByKey:function(a){return this.getLayerBy({key:a})},getMapSize:function(){if(!this._map){return null}return this._map.getSize()},getScale:function(){if(!this._map){return null}return this._map.getScale()},onAuthenticationFailure:function(){aw.ui.Container.prototype.onAuthenticationFailure.apply(this);this._retrieveLayerInfo()},onAuthenticationSuccess:function(){aw.ui.Container.prototype.onAuthenticationSuccess.apply(this);this._retrieveLayerInfo()},pickPoint:function(a){if((!this._map)||(!this._clickControl)){return}this._clickControl.activate(a)},removeAllLayers:function(){if((!this.layers)||(!this.layers.length>0)){return}for(var a=0;a<this.layers.length;a++){this.removeLayer(this.layers[a])}this.layers=[]},removeControl:function(f){if((!f)||(!this.controls)||(!this.controls.length>0)){return}var e=false,b=[];for(var d=0,a=this.controls.length;d<a;d++){if(this.controls[d]===f){this.controls[d].destroy();e=true}else{b.push(this.controls[d])}}if(e===true){this.controls=b;this.triggerEvent("controlremoved",f)}},removeLayer:function(d){if((!d)||(!this.layers)||(!this.layers.length>0)){return}var b;var e=this.layers;var a=e.length;var f=[];for(b=0;b<a;b++){if(e[b].id!=d.id){f.push(e[b])}}this._removeLayer(d);this.triggerEvent("layerremoved",d);this.layers=f;this._triggerLayerChanged()},removeLayerByKey:function(a){this.removeLayer(this.getLayerBy({key:a}))},setCenter:function(e,b,a){var d=OpenLayers.Projection.transform(new OpenLayers.Geometry.Point(b,e),this.inProj,this.outProj);this._center=new OpenLayers.LonLat(d.x,d.y);if(a){this._zoom=a}this._setCenter()},setLayerIndex:function(b,a){if(!this._map||!b){return}this._map.setLayerIndex(b,a)},setSize:function(a,b){aw.ui.Container.prototype.setSize.apply(this,arguments);if(this.isVisible()!==true){return}var d=this.canvas.getDimensions();if((!this._canvasDims)||((d)&&((this._canvasDims.height!=d.height)||(this._canvasDims.width!=d.width)))){this._canvasDims=d;this._setSize()}else{if(this._mapBounds){this._map.zoomToExtent(this._mapBounds)}}},zoomToExtent:function(b,a,e,d){this._mapBounds=new OpenLayers.Bounds(b,a,e,d).transform(this.inProj,this.outProj);this._zoomToExtent()},_addControl:function(e){if((!e)||(e.CLASS_NAME.indexOf("OpenLayers.Control")>-1)||(e.derivesFrom("aw.ui.Map.Control")!==true)){return}e.setMap(this);if((e.derivesFrom)&&(e.derivesFrom("aw.ui.Map.Control")===true)){var a=null;if(e.group){var b=false;var f=null;var d=e.group;if(this.controlGroups[d]){f=this.controlGroups[d]}else{f=this.controlGroups[d]=new aw.ui.Map.Control.Group({icon:"./core/img/Map/Control/wrench.png",container:this.canvas,title:d,position:{top:"5px",right:"5px",left:"auto"}});f.registerEvent("onshow",this._onControlToggled.bind(this));f.registerEvent("onhide",this._onControlToggled.bind(this));f.canvas.setStyle({zIndex:this.controls.length+1000});b=true}f.add(e);if(b){this.triggerEvent("controladded",f)}}else{e.setContainer(this.canvas);e.canvas.setStyle({zIndex:this.controls.length+1000});this.triggerEvent("controladded",e)}}},_addLayer:function(a){if((!a)||(!a.CLASS_NAME.toLowerCase().match("aw.ui.map.layer"))){return}a.setMap(this);a.registerEvent("layerchanged",this._onLayerChanged.bind(this));a.setLayerInfo(this._getLayerInfo(a));if((this._map)&&(a.getLayerObject())){this._map.addLayer(a.getLayerObject());if(a.selectable){if(!this._rootContainer){this._rootContainer=new OpenLayers.Layer.Vector.RootContainer(this.getId("awvrc"),{layers:[a.getLayerObject()]});a.getLayerObject().events.register("featureselected",this,this._onFeatureSelected.bind(this,a));this._map.addLayer(this._rootContainer)}else{this._rootContainer.addLayer(a.getLayerObject());a.getLayerObject().events.register("featureselected",this,this._onFeatureSelected.bind(this,a))}if(!this._highlightLayerControl){this._highlightLayerControl=new OpenLayers.Control.SelectFeature(this._rootContainer,{hover:true,highlightOnly:true,renderIntent:"temporary"});this._map.addControl(this._highlightLayerControl);this._highlightLayerControl.activate()}if(!this._selectLayerControl){this._selectLayerControl=new OpenLayers.Control.SelectFeature(this._rootContainer,{clickout:true,multipleKey:"ctrlKey"});this._map.addControl(this._selectLayerControl);this._selectLayerControl.activate()}}}this._updateLayerDrawIndexes();this.triggerEvent("layeradded",a);this._triggerLayerChanged()},getSelectedFeatures:function(){var f=[];if(this._rootContainer){if(this._rootContainer.layers){var d=0,g=this._rootContainer.layers,a=g.length,b=null,e=null;for(d=0;d<a;d++){b=g[d];e=b.selectedFeatures;if((e)&&(e.length>0)){f=f.concat(e)}}return f}}return null},_compileLayerInfo:function(e,d){d=d||{};if((!e)||(!e.length>0)){return d}d.layers=[];for(var b=0,a=e.length;b<a;b++){d.layers.push(e[b].getLayerInfo());if(e[b].layers){this._compileLayerInfo(e[b].layers,d.layers[b])}}return d},_getLayerBy:function(g,f){if((!g)||(!f)||(!f.length>0)){return null}var d=null;var e=true;for(var b=0;d=f[b];b++){e=true;for(var a in g){if(d[a]!==g[a]){e=false}}if(e===true){return d}if((d.layers)&&(this._getLayerBy(g,d.layers))){return this._getLayerBy(g,d.layers)}}return null},_getLayerInfo:function(e,f){if((!e)||(!this._layerInfo)||(!this._layerInfo.length>0)){return null}f=f||this._layerInfo;var b=null,a=f.length,g=null;for(var d=0;d<a;d++){g=f[d];if(e.key==g.key){return g}if((g.layers)&&(g.layers.length>0)){b=this._getLayerInfo(e,g.layers);if(b){return b}}}return null},_onActiveLayerChanged:function(a){this.triggerEvent("activelayerchanged",a)},_onControlToggled:function(a){this.triggerEvent("controltoggled",a)},_onLayerChanged:function(a){this.triggerEvent("layerchanged",a);this._triggerLayerChanged()},_onMapMoveEnd:function(){if(this.isVisible()){this.triggerEvent("moveend",this._map.getExtent())}},_onMapZoomEnd:function(){if(this.isVisible()){this.triggerEvent("zoomchanged",this._map.getScale())}},_persistLayerInfo:function(a){if(this.isSessionValidated()!==true){return}if(a===true){var b=this._compileLayerInfo(this.layers);if(b){this._layerInfo=b.layers}this.setRecordStore({key:"Maps.LayerInfo",content:b});return}if(this._persistInfoTimeout){clearTimeout(this._persistInfoTimeout);this._persistInfoTimeout=null}this._persistInfoTimeout=setTimeout(this._persistLayerInfo.bind(this,true),5000)},_removeLayer:function(a){if((!this._map)||(!a)){return}var b=a.getLayerObject();if(b){this._map.removeLayer(b)}a.destroy();this._updateLayerDrawIndexes()},_retrieveLayerInfo:function(){this.getRecordStore("Maps.LayerInfo",function(a){if((a)&&(a.length>0)&&(a[0].content)){this._layerInfo=a[0].content.layers;this._setLayerInfo(this._layerInfo)}}.bind(this))},_setCenter:function(){if((this.isVisible()!==true)||(!this._center)){return}this._map.setCenter(this._center,this._zoom)},_setLayerInfo:function(e){if((!e)||(!e.length>0)){return}var d=null;for(var b=0,a=e.length;b<a;b++){d=this.getLayerByKey(e[b].key);if(d){d.setLayerInfo(e[b])}if((e[b].layers)&&(e[b].layers.length>0)){this._setLayerInfo(e[b].layers)}}},_setSize:function(d){if(this._setMapSizeTimeout){clearTimeout(this._setMapSizeTimeout);this._setMapSizeTimeout=null}if(d!==true){this._setMapSizeTimeout=setTimeout(this._setSize.bind(this,true),100);return}if((this.controls)&&(this.controls.length>0)){for(var b=0;b<this.controls.length;b++){if(((!this.controls[b].group)||(this.controls[b].group===""))&&(this.controls[b].CLASS_NAME)&&(this.controls[b].CLASS_NAME.toLowerCase().match("aw.ui.map.control"))){this.controls[b].setSize(this.controls[b].height,this.controls[b].width)}}}if(this.controlGroups){for(var a in this.controlGroups){this.controlGroups[a].setSize(this.controlGroups[a].height,this.controlGroups[a].width)}}if(this._map){this._map.updateSize();this._zoomToExtent()}this.triggerEvent("mapresized",this)},_triggerLayerChanged:function(a){if(a===true){this.triggerEvent("layerschanged",this.layers);return}if(this._layerChangedTimeout){clearTimeout(this._layerChangedTimeout);this._layerChangedTimeout=null}this._layerChangedTimeout=setTimeout(this._triggerLayerChanged.bind(this,true),30);this._persistLayerInfo()},_updateLayerDrawIndexes:function(d){if(this._updateLayerIndexTimeout){clearTimeout(this._updateLayerIndexTimeout);this._updateLayerIndexTimeout=null}if(d!==true){this._updateLayerIndexTimeout=setTimeout(this._updateLayerDrawIndexes.bind(this,true),500);return}var a=this.getAllLayers();if((!a)||(!a.length>0)){return}for(var b=a.length-1;b>=0;b--){a[b].setDrawIndex(b)}this._triggerLayerChanged()},_zoomToExtent:function(){if((this.isVisible()!==true)||(!this._mapBounds)){return}this._map.zoomToExtent(this._mapBounds);this._mapBounds=null},EVENTS:["activelayerchanged","controladded","controlremoved","controltoggled","layeradded","layerremoved","layerschanged","layerchanged","zoomchanged","moveend","mapresized"],VALID_PROPERTIES:["container","componentBus","height","width","minHeight","minWidth","layers","controls","inProj","outProj","maxExtent","service"],CLASS_NAME:"aw.ui.Map"});aw.ui.Map.ClickControl=OpenLayers.Class(OpenLayers.Control,{defaultHandlerOptions:{single:true,"double":false,pixelTolerance:0,stopSingle:false,stopDouble:false},callback:null,initialize:function(a){this.handlerOptions=OpenLayers.Util.extend({},this.defaultHandlerOptions);OpenLayers.Control.prototype.initialize.apply(this,arguments);this.handler=new OpenLayers.Handler.Click(this,{click:this.onclick},this.handlerOptions);this.inProj=((a)&&(a.inProj))?a.inProj:null;this.outProj=((a)&&(a.outProj))?a.outProj:null},activate:function(a){OpenLayers.Control.prototype.activate.apply(this);this.callback=a||null},onclick:function(a){if(this.callback){this.callback(this.map.getLonLatFromViewPortPx(a.xy).transform(this.outProj,this.inProj));this.callback=null}this.deactivate()}});aw.ui.Map.Layer=Class.create(aw.base,{active:false,attribution:null,disabled:false,drawPriority:-1,icon:null,key:null,label:"",labelControllable:false,labelField:null,labelTemplate:"",labelVisible:false,opacity:1,options:false,parameters:{},showInFeatures:true,showInLegend:false,sourceKey:null,sourcePool:null,status:"complete",style:{},visible:false,_drawIndex:0,_layerChangedTimeout:null,_layerObj:null,_map:null,_overrideStyle:false,initialize:function(b,a){this.active=false;this.attribution=null;this.disabled=false;this.drawPriority=-1;this.icon=null;this.key=this.getId("awml");this.label="";this.labelControllable=false;this.labelField=null;this.labelTemplate="";this.labelVisible=false;this.visible=false;this.opacity=1;this.options=false;this.parameters={};this.sourceKey=null;this.sourcePool=null;this.showInFeatures=true;this.showInLegend=false;this.status="complete";this.style={};this._drawIndex=0;this._layerObj=null;this._layerChangedTimeout=null;this._map=null;this._overrideStyle=false;aw.base.prototype.initialize.apply(this,arguments);this.setParameters({rt:"bc"})},complete:function(a){},destroy:function(){this._map=null;if(this._layerObj){this._layerObj.destroy()}this._layerObj=null;aw.base.prototype.destroy.apply(this)},getDrawIndex:function(){return this._drawIndex},getLayerInfo:function(){var a={key:this.key,type:this.CLASS_NAME,visibility:this.visible,disabled:this.disabled};if(this.labelControllable===true){a.labelField=this.labelField;a.labelVisible=this.labelVisible}return a},getLayerObject:function(){return this._layerObj||null},getParameter:function(a){return this.parameters[a]},getParameters:function(){return this.parameters||{}},getSourceUrl:function(b){if((!this._map)||(!this._map.componentBus)||(!this._map.componentBus.getMapSourcePool)||(!this._map.componentBus.getMapSourcePool(this.sourcePool||"default"))){return null}var a=this._map.componentBus.getMapSourcePool(this.sourcePool||"default");if(a){return(b===true)?a[0]:a}else{return null}},isComplete:function(){return true},redraw:function(){if((this._layerObj)&&(this._layerObj.redraw)){this._layerObj.redraw()}},request:function(a,e,b,d){if(this._map){this._map.request(a,e,b,d)}else{this.request.bind(this,a,e,b,d).delay(0.5)}},setActive:function(a){if(a===this.active){return}this.active=a;if(this._map){this._map._onActiveLayerChanged(this)}},setDisabled:function(a,b){a=(a===false)?false:true;if(a===this.disabled){return}this.disabled=a;if(b!==false){this.triggerEvent("layerchanged",this)}if(this._layerObj){this._layerObj.setVisibility((this.disabled===true)?false:this.visible)}},setDrawIndex:function(a){this._drawIndex=a;if((this._map)&&(this._layerObj)){this._map.setLayerIndex(this._layerObj,this._drawIndex)}},setLabelDisposition:function(){},setLabelField:function(b,a){if((b===this.labelField)&&this.isComplete()){return}this.labelField=b;if(a!==false){this.triggerEvent("layerchanged",this)}},setLabelVisibility:function(b,a){if((b===this.labelVisible)&&(this.isComplete()===true)){return}this.labelVisible=b;if(a!==false){this.triggerEvent("layerchanged",this)}},setLayerInfo:function(b){var a={labelField:((b)&&(b.labelField!=undefined))?b.labelField:this.labelField,labelVisible:((b)&&(b.labelVisible!=undefined))?b.labelVisible:this.labelVisible,visibility:((b)&&(b.visibility!=undefined))?b.visibility:this.visible,disabled:((b)&&(b.disabled!=undefined))?b.disabled:this.disabled};this.setLabelField(a.labelField,false);this.setLabelVisibility(a.labelVisible,false);this.setDisabled(a.disabled,false);this.setVisibility(a.visibility,false);this.triggerEvent("layerchanged",this)},setMap:function(a){if(!a){return}this._map=a;this._setSourceUrl();this._setApplicationKey()},setParameters:function(a,b){if(!a){return}if(b===false){this.parameters=a}else{Object.extend(this.parameters,a)}if((this._layerObj)&&(this._layerObj.params)){this._layerObj.params=this.parameters;this._redrawLayerObject()}},setSourcePool:function(a){this.sourcePool=a||"default";this._setSourceUrl()},setStatus:function(a){if((!a)||(!a.toLowerCase().match("complete|loading|corrupt"))||(this.status==a.toLowerCase())){return false}this.status=a.toLowerCase();this.triggerEvent("layerchanged",this);return true},setStyle:function(a){if(this._overrideStyle===true){this.style=Object.extend(a||{},this.style)}else{Object.extend(this.style,a)}this.triggerEvent("layerchanged",this)},setVisibility:function(a,b){a=(a===false)?false:true;if((a===this.visible)&&(this.isComplete()===true)){return}this.visible=a;if((this.isComplete()!==true)&&(this.visible===true)&&(this.disabled!==true)){this.complete(this._setVisibility.bind(this,b))}else{this._setVisibility(b)}},_redrawLayerObject:function(a){if(this._layerChangedTimeout){clearTimeout(this._layerChangedTimeout);this._layerChangedTimeout=null}if((a===true)&&(this._layerObj)){this._layerObj.redraw();return}this._layerChangedTimeout=setTimeout(this._redrawLayerObject.bind(this,true),300)},_setApplicationKey:function(){this.setParameters({akey:this._map.componentBus.getApplicationKey()})},_setSourceUrl:function(){var a=this.getSourceUrl();if((a)&&(this._layerObj)&&(this._layerObj.setUrl)){this._layerObj.setUrl(a)}},_setVisibility:function(a){if(a!==false){this.triggerEvent("layerchanged",this)}if((this._layerObj)&&(this.disabled!==true)){this._layerObj.setVisibility(this.visible)}},BUFFER:2,EVENTS:["layerchanged","layerschanged"],VALID_PROPERTIES:["key","label","labelTemplate","labelControllable","labelVisible","visible","disabled","options","parameters","sourceKey","sourcePool","opacity","icon","showInFeatures","showInLegend","drawPriority","attribution"],CLASS_NAME:"aw.ui.Map.Layer"});aw.ui.Map.Layer.Annotation=Class.create(aw.ui.Map.Layer,{annotations:[],ratio:2,_annotationsRetrieved:false,_bounds:null,_onmoveend_fx:null,_onzoomend_fx:null,_setBoundsTimeout:null,initialize:function(d,b){this.annotations=[];this.ratio=2;this._overrideStyle=true;var a={fontFamily:"arial",fontSize:"10pt",fontWeight:"normal",fontColor:"000000",fontStyle:"normal",fontDecoration:"none",mouseOver:false,icon:"aws:icon:server:Pushpin (Red).png",iconSize:"16x16"};if((d)&&(d.style)){Object.extend(a,d.style)}this._annotationsRetrieved=false;this._bounds=null;this._onmoveend_fx=null;this._onzoomend_fx=null;Object.extend(d,{style:a});aw.ui.Map.Layer.prototype.initialize.apply(this,[d,b]);this.showInLegend=true;this._layerObj=new OpenLayers.Layer.Markers(this.label)},clearAnnotations:function(){if(this._layerObj){this._layerObj.clearMarkers()}this._clearPopups()},complete:function(a){if(!this._map){return}this._annotationsRetrieved=false;this._retrieveAnnotations(a)},destroy:function(){if(this._map){if(this._onmoveend_fx){this._map.unregisterEvent("moveend",this._onmoveend_fx);this._onmoveend_fx=null}if(this._onzoomend_fx){this._map.unregisterEvent("zoomchanged",this._onzoomend_fx);this._onzoomend_fx=null}}aw.ui.Map.Layer.prototype.destroy.apply(this)},getVisibleAnnotations:function(){if(!this._map.getExtent()){return[]}var d=[];var e=this._map.getExtent().clone().transform(this._map.outProj,this._map.inProj).toBBOX().split(",");if((this.annotations)&&(this.annotations.length>0)){for(var b=0,a=this.annotations.length;b<a;b++){if((this.annotations[b].lat<e[3])&&(this.annotations[b].lat>e[1])&&(this.annotations[b].lon<e[2])&&(this.annotations[b].lon>e[0])){d.push(this.annotations[b])}}}return d},isComplete:function(){if(aw.ui.Map.Layer.prototype.isComplete.apply(this)!==true){return false}if(this._annotationsRetrieved!==true){return false}return true},redrawAnnotations:function(){this.clearAnnotations();if((this.annotations)&&(this.annotations.length>0)){for(var a=0;a<this.annotations.length;a++){this._drawAnnotation(this.annotations[a])}}},setMap:function(a){aw.ui.Map.Layer.prototype.setMap.apply(this,arguments);this.icon=new aw.Icon({src:this.style.icon,server:this._map.componentBus.getComponentServer(),skey:this._map.componentBus.getSessionKey(),akey:this._map.componentBus.getApplicationKey()}).toURL();this._setBounds(this._map.getExtent());this._onmoveend_fx=this._onMoveEnd.bind(this);this._onzoomend_fx=this._onZoomEnd.bind(this);this._map.registerEvent("moveend",this._onmoveend_fx);this._map.registerEvent("zoomchanged",this._onzoomend_fx)},setStyle:function(a){aw.ui.Map.Layer.prototype.setStyle.apply(this,arguments);this.redrawAnnotations()},_addPopup:function(a){this._map._map.addPopup(a,true)},_clearPopups:function(){if((!this._map)||(!this._map._map)){return}var b=this._map._map.popups;if((b)&&(b.length>0)){for(var a=0;a<b.length;a++){this._map._map.removePopup(b[a])}}},_drawAnnotation:function(e){var a=OpenLayers.Projection.transform(new OpenLayers.Geometry.Point(e.lon,e.lat),this._map.inProj,this._map.outProj);var k=new OpenLayers.LonLat(a.x,a.y);var d=Object.clone(this.style);if((e.style)&&(e.style!=="")){Object.extend(d,e.style)}var b=d.iconSize.split("x");var j={fontFamily:d.fontFamily,fontSize:d.fontSize,fontWeight:d.fontWeight,fontStyle:d.fontStyle,textDecoration:d.fontDecoration,color:"#"+d.fontColor};var g=new OpenLayers.Size(b[0],b[1]);var f=new OpenLayers.Icon(new aw.Icon({src:d.icon,server:this._map.componentBus.getComponentServer(),akey:this._map.componentBus.getApplicationKey(),skey:this._map.componentBus.getSessionKey()}).toURL(),g,new OpenLayers.Pixel(-(g.w/2),-g.h));var h=new OpenLayers.Marker.Label(k,f,e.label,{mouseOver:d.mouseOver});if(h){if(h.labelDiv){Element.setStyle(h.labelDiv,j)}h.events.register("markerclicked",this,this._onAnnotationClicked.bind(this,e));h.events.register("moveend",this,this._onAnnotationMoved.bind(this,e));h.events.register("movestart",this,this._clearPopups);this._layerObj.addMarker(h)}},_onAnnotationClicked:function(a,b){var e=new OpenLayers.Popup.Annotation(null,b.lonlat,"<h1>"+a.label+'</h1><div class="loading">Loading...</div>',b.icon);this._addPopup(e);if(this._map){var d=this._map.componentBus.getComponentReferences("aw.AnnotationManager");if((d)&&(d.length>0)){d[0].getAnnotationData(this.label,a,this._onAnnotationDataReceived.bind(this,a,e))}d=null}},_onAnnotationDataReceived:function(g,b,k){if((!g)||(!b)){return}var n=[];if((k)&&(k.length>0)){for(var l=0;l<k.length;l++){if(k[l].type=="1"){n.push("<p>"+k[l].value+"</p>")}}}var m=["<h1>"+g.label+"</h1>",n.join(""),'<div class="actions"></div>'];b.setContentHTML(m.join(""));if(b.contentDiv){var f=[{label:"Edit",callback:this._onEditAnnotationClick.bind(this,g)},{label:"Delete",callback:this._onDeleteAnnotationClick.bind(this,g)}];var d=Element.down(b.contentDiv,"div.actions");if(d){var a=null,e=null;for(var h=f.length;h>=1;h--){new aw.ui.Control.Button({label:f[h-1].label,container:d},{click:f[h-1].callback})}}}},_onAnnotationMoved:function(a,b){var d=OpenLayers.Projection.transform(new OpenLayers.Geometry.Point(b.lonlat.lon,b.lonlat.lat),this._map.outProj,this._map.inProj);this.triggerEvent("annotationmoved",this,a,{lat:d.y,lon:d.x})},_onAnnotationsReceived:function(d,b){this.clearAnnotations();if(b){Object.extend(this.style,b.style);if(this._map){this.icon=new aw.Icon({src:this.style.icon,server:this._map.componentBus.getComponentServer(),skey:this._map.componentBus.getSessionKey(),akey:this._map.componentBus.getApplicationKey()}).toURL()}}if((b)&&(b.annotations)){this.annotations=b.annotations;for(var a=0;a<this.annotations.length;a++){this._drawAnnotation(this.annotations[a])}}this._annotationsRetrieved=true;if(d){d()}this.setStatus("complete");this.triggerEvent("onannotationsrendered",this)},_onDeleteAnnotationClick:function(a){this._clearPopups();this.triggerEvent("onannotationdeleteclick",a,this)},_onEditAnnotationClick:function(a){this._clearPopups();this.triggerEvent("onannotationeditclick",a,this)},_onMoveEnd:function(a){this._setBounds(a)},_onZoomEnd:function(){this._bounds=null;this._setBounds()},_retrieveAnnotations:function(d){if(!this._bounds){return}var b=this._bounds.clone().transform(this._map.outProj,this._map.inProj).toBBOX().split(",");if(this._map){var a=this._map.componentBus.getComponentReferences("aw.AnnotationManager");if((a)&&(a.length>0)){this.setStatus("loading");a[0].getAnnotationsBySetName(this.label,b[0],b[1],b[2],b[3],this._onAnnotationsReceived.bind(this,d))}a=null}},_setBounds:function(d,f){if(this._setBoundsTimeout){clearTimeout(this._setBoundsTimeout);this._setBoundsTimeout=null}if(f!==true){this._setBoundsTimeout=setTimeout(this._setBounds.bind(this,d,true),500);return}d=d||this._map.getExtent();var e=false;if(d){var a=d.getCenterLonLat();var h=d.getWidth()*(this.ratio||2);var b=d.getHeight()*(this.ratio||2);var g=new OpenLayers.Bounds(a.lon-(h/2),a.lat-(b/2),a.lon+(h/2),a.lat+(b/2));if(this._bounds){if(this._bounds.containsBounds(d)!==true){this._bounds=g;e=true}}else{this._bounds=g;e=true}}if(e===true){this._annotationsRetrieved=false;if((this.visible===true)&&(this.disabled!==true)){this._retrieveAnnotations()}}},EVENTS:["layerchanged","annotationmoved","onannotationsrendered","onannotationdeleteclick","onannotationeditclick"],VALID_PROPERTIES:["key","label","visible","disabled","parameters","sourcePool","opacity","icon","showInFeatures","showInLegend","drawPriority","annotations","ratio","style"],CLASS_NAME:"aw.ui.Map.Layer.Annotation"});aw.ui.Map.Layer.Bing=Class.create(aw.ui.Map.Layer,{initialize:function(b,a){aw.ui.Map.Layer.prototype.initialize.apply(this,arguments);this._layerObj=new OpenLayers.Layer.Bing({key:"Aqzca9ch19ptuRfBfa3Qk7tKYRs58eo3xKpM06dxJcPyOJPx2tUd1wZeycSF-Evu",type:"Road"})},CLASS_NAME:"aw.ui.Map.Layer.Bing"});aw.ui.Map.Layer.CustomPolygonSet=Class.create(aw.ui.Map.Layer,{_renderKey:null,initialize:function(b,a){this._renderKey=null;Object.extend(b,{opacity:0.6});aw.ui.Map.Layer.prototype.initialize.apply(this,[b,a]);this.labelControllable=true;this.labelTemplate="CustomPolygonLabel";this.showInLegend=true;this._layerObj=new OpenLayers.Layer.SRCMapServer(this.label,null,this.getParameters(),{isBaseLayer:false,opacity:this.opacity,visibility:this.visible});this.setParameters({service:"selection",lt:"MS_LAYER_POLYGON",fillc:this.getParameter("fillc")||aw.Color.random(),outw:this.getParameter("outw")||"3",outc:this.getParameter("outc")||"000000"})},complete:function(d){if(!this._map){return}var b=this.getSourceUrl(true);if(!b){return}this.setStatus("loading");this._renderKey=null;var a={cn:"MapHandler",service:"setUserLayer",userLayer:this.label,userLayerDatatype:"CustomPolygon"};this.request(a,this._onKeyReceived.bind(this,d),b)},getLayerInfo:function(){var a=aw.ui.Map.Layer.prototype.getLayerInfo.apply(this);Object.extend(a,{fillc:this.getParameter("fillc"),outw:this.getParameter("outw"),outc:this.getParameter("outc")});return a},isComplete:function(){if(aw.ui.Map.Layer.prototype.isComplete.apply(this)!==true){return false}if((!this._renderKey)||(this._renderKey==="")){return false}return true},setLayerInfo:function(a){if(a){this.setParameters({fillc:a.fillc,outw:a.outw,outc:a.outc})}aw.ui.Map.Layer.prototype.setLayerInfo.apply(this,arguments)},_onKeyReceived:function(d,a,b){if((b)&&(b.payload)&&(b.payload.userLayerKey)){this._setRenderKey(b.payload.userLayerKey)}if(d){d()}this.setStatus("complete")},_setRenderKey:function(a){this.sourceKey=a;this._renderKey=a;this.setParameters({gkey:this._renderKey});this.redraw()},CLASS_NAME:"aw.ui.Map.Layer.CustomPolygonSet"});aw.ui.Map.Layer.GeographySelection=Class.create(aw.ui.Map.Layer,{geoCollection:null,labelControllable:true,labelTemplate:"",labelVisible:false,sourceKey:null,_filterKey:null,_geographyKey:null,_setgeographycollection_fx:null,initialize:function(b,a){this.geoCollection=null;this.labelControllable=true;this.labelTemplate="GeographySelectionLabel";this.labelVisible=false;this.sourceKey=null;this._filterKey=null;this._geographyKey=null;this._setgeographycollection_fx=null;aw.ui.Map.Layer.prototype.initialize.apply(this,[b,a]);this.key="geographyselection";if((!this.label)||(this.label==="")){this.label="Geography Selection"}this._layerObj=new OpenLayers.Layer.SRCMapServer(this.label,null,this.getParameters(),{opacity:this.opacity,visibility:this.visible});this.setParameters({service:this.getParameter("service")||"selection",lt:"MS_LAYER_POLYGON",rt:"bc"})},complete:function(h){if(!this._map){return}var d=this.getSourceUrl(true);if(!d){return}var f=[];var g=[];if((this.geoCollection)&&(this.geoCollection.geos)&&(this.geoCollection.geos.length>0)){var e=null;for(var a=0;e=this.geoCollection.geos[a];a++){if(e.CLASS_NAME.toLowerCase().match("aw.geography.standard")){f.push(e.getGeographyDefinition().replace(/^Geography\(|\)$/gi,"").replace(/^\s*|\s*$/gi,"").replace(/\s*,\s*/,"|"))}else{g.push(e._serverGuid+"|"+e._serverUser)}}var b={cn:"MapHandler",service:"setFilter",sl:(this.getParameter("service")||"selection")};if(f.length>0){Object.extend(b,{f:f})}if(g.length>0){Object.extend(b,{g:g})}this._geographyKey=null;this._filterKey=null;this.setStatus("loading");this.request(b,this._onKeyReceived.bind(this,h),d)}},destroy:function(){if((this._map)&&(this._map.componentBus)){this._map.componentBus.getComponentReferences("aw.GeographyManager",function(a){if((a)&&(a.length>0)){a[0].unregisterEvent("onactivegeographychanged",this._setgeographycollection_fx);this._setgeographycollection_fx=null}}.bind(this))}aw.ui.Map.Layer.prototype.destroy.apply(this)},isComplete:function(){if(aw.ui.Map.Layer.prototype.isComplete.apply(this)!==true){return false}if((!this.geoCollection)||((!this._filterKey)&&(!this._geographyKey))){return false}return true},setGeographyCollection:function(a){if((!a)||(!a.geos)||(!a.geos.length>0)){return}this.geoCollection=a;this._filterKey=null;this._geographyKey=null;if(this.visible===true){this.complete(this.redraw.bind(this))}},setLabelDisposition:function(){this.sourceKey=(this._filterKey)?this._filterKey:this._geographyKey},setMap:function(a){aw.ui.Map.Layer.prototype.setMap.apply(this,arguments);if((this._map)&&(this._map.componentBus)){this._map.componentBus.getComponentReferences("aw.GeographyManager",function(b){if((b)&&(b.length>0)){this._setgeographycollection_fx=this.setGeographyCollection.bind(this);b[0].registerEvent("onactivegeographychanged",this._setgeographycollection_fx);if(b[0].activeGeography){this.setGeographyCollection(b[0].activeGeography)}}}.bind(this))}},_onKeyReceived:function(f,a,d){if((d)&&(d.payload)){this._geographyKey=(d.payload.geographyKey)?d.payload.geographyKey:null;this._filterKey=(d.payload.filterKey)?d.payload.filterKey:null;var b={fkey:null,gkey:null};if(this._geographyKey){var e=((this.geoCollection)&&(this.geoCollection.contains("aw.Geography.Custom")))?true:false;Object.extend(b,{gkey:this._geographyKey,fillc:(e===true)?"800000":"",outw:"3",outc:"000000"});this.icon="./core/img/Map/Layer/GeographySelection/"+((e===true)?"polygon":"radii.png")}if(this._filterKey){Object.extend(b,{fkey:this._filterKey,fillc:"800000",outw:"3",outc:"000000"});this.icon="./core/img/Map/Layer/GeographySelection/polygon.png"}this.setParameters(b);this.setLabelDisposition();this.redraw()}if(f){f()}this.setStatus("complete")},_setFilterKey:function(a){this._geographyKey=null;this._filterKey=a;this.setParameters({fkey:a,gkey:null,fillc:"800000",outw:"3",outc:"000000"});this.icon="./core/img/Map/Layer/GeographySelection/polygon.png";this.redraw()},_setGeographyKey:function(a){this._geographyKey=a;this._filterKey=null;var b=((this.geoCollection)&&(this.geoCollection.contains("aw.Geography.Custom")))?true:false;this.setParameters({fkey:null,gkey:a,fillc:(b===true)?"800000":"",outw:"3",outc:"000000"});this.icon="./core/img/Map/Layer/GeographySelection/"+((b===true)?"polygon":"radii.png");this.redraw()},VALID_PROPERTIES:["drawPriority","labelControllable","labelTemplate","labelVisible","opacity","showInLegend","visible"],CLASS_NAME:"aw.ui.Map.Layer.GeographySelection"});aw.ui.Map.Layer.Google=Class.create(aw.ui.Map.Layer,{initialize:function(b,a){aw.ui.Map.Layer.prototype.initialize.apply(this,arguments);this._layerObj=new OpenLayers.Layer.Google(this.label,{sphericalMercator:true})},setMap:function(a){aw.ui.Map.Layer.prototype.setMap.apply(this,[a]);if(this._map){this._map.registerEvent("mapresized",this._onMapResized.bind(this))}},_onMapResized:function(){if((this._layerObj)&&(this._layerObj.onMapResize)){this._layerObj.onMapResize()}},CLASS_NAME:"aw.ui.Map.Layer.Google"});aw.ui.Map.Layer.Group=Class.create(aw.ui.Map.Layer,{aggregate:false,collapsed:false,layers:[],_setLayerInfoTimeout:null,initialize:function(b,a){this.aggregate=false;this.collapsed=false;this.layers=[];this._setLayerInfoTimeout=null;Object.extend(b,{icon:"./core/img/Map/Layer/group.png"});aw.ui.Map.Layer.prototype.initialize.apply(this,[b,a]);if(this.aggregate===true){this._renderKey=null;this._layerObj=new OpenLayers.Layer.SRCMapServer(this.label,null,this.getParameters(),{isBaseLayer:false,opacity:this.opacity,visibility:this.visible});this.setParameters({service:"aggregate"})}},addLayer:function(a){if(this.aggregate===true){a.registerEvent("layerchanged",this._onLayerChanged.bind(this));if(a._layerObj){a._layerObj.destroy();a._layerObj=null}}this.layers.push(a);this._map._addLayer(a);if((this.visible!==true)||(this.disabled===true)){a.setDisabled(true)}return a},complete:function(e){if(this.aggregate===true){if(!this._map){return}var b=this.getSourceUrl(true);var d=this._compileLayerInfo(this.layers);if(!b){return}if(d===null){if((this._layerObj)&&(this.disabled!==true)){this._layerObj.setVisibility(false)}return}var a={cn:"MapHandler",service:"setLayer",content:Object.toJSON(d)}}},getLayerBy:function(f){if((!f)||(!this.layers)||(!this.layers.length>0)){return null}var d=null;var e=true;for(var b=0;d=this.layers[b];b++){e=true;for(var a in f){if(d[a]!==f[a]){e=false}}if(e===true){return d}}return null},getLayerByKey:function(a){return this.getLayerBy({key:a})},getLayerInfo:function(){var a=aw.ui.Map.Layer.prototype.getLayerInfo.apply(this);a.collapsed=this.collapsed;return a},isComplete:function(){if(this.aggregate===true){if(aw.ui.Map.Layer.prototype.isComplete.apply(this)!==true){return false}if((!this._renderKey)||(this._renderKey==="")){return false}return true}else{return aw.ui.Map.Layer.prototype.isComplete.apply(this)}},removeAllLayers:function(){if((!this.layers)||(!this.layers.length>0)){return}for(var a=0;a<this.layers.length;a++){this._map.removeLayer(this.layers[a])}this.layers=[]},removeLayer:function(b){if((!b)||(!this.layers)||(!this.layers.length>0)){return}var e=[],d=false;for(var a=0;a<this.layers.length;a++){if(this.layers[a]===b){d=true}else{e.push(this.layers[a])}}if(d===true){this.layers=e;this._map.removeLayer(b)}},removeLayerByKey:function(a){this.removeLayer(this.getLayerByKey(a))},setDisabled:function(d,e){aw.ui.Map.Layer.prototype.setDisabled.apply(this,arguments);if((this.layers)&&(this.layers.length>0)){for(var b=0,a=this.layers.length;b<a;b++){this.layers[b].setDisabled(this.disabled)}}},setLayerInfo:function(a){if(a){this.collapsed=(a.collapsed===true)?true:false}aw.ui.Map.Layer.prototype.setLayerInfo.apply(this,arguments)},setVisibility:function(b){aw.ui.Map.Layer.prototype.setVisibility.apply(this,arguments);if((this.layers)&&(this.layers.length>0)){for(var d=0,a=this.layers.length;d<a;d++){this.layers[d].setDisabled(!this.visible)}}},_compileLayerInfo:function(f){if((!f)||(!f.length>0)){return null}var a=[],e,d=null;for(var b=0;b<f.length;b++){if((f[b].isComplete())&&(f[b].visible===true)&&(f[b].disabled!==true)){e=f[b].getParameters();e.opacity=f[b].opacity;a.push(e)}if((f[b].layers)&&(f[b].layers.length>0)){d=this._compileLayerInfo(f[b].layers);if((d)&&(d.length>0)){if(a.length<1){a=d}else{a=a.concat(d)}}}}return(a.length>0)?a:null},_onKeyReceived:function(d,a,b){if((b)&&(b.payload)&&(b.payload.layerKey)){this._setRenderKey(b.payload.layerKey)}if((this._layerObj)&&(this.disabled!==true)){this._layerObj.setVisibility(true)}if(d){d()}},_setRenderKey:function(a){this._renderKey=a;this.setParameters({lkey:this._renderKey});this.redraw()},_onLayerChanged:function(){this._setLayerInfo()},_setLayerInfo:function(a){if(this._setLayerInfoTimeout){clearTimeout(this._setLayerInfoTimeout);this._setLayerInfoTimeout=null}if(a!==true){this._setLayerInfoTimeout=setTimeout(this._setLayerInfo.bind(this,true),400);return}this._renderKey=null;if((this.visible===true)&&(this.disabled!==true)){this.complete()}},VALID_PROPERTIES:["key","label","visible","disabled","layers","icon","showInLegend","drawPriority","aggregate","collapsed"],CLASS_NAME:"aw.ui.Map.Layer.Group"});aw.ui.Map.Layer.Label=Class.create(aw.ui.Map.Layer,{_renderKey:null,_setLabelInfoTimeout:null,initialize:function(b,a){aw.ui.Map.Layer.prototype.initialize.apply(this,arguments);this._renderKey=null;this._setLabelInfoTimeout=null;this.showInFeatures=false;this._layerObj=new OpenLayers.Layer.SRCMapServer(this.label,null,this.getParameters(),{isBaseLayer:false,singleTile:true,ratio:1.5,opacity:this.opacity,visibility:this.visible});this.setParameters({service:"label"})},complete:function(e){if(!this._map){return}var d=this.getSourceUrl(true);var a=this._compileLabelInfo(this._map.layers);if(!d){return}if(a===null){if((this._layerObj)&&(this.disabled!==true)){this._layerObj.setVisibility(false)}return}var b={cn:"MapHandler",service:"setLabel",content:this._serializeLabelInfo(a)};this.request(b,this._onKeyReceived.bind(this,e),d)},isComplete:function(){if(aw.ui.Map.Layer.prototype.isComplete.apply(this)!==true){return false}if((!this._renderKey)||(this._renderKey==="")){return false}return true},setLabelInfo:function(){this._setLabelInfo()},setMap:function(a){aw.ui.Map.Layer.prototype.setMap.apply(this,[a]);if(this._map){this._map.registerEvent("layerchanged",this._onLayerChanged.bind(this));this._map.registerEvent("mapresized",this._onMapResized.bind(this))}},_compileLabelInfo:function(e){var d=[],b=null;if((!e)||(!e.length>0)){return d}for(var a=0;a<e.length;a++){if((e[a].labelControllable===true)&&(e[a].isComplete()===true)&&(e[a].visible===true)&&(e[a].labelVisible===true)&&(e[a].disabled!==true)){d.push({template:e[a].labelTemplate,source:e[a].sourceKey,field:e[a].labelField,on:e[a].labelVisible})}if((e[a].layers)&&(e[a].layers.length>0)){b=this._compileLabelInfo(e[a].layers);if((b)&&(b.length>0)){if(d.length<1){d=b}else{d=d.concat(b)}}}}return(d.length>0)?d:null},_onKeyReceived:function(d,a,b){if((b)&&(b.payload)&&(b.payload.labelKey)){this._setRenderKey(b.payload.labelKey)}if((this._layerObj)&&(this.disabled!==true)){this._layerObj.setVisibility(true)}if(d){d()}},_onLayerChanged:function(a){if((a.id===this.id)||(a.labelControllable!==true)){return}this.setLabelInfo()},_onMapResized:function(){if((this._layerObj)&&(this._layerObj.onMapResize)){this._layerObj.onMapResize()}this.redraw()},_setLabelInfo:function(a){if(this._setLabelInfoTimeout){clearTimeout(this._setLabelInfoTimeout);this._setLabelInfoTimeout=null}if(a!==true){this._setLabelInfoTimeout=setTimeout(this._setLabelInfo.bind(this,true),400);return}this._renderKey=null;if(this.visible===true){this.complete()}},_serializeLabelInfo:function(a){if(a instanceof String){return a}return Object.toJSON(a)},_setRenderKey:function(a){this._renderKey=a;this.setParameters({lkey:this._renderKey});this.redraw()},CLASS_NAME:"aw.ui.Map.Layer.Label"});aw.ui.Map.Layer.Point=Class.create(aw.ui.Map.Layer,{initialize:function(b,a){aw.ui.Map.Layer.prototype.initialize.apply(this,arguments);this.showInLegend=true;this._layerObj=new OpenLayers.Layer.SRCMapServer(this.label,null,this.getParameters(),{isBaseLayer:false,opacity:1,visibility:this.visible});this.setParameters({lt:"MS_LAYER_POINT",symsz:7})},CLASS_NAME:"aw.ui.Map.Layer.Point"});aw.ui.Map.Layer.Point.LocationFile=Class.create(aw.ui.Map.Layer.Point,{labelControllable:true,labelTemplate:"",labelVisible:false,options:true,sourceKey:null,_renderKey:null,initialize:function(b,a){this.labelControllable=true;this.labelTemplate="UserLocationLabel";this.labelVisible=false;this.options=true;this.sourceKey=null;this._renderKey=null;aw.ui.Map.Layer.Point.prototype.initialize.apply(this,arguments);this.setParameters({service:"selection",fillc:this.getParameter("fillc")||aw.Color.random(),outw:this.getParameter("outw")||"2",outc:this.getParameter("outc")||"000000"})},complete:function(d){if(!this._map){return}var b=this.getSourceUrl(true);if(!b){return}this.setStatus("loading");var a={cn:"MapHandler",service:"setUserLayer",userLayer:this.label,userLayerDatatype:"UserLocationFile"};this.request(a,this._onKeyReceived.bind(this,d),b)},getLayerInfo:function(){var a=aw.ui.Map.Layer.Point.prototype.getLayerInfo.apply(this);Object.extend(a,{fillc:this.getParameter("fillc"),outw:this.getParameter("outw"),outc:this.getParameter("outc")});return a},isComplete:function(){if(aw.ui.Map.Layer.Point.prototype.isComplete.apply(this)!==true){return false}if((!this._renderKey)||(this._renderKey==="")){return false}return true},setLabelDisposition:function(){this.sourceKey=this._renderKey},setLayerInfo:function(a){if(a){this.setParameters({fillc:a.fillc,outw:a.outw,outc:a.outc})}aw.ui.Map.Layer.Point.prototype.setLayerInfo.apply(this,arguments)},_onKeyReceived:function(d,a,b){if((b)&&(b.payload)&&(b.payload.userLayerKey)){this._setRenderKey(b.payload.userLayerKey)}this.setLabelDisposition();if(d){d()}this.setStatus("complete")},_setRenderKey:function(a){this._renderKey=a;this.setParameters({gkey:this._renderKey});this.redraw()},VALID_PROPERTIES:["key","label","labelControllable","labelTemplate","labelVisible","visible","disabled","options","parameters","sourcePool","opacity","icon","showInLegend","drawPriority"],CLASS_NAME:"aw.ui.Map.Layer.Point.LocationFile"});aw.ui.Map.Layer.Point.Query=Class.create(aw.ui.Map.Layer.Point,{dataset:null,geoCollection:null,labelControllable:true,labelTemplate:"",labelVisible:false,query:null,options:true,sourceKey:null,_queryBuilt:false,_renderKey:null,initialize:function(b,a){this.dataset=null;this.geoCollection=null;this.labelControllable=true;this.labelTemplate="";this.labelVisible=false;this.options=true;this.query=null;this.sourceKey=null;this._queryBuilt=false;this._renderKey=null;aw.ui.Map.Layer.Point.prototype.initialize.apply(this,arguments);this.setParameters({service:"selection",fillc:this.getParameter("fillc")||aw.Color.random(),outw:this.getParameter("outw")||"2",outc:this.getParameter("outc")||"000000"})},complete:function(d){if(!this._map){return}var b=this.getSourceUrl(true);if(!b){return}this.setStatus("loading");var a=null;if(this._queryBuilt!==true){a={cn:"SRC.Web.Client.Handler.CalgaryHandler|"+this.dataset,service:"buildCalgaryQuery",query:this.query};Object.extend(a,this.geoCollection);this.request(a,function(g,e,f){this.query=f.payload.query;this._queryBuilt=true;this.complete(g)}.bind(this,d));return}a={cn:"MapHandler",service:"setCalgaryFilter",db:this.dataset,query:this.query};this.request(a,this._onKeyReceived.bind(this,d),b)},getLayerInfo:function(){var a=aw.ui.Map.Layer.Point.prototype.getLayerInfo.apply(this);Object.extend(a,{fillc:this.getParameter("fillc"),outw:this.getParameter("outw"),outc:this.getParameter("outc")});return a},isComplete:function(){if(aw.ui.Map.Layer.Point.prototype.isComplete.apply(this)!==true){return false}if((!this._renderKey)||(this._renderKey==="")){return false}return true},setDataset:function(a){if(!a){return}this.dataset=a},setGeoCollection:function(a){this.geoCollection=a;this._queryBuilt=false;this._renderKey=null},setLabelDisposition:function(){this.sourceKey=this._renderKey},setLayerInfo:function(a){if(a){this.setParameters({fillc:a.fillc,outw:a.outw,outc:a.outc})}aw.ui.Map.Layer.Point.prototype.setLayerInfo.apply(this,arguments)},setQuery:function(a){if(!a){return}this.query=a;this._queryBuilt=false;this._renderKey=null;if(this.visible===true){this.complete()}},_onKeyReceived:function(d,a,b){if((b)&&(b.payload)&&(b.payload.calgaryKey)){this._setRenderKey(b.payload.calgaryKey)}this.setLabelDisposition();if(d){d()}this.setStatus("complete")},_setRenderKey:function(a){this._renderKey=a;this.setParameters({ckey:this._renderKey});this.redraw()},VALID_PROPERTIES:["key","label","labelTemplate","labelControllable","labelVisible","visible","disabled","parameters","sourcePool","opacity","options","icon","dataset","query","geoCollection","showInLegend","drawPriority"],CLASS_NAME:"aw.ui.Map.Layer.Point.Query"});aw.ui.Map.Layer.Static=Class.create(aw.ui.Map.Layer,{initialize:function(b,a){aw.ui.Map.Layer.prototype.initialize.apply(this,arguments);this._layerObj=new OpenLayers.Layer.SRCMapServer(this.label,null,this.getParameters(),{opacity:this.opacity,visibility:this.visible,attribution:this.attribution})},CLASS_NAME:"aw.ui.Map.Layer.Static"});aw.ui.Map.Layer.Thematic=Class.create(aw.ui.Map.Layer,{active:false,colors:[],cutoffs:[],dataset:{},name:null,palette:null,variable:{},geography:{},_saveThematicTimeout:null,_thematicKey:null,_variableChanged:false,initialize:function(b,a){this.active=false;this.colors=[];this.cutoffs=[];this.dataset={};this.name=null;this.palette=null;this.variable={};this.geography={};this._saveThematicTimeout=null;this._thematicKey=((b)&&(b.key))?b.key:null;this._variableChanged=false;Object.extend(b,{icon:"./core/img/Map/Layer/thematic.png"});aw.ui.Map.Layer.prototype.initialize.apply(this,[b,a]);this.showInLegend=true;if((!this.label)||(this.label==="")){this.label="Thematic Layer"}this.setParameters({service:"theme",ds:(this.dataset)?this.dataset.key:null,layer:(this.geography)?this.geography.geography:null,themeVar:(this.variable)?this.variable.variableKey:null,themeColor:this.colors,themeRange:this.ranges,lt:"MS_LAYER_POLYGON"});this._layerObj=new OpenLayers.Layer.SRCMapServer(this.label,null,this.getParameters(),{opacity:this.opacity,visibility:this.visible})},complete:function(a){if(!this._map){return}this.setStatus("loading")},getRanges:function(){if((!this.colors)||(!this.colors.length>0)||(!this.cutoffs)||(!this.cutoffs.length>0)||(this.colors.length!=this.cutoffs.length+1)){return null}var a=[];for(var b=0;b<this.cutoffs.length;b++){if(b===0){a.push({color:this.colors[b],min:this.cutoffs[b],max:null,label:"Above "+parseFloat(this.cutoffs[b]).addCommas()})}if(b==this.cutoffs.length-1){a.push({color:this.colors[b+1],min:null,max:this.cutoffs[b],label:"Below "+parseFloat(this.cutoffs[b]).addCommas()})}else{a.push({color:this.colors[b+1],min:this.cutoffs[b+1],max:this.cutoffs[b],label:parseFloat(this.cutoffs[b+1]).addCommas()+" to "+parseFloat(this.cutoffs[b]).addCommas()})}}return a},isComplete:function(){if(aw.ui.Map.Layer.prototype.isComplete.apply(this)!==true){return false}if((!this.dataset)||(!this.geography)||(!this.geography.geography)||(!this.variable)||(!this.variable.variableKey)||(!this.colors)||(!this.colors.length>0)||(!this.cutoffs)||(!this.cutoffs.length>0)||(this.colors.length!=this.cutoffs.length+1)){return false}this._saveThematicLayer();return true},setColors:function(a){if(!a){return}if((this.cutoffs)&&(a)&&(this.cutoffs.length+1!=a.length)){this._getColorRamp(a)}this.colors=a;this.setParameters({themeColor:this.colors});this._complete()},setCutoffs:function(a){this.cutoffs=a;this.setParameters({themeRange:this.cutoffs});this.setColors(this.colors);this._complete()},setDataset:function(a){this.dataset=a},setGeography:function(a){if(!a){return}if((!this.geography)||(a.geography!=this.geography.geography)||(!this.cutoffs)||(!this.cutoffs.length>0)){this._getCutoffs(a,this.variable,"geography")}this.geography=a;this.setParameters({layer:this.geography.geography});this._complete()},setPalette:function(a){this.palette=a},setVariable:function(a){if(!a){return}if((!this.variable)||(a.variableKey!=this.variable.variableKey)||(!this.cutoffs)||(!this.cutoffs.length>0)){this._getCutoffs(this.geography,a,"variable")}this.variable=a;this.setParameters({themeVar:this.variable.variableKey});this._complete();this._variableChanged=true},_complete:function(){if(this.isComplete()===true){this.setStatus("complete");if(this.visible===true){this._setVisibility()}this.redraw()}},_getColorRamp:function(a){if((!a)||(a.length<2)||(!this.dataset)||(!this.cutoffs)||(!this.cutoffs.length>0)){return}if((a===this.colors)&&(a.length==this.cutoffs.length+1)){return}this.colors=[];this.setStatus("loading");var b={cn:"SRC.Web.Client.Handler.MapUIHandler|"+this.dataset.variant,service:"getColorRamp",colors:a,n:this.cutoffs.length+1};this.request(b,function(d,e){if((!e)||(!e.payload)||(!e.payload.colors)){return}this.setColors(e.payload.colors)}.bind(this))},_getCutoffs:function(b,a,e){if((!b)||(!b.geography)||(!a)||(!a.variableKey)||(!this.dataset)){return}if((this.geography)&&(this.geography.geography==b.geography)&&(this.variable)&&(this.variable.variableKey==a.variableKey)){return}this.cutoffs=[];this.setStatus("loading");var d={cn:"SRC.Web.Client.Handler.AllocateHandler|"+this.dataset.variant,service:"getThematicRanges",sgn:b.geography,varKey:a.variableKey,n:"4"};this.request(d,function(f,g){if((!g)||(!g.payload)||(!g.payload.breaks)){return}this.setCutoffs(g.payload.breaks.reverse())}.bind(this))},_saveThematicLayer:function(b){if((!this._map)||(this._map.isSessionValidated()!==true)){return}if(this._saveThematicTimeout){clearTimeout(this._saveThematicTimeout);this._saveThematicTimeout=null}if(b!==true){this._saveThematicTimeout=setTimeout(this._saveThematicLayer.bind(this,true),5000);return}var a={cn:"SRC.Web.Client.Handler.MapUIHandler|"+this.dataset.variant,service:"setThematic",key:this._thematicKey,name:this.name,active:this.active,visible:this.visible,variable:this.variable.variableKey,geography:this.geography.geography,ranges:this.cutoffs.join(","),palette:this.palette,colors:this.colors.join(","),dataset:this.dataset.key};if(this._variableChanged){Object.extend(a,{action:"variables"});this._variableChanged=false}this.request(a,function(d,e){if((!e)||(!e.payload)||(!e.payload.key)){return}this._thematicKey=e.payload.key}.bind(this))},VALID_PROPERTIES:["key","label","visible","disabled","parameters","sourcePool","opacity","palette","colors","cutoffs","dataset","variable","geography","ranges","name","active","showInLegend","drawPriority","icon"],CLASS_NAME:"aw.ui.Map.Layer.Thematic"});aw.ui.Menu=Class.create(aw.ui,{_onclick_fx:null,initialize:function(b,a){this._onclick_fx=this._onclick.bind(this);aw.ui.prototype.initialize.apply(this,arguments)},draw:function(){aw.ui.prototype.draw.apply(this);this.canvas.insert(this._buildMenuFragments(this.items));aw.EventManager.register(this.canvas,"click",this._onclick_fx);return this.canvas},_buildMenuFragments:function(b){if((!b)||(!b.length>0)){return null}var e=["<ul>"],d=null,a=null;for(var f=0;f<b.length;f++){b[f].key=b[f].key||this.getId("awmi");a=[];if((b[f].items)&&(b[f].items.length>0)){a.push("branch")}if(b[f].cssClass){a.push(b[f].cssClass)}e.push('<li key="'+b[f].key+'"'+((a.length>0)?(' class="'+a.join(" ")+'"'):"")+((b[f].icon)?(" style=\"background-image: url('"+b[f].icon+"');\""):"")+">");d="<span>"+b[f].label+"</span>";if((b[f].url)&&(b[f].url!=="")){d='<a href="'+b[f].url+'">'+d+"</a>"}e.push(d);if((b[f].items)&&(b[f].items.length>0)){e.push(this._buildMenuFragments(b[f].items))}e.push("</li>")}e.push("</ul>");return e.join("")},_getMenuItemByKey:function(d,a){a=a||this.items;if((!a)||(!a.length>0)){return null}for(var b=0;b<a.length;b++){if(a[b].key==d){return a[b]}if((a[b].items)&&(a[b].items.length>0)&&(this._getMenuItemByKey(d,a[b].items))){return this._getMenuItemByKey(d,a[b].items)}}return null},_onclick:function(g){var f=aw.EventManager.getEvent(g);var a=f.target;if(!a){return}var d=a.getAttribute("key");if((!d)||(d==="")){return}var b=this._getMenuItemByKey(d);if((b)&&(b.click)){b.click()}},VALID_PROPERTIES:["container","cssClass","componentBus","inheritCSS","items"],CLASS_NAME:"aw.ui.Menu"});aw.ui.Panel=Class.create(aw.ui.Container,{childMinWidth:null,childMinHeight:null,closeable:false,disabled:false,helpCallback:null,hideable:false,icon:null,minWidth:null,minHeight:null,overlay:false,showBgd:true,title:"",titleVisibility:true,_contentsDOM:null,_mousemove_fx:null,_mousedown_fx:null,_mouseup_fx:null,_onCloseClick_fx:null,_selectStart_fx:null,_ghostPanel:null,_titleBarDOM:null,_constraints:null,initialize:function(b,a){this.title="";this.titleVisibility=true;this.minWidth=0;this.minHeight=0;this.helpCallback=null;this.childMinWidth=0;this.childMinHeight=0;this.closeable=false;this.disabled=false;this.hideable=false;this.icon=null;this._constraints={t:0,r:0,b:0,l:0};this._contentsDOM=null;this._mousemove_fx=null;this._mousedown_fx=this._onmousedown.bind(this);this._mouseup_fx=null;this._onCloseClick_fx=null;this._selectStart_fx=null;this._ghostPanel=null;this._titleBarDOM=null;aw.ui.Container.prototype.initialize.apply(this,arguments)},add:function(a){if(this.orientation=="vertical"){this.childMinHeight+=Math.max(parseInt(a.minHeight||0,10),parseInt(a.childMinHeight||0,10))}else{if(this.orientation=="horizontal"){this.childMinWidth+=Math.max(parseInt(a.minWidth||0,10),parseInt(a.childMinWidth||0,10))}}this.minWidth=Math.max(parseInt(this.minWidth,10),Math.max(parseInt(a.minWidth||0,10),parseInt(a.childMinWidth||0,10)));this.minHeight=Math.max(parseInt(this.minHeight,10),Math.max(parseInt(a.minHeight||0,10),parseInt(a.childMinHeight||0,10)));aw.ui.Container.prototype.add.apply(this,arguments)},afterDraw:function(){aw.ui.Container.prototype.afterDraw.apply(this);if(this.moveable===true||this.resizeable===true){this.canvas.absolutize();this.setPosition(this.position)}this.setSize()},clear:function(){aw.ui.Container.prototype.clear.apply(this);var a=this._getContentsDOM();if(a){a.innerHTML=""}a=null;this._contentsDOM=null},close:function(){this.erase();this.triggerEvent("onclose",this)},disable:function(){if(this.disabled===true){return}this.disabled=true;this.triggerEvent("ondisabled",this)},draw:function(){aw.ui.Container.prototype.draw.apply(this);if(this.moveable===true||this.resizeable===true){aw.EventManager.register(this.canvas,"mousedown",this._mousedown_fx);this.canvas.insert(this._templates.borders);if(this.resizeable===true){this.canvas.addClassName("resizable")}else{if(this.moveable===true){this.canvas.addClassName("moveable")}}}else{this.canvas.addClassName("static")}if(!this.showBgd){this.canvas.addClassName("no-bgd")}var f=this.canvas.down("div.close");if((f)&&(this.closeable!==true)&&(this.hideable!==true)){f.hide()}else{if(f){this._onCloseClick_fx=this._onCloseClick.bind(this);aw.EventManager.register(f,"click",this._onCloseClick_fx)}}f=null;var a=this.canvas.down(".help");if((a)&&(!this.helpCallback)){a.hide()}else{if(a){aw.EventManager.register(a,"click",this.helpCallback)}}a=null;var e=this.canvas.down(".handle");if(e&&!this.moveable){e.hide()}if(e&&this.icon){e.insert({after:this.evaluateTemplate("icon",{background:"background:url('"+this.icon+"') no-repeat 3px 3px"})})}e=null;if(this.overlay===true){this.container=$(document.getElementsByTagName("body")[0]);this.container.innerHTML+=this.evaluateTemplate("background",{cssClass:("aw_ui_Panel background"),id:this.id});var d=$(document.getElementById(this.id+"_background"));if(d){d.setOpacity(0.5)}this.container.insert(this.canvas)}var b=this._getTitleBarDOM();if(this.titleVisibility!==true){b.hide()}if(this.moveable===true){b.className="title-moveable"}this.setSize(this.height,this.width);return this.canvas},drawItem:function(b){if((this.canvas)&&(b)&&(b.draw)){var a=this._getContentsDOM();if(a){var d=b.draw();if(b.CLASS_NAME.indexOf("aw.ui.Toolbar")>-1){if((b.region=="right")||(b.region=="bottom")){a.insert({after:d})}else{a.insert({before:d})}}else{a.insert(d)}d=null}}},enable:function(){if(this.disabled!==true){return}this.disabled=false;this.triggerEvent("onenabled",this)},erase:function(){if(this.canvas){if(this._onCloseClick_fx){var d=this.canvas.down("div.close");if(d){aw.EventManager.unregister(d,"click",this._onCloseClick_fx)}d=null;this._onCloseClick_fx=null}if(this._mousedown_fx){aw.EventManager.unregister(this.canvas,"mousedown",this._mousedown_fx);this._mousedown_fx}}var b=this._getTitleBarDOM();if(b){b.remove();b=null}if(this.overlay===true){var a=document.getElementById(this.id+"_background");if(a){$(a).remove()}a=null}this._contentsDOM=null;this._titleBarDOM=null;aw.ui.Container.prototype.erase.apply(this)},hide:function(){aw.ui.Container.prototype.hide.apply(this);if(!this.canvas){return}if(this.overlay===true){var a=$(document.getElementById(this.id+"_background"));if(a){a.hide()}a=null}},setSize:function(q,e){if((!this.canvas)||(this.isVisible()!==true)){return}aw.ui.Container.prototype.setSize.apply(this,arguments);var t=null;var g=this._getContentsDOM();if(g){var m=0,o=0,a=0,f=0;var s=parseInt(this._getTitleBarHeight(),10);var n=this._getTitleBarDOM();if((n)&&(this.titleVisibility===true)){m=s}if((this.items)&&(this.items.length>0)){t=null;for(var k=0;t=this.items[k];k++){if((t.CLASS_NAME.indexOf("aw.ui.Toolbar")>-1)&&(t.getSize)){var p=t.getSize();var l={};if(t.region=="top"){m+=parseInt(p.height,10);if((n)&&(this.titleVisibility===true)){t.setPosition({top:""+s+"px"})}if(n){l.marginLeft=n.getStyle("margin-left");l.marginRight=n.getStyle("margin-right")}}else{if(t.region=="right"){o+=parseInt(p.width,10);if(n){l.marginTop=n.getStyle("margin-top");l.marginBottom=n.getStyle("margin-bottom")}}else{if(t.region=="bottom"){if(this.resizeable===true){var d=this.canvas.down("div.panel-b").getHeight();a+=parseInt(d,10);t.setPosition({bottom:""+d+"px"})}a+=parseInt(p.height,10);if(n){l.marginLeft=n.getStyle("margin-left");l.marginRight=n.getStyle("margin-right")}}else{if(t.region=="left"){f+=parseInt(p.width,10);if(n){l.marginTop=n.getStyle("margin-top");l.marginBottom=n.getStyle("margin-bottom")}}}}}if((n)&&(this.titleVisibility===true)){t.canvas.setStyle(l)}}}}var b={top:""+m+"px"};if(o>0){b.right=""+o+"px"}if(a>0){b.bottom=""+a+"px"}if(f>0){b.left=""+f+"px"}g.setStyle(b)}g=null;if((this.items)&&(this.items.length>0)){for(var h=0;h<this.items.length;h++){if(this.items[h].setSize){this.items[h].setSize()}}}},setTitle:function(d){this.title=d;var a=this._getTitleBarDOM();if(a){var b=a.down("span");if(b){b.innerHTML=d}b=null}},show:function(){aw.ui.Container.prototype.show.apply(this);if(this.overlay===true){var a=$(document.getElementById(this.id+"_background"));if(a){a.show()}a=null}},onControlChanged:function(a){alert("onControlChanged( "+a+" )")},_getContentsDOM:function(){if(this._contentsDOM){return this._contentsDOM}return this._contentsDOM=(this.canvas)?this.canvas.down(".contents"):null},_getTitleBarDOM:function(){return this._titleBarDOM=(this.canvas)?this.canvas.down(".title,.title-moveable"):null},_getTitleBarHeight:function(){var a=0;var b=this._getTitleBarDOM();if(b){a=parseInt(b.getHeight(),10)+parseInt(b.getStyle("margin-top")||0,10)+parseInt(b.getStyle("margin-bottom")||0,10)+parseInt(b.getStyle("padding-top")||0,10)+parseInt(b.getStyle("padding-bottom")||0,10)}b=null;return a},_onCloseClick:function(a){if(this.closeable===true){this.close()}else{this.hide()}},_onclose:function(a){this.erase()},_onmousedown:function(k){var o=aw.EventManager.getEvent(k);var h=o.target;if((!h)||(!h.tagName)||(!h.tagName.toLowerCase().match("div|span"))){return}var p=document;var f=h.className;var a={x:o.pointerX,y:o.pointerY};var j=this.canvas.positionedOffset();var b=this.canvas.getDimensions();var s=h.getStyle("cursor");var g="";if(this.moveable===true){if((f==="title-moveable")||(h.up(".title-moveable"))){g="move"}}if(this.resizeable===true){switch(f){case"panel-t":g="resize-north";break;case"panel-b":g="resize-south";break;case"panel-l":g="resize-west";break;case"panel-r":g="resize-east";break;case"panel-tl":g="resize-northwest";break;case"panel-tr":g="resize-northeast";break;case"panel-bl":g="resize-southwest";break;case"panel-br":g="resize-southeast";break}}if(g===""){return}this._selectStart_fx=function(){return false};aw.EventManager.register(p,"selectstart",this._selectStart_fx);if(typeof this.canvas.style.MozUserSelect!="undefined"){this.canvas.style.MozUserSelect="none"}if(o.stop){o.stop()}if(this._ghostPanel){this._ghostPanel.remove();this._ghostPanel=null}if(g!="move"){var t=this.getId("awgp");var m=null;if(this.container){m=this.container}else{m=$(p.getElementsByTagName("body")[0])}m.insert(this.evaluateTemplate("ghost",{cssClass:this.getCSSClassName(),key:t}));this._ghostPanel=m.down('div[key="'+t+'"]');m=null;if(this.inheritCSS){this._applyInheritCSS(this._ghostPanel)}var d={position:"absolute",top:""+j.top+"px",left:""+j.left+"px",width:""+(b.width-parseInt(this._ghostPanel.getStyle("border-left-width"),10)-parseInt(this._ghostPanel.getStyle("border-right-width"),10))+"px",height:""+(b.height-parseInt(this._ghostPanel.getStyle("border-top-width"),10)-parseInt(this._ghostPanel.getStyle("border-bottom-width"),10))+"px",cursor:s};var n=this.canvas.getStyle("zIndex");if(n){Object.extend(d,{zIndex:n})}this._ghostPanel.setStyle(d)}if(this.container){var q=$(this.container).cumulativeOffset();var l=this.container.getDimensions();this._constraints={t:q.top+5,r:q.left+l.width-5,b:q.top+l.height-5,l:q.left+5}}this._mousemove_fx=this._onmousemove.bind(this,g,a,j,b);this._mouseup_fx=this._onmouseup.bind(this,g);aw.EventManager.register(p,"mousemove",this._mousemove_fx);aw.EventManager.register(p,"mouseup",this._mouseup_fx)},_onmousemove:function(g,m,d,o,j){var l=aw.EventManager.getEvent(j);var h=l.target;l.stop();var a=l.pointerX;var q=l.pointerY;var n=this._getTitleBarDOM();if(g=="move"){var k={};if(((q>this._constraints.t)||(this._constraints.t<0))&&((q<this._constraints.b)||(this._constraints.b<0))){Object.extend(k,{top:""+parseInt(d.top,10)-(m.y-q)+"px"})}if(((a>this._constraints.l)||(this._constraints.l<0))&&((a<this._constraints.r)||(this._constraints.r<0))){Object.extend(k,{left:""+parseInt(d.left,10)-(m.x-a)+"px"})}this.setPosition(k)}else{if(g.indexOf("resize")>-1){var p,f=null;var b={};if(g.indexOf("north")>-1){if(((q>this._constraints.t)||(this._constraints.t<0))&&((q<this._constraints.b)||(this._constraints.b<0))){p=Math.max(parseInt(o.height,10)+(m.y-q),(Math.max(this.minHeight,(this.childMinHeight+(parseInt(n.getHeight(),10)+parseInt(n.getStyle("margin-top")||0,10))))||0));Object.extend(b,{height:""+(p-parseInt(this._ghostPanel.getStyle("border-top-width"),10)-parseInt(this._ghostPanel.getStyle("border-bottom-width"),10))+"px",top:""+(parseInt(d.top,10)+(o.height-p))+"px"})}}if(g.indexOf("south")>-1){if(((q>this._constraints.t)||(this._constraints.t<0))&&((q<this._constraints.b)||(this._constraints.b<0))){p=Math.max(parseInt(o.height,10)-(m.y-q),(Math.max(this.minHeight,(this.childMinHeight+(parseInt(n.getHeight(),10)+parseInt(n.getStyle("margin-top")||0,10))))||0));Object.extend(b,{height:""+(p-parseInt(this._ghostPanel.getStyle("border-top-width"),10)-parseInt(this._ghostPanel.getStyle("border-bottom-width"),10))+"px"})}}if(g.indexOf("west")>-1){if(((a>this._constraints.l)||(this._constraints.l<0))&&((a<this._constraints.r)||(this._constraints.r<0))){f=Math.max(parseInt(o.width,10)+(m.x-a),(Math.max(this.minWidth,this.childMinWidth)||0));Object.extend(b,{width:""+(f-parseInt(this._ghostPanel.getStyle("border-left-width"),10)-parseInt(this._ghostPanel.getStyle("border-right-width"),10))+"px",left:""+(parseInt(d.left,10)+(o.width-f))+"px"})}}if(g.indexOf("east")>-1){if(((a>this._constraints.l)||(this._constraints.l<0))&&((a<this._constraints.r)||(this._constraints.r<0))){f=Math.max(parseInt(o.width,10)-(m.x-a),(Math.max(this.minWidth,this.childMinWidth)||0));Object.extend(b,{width:""+(f-parseInt(this._ghostPanel.getStyle("border-left-width"),10)-parseInt(this._ghostPanel.getStyle("border-right-width"),10))+"px"})}}if(this._ghostPanel){this._ghostPanel.setStyle(b)}}}n=null},_onmouseup:function(e){var f=document;aw.EventManager.unregister(f,"mousemove",this._mousemove_fx);aw.EventManager.unregister(f,"mouseup",this._mouseup_fx);aw.EventManager.unregister(f,"selectstart",this._selectStart_fx);if(typeof this.canvas.style.MozUserSelect!="undefined"){this.canvas.style.MozUserSelect="text"}if((this._ghostPanel)&&(e!="move")){var h=this._ghostPanel.positionedOffset();var g=this._ghostPanel.getDimensions();var a=parseInt(g.height,10);var d=parseInt(g.width,10);var b=((e.indexOf("north")>-1)||(e.indexOf("west")>-1))?"desc":null;this.setPosition({top:""+h.top+"px",left:""+h.left+"px"});this.setSize(a,d,b);this._ghostPanel.remove();this._ghostPanel=null}},_templates:{ui:new Template('<div class="title"><div class="handle"></div><span>#{title}</span><div class="help"></div><div class="close"></div></div><div class="contents"></div>'),icon:new Template('<div class="icon" style="#{background}"></div>'),borders:'<div class="panel-t"></div><div class="panel-b"></div><div class="panel-l"></div><div class="panel-r"></div><div class="panel-tl"></div><div class="panel-tr"></div><div class="panel-bl"></div><div class="panel-br"></div>',ghost:new Template('<div class="#{cssClass} ghost-x" key="#{key}"></div>'),background:new Template('<div class="#{cssClass}" id="#{id}_background"></div>')},EVENTS:["onhide","onshow","ondisabled","onenabled","onclose"],CLASS_NAME:"aw.ui.Panel",VALID_PROPERTIES:["title","container","componentBus","cssClass","closeable","titleVisibility","moveable","resizeable","hideable","dockable","height","width","minHeight","minWidth","position","helpCallback","icon","disabled","overlay","helpCallback","showBgd"]});aw.ui.Panel.Accordion=Class.create(aw.ui.Panel,{activePanel:null,_onClick_fx:null,initialize:function(b,a){this.activePanel=null;this._onClick_fx=null;aw.ui.Panel.prototype.initialize.apply(this,arguments)},add:function(d){var a=(d instanceof Array)?d:[d];for(var b=0;b<a.length;b++){aw.ui.Panel.prototype.add.apply(this,[a[b]]);if(!this.activePanel){this.activePanel=a[b]}}this._setActivePanel()},clear:function(){aw.ui.Panel.prototype.clear.apply(this);this.activePanel=null},draw:function(){aw.ui.Panel.prototype.draw.apply(this);this._onClick_fx=this._onClick.bind(this);aw.EventManager.register(this.canvas,"click",this._onClick_fx);this._setActivePanel();return this.canvas},drawItem:function(d){if((this.canvas)&&(d)&&(d.draw)){if(d.derivesFrom("aw.ui.Panel")===true){d.applyProperties({titleVisibility:false,resizeable:false,moveable:false});d.registerEvent("onshow",this._onPanelShow.bind(this));var b=this._getContentsDOM();if(b){b.insert('<div class="list" key="'+d.id+'"><div class="accordionlabel"><div class="expcol">'+d.title+"</div></div></div>");var a=b.down('div[key="'+d.id+'"].list');if(a){a.insert(d.draw())}a=null}b=null;if(!this.activePanel){this.activePanel=d}}else{aw.ui.Panel.prototype.drawItem.apply(this,arguments)}}},getPanelByLabel:function(a){if((!a)||(!this.items)||(!this.items.length>0)){return null}var d=null;for(var b=0;d=this.items[b];b++){if(d.title==a){return d}}return null},setActivePanel:function(a){if(this.activePanel!==a){this.activePanel=a;this._setActivePanel()}},setActivePanelByLabel:function(a){this.setActivePanel(this.getPanelByLabel(a))},setSize:function(a,b){if((!this.canvas)||(this.isVisible()!==true)){return}aw.ui.Panel.prototype.setSize.apply(this,arguments);this._setPanelSize()},_onClick:function(f){var d=aw.EventManager.getEvent(f);var a=d.target;if(!a){return}if((!a.tagName)||(a.tagName.toLowerCase()!="div")||(!a.className)||(!a.className.toLowerCase().match("accordionlabel"))){a=$(aw.Element.getParentNode(a,"div","accordionlabel"))}if(!a){return}a=$(aw.Element.getParentNode(a,"div","list"));if((!a)||(!a.readAttribute("key"))){return}var b=this.getItemById(a.readAttribute("key"));if(!b){return}if(this.activePanel===b){this.activePanel=null;this._setActivePanel()}else{this.setActivePanel(b)}},_onPanelShow:function(a){this.setActivePanel(a)},_setActivePanel:function(){if(!this.canvas){return}var a=null;for(var b=0;b<this.items.length;b++){if((this.items[b]!==this.activePanel)&&(this.items[b].isVisible()===true)){this.items[b].hide();a=this.canvas.down('div[key="'+this.items[b].id+'"].list');if(a){a.removeClassName("active")}a=null}}if(this.activePanel){a=this.canvas.down('div[key="'+this.activePanel.id+'"].list');if(a){a.addClassName("active")}a=null;this.activePanel.show();this.activePanel.setSize()}this._setPanelSize()},_setPanelSize:function(){var j=0,g=0,h=0,d=0,b=false;var f=this._getContentsDOM();if(f){j=f.getHeight()-parseInt(f.getStyle("border-top-width").replace(/\D*/gi,"")||0,10)-parseInt(f.getStyle("border-bottom-width").replace(/\D*/gi,"")||0,10)}f=null;var a=this.canvas.down("div.list > div.accordionlabel");if(a){g=(a.getHeight()+parseInt(a.getStyle("border-top-width").replace(/\D*/gi,"")||0,10)+parseInt(a.getStyle("border-bottom-width").replace(/\D*/gi,"")||0,10))}a=this.canvas.select(">div.contents > div.list");if((a)&&(a.length>0)){for(var e=0;e<a.length;e++){if(b!==true){a[e].setStyle({top:""+h+"px",bottom:"auto"})}else{a[e].setStyle({top:"auto",bottom:""+((this.items.length-(e+1))*g)+"px"})}if(a[e].hasClassName("active")){a[e].setStyle({bottom:""+(g*(this.items.length-(e+1)))+"px"});b=true}else{h+=parseInt(g,10)}}}},_templates:{ui:new Template('<div class="title"><div class="handle"></div><span>#{title}</span><div class="close"></div></div><div class="contents"></div>'),icon:new Template('<div class="icon" style="#{background}"></div>'),borders:'<div class="panel-t"></div><div class="panel-b"></div><div class="panel-l"></div><div class="panel-r"></div><div class="panel-tl"></div><div class="panel-tr"></div><div class="panel-bl"></div><div class="panel-br"></div>',ghost:new Template('<div class="#{cssClass} ghost-x" key="#{key}"></div>'),background:new Template('<div class="#{cssClass}" id="#{id}_background"></div>')},CLASS_NAME:"aw.ui.Panel.Accordion"});aw.ui.Panel.Signup=Class.create(aw.ui.Panel,{excludeFields:[],_buttons:[],_form:null,initialize:function(b,a){this.excludeFields=[];this._buttons=[];this._form=null;Object.extend(b,{title:"Sign Up"});aw.ui.Panel.prototype.initialize.apply(this,arguments)},afterDraw:function(){var a=(this.componentBus)?this.componentBus.getComponentReferences("aw.AccountManager"):null;if((a)&&(a.length>0)){a=a[0]}else{return}a.retrieveAccountInfo(this._manifestReceived.bind(this))},draw:function(){aw.ui.Panel.prototype.draw.apply(this);this._updateContents("<p>Loading ...</p>");this.canvas.setAttribute("role","form");this.canvas.setAttribute("aria-describedby",this.id+"_instructions");return this.canvas},_addControl:function(d,e){if(!this._form){this._form=new aw.ui.Form()}var b;if((d.type=="text")||(d.type=="password")){b=new aw.ui.Control.TextBox({type:d.type,label:d.label,name:d.name,value:((d.type=="password")?"":d.defaultValue),required:d.required,container:e},{enter:this._onSignupClick.bind(this)});this._form.add(b);if(d.name=="password"){var a=Object.extend({},d);a.label="Password Confirmation";a.name="passwordConfirm";this._addControl(a,e)}}else{if(d.type=="select"){d.values.unshift({value:"",label:"-- Select One --"});b=new aw.ui.Control.DropDown({label:d.label,name:d.name,options:d.values,required:d.required,container:e});if((d.defaultValue)&&(d.defaultValue!=="")){b.selectByValue(d.defaultValue)}this._form.add(b)}}},_fieldShouldBeExcluded:function(d){if(this.excludeFields.length===0||!d||d===""){return false}var b=new RegExp("\\b"+d+"\\b"),a=this.excludeFields.join("||");return b.test(a)},_manifestReceived:function(a){if((!a)||(!a.length>0)){return}this._form=new aw.ui.Form();var e=this._updateContents('<div class="response"></div><div id="'+this.id+'_instructions" class="instructions"><b>*</b> Required fields</div>');var k,g,d,p,h,b,m,l,o,f,n;for(k=0,d=a.length;k<d;k++){b=a[k];l=b.fields;o=document.createElement("fieldset");n=document.createElement("legend");legendText=document.createTextNode(b.category);n.appendChild(legendText);o.appendChild(n);h=true;for(g=0,p=l.length;g<p;g++){m=l[g];if(!this._fieldShouldBeExcluded(m.name)){if(h===true){e.insert(o);h=false}this._addControl(m,o)}}h=true;n=null;o=null}e.insert('<div class="buttons"></div>');this._renderButton("Sign Up",this._onSignupClick.bind(this))},_onSignupClick:function(){if(!this._form){return}var a=this.componentBus.getComponentReferences("aw.AccountManager");if((a)&&(a.length>0)){a=a[0]}else{return}var b=this._form.serialize();a.createAccount(b,function(d,f){var e=this.canvas.down(".response");d=(d=="failure")?"error":"success";if(d=="success"){this._form.reset()}e.addClassName(d);e.innerHTML=f}.bind(this))},_renderButton:function(b,e){if(!this.canvas){return null}var a=this.canvas.down(".buttons");if(a){var d=new aw.ui.Control.Button({label:b,container:a},{click:e,enter:e});a=null;this._buttons.push(d);return d}return null},_updateContents:function(b){if(typeof b!="string"){throw new TypeError("content is not a string")}var a=this.canvas.down(".contents");if(a){a.update(b);return a}},VALID_PROPERTIES:["title","container","componentBus","cssClass","closeable","titleVisibility","moveable","resizeable","hideable","dockable","height","width","minHeight","minWidth","position","helpCallback","icon","disabled","overlay","helpCallback","showBgd","excludeFields"],CLASS_NAME:"aw.ui.Panel.Signup"});aw.ui.Panel.Splitter=Class.create(aw.ui.Panel,{orientation:"vertical",overlay:false,_ghostSplitter:null,_activeSplitter:null,_splitmove_fx:null,_splitmouseup_fx:null,_selectstart_fx:null,initialize:function(b,a){this._ghostSplitter=null;this._activeSplitter=null;this._splitmove_fx=null;this._splitmouseup_fx=this._splitbar_mouseup.bind(this);this._selectstart_fx=null;aw.ui.Panel.prototype.initialize.apply(this,arguments)},add:function(d){var a=(d instanceof Array)?d:[d];for(var b=0;b<a.length;b++){if(a[b].derivesFrom("aw.ui.Panel")!==true){return}}aw.ui.Panel.prototype.add.apply(this,arguments)},afterDraw:function(){aw.ui.Panel.prototype.afterDraw.apply(this);this.setSize(this.height,this.width)},drawItem:function(d){if(this.canvas){var b=this._getContentsDOM();if(!b){return}if(d!==this.items[0]){b.insert(this.evaluateTemplate("splitbar",{orientation:this.orientation}));var a=b.select("div.splitbar-"+this.orientation);if((a)&&(a.length>0)){aw.EventManager.register(a[a.length-1],"mousedown",this._splitbar_mousedown.bind(this))}this.childMinHeight+=5;this.childMinWidth+=5}b=null}aw.ui.Panel.prototype.drawItem.apply(this,arguments);this.setSize(this.height,this.width)},erase:function(){if(this._splitmove_fx){aw.EventManager.unregister(document,"mousemove",this._splitmove_fx);this._splitmove_fx=null}if(this._splitmouseup_fx){aw.EventManager.unregister(document,"mouseup",this._splitmouseup_fx);this._splitmouseup_fx=null}aw.ui.Panel.prototype.erase.apply(this)},setSize:function(s,b,p){aw.ui.Panel.prototype.setSize.apply(this,arguments);if(!this.canvas){return}var g=this._getContentsDOM();if(!g){return}var e=g.getDimensions();if((!e.height>0)||(!e.width>0)){return}var n={height:0,width:0};var m=null,t=null;var o=0,f=0;if((this.items)&&(this.items.length>0)){var d=g.childElements();if((d)&&(d.length>0)){for(m=0;child=d[m];m++){n.height+=parseInt(child.getHeight(),10);n.width+=parseInt(child.getWidth(),10)}}var h=n.height-e.height;var l=n.width-e.width;var a=0,k=0;var j=null;if(p=="desc"){j=0}else{j=this.items.length-1}t=this.items[j];while(t){var q=t.getSize();if(this.orientation=="vertical"){a=(h!==0)?Math.max(Math.max(t.minHeight,t.childMinHeight),(q.height-h)):q.height;t.setSize(a,e.width);h-=q.height-a}else{if(this.orientation=="horizontal"){k=(l!==0)?Math.max(Math.max(t.minWidth,t.childMinWidth),(q.width-l)):q.width;t.setSize(e.height,k);l-=q.width-k}}if(p=="desc"){j++}else{j--}t=this.items[j]}if((d)&&(d.length>0)){for(m=0;child=d[m];m++){child.setStyle({position:"absolute",top:""+o+"px",left:""+f+"px"});if(this.orientation=="vertical"){o+=parseInt(child.getHeight(),10)}else{if(this.orientation=="horizontal"){f+=parseInt(child.getWidth(),10)}}}}child=null}g=null},_splitbar_mousedown:function(n){var q=aw.EventManager.getEvent(n);var h=q.target;if(!h){return false}var j=h.previous();var o=h.next();if((!j)||(!o)){return false}var l=this.getItemById(j.id);var b=this.getItemById(o.id);if((!l)||(!b)){return false}var g=l.getSize();var k=b.getSize();var m={up:g.height-Math.max(l.minHeight,l.childMinHeight),down:k.height-Math.max(b.minHeight,b.childMinHeight),left:g.width-Math.max(l.minWidth,l.childMinWidth),right:k.width-Math.max(b.minWidth,b.childMinWidth)};var f=this._getContentsDOM();if(f){f.insert(this.evaluateTemplate("splitbar",{orientation:"ghost"}));this._ghostSplitter=f.down("div.splitbar-ghost");this._activeSplitter=h;var p=h.positionedOffset();var s=h.getDimensions();var t=h.getStyle("cursor");var d={top:""+p.top+"px",left:""+p.left+"px",width:""+s.width+"px",height:""+s.height+"px",cursor:t};this._ghostSplitter.setStyle(d)}else{return false}var a={x:q.pointerX,y:q.pointerY};this._splitmove_fx=this._splitbar_mousemove.bind(this,h,a,l,b,m);this._selectstart_fx=function(){return false};aw.EventManager.register(document,"mousemove",this._splitmove_fx);aw.EventManager.register(document,"mouseup",this._splitmouseup_fx);aw.EventManager.register(this.canvas,"selectstart",this._selectstart_fx);if(typeof this.canvas.style.MozUserSelect!="undefined"){this.canvas.style.MozUserSelect="none"}return false},_splitbar_mousemove:function(k,d,j,f,m,l){if((!l)||(!this._ghostSplitter)){return}var n=aw.EventManager.getEvent(l);var b=n.pointerX;var q=n.pointerY;var h=k.positionedOffset();var p=k.getDimensions();var a=q-d.y;var o=b-d.x;var g={};if(this.orientation=="vertical"){if((a>(m.up*-1))&&(a<m.down)){Object.extend(g,{top:""+(parseInt(h.top,10)+a)+"px"})}else{if(a<=(m.up*-1)){Object.extend(g,{top:""+(parseInt(h.top,10)+(m.up*-1))+"px"})}else{if(a>=m.down){Object.extend(g,{top:""+(parseInt(h.top,10)+m.down)+"px"})}}}}else{if(this.orientation=="horizontal"){if((o>(m.left*-1))&&(o<m.right)){Object.extend(g,{left:""+(parseInt(h.left,10)+o)+"px"})}else{if(o<=(m.left*-1)){Object.extend(g,{left:""+(parseInt(h.left,10)+(m.left*-1))+"px"})}else{if(o>=m.right){Object.extend(g,{left:""+(parseInt(h.left,10)+m.right)+"px"})}}}}}this._ghostSplitter.setStyle(g);return false},_splitbar_mouseup:function(){aw.EventManager.unregister(document,"mousemove",this._splitmove_fx);aw.EventManager.unregister(document,"mouseup",this._splitmouseup_fx);aw.EventManager.unregister(this.canvas,"selectstart",this._selectstart_fx);if(typeof this.canvas.style.MozUserSelect!="undefined"){this.canvas.style.MozUserSelect="text"}if((!this._ghostSplitter)||(!this._activeSplitter)){return}var e=this._activeSplitter.previous();var j=this._activeSplitter.next();if((!e)||(!j)){return}var f=this.getItemById(e.id);var b=this.getItemById(j.id);if((!f)||(!b)){return}var m=this._ghostSplitter.positionedOffset();var l=this._activeSplitter.positionedOffset();var h=l.top-m.top;var g=l.left-m.left;var k=0,d=0;f.setSize((parseInt(h,10)!==0)?(parseInt(f.getSize().height,10)-parseInt(h,10)):null,(parseInt(g,10)!==0)?(parseInt(f.getSize().width,10)-parseInt(g,10)):null);b.setSize((parseInt(h,10)!==0)?(parseInt(b.getSize().height,10)+parseInt(h,10)):null,(parseInt(g,10)!==0)?(parseInt(b.getSize().width,10)+parseInt(g,10)):null);var a=j.positionedOffset();k=parseInt(a.top,10)-parseInt(h,10);d=parseInt(a.left,10)-parseInt(g,10);b.setPosition({position:"absolute",top:""+k+"px",left:""+d+"px"});this._activeSplitter.setStyle({top:""+(m.top||0)+"px",left:""+(m.left||0)+"px"});if(this._ghostSplitter){this._ghostSplitter.remove()}},_templates:{ui:new Template('<div class="title"><div class="handle"></div><span>#{title}</span><div class="close"></div></div><div class="contents"></div>'),icon:new Template('<div class="icon" style="#{background}"></div>'),borders:'<div class="panel-t"></div><div class="panel-b"></div><div class="panel-l"></div><div class="panel-r"></div><div class="panel-tl"></div><div class="panel-tr"></div><div class="panel-bl"></div><div class="panel-br"></div>',ghost:new Template('<div class="#{cssClass} ghost-x" key="#{key}"></div>'),splitbar:new Template('<div class="splitbar-#{orientation}"></div>'),background:new Template('<div class="#{cssClass}" id="#{id}_background"></div>')},CLASS_NAME:"aw.ui.Panel.Splitter",VALID_PROPERTIES:["title","componentBus","container","cssClass","closeable","titleVisibility","height","width","moveable","resizeable","minHeight","minWidth","orientation","disabled","position","overlay","helpCallback","showBgd","icon"]});aw.ui.Panel.Login=Class.create(aw.ui.Panel,{_buttons:[],initialize:function(b,a){Object.extend(b,{title:"Log In"});aw.ui.Panel.prototype.initialize.apply(this,arguments);if(this.componentBus){this._onLoginFailure_fx=this._onLoginFailure.bind(this);this.componentBus.registerEvent("onloginfailure",this._onLoginFailure_fx);this._onLoginSuccess_fx=this._onLoginSuccess.bind(this);this.componentBus.registerEvent("onloginsuccess",this._onLoginSuccess_fx)}},destroy:function(){if(this.componentBus){if(this._onLoginFailure_fx){this.componentBus.unregisterEvent("onloginfailure",this._onLoginFailure_fx);this._onLoginFailure_fx=null}if(this._onLoginSuccess_fx){this.componentBus.unregisterEvent("onloginsuccess",this._onLoginSuccess_fx);this._onLoginSuccess_fx=null}}aw.ui.Panel.prototype.destroy.apply(this)},draw:function(){aw.ui.Panel.prototype.draw.apply(this);var a=this.canvas.down("div.contents");if(!a){return null}a.innerHTML+='<div class="failure"></div>';var b=this.readCookie("username");this._userTextbox=new aw.ui.Control.TextBox({label:"Email:",value:b,container:a,hasFocus:((b)&&(b!==""))?false:true},{enter:this._onLoginClick.bind(this)});this._passTextbox=new aw.ui.Control.TextBox({label:"Password:",type:"password",container:a,hasFocus:((b)&&(b!==""))?true:false},{enter:this._onLoginClick.bind(this)});new aw.ui.Control.Link({label:"Forgot Password?",container:a},{click:this._onForgotPasswordClick.bind(this)});a.insert('<div class="buttons"></div>');this._renderButton("Log In",this._onLoginClick.bind(this));return this.canvas},_onForgotPasswordClick:function(){new aw.ui.Dialog.ForgotPassword({componentBus:this.componentBus,defaultEmail:this._userTextbox.getValue()})},_onLoginClick:function(){if(!this.componentBus){return}if(this.isValidating()){return}this.componentBus.loadUser(this._userTextbox.value,this._passTextbox.value);this._buttons[0].disable();this._buttons[0].setLabel("Please wait...")},_onLoginFailure:function(b){if(!this.canvas){return}var a=this.canvas.down("div.contents div.failure");if(a){a.update(b)}this._buttons[0].enable();this._buttons[0].setLabel("Log In")},_onLoginSuccess:function(){this.destroy();if(this.closeable){this.close()}},_renderButton:aw.ui.Dialog.prototype._renderButton,CLASS_NAME:"aw.ui.Panel.Login"});aw.ui.Panel.Tab=Class.create(aw.ui.Panel,{activeTab:null,overlay:false,showBgd:true,_onClick_fx:null,initialize:function(b,a){this.activeTab=null;this._onClick_fx=null;aw.ui.Panel.prototype.initialize.apply(this,arguments)},add:function(d){var a=(d instanceof Array)?d:[d];for(var b=0;b<a.length;b++){aw.ui.Panel.prototype.add.apply(this,[a[b]])}},clear:function(){aw.ui.Panel.prototype.clear.apply(this);var a=this.canvas.getElementsByTagName("ul")[0];if(a){a.innerHTML=""}a=null;this.activeTab=null},disableTab:function(d){if((!d)||(!this.items)||(!this.items.length>0)){return}if(this.canvas){var b=this.canvas.down('li[key="'+d.id+'"]');if(b){b.removeClassName("active");b.addClassName("disabled")}b=null}if((this.activeTab)&&(this.activeTab.id==d.id)){for(var a=0;a<this.items.length;a++){if(this.items[a].disabled!==true){this.setActiveTab(this.items[a]);return}}}},draw:function(){aw.ui.Panel.prototype.draw.apply(this);var a=this.canvas.getElementsByTagName("ul")[0];if(a){this._onClick_fx=this.onClick.bind(this);aw.EventManager.register(a,"click",this._onClick_fx);a=null}return this.canvas},drawItem:function(g){if((this.canvas)&&(g)&&(g.draw)){if(g.CLASS_NAME.toLowerCase().match("aw.ui.toolbar")){aw.ui.Panel.prototype.drawItem.apply(this,arguments)}else{g.applyProperties({titleVisibility:false,resizeable:false,moveable:false});aw.EventManager.register(g,"onshow",this._onPanelShow.bind(this),this);aw.EventManager.register(g,"ondisabled",this._onPanelDisabled.bind(this),this);aw.EventManager.register(g,"onenabled",this._onPanelEnabled.bind(this),this);var b=this.canvas.getElementsByTagName("ul")[0];var e=null;var d="";var a="";if(b){if(g.icon){d='<div class="icon" style="background-image:url(\''+g.icon+"')\"></div>";a=" icon"}b.innerHTML+='<li class="tab'+a+((g.disabled===true)?" disabled":"")+'" key="'+g.id+'"><div><div>'+d+g.title+"</div></div></li>"}b=null;var f=this._getContentsDOM();if(f){var h=g.draw();g.hide();f.insert(h);h=null}f=null;if(!this.activeTab){this.setActiveTab(g)}else{if(this.activeTab.id===g.id){e=this.canvas.down('li[key="'+this.activeTab.id+'"]');if(e){e.addClassName("active")}e=null;this.activeTab.show();this.activeTab.setSize()}}}}},enableTab:function(b){if((!b)||(!this.items)||(!this.items.length>0)){return}if(this.canvas){var a=this.canvas.down('li[key="'+b.id+'"]');if(a){a.removeClassName("disabled")}a=null}if(!this.activeTab){this.setActiveTab(b)}},erase:function(){if(this.canvas){if(this._onClick_fx){aw.EventManager.unregister(this.canvas.getElementsByTagName("ul")[0],"click",this._onClick_fx);this._onClick_fx=null}}aw.ui.Panel.prototype.erase.apply(this)},first:function(){var a=null;var b=this.canvas.select("li.tab");if(b.length<=0){return null}a=b[0];if((!a)||(!a.readAttribute("key"))){return null}var d=this.getItemById(a.readAttribute("key"));if(!d){return null}return d},getTabByLabel:function(a){if((!a)||(!this.items)||(!this.items.length>0)){return null}var d=null;for(var b=0;d=this.items[b];b++){if(d.title==a){return d}}return null},last:function(){var a=null;var b=this.canvas.select("li.tab");if(b.length<=0){return null}a=b[b.length-1];if((!a)||(!a.readAttribute("key"))){return null}var d=this.getItemById(a.readAttribute("key"));if(!d){return null}return d},next:function(){if((!this.items.length>0)||(!this.activeTab)){return}for(var b=0,a=this.items.length;b<a;b++){if((this.items[b]===this.activeTab)&&(b<this.items.length-1)){this.setActiveTab(this.items[b+1]);return}}},previous:function(){if((!this.items.length>0)||(!this.activeTab)){return}for(var b=0,a=this.items.length;b<a;b++){if((this.items[b]===this.activeTab)&&((b-1)>=0)){this.setActiveTab(this.items[b-1]);return}}},remove:function(f){if((!f)||(!this.items)||(!this.items.length>0)){return false}for(var d=0,a=this.items.length;d<a;d++){if(this.items[d]===f){this.items.splice(d,1);if(this.canvas){var b=this.canvas.getElementsByTagName("ul")[0];var e=b.down('li[key="'+f.id+'"]');if(e){aw.Element.remove(e)}e=null;f.erase()}if((this.activeTab===f)&&(this.items.length>0)){this.setActiveTab(this.items[0])}else{if(this.activeTab===f){this.activeTab=null}}}}},setActiveTab:function(f){if((!f)||(!this.items)||(!this.items.length>0)||((this.activeTab)&&(this.activeTab.id===f.id))||(f.disabled===true)){return}var g=false;var b=null;var e=null;for(var d=0,a=this.items.length;d<a;d++){if(this.items[d].id===f.id){b=f;g=true}}if((g===true)&&(b)&&(this.canvas)){if(this.activeTab){e=this.canvas.down('li[key="'+this.activeTab.id+'"]');if(e){e.removeClassName("active")}e=null;this.activeTab.hide()}this.activeTab=b;e=this.canvas.down('li[key="'+this.activeTab.id+'"]');if(e){e.addClassName("active")}e=null;this.activeTab.show();this.activeTab.setSize();this.triggerEvent("tabchanged",this.activeTab)}},setActiveTabByLabel:function(a){this.setActiveTab(this.getTabByLabel(a))},setSize:function(s,d){if((!this.canvas)||(this.isVisible()!==true)){return}aw.ui.Container.prototype.setSize.apply(this,arguments);var u=null;var f=this._getContentsDOM();if(f){var n=0,p=0,a=0,e=0;var t=parseInt(this._getTitleBarHeight(),10);var o=this._getTitleBarDOM();if((o)&&(this.titleVisibility===true)){n=t}var m=this.canvas.down("div.tabs-wrap");if((m)&&(m.getHeight)){n+=parseInt(m.getHeight(),10)}m=null;if((this.items)&&(this.items.length>0)){u=null;for(var h=0,k=this.items.length;h<k;h++){u=this.items[h];if((u.CLASS_NAME.indexOf("aw.ui.Toolbar")>-1)&&(u.getSize)){var q=u.getSize();var l={};if(u.region=="top"){n+=parseInt(q.height,10);if((o)&&(this.titleVisibility===true)){u.setPosition({top:""+t+"px"})}if(o){Object.extend(l,{marginLeft:o.getStyle("margin-left"),marginRight:o.getStyle("margin-right")})}}else{if(u.region=="right"){p+=parseInt(q.width,10);if(o){Object.extend(l,{marginTop:o.getStyle("margin-top"),marginBottom:o.getStyle("margin-bottom")})}}else{if(u.region=="bottom"){a+=parseInt(q.height,10);if(o){Object.extend(l,{marginLeft:o.getStyle("margin-left"),marginRight:o.getStyle("margin-right")})}}else{if(u.region=="left"){e+=parseInt(q.width,10);if(o){Object.extend(l,{marginTop:o.getStyle("margin-top"),marginBottom:o.getStyle("margin-bottom")})}}}}}if((o)&&(this.titleVisibility===true)){u.canvas.setStyle(l)}}}}var b={top:""+n+"px"};if(p>0){b.right=""+p+"px"}if(a>0){b.bottom=""+a+"px"}if(e>0){b.left=""+e+"px"}f.setStyle(b)}f=null;if((this.items)&&(this.items.length>0)){for(var g=0,k=this.items.length;g<k;g++){if(this.items[g].setSize){this.items[g].setSize()}}}},onClick:function(f){var d=aw.EventManager.getEvent(f);var a=d.target;if(!a){return}if((!a.tagName)||(a.tagName.toLowerCase()!="li")){a=$(aw.Element.getParentNode(a,"li"))}if((!a)||(!a.readAttribute("key"))){return}var b=this.getItemById(a.readAttribute("key"));if(!b){return}this.triggerEvent("tabclicked",b);this.setActiveTab(b)},_onPanelDisabled:function(a){this.disableTab(a)},_onPanelEnabled:function(a){this.enableTab(a)},_onPanelShow:function(a){this.setActiveTab(a)},_templates:{tab:new Template('<li class="tab#{iconClass}" key="#{key}"><div><div>#{icon}#{label}</div></div></li>'),ui:new Template('<div class="title"><div class="handle"></div><span>#{title}</span><div class="close"></div></div><div class="tabs-wrap"><ul class="tabs"></ul></div><div class="contents"></div>'),icon:new Template('<div class="icon" style="#{background}"></div>'),borders:'<div class="panel-t"></div><div class="panel-b"></div><div class="panel-l"></div><div class="panel-r"></div><div class="panel-tl"></div><div class="panel-tr"></div><div class="panel-bl"></div><div class="panel-br"></div>',ghost:new Template('<div class="#{cssClass} ghost-x" key="#{key}"></div>'),background:new Template('<div class="#{cssClass}" id="#{id}_background"></div>')},CLASS_NAME:"aw.ui.Panel.Tab",VALID_PROPERTIES:["title","icon","items","container","cssClass","componentBus","closeable","titleVisibility","moveable","resizeable","hideable","height","width","minHeight","minWidth","overlay","position","showBgd","activeTab"],EVENTS:["onshow","onhide","onclose","tabchanged","tabclicked"]});aw.ui.Debug=Class.create(aw.ui.Panel.Tab,{_onComponentRegistered_fx:null,_onRequestCompleted_fx:null,_onRequestInitialized_fx:null,_onSessionChanged_fx:null,_componentDetailsPanel:null,_componentsGrid:null,_cookiesGrid:null,_deleteSelectedCookiesButton:null,_requestDetailsPanel:null,_requestGrid:null,_sessionDetailsPanel:null,_sscc:0,initialize:function(b,a){this.inheritCSS=true;this._onComponentRegistered_fx=null;this._onRequestCompleted_fx=null;this._onSessionChanged_fx=null;this._componentDetailsPanel=null;this._componentsGrid=null;this._cookiesGrid=null;this._deleteSelectedCookiesButton=null;this._requestDetailsPanel=null;this._requestGrid=null;this._sessionDetailsPanel=null;this._sscc=0;Object.extend(b,{container:document.getElementsByTagName("body")[0],title:"Debugger",height:500,width:600,orientation:"vertical",resizeable:true,moveable:true,closeable:true,position:{top:"100px",left:"200px"}});aw.ui.Panel.Tab.prototype.initialize.apply(this,arguments);if(this.componentBus){this._onRequestCompleted_fx=this._onRequestCompleted.bind(this);this.componentBus.registerEvent("onrequestcompleted",this._onRequestCompleted_fx);var e=this.componentBus.getRequestRegistry();if((e)&&(e.length>0)){this._onRequestCompleted()}this._onComponentRegistered_fx=this._onComponentRegistered.bind(this);this.componentBus.registerEvent("oncomponentregistered",this._onComponentRegistered_fx);this.componentBus.registerEvent("oncomponentunregistered",this._onComponentRegistered_fx);var d=this.componentBus.getComponentRegistry();if((d)&&(d.length>0)){this._onComponentRegistered()}this._onSessionChanged_fx=this._onSessionChanged.bind(this);this.componentBus.registerEvent("onauthenticationfailure",this._onSessionChanged_fx);this.componentBus.registerEvent("onauthenticationsuccess",this._onSessionChanged_fx);this.componentBus.registerEvent("onvalidationfailure",this._onSessionChanged_fx);this.componentBus.registerEvent("onvalidationsuccess",this._onSessionChanged_fx);this._onSessionChanged();this._retrieveRecordStore()}},close:function(){aw.ui.Panel.Tab.prototype.close.apply(this);this.destroy()},destroy:function(){if(this.componentBus){if(this._onRequestCompleted_fx){this.componentBus.unregisterEvent("onrequestcompleted",this._onRequestCompleted_fx);this._onRequestCompleted_fx=null}if(this._onComponentRegistered_fx){this.componentBus.unregisterEvent("oncomponentregistered",this._onComponentRegistered_fx);this.componentBus.unregisterEvent("oncomponentunregistered",this._onComponentRegistered_fx);this._onComponentRegistered_fx=null}if(this._onSessionChanged_fx){this.componentBus.unregisterEvent("onauthenticationfailure",this._onSessionChanged_fx);this.componentBus.unregisterEvent("onauthenticationsuccess",this._onSessionChanged_fx);this.componentBus.unregisterEvent("onvalidationfailure",this._onSessionChanged_fx);this.componentBus.unregisterEvent("onvalidationsuccess",this._onSessionChanged_fx);this._onSessionChanged_fx=null}this.componentBus._debugMode=false}aw.ui.Panel.Tab.prototype.destroy.apply(this)},draw:function(){aw.ui.Panel.Tab.prototype.draw.apply(this);if(this.canvas){aw.EventManager.register(this.canvas,"click",this._gfawgg.bind(this))}this._requestGrid=new aw.ui.Grid({columns:[{index:"index",label:"#",sorted:true,sortDirection:"asc",type:"numeric"},{index:"component",label:"Component"},{index:"service",label:"Service"},{index:"method",label:"Method"},{index:"time",label:"Time (ms)"}]},{onselectionchanged:this._onRequestGridSelectionChanged.bind(this)});this._componentsGrid=new aw.ui.Grid({columns:[{index:"id",label:"ID"},{index:"className",label:"Class Name",sorted:true,sortDirection:"asc"}]},{onselectionchanged:this._onComponentsGridSelectionChanged.bind(this)});this._cookiesGrid=new aw.ui.Grid({columns:[{index:"name",label:"Name",sorted:true,sortDirection:"asc"},{index:"value",label:"Value"}]},{onselectionchanged:this._onCookiesSelectionChanged.bind(this)});this._serverDetailsPanel=new aw.ui.Panel({title:"Configuration",height:200,minHeight:100,items:[new aw.ui.Control.Label({label:"Application Key:",value:this.componentBus.getApplicationKey()||"No Key"}),new aw.ui.Control.Label({label:"Server:",value:this.componentBus.getServer()||"No Server"}),new aw.ui.Control.Label({label:"Component Server:",value:this.componentBus.getComponentServer()||"No Server"}),new aw.ui.Control.Label({label:"Request Method:",value:this.componentBus.getServerMethod()||"Unknown"}),new aw.ui.Control.Label({label:"Session Length (Minutes):",value:this.componentBus.sessionLength}),new aw.ui.Control.Label({label:"Client Build:",value:aw.BUILD_VERSION})]});this._sessionDetailsPanel=new aw.ui.Panel({title:"Session Information",height:100,minHeight:100});this._recordStoreGrid=new aw.ui.Grid({columns:[{index:"key",label:"Key",sorted:true,sortDirection:"asc"},{index:"shortContent",label:"Content"}]},{onselectionchanged:this._onRecordStoreSelectionChanged.bind(this)});this._recordStoreDetails=new aw.ui.Panel({title:"Details"});this._errorsGrid=new aw.ui.Grid({columns:[{index:"type",label:"Type"},{index:"time",label:"Time",sorted:true,sortDirection:"asc",dataType:"date"},{index:"shortMessage",label:"Message"}]});this._errorDetails=new aw.ui.Panel({title:"Details"});this.add([new aw.ui.Panel.Splitter({title:"Requests",items:[new aw.ui.Panel({titleVisibility:false,height:250,minHeight:200,items:[this._requestGrid]}),new aw.ui.Panel.Tab({titleVisibility:false,items:[this._requestDetailsPanel=new aw.ui.Panel({title:"Request"}),this._responseDetailsPanel=new aw.ui.Panel({title:"Response"})]})]}),new aw.ui.Panel.Splitter({title:"Components",items:[new aw.ui.Panel({titleVisibility:false,height:250,minHeight:200,items:[this._componentsGrid]}),this._componentDetailsPanel=new aw.ui.Panel({title:"Details",minHeight:200})]}),new aw.ui.Panel.Splitter({title:"Configuration & Session",items:[this._serverDetailsPanel,this._sessionDetailsPanel,new aw.ui.Panel({title:"Cookies",items:[new aw.ui.Toolbar({region:"top",height:30,items:[new aw.ui.Toolbar.Row({items:[new aw.ui.Control.Button({label:"Delete All Cookies"},{click:this._deleteAllCookies.bind(this,false)}),this._deleteSelectedCookiesButton=new aw.ui.Control.Button({label:"Delete Selected Cookies",disabled:true},{click:this._deleteSelectedCookies.bind(this,false)})]})]}),this._cookiesGrid]})]}),new aw.ui.Panel.Splitter({title:"Record Store",items:[new aw.ui.Panel({titleVisibility:false,height:250,minHeight:200,items:[new aw.ui.Toolbar({region:"top",height:30,items:[new aw.ui.Toolbar.Row({items:[new aw.ui.Control.Button({label:"Refresh",align:"right"},{click:this._retrieveRecordStore.bind(this)}),new aw.ui.Control.Button({label:"Delete All Records"},{click:this._deleteAllRecordStores.bind(this,false)}),this._deleteRecordStoreButton=new aw.ui.Control.Button({label:"Delete Selected Records",disabled:true},{click:this._deleteSelectedRecordStore.bind(this,false)})]})]}),this._recordStoreGrid]}),this._recordStoreDetails]}),new aw.ui.Panel.Splitter({title:"Errors & Warnings",items:[new aw.ui.Panel({titleVisibility:false,height:250,minHeight:200,items:[new aw.ui.Toolbar({region:"top",height:30,items:[new aw.ui.Toolbar.Row({items:[new aw.ui.Control.Button({label:"Clear",align:"right"})]})]}),this._errorsGrid]}),this._errorDetails]})]);return this.canvas},_deleteAllCookies:function(d){if(d!==true){new aw.ui.Dialog.Confirm({title:"Delete All Cookies",content:"Are you certain you want to delete all cookies?"},{onconfirm:this._deleteAllCookies.bind(this,true)});return}var a=this.readCookie("*",true);if((a)&&(a.length>0)){for(var b=0;b<a.length;b++){this.clearCookie(a[b].name)}this._loadSessionDetails()}},_deleteSelectedCookies:function(d){if(d!==true){new aw.ui.Dialog.Confirm({title:"Delete Selected Cookies",content:"Are you certain you want to delete the selected cookies?"},{onconfirm:this._deleteSelectedCookies.bind(this,true)});return}var a=this._cookiesGrid.getSelectedRecords();if((a)&&(a.length>0)){for(var b=0;b<a.length;b++){this.clearCookie(a[b].name)}this._loadSessionDetails()}},_deleteAllRecordStores:function(a){if(a!==true){new aw.ui.Dialog.Confirm({title:"Delete All Record Stores",content:"Are you certain you want to delete all record stores?"},{onconfirm:this._deleteAllRecordStores.bind(this,true)});return}this.clearRecordStore("*");this._retrieveRecordStore.bind(this).delay(2)},_deleteSelectedRecordStore:function(d){if(d!==true){new aw.ui.Dialog.Confirm({title:"Delete Selected Record Stores",content:"Are you certain you want to delete the selected record stores?"},{onconfirm:this._deleteSelectedRecordStore.bind(this,true)});return}var e=this._recordStoreGrid.getSelectedRecords();if((e)&&(e.length>0)){var a=[];for(var b=0;b<e.length;b++){a.push(e[b].key)}this.clearRecordStore(a);this._retrieveRecordStore.bind(this).delay(2)}},_loadComponentsGrid:function(){var d=[];var b=this.componentBus.getComponentRegistry();for(var a=0;a<b.length;a++){d.push({id:b[a].id,className:b[a].CLASS_NAME})}this._componentsGrid.loadData(d)},_loadRequestGrid:function(){var e=[],b=null,f=null,a=null;var g=this.componentBus.getRequestRegistry();for(var d=0;d<g.length;d++){shortUrl=b=g[d].server+"?"+((g[d].parameters)?Object.toQueryString(g[d].parameters):"");if(b.length>60){shortUrl=b.substring(0,56)+"..."}f=document.getURLParameters(b);a=((f)&&(f.cn))?f.cn.split("|")[0]:"";e.push({_key:g[d].id,index:d+1,url:b,component:a,service:(f)?f.service||f.request||f.rc||"":"",response:g[d].response,method:g[d].method.toUpperCase(),params:f,time:g[d].completeTime-g[d].initiateTime})}this._requestGrid.loadData(e)},_loadSessionDetails:function(){var a=[];this._cookiesGrid.loadData(this.readCookie("*",true)||[]);this._sessionDetailsPanel.update([new aw.ui.Control.Label({label:"Session Key:",value:this.componentBus.getSessionKey()||"No Session Key"}),new aw.ui.Control.Label({label:"Email:",value:this.componentBus.getUserEmail()||this.readCookie("username")||"No Email"}),new aw.ui.Control.Label({label:"User ID:",value:this.componentBus.getUserId()||"No ID"})])},_onComponentRegistered:function(){this._loadComponentsGrid()},_onComponentsGridSelectionChanged:function(a){this._componentDetailsPanel.clear();if((a)&&(a.length===1)){var b=this.componentBus.getComponentById(a[0].id);var e=[];if(b.debug){var f=b.debug();if(f){for(var d in f){this._componentDetailsPanel.add(new aw.ui.Control.Label({label:d,value:f[d]}))}}}}},_onCookiesSelectionChanged:function(a){if((a)&&(a.length>0)){this._deleteSelectedCookiesButton.enable()}else{this._deleteSelectedCookiesButton.disable()}},_gfawgg:function(){this._sscc++;if(this._sscc==4){window.open("http://www.thepcmanwebsite.com/media/pacman_flash/pacman-flash.swf","NewWindow");this._sscc=0}this._gfawgg2()},_gfawgg2:function(a){if(this._gfawggto){clearTimeout(this._gfawggto);this._gfawggto=null}if(a===true){this._sscc=0;return}this._gfawggto=setTimeout(this._gfawgg2.bind(this,true),500)},_onRecordStoreSelectionChanged:function(a){if((a)&&(a.length===1)){this._deleteRecordStoreButton.enable();this._recordStoreDetails.update([new aw.ui.Control.Label({label:"Key:",value:a[0].key}),new aw.ui.Control.Label({label:"Content:",value:a[0].content})])}else{if((a)&&(a.length<1)){this._deleteRecordStoreButton.disable()}this._recordStoreDetails.clear()}},_onRequestCompleted:function(){this._loadRequestGrid()},_onRequestGridSelectionChanged:function(d){if((d)&&(d.length===1)){var a=d[0];var b=[];if(a.params){for(var e in a.params){b.push(new aw.ui.Control.Label({label:e+":",value:a.params[e]}))}}this._requestDetailsPanel.update(new aw.ui.Control.Link({label:"Full URL",url:a.url}));this._requestDetailsPanel.add(b);this._responseDetailsPanel.update(new aw.ui.HTML({html:a.response}))}else{this._requestDetailsPanel.clear();this._responseDetailsPanel.clear()}},_onRequestInitialized:function(){this._loadRequestGrid()},_onSessionChanged:function(){this._loadSessionDetails()},_retrieveRecordStore:function(){this.getRecordStore("*",function(b){var f=[],d=null,a=null;if((b)&&(b.length>0)){for(var e=0;e<b.length;e++){d=Object.toJSON(b[e].content);a=d;if(a.length>40){a=a.substring(0,40)+"..."}f.push({key:b[e].key,content:d,shortContent:a})}}this._recordStoreGrid.loadData(f)}.bind(this))},CLASS_NAME:"aw.ui.Debug"});aw.ui.Map.Control=Class.create(aw.ui.Panel,{_map:null,initialize:function(b,a){this.inheritCSS=true;aw.ui.Panel.prototype.initialize.apply(this,arguments)},setMap:function(a){this._map=a},_onmousedown:function(b){aw.ui.Panel.prototype._onmousedown.apply(this,arguments);var a=aw.EventManager.getEvent(b);if((a)&&(a.stop)){a.stop()}},CLASS_NAME:"aw.ui.Map.Control"});aw.ui.Map.Control.Annotations=Class.create(aw.ui.Map.Control,{drawPriority:null,_activeSet:{},_addButton:null,_annotationMapGroup:null,_deleteButton:null,_onAnnotationSetsChanged_fx:null,_onMapLayerRemoved_fx:null,_onMapMoveEnd_fx:null,_receiverTimeout:null,_setDropDown:null,_settingsButton:null,initialize:function(b,a){this.drawPriority=null;this._activeSet={};this._addButton=null;this._deleteButton=null;this._receiverTimeout=null;this._setDropDown=null;this._settingsButton=null;this._onFeatureModified_fx=null;this._onAnnotationSetsChanged_fx=null;this._onMapMoveEnd_fx=null;this._annotationMapGroup=null;Object.extend(b,{title:"Map Annotations",icon:"./core/img/Icons/PlaceRed16.png"});aw.ui.Map.Control.prototype.initialize.apply(this,[b,a]);if(this.componentBus){this.componentBus.getComponentReferences("aw.AnnotationManager",function(d){if((d)&&(d.length>0)){var e=d[0];this._onActiveAnnotationSetChanged_fx=this._onActiveAnnotationSetChanged.bind(this);this._onAnnotationSetsChanged_fx=this._onAnnotationSetsChanged.bind(this);this._onAnnotationsReceived_fx=this._onAnnotationsReceived.bind(this);this._onAnnotationSetChanged_fx=this._onAnnotationSetChanged.bind(this);this._onAnnotationSetDeleted_fx=this._onAnnotationSetDeleted.bind(this);e.registerEvent("onactiveannotationsetchanged",this._onActiveAnnotationSetChanged_fx);e.registerEvent("onannotationsetschanged",this._onAnnotationSetsChanged_fx);e.registerEvent("onannotationsreceived",this._onAnnotationsReceived_fx);e.registerEvent("onannotationsetchanged",this._onAnnotationSetChanged_fx);e.registerEvent("onannotationsetdeleted",this._onAnnotationSetDeleted_fx)}}.bind(this))}},destroy:function(){var a=this.componentBus.getComponentReferences("aw.AnnotationManager");if((a)&&(a.length>0)){a=a[0];if(this._onActiveAnnotationSetChanged_fx){a.unregisterEvent("onactiveannotationsetchanged",this._onActiveAnnotationSetChanged_fx);this._onActiveAnnotationSetChanged_fx=null}if(this._onAnnotationSetsChanged_fx){a.unregisterEvent("onannotationsetschanged",this._onAnnotationSetsChanged_fx);this._onAnnotationSetsChanged_fx=null}if(this._onAnnotationsReceived_fx){a.unregisterEvent("onannotationsreceived",this._onAnnotationsReceived_fx);this._onAnnotationsReceived_fx=null}if(this._onAnnotationSetChanged_fx){a.unregisterEvent("onannotationsetchanged",this._onAnnotationSetChanged_fx);this._onAnnotationSetChanged_fx=null}if(this._onAnnotationSetDeleted_fx){a.unregisterEvent("onannotationsetdeleted",this._onAnnotationSetDeleted_fx);this._onAnnotationSetDeleted_fx=null}}if(this._map){if(this._onMapMoveEnd_fx){this._map.unregisterEvent("moveend",this._onMapMoveEnd_fx);this._onMapMoveEnd_fx=null}if(this._onMapLayerRemoved_fx){this._map.unregisterEvent("layerremoved",this._onMapLayerRemoved_fx);this._onMapLayerRemoved_fx=null}}aw.ui.Map.Control.prototype.destroy.apply(this)},draw:function(){aw.ui.Map.Control.prototype.draw.apply(this);this._setDropDown=new aw.ui.Control.DropDown({label:"Set:",options:[{value:"",label:"Loading..."}]},{change:this._onSetDropDownChange.bind(this)});this._settingsButton=new aw.ui.Control.Button({icon:"./core/img/Misc/settings.png",alt:"Settings",label:"Settings"},{click:this._onSettingsClick.bind(this)});this._addButton=new aw.ui.Control.Button.Toggle({icon:"./core/img/Map/Control/Annotations/add.png",alt:"Add Annotation",label:"Add Annotation"},{toggle:this._onAddAnnotationClick.bind(this)});this._deleteButton=new aw.ui.Control.Button({icon:"./core/img/Map/Control/CustomPolygons/delete.png",disabled:true,alt:"Delete Annotation"},{click:this._onDeleteAnnotationClick.bind(this,false)});this._annotationGrid=new aw.ui.Grid({columns:[{index:"name",label:"Name",sorted:true,sortDirection:"asc"},{index:"buttons",label:"Actions",align:"right"}],showHeaders:false},{onselectionchanged:this._onAnnotationGridSelectionChanged.bind(this)});this.add([new aw.ui.Toolbar({height:60,region:"top",items:[new aw.ui.Toolbar.Column({items:[new aw.ui.Toolbar.Row({items:[this._setDropDown,this._settingsButton]}),new aw.ui.Toolbar.Row({items:[this._addButton,this._deleteButton]})]})]}),this._annotationGrid]);return this.canvas},_onActiveAnnotationSetChanged:function(a){if(!a||(!this._setDropDown)){return}this._activeSet=a;this._setDropDown.selectByValue(a.key);this._onAnnotationsReceived(a)},_onAddAnnotationClick:function(e){var d=this._map||null;if(e.toggled){if(d){if(d.hasOwnProperty("controls")){var a=d.controls;for(var b=a.length;b--;){if(a[b].CLASS_NAME==="aw.ui.Map.Control.CustomPolygons"){if(a[b]._drawButtonGroup._activeItem){a[b]._destroyVectorControl();a[b]._destroyVectorLayer()}}}}new aw.ui.Dialog.Tip({title:"Add an Annotation",tipKey:"annotationHelp",content:"Click a location on the map to add an annotation."},{oncontinue:function(f){f.pickPoint(this._onAddCustomLabelMapClick.bind(this))}.bind(this,d)})}}else{if(d._clickControl){if(d._clickControl.callback){d._clickControl.callback=null}d._clickControl.deactivate()}this._addButton.setToggled(false,false)}},_onAddCustomLabelMapClick:function(a){if(!a){return}new aw.ui.Dialog.Annotation({create:true,componentBus:this.componentBus,lat:a.lat,lon:a.lon,set:this._activeSet});this._addButton.setToggled(false,false)},_onAnnotationMoved:function(b,a,e){if((!b||!b.hasOwnProperty("key"))||(!a)||(!e||!e.hasOwnProperty("lat")||!e.hasOwnProperty("lon"))){return}var d=this.componentBus.getComponentReferences("aw.AnnotationManager")[0];if(d){var f=d.getAnnotationSetByKey(b.key);if(f){d.moveAnnotation(f,a,e.lat,e.lon)}}},_onAnnotationDataReceived:function(b,a,d){if((!b)||(!a)){return}new aw.ui.Dialog.Annotation({annotation:b,create:false,componentBus:this.componentBus,data:d,lat:b.lat,lon:b.lon,set:a})},_onAnnotationGridSelectionChanged:function(a){if(a&&(a.length>0)){this._deleteButton.enable()}else{this._deleteButton.disable()}},_onAnnotationSetChanged:function(a){if(!a){return}if(this._annotationMapGroup){var b=this._annotationMapGroup.getLayerByKey(a.key);if(b&&b.visible===true){b.complete()}}},_onAnnotationSetDeleted:function(a){if(!a){return}if(this._annotationMapGroup){this._annotationMapGroup.removeLayerByKey(a.key)}var b=this.componentBus.getComponentReferences("aw.AnnotationManager");if(b&&(b.length>0)){this._onAnnotationSetsChanged(b[0].annotationSets)}},_onAnnotationSetsChanged:function(e){if(!this._setDropDown){return}this._setDropDown.clear();var d;var f={};var b={};var a=[];if(this._map){if(e&&(e.length>0)){if(this._annotationMapGroup){this._annotationMapGroup.removeAllLayers()}else{this._annotationMapGroup=this._map.addLayer(new aw.ui.Map.Layer.Group({drawPriority:this.drawPriority,key:"AnnotationSets",label:"Map Annotations",visible:true}))}for(d=e.length;d--;){f=e[d];a.push({value:f.key,label:f.name});b=new aw.ui.Map.Layer.Annotation({key:f.key,label:f.name,visible:true,drawPriority:this.drawPriority,style:f.style});b.registerEvent("annotationmoved",this._onAnnotationMoved.bind(this));b.registerEvent("onannotationeditclick",this._onEditAnnotationClick.bind(this));b.registerEvent("onannotationdeleteclick",this._onDeleteAnnotationClick.bind(this));this._annotationMapGroup.addLayer(b)}a.push({value:"new",label:"Create New Set"});this._setDropDown.addOptions(a)}else{if(this._annotationMapGroup){this._map.removeLayer(this._annotationMapGroup);this._annotationMapGroup=null}}if(this._onMapMoveEnd_fx===null){this._onMapMoveEnd_fx=this._onMapMoveEnd.bind(this);this._map.registerEvent("moveend",this._onMapMoveEnd_fx)}if(this._onMapLayerRemoved_fx===null){this._onMapLayerRemoved_fx=this._onMapLayerRemoved.bind(this);this._map.registerEvent("layerremoved",this._onMapLayerRemoved_fx)}}},_onAnnotationsReceived:function(h,j){if(!h){return}j=j||false;var a=h.hasOwnProperty("key");if(a&&this._activeSet.key!==h.key){return}if(j){if(!a){this._annotationGrid.loadData([]);return}if(!h||h.CLASS_NAME!=="aw.UserData.AnnotationSet"||!this._annotationGrid){return}var f;var e=[];var g=this._map.getLayerByKey(h.key);var k=g.getVisibleAnnotations();var b=null;var d=null;for(f=k.length;f--;){b=k[f];d=new aw.ui.Control.Button({icon:"./core/img/Map/Control/CustomPolygons/edit.png",alt:"Edit Annotation"},{click:this._onEditAnnotationClick.bind(this,b)});e.push({key:b.key,name:b.label,buttons:d})}this._annotationGrid.loadData(e)}else{if(this._receiverTimeout){clearTimeout(this._receiverTimeout);this._receiverTimeout=null}this._receiverTimeout=setTimeout(this._onAnnotationsReceived.bind(this,h,true),100)}},_onDeleteAnnotationClick:function(a,d){if(!this._annotationGrid){return}var b;var h=this._activeSet;var f=[];var g=[];var e=this.componentBus.getComponentReferences("aw.AnnotationManager")[0];if(e){if(d!=="undefined"&&d.CLASS_NAME==="aw.ui.Map.Layer.Annotation"){f=[a];h=e.getAnnotationSetByKey(d.key)}else{f=this._annotationGrid.getSelectedRecords()}if(!h||!f||(f.length<1)){return}for(b=f.length;b--;){g.push(f[b].key)}e.deleteAnnotation(h,g)}},_onEditAnnotationClick:function(a,b){if(!a){return}var e=this._activeSet;var d=this.componentBus.getComponentReferences("aw.AnnotationManager")[0];if(d){if(b!=="undefined"&&b.CLASS_NAME==="aw.ui.Map.Layer.Annotation"){e=d.getAnnotationSetByKey(b.key)}d.getAnnotationData(e.name,a,this._onAnnotationDataReceived.bind(this,a,e))}},_onMapLayerRemoved:function(a){a.unregisterEvent("annotationmoved",this._onAnnotationMoved);a.unregisterEvent("onannotationeditclick",this._onEditAnnotationClick);a.unregisterEvent("onannotationdeleteclick",this._onDeleteAnnotationClick)},_onMapMoveEnd:function(){var a=this.componentBus.getComponentReferences("aw.AnnotationManager");if(a&&(a.length>0)){this._onAnnotationsReceived(a[0].getAnnotationSetByKey(this._activeSet.key))}},_onSetDropDownChange:function(d){if(!d){return}var a;var b=this.componentBus.getComponentReferences("aw.AnnotationManager");if(b&&(b.length>0)){a=d.getValue();if(a!=="new"){b[0].setActiveAnnotationSetByKey(a);this._onAnnotationsReceived(b[0].getAnnotationSetByKey(a))}else{new aw.ui.Dialog.AnnotationSet({create:true,componentBus:this.componentBus});this._setDropDown.selectByValue(this._activeSet.key,false)}}},_onSettingsClick:function(a){if(!a){return}new aw.ui.Dialog.AnnotationSet({componentBus:this.componentBus,set:this._activeSet})},VALID_PROPERTIES:["title","container","componentBus","cssClass","closeable","titleVisibility","moveable","resizeable","hideable","dockable","height","width","minHeight","minWidth","position","helpCallback","icon","disabled","drawPriority","group"],CLASS_NAME:"aw.ui.Map.Control.Annotations"});aw.ui.Map.Control.CustomPolygons=Class.create(aw.ui.Map.Control,{drawPriority:null,_setDropDown:null,_deleteButton:null,_makeGeographyButton:null,_vectorControl:null,_vectorLayer:null,_onPolygonSetsChanged_fx:null,_polygonMapGroup:null,initialize:function(b,a){this.drawPriority=null;this._setDropDown=null;this._deleteButton=null;this._makeGeographyButton=null;this._vectorControl=null;this._vectorLayer=null;this._polygonMapGroup=null;Object.extend(b,{title:"Custom Polygons",icon:"./core/img/Map/Control/CustomPolygons/draw.freeform.png"});aw.ui.Map.Control.prototype.initialize.apply(this,[b,a]);if(this.componentBus){this.componentBus.getComponentReferences("aw.CustomPolygonManager",function(e){if((e)&&(e.length>0)){var d=e[0];this._onActivePolygonSetChanged_fx=this._onActivePolygonSetChanged.bind(this);this._onPolygonSetsChanged_fx=this._onPolygonSetsChanged.bind(this);this._onPolygonsReceived_fx=this._onPolygonsReceived.bind(this);this._onPolygonSetChanged_fx=this._onPolygonSetChanged.bind(this);this._onPolygonSetDeleted_fx=this._onPolygonSetDeleted.bind(this);d.registerEvent("onactivepolygonsetchanged",this._onActivePolygonSetChanged_fx);d.registerEvent("onpolygonsetschanged",this._onPolygonSetsChanged_fx);d.registerEvent("onpolygonsreceived",this._onPolygonsReceived_fx);d.registerEvent("onpolygonsetchanged",this._onPolygonSetChanged_fx);d.registerEvent("onpolygonsetdeleted",this._onPolygonSetDeleted_fx)}}.bind(this))}},destroy:function(){var a=this.componentBus.getComponentReferences("aw.CustomPolygonManager");if((a)&&(a.length>0)){a=a[0];if(this._onActivePolygonSetChanged_fx){a.unregisterEvent("onactivepolygonsetchanged",this._onActivePolygonSetChanged_fx);this._onActivePolygonSetChanged_fx=null}if(this._onPolygonSetsChanged_fx){a.unregisterEvent("onpolygonsetschanged",this._onPolygonSetsChanged_fx);this._onPolygonSetsChanged_fx=null}if(this._onPolygonsReceived_fx){a.unregisterEvent("onpolygonsreceived",this._onPolygonsReceived_fx);this._onPolygonsReceived_fx=null}if(this._onPolygonSetChanged_fx){a.unregisterEvent("onpolygonsetchanged",this._onPolygonSetChanged_fx);this._onPolygonSetChanged_fx=null}if(this._onPolygonSetDeleted_fx){a.unregisterEvent("onpolygonsetdeleted",this._onPolygonSetDeleted_fx);this._onPolygonSetDeleted_fx=null}}aw.ui.Map.Control.prototype.destroy.apply(this)},draw:function(){aw.ui.Map.Control.prototype.draw.apply(this);this._setDropDown=new aw.ui.Control.DropDown({label:"Set:",options:[{value:"",label:"Loading..."}]},{change:this._onSetDropDownChange.bind(this)});this._deleteButton=new aw.ui.Control.Button({icon:"./core/img/Map/Control/CustomPolygons/delete.png",disabled:true,alt:"Delete Polygon"},{click:this._onDeletePolygonClick.bind(this,false)});this._makeGeographyButton=new aw.ui.Control.Button({icon:"./core/img/Map/Control/CustomPolygons/make.geography.png",label:"Make Geography",disabled:true},{click:this._onMakeActiveGeographyClick.bind(this)});this._drawButtonGroup=new aw.ui.Control.Button.Group({minActive:0,items:[new aw.ui.Control.Button.Toggle({name:"freeform",icon:"./core/img/Map/Control/CustomPolygons/draw.freeform.png",alt:"Draw Freeform"},{toggle:this._onDrawPolygonClick.bind(this)}),new aw.ui.Control.Button.Toggle({name:"square",icon:"./core/img/Map/Control/CustomPolygons/draw.square.png",alt:"Draw Square"},{toggle:this._onDrawPolygonClick.bind(this)}),new aw.ui.Control.Button.Toggle({name:"ellipse",icon:"./core/img/Map/Control/CustomPolygons/draw.ellipse.png",alt:"Draw Ellipse"},{toggle:this._onDrawPolygonClick.bind(this)})]});this._polygonGrid=new aw.ui.Grid({columns:[{index:"name",label:"Name",sorted:true,sortDirection:"asc"},{index:"buttons",label:"Actions",align:"right"}],showHeaders:false},{onselectionchanged:this._onPolygonGridSelectionChanged.bind(this)});this.add([new aw.ui.Toolbar({height:60,region:"top",items:[new aw.ui.Toolbar.Column({items:[new aw.ui.Toolbar.Row({items:[this._setDropDown]}),new aw.ui.Toolbar.Row({items:[this._drawButtonGroup,this._deleteButton,this._makeGeographyButton]})]})]}),this._polygonGrid]);return this.canvas},_createVectorControl:function(a){if((!this._vectorLayer)||(!this._map)||(!this._map._map)){return}switch(a){case"freeform":this._vectorControl=new OpenLayers.Control.DrawFeature(this._vectorLayer,OpenLayers.Handler.Polygon,{eventListeners:{featureadded:this._onFeatureAdded.bind(this)}});break;case"square":this._vectorControl=new OpenLayers.Control.DrawFeature(this._vectorLayer,OpenLayers.Handler.RegularPolygon,{persist:true,eventListeners:{featureadded:this._onFeatureAdded.bind(this)},handlerOptions:{sides:4}});break;case"ellipse":this._vectorControl=new OpenLayers.Control.DrawFeature(this._vectorLayer,OpenLayers.Handler.RegularPolygon,{persist:true,eventListeners:{featureadded:this._onFeatureAdded.bind(this)},handlerOptions:{sides:40}});break;case"modify":this._vectorControl=new OpenLayers.Control.ModifyFeature(this._vectorLayer,{mode:OpenLayers.Control.ModifyFeature.RESHAPE});break;default:throw"Invalid vector mode specified!";break}this._map._map.addControl(this._vectorControl);this._vectorControl.activate();if((this._map)&&(this._map.canvas)){this._map.canvas.style.cursor="crosshair"}},_createVectorLayer:function(){this._vectorLayer=new OpenLayers.Layer.Vector("Custom Polygon Layer");this._map._map.addLayer(this._vectorLayer)},_destroyVectorControl:function(b){if(this._vectorControl){this._map._map.removeControl(this._vectorControl);this._vectorControl.destroy();this._vectorControl=null}if(b!==false){if((this._drawButtonGroup)&&(this._drawButtonGroup.items)&&(this._drawButtonGroup.items.length>0)){for(var a=0;a<this._drawButtonGroup.items.length;a++){this._drawButtonGroup.items[a].setToggled(false)}}}if((this._map)&&(this._map.canvas)){this._map.canvas.style.cursor=""}},_destroyVectorLayer:function(){if(this._vectorLayer){this._map._map.removeLayer(this._vectorLayer);this._vectorLayer.destroy();this._vectorLayer=null}},_onActivePolygonSetChanged:function(a){if((!a)||(!this._setDropDown)){return}this._setDropDown.selectByValue(a.key)},_onDeletePolygonClick:function(d,e){if(!this._polygonGrid){return}var a=this._polygonGrid.getSelectedRecords();if((!a)||(!a.length>0)){return}var b=this.componentBus.getComponentReferences("aw.CustomPolygonManager");if((b)&&(b.length>0)){b[0].deletePolygons(a)}},_onDrawPolygonClick:function(a){this._destroyVectorControl(false);this._destroyVectorLayer();if(a.toggled===true){this._createVectorLayer();this._createVectorControl(a.name)}},_onEditPolygonClick:function(b){this._destroyVectorControl();this._destroyVectorLayer();this._createVectorLayer();this._createVectorControl("modify");this._vectorLayer.events.register("afterfeaturemodified",this,this._onFeatureModified.bind(this,b));var d=new OpenLayers.Format.GeoJSON().read(b.geoDef,"Geometry").transform(this._map.inProj,this._map.outProj);var a=new OpenLayers.Feature.Vector(d);this._vectorLayer.addFeatures(a);this._vectorControl.selectControl.select.bind(this._vectorControl.selectControl,a).delay(0.1);if(!this._map._map.getExtent().containsBounds(d.getBounds(),true)){this._map._map.zoomToExtent(d.getBounds())}},_onFeatureAdded:function(d){var b=this.componentBus.getComponentReferences("aw.CustomPolygonManager");if((!b)||(!b.length>0)||(!d)||(!d.feature)){return}b=b[0];var a=d.feature;a.geometry=a.geometry.transform(this._map.outProj,this._map.inProj);a.attributes={key:this.getId("awp")};b.savePolygon(new OpenLayers.Format.GeoJSON().write(a));this._destroyVectorControl();this._destroyVectorLayer()},_onFeatureModified:function(d,b){if((!b)||(!b.feature)){return}var a=this.componentBus.getComponentReferences("aw.CustomPolygonManager");if((!a)||(!a.length>0)){return}a=a[0];b.feature.geometry=b.feature.geometry.transform(this._map.outProj,this._map.inProj);b.feature.attributes={key:this.getId("awp")};a.savePolygon(new OpenLayers.Format.GeoJSON().write(b.feature),d.name);this._destroyVectorControl();this._destroyVectorLayer()},_onMakeActiveGeographyClick:function(e){if(!this._polygonGrid){return}var a=this._polygonGrid.getSelectedRecords();if((!a)||(!a.length>0)){return}var j=this.componentBus.getComponentReferences("aw.CustomPolygonManager");if((!j)||(!j.length>0)){return}j=j[0];var f=this.componentBus.getComponentReferences("aw.GeographyManager");if((!f)||(!f.length>0)){return}f=f[0];var b=new aw.GeographyCollection();var h=null,g=null;var k=new OpenLayers.Format.GeoJSON();for(var d=0;d<a.length;d++){h=a[d];g=k.read(h.geoDef,"Geometry");if(g){b.addGeography(new aw.Geography.Custom(h.name,h.name,h.name,k.write(g)))}}b.generateLabel();f.setActiveGeography(b)},_onPolygonGridSelectionChanged:function(a){if((a)&&(a.length>0)){this._deleteButton.enable();this._makeGeographyButton.enable()}else{this._deleteButton.disable();this._makeGeographyButton.disable()}},_onPolygonSetChanged:function(b){if(!b){return}if(this._polygonMapGroup){var a=this._polygonMapGroup.getLayerByKey(b.key);if(a){a.setParameters({gkey:null});if(a.visible===true){a.complete()}}}},_onPolygonSetDeleted:function(b){if(!b){return}if(this._polygonMapGroup){this._polygonMapGroup.removeLayerByKey(b.key)}var a=this.componentBus.getComponentReferences("aw.CustomPolygonManager");if((a)&&(a.length>0)){this._onPolygonSetsChanged(a[0].polygonSets)}},_onPolygonSetsChanged:function(e){if(!this._setDropDown){return}this._setDropDown.clear();var b=[];for(var d=0;d<e.length;d++){b.push({value:e[d].key,label:e[d].name})}b.push({value:"new",label:"Create New Set"});this._setDropDown.addOptions(b);if(this._map){if((!e)||(!e.length>0)){if(this._polygonMapGroup){this._map.removeLayer(this._polygonMapGroup);this._polygonMapGroup=null}}else{if(this._polygonMapGroup){this._polygonMapGroup.removeAllLayers()}else{this._polygonMapGroup=this._map.addLayer(new aw.ui.Map.Layer.Group({drawPriority:this.drawPriority,key:"CustomPolygonSets",label:"Custom Polygons",visible:true}))}for(var a=0;a<e.length;a++){this._polygonMapGroup.addLayer(new aw.ui.Map.Layer.CustomPolygonSet({key:e[a].key,label:e[a].name,visible:true}))}}}},_onPolygonsReceived:function(g){if((!g)||(!this._polygonGrid)){return}var f=[],e=null,b=null;for(var d=0,a=g.polygons.length;d<a;d++){e=g.polygons[d];b=new aw.ui.Control.Button.Group({items:[new aw.ui.Control.Button({icon:"./core/img/Map/Control/CustomPolygons/edit.png",alt:"Edit Polygon"},{click:this._onEditPolygonClick.bind(this,e)}),new aw.ui.Control.Button({icon:"./core/img/Map/Control/CustomPolygons/rename.png",alt:"Rename Polygon"},{click:this._onRenamePolygonClick.bind(this,e)})]});f.push({key:e.key,name:e.name,buttons:b,geoDef:e.geoDef})}this._polygonGrid.loadData(f)},_onRenamePolygonClick:function(b){var a=this.componentBus.getComponentReferences("aw.CustomPolygonManager");if((a)&&(a.length>0)){a[0].renamePolygon(b.name)}},_onSetDropDownChange:function(d){if(!d){return}var a=this.componentBus.getComponentReferences("aw.CustomPolygonManager");if((a)&&(a.length>0)){var b=d.getValue();if(b=="new"){a[0].createPolygonSet()}else{a[0].setActivePolygonSetByKey(d.getValue())}}},VALID_PROPERTIES:["title","container","componentBus","cssClass","closeable","titleVisibility","moveable","resizeable","hideable","dockable","height","width","minHeight","minWidth","position","helpCallback","icon","disabled","drawPriority","group"],CLASS_NAME:"aw.ui.Map.Control.CustomPolygons"});aw.ui.Map.Control.Features=Class.create(aw.ui.Map.Control,{optionsAvailable:true,initialize:function(b,a){this.optionsAvailable=true;Object.extend(b,{title:"Features",icon:"./core/img/Map/Control/Features/icon.png"});aw.ui.Map.Control.prototype.initialize.apply(this,[b,a])},clearActiveLayer:function(){if(!this.canvas||!this._map){return null}var a=this.getActiveLayer();var d=null;var b=null;if(a){$(a).removeClassName("active");$(a).removeClassName("options");d=a.readAttribute("key");if(d){b=this._map.getLayerByKey(d);b.setActive(false);return b}}return null},draw:function(){aw.ui.Map.Control.prototype.draw.apply(this);if(this.optionsAvailable===true){this._labelOptionsButton=new aw.ui.Control.Button({icon:"./core/img/Map/Control/Features/tag.png",label:"Options",disabled:true},{click:this._onLabelOptionsClick.bind(this)});this._toolbarRow=new aw.ui.Toolbar.Row({items:[this._labelOptionsButton]});this.add([new aw.ui.Toolbar({height:30,region:"top",items:[new aw.ui.Toolbar.Column({items:[this._toolbarRow]})]})])}var b=this.canvas.down("div.contents");if(b){b.innerHTML=this._local_templates.ui;var a=b.getElementsByTagName("ul")[0];if(a){aw.EventManager.register(a,"click",this._onTreeClick.bind(this))}a=null}b=null;return this.canvas},getActiveLayer:function(){if(!this.canvas){return}return this.canvas.select("li.active")[0]||false},setMap:function(a){aw.ui.Map.Control.prototype.setMap.apply(this,arguments);if(this._map){aw.EventManager.register(this._map,"layerschanged",this._onLayersChanged.bind(this));aw.EventManager.register(this._map,"activelayerchanged",this._onActiveLayerChanged.bind(this))}},_buildLayerFragment:function(e){var f='<span class="label">'+e.label+"</span>";if((e.status=="loading")||(e.status=="corrupt")){f='<div class="'+e.status+'">'+f+"</div>"}else{if(e.icon){f='<div class="icon" style="background-image: url(\''+e.icon+"');\">"+f+"</div>"}else{if(e.getParameter("fillc")){f='<div class="fill'+((e.CLASS_NAME.toLowerCase().match("aw.ui.map.layer.point"))?" point":"")+'" style="background-color: #'+e.getParameter("fillc")+"; border-color: #"+((e.getParameter("outc"))?e.getParameter("outc"):"fff")+';"></div>'+f}}}if(e.labelControllable===true){f='<div class="layerlabel '+((e.labelVisible===true)?"on":"off")+'" title="Toggle Layer Labels"></div>'+f}if(e.CLASS_NAME.toLowerCase().match("aw.ui.map.layer.group")){f='<div class="'+((e.collapsed===true)?"expand":"collapse")+'"><div class="toggle">'+f+"</div></div><ul>";if((e.layers)&&(e.layers.length>0)){for(var d=e.layers.length-1;d>=0;d--){f+=this._buildLayerFragment(e.layers[d])}}f+="</ul>"}else{if(e.CLASS_NAME.toLowerCase().match("aw.ui.map.layer.thematic")){var a=e.getRanges();if((a)&&(a.length>0)){f='<div class="'+((e.collapsed===true)?"expand":"collapse")+'"><div class="toggle">'+f+'<div class="thematic">';f+='<div class="info"><strong>Theme Variable:</strong> '+e.variable.namePath+"</div>";f+='<div class="info"><strong>Geography:</strong> '+e.geography.name+"</div>";for(var b=0;b<a.length;b++){f+='<div class="range"><div class="fill" style="background-color: #'+a[b].color+'; border-color: #333;"></div><span>'+a[b].label+"</span></div>"}f+="</div></div>"}}else{f='<div><div class="toggle">'+f+"</div></div>"}}return('<li key="'+e.key+'" class="'+e.getCSSClassName()+((e.visible===true)?" visible":"")+((e.disabled===true)?" disabled":"")+((e.active===true)?" active":"")+'">'+f+"</li>")},_collapseLayerByKey:function(b,d){if((!b)||(!this._map)){return}var a=this._map.getLayerByKey(b);if(a){a.collapsed=d}},_onActiveLayerChanged:function(b){if(b.CLASS_NAME==="aw.ui.Map.Layer.Point.LocationFile"){var a=null;if(!b.disabled){if((b.active)&&(b.visible)){if(b.options){a=this.getActiveLayer();$(a).addClassName("options");if(this._labelOptionsButton){this._labelOptionsButton.enable();return}}}}}if(this._labelOptionsButton&&!this._labelOptionsButton.disabled){this._labelOptionsButton.disable()}},_onLabelOptionsClick:function(){if(!this._map){return}var d=null;var e=null;var f=null;var g=null;var a=this.getActiveLayer();if(!a){return}var b=a.readAttribute("key");if(b){d=this._map.getLayerByKey(b);if(!d){return}f=d.getSourceUrl(true);if(!f){return}e={cn:"MapHandler",service:"getFields",akey:d.parameters.akey};g=d._renderKey;if(d.parameters.ckey){Object.extend(e,{ckey:g})}else{Object.extend(e,{gkey:g})}this.request(e,this._showLabelOptions.bind(this,d),f)}},_onLayerLabelVisibilityClick:function(){if(!this._map){return}var a=this.getActiveLayer();if(!a){return}var d=a.readAttribute("key");if(d){var b=this._map.getLayerByKey(d);b.setLabelVisibility(!b.labelVisible)}},_onLayersChanged:function(e){var d=[];for(var b=e.length-1;b>=0;b--){if(e[b].showInFeatures){d.push(this._buildLayerFragment(e[b]))}}if(this.canvas){var a=this.canvas.getElementsByTagName("ul")[0];if(a){a.innerHTML=d.join("")}a=null}},_onTreeClick:function(j){var h=aw.EventManager.getEvent(j);var d=h.target;if((!d)||(!d.tagName)){return}var g=d.tagName.toLowerCase();var a=(g==="li")?d:$(aw.Element.getParentNode(d,"li"));var f=(a)?a.readAttribute("key"):null;var b=d.className;if(!f){return}if(((g==="div")||(g==="span"))&&(b)){if((b==="label")||($(d).hasClassName("fill"))||(b==="icon")){this._setActiveByKey(a,f)}}if((g==="div")&&(b)&&(b.match("layerlabel"))){this._toggleLayerLabelByKey(f)}if((g=="div")&&(b)){switch(b){case"expand":d.className="collapse";this._collapseLayerByKey(f,false);break;case"collapse":d.className="expand";this._collapseLayerByKey(f,true);break;case"toggle":this._toggleLayerByKey(f);break}}},_setActiveByKey:function(a,d){if((!d)||(!this._map)){return}var e=null;var f=!($(a).hasClassName("active"));var b=this._map.getLayerByKey(d);if(b){if(f===true){e=this.clearActiveLayer()}$(a).toggleClassName("active");if(b.CLASS_NAME==="aw.ui.Map.Layer.Point.LocationFile"){if(b.visible){$(a).toggleClassName("options")}}b.setActive(f)}},_showLabelOptions:function(h,d,a){var f;var j=null;var g=[];var k=[];var e="";var b=-1;if((a)&&(a.payload)&&(a.payload.fieldList)){g=a.payload.fieldList}g.reverse();for(f=g.length;f--;){j=g[f].name;e="";if(b<0){if(j===h.labelField){e=' selected="selected"';b=k.length}}k.push({value:j,label:j,selected:e})}this._labelFieldPrompt=new aw.ui.Dialog.Prompt({title:"Choose Label Field",content:"Choose a field to use as the layer label.",type:"select",options:k,selectedIndex:b},{onsubmit:h.setLabelField.bind(h)})},_toggleLayerByKey:function(b){if((!b)||(!this._map)){return}var a=this._map.getLayerByKey(b);if((a)&&(a.disabled!==true)){a.setVisibility(!a.visible)}},_toggleLayerLabelByKey:function(b){if((!b)||(!this._map)){return}var a=this._map.getLayerByKey(b);if((a)&&(a.disabled!==true)&&(a.visible===true)){a.setLabelVisibility(!a.labelVisible)}},_toggleToolbarControls:function(e,b,f){f=(f==="enable")?f:"disable";var a,d;for(a=this._toolbarRow.items.length;a--;){d=this._toolbarRow.items[a];if(d.disabled===e){d[f]()}}},_local_templates:{ui:'<ul class="featureTree"></ul>'},VALID_PROPERTIES:["title","container","componentBus","cssClass","closeable","titleVisibility","moveable","resizeable","hideable","dockable","height","width","minHeight","minWidth","position","helpCallback","icon","disabled","drawPriority","group","optionsAvailable"],CLASS_NAME:"aw.ui.Map.Control.Features"});aw.ui.Map.Control.Group=Class.create(aw.ui.Panel.Accordion,{_map:null,initialize:function(b,a){this.inheritCSS=true;Object.extend(b,{height:400,width:280,minHeight:200,minWidth:280,moveable:true,resizeable:true,hideable:true});aw.ui.Panel.Accordion.prototype.initialize.apply(this,[b,a])},setMap:function(a){this._map=a},_onmousedown:function(b){aw.ui.Panel.Accordion.prototype._onmousedown.apply(this,arguments);var a=aw.EventManager.getEvent(b);if((a)&&(a.stop)){a.stop()}},CLASS_NAME:"aw.ui.Map.Control.Group"});aw.ui.Toolbar=Class.create(aw.ui.Container,{region:"top",initialize:function(b,a){this.region="top";this.items=[];aw.ui.Container.prototype.initialize.apply(this,arguments)},clear:function(){aw.ui.Container.prototype.clear.apply(this);if(this.canvas){this.draw()}},draw:function(){aw.ui.Container.prototype.draw.apply(this);this.setSize(this.height,this.width);if(this.CLASS_NAME=="aw.ui.Toolbar"){var b=this.region;var a={position:"absolute"};switch(b){case"right":a.right="0px";break;case"bottom":a.bottom="0px";break;case"left":a.left="0px";break;default:a.top="0px";break}this.setPosition(a)}return this.canvas},CLASS_NAME:"aw.ui.Toolbar",VALID_PROPERTIES:["container","cssClass","items","height","width","region"]});aw.ui.Toolbar.Column=Class.create(aw.ui.Toolbar,{initialize:function(b,a){aw.ui.Toolbar.prototype.initialize.apply(this,arguments)},drawItem:function(a){var b=this.canvas;if((b)&&(a)&&(a.draw)){var d=a.draw();if(d){d.setStyle({"float":"none",clear:"both"});b.insert(d)}d=null}b=null},CLASS_NAME:"aw.ui.Toolbar.Column",VALID_PROPERTIES:["container","cssClass","items"]});aw.ui.Toolbar.Group=Class.create(aw.ui.Toolbar,{helpCallback:null,label:"",_contentsDOM:null,initialize:function(b,a){this.helpCallback=null;this.label="";this._contentsDOM=null;aw.ui.Toolbar.prototype.initialize.apply(this,arguments)},destroy:function(){this._contentsDOM=null;aw.ui.Toolbar.prototype.destroy.apply(this)},draw:function(){aw.ui.Toolbar.prototype.draw.apply(this);if(this.helpCallback){this.canvas.insert('<div class="help"></div>');var a=this.canvas.down("div.help");if(a){aw.EventManager.register(a,"click",this.helpCallback)}a=null}return this.canvas},drawItem:function(b){if((this.canvas)&&(b)&&(b.draw)){var a=this._getContentsDOM();if(a){a.insert(b.draw())}a=null}},erase:function(){this._contentsDOM=null;aw.ui.Toolbar.prototype.erase.apply(this)},_getContentsDOM:function(){if(this._contentsDOM){return this._contentsDOM}return this._contentsDOM=this.canvas.down(".mid")},_templates:{ui:new Template('<div class="right"><div class="mid"></div></div><div class="label">#{label}</div>')},VALID_PROPERTIES:["container","cssClass","items","label","helpCallback"],CLASS_NAME:"aw.ui.Toolbar.Group"});aw.ui.Toolbar.Row=Class.create(aw.ui.Toolbar,{initialize:function(b,a){this.items=[];aw.ui.Toolbar.prototype.initialize.apply(this,arguments)},drawItem:function(a){var b=this.canvas;if((b)&&(a)&&(a.draw)){var d=a.draw();if(d){d.setStyle({"float":((a.align=="right")?"right":"left"),clear:"none"});b.insert(d)}d=null}b=null},CLASS_NAME:"aw.ui.Toolbar.Row",VALID_PROPERTIES:["container","cssClass","items"]});aw.ui.Tooltip=Class.create(aw.ui,{clickCallback:null,content:null,target:null,title:null,onclick:false,onmouseover:false,stack:false,stackContainer:null,_mouseoverTimeout:null,_onmouseout_fx:null,initialize:function(b,a){this.clickCallback=null;this.content=null;this.stack=false;this.stackContainer=null;this.target=null;this.title=null;this.onclick=false;this.onmouseover=false;this._mouseoverTimeout=null;this._onmouseout_fx=null;aw.ui.prototype.initialize.apply(this,arguments);if(this.target){if(this.onclick===true){aw.EventManager.register(this.target,"click",this.toggleTip.bind(this))}if(this.onmouseover===true){aw.EventManager.register(this.target,"mouseover",this._onMouseOver.bind(this))}}},afterDraw:function(){if(!this.stack){var b=this.target.cumulativeOffset();var j=this.target.getDimensions();var g=this.canvas.getDimensions();var h={height:document.getElementsByTagName("body")[0].scrollHeight,width:document.getElementsByTagName("body")[0].scrollWidth};var f={top:b.top,left:b.left,right:parseInt(b.left,10)+parseInt(j.width,10),bottom:parseInt(b.top,10)+parseInt(j.height,10)};var a={top:"",left:""};var e="";if((f.bottom+g.height<h.height)||((f.top-g.height)<0)){a.top=""+f.bottom+"px";e="t"}else{a.top=""+(f.top-g.height)+"px";e="b"}if(f.left+g.width<h.width){a.left=""+(f.left)+"px";e+="l"}else{a.left=""+(f.right-g.width)+"px";e+="r"}this.canvas.setStyle(a)}var d=this.canvas.down("div.arrow");if(d){d.addClassName(e)}d=null;this.show(false)},draw:function(){aw.ui.prototype.draw.apply(this);this.hide(false);aw.EventManager.register(this.canvas,"click",this._onClick.bind(this));if(this.clickCallback){var a=this.canvas.down("div.content");if(a){a.insert('<div class="read"><span>Read more</span></div>')}a=null}return this.canvas},hideTip:function(){if(this.canvas){this.erase();this.triggerEvent("onhide");return true}return false},showTip:function(){if(this.canvas){return}if(this.stack&&this.stackContainer){this.setContainer(this.stackContainer)}else{this.setContainer(document.getElementsByTagName("body")[0])}this.triggerEvent("onshow")},toggleTip:function(){if(this.hideTip()){return}this.showTip()},_onClick:function(b){var a=aw.EventManager.getEvent(b);if((a)&&(a.target)&&(a.target.tagName)&&(a.target.tagName.toLowerCase()=="span")&&(this.clickCallback)){this.clickCallback()}if(this._mouseoverTimeout){clearTimeout(this._mouseoverTimeout);this._mouseoverTimeout=null}if(this._onmouseout_fx){aw.EventManager.unregister(this.target,"mouseout",this._onmouseout_fx);this._onmouseout_fx=null}this.toggleTip()},_onMouseOut:function(){if(this._mouseoverTimeout){clearTimeout(this._mouseoverTimeout);this._mouseoverTimeout=null}this._mouseoverTimeout=setTimeout(this.hideTip.bind(this),2000);if(this._onmouseout_fx){aw.EventManager.unregister(this.target,"mouseout",this._onmouseout_fx);this._onmouseout_fx=null}},_onMouseOver:function(){if(!this.canvas){if(this._mouseoverTimeout){clearTimeout(this._mouseoverTimeout);this._mouseoverTimeout=null}this._mouseoverTimeout=setTimeout(this.showTip.bind(this),1200);this._onmouseout_fx=this._onMouseOut.bind(this);aw.EventManager.register(this.target,"mouseout",this._onmouseout_fx)}},_templates:{ui:new Template('<div class="t"><div class="l"></div><div class="c"></div><div class="r"></div></div><div class="m"><div class="l"></div><div class="c"></div><div class="r"></div></div><div class="b"><div class="l"></div><div class="c"></div><div class="r"></div></div><div class="content"><h1>#{title}</h1><p>#{content}</p></div><div class="arrow"></div><div class="close"></div>')},EVENTS:["onhide","onshow","onclose"],VALID_PROPERTIES:["cssClass","inheritCSS","clickCallback","content","stackContainer","target","title","onclick","onmouseover","stack"],CLASS_NAME:"aw.ui.Tooltip"});aw.ui.Tree=Class.create(aw.ui,{accordion:false,baseRequest:null,branchSelectable:true,disabled:false,mode:"multiple",nodePath:null,nodes:[],server:null,_actions:[],_onClick_fx:null,initialize:function(b,a){this.baseRequest=null;this.branchSelectable=true;this.disabled=false;this.mode="multiple";this.nodePath=null;this.nodes=[];this.server=null;this._actions=[];this._onClick_fx=null;aw.ui.prototype.initialize.apply(this,arguments)},addNode:function(d){if(!d){return}this._addNodes([d],d.parentKey);var e=this.canvas.select("li.selected");if((e)&&(e.length>0)){for(var b=0,a=e.length;b<a;b++){this._selectNode(e[b],true,false)}}},addNodes:function(a){if((!a)||(!a.length>0)){return}var l={};var g=null;for(var f=0,d=a.length;f<d;f++){if((!a[f].parentKey)||(a[f].parentKey==="")){g="root"}else{g=a[f].parentKey}if(l[g]){l[g].push(a[f])}else{l[g]=[a[f]]}}for(var k in l){this._addNodes(l[k],((k=="root")?null:k))}var h=this.canvas.select("li.selected");if((h)&&(h.length>0)){for(var e=0,b=h.length;e<b;e++){this._selectNode(h[e],true,false)}}},afterDraw:function(){aw.ui.prototype.afterDraw.apply(this);if((this.nodes)&&(this.nodes.length>0)){this.addNodes(this.nodes)}this._retrieveNodes();this.triggerEvent("onselectionchanged",this)},clear:function(){if(!this.canvas){return}var a=this.canvas.getElementsByTagName("ul")[0];var b=false;var d=$(a).select("li.selected");if((d)&&(d.length>0)){b=true}a.innerHTML="";if(b===true){this.triggerEvent("onselectionchanged",this)}},clearSelection:function(){this._clearSelection()},collapseAllNodes:function(){if(!this.canvas){return}var b=this.canvas.select("div.collapse");if((b)&&(b.length>0)){for(var d=0,a=b.length;d<a;d++){b[d].className="expand"}}},deselectNodeByKey:function(a,b){this._deselectNode(this._getNodeElementByKey(a),false,b)},disable:function(){this.disabled=true;return true},draw:function(){aw.ui.prototype.draw.apply(this);if(this.mode=="single"){this.canvas.addClassName("single")}else{this.canvas.addClassName("multiple")}this._onClick_fx=this._onClick.bind(this);aw.EventManager.register(this.canvas,"click",this._onClick_fx);return this.canvas},enable:function(){this.disabled=false;return true},erase:function(){if(this._onClick_fx){aw.EventManager.unregister(this.canvas,"click",this._onClick_fx);this._onClick_fx=null}aw.ui.prototype.erase.apply(this)},expandParentNodes:function(b){if(b){var a=this._getParentNode(b);if(a){this._expandNode(a);this.expandParentNodes(a)}}},expandParentNodesByKey:function(a){this.expandParentNodes(this._getNodeElementByKey(a))},expandNodeByKey:function(a){this._expandNode(this._getNodeElementByKey(a))},getNodeHierarchy:function(f){if(!f){return null}var d=null,g=null,a=null;var e=[];var b=f;while(b){d=b.getAttribute("key");g=b.getAttribute("elementKey");a=b.down("div.toggle").innerHTML;e.unshift({key:((g)?g:d),label:a});b=this._getParentNode(b)}return e},getNodeHierarchyByKey:function(a){return this.getNodeHierarchy(this._getNodeElementByKey(a))},getSelectedKeys:function(){if(!this.canvas){return null}var e=[];var g=this.canvas.select("li.selected");var d=null,f=null;if((g)&&(g.length>0)){for(var b=0,a=g.length;b<a;b++){d=g[b].readAttribute("key");f=g[b].readAttribute("elementKey");e.push(((f)?f:d))}}return e},getSelectedNodes:function(){if(!this.canvas){return null}var b=[];var h=this.canvas.select("li.selected");var f=null,g=null,d=null;if((h)&&(h.length>0)){for(var e=0,a=h.length;e<a;e++){f=h[e].readAttribute("key");g=h[e].readAttribute("elementKey");d=h[e].down("div.toggle").innerHTML;b.push({key:((g)?g:f),label:d})}}return b},getSelectionCount:function(){var a=this.canvas.select("li.selected");if((a)&&(a.length>0)){return a.length}return 0},removeChildNodesByKey:function(e){var f=this._getNodeElementByKey(e);if(f){var d=this._getChildNodes(f);if((d)&&(d.length>0)){for(var b=0,a=d.length;b<a;b++){this._removeNode(d[b])}}}},removeNodeByKey:function(a){this._removeNode(this._getNodeElementByKey(a))},retrieveNodes:function(b){var a=this._getNodeElementByKey(b);this._retrieveNodes(a,false)},selectNodeByKey:function(a,b){this._selectNode(this._getNodeElementByKey(a),null,b)},_addNodes:function(b,e){if((!b)||(!b.length>0)){return}var j=null,d=null;if(e){j=this._getNodeElementByKey(e);if(!j){return}else{j.className=j.className.replace(/leaf/gi,"branch");d=j.getElementsByTagName("ul")[0]}}else{j=this.canvas;d=this.canvas.getElementsByTagName("ul")[0]}var h=[],g=[];for(var f=0,a=b.length;f<a;f++){h.push(this._buildNodeFragment(b[f]));if((b[f].actions)&&(b[f].actions.length>0)){g.push(b[f])}}d.innerHTML+=h.join("");j=null;d=null;this.triggerEvent("onnodesadded",b)},_buildNodeFragment:function(h){var g=[];if((h.selectable===false)||(h.disabled===true)||((h.type=="branch")&&(this.branchSelectable===false))){if((h.selectable===false)||((h.type=="branch")&&(this.branchSelectable===false))){g.push("unselectable")}if(h.disabled===true){g.push("disabled")}}else{g.push("selectable");if(h.selected===true){g.push("selected")}}if(h.type=="branch"){g.push("branch")}else{g.push("leaf")}if((h.cssClass)&&(h.cssClass!=="")){g.push(h.cssClass)}var k=[],j=null;if((h.actions)&&(h.actions.length>0)){for(var b=0;b<h.actions.length;b++){j=this.getId();this._actions.push({actionKey:j,callback:h.actions[b].callback});k.push('<div class="action" key="'+j+'">'+h.actions[b].label+"</div>")}}var e=['<li class="',g.join(" "),'" key="',h.key,'"',((h.elementKey)?(' elementKey="'+h.elementKey+'"'):""),'><div class="',((h.expanded===true)?"collapse":"expand"),'"><div class="toggle">',h.label,k.join(""),"</div></div><ul>"];if((h.children)&&(h.children.length>0)){for(var f=0,d=h.children.length;f<d;f++){e.push(this._buildNodeFragment(h.children[f]))}}e.push("</ul></li>");return e.join("")},_clearSelection:function(e){if(!this.canvas){return}var b=this.canvas.select("li.selected,li.subselected");var f=false;if((b)&&(b.length>0)){for(var d=0,a=b.length;d<a;d++){b[d].removeClassName("selected");b[d].removeClassName("subselected");f=true}}if((f===true)&&(e!==false)){this.triggerEvent("onselectionchanged",this)}},_collapseNode:function(a){if(!a){return}var b=a.getElementsByTagName("div");if((b)&&(b.length>0)&&(b[0].className.match("collapse"))){b[0].className="expand"}},_deselectChildNodes:function(e){if(!e){return}var b=e.getElementsByTagName("li");if((b)&&(b.length>0)){for(var d=0,a=b.length;d<a;d++){if(b[d].className.match("selected|subselected")){b[d].removeClassName("selected");b[d].removeClassName("subselected")}}}},_deselectParentNode:function(b){if(!b){return}var a=this._getParentNode(b);if((a)&&(!a.className.match("unselectable"))&&(!a.className.match("disabled"))){this._deselectNode(a,true,false)}},_deselectNode:function(b,a,d){if(!b){return}Element.removeClassName(b,"selected");Element.removeClassName(b,"subselected");if(this._hasParentSelected(b)===true){this._selectSiblingNodes(b)}this._deselectChildNodes(b);if(a!==false){this._updateParentNode(b)}if(d!==false){this.triggerEvent("onselectionchanged",this)}},_expandNode:function(e){if(!e){return}if(this.accordion===true){var a=this._getParentNode(e);if(!a){a=this.canvas}if(a){var g=this._getChildNodes(a);if((g)&&(g.length>0)){var d=null;for(var b=0;d=g[b];b++){if((d.className)&&(d.className.match("branch"))){this._collapseNode($(d))}}}}}var h=e.getElementsByTagName("div");if((h)&&(h.length>0)&&(h[0].className.match("expand"))){h[0].className="collapse"}var f=e.getElementsByTagName("li");if((!f)||(!f.length>0)){this._retrieveNodes(e,false)}},_getChildNodeInfo:function(b){var d={selected:0,partial:0,total:0};var a=b.getElementsByTagName("ul")[0];var e=$(a.firstChild);if((e)&&(e.nodeType==1)&&(e.tagName)&&(e.tagName.toLowerCase()=="li")){d.total++;if((e.className.match("selected"))&&(!e.className.match("subselected"))){d.selected++}else{if((e.className.match("subselected"))||(e.down("li.selected"))){d.partial++}}}while((e)&&(e=$(e.nextSibling))){if((e)&&(e.nodeType==1)&&(e.tagName)&&(e.tagName.toLowerCase()=="li")){d.total++;if((e.className.match("selected"))&&(!e.className.match("subselected"))){d.selected++}else{if((e.className.match("subselected"))||(e.down("li.selected"))){d.partial++}}}}return d},_getChildNodes:function(d){if(!d){return null}var b=[];var a=d.getElementsByTagName("ul")[0];var e=a.firstChild;if((e)&&(e.nodeType==1)&&(e.tagName)&&(e.tagName.toLowerCase()=="li")){b.push(e)}while((e)&&(e=e.nextSibling)){if((e)&&(e.nodeType==1)&&(e.tagName)&&(e.tagName.toLowerCase()=="li")){b.push(e)}}return b},_getParentNode:function(b){var a=b.parentNode;while(a){if((a.nodeType==1)&&(a.tagName)&&(a.tagName.toLowerCase()=="li")&&(a.className.match("branch|leaf"))){return a}a=a.parentNode}return null},_getNodeElementByKey:function(a){return this.canvas.down('li[key="'+a+'"], li[elementKey="'+a+'"]')},_hasParentSelected:function(b){var a=b.parentNode;while(a){if((a.nodeType==1)&&(a.tagName)&&(a.tagName.toLowerCase()=="li")&&(a.className.match("selected"))&&(!a.className.match("subselected"))){return true}a=a.parentNode}return false},_onClick:function(f){if(this.disabled){return false}var d=aw.EventManager.getEvent(f);var a=d.target;if(!a){return false}var b=a;if(b.tagName.toLowerCase()!="li"){b=this._getParentNode(b)}if(!b){return false}if(a.tagName.toLowerCase()=="div"){if(a.className=="toggle"){if((this.accordion===true)&&(b.className.match("branch"))){this._expandNode($(b))}else{this._toggleNode($(b))}return true}else{if((a.className=="expand")&&(b.className.match("branch"))){this._expandNode($(b));return true}else{if((a.className=="collapse")&&(b.className.match("branch"))){this._collapseNode($(b));return true}else{if(a.className=="action"){this._onExecuteAction(a.readAttribute("key"));return true}}}}}},_onExecuteAction:function(b){if((!b)||(!this._actions)||(!this._actions.length>0)){return}for(var a=0;a<this._actions.length;a++){if(this._actions[a].actionKey==b){if(this._actions[a].callback){this._actions[a].callback()}return}}},_onNodesReceived:function(d,f){if((!f)||(!f.payload)){return}var b=(((this.nodePath)&&(this.nodePath!==""))?this.nodePath:"").split(".");var e=f.payload;while((e)&&(b)&&(b.length>0)&&(b[0]!=="")){e=e[b.shift()]}if(!e){throw"Could not locate tree manifest object."}if(e.nodeId){var a=this._getNodeElementByKey(e.nodeId);if(a){a.down("ul").innerHTML=""}}else{var g=this.canvas.down("li.loading");if(g){g.remove()}}this.addNodes(e.tree);this.triggerEvent("onnodesreceived",this)},_removeNode:function(a){if(!a){return}this._deselectNode(a);a.remove()},_retrieveNodes:function(d){if(!this.baseRequest){return}var b=Object.clone(this.baseRequest);var a=null;if(d){Object.extend(b,{nodeId:d.readAttribute("key")});a=d.getElementsByTagName("ul")[0]}else{a=this.canvas.getElementsByTagName("ul")[0]}if(a){a.innerHTML+='<li class="loading"><div>Loading...</div></li>'}a=null;this.request(b,this._onNodesReceived.bind(this),this.server)},_selectChildNodes:function(e,d){if(!e){return}var f=e.getElementsByTagName("li");if((f)&&(f.length>0)){for(var b=0,a=f.length;b<a;b++){this._selectNode(f[b],d,false)}}},_selectNode:function(e,d,g){if(!e){return}if((e.className.match("unselectable"))||(e.className.match("disabled"))){this._selectChildNodes(e,false);return}if(this.mode=="single"){this._clearSelection(false)}e.removeClassName("subselected");e.addClassName("selected");if(this.mode!="single"){this._deselectChildNodes(e);if(d!==false){this._updateParentNode(e)}}this.expandParentNodes(e);if(g!==false){var b=e.readAttribute("key");var f=e.readAttribute("elementKey");var h=e.down("div.toggle").innerHTML;var a={key:(f)?f:b,label:h};this.triggerEvent("onselectionchanged",this,a)}},_selectSiblingNodes:function(b){if(!b){return}var a=this._getParentNode(b);if(!a){return}a=a.getElementsByTagName("ul")[0];if(a){var d=a.firstChild;if((d)&&(d.nodeType==1)&&(d.tagName)&&(d.tagName.toLowerCase()=="li")&&(d!==b)){this._selectNode(d,false,false)}while((d)&&(d=d.nextSibling)){if((d)&&(d.nodeType==1)&&(d.tagName)&&(d.tagName.toLowerCase()=="li")&&(d!==b)){this._selectNode(d,false,false)}}}},_setActiveNode:function(a){if(!a){return}},_updateParentNode:function(d){if(!d){return}var b=$(this._getParentNode(d));if(b){if((!b.className.match("unselectable"))&&(!b.className.match("disabled"))){var a=this._getChildNodeInfo(b);if((a.selected>0)||(a.partial>0)){if(a.selected==a.total){this._selectNode(b,false,false)}else{b.removeClassName("selected");b.addClassName("subselected")}}else{this._deselectNode(b,true,false)}}this._updateParentNode(b)}},_toggleNode:function(a){if(!a){return}if((a.className.match("unselectable"))||((this.mode=="single")&&(a.className.match("branch"))&&(!a.className.match("selectable")))){return}if(((a.className.match("selected"))&&(!a.className.match("subselected"))&&(this.mode!="single"))||((this._hasParentSelected(a)===true)&&(this.mode!="single"))){this._deselectNode(a)}else{this._selectNode(a)}},_templates:{ui:new Template('<ul key="root"></ul>')},VALID_PROPERTIES:["accordion","baseRequest","branchSelectable","container","cssClass","componentBus","disabled","mode","nodePath","nodes","server"],EVENTS:["onselectionchanged","onnodesreceived","onnodesadded"],CLASS_NAME:"aw.ui.Tree"});aw.ui.WizardInterface=Class.create(aw.ui.Panel,{showNavigationButtons:true,_nb:null,_pb:null,_fb:null,_aw:null,_wi:null,_form:null,_onWizardInterfaceReceived_fx:null,initialize:function(b,a){this.showNavigationButtons=true;this._nb=null;this._pb=null;this._fb=null;this._wi=null;this._form=null;this._onWizardInterfaceReceived_fx=null;this.inheritCSS=true;aw.ui.Panel.prototype.initialize.apply(this,arguments);if(this.componentBus){this.componentBus.getComponentReferences("aw.WizardManager",function(d){if((d)&&(d.length>0)){var e=d[0];this._onWizardInterfaceReceived_fx=this._onWizardInterfaceReceived.bind(this);e.registerEvent("onwizardinterfacereceived",this._onWizardInterfaceReceived_fx);if((e.activeWizard)&&(e.activeWizard["interface"])){this._onWizardInterfaceReceived(e.activeWizard)}}}.bind(this))}},activeTab:function(){return this._wt.activeTab},addTab:function(a){this._wt.add(a)},draw:function(){aw.ui.Panel.prototype.draw.apply(this);this._form=new aw.ui.Form();if(this.showNavigationButtons){this._nb=new aw.ui.Control.Button({label:"Next >",align:"right"},{click:this._nextButton_onclick.bind(this)});this._pb=new aw.ui.Control.Button({label:"< Previous",align:"right"},{click:this._previousButton_onclick.bind(this)});this._fb=new aw.ui.Control.Button({label:"Finish",align:"right"},{click:this._finishButton_onclick.bind(this)});this.add(new aw.ui.Toolbar({height:"30",region:"bottom",items:[new aw.ui.Toolbar.Row({items:[this._fb,this._nb,this._pb]})]}));this._fb.disable();this._nb.disable();this._pb.disable()}this._wt=new aw.ui.Panel.Tab({titleVisibility:false,cssClass:"questions"},{tabchanged:this._tab_onchange.bind(this)});this.add(this._wt);return this.canvas},firstTab:function(){return this._wt.first()},lastTab:function(){return this._wt.last()},nextTab:function(){this._wt.next()},previousTab:function(){this._wt.previous()},serializeValues:function(){return this._form.serialize("xml",",",'<Value name="#{name}">#{value}</Value>')},_renderTab:function(t,j,k,b,g){if(!j){return}k=k||t;var n=null;var h=null;for(var q=0;h=j[q];q++){if(h.labelGroup){n=new aw.ui.Control.LabelGroup({label:h.labelGroup.description,name:h.labelGroup.name});this._renderTab(n,h.labelGroup.children,k,b,g)}else{if(h.label){n=new aw.ui.HTML({html:"<p>"+h.label.description+"</p>"})}else{if(h.textBox){n=new aw.ui.Control.TextBox({label:h.textBox.description,name:h.textBox.name,value:g[h.textBox.name]||h.textBox.defaultText,type:((h.textBox.password===true)?"password":"text"),multiline:h.textBox.multiline});this._form.add(n)}else{if(h.listBox){if(h.listBox.multiple===true){n=new aw.ui.Control.MultiSelectListBox({label:h.listBox.description,name:h.listBox.name,options:h.listBox.items,defaultAllChecked:h.listBox.defaultAllChecked,multipleCustom:h.listBox.multipleCustom,multipleStart:h.listBox.multipleStart,multipleSeparator:h.listBox.multipleSeparator,multipleEnd:h.listBox.multipleEnd})}else{n=new aw.ui.Control.DropDown({label:h.listBox.description,name:h.listBox.name,options:h.listBox.items});if(g[h.listBox.name]){n.selectByValue(g[h.listBox.name])}else{if(h.listBox["default"]){n.selectByPartialLabel(h.listBox["default"])}}}this._form.add(n)}else{if(h.radioGroup){n=new aw.ui.Control.RadioGroup({group:t.id+"_group",label:h.radioGroup.description,name:h.radioGroup.name,checked:(g[h.radioGroup.name]!=undefined)?g[h.radioGroup.name]:h.radioGroup.defaultChecked},{change:this._radioGroupChanged.bind(this)});this._form.add(n);this._renderTab(n,h.radioGroup.children,k,b,g)}else{if(h.booleanGroup){n=new aw.ui.Control.CheckboxGroup({group:t.id+"_group",label:h.booleanGroup.description,name:h.booleanGroup.name,checked:(g[h.booleanGroup.name]!=undefined)?g[h.booleanGroup.name]:h.booleanGroup.defaultChecked},{change:this._checkboxGroupChanged.bind(this)});this._form.add(n);this._renderTab(n,h.booleanGroup.children,k,b,g)}else{if(h["boolean"]){n=new aw.ui.Control.Checkbox({label:h["boolean"].description,name:h["boolean"].name,checked:(g[h["boolean"].name]!=undefined)?g[h["boolean"].name]:h["boolean"].defaultChecked,value:"true"});this._form.add(n)}else{if(h.numericUpDown){n=new aw.ui.Control.NumericUpDown({label:h.numericUpDown.description,name:h.numericUpDown.name,defaultValue:g[h.numericUpDown.name]||h.numericUpDown.defaultValue,decimalPlaces:h.numericUpDown.decimalPlaces,increment:h.numericUpDown.increment,maximum:h.numericUpDown.maximum,minimum:h.numericUpDown.minimum});this._form.add(n)}else{if(h.link){n=new aw.ui.Control.Link({label:h.link.description,url:h.link.linkDestination})}else{if(h.fileBrowse){var d={label:h.fileBrowse.description,name:h.fileBrowse.name};if(b){if(b.length>0){for(var m=0;m<b.length;m++){if(b[m].name===d.name){Object.extend(d,{value:b[m].filespec||""})}}}}if(h.fileBrowse.useFieldMap){Object.extend(d,{fieldMap:h.fileBrowse.fieldMap,fields:h.fileBrowse.fields})}n=new aw.ui.Control.FileBrowse(d,{click:this._browseButton_onclick.bind(this)});this._form.add(n)}else{if(h.date){n=new aw.ui.Control.Date({label:h.date.description,name:h.date.name});this._form.add(n)}else{if(h.geoInput){n=new aw.ui.Control.GeoInput({label:h.geoInput.description,value:g[h.geoInput.name]||h.geoInput.defaultText,name:h.geoInput.name,type:h.geoInput.objectType,multiple:h.geoInput.multiple},{click:this._onSpatialInputClick.bind(this)});this._form.add(n)}else{if(h.tree){var a=null,l=null,s=null;if((h.tree.mode=="AllocateGeography")||(h.tree.mode=="AllocateVariable")){a=(h.tree.allocate.datasetFromList===true)?this._form.getFieldByName(h.tree.allocate.listForDataset).getValue():h.tree.allocate.dataset}else{if(h.tree.mode=="CustomXml"){a=h.tree.xml.path}else{if(h.tree.mode=="CustomDW2"){a=h.tree.dw2.path;l=h.tree.dw2.key;s=h.tree.dw2.name}}}n=new aw.ui.Control.Tree({label:h.tree.description,name:h.tree.name,numberOfLines:h.tree.heightNumLines,customSerialize:{xml:this._treeControlSerializeXML.bind(this,h.tree.mode,h.tree.allocate.saveAsWorkspace)},value:g[h.tree.name],tree:new aw.ui.Tree({componentBus:this.componentBus,mode:(h.tree.singleSelect===true)?"single":"multiple",nodePath:"wizardTreeResponseMessage",baseRequest:{request:"tree",mode:h.tree.mode,guid:this._aw.guid,output:"json",keyField:l,nameField:s,datasource:a},server:this.componentBus._componentServer.replace(/ComponentHandler.ashx/gi,"WizardHandler.ashx")})});if((h.tree.mode=="AllocateGeography")||(h.tree.mode=="AllocateVariable")){if(h.tree.allocate.datasetFromList===true){var o=this._form.getFieldByName(h.tree.allocate.listForDataset);if(o){o.registerEvent("change",function(e,f){e.tree.baseRequest.datasource=f.getValue();e.tree.baseRequest.k=null;e.tree.clear();e.tree._retrieveNodes()}.bind(this,n))}}}this._form.add(n)}}}}}}}}}}}}}if(n){t.add(n)}}},_onSpatialInputClick:function(a){},_browseButton_onclick:function(a){new aw.ui.Dialog.FileManager({componentBus:this.componentBus,wizardGuid:this._aw.guid},{onfileselected:this._browseButton_onfileselected.bind(this,a)})},_browseButton_onfileselected:function(h,g){if(h&&g){h.setValue(g);var b=[];if(this.componentBus){var e=this.componentBus.getComponentReferences("aw.WizardManager");if((e)&&(e.length>0)){e=e[0];var d=null;for(var a=0;d=this._form.items[a];a++){if((d)&&(d.CLASS_NAME==="aw.ui.Control.FileBrowse")){if((d.name)&&(d.getValue()!=="")){b.push({name:d.name,filespec:d.getValue()})}}}if(b.length>0){e.reloadInterface(b)}}}}},_finishButton_onclick:function(b){var a=this.componentBus.getComponentReferences("aw.WizardManager");if((a)&&(a.length>0)){a=a[0];var d=this._form.serialize("xml",",",'<Value name="#{name}">#{value}</Value>');a.executeActiveWizard(d)}},_nextButton_onclick:function(a){this._wt.next()},_previousButton_onclick:function(a){this._wt.previous()},_tab_onchange:function(a){if(this.showNavigationButtons){if(a==this._wt.first()){this._pb.disable()}else{this._pb.enable()}if(a==this._wt.last()){this._nb.disable();this._fb.enable()}else{this._nb.enable();this._fb.disable()}}this.triggerEvent("tabchanged",a)},_radioGroupChanged:function(a){if(this._form){this._form.update(a)}},_checkboxGroupChanged:function(a){if(this._form){this._form.update(a)}},_treeControlSerializeXML:function(h,e,g){var d=g.value,b=0;if((!d)||(!d.length>0)){return""}var a=[];if(h=="AllocateVariable"){for(b=0;b<d.length;b++){if(e){a.push("Variable("+d[b]+","+d[b]+",False)\n")}else{a.push('&lt;Var name="'+d[b]+'"/&gt;\n')}}return(e!==true)?("&lt;Variables&gt;"+a.join("")+"&lt;/Variables&gt;"):a.join("")}else{if(h=="AllocateGeography"){var f=[];for(b=0;b<d.length;b++){if(d[b].indexOf(":")<=0){continue}f=d[b].split(":");if((f.length>1)&&(f[1]==="")){f[1]="*"}if((f.length>1)&&(f[0]!=="")&&(f[1]!=="")){if(e){a.push("Geography("+f[0]+","+f[1]+")\n")}else{a.push('&lt;Geography type="'+f[0]+'" key="'+f[1]+'"/&gt;\n')}}}return(e!==true)?("&lt;Geographies&gt;"+a.join("")+"&lt;/Geographies&gt;"):a.join("")}else{if((h=="CustomXml")||(h=="CustomDW2")){return d.join("\n")}}}},_onWizardInterfaceReceived:function(g,f,e){this.setTitle("Wizard: "+g.name);var h=((e===true)&&(this._wt)&&(this._wt.activeTab))?this._wt.activeTab.title:null;this._aw=g;var j={};if(this._form){if(e===true){j=this._form.serialize()}this._form.clear()}this._wt.clear();if((!g["interface"])||(!g["interface"].questions)){throw"An attempt was made to load the interface of an invalid wizard reference!"}var d=null,a=null;for(var b=0;a=g["interface"].questions[b];b++){d=new aw.ui.Panel({title:a.tab.description});this._renderTab(d,a.tab.children||[{label:{description:"There are no questions to display."}}],null,f,j);this.addTab(d)}if(this.showNavigationButtons){if((this._wt.first()!==null)&&(this._wt.last()!==null)){if(this._wt.first()==this._wt.activeTab){this._pb.disable()}}}if((h)&&(this._wt.getTabByLabel(h))&&(this._wt.getTabByLabel(h)!==this._wt.activeTab)){this._wt.setActiveTabByLabel(h)}else{this._tab_onchange(this._wt.activeTab)}},EVENTS:["onhide","onshow","ondisabled","onenabled","onclose","tabchanged","onspatialinputclicked"],VALID_PROPERTIES:["container","componentBus","titleVisibility","helpCallback","showNavigationButtons"],CLASS_NAME:"aw.ui.WizardInterface"});aw.ui.WizardQueue=Class.create(aw.ui.Panel.Splitter,{maskedExportFormats:[],renamedExportFormats:[],_wizardJobGrid:null,_onWizardJobCreated_fx:null,_onWizardJobUpdated_fx:null,initialize:function(b,a){this.inheritCSS=true;this.maskedExportFormats=[];this.renamedExportFormats=[];this._wizardJobGrid=null;this._onWizardJobCreated_fx=null;this._onWizardJobUpdated_fx=null;Object.extend(b,{titleVisibility:false,orientation:"vertical"});aw.ui.Panel.Splitter.prototype.initialize.apply(this,arguments);if(this.componentBus){this.componentBus.getComponentReferences("aw.WizardManager",function(d){if((d)&&(d.length>0)){var e=d[0];this._onWizardJobCreated_fx=this._onWizardJobCreated.bind(this);this._onWizardJobUpdated_fx=this._onWizardJobUpdated.bind(this);this._onWizardJobsReceived_fx=this._onWizardJobsReceived.bind(this);e.registerEvent("onwizardjobcreated",this._onWizardJobCreated_fx);e.registerEvent("onwizardjobupdated",this._onWizardJobUpdated_fx);e.registerEvent("onwizardjobsreceived",this._onWizardJobsReceived_fx);this._loadWizardJobs()}}.bind(this))}},draw:function(){aw.ui.Panel.Splitter.prototype.draw.apply(this);this._wizardJobGrid=new aw.ui.Grid({columns:[{index:"wizardName",label:"Wizard"},{index:"disposition",label:"Status",cssClass:"status"},{index:"executionStartDate",label:"Start Time",sorted:true,sortDirection:"desc",type:"date"},{index:"executionEndDate",label:"End Time",type:"date"},{index:"priority",label:"Priority",cssClass:"priority",type:"numeric"}],cssClass:"wizardQueue"},{onselectionchanged:this._onQueueSelectionChanged.bind(this)});this._deleteJobBtn=new aw.ui.Control.Button({label:"Delete",disabled:true},{click:this._onDeleteJobClick.bind(this)});this._priorityUpBtn=new aw.ui.Control.Button({label:"Up",align:"right",disabled:true},{click:this._onPriorityClick.bind(this,"up")});this._priorityDownBtn=new aw.ui.Control.Button({label:"Down",align:"right",disabled:true},{click:this._onPriorityClick.bind(this,"down")});this._outputGrid=new aw.ui.Grid({columns:[{index:"type",label:"Type"},{index:"detail",label:"Details"}],selectMultiple:false},{onselectionchanged:this._onOutputSelectionChanged.bind(this)});this._exportOutputBtn=new aw.ui.Control.Button.Drop({label:"Export file...",disabled:true,align:"right"});this._downloadOutputBtn=new aw.ui.Control.Button({label:"Download",disabled:true,align:"right"},{click:this._onDownloadFileButtonClick.bind(this)});this.add([new aw.ui.Panel({title:"Queue",height:"300",minHeight:"150",items:[new aw.ui.Toolbar({height:30,region:"top",items:[new aw.ui.Toolbar.Row({items:[this._deleteJobBtn,this._priorityDownBtn,this._priorityUpBtn]})]}),this._wizardJobGrid],helpCallback:this.helpCallback}),new aw.ui.Panel({title:"Output Details",height:"200",minHeight:"100",selectMultiple:false,items:[new aw.ui.Toolbar({height:30,items:[new aw.ui.Toolbar.Row({items:[this._exportOutputBtn,this._downloadOutputBtn]})]}),this._outputGrid]})]);return this.canvas},_getFormatLabel:function(b){if((!b)||(b.length!=2)){return null}if((this.renamedExportFormats)&&(this.renamedExportFormats.length>0)){for(var a=0;a<this.renamedExportFormats.length;a++){if(this.renamedExportFormats[a].format.toLowerCase()==b[1].toLowerCase()){return this.renamedExportFormats[a].label}}}return b[0]},_isFormatMasked:function(b){if((!b)||(!this.maskedExportFormats)||(!this.maskedExportFormats.length>0)){return false}for(var a=0;a<this.maskedExportFormats.length;a++){if(this.maskedExportFormats[a].toLowerCase()==b.toLowerCase()){return true}}return false},_loadWizardJobs:function(){if(!this._wizardJobGrid){return}var g=this.componentBus.getComponentReferences("aw.WizardManager");if((g)&&(g.length>0)){g=g[0];var a=g.getAllJobs();var f=[];if((a)&&(a.length>0)){var e=null,b=null;for(var d=0;e=a[d];d++){b=this._wizardJobGrid.getRecordBy({_key:e.id});f.push({_key:e.id,_selected:((b)?b._selected:false),disposition:e.disposition,wizardName:(e.wizard)?e.wizard.name:"Unknown",executionStartDate:e.executionStartDate,executionEndDate:e.executionEndDate,priority:e.priority})}}this._wizardJobGrid.loadData(f)}},_onDeleteJobClick:function(e){if(!e){return}var d=this._wizardJobGrid.getSelectedKeys();if((d)&&(d.length>0)){var b=this.componentBus.getComponentReferences("aw.WizardManager");if((b)&&(b.length>0)){b=b[0]}else{return}for(var a=0;a<d.length;a++){if(e.label=="Delete"){b.deleteJob(b.getJobById(d[a]))}else{if(e.label=="Cancel"){b.cancelJob(b.getJobById(d[a]))}}}}},_onDownloadFileButtonClick:function(){var a=this._wizardJobGrid.getSelectedRecords();if((a)&&(a.length===1)){var e=this.componentBus.getComponentReferences("aw.WizardManager");if((e)&&(e.length>0)){e=e[0];var d=e.getJobById(a[0]._key);if(d){var b=this._outputGrid.getSelectedRecords();if((b)&&(b.length===1)&&(b[0].filename)){b=b[0];var f=b.filename.substr(b.filename.lastIndexOf(".")+1);document.location.href=e.getJobOutputStreamURL(d,b.filename,f,true)}}}}},_onExportFileButtonClick:function(b,f){if((!b)||(!f)){return}var a=this._wizardJobGrid.getSelectedRecords();if((a)&&(a.length===1)){var e=this.componentBus.getComponentReferences("aw.WizardManager");if((e)&&(e.length>0)){e=e[0];var d=e.getJobById(a[0]._key);if(d){if(f.match("SavedReport|SavedGeography|FileUpload")){e.exportJobOutput(d,b,f)}else{document.location.href=e.getJobOutputStreamURL(d,b,f,true)}}}}},_onOutputSelectionChanged:function(a){this._exportOutputBtn.disable();this._downloadOutputBtn.disable();if((a)&&(a.length===1)&&(this._exportOutputBtn)){this._exportOutputBtn.clear();if((!a[0])||(!a[0].type)||(a[0].type.toLowerCase()!="file")){return}this._downloadOutputBtn.enable();var d=a[0];if((d)&&(d.outputOptions)&&(d.outputOptions.length>0)){var e=null;for(var b=0;b<d.outputOptions.length;b++){e=d.outputOptions[b].split("|");if(!this._isFormatMasked(e[1])){this._exportOutputBtn.add(new aw.ui.Control.Button({label:this._getFormatLabel(e)},{click:this._onExportFileButtonClick.bind(this,d.filename,e[1])}))}}this._exportOutputBtn.enable()}}},_onPriorityClick:function(f,e){var d=this._wizardJobGrid.getSelectedKeys();if((d)&&(d.length>0)){var a=d[0];var b=this.componentBus.getComponentReferences("aw.WizardManager");if((b)&&(b.length>0)){b=b[0];b.moveJob(b.getJobById(a),f)}}},_onQueueSelectionChanged:function(a){this._deleteJobBtn.disable();this._priorityUpBtn.disable();this._priorityDownBtn.disable();this._exportOutputBtn.disable();this._downloadOutputBtn.disable();this._outputGrid.loadData([]);if((a)&&(a.length>0)){this._deleteJobBtn.enable();this._deleteJobBtn.setLabel("Delete");for(var b=0;b<a.length;b++){if(!a[b].disposition.toLowerCase().match("complete|error|corrupt|initializing|canceling|canceled")){this._deleteJobBtn.setLabel("Cancel")}}if((a.length===1)&&(!a[0].disposition.toLowerCase().match("complete|error|corrupt|initializing"))){this._priorityUpBtn.enable();this._priorityDownBtn.enable()}if((a.length===1)&&(a[0].disposition.toLowerCase().match("complete|error"))){var d=this.componentBus.getComponentReferences("aw.WizardManager");if((d)&&(d.length>0)){d[0].getJobStatus(d[0].getJobById(a[0]._key),function(m){var l=[];if((m)&&(m.files)&&(m.files.length>0)){var k=null;for(var h=0,e=m.files.length;h<e;h++){if(m.files[h].fileItem){Object.extend(m.files[h].fileItem,{type:"File",detail:m.files[h].fileItem.filename});l.push(m.files[h].fileItem)}}}if((m)&&(m.errors)&&(m.errors.length>0)){for(var g=0,f=m.errors.length;g<f;g++){l.push({type:"Error",detail:m.errors[g]})}}this._outputGrid.loadData(l)}.bind(this))}}}},_onWizardJobCreated:function(a){this._loadWizardJobs()},_onWizardJobsReceived:function(a){this._loadWizardJobs()},_onWizardJobUpdated:function(a){this._loadWizardJobs()},VALID_PROPERTIES:["title","container","componentBus","cssClass","closeable","titleVisibility","moveable","resizeable","hideable","dockable","height","width","minHeight","minWidth","position","helpCallback","icon","disabled","pollingInterval","helpCallback","maskedExportFormats","renamedExportFormats"],CLASS_NAME:"aw.ui.WizardQueue"});aw.UserData=Class.create(aw.base,{key:null,type:"",typeLabel:"",name:"",dateCreated:"",dateModified:"",_actions:[],_udm:null,initialize:function(b,a){aw.base.prototype.initialize.apply(this,arguments);this.key=null;this.type="";this.typeLabel="";this.name="";this.dateCreated="";this.dateModified="";this._actions=[];this._udm=null},destroy:function(){this._udm=null;aw.base.prototype.destroy.apply(this)},executeAction:function(a){if((!a)||(!this._udm)){return}a=a.toLowerCase();if(a=="save"){this._save()}else{if(a=="rename"){this._rename()}else{if(a=="delete"){this._delete()}else{if(a=="copy"){this._copy()}}}}},getActions:function(){return this._actions||[]},parse:function(a){if(!a){return false}if((!a.key)||(!a.type)||(a.type.toLowerCase()!=this.type.toLowerCase())){return false}this.key=a.key;this.name=a.name;this.dateCreated=a.dateCreated;this.dateModified=a.dateModified;return true},setActions:function(b){this._actions=[];for(var a=0;a<b.length;a++){if(b[a].toLowerCase()!="save"){this._actions.push(b[a])}}},setUserDataManager:function(a){this._udm=a},_copy:function(){this._udm.executeAction({action:"copy",datatype:this.type,name:this.name})},_delete:function(){this._udm.executeAction({action:"delete",datatype:this.type,name:this.name})},_rename:function(a){if((!a)||(a==="")){new aw.ui.Dialog.Prompt({title:"Rename",content:"Please enter the new name for the data item:"},{onsubmit:this._rename.bind(this)});return}this._udm.executeAction({action:"rename",datatype:this.type,name:this.name,params:{newName:a}})},_save:function(){},VALID_PROPERTIES:["key","type","name"],CLASS_NAME:"aw.UserData"});aw.UserData.AnnotationSet=Class.create(aw.UserData,{annotations:[],numberOfAnnotations:0,style:{},initialize:function(b,a){this.annotations=[];this.numberOfAnnotations=0;this.style={};aw.UserData.prototype.initialize.apply(this,arguments);this.type="AnnotationLayer";this.typeLabel="Annotation Set"},parse:function(d){if(aw.UserData.prototype.parse.apply(this,arguments)!==true){return false}this.details=null;if((d.properties)&&(d.properties.length>0)){var b=d.properties[0],a={};this.numberOfAnnotations=b.pointCount;a["Number of Annotations"]=this.numberOfAnnotations;if((b.records)&&(b.records.length>0)){this.annotations=b.records}this.details=a}this.style=d.style;return true},CLASS_NAME:"aw.UserData.AnnotationSet"});aw.UserData.CustomPolygonSet=Class.create(aw.UserData,{polygons:[],initialize:function(b,a){this.polygons=[];aw.UserData.prototype.initialize.apply(this,arguments);this.type="CustomPolygon";this.typeLabel="Custom Polygon Set"},executeAction:function(a){aw.UserData.prototype.executeAction.apply(this,arguments);if(a=="View/Edit"){this._viewPolygonSet()}else{if(a=="Make Active Geography"){this._makeActiveGeography()}}},parse:function(g){if(aw.UserData.prototype.parse.apply(this,arguments)!==true){return false}this.details=null;if((g.properties)&&(g.properties.length>0)){var e=g.properties[0];var f=[],d={};if((e.records)&&(e.records.length>0)){for(var b=0,a=e.records.length;b<a;b++){this.polygons.push({name:e.records[b].polyName,geoDef:e.records[b].geoDef});if(b<5){f.push(e.records[b].polyName)}}}Object.extend(d,{"Number of Polygons":this.polygons.length});if(this.polygons.length>0){Object.extend(d,{Polygons:f.join("<br />")+((this.polygons.length>5)?("<br />And "+(this.polygons.length-5)+" more not shown."):"")})}this.details=d}return true},setActions:function(a){aw.UserData.prototype.setActions.apply(this,arguments);this._actions.push("View/Edit");this._actions.push("Make Active Geography")},_makeActiveGeography:function(){this._udm.retrieveData(this.type,this.name,null,function(f){if((!f)||(!f.length>0)){return}f=f[0];if((!f.polygons)||(!f.polygons.length>0)){new aw.ui.Dialog.Error({title:"Error",content:"No polygons have been created within this set."});return}var h=new aw.GeographyCollection(null,this.name,this.name,null);var b=null,e=null;var g=new OpenLayers.Format.GeoJSON();for(var a=0;b=f.polygons[a];a++){if((b.geoDef)&&(b.geoDef.type)&&(b.geoDef.type.toLowerCase()=="polygon")){e=g.read(b.geoDef,"Geometry");if(e){h.addGeography(new aw.Geography.Custom(b.name,b.name,b.name,g.write(e)))}}}if((!h)||(!h.geos)||(!h.geos.length>0)){new aw.ui.Dialog.Error({title:"Error",content:"No polygons have been created within this set."});return}var d={action:"Make Active Geography",datatype:this.type,name:this.name,params:{geoCollection:h}};this._udm.triggerEvent("onactionexecuted",d)}.bind(this))},_viewPolygonSet:function(){this._udm.triggerEvent("onactionexecuted",{action:"View/Edit",datatype:this.type,name:this.name})},CLASS_NAME:"aw.UserData.CustomPolygonSet"});aw.UserData.HistoryGeography=Class.create(aw.UserData,{details:null,geoCollection:null,initialize:function(b,a){this.details=null;this.geoCollection=null;aw.UserData.prototype.initialize.apply(this,arguments);this.type="HistoryGeography";this.typeLabel="History Geography"},parse:function(b){if(aw.UserData.prototype.parse.apply(this,arguments)!==true){return false}this.details=null;if(b.properties){var a={};this.setGeoCollection(b.properties);Object.extend(a,{"Number of Geographies":this.geoCollection.geos.length});this.details=a}return true},setGeoCollection:function(e){this.geoCollection=new aw.GeographyCollection(null,this.name,this.name,null);if((e)&&(e.length>0)){var d=null,b=null;for(var a=0;d=e[a];a++){b=this.geoCollection.parseGeoDefinition(d.GeoDefinition,d.Dataset);if((b)&&(b.length===1)&&(b[0].CLASS_NAME=="aw.Geography.Custom")){if(d.Key){b[0].setKey(d.Key)}if(d.Name){b[0].setName(d.Name);b[0].setLabel(d.Name)}}}}},CLASS_NAME:"aw.UserData.HistoryGeography"});aw.UserData.SavedGeography=Class.create(aw.UserData.HistoryGeography,{initialize:function(b,a){aw.UserData.HistoryGeography.prototype.initialize.apply(this,arguments);this.type="SavedGeography";this.typeLabel="Saved Geography"},executeAction:function(a){aw.UserData.HistoryGeography.prototype.executeAction.apply(this,arguments);if(a=="Make Active Geography"){this._makeActiveGeography()}},setActions:function(a){aw.UserData.HistoryGeography.prototype.setActions.apply(this,arguments);this._actions.push("Make Active Geography")},_makeActiveGeography:function(){this._udm.retrieveData(this.type,this.name,null,function(b){if((!b)||(!b.length>0)){return}b=b[0];if(b.geoCollection){var a={action:"Make Active Geography",datatype:this.type,name:this.name,params:{geoCollection:b.geoCollection}};this._udm.triggerEvent("onactionexecuted",a)}}.bind(this))},CLASS_NAME:"aw.UserData.SavedGeography"});aw.UserData.SavedQuery=Class.create(aw.UserData,{category:null,dataset:null,details:null,jsonQuery:null,query:null,subcategory:null,initialize:function(b,a){this.category=null;this.dataset=null;this.details=null;this.jsonQuery=null;this.query=null;this.subcategory=null;aw.UserData.prototype.initialize.apply(this,arguments);this.type="CalgaryListFilter";this.typeLabel="Saved Query"},executeAction:function(a){aw.UserData.prototype.executeAction.apply(this,arguments);if(a=="Edit"){this._editQuery()}},parse:function(g,f){if(aw.UserData.prototype.parse.apply(this,arguments)!==true){return false}this.details=null;if(g.properties){var d={};var b=null;for(var a=0;b=g.properties[a];a++){if((!b.Dataset)||(!b.Query)||(!b.jsonQuery)){return false}this.category=b.Category;this.dataset=b.Dataset;this.jsonQuery=b.jsonQuery;this.query=b.Query;this.subcategory=b.Subcategory;if(f){var e=f.componentBus.getComponentReferences("aw.QueryManager");if((e)&&(e.length>0)){var h=e[0].getQueryDatasetByKey(this.dataset);if(h){Object.extend(d,{Dataset:h.name})}}}}this.details=d}return true},setActions:function(a){aw.UserData.prototype.setActions.apply(this,arguments);this._actions.push("Edit")},_editQuery:function(){this._udm.retrieveData(this.type,this.name,null,function(b){if((!b)||(!b.length>0)){return}b=b[0];if(b.jsonQuery){var a={action:"Edit",datatype:this.type,name:this.name,params:{jsonQuery:b.jsonQuery,dataset:b.dataset}};this._udm.triggerEvent("onactionexecuted",a)}}.bind(this))},CLASS_NAME:"aw.UserData.SavedQuery"});aw.UserData.SavedReport=Class.create(aw.UserData,{initialize:function(b,a){aw.UserData.prototype.initialize.apply(this,arguments);this.type="SavedReport";this.typeLabel="Saved Report"},executeAction:function(a){aw.UserData.prototype.executeAction.apply(this,arguments);if(a=="View"){this._onViewReport()}},setActions:function(a){aw.UserData.prototype.setActions.apply(this,arguments);this._actions.push("View")},_onExportReportClick:function(e,d,b){if((!e)||(!d)){return}var a=[];a.push("cn=SRC.Web.Client.Handler.ReportHandler");a.push("service=render");a.push("report="+escape(this.name));a.push("type="+escape(this.type));a.push("format="+d);a.push("seqId="+this.getId(""));if(this._udm.componentBus.getApplicationKey()){a.push("akey="+this._udm.componentBus.getApplicationKey())}if(this._udm.componentBus.getSessionKey()){a.push("skey="+this._udm.componentBus.getSessionKey())}e.src=this._udm.componentBus.getComponentServer()+"?"+a.join("&")},_onPrintReportClick:function(d,b){if(d){var a=(d.contentWindow||d.contentDocument);a.print()}},_onViewReport:function(){var a=[];a.push("cn=SRC.Web.Client.Handler.ReportHandler");a.push("service=render");a.push("report="+escape(this.name));a.push("type="+escape(this.type));a.push("format=html");a.push("seqId="+this.getId(""));if(this._udm.componentBus.getApplicationKey()){a.push("akey="+this._udm.componentBus.getApplicationKey())}if(this._udm.componentBus.getSessionKey()){a.push("skey="+this._udm.componentBus.getSessionKey())}a=this._udm.componentBus.getComponentServer()+"?"+a.join("&");var d=new aw.ui.Dialog({title:"View Saved Report",content:'<div class="actions" style="height: 35px; clear: both;"><div style="float: left;"></div></div><iframe src="'+a+'" style="height: 400px; width: 600px; clear: both;"></iframe>',width:650});if((d)&&(d.canvas)){var b=d.canvas.down("div.actions div");if(b){var e=d.canvas.down("iframe");new aw.ui.Toolbar.Row({container:b,items:[new aw.ui.Control.Button.Split({items:[new aw.ui.Control.Button({label:"Export As PDF",icon:"./core/img/Misc/acrobat.png"},{click:this._onExportReportClick.bind(this,e,"pdf")}),new aw.ui.Control.Button({label:"Export As XLSX",icon:"./core/img/Misc/excel.png"},{click:this._onExportReportClick.bind(this,e,"xlsx")}),new aw.ui.Control.Button({label:"Export As DOCX",icon:"./core/img/Misc/word.png"},{click:this._onExportReportClick.bind(this,e,"docx")})]}),new aw.ui.Control.Button({label:"Print",icon:"./core/img/Misc/printer.png"},{click:this._onPrintReportClick.bind(this,e)})]})}}},CLASS_NAME:"aw.UserData.SavedReport"});aw.UserData.UserLocationFile=Class.create(aw.UserData,{initialize:function(b,a){aw.UserData.prototype.initialize.apply(this,arguments);this.type="UserLocationFile";this.typeLabel="Location File"},executeAction:function(a){aw.UserData.prototype.executeAction.apply(this,arguments);if(a=="Download as CSV"){this._downloadUserFile()}},setActions:function(a){aw.UserData.prototype.setActions.apply(this,arguments);this._actions.push("Download as CSV")},_downloadUserFile:function(){var a=[];a.push("cn=SRC.Web.Client.Handler.AlteryxHandler");a.push("service=exportContent");a.push("type="+escape(this.type));a.push("name="+escape(this.name));a.push("ft=CSV");a.push("seqId="+this.getId(""));if(this._udm.componentBus.getApplicationKey()){a.push("akey="+this._udm.componentBus.getApplicationKey())}if(this._udm.componentBus.getSessionKey()){a.push("skey="+this._udm.componentBus.getSessionKey())}a=this._udm.componentBus.getComponentServer()+"?"+a.join("&");document.location.href=a},CLASS_NAME:"aw.UserData.UserLocationFile"});aw.UserDataManager=Class.create(aw.base,{activeDataType:null,dataTypes:[],userSettings:null,_onFileGeocoded_fx:null,initialize:function(b,a){aw.base.prototype.initialize.apply(this,[b,a]);this.activeDataType=null;this.dataTypes=[];this.userSettings=null;if(this.componentBus){this.componentBus.getComponentReferences("aw.Geocoder",function(d){if((d)&&(d.length>0)){this._onFileGeocoded_fx=this._onFileGeocoded.bind(this);d[0].registerEvent("filegeocoded",this._onFileGeocoded_fx)}}.bind(this),false)}this._initializeUserData()},destroy:function(){if(this.componentBus){var a=this.componentBus.getComponentReferences("aw.Geocoder");if((a)&&(a.length>0)){a=a[0];if(this._onFileGeocoded_fx){a.unregisterEvent("filegeocoded",this._onFileGeocoded_fx);this._onFileGeocoded_fx=null}}}this.activeDataType=null;this.dataTypes=[];this.userSettings=null;aw.base.prototype.destroy.apply(this)},executeAction:function(d){if((!d)||(!d.action)||(!d.datatype)||(!d.name)){return}var a=d.variant;var b={cn:("SRC.Web.Client.Handler.UserDataHandler"+(((a)&&(a!==""))?("|"+a):"")),dt:d.datatype,name:d.name,service:d.action};var f=d.params;var e;if(f){for(e in f){b[e]=f[e]}}if((d.action.toLowerCase().match("save|rename"))&&(d.overwrite===true)){b.overwrite=true}if(this.isSessionValidated()===true){this.request(b,this._onAction_executed.bind(this,d))}else{if(this.isValidating()===true){this.executeAction.bind(this,d).delay(0.5)}}},getDataTypeByKey:function(b){if(((!b)&&(b!==""))||(!this.dataTypes)||(!this.dataTypes.length>0)){return null}var a;var d=null;var e=this.dataTypes;b=b.toLowerCase();for(a=0;d=e[a];a++){if(d.key.toLowerCase()==b){return d}}return null},getDataTypeByLabel:function(a){if((!a)||(!this.dataTypes)||(!this.dataTypes.length>0)){return null}var b;var d=null;var e=this.dataTypes;a=a.toLowerCase();for(b=0;d=e[b];b++){if(d.label.toLowerCase()==a){return d}}return null},getFiles:function(b){var a={cn:"SRC.Web.Client.Handler.UserDataHandler",service:"files"};if(b){if(b.wizardGuid){a.wizardGuid=b.wizardGuid}if(b.guid){a.guid=b.guid}}if((this.isSessionValidated()===false)&&(this.isValidating()===true)){this.getFiles.bind(this,b).delay(0.5);return}this.request(a,this._onFiles_received.bind(this,b))},onAuthenticationSuccess:function(){aw.base.prototype.onAuthenticationSuccess.apply(this);this._initializeUserData()},onAuthenticationFailure:function(){aw.base.prototype.onAuthenticationSuccess.apply(this);this._initializeUserData()},retrieveData:function(d,a,b,j,f,h){var e={cn:("SRC.Web.Client.Handler.UserDataHandler"+(((b)&&(b!==""))?("|"+b):"")),service:"retrieve"};if(d){e.dt=d;if(d=="CustomPolygon"&&h&&h.length>0){e.field=h}}if(a){e.name=a}if(f){for(var g in f){e[g]=f[g]}}if(this.isSessionValidated()===true){this.request(e,this._onData_received.bind(this,j))}else{if(this.isValidating()===true){this.retrieveData.bind(this,d,a,b,j,f,h).delay(0.5)}else{this._onData_received(j)}}},setActiveDataType:function(b){if((!b)||(!this.dataTypes)||(!this.dataTypes.length>0)){return}var a;var d=null;var e=this.dataTypes;for(a=0;d=e[a];a++){if(d===b){this.activeDataType=d;this.triggerEvent("ondatatypechanged",d);return}}},setActiveDataTypeByLabel:function(a){this.setActiveDataType(this.getDataTypeByLabel(a))},_getDataTypes:function(){this.dataTypes=[];var a={cn:"SRC.Web.Client.Handler.UserDataHandler",service:"listTypes"};this.request(a,function(f,g){if((!g)||(!g.payload)){return}var b;var e=g.payload;var d=null;var h=[];for(b=0;d=e[b];b++){h.push(d)}h.sortBy("label");h.unshift({key:"",label:"Everything"});this.dataTypes=h;this.triggerEvent("ondatatypeschanged",h);if((!this.activeDataType)&&(h.length>0)){this.setActiveDataType(h[0])}}.bind(this))},_getUserSettings:function(){var a={cn:"SRC.Web.Client.Handler.UserDataHandler",service:"getUserSettings"};this.request(a,function(b,d){if((!d)||(!d.payload)){return}this.userSettings=d.payload;this.triggerEvent("onusersettingsreceived",this.userSettings)}.bind(this))},_initializeUserData:function(){this.activeDataType=null;this.userSettings=null;this._getDataTypes();this._getUserSettings()},_onAction_executed:function(b,e,f,a){if((!b)||(!f)||(!f.payload)){return}var d=f.payload;if(d.status!="success"){if((d.code)&&(parseInt(d.code,10)===2)){new aw.ui.Dialog.Confirm({title:"Confirm Overwrite",content:"An item with the same name already exists. Would you like to overwrite the existing item?"},{onconfirm:function(g){g.overwrite=true;this.executeAction(g)}.bind(this,b)})}else{new aw.ui.Dialog.Error({title:"Error!",content:(((d.message)&&(d.message!==""))?d.message:"There was an unknown error!")})}}else{this.triggerEvent("onactionexecuted",b);if(b.callback){b.callback(b,d)}}},_onData_received:function(k,e,b){if((!b)||(!b.payload)){return}var g;var f=[];var d=null;var a=null;var h=null;var j=b.payload;if(j instanceof Array){for(g=0;a=j[g];g++){d=this._parseDataItem(a);if(d){h=this.getDataTypeByKey(d.type);if(h){d.setActions(h.actions)}d.setUserDataManager(this);f.push(d)}}}else{d=this._parseDataItem(j);if(d){f.push(d)}}if(k){k(f)}},_onFileGeocoded:function(d,a){var b={action:"geocode",datatype:"UserLocationFile",name:d,params:a};this.triggerEvent("onactionexecuted",b)},_onFiles_received:function(b,e,f,a){if((!b)||(!f)||(!f.payload)){return}var d=f.payload;this.triggerEvent("onfilesreceived",b,d);if(b.callback){b.callback(b,d)}},_parseDataItem:function(h,d){if(!h){return null}d=d||aw.UserData.subclasses;var g;var b=null;var f=null;var e;var a;for(g=0;b=d[g];g++){f=new b();a=b.subclasses;if(f.parse(h,this)){return f}else{if((a)&&(a.length>0)){e=this._parseDataItem(h,a);if(e){return e}}}f.destroy();f=null}return null},EVENTS:["onactionexecuted","ondatatypechanged","ondatatypeschanged","onusersettingsreceived","onfilesreceived"],VALID_PROPERTIES:["componentBus"],CLASS_NAME:"aw.UserDataManager"});aw.WizardManager=Class.create(aw.base,{activeWizard:null,statusPollFrequency:10,_isPolling:false,_jobRegistry:[],_wizards:[],initialize:function(b,a){this.activeWizard=null;this.statusPollFrequency=10;this._wizards=[];this._isPolling=false;this._jobRegistry=[];aw.base.prototype.initialize.apply(this,[b,a]);this._initializeWizards();this._pollAllJobs()},cancelJob:function(b){if((!b)||(!b.serverId)){return}var d=b.id;this._updateJob({id:d,disposition:"canceling"});var a={request:"cancel",jobId:b.serverId,output:"json"};this.request(a,function(e,f,g){if((g)&&(g.payload)){if(g.payload.exceptionMessage){this._updateJob({id:d,disposition:"corrupt"})}else{this._updateJob({id:d,disposition:"canceled"})}}}.bind(this,b),this.componentBus._componentServer.replace(/ComponentHandler.ashx/gi,"WizardHandler.ashx"))},clearJobs:function(){this._jobRegistry=[]},deleteJob:function(b){if((!b)||(!b.serverId)){return}this._updateJob({id:b.id,disposition:"deleting"});var a={request:"cancel",jobId:b.serverId,output:"json"};this.request(a,function(d,e,f){if((f)&&(f.payload)){if(f.payload.exceptionMessage){this._updateJob({id:d.id,disposition:"corrupt"})}else{this._deleteJob(d)}}}.bind(this,b),this.componentBus._componentServer.replace(/ComponentHandler.ashx/gi,"WizardHandler.ashx"))},deleteWizards:function(b){if((!b)||(!b.length>0)){return}var a={request:"deleteWizard",output:"json",guid:b};this.request(a,function(f,g){if((g)&&(g.payload)){var e=g.payload;if(e.exceptionMessage){new aw.ui.Dialog.Error({title:"Error",content:e.exceptionMessage.errorMessage||"An unknown error has occurred."})}else{if(e.wizardDeleteWizardResponseMessage){var d=e.wizardDeleteWizardResponseMessage;if(d.status=="success"){this.triggerEvent("onwizarddeleted");this._getWizardManifest()}else{new aw.ui.Dialog.Error({title:"Error",content:d.message||"An unknown error has occurred."})}}}}}.bind(this),this.componentBus._componentServer.replace(/ComponentHandler.ashx/gi,"WizardHandler.ashx"))},executeActiveWizard:function(d,e,b,a){return this.executeWizard(this.activeWizard,d,e,b,a)},executeWizard:function(f,h,j,g,a){if(!f){return null}var d={wizard:f,disposition:"initializing",callback:j};if((a)&&(a!=="")){d.metaInfo=a}d.isChained=(f["interface"]&&f["interface"].isLastWizard===false)?true:false;var e=this._createJob(d);var b={request:"execute",output:"json",guid:f.guid+((f["interface"]&&f["interface"].wizardName)?"|"+f["interface"].wizardName:""),params:h};if(g===true){b.schedule=true}if((a)&&(a!=="")){b.metainfo=a}if((f["interface"])&&(f["interface"].jobId)&&(f["interface"].jobId!=="")){b.jobId=f["interface"].jobId}this.request(b,function(l,k,m,n){if((n)&&(n.payload)){if(n.payload.wizardStatusResponseMessage){this._onWizardStatusResponseReceived(n.payload.wizardStatusResponseMessage,l);return}else{if(n.payload.wizardQuestionsResponseMessage){k["interface"]=n.payload.wizardQuestionsResponseMessage;this.triggerEvent("onwizardinterfacereceived",k);return}}}new aw.ui.Dialog.Error({title:"Error",content:"Invalid response from wizard execution."});this._deleteJob(l);this._getJobQueue()}.bind(this,e,f),this.componentBus._componentServer.replace(/ComponentHandler.ashx/gi,"WizardHandler.ashx"),"post");return e},exportJobOutput:function(d,a,e){var b=this.getJobOutputStreamRequest(d,a,e);if(e.match("SavedReport|SavedGeography|FileUpload")){new aw.ui.Dialog.Prompt({title:"Export File Output",content:"Please enter a name to store this file output as."},{onsubmit:function(g,f){if(f){g.on=f;this.request(g,this._onExportJobOutputComplete.bind(this,d,f,e),this.componentBus._componentServer.replace(/ComponentHandler.ashx/gi,"WizardHandler.ashx"))}}.bind(this,b)})}},getAllJobs:function(){return this._jobRegistry||[]},getAllWizards:function(){return this._wizards||[]},getJobById:function(g){if((!g)||(!this._jobRegistry)||(!this._jobRegistry.length>0)){return null}g=g.toLowerCase();var b=null;var d=null;var a=this._jobRegistry;var f;var e=a.length;while(e--){f=a[e];b=(f.id)?f.id.toLowerCase():null;d=(f.serverId)?f.serverId.toLowerCase():null;if((b===g)||(d===g)){return f}}return null},getJobOutputStreamRequest:function(b,e,d){if((!b)||(!b.serverId)||(!e)||(!d)){return{}}var a={request:"stream",jobId:b.serverId,fn:e,of:d};if((d)&&(d.toLowerCase().match("savedreport|savedgeography|fileupload"))){a.output="json"}return a},getJobOutputStreamURL:function(d,g,e,f){var a=this.componentBus;var b=this.getJobOutputStreamRequest(d,g,e);b.seqId=this.getId("");if(a.getApplicationKey()){b.akey=a.getApplicationKey()}if(a.getSessionKey()){b.skey=a.getSessionKey()}b.attachment=(f===false)?false:true;return a._componentServer.replace(/ComponentHandler.ashx/gi,"WizardHandler.ashx")+"?"+$H(b).toQueryString()},getJobStatus:function(b,d){if((!b)||(!b.serverId)){return}var a={request:"status",jobId:b.serverId,output:"json"};this.request(a,function(e,h,f,g){if((!g)||(!g.payload)||(!g.payload.wizardStatusResponseMessage)){this._updateJob({id:e.id,disposition:"corrupt"});new aw.ui.Dialog.Error({title:"Error",content:"Invalid response from wizard status."});return}this._onWizardStatusResponseReceived(g.payload.wizardStatusResponseMessage,e);if(h){h(e)}}.bind(this,b,d),this.componentBus._componentServer.replace(/ComponentHandler\.ashx/gi,"WizardHandler.ashx"))},getJobOutputLog:function(b,d){if((!b)||(!b.serverId)){return}var a={request:"outputlog",jobId:b.serverId,output:"json"};this.request(a,function(h,n,j,g){if((!g)||(!g.payload)||(!g.payload.wizardOutputLogResponseMessage)){new aw.ui.Dialog.Error({title:"Error",content:"Invalid response form wizard output log."});return}var k=g.payload.wizardOutputLogResponseMessage;var e={error:0,conversionError:0,warning:0,message:0};var f={"3":"error","5":"conversionError","2":"warning","1":"message"};for(var l=0,m=k.length;l<m;l++){e[f[k[l].type]]++}if(n){n(k,e)}}.bind(this,b,d),this.componentBus._componentServer.replace(/ComponentHandler\.ashx/gi,"WizardHandler.ashx"))},getWizardBy:function(f){if((!f)||(!this._wizards)||(!this._wizards.length>0)){return null}var e=null;var d=true;var b=this._wizards.length;while(b--){e=this._wizards[b];d=true;for(var a in f){if(e[a]!==f[a]){d=false}}if(d===true){return e}}return null},getWizardByKey:function(b){if((!b)||(!this._wizards)||(!this._wizards.length>0)){return null}var d=null;var a=this._wizards.length;while(a--){d=this._wizards[a];if(d.guid==b){return d}}return null},getWizardByName:function(a){if((!a)||(!this._wizards)||(!this._wizards.length>0)){return null}var d=null;var b=this._wizards.length;a=a.toLowerCase();while(b--){d=this._wizards[b];if((d.name)&&(d.name.toLowerCase()===a)){return d}}return null},getWizardInfo:function(a,e,d){if(!this.componentBus){return}var b={request:"info",guid:a,output:"json"};this.request(b,function(g,h){if((!h)||(!h.payload)||(!h.payload.wizardInformationResponseMessage)){new aw.ui.Dialog.Error({title:"Error",content:"Could not load wizard info"});return}var f=h.payload.wizardInformationResponseMessage;if(f){f.guid=h.guid}if(d){f.isHidden=d.isHidden;f.isPublic=d.isPublic}if(typeof e==="function"){e(f)}this.triggerEvent("onwizardinforeceived",f)}.bind(this),this.componentBus._componentServer.replace(/ComponentHandler.ashx/gi,"WizardHandler.ashx"))},getWizardStreamURL:function(d){if(!d){return null}var a=this.componentBus;var b={seqId:this.getId(""),guid:d,request:"download"};if(a.getApplicationKey()){b.akey=a.getApplicationKey()}if(a.getSessionKey()){b.skey=a.getSessionKey()}return a._componentServer.replace(/ComponentHandler.ashx/gi,"WizardHandler.ashx")+"?"+$H(b).toQueryString()},moveJob:function(b,d){if((!b)||(!b.serverId)||(!b.disposition)||(b.disposition.match("complete|error|corrupt|canceling|canceled|initializing"))||(!d)||(!d.toLowerCase().match("up|down"))){return}var a={request:"queue"+d,output:"json",jobId:b.serverId};this.request(a,function(j,k){if((!k)||(!k.payload)||(!k.payload.wizardQueueResponseMessage)){this.componentBus.validateSession(function(l){if(l===true){new aw.ui.Dialog.Error({title:"Error!",content:"Could not load wizard job queue."})}else{this.componentBus.unloadUser()}}.bind(this));return}this.clearJobs();var g=k.payload.wizardQueueResponseMessage.wizardQueueItems;var h=null;for(var f=0,e=g.length;f<e;f++){h=g[f].wizardQueueItem;h.serverId=h.jobId;h.wizard=this.getWizardByName(h.wizardName);this._createJob(h,false)}this.triggerEvent("onwizardjobsreceived",this._jobRegistry)}.bind(this),this.componentBus._componentServer.replace(/ComponentHandler.ashx/gi,"WizardHandler.ashx"))},onAuthenticationFailure:function(){aw.base.prototype.onAuthenticationFailure.apply(this);this._initializeWizards()},onAuthenticationSuccess:function(){aw.base.prototype.onAuthenticationSuccess.apply(this);this._initializeWizards()},reloadInterface:function(a){if(!this.activeWizard){return}this._getWizardInterface(this.activeWizard,a,true)},setActiveWizard:function(e){if(!e){return}if((!this._wizards)||(!this._wizards.length>0)){return}var a=null;var d=this._wizards;for(var b=0;a=d[b];b++){if(a===e){a["interface"]=null;this.activeWizard=a;this.triggerEvent("onactivewizardchanged",a);this._getWizardInterface(a);return}}throw"Could not locate wizard!"},setActiveWizardByKey:function(a){this.setActiveWizard(this.getWizardByKey(a))},updateWizardManifest:function(a,d,e){if(!this.componentBus){return}var b={request:"updateWizardManifest",guid:a,ispublic:d,output:"json"};this.request(b,function(k,l){if((!l)||(!l.payload)||(!l.payload.updateWizardManifestResponseMessage)){new aw.ui.Dialog.Error({title:"Error",content:"Could not update wizard manifest"});return}var g=l.payload.updateWizardManifestResponseMessage;var j=[],f=[];if(g.status=="Success"){j.push(g.message)}else{if(g.status=="Failure"){f.push(g.message)}}var h=(f.length>0||j.length<1)?"failure":"success";if(e){e(h,j,f)}}.bind(this),this.componentBus._componentServer.replace(/ComponentHandler.ashx/gi,"WizardHandler.ashx"))},validateWizardPackage:function(a){var b={request:"validateWizard",output:"json",fn:a};this.request(b,function(f,g){if((g)&&(g.payload)){var e=g.payload;if(e.exceptionMessage){this.triggerEvent("onwizardvalidateerror",e.exceptionMessage.errorMessage||"An unknown error has occurred.")}else{if(e.wizardValidateResponseMessage){var d=e.wizardValidateResponseMessage;if(d.status=="success"){this.triggerEvent("onwizardvalidated",d||"");this._getWizardManifest()}else{this.triggerEvent("onwizardvalidateerror",d.message||"An unknown error has occurred.")}}}}}.bind(this),this.componentBus._componentServer.replace(/ComponentHandler.ashx/gi,"WizardHandler.ashx"))},_createJob:function(b,a){if(!b){return null}b.id=this.getId("awwj");b.disposition=(b.disposition)?b.disposition.toLowerCase():null;if(!b.isChained){this._jobRegistry.push(b);if(a!==false){this.triggerEvent("onwizardjobcreated",b);if(b.callback){b.callback(b)}}}return b},_deleteJob:function(f){if(!f){return}if((this._jobRegistry)&&(this._jobRegistry.length>0)){var e;var b=[];var g;var d=this._jobRegistry;var a=d.length;for(e=0;e<a;e++){g=d[e];if(g!==f){b.push(g)}}this._jobRegistry=b;this.triggerEvent("onwizardjobsreceived",b)}},_getJobQueue:function(b){if(this.isSessionValidated()===true){this._isPolling=true;var a={request:"queue",output:"json"};this.request(a,function(h,j,k){if((!k)||(!k.payload)||(!k.payload.wizardQueueResponseMessage)){this.componentBus.validateSession(function(l){if(l===true){new aw.ui.Dialog.Error({title:"Error!",content:"Could not load wizard job queue."})}else{this.componentBus.unloadUser()}}.bind(this));this._isPolling=false;return}var e=k.payload.wizardQueueResponseMessage.wizardQueueItems;var f=null;var d=e.length;var g;while(d--){f=e[d].wizardQueueItem;f.serverId=f.jobId;f.wizard=this.getWizardByName(f.wizardName);g=this.getJobById(f.jobId);if(g){this._updateJob(f)}else{if(h!==false){this._createJob(f,false)}}}if(h!==false){this.triggerEvent("onwizardjobsreceived",this._jobRegistry)}this._isPolling=false}.bind(this,b),this.componentBus._componentServer.replace(/ComponentHandler.ashx/gi,"WizardHandler.ashx"))}else{if(this.isValidating()===true){this._getJobQueue.bind(this,b).delay(0.5)}}},_getWizardInterface:function(j,h,g){if(!j){return}var f={request:"interface",output:"json",guid:j.guid+((j["interface"]&&j["interface"].wizardName)?"|"+j["interface"].wizardName:"")};if((j["interface"])&&(j["interface"].jobId)&&(j["interface"].jobId!=="")){f.jobId=j["interface"].jobId}g=(g===true)?true:false;if(h){var e;var b="";var a=h.length;var d;for(e=0;e<a;e++){d=h[e];if((d.name)&&(d.filespec)){b+='<FileSpec name="'+d.name+'">'+d.filespec.split("\n")[0]+"</FileSpec>"}}if(b.length>0){f.params=b}}this.request(f,function(m,l,k,n,p){if(p&&p.payload&&p.payload.exceptionMessage){new aw.ui.Dialog.Error({title:"Error",content:p.payload.exceptionMessage.errorMessage});return}else{if((!p)||(!p.payload)||(!p.guid)||(!p.payload.wizardQuestionsResponseMessage)){new aw.ui.Dialog.Error({title:"Error",content:"Could not load wizard interface"});return}}Object.extend(m,{"interface":p.payload.wizardQuestionsResponseMessage});this.triggerEvent("onwizardinterfacereceived",m,l,k)}.bind(this,j,h,g),this.componentBus._componentServer.replace(/ComponentHandler.ashx/gi,"WizardHandler.ashx"))},_getWizardManifest:function(){if(!this.componentBus){return}this._wizards=[];this.activeWizard=null;var a={request:"manifest",output:"json"};this.request(a,function(g,h){if((!h)||(!h.payload)||(!h.payload.wizardManifestResponseMessage)){new aw.ui.Dialog.Error({title:"Error",content:"Could not load wizard manifest"});return}var b;var d=[];var f=null;var e=h.payload.wizardManifestResponseMessage.wizardPackages;for(b=0;f=e[b];b++){d.push(f.wizardPackage)}this._wizards=d;this.triggerEvent("onwizardschanged",d);this.clearJobs();this._getJobQueue();if((!this.activeWizard)&&(d.length>0)){this.setActiveWizard(d[0])}}.bind(this),this.componentBus._componentServer.replace(/ComponentHandler.ashx/gi,"WizardHandler.ashx"))},_initializeWizards:function(){this._getWizardManifest()},_onExportJobOutputComplete:function(e,a,g,f,h){var d=this.componentBus.getComponentReferences("aw.UserDataManager");if((d)&&(d.length>0)){d=d[0]}else{return}var b={action:"export",datatype:g,name:a};d.triggerEvent("onactionexecuted",b)},_onWizardStatusResponseReceived:function(b,p){if(!b.wizardQueueItem){return}var v=b.wizardQueueItem.jobId;var a=b.wizardQueueItem.disposition.toLowerCase();var h=((b.output)&&(b.output.files))?b.output.files:null;var G=((b.output)&&(b.output.userDataTypes))?b.output.userDataTypes:null;var t=null;var u=null;var o=((b.output)&&(b.output.log))?b.output.log:null;var H=b.wizardQueueItem.executionStartDate;var J=b.wizardQueueItem.executionEndDate;var C=b.wizardQueueItem.deployedDate;var I=b.wizardQueueItem.priority;var w=b.wizardQueueItem.metaInfo;var m=(b.wizardQueueItem.wizardExecuteRequestMessage)?b.wizardQueueItem.wizardExecuteRequestMessage.parameters:null;if((a!="error")&&(b.output)&&(b.output.inline)&&(b.output.inline.length>0)){var E,B,A;var z,q,n;var g=b.output.inline;t=[];var F=null;var f=null;var s=null;var d;var x;var D;for(E=0,z=g.length;E<z;E++){s=g[E];if((s)&&(s.inlineOutput)){d=s.inlineOutput;F={toolId:d.toolId,records:[]};t.push(F);D=d.records;orecords=F.records;x=d.fields;n=x.length;for(B=0,q=D.length;B<q;B++){f={};for(A=0;A<n;A++){f[x[A]]=D[B][A]}orecords.push(f)}}}}else{if((b.errors)&&(b.errors.length>0)){u=b.errors}}var e={id:p.id,serverId:v,priority:I,disposition:a,executionStartDate:H,executionEndDate:J,deployedDate:C,metaInfo:w,parameters:m,files:h,userDataTypes:G,output:t,errors:u,log:o,isChained:(p)?p.isChained:false};if(p.callback){e.callback=p.callback}this._updateJob(e)},_pollAllJobs:function(){if((this._jobRegistry)&&(this._jobRegistry.length>0)&&(this._isPolling!==true)){var b=false;var a=this._jobRegistry;var d=a.length;while(d--){if(a[d].disposition&&!a[d].disposition.toLowerCase().match("initializing|complete|error|corrupt|canceling|canceled")){b=true}}if(b===true){this._getJobQueue(false)}}this._pollAllJobs.bind(this).delay(this.statusPollFrequency||10)},_pollJob:function(b){if((!b)||(!b.serverId)){return}var a={request:"status",jobId:b.serverId,output:"json"};this.request(a,function(d,e,f){if((!f)||(!f.payload)||(!f.payload.wizardStatusResponseMessage)){this._updateJob({id:d.id,disposition:"corrupt"});new aw.ui.Dialog.Error({title:"Error",content:"Invalid response from wizard status."});this._deleteJob(d);this._getJobQueue();return}this._onWizardStatusResponseReceived(f.payload.wizardStatusResponseMessage,d)}.bind(this,b),this.componentBus._componentServer.replace(/ComponentHandler\.ashx/gi,"WizardHandler.ashx"))},_updateJob:function(d,a){if((!d)||((!d.id)&&(!d.serverId))||(!d.disposition)){return}d.disposition=d.disposition.toLowerCase();var e=this.getJobById(d.id||d.serverId);if(e){if(e.disposition!=d.disposition){Object.extend(e,d);if(e.callback){e.callback(e)}this.triggerEvent("onwizardjobupdated",e)}else{for(var b in d){e[b]=d[b]}}}else{if((d.isChained===true)&&(d.disposition=="error")&&(d.callback)){d.callback(d)}else{if(a===true){this._createJob(d)}}}},EVENTS:["onactivewizardchanged","onwizarddeleted","onwizardinterfacereceived","onwizardinforeceived","onwizardschanged","onwizardjobupdated","onwizardjobcreated","onwizardjobsreceived","onwizardvalidated","onwizardvalidateerror"],VALID_PROPERTIES:["componentBus","statusPollFrequency"],CLASS_NAME:"aw.WizardManager"});aw.BUILD_VERSION = '6.6.25914';

