window.dhtmlHistory={isIE:false,isOpera:false,isSafari:false,isKonquerer:false,isGecko:false,isSupported:false,create:function(d){var g=this;var f=navigator.userAgent.toLowerCase();var a=navigator.platform.toLowerCase();var h=navigator.vendor||"";if(h==="KDE"){this.isKonqueror=true;this.isSupported=false}else{if(typeof window.opera!=="undefined"){this.isOpera=true;this.isSupported=true}else{if(typeof document.all!=="undefined"){this.isIE=true;this.isSupported=true}else{if(h.indexOf("Apple Computer, Inc.")>-1){this.isSafari=true;this.isSupported=(a.indexOf("mac")>-1)}else{if(f.indexOf("gecko")!=-1){this.isGecko=true;this.isSupported=true}}}}}window.historyStorage.setup(d);if(this.isSafari){this.createSafari()}else{if(this.isOpera){this.createOpera()}}var b=this.getCurrentLocation();this.currentLocation=b;if(this.isIE){this.createIE(b)}var e=function(){g.firstLoad=null};this.addEventListener(window,"unload",e);if(this.isIE){this.ignoreLocationChange=true}else{if(!historyStorage.hasKey(this.PAGELOADEDSTRING)){this.ignoreLocationChange=true;this.firstLoad=true;historyStorage.put(this.PAGELOADEDSTRING,true)}else{this.ignoreLocationChange=false;this.fireOnNewListener=true}}var c=function(){g.checkLocation()};setInterval(c,100)},initialize:function(){if(this.isIE){if(!historyStorage.hasKey(this.PAGELOADEDSTRING)){this.fireOnNewListener=false;this.firstLoad=true;historyStorage.put(this.PAGELOADEDSTRING,true)}else{this.fireOnNewListener=true;this.firstLoad=false}}},addListener:function(a){this.listener=a;if(this.fireOnNewListener){this.fireHistoryEvent(this.currentLocation);this.fireOnNewListener=false}},addEventListener:function(c,b,a){if(c.addEventListener){c.addEventListener(b,a,false)}else{if(c.attachEvent){c.attachEvent("on"+b,function(){a(window.event)})}}},add:function(c,d){if(this.isSafari){c=this.removeHash(c);historyStorage.put(c,d);this.currentLocation=c;window.location.hash=c;this.putSafariState(c)}else{var b=this;var a=function(){if(b.currentWaitTime>0){b.currentWaitTime=b.currentWaitTime-b.waitTime}c=b.removeHash(c);if(document.getElementById(c)&&b.debugMode){var f="Exception: History locations can not have the same value as _any_ IDs that might be in the document, due to a bug in IE; please ask the developer to choose a history location that does not match any HTML IDs in this document. The following ID is already taken and cannot be a location: "+c;throw new Error(f)}historyStorage.put(c,d);b.ignoreLocationChange=true;b.ieAtomicLocationChange=true;b.currentLocation=c;window.location.hash=c;if(b.isIE){b.iframe.src="blank.html?"+c}b.ieAtomicLocationChange=false};window.setTimeout(a,this.currentWaitTime);this.currentWaitTime=this.currentWaitTime+this.waitTime}},isFirstLoad:function(){return this.firstLoad},getVersion:function(){return"0.6"},getCurrentLocation:function(){var a=(this.isSafari?this.getSafariState():this.getCurrentHash());return a},getCurrentHash:function(){var b=window.location.href;var a=b.indexOf("#");return(a>=0?b.substr(a+1):"")},PAGELOADEDSTRING:"DhtmlHistory_pageLoaded",listener:null,waitTime:200,currentWaitTime:0,currentLocation:null,iframe:null,safariHistoryStartPoint:null,safariStack:null,safariLength:null,ignoreLocationChange:null,fireOnNewListener:null,firstLoad:null,ieAtomicLocationChange:null,createIE:function(a){this.waitTime=400;var b=(historyStorage.debugMode?"width: 800px;height:80px;border:1px solid black;":historyStorage.hideStyles);var d="rshHistoryFrame";var c='<iframe frameborder="0" id="'+d+'" style="'+b+'" src="blank.html?'+a+'"></iframe>';document.write(c);this.iframe=document.getElementById(d)},createOpera:function(){this.waitTime=400;var a='<img src="javascript:location.href=\'javascript:dhtmlHistory.checkLocation();\';" style="'+historyStorage.hideStyles+'" />';document.write(a)},createSafari:function(){var e="rshSafariForm";var d="rshSafariStack";var c="rshSafariLength";var b=historyStorage.debugMode?historyStorage.showStyles:historyStorage.hideStyles;var a=(historyStorage.debugMode?"width:800px;height:20px;border:1px solid black;margin:0;padding:0;":historyStorage.hideStyles);var f='<form id="'+e+'" style="'+b+'"><input type="text" style="'+a+'" id="'+d+'" value="[]"/><input type="text" style="'+a+'" id="'+c+'" value=""/></form>';document.write(f);this.safariStack=document.getElementById(d);this.safariLength=document.getElementById(c);if(!historyStorage.hasKey(this.PAGELOADEDSTRING)){this.safariHistoryStartPoint=history.length;this.safariLength.value=this.safariHistoryStartPoint}else{this.safariHistoryStartPoint=this.safariLength.value}},getSafariStack:function(){var a=this.safariStack.value;return historyStorage.fromJSON(a)},getSafariState:function(){var a=this.getSafariStack();var b=a[history.length-this.safariHistoryStartPoint-1];return b},putSafariState:function(b){var a=this.getSafariStack();a[history.length-this.safariHistoryStartPoint]=b;this.safariStack.value=historyStorage.toJSON(a)},fireHistoryEvent:function(a){var b=historyStorage.get(a);this.listener.call(null,a,b)},checkLocation:function(){if(!this.isIE&&this.ignoreLocationChange){this.ignoreLocationChange=false;return}if(!this.isIE&&this.ieAtomicLocationChange){return}var a=this.getCurrentLocation();if(a==this.currentLocation){return}this.ieAtomicLocationChange=true;if(this.isIE&&this.getIframeHash()!=a){this.iframe.src="blank.html?"+a}else{if(this.isIE){return}}this.currentLocation=a;this.ieAtomicLocationChange=false;this.fireHistoryEvent(a)},getIframeHash:function(){var b=this.iframe.contentWindow.document;var a=String(b.location.search);if(a.length==1&&a.charAt(0)=="?"){a=""}else{if(a.length>=2&&a.charAt(0)=="?"){a=a.substring(1)}}return a},removeHash:function(b){var a;if(b===null||b===undefined){a=null}else{if(b===""){a=""}else{if(b.length==1&&b.charAt(0)=="#"){a=""}else{if(b.length>1&&b.charAt(0)=="#"){a=b.substring(1)}else{a=b}}}}return a},iframeLoaded:function(a){if(this.ignoreLocationChange){this.ignoreLocationChange=false;return}var b=String(a.search);if(b.length==1&&b.charAt(0)=="?"){b=""}else{if(b.length>=2&&b.charAt(0)=="?"){b=b.substring(1)}}window.location.hash=b;this.fireHistoryEvent(b)}};window.historyStorage={setup:function(b){if(typeof b!=="undefined"){if(b.debugMode){this.debugMode=b.debugMode}if(b.toJSON){this.toJSON=b.toJSON}if(b.fromJSON){this.fromJSON=b.fromJSON}}var d="rshStorageForm";var f="rshStorageField";var a=this.debugMode?historyStorage.showStyles:historyStorage.hideStyles;var e=(historyStorage.debugMode?"width: 800px;height:80px;border:1px solid black;":historyStorage.hideStyles);var c='<form id="'+d+'" style="'+a+'"><textarea id="'+f+'" style="'+e+'"></textarea></form>';document.write(c);this.storageField=document.getElementById(f);if(typeof window.opera!=="undefined"){this.storageField.focus()}},put:function(a,b){this.assertValidKey(a);if(this.hasKey(a)){this.remove(a)}this.storageHash[a]=b;this.saveHashTable()},get:function(a){this.assertValidKey(a);this.loadHashTable();var b=this.storageHash[a];if(b===undefined){b=null}return b},remove:function(a){this.assertValidKey(a);this.loadHashTable();delete this.storageHash[a];this.saveHashTable()},reset:function(){this.storageField.value="";this.storageHash={}},hasKey:function(a){this.assertValidKey(a);this.loadHashTable();return(typeof this.storageHash[a]!=="undefined")},isValidKey:function(a){return(typeof a==="string")},showStyles:"border:0;margin:0;padding:0;",hideStyles:"left:-1000px;top:-1000px;width:1px;height:1px;border:0;position:absolute;",debugMode:false,storageHash:{},hashLoaded:false,storageField:null,assertValidKey:function(a){var b=this.isValidKey(a);if(!b&&this.debugMode){throw new Error("Please provide a valid key for window.historyStorage. Invalid key = "+a+".")}},loadHashTable:function(){if(!this.hashLoaded){var a=this.storageField.value;if(a!==""&&a!==null){this.storageHash=this.fromJSON(a);this.hashLoaded=true}}},saveHashTable:function(){this.loadHashTable();var a=this.toJSON(this.storageHash);this.storageField.value=a},toJSON:function(a){return a.toJSONString()},fromJSON:function(a){return a.parseJSON()}};var Prototype={Version:"1.6.1",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.*Safari/.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 c=document.createElement("div");var b=document.createElement("form");var a=false;if(c.__proto__&&(c.__proto__!==b.__proto__)){a=true}c=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 c;for(var b=0,d=arguments.length;b<d;b++){var a=arguments[b];try{c=a();break}catch(f){}}return c}};var Class=(function(){function a(){}function b(){var g=null,f=$A(arguments);if(Object.isFunction(f[0])){g=f.shift()}function d(){this.initialize.apply(this,arguments)}Object.extend(d,Class.Methods);d.superclass=g;d.subclasses=[];if(g){a.prototype=g.prototype;d.prototype=new a;g.subclasses.push(d)}for(var e=0;e<f.length;e++){d.addMethods(f[e])}if(!d.prototype.initialize){d.prototype.initialize=Prototype.emptyFunction}d.prototype.constructor=d;return d}function c(l){var f=this.superclass&&this.superclass.prototype;var e=Object.keys(l);if(!Object.keys({toString:true}).length){if(l.toString!=Object.prototype.toString){e.push("toString")}if(l.valueOf!=Object.prototype.valueOf){e.push("valueOf")}}for(var d=0,g=e.length;d<g;d++){var k=e[d],h=l[k];if(f&&Object.isFunction(h)&&h.argumentNames().first()=="$super"){var m=h;h=(function(o){return function(){return f[o].apply(this,arguments)}})(k).wrap(m);h.valueOf=m.valueOf.bind(m);h.toString=m.toString.bind(m)}this.prototype[k]=h}return this}return{create:b,Methods:{addMethods:c}}})();(function(){var d=Object.prototype.toString;function k(t,v){for(var u in v){t[u]=v[u]}return t}function o(t){try{if(e(t)){return"undefined"}if(t===null){return"null"}return t.inspect?t.inspect():String(t)}catch(u){if(u instanceof RangeError){return"..."}throw u}}function m(t){var v=typeof t;switch(v){case"undefined":case"function":case"unknown":return;case"boolean":return t.toString()}if(t===null){return"null"}if(t.toJSON){return t.toJSON()}if(h(t)){return}var u=[];for(var z in t){var w=m(t[z]);if(!e(w)){u.push(z.toJSON()+": "+w)}}return"{"+u.join(", ")+"}"}function c(t){return $H(t).toQueryString()}function f(t){return t&&t.toHTML?t.toHTML():String.interpret(t)}function r(t){var u=[];for(var v in t){u.push(v)}return u}function p(t){var u=[];for(var v in t){u.push(t[v])}return u}function l(t){return k({},t)}function h(t){return !!(t&&t.nodeType==1)}function g(t){return d.call(t)=="[object Array]"}function s(t){return t instanceof Hash}function b(t){return typeof t==="function"}function a(t){return d.call(t)=="[object String]"}function q(t){return d.call(t)=="[object Number]"}function e(t){return typeof t==="undefined"}k(Object,{extend:k,inspect:o,toJSON:m,toQueryString:c,toHTML:f,keys:r,values:p,clone:l,isElement:h,isArray:g,isHash:s,isFunction:b,isString:a,isNumber:q,isUndefined:e})})();Object.extend(Function.prototype,(function(){var m=Array.prototype.slice;function d(r,o){var q=r.length,p=o.length;while(p--){r[q+p]=o[p]}return r}function k(p,o){p=m.call(p,0);return d(p,o)}function g(){var o=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g,"").replace(/\s+/g,"").split(",");return o.length==1&&!o[0]?[]:o}function h(q){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this}var o=this,p=m.call(arguments,1);return function(){var r=k(p,arguments);return o.apply(q,r)}}function f(q){var o=this,p=m.call(arguments,1);return function(s){var r=d([s||window.event],p);return o.apply(q,r)}}function l(){if(!arguments.length){return this}var o=this,p=m.call(arguments,0);return function(){var q=k(p,arguments);return o.apply(this,q)}}function e(q){var o=this,p=m.call(arguments,1);q=q*1000;return window.setTimeout(function(){return o.apply(o,p)},q)}function a(){var o=d([0.01],arguments);return this.delay.apply(this,o)}function c(p){var o=this;return function(){var q=d([o.bind(this)],arguments);return p.apply(this,q)}}function b(){if(this._methodized){return this._methodized}var o=this;return this._methodized=function(){var p=d([this],arguments);return o.apply(null,p)}}return{argumentNames:g,bind:h,bindAsEventListener:f,curry:l,delay:e,defer:a,wrap:c,methodize:b}})());Date.prototype.toJSON=function(){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"'};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(){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");var 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());var 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(){var parts=this.split("-"),len=parts.length;if(len==1){return parts[0]}var camelized=this.charAt(0)=="-"?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i<len;i++){camelized+=parts[i].charAt(0).toUpperCase()+parts[i].substring(1)}return camelized}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 toJSON(){return this.inspect(true)}function unfilterJSON(filter){return this.replace(filter||Prototype.JSONFilter,"$1")}function isJSON(){var str=this;if(str.blank()){return false}str=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str)}function evalJSON(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())}function include(pattern){return this.indexOf(pattern)>-1}function startsWith(pattern){return this.indexOf(pattern)===0}function endsWith(pattern){var d=this.length-pattern.length;return d>=0&&this.lastIndexOf(pattern)===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?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,toJSON:toJSON,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON: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(d){if(a==null){return(d[1]+"")}var f=d[1]||"";if(f=="\\"){return d[2]}var b=a,g=d[3];var e=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;d=e.exec(g);if(d==null){return f}while(d!=null){var c=d[1].startsWith("[")?d[2].replace(/\\\\]/g,"]"):d[1];b=b[c];if(null==b||""==d[3]){break}g=g.substring("["==d[3]?d[1].length:d[0].length);d=e.exec(g)}return f+String.interpret(b)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable=(function(){function c(D,C){var B=0;try{this._each(function(F){D.call(C,F,B++)})}catch(E){if(E!=$break){throw E}}return this}function u(E,D,C){var B=-E,F=[],G=this.toArray();if(E<1){return G}while((B+=E)<G.length){F.push(G.slice(B,B+E))}return F.collect(D,C)}function b(D,C){D=D||Prototype.K;var B=true;this.each(function(F,E){B=B&&!!D.call(C,F,E);if(!B){throw $break}});return B}function k(D,C){D=D||Prototype.K;var B=false;this.each(function(F,E){if(B=!!D.call(C,F,E)){throw $break}});return B}function l(D,C){D=D||Prototype.K;var B=[];this.each(function(F,E){B.push(D.call(C,F,E))});return B}function w(D,C){var B;this.each(function(F,E){if(D.call(C,F,E)){B=F;throw $break}});return B}function h(D,C){var B=[];this.each(function(F,E){if(D.call(C,F,E)){B.push(F)}});return B}function g(E,D,C){D=D||Prototype.K;var B=[];if(Object.isString(E)){E=new RegExp(RegExp.escape(E))}this.each(function(G,F){if(E.match(G)){B.push(D.call(C,G,F))}});return B}function a(B){if(Object.isFunction(this.indexOf)){if(this.indexOf(B)!=-1){return true}}var C=false;this.each(function(D){if(D==B){C=true;throw $break}});return C}function t(C,B){B=Object.isUndefined(B)?null:B;return this.eachSlice(C,function(D){while(D.length<C){D.push(B)}return D})}function o(B,D,C){this.each(function(F,E){B=D.call(C,B,F,E)});return B}function A(C){var B=$A(arguments).slice(1);return this.map(function(D){return D[C].apply(D,B)})}function s(D,C){D=D||Prototype.K;var B;this.each(function(F,E){F=D.call(C,F,E);if(B==null||F>=B){B=F}});return B}function q(D,C){D=D||Prototype.K;var B;this.each(function(F,E){F=D.call(C,F,E);if(B==null||F<B){B=F}});return B}function e(E,C){E=E||Prototype.K;var D=[],B=[];this.each(function(G,F){(E.call(C,G,F)?D:B).push(G)});return[D,B]}function f(C){var B=[];this.each(function(D){B.push(D[C])});return B}function d(D,C){var B=[];this.each(function(F,E){if(!D.call(C,F,E)){B.push(F)}});return B}function p(C,B){return this.map(function(E,D){return{value:E,criteria:C.call(B,E,D)}}).sort(function(G,F){var E=G.criteria,D=F.criteria;return E<D?-1:E>D?1:0}).pluck("value")}function r(){return this.map()}function v(){var C=Prototype.K,B=$A(arguments);if(Object.isFunction(B.last())){C=B.pop()}var D=[this].concat(B).map($A);return this.map(function(F,E){return C(D.pluck(E))})}function m(){return this.toArray().length}function z(){return"#<Enumerable:"+this.toArray().inspect()+">"}return{each:c,eachSlice:u,all:b,every:b,any:k,some:k,collect:l,map:l,detect:w,findAll:h,select:h,filter:h,grep:g,include:a,member:a,inGroupsOf:t,inject:o,invoke:A,max:s,min:q,partition:e,pluck:f,reject:d,sortBy:p,toArray:r,entries:r,zip:v,size:m,inspect:z,find:w}})();function $A(c){if(!c){return[]}if("toArray" in Object(c)){return c.toArray()}var b=c.length||0,a=new Array(b);while(b--){a[b]=c[b]}return a}function $w(a){if(!Object.isString(a)){return[]}a=a.strip();return a?a.split(/\s+/):[]}Array.from=$A;(function(){var v=Array.prototype,p=v.slice,r=v.forEach;function b(B){for(var A=0,C=this.length;A<C;A++){B(this[A])}}if(!r){r=b}function o(){this.length=0;return this}function d(){return this[0]}function g(){return this[this.length-1]}function k(){return this.select(function(A){return A!=null})}function z(){return this.inject([],function(B,A){if(Object.isArray(A)){return B.concat(A.flatten())}B.push(A);return B})}function h(){var A=p.call(arguments,0);return this.select(function(B){return !A.include(B)})}function f(A){return(A!==false?this:this.toArray())._reverse()}function m(A){return this.inject([],function(D,C,B){if(0==B||(A?D.last()!=C:!D.include(C))){D.push(C)}return D})}function s(A){return this.uniq().findAll(function(B){return A.detect(function(C){return B===C})})}function t(){return p.call(this,0)}function l(){return this.length}function w(){return"["+this.map(Object.inspect).join(", ")+"]"}function u(){var A=[];this.each(function(B){var C=Object.toJSON(B);if(!Object.isUndefined(C)){A.push(C)}});return"["+A.join(", ")+"]"}function a(C,A){A||(A=0);var B=this.length;if(A<0){A=B+A}for(;A<B;A++){if(this[A]===C){return A}}return -1}function q(B,A){A=isNaN(A)?this.length:(A<0?this.length+A:A)+1;var C=this.slice(0,A).reverse().indexOf(B);return(C<0)?C:A-C-1}function c(){var F=p.call(this,0),D;for(var B=0,C=arguments.length;B<C;B++){D=arguments[B];if(Object.isArray(D)&&!("callee" in D)){for(var A=0,E=D.length;A<E;A++){F.push(D[A])}}else{F.push(D)}}return F}Object.extend(v,Enumerable);if(!v._reverse){v._reverse=v.reverse}Object.extend(v,{_each:r,clear:o,first:d,last:g,compact:k,flatten:z,without:h,reverse:f,uniq:m,intersect:s,clone:t,toArray:t,size:l,inspect:w,toJSON:u});var e=(function(){return[].concat(arguments)[0][0]!==1})(1,2);if(e){v.concat=c}if(!v.indexOf){v.indexOf=a}if(!v.lastIndexOf){v.lastIndexOf=q}})();function $H(a){return new Hash(a)}var Hash=Class.create(Enumerable,(function(){function e(t){this._object=Object.isHash(t)?t.toObject():Object.clone(t)}function f(u){for(var t in this._object){var v=this._object[t],w=[t,v];w.key=t;w.value=v;u(w)}}function m(t,u){return this._object[t]=u}function c(t){if(this._object[t]!==Object.prototype[t]){return this._object[t]}}function q(t){var u=this._object[t];delete this._object[t];return u}function s(){return Object.clone(this._object)}function r(){return this.pluck("key")}function p(){return this.pluck("value")}function g(u){var t=this.detect(function(v){return v.value===u});return t&&t.key}function k(t){return this.clone().update(t)}function d(t){return new Hash(t).inject(this,function(u,v){u.set(v.key,v.value);return u})}function b(t,u){if(Object.isUndefined(u)){return t}return t+"="+encodeURIComponent(String.interpret(u))}function a(){return this.inject([],function(v,w){var u=encodeURIComponent(w.key),t=w.value;if(t&&typeof t=="object"){if(Object.isArray(t)){return v.concat(t.map(b.curry(u)))}}else{v.push(b(u,t))}return v}).join("&")}function o(){return"#<Hash:{"+this.map(function(t){return t.map(Object.inspect).join(": ")}).join(", ")+"}>"}function l(){return Object.toJSON(this.toObject())}function h(){return new Hash(this)}return{initialize:e,_each:f,set:m,get:c,unset:q,toObject:s,toTemplateReplacements:s,keys:r,values:p,index:g,merge:k,update:d,toQueryString:a,inspect:o,toJSON:l,clone:h}})());Hash.from=$H;Object.extend(Number.prototype,(function(){function d(){return this.toPaddedString(2,16)}function e(){return this+1}function a(m,l){$R(0,this,true).each(m,l);return this}function b(o,m){var l=this.toString(m||10);return"0".times(o-l.length)+l}function f(){return isFinite(this)?this.toString():"null"}function k(){return Math.abs(this)}function h(){return Math.round(this)}function g(){return Math.ceil(this)}function c(){return Math.floor(this)}return{toColorPart:d,succ:e,times:a,toPaddedString:b,toJSON:f,abs:k,round:h,ceil:g,floor:c}})());function $R(c,a,b){return new ObjectRange(c,a,b)}var ObjectRange=Class.create(Enumerable,(function(){function b(f,d,e){this.start=f;this.end=d;this.exclusive=e}function c(d){var e=this.start;while(this.include(e)){d(e);e=e.succ()}}function a(d){if(d<this.start){return false}if(this.exclusive){return d<this.end}return d<=this.end}return{initialize:b,_each:c,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(d,b,c,a){this.each(function(f){if(Object.isFunction(f[d])){try{f[d].apply(f,[b,c,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.isString(this.options.parameters)){this.options.parameters=this.options.parameters.toQueryParams()}else{if(Object.isHash(this.options.parameters)){this.options.parameters=this.options.parameters.toObject()}}}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,b,a){$super(a);this.transport=Ajax.getTransport();this.request(b)},request:function(b){this.url=b;this.method=this.options.method;var d=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){d._method=this.method;this.method="post"}this.parameters=d;if(d=Object.toQueryString(d)){if(this.method=="get"){this.url+=(this.url.include("?")?"&":"?")+d}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){d+="&_="}}}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||d):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(c){this.dispatchException(c)}},onStateChange:function(){var a=this.transport.readyState;if(a>1&&!((a==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var e={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){e["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){e.Connection="close"}}if(typeof this.options.requestHeaders=="object"){var c=this.options.requestHeaders;if(Object.isFunction(c.push)){for(var b=0,d=c.length;b<d;b+=2){e[c[b]]=c[b+1]}}else{$H(c).each(function(f){e[f.key]=f.value})}}for(var a in e){this.transport.setRequestHeader(a,e[a])}},success:function(){var a=this.getStatus();return !a||(a>=200&&a<300)},getStatus:function(){try{return this.transport.status||0}catch(a){return 0}},respondToReadyState:function(a){var c=Ajax.Request.Events[a],b=new Ajax.Response(this);if(c=="Complete"){try{this._complete=true;(this.options["on"+b.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(b,b.headerJSON)}catch(d){this.dispatchException(d)}var f=b.getHeader("Content-type");if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&f&&f.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse()}}try{(this.options["on"+c]||Prototype.emptyFunction)(b,b.headerJSON);Ajax.Responders.dispatch("on"+c,this,b,b.headerJSON)}catch(d){this.dispatchException(d)}if(c=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},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(c){this.request=c;var d=this.transport=c.transport,a=this.readyState=d.readyState;if((a>2&&!Prototype.Browser.IE)||a==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(d.responseText);this.headerJSON=this._getHeaderJSON()}if(a==4){var b=d.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($super,a,c,b){this.container={success:(a.success||a),failure:(a.failure||(a.success?null:a))};b=Object.clone(b);var d=b.onComplete;b.onComplete=(function(e,f){this.updateContent(e.responseText);if(Object.isFunction(d)){d(e,f)}}).bind(this);$super(c,b)},updateContent:function(d){var c=this.container[this.success()?"success":"failure"],a=this.options;if(!a.evalScripts){d=d.stripScripts()}if(c=$(c)){if(a.insertion){if(Object.isString(a.insertion)){var b={};b[a.insertion]=d;c.insert(b)}else{a.insertion(c,d)}}else{c.update(d)}}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,a,c,b){$super(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=c;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,d=[],c=arguments.length;a<c;a++){d.push($(arguments[a]))}return d}if(Object.isString(b)){b=document.getElementById(b)}return Element.extend(b)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(f,a){var c=[];var e=document.evaluate(f,$(a)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var b=0,d=e.snapshotLength;b<d;b++){c.push(Element.extend(e.snapshotItem(b)))}return c}}if(!window.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(c){var b=(function(){var f=document.createElement("form");var e=document.createElement("input");var d=document.documentElement;e.setAttribute("name","test");f.appendChild(e);d.appendChild(f);var g=f.elements?(typeof f.elements.test=="undefined"):null;d.removeChild(f);f=e=null;return g})();var a=c.Element;c.Element=function(f,e){e=e||{};f=f.toLowerCase();var d=Element.cache;if(b&&e.name){f="<"+f+' name="'+e.name+'">';delete e.name;return Element.writeAttribute(document.createElement(f),e)}if(!d[f]){d[f]=Element.extend(document.createElement(f))}return Element.writeAttribute(d[f].cloneNode(false),e)};Object.extend(c.Element,a||{});if(a){c.Element.prototype=a.prototype}})(this);Element.cache={};Element.idCounter=1;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 b=(function(){var e=document.createElement("select"),f=true;e.innerHTML='<option value="test">test</option>';if(e.options&&e.options[0]){f=e.options[0].nodeName.toUpperCase()!=="OPTION"}e=null;return f})();var a=(function(){try{var f=document.createElement("table");if(f&&f.tBodies){f.innerHTML="<tbody><tr><td>test</td></tr></tbody>";var h=typeof f.tBodies[0]=="undefined";f=null;return h}}catch(g){return true}})();var d=(function(){var f=document.createElement("script"),h=false;try{f.appendChild(document.createTextNode(""));h=!f.firstChild||f.firstChild&&f.firstChild.nodeType!==3}catch(g){h=true}f=null;return h})();function c(f,g){f=$(f);if(g&&g.toElement){g=g.toElement()}if(Object.isElement(g)){return f.update().insert(g)}g=Object.toHTML(g);var e=f.tagName.toUpperCase();if(e==="SCRIPT"&&d){f.text=g;return f}if(b||a){if(e in Element._insertionTranslations.tags){while(f.firstChild){f.removeChild(f.firstChild)}Element._getContentFromAnonymousElement(e,g.stripScripts()).each(function(h){f.appendChild(h)})}else{f.innerHTML=g.stripScripts()}}else{f.innerHTML=g.stripScripts()}g.evalScripts.bind(g).defer();return f}return c})(),replace:function(b,c){b=$(b);if(c&&c.toElement){c=c.toElement()}else{if(!Object.isElement(c)){c=Object.toHTML(c);var a=b.ownerDocument.createRange();a.selectNode(b);c.evalScripts.bind(c).defer();c=a.createContextualFragment(c.stripScripts())}}b.parentNode.replaceChild(c,b);return b},insert:function(c,e){c=$(c);if(Object.isString(e)||Object.isNumber(e)||Object.isElement(e)||(e&&(e.toElement||e.toHTML))){e={bottom:e}}var d,f,b,g;for(var a in e){d=e[a];a=a.toLowerCase();f=Element._insertionTranslations[a];if(d&&d.toElement){d=d.toElement()}if(Object.isElement(d)){f(c,d);continue}d=Object.toHTML(d);b=((a=="before"||a=="after")?c.parentNode:c).tagName.toUpperCase();g=Element._getContentFromAnonymousElement(b,d.stripScripts());if(a=="top"||a=="after"){g.reverse()}g.each(f.curry(c));d.evalScripts.bind(d).defer()}return c},wrap:function(b,c,a){b=$(b);if(Object.isElement(c)){$(c).writeAttribute(a||{})}else{if(Object.isString(c)){c=new Element(c,a)}else{c=new Element("div",c)}}if(b.parentNode){b.parentNode.replaceChild(c,b)}c.appendChild(b);return c},inspect:function(b){b=$(b);var a="<"+b.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(f){var e=f.first(),c=f.last();var d=(b[e]||"").toString();if(d){a+=" "+c+"="+d.inspect(true)}});return a+">"},recursivelyCollect:function(a,c){a=$(a);var b=[];while(a=a[c]){if(a.nodeType==1){b.push(Element.extend(a))}}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(a){if(!(a=$(a).firstChild)){return[]}while(a&&a.nodeType!=1){a=a.nextSibling}if(a){return[a].concat($(a).nextSiblings())}return[]},previousSiblings:function(a){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){if(Object.isString(a)){a=new Selector(a)}return a.match($(b))},up:function(b,d,a){b=$(b);if(arguments.length==1){return $(b.parentNode)}var c=Element.ancestors(b);return Object.isNumber(d)?c[d]:Selector.findElement(c,d,a)},down:function(b,c,a){b=$(b);if(arguments.length==1){return Element.firstDescendant(b)}return Object.isNumber(c)?Element.descendants(b)[c]:Element.select(b,c)[a||0]},previous:function(b,d,a){b=$(b);if(arguments.length==1){return $(Selector.handlers.previousElementSibling(b))}var c=Element.previousSiblings(b);return Object.isNumber(d)?c[d]:Selector.findElement(c,d,a)},next:function(c,d,b){c=$(c);if(arguments.length==1){return $(Selector.handlers.nextElementSibling(c))}var a=Element.nextSiblings(c);return Object.isNumber(d)?a[d]:Selector.findElement(a,d,b)},select:function(b){var a=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(b,a)},adjacent:function(b){var a=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(b.parentNode,a).without(b)},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(c,a){c=$(c);if(Prototype.Browser.IE){var b=Element._attributeTranslations.read;if(b.values[a]){return b.values[a](c,a)}if(b.names[a]){a=b.names[a]}if(a.include(":")){return(!c.attributes||!c.attributes[a])?null:c.attributes[a].value}}return c.getAttribute(a)},writeAttribute:function(e,c,f){e=$(e);var b={},d=Element._attributeTranslations.write;if(typeof c=="object"){b=c}else{b[c]=Object.isUndefined(f)?true:f}for(var a in b){c=d.names[a]||a;f=b[a];if(d.values[a]){c=d.values[a](e,f)}if(f===false||f===null){e.removeAttribute(c)}else{if(f===true){e.setAttribute(c,c)}else{e.setAttribute(c,f)}}}return e},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 c=a.className;return(c.length>0&&(c==b||new RegExp("(^|\\s)"+b+"(\\s|$)").test(c)))},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 c=b.firstChild;while(c){var a=c.nextSibling;if(c.nodeType==3&&!/\S/.test(c.nodeValue)){b.removeChild(c)}c=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,c){b=$(b);c=c=="float"?"cssFloat":c.camelize();var d=b.style[c];if(!d||d=="auto"){var a=document.defaultView.getComputedStyle(b,null);d=a?a[c]:null}if(c=="opacity"){return d?parseFloat(d):1}return d=="auto"?null:d},getOpacity:function(a){return $(a).getStyle("opacity")},setStyle:function(b,c){b=$(b);var e=b.style,a;if(Object.isString(c)){b.style.cssText+=";"+c;return c.include("opacity")?b.setOpacity(c.match(/opacity:\s*(\d?\.?\d*)/)[1]):b}for(var d in c){if(d=="opacity"){b.setOpacity(c[d])}else{e[(d=="float"||d=="cssFloat")?(Object.isUndefined(e.styleFloat)?"cssFloat":"styleFloat"):d]=c[d]}}return b},setOpacity:function(a,b){a=$(a);a.style.opacity=(b==1||b==="")?"":(b<0.00001)?0:b;return a},getDimensions:function(c){c=$(c);var g=Element.getStyle(c,"display");if(g!="none"&&g!=null){return{width:c.offsetWidth,height:c.offsetHeight}}var b=c.style;var f=b.visibility;var d=b.position;var a=b.display;b.visibility="hidden";if(d!="fixed"){b.position="absolute"}b.display="block";var h=c.clientWidth;var e=c.clientHeight;b.display=a;b.position=d;b.visibility=f;return{width:h,height:e}},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},cumulativeOffset:function(b){var a=0,c=0;do{a+=b.offsetTop||0;c+=b.offsetLeft||0;b=b.offsetParent}while(b);return Element._returnOffset(c,a)},positionedOffset:function(b){var a=0,d=0;do{a+=b.offsetTop||0;d+=b.offsetLeft||0;b=b.offsetParent;if(b){if(b.tagName.toUpperCase()=="BODY"){break}var c=Element.getStyle(b,"position");if(c!=="static"){break}}}while(b);return Element._returnOffset(d,a)},absolutize:function(b){b=$(b);if(Element.getStyle(b,"position")=="absolute"){return b}var d=Element.positionedOffset(b);var f=d[1];var e=d[0];var c=b.clientWidth;var a=b.clientHeight;b._originalLeft=e-parseFloat(b.style.left||0);b._originalTop=f-parseFloat(b.style.top||0);b._originalWidth=b.style.width;b._originalHeight=b.style.height;b.style.position="absolute";b.style.top=f+"px";b.style.left=e+"px";b.style.width=c+"px";b.style.height=a+"px";return b},relativize:function(a){a=$(a);if(Element.getStyle(a,"position")=="relative"){return a}a.style.position="relative";var c=parseFloat(a.style.top||0)-(a._originalTop||0);var b=parseFloat(a.style.left||0)-(a._originalLeft||0);a.style.top=c+"px";a.style.left=b+"px";a.style.height=a._originalHeight;a.style.width=a._originalWidth;return a},cumulativeScrollOffset:function(b){var a=0,c=0;do{a+=b.scrollTop||0;c+=b.scrollLeft||0;b=b.parentNode}while(b);return Element._returnOffset(c,a)},getOffsetParent:function(a){if(a.offsetParent){return $(a.offsetParent)}if(a==document.body){return $(a)}while((a=a.parentNode)&&a!=document.body){if(Element.getStyle(a,"position")!="static"){return $(a)}}return $(document.body)},viewportOffset:function(d){var a=0,c=0;var b=d;do{a+=b.offsetTop||0;c+=b.offsetLeft||0;if(b.offsetParent==document.body&&Element.getStyle(b,"position")=="absolute"){break}}while(b=b.offsetParent);b=d;do{if(!Prototype.Browser.Opera||(b.tagName&&(b.tagName.toUpperCase()=="BODY"))){a-=b.scrollTop||0;c-=b.scrollLeft||0}}while(b=b.parentNode);return Element._returnOffset(c,a)},clonePosition:function(b,d){var a=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});d=$(d);var e=Element.viewportOffset(d);b=$(b);var f=[0,0];var c=null;if(Element.getStyle(b,"position")=="absolute"){c=Element.getOffsetParent(b);f=Element.viewportOffset(c)}if(c==document.body){f[0]-=document.body.offsetLeft;f[1]-=document.body.offsetTop}if(a.setLeft){b.style.left=(e[0]-f[0]+a.offsetLeft)+"px"}if(a.setTop){b.style.top=(e[1]-f[1]+a.offsetTop)+"px"}if(a.setWidth){b.style.width=d.offsetWidth+"px"}if(a.setHeight){b.style.height=d.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(d,b,c){switch(c){case"left":case"top":case"right":case"bottom":if(d(b,"position")==="static"){return null}case"height":case"width":if(!Element.visible(b)){return null}var e=parseInt(d(b,c),10);if(e!==b["offset"+c.capitalize()]){return e+"px"}var a;if(c==="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(e,function(f,g){var h=d(b,g);return h===null?f:f-parseInt(h,10)})+"px";default:return d(b,c)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(c,a,b){if(b==="title"){return a.title}return c(a,b)})}else{if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(c,b){b=$(b);try{b.offsetParent}catch(f){return $(document.body)}var a=b.getStyle("position");if(a!=="static"){return c(b)}b.setStyle({position:"relative"});var d=c(b);b.setStyle({position:a});return d});$w("positionedOffset viewportOffset").each(function(a){Element.Methods[a]=Element.Methods[a].wrap(function(f,c){c=$(c);try{c.offsetParent}catch(h){return Element._returnOffset(0,0)}var b=c.getStyle("position");if(b!=="static"){return f(c)}var d=c.getOffsetParent();if(d&&d.getStyle("position")==="fixed"){d.setStyle({zoom:1})}c.setStyle({position:"relative"});var g=f(c);c.setStyle({position:b});return g})});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(b,a){try{a.offsetParent}catch(c){return Element._returnOffset(0,0)}return b(a)});Element.Methods.getStyle=function(a,b){a=$(a);b=(b=="float"||b=="cssFloat")?"styleFloat":b.camelize();var c=a.style[b];if(!c&&a.currentStyle){c=a.currentStyle[b]}if(b=="opacity"){if(c=(a.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(c[1]){return parseFloat(c[1])/100}}return 1}if(c=="auto"){if((b=="width"||b=="height")&&(a.getStyle("display")!="none")){return a["offset"+b.capitalize()]+"px"}return null}return c};Element.Methods.setOpacity=function(b,e){function f(g){return g.replace(/alpha\([^\)]*\)/gi,"")}b=$(b);var a=b.currentStyle;if((a&&!a.hasLayout)||(!a&&b.style.zoom=="normal")){b.style.zoom=1}var d=b.getStyle("filter"),c=b.style;if(e==1||e===""){(d=f(d))?c.filter=d:c.removeAttribute("filter");return b}else{if(e<0.00001){e=0}}c.filter=f(d)+"alpha(opacity="+(e*100)+")";return b};Element._attributeTranslations=(function(){var b="className";var a="for";var c=document.createElement("div");c.setAttribute(b,"x");if(c.className!=="x"){c.setAttribute("class","x");if(c.className==="x"){b="class"}}c=null;c=document.createElement("label");c.setAttribute(a,"x");if(c.htmlFor!=="x"){c.setAttribute("htmlFor","x");if(c.htmlFor==="x"){a="htmlFor"}}c=null;return{read:{names:{"class":b,className:b,"for":a,htmlFor:a},values:{_getAttr:function(d,e){return d.getAttribute(e)},_getAttr2:function(d,e){return d.getAttribute(e,2)},_getAttrNode:function(d,f){var e=d.getAttributeNode(f);return e?e.value:""},_getEv:(function(){var d=document.createElement("div");d.onclick=Prototype.emptyFunction;var g=d.getAttribute("onclick");var e;if(String(g).indexOf("{")>-1){e=function(f,h){h=f.getAttribute(h);if(!h){return null}h=h.toString();h=h.split("{")[1];h=h.split("}")[0];return h.strip()}}else{if(g===""){e=function(f,h){h=f.getAttribute(h);if(!h){return null}return h.strip()}}}d=null;return e})(),_flag:function(d,e){return $(d).hasAttribute(e)?e:null},style:function(d){return d.style.cssText.toLowerCase()},title:function(d){return d.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(e){var b=e.getElementsByTagName("*"),d=[];for(var c=0,f;f=b[c];c++){if(f.tagName!=="!"){d.push(f)}}return d}Element.Methods.down=function(c,d,b){c=$(c);if(arguments.length==1){return c.firstDescendant()}return Object.isNumber(d)?a(c)[d]:Element.select(c,d)[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 d=document.createTextNode(" ");a.appendChild(d);a.removeChild(d)}catch(c){}}}return a};Element.Methods.cumulativeOffset=function(b){var a=0,c=0;do{a+=b.offsetTop||0;c+=b.offsetLeft||0;if(b.offsetParent==document.body){if(Element.getStyle(b,"position")=="absolute"){break}}b=b.offsetParent}while(b);return Element._returnOffset(c,a)}}}}}if("outerHTML" in document.documentElement){Element.Methods.replace=function(c,e){c=$(c);if(e&&e.toElement){e=e.toElement()}if(Object.isElement(e)){c.parentNode.replaceChild(e,c);return c}e=Object.toHTML(e);var d=c.parentNode,b=d.tagName.toUpperCase();if(Element._insertionTranslations.tags[b]){var f=c.next();var a=Element._getContentFromAnonymousElement(b,e.stripScripts());d.removeChild(c);if(f){a.each(function(g){d.insertBefore(g,f)})}else{a.each(function(g){d.appendChild(g)})}}else{c.outerHTML=e.stripScripts()}e.evalScripts.bind(e).defer();return c}}Element._returnOffset=function(b,c){var a=[b,c];a.left=b;a.top=c;return a};Element._getContentFromAnonymousElement=function(c,b){var d=new Element("div"),a=Element._insertionTranslations.tags[c];if(a){d.innerHTML=a[0]+b+a[1];a[2].times(function(){d=d.firstChild})}else{d.innerHTML=b}return $A(d.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,c){c=Element._attributeTranslations.has[c]||c;var b=$(a).getAttributeNode(c);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 c(g){if(typeof window.Element!="undefined"){var k=window.Element.prototype;if(k){var m="_"+(Math.random()+"").slice(2);var h=document.createElement(g);k[m]="x";var l=(h[m]!=="x");delete k[m];h=null;return l}}return false}function b(h,g){for(var l in g){var k=g[l];if(Object.isFunction(k)&&!(l in h)){h[l]=k.methodize()}}}var d=c("object");if(Prototype.BrowserFeatures.SpecificElementExtensions){if(d){return function(h){if(h&&typeof h._extendedByPrototype=="undefined"){var g=h.tagName;if(g&&(/^(?:object|applet|embed)$/i.test(g))){b(h,Element.Methods);b(h,Element.Methods.Simulated);b(h,Element.Methods.ByTag[g.toUpperCase()])}}return h}}return Prototype.K}var a={},e=Element.Methods.ByTag;var f=Object.extend(function(k){if(!k||typeof k._extendedByPrototype!="undefined"||k.nodeType!=1||k==window){return k}var g=Object.clone(a),h=k.tagName.toUpperCase();if(e[h]){Object.extend(g,e[h])}b(k,g);k._extendedByPrototype=Prototype.emptyFunction;return k},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(a,Element.Methods);Object.extend(a,Element.Methods.Simulated)}}});f.refresh();return f})();Element.hasAttribute=function(a,b){if(a.hasAttribute){return a.hasAttribute(b)}return Element.Methods.Simulated.hasAttribute(a,b)};Element.addMethods=function(c){var k=Prototype.BrowserFeatures,d=Element.Methods.ByTag;if(!c){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)})}if(arguments.length==2){var b=c;c=arguments[1]}if(!b){Object.extend(Element.Methods,c||{})}else{if(Object.isArray(b)){b.each(g)}else{g(b)}}function g(m){m=m.toUpperCase();if(!Element.Methods.ByTag[m]){Element.Methods.ByTag[m]={}}Object.extend(Element.Methods.ByTag[m],c)}function a(p,o,m){m=m||false;for(var r in p){var q=p[r];if(!Object.isFunction(q)){continue}if(!m||!(r in o)){o[r]=q.methodize()}}}function e(q){var m;var p={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(p[q]){m="HTML"+p[q]+"Element"}if(window[m]){return window[m]}m="HTML"+q+"Element";if(window[m]){return window[m]}m="HTML"+q.capitalize()+"Element";if(window[m]){return window[m]}var o=document.createElement(q);var r=o.__proto__||o.constructor.prototype;o=null;return r}var h=window.HTMLElement?HTMLElement.prototype:Element.prototype;if(k.ElementExtensions){a(Element.Methods,h);a(Element.Methods.Simulated,h,true)}if(k.SpecificElementExtensions){for(var l in Element.Methods.ByTag){var f=e(l);if(Object.isUndefined(f)){continue}a(d[l],f.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 g=Prototype.Browser,e=document,c,d={};function a(){if(g.WebKit&&!e.evaluate){return document}if(g.Opera&&window.parseFloat(window.opera.version())<9.5){return document.body}return document.documentElement}function f(h){if(!c){c=a()}d[h]="client"+h;b["get"+h]=function(){return c[d[h]]};return b["get"+h]()}b.getWidth=f.curry("Width");b.getHeight=f.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[0]}if(!Element.Storage[a]){Element.Storage[a]=$H()}return Element.Storage[a]},store:function(b,a,c){if(!(b=$(b))){return}if(arguments.length===2){Element.getStorage(b).update(a)}else{Element.getStorage(b).set(a,c)}return b},retrieve:function(c,b,a){if(!(c=$(c))){return}var e=Element.getStorage(c),d=e.get(b);if(Object.isUndefined(d)){e.set(b,a);d=a}return d},clone:function(c,a){if(!(c=$(c))){return}var e=c.cloneNode(a);e._prototypeUID=void 0;if(a){var d=Element.select(e,"*"),b=d.length;while(b--){d[b]._prototypeUID=void 0}}return Element.extend(e)}});var Selector=Class.create({initialize:function(a){this.expression=a.strip();if(this.shouldUseSelectorsAPI()){this.mode="selectorsAPI"}else{if(this.shouldUseXPath()){this.mode="xpath";this.compileXPathMatcher()}else{this.mode="normal";this.compileMatcher()}}},shouldUseXPath:(function(){var a=(function(){var e=false;if(document.evaluate&&window.XPathResult){var d=document.createElement("div");d.innerHTML="<ul><li></li></ul><div><ul><li></li></ul></div>";var c=".//*[local-name()='ul' or local-name()='UL']//*[local-name()='li' or local-name()='LI']";var b=document.evaluate(c,d,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);e=(b.snapshotLength!==2);d=null}return e})();return function(){if(!Prototype.BrowserFeatures.XPath){return false}var b=this.expression;if(Prototype.Browser.WebKit&&(b.include("-of-type")||b.include(":empty"))){return false}if((/(\[[\w-]*?:|:checked)/).test(b)){return false}if(a){return false}return true}})(),shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI){return false}if(Selector.CASE_INSENSITIVE_CLASS_NAMES){return false}if(!Selector._div){Selector._div=new Element("div")}try{Selector._div.querySelector(this.expression)}catch(a){return false}return true},compileMatcher:function(){var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m,len=ps.length,name;if(Selector._cache[e]){this.matcher=Selector._cache[e];return}this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i=0;i<len;i++){p=ps[i].re;name=ps[i].name;if(m=e.match(p)){this.matcher.push(Object.isFunction(c[name])?c[name](m):new Template(c[name]).evaluate(m));e=e.replace(m[0],"");break}}}this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join("\n"));Selector._cache[this.expression]=this.matcher},compileXPathMatcher:function(){var h=this.expression,k=Selector.patterns,c=Selector.xpath,g,b,a=k.length,d;if(Selector._cache[h]){this.xpath=Selector._cache[h];return}this.matcher=[".//*"];while(h&&g!=h&&(/\S/).test(h)){g=h;for(var f=0;f<a;f++){d=k[f].name;if(b=h.match(k[f].re)){this.matcher.push(Object.isFunction(c[d])?c[d](b):new Template(c[d]).evaluate(b));h=h.replace(b[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath},findElements:function(a){a=a||document;var c=this.expression,b;switch(this.mode){case"selectorsAPI":if(a!==document){var d=a.id,f=$(a).identify();f=f.replace(/([\.:])/g,"\\$1");c="#"+f+" "+c}b=$A(a.querySelectorAll(c)).map(Element.extend);a.id=d;return b;case"xpath":return document._getElementsByXPath(this.xpath,a);default:return this.matcher(a)}},match:function(l){this.tokens=[];var s=this.expression,a=Selector.patterns,f=Selector.assertions;var b,d,g,r=a.length,c;while(s&&b!==s&&(/\S/).test(s)){b=s;for(var k=0;k<r;k++){d=a[k].re;c=a[k].name;if(g=s.match(d)){if(f[c]){this.tokens.push([c,Object.clone(g)]);s=s.replace(g[0],"")}else{return this.findElements(document).include(l)}}}}var q=true,c,o;for(var k=0,h;h=this.tokens[k];k++){c=h[0],o=h[1];if(!Selector.assertions[c](l,o)){q=false;break}}return q},toString:function(){return this.expression},inspect:function(){return"#<Selector:"+this.expression.inspect()+">"}});if(Prototype.BrowserFeatures.SelectorsAPI&&document.compatMode==="BackCompat"){Selector.CASE_INSENSITIVE_CLASS_NAMES=(function(){var c=document.createElement("div"),a=document.createElement("span");c.id="prototype_test_id";a.className="Test";c.appendChild(a);var b=(c.querySelector("#prototype_test_id .test")!==null);c=a=null;return b})()}Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(a){if(a[1]=="*"){return""}return"[local-name()='"+a[1].toLowerCase()+"' or local-name()='"+a[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(a){a[1]=a[1].toLowerCase();return new Template("[@#{1}]").evaluate(a)},attr:function(a){a[1]=a[1].toLowerCase();a[3]=a[5]||a[6];return new Template(Selector.xpath.operators[a[2]]).evaluate(a)},pseudo:function(a){var b=Selector.xpath.pseudos[a[1]];if(!b){return""}if(Object.isFunction(b)){return b(a)}return new Template(Selector.xpath.pseudos[a[1]]).evaluate(a)},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","only-child":"[not(preceding-sibling::* or following-sibling::*)]",empty:"[count(*) = 0 and (count(text()) = 0)]",checked:"[@checked]",disabled:"[(@disabled) and (@type!='hidden')]",enabled:"[not(@disabled) and (@type!='hidden')]",not:function(f){var k=f[6],c=Selector.patterns,l=Selector.xpath,a,o,h=c.length,b;var d=[];while(k&&a!=k&&(/\S/).test(k)){a=k;for(var g=0;g<h;g++){b=c[g].name;if(f=k.match(c[g].re)){o=Object.isFunction(l[b])?l[b](f):new Template(l[b]).evaluate(f);d.push("("+o.substring(1,o.length-1)+")");k=k.replace(f[0],"");break}}}return"[not("+d.join(" and ")+")]"},"nth-child":function(a){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",a)},"nth-last-child":function(a){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",a)},"nth-of-type":function(a){return Selector.xpath.pseudos.nth("position() ",a)},"nth-last-of-type":function(a){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",a)},"first-of-type":function(a){a[6]="1";return Selector.xpath.pseudos["nth-of-type"](a)},"last-of-type":function(a){a[6]="1";return Selector.xpath.pseudos["nth-last-of-type"](a)},"only-of-type":function(a){var b=Selector.xpath.pseudos;return b["first-of-type"](a)+b["last-of-type"](a)},nth:function(g,e){var h,k=e[6],d;if(k=="even"){k="2n+0"}if(k=="odd"){k="2n+1"}if(h=k.match(/^(\d+)$/)){return"["+g+"= "+h[1]+"]"}if(h=k.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(h[1]=="-"){h[1]=-1}var f=h[1]?Number(h[1]):1;var c=h[2]?Number(h[2]):0;d="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(d).evaluate({fragment:g,a:f,b:c})}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);      c = false;',className:'n = h.className(n, r, "#{1}", c);    c = false;',id:'n = h.id(n, r, "#{1}", c);           c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(a){a[3]=(a[5]||a[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(a)},pseudo:function(a){if(a[6]){a[6]=a[6].replace(/"/g,'\\"')}return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(a)},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:[{name:"laterSibling",re:/^\s*~\s*/},{name:"child",re:/^\s*>\s*/},{name:"adjacent",re:/^\s*\+\s*/},{name:"descendant",re:/^\s/},{name:"tagName",re:/^\s*(\*|[\w\-]+)(\b|$)?/},{name:"id",re:/^#([\w\-\*]+)(\b|$)/},{name:"className",re:/^\.([\w\-\*]+)(\b|$)/},{name:"pseudo",re:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/},{name:"attrPresence",re:/^\[((?:[\w-]+:)?[\w-]+)\]/},{name:"attr",re:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/}],assertions:{tagName:function(a,b){return b[1].toUpperCase()==a.tagName.toUpperCase()},className:function(a,b){return Element.hasClassName(a,b[1])},id:function(a,b){return a.id===b[1]},attrPresence:function(a,b){return Element.hasAttribute(a,b[1])},attr:function(b,c){var a=Element.readAttribute(b,c[1]);return a&&Selector.operators[c[2]](a,c[5]||c[6])}},handlers:{concat:function(d,c){for(var e=0,f;f=c[e];e++){d.push(f)}return d},mark:function(a){var d=Prototype.emptyFunction;for(var b=0,c;c=a[b];b++){c._countedByPrototype=d}return a},unmark:(function(){var a=(function(){var b=document.createElement("div"),e=false,d="_countedByPrototype",c="x";b[d]=c;e=(b.getAttribute(d)===c);b=null;return e})();return a?function(b){for(var c=0,d;d=b[c];c++){d.removeAttribute("_countedByPrototype")}return b}:function(b){for(var c=0,d;d=b[c];c++){d._countedByPrototype=void 0}return b}})(),index:function(a,d,g){a._countedByPrototype=Prototype.emptyFunction;if(d){for(var b=a.childNodes,e=b.length-1,c=1;e>=0;e--){var f=b[e];if(f.nodeType==1&&(!g||f._countedByPrototype)){f.nodeIndex=c++}}}else{for(var e=0,c=1,b=a.childNodes;f=b[e];e++){if(f.nodeType==1&&(!g||f._countedByPrototype)){f.nodeIndex=c++}}}},unique:function(b){if(b.length==0){return b}var d=[],e;for(var c=0,a=b.length;c<a;c++){if(typeof(e=b[c])._countedByPrototype=="undefined"){e._countedByPrototype=Prototype.emptyFunction;d.push(Element.extend(e))}}return Selector.handlers.unmark(d)},descendant:function(a){var d=Selector.handlers;for(var c=0,b=[],e;e=a[c];c++){d.concat(b,e.getElementsByTagName("*"))}return b},child:function(a){var e=Selector.handlers;for(var d=0,c=[],f;f=a[d];d++){for(var b=0,g;g=f.childNodes[b];b++){if(g.nodeType==1&&g.tagName!="!"){c.push(g)}}}return c},adjacent:function(a){for(var c=0,b=[],e;e=a[c];c++){var d=this.nextElementSibling(e);if(d){b.push(d)}}return b},laterSibling:function(a){var d=Selector.handlers;for(var c=0,b=[],e;e=a[c];c++){d.concat(b,Element.nextSiblings(e))}return b},nextElementSibling:function(a){while(a=a.nextSibling){if(a.nodeType==1){return a}}return null},previousElementSibling:function(a){while(a=a.previousSibling){if(a.nodeType==1){return a}}return null},tagName:function(a,k,c,b){var l=c.toUpperCase();var e=[],g=Selector.handlers;if(a){if(b){if(b=="descendant"){for(var f=0,d;d=a[f];f++){g.concat(e,d.getElementsByTagName(c))}return e}else{a=this[b](a)}if(c=="*"){return a}}for(var f=0,d;d=a[f];f++){if(d.tagName.toUpperCase()===l){e.push(d)}}return e}else{return k.getElementsByTagName(c)}},id:function(a,l,b,c){var k=$(b),g=Selector.handlers;if(l==document){if(!k){return[]}if(!a){return[k]}}else{if(!l.sourceIndex||l.sourceIndex<1){var a=l.getElementsByTagName("*");for(var e=0,d;d=a[e];e++){if(d.id===b){return[d]}}}}if(a){if(c){if(c=="child"){for(var f=0,d;d=a[f];f++){if(k.parentNode==d){return[k]}}}else{if(c=="descendant"){for(var f=0,d;d=a[f];f++){if(Element.descendantOf(k,d)){return[k]}}}else{if(c=="adjacent"){for(var f=0,d;d=a[f];f++){if(Selector.handlers.previousElementSibling(k)==d){return[k]}}}else{a=g[c](a)}}}}for(var f=0,d;d=a[f];f++){if(d==k){return[k]}}return[]}return(k&&Element.descendantOf(k,l))?[k]:[]},className:function(b,a,c,d){if(b&&d){b=this[d](b)}return Selector.handlers.byClassName(b,a,c)},byClassName:function(c,b,f){if(!c){c=Selector.handlers.descendant([b])}var h=" "+f+" ";for(var e=0,d=[],g,a;g=c[e];e++){a=g.className;if(a.length==0){continue}if(a==f||(" "+a+" ").include(h)){d.push(g)}}return d},attrPresence:function(c,b,a,g){if(!c){c=b.getElementsByTagName("*")}if(c&&g){c=this[g](c)}var e=[];for(var d=0,f;f=c[d];d++){if(Element.hasAttribute(f,a)){e.push(f)}}return e},attr:function(a,k,h,l,c,b){if(!a){a=k.getElementsByTagName("*")}if(a&&b){a=this[b](a)}var m=Selector.operators[c],f=[];for(var e=0,d;d=a[e];e++){var g=Element.readAttribute(d,h);if(g===null){continue}if(m(g,l)){f.push(d)}}return f},pseudo:function(b,c,e,a,d){if(b&&d){b=this[d](b)}if(!b){b=a.getElementsByTagName("*")}return Selector.pseudos[c](b,e,a)}},pseudos:{"first-child":function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(Selector.handlers.previousElementSibling(e)){continue}c.push(e)}return c},"last-child":function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(Selector.handlers.nextElementSibling(e)){continue}c.push(e)}return c},"only-child":function(b,g,a){var e=Selector.handlers;for(var d=0,c=[],f;f=b[d];d++){if(!e.previousElementSibling(f)&&!e.nextElementSibling(f)){c.push(f)}}return c},"nth-child":function(b,c,a){return Selector.pseudos.nth(b,c,a)},"nth-last-child":function(b,c,a){return Selector.pseudos.nth(b,c,a,true)},"nth-of-type":function(b,c,a){return Selector.pseudos.nth(b,c,a,false,true)},"nth-last-of-type":function(b,c,a){return Selector.pseudos.nth(b,c,a,true,true)},"first-of-type":function(b,c,a){return Selector.pseudos.nth(b,"1",a,false,true)},"last-of-type":function(b,c,a){return Selector.pseudos.nth(b,"1",a,true,true)},"only-of-type":function(b,d,a){var c=Selector.pseudos;return c["last-of-type"](c["first-of-type"](b,d,a),d,a)},getIndices:function(d,c,e){if(d==0){return c>0?[c]:[]}return $R(1,e).inject([],function(a,b){if(0==(b-c)%d&&(b-c)/d>=0){a.push(b)}return a})},nth:function(c,t,v,s,e){if(c.length==0){return[]}if(t=="even"){t="2n+0"}if(t=="odd"){t="2n+1"}var r=Selector.handlers,q=[],d=[],g;r.mark(c);for(var p=0,f;f=c[p];p++){if(!f.parentNode._countedByPrototype){r.index(f.parentNode,s,e);d.push(f.parentNode)}}if(t.match(/^\d+$/)){t=Number(t);for(var p=0,f;f=c[p];p++){if(f.nodeIndex==t){q.push(f)}}}else{if(g=t.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(g[1]=="-"){g[1]=-1}var w=g[1]?Number(g[1]):1;var u=g[2]?Number(g[2]):0;var z=Selector.pseudos.getIndices(w,u,c.length);for(var p=0,f,k=z.length;f=c[p];p++){for(var o=0;o<k;o++){if(f.nodeIndex==z[o]){q.push(f)}}}}}r.unmark(c);r.unmark(d);return q},empty:function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(e.tagName=="!"||e.firstChild){continue}c.push(e)}return c},not:function(a,d,l){var g=Selector.handlers,o,c;var k=new Selector(d).findElements(l);g.mark(k);for(var f=0,e=[],b;b=a[f];f++){if(!b._countedByPrototype){e.push(b)}}g.unmark(k);return e},enabled:function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(!e.disabled&&(!e.type||e.type!=="hidden")){c.push(e)}}return c},disabled:function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(e.disabled){c.push(e)}}return c},checked:function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(e.checked){c.push(e)}}return c}},operators:{"=":function(b,a){return b==a},"!=":function(b,a){return b!=a},"^=":function(b,a){return b==a||b&&b.startsWith(a)},"$=":function(b,a){return b==a||b&&b.endsWith(a)},"*=":function(b,a){return b==a||b&&b.include(a)},"~=":function(b,a){return(" "+b+" ").include(" "+a+" ")},"|=":function(b,a){return("-"+(b||"").toUpperCase()+"-").include("-"+(a||"").toUpperCase()+"-")}},split:function(b){var a=[];b.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(c){a.push(c[1].strip())});return a},matchElements:function(f,g){var e=$$(g),d=Selector.handlers;d.mark(e);for(var c=0,b=[],a;a=f[c];c++){if(a._countedByPrototype){b.push(a)}}d.unmark(e);return b},findElement:function(b,c,a){if(Object.isNumber(c)){a=c;c=false}return Selector.matchElements(b,c||"*")[a||0]},findChildElements:function(e,g){g=Selector.split(g.join(","));var d=[],f=Selector.handlers;for(var c=0,b=g.length,a;c<b;c++){a=new Selector(g[c].strip());f.concat(d,a.findElements(e))}return(b>1)?f.unique(d):d}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(d,c){for(var e=0,f;f=c[e];e++){if(f.tagName!=="!"){d.push(f)}}return d}})}function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(a){a=$(a);a.reset();return a},serializeElements:function(g,b){if(typeof b!="object"){b={hash:!!b}}else{if(Object.isUndefined(b.hash)){b.hash=true}}var c,f,a=false,e=b.submit;var d=g.inject({},function(h,k){if(!k.disabled&&k.name){c=k.name;f=$(k).getValue();if(f!=null&&k.type!="file"&&(k.type!="submit"||(!a&&e!==false&&(!e||c==e)&&(a=true)))){if(c in h){if(!Object.isArray(h[c])){h[c]=[h[c]]}h[c].push(f)}else{h[c]=f}}}return h});return b.hash?d:Object.toQueryString(d)}};Form.Methods={serialize:function(b,a){return Form.serializeElements(Form.getElements(b),a)},getElements:function(e){var f=$(e).getElementsByTagName("*"),d,a=[],c=Form.Element.Serializers;for(var b=0;d=f[b];b++){a.push(d)}return a.inject([],function(g,h){if(c[h.tagName.toLowerCase()]){g.push(Element.extend(h))}return g})},getInputs:function(g,c,d){g=$(g);var a=g.getElementsByTagName("input");if(!c&&!d){return $A(a).map(Element.extend)}for(var e=0,h=[],f=a.length;e<f;e++){var b=a[e];if((c&&b.type!=c)||(d&&b.name!=d)){continue}h.push(Element.extend(b))}return h},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 c=$(b).getElements().findAll(function(d){return"hidden"!=d.type&&!d.disabled});var a=c.findAll(function(d){return d.hasAttribute("tabIndex")&&d.tabIndex>=0}).sortBy(function(d){return d.tabIndex}).first();return a?a:c.find(function(d){return/^(?:input|select|textarea)$/i.test(d.tagName)})},focusFirstElement:function(a){a=$(a);a.findFirstElement().activate();return a},request:function(b,a){b=$(b),a=Object.clone(a||{});var d=a.parameters,c=b.readAttribute("action")||"";if(c.blank()){c=window.location.href}a.parameters=b.serialize(true);if(d){if(Object.isString(d)){d=d.toQueryParams()}Object.extend(a.parameters,d)}if(b.hasAttribute("method")&&!a.method){a.method=b.method}return new Ajax.Request(c,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 c={};c[a.name]=b;return Object.toQueryString(c)}}return""},getValue:function(a){a=$(a);var b=a.tagName.toLowerCase();return Form.Element.Serializers[b](a)},setValue:function(a,b){a=$(a);var c=a.tagName.toLowerCase();Form.Element.Serializers[c](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={input:function(a,b){switch(a.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(a,b);default:return Form.Element.Serializers.textarea(a,b)}},inputSelector:function(a,b){if(Object.isUndefined(b)){return a.checked?a.value:null}else{a.checked=!!b}},textarea:function(a,b){if(Object.isUndefined(b)){return a.value}else{a.value=b}},select:function(c,f){if(Object.isUndefined(f)){return this[c.type=="select-one"?"selectOne":"selectMany"](c)}else{var b,d,g=!Object.isArray(f);for(var a=0,e=c.length;a<e;a++){b=c.options[a];d=this.optionValue(b);if(g){if(d==f){b.selected=true;return}}else{b.selected=f.include(d)}}}},selectOne:function(b){var a=b.selectedIndex;return a>=0?this.optionValue(b.options[a]):null},selectMany:function(d){var a,e=d.length;if(!e){return null}for(var c=0,a=[];c<e;c++){var b=d.options[c];if(b.selected){a.push(this.optionValue(b))}}return a},optionValue:function(a){return Element.extend(a).hasAttribute("value")?a.value:a.text}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,a,b,c){$super(c,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 A={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 e=document.documentElement;var B="onmouseenter" in e&&"onmouseleave" in e;var r;if(Prototype.Browser.IE){var h={0:1,1:4,2:2};r=function(D,C){return D.button===h[C]}}else{if(Prototype.Browser.WebKit){r=function(D,C){switch(C){case 0:return D.which==1&&!D.metaKey;case 1:return D.which==1&&D.metaKey;default:return false}}}else{r=function(D,C){return D.which?(D.which===C+1):(D.button===C)}}}function u(C){return r(C,0)}function t(C){return r(C,1)}function m(C){return r(C,2)}function c(E){E=A.extend(E);var D=E.target,C=E.type,F=E.currentTarget;if(F&&F.tagName){if(C==="load"||C==="error"||(C==="click"&&F.tagName.toLowerCase()==="input"&&F.type==="radio")){D=F}}if(D.nodeType==Node.TEXT_NODE){D=D.parentNode}return Element.extend(D)}function p(D,F){var C=A.element(D);if(!F){return C}var E=[C].concat(C.ancestors());return Selector.findElement(E,F,0)}function s(C){return{x:b(C),y:a(C)}}function b(E){var D=document.documentElement,C=document.body||{scrollLeft:0};return E.pageX||(E.clientX+(D.scrollLeft||C.scrollLeft)-(D.clientLeft||0))}function a(E){var D=document.documentElement,C=document.body||{scrollTop:0};return E.pageY||(E.clientY+(D.scrollTop||C.scrollTop)-(D.clientTop||0))}function q(C){A.extend(C);C.preventDefault();C.stopPropagation();C.stopped=true}A.Methods={isLeftClick:u,isMiddleClick:t,isRightClick:m,element:c,findElement:p,pointer:s,pointerX:b,pointerY:a,stop:q};var w=Object.keys(A.Methods).inject({},function(C,D){C[D]=A.Methods[D].methodize();return C});if(Prototype.Browser.IE){function g(D){var C;switch(D.type){case"mouseover":C=D.fromElement;break;case"mouseout":C=D.toElement;break;default:return null}return Element.extend(C)}Object.extend(w,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});A.extend=function(D,C){if(!D){return false}if(D._extendedByPrototype){return D}D._extendedByPrototype=Prototype.emptyFunction;var E=A.pointer(D);Object.extend(D,{target:D.srcElement||C,relatedTarget:g(D),pageX:E.x,pageY:E.y});return Object.extend(D,w)}}else{A.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(A.prototype,w);A.extend=Prototype.K}function o(G,F,H){var E=Element.retrieve(G,"prototype_event_registry");if(Object.isUndefined(E)){d.push(G);E=Element.retrieve(G,"prototype_event_registry",$H())}var C=E.get(F);if(Object.isUndefined(C)){C=[];E.set(F,C)}if(C.pluck("handler").include(H)){return false}var D;if(F.include(":")){D=function(I){if(Object.isUndefined(I.eventName)){return false}if(I.eventName!==F){return false}A.extend(I,G);H.call(G,I)}}else{if(!B&&(F==="mouseenter"||F==="mouseleave")){if(F==="mouseenter"||F==="mouseleave"){D=function(J){A.extend(J,G);var I=J.relatedTarget;while(I&&I!==G){try{I=I.parentNode}catch(K){I=G}}if(I===G){return}H.call(G,J)}}}else{D=function(I){A.extend(I,G);H.call(G,I)}}}D.handler=H;C.push(D);return D}function f(){for(var C=0,D=d.length;C<D;C++){A.stopObserving(d[C]);d[C]=null}}var d=[];if(Prototype.Browser.IE){window.attachEvent("onunload",f)}if(Prototype.Browser.WebKit){window.addEventListener("unload",Prototype.emptyFunction,false)}var l=Prototype.K;if(!B){l=function(D){var C={mouseenter:"mouseover",mouseleave:"mouseout"};return D in C?C[D]:D}}function v(F,E,G){F=$(F);var D=o(F,E,G);if(!D){return F}if(E.include(":")){if(F.addEventListener){F.addEventListener("dataavailable",D,false)}else{F.attachEvent("ondataavailable",D);F.attachEvent("onfilterchange",D)}}else{var C=l(E);if(F.addEventListener){F.addEventListener(C,D,false)}else{F.attachEvent("on"+C,D)}}return F}function k(H,F,I){H=$(H);var E=Element.retrieve(H,"prototype_event_registry");if(Object.isUndefined(E)){return H}if(F&&!I){var G=E.get(F);if(Object.isUndefined(G)){return H}G.each(function(J){Element.stopObserving(H,F,J.handler)});return H}else{if(!F){E.each(function(L){var J=L.key,K=L.value;K.each(function(M){Element.stopObserving(H,J,M.handler)})});return H}}var G=E.get(F);if(!G){return}var D=G.find(function(J){return J.handler===I});if(!D){return H}var C=l(F);if(F.include(":")){if(H.removeEventListener){H.removeEventListener("dataavailable",D,false)}else{H.detachEvent("ondataavailable",D);H.detachEvent("onfilterchange",D)}}else{if(H.removeEventListener){H.removeEventListener(C,D,false)}else{H.detachEvent("on"+C,D)}}E.set(F,G.without(D));return H}function z(F,E,D,C){F=$(F);if(Object.isUndefined(C)){C=true}if(F==document&&document.createEvent&&!F.dispatchEvent){F=document.documentElement}var G;if(document.createEvent){G=document.createEvent("HTMLEvents");G.initEvent("dataavailable",true,true)}else{G=document.createEventObject();G.eventType=C?"ondataavailable":"onfilterchange"}G.eventName=E;G.memo=D||{};if(document.createEvent){F.dispatchEvent(G)}else{F.fireEvent(G.eventType,G)}return A.extend(G)}Object.extend(A,A.Methods);Object.extend(A,{fire:z,observe:v,stopObserving:k});Element.addMethods({fire:z,observe:v,stopObserving:k});Object.extend(document,{fire:z.methodize(),observe:v.methodize(),stopObserving:k.methodize(),loaded:false});if(window.Event){Object.extend(window.Event,A)}else{window.Event=A}})();(function(){var d;function a(){if(document.loaded){return}if(d){window.clearTimeout(d)}document.loaded=true;document.fire("dom:loaded")}function c(){if(document.readyState==="complete"){document.stopObserving("readystatechange",c);a()}}function b(){try{document.documentElement.doScroll("left")}catch(f){d=b.defer();return}a()}if(document.addEventListener){document.addEventListener("DOMContentLoaded",a,false)}else{document.observe("readystatechange",c);if(window==top){d=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,c){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(b,a,c)}this.xcomp=a;this.ycomp=c;this.offset=Element.cumulativeOffset(b);return(c>=this.offset[1]&&c<this.offset[1]+b.offsetHeight&&a>=this.offset[0]&&a<this.offset[0]+b.offsetWidth)},withinIncludingScrolloffsets:function(b,a,d){var c=Element.cumulativeScrollOffset(b);this.xcomp=a+c[0]-this.deltaX;this.ycomp=d+c[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,c,a){a=a||{};return Element.clonePosition(c,b,a)}};if(!document.getElementsByClassName){document.getElementsByClassName=function(b){function a(c){return c.blank()?null:"[contains(concat(' ', @class, ' '), ' "+c+" ')]"}b.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(c,e){e=e.toString().strip();var d=/\s/.test(e)?$w(e).map(a).join(""):a(e);return d?document._getElementsByXPath(".//*"+d,c):[]}:function(e,f){f=f.toString().strip();var g=[],h=(/\s/.test(f)?$w(f):null);if(!h&&!f){return g}var c=$(e).getElementsByTagName("*");f=" "+f+" ";for(var d=0,l,k;l=c[d];d++){if(l.className&&(k=" "+l.className+" ")&&(k.include(f)||(h&&h.all(function(m){return !m.toString().blank()&&k.include(" "+m+" ")})))){g.push(Element.extend(l))}}return g};return function(d,c){return $(c||document.body).getElementsByClassName(d)}}(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);if(!Proto){var Proto={}}Proto.Chart=Class.create({initialize:function(b,c,a){a=a||{};this.graphData=[];this.options=this.merge(a,{colors:["#edc240","#00A8F0","#C0D800","#cb4b4b","#4da74d","#9440ed"],legend:{show:false,noColumns:1,labelFormatter:null,labelBoxBorderColor:"#ccc",container:null,position:"ne",margin:5,backgroundColor:null,backgroundOpacity:0.85},xaxis:{mode:null,min:null,max:null,autoscaleMargin:null,ticks:null,tickFormatter:null,tickDecimals:null,tickSize:null,minTickSize:null,monthNames:null,timeformat:null},yaxis:{mode:null,min:null,max:null,ticks:null,tickFormatter:null,tickDecimals:null,tickSize:null,minTickSize:null,monthNames:null,timeformat:null,autoscaleMargin:0.02},points:{show:false,radius:3,lineWidth:2,fill:true,fillColor:"#ffffff"},lines:{show:false,lineWidth:2,fill:false,fillColor:null},bars:{show:false,lineWidth:2,barWidth:1,fill:true,fillColor:null,showShadow:false,fillOpacity:0.4,autoScale:true},pies:{show:false,radius:50,borderWidth:1,fill:true,fillColor:null,fillOpacity:0.9,labelWidth:30,fontSize:11,autoScale:true},grid:{color:"#545454",backgroundColor:null,tickColor:"#dddddd",labelMargin:3,borderWidth:1,clickable:null,coloredAreas:null,coloredAreasColor:"#f4f4f4",drawXAxis:true,drawYAxis:true},mouse:{track:false,position:"se",fixedPosition:true,clsName:"mouseValHolder",trackFormatter:this.defaultTrackFormatter,margin:3,color:"#ff3f19",trackDecimals:1,sensibility:2,radius:5,lineColor:"#cb4b4b"},selection:{mode:null,color:"#97CBFF"},allowDataClick:true,makeRandomColor:false,shadowSize:4});this.canvas=null;this.overlay=null;this.eventHolder=null;this.context=null;this.overlayContext=null;this.domObj=$(b);this.xaxis={};this.yaxis={};this.chartOffset={left:0,right:0,top:0,bottom:0};this.yLabelMaxWidth=0;this.yLabelMaxHeight=0;this.xLabelBoxWidth=0;this.canvasWidth=0;this.canvasHeight=0;this.chartWidth=0;this.chartHeight=0;this.hozScale=0;this.vertScale=0;this.workarounds={};this.domObj=$(b);this.barDataRange=[];this.lastMousePos={pageX:null,pageY:null};this.selection={first:{x:-1,y:-1},second:{x:-1,y:-1}};this.prevSelection=null;this.selectionInterval=null;this.ignoreClick=false;this.prevHit=null;if(this.options.makeRandomColor){this.options.color=this.makeRandomColor(this.options.colors)}this.setData(c);this.constructCanvas();this.setupGrid();this.draw()},merge:function(d,b){var a=b||{};for(var c in d){a[c]=(typeof(d[c])=="object"&&!(d[c].constructor==Array||d[c].constructor==RegExp))?this.merge(d[c],b[c]):a[c]=d[c]}return a},setData:function(a){this.graphData=this.parseData(a);this.setBarWidth();this.copyGraphDataOptions();this.processGraphData()},parseData:function(b){var a=[];b.each(function(f){var e;if(f.data){e={};for(var c in f){e[c]=f[c]}}else{e={data:f}}a.push(e)}.bind(this));return a},makeRandomColor:function(d){var b=Math.floor(Math.random()*d.length);var a=[];var c=[];a.push(b);while(a.length<d.length){var e=Math.floor(Math.random()*d.length);while(checkExisted(e,a)){e=Math.floor(Math.random()*d.length)}a.push(e)}a.each(function(f){c.push(d[f])}.bind(this));return c},checkExisted:function(c,b){var a=false;b.each(function(d){if(d==c){a=true;throw $break}}.bind(this));return a},setBarWidth:function(){if(this.options.bars.show&&this.options.bars.autoScale){this.options.bars.barWidth=1/this.graphData.length/1.2}},copyGraphDataOptions:function(){var g,m=this.graphData.length,a=[],e=[];this.graphData.each(function(c){var p=c.color;if(p){--m;if(Object.isNumber(p)){e.push(p)}else{a.push(this.parseColor(p))}}}.bind(this));e.each(function(c){m=Math.max(m,c+1)});var b=[];var f=0;g=0;while(b.length<m){var k;if(this.options.colors.length==g){k=new Proto.Color(100,100,100)}else{k=this.parseColor(this.options.colors[g])}var d=f%2==1?-1:1;var h=1+d*Math.ceil(f/2)*0.2;k.scale(h,h,h);b.push(k);++g;if(g>=this.options.colors.length){g=0;++f}}var l=0,o;this.graphData.each(function(c){if(c.color==null){c.color=b[l].toString();++l}else{if(Object.isNumber(c.color)){c.color=b[c.color].toString()}}c.lines=Object.extend(Object.clone(this.options.lines),c.lines);c.points=Object.extend(Object.clone(this.options.points),c.points);c.bars=Object.extend(Object.clone(this.options.bars),c.bars);c.mouse=Object.extend(Object.clone(this.options.mouse),c.mouse);c.mouse.lineColor=c.color;if(c.shadowSize==null){c.shadowSize=this.options.shadowSize}}.bind(this))},processGraphData:function(){this.xaxis.datamin=this.yaxis.datamin=Number.MAX_VALUE;this.xaxis.datamax=this.yaxis.datamax=Number.MIN_VALUE;this.graphData.each(function(a){var b=a.data;b.each(function(e){if(e==null){return}var c=e[0],f=e[1];if(isNaN(c=+c)||isNaN(f=+f)){e=null;return}if(c<this.xaxis.datamin){this.xaxis.datamin=c}if(c>this.xaxis.datamax){this.xaxis.datamax=c}if(f<this.yaxis.datamin){this.yaxis.datamin=f}if(f>this.yaxis.datamax){this.yaxis.datamax=f}}.bind(this))}.bind(this));if(this.xaxis.datamin==Number.MAX_VALUE){this.xaxis.datamin=0}if(this.yaxis.datamin==Number.MAX_VALUE){this.yaxis.datamin=0}if(this.xaxis.datamax==Number.MIN_VALUE){this.xaxis.datamax=1}if(this.yaxis.datamax==Number.MIN_VALUE){this.yaxis.datamax=1}},constructCanvas:function(){this.canvasWidth=this.domObj.getWidth();this.canvasHeight=this.domObj.getHeight();this.domObj.update("");this.domObj.setStyle({position:"relative"});if(this.canvasWidth<=0){this.canvasWdith=400}if(this.canvasHeight<=0){this.canvasHeight=300}this.canvas=(Prototype.Browser.IE)?document.createElement("canvas"):new Element("CANVAS",{width:this.canvasWidth,height:this.canvasHeight});Element.extend(this.canvas);this.canvas.style.width=this.canvasWidth+"px";this.canvas.style.height=this.canvasHeight+"px";this.domObj.appendChild(this.canvas);if(Prototype.Browser.IE){this.canvas=$(window.G_vmlCanvasManager.initElement(this.canvas))}this.canvas=$(this.canvas);this.context=this.canvas.getContext("2d");this.overlay=(Prototype.Browser.IE)?document.createElement("canvas"):new Element("CANVAS",{width:this.canvasWidth,height:this.canvasHeight});Element.extend(this.overlay);this.overlay.style.width=this.canvasWidth+"px";this.overlay.style.height=this.canvasHeight+"px";this.overlay.style.position="absolute";this.overlay.style.left="0px";this.overlay.style.right="0px";this.overlay.setStyle({position:"absolute",left:"0px",right:"0px"});this.domObj.appendChild(this.overlay);if(Prototype.Browser.IE){this.overlay=$(window.G_vmlCanvasManager.initElement(this.overlay))}this.overlay=$(this.overlay);this.overlayContext=this.overlay.getContext("2d");if(this.options.selection.mode){this.overlay.observe("mousedown",this.onMouseDown.bind(this));this.overlay.observe("mousemove",this.onMouseMove.bind(this))}if(this.options.grid.clickable){this.overlay.observe("click",this.onClick.bind(this))}if(this.options.mouse.track){this.overlay.observe("mousemove",this.onMouseMove.bind(this));this.overlay.observe("mouseout",this.onMouseOut.bind(this))}},setupGrid:function(){if(this.options.bars.show){this.xaxis.max+=0.5;this.xaxis.min-=0.5}this.extendXRangeIfNeededByBar();this.setRange(this.xaxis,this.options.xaxis);this.prepareTickGeneration(this.xaxis,this.options.xaxis);this.setTicks(this.xaxis,this.options.xaxis);this.setRange(this.yaxis,this.options.yaxis);this.prepareTickGeneration(this.yaxis,this.options.yaxis);this.setTicks(this.yaxis,this.options.yaxis);this.setSpacing();if(!this.options.pies.show){this.insertLabels()}this.insertLegend()},setRange:function(d,f){var c=f.min!=null?f.min:d.datamin;var a=f.max!=null?f.max:d.datamax;if(a-c==0){var b;if(a==0){b=1}else{b=0.01}c-=b;a+=b}else{var e=f.autoscaleMargin;if(e!=null){if(f.min==null){c-=(a-c)*e;if(c<0&&d.datamin>=0){c=0}}if(f.max==null){a+=(a-c)*e;if(a>0&&d.datamax<=0){a=0}}}}d.min=c;d.max=a},prepareTickGeneration:function(c,k){var d;if(Object.isNumber(k.ticks)&&k.ticks>0){d=k.ticks}else{if(c==this.xaxis){d=this.canvasWidth/100}else{d=this.canvasHeight/60}}var t=(c.max-c.min)/d;var p,a,m,r,s,q,e;if(k.mode=="time"){function l(D,v,z){var w=function(F){F=""+F;return F.length==1?"0"+F:F};var C=[];var B=false;if(z==null){z=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}for(var A=0;A<v.length;++A){var E=v.charAt(A);if(B){switch(E){case"h":E=""+D.getHours();break;case"H":E=w(D.getHours());break;case"M":E=w(D.getMinutes());break;case"S":E=w(D.getSeconds());break;case"d":E=""+D.getDate();break;case"m":E=""+(D.getMonth()+1);break;case"y":E=""+D.getFullYear();break;case"b":E=""+z[D.getMonth()];break}C.push(E);B=false}else{if(E=="%"){B=true}else{C.push(E)}}}return C.join("")}var f={second:1000,minute:60*1000,hour:60*60*1000,day:24*60*60*1000,month:30*24*60*60*1000,year:365.2425*24*60*60*1000};var g=[[1,"second"],[2,"second"],[5,"second"],[10,"second"],[30,"second"],[1,"minute"],[2,"minute"],[5,"minute"],[10,"minute"],[30,"minute"],[1,"hour"],[2,"hour"],[4,"hour"],[8,"hour"],[12,"hour"],[1,"day"],[2,"day"],[3,"day"],[0.25,"month"],[0.5,"month"],[1,"month"],[2,"month"],[3,"month"],[6,"month"],[1,"year"]];var b=0;if(k.minTickSize!=null){if(typeof k.tickSize=="number"){b=k.tickSize}else{b=k.minTickSize[0]*f[k.minTickSize[1]]}}for(s=0;s<g.length-1;++s){if(t<(g[s][0]*f[g[s][1]]+g[s+1][0]*f[g[s+1][1]])/2&&g[s][0]*f[g[s][1]]>=b){break}}p=g[s][0];m=g[s][1];if(m=="year"){q=Math.pow(10,Math.floor(Math.log(t/f.year)/Math.LN10));e=(t/f.year)/q;if(e<1.5){p=1}else{if(e<3){p=2}else{if(e<7.5){p=5}else{p=10}}}p*=q}if(k.tickSize){p=k.tickSize[0];m=k.tickSize[1]}var h=this.floorInBase;a=function(A){var G=[],C=A.tickSize[0],H=A.tickSize[1],D=new Date(A.min);var z=C*f[H];if(H=="second"){D.setSeconds(h(D.getSeconds(),C))}if(H=="minute"){D.setMinutes(h(D.getMinutes(),C))}if(H=="hour"){D.setHours(h(D.getHours(),C))}if(H=="month"){D.setMonth(h(D.getMonth(),C))}if(H=="year"){D.setFullYear(h(D.getFullYear(),C))}D.setMilliseconds(0);if(z>=f.minute){D.setSeconds(0)}if(z>=f.hour){D.setMinutes(0)}if(z>=f.day){D.setHours(0)}if(z>=f.day*28){D.setDate(1)}if(z>=f.year){D.setMonth(0)}var J=0,I;do{I=D.getTime();G.push({v:I,label:A.tickFormatter(I,A)});if(H=="month"){if(C<1){D.setDate(1);var w=D.getTime();D.setMonth(D.getMonth()+1);var B=D.getTime();D.setTime(I+J*f.hour+(B-w)*C);J=D.getHours();D.setHours(0)}else{D.setMonth(D.getMonth()+C)}}else{if(H=="year"){D.setFullYear(D.getFullYear()+C)}else{var K=D.getTimezoneOffset();D.setTime(I+z);var F=D.getTimezoneOffset();var E=F-K;if(E!=0){D.setTime(I+z+E*60*1000)}}}}while(I<A.max);return G};r=function(w,B){var C=new Date(w);if(k.timeformat!=null){return l(C,k.timeformat,k.monthNames)}var z=B.tickSize[0]*f[B.tickSize[1]];var A=B.max-B.min;if(z<f.minute){fmt="%h:%M:%S"}else{if(z<f.day){if(A<2*f.day){fmt="%h:%M"}else{fmt="%b %d %h:%M"}}else{if(z<f.month){fmt="%b %d"}else{if(z<f.year){if(A<f.year){fmt="%b"}else{fmt="%b %y"}}else{fmt="%y"}}}}return l(C,fmt,k.monthNames)}}else{var u=k.tickDecimals;var o=-Math.floor(Math.log(t)/Math.LN10);if(u!=null&&o>u){o=u}q=Math.pow(10,-o);e=t/q;if(e<1.5){p=1}else{if(e<3){p=2;if(e>2.25&&(u==null||o+1<=u)){p=2.5;++o}}else{if(e<7.5){p=5}else{p=10}}}p*=q;if(k.minTickSize!=null&&p<k.minTickSize){p=k.minTickSize}if(k.tickSize!=null){p=k.tickSize}c.tickDecimals=Math.max(0,(u!=null)?u:o);var h=this.floorInBase;a=function(A){var B=[];var C=h(A.min,A.tickSize);var z=0,w;do{w=C+z*A.tickSize;B.push({v:w,label:A.tickFormatter(w,A)});++z}while(w<A.max);return B};r=function(w,z){if(w){return w.toFixed(z.tickDecimals)}return 0}}c.tickSize=m?[p,m]:p;c.tickGenerator=a;if(Object.isFunction(k.tickFormatter)){c.tickFormatter=function(w,z){return""+k.tickFormatter(w,z)}}else{c.tickFormatter=r}},extendXRangeIfNeededByBar:function(){if(this.options.xaxis.max==null){var a=this.xaxis.max;this.graphData.each(function(b){if(b.bars.show&&b.bars.barWidth+this.xaxis.datamax>a){a=this.xaxis.datamax+b.bars.barWidth}}.bind(this));this.xaxis.nax=a}},setTicks:function(a,c){a.ticks=[];if(c.ticks==null){a.ticks=a.tickGenerator(a)}else{if(typeof c.ticks=="number"){if(c.ticks>0){a.ticks=a.tickGenerator(a)}}else{if(c.ticks){var b=c.ticks;if(Object.isFunction(b)){b=b({min:a.min,max:a.max})}b.each(function(g,f){var d=null;var e=null;if(typeof g=="object"){d=g[0];if(g.length>1){e=g[1]}}else{d=g}if(!e){e=a.tickFormatter(d,a)}a.ticks[f]={v:d,label:e}}.bind(this))}}}if(c.autoscaleMargin!=null&&a.ticks.length>0){if(c.min==null){a.min=Math.min(a.min,a.ticks[0].v)}if(c.max==null&&a.ticks.length>1){a.max=Math.min(a.max,a.ticks[a.ticks.length-1].v)}}},setSpacing:function(){var c,f=[],b;for(c=0;c<this.yaxis.ticks.length;++c){b=this.yaxis.ticks[c].label;if(b){f.push('<div class="tickLabel">'+b+"</div>")}}if(f.length>0){var a=new Element("div",{style:"position:absolute;top:-10000px;font-size:smaller"});a.update(f.join(""));this.domObj.insert(a);this.yLabelMaxWidth=a.getWidth();this.yLabelMaxHeight=a.select("div")[0].getHeight();a.remove()}var e=this.options.grid.borderWidth;if(this.options.points.show){e=Math.max(e,this.options.points.radius+this.options.points.lineWidth/2);e=Math.max(e,this.options.mouse.radius+this.options.points.lineWidth/2)}for(c=0;c<this.graphData.length;++c){if(this.graphData[c].points.show){e=Math.max(e,this.graphData[c].points.radius+this.graphData[c].points.lineWidth/2)}}this.chartOffset.left=this.chartOffset.right=this.chartOffset.top=this.chartOffset.bottom=e;this.chartOffset.left+=this.yLabelMaxWidth+this.options.grid.labelMargin;this.chartWidth=this.canvasWidth-this.chartOffset.left-this.chartOffset.right;this.xLabelBoxWidth=this.chartWidth/6;f=[];for(c=0;c<this.xaxis.ticks.length;++c){b=this.xaxis.ticks[c].label;if(b){f.push('<span class="tickLabel" width="'+this.xLabelBoxWidth+'">'+b+"</span>")}}var d=0;if(f.length>0){var a=new Element("div",{style:"position:absolute;top:-10000px;font-size:smaller"});a.update(f.join(""));this.domObj.appendChild(a);d=a.getHeight();a.remove()}this.chartOffset.bottom+=d+this.options.grid.labelMargin;this.chartHeight=this.canvasHeight-this.chartOffset.bottom-this.chartOffset.top;this.hozScale=this.chartWidth/(this.xaxis.max-this.xaxis.min);this.vertScale=this.chartHeight/(this.yaxis.max-this.yaxis.min)},draw:function(){if(this.options.bars.show){this.extendXRangeIfNeededByBar();this.setSpacing();this.drawGrid();this.drawBarGraph(this.graphData,this.barDataRange)}else{if(this.options.pies.show){this.preparePieData(this.graphData);this.drawPieGraph(this.graphData)}else{this.drawGrid();for(var a=0;a<this.graphData.length;a++){this.drawGraph(this.graphData[a])}}}},translateHoz:function(a){return(a-this.xaxis.min)*this.hozScale},translateVert:function(a){return this.chartHeight-(a-this.yaxis.min)*this.vertScale},drawGrid:function(){var c;this.context.save();this.context.clearRect(0,0,this.canvasWidth,this.canvasHeight);this.context.translate(this.chartOffset.left,this.chartOffset.top);if(this.options.grid.backgroundColor!=null){this.context.fillStyle=this.options.grid.backgroundColor;this.context.fillRect(0,0,this.chartWidth,this.chartHeight)}if(this.options.grid.coloredAreas){var b=this.options.grid.coloredAreas;if(Object.isFunction(b)){b=b({xmin:this.xaxis.min,xmax:this.xaxis.max,ymin:this.yaxis.min,ymax:this.yaxis.max})}b.each(function(d){if(d.x1==null||d.x1<this.xaxis.min){d.x1=this.xaxis.min}if(d.x2==null||d.x2>this.xaxis.max){d.x2=this.xaxis.max}if(d.y1==null||d.y1<this.yaxis.min){d.y1=this.yaxis.min}if(d.y2==null||d.y2>this.yaxis.max){d.y2=this.yaxis.max}var e;if(d.x1>d.x2){e=d.x1;d.x1=d.x2;d.x2=e}if(d.y1>d.y2){e=d.y1;d.y1=d.y2;d.y2=e}if(d.x1>=this.xaxis.max||d.x2<=this.xaxis.min||d.x1==d.x2||d.y1>=this.yaxis.max||d.y2<=this.yaxis.min||d.y1==d.y2){return}this.context.fillStyle=d.color||this.options.grid.coloredAreasColor;this.context.fillRect(Math.floor(this.translateHoz(d.x1)),Math.floor(this.translateVert(d.y2)),Math.floor(this.translateHoz(d.x2)-this.translateHoz(d.x1)),Math.floor(this.translateVert(d.y1)-this.translateVert(d.y2)))}.bind(this))}this.context.lineWidth=1;this.context.strokeStyle=this.options.grid.tickColor;this.context.beginPath();var a;if(this.options.grid.drawXAxis){this.xaxis.ticks.each(function(d){a=d.v;if(a<=this.xaxis.min||a>=this.xaxis.max){return}this.context.moveTo(Math.floor(this.translateHoz(a))+this.context.lineWidth/2,0);this.context.lineTo(Math.floor(this.translateHoz(a))+this.context.lineWidth/2,this.chartHeight)}.bind(this))}if(this.options.grid.drawYAxis){this.yaxis.ticks.each(function(d){a=d.v;if(a<=this.yaxis.min||a>=this.yaxis.max){return}this.context.moveTo(0,Math.floor(this.translateVert(a))+this.context.lineWidth/2);this.context.lineTo(this.chartWidth,Math.floor(this.translateVert(a))+this.context.lineWidth/2)}.bind(this))}this.context.stroke();if(this.options.grid.borderWidth){this.context.lineWidth=this.options.grid.borderWidth;this.context.strokeStyle=this.options.grid.color;this.context.lineJoin="round";this.context.strokeRect(0,0,this.chartWidth,this.chartHeight);this.context.restore()}},insertLabels:function(){this.domObj.select(".tickLabels").invoke("remove");var c,b;var a='<div class="tickLabels" style="font-size:smaller;color:'+this.options.grid.color+'">';this.xaxis.ticks.each(function(d){if(!d.label){return}a+='<div style="position:absolute;top:'+(this.chartOffset.top+this.chartHeight+this.options.grid.labelMargin)+"px;left:"+(this.chartOffset.left+this.translateHoz(d.v)-this.xLabelBoxWidth/2)+"px;width:"+this.xLabelBoxWidth+'px;text-align:center" class="tickLabel">'+d.label+"</div>"}.bind(this));this.yaxis.ticks.each(function(d){if(!d.label||d.v<this.yaxis.min||d.v>this.yaxis.max){return}a+='<div id="ylabels" style="position:absolute;top:'+(this.chartOffset.top+this.translateVert(d.v)-this.yLabelMaxHeight/2)+"px;left:0;width:"+this.yLabelMaxWidth+'px;text-align:right" class="tickLabel">'+d.label+"</div>"}.bind(this));a+="</div>";this.domObj.insert(a)},drawGraph:function(a){if(a.lines.show||(!a.bars.show&&!a.points.show)){this.drawGraphLines(a)}if(a.bars.show){this.drawGraphBar(a)}if(a.points.show){this.drawGraphPoints(a)}},plotLine:function(f,e,h){var d,m=null,a=null,o=null;this.context.beginPath();for(var g=0;g<f.length;++g){d=m;m=f[g];if(d==null||m==null){continue}var c=d[0],l=d[1],b=m[0],k=m[1];if(l<=k&&l<this.yaxis.min){if(k<this.yaxis.min){continue}c=(this.yaxis.min-l)/(k-l)*(b-c)+c;l=this.yaxis.min}else{if(k<=l&&k<this.yaxis.min){if(l<this.yaxis.min){continue}b=(this.yaxis.min-l)/(k-l)*(b-c)+c;k=this.yaxis.min}}if(l>=k&&l>this.yaxis.max){if(k>this.yaxis.max){continue}c=(this.yaxis.max-l)/(k-l)*(b-c)+c;l=this.yaxis.max}else{if(k>=l&&k>this.yaxis.max){if(l>this.yaxis.max){continue}b=(this.yaxis.max-l)/(k-l)*(b-c)+c;k=this.yaxis.max}}if(c<=b&&c<this.xaxis.min){if(b<this.xaxis.min){continue}l=(this.xaxis.min-c)/(b-c)*(k-l)+l;c=this.xaxis.min}else{if(b<=c&&b<this.xaxis.min){if(c<this.xaxis.min){continue}k=(this.xaxis.min-c)/(b-c)*(k-l)+l;b=this.xaxis.min}}if(c>=b&&c>this.xaxis.max){if(b>this.xaxis.max){continue}l=(this.xaxis.max-c)/(b-c)*(k-l)+l;c=this.xaxis.max}else{if(b>=c&&b>this.xaxis.max){if(c>this.xaxis.max){continue}k=(this.xaxis.max-c)/(b-c)*(k-l)+l;b=this.xaxis.max}}if(a!=this.translateHoz(c)||o!=this.translateVert(l)+e){this.context.moveTo(this.translateHoz(c),this.translateVert(l)+e)}a=this.translateHoz(b);o=this.translateVert(k)+e;if(h){this.plotLineDashed(this.translateHoz(c),this.translateVert(l)+e,a,o,h)}else{this.context.lineTo(a,o)}}this.context.stroke()},plotLineDashed:function(c,k,a,h,l){var q=c;var o=k;var d=Math.sqrt((a-q)*(a-q)+(h-o)*(h-o));var p=(a-q)/d;var m=(h-o)/d;var g=0;var f=0;var e=0;while(g<d){var b=Math.min(l[f],d-g);g+=b;if(f%2==0){this.context.moveTo(q,o)}q+=b*p;o+=b*m;if(f%2==0){this.context.lineTo(q,o)}e+=b;if(e>l[f]){e-=l[f];f=(f+1)%l.length}}},plotLineArea:function(f){var e,p=null;var a=Math.min(Math.max(0,this.yaxis.min),this.yaxis.max);var l,d=0;var o=false;for(var g=0;g<f.length;++g){e=p;p=f[g];if(o&&e!=null&&p==null){this.context.lineTo(this.translateHoz(d),this.translateVert(a));this.context.fill();o=false;continue}if(e==null||p==null){continue}var c=e[0],m=e[1],b=p[0],k=p[1];if(c<=b&&c<this.xaxis.min){if(b<this.xaxis.min){continue}m=(this.xaxis.min-c)/(b-c)*(k-m)+m;c=this.xaxis.min}else{if(b<=c&&b<this.xaxis.min){if(c<this.xaxis.min){continue}k=(this.xaxis.min-c)/(b-c)*(k-m)+m;b=this.xaxis.min}}if(c>=b&&c>this.xaxis.max){if(b>this.xaxis.max){continue}m=(this.xaxis.max-c)/(b-c)*(k-m)+m;c=this.xaxis.max}else{if(b>=c&&b>this.xaxis.max){if(c>this.xaxis.max){continue}k=(this.xaxis.max-c)/(b-c)*(k-m)+m;b=this.xaxis.max}}if(!o){this.context.beginPath();this.context.moveTo(this.translateHoz(c),this.translateVert(a));o=true}if(m>=this.yaxis.max&&k>=this.yaxis.max){this.context.lineTo(this.translateHoz(c),this.translateVert(this.yaxis.max));this.context.lineTo(this.translateHoz(b),this.translateVert(this.yaxis.max));continue}else{if(m<=this.yaxis.min&&k<=this.yaxis.min){this.context.lineTo(this.translateHoz(c),this.translateVert(this.yaxis.min));this.context.lineTo(this.translateHoz(b),this.translateVert(this.yaxis.min));continue}}var q=c,h=b;if(m<=k&&m<this.yaxis.min&&k>=this.yaxis.min){c=(this.yaxis.min-m)/(k-m)*(b-c)+c;m=this.yaxis.min}else{if(k<=m&&k<this.yaxis.min&&m>=this.yaxis.min){b=(this.yaxis.min-m)/(k-m)*(b-c)+c;k=this.yaxis.min}}if(m>=k&&m>this.yaxis.max&&k<=this.yaxis.max){c=(this.yaxis.max-m)/(k-m)*(b-c)+c;m=this.yaxis.max}else{if(k>=m&&k>this.yaxis.max&&m<=this.yaxis.max){b=(this.yaxis.max-m)/(k-m)*(b-c)+c;k=this.yaxis.max}}if(c!=q){if(m<=this.yaxis.min){l=this.yaxis.min}else{l=this.yaxis.max}this.context.lineTo(this.translateHoz(q),this.translateVert(l));this.context.lineTo(this.translateHoz(c),this.translateVert(l))}this.context.lineTo(this.translateHoz(c),this.translateVert(m));this.context.lineTo(this.translateHoz(b),this.translateVert(k));if(b!=h){if(k<=this.yaxis.min){l=this.yaxis.min}else{l=this.yaxis.max}this.context.lineTo(this.translateHoz(h),this.translateVert(l));this.context.lineTo(this.translateHoz(b),this.translateVert(l))}d=Math.max(b,h)}if(o){this.context.lineTo(this.translateHoz(d),this.translateVert(a));this.context.fill()}},drawGraphLines:function(c){this.context.save();this.context.translate(this.chartOffset.left,this.chartOffset.top);this.context.lineJoin="round";var b=c.lines.lineWidth;var a=c.shadowSize;if(a>0){this.context.lineWidth=a/2;this.context.strokeStyle="rgba(0,0,0,0.1)";this.plotLine(c.data,b/2+a/2+this.context.lineWidth/2,c.dashArray);this.context.lineWidth=a/2;this.context.strokeStyle="rgba(0,0,0,0.2)";this.plotLine(c.data,b/2+this.context.lineWidth/2,c.dashArray)}this.context.lineWidth=b;this.context.strokeStyle=c.color;if(c.lines.fill){this.context.fillStyle=c.lines.fillColor!=null?c.lines.fillColor:this.parseColor(c.color).scale(null,null,null,0.4).toString();this.plotLineArea(c.data,0)}this.plotLine(c.data,0,c.dashArray);this.context.restore()},plotPoints:function(d,b,e){for(var c=0;c<d.length;++c){if(d[c]==null){continue}var a=d[c][0],f=d[c][1];if(a<this.xaxis.min||a>this.xaxis.max||f<this.yaxis.min||f>this.yaxis.max){continue}this.context.beginPath();this.context.arc(this.translateHoz(a),this.translateVert(f),b,0,2*Math.PI,true);if(e){this.context.fill()}this.context.stroke()}},plotPointShadows:function(d,e,b){for(var c=0;c<d.length;++c){if(d[c]==null){continue}var a=d[c][0],f=d[c][1];if(a<this.xaxis.min||a>this.xaxis.max||f<this.yaxis.min||f>this.yaxis.max){continue}this.context.beginPath();this.context.arc(this.translateHoz(a),this.translateVert(f)+e,b,0,Math.PI,false);this.context.stroke()}},drawGraphPoints:function(c){this.context.save();this.context.translate(this.chartOffset.left,this.chartOffset.top);var b=c.lines.lineWidth;var a=c.shadowSize;if(a>0){this.context.lineWidth=a/2;this.context.strokeStyle="rgba(0,0,0,0.1)";this.plotPointShadows(c.data,a/2+this.context.lineWidth/2,c.points.radius);this.context.lineWidth=a/2;this.context.strokeStyle="rgba(0,0,0,0.2)";this.plotPointShadows(c.data,this.context.lineWidth/2,c.points.radius)}this.context.lineWidth=c.points.lineWidth;this.context.strokeStyle=c.color;this.context.fillStyle=c.points.fillColor!=null?c.points.fillColor:c.color;this.plotPoints(c.data,c.points.radius,c.points.fill);this.context.restore()},preparePieData:function(b){for(i=0;i<b.length;i++){var a=0;for(j=0;j<b[i].data.length;j++){a+=parseInt(b[i].data[j][1])}b[i].data=a}},drawPieShadow:function(b,c,a){this.context.beginPath();this.context.moveTo(b,c);this.context.fillStyle="rgba(0,0,0,"+0.1+")";startAngle=0;endAngle=(Math.PI/180)*360;this.context.arc(b+2,c+2,a+(this.options.shadowSize/2),startAngle,endAngle,false);this.context.fill();this.context.closePath()},drawPieGraph:function(k){var h=0;var e=0;var d=this.chartWidth/2;var c=this.chartHeight/2;var f=0;var a=0;var l=this.options.pies.fontSize;var g=this.options.pies.labelWidth;if(!this.options.pies.autoScale){e=this.options.pies.radius}else{e=(this.chartHeight*0.85)/2}var b=e*1.05;for(i=0;i<k.length;i++){h+=k[i].data}totalPct=0;this.drawPieShadow(d,c,e,0,0);k.each(function(B,s){var C=B.data/h;f=a;a+=C*(2*Math.PI);var A=(a-f)/2+f;var w=d+Math.cos(A)*b;var v=c+Math.sin(A)*b;var r=d;var o=c;var m=null;var q=null;var p=0;var z=0;this.context.beginPath();this.context.moveTo(r,o);this.context.arc(r,o,e,f,a,false);this.context.closePath();this.context.fillStyle=this.parseColor(B.color).scale(null,null,null,this.options.pies.fillOpacity).toString();if(this.options.pies.fill){this.context.fill()}if(A<=0.25*(2*Math.PI)){m="left";q="top";p=w;z=v+l}else{if(A>0.25*(2*Math.PI)&&A<=0.5*(2*Math.PI)){m="left";q="bottom";p=w-g;z=v}else{if(A>0.5*(2*Math.PI)&&A<=0.75*(2*Math.PI)){m="right";q="bottom";p=w-g;z=v-l}else{m="right";q="bottom";p=w;z=v-l}}}p=p+"px";z=z+"px";var u=Math.round(C*100);if(s==k.length-1){if(u+totalPct<100){u=u+1}else{if(u+totalPct>100){u=u-1}}}var t='<div style="position: absolute;zindex:11; width:'+g+"px;fontSize:"+l+"px;overflow:hidden;top:"+z+";left:"+p+";textAlign:"+m+";verticalAlign:"+q+'">'+u+"%</div>";this.domObj.insert(t);totalPct=totalPct+u}.bind(this))},drawBarGraph:function(a,b){a.each(function(d,c){this.drawGraphBars(d,c,a.size(),b)}.bind(this))},drawGraphBar:function(a){this.drawGraphBars(a,0,this.graphData.length,this.barDataRange)},plotBars:function(k,g,m,f,l,a,h,e){var d=0;if(h%2==0){d=(1+((a-h/2)-1))*m}else{var c=0.5;if(a==(h/2-c)){d=-m*c}else{d=(c+(a-Math.round(h/2)))*m}}var b=[];g.each(function(s){if(!s){return}var w=s[0],v=s[1];var z=true,r=true,t=true;var q=w+d,A=w+m+d,o=0,u=v;var p={};p.left=q;p.right=A;p.value=u;b.push(p);if(A<this.xaxis.min||q>this.xaxis.max||u<this.yaxis.min||o>this.yaxis.max){return}if(q<this.xaxis.min){q=this.xaxis.min;z=false}if(A>this.xaxis.max){A=this.xaxis.max;t=false}if(o<this.yaxis.min){o=this.yaxis.min}if(u>this.yaxis.max){u=this.yaxis.max;r=false}if(k.bars.showShadow&&k.shadowSize>0){this.plotShadowOutline(k,this.context.strokeStyle,q,o,u,A,z,t,r)}if(l){this.context.beginPath();this.context.moveTo(this.translateHoz(q),this.translateVert(o)+f);this.context.lineTo(this.translateHoz(q),this.translateVert(u)+f);this.context.lineTo(this.translateHoz(A),this.translateVert(u)+f);this.context.lineTo(this.translateHoz(A),this.translateVert(o)+f);this.context.fill()}if(z||t||r){this.context.beginPath();this.context.moveTo(this.translateHoz(q),this.translateVert(o)+f);if(z){this.context.lineTo(this.translateHoz(q),this.translateVert(u)+f)}else{this.context.moveTo(this.translateHoz(q),this.translateVert(u)+f)}if(r){this.context.lineTo(this.translateHoz(A),this.translateVert(u)+f)}else{this.context.moveTo(this.translateHoz(A),this.translateVert(u)+f)}if(t){this.context.lineTo(this.translateHoz(A),this.translateVert(o)+f)}else{this.context.moveTo(this.translateHoz(A),this.translateVert(o)+f)}this.context.stroke()}}.bind(this));e.push(b)},plotShadowOutline:function(h,o,c,a,g,l,k,f,e){var m=0.3;for(var b=1;b<=this.options.shadowSize/2;b++){var d=m*b;this.context.beginPath();this.context.strokeStyle="rgba(0,0,0,"+d+")";this.context.moveTo(this.translateHoz(c)+b,this.translateVert(a));if(k){this.context.lineTo(this.translateHoz(c)+b,this.translateVert(g)-b)}else{this.context.moveTo(this.translateHoz(c)+b,this.translateVert(g)-b)}if(e){this.context.lineTo(this.translateHoz(l)+b,this.translateVert(g)-b)}else{this.context.moveTo(this.translateHoz(l)+b,this.translateVert(g)-b)}if(f){this.context.lineTo(this.translateHoz(l)+b,this.translateVert(a))}else{this.context.lineTo(this.translateHoz(l)+b,this.translateVert(a))}this.context.stroke();this.context.closePath()}this.context.strokeStyle=o},drawGraphBars:function(d,a,b,f){this.context.save();this.context.translate(this.chartOffset.left,this.chartOffset.top);this.context.lineJoin="round";var e=d.bars.barWidth;var c=Math.min(d.bars.lineWidth,e);this.context.lineWidth=c;this.context.strokeStyle=d.color;if(d.bars.fill){this.context.fillStyle=d.bars.fillColor!=null?d.bars.fillColor:this.parseColor(d.color).scale(null,null,null,this.options.bars.fillOpacity).toString()}this.plotBars(d,d.data,e,0,d.bars.fill,a,b,f);this.context.restore()},insertLegend:function(){this.domObj.select(".legend").invoke("remove");if(!this.options.legend.show){return}var h=[];var f=false;this.graphData.each(function(o,m){if(!o.label){return}if(m%this.options.legend.noColumns==0){if(f){h.push("</tr>")}h.push("<tr>");f=true}var c=o.label;if(this.options.legend.labelFormatter!=null){c=this.options.legend.labelFormatter(c)}h.push('<td class="legendColorBox"><div style="border:1px solid '+this.options.legend.labelBoxBorderColor+';padding:1px"><div style="width:14px;height:10px;background-color:'+o.color+';overflow:hidden"></div></div></td><td class="legendLabel">'+c+"</td>")}.bind(this));if(f){h.push("</tr>")}if(h.length>0){var l='<table style="font-size:smaller;color:'+this.options.grid.color+'">'+h.join("")+"</table>";if($(this.options.legend.container)!=null){$(this.options.legend.container).insert(l)}else{var k="";var b=this.options.legend.position,d=this.options.legend.margin;if(b.charAt(0)=="n"){k+="top:"+(d+this.chartOffset.top)+"px;"}else{if(b.charAt(0)=="s"){k+="bottom:"+(d+this.chartOffset.bottom)+"px;"}}if(b.charAt(1)=="e"){k+="right:"+(d+this.chartOffset.right)+"px;"}else{if(b.charAt(1)=="w"){k+="left:"+(d+this.chartOffset.bottom)+"px;"}}var a=this.domObj.insert('<div class="ProtoChart-legend" style="border: 1px solid '+this.options.legend.borderColor+"; position:absolute;z-index:2;"+k+'">'+l+"</div>").getElementsBySelector("div.ProtoChart-legend").first();if(this.options.legend.backgroundOpacity!=0){var g=this.options.legend.backgroundColor;if(g==null){var e=(this.options.grid.backgroundColor!=null)?this.options.grid.backgroundColor:this.extractColor(a);g=this.parseColor(e).adjust(null,null,null,1).toString()}this.domObj.insert('<div class="ProtoChart-legend-bg" style="position:absolute;width:'+a.getWidth()+"px;height:"+a.getHeight()+"px;"+k+"background-color:"+g+';"> </div>').select("div.ProtoChart-legend-bg").first().setStyle({opacity:this.options.legend.backgroundOpacity})}}}},onMouseMove:function(c){var d=c||window.event;if(d.pageX==null&&d.clientX!=null){var h=document.documentElement,a=$(document.body);this.lastMousePos.pageX=d.clientX+(h&&h.scrollLeft||a.scrollLeft||0);this.lastMousePos.pageY=d.clientY+(h&&h.scrollTop||a.scrollTop||0)}else{this.lastMousePos.pageX=d.pageX;this.lastMousePos.pageY=d.pageY}var f=this.overlay.cumulativeOffset();var g={x:this.xaxis.min+(d.pageX-f.left-this.chartOffset.left)/this.hozScale,y:this.yaxis.max-(d.pageY-f.top-this.chartOffset.top)/this.vertScale};if(this.options.mouse.track&&this.selectionInterval==null){this.hit(c,g)}this.domObj.fire("ProtoChart:mousemove",[g])},onMouseOut:function(b){var a=this.domObj.select("."+this.options.mouse.clsName).first();if(a){a.setStyle({display:"none"})}this.clearHit()},onMouseDown:function(a){if(a.which!=1){return}document.body.focus();if(document.onselectstart!==undefined&&this.workarounds.onselectstart==null){this.workarounds.onselectstart=document.onselectstart;document.onselectstart=function(){return false}}if(document.ondrag!==undefined&&this.workarounds.ondrag==null){this.workarounds.ondrag=document.ondrag;document.ondrag=function(){return false}}this.setSelectionPos(this.selection.first,a);if(this.selectionInterval!=null){clearInterval(this.selectionInterval)}this.lastMousePos.pageX=null;this.selectionInterval=setInterval(this.updateSelectionOnMouseMove.bind(this),200);this.overlay.observe("mouseup",this.onSelectionMouseUp.bind(this))},onClick:function(b){if(this.ignoreClick){this.ignoreClick=false;return}var c=this.overlay.cumulativeOffset();var d={x:this.xaxis.min+(b.pageX-c.left-this.chartOffset.left)/this.hozScale,y:this.yaxis.max-(b.pageY-c.top-this.chartOffset.top)/this.vertScale};this.domObj.fire("ProtoChart:plotclick",[d]);if(this.options.allowDataClick){var a={};if(this.options.points.show){a=this.getDataClickPoint(d,this.options);this.domObj.fire("ProtoChart:dataclick",[a])}else{if(this.options.lines.show&&this.options.points.show){a=this.getDataClickPoint(d,this.options);this.domObj.fire("ProtoChart:dataclick",[a])}else{if(this.options.bars.show){if(this.barDataRange.length>0){a=this.getDataClickPoint(d,this.options,this.barDataRange);this.domObj.fire("ProtoChart:dataclick",[a])}}}}}},getDataClickPoint:function(e,c,d){e.x=parseInt(e.x);e.y=parseInt(e.y);var b=e.y.toFixed(0);var a={};a.position=e;a.value="";if(c.points.show){this.graphData.each(function(h){var f=h.data;var g=parseInt(e.x.toFixed(0));if(g<0){g=0}if(f[g]&&b>=f[g][1]-(this.options.points.radius*10)&&b<=f[g][1]+(this.options.points.radius*10)){a.value=f[g][1];throw $break}}.bind(this))}else{if(c.bars.show){xClick=e.x;this.barDataRange.each(function(f){f.each(function(h){var g=h;if(xClick>g.left&&xClick<g.right){a.value=g.value;throw $break}}.bind(this))}.bind(this))}}return a},triggerSelectedEvent:function(){var b,a,d,c;if(this.selection.first.x<=this.selection.second.x){b=this.selection.first.x;a=this.selection.second.x}else{b=this.selection.second.x;a=this.selection.first.x}if(this.selection.first.y>=this.selection.second.y){d=this.selection.first.y;c=this.selection.second.y}else{d=this.selection.second.y;c=this.selection.first.y}b=this.xaxis.min+b/this.hozScale;a=this.xaxis.min+a/this.hozScale;d=this.yaxis.max-d/this.vertScale;c=this.yaxis.max-c/this.vertScale;this.domObj.fire("ProtoChart:selected",[{x1:b,y1:d,x2:a,y2:c}])},onSelectionMouseUp:function(a){if(document.onselectstart!==undefined){document.onselectstart=this.workarounds.onselectstart}if(document.ondrag!==undefined){document.ondrag=this.workarounds.ondrag}if(this.selectionInterval!=null){clearInterval(this.selectionInterval);this.selectionInterval=null}this.setSelectionPos(this.selection.second,a);this.clearSelection();if(!this.selectionIsSane()||a.which!=1){return false}this.drawSelection();this.triggerSelectedEvent();this.ignoreClick=true;return false},setSelectionPos:function(c,a){var b=$(this.overlay).cumulativeOffset();if(this.options.selection.mode=="y"){if(c==this.selection.first){c.x=0}else{c.x=this.chartWidth}}else{c.x=a.pageX-b.left-this.chartOffset.left;c.x=Math.min(Math.max(0,c.x),this.chartWidth)}if(this.options.selection.mode=="x"){if(c==this.selection.first){c.y=0}else{c.y=this.chartHeight}}else{c.y=a.pageY-b.top-this.chartOffset.top;c.y=Math.min(Math.max(0,c.y),this.chartHeight)}},updateSelectionOnMouseMove:function(){if(this.lastMousePos.pageX==null){return}this.setSelectionPos(this.selection.second,this.lastMousePos);this.clearSelection();if(this.selectionIsSane()){this.drawSelection()}},clearSelection:function(){if(this.prevSelection==null){return}var a=Math.min(this.prevSelection.first.x,this.prevSelection.second.x),d=Math.min(this.prevSelection.first.y,this.prevSelection.second.y),b=Math.abs(this.prevSelection.second.x-this.prevSelection.first.x),c=Math.abs(this.prevSelection.second.y-this.prevSelection.first.y);this.overlayContext.clearRect(a+this.chartOffset.left-this.overlayContext.lineWidth,d+this.chartOffset.top-this.overlayContext.lineWidth,b+this.overlayContext.lineWidth*2,c+this.overlayContext.lineWidth*2);this.prevSelection=null},setSelection:function(a){this.clearSelection();if(this.options.selection.mode=="x"){this.selection.first.y=0;this.selection.second.y=this.chartHeight}else{this.selection.first.y=(this.yaxis.max-a.y1)*this.vertScale;this.selection.second.y=(this.yaxis.max-a.y2)*this.vertScale}if(this.options.selection.mode=="y"){this.selection.first.x=0;this.selection.second.x=this.chartWidth}else{this.selection.first.x=(a.x1-this.xaxis.min)*this.hozScale;this.selection.second.x=(a.x2-this.xaxis.min)*this.hozScale}this.drawSelection();this.triggerSelectedEvent()},drawSelection:function(){if(this.prevSelection!=null&&this.selection.first.x==this.prevSelection.first.x&&this.selection.first.y==this.prevSelection.first.y&&this.selection.second.x==this.prevSelection.second.x&&this.selection.second.y==this.prevSelection.second.y){return}this.overlayContext.strokeStyle=this.parseColor(this.options.selection.color).scale(null,null,null,0.8).toString();this.overlayContext.lineWidth=1;this.context.lineJoin="round";this.overlayContext.fillStyle=this.parseColor(this.options.selection.color).scale(null,null,null,0.4).toString();this.prevSelection={first:{x:this.selection.first.x,y:this.selection.first.y},second:{x:this.selection.second.x,y:this.selection.second.y}};var a=Math.min(this.selection.first.x,this.selection.second.x),d=Math.min(this.selection.first.y,this.selection.second.y),b=Math.abs(this.selection.second.x-this.selection.first.x),c=Math.abs(this.selection.second.y-this.selection.first.y);this.overlayContext.fillRect(a+this.chartOffset.left,d+this.chartOffset.top,b,c);this.overlayContext.strokeRect(a+this.chartOffset.left,d+this.chartOffset.top,b,c)},selectionIsSane:function(){var a=5;return Math.abs(this.selection.second.x-this.selection.first.x)>=a&&Math.abs(this.selection.second.y-this.selection.first.y)>=a},defaultTrackFormatter:function(a){return"["+a.x+", "+a.y+"]"},clearHit:function(){if(this.prevHit){this.overlayContext.clearRect(this.translateHoz(this.prevHit.x)+this.chartOffset.left-this.options.mouse.radius*2,this.translateVert(this.prevHit.y)+this.chartOffset.top-this.options.mouse.radius*2,this.options.mouse.radius*3+this.options.points.lineWidth*3,this.options.mouse.radius*3+this.options.points.lineWidth*3);this.prevHit=null}},hit:function(a,r){var f={dist:Number.MAX_VALUE,x:null,y:null,mouse:null};for(var q=0,o,h,d;q<this.graphData.length;q++){if(!this.graphData[q].mouse.track){continue}o=this.graphData[q].data;h=(this.hozScale*this.graphData[q].mouse.sensibility);d=(this.vertScale*this.graphData[q].mouse.sensibility);for(var k=0,s,l;k<o.length;k++){s=this.hozScale*Math.abs(o[k][0]-r.x);l=this.vertScale*Math.abs(o[k][1]-r.y);if(s<h&&l<d&&(s+l)<f.dist){f.dist=(s+l);f.x=o[k][0];f.y=o[k][1];f.mouse=this.graphData[q].mouse}}}if(f.mouse&&f.mouse.track&&!this.prevHit||(this.prevHit&&f.x!=this.prevHit.x&&f.y!=this.prevHit.y)){var c=this.domObj.select("."+this.options.mouse.clsName).first();if(!c){var t="",b=this.options.mouse.position,g=this.options.mouse.margin;if(b.charAt(0)=="n"){t+="top:"+(g+this.chartOffset.top)+"px;"}else{if(b.charAt(0)=="s"){t+="bottom:"+(g+this.chartOffset.bottom)+"px;"}}if(b.charAt(1)=="e"){t+="right:"+(g+this.chartOffset.right)+"px;"}else{if(b.charAt(1)=="w"){t+="left:"+(g+this.chartOffset.bottom)+"px;"}}this.domObj.insert('<div class="'+this.options.mouse.clsName+'" style="display:none;position:absolute;'+t+'"></div>');return}if(f.x!==null&&f.y!==null){c.setStyle({display:"block"});this.clearHit();if(f.mouse.lineColor!=null){this.overlayContext.save();this.overlayContext.translate(this.chartOffset.left,this.chartOffset.top);this.overlayContext.lineWidth=this.options.points.lineWidth;this.overlayContext.strokeStyle=f.mouse.lineColor;this.overlayContext.fillStyle="#ffffff";this.overlayContext.beginPath();this.overlayContext.arc(this.translateHoz(f.x),this.translateVert(f.y),this.options.mouse.radius,0,2*Math.PI,true);this.overlayContext.fill();this.overlayContext.stroke();this.overlayContext.restore()}this.prevHit=f;var e=f.mouse.trackDecimals;if(e==null||e<0){e=0}if(!this.options.mouse.fixedPosition){c.setStyle({left:(this.translateHoz(f.x)+this.options.mouse.radius+10)+"px",top:(this.translateVert(f.y)+this.options.mouse.radius+10)+"px"})}c.innerHTML=f.mouse.trackFormatter({x:f.x.toFixed?f.x.toFixed(e):f.x,y:f.y.toFixed?f.y.toFixed(e):f.y});this.domObj.fire("ProtoChart:hit",[f])}else{if(this.options.prevHit){c.setStyle({display:"none"});this.clearHit()}}}},floorInBase:function(b,a){return a*Math.floor(b/a)},extractColor:function(b){var a;do{a=$(b).getStyle("background-color").toLowerCase();if(a!=""&&a!="transparent"){break}b=b.up(0)}while(b.nodeName.toLowerCase()!="body");if(a=="rgba(0, 0, 0, 0)"){return"transparent"}return a},parseColor:function(c){var a;if((a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))){return new Proto.Color(parseInt(a[1]),parseInt(a[2]),parseInt(a[3]))}if((a=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(c))){return new Proto.Color(parseInt(a[1]),parseInt(a[2]),parseInt(a[3]),parseFloat(a[4]))}if((a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))){return new Proto.Color(parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55)}if((a=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(c))){return new Proto.Color(parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55,parseFloat(a[4]))}if((a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))){return new Proto.Color(parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16))}if((a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))){return new Proto.Color(parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16))}var b=c.strip().toLowerCase();if(b=="transparent"){return new Proto.Color(255,255,255,0)}return new Proto.Color(100,100,100,1)}});if(!Proto){var Proto={}}Proto.Color=Class.create({initialize:function(h,f,d,e){this.rgba=["r","g","b","a"];var c=4;while(-1<--c){this[this.rgba[c]]=arguments[c]||((c==3)?1:0)}},toString:function(){if(this.a>=1){return"rgb("+[this.r,this.g,this.b].join(",")+")"}else{return"rgba("+[this.r,this.g,this.b,this.a].join(",")+")"}},scale:function(c,b,d,a){x=4;while(-1<--x){if(arguments[x]!=null){this[this.rgba[x]]*=arguments[x]}}return this.normalize()},adjust:function(c,b,d,a){x=4;while(-1<--x){if(arguments[x]!=null){this[this.rgba[x]]+=arguments[x]}}return this.normalize()},clone:function(){return new Proto.Color(this.r,this.b,this.g,this.a)},limit:function(b,a,c){return Math.max(Math.min(b,c),a)},normalize:function(){this.r=this.limit(parseInt(this.r),0,255);this.g=this.limit(parseInt(this.g),0,255);this.b=this.limit(parseInt(this.b),0,255);this.a=this.limit(this.a,0,1);return this}});var Scriptaculous={Version:"1.8.1",require:function(a){document.write('<script type="text/javascript" src="'+a+'"><\/script>')},REQUIRED_PROTOTYPE:"1.6.0",load:function(){function a(b){var c=b.split(".");return parseInt(c[0])*100000+parseInt(c[1])*1000+parseInt(c[2])}if((typeof Prototype=="undefined")||(typeof Element=="undefined")||(typeof Element.Methods=="undefined")||(a(Prototype.Version)<a(Scriptaculous.REQUIRED_PROTOTYPE))){throw ("script.aculo.us requires the Prototype JavaScript framework >= "+Scriptaculous.REQUIRED_PROTOTYPE)}$A(document.getElementsByTagName("script")).findAll(function(b){return(b.src&&b.src.match(/scriptaculous\.js(\?.*)?$/))}).each(function(c){var d=c.src.replace(/scriptaculous\.js(\?.*)?$/,"");var b=c.src.match(/\?.*load=([a-z,]*)/);(b?b[1]:"builder,effects,dragdrop,controls,slider,sound").split(",").each(function(e){Scriptaculous.require(d+e+".js")})})}};Scriptaculous.load();String.prototype.parseColor=function(){var a="#";if(this.slice(0,4)=="rgb("){var c=this.slice(4,this.length-1).split(",");var b=0;do{a+=parseInt(c[b]).toColorPart()}while(++b<3)}else{if(this.slice(0,1)=="#"){if(this.length==4){for(var b=1;b<4;b++){a+=(this.charAt(b)+this.charAt(b)).toLowerCase()}}if(this.length==7){a=this.toLowerCase()}}}return(a.length==7?a:(arguments[0]||this))};Element.collectTextNodes=function(a){return $A($(a).childNodes).collect(function(b){return(b.nodeType==3?b.nodeValue:(b.hasChildNodes()?Element.collectTextNodes(b):""))}).flatten().join("")};Element.collectTextNodesIgnoreClass=function(a,b){return $A($(a).childNodes).collect(function(c){return(c.nodeType==3?c.nodeValue:((c.hasChildNodes()&&!Element.hasClassName(c,b))?Element.collectTextNodesIgnoreClass(c,b):""))}).flatten().join("")};Element.setContentZoom=function(a,b){a=$(a);a.setStyle({fontSize:(b/100)+"em"});if(Prototype.Browser.WebKit){window.scrollBy(0,0)}return a};Element.getInlineOpacity=function(a){return $(a).style.opacity||""};Element.forceRerendering=function(a){try{a=$(a);var c=document.createTextNode(" ");a.appendChild(c);a.removeChild(c)}catch(b){}};var Effect={_elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},Transitions:{linear:Prototype.K,sinoidal:function(a){return(-Math.cos(a*Math.PI)/2)+0.5},reverse:function(a){return 1-a},flicker:function(a){var a=((-Math.cos(a*Math.PI)/4)+0.75)+Math.random()/4;return a>1?1:a},wobble:function(a){return(-Math.cos(a*Math.PI*(9*a))/2)+0.5},pulse:function(b,a){a=a||5;return(((b%(1/a))*a).round()==0?((b*a*2)-(b*a*2).floor()):1-((b*a*2)-(b*a*2).floor()))},spring:function(a){return 1-(Math.cos(a*4.5*Math.PI)*Math.exp(-a*6))},none:function(a){return 0},full:function(a){return 1}},DefaultOptions:{duration:1,fps:100,sync:false,from:0,to:1,delay:0,queue:"parallel"},tagifyText:function(a){var b="position:relative";if(Prototype.Browser.IE){b+=";zoom:1"}a=$(a);$A(a.childNodes).each(function(c){if(c.nodeType==3){c.nodeValue.toArray().each(function(d){a.insertBefore(new Element("span",{style:b}).update(d==" "?String.fromCharCode(160):d),c)});Element.remove(c)}})},multiple:function(b,c){var e;if(((typeof b=="object")||Object.isFunction(b))&&(b.length)){e=b}else{e=$(b).childNodes}var a=Object.extend({speed:0.1,delay:0},arguments[2]||{});var d=a.delay;$A(e).each(function(g,f){new c(g,Object.extend(a,{delay:f*a.speed+d}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(b,c){b=$(b);c=(c||"appear").toLowerCase();var a=Object.extend({queue:{position:"end",scope:(b.id||"global"),limit:1}},arguments[2]||{});Effect[b.visible()?Effect.PAIRS[c][1]:Effect.PAIRS[c][0]](b,a)}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null},_each:function(a){this.effects._each(a)},add:function(b){var c=new Date().getTime();var a=Object.isString(b.options.queue)?b.options.queue:b.options.queue.position;switch(a){case"front":this.effects.findAll(function(d){return d.state=="idle"}).each(function(d){d.startOn+=b.finishOn;d.finishOn+=b.finishOn});break;case"with-last":c=this.effects.pluck("startOn").max()||c;break;case"end":c=this.effects.pluck("finishOn").max()||c;break}b.startOn+=c;b.finishOn+=c;if(!b.options.queue.limit||(this.effects.length<b.options.queue.limit)){this.effects.push(b)}if(!this.interval){this.interval=setInterval(this.loop.bind(this),15)}},remove:function(a){this.effects=this.effects.reject(function(b){return b==a});if(this.effects.length==0){clearInterval(this.interval);this.interval=null}},loop:function(){var c=new Date().getTime();for(var b=0,a=this.effects.length;b<a;b++){this.effects[b]&&this.effects[b].loop(c)}}});Effect.Queues={instances:$H(),get:function(a){if(!Object.isString(a)){return a}return this.instances.get(a)||this.instances.set(a,new Effect.ScopedQueue())}};Effect.Queue=Effect.Queues.get("global");Effect.Base=Class.create({position:null,start:function(options){function codeForEvent(options,eventName){return((options[eventName+"Internal"]?"this.options."+eventName+"Internal(this);":"")+(options[eventName]?"this.options."+eventName+"(this);":""))}if(options&&options.transition===false){options.transition=Effect.Transitions.linear}this.options=Object.extend(Object.extend({},Effect.DefaultOptions),options||{});this.currentFrame=0;this.state="idle";this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.fromToDelta=this.options.to-this.options.from;this.totalTime=this.finishOn-this.startOn;this.totalFrames=this.options.fps*this.options.duration;eval('this.render = function(pos){ if (this.state=="idle"){this.state="running";'+codeForEvent(this.options,"beforeSetup")+(this.setup?"this.setup();":"")+codeForEvent(this.options,"afterSetup")+'};if (this.state=="running"){pos=this.options.transition(pos)*'+this.fromToDelta+"+"+this.options.from+";this.position=pos;"+codeForEvent(this.options,"beforeUpdate")+(this.update?"this.update(pos);":"")+codeForEvent(this.options,"afterUpdate")+"}}");this.event("beforeStart");if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).add(this)}},loop:function(c){if(c>=this.startOn){if(c>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");if(this.finish){this.finish()}this.event("afterFinish");return}var b=(c-this.startOn)/this.totalTime,a=(b*this.totalFrames).round();if(a>this.currentFrame){this.render(b);this.currentFrame=a}}},cancel:function(){if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).remove(this)}this.state="finished"},event:function(a){if(this.options[a+"Internal"]){this.options[a+"Internal"](this)}if(this.options[a]){this.options[a](this)}},inspect:function(){var a=$H();for(property in this){if(!Object.isFunction(this[property])){a.set(property,this[property])}}return"#<Effect:"+a.inspect()+",options:"+$H(this.options).inspect()+">"}});Effect.Parallel=Class.create(Effect.Base,{initialize:function(a){this.effects=a||[];this.start(arguments[1])},update:function(a){this.effects.invoke("render",a)},finish:function(a){this.effects.each(function(b){b.render(1);b.cancel();b.event("beforeFinish");if(b.finish){b.finish(a)}b.event("afterFinish")})}});Effect.Tween=Class.create(Effect.Base,{initialize:function(c,f,e){c=Object.isString(c)?$(c):c;var b=$A(arguments),d=b.last(),a=b.length==5?b[3]:null;this.method=Object.isFunction(d)?d.bind(c):Object.isFunction(c[d])?c[d].bind(c):function(g){c[d]=g};this.start(Object.extend({from:f,to:e},a||{}))},update:function(a){this.method(a)}});Effect.Event=Class.create(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}))},update:Prototype.emptyFunction});Effect.Opacity=Class.create(Effect.Base,{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}var a=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});this.start(a)},update:function(a){this.element.setOpacity(a)}});Effect.Move=Class.create(Effect.Base,{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{});this.start(a)},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle("left")||"0");this.originalTop=parseFloat(this.element.getStyle("top")||"0");if(this.options.mode=="absolute"){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop}},update:function(a){this.element.setStyle({left:(this.options.x*a+this.originalLeft).round()+"px",top:(this.options.y*a+this.originalTop).round()+"px"})}});Effect.MoveBy=function(b,a,c){return new Effect.Move(b,Object.extend({x:c,y:a},arguments[3]||{}))};Effect.Scale=Class.create(Effect.Base,{initialize:function(b,c){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:c},arguments[2]||{});this.start(a)},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle("position");this.originalStyle={};["top","left","width","height","fontSize"].each(function(b){this.originalStyle[b]=this.element.style[b]}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var a=this.element.getStyle("font-size")||"100%";["em","px","%","pt"].each(function(b){if(a.indexOf(b)>0){this.fontSize=parseFloat(a);this.fontSizeType=b}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=="box"){this.dims=[this.element.offsetHeight,this.element.offsetWidth]}if(/^content/.test(this.options.scaleMode)){this.dims=[this.element.scrollHeight,this.element.scrollWidth]}if(!this.dims){this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]}},update:function(a){var b=(this.options.scaleFrom/100)+(this.factor*a);if(this.options.scaleContent&&this.fontSize){this.element.setStyle({fontSize:this.fontSize*b+this.fontSizeType})}this.setDimensions(this.dims[0]*b,this.dims[1]*b)},finish:function(a){if(this.restoreAfterFinish){this.element.setStyle(this.originalStyle)}},setDimensions:function(a,e){var f={};if(this.options.scaleX){f.width=e.round()+"px"}if(this.options.scaleY){f.height=a.round()+"px"}if(this.options.scaleFromCenter){var c=(a-this.dims[0])/2;var b=(e-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY){f.top=this.originalTop-c+"px"}if(this.options.scaleX){f.left=this.originalLeft-b+"px"}}else{if(this.options.scaleY){f.top=-c+"px"}if(this.options.scaleX){f.left=-b+"px"}}}this.element.setStyle(f)}});Effect.Highlight=Class.create(Effect.Base,{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({startcolor:"#ffff99"},arguments[1]||{});this.start(a)},setup:function(){if(this.element.getStyle("display")=="none"){this.cancel();return}this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle("background-image");this.element.setStyle({backgroundImage:"none"})}if(!this.options.endcolor){this.options.endcolor=this.element.getStyle("background-color").parseColor("#ffffff")}if(!this.options.restorecolor){this.options.restorecolor=this.element.getStyle("background-color")}this._base=$R(0,2).map(function(a){return parseInt(this.options.startcolor.slice(a*2+1,a*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(a){return parseInt(this.options.endcolor.slice(a*2+1,a*2+3),16)-this._base[a]}.bind(this))},update:function(a){this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(b,c,d){return b+((this._base[d]+(this._delta[d]*a)).round().toColorPart())}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=function(d){var c=arguments[1]||{},b=document.viewport.getScrollOffsets(),e=$(d).cumulativeOffset(),a=(window.height||document.body.scrollHeight)-document.viewport.getHeight();if(c.offset){e[1]+=c.offset}return new Effect.Tween(null,b.top,e[1]>a?a:e[1],c,function(f){scrollTo(b.left,f.round())})};Effect.Fade=function(c){c=$(c);var a=c.getInlineOpacity();var b=Object.extend({from:c.getOpacity()||1,to:0,afterFinishInternal:function(d){if(d.options.to!=0){return}d.element.hide().setStyle({opacity:a})}},arguments[1]||{});return new Effect.Opacity(c,b)};Effect.Appear=function(b){b=$(b);var a=Object.extend({from:(b.getStyle("display")=="none"?0:b.getOpacity()||0),to:1,afterFinishInternal:function(c){c.element.forceRerendering()},beforeSetup:function(c){c.element.setOpacity(c.options.from).show()}},arguments[1]||{});return new Effect.Opacity(b,a)};Effect.Puff=function(b){b=$(b);var a={opacity:b.getInlineOpacity(),position:b.getStyle("position"),top:b.style.top,left:b.style.left,width:b.style.width,height:b.style.height};return new Effect.Parallel([new Effect.Scale(b,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(b,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(c){Position.absolutize(c.effects[0].element)},afterFinishInternal:function(c){c.effects[0].element.hide().setStyle(a)}},arguments[1]||{}))};Effect.BlindUp=function(a){a=$(a);a.makeClipping();return new Effect.Scale(a,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(b){b.element.hide().undoClipping()}},arguments[1]||{}))};Effect.BlindDown=function(b){b=$(b);var a=b.getDimensions();return new Effect.Scale(b,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:a.height,originalWidth:a.width},restoreAfterFinish:true,afterSetup:function(c){c.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(c){c.element.undoClipping()}},arguments[1]||{}))};Effect.SwitchOff=function(b){b=$(b);var a=b.getInlineOpacity();return new Effect.Appear(b,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(c){new Effect.Scale(c.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(d){d.element.makePositioned().makeClipping()},afterFinishInternal:function(d){d.element.hide().undoClipping().undoPositioned().setStyle({opacity:a})}})}},arguments[1]||{}))};Effect.DropOut=function(b){b=$(b);var a={top:b.getStyle("top"),left:b.getStyle("left"),opacity:b.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(b,{x:0,y:100,sync:true}),new Effect.Opacity(b,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(c){c.effects[0].element.makePositioned()},afterFinishInternal:function(c){c.effects[0].element.hide().undoPositioned().setStyle(a)}},arguments[1]||{}))};Effect.Shake=function(d){d=$(d);var b=Object.extend({distance:20,duration:0.5},arguments[1]||{});var e=parseFloat(b.distance);var c=parseFloat(b.duration)/10;var a={top:d.getStyle("top"),left:d.getStyle("left")};return new Effect.Move(d,{x:e,y:0,duration:c,afterFinishInternal:function(f){new Effect.Move(f.element,{x:-e*2,y:0,duration:c*2,afterFinishInternal:function(g){new Effect.Move(g.element,{x:e*2,y:0,duration:c*2,afterFinishInternal:function(h){new Effect.Move(h.element,{x:-e*2,y:0,duration:c*2,afterFinishInternal:function(k){new Effect.Move(k.element,{x:e*2,y:0,duration:c*2,afterFinishInternal:function(l){new Effect.Move(l.element,{x:-e,y:0,duration:c,afterFinishInternal:function(m){m.element.undoPositioned().setStyle(a)}})}})}})}})}})}})};Effect.SlideDown=function(c){c=$(c).cleanWhitespace();var a=c.down().getStyle("bottom");var b=c.getDimensions();return new Effect.Scale(c,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:b.height,originalWidth:b.width},restoreAfterFinish:true,afterSetup:function(d){d.element.makePositioned();d.element.down().makePositioned();if(window.opera){d.element.setStyle({top:""})}d.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(d){d.element.down().setStyle({bottom:(d.dims[0]-d.element.clientHeight)+"px"})},afterFinishInternal:function(d){d.element.undoClipping().undoPositioned();d.element.down().undoPositioned().setStyle({bottom:a})}},arguments[1]||{}))};Effect.SlideUp=function(c){c=$(c).cleanWhitespace();var a=c.down().getStyle("bottom");var b=c.getDimensions();return new Effect.Scale(c,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,scaleMode:{originalHeight:b.height,originalWidth:b.width},restoreAfterFinish:true,afterSetup:function(d){d.element.makePositioned();d.element.down().makePositioned();if(window.opera){d.element.setStyle({top:""})}d.element.makeClipping().show()},afterUpdateInternal:function(d){d.element.down().setStyle({bottom:(d.dims[0]-d.element.clientHeight)+"px"})},afterFinishInternal:function(d){d.element.hide().undoClipping().undoPositioned();d.element.down().undoPositioned().setStyle({bottom:a})}},arguments[1]||{}))};Effect.Squish=function(a){return new Effect.Scale(a,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(b){b.element.makeClipping()},afterFinishInternal:function(b){b.element.hide().undoClipping()}})};Effect.Grow=function(c){c=$(c);var b=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var a={top:c.style.top,left:c.style.left,height:c.style.height,width:c.style.width,opacity:c.getInlineOpacity()};var g=c.getDimensions();var h,f;var e,d;switch(b.direction){case"top-left":h=f=e=d=0;break;case"top-right":h=g.width;f=d=0;e=-g.width;break;case"bottom-left":h=e=0;f=g.height;d=-g.height;break;case"bottom-right":h=g.width;f=g.height;e=-g.width;d=-g.height;break;case"center":h=g.width/2;f=g.height/2;e=-g.width/2;d=-g.height/2;break}return new Effect.Move(c,{x:h,y:f,duration:0.01,beforeSetup:function(k){k.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(k){new Effect.Parallel([new Effect.Opacity(k.element,{sync:true,to:1,from:0,transition:b.opacityTransition}),new Effect.Move(k.element,{x:e,y:d,sync:true,transition:b.moveTransition}),new Effect.Scale(k.element,100,{scaleMode:{originalHeight:g.height,originalWidth:g.width},sync:true,scaleFrom:window.opera?1:0,transition:b.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(l){l.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(l){l.effects[0].element.undoClipping().undoPositioned().setStyle(a)}},b))}})};Effect.Shrink=function(c){c=$(c);var b=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var a={top:c.style.top,left:c.style.left,height:c.style.height,width:c.style.width,opacity:c.getInlineOpacity()};var f=c.getDimensions();var e,d;switch(b.direction){case"top-left":e=d=0;break;case"top-right":e=f.width;d=0;break;case"bottom-left":e=0;d=f.height;break;case"bottom-right":e=f.width;d=f.height;break;case"center":e=f.width/2;d=f.height/2;break}return new Effect.Parallel([new Effect.Opacity(c,{sync:true,to:0,from:1,transition:b.opacityTransition}),new Effect.Scale(c,window.opera?1:0,{sync:true,transition:b.scaleTransition,restoreAfterFinish:true}),new Effect.Move(c,{x:e,y:d,sync:true,transition:b.moveTransition})],Object.extend({beforeStartInternal:function(g){g.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(g){g.effects[0].element.hide().undoClipping().undoPositioned().setStyle(a)}},b))};Effect.Pulsate=function(c){c=$(c);var b=arguments[1]||{};var a=c.getInlineOpacity();var e=b.transition||Effect.Transitions.sinoidal;var d=function(f){return e(1-Effect.Transitions.pulse(f,b.pulses))};d.bind(e);return new Effect.Opacity(c,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(f){f.element.setStyle({opacity:a})}},b),{transition:d}))};Effect.Fold=function(b){b=$(b);var a={top:b.style.top,left:b.style.left,width:b.style.width,height:b.style.height};b.makeClipping();return new Effect.Scale(b,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(c){new Effect.Scale(b,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(d){d.element.hide().undoClipping().setStyle(a)}})}},arguments[1]||{}))};Effect.Morph=Class.create(Effect.Base,{initialize:function(c){this.element=$(c);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(a.style)){this.style=$H(a.style)}else{if(a.style.include(":")){this.style=a.style.parseStyle()}else{this.element.addClassName(a.style);this.style=$H(this.element.getStyles());this.element.removeClassName(a.style);var b=this.element.getStyles();this.style=this.style.reject(function(d){return d.value==b[d.key]});a.afterFinishInternal=function(d){d.element.addClassName(d.options.style);d.transforms.each(function(e){d.element.style[e.style]=""})}}}this.start(a)},setup:function(){function a(b){if(!b||["rgba(0, 0, 0, 0)","transparent"].include(b)){b="#ffffff"}b=b.parseColor();return $R(0,2).map(function(c){return parseInt(b.slice(c*2+1,c*2+3),16)})}this.transforms=this.style.map(function(g){var f=g[0],e=g[1],d=null;if(e.parseColor("#zzzzzz")!="#zzzzzz"){e=e.parseColor();d="color"}else{if(f=="opacity"){e=parseFloat(e);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}}else{if(Element.CSS_LENGTH.test(e)){var c=e.match(/^([\+\-]?[0-9\.]+)(.*)$/);e=parseFloat(c[1]);d=(c.length==3)?c[2]:null}}}var b=this.element.getStyle(f);return{style:f.camelize(),originalValue:d=="color"?a(b):parseFloat(b||0),targetValue:d=="color"?a(e):e,unit:d}}.bind(this)).reject(function(b){return((b.originalValue==b.targetValue)||(b.unit!="color"&&(isNaN(b.originalValue)||isNaN(b.targetValue))))})},update:function(a){var d={},b,c=this.transforms.length;while(c--){d[(b=this.transforms[c]).style]=b.unit=="color"?"#"+(Math.round(b.originalValue[0]+(b.targetValue[0]-b.originalValue[0])*a)).toColorPart()+(Math.round(b.originalValue[1]+(b.targetValue[1]-b.originalValue[1])*a)).toColorPart()+(Math.round(b.originalValue[2]+(b.targetValue[2]-b.originalValue[2])*a)).toColorPart():(b.originalValue+(b.targetValue-b.originalValue)*a).toFixed(3)+(b.unit===null?"":b.unit)}this.element.setStyle(d,true)}});Effect.Transform=Class.create({initialize:function(a){this.tracks=[];this.options=arguments[1]||{};this.addTracks(a)},addTracks:function(a){a.each(function(b){b=$H(b);var c=b.values().first();this.tracks.push($H({ids:b.keys().first(),effect:Effect.Morph,options:{style:c}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(a){var d=a.get("ids"),c=a.get("effect"),b=a.get("options");var e=[$(d)||$$(d)].flatten();return e.map(function(f){return new c(f,Object.extend({sync:true},b))})}).flatten(),this.options)}});Element.CSS_PROPERTIES=$w("backgroundColor backgroundPosition borderBottomColor borderBottomStyle borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth borderRightColor borderRightStyle borderRightWidth borderSpacing borderTopColor borderTopStyle borderTopWidth bottom clip color fontSize fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop markerOffset maxHeight maxWidth minHeight minWidth opacity outlineColor outlineOffset outlineWidth paddingBottom paddingLeft paddingRight paddingTop right textIndent top width wordSpacing zIndex");Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.__parseStyleElement=document.createElement("div");String.prototype.parseStyle=function(){var b,a=$H();if(Prototype.Browser.WebKit){b=new Element("div",{style:this}).style}else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';b=String.__parseStyleElement.childNodes[0].style}Element.CSS_PROPERTIES.each(function(c){if(b[c]){a.set(c,b[c])}});if(Prototype.Browser.IE&&this.include("opacity")){a.set("opacity",this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1])}return a};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(b){var a=document.defaultView.getComputedStyle($(b),null);return Element.CSS_PROPERTIES.inject({},function(c,d){c[d]=a[d];return c})}}else{Element.getStyles=function(b){b=$(b);var a=b.currentStyle,c;c=Element.CSS_PROPERTIES.inject({},function(d,e){d[e]=a[e];return d});if(!c.opacity){c.opacity=b.getOpacity()}return c}}Effect.Methods={morph:function(a,b){a=$(a);new Effect.Morph(a,Object.extend({style:b},arguments[2]||{}));return a},visualEffect:function(c,e,b){c=$(c);var d=e.dasherize().camelize(),a=d.charAt(0).toUpperCase()+d.substring(1);new Effect[a](c,b);return c},highlight:function(b,a){b=$(b);new Effect.Highlight(b,a);return b}};$w("fade appear grow shrink fold blindUp blindDown slideUp slideDown pulsate shake puff squish switchOff dropOut").each(function(a){Effect.Methods[a]=function(c,b){c=$(c);Effect[a.charAt(0).toUpperCase()+a.substring(1)](c,b);return c}});$w("getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles").each(function(a){Effect.Methods[a]=Element[a]});Element.addMethods(Effect.Methods);if(Object.isUndefined(Effect)){throw ("dragdrop.js requires including script.aculo.us' effects.js library")}var Droppables={drops:[],remove:function(a){this.drops=this.drops.reject(function(b){return b.element==$(a)})},add:function(b){b=$(b);var a=Object.extend({greedy:true,hoverclass:null,tree:false},arguments[1]||{});if(a.containment){a._containers=[];var c=a.containment;if(Object.isArray(c)){c.each(function(d){a._containers.push($(d))})}else{a._containers.push($(c))}}if(a.accept){a.accept=[a.accept].flatten()}Element.makePositioned(b);a.element=b;this.drops.push(a)},findDeepestChild:function(a){deepest=a[0];for(i=1;i<a.length;++i){if(Element.isParent(a[i].element,deepest.element)){deepest=a[i]}}return deepest},isContained:function(b,a){var c;if(a.tree){c=b.treeNode}else{c=b.parentNode}return a._containers.detect(function(d){return c==d})},isAffected:function(a,c,b){return((b.element!=c)&&((!b._containers)||this.isContained(c,b))&&((!b.accept)||(Element.classNames(c).detect(function(d){return b.accept.include(d)})))&&Position.within(b.element,a[0],a[1]))},deactivate:function(a){if(a.hoverclass){Element.removeClassName(a.element,a.hoverclass)}this.last_active=null},activate:function(a){if(a.hoverclass){Element.addClassName(a.element,a.hoverclass)}this.last_active=a},show:function(a,c){if(!this.drops.length){return}var b,d=[];this.drops.each(function(e){if(Droppables.isAffected(a,c,e)){d.push(e)}});if(d.length>0){b=Droppables.findDeepestChild(d)}if(this.last_active&&this.last_active!=b){this.deactivate(this.last_active)}if(b){Position.within(b.element,a[0],a[1]);if(b.onHover){b.onHover(c,b.element,Position.overlap(b.overlap,b.element))}if(b!=this.last_active){Droppables.activate(b)}}},fire:function(b,a){if(!this.last_active){return}Position.prepare();if(this.isAffected([Event.pointerX(b),Event.pointerY(b)],a,this.last_active)){if(this.last_active.onDrop){this.last_active.onDrop(a,this.last_active.element,b);return true}}},reset:function(){if(this.last_active){this.deactivate(this.last_active)}}};var Draggables={drags:[],observers:[],register:function(a){if(this.drags.length==0){this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.updateDrag.bindAsEventListener(this);this.eventKeypress=this.keyPress.bindAsEventListener(this);Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(document,"mousemove",this.eventMouseMove);Event.observe(document,"keypress",this.eventKeypress)}this.drags.push(a)},unregister:function(a){this.drags=this.drags.reject(function(b){return b==a});if(this.drags.length==0){Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);Event.stopObserving(document,"keypress",this.eventKeypress)}},activate:function(a){if(a.options.delay){this._timeout=setTimeout(function(){Draggables._timeout=null;window.focus();Draggables.activeDraggable=a}.bind(this),a.options.delay)}else{window.focus();this.activeDraggable=a}},deactivate:function(){this.activeDraggable=null},updateDrag:function(a){if(!this.activeDraggable){return}var b=[Event.pointerX(a),Event.pointerY(a)];if(this._lastPointer&&(this._lastPointer.inspect()==b.inspect())){return}this._lastPointer=b;this.activeDraggable.updateDrag(a,b)},endDrag:function(a){if(this._timeout){clearTimeout(this._timeout);this._timeout=null}if(!this.activeDraggable){return}this._lastPointer=null;this.activeDraggable.endDrag(a);this.activeDraggable=null},keyPress:function(a){if(this.activeDraggable){this.activeDraggable.keyPress(a)}},addObserver:function(a){this.observers.push(a);this._cacheObserverCallbacks()},removeObserver:function(a){this.observers=this.observers.reject(function(b){return b.element==a});this._cacheObserverCallbacks()},notify:function(b,a,c){if(this[b+"Count"]>0){this.observers.each(function(d){if(d[b]){d[b](b,a,c)}})}if(a.options[b]){a.options[b](a,c)}},_cacheObserverCallbacks:function(){["onStart","onEnd","onDrag"].each(function(a){Draggables[a+"Count"]=Draggables.observers.select(function(b){return b[a]}).length})}};var Draggable=Class.create({initialize:function(b){var c={handle:false,reverteffect:function(f,e,d){var g=Math.sqrt(Math.abs(e^2)+Math.abs(d^2))*0.02;new Effect.Move(f,{x:-d,y:-e,duration:g,queue:{scope:"_draggable",position:"end"}})},endeffect:function(e){var d=Object.isNumber(e._opacity)?e._opacity:1;new Effect.Opacity(e,{duration:0.2,from:0.7,to:d,queue:{scope:"_draggable",position:"end"},afterFinish:function(){Draggable._dragging[e]=false}})},zindex:1000,revert:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,snap:false,delay:0};if(!arguments[1]||Object.isUndefined(arguments[1].endeffect)){Object.extend(c,{starteffect:function(d){d._opacity=Element.getOpacity(d);Draggable._dragging[d]=true;new Effect.Opacity(d,{duration:0.2,from:d._opacity,to:0.7})}})}var a=Object.extend(c,arguments[1]||{});this.element=$(b);if(a.handle&&Object.isString(a.handle)){this.handle=this.element.down("."+a.handle,0)}if(!this.handle){this.handle=$(a.handle)}if(!this.handle){this.handle=this.element}if(a.scroll&&!a.scroll.scrollTo&&!a.scroll.outerHTML){a.scroll=$(a.scroll);this._isScrollChild=Element.childOf(this.element,a.scroll)}Element.makePositioned(this.element);this.options=a;this.dragging=false;this.eventMouseDown=this.initDrag.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Draggables.register(this)},destroy:function(){Event.stopObserving(this.handle,"mousedown",this.eventMouseDown);Draggables.unregister(this)},currentDelta:function(){return([parseInt(Element.getStyle(this.element,"left")||"0"),parseInt(Element.getStyle(this.element,"top")||"0")])},initDrag:function(a){if(!Object.isUndefined(Draggable._dragging[this.element])&&Draggable._dragging[this.element]){return}if(Event.isLeftClick(a)){var c=Event.element(a);if((tag_name=c.tagName.toUpperCase())&&(tag_name=="INPUT"||tag_name=="SELECT"||tag_name=="OPTION"||tag_name=="BUTTON"||tag_name=="TEXTAREA")){return}var b=[Event.pointerX(a),Event.pointerY(a)];var d=Position.cumulativeOffset(this.element);this.offset=[0,1].map(function(e){return(b[e]-d[e])});Draggables.activate(this);Event.stop(a)}},startDrag:function(b){this.dragging=true;if(!this.delta){this.delta=this.currentDelta()}if(this.options.zindex){this.originalZ=parseInt(Element.getStyle(this.element,"z-index")||0);this.element.style.zIndex=this.options.zindex}if(this.options.ghosting){this._clone=this.element.cloneNode(true);this.element._originallyAbsolute=(this.element.getStyle("position")=="absolute");if(!this.element._originallyAbsolute){Position.absolutize(this.element)}this.element.parentNode.insertBefore(this._clone,this.element)}if(this.options.scroll){if(this.options.scroll==window){var a=this._getWindowScroll(this.options.scroll);this.originalScrollLeft=a.left;this.originalScrollTop=a.top}else{this.originalScrollLeft=this.options.scroll.scrollLeft;this.originalScrollTop=this.options.scroll.scrollTop}}Draggables.notify("onStart",this,b);if(this.options.starteffect){this.options.starteffect(this.element)}},updateDrag:function(event,pointer){if(!this.dragging){this.startDrag(event)}if(!this.options.quiet){Position.prepare();Droppables.show(pointer,this.element)}Draggables.notify("onDrag",this,event);this.draw(pointer);if(this.options.change){this.options.change(this)}if(this.options.scroll){this.stopScrolling();var p;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){p=[left,top,left+width,top+height]}}else{p=Position.page(this.options.scroll);p[0]+=this.options.scroll.scrollLeft+Position.deltaX;p[1]+=this.options.scroll.scrollTop+Position.deltaY;p.push(p[0]+this.options.scroll.offsetWidth);p.push(p[1]+this.options.scroll.offsetHeight)}var speed=[0,0];if(pointer[0]<(p[0]+this.options.scrollSensitivity)){speed[0]=pointer[0]-(p[0]+this.options.scrollSensitivity)}if(pointer[1]<(p[1]+this.options.scrollSensitivity)){speed[1]=pointer[1]-(p[1]+this.options.scrollSensitivity)}if(pointer[0]>(p[2]-this.options.scrollSensitivity)){speed[0]=pointer[0]-(p[2]-this.options.scrollSensitivity)}if(pointer[1]>(p[3]-this.options.scrollSensitivity)){speed[1]=pointer[1]-(p[3]-this.options.scrollSensitivity)}this.startScrolling(speed)}if(Prototype.Browser.WebKit){window.scrollBy(0,0)}Event.stop(event)},finishDrag:function(b,f){this.dragging=false;if(this.options.quiet){Position.prepare();var e=[Event.pointerX(b),Event.pointerY(b)];Droppables.show(e,this.element)}if(this.options.ghosting){if(!this.element._originallyAbsolute){Position.relativize(this.element)}delete this.element._originallyAbsolute;Element.remove(this._clone);this._clone=null}var g=false;if(f){g=Droppables.fire(b,this.element);if(!g){g=false}}if(g&&this.options.onDropped){this.options.onDropped(this.element)}Draggables.notify("onEnd",this,b);var a=this.options.revert;if(a&&Object.isFunction(a)){a=a(this.element)}var c=this.currentDelta();if(a&&this.options.reverteffect){if(g==0||a!="failure"){this.options.reverteffect(this.element,c[1]-this.delta[1],c[0]-this.delta[0])}}else{this.delta=c}if(this.options.zindex){this.element.style.zIndex=this.originalZ}if(this.options.endeffect){this.options.endeffect(this.element)}Draggables.deactivate(this);Droppables.reset()},keyPress:function(a){if(a.keyCode!=Event.KEY_ESC){return}this.finishDrag(a,false);Event.stop(a)},endDrag:function(a){if(!this.dragging){return}this.stopScrolling();this.finishDrag(a,true);Event.stop(a)},draw:function(a){var g=Position.cumulativeOffset(this.element);if(this.options.ghosting){var c=Position.realOffset(this.element);g[0]+=c[0]-Position.deltaX;g[1]+=c[1]-Position.deltaY}var f=this.currentDelta();g[0]-=f[0];g[1]-=f[1];if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){g[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;g[1]-=this.options.scroll.scrollTop-this.originalScrollTop}var e=[0,1].map(function(d){return(a[d]-g[d]-this.offset[d])}.bind(this));if(this.options.snap){if(Object.isFunction(this.options.snap)){e=this.options.snap(e[0],e[1],this)}else{if(Object.isArray(this.options.snap)){e=e.map(function(d,h){return(d/this.options.snap[h]).round()*this.options.snap[h]}.bind(this))}else{e=e.map(function(d){return(d/this.options.snap).round()*this.options.snap}.bind(this))}}}var b=this.element.style;if((!this.options.constraint)||(this.options.constraint=="horizontal")){b.left=e[0]+"px"}if((!this.options.constraint)||(this.options.constraint=="vertical")){b.top=e[1]+"px"}if(b.visibility=="hidden"){b.visibility=""}},stopScrolling:function(){if(this.scrollInterval){clearInterval(this.scrollInterval);this.scrollInterval=null;Draggables._lastScrollPointer=null}},startScrolling:function(a){if(!(a[0]||a[1])){return}this.scrollSpeed=[a[0]*this.options.scrollSpeed,a[1]*this.options.scrollSpeed];this.lastScrolled=new Date();this.scrollInterval=setInterval(this.scroll.bind(this),10)},scroll:function(){var current=new Date();var delta=current-this.lastScrolled;this.lastScrolled=current;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){if(this.scrollSpeed[0]||this.scrollSpeed[1]){var d=delta/1000;this.options.scroll.scrollTo(left+d*this.scrollSpeed[0],top+d*this.scrollSpeed[1])}}}else{this.options.scroll.scrollLeft+=this.scrollSpeed[0]*delta/1000;this.options.scroll.scrollTop+=this.scrollSpeed[1]*delta/1000}Position.prepare();Droppables.show(Draggables._lastPointer,this.element);Draggables.notify("onDrag",this);if(this._isScrollChild){Draggables._lastScrollPointer=Draggables._lastScrollPointer||$A(Draggables._lastPointer);Draggables._lastScrollPointer[0]+=this.scrollSpeed[0]*delta/1000;Draggables._lastScrollPointer[1]+=this.scrollSpeed[1]*delta/1000;if(Draggables._lastScrollPointer[0]<0){Draggables._lastScrollPointer[0]=0}if(Draggables._lastScrollPointer[1]<0){Draggables._lastScrollPointer[1]=0}this.draw(Draggables._lastScrollPointer)}if(this.options.change){this.options.change(this)}},_getWindowScroll:function(w){var T,L,W,H;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft}else{if(w.document.body){T=body.scrollTop;L=body.scrollLeft}}if(w.innerWidth){W=w.innerWidth;H=w.innerHeight}else{if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight}else{W=body.offsetWidth;H=body.offsetHeight}}}return{top:T,left:L,width:W,height:H}}});Draggable._dragging={};var SortableObserver=Class.create({initialize:function(b,a){this.element=$(b);this.observer=a;this.lastValue=Sortable.serialize(this.element)},onStart:function(){this.lastValue=Sortable.serialize(this.element)},onEnd:function(){Sortable.unmark();if(this.lastValue!=Sortable.serialize(this.element)){this.observer(this.element)}}});var Sortable={SERIALIZE_RULE:/^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,sortables:{},_findRootElement:function(a){while(a.tagName.toUpperCase()!="BODY"){if(a.id&&Sortable.sortables[a.id]){return a}a=a.parentNode}},options:function(a){a=Sortable._findRootElement($(a));if(!a){return}return Sortable.sortables[a.id]},destroy:function(a){var b=Sortable.options(a);if(b){Draggables.removeObserver(b.element);b.droppables.each(function(c){Droppables.remove(c)});b.draggables.invoke("destroy");delete Sortable.sortables[b.element.id]}},create:function(c){c=$(c);var b=Object.extend({element:c,tag:"li",dropOnEmpty:false,tree:false,treeTag:"ul",overlap:"vertical",constraint:"vertical",containment:c,handle:false,only:false,delay:0,hoverclass:null,ghosting:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,format:this.SERIALIZE_RULE,elements:false,handles:false,onChange:Prototype.emptyFunction,onUpdate:Prototype.emptyFunction},arguments[1]||{});this.destroy(c);var a={revert:true,quiet:b.quiet,scroll:b.scroll,scrollSpeed:b.scrollSpeed,scrollSensitivity:b.scrollSensitivity,delay:b.delay,ghosting:b.ghosting,constraint:b.constraint,handle:b.handle};if(b.starteffect){a.starteffect=b.starteffect}if(b.reverteffect){a.reverteffect=b.reverteffect}else{if(b.ghosting){a.reverteffect=function(f){f.style.top=0;f.style.left=0}}}if(b.endeffect){a.endeffect=b.endeffect}if(b.zindex){a.zindex=b.zindex}var d={overlap:b.overlap,containment:b.containment,tree:b.tree,hoverclass:b.hoverclass,onHover:Sortable.onHover};var e={onHover:Sortable.onEmptyHover,overlap:b.overlap,containment:b.containment,hoverclass:b.hoverclass};Element.cleanWhitespace(c);b.draggables=[];b.droppables=[];if(b.dropOnEmpty||b.tree){Droppables.add(c,e);b.droppables.push(c)}(b.elements||this.findElements(c,b)||[]).each(function(h,f){var g=b.handles?$(b.handles[f]):(b.handle?$(h).select("."+b.handle)[0]:h);b.draggables.push(new Draggable(h,Object.extend(a,{handle:g})));Droppables.add(h,d);if(b.tree){h.treeNode=c}b.droppables.push(h)});if(b.tree){(Sortable.findTreeElements(c,b)||[]).each(function(f){Droppables.add(f,e);f.treeNode=c;b.droppables.push(f)})}this.sortables[c.id]=b;Draggables.addObserver(new SortableObserver(c,b.onUpdate))},findElements:function(b,a){return Element.findChildren(b,a.only,a.tree?true:false,a.tag)},findTreeElements:function(b,a){return Element.findChildren(b,a.only,a.tree?true:false,a.treeTag)},onHover:function(e,d,a){if(Element.isParent(d,e)){return}if(a>0.33&&a<0.66&&Sortable.options(d).tree){return}else{if(a>0.5){Sortable.mark(d,"before");if(d.previousSibling!=e){var b=e.parentNode;e.style.visibility="hidden";d.parentNode.insertBefore(e,d);if(d.parentNode!=b){Sortable.options(b).onChange(e)}Sortable.options(d.parentNode).onChange(e)}}else{Sortable.mark(d,"after");var c=d.nextSibling||null;if(c!=e){var b=e.parentNode;e.style.visibility="hidden";d.parentNode.insertBefore(e,c);if(d.parentNode!=b){Sortable.options(b).onChange(e)}Sortable.options(d.parentNode).onChange(e)}}}},onEmptyHover:function(e,g,h){var k=e.parentNode;var a=Sortable.options(g);if(!Element.isParent(g,e)){var f;var c=Sortable.findElements(g,{tag:a.tag,only:a.only});var b=null;if(c){var d=Element.offsetSize(g,a.overlap)*(1-h);for(f=0;f<c.length;f+=1){if(d-Element.offsetSize(c[f],a.overlap)>=0){d-=Element.offsetSize(c[f],a.overlap)}else{if(d-(Element.offsetSize(c[f],a.overlap)/2)>=0){b=f+1<c.length?c[f+1]:null;break}else{b=c[f];break}}}}g.insertBefore(e,b);Sortable.options(k).onChange(e);a.onChange(e)}},unmark:function(){if(Sortable._marker){Sortable._marker.hide()}},mark:function(b,a){var d=Sortable.options(b.parentNode);if(d&&!d.ghosting){return}if(!Sortable._marker){Sortable._marker=($("dropmarker")||Element.extend(document.createElement("DIV"))).hide().addClassName("dropmarker").setStyle({position:"absolute"});document.getElementsByTagName("body").item(0).appendChild(Sortable._marker)}var c=Position.cumulativeOffset(b);Sortable._marker.setStyle({left:c[0]+"px",top:c[1]+"px"});if(a=="after"){if(d.overlap=="horizontal"){Sortable._marker.setStyle({left:(c[0]+b.clientWidth)+"px"})}else{Sortable._marker.setStyle({top:(c[1]+b.clientHeight)+"px"})}}Sortable._marker.show()},_tree:function(e,b,f){var d=Sortable.findElements(e,b)||[];for(var c=0;c<d.length;++c){var a=d[c].id.match(b.format);if(!a){continue}var g={id:encodeURIComponent(a?a[1]:null),element:e,parent:f,children:[],position:f.children.length,container:$(d[c]).down(b.treeTag)};if(g.container){this._tree(g.container,b,g)}f.children.push(g)}return f},tree:function(d){d=$(d);var c=this.options(d);var b=Object.extend({tag:c.tag,treeTag:c.treeTag,only:c.only,name:d.id,format:c.format},arguments[1]||{});var a={id:null,parent:null,children:[],container:d,position:0};return Sortable._tree(d,b,a)},_constructIndex:function(b){var a="";do{if(b.id){a="["+b.position+"]"+a}}while((b=b.parent)!=null);return a},sequence:function(b){b=$(b);var a=Object.extend(this.options(b),arguments[1]||{});return $(this.findElements(b,a)||[]).map(function(c){return c.id.match(a.format)?c.id.match(a.format)[1]:""})},setSequence:function(b,c){b=$(b);var a=Object.extend(this.options(b),arguments[2]||{});var d={};this.findElements(b,a).each(function(e){if(e.id.match(a.format)){d[e.id.match(a.format)[1]]=[e,e.parentNode]}e.parentNode.removeChild(e)});c.each(function(e){var f=d[e];if(f){f[1].appendChild(f[0]);delete d[e]}})},serialize:function(c){c=$(c);var b=Object.extend(Sortable.options(c),arguments[1]||{});var a=encodeURIComponent((arguments[1]&&arguments[1].name)?arguments[1].name:c.id);if(b.tree){return Sortable.tree(c,arguments[1]).children.map(function(d){return[a+Sortable._constructIndex(d)+"[id]="+encodeURIComponent(d.id)].concat(d.children.map(arguments.callee))}).flatten().join("&")}else{return Sortable.sequence(c,arguments[1]).map(function(d){return a+"[]="+encodeURIComponent(d)}).join("&")}}};Element.isParent=function(b,a){if(!b.parentNode||b==a){return false}if(b.parentNode==a){return true}return Element.isParent(b.parentNode,a)};Element.findChildren=function(d,b,a,c){if(!d.hasChildNodes()){return null}c=c.toUpperCase();if(b){b=[b].flatten()}var e=[];$A(d.childNodes).each(function(g){if(g.tagName&&g.tagName.toUpperCase()==c&&(!b||(Element.classNames(g).detect(function(h){return b.include(h)})))){e.push(g)}if(a){var f=Element.findChildren(g,b,a,c);if(f){e.push(f)}}});return(e.length>0?e.flatten():[])};Element.offsetSize=function(a,b){return a["offset"+((b=="vertical"||b=="height")?"Height":"Width")]};var OpenLayers={singleFile:true};(function(){var g=(typeof OpenLayers=="object"&&OpenLayers.singleFile);window.OpenLayers={_scriptName:(!g)?"lib/OpenLayers.js":"OpenLayers.js",_getScriptLocation:function(){var r="";var t=new RegExp("(^|(.*?\\/))("+OpenLayers._scriptName+")(\\?|$)");var o=document.getElementsByTagName("script");for(var q=0,h=o.length;q<h;q++){var s=o[q].getAttribute("src");if(s){var p=s.match(t);if(p){r=p[1];break}}}return r}};if(!g){var k=new Array("OpenLayers/Util.js","OpenLayers/BaseTypes.js","OpenLayers/BaseTypes/Class.js","OpenLayers/BaseTypes/Bounds.js","OpenLayers/BaseTypes/Element.js","OpenLayers/BaseTypes/LonLat.js","OpenLayers/BaseTypes/Pixel.js","OpenLayers/BaseTypes/Size.js","OpenLayers/Console.js","OpenLayers/Tween.js","Rico/Corner.js","Rico/Color.js","OpenLayers/Ajax.js","OpenLayers/Events.js","OpenLayers/Request.js","OpenLayers/Request/XMLHttpRequest.js","OpenLayers/Projection.js","OpenLayers/Map.js","OpenLayers/Layer.js","OpenLayers/Icon.js","OpenLayers/Marker.js","OpenLayers/Marker/Box.js","OpenLayers/Popup.js","OpenLayers/Tile.js","OpenLayers/Tile/Image.js","OpenLayers/Tile/WFS.js","OpenLayers/Layer/Image.js","OpenLayers/Layer/SphericalMercator.js","OpenLayers/Layer/EventPane.js","OpenLayers/Layer/FixedZoomLevels.js","OpenLayers/Layer/Google.js","OpenLayers/Layer/VirtualEarth.js","OpenLayers/Layer/Yahoo.js","OpenLayers/Layer/HTTPRequest.js","OpenLayers/Layer/Grid.js","OpenLayers/Layer/MapGuide.js","OpenLayers/Layer/MapServer.js","OpenLayers/Layer/MapServer/Untiled.js","OpenLayers/Layer/KaMap.js","OpenLayers/Layer/KaMapCache.js","OpenLayers/Layer/MultiMap.js","OpenLayers/Layer/Markers.js","OpenLayers/Layer/Text.js","OpenLayers/Layer/WorldWind.js","OpenLayers/Layer/ArcGIS93Rest.js","OpenLayers/Layer/WMS.js","OpenLayers/Layer/WMS/Untiled.js","OpenLayers/Layer/ArcIMS.js","OpenLayers/Layer/GeoRSS.js","OpenLayers/Layer/Boxes.js","OpenLayers/Layer/XYZ.js","OpenLayers/Layer/TMS.js","OpenLayers/Layer/TileCache.js","OpenLayers/Popup/Anchored.js","OpenLayers/Popup/AnchoredBubble.js","OpenLayers/Popup/Framed.js","OpenLayers/Popup/FramedCloud.js","OpenLayers/Feature.js","OpenLayers/Feature/Vector.js","OpenLayers/Feature/WFS.js","OpenLayers/Handler.js","OpenLayers/Handler/Click.js","OpenLayers/Handler/Hover.js","OpenLayers/Handler/Point.js","OpenLayers/Handler/Path.js","OpenLayers/Handler/Polygon.js","OpenLayers/Handler/Feature.js","OpenLayers/Handler/Drag.js","OpenLayers/Handler/RegularPolygon.js","OpenLayers/Handler/Box.js","OpenLayers/Handler/MouseWheel.js","OpenLayers/Handler/Keyboard.js","OpenLayers/Control.js","OpenLayers/Control/Attribution.js","OpenLayers/Control/Button.js","OpenLayers/Control/ZoomBox.js","OpenLayers/Control/ZoomToMaxExtent.js","OpenLayers/Control/DragPan.js","OpenLayers/Control/Navigation.js","OpenLayers/Control/MouseDefaults.js","OpenLayers/Control/MousePosition.js","OpenLayers/Control/OverviewMap.js","OpenLayers/Control/KeyboardDefaults.js","OpenLayers/Control/PanZoom.js","OpenLayers/Control/PanZoomBar.js","OpenLayers/Control/ArgParser.js","OpenLayers/Control/Permalink.js","OpenLayers/Control/Scale.js","OpenLayers/Control/ScaleLine.js","OpenLayers/Control/Snapping.js","OpenLayers/Control/Split.js","OpenLayers/Control/LayerSwitcher.js","OpenLayers/Control/DrawFeature.js","OpenLayers/Control/DragFeature.js","OpenLayers/Control/ModifyFeature.js","OpenLayers/Control/Panel.js","OpenLayers/Control/SelectFeature.js","OpenLayers/Control/NavigationHistory.js","OpenLayers/Control/Measure.js","OpenLayers/Control/WMSGetFeatureInfo.js","OpenLayers/Geometry.js","OpenLayers/Geometry/Rectangle.js","OpenLayers/Geometry/Collection.js","OpenLayers/Geometry/Point.js","OpenLayers/Geometry/MultiPoint.js","OpenLayers/Geometry/Curve.js","OpenLayers/Geometry/LineString.js","OpenLayers/Geometry/LinearRing.js","OpenLayers/Geometry/Polygon.js","OpenLayers/Geometry/MultiLineString.js","OpenLayers/Geometry/MultiPolygon.js","OpenLayers/Geometry/Surface.js","OpenLayers/Renderer.js","OpenLayers/Renderer/Elements.js","OpenLayers/Renderer/SVG.js","OpenLayers/Renderer/Canvas.js","OpenLayers/Renderer/VML.js","OpenLayers/Layer/Vector.js","OpenLayers/Layer/Vector/RootContainer.js","OpenLayers/Strategy.js","OpenLayers/Strategy/Fixed.js","OpenLayers/Strategy/Cluster.js","OpenLayers/Strategy/Paging.js","OpenLayers/Strategy/BBOX.js","OpenLayers/Strategy/Save.js","OpenLayers/Protocol.js","OpenLayers/Protocol/HTTP.js","OpenLayers/Protocol/SQL.js","OpenLayers/Protocol/SQL/Gears.js","OpenLayers/Protocol/WFS.js","OpenLayers/Protocol/WFS/v1.js","OpenLayers/Protocol/WFS/v1_0_0.js","OpenLayers/Protocol/WFS/v1_1_0.js","OpenLayers/Layer/PointTrack.js","OpenLayers/Layer/GML.js","OpenLayers/Style.js","OpenLayers/StyleMap.js","OpenLayers/Rule.js","OpenLayers/Filter.js","OpenLayers/Filter/FeatureId.js","OpenLayers/Filter/Logical.js","OpenLayers/Filter/Comparison.js","OpenLayers/Filter/Spatial.js","OpenLayers/Format.js","OpenLayers/Format/XML.js","OpenLayers/Format/ArcXML.js","OpenLayers/Format/ArcXML/Features.js","OpenLayers/Format/GML.js","OpenLayers/Format/GML/Base.js","OpenLayers/Format/GML/v2.js","OpenLayers/Format/GML/v3.js","OpenLayers/Format/KML.js","OpenLayers/Format/GeoRSS.js","OpenLayers/Format/WFS.js","OpenLayers/Format/WFSCapabilities.js","OpenLayers/Format/WFSCapabilities/v1.js","OpenLayers/Format/WFSCapabilities/v1_0_0.js","OpenLayers/Format/WFSCapabilities/v1_1_0.js","OpenLayers/Format/WFSDescribeFeatureType.js","OpenLayers/Format/WMSDescribeLayer.js","OpenLayers/Format/WMSDescribeLayer/v1_1.js","OpenLayers/Format/WKT.js","OpenLayers/Format/OSM.js","OpenLayers/Format/GPX.js","OpenLayers/Format/Filter.js","OpenLayers/Format/Filter/v1.js","OpenLayers/Format/Filter/v1_0_0.js","OpenLayers/Format/Filter/v1_1_0.js","OpenLayers/Format/SLD.js","OpenLayers/Format/SLD/v1.js","OpenLayers/Format/SLD/v1_0_0.js","OpenLayers/Format/SLD/v1.js","OpenLayers/Format/WFST.js","OpenLayers/Format/WFST/v1.js","OpenLayers/Format/WFST/v1_0_0.js","OpenLayers/Format/WFST/v1_1_0.js","OpenLayers/Format/Text.js","OpenLayers/Format/JSON.js","OpenLayers/Format/GeoJSON.js","OpenLayers/Format/WMC.js","OpenLayers/Format/WMC/v1.js","OpenLayers/Format/WMC/v1_0_0.js","OpenLayers/Format/WMC/v1_1_0.js","OpenLayers/Format/WMSCapabilities.js","OpenLayers/Format/WMSCapabilities/v1_1.js","OpenLayers/Format/WMSCapabilities/v1_1_0.js","OpenLayers/Format/WMSCapabilities/v1_1_1.js","OpenLayers/Format/WMSGetFeatureInfo.js","OpenLayers/Layer/WFS.js","OpenLayers/Control/GetFeature.js","OpenLayers/Control/MouseToolbar.js","OpenLayers/Control/NavToolbar.js","OpenLayers/Control/PanPanel.js","OpenLayers/Control/Pan.js","OpenLayers/Control/ZoomIn.js","OpenLayers/Control/ZoomOut.js","OpenLayers/Control/ZoomPanel.js","OpenLayers/Control/EditingToolbar.js","OpenLayers/Lang.js","OpenLayers/Lang/en.js");var b=navigator.userAgent;var d=(b.match("MSIE")||b.match("Safari"));if(d){var a=new Array(k.length)}var l=OpenLayers._getScriptLocation()+"lib/";for(var c=0,f=k.length;c<f;c++){if(d){a[c]="<script src='"+l+k[c]+"'><\/script>"}else{var m=document.createElement("script");m.src=l+k[c];var e=document.getElementsByTagName("head").length?document.getElementsByTagName("head")[0]:document.body;e.appendChild(m)}}if(d){document.write(a.join(""))}}})();OpenLayers.VERSION_NUMBER="OpenLayers 2.8 -- $Revision: 9492 $";OpenLayers.String={startsWith:function(b,a){return(b.indexOf(a)==0)},contains:function(b,a){return(b.indexOf(a)!=-1)},trim:function(a){return a.replace(/^\s\s*/,"").replace(/\s\s*$/,"")},camelize:function(f){var d=f.split("-");var b=d[0];for(var c=1,a=d.length;c<a;c++){var e=d[c];b+=e.charAt(0).toUpperCase()+e.substring(1)}return b},format:function(d,c,a){if(!c){c=window}var b=function(k,e){var h;var g=e.split(/\.+/);for(var f=0;f<g.length;f++){if(f==0){h=c}h=h[g[f]]}if(typeof h=="function"){h=a?h.apply(null,a):h()}if(typeof h=="undefined"){return"undefined"}else{return h}};return d.replace(OpenLayers.String.tokenRegEx,b)},tokenRegEx:/\$\{([\w.]+?)\}/g,numberRegEx:/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,isNumeric:function(a){return OpenLayers.String.numberRegEx.test(a)},numericIf:function(a){return OpenLayers.String.isNumeric(a)?parseFloat(a):a}};if(!String.prototype.startsWith){String.prototype.startsWith=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.String.startsWith"}));return OpenLayers.String.startsWith(this,a)}}if(!String.prototype.contains){String.prototype.contains=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.String.contains"}));return OpenLayers.String.contains(this,a)}}if(!String.prototype.trim){String.prototype.trim=function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.String.trim"}));return OpenLayers.String.trim(this)}}if(!String.prototype.camelize){String.prototype.camelize=function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.String.camelize"}));return OpenLayers.String.camelize(this)}}OpenLayers.Number={decimalSeparator:".",thousandsSeparator:",",limitSigDigs:function(a,c){var b=0;if(c>0){b=parseFloat(a.toPrecision(c))}return b},format:function(c,a,g,k){a=(typeof a!="undefined")?a:0;g=(typeof g!="undefined")?g:OpenLayers.Number.thousandsSeparator;k=(typeof k!="undefined")?k:OpenLayers.Number.decimalSeparator;if(a!=null){c=parseFloat(c.toFixed(a))}var b=c.toString().split(".");if(b.length==1&&a==null){a=0}var d=b[0];if(g){var e=/(-?[0-9]+)([0-9]{3})/;while(e.test(d)){d=d.replace(e,"$1"+g+"$2")}}var f;if(a==0){f=d}else{var h=b.length>1?b[1]:"0";if(a!=null){h=h+new Array(a-h.length+1).join("0")}f=d+k+h}return f}};if(!Number.prototype.limitSigDigs){Number.prototype.limitSigDigs=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Number.limitSigDigs"}));return OpenLayers.Number.limitSigDigs(this,a)}}OpenLayers.Function={bind:function(c,b){var a=Array.prototype.slice.apply(arguments,[2]);return function(){var d=a.concat(Array.prototype.slice.apply(arguments,[0]));return c.apply(b,d)}},bindAsEventListener:function(b,a){return function(c){return b.call(a,c||window.event)}}};if(!Function.prototype.bind){Function.prototype.bind=function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Function.bind"}));Array.prototype.unshift.apply(arguments,[this]);return OpenLayers.Function.bind.apply(null,arguments)}}if(!Function.prototype.bindAsEventListener){Function.prototype.bindAsEventListener=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Function.bindAsEventListener"}));return OpenLayers.Function.bindAsEventListener(this,a)}}OpenLayers.Array={filter:function(g,f,b){var d=[];if(Array.prototype.filter){d=g.filter(f,b)}else{var a=g.length;if(typeof f!="function"){throw new TypeError()}for(var c=0;c<a;c++){if(c in g){var e=g[c];if(f.call(b,e,c,g)){d.push(e)}}}}return d}};OpenLayers.Class=function(){var d=function(){if(arguments&&arguments[0]!=OpenLayers.Class.isPrototype){this.initialize.apply(this,arguments)}};var c={};var f,b;for(var e=0,a=arguments.length;e<a;++e){if(typeof arguments[e]=="function"){if(e==0&&a>1){b=arguments[e].prototype.initialize;arguments[e].prototype.initialize=function(){};c=new arguments[e];if(b===undefined){delete arguments[e].prototype.initialize}else{arguments[e].prototype.initialize=b}}f=arguments[e].prototype}else{f=arguments[e]}OpenLayers.Util.extend(c,f)}d.prototype=c;return d};OpenLayers.Class.isPrototype=function(){};OpenLayers.Class.create=function(){return function(){if(arguments&&arguments[0]!=OpenLayers.Class.isPrototype){this.initialize.apply(this,arguments)}}};OpenLayers.Class.inherit=function(){var d=arguments[0];var e=new d(OpenLayers.Class.isPrototype);for(var c=1,a=arguments.length;c<a;c++){if(typeof arguments[c]=="function"){var b=arguments[c];arguments[c]=new b(OpenLayers.Class.isPrototype)}OpenLayers.Util.extend(e,arguments[c])}return e};OpenLayers.Util={};OpenLayers.Util.getElement=function(){var d=[];for(var c=0,a=arguments.length;c<a;c++){var b=arguments[c];if(typeof b=="string"){b=document.getElementById(b)}if(arguments.length==1){return b}d.push(b)}return d};if(typeof window.$==="undefined"){window.$=OpenLayers.Util.getElement}OpenLayers.Util.extend=function(a,e){a=a||{};if(e){for(var d in e){var c=e[d];if(c!==undefined){a[d]=c}}var b=typeof window.Event=="function"&&e instanceof window.Event;if(!b&&e.hasOwnProperty&&e.hasOwnProperty("toString")){a.toString=e.toString}}return a};OpenLayers.Util.removeItem=function(c,b){for(var a=c.length-1;a>=0;a--){if(c[a]==b){c.splice(a,1)}}return c};OpenLayers.Util.clearArray=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"array = []"}));a.length=0};OpenLayers.Util.indexOf=function(d,c){for(var b=0,a=d.length;b<a;b++){if(d[b]==c){return b}}return -1};OpenLayers.Util.modifyDOMElement=function(e,h,d,f,a,c,g,b){if(h){e.id=h}if(d){e.style.left=d.x+"px";e.style.top=d.y+"px"}if(f){e.style.width=f.w+"px";e.style.height=f.h+"px"}if(a){e.style.position=a}if(c){e.style.border=c}if(g){e.style.overflow=g}if(parseFloat(b)>=0&&parseFloat(b)<1){e.style.filter="alpha(opacity="+(b*100)+")";e.style.opacity=b}else{if(parseFloat(b)==1){e.style.filter="";e.style.opacity=""}}};OpenLayers.Util.createDiv=function(a,k,h,f,e,c,b,g){var d=document.createElement("div");if(f){d.style.backgroundImage="url("+f+")"}if(!a){a=OpenLayers.Util.createUniqueID("OpenLayersDiv")}if(!e){e="absolute"}OpenLayers.Util.modifyDOMElement(d,a,k,h,e,c,b,g);return d};OpenLayers.Util.createImage=function(a,h,g,e,d,c,f,k){var b=document.createElement("img");if(!a){a=OpenLayers.Util.createUniqueID("OpenLayersDiv")}if(!d){d="relative"}OpenLayers.Util.modifyDOMElement(b,a,h,g,d,c,null,f);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(e){b.src=e}return b};OpenLayers.Util.setOpacity=function(b,a){OpenLayers.Util.modifyDOMElement(b,null,null,null,null,null,null,a)};OpenLayers.Util.onImageLoad=function(){if(!this.viewRequestID||(this.map&&this.viewRequestID==this.map.viewRequestID)){this.style.backgroundColor="transparent";this.style.display=""}};OpenLayers.Util.onImageLoadErrorColor="pink";OpenLayers.IMAGE_RELOAD_ATTEMPTS=0;OpenLayers.Util.onImageLoadError=function(){this._attempts=(this._attempts)?(this._attempts+1):1;if(this._attempts<=OpenLayers.IMAGE_RELOAD_ATTEMPTS){var d=this.urls;if(d&&d instanceof Array&&d.length>1){var e=this.src.toString();var c,a;for(a=0;c=d[a];a++){if(e.indexOf(c)!=-1){break}}var f=Math.floor(d.length*Math.random());var b=d[f];a=0;while(b==c&&a++<4){f=Math.floor(d.length*Math.random());b=d[f]}this.src=e.replace(c,b)}else{this.src=this.src}}else{this.style.backgroundColor=OpenLayers.Util.onImageLoadErrorColor}this.style.display=""};OpenLayers.Util.alphaHackNeeded=null;OpenLayers.Util.alphaHack=function(){if(OpenLayers.Util.alphaHackNeeded==null){var d=navigator.appVersion.split("MSIE");var a=parseFloat(d[1]);var b=false;try{b=!!(document.body.filters)}catch(c){}OpenLayers.Util.alphaHackNeeded=(b&&(a>=5.5)&&(a<7))}return OpenLayers.Util.alphaHackNeeded};OpenLayers.Util.modifyAlphaImageDiv=function(a,b,l,k,g,f,c,d,h){OpenLayers.Util.modifyDOMElement(a,b,l,k,f,null,null,h);var e=a.childNodes[0];if(g){e.src=g}OpenLayers.Util.modifyDOMElement(e,a.id+"_innerImage",null,k,"relative",c);if(OpenLayers.Util.alphaHack()){if(a.style.display!="none"){a.style.display="inline-block"}if(d==null){d="scale"}a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+e.src+"', sizingMethod='"+d+"')";if(parseFloat(a.style.opacity)>=0&&parseFloat(a.style.opacity)<1){a.style.filter+=" alpha(opacity="+a.style.opacity*100+")"}e.style.filter="alpha(opacity=0)"}};OpenLayers.Util.modifyCssSpriteDiv=function(a,b,k,h,f,e,c,d,g){OpenLayers.Util.modifyDOMElement(a,b,k,h,e,null,null,g);if(f){$(a).addClassName(f)}};OpenLayers.Util.createAlphaImageDiv=function(b,l,k,g,f,c,d,h,m){var a=OpenLayers.Util.createDiv();var e=OpenLayers.Util.createImage(null,null,null,null,null,null,null,false);a.appendChild(e);if(m){e.style.display="none";OpenLayers.Event.observe(e,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,a));OpenLayers.Event.observe(e,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,a))}OpenLayers.Util.modifyAlphaImageDiv(a,b,l,k,g,f,c,d,h);return a};OpenLayers.Util.createCssSpriteDiv=function(b,k,h,f,e,c,d,g,l){var a=OpenLayers.Util.createDiv();OpenLayers.Util.modifyCssSpriteDiv(a,b,k,h,f,e,c,d,g);return a};OpenLayers.Util.upperCaseObject=function(b){var a={};for(var c in b){a[c.toUpperCase()]=b[c]}return a};OpenLayers.Util.applyDefaults=function(d,c){d=d||{};var b=typeof window.Event=="function"&&c instanceof window.Event;for(var a in c){if(d[a]===undefined||(!b&&c.hasOwnProperty&&c.hasOwnProperty(a)&&!d.hasOwnProperty(a))){d[a]=c[a]}}if(!b&&c&&c.hasOwnProperty&&c.hasOwnProperty("toString")&&!d.hasOwnProperty("toString")){d.toString=c.toString}return d};OpenLayers.Util.getParameterString=function(h){var g=[];for(var c in h){var e=h[c];if((e!=null)&&(typeof e!="function")){var b;if(typeof e=="object"&&e.constructor==Array){var f=[];for(var d=0,a=e.length;d<a;d++){f.push(encodeURIComponent(e[d]))}b=f.join(",")}else{b=encodeURIComponent(e)}g.push(encodeURIComponent(c)+"="+b)}}return g.join("&")};OpenLayers.ImgPath="";OpenLayers.Util.getImagesLocation=function(){return OpenLayers.ImgPath||(OpenLayers._getScriptLocation()+"img/")};OpenLayers.Util.Try=function(){var d=null;for(var c=0,a=arguments.length;c<a;c++){var b=arguments[c];try{d=b();break}catch(f){}}return d};OpenLayers.Util.getNodes=function(c,b){var a=OpenLayers.Util.Try(function(){return OpenLayers.Util._getNodes(c.documentElement.childNodes,b)},function(){return OpenLayers.Util._getNodes(c.childNodes,b)});return a};OpenLayers.Util._getNodes=function(c,e){var b=[];for(var d=0,a=c.length;d<a;d++){if(c[d].nodeName==e){b.push(c[d])}}return b};OpenLayers.Util.getTagText=function(c,d,b){var a=OpenLayers.Util.getNodes(c,d);if(a&&(a.length>0)){if(!b){b=0}if(a[b].childNodes.length>1){return a.childNodes[1].nodeValue}else{if(a[b].childNodes.length==1){return a[b].firstChild.nodeValue}}}else{return""}};OpenLayers.Util.getXmlNodeValue=function(a){var b=null;OpenLayers.Util.Try(function(){b=a.text;if(!b){b=a.textContent}if(!b){b=a.firstChild.nodeValue}},function(){b=a.textContent});return b};OpenLayers.Util.mouseLeft=function(a,c){var b=(a.relatedTarget)?a.relatedTarget:a.toElement;while(b!=c&&b!=null){b=b.parentNode}return(b!=c)};OpenLayers.Util.DEFAULT_PRECISION=14;OpenLayers.Util.toFloat=function(b,a){if(a==null){a=OpenLayers.Util.DEFAULT_PRECISION}var b;if(a==0){b=parseFloat(b)}else{b=parseFloat(parseFloat(b).toPrecision(a))}return b};OpenLayers.Util.rad=function(a){return a*Math.PI/180};OpenLayers.Util.distVincenty=function(g,c){var Q=6378137,P=6356752.3142,K=1/298.257223563;var p=OpenLayers.Util.rad(c.lon-g.lon);var O=Math.atan((1-K)*Math.tan(OpenLayers.Util.rad(g.lat)));var N=Math.atan((1-K)*Math.tan(OpenLayers.Util.rad(c.lat)));var o=Math.sin(O),k=Math.cos(O);var m=Math.sin(N),h=Math.cos(N);var u=p,q=2*Math.PI;var t=20;while(Math.abs(u-q)>1e-12&&--t>0){var G=Math.sin(u),e=Math.cos(u);var R=Math.sqrt((h*G)*(h*G)+(k*m-o*h*e)*(k*m-o*h*e));if(R==0){return 0}var I=o*m+k*h*e;var F=Math.atan2(R,I);var l=Math.asin(k*h*G/R);var J=Math.cos(l)*Math.cos(l);var r=I-2*o*m/J;var z=K/16*J*(4+K*(4-3*J));q=u;u=p+(1-z)*K*Math.sin(l)*(F+z*R*(r+z*I*(-1+2*r*r)))}if(t==0){return NaN}var w=J*(Q*Q-P*P)/(P*P);var E=1+w/16384*(4096+w*(-768+w*(320-175*w)));var D=w/1024*(256+w*(-128+w*(74-47*w)));var H=D*R*(r+D/4*(I*(-1+2*r*r)-D/6*r*(-3+4*R*R)*(-3+4*r*r)));var v=P*E*(F-H);var M=v.toFixed(3)/1000;return M};OpenLayers.Util.getParameters=function(b){b=b||window.location.href;var a="";if(OpenLayers.String.contains(b,"?")){var c=b.indexOf("?")+1;var e=OpenLayers.String.contains(b,"#")?b.indexOf("#"):b.length;a=b.substring(c,e)}var p={};var d=a.split(/[&;]/);for(var h=0,k=d.length;h<k;++h){var g=d[h].split("=");if(g[0]){var m=decodeURIComponent(g[0]);var l=g[1]||"";l=l.split(",");for(var f=0,o=l.length;f<o;f++){l[f]=decodeURIComponent(l[f])}if(l.length==1){l=l[0]}p[m]=l}}return p};OpenLayers.Util.getArgs=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Util.getParameters"}));return OpenLayers.Util.getParameters(a)};OpenLayers.Util.lastSeqID=0;OpenLayers.Util.createUniqueID=function(a){if(a==null){a="id_"}OpenLayers.Util.lastSeqID+=1;return a+OpenLayers.Util.lastSeqID};OpenLayers.INCHES_PER_UNIT={inches:1,ft:12,mi:63360,m:39.3701,km:39370.1,dd:4374754,yd:36};OpenLayers.INCHES_PER_UNIT["in"]=OpenLayers.INCHES_PER_UNIT.inches;OpenLayers.INCHES_PER_UNIT.degrees=OpenLayers.INCHES_PER_UNIT.dd;OpenLayers.INCHES_PER_UNIT.nmi=1852*OpenLayers.INCHES_PER_UNIT.m;OpenLayers.METERS_PER_INCH=0.0254000508001016;OpenLayers.Util.extend(OpenLayers.INCHES_PER_UNIT,{Inch:OpenLayers.INCHES_PER_UNIT.inches,Meter:1/OpenLayers.METERS_PER_INCH,Foot:0.3048006096012192/OpenLayers.METERS_PER_INCH,IFoot:0.3048/OpenLayers.METERS_PER_INCH,ClarkeFoot:0.3047972651151/OpenLayers.METERS_PER_INCH,SearsFoot:0.30479947153867626/OpenLayers.METERS_PER_INCH,GoldCoastFoot:0.3047997101815088/OpenLayers.METERS_PER_INCH,IInch:0.0254/OpenLayers.METERS_PER_INCH,MicroInch:0.0000254/OpenLayers.METERS_PER_INCH,Mil:2.54e-8/OpenLayers.METERS_PER_INCH,Centimeter:0.01/OpenLayers.METERS_PER_INCH,Kilometer:1000/OpenLayers.METERS_PER_INCH,Yard:0.9144018288036576/OpenLayers.METERS_PER_INCH,SearsYard:0.914398414616029/OpenLayers.METERS_PER_INCH,IndianYard:0.9143985307444408/OpenLayers.METERS_PER_INCH,IndianYd37:0.91439523/OpenLayers.METERS_PER_INCH,IndianYd62:0.9143988/OpenLayers.METERS_PER_INCH,IndianYd75:0.9143985/OpenLayers.METERS_PER_INCH,IndianFoot:0.30479951/OpenLayers.METERS_PER_INCH,IndianFt37:0.30479841/OpenLayers.METERS_PER_INCH,IndianFt62:0.3047996/OpenLayers.METERS_PER_INCH,IndianFt75:0.3047995/OpenLayers.METERS_PER_INCH,Mile:1609.3472186944373/OpenLayers.METERS_PER_INCH,IYard:0.9144/OpenLayers.METERS_PER_INCH,IMile:1609.344/OpenLayers.METERS_PER_INCH,NautM:1852/OpenLayers.METERS_PER_INCH,"Lat-66":110943.31648893273/OpenLayers.METERS_PER_INCH,"Lat-83":110946.25736872235/OpenLayers.METERS_PER_INCH,Decimeter:0.1/OpenLayers.METERS_PER_INCH,Millimeter:0.001/OpenLayers.METERS_PER_INCH,Dekameter:10/OpenLayers.METERS_PER_INCH,Decameter:10/OpenLayers.METERS_PER_INCH,Hectometer:100/OpenLayers.METERS_PER_INCH,GermanMeter:1.0000135965/OpenLayers.METERS_PER_INCH,CaGrid:0.999738/OpenLayers.METERS_PER_INCH,ClarkeChain:20.1166194976/OpenLayers.METERS_PER_INCH,GunterChain:20.11684023368047/OpenLayers.METERS_PER_INCH,BenoitChain:20.116782494375872/OpenLayers.METERS_PER_INCH,SearsChain:20.11676512155/OpenLayers.METERS_PER_INCH,ClarkeLink:0.201166194976/OpenLayers.METERS_PER_INCH,GunterLink:0.2011684023368047/OpenLayers.METERS_PER_INCH,BenoitLink:0.20116782494375873/OpenLayers.METERS_PER_INCH,SearsLink:0.2011676512155/OpenLayers.METERS_PER_INCH,Rod:5.02921005842012/OpenLayers.METERS_PER_INCH,IntnlChain:20.1168/OpenLayers.METERS_PER_INCH,IntnlLink:0.201168/OpenLayers.METERS_PER_INCH,Perch:5.02921005842012/OpenLayers.METERS_PER_INCH,Pole:5.02921005842012/OpenLayers.METERS_PER_INCH,Furlong:201.1684023368046/OpenLayers.METERS_PER_INCH,Rood:3.778266898/OpenLayers.METERS_PER_INCH,CapeFoot:0.3047972615/OpenLayers.METERS_PER_INCH,Brealey:375/OpenLayers.METERS_PER_INCH,ModAmFt:0.304812252984506/OpenLayers.METERS_PER_INCH,Fathom:1.8288/OpenLayers.METERS_PER_INCH,"NautM-UK":1853.184/OpenLayers.METERS_PER_INCH,"50kilometers":50000/OpenLayers.METERS_PER_INCH,"150kilometers":150000/OpenLayers.METERS_PER_INCH});OpenLayers.Util.extend(OpenLayers.INCHES_PER_UNIT,{mm:OpenLayers.INCHES_PER_UNIT.Meter/1000,cm:OpenLayers.INCHES_PER_UNIT.Meter/100,dm:OpenLayers.INCHES_PER_UNIT.Meter*100,km:OpenLayers.INCHES_PER_UNIT.Meter*1000,kmi:OpenLayers.INCHES_PER_UNIT.nmi,fath:OpenLayers.INCHES_PER_UNIT.Fathom,ch:OpenLayers.INCHES_PER_UNIT.IntnlChain,link:OpenLayers.INCHES_PER_UNIT.IntnlLink,"us-in":OpenLayers.INCHES_PER_UNIT.inches,"us-ft":OpenLayers.INCHES_PER_UNIT.Foot,"us-yd":OpenLayers.INCHES_PER_UNIT.Yard,"us-ch":OpenLayers.INCHES_PER_UNIT.GunterChain,"us-mi":OpenLayers.INCHES_PER_UNIT.Mile,"ind-yd":OpenLayers.INCHES_PER_UNIT.IndianYd37,"ind-ft":OpenLayers.INCHES_PER_UNIT.IndianFt37,"ind-ch":20.11669506/OpenLayers.METERS_PER_INCH});OpenLayers.DOTS_PER_INCH=72;OpenLayers.Util.normalizeScale=function(b){var a=(b>1)?(1/b):b;return a};OpenLayers.Util.getResolutionFromScale=function(d,a){if(a==null){a="degrees"}var c=OpenLayers.Util.normalizeScale(d);var b=1/(c*OpenLayers.INCHES_PER_UNIT[a]*OpenLayers.DOTS_PER_INCH);return b};OpenLayers.Util.getScaleFromResolution=function(b,a){if(a==null){a="degrees"}var c=b*OpenLayers.INCHES_PER_UNIT[a]*OpenLayers.DOTS_PER_INCH;return c};OpenLayers.Util.safeStopPropagation=function(a){OpenLayers.Event.stop(a,true)};OpenLayers.Util.pagePosition=function(f){var a=0,d=0;var b=f;var g=f;while(b){if(b==document.body){if(OpenLayers.Element.getStyle(g,"position")=="absolute"){break}}a+=b.offsetTop||0;d+=b.offsetLeft||0;g=b;try{b=b.offsetParent}catch(c){OpenLayers.Console.error(OpenLayers.i18n("pagePositionFailed",{elemId:b.id}));break}}b=f;while(b){a-=b.scrollTop||0;d-=b.scrollLeft||0;b=b.parentNode}return[d,a]};OpenLayers.Util.isEquivalentUrl=function(f,e,c){c=c||{};OpenLayers.Util.applyDefaults(c,{ignoreCase:true,ignorePort80:true,ignoreHash:true});var b=OpenLayers.Util.createUrlObject(f,c);var a=OpenLayers.Util.createUrlObject(e,c);for(var d in b){if(d!=="args"){if(b[d]!=a[d]){return false}}}for(var d in b.args){if(b.args[d]!=a.args[d]){return false}delete a.args[d]}for(var d in a.args){return false}return true};OpenLayers.Util.createUrlObject=function(c,m){m=m||{};if(!(/^\w+:\/\//).test(c)){var g=window.location;var e=g.port?":"+g.port:"";var h=g.protocol+"//"+g.host.split(":").shift()+e;if(c.indexOf("/")===0){c=h+c}else{var f=g.pathname.split("/");f.pop();c=h+f.join("/")+"/"+c}}if(m.ignoreCase){c=c.toLowerCase()}var k=document.createElement("a");k.href=c;var d={};d.host=k.host.split(":").shift();d.protocol=k.protocol;if(m.ignorePort80){d.port=(k.port=="80"||k.port=="0")?"":k.port}else{d.port=(k.port==""||k.port=="0")?"80":k.port}d.hash=(m.ignoreHash||k.hash==="#")?"":k.hash;var b=k.search;if(!b){var l=c.indexOf("?");b=(l!=-1)?c.substr(l):""}d.args=OpenLayers.Util.getParameters(b);d.pathname=(k.pathname.charAt(0)=="/")?k.pathname:"/"+k.pathname;return d};OpenLayers.Util.removeTail=function(b){var c=null;var a=b.indexOf("?");var d=b.indexOf("#");if(a==-1){c=(d!=-1)?b.substr(0,d):b}else{c=(d!=-1)?b.substr(0,Math.min(a,d)):b.substr(0,a)}return c};OpenLayers.Util.getBrowserName=function(){var b="";var a=navigator.userAgent.toLowerCase();if(a.indexOf("opera")!=-1){b="opera"}else{if(a.indexOf("msie")!=-1){b="msie"}else{if(a.indexOf("safari")!=-1){b="safari"}else{if(a.indexOf("mozilla")!=-1){if(a.indexOf("firefox")!=-1){b="firefox"}else{b="mozilla"}}}}}return b};OpenLayers.Util.getRenderedDimensions=function(b,q,r){var m,e;var a=document.createElement("div");a.style.visibility="hidden";var p=(r&&r.containerElement)?r.containerElement:document.body;if(q){if(q.w){m=q.w;a.style.width=m+"px"}else{if(q.h){e=q.h;a.style.height=e+"px"}}}if(r&&r.displayClass){a.className=r.displayClass}var f=document.createElement("div");f.innerHTML=b;f.style.overflow="visible";if(f.childNodes){for(var d=0,c=f.childNodes.length;d<c;d++){if(!f.childNodes[d].style){continue}f.childNodes[d].style.overflow="visible"}}a.appendChild(f);p.appendChild(a);var o=false;var k=a.parentNode;while(k&&k.tagName.toLowerCase()!="body"){var g=OpenLayers.Element.getStyle(k,"position");if(g=="absolute"){o=true;break}else{if(g&&g!="static"){break}}k=k.parentNode}if(!o){a.style.position="absolute"}if(!m){m=parseInt(f.scrollWidth);a.style.width=m+"px"}if(!e){e=parseInt(f.scrollHeight)}a.removeChild(f);p.removeChild(a);return new OpenLayers.Size(m,e)};OpenLayers.Util.getScrollbarWidth=function(){var c=OpenLayers.Util._scrollbarWidth;if(c==null){var e=null;var d=null;var a=0;var b=0;e=document.createElement("div");e.style.position="absolute";e.style.top="-1000px";e.style.left="-1000px";e.style.width="100px";e.style.height="50px";e.style.overflow="hidden";d=document.createElement("div");d.style.width="100%";d.style.height="200px";e.appendChild(d);document.body.appendChild(e);a=d.offsetWidth;e.style.overflow="scroll";b=d.offsetWidth;document.body.removeChild(document.body.lastChild);OpenLayers.Util._scrollbarWidth=(a-b);c=OpenLayers.Util._scrollbarWidth}return c};OpenLayers.Rico=new Object();OpenLayers.Rico.Corner={round:function(d,b){d=OpenLayers.Util.getElement(d);this._setOptions(b);var a=this.options.color;if(this.options.color=="fromElement"){a=this._background(d)}var c=this.options.bgColor;if(this.options.bgColor=="fromParent"){c=this._background(d.offsetParent)}this._roundCornersImpl(d,a,c)},changeColor:function(c,b){c.style.backgroundColor=b;var a=c.parentNode.getElementsByTagName("span");for(var d=0;d<a.length;d++){a[d].style.backgroundColor=b}},changeOpacity:function(c,f){var d=f;var a="alpha(opacity="+f*100+")";c.style.opacity=d;c.style.filter=a;var b=c.parentNode.getElementsByTagName("span");for(var e=0;e<b.length;e++){b[e].style.opacity=d;b[e].style.filter=a}},reRound:function(d,c){var b=d.parentNode.childNodes[0];var a=d.parentNode.childNodes[2];d.parentNode.removeChild(b);d.parentNode.removeChild(a);this.round(d.parentNode,c)},_roundCornersImpl:function(c,a,b){if(this.options.border){this._renderBorder(c,b)}if(this._isTopRounded()){this._roundTopCorners(c,a,b)}if(this._isBottomRounded()){this._roundBottomCorners(c,a,b)}},_renderBorder:function(d,e){var b="1px solid "+this._borderColor(e);var a="border-left: "+b;var f="border-right: "+b;var c="style='"+a+";"+f+"'";d.innerHTML="<div "+c+">"+d.innerHTML+"</div>"},_roundTopCorners:function(c,a,e){var d=this._createCorner(e);for(var b=0;b<this.options.numSlices;b++){d.appendChild(this._createCornerSlice(a,e,b,"top"))}c.style.paddingTop=0;c.insertBefore(d,c.firstChild)},_roundBottomCorners:function(c,a,e){var d=this._createCorner(e);for(var b=(this.options.numSlices-1);b>=0;b--){d.appendChild(this._createCornerSlice(a,e,b,"bottom"))}c.style.paddingBottom=0;c.appendChild(d)},_createCorner:function(b){var a=document.createElement("div");a.style.backgroundColor=(this._isTransparent()?"transparent":b);return a},_createCornerSlice:function(c,d,g,a){var e=document.createElement("span");var b=e.style;b.backgroundColor=c;b.display="block";b.height="1px";b.overflow="hidden";b.fontSize="1px";var f=this._borderColor(c,d);if(this.options.border&&g==0){b.borderTopStyle="solid";b.borderTopWidth="1px";b.borderLeftWidth="0px";b.borderRightWidth="0px";b.borderBottomWidth="0px";b.height="0px";b.borderColor=f}else{if(f){b.borderColor=f;b.borderStyle="solid";b.borderWidth="0px 1px"}}if(!this.options.compact&&(g==(this.options.numSlices-1))){b.height="2px"}this._setMargin(e,g,a);this._setBorder(e,g,a);return e},_setOptions:function(a){this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:true,border:false,compact:false};OpenLayers.Util.extend(this.options,a||{});this.options.numSlices=this.options.compact?2:4;if(this._isTransparent()){this.options.blend=false}},_whichSideTop:function(){if(this._hasString(this.options.corners,"all","top")){return""}if(this.options.corners.indexOf("tl")>=0&&this.options.corners.indexOf("tr")>=0){return""}if(this.options.corners.indexOf("tl")>=0){return"left"}else{if(this.options.corners.indexOf("tr")>=0){return"right"}}return""},_whichSideBottom:function(){if(this._hasString(this.options.corners,"all","bottom")){return""}if(this.options.corners.indexOf("bl")>=0&&this.options.corners.indexOf("br")>=0){return""}if(this.options.corners.indexOf("bl")>=0){return"left"}else{if(this.options.corners.indexOf("br")>=0){return"right"}}return""},_borderColor:function(a,b){if(a=="transparent"){return b}else{if(this.options.border){return this.options.border}else{if(this.options.blend){return this._blend(b,a)}else{return""}}}},_setMargin:function(d,e,b){var c=this._marginSize(e);var a=b=="top"?this._whichSideTop():this._whichSideBottom();if(a=="left"){d.style.marginLeft=c+"px";d.style.marginRight="0px"}else{if(a=="right"){d.style.marginRight=c+"px";d.style.marginLeft="0px"}else{d.style.marginLeft=c+"px";d.style.marginRight=c+"px"}}},_setBorder:function(d,e,b){var c=this._borderSize(e);var a=b=="top"?this._whichSideTop():this._whichSideBottom();if(a=="left"){d.style.borderLeftWidth=c+"px";d.style.borderRightWidth="0px"}else{if(a=="right"){d.style.borderRightWidth=c+"px";d.style.borderLeftWidth="0px"}else{d.style.borderLeftWidth=c+"px";d.style.borderRightWidth=c+"px"}}if(this.options.border!=false){d.style.borderLeftWidth=c+"px";d.style.borderRightWidth=c+"px"}},_marginSize:function(e){if(this._isTransparent()){return 0}var d=[5,3,2,1];var a=[3,2,1,0];var c=[2,1];var b=[1,0];if(this.options.compact&&this.options.blend){return b[e]}else{if(this.options.compact){return c[e]}else{if(this.options.blend){return a[e]}else{return d[e]}}}},_borderSize:function(e){var d=[5,3,2,1];var b=[2,1,1,1];var a=[1,0];var c=[0,2,0,0];if(this.options.compact&&(this.options.blend||this._isTransparent())){return 1}else{if(this.options.compact){return a[e]}else{if(this.options.blend){return b[e]}else{if(this.options.border){return c[e]}else{if(this._isTransparent()){return d[e]}}}}}return 0},_hasString:function(b){for(var a=1;a<arguments.length;a++){if(b.indexOf(arguments[a])>=0){return true}}return false},_blend:function(c,a){var b=OpenLayers.Rico.Color.createFromHex(c);b.blend(OpenLayers.Rico.Color.createFromHex(a));return b},_background:function(a){try{return OpenLayers.Rico.Color.createColorFromBackground(a).asHex()}catch(b){return"#ffffff"}},_isTransparent:function(){return this.options.color=="transparent"},_isTopRounded:function(){return this._hasString(this.options.corners,"all","top","tl","tr")},_isBottomRounded:function(){return this._hasString(this.options.corners,"all","bottom","bl","br")},_hasSingleTextChild:function(a){return a.childNodes.length==1&&a.childNodes[0].nodeType==3}};OpenLayers.Element={visible:function(a){return OpenLayers.Util.getElement(a).style.display!="none"},toggle:function(){for(var c=0,a=arguments.length;c<a;c++){var b=OpenLayers.Util.getElement(arguments[c]);var d=OpenLayers.Element.visible(b)?"hide":"show";OpenLayers.Element[d](b)}},hide:function(){for(var c=0,a=arguments.length;c<a;c++){var b=OpenLayers.Util.getElement(arguments[c]);b.style.display="none"}},show:function(){for(var c=0,a=arguments.length;c<a;c++){var b=OpenLayers.Util.getElement(arguments[c]);b.style.display=""}},remove:function(a){a=OpenLayers.Util.getElement(a);a.parentNode.removeChild(a)},getHeight:function(a){a=OpenLayers.Util.getElement(a);return a.offsetHeight},getDimensions:function(b){b=OpenLayers.Util.getElement(b);if(OpenLayers.Element.getStyle(b,"display")!="none"){return{width:b.offsetWidth,height:b.offsetHeight}}var a=b.style;var e=a.visibility;var c=a.position;a.visibility="hidden";a.position="absolute";a.display="";var f=b.clientWidth;var d=b.clientHeight;a.display="none";a.position=c;a.visibility=e;return{width:f,height:d}},hasClass:function(b,a){var c=b.className;return(!!c&&new RegExp("(^|\\s)"+a+"(\\s|$)").test(c))},addClass:function(b,a){if(!OpenLayers.Element.hasClass(b,a)){b.className+=(b.className?" ":"")+a}return b},removeClass:function(b,a){var c=b.className;if(c){b.className=OpenLayers.String.trim(c.replace(new RegExp("(^|\\s+)"+a+"(\\s+|$)")," "))}return b},toggleClass:function(b,a){if(OpenLayers.Element.hasClass(b,a)){OpenLayers.Element.removeClass(b,a)}else{OpenLayers.Element.addClass(b,a)}return b},getStyle:function(c,d){c=OpenLayers.Util.getElement(c);var e=null;if(c&&c.style){e=c.style[OpenLayers.String.camelize(d)];if(!e){if(document.defaultView&&document.defaultView.getComputedStyle){var b=document.defaultView.getComputedStyle(c,null);e=b?b.getPropertyValue(d):null}else{if(c.currentStyle){e=c.currentStyle[OpenLayers.String.camelize(d)]}}}var a=["left","top","right","bottom"];if(window.opera&&(OpenLayers.Util.indexOf(a,d)!=-1)&&(OpenLayers.Element.getStyle(c,"position")=="static")){e="auto"}}return e=="auto"?null:e}};OpenLayers.Size=OpenLayers.Class({w:0,h:0,initialize:function(a,b){this.w=parseFloat(a);this.h=parseFloat(b)},toString:function(){return("w="+this.w+",h="+this.h)},clone:function(){return new OpenLayers.Size(this.w,this.h)},equals:function(b){var a=false;if(b!=null){a=((this.w==b.w&&this.h==b.h)||(isNaN(this.w)&&isNaN(this.h)&&isNaN(b.w)&&isNaN(b.h)))}return a},CLASS_NAME:"OpenLayers.Size"});OpenLayers.Console={log:function(){},debug:function(){},info:function(){},warn:function(){},error:function(){},userError:function(a){alert(a)},assert:function(){},dir:function(){},dirxml:function(){},trace:function(){},group:function(){},groupEnd:function(){},time:function(){},timeEnd:function(){},profile:function(){},profileEnd:function(){},count:function(){},CLASS_NAME:"OpenLayers.Console"};(function(){var b=document.getElementsByTagName("script");for(var c=0,a=b.length;c<a;++c){if(b[c].src.indexOf("firebug.js")!=-1){if(console){OpenLayers.Util.extend(OpenLayers.Console,console);break}}}})();OpenLayers.Icon=OpenLayers.Class({url:null,size:null,offset:null,calculateOffset:null,imageDiv:null,px:null,initialize:function(a,b,d,c){this.url=a;this.size=(b)?b:new OpenLayers.Size(20,20);this.offset=d?d:new OpenLayers.Pixel(-(this.size.w/2),-(this.size.h/2));this.calculateOffset=c;var e=OpenLayers.Util.createUniqueID("OL_Icon_");this.imageDiv=OpenLayers.Util.createCssSpriteDiv(e)},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.modifyCssSpriteDiv(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.modifyCssSpriteDiv(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.modifyCssSpriteDiv(this.imageDiv,null,b)}}},display:function(a){this.imageDiv.style.display=(a)?"":"none"},isDrawn:function(){var a=(this.imageDiv&&this.imageDiv.parentNode&&(this.imageDiv.parentNode.nodeType!=11));return a},CLASS_NAME:"OpenLayers.Icon"});OpenLayers.Popup=OpenLayers.Class({events:null,id:"",lonlat:null,div:null,contentSize:null,size:null,contentHTML:null,backgroundColor:"",opacity:"",border:"",contentDiv:null,groupDiv:null,closeDiv:null,autoSize:false,minSize:null,maxSize:null,displayClass:"olPopup",contentDisplayClass:"olPopupContent",padding:0,disableFirefoxOverflowHack:false,fixPadding:function(){if(typeof this.padding=="number"){this.padding=new OpenLayers.Bounds(this.padding,this.padding,this.padding,this.padding)}},panMapIfOutOfView:false,keepInMap:false,closeOnMove:false,map:null,initialize:function(g,c,f,b,e,d){if(g==null){g=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")}this.id=g;this.lonlat=c;this.contentSize=(f!=null)?f: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 g=this.div.id+"_contentDiv";this.contentDiv=OpenLayers.Util.createDiv(g,null,this.contentSize.clone(),null,"relative");this.contentDiv.className=this.contentDisplayClass;this.groupDiv.appendChild(this.contentDiv);this.div.appendChild(this.groupDiv);if(e){this.addCloseBox(d)}this.registerEvents()},destroy:function(){this.id=null;this.lonlat=null;this.size=null;this.contentHTML=null;this.backgroundColor=null;this.opacity=null;this.border=null;if(this.closeOnMove&&this.map){this.map.events.unregister("movestart",this,this.hide)}this.events.destroy();this.events=null;if(this.closeDiv){OpenLayers.Event.stopObservingElement(this.closeDiv);this.groupDiv.removeChild(this.closeDiv)}this.closeDiv=null;this.div.removeChild(this.groupDiv);this.groupDiv=null;if(this.map!=null){this.map.removePopup(this)}this.map=null;this.div=null;this.autoSize=null;this.minSize=null;this.maxSize=null;this.padding=null;this.panMapIfOutOfView=null},draw:function(a){if(a==null){if((this.lonlat!=null)&&(this.map!=null)){a=this.map.getLayerPxFromLonLat(this.lonlat)}}if(this.closeOnMove){this.map.events.register("movestart",this,this.hide)}if(!this.disableFirefoxOverflowHack&&OpenLayers.Util.getBrowserName()=="firefox"){this.map.events.register("movestart",this,function(){var b=document.defaultView.getComputedStyle(this.contentDiv,null);var c=b.getPropertyValue("overflow");if(c!="hidden"){this.contentDiv._oldOverflow=c;this.contentDiv.style.overflow="hidden"}});this.map.events.register("moveend",this,function(){var b=this.contentDiv._oldOverflow;if(b){this.contentDiv.style.overflow=b;this.contentDiv._oldOverflow=null}})}this.moveTo(a);if(!this.autoSize&&!this.size){this.setSize(this.contentSize)}this.setBackgroundColor();this.setOpacity();this.setBorder();this.setContentHTML();if(this.panMapIfOutOfView){this.panIntoView()}return this.div},updatePosition:function(){if((this.lonlat)&&(this.map)){var a=this.map.getLayerPxFromLonLat(this.lonlat);if(a){this.moveTo(a)}}},moveTo:function(a){if((a!=null)&&(this.div!=null)){this.div.style.left=a.x+"px";this.div.style.top=a.y+"px"}},visible:function(){return OpenLayers.Element.visible(this.div)},toggle:function(){if(this.visible()){this.hide()}else{this.show()}},show:function(){OpenLayers.Element.show(this.div);if(this.panMapIfOutOfView){this.panIntoView()}},hide:function(){OpenLayers.Element.hide(this.div)},setSize:function(c){this.size=c.clone();var b=this.getContentDivPadding();var a=b.left+b.right;var e=b.top+b.bottom;this.fixPadding();a+=this.padding.left+this.padding.right;e+=this.padding.top+this.padding.bottom;if(this.closeDiv){var d=parseInt(this.closeDiv.style.width);a+=d+b.right}this.size.w+=a;this.size.h+=e;if(OpenLayers.Util.getBrowserName()=="msie"){this.contentSize.w+=b.left+b.right;this.contentSize.h+=b.bottom+b.top}if(this.div!=null){this.div.style.width=this.size.w+"px";this.div.style.height=this.size.h+"px"}if(this.contentDiv!=null){this.contentDiv.style.width=c.w+"px";this.contentDiv.style.height=c.h+"px"}},updateSize:function(){var e="<div class='"+this.contentDisplayClass+"'>"+this.contentDiv.innerHTML+"</div>";var h=(this.map)?this.map.layerContainerDiv:document.body;var k=OpenLayers.Util.getRenderedDimensions(e,null,{displayClass:this.displayClass,containerElement:h});var g=this.getSafeContentSize(k);var f=null;if(g.equals(k)){f=k}else{var b=new OpenLayers.Size();b.w=(g.w<k.w)?g.w:null;b.h=(g.h<k.h)?g.h:null;if(b.w&&b.h){f=g}else{var d=OpenLayers.Util.getRenderedDimensions(e,b,{displayClass:this.contentDisplayClass,containerElement:h});var c=OpenLayers.Element.getStyle(this.contentDiv,"overflow");if((c!="hidden")&&(d.equals(g))){var a=OpenLayers.Util.getScrollbarWidth();if(b.w){d.h+=a}else{d.w+=a}}f=this.getSafeContentSize(d)}}this.setSize(f)},setBackgroundColor:function(a){if(a!=undefined){this.backgroundColor=a}if(this.div!=null){this.div.style.backgroundColor=this.backgroundColor}},setOpacity:function(a){if(a!=undefined){this.opacity=a}if(this.div!=null){this.div.style.opacity=this.opacity;this.div.style.filter="alpha(opacity="+this.opacity*100+")"}},setBorder:function(a){if(a!=undefined){this.border=a}if(this.div!=null){this.div.style.border=this.border}},setContentHTML:function(a){if(a!=null){this.contentHTML=a}if((this.contentDiv!=null)&&(this.contentHTML!=null)&&(this.contentHTML!=this.contentDiv.innerHTML)){this.contentDiv.innerHTML=this.contentHTML;if(this.autoSize){this.registerImageListeners();this.updateSize()}}},registerImageListeners:function(){var f=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 e=0,a=b.length;e<a;e++){var c=b[e];if(c.width==0||c.height==0){var d={popup:this,img:c};c._onImgLoad=OpenLayers.Function.bind(f,d);OpenLayers.Event.observe(c,"load",c._onImgLoad)}}},getSafeContentSize:function(m){var d=m.clone();var k=this.getContentDivPadding();var l=k.left+k.right;var g=k.top+k.bottom;this.fixPadding();l+=this.padding.left+this.padding.right;g+=this.padding.top+this.padding.bottom;if(this.closeDiv){var c=parseInt(this.closeDiv.style.width);l+=c+k.right}if(this.minSize){d.w=Math.max(d.w,(this.minSize.w-l));d.h=Math.max(d.h,(this.minSize.h-g))}if(this.maxSize){d.w=Math.min(d.w,(this.maxSize.w-l));d.h=Math.min(d.h,(this.maxSize.h-g))}if(this.map&&this.map.size){var f=0,e=0;if(this.keepInMap&&!this.panMapIfOutOfView){var h=this.map.getPixelFromLonLat(this.lonlat);switch(this.relativePosition){case"tr":f=h.x;e=this.map.size.h-h.y;break;case"tl":f=this.map.size.w-h.x;e=this.map.size.h-h.y;break;case"bl":f=this.map.size.w-h.x;e=h.y;break;case"br":f=h.x;e=h.y;break;default:f=h.x;e=this.map.size.h-h.y;break}}var a=this.map.size.h-this.map.paddingForPopups.top-this.map.paddingForPopups.bottom-g-e;var b=this.map.size.w-this.map.paddingForPopups.left-this.map.paddingForPopups.right-l-f;d.w=Math.min(d.w,b);d.h=Math.min(d.h,a)}return d},getContentDivPadding:function(){var a=this._contentDivPadding;if(!a){if(this.div.parentNode==null){this.div.style.display="none";document.body.appendChild(this.div)}a=new OpenLayers.Bounds(OpenLayers.Element.getStyle(this.contentDiv,"padding-left"),OpenLayers.Element.getStyle(this.contentDiv,"padding-bottom"),OpenLayers.Element.getStyle(this.contentDiv,"padding-right"),OpenLayers.Element.getStyle(this.contentDiv,"padding-top"));this._contentDivPadding=a;if(this.div.parentNode==document.body){document.body.removeChild(this.div);this.div.style.display=""}}return a},addCloseBox:function(c){this.closeDiv=OpenLayers.Util.createDiv(this.id+"_close",null,new OpenLayers.Size(17,17));this.closeDiv.className="olPopupCloseBox";var b=this.getContentDivPadding();this.closeDiv.style.right=b.right+"px";this.closeDiv.style.top=b.top+"px";this.groupDiv.appendChild(this.closeDiv);var a=c||function(d){this.hide();OpenLayers.Event.stop(d)};OpenLayers.Event.observe(this.closeDiv,"click",OpenLayers.Function.bindAsEventListener(a,this))},panIntoView:function(){var e=this.map.getSize();var d=this.map.getViewPortPxFromLayerPx(new OpenLayers.Pixel(parseInt(this.div.style.left),parseInt(this.div.style.top)));var c=d.clone();if(d.x<this.map.paddingForPopups.left){c.x=this.map.paddingForPopups.left}else{if((d.x+this.size.w)>(e.w-this.map.paddingForPopups.right)){c.x=e.w-this.map.paddingForPopups.right-this.size.w}}if(d.y<this.map.paddingForPopups.top){c.y=this.map.paddingForPopups.top}else{if((d.y+this.size.h)>(e.h-this.map.paddingForPopups.bottom)){c.y=e.h-this.map.paddingForPopups.bottom-this.size.h}}var b=d.x-c.x;var a=d.y-c.y;this.map.pan(b,a)},registerEvents:function(){this.events=new OpenLayers.Events(this,this.div,null,true);this.events.on({mousedown:this.onmousedown,mousemove:this.onmousemove,mouseup:this.onmouseup,click:this.onclick,mouseout:this.onmouseout,dblclick:this.ondblclick,scope:this})},onmousedown:function(a){this.mousedown=true;OpenLayers.Event.stop(a,true)},onmousemove:function(a){if(this.mousedown){OpenLayers.Event.stop(a,true)}},onmouseup:function(a){if(this.mousedown){this.mousedown=false;OpenLayers.Event.stop(a,true)}},onclick:function(a){OpenLayers.Event.stop(a,true)},onmouseout:function(a){this.mousedown=false},ondblclick:function(a){OpenLayers.Event.stop(a,true)},CLASS_NAME:"OpenLayers.Popup"});OpenLayers.Popup.WIDTH=200;OpenLayers.Popup.HEIGHT=200;OpenLayers.Popup.COLOR="white";OpenLayers.Popup.OPACITY=1;OpenLayers.Popup.BORDER="0px";OpenLayers.Renderer=OpenLayers.Class({container:null,root:null,extent:null,locked:false,size:null,resolution:null,map:null,initialize:function(a,b){this.container=OpenLayers.Util.getElement(a)},destroy:function(){this.container=null;this.extent=null;this.size=null;this.resolution=null;this.map=null},supported:function(){return false},setExtent:function(a,b){this.extent=a.clone();if(b){this.resolution=null}},setSize:function(a){this.size=a.clone();this.resolution=null},getResolution:function(){this.resolution=this.resolution||this.map.getResolution();return this.resolution},drawFeature:function(a,b){if(b==null){b=a.style}if(a.geometry){var c=a.geometry.getBounds();if(c){if(!c.intersectsBounds(this.extent)){b={display:"none"}}var d=this.drawGeometry(a.geometry,b,a.id);if(b.display!="none"&&b.label&&d!==false){this.drawText(a.id,b,a.geometry.getCentroid())}else{this.removeText(a.id)}return d}}},drawGeometry:function(c,a,b){},drawText:function(c,b,a){},removeText:function(a){},clear:function(){},getFeatureIdFromEvent:function(a){},eraseFeatures:function(c){if(!(c instanceof Array)){c=[c]}for(var b=0,a=c.length;b<a;++b){this.eraseGeometry(c[b].geometry);this.removeText(c[b].id)}},eraseGeometry:function(a){},moveRoot:function(a){},getRenderLayerId:function(){return this.container.id},CLASS_NAME:"OpenLayers.Renderer"});OpenLayers.Bounds=OpenLayers.Class({left:null,bottom:null,right:null,top:null,centerLonLat:null,initialize:function(d,a,b,c){if(d!=null){this.left=OpenLayers.Util.toFloat(d)}if(a!=null){this.bottom=OpenLayers.Util.toFloat(a)}if(b!=null){this.right=OpenLayers.Util.toFloat(b)}if(c!=null){this.top=OpenLayers.Util.toFloat(c)}},clone:function(){return new OpenLayers.Bounds(this.left,this.bottom,this.right,this.top)},equals:function(b){var a=false;if(b!=null){a=((this.left==b.left)&&(this.right==b.right)&&(this.top==b.top)&&(this.bottom==b.bottom))}return a},toString:function(){return("left-bottom=("+this.left+","+this.bottom+") right-top=("+this.right+","+this.top+")")},toArray:function(){return[this.left,this.bottom,this.right,this.top]},toBBOX:function(a){if(a==null){a=6}var b=Math.pow(10,a);var c=Math.round(this.left*b)/b+","+Math.round(this.bottom*b)/b+","+Math.round(this.right*b)/b+","+Math.round(this.top*b)/b;return c},toGeometry:function(){return new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(this.left,this.bottom),new OpenLayers.Geometry.Point(this.right,this.bottom),new OpenLayers.Geometry.Point(this.right,this.top),new OpenLayers.Geometry.Point(this.left,this.top)])])},getWidth:function(){return(this.right-this.left)},getHeight:function(){return(this.top-this.bottom)},getSize:function(){return new OpenLayers.Size(this.getWidth(),this.getHeight())},getCenterPixel:function(){return new OpenLayers.Pixel((this.left+this.right)/2,(this.bottom+this.top)/2)},getCenterLonLat:function(){if(!this.centerLonLat){this.centerLonLat=new OpenLayers.LonLat((this.left+this.right)/2,(this.bottom+this.top)/2)}return this.centerLonLat},scale:function(f,h){if(h==null){h=this.getCenterLonLat()}var a=[];var e,d;if(h.CLASS_NAME=="OpenLayers.LonLat"){e=h.lon;d=h.lat}else{e=h.x;d=h.y}var c=(this.left-e)*f+e;var b=(this.bottom-d)*f+d;var k=(this.right-e)*f+e;var g=(this.top-d)*f+d;return new OpenLayers.Bounds(c,b,k,g)},add:function(a,c){if((a==null)||(c==null)){var b=OpenLayers.i18n("boundsAddError");OpenLayers.Console.error(b);return null}return new OpenLayers.Bounds(this.left+a,this.bottom+c,this.right+a,this.top+c)},extend:function(a){var b=null;if(a){switch(a.CLASS_NAME){case"OpenLayers.LonLat":b=new OpenLayers.Bounds(a.lon,a.lat,a.lon,a.lat);break;case"OpenLayers.Geometry.Point":b=new OpenLayers.Bounds(a.x,a.y,a.x,a.y);break;case"OpenLayers.Bounds":b=a;break}if(b){this.centerLonLat=null;if((this.left==null)||(b.left<this.left)){this.left=b.left}if((this.bottom==null)||(b.bottom<this.bottom)){this.bottom=b.bottom}if((this.right==null)||(b.right>this.right)){this.right=b.right}if((this.top==null)||(b.top>this.top)){this.top=b.top}}}},containsLonLat:function(b,a){return this.contains(b.lon,b.lat,a)},containsPixel:function(b,a){return this.contains(b.x,b.y,a)},contains:function(b,d,a){if(a==null){a=true}if(b==null||d==null){return false}b=OpenLayers.Util.toFloat(b);d=OpenLayers.Util.toFloat(d);var c=false;if(a){c=((b>=this.left)&&(b<=this.right)&&(d>=this.bottom)&&(d<=this.top))}else{c=((b>this.left)&&(b<this.right)&&(d>this.bottom)&&(d<this.top))}return c},intersectsBounds:function(e,b){if(b==null){b=true}var d=false;var h=(this.left==e.right||this.right==e.left||this.top==e.bottom||this.bottom==e.top);if(b||!h){var g=(((e.bottom>=this.bottom)&&(e.bottom<=this.top))||((this.bottom>=e.bottom)&&(this.bottom<=e.top)));var f=(((e.top>=this.bottom)&&(e.top<=this.top))||((this.top>e.bottom)&&(this.top<e.top)));var c=(((e.left>=this.left)&&(e.left<=this.right))||((this.left>=e.left)&&(this.left<=e.right)));var a=(((e.right>=this.left)&&(e.right<=this.right))||((this.right>=e.left)&&(this.right<=e.right)));d=((g||f)&&(c||a))}return d},containsBounds:function(g,b,a){if(b==null){b=false}if(a==null){a=true}var c=this.contains(g.left,g.bottom,a);var d=this.contains(g.right,g.bottom,a);var f=this.contains(g.left,g.top,a);var e=this.contains(g.right,g.top,a);return(b)?(c||d||f||e):(c&&d&&f&&e)},determineQuadrant:function(c){var b="";var a=this.getCenterLonLat();b+=(c.lat<a.lat)?"b":"t";b+=(c.lon<a.lon)?"l":"r";return b},transform:function(d,b){this.centerLonLat=null;var e=OpenLayers.Projection.transform({x:this.left,y:this.bottom},d,b);var a=OpenLayers.Projection.transform({x:this.right,y:this.bottom},d,b);var c=OpenLayers.Projection.transform({x:this.left,y:this.top},d,b);var f=OpenLayers.Projection.transform({x:this.right,y:this.top},d,b);this.left=Math.min(e.x,c.x);this.bottom=Math.min(e.y,a.y);this.right=Math.max(a.x,f.x);this.top=Math.max(c.y,f.y);return this},wrapDateLine:function(a,c){c=c||{};var d=c.leftTolerance||0;var b=c.rightTolerance||0;var e=this.clone();if(a){while(e.left<a.left&&(e.right-b)<=a.left){e=e.add(a.getWidth(),0)}while((e.left+d)>=a.right&&e.right>a.right){e=e.add(-a.getWidth(),0)}}return e},CLASS_NAME:"OpenLayers.Bounds"});OpenLayers.Bounds.fromString=function(b){var a=b.split(",");return OpenLayers.Bounds.fromArray(a)};OpenLayers.Bounds.fromArray=function(a){return new OpenLayers.Bounds(parseFloat(a[0]),parseFloat(a[1]),parseFloat(a[2]),parseFloat(a[3]))};OpenLayers.Bounds.fromSize=function(a){return new OpenLayers.Bounds(0,a.h,a.w,0)};OpenLayers.Bounds.oppositeQuadrant=function(a){var b="";b+=(a.charAt(0)=="t")?"b":"t";b+=(a.charAt(1)=="l")?"r":"l";return b};OpenLayers.LonLat=OpenLayers.Class({lon:0,lat:0,initialize:function(b,a){this.lon=OpenLayers.Util.toFloat(b);this.lat=OpenLayers.Util.toFloat(a)},toString:function(){return("lon="+this.lon+",lat="+this.lat)},toShortString:function(){return(this.lon+", "+this.lat)},clone:function(){return new OpenLayers.LonLat(this.lon,this.lat)},add:function(c,a){if((c==null)||(a==null)){var b=OpenLayers.i18n("lonlatAddError");OpenLayers.Console.error(b);return null}return new OpenLayers.LonLat(this.lon+c,this.lat+a)},equals:function(b){var a=false;if(b!=null){a=((this.lon==b.lon&&this.lat==b.lat)||(isNaN(this.lon)&&isNaN(this.lat)&&isNaN(b.lon)&&isNaN(b.lat)))}return a},transform:function(c,b){var a=OpenLayers.Projection.transform({x:this.lon,y:this.lat},c,b);this.lon=a.x;this.lat=a.y;return this},wrapDateLine:function(a){var b=this.clone();if(a){while(b.lon<a.left){b.lon+=a.getWidth()}while(b.lon>a.right){b.lon-=a.getWidth()}}return b},CLASS_NAME:"OpenLayers.LonLat"});OpenLayers.LonLat.fromString=function(b){var a=b.split(",");return new OpenLayers.LonLat(parseFloat(a[0]),parseFloat(a[1]))};OpenLayers.Pixel=OpenLayers.Class({x:0,y:0,initialize:function(a,b){this.x=parseFloat(a);this.y=parseFloat(b)},toString:function(){return("x="+this.x+",y="+this.y)},clone:function(){return new OpenLayers.Pixel(this.x,this.y)},equals:function(a){var b=false;if(a!=null){b=((this.x==a.x&&this.y==a.y)||(isNaN(this.x)&&isNaN(this.y)&&isNaN(a.x)&&isNaN(a.y)))}return b},add:function(a,c){if((a==null)||(c==null)){var b=OpenLayers.i18n("pixelAddError");OpenLayers.Console.error(b);return null}return new OpenLayers.Pixel(this.x+a,this.y+c)},offset:function(a){var b=this.clone();if(a){b=this.add(a.x,a.y)}return b},CLASS_NAME:"OpenLayers.Pixel"});OpenLayers.Control=OpenLayers.Class({id:null,map:null,div:null,type:null,allowSelection:false,displayClass:"",title:"",active:null,handler:null,eventListeners:null,events:null,EVENT_TYPES:["activate","deactivate"],initialize:function(a){this.displayClass=this.CLASS_NAME.replace("OpenLayers.","ol").replace(/\./g,"");OpenLayers.Util.extend(this,a);this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES);if(this.eventListeners instanceof Object){this.events.on(this.eventListeners)}if(this.id==null){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")}},destroy:function(){if(this.events){if(this.eventListeners){this.events.un(this.eventListeners)}this.events.destroy();this.events=null}this.eventListeners=null;if(this.handler){this.handler.destroy();this.handler=null}if(this.handlers){for(var a in this.handlers){if(this.handlers.hasOwnProperty(a)&&typeof this.handlers[a].destroy=="function"){this.handlers[a].destroy()}}this.handlers=null}if(this.map){this.map.removeControl(this);this.map=null}},setMap:function(a){this.map=a;if(this.handler){this.handler.setMap(a)}},draw:function(a){if(this.div==null){this.div=OpenLayers.Util.createDiv(this.id);this.div.className=this.displayClass;if(!this.allowSelection){this.div.className+=" olControlNoSelect";this.div.setAttribute("unselectable","on",0);this.div.onselectstart=function(){return(false)}}if(this.title!=""){this.div.title=this.title}}if(a!=null){this.position=a.clone()}this.moveTo(this.position);return this.div},moveTo:function(a){if((a!=null)&&(this.div!=null)){this.div.style.left=a.x+"px";this.div.style.top=a.y+"px"}},activate:function(){if(this.active){return false}if(this.handler){this.handler.activate()}this.active=true;if(this.map){OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active")}this.events.triggerEvent("activate");return true},deactivate:function(){if(this.active){if(this.handler){this.handler.deactivate()}this.active=false;if(this.map){OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active")}this.events.triggerEvent("deactivate");return true}return false},CLASS_NAME:"OpenLayers.Control"});OpenLayers.Control.TYPE_BUTTON=1;OpenLayers.Control.TYPE_TOGGLE=2;OpenLayers.Control.TYPE_TOOL=3;OpenLayers.Lang={code:null,defaultCode:"en",getCode:function(){if(!OpenLayers.Lang.code){OpenLayers.Lang.setCode()}return OpenLayers.Lang.code},setCode:function(b){var d;if(!b){b=(OpenLayers.Util.getBrowserName()=="msie")?navigator.userLanguage:navigator.language}var c=b.split("-");c[0]=c[0].toLowerCase();if(typeof OpenLayers.Lang[c[0]]=="object"){d=c[0]}if(c[1]){var a=c[0]+"-"+c[1].toUpperCase();if(typeof OpenLayers.Lang[a]=="object"){d=a}}if(!d){OpenLayers.Console.warn("Failed to find OpenLayers.Lang."+c.join("-")+" dictionary, falling back to default language");d=OpenLayers.Lang.defaultCode}OpenLayers.Lang.code=d},translate:function(b,a){var d=OpenLayers.Lang[OpenLayers.Lang.getCode()];var c=d[b];if(!c){c=b}if(a){c=OpenLayers.String.format(c,a)}return c}};OpenLayers.i18n=OpenLayers.Lang.translate;OpenLayers.Popup.Anchored=OpenLayers.Class(OpenLayers.Popup,{relativePosition:null,keepInMap:true,anchor:null,initialize:function(h,d,g,c,b,f,e){var a=[h,d,g,c,f,e];OpenLayers.Popup.prototype.initialize.apply(this,a);this.anchor=(b!=null)?b:{size:new OpenLayers.Size(0,0),offset:new OpenLayers.Pixel(0,0)}},destroy:function(){this.anchor=null;this.relativePosition=null;OpenLayers.Popup.prototype.destroy.apply(this,arguments)},show:function(){this.updatePosition();OpenLayers.Popup.prototype.show.apply(this,arguments)},moveTo:function(c){var b=this.relativePosition;this.relativePosition=this.calculateRelativePosition(c);var d=this.calculateNewPx(c);var a=new Array(d);OpenLayers.Popup.prototype.moveTo.apply(this,a);if(this.relativePosition!=b){this.updateRelativePosition()}},setSize:function(b){OpenLayers.Popup.prototype.setSize.apply(this,arguments);if((this.lonlat)&&(this.map)){var a=this.map.getLayerPxFromLonLat(this.lonlat);this.moveTo(a)}},calculateRelativePosition:function(b){var d=this.map.getLonLatFromLayerPx(b);var c=this.map.getExtent();var a=c.determineQuadrant(d);return OpenLayers.Bounds.oppositeQuadrant(a)},updateRelativePosition:function(){},calculateNewPx:function(b){var e=b.offset(this.anchor.offset);var a=this.size||this.contentSize;var d=(this.relativePosition.charAt(0)=="t");e.y+=(d)?-a.h:this.anchor.size.h;var c=(this.relativePosition.charAt(1)=="l");e.x+=(c)?-a.w:this.anchor.size.w;return e},CLASS_NAME:"OpenLayers.Popup.Anchored"});OpenLayers.Renderer.Canvas=OpenLayers.Class(OpenLayers.Renderer,{canvas:null,features:null,geometryMap:null,initialize:function(a){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.root=document.createElement("canvas");this.container.appendChild(this.root);this.canvas=this.root.getContext("2d");this.features={};this.geometryMap={}},eraseGeometry:function(a){this.eraseFeatures(this.features[this.geometryMap[a.id]][0])},supported:function(){var a=document.createElement("canvas");return !!a.getContext},setExtent:function(a){this.extent=a.clone();this.resolution=null;this.redraw()},setSize:function(a){this.size=a.clone();this.root.style.width=a.w+"px";this.root.style.height=a.h+"px";this.root.width=a.w;this.root.height=a.h;this.resolution=null},drawFeature:function(a,b){if(b==null){b=a.style}b=OpenLayers.Util.extend({fillColor:"#000000",strokeColor:"#000000",strokeWidth:2,fillOpacity:1,strokeOpacity:1},b);this.features[a.id]=[a,b];if(a.geometry){this.geometryMap[a.geometry.id]=a.id}this.redraw()},drawGeometry:function(d,c){var b=d.CLASS_NAME;if((b=="OpenLayers.Geometry.Collection")||(b=="OpenLayers.Geometry.MultiPoint")||(b=="OpenLayers.Geometry.MultiLineString")||(b=="OpenLayers.Geometry.MultiPolygon")){for(var a=0;a<d.components.length;a++){this.drawGeometry(d.components[a],c)}return}switch(d.CLASS_NAME){case"OpenLayers.Geometry.Point":this.drawPoint(d,c);break;case"OpenLayers.Geometry.LineString":this.drawLineString(d,c);break;case"OpenLayers.Geometry.LinearRing":this.drawLinearRing(d,c);break;case"OpenLayers.Geometry.Polygon":this.drawPolygon(d,c);break;default:break}},drawExternalGraphic:function(k,a){var e=new Image();e.src=a.externalGraphic;if(a.graphicTitle){e.title=a.graphicTitle}var c=a.graphicWidth||a.graphicHeight;var h=a.graphicHeight||a.graphicWidth;c=c?c:a.pointRadius*2;h=h?h:a.pointRadius*2;var g=(a.graphicXOffset!=undefined)?a.graphicXOffset:-(0.5*c);var d=(a.graphicYOffset!=undefined)?a.graphicYOffset:-(0.5*h);var f=a.graphicOpacity||a.fillOpacity;var b={img:e,x:(k[0]+g),y:(k[1]+d),width:c,height:h,canvas:this.canvas};e.onload=OpenLayers.Function.bind(function(){this.canvas.drawImage(this.img,this.x,this.y,this.width,this.height)},b)},setCanvasStyle:function(b,a){if(b=="fill"){this.canvas.globalAlpha=a.fillOpacity;this.canvas.fillStyle=a.fillColor}else{if(b=="stroke"){this.canvas.globalAlpha=a.strokeOpacity;this.canvas.strokeStyle=a.strokeColor;this.canvas.lineWidth=a.strokeWidth}else{this.canvas.globalAlpha=0;this.canvas.lineWidth=1}}},drawPoint:function(c,a){if(a.graphic!==false){var b=this.getLocalXY(c);if(a.externalGraphic){this.drawExternalGraphic(b,a)}else{if(a.fill!==false){this.setCanvasStyle("fill",a);this.canvas.beginPath();this.canvas.arc(b[0],b[1],6,0,Math.PI*2,true);this.canvas.fill()}if(a.stroke!==false){this.setCanvasStyle("stroke",a);this.canvas.beginPath();this.canvas.arc(b[0],b[1],6,0,Math.PI*2,true);this.canvas.stroke();this.setCanvasStyle("reset")}}}},drawLineString:function(d,b){if(b.stroke!==false){this.setCanvasStyle("stroke",b);this.canvas.beginPath();var e=this.getLocalXY(d.components[0]);this.canvas.moveTo(e[0],e[1]);for(var a=1;a<d.components.length;a++){var c=this.getLocalXY(d.components[a]);this.canvas.lineTo(c[0],c[1])}this.canvas.stroke()}this.setCanvasStyle("reset")},drawLinearRing:function(e,c){if(c.fill!==false){this.setCanvasStyle("fill",c);this.canvas.beginPath();var f=this.getLocalXY(e.components[0]);this.canvas.moveTo(f[0],f[1]);for(var b=1;b<e.components.length-1;b++){var d=this.getLocalXY(e.components[b]);this.canvas.lineTo(d[0],d[1])}this.canvas.fill()}if(c.stroke!==false){var a=this.canvas.lineWidth;this.setCanvasStyle("stroke",c);this.canvas.beginPath();var f=this.getLocalXY(e.components[0]);this.canvas.moveTo(f[0],f[1]);for(var b=1;b<e.components.length;b++){var d=this.getLocalXY(e.components[b]);this.canvas.lineTo(d[0],d[1])}this.canvas.stroke()}this.setCanvasStyle("reset")},drawPolygon:function(c,b){this.drawLinearRing(c.components[0],b);for(var a=1;a<c.components.length;a++){this.drawLinearRing(c.components[a],{fillOpacity:0,strokeWidth:0,strokeOpacity:0,strokeColor:"#000000",fillColor:"#000000"})}},drawText:function(b,d){d=OpenLayers.Util.extend({fontColor:"#000000",labelAlign:"cm"},d);var e=this.getLocalXY(b);this.setCanvasStyle("reset");this.canvas.fillStyle=d.fontColor;this.canvas.globalAlpha=1;var f=d.fontWeight+" "+d.fontSize+" "+d.fontFamily;if(this.canvas.fillText){var c=OpenLayers.Renderer.Canvas.LABEL_ALIGN[d.labelAlign[0]]||"middle";this.canvas.font=f;this.canvas.textAlign=c;this.canvas.fillText(d.label,e[0],e[1])}else{if(this.canvas.mozDrawText){this.canvas.mozTextStyle=f;var a=this.canvas.mozMeasureText(d.label);switch(d.labelAlign[0]){case"l":break;case"r":e[0]-=a;break;case"c":default:e[0]-=a/2}this.canvas.translate(e[0],e[1]);this.canvas.mozDrawText(d.label);this.canvas.translate(-1*e[0],-1*e[1])}}this.setCanvasStyle("reset")},getLocalXY:function(b){var c=this.getResolution();var d=this.extent;var a=(b.x/c+(-d.left/c));var e=((d.top/c)-b.y/c);return[a,e]},clear:function(){this.canvas.clearRect(0,0,this.root.width,this.root.height)},getFeatureIdFromEvent:function(a){var f=this.map.getLonLatFromPixel(a.xy);var b=this.getResolution();var e=new OpenLayers.Bounds(f.lon-b*5,f.lat-b*5,f.lon+b*5,f.lat+b*5);var c=e.toGeometry();for(var d in this.features){if(!this.features.hasOwnProperty(d)){continue}if(this.features[d][0].geometry.intersects(c)){return d}}return null},eraseFeatures:function(b){if(!(b instanceof Array)){b=[b]}for(var a=0;a<b.length;++a){delete this.features[b[a].id]}this.redraw()},redraw:function(){if(!this.locked){this.clear();var e=[];var b,c;for(var f in this.features){if(!this.features.hasOwnProperty(f)){continue}b=this.features[f][0];c=this.features[f][1];if(!b.geometry){continue}this.drawGeometry(b.geometry,c);if(c.label){e.push([b,c])}}var d;for(var a=0;len=e.length,a<len;++a){d=e[a];this.drawText(d[0].geometry.getCentroid(),d[1])}}},CLASS_NAME:"OpenLayers.Renderer.Canvas"});OpenLayers.Renderer.Canvas.LABEL_ALIGN={l:"left",r:"right"};OpenLayers.ElementsIndexer=OpenLayers.Class({maxZIndex:null,order:null,indices:null,compare:null,initialize:function(a){this.compare=a?OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_Y_ORDER:OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_DRAWING_ORDER;this.order=[];this.indices={};this.maxZIndex=0},insert:function(c){if(this.exists(c)){this.remove(c)}var f=c.id;this.determineZIndex(c);var d=-1;var e=this.order.length;var a;while(e-d>1){a=parseInt((d+e)/2);var b=this.compare(this,c,OpenLayers.Util.getElement(this.order[a]));if(b>0){d=a}else{e=a}}this.order.splice(e,0,f);this.indices[f]=this.getZIndex(c);return this.getNextElement(e)},remove:function(b){var d=b.id;var a=OpenLayers.Util.indexOf(this.order,d);if(a>=0){this.order.splice(a,1);delete this.indices[d];if(this.order.length>0){var c=this.order[this.order.length-1];this.maxZIndex=this.indices[c]}else{this.maxZIndex=0}}},clear:function(){this.order=[];this.indices={};this.maxZIndex=0},exists:function(a){return(this.indices[a.id]!=null)},getZIndex:function(a){return a._style.graphicZIndex},determineZIndex:function(a){var b=a._style.graphicZIndex;if(b==null){b=this.maxZIndex;a._style.graphicZIndex=b}else{if(b>this.maxZIndex){this.maxZIndex=b}}},getNextElement:function(b){var a=b+1;if(a<this.order.length){var c=OpenLayers.Util.getElement(this.order[a]);if(c==undefined){c=this.getNextElement(a)}return c}else{return null}},CLASS_NAME:"OpenLayers.ElementsIndexer"});OpenLayers.ElementsIndexer.IndexingMethods={Z_ORDER:function(e,d,b){var a=e.getZIndex(d);var f=0;if(b){var c=e.getZIndex(b);f=a-c}return f},Z_ORDER_DRAWING_ORDER:function(c,b,a){var d=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(c,b,a);if(a&&d==0){d=1}return d},Z_ORDER_Y_ORDER:function(f,e,b){var g=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(f,e,b);if(b&&g==0){var c=e._geometry.getBounds().bottom;var d=b._geometry.getBounds().bottom;var a=d-c;g=(a==0)?1:a}return g}};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(g,d,f){var c=g.CLASS_NAME;var h=true;if((c=="OpenLayers.Geometry.Collection")||(c=="OpenLayers.Geometry.MultiPoint")||(c=="OpenLayers.Geometry.MultiLineString")||(c=="OpenLayers.Geometry.MultiPolygon")){for(var b=0,a=g.components.length;b<a;b++){h=this.drawGeometry(g.components[b],d,f)&&h}return h}h=false;if(d.display!="none"){if(d.backgroundGraphic){this.redrawBackgroundNode(g.id,g,d,f)}h=this.redrawNode(g.id,g,d,f)}if(h==false){var e=document.getElementById(g.id);if(e){if(e._style.backgroundGraphic){e.parentNode.removeChild(document.getElementById(g.id+this.BACKGROUND_ID_SUFFIX))}e.parentNode.removeChild(e)}}return h},redrawNode:function(g,f,b,e){var c=this.nodeFactory(g,this.getNodeType(f,b));c._featureId=e;c._geometry=f;c._geometryClass=f.CLASS_NAME;c._style=b;var a=this.drawGeometryNode(c,f,b);if(a===false){return false}c=a.node;if(this.indexer){var d=this.indexer.insert(c);if(d){this.vectorRoot.insertBefore(c,d)}else{this.vectorRoot.appendChild(c)}}else{if(c.parentNode!==this.vectorRoot){this.vectorRoot.appendChild(c)}}this.postDraw(c);return a.complete},redrawBackgroundNode:function(e,d,b,c){var a=OpenLayers.Util.extend({},b);a.externalGraphic=a.backgroundGraphic;a.graphicXOffset=a.backgroundXOffset;a.graphicYOffset=a.backgroundYOffset;a.graphicZIndex=a.backgroundGraphicZIndex;a.graphicWidth=a.backgroundWidth||a.graphicWidth;a.graphicHeight=a.backgroundHeight||a.graphicHeight;a.backgroundGraphic=null;a.backgroundXOffset=null;a.backgroundYOffset=null;a.backgroundGraphicZIndex=null;return this.redrawNode(e+this.BACKGROUND_ID_SUFFIX,d,a,null)},drawGeometryNode:function(c,e,b){b=b||c._style;OpenLayers.Util.applyDefaults(b,this.minimumSymbolizer);var a={isFilled:b.fill===undefined?true:b.fill,isStroked:b.stroke===undefined?!!b.strokeWidth:b.stroke};var d;switch(e.CLASS_NAME){case"OpenLayers.Geometry.Point":if(b.graphic===false){a.isFilled=false;a.isStroked=false}d=this.drawPoint(c,e);break;case"OpenLayers.Geometry.LineString":a.isFilled=false;d=this.drawLineString(c,e);break;case"OpenLayers.Geometry.LinearRing":d=this.drawLinearRing(c,e);break;case"OpenLayers.Geometry.Polygon":d=this.drawPolygon(c,e);break;case"OpenLayers.Geometry.Surface":d=this.drawSurface(c,e);break;case"OpenLayers.Geometry.Rectangle":d=this.drawRectangle(c,e);break;default:break}c._style=b;c._options=a;if(d!=false){return{node:this.setStyle(c,b,a,e),complete:d}}else{return false}},postDraw:function(a){},drawPoint:function(a,b){},drawLineString:function(a,b){},drawLinearRing:function(a,b){},drawPolygon:function(a,b){},drawRectangle:function(a,b){},drawCircle:function(a,b){},drawSurface:function(a,b){},removeText:function(b){var a=document.getElementById(b+this.LABEL_ID_SUFFIX);if(a){this.textRoot.removeChild(a)}},getFeatureIdFromEvent:function(a){var d=a.target;var b=d&&d.correspondingUseElement;var c=b?b:(d||a.srcElement);var e=c._featureId;return e},eraseGeometry:function(f){if((f.CLASS_NAME=="OpenLayers.Geometry.MultiPoint")||(f.CLASS_NAME=="OpenLayers.Geometry.MultiLineString")||(f.CLASS_NAME=="OpenLayers.Geometry.MultiPolygon")||(f.CLASS_NAME=="OpenLayers.Geometry.Collection")){for(var d=0,a=f.components.length;d<a;d++){this.eraseGeometry(f.components[d])}}else{var c=OpenLayers.Util.getElement(f.id);if(c&&c.parentNode){if(c.geometry){c.geometry.destroy();c.geometry=null}c.parentNode.removeChild(c);if(this.indexer){this.indexer.remove(c)}if(c._style.backgroundGraphic){var b=f.id+this.BACKGROUND_ID_SUFFIX;var e=OpenLayers.Util.getElement(b);if(e&&e.parentNode){e.parentNode.removeChild(e)}}}}},nodeFactory:function(c,a){var b=OpenLayers.Util.getElement(c);if(b){if(!this.nodeTypeCompare(b,a)){b.parentNode.removeChild(b);b=this.nodeFactory(c,a)}}else{b=this.createNode(a,c)}return b},nodeTypeCompare:function(b,a){},createNode:function(a,b){},moveRoot:function(b){var a=this.root;if(b.root.parentNode==this.rendererRoot){a=b.root}a.parentNode.removeChild(a);b.rendererRoot.appendChild(a)},getRenderLayerId:function(){return this.root.parentNode.parentNode.id},isComplexSymbol:function(a){return(a!="circle")&&!!a},CLASS_NAME:"OpenLayers.Renderer.Elements"});OpenLayers.Renderer.symbol={star:[350,75,379,161,469,161,397,215,423,301,350,250,277,301,303,215,231,161,321,161,350,75],cross:[4,0,6,0,6,4,10,4,10,6,6,6,6,10,4,10,4,6,0,6,0,4,4,4,4,0],x:[0,0,25,0,50,35,75,0,100,0,65,50,100,100,75,100,50,65,25,100,0,100,35,50,0,0],square:[0,0,0,1,1,1,1,0,0,0],triangle:[0,10,10,10,5,0,0,10]};OpenLayers.Tween=OpenLayers.Class({INTERVAL:10,easing:null,begin:null,finish:null,duration:null,callbacks:null,time:null,interval:null,playing:false,initialize:function(a){this.easing=(a)?a:OpenLayers.Easing.Expo.easeOut},start:function(c,b,d,a){this.playing=true;this.begin=c;this.finish=b;this.duration=d;this.callbacks=a.callbacks;this.time=0;if(this.interval){window.clearInterval(this.interval);this.interval=null}if(this.callbacks&&this.callbacks.start){this.callbacks.start.call(this,this.begin)}this.interval=window.setInterval(OpenLayers.Function.bind(this.play,this),this.INTERVAL)},stop:function(){if(!this.playing){return}if(this.callbacks&&this.callbacks.done){this.callbacks.done.call(this,this.finish)}window.clearInterval(this.interval);this.interval=null;this.playing=false},play:function(){var 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.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(e){OpenLayers.Control.prototype.setMap.apply(this,arguments);for(var c=0,a=this.map.controls.length;c<a;c++){var d=this.map.controls[c];if((d!=this)&&(d.CLASS_NAME=="OpenLayers.Control.ArgParser")){if(d.displayProjection!=this.displayProjection){this.displayProjection=d.displayProjection}break}}if(c==this.map.controls.length){var b=OpenLayers.Util.getParameters();if(b.layers){this.layers=b.layers;this.map.events.register("addlayer",this,this.configureLayers);this.configureLayers()}if(b.lat&&b.lon){this.center=new OpenLayers.LonLat(parseFloat(b.lon),parseFloat(b.lat));if(b.zoom){this.zoom=parseInt(b.zoom)}this.map.events.register("changebaselayer",this,this.setCenter);this.setCenter()}}},setCenter:function(){if(this.map.baseLayer){this.map.events.unregister("changebaselayer",this,this.setCenter);if(this.displayProjection){this.center.transform(this.displayProjection,this.map.getProjectionObject())}this.map.setCenter(this.center,this.zoom)}},configureLayers:function(){if(this.layers.length==this.map.layers.length){this.map.events.unregister("addlayer",this,this.configureLayers);for(var d=0,a=this.layers.length;d<a;d++){var b=this.map.layers[d];var 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.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 d=[];if(this.map&&this.map.layers){for(var c=0,a=this.map.layers.length;c<a;c++){var b=this.map.layers[c];if(b.attribution&&b.getVisibility()){d.push(b.attribution)}}this.div.innerHTML=d.join(this.separator)}},CLASS_NAME:"OpenLayers.Control.Attribution"});OpenLayers.Control.LayerSwitcher=OpenLayers.Class(OpenLayers.Control,{activeColor:"darkblue",layerStates:null,layersDiv:null,baseLayersDiv:null,baseLayers:null,dataLbl:null,dataLayersDiv:null,dataLayers:null,minimizeDiv:null,maximizeDiv:null,ascending:true,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.layerStates=[]},destroy:function(){OpenLayers.Event.stopObservingElement(this.div);OpenLayers.Event.stopObservingElement(this.minimizeDiv);OpenLayers.Event.stopObservingElement(this.maximizeDiv);this.clearLayersArray("base");this.clearLayersArray("data");this.map.events.un({addlayer:this.redraw,changelayer:this.redraw,removelayer:this.redraw,changebaselayer:this.redraw,scope:this});OpenLayers.Control.prototype.destroy.apply(this,arguments)},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.map.events.on({addlayer:this.redraw,changelayer:this.redraw,removelayer:this.redraw,changebaselayer:this.redraw,scope:this})},draw:function(){OpenLayers.Control.prototype.draw.apply(this);this.loadContents();if(!this.outsideViewport){this.minimizeControl()}this.redraw();return this.div},clearLayersArray:function(d){var e=this[d+"Layers"];if(e){for(var c=0,a=e.length;c<a;c++){var b=e[c];OpenLayers.Event.stopObservingElement(b.inputElem);OpenLayers.Event.stopObservingElement(b.labelSpan)}}this[d+"LayersDiv"].innerHTML="";this[d+"Layers"]=[]},checkRedraw:function(){var e=false;if(!this.layerStates.length||(this.map.layers.length!=this.layerStates.length)){e=true}else{for(var c=0,a=this.layerStates.length;c<a;c++){var d=this.layerStates[c];var b=this.map.layers[c];if((d.name!=b.name)||(d.inRange!=b.inRange)||(d.id!=b.id)||(d.visibility!=b.visibility)){e=true;break}}}return e},sortLayers:function(d,c){if(d.options&&c.options){return d.options.layerSwitcherOrder<c.options.layerSwitcherOrder?-1:1}return 0},redraw:function(){if(!this.checkRedraw()){return this.div}this.clearLayersArray("base");this.clearLayersArray("data");var d=false;var o=false;var h=this.map.layers.length;this.layerStates=new Array(h);for(var f=0;f<h;f++){var g=this.map.layers[f];this.layerStates[f]={name:g.name,visibility:g.visibility,inRange:g.inRange,id:g.id}}var e=this.map.layers.slice();e.sort(this.sortLayers);if(!this.ascending){e.reverse()}for(var f=0,h=e.length;f<h;f++){var g=e[f];var k=g.isBaseLayer;if(g.displayInLayerSwitcher){if(k){o=true}else{d=true}var m=(k)?(g==this.map.baseLayer):g.getVisibility();var l=document.createElement("input");l.id=this.id+"_input_"+g.name;l.name=(k)?"baseLayers":g.name;l.type=(k)?"radio":"checkbox";l.value=g.name;l.checked=m;l.defaultChecked=m;if(!k&&!g.inRange){l.disabled=true}var a={inputElem:l,layer:g,layerSwitcher:this};OpenLayers.Event.observe(l,"mouseup",OpenLayers.Function.bindAsEventListener(this.onInputClick,a));var b=document.createElement("span");if(!k&&!g.inRange){b.style.color="gray"}b.innerHTML=g.name;b.style.verticalAlign=(k)?"bottom":"baseline";OpenLayers.Event.observe(b,"click",OpenLayers.Function.bindAsEventListener(this.onInputClick,a));var q=document.createElement("br");var p=(k)?this.baseLayers:this.dataLayers;p.push({layer:g,inputElem:l,labelSpan:b});var c=(k)?this.baseLayersDiv:this.dataLayersDiv;c.appendChild(l);c.appendChild(b);c.appendChild(q)}}this.dataLbl.style.display=(d)?"":"none";this.baseLbl.style.display=(o)?"":"none";return this.div},onInputClick:function(a){if(!this.inputElem.disabled){if(this.inputElem.type=="radio"){this.inputElem.checked=true;this.layer.map.setBaseLayer(this.layer)}else{this.inputElem.checked=!this.inputElem.checked;this.layerSwitcher.updateMap()}}OpenLayers.Event.stop(a)},onLayerClick:function(a){this.updateMap()},updateMap:function(){for(var b=0,a=this.baseLayers.length;b<a;b++){var c=this.baseLayers[b];if(c.inputElem.checked){this.map.setBaseLayer(c.layer,false)}}for(var b=0,a=this.dataLayers.length;b<a;b++){var c=this.dataLayers[b];c.layer.setVisibility(c.inputElem.checked)}},maximizeControl:function(a){this.div.style.width="20em";this.div.style.height="";this.showControls(false);if(a!=null){OpenLayers.Event.stop(a)}},minimizeControl:function(a){this.div.style.width="0px";this.div.style.height="0px";this.showControls(true);if(a!=null){OpenLayers.Event.stop(a)}},showControls:function(a){this.maximizeDiv.style.display=a?"":"none";this.minimizeDiv.style.display=a?"none":"";this.layersDiv.style.display=a?"none":""},loadContents:function(){this.div.style.position="absolute";this.div.style.top="25px";this.div.style.right="0px";this.div.style.left="";this.div.style.fontFamily="sans-serif";this.div.style.fontWeight="bold";this.div.style.marginTop="3px";this.div.style.marginLeft="3px";this.div.style.marginBottom="3px";this.div.style.fontSize="smaller";this.div.style.color="white";this.div.style.backgroundColor="transparent";OpenLayers.Event.observe(this.div,"mouseup",OpenLayers.Function.bindAsEventListener(this.mouseUp,this));OpenLayers.Event.observe(this.div,"click",this.ignoreEvent);OpenLayers.Event.observe(this.div,"mousedown",OpenLayers.Function.bindAsEventListener(this.mouseDown,this));OpenLayers.Event.observe(this.div,"dblclick",this.ignoreEvent);this.layersDiv=document.createElement("div");this.layersDiv.id=this.id+"_layersDiv";this.layersDiv.style.paddingTop="5px";this.layersDiv.style.paddingLeft="10px";this.layersDiv.style.paddingBottom="5px";this.layersDiv.style.paddingRight="75px";this.layersDiv.style.backgroundColor=this.activeColor;this.layersDiv.style.width="100%";this.layersDiv.style.height="100%";this.baseLbl=document.createElement("div");this.baseLbl.innerHTML=OpenLayers.i18n("baseLayer");this.baseLbl.style.marginTop="3px";this.baseLbl.style.marginLeft="3px";this.baseLbl.style.marginBottom="3px";this.baseLayersDiv=document.createElement("div");this.baseLayersDiv.style.paddingLeft="10px";this.dataLbl=document.createElement("div");this.dataLbl.innerHTML=OpenLayers.i18n("overlays");this.dataLbl.style.marginTop="3px";this.dataLbl.style.marginLeft="3px";this.dataLbl.style.marginBottom="3px";this.dataLayersDiv=document.createElement("div");this.dataLayersDiv.style.paddingLeft="10px";if(this.ascending){this.layersDiv.appendChild(this.baseLbl);this.layersDiv.appendChild(this.baseLayersDiv);this.layersDiv.appendChild(this.dataLbl);this.layersDiv.appendChild(this.dataLayersDiv)}else{this.layersDiv.appendChild(this.dataLbl);this.layersDiv.appendChild(this.dataLayersDiv);this.layersDiv.appendChild(this.baseLbl);this.layersDiv.appendChild(this.baseLayersDiv)}this.div.appendChild(this.layersDiv);OpenLayers.Rico.Corner.round(this.div,{corners:"tl bl",bgColor:"transparent",color:this.activeColor,blend:false});OpenLayers.Rico.Corner.changeOpacity(this.layersDiv,0.75);var c=OpenLayers.Util.getImagesLocation();var b=new OpenLayers.Size(18,18);var a=c+"layer-switcher-maximize.png";this.maximizeDiv=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_MaximizeDiv",null,b,a,"absolute");this.maximizeDiv.style.top="5px";this.maximizeDiv.style.right="0px";this.maximizeDiv.style.left="";this.maximizeDiv.style.display="none";OpenLayers.Event.observe(this.maximizeDiv,"click",OpenLayers.Function.bindAsEventListener(this.maximizeControl,this));this.div.appendChild(this.maximizeDiv);var a=c+"layer-switcher-minimize.png";var b=new OpenLayers.Size(18,18);this.minimizeDiv=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_MinimizeDiv",null,b,a,"absolute");this.minimizeDiv.style.top="5px";this.minimizeDiv.style.right="0px";this.minimizeDiv.style.left="";this.minimizeDiv.style.display="none";OpenLayers.Event.observe(this.minimizeDiv,"click",OpenLayers.Function.bindAsEventListener(this.minimizeControl,this));this.div.appendChild(this.minimizeDiv)},ignoreEvent:function(a){OpenLayers.Event.stop(a)},mouseDown:function(a){this.isMouseDown=true;this.ignoreEvent(a)},mouseUp:function(a){if(this.isMouseDown){this.isMouseDown=false;this.ignoreEvent(a)}},CLASS_NAME:"OpenLayers.Control.LayerSwitcher"});OpenLayers.Control.PanZoom=OpenLayers.Class(OpenLayers.Control,{slideFactor:50,slideRatio:null,buttons:null,position:null,initialize:function(a){this.position=new OpenLayers.Pixel(OpenLayers.Control.PanZoom.X,OpenLayers.Control.PanZoom.Y);OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){OpenLayers.Control.prototype.destroy.apply(this,arguments);this.removeButtons();this.buttons=null;this.position=null},draw:function(b){OpenLayers.Control.prototype.draw.apply(this,arguments);b=this.position;this.buttons=[];var c=new OpenLayers.Size(18,18);var a=new OpenLayers.Pixel(b.x+c.w/2,b.y);this._addButton("panup","north-mini.png",a,c);b.y=a.y+c.h;this._addButton("panleft","west-mini.png",b,c);this._addButton("panright","east-mini.png",b.add(c.w,0),c);this._addButton("pandown","south-mini.png",a.add(0,c.h*2),c);this._addButton("zoomin","zoom-plus-mini.png",a.add(0,c.h*3+5),c);this._addButton("zoomworld","zoom-world-mini.png",a.add(0,c.h*4+5),c);this._addButton("zoomout","zoom-minus-mini.png",a.add(0,c.h*5+5),c);return this.div},_addButton:function(a,d,k,g){var f=OpenLayers.Util.getImagesLocation()+d;var b=OpenLayers.Util.createAlphaImageDiv(this.id+"_"+a,k,g,f,"absolute");this.div.appendChild(b);OpenLayers.Event.observe(b,"mousedown",OpenLayers.Function.bindAsEventListener(this.buttonDown,b));OpenLayers.Event.observe(b,"dblclick",OpenLayers.Function.bindAsEventListener(this.doubleClick,b));OpenLayers.Event.observe(b,"click",OpenLayers.Function.bindAsEventListener(this.doubleClick,b));b.action=a;b.map=this.map;if(!this.slideRatio){var c=this.slideFactor;var e=function(){return c}}else{var h=this.slideRatio;var e=function(l){return this.map.getSize()[l]*h}}b.getSlideFactor=e;this.buttons.push(b);return b},_removeButton:function(a){OpenLayers.Event.stopObservingElement(a);a.map=null;this.div.removeChild(a);OpenLayers.Util.removeItem(this.buttons,a)},removeButtons:function(){for(var a=this.buttons.length-1;a>=0;--a){this._removeButton(this.buttons[a])}},doubleClick:function(a){OpenLayers.Event.stop(a);return false},buttonDown:function(a){if(!OpenLayers.Event.isLeftClick(a)){return}switch(this.action){case"panup":this.map.pan(0,-this.getSlideFactor("h"));break;case"pandown":this.map.pan(0,this.getSlideFactor("h"));break;case"panleft":this.map.pan(-this.getSlideFactor("w"),0);break;case"panright":this.map.pan(this.getSlideFactor("w"),0);break;case"zoomin":this.map.zoomIn();break;case"zoomout":this.map.zoomOut();break;case"zoomworld":this.map.zoomToMaxExtent();break}OpenLayers.Event.stop(a)},CLASS_NAME:"OpenLayers.Control.PanZoom"});OpenLayers.Control.PanZoom.X=4;OpenLayers.Control.PanZoom.Y=4;OpenLayers.Event={observers:false,KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(a){return a.target||a.srcElement},isLeftClick:function(a){return(((a.which)&&(a.which==1))||((a.button)&&(a.button==1)))},isRightClick:function(a){return(((a.which)&&(a.which==3))||((a.button)&&(a.button==2)))},stop:function(b,a){if(!a){if(b.preventDefault){b.preventDefault()}else{b.returnValue=false}}if(b.stopPropagation){b.stopPropagation()}else{b.cancelBubble=true}},findElement:function(c,b){var a=OpenLayers.Event.element(c);while(a.parentNode&&(!a.tagName||(a.tagName.toUpperCase()!=b.toUpperCase()))){a=a.parentNode}return a},observe:function(b,d,c,a){var e=OpenLayers.Util.getElement(b);a=a||false;if(d=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||e.attachEvent)){d="keydown"}if(!this.observers){this.observers={}}if(!e._eventCacheID){var f="eventCacheID_";if(e.id){f=e.id+"_"+f}e._eventCacheID=OpenLayers.Util.createUniqueID(f)}var g=e._eventCacheID;if(!this.observers[g]){this.observers[g]=[]}this.observers[g].push({element:e,name:d,observer:c,useCapture:a});if(e.addEventListener){e.addEventListener(d,c,a)}else{if(e.attachEvent){e.attachEvent("on"+d,c)}}},stopObservingElement:function(a){var b=OpenLayers.Util.getElement(a);var c=b._eventCacheID;this._removeElementObservers(OpenLayers.Event.observers[c])},_removeElementObservers:function(e){if(e){for(var b=e.length-1;b>=0;b--){var c=e[b];var a=new Array(c.element,c.name,c.observer,c.useCapture);var d=OpenLayers.Event.stopObserving.apply(this,a)}}},stopObserving:function(h,a,g,b){b=b||false;var f=OpenLayers.Util.getElement(h);var d=f._eventCacheID;if(a=="keypress"){if(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||f.detachEvent){a="keydown"}}var l=false;var c=OpenLayers.Event.observers[d];if(c){var e=0;while(!l&&e<c.length){var k=c[e];if((k.name==a)&&(k.observer==g)&&(k.useCapture==b)){c.splice(e,1);if(c.length==0){delete OpenLayers.Event.observers[d]}l=true;break}e++}}if(l){if(f.removeEventListener){f.removeEventListener(a,g,b)}else{if(f&&f.detachEvent){f.detachEvent("on"+a,g)}}}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(c,e,g,f,b){OpenLayers.Util.extend(this,b);this.object=c;this.fallThrough=f;this.listeners={};this.eventHandler=OpenLayers.Function.bindAsEventListener(this.handleBrowserEvent,this);this.clearMouseListener=OpenLayers.Function.bind(this.clearMouseCache,this);this.eventTypes=[];if(g!=null){for(var d=0,a=g.length;d<a;d++){this.addEventType(g[d])}}if(e!=null){this.attachToElement(e)}},destroy:function(){if(this.element){OpenLayers.Event.stopObservingElement(this.element);if(this.element.hasScrollEvent){OpenLayers.Event.stopObserving(window,"scroll",this.clearMouseListener)}}this.element=null;this.listeners=null;this.object=null;this.eventTypes=null;this.fallThrough=null;this.eventHandler=null},addEventType:function(a){if(!this.listeners[a]){this.eventTypes.push(a);this.listeners[a]=[]}},attachToElement:function(d){if(this.element){OpenLayers.Event.stopObservingElement(this.element)}this.element=d;for(var c=0,a=this.BROWSER_EVENTS.length;c<a;c++){var b=this.BROWSER_EVENTS[c];this.addEventType(b);OpenLayers.Event.observe(d,b,this.eventHandler)}OpenLayers.Event.observe(d,"dragstart",OpenLayers.Event.stop)},on:function(a){for(var b in a){if(b!="scope"){this.register(b,a.scope,a[b])}}},register:function(b,d,c){if((c!=null)&&(OpenLayers.Util.indexOf(this.eventTypes,b)!=-1)){if(d==null){d=this.object}var a=this.listeners[b];a.push({obj:d,func:c})}},registerPriority:function(b,d,c){if(c!=null){if(d==null){d=this.object}var a=this.listeners[b];if(a!=null){a.unshift({obj:d,func:c})}}},un:function(a){for(var b in a){if(b!="scope"){this.unregister(b,a.scope,a[b])}}},unregister:function(d,f,e){if(f==null){f=this.object}var c=this.listeners[d];if(c!=null){for(var b=0,a=c.length;b<a;b++){if(c[b].obj==f&&c[b].func==e){c.splice(b,1);break}}}},remove:function(a){if(this.listeners[a]!=null){this.listeners[a]=[]}},triggerEvent:function(e,b){var d=this.listeners[e];if(!d||d.length==0){return}if(b==null){b={}}b.object=this.object;b.element=this.element;if(!b.type){b.type=e}var d=d.slice(),f;for(var c=0,a=d.length;c<a;c++){var g=d[c];f=g.func.apply(g.obj,[b]);if((f!=undefined)&&(f==false)){break}}if(!this.fallThrough){OpenLayers.Event.stop(b,true)}return f},handleBrowserEvent:function(a){if(this.includeXY){a.xy=this.getMousePosition(a)}this.triggerEvent(a.type,a)},clearMouseCache:function(){this.element.scrolls=null;this.element.lefttop=null;this.element.offsets=null},getMousePosition:function(a){if(!this.includeXY){this.clearMouseCache()}else{if(!this.element.hasScrollEvent){OpenLayers.Event.observe(window,"scroll",this.clearMouseListener);this.element.hasScrollEvent=true}}if(!this.element.scrolls){this.element.scrolls=[(document.documentElement.scrollLeft||document.body.scrollLeft),(document.documentElement.scrollTop||document.body.scrollTop)]}if(!this.element.lefttop){this.element.lefttop=[(document.documentElement.clientLeft||0),(document.documentElement.clientTop||0)]}if(!this.element.offsets){this.element.offsets=OpenLayers.Util.pagePosition(this.element);this.element.offsets[0]+=this.element.scrolls[0];this.element.offsets[1]+=this.element.scrolls[1]}return new OpenLayers.Pixel((a.clientX+this.element.scrolls[0])-this.element.offsets[0]-this.element.lefttop[0],(a.clientY+this.element.scrolls[1])-this.element.offsets[1]-this.element.lefttop[1])},CLASS_NAME:"OpenLayers.Events"});OpenLayers.Format=OpenLayers.Class({options:null,externalProjection:null,internalProjection:null,data:null,keepData:false,initialize:function(a){OpenLayers.Util.extend(this,a);this.options=a},destroy:function(){},read:function(a){OpenLayers.Console.userError(OpenLayers.i18n("readNotImplemented"))},write:function(a){OpenLayers.Console.userError(OpenLayers.i18n("writeNotImplemented"))},CLASS_NAME:"OpenLayers.Format"});OpenLayers.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}",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."};OpenLayers.Popup.AnchoredBubble=OpenLayers.Class(OpenLayers.Popup.Anchored,{rounded:false,initialize:function(g,c,f,b,a,e,d){this.padding=new OpenLayers.Bounds(0,OpenLayers.Popup.AnchoredBubble.CORNER_SIZE,0,OpenLayers.Popup.AnchoredBubble.CORNER_SIZE);OpenLayers.Popup.Anchored.prototype.initialize.apply(this,arguments)},draw:function(a){OpenLayers.Popup.Anchored.prototype.draw.apply(this,arguments);this.setContentHTML();this.setBackgroundColor();this.setOpacity();return this.div},updateRelativePosition:function(){this.setRicoCorners()},setSize:function(a){OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments);this.setRicoCorners()},setBackgroundColor:function(a){if(a!=undefined){this.backgroundColor=a}if(this.div!=null){if(this.contentDiv!=null){this.div.style.background="transparent";OpenLayers.Rico.Corner.changeColor(this.groupDiv,this.backgroundColor)}}},setOpacity:function(a){OpenLayers.Popup.Anchored.prototype.setOpacity.call(this,a);if(this.div!=null){if(this.groupDiv!=null){OpenLayers.Rico.Corner.changeOpacity(this.groupDiv,this.opacity)}}},setBorder:function(a){this.border=0},setRicoCorners:function(){var a=this.getCornersToRound(this.relativePosition);var b={corners:a,color:this.backgroundColor,bgColor:"transparent",blend:false};if(!this.rounded){OpenLayers.Rico.Corner.round(this.div,b);this.rounded=true}else{OpenLayers.Rico.Corner.reRound(this.groupDiv,b);this.setBackgroundColor();this.setOpacity()}},getCornersToRound:function(){var a=["tl","tr","bl","br"];var b=OpenLayers.Bounds.oppositeQuadrant(this.relativePosition);OpenLayers.Util.removeItem(a,b);return a.join(" ")},CLASS_NAME:"OpenLayers.Popup.AnchoredBubble"});OpenLayers.Popup.AnchoredBubble.CORNER_SIZE=5;OpenLayers.Popup.Framed=OpenLayers.Class(OpenLayers.Popup.Anchored,{imageSrc:null,imageSize:null,isAlphaImage:false,positionBlocks:null,blocks:null,fixedRelativePosition:false,initialize:function(g,c,f,b,a,e,d){OpenLayers.Popup.Anchored.prototype.initialize.apply(this,arguments);if(this.fixedRelativePosition){this.updateRelativePosition();this.calculateRelativePosition=function(h){return this.relativePosition}}this.contentDiv.style.position="absolute";this.contentDiv.style.zIndex=1;if(e){this.closeDiv.style.zIndex=1}this.groupDiv.style.position="absolute";this.groupDiv.style.top="0px";this.groupDiv.style.left="0px";this.groupDiv.style.height="100%";this.groupDiv.style.width="100%"},destroy:function(){this.imageSrc=null;this.imageSize=null;this.isAlphaImage=null;this.fixedRelativePosition=false;this.positionBlocks=null;for(var a=0;a<this.blocks.length;a++){var b=this.blocks[a];if(b.image){b.div.removeChild(b.image)}b.image=null;if(b.div){this.groupDiv.removeChild(b.div)}b.div=null}this.blocks=null;OpenLayers.Popup.Anchored.prototype.destroy.apply(this,arguments)},setBackgroundColor:function(a){},setBorder:function(){},setOpacity:function(a){},setSize:function(a){OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments);this.updateBlocks()},updateRelativePosition:function(){this.padding=this.positionBlocks[this.relativePosition].padding;if(this.closeDiv){var a=this.getContentDivPadding();this.closeDiv.style.right=a.right+this.padding.right+"px";this.closeDiv.style.top=a.top+this.padding.top+"px"}this.updateBlocks()},calculateNewPx:function(a){var b=OpenLayers.Popup.Anchored.prototype.calculateNewPx.apply(this,arguments);b=b.offset(this.positionBlocks[this.relativePosition].offset);return b},createBlocks:function(){this.blocks=[];var f=null;for(var e in this.positionBlocks){f=e;break}var a=this.positionBlocks[f];for(var d=0;d<a.blocks.length;d++){var h={};this.blocks.push(h);var b=this.id+"_FrameDecorationDiv_"+d;h.div=OpenLayers.Util.createDiv(b,null,null,null,"absolute",null,"hidden",null);var c=this.id+"_FrameDecorationImg_"+d;var g=(this.isAlphaImage)?OpenLayers.Util.createAlphaImageDiv:OpenLayers.Util.createImage;h.image=g(c,null,this.imageSize,this.imageSrc,"absolute",null,null,null);h.div.appendChild(h.image);this.groupDiv.appendChild(h.div)}},updateBlocks:function(){if(!this.blocks){this.createBlocks()}if(this.size&&this.relativePosition){var k=this.positionBlocks[this.relativePosition];for(var f=0;f<k.blocks.length;f++){var c=k.blocks[f];var e=this.blocks[f];var d=c.anchor.left;var m=c.anchor.bottom;var a=c.anchor.right;var p=c.anchor.top;var o=(isNaN(c.size.w))?this.size.w-(a+d):c.size.w;var g=(isNaN(c.size.h))?this.size.h-(m+p):c.size.h;e.div.style.width=(o<0?0:o)+"px";e.div.style.height=(g<0?0:g)+"px";e.div.style.left=(d!=null)?d+"px":"";e.div.style.bottom=(m!=null)?m+"px":"";e.div.style.right=(a!=null)?a+"px":"";e.div.style.top=(p!=null)?p+"px":"";e.image.style.left=c.position.x+"px";e.image.style.top=c.position.y+"px"}this.contentDiv.style.left=this.padding.left+"px";this.contentDiv.style.top=this.padding.top+"px"}},CLASS_NAME:"OpenLayers.Popup.Framed"});OpenLayers.Projection=OpenLayers.Class({proj:null,projCode:null,initialize:function(b,a){OpenLayers.Util.extend(this,a);this.projCode=b;if(window.Proj4js){this.proj=new Proj4js.Proj(b)}},getCode:function(){return this.proj?this.proj.srsCode:this.projCode},getUnits:function(){return this.proj?this.proj.units:null},toString:function(){return this.getCode()},equals:function(a){if(a&&a.getCode){return this.getCode()==a.getCode()}else{return false}},destroy:function(){delete this.proj;delete this.projCode},CLASS_NAME:"OpenLayers.Projection"});OpenLayers.Projection.transforms={};OpenLayers.Projection.addTransform=function(c,b,a){if(!OpenLayers.Projection.transforms[c]){OpenLayers.Projection.transforms[c]={}}OpenLayers.Projection.transforms[c][b]=a};OpenLayers.Projection.transform=function(a,c,b){if(c.proj&&b.proj){a=Proj4js.transform(c.proj,b.proj,a)}else{if(c&&b&&OpenLayers.Projection.transforms[c.getCode()]&&OpenLayers.Projection.transforms[c.getCode()][b.getCode()]){OpenLayers.Projection.transforms[c.getCode()][b.getCode()](a)}}return a};OpenLayers.Renderer.SVG=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"http://www.w3.org/2000/svg",xlinkns:"http://www.w3.org/1999/xlink",MAX_PIXEL:15000,translationParameters:null,symbolSize:{},isGecko:null,initialize:function(a){if(!this.supported()){return}OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments);this.translationParameters={x:0,y:0};this.isGecko=(navigator.userAgent.toLowerCase().indexOf("gecko/")!=-1)},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments)},supported:function(){var a="http://www.w3.org/TR/SVG11/feature#";return(document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature(a+"SVG","1.1")||document.implementation.hasFeature(a+"BasicStructure","1.1")))},inValidRange:function(a,e,b){var d=a+(b?0:this.translationParameters.x);var c=e+(b?0:this.translationParameters.y);return(d>=-this.MAX_PIXEL&&d<=this.MAX_PIXEL&&c>=-this.MAX_PIXEL&&c<=this.MAX_PIXEL)},setExtent:function(b,d){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var a=this.getResolution();var f=-b.left/a;var e=b.top/a;if(d){this.left=f;this.top=e;var c="0 0 "+this.size.w+" "+this.size.h;this.rendererRoot.setAttributeNS(null,"viewBox",c);this.translate(0,0);return true}else{var g=this.translate(f-this.left,e-this.top);if(!g){this.setExtent(b,true)}return g}},translate:function(a,c){if(!this.inValidRange(a,c,true)){return false}else{var b="";if(a||c){b="translate("+a+","+c+")"}this.root.setAttributeNS(null,"transform",b);this.translationParameters={x:a,y:c};return true}},setSize:function(a){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);this.rendererRoot.setAttributeNS(null,"width",this.size.w);this.rendererRoot.setAttributeNS(null,"height",this.size.h)},getNodeType:function(c,b){var a=null;switch(c.CLASS_NAME){case"OpenLayers.Geometry.Point":if(b.externalGraphic){a="image"}else{if(this.isComplexSymbol(b.graphicName)){a="use"}else{a="circle"}}break;case"OpenLayers.Geometry.Rectangle":a="rect";break;case"OpenLayers.Geometry.LineString":a="polyline";break;case"OpenLayers.Geometry.LinearRing":a="polygon";break;case"OpenLayers.Geometry.Polygon":case"OpenLayers.Geometry.Curve":case"OpenLayers.Geometry.Surface":a="path";break;default:break}return a},setStyle:function(q,u,b){u=u||q._style;b=b||q._options;var k=parseFloat(q.getAttributeNS(null,"r"));var h=1;var d;if(q._geometryClass=="OpenLayers.Geometry.Point"&&k){q.style.visibility="";if(u.graphic===false){q.style.visibility="hidden"}else{if(u.externalGraphic){d=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 m=u.graphicHeight||u.graphicWidth;p=p?p:u.pointRadius*2;m=m?m:u.pointRadius*2;var v=(u.graphicXOffset!=undefined)?u.graphicXOffset:-(0.5*p);var e=(u.graphicYOffset!=undefined)?u.graphicYOffset:-(0.5*m);var a=u.graphicOpacity||u.fillOpacity;q.setAttributeNS(null,"x",(d.x+v).toFixed());q.setAttributeNS(null,"y",(d.y+e).toFixed());q.setAttributeNS(null,"width",p);q.setAttributeNS(null,"height",m);q.setAttributeNS(this.xlinkns,"href",u.externalGraphic);q.setAttributeNS(null,"style","opacity: "+a)}else{if(this.isComplexSymbol(u.graphicName)){var c=u.pointRadius*3;var l=c*2;var o=this.importSymbol(u.graphicName);var t="#"+o;d=this.getPosition(q);h=this.symbolSize[o]/l;var f=q.parentNode;var g=q.nextSibling;if(f){f.removeChild(q)}q.setAttributeNS(this.xlinkns,"href",t);q.setAttributeNS(null,"width",l);q.setAttributeNS(null,"height",l);q.setAttributeNS(null,"x",d.x-c);q.setAttributeNS(null,"y",d.y-c);if(g){f.insertBefore(q,g)}else{if(f){f.appendChild(q)}}}else{q.setAttributeNS(null,"r",u.pointRadius)}}}if(typeof u.rotation!="undefined"&&d){var s=OpenLayers.String.format("rotate(${0} ${1} ${2})",[u.rotation,d.x,d.y]);q.setAttributeNS(null,"transform",s)}}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*h);q.setAttributeNS(null,"stroke-linecap",u.strokeLinecap);q.setAttributeNS(null,"stroke-linejoin","round");q.setAttributeNS(null,"stroke-dasharray",this.dashStyle(u,h))}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(c,b){var a=c.strokeWidth*b;switch(c.strokeDashstyle){case"solid":return"none";case"dot":return[1,4*a].join();case"dash":return[4*a,4*a].join();case"dashdot":return[4*a,4*a,1,4*a].join();case"longdash":return[8*a,4*a].join();case"longdashdot":return[8*a,4*a,1,4*a].join();default:return c.strokeDashstyle.replace(/ /g,",")}},createNode:function(a,c){var b=document.createElementNS(this.xmlns,a);if(c){b.setAttributeNS(null,"id",c)}return b},nodeTypeCompare:function(b,a){return(a==b.nodeName)},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_svgRoot","svg")},createRoot:function(a){return this.nodeFactory(this.container.id+a,"g")},createDefs:function(){var a=this.nodeFactory(this.container.id+"_defs","defs");this.rendererRoot.appendChild(a);return a},drawPoint:function(a,b){return this.drawCircle(a,b,1)},drawCircle:function(d,e,b){var c=this.getResolution();var a=(e.x/c+this.left);var f=(this.top-e.y/c);if(this.inValidRange(a,f)){d.setAttributeNS(null,"cx",a);d.setAttributeNS(null,"cy",f);d.setAttributeNS(null,"r",b);return d}else{return false}},drawLineString:function(b,c){var a=this.getComponentsString(c.components);if(a.path){b.setAttributeNS(null,"points",a.path);return(a.complete?b:null)}else{return false}},drawLinearRing:function(b,c){var a=this.getComponentsString(c.components);if(a.path){b.setAttributeNS(null,"points",a.path);return(a.complete?b:null)}else{return false}},drawPolygon:function(b,h){var g="";var k=true;var a=true;var c,l;for(var e=0,f=h.components.length;e<f;e++){g+=" M";c=this.getComponentsString(h.components[e].components," ");l=c.path;if(l){g+=" "+l;a=c.complete&&a}else{k=false}}g+=" z";if(k){b.setAttributeNS(null,"d",g);b.setAttributeNS(null,"fill-rule","evenodd");return a?b:null}else{return false}},drawRectangle:function(c,d){var b=this.getResolution();var a=(d.x/b+this.left);var e=(this.top-d.y/b);if(this.inValidRange(a,e)){c.setAttributeNS(null,"x",a);c.setAttributeNS(null,"y",e);c.setAttributeNS(null,"width",d.width/b);c.setAttributeNS(null,"height",d.height/b);return c}else{return false}},drawSurface:function(f,h){var g=null;var b=true;for(var e=0,a=h.components.length;e<a;e++){if((e%3)==0&&(e/3)==0){var c=this.getShortString(h.components[e]);if(!c){b=false}g="M "+c}else{if((e%3)==1){var c=this.getShortString(h.components[e]);if(!c){b=false}g+=" C "+c}else{var c=this.getShortString(h.components[e]);if(!c){b=false}g+=" "+c}}}g+=" Z";if(b){f.setAttributeNS(null,"d",g);return f}else{return false}},drawText:function(c,a,k){var b=this.getResolution();var h=(k.x/b+this.left);var e=(k.y/b-this.top);var g=this.nodeFactory(c+this.LABEL_ID_SUFFIX,"text");var f=this.nodeFactory(c+this.LABEL_ID_SUFFIX+"_tspan","tspan");g.setAttributeNS(null,"x",h);g.setAttributeNS(null,"y",-e);g.setAttributeNS(null,"pointer-events","none");if(a.fontColor){g.setAttributeNS(null,"fill",a.fontColor)}if(a.fontFamily){g.setAttributeNS(null,"font-family",a.fontFamily)}if(a.fontSize){g.setAttributeNS(null,"font-size",a.fontSize)}if(a.fontWeight){g.setAttributeNS(null,"font-weight",a.fontWeight)}var d=a.labelAlign||"cm";g.setAttributeNS(null,"text-anchor",OpenLayers.Renderer.SVG.LABEL_ALIGN[d[0]]||"middle");if(this.isGecko){g.setAttributeNS(null,"dominant-baseline",OpenLayers.Renderer.SVG.LABEL_ALIGN[d[1]]||"central")}else{f.setAttributeNS(null,"baseline-shift",OpenLayers.Renderer.SVG.LABEL_VSHIFT[d[1]]||"-35%")}f.textContent=a.label;if(!g.parentNode){g.appendChild(f);this.textRoot.appendChild(g)}},getComponentsString:function(e,d){var g=[];var a=true;var f=e.length;var l=[];var h,k,b;for(var c=0;c<f;c++){k=e[c];g.push(k);h=this.getShortString(k);if(h){l.push(h)}else{if(c>0){if(this.getShortString(e[c-1])){l.push(this.clipLine(e[c],e[c-1]))}}if(c<f-1){if(this.getShortString(e[c+1])){l.push(this.clipLine(e[c],e[c+1]))}}a=false}}return{path:l.join(d||","),complete:a}},clipLine:function(e,h){if(h.equals(e)){return""}var f=this.getResolution();var b=this.MAX_PIXEL-this.translationParameters.x;var a=this.MAX_PIXEL-this.translationParameters.y;var d=h.x/f+this.left;var m=this.top-h.y/f;var c=e.x/f+this.left;var l=this.top-e.y/f;var g;if(c<-b||c>b){g=(l-m)/(c-d);c=c<0?-b:b;l=m+(c-d)*g}if(l<-a||l>a){g=(c-d)/(l-m);l=l<0?-a:a;c=d+(l-m)*g}return c+","+l},getShortString:function(b){var c=this.getResolution();var a=(b.x/c+this.left);var d=(this.top-b.y/c);if(this.inValidRange(a,d)){return a+","+d}else{return false}},getPosition:function(a){return({x:parseFloat(a.getAttributeNS(null,"cx")),y:parseFloat(a.getAttributeNS(null,"cy"))})},importSymbol:function(e){if(!this.defs){this.defs=this.createDefs()}var b=this.container.id+"-"+e;if(document.getElementById(b)!=null){return b}var d=OpenLayers.Renderer.symbol[e];if(!d){throw new Error(e+" is not a valid symbol name");return}var g=this.nodeFactory(b,"symbol");var c=this.nodeFactory(null,"polygon");g.appendChild(c);var o=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0);var l="";var k,h;for(var f=0;f<d.length;f=f+2){k=d[f];h=d[f+1];o.left=Math.min(o.left,k);o.bottom=Math.min(o.bottom,h);o.right=Math.max(o.right,k);o.top=Math.max(o.top,h);l+=" "+k+","+h}c.setAttributeNS(null,"points",l);var a=o.getWidth();var m=o.getHeight();var p=[o.left-a,o.bottom-m,a*3,m*3];g.setAttributeNS(null,"viewBox",p.join(" "));this.symbolSize[b]=Math.max(a,m)*3;this.defs.appendChild(g);return g.id},CLASS_NAME:"OpenLayers.Renderer.SVG"});OpenLayers.Renderer.SVG.LABEL_ALIGN={l:"start",r:"end",b:"bottom",t:"hanging"};OpenLayers.Renderer.SVG.LABEL_VSHIFT={t:"-70%",b:"0"};OpenLayers.Renderer.VML=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"urn:schemas-microsoft-com:vml",symbolCache:{},offset:null,initialize:function(b){if(!this.supported()){return}if(!document.namespaces.olv){document.namespaces.add("olv",this.xmlns);var e=document.createStyleSheet();var c=["shape","rect","oval","fill","stroke","imagedata","group","textbox"];for(var d=0,a=c.length;d<a;d++){e.addRule("olv\\:"+c[d],"behavior: url(#default#VML); position: absolute; display: inline-block;")}}OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments);this.offset={x:0,y:0}},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments)},supported:function(){return !!(document.namespaces)},setExtent:function(k,a){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var c=this.getResolution();var b=k.left/c;var f=k.top/c-this.size.h;if(a){this.offset={x:b,y:f};b=0;f=0}else{b=b-this.offset.x;f=f-this.offset.y}var m=b+" "+f;this.root.coordorigin=m;var h=[this.root,this.vectorRoot,this.textRoot];var g;for(var d=0,e=h.length;d<e;++d){g=h[d];var l=this.size.w+" "+this.size.h;g.coordsize=l}this.root.style.flip="y";return true},setSize:function(f){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);var d=[this.rendererRoot,this.root,this.vectorRoot,this.textRoot];var c=this.size.w+"px";var g=this.size.h+"px";var b;for(var e=0,a=d.length;e<a;++e){b=d[e];b.style.width=c;b.style.height=g}},getNodeType:function(c,b){var a=null;switch(c.CLASS_NAME){case"OpenLayers.Geometry.Point":if(b.externalGraphic){a="olv:rect"}else{if(this.isComplexSymbol(b.graphicName)){a="olv:shape"}else{a="olv:oval"}}break;case"OpenLayers.Geometry.Rectangle":a="olv:rect";break;case"OpenLayers.Geometry.LineString":case"OpenLayers.Geometry.LinearRing":case"OpenLayers.Geometry.Polygon":case"OpenLayers.Geometry.Curve":case"OpenLayers.Geometry.Surface":a="olv:shape";break;default:break}return a},setStyle:function(d,b,s,m){b=b||d._style;s=s||d._options;var k=1;if(d._geometryClass=="OpenLayers.Geometry.Point"){if(b.externalGraphic){if(b.graphicTitle){d.title=b.graphicTitle}var c=b.graphicWidth||b.graphicHeight;var o=b.graphicHeight||b.graphicWidth;c=c?c:b.pointRadius*2;o=o?o:b.pointRadius*2;var f=this.getResolution();var h=(b.graphicXOffset!=undefined)?b.graphicXOffset:-(0.5*c);var e=(b.graphicYOffset!=undefined)?b.graphicYOffset:-(0.5*o);d.style.left=((m.x/f-this.offset.x)+h).toFixed();d.style.top=((m.y/f-this.offset.y)-(e+o)).toFixed();d.style.width=c+"px";d.style.height=o+"px";d.style.flip="y";b.fillColor="none";s.isStroked=false}else{if(this.isComplexSymbol(b.graphicName)){var a=this.importSymbol(b.graphicName);d.path=a.path;d.coordorigin=a.left+","+a.bottom;var r=a.size;d.coordsize=r+","+r;this.drawCircle(d,m,b.pointRadius);d.style.flip="y"}else{this.drawCircle(d,m,b.pointRadius)}}}if(s.isFilled){d.fillcolor=b.fillColor}else{d.filled="false"}var l=d.getElementsByTagName("fill");var q=(l.length==0)?null:l[0];if(!s.isFilled){if(q){d.removeChild(q)}}else{if(!q){q=this.createNode("olv:fill",d.id+"_fill")}q.opacity=b.fillOpacity;if(d._geometryClass=="OpenLayers.Geometry.Point"&&b.externalGraphic){if(b.graphicOpacity){q.opacity=b.graphicOpacity}q.src=b.externalGraphic;q.type="frame";if(!(b.graphicWidth&&b.graphicHeight)){q.aspect="atmost"}}if(q.parentNode!=d){d.appendChild(q)}}if(typeof b.rotation!="undefined"){if(b.externalGraphic){this.graphicRotate(d,h,e);q.opacity=0}else{d.style.rotation=b.rotation}}if(s.isStroked){d.strokecolor=b.strokeColor;d.strokeweight=b.strokeWidth+"px"}else{d.stroked=false}var g=d.getElementsByTagName("stroke");var p=(g.length==0)?null:g[0];if(!s.isStroked){if(p){d.removeChild(p)}}else{if(!p){p=this.createNode("olv:stroke",d.id+"_stroke");d.appendChild(p)}p.opacity=b.strokeOpacity;p.endcap=!b.strokeLinecap||b.strokeLinecap=="butt"?"flat":b.strokeLinecap;p.dashstyle=this.dashStyle(b)}if(b.cursor!="inherit"&&b.cursor!=null){d.style.cursor=b.cursor}return d},graphicRotate:function(q,u,f){var t=t||q._style;var d=q._options;var a,l;if(!(t.graphicWidth&&t.graphicHeight)){var v=new Image();v.onreadystatechange=OpenLayers.Function.bind(function(){if(v.readyState=="complete"||v.readyState=="interactive"){a=v.width/v.height;l=Math.max(t.pointRadius*2,t.graphicWidth||0,t.graphicHeight||0);u=u*a;t.graphicWidth=l*a;t.graphicHeight=l;this.graphicRotate(q,u,f)}},this);v.src=t.externalGraphic;return}else{l=Math.max(t.graphicWidth,t.graphicHeight);a=t.graphicWidth/t.graphicHeight}var p=Math.round(t.graphicWidth||l*a);var m=Math.round(t.graphicHeight||l);q.style.width=p+"px";q.style.height=m+"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=m+"px";o.src=t.externalGraphic;o.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='', sizingMethod='scale')";var r=t.rotation*Math.PI/180;var h=Math.sin(r);var e=Math.cos(r);var g="progid:DXImageTransform.Microsoft.Matrix(M11="+e+",M12="+(-h)+",M21="+h+",M22="+e+",SizingMethod='auto expand')\n";var b=t.graphicOpacity||t.fillOpacity;if(b&&b!=1){g+="progid:DXImageTransform.Microsoft.BasicImage(opacity="+b+")\n"}q.style.filter=g;var s=new OpenLayers.Geometry.Point(-u,-f);var c=new OpenLayers.Bounds(0,0,p,m).toGeometry();c.rotate(t.rotation,s);var k=c.getBounds();q.style.left=Math.round(parseInt(q.style.left)+k.left)+"px";q.style.top=Math.round(parseInt(q.style.top)-k.bottom)+"px"},postDraw:function(a){var c=a._style.fillColor;var b=a._style.strokeColor;if(c=="none"&&a.fillcolor!=c){a.fillcolor=c}if(b=="none"&&a.strokecolor!=b){a.strokecolor=b}},setNodeDimension:function(b,e){var d=e.getBounds();if(d){var a=this.getResolution();var c=new OpenLayers.Bounds((d.left/a-this.offset.x).toFixed(),(d.bottom/a-this.offset.y).toFixed(),(d.right/a-this.offset.x).toFixed(),(d.top/a-this.offset.y).toFixed());b.style.left=c.left+"px";b.style.top=c.top+"px";b.style.width=c.getWidth()+"px";b.style.height=c.getHeight()+"px";b.coordorigin=c.left+" "+c.top;b.coordsize=c.getWidth()+" "+c.getHeight()}},dashStyle:function(a){var c=a.strokeDashstyle;switch(c){case"solid":case"dot":case"dash":case"dashdot":case"longdash":case"longdashdot":return c;default:var b=c.split(/[ ,]/);if(b.length==2){if(1*b[0]>=2*b[1]){return"longdash"}return(b[0]==1||b[1]==1)?"dot":"dash"}else{if(b.length==4){return(1*b[0]>=2*b[1])?"longdashdot":"dashdot"}}return"solid"}},createNode:function(a,c){var b=document.createElement(a);if(c){b.id=c}b.unselectable="on";b.onselectstart=function(){return(false)};return b},nodeTypeCompare:function(c,b){var d=b;var a=d.indexOf(":");if(a!=-1){d=d.substr(a+1)}var e=c.nodeName;a=e.indexOf(":");if(a!=-1){e=e.substr(a+1)}return(d==e)},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_vmlRoot","div")},createRoot:function(a){return this.nodeFactory(this.container.id+a,"olv:group")},drawPoint:function(a,b){return this.drawCircle(a,b,1)},drawCircle:function(d,e,a){if(!isNaN(e.x)&&!isNaN(e.y)){var b=this.getResolution();d.style.left=((e.x/b-this.offset.x).toFixed()-a)+"px";d.style.top=((e.y/b-this.offset.y).toFixed()-a)+"px";var c=a*2;d.style.width=c+"px";d.style.height=c+"px";return d}return false},drawLineString:function(a,b){return this.drawLine(a,b,false)},drawLinearRing:function(a,b){return this.drawLine(a,b,true)},drawLine:function(b,l,g){this.setNodeDimension(b,l);var c=this.getResolution();var a=l.components.length;var e=new Array(a);var h,m,k;for(var f=0;f<a;f++){h=l.components[f];m=(h.x/c-this.offset.x);k=(h.y/c-this.offset.y);e[f]=" "+m.toFixed()+","+k.toFixed()+" l "}var d=(g)?" x e":" e";b.path="m"+e.join("")+d;return b},drawPolygon:function(b,l){this.setNodeDimension(b,l);var c=this.getResolution();var o=[];var f,e,d,h,a,g,m,k;for(d=0,h=l.components.length;d<h;d++){f=l.components[d];o.push("m");for(e=0,a=f.components.length;e<a;e++){g=f.components[e];m=g.x/c-this.offset.x;k=g.y/c-this.offset.y;o.push(" "+m.toFixed()+","+k.toFixed());if(e==0){o.push(" l")}}o.push(" x ")}o.push("e");b.path=o.join("");return b},drawRectangle:function(b,c){var a=this.getResolution();b.style.left=(c.x/a-this.offset.x)+"px";b.style.top=(c.y/a-this.offset.y)+"px";b.style.width=c.width/a+"px";b.style.height=c.height/a+"px";return b},drawText:function(d,a,h){var g=this.nodeFactory(d+this.LABEL_ID_SUFFIX,"olv:rect");var f=this.nodeFactory(d+this.LABEL_ID_SUFFIX+"_textbox","olv:textbox");var c=this.getResolution();g.style.left=(h.x/c-this.offset.x).toFixed()+"px";g.style.top=(h.y/c-this.offset.y).toFixed()+"px";g.style.flip="y";f.innerText=a.label;if(a.fillColor){f.style.color=a.fontColor}if(a.fontFamily){f.style.fontFamily=a.fontFamily}if(a.fontSize){f.style.fontSize=a.fontSize}if(a.fontWeight){f.style.fontWeight=a.fontWeight}f.style.whiteSpace="nowrap";f.inset="1px,0px,0px,0px";if(!g.parentNode){g.appendChild(f);this.textRoot.appendChild(g)}var e=a.labelAlign||"cm";var k=f.clientWidth*(OpenLayers.Renderer.VML.LABEL_SHIFT[e.substr(0,1)]);var b=f.clientHeight*(OpenLayers.Renderer.VML.LABEL_SHIFT[e.substr(1,1)]);g.style.left=parseInt(g.style.left)-k-1+"px";g.style.top=parseInt(g.style.top)+b+"px"},drawSurface:function(a,g){this.setNodeDimension(a,g);var b=this.getResolution();var k=[];var d,h,f;for(var c=0,e=g.components.length;c<e;c++){d=g.components[c];h=d.x/b-this.offset.x;f=d.y/b-this.offset.y;if((c%3)==0&&(c/3)==0){k.push("m")}else{if((c%3)==1){k.push(" c")}}k.push(" "+h+","+f)}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(d){var b=this.container.id+"-"+d;var a=this.symbolCache[b];if(a){return a}var c=OpenLayers.Renderer.symbol[d];if(!c){throw new Error(d+" is not a valid symbol name");return}var h=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0);var e=["m"];for(var f=0;f<c.length;f=f+2){x=c[f];y=c[f+1];h.left=Math.min(h.left,x);h.bottom=Math.min(h.bottom,y);h.right=Math.max(h.right,x);h.top=Math.max(h.top,y);e.push(x);e.push(y);if(f==0){e.push("l")}}e.push("x e");var k=e.join(" ");var g=(h.getWidth()-h.getHeight())/2;if(g>0){h.bottom=h.bottom-g;h.top=h.top+g}else{h.left=h.left-g;h.right=h.right+g}a={path:k,size:h.getWidth(),left:h.left,bottom:h.bottom};this.symbolCache[b]=a;return a},CLASS_NAME:"OpenLayers.Renderer.VML"});OpenLayers.Renderer.VML.LABEL_SHIFT={l:0,c:0.5,r:1,t:0,m:0.5,b:1};OpenLayers.Tile=OpenLayers.Class({EVENT_TYPES:["loadstart","loadend","reload","unload"],events:null,id:null,layer:null,url:null,bounds:null,size:null,position:null,isLoading:false,initialize:function(d,a,e,b,c){this.layer=d;this.position=a.clone();this.bounds=e.clone();this.url=b;this.size=c.clone();this.id=OpenLayers.Util.createUniqueID("Tile_");this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES)},unload:function(){if(this.isLoading){this.isLoading=false;this.events.triggerEvent("unload")}},destroy:function(){this.layer=null;this.bounds=null;this.size=null;this.position=null;this.events.destroy();this.events=null},clone:function(a){if(a==null){a=new OpenLayers.Tile(this.layer,this.position,this.bounds,this.url,this.size)}OpenLayers.Util.applyDefaults(a,this);return a},draw:function(){var a=this.layer.maxExtent;var b=(a&&this.bounds.intersectsBounds(a,false));this.shouldDraw=(b||this.layer.displayOutsideMaxExtent);this.clear();return this.shouldDraw},moveTo:function(b,a,c){if(c==null){c=true}this.bounds=b.clone();this.position=a.clone();if(c){this.draw()}},clear:function(){},getBoundsFromBaseLayer:function(a){var f=OpenLayers.i18n("reprojectDeprecated",{layerName:this.layer.name});OpenLayers.Console.warn(f);var d=this.layer.map.getLonLatFromLayerPx(a);var c=a.clone();c.x+=this.size.w;c.y+=this.size.h;var b=this.layer.map.getLonLatFromLayerPx(c);if(d.lon>b.lon){if(d.lon<0){d.lon=-180-(d.lon+180)}else{b.lon=180+b.lon+180}}var e=new OpenLayers.Bounds(d.lon,b.lat,b.lon,d.lat);return e},showTile:function(){if(this.shouldDraw){this.show()}},show:function(){},hide:function(){},CLASS_NAME:"OpenLayers.Tile"});OpenLayers.Handler=OpenLayers.Class({id:null,control:null,map:null,keyMask:null,active:false,evt:null,initialize:function(c,b,a){OpenLayers.Util.extend(this,a);this.control=c;this.callbacks=b;if(c.map){this.setMap(c.map)}OpenLayers.Util.extend(this,a);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},setMap:function(a){this.map=a},checkModifiers:function(a){if(this.keyMask==null){return true}var b=(a.shiftKey?OpenLayers.Handler.MOD_SHIFT:0)|(a.ctrlKey?OpenLayers.Handler.MOD_CTRL:0)|(a.altKey?OpenLayers.Handler.MOD_ALT:0);return(b==this.keyMask)},activate:function(){if(this.active){return false}var c=OpenLayers.Events.prototype.BROWSER_EVENTS;for(var b=0,a=c.length;b<a;b++){if(this[c[b]]){this.register(c[b],this[c[b]])}}this.active=true;return true},deactivate:function(){if(!this.active){return false}var c=OpenLayers.Events.prototype.BROWSER_EVENTS;for(var b=0,a=c.length;b<a;b++){if(this[c[b]]){this.unregister(c[b],this[c[b]])}}this.active=false;return true},callback:function(b,a){if(b&&this.callbacks[b]){this.callbacks[b].apply(this.control,a)}},register:function(a,b){this.map.events.registerPriority(a,this,b);this.map.events.registerPriority(a,this,this.setEvent)},unregister:function(a,b){this.map.events.unregister(a,this,b);this.map.events.unregister(a,this,this.setEvent)},setEvent:function(a){this.evt=a;return true},destroy:function(){this.deactivate();this.control=this.map=null},CLASS_NAME:"OpenLayers.Handler"});OpenLayers.Handler.MOD_NONE=0;OpenLayers.Handler.MOD_SHIFT=1;OpenLayers.Handler.MOD_CTRL=2;OpenLayers.Handler.MOD_ALT=4;OpenLayers.Map=OpenLayers.Class({Z_INDEX_BASE:{BaseLayer:100,Overlay:325,Feature:725,Popup:750,Control:1000},EVENT_TYPES:["preaddlayer","addlayer","removelayer","changelayer","movestart","move","moveend","zoomend","popupopen","popupclose","addmarker","removemarker","clearmarkers","mouseover","mouseout","mousemove","dragstart","drag","dragend","changebaselayer"],id:null,fractionalZoom:false,events:null,allOverlays:false,div:null,dragging:false,size:null,viewPortDiv:null,layerContainerOrigin:null,layerContainerDiv:null,layers:null,controls:null,popups:null,baseLayer:null,center:null,resolution:null,zoom:0,panRatio:1.5,viewRequestID:0,tileSize:null,projection:"EPSG:4326",units:"degrees",resolutions:null,maxResolution:1.40625,minResolution:null,maxScale:null,minScale:null,maxExtent:null,minExtent:null,restrictedExtent:null,numZoomLevels:16,theme:null,displayProjection:null,fallThrough:true,panTween:null,eventListeners:null,panMethod:OpenLayers.Easing.Expo.easeOut,panDuration:50,paddingForPopups:null,initialize:function(h,d){if(arguments.length===1&&typeof h==="object"){d=h;h=d&&d.div}this.tileSize=new OpenLayers.Size(OpenLayers.Map.TILE_WIDTH,OpenLayers.Map.TILE_HEIGHT);this.maxExtent=new OpenLayers.Bounds(-180,-90,180,90);this.paddingForPopups=new OpenLayers.Bounds(15,15,15,15);this.theme=OpenLayers._getScriptLocation()+"theme/default/style.css";OpenLayers.Util.extend(this,d);this.id=OpenLayers.Util.createUniqueID("OpenLayers.Map_");this.div=OpenLayers.Util.getElement(h);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 g=this.div.id+"_OpenLayers_ViewPort";this.viewPortDiv=OpenLayers.Util.createDiv(g,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);g=this.div.id+"_OpenLayers_Container";this.layerContainerDiv=OpenLayers.Util.createDiv(g);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 f=true;var c=document.getElementsByTagName("link");for(var e=0,a=c.length;e<a;++e){if(OpenLayers.Util.isEquivalentUrl(c.item(e).href,this.theme)){f=false;break}}if(f){var b=document.createElement("link");b.setAttribute("rel","stylesheet");b.setAttribute("type","text/css");b.setAttribute("href",this.theme);document.getElementsByTagName("head")[0].appendChild(b)}}this.layers=[];if(this.controls==null){if(OpenLayers.Control!=null){this.controls=[new OpenLayers.Control.Navigation(),new OpenLayers.Control.PanZoom(),new OpenLayers.Control.ArgParser(),new OpenLayers.Control.Attribution()]}else{this.controls=[]}}for(var e=0,a=this.controls.length;e<a;e++){this.addControlToMap(this.controls[e])}this.popups=[];this.unloadDestroy=OpenLayers.Function.bind(this.destroy,this);OpenLayers.Event.observe(window,"unload",this.unloadDestroy)},render:function(a){this.div=OpenLayers.Util.getElement(a);OpenLayers.Element.addClass(this.div,"olMap");this.events.attachToElement(this.div);this.viewPortDiv.parentNode.removeChild(this.viewPortDiv);this.div.appendChild(this.viewPortDiv);this.updateSize()},unloadDestroy:null,updateSizeDestroy:null,destroy:function(){if(!this.unloadDestroy){return false}OpenLayers.Event.stopObserving(window,"unload",this.unloadDestroy);this.unloadDestroy=null;if(this.updateSizeDestroy){OpenLayers.Event.stopObserving(window,"resize",this.updateSizeDestroy)}else{this.events.unregister("resize",this,this.updateSize)}this.paddingForPopups=null;if(this.controls!=null){for(var a=this.controls.length-1;a>=0;--a){this.controls[a].destroy()}this.controls=null}if(this.layers!=null){for(var a=this.layers.length-1;a>=0;--a){this.layers[a].destroy(false)}this.layers=null}if(this.viewPortDiv){this.div.removeChild(this.viewPortDiv)}this.viewPortDiv=null;if(this.eventListeners){this.events.un(this.eventListeners);this.eventListeners=null}this.events.destroy();this.events=null},setOptions:function(a){OpenLayers.Util.extend(this,a)},getTileSize:function(){return this.tileSize},getBy:function(e,c,a){var d=(typeof a.test=="function");var b=OpenLayers.Array.filter(this[e],function(f){return f[c]==a||(d&&a.test(f[c]))});return b},getLayersBy:function(b,a){return this.getBy("layers",b,a)},getLayersByName:function(a){return this.getLayersBy("name",a)},getLayersByClass:function(a){return this.getLayersBy("CLASS_NAME",a)},getControlsBy:function(b,a){return this.getBy("controls",b,a)},getControlsByClass:function(a){return this.getControlsBy("CLASS_NAME",a)},getLayer:function(e){var b=null;for(var d=0,a=this.layers.length;d<a;d++){var c=this.layers[d];if(c.id==e){b=c;break}}return b},setLayerZIndex:function(b,a){b.setZIndex(this.Z_INDEX_BASE[b.isBaseLayer?"BaseLayer":"Overlay"]+a*5)},resetLayersZIndex:function(){for(var c=0,a=this.layers.length;c<a;c++){var b=this.layers[c];this.setLayerZIndex(b,c)}},addLayer:function(c){for(var b=0,a=this.layers.length;b<a;b++){if(this.layers[b]==c){var d=OpenLayers.i18n("layerAlreadyAdded",{layerName:c.name});OpenLayers.Console.warn(d);return false}}if(this.allOverlays){c.isBaseLayer=false}this.events.triggerEvent("preaddlayer",{layer:c});c.div.className="olLayerDiv";c.div.style.overflow="";this.setLayerZIndex(c,this.layers.length);if(c.isFixed){this.viewPortDiv.appendChild(c.div)}else{this.layerContainerDiv.appendChild(c.div)}this.layers.push(c);c.setMap(this);if(c.isBaseLayer||(this.allOverlays&&!this.baseLayer)){if(this.baseLayer==null){this.setBaseLayer(c)}else{c.setVisibility(false)}}else{c.redraw()}this.events.triggerEvent("addlayer",{layer:c});c.afterAdd()},addLayers:function(c){for(var b=0,a=c.length;b<a;b++){this.addLayer(c[b])}},removeLayer:function(c,e){if(e==null){e=true}if(c.isFixed){this.viewPortDiv.removeChild(c.div)}else{this.layerContainerDiv.removeChild(c.div)}OpenLayers.Util.removeItem(this.layers,c);c.removeMap(this);c.map=null;if(this.baseLayer==c){this.baseLayer=null;if(e){for(var b=0,a=this.layers.length;b<a;b++){var d=this.layers[b];if(d.isBaseLayer||this.allOverlays){this.setBaseLayer(d);break}}}}this.resetLayersZIndex();this.events.triggerEvent("removelayer",{layer:c})},getNumLayers:function(){return this.layers.length},getLayerIndex:function(a){return OpenLayers.Util.indexOf(this.layers,a)},setLayerIndex:function(d,b){var e=this.getLayerIndex(d);if(b<0){b=0}else{if(b>this.layers.length){b=this.layers.length}}if(e!=b){this.layers.splice(e,1);this.layers.splice(b,0,d);for(var c=0,a=this.layers.length;c<a;c++){this.setLayerZIndex(this.layers[c],c)}this.events.triggerEvent("changelayer",{layer:d,property:"order"});if(this.allOverlays){if(b===0){this.setBaseLayer(d)}else{if(this.baseLayer!==this.layers[0]){this.setBaseLayer(this.layers[0])}}}}},raiseLayer:function(b,c){var a=this.getLayerIndex(b)+c;this.setLayerIndex(b,a)},setBaseLayer:function(e){var d=null;if(this.baseLayer){d=this.baseLayer.getExtent()}if(e!=this.baseLayer){if(OpenLayers.Util.indexOf(this.layers,e)!=-1){if(this.baseLayer!=null&&!this.allOverlays){this.baseLayer.setVisibility(false)}this.baseLayer=e;this.viewRequestID++;if(!this.allOverlays){this.baseLayer.visibility=true}var a=this.getCenter();if(a!=null){var b=(d)?d.getCenterLonLat():a;var c=(d)?this.getZoomForExtent(d,true):this.getZoomForResolution(this.resolution,true);this.setCenter(b,c,false,true)}this.events.triggerEvent("changebaselayer",{layer:this.baseLayer})}}},addControl:function(b,a){this.controls.push(b);this.addControlToMap(b,a)},addControlToMap:function(b,a){b.outsideViewport=(b.div!=null);if(this.displayProjection&&!b.displayProjection){b.displayProjection=this.displayProjection}b.setMap(this);var c=b.draw(a);if(c){if(!b.outsideViewport){c.style.zIndex=this.Z_INDEX_BASE.Control+this.controls.length;this.viewPortDiv.appendChild(c)}}},getControl:function(e){var b=null;for(var c=0,a=this.controls.length;c<a;c++){var d=this.controls[c];if(d.id==e){b=d;break}}return b},removeControl:function(a){if((a)&&(a==this.getControl(a.id))){if(a.div&&(a.div.parentNode==this.viewPortDiv)){this.viewPortDiv.removeChild(a.div)}OpenLayers.Util.removeItem(this.controls,a)}},addPopup:function(a,d){if(d){for(var b=this.popups.length-1;b>=0;--b){this.removePopup(this.popups[b])}}a.map=this;this.popups.push(a);var c=a.draw();if(c){c.style.zIndex=this.Z_INDEX_BASE.Popup+this.popups.length;this.layerContainerDiv.appendChild(c)}},removePopup:function(a){OpenLayers.Util.removeItem(this.popups,a);if(a.div){try{this.layerContainerDiv.removeChild(a.div)}catch(b){}}a.map=null},getSize:function(){var a=null;if(this.size!=null){a=this.size.clone()}return a},updateSize:function(){this.events.clearMouseCache();var c=this.getCurrentSize();var f=this.getSize();if(f==null){this.size=f=c}if(!c.equals(f)){this.size=c;for(var d=0,b=this.layers.length;d<b;d++){this.layers[d].onMapResize()}if(this.baseLayer!=null){var a=new OpenLayers.Pixel(c.w/2,c.h/2);var g=this.getLonLatFromViewPortPx(a);var e=this.getZoom();this.zoom=null;this.setCenter(this.getCenter(),e)}}},getCurrentSize:function(){var a=new OpenLayers.Size(this.div.clientWidth,this.div.clientHeight);if(a.w==0&&a.h==0||isNaN(a.w)&&isNaN(a.h)){var b=OpenLayers.Element.getDimensions(this.div);a.w=b.width;a.h=b.height}if(a.w==0&&a.h==0||isNaN(a.w)&&isNaN(a.h)){a.w=parseInt(this.div.style.width);a.h=parseInt(this.div.style.height)}return a},calculateBounds:function(a,b){var e=null;if(a==null){a=this.getCenter()}if(b==null){b=this.getResolution()}if((a!=null)&&(b!=null)){var d=this.getSize();var f=d.w*b;var c=d.h*b;e=new OpenLayers.Bounds(a.lon-f/2,a.lat-c/2,a.lon+f/2,a.lat+c/2)}return e},getCenter:function(){var a=null;if(this.center){a=this.center.clone()}return a},getZoom:function(){return this.zoom},pan:function(d,c,e){e=OpenLayers.Util.applyDefaults(e,{animate:true,dragging:false});var f=this.getViewPortPxFromLonLat(this.getCenter());var b=f.add(d,c);if(!e.dragging||!b.equals(f)){var a=this.getLonLatFromViewPortPx(b);if(e.animate){this.panTo(a)}else{this.setCenter(a,null,e.dragging)}}},panTo:function(b){if(this.panMethod&&this.getExtent().scale(this.panRatio).containsLonLat(b)){if(!this.panTween){this.panTween=new OpenLayers.Tween(this.panMethod)}var a=this.getCenter();if(b.lon==a.lon&&b.lat==a.lat){return}var d={lon:a.lon,lat:a.lat};var c={lon:b.lon,lat:b.lat};this.panTween.start(d,c,this.panDuration,{callbacks:{start:OpenLayers.Function.bind(function(e){this.events.triggerEvent("movestart")},this),eachStep:OpenLayers.Function.bind(function(e){e=new OpenLayers.LonLat(e.lon,e.lat);this.moveTo(e,this.zoom,{dragging:true,noEvent:true})},this),done:OpenLayers.Function.bind(function(e){e=new OpenLayers.LonLat(e.lon,e.lat);this.moveTo(e,this.zoom,{noEvent:true});this.events.triggerEvent("moveend")},this)}})}else{this.setCenter(b)}},setCenter:function(c,a,b,d){this.moveTo(c,a,{dragging:b,forceZoomChange:d,caller:"setCenter"})},moveTo:function(g,p,s){if(!s){s={}}var o=s.dragging;var c=s.forceZoomChange;var h=s.noEvent;if(this.panTween&&s.caller=="setCenter"){this.panTween.stop()}if(!this.center&&!this.isValidLonLat(g)){g=this.maxExtent.getCenterLonLat()}if(this.restrictedExtent!=null){if(g==null){g=this.getCenter()}if(p==null){p=this.getZoom()}var d=this.getResolutionForZoom(p);var q=this.calculateBounds(g,d);if(!this.restrictedExtent.containsBounds(q)){var r=this.restrictedExtent.getCenterLonLat();if(q.getWidth()>this.restrictedExtent.getWidth()){g=new OpenLayers.LonLat(r.lon,g.lat)}else{if(q.left<this.restrictedExtent.left){g=g.add(this.restrictedExtent.left-q.left,0)}else{if(q.right>this.restrictedExtent.right){g=g.add(this.restrictedExtent.right-q.right,0)}}}if(q.getHeight()>this.restrictedExtent.getHeight()){g=new OpenLayers.LonLat(g.lon,r.lat)}else{if(q.bottom<this.restrictedExtent.bottom){g=g.add(0,this.restrictedExtent.bottom-q.bottom)}else{if(q.top>this.restrictedExtent.top){g=g.add(0,this.restrictedExtent.top-q.top)}}}}}var b=c||((this.isValidZoomLevel(p))&&(p!=this.getZoom()));var e=(this.isValidLonLat(g))&&(!g.equals(this.center));if(b||e||!o){if(!this.dragging&&!h){this.events.triggerEvent("movestart")}if(e){if((!b)&&(this.center)){this.centerLayerContainer(g)}this.center=g.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=p;this.resolution=this.getResolutionForZoom(p);this.viewRequestID++}var a=this.getExtent();if(this.baseLayer.visibility){this.baseLayer.moveTo(a,b,o);if(o){this.baseLayer.events.triggerEvent("move")}else{this.baseLayer.events.triggerEvent("moveend",{zoomChanged:b})}}a=this.baseLayer.getExtent();for(var f=0,l=this.layers.length;f<l;f++){var k=this.layers[f];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,o);if(o){k.events.triggerEvent("move")}else{k.events.triggerEvent("moveend",{zoomChanged:b})}}}}if(b){for(var f=0,l=this.popups.length;f<l;f++){this.popups[f].updatePosition()}}this.events.triggerEvent("move");if(b){this.events.triggerEvent("zoomend")}}if(!o&&!h){this.events.triggerEvent("moveend")}this.dragging=!!o},centerLayerContainer:function(b){var a=this.getViewPortPxFromLonLat(this.layerContainerOrigin);var c=this.getViewPortPxFromLonLat(b);if((a!=null)&&(c!=null)){this.layerContainerDiv.style.left=Math.round(a.x-c.x)+"px";this.layerContainerDiv.style.top=Math.round(a.y-c.y)+"px"}},isValidZoomLevel:function(a){return((a!=null)&&(a>=0)&&(a<this.getNumZoomLevels()))},isValidLonLat:function(c){var b=false;if(c!=null){var a=this.getMaxExtent();b=a.containsLonLat(c)}return b},getProjection:function(){var a=this.getProjectionObject();return a?a.getCode():null},getProjectionObject:function(){var a=null;if(this.baseLayer!=null){a=this.baseLayer.projection}return a},getMaxResolution:function(){var a=null;if(this.baseLayer!=null){a=this.baseLayer.maxResolution}return a},getMaxExtent:function(b){var a=null;if(b&&b.restricted&&this.restrictedExtent){a=this.restrictedExtent}else{if(this.baseLayer!=null){a=this.baseLayer.maxExtent}}return a},getNumZoomLevels:function(){var a=null;if(this.baseLayer!=null){a=this.baseLayer.numZoomLevels}return a},getExtent:function(){var a=null;if(this.baseLayer!=null){a=this.baseLayer.getExtent()}return a},getResolution:function(){var a=null;if(this.baseLayer!=null){a=this.baseLayer.getResolution()}return a},getUnits:function(){var a=null;if(this.baseLayer!=null){a=this.baseLayer.units}return a},getScale:function(){var c=null;if(this.baseLayer!=null){var b=this.getResolution();var a=this.baseLayer.units;c=OpenLayers.Util.getScaleFromResolution(b,a)}return c},getZoomForExtent:function(c,b){var a=null;if(this.baseLayer!=null){a=this.baseLayer.getZoomForExtent(c,b)}return a},getResolutionForZoom:function(b){var a=null;if(this.baseLayer){a=this.baseLayer.getResolutionForZoom(b)}return a},getZoomForResolution:function(a,c){var b=null;if(this.baseLayer!=null){b=this.baseLayer.getZoomForResolution(a,c)}return b},zoomTo:function(a){if(this.isValidZoomLevel(a)){this.setCenter(null,a)}},zoomIn:function(){this.zoomTo(this.getZoom()+1)},zoomOut:function(){this.zoomTo(this.getZoom()-1)},zoomToExtent:function(d,c){var b=d.getCenterLonLat();if(this.baseLayer.wrapDateLine){var a=this.getMaxExtent();d=d.clone();while(d.right<d.left){d.right+=a.getWidth()}b=d.getCenterLonLat().wrapDateLine(a)}this.setCenter(b,this.getZoomForExtent(d,c))},zoomToMaxExtent:function(c){var b=(c)?c.restricted:true;var a=this.getMaxExtent({restricted:b});this.zoomToExtent(a)},zoomToScale:function(h,g){var d=OpenLayers.Util.getResolutionFromScale(h,this.baseLayer.units);var c=this.getSize();var f=c.w*d;var b=c.h*d;var a=this.getCenter();var e=new OpenLayers.Bounds(a.lon-f/2,a.lat-b/2,a.lon+f/2,a.lat+b/2);this.zoomToExtent(e,g)},getLonLatFromViewPortPx:function(a){var b=null;if(this.baseLayer!=null){b=this.baseLayer.getLonLatFromViewPortPx(a)}return b},getViewPortPxFromLonLat:function(b){var a=null;if(this.baseLayer!=null){a=this.baseLayer.getViewPortPxFromLonLat(b)}return a},getLonLatFromPixel:function(a){return this.getLonLatFromViewPortPx(a)},getPixelFromLonLat:function(b){var a=this.getViewPortPxFromLonLat(b);a.x=Math.round(a.x);a.y=Math.round(a.y);return a},getViewPortPxFromLayerPx:function(d){var c=null;if(d!=null){var b=parseInt(this.layerContainerDiv.style.left);var a=parseInt(this.layerContainerDiv.style.top);c=d.add(b,a)}return c},getLayerPxFromViewPortPx:function(c){var d=null;if(c!=null){var b=-parseInt(this.layerContainerDiv.style.left);var a=-parseInt(this.layerContainerDiv.style.top);d=c.add(b,a);if(isNaN(d.x)||isNaN(d.y)){d=null}}return d},getLonLatFromLayerPx:function(a){a=this.getViewPortPxFromLayerPx(a);return this.getLonLatFromViewPortPx(a)},getLayerPxFromLonLat:function(b){var a=this.getPixelFromLonLat(b);return this.getLayerPxFromViewPortPx(a)},CLASS_NAME:"OpenLayers.Map"});OpenLayers.Map.TILE_WIDTH=256;OpenLayers.Map.TILE_HEIGHT=256;OpenLayers.Marker=OpenLayers.Class({icon:null,lonlat:null,events:null,map:null,initialize:function(c,b){this.lonlat=c;var a=(b)?b:OpenLayers.Marker.defaultIcon();if(this.icon==null){this.icon=a}else{this.icon.url=a.url;this.icon.size=a.size;this.icon.offset=a.offset;this.icon.calculateOffset=a.calculateOffset}this.events=new OpenLayers.Events(this,this.icon.imageDiv,null)},destroy:function(){this.erase();this.map=null;this.events.destroy();this.events=null;if(this.icon!=null){this.icon.destroy();this.icon=null}},draw:function(a){return this.icon.draw(a)},erase:function(){if(this.icon!=null){this.icon.erase()}},moveTo:function(a){if((a!=null)&&(this.icon!=null)){this.icon.moveTo(a)}this.lonlat=this.map.getLonLatFromLayerPx(a)},isDrawn:function(){var a=(this.icon&&this.icon.isDrawn());return a},onScreen:function(){var b=false;if(this.map){var a=this.map.getExtent();b=a.containsLonLat(this.lonlat)}return b},inflate:function(b){if(this.icon){var a=new OpenLayers.Size(this.icon.size.w*b,this.icon.size.h*b);this.icon.setSize(a)}},setOpacity:function(a){this.icon.setOpacity(a)},setUrl:function(a){this.icon.setUrl(a)},display:function(a){this.icon.display(a)},CLASS_NAME:"OpenLayers.Marker"});OpenLayers.Marker.defaultIcon=function(){var a=OpenLayers.Util.getImagesLocation()+"marker.png";var b=new OpenLayers.Size(21,25);var c=function(d){return new OpenLayers.Pixel(-(d.w/2),-d.h)};return new OpenLayers.Icon(a,b,null,c)};OpenLayers.Popup.FramedCloud=OpenLayers.Class(OpenLayers.Popup.Framed,{contentDisplayClass:"olFramedCloudPopupContent",autoSize:true,panMapIfOutOfView:true,imageSize:new OpenLayers.Size(676,736),isAlphaImage:false,fixedRelativePosition:false,positionBlocks:{tl:{offset:new OpenLayers.Pixel(44,0),padding:new OpenLayers.Bounds(8,40,8,9),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,51,22,0),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,50,0,0),position:new OpenLayers.Pixel(-638,0)},{size:new OpenLayers.Size("auto",19),anchor:new OpenLayers.Bounds(0,32,22,null),position:new OpenLayers.Pixel(0,-631)},{size:new OpenLayers.Size(22,18),anchor:new OpenLayers.Bounds(null,32,0,null),position:new OpenLayers.Pixel(-638,-632)},{size:new OpenLayers.Size(81,35),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(0,-688)}]},tr:{offset:new OpenLayers.Pixel(-45,0),padding:new OpenLayers.Bounds(8,40,8,9),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,51,22,0),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,50,0,0),position:new OpenLayers.Pixel(-638,0)},{size:new OpenLayers.Size("auto",19),anchor:new OpenLayers.Bounds(0,32,22,null),position:new OpenLayers.Pixel(0,-631)},{size:new OpenLayers.Size(22,19),anchor:new OpenLayers.Bounds(null,32,0,null),position:new OpenLayers.Pixel(-638,-631)},{size:new OpenLayers.Size(81,35),anchor:new OpenLayers.Bounds(0,0,null,null),position:new OpenLayers.Pixel(-215,-687)}]},bl:{offset:new OpenLayers.Pixel(45,0),padding:new OpenLayers.Bounds(8,9,8,40),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,21,22,32),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,21,0,32),position:new OpenLayers.Pixel(-638,0)},{size:new OpenLayers.Size("auto",21),anchor:new OpenLayers.Bounds(0,0,22,null),position:new OpenLayers.Pixel(0,-629)},{size:new OpenLayers.Size(22,21),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(-638,-629)},{size:new OpenLayers.Size(81,33),anchor:new OpenLayers.Bounds(null,null,0,0),position:new OpenLayers.Pixel(-101,-674)}]},br:{offset:new OpenLayers.Pixel(-44,0),padding:new OpenLayers.Bounds(8,9,8,40),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,21,22,32),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,21,0,32),position:new OpenLayers.Pixel(-638,0)},{size:new OpenLayers.Size("auto",21),anchor:new OpenLayers.Bounds(0,0,22,null),position:new OpenLayers.Pixel(0,-629)},{size:new OpenLayers.Size(22,21),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(-638,-629)},{size:new OpenLayers.Size(81,33),anchor:new OpenLayers.Bounds(0,null,null,0),position:new OpenLayers.Pixel(-311,-674)}]}},minSize:new OpenLayers.Size(105,10),maxSize:new OpenLayers.Size(600,660),initialize:function(g,c,f,b,a,e,d){this.imageSrc=OpenLayers.Util.getImagesLocation()+"cloud-popup-relative.png";OpenLayers.Popup.Framed.prototype.initialize.apply(this,arguments);this.contentDiv.className=this.contentDisplayClass},destroy:function(){OpenLayers.Popup.Framed.prototype.destroy.apply(this,arguments)},CLASS_NAME:"OpenLayers.Popup.FramedCloud"});OpenLayers.Tile.Image=OpenLayers.Class(OpenLayers.Tile,{url:null,imgDiv:null,frame:null,layerAlphaHack:null,isBackBuffer:false,lastRatio:1,isFirstDraw:true,backBufferTile:null,initialize:function(d,a,e,b,c){OpenLayers.Tile.prototype.initialize.apply(this,arguments);this.url=b;this.frame=document.createElement("div");this.frame.style.overflow="hidden";this.frame.style.position="absolute";this.layerAlphaHack=this.layer.alpha&&OpenLayers.Util.alphaHack()},destroy:function(){if(this.imgDiv!=null){if(this.layerAlphaHack){OpenLayers.Event.stopObservingElement(this.imgDiv.childNodes[0].id)}OpenLayers.Event.stopObservingElement(this.imgDiv.id);if(this.imgDiv.parentNode==this.frame){this.frame.removeChild(this.imgDiv);this.imgDiv.map=null}this.imgDiv.urls=null;this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif"}this.imgDiv=null;if((this.frame!=null)&&(this.frame.parentNode==this.layer.div)){this.layer.div.removeChild(this.frame)}this.frame=null;if(this.backBufferTile){this.backBufferTile.destroy();this.backBufferTile=null}this.layer.events.unregister("loadend",this,this.resetBackBuffer);OpenLayers.Tile.prototype.destroy.apply(this,arguments)},clone:function(a){if(a==null){a=new OpenLayers.Tile.Image(this.layer,this.position,this.bounds,this.url,this.size)}a=OpenLayers.Tile.prototype.clone.apply(this,[a]);a.imgDiv=null;return a},draw:function(){if(this.layer!=this.layer.map.baseLayer&&this.layer.reproject){this.bounds=this.getBoundsFromBaseLayer(this.position)}var a=OpenLayers.Tile.prototype.draw.apply(this,arguments);if(OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1){if(a){if(!this.backBufferTile){this.backBufferTile=this.clone();this.backBufferTile.hide();this.backBufferTile.isBackBuffer=true;this.events.register("loadend",this,this.resetBackBuffer);this.layer.events.register("loadend",this,this.resetBackBuffer)}this.startTransition()}else{if(this.backBufferTile){this.backBufferTile.clear()}}}else{if(a&&this.isFirstDraw){this.events.register("loadend",this,this.showTile);this.isFirstDraw=false}}if(!a){return false}if(this.isLoading){this.events.triggerEvent("reload")}else{this.isLoading=true;this.events.triggerEvent("loadstart")}return this.renderTile()},resetBackBuffer:function(){this.showTile();if(this.backBufferTile&&(this.isFirstDraw||!this.layer.numLoadingTiles)){this.isFirstDraw=false;var a=this.layer.maxExtent;var b=(a&&this.bounds.intersectsBounds(a,false));if(b){this.backBufferTile.position=this.position;this.backBufferTile.bounds=this.bounds;this.backBufferTile.size=this.size;this.backBufferTile.imageSize=this.layer.imageSize||this.size;this.backBufferTile.imageOffset=this.layer.imageOffset;this.backBufferTile.resolution=this.layer.getResolution();this.backBufferTile.renderTile()}this.backBufferTile.hide()}},renderTile:function(){if(this.imgDiv==null){this.initImgDiv()}this.imgDiv.viewRequestID=this.layer.map.viewRequestID;if(this.layer.async){this.layer.getURLasync(this.bounds,this,"url",this.positionImage)}else{if(this.layer.url instanceof Array){this.imgDiv.urls=this.layer.url.slice()}this.url=this.layer.getURL(this.bounds);this.positionImage()}return true},positionImage:function(){if(this.layer==null){return}OpenLayers.Util.modifyDOMElement(this.frame,null,this.position,this.size);var a=this.layer.getImageSize();if(this.layerAlphaHack){OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv,null,null,a,this.url)}else{OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,a);this.imgDiv.src=this.url}},clear:function(){if(this.imgDiv){this.hide();if(OpenLayers.Tile.Image.useBlankTile){this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif"}}},initImgDiv:function(){var d=this.layer.imageOffset;var b=this.layer.getImageSize();if(this.layerAlphaHack){this.imgDiv=OpenLayers.Util.createAlphaImageDiv(null,d,b,null,"relative",null,null,null,true)}else{this.imgDiv=OpenLayers.Util.createImage(null,d,b,null,"relative",null,null,true)}this.imgDiv.className="olTileImage";this.frame.style.zIndex=this.isBackBuffer?0:1;this.frame.appendChild(this.imgDiv);this.layer.div.appendChild(this.frame);if(this.layer.opacity!=null){OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,null,null,null,null,this.layer.opacity)}this.imgDiv.map=this.layer.map;var c=function(){if(this.isLoading){this.isLoading=false;this.events.triggerEvent("loadend")}};if(this.layerAlphaHack){OpenLayers.Event.observe(this.imgDiv.childNodes[0],"load",OpenLayers.Function.bind(c,this))}else{OpenLayers.Event.observe(this.imgDiv,"load",OpenLayers.Function.bind(c,this))}var a=function(){if(this.imgDiv._attempts>OpenLayers.IMAGE_RELOAD_ATTEMPTS){c.call(this)}};OpenLayers.Event.observe(this.imgDiv,"error",OpenLayers.Function.bind(a,this))},checkImgURL:function(){if(this.layer){var a=this.layerAlphaHack?this.imgDiv.firstChild.src:this.imgDiv.src;if(!OpenLayers.Util.isEquivalentUrl(a,this.url)){this.hide()}}},startTransition:function(){if(!this.backBufferTile||!this.backBufferTile.imgDiv){return}var d=1;if(this.backBufferTile.resolution){d=this.backBufferTile.resolution/this.layer.getResolution()}if(d!=this.lastRatio){if(this.layer.transitionEffect=="resize"){var c=new OpenLayers.LonLat(this.backBufferTile.bounds.left,this.backBufferTile.bounds.top);var b=new OpenLayers.Size(this.backBufferTile.size.w*d,this.backBufferTile.size.h*d);var a=this.layer.map.getLayerPxFromLonLat(c);OpenLayers.Util.modifyDOMElement(this.backBufferTile.frame,null,a,b);var e=this.backBufferTile.imageSize;e=new OpenLayers.Size(e.w*d,e.h*d);var f=this.backBufferTile.imageOffset;if(f){f=new OpenLayers.Pixel(f.x*d,f.y*d)}OpenLayers.Util.modifyDOMElement(this.backBufferTile.imgDiv,null,f,e);this.backBufferTile.show()}}else{if(this.layer.singleTile){this.backBufferTile.show()}else{this.backBufferTile.hide()}}this.lastRatio=d},show:function(){this.frame.style.display="";if(OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1){if(navigator.userAgent.toLowerCase().indexOf("gecko")!=-1){this.frame.scrollLeft=this.frame.scrollLeft}}},hide:function(){this.frame.style.display="none"},CLASS_NAME:"OpenLayers.Tile.Image"});OpenLayers.Tile.Image.useBlankTile=(OpenLayers.Util.getBrowserName()=="safari"||OpenLayers.Util.getBrowserName()=="opera");OpenLayers.Feature=OpenLayers.Class({layer:null,id:null,lonlat:null,data:null,marker:null,popupClass:OpenLayers.Popup.AnchoredBubble,popup:null,initialize:function(a,c,b){this.layer=a;this.lonlat=c;this.data=(b!=null)?b:{};this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){if((this.layer!=null)&&(this.layer.map!=null)){if(this.popup!=null){this.layer.map.removePopup(this.popup)}}this.layer=null;this.id=null;this.lonlat=null;this.data=null;if(this.marker!=null){this.destroyMarker(this.marker);this.marker=null}if(this.popup!=null){this.destroyPopup(this.popup);this.popup=null}},onScreen:function(){var b=false;if((this.layer!=null)&&(this.layer.map!=null)){var a=this.layer.map.getExtent();b=a.containsLonLat(this.lonlat)}return b},createMarker:function(){if(this.lonlat!=null){this.marker=new OpenLayers.Marker(this.lonlat,this.data.icon)}return this.marker},destroyMarker:function(){this.marker.destroy()},createPopup:function(b){if(this.lonlat!=null){var c=this.id+"_popup";var a=(this.marker)?this.marker.icon:null;if(!this.popup){this.popup=new this.popupClass(c,this.lonlat,this.data.popupSize,this.data.popupContentHTML,a,b)}if(this.data.overflow!=null){this.popup.contentDiv.style.overflow=this.data.overflow}this.popup.feature=this}return this.popup},destroyPopup:function(){if(this.popup){this.popup.feature=null;this.popup.destroy();this.popup=null}},CLASS_NAME:"OpenLayers.Feature"});OpenLayers.Handler.Click=OpenLayers.Class(OpenLayers.Handler,{delay:300,single:true,"double":false,pixelTolerance:0,stopSingle:false,stopDouble:false,timerId:null,down:null,rightclickTimerId:null,initialize:function(c,b,a){OpenLayers.Handler.prototype.initialize.apply(this,arguments);if(this.pixelTolerance!=null){this.mousedown=function(d){this.down=d.xy;return true}}},mousedown:null,mouseup:function(b){var a=true;if(this.checkModifiers(b)&&this.control.handleRightClicks&&OpenLayers.Event.isRightClick(b)){a=this.rightclick(b)}return a},rightclick:function(b){if(this.passesTolerance(b)){if(this.rightclickTimerId!=null){this.clearTimer();this.callback("dblrightclick",[b]);return !this.stopDouble}else{var a=this["double"]?OpenLayers.Util.extend({},b):this.callback("rightclick",[b]);var c=OpenLayers.Function.bind(this.delayedRightCall,this,a);this.rightclickTimerId=window.setTimeout(c,this.delay)}}return !this.stopSingle},delayedRightCall:function(a){this.rightclickTimerId=null;if(a){this.callback("rightclick",[a])}return !this.stopSingle},dblclick:function(a){if(this.passesTolerance(a)){if(this["double"]){this.callback("dblclick",[a])}this.clearTimer()}return !this.stopDouble},click:function(b){if(this.passesTolerance(b)){if(this.timerId!=null){this.clearTimer()}else{var a=this.single?OpenLayers.Util.extend({},b):null;this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,a),this.delay)}}return !this.stopSingle},passesTolerance:function(b){var c=true;if(this.pixelTolerance!=null&&this.down){var a=Math.sqrt(Math.pow(this.down.x-b.xy.x,2)+Math.pow(this.down.y-b.xy.y,2));if(a>this.pixelTolerance){c=false}}return c},clearTimer:function(){if(this.timerId!=null){window.clearTimeout(this.timerId);this.timerId=null}if(this.rightclickTimerId!=null){window.clearTimeout(this.rightclickTimerId);this.rightclickTimerId=null}},delayedCall:function(a){this.timerId=null;if(a){this.callback("click",[a])}},deactivate:function(){var a=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.clearTimer();this.down=null;a=true}return a},CLASS_NAME:"OpenLayers.Handler.Click"});OpenLayers.Handler.Drag=OpenLayers.Class(OpenLayers.Handler,{started:false,stopDown:true,dragging:false,last:null,start:null,oldOnselectstart:null,interval:0,timeoutId:null,initialize:function(c,b,a){OpenLayers.Handler.prototype.initialize.apply(this,arguments)},down:function(a){},move:function(a){},up:function(a){},out:function(a){},mousedown:function(b){var a=true;this.dragging=false;if(this.checkModifiers(b)&&OpenLayers.Event.isLeftClick(b)){this.started=true;this.start=b.xy;this.last=b.xy;OpenLayers.Element.addClass(this.map.viewPortDiv,"olDragDown");this.down(b);this.callback("down",[b.xy]);OpenLayers.Event.stop(b);if(!this.oldOnselectstart){this.oldOnselectstart=(document.onselectstart)?document.onselectstart:function(){return true};document.onselectstart=function(){return false}}a=!this.stopDown}else{this.started=false;this.start=null;this.last=null}return a},mousemove:function(a){if(this.started&&!this.timeoutId&&(a.xy.x!=this.last.x||a.xy.y!=this.last.y)){if(this.interval>0){this.timeoutId=setTimeout(OpenLayers.Function.bind(this.removeTimeout,this),this.interval)}this.dragging=true;this.move(a);this.callback("move",[a.xy]);if(!this.oldOnselectstart){this.oldOnselectstart=document.onselectstart;document.onselectstart=function(){return false}}this.last=this.evt.xy}return true},removeTimeout:function(){this.timeoutId=null},mouseup:function(b){if(this.started){var a=(this.start!=this.last);this.started=false;this.dragging=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.up(b);this.callback("up",[b.xy]);if(a){this.callback("done",[b.xy])}document.onselectstart=this.oldOnselectstart}return true},mouseout:function(b){if(this.started&&OpenLayers.Util.mouseLeft(b,this.map.div)){var a=(this.start!=this.last);this.started=false;this.dragging=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.out(b);this.callback("out",[]);if(a){this.callback("done",[b.xy])}if(document.onselectstart){document.onselectstart=this.oldOnselectstart}}return true},click:function(a){return(this.start==this.last)},activate:function(){var a=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragging=false;a=true}return a},deactivate:function(){var a=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.started=false;this.dragging=false;this.start=null;this.last=null;a=true;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown")}return a},CLASS_NAME:"OpenLayers.Handler.Drag"});OpenLayers.Handler.MouseWheel=OpenLayers.Class(OpenLayers.Handler,{wheelListener:null,mousePosition:null,initialize:function(c,b,a){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.wheelListener=OpenLayers.Function.bindAsEventListener(this.onWheelEvent,this)},destroy:function(){OpenLayers.Handler.prototype.destroy.apply(this,arguments);this.wheelListener=null},onWheelEvent:function(l){if(!this.map||!this.checkModifiers(l)){return}var g=false;var m=false;var f=false;var b=OpenLayers.Event.element(l);while((b!=null)&&!f&&!g){if(!g){try{if(b.currentStyle){c=b.currentStyle.overflow}else{var a=document.defaultView.getComputedStyle(b,null);var c=a.getPropertyValue("overflow")}g=(c&&(c=="auto")||(c=="scroll"))}catch(d){}}if(!m){for(var h=0,k=this.map.layers.length;h<k;h++){if(b==this.map.layers[h].div||b==this.map.layers[h].pane){m=true;break}}}f=(b==this.map.div);b=b.parentNode}if(!g&&f){if(m){this.wheelZoom(l)}OpenLayers.Event.stop(l)}},wheelZoom:function(a){var b=0;if(!a){a=window.event}if(a.wheelDelta){b=a.wheelDelta/120;if(window.opera&&window.opera.version()<9.2){b=-b}}else{if(a.detail){b=-a.detail/3}}if(b){if(this.mousePosition){a.xy=this.mousePosition}if(!a.xy){a.xy=this.map.getPixelFromLonLat(this.map.getCenter())}if(b<0){this.callback("down",[a,b])}else{this.callback("up",[a,b])}}},mousemove:function(a){this.mousePosition=a.xy},activate:function(a){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){var b=this.wheelListener;OpenLayers.Event.observe(window,"DOMMouseScroll",b);OpenLayers.Event.observe(window,"mousewheel",b);OpenLayers.Event.observe(document,"mousewheel",b);return true}else{return false}},deactivate:function(a){if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){var b=this.wheelListener;OpenLayers.Event.stopObserving(window,"DOMMouseScroll",b);OpenLayers.Event.stopObserving(window,"mousewheel",b);OpenLayers.Event.stopObserving(document,"mousewheel",b);return true}else{return false}},CLASS_NAME:"OpenLayers.Handler.MouseWheel"});OpenLayers.Layer=OpenLayers.Class({id:null,name:null,div:null,opacity:null,alwaysInRange:null,EVENT_TYPES:["loadstart","loadend","loadcancel","visibilitychanged","move","moveend"],events:null,map:null,isBaseLayer:false,alpha:false,displayInLayerSwitcher:true,visibility:true,attribution:null,inRange:false,imageSize:null,imageOffset:null,options:null,eventListeners:null,gutter:0,projection:null,units:null,scales:null,resolutions:null,maxExtent:null,minExtent:null,maxResolution:null,minResolution:null,numZoomLevels:null,minScale:null,maxScale:null,displayOutsideMaxExtent:false,wrapDateLine:false,transitionEffect:null,SUPPORTED_TRANSITIONS:["resize"],initialize:function(b,a){this.addOptions(a);this.name=b;if(this.id==null){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");this.div=OpenLayers.Util.createDiv(this.id);this.div.style.width="100%";this.div.style.height="100%";this.div.dir="ltr";this.events=new OpenLayers.Events(this,this.div,this.EVENT_TYPES);if(this.eventListeners instanceof Object){this.events.on(this.eventListeners)}}if(this.wrapDateLine){this.displayOutsideMaxExtent=true}},destroy:function(a){if(a==null){a=true}if(this.map!=null){this.map.removeLayer(this,a)}this.projection=null;this.map=null;this.name=null;this.div=null;this.options=null;if(this.events){if(this.eventListeners){this.events.un(this.eventListeners)}this.events.destroy()}this.eventListeners=null;this.events=null},clone:function(a){if(a==null){a=new OpenLayers.Layer(this.name,this.options)}OpenLayers.Util.applyDefaults(a,this);a.map=null;return a},setName:function(a){if(a!=this.name){this.name=a;if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"name"})}}},addOptions:function(a){if(this.options==null){this.options={}}OpenLayers.Util.extend(this.options,a);OpenLayers.Util.extend(this,a)},onMapResize:function(){},redraw:function(){var b=false;if(this.map){this.inRange=this.calculateInRange();var c=this.getExtent();if(c&&this.inRange&&this.visibility){var a=true;this.moveTo(c,a,false);this.events.triggerEvent("moveend",{zoomChanged:a});b=true}}return b},moveTo:function(b,a,c){var d=this.visibility;if(!this.isBaseLayer){d=d&&this.inRange}this.display(d)},setMap:function(b){if(this.map==null){this.map=b;this.maxExtent=this.maxExtent||this.map.maxExtent;this.projection=this.projection||this.map.projection;if(this.projection&&typeof this.projection=="string"){this.projection=new OpenLayers.Projection(this.projection)}this.units=this.projection.getUnits()||this.units||this.map.units;this.initResolutions();if(!this.isBaseLayer){this.inRange=this.calculateInRange();var a=((this.visibility)&&(this.inRange));this.div.style.display=a?"":"none"}this.setTileSize()}},afterAdd:function(){},removeMap:function(a){},getImageSize:function(){return(this.imageSize||this.tileSize)},setTileSize:function(a){var b=(a)?a:((this.tileSize)?this.tileSize:this.map.getTileSize());this.tileSize=b;if(this.gutter){this.imageOffset=new OpenLayers.Pixel(-this.gutter,-this.gutter);this.imageSize=new OpenLayers.Size(b.w+(2*this.gutter),b.h+(2*this.gutter))}},getVisibility:function(){return this.visibility},setVisibility:function(a){if(a!=this.visibility){this.visibility=a;this.display(a);this.redraw();if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"visibility"})}this.events.triggerEvent("visibilitychanged")}},display:function(a){var b=this.calculateInRange();if(a!=(this.div.style.display!="none")){this.div.style.display=(a&&b)?"block":"none"}},calculateInRange:function(){var b=false;if(this.alwaysInRange){b=true}else{if(this.map){var a=this.map.getResolution();b=((a>=this.minResolution)&&(a<=this.maxResolution))}}return b},setIsBaseLayer:function(a){if(a!=this.isBaseLayer){this.isBaseLayer=a;if(this.map!=null){this.map.events.triggerEvent("changebaselayer",{layer:this})}}},initResolutions:function(){var p=new Array("projection","units","scales","resolutions","maxScale","minScale","maxResolution","minResolution","minExtent","maxExtent","numZoomLevels","maxZoomLevel");var b=["projection","units"];var e=false;var d={};for(var f=0,k=p.length;f<k;f++){var r=p[f];if(this.options[r]&&OpenLayers.Util.indexOf(b,r)==-1){e=true}d[r]=this.options[r]||this.map[r]}if(this.alwaysInRange==null){this.alwaysInRange=!e}if((this.options.minScale!=null||this.options.maxScale!=null)&&this.options.scales==null){d.scales=null}if((this.options.minResolution!=null||this.options.maxResolution!=null)&&this.options.resolutions==null){d.resolutions=null}if((!d.numZoomLevels)&&(d.maxZoomLevel)){d.numZoomLevels=d.maxZoomLevel+1}if((d.scales!=null)||(d.resolutions!=null)){if(d.scales!=null){d.resolutions=[];for(var f=0,k=d.scales.length;f<k;f++){var c=d.scales[f];d.resolutions[f]=OpenLayers.Util.getResolutionFromScale(c,d.units)}}d.numZoomLevels=d.resolutions.length}else{if(d.minScale){d.maxResolution=OpenLayers.Util.getResolutionFromScale(d.minScale,d.units)}else{if(d.maxResolution=="auto"){var q=this.map.getSize();var o=d.maxExtent.getWidth()/q.w;var h=d.maxExtent.getHeight()/q.h;d.maxResolution=Math.max(o,h)}}if(d.maxScale!=null){d.minResolution=OpenLayers.Util.getResolutionFromScale(d.maxScale,d.units)}else{if((d.minResolution=="auto")&&(d.minExtent!=null)){var q=this.map.getSize();var o=d.minExtent.getWidth()/q.w;var h=d.minExtent.getHeight()/q.h;d.minResolution=Math.max(o,h)}}if(d.minResolution!=null&&this.options.numZoomLevels==undefined){var m=d.maxResolution/d.minResolution;d.numZoomLevels=Math.floor(Math.log(m)/Math.log(2))+1}d.resolutions=new Array(d.numZoomLevels);var a=2;if(typeof d.minResolution=="number"&&d.numZoomLevels>1){a=Math.pow((d.maxResolution/d.minResolution),(1/(d.numZoomLevels-1)))}for(var f=0;f<d.numZoomLevels;f++){var l=d.maxResolution/Math.pow(a,f);d.resolutions[f]=l}}d.resolutions.sort(function(t,s){return(s-t)});this.resolutions=d.resolutions;this.maxResolution=d.resolutions[0];var g=d.resolutions.length-1;this.minResolution=d.resolutions[g];this.scales=[];for(var f=0,k=d.resolutions.length;f<k;f++){this.scales[f]=OpenLayers.Util.getScaleFromResolution(d.resolutions[f],d.units)}this.minScale=this.scales[0];this.maxScale=this.scales[this.scales.length-1];this.numZoomLevels=d.numZoomLevels},getResolution:function(){var a=this.map.getZoom();return this.getResolutionForZoom(a)},getExtent:function(){return this.map.calculateBounds()},getZoomForExtent:function(b,c){var d=this.map.getSize();var a=Math.max(b.getWidth()/d.w,b.getHeight()/d.h);return this.getZoomForResolution(a,c)},getDataExtent:function(){},getResolutionForZoom:function(c){c=Math.max(0,Math.min(c,this.resolutions.length-1));var b;if(this.map.fractionalZoom){var a=Math.floor(c);var d=Math.ceil(c);b=this.resolutions[a]-((c-a)*(this.resolutions[a]-this.resolutions[d]))}else{b=this.resolutions[Math.round(c)]}return b},getZoomForResolution:function(e,a){var p;if(this.map.fractionalZoom){var l=0;var c=this.resolutions.length-1;var d=this.resolutions[l];var b=this.resolutions[c];var k;for(var f=0,g=this.resolutions.length;f<g;++f){k=this.resolutions[f];if(k>=e){d=k;l=f}if(k<=e){b=k;c=f;break}}var h=d-b;if(h>0){p=l+((d-e)/h)}else{p=l}}else{var m;var o=Number.POSITIVE_INFINITY;for(var f=0,g=this.resolutions.length;f<g;f++){if(a){m=Math.abs(this.resolutions[f]-e);if(m>o){break}o=m}else{if(this.resolutions[f]<e){break}}}p=Math.max(0,f-1)}return p},getLonLatFromViewPortPx:function(b){var e=null;if(b!=null){var d=this.map.getSize();var a=this.map.getCenter();if(a){var c=this.map.getResolution();var g=b.x-(d.w/2);var f=b.y-(d.h/2);e=new OpenLayers.LonLat(a.lon+g*c,a.lat-f*c);if(this.wrapDateLine){e=e.wrapDateLine(this.maxExtent)}}}return e},getViewPortPxFromLonLat:function(d){var b=null;if(d!=null){var a=this.map.getResolution();var c=this.map.getExtent();b=new OpenLayers.Pixel((1/a*(d.lon-c.left)),(1/a*(c.top-d.lat)))}return b},setOpacity:function(b){if(b!=this.opacity){this.opacity=b;for(var d=0,a=this.div.childNodes.length;d<a;++d){var c=this.div.childNodes[d].firstChild;OpenLayers.Util.modifyDOMElement(c,null,null,null,null,null,null,b)}}},getZIndex:function(){return this.div.style.zIndex},setZIndex:function(a){this.div.style.zIndex=a},adjustBounds:function(b){if(this.gutter){var a=this.gutter*this.map.getResolution();b=new OpenLayers.Bounds(b.left-a,b.bottom-a,b.right+a,b.top+a)}if(this.wrapDateLine){var c={rightTolerance:this.getResolution()};b=b.wrapDateLine(this.maxExtent,c)}return b},CLASS_NAME:"OpenLayers.Layer"});OpenLayers.Control.DragPan=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,panned:false,interval:25,draw:function(){this.handler=new OpenLayers.Handler.Drag(this,{move:this.panMap,done:this.panMapDone},{interval:this.interval})},panMap:function(a){this.panned=true;this.map.pan(this.handler.last.x-a.x,this.handler.last.y-a.y,{dragging:this.handler.dragging,animate:false})},panMapDone:function(a){if(this.panned){this.panMap(a);this.panned=false}},CLASS_NAME:"OpenLayers.Control.DragPan"});OpenLayers.State={UNKNOWN:"Unknown",INSERT:"Insert",UPDATE:"Update",DELETE:"Delete"};OpenLayers.Feature.Vector=OpenLayers.Class(OpenLayers.Feature,{fid:null,geometry:null,attributes:null,bounds:null,state:null,style:null,renderIntent:"default",initialize:function(c,a,b){OpenLayers.Feature.prototype.initialize.apply(this,[null,null,a]);this.lonlat=null;this.geometry=c?c:null;this.state=null;this.attributes={};if(a){this.attributes=OpenLayers.Util.extend(this.attributes,a)}this.style=b?b:null},destroy:function(){if(this.layer){this.layer.removeFeatures(this);this.layer=null}this.geometry=null;OpenLayers.Feature.prototype.destroy.apply(this,arguments)},clone:function(){return new OpenLayers.Feature.Vector(this.geometry?this.geometry.clone():null,this.attributes,this.style)},onScreen:function(d){var c=false;if(this.layer&&this.layer.map){var a=this.layer.map.getExtent();if(d){var b=this.geometry.getBounds();c=a.intersectsBounds(b)}else{var e=a.toGeometry();c=e.intersects(this.geometry)}}return c},createMarker:function(){return null},destroyMarker:function(){},createPopup:function(){return null},atPoint:function(b,d,c){var a=false;if(this.geometry){a=this.geometry.atPoint(b,d,c)}return a},destroyPopup:function(){},move:function(a){if(!this.layer||!this.geometry.move){return}var b;if(a.CLASS_NAME=="OpenLayers.LonLat"){b=this.layer.getViewPortPxFromLonLat(a)}else{b=a}var d=this.layer.getViewPortPxFromLonLat(this.geometry.getBounds().getCenterLonLat());var c=this.layer.map.getResolution();this.geometry.move(c*(b.x-d.x),c*(d.y-b.y));this.layer.drawFeature(this);return d},toState:function(a){if(a==OpenLayers.State.UPDATE){switch(this.state){case OpenLayers.State.UNKNOWN:case OpenLayers.State.DELETE:this.state=a;break;case OpenLayers.State.UPDATE:case OpenLayers.State.INSERT:break}}else{if(a==OpenLayers.State.INSERT){switch(this.state){case OpenLayers.State.UNKNOWN:break;default:this.state=a;break}}else{if(a==OpenLayers.State.DELETE){switch(this.state){case OpenLayers.State.INSERT:break;case OpenLayers.State.DELETE:break;case OpenLayers.State.UNKNOWN:case OpenLayers.State.UPDATE:this.state=a;break}}else{if(a==OpenLayers.State.UNKNOWN){this.state=a}}}}},CLASS_NAME:"OpenLayers.Feature.Vector"});OpenLayers.Feature.Vector.style={"default":{fillColor:"#ee9900",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#ee9900",strokeOpacity:1,strokeWidth:1,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},select:{fillColor:"blue",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"blue",strokeOpacity:1,strokeWidth:2,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"pointer"},temporary:{fillColor:"#66cccc",fillOpacity:0.2,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#66cccc",strokeOpacity:1,strokeLinecap:"round",strokeWidth:2,strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},"delete":{display:"none"}};OpenLayers.Handler.Box=OpenLayers.Class(OpenLayers.Handler,{dragHandler:null,boxDivClassName:"olHandlerBoxZoomBox",boxCharacteristics:null,initialize:function(c,b,a){OpenLayers.Handler.prototype.initialize.apply(this,arguments);var b={down:this.startBox,move:this.moveBox,out:this.removeBox,up:this.endBox};this.dragHandler=new OpenLayers.Handler.Drag(this,b,{keyMask:this.keyMask})},setMap:function(a){OpenLayers.Handler.prototype.setMap.apply(this,arguments);if(this.dragHandler){this.dragHandler.setMap(a)}},startBox:function(a){this.zoomBox=OpenLayers.Util.createDiv("zoomBox",this.dragHandler.start);this.zoomBox.className=this.boxDivClassName;this.zoomBox.style.zIndex=this.map.Z_INDEX_BASE.Popup-1;this.map.viewPortDiv.appendChild(this.zoomBox);OpenLayers.Element.addClass(this.map.viewPortDiv,"olDrawBox")},moveBox:function(f){var d=this.dragHandler.start.x;var b=this.dragHandler.start.y;var c=Math.abs(d-f.x);var a=Math.abs(b-f.y);this.zoomBox.style.width=Math.max(1,c)+"px";this.zoomBox.style.height=Math.max(1,a)+"px";this.zoomBox.style.left=f.x<d?f.x+"px":d+"px";this.zoomBox.style.top=f.y<b?f.y+"px":b+"px";var e=this.getBoxCharacteristics();if(e.newBoxModel){if(f.x>d){this.zoomBox.style.width=Math.max(1,c-e.xOffset)+"px"}if(f.y>b){this.zoomBox.style.height=Math.max(1,a-e.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 g=this.dragHandler.start;var f=Math.min(g.y,b.y);var c=Math.max(g.y,b.y);var e=Math.min(g.x,b.x);var d=Math.max(g.x,b.x);a=new OpenLayers.Bounds(e,c,d,f)}else{a=this.dragHandler.start.clone()}this.removeBox();this.callback("done",[a])},removeBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox);this.zoomBox=null;this.boxCharacteristics=null;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDrawBox")},activate:function(){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragHandler.activate();return true}else{return false}},deactivate:function(){if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.dragHandler.deactivate();return true}else{return false}},getBoxCharacteristics:function(){if(!this.boxCharacteristics){var a=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-left-width"))+parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-right-width"))+1;var c=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-top-width"))+parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-bottom-width"))+1;var b=OpenLayers.Util.getBrowserName()=="msie"?document.compatMode!="BackCompat":true;this.boxCharacteristics={xOffset:a,yOffset:c,newBoxModel:b}}return this.boxCharacteristics},CLASS_NAME:"OpenLayers.Handler.Box"});OpenLayers.Layer.EventPane=OpenLayers.Class(OpenLayers.Layer,{smoothDragPan:true,isBaseLayer:true,isFixed:true,pane:null,mapObject:null,initialize:function(b,a){OpenLayers.Layer.prototype.initialize.apply(this,arguments);if(this.pane==null){this.pane=OpenLayers.Util.createDiv(this.div.id+"_EventPane")}},destroy:function(){this.mapObject=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},setMap:function(a){OpenLayers.Layer.prototype.setMap.apply(this,arguments);this.pane.style.zIndex=parseInt(this.div.style.zIndex)+1;this.pane.style.display=this.div.style.display;this.pane.style.width="100%";this.pane.style.height="100%";if(OpenLayers.Util.getBrowserName()=="msie"){this.pane.style.background="url("+OpenLayers.Util.getImagesLocation()+"blank.gif)"}if(this.isFixed){this.map.viewPortDiv.appendChild(this.pane)}else{this.map.layerContainerDiv.appendChild(this.pane)}this.loadMapObject();if(this.mapObject==null){this.loadWarningMessage()}},removeMap:function(a){if(this.pane&&this.pane.parentNode){this.pane.parentNode.removeChild(this.pane);this.pane=null}OpenLayers.Layer.prototype.removeMap.apply(this,arguments)},loadWarningMessage:function(){this.div.style.backgroundColor="darkblue";var g=this.map.getSize();var a=Math.min(g.w,300);var e=Math.min(g.h,200);var b=new OpenLayers.Size(a,e);var d=new OpenLayers.Pixel(g.w/2,g.h/2);var c=d.add(-b.w/2,-b.h/2);var f=OpenLayers.Util.createDiv(this.name+"_warning",c,b,null,null,null,"auto");f.style.padding="7px";f.style.backgroundColor="yellow";f.innerHTML=this.getWarningHTML();this.div.appendChild(f)},getWarningHTML:function(){return""},display:function(a){OpenLayers.Layer.prototype.display.apply(this,arguments);this.pane.style.display=this.div.style.display},setZIndex:function(a){OpenLayers.Layer.prototype.setZIndex.apply(this,arguments);this.pane.style.zIndex=parseInt(this.div.style.zIndex)+1},moveTo:function(c,d,l){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);if(this.mapObject!=null){var e=this.map.getCenter();var g=this.map.getZoom();if(e!=null){var f=this.getMapObjectCenter();var b=this.getOLLonLatFromMapObjectLonLat(f);var h=this.getMapObjectZoom();var p=this.getOLZoomFromMapObjectZoom(h);if(!(e.equals(b))||!(g==p)){if(l&&this.dragPanMapObject&&this.smoothDragPan){var k=this.map.getViewPortPxFromLonLat(b);var m=this.map.getViewPortPxFromLonLat(e);this.dragPanMapObject(m.x-k.x,k.y-m.y)}else{var a=this.getMapObjectLonLatFromOLLonLat(e);var o=this.getMapObjectZoomFromOLZoom(g);this.setMapObjectCenter(a,o,l)}}}}},getLonLatFromViewPortPx:function(a){var b=null;if((this.mapObject!=null)&&(this.getMapObjectCenter()!=null)){var d=this.getMapObjectPixelFromOLPixel(a);var c=this.getMapObjectLonLatFromMapObjectPixel(d);b=this.getOLLonLatFromMapObjectLonLat(c)}return b},getViewPortPxFromLonLat:function(b){var a=null;if((this.mapObject!=null)&&(this.getMapObjectCenter()!=null)){var d=this.getMapObjectLonLatFromOLLonLat(b);var c=this.getMapObjectPixelFromMapObjectLonLat(d);a=this.getOLPixelFromMapObjectPixel(c)}return a},getOLLonLatFromMapObjectLonLat:function(d){var a=null;if(d!=null){var c=this.getLongitudeFromMapObjectLonLat(d);var b=this.getLatitudeFromMapObjectLonLat(d);a=new OpenLayers.LonLat(c,b)}return a},getMapObjectLonLatFromOLLonLat:function(a){var b=null;if(a!=null){b=this.getMapObjectLonLatFromLonLat(a.lon,a.lat)}return b},getOLPixelFromMapObjectPixel:function(d){var b=null;if(d!=null){var a=this.getXFromMapObjectPixel(d);var c=this.getYFromMapObjectPixel(d);b=new OpenLayers.Pixel(a,c)}return b},getMapObjectPixelFromOLPixel:function(a){var b=null;if(a!=null){b=this.getMapObjectPixelFromXY(a.x,a.y)}return b},CLASS_NAME:"OpenLayers.Layer.EventPane"});OpenLayers.Layer.FixedZoomLevels=OpenLayers.Class({initialize:function(){},initResolutions:function(){var c=new Array("minZoomLevel","maxZoomLevel","numZoomLevels");for(var b=0,a=c.length;b<a;b++){var f=c[b];this[f]=(this.options[f]!=null)?this.options[f]:this.map[f]}if((this.minZoomLevel==null)||(this.minZoomLevel<this.MIN_ZOOM_LEVEL)){this.minZoomLevel=this.MIN_ZOOM_LEVEL}var g;var e=this.MAX_ZOOM_LEVEL-this.minZoomLevel+1;if(((this.options.numZoomLevels==null)&&(this.options.maxZoomLevel!=null))||((this.numZoomLevels==null)&&(this.maxZoomLevel!=null))){g=this.maxZoomLevel-this.minZoomLevel+1}else{g=this.numZoomLevels}if(g!=null){this.numZoomLevels=Math.min(g,e)}else{this.numZoomLevels=e}this.maxZoomLevel=this.minZoomLevel+this.numZoomLevels-1;if(this.RESOLUTIONS!=null){var d=0;this.resolutions=[];for(var b=this.minZoomLevel;b<=this.maxZoomLevel;b++){this.resolutions[d++]=this.RESOLUTIONS[b]}this.maxResolution=this.resolutions[0];this.minResolution=this.resolutions[this.resolutions.length-1]}},getResolution:function(){if(this.resolutions!=null){return OpenLayers.Layer.prototype.getResolution.apply(this,arguments)}else{var a=null;var c=this.map.getSize();var b=this.getExtent();if((c!=null)&&(b!=null)){a=Math.max(b.getWidth()/c.w,b.getHeight()/c.h)}return a}},getExtent:function(){var c=null;var b=this.map.getSize();var e=new OpenLayers.Pixel(0,0);var f=this.getLonLatFromViewPortPx(e);var a=new OpenLayers.Pixel(b.w,b.h);var d=this.getLonLatFromViewPortPx(a);if((f!=null)&&(d!=null)){c=new OpenLayers.Bounds(f.lon,d.lat,d.lon,f.lat)}return c},getZoomForResolution:function(a){if(this.resolutions!=null){return OpenLayers.Layer.prototype.getZoomForResolution.apply(this,arguments)}else{var b=OpenLayers.Layer.prototype.getExtent.apply(this,[]);return this.getZoomForExtent(b)}},getOLZoomFromMapObjectZoom:function(a){var b=null;if(a!=null){b=a-this.minZoomLevel}return b},getMapObjectZoomFromOLZoom:function(a){var b=null;if(a!=null){b=a+this.minZoomLevel}return b},CLASS_NAME:"OpenLayers.Layer.FixedZoomLevels"});OpenLayers.Layer.HTTPRequest=OpenLayers.Class(OpenLayers.Layer,{URL_HASH_FACTOR:(Math.sqrt(5)-1)/2,url:null,params:null,reproject:false,initialize:function(d,c,e,b){var a=arguments;a=[d,b];OpenLayers.Layer.prototype.initialize.apply(this,a);this.url=c;this.params=OpenLayers.Util.extend({},e)},destroy:function(){this.url=null;this.params=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(a){if(a==null){a=new OpenLayers.Layer.HTTPRequest(this.name,this.url,this.params,this.options)}a=OpenLayers.Layer.prototype.clone.apply(this,[a]);return a},setUrl:function(a){this.url=a},mergeNewParams:function(a){this.params=OpenLayers.Util.extend(this.params,a);return this.redraw()},redraw:function(a){if(a){return this.mergeNewParams({_olSalt:Math.random()})}else{return OpenLayers.Layer.prototype.redraw.apply(this,[])}},selectUrl:function(e,d){var c=1;for(var b=0,a=e.length;b<a;b++){c*=e.charCodeAt(b)*this.URL_HASH_FACTOR;c-=Math.floor(c)}return d[Math.floor(c*d.length)]},getFullRequestString:function(f,e){var b=e||this.url;var g=OpenLayers.Util.extend({},this.params);g=OpenLayers.Util.extend(g,f);var a=OpenLayers.Util.getParameterString(g);if(b instanceof Array){b=this.selectUrl(a,b)}var d=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(b));for(var h in g){if(h.toUpperCase() in d){delete g[h]}}a=OpenLayers.Util.getParameterString(g);var k=b;if(a!=""){var c=b.charAt(b.length-1);if((c=="&")||(c=="?")){k+=a}else{if(b.indexOf("?")==-1){k+="?"+a}else{k+="&"+a}}}return k},CLASS_NAME:"OpenLayers.Layer.HTTPRequest"});OpenLayers.Layer.Markers=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:false,markers:null,drawn:false,initialize:function(b,a){OpenLayers.Layer.prototype.initialize.apply(this,arguments);this.markers=[]},destroy:function(){this.clearMarkers();this.markers=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},setOpacity:function(b){if(b!=this.opacity){this.opacity=b;for(var c=0,a=this.markers.length;c<a;c++){this.markers[c].setOpacity(this.opacity)}}},moveTo:function(d,b,e){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);if(b||!this.drawn){for(var c=0,a=this.markers.length;c<a;c++){this.drawMarker(this.markers[c])}this.drawn=true}},addMarker:function(a){this.markers.push(a);if(this.opacity!=null){a.setOpacity(this.opacity)}if(this.map&&this.map.getExtent()){a.map=this.map;this.drawMarker(a)}},removeMarker:function(a){if(this.markers&&this.markers.length){OpenLayers.Util.removeItem(this.markers,a);a.erase()}},clearMarkers:function(){if(this.markers!=null){while(this.markers.length>0){this.removeMarker(this.markers[0])}}},drawMarker:function(a){var b=this.map.getLayerPxFromLonLat(a.lonlat);if(b==null){a.display(false)}else{if(!a.isDrawn()){var c=a.draw(b);this.div.appendChild(c)}else{if(a.icon){a.icon.moveTo(b)}}}},getDataExtent:function(){var b=null;if(this.markers&&(this.markers.length>0)){var b=new OpenLayers.Bounds();for(var d=0,a=this.markers.length;d<a;d++){var c=this.markers[d];b.extend(c.lonlat)}}return b},CLASS_NAME:"OpenLayers.Layer.Markers"});OpenLayers.Layer.SphericalMercator={getExtent:function(){var a=null;if(this.sphericalMercator){a=this.map.calculateBounds()}else{a=OpenLayers.Layer.FixedZoomLevels.prototype.getExtent.apply(this)}return a},initMercatorParameters:function(){this.RESOLUTIONS=[];var a=156543.0339;for(var b=0;b<=this.MAX_ZOOM_LEVEL;++b){this.RESOLUTIONS[b]=a/Math.pow(2,b)}this.units="m";this.projection="EPSG:900913"},forwardMercator:function(c,b){var a=c*20037508.34/180;var d=Math.log(Math.tan((90+b)*Math.PI/360))/(Math.PI/180);d=d*20037508.34/180;return new OpenLayers.LonLat(a,d)},inverseMercator:function(a,d){var c=(a/20037508.34)*180;var b=(d/20037508.34)*180;b=180/Math.PI*(2*Math.atan(Math.exp(b*Math.PI/180))-Math.PI/2);return new OpenLayers.LonLat(c,b)},projectForward:function(a){var b=OpenLayers.Layer.SphericalMercator.forwardMercator(a.x,a.y);a.x=b.lon;a.y=b.lat;return a},projectInverse:function(a){var b=OpenLayers.Layer.SphericalMercator.inverseMercator(a.x,a.y);a.x=b.lon;a.y=b.lat;return a}};OpenLayers.Projection.addTransform("EPSG:4326","EPSG:900913",OpenLayers.Layer.SphericalMercator.projectForward);OpenLayers.Projection.addTransform("EPSG:900913","EPSG:4326",OpenLayers.Layer.SphericalMercator.projectInverse);OpenLayers.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(h){if(h instanceof OpenLayers.Bounds){if(!this.out){var k=this.map.getLonLatFromPixel(new OpenLayers.Pixel(h.left,h.bottom));var p=this.map.getLonLatFromPixel(new OpenLayers.Pixel(h.right,h.top));var b=new OpenLayers.Bounds(k.lon,k.lat,p.lon,p.lat)}else{var g=Math.abs(h.right-h.left);var l=Math.abs(h.top-h.bottom);var e=Math.min((this.map.size.h/l),(this.map.size.w/g));var q=this.map.getExtent();var a=this.map.getLonLatFromPixel(h.getCenterPixel());var c=a.lon-(q.getWidth()/2)*e;var f=a.lon+(q.getWidth()/2)*e;var o=a.lat-(q.getHeight()/2)*e;var d=a.lat+(q.getHeight()/2)*e;var b=new OpenLayers.Bounds(c,o,f,d)}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(h),this.map.getZoom()+1)}else{this.map.setCenter(this.map.getLonLatFromPixel(h),this.map.getZoom()-1)}}},CLASS_NAME:"OpenLayers.Control.ZoomBox"});OpenLayers.Format.WKT=OpenLayers.Class(OpenLayers.Format,{initialize:function(a){this.regExes={typeStr:/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,spaces:/\s+/,parenComma:/\)\s*,\s*\(/,doubleParenComma:/\)\s*\)\s*,\s*\(\s*\(/,trimParens:/^\s*\(?(.*?)\)?\s*$/};OpenLayers.Format.prototype.initialize.apply(this,[a])},read:function(f){var e,d,h;var g=this.regExes.typeStr.exec(f);if(g){d=g[1].toLowerCase();h=g[2];if(this.parse[d]){e=this.parse[d].apply(this,[h])}if(this.internalProjection&&this.externalProjection){if(e&&e.CLASS_NAME=="OpenLayers.Feature.Vector"){e.geometry.transform(this.externalProjection,this.internalProjection)}else{if(e&&d!="geometrycollection"&&typeof e=="object"){for(var c=0,a=e.length;c<a;c++){var b=e[c];b.geometry.transform(this.externalProjection,this.internalProjection)}}}}}return e},write:function(a){var f,k,h,d,b;if(a.constructor==Array){f=a;b=true}else{f=[a];b=false}var c=[];if(b){c.push("GEOMETRYCOLLECTION(")}for(var e=0,g=f.length;e<g;++e){if(b&&e>0){c.push(",")}k=f[e].geometry;h=k.CLASS_NAME.split(".")[2].toLowerCase();if(!this.extract[h]){return null}if(this.internalProjection&&this.externalProjection){k=k.clone();k.transform(this.internalProjection,this.externalProjection)}d=this.extract[h].apply(this,[k]);c.push(h.toUpperCase()+"("+d+")")}if(b){c.push(")")}return c.join("")},extract:{point:function(a){return a.x+" "+a.y},multipoint:function(c){var d=[];for(var b=0,a=c.components.length;b<a;++b){d.push(this.extract.point.apply(this,[c.components[b]]))}return d.join(",")},linestring:function(b){var d=[];for(var c=0,a=b.components.length;c<a;++c){d.push(this.extract.point.apply(this,[b.components[c]]))}return d.join(",")},multilinestring:function(c){var d=[];for(var b=0,a=c.components.length;b<a;++b){d.push("("+this.extract.linestring.apply(this,[c.components[b]])+")")}return d.join(",")},polygon:function(c){var d=[];for(var b=0,a=c.components.length;b<a;++b){d.push("("+this.extract.linestring.apply(this,[c.components[b]])+")")}return d.join(",")},multipolygon:function(d){var c=[];for(var b=0,a=d.components.length;b<a;++b){c.push("("+this.extract.polygon.apply(this,[d.components[b]])+")")}return c.join(",")}},parse:{point:function(b){var a=OpenLayers.String.trim(b).split(this.regExes.spaces);return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(a[0],a[1]))},multipoint:function(e){var c=OpenLayers.String.trim(e).split(",");var d=[];for(var b=0,a=c.length;b<a;++b){d.push(this.parse.point.apply(this,[c[b]]).geometry)}return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPoint(d))},linestring:function(e){var c=OpenLayers.String.trim(e).split(",");var d=[];for(var b=0,a=c.length;b<a;++b){d.push(this.parse.point.apply(this,[c[b]]).geometry)}return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(d))},multilinestring:function(f){var c;var b=OpenLayers.String.trim(f).split(this.regExes.parenComma);var e=[];for(var d=0,a=b.length;d<a;++d){c=b[d].replace(this.regExes.trimParens,"$1");e.push(this.parse.linestring.apply(this,[c]).geometry)}return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiLineString(e))},polygon:function(h){var c,b,f;var g=OpenLayers.String.trim(h).split(this.regExes.parenComma);var e=[];for(var d=0,a=g.length;d<a;++d){c=g[d].replace(this.regExes.trimParens,"$1");b=this.parse.linestring.apply(this,[c]).geometry;f=new OpenLayers.Geometry.LinearRing(b.components);e.push(f)}return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon(e))},multipolygon:function(f){var d;var b=OpenLayers.String.trim(f).split(this.regExes.doubleParenComma);var e=[];for(var c=0,a=b.length;c<a;++c){d=b[c].replace(this.regExes.trimParens,"$1");e.push(this.parse.polygon.apply(this,[d]).geometry)}return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPolygon(e))},geometrycollection:function(e){e=e.replace(/,\s*([A-Za-z])/g,"|$1");var d=OpenLayers.String.trim(e).split("|");var c=[];for(var b=0,a=d.length;b<a;++b){c.push(OpenLayers.Format.WKT.prototype.read.apply(this,[d[b]]))}return c}},CLASS_NAME:"OpenLayers.Format.WKT"});OpenLayers.Layer.Google=OpenLayers.Class(OpenLayers.Layer.EventPane,OpenLayers.Layer.FixedZoomLevels,{MIN_ZOOM_LEVEL:0,MAX_ZOOM_LEVEL:19,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],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()}},loadMapObject:function(){try{this.mapObject=new GMap2(this.div);if(typeof this.mapObject.getDragObject=="function"){this.dragObject=this.mapObject.getDragObject()}else{this.dragPanMapObject=null}this.termsOfUse=this.div.lastChild;this.div.removeChild(this.termsOfUse);if(this.isFixed){this.map.viewPortDiv.appendChild(this.termsOfUse)}else{this.map.layerContainerDiv.appendChild(this.termsOfUse)}this.termsOfUse.style.zIndex="1100";this.termsOfUse.style.display=this.div.style.display;this.termsOfUse.style.right="";this.termsOfUse.style.bottom="";this.termsOfUse.className="olLayerGoogleCopyright";this.poweredBy=this.div.lastChild;this.div.removeChild(this.poweredBy);if(this.isFixed){this.map.viewPortDiv.appendChild(this.poweredBy)}else{this.map.layerContainerDiv.appendChild(this.poweredBy)}this.poweredBy.style.zIndex="1100";this.poweredBy.style.display=this.div.style.display;this.poweredBy.style.right="";this.poweredBy.style.bottom="";this.poweredBy.className="olLayerGooglePoweredBy gmnoprint"}catch(a){OpenLayers.Console.error(a)}},setMap:function(a){OpenLayers.Layer.EventPane.prototype.setMap.apply(this,arguments);if(this.type!=null){this.map.events.register("moveend",this,this.setMapType)}},setMapType:function(){if(this.mapObject.getCenter()!=null){if(OpenLayers.Util.indexOf(this.mapObject.getMapTypes(),this.type)==-1){this.mapObject.addMapType(this.type)}this.mapObject.setMapType(this.type);this.map.events.unregister("moveend",this,this.setMapType)}},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}},display:function(a){OpenLayers.Layer.EventPane.prototype.display.apply(this,arguments);this.termsOfUse.style.display=this.div.style.display;this.poweredBy.style.display=this.div.style.display},removeMap:function(a){if(this.termsOfUse&&this.termsOfUse.parentNode){this.termsOfUse.parentNode.removeChild(this.termsOfUse);this.termsOfUse=null}if(this.poweredBy&&this.poweredBy.parentNode){this.poweredBy.parentNode.removeChild(this.poweredBy);this.poweredBy=null}OpenLayers.Layer.EventPane.prototype.removeMap.apply(this,arguments)},getOLBoundsFromMapObjectBounds:function(b){var c=null;if(b!=null){var a=b.getSouthWest();var d=b.getNorthEast();if(this.sphericalMercator){a=this.forwardMercator(a.lng(),a.lat());d=this.forwardMercator(d.lng(),d.lat())}else{a=new OpenLayers.LonLat(a.lng(),a.lat());d=new OpenLayers.LonLat(d.lng(),d.lat())}c=new OpenLayers.Bounds(a.lon,a.lat,d.lon,d.lat)}return c},getMapObjectBoundsFromOLBounds:function(c){var b=null;if(c!=null){var a=this.sphericalMercator?this.inverseMercator(c.bottom,c.left):new OpenLayers.LonLat(c.bottom,c.left);var d=this.sphericalMercator?this.inverseMercator(c.top,c.right):new OpenLayers.LonLat(c.top,c.right);b=new GLatLngBounds(new GLatLng(a.lat,a.lon),new GLatLng(d.lat,d.lon))}return b},addContainerPxFunction:function(){if((typeof GMap2!="undefined")&&!GMap2.prototype.fromLatLngToContainerPixel){GMap2.prototype.fromLatLngToContainerPixel=function(b){var a=this.fromLatLngToDivPixel(b);var c=this.getContainer().firstChild.firstChild;a.x+=c.offsetLeft;a.y+=c.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(d,b){var c;if(this.sphericalMercator){var a=this.inverseMercator(d,b);c=new GLatLng(a.lat,a.lon)}else{c=new GLatLng(b,d)}return c},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.Grid=OpenLayers.Class(OpenLayers.Layer.HTTPRequest,{tileSize:null,grid:null,singleTile:false,ratio:1.5,buffer:2,numLoadingTiles:0,initialize:function(c,b,d,a){OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,arguments);this.events.addEventType("tileloaded");this.grid=[]},destroy:function(){this.clearGrid();this.grid=null;this.tileSize=null;OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this,arguments)},clearGrid:function(){if(this.grid){for(var f=0,b=this.grid.length;f<b;f++){var e=this.grid[f];for(var c=0,a=e.length;c<a;c++){var d=e[c];this.removeTileMonitoringHooks(d);d.destroy()}}this.grid=[]}},clone:function(a){if(a==null){a=new OpenLayers.Layer.Grid(this.name,this.url,this.params,this.options)}a=OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this,[a]);if(this.tileSize!=null){a.tileSize=this.tileSize.clone()}a.grid=[];return a},moveTo:function(d,a,e){OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this,arguments);d=d||this.map.getExtent();if(d!=null){var c=!this.grid.length||a;var b=this.getTilesBounds();if(this.singleTile){if(c||(!e&&!b.containsBounds(d))){this.initSingleTile(d)}}else{if(c||!b.containsBounds(d,true)){this.initGriddedTiles(d)}else{this.moveGriddedTiles(d)}}}},setTileSize:function(a){if(this.singleTile){a=this.map.getSize().clone();a.h=parseInt(a.h*this.ratio);a.w=parseInt(a.w*this.ratio)}OpenLayers.Layer.HTTPRequest.prototype.setTileSize.apply(this,[a])},getGridBounds:function(){var a="The getGridBounds() function is deprecated. It will be removed in 3.0. Please use getTilesBounds() instead.";OpenLayers.Console.warn(a);return this.getTilesBounds()},getTilesBounds:function(){var e=null;if(this.grid.length){var a=this.grid.length-1;var d=this.grid[a][0];var b=this.grid[0].length-1;var c=this.grid[0][b];e=new OpenLayers.Bounds(d.bounds.left,d.bounds.bottom,c.bounds.right,c.bounds.top)}return e},initSingleTile:function(f){var a=f.getCenterLonLat();var h=f.getWidth()*this.ratio;var b=f.getHeight()*this.ratio;var g=new OpenLayers.Bounds(a.lon-(h/2),a.lat-(b/2),a.lon+(h/2),a.lat+(b/2));var d=new OpenLayers.LonLat(g.left,g.top);var c=this.map.getLayerPxFromLonLat(d);if(!this.grid.length){this.grid[0]=[]}var e=this.grid[0][0];if(!e){e=this.addTile(g,c);this.addTileMonitoringHooks(e);e.draw();this.grid[0][0]=e}else{e.moveTo(g,c)}this.removeExcessTiles(1,1)},calculateGridLayout:function(a,r,e){var m=e*this.tileSize.w;var c=e*this.tileSize.h;var k=a.left-r.left;var o=Math.floor(k/m)-this.buffer;var l=k/m-o;var f=-l*this.tileSize.w;var p=r.left+o*m;var b=a.top-(r.bottom+c);var h=Math.ceil(b/c)+this.buffer;var q=h-b/c;var d=-q*this.tileSize.h;var g=r.bottom+h*c;return{tilelon:m,tilelat:c,tileoffsetlon:p,tileoffsetlat:g,tileoffsetx:f,tileoffsety:d}},initGriddedTiles:function(k){var g=this.map.getSize();var A=Math.ceil(g.h/this.tileSize.h)+Math.max(1,2*this.buffer);var C=Math.ceil(g.w/this.tileSize.w)+Math.max(1,2*this.buffer);var r=this.maxExtent;var u=this.map.getResolution();var t=this.calculateGridLayout(k,r,u);var f=Math.round(t.tileoffsetx);var c=Math.round(t.tileoffsety);var m=t.tileoffsetlon;var q=t.tileoffsetlat;var e=t.tilelon;var l=t.tilelat;this.origin=new OpenLayers.Pixel(f,c);var z=f;var B=m;var w=0;var a=parseInt(this.map.layerContainerDiv.style.left);var v=parseInt(this.map.layerContainerDiv.style.top);do{var h=this.grid[w++];if(!h){h=[];this.grid.push(h)}m=B;f=z;var d=0;do{var b=new OpenLayers.Bounds(m,q,m+e,q+l);var p=f;p-=a;var o=c;o-=v;var s=new OpenLayers.Pixel(p,o);var D=h[d++];if(!D){D=this.addTile(b,s);this.addTileMonitoringHooks(D);h.push(D)}else{D.moveTo(b,s,false)}m+=e;f+=this.tileSize.w}while((m<=k.right+e*this.buffer)||d<C);q-=l;c+=this.tileSize.h}while((q>=k.bottom-l*this.buffer)||w<A);this.removeExcessTiles(w,d);this.spiralTileLoad()},spiralTileLoad:function(){var b=[];var h=["right","down","left","up"];var g=0;var a=-1;var l=OpenLayers.Util.indexOf(h,"right");var m=0;while(m<h.length){var k=g;var c=a;switch(h[l]){case"right":c++;break;case"down":k++;break;case"left":c--;break;case"up":k--;break}var f=null;if((k<this.grid.length)&&(k>=0)&&(c<this.grid[0].length)&&(c>=0)){f=this.grid[k][c]}if((f!=null)&&(!f.queued)){b.unshift(f);f.queued=true;m=0;g=k;a=c}else{l=(l+1)%4;m++}}for(var d=0,e=b.length;d<e;d++){var f=b[d];f.draw();f.queued=false}},addTile:function(b,a){},addTileMonitoringHooks:function(a){a.onLoadStart=function(){if(this.numLoadingTiles==0){this.events.triggerEvent("loadstart")}this.numLoadingTiles++};a.events.register("loadstart",this,a.onLoadStart);a.onLoadEnd=function(){this.numLoadingTiles--;this.events.triggerEvent("tileloaded");if(this.numLoadingTiles==0){this.events.triggerEvent("loadend")}};a.events.register("loadend",this,a.onLoadEnd);a.events.register("unload",this,a.onLoadEnd)},removeTileMonitoringHooks:function(a){a.unload();a.events.un({loadstart:a.onLoadStart,loadend:a.onLoadEnd,unload:a.onLoadEnd,scope:this})},moveGriddedTiles:function(c){var b=this.buffer||1;while(true){var a=this.grid[0][0].position;var d=this.map.getViewPortPxFromLayerPx(a);if(d.x>-this.tileSize.w*(b-1)){this.shiftColumn(true)}else{if(d.x<-this.tileSize.w*b){this.shiftColumn(false)}else{if(d.y>-this.tileSize.h*(b-1)){this.shiftRow(true)}else{if(d.y<-this.tileSize.h*b){this.shiftRow(false)}else{break}}}}}},shiftRow:function(p){var c=(p)?0:(this.grid.length-1);var b=this.grid;var f=b[c];var e=this.map.getResolution();var h=(p)?-this.tileSize.h:this.tileSize.h;var g=e*-h;var o=(p)?b.pop():b.shift();for(var k=0,m=f.length;k<m;k++){var d=f[k];var a=d.bounds.clone();var l=d.position.clone();a.bottom=a.bottom+g;a.top=a.top+g;l.y=l.y+h;o[k].moveTo(a,l)}if(p){b.unshift(o)}else{b.push(o)}},shiftColumn:function(o){var d=(o)?-this.tileSize.w:this.tileSize.w;var c=this.map.getResolution();var l=c*d;for(var e=0,g=this.grid.length;e<g;e++){var m=this.grid[e];var k=(o)?0:(m.length-1);var b=m[k];var a=b.bounds.clone();var f=b.position.clone();a.left=a.left+l;a.right=a.right+l;f.x=f.x+d;var h=o?this.grid[e].pop():this.grid[e].shift();h.moveTo(a,f);if(o){m.unshift(h)}else{m.push(h)}}},removeExcessTiles:function(e,c){while(this.grid.length>e){var f=this.grid.pop();for(var b=0,a=f.length;b<a;b++){var d=f[b];this.removeTileMonitoringHooks(d);d.destroy()}}while(this.grid[0].length>c){for(var b=0,a=this.grid.length;b<a;b++){var f=this.grid[b];var d=f.pop();this.removeTileMonitoringHooks(d);d.destroy()}}},onMapResize:function(){if(this.singleTile){this.clearGrid();this.setTileSize()}},getTileBounds:function(d){var c=this.maxExtent;var f=this.getResolution();var e=f*this.tileSize.w;var b=f*this.tileSize.h;var h=this.getLonLatFromViewPortPx(d);var a=c.left+(e*Math.floor((h.lon-c.left)/e));var g=c.bottom+(b*Math.floor((h.lat-c.bottom)/b));return new OpenLayers.Bounds(a,g,a+e,g+b)},CLASS_NAME:"OpenLayers.Layer.Grid"});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 h,b;var c=[];var f=false;for(var d=0,e=k.length;d<e;d++){h=k[d];var g=h.evaluate(l);if(g){if(h instanceof OpenLayers.Rule&&h.elseFilter){c.push(h)}else{f=true;this.applySymbolizer(h,a,l)}}}if(f==false&&c.length>0){f=true;for(var d=0,e=c.length;d<e;d++){this.applySymbolizer(c[d],a,l)}}if(k.length>0&&f==false){a.display="none"}return a},applySymbolizer:function(f,d,b){var a=b.geometry?this.getSymbolizerPrefix(b.geometry):OpenLayers.Style.SYMBOLIZER_PREFIXES[0];var c=f.symbolizer[a]||f.symbolizer;if(this.defaultsPerSymbolizer===true){var e=this.defaultStyle;OpenLayers.Util.applyDefaults(c,{pointRadius:e.pointRadius});if(c.stroke===true||c.graphic===true){OpenLayers.Util.applyDefaults(c,{strokeWidth:e.strokeWidth,strokeColor:e.strokeColor,strokeOpacity:e.strokeOpacity,strokeDashstyle:e.strokeDashstyle,strokeLinecap:e.strokeLinecap})}if(c.fill===true||c.graphic===true){OpenLayers.Util.applyDefaults(c,{fillColor:e.fillColor,fillOpacity:e.fillOpacity})}if(c.graphic===true){OpenLayers.Util.applyDefaults(c,{pointRadius:this.defaultStyle.pointRadius,externalGraphic:this.defaultStyle.externalGraphic,graphicName:this.defaultStyle.graphicName,graphicOpacity:this.defaultStyle.graphicOpacity,graphicWidth:this.defaultStyle.graphicWidth,graphicHeight:this.defaultStyle.graphicHeight,graphicXOffset:this.defaultStyle.graphicXOffset,graphicYOffset:this.defaultStyle.graphicYOffset})}}return this.createLiterals(OpenLayers.Util.extend(d,c),b)},createLiterals:function(d,c){var b=this.context||c.attributes||c.data;for(var a in this.propertyStyles){d[a]=OpenLayers.Style.createLiteral(d[a],b,c)}return d},findPropertyStyles:function(){var d={};var f=this.defaultStyle;this.addPropertyStyles(d,f);var h=this.rules;var e,g;for(var c=0,a=h.length;c<a;c++){e=h[c].symbolizer;for(var b in e){g=e[b];if(typeof g=="object"){this.addPropertyStyles(d,g)}else{this.addPropertyStyles(d,e);break}}}return d},addPropertyStyles:function(b,c){var d;for(var a in c){d=c[a];if(typeof d=="string"&&d.match(/\$\{\w+\}/)){b[a]=true}}return b},addRules:function(a){this.rules=this.rules.concat(a);this.propertyStyles=this.findPropertyStyles()},setDefaultStyle:function(a){this.defaultStyle=a;this.propertyStyles=this.findPropertyStyles()},getSymbolizerPrefix:function(d){var c=OpenLayers.Style.SYMBOLIZER_PREFIXES;for(var b=0,a=c.length;b<a;b++){if(d.CLASS_NAME.indexOf(c[b])!=-1){return c[b]}}},CLASS_NAME:"OpenLayers.Style"});OpenLayers.Style.createLiteral=function(c,b,a){if(typeof c=="string"&&c.indexOf("${")!=-1){c=OpenLayers.String.format(c,b,[a]);c=(isNaN(c)||!c)?c:parseFloat(c)}return c};OpenLayers.Style.SYMBOLIZER_PREFIXES=["Point","Line","Polygon","Text"];OpenLayers.Control.Navigation=OpenLayers.Class(OpenLayers.Control,{dragPan:null,dragPanOptions:null,zoomBox:null,zoomWheelEnabled:true,handleRightClicks:false,zoomBoxKeyMask:OpenLayers.Handler.MOD_SHIFT,initialize:function(a){this.handlers={};OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.deactivate();if(this.dragPan){this.dragPan.destroy()}this.dragPan=null;if(this.zoomBox){this.zoomBox.destroy()}this.zoomBox=null;OpenLayers.Control.prototype.destroy.apply(this,arguments)},activate:function(){this.dragPan.activate();if(this.zoomWheelEnabled){this.handlers.wheel.activate()}this.handlers.click.activate();this.zoomBox.activate();return OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){this.zoomBox.deactivate();this.dragPan.deactivate();this.handlers.click.deactivate();this.handlers.wheel.deactivate();return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},draw:function(){if(this.handleRightClicks){this.map.viewPortDiv.oncontextmenu=function(){return false}}var a={dblclick:this.defaultDblClick,dblrightclick:this.defaultDblRightClick};var b={"double":true,stopDouble:true};this.handlers.click=new OpenLayers.Handler.Click(this,a,b);this.dragPan=new OpenLayers.Control.DragPan(OpenLayers.Util.extend({map:this.map},this.dragPanOptions));this.zoomBox=new OpenLayers.Control.ZoomBox({map:this.map,keyMask:this.zoomBoxKeyMask});this.dragPan.draw();this.zoomBox.draw();this.handlers.wheel=new OpenLayers.Handler.MouseWheel(this,{up:this.wheelUp,down:this.wheelDown});this.activate()},defaultDblClick:function(b){var a=this.map.getLonLatFromViewPortPx(b.xy);this.map.setCenter(a,this.map.zoom+1)},defaultDblRightClick:function(b){var a=this.map.getLonLatFromViewPortPx(b.xy);this.map.setCenter(a,this.map.zoom-1)},wheelChange:function(h,c){var f=this.map.getZoom()+c;if(!this.map.isValidZoomLevel(f)){return}var k=this.map.getSize();var e=k.w/2-h.xy.x;var d=h.xy.y-k.h/2;var g=this.map.baseLayer.getResolutionForZoom(f);var a=this.map.getLonLatFromPixel(h.xy);var b=new OpenLayers.LonLat(a.lon+e*g,a.lat+d*g);this.map.setCenter(b,f)},wheelUp:function(a){this.wheelChange(a,1)},wheelDown:function(a){this.wheelChange(a,-1)},disableZoomWheel:function(){this.zoomWheelEnabled=false;this.handlers.wheel.deactivate()},enableZoomWheel:function(){this.zoomWheelEnabled=true;if(this.active){this.handlers.wheel.activate()}},CLASS_NAME:"OpenLayers.Control.Navigation"});OpenLayers.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(e,h,f){var c=false;var d=this.getBounds();if((d!=null)&&(e!=null)){var b=(h!=null)?h:0;var a=(f!=null)?f:0;var g=new OpenLayers.Bounds(this.bounds.left-b,this.bounds.bottom-a,this.bounds.right+b,this.bounds.top+a);c=g.containsLonLat(e)}return c},getLength:function(){return 0},getArea:function(){return 0},getCentroid:function(){return null},toString:function(){return OpenLayers.Format.WKT.prototype.write(new OpenLayers.Feature.Vector(this))},CLASS_NAME:"OpenLayers.Geometry"});OpenLayers.Geometry.fromWKT=function(f){var g=arguments.callee.format;if(!g){g=new OpenLayers.Format.WKT();arguments.callee.format=g}var d;var b=g.read(f);if(b instanceof OpenLayers.Feature.Vector){d=b.geometry}else{if(b instanceof Array){var a=b.length;var e=new Array(a);for(var c=0;c<a;++c){e[c]=b[c].geometry}d=new OpenLayers.Geometry.Collection(e)}}return d};OpenLayers.Geometry.segmentsIntersect=function(a,I,b){var t=b&&b.point;var A=b&&b.tolerance;var f=false;var C=a.x1-I.x1;var G=a.y1-I.y1;var q=a.x2-a.x1;var z=a.y2-a.y1;var u=I.y2-I.y1;var l=I.x2-I.x1;var E=(u*q)-(l*z);var e=(l*G)-(u*C);var c=(q*G)-(z*C);if(E==0){if(e==0&&c==0){f=true}}else{var F=e/E;var D=c/E;if(F>=0&&F<=1&&D>=0&&D<=1){if(!t){f=true}else{var h=a.x1+(F*q);var g=a.y1+(F*z);f=new OpenLayers.Geometry.Point(h,g)}}}if(A){var s;if(f){if(t){var o=[a,I];var B,h,g;outer:for(var w=0;w<2;++w){B=o[w];for(var v=1;v<3;++v){h=B["x"+v];g=B["y"+v];s=Math.sqrt(Math.pow(h-f.x,2)+Math.pow(g-f.y,2));if(s<A){f.x=h;f.y=g;break outer}}}}}else{var o=[a,I];var r,H,h,g,m,k;outer:for(var w=0;w<2;++w){r=o[w];H=o[(w+1)%2];for(var v=1;v<3;++v){m={x:r["x"+v],y:r["y"+v]};k=OpenLayers.Geometry.distanceToSegment(m,H);if(k.distance<A){if(t){f=new OpenLayers.Geometry.Point(m.x,m.y)}else{f=true}break outer}}}}}return f};OpenLayers.Geometry.distanceToSegment=function(m,d){var c=m.x;var l=m.y;var b=d.x1;var k=d.y1;var a=d.x2;var f=d.y2;var p=a-b;var o=f-k;var h=((p*(c-b))+(o*(l-k)))/(Math.pow(p,2)+Math.pow(o,2));var g,e;if(h<=0){g=b;e=k}else{if(h>=1){g=a;e=f}else{g=b+h*p;e=k+h*o}}return{distance:Math.sqrt(Math.pow(g-c,2)+Math.pow(e-l,2)),x:g,y:e}};OpenLayers.Layer.DeferredGoogle=OpenLayers.Class(OpenLayers.Layer,{name:null,options:null,arguments:null,isBaseLayer:true,waitingForSwap:false,initialize:function(b,a){OpenLayers.Layer.prototype.initialize.apply(this,arguments);this.name=b;this.options=a;this.arguments=arguments},display:function(b){var a=this;if(b&&!this.waitingForSwap){this.waitingForSwap=true;this.loadGoogleMapsCode(function(){a.swapLayer()})}},swapLayer:function(){if(this.options.type=="G_PHYSICAL_MAP"){this.options.type=G_PHYSICAL_MAP}else{if(this.options.type=="G_SATELLITE_MAP"){this.options.type=G_SATELLITE_MAP}else{if(this.options.type=="G_NORMAL_MAP"){this.options.type=G_NORMAL_MAP}}}var c=this.map;var b=new OpenLayers.Layer.Google(this.name,this.options,this.arguments);var a=c.getLayerIndex(this);c.addLayer(b);c.removeLayer(this);c.setLayerIndex(b,a);c.setBaseLayer(b)},loadGoogleMapsCode:function(d){var c=true;try{if(!G_NORMAL_MAP){c=false}}catch(a){c=false}if(c){d();return}var b=this;google.load("maps","2",{callback:function(){d()}})},CLASS_NAME:"OpenLayers.Layer.DeferredGoogle"});OpenLayers.Layer.WMS=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{service:"WMS",version:"1.1.1",request:"GetMap",styles:"",exceptions:"application/vnd.ogc.se_inimage",format:"image/jpeg"},reproject:false,isBaseLayer:true,encodeBBOX:false,noMagic:false,initialize:function(d,c,e,b){var a=[];e=OpenLayers.Util.upperCaseObject(e);a.push(d,c,e,b);OpenLayers.Layer.Grid.prototype.initialize.apply(this,a);OpenLayers.Util.applyDefaults(this.params,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS));if(!this.noMagic&&this.params.TRANSPARENT&&this.params.TRANSPARENT.toString().toLowerCase()=="true"){if((b==null)||(!b.isBaseLayer)){this.isBaseLayer=false}if(this.params.FORMAT=="image/jpeg"){this.params.FORMAT=OpenLayers.Util.alphaHack()?"image/gif":"image/png"}}},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments)},clone:function(a){if(a==null){a=new OpenLayers.Layer.WMS(this.name,this.url,this.params,this.options)}a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a]);return a},getURL:function(b){b=this.adjustBounds(b);var c=this.getImageSize();var d={BBOX:this.encodeBBOX?b.toBBOX():b.toArray(),WIDTH:c.w,HEIGHT:c.h};var a=this.getFullRequestString(d);return a},addTile:function(b,a){return new OpenLayers.Tile.Image(this,a,b,null,this.tileSize)},mergeNewParams:function(c){var b=OpenLayers.Util.upperCaseObject(c);var a=[b];return OpenLayers.Layer.Grid.prototype.mergeNewParams.apply(this,a)},getFullRequestString:function(c,b){var a=this.map.getProjection();this.params.SRS=(a=="none")?null:a;return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments)},CLASS_NAME:"OpenLayers.Layer.WMS"});OpenLayers.StyleMap=OpenLayers.Class({styles:null,extendDefault:true,initialize:function(c,a){this.styles={"default":new OpenLayers.Style(OpenLayers.Feature.Vector.style["default"]),select:new OpenLayers.Style(OpenLayers.Feature.Vector.style.select),temporary:new OpenLayers.Style(OpenLayers.Feature.Vector.style.temporary),"delete":new OpenLayers.Style(OpenLayers.Feature.Vector.style["delete"])};if(c instanceof OpenLayers.Style){this.styles["default"]=c;this.styles.select=c;this.styles.temporary=c;this.styles["delete"]=c}else{if(typeof c=="object"){for(var b in c){if(c[b] instanceof OpenLayers.Style){this.styles[b]=c[b]}else{if(typeof c[b]=="object"){this.styles[b]=new OpenLayers.Style(c[b])}else{this.styles["default"]=new OpenLayers.Style(c);this.styles.select=new OpenLayers.Style(c);this.styles.temporary=new OpenLayers.Style(c);this.styles["delete"]=new OpenLayers.Style(c);break}}}}}OpenLayers.Util.extend(this,a)},destroy:function(){for(var a in this.styles){this.styles[a].destroy()}this.styles=null},createSymbolizer:function(b,c){if(!b){b=new OpenLayers.Feature.Vector()}if(!this.styles[c]){c="default"}b.renderIntent=c;var a={};if(this.extendDefault&&c!="default"){a=this.styles["default"].createSymbolizer(b)}return OpenLayers.Util.extend(a,this.styles[c].createSymbolizer(b))},addUniqueValueRules:function(b,d,f,a){var e=[];for(var c in f){e.push(new OpenLayers.Rule({symbolizer:f[c],context:a,filter:new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.EQUAL_TO,property:d,value:c})}))}this.styles[b].addRules(e)},CLASS_NAME:"OpenLayers.StyleMap"});OpenLayers.Geometry.Collection=OpenLayers.Class(OpenLayers.Geometry,{components:null,componentTypes:null,initialize:function(a){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.components=[];if(a!=null){this.addComponents(a)}},destroy:function(){this.components.length=0;this.components=null},clone:function(){var geometry=eval("new "+this.CLASS_NAME+"()");for(var i=0,len=this.components.length;i<len;i++){geometry.addComponent(this.components[i].clone())}OpenLayers.Util.applyDefaults(geometry,this);return geometry},getComponentsString:function(){var b=[];for(var c=0,a=this.components.length;c<a;c++){b.push(this.components[c].toShortString())}return b.join(",")},calculateBounds:function(){this.bounds=null;if(this.components&&this.components.length>0){this.setBounds(this.components[0].getBounds());for(var b=1,a=this.components.length;b<a;b++){this.extendBounds(this.components[b].getBounds())}}},addComponents:function(c){if(!(c instanceof Array)){c=[c]}for(var b=0,a=c.length;b<a;b++){this.addComponent(c[b])}},addComponent:function(b,a){var d=false;if(b){if(this.componentTypes==null||(OpenLayers.Util.indexOf(this.componentTypes,b.CLASS_NAME)>-1)){if(a!=null&&(a<this.components.length)){var e=this.components.slice(0,a);var c=this.components.slice(a,this.components.length);e.push(b);this.components=e.concat(c)}else{this.components.push(b)}b.parent=this;this.clearBounds();d=true}}return d},removeComponents:function(b){if(!(b instanceof Array)){b=[b]}for(var a=b.length-1;a>=0;--a){this.removeComponent(b[a])}},removeComponent:function(a){OpenLayers.Util.removeItem(this.components,a);this.clearBounds()},getLength:function(){var c=0;for(var b=0,a=this.components.length;b<a;b++){c+=this.components[b].getLength()}return c},getArea:function(){var c=0;for(var b=0,a=this.components.length;b<a;b++){c+=this.components[b].getArea()}return c},getGeodesicArea:function(b){var d=0;for(var c=0,a=this.components.length;c<a;c++){d+=this.components[c].getGeodesicArea(b)}return d},getCentroid:function(){return this.components.length&&this.components[0].getCentroid()},getGeodesicLength:function(b){var d=0;for(var c=0,a=this.components.length;c<a;c++){d+=this.components[c].getGeodesicLength(b)}return d},move:function(b,d){for(var c=0,a=this.components.length;c<a;c++){this.components[c].move(b,d)}},rotate:function(d,b){for(var c=0,a=this.components.length;c<a;++c){this.components[c].rotate(d,b)}},resize:function(d,a,c){for(var b=0;b<this.components.length;++b){this.components[b].resize(d,a,c)}return this},distanceTo:function(g,h){var b=!(h&&h.edge===false);var a=b&&h&&h.details;var k,c;var d=Number.POSITIVE_INFINITY;for(var e=0,f=this.components.length;e<f;++e){k=this.components[e].distanceTo(g,h);distance=a?k.distance:k;if(distance<d){d=distance;c=k;if(d==0){break}}}return c},equals:function(d){var b=true;if(!d||!d.CLASS_NAME||(this.CLASS_NAME!=d.CLASS_NAME)){b=false}else{if(!(d.components instanceof Array)||(d.components.length!=this.components.length)){b=false}else{for(var c=0,a=this.components.length;c<a;++c){if(!this.components[c].equals(d.components[c])){b=false;break}}}}return b},transform:function(e,c){if(e&&c){for(var d=0,a=this.components.length;d<a;d++){var b=this.components[d];b.transform(e,c)}this.bounds=null}return this},intersects:function(d){var b=false;for(var c=0,a=this.components.length;c<a;++c){b=d.intersects(this.components[c]);if(b){break}}return b},getVertices:function(b){var c=[];for(var d=0,a=this.components.length;d<a;++d){Array.prototype.push.apply(c,this.components[d].getVertices(b))}return c},CLASS_NAME:"OpenLayers.Geometry.Collection"});OpenLayers.Geometry.Point=OpenLayers.Class(OpenLayers.Geometry,{x:null,y:null,initialize:function(a,b){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.x=parseFloat(a);this.y=parseFloat(b)},clone:function(a){if(a==null){a=new OpenLayers.Geometry.Point(this.x,this.y)}OpenLayers.Util.applyDefaults(a,this);return a},calculateBounds:function(){this.bounds=new OpenLayers.Bounds(this.x,this.y,this.x,this.y)},distanceTo:function(f,l){var d=!(l&&l.edge===false);var a=d&&l&&l.details;var b,e,h,c,g,k;if(f instanceof OpenLayers.Geometry.Point){e=this.x;h=this.y;c=f.x;g=f.y;b=Math.sqrt(Math.pow(e-c,2)+Math.pow(h-g,2));k=!a?b:{x0:e,y0:h,x1:c,y1:g,distance:b}}else{k=f.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(d,b){d*=Math.PI/180;var a=this.distanceTo(b);var c=d+Math.atan2(this.y-b.y,this.x-b.x);this.x=b.x+(a*Math.cos(c));this.y=b.y+(a*Math.sin(c));this.clearBounds()},getCentroid:function(){return new OpenLayers.Geometry.Point(this.x,this.y)},resize:function(c,a,b){b=(b==undefined)?1:b;this.x=a.x+(c*b*(this.x-a.x));this.y=a.y+(c*(this.y-a.y));this.clearBounds();return this},intersects:function(b){var a=false;if(b.CLASS_NAME=="OpenLayers.Geometry.Point"){a=this.equals(b)}else{a=b.intersects(this)}return a},transform:function(b,a){if((b&&a)){OpenLayers.Projection.transform(this,b,a);this.bounds=null}return this},getVertices:function(a){return[this]},CLASS_NAME:"OpenLayers.Geometry.Point"});OpenLayers.Layer.Vector=OpenLayers.Class(OpenLayers.Layer,{EVENT_TYPES:["beforefeatureadded","beforefeaturesadded","featureadded","featuresadded","beforefeatureremoved","featureremoved","featuresremoved","beforefeatureselected","featureselected","featureunselected","beforefeaturemodified","featuremodified","afterfeaturemodified","vertexmodified","sketchstarted","sketchmodified","sketchcomplete","refresh"],isBaseLayer:false,isFixed:false,isVector:true,features:null,selectedFeatures:null,unrenderedFeatures:null,reportError:true,style:null,styleMap:null,strategies:null,protocol:null,renderers:["SVG","VML","Canvas"],renderer:null,rendererOptions:null,geometryType:null,drawn:false,initialize:function(c,b){this.EVENT_TYPES=OpenLayers.Layer.Vector.prototype.EVENT_TYPES.concat(OpenLayers.Layer.prototype.EVENT_TYPES);OpenLayers.Layer.prototype.initialize.apply(this,arguments);if(!this.renderer||!this.renderer.supported()){this.assignRenderer()}if(!this.renderer||!this.renderer.supported()){this.renderer=null;this.displayError()}if(!this.styleMap){this.styleMap=new OpenLayers.StyleMap()}this.features=[];this.selectedFeatures=[];this.unrenderedFeatures={};if(this.strategies){for(var d=0,a=this.strategies.length;d<a;d++){this.strategies[d].setLayer(this)}}},destroy:function(){if(this.strategies){var c,b,a;for(b=0,a=this.strategies.length;b<a;b++){c=this.strategies[b];if(c.autoDestroy){c.destroy()}}this.strategies=null}if(this.protocol){if(this.protocol.autoDestroy){this.protocol.destroy()}this.protocol=null}this.destroyFeatures();this.features=null;this.selectedFeatures=null;this.unrenderedFeatures=null;if(this.renderer){this.renderer.destroy()}this.renderer=null;this.geometryType=null;this.drawn=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},refresh:function(a){if(this.calculateInRange()&&this.visibility){this.events.triggerEvent("refresh",a)}},assignRenderer:function(){for(var c=0,a=this.renderers.length;c<a;c++){var b=OpenLayers.Renderer[this.renderers[c]];if(b&&b.prototype.supported()){this.renderer=new b(this.div,this.rendererOptions);break}}},displayError:function(){if(this.reportError){OpenLayers.Console.userError(OpenLayers.i18n("browserNotSupported",{renderers:this.renderers.join("\n")}))}},setMap:function(a){OpenLayers.Layer.prototype.setMap.apply(this,arguments);if(!this.renderer){this.map.removeLayer(this)}else{this.renderer.map=this.map;this.renderer.setSize(this.map.getSize())}},afterAdd:function(){if(this.strategies){var c,b,a;for(b=0,a=this.strategies.length;b<a;b++){c=this.strategies[b];if(c.autoActivate){c.activate()}}}},removeMap:function(c){if(this.strategies){var d,b,a;for(b=0,a=this.strategies.length;b<a;b++){d=this.strategies[b];if(d.autoActivate){d.deactivate()}}}},onMapResize:function(){OpenLayers.Layer.prototype.onMapResize.apply(this,arguments);this.renderer.setSize(this.map.getSize())},moveTo:function(g,b,h){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);var e=true;if(!h){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 f=this.map.getExtent();e=this.renderer.setExtent(f,b);this.renderer.root.style.visibility="visible";if(navigator.userAgent.toLowerCase().indexOf("gecko")!=-1){this.div.scrollLeft=this.div.scrollLeft}if(!b&&e){for(var d in this.unrenderedFeatures){var c=this.unrenderedFeatures[d];this.drawFeature(c)}}}if(!this.drawn||b||!e){this.drawn=true;var c;for(var d=0,a=this.features.length;d<a;d++){this.renderer.locked=(d!==(a-1));c=this.features[d];this.drawFeature(c)}}},display:function(a){OpenLayers.Layer.prototype.display.apply(this,arguments);var b=this.div.style.display;if(b!=this.renderer.root.style.display){this.renderer.root.style.display=b}},addFeatures:function(b,k){if(!(b instanceof Array)){b=[b]}var g=!k||!k.silent;if(g){var a={features:b};var f=this.events.triggerEvent("beforefeaturesadded",a);if(f===false){return}b=a.features}for(var c=0,e=b.length;c<e;c++){if(c!=(b.length-1)){this.renderer.locked=true}else{this.renderer.locked=false}var h=b[c];if(this.geometryType&&!(h.geometry instanceof this.geometryType)){var d=OpenLayers.i18n("componentShouldBe",{geomType:this.geometryType.prototype.CLASS_NAME});throw d}this.features.push(h);h.layer=this;if(!h.style&&this.style){h.style=OpenLayers.Util.extend({},this.style)}if(g){if(this.events.triggerEvent("beforefeatureadded",{feature:h})===false){continue}this.preFeatureInsert(h)}this.drawFeature(h);if(g){this.events.triggerEvent("featureadded",{feature:h});this.onFeatureInsert(h)}}if(g){this.events.triggerEvent("featuresadded",{features:b})}},removeFeatures:function(e,a){if(!e||e.length===0){return}if(!(e instanceof Array)){e=[e]}if(e===this.features){e=e.slice()}var d=!a||!a.silent;for(var c=e.length-1;c>=0;c--){if(c!=0&&e[c-1].geometry){this.renderer.locked=true}else{this.renderer.locked=false}var b=e[c];delete this.unrenderedFeatures[b.id];if(d){this.events.triggerEvent("beforefeatureremoved",{feature:b})}this.features=OpenLayers.Util.removeItem(this.features,b);b.layer=null;if(b.geometry){this.renderer.eraseFeatures(b)}if(OpenLayers.Util.indexOf(this.selectedFeatures,b)!=-1){OpenLayers.Util.removeItem(this.selectedFeatures,b)}if(d){this.events.triggerEvent("featureremoved",{feature:b})}}if(d){this.events.triggerEvent("featuresremoved",{features:e})}},destroyFeatures:function(d,a){var c=(d==undefined);if(c){d=this.features}if(d){this.removeFeatures(d,a);for(var b=d.length-1;b>=0;b--){d[b].destroy()}}},drawFeature:function(a,b){if(!this.drawn){return}if(typeof b!="object"){if(!b&&a.state===OpenLayers.State.DELETE){b="delete"}var c=b||a.renderIntent;b=a.style||this.style;if(!b){b=this.styleMap.createSymbolizer(a,c)}}if(!this.renderer.drawFeature(a,b)){this.unrenderedFeatures[a.id]=a}else{delete this.unrenderedFeatures[a.id]}},eraseFeatures:function(a){this.renderer.eraseFeatures(a)},getFeatureFromEvent:function(a){if(!this.renderer){OpenLayers.Console.error(OpenLayers.i18n("getFeatureError"));return null}var b=this.renderer.getFeatureIdFromEvent(a);return this.getFeatureById(b)},getFeatureById:function(d){var c=null;for(var b=0,a=this.features.length;b<a;++b){if(this.features[b].id==d){c=this.features[b];break}}return c},onFeatureInsert:function(a){},preFeatureInsert:function(a){},getDataExtent:function(){var b=null;if(this.features&&(this.features.length>0)){b=new OpenLayers.Bounds();for(var c=0,a=this.features.length;c<a;c++){b.extend(this.features[c].geometry.getBounds())}}return b},CLASS_NAME:"OpenLayers.Layer.Vector"});OpenLayers.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 c=0;if(this.components&&(this.components.length>1)){for(var b=1,a=this.components.length;b<a;b++){c+=this.components[b-1].distanceTo(this.components[b])}}return c},getGeodesicLength:function(b){var e=this;if(b){var c=new OpenLayers.Projection("EPSG:4326");if(!c.equals(b)){e=this.clone().transform(b,c)}}var f=0;if(e.components&&(e.components.length>1)){var h,g;for(var d=1,a=e.components.length;d<a;d++){h=e.components[d-1];g=e.components[d];f+=OpenLayers.Util.distVincenty({lon:h.x,lat:h.y},{lon:g.x,lat:g.y})}}return f*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(m){var c=false;var l=m.CLASS_NAME;if(l=="OpenLayers.Geometry.LineString"||l=="OpenLayers.Geometry.LinearRing"||l=="OpenLayers.Geometry.Point"){var q=this.getSortedSegments();var o;if(l=="OpenLayers.Geometry.Point"){o=[{x1:m.x,y1:m.y,x2:m.x,y2:m.y}]}else{o=m.getSortedSegments()}var t,g,e,a,s,r,d,b;outer:for(var h=0,k=q.length;h<k;++h){t=q[h];g=t.x1;e=t.x2;a=t.y1;s=t.y2;inner:for(var f=0,p=o.length;f<p;++f){r=o[f];if(r.x1>e){break}if(r.x2<g){continue}d=r.y1;b=r.y2;if(Math.min(d,b)>Math.max(a,s)){continue}if(Math.max(d,b)<Math.min(a,s)){continue}if(OpenLayers.Geometry.segmentsIntersect(t,r)){c=true;break outer}}}}else{c=m.intersects(this)}return c},getSortedSegments:function(){var a=this.components.length-1;var b=new Array(a);for(var c=0;c<a;++c){point1=this.components[c];point2=this.components[c+1];if(point1.x<point2.x){b[c]={x1:point1.x,y1:point1.y,x2:point2.x,y2:point2.y}}else{b[c]={x1:point2.x,y1:point2.y,x2:point1.x,y2:point1.y}}}function d(f,e){return f.x1-e.x1}return b.sort(d)},splitWithSegment:function(t,b){var c=!(b&&b.edge===false);var q=b&&b.tolerance;var a=[];var v=this.getVertices();var p=[];var z=[];var h=false;var e,d,m;var k,s,w;var f={point:true,tolerance:q};var g=null;for(var o=0,l=v.length-2;o<=l;++o){e=v[o];p.push(e.clone());d=v[o+1];w={x1:e.x,y1:e.y,x2:d.x,y2:d.y};m=OpenLayers.Geometry.segmentsIntersect(t,w,f);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(e)||m.equals(d)){s=true}else{s=false}if(s||c){if(!m.equals(z[z.length-1])){z.push(m.clone())}if(o===0){if(m.equals(e)){continue}}if(m.equals(d)){continue}h=true;if(!m.equals(e)){p.push(m)}a.push(new OpenLayers.Geometry.LineString(p));p=[m.clone()]}}}if(h){p.push(d.clone());a.push(new OpenLayers.Geometry.LineString(p))}if(z.length>0){var r=t.x1<t.x2?1:-1;var u=t.y1<t.y2?1:-1;g={lines:a,points:z.sort(function(B,A){return(r*B.x-r*A.x)||(u*B.y-u*A.y)})}}return g},split:function(A,b){var o=null;var d=b&&b.mutual;var l,e,m,c;if(A instanceof OpenLayers.Geometry.LineString){var z=this.getVertices();var g,f,w,h,a,q;var t=[];m=[];for(var u=0,p=z.length-2;u<=p;++u){g=z[u];f=z[u+1];w={x1:g.x,y1:g.y,x2:f.x,y2:f.y};c=c||[A];if(d){t.push(g.clone())}for(var s=0;s<c.length;++s){h=c[s].splitWithSegment(w,b);if(h){a=h.lines;if(a.length>0){a.unshift(s,1);Array.prototype.splice.apply(c,a);s+=a.length-2}if(d){for(var r=0,v=h.points.length;r<v;++r){q=h.points[r];if(!q.equals(g)){t.push(q);m.push(new OpenLayers.Geometry.LineString(t));if(q.equals(f)){t=[]}else{t=[q.clone()]}}}}}}}if(d&&m.length>0&&t.length>0){t.push(f.clone());m.push(new OpenLayers.Geometry.LineString(t))}}else{o=A.splitWith(this,b)}if(c&&c.length>1){e=true}else{c=[]}if(m&&m.length>1){l=true}else{m=[]}if(e||l){if(d){o=[m,c]}else{o=c}}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(h,g){var k=!(g&&g.edge===false);var C=k&&g&&g.details;var r,e={};var u=Number.POSITIVE_INFINITY;if(h instanceof OpenLayers.Geometry.Point){var s=this.getSortedSegments();var q=h.x;var p=h.y;var A;for(var w=0,z=s.length;w<z;++w){A=s[w];r=OpenLayers.Geometry.distanceToSegment(h,A);if(r.distance<u){u=r.distance;e=r;if(u===0){break}}else{if(A.x2>q&&((p>A.y1&&p<A.y2)||(p<A.y1&&p>A.y2))){break}}}if(C){e={distance:e.distance,x0:e.x,y0:e.y,x1:q,y1:p}}else{e=e.distance}}else{if(h instanceof OpenLayers.Geometry.LineString){var d=this.getSortedSegments();var c=h.getSortedSegments();var b,a,o,B,f;var m=c.length;var l={point:true};outer:for(var w=0,z=d.length;w<z;++w){b=d[w];B=b.x1;f=b.y1;for(var v=0;v<m;++v){a=c[v];o=OpenLayers.Geometry.segmentsIntersect(b,a,l);if(o){u=0;e={distance:0,x0:o.x,y0:o.y,x1:o.x,y1:o.y};break outer}else{r=OpenLayers.Geometry.distanceToSegment({x:B,y:f},a);if(r.distance<u){u=r.distance;e={distance:u,x0:B,y0:f,x1:r.x,y1:r.y}}}}}if(!C){e=e.distance}if(u!==0){if(b){r=h.distanceTo(new OpenLayers.Geometry.Point(b.x2,b.y2),g);var t=C?r.distance:r;if(t<u){if(C){e={distance:u,x0:r.x1,y0:r.y1,x1:r.x0,y1:r.y0}}else{e=t}}}}}else{e=h.distanceTo(this,g);if(C){e={distance:e.distance,x0:e.x1,y0:e.y1,x1:e.x0,y1:e.y0}}}}return e},CLASS_NAME:"OpenLayers.Geometry.LineString"});var DatePickerUtils={oneDayInMs:24*3600*1000,_daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],getMonthDays:function(a,b){if(((0==(a%4))&&((0!=(a%100))||(0==(a%400))))&&(b==1)){return 29}return this._daysInMonth[b]},parseDate:function(c){var a=DatePickerUtils.ansiDateToObject(c);if(!a){var b=parseFloat(c);a=new Date();a.setTime(a.getTime()+c*this.oneDayInMs)}return a},dateObjectToAnsi:function(a){if(!a){return null}return a.getFullYear().toPaddedString(4)+"-"+(a.getMonth()+1).toPaddedString(2)+"-"+a.getDate().toPaddedString(2)},ansiDateToObject:function(c){var a=null;var b=String(c).match(/^(\d+)-0*(\d+)-0*(\d+)$/);if(b){a=new Date(b[1],b[2]-1,b[3])}return a},yearMonthToAnsiStub:function(a,b){return a.toPaddedString(4)+"-"+(b+1).toPaddedString(2)+"-"},noDatesBefore:function(a){return new DatePickerFilter(function(d,h){var b=DatePickerUtils.dateObjectToAnsi(a);var g=new Array();var f=DatePickerUtils.getMonthDays(d,h);var e=DatePickerUtils.yearMonthToAnsiStub(d,h);for(var c=1;c<=f;c++){g[c]=(b>(e+c.toPaddedString(2)))}return g},function(c,e){var b=DatePickerUtils.dateObjectToAnsi(a);var d=DatePickerUtils.yearMonthToAnsiStub(c,e)+DatePickerUtils.getMonthDays(c,e);return(b<=d)})},noDatesAfter:function(a){return new DatePickerFilter(function(d,h){var b=DatePickerUtils.dateObjectToAnsi(a);var g=new Array();var f=DatePickerUtils.getMonthDays(d,h);var e=DatePickerUtils.yearMonthToAnsiStub(d,h);for(var c=1;c<=f;c++){g[c]=(b<(e+c.toPaddedString(2)))}return g},function(c,e){var b=DatePickerUtils.dateObjectToAnsi(a);var d=DatePickerUtils.yearMonthToAnsiStub(c,e)+"01";return(b>=d)})}};var DatePickerFormatter=Class.create();DatePickerFormatter.prototype={initialize:function(b,a){if(Object.isUndefined(b)){b=["yyyy","mm","dd"]}if(Object.isUndefined(a)){a="-"}this._format=b;this.separator=a;this._formatYearIndex=b.indexOf("yyyy");this._formatMonthIndex=b.indexOf("mm");this._formatDayIndex=b.indexOf("dd");this._yearRegexp=/^\d{4}$/;this._monthRegexp=/^0\d|1[012]|\d$/;this._dayRegexp=/^0\d|[12]\d|3[01]|\d$/},match:function(f){var e=f.split(this.separator);if(e.length<3){return false}var b=e[this._formatYearIndex].match(this._yearRegexp);if(b){b=b[0]}else{return false}var c=e[this._formatMonthIndex].match(this._monthRegexp);if(c){c=c[0]}else{return false}var a=e[this._formatDayIndex].match(this._dayRegexp);if(a){a=a[0]}else{return false}return[b,c,a]},currentDate:function(){var a=new Date;return this.dateToString(a.getFullYear(),a.getMonth()+1,a.getDate())},dateToString:function(d,f,c,e){if(Object.isUndefined(e)){e=this.separator}var b=[0,0,0];b[this._formatYearIndex]=d;b[this._formatMonthIndex]=f.toPaddedString(2);b[this._formatDayIndex]=c.toPaddedString(2);return b.join(e)}};var DatePickerFilter=Class.create();DatePickerFilter.prototype={initialize:function(a,b){if(a){this.badDates=a}if(b){this.validMonthP=b}},badDates:null,validMonthP:null,append:function(c){if(!this.badDates){this.badDates=c.badDates}else{if(c.badDates){var b=this.badDates;this.badDates=function(g,h){var e=b(g,h);var d=c.badDates(g,h);for(var f=0;f<e.length;f++){e[f]=e[f]||d[f]}return e}}}if(!this.validMonthP){this.validMonthP=c.validMonthP}else{if(c.validMonthP){var a=this.validMonthP;this.validMonthP=function(d,e){return a(d,e)&&c.validMonthP(d,e)}}}return this}};var DatePicker=Class.create();DatePicker.prototype={Version:"1.0.0",_relative:null,_div:null,_dateFormat:null,_language:"en",_language_month:$H({en:["January","February","March","April","May","June","July","August","September","October","November","December"]}),_language_day:$H({en:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]}),_language_date_format:$H({en:[["yyyy","mm","dd"],"-"]}),_todayDate:new Date(),_currentDate:null,_dateFilter:new DatePickerFilter(),_id_datepicker:null,_element:null,_callback:null,getMonthLocale:function(a){return this._language_month.get(this._language)[a]},_initCurrentDate:function(){if(!this._dateFormat){this._dateFormat=this._language_date_format.get(this._language)}this._df=new DatePickerFormatter(this._dateFormat[0],this._dateFormat[1]);var a=this._df.match(this._currentDate);this._currentYear=Number(a[0]);this._currentMonth=Number(a[1])-1;this._currentDay=Number(a[2])},initialize:function(a){this._relative=a.relative;if(!Object.isUndefined(a.currentDate)){this._currentDate=a.currentDate}if(!Object.isUndefined(a.element)){this._element=a.element}if(!Object.isUndefined(a.callback)){this._callback=a.callback}if(!Object.isUndefined(a.dateFilter)&&a.dateFilter){this._dateFilter=a.dateFilter}this._id_datepicker="datepicker-"+this._relative;this._id_datepicker_prev=this._id_datepicker+"-prev";this._id_datepicker_next=this._id_datepicker+"-next";this._id_datepicker_hdr=this._id_datepicker+"-header";this._div=new Element("div",{id:this._id_datepicker,className:"datepicker"});this._div.innerHTML='<table><thead><tr><th width="10px" id="'+this._id_datepicker_prev+'" style="cursor: pointer;">&nbsp;&lt;&lt;&nbsp;</th><th id="'+this._id_datepicker_hdr+'" colspan="5"></th><th width="10px" id="'+this._id_datepicker_next+'" style="cursor: pointer;">&nbsp;&gt;&gt;&nbsp;</th></tr></thead><tbody id="'+this._id_datepicker+'-tbody"></tbody></table>';this._element.update(this._div);this.load()},load:function(){this._initCurrentDate();Event.observe($(this._id_datepicker_prev),"click",this.prevMonth.bindAsEventListener(this),false);Event.observe($(this._id_datepicker_next),"click",this.nextMonth.bindAsEventListener(this),false);this._initCurrentDate();this._redrawCalendar()},_wrap_in_iframe:function(a){return(Prototype.Browser.IE)?"<div style='height:167px;width:185px;background-color:white;align:left'><iframe width='100%' height='100%' marginwidth='0' marginheight='0' frameborder='0' src='about:blank' style='filter:alpha(Opacity=50);'></iframe><div style='position:absolute;background-color:white;top:2px;left:2px;width:180px'>"+a+"</div></div>":a},close:function(){},setDateFormat:function(b,a){if(Object.isUndefined(b)){b=this._dateFormat[0]}if(Object.isUndefined(a)){a=this._dateFormat[1]}this._dateFormat=[b,a]},_buildCalendar:function(){var f=this;var a=$(this._id_datepicker+"-tbody");try{while(a.hasChildNodes()){a.removeChild(a.childNodes[0])}}catch(v){}var p=new Element("tr");this._language_day.get(this._language).each(function(d){var e=new Element("td");e.innerHTML=d;e.className="wday";p.appendChild(e)});a.appendChild(p);var w=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];var r=this._currentMonth;var B=this._currentYear;var z=new Date(B,r,1,12);var g=(z.getDay()+6)%7;var c=DatePickerUtils.getMonthDays(B,r);var k=1;var A=(this._dateFilter.badDates)?this._dateFilter.badDates(B,r):[];for(var t=g;t<7;t++){w[0][t]={d:k,m:r,y:B,b:A[k]};k++}var m=this._prevMonthYear();var q=DatePickerUtils.getMonthDays(m[1],m[0]);for(var t=0;t<g;t++){w[0][t]={d:Number(q-g+t+1),m:Number(m[0]),y:m[1],c:"outbound",b:true}}var s=false;for(var u=1;u<6;u++){for(var t=0;t<7;t++){w[u][t]={d:k,m:r,y:B,c:(s)?"outbound":(((k==this._currentDay)&&(r==this._currentMonth)&&(B==this._currentYear))?"today":null),b:s||A[k]};k++;if(k>c){k=1;s=true;if(this._currentMonth+1>11){r=0;B+=1}else{r+=1}}}}for(var u=0;u<6;u++){var b=new Element("tr");for(var t=0;t<7;t++){var l=w[u][t];var h=new Element("td");var o=$A([this._relative,this._df.dateToString(l.y,l.m+1,l.d,"-")]).join("-");h.setAttribute("id",o);if(l.c){h.className=l.c}this._bindCellOnClick(h,l.b,l.c);h.innerHTML=l.d;b.appendChild(h)}a.appendChild(b)}return a},_bindCellOnClick:function(d,b,c){if(b){d.className=(c)?"nclick_"+c:"nclick"}else{var a=this;d.onclick=function(){if(a._callback){a._callback(String($(this).readAttribute("id")).replace(a._relative+"-","").replace(/-/g,a._df.separator))}a.close()}}},_nextMonthYear:function(){var b=this._currentMonth;var a=this._currentYear;if(b+1>11){b=0;a+=1}else{b+=1}return[b,a]},nextMonth:function(){this._maybeRedrawMonth(this._nextMonthYear())},_prevMonthYear:function(){var b=this._currentMonth;var a=this._currentYear;if(b-1<0){b=11;a-=1}else{b-=1}return[b,a]},prevMonth:function(){this._maybeRedrawMonth(this._prevMonthYear())},_maybeRedrawMonth:function(c){var b=c[0];var a=c[1];if(!this._dateFilter.validMonthP||this._dateFilter.validMonthP(a,b)){this._currentMonth=b;this._currentYear=a;this._redrawCalendar()}},_redrawCalendar:function(){this._setLocaleHdr();this._buildCalendar()},_setLocaleHdr:function(){var a=this._nextMonthYear();$(this._id_datepicker_next).setAttribute("title",this.getMonthLocale(a[0])+" "+a[1]);var b=this._prevMonthYear();$(this._id_datepicker_prev).setAttribute("title",this.getMonthLocale(b[0])+" "+b[1]);$(this._id_datepicker_hdr).update("&nbsp;&nbsp;&nbsp;"+this.getMonthLocale(this._currentMonth)+"&nbsp;"+this._currentYear+"&nbsp;&nbsp;&nbsp;")}};var at=Class.create();at.idiom=Class.create();at.idiom.js=Class.create();at.idiom.js.main=Class.create();at.idiom.js.main.Main=Class.create({initialize:function(){this.loadCounter=new at.idiom.js.util.Counter();this.observers={global:{},local:{}};this.history=new at.idiom.js.history.History(this)},loadStart:function(a){this.loadCounter.start(a)},loadEnd:function(a){this.loadCounter.end(a)},loadRegisterStart:function(a){this.loadCounter.registerStart(a)},loadRegisterEnd:function(a){this.loadCounter.registerEnd(a)},updateLocation:function(a){window.location.hash=a},notify:function(a,c,d){var b=null;if(a){b=this.observers.local[a]}else{b=this.observers.global}if(b==null){b={}}if(b[c]==null){b[c]={param:null,functions:[]}}b[c].param=d;$(b[c].functions).each(function(f){try{f(d)}catch(e){}});if(a){this.observers.local[a]=b}else{this.observers.global=b}},register:function(a,d,e){var c=null;if(a){if(this.observers.local[a]==null){this.observers.local[a]={}}c=this.observers.local[a]}else{c=this.observers.global}if(!c[d]){c[d]={param:null,functions:[]};if(a){this.observers.local[a]=c}else{this.observers.global=c}}c[d].functions.push(e);if(c[d].param){try{e(c[d].param)}catch(b){}}}});var IDIOM=null;var IDIOM_LOAD=[];Event.observe(window,"load",function(){IDIOM=new at.idiom.js.main.Main();IDIOM.loadRegisterStart(function(){$("Loading").show()});IDIOM.loadRegisterEnd(function(){$("Loading").hide()});$(IDIOM_LOAD).each(function(b){try{b(IDIOM)}catch(a){IDIOM.notify("error","display","Error in calling initializer: "+a)}});dhtmlHistory.initialize();dhtmlHistory.addListener(IDIOM.history.listener.bind(IDIOM.history))});window.dhtmlHistory.create({toJSON:function(a){return Object.toJSON(a)},fromJSON:function(a){return a.evalJSON()}});at.idiom.js.history=Class.create();at.idiom.js.history.History=Class.create({initialize:function(a){this.currentCounter=0;this.contentId=0;this.snapshotId=0;this.searchTerm=null;this.searchCount=0;this.searchConcordance=null;this.idiom=a;var b=this;this.idiom.register("history","storeState",function(c){b.storeState(c)})},listener:function(a,b){if(b==null){return}this.restoreState(b);this.idiom.notify(null,"restoreState",b)},restoreState:function(a){this.contentId=a.contentid;this.snapshotId=a.snapshotid;this.searchTerm=a.searchterm;this.searchCount=a.searchcount;this.searchConcordance=a.searchconcordance;this.currentCounter=a.counter},storeState:function(b){var a=false;if(b.contentid!=this.contentId){a=true;this.contentId=b.contentid}if(b.snapshotid!=this.snapshotId){a=true;this.snapshotId=b.snapshotid}if(b.searchterm!=this.searchTerm){a=true;this.searchTerm=b.searchterm}if(b.searchcount!=this.searchCount){a=true;this.searchCount=b.searchcount}if(b.searchconcordance!=this.searchConcordance){a=true;this.searchConcordance=b.searchconcordance}if(a){this.store()}},store:function(){var b={contentid:this.contentId,snapshotid:this.snapshotId,searchterm:this.searchTerm,searchcount:this.searchCount,searchconcordance:this.searchConcordance,counter:++this.currentCounter};var a=this.currentCounter;this.currentFragment=a;dhtmlHistory.add(a,b)}});at.idiom.js.util=Class.create();at.idiom.js.util.Util={};at.idiom.js.util.Util.getPageSize=function(){var c,a;if(window.innerHeight&&window.scrollMaxY){c=window.innerWidth+window.scrollMaxX;a=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){c=document.body.scrollWidth;a=document.body.scrollHeight}else{c=document.body.offsetWidth;a=document.body.offsetHeight}}var b,d;if(self.innerHeight){if(document.documentElement.clientWidth){b=document.documentElement.clientWidth}else{b=self.innerWidth}d=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){b=document.documentElement.clientWidth;d=document.documentElement.clientHeight}else{if(document.body){b=document.body.clientWidth;d=document.body.clientHeight}}}if(a<d){pageHeight=d}else{pageHeight=a}if(c<b){pageWidth=c}else{pageWidth=b}arrayPageSize=new Array(pageWidth,pageHeight,b,d);return arrayPageSize};at.idiom.js.util.Observer=Class.create({initialize:function(){this.callbackFunctions=new Array();this.lastParam=null},register:function(b){var a=true;this.callbackFunctions.each(function(d){if(d==b){a=false;return}});var c=this.lastParam;if(a){this.callbackFunctions.push(b);if(c){setTimeout(function(){b(c)},1)}}},unregister:function(b){var a=this;this.callbackFunctions.each(function(c){if(c==b){a.callbackFunctions.remove(c)}})},notify:function(a){this.callbackFunctions.each(function(c){try{c(a)}catch(b){}});this.lastParam=a}});at.idiom.js.util.Notifier=Class.create({initialize:function(){this.callbackFunction=null;this.lastParam=null},register:function(a){this.callbackFunction=a;if(this.lastParam){this.notify(this.lastParam)}},unregister:function(a){if(this.callbackFunction==a){this.callbackFunction=null}},notify:function(b){try{this.callbackFunction(b)}catch(a){}this.lastParam=b}});at.idiom.js.util.Counter=Class.create({initialize:function(){this.counts=new Array();this.observerStart=new at.idiom.js.util.Observer();this.observerEnd=new at.idiom.js.util.Observer()},start:function(a){this.counts.push(a);if(this.counts.length==1){this.notifyStart()}},end:function(b){var a=this;this.counts.each(function(c){if(c==b){a.counts=a.counts.without(b)}});if(this.counts.length==0){this.notifyEnd()}},notifyStart:function(){this.observerStart.notify()},notifyEnd:function(){this.observerEnd.notify()},registerStart:function(a){this.observerStart.register(a)},unregisterStart:function(a){this.observerStart.unregister(a)},registerEnd:function(a){this.observerEnd.register(a)},unregisterEnd:function(a){this.observerEnd.unregister(a)}});at.idiom.js.util.ImageChanger=Class.create({initialize:function(a){this.delay=a.delay;this.duration=a.duration/1000;this.list=a.list;this.index=0;this.interval=null},start:function(){var a=this;setTimeout(function(){a.toggle()},this.delay)},end:function(){clearInterval(this.interval)},toggle:function(){this.hide(this.index);this.index=++this.index%this.list.length;var a=this;setTimeout(function(){a.show(a.index)},(this.duration/2));setTimeout(function(){a.toggle()},this.delay)},show:function(a){new Effect.Appear(this.list[a],{duration:this.duration})},hide:function(a){new Effect.Fade(this.list[a],{duration:this.duration})}});at.idiom.js.error=Class.create();at.idiom.js.error.Error=Class.create({initialize:function(b){this.element=$(b.id);this.timeout=2000;if(b.timeout){this.timeout=b.timeout}this.hideTimeout=null;var a=this;b.idiom.register("error","display",function(c){a.display(c)})},display:function(a){this.element.update(a);this.displayElement();if(console&&console.log){console.log(a)}},displayElement:function(){clearTimeout(this.hideTimeout);this.element.show();var a=this;setTimeout(function(){a.hideElement()},this.timeout)},hideElement:function(){this.element.hide()}});at.idiom.js.window=Class.create();at.idiom.js.window.Window=Class.create({initialize:function(b){this.window=$(b.window);this.windowId=b.window;this.header=b.windowHeader?$(b.windowHeader):$(b.window+"Title");this.content=b.windowContent?$(b.windowContent):$(b.window+"Content");this.maximizeButton=b.maximizeButton?$(b.maximizeButton):$(b.window+"MaximizeButton");this.parent=this.windowParent?$(b.windowParent):this.window.parentNode;this.canMaximize=b.canMaximize?b.canMaximize:false;this.isMaximized=b.isMaximized?b.isMaximized:false;this.canPopup=b.canPopup?b.canPopup:false;this.popupUrl=b.popupUrl;this.isPopup=false;this.popupWindow=null;this.isVisible=b.isVisible?b.isVisible:false;this.main=b.main?b.main:$("Content");this.placeholder=null;this.window.addClassName("window");var a="";if(this.isVisible){if(this.isMaximized){a="max"}else{a="min"}}else{a="close"}this.idiom=b.idiom},maximize:function(){if(!this.canMaximize||this.isMaximized){return}this.window.addClassName("maximized");this.isMaximized=true;this.maximizeButton.hide();this.placeholder=$(document.createElement("div"));this.window.parentNode.replaceChild(this.placeholder,this.window);this.main.appendChild(this.window);this.window.setStyle({zIndex:5000});this.adjustContentHeight();this.idiom.notify("main","hide",null)},minimize:function(){if(!this.canMaximize||!this.isMaximized){return}this.isMaximized=false;this.window.parentNode.removeChild(this.window);this.parent.replaceChild(this.window,this.placeholder);this.maximizeButton.show();this.window.setStyle({zIndex:0});this.window.removeClassName("maximized");this.adjustContentHeight();this.idiom.notify("main","show",null)},getPosition:function(){return{top:parseFloat(this.window.getStyle("top")),left:parseFloat(this.window.getStyle("left")),right:parseFloat(this.window.getStyle("right")),bottom:parseFloat(this.window.getStyle("bottom")),width:this.window.getWidth(),height:this.window.getHeight(),position:this.window.getStyle("position")}},show:function(e,d,c,b,a){this.window.setStyle({top:e+"px",left:d+"px",width:c+"px",height:b+"px",position:a});this.isVisible=true;this.adjustContentHeight()},close:function(){this.isVisible=false},adjustContentHeight:function(){var a=this.window.getHeight();var b=parseInt(this.content.getStyle("paddingTop"));var c=parseInt(this.content.getStyle("paddingBottom"));a=a-this.header.getHeight()-b-c-3;this.content.setStyle({height:a+"px"})},resetDirectPosition:function(){this.window.setStyle({top:null,left:null,right:null,bottom:null,width:null,height:null})},isWindowMaximized:function(){return this.isMaximized},isWindowMinimized:function(){return !this.isMaximized},isWindowClosed:function(){return !this.isVisible},isWindowShown:function(){return this.isVisible},setWindowTitle:function(a){this.header.down(".viewHeaderTitle").update(a)},popup:function(a,d){if(!this.canPopup){return}this.popupWindow=window.open(a,"Popup"+this.windowId,"dependent=yes,location=no,menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,height=300,width=300");var b=this;var c=function(){if(b.popupWindow.load){b.popupWindow.load(b.idiom,d)}else{setTimeout(c,10)}};setTimeout(c,10)},hideWindow:function(){this.window.hide();this.isVisible=false},showWindow:function(){this.window.show();this.isVisible=true}});at.idiom.js.about=Class.create();at.idiom.js.about.About=Class.create({initialize:function(c){this.idiom=c.idiom;this.main=$(c.box);this.date=$(c.footerdate);this.statusbar=$(c.statusbar);this.shownElement=null;var a=document.getElementsByTagName("body").item(0);this.overlay=$(document.createElement("div"));this.overlay.setAttribute("id",c.overlay);this.overlay.hide();a.appendChild(this.overlay);this.overlayShown=false;this.main.parentNode.removeChild(this.main);a.appendChild(this.main);var b=this;Event.observe(this.overlay,"click",function(){b.hide()});Event.observe(window,"resize",function(){b.resizeOverlay()});this.idiom.register("about","show",function(d){b.show($(d.dialog))});this.idiom.register("about","hide",function(){b.hide()})},show:function(a){var b=this;if(this.shownElement){this.hideBox(function(){b.showDialogHide(a)})}else{this.showDialogHide(a)}},showDialogHide:function(a){var b=this;this.showOverlay(function(){b.showDialog(a)})},showDialog:function(a){$(a).show();this.resizeBox();new Effect.Appear(this.main,{duration:0.1,from:0,to:1,queue:"end"});this.shownElement=a},hide:function(){var a=this;this.hideBox(function(){a.hideOverlay()})},hideBox:function(b){var a=this.shownElement;this.shownElement=null;new Effect.Fade(this.main,{duration:0.1,from:1,to:0,queue:"end",afterFinish:function(){if(a){$(a).hide()}if(b){b()}}})},hideOverlay:function(a){this.overlayShown=false;new Effect.Fade(this.overlay,{duration:0.1,from:0.5,to:0,queue:"end",afterFinish:function(){if(a){a()}}})},showOverlay:function(b){if(!this.overlayShown){this.overlayShown=true;var a=this.getPageSize();this.resizeOverlay();new Effect.Appear(this.overlay,{duration:0.1,from:0,to:0.5,afterFinish:b})}else{if(b){b()}}},resizeBox:function(){if(this.overlayShown){var f=0;var b=this.getPageSize();var e=this.main.getWidth();var g=this.main.getHeight()-f;var d=$("Content").getHeight();var a=(b[0]-e)/2;var c=(d-g)/2;this.main.setStyle({left:a+"px",top:c+"px"})}},resizeOverlay:function(){if(this.overlayShown){var b=0;var a=this.getPageSize();this.overlay.setStyle({top:b+"px",width:a[0]+"px",height:(a[1]-b)+"px",left:"0px"})}},getPageSize:function(){return at.idiom.js.util.Util.getPageSize()},showDate:function(){var c=new Date();var a=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");function d(f){return(f<1900)?f+1900:f}function e(f){return(f<10)?"0"+f:f}var b=a[c.getMonth()]+" "+e(c.getDate())+", "+c.getFullYear()+" "+e(c.getHours())+":"+e(c.getMinutes());this.date.update(b)}});at.idiom.js.maps=Class.create();at.idiom.js.maps.Map=Class.create(at.idiom.js.window.Window,{initialize:function($super,c){$super(c);this.windowClosed=c.windowClosed?$(c.windowClosed):$(c.window+"Closed");this.properties=c.properties?c.properties:{};this.layers=c.layers?c.layers:[];this.scaleX=c.scaleX?c.scaleX:1;this.scaleY=c.scaleY?c.scaleY:1;this.pointX=c.pointX?c.pointX:"lng";this.pointY=c.pointY?c.pointY:"lat";this.semanticOrientation=c.semanticOrientation?c.semanticOrientation:"semorient";this.semanticThreshold=c.semanticThreshold?c.semanticThreshold:0.1;this.drawArcs=c.drawArcs?true:false;this.sourcePointX=c.sourcePointX?c.sourcePointX:"sourceLng";this.sourcePointY=c.sourcePointY?c.sourcePointY:"sourceLat";this.cssPrefix=c.cssPrefix;this.defaultZoom=c.defaultZoom?c.defaultZoom:0;this.searchColour=c.searchColour?c.searchColour:"#cccccc";this.positiveSearchColour=c.positiveSearchColour?c.positiveSearchColour:"#00bb00";this.negativeSearchColour=c.negativrSearchColour?c.negativeSearchColour:"#bb3333";this.arcStartColour="#fffb9c";this.arcOpacity=0.5;this.startArcPower=0.7;this.endArcPower=1;this.searchFillOpacity=c.searchFillOpacity?c.searchFillOpacity:0.25;this.searchGraphicOpacity=c.searchGraphicOpacity?c.searchGraphicOpacity:0.75;this.searchRadius=c.searchRadius?c.searchRadius:3;this.searchRadiusIncrement=c.searchRadiusIncrement?c.searchRadiusIncrement:this.searchRadius;this.searchRadiusIncrementStep=c.searchRadiusIncrementStep?c.searchRadiusIncrementStep:5;this.properties.theme=null;this.map2DContainer=c.map2DContainer?$(c.map2DContainer):this.content;this.mainLayer=null;this.errorElement=null;this.errorElementTimeout=null;this.markerSizeX=c.markerSizeX?c.markerSizeX:16;this.markerSizeY=c.markerSizeY?c.markerSizeY:16;this.map3DContainer=c.map3DContainer?$(c.map3DContainer):this.content;this.map3DEnabled=c.map3DEnabled?true:false;this.map3DButton=c.map3DButton?$(c.map3DButton):null;this.map3DAboutButton=c.map3DAboutButton?$(c.map3DAboutButton):null;this.map3DDocumentButton=c.map3DDocumentButton?$(c.map3DDocumentButton):null;this.map3DProfileButton=c.map3DProfileButton?$(c.map3DProfileButton):null;this.isMap3DShown=c.map3DShown?true:false;this.isMap3DDocumentChooser=false;this.isMap3DTerrainProfile=true;this.isMap3DCreated=false;this.map3DClasspath=c.map3DClasspath;this.map3DImageHostname=c.map3DImageHostname;this.map3DImageDatasetname=c.map3DImageDatasetname;this.map3DImageDatasetLevels=c.map3DImageDatasetLevels;this.map3DImageCachedir=c.map3DImageCachedir;this.map3DBilHostname=c.map3DBilHostname;this.map3DBilDatasetname=c.map3DBilDatasetname;this.map3DBilDatasetLevels=c.map3DBilDatasetLevels;this.map3DBilCachedir=c.map3DBilCachedir;this.map3DJavascriptCallbackFunction=c.map3DJavascriptCallbackFunction?c.map3DJavascriptCallbackFunction:"callbackFromWorldWindApplet";this.windowTitle3d=c.windowTitle3d?c.windowTitle3d:"";this.windowTitleNormal=c.windowTitleNormal?c.windowTitleNormal:"";var a=false;if(!this.isVisible){this.show(0,0,100,100,"absolute");a=true}this.createMap();if(a){this.close()}var b=this;this.idiom.register(null,"changeMainLayer",function(d){b.switchMainLayer(d)})},createMap:function(){this.map=new OpenLayers.Map(this.map2DContainer,this.properties);var a=this;var b=0;this.layers.each(function(d){var c=null;b++;c=a.createLayer(d,b);if(c){a.map.addLayer(c)}});this.map.events.register("changebaselayer",this.map,function(c){a.transformProjection()});if(this.layers.size()>1){this.map.addControl(new OpenLayers.Control.LayerSwitcher())}this.markersLayer=new OpenLayers.Layer.Markers("Document Markers",{layerSwitcherOrder:++b});this.searchMarkersLayer=new OpenLayers.Layer.Vector("Search Results",{layerSwitcherOrder:++b});this.map.addLayer(this.searchMarkersLayer);if(this.drawArcs){this.searchArcsLayer=new OpenLayers.Layer.Vector("Trajectories",{layerSwitcherOrder:++b});this.map.addLayer(this.searchArcsLayer)}this.map.addLayer(this.markersLayer);this.markersNormal=new Array();this.markersHighlight=new Array();this.map.zoomTo(this.defaultZoom);this.transformProjection(true);this.centerPoint=null;this.idiom.notify("maps","register",{map:this})},createLayer:function(a,b){if(a.type=="WMS"){layer=new OpenLayers.Layer.WMS(a.description,a.url,{layers:a.layers,resolutions:a.resolutions,units:a.units},{layerSwitcherOrder:b})}else{if(a.type=="Google"){layer=new OpenLayers.Layer.DeferredGoogle(a.description,{type:a.layers,sphericalMercator:true,projection:new OpenLayers.Projection("EPSG:900913"),maxExtent:new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34)},{layerSwitcherOrder:b})}}if(layer&&a.mainLayer){this.mainLayer=layer}return layer},transformProjection:function(b){var a=this.markersLayer.projection;var c=this.map.getProjectionObject();var e=a.getCode()!=c.getCode();this.map.restrictedExtent=this.map.baseLayer.maxExtent;var d=this.map.getLayersBy("isVector",true);$(d).each(function(f){f.maxResolution=this.map.baseLayer.maxResolution;f.minResolution=this.map.baseLayer.minResolution;f.setVisibility(false);f.setVisibility(true);$(f.features).each(function(g){g.geometry.transform(f.projection,c)},this);f.projection=c;f.redraw()},this);this.markersLayer.maxResolution=this.map.baseLayer.maxResolution;this.markersLayer.minResolution=this.map.baseLayer.minResolution;$(this.markersLayer.markers).each(function(f){f.lonlat.transform(this.markersLayer.projection,c)},this);this.markersLayer.projection=c;this.markersLayer.redraw();if(e&&!b){this.map.zoomToMaxExtent()}},switchMainLayer:function(c){var a=null;if(this.mainLayer){a=this.mainLayer;this.mainLayer=null}c.mainLayer=true;var b=this.createLayer(c);if(b){this.map.addLayer(b);this.map.setBaseLayer(b);b.redraw()}if(b&&a){this.map.removeLayer(a)}},create3DMap:function(){if(!this.map3DEnabled){return}if(!this.isMap3DCreated){var b='<!--[if !IE]> Firefox and others will use outer object --><object id="SemanticMapWorldWindApplet" name="SemanticMapWorldWindApplet" type="application/x-java-applet" codetype="application/java-vm"classid="java:org.jdesktop.applet.util.JNLPAppletLauncher.class" archive="http://download.java.net/media/applet-launcher/applet-launcher.jar,http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jar,http://download.java.net/media/gluegen/webstart/gluegen-rt.jar,#{map3dclasspath}worldwind.jar,#{map3dclasspath}plugin.jar,#{map3dclasspath}kpsigned.jar" height="100%" width="100%"><!-- Konqueror browser needs the following param --><param name="archive" value="http://download.java.net/media/applet-launcher/applet-launcher.jar,http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jar,http://download.java.net/media/gluegen/webstart/gluegen-rt.jar,#{map3dclasspath}worldwind.jar,#{map3dclasspath}plugin.jar,#{map3dclasspath}kpsigned.jar"/><param name="code" value="org.jdesktop.applet.util.JNLPAppletLauncher"/><param name="mayscript" value="true"/><param name="codebase_lookup" value="false"/><param name="subapplet.classname" value="at.raven.KnowledgePlanet2.Applet.KnowledgePlanetAppletTwo"/><param name="subapplet.displayname" value="WWJ Applet"/><param name="noddraw.check" value="true"/><param name="progressbar" value="true"/><param name="jnlpNumExtensions" value="1"/><param name="jnlpExtension1" value="http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jnlp"/><param name="ImageHostURL" value="#{map3dimagehostname}" /><param name="ImageDataSetName" value="#{map3dimagedatasetname}" /><param name="ImageCacheDir" value="#{map3dimagecachedir}" /><param name="ImageDataSetLevels" value="#{map3dimagedatasetlevels}" /><param name="BILHostURL" value="#{map3dbilhostname}" /><param name="BILDataSetName" value="#{map3dbildatasetname}" /><param name="BILCacheDir" value="#{map3dbilcachedir}" /><param name="BILDataSetLevels" value="#{map3dbildatasetlevels}" /><param name="JavascriptCallbackFunction" value="#{map3djavascriptcallbackfunction}" /><param name="startLat" value="#{map3dstartlat}" /><param name="startLon" value="#{map3dstartlon}" /><!--<![endif]--><!-- MSIE (Microsoft Internet Explorer) will use inner object --><object id="SemanticMapWorldWindApplet" type="application/x-java-applet"  codetype="application/java-vm" classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" height="100%" width="100%" ><param name="code" value="org.jdesktop.applet.util.JNLPAppletLauncher"/><param name="archive" value="http://download.java.net/media/applet-launcher/applet-launcher.jar,http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jar,http://download.java.net/media/gluegen/webstart/gluegen-rt.jar,#{map3dclasspath}worldwind.jar,#{map3dclasspath}plugin.jar,#{map3dclasspath}kpsigned.jar"/><param name="code" value="org.jdesktop.applet.util.JNLPAppletLauncher"/><param name="mayscript" value="true"/><param name="codebase_lookup" value="false"/><param name="subapplet.classname" value="at.raven.KnowledgePlanet2.Applet.KnowledgePlanetAppletTwo"/><param name="subapplet.displayname" value="WWJ Applet"/><param name="noddraw.check" value="true"/><param name="progressbar" value="true"/><param name="jnlpNumExtensions" value="1"/><param name="jnlpExtension1" value="http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jnlp"/><param name="ImageHostURL" value="#{map3dimagehostname}" /><param name="ImageDataSetName" value="#{map3dimagedatasetname}" /><param name="ImageCacheDir" value="#{map3dimagecachedir}" /><param name="ImageDataSetLevels" value="#{map3dimagedatasetlevels}" /><param name="BILHostURL" value="#{map3dbilhostname}" /><param name="BILDataSetName" value="#{map3dbildatasetname}" /><param name="BILCacheDir" value="#{map3dbilcachedir}" /><param name="BILDataSetLevels" value="#{map3dbildatasetlevels}" /><param name="JavascriptCallbackFunction" value="#{map3djavascriptcallbackfunction}" /><param name="startLat" value="#{map3dstartlat}" /><param name="startLon" value="#{map3dstartlon}" /><strong>This browser does not have a Java Plug-in.<br /><a href="http://java.sun.com/products/plugin/downloads/index.html">Get the latest Java Plug-in here.</a></strong></object> <!--[if !IE]> close outer object --></object><!--<![endif]-->';var c=new Template(b);var d={map3dclasspath:this.map3DClasspath,map3dimagehostname:this.map3DImageHostname,map3dimagedatasetname:this.map3DImageDatasetname,map3dimagedatasetlevels:this.map3DImageDatasetLevels,map3dimagecachedir:this.map3DImageCachedir,map3dbilhostname:this.map3DBilHostname,map3dbildatasetname:this.map3DBilDatasetname,map3dbildatasetlevels:this.map3DBilDatasetLevels,map3dbilcachedir:this.map3DBilCachedir,map3djavascriptcallbackfunction:this.map3DJavascriptCallbackFunction,map3dstartlat:"5",map3dstartlon:"-10"};var a=c.evaluate(d);this.map3DContainer.insert(a)}this.maximize();this.map2DContainer.hide();this.map3DContainer.show();this.isMap3DShown=true;this.map3DButton.hide();this.map3DAboutButton.show();this.map3DProfileButton.show();this.isMap3DCreated=true;this.setWindowTitle(this.windowTitle3d)},destroy3DMap:function(){this.map3DContainer.hide();this.isMap3DShown=false;this.map3DButton.show();this.map3DAboutButton.hide();this.map3DProfileButton.hide();this.map3DContainer.hide();this.map2DContainer.show();this.setWindowTitle(this.windowTitleNormal)},workaroundSubapplet:function(){if(typeof this.workaroundSubappletCount=="undefined"){this.workaroundSubappletCount=0}if(this.workaroundSubappletCount>=10000){return}this.workaroundSubappletCount++;try{$("SemanticMapWorldWindApplet").getSubApplet()}catch(a){var b=this;setTimeout(function(){b.workaroundSubapplet()},1)}},enableDocumentChooser3DMap:function(b){try{$("SemanticMapWorldWindApplet").getSubApplet().setActivateOnSingleClick();this.isMap3DDocumentChooser=true;return true}catch(a){if(!b){return this.enableDocumentChooser3DMap(true)}this.errorHandler("Could not enable document chooser mode.",a)}return false},disableDocumentChooser3DMap:function(b){try{$("SemanticMapWorldWindApplet").getSubApplet().DeActivateClickEvents();this.isMap3DDocumentChooser=false;return true}catch(a){if(!b){return this.disableDocumentChooser3DMap(true)}this.errorHandler("Could not disable document chooser mode.",a)}return false},isDocumentChooser3DMap:function(){return this.isMap3DDocumentChooser},enableTerrainProfile3DMap:function(b){try{$("SemanticMapWorldWindApplet").getSubApplet().enableTerrainProfileLayer();this.isMap3DTerrainProfile=true;return true}catch(a){if(!b){return this.enableTerrainProfile3DMap(true)}this.errorHandler("Could not enable terrain profile mode.",a)}return false},disableTerrainProfile3DMap:function(b){try{$("SemanticMapWorldWindApplet").getSubApplet().disableTerrainProfileLayer();this.isMap3DTerrainProfile=false;return true}catch(a){if(!b){return this.disableTerrainProfile3DMap(true)}this.errorHandler("Could not disable terrain profile mode.",a)}return false},isTerrainProfile3DMap:function(){return this.isMap3DTerrainProfile},refresh3DMap:function(b){try{$("SemanticMapWorldWindApplet").getSubApplet().refresh();return true}catch(a){if(!b){return this.refresh3DMap(true)}}return false},drawMarkers:function(b){var e=b.contentobjects;this.markersLayer.clearMarkers();for(var c=5;c>=0;c--){if(e[c]==null){continue}var a=new OpenLayers.LonLat(parseFloat(e[c].attributes[this.pointX])*this.scaleX,parseFloat(e[c].attributes[this.pointY])*this.scaleY);a.transform(new OpenLayers.Projection("EPSG:4326"),this.map.getProjectionObject());var d=a.clone();this.markersNormal[c]=this.createMarker(c,a,e[c].attributes.location,e[c].attributes.title,e[c].attributes.published,e[c].attributes.mirrorDate,e[c].contentid,false);this.markersLayer.addMarker(this.markersNormal[c]);if(c!=0){this.markersHighlight[c]=this.createMarker(c,d,e[c].attributes.location,e[c].attributes.title,e[c].attributes.published,e[c].attributes.mirrorDate,e[c].contentid,true);this.markersLayer.addMarker(this.markersHighlight[c]);this.markersHighlight[c].display(false);this.markersHighlight[c].highlight=true}if(c==0){this.centerPoint=a;if(this.isVisible){this.map.setCenter(a)}}}},updateMainView:function(a){if(a!=0){this.idiom.notify("main","setNewContentId",{contentid:a})}},createMarker:function(k,r,q,p,m,e,b,f){var t=new OpenLayers.Size(this.markerSizeX,this.markerSizeY);var g=new OpenLayers.Pixel(-(t.w/2),-(t.h/2));var s=this.cssPrefix+k;if(f){s+="h"}var o=new OpenLayers.Icon(s,t,g);var h=new OpenLayers.Marker(r,o);var l="<b>"+p.substring(0,35)+"</b><br>Source: "+m+" &bull; Target: "+q+"<br />Mirror Date: "+e+"<br /><a href='#' onclick=\"IDIOM.notify('main', 'setNewContentId', {contentid: "+b+'}); return false;">read document</a>';var c=this.windowId+"_popup_"+k;var a=new OpenLayers.Popup.FramedCloud(c,r,new OpenLayers.Size(200,100),l,o,true);a.border="1px solid #cccccc";a.contentDiv.style.padding="5px";var d=this;h.events.register("click",h,function(){d.map.addPopup(a,true);a.show()});h.events.register("mouseover",h,function(){d.highlight(k);d.markInList(k)});h.events.register("mouseout",h,function(){d.normal(k);d.unmarkInList(k)});return h},errorHandler:function(b,a){if(!a){a=""}this.idiom.notify("error","display","Error in map: "+b+" "+a)},errorHandlerInternal:function(a){clearTimeout(this.errorElementTimeout);if(!this.errorElement){this.errorElement=new Element("div").addClassName("maperror");this.map2DContainer.insert(this.errorElement)}this.errorElement.update(a);this.errorElementTimeout=setTimeout(this.clearErrorHandlerInternal.bind(this),5000)},clearErrorHandlerInternal:function(){clearTimeout(this.errorElementTimeout);if(this.errorElement){this.errorElement.remove();this.errorElement=null}},highlight:function(a){try{this.markersHighlight[a].display(true);this.markersNormal[a].display(false)}catch(b){}},normal:function(a){try{this.markersNormal[a].display(true);this.markersHighlight[a].display(false)}catch(b){}},show:function($super,e,d,c,b,a){this.window.removeClassName("closed");this.windowClosed.removeClassName("closed");$super(e,d,c,b,a);if(!this.map){return}this.map.updateSize();if(this.centerPoint){this.map.setCenter(this.centerPoint)}this.map.updateSize();this.markersLayer.markers.each(function(f){if(!f.highlight){f.display(true)}});this.markersLayer.redraw()},close:function($super){$super();if(this.isMap3DShown){this.destroy3DMap()}if(this.isMaximized){this.minimize()}this.window.addClassName("closed");this.windowClosed.addClassName("closed");this.isVisible=false},maximize:function($super){$super();if(this.map.zoom<1){this.map.zoomTo(1)}this.map.updateSize();if(this.centerPoint){this.map.setCenter(this.centerPoint)}},minimize:function($super){if(this.isMap3DShown){this.destroy3DMap()}$super();this.isVisible=false;this.idiom.notify("maps","show",this)},markInList:function(a){},unmarkInList:function(a){},addSearchMarkers:function(b){this.clearSearchMarkers();var a=new Hash();b.each(function(e){var g=e.attributes[this.pointX]+"/"+e.attributes[this.pointY];var c=a.get(g);if(c){var f=c.attributes[this.semanticOrientation];var d=e.attributes[this.semanticOrientation];var h=(d+c.count*f)/(c.count+1);c.attributes[this.semanticOrientation]=h;if(c.documents.indexOf(e.contentid)==-1){c.count++;c.documents.push(e.contentid)}}else{c=Object.clone(e);c.attributes=Object.clone(e.attributes);c.count=1;c.documents=[e.contentid];a.set(g,c)}},this);this.searchMarkersLayer.maxResolution=this.map.baseLayer.maxResolution;this.searchMarkersLayer.minResolution=this.map.baseLayer.minResolution;a.each(function(h){var c=new OpenLayers.Geometry.Point(parseFloat(h.value.attributes[this.pointX])*this.scaleX,parseFloat(h.value.attributes[this.pointY])*this.scaleY);var g=this.searchColour;var f=h.value.attributes[this.semanticOrientation];if(f>this.semanticThreshold){g=this.positiveSearchColour}else{if(f<-this.semanticThreshold){g=this.negativeSearchColour}}var e=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style["default"]);e.fillOpacity=this.searchFillOpacity;e.graphicOpacity=this.searchGraphicOpacity;e.strokeColor=g;e.fillColor=g;e.pointRadius=this.searchRadius+(this.searchRadiusIncrement*((h.value.count-1)/this.searchRadiusIncrementStep));c.transform(new OpenLayers.Projection("EPSG:4326"),this.map.getProjectionObject());var d=new OpenLayers.Feature.Vector(c,null,e);this.searchMarkersLayer.addFeatures([d])},this)},addSearchLines:function(b){if(!this.drawArcs){return}var a=new Hash();b.each(function(e){var g=e.attributes[this.pointX]+"/"+e.attributes[this.pointY]+"/"+e.attributes[this.sourcePointX]+"/"+e.attributes[this.sourcePointY];var c=a.get(g);if(c){var f=c.attributes[this.semanticOrientation];var d=e.attributes[this.semanticOrientation];var h=(d+c.count*f)/(c.count+1);c.attributes[this.semanticOrientation]=h;if(c.documents.indexOf(e.contentid)==-1){c.count++;c.documents.push(e.contentid)}}else{c=Object.clone(e);c.attributes=Object.clone(e.attributes);c.count=1;c.documents=[];a.set(g,c)}},this);this.searchArcsLayer.maxResolution=this.map.baseLayer.maxResolution;this.searchArcsLayer.minResolution=this.map.baseLayer.minResolution;a.each(function(t){var h=parseFloat(t.value.attributes[this.pointX])*this.scaleX;var g=parseFloat(t.value.attributes[this.pointY])*this.scaleY;var d=parseFloat(t.value.attributes[this.sourcePointX])*this.scaleX;var c=parseFloat(t.value.attributes[this.sourcePointY])*this.scaleY;var v=this.calculateBezier(d,c,h,g);var z=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style["default"]);z.fillOpacity=this.arcOpacity;z.strokeOpacity=this.arcOpacity;z.graphicOpacity=this.searchGraphicOpacity;var o=Math.pow(t.value.count,this.startArcPower);var u=Math.pow(t.value.count,this.endArcPower);var p={};p.r=parseInt(this.arcStartColour.substring(1,3),16);p.g=parseInt(this.arcStartColour.substring(3,5),16);p.b=parseInt(this.arcStartColour.substring(5,7),16);var r=this.searchColour;var e=t.value.attributes[this.semanticOrientation];if(e>this.semanticThreshold){r=this.positiveSearchColour}else{if(e<-this.semanticThreshold){r=this.negativeSearchColour}}var l={};l.r=parseInt(r.substring(1,3),16);l.g=parseInt(r.substring(3,5),16);l.b=parseInt(r.substring(5,7),16);for(var w=0;w<v.length;w=w+5){var m={};m.r=p.r+(l.r-p.r)*w/v.length;m.g=p.g+(l.g-p.g)*w/v.length;m.b=p.b+(l.b-p.b)*w/v.length;var k="#"+parseInt(m.r).toString(16)+parseInt(m.g).toString(16)+parseInt(m.b).toString(16);var q=Object.clone(z);q.strokeColor=k;q.fillColor=k;q.strokeWidth=o+(u-o)*w/v.length;var f=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(v.slice(w,Math.min(w+5,v.length))),null,q);f.geometry.transform(new OpenLayers.Projection("EPSG:4326"),this.map.getProjectionObject());this.searchArcsLayer.addFeatures([f])}},this)},clearSearchMarkers:function(){this.searchMarkersLayer.destroyFeatures();if(this.drawArcs){this.searchArcsLayer.destroyFeatures()}},calculateBezier:function(b,h,a,g){var o=new OpenLayers.Geometry.Point(b,h);var m=new OpenLayers.Geometry.Point(a,g);var e=20;if(m.x<o.x){e=-e}var d=0.5/Math.cos(e/180*Math.PI);var f=m.clone();f.rotate(e,o);f.resize(d,o);var k=[];var c=new at.idiom.js.util.Bezier(o,m,f,f);c.plot(function(q){var l=new OpenLayers.Geometry.Point(q.x,q.y);k.push(l)});return k}});at.idiom.js.util.Bezier=Class.create({initialize:function(e,d,b,a){var c=this;c.x0=e.x;c.y0=e.y;c.x1=d.x;c.y1=d.y;c.cx0=b.x;c.cy0=b.y;c.cx1=a.x;c.cy1=a.y},getCoordinates:function(q){var f=1-q;var p=q*q;var k=f*f;var m=p*q;var l=3*p*f;var h=3*q*k;var g=k*f;var e=this;return{x:m*e.x0+l*e.cx0+h*e.cx1+g*e.x1,y:m*e.y0+l*e.cy0+h*e.cy1+g*e.y1}},plot:function(g){var e;var a=(a=this.x0-this.x1)*a;var f=(f=this.y0-this.y1)*f;var b=b=Math.ceil(Math.sqrt(a+f));var d=b+1;while(g(this.getCoordinates(e=--d/b),e),d){}}});at.idiom.js.maps.Maps=Class.create({initialize:function(b){this.container=$(b.container);this.closedContainer=$(b.closedContainer);this.maps=new Array();var a=this;b.idiom.register("maps","register",function(c){a.register(c.map)});b.idiom.register("maps","unregister",function(c){a.unregister(c.map)});b.idiom.register("maps","show",function(c){a.show(c)});b.idiom.register("maps","close",function(c){a.close(c)});b.idiom.register("maps","minimize",function(){a.minimize()});b.idiom.register(null,"hide",function(){a.hideWindow()});b.idiom.register(null,"show",function(){a.showWindow()})},register:function(a){this.maps.push(a)},unregister:function(a){this.maps=this.maps.without(a)},close:function(a){var d=0;this.maps.each(function(e){if(e.isVisible){d++}});if(d<=1){return}var c=this.container.getDimensions();a.close();d=0;this.maps.each(function(e){if(e.isVisible){d++}if(e.isMaximized){e.minimize()}});if(d==0){return}var b=(c.height-(10*(d-1)))/d;this.maps.each(function(e){if(e.isVisible){e.show(0,0,c.width,b,"relative")}})},show:function(a){var d=this.container.getDimensions();var c=0;this.maps.each(function(e){if(e.isVisible){c++}if(e.isMaximized){e.minimize()}});c++;var b=(d.height-(10*(c-1)))/c;this.maps.each(function(e){if(e.isVisible){e.show(0,0,d.width,b,"relative")}});a.show(0,0,d.width,b,"relative")},deactivate:function(){this.maps.each(function(a){a.map.controls.each(function(b){b.deactivate()})})},activate:function(){this.maps.each(function(a){a.map.controls.each(function(b){b.activate()})})},minimize:function(){this.maps.each(function(a){if(a.isMaximized){a.minimize()}})},hideWindow:function(){this.container.hide();this.closedContainer.select(".mapbutton").each(function(a){a.addClassName("disabled")})},showWindow:function(){this.container.show();this.closedContainer.select(".mapbutton").each(function(a){a.removeClassName("disabled")})}});at.idiom.js.maps.TagCloud=Class.create(at.idiom.js.window.Window,{initialize:function($super,e){$super(e);this.storedTerms=[];this.paneWidth=e.paneWidth;this.paneHeight=e.paneHeight;this.SVGNS="http://www.w3.org/2000/svg";this.svgContainer=$(e.svgContainer);this.clippingContainer=$(e.clippingContainer);this.sample=e.sample;this.site=e.site;this.maxExtentX=0;this.maxExtentY=0;this.minSentimentValue=-1;this.maxSentimentValue=1;this.minSentimentColour={r:255,g:0,b:0};this.maxSentimentColour={r:0,g:255,b:0};var a=document.createElementNS(this.SVGNS,"svg:svg");a.setAttribute("id","svg");a.setAttribute("width",this.paneWidth+"px");a.setAttribute("height",this.paneHeight+"px");a.setAttribute("viewBox","0 0 "+this.paneWidth+" "+this.paneHeight);this.svgContainer.appendChild(a);this.g=document.createElementNS(this.SVGNS,"svg:g");a.appendChild(this.g);var c=this;this.idiom.register("tagcloud","highlight",function(f){c.highlightTerms(f.terms)});var d=[0.25,0.5,1,1.5,2,3,4];var b=2;this.svgContainer.observe("DOMMouseScroll",function(f){var g=f.detail;if(g<0){b++;b=b>d.length-1?d.length-1:b}else{b--;b=b<0?0:b}var h=d[b];console.log(h);c.g.setAttribute("transform","scale("+h+")");a.setAttribute("width",(c.paneWidth*c.scale)+"px");a.setAttribute("height",(c.paneHeight*c.scale)+"px")});var c=this;new Draggable(this.svgContainer,{starteffect:Effect.Full,endeffect:Effect.Full,snap:function(f,g){return[(f>10)?10:(f<-c.maxClippingX-10)?f=-c.maxClippingX-10:f,(g>10)?10:(g<-c.maxClippingY-10)?g=-c.maxClippingY-10:g]}});this.loadTerms()},createMapSVG:function(c){var g=0;var f=0;var a=0;var b=this;this.maxClippingX=0;this.maxClippingY=0;var k=0;var h=0;var e=0;var d=[];$(c).each(function(l){a++;var o=document.createElementNS(this.SVGNS,"svg:text");o.setAttribute("x",g);o.setAttribute("y",f);o.setAttribute("font-size",l.size/8);o.setAttribute("fill",b.calculateColour(l.colour,l.sentiment));o.appendChild(document.createTextNode(l.term));o.addEventListener("click",function(){b.idiom.notify("search","newSearch",{term:l.term,count:50})},false);this.g.appendChild(o);var m=o.getBBox();if(g+m.width>b.paneWidth){$(d).each(function(p){p.setAttribute("y",f+e)});d=[];f+=e;e=0;g=0;o.setAttribute("x",g);o.setAttribute("y",f)}if(m.height>e){e=m.height}d.push(o);g+=m.width+3;this.storedTerms.push({term:l.term,colour:l.colour,element:o});if(g>k){k=g}if(f>h){h=f}},this);$(d).each(function(l){l.setAttribute("y",f+e)});d=[];this.g.setAttribute("transform","scale(1)");this.maxClippingX=Math.max(k-this.clippingContainer.getWidth(),0);this.maxClippingY=Math.max(h-this.clippingContainer.getHeight(),0)},loadTerms:function(){var a=this;this.idiom.loadStart("TAGMAP");Server.getTagCloudData(this.sample,this.site,{callback:function(b){a.idiom.loadEnd("TAGMAP");a.createMapSVG(b.elements)},errorHandler:function(c,b){a.errorHandler(c,b);a.idiom.loadEnd("TAGMAP")}})},errorHandler:function(b,a){this.idiom.notify("error","display","Error in tagcloud: "+b+" "+a.message)},highlightTerms:function(b){var a="";$(b).each(function(c){a+=" "+c});a+=" ";$(this.storedTerms).each(function(c){if(a.indexOf(c.term)!=-1){c.element.setAttribute("fill-opacity",1)}else{c.element.setAttribute("fill-opacity",0.3)}})},calculateColour:function(f,c){if(c==0){return f}var b=this.convertHEXToRGB(f.substring(1));if(c>0){var a=(c/this.maxSentimentValue);a=a>1?1:a;var d=b.g;d=d+(this.maxSentimentColour.g-d)*a;b.g=d}else{var a=(c/this.minSentimentValue);a=a>1?1:a;var e=b.r;e=e+(this.minSentimentColour.r-e)*a;b.r=e}return this.convertRGBToHEX(b)},convertRGBtoHSV:function(a,f,k){a=a/255;f=f/255;k=k/255;var d=0;var t=0;var o=0;var p=Math.min(a,f,k);var q=Math.max(a,f,k);var m=q-p;o=q;if(m==0){d=0;t=0}else{t=m/q;var l=(((q-a)/6)+(m/2))/m;var c=(((q-f)/6)+(m/2))/m;var e=(((q-k)/6)+(m/2))/m;if(a==q){d=e-c}else{if(f==q){d=(1/3)+l-e}else{if(k==q){d=(2/3)+c-l}}}if(d<0){d+=1}if(d>1){d-=1}}return{hue:d*360,saturation:t*100,value:o*100}},convertHSVtoRGB:function(l,d,p){var f=l/360;var r=d/100;var q=p/100;if(r==0){return{r:q*255,g:q*255,b:q*255}}else{var k=f*6;var e=Math.floor(k);var g=q*(1-r);var c=q*(1-r*(k-e));var b=q*(1-r*(1-(k-e)));var a=0;var m=0;var o=0;switch(e){case 0:a=q;m=b;o=g;break;case 1:a=c;m=q;o=g;break;case 2:a=g;m=q;o=b;break;case 3:a=g;m=c;o=q;break;case 4:a=b;m=g;o=q;break;default:a=q;m=g;o=c}return{r:a*255,g:m*255,b:o*255}}},convertHEXtoDEC:function(a){return parseInt(a,16)},convertDECtoHEX:function(d){var c=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];var b=Math.floor(d/16);var a=d-b*16;return c[b]+c[a]},convertHEXToRGB:function(a){return{r:this.convertHEXtoDEC(a.substring(0,2)),g:this.convertHEXtoDEC(a.substring(2,4)),b:this.convertHEXtoDEC(a.substring(4,6))}},convertRGBToHEX:function(a){return"#"+this.convertDECtoHEX(Math.floor(a.r))+this.convertDECtoHEX(Math.floor(a.g))+this.convertDECtoHEX(Math.floor(a.b))}});at.idiom.js.related=Class.create();at.idiom.js.related.Related=Class.create(at.idiom.js.window.Window,{initialize:function($super,b){$super(b);this.sample=b.sample;this.site=b.site;this.snapshot=b.snapshot;this.imageUrl=b.imageUrl;this.enabled=b.enabled?b.enabled:false;this.rssEnabled=b.rssEnabled?b.rssEnabled:false;this.rssId=b.rssId;this.rssUrl=b.rssUrl;this.tagUrl=b.tagUrl;this.contentId=b.contentId;this.content=$(b.contentId);this.loadName=b.loadName;this.type=b.type;this.currentContentId=0;this.offset=0;this.offsetLabel=this.header.down(".offset");var a=this;this.idiom.register(null,"onNewContentId",function(c){a.update(c)});if(this.type=="semantic"){this.idiom.register("semanticrelated","highlight",function(c){a.highlightSemantic(c)});this.idiom.register("semanticrelated","unhighlight",function(c){a.unhighlightSemantic(c)})}else{if(this.type=="geographic"){this.idiom.register("geographicrelated","highlight",function(c){a.highlightGeographic(c)});this.idiom.register("geographicrelated","unhighlight",function(c){a.unhighlightGeographic(c)})}}this.searchTerm="";this.idiom.register("search","newSearch",function(c){a.searchTerm=c.term});this.idiom.register(null,"changeSnapshot",function(c){a.snapshot=c.snapshotid});this.idiom.register(null,"hide",function(){a.hideWindow()});this.idiom.register(null,"show",function(){a.showWindow()});this.previousButton=$(b.previousButton);this.nextButton=$(b.nextButton);this.nextButton.observe("click",function(c){a.doOffset(5);c.stop()});this.previousButton.observe("click",function(c){a.doOffset(-5);c.stop()})},doOffset:function(a){if(this.offset==0&&a<0){return}this.offset+=a;if(this.offset<=0){this.offset=0;this.previousButton.down(".enabled").hide();this.previousButton.down(".disabled").show();this.offsetLabel.update()}else{this.previousButton.down(".disabled").hide();this.previousButton.down(".enabled").show();this.offsetLabel.update(" ("+(this.offset+1)+" - "+(this.offset+5)+")")}this.update({contentid:this.currentContentId,snapshotid:this.snapshot});if(this.type=="semantic"){this.idiom.notify(null,"newSemanticDocuments",{contentid:this.currentContentId,snapshotid:this.snapshot,offset:this.offset})}else{if(this.type=="geographic"){this.idiom.notify(null,"newGeographicDocuments",{contentid:this.currentContentId,snapshotid:this.snapshot,offset:this.offset})}}},toggleSnippet:function(b,a){$(a).getElementsBySelector(".snippet .short").each(function(c){c.toggle()});$(a).getElementsBySelector(".snippet .long").each(function(c){c.toggle()});Event.stop(b);return false},navigate:function(a,b){this.idiom.notify("main","setNewContentId",{contentid:b});Event.stop(a);return false},displayInformation:function(m){var p=function(){};var q=function(){};var d=this;if(this.type=="semantic"){p=function(u){d.idiom.notify("geographic","setHighlightMarker",u)};q=function(u){d.idiom.notify("geographic","setNormalMarker",u)}}if(this.type=="geographic"){p=function(u){d.idiom.notify("semantic","setHighlightMarker",u);d.idiom.notify("ontology","setHighlightMarker",u)};q=function(u){d.idiom.notify("semantic","setNormalMarker",u);d.idiom.notify("ontology","setNormalMarker",u)}}var h=new Template("<tr id='#{id}' class='entry hreview'><td class='rating microformats'>#{rating}</td><td class='dtreviewed microformats'>#{date}</td><td class='icon' title='Display Full Document'><span class='sprite_marker_#{imagetype}_#{imageindex} normal'></span><span class='sprite_marker_#{imagetype}_#{imageindex}h highlight'></span></td><td class='content' title='Display Longer Snippet (Click on Document Marker to Display Full Document)'><div class='title summary'>#{title}</div><div class='snippet'><div class='short'>#{shortsnippet}</div><div class='long' title='Display Shorter Snippet' style='display: none;'>#{longsnippet}</div></div><span class='item'><div class='url fn' title='Display Full Document'>#{url}</div></span></td></tr>");var e="<div class='viewBorder'><table class='entrytable' cellpadding='0' cellspacing='0'>";var a=m.contentobjects;for(var o=0;o<5;o++){var l=a[o];if(l==null){continue}var r=l.attributes.shortsnippet.prefix;if(!r){r=""}var t=l.attributes.shortsnippet.match;if(!t){t=""}var g=l.attributes.shortsnippet.postfix;if(!g){g=""}var c=l.attributes.longsnippet.prefix;if(!c){c=""}var k=l.attributes.longsnippet.match;if(!k){k=""}var b=l.attributes.longsnippet.postfix;if(!b){b=""}var s={id:this.contentId+"_element_"+o,title:l.attributes.title!=null?l.attributes.title.substring(0,70):"",url:l.attributes.url!=null?l.attributes.url.escapeHTML():"",shortsnippet:r+"<span class='regExpMatch'>"+t+"</span>"+g,longsnippet:c+"<a href='"+this.tagUrl+k+"' rel='tag' class='regExpMatch' onclick='return false;'>"+k+"</a>"+b,imagetype:this.type,imageindex:o+1,rating:5-o,date:l.attributes.date};e+=h.evaluate(s)}e+="</table></div>";this.content.update();this.content.update(e);this.idiom.loadEnd(this.loadName);for(var o=0;o<5;o++){var f=this.contentId+"_element_"+o;Event.observe($(f),"mouseover",p.bind(this,{position:o+1}));Event.observe($(f),"mouseout",q.bind(this,{position:o+1}));Event.observe($(f).down(".content"),"click",this.toggleSnippet.bindAsEventListener(this,$(f).down(".content")));Event.observe($(f).down(".icon"),"click",this.navigate.bindAsEventListener(this,m.contentobjects[o].contentid));Event.observe($(f).down(".url"),"click",this.navigate.bindAsEventListener(this,m.contentobjects[o].contentid))}},update:function(a){this.currentContentId=a.contentid;this.snapshot=a.snapshotid;this.updateInformationDWR(this.currentContentId,this.offset,this.searchTerm)},updateInformationDWR:function(f,e,b){var c=this;this.idiom.loadStart(this.loadName);var d=function(){};if(this.type=="semantic"){d=Server.getSemanticSimilarDocuments}if(this.type=="geographic"){d=Server.getGeographicSimilarDocuments}d(f,e,b,this.sample,this.site,this.snapshot,{callback:function(g){c.displayInformation(g)},errorHandler:function(g){c.errorHandler(g)}});if(this.rssEnabled){var a=this.rssUrl.gsub("[sample]",this.sample).gsub("[site]",this.site).gsub("[contentid]",f);$(this.rssId).href=a}},errorHandler:function(a){this.idiom.notify("error","display","Error in related: "+a)},clear:function(){if(this.similarTopicsEnabled){$("WhatsRelatedSemanticContent").update()}if(this.nearbyLocationsEnabled){$("WhatsRelatedGeographicContent").update()}},highlightSemantic:function(a){try{$("WhatsRelatedSemanticContent").down(".entry",a).addClassName("hover")}catch(b){}},unhighlightSemantic:function(a){try{$("WhatsRelatedSemanticContent").down(".entry",a).removeClassName("hover")}catch(b){}},highlightGeographic:function(a){try{$("WhatsRelatedGeographicContent").down(".entry",a).addClassName("hover")}catch(b){}},unhighlightGeographic:function(a){try{$("WhatsRelatedGeographicContent").down(".entry",a).removeClassName("hover")}catch(b){}}});at.idiom.js.search=Class.create();at.idiom.js.search.Search=Class.create(at.idiom.js.window.Window,{initialize:function($super,b){$super(b);this.loadName=b.searchMessage;this.searchMessage=$(b.searchMessageId);this.searchInput=$(b.searchInputId);this.mainContent=$(b.mainContentId);this.mainContentPermalink=$(b.mainContentPermalinkId);this.searchForm=$(b.searchFormId);this.sample=b.sample;this.site=b.site;this.snapshot=b.snapshot;this.displayConcordance=b.displayConcordance;this.displayVote=b.displayVote;this.voteElement=$(b.vote);this.displaySemanticOrientation=b.displaySemanticOrientation;this.count=50;this.searchTerm="";this.searchDisplayed=false;this.concordance=$(b.concordanceId);this.concordanceContent=$(b.concordanceContentId);this.smallConcordance=b.smallConcordance;this.bigConcordance=b.bigConcordance;this.toggleButton=$(b.toggleButtonId);this.toggleButtonMax=$(b.toggleButtonMaxId);this.toggleButtonMin=$(b.toggleButtonMinId);this.buttonNormal=b.buttonNormal;this.buttonHighlight=b.buttonHighlight;this.sortBy=null;this.sortOrder=null;this.result=[];var a=this;this.idiom.register("search","displayInformationMain",function(c){a.displayInformationMain(c)});this.idiom.register("search","displayInformationSingle",function(c){a.displayInformationSingle(c,true)});this.idiom.register("search","displayInformationDone",function(c){a.displayInformationDone(c)});this.idiom.register("search","newSearch",function(c){a.search(c.term,c.count)});this.idiom.register("search","newTagSearch",function(c){a.setValue(c);a.submit(null)});Event.observe($(b.resultButton50),"click",function(){a.searchMore(50)});Event.observe($(b.resultButton100),"click",function(){a.searchMore(100)});Event.observe($(b.resultButton200),"click",function(){a.searchMore(200)});if(b.semanticOrientationButton){Event.observe($(b.semanticOrientationButton),"click",function(){a.sortResultToggle("semorient")})}Event.observe($(b.sortButtonDate),"click",function(){a.sortResultToggle("date")});Event.observe(this.toggleButton,"click",this.toggleConcordance.bindAsEventListener(this));if(b.maximizeButton){Event.observe($(b.maximizeButton),"click",this.maximize.bindAsEventListener(this))}if(b.minimizeButton){Event.observe($(b.minimizeButton),"click",this.minimize.bindAsEventListener(this))}Event.observe($(b.closeButton),"click",function(){a.closeConcordance()});Event.observe(this.searchForm,"submit",this.submit.bindAsEventListener(this));Event.observe($(b.searchInputId),"click",this.hideHint.bindAsEventListener(this));Event.observe($(b.searchInputId),"blur",this.showHint.bindAsEventListener(this));this.idiom.register(null,"restoreState",function(c){if(c.snapshotid){a.snapshot=c.snapshotid}if(c.searchterm){a.search(c.searchterm,c.searchcount,true)}if(c.searchconcordance){a.showConcordance();if(c.searchconcordance=="big"){a.maximizeConcordance()}else{if(c.searchconcordance=="small"){a.minimizeConcordance()}else{if(c.searchconcordance=="minimize"){a.minimize()}else{if(c.searchconcordance=="maximize"){a.maximize()}else{a.closeConcordance(true)}}}}}else{a.closeConcordance(true)}});this.idiom.register(null,"hide",function(){a.hideWindow();a.toggleSearchForm(false)});this.idiom.register(null,"show",function(){if(a.searchDisplayed){a.showWindow()}a.toggleSearchForm(true)});this.idiom.register(null,"changeSnapshot",function(c){a.snapshot=c.snapshotid})},formatDate:function(c){var e=c.getMonth();var d=c.getFullYear();var b=c.getDate();var a=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");e=a[e];return b+" "+e+" "+d},displayInformationFrame:function(a){this.concordanceContent.update('<table id="ConcordanceTable" cellspacing="0" cellpadding="0" border="0"></table>');if(a){this.idiom.notify("main","switchBig",null);this.idiom.notify("charts","hide",null);this.showConcordance()}},displayInformationSingle:function(f,b){var l='<tr class="hover resultelement"><td class="result"><div class="overflow"><div class="clip"><div class="center"><span class="prefix">#{prefix}</span><span class="match">#{match}</span><span class="postfix">#{postfix}</span></div></div></div></td>';if(this.displaySemanticOrientation){l+='<td class="semorient #{semorientclass}">#{semorient}</td>'}l+='<td class="date">#{date}</td></tr>';var k='<tr class="splitelement"><td>&nbsp;</td>';if(this.displaySemanticOrientation){k+="<td>&nbsp;</td>"}k+="<td>&nbsp;</td></tr>";var e=new Template(l);var c="";var a=0;var p="";if(this.displayConcordance){var c="";if(f){var m="";if(this.displaySemanticOrientation){if(f.attributes.semorient>0){m="positive"}else{if(f.attributes.semorient<0){m="negative"}}}var o={prefix:f.attributes.prefix,match:f.attributes.match,postfix:f.attributes.postfix,semorient:f.attributes.semorient.toFixed(1),semorientclass:m,date:this.formatDate(f.attributes.date)};c+=e.evaluate(o)}}var h=0;if(b){var g=this.storeResult(f);h=g.index;var d=$("ConcordanceTable").down("tr.resultelement",h-1);if(d){if(g.splitterBefore){if(!d.next("tr")||!d.next("tr").hasClassName("splitelement")){d.insert({after:k})}d=d.next("tr")}d.insert({after:c});d=d.next("tr");if(g.splitterAfter){if(d.next("tr")&&!d.next("tr").hasClassName("splitelement")){d.insert({after:k})}}}else{$("ConcordanceTable").insert({top:c});d=$("ConcordanceTable").down("tr.resultelement");if(g.splitterAfter){d.insert({after:k})}}}else{$("ConcordanceTable").insert(c);h=$("ConcordanceTable").select("tr.resultelement").length-1}Event.observe($("ConcordanceTable").down("tr.resultelement",h),"click",this.selectSearchHit.bindAsEventListener(this,f.contentid,f.attributes.md5sum))},selectSearchHit:function(a,c,b){this.minimize();this.idiom.notify("main","setNewContentId",{contentid:c,md5sum:b,showsnippet:true})},displayInformationMain:function(a){var b=0;if(a){if(a.attributes.firstHit){b=a.contentid}}this.idiom.notify("main","setNewContentId",{contentid:b,nostorestate:true,noload:false});this.idiom.notify("maps","minimize",null);this.hideHint()},displayInformation:function(d,c,e){if(d.length==0){return}if(d.length==1){var b=d[0];if(b.attributes.emptyresults){this.displayMessage("Term not found.");this.concordanceContent.update("No documents matching your search query have been found.");return}if(b.attributes.indexexception){this.displayMessage("Error retrieving search results.");this.concordanceContent.update("The search index is inaccessible at the moment. Please try again later.");return}if(b.attributes.queryexception){this.displayMessage("Incorrect query");this.concordanceContent.update('Your query <span class="incorrectquery">'+b.attributes.query.escapeHTML()+"</span> could not be understood.");return}if(b.attributes.stopwords){this.displayMessage("Term too general.");this.concordanceContent.update("The search term is too general, try a more specific search query.");return}if(b.attributes.ajaxresults){return}}if(d.length>=1&&c){var b=d[0];this.displayInformationMain(b)}if(this.displayConcordance){this.displayInformationFrame(c);for(var a=1;a<d.length;a++){var b=d[a];this.displayInformationSingle(b,e)}if(d.length==1){this.concordanceContent.update("No additional results found.")}}this.displayInformationDone()},displayInformationDone:function(){this.idiom.loadEnd(this.loadName);dwr.engine.setActiveReverseAjax(false);this.idiom.notify("geographic","addSearchMarkers",this.result);this.idiom.notify("geographic","addSearchLines",this.result);this.idiom.notify("semantic","addSearchMarkers",this.result);this.idiom.notify("keywordgraph","newGraph",{term:this.searchTerm})},storeResults:function(a){this.result=a},storeResult:function(d){this.result.push(d);var f=this;this.result.sort(function(k,h){return f.resultComparator(k,h)});var c=$(this.result).indexOf(d);var e=false;var b=this.result[c-1];if(b&&b.attributes.match.toLowerCase()!=d.attributes.match.toLowerCase()){e=true}var g=false;var a=this.result[c+1];if(a&&a.attributes.match.toLowerCase()!=d.attributes.match.toLowerCase()){g=true}return{index:c,splitterBefore:e,splitterAfter:g}},resultComparator:function(d,c){var f=d.attributes.match.toLowerCase().replace(/&nbsp;/g," ");var e=c.attributes.match.toLowerCase().replace(/&nbsp;/g," ");if(f==e){return c.attributes.date.getTime()-d.attributes.date.getTime()}var g=this.searchTerm.toLowerCase().replace(/\"/g,"");if(g==f){return -1}if(g==e){return 1}if(f<e){return -1}else{return 1}},sortResultToggle:function(a){if(this.sortBy==a){if(this.sortOrder=="asc"){this.sortOrder="desc"}else{this.sortOrder="asc"}}else{this.sortOrder="asc"}this.sortBy=a;this.sortResult(this.sortBy,this.sortOrder)},sortResult:function(c,a){if(!this.result){return}var b=this;this.storeResults(this.result.sort(function(e,d){return b.sort(e,d,c,a)}));this.displayInformation(this.result,false,false)},sort:function(e,d,g,c){if(e.attributes.firstHit){return -1}else{if(d.attributes.firstHit){return 1}}var f=0;if(g=="date"){f=e.attributes.date.getTime()-d.attributes.date.getTime()}else{if(g=="semorient"){f=e.attributes.semorient-d.attributes.semorient}else{if(g=="match"){f=(d.attributes.match<e.attributes.match)-(e.attributes.match<d.attributes.match)}}}if(c=="asc"){return f}else{return -f}},displayMessage:function(b){this.searchMessage.update(b);var c=Position.cumulativeOffset(this.searchInput)[1];c+=this.searchInput.getHeight();this.searchMessage.setStyle({top:c+"px"});this.searchMessage.show();clearTimeout(this.timeout);var a=this;this.timeout=setTimeout(function(){a.searchMessage.hide()},5000)},submit:function(b){var a=this.searchInput.value;if(a=="Search..."){return false}this.idiom.notify("search","newSearch",{term:a,count:50});Event.stop(b)},search:function(b,e,a){this.searchInput.value=b;if(e<0){e=0}if(e>200){e=200}this.result=[];this.toggleCountButtons(this.count,e);this.count=e;var c=true;if(this.searchTerm==b&&this.searchDisplayed){c=false}this.searchTerm=b;this.idiom.loadStart(this.loadName);this.searchMessage.hide();var d=this;this.hideHint();dwr.engine.setActiveReverseAjax(true);this.displayInformationFrame(c);Server.searchAdvanced(b,this.sample,this.site,this.snapshot,e,{callback:function(f){d.displayInformation(f.contentobjects,c,true)},errorHandler:function(g,f){d.errorHandler(g,f)}});if(!a){this.idiom.notify("history","storeState",{searchterm:b,searchcount:e,searchconcordance:this.concordanceMaximized?"big":"small"})}},searchMore:function(a){this.idiom.notify("search","newSearch",{term:this.searchTerm,count:a})},setValue:function(a){this.searchInput.value=a.gsub(new RegExp("<b>(.*)</b>","i"),function(b){return b[1]}).toLowerCase();this.hideHint()},getValue:function(){var a=this.searchInput.value;if(a=="Search ..."){a=""}return a},errorHandler:function(b,a){this.idiom.notify("error","display","Error in search: "+b+" "+a.message)},showHint:function(){if(this.searchInput.value==""){this.searchInput.value="Search ...";this.searchInput.addClassName("hint");this.searchInput.removeClassName("nohint")}},hideHint:function(){if(this.searchInput.value=="Search ..."){this.searchInput.value=""}this.searchInput.addClassName("nohint");this.searchInput.removeClassName("hint")},showConcordance:function(){if(this.searchDisplayed){return}this.searchDisplayed=true;this.resetDirectPosition();this.concordance.show();this.idiom.notify("main","switchBig",null);this.concordance.addClassName("small");this.adjustContentHeight();this.toggleButtonMin.hide();this.toggleButtonMax.show()},closeConcordance:function(a){if(!this.searchDisplayed){return}if(this.isMaximized){this.minimize();return}this.concordance.removeClassName("small");this.concordance.removeClassName("big");this.concordance.hide();this.idiom.notify("main","switchFull",null);this.searchDisplayed=false;this.minimize();this.idiom.notify("charts","show",null);this.idiom.notify("geographic","clearSearchMarkers",null);this.idiom.notify("semantic","clearSearchMarkers",null);if(!a){this.idiom.notify("history","storeState",{searchterm:null,searchcount:0,searchconcordance:null})}},maximizeConcordance:function(){this.concordance.removeClassName("small");this.concordance.addClassName("big");this.toggleButtonMax.hide();this.toggleButtonMin.show();this.adjustContentHeight();this.idiom.notify("main","switchSmall",null);this.concordanceMaximized=true},minimizeConcordance:function(){this.concordance.removeClassName("big");this.concordance.addClassName("small");this.toggleButtonMin.hide();this.toggleButtonMax.show();this.adjustContentHeight();this.idiom.notify("main","switchBig",null);this.concordanceMaximized=false},toggleConcordance:function(){if(this.concordanceMaximized){this.minimizeConcordance()}else{this.maximizeConcordance()}},minimize:function($super){$super();this.resetDirectPosition();this.showToggle()},maximize:function($super){$super();this.hideToggle()},hideToggle:function(){this.toggleButton.hide()},showToggle:function(){this.toggleButton.show()},toggleCountButtons:function(a,b){$(this.buttonHighlight+a).hide();$(this.buttonNormal+a).show();$(this.buttonNormal+b).hide();$(this.buttonHighlight+b).show()},vote:function(a){Server.voteSearchResult(a,{callback:function(b){},errorHandler:function(){}})},voteForm:function(d){var a=0;for(var b=0;b<d.length;b++){if(d[b].checked){a=d[b].value}}var c=this;Server.voteSearchResult(a,{callback:function(e){c.hideVote()},errorHandler:function(){}})},showVote:function(){if(this.displayVote){this.voteElement.show()}},hideVote:function(){if(this.displayVote){new Effect.Fade(this.voteElement,{duration:1,from:1,to:0})}},getSearchTerm:function(){return this.searchTerm},getSearchCount:function(){return this.count},toggleSearchForm:function(a){if(a){this.searchForm.enable()}else{this.searchForm.disable()}}});at.idiom.js.viewer=Class.create();at.idiom.js.viewer.Viewer=Class.create(at.idiom.js.window.Window,{initialize:function($super,b){$super(b);this.loadId=b.loadId;this.sample=b.sample;this.site=b.site;this.snapshot=b.snapshot;this.reloadAfterSnapshotChange=false;this.category=b.category;this.mainContent=$(b.mainContentId);this.mainContentContent=$(b.mainContentContentId);this.mainContentTitle=$(b.mainContentTitleId);this.mainContentTitleActiveDocument=$(b.mainContentTitleActiveDocumentId);this.mainContentTitleUploadDocument=$(b.mainContentTitleUploadDocumentId);this.mainContentTitleAnalyzingDocument=$(b.mainContentTitleAnalyzingDocumentId);this.mainContentTitleAnalyzingDocumentName=$(b.mainContentTitleAnalyzingDocumentNameId);this.mainContentTitleFillForm=$(b.mainContentTitleFillFormId);this.mainContentPermalink=$(b.mainContentPermalinkId);this.mainContentAddContent=$(b.mainContentAddContentId);this.contentModeSwitcher=b.contentModeSwitcher;var a=this;this.currentContentId=0;this.currentContent=null;this.currentVideoUrl=null;this.idiom.register("main","setNewContentId",function(c){a.update(c)});this.idiom.register("main","displayNewStartDocument",function(c){a.displayNewStartDocument(c)});this.idiom.register("main","switchSmall",function(){a.switchSmall()});this.idiom.register("main","switchBig",function(){a.switchBig()});this.idiom.register("main","switchFull",function(){a.switchFull()});this.searchTerm="";this.idiom.register("search","newSearch",function(c){a.searchTerm=c.term});this.idiom.register(null,"restoreState",function(c){if(c.contentid){this.snapshot=c.snapshotid;a.update({contentid:c.contentid,nostorestate:true})}});if(b.addContentEnabled){$(b.mainContentAddContentId).observe("click",function(){a.idiom.notify("addcontent","show",{})})}if(b.videoEnabled){$(b.mainContentDisplayVideo).observe("click",function(){a.idiom.notify("video","show",{url:a.currentVideoUrl})});this.idiom.register("main","showAddVideo",function(c){$(b.mainContentDisplayVideo).show();a.currentVideoUrl=c.url});this.idiom.register("main","hideAddVideo",function(){$(b.mainContentDisplayVideo).hide()})}this.idiom.register("main","showAddContent",function(){a.switchAddContent(true)});this.idiom.register("main","hideAddContent",function(){a.switchAddContent(false)});this.idiom.register("main","displayTitle",function(c){a.switchTitle(c)});this.idiom.register("categorychooser","select",function(c){a.category=c.key});this.idiom.register(null,"changeSnapshot",function(c){a.snapshot=c.snapshotid;a.reloadAfterSnapshotChange=true});this.idiom.register(this.contentModeSwitcher,"select",function(c){a.switchMode(c.data.name)})},setStartDocument:function(b,a){this.currentContentId=b.contentId;this.idiom.notify(null,"onNewContentId",{contentid:b.contentId,snapshotid:this.snapshot});this.idiom.notify("video","update",{url:b.url});if(!a){this.idiom.notify("history","storeState",{contentid:b.contentId,snapshotid:this.snapshot})}this.idiom.notify("maps","minimize",null)},displayNewStartDocument:function(b){var a=this;Server.getStartContentId(this.sample,this.site,this.snapshot,b.date,b.chartcategory,b.charttype,b.numKeywords,{callback:function(c){if(c!=a.currentContentId){a.update({contentid:c,nostorestate:false})}},errorHandler:function(c){a.idiom.notify("error","display",c)}})},updateMainView:function(d,g){if(g==null){g=d.defaultmode}if(d==null){d=this.currentContent}this.currentContent=d;var c=d.metadata;var f=null;if(g=="summary"&&d.summary!=null){f=d.summary}else{if(g=="fulltext"&&d.fulltext!=null){f=d.fulltext}else{if(g=="extendedquote"&&d.extendedquote!=null){f=d.extendedquote}}}var a="<div class='textContent'>"+f+"</div>";if(this.searchTerm!=""){var b=this.searchTerm.replace(/"/g,"");a=a.gsub(new RegExp("(>[^<]*?\\b)("+b+")(\\b[^>]*?<)","i"),function(h){return h[1]+"<span class='regExpMatch'>"+h[2]+"</span>"+h[3]})}this.mainContentContent.update(c+a);this.mainContentPermalink.href=d.permalink;this.mainContentContent.scrollTop=0;this.idiom.notify(this.contentModeSwitcher,"set",{name:g});var e=[];if(d.summary!=null){e.push("summary")}if(d.fulltext!=null){e.push("fulltext")}if(d.extendedquote!=null){e.push("extendedquote")}this.idiom.notify(this.contentModeSwitcher,"enable",{names:e})},update:function(b){var c=b.contentid;if(c==this.currentContentId&&!this.reloadAfterSnapshotChange&&!b.showsnippet){return}this.currentContentId=c;if(b.noload){return}this.reloadAfterSnapshotChange=false;var a=this;this.idiom.loadStart(this.loadId);if(b.showsnippet){Server.getContentSnippet(c,this.sample,this.site,this.snapshot,b.md5sum,{callback:function(d){d.contentId=c;a.updateMainView(d);a.setStartDocument(d,b.nostorestate);a.idiom.loadEnd(a.loadId)},errorHandler:function(d){a.idiom.notify("error","display",d)}})}else{Server.getContent(c,this.sample,this.site,this.snapshot,{callback:function(d){d.contentId=c;a.updateMainView(d);a.setStartDocument(d,b.nostorestate);a.idiom.loadEnd(a.loadId)},errorHandler:function(d){a.idiom.notify("error","display",d)}})}},switchBig:function(){this.showWindow();this.mainContent.removeClassName("small");this.mainContent.addClassName("big");this.adjustContentHeight()},switchSmall:function(){this.showWindow();this.mainContent.removeClassName("big");this.mainContent.addClassName("small");this.adjustContentHeight()},switchFull:function(){this.showWindow();this.mainContent.removeClassName("big");this.mainContent.removeClassName("small");this.adjustContentHeight()},switchAddContent:function(a){this.showWindow();this.mainContent.removeClassName("big");this.mainContent.removeClassName("small");if(a){this.mainContent.addClassName("addcontent");this.mainContentAddContent.hide();this.mainContentPermalink.hide();this.switchTitle({title:"uploadDocument"});this.clearContent()}else{this.mainContent.removeClassName("addcontent");this.mainContentAddContent.show();this.mainContentPermalink.show();this.switchTitle({title:"activeDocument"});this.reshowDocument()}this.adjustContentHeight()},switchTitle:function(a){this.mainContentTitle.select(".viewHeaderTitle").each(function(b){b.hide()});if(a.title=="activeDocument"){this.mainContentTitleActiveDocument.show()}else{if(a.title=="uploadDocument"){this.mainContentTitleUploadDocument.show()}else{if(a.title=="analyzingDocument"){this.mainContentTitleAnalyzingDocument.show();this.mainContentTitleAnalyzingDocumentName.update("'"+a.file+"'")}else{if(a.title=="fillForm"){this.mainContentTitleFillForm.show()}}}}},hideWindow:function(){this.mainContent.hide()},showWindow:function(){this.mainContent.show()},clearContent:function(){this.mainContentContent.update()},reshowDocument:function(){var a=this.currentContentId;this.currentContentId=null;this.update({contentid:a})},switchMode:function(a){this.updateMainView(null,a)}});at.idiom.js.charts=Class.create();at.idiom.js.charts.Chart=Class.create(at.idiom.js.window.Window,{initialize:function($super,b){$super(b);this.sample=b.sample;this.site=b.site;this.snapshot=b.snapshot;this.loadName=b.loadId;this.chartContainerClass=b.chartContainerClass;this.legendContainerClass=b.legendContainerClass;this.chartsId=b.chartsId;this.chartCategoriesEnabled=b.chartCategoriesEnabled;if(this.chartCategoriesEnabled){this.chartCategoryDisplay=$(b.chartCategory)}this.chartCategory=null;this.chartCategoryName=null;this.chartType="frequency";this.currentDate=null;this.numKeywords=null;this.numDatapoints=null;this.charts=$H();var a=this;this.idiom.register("charts","hide",function(){a.hideWindow()});this.idiom.register("charts","show",function(){a.showWindow()});this.idiom.register(null,"hide",function(){a.hideWindow()});this.idiom.register(null,"show",function(){a.showWindow()});this.idiom.register("categorychooser","select",function(c){a.loadCharts(c.data.name,c.data.displayName,c.data.numKeywords,c.data.numDatapoints,false)});this.idiom.register(null,"changeSnapshot",function(c){a.snapshot=c.snapshotid;a.loadCharts(a.chartCategory,a.chartCategoryName,a.numKeywords,a.numDatapoints,false)});this.idiom.register(null,"changeDate",function(c){a.currentDate=c.date;if(a.isVisible){a.idiom.notify("main","displayNewStartDocument",{date:a.currentDate,chartcategory:a.chartCategory,charttype:a.chartType,numKeywords:a.numKeywords});a.loadCharts(a.chartCategory,a.chartCategoryName,a.numKeywords,a.numDatapoints,false)}})},createCharts:function(a,b){this.idiom.loadEnd(this.loadName);this.charts=$H();$(a).each(function(c){this.createChart(c.name,c.data)},this);this.showChart(b)},createChart:function(b,f){var e=$H();var c=$H();f.series.each(function(l){var k={label:l.name,data:[],color:l.colour,enabled:true};var h=new Date(0,0,0);var g=Number.MIN_VALUE;$H(l.data).each(function(p){var o=p.key;var m=new Date(parseInt(o.substring(0,4),10),parseInt(o.substring(5,7),10)-1,parseInt(o.substring(8,10),10));if(p.value!=null){k.data.push([m,p.value])}if(m.getTime()>h.getTime()){h=m;g=p.value}});e.set(l.name,k);c.set(l.name,{value:g,name:l.name,colour:l.colour})},this);var a=c.values();a.sort(function(h,g){return g.value-h.value});this.findLegend(b).update();$(a).each(function(g){this.createLegend(b,g.colour,g.name)},this);this.charts.set(b,{name:b,data:e,legend:c});this.createChartObject(b,e.values());var d=this;Event.observe($(this.chartsId).down(".button."+b),"click",function(){d.chartType=b;d.showChart(false)})},createChartObject:function(a,c){var b=this.findContainer(a);b.update();new Proto.Chart(b,c,{xaxis:{mode:"time",tickSize:[7,"day"]},lines:{show:true},points:{show:true},mouse:{track:true,fixedPosition:false,sensibility:10000000,trackFormatter:function(d){return d.y}}})},createLegend:function(a,g,c){var e=this.findLegend(a);var d=new Template('<li class="legendEntry"><div class="colour" title="Hide chart series" style="background-color:#{colour}"></div><div class="name">#{name}</div></li>');var f=d.evaluate({colour:g,name:c});e.insert(f);var b=$(e).select(".legendEntry").last();Event.observe($(b).down(".colour"),"click",this.toggleChartSeries.bind(this,b,a,c));Event.observe($(b).down(".name"),"click",this.idiom.notify.bind(this.idiom,"search","newSearch",{term:c.indexOf(" ")!=-1?'"'+c+'"':c,count:50}))},toggleChartSeries:function(d,b,c){var a=this.charts.get(b).data.get(c).enabled;this.charts.get(b).data.get(c).enabled=!a;if(a){$(d).addClassName("deselected")}else{$(d).removeClassName("deselected")}var e=[];this.charts.get(b).data.each(function(f){if(f.value.enabled){e.push(f.value)}});this.createChartObject(b,e)},loadCharts:function(e,a,d,b,f){this.chartCategory=e;this.chartCategoryName=a;this.numKeywords=d;this.numDatapoints=b;var c=this;this.idiom.loadStart(this.loadName);Server.getTopCharts(d,b,this.sample,this.site,this.snapshot,e,this.currentDate,{callback:function(g){c.createCharts(g,f)}})},errorHandler:function(b,a){if(!a){a=""}this.idiom.notify("error","display","Error in chart: "+b+" "+a)},showChart:function(a){this.charts.each(function(c){var b=c.value;this.hideChart(b.name);if(b.name==this.chartType){if(!a){this.idiom.notify("main","displayNewStartDocument",{date:this.currentDate,charttype:this.chartType,chartcategory:this.chartCategory,numKeywords:this.numKeywords})}}},this);this.findContent(this.chartType).setStyle({visibility:"visible"});this.toggleButton(this.chartType)},hideChart:function(a){this.findContent(a).setStyle({visibility:"hidden"})},findContent:function(a){return $(this.chartsId).down(".chartContent."+a)},findContainer:function(a){return $(this.chartsId).down(".chartContent."+a).down(".chartContainer")},findLegend:function(a){return $(this.chartsId).down(".chartContent."+a).down(".chartLegend")},toggleButton:function(a){$(this.windowId).select(".button").each(function(b){if(b.hasClassName(a)){$(b).down(".normal").hide();$(b).down(".highlight").show()}else{$(b).down(".normal").show();$(b).down(".highlight").hide()}})}});at.idiom.js.addcontent=Class.create();at.idiom.js.addcontent.Form=Class.create(at.idiom.js.window.Window,{initialize:function($super,b){$super(b);this.formWrapper=$(b.formWrapperId);this.formData=$(b.formDataId);this.formFile=$(b.formFileId);this.formFileInput=$(b.formFileInputId);this.formTitleInput=$(b.formTitleInputId);this.formFileSubmit=$(b.formFileSubmitId);var a=this;this.idiom.register("addcontent","show",function(c){a.showForm();this.idiom.notify("main","displayTitle",{title:"uploadDocument",file:""})});this.idiom.register("addcontent","hide",function(){a.hideForm()});this.idiom.register("addcontent","startUpload",function(){a.idiom.notify("main","displayTitle",{title:"analyzingDocument",file:a.formFileInput.getValue()})});this.idiom.register("addcontent","uploadDone",function(c){a.idiom.notify("main","displayTitle",{title:"fillForm",file:""})})},showForm:function(){this.idiom.notify("main","showAddContent",{});this.idiom.notify(null,"hide",{});this.formData.reset();this.formFile.reset();$("AddContentFormFieldFile").enable();this.formWrapper.show()},hideForm:function(){this.formWrapper.hide();this.idiom.notify("main","hideAddContent",{});this.idiom.notify(null,"show",{})},checkUploadButton:function(){if(this.formTitleInput.getValue()!=""&&this.formFileInput.getValue()!=""){this.formFileSubmit.enable()}else{this.formFileSubmit.disable()}}});at.idiom.js.sample=Class.create();at.idiom.js.sample.SampleChooser=Class.create({initialize:function(b){this.idiom=b.idiom;this.form=$(b.formId);var a=this;this.idiom.register(null,"hide",function(){a.toggleForm(false)});this.idiom.register(null,"show",function(){a.toggleForm(true)})},toggleForm:function(a){if(a){this.form.enable()}else{this.form.disable()}}});at.idiom.js.video=Class.create();at.idiom.js.video.Video=Class.create(at.idiom.js.window.Window,{initialize:function($super,b){$super(b);this.idiom=b.idiom;this.content=$(b.content);this.playerObjectTemplate=new Template("<object width='260' height='240' classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95'><param name='FileName' value='#{videoUrl}' /><param name='AutoStart' value='true' /><param name='ShowControls' value='1' /><param name='ShowStatusBar' value='0' /><param name='EnableContextMenu' value='0' /><param name='ShowDisplay' value='0' /><param name='ShowTracker' value='1' /><param name='stretchToFit' value='true' /><param name='AutoSize' value='true' /><param name='scale' value='tofit' /><embed width='260' height='240' scale='tofit' stretchtofit='true' autosize='true' showstatusbar='0' showcontrols='1' showtracker='1' enabledcontextmenu='0' src='#{videoUrl}' pluginspage='http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/' type='application/x-mplayer2' /></object>");var a=this;this.idiom.register("video","show",function(c){if(c.url&&c.url!=""){a.createPlayerObject(c.url);a.idiom.notify("keywordgraph","close",{})}});this.idiom.register("video","update",function(c){a.idiom.notify("video","hide",{});if(c.url&&c.url!=""){if(c.url.substr(c.url.length-4)==".wmv"){a.idiom.notify("main","showAddVideo",{url:c.url})}else{a.idiom.notify("main","hideAddVideo",{})}}else{a.idiom.notify("main","hideAddVideo",{})}});this.idiom.register("video","hide",function(){a.destroyPlayerObject()});$(b.closeButton).observe("click",function(){a.idiom.notify("video","hide",{})});this.leftLeft=0;this.rightLeft=0;this.toggleLeft=0;new Draggable(this.window,{handle:"viewHeader",constraint:"horizontal",onEnd:function(){var d=a.window.positionedOffset().left;var c=a.window.positionedOffset().top;if(d<a.toggleLeft){new Effect.Move(a.window,{x:a.leftLeft,y:c,mode:"absolute",duration:0.5})}else{new Effect.Move(a.window,{x:a.rightLeft,y:c,mode:"absolute",duration:0.5})}},starteffect:Effect.Full,endeffect:Effect.Full})},destroyPlayerObject:function(){this.content.update();this.hideWindow()},createPlayerObject:function(b){this.destroyPlayerObject();this.showWindow();this.leftLeft=parseInt(this.window.getStyle("left"));this.rightLeft=this.leftLeft+this.window.getWidth()+10;this.toggleLeft=(this.leftLeft+this.rightLeft)/2;var a=this.playerObjectTemplate.evaluate({videoUrl:b});this.content.update(a)}});at.idiom.js.menu=Class.create();at.idiom.js.menu.OverlayMenu=Class.create({initialize:function(c){this.idiom=c.idiom;this.notifyName=c.notifyName;this.entry=$(c.entry);this.mainContentElement=$(c.mainContentElement);this.displayElement=$(c.displayElement);this.content=c.content;this.imageUrl=c.imageUrl;this.align=c.align?c.align:"center";this.overlay=null;this.menuElement=null;this.contentFunction=c.contentFunction;this.spacerTemplate=new Template("<hr></hr>");this.unselectedTemplate=new Template("<a class='#{cssclass}'>#{displayName}</a>");this.selectedTemplate=new Template("<a class='#{cssclass}'><img src='#{imageUrl}topbar/b_right.gif' border='0' />#{displayName}</a>");var b=this;this.entry.observe("click",function(){b.showMenu()});if(this.notifyName){this.idiom.register(this.notifyName,"set",function(d){b.setSelected(-1,d.name)});this.idiom.register(this.notifyName,"enable",function(d){b.enable(d.names)})}if(this.content!=null){var a=0;this.content.each(function(d){if(d.enabled){a++}});if(a>1){this.entry.show()}else{this.entry.hide()}}},showMenu:function(){this.entry.addClassName("menuSelected");if(this.menuElement){this.destroyMenu()}this.createMenuElement();this.insertContent();var f=this.menuElement.getWidth();var d=this.entry.getWidth();if(f<d){f=d}var b=this.mainContentElement.cumulativeOffset().left;var k=this.entry.cumulativeOffset().left-b;var e=0;if(this.align=="right"){e=k+d-f}else{var a=k+d/2;e=a-f/2}if(e+f>this.mainContentElement.getWidth()){e=this.mainContentElement.getWidth()-f}else{if(e<5){e=5}}var g=this.entry.cumulativeOffset().top;var c=this.entry.getHeight();var h=g+c;this.menuElement.setStyle({left:e+"px",width:f+"px",top:h+"px"});this.menuElement.appear({duration:0.3});new Effect.BlindDown(this.menuElement,{duration:0.3});this.createBackgroundOverlay()},insertContent:function(){if(this.contentFunction){this.contentFunction(this.menuElement)}else{var a="";var c=false;var b=this;this.content.each(function(f){if(f.fixed&&!c){a+=this.spacerTemplate.evaluate({});c=true}else{c=false}var d=this.unselectedTemplate;if(f.selected){d=this.selectedTemplate}var e="";if(f.fixed){e+=" fixed "}if(!f.enabled){e+=" disabled "}else{e+=" enabled "}a+=d.evaluate({imageUrl:b.imageUrl,displayName:f.displayName,cssclass:e})},this);this.menuElement.update(a);this.menuElement.select("a").each(function(e,d){if(!e.hasClassName("disabled")){e.observe("click",function(f){b.setSelected(d);b.idiom.notify(b.notifyName,"select",{data:b.content[d]});f.stop();b.destroyMenu()})}})}},setSelected:function(a,b){this.content.each(function(d,c){if(c==a||d.name==b){d.selected=true;this.showSelection(d)}else{d.selected=false}},this)},createMenuElement:function(){this.menuElement=$(document.createElement("div"));this.mainContentElement.appendChild(this.menuElement);this.menuElement.setStyle({zIndex:10000,width:"auto",height:"auto",display:"none"});this.menuElement.addClassName("overlayMenuContent")},createBackgroundOverlay:function(){var b=document.getElementsByTagName("body").item(0);this.overlay=$(document.createElement("div"));b.appendChild(this.overlay);var a=at.idiom.js.util.Util.getPageSize();this.overlay.setStyle({position:"absolute",zIndex:5000,top:"0px",width:a[0]+"px",height:a[1]+"px",left:"0px"});this.overlay.show();var c=this;this.overlay.observe("click",function(){c.destroyMenu()})},destroyBackgroundOverlay:function(){if(this.overlay){this.overlay.remove();this.overlay=null}},destroyMenu:function(){this.entry.removeClassName("menuSelected");this.destroyBackgroundOverlay();this.menuElement.fade({duration:0.3});var a=this;new Effect.BlindUp(this.menuElement,{duration:0.3,afterFinish:function(){a.menuElement.remove();a.menuElement=null}})},showSelection:function(a){if(this.displayElement){this.displayElement.update(a.displayName)}},enable:function(b){var a=0;this.content.each(function(c){if(b.indexOf(c.name)!=-1){a++;c.enabled=true}else{c.enabled=false}},this);if(a>1){this.entry.show()}else{this.entry.hide()}}});at.idiom.js.snapshots=Class.create();at.idiom.js.snapshots.Snapshots=Class.create({months:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],initialize:function(c){this.idiom=c.idiom;this.sample=c.sample;this.site=c.site;this.snapshots=c.snapshots;this.imageUrl=c.imageUrl;this.enabled=c.enabled?c.enabled:false;this.nextDayElement=$(c.nextDay);this.nextWeekElement=$(c.nextWeek);this.previousDayElement=$(c.previousDay);this.previousWeekElement=$(c.previousWeek);this.currentDateElement=$(c.currentDate);this.snapshotSelectorElement=$(c.snapshotSelectorElement);this.currentSnapshotId=c.currentSnapshot;this.currentSnapshotIndex=-1;for(var a=0;a<this.snapshots.length;a++){if(this.snapshots[a].id==c.currentSnapshot){this.currentSnapshotIndex=a;break}}this.currentDate=this.parseDate(c.newestDate);this.newestDate=c.newestDate;this.updateDate(false);var b=this;this.previousWeekElement.observe("click",this.previousWeek.bind(this));this.previousDayElement.observe("click",this.previousDay.bind(this));this.nextDayElement.observe("click",this.nextDay.bind(this));this.nextWeekElement.observe("click",this.nextWeek.bind(this));this.updateButtons();this.popupMenu=new at.idiom.js.menu.OverlayMenu({notifyName:"",idiom:this.idiom,entry:this.snapshotSelectorElement,mainContentElement:$("Content"),content:null,contentFunction:function(d){b.createDateSelector(d)}})},nextDay:function(){if(this.nextDayElement.down(".enabled").visible()){this.changeDate(24*60*60*1000)}},previousDay:function(){if(this.previousDayElement.down(".enabled").visible()){this.changeDate(-24*60*60*1000)}},nextWeek:function(){if(this.nextWeekElement.down(".enabled").visible()){this.changeDate(7*24*60*60*1000)}},previousWeek:function(){if(this.previousWeekElement.down(".enabled").visible()){this.changeDate(-7*24*60*60*1000)}},changeDate:function(f){var c=this.parseDate(this.newestDate);var d=this.parseDate(this.snapshots[0].date);var a=new Date(this.currentDate.getTime()+f);if(a.getTime()<d.getTime()){a.setTime(d.getTime())}else{if(a.getTime()>c.getTime()){a.setTime(c.getTime())}}var e=DatePickerUtils.dateObjectToAnsi(this.currentDate);this.currentDate.setTime(a.getTime());var b=DatePickerUtils.dateObjectToAnsi(this.currentDate);var g=e!=b;if(g){this.changedDate(g)}},changedDate:function(){var a=this.getSnapshotForDate(this.currentDate);if(a!=this.currentSnapshotId){this.selectSnapshotById(a)}this.updateButtons();this.updateDate(true)},selectSnapshotById:function(a){this.currentSnapshotId=a;for(var b=0;b<this.snapshots.length;b++){if(this.snapshots[b].id==a){this.currentSnapshotIndex=b;break}}this.idiom.notify(null,"changeSnapshot",{snapshotid:a})},selectSnapshotByDate:function(a){this.currentDate=this.parseDate(a);this.changedDate()},updateButtons:function(){var b=this.parseDate(this.snapshots[0].date).getTime();var a=this.parseDate(this.newestDate).getTime();var c=this.currentDate.getTime();this.updateButton(this.previousWeekElement,c-7*24*60*60*1000>=b);this.updateButton(this.previousDayElement,c-24*60*60*1000>=b);this.updateButton(this.nextDayElement,c+24*60*60*1000<=a);this.updateButton(this.nextWeekElement,c+7*24*60*60*1000<=a)},updateButton:function(b,a){if(a){b.down(".disabled").hide();b.down(".enabled").show()}else{b.down(".enabled").hide();b.down(".disabled").show()}},updateDate:function(a){this.currentDateElement.update(this.formatDate(this.currentDate));if(a){this.idiom.notify(null,"changeDate",{date:this.currentDate})}},createDateSelector:function(a){var b=this;this.dateSelector=new DatePicker({element:a,relative:this.snapshotSelectorElement.id,keepFieldEmpty:true,dateFilter:this.dateSelectorFilter(),zindex:10000,relativePosition:false,relativeAppend:true,currentDate:DatePickerUtils.dateObjectToAnsi(this.currentDate),callback:function(c){b.popupMenu.destroyMenu();b.selectSnapshotByDate(c)}})},dateSelectorFilter:function(){var d=this.parseDate(this.snapshots[0].date);var c=this.parseDate(this.newestDate);var b=new DatePickerUtils.noDatesBefore(d);var a=new DatePickerUtils.noDatesAfter(c);return b.append(a)},showDateSelector:function(){this.dateSelector.click()},parseDate:function(a){return new Date(a.substr(0,4),a.substr(5,2)-1,a.substr(8,2))},formatDate:function(a){return(a.getDate()<10?"0":"")+a.getDate()+" "+this.months[a.getMonth()]+" "+a.getFullYear()},getSnapshotForDate:function(b){var d=-1;var e=DatePickerUtils.dateObjectToAnsi(b);for(var c=0;c<this.snapshots.length;c++){var a=this.snapshots[c].id;var f=this.snapshots[c].date;if(f>=e){d=a;break}}if(d==-1){d=this.snapshots[this.snapshots.length-1].id}return d}});at.idiom.js.touchgraph=Class.create();at.idiom.js.touchgraph.position=function(a,b){if(b==null){return null}a.setStyle({left:b.left+"px",top:b.top+"px"});return b};at.idiom.js.touchgraph.getCenter=function(a){return new at.idiom.js.touchgraph.Vector(a.position.left+a.width/2,a.position.top+a.height/2)};at.idiom.js.touchgraph.getDistance=function(b,a){return new at.idiom.js.touchgraph.Vector(a.position.left-b.position.left,a.position.top-b.position.top)};at.idiom.js.touchgraph.Touchgraph=Class.create(at.idiom.js.window.Window,{initialize:function($super,b){$super(b);this.sample=b.sample;this.site=b.site;this.snapshot=b.snapshot;this.settings={G:10,radiusScale:0.75,defaultRadius:4,massScale:0.8,stiffness:0.075,defaultEdgeLength:65,frameRate:100,focusClass:"touchgraph-focus",visualisationTimeout:15000};this.element=$(b.element);this.model={};this.edges=new at.idiom.js.touchgraph.Edges();this.position=this.element.cumulativeOffset();this.width=this.element.getWidth();this.height=this.element.getHeight();this.lineImages=[];this.drawingInterval=null;this.drawingTimer=null;this.loadImages($(b.imagePreloadElement).select("img"));this.numTerms=4;this.addLevelDelay=250;this.maxNodeCount=50;this.plusButton=$(b.plusButton);this.plusButtonActive=true;this.loadId=b.loadId;var a=this;this.idiom.register(null,"changeSnapshot",function(c){a.snapshot=c.snapshotid});this.idiom.register("keywordgraph","newGraph",function(c){a.displayKeywords(c.term)});this.idiom.register("keywordgraph","restart",function(c){a.restart()});this.idiom.register("keywordgraph","close",function(){a.close()});this.idiom.register("keywordgraph","plus",this.addLevel.bind(this));Event.observe(this.plusButton,"click",function(c){if(a.plusButtonActive){a.addLevel()}c.stop();return false})},close:function($super){if(this.isMaximized){this.minimize();this.restart();this.window.setStyle({zIndex:100})}else{$super();this.hideWindow()}},displayKeywords:function(a){this.model={};this.edges=new at.idiom.js.touchgraph.Edges();this.element.update();this.showWindow();this.position=this.element.cumulativeOffset();this.width=this.element.getWidth();this.height=this.element.getHeight();var b=this;a=a.replace(/\"/g,"");var c="id-"+a;this.getKeywords({term:a,callback:function(d){d[c]={children:[],label:a,focus:true};$H(d).each(function(e){if(e.key!=c){d[c].children.push(e.key)}});b.parseJSON(d);b.start()}})},getKeywords:function(c){var b=this;this.idiom.loadStart(this.loadId);var a=[c.term];for(n in this.model){a.push(this.model[n].label)}Server.getDocumentsKeywordsForTerm(this.sample,this.site,this.snapshot,c.term,this.numTerms,a,{callback:function(d){var f="id-"+c.term;var e={};$(d).each(function(h){var g="id-"+h.keyword;if(g!=f){e[g]={children:[],label:h.keyword,sentiment:h.sentiment}}});c.callback(e);b.idiom.loadEnd(b.loadId)},errorHandler:function(f,d){b.errorHandler(f,d);b.idiom.loadEnd(b.loadId)}})},onCreateNode:function(d,f,e){var b=new Element("div",{"class":"label"});e.label.split(" ").each(function(g){b.insert(new Element("span",{"class":"line"}).update(g)).insert("<br />")});d.insert(b);var c=this;d.observe("click",function(){c.getKeywords({term:e.label,callback:function(g){c.addChildren(f,g);c.start()}})});var a="#000000";if(e.sentiment>0.3){a="#00bb00"}else{if(e.sentiment<-0.3){a="#bb3333"}}d.setStyle({backgroundColor:a});this.togglePlusButton(this.plusButtonActive)},loadImages:function(a){a.each(function(b){this.lineImages.push(b.src)},this)},updateLine:function(g,b,a){var e=b.left;var c=b.top;var p=a.left;var o=a.top;var d=Math.min(e,p);var q=Math.min(c,o);var l=Math.max(e,p);var f=Math.max(c,o);var k=Math.max(l-d,1);var m=Math.max(f-q,1);var h=Math.min(k,m,256);var r=(p-e)*(o-c)<0?0:1;while(h>>=1){r+=2}g.writeAttribute("src",this.lineImages[r+2]);g.setStyle({width:k+"px",height:m+"px",left:d+"px",top:q+"px"})},parseJSON:function(d){this.model=d;var a=null;for(n in this.model){new at.idiom.js.touchgraph.Node(n,this);if(this.model[n].focus){a=this.model[n];this.model[n].element.addClassName(this.settings.focusClass);this.model[n].node.position=at.idiom.js.touchgraph.position(this.model[n].element,new at.idiom.js.touchgraph.Vector(this.width/2,this.height/2))}}this.positionChildren(a,true);for(n in this.model){var b=this.model[n].children;for(var c=0;c<b.length;c++){new at.idiom.js.touchgraph.Edge(this.model[n].node,this.model[b[c]].node,this)}}},addChildren:function(d,b){var c=0;var a=this.model[d];($H(b)).each(function(f){if(this.model[f.key]){var e=this.model[f.key].children;this.model[f.key]=Object.extend(this.model[f.key],f.value);$(e).each(function(g){if($(this.model[f.key].children).indexOf(g)==-1){this.model[f.key].children.push(g)}},this)}else{this.model[f.key]=f.value;new at.idiom.js.touchgraph.Node(f.key,this)}if(a.children.indexOf(f.key)==-1){a.children.push(f.key)}c++;if(!this.edges.get(d,f.key)){new at.idiom.js.touchgraph.Edge(a.node,this.model[f.key].node,this)}},this);this.positionChildren(a,false);return c},edgesFrom:function(c){var a=[];for(var b=0;b<this.edges.getEdges().length;b++){if(this.edges.getEdges()[b].node1.id==c.id){a.push(this.edges.getEdges()[b])}}return a},edgesTo:function(c){var a=[];for(var b=0;b<this.edges.getEdges().length;b++){if(this.edges.getEdges()[b].node2.id==c.id){a.push(this.edges.getEdges()[b])}}return a},calculate:function(){for(x in this.model){var f=this.model[x].node;f.force=new at.idiom.js.touchgraph.Vector(0,0);var d=this.edgesFrom(f);for(var e=0;e<d.length;e++){f.force.add(d[e].forceFrom())}d=this.edgesTo(f);for(var e=0;e<d.length;e++){f.force.add(d[e].forceTo())}}for(x in this.model){var c=this.model[x].node;for(y in this.model){var b=this.model[y].node;if(x!=y){c.force.add(c.forceTo(b))}}}for(x in this.model){var f=this.model[x].node;f.force.add(f.forceEdge())}for(x in this.model){var a=this.model[x].node.draw()}for(var e=0;e<this.edges.getEdges().length;e++){this.edges.getEdges()[e].draw()}},start:function(){this.stop();this.drawingInterval=setInterval(this.calculate.bind(this),this.settings.frameRate);this.drawingTimer=setTimeout(this.stop.bind(this),this.settings.visualisationTimeout)},stop:function(){clearTimeout(this.drawingTimer);clearInterval(this.drawingInterval)},restart:function(){this.stop();this.position=this.element.cumulativeOffset();this.width=this.element.getWidth();this.height=this.element.getHeight();for(n in this.model){if(this.model[n].focus){this.clearPositions(this.model[n]);this.model[n].node.position=at.idiom.js.touchgraph.position(this.model[n].element,new at.idiom.js.touchgraph.Vector(this.width/2,this.height/2));this.positionChildren(this.model[n],false);break}}this.start()},clearPositions:function(a){if(a.node.position==null){return}a.node.position=null;$(a.children).each(function(b){var c=this.model[b];this.clearPositions(c)},this)},positionChildren:function(f,e){var h=f.node.position;var c=f.children.length;var d=2*Math.PI/c;var a=this.settings.defaultEdgeLength/2;var g=Math.PI/4;var b=[];$(f.children).each(function(k){var o=this.model[k];if(o.node.position==null){var m=0;var l=0;if(f.focus&&e){m=Math.random()*this.width;l=Math.random()*this.height}else{m=h.left+a*Math.cos(g);l=h.top+a*Math.sin(g)}o.node.position=at.idiom.js.touchgraph.position(o.element,new at.idiom.js.touchgraph.Vector(m,l));g+=d;b.push(o)}},this);$(b).each(function(k){this.positionChildren(k,false)},this)},getLeafNodes:function(c,b){if(b.indexOf(c.node.id)!=-1){return[]}if(c.children.length==0){return[c.label]}var a=[];b.push(c.node.id);$(c.children).each(function(d){var e=this.model[d];a.push(this.getLeafNodes(e,b))},this);return a},addLevel:function(){this.togglePlusButton(false);var a=null;for(n in this.model){if(this.model[n].focus){a=this.model[n];break}}var c=$(this.getLeafNodes(a,[])).flatten().uniq();var d=this;var b=0;$(c).each(function(g,e){var f=e==c.length-1;setTimeout(function(){d.getKeywords({term:g,callback:function(h){d.addChildren("id-"+g,h);d.start();if(f){d.togglePlusButton(true)}}})},b);b+=this.addLevelDelay},this)},getNodeCount:function(){var a=0;for(i in this.model){a++}return a},togglePlusButton:function(a){if(a!=this.plusButtonActive){if(a){this.plusButtonActive=true;this.plusButton.down(".inactive").hide();this.plusButton.down(".active").show()}else{this.plusButtonActive=false;this.plusButton.down(".active").hide();this.plusButton.down(".inactive").show()}}if(this.getNodeCount()<this.maxNodeCount){this.plusButton.show()}else{this.plusButton.hide()}},errorHandler:function(b,a){if(!a){a=""}this.idiom.notify("error","display","Error in keyword graph: "+b+" "+a)}});at.idiom.js.touchgraph.Edges=Class.create(new Array(),{initialize:function(){this.edges=[]},get:function(c,b){for(var a=0;a<this.edges.length;a++){var d=this.edges[a];if(d.node1.id==c&&d.node2.id==b){return d}if(d.node2.id==c&&d.node1.id==b){return d}}return null},push:function(a){this.edges.push(a)},getEdges:function(){return this.edges}});at.idiom.js.touchgraph.Vector=Class.create({initialize:function(b,a){this.left=b;this.top=a},length:function(){return Math.sqrt(this.left*this.left+this.top*this.top)},add:function(a){this.left+=a.left;this.top+=a.top;return this}});at.idiom.js.touchgraph.Node=Class.create({initialize:function(b,a){this.id=b;this.graph=a;if(!a.model[b]){a.model[b]={children:[]}}this.focus=a.model[b].focus;this.position=null;this.element=a.model[b].element=new Element("div",{"class":"node",id:b});a.element.insert(this.element);a.onCreateNode(this.element,b,a.model[b]);at.idiom.js.touchgraph.position(this.element,this.position);this.force=new at.idiom.js.touchgraph.Vector(0,0);this.mass=1;this.massChange();a.model[b].node=this},addMass:function(a){this.mass+=a*this.graph.settings.massScale;this.massChange()},massChange:function(){var a=this.mass*this.graph.settings.radiusScale;this.width=this.height=this.graph.settings.defaultRadius+a;this.element.setStyle({width:this.width+"px",height:this.height+"px"})},forceTo:function(b){var e=at.idiom.js.touchgraph.getDistance(this,b);var a=e.length();if(!a){return new at.idiom.js.touchgraph.Vector(0,0)}var c=this.graph.settings.G*(this.mass*b.mass)/(a*a);c=Math.min(c,10);return new at.idiom.js.touchgraph.Vector(-e.left*c,-e.top*c)},forceEdge:function(){var d=10*this.mass;var b={position:new at.idiom.js.touchgraph.Vector(this.position.left,Math.min(30,this.position.top-10)),mass:d};var e={position:new at.idiom.js.touchgraph.Vector(Math.min(10,this.position.left-10),this.position.top),mass:d};var g={position:new at.idiom.js.touchgraph.Vector(this.position.left,Math.max(this.graph.height-10,this.position.top+10)),mass:d};var h={position:new at.idiom.js.touchgraph.Vector(Math.max(this.graph.width-30,this.position.left+10),this.position.top),mass:d};var c=this.forceTo(b);var a=this.forceTo(e);var k=this.forceTo(g);var f=this.forceTo(h);return c.add(a).add(k).add(f)},draw:function(b){if(this.focus){return this.position}if(!b){b=this.force}var a=this.position.left;this.position=this.position.add(b);at.idiom.js.touchgraph.position(this.element,this.position);return this.position}});at.idiom.js.touchgraph.Edge=Class.create({initialize:function(b,a,c){this.node1=b;this.node2=a;this.node1.addMass(1);this.graph=c;this.id="edge-"+b.id+"-"+a.id;this.stiffness=0.1;this.naturalLength=this.graph.settings.defaultEdgeLength;this.element=$(this.id);if(!this.element){this.element=new Element("img",{id:this.id,"class":"line"});c.element.insert(this.element)}c.edges.push(this)},forceTo:function(){var c=at.idiom.js.touchgraph.getDistance(this.node1,this.node2);var a=c.length();if(!a){return new at.idiom.js.touchgraph.Vector(0,0)}var b=this.graph.settings.stiffness*(a-this.naturalLength);return new at.idiom.js.touchgraph.Vector(-b*c.left/a,-b*c.top/a)},forceFrom:function(){var c=at.idiom.js.touchgraph.getDistance(this.node1,this.node2);var a=c.length();if(!a){return new at.idiom.js.touchgraph.Vector(0,0)}var b=this.graph.settings.stiffness*(a-this.naturalLength);return new at.idiom.js.touchgraph.Vector(b*c.left/a,b*c.top/a)},draw:function(){this.graph.updateLine(this.element,at.idiom.js.touchgraph.getCenter(this.node1),at.idiom.js.touchgraph.getCenter(this.node2))}});