/*
Copyright (c) 2007 Brian Dillard and Brad Neuberg:
Brian Dillard | Project Lead | bdillard@pathf.com | http://blogs.pathf.com/agileajax/
Brad Neuberg | Original Project Creator | http://codinginparadise.org
   
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
window.dhtmlHistory={isIE:false,isOpera:false,isSafari:false,isKonquerer:false,isGecko:false,isSupported:false,create:function(e){var h=this;var g=navigator.userAgent.toLowerCase();var a=navigator.platform.toLowerCase();var k=navigator.vendor||"";if(k==="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(k.indexOf("Apple Computer, Inc.")>-1){this.isSafari=true;this.isSupported=(a.indexOf("mac")>-1)}else{if(g.indexOf("gecko")!=-1){this.isGecko=true;this.isSupported=true}}}}}window.historyStorage.setup(e);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 f=function(){h.firstLoad=null};this.addEventListener(window,"unload",f);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(){h.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,e){if(this.isSafari){c=this.removeHash(c);historyStorage.put(c,e);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,e);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 e="rshHistoryFrame";var c='<iframe frameborder="0" id="'+e+'" style="'+b+'" src="blank.html?'+a+'"></iframe>';document.write(c);this.iframe=document.getElementById(e)},createOpera:function(){this.waitTime=400;var a='<img src="javascript:location.href=\'javascript:dhtmlHistory.checkLocation();\';" style="'+historyStorage.hideStyles+'" />';document.write(a)},createSafari:function(){var f="rshSafariForm";var e="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 g='<form id="'+f+'" style="'+b+'"><input type="text" style="'+a+'" id="'+e+'" value="[]"/><input type="text" style="'+a+'" id="'+c+'" value=""/></form>';document.write(g);this.safariStack=document.getElementById(e);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 e="rshStorageForm";var g="rshStorageField";var a=this.debugMode?historyStorage.showStyles:historyStorage.hideStyles;var f=(historyStorage.debugMode?"width: 800px;height:80px;border:1px solid black;":historyStorage.hideStyles);var c='<form id="'+e+'" style="'+a+'"><textarea id="'+g+'" style="'+f+'"></textarea></form>';document.write(c);this.storageField=document.getElementById(g);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()}};
/*  Prototype JavaScript framework, version 1.7
 *  (c) 2005-2010 Sam Stephenson
 *
 *  Prototype is freely distributable under the terms of an MIT-style license.
 *  For details, see the Prototype web site: http://www.prototypejs.org/
 *
 *--------------------------------------------------------------------------*/
var Prototype={Version:"1.7",Browser:(function(){var b=navigator.userAgent;var a=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!a,Opera:a,WebKit:b.indexOf("AppleWebKit/")>-1,Gecko:b.indexOf("Gecko")>-1&&b.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile/.test(b)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var a=window.Element||window.HTMLElement;return !!(a&&a.prototype)})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var c=document.createElement("div"),b=document.createElement("form"),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,f=arguments.length;b<f;b++){var a=arguments[b];try{c=a();break}catch(g){}}return c}};var Class=(function(){var e=(function(){for(var f in {toString:1}){if(f==="toString"){return false}}return true})();function a(){}function b(){var k=null,h=$A(arguments);if(Object.isFunction(h[0])){k=h.shift()}function f(){this.initialize.apply(this,arguments)}Object.extend(f,Class.Methods);f.superclass=k;f.subclasses=[];if(k){a.prototype=k.prototype;f.prototype=new a;k.subclasses.push(f)}for(var g=0,l=h.length;g<l;g++){f.addMethods(h[g])}if(!f.prototype.initialize){f.prototype.initialize=Prototype.emptyFunction}f.prototype.constructor=f;return f}function c(n){var h=this.superclass&&this.superclass.prototype,g=Object.keys(n);if(e){if(n.toString!=Object.prototype.toString){g.push("toString")}if(n.valueOf!=Object.prototype.valueOf){g.push("valueOf")}}for(var f=0,k=g.length;f<k;f++){var m=g[f],l=n[m];if(h&&Object.isFunction(l)&&l.argumentNames()[0]=="$super"){var o=l;l=(function(p){return function(){return h[p].apply(this,arguments)}})(m).wrap(o);l.valueOf=o.valueOf.bind(o);l.toString=o.toString.bind(o)}this.prototype[m]=l}return this}return{create:b,Methods:{addMethods:c}}})();(function(){var G=Object.prototype.toString,F="Null",r="Undefined",z="Boolean",g="Number",v="String",L="Object",w="[object Function]",C="[object Boolean]",h="[object Number]",o="[object String]",k="[object Array]",B="[object Date]",l=window.JSON&&typeof JSON.stringify==="function"&&JSON.stringify(0)==="0"&&typeof JSON.stringify(Prototype.K)==="undefined";function n(N){switch(N){case null:return F;case (void 0):return r}var M=typeof N;switch(M){case"boolean":return z;case"number":return g;case"string":return v}return L}function D(M,O){for(var N in O){M[N]=O[N]}return M}function K(M){try{if(c(M)){return"undefined"}if(M===null){return"null"}return M.inspect?M.inspect():String(M)}catch(N){if(N instanceof RangeError){return"..."}throw N}}function H(M){return J("",{"":M},[])}function J(V,S,T){var U=S[V],R=typeof U;if(n(U)===L&&typeof U.toJSON==="function"){U=U.toJSON(V)}var O=G.call(U);switch(O){case h:case C:case o:U=U.valueOf()}switch(U){case null:return"null";case true:return"true";case false:return"false"}R=typeof U;switch(R){case"string":return U.inspect(true);case"number":return isFinite(U)?String(U):"null";case"object":for(var N=0,M=T.length;N<M;N++){if(T[N]===U){throw new TypeError()}}T.push(U);var Q=[];if(O===k){for(var N=0,M=U.length;N<M;N++){var P=J(N,U,T);Q.push(typeof P==="undefined"?"null":P)}Q="["+Q.join(",")+"]"}else{var W=Object.keys(U);for(var N=0,M=W.length;N<M;N++){var V=W[N],P=J(V,U,T);if(typeof P!=="undefined"){Q.push(V.inspect(true)+":"+P)}}Q="{"+Q.join(",")+"}"}T.pop();return Q}}function A(M){return JSON.stringify(M)}function m(M){return $H(M).toQueryString()}function s(M){return M&&M.toHTML?M.toHTML():String.interpret(M)}function u(M){if(n(M)!==L){throw new TypeError()}var N=[];for(var O in M){if(M.hasOwnProperty(O)){N.push(O)}}return N}function e(M){var N=[];for(var O in M){N.push(M[O])}return N}function E(M){return D({},M)}function y(M){return !!(M&&M.nodeType==1)}function p(M){return G.call(M)===k}var b=(typeof Array.isArray=="function")&&Array.isArray([])&&!Array.isArray({});if(b){p=Array.isArray}function f(M){return M instanceof Hash}function a(M){return G.call(M)===w}function q(M){return G.call(M)===o}function t(M){return G.call(M)===h}function I(M){return G.call(M)===B}function c(M){return typeof M==="undefined"}D(Object,{extend:D,inspect:K,toJSON:l?A:H,toQueryString:m,toHTML:s,keys:Object.keys||u,values:e,clone:E,isElement:y,isArray:p,isHash:f,isFunction:a,isString:q,isNumber:t,isDate:I,isUndefined:c})})();Object.extend(Function.prototype,(function(){var n=Array.prototype.slice;function e(r,o){var q=r.length,p=o.length;while(p--){r[q+p]=o[p]}return r}function l(p,o){p=n.call(p,0);return e(p,o)}function h(){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 k(q){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this}var o=this,p=n.call(arguments,1);return function(){var r=l(p,arguments);return o.apply(q,r)}}function g(q){var o=this,p=n.call(arguments,1);return function(s){var r=e([s||window.event],p);return o.apply(q,r)}}function m(){if(!arguments.length){return this}var o=this,p=n.call(arguments,0);return function(){var q=l(p,arguments);return o.apply(this,q)}}function f(q){var o=this,p=n.call(arguments,1);q=q*1000;return window.setTimeout(function(){return o.apply(o,p)},q)}function a(){var o=e([0.01],arguments);return this.delay.apply(this,o)}function c(p){var o=this;return function(){var q=e([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=e([this],arguments);return o.apply(null,p)}}return{argumentNames:h,bind:k,bindAsEventListener:g,curry:m,delay:f,defer:a,wrap:c,methodize:b}})());(function(c){function b(){return this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+"Z"}function a(){return this.toISOString()}if(!c.toISOString){c.toISOString=b}if(!c.toJSON){c.toJSON=a}})(Date.prototype);RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};var PeriodicalExecuter=Class.create({initialize:function(b,a){this.callback=b;this.frequency=a;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},execute:function(){this.callback(this)},stop:function(){if(!this.timer){return}clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute();this.currentlyExecuting=false}catch(a){this.currentlyExecuting=false;throw a}}}});Object.extend(String,{interpret:function(a){return a==null?"":String(a)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,(function(){var NATIVE_JSON_PARSE_SUPPORT=window.JSON&&typeof JSON.parse==="function"&&JSON.parse('{"test": true}').test;function prepareReplacement(replacement){if(Object.isFunction(replacement)){return replacement}var template=new Template(replacement);return function(match){return template.evaluate(match)}}function gsub(pattern,replacement){var result="",source=this,match;replacement=prepareReplacement(replacement);if(Object.isString(pattern)){pattern=RegExp.escape(pattern)}if(!(pattern.length||pattern.source)){replacement=replacement("");return replacement+source.split("").join(replacement)+replacement}while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length)}else{result+=source,source=""}}return result}function sub(pattern,replacement,count){replacement=prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(match){if(--count<0){return match[0]}return replacement(match)})}function scan(pattern,iterator){this.gsub(pattern,iterator);return String(this)}function truncate(length,truncation){length=length||30;truncation=Object.isUndefined(truncation)?"...":truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this)}function strip(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}function stripTags(){return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,"")}function stripScripts(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")}function extractScripts(){var matchAll=new RegExp(Prototype.ScriptFragment,"img"),matchOne=new RegExp(Prototype.ScriptFragment,"im");return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||["",""])[1]})}function evalScripts(){return this.extractScripts().map(function(script){return eval(script)})}function escapeHTML(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function unescapeHTML(){return this.stripTags().replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}function toQueryParams(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match){return{}}return match[1].split(separator||"&").inject({},function(hash,pair){if((pair=pair.split("="))[0]){var key=decodeURIComponent(pair.shift()),value=pair.length>1?pair.join("="):pair[0];if(value!=undefined){value=decodeURIComponent(value)}if(key in hash){if(!Object.isArray(hash[key])){hash[key]=[hash[key]]}hash[key].push(value)}else{hash[key]=value}}return hash})}function toArray(){return this.split("")}function succ(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)}function times(count){return count<1?"":new Array(count+1).join(this)}function camelize(){return this.replace(/-+(.)?/g,function(match,chr){return chr?chr.toUpperCase():""})}function capitalize(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()}function underscore(){return this.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/-/g,"_").toLowerCase()}function dasherize(){return this.replace(/_/g,"-")}function inspect(useDoubleQuotes){var escapedString=this.replace(/[\x00-\x1f\\]/g,function(character){if(character in String.specialChar){return String.specialChar[character]}return"\\u00"+character.charCodeAt().toPaddedString(2,16)});if(useDoubleQuotes){return'"'+escapedString.replace(/"/g,'\\"')+'"'}return"'"+escapedString.replace(/'/g,"\\'")+"'"}function unfilterJSON(filter){return this.replace(filter||Prototype.JSONFilter,"$1")}function isJSON(){var str=this;if(str.blank()){return false}str=str.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@");str=str.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]");str=str.replace(/(?:^|:|,)(?:\s*\[)+/g,"");return(/^[\],:{}\s]*$/).test(str)}function evalJSON(sanitize){var json=this.unfilterJSON(),cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;if(cx.test(json)){json=json.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())}function parseJSON(){var json=this.unfilterJSON();return JSON.parse(json)}function include(pattern){return this.indexOf(pattern)>-1}function startsWith(pattern){return this.lastIndexOf(pattern,0)===0}function endsWith(pattern){var d=this.length-pattern.length;return d>=0&&this.indexOf(pattern,d)===d}function empty(){return this==""}function blank(){return/^\s*$/.test(this)}function interpolate(object,pattern){return new Template(this,pattern).evaluate(object)}return{gsub:gsub,sub:sub,scan:scan,truncate:truncate,strip:String.prototype.trim||strip,stripTags:stripTags,stripScripts:stripScripts,extractScripts:extractScripts,evalScripts:evalScripts,escapeHTML:escapeHTML,unescapeHTML:unescapeHTML,toQueryParams:toQueryParams,parseQuery:toQueryParams,toArray:toArray,succ:succ,times:times,camelize:camelize,capitalize:capitalize,underscore:underscore,dasherize:dasherize,inspect:inspect,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:NATIVE_JSON_PARSE_SUPPORT?parseJSON:evalJSON,include:include,startsWith:startsWith,endsWith:endsWith,empty:empty,blank:blank,interpolate:interpolate}})());var Template=Class.create({initialize:function(a,b){this.template=a.toString();this.pattern=b||Template.Pattern},evaluate:function(a){if(a&&Object.isFunction(a.toTemplateReplacements)){a=a.toTemplateReplacements()}return this.template.gsub(this.pattern,function(e){if(a==null){return(e[1]+"")}var g=e[1]||"";if(g=="\\"){return e[2]}var b=a,h=e[3],f=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;e=f.exec(h);if(e==null){return g}while(e!=null){var c=e[1].startsWith("[")?e[2].replace(/\\\\]/g,"]"):e[1];b=b[c];if(null==b||""==e[3]){break}h=h.substring("["==e[3]?e[1].length:e[0].length);e=f.exec(h)}return g+String.interpret(b)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable=(function(){function c(C,B){var A=0;try{this._each(function(E){C.call(B,E,A++)})}catch(D){if(D!=$break){throw D}}return this}function u(D,C,B){var A=-D,E=[],F=this.toArray();if(D<1){return F}while((A+=D)<F.length){E.push(F.slice(A,A+D))}return E.collect(C,B)}function b(C,B){C=C||Prototype.K;var A=true;this.each(function(E,D){A=A&&!!C.call(B,E,D);if(!A){throw $break}});return A}function l(C,B){C=C||Prototype.K;var A=false;this.each(function(E,D){if(A=!!C.call(B,E,D)){throw $break}});return A}function m(C,B){C=C||Prototype.K;var A=[];this.each(function(E,D){A.push(C.call(B,E,D))});return A}function w(C,B){var A;this.each(function(E,D){if(C.call(B,E,D)){A=E;throw $break}});return A}function k(C,B){var A=[];this.each(function(E,D){if(C.call(B,E,D)){A.push(E)}});return A}function h(D,C,B){C=C||Prototype.K;var A=[];if(Object.isString(D)){D=new RegExp(RegExp.escape(D))}this.each(function(F,E){if(D.match(F)){A.push(C.call(B,F,E))}});return A}function a(A){if(Object.isFunction(this.indexOf)){if(this.indexOf(A)!=-1){return true}}var B=false;this.each(function(C){if(C==A){B=true;throw $break}});return B}function t(B,A){A=Object.isUndefined(A)?null:A;return this.eachSlice(B,function(C){while(C.length<B){C.push(A)}return C})}function o(A,C,B){this.each(function(E,D){A=C.call(B,A,E,D)});return A}function z(B){var A=$A(arguments).slice(1);return this.map(function(C){return C[B].apply(C,A)})}function s(C,B){C=C||Prototype.K;var A;this.each(function(E,D){E=C.call(B,E,D);if(A==null||E>=A){A=E}});return A}function q(C,B){C=C||Prototype.K;var A;this.each(function(E,D){E=C.call(B,E,D);if(A==null||E<A){A=E}});return A}function f(D,B){D=D||Prototype.K;var C=[],A=[];this.each(function(F,E){(D.call(B,F,E)?C:A).push(F)});return[C,A]}function g(B){var A=[];this.each(function(C){A.push(C[B])});return A}function e(C,B){var A=[];this.each(function(E,D){if(!C.call(B,E,D)){A.push(E)}});return A}function p(B,A){return this.map(function(D,C){return{value:D,criteria:B.call(A,D,C)}}).sort(function(F,E){var D=F.criteria,C=E.criteria;return D<C?-1:D>C?1:0}).pluck("value")}function r(){return this.map()}function v(){var B=Prototype.K,A=$A(arguments);if(Object.isFunction(A.last())){B=A.pop()}var C=[this].concat(A).map($A);return this.map(function(E,D){return B(C.pluck(D))})}function n(){return this.toArray().length}function y(){return"#<Enumerable:"+this.toArray().inspect()+">"}return{each:c,eachSlice:u,all:b,every:b,any:l,some:l,collect:m,map:m,detect:w,findAll:k,select:k,filter:k,grep:h,include:a,member:a,inGroupsOf:t,inject:o,invoke:z,max:s,min:q,partition:f,pluck:g,reject:e,sortBy:p,toArray:r,entries:r,zip:v,size:n,inspect:y,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 u=Array.prototype,p=u.slice,r=u.forEach;function b(A,z){for(var y=0,B=this.length>>>0;y<B;y++){if(y in this){A.call(z,this[y],y,this)}}}if(!r){r=b}function o(){this.length=0;return this}function e(){return this[0]}function h(){return this[this.length-1]}function l(){return this.select(function(y){return y!=null})}function w(){return this.inject([],function(z,y){if(Object.isArray(y)){return z.concat(y.flatten())}z.push(y);return z})}function k(){var y=p.call(arguments,0);return this.select(function(z){return !y.include(z)})}function g(y){return(y===false?this.toArray():this)._reverse()}function n(y){return this.inject([],function(B,A,z){if(0==z||(y?B.last()!=A:!B.include(A))){B.push(A)}return B})}function s(y){return this.uniq().findAll(function(z){return y.detect(function(A){return z===A})})}function t(){return p.call(this,0)}function m(){return this.length}function v(){return"["+this.map(Object.inspect).join(", ")+"]"}function a(A,y){y||(y=0);var z=this.length;if(y<0){y=z+y}for(;y<z;y++){if(this[y]===A){return y}}return -1}function q(z,y){y=isNaN(y)?this.length:(y<0?this.length+y:y)+1;var A=this.slice(0,y).reverse().indexOf(z);return(A<0)?A:y-A-1}function c(){var D=p.call(this,0),B;for(var z=0,A=arguments.length;z<A;z++){B=arguments[z];if(Object.isArray(B)&&!("callee" in B)){for(var y=0,C=B.length;y<C;y++){D.push(B[y])}}else{D.push(B)}}return D}Object.extend(u,Enumerable);if(!u._reverse){u._reverse=u.reverse}Object.extend(u,{_each:r,clear:o,first:e,last:h,compact:l,flatten:w,without:k,reverse:g,uniq:n,intersect:s,clone:t,toArray:t,size:m,inspect:v});var f=(function(){return[].concat(arguments)[0][0]!==1})(1,2);if(f){u.concat=c}if(!u.indexOf){u.indexOf=a}if(!u.lastIndexOf){u.lastIndexOf=q}})();function $H(a){return new Hash(a)}var Hash=Class.create(Enumerable,(function(){function f(s){this._object=Object.isHash(s)?s.toObject():Object.clone(s)}function g(t){for(var s in this._object){var u=this._object[s],v=[s,u];v.key=s;v.value=u;t(v)}}function m(s,t){return this._object[s]=t}function c(s){if(this._object[s]!==Object.prototype[s]){return this._object[s]}}function p(s){var t=this._object[s];delete this._object[s];return t}function r(){return Object.clone(this._object)}function q(){return this.pluck("key")}function o(){return this.pluck("value")}function h(t){var s=this.detect(function(u){return u.value===t});return s&&s.key}function l(s){return this.clone().update(s)}function e(s){return new Hash(s).inject(this,function(t,u){t.set(u.key,u.value);return t})}function b(s,t){if(Object.isUndefined(t)){return s}return s+"="+encodeURIComponent(String.interpret(t))}function a(){return this.inject([],function(w,A){var v=encodeURIComponent(A.key),t=A.value;if(t&&typeof t=="object"){if(Object.isArray(t)){var z=[];for(var u=0,s=t.length,y;u<s;u++){y=t[u];z.push(b(v,y))}return w.concat(z)}}else{w.push(b(v,t))}return w}).join("&")}function n(){return"#<Hash:{"+this.map(function(s){return s.map(Object.inspect).join(": ")}).join(", ")+"}>"}function k(){return new Hash(this)}return{initialize:f,_each:g,set:m,get:c,unset:p,toObject:r,toTemplateReplacements:r,keys:q,values:o,index:h,merge:l,update:e,toQueryString:a,inspect:n,toJSON:r,clone:k}})());Hash.from=$H;Object.extend(Number.prototype,(function(){function e(){return this.toPaddedString(2,16)}function b(){return this+1}function k(m,l){$R(0,this,true).each(m,l);return this}function h(n,m){var l=this.toString(m||10);return"0".times(n-l.length)+l}function a(){return Math.abs(this)}function c(){return Math.round(this)}function f(){return Math.ceil(this)}function g(){return Math.floor(this)}return{toColorPart:e,succ:b,times:k,toPaddedString:h,abs:a,round:c,ceil:f,floor:g}})());function $R(c,a,b){return new ObjectRange(c,a,b)}var ObjectRange=Class.create(Enumerable,(function(){function b(g,e,f){this.start=g;this.end=e;this.exclusive=f}function c(e){var f=this.start;while(this.include(f)){e(f);f=f.succ()}}function a(e){if(e<this.start){return false}if(this.exclusive){return e<this.end}return e<=this.end}return{initialize:b,_each: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(e,b,c,a){this.each(function(f){if(Object.isFunction(f[e])){try{f[e].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.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 f=Object.isString(this.options.parameters)?this.options.parameters:Object.toQueryString(this.options.parameters);if(!["get","post"].include(this.method)){f+=(f?"&":"")+"_method="+this.method;this.method="post"}if(f&&this.method==="get"){this.url+=(this.url.include("?")?"&":"?")+f}this.parameters=f.toQueryParams();try{var a=new Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(a)}Ajax.Responders.dispatch("onCreate",this,a);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){this.respondToReadyState.bind(this).defer(1)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?(this.options.postBody||f):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(c){this.dispatchException(c)}},onStateChange:function(){var a=this.transport.readyState;if(a>1&&!((a==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var f={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){f["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){f.Connection="close"}}if(typeof this.options.requestHeaders=="object"){var c=this.options.requestHeaders;if(Object.isFunction(c.push)){for(var b=0,e=c.length;b<e;b+=2){f[c[b]]=c[b+1]}}else{$H(c).each(function(g){f[g.key]=g.value})}}for(var a in f){this.transport.setRequestHeader(a,f[a])}},success:function(){var a=this.getStatus();return !a||(a>=200&&a<300)||a==304},getStatus:function(){try{if(this.transport.status===1223){return 204}return this.transport.status||0}catch(a){return 0}},respondToReadyState:function(a){var 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(f){this.dispatchException(f)}var g=b.getHeader("Content-type");if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&g&&g.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse()}}try{(this.options["on"+c]||Prototype.emptyFunction)(b,b.headerJSON);Ajax.Responders.dispatch("on"+c,this,b,b.headerJSON)}catch(f){this.dispatchException(f)}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 e=this.transport=c.transport,a=this.readyState=e.readyState;if((a>2&&!Prototype.Browser.IE)||a==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(e.responseText);this.headerJSON=this._getHeaderJSON()}if(a==4){var b=e.responseXML;this.responseXML=Object.isUndefined(b)?null:b;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""}catch(a){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(a){return null}},getResponseHeader:function(a){return this.transport.getResponseHeader(a)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var a=this.getHeader("X-JSON");if(!a){return null}a=decodeURIComponent(escape(a));try{return a.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}},_getResponseJSON:function(){var a=this.request.options;if(!a.evalJSON||(a.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json"))||this.responseText.blank()){return null}try{return this.responseText.evalJSON(a.sanitizeJSON||!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,a,c,b){this.container={success:(a.success||a),failure:(a.failure||(a.success?null:a))};b=Object.clone(b);var e=b.onComplete;b.onComplete=(function(f,g){this.updateContent(f.responseText);if(Object.isFunction(e)){e(f,g)}}).bind(this);$super(c,b)},updateContent:function(e){var c=this.container[this.success()?"success":"failure"],a=this.options;if(!a.evalScripts){e=e.stripScripts()}if(c=$(c)){if(a.insertion){if(Object.isString(a.insertion)){var b={};b[a.insertion]=e;c.insert(b)}else{a.insertion(c,e)}}else{c.update(e)}}}});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,e=[],c=arguments.length;a<c;a++){e.push($(arguments[a]))}return e}if(Object.isString(b)){b=document.getElementById(b)}return Element.extend(b)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(g,a){var c=[];var f=document.evaluate(g,$(a)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var b=0,e=f.snapshotLength;b<e;b++){c.push(Element.extend(f.snapshotItem(b)))}return c}}if(!Node){var Node={}}if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12})}(function(c){function e(g,f){if(g==="select"){return false}if("type" in f){return false}return true}var b=(function(){try{var f=document.createElement('<input name="x">');return f.tagName.toLowerCase()==="input"&&f.name==="x"}catch(g){return false}})();var a=c.Element;c.Element=function(h,g){g=g||{};h=h.toLowerCase();var f=Element.cache;if(b&&g.name){h="<"+h+' name="'+g.name+'">';delete g.name;return Element.writeAttribute(document.createElement(h),g)}if(!f[h]){f[h]=Element.extend(document.createElement(h))}var k=e(h,g)?f[h].cloneNode(false):document.createElement(h);return Element.writeAttribute(k,g)};Object.extend(c.Element,a||{});if(a){c.Element.prototype=a.prototype}})(this);Element.idCounter=1;Element.cache={};Element._purgeElement=function(b){var a=b._prototypeUID;if(a){Element.stopObserving(b);b._prototypeUID=void 0;delete Element.Storage[a]}};Element.Methods={visible:function(a){return $(a).style.display!="none"},toggle:function(a){a=$(a);Element[Element.visible(a)?"hide":"show"](a);return a},hide:function(a){a=$(a);a.style.display="none";return a},show:function(a){a=$(a);a.style.display="";return a},remove:function(a){a=$(a);a.parentNode.removeChild(a);return a},update:(function(){var e=(function(){var h=document.createElement("select"),k=true;h.innerHTML='<option value="test">test</option>';if(h.options&&h.options[0]){k=h.options[0].nodeName.toUpperCase()!=="OPTION"}h=null;return k})();var b=(function(){try{var h=document.createElement("table");if(h&&h.tBodies){h.innerHTML="<tbody><tr><td>test</td></tr></tbody>";var l=typeof h.tBodies[0]=="undefined";h=null;return l}}catch(k){return true}})();var a=(function(){try{var h=document.createElement("div");h.innerHTML="<link>";var l=(h.childNodes.length===0);h=null;return l}catch(k){return true}})();var c=e||b||a;var g=(function(){var h=document.createElement("script"),l=false;try{h.appendChild(document.createTextNode(""));l=!h.firstChild||h.firstChild&&h.firstChild.nodeType!==3}catch(k){l=true}h=null;return l})();function f(n,o){n=$(n);var h=Element._purgeElement;var p=n.getElementsByTagName("*"),m=p.length;while(m--){h(p[m])}if(o&&o.toElement){o=o.toElement()}if(Object.isElement(o)){return n.update().insert(o)}o=Object.toHTML(o);var l=n.tagName.toUpperCase();if(l==="SCRIPT"&&g){n.text=o;return n}if(c){if(l in Element._insertionTranslations.tags){while(n.firstChild){n.removeChild(n.firstChild)}Element._getContentFromAnonymousElement(l,o.stripScripts()).each(function(q){n.appendChild(q)})}else{if(a&&Object.isString(o)&&o.indexOf("<link")>-1){while(n.firstChild){n.removeChild(n.firstChild)}var k=Element._getContentFromAnonymousElement(l,o.stripScripts(),true);k.each(function(q){n.appendChild(q)})}else{n.innerHTML=o.stripScripts()}}}else{n.innerHTML=o.stripScripts()}o.evalScripts.bind(o).defer();return n}return f})(),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,f){c=$(c);if(Object.isString(f)||Object.isNumber(f)||Object.isElement(f)||(f&&(f.toElement||f.toHTML))){f={bottom:f}}var e,g,b,h;for(var a in f){e=f[a];a=a.toLowerCase();g=Element._insertionTranslations[a];if(e&&e.toElement){e=e.toElement()}if(Object.isElement(e)){g(c,e);continue}e=Object.toHTML(e);b=((a=="before"||a=="after")?c.parentNode:c).tagName.toUpperCase();h=Element._getContentFromAnonymousElement(b,e.stripScripts());if(a=="top"||a=="after"){h.reverse()}h.each(g.curry(c));e.evalScripts.bind(e).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(g){var f=g.first(),c=g.last(),e=(b[f]||"").toString();if(e){a+=" "+c+"="+e.inspect(true)}});return a+">"},recursivelyCollect:function(a,c,e){a=$(a);e=e||-1;var b=[];while(a=a[c]){if(a.nodeType==1){b.push(Element.extend(a))}if(b.length==e){break}}return b},ancestors:function(a){return Element.recursivelyCollect(a,"parentNode")},descendants:function(a){return Element.select(a,"*")},firstDescendant:function(a){a=$(a).firstChild;while(a&&a.nodeType!=1){a=a.nextSibling}return $(a)},immediateDescendants:function(b){var a=[],c=$(b).firstChild;while(c){if(c.nodeType===1){a.push(Element.extend(c))}c=c.nextSibling}return a},previousSiblings:function(a,b){return Element.recursivelyCollect(a,"previousSibling")},nextSiblings:function(a){return Element.recursivelyCollect(a,"nextSibling")},siblings:function(a){a=$(a);return Element.previousSiblings(a).reverse().concat(Element.nextSiblings(a))},match:function(b,a){b=$(b);if(Object.isString(a)){return Prototype.Selector.match(b,a)}return a.match(b)},up:function(b,e,a){b=$(b);if(arguments.length==1){return $(b.parentNode)}var c=Element.ancestors(b);return Object.isNumber(e)?c[e]:Prototype.Selector.find(c,e,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,c,a){b=$(b);if(Object.isNumber(c)){a=c,c=false}if(!Object.isNumber(a)){a=0}if(c){return Prototype.Selector.find(b.previousSiblings(),c,a)}else{return b.recursivelyCollect("previousSibling",a+1)[a]}},next:function(b,e,a){b=$(b);if(Object.isNumber(e)){a=e,e=false}if(!Object.isNumber(a)){a=0}if(e){return Prototype.Selector.find(b.nextSiblings(),e,a)}else{var c=Object.isNumber(a)?a+1:1;return b.recursivelyCollect("nextSibling",a+1)[a]}},select:function(a){a=$(a);var b=Array.prototype.slice.call(arguments,1).join(", ");return Prototype.Selector.select(b,a)},adjacent:function(a){a=$(a);var b=Array.prototype.slice.call(arguments,1).join(", ");return Prototype.Selector.select(b,a.parentNode).without(a)},identify:function(a){a=$(a);var b=Element.readAttribute(a,"id");if(b){return b}do{b="anonymous_element_"+Element.idCounter++}while($(b));Element.writeAttribute(a,"id",b);return b},readAttribute:function(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(f,c,g){f=$(f);var b={},e=Element._attributeTranslations.write;if(typeof c=="object"){b=c}else{b[c]=Object.isUndefined(g)?true:g}for(var a in b){c=e.names[a]||a;g=b[a];if(e.values[a]){c=e.values[a](f,g)}if(g===false||g===null){f.removeAttribute(c)}else{if(g===true){f.setAttribute(c,c)}else{f.setAttribute(c,g)}}}return f},getHeight:function(a){return Element.getDimensions(a).height},getWidth:function(a){return Element.getDimensions(a).width},classNames:function(a){return new Element.ClassNames(a)},hasClassName:function(a,b){if(!(a=$(a))){return}var 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 e=b.style[c];if(!e||e=="auto"){var a=document.defaultView.getComputedStyle(b,null);e=a?a[c]:null}if(c=="opacity"){return e?parseFloat(e):1}return e=="auto"?null:e},getOpacity:function(a){return $(a).getStyle("opacity")},setStyle:function(b,c){b=$(b);var f=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 e in c){if(e=="opacity"){b.setOpacity(c[e])}else{f[(e=="float"||e=="cssFloat")?(Object.isUndefined(f.styleFloat)?"cssFloat":"styleFloat"):e]=c[e]}}return b},setOpacity:function(a,b){a=$(a);a.style.opacity=(b==1||b==="")?"":(b<0.00001)?0:b;return a},makePositioned:function(a){a=$(a);var b=Element.getStyle(a,"position");if(b=="static"||!b){a._madePositioned=true;a.style.position="relative";if(Prototype.Browser.Opera){a.style.top=0;a.style.left=0}}return a},undoPositioned:function(a){a=$(a);if(a._madePositioned){a._madePositioned=undefined;a.style.position=a.style.top=a.style.left=a.style.bottom=a.style.right=""}return a},makeClipping:function(a){a=$(a);if(a._overflow){return a}a._overflow=Element.getStyle(a,"overflow")||"auto";if(a._overflow!=="hidden"){a.style.overflow="hidden"}return a},undoClipping:function(a){a=$(a);if(!a._overflow){return a}a.style.overflow=a._overflow=="auto"?"":a._overflow;a._overflow=null;return a},clonePosition:function(b,e){var a=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});e=$(e);var f=Element.viewportOffset(e),g=[0,0],c=null;b=$(b);if(Element.getStyle(b,"position")=="absolute"){c=Element.getOffsetParent(b);g=Element.viewportOffset(c)}if(c==document.body){g[0]-=document.body.offsetLeft;g[1]-=document.body.offsetTop}if(a.setLeft){b.style.left=(f[0]-g[0]+a.offsetLeft)+"px"}if(a.setTop){b.style.top=(f[1]-g[1]+a.offsetTop)+"px"}if(a.setWidth){b.style.width=e.offsetWidth+"px"}if(a.setHeight){b.style.height=e.offsetHeight+"px"}return b}};Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(e,b,c){switch(c){case"height":case"width":if(!Element.visible(b)){return null}var f=parseInt(e(b,c),10);if(f!==b["offset"+c.capitalize()]){return f+"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(f,function(g,h){var k=e(b,h);return k===null?g:g-parseInt(k,10)})+"px";default:return e(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.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,f){function g(h){return h.replace(/alpha\([^\)]*\)/gi,"")}b=$(b);var a=b.currentStyle;if((a&&!a.hasLayout)||(!a&&b.style.zoom=="normal")){b.style.zoom=1}var e=b.getStyle("filter"),c=b.style;if(f==1||f===""){(e=g(e))?c.filter=e:c.removeAttribute("filter");return b}else{if(f<0.00001){f=0}}c.filter=g(e)+"alpha(opacity="+(f*100)+")";return b};Element._attributeTranslations=(function(){var b="className",a="for",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(e,f){return e.getAttribute(f)},_getAttr2:function(e,f){return e.getAttribute(f,2)},_getAttrNode:function(e,g){var f=e.getAttributeNode(g);return f?f.value:""},_getEv:(function(){var e=document.createElement("div"),h;e.onclick=Prototype.emptyFunction;var g=e.getAttribute("onclick");if(String(g).indexOf("{")>-1){h=function(f,k){k=f.getAttribute(k);if(!k){return null}k=k.toString();k=k.split("{")[1];k=k.split("}")[0];return k.strip()}}else{if(g===""){h=function(f,k){k=f.getAttribute(k);if(!k){return null}return k.strip()}}}e=null;return h})(),_flag:function(e,f){return $(e).hasAttribute(f)?f:null},style:function(e){return e.style.cssText.toLowerCase()},title:function(e){return e.title}}}}})();Element._attributeTranslations.write={names:Object.extend({cellpadding:"cellPadding",cellspacing:"cellSpacing"},Element._attributeTranslations.read.names),values:{checked:function(a,b){a.checked=!!b},style:function(a,b){a.style.cssText=b?b:""}}};Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder").each(function(a){Element._attributeTranslations.write.names[a.toLowerCase()]=a;Element._attributeTranslations.has[a.toLowerCase()]=a});(function(a){Object.extend(a,{href:a._getAttr2,src:a._getAttr2,type:a._getAttr,action:a._getAttrNode,disabled:a._flag,checked:a._flag,readonly:a._flag,multiple:a._flag,onload:a._getEv,onunload:a._getEv,onclick:a._getEv,ondblclick:a._getEv,onmousedown:a._getEv,onmouseup:a._getEv,onmouseover:a._getEv,onmousemove:a._getEv,onmouseout:a._getEv,onfocus:a._getEv,onblur:a._getEv,onkeypress:a._getEv,onkeydown:a._getEv,onkeyup:a._getEv,onsubmit:a._getEv,onreset:a._getEv,onselect:a._getEv,onchange:a._getEv})})(Element._attributeTranslations.read.values);if(Prototype.BrowserFeatures.ElementExtensions){(function(){function a(f){var b=f.getElementsByTagName("*"),e=[];for(var c=0,g;g=b[c];c++){if(g.tagName!=="!"){e.push(g)}}return e}Element.Methods.down=function(c,e,b){c=$(c);if(arguments.length==1){return c.firstDescendant()}return Object.isNumber(e)?a(c)[e]:Element.select(c,e)[b||0]}})()}}else{if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=(b==1)?0.999999:(b==="")?"":(b<0.00001)?0:b;return a}}else{if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=(b==1||b==="")?"":(b<0.00001)?0:b;if(b==1){if(a.tagName.toUpperCase()=="IMG"&&a.width){a.width++;a.width--}else{try{var f=document.createTextNode(" ");a.appendChild(f);a.removeChild(f)}catch(c){}}}return a}}}}}if("outerHTML" in document.documentElement){Element.Methods.replace=function(c,f){c=$(c);if(f&&f.toElement){f=f.toElement()}if(Object.isElement(f)){c.parentNode.replaceChild(f,c);return c}f=Object.toHTML(f);var e=c.parentNode,b=e.tagName.toUpperCase();if(Element._insertionTranslations.tags[b]){var g=c.next(),a=Element._getContentFromAnonymousElement(b,f.stripScripts());e.removeChild(c);if(g){a.each(function(h){e.insertBefore(h,g)})}else{a.each(function(h){e.appendChild(h)})}}else{c.outerHTML=f.stripScripts()}f.evalScripts.bind(f).defer();return c}}Element._returnOffset=function(b,c){var a=[b,c];a.left=b;a.top=c;return a};Element._getContentFromAnonymousElement=function(f,e,g){var h=new Element("div"),c=Element._insertionTranslations.tags[f];var a=false;if(c){a=true}else{if(g){a=true;c=["","",0]}}if(a){h.innerHTML="&nbsp;"+c[0]+e+c[1];h.removeChild(h.firstChild);for(var b=c[2];b--;){h=h.firstChild}}else{h.innerHTML=e}return $A(h.childNodes)};Element._insertionTranslations={before:function(a,b){a.parentNode.insertBefore(b,a)},top:function(a,b){a.insertBefore(b,a.firstChild)},bottom:function(a,b){a.appendChild(b)},after:function(a,b){a.parentNode.insertBefore(b,a.nextSibling)},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};(function(){var a=Element._insertionTranslations.tags;Object.extend(a,{THEAD:a.TBODY,TFOOT:a.TBODY,TH:a.TD})})();Element.Methods.Simulated={hasAttribute:function(a,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(h){if(typeof window.Element!="undefined"){var l=window.Element.prototype;if(l){var n="_"+(Math.random()+"").slice(2),k=document.createElement(h);l[n]="x";var m=(k[n]!=="x");delete l[n];k=null;return m}}return false}function b(k,h){for(var m in h){var l=h[m];if(Object.isFunction(l)&&!(m in k)){k[m]=l.methodize()}}}var e=c("object");if(Prototype.BrowserFeatures.SpecificElementExtensions){if(e){return function(k){if(k&&typeof k._extendedByPrototype=="undefined"){var h=k.tagName;if(h&&(/^(?:object|applet|embed)$/i.test(h))){b(k,Element.Methods);b(k,Element.Methods.Simulated);b(k,Element.Methods.ByTag[h.toUpperCase()])}}return k}}return Prototype.K}var a={},f=Element.Methods.ByTag;var g=Object.extend(function(l){if(!l||typeof l._extendedByPrototype!="undefined"||l.nodeType!=1||l==window){return l}var h=Object.clone(a),k=l.tagName.toUpperCase();if(f[k]){Object.extend(h,f[k])}b(l,h);l._extendedByPrototype=Prototype.emptyFunction;return l},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(a,Element.Methods);Object.extend(a,Element.Methods.Simulated)}}});g.refresh();return g})();if(document.documentElement.hasAttribute){Element.hasAttribute=function(a,b){return a.hasAttribute(b)}}else{Element.hasAttribute=Element.Methods.Simulated.hasAttribute}Element.addMethods=function(c){var l=Prototype.BrowserFeatures,e=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),BUTTON: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(h)}else{h(b)}}function h(n){n=n.toUpperCase();if(!Element.Methods.ByTag[n]){Element.Methods.ByTag[n]={}}Object.extend(Element.Methods.ByTag[n],c)}function a(p,o,n){n=n||false;for(var r in p){var q=p[r];if(!Object.isFunction(q)){continue}if(!n||!(r in o)){o[r]=q.methodize()}}}function f(q){var n;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]){n="HTML"+p[q]+"Element"}if(window[n]){return window[n]}n="HTML"+q+"Element";if(window[n]){return window[n]}n="HTML"+q.capitalize()+"Element";if(window[n]){return window[n]}var o=document.createElement(q),r=o.__proto__||o.constructor.prototype;o=null;return r}var k=window.HTMLElement?HTMLElement.prototype:Element.prototype;if(l.ElementExtensions){a(Element.Methods,k);a(Element.Methods.Simulated,k,true)}if(l.SpecificElementExtensions){for(var m in Element.Methods.ByTag){var g=f(m);if(Object.isUndefined(g)){continue}a(e[m],g.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh){Element.extend.refresh()}Element.cache={}};document.viewport={getDimensions:function(){return{width:this.getWidth(),height:this.getHeight()}},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};(function(b){var h=Prototype.Browser,f=document,c,e={};function a(){if(h.WebKit&&!f.evaluate){return document}if(h.Opera&&window.parseFloat(window.opera.version())<9.5){return document.body}return document.documentElement}function g(k){if(!c){c=a()}e[k]="client"+k;b["get"+k]=function(){return c[e[k]]};return b["get"+k]()}b.getWidth=g.curry("Width");b.getHeight=g.curry("Height")})(document.viewport);Element.Storage={UID:1};Element.addMethods({getStorage:function(b){if(!(b=$(b))){return}var a;if(b===window){a=0}else{if(typeof b._prototypeUID==="undefined"){b._prototypeUID=Element.Storage.UID++}a=b._prototypeUID}if(!Element.Storage[a]){Element.Storage[a]=$H()}return Element.Storage[a]},store:function(b,a,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 f=Element.getStorage(c),e=f.get(b);if(Object.isUndefined(e)){f.set(b,a);e=a}return e},clone:function(c,a){if(!(c=$(c))){return}var f=c.cloneNode(a);f._prototypeUID=void 0;if(a){var e=Element.select(f,"*"),b=e.length;while(b--){e[b]._prototypeUID=void 0}}return Element.extend(f)},purge:function(c){if(!(c=$(c))){return}var a=Element._purgeElement;a(c);var e=c.getElementsByTagName("*"),b=e.length;while(b--){a(e[b])}return null}});(function(){function k(z){var y=z.match(/^(\d+)%?$/i);if(!y){return null}return(Number(y[1])/100)}function r(J,K,z){var C=null;if(Object.isElement(J)){C=J;J=C.getStyle(K)}if(J===null){return null}if((/^(?:-)?\d+(\.\d+)?(px)?$/i).test(J)){return window.parseFloat(J)}var E=J.include("%"),A=(z===document.viewport);if(/\d/.test(J)&&C&&C.runtimeStyle&&!(E&&A)){var y=C.style.left,I=C.runtimeStyle.left;C.runtimeStyle.left=C.currentStyle.left;C.style.left=J||0;J=C.style.pixelLeft;C.style.left=y;C.runtimeStyle.left=I;return J}if(C&&E){z=z||C.parentNode;var B=k(J);var F=null;var D=C.getStyle("position");var H=K.include("left")||K.include("right")||K.include("width");var G=K.include("top")||K.include("bottom")||K.include("height");if(z===document.viewport){if(H){F=document.viewport.getWidth()}else{if(G){F=document.viewport.getHeight()}}}else{if(H){F=$(z).measure("width")}else{if(G){F=$(z).measure("height")}}}return(F===null)?0:F*B}return 0}function h(y){if(Object.isString(y)&&y.endsWith("px")){return y}return y+"px"}function m(z){var y=z;while(z&&z.parentNode){var A=z.getStyle("display");if(A==="none"){return false}z=$(z.parentNode)}return true}var e=Prototype.K;if("currentStyle" in document.documentElement){e=function(y){if(!y.currentStyle.hasLayout){y.style.zoom=1}return y}}function g(y){if(y.include("border")){y=y+"-width"}return y.camelize()}Element.Layout=Class.create(Hash,{initialize:function($super,z,y){$super();this.element=$(z);Element.Layout.PROPERTIES.each(function(A){this._set(A,null)},this);if(y){this._preComputing=true;this._begin();Element.Layout.PROPERTIES.each(this._compute,this);this._end();this._preComputing=false}},_set:function(z,y){return Hash.prototype.set.call(this,z,y)},set:function(z,y){throw"Properties of Element.Layout are read-only."},get:function($super,z){var y=$super(z);return y===null?this._compute(z):y},_begin:function(){if(this._prepared){return}var C=this.element;if(m(C)){this._prepared=true;return}var E={position:C.style.position||"",width:C.style.width||"",visibility:C.style.visibility||"",display:C.style.display||""};C.store("prototype_original_styles",E);var F=C.getStyle("position"),y=C.getStyle("width");if(y==="0px"||y===null){C.style.display="block";y=C.getStyle("width")}var z=(F==="fixed")?document.viewport:C.parentNode;C.setStyle({position:"absolute",visibility:"hidden",display:"block"});var A=C.getStyle("width");var B;if(y&&(A===y)){B=r(C,"width",z)}else{if(F==="absolute"||F==="fixed"){B=r(C,"width",z)}else{var G=C.parentNode,D=$(G).getLayout();B=D.get("width")-this.get("margin-left")-this.get("border-left")-this.get("padding-left")-this.get("padding-right")-this.get("border-right")-this.get("margin-right")}}C.setStyle({width:B+"px"});this._prepared=true},_end:function(){var z=this.element;var y=z.retrieve("prototype_original_styles");z.store("prototype_original_styles",null);z.setStyle(y);this._prepared=false},_compute:function(z){var y=Element.Layout.COMPUTATIONS;if(!(z in y)){throw"Property not found."}return this._set(z,y[z].call(this,this.element))},toObject:function(){var y=$A(arguments);var z=(y.length===0)?Element.Layout.PROPERTIES:y.join(" ").split(" ");var A={};z.each(function(B){if(!Element.Layout.PROPERTIES.include(B)){return}var C=this.get(B);if(C!=null){A[B]=C}},this);return A},toHash:function(){var y=this.toObject.apply(this,arguments);return new Hash(y)},toCSS:function(){var y=$A(arguments);var A=(y.length===0)?Element.Layout.PROPERTIES:y.join(" ").split(" ");var z={};A.each(function(B){if(!Element.Layout.PROPERTIES.include(B)){return}if(Element.Layout.COMPOSITE_PROPERTIES.include(B)){return}var C=this.get(B);if(C!=null){z[g(B)]=C+"px"}},this);return z},inspect:function(){return"#<Element.Layout>"}});Object.extend(Element.Layout,{PROPERTIES:$w("height width top left right bottom border-left border-right border-top border-bottom padding-left padding-right padding-top padding-bottom margin-top margin-bottom margin-left margin-right padding-box-width padding-box-height border-box-width border-box-height margin-box-width margin-box-height"),COMPOSITE_PROPERTIES:$w("padding-box-width padding-box-height margin-box-width margin-box-height border-box-width border-box-height"),COMPUTATIONS:{height:function(A){if(!this._preComputing){this._begin()}var y=this.get("border-box-height");if(y<=0){if(!this._preComputing){this._end()}return 0}var B=this.get("border-top"),z=this.get("border-bottom");var D=this.get("padding-top"),C=this.get("padding-bottom");if(!this._preComputing){this._end()}return y-B-z-D-C},width:function(A){if(!this._preComputing){this._begin()}var z=this.get("border-box-width");if(z<=0){if(!this._preComputing){this._end()}return 0}var D=this.get("border-left"),y=this.get("border-right");var B=this.get("padding-left"),C=this.get("padding-right");if(!this._preComputing){this._end()}return z-D-y-B-C},"padding-box-height":function(z){var y=this.get("height"),B=this.get("padding-top"),A=this.get("padding-bottom");return y+B+A},"padding-box-width":function(y){var z=this.get("width"),A=this.get("padding-left"),B=this.get("padding-right");return z+A+B},"border-box-height":function(z){if(!this._preComputing){this._begin()}var y=z.offsetHeight;if(!this._preComputing){this._end()}return y},"border-box-width":function(y){if(!this._preComputing){this._begin()}var z=y.offsetWidth;if(!this._preComputing){this._end()}return z},"margin-box-height":function(z){var y=this.get("border-box-height"),A=this.get("margin-top"),B=this.get("margin-bottom");if(y<=0){return 0}return y+A+B},"margin-box-width":function(A){var z=this.get("border-box-width"),B=this.get("margin-left"),y=this.get("margin-right");if(z<=0){return 0}return z+B+y},top:function(y){var z=y.positionedOffset();return z.top},bottom:function(y){var B=y.positionedOffset(),z=y.getOffsetParent(),A=z.measure("height");var C=this.get("border-box-height");return A-C-B.top},left:function(y){var z=y.positionedOffset();return z.left},right:function(A){var C=A.positionedOffset(),B=A.getOffsetParent(),y=B.measure("width");var z=this.get("border-box-width");return y-z-C.left},"padding-top":function(y){return r(y,"paddingTop")},"padding-bottom":function(y){return r(y,"paddingBottom")},"padding-left":function(y){return r(y,"paddingLeft")},"padding-right":function(y){return r(y,"paddingRight")},"border-top":function(y){return r(y,"borderTopWidth")},"border-bottom":function(y){return r(y,"borderBottomWidth")},"border-left":function(y){return r(y,"borderLeftWidth")},"border-right":function(y){return r(y,"borderRightWidth")},"margin-top":function(y){return r(y,"marginTop")},"margin-bottom":function(y){return r(y,"marginBottom")},"margin-left":function(y){return r(y,"marginLeft")},"margin-right":function(y){return r(y,"marginRight")}}});if("getBoundingClientRect" in document.documentElement){Object.extend(Element.Layout.COMPUTATIONS,{right:function(z){var A=e(z.getOffsetParent());var B=z.getBoundingClientRect(),y=A.getBoundingClientRect();return(y.right-B.right).round()},bottom:function(z){var A=e(z.getOffsetParent());var B=z.getBoundingClientRect(),y=A.getBoundingClientRect();return(y.bottom-B.bottom).round()}})}Element.Offset=Class.create({initialize:function(z,y){this.left=z.round();this.top=y.round();this[0]=this.left;this[1]=this.top},relativeTo:function(y){return new Element.Offset(this.left-y.left,this.top-y.top)},inspect:function(){return"#<Element.Offset left: #{left} top: #{top}>".interpolate(this)},toString:function(){return"[#{left}, #{top}]".interpolate(this)},toArray:function(){return[this.left,this.top]}});function u(z,y){return new Element.Layout(z,y)}function b(y,z){return $(y).getLayout().get(z)}function q(z){z=$(z);var D=Element.getStyle(z,"display");if(D&&D!=="none"){return{width:z.offsetWidth,height:z.offsetHeight}}var A=z.style;var y={visibility:A.visibility,position:A.position,display:A.display};var C={visibility:"hidden",display:"block"};if(y.position!=="fixed"){C.position="absolute"}Element.setStyle(z,C);var B={width:z.offsetWidth,height:z.offsetHeight};Element.setStyle(z,y);return B}function o(y){y=$(y);if(f(y)||c(y)||p(y)||n(y)){return $(document.body)}var z=(Element.getStyle(y,"display")==="inline");if(!z&&y.offsetParent){return $(y.offsetParent)}while((y=y.parentNode)&&y!==document.body){if(Element.getStyle(y,"position")!=="static"){return n(y)?$(document.body):$(y)}}return $(document.body)}function w(z){z=$(z);var y=0,A=0;if(z.parentNode){do{y+=z.offsetTop||0;A+=z.offsetLeft||0;z=z.offsetParent}while(z)}return new Element.Offset(A,y)}function s(z){z=$(z);var A=z.getLayout();var y=0,C=0;do{y+=z.offsetTop||0;C+=z.offsetLeft||0;z=z.offsetParent;if(z){if(p(z)){break}var B=Element.getStyle(z,"position");if(B!=="static"){break}}}while(z);C-=A.get("margin-top");y-=A.get("margin-left");return new Element.Offset(C,y)}function a(z){var y=0,A=0;do{y+=z.scrollTop||0;A+=z.scrollLeft||0;z=z.parentNode}while(z);return new Element.Offset(A,y)}function v(C){z=$(z);var y=0,B=0,A=document.body;var z=C;do{y+=z.offsetTop||0;B+=z.offsetLeft||0;if(z.offsetParent==A&&Element.getStyle(z,"position")=="absolute"){break}}while(z=z.offsetParent);z=C;do{if(z!=A){y-=z.scrollTop||0;B-=z.scrollLeft||0}}while(z=z.parentNode);return new Element.Offset(B,y)}function t(y){y=$(y);if(Element.getStyle(y,"position")==="absolute"){return y}var C=o(y);var B=y.viewportOffset(),z=C.viewportOffset();var D=B.relativeTo(z);var A=y.getLayout();y.store("prototype_absolutize_original_styles",{left:y.getStyle("left"),top:y.getStyle("top"),width:y.getStyle("width"),height:y.getStyle("height")});y.setStyle({position:"absolute",top:D.top+"px",left:D.left+"px",width:A.get("width")+"px",height:A.get("height")+"px"});return y}function l(z){z=$(z);if(Element.getStyle(z,"position")==="relative"){return z}var y=z.retrieve("prototype_absolutize_original_styles");if(y){z.setStyle(y)}return z}if(Prototype.Browser.IE){o=o.wrap(function(A,z){z=$(z);if(f(z)||c(z)||p(z)||n(z)){return $(document.body)}var y=z.getStyle("position");if(y!=="static"){return A(z)}z.setStyle({position:"relative"});var B=A(z);z.setStyle({position:y});return B});s=s.wrap(function(B,z){z=$(z);if(!z.parentNode){return new Element.Offset(0,0)}var y=z.getStyle("position");if(y!=="static"){return B(z)}var A=z.getOffsetParent();if(A&&A.getStyle("position")==="fixed"){e(A)}z.setStyle({position:"relative"});var C=B(z);z.setStyle({position:y});return C})}else{if(Prototype.Browser.Webkit){w=function(z){z=$(z);var y=0,A=0;do{y+=z.offsetTop||0;A+=z.offsetLeft||0;if(z.offsetParent==document.body){if(Element.getStyle(z,"position")=="absolute"){break}}z=z.offsetParent}while(z);return new Element.Offset(A,y)}}}Element.addMethods({getLayout:u,measure:b,getDimensions:q,getOffsetParent:o,cumulativeOffset:w,positionedOffset:s,cumulativeScrollOffset:a,viewportOffset:v,absolutize:t,relativize:l});function p(y){return y.nodeName.toUpperCase()==="BODY"}function n(y){return y.nodeName.toUpperCase()==="HTML"}function f(y){return y.nodeType===Node.DOCUMENT_NODE}function c(y){return y!==document.body&&!Element.descendantOf(y,document.body)}if("getBoundingClientRect" in document.documentElement){Element.addMethods({viewportOffset:function(y){y=$(y);if(c(y)){return new Element.Offset(0,0)}var z=y.getBoundingClientRect(),A=document.documentElement;return new Element.Offset(z.left-A.clientLeft,z.top-A.clientTop)}})}})();window.$$=function(){var a=$A(arguments).join(", ");return Prototype.Selector.select(a,document)};Prototype.Selector=(function(){function a(){throw new Error('Method "Prototype.Selector.select" must be defined.')}function c(){throw new Error('Method "Prototype.Selector.match" must be defined.')}function e(n,o,k){k=k||0;var h=Prototype.Selector.match,m=n.length,g=0,l;for(l=0;l<m;l++){if(h(n[l],o)&&k==g++){return Element.extend(n[l])}}}function f(k){for(var g=0,h=k.length;g<h;g++){Element.extend(k[g])}return k}var b=Prototype.K;return{select:a,match:c,find:e,extendElements:(Element.extend===b)?b:f,extendElement:Element.extend}})();Prototype._original_property=window.Sizzle;
/*
 * Sizzle CSS Selector Engine - v1.0
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
(function(){var t=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,m=0,f=Object.prototype.toString,r=false,l=true;[0,0].sort(function(){l=false;return 0});var b=function(I,y,F,A){F=F||[];var e=y=y||document;if(y.nodeType!==1&&y.nodeType!==9){return[]}if(!I||typeof I!=="string"){return F}var G=[],H,D,M,L,E,w,v=true,B=s(y),K=I;while((t.exec(""),H=t.exec(K))!==null){K=H[3];G.push(H[1]);if(H[2]){w=H[3];break}}if(G.length>1&&n.exec(I)){if(G.length===2&&g.relative[G[0]]){D=h(G[0]+G[1],y)}else{D=g.relative[G[0]]?[y]:b(G.shift(),y);while(G.length){I=G.shift();if(g.relative[I]){I+=G.shift()}D=h(I,D)}}}else{if(!A&&G.length>1&&y.nodeType===9&&!B&&g.match.ID.test(G[0])&&!g.match.ID.test(G[G.length-1])){var N=b.find(G.shift(),y,B);y=N.expr?b.filter(N.expr,N.set)[0]:N.set[0]}if(y){var N=A?{expr:G.pop(),set:a(A)}:b.find(G.pop(),G.length===1&&(G[0]==="~"||G[0]==="+")&&y.parentNode?y.parentNode:y,B);D=N.expr?b.filter(N.expr,N.set):N.set;if(G.length>0){M=a(D)}else{v=false}while(G.length){var z=G.pop(),C=z;if(!g.relative[z]){z=""}else{C=G.pop()}if(C==null){C=y}g.relative[z](M,C,B)}}else{M=G=[]}}if(!M){M=D}if(!M){throw"Syntax error, unrecognized expression: "+(z||I)}if(f.call(M)==="[object Array]"){if(!v){F.push.apply(F,M)}else{if(y&&y.nodeType===1){for(var J=0;M[J]!=null;J++){if(M[J]&&(M[J]===true||M[J].nodeType===1&&k(y,M[J]))){F.push(D[J])}}}else{for(var J=0;M[J]!=null;J++){if(M[J]&&M[J].nodeType===1){F.push(D[J])}}}}}else{a(M,F)}if(w){b(w,e,F,A);b.uniqueSort(F)}return F};b.uniqueSort=function(v){if(c){r=l;v.sort(c);if(r){for(var e=1;e<v.length;e++){if(v[e]===v[e-1]){v.splice(e--,1)}}}}return v};b.matches=function(e,v){return b(e,null,null,v)};b.find=function(C,e,D){var B,z;if(!C){return[]}for(var y=0,w=g.order.length;y<w;y++){var A=g.order[y],z;if((z=g.leftMatch[A].exec(C))){var v=z[1];z.splice(1,1);if(v.substr(v.length-1)!=="\\"){z[1]=(z[1]||"").replace(/\\/g,"");B=g.find[A](z,e,D);if(B!=null){C=C.replace(g.match[A],"");break}}}}if(!B){B=e.getElementsByTagName("*")}return{set:B,expr:C}};b.filter=function(F,E,I,y){var w=F,K=[],C=E,A,e,B=E&&E[0]&&s(E[0]);while(F&&E.length){for(var D in g.filter){if((A=g.match[D].exec(F))!=null){var v=g.filter[D],J,H;e=false;if(C==K){K=[]}if(g.preFilter[D]){A=g.preFilter[D](A,C,I,K,y,B);if(!A){e=J=true}else{if(A===true){continue}}}if(A){for(var z=0;(H=C[z])!=null;z++){if(H){J=v(H,A,z,C);var G=y^!!J;if(I&&J!=null){if(G){e=true}else{C[z]=false}}else{if(G){K.push(H);e=true}}}}}if(J!==undefined){if(!I){C=K}F=F.replace(g.match[D],"");if(!e){return[]}break}}}if(F==w){if(e==null){throw"Syntax error, unrecognized expression: "+F}else{break}}w=F}return C};var g=b.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")}},relative:{"+":function(C,e,B){var z=typeof e==="string",D=z&&!/\W/.test(e),A=z&&!D;if(D&&!B){e=e.toUpperCase()}for(var y=0,w=C.length,v;y<w;y++){if((v=C[y])){while((v=v.previousSibling)&&v.nodeType!==1){}C[y]=A||v&&v.nodeName===e?v||false:v===e}}if(A){b.filter(e,C,true)}},">":function(B,v,C){var z=typeof v==="string";if(z&&!/\W/.test(v)){v=C?v:v.toUpperCase();for(var w=0,e=B.length;w<e;w++){var A=B[w];if(A){var y=A.parentNode;B[w]=y.nodeName===v?y:false}}}else{for(var w=0,e=B.length;w<e;w++){var A=B[w];if(A){B[w]=z?A.parentNode:A.parentNode===v}}if(z){b.filter(v,B,true)}}},"":function(y,v,A){var w=m++,e=u;if(!/\W/.test(v)){var z=v=A?v:v.toUpperCase();e=q}e("parentNode",v,w,y,z,A)},"~":function(y,v,A){var w=m++,e=u;if(typeof v==="string"&&!/\W/.test(v)){var z=v=A?v:v.toUpperCase();e=q}e("previousSibling",v,w,y,z,A)}},find:{ID:function(v,w,y){if(typeof w.getElementById!=="undefined"&&!y){var e=w.getElementById(v[1]);return e?[e]:[]}},NAME:function(w,A,B){if(typeof A.getElementsByName!=="undefined"){var v=[],z=A.getElementsByName(w[1]);for(var y=0,e=z.length;y<e;y++){if(z[y].getAttribute("name")===w[1]){v.push(z[y])}}return v.length===0?null:v}},TAG:function(e,v){return v.getElementsByTagName(e[1])}},preFilter:{CLASS:function(y,v,w,e,B,C){y=" "+y[1].replace(/\\/g,"")+" ";if(C){return y}for(var z=0,A;(A=v[z])!=null;z++){if(A){if(B^(A.className&&(" "+A.className+" ").indexOf(y)>=0)){if(!w){e.push(A)}}else{if(w){v[z]=false}}}}return false},ID:function(e){return e[1].replace(/\\/g,"")},TAG:function(v,e){for(var w=0;e[w]===false;w++){}return e[w]&&s(e[w])?v[1]:v[1].toUpperCase()},CHILD:function(e){if(e[1]=="nth"){var v=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(e[2]=="even"&&"2n"||e[2]=="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(v[1]+(v[2]||1))-0;e[3]=v[3]-0}e[0]=m++;return e},ATTR:function(z,v,w,e,A,B){var y=z[1].replace(/\\/g,"");if(!B&&g.attrMap[y]){z[1]=g.attrMap[y]}if(z[2]==="~="){z[4]=" "+z[4]+" "}return z},PSEUDO:function(z,v,w,e,A){if(z[1]==="not"){if((t.exec(z[3])||"").length>1||/^\w/.test(z[3])){z[3]=b(z[3],null,null,v)}else{var y=b.filter(z[3],v,w,true^A);if(!w){e.push.apply(e,y)}return false}}else{if(g.match.POS.test(z[0])||g.match.CHILD.test(z[0])){return true}}return z},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){e.parentNode.selectedIndex;return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(w,v,e){return !!b(e[3],w).length},header:function(e){return/h\d/i.test(e.nodeName)},text:function(e){return"text"===e.type},radio:function(e){return"radio"===e.type},checkbox:function(e){return"checkbox"===e.type},file:function(e){return"file"===e.type},password:function(e){return"password"===e.type},submit:function(e){return"submit"===e.type},image:function(e){return"image"===e.type},reset:function(e){return"reset"===e.type},button:function(e){return"button"===e.type||e.nodeName.toUpperCase()==="BUTTON"},input:function(e){return/input|select|textarea|button/i.test(e.nodeName)}},setFilters:{first:function(v,e){return e===0},last:function(w,v,e,y){return v===y.length-1},even:function(v,e){return e%2===0},odd:function(v,e){return e%2===1},lt:function(w,v,e){return v<e[3]-0},gt:function(w,v,e){return v>e[3]-0},nth:function(w,v,e){return e[3]-0==v},eq:function(w,v,e){return e[3]-0==v}},filter:{PSEUDO:function(B,w,y,C){var v=w[1],z=g.filters[v];if(z){return z(B,y,w,C)}else{if(v==="contains"){return(B.textContent||B.innerText||"").indexOf(w[3])>=0}else{if(v==="not"){var A=w[3];for(var y=0,e=A.length;y<e;y++){if(A[y]===B){return false}}return true}}}},CHILD:function(e,y){var B=y[1],v=e;switch(B){case"only":case"first":while((v=v.previousSibling)){if(v.nodeType===1){return false}}if(B=="first"){return true}v=e;case"last":while((v=v.nextSibling)){if(v.nodeType===1){return false}}return true;case"nth":var w=y[2],E=y[3];if(w==1&&E==0){return true}var A=y[0],D=e.parentNode;if(D&&(D.sizcache!==A||!e.nodeIndex)){var z=0;for(v=D.firstChild;v;v=v.nextSibling){if(v.nodeType===1){v.nodeIndex=++z}}D.sizcache=A}var C=e.nodeIndex-E;if(w==0){return C==0}else{return(C%w==0&&C/w>=0)}}},ID:function(v,e){return v.nodeType===1&&v.getAttribute("id")===e},TAG:function(v,e){return(e==="*"&&v.nodeType===1)||v.nodeName===e},CLASS:function(v,e){return(" "+(v.className||v.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(A,y){var w=y[1],e=g.attrHandle[w]?g.attrHandle[w](A):A[w]!=null?A[w]:A.getAttribute(w),B=e+"",z=y[2],v=y[4];return e==null?z==="!=":z==="="?B===v:z==="*="?B.indexOf(v)>=0:z==="~="?(" "+B+" ").indexOf(v)>=0:!v?B&&e!==false:z==="!="?B!=v:z==="^="?B.indexOf(v)===0:z==="$="?B.substr(B.length-v.length)===v:z==="|="?B===v||B.substr(0,v.length+1)===v+"-":false},POS:function(z,v,w,A){var e=v[2],y=g.setFilters[e];if(y){return y(z,w,v,A)}}}};var n=g.match.POS;for(var p in g.match){g.match[p]=new RegExp(g.match[p].source+/(?![^\[]*\])(?![^\(]*\))/.source);g.leftMatch[p]=new RegExp(/(^(?:.|\r|\n)*?)/.source+g.match[p].source)}var a=function(v,e){v=Array.prototype.slice.call(v,0);if(e){e.push.apply(e,v);return e}return v};try{Array.prototype.slice.call(document.documentElement.childNodes,0)}catch(o){a=function(z,y){var v=y||[];if(f.call(z)==="[object Array]"){Array.prototype.push.apply(v,z)}else{if(typeof z.length==="number"){for(var w=0,e=z.length;w<e;w++){v.push(z[w])}}else{for(var w=0;z[w];w++){v.push(z[w])}}}return v}}var c;if(document.documentElement.compareDocumentPosition){c=function(v,e){if(!v.compareDocumentPosition||!e.compareDocumentPosition){if(v==e){r=true}return 0}var w=v.compareDocumentPosition(e)&4?-1:v===e?0:1;if(w===0){r=true}return w}}else{if("sourceIndex" in document.documentElement){c=function(v,e){if(!v.sourceIndex||!e.sourceIndex){if(v==e){r=true}return 0}var w=v.sourceIndex-e.sourceIndex;if(w===0){r=true}return w}}else{if(document.createRange){c=function(y,v){if(!y.ownerDocument||!v.ownerDocument){if(y==v){r=true}return 0}var w=y.ownerDocument.createRange(),e=v.ownerDocument.createRange();w.setStart(y,0);w.setEnd(y,0);e.setStart(v,0);e.setEnd(v,0);var z=w.compareBoundaryPoints(Range.START_TO_END,e);if(z===0){r=true}return z}}}}(function(){var v=document.createElement("div"),w="script"+(new Date).getTime();v.innerHTML="<a name='"+w+"'/>";var e=document.documentElement;e.insertBefore(v,e.firstChild);if(!!document.getElementById(w)){g.find.ID=function(z,A,B){if(typeof A.getElementById!=="undefined"&&!B){var y=A.getElementById(z[1]);return y?y.id===z[1]||typeof y.getAttributeNode!=="undefined"&&y.getAttributeNode("id").nodeValue===z[1]?[y]:undefined:[]}};g.filter.ID=function(A,y){var z=typeof A.getAttributeNode!=="undefined"&&A.getAttributeNode("id");return A.nodeType===1&&z&&z.nodeValue===y}}e.removeChild(v);e=v=null})();(function(){var e=document.createElement("div");e.appendChild(document.createComment(""));if(e.getElementsByTagName("*").length>0){g.find.TAG=function(v,A){var z=A.getElementsByTagName(v[1]);if(v[1]==="*"){var y=[];for(var w=0;z[w];w++){if(z[w].nodeType===1){y.push(z[w])}}z=y}return z}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){g.attrHandle.href=function(v){return v.getAttribute("href",2)}}e=null})();if(document.querySelectorAll){(function(){var e=b,w=document.createElement("div");w.innerHTML="<p class='TEST'></p>";if(w.querySelectorAll&&w.querySelectorAll(".TEST").length===0){return}b=function(B,A,y,z){A=A||document;if(!z&&A.nodeType===9&&!s(A)){try{return a(A.querySelectorAll(B),y)}catch(C){}}return e(B,A,y,z)};for(var v in e){b[v]=e[v]}w=null})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var e=document.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}g.order.splice(1,0,"CLASS");g.find.CLASS=function(v,w,y){if(typeof w.getElementsByClassName!=="undefined"&&!y){return w.getElementsByClassName(v[1])}};e=null})()}function q(v,B,A,F,C,E){var D=v=="previousSibling"&&!E;for(var y=0,w=F.length;y<w;y++){var e=F[y];if(e){if(D&&e.nodeType===1){e.sizcache=A;e.sizset=y}e=e[v];var z=false;while(e){if(e.sizcache===A){z=F[e.sizset];break}if(e.nodeType===1&&!E){e.sizcache=A;e.sizset=y}if(e.nodeName===B){z=e;break}e=e[v]}F[y]=z}}}function u(v,B,A,F,C,E){var D=v=="previousSibling"&&!E;for(var y=0,w=F.length;y<w;y++){var e=F[y];if(e){if(D&&e.nodeType===1){e.sizcache=A;e.sizset=y}e=e[v];var z=false;while(e){if(e.sizcache===A){z=F[e.sizset];break}if(e.nodeType===1){if(!E){e.sizcache=A;e.sizset=y}if(typeof B!=="string"){if(e===B){z=true;break}}else{if(b.filter(B,[e]).length>0){z=e;break}}}e=e[v]}F[y]=z}}}var k=document.compareDocumentPosition?function(v,e){return v.compareDocumentPosition(e)&16}:function(v,e){return v!==e&&(v.contains?v.contains(e):true)};var s=function(e){return e.nodeType===9&&e.documentElement.nodeName!=="HTML"||!!e.ownerDocument&&e.ownerDocument.documentElement.nodeName!=="HTML"};var h=function(e,C){var y=[],z="",A,w=C.nodeType?[C]:C;while((A=g.match.PSEUDO.exec(e))){z+=A[0];e=e.replace(g.match.PSEUDO,"")}e=g.relative[e]?e+"*":e;for(var B=0,v=w.length;B<v;B++){b(e,w[B],y)}return b.filter(z,y)};window.Sizzle=b})();(function(c){var e=Prototype.Selector.extendElements;function a(f,g){return e(c(f,g||document))}function b(g,f){return c.matches(f,[g]).length==1}Prototype.Selector.engine=c;Prototype.Selector.select=a;Prototype.Selector.match=b})(Sizzle);window.Sizzle=Prototype._original_property;delete Prototype._original_property;var Form={reset:function(a){a=$(a);a.reset();return a},serializeElements:function(k,e){if(typeof e!="object"){e={hash:!!e}}else{if(Object.isUndefined(e.hash)){e.hash=true}}var f,h,a=false,g=e.submit,b,c;if(e.hash){c={};b=function(l,m,n){if(m in l){if(!Object.isArray(l[m])){l[m]=[l[m]]}l[m].push(n)}else{l[m]=n}return l}}else{c="";b=function(l,m,n){return l+(l?"&":"")+encodeURIComponent(m)+"="+encodeURIComponent(n)}}return k.inject(c,function(l,m){if(!m.disabled&&m.name){f=m.name;h=$(m).getValue();if(h!=null&&m.type!="file"&&(m.type!="submit"||(!a&&g!==false&&(!g||f==g)&&(a=true)))){l=b(l,f,h)}}return l})}};Form.Methods={serialize:function(b,a){return Form.serializeElements(Form.getElements(b),a)},getElements:function(f){var g=$(f).getElementsByTagName("*"),e,a=[],c=Form.Element.Serializers;for(var b=0;e=g[b];b++){a.push(e)}return a.inject([],function(h,k){if(c[k.tagName.toLowerCase()]){h.push(Element.extend(k))}return h})},getInputs:function(h,c,e){h=$(h);var a=h.getElementsByTagName("input");if(!c&&!e){return $A(a).map(Element.extend)}for(var f=0,k=[],g=a.length;f<g;f++){var b=a[f];if((c&&b.type!=c)||(e&&b.name!=e)){continue}k.push(Element.extend(b))}return k},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(e){return"hidden"!=e.type&&!e.disabled});var a=c.findAll(function(e){return e.hasAttribute("tabIndex")&&e.tabIndex>=0}).sortBy(function(e){return e.tabIndex}).first();return a?a:c.find(function(e){return/^(?:input|select|textarea)$/i.test(e.tagName)})},focusFirstElement:function(b){b=$(b);var a=b.findFirstElement();if(a){a.activate()}return b},request:function(b,a){b=$(b),a=Object.clone(a||{});var e=a.parameters,c=b.readAttribute("action")||"";if(c.blank()){c=window.location.href}a.parameters=b.serialize(true);if(e){if(Object.isString(e)){e=e.toQueryParams()}Object.extend(a.parameters,e)}if(b.hasAttribute("method")&&!a.method){a.method=b.method}return new Ajax.Request(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=(function(){function b(k,l){switch(k.type.toLowerCase()){case"checkbox":case"radio":return g(k,l);default:return f(k,l)}}function g(k,l){if(Object.isUndefined(l)){return k.checked?k.value:null}else{k.checked=!!l}}function f(k,l){if(Object.isUndefined(l)){return k.value}else{k.value=l}}function a(m,p){if(Object.isUndefined(p)){return(m.type==="select-one"?c:e)(m)}var l,n,q=!Object.isArray(p);for(var k=0,o=m.length;k<o;k++){l=m.options[k];n=this.optionValue(l);if(q){if(n==p){l.selected=true;return}}else{l.selected=p.include(n)}}}function c(l){var k=l.selectedIndex;return k>=0?h(l.options[k]):null}function e(n){var k,o=n.length;if(!o){return null}for(var m=0,k=[];m<o;m++){var l=n.options[m];if(l.selected){k.push(h(l))}}return k}function h(k){return Element.hasAttribute(k,"value")?k.value:k.text}return{input:b,inputSelector:g,textarea:f,select:a,selectOne:c,selectMany:e,optionValue:h,button:f}})();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 G={KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,cache:{}};var g=document.documentElement;var H="onmouseenter" in g&&"onmouseleave" in g;var a=function(I){return false};if(window.attachEvent){if(window.addEventListener){a=function(I){return !(I instanceof window.Event)}}else{a=function(I){return true}}}var u;function E(J,I){return J.which?(J.which===I+1):(J.button===I)}var r={0:1,1:4,2:2};function C(J,I){return J.button===r[I]}function F(J,I){switch(I){case 0:return J.which==1&&!J.metaKey;case 1:return J.which==2||(J.which==1&&J.metaKey);case 2:return J.which==3;default:return false}}if(window.attachEvent){if(!window.addEventListener){u=C}else{u=function(J,I){return a(J)?C(J,I):E(J,I)}}}else{if(Prototype.Browser.WebKit){u=F}else{u=E}}function z(I){return u(I,0)}function w(I){return u(I,1)}function q(I){return u(I,2)}function e(K){K=G.extend(K);var J=K.target,I=K.type,L=K.currentTarget;if(L&&L.tagName){if(I==="load"||I==="error"||(I==="click"&&L.tagName.toLowerCase()==="input"&&L.type==="radio")){J=L}}if(J.nodeType==Node.TEXT_NODE){J=J.parentNode}return Element.extend(J)}function s(J,K){var I=G.element(J);if(!K){return I}while(I){if(Object.isElement(I)&&Prototype.Selector.match(I,K)){return Element.extend(I)}I=I.parentNode}}function v(I){return{x:c(I),y:b(I)}}function c(K){var J=document.documentElement,I=document.body||{scrollLeft:0};return K.pageX||(K.clientX+(J.scrollLeft||I.scrollLeft)-(J.clientLeft||0))}function b(K){var J=document.documentElement,I=document.body||{scrollTop:0};return K.pageY||(K.clientY+(J.scrollTop||I.scrollTop)-(J.clientTop||0))}function t(I){G.extend(I);I.preventDefault();I.stopPropagation();I.stopped=true}G.Methods={isLeftClick:z,isMiddleClick:w,isRightClick:q,element:e,findElement:s,pointer:v,pointerX:c,pointerY:b,stop:t};var B=Object.keys(G.Methods).inject({},function(I,J){I[J]=G.Methods[J].methodize();return I});if(window.attachEvent){function l(J){var I;switch(J.type){case"mouseover":case"mouseenter":I=J.fromElement;break;case"mouseout":case"mouseleave":I=J.toElement;break;default:return null}return Element.extend(I)}var y={stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}};G.extend=function(J,I){if(!J){return false}if(!a(J)){return J}if(J._extendedByPrototype){return J}J._extendedByPrototype=Prototype.emptyFunction;var K=G.pointer(J);Object.extend(J,{target:J.srcElement||I,relatedTarget:l(J),pageX:K.x,pageY:K.y});Object.extend(J,B);Object.extend(J,y);return J}}else{G.extend=Prototype.K}if(window.addEventListener){G.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(G.prototype,B)}function p(M,L,N){var K=Element.retrieve(M,"prototype_event_registry");if(Object.isUndefined(K)){f.push(M);K=Element.retrieve(M,"prototype_event_registry",$H())}var I=K.get(L);if(Object.isUndefined(I)){I=[];K.set(L,I)}if(I.pluck("handler").include(N)){return false}var J;if(L.include(":")){J=function(O){if(Object.isUndefined(O.eventName)){return false}if(O.eventName!==L){return false}G.extend(O,M);N.call(M,O)}}else{if(!H&&(L==="mouseenter"||L==="mouseleave")){if(L==="mouseenter"||L==="mouseleave"){J=function(P){G.extend(P,M);var O=P.relatedTarget;while(O&&O!==M){try{O=O.parentNode}catch(Q){O=M}}if(O===M){return}N.call(M,P)}}}else{J=function(O){G.extend(O,M);N.call(M,O)}}}J.handler=N;I.push(J);return J}function k(){for(var I=0,J=f.length;I<J;I++){G.stopObserving(f[I]);f[I]=null}}var f=[];if(Prototype.Browser.IE){window.attachEvent("onunload",k)}if(Prototype.Browser.WebKit){window.addEventListener("unload",Prototype.emptyFunction,false)}var o=Prototype.K,h={mouseenter:"mouseover",mouseleave:"mouseout"};if(!H){o=function(I){return(h[I]||I)}}function A(L,K,M){L=$(L);var J=p(L,K,M);if(!J){return L}if(K.include(":")){if(L.addEventListener){L.addEventListener("dataavailable",J,false)}else{L.attachEvent("ondataavailable",J);L.attachEvent("onlosecapture",J)}}else{var I=o(K);if(L.addEventListener){L.addEventListener(I,J,false)}else{L.attachEvent("on"+I,J)}}return L}function n(O,L,P){O=$(O);var K=Element.retrieve(O,"prototype_event_registry");if(!K){return O}if(!L){K.each(function(R){var Q=R.key;n(O,Q)});return O}var M=K.get(L);if(!M){return O}if(!P){M.each(function(Q){n(O,L,Q.handler)});return O}var N=M.length,J;while(N--){if(M[N].handler===P){J=M[N];break}}if(!J){return O}if(L.include(":")){if(O.removeEventListener){O.removeEventListener("dataavailable",J,false)}else{O.detachEvent("ondataavailable",J);O.detachEvent("onlosecapture",J)}}else{var I=o(L);if(O.removeEventListener){O.removeEventListener(I,J,false)}else{O.detachEvent("on"+I,J)}}K.set(L,M.without(J));return O}function D(L,K,J,I){L=$(L);if(Object.isUndefined(I)){I=true}if(L==document&&document.createEvent&&!L.dispatchEvent){L=document.documentElement}var M;if(document.createEvent){M=document.createEvent("HTMLEvents");M.initEvent("dataavailable",I,true)}else{M=document.createEventObject();M.eventType=I?"ondataavailable":"onlosecapture"}M.eventName=K;M.memo=J||{};if(document.createEvent){L.dispatchEvent(M)}else{L.fireEvent(M.eventType,M)}return G.extend(M)}G.Handler=Class.create({initialize:function(K,J,I,L){this.element=$(K);this.eventName=J;this.selector=I;this.callback=L;this.handler=this.handleEvent.bind(this)},start:function(){G.observe(this.element,this.eventName,this.handler);return this},stop:function(){G.stopObserving(this.element,this.eventName,this.handler);return this},handleEvent:function(J){var I=G.findElement(J,this.selector);if(I){this.callback.call(this.element,J,I)}}});function m(K,J,I,L){K=$(K);if(Object.isFunction(I)&&Object.isUndefined(L)){L=I,I=null}return new G.Handler(K,J,I,L).start()}Object.extend(G,G.Methods);Object.extend(G,{fire:D,observe:A,stopObserving:n,on:m});Element.addMethods({fire:D,observe:A,stopObserving:n,on:m});Object.extend(document,{fire:D.methodize(),observe:A.methodize(),stopObserving:n.methodize(),on:m.methodize(),loaded:false});if(window.Event){Object.extend(window.Event,G)}else{window.Event=G}})();(function(){var e;function a(){if(document.loaded){return}if(e){window.clearTimeout(e)}document.loaded=true;document.fire("dom:loaded")}function c(){if(document.readyState==="complete"){document.stopObserving("readystatechange",c);a()}}function b(){try{document.documentElement.doScroll("left")}catch(f){e=b.defer();return}a()}if(document.addEventListener){document.addEventListener("DOMContentLoaded",a,false)}else{document.observe("readystatechange",c);if(window==top){e=b.defer()}}Event.observe(window,"load",a)})();Element.addMethods();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(a,b){return Element.insert(a,{before:b})},Top:function(a,b){return Element.insert(a,{top:b})},Bottom:function(a,b){return Element.insert(a,{bottom:b})},After:function(a,b){return Element.insert(a,{after:b})}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},within:function(b,a,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,e){var c=Element.cumulativeScrollOffset(b);this.xcomp=a+c[0]-this.deltaX;this.ycomp=e+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,f){f=f.toString().strip();var e=/\s/.test(f)?$w(f).map(a).join(""):a(f);return e?document._getElementsByXPath(".//*"+e,c):[]}:function(f,g){g=g.toString().strip();var h=[],k=(/\s/.test(g)?$w(g):null);if(!k&&!g){return h}var c=$(f).getElementsByTagName("*");g=" "+g+" ";for(var e=0,m,l;m=c[e];e++){if(m.className&&(l=" "+m.className+" ")&&(l.include(g)||(k&&k.all(function(n){return !n.toString().blank()&&l.include(" "+n+" ")})))){h.push(Element.extend(m))}}return h};return function(e,c){return $(c||document.body).getElementsByClassName(e)}}(Element.Methods)}Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(a){this.element=$(a)},_each:function(a){this.element.className.split(/\s+/).select(function(b){return b.length>0})._each(a)},set:function(a){this.element.className=a},add:function(a){if(this.include(a)){return}this.set($A(this).concat(a).join(" "))},remove:function(a){if(!this.include(a)){return}this.set($A(this).without(a).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);(function(){window.Selector=Class.create({initialize:function(a){this.expression=a.strip()},findElements:function(a){return Prototype.Selector.select(this.expression,a)},match:function(a){return Prototype.Selector.match(a,this.expression)},toString:function(){return this.expression},inspect:function(){return"#<Selector: "+this.expression+">"}});Object.extend(Selector,{matchElements:function(g,h){var a=Prototype.Selector.match,e=[];for(var c=0,f=g.length;c<f;c++){var b=g[c];if(a(b,h)){e.push(Element.extend(b))}}return e},findElement:function(g,h,b){b=b||0;var a=0,e;for(var c=0,f=g.length;c<f;c++){e=g[c];if(Prototype.Selector.match(e,h)&&b===a++){return Element.extend(e)}}},findChildElements:function(b,c){var a=c.toArray().join(", ");return Prototype.Selector.select(a,b||document)}})})();
/*
 * Class: ProtoChart 
 * Version: v0.5 beta
 * 
 * ProtoChart is a charting lib on top of Prototype.
 * This library is heavily motivated by excellent work done by:
 * * Flot <http://code.google.com/p/flot/>
 * * Flotr <http://solutoire.com/flotr/>
 * 
 * Complete examples can be found at: <http://www.deensoft.com/lab/protochart>
 */
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(e,b){var a=b||{};for(var c in e){a[c]=(typeof(e[c])=="object"&&!(e[c].constructor==Array||e[c].constructor==RegExp))?this.merge(e[c],b[c]):a[c]=e[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(e){var b=Math.floor(Math.random()*e.length);var a=[];var c=[];a.push(b);while(a.length<e.length){var f=Math.floor(Math.random()*e.length);while(checkExisted(f,a)){f=Math.floor(Math.random()*e.length)}a.push(f)}a.each(function(g){c.push(e[g])}.bind(this));return c},checkExisted:function(c,b){var a=false;b.each(function(e){if(e==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 h,n=this.graphData.length,a=[],f=[];this.graphData.each(function(c){var p=c.color;if(p){--n;if(Object.isNumber(p)){f.push(p)}else{a.push(this.parseColor(p))}}}.bind(this));f.each(function(c){n=Math.max(n,c+1)});var b=[];var g=0;h=0;while(b.length<n){var l;if(this.options.colors.length==h){l=new Proto.Color(100,100,100)}else{l=this.parseColor(this.options.colors[h])}var e=g%2==1?-1:1;var k=1+e*Math.ceil(g/2)*0.2;l.scale(k,k,k);b.push(l);++h;if(h>=this.options.colors.length){h=0;++g}}var m=0,o;this.graphData.each(function(c){if(c.color==null){c.color=b[m].toString();++m}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}var a=(!!document.createElement("canvas").getContext);this.canvas=(!a)?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(!a){this.canvas=$(window.G_vmlCanvasManager.initElement(this.canvas))}this.canvas=$(this.canvas);this.context=this.canvas.getContext("2d");this.overlay=(!a)?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(!a){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.mouseIsOut=false;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(e,g){var c=g.min!=null?g.min:e.datamin;var a=g.max!=null?g.max:e.datamax;if(a-c==0){var b;if(a==0){b=1}else{b=0.01}c-=b;a+=b}else{var f=g.autoscaleMargin;if(f!=null){if(g.min==null){c-=(a-c)*f;if(c<0&&e.datamin>=0){c=0}}if(g.max==null){a+=(a-c)*f;if(a>0&&e.datamax<=0){a=0}}}}e.min=c;e.max=a},prepareTickGeneration:function(c,l){var e;if(Object.isNumber(l.ticks)&&l.ticks>0){e=l.ticks}else{if(c==this.xaxis){e=this.canvasWidth/100}else{e=this.canvasHeight/60}}var t=(c.max-c.min)/e;var p,a,n,r,s,q,f;if(l.mode=="time"){function m(C,v,y){var w=function(E){E=""+E;return E.length==1?"0"+E:E};var B=[];var A=false;if(y==null){y=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}for(var z=0;z<v.length;++z){var D=v.charAt(z);if(A){switch(D){case"h":D=""+C.getHours();break;case"H":D=w(C.getHours());break;case"M":D=w(C.getMinutes());break;case"S":D=w(C.getSeconds());break;case"d":D=""+C.getDate();break;case"m":D=""+(C.getMonth()+1);break;case"y":D=""+C.getFullYear();break;case"b":D=""+y[C.getMonth()];break}B.push(D);A=false}else{if(D=="%"){A=true}else{B.push(D)}}}return B.join("")}var g={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 h=[[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(l.minTickSize!=null){if(typeof l.tickSize=="number"){b=l.tickSize}else{b=l.minTickSize[0]*g[l.minTickSize[1]]}}for(s=0;s<h.length-1;++s){if(t<(h[s][0]*g[h[s][1]]+h[s+1][0]*g[h[s+1][1]])/2&&h[s][0]*g[h[s][1]]>=b){break}}p=h[s][0];n=h[s][1];if(n=="year"){q=Math.pow(10,Math.floor(Math.log(t/g.year)/Math.LN10));f=(t/g.year)/q;if(f<1.5){p=1}else{if(f<3){p=2}else{if(f<7.5){p=5}else{p=10}}}p*=q}if(l.tickSize){p=l.tickSize[0];n=l.tickSize[1]}var k=this.floorInBase;a=function(z){var F=[],B=z.tickSize[0],G=z.tickSize[1],C=new Date(z.max);var y=B*g[G];if(G=="second"){C.setSeconds(k(C.getSeconds(),B))}if(G=="minute"){C.setMinutes(k(C.getMinutes(),B))}if(G=="hour"){C.setHours(k(C.getHours(),B))}if(G=="month"){C.setMonth(k(C.getMonth(),B))}if(G=="year"){C.setFullYear(k(C.getFullYear(),B))}C.setMilliseconds(0);if(y>=g.minute){C.setSeconds(0)}if(y>=g.hour){C.setMinutes(0)}if(y>=g.day){C.setHours(0)}if(y>=g.day*28){C.setDate(1)}if(y>=g.year){C.setMonth(0)}var I=0,H;do{H=C.getTime();F.push({v:H,label:z.tickFormatter(H,z)});if(G=="month"){if(B<1){C.setDate(1);var w=C.getTime();C.setMonth(C.getMonth()-1);var A=C.getTime();C.setTime(H-I*g.hour-(A-w)*B);I=C.getHours();C.setHours(0)}else{C.setMonth(C.getMonth()-B)}}else{if(G=="year"){C.setFullYear(C.getFullYear()-B)}else{var J=C.getTimezoneOffset();C.setTime(H-y);var E=C.getTimezoneOffset();var D=E-J;if(D!=0){C.setTime(H-y+D*60*1000)}}}}while(H>z.min);F.reverse();if(F[F.length-1].v>z.max){F.pop()}if(F[0].v<z.min){F.shift()}return F};r=function(w,A){var B=new Date(w);if(l.timeformat!=null){return m(B,l.timeformat,l.monthNames)}var y=A.tickSize[0]*g[A.tickSize[1]];var z=A.max-A.min;if(y<g.minute){fmt="%h:%M:%S"}else{if(y<g.day){if(z<2*g.day){fmt="%h:%M"}else{fmt="%b %d %h:%M"}}else{if(y<g.month){fmt="%b %d"}else{if(y<g.year){if(z<g.year){fmt="%b"}else{fmt="%b %y"}}else{fmt="%y"}}}}return m(B,fmt,l.monthNames)}}else{var u=l.tickDecimals;var o=-Math.floor(Math.log(t)/Math.LN10);if(u!=null&&o>u){o=u}q=Math.pow(10,-o);f=t/q;if(f<1.5){p=1}else{if(f<3){p=2;if(f>2.25&&(u==null||o+1<=u)){p=2.5;++o}}else{if(f<7.5){p=5}else{p=10}}}p*=q;if(l.minTickSize!=null&&p<l.minTickSize){p=l.minTickSize}if(l.tickSize!=null){p=l.tickSize}c.tickDecimals=Math.max(0,(u!=null)?u:o);var k=this.floorInBase;a=function(z){var A=[];var B=k(z.min,z.tickSize);if(z.min<0&&!(B<0)){B=-z.tickSize}var y=0,w;do{w=B+y*z.tickSize;A.push({v:w,label:z.tickFormatter(w,z)});++y}while(w<z.max);return A};r=function(w,y){if(w){return w.toFixed(y.tickDecimals)}return 0}}c.tickSize=n?[p,n]:p;c.tickGenerator=a;if(Object.isFunction(l.tickFormatter)){c.tickFormatter=function(w,y){return""+l.tickFormatter(w,y)}}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(h,g){var e=null;var f=null;if(typeof h=="object"){e=h[0];if(h.length>1){f=h[1]}}else{e=h}if(!f){f=a.tickFormatter(e,a)}a.ticks[g]={v:e,label:f}}.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,g=[],b;for(c=0;c<this.yaxis.ticks.length;++c){b=this.yaxis.ticks[c].label;if(b){g.push('<div class="tickLabel">'+b+"</div>")}}if(g.length>0){var a=new Element("div",{style:"position:absolute;top:-10000px;font-size:smaller"});a.update(g.join(""));this.domObj.insert(a);this.yLabelMaxWidth=a.getWidth();this.yLabelMaxHeight=a.select("div")[0].getHeight();a.remove()}var f=this.options.grid.borderWidth;if(this.options.points.show){f=Math.max(f,this.options.points.radius+this.options.points.lineWidth/2);f=Math.max(f,this.options.mouse.radius+this.options.points.lineWidth/2)}for(c=0;c<this.graphData.length;++c){if(this.graphData[c].points.show){f=Math.max(f,this.graphData[c].points.radius+this.graphData[c].points.lineWidth/2)}}this.chartOffset.left=this.chartOffset.right=this.chartOffset.top=this.chartOffset.bottom=f;this.chartOffset.left+=this.yLabelMaxWidth+this.options.grid.labelMargin;this.chartWidth=this.canvasWidth-this.chartOffset.left-this.chartOffset.right;this.xLabelBoxWidth=this.chartWidth/6;g=[];for(c=0;c<this.xaxis.ticks.length;++c){b=this.xaxis.ticks[c].label;if(b){g.push('<span class="tickLabel" width="'+this.xLabelBoxWidth+'">'+b+"</span>")}}var e=0;if(g.length>0){var a=new Element("div",{style:"position:absolute;top:-10000px;font-size:smaller"});a.update(g.join(""));this.domObj.appendChild(a);e=a.getHeight();a.remove()}this.chartOffset.bottom+=e+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(e){if(e.x1==null||e.x1<this.xaxis.min){e.x1=this.xaxis.min}if(e.x2==null||e.x2>this.xaxis.max){e.x2=this.xaxis.max}if(e.y1==null||e.y1<this.yaxis.min){e.y1=this.yaxis.min}if(e.y2==null||e.y2>this.yaxis.max){e.y2=this.yaxis.max}var f;if(e.x1>e.x2){f=e.x1;e.x1=e.x2;e.x2=f}if(e.y1>e.y2){f=e.y1;e.y1=e.y2;e.y2=f}if(e.x1>=this.xaxis.max||e.x2<=this.xaxis.min||e.x1==e.x2||e.y1>=this.yaxis.max||e.y2<=this.yaxis.min||e.y1==e.y2){return}this.context.fillStyle=e.color||this.options.grid.coloredAreasColor;this.context.fillRect(Math.floor(this.translateHoz(e.x1)),Math.floor(this.translateVert(e.y2)),Math.floor(this.translateHoz(e.x2)-this.translateHoz(e.x1)),Math.floor(this.translateVert(e.y1)-this.translateVert(e.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(e){a=e.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(e){a=e.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(e){if(!e.label){return}a+='<div style="position:absolute;top:'+(this.chartOffset.top+this.chartHeight+this.options.grid.labelMargin)+"px;left:"+(this.chartOffset.left+this.translateHoz(e.v)-this.xLabelBoxWidth/2)+"px;width:"+this.xLabelBoxWidth+'px;text-align:center" class="tickLabel">'+e.label+"</div>"}.bind(this));this.yaxis.ticks.each(function(e){if(!e.label||e.v<this.yaxis.min||e.v>this.yaxis.max){return}a+='<div id="ylabels" style="position:absolute;top:'+(this.chartOffset.top+this.translateVert(e.v)-this.yLabelMaxHeight/2)+"px;left:0;width:"+this.yLabelMaxWidth+'px;text-align:right" class="tickLabel">'+e.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(g,f,k){var e,n=null,a=null,o=null;this.context.beginPath();for(var h=0;h<g.length;++h){e=n;n=g[h];if(e==null||n==null){continue}var c=e[0],m=e[1],b=n[0],l=n[1];if(m<=l&&m<this.yaxis.min){if(l<this.yaxis.min){continue}c=(this.yaxis.min-m)/(l-m)*(b-c)+c;m=this.yaxis.min}else{if(l<=m&&l<this.yaxis.min){if(m<this.yaxis.min){continue}b=(this.yaxis.min-m)/(l-m)*(b-c)+c;l=this.yaxis.min}}if(m>=l&&m>this.yaxis.max){if(l>this.yaxis.max){continue}c=(this.yaxis.max-m)/(l-m)*(b-c)+c;m=this.yaxis.max}else{if(l>=m&&l>this.yaxis.max){if(m>this.yaxis.max){continue}b=(this.yaxis.max-m)/(l-m)*(b-c)+c;l=this.yaxis.max}}if(c<=b&&c<this.xaxis.min){if(b<this.xaxis.min){continue}m=(this.xaxis.min-c)/(b-c)*(l-m)+m;c=this.xaxis.min}else{if(b<=c&&b<this.xaxis.min){if(c<this.xaxis.min){continue}l=(this.xaxis.min-c)/(b-c)*(l-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)*(l-m)+m;c=this.xaxis.max}else{if(b>=c&&b>this.xaxis.max){if(c>this.xaxis.max){continue}l=(this.xaxis.max-c)/(b-c)*(l-m)+m;b=this.xaxis.max}}if(a!=this.translateHoz(c)||o!=this.translateVert(m)+f){this.context.moveTo(this.translateHoz(c),this.translateVert(m)+f)}a=this.translateHoz(b);o=this.translateVert(l)+f;if(k){this.plotLineDashed(this.translateHoz(c),this.translateVert(m)+f,a,o,k)}else{this.context.lineTo(a,o)}}this.context.stroke()},plotLineDashed:function(c,l,a,k,m){var q=c;var o=l;var e=Math.sqrt((a-q)*(a-q)+(k-o)*(k-o));var p=(a-q)/e;var n=(k-o)/e;var h=0;var g=0;var f=0;while(h<e){var b=Math.min(m[g],e-h);h+=b;if(g%2==0){this.context.moveTo(q,o)}q+=b*p;o+=b*n;if(g%2==0){this.context.lineTo(q,o)}f+=b;if(f>m[g]){f-=m[g];g=(g+1)%m.length}}},plotLineArea:function(g){var f,p=null;var a=Math.min(Math.max(0,this.yaxis.min),this.yaxis.max);var m,e=0;var o=false;for(var h=0;h<g.length;++h){f=p;p=g[h];if(o&&f!=null&&p==null){this.context.lineTo(this.translateHoz(e),this.translateVert(a));this.context.fill();o=false;continue}if(f==null||p==null){continue}var c=f[0],n=f[1],b=p[0],l=p[1];if(c<=b&&c<this.xaxis.min){if(b<this.xaxis.min){continue}n=(this.xaxis.min-c)/(b-c)*(l-n)+n;c=this.xaxis.min}else{if(b<=c&&b<this.xaxis.min){if(c<this.xaxis.min){continue}l=(this.xaxis.min-c)/(b-c)*(l-n)+n;b=this.xaxis.min}}if(c>=b&&c>this.xaxis.max){if(b>this.xaxis.max){continue}n=(this.xaxis.max-c)/(b-c)*(l-n)+n;c=this.xaxis.max}else{if(b>=c&&b>this.xaxis.max){if(c>this.xaxis.max){continue}l=(this.xaxis.max-c)/(b-c)*(l-n)+n;b=this.xaxis.max}}if(!o){this.context.beginPath();this.context.moveTo(this.translateHoz(c),this.translateVert(a));o=true}if(n>=this.yaxis.max&&l>=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(n<=this.yaxis.min&&l<=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,k=b;if(n<=l&&n<this.yaxis.min&&l>=this.yaxis.min){c=(this.yaxis.min-n)/(l-n)*(b-c)+c;n=this.yaxis.min}else{if(l<=n&&l<this.yaxis.min&&n>=this.yaxis.min){b=(this.yaxis.min-n)/(l-n)*(b-c)+c;l=this.yaxis.min}}if(n>=l&&n>this.yaxis.max&&l<=this.yaxis.max){c=(this.yaxis.max-n)/(l-n)*(b-c)+c;n=this.yaxis.max}else{if(l>=n&&l>this.yaxis.max&&n<=this.yaxis.max){b=(this.yaxis.max-n)/(l-n)*(b-c)+c;l=this.yaxis.max}}if(c!=q){if(n<=this.yaxis.min){m=this.yaxis.min}else{m=this.yaxis.max}this.context.lineTo(this.translateHoz(q),this.translateVert(m));this.context.lineTo(this.translateHoz(c),this.translateVert(m))}this.context.lineTo(this.translateHoz(c),this.translateVert(n));this.context.lineTo(this.translateHoz(b),this.translateVert(l));if(b!=k){if(l<=this.yaxis.min){m=this.yaxis.min}else{m=this.yaxis.max}this.context.lineTo(this.translateHoz(k),this.translateVert(m));this.context.lineTo(this.translateHoz(b),this.translateVert(m))}e=Math.max(b,k)}if(o){this.context.lineTo(this.translateHoz(e),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(e,b,f){for(var c=0;c<e.length;++c){if(e[c]==null){continue}var a=e[c][0],g=e[c][1];if(a<this.xaxis.min||a>this.xaxis.max||g<this.yaxis.min||g>this.yaxis.max){continue}this.context.beginPath();this.context.arc(this.translateHoz(a),this.translateVert(g),b,0,2*Math.PI,true);if(f){this.context.fill()}this.context.stroke()}},plotPointShadows:function(e,f,b){for(var c=0;c<e.length;++c){if(e[c]==null){continue}var a=e[c][0],g=e[c][1];if(a<this.xaxis.min||a>this.xaxis.max||g<this.yaxis.min||g>this.yaxis.max){continue}this.context.beginPath();this.context.arc(this.translateHoz(a),this.translateVert(g)+f,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(l){var k=0;var f=0;var e=this.chartWidth/2;var c=this.chartHeight/2;var g=0;var a=0;var m=this.options.pies.fontSize;var h=this.options.pies.labelWidth;if(!this.options.pies.autoScale){f=this.options.pies.radius}else{f=(this.chartHeight*0.85)/2}var b=f*1.05;for(i=0;i<l.length;i++){k+=l[i].data}totalPct=0;this.drawPieShadow(e,c,f,0,0);l.each(function(A,s){var B=A.data/k;g=a;a+=B*(2*Math.PI);var z=(a-g)/2+g;var w=e+Math.cos(z)*b;var v=c+Math.sin(z)*b;var r=e;var o=c;var n=null;var q=null;var p=0;var y=0;this.context.beginPath();this.context.moveTo(r,o);this.context.arc(r,o,f,g,a,false);this.context.closePath();this.context.fillStyle=this.parseColor(A.color).scale(null,null,null,this.options.pies.fillOpacity).toString();if(this.options.pies.fill){this.context.fill()}if(z<=0.25*(2*Math.PI)){n="left";q="top";p=w;y=v+m}else{if(z>0.25*(2*Math.PI)&&z<=0.5*(2*Math.PI)){n="left";q="bottom";p=w-h;y=v}else{if(z>0.5*(2*Math.PI)&&z<=0.75*(2*Math.PI)){n="right";q="bottom";p=w-h;y=v-m}else{n="right";q="bottom";p=w;y=v-m}}}p=p+"px";y=y+"px";var u=Math.round(B*100);if(s==l.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:'+h+"px;fontSize:"+m+"px;overflow:hidden;top:"+y+";left:"+p+";textAlign:"+n+";verticalAlign:"+q+'">'+u+"%</div>";this.domObj.insert(t);totalPct=totalPct+u}.bind(this))},drawBarGraph:function(a,b){a.each(function(e,c){this.drawGraphBars(e,c,a.size(),b)}.bind(this))},drawGraphBar:function(a){this.drawGraphBars(a,0,this.graphData.length,this.barDataRange)},plotBars:function(l,h,n,g,m,a,k,f){var e=0;if(k%2==0){e=(1+((a-k/2)-1))*n}else{var c=0.5;if(a==(k/2-c)){e=-n*c}else{e=(c+(a-Math.round(k/2)))*n}}var b=[];h.each(function(s){if(!s){return}var w=s[0],v=s[1];var z=true,r=true,t=true;var q=w+e,A=w+n+e,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(l.bars.showShadow&&l.shadowSize>0){this.plotShadowOutline(l,this.context.strokeStyle,q,o,u,A,z,t,r)}if(m){this.context.beginPath();this.context.moveTo(this.translateHoz(q),this.translateVert(o)+g);this.context.lineTo(this.translateHoz(q),this.translateVert(u)+g);this.context.lineTo(this.translateHoz(A),this.translateVert(u)+g);this.context.lineTo(this.translateHoz(A),this.translateVert(o)+g);this.context.fill()}if(z||t||r){this.context.beginPath();this.context.moveTo(this.translateHoz(q),this.translateVert(o)+g);if(z){this.context.lineTo(this.translateHoz(q),this.translateVert(u)+g)}else{this.context.moveTo(this.translateHoz(q),this.translateVert(u)+g)}if(r){this.context.lineTo(this.translateHoz(A),this.translateVert(u)+g)}else{this.context.moveTo(this.translateHoz(A),this.translateVert(u)+g)}if(t){this.context.lineTo(this.translateHoz(A),this.translateVert(o)+g)}else{this.context.moveTo(this.translateHoz(A),this.translateVert(o)+g)}this.context.stroke()}}.bind(this));f.push(b)},plotShadowOutline:function(k,p,c,a,h,m,l,g,f){var o=0.3;for(var b=1;b<=this.options.shadowSize/2;b++){var e=o*b;this.context.beginPath();this.context.strokeStyle="rgba(0,0,0,"+e+")";this.context.moveTo(this.translateHoz(c)+b,this.translateVert(a));if(l){this.context.lineTo(this.translateHoz(c)+b,this.translateVert(h)-b)}else{this.context.moveTo(this.translateHoz(c)+b,this.translateVert(h)-b)}if(f){this.context.lineTo(this.translateHoz(m)+b,this.translateVert(h)-b)}else{this.context.moveTo(this.translateHoz(m)+b,this.translateVert(h)-b)}if(g){this.context.lineTo(this.translateHoz(m)+b,this.translateVert(a))}else{this.context.lineTo(this.translateHoz(m)+b,this.translateVert(a))}this.context.stroke();this.context.closePath()}this.context.strokeStyle=p},drawGraphBars:function(e,a,b,g){this.context.save();this.context.translate(this.chartOffset.left,this.chartOffset.top);this.context.lineJoin="round";var f=e.bars.barWidth;var c=Math.min(e.bars.lineWidth,f);this.context.lineWidth=c;this.context.strokeStyle=e.color;if(e.bars.fill){this.context.fillStyle=e.bars.fillColor!=null?e.bars.fillColor:this.parseColor(e.color).scale(null,null,null,this.options.bars.fillOpacity).toString()}this.plotBars(e,e.data,f,0,e.bars.fill,a,b,g);this.context.restore()},insertLegend:function(){this.domObj.select(".legend").invoke("remove");if(!this.options.legend.show){return}var k=[];var g=false;this.graphData.each(function(o,m){if(!o.label){return}if(m%this.options.legend.noColumns==0){if(g){k.push("</tr>")}k.push("<tr>");g=true}var c=o.label;if(this.options.legend.labelFormatter!=null){c=this.options.legend.labelFormatter(c)}k.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(g){k.push("</tr>")}if(k.length>0){var n='<table style="font-size:smaller;color:'+this.options.grid.color+'">'+k.join("")+"</table>";if($(this.options.legend.container)!=null){$(this.options.legend.container).insert(n)}else{var l="";var b=this.options.legend.position,e=this.options.legend.margin;if(b.charAt(0)=="n"){l+="top:"+(e+this.chartOffset.top)+"px;"}else{if(b.charAt(0)=="s"){l+="bottom:"+(e+this.chartOffset.bottom)+"px;"}}if(b.charAt(1)=="e"){l+="right:"+(e+this.chartOffset.right)+"px;"}else{if(b.charAt(1)=="w"){l+="left:"+(e+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;"+l+'">'+n+"</div>").getElementsBySelector("div.ProtoChart-legend").first();if(this.options.legend.backgroundOpacity!=0){var h=this.options.legend.backgroundColor;if(h==null){var f=(this.options.grid.backgroundColor!=null)?this.options.grid.backgroundColor:this.extractColor(a);h=this.parseColor(f).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;"+l+"background-color:"+h+';"> </div>').select("div.ProtoChart-legend-bg").first().setStyle({opacity:this.options.legend.backgroundOpacity})}}}},onMouseMove:function(c){this.mouseIsOut=false;var f=c||window.event;if(f.pageX==null&&f.clientX!=null){var k=document.documentElement,a=$(document.body);this.lastMousePos.pageX=f.clientX+(k&&k.scrollLeft||a.scrollLeft||0);this.lastMousePos.pageY=f.clientY+(k&&k.scrollTop||a.scrollTop||0)}else{this.lastMousePos.pageX=f.pageX;this.lastMousePos.pageY=f.pageY}var g=this.overlay.cumulativeOffset();var h={x:this.xaxis.min+(f.pageX-g.left-this.chartOffset.left)/this.hozScale,y:this.yaxis.max-(f.pageY-g.top-this.chartOffset.top)/this.vertScale};if(this.options.mouse.track&&this.selectionInterval==null){this.hit(c,h)}this.domObj.fire("ProtoChart:mousemove",[h])},onMouseOut:function(b){this.mouseIsOut=true;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 f={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",[f]);if(this.options.allowDataClick){var a={};if(this.options.points.show){a=this.getDataClickPoint(f,this.options);this.domObj.fire("ProtoChart:dataclick",[a])}else{if(this.options.lines.show&&this.options.points.show){a=this.getDataClickPoint(f,this.options);this.domObj.fire("ProtoChart:dataclick",[a])}else{if(this.options.bars.show){if(this.barDataRange.length>0){a=this.getDataClickPoint(f,this.options,this.barDataRange);this.domObj.fire("ProtoChart:dataclick",[a])}}}}}},getDataClickPoint:function(f,c,e){f.x=parseInt(f.x);f.y=parseInt(f.y);var b=f.y.toFixed(0);var a={};a.position=f;a.value="";a.queryName="";a.date=null;if(c.points.show||c.lines.show){this.graphData.each(function(n){var h=n.data;var m=parseInt(f.x.toFixed(0));if(m<0){m=0}if(this.options.xaxis.mode=="time"){var o=new Date(m);o.setHours(0,0,0,0);m=o.getTime();a.date=o}dist=Number.MAX_VALUE;xsens=(this.hozScale*n.mouse.sensibility);ysens=(this.vertScale*n.mouse.sensibility);for(var l=0,k,g;l<n.data.length;l++){k=this.hozScale*Math.abs(n.data[l][0]-m);g=this.vertScale*Math.abs(n.data[l][1]-f.y);if(k<xsens&&g<ysens&&(k+g)<dist){a.value=n.data[l][1];a.queryName=n.queryName;throw $break}}}.bind(this))}else{if(c.bars.show){xClick=f.x;this.barDataRange.each(function(g){g.each(function(k){var h=k;if(xClick>h.left&&xClick<h.right){a.value=h.value;throw $break}}.bind(this))}.bind(this))}}return a},triggerSelectedEvent:function(){var b,a,e,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){e=this.selection.first.y;c=this.selection.second.y}else{e=this.selection.second.y;c=this.selection.first.y}b=this.xaxis.min+b/this.hozScale;a=this.xaxis.min+a/this.hozScale;e=this.yaxis.max-e/this.vertScale;c=this.yaxis.max-c/this.vertScale;this.domObj.fire("ProtoChart:selected",[{x1:b,y1:e,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),e=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,e+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),e=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,e+this.chartOffset.top,b,c);this.overlayContext.strokeRect(a+this.chartOffset.left,e+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,u){var h={dist:Number.MAX_VALUE,x:null,y:null,graphData:null,mouse:null};for(var s=0,r,l,e;s<this.graphData.length;s++){if(!this.graphData[s].mouse.track){continue}r=this.graphData[s].data;l=(this.hozScale*this.graphData[s].mouse.sensibility);e=(this.vertScale*this.graphData[s].mouse.sensibility);for(var o=0,v,q;o<r.length;o++){v=this.hozScale*Math.abs(r[o][0]-u.x);q=this.vertScale*Math.abs(r[o][1]-u.y);if(v<l&&q<e&&(v+q)<h.dist){h.dist=(v+q);h.x=r[o][0];h.y=r[o][1];h.mouse=this.graphData[s].mouse;h.graphData=this.graphData[s]}}}if(h.mouse&&h.mouse.track&&!this.prevHit||(this.prevHit&&(h.x!=this.prevHit.x||h.y!=this.prevHit.y))){var c=this.domObj.select("."+this.options.mouse.clsName).first();if(!c){var w="",b=this.options.mouse.position,k=this.options.mouse.margin;this.domObj.insert('<div class="'+this.options.mouse.clsName+'" style="display:none;position:absolute;'+w+'"></div>');return}if(h.x!==null&&h.y!==null){c.setStyle({display:"block"});this.clearHit();if(h.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=h.mouse.lineColor;this.overlayContext.fillStyle="#ffffff";this.overlayContext.beginPath();this.overlayContext.arc(this.translateHoz(h.x),this.translateVert(h.y),this.options.mouse.radius,0,2*Math.PI,true);this.overlayContext.fill();this.overlayContext.stroke();this.overlayContext.restore()}this.prevHit=h;var g=h.mouse.trackDecimals;if(g==null||g<0){g=0}if(!this.options.mouse.fixedPosition){c.setStyle({left:(this.translateHoz(h.x)+this.options.mouse.radius+10)+"px",top:(this.translateVert(h.y)+this.options.mouse.radius+10)+"px"})}var f=this;var t=h.mouse.trackFormatter({x:h.x.toFixed?h.x.toFixed(g):h.x,y:h.y.toFixed?h.y.toFixed(g):h.y,series:h.graphData,callback:function(m){if(f.mouseIsOut){return}if(m!=null){c.setStyle({display:"block"});c.innerHTML=m}else{c.setStyle({display:"none"})}}});if(t!=null){c.setStyle({display:"block"});c.innerHTML=t}else{c.setStyle({display:"none"})}this.domObj.fire("ProtoChart:hit",[h])}else{if(this.options.prevHit){c.setStyle({display:"none"});this.clearHit()}}}},floorInBase:function(b,a){if(b>0){return a*Math.floor(b/a)}else{return a*Math.ceil(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(k,h,e,f){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,e,a){x=4;while(-1<--x){if(arguments[x]!=null){this[this.rgba[x]]*=arguments[x]}}return this.normalize()},adjust:function(c,b,e,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}});
/* script.aculo.us scriptaculous.js v1.9.0, Thu Dec 23 16:54:48 -0500 2010

// Copyright (c) 2005-2010 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// For details, see the script.aculo.us web site: http://script.aculo.us/
*/
var Scriptaculous={Version:"1.9.0",require:function(b){try{document.write('<script type="text/javascript" src="'+b+'"><\/script>')}catch(c){var a=document.createElement("script");a.type="text/javascript";a.src=b;document.getElementsByTagName("head")[0].appendChild(a)}},REQUIRED_PROTOTYPE:"1.6.0.3",load:function(){function a(c){var e=c.replace(/_.*|\./g,"");e=parseInt(e+"0".times(4-e.length));return c.indexOf("_")>-1?e-1:e}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)}var b=/scriptaculous\.js(\?.*)?$/;$$("script[src]").findAll(function(c){return c.src.match(b)}).each(function(e){var f=e.src.replace(b,""),c=e.src.match(/\?.*load=([a-z,]*)/);(c?c[1]:"builder,effects,dragdrop,controls,slider,sound").split(",").each(function(g){Scriptaculous.require(f+g+".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){return(-Math.cos((b*((a||5)-0.5)*2)*Math.PI)/2)+0.5},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(e){a.insertBefore(new Element("span",{style:b}).update(e==" "?String.fromCharCode(160):e),c)});Element.remove(c)}})},multiple:function(b,c){var f;if(((typeof b=="object")||Object.isFunction(b))&&(b.length)){f=b}else{f=$(b).childNodes}var a=Object.extend({speed:0.1,delay:0},arguments[2]||{});var e=a.delay;$A(f).each(function(h,g){new c(h,Object.extend(a,{delay:g*a.speed+e}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(b,c,a){b=$(b);c=(c||"appear").toLowerCase();return Effect[Effect.PAIRS[c][b.visible()?1:0]](b,Object.extend({queue:{position:"end",scope:(b.id||"global"),limit:1}},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(f){return f.state=="idle"}).each(function(f){f.startOn+=b.finishOn;f.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(a){if(a&&a.transition===false){a.transition=Effect.Transitions.linear}this.options=Object.extend(Object.extend({},Effect.DefaultOptions),a||{});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;this.render=(function(){function b(e,c){if(e.options[c+"Internal"]){e.options[c+"Internal"](e)}if(e.options[c]){e.options[c](e)}}return function(c){if(this.state==="idle"){this.state="running";b(this,"beforeSetup");if(this.setup){this.setup()}b(this,"afterSetup")}if(this.state==="running"){c=(this.options.transition(c)*this.fromToDelta)+this.options.from;this.position=c;b(this,"beforeUpdate");if(this.update){this.update(c)}b(this,"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,g,f){c=Object.isString(c)?$(c):c;var b=$A(arguments),e=b.last(),a=b.length==5?b[3]:null;this.method=Object.isFunction(e)?e.bind(c):Object.isFunction(c[e])?c[e].bind(c):function(h){c[e]=h};this.start(Object.extend({from:g,to:f},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,e){return b+((this._base[e]+(this._delta[e]*a)).round().toColorPart())}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=function(c){var b=arguments[1]||{},a=document.viewport.getScrollOffsets(),e=$(c).cumulativeOffset();if(b.offset){e[1]+=b.offset}return new Effect.Tween(null,a.top,e[1],b,function(f){scrollTo(a.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(e){if(e.options.to!=0){return}e.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(e){e.element.makePositioned().makeClipping()},afterFinishInternal:function(e){e.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(e){e=$(e);var b=Object.extend({distance:20,duration:0.5},arguments[1]||{});var f=parseFloat(b.distance);var c=parseFloat(b.duration)/10;var a={top:e.getStyle("top"),left:e.getStyle("left")};return new Effect.Move(e,{x:f,y:0,duration:c,afterFinishInternal:function(g){new Effect.Move(g.element,{x:-f*2,y:0,duration:c*2,afterFinishInternal:function(h){new Effect.Move(h.element,{x:f*2,y:0,duration:c*2,afterFinishInternal:function(k){new Effect.Move(k.element,{x:-f*2,y:0,duration:c*2,afterFinishInternal:function(l){new Effect.Move(l.element,{x:f*2,y:0,duration:c*2,afterFinishInternal:function(m){new Effect.Move(m.element,{x:-f,y:0,duration:c,afterFinishInternal:function(n){n.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(e){e.element.makePositioned();e.element.down().makePositioned();if(window.opera){e.element.setStyle({top:""})}e.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(e){e.element.down().setStyle({bottom:(e.dims[0]-e.element.clientHeight)+"px"})},afterFinishInternal:function(e){e.element.undoClipping().undoPositioned();e.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(e){e.element.makePositioned();e.element.down().makePositioned();if(window.opera){e.element.setStyle({top:""})}e.element.makeClipping().show()},afterUpdateInternal:function(e){e.element.down().setStyle({bottom:(e.dims[0]-e.element.clientHeight)+"px"})},afterFinishInternal:function(e){e.element.hide().undoClipping().undoPositioned();e.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 h=c.getDimensions();var k,g;var f,e;switch(b.direction){case"top-left":k=g=f=e=0;break;case"top-right":k=h.width;g=e=0;f=-h.width;break;case"bottom-left":k=f=0;g=h.height;e=-h.height;break;case"bottom-right":k=h.width;g=h.height;f=-h.width;e=-h.height;break;case"center":k=h.width/2;g=h.height/2;f=-h.width/2;e=-h.height/2;break}return new Effect.Move(c,{x:k,y:g,duration:0.01,beforeSetup:function(l){l.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(l){new Effect.Parallel([new Effect.Opacity(l.element,{sync:true,to:1,from:0,transition:b.opacityTransition}),new Effect.Move(l.element,{x:f,y:e,sync:true,transition:b.moveTransition}),new Effect.Scale(l.element,100,{scaleMode:{originalHeight:h.height,originalWidth:h.width},sync:true,scaleFrom:window.opera?1:0,transition:b.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(m){m.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(m){m.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 g=c.getDimensions();var f,e;switch(b.direction){case"top-left":f=e=0;break;case"top-right":f=g.width;e=0;break;case"bottom-left":f=0;e=g.height;break;case"bottom-right":f=g.width;e=g.height;break;case"center":f=g.width/2;e=g.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:f,y:e,sync:true,transition:b.moveTransition})],Object.extend({beforeStartInternal:function(h){h.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(h){h.effects[0].element.hide().undoClipping().undoPositioned().setStyle(a)}},b))};Effect.Pulsate=function(c){c=$(c);var b=arguments[1]||{},a=c.getInlineOpacity(),f=b.transition||Effect.Transitions.linear,e=function(g){return 1-f((-Math.cos((g*(b.pulses||5)*2)*Math.PI)/2)+0.5)};return new Effect.Opacity(c,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(g){g.element.setStyle({opacity:a})}},b),{transition:e}))};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(e){e.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(e){return e.value==b[e.key]});a.afterFinishInternal=function(e){e.element.addClassName(e.options.style);e.transforms.each(function(f){e.element.style[f.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(h){var g=h[0],f=h[1],e=null;if(f.parseColor("#zzzzzz")!="#zzzzzz"){f=f.parseColor();e="color"}else{if(g=="opacity"){f=parseFloat(f);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}}else{if(Element.CSS_LENGTH.test(f)){var c=f.match(/^([\+\-]?[0-9\.]+)(.*)$/);f=parseFloat(c[1]);e=(c.length==3)?c[2]:null}}}var b=this.element.getStyle(g);return{style:g.camelize(),originalValue:e=="color"?a(b):parseFloat(b||0),targetValue:e=="color"?a(f):f,unit:e}}.bind(this)).reject(function(b){return((b.originalValue==b.targetValue)||(b.unit!="color"&&(isNaN(b.originalValue)||isNaN(b.targetValue))))})},update:function(a){var e={},b,c=this.transforms.length;while(c--){e[(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(e,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 e=a.get("ids"),c=a.get("effect"),b=a.get("options");var f=[$(e)||$$(e)].flatten();return f.map(function(g){return new c(g,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,e){c[e]=a[e];return c})}}else{Element.getStyles=function(b){b=$(b);var a=b.currentStyle,c;c=Element.CSS_PROPERTIES.inject({},function(e,f){e[f]=a[f];return e});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,f,b){c=$(c);var e=f.dasherize().camelize(),a=e.charAt(0).toUpperCase()+e.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(e){a._containers.push($(e))})}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(e){return c==e})},isAffected:function(a,c,b){return((b.element!=c)&&((!b._containers)||this.isContained(c,b))&&((!b.accept)||(Element.classNames(c).detect(function(e){return b.accept.include(e)})))&&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,e=[];this.drops.each(function(f){if(Droppables.isAffected(a,c,f)){e.push(f)}});if(e.length>0){b=Droppables.findDeepestChild(e)}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(e){if(e[b]){e[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(g,f,e){var h=Math.sqrt(Math.abs(f^2)+Math.abs(e^2))*0.02;new Effect.Move(g,{x:-e,y:-f,duration:h,queue:{scope:"_draggable",position:"end"}})},endeffect:function(f){var e=Object.isNumber(f._opacity)?f._opacity:1;new Effect.Opacity(f,{duration:0.2,from:0.7,to:e,queue:{scope:"_draggable",position:"end"},afterFinish:function(){Draggable._dragging[f]=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(e){e._opacity=Element.getOpacity(e);Draggable._dragging[e]=true;new Effect.Opacity(e,{duration:0.2,from:e._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 e=this.element.cumulativeOffset();this.offset=[0,1].map(function(f){return(b[f]-e[f])});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._originallyAbsolute=(this.element.getStyle("position")=="absolute");if(!this._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).toArray();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._originallyAbsolute){Position.relativize(this.element)}delete this._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=this.element.cumulativeOffset();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(h){return(a[h]-g[h]-this.offset[h])}.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(h,k){return(h/this.options.snap[k]).round()*this.options.snap[k]}.bind(this))}else{e=e.map(function(h){return(h/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){a=$(a);var b=Sortable.sortables[a.id];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(g){g.style.top=0;g.style.left=0}}}if(b.endeffect){a.endeffect=b.endeffect}if(b.zindex){a.zindex=b.zindex}var e={overlap:b.overlap,containment:b.containment,tree:b.tree,hoverclass:b.hoverclass,onHover:Sortable.onHover};var f={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,f);b.droppables.push(c)}(b.elements||this.findElements(c,b)||[]).each(function(k,g){var h=b.handles?$(b.handles[g]):(b.handle?$(k).select("."+b.handle)[0]:k);b.draggables.push(new Draggable(k,Object.extend(a,{handle:h})));Droppables.add(k,e);if(b.tree){k.treeNode=c}b.droppables.push(k)});if(b.tree){(Sortable.findTreeElements(c,b)||[]).each(function(g){Droppables.add(g,f);g.treeNode=c;b.droppables.push(g)})}this.sortables[c.identify()]=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(f,e,a){if(Element.isParent(e,f)){return}if(a>0.33&&a<0.66&&Sortable.options(e).tree){return}else{if(a>0.5){Sortable.mark(e,"before");if(e.previousSibling!=f){var b=f.parentNode;f.style.visibility="hidden";e.parentNode.insertBefore(f,e);if(e.parentNode!=b){Sortable.options(b).onChange(f)}Sortable.options(e.parentNode).onChange(f)}}else{Sortable.mark(e,"after");var c=e.nextSibling||null;if(c!=f){var b=f.parentNode;f.style.visibility="hidden";e.parentNode.insertBefore(f,c);if(e.parentNode!=b){Sortable.options(b).onChange(f)}Sortable.options(e.parentNode).onChange(f)}}}},onEmptyHover:function(f,h,k){var l=f.parentNode;var a=Sortable.options(h);if(!Element.isParent(h,f)){var g;var c=Sortable.findElements(h,{tag:a.tag,only:a.only});var b=null;if(c){var e=Element.offsetSize(h,a.overlap)*(1-k);for(g=0;g<c.length;g+=1){if(e-Element.offsetSize(c[g],a.overlap)>=0){e-=Element.offsetSize(c[g],a.overlap)}else{if(e-(Element.offsetSize(c[g],a.overlap)/2)>=0){b=g+1<c.length?c[g+1]:null;break}else{b=c[g];break}}}}h.insertBefore(f,b);Sortable.options(l).onChange(f);a.onChange(f)}},unmark:function(){if(Sortable._marker){Sortable._marker.hide()}},mark:function(b,a){var e=Sortable.options(b.parentNode);if(e&&!e.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=b.cumulativeOffset();Sortable._marker.setStyle({left:c[0]+"px",top:c[1]+"px"});if(a=="after"){if(e.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(f,b,g){var e=Sortable.findElements(f,b)||[];for(var c=0;c<e.length;++c){var a=e[c].id.match(b.format);if(!a){continue}var h={id:encodeURIComponent(a?a[1]:null),element:f,parent:g,children:[],position:g.children.length,container:$(e[c]).down(b.treeTag)};if(h.container){this._tree(h.container,b,h)}g.children.push(h)}return g},tree:function(e){e=$(e);var c=this.options(e);var b=Object.extend({tag:c.tag,treeTag:c.treeTag,only:c.only,name:e.id,format:c.format},arguments[1]||{});var a={id:null,parent:null,children:[],container:e,position:0};return Sortable._tree(e,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 e={};this.findElements(b,a).each(function(f){if(f.id.match(a.format)){e[f.id.match(a.format)[1]]=[f,f.parentNode]}f.parentNode.removeChild(f)});c.each(function(f){var g=e[f];if(g){g[1].appendChild(g[0]);delete e[f]}})},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(e){return[a+Sortable._constructIndex(e)+"[id]="+encodeURIComponent(e.id)].concat(e.children.map(arguments.callee))}).flatten().join("&")}else{return Sortable.sequence(c,arguments[1]).map(function(e){return a+"[]="+encodeURIComponent(e)}).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(e,b,a,c){if(!e.hasChildNodes()){return null}c=c.toUpperCase();if(b){b=[b].flatten()}var f=[];$A(e.childNodes).each(function(h){if(h.tagName&&h.tagName.toUpperCase()==c&&(!b||(Element.classNames(h).detect(function(k){return b.include(k)})))){f.push(h)}if(a){var g=Element.findChildren(h,b,a,c);if(g){f.push(g)}}});return(f.length>0?f.flatten():[])};Element.offsetSize=function(a,b){return a["offset"+((b=="vertical"||b=="height")?"Height":"Width")]};
/*

  OpenLayers.js -- OpenLayers Map Viewer Library

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

  Includes compressed code under the following licenses:

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

*/
/* Contains portions of Prototype.js:
 *
 * Prototype JavaScript framework, version 1.4.0
 *  (c) 2005 Sam Stephenson <sam@conio.net>
 *
 *  Prototype is freely distributable under the terms of an MIT-style license.
 *  For details, see the Prototype web site: http://prototype.conio.net/
 *
 *--------------------------------------------------------------------------*/
/*  
*  
*  Contains portions of Rico <http://openrico.org/>
* 
*  Copyright 2005 Sabre Airline Solutions  
*  
*  Licensed under the Apache License, Version 2.0 (the "License"); you
*  may not use this file except in compliance with the License. You
*  may obtain a copy of the License at
*  
*         http://www.apache.org/licenses/LICENSE-2.0  
*  
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
*  implied. See the License for the specific language governing
*  permissions and limitations under the License. 
*
**/
/*
 * Contains XMLHttpRequest.js <http://code.google.com/p/xmlhttprequest/>
 * Copyright 2007 Sergey Ilinsky (http://www.ilinsky.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 */
/*
 * Contains portions of Gears <http://code.google.com/apis/gears/>
 *
 * Copyright 2007, Google Inc.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *  1. Redistributions of source code must retain the above copyright notice,
 *     this list of conditions and the following disclaimer.
 *  2. Redistributions in binary form must reproduce the above copyright notice,
 *     this list of conditions and the following disclaimer in the documentation
 *     and/or other materials provided with the distribution.
 *  3. Neither the name of Google Inc. nor the names of its contributors may be
 *     used to endorse or promote products derived from this software without
 *     specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Sets up google.gears.*, which is *the only* supported way to access Gears.
 *
 * Circumvent this file at your own risk!
 *
 * In the future, Gears may automatically define google.gears.* without this
 * file. Gears may use these objects to transparently fix bugs and compatibility
 * issues. Applications that use the code below will continue to work seamlessly
 * when that happens.
 */
var OpenLayers={singleFile:true};(function(){var l=(typeof OpenLayers=="object"&&OpenLayers.singleFile);var a;window.OpenLayers={_scriptName:(!l)?"lib/OpenLayers.js":"OpenLayers.js",_getScriptLocation:function(){if(a!=undefined){return a}a="";var t=new RegExp("(^|(.*?\\/))("+OpenLayers._scriptName+")(\\?|$)");var p=document.getElementsByTagName("script");for(var r=0,h=p.length;r<h;r++){var s=p[r].getAttribute("src");if(s){var q=s.match(t);if(q){a=q[1];break}}}return a}};if(!l){var m=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/Image/IFrame.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/Google/v3.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/WMS/Post.js","OpenLayers/Layer/WMTS.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/Layer/Zoomify.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/Control/WMTSGetFeatureInfo.js","OpenLayers/Control/Graticule.js","OpenLayers/Control/TransformFeature.js","OpenLayers/Control/SLDSelect.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/Filter.js","OpenLayers/Strategy/Fixed.js","OpenLayers/Strategy/Cluster.js","OpenLayers/Strategy/Paging.js","OpenLayers/Strategy/BBOX.js","OpenLayers/Strategy/Save.js","OpenLayers/Strategy/Refresh.js","OpenLayers/Filter.js","OpenLayers/Filter/FeatureId.js","OpenLayers/Filter/Logical.js","OpenLayers/Filter/Comparison.js","OpenLayers/Filter/Spatial.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/Protocol/SOS.js","OpenLayers/Protocol/SOS/v1_0_0.js","OpenLayers/Layer/PointTrack.js","OpenLayers/Layer/GML.js","OpenLayers/Style.js","OpenLayers/Style2.js","OpenLayers/StyleMap.js","OpenLayers/Rule.js","OpenLayers/Format.js","OpenLayers/Format/XML.js","OpenLayers/Format/Context.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/Atom.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/OWSCommon/v1.js","OpenLayers/Format/OWSCommon/v1_0_0.js","OpenLayers/Format/OWSCommon/v1_1_0.js","OpenLayers/Format/CSWGetDomain.js","OpenLayers/Format/CSWGetDomain/v2_0_2.js","OpenLayers/Format/CSWGetRecords.js","OpenLayers/Format/CSWGetRecords/v2_0_2.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.js","OpenLayers/Format/WMSCapabilities/v1_1.js","OpenLayers/Format/WMSCapabilities/v1_1_0.js","OpenLayers/Format/WMSCapabilities/v1_1_1.js","OpenLayers/Format/WMSCapabilities/v1_3.js","OpenLayers/Format/WMSCapabilities/v1_3_0.js","OpenLayers/Format/WMSGetFeatureInfo.js","OpenLayers/Format/SOSCapabilities.js","OpenLayers/Format/SOSCapabilities/v1_0_0.js","OpenLayers/Format/SOSGetObservation.js","OpenLayers/Format/SOSGetFeatureOfInterest.js","OpenLayers/Format/OWSContext.js","OpenLayers/Format/OWSContext/v0_3_1.js","OpenLayers/Format/WMTSCapabilities.js","OpenLayers/Format/WMTSCapabilities/v1_0_0.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/Symbolizer.js","OpenLayers/Symbolizer/Point.js","OpenLayers/Symbolizer/Line.js","OpenLayers/Symbolizer/Polygon.js","OpenLayers/Symbolizer/Text.js","OpenLayers/Symbolizer/Raster.js","OpenLayers/Lang.js","OpenLayers/Lang/en.js");var c=navigator.userAgent;var f=(c.match("MSIE")||c.match("Safari"));if(f){var b=new Array(m.length)}var n=OpenLayers._getScriptLocation()+"lib/";for(var e=0,k=m.length;e<k;e++){if(f){b[e]="<script src='"+n+m[e]+"'><\/script>"}else{var o=document.createElement("script");o.src=n+m[e];var g=document.getElementsByTagName("head").length?document.getElementsByTagName("head")[0]:document.body;g.appendChild(o)}}if(f){document.write(b.join(""))}}})();OpenLayers.VERSION_NUMBER="OpenLayers 2.10 -- $Revision: 10721 $";OpenLayers.String={startsWith:function(b,a){return(b.indexOf(a)==0)},contains:function(b,a){return(b.indexOf(a)!=-1)},trim:function(a){return a.replace(/^\s\s*/,"").replace(/\s\s*$/,"")},camelize:function(g){var e=g.split("-");var b=e[0];for(var c=1,a=e.length;c<a;c++){var f=e[c];b+=f.charAt(0).toUpperCase()+f.substring(1)}return b},format:function(e,c,a){if(!c){c=window}var b=function(l,f){var k;var h=f.split(/\.+/);for(var g=0;g<h.length;g++){if(g==0){k=c}k=k[h[g]]}if(typeof k=="function"){k=a?k.apply(null,a):k()}if(typeof k=="undefined"){return"undefined"}else{return k}};return e.replace(OpenLayers.String.tokenRegEx,b)},tokenRegEx:/\$\{([\w.]+?)\}/g,numberRegEx:/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,isNumeric:function(a){return OpenLayers.String.numberRegEx.test(a)},numericIf:function(a){return OpenLayers.String.isNumeric(a)?parseFloat(a):a}};if(!String.prototype.startsWith){String.prototype.startsWith=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.String.startsWith"}));return OpenLayers.String.startsWith(this,a)}}if(!String.prototype.contains){String.prototype.contains=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.String.contains"}));return OpenLayers.String.contains(this,a)}}if(!String.prototype.trim){String.prototype.trim=function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.String.trim"}));return OpenLayers.String.trim(this)}}if(!String.prototype.camelize){String.prototype.camelize=function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.String.camelize"}));return OpenLayers.String.camelize(this)}}OpenLayers.Number={decimalSeparator:".",thousandsSeparator:",",limitSigDigs:function(a,c){var b=0;if(c>0){b=parseFloat(a.toPrecision(c))}return b},format:function(c,a,h,l){a=(typeof a!="undefined")?a:0;h=(typeof h!="undefined")?h:OpenLayers.Number.thousandsSeparator;l=(typeof l!="undefined")?l:OpenLayers.Number.decimalSeparator;if(a!=null){c=parseFloat(c.toFixed(a))}var b=c.toString().split(".");if(b.length==1&&a==null){a=0}var e=b[0];if(h){var f=/(-?[0-9]+)([0-9]{3})/;while(f.test(e)){e=e.replace(f,"$1"+h+"$2")}}var g;if(a==0){g=e}else{var k=b.length>1?b[1]:"0";if(a!=null){k=k+new Array(a-k.length+1).join("0")}g=e+l+k}return g}};if(!Number.prototype.limitSigDigs){Number.prototype.limitSigDigs=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Number.limitSigDigs"}));return OpenLayers.Number.limitSigDigs(this,a)}}OpenLayers.Function={bind:function(c,b){var a=Array.prototype.slice.apply(arguments,[2]);return function(){var e=a.concat(Array.prototype.slice.apply(arguments,[0]));return c.apply(b,e)}},bindAsEventListener:function(b,a){return function(c){return b.call(a,c||window.event)}},False:function(){return false},True:function(){return true}};if(!Function.prototype.bind){Function.prototype.bind=function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Function.bind"}));Array.prototype.unshift.apply(arguments,[this]);return OpenLayers.Function.bind.apply(null,arguments)}}if(!Function.prototype.bindAsEventListener){Function.prototype.bindAsEventListener=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Function.bindAsEventListener"}));return OpenLayers.Function.bindAsEventListener(this,a)}}OpenLayers.Array={filter:function(h,g,b){var e=[];if(Array.prototype.filter){e=h.filter(g,b)}else{var a=h.length;if(typeof g!="function"){throw new TypeError()}for(var c=0;c<a;c++){if(c in h){var f=h[c];if(g.call(b,f,c,h)){e.push(f)}}}}return e}};OpenLayers.Date={toISOString:(function(){if("toISOString" in Date.prototype){return function(b){return b.toISOString()}}else{function a(c,b){var e=c+"";while(e.length<b){e="0"+e}return e}return function(b){var c;if(isNaN(b.getTime())){c="Invalid Date"}else{c=b.getUTCFullYear()+"-"+a(b.getUTCMonth()+1,2)+"-"+a(b.getUTCDate(),2)+"T"+a(b.getUTCHours(),2)+":"+a(b.getUTCMinutes(),2)+":"+a(b.getUTCSeconds(),2)+"."+a(b.getUTCMilliseconds(),3)+"Z"}return c}}})(),parse:function(m){var b;var s=Date.parse(m);if(!isNaN(s)){b=new Date(s)}else{var k=m.match(/^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))?$/);var b;if(k&&(k[1]||k[7])){var n=parseInt(k[1],10)||0;var l=(parseInt(k[2],10)-1)||0;var p=parseInt(k[3],10)||1;b=new Date(Date.UTC(n,l,p));var o=k[7];if(o){var q=parseInt(k[4],10);var e=parseInt(k[5],10);var a=parseFloat(k[6]);var r=a|0;var c=Math.round(1000*(a-r));b.setUTCHours(q,e,r,c);if(o!=="Z"){var h=parseInt(o,10);var g=parseInt(k[8])||0;var f=-1000*(60*(h*60)+g*60);b=new Date(b.getTime()+f)}}}else{b=new Date("invalid")}}return b}};OpenLayers.Class=function(){var f=function(){if(arguments&&arguments[0]!=OpenLayers.Class.isPrototype){this.initialize.apply(this,arguments)}};var c={};var h,b,e;for(var g=0,a=arguments.length;g<a;++g){e=arguments[g];if(typeof e=="function"){if(g==0&&a>1){b=e.prototype.initialize;e.prototype.initialize=function(){};c=new e();if(b===undefined){delete e.prototype.initialize}else{e.prototype.initialize=b}}h=e.prototype}else{h=e}OpenLayers.Util.extend(c,h)}f.prototype=c;return f};OpenLayers.Class.isPrototype=function(){};OpenLayers.Class.create=function(){return function(){if(arguments&&arguments[0]!=OpenLayers.Class.isPrototype){this.initialize.apply(this,arguments)}}};OpenLayers.Class.inherit=function(){var e=arguments[0];var f=new e(OpenLayers.Class.isPrototype);for(var c=1,a=arguments.length;c<a;c++){if(typeof arguments[c]=="function"){var b=arguments[c];arguments[c]=new b(OpenLayers.Class.isPrototype)}OpenLayers.Util.extend(f,arguments[c])}return f};OpenLayers.Util={};OpenLayers.Util.getElement=function(){var e=[];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}e.push(b)}return e};OpenLayers.Util.isElement=function(a){return !!(a&&a.nodeType===1)};if(typeof window.$==="undefined"){window.$=OpenLayers.Util.getElement}OpenLayers.Util.extend=function(a,f){a=a||{};if(f){for(var e in f){var c=f[e];if(c!==undefined){a[e]=c}}var b=typeof window.Event=="function"&&f instanceof window.Event;if(!b&&f.hasOwnProperty&&f.hasOwnProperty("toString")){a.toString=f.toString}}return a};OpenLayers.Util.removeItem=function(c,b){for(var a=c.length-1;a>=0;a--){if(c[a]==b){c.splice(a,1)}}return c};OpenLayers.Util.clearArray=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"array = []"}));a.length=0};OpenLayers.Util.indexOf=function(e,c){if(typeof e.indexOf=="function"){return e.indexOf(c)}else{for(var b=0,a=e.length;b<a;b++){if(e[b]==c){return b}}return -1}};OpenLayers.Util.modifyDOMElement=function(f,k,e,g,a,c,h,b){if(k){f.id=k}if(e){f.style.left=e.x+"px";f.style.top=e.y+"px"}if(g){f.style.width=g.w+"px";f.style.height=g.h+"px"}if(a){f.style.position=a}if(c){f.style.border=c}if(h){f.style.overflow=h}if(parseFloat(b)>=0&&parseFloat(b)<1){f.style.filter="alpha(opacity="+(b*100)+")";f.style.opacity=b}else{if(parseFloat(b)==1){f.style.filter="";f.style.opacity=""}}};OpenLayers.Util.createDiv=function(a,l,k,g,f,c,b,h){var e=document.createElement("div");if(g){e.style.backgroundImage="url("+g+")"}if(!a){a=OpenLayers.Util.createUniqueID("OpenLayersDiv")}if(!f){f="absolute"}OpenLayers.Util.modifyDOMElement(e,a,l,k,f,c,b,h);return e};OpenLayers.Util.createImage=function(a,k,h,f,e,c,g,l){var b=document.createElement("img");if(!a){a=OpenLayers.Util.createUniqueID("OpenLayersDiv")}if(!e){e="relative"}OpenLayers.Util.modifyDOMElement(b,a,k,h,e,c,null,g);if(l){b.style.display="none";OpenLayers.Event.observe(b,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,b));OpenLayers.Event.observe(b,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,b))}b.style.alt=a;b.galleryImg="no";if(f){b.src=f}return b};OpenLayers.Util.setOpacity=function(b,a){OpenLayers.Util.modifyDOMElement(b,null,null,null,null,null,null,a)};OpenLayers.Util.onImageLoad=function(){if(!this.viewRequestID||(this.map&&this.viewRequestID==this.map.viewRequestID)){this.style.display=""}OpenLayers.Element.removeClass(this,"olImageLoadError")};OpenLayers.IMAGE_RELOAD_ATTEMPTS=0;OpenLayers.Util.onImageLoadError=function(){this._attempts=(this._attempts)?(this._attempts+1):1;if(this._attempts<=OpenLayers.IMAGE_RELOAD_ATTEMPTS){var e=this.urls;if(e&&e instanceof Array&&e.length>1){var f=this.src.toString();var c,a;for(a=0;c=e[a];a++){if(f.indexOf(c)!=-1){break}}var g=Math.floor(e.length*Math.random());var b=e[g];a=0;while(b==c&&a++<4){g=Math.floor(e.length*Math.random());b=e[g]}this.src=f.replace(c,b)}else{this.src=this.src}}else{OpenLayers.Element.addClass(this,"olImageLoadError")}this.style.display=""};OpenLayers.Util.alphaHackNeeded=null;OpenLayers.Util.alphaHack=function(){if(OpenLayers.Util.alphaHackNeeded==null){var f=navigator.appVersion.split("MSIE");var a=parseFloat(f[1]);var b=false;try{b=!!(document.body.filters)}catch(c){}OpenLayers.Util.alphaHackNeeded=(b&&(a>=5.5)&&(a<7))}return OpenLayers.Util.alphaHackNeeded};OpenLayers.Util.modifyAlphaImageDiv=function(a,b,m,l,h,g,c,e,k){OpenLayers.Util.modifyDOMElement(a,b,m,l,g,null,null,k);var f=a.childNodes[0];if(h){f.src=h}OpenLayers.Util.modifyDOMElement(f,a.id+"_innerImage",null,l,"relative",c);if(OpenLayers.Util.alphaHack()){if(a.style.display!="none"){a.style.display="inline-block"}if(e==null){e="scale"}a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+f.src+"', sizingMethod='"+e+"')";if(parseFloat(a.style.opacity)>=0&&parseFloat(a.style.opacity)<1){a.style.filter+=" alpha(opacity="+a.style.opacity*100+")"}f.style.filter="alpha(opacity=0)"}};OpenLayers.Util.modifyCssSpriteDiv=function(a,b,l,k,g,f,c,e,h){OpenLayers.Util.modifyDOMElement(a,b,l,k,f,null,null,h);if(g){$(a).addClassName(g)}};OpenLayers.Util.createAlphaImageDiv=function(b,m,l,h,g,c,e,k,n){var a=OpenLayers.Util.createDiv();var f=OpenLayers.Util.createImage(null,null,null,null,null,null,null,false);a.appendChild(f);if(n){f.style.display="none";OpenLayers.Event.observe(f,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,a));OpenLayers.Event.observe(f,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,a))}OpenLayers.Util.modifyAlphaImageDiv(a,b,m,l,h,g,c,e,k);return a};OpenLayers.Util.createCssSpriteDiv=function(b,l,k,g,f,c,e,h,m){var a=OpenLayers.Util.createDiv();OpenLayers.Util.modifyCssSpriteDiv(a,b,l,k,g,f,c,e,h);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(e,c){e=e||{};var b=typeof window.Event=="function"&&c instanceof window.Event;for(var a in c){if(e[a]===undefined||(!b&&c.hasOwnProperty&&c.hasOwnProperty(a)&&!e.hasOwnProperty(a))){e[a]=c[a]}}if(!b&&c&&c.hasOwnProperty&&c.hasOwnProperty("toString")&&!e.hasOwnProperty("toString")){e.toString=c.toString}return e};OpenLayers.Util.getParameterString=function(c){var b=[];for(var k in c){var h=c[k];if((h!=null)&&(typeof h!="function")){var e;if(typeof h=="object"&&h.constructor==Array){var f=[];var l;for(var a=0,g=h.length;a<g;a++){l=h[a];f.push(encodeURIComponent((l===null||l===undefined)?"":l))}e=f.join(",")}else{e=encodeURIComponent(h)}b.push(encodeURIComponent(k)+"="+e)}}return b.join("&")};OpenLayers.Util.urlAppend=function(a,b){var e=a;if(b){var c=(a+" ").split(/[?&]/);e+=(c.pop()===" "?b:c.length?"&"+b:"?"+b)}return e};OpenLayers.ImgPath="";OpenLayers.Util.getImagesLocation=function(){return OpenLayers.ImgPath||(OpenLayers._getScriptLocation()+"img/")};OpenLayers.Util.Try=function(){var f=null;for(var c=0,a=arguments.length;c<a;c++){var b=arguments[c];try{f=b();break}catch(g){}}return f};OpenLayers.Util.getNodes=function(c,b){var a=OpenLayers.Util.Try(function(){return OpenLayers.Util._getNodes(c.documentElement.childNodes,b)},function(){return OpenLayers.Util._getNodes(c.childNodes,b)});return a};OpenLayers.Util._getNodes=function(c,f){var b=[];for(var e=0,a=c.length;e<a;e++){if(c[e].nodeName==f){b.push(c[e])}}return b};OpenLayers.Util.getTagText=function(c,e,b){var a=OpenLayers.Util.getNodes(c,e);if(a&&(a.length>0)){if(!b){b=0}if(a[b].childNodes.length>1){return a.childNodes[1].nodeValue}else{if(a[b].childNodes.length==1){return a[b].firstChild.nodeValue}}}else{return""}};OpenLayers.Util.getXmlNodeValue=function(a){var b=null;OpenLayers.Util.Try(function(){b=a.text;if(!b){b=a.textContent}if(!b){b=a.firstChild.nodeValue}},function(){b=a.textContent});return b};OpenLayers.Util.mouseLeft=function(a,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.deg=function(a){return a*180/Math.PI};OpenLayers.Util.VincentyConstants={a:6378137,b:6356752.3142,f:1/298.257223563};OpenLayers.Util.distVincenty=function(g,e){var m=OpenLayers.Util.VincentyConstants;var P=m.a,O=m.b,J=m.f;var p=OpenLayers.Util.rad(e.lon-g.lon);var N=Math.atan((1-J)*Math.tan(OpenLayers.Util.rad(g.lat)));var M=Math.atan((1-J)*Math.tan(OpenLayers.Util.rad(e.lat)));var o=Math.sin(N),k=Math.cos(N);var n=Math.sin(M),h=Math.cos(M);var u=p,q=2*Math.PI;var t=20;while(Math.abs(u-q)>1e-12&&--t>0){var F=Math.sin(u),c=Math.cos(u);var Q=Math.sqrt((h*F)*(h*F)+(k*n-o*h*c)*(k*n-o*h*c));if(Q==0){return 0}var H=o*n+k*h*c;var E=Math.atan2(Q,H);var l=Math.asin(k*h*F/Q);var I=Math.cos(l)*Math.cos(l);var r=H-2*o*n/I;var y=J/16*I*(4+J*(4-3*I));q=u;u=p+(1-y)*J*Math.sin(l)*(E+y*Q*(r+y*H*(-1+2*r*r)))}if(t==0){return NaN}var w=I*(P*P-O*O)/(O*O);var D=1+w/16384*(4096+w*(-768+w*(320-175*w)));var z=w/1024*(256+w*(-128+w*(74-47*w)));var G=z*Q*(r+z/4*(H*(-1+2*r*r)-z/6*r*(-3+4*Q*Q)*(-3+4*r*r)));var v=O*D*(E-G);var K=v.toFixed(3)/1000;return K};OpenLayers.Util.destinationVincenty=function(o,T,I){var r=OpenLayers.Util;var l=r.VincentyConstants;var U=l.a,S=l.b,O=l.f;var R=o.lon;var h=o.lat;var v=I;var H=r.rad(T);var K=Math.sin(H);var k=Math.cos(H);var J=(1-O)*Math.tan(r.rad(h));var c=1/Math.sqrt((1+J*J)),m=J*c;var t=Math.atan2(J,k);var F=c*K;var N=1-F*F;var y=N*(U*U-S*S)/(S*S);var E=1+y/16384*(4096+y*(-768+y*(320-175*y)));var z=y/1024*(256+y*(-128+y*(74-47*y)));var D=v/(S*E),P=2*Math.PI;while(Math.abs(D-P)>1e-12){var p=Math.cos(2*t+D);var V=Math.sin(D);var M=Math.cos(D);var G=z*V*(p+z/4*(M*(-1+2*p*p)-z/6*p*(-3+4*V*V)*(-3+4*p*p)));P=D;D=v/(S*E)+G}var Q=m*V-c*M*k;var e=Math.atan2(m*M+c*V*k,(1-O)*Math.sqrt(F*F+Q*Q));var q=Math.atan2(V*K,c*M-m*V*k);var w=O/16*N*(4+O*(4-3*N));var n=q-(1-w)*O*F*(D+w*V*(p+w*M*(-1+2*p*p)));var g=Math.atan2(F,-Q);return new OpenLayers.LonLat(R+r.deg(n),r.deg(e))};OpenLayers.Util.getParameters=function(b){b=b||window.location.href;var a="";if(OpenLayers.String.contains(b,"?")){var c=b.indexOf("?")+1;var f=OpenLayers.String.contains(b,"#")?b.indexOf("#"):b.length;a=b.substring(c,f)}var n={};var e=a.split(/[&;]/);for(var h=0,k=e.length;h<k;++h){var g=e[h].split("=");if(g[0]){var m=decodeURIComponent(g[0]);var l=g[1]||"";l=decodeURIComponent(l.replace(/\+/g," ")).split(",");if(l.length==1){l=l[0]}n[m]=l}}return n};OpenLayers.Util.getArgs=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Util.getParameters"}));return OpenLayers.Util.getParameters(a)};OpenLayers.Util.lastSeqID=0;OpenLayers.Util.createUniqueID=function(a){if(a==null){a="id_"}OpenLayers.Util.lastSeqID+=1;return a+OpenLayers.Util.lastSeqID};OpenLayers.INCHES_PER_UNIT={inches:1,ft:12,mi:63360,m:39.3701,km:39370.1,dd:4374754,yd:36};OpenLayers.INCHES_PER_UNIT["in"]=OpenLayers.INCHES_PER_UNIT.inches;OpenLayers.INCHES_PER_UNIT.degrees=OpenLayers.INCHES_PER_UNIT.dd;OpenLayers.INCHES_PER_UNIT.nmi=1852*OpenLayers.INCHES_PER_UNIT.m;OpenLayers.METERS_PER_INCH=0.0254000508001016;OpenLayers.Util.extend(OpenLayers.INCHES_PER_UNIT,{Inch:OpenLayers.INCHES_PER_UNIT.inches,Meter:1/OpenLayers.METERS_PER_INCH,Foot:0.3048006096012192/OpenLayers.METERS_PER_INCH,IFoot:0.3048/OpenLayers.METERS_PER_INCH,ClarkeFoot:0.3047972651151/OpenLayers.METERS_PER_INCH,SearsFoot:0.30479947153867626/OpenLayers.METERS_PER_INCH,GoldCoastFoot:0.3047997101815088/OpenLayers.METERS_PER_INCH,IInch:0.0254/OpenLayers.METERS_PER_INCH,MicroInch:0.0000254/OpenLayers.METERS_PER_INCH,Mil:2.54e-8/OpenLayers.METERS_PER_INCH,Centimeter:0.01/OpenLayers.METERS_PER_INCH,Kilometer:1000/OpenLayers.METERS_PER_INCH,Yard:0.9144018288036576/OpenLayers.METERS_PER_INCH,SearsYard:0.914398414616029/OpenLayers.METERS_PER_INCH,IndianYard:0.9143985307444408/OpenLayers.METERS_PER_INCH,IndianYd37:0.91439523/OpenLayers.METERS_PER_INCH,IndianYd62:0.9143988/OpenLayers.METERS_PER_INCH,IndianYd75:0.9143985/OpenLayers.METERS_PER_INCH,IndianFoot:0.30479951/OpenLayers.METERS_PER_INCH,IndianFt37:0.30479841/OpenLayers.METERS_PER_INCH,IndianFt62:0.3047996/OpenLayers.METERS_PER_INCH,IndianFt75:0.3047995/OpenLayers.METERS_PER_INCH,Mile:1609.3472186944373/OpenLayers.METERS_PER_INCH,IYard:0.9144/OpenLayers.METERS_PER_INCH,IMile:1609.344/OpenLayers.METERS_PER_INCH,NautM:1852/OpenLayers.METERS_PER_INCH,"Lat-66":110943.31648893273/OpenLayers.METERS_PER_INCH,"Lat-83":110946.25736872235/OpenLayers.METERS_PER_INCH,Decimeter:0.1/OpenLayers.METERS_PER_INCH,Millimeter:0.001/OpenLayers.METERS_PER_INCH,Dekameter:10/OpenLayers.METERS_PER_INCH,Decameter:10/OpenLayers.METERS_PER_INCH,Hectometer:100/OpenLayers.METERS_PER_INCH,GermanMeter:1.0000135965/OpenLayers.METERS_PER_INCH,CaGrid:0.999738/OpenLayers.METERS_PER_INCH,ClarkeChain:20.1166194976/OpenLayers.METERS_PER_INCH,GunterChain:20.11684023368047/OpenLayers.METERS_PER_INCH,BenoitChain:20.116782494375872/OpenLayers.METERS_PER_INCH,SearsChain:20.11676512155/OpenLayers.METERS_PER_INCH,ClarkeLink:0.201166194976/OpenLayers.METERS_PER_INCH,GunterLink:0.2011684023368047/OpenLayers.METERS_PER_INCH,BenoitLink:0.20116782494375873/OpenLayers.METERS_PER_INCH,SearsLink:0.2011676512155/OpenLayers.METERS_PER_INCH,Rod:5.02921005842012/OpenLayers.METERS_PER_INCH,IntnlChain:20.1168/OpenLayers.METERS_PER_INCH,IntnlLink:0.201168/OpenLayers.METERS_PER_INCH,Perch:5.02921005842012/OpenLayers.METERS_PER_INCH,Pole:5.02921005842012/OpenLayers.METERS_PER_INCH,Furlong:201.1684023368046/OpenLayers.METERS_PER_INCH,Rood:3.778266898/OpenLayers.METERS_PER_INCH,CapeFoot:0.3047972615/OpenLayers.METERS_PER_INCH,Brealey:375/OpenLayers.METERS_PER_INCH,ModAmFt:0.304812252984506/OpenLayers.METERS_PER_INCH,Fathom:1.8288/OpenLayers.METERS_PER_INCH,"NautM-UK":1853.184/OpenLayers.METERS_PER_INCH,"50kilometers":50000/OpenLayers.METERS_PER_INCH,"150kilometers":150000/OpenLayers.METERS_PER_INCH});OpenLayers.Util.extend(OpenLayers.INCHES_PER_UNIT,{mm:OpenLayers.INCHES_PER_UNIT.Meter/1000,cm:OpenLayers.INCHES_PER_UNIT.Meter/100,dm:OpenLayers.INCHES_PER_UNIT.Meter*100,km:OpenLayers.INCHES_PER_UNIT.Meter*1000,kmi:OpenLayers.INCHES_PER_UNIT.nmi,fath:OpenLayers.INCHES_PER_UNIT.Fathom,ch:OpenLayers.INCHES_PER_UNIT.IntnlChain,link:OpenLayers.INCHES_PER_UNIT.IntnlLink,"us-in":OpenLayers.INCHES_PER_UNIT.inches,"us-ft":OpenLayers.INCHES_PER_UNIT.Foot,"us-yd":OpenLayers.INCHES_PER_UNIT.Yard,"us-ch":OpenLayers.INCHES_PER_UNIT.GunterChain,"us-mi":OpenLayers.INCHES_PER_UNIT.Mile,"ind-yd":OpenLayers.INCHES_PER_UNIT.IndianYd37,"ind-ft":OpenLayers.INCHES_PER_UNIT.IndianFt37,"ind-ch":20.11669506/OpenLayers.METERS_PER_INCH});OpenLayers.DOTS_PER_INCH=72;OpenLayers.Util.normalizeScale=function(b){var a=(b>1)?(1/b):b;return a};OpenLayers.Util.getResolutionFromScale=function(e,a){var b;if(e){if(a==null){a="degrees"}var c=OpenLayers.Util.normalizeScale(e);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(g){var a=0,f=0;var b=g;var h=g;while(b){if(b==document.body){if(OpenLayers.Element.getStyle(h,"position")=="absolute"){break}}a+=b.offsetTop||0;f+=b.offsetLeft||0;h=b;try{b=b.offsetParent}catch(c){OpenLayers.Console.error(OpenLayers.i18n("pagePositionFailed",{elemId:b.id}));break}}b=g;while(b){a-=b.scrollTop||0;f-=b.scrollLeft||0;b=b.parentNode}return[f,a]};OpenLayers.Util.isEquivalentUrl=function(g,f,c){c=c||{};OpenLayers.Util.applyDefaults(c,{ignoreCase:true,ignorePort80:true,ignoreHash:true});var b=OpenLayers.Util.createUrlObject(g,c);var a=OpenLayers.Util.createUrlObject(f,c);for(var e in b){if(e!=="args"){if(b[e]!=a[e]){return false}}}for(var e in b.args){if(b.args[e]!=a.args[e]){return false}delete a.args[e]}for(var e in a.args){return false}return true};OpenLayers.Util.createUrlObject=function(c,n){n=n||{};if(!(/^\w+:\/\//).test(c)){var h=window.location;var f=h.port?":"+h.port:"";var k=h.protocol+"//"+h.host.split(":").shift()+f;if(c.indexOf("/")===0){c=k+c}else{var g=h.pathname.split("/");g.pop();c=k+g.join("/")+"/"+c}}if(n.ignoreCase){c=c.toLowerCase()}var l=document.createElement("a");l.href=c;var e={};e.host=l.host.split(":").shift();e.protocol=l.protocol;if(n.ignorePort80){e.port=(l.port=="80"||l.port=="0")?"":l.port}else{e.port=(l.port==""||l.port=="0")?"80":l.port}e.hash=(n.ignoreHash||l.hash==="#")?"":l.hash;var b=l.search;if(!b){var m=c.indexOf("?");b=(m!=-1)?c.substr(m):""}e.args=OpenLayers.Util.getParameters(b);e.pathname=(l.pathname.charAt(0)=="/")?l.pathname:"/"+l.pathname;return e};OpenLayers.Util.removeTail=function(b){var c=null;var a=b.indexOf("?");var e=b.indexOf("#");if(a==-1){c=(e!=-1)?b.substr(0,e):b}else{c=(e!=-1)?b.substr(0,Math.min(a,e)):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 n,f;var a=document.createElement("div");a.style.visibility="hidden";var p=(r&&r.containerElement)?r.containerElement:document.body;if(q){if(q.w){n=q.w;a.style.width=n+"px"}else{if(q.h){f=q.h;a.style.height=f+"px"}}}if(r&&r.displayClass){a.className=r.displayClass}var g=document.createElement("div");g.innerHTML=b;g.style.overflow="visible";if(g.childNodes){for(var e=0,c=g.childNodes.length;e<c;e++){if(!g.childNodes[e].style){continue}g.childNodes[e].style.overflow="visible"}}a.appendChild(g);p.appendChild(a);var o=false;var m=a.parentNode;while(m&&m.tagName.toLowerCase()!="body"){var k=OpenLayers.Element.getStyle(m,"position");if(k=="absolute"){o=true;break}else{if(k&&k!="static"){break}}m=m.parentNode}if(!o){a.style.position="absolute"}if(!n){n=parseInt(g.scrollWidth);a.style.width=n+"px"}if(!f){f=parseInt(g.scrollHeight)}a.removeChild(g);p.removeChild(a);return new OpenLayers.Size(n,f)};OpenLayers.Util.getScrollbarWidth=function(){var c=OpenLayers.Util._scrollbarWidth;if(c==null){var f=null;var e=null;var a=0;var b=0;f=document.createElement("div");f.style.position="absolute";f.style.top="-1000px";f.style.left="-1000px";f.style.width="100px";f.style.height="50px";f.style.overflow="hidden";e=document.createElement("div");e.style.width="100%";e.style.height="200px";f.appendChild(e);document.body.appendChild(f);a=e.offsetWidth;f.style.overflow="scroll";b=e.offsetWidth;document.body.removeChild(document.body.lastChild);OpenLayers.Util._scrollbarWidth=(a-b);c=OpenLayers.Util._scrollbarWidth}return c};OpenLayers.Util.getFormattedLonLat=function(k,b,f){if(!f){f="dms"}var e=Math.abs(k);var l=Math.floor(e);var a=(e-l)/(1/60);var c=a;a=Math.floor(a);var h=(c-a)/(1/60);h=Math.round(h*10);h/=10;if(l<10){l="0"+l}var g=l+"\u00B0";if(f.indexOf("dm")>=0){if(a<10){a="0"+a}g+=a+"'";if(f.indexOf("dms")>=0){if(h<10){h="0"+h}g+=h+'"'}}if(b=="lon"){g+=k<0?OpenLayers.i18n("W"):OpenLayers.i18n("E")}else{g+=k<0?OpenLayers.i18n("S"):OpenLayers.i18n("N")}return g};OpenLayers.Rico=new Object();OpenLayers.Rico.Corner={round:function(f,b){f=OpenLayers.Util.getElement(f);this._setOptions(b);var a=this.options.color;if(this.options.color=="fromElement"){a=this._background(f)}var c=this.options.bgColor;if(this.options.bgColor=="fromParent"){c=this._background(f.offsetParent)}this._roundCornersImpl(f,a,c)},changeColor:function(c,b){c.style.backgroundColor=b;var a=c.parentNode.getElementsByTagName("span");for(var e=0;e<a.length;e++){a[e].style.backgroundColor=b}},changeOpacity:function(c,g){var e=g;var a="alpha(opacity="+g*100+")";c.style.opacity=e;c.style.filter=a;var b=c.parentNode.getElementsByTagName("span");for(var f=0;f<b.length;f++){b[f].style.opacity=e;b[f].style.filter=a}},reRound:function(e,c){var b=e.parentNode.childNodes[0];var a=e.parentNode.childNodes[2];e.parentNode.removeChild(b);e.parentNode.removeChild(a);this.round(e.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(e,f){var b="1px solid "+this._borderColor(f);var a="border-left: "+b;var g="border-right: "+b;var c="style='"+a+";"+g+"'";e.innerHTML="<div "+c+">"+e.innerHTML+"</div>"},_roundTopCorners:function(c,a,f){var e=this._createCorner(f);for(var b=0;b<this.options.numSlices;b++){e.appendChild(this._createCornerSlice(a,f,b,"top"))}c.style.paddingTop=0;c.insertBefore(e,c.firstChild)},_roundBottomCorners:function(c,a,f){var e=this._createCorner(f);for(var b=(this.options.numSlices-1);b>=0;b--){e.appendChild(this._createCornerSlice(a,f,b,"bottom"))}c.style.paddingBottom=0;c.appendChild(e)},_createCorner:function(b){var a=document.createElement("div");a.style.backgroundColor=(this._isTransparent()?"transparent":b);return a},_createCornerSlice:function(c,e,h,a){var f=document.createElement("span");var b=f.style;b.backgroundColor=c;b.display="block";b.height="1px";b.overflow="hidden";b.fontSize="1px";var g=this._borderColor(c,e);if(this.options.border&&h==0){b.borderTopStyle="solid";b.borderTopWidth="1px";b.borderLeftWidth="0px";b.borderRightWidth="0px";b.borderBottomWidth="0px";b.height="0px";b.borderColor=g}else{if(g){b.borderColor=g;b.borderStyle="solid";b.borderWidth="0px 1px"}}if(!this.options.compact&&(h==(this.options.numSlices-1))){b.height="2px"}this._setMargin(f,h,a);this._setBorder(f,h,a);return f},_setOptions:function(a){this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:true,border:false,compact:false};OpenLayers.Util.extend(this.options,a||{});this.options.numSlices=this.options.compact?2:4;if(this._isTransparent()){this.options.blend=false}},_whichSideTop:function(){if(this._hasString(this.options.corners,"all","top")){return""}if(this.options.corners.indexOf("tl")>=0&&this.options.corners.indexOf("tr")>=0){return""}if(this.options.corners.indexOf("tl")>=0){return"left"}else{if(this.options.corners.indexOf("tr")>=0){return"right"}}return""},_whichSideBottom:function(){if(this._hasString(this.options.corners,"all","bottom")){return""}if(this.options.corners.indexOf("bl")>=0&&this.options.corners.indexOf("br")>=0){return""}if(this.options.corners.indexOf("bl")>=0){return"left"}else{if(this.options.corners.indexOf("br")>=0){return"right"}}return""},_borderColor:function(a,b){if(a=="transparent"){return b}else{if(this.options.border){return this.options.border}else{if(this.options.blend){return this._blend(b,a)}else{return""}}}},_setMargin:function(e,f,b){var c=this._marginSize(f);var a=b=="top"?this._whichSideTop():this._whichSideBottom();if(a=="left"){e.style.marginLeft=c+"px";e.style.marginRight="0px"}else{if(a=="right"){e.style.marginRight=c+"px";e.style.marginLeft="0px"}else{e.style.marginLeft=c+"px";e.style.marginRight=c+"px"}}},_setBorder:function(e,f,b){var c=this._borderSize(f);var a=b=="top"?this._whichSideTop():this._whichSideBottom();if(a=="left"){e.style.borderLeftWidth=c+"px";e.style.borderRightWidth="0px"}else{if(a=="right"){e.style.borderRightWidth=c+"px";e.style.borderLeftWidth="0px"}else{e.style.borderLeftWidth=c+"px";e.style.borderRightWidth=c+"px"}}if(this.options.border!=false){e.style.borderLeftWidth=c+"px";e.style.borderRightWidth=c+"px"}},_marginSize:function(f){if(this._isTransparent()){return 0}var e=[5,3,2,1];var a=[3,2,1,0];var c=[2,1];var b=[1,0];if(this.options.compact&&this.options.blend){return b[f]}else{if(this.options.compact){return c[f]}else{if(this.options.blend){return a[f]}else{return e[f]}}}},_borderSize:function(f){var e=[5,3,2,1];var b=[2,1,1,1];var a=[1,0];var c=[0,2,0,0];if(this.options.compact&&(this.options.blend||this._isTransparent())){return 1}else{if(this.options.compact){return a[f]}else{if(this.options.blend){return b[f]}else{if(this.options.border){return c[f]}else{if(this._isTransparent()){return e[f]}}}}}return 0},_hasString:function(b){for(var a=1;a<arguments.length;a++){if(b.indexOf(arguments[a])>=0){return true}}return false},_blend:function(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 e=OpenLayers.Element.visible(b)?"hide":"show";OpenLayers.Element[e](b)}},hide:function(){for(var c=0,a=arguments.length;c<a;c++){var b=OpenLayers.Util.getElement(arguments[c]);if(b){b.style.display="none"}}},show:function(){for(var c=0,a=arguments.length;c<a;c++){var b=OpenLayers.Util.getElement(arguments[c]);if(b){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(c){c=OpenLayers.Util.getElement(c);if(OpenLayers.Element.getStyle(c,"display")!="none"){return{width:c.offsetWidth,height:c.offsetHeight}}var b=c.style;var g=b.visibility;var e=b.position;var a=b.display;b.visibility="hidden";b.position="absolute";b.display="";var h=c.clientWidth;var f=c.clientHeight;b.display=a;b.position=e;b.visibility=g;return{width:h,height:f}},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,e){c=OpenLayers.Util.getElement(c);var f=null;if(c&&c.style){f=c.style[OpenLayers.String.camelize(e)];if(!f){if(document.defaultView&&document.defaultView.getComputedStyle){var b=document.defaultView.getComputedStyle(c,null);f=b?b.getPropertyValue(e):null}else{if(c.currentStyle){f=c.currentStyle[OpenLayers.String.camelize(e)]}}}var a=["left","top","right","bottom"];if(window.opera&&(OpenLayers.Util.indexOf(a,e)!=-1)&&(OpenLayers.Element.getStyle(c,"position")=="static")){f="auto"}}return f=="auto"?null:f}};OpenLayers.Size=OpenLayers.Class({w:0,h:0,initialize:function(a,b){this.w=parseFloat(a);this.h=parseFloat(b)},toString:function(){return("w="+this.w+",h="+this.h)},clone:function(){return new OpenLayers.Size(this.w,this.h)},equals:function(b){var a=false;if(b!=null){a=((this.w==b.w&&this.h==b.h)||(isNaN(this.w)&&isNaN(this.h)&&isNaN(b.w)&&isNaN(b.h)))}return a},CLASS_NAME:"OpenLayers.Size"});OpenLayers.Console={log:function(){},debug:function(){},info:function(){},warn:function(){},error:function(){},userError:function(a){alert(a)},assert:function(){},dir:function(){},dirxml:function(){},trace:function(){},group:function(){},groupEnd:function(){},time:function(){},timeEnd:function(){},profile:function(){},profileEnd:function(){},count:function(){},CLASS_NAME:"OpenLayers.Console"};(function(){var b=document.getElementsByTagName("script");for(var c=0,a=b.length;c<a;++c){if(b[c].src.indexOf("firebug.js")!=-1){if(console){OpenLayers.Util.extend(OpenLayers.Console,console);break}}}})();OpenLayers.Icon=OpenLayers.Class({url:null,size:null,offset:null,calculateOffset:null,imageDiv:null,px:null,initialize:function(a,b,e,c){this.url=a;this.size=(b)?b:new OpenLayers.Size(20,20);this.offset=e?e:new OpenLayers.Pixel(-(this.size.w/2),-(this.size.h/2));this.calculateOffset=c;var f=OpenLayers.Util.createUniqueID("OL_Icon_");this.imageDiv=OpenLayers.Util.createCssSpriteDiv(f)},destroy:function(){this.erase();OpenLayers.Event.stopObservingElement(this.imageDiv.firstChild);this.imageDiv.innerHTML="";this.imageDiv=null},clone:function(){return new OpenLayers.Icon(this.url,this.size,this.offset,this.calculateOffset)},setSize:function(a){if(a!=null){this.size=a}this.draw()},setUrl:function(a){if(a!=null){this.url=a}this.draw()},draw:function(a){OpenLayers.Util.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(h,c,g,b,f,e){if(h==null){h=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")}this.id=h;this.lonlat=c;this.contentSize=(g!=null)?g:new OpenLayers.Size(OpenLayers.Popup.WIDTH,OpenLayers.Popup.HEIGHT);if(b!=null){this.contentHTML=b}this.backgroundColor=OpenLayers.Popup.COLOR;this.opacity=OpenLayers.Popup.OPACITY;this.border=OpenLayers.Popup.BORDER;this.div=OpenLayers.Util.createDiv(this.id,null,null,null,null,null,"hidden");this.div.className=this.displayClass;var a=this.id+"_GroupDiv";this.groupDiv=OpenLayers.Util.createDiv(a,null,null,null,"relative",null,"hidden");var h=this.div.id+"_contentDiv";this.contentDiv=OpenLayers.Util.createDiv(h,null,this.contentSize.clone(),null,"relative");this.contentDiv.className=this.contentDisplayClass;this.groupDiv.appendChild(this.contentDiv);this.div.appendChild(this.groupDiv);if(f){this.addCloseBox(e)}this.registerEvents()},destroy:function(){this.id=null;this.lonlat=null;this.size=null;this.contentHTML=null;this.backgroundColor=null;this.opacity=null;this.border=null;if(this.closeOnMove&&this.map){this.map.events.unregister("movestart",this,this.hide)}this.events.destroy();this.events=null;if(this.closeDiv){OpenLayers.Event.stopObservingElement(this.closeDiv);this.groupDiv.removeChild(this.closeDiv)}this.closeDiv=null;this.div.removeChild(this.groupDiv);this.groupDiv=null;if(this.map!=null){this.map.removePopup(this)}this.map=null;this.div=null;this.autoSize=null;this.minSize=null;this.maxSize=null;this.padding=null;this.panMapIfOutOfView=null},draw:function(a){if(a==null){if((this.lonlat!=null)&&(this.map!=null)){a=this.map.getLayerPxFromLonLat(this.lonlat)}}if(this.closeOnMove){this.map.events.register("movestart",this,this.hide)}if(!this.disableFirefoxOverflowHack&&OpenLayers.Util.getBrowserName()=="firefox"){this.map.events.register("movestart",this,function(){var b=document.defaultView.getComputedStyle(this.contentDiv,null);var c=b.getPropertyValue("overflow");if(c!="hidden"){this.contentDiv._oldOverflow=c;this.contentDiv.style.overflow="hidden"}});this.map.events.register("moveend",this,function(){var b=this.contentDiv._oldOverflow;if(b){this.contentDiv.style.overflow=b;this.contentDiv._oldOverflow=null}})}this.moveTo(a);if(!this.autoSize&&!this.size){this.setSize(this.contentSize)}this.setBackgroundColor();this.setOpacity();this.setBorder();this.setContentHTML();if(this.panMapIfOutOfView){this.panIntoView()}return this.div},updatePosition:function(){if((this.lonlat)&&(this.map)){var a=this.map.getLayerPxFromLonLat(this.lonlat);if(a){this.moveTo(a)}}},moveTo:function(a){if((a!=null)&&(this.div!=null)){this.div.style.left=a.x+"px";this.div.style.top=a.y+"px"}},visible:function(){return OpenLayers.Element.visible(this.div)},toggle:function(){if(this.visible()){this.hide()}else{this.show()}},show:function(){OpenLayers.Element.show(this.div);if(this.panMapIfOutOfView){this.panIntoView()}},hide:function(){OpenLayers.Element.hide(this.div)},setSize:function(c){this.size=c.clone();var b=this.getContentDivPadding();var a=b.left+b.right;var f=b.top+b.bottom;this.fixPadding();a+=this.padding.left+this.padding.right;f+=this.padding.top+this.padding.bottom;if(this.closeDiv){var e=parseInt(this.closeDiv.style.width);a+=e+b.right}this.size.w+=a;this.size.h+=f;if(OpenLayers.Util.getBrowserName()=="msie"){this.contentSize.w+=b.left+b.right;this.contentSize.h+=b.bottom+b.top}if(this.div!=null){this.div.style.width=this.size.w+"px";this.div.style.height=this.size.h+"px"}if(this.contentDiv!=null){this.contentDiv.style.width=c.w+"px";this.contentDiv.style.height=c.h+"px"}},updateSize:function(){var f="<div class='"+this.contentDisplayClass+"'>"+this.contentDiv.innerHTML+"</div>";var k=(this.map)?this.map.layerContainerDiv:document.body;var l=OpenLayers.Util.getRenderedDimensions(f,null,{displayClass:this.displayClass,containerElement:k});var h=this.getSafeContentSize(l);var g=null;if(h.equals(l)){g=l}else{var b=new OpenLayers.Size();b.w=(h.w<l.w)?h.w:null;b.h=(h.h<l.h)?h.h:null;if(b.w&&b.h){g=h}else{var e=OpenLayers.Util.getRenderedDimensions(f,b,{displayClass:this.contentDisplayClass,containerElement:k});var c=OpenLayers.Element.getStyle(this.contentDiv,"overflow");if((c!="hidden")&&(e.equals(h))){var a=OpenLayers.Util.getScrollbarWidth();if(b.w){e.h+=a}else{e.w+=a}}g=this.getSafeContentSize(e)}}this.setSize(g)},setBackgroundColor:function(a){if(a!=undefined){this.backgroundColor=a}if(this.div!=null){this.div.style.backgroundColor=this.backgroundColor}},setOpacity:function(a){if(a!=undefined){this.opacity=a}if(this.div!=null){this.div.style.opacity=this.opacity;this.div.style.filter="alpha(opacity="+this.opacity*100+")"}},setBorder:function(a){if(a!=undefined){this.border=a}if(this.div!=null){this.div.style.border=this.border}},setContentHTML:function(a){if(a!=null){this.contentHTML=a}if((this.contentDiv!=null)&&(this.contentHTML!=null)&&(this.contentHTML!=this.contentDiv.innerHTML)){this.contentDiv.innerHTML=this.contentHTML;if(this.autoSize){this.registerImageListeners();this.updateSize()}}},registerImageListeners:function(){var g=function(){this.popup.updateSize();if(this.popup.visible()&&this.popup.panMapIfOutOfView){this.popup.panIntoView()}OpenLayers.Event.stopObserving(this.img,"load",this.img._onImageLoad)};var b=this.contentDiv.getElementsByTagName("img");for(var f=0,a=b.length;f<a;f++){var c=b[f];if(c.width==0||c.height==0){var e={popup:this,img:c};c._onImgLoad=OpenLayers.Function.bind(g,e);OpenLayers.Event.observe(c,"load",c._onImgLoad)}}},getSafeContentSize:function(n){var e=n.clone();var l=this.getContentDivPadding();var m=l.left+l.right;var h=l.top+l.bottom;this.fixPadding();m+=this.padding.left+this.padding.right;h+=this.padding.top+this.padding.bottom;if(this.closeDiv){var c=parseInt(this.closeDiv.style.width);m+=c+l.right}if(this.minSize){e.w=Math.max(e.w,(this.minSize.w-m));e.h=Math.max(e.h,(this.minSize.h-h))}if(this.maxSize){e.w=Math.min(e.w,(this.maxSize.w-m));e.h=Math.min(e.h,(this.maxSize.h-h))}if(this.map&&this.map.size){var g=0,f=0;if(this.keepInMap&&!this.panMapIfOutOfView){var k=this.map.getPixelFromLonLat(this.lonlat);switch(this.relativePosition){case"tr":g=k.x;f=this.map.size.h-k.y;break;case"tl":g=this.map.size.w-k.x;f=this.map.size.h-k.y;break;case"bl":g=this.map.size.w-k.x;f=k.y;break;case"br":g=k.x;f=k.y;break;default:g=k.x;f=this.map.size.h-k.y;break}}var a=this.map.size.h-this.map.paddingForPopups.top-this.map.paddingForPopups.bottom-h-f;var b=this.map.size.w-this.map.paddingForPopups.left-this.map.paddingForPopups.right-m-g;e.w=Math.min(e.w,b);e.h=Math.min(e.h,a)}return e},getContentDivPadding:function(){var a=this._contentDivPadding;if(!a){if(this.div.parentNode==null){this.div.style.display="none";document.body.appendChild(this.div)}a=new OpenLayers.Bounds(OpenLayers.Element.getStyle(this.contentDiv,"padding-left"),OpenLayers.Element.getStyle(this.contentDiv,"padding-bottom"),OpenLayers.Element.getStyle(this.contentDiv,"padding-right"),OpenLayers.Element.getStyle(this.contentDiv,"padding-top"));this._contentDivPadding=a;if(this.div.parentNode==document.body){document.body.removeChild(this.div);this.div.style.display=""}}return a},addCloseBox:function(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(f){this.hide();OpenLayers.Event.stop(f)};OpenLayers.Event.observe(this.closeDiv,"click",OpenLayers.Function.bindAsEventListener(a,this))},panIntoView:function(){var f=this.map.getSize();var e=this.map.getViewPortPxFromLayerPx(new OpenLayers.Pixel(parseInt(this.div.style.left),parseInt(this.div.style.top)));var c=e.clone();if(e.x<this.map.paddingForPopups.left){c.x=this.map.paddingForPopups.left}else{if((e.x+this.size.w)>(f.w-this.map.paddingForPopups.right)){c.x=f.w-this.map.paddingForPopups.right-this.size.w}}if(e.y<this.map.paddingForPopups.top){c.y=this.map.paddingForPopups.top}else{if((e.y+this.size.h)>(f.h-this.map.paddingForPopups.bottom)){c.y=f.h-this.map.paddingForPopups.bottom-this.size.h}}var b=e.x-c.x;var a=e.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(c,e){if(e==null){e=c.style}if(c.geometry){var f=c.geometry.getBounds();if(f){if(!f.intersectsBounds(this.extent)){e={display:"none"}}var g=this.drawGeometry(c.geometry,e,c.id);if(e.display!="none"&&e.label&&g!==false){var a=c.geometry.getCentroid();if(e.labelXOffset||e.labelYOffset){xOffset=isNaN(e.labelXOffset)?0:e.labelXOffset;yOffset=isNaN(e.labelYOffset)?0:e.labelYOffset;var b=this.getResolution();a.move(xOffset*b,yOffset*b)}this.drawText(c.id,e,a)}else{this.removeText(c.id)}return g}}},drawGeometry:function(c,a,b){},drawText:function(c,b,a){},removeText:function(a){},clear:function(){},getFeatureIdFromEvent:function(a){},eraseFeatures:function(e){if(!(e instanceof Array)){e=[e]}for(var c=0,a=e.length;c<a;++c){var b=e[c];this.eraseGeometry(b.geometry,b.id);this.removeText(b.id)}},eraseGeometry:function(b,a){},moveRoot:function(a){},getRenderLayerId:function(){return this.container.id},applyDefaultSymbolizer:function(b){var a=OpenLayers.Util.extend({},OpenLayers.Renderer.defaultSymbolizer);if(b.stroke===false){delete a.strokeWidth;delete a.strokeColor}if(b.fill===false){delete a.fillColor}OpenLayers.Util.extend(a,b);return a},CLASS_NAME:"OpenLayers.Renderer"});OpenLayers.Renderer.defaultSymbolizer={fillColor:"#000000",strokeColor:"#000000",strokeWidth:2,fillOpacity:1,strokeOpacity:1,pointRadius:0};OpenLayers.Bounds=OpenLayers.Class({left:null,bottom:null,right:null,top:null,centerLonLat:null,initialize:function(e,a,b,c){if(e!=null){this.left=OpenLayers.Util.toFloat(e)}if(a!=null){this.bottom=OpenLayers.Util.toFloat(a)}if(b!=null){this.right=OpenLayers.Util.toFloat(b)}if(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(a){if(a===true){return[this.bottom,this.left,this.top,this.right]}else{return[this.left,this.bottom,this.right,this.top]}},toBBOX:function(b,f){if(b==null){b=6}var h=Math.pow(10,b);var g=Math.round(this.left*h)/h;var e=Math.round(this.bottom*h)/h;var c=Math.round(this.right*h)/h;var a=Math.round(this.top*h)/h;if(f===true){return e+","+g+","+a+","+c}else{return g+","+e+","+c+","+a}},toGeometry:function(){return new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(this.left,this.bottom),new OpenLayers.Geometry.Point(this.right,this.bottom),new OpenLayers.Geometry.Point(this.right,this.top),new OpenLayers.Geometry.Point(this.left,this.top)])])},getWidth:function(){return(this.right-this.left)},getHeight:function(){return(this.top-this.bottom)},getSize:function(){return new OpenLayers.Size(this.getWidth(),this.getHeight())},getCenterPixel:function(){return new OpenLayers.Pixel((this.left+this.right)/2,(this.bottom+this.top)/2)},getCenterLonLat:function(){if(!this.centerLonLat){this.centerLonLat=new OpenLayers.LonLat((this.left+this.right)/2,(this.bottom+this.top)/2)}return this.centerLonLat},scale:function(f,c){if(c==null){c=this.getCenterLonLat()}var a,k;if(c.CLASS_NAME=="OpenLayers.LonLat"){a=c.lon;k=c.lat}else{a=c.x;k=c.y}var h=(this.left-a)*f+a;var b=(this.bottom-k)*f+k;var e=(this.right-a)*f+a;var g=(this.top-k)*f+k;return new OpenLayers.Bounds(h,b,e,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,e,a){if(a==null){a=true}if(b==null||e==null){return false}b=OpenLayers.Util.toFloat(b);e=OpenLayers.Util.toFloat(e);var c=false;if(a){c=((b>=this.left)&&(b<=this.right)&&(e>=this.bottom)&&(e<=this.top))}else{c=((b>this.left)&&(b<this.right)&&(e>this.bottom)&&(e<this.top))}return c},intersectsBounds:function(f,b){if(b==null){b=true}var e=false;var k=(this.left==f.right||this.right==f.left||this.top==f.bottom||this.bottom==f.top);if(b||!k){var h=(((f.bottom>=this.bottom)&&(f.bottom<=this.top))||((this.bottom>=f.bottom)&&(this.bottom<=f.top)));var g=(((f.top>=this.bottom)&&(f.top<=this.top))||((this.top>f.bottom)&&(this.top<f.top)));var c=(((f.left>=this.left)&&(f.left<=this.right))||((this.left>=f.left)&&(this.left<=f.right)));var a=(((f.right>=this.left)&&(f.right<=this.right))||((this.right>=f.left)&&(this.right<=f.right)));e=((h||g)&&(c||a))}return e},containsBounds:function(h,b,a){if(b==null){b=false}if(a==null){a=true}var c=this.contains(h.left,h.bottom,a);var e=this.contains(h.right,h.bottom,a);var g=this.contains(h.left,h.top,a);var f=this.contains(h.right,h.top,a);return(b)?(c||e||g||f):(c&&e&&g&&f)},determineQuadrant:function(c){var b="";var a=this.getCenterLonLat();b+=(c.lat<a.lat)?"b":"t";b+=(c.lon<a.lon)?"l":"r";return b},transform:function(e,b){this.centerLonLat=null;var f=OpenLayers.Projection.transform({x:this.left,y:this.bottom},e,b);var a=OpenLayers.Projection.transform({x:this.right,y:this.bottom},e,b);var c=OpenLayers.Projection.transform({x:this.left,y:this.top},e,b);var g=OpenLayers.Projection.transform({x:this.right,y:this.top},e,b);this.left=Math.min(f.x,c.x);this.bottom=Math.min(f.y,a.y);this.right=Math.max(a.x,g.x);this.top=Math.max(c.y,g.y);return this},wrapDateLine:function(a,c){c=c||{};var e=c.leftTolerance||0;var b=c.rightTolerance||0;var f=this.clone();if(a){while(f.left<a.left&&(f.right-b)<=a.left){f=f.add(a.getWidth(),0)}while((f.left+e)>=a.right&&f.right>a.right){f=f.add(-a.getWidth(),0)}}return f},CLASS_NAME:"OpenLayers.Bounds"});OpenLayers.Bounds.fromString=function(b){var a=b.split(",");return OpenLayers.Bounds.fromArray(a)};OpenLayers.Bounds.fromArray=function(a){return new OpenLayers.Bounds(parseFloat(a[0]),parseFloat(a[1]),parseFloat(a[2]),parseFloat(a[3]))};OpenLayers.Bounds.fromSize=function(a){return new OpenLayers.Bounds(0,a.h,a.w,0)};OpenLayers.Bounds.oppositeQuadrant=function(a){var b="";b+=(a.charAt(0)=="t")?"b":"t";b+=(a.charAt(1)=="l")?"r":"l";return b};OpenLayers.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+OpenLayers.Util.toFloat(c),this.lat+OpenLayers.Util.toFloat(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(a[0],a[1])};OpenLayers.Pixel=OpenLayers.Class({x:0,y:0,initialize:function(a,b){this.x=parseFloat(a);this.y=parseFloat(b)},toString:function(){return("x="+this.x+",y="+this.y)},clone:function(){return new OpenLayers.Pixel(this.x,this.y)},equals:function(a){var b=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:"",autoActivate:false,active:null,handler:null,eventListeners:null,events:null,EVENT_TYPES:["activate","deactivate"],initialize:function(a){this.displayClass=this.CLASS_NAME.replace("OpenLayers.","ol").replace(/\./g,"");OpenLayers.Util.extend(this,a);this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES);if(this.eventListeners instanceof Object){this.events.on(this.eventListeners)}if(this.id==null){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")}},destroy:function(){if(this.events){if(this.eventListeners){this.events.un(this.eventListeners)}this.events.destroy();this.events=null}this.eventListeners=null;if(this.handler){this.handler.destroy();this.handler=null}if(this.handlers){for(var a in this.handlers){if(this.handlers.hasOwnProperty(a)&&typeof this.handlers[a].destroy=="function"){this.handlers[a].destroy()}}this.handlers=null}if(this.map){this.map.removeControl(this);this.map=null}},setMap:function(a){this.map=a;if(this.handler){this.handler.setMap(a)}},draw:function(a){if(this.div==null){this.div=OpenLayers.Util.createDiv(this.id);this.div.className=this.displayClass;if(!this.allowSelection){this.div.className+=" olControlNoSelect";this.div.setAttribute("unselectable","on",0);this.div.onselectstart=OpenLayers.Function.False}if(this.title!=""){this.div.title=this.title}}if(a!=null){this.position=a.clone()}this.moveTo(this.position);return this.div},moveTo:function(a){if((a!=null)&&(this.div!=null)){this.div.style.left=a.x+"px";this.div.style.top=a.y+"px"}},activate:function(){if(this.active){return false}if(this.handler){this.handler.activate()}this.active=true;if(this.map){OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active")}this.events.triggerEvent("activate");return true},deactivate:function(){if(this.active){if(this.handler){this.handler.deactivate()}this.active=false;if(this.map){OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active")}this.events.triggerEvent("deactivate");return true}return false},CLASS_NAME:"OpenLayers.Control"});OpenLayers.Control.TYPE_BUTTON=1;OpenLayers.Control.TYPE_TOGGLE=2;OpenLayers.Control.TYPE_TOOL=3;OpenLayers.Lang={code:null,defaultCode:"en",getCode:function(){if(!OpenLayers.Lang.code){OpenLayers.Lang.setCode()}return OpenLayers.Lang.code},setCode:function(b){var e;if(!b){b=(OpenLayers.Util.getBrowserName()=="msie")?navigator.userLanguage:navigator.language}var c=b.split("-");c[0]=c[0].toLowerCase();if(typeof OpenLayers.Lang[c[0]]=="object"){e=c[0]}if(c[1]){var a=c[0]+"-"+c[1].toUpperCase();if(typeof OpenLayers.Lang[a]=="object"){e=a}}if(!e){OpenLayers.Console.warn("Failed to find OpenLayers.Lang."+c.join("-")+" dictionary, falling back to default language");e=OpenLayers.Lang.defaultCode}OpenLayers.Lang.code=e},translate:function(b,a){var e=OpenLayers.Lang[OpenLayers.Lang.getCode()];var c=e[b];if(!c){c=b}if(a){c=OpenLayers.String.format(c,a)}return c}};OpenLayers.i18n=OpenLayers.Lang.translate;OpenLayers.Popup.Anchored=OpenLayers.Class(OpenLayers.Popup,{relativePosition:null,keepInMap:true,anchor:null,initialize:function(k,e,h,c,b,g,f){var a=[k,e,h,c,g,f];OpenLayers.Popup.prototype.initialize.apply(this,a);this.anchor=(b!=null)?b:{size:new OpenLayers.Size(0,0),offset:new OpenLayers.Pixel(0,0)}},destroy:function(){this.anchor=null;this.relativePosition=null;OpenLayers.Popup.prototype.destroy.apply(this,arguments)},show:function(){this.updatePosition();OpenLayers.Popup.prototype.show.apply(this,arguments)},moveTo:function(c){var b=this.relativePosition;this.relativePosition=this.calculateRelativePosition(c);var e=this.calculateNewPx(c);var a=new Array(e);OpenLayers.Popup.prototype.moveTo.apply(this,a);if(this.relativePosition!=b){this.updateRelativePosition()}},setSize:function(b){OpenLayers.Popup.prototype.setSize.apply(this,arguments);if((this.lonlat)&&(this.map)){var a=this.map.getLayerPxFromLonLat(this.lonlat);this.moveTo(a)}},calculateRelativePosition:function(b){var e=this.map.getLonLatFromLayerPx(b);var c=this.map.getExtent();var a=c.determineQuadrant(e);return OpenLayers.Bounds.oppositeQuadrant(a)},updateRelativePosition:function(){},calculateNewPx:function(b){var f=b.offset(this.anchor.offset);var a=this.size||this.contentSize;var e=(this.relativePosition.charAt(0)=="t");f.y+=(e)?-(a.h+this.anchor.size.h):this.anchor.size.h;var c=(this.relativePosition.charAt(1)=="l");f.x+=(c)?-(a.w+this.anchor.size.w):this.anchor.size.w;return f},CLASS_NAME:"OpenLayers.Popup.Anchored"});OpenLayers.Renderer.Canvas=OpenLayers.Class(OpenLayers.Renderer,{canvas:null,features: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={}},eraseGeometry:function(b,a){this.eraseFeatures(this.features[a][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){b=b||a.style;b=this.applyDefaultSymbolizer(b);this.features[a.id]=[a,b];this.redraw()},drawGeometry:function(e,c){var b=e.CLASS_NAME;if((b=="OpenLayers.Geometry.Collection")||(b=="OpenLayers.Geometry.MultiPoint")||(b=="OpenLayers.Geometry.MultiLineString")||(b=="OpenLayers.Geometry.MultiPolygon")){for(var a=0;a<e.components.length;a++){this.drawGeometry(e.components[a],c)}return}switch(e.CLASS_NAME){case"OpenLayers.Geometry.Point":this.drawPoint(e,c);break;case"OpenLayers.Geometry.LineString":this.drawLineString(e,c);break;case"OpenLayers.Geometry.LinearRing":this.drawLinearRing(e,c);break;case"OpenLayers.Geometry.Polygon":this.drawPolygon(e,c);break;default:break}},drawExternalGraphic:function(h,g){var b=new Image();if(g.graphicTitle){b.title=g.graphicTitle}var f=g.graphicWidth||g.graphicHeight;var a=g.graphicHeight||g.graphicWidth;f=f?f:g.pointRadius*2;a=a?a:g.pointRadius*2;var e=(g.graphicXOffset!=undefined)?g.graphicXOffset:-(0.5*f);var k=(g.graphicYOffset!=undefined)?g.graphicYOffset:-(0.5*a);var c={img:b,x:(h[0]+e),y:(h[1]+k),width:f,height:a,opacity:g.graphicOpacity||g.fillOpacity,canvas:this.canvas};b.onload=OpenLayers.Function.bind(function(){this.canvas.globalAlpha=this.opacity;this.canvas.drawImage(this.img,this.x,this.y,this.width,this.height)},c);b.src=g.externalGraphic},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],a.pointRadius,0,Math.PI*2,true);this.canvas.fill()}if(a.stroke!==false){this.setCanvasStyle("stroke",a);this.canvas.beginPath();this.canvas.arc(b[0],b[1],a.pointRadius,0,Math.PI*2,true);this.canvas.stroke();this.setCanvasStyle("reset")}}}},drawLineString:function(e,b){if(b.stroke!==false){this.setCanvasStyle("stroke",b);this.canvas.beginPath();var f=this.getLocalXY(e.components[0]);this.canvas.moveTo(f[0],f[1]);for(var a=1;a<e.components.length;a++){var c=this.getLocalXY(e.components[a]);this.canvas.lineTo(c[0],c[1])}this.canvas.stroke()}this.setCanvasStyle("reset")},drawLinearRing:function(e,b){if(b.fill!==false){this.setCanvasStyle("fill",b);this.canvas.beginPath();var f=this.getLocalXY(e.components[0]);this.canvas.moveTo(f[0],f[1]);for(var a=1;a<e.components.length-1;a++){var c=this.getLocalXY(e.components[a]);this.canvas.lineTo(c[0],c[1])}this.canvas.fill()}if(b.stroke!==false){this.setCanvasStyle("stroke",b);this.canvas.beginPath();var f=this.getLocalXY(e.components[0]);this.canvas.moveTo(f[0],f[1]);for(var a=1;a<e.components.length;a++){var c=this.getLocalXY(e.components[a]);this.canvas.lineTo(c[0],c[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,e){e=OpenLayers.Util.extend({fontColor:"#000000",labelAlign:"cm"},e);var f=this.getLocalXY(b);this.setCanvasStyle("reset");this.canvas.fillStyle=e.fontColor;this.canvas.globalAlpha=e.fontOpacity||1;var g=e.fontWeight+" "+e.fontSize+" "+e.fontFamily;if(this.canvas.fillText){var c=OpenLayers.Renderer.Canvas.LABEL_ALIGN[e.labelAlign[0]]||"center";this.canvas.font=g;this.canvas.textAlign=c;this.canvas.fillText(e.label,f[0],f[1])}else{if(this.canvas.mozDrawText){this.canvas.mozTextStyle=g;var a=this.canvas.mozMeasureText(e.label);switch(e.labelAlign[0]){case"l":break;case"r":f[0]-=a;break;case"c":default:f[0]-=a/2}this.canvas.translate(f[0],f[1]);this.canvas.mozDrawText(e.label);this.canvas.translate(-1*f[0],-1*f[1])}}this.setCanvasStyle("reset")},getLocalXY:function(b){var c=this.getResolution();var e=this.extent;var a=(b.x/c+(-e.left/c));var f=((e.top/c)-b.y/c);return[a,f]},clear:function(){this.canvas.clearRect(0,0,this.root.width,this.root.height);this.features={}},getFeatureIdFromEvent:function(a){var g=this.map.getLonLatFromPixel(a.xy);var b=this.getResolution();var f=new OpenLayers.Bounds(g.lon-b*5,g.lat-b*5,g.lon+b*5,g.lat+b*5);var c=f.toGeometry();for(var e in this.features){if(!this.features.hasOwnProperty(e)){continue}if(this.features[e][0].geometry.intersects(c)){return e}}return null},eraseFeatures:function(b){if(!(b instanceof Array)){b=[b]}for(var a=0;a<b.length;++a){delete this.features[b[a].id]}this.redraw()},redraw:function(){if(!this.locked){this.canvas.clearRect(0,0,this.root.width,this.root.height);var g=[];var c,e;for(var h in this.features){if(!this.features.hasOwnProperty(h)){continue}c=this.features[h][0];e=this.features[h][1];if(!c.geometry){continue}this.drawGeometry(c.geometry,e);if(e.label){g.push([c,e])}}var f;for(var b=0,a=g.length;b<a;++b){f=g[b];this.drawText(f[0].geometry.getCentroid(),f[1])}}},CLASS_NAME:"OpenLayers.Renderer.Canvas"});OpenLayers.Renderer.Canvas.LABEL_ALIGN={l:"left",r:"right"};OpenLayers.ElementsIndexer=OpenLayers.Class({maxZIndex:null,order:null,indices:null,compare:null,initialize:function(a){this.compare=a?OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_Y_ORDER:OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_DRAWING_ORDER;this.order=[];this.indices={};this.maxZIndex=0},insert:function(c){if(this.exists(c)){this.remove(c)}var g=c.id;this.determineZIndex(c);var e=-1;var f=this.order.length;var a;while(f-e>1){a=parseInt((e+f)/2);var b=this.compare(this,c,OpenLayers.Util.getElement(this.order[a]));if(b>0){e=a}else{f=a}}this.order.splice(f,0,g);this.indices[g]=this.getZIndex(c);return this.getNextElement(f)},remove:function(b){var e=b.id;var a=OpenLayers.Util.indexOf(this.order,e);if(a>=0){this.order.splice(a,1);delete this.indices[e];if(this.order.length>0){var c=this.order[this.order.length-1];this.maxZIndex=this.indices[c]}else{this.maxZIndex=0}}},clear:function(){this.order=[];this.indices={};this.maxZIndex=0},exists:function(a){return(this.indices[a.id]!=null)},getZIndex:function(a){return a._style.graphicZIndex},determineZIndex:function(a){var b=a._style.graphicZIndex;if(b==null){b=this.maxZIndex;a._style.graphicZIndex=b}else{if(b>this.maxZIndex){this.maxZIndex=b}}},getNextElement:function(b){var a=b+1;if(a<this.order.length){var c=OpenLayers.Util.getElement(this.order[a]);if(c==undefined){c=this.getNextElement(a)}return c}else{return null}},CLASS_NAME:"OpenLayers.ElementsIndexer"});OpenLayers.ElementsIndexer.IndexingMethods={Z_ORDER:function(f,e,b){var a=f.getZIndex(e);var g=0;if(b){var c=f.getZIndex(b);g=a-c}return g},Z_ORDER_DRAWING_ORDER:function(c,b,a){var e=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(c,b,a);if(a&&e==0){e=1}return e},Z_ORDER_Y_ORDER:function(e,c,b){var f=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(e,c,b);if(b&&f===0){var a=b._boundsBottom-c._boundsBottom;f=(a===0)?1:a}return f}};OpenLayers.Renderer.Elements=OpenLayers.Class(OpenLayers.Renderer,{rendererRoot:null,root:null,vectorRoot:null,textRoot:null,xmlns:null,indexer:null,BACKGROUND_ID_SUFFIX:"_background",LABEL_ID_SUFFIX:"_label",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(){var b;var a=this.vectorRoot;if(a){while(b=a.firstChild){a.removeChild(b)}}a=this.textRoot;if(a){while(b=a.firstChild){a.removeChild(b)}}if(this.indexer){this.indexer.clear()}},getNodeType:function(b,a){},drawGeometry:function(h,e,g){var c=h.CLASS_NAME;var k=true;if((c=="OpenLayers.Geometry.Collection")||(c=="OpenLayers.Geometry.MultiPoint")||(c=="OpenLayers.Geometry.MultiLineString")||(c=="OpenLayers.Geometry.MultiPolygon")){for(var b=0,a=h.components.length;b<a;b++){k=this.drawGeometry(h.components[b],e,g)&&k}return k}k=false;if(e.display!="none"){if(e.backgroundGraphic){this.redrawBackgroundNode(h.id,h,e,g)}k=this.redrawNode(h.id,h,e,g)}if(k==false){var f=document.getElementById(h.id);if(f){if(f._style.backgroundGraphic){f.parentNode.removeChild(document.getElementById(h.id+this.BACKGROUND_ID_SUFFIX))}f.parentNode.removeChild(f)}}return k},redrawNode:function(h,g,b,f){b=this.applyDefaultSymbolizer(b);var c=this.nodeFactory(h,this.getNodeType(g,b));c._featureId=f;c._boundsBottom=g.getBounds().bottom;c._geometryClass=g.CLASS_NAME;c._style=b;var a=this.drawGeometryNode(c,g,b);if(a===false){return false}c=a.node;if(this.indexer){var e=this.indexer.insert(c);if(e){this.vectorRoot.insertBefore(c,e)}else{this.vectorRoot.appendChild(c)}}else{if(c.parentNode!==this.vectorRoot){this.vectorRoot.appendChild(c)}}this.postDraw(c);return a.complete},redrawBackgroundNode:function(f,e,b,c){var a=OpenLayers.Util.extend({},b);a.externalGraphic=a.backgroundGraphic;a.graphicXOffset=a.backgroundXOffset;a.graphicYOffset=a.backgroundYOffset;a.graphicZIndex=a.backgroundGraphicZIndex;a.graphicWidth=a.backgroundWidth||a.graphicWidth;a.graphicHeight=a.backgroundHeight||a.graphicHeight;a.backgroundGraphic=null;a.backgroundXOffset=null;a.backgroundYOffset=null;a.backgroundGraphicZIndex=null;return this.redrawNode(f+this.BACKGROUND_ID_SUFFIX,e,a,null)},drawGeometryNode:function(c,f,b){b=b||c._style;var a={isFilled:b.fill===undefined?true:b.fill,isStroked:b.stroke===undefined?!!b.strokeWidth:b.stroke};var e;switch(f.CLASS_NAME){case"OpenLayers.Geometry.Point":if(b.graphic===false){a.isFilled=false;a.isStroked=false}e=this.drawPoint(c,f);break;case"OpenLayers.Geometry.LineString":a.isFilled=false;e=this.drawLineString(c,f);break;case"OpenLayers.Geometry.LinearRing":e=this.drawLinearRing(c,f);break;case"OpenLayers.Geometry.Polygon":e=this.drawPolygon(c,f);break;case"OpenLayers.Geometry.Surface":e=this.drawSurface(c,f);break;case"OpenLayers.Geometry.Rectangle":e=this.drawRectangle(c,f);break;default:break}c._options=a;if(e!=false){return{node:this.setStyle(c,b,a,f),complete:e}}else{return false}},postDraw:function(a){},drawPoint:function(a,b){},drawLineString:function(a,b){},drawLinearRing:function(a,b){},drawPolygon:function(a,b){},drawRectangle:function(a,b){},drawCircle:function(a,b){},drawSurface:function(a,b){},removeText:function(b){var a=document.getElementById(b+this.LABEL_ID_SUFFIX);if(a){this.textRoot.removeChild(a)}},getFeatureIdFromEvent:function(a){var e=a.target;var b=e&&e.correspondingUseElement;var c=b?b:(e||a.srcElement);var f=c._featureId;return f},eraseGeometry:function(h,g){if((h.CLASS_NAME=="OpenLayers.Geometry.MultiPoint")||(h.CLASS_NAME=="OpenLayers.Geometry.MultiLineString")||(h.CLASS_NAME=="OpenLayers.Geometry.MultiPolygon")||(h.CLASS_NAME=="OpenLayers.Geometry.Collection")){for(var e=0,a=h.components.length;e<a;e++){this.eraseGeometry(h.components[e],g)}}else{var c=OpenLayers.Util.getElement(h.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=h.id+this.BACKGROUND_ID_SUFFIX;var f=OpenLayers.Util.getElement(b);if(f&&f.parentNode){f.parentNode.removeChild(f)}}}}},nodeFactory:function(c,a){var b=OpenLayers.Util.getElement(c);if(b){if(!this.nodeTypeCompare(b,a)){b.parentNode.removeChild(b);b=this.nodeFactory(c,a)}}else{b=this.createNode(a,c)}return b},nodeTypeCompare:function(b,a){},createNode:function(a,b){},moveRoot:function(b){var a=this.root;if(b.root.parentNode==this.rendererRoot){a=b.root}a.parentNode.removeChild(a);b.rendererRoot.appendChild(a)},getRenderLayerId:function(){return this.root.parentNode.parentNode.id},isComplexSymbol:function(a){return(a!="circle")&&!!a},CLASS_NAME:"OpenLayers.Renderer.Elements"});OpenLayers.Renderer.symbol={star:[350,75,379,161,469,161,397,215,423,301,350,250,277,301,303,215,231,161,321,161,350,75],cross:[4,0,6,0,6,4,10,4,10,6,6,6,6,10,4,10,4,6,0,6,0,4,4,4,4,0],x:[0,0,25,0,50,35,75,0,100,0,65,50,100,100,75,100,50,65,25,100,0,100,35,50,0,0],square:[0,0,0,1,1,1,1,0,0,0],triangle:[0,10,10,10,5,0,0,10]};OpenLayers.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,e,a){this.playing=true;this.begin=c;this.finish=b;this.duration=e;this.callbacks=a.callbacks;this.time=0;if(this.interval){window.clearInterval(this.interval);this.interval=null}if(this.callbacks&&this.callbacks.start){this.callbacks.start.call(this,this.begin)}this.interval=window.setInterval(OpenLayers.Function.bind(this.play,this),this.INTERVAL)},stop:function(){if(!this.playing){return}if(this.callbacks&&this.callbacks.done){this.callbacks.done.call(this,this.finish)}window.clearInterval(this.interval);this.interval=null;this.playing=false},play:function(){var h={};for(var e in this.begin){var a=this.begin[e];var g=this.finish[e];if(a==null||g==null||isNaN(a)||isNaN(g)){OpenLayers.Console.error("invalid value for Tween")}var k=g-a;h[e]=this.easing.apply(this,[this.time,a,k,this.duration])}this.time++;if(this.callbacks&&this.callbacks.eachStep){this.callbacks.eachStep.call(this,h)}if(this.time>this.duration){this.stop()}},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(f){OpenLayers.Control.prototype.setMap.apply(this,arguments);for(var c=0,a=this.map.controls.length;c<a;c++){var e=this.map.controls[c];if((e!=this)&&(e.CLASS_NAME=="OpenLayers.Control.ArgParser")){if(e.displayProjection!=this.displayProjection){this.displayProjection=e.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 e=0,a=this.layers.length;e<a;e++){var b=this.map.layers[e];var f=this.layers.charAt(e);if(f=="B"){this.map.setBaseLayer(b)}else{if((f=="T")||(f=="F")){b.setVisibility(f=="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 e=[];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()){if(OpenLayers.Util.indexOf(e,b.attribution)===-1){e.push(b.attribution)}}}this.div.innerHTML=e.join(this.separator)}},CLASS_NAME:"OpenLayers.Control.Attribution"});OpenLayers.Control.LayerSwitcher=OpenLayers.Class(OpenLayers.Control,{roundedCorner:true,roundedCornerColor:"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(e){var f=this[e+"Layers"];if(f){for(var c=0,a=f.length;c<a;c++){var b=f[c];OpenLayers.Event.stopObservingElement(b.inputElem);OpenLayers.Event.stopObservingElement(b.labelSpan)}}this[e+"LayersDiv"].innerHTML="";this[e+"Layers"]=[]},checkRedraw:function(){var f=false;if(!this.layerStates.length||(this.map.layers.length!=this.layerStates.length)){f=true}else{for(var c=0,a=this.layerStates.length;c<a;c++){var e=this.layerStates[c];var b=this.map.layers[c];if((e.name!=b.name)||(e.inRange!=b.inRange)||(e.id!=b.id)||(e.visibility!=b.visibility)){f=true;break}}}return f},sortLayers:function(e,c){if(e.options&&c.options){return e.options.layerSwitcherOrder<c.options.layerSwitcherOrder?-1:1}return 0},redraw:function(){if(!this.checkRedraw()){return this.div}this.clearLayersArray("base");this.clearLayersArray("data");var e=false;var o=false;var k=this.map.layers.length;this.layerStates=new Array(k);for(var g=0;g<k;g++){var h=this.map.layers[g];this.layerStates[g]={name:h.name,visibility:h.visibility,inRange:h.inRange,id:h.id}}var f=this.map.layers.slice();f.sort(this.sortLayers);if(!this.ascending){f.reverse()}for(var g=0,k=f.length;g<k;g++){var h=f[g];var l=h.isBaseLayer;if(h.displayInLayerSwitcher){if(l){o=true}else{e=true}var n=(l)?(h==this.map.baseLayer):h.getVisibility();var m=document.createElement("input");m.id=this.id+"_input_"+h.name;m.name=(l)?this.id+"_baseLayers":h.name;m.type=(l)?"radio":"checkbox";m.value=h.name;m.checked=n;m.defaultChecked=n;if(!l&&!h.inRange){m.disabled=true}var a={inputElem:m,layer:h,layerSwitcher:this};OpenLayers.Event.observe(m,"mouseup",OpenLayers.Function.bindAsEventListener(this.onInputClick,a));var b=document.createElement("span");OpenLayers.Element.addClass(b,"labelSpan");if(!l&&!h.inRange){b.style.color="gray"}b.innerHTML=h.name;b.style.verticalAlign=(l)?"bottom":"baseline";OpenLayers.Event.observe(b,"click",OpenLayers.Function.bindAsEventListener(this.onInputClick,a));var q=document.createElement("br");var p=(l)?this.baseLayers:this.dataLayers;p.push({layer:h,inputElem:m,labelSpan:b});var c=(l)?this.baseLayersDiv:this.dataLayersDiv;c.appendChild(m);c.appendChild(b);c.appendChild(q)}}this.dataLbl.style.display=(e)?"":"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="";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(){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";OpenLayers.Element.addClass(this.layersDiv,"layersDiv");this.baseLbl=document.createElement("div");this.baseLbl.innerHTML=OpenLayers.i18n("baseLayer");OpenLayers.Element.addClass(this.baseLbl,"baseLbl");this.baseLayersDiv=document.createElement("div");OpenLayers.Element.addClass(this.baseLayersDiv,"baseLayersDiv");this.dataLbl=document.createElement("div");this.dataLbl.innerHTML=OpenLayers.i18n("overlays");OpenLayers.Element.addClass(this.dataLbl,"dataLbl");this.dataLayersDiv=document.createElement("div");OpenLayers.Element.addClass(this.dataLayersDiv,"dataLayersDiv");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);if(this.roundedCorner){OpenLayers.Rico.Corner.round(this.div,{corners:"tl bl",bgColor:"transparent",color:this.roundedCornerColor,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");OpenLayers.Element.addClass(this.maximizeDiv,"maximizeDiv");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");OpenLayers.Element.addClass(this.minimizeDiv,"minimizeDiv");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,e,l,h){var g=OpenLayers.Util.getImagesLocation()+e;var b=OpenLayers.Util.createAlphaImageDiv(this.id+"_"+a,l,h,g,"absolute");this.div.appendChild(b);OpenLayers.Event.observe(b,"mousedown",OpenLayers.Function.bindAsEventListener(this.buttonDown,b));OpenLayers.Event.observe(b,"dblclick",OpenLayers.Function.bindAsEventListener(this.doubleClick,b));OpenLayers.Event.observe(b,"click",OpenLayers.Function.bindAsEventListener(this.doubleClick,b));b.action=a;b.map=this.map;if(!this.slideRatio){var c=this.slideFactor;var f=function(){return c}}else{var k=this.slideRatio;var f=function(m){return this.map.getSize()[m]*k}}b.getSlideFactor=f;this.buttons.push(b);return b},_removeButton:function(a){OpenLayers.Event.stopObservingElement(a);a.map=null;a.getSlideFactor=null;this.div.removeChild(a);OpenLayers.Util.removeItem(this.buttons,a)},removeButtons:function(){for(var a=this.buttons.length-1;a>=0;--a){this._removeButton(this.buttons[a])}},doubleClick:function(a){OpenLayers.Event.stop(a);return false},buttonDown:function(a){if(!OpenLayers.Event.isLeftClick(a)){return}switch(this.action){case"panup":this.map.pan(0,-this.getSlideFactor("h"));break;case"pandown":this.map.pan(0,this.getSlideFactor("h"));break;case"panleft":this.map.pan(-this.getSlideFactor("w"),0);break;case"panright":this.map.pan(this.getSlideFactor("w"),0);break;case"zoomin":this.map.zoomIn();break;case"zoomout":this.map.zoomOut();break;case"zoomworld":this.map.zoomToMaxExtent();break}OpenLayers.Event.stop(a)},CLASS_NAME:"OpenLayers.Control.PanZoom"});OpenLayers.Control.PanZoom.X=4;OpenLayers.Control.PanZoom.Y=4;OpenLayers.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,e,c,a){var f=OpenLayers.Util.getElement(b);a=a||false;if(e=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||f.attachEvent)){e="keydown"}if(!this.observers){this.observers={}}if(!f._eventCacheID){var g="eventCacheID_";if(f.id){g=f.id+"_"+g}f._eventCacheID=OpenLayers.Util.createUniqueID(g)}var h=f._eventCacheID;if(!this.observers[h]){this.observers[h]=[]}this.observers[h].push({element:f,name:e,observer:c,useCapture:a});if(f.addEventListener){f.addEventListener(e,c,a)}else{if(f.attachEvent){f.attachEvent("on"+e,c)}}},stopObservingElement:function(a){var b=OpenLayers.Util.getElement(a);var c=b._eventCacheID;this._removeElementObservers(OpenLayers.Event.observers[c])},_removeElementObservers:function(f){if(f){for(var b=f.length-1;b>=0;b--){var c=f[b];var a=new Array(c.element,c.name,c.observer,c.useCapture);var e=OpenLayers.Event.stopObserving.apply(this,a)}}},stopObserving:function(k,a,h,b){b=b||false;var g=OpenLayers.Util.getElement(k);var e=g._eventCacheID;if(a=="keypress"){if(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||g.detachEvent){a="keydown"}}var m=false;var c=OpenLayers.Event.observers[e];if(c){var f=0;while(!m&&f<c.length){var l=c[f];if((l.name==a)&&(l.observer==h)&&(l.useCapture==b)){c.splice(f,1);if(c.length==0){delete OpenLayers.Event.observers[e]}m=true;break}f++}}if(m){if(g.removeEventListener){g.removeEventListener(a,h,b)}else{if(g&&g.detachEvent){g.detachEvent("on"+a,h)}}}return m},unloadCache:function(){if(OpenLayers.Event&&OpenLayers.Event.observers){for(var a in OpenLayers.Event.observers){var b=OpenLayers.Event.observers[a];OpenLayers.Event._removeElementObservers.apply(this,[b])}OpenLayers.Event.observers=false}},CLASS_NAME:"OpenLayers.Event"};OpenLayers.Event.observe(window,"unload",OpenLayers.Event.unloadCache,false);if(window.Event){OpenLayers.Util.applyDefaults(window.Event,OpenLayers.Event)}else{var Event=OpenLayers.Event}OpenLayers.Events=OpenLayers.Class({BROWSER_EVENTS:["mouseover","mouseout","mousedown","mouseup","mousemove","click","dblclick","rightclick","dblrightclick","resize","focus","blur"],listeners:null,object:null,element:null,eventTypes:null,eventHandler:null,fallThrough:null,includeXY:false,clearMouseListener:null,initialize:function(c,f,h,g,b){OpenLayers.Util.extend(this,b);this.object=c;this.fallThrough=g;this.listeners={};this.eventHandler=OpenLayers.Function.bindAsEventListener(this.handleBrowserEvent,this);this.clearMouseListener=OpenLayers.Function.bind(this.clearMouseCache,this);this.eventTypes=[];if(h!=null){for(var e=0,a=h.length;e<a;e++){this.addEventType(h[e])}}if(f!=null){this.attachToElement(f)}},destroy:function(){if(this.element){OpenLayers.Event.stopObservingElement(this.element);if(this.element.hasScrollEvent){OpenLayers.Event.stopObserving(window,"scroll",this.clearMouseListener)}}this.element=null;this.listeners=null;this.object=null;this.eventTypes=null;this.fallThrough=null;this.eventHandler=null},addEventType:function(a){if(!this.listeners[a]){this.eventTypes.push(a);this.listeners[a]=[]}},attachToElement:function(e){if(this.element){OpenLayers.Event.stopObservingElement(this.element)}this.element=e;for(var c=0,a=this.BROWSER_EVENTS.length;c<a;c++){var b=this.BROWSER_EVENTS[c];this.addEventType(b);OpenLayers.Event.observe(e,b,this.eventHandler)}OpenLayers.Event.observe(e,"dragstart",OpenLayers.Event.stop)},on:function(a){for(var b in a){if(b!="scope"){this.register(b,a.scope,a[b])}}},register:function(b,e,c){if((c!=null)&&(OpenLayers.Util.indexOf(this.eventTypes,b)!=-1)){if(e==null){e=this.object}var a=this.listeners[b];a.push({obj:e,func:c})}},registerPriority:function(b,e,c){if(c!=null){if(e==null){e=this.object}var a=this.listeners[b];if(a!=null){a.unshift({obj:e,func:c})}}},un:function(a){for(var b in a){if(b!="scope"){this.unregister(b,a.scope,a[b])}}},unregister:function(e,g,f){if(g==null){g=this.object}var c=this.listeners[e];if(c!=null){for(var b=0,a=c.length;b<a;b++){if(c[b].obj==g&&c[b].func==f){c.splice(b,1);break}}}},remove:function(a){if(this.listeners[a]!=null){this.listeners[a]=[]}},triggerEvent:function(f,b){var e=this.listeners[f];if(!e||e.length==0){return}if(b==null){b={}}b.object=this.object;b.element=this.element;if(!b.type){b.type=f}var e=e.slice(),g;for(var c=0,a=e.length;c<a;c++){var h=e[c];g=h.func.apply(h.obj,[b]);if((g!=undefined)&&(g==false)){break}}if(!this.fallThrough){OpenLayers.Event.stop(b,true)}return g},handleBrowserEvent:function(a){if(this.includeXY){a.xy=this.getMousePosition(a)}this.triggerEvent(a.type,a)},clearMouseCache:function(){this.element.scrolls=null;this.element.lefttop=null;this.element.offsets=null},getMousePosition:function(a){if(!this.includeXY){this.clearMouseCache()}else{if(!this.element.hasScrollEvent){OpenLayers.Event.observe(window,"scroll",this.clearMouseListener);this.element.hasScrollEvent=true}}if(!this.element.scrolls){this.element.scrolls=[(document.documentElement.scrollLeft||document.body.scrollLeft),(document.documentElement.scrollTop||document.body.scrollTop)]}if(!this.element.lefttop){this.element.lefttop=[(document.documentElement.clientLeft||0),(document.documentElement.clientTop||0)]}if(!this.element.offsets){this.element.offsets=OpenLayers.Util.pagePosition(this.element);this.element.offsets[0]+=this.element.scrolls[0];this.element.offsets[1]+=this.element.scrolls[1]}return new OpenLayers.Pixel((a.clientX+this.element.scrolls[0])-this.element.offsets[0]-this.element.lefttop[0],(a.clientY+this.element.scrolls[1])-this.element.offsets[1]-this.element.lefttop[1])},CLASS_NAME:"OpenLayers.Events"});OpenLayers.Format=OpenLayers.Class({options:null,externalProjection:null,internalProjection:null,data:null,keepData:false,initialize:function(a){OpenLayers.Util.extend(this,a);this.options=a},destroy:function(){},read:function(a){OpenLayers.Console.userError(OpenLayers.i18n("readNotImplemented"))},write:function(a){OpenLayers.Console.userError(OpenLayers.i18n("writeNotImplemented"))},CLASS_NAME:"OpenLayers.Format"});OpenLayers.Lang.en={unhandledRequest:"Unhandled request return ${statusText}",permalink:"Permalink",overlays:"Overlays",baseLayer:"Base Layer",sameProjection:"The overview map only works when it is in the same projection as the main map",readNotImplemented:"Read not implemented.",writeNotImplemented:"Write not implemented.",noFID:"Can't update a feature for which there is no FID.",errorLoadingGML:"Error in loading GML file ${url}",browserNotSupported:"Your browser does not support vector rendering. Currently supported renderers are:\n${renderers}",componentShouldBe:"addFeatures : component should be an ${geomType}",getFeatureError:"getFeatureFromEvent called on layer with no renderer. This usually means you destroyed a layer, but not some handler which is associated with it.",minZoomLevelError:"The minZoomLevel property is only intended for use with the FixedZoomLevels-descendent layers. That this wfs layer checks for minZoomLevel is a relic of thepast. We cannot, however, remove it without possibly breaking OL based applications that may depend on it. Therefore we are deprecating it -- the minZoomLevel check below will be removed at 3.0. Please instead use min/max resolution setting as described here: http://trac.openlayers.org/wiki/SettingZoomLevels",commitSuccess:"WFS Transaction: SUCCESS ${response}",commitFailed:"WFS Transaction: FAILED ${response}",googleWarning:"The Google Layer was unable to load correctly.<br><br>To get rid of this message, select a new BaseLayer in the layer switcher in the upper-right corner.<br><br>Most likely, this is because the Google Maps library script was either not included, or does not contain the correct API key for your site.<br><br>Developers: For help getting this working correctly, <a href='http://trac.openlayers.org/wiki/Google' target='_blank'>click here</a>",getLayerWarning:"The ${layerType} Layer was unable to load correctly.<br><br>To get rid of this message, select a new BaseLayer in the layer switcher in the upper-right corner.<br><br>Most likely, this is because the ${layerLib} library script was not correctly included.<br><br>Developers: For help getting this working correctly, <a href='http://trac.openlayers.org/wiki/${layerLib}' target='_blank'>click here</a>",scale:"Scale = 1 : ${scaleDenom}",W:"W",E:"E",N:"N",S:"S",graticule:"Graticule",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.",filterEvaluateNotImplemented:"evaluate is not implemented for this filter type.",end:""};OpenLayers.Popup.AnchoredBubble=OpenLayers.Class(OpenLayers.Popup.Anchored,{rounded:false,initialize:function(h,c,g,b,a,f,e){this.padding=new OpenLayers.Bounds(0,OpenLayers.Popup.AnchoredBubble.CORNER_SIZE,0,OpenLayers.Popup.AnchoredBubble.CORNER_SIZE);OpenLayers.Popup.Anchored.prototype.initialize.apply(this,arguments)},draw:function(a){OpenLayers.Popup.Anchored.prototype.draw.apply(this,arguments);this.setContentHTML();this.setBackgroundColor();this.setOpacity();return this.div},updateRelativePosition:function(){this.setRicoCorners()},setSize:function(a){OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments);this.setRicoCorners()},setBackgroundColor:function(a){if(a!=undefined){this.backgroundColor=a}if(this.div!=null){if(this.contentDiv!=null){this.div.style.background="transparent";OpenLayers.Rico.Corner.changeColor(this.groupDiv,this.backgroundColor)}}},setOpacity:function(a){OpenLayers.Popup.Anchored.prototype.setOpacity.call(this,a);if(this.div!=null){if(this.groupDiv!=null){OpenLayers.Rico.Corner.changeOpacity(this.groupDiv,this.opacity)}}},setBorder:function(a){this.border=0},setRicoCorners:function(){var a=this.getCornersToRound(this.relativePosition);var b={corners:a,color:this.backgroundColor,bgColor:"transparent",blend:false};if(!this.rounded){OpenLayers.Rico.Corner.round(this.div,b);this.rounded=true}else{OpenLayers.Rico.Corner.reRound(this.groupDiv,b);this.setBackgroundColor();this.setOpacity()}},getCornersToRound:function(){var a=["tl","tr","bl","br"];var b=OpenLayers.Bounds.oppositeQuadrant(this.relativePosition);OpenLayers.Util.removeItem(a,b);return a.join(" ")},CLASS_NAME:"OpenLayers.Popup.AnchoredBubble"});OpenLayers.Popup.AnchoredBubble.CORNER_SIZE=5;OpenLayers.Popup.Framed=OpenLayers.Class(OpenLayers.Popup.Anchored,{imageSrc:null,imageSize:null,isAlphaImage:false,positionBlocks:null,blocks:null,fixedRelativePosition:false,initialize:function(h,c,g,b,a,f,e){OpenLayers.Popup.Anchored.prototype.initialize.apply(this,arguments);if(this.fixedRelativePosition){this.updateRelativePosition();this.calculateRelativePosition=function(k){return this.relativePosition}}this.contentDiv.style.position="absolute";this.contentDiv.style.zIndex=1;if(f){this.closeDiv.style.zIndex=1}this.groupDiv.style.position="absolute";this.groupDiv.style.top="0px";this.groupDiv.style.left="0px";this.groupDiv.style.height="100%";this.groupDiv.style.width="100%"},destroy:function(){this.imageSrc=null;this.imageSize=null;this.isAlphaImage=null;this.fixedRelativePosition=false;this.positionBlocks=null;for(var a=0;a<this.blocks.length;a++){var b=this.blocks[a];if(b.image){b.div.removeChild(b.image)}b.image=null;if(b.div){this.groupDiv.removeChild(b.div)}b.div=null}this.blocks=null;OpenLayers.Popup.Anchored.prototype.destroy.apply(this,arguments)},setBackgroundColor:function(a){},setBorder:function(){},setOpacity:function(a){},setSize:function(a){OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments);this.updateBlocks()},updateRelativePosition:function(){this.padding=this.positionBlocks[this.relativePosition].padding;if(this.closeDiv){var a=this.getContentDivPadding();this.closeDiv.style.right=a.right+this.padding.right+"px";this.closeDiv.style.top=a.top+this.padding.top+"px"}this.updateBlocks()},calculateNewPx:function(a){var b=OpenLayers.Popup.Anchored.prototype.calculateNewPx.apply(this,arguments);b=b.offset(this.positionBlocks[this.relativePosition].offset);return b},createBlocks:function(){this.blocks=[];var g=null;for(var f in this.positionBlocks){g=f;break}var a=this.positionBlocks[g];for(var e=0;e<a.blocks.length;e++){var k={};this.blocks.push(k);var b=this.id+"_FrameDecorationDiv_"+e;k.div=OpenLayers.Util.createDiv(b,null,null,null,"absolute",null,"hidden",null);var c=this.id+"_FrameDecorationImg_"+e;var h=(this.isAlphaImage)?OpenLayers.Util.createAlphaImageDiv:OpenLayers.Util.createImage;k.image=h(c,null,this.imageSize,this.imageSrc,"absolute",null,null,null);k.div.appendChild(k.image);this.groupDiv.appendChild(k.div)}},updateBlocks:function(){if(!this.blocks){this.createBlocks()}if(this.size&&this.relativePosition){var m=this.positionBlocks[this.relativePosition];for(var g=0;g<m.blocks.length;g++){var c=m.blocks[g];var f=this.blocks[g];var e=c.anchor.left;var n=c.anchor.bottom;var a=c.anchor.right;var p=c.anchor.top;var o=(isNaN(c.size.w))?this.size.w-(a+e):c.size.w;var k=(isNaN(c.size.h))?this.size.h-(n+p):c.size.h;f.div.style.width=(o<0?0:o)+"px";f.div.style.height=(k<0?0:k)+"px";f.div.style.left=(e!=null)?e+"px":"";f.div.style.bottom=(n!=null)?n+"px":"";f.div.style.right=(a!=null)?a+"px":"";f.div.style.top=(p!=null)?p+"px":"";f.image.style.left=c.position.x+"px";f.image.style.top=c.position.y+"px"}this.contentDiv.style.left=this.padding.left+"px";this.contentDiv.style.top=this.padding.top+"px"}},CLASS_NAME:"OpenLayers.Popup.Framed"});OpenLayers.Projection=OpenLayers.Class({proj:null,projCode:null,initialize:function(b,a){OpenLayers.Util.extend(this,a);this.projCode=b;if(window.Proj4js){this.proj=new Proj4js.Proj(b)}},getCode:function(){return this.proj?this.proj.srsCode:this.projCode},getUnits:function(){return this.proj?this.proj.units:null},toString:function(){return this.getCode()},equals:function(a){if(a&&a.getCode){return this.getCode()==a.getCode()}else{return false}},destroy:function(){delete this.proj;delete this.projCode},CLASS_NAME:"OpenLayers.Projection"});OpenLayers.Projection.transforms={};OpenLayers.Projection.addTransform=function(c,b,a){if(!OpenLayers.Projection.transforms[c]){OpenLayers.Projection.transforms[c]={}}OpenLayers.Projection.transforms[c][b]=a};OpenLayers.Projection.transform=function(a,c,b){if(c.proj&&b.proj){a=Proj4js.transform(c.proj,b.proj,a)}else{if(c&&b&&OpenLayers.Projection.transforms[c.getCode()]&&OpenLayers.Projection.transforms[c.getCode()][b.getCode()]){OpenLayers.Projection.transforms[c.getCode()][b.getCode()](a)}}return a};OpenLayers.Renderer.SVG=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"http://www.w3.org/2000/svg",xlinkns:"http://www.w3.org/1999/xlink",MAX_PIXEL:15000,translationParameters:null,symbolMetrics:null,isGecko:null,supportUse:null,initialize:function(a){if(!this.supported()){return}OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments);this.translationParameters={x:0,y:0};this.supportUse=(navigator.userAgent.toLowerCase().indexOf("applewebkit/5")==-1);this.isGecko=(navigator.userAgent.toLowerCase().indexOf("gecko/")!=-1);this.symbolMetrics={}},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments)},supported:function(){var a="http://www.w3.org/TR/SVG11/feature#";return(document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature(a+"SVG","1.1")||document.implementation.hasFeature(a+"BasicStructure","1.1")))},inValidRange:function(a,f,b){var e=a+(b?0:this.translationParameters.x);var c=f+(b?0:this.translationParameters.y);return(e>=-this.MAX_PIXEL&&e<=this.MAX_PIXEL&&c>=-this.MAX_PIXEL&&c<=this.MAX_PIXEL)},setExtent:function(b,e){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var a=this.getResolution();var g=-b.left/a;var f=b.top/a;if(e){this.left=g;this.top=f;var c="0 0 "+this.size.w+" "+this.size.h;this.rendererRoot.setAttributeNS(null,"viewBox",c);this.translate(0,0);return true}else{var h=this.translate(g-this.left,f-this.top);if(!h){this.setExtent(b,true)}return h}},translate:function(a,c){if(!this.inValidRange(a,c,true)){return false}else{var b="";if(a||c){b="translate("+a+","+c+")"}this.root.setAttributeNS(null,"transform",b);this.translationParameters={x:a,y:c};return true}},setSize:function(a){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);this.rendererRoot.setAttributeNS(null,"width",this.size.w);this.rendererRoot.setAttributeNS(null,"height",this.size.h)},getNodeType:function(c,b){var a=null;switch(c.CLASS_NAME){case"OpenLayers.Geometry.Point":if(b.externalGraphic){a="image"}else{if(this.isComplexSymbol(b.graphicName)){a=this.supportUse===false?"svg":"use"}else{a="circle"}}break;case"OpenLayers.Geometry.Rectangle":a="rect";break;case"OpenLayers.Geometry.LineString":a="polyline";break;case"OpenLayers.Geometry.LinearRing":a="polygon";break;case"OpenLayers.Geometry.Polygon":case"OpenLayers.Geometry.Curve":case"OpenLayers.Geometry.Surface":a="path";break;default:break}return a},setStyle:function(s,v,b){v=v||s._style;b=b||s._options;var m=parseFloat(s.getAttributeNS(null,"r"));var l=1;var e;if(s._geometryClass=="OpenLayers.Geometry.Point"&&m){s.style.visibility="";if(v.graphic===false){s.style.visibility="hidden"}else{if(v.externalGraphic){e=this.getPosition(s);if(v.graphicTitle){s.setAttributeNS(null,"title",v.graphicTitle)}if(v.graphicWidth&&v.graphicHeight){s.setAttributeNS(null,"preserveAspectRatio","none")}var q=v.graphicWidth||v.graphicHeight;var o=v.graphicHeight||v.graphicWidth;q=q?q:v.pointRadius*2;o=o?o:v.pointRadius*2;var w=(v.graphicXOffset!=undefined)?v.graphicXOffset:-(0.5*q);var g=(v.graphicYOffset!=undefined)?v.graphicYOffset:-(0.5*o);var a=v.graphicOpacity||v.fillOpacity;s.setAttributeNS(null,"x",(e.x+w).toFixed());s.setAttributeNS(null,"y",(e.y+g).toFixed());s.setAttributeNS(null,"width",q);s.setAttributeNS(null,"height",o);s.setAttributeNS(this.xlinkns,"href",v.externalGraphic);s.setAttributeNS(null,"style","opacity: "+a)}else{if(this.isComplexSymbol(v.graphicName)){var c=v.pointRadius*3;var n=c*2;var p=this.importSymbol(v.graphicName);e=this.getPosition(s);l=this.symbolMetrics[p][0]*3/n;var h=s.parentNode;var k=s.nextSibling;if(h){h.removeChild(s)}if(this.supportUse===false){var f=document.getElementById(p);s.firstChild&&s.removeChild(s.firstChild);s.appendChild(f.firstChild.cloneNode(true));s.setAttributeNS(null,"viewBox",f.getAttributeNS(null,"viewBox"))}else{s.setAttributeNS(this.xlinkns,"href","#"+p)}s.setAttributeNS(null,"width",n);s.setAttributeNS(null,"height",n);s.setAttributeNS(null,"x",e.x-c);s.setAttributeNS(null,"y",e.y-c);if(k){h.insertBefore(s,k)}else{if(h){h.appendChild(s)}}}else{s.setAttributeNS(null,"r",v.pointRadius)}}}var u=v.rotation;if((u!==undefined||s._rotation!==undefined)&&e){s._rotation=u;u|=0;if(s.nodeName!=="svg"){s.setAttributeNS(null,"transform","rotate("+u+" "+e.x+" "+e.y+")")}else{var t=this.symbolMetrics[p];s.firstChild.setAttributeNS(null,"transform","rotate("+v.rotation+" "+t[1]+" "+t[2]+")")}}}if(b.isFilled){s.setAttributeNS(null,"fill",v.fillColor);s.setAttributeNS(null,"fill-opacity",v.fillOpacity)}else{s.setAttributeNS(null,"fill","none")}if(b.isStroked){s.setAttributeNS(null,"stroke",v.strokeColor);s.setAttributeNS(null,"stroke-opacity",v.strokeOpacity);s.setAttributeNS(null,"stroke-width",v.strokeWidth*l);s.setAttributeNS(null,"stroke-linecap",v.strokeLinecap||"round");s.setAttributeNS(null,"stroke-linejoin","round");v.strokeDashstyle&&s.setAttributeNS(null,"stroke-dasharray",this.dashStyle(v,l))}else{s.setAttributeNS(null,"stroke","none")}if(v.pointerEvents){s.setAttributeNS(null,"pointer-events",v.pointerEvents)}if(v.cursor!=null){s.setAttributeNS(null,"cursor",v.cursor)}return s},dashStyle:function(c,b){var a=c.strokeWidth*b;var e=c.strokeDashstyle;switch(e){case"solid":return"none";case"dot":return[1,4*a].join();case"dash":return[4*a,4*a].join();case"dashdot":return[4*a,4*a,1,4*a].join();case"longdash":return[8*a,4*a].join();case"longdashdot":return[8*a,4*a,1,4*a].join();default:return OpenLayers.String.trim(e).replace(/\s+/g,",")}},createNode:function(a,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(e,f,b){var c=this.getResolution();var a=(f.x/c+this.left);var g=(this.top-f.y/c);if(this.inValidRange(a,g)){e.setAttributeNS(null,"cx",a);e.setAttributeNS(null,"cy",g);e.setAttributeNS(null,"r",b);return e}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,e){var b=this.getResolution();var a=(e.x/b+this.left);var f=(this.top-e.y/b);if(this.inValidRange(a,f)){c.setAttributeNS(null,"x",a);c.setAttributeNS(null,"y",f);c.setAttributeNS(null,"width",e.width/b);c.setAttributeNS(null,"height",e.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,l){var b=this.getResolution();var k=(l.x/b+this.left);var f=(l.y/b-this.top);var h=this.nodeFactory(c+this.LABEL_ID_SUFFIX,"text");var g=this.nodeFactory(c+this.LABEL_ID_SUFFIX+"_tspan","tspan");h.setAttributeNS(null,"x",k);h.setAttributeNS(null,"y",-f);if(a.fontColor){h.setAttributeNS(null,"fill",a.fontColor)}if(a.fontOpacity){h.setAttributeNS(null,"opacity",a.fontOpacity)}if(a.fontFamily){h.setAttributeNS(null,"font-family",a.fontFamily)}if(a.fontSize){h.setAttributeNS(null,"font-size",a.fontSize)}if(a.fontWeight){h.setAttributeNS(null,"font-weight",a.fontWeight)}if(a.labelSelect===true){h.setAttributeNS(null,"pointer-events","visible");h._featureId=c;g._featureId=c;g._geometry=l;g._geometryClass=l.CLASS_NAME}else{h.setAttributeNS(null,"pointer-events","none")}var e=a.labelAlign||"cm";h.setAttributeNS(null,"text-anchor",OpenLayers.Renderer.SVG.LABEL_ALIGN[e[0]]||"middle");if(this.isGecko){h.setAttributeNS(null,"dominant-baseline",OpenLayers.Renderer.SVG.LABEL_ALIGN[e[1]]||"central")}else{g.setAttributeNS(null,"baseline-shift",OpenLayers.Renderer.SVG.LABEL_VSHIFT[e[1]]||"-35%")}g.textContent=a.label;if(!h.parentNode){h.appendChild(g);this.textRoot.appendChild(h)}},getComponentsString:function(e,c){var g=[];var a=true;var f=e.length;var l=[];var h,k;for(var b=0;b<f;b++){k=e[b];g.push(k);h=this.getShortString(k);if(h){l.push(h)}else{if(b>0){if(this.getShortString(e[b-1])){l.push(this.clipLine(e[b],e[b-1]))}}if(b<f-1){if(this.getShortString(e[b+1])){l.push(this.clipLine(e[b],e[b+1]))}}a=false}}return{path:l.join(c||","),complete:a}},clipLine:function(f,l){if(l.equals(f)){return""}var g=this.getResolution();var b=this.MAX_PIXEL-this.translationParameters.x;var a=this.MAX_PIXEL-this.translationParameters.y;var e=l.x/g+this.left;var n=this.top-l.y/g;var c=f.x/g+this.left;var m=this.top-f.y/g;var h;if(c<-b||c>b){h=(m-n)/(c-e);c=c<0?-b:b;m=n+(c-e)*h}if(m<-a||m>a){h=(c-e)/(m-n);m=m<0?-a:a;c=e+(m-n)*h}return c+","+m},getShortString:function(b){var c=this.getResolution();var a=(b.x/c+this.left);var e=(this.top-b.y/c);if(this.inValidRange(a,e)){return a+","+e}else{return false}},getPosition:function(a){return({x:parseFloat(a.getAttributeNS(null,"cx")),y:parseFloat(a.getAttributeNS(null,"cy"))})},importSymbol:function(f){if(!this.defs){this.defs=this.createDefs()}var b=this.container.id+"-"+f;if(document.getElementById(b)!=null){return b}var e=OpenLayers.Renderer.symbol[f];if(!e){throw new Error(f+" is not a valid symbol name")}var h=this.nodeFactory(b,"symbol");var c=this.nodeFactory(null,"polygon");h.appendChild(c);var o=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0);var m=[];var l,k;for(var g=0;g<e.length;g=g+2){l=e[g];k=e[g+1];o.left=Math.min(o.left,l);o.bottom=Math.min(o.bottom,k);o.right=Math.max(o.right,l);o.top=Math.max(o.top,k);m.push(l,",",k)}c.setAttributeNS(null,"points",m.join(" "));var a=o.getWidth();var n=o.getHeight();var p=[o.left-a,o.bottom-n,a*3,n*3];h.setAttributeNS(null,"viewBox",p.join(" "));this.symbolMetrics[b]=[Math.max(a,n),o.getCenterLonLat().lon,o.getCenterLonLat().lat];this.defs.appendChild(h);return h.id},getFeatureIdFromEvent:function(a){var c=OpenLayers.Renderer.Elements.prototype.getFeatureIdFromEvent.apply(this,arguments);if(this.supportUse===false&&!c){var b=a.target;c=b.parentNode&&b!=this.rendererRoot&&b.parentNode._featureId}return c},CLASS_NAME:"OpenLayers.Renderer.SVG"});OpenLayers.Renderer.SVG.LABEL_ALIGN={l:"start",r:"end",b:"bottom",t:"hanging"};OpenLayers.Renderer.SVG.LABEL_VSHIFT={t:"-70%",b:"0"};OpenLayers.Renderer.VML=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"urn:schemas-microsoft-com:vml",symbolCache:{},offset:null,initialize:function(b){if(!this.supported()){return}if(!document.namespaces.olv){document.namespaces.add("olv",this.xmlns);var f=document.createStyleSheet();var c=["shape","rect","oval","fill","stroke","imagedata","group","textbox"];for(var e=0,a=c.length;e<a;e++){f.addRule("olv\\:"+c[e],"behavior: url(#default#VML); position: absolute; display: inline-block;")}}OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments)},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments)},supported:function(){return !!(document.namespaces)},setExtent:function(l,a){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var c=this.getResolution();var b=(l.left/c)|0;var g=(l.top/c-this.size.h)|0;if(a||!this.offset){this.offset={x:b,y:g};b=0;g=0}else{b=b-this.offset.x;g=g-this.offset.y}var n=b+" "+g;this.root.coordorigin=n;var k=[this.root,this.vectorRoot,this.textRoot];var h;for(var e=0,f=k.length;e<f;++e){h=k[e];var m=this.size.w+" "+this.size.h;h.coordsize=m}this.root.style.flip="y";return true},setSize:function(g){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);var e=[this.rendererRoot,this.root,this.vectorRoot,this.textRoot];var c=this.size.w+"px";var k=this.size.h+"px";var b;for(var f=0,a=e.length;f<a;++f){b=e[f];b.style.width=c;b.style.height=k}},getNodeType:function(c,b){var a=null;switch(c.CLASS_NAME){case"OpenLayers.Geometry.Point":if(b.externalGraphic){a="olv:rect"}else{if(this.isComplexSymbol(b.graphicName)){a="olv:shape"}else{a="olv:oval"}}break;case"OpenLayers.Geometry.Rectangle":a="olv:rect";break;case"OpenLayers.Geometry.LineString":case"OpenLayers.Geometry.LinearRing":case"OpenLayers.Geometry.Polygon":case"OpenLayers.Geometry.Curve":case"OpenLayers.Geometry.Surface":a="olv:shape";break;default:break}return a},setStyle:function(f,b,t,n){b=b||f._style;t=t||f._options;var c=b.fillColor;if(f._geometryClass==="OpenLayers.Geometry.Point"){if(b.externalGraphic){if(b.graphicTitle){f.title=b.graphicTitle}var e=b.graphicWidth||b.graphicHeight;var o=b.graphicHeight||b.graphicWidth;e=e?e:b.pointRadius*2;o=o?o:b.pointRadius*2;var h=this.getResolution();var l=(b.graphicXOffset!=undefined)?b.graphicXOffset:-(0.5*e);var g=(b.graphicYOffset!=undefined)?b.graphicYOffset:-(0.5*o);f.style.left=(((n.x/h-this.offset.x)+l)|0)+"px";f.style.top=(((n.y/h-this.offset.y)-(g+o))|0)+"px";f.style.width=e+"px";f.style.height=o+"px";f.style.flip="y";c="none";t.isStroked=false}else{if(this.isComplexSymbol(b.graphicName)){var a=this.importSymbol(b.graphicName);f.path=a.path;f.coordorigin=a.left+","+a.bottom;var s=a.size;f.coordsize=s+","+s;this.drawCircle(f,n,b.pointRadius);f.style.flip="y"}else{this.drawCircle(f,n,b.pointRadius)}}}if(t.isFilled){f.fillcolor=c}else{f.filled="false"}var m=f.getElementsByTagName("fill");var r=(m.length==0)?null:m[0];if(!t.isFilled){if(r){f.removeChild(r)}}else{if(!r){r=this.createNode("olv:fill",f.id+"_fill")}r.opacity=b.fillOpacity;if(f._geometryClass==="OpenLayers.Geometry.Point"&&b.externalGraphic){if(b.graphicOpacity){r.opacity=b.graphicOpacity}r.src=b.externalGraphic;r.type="frame";if(!(b.graphicWidth&&b.graphicHeight)){r.aspect="atmost"}}if(r.parentNode!=f){f.appendChild(r)}}var q=b.rotation;if((q!==undefined||f._rotation!==undefined)){f._rotation=q;if(b.externalGraphic){this.graphicRotate(f,l,g,b);r.opacity=0}else{if(f._geometryClass==="OpenLayers.Geometry.Point"){f.style.rotation=q||0}}}var k=f.getElementsByTagName("stroke");var p=(k.length==0)?null:k[0];if(!t.isStroked){f.stroked=false;if(p){p.on=false}}else{if(!p){p=this.createNode("olv:stroke",f.id+"_stroke");f.appendChild(p)}p.on=true;p.color=b.strokeColor;p.weight=b.strokeWidth+"px";p.opacity=b.strokeOpacity;p.endcap=b.strokeLinecap=="butt"?"flat":(b.strokeLinecap||"round");if(b.strokeDashstyle){p.dashstyle=this.dashStyle(b)}}if(b.cursor!="inherit"&&b.cursor!=null){f.style.cursor=b.cursor}return f},graphicRotate:function(q,u,f,t){var t=t||q._style;var r=t.rotation||0;var a,m;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;m=Math.max(t.pointRadius*2,t.graphicWidth||0,t.graphicHeight||0);u=u*a;t.graphicWidth=m*a;t.graphicHeight=m;this.graphicRotate(q,u,f,t)}},this);v.src=t.externalGraphic;return}else{m=Math.max(t.graphicWidth,t.graphicHeight);a=t.graphicWidth/t.graphicHeight}var p=Math.round(t.graphicWidth||m*a);var n=Math.round(t.graphicHeight||m);q.style.width=p+"px";q.style.height=n+"px";var o=document.getElementById(q.id+"_image");if(!o){o=this.createNode("olv:imagedata",q.id+"_image");q.appendChild(o)}o.style.width=p+"px";o.style.height=n+"px";o.src=t.externalGraphic;o.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='', sizingMethod='scale')";var g=r*Math.PI/180;var k=Math.sin(g);var e=Math.cos(g);var h="progid:DXImageTransform.Microsoft.Matrix(M11="+e+",M12="+(-k)+",M21="+k+",M22="+e+",SizingMethod='auto expand')\n";var b=t.graphicOpacity||t.fillOpacity;if(b&&b!=1){h+="progid:DXImageTransform.Microsoft.BasicImage(opacity="+b+")\n"}q.style.filter=h;var s=new OpenLayers.Geometry.Point(-u,-f);var c=new OpenLayers.Bounds(0,0,p,n).toGeometry();c.rotate(t.rotation,s);var l=c.getBounds();q.style.left=Math.round(parseInt(q.style.left)+l.left)+"px";q.style.top=Math.round(parseInt(q.style.top)-l.bottom)+"px"},postDraw:function(a){a.style.visibility="visible";var c=a._style.fillColor;var b=a._style.strokeColor;if(c=="none"&&a.fillcolor!=c){a.fillcolor=c}if(b=="none"&&a.strokecolor!=b){a.strokecolor=b}},setNodeDimension:function(b,f){var e=f.getBounds();if(e){var a=this.getResolution();var c=new OpenLayers.Bounds((e.left/a-this.offset.x)|0,(e.bottom/a-this.offset.y)|0,(e.right/a-this.offset.x)|0,(e.top/a-this.offset.y)|0);b.style.left=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=OpenLayers.Function.False;return b},nodeTypeCompare:function(c,b){var e=b;var a=e.indexOf(":");if(a!=-1){e=e.substr(a+1)}var f=c.nodeName;a=f.indexOf(":");if(a!=-1){f=f.substr(a+1)}return(e==f)},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_vmlRoot","div")},createRoot:function(a){return this.nodeFactory(this.container.id+a,"olv:group")},drawPoint:function(a,b){return this.drawCircle(a,b,1)},drawCircle:function(e,f,a){if(!isNaN(f.x)&&!isNaN(f.y)){var b=this.getResolution();e.style.left=(((f.x/b-this.offset.x)|0)-a)+"px";e.style.top=(((f.y/b-this.offset.y)|0)-a)+"px";var c=a*2;e.style.width=c+"px";e.style.height=c+"px";return e}return false},drawLineString:function(a,b){return this.drawLine(a,b,false)},drawLinearRing:function(a,b){return this.drawLine(a,b,true)},drawLine:function(b,m,h){this.setNodeDimension(b,m);var c=this.getResolution();var a=m.components.length;var f=new Array(a);var k,n,l;for(var g=0;g<a;g++){k=m.components[g];n=(k.x/c-this.offset.x)|0;l=(k.y/c-this.offset.y)|0;f[g]=" "+n+","+l+" l "}var e=(h)?" x e":" e";b.path="m"+f.join("")+e;return b},drawPolygon:function(b,m){this.setNodeDimension(b,m);var c=this.getResolution();var o=[];var g,f,e,k,a,h,n,l;for(e=0,k=m.components.length;e<k;e++){g=m.components[e];o.push("m");for(f=0,a=g.components.length;f<a;f++){h=g.components[f];n=(h.x/c-this.offset.x)|0;l=(h.y/c-this.offset.y)|0;o.push(" "+n+","+l);if(f==0){o.push(" l")}}o.push(" x ")}o.push("e");b.path=o.join("");return b},drawRectangle:function(b,c){var a=this.getResolution();b.style.left=((c.x/a-this.offset.x)|0)+"px";b.style.top=((c.y/a-this.offset.y)|0)+"px";b.style.width=((c.width/a)|0)+"px";b.style.height=((c.height/a)|0)+"px";return b},drawText:function(e,a,k){var h=this.nodeFactory(e+this.LABEL_ID_SUFFIX,"olv:rect");var g=this.nodeFactory(e+this.LABEL_ID_SUFFIX+"_textbox","olv:textbox");var c=this.getResolution();h.style.left=((k.x/c-this.offset.x)|0)+"px";h.style.top=((k.y/c-this.offset.y)|0)+"px";h.style.flip="y";g.innerText=a.label;if(a.fontColor){g.style.color=a.fontColor}if(a.fontOpacity){g.style.filter="alpha(opacity="+(a.fontOpacity*100)+")"}if(a.fontFamily){g.style.fontFamily=a.fontFamily}if(a.fontSize){g.style.fontSize=a.fontSize}if(a.fontWeight){g.style.fontWeight=a.fontWeight}if(a.labelSelect===true){h._featureId=e;g._featureId=e;g._geometry=k;g._geometryClass=k.CLASS_NAME}g.style.whiteSpace="nowrap";g.inset="1px,0px,0px,0px";if(!h.parentNode){h.appendChild(g);this.textRoot.appendChild(h)}var f=a.labelAlign||"cm";if(f.length==1){f+="m"}var l=g.clientWidth*(OpenLayers.Renderer.VML.LABEL_SHIFT[f.substr(0,1)]);var b=g.clientHeight*(OpenLayers.Renderer.VML.LABEL_SHIFT[f.substr(1,1)]);h.style.left=parseInt(h.style.left)-l-1+"px";h.style.top=parseInt(h.style.top)+b+"px"},drawSurface:function(a,h){this.setNodeDimension(a,h);var b=this.getResolution();var l=[];var e,k,g;for(var c=0,f=h.components.length;c<f;c++){e=h.components[c];k=(e.x/b-this.offset.x)|0;g=(e.y/b-this.offset.y)|0;if((c%3)==0&&(c/3)==0){l.push("m")}else{if((c%3)==1){l.push(" c")}}l.push(" "+k+","+g)}l.push(" x e");a.path=l.join("");return a},moveRoot:function(b){var a=this.map.getLayer(b.container.id);if(a instanceof OpenLayers.Layer.Vector.RootContainer){a=this.map.getLayer(this.container.id)}a&&a.renderer.clear();OpenLayers.Renderer.Elements.prototype.moveRoot.apply(this,arguments);a&&a.redraw()},importSymbol:function(e){var b=this.container.id+"-"+e;var a=this.symbolCache[b];if(a){return a}var c=OpenLayers.Renderer.symbol[e];if(!c){throw new Error(e+" is not a valid symbol name")}var m=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0);var f=["m"];for(var g=0;g<c.length;g=g+2){var k=c[g];var h=c[g+1];m.left=Math.min(m.left,k);m.bottom=Math.min(m.bottom,h);m.right=Math.max(m.right,k);m.top=Math.max(m.top,h);f.push(k);f.push(h);if(g==0){f.push("l")}}f.push("x e");var n=f.join(" ");var l=(m.getWidth()-m.getHeight())/2;if(l>0){m.bottom=m.bottom-l;m.top=m.top+l}else{m.left=m.left+l;m.right=m.right-l}a={path:n,size:m.getWidth(),left:m.left,bottom:m.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(e,a,f,b,c){this.layer=e;this.position=a.clone();this.bounds=f.clone();this.url=b;this.size=c.clone();this.id=OpenLayers.Util.createUniqueID("Tile_");this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES)},unload:function(){if(this.isLoading){this.isLoading=false;this.events.triggerEvent("unload")}},destroy:function(){this.layer=null;this.bounds=null;this.size=null;this.position=null;this.events.destroy();this.events=null},clone:function(a){if(a==null){a=new OpenLayers.Tile(this.layer,this.position,this.bounds,this.url,this.size)}OpenLayers.Util.applyDefaults(a,this);return a},draw:function(){var a=this.layer.maxExtent;var b=(a&&this.bounds.intersectsBounds(a,false));this.shouldDraw=(b||this.layer.displayOutsideMaxExtent);this.clear();return this.shouldDraw},moveTo:function(b,a,c){if(c==null){c=true}this.bounds=b.clone();this.position=a.clone();if(c){this.draw()}},clear:function(){},getBoundsFromBaseLayer:function(a){var g=OpenLayers.i18n("reprojectDeprecated",{layerName:this.layer.name});OpenLayers.Console.warn(g);var e=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(e.lon>b.lon){if(e.lon<0){e.lon=-180-(e.lon+180)}else{b.lon=180+b.lon+180}}var f=new OpenLayers.Bounds(e.lon,b.lat,b.lon,e.lat);return f},showTile:function(){if(this.shouldDraw){this.show()}},show:function(){},hide:function(){},CLASS_NAME:"OpenLayers.Tile"});OpenLayers.Handler=OpenLayers.Class({id:null,control:null,map:null,keyMask:null,active:false,evt:null,initialize:function(e,b,a){OpenLayers.Util.extend(this,a);this.control=e;this.callbacks=b;var c=this.map||e.map;if(c){this.setMap(c)}this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},setMap:function(a){this.map=a},checkModifiers:function(a){if(this.keyMask==null){return true}var b=(a.shiftKey?OpenLayers.Handler.MOD_SHIFT:0)|(a.ctrlKey?OpenLayers.Handler.MOD_CTRL:0)|(a.altKey?OpenLayers.Handler.MOD_ALT:0);return(b==this.keyMask)},activate:function(){if(this.active){return false}var c=OpenLayers.Events.prototype.BROWSER_EVENTS;for(var b=0,a=c.length;b<a;b++){if(this[c[b]]){this.register(c[b],this[c[b]])}}this.active=true;return true},deactivate:function(){if(!this.active){return false}var c=OpenLayers.Events.prototype.BROWSER_EVENTS;for(var b=0,a=c.length;b<a;b++){if(this[c[b]]){this.unregister(c[b],this[c[b]])}}this.active=false;return true},callback:function(b,a){if(b&&this.callbacks[b]){this.callbacks[b].apply(this.control,a)}},register:function(a,b){this.map.events.registerPriority(a,this,b);this.map.events.registerPriority(a,this,this.setEvent)},unregister:function(a,b){this.map.events.unregister(a,this,b);this.map.events.unregister(a,this,this.setEvent)},setEvent:function(a){this.evt=a;return true},destroy:function(){this.deactivate();this.control=this.map=null},CLASS_NAME:"OpenLayers.Handler"});OpenLayers.Handler.MOD_NONE=0;OpenLayers.Handler.MOD_SHIFT=1;OpenLayers.Handler.MOD_CTRL=2;OpenLayers.Handler.MOD_ALT=4;OpenLayers.Map=OpenLayers.Class({Z_INDEX_BASE:{BaseLayer:100,Overlay:325,Feature:725,Popup:750,Control:1000},EVENT_TYPES:["preaddlayer","addlayer","removelayer","changelayer","movestart","move","moveend","zoomend","popupopen","popupclose","addmarker","removemarker","clearmarkers","mouseover","mouseout","mousemove","dragstart","drag","dragend","changebaselayer"],id:null,fractionalZoom:false,events:null,allOverlays:false,div:null,dragging:false,size:null,viewPortDiv:null,layerContainerOrigin:null,layerContainerDiv:null,layers:null,controls:null,popups:null,baseLayer:null,center:null,resolution:null,zoom:0,panRatio:1.5,viewRequestID:0,tileSize:null,projection:"EPSG:4326",units:"degrees",resolutions:null,maxResolution:1.40625,minResolution:null,maxScale:null,minScale:null,maxExtent:null,minExtent:null,restrictedExtent:null,numZoomLevels:16,theme:null,displayProjection:null,fallThrough:true,panTween:null,eventListeners:null,panMethod:OpenLayers.Easing.Expo.easeOut,panDuration:50,paddingForPopups:null,initialize:function(k,e){if(arguments.length===1&&typeof k==="object"){e=k;k=e&&e.div}this.tileSize=new OpenLayers.Size(OpenLayers.Map.TILE_WIDTH,OpenLayers.Map.TILE_HEIGHT);this.maxExtent=new OpenLayers.Bounds(-180,-90,180,90);this.paddingForPopups=new OpenLayers.Bounds(15,15,15,15);this.theme=OpenLayers._getScriptLocation()+"theme/default/style.css";OpenLayers.Util.extend(this,e);this.layers=[];this.id=OpenLayers.Util.createUniqueID("OpenLayers.Map_");this.div=OpenLayers.Util.getElement(k);if(!this.div){this.div=document.createElement("div");this.div.style.height="1px";this.div.style.width="1px"}OpenLayers.Element.addClass(this.div,"olMap");var h=this.id+"_OpenLayers_ViewPort";this.viewPortDiv=OpenLayers.Util.createDiv(h,null,null,null,"relative",null,"hidden");this.viewPortDiv.style.width="100%";this.viewPortDiv.style.height="100%";this.viewPortDiv.className="olMapViewport";this.div.appendChild(this.viewPortDiv);h=this.id+"_OpenLayers_Container";this.layerContainerDiv=OpenLayers.Util.createDiv(h);this.layerContainerDiv.style.zIndex=this.Z_INDEX_BASE.Popup-1;this.viewPortDiv.appendChild(this.layerContainerDiv);this.events=new OpenLayers.Events(this,this.div,this.EVENT_TYPES,this.fallThrough,{includeXY:true});this.updateSize();if(this.eventListeners instanceof Object){this.events.on(this.eventListeners)}this.events.register("movestart",this,this.updateSize);if(OpenLayers.String.contains(navigator.appName,"Microsoft")){this.events.register("resize",this,this.updateSize)}else{this.updateSizeDestroy=OpenLayers.Function.bind(this.updateSize,this);OpenLayers.Event.observe(window,"resize",this.updateSizeDestroy)}if(this.theme){var g=true;var c=document.getElementsByTagName("link");for(var f=0,a=c.length;f<a;++f){if(OpenLayers.Util.isEquivalentUrl(c.item(f).href,this.theme)){g=false;break}}if(g){var b=document.createElement("link");b.setAttribute("rel","stylesheet");b.setAttribute("type","text/css");b.setAttribute("href",this.theme);document.getElementsByTagName("head")[0].appendChild(b)}}if(this.controls==null){if(OpenLayers.Control!=null){this.controls=[new OpenLayers.Control.Navigation(),new OpenLayers.Control.PanZoom(),new OpenLayers.Control.ArgParser(),new OpenLayers.Control.Attribution()]}else{this.controls=[]}}for(var f=0,a=this.controls.length;f<a;f++){this.addControlToMap(this.controls[f])}this.popups=[];this.unloadDestroy=OpenLayers.Function.bind(this.destroy,this);OpenLayers.Event.observe(window,"unload",this.unloadDestroy);if(e&&e.layers){this.addLayers(e.layers);if(e.center){this.setCenter(e.center,e.zoom)}}},render:function(a){this.div=OpenLayers.Util.getElement(a);OpenLayers.Element.addClass(this.div,"olMap");this.events.attachToElement(this.div);this.viewPortDiv.parentNode.removeChild(this.viewPortDiv);this.div.appendChild(this.viewPortDiv);this.updateSize()},unloadDestroy:null,updateSizeDestroy:null,destroy:function(){if(!this.unloadDestroy){return false}if(this.panTween){this.panTween.stop();this.panTween=null}OpenLayers.Event.stopObserving(window,"unload",this.unloadDestroy);this.unloadDestroy=null;if(this.updateSizeDestroy){OpenLayers.Event.stopObserving(window,"resize",this.updateSizeDestroy)}else{this.events.unregister("resize",this,this.updateSize)}this.paddingForPopups=null;if(this.controls!=null){for(var a=this.controls.length-1;a>=0;--a){this.controls[a].destroy()}this.controls=null}if(this.layers!=null){for(var a=this.layers.length-1;a>=0;--a){this.layers[a].destroy(false)}this.layers=null}if(this.viewPortDiv){this.div.removeChild(this.viewPortDiv)}this.viewPortDiv=null;if(this.eventListeners){this.events.un(this.eventListeners);this.eventListeners=null}this.events.destroy();this.events=null},setOptions:function(a){OpenLayers.Util.extend(this,a)},getTileSize:function(){return this.tileSize},getBy:function(f,c,a){var e=(typeof a.test=="function");var b=OpenLayers.Array.filter(this[f],function(g){return g[c]==a||(e&&a.test(g[c]))});return b},getLayersBy:function(b,a){return this.getBy("layers",b,a)},getLayersByName:function(a){return this.getLayersBy("name",a)},getLayersByClass:function(a){return this.getLayersBy("CLASS_NAME",a)},getControlsBy:function(b,a){return this.getBy("controls",b,a)},getControlsByClass:function(a){return this.getControlsBy("CLASS_NAME",a)},getLayer:function(f){var b=null;for(var e=0,a=this.layers.length;e<a;e++){var c=this.layers[e];if(c.id==f){b=c;break}}return b},setLayerZIndex:function(b,a){b.setZIndex(this.Z_INDEX_BASE[b.isBaseLayer?"BaseLayer":"Overlay"]+a*5)},resetLayersZIndex:function(){for(var c=0,a=this.layers.length;c<a;c++){var b=this.layers[c];this.setLayerZIndex(b,c)}},addLayer:function(c){for(var b=0,a=this.layers.length;b<a;b++){if(this.layers[b]==c){var e=OpenLayers.i18n("layerAlreadyAdded",{layerName:c.name});OpenLayers.Console.warn(e);return false}}if(this.allOverlays){c.isBaseLayer=false}if(this.events.triggerEvent("preaddlayer",{layer:c})===false){return}c.div.className="olLayerDiv";c.div.style.overflow="";this.setLayerZIndex(c,this.layers.length);if(c.isFixed){this.viewPortDiv.appendChild(c.div)}else{this.layerContainerDiv.appendChild(c.div)}this.layers.push(c);c.setMap(this);if(c.isBaseLayer||(this.allOverlays&&!this.baseLayer)){if(this.baseLayer==null){this.setBaseLayer(c)}else{c.setVisibility(false)}}else{c.redraw()}this.events.triggerEvent("addlayer",{layer:c});c.afterAdd()},addLayers:function(c){for(var b=0,a=c.length;b<a;b++){this.addLayer(c[b])}},removeLayer:function(c,f){if(f==null){f=true}if(c.isFixed){this.viewPortDiv.removeChild(c.div)}else{this.layerContainerDiv.removeChild(c.div)}OpenLayers.Util.removeItem(this.layers,c);c.removeMap(this);c.map=null;if(this.baseLayer==c){this.baseLayer=null;if(f){for(var b=0,a=this.layers.length;b<a;b++){var e=this.layers[b];if(e.isBaseLayer||this.allOverlays){this.setBaseLayer(e);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(e,b){var f=this.getLayerIndex(e);if(b<0){b=0}else{if(b>this.layers.length){b=this.layers.length}}if(f!=b){this.layers.splice(f,1);this.layers.splice(b,0,e);for(var c=0,a=this.layers.length;c<a;c++){this.setLayerZIndex(this.layers[c],c)}this.events.triggerEvent("changelayer",{layer:e,property:"order"});if(this.allOverlays){if(b===0){this.setBaseLayer(e)}else{if(this.baseLayer!==this.layers[0]){this.setBaseLayer(this.layers[0])}}}}},raiseLayer:function(b,c){var a=this.getLayerIndex(b)+c;this.setLayerIndex(b,a)},setBaseLayer:function(c){if(c!=this.baseLayer){if(OpenLayers.Util.indexOf(this.layers,c)!=-1){var a=this.getCenter();var e=OpenLayers.Util.getResolutionFromScale(this.getScale(),c.units);if(this.baseLayer!=null&&!this.allOverlays){this.baseLayer.setVisibility(false)}this.baseLayer=c;this.viewRequestID++;if(!this.allOverlays||this.baseLayer.visibility){this.baseLayer.setVisibility(true)}if(a!=null){var b=this.getZoomForResolution(e||this.resolution,true);this.setCenter(a,b,false,true)}this.events.triggerEvent("changebaselayer",{layer:this.baseLayer})}}},addControl:function(b,a){this.controls.push(b);this.addControlToMap(b,a)},addControls:function(b,h){var f=(arguments.length===1)?[]:h;for(var e=0,a=b.length;e<a;e++){var g=b[e];var c=(f[e])?f[e]:null;this.addControl(g,c)}},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)}}if(b.autoActivate){b.activate()}},getControl:function(f){var b=null;for(var c=0,a=this.controls.length;c<a;c++){var e=this.controls[c];if(e.id==f){b=e;break}}return b},removeControl:function(a){if((a)&&(a==this.getControl(a.id))){if(a.div&&(a.div.parentNode==this.viewPortDiv)){this.viewPortDiv.removeChild(a.div)}OpenLayers.Util.removeItem(this.controls,a)}},addPopup:function(a,e){if(e){for(var b=this.popups.length-1;b>=0;--b){this.removePopup(this.popups[b])}}a.map=this;this.popups.push(a);var 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(){var c=this.getCurrentSize();if(c&&!isNaN(c.h)&&!isNaN(c.w)){this.events.clearMouseCache();var g=this.getSize();if(g==null){this.size=g=c}if(!c.equals(g)){this.size=c;for(var e=0,b=this.layers.length;e<b;e++){this.layers[e].onMapResize()}var a=this.getCenter();if(this.baseLayer!=null&&a!=null){var f=this.getZoom();this.zoom=null;this.setCenter(a,f)}}}},getCurrentSize:function(){var a=new OpenLayers.Size(this.div.clientWidth,this.div.clientHeight);if(a.w==0&&a.h==0||isNaN(a.w)&&isNaN(a.h)){a.w=this.div.offsetWidth;a.h=this.div.offsetHeight}if(a.w==0&&a.h==0||isNaN(a.w)&&isNaN(a.h)){a.w=parseInt(this.div.style.width);a.h=parseInt(this.div.style.height)}return a},calculateBounds:function(a,b){var f=null;if(a==null){a=this.getCenter()}if(b==null){b=this.getResolution()}if((a!=null)&&(b!=null)){var e=this.getSize();var g=e.w*b;var c=e.h*b;f=new OpenLayers.Bounds(a.lon-g/2,a.lat-c/2,a.lon+g/2,a.lat+c/2)}return f},getCenter:function(){var a=null;if(this.center){a=this.center.clone()}return a},getZoom:function(){return this.zoom},pan:function(e,c,f){f=OpenLayers.Util.applyDefaults(f,{animate:true,dragging:false});var g=this.getViewPortPxFromLonLat(this.getCenter());var b=g.add(e,c);if(!f.dragging||!b.equals(g)){var a=this.getLonLatFromViewPortPx(b);if(f.animate){this.panTo(a)}else{this.setCenter(a,null,f.dragging)}}},panTo:function(b){if(this.panMethod&&this.getExtent().scale(this.panRatio).containsLonLat(b)){if(!this.panTween){this.panTween=new OpenLayers.Tween(this.panMethod)}var a=this.getCenter();if(b.lon==a.lon&&b.lat==a.lat){return}var e={lon:a.lon,lat:a.lat};var c={lon:b.lon,lat:b.lat};this.panTween.start(e,c,this.panDuration,{callbacks:{start:OpenLayers.Function.bind(function(f){this.events.triggerEvent("movestart")},this),eachStep:OpenLayers.Function.bind(function(f){f=new OpenLayers.LonLat(f.lon,f.lat);this.moveTo(f,this.zoom,{dragging:true,noEvent:true})},this),done:OpenLayers.Function.bind(function(f){f=new OpenLayers.LonLat(f.lon,f.lat);this.moveTo(f,this.zoom,{noEvent:true});this.events.triggerEvent("moveend")},this)}})}else{this.setCenter(b)}},setCenter:function(c,a,b,e){this.moveTo(c,a,{dragging:b,forceZoomChange:e,caller:"setCenter"})},moveTo:function(h,p,s){if(!s){s={}}if(p!=null){p=parseFloat(p);if(!this.fractionalZoom){p=Math.round(p)}}var o=s.dragging;var c=s.forceZoomChange;var k=s.noEvent;if(this.panTween&&s.caller=="setCenter"){this.panTween.stop()}if(!this.center&&!this.isValidLonLat(h)){h=this.maxExtent.getCenterLonLat()}if(this.restrictedExtent!=null){if(h==null){h=this.getCenter()}if(p==null){p=this.getZoom()}var e=this.getResolutionForZoom(p);var q=this.calculateBounds(h,e);if(!this.restrictedExtent.containsBounds(q)){var r=this.restrictedExtent.getCenterLonLat();if(q.getWidth()>this.restrictedExtent.getWidth()){h=new OpenLayers.LonLat(r.lon,h.lat)}else{if(q.left<this.restrictedExtent.left){h=h.add(this.restrictedExtent.left-q.left,0)}else{if(q.right>this.restrictedExtent.right){h=h.add(this.restrictedExtent.right-q.right,0)}}}if(q.getHeight()>this.restrictedExtent.getHeight()){h=new OpenLayers.LonLat(h.lon,r.lat)}else{if(q.bottom<this.restrictedExtent.bottom){h=h.add(0,this.restrictedExtent.bottom-q.bottom)}else{if(q.top>this.restrictedExtent.top){h=h.add(0,this.restrictedExtent.top-q.top)}}}}}var b=c||((this.isValidZoomLevel(p))&&(p!=this.getZoom()));var f=(this.isValidLonLat(h))&&(!h.equals(this.center));if(b||f||!o){if(!this.dragging&&!k){this.events.triggerEvent("movestart")}if(f){if((!b)&&(this.center)){this.centerLayerContainer(h)}this.center=h.clone()}if((b)||(this.layerContainerOrigin==null)){this.layerContainerOrigin=this.center.clone();this.layerContainerDiv.style.left="0px";this.layerContainerDiv.style.top="0px"}if(b){this.zoom=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 g=0,m=this.layers.length;g<m;g++){var l=this.layers[g];if(l!==this.baseLayer&&!l.isBaseLayer){var n=l.calculateInRange();if(l.inRange!=n){l.inRange=n;if(!n){l.display(false)}this.events.triggerEvent("changelayer",{layer:l,property:"visibility"})}if(n&&l.visibility){l.moveTo(a,b,o);if(o){l.events.triggerEvent("move")}else{l.events.triggerEvent("moveend",{zoomChanged:b})}}}}if(b){for(var g=0,m=this.popups.length;g<m;g++){this.popups[g].updatePosition()}}this.events.triggerEvent("move");if(b){this.events.triggerEvent("zoomend")}}if(!o&&!k){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()}else{if(this.allOverlays===true&&this.layers.length>0){a=this.layers[0].getResolution()}}return a},getUnits:function(){var a=null;if(this.baseLayer!=null){a=this.baseLayer.units}return a},getScale:function(){var 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(e,c){var b=e.getCenterLonLat();if(this.baseLayer.wrapDateLine){var a=this.getMaxExtent();e=e.clone();while(e.right<e.left){e.right+=a.getWidth()}b=e.getCenterLonLat().wrapDateLine(a)}this.setCenter(b,this.getZoomForExtent(e,c))},zoomToMaxExtent:function(c){var b=(c)?c.restricted:true;var a=this.getMaxExtent({restricted:b});this.zoomToExtent(a)},zoomToScale:function(k,h){var e=OpenLayers.Util.getResolutionFromScale(k,this.baseLayer.units);var c=this.getSize();var g=c.w*e;var b=c.h*e;var a=this.getCenter();var f=new OpenLayers.Bounds(a.lon-g/2,a.lat-b/2,a.lon+g/2,a.lat+b/2);this.zoomToExtent(f,h)},getLonLatFromViewPortPx:function(a){var b=null;if(this.baseLayer!=null){b=this.baseLayer.getLonLatFromViewPortPx(a)}return b},getViewPortPxFromLonLat:function(b){var a=null;if(this.baseLayer!=null){a=this.baseLayer.getViewPortPxFromLonLat(b)}return a},getLonLatFromPixel:function(a){return this.getLonLatFromViewPortPx(a)},getPixelFromLonLat:function(b){var a=this.getViewPortPxFromLonLat(b);a.x=Math.round(a.x);a.y=Math.round(a.y);return a},getGeodesicPixelSize:function(h){var e=h?this.getLonLatFromPixel(h):(this.getCenter()||new OpenLayers.LonLat(0,0));var f=this.getResolution();var c=e.add(-f/2,0);var l=e.add(f/2,0);var b=e.add(0,-f/2);var g=e.add(0,f/2);var k=new OpenLayers.Projection("EPSG:4326");var a=this.getProjectionObject()||k;if(!a.equals(k)){c.transform(a,k);l.transform(a,k);b.transform(a,k);g.transform(a,k)}return new OpenLayers.Size(OpenLayers.Util.distVincenty(c,l),OpenLayers.Util.distVincenty(b,g))},getViewPortPxFromLayerPx:function(e){var c=null;if(e!=null){var b=parseInt(this.layerContainerDiv.style.left);var a=parseInt(this.layerContainerDiv.style.top);c=e.add(b,a)}return c},getLayerPxFromViewPortPx:function(c){var e=null;if(c!=null){var b=-parseInt(this.layerContainerDiv.style.left);var a=-parseInt(this.layerContainerDiv.style.top);e=c.add(b,a);if(isNaN(e.x)||isNaN(e.y)){e=null}}return e},getLonLatFromLayerPx:function(a){a=this.getViewPortPxFromLayerPx(a);return this.getLonLatFromViewPortPx(a)},getLayerPxFromLonLat:function(b){var a=this.getPixelFromLonLat(b);return this.getLayerPxFromViewPortPx(a)},CLASS_NAME:"OpenLayers.Map"});OpenLayers.Map.TILE_WIDTH=256;OpenLayers.Map.TILE_HEIGHT=256;OpenLayers.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(e){return new OpenLayers.Pixel(-(e.w/2),-e.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(1276,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(-1238,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(-1238,-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(-1238,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(-1238,-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(-1238,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(-1238,-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(-1238,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(-1238,-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(1200,660),initialize:function(h,c,g,b,a,f,e){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(e,a,f,b,c){OpenLayers.Tile.prototype.initialize.apply(this,arguments);this.url=b;this.frame=document.createElement("div");this.frame.style.overflow="hidden";this.frame.style.position="absolute";this.layerAlphaHack=this.layer.alpha&&OpenLayers.Util.alphaHack()},destroy:function(){if(this.imgDiv!=null){if(this.layerAlphaHack){OpenLayers.Event.stopObservingElement(this.imgDiv.childNodes[0])}OpenLayers.Event.stopObservingElement(this.imgDiv);if(this.imgDiv.parentNode==this.frame){this.frame.removeChild(this.imgDiv);this.imgDiv.map=null}this.imgDiv.urls=null;this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif"}this.imgDiv=null;if((this.frame!=null)&&(this.frame.parentNode==this.layer.div)){this.layer.div.removeChild(this.frame)}this.frame=null;if(this.backBufferTile){this.backBufferTile.destroy();this.backBufferTile=null}this.layer.events.unregister("loadend",this,this.resetBackBuffer);OpenLayers.Tile.prototype.destroy.apply(this,arguments)},clone:function(a){if(a==null){a=new OpenLayers.Tile.Image(this.layer,this.position,this.bounds,this.url,this.size)}a=OpenLayers.Tile.prototype.clone.apply(this,[a]);a.imgDiv=null;return a},draw:function(){if(this.layer!=this.layer.map.baseLayer&&this.layer.reproject){this.bounds=this.getBoundsFromBaseLayer(this.position)}var a=OpenLayers.Tile.prototype.draw.apply(this,arguments);if((OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1)||this.layer.singleTile){if(a){if(!this.backBufferTile){this.backBufferTile=this.clone();this.backBufferTile.hide();this.backBufferTile.isBackBuffer=true;this.events.register("loadend",this,this.resetBackBuffer);this.layer.events.register("loadend",this,this.resetBackBuffer)}this.startTransition()}else{if(this.backBufferTile){this.backBufferTile.clear()}}}else{if(a&&this.isFirstDraw){this.events.register("loadend",this,this.showTile);this.isFirstDraw=false}}if(!a){return false}if(this.isLoading){this.events.triggerEvent("reload")}else{this.isLoading=true;this.events.triggerEvent("loadstart")}return this.renderTile()},resetBackBuffer:function(){this.showTile();if(this.backBufferTile&&(this.isFirstDraw||!this.layer.numLoadingTiles)){this.isFirstDraw=false;var a=this.layer.maxExtent;var b=(a&&this.bounds.intersectsBounds(a,false));if(b){this.backBufferTile.position=this.position;this.backBufferTile.bounds=this.bounds;this.backBufferTile.size=this.size;this.backBufferTile.imageSize=this.layer.getImageSize(this.bounds)||this.size;this.backBufferTile.imageOffset=this.layer.imageOffset;this.backBufferTile.resolution=this.layer.getResolution();this.backBufferTile.renderTile()}this.backBufferTile.hide()}},renderTile:function(){if(this.imgDiv==null){this.initImgDiv()}this.imgDiv.viewRequestID=this.layer.map.viewRequestID;if(this.layer.async){this.layer.getURLasync(this.bounds,this,"url",this.positionImage)}else{if(this.layer.url instanceof Array){this.imgDiv.urls=this.layer.url.slice()}this.url=this.layer.getURL(this.bounds);this.positionImage()}return true},positionImage:function(){if(this.layer===null){return}OpenLayers.Util.modifyDOMElement(this.frame,null,this.position,this.size);var a=this.layer.getImageSize(this.bounds);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 e=this.layer.imageOffset;var b=this.layer.getImageSize(this.bounds);if(this.layerAlphaHack){this.imgDiv=OpenLayers.Util.createAlphaImageDiv(null,e,b,null,"relative",null,null,null,true)}else{this.imgDiv=OpenLayers.Util.createImage(null,e,b,null,"relative",null,null,true)}this.imgDiv.className="olTileImage";this.frame.style.zIndex=this.isBackBuffer?0:1;this.frame.appendChild(this.imgDiv);this.layer.div.appendChild(this.frame);if(this.layer.opacity!=null){OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,null,null,null,null,this.layer.opacity)}this.imgDiv.map=this.layer.map;var 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 e=1;if(this.backBufferTile.resolution){e=this.backBufferTile.resolution/this.layer.getResolution()}if(e!=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*e,this.backBufferTile.size.h*e);var a=this.layer.map.getLayerPxFromLonLat(c);OpenLayers.Util.modifyDOMElement(this.backBufferTile.frame,null,a,b);var f=this.backBufferTile.imageSize;f=new OpenLayers.Size(f.w*e,f.h*e);var g=this.backBufferTile.imageOffset;if(g){g=new OpenLayers.Pixel(g.x*e,g.y*e)}OpenLayers.Util.modifyDOMElement(this.backBufferTile.imgDiv,null,g,f);this.backBufferTile.show()}}else{if(this.layer.singleTile){this.backBufferTile.show()}else{this.backBufferTile.hide()}}this.lastRatio=e},show:function(){this.frame.style.display="";if(OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1){if(navigator.userAgent.toLowerCase().indexOf("gecko")!=-1){this.frame.scrollLeft=this.frame.scrollLeft}}},hide:function(){this.frame.style.display="none"},CLASS_NAME:"OpenLayers.Tile.Image"});OpenLayers.Tile.Image.useBlankTile=(OpenLayers.Util.getBrowserName()=="safari"||OpenLayers.Util.getBrowserName()=="opera");OpenLayers.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)}}if(this.layer!=null&&this.marker!=null){this.layer.removeMarker(this.marker)}this.layer=null;this.id=null;this.lonlat=null;this.data=null;if(this.marker!=null){this.destroyMarker(this.marker);this.marker=null}if(this.popup!=null){this.destroyPopup(this.popup);this.popup=null}},onScreen:function(){var b=false;if((this.layer!=null)&&(this.layer.map!=null)){var a=this.layer.map.getExtent();b=a.containsLonLat(this.lonlat)}return b},createMarker:function(){if(this.lonlat!=null){this.marker=new OpenLayers.Marker(this.lonlat,this.data.icon)}return this.marker},destroyMarker:function(){this.marker.destroy()},createPopup:function(b){if(this.lonlat!=null){var 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(e){this.down=e.xy;return true}}},mousedown:null,mouseup:function(b){var a=true;if(this.checkModifiers(b)&&this.control.handleRightClicks&&OpenLayers.Event.isRightClick(b)){a=this.rightclick(b)}return a},rightclick:function(b){if(this.passesTolerance(b)){if(this.rightclickTimerId!=null){this.clearTimer();this.callback("dblrightclick",[b]);return !this.stopDouble}else{var a=this["double"]?OpenLayers.Util.extend({},b):this.callback("rightclick",[b]);var 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,documentDrag:false,documentEvents: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:OpenLayers.Function.True}document.onselectstart=OpenLayers.Function.False;a=!this.stopDown}else{this.started=false;this.start=null;this.last=null}return a},mousemove:function(a){if(this.started&&!this.timeoutId&&(a.xy.x!=this.last.x||a.xy.y!=this.last.y)){if(this.documentDrag===true&&this.documentEvents){if(a.element===document){this.adjustXY(a);this.setEvent(a)}else{this.destroyDocumentEvents()}}if(this.interval>0){this.timeoutId=setTimeout(OpenLayers.Function.bind(this.removeTimeout,this),this.interval)}this.dragging=true;this.move(a);this.callback("move",[a.xy]);if(!this.oldOnselectstart){this.oldOnselectstart=document.onselectstart;document.onselectstart=OpenLayers.Function.False}this.last=this.evt.xy}return true},removeTimeout:function(){this.timeoutId=null},mouseup:function(b){if(this.started){if(this.documentDrag===true&&this.documentEvents){this.adjustXY(b);this.destroyDocumentEvents()}var a=(this.start!=this.last);this.started=false;this.dragging=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.up(b);this.callback("up",[b.xy]);if(a){this.callback("done",[b.xy])}document.onselectstart=this.oldOnselectstart}return true},mouseout:function(b){if(this.started&&OpenLayers.Util.mouseLeft(b,this.map.div)){if(this.documentDrag===true){this.documentEvents=new OpenLayers.Events(this,document,null,null,{includeXY:true});this.documentEvents.on({mousemove:this.mousemove,mouseup:this.mouseup});OpenLayers.Element.addClass(document.body,"olDragDown")}else{var a=(this.start!=this.last);this.started=false;this.dragging=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.out(b);this.callback("out",[]);if(a){this.callback("done",[b.xy])}if(document.onselectstart){document.onselectstart=this.oldOnselectstart}}}return true},click:function(a){return(this.start==this.last)},activate:function(){var a=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragging=false;a=true}return a},deactivate:function(){var a=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.started=false;this.dragging=false;this.start=null;this.last=null;a=true;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown")}return a},adjustXY:function(a){var b=OpenLayers.Util.pagePosition(this.map.div);a.xy.x-=b[0];a.xy.y-=b[1]},destroyDocumentEvents:function(){OpenLayers.Element.removeClass(document.body,"olDragDown");this.documentEvents.destroy();this.documentEvents=null},CLASS_NAME:"OpenLayers.Handler.Drag"});OpenLayers.Handler.MouseWheel=OpenLayers.Class(OpenLayers.Handler,{wheelListener:null,mousePosition:null,interval:0,delta:0,cumulative:true,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(m){if(!this.map||!this.checkModifiers(m)){return}var h=false;var o=false;var g=false;var b=OpenLayers.Event.element(m);while((b!=null)&&!g&&!h){if(!h){try{if(b.currentStyle){c=b.currentStyle.overflow}else{var a=document.defaultView.getComputedStyle(b,null);var c=a.getPropertyValue("overflow")}h=(c&&(c=="auto")||(c=="scroll"))}catch(f){}}if(!o){for(var k=0,l=this.map.layers.length;k<l;k++){if(b==this.map.layers[k].div||b==this.map.layers[k].pane){o=true;break}}}g=(b==this.map.div);b=b.parentNode}if(!h&&g){if(o){var n=0;if(!m){m=window.event}if(m.wheelDelta){n=m.wheelDelta/120;if(window.opera&&window.opera.version()<9.2){n=-n}}else{if(m.detail){n=-m.detail/3}}this.delta=this.delta+n;if(this.interval){window.clearTimeout(this._timeoutId);this._timeoutId=window.setTimeout(OpenLayers.Function.bind(function(){this.wheelZoom(m)},this),this.interval)}else{this.wheelZoom(m)}}OpenLayers.Event.stop(m)}},wheelZoom:function(a){var b=this.delta;this.delta=0;if(b){if(this.mousePosition){a.xy=this.mousePosition}if(!a.xy){a.xy=this.map.getPixelFromLonLat(this.map.getCenter())}if(b<0){this.callback("down",[a,this.cumulative?b:-1])}else{this.callback("up",[a,this.cumulative?b:1])}}},mousemove:function(a){this.mousePosition=a.xy},activate:function(a){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){var b=this.wheelListener;OpenLayers.Event.observe(window,"DOMMouseScroll",b);OpenLayers.Event.observe(window,"mousewheel",b);OpenLayers.Event.observe(document,"mousewheel",b);return true}else{return false}},deactivate:function(a){if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){var b=this.wheelListener;OpenLayers.Event.stopObserving(window,"DOMMouseScroll",b);OpenLayers.Event.stopObserving(window,"mousewheel",b);OpenLayers.Event.stopObserving(document,"mousewheel",b);return true}else{return false}},CLASS_NAME:"OpenLayers.Handler.MouseWheel"});OpenLayers.Layer=OpenLayers.Class({id:null,name:null,div:null,opacity:null,alwaysInRange:null,EVENT_TYPES:["loadstart","loadend","loadcancel","visibilitychanged","move","moveend"],RESOLUTION_PROPERTIES:["scales","resolutions","maxScale","minScale","maxResolution","minResolution","numZoomLevels","maxZoomLevel"],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"],metadata:{},initialize:function(b,a){this.addOptions(a);this.name=b;if(this.id==null){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");this.div=OpenLayers.Util.createDiv(this.id);this.div.style.width="100%";this.div.style.height="100%";this.div.dir="ltr";this.events=new OpenLayers.Events(this,this.div,this.EVENT_TYPES);if(this.eventListeners instanceof Object){this.events.on(this.eventListeners)}}if(this.wrapDateLine){this.displayOutsideMaxExtent=true}},destroy:function(a){if(a==null){a=true}if(this.map!=null){this.map.removeLayer(this,a)}this.projection=null;this.map=null;this.name=null;this.div=null;this.options=null;if(this.events){if(this.eventListeners){this.events.un(this.eventListeners)}this.events.destroy()}this.eventListeners=null;this.events=null},clone:function(a){if(a==null){a=new OpenLayers.Layer(this.name,this.getOptions())}OpenLayers.Util.applyDefaults(a,this);a.map=null;return a},getOptions:function(){var a={};for(var b in this.options){a[b]=this[b]}return a},setName:function(a){if(a!=this.name){this.name=a;if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"name"})}}},addOptions:function(c){if(this.options==null){this.options={}}OpenLayers.Util.extend(this.options,c);OpenLayers.Util.extend(this,c);if(typeof this.projection=="string"){this.projection=new OpenLayers.Projection(this.projection)}if(this.projection&&this.projection.getUnits()){this.units=this.projection.getUnits()}if(this.map){var a=this.RESOLUTION_PROPERTIES.concat(["projection","units","minExtent","maxExtent"]);for(var b in c){if(c.hasOwnProperty(b)&&OpenLayers.Util.indexOf(a,b)>=0){this.initResolutions();break}}}},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 e=this.visibility;if(!this.isBaseLayer){e=e&&this.inRange}this.display(e)},setMap:function(b){if(this.map==null){this.map=b;this.maxExtent=this.maxExtent||this.map.maxExtent;this.minExtent=this.minExtent||this.map.minExtent;this.projection=this.projection||this.map.projection;if(typeof this.projection=="string"){this.projection=new OpenLayers.Projection(this.projection)}this.units=this.projection.getUnits()||this.units||this.map.units;this.initResolutions();if(!this.isBaseLayer){this.inRange=this.calculateInRange();var a=((this.visibility)&&(this.inRange));this.div.style.display=a?"":"none"}this.setTileSize()}},afterAdd:function(){},removeMap:function(a){},getImageSize:function(a){return(this.imageSize||this.tileSize)},setTileSize:function(a){var b=(a)?a:((this.tileSize)?this.tileSize:this.map.getTileSize());this.tileSize=b;if(this.gutter){this.imageOffset=new OpenLayers.Pixel(-this.gutter,-this.gutter);this.imageSize=new OpenLayers.Size(b.w+(2*this.gutter),b.h+(2*this.gutter))}},getVisibility:function(){return this.visibility},setVisibility:function(a){if(a!=this.visibility){this.visibility=a;this.display(a);this.redraw();if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"visibility"})}this.events.triggerEvent("visibilitychanged")}},display:function(a){if(a!=(this.div.style.display!="none")){this.div.style.display=(a&&this.calculateInRange())?"block":"none"}},calculateInRange:function(){var b=false;if(this.alwaysInRange){b=true}else{if(this.map){var a=this.map.getResolution();b=((a>=this.minResolution)&&(a<=this.maxResolution))}}return b},setIsBaseLayer:function(a){if(a!=this.isBaseLayer){this.isBaseLayer=a;if(this.map!=null){this.map.events.triggerEvent("changebaselayer",{layer:this})}}},initResolutions:function(){var f,a;var g={},e=true;for(f=0,a=this.RESOLUTION_PROPERTIES.length;f<a;f++){var k=this.RESOLUTION_PROPERTIES[f];g[k]=this.options[k];if(e&&this.options[k]){e=false}}if(this.alwaysInRange==null){this.alwaysInRange=e}if(g.resolutions==null){g.resolutions=this.resolutionsFromScales(g.scales)}if(g.resolutions==null){g.resolutions=this.calculateResolutions(g)}if(g.resolutions==null){for(f=0,a=this.RESOLUTION_PROPERTIES.length;f<a;f++){var k=this.RESOLUTION_PROPERTIES[f];g[k]=this.options[k]!=null?this.options[k]:this.map[k]}if(g.resolutions==null){g.resolutions=this.resolutionsFromScales(g.scales)}if(g.resolutions==null){g.resolutions=this.calculateResolutions(g)}}var c;if(this.options.maxResolution&&this.options.maxResolution!=="auto"){c=this.options.maxResolution}if(this.options.minScale){c=OpenLayers.Util.getResolutionFromScale(this.options.minScale,this.units)}var b;if(this.options.minResolution&&this.options.minResolution!=="auto"){b=this.options.minResolution}if(this.options.maxScale){b=OpenLayers.Util.getResolutionFromScale(this.options.maxScale,this.units)}if(g.resolutions){g.resolutions.sort(function(m,l){return(l-m)});if(!c){c=g.resolutions[0]}if(!b){var h=g.resolutions.length-1;b=g.resolutions[h]}}this.resolutions=g.resolutions;if(this.resolutions){a=this.resolutions.length;this.scales=new Array(a);for(f=0;f<a;f++){this.scales[f]=OpenLayers.Util.getScaleFromResolution(this.resolutions[f],this.units)}this.numZoomLevels=a}this.minResolution=b;if(b){this.maxScale=OpenLayers.Util.getScaleFromResolution(b,this.units)}this.maxResolution=c;if(c){this.minScale=OpenLayers.Util.getScaleFromResolution(c,this.units)}},resolutionsFromScales:function(e){if(e==null){return}var b,c,a;a=e.length;b=new Array(a);for(c=0;c<a;c++){b[c]=OpenLayers.Util.getResolutionFromScale(e[c],this.units)}return b},calculateResolutions:function(m){var o=m.maxResolution;if(m.minScale!=null){o=OpenLayers.Util.getResolutionFromScale(m.minScale,this.units)}else{if(o=="auto"&&this.maxExtent!=null){var n=this.map.getSize();var l=this.maxExtent.getWidth()/n.w;var h=this.maxExtent.getHeight()/n.h;o=Math.max(l,h)}}var g=m.minResolution;if(m.maxScale!=null){g=OpenLayers.Util.getResolutionFromScale(m.maxScale,this.units)}else{if(m.minResolution=="auto"&&this.minExtent!=null){var n=this.map.getSize();var l=this.minExtent.getWidth()/n.w;var h=this.minExtent.getHeight()/n.h;g=Math.max(l,h)}}var a=m.maxZoomLevel;var b=m.numZoomLevels;if(typeof g==="number"&&typeof o==="number"&&b===undefined){var k=o/g;b=Math.floor(Math.log(k)/Math.log(2))+1}else{if(b===undefined&&a!=null){b=a+1}}if(typeof b!=="number"||b<=0||(typeof o!=="number"&&typeof g!=="number")){return}var e=new Array(b);var c=2;if(typeof g=="number"&&typeof o=="number"){c=Math.pow((o/g),(1/(b-1)))}var f;if(typeof o==="number"){for(f=0;f<b;f++){e[f]=o/Math.pow(c,f)}}else{for(f=0;f<b;f++){e[b-1-f]=g*Math.pow(c,f)}}return e},getResolution:function(){var a=this.map.getZoom();return this.getResolutionForZoom(a)},getExtent:function(){return this.map.calculateBounds()},getZoomForExtent:function(b,c){var e=this.map.getSize();var a=Math.max(b.getWidth()/e.w,b.getHeight()/e.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 e=Math.ceil(c);b=this.resolutions[a]-((c-a)*(this.resolutions[a]-this.resolutions[e]))}else{b=this.resolutions[Math.round(c)]}return b},getZoomForResolution:function(f,a){var p;if(this.map.fractionalZoom){var m=0;var c=this.resolutions.length-1;var e=this.resolutions[m];var b=this.resolutions[c];var l;for(var g=0,h=this.resolutions.length;g<h;++g){l=this.resolutions[g];if(l>=f){e=l;m=g}if(l<=f){b=l;c=g;break}}var k=e-b;if(k>0){p=m+((e-f)/k)}else{p=m}}else{var n;var o=Number.POSITIVE_INFINITY;for(var g=0,h=this.resolutions.length;g<h;g++){if(a){n=Math.abs(this.resolutions[g]-f);if(n>o){break}o=n}else{if(this.resolutions[g]<f){break}}}p=Math.max(0,g-1)}return p},getLonLatFromViewPortPx:function(b){var f=null;if(b!=null){var e=this.map.getSize();var a=this.map.getCenter();if(a){var c=this.map.getResolution();var h=b.x-(e.w/2);var g=b.y-(e.h/2);f=new OpenLayers.LonLat(a.lon+h*c,a.lat-g*c);if(this.wrapDateLine){f=f.wrapDateLine(this.maxExtent)}}}return f},getViewPortPxFromLonLat:function(e){var b=null;if(e!=null){var a=this.map.getResolution();var c=this.map.getExtent();b=new OpenLayers.Pixel((1/a*(e.lon-c.left)),(1/a*(c.top-e.lat)))}return b},setOpacity:function(b){if(b!=this.opacity){this.opacity=b;for(var e=0,a=this.div.childNodes.length;e<a;++e){var c=this.div.childNodes[e].firstChild;OpenLayers.Util.modifyDOMElement(c,null,null,null,null,null,null,b)}if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"opacity"})}}},getZIndex:function(){return this.div.style.zIndex},setZIndex:function(a){this.div.style.zIndex=a},adjustBounds:function(b){if(this.gutter){var a=this.gutter*this.map.getResolution();b=new OpenLayers.Bounds(b.left-a,b.bottom-a,b.right+a,b.top+a)}if(this.wrapDateLine){var 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,documentDrag:false,draw:function(){this.handler=new OpenLayers.Handler.Drag(this,{move:this.panMap,done:this.panMapDone},{interval:this.interval,documentDrag:this.documentDrag})},panMap:function(a){this.panned=true;this.map.pan(this.handler.last.x-a.x,this.handler.last.y-a.y,{dragging:this.handler.dragging,animate:false})},panMapDone:function(a){if(this.panned){this.panMap(a);this.panned=false}},CLASS_NAME:"OpenLayers.Control.DragPan"});OpenLayers.State={UNKNOWN:"Unknown",INSERT:"Insert",UPDATE:"Update",DELETE:"Delete"};OpenLayers.Feature.Vector=OpenLayers.Class(OpenLayers.Feature,{fid:null,geometry:null,attributes:null,bounds:null,state:null,style:null,url:null,renderIntent:"default",initialize:function(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(e){var c=false;if(this.layer&&this.layer.map){var a=this.layer.map.getExtent();if(e){var b=this.geometry.getBounds();c=a.intersectsBounds(b)}else{var f=a.toGeometry();c=f.intersects(this.geometry)}}return c},getVisibility:function(){return !(this.style&&this.style.display=="none"||!this.layer||this.layer&&this.layer.styleMap&&this.layer.styleMap.createSymbolizer(this,this.renderIntent).display=="none"||this.layer&&!this.layer.getVisibility())},createMarker:function(){return null},destroyMarker:function(){},createPopup:function(){return null},atPoint:function(b,e,c){var a=false;if(this.geometry){a=this.geometry.atPoint(b,e,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 e=this.layer.getViewPortPxFromLonLat(this.geometry.getBounds().getCenterLonLat());var c=this.layer.map.getResolution();this.geometry.move(c*(b.x-e.x),c*(e.y-b.y));this.layer.drawFeature(this);return e},toState:function(a){if(a==OpenLayers.State.UPDATE){switch(this.state){case OpenLayers.State.UNKNOWN:case OpenLayers.State.DELETE:this.state=a;break;case OpenLayers.State.UPDATE:case OpenLayers.State.INSERT:break}}else{if(a==OpenLayers.State.INSERT){switch(this.state){case OpenLayers.State.UNKNOWN:break;default:this.state=a;break}}else{if(a==OpenLayers.State.DELETE){switch(this.state){case OpenLayers.State.INSERT:break;case OpenLayers.State.DELETE:break;case OpenLayers.State.UNKNOWN:case OpenLayers.State.UPDATE:this.state=a;break}}else{if(a==OpenLayers.State.UNKNOWN){this.state=a}}}}},CLASS_NAME:"OpenLayers.Feature.Vector"});OpenLayers.Feature.Vector.style={"default":{fillColor:"#ee9900",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#ee9900",strokeOpacity:1,strokeWidth:1,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},select:{fillColor:"blue",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"blue",strokeOpacity:1,strokeWidth:2,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"pointer"},temporary:{fillColor:"#66cccc",fillOpacity:0.2,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#66cccc",strokeOpacity:1,strokeLinecap:"round",strokeWidth:2,strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},"delete":{display:"none"}};OpenLayers.Handler.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})},destroy:function(){if(this.dragHandler){this.dragHandler.destroy();this.dragHandler=null}OpenLayers.Handler.prototype.destroy.apply(this,arguments)},setMap:function(a){OpenLayers.Handler.prototype.setMap.apply(this,arguments);if(this.dragHandler){this.dragHandler.setMap(a)}},startBox:function(a){this.zoomBox=OpenLayers.Util.createDiv("zoomBox",this.dragHandler.start);this.zoomBox.className=this.boxDivClassName;this.zoomBox.style.zIndex=this.map.Z_INDEX_BASE.Popup-1;this.map.viewPortDiv.appendChild(this.zoomBox);OpenLayers.Element.addClass(this.map.viewPortDiv,"olDrawBox")},moveBox:function(g){var e=this.dragHandler.start.x;var b=this.dragHandler.start.y;var c=Math.abs(e-g.x);var a=Math.abs(b-g.y);this.zoomBox.style.width=Math.max(1,c)+"px";this.zoomBox.style.height=Math.max(1,a)+"px";this.zoomBox.style.left=g.x<e?g.x+"px":e+"px";this.zoomBox.style.top=g.y<b?g.y+"px":b+"px";var f=this.getBoxCharacteristics();if(f.newBoxModel){if(g.x>e){this.zoomBox.style.width=Math.max(1,c-f.xOffset)+"px"}if(g.y>b){this.zoomBox.style.height=Math.max(1,a-f.yOffset)+"px"}}},endBox:function(b){var a;if(Math.abs(this.dragHandler.start.x-b.x)>5||Math.abs(this.dragHandler.start.y-b.y)>5){var h=this.dragHandler.start;var g=Math.min(h.y,b.y);var c=Math.max(h.y,b.y);var f=Math.min(h.x,b.x);var e=Math.max(h.x,b.x);a=new OpenLayers.Bounds(f,c,e,g)}else{a=this.dragHandler.start.clone()}this.removeBox();this.callback("done",[a])},removeBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox);this.zoomBox=null;this.boxCharacteristics=null;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDrawBox")},activate:function(){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragHandler.activate();return true}else{return false}},deactivate:function(){if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.dragHandler.deactivate();return true}else{return false}},getBoxCharacteristics:function(){if(!this.boxCharacteristics){var a=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-left-width"))+parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-right-width"))+1;var 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;this.pane=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},setMap:function(a){OpenLayers.Layer.prototype.setMap.apply(this,arguments);this.pane.style.zIndex=parseInt(this.div.style.zIndex)+1;this.pane.style.display=this.div.style.display;this.pane.style.width="100%";this.pane.style.height="100%";if(OpenLayers.Util.getBrowserName()=="msie"){this.pane.style.background="url("+OpenLayers.Util.getImagesLocation()+"blank.gif)"}if(this.isFixed){this.map.viewPortDiv.appendChild(this.pane)}else{this.map.layerContainerDiv.appendChild(this.pane)}this.loadMapObject();if(this.mapObject==null){this.loadWarningMessage()}},removeMap:function(a){if(this.pane&&this.pane.parentNode){this.pane.parentNode.removeChild(this.pane)}OpenLayers.Layer.prototype.removeMap.apply(this,arguments)},loadWarningMessage:function(){this.div.style.backgroundColor="darkblue";var h=this.map.getSize();var a=Math.min(h.w,300);var f=Math.min(h.h,200);var b=new OpenLayers.Size(a,f);var e=new OpenLayers.Pixel(h.w/2,h.h/2);var c=e.add(-b.w/2,-b.h/2);var g=OpenLayers.Util.createDiv(this.name+"_warning",c,b,null,null,null,"auto");g.style.padding="7px";g.style.backgroundColor="yellow";g.innerHTML=this.getWarningHTML();this.div.appendChild(g)},getWarningHTML:function(){return""},display:function(a){OpenLayers.Layer.prototype.display.apply(this,arguments);this.pane.style.display=this.div.style.display},setZIndex:function(a){OpenLayers.Layer.prototype.setZIndex.apply(this,arguments);this.pane.style.zIndex=parseInt(this.div.style.zIndex)+1},moveTo:function(c,e,m){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);if(this.mapObject!=null){var f=this.map.getCenter();var h=this.map.getZoom();if(f!=null){var g=this.getMapObjectCenter();var b=this.getOLLonLatFromMapObjectLonLat(g);var k=this.getMapObjectZoom();var p=this.getOLZoomFromMapObjectZoom(k);if(!(f.equals(b))||!(h==p)){if(m&&this.dragPanMapObject&&this.smoothDragPan){var l=this.map.getViewPortPxFromLonLat(b);var n=this.map.getViewPortPxFromLonLat(f);this.dragPanMapObject(n.x-l.x,l.y-n.y)}else{var a=this.getMapObjectLonLatFromOLLonLat(f);var o=this.getMapObjectZoomFromOLZoom(h);this.setMapObjectCenter(a,o,m)}}}}},getLonLatFromViewPortPx:function(a){var b=null;if((this.mapObject!=null)&&(this.getMapObjectCenter()!=null)){var e=this.getMapObjectPixelFromOLPixel(a);var c=this.getMapObjectLonLatFromMapObjectPixel(e);b=this.getOLLonLatFromMapObjectLonLat(c)}return b},getViewPortPxFromLonLat:function(b){var a=null;if((this.mapObject!=null)&&(this.getMapObjectCenter()!=null)){var e=this.getMapObjectLonLatFromOLLonLat(b);var c=this.getMapObjectPixelFromMapObjectLonLat(e);a=this.getOLPixelFromMapObjectPixel(c)}return a},getOLLonLatFromMapObjectLonLat:function(e){var a=null;if(e!=null){var c=this.getLongitudeFromMapObjectLonLat(e);var b=this.getLatitudeFromMapObjectLonLat(e);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(e){var b=null;if(e!=null){var a=this.getXFromMapObjectPixel(e);var c=this.getYFromMapObjectPixel(e);b=new OpenLayers.Pixel(a,c)}return b},getMapObjectPixelFromOLPixel:function(a){var b=null;if(a!=null){b=this.getMapObjectPixelFromXY(a.x,a.y)}return b},CLASS_NAME:"OpenLayers.Layer.EventPane"});OpenLayers.Layer.FixedZoomLevels=OpenLayers.Class({initialize:function(){},initResolutions:function(){var c=new Array("minZoomLevel","maxZoomLevel","numZoomLevels");for(var b=0,a=c.length;b<a;b++){var g=c[b];this[g]=(this.options[g]!=null)?this.options[g]:this.map[g]}if((this.minZoomLevel==null)||(this.minZoomLevel<this.MIN_ZOOM_LEVEL)){this.minZoomLevel=this.MIN_ZOOM_LEVEL}var h;var f=this.MAX_ZOOM_LEVEL-this.minZoomLevel+1;if(((this.options.numZoomLevels==null)&&(this.options.maxZoomLevel!=null))||((this.numZoomLevels==null)&&(this.maxZoomLevel!=null))){h=this.maxZoomLevel-this.minZoomLevel+1}else{h=this.numZoomLevels}if(h!=null){this.numZoomLevels=Math.min(h,f)}else{this.numZoomLevels=f}this.maxZoomLevel=this.minZoomLevel+this.numZoomLevels-1;if(this.RESOLUTIONS!=null){var e=0;this.resolutions=[];for(var b=this.minZoomLevel;b<=this.maxZoomLevel;b++){this.resolutions[e++]=this.RESOLUTIONS[b]}this.maxResolution=this.resolutions[0];this.minResolution=this.resolutions[this.resolutions.length-1]}},getResolution:function(){if(this.resolutions!=null){return OpenLayers.Layer.prototype.getResolution.apply(this,arguments)}else{var a=null;var c=this.map.getSize();var b=this.getExtent();if((c!=null)&&(b!=null)){a=Math.max(b.getWidth()/c.w,b.getHeight()/c.h)}return a}},getExtent:function(){var c=null;var b=this.map.getSize();var f=new OpenLayers.Pixel(0,0);var g=this.getLonLatFromViewPortPx(f);var a=new OpenLayers.Pixel(b.w,b.h);var e=this.getLonLatFromViewPortPx(a);if((g!=null)&&(e!=null)){c=new OpenLayers.Bounds(g.lon,e.lat,e.lon,g.lat)}return c},getZoomForResolution:function(a){if(this.resolutions!=null){return OpenLayers.Layer.prototype.getZoomForResolution.apply(this,arguments)}else{var b=OpenLayers.Layer.prototype.getExtent.apply(this,[]);return this.getZoomForExtent(b)}},getOLZoomFromMapObjectZoom:function(a){var b=null;if(a!=null){b=a-this.minZoomLevel}return b},getMapObjectZoomFromOLZoom:function(a){var b=null;if(a!=null){b=a+this.minZoomLevel}return b},CLASS_NAME:"OpenLayers.Layer.FixedZoomLevels"});OpenLayers.Layer.HTTPRequest=OpenLayers.Class(OpenLayers.Layer,{URL_HASH_FACTOR:(Math.sqrt(5)-1)/2,url:null,params:null,reproject:false,initialize:function(e,c,f,b){var a=arguments;a=[e,b];OpenLayers.Layer.prototype.initialize.apply(this,a);this.url=c;this.params=OpenLayers.Util.extend({},f)},destroy:function(){this.url=null;this.params=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(a){if(a==null){a=new OpenLayers.Layer.HTTPRequest(this.name,this.url,this.params,this.getOptions())}a=OpenLayers.Layer.prototype.clone.apply(this,[a]);return a},setUrl:function(a){this.url=a},mergeNewParams:function(b){this.params=OpenLayers.Util.extend(this.params,b);var a=this.redraw();if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"params"})}return a},redraw:function(a){if(a){return this.mergeNewParams({_olSalt:Math.random()})}else{return OpenLayers.Layer.prototype.redraw.apply(this,[])}},selectUrl:function(f,e){var c=1;for(var b=0,a=f.length;b<a;b++){c*=f.charCodeAt(b)*this.URL_HASH_FACTOR;c-=Math.floor(c)}return e[Math.floor(c*e.length)]},getFullRequestString:function(h,e){var b=e||this.url;var g=OpenLayers.Util.extend({},this.params);g=OpenLayers.Util.extend(g,h);var f=OpenLayers.Util.getParameterString(g);if(b instanceof Array){b=this.selectUrl(f,b)}var a=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(b));for(var c in g){if(c.toUpperCase() in a){delete g[c]}}f=OpenLayers.Util.getParameterString(g);return OpenLayers.Util.urlAppend(b,f)},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(e,b,f){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);if(b||!this.drawn){for(var c=0,a=this.markers.length;c<a;c++){this.drawMarker(this.markers[c])}this.drawn=true}},addMarker:function(a){this.markers.push(a);if(this.opacity!=null){a.setOpacity(this.opacity)}if(this.map&&this.map.getExtent()){a.map=this.map;this.drawMarker(a)}},removeMarker:function(a){if(this.markers&&this.markers.length){OpenLayers.Util.removeItem(this.markers,a);a.erase()}},clearMarkers:function(){if(this.markers!=null){while(this.markers.length>0){this.removeMarker(this.markers[0])}}},drawMarker:function(a){var b=this.map.getLayerPxFromLonLat(a.lonlat);if(b==null){a.display(false)}else{if(!a.isDrawn()){var c=a.draw(b);this.div.appendChild(c)}else{if(a.icon){a.icon.moveTo(b)}}}},getDataExtent:function(){var b=null;if(this.markers&&(this.markers.length>0)){var b=new OpenLayers.Bounds();for(var e=0,a=this.markers.length;e<a;e++){var c=this.markers[e];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},getLonLatFromViewPortPx:function(a){return OpenLayers.Layer.prototype.getLonLatFromViewPortPx.apply(this,arguments)},getViewPortPxFromLonLat:function(a){return OpenLayers.Layer.prototype.getViewPortPxFromLonLat.apply(this,arguments)},initMercatorParameters:function(){this.RESOLUTIONS=[];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=this.projection||"EPSG:900913"},forwardMercator:function(c,b){var a=c*20037508.34/180;var e=Math.log(Math.tan((90+b)*Math.PI/360))/(Math.PI/180);e=e*20037508.34/180;return new OpenLayers.LonLat(a,e)},inverseMercator:function(a,e){var c=(a/20037508.34)*180;var b=(e/20037508.34)*180;b=180/Math.PI*(2*Math.atan(Math.exp(b*Math.PI/180))-Math.PI/2);return new OpenLayers.LonLat(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(k){if(k instanceof OpenLayers.Bounds){var b;if(!this.out){var l=this.map.getLonLatFromPixel(new OpenLayers.Pixel(k.left,k.bottom));var p=this.map.getLonLatFromPixel(new OpenLayers.Pixel(k.right,k.top));b=new OpenLayers.Bounds(l.lon,l.lat,p.lon,p.lat)}else{var h=Math.abs(k.right-k.left);var m=Math.abs(k.top-k.bottom);var f=Math.min((this.map.size.h/m),(this.map.size.w/h));var q=this.map.getExtent();var a=this.map.getLonLatFromPixel(k.getCenterPixel());var c=a.lon-(q.getWidth()/2)*f;var g=a.lon+(q.getWidth()/2)*f;var o=a.lat-(q.getHeight()/2)*f;var e=a.lat+(q.getHeight()/2)*f;b=new OpenLayers.Bounds(c,o,g,e)}var n=this.map.getZoom();this.map.zoomToExtent(b);if(n==this.map.getZoom()&&this.alwaysZoom==true){this.map.zoomTo(n+(this.out?-1:1))}}else{if(!this.out){this.map.setCenter(this.map.getLonLatFromPixel(k),this.map.getZoom()+1)}else{this.map.setCenter(this.map.getLonLatFromPixel(k),this.map.getZoom()-1)}}},CLASS_NAME:"OpenLayers.Control.ZoomBox"});OpenLayers.Format.WKT=OpenLayers.Class(OpenLayers.Format,{initialize:function(a){this.regExes={typeStr:/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,spaces:/\s+/,parenComma:/\)\s*,\s*\(/,doubleParenComma:/\)\s*\)\s*,\s*\(\s*\(/,trimParens:/^\s*\(?(.*?)\)?\s*$/};OpenLayers.Format.prototype.initialize.apply(this,[a])},read:function(g){var f,e,k;var h=this.regExes.typeStr.exec(g);if(h){e=h[1].toLowerCase();k=h[2];if(this.parse[e]){f=this.parse[e].apply(this,[k])}if(this.internalProjection&&this.externalProjection){if(f&&f.CLASS_NAME=="OpenLayers.Feature.Vector"){f.geometry.transform(this.externalProjection,this.internalProjection)}else{if(f&&e!="geometrycollection"&&typeof f=="object"){for(var c=0,a=f.length;c<a;c++){var b=f[c];b.geometry.transform(this.externalProjection,this.internalProjection)}}}}}return f},write:function(a){var g,l,k,e,b;if(a.constructor==Array){g=a;b=true}else{g=[a];b=false}var c=[];if(b){c.push("GEOMETRYCOLLECTION(")}for(var f=0,h=g.length;f<h;++f){if(b&&f>0){c.push(",")}l=g[f].geometry;k=l.CLASS_NAME.split(".")[2].toLowerCase();if(!this.extract[k]){return null}if(this.internalProjection&&this.externalProjection){l=l.clone();l.transform(this.internalProjection,this.externalProjection)}e=this.extract[k].apply(this,[l]);c.push(k.toUpperCase()+"("+e+")")}if(b){c.push(")")}return c.join("")},extract:{point:function(a){return a.x+" "+a.y},multipoint:function(c){var e=[];for(var b=0,a=c.components.length;b<a;++b){e.push("("+this.extract.point.apply(this,[c.components[b]])+")")}return e.join(",")},linestring:function(b){var e=[];for(var c=0,a=b.components.length;c<a;++c){e.push(this.extract.point.apply(this,[b.components[c]]))}return e.join(",")},multilinestring:function(c){var e=[];for(var b=0,a=c.components.length;b<a;++b){e.push("("+this.extract.linestring.apply(this,[c.components[b]])+")")}return e.join(",")},polygon:function(c){var e=[];for(var b=0,a=c.components.length;b<a;++b){e.push("("+this.extract.linestring.apply(this,[c.components[b]])+")")}return e.join(",")},multipolygon:function(e){var c=[];for(var b=0,a=e.components.length;b<a;++b){c.push("("+this.extract.polygon.apply(this,[e.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(g){var b;var e=OpenLayers.String.trim(g).split(this.regExes.parenComma);var f=[];for(var c=0,a=e.length;c<a;++c){b=e[c].replace(this.regExes.trimParens,"$1");f.push(this.parse.point.apply(this,[b]).geometry)}return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPoint(f))},linestring:function(f){var c=OpenLayers.String.trim(f).split(",");var e=[];for(var b=0,a=c.length;b<a;++b){e.push(this.parse.point.apply(this,[c[b]]).geometry)}return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(e))},multilinestring:function(g){var c;var b=OpenLayers.String.trim(g).split(this.regExes.parenComma);var f=[];for(var e=0,a=b.length;e<a;++e){c=b[e].replace(this.regExes.trimParens,"$1");f.push(this.parse.linestring.apply(this,[c]).geometry)}return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiLineString(f))},polygon:function(k){var c,b,g;var h=OpenLayers.String.trim(k).split(this.regExes.parenComma);var f=[];for(var e=0,a=h.length;e<a;++e){c=h[e].replace(this.regExes.trimParens,"$1");b=this.parse.linestring.apply(this,[c]).geometry;g=new OpenLayers.Geometry.LinearRing(b.components);f.push(g)}return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon(f))},multipolygon:function(g){var e;var b=OpenLayers.String.trim(g).split(this.regExes.doubleParenComma);var f=[];for(var c=0,a=b.length;c<a;++c){e=b[c].replace(this.regExes.trimParens,"$1");f.push(this.parse.polygon.apply(this,[e]).geometry)}return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPolygon(f))},geometrycollection:function(f){f=f.replace(/,\s*([A-Za-z])/g,"|$1");var e=OpenLayers.String.trim(f).split("|");var c=[];for(var b=0,a=e.length;b<a;++b){c.push(OpenLayers.Format.WKT.prototype.read.apply(this,[e[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:21,RESOLUTIONS:[1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125,0.00002145767211914062,0.00001072883605957031,0.00000536441802978515,0.00000268220901489257,0.000001341104507446289,6.705522537231445e-7],type:null,wrapDateLine:true,sphericalMercator:false,version:null,initialize:function(c,b){b=b||{};if(!b.version){b.version=typeof GMap2==="function"?"2":"3"}var a=OpenLayers.Layer.Google["v"+b.version.replace(/\./g,"_")];if(a){OpenLayers.Util.applyDefaults(b,a)}else{throw"Unsupported Google Maps API version: "+b.version}OpenLayers.Util.applyDefaults(b,a.DEFAULTS);if(b.maxExtent){b.maxExtent=b.maxExtent.clone()}OpenLayers.Layer.EventPane.prototype.initialize.apply(this,[c,b]);OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,[c,b]);if(this.sphericalMercator){OpenLayers.Util.extend(this,OpenLayers.Layer.SphericalMercator);this.initMercatorParameters()}},clone:function(){return new OpenLayers.Layer.Google(this.name,this.getOptions())},setVisibility:function(b){var a=this.opacity==null?1:this.opacity;OpenLayers.Layer.EventPane.prototype.setVisibility.apply(this,arguments);this.setOpacity(a)},display:function(a){if(!this._dragging){this.setGMapVisibility(a)}OpenLayers.Layer.EventPane.prototype.display.apply(this,arguments)},moveTo:function(b,a,c){this._dragging=c;OpenLayers.Layer.EventPane.prototype.moveTo.apply(this,arguments);delete this._dragging},setOpacity:function(b){if(b!==this.opacity){if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"opacity"})}this.opacity=b}if(this.getVisibility()){var a=this.getMapContainer();OpenLayers.Util.modifyDOMElement(a,null,null,null,null,null,null,b)}},destroy:function(){if(this.map){this.setGMapVisibility(false);var a=OpenLayers.Layer.Google.cache[this.map.id];if(a&&a.count<=1){this.removeGMapElements()}}OpenLayers.Layer.EventPane.prototype.destroy.apply(this,arguments)},removeGMapElements:function(){var e=OpenLayers.Layer.Google.cache[this.map.id];if(e){var b=this.mapObject&&this.getMapContainer();if(b&&b.parentNode){b.parentNode.removeChild(b)}var c=e.termsOfUse;if(c&&c.parentNode){c.parentNode.removeChild(c)}var a=e.poweredBy;if(a&&a.parentNode){a.parentNode.removeChild(a)}}},removeMap:function(b){if(this.visibility&&this.mapObject){this.setGMapVisibility(false)}var a=OpenLayers.Layer.Google.cache[b.id];if(a){if(a.count<=1){this.removeGMapElements();delete OpenLayers.Layer.Google.cache[b.id]}else{--a.count}}delete this.termsOfUse;delete this.poweredBy;delete this.mapObject;delete this.dragObject;OpenLayers.Layer.EventPane.prototype.removeMap.apply(this,arguments)},getOLBoundsFromMapObjectBounds:function(b){var c=null;if(b!=null){var a=b.getSouthWest();var e=b.getNorthEast();if(this.sphericalMercator){a=this.forwardMercator(a.lng(),a.lat());e=this.forwardMercator(e.lng(),e.lat())}else{a=new OpenLayers.LonLat(a.lng(),a.lat());e=new OpenLayers.LonLat(e.lng(),e.lat())}c=new OpenLayers.Bounds(a.lon,a.lat,e.lon,e.lat)}return c},getWarningHTML:function(){return OpenLayers.i18n("googleWarning")},getMapObjectCenter:function(){return this.mapObject.getCenter()},getMapObjectZoom:function(){return this.mapObject.getZoom()},getLongitudeFromMapObjectLonLat:function(a){return this.sphericalMercator?this.forwardMercator(a.lng(),a.lat()).lon:a.lng()},getLatitudeFromMapObjectLonLat:function(b){var a=this.sphericalMercator?this.forwardMercator(b.lng(),b.lat()).lat:b.lat();return a},getXFromMapObjectPixel:function(a){return a.x},getYFromMapObjectPixel:function(a){return a.y},CLASS_NAME:"OpenLayers.Layer.Google"});OpenLayers.Layer.Google.cache={};OpenLayers.Layer.Google.v2={termsOfUse:null,poweredBy:null,dragObject:null,loadMapObject:function(){if(!this.type){this.type=G_NORMAL_MAP}var h,f,a;var c=OpenLayers.Layer.Google.cache[this.map.id];if(c){h=c.mapObject;f=c.termsOfUse;a=c.poweredBy;++c.count}else{var b=this.map.viewPortDiv;var k=document.createElement("div");k.id=this.map.id+"_GMap2Container";k.style.position="absolute";k.style.width="100%";k.style.height="100%";b.appendChild(k);try{h=new GMap2(k);f=k.lastChild;b.appendChild(f);f.style.zIndex="1100";f.style.right="";f.style.bottom="";f.className="olLayerGoogleCopyright";a=k.lastChild;b.appendChild(a);a.style.zIndex="1100";a.style.right="";a.style.bottom="";a.className="olLayerGooglePoweredBy gmnoprint"}catch(g){throw (g)}OpenLayers.Layer.Google.cache[this.map.id]={mapObject:h,termsOfUse:f,poweredBy:a,count:1}}this.mapObject=h;this.termsOfUse=f;this.poweredBy=a;if(OpenLayers.Util.indexOf(this.mapObject.getMapTypes(),this.type)===-1){this.mapObject.addMapType(this.type)}if(typeof h.getDragObject=="function"){this.dragObject=h.getDragObject()}else{this.dragPanMapObject=null}if(this.isBaseLayer===false){this.setGMapVisibility(this.div.style.display!=="none")}},onMapResize:function(){if(this.visibility&&this.mapObject.isLoaded()){this.mapObject.checkResize()}else{if(!this._resized){var a=this;var b=GEvent.addListener(this.mapObject,"load",function(){GEvent.removeListener(b);delete a._resized;a.mapObject.checkResize();a.moveTo(a.map.getCenter(),a.map.getZoom())})}this._resized=true}},setGMapVisibility:function(c){var b=OpenLayers.Layer.Google.cache[this.map.id];if(b){var a=this.mapObject.getContainer();if(c===true){this.mapObject.setMapType(this.type);a.style.display="";this.termsOfUse.style.left="";this.termsOfUse.style.display="";this.poweredBy.style.display="";b.displayed=this.id}else{if(b.displayed===this.id){delete b.displayed}if(!b.displayed){a.style.display="none";this.termsOfUse.style.display="none";this.termsOfUse.style.left="-9999px";this.poweredBy.style.display="none"}}}},getMapContainer:function(){return this.mapObject.getContainer()},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 e=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(e.lat,e.lon))}return b},setMapObjectCenter:function(a,b){this.mapObject.setCenter(a,b)},dragPanMapObject:function(b,a){this.dragObject.moveBy(new GSize(-b,a))},getMapObjectLonLatFromMapObjectPixel:function(a){return this.mapObject.fromContainerPixelToLatLng(a)},getMapObjectPixelFromMapObjectLonLat:function(a){return this.mapObject.fromLatLngToContainerPixel(a)},getMapObjectZoomFromMapObjectBounds:function(a){return this.mapObject.getBoundsZoomLevel(a)},getMapObjectLonLatFromLonLat:function(e,b){var c;if(this.sphericalMercator){var a=this.inverseMercator(e,b);c=new GLatLng(a.lat,a.lon)}else{c=new GLatLng(b,e)}return c},getMapObjectPixelFromXY:function(a,b){return new GPoint(a,b)}};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,e,a){OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,arguments);this.events.addEventType("tileloaded");this.grid=[]},destroy:function(){this.clearGrid();this.grid=null;this.tileSize=null;OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this,arguments)},clearGrid:function(){if(this.grid){for(var g=0,b=this.grid.length;g<b;g++){var f=this.grid[g];for(var c=0,a=f.length;c<a;c++){var e=f[c];this.removeTileMonitoringHooks(e);e.destroy()}}this.grid=[]}},clone:function(a){if(a==null){a=new OpenLayers.Layer.Grid(this.name,this.url,this.params,this.getOptions())}a=OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this,[a]);if(this.tileSize!=null){a.tileSize=this.tileSize.clone()}a.grid=[];return a},moveTo:function(e,a,f){OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this,arguments);e=e||this.map.getExtent();if(e!=null){var c=!this.grid.length||a;var b=this.getTilesBounds();if(this.singleTile){if(c||(!f&&!b.containsBounds(e))){this.initSingleTile(e)}}else{if(c||!b.containsBounds(e,true)){this.initGriddedTiles(e)}else{this.moveGriddedTiles(e)}}}},setTileSize:function(a){if(this.singleTile){a=this.map.getSize();a.h=parseInt(a.h*this.ratio);a.w=parseInt(a.w*this.ratio)}OpenLayers.Layer.HTTPRequest.prototype.setTileSize.apply(this,[a])},getGridBounds:function(){var a="The getGridBounds() function is deprecated. It will be removed in 3.0. Please use getTilesBounds() instead.";OpenLayers.Console.warn(a);return this.getTilesBounds()},getTilesBounds:function(){var f=null;if(this.grid.length){var a=this.grid.length-1;var e=this.grid[a][0];var b=this.grid[0].length-1;var c=this.grid[0][b];f=new OpenLayers.Bounds(e.bounds.left,e.bounds.bottom,c.bounds.right,c.bounds.top)}return f},initSingleTile:function(g){var a=g.getCenterLonLat();var k=g.getWidth()*this.ratio;var b=g.getHeight()*this.ratio;var h=new OpenLayers.Bounds(a.lon-(k/2),a.lat-(b/2),a.lon+(k/2),a.lat+(b/2));var e=new OpenLayers.LonLat(h.left,h.top);var c=this.map.getLayerPxFromLonLat(e);if(!this.grid.length){this.grid[0]=[]}var f=this.grid[0][0];if(!f){f=this.addTile(h,c);this.addTileMonitoringHooks(f);f.draw();this.grid[0][0]=f}else{f.moveTo(h,c)}this.removeExcessTiles(1,1)},calculateGridLayout:function(a,r,f){var n=f*this.tileSize.w;var c=f*this.tileSize.h;var l=a.left-r.left;var o=Math.floor(l/n)-this.buffer;var m=l/n-o;var g=-m*this.tileSize.w;var p=r.left+o*n;var b=a.top-(r.bottom+c);var k=Math.ceil(b/c)+this.buffer;var q=k-b/c;var e=-q*this.tileSize.h;var h=r.bottom+k*c;return{tilelon:n,tilelat:c,tileoffsetlon:p,tileoffsetlat:h,tileoffsetx:g,tileoffsety:e}},initGriddedTiles:function(l){var h=this.map.getSize();var A=Math.ceil(h.h/this.tileSize.h)+Math.max(1,2*this.buffer);var C=Math.ceil(h.w/this.tileSize.w)+Math.max(1,2*this.buffer);var r=this.getMaxExtent();var u=this.map.getResolution();var t=this.calculateGridLayout(l,r,u);var g=Math.round(t.tileoffsetx);var c=Math.round(t.tileoffsety);var n=t.tileoffsetlon;var q=t.tileoffsetlat;var f=t.tilelon;var m=t.tilelat;this.origin=new OpenLayers.Pixel(g,c);var z=g;var B=n;var w=0;var a=parseInt(this.map.layerContainerDiv.style.left);var v=parseInt(this.map.layerContainerDiv.style.top);do{var k=this.grid[w++];if(!k){k=[];this.grid.push(k)}n=B;g=z;var e=0;do{var b=new OpenLayers.Bounds(n,q,n+f,q+m);var p=g;p-=a;var o=c;o-=v;var s=new OpenLayers.Pixel(p,o);var D=k[e++];if(!D){D=this.addTile(b,s);this.addTileMonitoringHooks(D);k.push(D)}else{D.moveTo(b,s,false)}n+=f;g+=this.tileSize.w}while((n<=l.right+f*this.buffer)||e<C);q-=m;c+=this.tileSize.h}while((q>=l.bottom-m*this.buffer)||w<A);this.removeExcessTiles(w,e);this.spiralTileLoad()},getMaxExtent:function(){return this.maxExtent},spiralTileLoad:function(){var b=[];var k=["right","down","left","up"];var h=0;var a=-1;var m=OpenLayers.Util.indexOf(k,"right");var n=0;while(n<k.length){var l=h;var c=a;switch(k[m]){case"right":c++;break;case"down":l++;break;case"left":c--;break;case"up":l--;break}var g=null;if((l<this.grid.length)&&(l>=0)&&(c<this.grid[0].length)&&(c>=0)){g=this.grid[l][c]}if((g!=null)&&(!g.queued)){b.unshift(g);g.queued=true;n=0;h=l;a=c}else{m=(m+1)%4;n++}}for(var e=0,f=b.length;e<f;e++){var g=b[e];g.draw();g.queued=false}},addTile:function(b,a){},addTileMonitoringHooks:function(a){a.onLoadStart=function(){if(this.numLoadingTiles==0){this.events.triggerEvent("loadstart")}this.numLoadingTiles++};a.events.register("loadstart",this,a.onLoadStart);a.onLoadEnd=function(){this.numLoadingTiles--;this.events.triggerEvent("tileloaded");if(this.numLoadingTiles==0){this.events.triggerEvent("loadend")}};a.events.register("loadend",this,a.onLoadEnd);a.events.register("unload",this,a.onLoadEnd)},removeTileMonitoringHooks:function(a){a.unload();a.events.un({loadstart:a.onLoadStart,loadend:a.onLoadEnd,unload:a.onLoadEnd,scope:this})},moveGriddedTiles:function(c){var b=this.buffer||1;while(true){var a=this.grid[0][0].position;var e=this.map.getViewPortPxFromLayerPx(a);if(e.x>-this.tileSize.w*(b-1)){this.shiftColumn(true)}else{if(e.x<-this.tileSize.w*b){this.shiftColumn(false)}else{if(e.y>-this.tileSize.h*(b-1)){this.shiftRow(true)}else{if(e.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 g=b[c];var f=this.map.getResolution();var k=(p)?-this.tileSize.h:this.tileSize.h;var h=f*-k;var o=(p)?b.pop():b.shift();for(var l=0,n=g.length;l<n;l++){var e=g[l];var a=e.bounds.clone();var m=e.position.clone();a.bottom=a.bottom+h;a.top=a.top+h;m.y=m.y+k;o[l].moveTo(a,m)}if(p){b.unshift(o)}else{b.push(o)}},shiftColumn:function(o){var e=(o)?-this.tileSize.w:this.tileSize.w;var c=this.map.getResolution();var m=c*e;for(var f=0,h=this.grid.length;f<h;f++){var n=this.grid[f];var l=(o)?0:(n.length-1);var b=n[l];var a=b.bounds.clone();var g=b.position.clone();a.left=a.left+m;a.right=a.right+m;g.x=g.x+e;var k=o?this.grid[f].pop():this.grid[f].shift();k.moveTo(a,g);if(o){n.unshift(k)}else{n.push(k)}}},removeExcessTiles:function(f,c){while(this.grid.length>f){var g=this.grid.pop();for(var b=0,a=g.length;b<a;b++){var e=g[b];this.removeTileMonitoringHooks(e);e.destroy()}}while(this.grid[0].length>c){for(var b=0,a=this.grid.length;b<a;b++){var g=this.grid[b];var e=g.pop();this.removeTileMonitoringHooks(e);e.destroy()}}},onMapResize:function(){if(this.singleTile){this.clearGrid();this.setTileSize()}},getTileBounds:function(e){var c=this.maxExtent;var g=this.getResolution();var f=g*this.tileSize.w;var b=g*this.tileSize.h;var k=this.getLonLatFromViewPortPx(e);var a=c.left+(f*Math.floor((k.lon-c.left)/f));var h=c.bottom+(b*Math.floor((k.lat-c.bottom)/b));return new OpenLayers.Bounds(a,h,a+f,h+b)},CLASS_NAME:"OpenLayers.Layer.Grid"});OpenLayers.Style=OpenLayers.Class({id:null,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"]);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},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(m){var a=this.defaultsPerSymbolizer?{}:this.createLiterals(OpenLayers.Util.extend({},this.defaultStyle),m);var l=this.rules;var k,b;var c=[];var g=false;for(var e=0,f=l.length;e<f;e++){k=l[e];var h=k.evaluate(m);if(h){if(k instanceof OpenLayers.Rule&&k.elseFilter){c.push(k)}else{g=true;this.applySymbolizer(k,a,m)}}}if(g==false&&c.length>0){g=true;for(var e=0,f=c.length;e<f;e++){this.applySymbolizer(c[e],a,m)}}if(l.length>0&&g==false){a.display="none"}return a},applySymbolizer:function(g,e,b){var a=b.geometry?this.getSymbolizerPrefix(b.geometry):OpenLayers.Style.SYMBOLIZER_PREFIXES[0];var c=g.symbolizer[a]||g.symbolizer;if(this.defaultsPerSymbolizer===true){var f=this.defaultStyle;OpenLayers.Util.applyDefaults(c,{pointRadius:f.pointRadius});if(c.stroke===true||c.graphic===true){OpenLayers.Util.applyDefaults(c,{strokeWidth:f.strokeWidth,strokeColor:f.strokeColor,strokeOpacity:f.strokeOpacity,strokeDashstyle:f.strokeDashstyle,strokeLinecap:f.strokeLinecap})}if(c.fill===true||c.graphic===true){OpenLayers.Util.applyDefaults(c,{fillColor:f.fillColor,fillOpacity:f.fillOpacity})}if(c.graphic===true){OpenLayers.Util.applyDefaults(c,{pointRadius:this.defaultStyle.pointRadius,externalGraphic:this.defaultStyle.externalGraphic,graphicName:this.defaultStyle.graphicName,graphicOpacity:this.defaultStyle.graphicOpacity,graphicWidth:this.defaultStyle.graphicWidth,graphicHeight:this.defaultStyle.graphicHeight,graphicXOffset:this.defaultStyle.graphicXOffset,graphicYOffset:this.defaultStyle.graphicYOffset})}}return this.createLiterals(OpenLayers.Util.extend(e,c),b)},createLiterals:function(e,c){var b=OpenLayers.Util.extend({},c.attributes||c.data);OpenLayers.Util.extend(b,this.context);for(var a in this.propertyStyles){e[a]=OpenLayers.Style.createLiteral(e[a],b,c,a)}return e},findPropertyStyles:function(){var e={};var g=this.defaultStyle;this.addPropertyStyles(e,g);var k=this.rules;var f,h;for(var c=0,a=k.length;c<a;c++){f=k[c].symbolizer;for(var b in f){h=f[b];if(typeof h=="object"){this.addPropertyStyles(e,h)}else{this.addPropertyStyles(e,f);break}}}return e},addPropertyStyles:function(b,c){var e;for(var a in c){e=c[a];if(typeof e=="string"&&e.match(/\$\{\w+\}/)){b[a]=true}}return b},addRules:function(a){Array.prototype.push.apply(this.rules,a);this.propertyStyles=this.findPropertyStyles()},setDefaultStyle:function(a){this.defaultStyle=a;this.propertyStyles=this.findPropertyStyles()},getSymbolizerPrefix:function(e){var c=OpenLayers.Style.SYMBOLIZER_PREFIXES;for(var b=0,a=c.length;b<a;b++){if(e.CLASS_NAME.indexOf(c[b])!=-1){return c[b]}}},clone:function(){var b=OpenLayers.Util.extend({},this);if(this.rules){b.rules=[];for(var c=0,a=this.rules.length;c<a;++c){b.rules.push(this.rules[c].clone())}}b.context=this.context&&OpenLayers.Util.extend({},this.context);var e=OpenLayers.Util.extend({},this.defaultStyle);return new OpenLayers.Style(e,b)},CLASS_NAME:"OpenLayers.Style"});OpenLayers.Style.createLiteral=function(e,b,a,c){if(typeof e=="string"&&e.indexOf("${")!=-1){e=OpenLayers.String.format(e,b,[a,c]);e=(isNaN(e)||!e)?e:parseFloat(e)}return e};OpenLayers.Style.SYMBOLIZER_PREFIXES=["Point","Line","Polygon","Text","Raster"];OpenLayers.Control.Navigation=OpenLayers.Class(OpenLayers.Control,{dragPan:null,dragPanOptions:null,documentDrag:false,zoomBox:null,zoomBoxEnabled:true,zoomWheelEnabled:true,mouseWheelOptions:null,handleRightClicks:false,zoomBoxKeyMask:OpenLayers.Handler.MOD_SHIFT,autoActivate:true,initialize:function(a){this.handlers={};OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.deactivate();if(this.dragPan){this.dragPan.destroy()}this.dragPan=null;if(this.zoomBox){this.zoomBox.destroy()}this.zoomBox=null;OpenLayers.Control.prototype.destroy.apply(this,arguments)},activate:function(){this.dragPan.activate();if(this.zoomWheelEnabled){this.handlers.wheel.activate()}this.handlers.click.activate();if(this.zoomBoxEnabled){this.zoomBox.activate()}return OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){this.zoomBox.deactivate();this.dragPan.deactivate();this.handlers.click.deactivate();this.handlers.wheel.deactivate();return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},draw:function(){if(this.handleRightClicks){this.map.viewPortDiv.oncontextmenu=OpenLayers.Function.False}var a={dblclick:this.defaultDblClick,dblrightclick:this.defaultDblRightClick};var b={"double":true,stopDouble:true};this.handlers.click=new OpenLayers.Handler.Click(this,a,b);this.dragPan=new OpenLayers.Control.DragPan(OpenLayers.Util.extend({map:this.map,documentDrag:this.documentDrag},this.dragPanOptions));this.zoomBox=new OpenLayers.Control.ZoomBox({map:this.map,keyMask:this.zoomBoxKeyMask});this.dragPan.draw();this.zoomBox.draw();this.handlers.wheel=new OpenLayers.Handler.MouseWheel(this,{up:this.wheelUp,down:this.wheelDown},this.mouseWheelOptions)},defaultDblClick:function(b){var a=this.map.getLonLatFromViewPortPx(b.xy);this.map.setCenter(a,this.map.zoom+1)},defaultDblRightClick:function(b){var a=this.map.getLonLatFromViewPortPx(b.xy);this.map.setCenter(a,this.map.zoom-1)},wheelChange:function(l,c){var k=this.map.getZoom();var g=this.map.getZoom()+Math.round(c);g=Math.max(g,0);g=Math.min(g,this.map.getNumZoomLevels());if(g===k){return}var m=this.map.getSize();var f=m.w/2-l.xy.x;var e=l.xy.y-m.h/2;var h=this.map.baseLayer.getResolutionForZoom(g);var a=this.map.getLonLatFromPixel(l.xy);var b=new OpenLayers.LonLat(a.lon+f*h,a.lat+e*h);this.map.setCenter(b,g)},wheelUp:function(a,b){this.wheelChange(a,b||1)},wheelDown:function(a,b){this.wheelChange(a,b||-1)},disableZoomBox:function(){this.zoomBoxEnabled=false;this.zoomBox.deactivate()},enableZoomBox:function(){this.zoomBoxEnabled=true;if(this.active){this.zoomBox.activate()}},disableZoomWheel:function(){this.zoomWheelEnabled=false;this.handlers.wheel.deactivate()},enableZoomWheel:function(){this.zoomWheelEnabled=true;if(this.active){this.handlers.wheel.activate()}},CLASS_NAME:"OpenLayers.Control.Navigation"});OpenLayers.Geometry=OpenLayers.Class({id:null,parent:null,bounds:null,initialize:function(){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){this.id=null;this.bounds=null},clone:function(){return new OpenLayers.Geometry()},setBounds:function(a){if(a){this.bounds=a.clone()}},clearBounds:function(){this.bounds=null;if(this.parent){this.parent.clearBounds()}},extendBounds:function(b){var a=this.getBounds();if(!a){this.setBounds(b)}else{this.bounds.extend(b)}},getBounds:function(){if(this.bounds==null){this.calculateBounds()}return this.bounds},calculateBounds:function(){},distanceTo:function(b,a){},getVertices:function(a){},atPoint:function(f,k,g){var c=false;var e=this.getBounds();if((e!=null)&&(f!=null)){var b=(k!=null)?k:0;var a=(g!=null)?g:0;var h=new OpenLayers.Bounds(this.bounds.left-b,this.bounds.bottom-a,this.bounds.right+b,this.bounds.top+a);c=h.containsLonLat(f)}return c},getLength:function(){return 0},getArea:function(){return 0},getCentroid:function(){return null},toString:function(){return OpenLayers.Format.WKT.prototype.write(new OpenLayers.Feature.Vector(this))},CLASS_NAME:"OpenLayers.Geometry"});OpenLayers.Geometry.fromWKT=function(g){var h=arguments.callee.format;if(!h){h=new OpenLayers.Format.WKT();arguments.callee.format=h}var e;var b=h.read(g);if(b instanceof OpenLayers.Feature.Vector){e=b.geometry}else{if(b instanceof Array){var a=b.length;var f=new Array(a);for(var c=0;c<a;++c){f[c]=b[c].geometry}e=new OpenLayers.Geometry.Collection(f)}}return e};OpenLayers.Geometry.segmentsIntersect=function(a,H,b){var s=b&&b.point;var z=b&&b.tolerance;var f=false;var B=a.x1-H.x1;var F=a.y1-H.y1;var o=a.x2-a.x1;var w=a.y2-a.y1;var t=H.y2-H.y1;var l=H.x2-H.x1;var D=(t*o)-(l*w);var e=(l*F)-(t*B);var c=(o*F)-(w*B);if(D==0){if(e==0&&c==0){f=true}}else{var E=e/D;var C=c/D;if(E>=0&&E<=1&&C>=0&&C<=1){if(!s){f=true}else{var h=a.x1+(E*o);var g=a.y1+(E*w);f=new OpenLayers.Geometry.Point(h,g)}}}if(z){var r;if(f){if(s){var n=[a,H];var A,h,g;outer:for(var v=0;v<2;++v){A=n[v];for(var u=1;u<3;++u){h=A["x"+u];g=A["y"+u];r=Math.sqrt(Math.pow(h-f.x,2)+Math.pow(g-f.y,2));if(r<z){f.x=h;f.y=g;break outer}}}}}else{var n=[a,H];var q,G,h,g,m,k;outer:for(var v=0;v<2;++v){q=n[v];G=n[(v+1)%2];for(var u=1;u<3;++u){m={x:q["x"+u],y:q["y"+u]};k=OpenLayers.Geometry.distanceToSegment(m,G);if(k.distance<z){if(s){f=new OpenLayers.Geometry.Point(m.x,m.y)}else{f=true}break outer}}}}}return f};OpenLayers.Geometry.distanceToSegment=function(n,e){var c=n.x;var m=n.y;var b=e.x1;var l=e.y1;var a=e.x2;var g=e.y2;var p=a-b;var o=g-l;var k=((p*(c-b))+(o*(m-l)))/(Math.pow(p,2)+Math.pow(o,2));var h,f;if(k<=0){h=b;f=l}else{if(k>=1){h=a;f=g}else{h=b+k*p;f=l+k*o}}return{distance:Math.sqrt(Math.pow(h-c,2)+Math.pow(f-m,2)),x:h,y:f}};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 f=this.map;var g=f.getZoom();var a=f.getCenter();var b=this.isBaseLayer;var e=new OpenLayers.Layer.Google(this.name,this.options,this.arguments);var c=f.getLayerIndex(this);f.addLayer(e);f.removeLayer(this);f.setLayerIndex(e,c);if(b){f.setBaseLayer(e);f.zoomTo(g);f.setCenter(a)}},loadGoogleMapsCode:function(e){var c=true;try{if(!G_NORMAL_MAP){c=false}}catch(a){c=false}if(c){e();return}var b=this;google.load("maps","2",{callback:function(){e()}})},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,yx:{"EPSG:4326":true},initialize:function(e,c,f,b){var a=[];f=OpenLayers.Util.upperCaseObject(f);if(parseFloat(f.VERSION)>=1.3&&!f.EXCEPTIONS){f.EXCEPTIONS="INIMAGE"}a.push(e,c,f,b);OpenLayers.Layer.Grid.prototype.initialize.apply(this,a);OpenLayers.Util.applyDefaults(this.params,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS));if(!this.noMagic&&this.params.TRANSPARENT&&this.params.TRANSPARENT.toString().toLowerCase()=="true"){if((b==null)||(!b.isBaseLayer)){this.isBaseLayer=false}if(this.params.FORMAT=="image/jpeg"){this.params.FORMAT=OpenLayers.Util.alphaHack()?"image/gif":"image/png"}}},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments)},clone:function(a){if(a==null){a=new OpenLayers.Layer.WMS(this.name,this.url,this.params,this.getOptions())}a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a]);return a},reverseAxisOrder:function(){return(parseFloat(this.params.VERSION)>=1.3&&!!this.yx[this.map.getProjectionObject().getCode()])},getURL:function(c){c=this.adjustBounds(c);var e=this.getImageSize();var f={};var b=this.reverseAxisOrder();f.BBOX=this.encodeBBOX?c.toBBOX(null,b):c.toArray(b);f.WIDTH=e.w;f.HEIGHT=e.h;var a=this.getFullRequestString(f);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(e,b){var a=this.map.getProjection();var c=(a=="none")?null:a;if(parseFloat(this.params.VERSION)>=1.3){this.params.CRS=c}else{this.params.SRS=c}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,e,g,a){var f=[];for(var c in g){f.push(new OpenLayers.Rule({symbolizer:g[c],context:a,filter:new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.EQUAL_TO,property:e,value:c})}))}this.styles[b].addRules(f)},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;OpenLayers.Geometry.prototype.destroy.apply(this,arguments)},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 e=false;if(b){if(this.componentTypes==null||(OpenLayers.Util.indexOf(this.componentTypes,b.CLASS_NAME)>-1)){if(a!=null&&(a<this.components.length)){var f=this.components.slice(0,a);var c=this.components.slice(a,this.components.length);f.push(b);this.components=f.concat(c)}else{this.components.push(b)}b.parent=this;this.clearBounds();e=true}}return e},removeComponents:function(b){if(!(b instanceof Array)){b=[b]}for(var a=b.length-1;a>=0;--a){this.removeComponent(b[a])}},removeComponent:function(a){OpenLayers.Util.removeItem(this.components,a);this.clearBounds()},getLength:function(){var 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 e=0;for(var c=0,a=this.components.length;c<a;c++){e+=this.components[c].getGeodesicArea(b)}return e},getCentroid:function(h){if(!h){return this.components.length&&this.components[0].getCentroid()}var n=this.components.length;if(!n){return false}var b=[];var c=[];var e=0;var k=Number.MAX_VALUE;var o;for(var m=0;m<n;++m){o=this.components[m];var f=o.getArea();var g=o.getCentroid(true);if(isNaN(f)||isNaN(g.x)||isNaN(g.y)){continue}b.push(f);e+=f;k=(f<k&&f>0)?f:k;c.push(g)}n=b.length;if(e===0){for(var m=0;m<n;++m){b[m]=1}e=b.length}else{for(var m=0;m<n;++m){b[m]/=k}e/=k}var l=0,a=0,g,f;for(var m=0;m<n;++m){g=c[m];f=b[m];l+=g.x*f;a+=g.y*f}return new OpenLayers.Geometry.Point(l/e,a/e)},getGeodesicLength:function(b){var e=0;for(var c=0,a=this.components.length;c<a;c++){e+=this.components[c].getGeodesicLength(b)}return e},move:function(b,e){for(var c=0,a=this.components.length;c<a;c++){this.components[c].move(b,e)}},rotate:function(e,b){for(var c=0,a=this.components.length;c<a;++c){this.components[c].rotate(e,b)}},resize:function(e,a,c){for(var b=0;b<this.components.length;++b){this.components[b].resize(e,a,c)}return this},distanceTo:function(k,l){var c=!(l&&l.edge===false);var a=c&&l&&l.details;var m,e,b;var f=Number.POSITIVE_INFINITY;for(var g=0,h=this.components.length;g<h;++g){m=this.components[g].distanceTo(k,l);b=a?m.distance:m;if(b<f){f=b;e=m;if(f==0){break}}}return e},equals:function(e){var b=true;if(!e||!e.CLASS_NAME||(this.CLASS_NAME!=e.CLASS_NAME)){b=false}else{if(!(e.components instanceof Array)||(e.components.length!=this.components.length)){b=false}else{for(var c=0,a=this.components.length;c<a;++c){if(!this.components[c].equals(e.components[c])){b=false;break}}}}return b},transform:function(f,c){if(f&&c){for(var e=0,a=this.components.length;e<a;e++){var b=this.components[e];b.transform(f,c)}this.bounds=null}return this},intersects:function(e){var b=false;for(var c=0,a=this.components.length;c<a;++c){b=e.intersects(this.components[c]);if(b){break}}return b},getVertices:function(b){var c=[];for(var e=0,a=this.components.length;e<a;++e){Array.prototype.push.apply(c,this.components[e].getVertices(b))}return c},CLASS_NAME:"OpenLayers.Geometry.Collection"});OpenLayers.Geometry.Point=OpenLayers.Class(OpenLayers.Geometry,{x:null,y:null,initialize:function(a,b){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.x=parseFloat(a);this.y=parseFloat(b)},clone:function(a){if(a==null){a=new OpenLayers.Geometry.Point(this.x,this.y)}OpenLayers.Util.applyDefaults(a,this);return a},calculateBounds:function(){this.bounds=new OpenLayers.Bounds(this.x,this.y,this.x,this.y)},distanceTo:function(g,m){var e=!(m&&m.edge===false);var a=e&&m&&m.details;var b,f,k,c,h,l;if(g instanceof OpenLayers.Geometry.Point){f=this.x;k=this.y;c=g.x;h=g.y;b=Math.sqrt(Math.pow(f-c,2)+Math.pow(k-h,2));l=!a?b:{x0:f,y0:k,x1:c,y1:h,distance:b}}else{l=g.distanceTo(this,m);if(a){l={x0:l.x1,y0:l.y1,x1:l.x0,y1:l.y0,distance:l.distance}}}return l},equals:function(a){var b=false;if(a!=null){b=((this.x==a.x&&this.y==a.y)||(isNaN(this.x)&&isNaN(this.y)&&isNaN(a.x)&&isNaN(a.y)))}return b},toShortString:function(){return(this.x+", "+this.y)},move:function(a,b){this.x=this.x+a;this.y=this.y+b;this.clearBounds()},rotate:function(e,b){e*=Math.PI/180;var a=this.distanceTo(b);var c=e+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","beforefeaturesremoved","featureremoved","featuresremoved","beforefeatureselected","featureselected","featureunselected","beforefeaturemodified","featuremodified","afterfeaturemodified","vertexmodified","sketchstarted","sketchmodified","sketchcomplete","refresh"],isBaseLayer:false,isFixed:false,isVector:true,features:null,filter:null,selectedFeatures:null,unrenderedFeatures:null,reportError:true,style:null,styleMap:null,strategies:null,protocol:null,renderers:["SVG","VML","Canvas"],renderer:null,rendererOptions:null,geometryType:null,drawn:false,initialize:function(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 e=0,a=this.strategies.length;e<a;e++){this.strategies[e].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)},clone:function(f){if(f==null){f=new OpenLayers.Layer.Vector(this.name,this.getOptions())}f=OpenLayers.Layer.prototype.clone.apply(this,[f]);var c=this.features;var a=c.length;var e=new Array(a);for(var b=0;b<a;++b){e[b]=c[b].clone()}f.features=e;return f},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=this.renderers[c];var e=(typeof b=="function")?b:OpenLayers.Renderer[b];if(e&&e.prototype.supported()){this.renderer=new e(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){this.drawn=false;if(this.strategies){var e,b,a;for(b=0,a=this.strategies.length;b<a;b++){e=this.strategies[b];if(e.autoActivate){e.deactivate()}}}},onMapResize:function(){OpenLayers.Layer.prototype.onMapResize.apply(this,arguments);this.renderer.setSize(this.map.getSize())},moveTo:function(h,b,k){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);var f=true;if(!k){this.renderer.root.style.visibility="hidden";this.div.style.left=-parseInt(this.map.layerContainerDiv.style.left)+"px";this.div.style.top=-parseInt(this.map.layerContainerDiv.style.top)+"px";var g=this.map.getExtent();f=this.renderer.setExtent(g,b);this.renderer.root.style.visibility="visible";if(navigator.userAgent.toLowerCase().indexOf("gecko")!=-1){this.div.scrollLeft=this.div.scrollLeft}if(!b&&f){for(var e in this.unrenderedFeatures){var c=this.unrenderedFeatures[e];this.drawFeature(c)}}}if(!this.drawn||b||!f){this.drawn=true;var c;for(var e=0,a=this.features.length;e<a;e++){this.renderer.locked=(e!==(a-1));c=this.features[e];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,m){if(!(b instanceof Array)){b=[b]}var k=!m||!m.silent;if(k){var a={features:b};var h=this.events.triggerEvent("beforefeaturesadded",a);if(h===false){return}b=a.features}var e=[];for(var c=0,g=b.length;c<g;c++){if(c!=(b.length-1)){this.renderer.locked=true}else{this.renderer.locked=false}var l=b[c];if(this.geometryType&&!(l.geometry instanceof this.geometryType)){var f=OpenLayers.i18n("componentShouldBe",{geomType:this.geometryType.prototype.CLASS_NAME});throw f}l.layer=this;if(!l.style&&this.style){l.style=OpenLayers.Util.extend({},this.style)}if(k){if(this.events.triggerEvent("beforefeatureadded",{feature:l})===false){continue}this.preFeatureInsert(l)}e.push(l);this.features.push(l);this.drawFeature(l);if(k){this.events.triggerEvent("featureadded",{feature:l});this.onFeatureInsert(l)}}if(k){this.events.triggerEvent("featuresadded",{features:e})}},removeFeatures:function(f,a){if(!f||f.length===0){return}if(f===this.features){return this.removeAllFeatures(a)}if(!(f instanceof Array)){f=[f]}if(f===this.selectedFeatures){f=f.slice()}var e=!a||!a.silent;if(e){this.events.triggerEvent("beforefeaturesremoved",{features:f})}for(var c=f.length-1;c>=0;c--){if(c!=0&&f[c-1].geometry){this.renderer.locked=true}else{this.renderer.locked=false}var b=f[c];delete this.unrenderedFeatures[b.id];if(e){this.events.triggerEvent("beforefeatureremoved",{feature:b})}this.features=OpenLayers.Util.removeItem(this.features,b);b.layer=null;if(b.geometry){this.renderer.eraseFeatures(b)}if(OpenLayers.Util.indexOf(this.selectedFeatures,b)!=-1){OpenLayers.Util.removeItem(this.selectedFeatures,b)}if(e){this.events.triggerEvent("featureremoved",{feature:b})}}if(e){this.events.triggerEvent("featuresremoved",{features:f})}},removeAllFeatures:function(a){var e=!a||!a.silent;var f=this.features;if(e){this.events.triggerEvent("beforefeaturesremoved",{features:f})}var c;for(var b=f.length-1;b>=0;b--){c=f[b];if(e){this.events.triggerEvent("beforefeatureremoved",{feature:c})}c.layer=null;if(e){this.events.triggerEvent("featureremoved",{feature:c})}}this.renderer.clear();this.features=[];this.unrenderedFeatures={};this.selectedFeatures=[];if(e){this.events.triggerEvent("featuresremoved",{features:f})}},destroyFeatures:function(e,a){var c=(e==undefined);if(c){e=this.features}if(e){this.removeFeatures(e,a);for(var b=e.length-1;b>=0;b--){e[b].destroy()}}},drawFeature:function(a,b){if(!this.drawn){return}if(typeof b!="object"){if(!b&&a.state===OpenLayers.State.DELETE){b="delete"}var 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)},getFeatureBy:function(f,e){var c=null;for(var b=0,a=this.features.length;b<a;++b){if(this.features[b][f]==e){c=this.features[b];break}}return c},getFeatureById:function(a){return this.getFeatureBy("id",a)},getFeatureByFid:function(a){return this.getFeatureBy("fid",a)},onFeatureInsert:function(a){},preFeatureInsert:function(a){},getDataExtent:function(){var b=null;var e=this.features;if(e&&(e.length>0)){b=new OpenLayers.Bounds();var f=null;for(var c=0,a=e.length;c<a;c++){f=e[c].geometry;if(f){b.extend(f.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 f=this;if(b){var c=new OpenLayers.Projection("EPSG:4326");if(!c.equals(b)){f=this.clone().transform(b,c)}}var g=0;if(f.components&&(f.components.length>1)){var k,h;for(var e=1,a=f.components.length;e<a;e++){k=f.components[e-1];h=f.components[e];g+=OpenLayers.Util.distVincenty({lon:k.x,lat:k.y},{lon:h.x,lat:h.y})}}return g*1000},CLASS_NAME:"OpenLayers.Geometry.Curve"});OpenLayers.Geometry.LineString=OpenLayers.Class(OpenLayers.Geometry.Curve,{initialize:function(a){OpenLayers.Geometry.Curve.prototype.initialize.apply(this,arguments)},removeComponent:function(a){if(this.components&&(this.components.length>2)){OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments)}},intersects:function(n){var c=false;var m=n.CLASS_NAME;if(m=="OpenLayers.Geometry.LineString"||m=="OpenLayers.Geometry.LinearRing"||m=="OpenLayers.Geometry.Point"){var q=this.getSortedSegments();var o;if(m=="OpenLayers.Geometry.Point"){o=[{x1:n.x,y1:n.y,x2:n.x,y2:n.y}]}else{o=n.getSortedSegments()}var t,h,f,a,s,r,e,b;outer:for(var k=0,l=q.length;k<l;++k){t=q[k];h=t.x1;f=t.x2;a=t.y1;s=t.y2;inner:for(var g=0,p=o.length;g<p;++g){r=o[g];if(r.x1>f){break}if(r.x2<h){continue}e=r.y1;b=r.y2;if(Math.min(e,b)>Math.max(a,s)){continue}if(Math.max(e,b)<Math.min(a,s)){continue}if(OpenLayers.Geometry.segmentsIntersect(t,r)){c=true;break outer}}}}else{c=n.intersects(this)}return c},getSortedSegments:function(){var a=this.components.length-1;var b=new Array(a),f,e;for(var c=0;c<a;++c){f=this.components[c];e=this.components[c+1];if(f.x<e.x){b[c]={x1:f.x,y1:f.y,x2:e.x,y2:e.y}}else{b[c]={x1:e.x,y1:e.y,x2:f.x,y2:f.y}}}function g(k,h){return k.x1-h.x1}return b.sort(g)},splitWithSegment:function(t,b){var c=!(b&&b.edge===false);var q=b&&b.tolerance;var a=[];var v=this.getVertices();var p=[];var y=[];var k=false;var f,e,n;var l,s,w;var g={point:true,tolerance:q};var h=null;for(var o=0,m=v.length-2;o<=m;++o){f=v[o];p.push(f.clone());e=v[o+1];w={x1:f.x,y1:f.y,x2:e.x,y2:e.y};n=OpenLayers.Geometry.segmentsIntersect(t,w,g);if(n instanceof OpenLayers.Geometry.Point){if((n.x===t.x1&&n.y===t.y1)||(n.x===t.x2&&n.y===t.y2)||n.equals(f)||n.equals(e)){s=true}else{s=false}if(s||c){if(!n.equals(y[y.length-1])){y.push(n.clone())}if(o===0){if(n.equals(f)){continue}}if(n.equals(e)){continue}k=true;if(!n.equals(f)){p.push(n)}a.push(new OpenLayers.Geometry.LineString(p));p=[n.clone()]}}}if(k){p.push(e.clone());a.push(new OpenLayers.Geometry.LineString(p))}if(y.length>0){var r=t.x1<t.x2?1:-1;var u=t.y1<t.y2?1:-1;h={lines:a,points:y.sort(function(A,z){return(r*A.x-r*z.x)||(u*A.y-u*z.y)})}}return h},split:function(z,b){var o=null;var e=b&&b.mutual;var m,f,n,c;if(z instanceof OpenLayers.Geometry.LineString){var y=this.getVertices();var h,g,w,l,a,q;var t=[];n=[];for(var u=0,p=y.length-2;u<=p;++u){h=y[u];g=y[u+1];w={x1:h.x,y1:h.y,x2:g.x,y2:g.y};c=c||[z];if(e){t.push(h.clone())}for(var s=0;s<c.length;++s){l=c[s].splitWithSegment(w,b);if(l){a=l.lines;if(a.length>0){a.unshift(s,1);Array.prototype.splice.apply(c,a);s+=a.length-2}if(e){for(var r=0,v=l.points.length;r<v;++r){q=l.points[r];if(!q.equals(h)){t.push(q);n.push(new OpenLayers.Geometry.LineString(t));if(q.equals(g)){t=[]}else{t=[q.clone()]}}}}}}}if(e&&n.length>0&&t.length>0){t.push(g.clone());n.push(new OpenLayers.Geometry.LineString(t))}}else{o=z.splitWith(this,b)}if(c&&c.length>1){f=true}else{c=[]}if(n&&n.length>1){m=true}else{n=[]}if(f||m){if(e){o=[n,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(k,h){var l=!(h&&h.edge===false);var C=l&&h&&h.details;var r,f={};var u=Number.POSITIVE_INFINITY;if(k instanceof OpenLayers.Geometry.Point){var s=this.getSortedSegments();var q=k.x;var p=k.y;var A;for(var w=0,z=s.length;w<z;++w){A=s[w];r=OpenLayers.Geometry.distanceToSegment(k,A);if(r.distance<u){u=r.distance;f=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){f={distance:f.distance,x0:f.x,y0:f.y,x1:q,y1:p}}else{f=f.distance}}else{if(k instanceof OpenLayers.Geometry.LineString){var e=this.getSortedSegments();var c=k.getSortedSegments();var b,a,o,B,g;var n=c.length;var m={point:true};outer:for(var w=0,z=e.length;w<z;++w){b=e[w];B=b.x1;g=b.y1;for(var v=0;v<n;++v){a=c[v];o=OpenLayers.Geometry.segmentsIntersect(b,a,m);if(o){u=0;f={distance:0,x0:o.x,y0:o.y,x1:o.x,y1:o.y};break outer}else{r=OpenLayers.Geometry.distanceToSegment({x:B,y:g},a);if(r.distance<u){u=r.distance;f={distance:u,x0:B,y0:g,x1:r.x,y1:r.y}}}}}if(!C){f=f.distance}if(u!==0){if(b){r=k.distanceTo(new OpenLayers.Geometry.Point(b.x2,b.y2),h);var t=C?r.distance:r;if(t<u){if(C){f={distance:u,x0:r.x1,y0:r.y1,x1:r.x0,y1:r.y0}}else{f=t}}}}}else{f=k.distanceTo(this,h);if(C){f={distance:f.distance,x0:f.x1,y0:f.y1,x1:f.x0,y1:f.y0}}}}return f},CLASS_NAME:"OpenLayers.Geometry.LineString"});
/*
 * DatePicker widget using Prototype and Scriptaculous.
 * (c) 2007-2008 Mathieu Jondet <mathieu@eulerian.com>
 * Eulerian Technologies
 * (c) 2009 Titi Ala'ilima <tigre@pobox.com>
 *
 * DatePicker is freely distributable under the same terms as Prototype.
 *
 * NOTE: HEAVILY MODIFIED FOR IDIOM PORTAL
 * 
 * v1.0.0
 */
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(e,k){var b=DatePickerUtils.dateObjectToAnsi(a);var h=new Array();var g=DatePickerUtils.getMonthDays(e,k);var f=DatePickerUtils.yearMonthToAnsiStub(e,k);for(var c=1;c<=g;c++){h[c]=(b>(f+c.toPaddedString(2)))}return h},function(c,f){var b=DatePickerUtils.dateObjectToAnsi(a);var e=DatePickerUtils.yearMonthToAnsiStub(c,f)+DatePickerUtils.getMonthDays(c,f);return(b<=e)})},noDatesAfter:function(a){return new DatePickerFilter(function(e,k){var b=DatePickerUtils.dateObjectToAnsi(a);var h=new Array();var g=DatePickerUtils.getMonthDays(e,k);var f=DatePickerUtils.yearMonthToAnsiStub(e,k);for(var c=1;c<=g;c++){h[c]=(b<(f+c.toPaddedString(2)))}return h},function(c,f){var b=DatePickerUtils.dateObjectToAnsi(a);var e=DatePickerUtils.yearMonthToAnsiStub(c,f)+"01";return(b>=e)})}};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(e,g,c,f){if(Object.isUndefined(f)){f=this.separator}var b=[0,0,0];b[this._formatYearIndex]=e;b[this._formatMonthIndex]=g.toPaddedString(2);b[this._formatDayIndex]=c.toPaddedString(2);return b.join(f)}};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(h,k){var f=b(h,k);var e=c.badDates(h,k);for(var g=0;g<f.length;g++){f[g]=f[g]||e[g]}return f}}}if(!this.validMonthP){this.validMonthP=c.validMonthP}else{if(c.validMonthP){var a=this.validMonthP;this.validMonthP=function(e,f){return a(e,f)&&c.validMonthP(e,f)}}}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"],de:["Jänner","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"]}),_language_day:$H({en:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],de:["Mo","Di","Mi","Do","Fr","Sa","So"]}),_language_date_format:$H({en:[["yyyy","mm","dd"],"-"],de:[["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";if(!Object.isUndefined(a.language)){this._language=a.language}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(u){}var o=new Element("tr");this._language_day.get(this._language).each(function(e){var A=new Element("td");A.innerHTML=e;A.className="wday";o.appendChild(A)});a.appendChild(o);var v=[[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 q=this._currentMonth;var z=this._currentYear;var w=new Date(z,q,1,12);var g=(w.getDay()+6)%7;var c=DatePickerUtils.getMonthDays(z,q);var k=1;var y=(this._dateFilter.badDates)?this._dateFilter.badDates(z,q):[];for(var s=g;s<7;s++){v[0][s]={d:k,m:q,y:z,b:y[k]};k++}var m=this._prevMonthYear();var p=DatePickerUtils.getMonthDays(m[1],m[0]);for(var s=0;s<g;s++){v[0][s]={d:Number(p-g+s+1),m:Number(m[0]),y:m[1],c:"outbound",b:true}}var r=false;for(var t=1;t<6;t++){for(var s=0;s<7;s++){v[t][s]={d:k,m:q,y:z,c:(r)?"outbound":(((k==this._currentDay)&&(q==this._currentMonth)&&(z==this._currentYear))?"today":null),b:r||y[k]};k++;if(k>c){k=1;r=true;if(this._currentMonth+1>11){q=0;z+=1}else{q+=1}}}}for(var t=0;t<6;t++){var b=new Element("tr");for(var s=0;s<7;s++){var l=v[t][s];var h=new Element("td");var n=$A([this._relative,this._df.dateToString(l.y,l.m+1,l.d,"-")]).join("-");h.setAttribute("id",n);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(e,b,c){if(b){e.className=(c)?"nclick_"+c:"nclick"}else{var a=this;e.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;")}};(function(){if(!Date.now){Date.now=function(){return +new Date}}try{document.createElement("div").style.setProperty("opacity",0,"")}catch(b7){var bj=CSSStyleDeclaration.prototype,c=bj.setProperty;bj.setProperty=function(ci,ck,cj){c.call(this,ci,ck+"",cj)}}d3={version:"2.1.3"};var a2=[].__proto__?function(cj,ci){cj.__proto__=ci}:function(ck,ci){for(var cj in ci){ck[cj]=ci[cj]}};function a0(){return this}d3.functor=function(ci){return typeof ci==="function"?ci:function(){return ci}};d3.rebind=function(ci,cj){return function(){var ck=cj.apply(ci,arguments);return arguments.length?ci:ck}};d3.ascending=function(cj,ci){return cj<ci?-1:cj>ci?1:cj>=ci?0:NaN};d3.descending=function(cj,ci){return ci<cj?-1:ci>cj?1:ci>=cj?0:NaN};d3.min=function(cn,cl){var ck=-1,cm=cn.length,cj,ci;if(arguments.length===1){while(++ck<cm&&((cj=cn[ck])==null||cj!=cj)){cj=undefined}while(++ck<cm){if((ci=cn[ck])!=null&&cj>ci){cj=ci}}}else{while(++ck<cm&&((cj=cl.call(cn,cn[ck],ck))==null||cj!=cj)){cj=undefined}while(++ck<cm){if((ci=cl.call(cn,cn[ck],ck))!=null&&cj>ci){cj=ci}}}return cj};d3.max=function(cn,cl){var ck=-1,cm=cn.length,cj,ci;if(arguments.length===1){while(++ck<cm&&((cj=cn[ck])==null||cj!=cj)){cj=undefined}while(++ck<cm){if((ci=cn[ck])!=null&&ci>cj){cj=ci}}}else{while(++ck<cm&&((cj=cl.call(cn,cn[ck],ck))==null||cj!=cj)){cj=undefined}while(++ck<cm){if((ci=cl.call(cn,cn[ck],ck))!=null&&ci>cj){cj=ci}}}return cj};d3.sum=function(cn,cl){var ck=0,cm=cn.length,ci,cj=-1;if(arguments.length===1){while(++cj<cm){if(!isNaN(ci=+cn[cj])){ck+=ci}}}else{while(++cj<cm){if(!isNaN(ci=+cl.call(cn,cn[cj],cj))){ck+=ci}}}return ck};d3.quantile=function(cj,cn){var ck=(cj.length-1)*cn+1,cl=Math.floor(ck),ci=cj[cl-1],cm=ck-cl;return cm?ci+cm*(cj[cl]-ci):ci};d3.zip=function(){if(!(cn=arguments.length)){return[]}for(var cl=-1,ci=d3.min(arguments,bE),ck=new Array(ci);++cl<ci;){for(var cj=-1,cn,cm=ck[cl]=new Array(cn);++cj<cn;){cm[cj]=arguments[cj][cl]}}return ck};function bE(ci){return ci.length}d3.bisectLeft=function(cj,ci,cm,cl){if(arguments.length<3){cm=0}if(arguments.length<4){cl=cj.length}while(cm<cl){var ck=(cm+cl)>>1;if(cj[ck]<ci){cm=ck+1}else{cl=ck}}return cm};d3.bisect=d3.bisectRight=function(cj,ci,cm,cl){if(arguments.length<3){cm=0}if(arguments.length<4){cl=cj.length}while(cm<cl){var ck=(cm+cl)>>1;if(ci<cj[ck]){cl=ck}else{cm=ck+1}}return cm};d3.first=function(cn,cl){var ck=0,cm=cn.length,cj=cn[0],ci;if(arguments.length===1){cl=d3.ascending}while(++ck<cm){if(cl.call(cn,cj,ci=cn[ck])>0){cj=ci}}return cj};d3.last=function(cn,cl){var ck=0,cm=cn.length,cj=cn[0],ci;if(arguments.length===1){cl=d3.ascending}while(++ck<cm){if(cl.call(cn,cj,ci=cn[ck])<=0){cj=ci}}return cj};d3.nest=function(){var cl={},ck=[],co=[],cj,cm;function cn(cw,cu){if(cu>=ck.length){return cm?cm.call(cl,cw):(cj?cw.sort(cj):cw)}var cr=-1,cv=cw.length,cq=ck[cu++],cs,cp,ct={};while(++cr<cv){if((cs=cq(cp=cw[cr])) in ct){ct[cs].push(cp)}else{ct[cs]=[cp]}}for(cs in ct){ct[cs]=cn(ct[cs],cu)}return ct}function ci(cs,ct){if(ct>=ck.length){return cs}var cp=[],cq=co[ct++],cr;for(cr in cs){cp.push({key:cr,values:ci(cs[cr],ct)})}if(cq){cp.sort(function(cv,cu){return cq(cv.key,cu.key)})}return cp}cl.map=function(cp){return cn(cp,0)};cl.entries=function(cp){return ci(cn(cp,0),0)};cl.key=function(cp){ck.push(cp);return cl};cl.sortKeys=function(cp){co[ck.length-1]=cp;return cl};cl.sortValues=function(cp){cj=cp;return cl};cl.rollup=function(cp){cm=cp;return cl};return cl};d3.keys=function(ck){var cj=[];for(var ci in ck){cj.push(ci)}return cj};d3.values=function(ck){var ci=[];for(var cj in ck){ci.push(ck[cj])}return ci};d3.entries=function(ck){var ci=[];for(var cj in ck){ci.push({key:cj,value:ck[cj]})}return ci};d3.permute=function(cm,cj){var ci=[],ck=-1,cl=cj.length;while(++ck<cl){ci[ck]=cm[cj[ck]]}return ci};d3.merge=function(ci){return Array.prototype.concat.apply([],ci)};d3.split=function(co,cm){var cl=[],ci=[],ck,cj=-1,cn=co.length;if(arguments.length<2){cm=bu}while(++cj<cn){if(cm.call(ci,ck=co[cj],cj)){ci=[]}else{if(!ci.length){cl.push(ci)}ci.push(ck)}}return cl};function bu(ci){return ci==null}function bS(ci){return ci.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}d3.range=function(cn,cl,cm){if(arguments.length<3){cm=1;if(arguments.length<2){cl=cn;cn=0}}if((cl-cn)/cm==Infinity){throw new Error("infinite range")}var ci=[],ck=-1,cj;if(cm<0){while((cj=cn+cm*++ck)>cl){ci.push(cj)}}else{while((cj=cn+cm*++ck)<cl){ci.push(cj)}}return ci};d3.requote=function(ci){return ci.replace(aZ,"\\$&")};var aZ=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(ci,cj){return cj?Math.round(ci*Math.pow(10,cj))*Math.pow(10,-cj):Math.round(ci)};d3.xhr=function(ci,ck,cl){var cj=new XMLHttpRequest;if(arguments.length<3){cl=ck}else{if(ck&&cj.overrideMimeType){cj.overrideMimeType(ck)}}cj.open("GET",ci,true);cj.onreadystatechange=function(){if(cj.readyState===4){cl(cj.status<300?cj:null)}};cj.send(null)};d3.text=function(ci,ck,cl){function cj(cm){cl(cm&&cm.responseText)}if(arguments.length<3){cl=ck;ck=null}d3.xhr(ci,ck,cj)};d3.json=function(ci,cj){d3.text(ci,"application/json",function(ck){cj(ck?JSON.parse(ck):null)})};d3.html=function(ci,cj){d3.text(ci,"text/html",function(cl){if(cl!=null){var ck=document.createRange();ck.selectNode(document.body);cl=ck.createContextualFragment(cl)}cj(cl)})};d3.xml=function(ci,ck,cl){function cj(cm){cl(cm&&cm.responseXML)}if(arguments.length<3){cl=ck;ck=null}d3.xhr(ci,ck,cj)};d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(ci){var cj=ci.indexOf(":");return cj<0?ci:{space:d3.ns.prefix[ci.substring(0,cj)],local:ci.substring(cj+1)}}};d3.dispatch=function(ck){var ci={},cl;for(var cj=0,cm=arguments.length;cj<cm;cj++){cl=arguments[cj];ci[cl]=U(cl)}return ci};function U(ck){var ci={},cj=[];ci.add=function(cm){for(var cl=0;cl<cj.length;cl++){if(cj[cl].listener==cm){return ci}}cj.push({listener:cm,on:true});return ci};ci.remove=function(cn){for(var cm=0;cm<cj.length;cm++){var cl=cj[cm];if(cl.listener==cn){cl.on=false;cj=cj.slice(0,cm).concat(cj.slice(cm+1));break}}return ci};ci.dispatch=function(){var cm=cj;for(var cn=0,co=cm.length;cn<co;cn++){var cl=cm[cn];if(cl.on){cl.listener.apply(this,arguments)}}};return ci}d3.format=function(cp){var cm=G.exec(cp),cr=cm[1]||" ",cj=cm[3]||"",ck=cm[5],ci=+cm[6],cs=cm[7],cn=cm[8],co=cm[9],cq=false,cl=false;if(cn){cn=cn.substring(1)}if(ck){cr="0";if(cs){ci-=Math.floor((ci-1)/4)}}switch(co){case"n":cs=true;co="g";break;case"%":cq=true;co="f";break;case"p":cq=true;co="r";break;case"d":cl=true;cn="0";break}co=aQ[co]||bW;return function(cw){var cv=cq?cw*100:+cw,ct=(cv<0)&&(cv=-cv)?"\u2212":cj;if(cl&&(cv%1)){return""}cw=co(cv,cn);if(ck){var cu=cw.length+ct.length;if(cu<ci){cw=new Array(ci-cu+1).join(cr)+cw}if(cs){cw=bM(cw)}cw=ct+cw}else{if(cs){cw=bM(cw)}cw=ct+cw;var cu=cw.length;if(cu<ci){cw=new Array(ci-cu+1).join(cr)+cw}}if(cq){cw+="%"}return cw}};var G=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/;var aQ={g:function(ci,cj){return ci.toPrecision(cj)},e:function(ci,cj){return ci.toExponential(cj)},f:function(ci,cj){return ci.toFixed(cj)},r:function(ci,cj){var ck=1+Math.floor(1e-15+Math.log(ci)/Math.LN10);return d3.round(ci,cj-ck).toFixed(Math.max(0,Math.min(20,cj-ck)))}};function bW(ci){return ci+""}function bM(cl){var cj=cl.lastIndexOf("."),ck=cj>=0?cl.substring(cj):(cj=cl.length,""),ci=[];while(cj>0){ci.push(cl.substring(cj-=3,cj+3))}return ci.reverse().join(",")+ck}var bl=a1(2),W=a1(3);var b={linear:function(){return b6},poly:a1,quad:function(){return bl},cubic:function(){return W},sin:function(){return aC},exp:function(){return Z},circle:function(){return bm},elastic:aw,back:aE,bounce:function(){return aS}};var bc={"in":function(ci){return ci},out:aM,"in-out":av,"out-in":function(ci){return av(aM(ci))}};d3.ease=function(cj){var cl=cj.indexOf("-"),ck=cl>=0?cj.substring(0,cl):cj,ci=cl>=0?cj.substring(cl+1):"in";return aR(bc[ci](b[ck].apply(null,Array.prototype.slice.call(arguments,1))))};function aR(ci){return function(cj){return cj<=0?0:cj>=1?1:ci(cj)}}function aM(ci){return function(cj){return 1-ci(1-cj)}}function av(ci){return function(cj){return 0.5*(cj<0.5?ci(2*cj):(2-ci(2-2*cj)))}}function b6(ci){return ci}function a1(ci){return function(cj){return Math.pow(cj,ci)}}function aC(ci){return 1-Math.cos(ci*Math.PI/2)}function Z(ci){return Math.pow(2,10*(ci-1))}function bm(ci){return 1-Math.sqrt(1-ci*ci)}function aw(ci,ck){var cj;if(arguments.length<2){ck=0.45}if(arguments.length<1){ci=1;cj=ck/4}else{cj=ck/(2*Math.PI)*Math.asin(1/ci)}return function(cl){return 1+ci*Math.pow(2,10*-cl)*Math.sin((cl-cj)*2*Math.PI/ck)}}function aE(ci){if(!ci){ci=1.70158}return function(cj){return cj*cj*((ci+1)*cj-ci)}}function aS(ci){return ci<1/2.75?7.5625*ci*ci:ci<2/2.75?7.5625*(ci-=1.5/2.75)*ci+0.75:ci<2.5/2.75?7.5625*(ci-=2.25/2.75)*ci+0.9375:7.5625*(ci-=2.625/2.75)*ci+0.984375}d3.event=null;d3.interpolate=function(cj,ci){var ck=d3.interpolators.length,cl;while(--ck>=0&&!(cl=d3.interpolators[ck](cj,ci))){}return cl};d3.interpolateNumber=function(cj,ci){ci-=cj;return function(ck){return cj+ci*ck}};d3.interpolateRound=function(cj,ci){ci-=cj;return function(ck){return Math.round(cj+ci*ck)}};d3.interpolateString=function(cp,co){var cl,cn,cm,cr=0,cq=0,cs=[],ci=[],ck,cj;p.lastIndex=0;for(cn=0;cl=p.exec(co);++cn){if(cl.index){cs.push(co.substring(cr,cq=cl.index))}ci.push({i:cs.length,x:cl[0]});cs.push(null);cr=p.lastIndex}if(cr<co.length){cs.push(co.substring(cr))}for(cn=0,ck=ci.length;(cl=p.exec(cp))&&cn<ck;++cn){cj=ci[cn];if(cj.x==cl[0]){if(cj.i){if(cs[cj.i+1]==null){cs[cj.i-1]+=cj.x;cs.splice(cj.i,1);for(cm=cn+1;cm<ck;++cm){ci[cm].i--}}else{cs[cj.i-1]+=cj.x+cs[cj.i+1];cs.splice(cj.i,2);for(cm=cn+1;cm<ck;++cm){ci[cm].i-=2}}}else{if(cs[cj.i+1]==null){cs[cj.i]=cj.x}else{cs[cj.i]=cj.x+cs[cj.i+1];cs.splice(cj.i+1,1);for(cm=cn+1;cm<ck;++cm){ci[cm].i--}}}ci.splice(cn,1);ck--;cn--}else{cj.x=d3.interpolateNumber(parseFloat(cl[0]),parseFloat(cj.x))}}while(cn<ck){cj=ci.pop();if(cs[cj.i+1]==null){cs[cj.i]=cj.x}else{cs[cj.i]=cj.x+cs[cj.i+1];cs.splice(cj.i+1,1)}ck--}if(cs.length===1){return cs[0]==null?ci[0].x:function(){return co}}return function(ct){for(cn=0;cn<ck;++cn){cs[(cj=ci[cn]).i]=cj.x(ct)}return cs.join("")}};d3.interpolateRgb=function(cj,ci){cj=d3.rgb(cj);ci=d3.rgb(ci);var cl=cj.r,ck=cj.g,co=cj.b,cn=ci.r-cl,cm=ci.g-ck,cp=ci.b-co;return function(cq){return"rgb("+Math.round(cl+cn*cq)+","+Math.round(ck+cm*cq)+","+Math.round(co+cp*cq)+")"}};d3.interpolateHsl=function(ck,ci){ck=d3.hsl(ck);ci=d3.hsl(ci);var cp=ck.h,co=ck.s,cl=ck.l,cn=ci.h-cp,cm=ci.s-co,cj=ci.l-cl;return function(cq){return ca(cp+cn*cq,co+cm*cq,cl+cj*cq).toString()}};d3.interpolateArray=function(cm,ck){var cj=[],cp=[],cl=cm.length,ci=ck.length,co=Math.min(cm.length,ck.length),cn;for(cn=0;cn<co;++cn){cj.push(d3.interpolate(cm[cn],ck[cn]))}for(;cn<cl;++cn){cp[cn]=cm[cn]}for(;cn<ci;++cn){cp[cn]=ck[cn]}return function(cq){for(cn=0;cn<co;++cn){cp[cn]=cj[cn](cq)}return cp}};d3.interpolateObject=function(cj,ci){var cl={},cm={},ck;for(ck in cj){if(ck in ci){cl[ck]=al(ck)(cj[ck],ci[ck])}else{cm[ck]=cj[ck]}}for(ck in ci){if(!(ck in cj)){cm[ck]=ci[ck]}}return function(cn){for(ck in cl){cm[ck]=cl[ck](cn)}return cm}};var p=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,bQ={background:1,fill:1,stroke:1};function al(ci){return ci in bQ||/\bcolor\b/.test(ci)?d3.interpolateRgb:d3.interpolate}d3.interpolators=[d3.interpolateObject,function(cj,ci){return(ci instanceof Array)&&d3.interpolateArray(cj,ci)},function(cj,ci){return(typeof ci==="string")&&d3.interpolateString(String(cj),ci)},function(cj,ci){return(typeof ci==="string"?ci in aX||/^(#|rgb\(|hsl\()/.test(ci):ci instanceof bp||ci instanceof bC)&&d3.interpolateRgb(String(cj),ci)},function(cj,ci){return(typeof ci==="number")&&d3.interpolateNumber(+cj,ci)}];function Q(cj,ci){ci=ci-(cj=+cj)?1/(ci-cj):0;return function(ck){return(ck-cj)*ci}}function ah(cj,ci){ci=ci-(cj=+cj)?1/(ci-cj):0;return function(ck){return Math.max(0,Math.min(1,(ck-cj)*ci))}}d3.rgb=function(ck,cj,ci){return arguments.length===1?af(""+ck,aD,ca):aD(~~ck,~~cj,~~ci)};function aD(ck,cj,ci){return new bp(ck,cj,ci)}function bp(ck,cj,ci){this.r=ck;this.g=cj;this.b=ci}bp.prototype.brighter=function(cj){cj=Math.pow(0.7,arguments.length?cj:1);var cm=this.r,cl=this.g,ci=this.b,ck=30;if(!cm&&!cl&&!ci){return aD(ck,ck,ck)}if(cm&&cm<ck){cm=ck}if(cl&&cl<ck){cl=ck}if(ci&&ci<ck){ci=ck}return aD(Math.min(255,Math.floor(cm/cj)),Math.min(255,Math.floor(cl/cj)),Math.min(255,Math.floor(ci/cj)))};bp.prototype.darker=function(ci){ci=Math.pow(0.7,arguments.length?ci:1);return aD(Math.max(0,Math.floor(ci*this.r)),Math.max(0,Math.floor(ci*this.g)),Math.max(0,Math.floor(ci*this.b)))};bp.prototype.hsl=function(){return a8(this.r,this.g,this.b)};bp.prototype.toString=function(){return"#"+bo(this.r)+bo(this.g)+bo(this.b)};function bo(ci){return ci<16?"0"+ci.toString(16):ci.toString(16)}function af(cn,cl,co){var ci=0,ck=0,cm=0,cq,cp,cj;cq=/([a-z]+)\((.*)\)/i.exec(cn);if(cq){cp=cq[2].split(",");switch(cq[1]){case"hsl":return co(parseFloat(cp[0]),parseFloat(cp[1])/100,parseFloat(cp[2])/100);case"rgb":return cl(aG(cp[0]),aG(cp[1]),aG(cp[2]))}}if(cj=aX[cn]){return cl(cj.r,cj.g,cj.b)}if(cn!=null&&cn.charAt(0)==="#"){if(cn.length===4){ci=cn.charAt(1);ci+=ci;ck=cn.charAt(2);ck+=ck;cm=cn.charAt(3);cm+=cm}else{if(cn.length===7){ci=cn.substring(1,3);ck=cn.substring(3,5);cm=cn.substring(5,7)}}ci=parseInt(ci,16);ck=parseInt(ck,16);cm=parseInt(cm,16)}return cl(ci,ck,cm)}function a8(ci,cm,co){var ck=Math.min(ci/=255,cm/=255,co/=255),cp=Math.max(ci,cm,co),cn=cp-ck,cl,cq,cj=(cp+ck)/2;if(cn){cq=cj<0.5?cn/(cp+ck):cn/(2-cp-ck);if(ci==cp){cl=(cm-co)/cn+(cm<co?6:0)}else{if(cm==cp){cl=(co-ci)/cn+2}else{cl=(ci-cm)/cn+4}}cl*=60}else{cq=cl=0}return aT(cl,cq,cj)}function aG(cj){var ci=parseFloat(cj);return cj.charAt(cj.length-1)==="%"?Math.round(ci*2.55):ci}var aX={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var ba in aX){aX[ba]=af(aX[ba],aD,ca)}d3.hsl=function(ck,cj,ci){return arguments.length===1?af(""+ck,a8,aT):aT(+ck,+cj,+ci)};function aT(ck,cj,ci){return new bC(ck,cj,ci)}function bC(ck,cj,ci){this.h=ck;this.s=cj;this.l=ci}bC.prototype.brighter=function(ci){ci=Math.pow(0.7,arguments.length?ci:1);return aT(this.h,this.s,this.l/ci)};bC.prototype.darker=function(ci){ci=Math.pow(0.7,arguments.length?ci:1);return aT(this.h,this.s,ci*this.l)};bC.prototype.rgb=function(){return ca(this.h,this.s,this.l)};bC.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"};function ca(cn,cm,ci){var cl,ck;cn=cn%360;if(cn<0){cn+=360}cm=cm<0?0:cm>1?1:cm;ci=ci<0?0:ci>1?1:ci;ck=ci<=0.5?ci*(1+cm):ci+cm-ci*cm;cl=2*ci-ck;function cj(cp){if(cp>360){cp-=360}else{if(cp<0){cp+=360}}if(cp<60){return cl+(ck-cl)*cp/60}if(cp<180){return ck}if(cp<240){return cl+(ck-cl)*(240-cp)/60}return cl}function co(cp){return Math.round(cj(cp)*255)}return aD(co(cn+120),co(cn),co(cn-120))}function g(ci){a2(ci,az);return ci}var bh=function(ci,cj){return cj.querySelector(ci)},br=function(ci,cj){return cj.querySelectorAll(ci)};if(typeof Sizzle==="function"){bh=function(ci,cj){return Sizzle(ci,cj)[0]};br=function(ci,cj){return Sizzle.uniqueSort(Sizzle(ci,cj))}}var az=[];d3.selection=function(){return bg};d3.selection.prototype=az;az.select=function(cn){var ck=[],cr,ci,cq,cl;if(typeof cn!=="function"){cn=aK(cn)}for(var co=-1,cm=this.length;++co<cm;){ck.push(cr=[]);cr.parentNode=(cq=this[co]).parentNode;for(var cp=-1,cj=cq.length;++cp<cj;){if(cl=cq[cp]){cr.push(ci=cn.call(cl,cl.__data__,cp));if(ci&&"__data__" in cl){ci.__data__=cl.__data__}}else{cr.push(null)}}}return g(ck)};function aK(ci){return function(){return bh(ci,this)}}az.selectAll=function(cm){var cj=[],cq,ck;if(typeof cm!=="function"){cm=D(cm)}for(var cn=-1,cl=this.length;++cn<cl;){for(var cp=this[cn],co=-1,ci=cp.length;++co<ci;){if(ck=cp[co]){cj.push(cq=cm.call(ck,ck.__data__,co));cq.parentNode=ck}}}return g(cj)};function D(ci){return function(){return br(ci,this)}}az.attr=function(cj,cp){cj=d3.ns.qualify(cj);if(arguments.length<2){var cn=this.node();return cj.local?cn.getAttributeNS(cj.space,cj.local):cn.getAttribute(cj)}function ck(){this.removeAttribute(cj)}function cm(){this.removeAttributeNS(cj.space,cj.local)}function cq(){this.setAttribute(cj,cp)}function cl(){this.setAttributeNS(cj.space,cj.local,cp)}function co(){var cr=cp.apply(this,arguments);if(cr==null){this.removeAttribute(cj)}else{this.setAttribute(cj,cr)}}function ci(){var cr=cp.apply(this,arguments);if(cr==null){this.removeAttributeNS(cj.space,cj.local)}else{this.setAttributeNS(cj.space,cj.local,cr)}}return this.each(cp==null?(cj.local?cm:ck):(typeof cp==="function"?(cj.local?ci:co):(cj.local?cl:cq)))};az.classed=function(ci,cm){var cj=new RegExp("(^|\\s+)"+d3.requote(ci)+"(\\s+|$)","g");if(arguments.length<2){var cl=this.node();if(cp=cl.classList){return cp.contains(ci)}var cp=cl.className;cj.lastIndex=0;return cj.test(cp.baseVal!=null?cp.baseVal:cp)}function co(){if(cs=this.classList){return cs.add(ci)}var cs=this.className,cq=cs.baseVal!=null,cr=cq?cs.baseVal:cs;cj.lastIndex=0;if(!cj.test(cr)){cr=bS(cr+" "+ci);if(cq){cs.baseVal=cr}else{this.className=cr}}}function cn(){if(cs=this.classList){return cs.remove(ci)}var cs=this.className,cq=cs.baseVal!=null,cr=cq?cs.baseVal:cs;cr=bS(cr.replace(cj," "));if(cq){cs.baseVal=cr}else{this.className=cr}}function ck(){(cm.apply(this,arguments)?co:cn).call(this)}return this.each(typeof cm==="function"?ck:cm?co:cn)};az.style=function(ck,cn,cl){if(arguments.length<3){cl=""}if(arguments.length<2){return window.getComputedStyle(this.node(),null).getPropertyValue(ck)}function cj(){this.style.removeProperty(ck)}function cm(){this.style.setProperty(ck,cn,cl)}function ci(){var co=cn.apply(this,arguments);if(co==null){this.style.removeProperty(ck)}else{this.style.setProperty(ck,co,cl)}}return this.each(cn==null?cj:(typeof cn==="function"?ci:cm))};az.property=function(cj,cl){if(arguments.length<2){return this.node()[cj]}function ci(){delete this[cj]}function ck(){this[cj]=cl}function cm(){var cn=cl.apply(this,arguments);if(cn==null){delete this[cj]}else{this[cj]=cn}}return this.each(cl==null?ci:(typeof cl==="function"?cm:ck))};az.text=function(ci){return arguments.length<1?this.node().textContent:(this.each(typeof ci==="function"?function(){this.textContent=ci.apply(this,arguments)}:function(){this.textContent=ci}))};az.html=function(ci){return arguments.length<1?this.node().innerHTML:(this.each(typeof ci==="function"?function(){this.innerHTML=ci.apply(this,arguments)}:function(){this.innerHTML=ci}))};az.append=function(cj){cj=d3.ns.qualify(cj);function ci(){return this.appendChild(document.createElement(cj))}function ck(){return this.appendChild(document.createElementNS(cj.space,cj.local))}return this.select(cj.local?ck:ci)};az.insert=function(ci,ck){ci=d3.ns.qualify(ci);function cj(){return this.insertBefore(document.createElement(ci),bh(ck,this))}function cl(){return this.insertBefore(document.createElementNS(ci.space,ci.local),bh(ck,this))}return this.select(ci.local?cl:cj)};az.remove=function(){return this.each(function(){var ci=this.parentNode;if(ci){ci.removeChild(this)}})};az.data=function(cm,ci){var cp=[],cl=[],cj=[];function co(cF,cw){var cy,ct=cF.length,cv=cw.length,cC=Math.min(ct,cv),cB=Math.max(ct,cv),cH=[],cE=[],cA=[],cu,cs;if(ci){var cz={},cG=[],cD,cx=cw.length;for(cy=-1;++cy<ct;){cD=ci.call(cu=cF[cy],cu.__data__,cy);if(cD in cz){cA[cx++]=cu}else{cz[cD]=cu}cG.push(cD)}for(cy=-1;++cy<cv;){cu=cz[cD=ci.call(cw,cs=cw[cy],cy)];if(cu){cu.__data__=cs;cH[cy]=cu;cE[cy]=cA[cy]=null}else{cE[cy]=y(cs);cH[cy]=cA[cy]=null}delete cz[cD]}for(cy=-1;++cy<ct;){if(cG[cy] in cz){cA[cy]=cF[cy]}}}else{for(cy=-1;++cy<cC;){cu=cF[cy];cs=cw[cy];if(cu){cu.__data__=cs;cH[cy]=cu;cE[cy]=cA[cy]=null}else{cE[cy]=y(cs);cH[cy]=cA[cy]=null}}for(;cy<cv;++cy){cE[cy]=y(cw[cy]);cH[cy]=cA[cy]=null}for(;cy<cB;++cy){cA[cy]=cF[cy];cE[cy]=cH[cy]=null}}cE.update=cH;cE.parentNode=cH.parentNode=cA.parentNode=cF.parentNode;cp.push(cE);cl.push(cH);cj.push(cA)}var cn=-1,ck=this.length,cr;if(typeof cm==="function"){while(++cn<ck){co(cr=this[cn],cm.call(cr,cr.parentNode.__data__,cn))}}else{while(++cn<ck){co(cr=this[cn],cm)}}var cq=g(cl);cq.enter=function(){return by(cp)};cq.exit=function(){return g(cj)};return cq};function y(ci){return{__data__:ci}}function by(ci){a2(ci,bv);return ci}var bv=[];bv.append=az.append;bv.insert=az.insert;bv.empty=az.empty;bv.select=function(cn){var ck=[],cs,ci,cq,cr,cm;for(var co=-1,cl=this.length;++co<cl;){cq=(cr=this[co]).update;ck.push(cs=[]);cs.parentNode=cr.parentNode;for(var cp=-1,cj=cr.length;++cp<cj;){if(cm=cr[cp]){cs.push(cq[cp]=ci=cn.call(cr.parentNode,cm.__data__,cp));ci.__data__=cm.__data__}else{cs.push(null)}}}return g(ck)};az.filter=function(ci){var ck=[],cq,cp,cl;for(var cn=0,cm=this.length;cn<cm;cn++){ck.push(cq=[]);cq.parentNode=(cp=this[cn]).parentNode;for(var co=0,cj=cp.length;co<cj;co++){if((cl=cp[co])&&ci.call(cl,cl.__data__,co)){cq.push(cl)}}}return g(ck)};az.map=function(ci){return this.each(function(){this.__data__=ci.apply(this,arguments)})};az.sort=function(cj){cj=h.apply(this,arguments);for(var ck=0,ci=this.length;ck<ci;ck++){for(var co=this[ck].sort(cj),cl=1,cp=co.length,cn=co[0];cl<cp;cl++){var cm=co[cl];if(cm){if(cn){cn.parentNode.insertBefore(cm,cn.nextSibling)}cn=cm}}}return this};function h(ci){if(!arguments.length){ci=d3.ascending}return function(ck,cj){return ci(ck&&ck.__data__,cj&&cj.__data__)}}az.on=function(cl,cm,ci){if(arguments.length<3){ci=false}var cj="__on"+cl,ck=cl.indexOf(".");if(ck>0){cl=cl.substring(0,ck)}if(arguments.length<2){return(ck=this.node()[cj])&&ck._}return this.each(function(cq,co){var cp=this;if(cp[cj]){cp.removeEventListener(cl,cp[cj],ci)}if(cm){cp.addEventListener(cl,cp[cj]=cn,ci)}function cn(cr){var cs=d3.event;d3.event=cr;try{cm.call(cp,cp.__data__,co)}finally{d3.event=cs}}cn._=cm})};az.each=function(co){for(var cj=-1,ci=this.length;++cj<ci;){for(var cm=this[cj],ck=-1,cn=cm.length;++ck<cn;){var cl=cm[ck];if(cl){co.call(cl,cl.__data__,ck,cj)}}}return this};az.call=function(ci){ci.apply(this,(arguments[0]=this,arguments));return this};az.empty=function(){return !this.node()};az.node=function(co){for(var cj=0,ci=this.length;cj<ci;cj++){for(var cm=this[cj],ck=0,cn=cm.length;ck<cn;ck++){var cl=cm[ck];if(cl){return cl}}}return null};az.transition=function(){var cj=[],ck,cn;for(var cl=-1,ci=this.length;++cl<ci;){cj.push(ck=[]);for(var co=this[cl],cm=-1,cp=co.length;++cm<cp;){ck.push((cn=co[cm])?{node:cn,delay:0,duration:250}:null)}}return bI(cj,b3||++S)};var bg=g([[document]]);bg[0].parentNode=document.documentElement;d3.select=function(ci){return typeof ci==="string"?bg.select(ci):g([[ci]])};d3.selectAll=function(ci){return typeof ci==="string"?bg.selectAll(ci):g([ci])};function bI(ci,cn){a2(ci,bn);var ck={},cj=d3.dispatch("start","end"),cm=ak,cl=Date.now();ci.id=cn;ci.tween=function(co,cp){if(arguments.length<2){return ck[co]}if(cp==null){delete ck[co]}else{ck[co]=cp}return ci};ci.ease=function(co){if(!arguments.length){return cm}cm=typeof co==="function"?co:d3.ease.apply(d3,arguments);return ci};ci.each=function(co,cp){if(arguments.length<2){return T.call(ci,co)}cj[co].add(cp);return ci};d3.timer(function(co){ci.each(function(cw,ct,cs){var cy=[],cq=this,cu=ci[cs][ct].delay,cr=ci[cs][ct].duration,cz=cq.__transition__||(cq.__transition__={active:0,count:0});++cz.count;cu<=co?cp(co):d3.timer(cp,cu,cl);function cp(cA){if(cz.active>cn){return cx()}cz.active=cn;for(var cB in ck){if(cB=ck[cB].call(cq,cw,ct)){cy.push(cB)}}cj.start.dispatch.call(cq,cw,ct);if(!cv(cA)){d3.timer(cv,0,cl)}return 1}function cv(cA){if(cz.active!==cn){return cx()}var cB=(cA-cu)/cr,cC=cm(cB),cD=cy.length;while(cD>0){cy[--cD].call(cq,cC)}if(cB>=1){cx();b3=cn;cj.end.dispatch.call(cq,cw,ct);b3=0;return 1}}function cx(){if(!--cz.count){delete cq.__transition__}return 1}});return 1},0,cl);return ci}function ch(ci){return typeof ci==="function"?function(cm,cl,cj){var ck=ci.call(this,cm,cl)+"";return cj!=ck&&d3.interpolate(cj,ck)}:(ci=ci+"",function(cl,ck,cj){return cj!=ci&&d3.interpolate(cj,ci)})}var bn=[],S=0,b3=0,ak=d3.ease("cubic-in-out");bn.call=az.call;d3.transition=function(){return bg.transition()};d3.transition.prototype=bn;bn.select=function(cn){var ck=[],cr,ci,cl;if(typeof cn!=="function"){cn=aK(cn)}for(var co=-1,cm=this.length;++co<cm;){ck.push(cr=[]);for(var cq=this[co],cp=-1,cj=cq.length;++cp<cj;){if((cl=cq[cp])&&(ci=cn.call(cl.node,cl.node.__data__,cp))){if("__data__" in cl.node){ci.__data__=cl.node.__data__}cr.push({node:ci,delay:cl.delay,duration:cl.duration})}else{cr.push(null)}}}return bI(ck,this.id).ease(this.ease())};bn.selectAll=function(cn){var ck=[],cs,cl;if(typeof cn!=="function"){cn=D(cn)}for(var cp=-1,cm=this.length;++cp<cm;){for(var cr=this[cp],cq=-1,cj=cr.length;++cq<cj;){if(cl=cr[cq]){ck.push(cs=cn.call(cl.node,cl.node.__data__,cq));for(var co=-1,ci=cs.length;++co<ci;){cs[co]={node:cs[co],delay:cl.delay,duration:cl.duration}}}}}return bI(ck,this.id).ease(this.ease())};bn.attr=function(ci,cj){return this.attrTween(ci,ch(cj))};bn.attrTween=function(ci,cj){ci=d3.ns.qualify(ci);function ck(co,cm){var cn=cj.call(this,co,cm,this.getAttribute(ci));return cn&&function(cp){this.setAttribute(ci,cn(cp))}}function cl(co,cm){var cn=cj.call(this,co,cm,this.getAttributeNS(ci.space,ci.local));return cn&&function(cp){this.setAttributeNS(ci.space,ci.local,cn(cp))}}return this.tween("attr."+ci,ci.local?cl:ck)};bn.style=function(ci,ck,cj){if(arguments.length<3){cj=""}return this.styleTween(ci,ch(ck),cj)};bn.styleTween=function(ci,ck,cj){if(arguments.length<3){cj=""}return this.tween("style."+ci,function(cn,cl){var cm=ck.call(this,cn,cl,window.getComputedStyle(this,null).getPropertyValue(ci));return cm&&function(co){this.style.setProperty(ci,cm(co),cj)}})};bn.text=function(ci){return this.tween("text",function(ck,cj){this.textContent=typeof ci==="function"?ci.call(this,ck,cj):ci})};bn.remove=function(){return this.each("end",function(){var ci;if(!this.__transition__&&(ci=this.parentNode)){ci.removeChild(this)}})};bn.delay=function(cj){var ci=this;return ci.each(typeof cj==="function"?function(cm,cl,ck){ci[ck][cl].delay=+cj.apply(this,arguments)}:(cj=+cj,function(cm,cl,ck){ci[ck][cl].delay=cj}))};bn.duration=function(cj){var ci=this;return ci.each(typeof cj==="function"?function(cm,cl,ck){ci[ck][cl].duration=+cj.apply(this,arguments)}:(cj=+cj,function(cm,cl,ck){ci[ck][cl].duration=cj}))};function T(co){for(var cj=0,ci=this.length;cj<ci;cj++){for(var cm=this[cj],ck=0,cn=cm.length;ck<cn;ck++){var cl=cm[ck];if(cl){co.call(cl=cl.node,cl.__data__,ck,cj)}}}return this}bn.transition=function(){return this.select(a0)};var bH=null,I,X;d3.timer=function(cn,ci,cm){var cl=false,ck,cj=bH;if(arguments.length<3){if(arguments.length<2){ci=0}else{if(!isFinite(ci)){return}}cm=Date.now()}while(cj){if(cj.callback===cn){cj.then=cm;cj.delay=ci;cl=true;break}ck=cj;cj=cj.next}if(!cl){bH={callback:cn,then:cm,delay:ci,next:bH}}if(!I){X=clearTimeout(X);I=1;b5(aa)}};function aa(){var ci,ck=Date.now(),cl=bH;while(cl){ci=ck-cl.then;if(ci>=cl.delay){cl.flush=cl.callback(ci)}cl=cl.next}var cj=b8()-ck;if(cj>24){if(isFinite(cj)){clearTimeout(X);X=setTimeout(aa,cj)}I=0}else{I=1;b5(aa)}}d3.timer.flush=function(){var ci,cj=Date.now(),ck=bH;while(ck){ci=cj-ck.then;if(!ck.delay){ck.flush=ck.callback(ci)}ck=ck.next}b8()};function b8(){var cj=null,ci=bH,ck=Infinity;while(ci){if(ci.flush){ci=cj?cj.next=ci.next:bH=ci.next}else{ck=Math.min(ck,ci.then+ci.delay);ci=(cj=ci).next}}return ck}var b5=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(ci){setTimeout(ci,17)};function F(){}d3.scale={};function ae(cj){var ck=cj[0],ci=cj[cj.length-1];return ck<ci?[ck,ci]:[ci,ck]}function bO(co,cm){var cn=0,cl=co.length-1,ck=co[cn],cj=co[cl],ci;if(cj<ck){ci=cn;cn=cl;cl=ci;ci=ck;ck=cj;cj=ci}cm=cm(cj-ck);co[cn]=cm.floor(ck);co[cl]=cm.ceil(cj);return co}function f(){return Math}d3.scale.linear=function(){return au([0,1],[0,1],d3.interpolate,false)};function au(cn,cl,cm,cp){var ck,cj;function ci(){var cq=cn.length==2?cf:v,cr=cp?ah:Q;ck=cq(cn,cl,cr,cm);cj=cq(cl,cn,cr,d3.interpolate);return co}function co(cq){return ck(cq)}co.invert=function(cq){return cj(cq)};co.domain=function(cq){if(!arguments.length){return cn}cn=cq.map(Number);return ci()};co.range=function(cq){if(!arguments.length){return cl}cl=cq;return ci()};co.rangeRound=function(cq){return co.range(cq).interpolate(d3.interpolateRound)};co.clamp=function(cq){if(!arguments.length){return cp}cp=cq;return ci()};co.interpolate=function(cq){if(!arguments.length){return cm}cm=cq;return ci()};co.ticks=function(cq){return K(cn,cq)};co.tickFormat=function(cq){return a(cn,cq)};co.nice=function(){bO(cn,ao);return ci()};co.copy=function(){return au(cn,cl,cm,cp)};return ci()}function bN(cj,ci){cj.range=d3.rebind(cj,ci.range);cj.rangeRound=d3.rebind(cj,ci.rangeRound);cj.interpolate=d3.rebind(cj,ci.interpolate);cj.clamp=d3.rebind(cj,ci.clamp);return cj}function ao(ci){ci=Math.pow(10,Math.round(Math.log(ci)/Math.LN10)-1);return{floor:function(cj){return Math.floor(cj/ci)*ci},ceil:function(cj){return Math.ceil(cj/ci)*ci}}}function V(cn,ci){var ck=ae(cn),cj=ck[1]-ck[0],cm=Math.pow(10,Math.floor(Math.log(cj/ci)/Math.LN10)),cl=ci/cj*cm;if(cl<=0.15){cm*=10}else{if(cl<=0.35){cm*=5}else{if(cl<=0.75){cm*=2}}}ck[0]=Math.ceil(ck[0]/cm)*cm;ck[1]=Math.floor(ck[1]/cm)*cm+cm*0.5;ck[2]=cm;return ck}function K(cj,ci){return d3.range.apply(d3,V(cj,ci))}function a(cj,ci){return d3.format(",."+Math.max(0,-Math.floor(Math.log(V(cj,ci)[2])/Math.LN10+0.01))+"f")}function cf(cm,ci,cn,ck){var cj=cn(cm[0],cm[1]),cl=ck(ci[0],ci[1]);return function(co){return cl(cj(co))}}function v(cn,ci,cp,cl){var ck=[],cm=[],cj=0,co=cn.length;while(++cj<co){ck.push(cp(cn[cj-1],cn[cj]));cm.push(cl(ci[cj-1],ci[cj]))}return function(cq){var cr=d3.bisect(cn,cq,1,cn.length-1)-1;return cm[cr](ck[cr](cq))}}d3.scale.log=function(){return b1(d3.scale.linear(),cb)};function b1(ci,cj){var ck=cj.pow;function cl(cm){return ci(cj(cm))}cl.invert=function(cm){return ck(ci.invert(cm))};cl.domain=function(cm){if(!arguments.length){return ci.domain().map(ck)}cj=cm[0]<0?cc:cb;ck=cj.pow;ci.domain(cm.map(cj));return cl};cl.nice=function(){ci.domain(bO(ci.domain(),f));return cl};cl.ticks=function(){var cr=ae(ci.domain()),cs=[];if(cr.every(isFinite)){var cq=Math.floor(cr[0]),cp=Math.ceil(cr[1]),co=ck(cr[0]),cn=ck(cr[1]);if(cj===cc){cs.push(ck(cq));for(;cq++<cp;){for(var cm=9;cm>0;cm--){cs.push(ck(cq)*cm)}}}else{for(;cq<cp;cq++){for(var cm=1;cm<10;cm++){cs.push(ck(cq)*cm)}}cs.push(ck(cq))}for(cq=0;cs[cq]<co;cq++){}for(cp=cs.length;cs[cp-1]>cn;cp--){}cs=cs.slice(cq,cp)}return cs};cl.tickFormat=function(){return w};cl.copy=function(){return b1(ci.copy(),cj)};return bN(cl,ci)}function cb(ci){return Math.log(ci)/Math.LN10}function cc(ci){return -Math.log(-ci)/Math.LN10}cb.pow=function(ci){return Math.pow(10,ci)};cc.pow=function(ci){return -Math.pow(10,-ci)};function w(ci){return ci.toPrecision(1)}d3.scale.pow=function(){return bJ(d3.scale.linear(),1)};function bJ(ci,ck){var cj=H(ck),cl=H(1/ck);function cm(cn){return ci(cj(cn))}cm.invert=function(cn){return cl(ci.invert(cn))};cm.domain=function(cn){if(!arguments.length){return ci.domain().map(cl)}ci.domain(cn.map(cj));return cm};cm.ticks=function(cn){return K(cm.domain(),cn)};cm.tickFormat=function(cn){return a(cm.domain(),cn)};cm.nice=function(){return cm.domain(bO(cm.domain(),ao))};cm.exponent=function(cn){if(!arguments.length){return ck}var co=cm.domain();cj=H(ck=cn);cl=H(1/ck);return cm.domain(co)};cm.copy=function(){return bJ(ci.copy(),ck)};return bN(cm,ci)}function H(ci){return function(cj){return cj<0?-Math.pow(-cj,ci):Math.pow(cj,ci)}}d3.scale.sqrt=function(){return d3.scale.pow().exponent(0.5)};d3.scale.ordinal=function(){return r([],{t:"range",x:[]})};function r(cm,cj){var cl,ci,ck;function cn(co){return ci[((cl[co]||(cl[co]=cm.push(co)))-1)%ci.length]}cn.domain=function(co){if(!arguments.length){return cm}cm=[];cl={};var cq=-1,cr=co.length,cp;while(++cq<cr){if(!cl[cp=co[cq]]){cl[cp]=cm.push(cp)}}return cn[cj.t](cj.x,cj.p)};cn.range=function(co){if(!arguments.length){return ci}ci=co;ck=0;cj={t:"range",x:co};return cn};cn.rangePoints=function(co,cr){if(arguments.length<2){cr=0}var cs=co[0],cp=co[1],cq=(cp-cs)/(cm.length-1+cr);ci=cm.length<2?[(cs+cp)/2]:d3.range(cs+cq*cr/2,cp+cq/2,cq);ck=0;cj={t:"rangePoints",x:co,p:cr};return cn};cn.rangeBands=function(co,cr){if(arguments.length<2){cr=0}var cs=co[0],cp=co[1],cq=(cp-cs)/(cm.length+cr);ci=d3.range(cs+cq*cr,cp,cq);ck=cq*(1-cr);cj={t:"rangeBands",x:co,p:cr};return cn};cn.rangeRoundBands=function(co,cs){if(arguments.length<2){cs=0}var ct=co[0],cp=co[1],cr=Math.floor((cp-ct)/(cm.length+cs)),cq=cp-ct-(cm.length-cs)*cr;ci=d3.range(ct+Math.round(cq/2),cp,cr);ck=Math.round(cr*(1-cs));cj={t:"rangeRoundBands",x:co,p:cs};return cn};cn.rangeBand=function(){return ck};cn.copy=function(){return r(cm,cj)};return cn.domain(cm)}d3.scale.category10=function(){return d3.scale.ordinal().range(ay)};d3.scale.category20=function(){return d3.scale.ordinal().range(Y)};d3.scale.category20b=function(){return d3.scale.ordinal().range(a6)};d3.scale.category20c=function(){return d3.scale.ordinal().range(a5)};var ay=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];var Y=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"];var a6=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"];var a5=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return aH([],[])};function aH(ck,cj){var cl;function ci(){var cn=0,cp=ck.length,co=cj.length;cl=[];while(++cn<co){cl[cn-1]=d3.quantile(ck,cn/co)}return cm}function cm(cn){if(isNaN(cn=+cn)){return NaN}return cj[d3.bisect(cl,cn)]}cm.domain=function(cn){if(!arguments.length){return ck}ck=cn.filter(function(co){return !isNaN(co)}).sort(d3.ascending);return ci()};cm.range=function(cn){if(!arguments.length){return cj}cj=cn;return ci()};cm.quantiles=function(){return cl};cm.copy=function(){return aH(ck,cj)};return ci()}d3.scale.quantize=function(){return ab(0,1,[0,1])};function ab(cm,ck,cj){var cn,cl;function co(cp){return cj[Math.max(0,Math.min(cl,Math.floor(cn*(cp-cm))))]}function ci(){cn=cj.length/(ck-cm);cl=cj.length-1;return co}co.domain=function(cp){if(!arguments.length){return[cm,ck]}cm=+cp[0];ck=+cp[cp.length-1];return ci()};co.range=function(cp){if(!arguments.length){return cj}cj=cp;return ci()};co.copy=function(){return ab(cm,ck,cj)};return ci()}d3.svg={};d3.svg.arc=function(){var cm=B,cl=J,ck=aL,ci=bB;function cj(){var cq=cm.apply(this,arguments),cp=cl.apply(this,arguments),co=ck.apply(this,arguments)+aB,cn=ci.apply(this,arguments)+aB,cw=(cn<co&&(cw=co,co=cn,cn=cw),cn-co),ct=cw<Math.PI?"0":"1",cs=Math.cos(co),cv=Math.sin(co),cr=Math.cos(cn),cu=Math.sin(cn);return cw>=bq?(cq?"M0,"+cp+"A"+cp+","+cp+" 0 1,1 0,"+(-cp)+"A"+cp+","+cp+" 0 1,1 0,"+cp+"M0,"+cq+"A"+cq+","+cq+" 0 1,0 0,"+(-cq)+"A"+cq+","+cq+" 0 1,0 0,"+cq+"Z":"M0,"+cp+"A"+cp+","+cp+" 0 1,1 0,"+(-cp)+"A"+cp+","+cp+" 0 1,1 0,"+cp+"Z"):(cq?"M"+cp*cs+","+cp*cv+"A"+cp+","+cp+" 0 "+ct+",1 "+cp*cr+","+cp*cu+"L"+cq*cr+","+cq*cu+"A"+cq+","+cq+" 0 "+ct+",0 "+cq*cs+","+cq*cv+"Z":"M"+cp*cs+","+cp*cv+"A"+cp+","+cp+" 0 "+ct+",1 "+cp*cr+","+cp*cu+"L0,0Z")}cj.innerRadius=function(cn){if(!arguments.length){return cm}cm=d3.functor(cn);return cj};cj.outerRadius=function(cn){if(!arguments.length){return cl}cl=d3.functor(cn);return cj};cj.startAngle=function(cn){if(!arguments.length){return ck}ck=d3.functor(cn);return cj};cj.endAngle=function(cn){if(!arguments.length){return ci}ci=d3.functor(cn);return cj};cj.centroid=function(){var co=(cm.apply(this,arguments)+cl.apply(this,arguments))/2,cn=(ck.apply(this,arguments)+ci.apply(this,arguments))/2+aB;return[Math.cos(cn)*co,Math.sin(cn)*co]};return cj};var aB=-Math.PI/2,bq=2*Math.PI-0.000001;function B(ci){return ci.innerRadius}function J(ci){return ci.outerRadius}function aL(ci){return ci.startAngle}function bB(ci){return ci.endAngle}function P(cj){var ci=u,co=t,cl="linear",cn=bT[cl],cm=0.7;function ck(cp){return cp.length<1?null:"M"+cn(cj(bx(this,cp,ci,co)),cm)}ck.x=function(cp){if(!arguments.length){return ci}ci=cp;return ck};ck.y=function(cp){if(!arguments.length){return co}co=cp;return ck};ck.interpolate=function(cp){if(!arguments.length){return cl}cn=bT[cl=cp];return ck};ck.tension=function(cp){if(!arguments.length){return cm}cm=cp;return ck};return ck}d3.svg.line=function(){return P(Object)};function bx(cr,cm,co,cn){var cq=[],cl=-1,ci=cm.length,ck=typeof co==="function",cj=typeof cn==="function",cp;if(ck&&cj){while(++cl<ci){cq.push([co.call(cr,cp=cm[cl],cl),cn.call(cr,cp,cl)])}}else{if(ck){while(++cl<ci){cq.push([co.call(cr,cm[cl],cl),cn])}}else{if(cj){while(++cl<ci){cq.push([co,cn.call(cr,cm[cl],cl)])}}else{while(++cl<ci){cq.push([co,cn])}}}}return cq}function u(ci){return ci[0]}function t(ci){return ci[1]}var bT={linear:bi,"step-before":ax,"step-after":am,basis:aJ,"basis-open":bY,"basis-closed":b9,bundle:ac,cardinal:bG,"cardinal-open":a4,"cardinal-closed":aA,monotone:E};function bi(cj){var cl=[],ci=0,cm=cj.length,ck=cj[0];cl.push(ck[0],",",ck[1]);while(++ci<cm){cl.push("L",(ck=cj[ci])[0],",",ck[1])}return cl.join("")}function ax(cj){var cl=[],ci=0,cm=cj.length,ck=cj[0];cl.push(ck[0],",",ck[1]);while(++ci<cm){cl.push("V",(ck=cj[ci])[1],"H",ck[0])}return cl.join("")}function am(cj){var cl=[],ci=0,cm=cj.length,ck=cj[0];cl.push(ck[0],",",ck[1]);while(++ci<cm){cl.push("H",(ck=cj[ci])[0],"V",ck[1])}return cl.join("")}function a4(cj,ci){return cj.length<4?bi(cj):cj[1]+ai(cj.slice(1,cj.length-1),bz(cj,ci))}function aA(cj,ci){return cj.length<3?bi(cj):cj[0]+ai((cj.push(cj[0]),cj),bz([cj[cj.length-2]].concat(cj,[cj[1]]),ci))}function bG(ck,cj,ci){return ck.length<3?bi(ck):ck[0]+ai(ck,bz(ck,cj))}function ai(co,cn){if(cn.length<1||(co.length!=cn.length&&co.length!=cn.length+2)){return bi(co)}var cp=co.length!=cn.length,cs="",cq=co[0],ci=co[1],cm=cn[0],cr=cm,ck=1;if(cp){cs+="Q"+(ci[0]-cm[0]*2/3)+","+(ci[1]-cm[1]*2/3)+","+ci[0]+","+ci[1];cq=co[1];ck=2}if(cn.length>1){cr=cn[1];ci=co[ck];ck++;cs+="C"+(cq[0]+cm[0])+","+(cq[1]+cm[1])+","+(ci[0]-cr[0])+","+(ci[1]-cr[1])+","+ci[0]+","+ci[1];for(var cj=2;cj<cn.length;cj++,ck++){ci=co[ck];cr=cn[cj];cs+="S"+(ci[0]-cr[0])+","+(ci[1]-cr[1])+","+ci[0]+","+ci[1]}}if(cp){var cl=co[ck];cs+="Q"+(ci[0]+cr[0]*2/3)+","+(ci[1]+cr[1]*2/3)+","+cl[0]+","+cl[1]}return cs}function bz(co,cm){var ck=[],cl=(1-cm)/2,cq,cp=co[0],cn=co[1],cj=1,ci=co.length;while(++cj<ci){cq=cp;cp=cn;cn=co[cj];ck.push([cl*(cn[0]-cq[0]),cl*(cn[1]-cq[1])])}return ck}function aJ(cp){if(cp.length<3){return bi(cp)}var cq=[],ck=1,cj=cp.length,cl=cp[0],ci=cl[0],cn=cl[1],co=[ci,ci,ci,(cl=cp[1])[0]],cm=[cn,cn,cn,cl[1]];cq.push(ci,",",cn);q(cq,co,cm);while(++ck<cj){cl=cp[ck];co.shift();co.push(cl[0]);cm.shift();cm.push(cl[1]);q(cq,co,cm)}ck=-1;while(++ck<2){co.shift();co.push(cl[0]);cm.shift();cm.push(cl[1]);q(cq,co,cm)}return cq.join("")}function bY(cl){if(cl.length<4){return bi(cl)}var cn=[],ck=-1,co=cl.length,cm,cj=[0],ci=[0];while(++ck<3){cm=cl[ck];cj.push(cm[0]);ci.push(cm[1])}cn.push(A(ap,cj)+","+A(ap,ci));--ck;while(++ck<co){cm=cl[ck];cj.shift();cj.push(cm[0]);ci.shift();ci.push(cm[1]);q(cn,cj,ci)}return cn.join("")}function b9(cm){var co,cl=-1,cp=cm.length,ci=cp+4,cn,ck=[],cj=[];while(++cl<4){cn=cm[cl%cp];ck.push(cn[0]);cj.push(cn[1])}co=[A(ap,ck),",",A(ap,cj)];--cl;while(++cl<ci){cn=cm[cl%cp];ck.shift();ck.push(cn[0]);cj.shift();cj.push(cn[1]);q(co,ck,cj)}return co.join("")}function ac(co,cn){var ck=co.length-1,cj=co[0][0],cm=co[0][1],cr=co[ck][0]-cj,cq=co[ck][1]-cm,cl=-1,ci,cp;while(++cl<=ck){ci=co[cl];cp=cl/ck;ci[0]=cn*ci[0]+(1-cn)*(cj+cp*cr);ci[1]=cn*ci[1]+(1-cn)*(cm+cp*cq)}return aJ(co)}function A(cj,ci){return cj[0]*ci[0]+cj[1]*ci[1]+cj[2]*ci[2]+cj[3]*ci[3]}var ar=[0,2/3,1/3,0],aq=[0,1/3,2/3,0],ap=[0,1/6,2/3,1/6];function q(cj,ci,ck){cj.push("C",A(ar,ci),",",A(ar,ck),",",A(aq,ci),",",A(aq,ck),",",A(ap,ci),",",A(ap,ck))}function a3(cj,ci){return(ci[1]-cj[1])/(ci[0]-cj[0])}function ad(cl){var ck=0,cj=cl.length-1,ci=[],co=cl[0],cn=cl[1],cm=ci[0]=a3(co,cn);while(++ck<cj){ci[ck]=cm+(cm=a3(co=cn,cn=cl[ck+1]))}ci[ck]=cm;return ci}function bD(cp){var cm=[],cl,co,cn,cq,ci=ad(cp),ck=-1,cj=cp.length-1;while(++ck<cj){cl=a3(cp[ck],cp[ck+1]);if(Math.abs(cl)<0.000001){ci[ck]=ci[ck+1]=0}else{co=ci[ck]/cl;cn=ci[ck+1]/cl;cq=co*co+cn*cn;if(cq>9){cq=cl*3/Math.sqrt(cq);ci[ck]=cq*co;ci[ck+1]=cq*cn}}}ck=-1;while(++ck<=cj){cq=(cp[Math.min(cj,ck+1)][0]-cp[Math.max(0,ck-1)][0])/(6*(1+ci[ck]*ci[ck]));cm.push([cq||0,ci[ck]*cq||0])}return cm}function E(ci){return ci.length<3?bi(ci):ci[0]+ai(ci,bD(ci))}d3.svg.line.radial=function(){var ci=P(O);ci.radius=ci.x,delete ci.x;ci.angle=ci.y,delete ci.y;return ci};function O(cl){var ci,ck=-1,cn=cl.length,cm,cj;while(++ck<cn){ci=cl[ck];cm=ci[0];cj=ci[1]+aB;ci[0]=cm*Math.cos(cj);ci[1]=cm*Math.sin(cj)}return cl}function cd(cl){var ck=u,cj=u,cp=0,co=t,cm="linear",cn=bT[cm],cq=0.7;function ci(ct){if(ct.length<1){return null}var cs=bx(this,ct,ck,cp),cr=bx(this,ct,ck===cj?l(cs):cj,cp===co?k(cs):co);return"M"+cn(cl(cr),cq)+"L"+cn(cl(cs.reverse()),cq)+"Z"}ci.x=function(cr){if(!arguments.length){return cj}ck=cj=cr;return ci};ci.x0=function(cr){if(!arguments.length){return ck}ck=cr;return ci};ci.x1=function(cr){if(!arguments.length){return cj}cj=cr;return ci};ci.y=function(cr){if(!arguments.length){return co}cp=co=cr;return ci};ci.y0=function(cr){if(!arguments.length){return cp}cp=cr;return ci};ci.y1=function(cr){if(!arguments.length){return co}co=cr;return ci};ci.interpolate=function(cr){if(!arguments.length){return cm}cn=bT[cm=cr];return ci};ci.tension=function(cr){if(!arguments.length){return cq}cq=cr;return ci};return ci}d3.svg.area=function(){return cd(Object)};function l(ci){return function(ck,cj){return ci[cj][0]}}function k(ci){return function(ck,cj){return ci[cj][1]}}d3.svg.area.radial=function(){var ci=cd(O);ci.radius=ci.x,delete ci.x;ci.innerRadius=ci.x0,delete ci.x0;ci.outerRadius=ci.x1,delete ci.x1;ci.angle=ci.y,delete ci.y;ci.startAngle=ci.y0,delete ci.y0;ci.endAngle=ci.y1,delete ci.y1;return ci};d3.svg.chord=function(){var ci=b4,cp=bX,co=ce,cq=aL,cm=bB;function cn(cv,ct){var cu=cr(this,ci,cv,ct),cs=cr(this,cp,cv,ct);return"M"+cu.p0+cj(cu.r,cu.p1)+(ck(cu,cs)?cl(cu.r,cu.p1,cu.r,cu.p0):cl(cu.r,cu.p1,cs.r,cs.p0)+cj(cs.r,cs.p1)+cl(cs.r,cs.p1,cu.r,cu.p0))+"Z"}function cr(cv,cy,cz,cw){var cu=cy.call(cv,cz,cw),cx=co.call(cv,cu,cw),ct=cq.call(cv,cu,cw)+aB,cs=cm.call(cv,cu,cw)+aB;return{r:cx,a0:ct,a1:cs,p0:[cx*Math.cos(ct),cx*Math.sin(ct)],p1:[cx*Math.cos(cs),cx*Math.sin(cs)]}}function ck(ct,cs){return ct.a0==cs.a0&&ct.a1==cs.a1}function cj(cs,ct){return"A"+cs+","+cs+" 0 0,1 "+ct}function cl(ct,cv,cs,cu){return"Q 0,0 "+cu}cn.radius=function(cs){if(!arguments.length){return co}co=d3.functor(cs);return cn};cn.source=function(cs){if(!arguments.length){return ci}ci=d3.functor(cs);return cn};cn.target=function(cs){if(!arguments.length){return cp}cp=d3.functor(cs);return cn};cn.startAngle=function(cs){if(!arguments.length){return cq}cq=d3.functor(cs);return cn};cn.endAngle=function(cs){if(!arguments.length){return cm}cm=d3.functor(cs);return cn};return cn};function b4(ci){return ci.source}function bX(ci){return ci.target}function ce(ci){return ci.radius}function N(ci){return ci.startAngle}function aI(ci){return ci.endAngle}d3.svg.diagonal=function(){var ck=b4,cl=bX,ci=e;function cj(cq,cn){var cr=ck.call(this,cq,cn),co=cl.call(this,cq,cn),cm=(cr.y+co.y)/2,cp=[cr,{x:cr.x,y:cm},{x:co.x,y:cm},co];cp=cp.map(ci);return"M"+cp[0]+"C"+cp[1]+" "+cp[2]+" "+cp[3]}cj.source=function(cm){if(!arguments.length){return ck}ck=d3.functor(cm);return cj};cj.target=function(cm){if(!arguments.length){return cl}cl=d3.functor(cm);return cj};cj.projection=function(cm){if(!arguments.length){return ci}ci=cm;return cj};return cj};function e(ci){return[ci.x,ci.y]}d3.svg.diagonal.radial=function(){var ck=d3.svg.diagonal(),ci=e,cj=ck.projection;ck.projection=function(cl){return arguments.length?cj(M(ci=cl)):ci};return ck};function M(ci){return function(){var cl=ci.apply(this,arguments),ck=cl[0],cj=cl[1]+aB;return[ck*Math.cos(cj),ck*Math.sin(cj)]}}d3.svg.mouse=function(ci){return cg(ci,d3.event)};var bP=/WebKit/.test(navigator.userAgent)?-1:0;function cg(ck,cm){var ci=(ck.ownerSVGElement||ck).createSVGPoint();if((bP<0)&&(window.scrollX||window.scrollY)){var cl=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0);var cj=cl[0][0].getScreenCTM();bP=!(cj.f||cj.e);cl.remove()}if(bP){ci.x=cm.pageX;ci.y=cm.pageY}else{ci.x=cm.clientX;ci.y=cm.clientY}ci=ci.matrixTransform(ck.getScreenCTM().inverse());return[ci.x,ci.y]}d3.svg.touches=function(ci){var cj=d3.event.touches;return cj?Array.prototype.map.call(cj,function(cl){var ck=cg(ci,cl);ck.identifier=cl.identifier;return ck}):[]};d3.svg.symbol=function(){var cj=aF,ci=aY;function ck(cm,cl){return(bd[cj.call(this,cm,cl)]||bd.circle)(ci.call(this,cm,cl))}ck.type=function(cl){if(!arguments.length){return cj}cj=d3.functor(cl);return ck};ck.size=function(cl){if(!arguments.length){return ci}ci=d3.functor(cl);return ck};return ck};function aY(){return 64}function aF(){return"circle"}var bd={circle:function(ci){var cj=Math.sqrt(ci/Math.PI);return"M0,"+cj+"A"+cj+","+cj+" 0 1,1 0,"+(-cj)+"A"+cj+","+cj+" 0 1,1 0,"+cj+"Z"},cross:function(ci){var cj=Math.sqrt(ci/5)/2;return"M"+-3*cj+","+-cj+"H"+-cj+"V"+-3*cj+"H"+cj+"V"+-cj+"H"+3*cj+"V"+cj+"H"+cj+"V"+3*cj+"H"+-cj+"V"+cj+"H"+-3*cj+"Z"},diamond:function(ci){var cj=Math.sqrt(ci/(2*bV)),ck=cj*bV;return"M0,"+-cj+"L"+ck+",0 0,"+cj+" "+-ck+",0Z"},square:function(ci){var cj=Math.sqrt(ci)/2;return"M"+-cj+","+-cj+"L"+cj+","+-cj+" "+cj+","+cj+" "+-cj+","+cj+"Z"},"triangle-down":function(ci){var ck=Math.sqrt(ci/aj),cj=ck*aj/2;return"M0,"+cj+"L"+ck+","+-cj+" "+-ck+","+-cj+"Z"},"triangle-up":function(ci){var ck=Math.sqrt(ci/aj),cj=ck*aj/2;return"M0,"+-cj+"L"+ck+","+cj+" "+-ck+","+cj+"Z"}};d3.svg.symbolTypes=d3.keys(bd);var aj=Math.sqrt(3),bV=Math.tan(30*Math.PI/180);d3.svg.axis=function(){var cl=d3.scale.linear(),cn="bottom",cm=6,ci=6,cj=6,cr=3,cq=[10],cp,co=0;function ck(cs){cs.each(function(cM,cI,cG){var cK=d3.select(this);var cN=cl.ticks.apply(cl,cq),cD=cp==null?cl.tickFormat.apply(cl,cq):cp;var cx=n(cl,cN,co),cw=cK.selectAll(".minor").data(cx,String),cF=cw.enter().insert("svg:line","g").attr("class","tick minor").style("opacity",0.000001),cE=cL(cw.exit()).style("opacity",0.000001).remove(),cv=cL(cw).style("opacity",1);var cJ=cK.selectAll("g").data(cN,String),cA=cJ.enter().insert("svg:g","path").style("opacity",0.000001),cC=cL(cJ.exit()).style("opacity",0.000001).remove(),cy=cL(cJ).style("opacity",1),ct;var cz=ae(cl.range()),cB=cK.selectAll(".domain").data([0]),cu=cB.enter().append("svg:path").attr("class","domain"),cO=cL(cB);var cH=this.__chart__||cl;this.__chart__=cl.copy();cA.append("svg:line").attr("class","tick");cA.append("svg:text");cy.select("text").text(cD);switch(cn){case"bottom":ct=b0;cv.attr("y2",ci);cA.select("text").attr("dy",".71em").attr("text-anchor","middle");cy.select("line").attr("y2",cm);cy.select("text").attr("y",Math.max(cm,0)+cr);cO.attr("d","M"+cz[0]+","+cj+"V0H"+cz[1]+"V"+cj);break;case"top":ct=b0;cv.attr("y2",-ci);cA.select("text").attr("text-anchor","middle");cy.select("line").attr("y2",-cm);cy.select("text").attr("y",-(Math.max(cm,0)+cr));cO.attr("d","M"+cz[0]+","+-cj+"V0H"+cz[1]+"V"+-cj);break;case"left":ct=bZ;cv.attr("x2",-ci);cA.select("text").attr("dy",".32em").attr("text-anchor","end");cy.select("line").attr("x2",-cm);cy.select("text").attr("x",-(Math.max(cm,0)+cr));cO.attr("d","M"+-cj+","+cz[0]+"H0V"+cz[1]+"H"+-cj);break;case"right":ct=bZ;cv.attr("x2",ci);cA.select("text").attr("dy",".32em");cy.select("line").attr("x2",cm);cy.select("text").attr("x",Math.max(cm,0)+cr);cO.attr("d","M"+cj+","+cz[0]+"H0V"+cz[1]+"H"+cj);break}cA.call(ct,cH);cy.call(ct,cl);cC.call(ct,cl);cF.call(ct,cH);cv.call(ct,cl);cE.call(ct,cl);function cL(cP){return cs.delay?cP.transition().delay(cs[cG][cI].delay).duration(cs[cG][cI].duration).ease(cs.ease()):cP}})}ck.scale=function(cs){if(!arguments.length){return cl}cl=cs;return ck};ck.orient=function(cs){if(!arguments.length){return cn}cn=cs;return ck};ck.ticks=function(){if(!arguments.length){return cq}cq=arguments;return ck};ck.tickFormat=function(cs){if(!arguments.length){return cp}cp=cs;return ck};ck.tickSize=function(cs,cv,ct){if(!arguments.length){return cm}var cu=arguments.length-1;cm=+cs;ci=cu>1?+cv:cm;cj=cu>0?+arguments[cu]:cm;return ck};ck.tickPadding=function(cs){if(!arguments.length){return cr}cr=+cs;return ck};ck.tickSubdivide=function(cs){if(!arguments.length){return co}co=+cs;return ck};return ck};function b0(cj,ci){cj.attr("transform",function(ck){return"translate("+ci(ck)+",0)"})}function bZ(ci,cj){ci.attr("transform",function(ck){return"translate(0,"+cj(ck)+")"})}function n(ck,co,cj){cp=[];if(cj&&co.length>1){var cr=ae(ck.domain()),cp,cm=-1,ci=co.length,cn=(co[1]-co[0])/++cj,cl,cq;while(++cm<ci){for(cl=cj;--cl>0;){if((cq=+co[cm]-cl*cn)>=cr[0]){cp.push(cq)}}}for(--cm,cl=0;++cl<cj&&(cq=+co[cm]+cl*cn)<cr[1];){cp.push(cq)}}return cp}d3.behavior={};d3.behavior.drag=function(){var ck=d3.dispatch("drag","dragstart","dragend");function cj(){this.on("mousedown.drag",ci).on("touchstart.drag",ci);d3.select(window).on("mousemove.drag",C).on("touchmove.drag",C).on("mouseup.drag",aW,true).on("touchend.drag",aW,true).on("click.drag",bA,true)}function cl(){aV=ck;bs=bL((o=this).parentNode);bK=0;aO=arguments}function ci(){cl.apply(this,arguments);be("dragstart")}cj.on=function(cm,cn){ck[cm].add(cn);return cj};return cj};var aV,o,aO,bs,bK,bw;function be(ck){var cm=d3.event,cl=o.parentNode,cj=0,ci=0;if(cl){cl=bL(cl);cj=cl[0]-bs[0];ci=cl[1]-bs[1];bs=cl;bK|=cj|ci}try{d3.event={dx:cj,dy:ci};aV[ck].dispatch.apply(o,aO)}finally{d3.event=cm}cm.preventDefault()}function bL(ci){return d3.event.touches?d3.svg.touches(ci)[0]:d3.svg.mouse(ci)}function C(){if(!o){return}var ci=o.parentNode;if(!ci){return aW()}be("drag");b2()}function aW(){if(!o){return}be("dragend");o=null;if(bK){bw=true;b2()}}function bA(){if(bw){b2();bw=false}}function b2(){d3.event.stopPropagation();d3.event.preventDefault()}d3.behavior.zoom=function(){var cj=[0,0,0],cm=d3.dispatch("zoom");function cl(){this.on("mousedown.zoom",ck).on("mousewheel.zoom",ci).on("DOMMouseScroll.zoom",ci).on("dblclick.zoom",cn).on("touchstart.zoom",co);d3.select(window).on("mousemove.zoom",z).on("mouseup.zoom",bF).on("touchmove.zoom",aN).on("touchend.zoom",bk).on("click.zoom",R,true)}function cp(){L=cj;aU=cm.zoom.dispatch;an=this;bf=arguments}function ck(){cp.apply(this,arguments);a7=bb(d3.svg.mouse(an));ag=false;d3.event.preventDefault();window.focus()}function ci(){cp.apply(this,arguments);if(!aP){aP=bb(d3.svg.mouse(an))}m(a9()+cj[2],d3.svg.mouse(an),aP)}function cn(){cp.apply(this,arguments);var cq=d3.svg.mouse(an);m(d3.event.shiftKey?Math.ceil(cj[2]-1):Math.floor(cj[2]+1),cq,bb(cq))}function co(){cp.apply(this,arguments);var cr=bk(),cs,cq=Date.now();if((cr.length===1)&&(cq-bR<300)){m(1+Math.floor(cj[2]),cs=cr[0],s[cs.identifier])}bR=cq}cl.on=function(cq,cr){cm[cq].add(cr);return cl};return cl};var bt,a7,aP,s={},bR=0,L,aU,an,bf,ag,bU;function bb(ci){return[ci[0]-L[0],ci[1]-L[1],L[2]]}function a9(){if(!bt){bt=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode}var cj=d3.event,ck;try{bt.scrollTop=1000;bt.dispatchEvent(cj);ck=1000-bt.scrollTop}catch(ci){ck=cj.wheelDelta||(-cj.detail*5)}return ck*0.005}function bk(){var cj=d3.svg.touches(an),ci=-1,cl=cj.length,ck;while(++ci<cl){s[(ck=cj[ci]).identifier]=bb(ck)}return cj}function aN(){var cm=d3.svg.touches(an);switch(cm.length){case 1:var cp=cm[0];m(L[2],cp,s[cp.identifier]);break;case 2:var co=cm[0],cn=cm[1],cl=[(co[0]+cn[0])/2,(co[1]+cn[1])/2],ck=s[co.identifier],cj=s[cn.identifier],ci=[(ck[0]+cj[0])/2,(ck[1]+cj[1])/2,ck[2]];m(Math.log(d3.event.scale)/Math.LN2+ck[2],cl,ci);break}}function z(){aP=null;if(a7){ag=true;m(L[2],d3.svg.mouse(an),a7)}}function bF(){if(a7){if(ag){bU=true}z();a7=null}}function R(){if(bU){d3.event.stopPropagation();d3.event.preventDefault();bU=false}}function m(cn,ck,ci){var cp=Math.pow(2,(L[2]=cn)-ci[2]),cq=L[0]=ck[0]-cp*ci[0],co=L[1]=ck[1]-cp*ci[1],cj=d3.event,cm=Math.pow(2,cn);d3.event={scale:cm,translate:[cq,co],transform:function(cs,cr){if(cs){cl(cs,cq)}if(cr){cl(cr,co)}}};function cl(cu,ct){var cs=cu.__domain||(cu.__domain=cu.domain()),cr=cu.range().map(function(cv){return(cv-ct)/cm});cu.domain(cs).domain(cr.map(cu.invert))}try{aU.apply(an,bf)}finally{d3.event=cj}cj.preventDefault()}})();(function(){d3.geom={};d3.geom.contour=function(o,p){var A=p||m(o),u=[],w=A[0],v=A[1],B=0,z=0,r=NaN,q=NaN,t=0;do{t=0;if(o(w-1,v-1)){t+=1}if(o(w,v-1)){t+=2}if(o(w-1,v)){t+=4}if(o(w,v)){t+=8}if(t===6){B=q===-1?-1:1;z=0}else{if(t===9){B=0;z=r===1?-1:1}else{B=e[t];z=c[t]}}if(B!=r&&z!=q){u.push([w,v]);r=B;q=z}w+=B;v+=z}while(A[0]!=w||A[1]!=v);return u};var e=[1,0,1,1,-1,0,-1,1,0,0,0,0,-1,0,-1,NaN],c=[0,-1,0,0,0,-1,0,0,1,-1,1,1,0,-1,0,NaN];function m(p){var o=0,q=0;while(true){if(p(o,q)){return[o,q]}if(o===0){o=q+1;q=0}else{o=o-1;q=q+1}}}d3.geom.hull=function(A){if(A.length<3){return[]}var z=A.length,s=z-1,G=[],C=[],w,t,y=0,r,E,p,B,H,F,D,q;for(w=1;w<z;++w){if(A[w][1]<A[y][1]){y=w}else{if(A[w][1]==A[y][1]){y=(A[w][0]<A[y][0]?w:y)}}}for(w=0;w<z;++w){if(w===y){continue}E=A[w][1]-A[y][1];r=A[w][0]-A[y][0];G.push({angle:Math.atan2(E,r),index:w})}G.sort(function(v,u){return v.angle-u.angle});D=G[0].angle;F=G[0].index;H=0;for(w=1;w<s;++w){t=G[w].index;if(D==G[w].angle){r=A[F][0]-A[y][0];E=A[F][1]-A[y][1];p=A[t][0]-A[y][0];B=A[t][1]-A[y][1];if((r*r+E*E)>=(p*p+B*B)){G[w].index=-1}else{G[H].index=-1;D=G[w].angle;H=w;F=t}}else{D=G[w].angle;H=w;F=t}}C.push(y);for(w=0,t=0;w<2;++t){if(G[t].index!==-1){C.push(G[t].index);w++}}q=C.length;for(;t<s;++t){if(G[t].index===-1){continue}while(!b(C[q-2],C[q-1],G[t].index,A)){--q}C[q++]=G[t].index}var o=[];for(w=0;w<q;++w){o.push(A[C[w]])}return o};function b(q,p,o,A){var B,z,y,w,u,s,r;B=A[q];z=B[0];y=B[1];B=A[p];w=B[0];u=B[1];B=A[o];s=B[0];r=B[1];return((r-y)*(w-z)-(u-y)*(s-z))>0}d3.geom.polygon=function(o){o.area=function(){var r=0,s=o.length,q=o[s-1][0]*o[0][1],p=o[s-1][1]*o[0][0];while(++r<s){q+=o[r-1][0]*o[r][1];p+=o[r-1][1]*o[r][0]}return(p-q)*0.5};o.centroid=function(s){var t=-1,w=o.length-1,q=0,v=0,r,p,u;if(!arguments.length){s=1/(6*o.area())}while(++t<w){r=o[t];p=o[t+1];u=r[0]*p[1]-p[0]*r[1];q+=(r[0]+p[0])*u;v+=(r[1]+p[1])*u}return[q*s,v*s]};o.clip=function(v){var y,s=-1,p=o.length,r,q,z=o[p-1],w,u,t;while(++s<p){y=v.slice();v.length=0;w=o[s];u=y[(q=y.length)-1];r=-1;while(++r<q){t=y[r];if(a(t,z,w)){if(!a(u,z,w)){v.push(k(u,t,z,w))}v.push(t)}else{if(a(u,z,w)){v.push(k(u,t,z,w))}}u=t}z=w}return v};return o};function a(r,q,o){return(o[0]-q[0])*(r[1]-q[1])<(o[1]-q[1])*(r[0]-q[0])}function k(C,B,F,E){var A=C[0],z=B[0],y=F[0],v=E[0],r=C[1],q=B[1],p=F[1],o=E[1],G=A-y,s=z-A,H=v-y,t=r-p,D=q-r,u=o-p,w=(H*t-u*G)/(u*s-H*D);return[A+w*s,r+w*D]}d3.geom.voronoi=function(p){var o=p.map(function(){return[]});h(p,function(s){var z,y,r,q,v,t;if(s.a===1&&s.b>=0){z=s.ep.r;y=s.ep.l}else{z=s.ep.l;y=s.ep.r}if(s.a===1){v=z?z.y:-1000000;r=s.c-s.b*v;t=y?y.y:1000000;q=s.c-s.b*t}else{r=z?z.x:-1000000;v=s.c-s.a*r;q=y?y.x:1000000;t=s.c-s.a*q}var w=[r,v],u=[q,t];o[s.region.l.index].push(w,u);o[s.region.r.index].push(w,u)});return o.map(function(s,r){var q=p[r][0],t=p[r][1];s.forEach(function(u){u.angle=Math.atan2(u[0]-q,u[1]-t)});return s.sort(function(v,u){return v.angle-u.angle}).filter(function(v,u){return !u||(v.angle-s[u-1].angle>1e-10)})})};var n={l:"r",r:"l"};function h(t,r){var J={list:t.map(function(p,L){return{index:L,x:p[0],y:p[1]}}).sort(function(v,p){return v.y<p.y?-1:v.y>p.y?1:v.x<p.x?-1:v.x>p.x?1:0}),bottomSite:null};var q={list:[],leftEnd:null,rightEnd:null,init:function(){q.leftEnd=q.createHalfEdge(null,"l");q.rightEnd=q.createHalfEdge(null,"l");q.leftEnd.r=q.rightEnd;q.rightEnd.l=q.leftEnd;q.list.unshift(q.leftEnd,q.rightEnd)},createHalfEdge:function(v,p){return{edge:v,side:p,vertex:null,l:null,r:null}},insert:function(v,p){p.l=v;p.r=v.r;v.r.l=p;v.r=p},leftBound:function(L){var v=q.leftEnd;do{v=v.r}while(v!=q.rightEnd&&I.rightOf(v,L));v=v.l;return v},del:function(p){p.l.r=p.r;p.r.l=p.l;p.edge=null},right:function(p){return p.r},left:function(p){return p.l},leftRegion:function(p){return p.edge==null?J.bottomSite:p.edge.region[p.side]},rightRegion:function(p){return p.edge==null?J.bottomSite:p.edge.region[n[p.side]]}};var I={bisect:function(N,L){var M={region:{l:N,r:L},ep:{l:null,r:null}};var v=L.x-N.x,p=L.y-N.y,P=v>0?v:-v,O=p>0?p:-p;M.c=N.x*v+N.y*p+(v*v+p*p)*0.5;if(P>O){M.a=1;M.b=p/v;M.c/=v}else{M.b=1;M.a=v/p;M.c/=p}return M},intersect:function(M,L){var R=M.edge,Q=L.edge;if(!R||!Q||(R.region.r==Q.region.r)){return null}var P=(R.a*Q.b)-(R.b*Q.a);if(Math.abs(P)<1e-10){return null}var v=(R.c*Q.b-Q.c*R.b)/P,U=(Q.c*R.a-R.c*Q.a)/P,T=R.region.r,O=Q.region.r,p,N;if((T.y<O.y)||(T.y==O.y&&T.x<O.x)){p=M;N=R}else{p=L;N=Q}var S=(v>=N.region.r.x);if((S&&(p.side==="l"))||(!S&&(p.side==="r"))){return null}return{x:v,y:U}},rightOf:function(P,v){var T=P.edge,N=T.region.r,W=(v.x>N.x);if(W&&(P.side==="l")){return 1}if(!W&&(P.side==="r")){return 0}if(T.a===1){var V=v.y-N.y,L=v.x-N.x,Q=0,U=0;if((!W&&(T.b<0))||(W&&(T.b>=0))){U=Q=(V>=T.b*L)}else{U=((v.x+v.y*T.b)>T.c);if(T.b<0){U=!U}if(!U){Q=1}}if(!Q){var X=N.x-T.region.l.x;U=(T.b*(L*L-V*V))<(X*V*(1+2*L/X+T.b*T.b));if(T.b<0){U=!U}}}else{var M=T.c-T.a*v.x,S=v.y-M,R=v.x-N.x,O=M-N.y;U=(S*S)>(R*R+O*O)}return P.side==="l"?U:!U},endPoint:function(L,v,p){L.ep[v]=p;if(!L.ep[n[v]]){return}r(L)},distance:function(M,L){var v=M.x-L.x,p=M.y-L.y;return Math.sqrt(v*v+p*p)}};var o={list:[],insert:function(O,v,P){O.vertex=v;O.ystar=v.y+P;for(var L=0,N=o.list,p=N.length;L<p;L++){var M=N[L];if(O.ystar>M.ystar||(O.ystar==M.ystar&&v.x>M.vertex.x)){continue}else{break}}N.splice(L,0,O)},del:function(M){for(var L=0,v=o.list,p=v.length;L<p&&(v[L]!=M);++L){}v.splice(L,1)},empty:function(){return o.list.length===0},nextEvent:function(M){for(var L=0,v=o.list,p=v.length;L<p;++L){if(v[L]==M){return v[L+1]}}return null},min:function(){var p=o.list[0];return{x:p.vertex.x,y:p.ystar}},extractMin:function(){return o.list.shift()}};q.init();J.bottomSite=J.list.shift();var K=J.list.shift(),w;var C,z,s,G,u;var A,B,H,D,y;var F,E;while(true){if(!o.empty()){w=o.min()}if(K&&(o.empty()||K.y<w.y||(K.y==w.y&&K.x<w.x))){C=q.leftBound(K);z=q.right(C);A=q.rightRegion(C);F=I.bisect(A,K);u=q.createHalfEdge(F,"l");q.insert(C,u);D=I.intersect(C,u);if(D){o.del(C);o.insert(C,D,I.distance(D,K))}C=u;u=q.createHalfEdge(F,"r");q.insert(C,u);D=I.intersect(u,z);if(D){o.insert(u,D,I.distance(D,K))}K=J.list.shift()}else{if(!o.empty()){C=o.extractMin();s=q.left(C);z=q.right(C);G=q.right(z);A=q.leftRegion(C);B=q.rightRegion(z);y=C.vertex;I.endPoint(C.edge,C.side,y);I.endPoint(z.edge,z.side,y);q.del(C);o.del(z);q.del(z);E="l";if(A.y>B.y){H=A;A=B;B=H;E="r"}F=I.bisect(A,B);u=q.createHalfEdge(F,E);q.insert(s,u);I.endPoint(F,n[E],y);D=I.intersect(s,u);if(D){o.del(s);o.insert(s,D,I.distance(D,A))}D=I.intersect(u,G);if(D){o.insert(u,D,I.distance(D,A))}}else{break}}}for(C=q.right(q.leftEnd);C!=q.rightEnd;C=q.right(C)){r(C.edge)}}d3.geom.delaunay=function(p){var o=p.map(function(){return[]}),q=[];h(p,function(r){o[r.region.l.index].push(p[r.region.r.index])});o.forEach(function(y,w){var t=p[w],s=t[0],z=t[1];y.forEach(function(A){A.angle=Math.atan2(A[0]-s,A[1]-z)});y.sort(function(A,v){return A.angle-v.angle});for(var u=0,r=y.length-1;u<r;u++){q.push([t,y[u],y[u+1]])}});return q};d3.geom.quadtree=function(z,r,y,o,w){var q,t=-1,s=z.length;if(s&&isNaN(z[0].x)){z=z.map(g)}if(arguments.length<5){if(arguments.length===3){w=o=y;y=r}else{r=y=Infinity;o=w=-Infinity;while(++t<s){q=z[t];if(q.x<r){r=q.x}if(q.y<y){y=q.y}if(q.x>o){o=q.x}if(q.y>w){w=q.y}}var C=o-r,B=w-y;if(C>B){w=y+C}else{o=r+B}}}function A(J,I,F,H,E,G){if(isNaN(I.x)||isNaN(I.y)){return}if(J.leaf){var D=J.point;if(D){if((Math.abs(D.x-I.x)+Math.abs(D.y-I.y))<0.01){u(J,I,F,H,E,G)}else{J.point=null;u(J,D,F,H,E,G);u(J,I,F,H,E,G)}}else{J.point=I}}else{u(J,I,F,H,E,G)}}function u(H,F,G,M,E,K){var L=(G+E)*0.5,J=(M+K)*0.5,N=F.x>=L,D=F.y>=J,I=(D<<1)+N;H.leaf=false;H=H.nodes[I]||(H.nodes[I]=l());if(N){G=L}else{E=L}if(D){M=J}else{K=J}A(H,F,G,M,E,K)}var v=l();v.add=function(D){A(v,D,r,y,o,w)};v.visit=function(p){f(p,v,r,y,o,w)};z.forEach(v.add);return v};function l(){return{leaf:true,nodes:[],point:null}}function f(s,r,p,w,o,u){if(!s(r,p,w,o,u)){var v=(p+o)*0.5,t=(w+u)*0.5,q=r.nodes;if(q[0]){f(s,q[0],p,w,v,t)}if(q[1]){f(s,q[1],v,w,o,t)}if(q[2]){f(s,q[2],p,t,v,u)}if(q[3]){f(s,q[3],v,t,o,u)}}}function g(o){return{x:o[0],y:o[1]}}})();(function(){d3.layout={};d3.layout.bundle=function(){return function(ai){var ak=[],aj=-1,al=ai.length;while(++aj<al){ak.push(b(ai[aj]))}return ak}};function b(al){var an=al.source,ai=al.target,am=D(an,ai),ak=[an];while(an!==am){an=an.parent;ak.push(an)}var aj=ak.length;while(ai!==am){ak.splice(aj,0,ai);ai=ai.parent}return ak}function B(ak){var aj=[],ai=ak.parent;while(ai!=null){aj.push(ak);ak=ai;ai=ai.parent}aj.push(ak);return aj}function D(al,aj){if(al===aj){return al}var ak=B(al),ai=B(aj),am=ak.pop(),an=ai.pop(),ao=null;while(am===an){ao=am;am=ak.pop();an=ai.pop()}return ao}d3.layout.chord=function(){var an={},ao,al,au,ak,ar=0,ai,aj,am;function aq(){var ax={},aA=[],aI=d3.range(ak),aE=[],ay,aG,aw,aB,az;ao=[];al=[];ay=0,aB=-1;while(++aB<ak){aG=0,az=-1;while(++az<ak){aG+=au[aB][az]}aA.push(aG);aE.push(d3.range(ak));ay+=aG}if(ai){aI.sort(function(aK,aJ){return ai(aA[aK],aA[aJ])})}if(aj){aE.forEach(function(aK,aJ){aK.sort(function(aM,aL){return aj(au[aJ][aM],au[aJ][aL])})})}ay=(2*Math.PI-ar*ak)/ay;aG=0,aB=-1;while(++aB<ak){aw=aG,az=-1;while(++az<ak){var aF=aI[aB],aD=aE[aB][az],aH=au[aF][aD];ax[aF+"-"+aD]={index:aF,subindex:aD,startAngle:aG,endAngle:aG+=aH*ay,value:aH}}al.push({index:aF,startAngle:aw,endAngle:aG,value:(aG-aw)/ay});aG+=ar}aB=-1;while(++aB<ak){az=aB-1;while(++az<ak){var av=ax[aB+"-"+az],aC=ax[az+"-"+aB];if(av.value||aC.value){ao.push(av.value<aC.value?{source:aC,target:av}:{source:av,target:aC})}}}if(am){ap()}}function ap(){ao.sort(function(aw,av){return am(aw.target.value,av.target.value)})}an.matrix=function(av){if(!arguments.length){return au}ak=(au=av)&&au.length;ao=al=null;return an};an.padding=function(av){if(!arguments.length){return ar}ar=av;ao=al=null;return an};an.sortGroups=function(av){if(!arguments.length){return ai}ai=av;ao=al=null;return an};an.sortSubgroups=function(av){if(!arguments.length){return aj}aj=av;ao=null;return an};an.sortChords=function(av){if(!arguments.length){return am}am=av;if(ao){ap()}return an};an.chords=function(){if(!ao){aq()}return ao};an.groups=function(){if(!al){aq()}return al};return an};d3.layout.force=function(){var aj={},ax=d3.dispatch("tick"),ar=[1,1],aA,am,ap=0.9,aC=n,al=I,aw=-30,an=0.1,aq=0.8,aB,av=[],ak=[],ao,ai;function ay(aE,aD){return function(aL,aG,aK,aF,aJ){if(aL.point!==aE){var aN=aL.cx-aE.x,aM=aL.cy-aE.y,aI=1/Math.sqrt(aN*aN+aM*aM);if((aF-aG)*aI<aq){var aH=aD*aL.count*aI*aI;aE.px-=aN*aH;aE.py-=aM*aH;return true}if(aL.point&&isFinite(aI)){var aH=aD*aI*aI;aE.px-=aN*aH;aE.py-=aM*aH}}}}function az(){var aF=av.length,aG=ak.length,aD,aJ,aE,aN,aM,aH,aI,aL,aK;for(aJ=0;aJ<aG;++aJ){aE=ak[aJ];aN=aE.source;aM=aE.target;aL=aM.x-aN.x;aK=aM.y-aN.y;if(aH=(aL*aL+aK*aK)){aH=am*ai[aJ]*((aH=Math.sqrt(aH))-ao[aJ])/aH;aL*=aH;aK*=aH;aM.x-=aL*(aI=aN.weight/(aM.weight+aN.weight));aM.y-=aK*aI;aN.x+=aL*(aI=1-aI);aN.y+=aK*aI}}if(aI=am*an){aL=ar[0]/2;aK=ar[1]/2;aJ=-1;if(aI){while(++aJ<aF){aE=av[aJ];aE.x+=(aL-aE.x)*aI;aE.y+=(aK-aE.y)*aI}}}if(aI=am*aw){t(aD=d3.geom.quadtree(av));aJ=-1;while(++aJ<aF){if(!(aE=av[aJ]).fixed){aD.visit(ay(aE,aI))}}}aJ=-1;while(++aJ<aF){aE=av[aJ];if(aE.fixed){aE.x=aE.px;aE.y=aE.py}else{aE.x-=(aE.px-(aE.px=aE.x))*ap;aE.y-=(aE.py-(aE.py=aE.y))*ap}}ax.tick.dispatch({type:"tick",alpha:am});return(am*=0.99)<0.005}aj.on=function(aD,aE){ax[aD].add(aE);return aj};aj.nodes=function(aD){if(!arguments.length){return av}av=aD;return aj};aj.links=function(aD){if(!arguments.length){return ak}ak=aD;return aj};aj.size=function(aD){if(!arguments.length){return ar}ar=aD;return aj};aj.linkDistance=function(aD){if(!arguments.length){return aC}aC=d3.functor(aD);return aj};aj.distance=aj.linkDistance;aj.linkStrength=function(aD){if(!arguments.length){return al}al=d3.functor(aD);return aj};aj.friction=function(aD){if(!arguments.length){return ap}ap=aD;return aj};aj.charge=function(aD){if(!arguments.length){return aw}aw=aD;return aj};aj.gravity=function(aD){if(!arguments.length){return an}an=aD;return aj};aj.theta=function(aD){if(!arguments.length){return aq}aq=aD;return aj};aj.start=function(){var aH,aG,aE=av.length,aF=ak.length,aK=ar[0],aJ=ar[1],aM,aD;for(aH=0;aH<aE;++aH){(aD=av[aH]).index=aH;aD.weight=0}ao=[];ai=[];for(aH=0;aH<aF;++aH){aD=ak[aH];if(typeof aD.source=="number"){aD.source=av[aD.source]}if(typeof aD.target=="number"){aD.target=av[aD.target]}ao[aH]=aC.call(this,aD,aH);ai[aH]=al.call(this,aD,aH);++aD.source.weight;++aD.target.weight}for(aH=0;aH<aE;++aH){aD=av[aH];if(isNaN(aD.x)){aD.x=aI("x",aK)}if(isNaN(aD.y)){aD.y=aI("y",aJ)}if(isNaN(aD.px)){aD.px=aD.x}if(isNaN(aD.py)){aD.py=aD.y}}function aI(aS,aR){var aQ=aL(aH),aP=-1,aO=aQ.length,aN;while(++aP<aO){if(!isNaN(aN=aQ[aP][aS])){return aN}}return Math.random()*aR}function aL(){if(!aM){aM=[];for(aG=0;aG<aE;++aG){aM[aG]=[]}for(aG=0;aG<aF;++aG){var aN=ak[aG];aM[aN.source.index].push(aN.target);aM[aN.target.index].push(aN.source)}}return aM[aH]}return aj.resume()};aj.resume=function(){am=0.1;d3.timer(az);return aj};aj.stop=function(){am=0;return aj};aj.drag=function(){if(!aA){aA=d3.behavior.drag().on("dragstart",au).on("drag",y).on("dragend",K)}this.on("mouseover.force",r).on("mouseout.force",ae).call(aA)};function au(aD){r(m=aD);H=aj}return aj};var H,m;function r(ai){ai.fixed|=2}function ae(ai){if(ai!==m){ai.fixed&=1}}function K(){y();m.fixed&=1;H=m=null}function y(){m.px+=d3.event.dx;m.py+=d3.event.dy;H.resume()}function t(aj){var ai=0,ao=0;aj.count=0;if(!aj.leaf){var ak=aj.nodes,an=ak.length,al=-1,am;while(++al<an){am=ak[al];if(am==null){continue}t(am);aj.count+=am.count;ai+=am.count*am.cx;ao+=am.count*am.cy}}if(aj.point){if(!aj.leaf){aj.point.x+=Math.random()-0.5;aj.point.y+=Math.random()-0.5}aj.count++;ai+=aj.point.x;ao+=aj.point.y}aj.cx=ai/aj.count;aj.cy=ao/aj.count}function n(ai){return 20}function I(ai){return 1}d3.layout.partition=function(){var ak=d3.layout.hierarchy(),al=[1,1];function ai(ap,av,ax,aw){var an=ap.children;ap.x=av;ap.y=ap.depth*aw;ap.dx=ax;ap.dy=aw;if(an){var aq=-1,ao=an.length,au,ar;ax=ap.value?ax/ap.value:0;while(++aq<ao){ai(au=an[aq],av,ar=au.value*ax,aw);av+=ar}}}function am(ap){var ao=ap.children,aq=0;if(ao){var an=-1,ar=ao.length;while(++an<ar){aq=Math.max(aq,am(ao[an]))}}return 1+aq}function aj(ap,ao){var an=ak.call(this,ap,ao);ai(an[0],0,al[0],al[1]/am(an[0]));return an}aj.size=function(an){if(!arguments.length){return al}al=an;return aj};return w(aj,ak)};d3.layout.pie=function(){var am=Number,al=null,ak=0,aj=2*Math.PI;function ai(av,ar){var an=+(typeof ak==="function"?ak.apply(this,arguments):ak);var ap=(typeof aj==="function"?aj.apply(this,arguments):aj)-ak;var aq=d3.range(av.length);if(al!=null){aq.sort(function(ax,aw){return al(av[ax],av[aw])})}var ao=av.map(am);ap/=ao.reduce(function(aw,ax){return aw+ax},0);var au=aq.map(function(aw){return{data:av[aw],value:d=ao[aw],startAngle:an,endAngle:an+=d*ap}});return av.map(function(ax,aw){return au[aq[aw]]})}ai.value=function(an){if(!arguments.length){return am}am=an;return ai};ai.sort=function(an){if(!arguments.length){return al}al=an;return ai};ai.startAngle=function(an){if(!arguments.length){return ak}ak=an;return ai};ai.endAngle=function(an){if(!arguments.length){return aj}aj=an;return ai};return ai};d3.layout.stack=function(){var al=Object,ak=k["default"],an=s.zero,am=a,aj=T,ao=R;function ai(ay,aA){var az=ay.map(function(aD,aC){return al.call(ai,aD,aC)});var aB=az.map(function(aD,aC){return aD.map(function(aE,aF){return[aj.call(ai,aE,aF),ao.call(ai,aE,aF)]})});var av=ak.call(ai,aB,aA);az=d3.permute(az,av);aB=d3.permute(aB,av);var au=an.call(ai,aB,aA);var aq=az.length,ar=az[0].length,ax,aw,ap;for(aw=0;aw<ar;++aw){am.call(ai,az[0][aw],ap=au[aw],aB[0][aw][1]);for(ax=1;ax<aq;++ax){am.call(ai,az[ax][aw],ap+=aB[ax-1][aw][1],aB[ax][aw][1])}}return ay}ai.values=function(ap){if(!arguments.length){return al}al=ap;return ai};ai.order=function(ap){if(!arguments.length){return ak}ak=typeof ap==="function"?ap:k[ap];return ai};ai.offset=function(ap){if(!arguments.length){return an}an=typeof ap==="function"?ap:s[ap];return ai};ai.x=function(ap){if(!arguments.length){return aj}aj=ap;return ai};ai.y=function(ap){if(!arguments.length){return ao}ao=ap;return ai};ai.out=function(ap){if(!arguments.length){return am}am=ap;return ai};return ai};function T(ai){return ai.x}function R(ai){return ai.y}function a(aj,ai,ak){aj.y0=ai;aj.y=ak}var k={"inside-out":function(am){var ak=am.length,an,al,ar=am.map(S),ao=am.map(z),ap=d3.range(ak).sort(function(aw,av){return ar[aw]-ar[av]}),aq=0,ai=0,au=[],aj=[];for(an=0;an<ak;++an){al=ap[an];if(aq<ai){aq+=ao[al];au.push(al)}else{ai+=ao[al];aj.push(al)}}return aj.reverse().concat(au)},reverse:function(ai){return d3.range(ai.length).reverse()},"default":function(ai){return d3.range(ai.length)}};var s={silhouette:function(am){var aj=am.length,ak=am[0].length,ao=[],ap=0,an,al,ai,aq=[];for(al=0;al<ak;++al){for(an=0,ai=0;an<aj;an++){ai+=am[an][al][1]}if(ai>ap){ap=ai}ao.push(ai)}for(al=0;al<ak;++al){aq[al]=(ap-ao[al])/2}return aq},wiggle:function(ao){var aj=ao.length,au=ao[0],ak=au.length,aq=0,ap,an,am,ax,aw,ar,ay,ai,al,av=[];av[0]=ai=al=0;for(an=1;an<ak;++an){for(ap=0,ax=0;ap<aj;++ap){ax+=ao[ap][an][1]}for(ap=0,aw=0,ay=au[an][0]-au[an-1][0];ap<aj;++ap){for(am=0,ar=(ao[ap][an][1]-ao[ap][an-1][1])/(2*ay);am<ap;++am){ar+=(ao[am][an][1]-ao[am][an-1][1])/ay}aw+=ar*ao[ap][an][1]}av[an]=ai-=ax?aw/ax*ay:0;if(ai<al){al=ai}}for(an=0;an<ak;++an){av[an]-=al}return av},expand:function(an){var ap=an.length,ai=an[0].length,aj=1/ap,al,ak,ao,am=[];for(ak=0;ak<ai;++ak){for(al=0,ao=0;al<ap;al++){ao+=an[al][ak][1]}if(ao){for(al=0;al<ap;al++){an[al][ak][1]/=ao}}else{for(al=0;al<ap;al++){an[al][ak][1]=aj}}}for(ak=0;ak<ai;++ak){am[ak]=0}return am},zero:function(al){var aj=-1,ai=al[0].length,ak=[];while(++aj<ai){ak[aj]=0}return ak}};function S(an){var al=1,ak=0,aj=an[0][1],ai,am=an.length;for(;al<am;++al){if((ai=an[al][1])>aj){ak=al;aj=ai}}return ak}function z(ai){return ai.reduce(M,0)}function M(ai,aj){return ai+aj[1]}d3.layout.histogram=function(){var am=true,aj=Number,ai=ad,ak=N;function al(aq,ar){var ay=[],aw=aq.map(aj,this),au=ai.call(this,aw,ar),ax=ak.call(this,au,aw,ar),az,ar=-1,an=aw.length,ao=ax.length-1,ap=am?1:1/an,av;while(++ar<ao){az=ay[ar]=[];az.dx=ax[ar+1]-(az.x=ax[ar]);az.y=0}ar=-1;while(++ar<an){av=aw[ar];if((av>=au[0])&&(av<=au[1])){az=ay[d3.bisect(ax,av,1,ao)-1];az.y+=ap;az.push(aq[ar])}}return ay}al.value=function(an){if(!arguments.length){return aj}aj=an;return al};al.range=function(an){if(!arguments.length){return ai}ai=d3.functor(an);return al};al.bins=function(an){if(!arguments.length){return ak}ak=typeof an==="number"?function(ao){return ag(ao,an)}:d3.functor(an);return al};al.frequency=function(an){if(!arguments.length){return am}am=!!an;return al};return al};function N(aj,ai){return ag(aj,Math.ceil(Math.log(ai.length)/Math.LN2+1))}function ag(al,an){var ak=-1,aj=+al[0],ai=(al[1]-aj)/an,am=[];while(++ak<=an){am[ak]=ai*ak+aj}return am}function ad(ai){return[d3.min(ai),d3.max(ai)]}d3.layout.hierarchy=function(){var ak=L,aj=V,am=ac;function al(av,au,ao){var ax=aj.call(ai,av,au),aq=v?av:{data:av};aq.depth=au;ao.push(aq);if(ax){var aw=-1,ap=ax.length,ay=aq.children=[],az=0,ar=au+1;while(++aw<ap){d=al(ax[aw],ar,ao);d.parent=aq;ay.push(d);az+=d.value}if(ak){ay.sort(ak)}if(am){aq.value=az}}else{if(am){aq.value=+am.call(ai,av,au)||0}}return aq}function an(au,av){var ar=au.children,ao=0;if(ar){var aq=-1,aw=ar.length,ap=av+1;while(++aq<aw){ao+=an(ar[aq],ap)}}else{if(am){ao=+am.call(ai,v?au:au.data,av)||0}}if(am){au.value=ao}return ao}function ai(ap){var ao=[];al(ap,0,ao);return ao}ai.sort=function(ao){if(!arguments.length){return ak}ak=ao;return ai};ai.children=function(ao){if(!arguments.length){return aj}aj=ao;return ai};ai.value=function(ao){if(!arguments.length){return am}am=ao;return ai};ai.revalue=function(ao){an(ao,0);return ao};return ai};function w(aj,ai){aj.sort=d3.rebind(aj,ai.sort);aj.children=d3.rebind(aj,ai.children);aj.links=ab;aj.value=d3.rebind(aj,ai.value);aj.nodes=function(ak){v=true;return(aj.nodes=aj)(ak)};return aj}function V(ai){return ai.children}function ac(ai){return ai.value}function L(aj,ai){return ai.value-aj.value}function ab(ai){return d3.merge(ai.map(function(aj){return(aj.children||[]).map(function(ak){return{source:aj,target:ak}})}))}var v=false;d3.layout.pack=function(){var ai=d3.layout.hierarchy().sort(ah),ak=[1,1];function aj(ar,ap){var ao=ai.call(this,ar,ap),am=ao[0];am.x=0;am.y=0;F(am);var al=ak[0],aq=ak[1],an=1/Math.max(2*am.r/al,2*am.r/aq);O(am,al/2,aq/2,an);return ao}aj.size=function(al){if(!arguments.length){return ak}ak=al;return aj};return w(aj,ai)};function ah(aj,ai){return aj.value-ai.value}function G(aj,ai){var ak=aj._pack_next;aj._pack_next=ai;ai._pack_prev=aj;ai._pack_next=ak;ak._pack_prev=ai}function Y(aj,ai){aj._pack_next=ai;ai._pack_prev=aj}function af(ak,ai){var al=ai.x-ak.x,aj=ai.y-ak.y,am=ak.r+ai.r;return(am*am-al*al-aj*aj)>0.001}function Q(au){var az=Infinity,aD=-Infinity,ai=Infinity,am=-Infinity,ar=au.length,aC,aB,aA,ax,aw;function ak(aE){az=Math.min(aE.x-aE.r,az);aD=Math.max(aE.x+aE.r,aD);ai=Math.min(aE.y-aE.r,ai);am=Math.max(aE.y+aE.r,am)}au.forEach(p);aC=au[0];aC.x=-aC.r;aC.y=0;ak(aC);if(ar>1){aB=au[1];aB.x=aB.r;aB.y=0;ak(aB);if(ar>2){aA=au[2];l(aC,aB,aA);ak(aA);G(aC,aA);aC._pack_prev=aA;G(aA,aB);aB=aC._pack_next;for(var ay=3;ay<ar;ay++){l(aC,aB,aA=au[ay]);var aj=0,an=1,al=1;for(ax=aB._pack_next;ax!==aB;ax=ax._pack_next,an++){if(af(ax,aA)){aj=1;break}}if(aj==1){for(aw=aC._pack_prev;aw!==ax._pack_prev;aw=aw._pack_prev,al++){if(af(aw,aA)){if(al<an){aj=-1;ax=aw}break}}}if(aj==0){G(aC,aA);aB=aA;ak(aA)}else{if(aj>0){Y(aC,ax);aB=ax;ay--}else{Y(ax,aB);aC=ax;ay--}}}}}var ap=(az+aD)/2,ao=(ai+am)/2,aq=0;for(var ay=0;ay<ar;ay++){var av=au[ay];av.x-=ap;av.y-=ao;aq=Math.max(aq,av.r+Math.sqrt(av.x*av.x+av.y*av.y))}au.forEach(U);return aq}function p(ai){ai._pack_next=ai._pack_prev=ai}function U(ai){delete ai._pack_next;delete ai._pack_prev}function F(aj){var ai=aj.children;if(ai){ai.forEach(F);aj.r=Q(ai)}else{aj.r=Math.sqrt(aj.value)}}function O(am,ai,ao,aj){var al=am.children;am.x=(ai+=aj*am.x);am.y=(ao+=aj*am.y);am.r*=aj;if(al){var ak=-1,an=al.length;while(++ak<an){O(al[ak],ai,ao,aj)}}}function l(an,al,ak){var au=al.r+ak.r,aq=an.r+ak.r,av=al.x-an.x,ar=al.y-an.y,ap=Math.sqrt(av*av+ar*ar),ao=(aq*aq+ap*ap-au*au)/(2*aq*ap),ai=Math.acos(ao),am=ao*aq,aj=Math.sin(ai)*aq;av/=ap;ar/=ap;ak.x=an.x+am*av+aj*ar;ak.y=an.y+am*ar-aj*av}d3.layout.cluster=function(){var aj=d3.layout.hierarchy().sort(null).value(null),al=q,ak=[1,1];function ai(av,aq){var am=aj.call(this,av,aq),aw=am[0],ax,ay=0,au,ar;Z(aw,function(aA){if(aA.children){aA.x=f(aA.children);aA.y=e(aA.children)}else{aA.x=ax?ay+=al(aA,ax):0;aA.y=0;ax=aA}});var ap=P(aw),az=h(aw),ao=ap.x-al(ap,az)/2,an=az.x+al(az,ap)/2;Z(aw,function(aA){aA.x=(aA.x-ao)/(an-ao)*ak[0];aA.y=(1-aA.y/aw.y)*ak[1]});return am}ai.separation=function(am){if(!arguments.length){return al}al=am;return ai};ai.size=function(am){if(!arguments.length){return ak}ak=am;return ai};return w(ai,aj)};function e(ai){return 1+d3.max(ai,function(aj){return aj.y})}function f(ai){return ai.reduce(function(aj,ak){return aj+ak.x},0)/ai.length}function P(aj){var ai=aj.children;return ai?P(ai[0]):aj}function h(aj){var ai=aj.children;return ai?h(ai[ai.length-1]):aj}d3.layout.tree=function(){var aj=d3.layout.hierarchy().sort(null).value(null),al=q,ak=[1,1];function ai(av,ar){var an=aj.call(this,av,ar),ax=an[0];function au(aF,aB){var aD=aF.children,aI=aF._tree;if(aD&&(aE=aD.length)){var aE,aK=aD[0],aJ,aH=aK,aC,aG=-1;while(++aG<aE){aC=aD[aG];au(aC,aJ);aH=am(aC,aJ,aH);aJ=aC}J(aF);var aL=0.5*(aK._tree.prelim+aC._tree.prelim);if(aB){aI.prelim=aB._tree.prelim+al(aF,aB);aI.mod=aI.prelim-aL}else{aI.prelim=aL}}else{if(aB){aI.prelim=aB._tree.prelim+al(aF,aB)}}}function aw(aE,aB){aE.x=aE._tree.prelim+aB;var aD=aE.children;if(aD){var aC=-1,aF=aD.length;aB+=aE._tree.mod;while(++aC<aF){aw(aD[aC],aB)}}}function am(aF,aB,aI){if(aB){var aE=aF,aD=aF,aH=aB,aG=aF.parent.children[0],aK=aE._tree.mod,aJ=aD._tree.mod,aM=aH._tree.mod,aL=aG._tree.mod,aC;while(aH=aa(aH),aE=o(aE),aH&&aE){aG=o(aG);aD=aa(aD);aD._tree.ancestor=aF;aC=aH._tree.prelim+aM-aE._tree.prelim-aK+al(aH,aE);if(aC>0){A(c(aH,aF,aI),aF,aC);aK+=aC;aJ+=aC}aM+=aH._tree.mod;aK+=aE._tree.mod;aL+=aG._tree.mod;aJ+=aD._tree.mod}if(aH&&!aa(aD)){aD._tree.thread=aH;aD._tree.mod+=aM-aJ}if(aE&&!o(aG)){aG._tree.thread=aE;aG._tree.mod+=aK-aL;aI=aF}}return aI}Z(ax,function(aC,aB){aC._tree={ancestor:aC,prelim:0,mod:0,change:0,shift:0,number:aB?aB._tree.number+1:0}});au(ax);aw(ax,-ax._tree.prelim);var aq=E(ax,g),aA=E(ax,X),az=E(ax,C),ap=aq.x-al(aq,aA)/2,ao=aA.x+al(aA,aq)/2,ay=az.depth||1;Z(ax,function(aB){aB.x=(aB.x-ap)/(ao-ap)*ak[0];aB.y=aB.depth/ay*ak[1];delete aB._tree});return an}ai.separation=function(am){if(!arguments.length){return al}al=am;return ai};ai.size=function(am){if(!arguments.length){return ak}ak=am;return ai};return w(ai,aj)};function q(aj,ai){return aj.parent==ai.parent?1:2}function o(ai){return ai.children?ai.children[0]:ai._tree.thread}function aa(ai){return ai.children?ai.children[ai.children.length-1]:ai._tree.thread}function E(ak,al){var aj=ak.children;if(aj){var an,am=aj.length,ai=-1;while(++ai<am){if(al(an=E(aj[ai],al),ak)>0){ak=an}}}return ak}function X(aj,ai){return aj.x-ai.x}function g(aj,ai){return ai.x-aj.x}function C(aj,ai){return aj.depth-ai.depth}function Z(aj,ak){function ai(ap,ao){var an=ap.children;if(an){var ar,am=null,al=-1,aq=an.length;while(++al<aq){ar=an[al];ai(ar,am);am=ar}}ak(ap,ao)}ai(aj,null)}function J(al){var ai=0,an=0,ak=al.children,aj=ak.length,am;while(--aj>=0){am=ak[aj]._tree;am.prelim+=ai;am.mod+=ai;ai+=am.shift+(an+=am.change)}}function A(aj,ak,ai){aj=aj._tree;ak=ak._tree;var al=ai/(ak.number-aj.number);aj.change+=al;ak.change-=al;ak.shift+=ai;ak.prelim+=ai;ak.mod+=ai}function c(ai,ak,aj){return ai._tree.ancestor.parent==ak.parent?ai._tree.ancestor:aj}d3.layout.treemap=function(){var ap=d3.layout.hierarchy(),av=Math.round,ax=[1,1],aq=null,ai=u,ar=false,an,ao=0.5*(1+Math.sqrt(5));function aj(aA,ay){var az=-1,aD=aA.length,aC,aB;while(++az<aD){aB=(aC=aA[az]).value*(ay<0?0:ay);aC.area=isNaN(aB)||aB<=0?0:aB}}function al(aC){if(!aC.children){return}var aE=ai(aC),aG=[],az=aC.children.slice(),ay,aD=Infinity,aB,aF=Math.min(aE.dx,aE.dy),aA;aj(az,aE.dx*aE.dy/aC.value);aG.area=0;while((aA=az.length)>0){aG.push(ay=az[aA-1]);aG.area+=ay.area;if((aB=ak(aG,aF))<=aD){az.pop();aD=aB}else{aG.area-=aG.pop().area;am(aG,aF,aE,false);aF=Math.min(aE.dx,aE.dy);aG.length=aG.area=0;aD=Infinity}}if(aG.length){am(aG,aF,aE,true);aG.length=aG.area=0}aC.children.forEach(al)}function aw(aA){if(!aA.children){return}var az=ai(aA),ay=aA.children.slice(),aC,aB=[];aj(ay,az.dx*az.dy/aA.value);aB.area=0;while(aC=ay.pop()){aB.push(aC);aB.area+=aC.area;if(aC.z!=null){am(aB,aC.z?az.dx:az.dy,az,!ay.length);aB.length=aB.area=0}}aA.children.forEach(aw)}function ak(aD,az){var aB=aD.area,aC,aF=0,ay=Infinity,aA=-1,aE=aD.length;while(++aA<aE){if(!(aC=aD[aA].area)){continue}if(aC<ay){ay=aC}if(aC>aF){aF=aC}}aB*=aB;az*=az;return aB?Math.max((az*aF*ao)/aB,aB/(az*ay*ao)):Infinity}function am(aH,aG,aC,aF){var aA=-1,az=aH.length,aD=aC.x,aB=aC.y,aE=aG?av(aH.area/aG):0,ay;if(aG==aC.dx){if(aF||aE>aC.dy){aE=aE?aC.dy:0}while(++aA<az){ay=aH[aA];ay.x=aD;ay.y=aB;ay.dy=aE;aD+=ay.dx=aE?av(ay.area/aE):0}ay.z=true;ay.dx+=aC.x+aC.dx-aD;aC.y+=aE;aC.dy-=aE}else{if(aF||aE>aC.dx){aE=aE?aC.dx:0}while(++aA<az){ay=aH[aA];ay.x=aD;ay.y=aB;ay.dx=aE;aB+=ay.dy=aE?av(ay.area/aE):0}ay.z=false;ay.dy+=aC.y+aC.dy-aB;aC.x+=aE;aC.dx-=aE}}function au(aA){var az=an||ap(aA),ay=az[0];ay.x=0;ay.y=0;ay.dx=ax[0];ay.dy=ax[1];if(an){ap.revalue(ay)}aj([ay],ay.dx*ay.dy/ay.value);(an?aw:al)(ay);if(ar){an=az}return az}au.size=function(ay){if(!arguments.length){return ax}ax=ay;return au};au.padding=function(ay){if(!arguments.length){return aq}function aB(aC){var aD=ay.call(au,aC,aC.depth);return aD==null?u(aC):W(aC,typeof aD==="number"?[aD,aD,aD,aD]:aD)}function aA(aC){return W(aC,ay)}var az;ai=(aq=ay)==null?u:(az=typeof ay)==="function"?aB:az==="number"?(ay=[ay,ay,ay,ay],aA):aA;return au};au.round=function(ay){if(!arguments.length){return av!=Number}av=ay?Math.round:Number;return au};au.sticky=function(ay){if(!arguments.length){return ar}ar=ay;an=null;return au};au.ratio=function(ay){if(!arguments.length){return ao}ao=ay;return au};return w(au,ap)};function u(ai){return{x:ai.x,y:ai.y,dx:ai.dx,dy:ai.dy}}function W(al,am){var ai=al.x+am[3],an=al.y+am[0],ak=al.dx-am[1]-am[3],aj=al.dy-am[0]-am[2];if(ak<0){ai+=ak/2;ak=0}if(aj<0){an+=aj/2;aj=0}return{x:ai,y:an,dx:ak,dy:aj}}})();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,e){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=e;$(b[c].functions).each(function(g){try{g(e)}catch(f){}});if(a){this.observers.local[a]=b}else{this.observers.global=b}},register:function(a,e,f){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[e]){c[e]={param:null,functions:[]};if(a){this.observers.local[a]=c}else{this.observers.global=c}}c[e].functions.push(f);if(c[e].param){try{f(c[e].param)}catch(b){}}},switchSample:function(c,a){var b=this;Client.getConfiguration({sample:c,site:a},{callback:function(e){b.notify(null,"switchsample",e)}})}});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,e;if(self.innerHeight){if(document.documentElement.clientWidth){b=document.documentElement.clientWidth}else{b=self.innerWidth}e=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){b=document.documentElement.clientWidth;e=document.documentElement.clientHeight}else{if(document.body){b=document.body.clientWidth;e=document.body.clientHeight}}}if(a<e){pageHeight=e}else{pageHeight=a}if(c<b){pageWidth=c}else{pageWidth=b}arrayPageSize=new Array(pageWidth,pageHeight,b,e);return arrayPageSize};at.idiom.js.util.Util.contains=function(b,a){if(a==b){return true}if(a==null){return false}else{return at.idiom.js.util.Util.contains(b,a.parentNode)}};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(e){if(e==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.util.Months=$H({en:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],de:["Jän","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"]});at.idiom.js.util.Date={};at.idiom.js.util.Date.formatFullDate=function(a,b){return(a.getDate()<10?"0":"")+a.getDate()+" "+at.idiom.js.util.Months.get(b)[a.getMonth()]+" "+a.getFullYear()};at.idiom.js.util.Date.formatShortDate=function(a,b){return at.idiom.js.util.Months.get(b)[a.getMonth()]+" "+(a.getDate()<10?"0":"")+a.getDate()};at.idiom.js.util.Date.formatDateForSearch=function(b){var a=b.getDate();if(a<10){a="0"+a}var e=b.getMonth()+1;if(e<10){e="0"+e}var c=b.getFullYear();return c+"-"+e+"-"+a};at.idiom.js.util.Date.parseDate=function(a){if(typeof a=="object"){return a}return new Date(Date.UTC(a.substr(0,4),a.substr(5,2)-1,a.substr(8,2)))};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(f,e,c,b,a){this.window.setStyle({top:f+"px",left:e+"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,e){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,e)}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(e){b.show($(e.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 g=0;var b=this.getPageSize();var f=this.main.getWidth();var h=this.main.getHeight()-g;var e=$("Content").getHeight();var a=(b[0]-f)/2;var c=(e-h)/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 e(g){return(g<1900)?g+1900:g}function f(g){return(g<10)?"0"+g:g}var b=a[c.getMonth()]+" "+f(c.getDate())+", "+c.getFullYear()+" "+f(c.getHours())+":"+f(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:"targetLongitude";this.pointY=c.pointY?c.pointY:"targetLatitude";this.sentimentName=c.semanticOrientation?c.semanticOrientation:"sentiment";this.sentimentThreshold=c.semanticThreshold?c.semanticThreshold:0.1;this.drawArcs=c.drawArcs?true:false;this.sourcePointX=c.sourcePointX?c.sourcePointX:"sourceLongitude";this.sourcePointY=c.sourcePointY?c.sourcePointY:"sourceLatitude";this.cssPrefix=c.cssPrefix;this.defaultZoom=c.defaultZoom?c.defaultZoom:0;this.defaultLayer=c.defaultLayer;this.searchColour=c.searchColour?c.searchColour:"#ffffff";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.properties.panMethod=OpenLayers.Easing.Expo.easeInOut;this.map2DContainer=c.map2DContainer?$(c.map2DContainer):this.content;this.freezeButton=c.freezeButton?$(c.freezeButton):null;this.mainLayer=null;this.errorElement=null;this.errorElementTimeout=null;this.markerSizeX=c.markerSizeX?c.markerSizeX:16;this.markerSizeY=c.markerSizeY?c.markerSizeY:16;this.textSource=c.textSource;this.textTarget=c.textTarget;this.textMirrorDate=c.textMirrorDate;this.textReadDocument=c.textReadDocument;this.language=c.language;this.previewEnabled=c.previewEnabled;this.isFrozen=false;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(e){b.switchMainLayer(e)});this.idiom.register(null,"switchsample",function(e){b.sample=e.sample});this.idiom.register("maps","resetPreview",function(){b.previewMarker.icon.display(false);if(!b.isFrozen){b.map.panTo(b.centerPoint)}});this.idiom.register(null,"enablePreviewMode",function(e){if(e){b.previewEnabled=true}else{b.previewEnabled=false}});this.map.events.register("moveend",this,function(){if(this.mouseOnMap){this.centerPoint=this.map.getCenter()}});this.idiom.register(null,"changeSnapshot",function(e){b.snapshot=e.snapshotid});this.idiom.register(null,"switchsample",function(e){b.sample=e.sample});this.minimalSentiment=c.minimalSentiment;this.maximalSentiment=c.maximalSentiment;this.idiom.register(null,"filterSentiment",function(e){b.minimalSentiment=e.minimalSentiment;b.maximalSentiment=e.maximalSentiment});this.minimalDate=at.idiom.js.util.Date.parseDate(c.minimalDate);this.maximalDate=at.idiom.js.util.Date.parseDate(c.maximalDate);this.idiom.register(null,"changeDate",function(e){b.minimalDate=e.beginDate;b.maximalDate=e.endDate})},createMap:function(){this.map=new OpenLayers.Map(this.map2DContainer,this.properties);var a=this;var b=0;this.layers.each(function(e){var c=null;b++;c=a.createLayer(e,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.layers).each(function(c){if(c.name==this.defaultLayer){this.map.setBaseLayer(c);c.setIsBaseLayer(true)}},this);this.map.zoomTo(this.defaultZoom);this.transformProjection(true);this.centerPoint=null;this.map.restrictedExtent=this.map.baseLayer.maxExtent;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 f=a.getCode()!=c.getCode();if(!f){return}this.map.restrictedExtent=this.map.baseLayer.maxExtent;var e=this.map.getLayersBy("isVector",true);$(e).each(function(g){g.maxResolution=this.map.baseLayer.maxResolution;g.minResolution=this.map.baseLayer.minResolution;g.setVisibility(false);g.setVisibility(true);$(g.features).each(function(h){h.geometry.transform(g.projection,c)},this);g.projection=c;g.redraw()},this);this.markersLayer.maxResolution=this.map.baseLayer.maxResolution;this.markersLayer.minResolution=this.map.baseLayer.minResolution;$(this.markersLayer.markers).each(function(g){g.lonlat.transform(this.markersLayer.projection,c)},this);this.markersLayer.projection=c;this.markersLayer.redraw();if(f&&!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)}},drawMarkers:function(g){var e=g.content;var c=g.documents;this.markersLayer.clearMarkers();var a=new OpenLayers.LonLat(0,0);this.previewMarker=this.createMarker(0,a,null,null,null,null,null,false);this.previewMarker.setOpacity(0.5);this.previewMarker.icon.display(false);if(c){for(var b=4;b>=0;b--){if(c[b]==null){continue}if(c[b][this.pointX]==null||c[b][this.pointY]==null){continue}var a=new OpenLayers.LonLat(parseFloat(c[b][this.pointX])*this.scaleX,parseFloat(c[b][this.pointY])*this.scaleY);a.transform(new OpenLayers.Projection("EPSG:4326"),this.map.getProjectionObject());var f=a.clone();this.markersNormal[b+1]=this.createMarker(b+1,a,c[b].targetLocation,c[b].title,c[b].sourceLocation,c[b].date,c[b].contentId,false);this.markersLayer.addMarker(this.markersNormal[b+1]);this.markersHighlight[b+1]=this.createMarker(b+1,f,c[b].targetLocation,c[b].title,c[b].sourceLocation,c[b].date,c[b].contentId,true);this.markersLayer.addMarker(this.markersHighlight[b+1]);this.markersHighlight[b+1].display(false);this.markersHighlight[b+1].highlight=true}}if(e){if(e[this.pointX]!=null&&e[this.pointY]!=null){var a=new OpenLayers.LonLat(parseFloat(e[this.pointX])*this.scaleX,parseFloat(e[this.pointY])*this.scaleY);a.transform(new OpenLayers.Projection("EPSG:4326"),this.map.getProjectionObject());this.markersNormal[0]=this.createMarker(0,a,e.targetLocation,e.title,e.sourceLocation,e.date,e.contentId,false);this.markersLayer.addMarker(this.markersNormal[0])}}this.markersLayer.addMarker(this.previewMarker);for(var b=0;b<=5;b++){if(!this.markersNormal[b]){continue}this.centerPoint=this.markersNormal[b].lonlat;if(this.isVisible&&!this.isFrozen){this.map.panTo(a)}break}},updateMainView:function(a){this.idiom.notify("main","setNewContent",{content:a})},previewMainView:function(b,c){if(b.content){if(c){this.idiom.notify("main","previewContent",{content:b.content})}else{var a=new OpenLayers.LonLat(parseFloat(b.x)*this.scaleX,parseFloat(b.y)*this.scaleY);a.transform(new OpenLayers.Projection("EPSG:4326"),this.map.getProjectionObject());this.previewMarker.lonlat=a;this.previewMarker.icon.display(true);this.markersLayer.redraw();if(!this.mouseOnMap){if(!this.isFrozen){this.map.panTo(a)}}}}},resetMainView:function(){this.idiom.notify("main","resetContent",null);this.markersLayer.redraw()},previewMouseIn:function(e,c,b){if(!this.previewEnabled){return}clearTimeout(this.mouseMoveDelay);var a=this.map.getLonLatFromPixel(e.xy);this.mouseMoveDelay=setTimeout(function(){c(a)},b);this.mouseOnMap=true},previewMouseOut:function(a){if(!this.previewEnabled){return}var b=$(a.relatedTarget||a.toElement);if(!at.idiom.js.util.Util.contains(this.window,b)){clearTimeout(this.mouseMoveDelay);this.resetMainView();this.mouseOnMap=false}},createMarker:function(l,r,q,p,n,f,b,g){var t=new OpenLayers.Size(this.markerSizeX,this.markerSizeY);var h=new OpenLayers.Pixel(-(t.w/2),-(t.h/2));var s=this.cssPrefix+l;if(g){s+="h"}var o=new OpenLayers.Icon(s,t,h);var k=new OpenLayers.Marker(r,o);var e=this;if(l!=0){var m="<b>"+p.substring(0,35)+"</b><br>"+this.textSource+": "+n+" &bull; "+this.textTarget+": "+q+"<br />"+this.textMirrorDate+": "+at.idiom.js.util.Date.formatFullDate(f,this.language)+"<br /><a href='#' onclick=\"IDIOM.notify('main', 'setNewContentId', {contentid: "+b+'}); return false;">'+this.textReadDocument+"</a>";var c=this.windowId+"_popup_"+l;var a=new OpenLayers.Popup.FramedCloud(c,r,new OpenLayers.Size(200,100),m,o,true);a.border="1px solid #cccccc";a.contentDiv.style.padding="5px";k.events.register("click",k,function(){e.map.addPopup(a,true);a.show()});k.events.register("mouseover",k,function(){e.highlight(l);e.markInList(l)});k.events.register("mouseout",k,function(){e.normal(l);e.unmarkInList(l)})}return k},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,f,e,c,b,a){this.window.removeClassName("closed");this.windowClosed.removeClassName("closed");$super(f,e,c,b,a);if(!this.map){return}this.map.updateSize();if(this.centerPoint&&!this.isFrozen){this.map.panTo(this.centerPoint)}this.map.updateSize();this.markersLayer.markers.each(function(g){if(!g.highlight){g.display(true)}});this.markersLayer.redraw()},close:function($super){$super();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.isFrozen){this.map.panTo(this.centerPoint)}},minimize:function($super){$super();if(!this.canMaximize||!this.isMaximized){return}this.idiom.notify("maps","show",this)},freeze:function(){this.isFrozen=!this.isFrozen;if(this.isFrozen){this.freezeButton.down(".sprite_icon_freeze_stop").show();this.freezeButton.down(".sprite_icon_freeze_play").hide()}else{this.freezeButton.down(".sprite_icon_freeze_play").show();this.freezeButton.down(".sprite_icon_freeze_stop").hide()}},markInList:function(a){},unmarkInList:function(a){},addSearchMarkers:function(b){this.clearSearchMarkers();var a=new Hash();b.reject(function(c){return c.disabled}).each(function(f){if(f[this.pointX]==null||f[this.pointY]==null){return}var h=f[this.pointX]+"/"+f[this.pointY];var c=a.get(h);if(c){var g=c.sentiment;var e=f[this.sentimentName];var k=(e+c.count*g)/(c.count+1);c.sentiment=k;if(c.documents.indexOf(f.contentId)==-1){c.count++;c.documents.push(f.contentId)}}else{c={};c.count=1;c.documents=[f.contentId];c.x=f[this.pointX];c.y=f[this.pointY];c.sentiment=f[this.sentimentName];a.set(h,c)}},this);this.searchMarkersLayer.maxResolution=this.map.baseLayer.maxResolution;this.searchMarkersLayer.minResolution=this.map.baseLayer.minResolution;a.each(function(k){var c=new OpenLayers.Geometry.Point(parseFloat(k.value.x)*this.scaleX,parseFloat(k.value.y)*this.scaleY);var h=this.searchColour;var g=k.value.sentiment;if(g>this.sentimentThreshold){h=this.positiveSearchColour}else{if(g<-this.sentimentThreshold){h=this.negativeSearchColour}}var f=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style["default"]);f.fillOpacity=this.searchFillOpacity;f.graphicOpacity=this.searchGraphicOpacity;f.strokeColor=h;f.fillColor=h;f.pointRadius=this.searchRadius+(this.searchRadiusIncrement*((k.value.count-1)/this.searchRadiusIncrementStep));c.transform(new OpenLayers.Projection("EPSG:4326"),this.map.getProjectionObject());var e=new OpenLayers.Feature.Vector(c,null,f);this.searchMarkersLayer.addFeatures([e])},this)},addSearchLines:function(b){if(!this.drawArcs){return}var a=new Hash();b.reject(function(c){return c.disabled}).each(function(f){if(!(f.hasTargetLocation&&f.hasSourceLocation)){return}var h=f[this.pointX]+"/"+f[this.pointY]+"/"+f[this.sourcePointX]+"/"+f[this.sourcePointY];var c=a.get(h);if(c){var g=c.sentiment;var e=f[this.sentimentName];var k=(e+c.count*g)/(c.count+1);c.sentiment=k;if(c.documents.indexOf(f.contentId)==-1){c.count++;c.documents.push(f.contentId)}}else{c={};c.count=1;c.documents=[f.contentId];c.sourceX=f[this.sourcePointX];c.sourceY=f[this.sourcePointY];c.targetX=f[this.pointX];c.targetY=f[this.pointY];c.sentiment=f[this.sentimentName];a.set(h,c)}},this);this.searchArcsLayer.maxResolution=this.map.baseLayer.maxResolution;this.searchArcsLayer.minResolution=this.map.baseLayer.minResolution;a.each(function(t){var k=parseFloat(t.value.targetX)*this.scaleX;var h=parseFloat(t.value.targetY)*this.scaleY;var e=parseFloat(t.value.sourceX)*this.scaleX;var c=parseFloat(t.value.sourceY)*this.scaleY;var v=this.calculateBezier(e,c,k,h);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 f=t.value.sentiment;if(f>this.sentimentThreshold){r=this.positiveSearchColour}else{if(f<-this.sentimentThreshold){r=this.negativeSearchColour}}var m={};m.r=parseInt(r.substring(1,3),16);m.g=parseInt(r.substring(3,5),16);m.b=parseInt(r.substring(5,7),16);for(var w=0;w<v.length;w=w+5){var n={};n.r=p.r+(m.r-p.r)*w/v.length;n.g=p.g+(m.g-p.g)*w/v.length;n.b=p.b+(m.b-p.b)*w/v.length;var l="#"+parseInt(n.r).toString(16)+parseInt(n.g).toString(16)+parseInt(n.b).toString(16);var q=Object.clone(z);q.strokeColor=l;q.fillColor=l;q.strokeWidth=o+(u-o)*w/v.length;var g=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(v.slice(w,Math.min(w+5,v.length))),null,q);g.geometry.transform(new OpenLayers.Projection("EPSG:4326"),this.map.getProjectionObject());this.searchArcsLayer.addFeatures([g])}},this)},clearSearchMarkers:function(){this.searchMarkersLayer.destroyFeatures();if(this.drawArcs){this.searchArcsLayer.destroyFeatures()}},calculateBezier:function(b,k,a,h){var o=new OpenLayers.Geometry.Point(b,k);var n=new OpenLayers.Geometry.Point(a,h);var f=20;if(n.x<o.x){f=-f}var e=0.5/Math.cos(f/180*Math.PI);var g=n.clone();g.rotate(f,o);g.resize(e,o);var m=[];var c=new at.idiom.js.util.Bezier(o,n,g,g);c.plot(function(q){var l=new OpenLayers.Geometry.Point(q.x,q.y);m.push(l)});return m}});at.idiom.js.util.Bezier=Class.create({initialize:function(f,e,b,a){var c=this;c.x0=f.x;c.y0=f.y;c.x1=e.x;c.y1=e.y;c.cx0=b.x;c.cy0=b.y;c.cx1=a.x;c.cy1=a.y},getCoordinates:function(p){var f=1-p;var n=p*p;var k=f*f;var m=n*p;var l=3*n*f;var h=3*p*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(h){var f;var a=(a=this.x0-this.x1)*a;var g=(g=this.y0-this.y1)*g;var b=b=Math.ceil(Math.sqrt(a+g));var e=b+1;while(h(this.getCoordinates(f=--e/b),f),e){}}});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 e=0;this.maps.each(function(f){if(f.isVisible){e++}});if(e<=1){return}var c=this.container.getDimensions();a.close();e=0;this.maps.each(function(f){if(f.isVisible){e++}if(f.isMaximized){f.minimize()}});if(e==0){return}var b=(c.height-(10*(e-1)))/e;this.maps.each(function(f){if(f.isVisible){f.show(0,0,c.width,b,"relative")}})},show:function(a){var e=this.container.getDimensions();var c=0;this.maps.each(function(f){if(f.isVisible){c++}if(f.isMaximized){f.minimize()}});c++;var b=(e.height-(10*(c-1)))/c;this.maps.each(function(f){if(f.isVisible){f.show(0,0,e.width,b,"relative")}});a.show(0,0,e.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.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.textLongerSnippet=b.textLongerSnippet;this.textShorterSnippet=b.textShorterSnippet;this.textFullDocument=b.textFullDocument;this.currentContent=null;this.currentDocuments=null;this.offset=0;this.offsetLabel=$(b.offsetId);this.fromsearch=false;this.siteimpact=null;this.previewEnabled=true;var a=this;this.idiom.register(null,"onNewContent",function(c){a.offset=0;a.previousButton.down(".enabled").hide();a.previousButton.down(".disabled").show();a.offsetLabel.update();a.fromsearch=c.fromSearch;a.siteimpact=c.siteImpact;a.update(c)});if(this.type=="semantic"){this.idiom.register("semanticrelated","preview",function(c){a.offset=0;a.previousButton.down(".enabled").hide();a.previousButton.down(".disabled").show();a.offsetLabel.update();a.updatePreview(c)});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","preview",function(c){a.offset=0;a.previousButton.down(".enabled").hide();a.previousButton.down(".disabled").show();a.offsetLabel.update();a.updatePreview(c)});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,"switchsample",function(c){a.sample=c.sample});this.minimalSentiment=b.minimalSentiment;this.maximalSentiment=b.maximalSentiment;this.idiom.register(null,"filterSentiment",function(c){a.minimalSentiment=c.minimalSentiment;a.maximalSentiment=c.maximalSentiment;a.updateInformation(a.currentContent,a.offset,a.searchTerm)});this.minimalDate=at.idiom.js.util.Date.parseDate(b.minimalDate);this.maximalDate=at.idiom.js.util.Date.parseDate(b.maximalDate);this.idiom.register(null,"changeDate",function(c){a.minimalDate=c.beginDate;a.maximalDate=c.endDate;a.updateInformation(a.currentContent,a.offset,a.searchTerm)});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()});this.idiom.register(null,"enablePreviewMode",function(c){if(c){this.previewEnabled=true}else{this.previewEnabled=false}}.bind(this))},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({content:this.currentContent,snapshotId:this.snapshot,fromSearch:this.fromsearch,siteImpact:this.siteimpact})},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(b,a){this.idiom.notify("main","setNewContent",{content:a});Event.stop(b);return false},displayInformation:function(m,p){var o=function(){};var q=function(){};var c=this;if(this.type=="semantic"){o=function(v,u,y){if(!this.previewEnabled){return}var w=$(v.relatedTarget||v.toElement);if(!at.idiom.js.util.Util.contains(u,w)){this.idiom.notify("geographic","setHighlightMarker",y);this.idiom.notify("main","previewContent",{content:y.content,mode:"summary"})}}.bind(this);q=function(v,u,y){if(!this.previewEnabled){return}var w=$(v.relatedTarget||v.toElement);if(!at.idiom.js.util.Util.contains(u,w)){this.idiom.notify("geographic","setNormalMarker",y);this.idiom.notify("main","resetContent",{})}}.bind(this)}if(this.type=="geographic"){o=function(v,u,y){if(!this.previewEnabled){return}var w=$(v.relatedTarget||v.toElement);if(!at.idiom.js.util.Util.contains(u,w)){this.idiom.notify("semantic","setHighlightMarker",y);this.idiom.notify("ontology","setHighlightMarker",y);this.idiom.notify("main","previewContent",{content:y.content,mode:"summary"})}}.bind(this);q=function(v,u,y){if(!this.previewEnabled){return}var w=$(v.relatedTarget||v.toElement);if(!at.idiom.js.util.Util.contains(u,w)){c.idiom.notify("semantic","setNormalMarker",y);c.idiom.notify("ontology","setNormalMarker",y);c.idiom.notify("main","resetContent",{})}}.bind(this)}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='#{textfulldocument}'><div class='sprite_marker_#{imagetype}_#{imageindex} normal'></div><div class='sprite_marker_#{imagetype}_#{imageindex}h highlight'></div><div class='sentiment #{posneg}'>#{semorient}</div></td><td class='content' title='#{textlongersnippet}'><div class='contentdiv'><div class='title summary'>#{title}</div><div class='snippet'><div class='short'>#{shortsnippet}</div><div class='long' title='#{textshortersnippet}' style='display: none;'>#{longsnippet}</div></div><span class='item'><div class='url fn' title='#{textfulldocument}'>#{url}</div></span></div></td><td class='sourceimage'><img src='#{sourceidimage}'></img></td></tr>");var e="<div class='viewBorder'><table class='entrytable' cellpadding='0' cellspacing='0'>";for(var n=0;n<5;n++){var l=m[n];if(l==null){continue}var r=l.shortSnippet.prefix;if(!r){r=""}var t=l.shortSnippet.match;if(!t){t=""}var g=l.shortSnippet.postfix;if(!g){g=""}var b=l.longSnippet.prefix;if(!b){b=""}var k=l.longSnippet.match;if(!k){k=""}var a=l.longSnippet.postfix;if(!a){a=""}var s={id:this.contentId+"_element_"+n,title:l.title!=null?l.title.substring(0,100):"",url:l.url!=null?l.url.escapeHTML():"",shortsnippet:r+"<span class='regExpMatch'>"+t+"</span>"+g,longsnippet:b+"<a href='"+this.tagUrl+k+"' rel='tag' class='regExpMatch' onclick='return false;'>"+k+"</a>"+a,imagetype:this.type,imageindex:n+1,rating:5-n,date:l.date,textlongersnippet:this.textLongerSnippet,textshortersnippet:this.textShorterSnippet,textfulldocument:this.textFullDocument,posneg:l.sentiment>0?"positive":l.sentiment<0?"negative":"",semorient:l.sentiment.toFixed(1),sourceidimage:this.imageUrl+"favicons/"+l.sourceId+".png"};e+=h.evaluate(s)}e+="</table></div>";this.content.update();this.content.update(e);this.idiom.loadEnd(this.loadName);for(var n=0;n<5;n++){var f=this.contentId+"_element_"+n;if(!$(f)){continue}Event.observe($(f),"mouseover",o.bindAsEventListener(this,$(f),{position:n+1,content:m[n]}));Event.observe($(f),"mouseout",q.bindAsEventListener(this,$(f),{position:n+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[n]));Event.observe($(f).down(".url"),"click",this.navigate.bindAsEventListener(this,m[n]))}if(this.type=="geographic"){this.idiom.notify("semantic","newDocuments",{content:p,documents:m})}else{if(this.type=="semantic"){this.idiom.notify("geographic","newDocuments",{content:p,documents:m})}}this.currentDocuments=m},update:function(a){this.currentContent=a.content;this.snapshot=a.snapshotId;this.updateInformation(a.content,this.offset,this.searchTerm,a.fromSearch,a.siteImpact)},updatePreview:function(c){var b=this;this.idiom.loadStart(this.loadName);var a=null;if(this.type=="semantic"){a=Client.getSemanticSimilarDocumentsPreview}else{if(this.type=="geographic"){a=Client.getGeographicSimilarDocumentsPreview}}a({text:c.text,offset:0,sample:this.sample,site:this.site,snapshotId:this.snapshot,minimalSentiment:this.minimalSentiment,maximalSentiment:this.maximalSentiment,startDate:this.minimalDate,endDate:this.maximalDate},{callback:function(f){if(b.type==="semantic"){var e=null;if(f.validLocation){e={targetLongitude:f.x,targetLatitude:f.y};b.idiom.notify("main","previewgeographiclocation",{name:f.locationName})}else{b.idiom.notify("main","previewgeographiclocation",{unknown:true})}b.displayInformation(f.similarDocuments,e)}else{if(b.type=="geographic"){var e=null;if(f.validLocation){e={semanticX:f.x,semanticY:f.y}}b.displayInformation(f.similarDocuments,e)}}},errorHandler:function(e){b.errorHandler(e)}})},updateInformation:function(f,k,c,b,g){var e=this;this.idiom.loadStart(this.loadName);var h=function(){};if(this.type=="semantic"){h=Client.getSemanticSimilarDocuments}if(this.type=="geographic"){h=Client.getGeographicSimilarDocuments}h({contentId:f.contentId,offset:k,searchTerm:c,sample:this.sample,site:this.site,snapshotId:this.snapshot,minimalSentiment:this.minimalSentiment,maximalSentiment:this.maximalSentiment,startDate:this.minimalDate,endDate:this.maximalDate,fromSearch:b?true:false,siteImpact:g},{callback:function(l){e.displayInformation(l,f)},errorHandler:function(l){e.errorHandler(l)}});if(this.rssEnabled){var a=this.rssUrl.gsub("[sample]",this.sample).gsub("[site]",this.site).gsub("[contentid]",f.contentId);$(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.sampleName=b.sampleName;this.site=b.site;this.snapshot=b.snapshot;this.displayConcordance=b.displayConcordance;this.siteImpact=b.siteImpact;this.count=50;this.actualCount=0;this.searchTerm="";this.fullQuery="";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.sortBy=null;this.sortOrder=null;this.result=[];this.firstHit=null;this.language=b.language;this.searchHint=b.searchHint;this.totalResultCountElement=$(b.totalResultCountElement);this.totalResultCountValueElement=$(b.totalResultCountValueElement);this.averageSentimentElement=$(b.averageSentimentElement);this.averageSentimentValueElement=$(b.averageSentimentValueElement);this.minimalSentiment=b.minimalSentiment;this.maximalSentiment=b.maximalSentiment;this.minimalDate=at.idiom.js.util.Date.parseDate(b.minimalDate);this.maximalDate=at.idiom.js.util.Date.parseDate(b.maximalDate);this.previewEnabled=true;this.textRemoveTooltip=b.textRemoveTooltip;this.textSearchExportTitle=b.textSearchExportTitle;this.textSearchExportQuery=b.textSearchExportQuery;this.textSearchExportDateRange=b.textSearchExportDateRange;this.textSearchExportSentimentFilter=b.textSearchExportSentimentFilter;this.textSearchExportSentimentFilterNone=b.textSearchExportSentimentFilterNone;this.textSearchExportSentimentFilterNegative=b.textSearchExportSentimentFilterNegative;this.textSearchExportSentimentFilterPositive=b.textSearchExportSentimentFilterPositive;this.textSearchExportSample=b.textSearchExportSample;this.textSearchExportResultCount=b.textSearchExportResultCount;this.textSearchExportResultOutOf=b.textSearchExportResultOutOf;this.cssUrl=b.cssUrl;this.resultCounts=b.resultCounts;this.template=new Template('<table id="ConcordanceTable" cellspacing="0" cellpadding="0" border="0">#{rows}</table>');this.documentTemplateRow=new Template('<tr class="document"><td class="date #{spacingclass}" onclick="IDIOM.notify(\'search\', \'disableSearchHit\', {contentid: #{contentid}, element: this}); Event.stop(event);">#{date}</td><td class="sentiment #{sentimentclass} #{spacingclass}">#{sentiment}</td><td class="matches #{spacingclass}">#{matches}</td></tr>');this.matchTemplate=new Template('<table cellspacing="0" cellpadding="0" border="0" width="100%">#{rows}</table>');this.matchTemplateRow=new Template('<tr><td class="result" onmouseup="IDIOM.notify(\'search\', \'selectSearchHit\', {contentid: #{contentid}, md5sum: \'#{md5sum}\', row: this, event: event}); Event.stop(event);" onmouseover="IDIOM.notify(\'search\', \'previewContent\', {contentid: #{contentid}, md5sum: \'#{md5sum}\'});" onmouseout="var target = event ? event.relatedTarget : event.toElement; if (! at.idiom.js.util.Util.contains(this, target)) {IDIOM.notify(\'search\', \'resetContent\', {delay: 0.1});}"><div class="overflow"><div class="clip"><div class="center"><span class="prefix">#{prefix}</span><span class="match sentiment #{sentimentclass}">#{match}</span><span class="postfix">#{postfix}</span></div></div></div></td></tr>');this.exportTemplate=new Template('<html><head><title>#{title}</title><link rel="stylesheet" type="text/css" href="#{cssUrl}"/></head><body class=\'searchresultexport\'><h3>#{title}</h3><div class="searchmetadata"><b>#{sampleHeader}:</b> #{sampleName}<br /><b>#{queryHeader}:</b> #{searchTerm}<br /><b>#{dateHeader}:</b> #{dateRange}<br /><b>#{resultcountHeader}:</b> #{resultCount} #{outof} #{totalResultCount}<br /><b>#{sentimentHeader}:</b> #{averageSentiment} (#{sentimentFilter})<br /></div><br />#{documents}</body></html>');this.exportDocumentTemplate=new Template('<div class="document"><div class="metadata">#{metadataPrefix}</div>#{extendedQuotes}<div class="metadata">#{metadataPostfix}</div></div><br />');this.exportDocumentQuoteTemplate=new Template('<div class="quote textcontent">#{text}</div>');var a=this;this.idiom.register("search","newSearch",function(c){a.search(c.term,c.count,false,c.fallbackContentId)});this.idiom.register("searchcountswitcher","select",function(c){a.search(a.fullQuery,c.data.name)});this.idiom.register("search","selectSearchHit",function(c){a.selectSearchHit(c.contentid,c.md5sum,c.row)});this.idiom.register("search","disableSearchHit",function(c){a.disableSearchHit(c.contentid,c.element)});this.idiom.register("search","previewContent",function(e){if(!this.previewEnabled){return}clearTimeout(this.previewDelayTimer);var c=e.delay?e.delay:0;this.previewDelayTimer=(function(){var f=this.getContentById(e.contentid);if(f.disabled){return}this.idiom.notify("main","previewContent",{content:f,mode:"extendedquote",md5sum:e.md5sum})}).bind(this).delay(c)}.bind(this));this.idiom.register("search","resetContent",function(e){if(!this.previewEnabled){return}clearTimeout(this.previewDelayTimer);var c=e.delay?e.delay:0;this.previewDelayTimer=(function(){this.idiom.notify("main","resetContent",{})}).bind(this).delay(c)}.bind(this));this.idiom.register("search","newTagSearch",function(c){a.setValue(c);a.submit(null)});this.idiom.register(null,"changeSiteImpact",function(c){a.siteImpact=c.siteImpact;if(a.searchDisplayed){a.search(a.searchTerm,a.count)}});$(b.semanticOrientationDocumentButton).observe("click",function(){a.sortResultToggle("documentsentiment")});$(b.semanticOrientationSentenceButton).observe("click",function(){a.sortResultToggle("sentencesentiment")});$(b.sortButtonDate).observe("click",function(){a.sortResultToggle("date")});this.toggleButton.observe("click",this.toggleConcordance.bindAsEventListener(this));if(b.maximizeButton){$(b.maximizeButton).observe("click",this.maximize.bindAsEventListener(this))}if(b.minimizeButton){$(b.minimizeButton).observe("click",this.minimize.bindAsEventListener(this))}$(b.closeButton).observe("click",function(){a.showHint(true);a.closeConcordance();a.idiom.notify("search","closed",{})});this.searchForm.observe("submit",this.submit.bindAsEventListener(this));$(b.searchInputId).observe("click",this.hideHint.bindAsEventListener(this));$(b.searchInputId).observe("blur",this.showHint.bindAsEventListener(this));this.idiom.register(null,"restoreState",function(c){if(c.snapshotid){a.snapshot=c.snapshotid}if(c.fullQuery){a.search(c.fullQuery,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});this.idiom.register(null,"filterSentiment",function(c){a.minimalSentiment=c.minimalSentiment;a.maximalSentiment=c.maximalSentiment;if(a.searchDisplayed){a.search(a.fullQuery,a.count)}});this.idiom.register(null,"changeDate",function(c){a.minimalDate=c.beginDate;a.maximalDate=c.endDate;if(a.searchDisplayed){a.search(a.fullQuery,a.count)}});this.idiom.register(null,"switchsample",function(c){a.sample=c.sample});if(b.exportButton){$(b.exportButton).observe("click",function(){a.exportSearchResults()})}this.idiom.register(null,"enablePreviewMode",function(c){if(c){this.previewEnabled=true}else{this.previewEnabled=false}}.bind(this))},formatDate:function(b){var e=b.getMonth()+1;if(e<10){e="0"+e}var c=b.getFullYear();var a=b.getDate();if(a<10){a="0"+a}if(this.language=="de"){return a+"-"+e}else{if(this.language=="en"){return e+"/"+a}else{return a+"-"+e}}},formatDateForSearch:function(a){return at.idiom.js.util.Date.formatDateForSearch(a)},displayInformationFrame:function(b,a){this.concordanceContent.update(a);if(b){this.idiom.notify("main","switchBig",null);this.idiom.notify("charts","hide",null);this.showConcordance()}},displayInformationDocument:function(a){var g="";var f=0;for(var e=0;e<a.searchMatches.length;e++){f++;var c=a.searchMatches[e];var b="";if(c.sentiment>0){b="positive"}else{if(c.sentiment<0){b="negative"}}g+=this.matchTemplateRow.evaluate({prefix:c.prefix,match:c.match,postfix:c.postfix,sentiment:c.sentiment.toFixed(0),sentimentclass:b,contentid:a.contentId,md5sum:c.md5sum,removetooltip:this.textRemoveTooltip})}return{count:f,html:this.matchTemplate.evaluate({rows:g})}},getContentById:function(a){return $(this.result).find(function(b){return b.contentId==a})},disableContentById:function(b){var a=this.getContentById(b);a.disabled=!a.disabled},selectSearchHit:function(e,c,b){this.minimize();var a=this.getContentById(e);this.idiom.notify("main","setNewContent",{content:a,md5sum:c,showsnippet:true});$("ConcordanceTable").select(".matches .result").invoke("removeClassName","selected");$(b).addClassName("selected")},disableSearchHit:function(b,a){$(a).up("tr").toggleClassName("disabled");this.disableContentById(b);this.displayInformationDone(true,true);this.displayResultCountAndAverageSentiment()},displayInformationMain:function(a){var b=$H(a.extendedQuotes).keys()[0];this.idiom.notify("main","setNewContent",{content:a,nostorestate:true,fromsearch:true,siteimpact:this.siteImpact,md5sum:b});this.idiom.notify("tags","minimize",null);this.idiom.notify("ontology","minimize",null);this.hideHint()},displayInformation:function(e,g,h,b){if(e.documents.length==0){this.displayMessage("Term not found.");this.concordanceContent.update("No documents matching your search query have been found.");if(!this.searchDisplayed){this.idiom.notify("charts","show",null)}if(b){this.idiom.notify("main","setNewContentId",{contentId:b})}this.idiom.loadEnd(this.loadName);return}if(e.indexError){this.displayMessage("Error retrieving search results.");this.concordanceContent.update("The search index is inaccessible at the moment. Please try again later.");this.idiom.loadEnd(this.loadName);return}if(e.queryError){this.displayMessage("Incorrect query");this.concordanceContent.update('Your query <span class="incorrectquery">'+element.attributes.query.escapeHTML()+"</span> could not be understood.");this.idiom.loadEnd(this.loadName);return}this.searchTerm=e.query;if(g){this.firstHit=e.firstHit;this.displayInformationMain(e.firstHit)}if(this.displayConcordance){this.sortBy="date";this.sortOrder="desc";this.result=e.documents;var a=this.sortResult(this.result,this.sortBy,this.sortOrder);this.displayDocuments(a,g)}this.totalResultCount=e.totalResultCount;this.totalResultCountValueElement.update(this.totalResultCount);this.totalResultCountElement.show();this.displayResultCountAndAverageSentiment();var c=this.resultCounts.find(function(k){return k>this.totalResultCount},this)||this.resultCounts.max();var f=this.resultCounts.findAll(function(k){return k<=c},this);this.idiom.notify("searchcountswitcher","enable",{names:f});this.displayInformationDone(g)},displayDocuments:function(f,h){if(this.displayConcordance){var c="";var b=0;for(var e=0;e<f.length;e++){var a=f[e];var g=this.displayInformationDocument(a);if(g.count>0){var k="";if(!(b==1&&g.count==1)&&b!=0){k="spacing"}c+=this.documentTemplateRow.evaluate({date:this.formatDate(a.date),matches:g.html,sentiment:(a.sentiment>0?"+":"")+a.sentiment.toFixed(0),sentimentclass:a.sentiment>0?"positive":a.sentiment<0?"negative":"",spacingclass:k,contentid:a.contentId})}b=g.count}c=this.template.evaluate({rows:c});this.displayInformationFrame(h,c)}},displayInformationDone:function(a,b){this.idiom.loadEnd(this.loadName);if(a){this.idiom.notify("geographic","addSearchMarkers",this.result);this.idiom.notify("geographic","addSearchLines",this.result);this.idiom.notify("semantic","addSearchMarkers",this.result);if(!b){this.idiom.notify("keywordgraph","setTerm",{term:this.getSearchTerm()});this.idiom.notify("keywordgraph","show",{})}}},sortResultToggle:function(b){if(this.sortBy==b){if(this.sortOrder=="asc"){this.sortOrder="desc"}else{this.sortOrder="asc"}}else{this.sortOrder="asc"}this.sortBy=b;var a=this.sortResult(this.result,this.sortBy,this.sortOrder);this.displayDocuments(a,false)},createSingleMatch:function(a,b,c){if(c==null){c={};c.searchMatches=[];c.contentId=a.contentId;c.date=a.date;c.semanticX=a.semanticX;c.semanticY=a.semanticY;c.sourceLatitude=a.sourceLatitude;c.sourceLongitude=a.sourceLongitude;c.targetLatitude=a.targetLatitude;c.targetLongitude=a.targetLongitude;c.title=a.title;c.sentiment=a.sentiment;c.searchScore=a.searchScore}c.searchMatches.push(b);return c},sortResult:function(n,m,e){if(!n){return}if(m=="sentencesentiment"){var b=[];for(var g=0;g<n.length;g++){var k=n[g];for(var f=0;f<k.searchMatches.length;f++){var h=this.createSingleMatch(k,k.searchMatches[f],null);b.push(h)}}n=b}else{var b=[];for(var g=0;g<n.length;g++){var k=n[g];if(!k.searchMatches){continue}var l=k.searchMatches.pluck("match").uniq();if(l.length==1){b.push(k);continue}var c=this;$(l).each(function(o){var p=null;k.searchMatches.findAll(function(q){return q.match==o}).each(function(q){p=c.createSingleMatch(k,q,p)});b.push(p)})}n=b}var c=this;var a=n.sort(function(p,o){return c.sort(p,o,m,e)});return a},sort:function(f,e,h,c){var g=0;var k=this.getSearchTerm().toLowerCase().escapeHTML().replace(/"/g,"");g=this.sortByMatch(f,e,k);if(g!=0&&h!="sentencesentiment"){return g}if(h=="date"){g=f.date.getTime()-e.date.getTime()}else{if(h=="documentsentiment"){g=f.sentiment-e.sentiment}else{if(h=="sentencesentiment"){g=f.searchMatches[0].sentiment-e.searchMatches[0].sentiment}}}if(g==0){g=f.searchScore-e.searchScore}if(c=="asc"){return g}else{return -g}},sortByMatch:function(e,c,h){var g=e.searchMatches[0].match.toLowerCase().replace(/&nbsp;/g," ");var f=c.searchMatches[0].match.toLowerCase().replace(/&nbsp;/g," ");if(g==f){return 0}if(h==g){return -1}if(h==f){return 1}if(g<f){return -1}else{return 1}},displayMessage:function(b){this.searchMessage.update(b);var c=this.searchInput.positionedOffset().top+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.getValue();if(a==this.searchHint){Event.stop(b);return false}this.idiom.notify("search","newSearch",{term:a});Event.stop(b);return false},search:function(c,f,b,a){this.fullQuery=c;this.searchInput.value=c;if(!f){f=this.count}if(f<0){f=1}if(f>1000){f=1000}this.count=f;this.result=[];this.idiom.notify("searchcountswitcher","set",{name:f});this.totalResultCountElement.hide();this.averageSentimentElement.hide();this.count=f;this.idiom.loadStart(this.loadName);this.searchMessage.hide();var e=this;this.hideHint();if(this.searchDisplayed){this.displayInformationFrame(true)}Client.search({searchTerm:c,sample:this.sample,site:this.site,snapshotId:this.snapshot,count:f,siteImpact:this.siteImpact,minimalSentiment:this.minimalSentiment,maximalSentiment:this.maximalSentiment,startDate:this.minimalDate,endDate:this.maximalDate},{callback:function(g){e.displayInformation(g,true,true,a)},errorHandler:function(h,g){e.errorHandler(h,g)}});if(!b){this.idiom.notify("history","storeState",{searchterm:c,searchcount:f,searchconcordance:this.concordanceMaximized?"big":"small"})}},searchMore:function(a){this.idiom.notify("search","newSearch",{term:this.fullQuery,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==this.searchHint){a=""}return a},errorHandler:function(b,a){this.idiom.notify("error","display","Error in search: "+b+" "+a.message)},showHint:function(a){if(this.searchInput.value==""||a){this.searchInput.value=this.searchHint;this.searchInput.addClassName("hint");this.searchInput.removeClassName("nohint")}},hideHint:function(){if(this.searchInput.value==this.searchHint){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()},getSearchTerm:function(){return this.searchTerm},getSearchCount:function(){return this.count},toggleSearchForm:function(a){if(a){this.searchForm.enable()}else{this.searchForm.disable()}},exportSearchResults:function(){var b=$(this.result).reject(function(f){return f.disabled}).inject("",function(g,h){var k=h.metadataPrefix.gsub(/<span\s+class\s*=\s*\"geo\s*microformats\s*\"\s*>.*?<\/span>.*?<\/span>.*?<\/span>/,"");var f=$H(h.extendedQuotes).inject("",function(o,n){var p=n.value.gsub(/<a((\s+(\w|\w[\w-]*\w)(\s*=\s*(?:\".*?\"|'.*?'|[^'\">\s]+))?)+\s*|\s*)>(.*?)<\/a>/,"#{5}");var m=this.searchTerm.replace(/"/g,"");p=p.gsub(new RegExp("(>[^<]*?\\b)("+m+")(\\b[^>]*?<)","i"),function(q){return q[1]+"<span class='regExpMatch'>"+q[2]+"</span>"+q[3]});o+=this.exportDocumentQuoteTemplate.evaluate({text:p});return o},this);var l=h.metadataPostfix;g+=this.exportDocumentTemplate.evaluate({metadataPrefix:k,extendedQuotes:f,metadataPostfix:l});return g},this);var c=this.textSearchExportSentimentFilterNone;if(this.minimalSentiment!=null&&this.minimalSentiment>=0){c=this.textSearchExportSentimentFilterPositive}else{if(this.maximalSentiment!=null&&this.maximalSentiment<=0){c=this.textSearchExportSentimentFilterNegative}}var e=this.exportTemplate.evaluate({title:this.textSearchExportTitle,cssUrl:this.cssUrl,sampleHeader:this.textSearchExportSample,sampleName:this.sampleName,queryHeader:this.textSearchExportQuery,searchTerm:this.searchTerm,dateHeader:this.textSearchExportDateRange,dateRange:at.idiom.js.util.Date.formatFullDate(this.minimalDate,this.language)+" - "+at.idiom.js.util.Date.formatFullDate(this.maximalDate,this.language),resultcountHeader:this.textSearchExportResultCount,resultCount:this.actualCount,outof:this.textSearchExportResultOutOf,totalResultCount:this.totalResultCount,sentimentHeader:this.textSearchExportSentimentFilter,averageSentiment:this.averageSentiment,sentimentFilter:c,documents:b});var a=window.open("","","dependent=yes,location=no,menubar=yes,resizable=yes,scrollbars=yes");a.document.write(e)},displayResultCountAndAverageSentiment:function(){var a=this.result.inject({count:0,averageSentiment:0},function(b,c){if(c.disabled){return b}return{count:b.count+1,averageSentiment:(c.sentiment+b.count*b.averageSentiment)/(b.count+1)}});this.averageSentiment=a.averageSentiment.toFixed(1);this.averageSentimentValueElement.update(this.averageSentiment);this.averageSentimentValueElement.removeClassName("positive");this.averageSentimentValueElement.removeClassName("negative");if(this.averageSentiment>0){this.averageSentimentValueElement.addClassName("positive")}else{this.averageSentimentValueElement.addClassName("negative")}this.averageSentimentElement.show();this.actualCount=a.count;this.idiom.notify("searchcountswitcher","setoverride",this.actualCount)}});at.idiom.js.viewer=Class.create();at.idiom.js.viewer.Viewer=Class.create(at.idiom.js.window.Window,{initialize:function($super,f){$super(f);this.loadId=f.loadId;this.sample=f.sample;this.site=f.site;this.snapshot=f.snapshot;this.reloadAfterSnapshotChange=false;this.category=f.category;this.mainContent=$(f.mainContentId);this.mainContentContent=$(f.mainContentContentId);this.mainContentTitle=$(f.mainContentTitleId);this.mainContentTitleActiveDocument=$(f.mainContentTitleActiveDocumentId);this.mainContentTitleUploadDocument=$(f.mainContentTitleUploadDocumentId);this.mainContentTitleAnalyzingDocument=$(f.mainContentTitleAnalyzingDocumentId);this.mainContentTitleAnalyzingDocumentName=$(f.mainContentTitleAnalyzingDocumentNameId);this.mainContentTitleFillForm=$(f.mainContentTitleFillFormId);this.mainContentPermalink=$(f.mainContentPermalinkId);this.mainContentAddContent=$(f.mainContentAddContentId);this.contentModeSwitcher=f.contentModeSwitcher;this.siteImpact=f.siteImpact;this.currentContent=null;this.currentSentence=null;this.currentMode=null;this.currentVideoUrl=null;this.idiom.register("main","setNewContent",function(g){this.currentMode=null;this.update(g);this.updateContentModeSwitcher();this.mainContentTitle.down(".preview").hide()}.bind(this));this.idiom.register("main","setNewContentId",function(g){this.displayContentById(g.contentId)}.bind(this));this.idiom.register("main","previewContent",function(g){this.preview(g);this.mainContentTitle.down(".preview").show()}.bind(this));this.idiom.register("main","resetContent",function(g){this.reset();this.updateContentModeSwitcher();this.mainContentTitle.down(".preview").hide()}.bind(this));this.idiom.register("main","displayNewStartDocument",function(g){this.displayNewStartDocument(g)}.bind(this));this.idiom.register("main","switchSmall",function(){this.switchSmall()}.bind(this));this.idiom.register("main","switchBig",function(){this.switchBig()}.bind(this));this.idiom.register("main","switchFull",function(){this.switchFull()}.bind(this));this.searchTerm="";this.idiom.register("search","newSearch",function(g){this.searchTerm=g.term}.bind(this));this.idiom.register(null,"restoreState",function(g){if(g.contentid){this.snapshot=g.snapshotid;this.update({contentid:g.contentid,nostorestate:true})}}.bind(this));this.idiom.register(null,"changeSiteImpact",function(g){this.siteImpact=g.siteImpact}.bind(this));if(f.addContentEnabled){$(f.mainContentAddContentId).observe("click",function(){this.idiom.notify("addcontent","show",{})}.bind(this))}if(f.videoEnabled){$(f.mainContentDisplayVideo).observe("click",function(){this.idiom.notify("video","show",{url:this.currentVideoUrl})}.bind(this));this.idiom.register("main","showAddVideo",function(g){$(f.mainContentDisplayVideo).show();this.currentVideoUrl=g.url}.bind(this));this.idiom.register("main","hideAddVideo",function(){$(f.mainContentDisplayVideo).hide()})}this.idiom.register("main","showAddContent",function(){this.switchAddContent(true)}.bind(this));this.idiom.register("main","hideAddContent",function(){this.switchAddContent(false)}.bind(this));this.idiom.register("main","displayTitle",function(g){this.switchTitle(g)}.bind(this));this.idiom.register("categorychooser","select",function(g){this.category=g.key}.bind(this));this.idiom.register(null,"changeSnapshot",function(g){this.snapshot=g.snapshotid;this.reloadAfterSnapshotChange=true}.bind(this));this.idiom.register(null,"switchsample",function(g){this.sample=g.sample}.bind(this));this.idiom.register(this.contentModeSwitcher,"select",function(g){this.switchMode(g.data.name)}.bind(this));this.minimalSentiment=null;this.maximalSentiment=null;this.idiom.register(null,"filterSentiment",function(g){this.minimalSentiment=g.minimalSentiment;this.maximalSentiment=g.maximalSentiment}.bind(this));if(f.editEnabled){this.editCookie=new at.idiom.js.cookie.Cookie();if(this.editCookie.getData("text")){$(f.mainContentEditLink).show()}$(f.mainContentEditLink).observe("click",function(){this.idiom.notify("main","edit",{})}.bind(this));$(f.mainContentEditNewLink).observe("click",function(){this.idiom.notify("main","edit",{newdocument:true})}.bind(this));$(f.mainContentEditClose).observe("click",function(){this.idiom.notify("main","closeedit",{})}.bind(this));this.idiom.register("main","edit",function(g){this.mainContentContent.hide(),$(f.mainContentEditor).show();$(f.mainContentEditLink).show();$(f.mainContentEditClose).show();this.idiom.notify(null,"enablePreviewMode",false);this.idiom.notify("contentmodeswitcher","set",{name:"editor"});this.idiom.notify("contentmodeswitcher","show",{names:["editor"]});var l=this.editCookie.getData("text");var k=this.editCookie.getData("title");if(l){$(f.mainContentEditorArea).value=l}else{$(f.mainContentEditorArea).value=f.textDefaultEditContent}if(k){$(f.mainContentEditorTitle).value=k}else{$(f.mainContentEditorTitle).value=f.textDefaultEditTitle}if(g.newdocument){if((k&&k!=""&&k!=f.textDefaultEditTitle)||(l&&l!=""&&l!=f.textDefaultEditContent)){var h=window.confirm(f.textEditResetConfirmation);if(h){$(f.mainContentEditorArea).value=f.textDefaultEditContent;$(f.mainContentEditorTitle).value=f.textDefaultEditTitle;this.editCookie.removeData("text");this.editCookie.removeData("title")}}}Client.getClientLocation({callback:function(m){$(f.mainContentEditorSourceGeographicLocation).update(m);if(m&&m!="--"){$(f.mainContentEditorSourceGeographicFlag).src=f.mainContentEditorFlagUrl.replace(/\[ID\]/,m.toUpperCase());$(f.mainContentEditorSourceGeographicFlag).show()}else{$(f.mainContentEditorSourceGeographicFlag).hide()}},errorHandler:function(m){$(f.mainContentEditorSourceGeographicLocation).update("?");this.idiom.notify("error","display",m)}})}.bind(this));this.idiom.register("main","closeedit",function(){$(f.mainContentEditor).hide();$(f.mainContentEditClose).hide();this.mainContentContent.show(),this.idiom.notify(null,"enablePreviewMode",true);this.updateContentModeSwitcher()}.bind(this));this.idiom.register("main","previewgeographiclocation",function(g){if(g.unknown){$(f.mainContentEditorGeographicLocation).update(f.textUnknownLocation)}else{$(f.mainContentEditorGeographicLocation).update(g.name)}});var c=false;var b=false;setInterval(function(){if(c||b){c=false;b=false;this.idiom.notify("semanticrelated","preview",{text:$(f.mainContentEditorTitle).value+" "+$(f.mainContentEditorArea).value});this.idiom.notify("geographicrelated","preview",{text:$(f.mainContentEditorTitle).value+" "+$(f.mainContentEditorArea).value});this.editCookie.setData("text",$(f.mainContentEditorArea).value);this.editCookie.setData("title",$(f.mainContentEditorTitle).value)}}.bind(this),f.editRequestDelay);var e="";$(f.mainContentEditorArea).observe("keyup",function(){var g=$(f.mainContentEditorArea).value;if(e!=g){c=true}e=g});var a="";$(f.mainContentEditorTitle).observe("keyup",function(){var g=$(f.mainContentEditorTitle).value;if(a!=g){b=true}a=g})}},setStartDocument:function(c,b,a,e){this.idiom.notify(null,"onNewContent",{content:c,snapshotId:this.snapshot,fromSearch:a,searchTerm:this.searchTerm,siteImpact:e});this.idiom.notify("video","update",{url:c.url});if(!b){this.idiom.notify("history","storeState",{contentid:c.contentId,snapshotid:this.snapshot})}},displayContentById:function(a){this.idiom.loadStart(this.loadId);Client.getDocument({sample:this.sample,site:this.site,snapshotId:this.snapshot,contentId:a},{callback:function(b){this.idiom.loadEnd(this.loadId);this.update({content:b})}.bind(this),errorHandler:function(b){this.idiom.loadEnd(this.loadId);this.idiom.notify("error","display",b)}.bind(this)})},displayNewStartDocument:function(a){Client.getStartDocument({sample:this.sample,site:this.site,snapshotId:this.snapshot,date:a.date,chartCategory:a.chartcategory,chartType:a.charttype,siteImpact:this.siteImpact,minimalSentiment:this.minimalSentiment,maximalSentiment:this.maximalSentiment},{callback:function(b){this.update({content:b})}.bind(this),errorHandler:function(b){this.idiom.notify("error","display",b)}.bind(this)})},updateMainView:function(c,g,f){if(c==null){c=this.currentContent}if(g==null){if(this.currentMode==null){g=c.defaultMode}else{g=this.currentMode}}if(f==null){f=this.currentSentence}var e=null;if(g=="summary"&&c.summaryContent!=null){e=c.summaryContent}else{if(g=="fulltext"&&c.fullContent!=null){e=c.fullContent}else{if(g=="extendedquote"&&c.extendedQuotes!=null){e=c.extendedQuotes[f]}}}var a="<div class='textContent'>"+e+"</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.metadataPrefix+a+c.metadataPostfix);this.mainContentPermalink.href=c.permalink;this.mainContentContent.scrollTop=0;this.updateContentModeSwitcher(g)},updateContentModeSwitcher:function(a){var b=[];if(this.currentContent.summaryContent!=null){b.push("summary")}if(this.currentContent.fullContent!=null){b.push("fulltext")}if($H(this.currentContent.extendedQuotes).keys().length>0){b.push("extendedquote")}this.idiom.notify(this.contentModeSwitcher,"enable",{names:b});this.idiom.notify(this.contentModeSwitcher,"show",{names:b});this.idiom.notify(this.contentModeSwitcher,"set",{name:a?a:this.currentMode})},update:function(a){var b=a.content.contentId;this.reloadAfterSnapshotChange=false;this.currentContent=a.content;this.currentSentence=a.md5sum;if(a.showsnippet){this.currentMode="extendedquote";this.updateMainView(a.content,"extendedquote",a.md5sum);this.setStartDocument(a.content,a.nostorestate,a.fromsearch,a.siteimpact)}else{this.currentMode=a.content.defaultMode;this.updateMainView(a.content);this.setStartDocument(a.content,a.nostorestate,a.fromsearch,a.siteimpact)}},preview:function(a){if(a.md5sum&&a.mode=="extendedquote"){this.updateMainView(a.content,a.mode,a.md5sum)}else{this.updateMainView(a.content,a.content.defaultMode)}this.idiom.notify("maps","preview",a.content)},reset:function(){this.updateMainView();this.idiom.notify("maps","resetPreview",{})},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.currentMode=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,c){$super(c);this.sample=c.sample;this.site=c.site;this.snapshot=c.snapshot;this.loadName=c.loadId;this.chartContainerClass=c.chartContainerClass;this.legendContainerClass=c.legendContainerClass;this.chartsId=c.chartsId;this.chartCategoriesEnabled=c.chartCategoriesEnabled;if(this.chartCategoriesEnabled){this.chartCategoryDisplay=$(c.chartCategory)}this.textHideChartSeries=c.textHideChartSeries;this.imageUrl=c.imageUrl;this.chartCategory=null;this.chartCategoryName=null;this.chartType=c.currentChartTypeGlobal;this.currentChart=c.currentChartType;this.currentBeginDate=at.idiom.js.util.Date.parseDate(c.beginDate);this.currentEndDate=at.idiom.js.util.Date.parseDate(c.endDate);this.charts=$H();this.siteImpact=c.siteImpact;this.maxPoints=c.maxPoints?c.maxPoints:20;this.language=c.language;this.idiom.register("charts","hide",function(){this.hideWindow()}.bind(this));this.idiom.register("charts","show",function(){this.showWindow();this.showChart(this.currentChart,false)}.bind(this));this.idiom.register(null,"hide",function(){this.hideWindow()}.bind(this));this.idiom.register(null,"show",function(){this.showWindow()}.bind(this));this.idiom.register("categorychooser","select",function(e){this.terms=[];this.colours=$H();this.loadCharts(e.data.name,e.data.displayName,false)}.bind(this));this.idiom.register(null,"changeSnapshot",function(e){this.snapshot=e.snapshotid}.bind(this));this.idiom.register(null,"changeDate",function(e){this.currentBeginDate=e.beginDate;this.currentEndDate=e.endDate;if(this.isVisible){this.idiom.notify("main","displayNewStartDocument",{date:this.currentEndDate,chartcategory:this.chartCategory,charttype:this.chartType});this.loadCharts(this.chartCategory,this.chartCategoryName,false)}}.bind(this));this.idiom.register(null,"changeSiteImpact",function(e){this.siteImpact=e.siteImpact;this.loadCharts(this.chartCategory,this.chartCategoryName,false)}.bind(this));this.idiom.register("charttypechooser","select",function(f){var e=f.data.name;if(f.data.name=="frequency"){if(this.sentiment=="positive"){e="frequencyPositive"}else{if(this.sentiment=="negative"){e="frequencyNegative"}else{e="frequencyTotal"}}}this.showChart(e,false)}.bind(this));this.sentiment="";this.idiom.register("charts","switchSentiment",function(e){this.sentiment=e.sentiment;if(this.chartType!="frequency"){return}if(this.sentiment=="positive"){this.showChart("frequencyPositive",false)}else{if(this.sentiment=="negative"){this.showChart("frequencyNegative",false)}else{this.showChart("frequencyTotal",false)}}}.bind(this));var a=null;var b=null;this.idiom.register(null,"filterSentiment",function(e){this.minimalSentiment=e.minimalSentiment;this.maximalSentiment=e.maximalSentiment}.bind(this));this.legendTemplate=new Template('<li class="legendEntry #{disabled}"><div class="colour" title="#{hidechartseries}" style="background-color:#{colour}"></div><div class="name">#{name}</div></li>');this.termChooser=new at.idiom.js.menu.OverlayMenu({idiom:this.idiom,notifyName:"charttermchooser",entry:$("ChartTerms"),mainContentElement:$("Content"),displayElement:$("ChartTermsTerm"),align:"left",content:null,imageUrl:this.imageUrl,selectCount:6,forceColumns:true});this.disabledSeries=$H();this.terms=[];this.colours=$H();this.idiom.register("charttermchooser","select",function(e){this.terms=e.data.collect(function(f){return f.name});this.disabledSeries=$H();this.loadCharts(this.chartCategory,this.chartCategoryName,false)}.bind(this));this.idiom.register(null,"switchsample",function(e){this.sample=e.sample;this.loadCharts(this.chartCategory,this.chartCategoryName,false)}.bind(this));this.trackQuery=null;this.trackStartDate=null;this.trackEndDate=null;$(this.findContainer()).observe("ProtoChart:plotclick",function(e){this.idiom.notify("search","newSearch",{term:this.trackQuery+" from:"+at.idiom.js.util.Date.formatDateForSearch(this.trackStartDate)+" to:"+at.idiom.js.util.Date.formatDateForSearch(this.trackEndDate)})}.bind(this))},createCharts:function(b,c){this.idiom.loadEnd(this.loadName);this.charts=$H();$(b.charts).each(function(f){this.createChart(f.name,f.type,f.siteImpact,f.data)},this);this.showChart(this.currentChart,c);var a=[];var e=this.charts.get(this.currentChart).data.values().collect(function(f){return f.label});b.availableTerms.each(function(f){a.push({name:f.term,displayName:f.term,selectedDisplayName:f.term,selected:(e.indexOf(f.term)>-1)?true:false,enabled:true,shown:true,category:f.category})});this.termChooser.setContent(a);if(b.availableTerms.size()>0){$("ChartTerms").show()}else{$("ChartTerms").hide()}},createChart:function(b,f,g,k){var h=$H();var e=$H();var a=Number.MAX_VALUE;var c=Number.MIN_VALUE;this.colours=$H();k.series.each(function(o){var n={label:o.name,displayName:o.displayName,queryName:o.queryName,data:[],color:o.colour,enabled:true};var m=0;var l=Number.MIN_VALUE;$H(o.data).each(function(r){var q=r.key;var p=new Date(parseInt(q.substring(0,4),10),parseInt(q.substring(5,7),10)-1,parseInt(q.substring(8,10),10));if(r.value!=null){n.data.push([p.getTime(),r.value])}if(p.getTime()>m){m=p.getTime();l=r.value}if(p.getTime()>c){c=p.getTime()}if(p.getTime()<a){a=p.getTime()}});h.set(o.name,n);e.set(o.name,{value:l,name:o.name,displayname:o.displayName,queryterm:o.queryName,colour:o.colour});this.colours.set(o.name,o.colour)},this);this.charts.set(b,{name:b,type:f,siteImpact:g,data:h,legend:e,firstDate:a,lastDate:c})},usePoints:function(c){var b=0;for(var a=0;a<c.length;a++){b=Math.max(b,c[a].data.length)}return b<=this.maxPoints},getTickSize:function(b,c){var a=c-b;if(a<11*24*60*60*1000){return[1,"day"]}if(a<11*7*24*60*60*1000){return[7,"day"]}return[1,"month"]},createChartObject:function(c,b,e){var a=this.findContainer();a.update();new Proto.Chart(a,c,{xaxis:{mode:"time",tickSize:this.getTickSize(b,e),min:b,max:e,monthNames:at.idiom.js.util.Months.get(this.language)},lines:{show:true},points:{show:this.usePoints(c)},mouse:{track:true,fixedPosition:false,sensibility:10000000,trackFormatter:function(h){var f=at.idiom.js.util.Date.formatShortDate(new Date(parseInt(h.x)),this.language);var g=h.series.queryName.indexOf(" ")!=-1?'"'+h.series.queryName+'"':h.series.queryName;this.getDocumentKeywordsForTerm(g,new Date(parseInt(h.x)),7,3,function(k){if(k==null||k.length==0){h.callback(null)}var l="<span class='caption'><span class='serieslabel'>"+h.series.displayName+"</span> ("+f+")</span>";$(k).each(function(m){l+="<span class='keyword'>"+m.term+"</span>"});h.callback(l)});return null}.bind(this)},grid:{clickable:true},allowDataClick:false})},getDocumentKeywordsForTerm:function(c,b,a,e,f){if(a>15){f(null)}this.trackEndDate=b;this.trackStartDate=new Date(parseInt(b.getTime()-a*24*60*60*1000));this.trackQuery=c;Client.getKeywords({sample:this.sample,site:this.site,snapshotId:this.snapshot,term:c,limit:e,existingTerms:[],minimalSentiment:this.minimalSentiment,maximalSentiment:this.maximalSentiment,startDate:this.trackStartDate,endDate:this.trackEndDate},{callback:function(g){if(g.length==0){this.getDocumentKeywordsForTerm(c,b,a+3,e,f);return}f(g)}.bind(this),errorHandler:function(h,g){this.errorHandler(h,g)}.bind(this)})},createLegend:function(a,f){var c=this.findLegend();var e=this.legendTemplate.evaluate({colour:f.colour,name:f.displayname,hidechartseries:this.textHideChartSeries,disabled:f.enabled?"":"deselected"});c.insert(e);var b=$(c).select(".legendEntry").last();Event.observe($(b).down(".colour"),"click",this.toggleChartSeries.bind(this,b,a,f.name));Event.observe($(b).down(".name"),"click",this.idiom.notify.bind(this.idiom,"search","newSearch",{term:f.queryterm.indexOf(" ")!=-1&&f.queryterm.indexOf('"')<0?'"'+f.queryterm+'"':f.queryterm}))},toggleChartSeries:function(e,b,c){var f=this.charts.get(b);var a=f.data.get(c).enabled;f.data.get(c).enabled=!a;this.disabledSeries.set(c,a);if(a){$(e).addClassName("deselected")}else{$(e).removeClassName("deselected")}var g=[];f.data.each(function(h){if(h.value.enabled){g.push(h.value)}});this.createChartObject(g,f.firstDate,f.lastDate);this.idiom.notify("charttermchooser","set",{name:c})},loadCharts:function(c,a,e){this.chartCategory=c;this.chartCategoryName=a;this.idiom.loadStart(this.loadName);var b=[];this.terms.each(function(f){b.push({term:f,colour:this.colours.get(f)})},this);Client.getCharts({sample:this.sample,site:this.site,category:c,startDate:this.currentBeginDate,endDate:this.currentEndDate,siteImpact:this.siteImpact,termColours:b},{callback:function(f){this.createCharts(f,e)}.bind(this)})},errorHandler:function(b,a){if(!a){a=""}this.idiom.notify("error","display","Error in chart: "+b+" "+a)},showChart:function(a,b){this.currentChart=a;this.charts.each(function(h){var f=h.value;if(f.name==a){this.chartType=f.type;var c=f.legend.values();c.each(function(k){k.enabled=this.disabledSeries.get(k.name)?false:true},this);c.sort(function(l,k){return k.value-l.value});this.findLegend().update();$(c).each(function(k){this.createLegend(f.name,k)},this);f.data.values().each(function(k){k.enabled=this.disabledSeries.get(k.label)?false:true},this);var g=f.data.values().findAll(function(k){return k.enabled});this.createChartObject(g,f.firstDate,f.lastDate);this.toggleAxisLabel(f.type,f.siteImpact);if(!b){this.idiom.notify("main","displayNewStartDocument",{date:this.currentEndDate,charttype:this.chartType,chartcategory:this.chartCategory})}var e=f.name;if(e.startsWith("frequency")){e="frequency"}this.idiom.notify("charttypechooser","set",{name:e});if(this.isVisible){this.idiom.notify("keywordgraph","setTerm",{term:c[0].name})}}},this)},findContainer:function(){return $(this.chartsId).down(".chartContent").down(".chartContainer")},findLegend:function(){return $(this.chartsId).down(".chartContent").down(".chartLegend")},toggleAxisLabel:function(a,b){$(this.chartsId).down(".chartContent").down(".valueLabel").writeAttribute({src:this.imageUrl+"charts/"+a+"."+b+".gif"})}});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)});this.beginDate=at.idiom.js.util.Date.parseDate(b.minimalDate);this.endDate=at.idiom.js.util.Date.parseDate(b.maximalDate);this.idiom.register(null,"changeDate",function(c){a.beginDate=c.beginDate;a.endDate=c.endDate});this.chartCategory=b.chartCategory;this.idiom.register("categorychooser","select",function(c){a.chartCategory=c.data.name});this.chartType=b.chartType;this.idiom.register("charttypechooser","select",function(c){a.chartType=c.data.name});this.idiom.register("charts","switchSentiment",function(c){if(!a.chartType.startsWith("frequency")){return}if(c.sentiment=="positive"){a.chartType="frequencyPositive"}else{if(c.sentiment=="negative"){a.chartType="frequencyNegative"}else{a.chartType="frequencyTotal"}}});this.sentiment=b.sentiment;this.idiom.register("sentimentselector","select",function(c){a.sentiment=c.data.name});this.idiom.register("sentimentselector","set",function(c){a.sentiment=c.name});this.siteImpact=b.siteImpact;this.idiom.register(null,"changeSiteImpact",function(c){a.siteImpact=c.siteImpact});this.searchTerm=b.searchTerm;this.searchCount=b.searchCount;this.isSearchShown=b.isSearch;this.idiom.register("search","newSearch",function(c){a.searchTerm=c.term;a.searchCount=c.count;a.isSearchShown=true});this.idiom.register("searchcountswitcher","select",function(c){a.searchCount=c.data.name});this.idiom.register("search","closed",function(){a.isSearchShown=false})},toggleForm:function(a){if(a){this.form.enable()}else{this.form.disable()}},getBeginDate:function(){return at.idiom.js.util.Date.formatDateForSearch(this.beginDate)},getEndDate:function(){return at.idiom.js.util.Date.formatDateForSearch(this.endDate)},getChartCategory:function(){return this.chartCategory},getChartType:function(){return this.chartType},getSentiment:function(){return this.sentiment},getSiteImpact:function(){return this.siteImpact},getSearchTerm:function(){return this.isSearchShown?this.searchTerm:""},getSearchCount:function(){return this.searchCount}});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 e=a.window.positionedOffset().left;var c=a.window.positionedOffset().top;if(e<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(b){this.idiom=b.idiom;this.notifyName=b.notifyName;this.entry=$(b.entry);this.mainContentElement=$(b.mainContentElement);this.displayElement=$(b.displayElement);this.content=b.content;this.imageUrl=b.imageUrl;this.align=b.align?b.align:"center";this.overlay=null;this.menuElement=null;this.contentFunction=b.contentFunction;this.selectCount=b.selectCount?b.selectCount:1;this.forceColumns=b.forceColumns?b.forceColumns:false;this.alwaysShown=b.alwaysShown?b.alwaysShown:false;this.spacerTemplate=new Template("<div class='spacer'></div>");this.categoryTemplate=new Template("<h3>#{categoryName}</h3>");this.columnTemplate=new Template('<div class="column">#{content}</div>');this.unselectedTemplate=new Template("<a class='#{cssclass}'>#{displayName}</a>");this.unselectedInnerTemplate=new Template("#{displayName}");this.selectedTemplate=new Template("<a class='selected #{cssclass}'><img src='#{imageUrl}topbar/#{image}' border='0' width='7' height='7' />#{displayName}</a>");this.selectedInnerTemplate=new Template("<img src='#{imageUrl}topbar/#{image}' border='0' width='7' height='7' />#{displayName}");var a=this;this.entry.observe("click",function(){a.showMenu()});if(this.notifyName){this.idiom.register(this.notifyName,"set",function(c){a.setSelected(-1,c.name)});this.idiom.register(this.notifyName,"setoverride",function(c){if(a.displayElement){a.displayElement.update(c)}});this.idiom.register(this.notifyName,"enable",function(c){a.enable(c.names)});this.idiom.register(this.notifyName,"show",function(c){a.show(c.names)});this.idiom.register(this.notifyName,"showelement",function(c){a.setVisibility(c)})}this.setVisibility(true)},showMenu:function(){this.entry.addClassName("menuSelected");if(this.menuElement){this.destroyMenu()}this.createMenuElement();this.insertContent();var g=this.menuElement.getWidth();var e=this.entry.getWidth();if(g<e){g=e}var b=this.mainContentElement.cumulativeOffset().left;var l=this.entry.cumulativeOffset().left-b;var f=0;if(this.align=="right"){f=l+e-g}else{var a=l+e/2;f=a-g/2}if(f+g>this.mainContentElement.getWidth()){f=this.mainContentElement.getWidth()-g}else{if(f<5){f=5}}var h=this.entry.cumulativeOffset().top;var c=this.entry.getHeight();var k=h+c;this.menuElement.setStyle({left:f+"px",minWidth:g+"px",top:k+"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 b="";var g=true;var e=null;var c=this;var f=this.content.size()>15||this.forceColumns;var a="";this.content.each(function(l){if(l.category!=null&&l.category!=e){if(f){b+=this.columnTemplate.evaluate({content:a})}else{b+=a}a="";if(!g){}a+=this.categoryTemplate.evaluate({categoryName:l.category});e=l.category}var h=this.unselectedTemplate;if(l.selected){h=this.selectedTemplate}var k="";if(!l.enabled){k+=" disabled "}else{k+=" enabled "}if(!l.shown){k+=" hidden "}a+=h.evaluate({imageUrl:c.imageUrl,image:this.selectCount==1?"b_right.gif":"b_check.gif",displayName:l.displayName,cssclass:k});g=false},this);if(a!=""){if(f){b+=this.columnTemplate.evaluate({content:a})}else{b+=a}}this.menuElement.update(b);this.menuElement.select("a").each(function(k,h){if(!k.hasClassName("disabled")){k.observe("click",function(l){c.clickFunction(l,k,h)})}})}},clickFunction:function(f,e,b){var g=this.getSelected().size();if((this.selectCount>1&&g>=this.selectCount&&this.content[b].selected==false)||(g==true&&this.content[b].selected==true)){return}this.setSelected(b);f.stop();if(this.selectCount==1){this.destroyMenu();this.idiom.notify(this.notifyName,"select",{data:this.content[b]})}else{var c=this.unselectedInnerTemplate;if(this.content[b].selected){c=this.selectedInnerTemplate;e.addClassName("selected")}else{e.removeClassName("selected")}var a=c.evaluate({imageUrl:this.imageUrl,image:this.selectCount==1?"b_right.gif":"b_check.gif",displayName:this.content[b].displayName,cssclass:"enabled"});e.update(a);this.idiom.notify(this.notifyName,"select",{data:this.getSelected()})}},setSelected:function(a,b){if(this.selectCount==1){this.content.each(function(e,c){if(c==a||e.name==b){e.selected=true;this.showSelection(e)}else{e.selected=false}},this)}else{this.content.each(function(e,c){if(c==a||e.name==b){e.selected=!e.selected}},this)}},getSelected:function(){return this.content.findAll(function(a){return a.selected})},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.selectedDisplayName?a.selectedDisplayName:a.displayName)}},enable:function(b){var a=0;this.content.each(function(c){if(b.include(c.name)){a++;c.enabled=true}else{c.enabled=false}},this);if(a>1||this.alwaysShown){this.entry.show()}else{this.entry.hide()}},show:function(b){var a=0;this.content.each(function(c){if(b.include(c.name)){a++;c.shown=true}else{c.shown=false}},this);if(a>1){this.entry.show()}else{this.entry.hide()}},setContent:function(a){this.content=a},setVisibility:function(b){if(b){if(this.content!=null){var a=0;this.content.each(function(c){if(c.enabled&&c.shown){a++}});if(a>1){this.entry.show()}else{this.entry.hide()}}}else{this.entry.hide()}}});at.idiom.js.menu.TabMenu=Class.create({initialize:function(a){this.idiom=a.idiom;this.notifyName=a.notifyName;this.displayElement=$(a.displayElement);this.content=a.content;this.selectCount=a.selectCount?a.selectCount:1;this.createMenu();if(this.notifyName){this.idiom.register(this.notifyName,"set",function(b){if(!Object.isArray(b.names)){b.names=[]}if(b.name){b.names.push(b.name)}this.setSelected(b.names,b.notify)}.bind(this));this.idiom.register(this.notifyName,"enable",function(b){this.enable(b.names)}.bind(this));this.idiom.register(this.notifyName,"show",function(b){this.show(b.names,null)}.bind(this));this.idiom.register(this.notifyName,"hide",function(b){this.show(null,b.names)}.bind(this));this.idiom.register(this.notifyName,"add",function(b){this.content.push(b);this.addItem(b);this.updateMenu()}.bind(this))}},createMenu:function(){this.displayElement.addClassName("tabmenu");if(Object.isFunction(this.content)){this.content(this.displayElement)}else{this.content.each(function(a){this.addItem(a)},this);this.updateMenu()}},addItem:function(b){var a=new Element("a");a.update(b.displayName);a.observe("click",function(c){c.stop();if(b.enabled){this.clickFunction(b)}}.bind(this));this.displayElement.insert(a);b.element=a},updateMenu:function(){var a=false;this.content.each(function(c){if(c.selected){a=true;c.element.addClassName("selected")}else{c.element.removeClassName("selected")}if(!c.enabled){c.element.addClassName("disabled")}else{c.element.removeClassName("disabled")}if(!c.shown){c.element.addClassName("hidden")}else{c.element.removeClassName("hidden")}},this);if(!a){var b=this.content.detect(function(c){return c.enabled&&c.shown});if(b){this.idiom.notify(this.notifyName,"set",{name:b.name,notify:true})}}},clickFunction:function(a){var b=this.getSelected().size();if((this.selectCount>1&&b>=this.selectCount&&a.selected==false)||(b==1&&a.selected==true)){return}this.setSelected([a.name],true)},setSelected:function(b,a){if(this.selectCount==1){this.content.each(function(c){if(b.include(c.name)){c.selected=true;c.enabled=true;c.shown=true}else{c.selected=false}},this)}else{this.content.each(function(c){if(b.include(c.name)){c.selected=!c.selected}},this)}this.updateMenu();if(a){this.idiom.notify(this.notifyName,"select",{data:this.selectCount==1?this.getSelected()[0]:this.getSelected()})}},getSelected:function(){return this.content.findAll(function(a){return a.selected})},enable:function(a){this.content.each(function(b){if(a.include(b.name)){b.enabled=true}else{b.enabled=false}},this);this.updateMenu()},show:function(a,b){this.content.each(function(c){if(a){if(a.include(c.name)){c.shown=true}else{c.shown=false;c.selected=false}}if(b){if(b.include(c.name)){c.shown=false;c.selected=false}else{c.shown=true}}},this);this.updateMenu()}});at.idiom.js.snapshots=Class.create();at.idiom.js.snapshots.Snapshots=Class.create({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.beginDateNextDayElement=$(c.beginDateNextDay);this.beginDateNextWeekElement=$(c.beginDateNextWeek);this.beginDatePreviousDayElement=$(c.beginDatePreviousDay);this.beginDatePreviousWeekElement=$(c.beginDatePreviousWeek);this.beginDateCurrentDateElement=$(c.beginDateCurrentDate);this.beginDateSelectorElement=$(c.beginDateSelectorElement);this.endDateNextDayElement=$(c.endDateNextDay);this.endDateNextWeekElement=$(c.endDateNextWeek);this.endDatePreviousDayElement=$(c.endDatePreviousDay);this.endDatePreviousWeekElement=$(c.endDatePreviousWeek);this.endDateCurrentDateElement=$(c.endDateCurrentDate);this.endDateSelectorElement=$(c.endDateSelectorElement);this.language=c.language;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.oldestDate=at.idiom.js.util.Date.parseDate(c.oldestDate);this.newestDate=at.idiom.js.util.Date.parseDate(c.newestDate);this.currentEndDate=at.idiom.js.util.Date.parseDate(c.rangeEndDate);this.currentBeginDate=at.idiom.js.util.Date.parseDate(c.rangeBeginDate);if(this.currentBeginDate.getTime()<this.oldestDate.getTime()){this.currentBeginDate=new Date(this.oldestDate.getTime())}this.updateDate(false);this.beginDatePreviousWeekElement.observe("click",this.beginDateButtonClick.bindAsEventListener(this,-7*24*60*60*1000));this.beginDatePreviousDayElement.observe("click",this.beginDateButtonClick.bindAsEventListener(this,-24*60*60*1000));this.beginDateNextDayElement.observe("click",this.beginDateButtonClick.bindAsEventListener(this,24*60*60*1000));this.beginDateNextWeekElement.observe("click",this.beginDateButtonClick.bindAsEventListener(this,7*24*60*60*1000));this.endDatePreviousWeekElement.observe("click",this.endDateButtonClick.bindAsEventListener(this,-7*24*60*60*1000));this.endDatePreviousDayElement.observe("click",this.endDateButtonClick.bindAsEventListener(this,-24*60*60*1000));this.endDateNextDayElement.observe("click",this.endDateButtonClick.bindAsEventListener(this,24*60*60*1000));this.endDateNextWeekElement.observe("click",this.endDateButtonClick.bindAsEventListener(this,7*24*60*60*1000));this.updateButtons();var b=this;this.beginDatePopupMenu=new at.idiom.js.menu.OverlayMenu({notifyName:"",idiom:this.idiom,entry:this.beginDateSelectorElement,mainContentElement:$("Content"),content:null,contentFunction:function(e){b.createBeginDateSelector(e)}});this.endDatePopupMenu=new at.idiom.js.menu.OverlayMenu({notifyName:"",idiom:this.idiom,entry:this.endDateSelectorElement,mainContentElement:$("Content"),content:null,contentFunction:function(e){b.createEndDateSelector(e)}});this.idiom.register(null,"switchsample",function(e){b.sample=e.sample;b.snapshots=e.snapshots;b.oldestDate=e.oldestDocumentDate;b.newestDate=e.newestDocumentDate;b.selectSnapshotByDate(b.currentBeginDate,b.currentEndDate)});this.idiom.register("daterange","set",function(e){b.currentBeginDate=e.beginDate;b.currentEndDate=e.endDate;b.changedDate()})},beginDateButtonClick:function(b,c){var a=Event.element(b);if(a.hasClassName("enabled")){this.changeBeginDate(c)}},endDateButtonClick:function(b,c){var a=Event.element(b);if(a.hasClassName("enabled")){this.changeEndDate(c)}},changeBeginDate:function(c){var b=this.oldestDate;var a=this.newestDate;if(this.currentEndDate.getTime()<a.getTime()){a=this.currentEndDate}this.changeDate(this.currentBeginDate,b,a,c)},changeEndDate:function(c){var b=this.oldestDate;if(this.currentBeginDate.getTime()>b){b=this.currentBeginDate}var a=this.newestDate;this.changeDate(this.currentEndDate,b,a,c)},changeDate:function(e,f,c,h){var a=new Date(e.getTime()+h);if(a.getTime()<f.getTime()){a.setTime(f.getTime())}else{if(a.getTime()>c.getTime()){a.setTime(c.getTime())}}var g=DatePickerUtils.dateObjectToAnsi(e);e.setTime(a.getTime());var b=DatePickerUtils.dateObjectToAnsi(e);var k=g!=b;if(k){this.changedDate()}},changedDate:function(){var a=this.getSnapshotForDate(this.currentEndDate);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}}var c=this;this.idiom.notify(null,"changeSnapshot",{snapshotid:a,sample:c.sample})},selectSnapshotByDate:function(a,b){this.currentBeginDate=at.idiom.js.util.Date.parseDate(a);this.currentEndDate=at.idiom.js.util.Date.parseDate(b);this.changedDate()},updateButtons:function(){var e=this.oldestDate.getTime();var a=this.newestDate.getTime();var c=this.currentBeginDate.getTime();var b=this.currentEndDate.getTime();this.updateButton(this.beginDatePreviousWeekElement,c-7*24*60*60*1000>=e);this.updateButton(this.beginDatePreviousDayElement,c-24*60*60*1000>=e);this.updateButton(this.beginDateNextDayElement,c+24*60*60*1000<=b);this.updateButton(this.beginDateNextWeekElement,c+7*24*60*60*1000<=b);this.updateButton(this.endDatePreviousWeekElement,b-7*24*60*60*1000>=c);this.updateButton(this.endDatePreviousDayElement,b-24*60*60*1000>=c);this.updateButton(this.endDateNextDayElement,b+24*60*60*1000<=a);this.updateButton(this.endDateNextWeekElement,b+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.beginDateCurrentDateElement.update(this.formatDate(this.currentBeginDate));this.endDateCurrentDateElement.update(this.formatDate(this.currentEndDate));if(a){this.idiom.notify(null,"changeDate",{beginDate:this.currentBeginDate,endDate:this.currentEndDate})}},createBeginDateSelector:function(a){var b=this;this.dateSelector=new DatePicker({element:a,relative:this.beginDateSelectorElement.id,keepFieldEmpty:true,dateFilter:this.dateSelectorFilter(this.oldestDate,this.currentEndDate),zindex:10000,relativePosition:false,relativeAppend:true,currentDate:DatePickerUtils.dateObjectToAnsi(this.currentBeginDate),callback:function(c){b.beginDatePopupMenu.destroyMenu();b.selectSnapshotByDate(c,DatePickerUtils.dateObjectToAnsi(b.currentEndDate))},language:this.language})},createEndDateSelector:function(a){var b=this;this.dateSelector=new DatePicker({element:a,relative:this.endDateSelectorElement.id,keepFieldEmpty:true,dateFilter:this.dateSelectorFilter(this.currentBeginDate,this.newestDate),zindex:10000,relativePosition:false,relativeAppend:true,currentDate:DatePickerUtils.dateObjectToAnsi(this.currentEndDate),callback:function(c){b.endDatePopupMenu.destroyMenu();b.selectSnapshotByDate(DatePickerUtils.dateObjectToAnsi(b.currentBeginDate),c)},language:this.language})},dateSelectorFilter:function(e,c){var b=new DatePickerUtils.noDatesBefore(e);var a=new DatePickerUtils.noDatesAfter(c);return b.append(a)},showDateSelector:function(){this.dateSelector.click()},formatDate:function(a){return at.idiom.js.util.Date.formatFullDate(a,this.language)},getSnapshotForDate:function(b){var e=-1;var f=DatePickerUtils.dateObjectToAnsi(b);for(var c=0;c<this.snapshots.length;c++){var a=this.snapshots[c].id;var g=this.snapshots[c].date;if(g>=f){e=a;break}}if(e==-1){e=this.snapshots[this.snapshots.length-1].id}return e}});at.idiom.js.keywordgraph=Class.create();at.idiom.js.keywordgraph.KeywordGraph=Class.create(at.idiom.js.window.Window,{initialize:function($super,a){$super(a);this.sample=a.sample;this.site=a.site;this.snapshot=a.snapshot;this.siteImpact=a.siteImpact;this.element=$(a.element);this.width=this.element.getWidth();this.height=this.element.getHeight();this.numTerms=a.numTerms;this.startNumTerms=a.startNumTerms?a.startNumTerms:a.numTerms;this.currentStartTerm=null;this.addLevelDelay=0.25;this.maxNodeCount=50;this.plusButton=$(a.plusButton);this.plusButtonActive=true;this.loadId=a.loadId;this.defaultRadius=2.5;this.links=[];this.nodes=[];this.vis=d3.select(this.element).append("svg:svg").attr("width","100%").attr("height","100%");this.gravity=0.15;this.linkDistance=40;this.linkStrength=0.75;this.friction=0.5;this.charge=-400;this.theta=0.8;this.label={dx:7,dy:10,lineLength:18};this.force=d3.layout.force().links(this.links).nodes(this.nodes).gravity(this.gravity).linkDistance(this.linkDistance).linkStrength(this.linkStrength).friction(this.friction).charge(this.charge).theta(this.theta).size([this.width,this.height]);this.force.on("tick",this.tickFunction.bind(this));this.idiom.register(null,"changeSnapshot",function(b){this.snapshot=b.snapshotid}.bind(this));this.idiom.register(null,"changeSiteImpact",function(b){this.siteImpact=b.siteImpact;this.loadCharts(this.chartCategory,this.chartCategoryName,false)}.bind(this));this.idiom.register("keywordgraph","newGraph",function(b){this.restart(b.term,true)}.bind(this));this.idiom.register("keywordgraph","setTerm",function(b){this.currentStartTerm=b.term;this.restartIfVisible(b.term,true)}.bind(this));this.idiom.register("keywordgraph","plus",this.addLevel.bind(this));this.idiom.register("keywordgraphedgecount","select",function(b){this.numTerms=b.data.name}.bind(this));Event.observe(this.plusButton,"click",function(b){if(this.plusButtonActive){this.addLevel()}b.stop();return false}.bind(this));this.minimalSentiment=a.minimalSentiment;this.maximalSentiment=a.maximalSentiment;this.idiom.register(null,"filterSentiment",function(b){this.minimalSentiment=b.minimalSentiment;this.maximalSentiment=b.maximalSentiment}.bind(this));this.minimalDate=at.idiom.js.util.Date.parseDate(a.minimalDate);this.maximalDate=at.idiom.js.util.Date.parseDate(a.maximalDate);this.idiom.register(null,"changeDate",function(b){this.minimalDate=b.beginDate;this.maximalDate=b.endDate}.bind(this));this.idiom.register(null,"switchsample",function(b){this.sample=b.sample}.bind(this))},start:function(){this.stop();this.force.start()},stop:function(){this.force.stop()},getNodeCount:function(){return this.nodes.size()},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()}},getKeywords:function(f,e,a,g){this.idiom.loadStart(this.loadId);var c=this.nodes.collect(function(h){return h.name});var b=f.name;Client.getKeywords({sample:this.sample,site:this.site,snapshotId:this.snapshot,siteImpact:this.siteImpact,term:b,limit:e,existingTerms:c,minimalSentiment:this.minimalSentiment,maximalSentiment:this.maximalSentiment,startDate:this.minimalDate,endDate:this.maximalDate},{callback:function(l){this.idiom.loadEnd(this.loadId);var k=[];for(var m=0;m<l.length;m++){var h={name:l[m].term,sentiment:l[m].sentiment};k.push(h)}this.addKeywords(f,k);if(a){this.togglePlusButton(true)}if(g){this.addLevel(this.startNumTerms)}}.bind(this),errorHandler:function(h){}})},tickFunction:function(a){var c=this.vis.selectAll("g.node").data(this.nodes,function(e){return e.id});c.attr("transform",function(f){f.x=Math.max(0,Math.min(f.x,this.width));f.y=Math.max(0,Math.min(f.y,this.height));if(f.virtual){var e=this.calculateVirtualPosition(f.virtualParent);f.x=e.x;f.y=e.y}return"translate("+f.x+","+f.y+")"}.bind(this));var b=this.vis.selectAll("line.link").data(this.links,function(e){return e.source.id+","+e.target.id});b.attr("x1",function(e){return e.source.x}).attr("y1",function(e){return e.source.y}).attr("x2",function(e){return e.target.x}).attr("y2",function(e){return e.target.y})},recalc:function(){var f=this.vis.selectAll("line.link").data(this.links,function(h){return h.source.id+"-"+h.target.id});f.enter().insert("svg:line",".node").attr("class","link").attr("x1",function(h){return h.source.x}).attr("y1",function(h){return h.source.y}).attr("x2",function(h){return h.target.x}).attr("y2",function(h){return h.target.y});f.exit().remove();var e=this.vis.selectAll("g.node").data(this.nodes,function(h){return h.id}).call(this.force.drag);var b=e.enter().insert("svg:g",".root").attr("transform",function(h){if(h.x&&h.y){return"translate("+h.x+","+h.y+")"}}).attr("class",function(h){return"node"+(h.root?" root":"")+(h.virtual?" virtual":"")+" "+this.color(h)}.bind(this)).on("click",function(h){this.click(h)}.bind(this)).call(this.force.drag).on("mouseover",this.mouseOver.bind(this)).on("mouseout",this.mouseOut.bind(this));b.append("svg:circle").attr("class","circle").attr("r",function(h){return this.radius(h)}.bind(this));var g=b.append("svg:rect").attr("class","background");var a=b.append("svg:text").attr("class","nodetext").attr("y",-this.label.dy);var c=this;a.each(function(k){var h=k.name.split(" ");h=h.inject([],function(l,m){if(l.size()==0){l.push(m)}else{if(l.last().length+m.length<c.label.lineLength){l[l.length-1]=l.last().concat(" "+m)}else{l.push(m)}}return l});h.each(function(l){d3.select(this).append("svg:tspan").attr("x",c.label.dx).attr("dy",c.label.dy).text(l)}.bind(this))});g.attr("x",this.label.dx).attr("y",function(h){return this.parentNode.getBBox().y}).attr("width",function(h){return this.parentNode.getBBox().width-c.label.dx}).attr("height",function(h){return this.parentNode.getBBox().height});e.exit().remove();this.force.links(this.links).nodes(this.nodes).start()},color:function(a){if(!a.root){if(a.sentiment>0.3){return"positive"}else{if(a.sentiment<-0.3){return"negative"}}}return""},radius:function(a){if(!a.radius){a.radius=this.defaultRadius}return a.radius},init:function(b,a){if(!b){b=this.currentStartTerm}this.currentStartTerm=b;var c={id:b,name:b,sentiment:1,radius:this.defaultRadius*1.5,x:this.getCenter().x,y:this.getCenter().y,fixed:true,children:[],root:true,parents:[]};this.nodes.push(c);this.getKeywords(c,this.numTerms,false,a)},addChildren:function(a,b,c){if(a.virtual){return}if(!c){c=this.numTerms}this.getKeywords(a,c,b)},addKeywords:function(a,b){b.each(function(h){var k=this.nodes.detect(function(m){return m.name==h.name});if(k){a.children.push(k);k.parents.push(a);var g={source:a,target:k};var l=this.links.detect(function(m){return(g.source==m.source&&g.target==m.target)||(g.target==m.source&&g.source==m.target)});if(!l){this.links.push(g)}}else{var f={id:h.name,name:h.name,sentiment:h.sentiment,x:a.root?undefined:a.x+(Math.random()*10-20),y:a.root?undefined:a.y+(Math.random()*10-20),children:[],root:false,parents:[a]};var e=this.calculateVirtualPosition(f);var c={id:"virtual-"+h.name,name:"",virtual:true,virtualParent:f,fixed:true,sentiment:0,x:e.x,y:e.y,children:[],root:false,parents:[]};var g={source:a,target:f};this.nodes.unshift(f);this.nodes.unshift(c);this.links.push(g);a.children.push(f)}},this);this.togglePlusButton(this.plusButtonActive);this.recalc()},calculateVirtualPosition:function(a){var f=10;var m=50;var l=10;var e=20;var n=a.x-f;var b=this.width-a.x-m;var g=a.y-l;var c=this.height-a.y-e;var k=a.x;var h=a.y;if(a.x<this.width/2){if(a.y<this.height/2){if(n<0&&g<0){k=Math.min(f,a.x-2);h=Math.min(l,a.y-2)}else{if(n<g){k=Math.min(f,a.x-2)}else{h=Math.min(l,a.y-2)}}}else{if(n<0&&c<0){k=Math.min(f,a.x-2);h=Math.max(this.height-e,a.y+2)}else{if(n<c){k=Math.min(f,a.x-2)}else{h=Math.max(this.height-e,a.y+2)}}}}else{if(a.y<this.height/2){if(b<0&&g<0){k=Math.max(this.width-m,a.x+2);h=Math.min(l,a.y-2)}else{if(b<g){k=Math.max(this.width-m,a.x+2)}else{h=Math.min(l,a.y-2)}}}else{if(b<0&&c<0){k=Math.max(this.width-m,a.x+2);h=Math.max(this.height-e,a.y+2)}else{if(b<c){k=Math.max(this.width-m,a.x+2)}else{h=Math.max(this.height-e,a.y+2)}}}}return{x:k,y:h}},deleteChildrenNodes:function(b){this.links=this.links.reject(function(e){return e.source==b&&b.children.include(e.target)});var a=[];this.nodes=this.nodes.select(function(f){var e=f.virtual||this.links.detect(function(g){return g.source==f||g.target==f},this);if(!e){a.push(f)}return e},this);this.nodes=this.nodes.reject(function(e){return e.virtual&&a.include(e.virtualParent)});var c=null;while((c=b.children.pop())!=null){c.parents=c.parents.reject(function(e){return e==b},this);if(!this.isConnectedToRoot(c)){this.deleteChildrenNodes(c)}}},click:function(a){if(a.children.size()>0){if(!a.root){this.deleteChildrenNodes(a)}else{this.restart(null,false)}}else{this.addChildren(a)}this.recalc()},getCenter:function(){var a={x:this.width/2,y:this.height/2};return a},addLevel:function(c){this.togglePlusButton(false);var b=this.nodes.select(function(e){return e.children.size()==0&&!e.virtual});var a=0;b.each(function(f,e){var g=e==b.length-1;this.addChildren.bind(this).delay(a,f,g,c);a+=this.addLevelDelay}.bind(this),this)},restart:function(a,b){this.showWindow();this.resize();this.nodes=[];this.links=[];this.vis.selectAll("*").remove();this.init(a,b)},restartIfVisible:function(a,b){if(this.isVisible){this.restart(a,b)}},isConnectedToRoot:function(a,b){if(!Object.isArray(b)){b=[]}if(b.include(a)){return false}b.push(a);if(a.root){return true}if(a.parents&&a.parents.size()>0){return a.parents.any(function(c){return this.isConnectedToRoot(c,b)},this)}return false},resize:function(){this.width=this.element.getWidth();this.height=this.element.getHeight();var a=this.nodes.detect(function(b){return b.root});if(a){a.x=a.px=this.getCenter().x;a.y=a.py=this.getCenter().y;this.positionChildren(a,[])}this.force.size([this.width,this.height]);this.force.start()},positionChildren:function(a,b){b.push(a);a.children.each(function(c){if(b.include(c)){return}c.x=c.px=c.parents[0].x+(Math.random()*10-20);c.y=c.py=c.parents[0].y+(Math.random()*10-20);this.positionChildren(c,b)}.bind(this))},mouseOver:function(a){this.vis.selectAll("g.node").filter(function(b){return b==a}).classed("highlight",true).select(".circle").attr("r",function(b){return this.radius(b)*1.5}.bind(this))},mouseOut:function(a){this.vis.selectAll("g.node").filter(function(b){return b==a}).classed("highlight",false).select(".circle").attr("r",function(b){return this.radius(b)}.bind(this))},errorHandler:function(b,a){if(!a){a=""}this.idiom.notify("error","display","Error in keyword graph: "+b+" "+a)}});at.idiom.js.siteimpact=Class.create();at.idiom.js.siteimpact.Chooser=Class.create({initialize:function(a){if(a.enabled){Event.observe($(a.checkbox),"click",function(){if($(a.checkbox).getValue()=="true"){a.idiom.notify(null,"changeSiteImpact",{siteImpact:"reach"})}else{a.idiom.notify(null,"changeSiteImpact",{siteImpact:"normal"})}})}else{$(a.checkbox).disable();$(a.element).addClassName("disabled")}}});at.idiom.js.sentiment=Class.create();at.idiom.js.sentiment.Filter=Class.create({initialize:function(b){this.minimalSentiment=null;this.maximalSentiment=null;this.element=$(b.elementId);var a=this;b.idiom.register(null,"filterSentiment",function(c){a.sentimentChange(c.minimalSentiment,c.maximalSentiment)})},sentimentChange:function(a,b){this.minimalSentiment=a;this.maximalSentiment=b;if(this.minimalSentiment!=null){this.showPositive()}else{if(this.maximalSentiment!=null){this.showNegative()}else{this.hide()}}},showPositive:function(){this.element.down(".positive").show();this.element.down(".negative").hide();this.element.show()},showNegative:function(){this.element.down(".negative").show();this.element.down(".positive").hide();this.element.show()},hide:function(){this.element.hide()}});at.idiom.js.cookie=Class.create();at.idiom.js.cookie.Cookie=Class.create({initialize:function(a,b){this.data={};this.options=Object.extend({name:"cookie",expires:null,domain:"",path:"",secure:false},a||{});var c=this.retrieve();if(c){this.data=c.evalJSON()}else{this.data=b||{}}this.store()},getData:function(a){return this.data[a]},setData:function(a,b){this.data[a]=b;this.store()},removeData:function(a){delete this.data[a];this.store()},retrieve:function(){var c=document.cookie.indexOf(this.options.name+"=");if(c==-1){return null}if(this.options.name!=document.cookie.substr(c,this.options.name.length)){return null}var a=c+this.options.name.length+1;var b=document.cookie.indexOf(";",a);if(b==-1){b=document.cookie.length}return unescape(document.cookie.substring(a,b))},store:function(){var a="";if(this.options.expires){var b=new Date();a=this.options.expires*86400000;a=";expires="+new Date(b.getTime()+a)}document.cookie=this.options.name+"="+escape(Object.toJSON(this.data))+this.getOptions()+a},erase:function(){document.cookie=this.options.name+"="+this.getOptions()+";expires=Thu, 01-Jan-1970 00:00:01 GMT"},getOptions:function(){return(this.options.path?";path="+this.options.path:"")+(this.options.domain?";domain="+this.options.domain:"")+(this.options.secure?";secure":"")}});

