window.dhtmlHistory={isIE:false,isOpera:false,isSafari:false,isKonquerer:false,isGecko:false,isSupported:false,create:function(D){var G=this;var F=navigator.userAgent.toLowerCase();var A=navigator.platform.toLowerCase();var H=navigator.vendor||"";if(H==="KDE"){this.isKonqueror=true;this.isSupported=false}else{if(typeof window.opera!=="undefined"){this.isOpera=true;this.isSupported=true}else{if(typeof document.all!=="undefined"){this.isIE=true;this.isSupported=true}else{if(H.indexOf("Apple Computer, Inc.")>-1){this.isSafari=true;this.isSupported=(A.indexOf("mac")>-1)}else{if(F.indexOf("gecko")!=-1){this.isGecko=true;this.isSupported=true}}}}}window.historyStorage.setup(D);if(this.isSafari){this.createSafari()}else{if(this.isOpera){this.createOpera()}}var B=this.getCurrentLocation();this.currentLocation=B;if(this.isIE){this.createIE(B)}var E=function(){G.firstLoad=null};this.addEventListener(window,"unload",E);if(this.isIE){this.ignoreLocationChange=true}else{if(!historyStorage.hasKey(this.PAGELOADEDSTRING)){this.ignoreLocationChange=true;this.firstLoad=true;historyStorage.put(this.PAGELOADEDSTRING,true)}else{this.ignoreLocationChange=false;this.fireOnNewListener=true}}var C=function(){G.checkLocation()};setInterval(C,100)},initialize:function(){if(this.isIE){if(!historyStorage.hasKey(this.PAGELOADEDSTRING)){this.fireOnNewListener=false;this.firstLoad=true;historyStorage.put(this.PAGELOADEDSTRING,true)}else{this.fireOnNewListener=true;this.firstLoad=false}}},addListener:function(A){this.listener=A;if(this.fireOnNewListener){this.fireHistoryEvent(this.currentLocation);this.fireOnNewListener=false}},addEventListener:function(C,B,A){if(C.addEventListener){C.addEventListener(B,A,false)}else{if(C.attachEvent){C.attachEvent("on"+B,function(){A(window.event)})}}},add:function(C,D){if(this.isSafari){C=this.removeHash(C);historyStorage.put(C,D);this.currentLocation=C;window.location.hash=C;this.putSafariState(C)}else{var B=this;var A=function(){if(B.currentWaitTime>0){B.currentWaitTime=B.currentWaitTime-B.waitTime}C=B.removeHash(C);if(document.getElementById(C)&&B.debugMode){var E="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(E)}historyStorage.put(C,D);B.ignoreLocationChange=true;B.ieAtomicLocationChange=true;B.currentLocation=C;window.location.hash=C;if(B.isIE){B.iframe.src="blank.html?"+C}B.ieAtomicLocationChange=false};window.setTimeout(A,this.currentWaitTime);this.currentWaitTime=this.currentWaitTime+this.waitTime}},isFirstLoad:function(){return this.firstLoad},getVersion:function(){return"0.6"},getCurrentLocation:function(){var A=(this.isSafari?this.getSafariState():this.getCurrentHash());return A},getCurrentHash:function(){var B=window.location.href;var A=B.indexOf("#");return(A>=0?B.substr(A+1):"")},PAGELOADEDSTRING:"DhtmlHistory_pageLoaded",listener:null,waitTime:200,currentWaitTime:0,currentLocation:null,iframe:null,safariHistoryStartPoint:null,safariStack:null,safariLength:null,ignoreLocationChange:null,fireOnNewListener:null,firstLoad:null,ieAtomicLocationChange:null,createIE:function(A){this.waitTime=400;var B=(historyStorage.debugMode?"width: 800px;height:80px;border:1px solid black;":historyStorage.hideStyles);var D="rshHistoryFrame";var C='<iframe frameborder="0" id="'+D+'" style="'+B+'" src="blank.html?'+A+'"></iframe>';document.write(C);this.iframe=document.getElementById(D)},createOpera:function(){this.waitTime=400;var A='<img src="javascript:location.href=\'javascript:dhtmlHistory.checkLocation();\';" style="'+historyStorage.hideStyles+'" />';document.write(A)},createSafari:function(){var E="rshSafariForm";var D="rshSafariStack";var C="rshSafariLength";var B=historyStorage.debugMode?historyStorage.showStyles:historyStorage.hideStyles;var A=(historyStorage.debugMode?"width:800px;height:20px;border:1px solid black;margin:0;padding:0;":historyStorage.hideStyles);var F='<form id="'+E+'" style="'+B+'"><input type="text" style="'+A+'" id="'+D+'" value="[]"/><input type="text" style="'+A+'" id="'+C+'" value=""/></form>';document.write(F);this.safariStack=document.getElementById(D);this.safariLength=document.getElementById(C);if(!historyStorage.hasKey(this.PAGELOADEDSTRING)){this.safariHistoryStartPoint=history.length;this.safariLength.value=this.safariHistoryStartPoint}else{this.safariHistoryStartPoint=this.safariLength.value}},getSafariStack:function(){var A=this.safariStack.value;return historyStorage.fromJSON(A)},getSafariState:function(){var A=this.getSafariStack();var B=A[history.length-this.safariHistoryStartPoint-1];return B},putSafariState:function(B){var A=this.getSafariStack();A[history.length-this.safariHistoryStartPoint]=B;this.safariStack.value=historyStorage.toJSON(A)},fireHistoryEvent:function(A){var B=historyStorage.get(A);this.listener.call(null,A,B)},checkLocation:function(){if(!this.isIE&&this.ignoreLocationChange){this.ignoreLocationChange=false;return }if(!this.isIE&&this.ieAtomicLocationChange){return }var A=this.getCurrentLocation();if(A==this.currentLocation){return }this.ieAtomicLocationChange=true;if(this.isIE&&this.getIframeHash()!=A){this.iframe.src="blank.html?"+A}else{if(this.isIE){return }}this.currentLocation=A;this.ieAtomicLocationChange=false;this.fireHistoryEvent(A)},getIframeHash:function(){var B=this.iframe.contentWindow.document;var A=String(B.location.search);if(A.length==1&&A.charAt(0)=="?"){A=""}else{if(A.length>=2&&A.charAt(0)=="?"){A=A.substring(1)}}return A},removeHash:function(B){var A;if(B===null||B===undefined){A=null}else{if(B===""){A=""}else{if(B.length==1&&B.charAt(0)=="#"){A=""}else{if(B.length>1&&B.charAt(0)=="#"){A=B.substring(1)}else{A=B}}}}return A},iframeLoaded:function(A){if(this.ignoreLocationChange){this.ignoreLocationChange=false;return }var B=String(A.search);if(B.length==1&&B.charAt(0)=="?"){B=""}else{if(B.length>=2&&B.charAt(0)=="?"){B=B.substring(1)}}window.location.hash=B;this.fireHistoryEvent(B)}};window.historyStorage={setup:function(B){if(typeof B!=="undefined"){if(B.debugMode){this.debugMode=B.debugMode}if(B.toJSON){this.toJSON=B.toJSON}if(B.fromJSON){this.fromJSON=B.fromJSON}}var D="rshStorageForm";var F="rshStorageField";var A=this.debugMode?historyStorage.showStyles:historyStorage.hideStyles;var E=(historyStorage.debugMode?"width: 800px;height:80px;border:1px solid black;":historyStorage.hideStyles);var C='<form id="'+D+'" style="'+A+'"><textarea id="'+F+'" style="'+E+'"></textarea></form>';document.write(C);this.storageField=document.getElementById(F);if(typeof window.opera!=="undefined"){this.storageField.focus()}},put:function(A,B){this.assertValidKey(A);if(this.hasKey(A)){this.remove(A)}this.storageHash[A]=B;this.saveHashTable()},get:function(A){this.assertValidKey(A);this.loadHashTable();var B=this.storageHash[A];if(B===undefined){B=null}return B},remove:function(A){this.assertValidKey(A);this.loadHashTable();delete this.storageHash[A];this.saveHashTable()},reset:function(){this.storageField.value="";this.storageHash={}},hasKey:function(A){this.assertValidKey(A);this.loadHashTable();return(typeof this.storageHash[A]!=="undefined")},isValidKey:function(A){return(typeof A==="string")},showStyles:"border:0;margin:0;padding:0;",hideStyles:"left:-1000px;top:-1000px;width:1px;height:1px;border:0;position:absolute;",debugMode:false,storageHash:{},hashLoaded:false,storageField:null,assertValidKey:function(A){var B=this.isValidKey(A);if(!B&&this.debugMode){throw new Error("Please provide a valid key for window.historyStorage. Invalid key = "+A+".")}},loadHashTable:function(){if(!this.hashLoaded){var A=this.storageField.value;if(A!==""&&A!==null){this.storageHash=this.fromJSON(A);this.hashLoaded=true}}},saveHashTable:function(){this.loadHashTable();var A=this.toJSON(this.storageHash);this.storageField.value=A},toJSON:function(A){return A.toJSONString()},fromJSON:function(A){return A.parseJSON()}};var Prototype={Version:"1.6.0.2",Browser:{IE:!!(window.attachEvent&&!window.opera),Opera:!!window.opera,WebKit:navigator.userAgent.indexOf("AppleWebKit/")>-1,Gecko:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")==-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)},BrowserFeatures:{XPath:!!document.evaluate,ElementExtensions:!!window.HTMLElement,SpecificElementExtensions:document.createElement("div").__proto__&&document.createElement("div").__proto__!==document.createElement("form").__proto__},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 Class={create:function(){var E=null,D=$A(arguments);if(Object.isFunction(D[0])){E=D.shift()}function A(){this.initialize.apply(this,arguments)}Object.extend(A,Class.Methods);A.superclass=E;A.subclasses=[];if(E){var B=function(){};B.prototype=E.prototype;A.prototype=new B;E.subclasses.push(A)}for(var C=0;C<D.length;C++){A.addMethods(D[C])}if(!A.prototype.initialize){A.prototype.initialize=Prototype.emptyFunction}A.prototype.constructor=A;return A}};Class.Methods={addMethods:function(G){var C=this.superclass&&this.superclass.prototype;var B=Object.keys(G);if(!Object.keys({toString:true}).length){B.push("toString","valueOf")}for(var A=0,D=B.length;A<D;A++){var F=B[A],E=G[F];if(C&&Object.isFunction(E)&&E.argumentNames().first()=="$super"){var H=E,E=Object.extend((function(I){return function(){return C[I].apply(this,arguments)}})(F).wrap(H),{valueOf:function(){return H},toString:function(){return H.toString()}})}this.prototype[F]=E}return this}};var Abstract={};Object.extend=function(A,C){for(var B in C){A[B]=C[B]}return A};Object.extend(Object,{inspect:function(A){try{if(Object.isUndefined(A)){return"undefined"}if(A===null){return"null"}return A.inspect?A.inspect():String(A)}catch(B){if(B instanceof RangeError){return"..."}throw B}},toJSON:function(A){var C=typeof A;switch(C){case"undefined":case"function":case"unknown":return ;case"boolean":return A.toString()}if(A===null){return"null"}if(A.toJSON){return A.toJSON()}if(Object.isElement(A)){return }var B=[];for(var E in A){var D=Object.toJSON(A[E]);if(!Object.isUndefined(D)){B.push(E.toJSON()+": "+D)}}return"{"+B.join(", ")+"}"},toQueryString:function(A){return $H(A).toQueryString()},toHTML:function(A){return A&&A.toHTML?A.toHTML():String.interpret(A)},keys:function(A){var B=[];for(var C in A){B.push(C)}return B},values:function(B){var A=[];for(var C in B){A.push(B[C])}return A},clone:function(A){return Object.extend({},A)},isElement:function(A){return A&&A.nodeType==1},isArray:function(A){return A!=null&&typeof A=="object"&&"splice" in A&&"join" in A},isHash:function(A){return A instanceof Hash},isFunction:function(A){return typeof A=="function"},isString:function(A){return typeof A=="string"},isNumber:function(A){return typeof A=="number"},isUndefined:function(A){return typeof A=="undefined"}});Object.extend(Function.prototype,{argumentNames:function(){var A=this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip");return A.length==1&&!A[0]?[]:A},bind:function(){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this}var A=this,C=$A(arguments),B=C.shift();return function(){return A.apply(B,C.concat($A(arguments)))}},bindAsEventListener:function(){var A=this,C=$A(arguments),B=C.shift();return function(D){return A.apply(B,[D||window.event].concat(C))}},curry:function(){if(!arguments.length){return this}var A=this,B=$A(arguments);return function(){return A.apply(this,B.concat($A(arguments)))}},delay:function(){var A=this,B=$A(arguments),C=B.shift()*1000;return window.setTimeout(function(){return A.apply(A,B)},C)},wrap:function(B){var A=this;return function(){return B.apply(this,[A.bind(this)].concat($A(arguments)))}},methodize:function(){if(this._methodized){return this._methodized}var A=this;return this._methodized=function(){return A.apply(null,[this].concat($A(arguments)))}}});Function.prototype.defer=Function.prototype.delay.curry(0.01);Date.prototype.toJSON=function(){return'"'+this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+'Z"'};var Try={these:function(){var C;for(var B=0,D=arguments.length;B<D;B++){var A=arguments[B];try{C=A();break}catch(E){}}return C}};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()}finally{this.currentlyExecuting=false}}}});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,{gsub:function(E,C){var A="",D=this,B;C=arguments.callee.prepareReplacement(C);while(D.length>0){if(B=D.match(E)){A+=D.slice(0,B.index);A+=String.interpret(C(B));D=D.slice(B.index+B[0].length)}else{A+=D,D=""}}return A},sub:function(C,A,B){A=this.gsub.prepareReplacement(A);B=Object.isUndefined(B)?1:B;return this.gsub(C,function(D){if(--B<0){return D[0]}return A(D)})},scan:function(B,A){this.gsub(B,A);return String(this)},truncate:function(B,A){B=B||30;A=Object.isUndefined(A)?"...":A;return this.length>B?this.slice(0,B-A.length)+A:String(this)},strip:function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,"")},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")},extractScripts:function(){var B=new RegExp(Prototype.ScriptFragment,"img");var A=new RegExp(Prototype.ScriptFragment,"im");return(this.match(B)||[]).map(function(C){return(C.match(A)||["",""])[1]})},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)})},escapeHTML:function(){var A=arguments.callee;A.text.data=this;return A.div.innerHTML},unescapeHTML:function(){var A=new Element("div");A.innerHTML=this.stripTags();return A.childNodes[0]?(A.childNodes.length>1?$A(A.childNodes).inject("",function(B,C){return B+C.nodeValue}):A.childNodes[0].nodeValue):""},toQueryParams:function(B){var A=this.strip().match(/([^?#]*)(#.*)?$/);if(!A){return{}}return A[1].split(B||"&").inject({},function(E,F){if((F=F.split("="))[0]){var C=decodeURIComponent(F.shift());var D=F.length>1?F.join("="):F[0];if(D!=undefined){D=decodeURIComponent(D)}if(C in E){if(!Object.isArray(E[C])){E[C]=[E[C]]}E[C].push(D)}else{E[C]=D}}return E})},toArray:function(){return this.split("")},succ:function(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)},times:function(A){return A<1?"":new Array(A+1).join(this)},camelize:function(){var D=this.split("-"),A=D.length;if(A==1){return D[0]}var C=this.charAt(0)=="-"?D[0].charAt(0).toUpperCase()+D[0].substring(1):D[0];for(var B=1;B<A;B++){C+=D[B].charAt(0).toUpperCase()+D[B].substring(1)}return C},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()},underscore:function(){return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase()},dasherize:function(){return this.gsub(/_/,"-")},inspect:function(B){var A=this.gsub(/[\x00-\x1f\\]/,function(C){var D=String.specialChar[C[0]];return D?D:"\\u00"+C[0].charCodeAt().toPaddedString(2,16)});if(B){return'"'+A.replace(/"/g,'\\"')+'"'}return"'"+A.replace(/'/g,"\\'")+"'"},toJSON:function(){return this.inspect(true)},unfilterJSON:function(A){return this.sub(A||Prototype.JSONFilter,"#{1}")},isJSON:function(){var A=this;if(A.blank()){return false}A=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(A)},evalJSON:function(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())},include:function(A){return this.indexOf(A)>-1},startsWith:function(A){return this.indexOf(A)===0},endsWith:function(A){var B=this.length-A.length;return B>=0&&this.lastIndexOf(A)===B},empty:function(){return this==""},blank:function(){return/^\s*$/.test(this)},interpolate:function(A,B){return new Template(this,B).evaluate(A)}});if(Prototype.Browser.WebKit||Prototype.Browser.IE){Object.extend(String.prototype,{escapeHTML:function(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},unescapeHTML:function(){return this.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">")}})}String.prototype.gsub.prepareReplacement=function(B){if(Object.isFunction(B)){return B}var A=new Template(B);return function(C){return A.evaluate(C)}};String.prototype.parseQuery=String.prototype.toQueryParams;Object.extend(String.prototype.escapeHTML,{div:document.createElement("div"),text:document.createTextNode("")});with(String.prototype.escapeHTML){div.appendChild(text)}var Template=Class.create({initialize:function(A,B){this.template=A.toString();this.pattern=B||Template.Pattern},evaluate:function(A){if(Object.isFunction(A.toTemplateReplacements)){A=A.toTemplateReplacements()}return this.template.gsub(this.pattern,function(D){if(A==null){return""}var F=D[1]||"";if(F=="\\"){return D[2]}var B=A,G=D[3];var E=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;D=E.exec(G);if(D==null){return F}while(D!=null){var C=D[1].startsWith("[")?D[2].gsub("\\\\]","]"):D[1];B=B[C];if(null==B||""==D[3]){break}G=G.substring("["==D[3]?D[1].length:D[0].length);D=E.exec(G)}return F+String.interpret(B)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable={each:function(C,B){var A=0;C=C.bind(B);try{this._each(function(E){C(E,A++)})}catch(D){if(D!=$break){throw D}}return this},eachSlice:function(D,C,B){C=C?C.bind(B):Prototype.K;var A=-D,E=[],F=this.toArray();while((A+=D)<F.length){E.push(F.slice(A,A+D))}return E.collect(C,B)},all:function(C,B){C=C?C.bind(B):Prototype.K;var A=true;this.each(function(E,D){A=A&&!!C(E,D);if(!A){throw $break}});return A},any:function(C,B){C=C?C.bind(B):Prototype.K;var A=false;this.each(function(E,D){if(A=!!C(E,D)){throw $break}});return A},collect:function(C,B){C=C?C.bind(B):Prototype.K;var A=[];this.each(function(E,D){A.push(C(E,D))});return A},detect:function(C,B){C=C.bind(B);var A;this.each(function(E,D){if(C(E,D)){A=E;throw $break}});return A},findAll:function(C,B){C=C.bind(B);var A=[];this.each(function(E,D){if(C(E,D)){A.push(E)}});return A},grep:function(D,C,B){C=C?C.bind(B):Prototype.K;var A=[];if(Object.isString(D)){D=new RegExp(D)}this.each(function(F,E){if(D.match(F)){A.push(C(F,E))}});return A},include:function(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},inGroupsOf:function(B,A){A=Object.isUndefined(A)?null:A;return this.eachSlice(B,function(C){while(C.length<B){C.push(A)}return C})},inject:function(A,C,B){C=C.bind(B);this.each(function(E,D){A=C(A,E,D)});return A},invoke:function(B){var A=$A(arguments).slice(1);return this.map(function(C){return C[B].apply(C,A)})},max:function(C,B){C=C?C.bind(B):Prototype.K;var A;this.each(function(E,D){E=C(E,D);if(A==null||E>=A){A=E}});return A},min:function(C,B){C=C?C.bind(B):Prototype.K;var A;this.each(function(E,D){E=C(E,D);if(A==null||E<A){A=E}});return A},partition:function(D,B){D=D?D.bind(B):Prototype.K;var C=[],A=[];this.each(function(F,E){(D(F,E)?C:A).push(F)});return[C,A]},pluck:function(B){var A=[];this.each(function(C){A.push(C[B])});return A},reject:function(C,B){C=C.bind(B);var A=[];this.each(function(E,D){if(!C(E,D)){A.push(E)}});return A},sortBy:function(B,A){B=B.bind(A);return this.map(function(D,C){return{value:D,criteria:B(D,C)}}).sort(function(F,E){var D=F.criteria,C=E.criteria;return D<C?-1:D>C?1:0}).pluck("value")},toArray:function(){return this.map()},zip:function(){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))})},size:function(){return this.toArray().length},inspect:function(){return"#<Enumerable:"+this.toArray().inspect()+">"}};Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,filter:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray,every:Enumerable.all,some:Enumerable.any});function $A(C){if(!C){return[]}if(C.toArray){return C.toArray()}var B=C.length||0,A=new Array(B);while(B--){A[B]=C[B]}return A}if(Prototype.Browser.WebKit){$A=function(C){if(!C){return[]}if(!(Object.isFunction(C)&&C=="[object NodeList]")&&C.toArray){return C.toArray()}var B=C.length||0,A=new Array(B);while(B--){A[B]=C[B]}return A}}Array.from=$A;Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse){Array.prototype._reverse=Array.prototype.reverse}Object.extend(Array.prototype,{_each:function(B){for(var A=0,C=this.length;A<C;A++){B(this[A])}},clear:function(){this.length=0;return this},first:function(){return this[0]},last:function(){return this[this.length-1]},compact:function(){return this.select(function(A){return A!=null})},flatten:function(){return this.inject([],function(B,A){return B.concat(Object.isArray(A)?A.flatten():[A])})},without:function(){var A=$A(arguments);return this.select(function(B){return !A.include(B)})},reverse:function(A){return(A!==false?this:this.toArray())._reverse()},reduce:function(){return this.length>1?this:this[0]},uniq:function(A){return this.inject([],function(D,C,B){if(0==B||(A?D.last()!=C:!D.include(C))){D.push(C)}return D})},intersect:function(A){return this.uniq().findAll(function(B){return A.detect(function(C){return B===C})})},clone:function(){return[].concat(this)},size:function(){return this.length},inspect:function(){return"["+this.map(Object.inspect).join(", ")+"]"},toJSON:function(){var A=[];this.each(function(B){var C=Object.toJSON(B);if(!Object.isUndefined(C)){A.push(C)}});return"["+A.join(", ")+"]"}});if(Object.isFunction(Array.prototype.forEach)){Array.prototype._each=Array.prototype.forEach}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(C,A){A||(A=0);var B=this.length;if(A<0){A=B+A}for(;A<B;A++){if(this[A]===C){return A}}return -1}}if(!Array.prototype.lastIndexOf){Array.prototype.lastIndexOf=function(B,A){A=isNaN(A)?this.length:(A<0?this.length+A:A)+1;var C=this.slice(0,A).reverse().indexOf(B);return(C<0)?C:A-C-1}}Array.prototype.toArray=Array.prototype.clone;function $w(A){if(!Object.isString(A)){return[]}A=A.strip();return A?A.split(/\s+/):[]}if(Prototype.Browser.Opera){Array.prototype.concat=function(){var E=[];for(var B=0,C=this.length;B<C;B++){E.push(this[B])}for(var B=0,C=arguments.length;B<C;B++){if(Object.isArray(arguments[B])){for(var A=0,D=arguments[B].length;A<D;A++){E.push(arguments[B][A])}}else{E.push(arguments[B])}}return E}}Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16)},succ:function(){return this+1},times:function(A){$R(0,this,true).each(A);return this},toPaddedString:function(C,B){var A=this.toString(B||10);return"0".times(C-A.length)+A},toJSON:function(){return isFinite(this)?this.toString():"null"}});$w("abs round ceil floor").each(function(A){Number.prototype[A]=Math[A].methodize()});function $H(A){return new Hash(A)}var Hash=Class.create(Enumerable,(function(){function A(B,C){if(Object.isUndefined(C)){return B}return B+"="+encodeURIComponent(String.interpret(C))}return{initialize:function(B){this._object=Object.isHash(B)?B.toObject():Object.clone(B)},_each:function(C){for(var B in this._object){var D=this._object[B],E=[B,D];E.key=B;E.value=D;C(E)}},set:function(B,C){return this._object[B]=C},get:function(B){return this._object[B]},unset:function(B){var C=this._object[B];delete this._object[B];return C},toObject:function(){return Object.clone(this._object)},keys:function(){return this.pluck("key")},values:function(){return this.pluck("value")},index:function(C){var B=this.detect(function(D){return D.value===C});return B&&B.key},merge:function(B){return this.clone().update(B)},update:function(B){return new Hash(B).inject(this,function(C,D){C.set(D.key,D.value);return C})},toQueryString:function(){return this.map(function(D){var C=encodeURIComponent(D.key),B=D.value;if(B&&typeof B=="object"){if(Object.isArray(B)){return B.map(A.curry(C)).join("&")}}return A(C,B)}).join("&")},inspect:function(){return"#<Hash:{"+this.map(function(B){return B.map(Object.inspect).join(": ")}).join(", ")+"}>"},toJSON:function(){return Object.toJSON(this.toObject())},clone:function(){return new Hash(this)}}})());Hash.prototype.toTemplateReplacements=Hash.prototype.toObject;Hash.from=$H;var ObjectRange=Class.create(Enumerable,{initialize:function(C,A,B){this.start=C;this.end=A;this.exclusive=B},_each:function(A){var B=this.start;while(this.include(B)){A(B);B=B.succ()}},include:function(A){if(A<this.start){return false}if(this.exclusive){return A<this.end}return A<=this.end}});var $R=function(C,A,B){return new ObjectRange(C,A,B)};var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||false},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(A){this.responders._each(A)},register:function(A){if(!this.include(A)){this.responders.push(A)}},unregister:function(A){this.responders=this.responders.without(A)},dispatch:function(D,B,C,A){this.each(function(E){if(Object.isFunction(E[D])){try{E[D].apply(E,[B,C,A])}catch(F){}}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(A){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};Object.extend(this.options,A||{});this.options.method=this.options.method.toLowerCase();if(Object.isString(this.options.parameters)){this.options.parameters=this.options.parameters.toQueryParams()}else{if(Object.isHash(this.options.parameters)){this.options.parameters=this.options.parameters.toObject()}}}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,B,A){$super(A);this.transport=Ajax.getTransport();this.request(B)},request:function(B){this.url=B;this.method=this.options.method;var D=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){D._method=this.method;this.method="post"}this.parameters=D;if(D=Object.toQueryString(D)){if(this.method=="get"){this.url+=(this.url.include("?")?"&":"?")+D}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){D+="&_="}}}try{var A=new Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(A)}Ajax.Responders.dispatch("onCreate",this,A);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){this.respondToReadyState.bind(this).defer(1)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?(this.options.postBody||D):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(C){this.dispatchException(C)}},onStateChange:function(){var A=this.transport.readyState;if(A>1&&!((A==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var E={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){E["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){E.Connection="close"}}if(typeof this.options.requestHeaders=="object"){var C=this.options.requestHeaders;if(Object.isFunction(C.push)){for(var B=0,D=C.length;B<D;B+=2){E[C[B]]=C[B+1]}}else{$H(C).each(function(F){E[F.key]=F.value})}}for(var A in E){this.transport.setRequestHeader(A,E[A])}},success:function(){var A=this.getStatus();return !A||(A>=200&&A<300)},getStatus:function(){try{return this.transport.status||0}catch(A){return 0}},respondToReadyState:function(A){var C=Ajax.Request.Events[A],B=new Ajax.Response(this);if(C=="Complete"){try{this._complete=true;(this.options["on"+B.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(B,B.headerJSON)}catch(D){this.dispatchException(D)}var E=B.getHeader("Content-type");if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&E&&E.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse()}}try{(this.options["on"+C]||Prototype.emptyFunction)(B,B.headerJSON);Ajax.Responders.dispatch("on"+C,this,B,B.headerJSON)}catch(D){this.dispatchException(D)}if(C=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},isSameOrigin:function(){var A=this.url.match(/^\s*https?:\/\/[^\/]*/);return !A||(A[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""}))},getHeader:function(A){try{return this.transport.getResponseHeader(A)||null}catch(B){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(A){(this.options.onException||Prototype.emptyFunction)(this,A);Ajax.Responders.dispatch("onException",this,A)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Response=Class.create({initialize:function(C){this.request=C;var D=this.transport=C.transport,A=this.readyState=D.readyState;if((A>2&&!Prototype.Browser.IE)||A==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(D.responseText);this.headerJSON=this._getHeaderJSON()}if(A==4){var B=D.responseXML;this.responseXML=Object.isUndefined(B)?null:B;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""}catch(A){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(A){return null}},getResponseHeader:function(A){return this.transport.getResponseHeader(A)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var A=this.getHeader("X-JSON");if(!A){return null}A=decodeURIComponent(escape(A));try{return A.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(B){this.request.dispatchException(B)}},_getResponseJSON:function(){var A=this.request.options;if(!A.evalJSON||(A.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json"))||this.responseText.blank()){return null}try{return this.responseText.evalJSON(A.sanitizeJSON||!this.request.isSameOrigin())}catch(B){this.request.dispatchException(B)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,A,C,B){this.container={success:(A.success||A),failure:(A.failure||(A.success?null:A))};B=Object.clone(B);var D=B.onComplete;B.onComplete=(function(E,F){this.updateContent(E.responseText);if(Object.isFunction(D)){D(E,F)}}).bind(this);$super(C,B)},updateContent:function(D){var C=this.container[this.success()?"success":"failure"],A=this.options;if(!A.evalScripts){D=D.stripScripts()}if(C=$(C)){if(A.insertion){if(Object.isString(A.insertion)){var B={};B[A.insertion]=D;C.insert(B)}else{A.insertion(C,D)}}else{C.update(D)}}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,A,C,B){$super(B);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=A;this.url=C;this.start()},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent()},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments)},updateComplete:function(A){if(this.options.decay){this.decay=(A.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=A.responseText}this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});function $(B){if(arguments.length>1){for(var A=0,D=[],C=arguments.length;A<C;A++){D.push($(arguments[A]))}return D}if(Object.isString(B)){B=document.getElementById(B)}return Element.extend(B)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(F,A){var C=[];var E=document.evaluate(F,$(A)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var B=0,D=E.snapshotLength;B<D;B++){C.push(Element.extend(E.snapshotItem(B)))}return C}}if(!window.Node){var Node={}}if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12})}(function(){var A=this.Element;this.Element=function(D,C){C=C||{};D=D.toLowerCase();var B=Element.cache;if(Prototype.Browser.IE&&C.name){D="<"+D+' name="'+C.name+'">';delete C.name;return Element.writeAttribute(document.createElement(D),C)}if(!B[D]){B[D]=Element.extend(document.createElement(D))}return Element.writeAttribute(B[D].cloneNode(false),C)};Object.extend(this.Element,A||{})}).call(window);Element.cache={};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).style.display="none";return A},show:function(A){$(A).style.display="";return A},remove:function(A){A=$(A);A.parentNode.removeChild(A);return A},update:function(A,B){A=$(A);if(B&&B.toElement){B=B.toElement()}if(Object.isElement(B)){return A.update().insert(B)}B=Object.toHTML(B);A.innerHTML=B.stripScripts();B.evalScripts.bind(B).defer();return A},replace:function(B,C){B=$(B);if(C&&C.toElement){C=C.toElement()}else{if(!Object.isElement(C)){C=Object.toHTML(C);var A=B.ownerDocument.createRange();A.selectNode(B);C.evalScripts.bind(C).defer();C=A.createContextualFragment(C.stripScripts())}}B.parentNode.replaceChild(C,B);return B},insert:function(C,E){C=$(C);if(Object.isString(E)||Object.isNumber(E)||Object.isElement(E)||(E&&(E.toElement||E.toHTML))){E={bottom:E}}var D,F,B,G;for(var A in E){D=E[A];A=A.toLowerCase();F=Element._insertionTranslations[A];if(D&&D.toElement){D=D.toElement()}if(Object.isElement(D)){F(C,D);continue}D=Object.toHTML(D);B=((A=="before"||A=="after")?C.parentNode:C).tagName.toUpperCase();G=Element._getContentFromAnonymousElement(B,D.stripScripts());if(A=="top"||A=="after"){G.reverse()}G.each(F.curry(C));D.evalScripts.bind(D).defer()}return C},wrap:function(B,C,A){B=$(B);if(Object.isElement(C)){$(C).writeAttribute(A||{})}else{if(Object.isString(C)){C=new Element(C,A)}else{C=new Element("div",C)}}if(B.parentNode){B.parentNode.replaceChild(C,B)}C.appendChild(B);return C},inspect:function(B){B=$(B);var A="<"+B.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(F){var E=F.first(),C=F.last();var D=(B[E]||"").toString();if(D){A+=" "+C+"="+D.inspect(true)}});return A+">"},recursivelyCollect:function(A,C){A=$(A);var B=[];while(A=A[C]){if(A.nodeType==1){B.push(Element.extend(A))}}return B},ancestors:function(A){return $(A).recursivelyCollect("parentNode")},descendants:function(A){return $(A).select("*")},firstDescendant:function(A){A=$(A).firstChild;while(A&&A.nodeType!=1){A=A.nextSibling}return $(A)},immediateDescendants:function(A){if(!(A=$(A).firstChild)){return[]}while(A&&A.nodeType!=1){A=A.nextSibling}if(A){return[A].concat($(A).nextSiblings())}return[]},previousSiblings:function(A){return $(A).recursivelyCollect("previousSibling")},nextSiblings:function(A){return $(A).recursivelyCollect("nextSibling")},siblings:function(A){A=$(A);return A.previousSiblings().reverse().concat(A.nextSiblings())},match:function(B,A){if(Object.isString(A)){A=new Selector(A)}return A.match($(B))},up:function(B,D,A){B=$(B);if(arguments.length==1){return $(B.parentNode)}var C=B.ancestors();return Object.isNumber(D)?C[D]:Selector.findElement(C,D,A)},down:function(B,C,A){B=$(B);if(arguments.length==1){return B.firstDescendant()}return Object.isNumber(C)?B.descendants()[C]:B.select(C)[A||0]},previous:function(B,D,A){B=$(B);if(arguments.length==1){return $(Selector.handlers.previousElementSibling(B))}var C=B.previousSiblings();return Object.isNumber(D)?C[D]:Selector.findElement(C,D,A)},next:function(C,D,B){C=$(C);if(arguments.length==1){return $(Selector.handlers.nextElementSibling(C))}var A=C.nextSiblings();return Object.isNumber(D)?A[D]:Selector.findElement(A,D,B)},select:function(){var A=$A(arguments),B=$(A.shift());return Selector.findChildElements(B,A)},adjacent:function(){var A=$A(arguments),B=$(A.shift());return Selector.findChildElements(B.parentNode,A).without(B)},identify:function(B){B=$(B);var C=B.readAttribute("id"),A=arguments.callee;if(C){return C}do{C="anonymous_element_"+A.counter++}while($(C));B.writeAttribute("id",C);return C},readAttribute:function(C,A){C=$(C);if(Prototype.Browser.IE){var B=Element._attributeTranslations.read;if(B.values[A]){return B.values[A](C,A)}if(B.names[A]){A=B.names[A]}if(A.include(":")){return(!C.attributes||!C.attributes[A])?null:C.attributes[A].value}}return C.getAttribute(A)},writeAttribute:function(E,C,F){E=$(E);var B={},D=Element._attributeTranslations.write;if(typeof C=="object"){B=C}else{B[C]=Object.isUndefined(F)?true:F}for(var A in B){C=D.names[A]||A;F=B[A];if(D.values[A]){C=D.values[A](E,F)}if(F===false||F===null){E.removeAttribute(C)}else{if(F===true){E.setAttribute(C,C)}else{E.setAttribute(C,F)}}}return E},getHeight:function(A){return $(A).getDimensions().height},getWidth:function(A){return $(A).getDimensions().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(!A.hasClassName(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 A[A.hasClassName(B)?"removeClassName":"addClassName"](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(D,C){D=$(D),C=$(C);var F=C;if(D.compareDocumentPosition){return(D.compareDocumentPosition(C)&8)===8}if(D.sourceIndex&&!Prototype.Browser.Opera){var E=D.sourceIndex,B=C.sourceIndex,A=C.nextSibling;if(!A){do{C=C.parentNode}while(!(A=C.nextSibling)&&C.parentNode)}if(A&&A.sourceIndex){return(E>B&&E<A.sourceIndex)}}while(D=D.parentNode){if(D==F){return true}}return false},scrollTo:function(A){A=$(A);var B=A.cumulativeOffset();window.scrollTo(B[0],B[1]);return A},getStyle:function(B,C){B=$(B);C=C=="float"?"cssFloat":C.camelize();var D=B.style[C];if(!D){var A=document.defaultView.getComputedStyle(B,null);D=A?A[C]:null}if(C=="opacity"){return D?parseFloat(D):1}return D=="auto"?null:D},getOpacity:function(A){return $(A).getStyle("opacity")},setStyle:function(B,C){B=$(B);var E=B.style,A;if(Object.isString(C)){B.style.cssText+=";"+C;return C.include("opacity")?B.setOpacity(C.match(/opacity:\s*(\d?\.?\d*)/)[1]):B}for(var D in C){if(D=="opacity"){B.setOpacity(C[D])}else{E[(D=="float"||D=="cssFloat")?(Object.isUndefined(E.styleFloat)?"cssFloat":"styleFloat"):D]=C[D]}}return B},setOpacity:function(A,B){A=$(A);A.style.opacity=(B==1||B==="")?"":(B<0.00001)?0:B;return A},getDimensions:function(C){C=$(C);var G=$(C).getStyle("display");if(G!="none"&&G!=null){return{width:C.offsetWidth,height:C.offsetHeight}}var B=C.style;var F=B.visibility;var D=B.position;var A=B.display;B.visibility="hidden";B.position="absolute";B.display="block";var H=C.clientWidth;var E=C.clientHeight;B.display=A;B.position=D;B.visibility=F;return{width:H,height:E}},makePositioned:function(A){A=$(A);var B=Element.getStyle(A,"position");if(B=="static"||!B){A._madePositioned=true;A.style.position="relative";if(window.opera){A.style.top=0;A.style.left=0}}return A},undoPositioned:function(A){A=$(A);if(A._madePositioned){A._madePositioned=undefined;A.style.position=A.style.top=A.style.left=A.style.bottom=A.style.right=""}return A},makeClipping:function(A){A=$(A);if(A._overflow){return A}A._overflow=Element.getStyle(A,"overflow")||"auto";if(A._overflow!=="hidden"){A.style.overflow="hidden"}return A},undoClipping:function(A){A=$(A);if(!A._overflow){return A}A.style.overflow=A._overflow=="auto"?"":A._overflow;A._overflow=null;return A},cumulativeOffset:function(B){var A=0,C=0;do{A+=B.offsetTop||0;C+=B.offsetLeft||0;B=B.offsetParent}while(B);return Element._returnOffset(C,A)},positionedOffset:function(B){var A=0,D=0;do{A+=B.offsetTop||0;D+=B.offsetLeft||0;B=B.offsetParent;if(B){if(B.tagName=="BODY"){break}var C=Element.getStyle(B,"position");if(C!=="static"){break}}}while(B);return Element._returnOffset(D,A)},absolutize:function(B){B=$(B);if(B.getStyle("position")=="absolute"){return }var D=B.positionedOffset();var F=D[1];var E=D[0];var C=B.clientWidth;var A=B.clientHeight;B._originalLeft=E-parseFloat(B.style.left||0);B._originalTop=F-parseFloat(B.style.top||0);B._originalWidth=B.style.width;B._originalHeight=B.style.height;B.style.position="absolute";B.style.top=F+"px";B.style.left=E+"px";B.style.width=C+"px";B.style.height=A+"px";return B},relativize:function(A){A=$(A);if(A.getStyle("position")=="relative"){return }A.style.position="relative";var C=parseFloat(A.style.top||0)-(A._originalTop||0);var B=parseFloat(A.style.left||0)-(A._originalLeft||0);A.style.top=C+"px";A.style.left=B+"px";A.style.height=A._originalHeight;A.style.width=A._originalWidth;return A},cumulativeScrollOffset:function(B){var A=0,C=0;do{A+=B.scrollTop||0;C+=B.scrollLeft||0;B=B.parentNode}while(B);return Element._returnOffset(C,A)},getOffsetParent:function(A){if(A.offsetParent){return $(A.offsetParent)}if(A==document.body){return $(A)}while((A=A.parentNode)&&A!=document.body){if(Element.getStyle(A,"position")!="static"){return $(A)}}return $(document.body)},viewportOffset:function(D){var A=0,C=0;var B=D;do{A+=B.offsetTop||0;C+=B.offsetLeft||0;if(B.offsetParent==document.body&&Element.getStyle(B,"position")=="absolute"){break}}while(B=B.offsetParent);B=D;do{if(!Prototype.Browser.Opera||B.tagName=="BODY"){A-=B.scrollTop||0;C-=B.scrollLeft||0}}while(B=B.parentNode);return Element._returnOffset(C,A)},clonePosition:function(B,D){var A=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});D=$(D);var E=D.viewportOffset();B=$(B);var F=[0,0];var C=null;if(Element.getStyle(B,"position")=="absolute"){C=B.getOffsetParent();F=C.viewportOffset()}if(C==document.body){F[0]-=document.body.offsetLeft;F[1]-=document.body.offsetTop}if(A.setLeft){B.style.left=(E[0]-F[0]+A.offsetLeft)+"px"}if(A.setTop){B.style.top=(E[1]-F[1]+A.offsetTop)+"px"}if(A.setWidth){B.style.width=D.offsetWidth+"px"}if(A.setHeight){B.style.height=D.offsetHeight+"px"}return B}};Element.Methods.identify.counter=1;Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(D,B,C){switch(C){case"left":case"top":case"right":case"bottom":if(D(B,"position")==="static"){return null}case"height":case"width":if(!Element.visible(B)){return null}var E=parseInt(D(B,C),10);if(E!==B["offset"+C.capitalize()]){return E+"px"}var A;if(C==="height"){A=["border-top-width","padding-top","padding-bottom","border-bottom-width"]}else{A=["border-left-width","padding-left","padding-right","border-right-width"]}return A.inject(E,function(F,G){var H=D(B,G);return H===null?F:F-parseInt(H,10)})+"px";default:return D(B,C)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(C,A,B){if(B==="title"){return A.title}return C(A,B)})}else{if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(C,B){B=$(B);var A=B.getStyle("position");if(A!=="static"){return C(B)}B.setStyle({position:"relative"});var D=C(B);B.setStyle({position:A});return D});$w("positionedOffset viewportOffset").each(function(A){Element.Methods[A]=Element.Methods[A].wrap(function(E,C){C=$(C);var B=C.getStyle("position");if(B!=="static"){return E(C)}var D=C.getOffsetParent();if(D&&D.getStyle("position")==="fixed"){D.setStyle({zoom:1})}C.setStyle({position:"relative"});var F=E(C);C.setStyle({position:B});return F})});Element.Methods.getStyle=function(A,B){A=$(A);B=(B=="float"||B=="cssFloat")?"styleFloat":B.camelize();var C=A.style[B];if(!C&&A.currentStyle){C=A.currentStyle[B]}if(B=="opacity"){if(C=(A.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(C[1]){return parseFloat(C[1])/100}}return 1}if(C=="auto"){if((B=="width"||B=="height")&&(A.getStyle("display")!="none")){return A["offset"+B.capitalize()]+"px"}return null}return C};Element.Methods.setOpacity=function(B,E){function F(G){return G.replace(/alpha\([^\)]*\)/gi,"")}B=$(B);var A=B.currentStyle;if((A&&!A.hasLayout)||(!A&&B.style.zoom=="normal")){B.style.zoom=1}var D=B.getStyle("filter"),C=B.style;if(E==1||E===""){(D=F(D))?C.filter=D:C.removeAttribute("filter");return B}else{if(E<0.00001){E=0}}C.filter=F(D)+"alpha(opacity="+(E*100)+")";return B};Element._attributeTranslations={read:{names:{"class":"className","for":"htmlFor"},values:{_getAttr:function(A,B){return A.getAttribute(B,2)},_getAttrNode:function(A,C){var B=A.getAttributeNode(C);return B?B.value:""},_getEv:function(A,B){B=A.getAttribute(B);return B?B.toString().slice(23,-2):null},_flag:function(A,B){return $(A).hasAttribute(B)?B:null},style:function(A){return A.style.cssText.toLowerCase()},title:function(A){return A.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").each(function(A){Element._attributeTranslations.write.names[A.toLowerCase()]=A;Element._attributeTranslations.has[A.toLowerCase()]=A});(function(A){Object.extend(A,{href:A._getAttr,src:A._getAttr,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)}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=="IMG"&&A.width){A.width++;A.width--}else{try{var D=document.createTextNode(" ");A.appendChild(D);A.removeChild(D)}catch(C){}}}return A};Element.Methods.cumulativeOffset=function(B){var A=0,C=0;do{A+=B.offsetTop||0;C+=B.offsetLeft||0;if(B.offsetParent==document.body){if(Element.getStyle(B,"position")=="absolute"){break}}B=B.offsetParent}while(B);return Element._returnOffset(C,A)}}}}}if(Prototype.Browser.IE||Prototype.Browser.Opera){Element.Methods.update=function(B,C){B=$(B);if(C&&C.toElement){C=C.toElement()}if(Object.isElement(C)){return B.update().insert(C)}C=Object.toHTML(C);var A=B.tagName.toUpperCase();if(A in Element._insertionTranslations.tags){$A(B.childNodes).each(function(D){B.removeChild(D)});Element._getContentFromAnonymousElement(A,C.stripScripts()).each(function(D){B.appendChild(D)})}else{B.innerHTML=C.stripScripts()}C.evalScripts.bind(C).defer();return B}}if("outerHTML" in document.createElement("div")){Element.Methods.replace=function(C,E){C=$(C);if(E&&E.toElement){E=E.toElement()}if(Object.isElement(E)){C.parentNode.replaceChild(E,C);return C}E=Object.toHTML(E);var D=C.parentNode,B=D.tagName.toUpperCase();if(Element._insertionTranslations.tags[B]){var F=C.next();var A=Element._getContentFromAnonymousElement(B,E.stripScripts());D.removeChild(C);if(F){A.each(function(G){D.insertBefore(G,F)})}else{A.each(function(G){D.appendChild(G)})}}else{C.outerHTML=E.stripScripts()}E.evalScripts.bind(E).defer();return C}}Element._returnOffset=function(B,C){var A=[B,C];A.left=B;A.top=C;return A};Element._getContentFromAnonymousElement=function(C,B){var D=new Element("div"),A=Element._insertionTranslations.tags[C];if(A){D.innerHTML=A[0]+B+A[1];A[2].times(function(){D=D.firstChild})}else{D.innerHTML=B}return $A(D.childNodes)};Element._insertionTranslations={before:function(A,B){A.parentNode.insertBefore(B,A)},top:function(A,B){A.insertBefore(B,A.firstChild)},bottom:function(A,B){A.appendChild(B)},after:function(A,B){A.parentNode.insertBefore(B,A.nextSibling)},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};(function(){Object.extend(this.tags,{THEAD:this.tags.TBODY,TFOOT:this.tags.TBODY,TH:this.tags.TD})}).call(Element._insertionTranslations);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);if(!Prototype.BrowserFeatures.ElementExtensions&&document.createElement("div").__proto__){window.HTMLElement={};window.HTMLElement.prototype=document.createElement("div").__proto__;Prototype.BrowserFeatures.ElementExtensions=true}Element.extend=(function(){if(Prototype.BrowserFeatures.SpecificElementExtensions){return Prototype.K}var A={},B=Element.Methods.ByTag;var C=Object.extend(function(F){if(!F||F._extendedByPrototype||F.nodeType!=1||F==window){return F}var D=Object.clone(A),E=F.tagName,H,G;if(B[E]){Object.extend(D,B[E])}for(H in D){G=D[H];if(Object.isFunction(G)&&!(H in F)){F[H]=G.methodize()}}F._extendedByPrototype=Prototype.emptyFunction;return F},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(A,Element.Methods);Object.extend(A,Element.Methods.Simulated)}}});C.refresh();return C})();Element.hasAttribute=function(A,B){if(A.hasAttribute){return A.hasAttribute(B)}return Element.Methods.Simulated.hasAttribute(A,B)};Element.addMethods=function(C){var I=Prototype.BrowserFeatures,D=Element.Methods.ByTag;if(!C){Object.extend(Form,Form.Methods);Object.extend(Form.Element,Form.Element.Methods);Object.extend(Element.Methods.ByTag,{FORM:Object.clone(Form.Methods),INPUT:Object.clone(Form.Element.Methods),SELECT:Object.clone(Form.Element.Methods),TEXTAREA:Object.clone(Form.Element.Methods)})}if(arguments.length==2){var B=C;C=arguments[1]}if(!B){Object.extend(Element.Methods,C||{})}else{if(Object.isArray(B)){B.each(H)}else{H(B)}}function H(F){F=F.toUpperCase();if(!Element.Methods.ByTag[F]){Element.Methods.ByTag[F]={}}Object.extend(Element.Methods.ByTag[F],C)}function A(L,K,F){F=F||false;for(var N in L){var M=L[N];if(!Object.isFunction(M)){continue}if(!F||!(N in K)){K[N]=M.methodize()}}}function E(L){var F;var K={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(K[L]){F="HTML"+K[L]+"Element"}if(window[F]){return window[F]}F="HTML"+L+"Element";if(window[F]){return window[F]}F="HTML"+L.capitalize()+"Element";if(window[F]){return window[F]}window[F]={};window[F].prototype=document.createElement(L).__proto__;return window[F]}if(I.ElementExtensions){A(Element.Methods,HTMLElement.prototype);A(Element.Methods.Simulated,HTMLElement.prototype,true)}if(I.SpecificElementExtensions){for(var J in Element.Methods.ByTag){var G=E(J);if(Object.isUndefined(G)){continue}A(D[J],G.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh){Element.extend.refresh()}Element.cache={}};document.viewport={getDimensions:function(){var A={};var C=Prototype.Browser;$w("width height").each(function(E){var B=E.capitalize();A[E]=(C.WebKit&&!document.evaluate)?self["inner"+B]:(C.Opera)?document.body["client"+B]:document.documentElement["client"+B]});return A},getWidth:function(){return this.getDimensions().width},getHeight:function(){return this.getDimensions().height},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};var Selector=Class.create({initialize:function(A){this.expression=A.strip();this.compileMatcher()},shouldUseXPath:function(){if(!Prototype.BrowserFeatures.XPath){return false}var A=this.expression;if(Prototype.Browser.WebKit&&(A.include("-of-type")||A.include(":empty"))){return false}if((/(\[[\w-]*?:|:checked)/).test(this.expression)){return false}return true},compileMatcher:function(){if(this.shouldUseXPath()){return this.compileXPathMatcher()}var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m;if(Selector._cache[e]){this.matcher=Selector._cache[e];return }this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in ps){p=ps[i];if(m=e.match(p)){this.matcher.push(Object.isFunction(c[i])?c[i](m):new Template(c[i]).evaluate(m));e=e.replace(m[0],"");break}}}this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join("\n"));Selector._cache[this.expression]=this.matcher},compileXPathMatcher:function(){var E=this.expression,F=Selector.patterns,B=Selector.xpath,D,A;if(Selector._cache[E]){this.xpath=Selector._cache[E];return }this.matcher=[".//*"];while(E&&D!=E&&(/\S/).test(E)){D=E;for(var C in F){if(A=E.match(F[C])){this.matcher.push(Object.isFunction(B[C])?B[C](A):new Template(B[C]).evaluate(A));E=E.replace(A[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath},findElements:function(A){A=A||document;if(this.xpath){return document._getElementsByXPath(this.xpath,A)}return this.matcher(A)},match:function(H){this.tokens=[];var L=this.expression,A=Selector.patterns,E=Selector.assertions;var B,D,F;while(L&&B!==L&&(/\S/).test(L)){B=L;for(var I in A){D=A[I];if(F=L.match(D)){if(E[I]){this.tokens.push([I,Object.clone(F)]);L=L.replace(F[0],"")}else{return this.findElements(document).include(H)}}}}var K=true,C,J;for(var I=0,G;G=this.tokens[I];I++){C=G[0],J=G[1];if(!Selector.assertions[C](H,J)){K=false;break}}return K},toString:function(){return this.expression},inspect:function(){return"#<Selector:"+this.expression.inspect()+">"}});Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(A){if(A[1]=="*"){return""}return"[local-name()='"+A[1].toLowerCase()+"' or local-name()='"+A[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(A){A[1]=A[1].toLowerCase();return new Template("[@#{1}]").evaluate(A)},attr:function(A){A[1]=A[1].toLowerCase();A[3]=A[5]||A[6];return new Template(Selector.xpath.operators[A[2]]).evaluate(A)},pseudo:function(A){var B=Selector.xpath.pseudos[A[1]];if(!B){return""}if(Object.isFunction(B)){return B(A)}return new Template(Selector.xpath.pseudos[A[1]]).evaluate(A)},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","only-child":"[not(preceding-sibling::* or following-sibling::*)]",empty:"[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]",checked:"[@checked]",disabled:"[@disabled]",enabled:"[not(@disabled)]",not:function(B){var H=B[6],G=Selector.patterns,A=Selector.xpath,E,C;var F=[];while(H&&E!=H&&(/\S/).test(H)){E=H;for(var D in G){if(B=H.match(G[D])){C=Object.isFunction(A[D])?A[D](B):new Template(A[D]).evaluate(B);F.push("("+C.substring(1,C.length-1)+")");H=H.replace(B[0],"");break}}}return"[not("+F.join(" and ")+")]"},"nth-child":function(A){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",A)},"nth-last-child":function(A){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",A)},"nth-of-type":function(A){return Selector.xpath.pseudos.nth("position() ",A)},"nth-last-of-type":function(A){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",A)},"first-of-type":function(A){A[6]="1";return Selector.xpath.pseudos["nth-of-type"](A)},"last-of-type":function(A){A[6]="1";return Selector.xpath.pseudos["nth-last-of-type"](A)},"only-of-type":function(A){var B=Selector.xpath.pseudos;return B["first-of-type"](A)+B["last-of-type"](A)},nth:function(E,C){var F,G=C[6],B;if(G=="even"){G="2n+0"}if(G=="odd"){G="2n+1"}if(F=G.match(/^(\d+)$/)){return"["+E+"= "+F[1]+"]"}if(F=G.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(F[1]=="-"){F[1]=-1}var D=F[1]?Number(F[1]):1;var A=F[2]?Number(F[2]):0;B="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(B).evaluate({fragment:E,a:D,b:A})}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);      c = false;',className:'n = h.className(n, r, "#{1}", c);    c = false;',id:'n = h.id(n, r, "#{1}", c);           c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(A){A[3]=(A[5]||A[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(A)},pseudo:function(A){if(A[6]){A[6]=A[6].replace(/"/g,'\\"')}return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(A)},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:{laterSibling:/^\s*~\s*/,child:/^\s*>\s*/,adjacent:/^\s*\+\s*/,descendant:/^\s/,tagName:/^\s*(\*|[\w\-]+)(\b|$)?/,id:/^#([\w\-\*]+)(\b|$)/,className:/^\.([\w\-\*]+)(\b|$)/,pseudo:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,attrPresence:/^\[([\w]+)\]/,attr:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/},assertions:{tagName:function(A,B){return B[1].toUpperCase()==A.tagName.toUpperCase()},className:function(A,B){return Element.hasClassName(A,B[1])},id:function(A,B){return A.id===B[1]},attrPresence:function(A,B){return Element.hasAttribute(A,B[1])},attr:function(B,C){var A=Element.readAttribute(B,C[1]);return A&&Selector.operators[C[2]](A,C[5]||C[6])}},handlers:{concat:function(B,A){for(var C=0,D;D=A[C];C++){B.push(D)}return B},mark:function(A){var D=Prototype.emptyFunction;for(var B=0,C;C=A[B];B++){C._countedByPrototype=D}return A},unmark:function(A){for(var B=0,C;C=A[B];B++){C._countedByPrototype=undefined}return A},index:function(A,D,G){A._countedByPrototype=Prototype.emptyFunction;if(D){for(var B=A.childNodes,E=B.length-1,C=1;E>=0;E--){var F=B[E];if(F.nodeType==1&&(!G||F._countedByPrototype)){F.nodeIndex=C++}}}else{for(var E=0,C=1,B=A.childNodes;F=B[E];E++){if(F.nodeType==1&&(!G||F._countedByPrototype)){F.nodeIndex=C++}}}},unique:function(B){if(B.length==0){return B}var D=[],E;for(var C=0,A=B.length;C<A;C++){if(!(E=B[C])._countedByPrototype){E._countedByPrototype=Prototype.emptyFunction;D.push(Element.extend(E))}}return Selector.handlers.unmark(D)},descendant:function(A){var D=Selector.handlers;for(var C=0,B=[],E;E=A[C];C++){D.concat(B,E.getElementsByTagName("*"))}return B},child:function(A){var E=Selector.handlers;for(var D=0,C=[],F;F=A[D];D++){for(var B=0,G;G=F.childNodes[B];B++){if(G.nodeType==1&&G.tagName!="!"){C.push(G)}}}return C},adjacent:function(A){for(var C=0,B=[],E;E=A[C];C++){var D=this.nextElementSibling(E);if(D){B.push(D)}}return B},laterSibling:function(A){var D=Selector.handlers;for(var C=0,B=[],E;E=A[C];C++){D.concat(B,Element.nextSiblings(E))}return B},nextElementSibling:function(A){while(A=A.nextSibling){if(A.nodeType==1){return A}}return null},previousElementSibling:function(A){while(A=A.previousSibling){if(A.nodeType==1){return A}}return null},tagName:function(A,H,C,B){var I=C.toUpperCase();var E=[],G=Selector.handlers;if(A){if(B){if(B=="descendant"){for(var F=0,D;D=A[F];F++){G.concat(E,D.getElementsByTagName(C))}return E}else{A=this[B](A)}if(C=="*"){return A}}for(var F=0,D;D=A[F];F++){if(D.tagName.toUpperCase()===I){E.push(D)}}return E}else{return H.getElementsByTagName(C)}},id:function(B,A,H,F){var G=$(H),D=Selector.handlers;if(!G){return[]}if(!B&&A==document){return[G]}if(B){if(F){if(F=="child"){for(var C=0,E;E=B[C];C++){if(G.parentNode==E){return[G]}}}else{if(F=="descendant"){for(var C=0,E;E=B[C];C++){if(Element.descendantOf(G,E)){return[G]}}}else{if(F=="adjacent"){for(var C=0,E;E=B[C];C++){if(Selector.handlers.previousElementSibling(G)==E){return[G]}}}else{B=D[F](B)}}}}for(var C=0,E;E=B[C];C++){if(E==G){return[G]}}return[]}return(G&&Element.descendantOf(G,A))?[G]:[]},className:function(B,A,C,D){if(B&&D){B=this[D](B)}return Selector.handlers.byClassName(B,A,C)},byClassName:function(C,B,F){if(!C){C=Selector.handlers.descendant([B])}var H=" "+F+" ";for(var E=0,D=[],G,A;G=C[E];E++){A=G.className;if(A.length==0){continue}if(A==F||(" "+A+" ").include(H)){D.push(G)}}return D},attrPresence:function(C,B,A,G){if(!C){C=B.getElementsByTagName("*")}if(C&&G){C=this[G](C)}var E=[];for(var D=0,F;F=C[D];D++){if(Element.hasAttribute(F,A)){E.push(F)}}return E},attr:function(A,I,H,J,C,B){if(!A){A=I.getElementsByTagName("*")}if(A&&B){A=this[B](A)}var K=Selector.operators[C],F=[];for(var E=0,D;D=A[E];E++){var G=Element.readAttribute(D,H);if(G===null){continue}if(K(G,J)){F.push(D)}}return F},pseudo:function(B,C,E,A,D){if(B&&D){B=this[D](B)}if(!B){B=A.getElementsByTagName("*")}return Selector.pseudos[C](B,E,A)}},pseudos:{"first-child":function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(Selector.handlers.previousElementSibling(E)){continue}C.push(E)}return C},"last-child":function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(Selector.handlers.nextElementSibling(E)){continue}C.push(E)}return C},"only-child":function(B,G,A){var E=Selector.handlers;for(var D=0,C=[],F;F=B[D];D++){if(!E.previousElementSibling(F)&&!E.nextElementSibling(F)){C.push(F)}}return C},"nth-child":function(B,C,A){return Selector.pseudos.nth(B,C,A)},"nth-last-child":function(B,C,A){return Selector.pseudos.nth(B,C,A,true)},"nth-of-type":function(B,C,A){return Selector.pseudos.nth(B,C,A,false,true)},"nth-last-of-type":function(B,C,A){return Selector.pseudos.nth(B,C,A,true,true)},"first-of-type":function(B,C,A){return Selector.pseudos.nth(B,"1",A,false,true)},"last-of-type":function(B,C,A){return Selector.pseudos.nth(B,"1",A,true,true)},"only-of-type":function(B,D,A){var C=Selector.pseudos;return C["last-of-type"](C["first-of-type"](B,D,A),D,A)},getIndices:function(B,A,C){if(B==0){return A>0?[A]:[]}return $R(1,C).inject([],function(D,E){if(0==(E-A)%B&&(E-A)/B>=0){D.push(E)}return D})},nth:function(A,L,N,K,C){if(A.length==0){return[]}if(L=="even"){L="2n+0"}if(L=="odd"){L="2n+1"}var J=Selector.handlers,I=[],B=[],E;J.mark(A);for(var H=0,D;D=A[H];H++){if(!D.parentNode._countedByPrototype){J.index(D.parentNode,K,C);B.push(D.parentNode)}}if(L.match(/^\d+$/)){L=Number(L);for(var H=0,D;D=A[H];H++){if(D.nodeIndex==L){I.push(D)}}}else{if(E=L.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(E[1]=="-"){E[1]=-1}var O=E[1]?Number(E[1]):1;var M=E[2]?Number(E[2]):0;var P=Selector.pseudos.getIndices(O,M,A.length);for(var H=0,D,F=P.length;D=A[H];H++){for(var G=0;G<F;G++){if(D.nodeIndex==P[G]){I.push(D)}}}}}J.unmark(A);J.unmark(B);return I},empty:function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(E.tagName=="!"||(E.firstChild&&!E.innerHTML.match(/^\s*$/))){continue}C.push(E)}return C},not:function(A,D,I){var G=Selector.handlers,J,C;var H=new Selector(D).findElements(I);G.mark(H);for(var F=0,E=[],B;B=A[F];F++){if(!B._countedByPrototype){E.push(B)}}G.unmark(H);return E},enabled:function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(!E.disabled){C.push(E)}}return C},disabled:function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(E.disabled){C.push(E)}}return C},checked:function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(E.checked){C.push(E)}}return C}},operators:{"=":function(B,A){return B==A},"!=":function(B,A){return B!=A},"^=":function(B,A){return B.startsWith(A)},"$=":function(B,A){return B.endsWith(A)},"*=":function(B,A){return B.include(A)},"~=":function(B,A){return(" "+B+" ").include(" "+A+" ")},"|=":function(B,A){return("-"+B.toUpperCase()+"-").include("-"+A.toUpperCase()+"-")}},split:function(B){var A=[];B.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(C){A.push(C[1].strip())});return A},matchElements:function(F,G){var E=$$(G),D=Selector.handlers;D.mark(E);for(var C=0,B=[],A;A=F[C];C++){if(A._countedByPrototype){B.push(A)}}D.unmark(E);return B},findElement:function(B,C,A){if(Object.isNumber(C)){A=C;C=false}return Selector.matchElements(B,C||"*")[A||0]},findChildElements:function(E,G){G=Selector.split(G.join(","));var D=[],F=Selector.handlers;for(var C=0,B=G.length,A;C<B;C++){A=new Selector(G[C].strip());F.concat(D,A.findElements(E))}return(B>1)?F.unique(D):D}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(B,A){for(var C=0,D;D=A[C];C++){if(D.tagName!=="!"){B.push(D)}}return B},unmark:function(A){for(var B=0,C;C=A[B];B++){C.removeAttribute("_countedByPrototype")}return A}})}function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(A){$(A).reset();return A},serializeElements:function(G,B){if(typeof B!="object"){B={hash:!!B}}else{if(Object.isUndefined(B.hash)){B.hash=true}}var C,F,A=false,E=B.submit;var D=G.inject({},function(H,I){if(!I.disabled&&I.name){C=I.name;F=$(I).getValue();if(F!=null&&(I.type!="submit"||(!A&&E!==false&&(!E||C==E)&&(A=true)))){if(C in H){if(!Object.isArray(H[C])){H[C]=[H[C]]}H[C].push(F)}else{H[C]=F}}}return H});return B.hash?D:Object.toQueryString(D)}};Form.Methods={serialize:function(B,A){return Form.serializeElements(Form.getElements(B),A)},getElements:function(A){return $A($(A).getElementsByTagName("*")).inject([],function(B,C){if(Form.Element.Serializers[C.tagName.toLowerCase()]){B.push(Element.extend(C))}return B})},getInputs:function(G,C,D){G=$(G);var A=G.getElementsByTagName("input");if(!C&&!D){return $A(A).map(Element.extend)}for(var E=0,H=[],F=A.length;E<F;E++){var B=A[E];if((C&&B.type!=C)||(D&&B.name!=D)){continue}H.push(Element.extend(B))}return H},disable:function(A){A=$(A);Form.getElements(A).invoke("disable");return A},enable:function(A){A=$(A);Form.getElements(A).invoke("enable");return A},findFirstElement:function(B){var C=$(B).getElements().findAll(function(D){return"hidden"!=D.type&&!D.disabled});var A=C.findAll(function(D){return D.hasAttribute("tabIndex")&&D.tabIndex>=0}).sortBy(function(D){return D.tabIndex}).first();return A?A:C.find(function(D){return["input","select","textarea"].include(D.tagName.toLowerCase())})},focusFirstElement:function(A){A=$(A);A.findFirstElement().activate();return A},request:function(B,A){B=$(B),A=Object.clone(A||{});var D=A.parameters,C=B.readAttribute("action")||"";if(C.blank()){C=window.location.href}A.parameters=B.serialize(true);if(D){if(Object.isString(D)){D=D.toQueryParams()}Object.extend(A.parameters,D)}if(B.hasAttribute("method")&&!A.method){A.method=B.method}return new Ajax.Request(C,A)}};Form.Element={focus:function(A){$(A).focus();return A},select:function(A){$(A).select();return A}};Form.Element.Methods={serialize:function(A){A=$(A);if(!A.disabled&&A.name){var B=A.getValue();if(B!=undefined){var C={};C[A.name]=B;return Object.toQueryString(C)}}return""},getValue:function(A){A=$(A);var B=A.tagName.toLowerCase();return Form.Element.Serializers[B](A)},setValue:function(A,B){A=$(A);var C=A.tagName.toLowerCase();Form.Element.Serializers[C](A,B);return A},clear:function(A){$(A).value="";return A},present:function(A){return $(A).value!=""},activate:function(A){A=$(A);try{A.focus();if(A.select&&(A.tagName.toLowerCase()!="input"||!["button","reset","submit"].include(A.type))){A.select()}}catch(B){}return A},disable:function(A){A=$(A);A.blur();A.disabled=true;return A},enable:function(A){A=$(A);A.disabled=false;return A}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(A,B){switch(A.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(A,B);default:return Form.Element.Serializers.textarea(A,B)}},inputSelector:function(A,B){if(Object.isUndefined(B)){return A.checked?A.value:null}else{A.checked=!!B}},textarea:function(A,B){if(Object.isUndefined(B)){return A.value}else{A.value=B}},select:function(D,A){if(Object.isUndefined(A)){return this[D.type=="select-one"?"selectOne":"selectMany"](D)}else{var C,F,G=!Object.isArray(A);for(var B=0,E=D.length;B<E;B++){C=D.options[B];F=this.optionValue(C);if(G){if(F==A){C.selected=true;return }}else{C.selected=A.include(F)}}}},selectOne:function(B){var A=B.selectedIndex;return A>=0?this.optionValue(B.options[A]):null},selectMany:function(D){var A,E=D.length;if(!E){return null}for(var C=0,A=[];C<E;C++){var B=D.options[C];if(B.selected){A.push(this.optionValue(B))}}return A},optionValue:function(A){return Element.extend(A).hasAttribute("value")?A.value:A.text}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,A,B,C){$super(C,B);this.element=$(A);this.lastValue=this.getValue()},execute:function(){var A=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(A)?this.lastValue!=A:String(this.lastValue)!=String(A)){this.callback(this.element,A);this.lastValue=A}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element)}});Abstract.EventObserver=Class.create({initialize:function(A,B){this.element=$(A);this.callback=B;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()}else{this.registerCallback(this.element)}},onElementEvent:function(){var A=this.getValue();if(this.lastValue!=A){this.callback(this.element,A);this.lastValue=A}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)},registerCallback:function(A){if(A.type){switch(A.type.toLowerCase()){case"checkbox":case"radio":Event.observe(A,"click",this.onElementEvent.bind(this));break;default:Event.observe(A,"change",this.onElementEvent.bind(this));break}}}});Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)}});if(!window.Event){var Event={}}Object.extend(Event,{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:{},relatedTarget:function(B){var A;switch(B.type){case"mouseover":A=B.fromElement;break;case"mouseout":A=B.toElement;break;default:return null}return Element.extend(A)}});Event.Methods=(function(){var A;if(Prototype.Browser.IE){var B={0:1,1:4,2:2};A=function(D,C){return D.button==B[C]}}else{if(Prototype.Browser.WebKit){A=function(D,C){switch(C){case 0:return D.which==1&&!D.metaKey;case 1:return D.which==1&&D.metaKey;default:return false}}}else{A=function(D,C){return D.which?(D.which===C+1):(D.button===C)}}}return{isLeftClick:function(C){return A(C,0)},isMiddleClick:function(C){return A(C,1)},isRightClick:function(C){return A(C,2)},element:function(D){var C=Event.extend(D).target;return Element.extend(C.nodeType==Node.TEXT_NODE?C.parentNode:C)},findElement:function(D,F){var C=Event.element(D);if(!F){return C}var E=[C].concat(C.ancestors());return Selector.findElement(E,F,0)},pointer:function(C){return{x:C.pageX||(C.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)),y:C.pageY||(C.clientY+(document.documentElement.scrollTop||document.body.scrollTop))}},pointerX:function(C){return Event.pointer(C).x},pointerY:function(C){return Event.pointer(C).y},stop:function(C){Event.extend(C);C.preventDefault();C.stopPropagation();C.stopped=true}}})();Event.extend=(function(){var A=Object.keys(Event.Methods).inject({},function(B,C){B[C]=Event.Methods[C].methodize();return B});if(Prototype.Browser.IE){Object.extend(A,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});return function(B){if(!B){return false}if(B._extendedByPrototype){return B}B._extendedByPrototype=Prototype.emptyFunction;var C=Event.pointer(B);Object.extend(B,{target:B.srcElement,relatedTarget:Event.relatedTarget(B),pageX:C.x,pageY:C.y});return Object.extend(B,A)}}else{Event.prototype=Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(Event.prototype,A);return Prototype.K}})();Object.extend(Event,(function(){var B=Event.cache;function C(J){if(J._prototypeEventID){return J._prototypeEventID[0]}arguments.callee.id=arguments.callee.id||1;return J._prototypeEventID=[++arguments.callee.id]}function G(J){if(J&&J.include(":")){return"dataavailable"}return J}function A(J){return B[J]=B[J]||{}}function F(L,J){var K=A(L);return K[J]=K[J]||[]}function H(K,J,L){var O=C(K);var N=F(O,J);if(N.pluck("handler").include(L)){return false}var M=function(P){if(!Event||!Event.extend||(P.eventName&&P.eventName!=J)){return false}Event.extend(P);L.call(K,P)};M.handler=L;N.push(M);return M}function I(M,J,K){var L=F(M,J);return L.find(function(N){return N.handler==K})}function D(M,J,K){var L=A(M);if(!L[J]){return false}L[J]=L[J].without(I(M,J,K))}function E(){for(var K in B){for(var J in B[K]){B[K][J]=null}}}if(window.attachEvent){window.attachEvent("onunload",E)}return{observe:function(L,J,M){L=$(L);var K=G(J);var N=H(L,J,M);if(!N){return L}if(L.addEventListener){L.addEventListener(K,N,false)}else{L.attachEvent("on"+K,N)}return L},stopObserving:function(L,J,M){L=$(L);var O=C(L),K=G(J);if(!M&&J){F(O,J).each(function(P){L.stopObserving(J,P.handler)});return L}else{if(!J){Object.keys(A(O)).each(function(P){L.stopObserving(P)});return L}}var N=I(O,J,M);if(!N){return L}if(L.removeEventListener){L.removeEventListener(K,N,false)}else{L.detachEvent("on"+K,N)}D(O,J,M);return L},fire:function(L,K,J){L=$(L);if(L==document&&document.createEvent&&!L.dispatchEvent){L=document.documentElement}var M;if(document.createEvent){M=document.createEvent("HTMLEvents");M.initEvent("dataavailable",true,true)}else{M=document.createEventObject();M.eventType="ondataavailable"}M.eventName=K;M.memo=J||{};if(document.createEvent){L.dispatchEvent(M)}else{L.fireEvent(M.eventType,M)}return Event.extend(M)}}})());Object.extend(Event,Event.Methods);Element.addMethods({fire:Event.fire,observe:Event.observe,stopObserving:Event.stopObserving});Object.extend(document,{fire:Element.Methods.fire.methodize(),observe:Element.Methods.observe.methodize(),stopObserving:Element.Methods.stopObserving.methodize(),loaded:false});(function(){var B;function A(){if(document.loaded){return }if(B){window.clearInterval(B)}document.fire("dom:loaded");document.loaded=true}if(document.addEventListener){if(Prototype.Browser.WebKit){B=window.setInterval(function(){if(/loaded|complete/.test(document.readyState)){A()}},0);Event.observe(window,"load",A)}else{document.addEventListener("DOMContentLoaded",A,false)}}else{document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");$("__onDOMContentLoaded").onreadystatechange=function(){if(this.readyState=="complete"){this.onreadystatechange=null;A()}}}})();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(A,B){return Element.insert(A,{before:B})},Top:function(A,B){return Element.insert(A,{top:B})},Bottom:function(A,B){return Element.insert(A,{bottom:B})},After:function(A,B){return Element.insert(A,{after:B})}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},within:function(B,A,C){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(B,A,C)}this.xcomp=A;this.ycomp=C;this.offset=Element.cumulativeOffset(B);return(C>=this.offset[1]&&C<this.offset[1]+B.offsetHeight&&A>=this.offset[0]&&A<this.offset[0]+B.offsetWidth)},withinIncludingScrolloffsets:function(B,A,D){var C=Element.cumulativeScrollOffset(B);this.xcomp=A+C[0]-this.deltaX;this.ycomp=D+C[1]-this.deltaY;this.offset=Element.cumulativeOffset(B);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+B.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+B.offsetWidth)},overlap:function(B,A){if(!B){return 0}if(B=="vertical"){return((this.offset[1]+A.offsetHeight)-this.ycomp)/A.offsetHeight}if(B=="horizontal"){return((this.offset[0]+A.offsetWidth)-this.xcomp)/A.offsetWidth}},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(A){Position.prepare();return Element.absolutize(A)},relativize:function(A){Position.prepare();return Element.relativize(A)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(B,C,A){A=A||{};return Element.clonePosition(C,B,A)}};if(!document.getElementsByClassName){document.getElementsByClassName=function(B){function A(C){return C.blank()?null:"[contains(concat(' ', @class, ' '), ' "+C+" ')]"}B.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(C,E){E=E.toString().strip();var D=/\s/.test(E)?$w(E).map(A).join(""):A(E);return D?document._getElementsByXPath(".//*"+D,C):[]}:function(E,F){F=F.toString().strip();var G=[],H=(/\s/.test(F)?$w(F):null);if(!H&&!F){return G}var C=$(E).getElementsByTagName("*");F=" "+F+" ";for(var D=0,J,I;J=C[D];D++){if(J.className&&(I=" "+J.className+" ")&&(I.include(F)||(H&&H.all(function(K){return !K.toString().blank()&&I.include(" "+K+" ")})))){G.push(Element.extend(J))}}return G};return function(D,C){return $(C||document.body).getElementsByClassName(D)}}(Element.Methods)}Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(A){this.element=$(A)},_each:function(A){this.element.className.split(/\s+/).select(function(B){return B.length>0})._each(A)},set:function(A){this.element.className=A},add:function(A){if(this.include(A)){return }this.set($A(this).concat(A).join(" "))},remove:function(A){if(!this.include(A)){return }this.set($A(this).without(A).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);Element.addMethods();if(!Proto){var Proto={}}Proto.Chart=Class.create({initialize:function(B,C,A){A=A||{};this.graphData=[];this.options=this.merge(A,{colors:["#edc240","#00A8F0","#C0D800","#cb4b4b","#4da74d","#9440ed"],legend:{show:false,noColumns:1,labelFormatter:null,labelBoxBorderColor:"#ccc",container:null,position:"ne",margin:5,backgroundColor:null,backgroundOpacity:0.85},xaxis:{mode:null,min:null,max:null,autoscaleMargin:null,ticks:null,tickFormatter:null,tickDecimals:null,tickSize:null,minTickSize:null,monthNames:null,timeformat:null},yaxis:{mode:null,min:null,max:null,ticks:null,tickFormatter:null,tickDecimals:null,tickSize:null,minTickSize:null,monthNames:null,timeformat:null,autoscaleMargin:0.02},points:{show:false,radius:3,lineWidth:2,fill:true,fillColor:"#ffffff"},lines:{show:false,lineWidth:2,fill:false,fillColor:null},bars:{show:false,lineWidth:2,barWidth:1,fill:true,fillColor:null,showShadow:false,fillOpacity:0.4,autoScale:true},pies:{show:false,radius:50,borderWidth:1,fill:true,fillColor:null,fillOpacity:0.9,labelWidth:30,fontSize:11,autoScale:true},grid:{color:"#545454",backgroundColor:null,tickColor:"#dddddd",labelMargin:3,borderWidth:1,clickable:null,coloredAreas:null,coloredAreasColor:"#f4f4f4",drawXAxis:true,drawYAxis:true},mouse:{track:false,position:"se",fixedPosition:true,clsName:"mouseValHolder",trackFormatter:this.defaultTrackFormatter,margin:3,color:"#ff3f19",trackDecimals:1,sensibility:2,radius:5,lineColor:"#cb4b4b"},selection:{mode:null,color:"#97CBFF"},allowDataClick:true,makeRandomColor:false,shadowSize:4});this.canvas=null;this.overlay=null;this.eventHolder=null;this.context=null;this.overlayContext=null;this.domObj=$(B);this.xaxis={};this.yaxis={};this.chartOffset={left:0,right:0,top:0,bottom:0};this.yLabelMaxWidth=0;this.yLabelMaxHeight=0;this.xLabelBoxWidth=0;this.canvasWidth=0;this.canvasHeight=0;this.chartWidth=0;this.chartHeight=0;this.hozScale=0;this.vertScale=0;this.workarounds={};this.domObj=$(B);this.barDataRange=[];this.lastMousePos={pageX:null,pageY:null};this.selection={first:{x:-1,y:-1},second:{x:-1,y:-1}};this.prevSelection=null;this.selectionInterval=null;this.ignoreClick=false;this.prevHit=null;if(this.options.makeRandomColor){this.options.color=this.makeRandomColor(this.options.colors)}this.setData(C);this.constructCanvas();this.setupGrid();this.draw()},merge:function(D,B){var A=B||{};for(var C in D){A[C]=(typeof (D[C])=="object"&&!(D[C].constructor==Array||D[C].constructor==RegExp))?this.merge(D[C],B[C]):A[C]=D[C]}return A},setData:function(A){this.graphData=this.parseData(A);this.setBarWidth();this.copyGraphDataOptions();this.processGraphData()},parseData:function(B){var A=[];B.each(function(E){var D;var F;if(E.data){D={};for(var C in E){D[C]=E[C]}F=E.color}else{D={data:E}}A.push(D)}.bind(this));return A},makeRandomColor:function(D){var B=Math.floor(Math.random()*D.length);var A=[];var C=[];A.push(B);while(A.length<D.length){var E=Math.floor(Math.random()*D.length);while(checkExisted(E,A)){E=Math.floor(Math.random()*D.length)}A.push(E)}A.each(function(F){C.push(D[F])}.bind(this));return C},checkExisted:function(C,B){var A=false;B.each(function(D){if(D==C){A=true;throw $break}}.bind(this));return A},setBarWidth:function(){if(this.options.bars.show&&this.options.bars.autoScale){this.options.bars.barWidth=1/this.graphData.length/1.2}},copyGraphDataOptions:function(){var F,J=this.graphData.length,A=[],D=[];this.graphData.each(function(L){var M=L.color;if(M){--J;if(Object.isNumber(M)){D.push(M)}else{A.push(this.parseColor(M))}}}.bind(this));D.each(function(L){J=Math.max(J,L+1)});var B=[];var E=0;F=0;while(B.length<J){var H;if(this.options.colors.length==F){H=new Proto.Color(100,100,100)}else{H=this.parseColor(this.options.colors[F])}var C=E%2==1?-1:1;var G=1+C*Math.ceil(E/2)*0.2;H.scale(G,G,G);B.push(H);++F;if(F>=this.options.colors.length){F=0;++E}}var I=0,K;this.graphData.each(function(L){if(L.color==null){L.color=B[I].toString();++I}else{if(Object.isNumber(L.color)){L.color=B[L.color].toString()}}L.lines=Object.extend(Object.clone(this.options.lines),L.lines);L.points=Object.extend(Object.clone(this.options.points),L.points);L.bars=Object.extend(Object.clone(this.options.bars),L.bars);L.mouse=Object.extend(Object.clone(this.options.mouse),L.mouse);if(L.shadowSize==null){L.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(D){if(D==null){return }var C=D[0],E=D[1];if(isNaN(C=+C)||isNaN(E=+E)){D=null;return }if(C<this.xaxis.datamin){this.xaxis.datamin=C}if(C>this.xaxis.datamax){this.xaxis.datamax=C}if(E<this.yaxis.datamin){this.yaxis.datamin=E}if(E>this.yaxis.datamax){this.yaxis.datamax=E}}.bind(this))}.bind(this));if(this.xaxis.datamin==Number.MAX_VALUE){this.xaxis.datamin=0}if(this.yaxis.datamin==Number.MAX_VALUE){this.yaxis.datamin=0}if(this.xaxis.datamax==Number.MIN_VALUE){this.xaxis.datamax=1}if(this.yaxis.datamax==Number.MIN_VALUE){this.yaxis.datamax=1}},constructCanvas:function(){this.canvasWidth=this.domObj.getWidth();this.canvasHeight=this.domObj.getHeight();this.domObj.update("");this.domObj.setStyle({position:"relative"});if(this.canvasWidth<=0){this.canvasWdith=400}if(this.canvasHeight<=0){this.canvasHeight=300}this.canvas=(Prototype.Browser.IE)?document.createElement("canvas"):new Element("CANVAS",{width:this.canvasWidth,height:this.canvasHeight});Element.extend(this.canvas);this.canvas.style.width=this.canvasWidth+"px";this.canvas.style.height=this.canvasHeight+"px";this.domObj.appendChild(this.canvas);if(Prototype.Browser.IE){this.canvas=$(window.G_vmlCanvasManager.initElement(this.canvas))}this.canvas=$(this.canvas);this.context=this.canvas.getContext("2d");this.overlay=(Prototype.Browser.IE)?document.createElement("canvas"):new Element("CANVAS",{width:this.canvasWidth,height:this.canvasHeight});Element.extend(this.overlay);this.overlay.style.width=this.canvasWidth+"px";this.overlay.style.height=this.canvasHeight+"px";this.overlay.style.position="absolute";this.overlay.style.left="0px";this.overlay.style.right="0px";this.overlay.setStyle({position:"absolute",left:"0px",right:"0px"});this.domObj.appendChild(this.overlay);if(Prototype.Browser.IE){this.overlay=$(window.G_vmlCanvasManager.initElement(this.overlay))}this.overlay=$(this.overlay);this.overlayContext=this.overlay.getContext("2d");if(this.options.selection.mode){this.overlay.observe("mousedown",this.onMouseDown.bind(this));this.overlay.observe("mousemove",this.onMouseMove.bind(this))}if(this.options.grid.clickable){this.overlay.observe("click",this.onClick.bind(this))}if(this.options.mouse.track){this.overlay.observe("mousemove",this.onMouseMove.bind(this));this.overlay.observe("mouseout",this.onMouseOut.bind(this))}},setupGrid:function(){if(this.options.bars.show){this.xaxis.max+=0.5;this.xaxis.min-=0.5}this.extendXRangeIfNeededByBar();this.setRange(this.xaxis,this.options.xaxis);this.prepareTickGeneration(this.xaxis,this.options.xaxis);this.setTicks(this.xaxis,this.options.xaxis);this.setRange(this.yaxis,this.options.yaxis);this.prepareTickGeneration(this.yaxis,this.options.yaxis);this.setTicks(this.yaxis,this.options.yaxis);this.setSpacing();if(!this.options.pies.show){this.insertLabels()}this.insertLegend()},setRange:function(D,F){var C=F.min!=null?F.min:D.datamin;var A=F.max!=null?F.max:D.datamax;if(A-C==0){var B;if(A==0){B=1}else{B=0.01}C-=B;A+=B}else{var E=F.autoscaleMargin;if(E!=null){if(F.min==null){C-=(A-C)*E;if(C<0&&D.datamin>=0){C=0}}if(F.max==null){A+=(A-C)*E;if(A>0&&D.datamax<=0){A=0}}}}D.min=C;D.max=A},prepareTickGeneration:function(C,I){var D;if(Object.isNumber(I.ticks)&&I.ticks>0){D=I.ticks}else{if(C==this.xaxis){D=this.canvasWidth/100}else{D=this.canvasHeight/60}}var Q=(C.max-C.min)/D;var M,A,K,O,P,N,E;if(I.mode=="time"){function J(Y,S,U){var T=function(a){a=""+a;return a.length==1?"0"+a:a};var X=[];var W=false;if(U==null){U=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}for(var V=0;V<S.length;++V){var Z=S.charAt(V);if(W){switch(Z){case"h":Z=""+Y.getHours();break;case"H":Z=T(Y.getHours());break;case"M":Z=T(Y.getMinutes());break;case"S":Z=T(Y.getSeconds());break;case"d":Z=""+Y.getDate();break;case"m":Z=""+(Y.getMonth()+1);break;case"y":Z=""+Y.getFullYear();break;case"b":Z=""+U[Y.getMonth()];break}X.push(Z);W=false}else{if(Z=="%"){W=true}else{X.push(Z)}}}return X.join("")}var F={second:1000,minute:60*1000,hour:60*60*1000,day:24*60*60*1000,month:30*24*60*60*1000,year:365.2425*24*60*60*1000};var G=[[1,"second"],[2,"second"],[5,"second"],[10,"second"],[30,"second"],[1,"minute"],[2,"minute"],[5,"minute"],[10,"minute"],[30,"minute"],[1,"hour"],[2,"hour"],[4,"hour"],[8,"hour"],[12,"hour"],[1,"day"],[2,"day"],[3,"day"],[0.25,"month"],[0.5,"month"],[1,"month"],[2,"month"],[3,"month"],[6,"month"],[1,"year"]];var B=0;if(I.minTickSize!=null){if(typeof I.tickSize=="number"){B=I.tickSize}else{B=I.minTickSize[0]*F[I.minTickSize[1]]}}for(P=0;P<G.length-1;++P){if(Q<(G[P][0]*F[G[P][1]]+G[P+1][0]*F[G[P+1][1]])/2&&G[P][0]*F[G[P][1]]>=B){break}}M=G[P][0];K=G[P][1];if(K=="year"){N=Math.pow(10,Math.floor(Math.log(Q/F.year)/Math.LN10));E=(Q/F.year)/N;if(E<1.5){M=1}else{if(E<3){M=2}else{if(E<7.5){M=5}else{M=10}}}M*=N}if(I.tickSize){M=I.tickSize[0];K=I.tickSize[1]}var H=this.floorInBase;A=function(U){var Y=[],W=U.tickSize[0],Z=U.tickSize[1],X=new Date(U.min);var T=W*F[Z];if(Z=="second"){X.setSeconds(H(X.getSeconds(),W))}if(Z=="minute"){X.setMinutes(H(X.getMinutes(),W))}if(Z=="hour"){X.setHours(H(X.getHours(),W))}if(Z=="month"){X.setMonth(H(X.getMonth(),W))}if(Z=="year"){X.setFullYear(H(X.getFullYear(),W))}X.setMilliseconds(0);if(T>=F.minute){X.setSeconds(0)}if(T>=F.hour){X.setMinutes(0)}if(T>=F.day){X.setHours(0)}if(T>=F.day*28){X.setDate(1)}if(T>=F.year){X.setMonth(0)}var b=0,a;do{a=X.getTime();Y.push({v:a,label:U.tickFormatter(a,U)});if(Z=="month"){if(W<1){X.setDate(1);var S=X.getTime();X.setMonth(X.getMonth()+1);var V=X.getTime();X.setTime(a+b*F.hour+(V-S)*W);b=X.getHours();X.setHours(0)}else{X.setMonth(X.getMonth()+W)}}else{if(Z=="year"){X.setFullYear(X.getFullYear()+W)}else{X.setTime(a+T)}}}while(a<U.max);return Y};O=function(S,V){var W=new Date(S);if(I.timeformat!=null){return J(W,I.timeformat,I.monthNames)}var T=V.tickSize[0]*F[V.tickSize[1]];var U=V.max-V.min;if(T<F.minute){fmt="%h:%M:%S"}else{if(T<F.day){if(U<2*F.day){fmt="%h:%M"}else{fmt="%b %d %h:%M"}}else{if(T<F.month){fmt="%b %d"}else{if(T<F.year){if(U<F.year){fmt="%b"}else{fmt="%b %y"}}else{fmt="%y"}}}}return J(W,fmt,I.monthNames)}}else{var R=I.tickDecimals;var L=-Math.floor(Math.log(Q)/Math.LN10);if(R!=null&&L>R){L=R}N=Math.pow(10,-L);E=Q/N;if(E<1.5){M=1}else{if(E<3){M=2;if(E>2.25&&(R==null||L+1<=R)){M=2.5;++L}}else{if(E<7.5){M=5}else{M=10}}}M*=N;if(I.minTickSize!=null&&M<I.minTickSize){M=I.minTickSize}if(I.tickSize!=null){M=I.tickSize}C.tickDecimals=Math.max(0,(R!=null)?R:L);var H=this.floorInBase;A=function(U){var V=[];var W=H(U.min,U.tickSize);var T=0,S;do{S=W+T*U.tickSize;V.push({v:S,label:U.tickFormatter(S,U)});++T}while(S<U.max);return V};O=function(S,T){if(S){return S.toFixed(T.tickDecimals)}return 0}}C.tickSize=K?[M,K]:M;C.tickGenerator=A;if(Object.isFunction(I.tickFormatter)){C.tickFormatter=function(S,T){return""+I.tickFormatter(S,T)}}else{C.tickFormatter=O}},extendXRangeIfNeededByBar:function(){if(this.options.xaxis.max==null){var A=this.xaxis.max;this.graphData.each(function(B){if(B.bars.show&&B.bars.barWidth+this.xaxis.datamax>A){A=this.xaxis.datamax+B.bars.barWidth}}.bind(this));this.xaxis.nax=A}},setTicks:function(A,C){A.ticks=[];if(C.ticks==null){A.ticks=A.tickGenerator(A)}else{if(typeof C.ticks=="number"){if(C.ticks>0){A.ticks=A.tickGenerator(A)}}else{if(C.ticks){var B=C.ticks;if(Object.isFunction(B)){B=B({min:A.min,max:A.max})}B.each(function(G,F){var D=null;var E=null;if(typeof G=="object"){D=G[0];if(G.length>1){E=G[1]}}else{D=G}if(!E){E=A.tickFormatter(D,A)}A.ticks[F]={v:D,label:E}}.bind(this))}}}if(C.autoscaleMargin!=null&&A.ticks.length>0){if(C.min==null){A.min=Math.min(A.min,A.ticks[0].v)}if(C.max==null&&A.ticks.length>1){A.max=Math.min(A.max,A.ticks[A.ticks.length-1].v)}}},setSpacing:function(){var C,F=[],B;for(C=0;C<this.yaxis.ticks.length;++C){B=this.yaxis.ticks[C].label;if(B){F.push('<div class="tickLabel">'+B+"</div>")}}if(F.length>0){var A=new Element("div",{style:"position:absolute;top:-10000px;font-size:smaller"});A.update(F.join(""));this.domObj.insert(A);this.yLabelMaxWidth=A.getWidth();this.yLabelMaxHeight=A.select("div")[0].getHeight();A.remove()}var E=this.options.grid.borderWidth;if(this.options.points.show){E=Math.max(E,this.options.points.radius+this.options.points.lineWidth/2)}for(C=0;C<this.graphData.length;++C){if(this.graphData[C].points.show){E=Math.max(E,this.graphData[C].points.radius+this.graphData[C].points.lineWidth/2)}}this.chartOffset.left=this.chartOffset.right=this.chartOffset.top=this.chartOffset.bottom=E;this.chartOffset.left+=this.yLabelMaxWidth+this.options.grid.labelMargin;this.chartWidth=this.canvasWidth-this.chartOffset.left-this.chartOffset.right;this.xLabelBoxWidth=this.chartWidth/6;F=[];for(C=0;C<this.xaxis.ticks.length;++C){B=this.xaxis.ticks[C].label;if(B){F.push('<span class="tickLabel" width="'+this.xLabelBoxWidth+'">'+B+"</span>")}}var D=0;if(F.length>0){var A=new Element("div",{style:"position:absolute;top:-10000px;font-size:smaller"});A.update(F.join(""));this.domObj.appendChild(A);D=A.getHeight();A.remove()}this.chartOffset.bottom+=D+this.options.grid.labelMargin;this.chartHeight=this.canvasHeight-this.chartOffset.bottom-this.chartOffset.top;this.hozScale=this.chartWidth/(this.xaxis.max-this.xaxis.min);this.vertScale=this.chartHeight/(this.yaxis.max-this.yaxis.min)},draw:function(){if(this.options.bars.show){this.extendXRangeIfNeededByBar();this.setSpacing();this.drawGrid();this.drawBarGraph(this.graphData,this.barDataRange)}else{if(this.options.pies.show){this.preparePieData(this.graphData);this.drawPieGraph(this.graphData)}else{this.drawGrid();for(var A=0;A<this.graphData.length;A++){this.drawGraph(this.graphData[A])}}}},translateHoz:function(A){return(A-this.xaxis.min)*this.hozScale},translateVert:function(A){return this.chartHeight-(A-this.yaxis.min)*this.vertScale},drawGrid:function(){var C;this.context.save();this.context.clearRect(0,0,this.canvasWidth,this.canvasHeight);this.context.translate(this.chartOffset.left,this.chartOffset.top);if(this.options.grid.backgroundColor!=null){this.context.fillStyle=this.options.grid.backgroundColor;this.context.fillRect(0,0,this.chartWidth,this.chartHeight)}if(this.options.grid.coloredAreas){var B=this.options.grid.coloredAreas;if(Object.isFunction(B)){B=B({xmin:this.xaxis.min,xmax:this.xaxis.max,ymin:this.yaxis.min,ymax:this.yaxis.max})}B.each(function(D){if(D.x1==null||D.x1<this.xaxis.min){D.x1=this.xaxis.min}if(D.x2==null||D.x2>this.xaxis.max){D.x2=this.xaxis.max}if(D.y1==null||D.y1<this.yaxis.min){D.y1=this.yaxis.min}if(D.y2==null||D.y2>this.yaxis.max){D.y2=this.yaxis.max}var E;if(D.x1>D.x2){E=D.x1;D.x1=D.x2;D.x2=E}if(D.y1>D.y2){E=D.y1;D.y1=D.y2;D.y2=E}if(D.x1>=this.xaxis.max||D.x2<=this.xaxis.min||D.x1==D.x2||D.y1>=this.yaxis.max||D.y2<=this.yaxis.min||D.y1==D.y2){return }this.context.fillStyle=D.color||this.options.grid.coloredAreasColor;this.context.fillRect(Math.floor(this.translateHoz(D.x1)),Math.floor(this.translateVert(D.y2)),Math.floor(this.translateHoz(D.x2)-this.translateHoz(D.x1)),Math.floor(this.translateVert(D.y1)-this.translateVert(D.y2)))}.bind(this))}this.context.lineWidth=1;this.context.strokeStyle=this.options.grid.tickColor;this.context.beginPath();var A;if(this.options.grid.drawXAxis){this.xaxis.ticks.each(function(D){A=D.v;if(A<=this.xaxis.min||A>=this.xaxis.max){return }this.context.moveTo(Math.floor(this.translateHoz(A))+this.context.lineWidth/2,0);this.context.lineTo(Math.floor(this.translateHoz(A))+this.context.lineWidth/2,this.chartHeight)}.bind(this))}if(this.options.grid.drawYAxis){this.yaxis.ticks.each(function(D){A=D.v;if(A<=this.yaxis.min||A>=this.yaxis.max){return }this.context.moveTo(0,Math.floor(this.translateVert(A))+this.context.lineWidth/2);this.context.lineTo(this.chartWidth,Math.floor(this.translateVert(A))+this.context.lineWidth/2)}.bind(this))}this.context.stroke();if(this.options.grid.borderWidth){this.context.lineWidth=this.options.grid.borderWidth;this.context.strokeStyle=this.options.grid.color;this.context.lineJoin="round";this.context.strokeRect(0,0,this.chartWidth,this.chartHeight);this.context.restore()}},insertLabels:function(){this.domObj.select(".tickLabels").invoke("remove");var C,B;var A='<div class="tickLabels" style="font-size:smaller;color:'+this.options.grid.color+'">';this.xaxis.ticks.each(function(D){if(!D.label){return }A+='<div style="position:absolute;top:'+(this.chartOffset.top+this.chartHeight+this.options.grid.labelMargin)+"px;left:"+(this.chartOffset.left+this.translateHoz(D.v)-this.xLabelBoxWidth/2)+"px;width:"+this.xLabelBoxWidth+'px;text-align:center" class="tickLabel">'+D.label+"</div>"}.bind(this));this.yaxis.ticks.each(function(D){if(!D.label||D.v<this.yaxis.min||D.v>this.yaxis.max){return }A+='<div id="ylabels" style="position:absolute;top:'+(this.chartOffset.top+this.translateVert(D.v)-this.yLabelMaxHeight/2)+"px;left:0;width:"+this.yLabelMaxWidth+'px;text-align:right" class="tickLabel">'+D.label+"</div>"}.bind(this));A+="</div>";this.domObj.insert(A)},drawGraph:function(A){if(A.lines.show||(!A.bars.show&&!A.points.show)){this.drawGraphLines(A)}if(A.bars.show){this.drawGraphBar(A)}if(A.points.show){this.drawGraphPoints(A)}},plotLine:function(F,E,H){var D,K=null,A=null,L=null;this.context.beginPath();for(var G=0;G<F.length;++G){D=K;K=F[G];if(D==null||K==null){continue}var C=D[0],J=D[1],B=K[0],I=K[1];if(J<=I&&J<this.yaxis.min){if(I<this.yaxis.min){continue}C=(this.yaxis.min-J)/(I-J)*(B-C)+C;J=this.yaxis.min}else{if(I<=J&&I<this.yaxis.min){if(J<this.yaxis.min){continue}B=(this.yaxis.min-J)/(I-J)*(B-C)+C;I=this.yaxis.min}}if(J>=I&&J>this.yaxis.max){if(I>this.yaxis.max){continue}C=(this.yaxis.max-J)/(I-J)*(B-C)+C;J=this.yaxis.max}else{if(I>=J&&I>this.yaxis.max){if(J>this.yaxis.max){continue}B=(this.yaxis.max-J)/(I-J)*(B-C)+C;I=this.yaxis.max}}if(C<=B&&C<this.xaxis.min){if(B<this.xaxis.min){continue}J=(this.xaxis.min-C)/(B-C)*(I-J)+J;C=this.xaxis.min}else{if(B<=C&&B<this.xaxis.min){if(C<this.xaxis.min){continue}I=(this.xaxis.min-C)/(B-C)*(I-J)+J;B=this.xaxis.min}}if(C>=B&&C>this.xaxis.max){if(B>this.xaxis.max){continue}J=(this.xaxis.max-C)/(B-C)*(I-J)+J;C=this.xaxis.max}else{if(B>=C&&B>this.xaxis.max){if(C>this.xaxis.max){continue}I=(this.xaxis.max-C)/(B-C)*(I-J)+J;B=this.xaxis.max}}if(A!=this.translateHoz(C)||L!=this.translateVert(J)+E){this.context.moveTo(this.translateHoz(C),this.translateVert(J)+E)}A=this.translateHoz(B);L=this.translateVert(I)+E;if(H){this.plotLineDashed(this.translateHoz(C),this.translateVert(J)+E,A,L,H)}else{this.context.lineTo(A,L)}}this.context.stroke()},plotLineDashed:function(C,I,A,H,J){var N=C;var L=I;var D=Math.sqrt((A-N)*(A-N)+(H-L)*(H-L));var M=(A-N)/D;var K=(H-L)/D;var G=0;var F=0;var E=0;while(G<D){var B=Math.min(J[F],D-G);G+=B;if(F%2==0){this.context.moveTo(N,L)}N+=B*M;L+=B*K;if(F%2==0){this.context.lineTo(N,L)}E+=B;if(E>J[F]){E-=J[F];F=(F+1)%J.length}}},plotLineArea:function(F){var E,M=null;var A=Math.min(Math.max(0,this.yaxis.min),this.yaxis.max);var J,D=0;var L=false;for(var G=0;G<F.length;++G){E=M;M=F[G];if(L&&E!=null&&M==null){this.context.lineTo(this.translateHoz(D),this.translateVert(A));this.context.fill();L=false;continue}if(E==null||M==null){continue}var C=E[0],K=E[1],B=M[0],I=M[1];if(C<=B&&C<this.xaxis.min){if(B<this.xaxis.min){continue}K=(this.xaxis.min-C)/(B-C)*(I-K)+K;C=this.xaxis.min}else{if(B<=C&&B<this.xaxis.min){if(C<this.xaxis.min){continue}I=(this.xaxis.min-C)/(B-C)*(I-K)+K;B=this.xaxis.min}}if(C>=B&&C>this.xaxis.max){if(B>this.xaxis.max){continue}K=(this.xaxis.max-C)/(B-C)*(I-K)+K;C=this.xaxis.max}else{if(B>=C&&B>this.xaxis.max){if(C>this.xaxis.max){continue}I=(this.xaxis.max-C)/(B-C)*(I-K)+K;B=this.xaxis.max}}if(!L){this.context.beginPath();this.context.moveTo(this.translateHoz(C),this.translateVert(A));L=true}if(K>=this.yaxis.max&&I>=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(K<=this.yaxis.min&&I<=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 N=C,H=B;if(K<=I&&K<this.yaxis.min&&I>=this.yaxis.min){C=(this.yaxis.min-K)/(I-K)*(B-C)+C;K=this.yaxis.min}else{if(I<=K&&I<this.yaxis.min&&K>=this.yaxis.min){B=(this.yaxis.min-K)/(I-K)*(B-C)+C;I=this.yaxis.min}}if(K>=I&&K>this.yaxis.max&&I<=this.yaxis.max){C=(this.yaxis.max-K)/(I-K)*(B-C)+C;K=this.yaxis.max}else{if(I>=K&&I>this.yaxis.max&&K<=this.yaxis.max){B=(this.yaxis.max-K)/(I-K)*(B-C)+C;I=this.yaxis.max}}if(C!=N){if(K<=this.yaxis.min){J=this.yaxis.min}else{J=this.yaxis.max}this.context.lineTo(this.translateHoz(N),this.translateVert(J));this.context.lineTo(this.translateHoz(C),this.translateVert(J))}this.context.lineTo(this.translateHoz(C),this.translateVert(K));this.context.lineTo(this.translateHoz(B),this.translateVert(I));if(B!=H){if(I<=this.yaxis.min){J=this.yaxis.min}else{J=this.yaxis.max}this.context.lineTo(this.translateHoz(H),this.translateVert(J));this.context.lineTo(this.translateHoz(B),this.translateVert(J))}D=Math.max(B,H)}if(L){this.context.lineTo(this.translateHoz(D),this.translateVert(A));this.context.fill()}},drawGraphLines:function(C){this.context.save();this.context.translate(this.chartOffset.left,this.chartOffset.top);this.context.lineJoin="round";var B=C.lines.lineWidth;var A=C.shadowSize;if(A>0){this.context.lineWidth=A/2;this.context.strokeStyle="rgba(0,0,0,0.1)";this.plotLine(C.data,B/2+A/2+this.context.lineWidth/2,C.dashArray);this.context.lineWidth=A/2;this.context.strokeStyle="rgba(0,0,0,0.2)";this.plotLine(C.data,B/2+this.context.lineWidth/2,C.dashArray)}this.context.lineWidth=B;this.context.strokeStyle=C.color;if(C.lines.fill){this.context.fillStyle=C.lines.fillColor!=null?C.lines.fillColor:this.parseColor(C.color).scale(null,null,null,0.4).toString();this.plotLineArea(C.data,0)}this.plotLine(C.data,0,C.dashArray);this.context.restore()},plotPoints:function(D,B,E){for(var C=0;C<D.length;++C){if(D[C]==null){continue}var A=D[C][0],F=D[C][1];if(A<this.xaxis.min||A>this.xaxis.max||F<this.yaxis.min||F>this.yaxis.max){continue}this.context.beginPath();this.context.arc(this.translateHoz(A),this.translateVert(F),B,0,2*Math.PI,true);if(E){this.context.fill()}this.context.stroke()}},plotPointShadows:function(D,E,B){for(var C=0;C<D.length;++C){if(D[C]==null){continue}var A=D[C][0],F=D[C][1];if(A<this.xaxis.min||A>this.xaxis.max||F<this.yaxis.min||F>this.yaxis.max){continue}this.context.beginPath();this.context.arc(this.translateHoz(A),this.translateVert(F)+E,B,0,Math.PI,false);this.context.stroke()}},drawGraphPoints:function(C){this.context.save();this.context.translate(this.chartOffset.left,this.chartOffset.top);var B=C.lines.lineWidth;var A=C.shadowSize;if(A>0){this.context.lineWidth=A/2;this.context.strokeStyle="rgba(0,0,0,0.1)";this.plotPointShadows(C.data,A/2+this.context.lineWidth/2,C.points.radius);this.context.lineWidth=A/2;this.context.strokeStyle="rgba(0,0,0,0.2)";this.plotPointShadows(C.data,this.context.lineWidth/2,C.points.radius)}this.context.lineWidth=C.points.lineWidth;this.context.strokeStyle=C.color;this.context.fillStyle=C.points.fillColor!=null?C.points.fillColor:C.color;this.plotPoints(C.data,C.points.radius,C.points.fill);this.context.restore()},preparePieData:function(B){for(i=0;i<B.length;i++){var A=0;for(j=0;j<B[i].data.length;j++){A+=parseInt(B[i].data[j][1])}B[i].data=A}},drawPieShadow:function(B,C,A){this.context.beginPath();this.context.moveTo(B,C);this.context.fillStyle="rgba(0,0,0,"+0.1+")";startAngle=0;endAngle=(Math.PI/180)*360;this.context.arc(B+2,C+2,A+(this.options.shadowSize/2),startAngle,endAngle,false);this.context.fill();this.context.closePath()},drawPieGraph:function(I){var H=0;var E=0;var D=this.chartWidth/2;var C=this.chartHeight/2;var F=0;var A=0;var J=this.options.pies.fontSize;var G=this.options.pies.labelWidth;if(!this.options.pies.autoScale){E=this.options.pies.radius}else{E=(this.chartHeight*0.85)/2}var B=E*1.05;for(i=0;i<I.length;i++){H+=I[i].data}totalPct=0;this.drawPieShadow(D,C,E,0,0);I.each(function(W,P){var X=W.data/H;F=A;A+=X*(2*Math.PI);var V=(A-F)/2+F;var T=D+Math.cos(V)*B;var S=C+Math.sin(V)*B;var O=D;var L=C;var K=null;var N=null;var M=0;var U=0;this.context.beginPath();this.context.moveTo(O,L);this.context.arc(O,L,E,F,A,false);this.context.closePath();this.context.fillStyle=this.parseColor(W.color).scale(null,null,null,this.options.pies.fillOpacity).toString();if(this.options.pies.fill){this.context.fill()}if(V<=0.25*(2*Math.PI)){K="left";N="top";M=T;U=S+J}else{if(V>0.25*(2*Math.PI)&&V<=0.5*(2*Math.PI)){K="left";N="bottom";M=T-G;U=S}else{if(V>0.5*(2*Math.PI)&&V<=0.75*(2*Math.PI)){K="right";N="bottom";M=T-G;U=S-J}else{K="right";N="bottom";M=T;U=S-J}}}M=M+"px";U=U+"px";var R=Math.round(X*100);if(P==I.length-1){if(R+totalPct<100){R=R+1}else{if(R+totalPct>100){R=R-1}}}var Q='<div style="position: absolute;zindex:11; width:'+G+"px;fontSize:"+J+"px;overflow:hidden;top:"+U+";left:"+M+";textAlign:"+K+";verticalAlign:"+N+'">'+R+"%</div>";this.domObj.insert(Q);totalPct=totalPct+R}.bind(this))},drawBarGraph:function(A,B){A.each(function(D,C){this.drawGraphBars(D,C,A.size(),B)}.bind(this))},drawGraphBar:function(A){this.drawGraphBars(A,0,this.graphData.length,this.barDataRange)},plotBars:function(I,G,K,F,J,A,H,E){var D=0;if(H%2==0){D=(1+((A-H/2)-1))*K}else{var C=0.5;if(A==(H/2-C)){D=-K*C}else{D=(C+(A-Math.round(H/2)))*K}}var B=[];G.each(function(P){if(!P){return }var T=P[0],S=P[1];var U=true,O=true,Q=true;var N=T+D,V=T+K+D,L=0,R=S;var M={};M.left=N;M.right=V;M.value=R;B.push(M);if(V<this.xaxis.min||N>this.xaxis.max||R<this.yaxis.min||L>this.yaxis.max){return }if(N<this.xaxis.min){N=this.xaxis.min;U=false}if(V>this.xaxis.max){V=this.xaxis.max;Q=false}if(L<this.yaxis.min){L=this.yaxis.min}if(R>this.yaxis.max){R=this.yaxis.max;O=false}if(I.bars.showShadow&&I.shadowSize>0){this.plotShadowOutline(I,this.context.strokeStyle,N,L,R,V,U,Q,O)}if(J){this.context.beginPath();this.context.moveTo(this.translateHoz(N),this.translateVert(L)+F);this.context.lineTo(this.translateHoz(N),this.translateVert(R)+F);this.context.lineTo(this.translateHoz(V),this.translateVert(R)+F);this.context.lineTo(this.translateHoz(V),this.translateVert(L)+F);this.context.fill()}if(U||Q||O){this.context.beginPath();this.context.moveTo(this.translateHoz(N),this.translateVert(L)+F);if(U){this.context.lineTo(this.translateHoz(N),this.translateVert(R)+F)}else{this.context.moveTo(this.translateHoz(N),this.translateVert(R)+F)}if(O){this.context.lineTo(this.translateHoz(V),this.translateVert(R)+F)}else{this.context.moveTo(this.translateHoz(V),this.translateVert(R)+F)}if(Q){this.context.lineTo(this.translateHoz(V),this.translateVert(L)+F)}else{this.context.moveTo(this.translateHoz(V),this.translateVert(L)+F)}this.context.stroke()}}.bind(this));E.push(B)},plotShadowOutline:function(H,L,C,A,G,J,I,F,E){var K=0.3;for(var B=1;B<=this.options.shadowSize/2;B++){var D=K*B;this.context.beginPath();this.context.strokeStyle="rgba(0,0,0,"+D+")";this.context.moveTo(this.translateHoz(C)+B,this.translateVert(A));if(I){this.context.lineTo(this.translateHoz(C)+B,this.translateVert(G)-B)}else{this.context.moveTo(this.translateHoz(C)+B,this.translateVert(G)-B)}if(E){this.context.lineTo(this.translateHoz(J)+B,this.translateVert(G)-B)}else{this.context.moveTo(this.translateHoz(J)+B,this.translateVert(G)-B)}if(F){this.context.lineTo(this.translateHoz(J)+B,this.translateVert(A))}else{this.context.lineTo(this.translateHoz(J)+B,this.translateVert(A))}this.context.stroke();this.context.closePath()}this.context.strokeStyle=L},drawGraphBars:function(D,A,B,F){this.context.save();this.context.translate(this.chartOffset.left,this.chartOffset.top);this.context.lineJoin="round";var E=D.bars.barWidth;var C=Math.min(D.bars.lineWidth,E);this.context.lineWidth=C;this.context.strokeStyle=D.color;if(D.bars.fill){this.context.fillStyle=D.bars.fillColor!=null?D.bars.fillColor:this.parseColor(D.color).scale(null,null,null,this.options.bars.fillOpacity).toString()}this.plotBars(D,D.data,E,0,D.bars.fill,A,B,F);this.context.restore()},insertLegend:function(){this.domObj.select(".legend").invoke("remove");if(!this.options.legend.show){return }var G=[];var E=false;this.graphData.each(function(L,K){if(!L.label){return }if(K%this.options.legend.noColumns==0){if(E){G.push("</tr>")}G.push("<tr>");E=true}var J=L.label;if(this.options.legend.labelFormatter!=null){J=this.options.legend.labelFormatter(J)}G.push('<td class="legendColorBox"><div style="border:1px solid '+this.options.legend.labelBoxBorderColor+';padding:1px"><div style="width:14px;height:10px;background-color:'+L.color+';overflow:hidden"></div></div></td><td class="legendLabel">'+J+"</td>")}.bind(this));if(E){G.push("</tr>")}if(G.length>0){var I='<table style="font-size:smaller;color:'+this.options.grid.color+'">'+G.join("")+"</table>";if($(this.options.legend.container)!=null){$(this.options.legend.container).insert(I)}else{var H="";var B=this.options.legend.position,C=this.options.legend.margin;if(B.charAt(0)=="n"){H+="top:"+(C+this.chartOffset.top)+"px;"}else{if(B.charAt(0)=="s"){H+="bottom:"+(C+this.chartOffset.bottom)+"px;"}}if(B.charAt(1)=="e"){H+="right:"+(C+this.chartOffset.right)+"px;"}else{if(B.charAt(1)=="w"){H+="left:"+(C+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;"+H+'">'+I+"</div>").getElementsBySelector("div.ProtoChart-legend").first();if(this.options.legend.backgroundOpacity!=0){var F=this.options.legend.backgroundColor;if(F==null){var D=(this.options.grid.backgroundColor!=null)?this.options.grid.backgroundColor:this.extractColor(A);F=this.parseColor(D).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;"+H+"background-color:"+F+';"> </div>').select("div.ProtoChart-legend-bg").first().setStyle({opacity:this.options.legend.backgroundOpacity})}}}},onMouseMove:function(B){var C=B||window.event;if(C.pageX==null&&C.clientX!=null){var F=document.documentElement,A=$(document.body);this.lastMousePos.pageX=C.clientX+(F&&F.scrollLeft||A.scrollLeft||0);this.lastMousePos.pageY=C.clientY+(F&&F.scrollTop||A.scrollTop||0)}else{this.lastMousePos.pageX=C.pageX;this.lastMousePos.pageY=C.pageY}var D=this.overlay.cumulativeOffset();var E={x:this.xaxis.min+(C.pageX-D.left-this.chartOffset.left)/this.hozScale,y:this.yaxis.max-(C.pageY-D.top-this.chartOffset.top)/this.vertScale};if(this.options.mouse.track&&this.selectionInterval==null){this.hit(B,E)}this.domObj.fire("ProtoChart:mousemove",[E])},onMouseOut:function(B){var A=this.domObj.select("."+this.options.mouse.clsName).first();if(A){A.setStyle({display:"none"})}this.clearHit()},onMouseDown:function(A){if(A.which!=1){return }document.body.focus();if(document.onselectstart!==undefined&&this.workarounds.onselectstart==null){this.workarounds.onselectstart=document.onselectstart;document.onselectstart=function(){return false}}if(document.ondrag!==undefined&&this.workarounds.ondrag==null){this.workarounds.ondrag=document.ondrag;document.ondrag=function(){return false}}this.setSelectionPos(this.selection.first,A);if(this.selectionInterval!=null){clearInterval(this.selectionInterval)}this.lastMousePos.pageX=null;this.selectionInterval=setInterval(this.updateSelectionOnMouseMove.bind(this),200);this.overlay.observe("mouseup",this.onSelectionMouseUp.bind(this))},onClick:function(B){if(this.ignoreClick){this.ignoreClick=false;return }var C=this.overlay.cumulativeOffset();var D={x:this.xaxis.min+(B.pageX-C.left-this.chartOffset.left)/this.hozScale,y:this.yaxis.max-(B.pageY-C.top-this.chartOffset.top)/this.vertScale};this.domObj.fire("ProtoChart:plotclick",[D]);if(this.options.allowDataClick){var A={};if(this.options.points.show){A=this.getDataClickPoint(D,this.options);this.domObj.fire("ProtoChart:dataclick",[A])}else{if(this.options.lines.show&&this.options.points.show){A=this.getDataClickPoint(D,this.options);this.domObj.fire("ProtoChart:dataclick",[A])}else{if(this.options.bars.show){if(this.barDataRange.length>0){A=this.getDataClickPoint(D,this.options,this.barDataRange);this.domObj.fire("ProtoChart:dataclick",[A])}}}}}},getDataClickPoint:function(E,C,D){E.x=parseInt(E.x);E.y=parseInt(E.y);var B=E.y.toFixed(0);var A={};A.position=E;A.value="";if(C.points.show){this.graphData.each(function(H){var F=H.data;var G=parseInt(E.x.toFixed(0));if(G<0){G=0}if(F[G]&&B>=F[G][1]-(this.options.points.radius*10)&&B<=F[G][1]+(this.options.points.radius*10)){A.value=F[G][1];throw $break}}.bind(this))}else{if(C.bars.show){xClick=E.x;this.barDataRange.each(function(F){F.each(function(H){var G=H;if(xClick>G.left&&xClick<G.right){A.value=G.value;throw $break}}.bind(this))}.bind(this))}}return A},triggerSelectedEvent:function(){var B,A,D,C;if(this.selection.first.x<=this.selection.second.x){B=this.selection.first.x;A=this.selection.second.x}else{B=this.selection.second.x;A=this.selection.first.x}if(this.selection.first.y>=this.selection.second.y){D=this.selection.first.y;C=this.selection.second.y}else{D=this.selection.second.y;C=this.selection.first.y}B=this.xaxis.min+B/this.hozScale;A=this.xaxis.min+A/this.hozScale;D=this.yaxis.max-D/this.vertScale;C=this.yaxis.max-C/this.vertScale;this.domObj.fire("ProtoChart:selected",[{x1:B,y1:D,x2:A,y2:C}])},onSelectionMouseUp:function(A){if(document.onselectstart!==undefined){document.onselectstart=this.workarounds.onselectstart}if(document.ondrag!==undefined){document.ondrag=this.workarounds.ondrag}if(this.selectionInterval!=null){clearInterval(this.selectionInterval);this.selectionInterval=null}this.setSelectionPos(this.selection.second,A);this.clearSelection();if(!this.selectionIsSane()||A.which!=1){return false}this.drawSelection();this.triggerSelectedEvent();this.ignoreClick=true;return false},setSelectionPos:function(C,A){var B=$(this.overlay).cumulativeOffset();if(this.options.selection.mode=="y"){if(C==this.selection.first){C.x=0}else{C.x=this.chartWidth}}else{C.x=A.pageX-B.left-this.chartOffset.left;C.x=Math.min(Math.max(0,C.x),this.chartWidth)}if(this.options.selection.mode=="x"){if(C==this.selection.first){C.y=0}else{C.y=this.chartHeight}}else{C.y=A.pageY-B.top-this.chartOffset.top;C.y=Math.min(Math.max(0,C.y),this.chartHeight)}},updateSelectionOnMouseMove:function(){if(this.lastMousePos.pageX==null){return }this.setSelectionPos(this.selection.second,this.lastMousePos);this.clearSelection();if(this.selectionIsSane()){this.drawSelection()}},clearSelection:function(){if(this.prevSelection==null){return }var A=Math.min(this.prevSelection.first.x,this.prevSelection.second.x),D=Math.min(this.prevSelection.first.y,this.prevSelection.second.y),B=Math.abs(this.prevSelection.second.x-this.prevSelection.first.x),C=Math.abs(this.prevSelection.second.y-this.prevSelection.first.y);this.overlayContext.clearRect(A+this.chartOffset.left-this.overlayContext.lineWidth,D+this.chartOffset.top-this.overlayContext.lineWidth,B+this.overlayContext.lineWidth*2,C+this.overlayContext.lineWidth*2);this.prevSelection=null},setSelection:function(A){this.clearSelection();if(this.options.selection.mode=="x"){this.selection.first.y=0;this.selection.second.y=this.chartHeight}else{this.selection.first.y=(this.yaxis.max-A.y1)*this.vertScale;this.selection.second.y=(this.yaxis.max-A.y2)*this.vertScale}if(this.options.selection.mode=="y"){this.selection.first.x=0;this.selection.second.x=this.chartWidth}else{this.selection.first.x=(A.x1-this.xaxis.min)*this.hozScale;this.selection.second.x=(A.x2-this.xaxis.min)*this.hozScale}this.drawSelection();this.triggerSelectedEvent()},drawSelection:function(){if(this.prevSelection!=null&&this.selection.first.x==this.prevSelection.first.x&&this.selection.first.y==this.prevSelection.first.y&&this.selection.second.x==this.prevSelection.second.x&&this.selection.second.y==this.prevSelection.second.y){return }this.overlayContext.strokeStyle=this.parseColor(this.options.selection.color).scale(null,null,null,0.8).toString();this.overlayContext.lineWidth=1;this.context.lineJoin="round";this.overlayContext.fillStyle=this.parseColor(this.options.selection.color).scale(null,null,null,0.4).toString();this.prevSelection={first:{x:this.selection.first.x,y:this.selection.first.y},second:{x:this.selection.second.x,y:this.selection.second.y}};var A=Math.min(this.selection.first.x,this.selection.second.x),D=Math.min(this.selection.first.y,this.selection.second.y),B=Math.abs(this.selection.second.x-this.selection.first.x),C=Math.abs(this.selection.second.y-this.selection.first.y);this.overlayContext.fillRect(A+this.chartOffset.left,D+this.chartOffset.top,B,C);this.overlayContext.strokeRect(A+this.chartOffset.left,D+this.chartOffset.top,B,C)},selectionIsSane:function(){var A=5;return Math.abs(this.selection.second.x-this.selection.first.x)>=A&&Math.abs(this.selection.second.y-this.selection.first.y)>=A},defaultTrackFormatter:function(A){return"["+A.x+", "+A.y+"]"},clearHit:function(){if(this.prevHit){this.overlayContext.clearRect(this.translateHoz(this.prevHit.x)+this.chartOffset.left-this.options.mouse.radius*2,this.translateVert(this.prevHit.y)+this.chartOffset.top-this.options.mouse.radius*2,this.options.mouse.radius*3+this.options.points.lineWidth*3,this.options.mouse.radius*3+this.options.points.lineWidth*3);this.prevHit=null}},hit:function(A,M){var F={dist:Number.MAX_VALUE,x:null,y:null,mouse:null};for(var L=0,K,H,D;L<this.graphData.length;L++){if(!this.graphData[L].mouse.track){continue}K=this.graphData[L].data;H=(this.hozScale*this.graphData[L].mouse.sensibility);D=(this.vertScale*this.graphData[L].mouse.sensibility);for(var I=0,N,J;I<K.length;I++){N=this.hozScale*Math.abs(K[I][0]-M.x);J=this.vertScale*Math.abs(K[I][1]-M.y);if(N<H&&J<D&&(N+J)<F.dist){F.dist=(N+J);F.x=K[I][0];F.y=K[I][1];F.mouse=this.graphData[L].mouse}}}if(F.mouse&&F.mouse.track&&!this.prevHit||(this.prevHit&&F.x!=this.prevHit.x&&F.y!=this.prevHit.y)){var C=this.domObj.select("."+this.options.mouse.clsName).first();if(!C){var O="",B=this.options.mouse.position,G=this.options.mouse.margin;if(B.charAt(0)=="n"){O+="top:"+(G+this.chartOffset.top)+"px;"}else{if(B.charAt(0)=="s"){O+="bottom:"+(G+this.chartOffset.bottom)+"px;"}}if(B.charAt(1)=="e"){O+="right:"+(G+this.chartOffset.right)+"px;"}else{if(B.charAt(1)=="w"){O+="left:"+(G+this.chartOffset.bottom)+"px;"}}this.domObj.insert('<div class="'+this.options.mouse.clsName+'" style="display:none;position:absolute;'+O+'"></div>');return }if(F.x!==null&&F.y!==null){C.setStyle({display:"block"});this.clearHit();if(F.mouse.lineColor!=null){this.overlayContext.save();this.overlayContext.translate(this.chartOffset.left,this.chartOffset.top);this.overlayContext.lineWidth=this.options.points.lineWidth;this.overlayContext.strokeStyle=F.mouse.lineColor;this.overlayContext.fillStyle="#ffffff";this.overlayContext.beginPath();this.overlayContext.arc(this.translateHoz(F.x),this.translateVert(F.y),this.options.mouse.radius,0,2*Math.PI,true);this.overlayContext.fill();this.overlayContext.stroke();this.overlayContext.restore()}this.prevHit=F;var E=F.mouse.trackDecimals;if(E==null||E<0){E=0}if(!this.options.mouse.fixedPosition){C.setStyle({left:(this.translateHoz(F.x)+this.options.mouse.radius+10)+"px",top:(this.translateVert(F.y)+this.options.mouse.radius+10)+"px"})}C.innerHTML=F.mouse.trackFormatter({x:F.x.toFixed?F.x.toFixed(E):F.x,y:F.y.toFixed?F.y.toFixed(E):F.y});this.domObj.fire("ProtoChart:hit",[F])}else{if(this.options.prevHit){C.setStyle({display:"none"});this.clearHit()}}}},floorInBase:function(B,A){return A*Math.floor(B/A)},extractColor:function(B){var A;do{A=$(B).getStyle("background-color").toLowerCase();if(A!=""&&A!="transparent"){break}B=B.up(0)}while(B.nodeName.toLowerCase()!="body");if(A=="rgba(0, 0, 0, 0)"){return"transparent"}return A},parseColor:function(C){var A;if((A=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(C))){return new Proto.Color(parseInt(A[1]),parseInt(A[2]),parseInt(A[3]))}if((A=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(C))){return new Proto.Color(parseInt(A[1]),parseInt(A[2]),parseInt(A[3]),parseFloat(A[4]))}if((A=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(C))){return new Proto.Color(parseFloat(A[1])*2.55,parseFloat(A[2])*2.55,parseFloat(A[3])*2.55)}if((A=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(C))){return new Proto.Color(parseFloat(A[1])*2.55,parseFloat(A[2])*2.55,parseFloat(A[3])*2.55,parseFloat(A[4]))}if((A=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(C))){return new Proto.Color(parseInt(A[1],16),parseInt(A[2],16),parseInt(A[3],16))}if((A=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(C))){return new Proto.Color(parseInt(A[1]+A[1],16),parseInt(A[2]+A[2],16),parseInt(A[3]+A[3],16))}var B=C.strip().toLowerCase();if(B=="transparent"){return new Proto.Color(255,255,255,0)}return new Proto.Color(100,100,100,1)}});if(!Proto){var Proto={}}Proto.Color=Class.create({initialize:function(E,D,B,C){this.rgba=["r","g","b","a"];var A=4;while(-1<--A){this[this.rgba[A]]=arguments[A]||((A==3)?1:0)}},toString:function(){if(this.a>=1){return"rgb("+[this.r,this.g,this.b].join(",")+")"}else{return"rgba("+[this.r,this.g,this.b,this.a].join(",")+")"}},scale:function(C,B,D,A){x=4;while(-1<--x){if(arguments[x]!=null){this[this.rgba[x]]*=arguments[x]}}return this.normalize()},adjust:function(C,B,D,A){x=4;while(-1<--x){if(arguments[x]!=null){this[this.rgba[x]]+=arguments[x]}}return this.normalize()},clone:function(){return new Proto.Color(this.r,this.b,this.g,this.a)},limit:function(B,A,C){return Math.max(Math.min(B,C),A)},normalize:function(){this.r=this.limit(parseInt(this.r),0,255);this.g=this.limit(parseInt(this.g),0,255);this.b=this.limit(parseInt(this.b),0,255);this.a=this.limit(this.a,0,1);return this}});var Scriptaculous={Version:"1.8.1",require:function(A){document.write('<script type="text/javascript" src="'+A+'"><\/script>')},REQUIRED_PROTOTYPE:"1.6.0",load:function(){function A(B){var C=B.split(".");return parseInt(C[0])*100000+parseInt(C[1])*1000+parseInt(C[2])}if((typeof Prototype=="undefined")||(typeof Element=="undefined")||(typeof Element.Methods=="undefined")||(A(Prototype.Version)<A(Scriptaculous.REQUIRED_PROTOTYPE))){throw ("script.aculo.us requires the Prototype JavaScript framework >= "+Scriptaculous.REQUIRED_PROTOTYPE)}$A(document.getElementsByTagName("script")).findAll(function(B){return(B.src&&B.src.match(/scriptaculous\.js(\?.*)?$/))}).each(function(C){var D=C.src.replace(/scriptaculous\.js(\?.*)?$/,"");var B=C.src.match(/\?.*load=([a-z,]*)/);(B?B[1]:"builder,effects,dragdrop,controls,slider,sound").split(",").each(function(E){Scriptaculous.require(D+E+".js")})})}};Scriptaculous.load();String.prototype.parseColor=function(){var A="#";if(this.slice(0,4)=="rgb("){var C=this.slice(4,this.length-1).split(",");var B=0;do{A+=parseInt(C[B]).toColorPart()}while(++B<3)}else{if(this.slice(0,1)=="#"){if(this.length==4){for(var B=1;B<4;B++){A+=(this.charAt(B)+this.charAt(B)).toLowerCase()}}if(this.length==7){A=this.toLowerCase()}}}return(A.length==7?A:(arguments[0]||this))};Element.collectTextNodes=function(A){return $A($(A).childNodes).collect(function(B){return(B.nodeType==3?B.nodeValue:(B.hasChildNodes()?Element.collectTextNodes(B):""))}).flatten().join("")};Element.collectTextNodesIgnoreClass=function(A,B){return $A($(A).childNodes).collect(function(C){return(C.nodeType==3?C.nodeValue:((C.hasChildNodes()&&!Element.hasClassName(C,B))?Element.collectTextNodesIgnoreClass(C,B):""))}).flatten().join("")};Element.setContentZoom=function(A,B){A=$(A);A.setStyle({fontSize:(B/100)+"em"});if(Prototype.Browser.WebKit){window.scrollBy(0,0)}return A};Element.getInlineOpacity=function(A){return $(A).style.opacity||""};Element.forceRerendering=function(A){try{A=$(A);var C=document.createTextNode(" ");A.appendChild(C);A.removeChild(C)}catch(B){}};var Effect={_elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},Transitions:{linear:Prototype.K,sinoidal:function(A){return(-Math.cos(A*Math.PI)/2)+0.5},reverse:function(A){return 1-A},flicker:function(A){var A=((-Math.cos(A*Math.PI)/4)+0.75)+Math.random()/4;return A>1?1:A},wobble:function(A){return(-Math.cos(A*Math.PI*(9*A))/2)+0.5},pulse:function(B,A){A=A||5;return(((B%(1/A))*A).round()==0?((B*A*2)-(B*A*2).floor()):1-((B*A*2)-(B*A*2).floor()))},spring:function(A){return 1-(Math.cos(A*4.5*Math.PI)*Math.exp(-A*6))},none:function(A){return 0},full:function(A){return 1}},DefaultOptions:{duration:1,fps:100,sync:false,from:0,to:1,delay:0,queue:"parallel"},tagifyText:function(A){var B="position:relative";if(Prototype.Browser.IE){B+=";zoom:1"}A=$(A);$A(A.childNodes).each(function(C){if(C.nodeType==3){C.nodeValue.toArray().each(function(D){A.insertBefore(new Element("span",{style:B}).update(D==" "?String.fromCharCode(160):D),C)});Element.remove(C)}})},multiple:function(B,C){var E;if(((typeof B=="object")||Object.isFunction(B))&&(B.length)){E=B}else{E=$(B).childNodes}var A=Object.extend({speed:0.1,delay:0},arguments[2]||{});var D=A.delay;$A(E).each(function(G,F){new C(G,Object.extend(A,{delay:F*A.speed+D}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(B,C){B=$(B);C=(C||"appear").toLowerCase();var A=Object.extend({queue:{position:"end",scope:(B.id||"global"),limit:1}},arguments[2]||{});Effect[B.visible()?Effect.PAIRS[C][1]:Effect.PAIRS[C][0]](B,A)}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null},_each:function(A){this.effects._each(A)},add:function(B){var C=new Date().getTime();var A=Object.isString(B.options.queue)?B.options.queue:B.options.queue.position;switch(A){case"front":this.effects.findAll(function(D){return D.state=="idle"}).each(function(D){D.startOn+=B.finishOn;D.finishOn+=B.finishOn});break;case"with-last":C=this.effects.pluck("startOn").max()||C;break;case"end":C=this.effects.pluck("finishOn").max()||C;break}B.startOn+=C;B.finishOn+=C;if(!B.options.queue.limit||(this.effects.length<B.options.queue.limit)){this.effects.push(B)}if(!this.interval){this.interval=setInterval(this.loop.bind(this),15)}},remove:function(A){this.effects=this.effects.reject(function(B){return B==A});if(this.effects.length==0){clearInterval(this.interval);this.interval=null}},loop:function(){var C=new Date().getTime();for(var B=0,A=this.effects.length;B<A;B++){this.effects[B]&&this.effects[B].loop(C)}}});Effect.Queues={instances:$H(),get:function(A){if(!Object.isString(A)){return A}return this.instances.get(A)||this.instances.set(A,new Effect.ScopedQueue())}};Effect.Queue=Effect.Queues.get("global");Effect.Base=Class.create({position:null,start:function(options){function codeForEvent(options,eventName){return((options[eventName+"Internal"]?"this.options."+eventName+"Internal(this);":"")+(options[eventName]?"this.options."+eventName+"(this);":""))}if(options&&options.transition===false){options.transition=Effect.Transitions.linear}this.options=Object.extend(Object.extend({},Effect.DefaultOptions),options||{});this.currentFrame=0;this.state="idle";this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.fromToDelta=this.options.to-this.options.from;this.totalTime=this.finishOn-this.startOn;this.totalFrames=this.options.fps*this.options.duration;eval('this.render = function(pos){ if (this.state=="idle"){this.state="running";'+codeForEvent(this.options,"beforeSetup")+(this.setup?"this.setup();":"")+codeForEvent(this.options,"afterSetup")+'};if (this.state=="running"){pos=this.options.transition(pos)*'+this.fromToDelta+"+"+this.options.from+";this.position=pos;"+codeForEvent(this.options,"beforeUpdate")+(this.update?"this.update(pos);":"")+codeForEvent(this.options,"afterUpdate")+"}}");this.event("beforeStart");if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).add(this)}},loop:function(C){if(C>=this.startOn){if(C>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");if(this.finish){this.finish()}this.event("afterFinish");return }var B=(C-this.startOn)/this.totalTime,A=(B*this.totalFrames).round();if(A>this.currentFrame){this.render(B);this.currentFrame=A}}},cancel:function(){if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).remove(this)}this.state="finished"},event:function(A){if(this.options[A+"Internal"]){this.options[A+"Internal"](this)}if(this.options[A]){this.options[A](this)}},inspect:function(){var A=$H();for(property in this){if(!Object.isFunction(this[property])){A.set(property,this[property])}}return"#<Effect:"+A.inspect()+",options:"+$H(this.options).inspect()+">"}});Effect.Parallel=Class.create(Effect.Base,{initialize:function(A){this.effects=A||[];this.start(arguments[1])},update:function(A){this.effects.invoke("render",A)},finish:function(A){this.effects.each(function(B){B.render(1);B.cancel();B.event("beforeFinish");if(B.finish){B.finish(A)}B.event("afterFinish")})}});Effect.Tween=Class.create(Effect.Base,{initialize:function(C,F,E){C=Object.isString(C)?$(C):C;var B=$A(arguments),D=B.last(),A=B.length==5?B[3]:null;this.method=Object.isFunction(D)?D.bind(C):Object.isFunction(C[D])?C[D].bind(C):function(G){C[D]=G};this.start(Object.extend({from:F,to:E},A||{}))},update:function(A){this.method(A)}});Effect.Event=Class.create(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}))},update:Prototype.emptyFunction});Effect.Opacity=Class.create(Effect.Base,{initialize:function(B){this.element=$(B);if(!this.element){throw (Effect._elementDoesNotExistError)}if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}var A=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});this.start(A)},update:function(A){this.element.setOpacity(A)}});Effect.Move=Class.create(Effect.Base,{initialize:function(B){this.element=$(B);if(!this.element){throw (Effect._elementDoesNotExistError)}var A=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{});this.start(A)},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle("left")||"0");this.originalTop=parseFloat(this.element.getStyle("top")||"0");if(this.options.mode=="absolute"){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop}},update:function(A){this.element.setStyle({left:(this.options.x*A+this.originalLeft).round()+"px",top:(this.options.y*A+this.originalTop).round()+"px"})}});Effect.MoveBy=function(B,A,C){return new Effect.Move(B,Object.extend({x:C,y:A},arguments[3]||{}))};Effect.Scale=Class.create(Effect.Base,{initialize:function(B,C){this.element=$(B);if(!this.element){throw (Effect._elementDoesNotExistError)}var A=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:C},arguments[2]||{});this.start(A)},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle("position");this.originalStyle={};["top","left","width","height","fontSize"].each(function(B){this.originalStyle[B]=this.element.style[B]}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var A=this.element.getStyle("font-size")||"100%";["em","px","%","pt"].each(function(B){if(A.indexOf(B)>0){this.fontSize=parseFloat(A);this.fontSizeType=B}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=="box"){this.dims=[this.element.offsetHeight,this.element.offsetWidth]}if(/^content/.test(this.options.scaleMode)){this.dims=[this.element.scrollHeight,this.element.scrollWidth]}if(!this.dims){this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]}},update:function(A){var B=(this.options.scaleFrom/100)+(this.factor*A);if(this.options.scaleContent&&this.fontSize){this.element.setStyle({fontSize:this.fontSize*B+this.fontSizeType})}this.setDimensions(this.dims[0]*B,this.dims[1]*B)},finish:function(A){if(this.restoreAfterFinish){this.element.setStyle(this.originalStyle)}},setDimensions:function(A,D){var E={};if(this.options.scaleX){E.width=D.round()+"px"}if(this.options.scaleY){E.height=A.round()+"px"}if(this.options.scaleFromCenter){var C=(A-this.dims[0])/2;var B=(D-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY){E.top=this.originalTop-C+"px"}if(this.options.scaleX){E.left=this.originalLeft-B+"px"}}else{if(this.options.scaleY){E.top=-C+"px"}if(this.options.scaleX){E.left=-B+"px"}}}this.element.setStyle(E)}});Effect.Highlight=Class.create(Effect.Base,{initialize:function(B){this.element=$(B);if(!this.element){throw (Effect._elementDoesNotExistError)}var A=Object.extend({startcolor:"#ffff99"},arguments[1]||{});this.start(A)},setup:function(){if(this.element.getStyle("display")=="none"){this.cancel();return }this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle("background-image");this.element.setStyle({backgroundImage:"none"})}if(!this.options.endcolor){this.options.endcolor=this.element.getStyle("background-color").parseColor("#ffffff")}if(!this.options.restorecolor){this.options.restorecolor=this.element.getStyle("background-color")}this._base=$R(0,2).map(function(A){return parseInt(this.options.startcolor.slice(A*2+1,A*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(A){return parseInt(this.options.endcolor.slice(A*2+1,A*2+3),16)-this._base[A]}.bind(this))},update:function(A){this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(B,C,D){return B+((this._base[D]+(this._delta[D]*A)).round().toColorPart())}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=function(D){var C=arguments[1]||{},B=document.viewport.getScrollOffsets(),E=$(D).cumulativeOffset(),A=(window.height||document.body.scrollHeight)-document.viewport.getHeight();if(C.offset){E[1]+=C.offset}return new Effect.Tween(null,B.top,E[1]>A?A:E[1],C,function(F){scrollTo(B.left,F.round())})};Effect.Fade=function(C){C=$(C);var A=C.getInlineOpacity();var B=Object.extend({from:C.getOpacity()||1,to:0,afterFinishInternal:function(D){if(D.options.to!=0){return }D.element.hide().setStyle({opacity:A})}},arguments[1]||{});return new Effect.Opacity(C,B)};Effect.Appear=function(B){B=$(B);var A=Object.extend({from:(B.getStyle("display")=="none"?0:B.getOpacity()||0),to:1,afterFinishInternal:function(C){C.element.forceRerendering()},beforeSetup:function(C){C.element.setOpacity(C.options.from).show()}},arguments[1]||{});return new Effect.Opacity(B,A)};Effect.Puff=function(B){B=$(B);var A={opacity:B.getInlineOpacity(),position:B.getStyle("position"),top:B.style.top,left:B.style.left,width:B.style.width,height:B.style.height};return new Effect.Parallel([new Effect.Scale(B,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(B,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(C){Position.absolutize(C.effects[0].element)},afterFinishInternal:function(C){C.effects[0].element.hide().setStyle(A)}},arguments[1]||{}))};Effect.BlindUp=function(A){A=$(A);A.makeClipping();return new Effect.Scale(A,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(B){B.element.hide().undoClipping()}},arguments[1]||{}))};Effect.BlindDown=function(B){B=$(B);var A=B.getDimensions();return new Effect.Scale(B,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:A.height,originalWidth:A.width},restoreAfterFinish:true,afterSetup:function(C){C.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(C){C.element.undoClipping()}},arguments[1]||{}))};Effect.SwitchOff=function(B){B=$(B);var A=B.getInlineOpacity();return new Effect.Appear(B,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(C){new Effect.Scale(C.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(D){D.element.makePositioned().makeClipping()},afterFinishInternal:function(D){D.element.hide().undoClipping().undoPositioned().setStyle({opacity:A})}})}},arguments[1]||{}))};Effect.DropOut=function(B){B=$(B);var A={top:B.getStyle("top"),left:B.getStyle("left"),opacity:B.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(B,{x:0,y:100,sync:true}),new Effect.Opacity(B,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(C){C.effects[0].element.makePositioned()},afterFinishInternal:function(C){C.effects[0].element.hide().undoPositioned().setStyle(A)}},arguments[1]||{}))};Effect.Shake=function(D){D=$(D);var B=Object.extend({distance:20,duration:0.5},arguments[1]||{});var E=parseFloat(B.distance);var C=parseFloat(B.duration)/10;var A={top:D.getStyle("top"),left:D.getStyle("left")};return new Effect.Move(D,{x:E,y:0,duration:C,afterFinishInternal:function(F){new Effect.Move(F.element,{x:-E*2,y:0,duration:C*2,afterFinishInternal:function(G){new Effect.Move(G.element,{x:E*2,y:0,duration:C*2,afterFinishInternal:function(H){new Effect.Move(H.element,{x:-E*2,y:0,duration:C*2,afterFinishInternal:function(I){new Effect.Move(I.element,{x:E*2,y:0,duration:C*2,afterFinishInternal:function(J){new Effect.Move(J.element,{x:-E,y:0,duration:C,afterFinishInternal:function(K){K.element.undoPositioned().setStyle(A)}})}})}})}})}})}})};Effect.SlideDown=function(C){C=$(C).cleanWhitespace();var A=C.down().getStyle("bottom");var B=C.getDimensions();return new Effect.Scale(C,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:B.height,originalWidth:B.width},restoreAfterFinish:true,afterSetup:function(D){D.element.makePositioned();D.element.down().makePositioned();if(window.opera){D.element.setStyle({top:""})}D.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(D){D.element.down().setStyle({bottom:(D.dims[0]-D.element.clientHeight)+"px"})},afterFinishInternal:function(D){D.element.undoClipping().undoPositioned();D.element.down().undoPositioned().setStyle({bottom:A})}},arguments[1]||{}))};Effect.SlideUp=function(C){C=$(C).cleanWhitespace();var A=C.down().getStyle("bottom");var B=C.getDimensions();return new Effect.Scale(C,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,scaleMode:{originalHeight:B.height,originalWidth:B.width},restoreAfterFinish:true,afterSetup:function(D){D.element.makePositioned();D.element.down().makePositioned();if(window.opera){D.element.setStyle({top:""})}D.element.makeClipping().show()},afterUpdateInternal:function(D){D.element.down().setStyle({bottom:(D.dims[0]-D.element.clientHeight)+"px"})},afterFinishInternal:function(D){D.element.hide().undoClipping().undoPositioned();D.element.down().undoPositioned().setStyle({bottom:A})}},arguments[1]||{}))};Effect.Squish=function(A){return new Effect.Scale(A,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(B){B.element.makeClipping()},afterFinishInternal:function(B){B.element.hide().undoClipping()}})};Effect.Grow=function(C){C=$(C);var B=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var A={top:C.style.top,left:C.style.left,height:C.style.height,width:C.style.width,opacity:C.getInlineOpacity()};var G=C.getDimensions();var H,F;var E,D;switch(B.direction){case"top-left":H=F=E=D=0;break;case"top-right":H=G.width;F=D=0;E=-G.width;break;case"bottom-left":H=E=0;F=G.height;D=-G.height;break;case"bottom-right":H=G.width;F=G.height;E=-G.width;D=-G.height;break;case"center":H=G.width/2;F=G.height/2;E=-G.width/2;D=-G.height/2;break}return new Effect.Move(C,{x:H,y:F,duration:0.01,beforeSetup:function(I){I.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(I){new Effect.Parallel([new Effect.Opacity(I.element,{sync:true,to:1,from:0,transition:B.opacityTransition}),new Effect.Move(I.element,{x:E,y:D,sync:true,transition:B.moveTransition}),new Effect.Scale(I.element,100,{scaleMode:{originalHeight:G.height,originalWidth:G.width},sync:true,scaleFrom:window.opera?1:0,transition:B.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(J){J.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(J){J.effects[0].element.undoClipping().undoPositioned().setStyle(A)}},B))}})};Effect.Shrink=function(C){C=$(C);var B=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var A={top:C.style.top,left:C.style.left,height:C.style.height,width:C.style.width,opacity:C.getInlineOpacity()};var F=C.getDimensions();var E,D;switch(B.direction){case"top-left":E=D=0;break;case"top-right":E=F.width;D=0;break;case"bottom-left":E=0;D=F.height;break;case"bottom-right":E=F.width;D=F.height;break;case"center":E=F.width/2;D=F.height/2;break}return new Effect.Parallel([new Effect.Opacity(C,{sync:true,to:0,from:1,transition:B.opacityTransition}),new Effect.Scale(C,window.opera?1:0,{sync:true,transition:B.scaleTransition,restoreAfterFinish:true}),new Effect.Move(C,{x:E,y:D,sync:true,transition:B.moveTransition})],Object.extend({beforeStartInternal:function(G){G.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(G){G.effects[0].element.hide().undoClipping().undoPositioned().setStyle(A)}},B))};Effect.Pulsate=function(C){C=$(C);var B=arguments[1]||{};var A=C.getInlineOpacity();var E=B.transition||Effect.Transitions.sinoidal;var D=function(F){return E(1-Effect.Transitions.pulse(F,B.pulses))};D.bind(E);return new Effect.Opacity(C,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(F){F.element.setStyle({opacity:A})}},B),{transition:D}))};Effect.Fold=function(B){B=$(B);var A={top:B.style.top,left:B.style.left,width:B.style.width,height:B.style.height};B.makeClipping();return new Effect.Scale(B,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(C){new Effect.Scale(B,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(D){D.element.hide().undoClipping().setStyle(A)}})}},arguments[1]||{}))};Effect.Morph=Class.create(Effect.Base,{initialize:function(C){this.element=$(C);if(!this.element){throw (Effect._elementDoesNotExistError)}var A=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(A.style)){this.style=$H(A.style)}else{if(A.style.include(":")){this.style=A.style.parseStyle()}else{this.element.addClassName(A.style);this.style=$H(this.element.getStyles());this.element.removeClassName(A.style);var B=this.element.getStyles();this.style=this.style.reject(function(D){return D.value==B[D.key]});A.afterFinishInternal=function(D){D.element.addClassName(D.options.style);D.transforms.each(function(E){D.element.style[E.style]=""})}}}this.start(A)},setup:function(){function A(B){if(!B||["rgba(0, 0, 0, 0)","transparent"].include(B)){B="#ffffff"}B=B.parseColor();return $R(0,2).map(function(C){return parseInt(B.slice(C*2+1,C*2+3),16)})}this.transforms=this.style.map(function(G){var F=G[0],E=G[1],D=null;if(E.parseColor("#zzzzzz")!="#zzzzzz"){E=E.parseColor();D="color"}else{if(F=="opacity"){E=parseFloat(E);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}}else{if(Element.CSS_LENGTH.test(E)){var C=E.match(/^([\+\-]?[0-9\.]+)(.*)$/);E=parseFloat(C[1]);D=(C.length==3)?C[2]:null}}}var B=this.element.getStyle(F);return{style:F.camelize(),originalValue:D=="color"?A(B):parseFloat(B||0),targetValue:D=="color"?A(E):E,unit:D}}.bind(this)).reject(function(B){return((B.originalValue==B.targetValue)||(B.unit!="color"&&(isNaN(B.originalValue)||isNaN(B.targetValue))))})},update:function(A){var D={},B,C=this.transforms.length;while(C--){D[(B=this.transforms[C]).style]=B.unit=="color"?"#"+(Math.round(B.originalValue[0]+(B.targetValue[0]-B.originalValue[0])*A)).toColorPart()+(Math.round(B.originalValue[1]+(B.targetValue[1]-B.originalValue[1])*A)).toColorPart()+(Math.round(B.originalValue[2]+(B.targetValue[2]-B.originalValue[2])*A)).toColorPart():(B.originalValue+(B.targetValue-B.originalValue)*A).toFixed(3)+(B.unit===null?"":B.unit)}this.element.setStyle(D,true)}});Effect.Transform=Class.create({initialize:function(A){this.tracks=[];this.options=arguments[1]||{};this.addTracks(A)},addTracks:function(A){A.each(function(B){B=$H(B);var C=B.values().first();this.tracks.push($H({ids:B.keys().first(),effect:Effect.Morph,options:{style:C}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(A){var D=A.get("ids"),C=A.get("effect"),B=A.get("options");var E=[$(D)||$$(D)].flatten();return E.map(function(F){return new C(F,Object.extend({sync:true},B))})}).flatten(),this.options)}});Element.CSS_PROPERTIES=$w("backgroundColor backgroundPosition borderBottomColor borderBottomStyle borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth borderRightColor borderRightStyle borderRightWidth borderSpacing borderTopColor borderTopStyle borderTopWidth bottom clip color fontSize fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop markerOffset maxHeight maxWidth minHeight minWidth opacity outlineColor outlineOffset outlineWidth paddingBottom paddingLeft paddingRight paddingTop right textIndent top width wordSpacing zIndex");Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.__parseStyleElement=document.createElement("div");String.prototype.parseStyle=function(){var B,A=$H();if(Prototype.Browser.WebKit){B=new Element("div",{style:this}).style}else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';B=String.__parseStyleElement.childNodes[0].style}Element.CSS_PROPERTIES.each(function(C){if(B[C]){A.set(C,B[C])}});if(Prototype.Browser.IE&&this.include("opacity")){A.set("opacity",this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1])}return A};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(B){var A=document.defaultView.getComputedStyle($(B),null);return Element.CSS_PROPERTIES.inject({},function(C,D){C[D]=A[D];return C})}}else{Element.getStyles=function(B){B=$(B);var A=B.currentStyle,C;C=Element.CSS_PROPERTIES.inject({},function(D,E){D[E]=A[E];return D});if(!C.opacity){C.opacity=B.getOpacity()}return C}}Effect.Methods={morph:function(A,B){A=$(A);new Effect.Morph(A,Object.extend({style:B},arguments[2]||{}));return A},visualEffect:function(C,E,B){C=$(C);var D=E.dasherize().camelize(),A=D.charAt(0).toUpperCase()+D.substring(1);new Effect[A](C,B);return C},highlight:function(B,A){B=$(B);new Effect.Highlight(B,A);return B}};$w("fade appear grow shrink fold blindUp blindDown slideUp slideDown pulsate shake puff squish switchOff dropOut").each(function(A){Effect.Methods[A]=function(C,B){C=$(C);Effect[A.charAt(0).toUpperCase()+A.substring(1)](C,B);return C}});$w("getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles").each(function(A){Effect.Methods[A]=Element[A]});Element.addMethods(Effect.Methods);if(Object.isUndefined(Effect)){throw ("dragdrop.js requires including script.aculo.us' effects.js library")}var Droppables={drops:[],remove:function(A){this.drops=this.drops.reject(function(B){return B.element==$(A)})},add:function(B){B=$(B);var A=Object.extend({greedy:true,hoverclass:null,tree:false},arguments[1]||{});if(A.containment){A._containers=[];var C=A.containment;if(Object.isArray(C)){C.each(function(D){A._containers.push($(D))})}else{A._containers.push($(C))}}if(A.accept){A.accept=[A.accept].flatten()}Element.makePositioned(B);A.element=B;this.drops.push(A)},findDeepestChild:function(A){deepest=A[0];for(i=1;i<A.length;++i){if(Element.isParent(A[i].element,deepest.element)){deepest=A[i]}}return deepest},isContained:function(B,A){var C;if(A.tree){C=B.treeNode}else{C=B.parentNode}return A._containers.detect(function(D){return C==D})},isAffected:function(A,C,B){return((B.element!=C)&&((!B._containers)||this.isContained(C,B))&&((!B.accept)||(Element.classNames(C).detect(function(D){return B.accept.include(D)})))&&Position.within(B.element,A[0],A[1]))},deactivate:function(A){if(A.hoverclass){Element.removeClassName(A.element,A.hoverclass)}this.last_active=null},activate:function(A){if(A.hoverclass){Element.addClassName(A.element,A.hoverclass)}this.last_active=A},show:function(A,C){if(!this.drops.length){return }var B,D=[];this.drops.each(function(E){if(Droppables.isAffected(A,C,E)){D.push(E)}});if(D.length>0){B=Droppables.findDeepestChild(D)}if(this.last_active&&this.last_active!=B){this.deactivate(this.last_active)}if(B){Position.within(B.element,A[0],A[1]);if(B.onHover){B.onHover(C,B.element,Position.overlap(B.overlap,B.element))}if(B!=this.last_active){Droppables.activate(B)}}},fire:function(B,A){if(!this.last_active){return }Position.prepare();if(this.isAffected([Event.pointerX(B),Event.pointerY(B)],A,this.last_active)){if(this.last_active.onDrop){this.last_active.onDrop(A,this.last_active.element,B);return true}}},reset:function(){if(this.last_active){this.deactivate(this.last_active)}}};var Draggables={drags:[],observers:[],register:function(A){if(this.drags.length==0){this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.updateDrag.bindAsEventListener(this);this.eventKeypress=this.keyPress.bindAsEventListener(this);Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(document,"mousemove",this.eventMouseMove);Event.observe(document,"keypress",this.eventKeypress)}this.drags.push(A)},unregister:function(A){this.drags=this.drags.reject(function(B){return B==A});if(this.drags.length==0){Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);Event.stopObserving(document,"keypress",this.eventKeypress)}},activate:function(A){if(A.options.delay){this._timeout=setTimeout(function(){Draggables._timeout=null;window.focus();Draggables.activeDraggable=A}.bind(this),A.options.delay)}else{window.focus();this.activeDraggable=A}},deactivate:function(){this.activeDraggable=null},updateDrag:function(A){if(!this.activeDraggable){return }var B=[Event.pointerX(A),Event.pointerY(A)];if(this._lastPointer&&(this._lastPointer.inspect()==B.inspect())){return }this._lastPointer=B;this.activeDraggable.updateDrag(A,B)},endDrag:function(A){if(this._timeout){clearTimeout(this._timeout);this._timeout=null}if(!this.activeDraggable){return }this._lastPointer=null;this.activeDraggable.endDrag(A);this.activeDraggable=null},keyPress:function(A){if(this.activeDraggable){this.activeDraggable.keyPress(A)}},addObserver:function(A){this.observers.push(A);this._cacheObserverCallbacks()},removeObserver:function(A){this.observers=this.observers.reject(function(B){return B.element==A});this._cacheObserverCallbacks()},notify:function(B,A,C){if(this[B+"Count"]>0){this.observers.each(function(D){if(D[B]){D[B](B,A,C)}})}if(A.options[B]){A.options[B](A,C)}},_cacheObserverCallbacks:function(){["onStart","onEnd","onDrag"].each(function(A){Draggables[A+"Count"]=Draggables.observers.select(function(B){return B[A]}).length})}};var Draggable=Class.create({initialize:function(B){var C={handle:false,reverteffect:function(F,E,D){var G=Math.sqrt(Math.abs(E^2)+Math.abs(D^2))*0.02;new Effect.Move(F,{x:-D,y:-E,duration:G,queue:{scope:"_draggable",position:"end"}})},endeffect:function(E){var D=Object.isNumber(E._opacity)?E._opacity:1;new Effect.Opacity(E,{duration:0.2,from:0.7,to:D,queue:{scope:"_draggable",position:"end"},afterFinish:function(){Draggable._dragging[E]=false}})},zindex:1000,revert:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,snap:false,delay:0};if(!arguments[1]||Object.isUndefined(arguments[1].endeffect)){Object.extend(C,{starteffect:function(D){D._opacity=Element.getOpacity(D);Draggable._dragging[D]=true;new Effect.Opacity(D,{duration:0.2,from:D._opacity,to:0.7})}})}var A=Object.extend(C,arguments[1]||{});this.element=$(B);if(A.handle&&Object.isString(A.handle)){this.handle=this.element.down("."+A.handle,0)}if(!this.handle){this.handle=$(A.handle)}if(!this.handle){this.handle=this.element}if(A.scroll&&!A.scroll.scrollTo&&!A.scroll.outerHTML){A.scroll=$(A.scroll);this._isScrollChild=Element.childOf(this.element,A.scroll)}Element.makePositioned(this.element);this.options=A;this.dragging=false;this.eventMouseDown=this.initDrag.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Draggables.register(this)},destroy:function(){Event.stopObserving(this.handle,"mousedown",this.eventMouseDown);Draggables.unregister(this)},currentDelta:function(){return([parseInt(Element.getStyle(this.element,"left")||"0"),parseInt(Element.getStyle(this.element,"top")||"0")])},initDrag:function(A){if(!Object.isUndefined(Draggable._dragging[this.element])&&Draggable._dragging[this.element]){return }if(Event.isLeftClick(A)){var C=Event.element(A);if((tag_name=C.tagName.toUpperCase())&&(tag_name=="INPUT"||tag_name=="SELECT"||tag_name=="OPTION"||tag_name=="BUTTON"||tag_name=="TEXTAREA")){return }var B=[Event.pointerX(A),Event.pointerY(A)];var D=Position.cumulativeOffset(this.element);this.offset=[0,1].map(function(E){return(B[E]-D[E])});Draggables.activate(this);Event.stop(A)}},startDrag:function(B){this.dragging=true;if(!this.delta){this.delta=this.currentDelta()}if(this.options.zindex){this.originalZ=parseInt(Element.getStyle(this.element,"z-index")||0);this.element.style.zIndex=this.options.zindex}if(this.options.ghosting){this._clone=this.element.cloneNode(true);this.element._originallyAbsolute=(this.element.getStyle("position")=="absolute");if(!this.element._originallyAbsolute){Position.absolutize(this.element)}this.element.parentNode.insertBefore(this._clone,this.element)}if(this.options.scroll){if(this.options.scroll==window){var A=this._getWindowScroll(this.options.scroll);this.originalScrollLeft=A.left;this.originalScrollTop=A.top}else{this.originalScrollLeft=this.options.scroll.scrollLeft;this.originalScrollTop=this.options.scroll.scrollTop}}Draggables.notify("onStart",this,B);if(this.options.starteffect){this.options.starteffect(this.element)}},updateDrag:function(event,pointer){if(!this.dragging){this.startDrag(event)}if(!this.options.quiet){Position.prepare();Droppables.show(pointer,this.element)}Draggables.notify("onDrag",this,event);this.draw(pointer);if(this.options.change){this.options.change(this)}if(this.options.scroll){this.stopScrolling();var p;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){p=[left,top,left+width,top+height]}}else{p=Position.page(this.options.scroll);p[0]+=this.options.scroll.scrollLeft+Position.deltaX;p[1]+=this.options.scroll.scrollTop+Position.deltaY;p.push(p[0]+this.options.scroll.offsetWidth);p.push(p[1]+this.options.scroll.offsetHeight)}var speed=[0,0];if(pointer[0]<(p[0]+this.options.scrollSensitivity)){speed[0]=pointer[0]-(p[0]+this.options.scrollSensitivity)}if(pointer[1]<(p[1]+this.options.scrollSensitivity)){speed[1]=pointer[1]-(p[1]+this.options.scrollSensitivity)}if(pointer[0]>(p[2]-this.options.scrollSensitivity)){speed[0]=pointer[0]-(p[2]-this.options.scrollSensitivity)}if(pointer[1]>(p[3]-this.options.scrollSensitivity)){speed[1]=pointer[1]-(p[3]-this.options.scrollSensitivity)}this.startScrolling(speed)}if(Prototype.Browser.WebKit){window.scrollBy(0,0)}Event.stop(event)},finishDrag:function(B,E){this.dragging=false;if(this.options.quiet){Position.prepare();var D=[Event.pointerX(B),Event.pointerY(B)];Droppables.show(D,this.element)}if(this.options.ghosting){if(!this.element._originallyAbsolute){Position.relativize(this.element)}delete this.element._originallyAbsolute;Element.remove(this._clone);this._clone=null}var F=false;if(E){F=Droppables.fire(B,this.element);if(!F){F=false}}if(F&&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(F==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 F=Position.cumulativeOffset(this.element);if(this.options.ghosting){var C=Position.realOffset(this.element);F[0]+=C[0]-Position.deltaX;F[1]+=C[1]-Position.deltaY}var E=this.currentDelta();F[0]-=E[0];F[1]-=E[1];if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){F[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;F[1]-=this.options.scroll.scrollTop-this.originalScrollTop}var D=[0,1].map(function(G){return(A[G]-F[G]-this.offset[G])}.bind(this));if(this.options.snap){if(Object.isFunction(this.options.snap)){D=this.options.snap(D[0],D[1],this)}else{if(Object.isArray(this.options.snap)){D=D.map(function(G,H){return(G/this.options.snap[H]).round()*this.options.snap[H]}.bind(this))}else{D=D.map(function(G){return(G/this.options.snap).round()*this.options.snap}.bind(this))}}}var B=this.element.style;if((!this.options.constraint)||(this.options.constraint=="horizontal")){B.left=D[0]+"px"}if((!this.options.constraint)||(this.options.constraint=="vertical")){B.top=D[1]+"px"}if(B.visibility=="hidden"){B.visibility=""}},stopScrolling:function(){if(this.scrollInterval){clearInterval(this.scrollInterval);this.scrollInterval=null;Draggables._lastScrollPointer=null}},startScrolling:function(A){if(!(A[0]||A[1])){return }this.scrollSpeed=[A[0]*this.options.scrollSpeed,A[1]*this.options.scrollSpeed];this.lastScrolled=new Date();this.scrollInterval=setInterval(this.scroll.bind(this),10)},scroll:function(){var current=new Date();var delta=current-this.lastScrolled;this.lastScrolled=current;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){if(this.scrollSpeed[0]||this.scrollSpeed[1]){var d=delta/1000;this.options.scroll.scrollTo(left+d*this.scrollSpeed[0],top+d*this.scrollSpeed[1])}}}else{this.options.scroll.scrollLeft+=this.scrollSpeed[0]*delta/1000;this.options.scroll.scrollTop+=this.scrollSpeed[1]*delta/1000}Position.prepare();Droppables.show(Draggables._lastPointer,this.element);Draggables.notify("onDrag",this);if(this._isScrollChild){Draggables._lastScrollPointer=Draggables._lastScrollPointer||$A(Draggables._lastPointer);Draggables._lastScrollPointer[0]+=this.scrollSpeed[0]*delta/1000;Draggables._lastScrollPointer[1]+=this.scrollSpeed[1]*delta/1000;if(Draggables._lastScrollPointer[0]<0){Draggables._lastScrollPointer[0]=0}if(Draggables._lastScrollPointer[1]<0){Draggables._lastScrollPointer[1]=0}this.draw(Draggables._lastScrollPointer)}if(this.options.change){this.options.change(this)}},_getWindowScroll:function(w){var T,L,W,H;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft}else{if(w.document.body){T=body.scrollTop;L=body.scrollLeft}}if(w.innerWidth){W=w.innerWidth;H=w.innerHeight}else{if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight}else{W=body.offsetWidth;H=body.offsetHeight}}}return{top:T,left:L,width:W,height:H}}});Draggable._dragging={};var SortableObserver=Class.create({initialize:function(B,A){this.element=$(B);this.observer=A;this.lastValue=Sortable.serialize(this.element)},onStart:function(){this.lastValue=Sortable.serialize(this.element)},onEnd:function(){Sortable.unmark();if(this.lastValue!=Sortable.serialize(this.element)){this.observer(this.element)}}});var Sortable={SERIALIZE_RULE:/^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,sortables:{},_findRootElement:function(A){while(A.tagName.toUpperCase()!="BODY"){if(A.id&&Sortable.sortables[A.id]){return A}A=A.parentNode}},options:function(A){A=Sortable._findRootElement($(A));if(!A){return }return Sortable.sortables[A.id]},destroy:function(A){var B=Sortable.options(A);if(B){Draggables.removeObserver(B.element);B.droppables.each(function(C){Droppables.remove(C)});B.draggables.invoke("destroy");delete Sortable.sortables[B.element.id]}},create:function(C){C=$(C);var B=Object.extend({element:C,tag:"li",dropOnEmpty:false,tree:false,treeTag:"ul",overlap:"vertical",constraint:"vertical",containment:C,handle:false,only:false,delay:0,hoverclass:null,ghosting:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,format:this.SERIALIZE_RULE,elements:false,handles:false,onChange:Prototype.emptyFunction,onUpdate:Prototype.emptyFunction},arguments[1]||{});this.destroy(C);var A={revert:true,quiet:B.quiet,scroll:B.scroll,scrollSpeed:B.scrollSpeed,scrollSensitivity:B.scrollSensitivity,delay:B.delay,ghosting:B.ghosting,constraint:B.constraint,handle:B.handle};if(B.starteffect){A.starteffect=B.starteffect}if(B.reverteffect){A.reverteffect=B.reverteffect}else{if(B.ghosting){A.reverteffect=function(F){F.style.top=0;F.style.left=0}}}if(B.endeffect){A.endeffect=B.endeffect}if(B.zindex){A.zindex=B.zindex}var D={overlap:B.overlap,containment:B.containment,tree:B.tree,hoverclass:B.hoverclass,onHover:Sortable.onHover};var E={onHover:Sortable.onEmptyHover,overlap:B.overlap,containment:B.containment,hoverclass:B.hoverclass};Element.cleanWhitespace(C);B.draggables=[];B.droppables=[];if(B.dropOnEmpty||B.tree){Droppables.add(C,E);B.droppables.push(C)}(B.elements||this.findElements(C,B)||[]).each(function(H,F){var G=B.handles?$(B.handles[F]):(B.handle?$(H).select("."+B.handle)[0]:H);B.draggables.push(new Draggable(H,Object.extend(A,{handle:G})));Droppables.add(H,D);if(B.tree){H.treeNode=C}B.droppables.push(H)});if(B.tree){(Sortable.findTreeElements(C,B)||[]).each(function(F){Droppables.add(F,E);F.treeNode=C;B.droppables.push(F)})}this.sortables[C.id]=B;Draggables.addObserver(new SortableObserver(C,B.onUpdate))},findElements:function(B,A){return Element.findChildren(B,A.only,A.tree?true:false,A.tag)},findTreeElements:function(B,A){return Element.findChildren(B,A.only,A.tree?true:false,A.treeTag)},onHover:function(E,D,A){if(Element.isParent(D,E)){return }if(A>0.33&&A<0.66&&Sortable.options(D).tree){return }else{if(A>0.5){Sortable.mark(D,"before");if(D.previousSibling!=E){var B=E.parentNode;E.style.visibility="hidden";D.parentNode.insertBefore(E,D);if(D.parentNode!=B){Sortable.options(B).onChange(E)}Sortable.options(D.parentNode).onChange(E)}}else{Sortable.mark(D,"after");var C=D.nextSibling||null;if(C!=E){var B=E.parentNode;E.style.visibility="hidden";D.parentNode.insertBefore(E,C);if(D.parentNode!=B){Sortable.options(B).onChange(E)}Sortable.options(D.parentNode).onChange(E)}}}},onEmptyHover:function(E,G,H){var I=E.parentNode;var A=Sortable.options(G);if(!Element.isParent(G,E)){var F;var C=Sortable.findElements(G,{tag:A.tag,only:A.only});var B=null;if(C){var D=Element.offsetSize(G,A.overlap)*(1-H);for(F=0;F<C.length;F+=1){if(D-Element.offsetSize(C[F],A.overlap)>=0){D-=Element.offsetSize(C[F],A.overlap)}else{if(D-(Element.offsetSize(C[F],A.overlap)/2)>=0){B=F+1<C.length?C[F+1]:null;break}else{B=C[F];break}}}}G.insertBefore(E,B);Sortable.options(I).onChange(E);A.onChange(E)}},unmark:function(){if(Sortable._marker){Sortable._marker.hide()}},mark:function(B,A){var D=Sortable.options(B.parentNode);if(D&&!D.ghosting){return }if(!Sortable._marker){Sortable._marker=($("dropmarker")||Element.extend(document.createElement("DIV"))).hide().addClassName("dropmarker").setStyle({position:"absolute"});document.getElementsByTagName("body").item(0).appendChild(Sortable._marker)}var C=Position.cumulativeOffset(B);Sortable._marker.setStyle({left:C[0]+"px",top:C[1]+"px"});if(A=="after"){if(D.overlap=="horizontal"){Sortable._marker.setStyle({left:(C[0]+B.clientWidth)+"px"})}else{Sortable._marker.setStyle({top:(C[1]+B.clientHeight)+"px"})}}Sortable._marker.show()},_tree:function(E,B,F){var D=Sortable.findElements(E,B)||[];for(var C=0;C<D.length;++C){var A=D[C].id.match(B.format);if(!A){continue}var G={id:encodeURIComponent(A?A[1]:null),element:E,parent:F,children:[],position:F.children.length,container:$(D[C]).down(B.treeTag)};if(G.container){this._tree(G.container,B,G)}F.children.push(G)}return F},tree:function(D){D=$(D);var C=this.options(D);var B=Object.extend({tag:C.tag,treeTag:C.treeTag,only:C.only,name:D.id,format:C.format},arguments[1]||{});var A={id:null,parent:null,children:[],container:D,position:0};return Sortable._tree(D,B,A)},_constructIndex:function(B){var A="";do{if(B.id){A="["+B.position+"]"+A}}while((B=B.parent)!=null);return A},sequence:function(B){B=$(B);var A=Object.extend(this.options(B),arguments[1]||{});return $(this.findElements(B,A)||[]).map(function(C){return C.id.match(A.format)?C.id.match(A.format)[1]:""})},setSequence:function(B,C){B=$(B);var A=Object.extend(this.options(B),arguments[2]||{});var D={};this.findElements(B,A).each(function(E){if(E.id.match(A.format)){D[E.id.match(A.format)[1]]=[E,E.parentNode]}E.parentNode.removeChild(E)});C.each(function(E){var F=D[E];if(F){F[1].appendChild(F[0]);delete D[E]}})},serialize:function(C){C=$(C);var B=Object.extend(Sortable.options(C),arguments[1]||{});var A=encodeURIComponent((arguments[1]&&arguments[1].name)?arguments[1].name:C.id);if(B.tree){return Sortable.tree(C,arguments[1]).children.map(function(D){return[A+Sortable._constructIndex(D)+"[id]="+encodeURIComponent(D.id)].concat(D.children.map(arguments.callee))}).flatten().join("&")}else{return Sortable.sequence(C,arguments[1]).map(function(D){return A+"[]="+encodeURIComponent(D)}).join("&")}}};Element.isParent=function(B,A){if(!B.parentNode||B==A){return false}if(B.parentNode==A){return true}return Element.isParent(B.parentNode,A)};Element.findChildren=function(D,B,A,C){if(!D.hasChildNodes()){return null}C=C.toUpperCase();if(B){B=[B].flatten()}var E=[];$A(D.childNodes).each(function(G){if(G.tagName&&G.tagName.toUpperCase()==C&&(!B||(Element.classNames(G).detect(function(H){return B.include(H)})))){E.push(G)}if(A){var F=Element.findChildren(G,B,A,C);if(F){E.push(F)}}});return(E.length>0?E.flatten():[])};Element.offsetSize=function(A,B){return A["offset"+((B=="vertical"||B=="height")?"Height":"Width")]};var OpenLayers={singleFile:true};(function(){var G=(typeof OpenLayers=="object"&&OpenLayers.singleFile);window.OpenLayers={_scriptName:(!G)?"lib/OpenLayers.js":"OpenLayers.js",_getScriptLocation:function(){var P="";var Q=OpenLayers._scriptName;var L=document.getElementsByTagName("script");for(var N=0,K=L.length;N<K;N++){var R=L[N].getAttribute("src");if(R){var M=R.lastIndexOf(Q);var O=R.lastIndexOf("?");if(O<0){O=R.length}if((M>-1)&&(M+Q.length==O)){P=R.slice(0,O-Q.length);break}}}return P}};if(!G){var H=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","Gears/gears_init.js","OpenLayers/Ajax.js","OpenLayers/Request.js","OpenLayers/Request/XMLHttpRequest.js","OpenLayers/Events.js","OpenLayers/Projection.js","OpenLayers/Map.js","OpenLayers/Layer.js","OpenLayers/Icon.js","OpenLayers/Marker.js","OpenLayers/Marker/Box.js","OpenLayers/Popup.js","OpenLayers/Tile.js","OpenLayers/Tile/Image.js","OpenLayers/Tile/WFS.js","OpenLayers/Layer/Image.js","OpenLayers/Layer/SphericalMercator.js","OpenLayers/Layer/EventPane.js","OpenLayers/Layer/FixedZoomLevels.js","OpenLayers/Layer/Google.js","OpenLayers/Layer/VirtualEarth.js","OpenLayers/Layer/Yahoo.js","OpenLayers/Layer/HTTPRequest.js","OpenLayers/Layer/Grid.js","OpenLayers/Layer/MapGuide.js","OpenLayers/Layer/MapServer.js","OpenLayers/Layer/MapServer/Untiled.js","OpenLayers/Layer/KaMap.js","OpenLayers/Layer/KaMapCache.js","OpenLayers/Layer/MultiMap.js","OpenLayers/Layer/Markers.js","OpenLayers/Layer/Text.js","OpenLayers/Layer/WorldWind.js","OpenLayers/Layer/WMS.js","OpenLayers/Layer/WMS/Untiled.js","OpenLayers/Layer/GeoRSS.js","OpenLayers/Layer/Boxes.js","OpenLayers/Layer/TMS.js","OpenLayers/Layer/TileCache.js","OpenLayers/Popup/Anchored.js","OpenLayers/Popup/AnchoredBubble.js","OpenLayers/Popup/Framed.js","OpenLayers/Popup/FramedCloud.js","OpenLayers/Feature.js","OpenLayers/Feature/Vector.js","OpenLayers/Feature/WFS.js","OpenLayers/Handler.js","OpenLayers/Handler/Click.js","OpenLayers/Handler/Hover.js","OpenLayers/Handler/Point.js","OpenLayers/Handler/Path.js","OpenLayers/Handler/Polygon.js","OpenLayers/Handler/Feature.js","OpenLayers/Handler/Drag.js","OpenLayers/Handler/RegularPolygon.js","OpenLayers/Handler/Box.js","OpenLayers/Handler/MouseWheel.js","OpenLayers/Handler/Keyboard.js","OpenLayers/Control.js","OpenLayers/Control/Attribution.js","OpenLayers/Control/Button.js","OpenLayers/Control/ZoomBox.js","OpenLayers/Control/ZoomToMaxExtent.js","OpenLayers/Control/DragPan.js","OpenLayers/Control/Navigation.js","OpenLayers/Control/MouseDefaults.js","OpenLayers/Control/MousePosition.js","OpenLayers/Control/OverviewMap.js","OpenLayers/Control/KeyboardDefaults.js","OpenLayers/Control/PanZoom.js","OpenLayers/Control/PanZoomBar.js","OpenLayers/Control/ArgParser.js","OpenLayers/Control/Permalink.js","OpenLayers/Control/Scale.js","OpenLayers/Control/ScaleLine.js","OpenLayers/Control/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/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/Strategy.js","OpenLayers/Strategy/Fixed.js","OpenLayers/Strategy/Cluster.js","OpenLayers/Strategy/Paging.js","OpenLayers/Strategy/BBOX.js","OpenLayers/Protocol.js","OpenLayers/Protocol/HTTP.js","OpenLayers/Protocol/SQL.js","OpenLayers/Protocol/SQL/Gears.js","OpenLayers/Layer/PointTrack.js","OpenLayers/Layer/GML.js","OpenLayers/Style.js","OpenLayers/StyleMap.js","OpenLayers/Rule.js","OpenLayers/Filter.js","OpenLayers/Filter/FeatureId.js","OpenLayers/Filter/Logical.js","OpenLayers/Filter/Comparison.js","OpenLayers/Filter/Spatial.js","OpenLayers/Format.js","OpenLayers/Format/XML.js","OpenLayers/Format/GML.js","OpenLayers/Format/GML/Base.js","OpenLayers/Format/GML/v2.js","OpenLayers/Format/GML/v3.js","OpenLayers/Format/KML.js","OpenLayers/Format/GeoRSS.js","OpenLayers/Format/WFS.js","OpenLayers/Format/WKT.js","OpenLayers/Format/OSM.js","OpenLayers/Format/GPX.js","OpenLayers/Format/SLD.js","OpenLayers/Format/SLD/v1.js","OpenLayers/Format/SLD/v1_0_0.js","OpenLayers/Format/SLD/v1.js","OpenLayers/Format/Filter.js","OpenLayers/Format/Filter/v1.js","OpenLayers/Format/Filter/v1_0_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/Layer/WFS.js","OpenLayers/Control/MouseToolbar.js","OpenLayers/Control/NavToolbar.js","OpenLayers/Control/PanPanel.js","OpenLayers/Control/Pan.js","OpenLayers/Control/ZoomIn.js","OpenLayers/Control/ZoomOut.js","OpenLayers/Control/ZoomPanel.js","OpenLayers/Control/EditingToolbar.js","OpenLayers/Lang.js","OpenLayers/Lang/en.js");var B=navigator.userAgent;var D=(B.match("MSIE")||B.match("Safari"));if(D){var A=new Array(H.length)}var I=OpenLayers._getScriptLocation()+"lib/";for(var C=0,F=H.length;C<F;C++){if(D){A[C]="<script src='"+I+H[C]+"'><\/script>"}else{var J=document.createElement("script");J.src=I+H[C];var E=document.getElementsByTagName("head").length?document.getElementsByTagName("head")[0]:document.body;E.appendChild(J)}}if(D){document.write(A.join(""))}}})();OpenLayers.VERSION_NUMBER="$Revision: 8012 $";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*$/,"$1")},camelize:function(F){var D=F.split("-");var B=D[0];for(var C=1,A=D.length;C<A;C++){var E=D[C];B+=E.charAt(0).toUpperCase()+E.substring(1)}return B},format:function(H,A,E){if(!A){A=window}var F=H.split("${");var I,G,B;for(var C=1,D=F.length;C<D;C++){I=F[C];G=I.indexOf("}");if(G>0){B=A[I.substring(0,G)];if(typeof B=="function"){B=E?B.apply(null,E):B()}F[C]=B+I.substring(++G)}else{F[C]="${"+I}}return F.join("")},numberRegEx:/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,isNumeric:function(A){return OpenLayers.String.numberRegEx.test(A)}};if(!String.prototype.startsWith){String.prototype.startsWith=function(A){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.String.startsWith"}));return OpenLayers.String.startsWith(this,A)}}if(!String.prototype.contains){String.prototype.contains=function(A){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.String.contains"}));return OpenLayers.String.contains(this,A)}}if(!String.prototype.trim){String.prototype.trim=function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.String.trim"}));return OpenLayers.String.trim(this)}}if(!String.prototype.camelize){String.prototype.camelize=function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.String.camelize"}));return OpenLayers.String.camelize(this)}}OpenLayers.Number={decimalSeparator:".",thousandsSeparator:",",limitSigDigs:function(A,C){var B=0;if(C>0){B=parseFloat(A.toPrecision(C))}return B},format:function(C,A,G,I){A=(typeof A!="undefined")?A:0;G=(typeof G!="undefined")?G:OpenLayers.Number.thousandsSeparator;I=(typeof I!="undefined")?I:OpenLayers.Number.decimalSeparator;if(A!=null){C=parseFloat(C.toFixed(A))}var B=C.toString().split(".");if(B.length==1&&A==null){A=0}var D=B[0];if(G){var E=/(-?[0-9]+)([0-9]{3})/;while(E.test(D)){D=D.replace(E,"$1"+G+"$2")}}var F;if(A==0){F=D}else{var H=B.length>1?B[1]:"0";if(A!=null){H=H+new Array(A-H.length+1).join("0")}F=D+I+H}return F}};if(!Number.prototype.limitSigDigs){Number.prototype.limitSigDigs=function(A){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Number.limitSigDigs"}));return OpenLayers.Number.limitSigDigs(this,A)}}OpenLayers.Function={bind:function(C,B){var A=Array.prototype.slice.apply(arguments,[2]);return function(){var D=A.concat(Array.prototype.slice.apply(arguments,[0]));return C.apply(B,D)}},bindAsEventListener:function(B,A){return function(C){return B.call(A,C||window.event)}}};if(!Function.prototype.bind){Function.prototype.bind=function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Function.bind"}));Array.prototype.unshift.apply(arguments,[this]);return OpenLayers.Function.bind.apply(null,arguments)}}if(!Function.prototype.bindAsEventListener){Function.prototype.bindAsEventListener=function(A){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Function.bindAsEventListener"}));return OpenLayers.Function.bindAsEventListener(this,A)}}OpenLayers.Array={filter:function(G,F,B){var D=[];if(Array.prototype.filter){D=G.filter(F,B)}else{var A=G.length;if(typeof F!="function"){throw new TypeError()}for(var C=0;C<A;C++){if(C in G){var E=G[C];if(F.call(B,E,C,G)){D.push(E)}}}}return D}};OpenLayers.Class=function(){var C=function(){if(arguments&&arguments[0]!=OpenLayers.Class.isPrototype){this.initialize.apply(this,arguments)}};var B={};var E;for(var D=0,A=arguments.length;D<A;++D){if(typeof arguments[D]=="function"){E=arguments[D].prototype}else{E=arguments[D]}OpenLayers.Util.extend(B,E)}C.prototype=B;return C};OpenLayers.Class.isPrototype=function(){};OpenLayers.Class.create=function(){return function(){if(arguments&&arguments[0]!=OpenLayers.Class.isPrototype){this.initialize.apply(this,arguments)}}};OpenLayers.Class.inherit=function(){var D=arguments[0];var E=new D(OpenLayers.Class.isPrototype);for(var C=1,A=arguments.length;C<A;C++){if(typeof arguments[C]=="function"){var B=arguments[C];arguments[C]=new B(OpenLayers.Class.isPrototype)}OpenLayers.Util.extend(E,arguments[C])}return E};OpenLayers.Util={};OpenLayers.Util.getElement=function(){var D=[];for(var C=0,A=arguments.length;C<A;C++){var B=arguments[C];if(typeof B=="string"){B=document.getElementById(B)}if(arguments.length==1){return B}D.push(B)}return D};if($==null){var $=OpenLayers.Util.getElement}OpenLayers.Util.extend=function(A,E){A=A||{};if(E){for(var D in E){var C=E[D];if(C!==undefined){A[D]=C}}var B=typeof window.Event=="function"&&E instanceof window.Event;if(!B&&E.hasOwnProperty&&E.hasOwnProperty("toString")){A.toString=E.toString}}return A};OpenLayers.Util.removeItem=function(C,B){for(var A=C.length-1;A>=0;A--){if(C[A]==B){C.splice(A,1)}}return C};OpenLayers.Util.clearArray=function(A){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"array = []"}));A.length=0};OpenLayers.Util.indexOf=function(D,C){for(var B=0,A=D.length;B<A;B++){if(D[B]==C){return B}}return -1};OpenLayers.Util.modifyDOMElement=function(E,H,D,F,A,C,G,B){if(H){E.id=H}if(D){E.style.left=D.x+"px";E.style.top=D.y+"px"}if(F){E.style.width=F.w+"px";E.style.height=F.h+"px"}if(A){E.style.position=A}if(C){E.style.border=C}if(G){E.style.overflow=G}if(parseFloat(B)>=0&&parseFloat(B)<1){E.style.filter="alpha(opacity="+(B*100)+")";E.style.opacity=B}else{if(parseFloat(B)==1){E.style.filter="";E.style.opacity=""}}};OpenLayers.Util.createDiv=function(A,I,H,F,E,C,B,G){var D=document.createElement("div");if(F){D.style.backgroundImage="url("+F+")"}if(!A){A=OpenLayers.Util.createUniqueID("OpenLayersDiv")}if(!E){E="absolute"}OpenLayers.Util.modifyDOMElement(D,A,I,H,E,C,B,G);return D};OpenLayers.Util.createImage=function(A,H,G,E,D,C,F,I){var B=document.createElement("img");if(!A){A=OpenLayers.Util.createUniqueID("OpenLayersDiv")}if(!D){D="relative"}OpenLayers.Util.modifyDOMElement(B,A,H,G,D,C,null,F);if(I){B.style.display="none";OpenLayers.Event.observe(B,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,B));OpenLayers.Event.observe(B,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,B))}B.style.alt=A;B.galleryImg="no";if(E){B.src=E}return B};OpenLayers.Util.setOpacity=function(B,A){OpenLayers.Util.modifyDOMElement(B,null,null,null,null,null,null,A)};OpenLayers.Util.onImageLoad=function(){if(!this.viewRequestID||(this.map&&this.viewRequestID==this.map.viewRequestID)){this.style.backgroundColor=null;this.style.display=""}};OpenLayers.Util.onImageLoadErrorColor="pink";OpenLayers.IMAGE_RELOAD_ATTEMPTS=0;OpenLayers.Util.onImageLoadError=function(){this._attempts=(this._attempts)?(this._attempts+1):1;if(this._attempts<=OpenLayers.IMAGE_RELOAD_ATTEMPTS){var D=this.urls;if(D&&D instanceof Array&&D.length>1){var E=this.src.toString();var C,A;for(A=0;C=D[A];A++){if(E.indexOf(C)!=-1){break}}var F=Math.floor(D.length*Math.random());var B=D[F];A=0;while(B==C&&A++<4){F=Math.floor(D.length*Math.random());B=D[F]}this.src=E.replace(C,B)}else{this.src=this.src}}else{this.style.backgroundColor=OpenLayers.Util.onImageLoadErrorColor}this.style.display=""};OpenLayers.Util.alphaHack=function(){var D=navigator.appVersion.split("MSIE");var A=parseFloat(D[1]);var B=false;try{B=!!(document.body.filters)}catch(C){}return(B&&(A>=5.5)&&(A<7))};OpenLayers.Util.modifyAlphaImageDiv=function(A,B,J,I,G,F,C,D,H){OpenLayers.Util.modifyDOMElement(A,B,J,I,F,null,null,H);var E=A.childNodes[0];if(G){E.src=G}OpenLayers.Util.modifyDOMElement(E,A.id+"_innerImage",null,I,"relative",C);if(OpenLayers.Util.alphaHack()){if(A.style.display!="none"){A.style.display="inline-block"}if(D==null){D="scale"}A.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+E.src+"', sizingMethod='"+D+"')";if(parseFloat(A.style.opacity)>=0&&parseFloat(A.style.opacity)<1){A.style.filter+=" alpha(opacity="+A.style.opacity*100+")"}E.style.filter="alpha(opacity=0)"}};OpenLayers.Util.modifyCssSpriteDiv=function(A,B,I,H,F,E,C,D,G){OpenLayers.Util.modifyDOMElement(A,B,I,H,E,null,null,G);if(F){$(A).addClassName(F)}};OpenLayers.Util.createAlphaImageDiv=function(B,J,I,G,F,C,D,H,K){var A=OpenLayers.Util.createDiv();var E=OpenLayers.Util.createImage(null,null,null,null,null,null,null,false);A.appendChild(E);if(K){E.style.display="none";OpenLayers.Event.observe(E,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,A));OpenLayers.Event.observe(E,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,A))}OpenLayers.Util.modifyAlphaImageDiv(A,B,J,I,G,F,C,D,H);return A};OpenLayers.Util.createCssSpriteDiv=function(B,I,H,F,E,C,D,G,J){var A=OpenLayers.Util.createDiv();OpenLayers.Util.modifyCssSpriteDiv(A,B,I,H,F,E,C,D,G);return A};OpenLayers.Util.upperCaseObject=function(B){var A={};for(var C in B){A[C.toUpperCase()]=B[C]}return A};OpenLayers.Util.applyDefaults=function(D,C){D=D||{};var B=typeof window.Event=="function"&&C instanceof window.Event;for(var A in C){if(D[A]===undefined||(!B&&C.hasOwnProperty&&C.hasOwnProperty(A)&&!D.hasOwnProperty(A))){D[A]=C[A]}}if(!B&&C&&C.hasOwnProperty&&C.hasOwnProperty("toString")&&!D.hasOwnProperty("toString")){D.toString=C.toString}return D};OpenLayers.Util.getParameterString=function(H){var G=[];for(var C in H){var E=H[C];if((E!=null)&&(typeof E!="function")){var B;if(typeof E=="object"&&E.constructor==Array){var F=[];for(var D=0,A=E.length;D<A;D++){F.push(encodeURIComponent(E[D]))}B=F.join(",")}else{B=encodeURIComponent(E)}G.push(encodeURIComponent(C)+"="+B)}}return G.join("&")};OpenLayers.ImgPath="";OpenLayers.Util.getImagesLocation=function(){return OpenLayers.ImgPath||(OpenLayers._getScriptLocation()+"img/")};OpenLayers.Util.Try=function(){var D=null;for(var C=0,A=arguments.length;C<A;C++){var B=arguments[C];try{D=B();break}catch(E){}}return D};OpenLayers.Util.getNodes=function(C,B){var A=OpenLayers.Util.Try(function(){return OpenLayers.Util._getNodes(C.documentElement.childNodes,B)},function(){return OpenLayers.Util._getNodes(C.childNodes,B)});return A};OpenLayers.Util._getNodes=function(C,E){var B=[];for(var D=0,A=C.length;D<A;D++){if(C[D].nodeName==E){B.push(C[D])}}return B};OpenLayers.Util.getTagText=function(C,D,B){var A=OpenLayers.Util.getNodes(C,D);if(A&&(A.length>0)){if(!B){B=0}if(A[B].childNodes.length>1){return A.childNodes[1].nodeValue}else{if(A[B].childNodes.length==1){return A[B].firstChild.nodeValue}}}else{return""}};OpenLayers.Util.getXmlNodeValue=function(A){var B=null;OpenLayers.Util.Try(function(){B=A.text;if(!B){B=A.textContent}if(!B){B=A.firstChild.nodeValue}},function(){B=A.textContent});return B};OpenLayers.Util.mouseLeft=function(A,C){var B=(A.relatedTarget)?A.relatedTarget:A.toElement;while(B!=C&&B!=null){B=B.parentNode}return(B!=C)};OpenLayers.Util.rad=function(A){return A*Math.PI/180};OpenLayers.Util.distVincenty=function(F,D){var m=6378137,l=6356752.3142,e=1/298.257223563;var M=OpenLayers.Util.rad(D.lon-F.lon);var k=Math.atan((1-e)*Math.tan(OpenLayers.Util.rad(F.lat)));var h=Math.atan((1-e)*Math.tan(OpenLayers.Util.rad(D.lat)));var K=Math.sin(k),H=Math.cos(k);var J=Math.sin(h),G=Math.cos(h);var Q=M,N=2*Math.PI;var P=20;while(Math.abs(Q-N)>1e-12&&--P>0){var X=Math.sin(Q),E=Math.cos(Q);var n=Math.sqrt((G*X)*(G*X)+(H*J-K*G*E)*(H*J-K*G*E));if(n==0){return 0}var Z=K*J+H*G*E;var W=Math.atan2(n,Z);var I=Math.asin(H*G*X/n);var c=Math.cos(I)*Math.cos(I);var O=Z-2*K*J/c;var T=e/16*c*(4+e*(4-3*c));N=Q;Q=M+(1-T)*e*Math.sin(I)*(W+T*n*(O+T*Z*(-1+2*O*O)))}if(P==0){return NaN}var S=c*(m*m-l*l)/(l*l);var V=1+S/16384*(4096+S*(-768+S*(320-175*S)));var U=S/1024*(256+S*(-128+S*(74-47*S)));var Y=U*n*(O+U/4*(Z*(-1+2*O*O)-U/6*O*(-3+4*n*n)*(-3+4*O*O)));var R=l*V*(W-Y);var g=R.toFixed(3)/1000;return g};OpenLayers.Util.getParameters=function(B){B=B||window.location.href;var A="";if(OpenLayers.String.contains(B,"?")){var C=B.indexOf("?")+1;var E=OpenLayers.String.contains(B,"#")?B.indexOf("#"):B.length;A=B.substring(C,E)}var M={};var D=A.split(/[&;]/);for(var H=0,I=D.length;H<I;++H){var G=D[H].split("=");if(G[0]){var K=decodeURIComponent(G[0]);var J=G[1]||"";J=J.split(",");for(var F=0,L=J.length;F<L;F++){J[F]=decodeURIComponent(J[F])}if(J.length==1){J=J[0]}M[K]=J}}return M};OpenLayers.Util.getArgs=function(A){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Util.getParameters"}));return OpenLayers.Util.getParameters(A)};OpenLayers.Util.lastSeqID=0;OpenLayers.Util.createUniqueID=function(A){if(A==null){A="id_"}OpenLayers.Util.lastSeqID+=1;return A+OpenLayers.Util.lastSeqID};OpenLayers.INCHES_PER_UNIT={inches:1,ft:12,mi:63360,m:39.3701,km:39370.1,dd:4374754,yd:36};OpenLayers.INCHES_PER_UNIT["in"]=OpenLayers.INCHES_PER_UNIT.inches;OpenLayers.INCHES_PER_UNIT.degrees=OpenLayers.INCHES_PER_UNIT.dd;OpenLayers.INCHES_PER_UNIT.nmi=1852*OpenLayers.INCHES_PER_UNIT.m;OpenLayers.DOTS_PER_INCH=72;OpenLayers.Util.normalizeScale=function(B){var A=(B>1)?(1/B):B;return A};OpenLayers.Util.getResolutionFromScale=function(D,A){if(A==null){A="degrees"}var C=OpenLayers.Util.normalizeScale(D);var B=1/(C*OpenLayers.INCHES_PER_UNIT[A]*OpenLayers.DOTS_PER_INCH);return B};OpenLayers.Util.getScaleFromResolution=function(B,A){if(A==null){A="degrees"}var C=B*OpenLayers.INCHES_PER_UNIT[A]*OpenLayers.DOTS_PER_INCH;return C};OpenLayers.Util.safeStopPropagation=function(A){OpenLayers.Event.stop(A,true)};OpenLayers.Util.pagePosition=function(E){var A=0,D=0;var B=E;var F=E;while(B){if(B==document.body){if(OpenLayers.Element.getStyle(F,"position")=="absolute"){break}}A+=B.offsetTop||0;D+=B.offsetLeft||0;F=B;try{B=B.offsetParent}catch(C){OpenLayers.Console.error(OpenLayers.i18n("pagePositionFailed",{elemId:B.id}));break}}B=E;while(B){A-=B.scrollTop||0;D-=B.scrollLeft||0;B=B.parentNode}return[D,A]};OpenLayers.Util.isEquivalentUrl=function(H,G,C){C=C||{};OpenLayers.Util.applyDefaults(C,{ignoreCase:true,ignorePort80:true,ignoreHash:true});var B=OpenLayers.Util.createUrlObject(H,C);var A=OpenLayers.Util.createUrlObject(G,C);for(var D in B){if(C.test){OpenLayers.Console.userError(D+"\n1:"+B[D]+"\n2:"+A[D])}var F=B[D];var E=A[D];switch(D){case"args":break;case"host":case"port":case"protocol":if((F=="")||(E=="")){break}default:if((D!="args")&&(B[D]!=A[D])){return false}break}}for(var D in B.args){if(B.args[D]!=A.args[D]){return false}delete A.args[D]}for(var D in A.args){return false}return true};OpenLayers.Util.createUrlObject=function(E,C){C=C||{};var Q={};if(C.ignoreCase){E=E.toLowerCase()}var S=document.createElement("a");S.href=E;Q.host=S.host;var J=S.port;if(J.length<=0){var N=Q.host.length-(J.length);Q.host=Q.host.substring(0,N)}Q.protocol=S.protocol;Q.port=((J=="80")&&(C.ignorePort80))?"":J;Q.hash=(C.ignoreHash)?"":S.hash;var B=S.search;if(!B){var H=E.indexOf("?");B=(H!=-1)?E.substr(H):""}Q.args=OpenLayers.Util.getParameters(B);if(((Q.protocol=="file:")&&(E.indexOf("file:")!=-1))||((Q.protocol!="file:")&&(Q.host!=""))){Q.pathname=S.pathname;var K=Q.pathname.indexOf("?");if(K!=-1){Q.pathname=Q.pathname.substring(0,K)}}else{var I=OpenLayers.Util.removeTail(E);var P=0;do{var F=I.indexOf("../");if(F==0){P++;I=I.substr(3)}else{if(F>=0){var L=I.substr(0,F-1);var O=L.indexOf("/");L=(O!=-1)?L.substr(0,O+1):"";var R=I.substr(F+3);I=L+R}}}while(F!=-1);var D=document.createElement("a");var M=window.location.href;if(C.ignoreCase){M=M.toLowerCase()}D.href=M;Q.protocol=D.protocol;var A=(D.pathname.indexOf("/")!=-1)?"/":"\\";var G=D.pathname.split(A);G.pop();while((P>0)&&(G.length>0)){G.pop();P--}I=G.join("/")+"/"+I;Q.pathname=I}if((Q.protocol=="file:")||(Q.protocol=="")){Q.host="localhost"}return Q};OpenLayers.Util.removeTail=function(B){var C=null;var A=B.indexOf("?");var D=B.indexOf("#");if(A==-1){C=(D!=-1)?B.substr(0,D):B}else{C=(D!=-1)?B.substr(0,Math.min(A,D)):B.substr(0,A)}return C};OpenLayers.Util.getBrowserName=function(){var B="";var A=navigator.userAgent.toLowerCase();if(A.indexOf("opera")!=-1){B="opera"}else{if(A.indexOf("msie")!=-1){B="msie"}else{if(A.indexOf("safari")!=-1){B="safari"}else{if(A.indexOf("mozilla")!=-1){if(A.indexOf("firefox")!=-1){B="firefox"}else{B="mozilla"}}}}}return B};OpenLayers.Util.getRenderedDimensions=function(G,D,C){var B,E;var A=document.createElement("div");A.style.overflow="";A.style.position="absolute";A.style.left="-9999px";if(D){if(D.w){B=D.w;A.style.width=B+"px"}else{if(D.h){E=D.h;A.style.height=E+"px"}}}if(C&&C.displayClass){A.className=C.displayClass}var F=document.createElement("div");F.innerHTML=G;A.appendChild(F);document.body.appendChild(A);if(!B){B=parseInt(F.scrollWidth);A.style.width=B+"px"}if(!E){E=parseInt(F.scrollHeight)}A.removeChild(F);document.body.removeChild(A);return new OpenLayers.Size(B,E)};OpenLayers.Util.getScrollbarWidth=function(){var C=OpenLayers.Util._scrollbarWidth;if(C==null){var E=null;var D=null;var A=0;var B=0;E=document.createElement("div");E.style.position="absolute";E.style.top="-1000px";E.style.left="-1000px";E.style.width="100px";E.style.height="50px";E.style.overflow="hidden";D=document.createElement("div");D.style.width="100%";D.style.height="200px";E.appendChild(D);document.body.appendChild(E);A=D.offsetWidth;E.style.overflow="scroll";B=D.offsetWidth;document.body.removeChild(document.body.lastChild);OpenLayers.Util._scrollbarWidth=(A-B);C=OpenLayers.Util._scrollbarWidth}return C};OpenLayers.Rico=new Object();OpenLayers.Rico.Corner={round:function(D,B){D=OpenLayers.Util.getElement(D);this._setOptions(B);var A=this.options.color;if(this.options.color=="fromElement"){A=this._background(D)}var C=this.options.bgColor;if(this.options.bgColor=="fromParent"){C=this._background(D.offsetParent)}this._roundCornersImpl(D,A,C)},changeColor:function(C,B){C.style.backgroundColor=B;var A=C.parentNode.getElementsByTagName("span");for(var D=0;D<A.length;D++){A[D].style.backgroundColor=B}},changeOpacity:function(C,F){var D=F;var A="alpha(opacity="+F*100+")";C.style.opacity=D;C.style.filter=A;var B=C.parentNode.getElementsByTagName("span");for(var E=0;E<B.length;E++){B[E].style.opacity=D;B[E].style.filter=A}},reRound:function(D,C){var B=D.parentNode.childNodes[0];var A=D.parentNode.childNodes[2];D.parentNode.removeChild(B);D.parentNode.removeChild(A);this.round(D.parentNode,C)},_roundCornersImpl:function(C,A,B){if(this.options.border){this._renderBorder(C,B)}if(this._isTopRounded()){this._roundTopCorners(C,A,B)}if(this._isBottomRounded()){this._roundBottomCorners(C,A,B)}},_renderBorder:function(D,E){var B="1px solid "+this._borderColor(E);var A="border-left: "+B;var F="border-right: "+B;var C="style='"+A+";"+F+"'";D.innerHTML="<div "+C+">"+D.innerHTML+"</div>"},_roundTopCorners:function(C,A,E){var D=this._createCorner(E);for(var B=0;B<this.options.numSlices;B++){D.appendChild(this._createCornerSlice(A,E,B,"top"))}C.style.paddingTop=0;C.insertBefore(D,C.firstChild)},_roundBottomCorners:function(C,A,E){var D=this._createCorner(E);for(var B=(this.options.numSlices-1);B>=0;B--){D.appendChild(this._createCornerSlice(A,E,B,"bottom"))}C.style.paddingBottom=0;C.appendChild(D)},_createCorner:function(B){var A=document.createElement("div");A.style.backgroundColor=(this._isTransparent()?"transparent":B);return A},_createCornerSlice:function(C,D,G,A){var E=document.createElement("span");var B=E.style;B.backgroundColor=C;B.display="block";B.height="1px";B.overflow="hidden";B.fontSize="1px";var F=this._borderColor(C,D);if(this.options.border&&G==0){B.borderTopStyle="solid";B.borderTopWidth="1px";B.borderLeftWidth="0px";B.borderRightWidth="0px";B.borderBottomWidth="0px";B.height="0px";B.borderColor=F}else{if(F){B.borderColor=F;B.borderStyle="solid";B.borderWidth="0px 1px"}}if(!this.options.compact&&(G==(this.options.numSlices-1))){B.height="2px"}this._setMargin(E,G,A);this._setBorder(E,G,A);return E},_setOptions:function(A){this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:true,border:false,compact:false};OpenLayers.Util.extend(this.options,A||{});this.options.numSlices=this.options.compact?2:4;if(this._isTransparent()){this.options.blend=false}},_whichSideTop:function(){if(this._hasString(this.options.corners,"all","top")){return""}if(this.options.corners.indexOf("tl")>=0&&this.options.corners.indexOf("tr")>=0){return""}if(this.options.corners.indexOf("tl")>=0){return"left"}else{if(this.options.corners.indexOf("tr")>=0){return"right"}}return""},_whichSideBottom:function(){if(this._hasString(this.options.corners,"all","bottom")){return""}if(this.options.corners.indexOf("bl")>=0&&this.options.corners.indexOf("br")>=0){return""}if(this.options.corners.indexOf("bl")>=0){return"left"}else{if(this.options.corners.indexOf("br")>=0){return"right"}}return""},_borderColor:function(A,B){if(A=="transparent"){return B}else{if(this.options.border){return this.options.border}else{if(this.options.blend){return this._blend(B,A)}else{return""}}}},_setMargin:function(D,E,B){var C=this._marginSize(E);var A=B=="top"?this._whichSideTop():this._whichSideBottom();if(A=="left"){D.style.marginLeft=C+"px";D.style.marginRight="0px"}else{if(A=="right"){D.style.marginRight=C+"px";D.style.marginLeft="0px"}else{D.style.marginLeft=C+"px";D.style.marginRight=C+"px"}}},_setBorder:function(D,E,B){var C=this._borderSize(E);var A=B=="top"?this._whichSideTop():this._whichSideBottom();if(A=="left"){D.style.borderLeftWidth=C+"px";D.style.borderRightWidth="0px"}else{if(A=="right"){D.style.borderRightWidth=C+"px";D.style.borderLeftWidth="0px"}else{D.style.borderLeftWidth=C+"px";D.style.borderRightWidth=C+"px"}}if(this.options.border!=false){D.style.borderLeftWidth=C+"px";D.style.borderRightWidth=C+"px"}},_marginSize:function(E){if(this._isTransparent()){return 0}var D=[5,3,2,1];var A=[3,2,1,0];var C=[2,1];var B=[1,0];if(this.options.compact&&this.options.blend){return B[E]}else{if(this.options.compact){return C[E]}else{if(this.options.blend){return A[E]}else{return D[E]}}}},_borderSize:function(E){var D=[5,3,2,1];var B=[2,1,1,1];var A=[1,0];var C=[0,2,0,0];if(this.options.compact&&(this.options.blend||this._isTransparent())){return 1}else{if(this.options.compact){return A[E]}else{if(this.options.blend){return B[E]}else{if(this.options.border){return C[E]}else{if(this._isTransparent()){return D[E]}}}}}return 0},_hasString:function(B){for(var A=1;A<arguments.length;A++){if(B.indexOf(arguments[A])>=0){return true}}return false},_blend:function(C,A){var B=OpenLayers.Rico.Color.createFromHex(C);B.blend(OpenLayers.Rico.Color.createFromHex(A));return B},_background:function(A){try{return OpenLayers.Rico.Color.createColorFromBackground(A).asHex()}catch(B){return"#ffffff"}},_isTransparent:function(){return this.options.color=="transparent"},_isTopRounded:function(){return this._hasString(this.options.corners,"all","top","tl","tr")},_isBottomRounded:function(){return this._hasString(this.options.corners,"all","bottom","bl","br")},_hasSingleTextChild:function(A){return A.childNodes.length==1&&A.childNodes[0].nodeType==3}};OpenLayers.Bounds=OpenLayers.Class({left:null,bottom:null,right:null,top:null,initialize:function(D,A,B,C){if(D!=null){this.left=parseFloat(D)}if(A!=null){this.bottom=parseFloat(A)}if(B!=null){this.right=parseFloat(B)}if(C!=null){this.top=parseFloat(C)}},clone:function(){return new OpenLayers.Bounds(this.left,this.bottom,this.right,this.top)},equals:function(B){var A=false;if(B!=null){A=((this.left==B.left)&&(this.right==B.right)&&(this.top==B.top)&&(this.bottom==B.bottom))}return A},toString:function(){return("left-bottom=("+this.left+","+this.bottom+") right-top=("+this.right+","+this.top+")")},toArray:function(){return[this.left,this.bottom,this.right,this.top]},toBBOX:function(A){if(A==null){A=6}var B=Math.pow(10,A);var C=Math.round(this.left*B)/B+","+Math.round(this.bottom*B)/B+","+Math.round(this.right*B)/B+","+Math.round(this.top*B)/B;return C},toGeometry:function(){return new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(this.left,this.bottom),new OpenLayers.Geometry.Point(this.right,this.bottom),new OpenLayers.Geometry.Point(this.right,this.top),new OpenLayers.Geometry.Point(this.left,this.top)])])},getWidth:function(){return(this.right-this.left)},getHeight:function(){return(this.top-this.bottom)},getSize:function(){return new OpenLayers.Size(this.getWidth(),this.getHeight())},getCenterPixel:function(){return new OpenLayers.Pixel((this.left+this.right)/2,(this.bottom+this.top)/2)},getCenterLonLat:function(){return new OpenLayers.LonLat((this.left+this.right)/2,(this.bottom+this.top)/2)},scale:function(F,H){if(H==null){H=this.getCenterLonLat()}var A=[];var E,D;if(H.CLASS_NAME=="OpenLayers.LonLat"){E=H.lon;D=H.lat}else{E=H.x;D=H.y}var C=(this.left-E)*F+E;var B=(this.bottom-D)*F+D;var I=(this.right-E)*F+E;var G=(this.top-D)*F+D;return new OpenLayers.Bounds(C,B,I,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){if((this.left==null)||(B.left<this.left)){this.left=B.left}if((this.bottom==null)||(B.bottom<this.bottom)){this.bottom=B.bottom}if((this.right==null)||(B.right>this.right)){this.right=B.right}if((this.top==null)||(B.top>this.top)){this.top=B.top}}}},containsLonLat:function(B,A){return this.contains(B.lon,B.lat,A)},containsPixel:function(B,A){return this.contains(B.x,B.y,A)},contains:function(B,D,A){if(A==null){A=true}var C=false;if(A){C=((B>=this.left)&&(B<=this.right)&&(D>=this.bottom)&&(D<=this.top))}else{C=((B>this.left)&&(B<this.right)&&(D>this.bottom)&&(D<this.top))}return C},intersectsBounds:function(D,B){if(B==null){B=true}var F=(D.bottom==this.bottom&&D.top==this.top)?true:(((D.bottom>this.bottom)&&(D.bottom<this.top))||((this.bottom>D.bottom)&&(this.bottom<D.top)));var E=(D.bottom==this.bottom&&D.top==this.top)?true:(((D.top>this.bottom)&&(D.top<this.top))||((this.top>D.bottom)&&(this.top<D.top)));var A=(D.right==this.right&&D.left==this.left)?true:(((D.right>this.left)&&(D.right<this.right))||((this.right>D.left)&&(this.right<D.right)));var C=(D.right==this.right&&D.left==this.left)?true:(((D.left>this.left)&&(D.left<this.right))||((this.left>D.left)&&(this.left<D.right)));return(this.containsBounds(D,true,B)||D.containsBounds(this,true,B)||((E||F)&&(C||A)))},containsBounds:function(E,D,B){if(D==null){D=false}if(B==null){B=true}var C;var G;var A;var F;if(B){C=(E.left>=this.left)&&(E.left<=this.right);G=(E.top>=this.bottom)&&(E.top<=this.top);A=(E.right>=this.left)&&(E.right<=this.right);F=(E.bottom>=this.bottom)&&(E.bottom<=this.top)}else{C=(E.left>this.left)&&(E.left<this.right);G=(E.top>this.bottom)&&(E.top<this.top);A=(E.right>this.left)&&(E.right<this.right);F=(E.bottom>this.bottom)&&(E.bottom<this.top)}return(D)?(G||F)&&(C||A):(G&&C&&F&&A)},determineQuadrant:function(C){var B="";var A=this.getCenterLonLat();B+=(C.lat<A.lat)?"b":"t";B+=(C.lon<A.lon)?"l":"r";return B},transform:function(D,B){var E=OpenLayers.Projection.transform({x:this.left,y:this.bottom},D,B);var A=OpenLayers.Projection.transform({x:this.right,y:this.bottom},D,B);var C=OpenLayers.Projection.transform({x:this.left,y:this.top},D,B);var F=OpenLayers.Projection.transform({x:this.right,y:this.top},D,B);this.left=Math.min(E.x,C.x);this.bottom=Math.min(E.y,A.y);this.right=Math.max(A.x,F.x);this.top=Math.max(C.y,F.y);return this},wrapDateLine:function(A,C){C=C||{};var D=C.leftTolerance||0;var B=C.rightTolerance||0;var E=this.clone();if(A){while(E.left<A.left&&(E.right-B)<=A.left){E=E.add(A.getWidth(),0)}while((E.left+D)>=A.right&&E.right>A.right){E=E.add(-A.getWidth(),0)}}return E},CLASS_NAME:"OpenLayers.Bounds"});OpenLayers.Bounds.fromString=function(B){var A=B.split(",");return OpenLayers.Bounds.fromArray(A)};OpenLayers.Bounds.fromArray=function(A){return new OpenLayers.Bounds(parseFloat(A[0]),parseFloat(A[1]),parseFloat(A[2]),parseFloat(A[3]))};OpenLayers.Bounds.fromSize=function(A){return new OpenLayers.Bounds(0,A.h,A.w,0)};OpenLayers.Bounds.oppositeQuadrant=function(A){var B="";B+=(A.charAt(0)=="t")?"b":"t";B+=(A.charAt(1)=="l")?"r":"l";return B};OpenLayers.Element={visible:function(A){return OpenLayers.Util.getElement(A).style.display!="none"},toggle:function(){for(var C=0,A=arguments.length;C<A;C++){var B=OpenLayers.Util.getElement(arguments[C]);var D=OpenLayers.Element.visible(B)?"hide":"show";OpenLayers.Element[D](B)}},hide:function(){for(var C=0,A=arguments.length;C<A;C++){var B=OpenLayers.Util.getElement(arguments[C]);B.style.display="none"}},show:function(){for(var C=0,A=arguments.length;C<A;C++){var B=OpenLayers.Util.getElement(arguments[C]);B.style.display=""}},remove:function(A){A=OpenLayers.Util.getElement(A);A.parentNode.removeChild(A)},getHeight:function(A){A=OpenLayers.Util.getElement(A);return A.offsetHeight},getDimensions:function(B){B=OpenLayers.Util.getElement(B);if(OpenLayers.Element.getStyle(B,"display")!="none"){return{width:B.offsetWidth,height:B.offsetHeight}}var A=B.style;var E=A.visibility;var C=A.position;A.visibility="hidden";A.position="absolute";A.display="";var F=B.clientWidth;var D=B.clientHeight;A.display="none";A.position=C;A.visibility=E;return{width:F,height:D}},hasClass:function(B,A){var C=B.className;return(!!C&&new RegExp("(^|\\s)"+A+"(\\s|$)").test(C))},addClass:function(B,A){if(!OpenLayers.Element.hasClass(B,A)){B.className+=(B.className?" ":"")+A}return B},removeClass:function(B,A){var C=B.className;if(C){B.className=OpenLayers.String.trim(C.replace(new RegExp("(^|\\s+)"+A+"(\\s+|$)")," "))}return B},toggleClass:function(B,A){if(OpenLayers.Element.hasClass(B,A)){OpenLayers.Element.removeClass(B,A)}else{OpenLayers.Element.addClass(B,A)}return B},getStyle:function(C,D){C=OpenLayers.Util.getElement(C);var E=null;if(C&&C.style){E=C.style[OpenLayers.String.camelize(D)];if(!E){if(document.defaultView&&document.defaultView.getComputedStyle){var B=document.defaultView.getComputedStyle(C,null);E=B?B.getPropertyValue(D):null}else{if(C.currentStyle){E=C.currentStyle[OpenLayers.String.camelize(D)]}}}var A=["left","top","right","bottom"];if(window.opera&&(OpenLayers.Util.indexOf(A,D)!=-1)&&(OpenLayers.Element.getStyle(C,"position")=="static")){E="auto"}}return E=="auto"?null:E}};OpenLayers.LonLat=OpenLayers.Class({lon:0,lat:0,initialize:function(B,A){this.lon=parseFloat(B);this.lat=parseFloat(A)},toString:function(){return("lon="+this.lon+",lat="+this.lat)},toShortString:function(){return(this.lon+", "+this.lat)},clone:function(){return new OpenLayers.LonLat(this.lon,this.lat)},add:function(C,A){if((C==null)||(A==null)){var B=OpenLayers.i18n("lonlatAddError");OpenLayers.Console.error(B);return null}return new OpenLayers.LonLat(this.lon+C,this.lat+A)},equals:function(B){var A=false;if(B!=null){A=((this.lon==B.lon&&this.lat==B.lat)||(isNaN(this.lon)&&isNaN(this.lat)&&isNaN(B.lon)&&isNaN(B.lat)))}return A},transform:function(C,B){var A=OpenLayers.Projection.transform({x:this.lon,y:this.lat},C,B);this.lon=A.x;this.lat=A.y;return this},wrapDateLine:function(A){var B=this.clone();if(A){while(B.lon<A.left){B.lon+=A.getWidth()}while(B.lon>A.right){B.lon-=A.getWidth()}}return B},CLASS_NAME:"OpenLayers.LonLat"});OpenLayers.LonLat.fromString=function(B){var A=B.split(",");return new OpenLayers.LonLat(parseFloat(A[0]),parseFloat(A[1]))};OpenLayers.Pixel=OpenLayers.Class({x:0,y:0,initialize:function(A,B){this.x=parseFloat(A);this.y=parseFloat(B)},toString:function(){return("x="+this.x+",y="+this.y)},clone:function(){return new OpenLayers.Pixel(this.x,this.y)},equals:function(A){var B=false;if(A!=null){B=((this.x==A.x&&this.y==A.y)||(isNaN(this.x)&&isNaN(this.y)&&isNaN(A.x)&&isNaN(A.y)))}return B},add:function(A,C){if((A==null)||(C==null)){var B=OpenLayers.i18n("pixelAddError");OpenLayers.Console.error(B);return null}return new OpenLayers.Pixel(this.x+A,this.y+C)},offset:function(A){var B=this.clone();if(A){B=this.add(A.x,A.y)}return B},CLASS_NAME:"OpenLayers.Pixel"});OpenLayers.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.Control=OpenLayers.Class({id:null,map:null,div:null,type:null,allowSelection:false,displayClass:"",title:"",active:null,handler:null,eventListeners:null,events:null,EVENT_TYPES:["activate","deactivate"],initialize:function(A){this.displayClass=this.CLASS_NAME.replace("OpenLayers.","ol").replace(/\./g,"");OpenLayers.Util.extend(this,A);this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES);if(this.eventListeners instanceof Object){this.events.on(this.eventListeners)}if(this.id==null){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")}},destroy:function(){if(this.events){if(this.eventListeners){this.events.un(this.eventListeners)}this.events.destroy();this.events=null}this.eventListeners=null;if(this.handler){this.handler.destroy();this.handler=null}if(this.handlers){for(var A in this.handlers){if(this.handlers.hasOwnProperty(A)&&typeof this.handlers[A].destroy=="function"){this.handlers[A].destroy()}}this.handlers=null}if(this.map){this.map.removeControl(this);this.map=null}},setMap:function(A){this.map=A;if(this.handler){this.handler.setMap(A)}},draw:function(A){if(this.div==null){this.div=OpenLayers.Util.createDiv(this.id);this.div.className=this.displayClass;if(!this.allowSelection){this.div.className+=" olControlNoSelect";this.div.setAttribute("unselectable","on",0);this.div.onselectstart=function(){return(false)}}if(this.title!=""){this.div.title=this.title}}if(A!=null){this.position=A.clone()}this.moveTo(this.position);return this.div},moveTo:function(A){if((A!=null)&&(this.div!=null)){this.div.style.left=A.x+"px";this.div.style.top=A.y+"px"}},activate:function(){if(this.active){return false}if(this.handler){this.handler.activate()}this.active=true;this.events.triggerEvent("activate");return true},deactivate:function(){if(this.active){if(this.handler){this.handler.deactivate()}this.active=false;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.Icon=OpenLayers.Class({url:null,size:null,offset:null,calculateOffset:null,imageDiv:null,px:null,initialize:function(A,B,D,C){this.url=A;this.size=(B)?B:new OpenLayers.Size(20,20);this.offset=D?D:new OpenLayers.Pixel(-(this.size.w/2),-(this.size.h/2));this.calculateOffset=C;var E=OpenLayers.Util.createUniqueID("OL_Icon_");this.imageDiv=OpenLayers.Util.createCssSpriteDiv(E)},destroy:function(){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},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"},CLASS_NAME:"OpenLayers.Icon"});OpenLayers.Lang={code:null,defaultCode:"en",getCode:function(){if(!OpenLayers.Lang.code){OpenLayers.Lang.setCode()}return OpenLayers.Lang.code},setCode:function(B){var D;if(!B){B=(OpenLayers.Util.getBrowserName()=="msie")?navigator.userLanguage:navigator.language}var C=B.split("-");C[0]=C[0].toLowerCase();if(typeof OpenLayers.Lang[C[0]]=="object"){D=C[0]}if(C[1]){var A=C[0]+"-"+C[1].toUpperCase();if(typeof OpenLayers.Lang[A]=="object"){D=A}}if(!D){OpenLayers.Console.warn("Failed to find OpenLayers.Lang."+C.join("-")+" dictionary, falling back to default language");D=OpenLayers.Lang.defaultCode}OpenLayers.Lang.code=D},translate:function(B,A){var D=OpenLayers.Lang[OpenLayers.Lang.getCode()];var C=D[B];if(!C){C=B}if(A){C=OpenLayers.String.format(C,A)}return C}};OpenLayers.i18n=OpenLayers.Lang.translate;OpenLayers.Popup=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,fixPadding:function(){if(typeof this.padding=="number"){this.padding=new OpenLayers.Bounds(this.padding,this.padding,this.padding,this.padding)}},panMapIfOutOfView:false,map:null,initialize:function(G,C,F,B,E,D){if(G==null){G=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")}this.id=G;this.lonlat=C;this.contentSize=(F!=null)?F:new OpenLayers.Size(OpenLayers.Popup.WIDTH,OpenLayers.Popup.HEIGHT);if(B!=null){this.contentHTML=B}this.backgroundColor=OpenLayers.Popup.COLOR;this.opacity=OpenLayers.Popup.OPACITY;this.border=OpenLayers.Popup.BORDER;this.div=OpenLayers.Util.createDiv(this.id,null,null,null,null,null,"hidden");this.div.className=this.displayClass;var A=this.id+"_GroupDiv";this.groupDiv=OpenLayers.Util.createDiv(A,null,null,null,"relative",null,"hidden");var G=this.div.id+"_contentDiv";this.contentDiv=OpenLayers.Util.createDiv(G,null,this.contentSize.clone(),null,"relative");this.contentDiv.className=this.contentDisplayClass;this.groupDiv.appendChild(this.contentDiv);this.div.appendChild(this.groupDiv);if(E){this.addCloseBox(D)}this.registerEvents()},destroy:function(){this.id=null;this.lonlat=null;this.size=null;this.contentHTML=null;this.backgroundColor=null;this.opacity=null;this.border=null;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(OpenLayers.Util.getBrowserName()=="firefox"){this.map.events.register("movestart",this,function(){var B=document.defaultView.getComputedStyle(this.contentDiv,null);var C=B.getPropertyValue("overflow");if(C!="hidden"){this.contentDiv._oldOverflow=C;this.contentDiv.style.overflow="hidden"}});this.map.events.register("moveend",this,function(){var B=this.contentDiv._oldOverflow;if(B){this.contentDiv.style.overflow=B;this.contentDiv._oldOverflow=null}})}this.moveTo(A);if(!this.autoSize&&!this.size){this.setSize(this.contentSize)}this.setBackgroundColor();this.setOpacity();this.setBorder();this.setContentHTML();if(this.panMapIfOutOfView){this.panIntoView()}return this.div},updatePosition:function(){if((this.lonlat)&&(this.map)){var A=this.map.getLayerPxFromLonLat(this.lonlat);if(A){this.moveTo(A)}}},moveTo:function(A){if((A!=null)&&(this.div!=null)){this.div.style.left=A.x+"px";this.div.style.top=A.y+"px"}},visible:function(){return OpenLayers.Element.visible(this.div)},toggle:function(){if(this.visible()){this.hide()}else{this.show()}},show:function(){OpenLayers.Element.show(this.div);if(this.panMapIfOutOfView){this.panIntoView()}},hide:function(){OpenLayers.Element.hide(this.div)},setSize:function(C){this.size=C.clone();var B=this.getContentDivPadding();var A=B.left+B.right;var E=B.top+B.bottom;this.fixPadding();A+=this.padding.left+this.padding.right;E+=this.padding.top+this.padding.bottom;if(this.closeDiv){var D=parseInt(this.closeDiv.style.width);A+=D+B.right}this.size.w+=A;this.size.h+=E;if(OpenLayers.Util.getBrowserName()=="msie"){this.contentSize.w+=B.left+B.right;this.contentSize.h+=B.bottom+B.top}if(this.div!=null){this.div.style.width=this.size.w+"px";this.div.style.height=this.size.h+"px"}if(this.contentDiv!=null){this.contentDiv.style.width=C.w+"px";this.contentDiv.style.height=C.h+"px"}},updateSize:function(){var E="<div class='"+this.contentDisplayClass+"'>"+this.contentDiv.innerHTML+"<div>";var D=OpenLayers.Util.getRenderedDimensions(E,null,{displayClass:this.displayClass});var B=this.getSafeContentSize(D);var C=null;if(B.equals(D)){C=D}else{var H=new OpenLayers.Size();H.w=(B.w<D.w)?B.w:null;H.h=(B.h<D.h)?B.h:null;if(H.w&&H.h){C=B}else{var A=OpenLayers.Util.getRenderedDimensions(E,H,{displayClass:this.contentDisplayClass});var G=OpenLayers.Element.getStyle(this.contentDiv,"overflow");if((G!="hidden")&&(A.equals(B))){var F=OpenLayers.Util.getScrollbarWidth();if(H.w){A.h+=F}else{A.w+=F}}C=this.getSafeContentSize(A)}}this.setSize(C)},setBackgroundColor:function(A){if(A!=undefined){this.backgroundColor=A}if(this.div!=null){this.div.style.backgroundColor=this.backgroundColor}},setOpacity:function(A){if(A!=undefined){this.opacity=A}if(this.div!=null){this.div.style.opacity=this.opacity;this.div.style.filter="alpha(opacity="+this.opacity*100+")"}},setBorder:function(A){if(A!=undefined){this.border=A}if(this.div!=null){this.div.style.border=this.border}},setContentHTML:function(A){if(A!=null){this.contentHTML=A}if((this.contentDiv!=null)&&(this.contentHTML!=null)&&(this.contentHTML!=this.contentDiv.innerHTML)){this.contentDiv.innerHTML=this.contentHTML;if(this.autoSize){this.registerImageListeners();this.updateSize()}}},registerImageListeners:function(){var F=function(){this.popup.updateSize();if(this.popup.visible()&&this.popup.panMapIfOutOfView){this.popup.panIntoView()}OpenLayers.Event.stopObserving(this.img,"load",this.img._onImageLoad)};var B=this.contentDiv.getElementsByTagName("img");for(var E=0,A=B.length;E<A;E++){var C=B[E];if(C.width==0||C.height==0){var D={popup:this,img:C};C._onImgLoad=OpenLayers.Function.bind(F,D);OpenLayers.Event.observe(C,"load",C._onImgLoad)}}},getSafeContentSize:function(B){var E=B.clone();var D=this.getContentDivPadding();var A=D.left+D.right;var H=D.top+D.bottom;this.fixPadding();A+=this.padding.left+this.padding.right;H+=this.padding.top+this.padding.bottom;if(this.closeDiv){var G=parseInt(this.closeDiv.style.width);A+=G+D.right}if(this.minSize){E.w=Math.max(E.w,(this.minSize.w-A));E.h=Math.max(E.h,(this.minSize.h-H))}if(this.maxSize){E.w=Math.min(E.w,(this.maxSize.w-A));E.h=Math.min(E.h,(this.maxSize.h-H))}if(this.map&&this.map.size){var C=this.map.size.h-this.map.paddingForPopups.top-this.map.paddingForPopups.bottom-H;var F=this.map.size.w-this.map.paddingForPopups.left-this.map.paddingForPopups.right-A;E.w=Math.min(E.w,F);E.h=Math.min(E.h,C)}return E},getContentDivPadding:function(){var A=this._contentDivPadding;if(!A){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;document.body.removeChild(this.div);this.div.style.display=""}return A},addCloseBox:function(C){this.closeDiv=OpenLayers.Util.createDiv(this.id+"_close",null,new OpenLayers.Size(17,17));this.closeDiv.className="olPopupCloseBox";var B=this.getContentDivPadding();this.closeDiv.style.right=B.right+"px";this.closeDiv.style.top=B.top+"px";this.groupDiv.appendChild(this.closeDiv);var A=C||function(D){this.hide();OpenLayers.Event.stop(D)};OpenLayers.Event.observe(this.closeDiv,"click",OpenLayers.Function.bindAsEventListener(A,this))},panIntoView:function(){var E=this.map.getSize();var D=this.map.getViewPortPxFromLayerPx(new OpenLayers.Pixel(parseInt(this.div.style.left),parseInt(this.div.style.top)));var C=D.clone();if(D.x<this.map.paddingForPopups.left){C.x=this.map.paddingForPopups.left}else{if((D.x+this.size.w)>(E.w-this.map.paddingForPopups.right)){C.x=E.w-this.map.paddingForPopups.right-this.size.w}}if(D.y<this.map.paddingForPopups.top){C.y=this.map.paddingForPopups.top}else{if((D.y+this.size.h)>(E.h-this.map.paddingForPopups.bottom)){C.y=E.h-this.map.paddingForPopups.bottom-this.size.h}}var B=D.x-C.x;var A=D.y-C.y;this.map.pan(B,A)},registerEvents:function(){this.events=new OpenLayers.Events(this,this.div,null,true);this.events.on({mousedown:this.onmousedown,mousemove:this.onmousemove,mouseup:this.onmouseup,click:this.onclick,mouseout:this.onmouseout,dblclick:this.ondblclick,scope:this})},onmousedown:function(A){this.mousedown=true;OpenLayers.Event.stop(A,true)},onmousemove:function(A){if(this.mousedown){OpenLayers.Event.stop(A,true)}},onmouseup:function(A){if(this.mousedown){this.mousedown=false;OpenLayers.Event.stop(A,true)}},onclick:function(A){OpenLayers.Event.stop(A,true)},onmouseout:function(A){this.mousedown=false},ondblclick:function(A){OpenLayers.Event.stop(A,true)},CLASS_NAME:"OpenLayers.Popup"});OpenLayers.Popup.WIDTH=200;OpenLayers.Popup.HEIGHT=200;OpenLayers.Popup.COLOR="white";OpenLayers.Popup.OPACITY=1;OpenLayers.Popup.BORDER="0px";OpenLayers.Renderer=OpenLayers.Class({container:null,extent:null,locked:false,size:null,resolution:null,map:null,initialize:function(A,B){this.container=OpenLayers.Util.getElement(A)},destroy:function(){this.container=null;this.extent=null;this.size=null;this.resolution=null;this.map=null},supported:function(){return false},setExtent:function(A,B){this.extent=A.clone();if(B){this.resolution=null}},setSize:function(A){this.size=A.clone();this.resolution=null},getResolution:function(){this.resolution=this.resolution||this.map.getResolution();return this.resolution},drawFeature:function(A,B){if(B==null){B=A.style}if(A.geometry){var C=A.geometry.getBounds();if(C){if(!C.intersectsBounds(this.extent)){B={display:"none"}}return this.drawGeometry(A.geometry,B,A.id)}}},drawGeometry:function(C,A,B){},clear:function(){},getFeatureIdFromEvent:function(A){},eraseFeatures:function(C){if(!(C instanceof Array)){C=[C]}for(var B=0,A=C.length;B<A;++B){this.eraseGeometry(C[B].geometry)}},eraseGeometry:function(A){},CLASS_NAME:"OpenLayers.Renderer"});OpenLayers.Tween=OpenLayers.Class({INTERVAL:10,easing:null,begin:null,finish:null,duration:null,callbacks:null,time:null,interval:null,playing:false,initialize:function(A){this.easing=(A)?A:OpenLayers.Easing.Expo.easeOut},start:function(C,B,D,A){this.playing=true;this.begin=C;this.finish=B;this.duration=D;this.callbacks=A.callbacks;this.time=0;if(this.interval){window.clearInterval(this.interval);this.interval=null}if(this.callbacks&&this.callbacks.start){this.callbacks.start.call(this,this.begin)}this.interval=window.setInterval(OpenLayers.Function.bind(this.play,this),this.INTERVAL)},stop:function(){if(!this.playing){return }if(this.callbacks&&this.callbacks.done){this.callbacks.done.call(this,this.finish)}window.clearInterval(this.interval);this.interval=null;this.playing=false},play:function(){var D={};for(var B in this.begin){var A=this.begin[B];var C=this.finish[B];if(A==null||C==null||isNaN(A)||isNaN(C)){OpenLayers.Console.error("invalid value for Tween")}var E=C-A;D[B]=this.easing.apply(this,[this.time,A,E,this.duration])}this.time++;if(this.callbacks&&this.callbacks.eachStep){this.callbacks.eachStep.call(this,D)}if(this.time>this.duration){if(this.callbacks&&this.callbacks.done){this.callbacks.done.call(this,this.finish);this.playing=false}window.clearInterval(this.interval);this.interval=null}},CLASS_NAME:"OpenLayers.Tween"});OpenLayers.Easing={CLASS_NAME:"OpenLayers.Easing"};OpenLayers.Easing.Linear={easeIn:function(B,A,D,C){return D*B/C+A},easeOut:function(B,A,D,C){return D*B/C+A},easeInOut:function(B,A,D,C){return D*B/C+A},CLASS_NAME:"OpenLayers.Easing.Linear"};OpenLayers.Easing.Expo={easeIn:function(B,A,D,C){return(B==0)?A:D*Math.pow(2,10*(B/C-1))+A},easeOut:function(B,A,D,C){return(B==C)?A+D:D*(-Math.pow(2,-10*B/C)+1)+A},easeInOut:function(B,A,D,C){if(B==0){return A}if(B==C){return A+D}if((B/=C/2)<1){return D/2*Math.pow(2,10*(B-1))+A}return D/2*(-Math.pow(2,-10*--B)+2)+A},CLASS_NAME:"OpenLayers.Easing.Expo"};OpenLayers.Easing.Quad={easeIn:function(B,A,D,C){return D*(B/=C)*B+A},easeOut:function(B,A,D,C){return -D*(B/=C)*(B-2)+A},easeInOut:function(B,A,D,C){if((B/=C/2)<1){return D/2*B*B+A}return -D/2*((--B)*(B-2)-1)+A},CLASS_NAME:"OpenLayers.Easing.Quad"};OpenLayers.Control.ArgParser=OpenLayers.Class(OpenLayers.Control,{center:null,zoom:null,layers:null,displayProjection:null,initialize:function(A){OpenLayers.Control.prototype.initialize.apply(this,arguments)},setMap:function(E){OpenLayers.Control.prototype.setMap.apply(this,arguments);for(var C=0,A=this.map.controls.length;C<A;C++){var D=this.map.controls[C];if((D!=this)&&(D.CLASS_NAME=="OpenLayers.Control.ArgParser")){if(D.displayProjection!=this.displayProjection){this.displayProjection=D.displayProjection}break}}if(C==this.map.controls.length){var B=OpenLayers.Util.getParameters();if(B.layers){this.layers=B.layers;this.map.events.register("addlayer",this,this.configureLayers);this.configureLayers()}if(B.lat&&B.lon){this.center=new OpenLayers.LonLat(parseFloat(B.lon),parseFloat(B.lat));if(B.zoom){this.zoom=parseInt(B.zoom)}this.map.events.register("changebaselayer",this,this.setCenter);this.setCenter()}}},setCenter:function(){if(this.map.baseLayer){this.map.events.unregister("changebaselayer",this,this.setCenter);if(this.displayProjection){this.center.transform(this.displayProjection,this.map.getProjectionObject())}this.map.setCenter(this.center,this.zoom)}},configureLayers:function(){if(this.layers.length==this.map.layers.length){this.map.events.unregister("addlayer",this,this.configureLayers);for(var C=0,A=this.layers.length;C<A;C++){var B=this.map.layers[C];var D=this.layers.charAt(C);if(D=="B"){this.map.setBaseLayer(B)}else{if((D=="T")||(D=="F")){B.setVisibility(D=="T")}}}}},CLASS_NAME:"OpenLayers.Control.ArgParser"});OpenLayers.Control.Attribution=OpenLayers.Class(OpenLayers.Control,{separator:", ",initialize:function(A){OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.map.events.un({removelayer:this.updateAttribution,addlayer:this.updateAttribution,changelayer:this.updateAttribution,changebaselayer:this.updateAttribution,scope:this});OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.map.events.on({changebaselayer:this.updateAttribution,changelayer:this.updateAttribution,addlayer:this.updateAttribution,removelayer:this.updateAttribution,scope:this});this.updateAttribution();return this.div},updateAttribution:function(){var D=[];if(this.map&&this.map.layers){for(var C=0,A=this.map.layers.length;C<A;C++){var B=this.map.layers[C];if(B.attribution&&B.getVisibility()){D.push(B.attribution)}}this.div.innerHTML=D.join(this.separator)}},CLASS_NAME:"OpenLayers.Control.Attribution"});OpenLayers.Control.LayerSwitcher=OpenLayers.Class(OpenLayers.Control,{activeColor:"darkblue",layerStates:null,layersDiv:null,baseLayersDiv:null,baseLayers:null,dataLbl:null,dataLayersDiv:null,dataLayers:null,minimizeDiv:null,maximizeDiv:null,ascending:true,initialize:function(A){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.layerStates=[]},destroy:function(){OpenLayers.Event.stopObservingElement(this.div);OpenLayers.Event.stopObservingElement(this.minimizeDiv);OpenLayers.Event.stopObservingElement(this.maximizeDiv);this.clearLayersArray("base");this.clearLayersArray("data");this.map.events.un({addlayer:this.redraw,changelayer:this.redraw,removelayer:this.redraw,changebaselayer:this.redraw,scope:this});OpenLayers.Control.prototype.destroy.apply(this,arguments)},setMap:function(A){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.map.events.on({addlayer:this.redraw,changelayer:this.redraw,removelayer:this.redraw,changebaselayer:this.redraw,scope:this})},draw:function(){OpenLayers.Control.prototype.draw.apply(this);this.loadContents();if(!this.outsideViewport){this.minimizeControl()}this.redraw();return this.div},clearLayersArray:function(D){var E=this[D+"Layers"];if(E){for(var C=0,A=E.length;C<A;C++){var B=E[C];OpenLayers.Event.stopObservingElement(B.inputElem);OpenLayers.Event.stopObservingElement(B.labelSpan)}}this[D+"LayersDiv"].innerHTML="";this[D+"Layers"]=[]},checkRedraw:function(){var E=false;if(!this.layerStates.length||(this.map.layers.length!=this.layerStates.length)){E=true}else{for(var C=0,A=this.layerStates.length;C<A;C++){var D=this.layerStates[C];var B=this.map.layers[C];if((D.name!=B.name)||(D.inRange!=B.inRange)||(D.id!=B.id)||(D.visibility!=B.visibility)){E=true;break}}}return E},sortLayers:function(B,A){if(B.options&&A.options){return B.options.layerSwitcherOrder<A.options.layerSwitcherOrder?-1:1}return 0},redraw:function(){if(!this.checkRedraw()){return this.div}this.clearLayersArray("base");this.clearLayersArray("data");var D=false;var L=false;var H=this.map.layers.length;this.layerStates=new Array(H);for(var F=0;F<H;F++){var G=this.map.layers[F];this.layerStates[F]={name:G.name,visibility:G.visibility,inRange:G.inRange,id:G.id}}var E=this.map.layers.slice();E.sort(this.sortLayers);if(!this.ascending){E.reverse()}for(var F=0,H=E.length;F<H;F++){var G=E[F];var I=G.isBaseLayer;if(G.displayInLayerSwitcher){if(I){L=true}else{D=true}var K=(I)?(G==this.map.baseLayer):G.getVisibility();var J=document.createElement("input");J.id=this.id+"_input_"+G.name;J.name=(I)?"baseLayers":G.name;J.type=(I)?"radio":"checkbox";J.value=G.name;J.checked=K;J.defaultChecked=K;if(!I&&!G.inRange){J.disabled=true}var A={inputElem:J,layer:G,layerSwitcher:this};OpenLayers.Event.observe(J,"mouseup",OpenLayers.Function.bindAsEventListener(this.onInputClick,A));var B=document.createElement("span");if(!I&&!G.inRange){B.style.color="gray"}B.innerHTML=G.name;B.style.verticalAlign=(I)?"bottom":"baseline";OpenLayers.Event.observe(B,"click",OpenLayers.Function.bindAsEventListener(this.onInputClick,A));var N=document.createElement("br");var M=(I)?this.baseLayers:this.dataLayers;M.push({layer:G,inputElem:J,labelSpan:B});var C=(I)?this.baseLayersDiv:this.dataLayersDiv;C.appendChild(J);C.appendChild(B);C.appendChild(N)}}this.dataLbl.style.display=(D)?"":"none";this.baseLbl.style.display=(L)?"":"none";return this.div},onInputClick:function(A){if(!this.inputElem.disabled){if(this.inputElem.type=="radio"){this.inputElem.checked=true;this.layer.map.setBaseLayer(this.layer)}else{this.inputElem.checked=!this.inputElem.checked;this.layerSwitcher.updateMap()}}OpenLayers.Event.stop(A)},onLayerClick:function(A){this.updateMap()},updateMap:function(){for(var B=0,A=this.baseLayers.length;B<A;B++){var C=this.baseLayers[B];if(C.inputElem.checked){this.map.setBaseLayer(C.layer,false)}}for(var B=0,A=this.dataLayers.length;B<A;B++){var C=this.dataLayers[B];C.layer.setVisibility(C.inputElem.checked)}},maximizeControl:function(A){this.div.style.width="20em";this.div.style.height="";this.showControls(false);if(A!=null){OpenLayers.Event.stop(A)}},minimizeControl:function(A){this.div.style.width="0px";this.div.style.height="0px";this.showControls(true);if(A!=null){OpenLayers.Event.stop(A)}},showControls:function(A){this.maximizeDiv.style.display=A?"":"none";this.minimizeDiv.style.display=A?"none":"";this.layersDiv.style.display=A?"none":""},loadContents:function(){this.div.style.position="absolute";this.div.style.top="25px";this.div.style.right="0px";this.div.style.left="";this.div.style.fontFamily="sans-serif";this.div.style.fontWeight="bold";this.div.style.marginTop="3px";this.div.style.marginLeft="3px";this.div.style.marginBottom="3px";this.div.style.fontSize="smaller";this.div.style.color="white";this.div.style.backgroundColor="transparent";OpenLayers.Event.observe(this.div,"mouseup",OpenLayers.Function.bindAsEventListener(this.mouseUp,this));OpenLayers.Event.observe(this.div,"click",this.ignoreEvent);OpenLayers.Event.observe(this.div,"mousedown",OpenLayers.Function.bindAsEventListener(this.mouseDown,this));OpenLayers.Event.observe(this.div,"dblclick",this.ignoreEvent);this.layersDiv=document.createElement("div");this.layersDiv.id=this.id+"_layersDiv";this.layersDiv.style.paddingTop="5px";this.layersDiv.style.paddingLeft="10px";this.layersDiv.style.paddingBottom="5px";this.layersDiv.style.paddingRight="75px";this.layersDiv.style.backgroundColor=this.activeColor;this.layersDiv.style.width="100%";this.layersDiv.style.height="100%";this.baseLbl=document.createElement("div");this.baseLbl.innerHTML=OpenLayers.i18n("baseLayer");this.baseLbl.style.marginTop="3px";this.baseLbl.style.marginLeft="3px";this.baseLbl.style.marginBottom="3px";this.baseLayersDiv=document.createElement("div");this.baseLayersDiv.style.paddingLeft="10px";this.dataLbl=document.createElement("div");this.dataLbl.innerHTML=OpenLayers.i18n("overlays");this.dataLbl.style.marginTop="3px";this.dataLbl.style.marginLeft="3px";this.dataLbl.style.marginBottom="3px";this.dataLayersDiv=document.createElement("div");this.dataLayersDiv.style.paddingLeft="10px";if(this.ascending){this.layersDiv.appendChild(this.baseLbl);this.layersDiv.appendChild(this.baseLayersDiv);this.layersDiv.appendChild(this.dataLbl);this.layersDiv.appendChild(this.dataLayersDiv)}else{this.layersDiv.appendChild(this.dataLbl);this.layersDiv.appendChild(this.dataLayersDiv);this.layersDiv.appendChild(this.baseLbl);this.layersDiv.appendChild(this.baseLayersDiv)}this.div.appendChild(this.layersDiv);OpenLayers.Rico.Corner.round(this.div,{corners:"tl bl",bgColor:"transparent",color:this.activeColor,blend:false});OpenLayers.Rico.Corner.changeOpacity(this.layersDiv,0.75);var C=OpenLayers.Util.getImagesLocation();var B=new OpenLayers.Size(18,18);var A=C+"layer-switcher-maximize.png";this.maximizeDiv=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_MaximizeDiv",null,B,A,"absolute");this.maximizeDiv.style.top="5px";this.maximizeDiv.style.right="0px";this.maximizeDiv.style.left="";this.maximizeDiv.style.display="none";OpenLayers.Event.observe(this.maximizeDiv,"click",OpenLayers.Function.bindAsEventListener(this.maximizeControl,this));this.div.appendChild(this.maximizeDiv);var A=C+"layer-switcher-minimize.png";var B=new OpenLayers.Size(18,18);this.minimizeDiv=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_MinimizeDiv",null,B,A,"absolute");this.minimizeDiv.style.top="5px";this.minimizeDiv.style.right="0px";this.minimizeDiv.style.left="";this.minimizeDiv.style.display="none";OpenLayers.Event.observe(this.minimizeDiv,"click",OpenLayers.Function.bindAsEventListener(this.minimizeControl,this));this.div.appendChild(this.minimizeDiv)},ignoreEvent:function(A){OpenLayers.Event.stop(A)},mouseDown:function(A){this.isMouseDown=true;this.ignoreEvent(A)},mouseUp:function(A){if(this.isMouseDown){this.isMouseDown=false;this.ignoreEvent(A)}},CLASS_NAME:"OpenLayers.Control.LayerSwitcher"});OpenLayers.Control.PanZoom=OpenLayers.Class(OpenLayers.Control,{slideFactor:50,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);while(this.buttons.length){var A=this.buttons.shift();A.map=null;OpenLayers.Event.stopObservingElement(A)}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(D,A,C,B){return this._addButtonCssSprite(D,A.replace(/\.png/g,""),C,B)},_addButtonCssSprite:function(E,A,D,C){var B=OpenLayers.Util.createCssSpriteDiv(this.id+"_"+E,D,C,A,"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=E;B.map=this.map;B.slideFactor=this.slideFactor;this.buttons.push(B);return B},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.slideFactor);break;case"pandown":this.map.pan(0,this.slideFactor);break;case"panleft":this.map.pan(-this.slideFactor,0);break;case"panright":this.map.pan(this.slideFactor,0);break;case"zoomin":this.map.zoomIn();break;case"zoomout":this.map.zoomOut();break;case"zoomworld":this.map.zoomToMaxExtent();break}OpenLayers.Event.stop(A)},CLASS_NAME:"OpenLayers.Control.PanZoom"});OpenLayers.Control.PanZoom.X=4;OpenLayers.Control.PanZoom.Y=4;OpenLayers.Event={observers:false,KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(A){return A.target||A.srcElement},isLeftClick:function(A){return(((A.which)&&(A.which==1))||((A.button)&&(A.button==1)))},isRightClick:function(A){return(((A.which)&&(A.which==3))||((A.button)&&(A.button==2)))},stop:function(B,A){if(!A){if(B.preventDefault){B.preventDefault()}else{B.returnValue=false}}if(B.stopPropagation){B.stopPropagation()}else{B.cancelBubble=true}},findElement:function(C,B){var A=OpenLayers.Event.element(C);while(A.parentNode&&(!A.tagName||(A.tagName.toUpperCase()!=B.toUpperCase()))){A=A.parentNode}return A},observe:function(B,D,C,A){var E=OpenLayers.Util.getElement(B);A=A||false;if(D=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||E.attachEvent)){D="keydown"}if(!this.observers){this.observers={}}if(!E._eventCacheID){var F="eventCacheID_";if(E.id){F=E.id+"_"+F}E._eventCacheID=OpenLayers.Util.createUniqueID(F)}var G=E._eventCacheID;if(!this.observers[G]){this.observers[G]=[]}this.observers[G].push({element:E,name:D,observer:C,useCapture:A});if(E.addEventListener){E.addEventListener(D,C,A)}else{if(E.attachEvent){E.attachEvent("on"+D,C)}}},stopObservingElement:function(A){var B=OpenLayers.Util.getElement(A);var C=B._eventCacheID;this._removeElementObservers(OpenLayers.Event.observers[C])},_removeElementObservers:function(E){if(E){for(var B=E.length-1;B>=0;B--){var C=E[B];var A=new Array(C.element,C.name,C.observer,C.useCapture);var D=OpenLayers.Event.stopObserving.apply(this,A)}}},stopObserving:function(H,A,G,B){B=B||false;var F=OpenLayers.Util.getElement(H);var D=F._eventCacheID;if(A=="keypress"){if(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||F.detachEvent){A="keydown"}}var J=false;var C=OpenLayers.Event.observers[D];if(C){var E=0;while(!J&&E<C.length){var I=C[E];if((I.name==A)&&(I.observer==G)&&(I.useCapture==B)){C.splice(E,1);if(C.length==0){delete OpenLayers.Event.observers[D]}J=true;break}E++}}if(J){if(F.removeEventListener){F.removeEventListener(A,G,B)}else{if(F&&F.detachEvent){F.detachEvent("on"+A,G)}}}return J},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,initialize:function(C,E,G,F,B){OpenLayers.Util.extend(this,B);this.object=C;this.element=E;this.fallThrough=F;this.listeners={};this.eventHandler=OpenLayers.Function.bindAsEventListener(this.handleBrowserEvent,this);this.eventTypes=[];if(G!=null){for(var D=0,A=G.length;D<A;D++){this.addEventType(G[D])}}if(this.element!=null){this.attachToElement(E)}},destroy:function(){if(this.element){OpenLayers.Event.stopObservingElement(this.element)}this.element=null;this.listeners=null;this.object=null;this.eventTypes=null;this.fallThrough=null;this.eventHandler=null},addEventType:function(A){if(!this.listeners[A]){this.eventTypes.push(A);this.listeners[A]=[]}},attachToElement:function(D){for(var C=0,A=this.BROWSER_EVENTS.length;C<A;C++){var B=this.BROWSER_EVENTS[C];this.addEventType(B);OpenLayers.Event.observe(D,B,this.eventHandler)}OpenLayers.Event.observe(D,"dragstart",OpenLayers.Event.stop)},on:function(A){for(var B in A){if(B!="scope"){this.register(B,A.scope,A[B])}}},register:function(B,D,C){if((C!=null)&&(OpenLayers.Util.indexOf(this.eventTypes,B)!=-1)){if(D==null){D=this.object}var A=this.listeners[B];A.push({obj:D,func:C})}},registerPriority:function(B,D,C){if(C!=null){if(D==null){D=this.object}var A=this.listeners[B];if(A!=null){A.unshift({obj:D,func:C})}}},un:function(A){for(var B in A){if(B!="scope"){this.unregister(B,A.scope,A[B])}}},unregister:function(D,F,E){if(F==null){F=this.object}var C=this.listeners[D];if(C!=null){for(var B=0,A=C.length;B<A;B++){if(C[B].obj==F&&C[B].func==E){C.splice(B,1);break}}}},remove:function(A){if(this.listeners[A]!=null){this.listeners[A]=[]}},triggerEvent:function(E,B){if(B==null){B={}}B.object=this.object;B.element=this.element;if(!B.type){B.type=E}var D=(this.listeners[E])?this.listeners[E].slice():null;if((D!=null)&&(D.length>0)){var F;for(var C=0,A=D.length;C<A;C++){var G=D[C];F=G.func.apply(G.obj,[B]);if((F!=undefined)&&(F==false)){break}}if(!this.fallThrough){OpenLayers.Event.stop(B,true)}}return F},handleBrowserEvent:function(A){if(this.includeXY){A.xy=this.getMousePosition(A)}this.triggerEvent(A.type,A)},clearMouseCache:function(){this.element.scrolls=null;this.element.lefttop=null;this.element.offsets=null},getMousePosition:function(A){if(!this.includeXY){this.clearMouseCache()}else{if(!this.element.hasScrollEvent){OpenLayers.Event.observe(window,"scroll",OpenLayers.Function.bind(this.clearMouseCache,this));this.element.hasScrollEvent=true}}if(!this.element.scrolls){this.element.scrolls=[];this.element.scrolls[0]=(document.documentElement.scrollLeft||document.body.scrollLeft);this.element.scrolls[1]=(document.documentElement.scrollTop||document.body.scrollTop)}if(!this.element.lefttop){this.element.lefttop=[];this.element.lefttop[0]=(document.documentElement.clientLeft||0);this.element.lefttop[1]=(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,initialize:function(A){OpenLayers.Util.extend(this,A);this.options=A},destroy:function(){},read:function(A){OpenLayers.Console.userError(OpenLayers.i18n("readNotImplemented"))},write:function(A){OpenLayers.Console.userError(OpenLayers.i18n("writeNotImplemented"))},CLASS_NAME:"OpenLayers.Format"});OpenLayers.Lang.en={unhandledRequest:"Unhandled request return ${statusText}",permalink:"Permalink",overlays:"Overlays",baseLayer:"Base Layer",sameProjection:"The overview map only works when it is in the same projection as the main map",readNotImplemented:"Read not implemented.",writeNotImplemented:"Write not implemented.",noFID:"Can't update a feature for which there is no FID.",errorLoadingGML:"Error in loading GML file ${url}",browserNotSupported:"Your browser does not support vector rendering. Currently supported renderers are:\n${renderers}",componentShouldBe:"addFeatures : component should be an ${geomType}",getFeatureError:"getFeatureFromEvent called on layer with no renderer. This usually means you destroyed a layer, but not some handler which is associated with it.",minZoomLevelError:"The minZoomLevel property is only intended for use with the FixedZoomLevels-descendent layers. That this wfs layer checks for minZoomLevel is a relic of thepast. We cannot, however, remove it without possibly breaking OL based applications that may depend on it. Therefore we are deprecating it -- the minZoomLevel check below will be removed at 3.0. Please instead use min/max resolution setting as described here: http://trac.openlayers.org/wiki/SettingZoomLevels",commitSuccess:"WFS Transaction: SUCCESS ${response}",commitFailed:"WFS Transaction: FAILED ${response}",googleWarning:"The Google Layer was unable to load correctly.<br><br>To get rid of this message, select a new BaseLayer in the layer switcher in the upper-right corner.<br><br>Most likely, this is because the Google Maps library script was either not included, or does not contain the correct API key for your site.<br><br>Developers: For help getting this working correctly, <a href='http://trac.openlayers.org/wiki/Google' target='_blank'>click here</a>",getLayerWarning:"The ${layerType} Layer was unable to load correctly.<br><br>To get rid of this message, select a new BaseLayer in the layer switcher in the upper-right corner.<br><br>Most likely, this is because the ${layerLib} library script was not correctly included.<br><br>Developers: For help getting this working correctly, <a href='http://trac.openlayers.org/wiki/${layerLib}' target='_blank'>click here</a>",scale:"Scale = 1 : ${scaleDenom}",layerAlreadyAdded:"You tried to add the layer: ${layerName} to the map, but it has already been added",reprojectDeprecated:"You are using the 'reproject' option on the ${layerName} layer. This option is deprecated: its use was designed to support displaying data over commercial basemaps, but that functionality should now be achieved by using Spherical Mercator support. More information is available from http://trac.openlayers.org/wiki/SphericalMercator.",methodDeprecated:"This method has been deprecated and will be removed in 3.0. Please use ${newMethod} instead.",boundsAddError:"You must pass both x and y values to the add function.",lonlatAddError:"You must pass both lon and lat values to the add function.",pixelAddError:"You must pass both x and y values to the add function.",unsupportedGeometryType:"Unsupported geometry type: ${geomType}",pagePositionFailed:"OpenLayers.Util.pagePosition failed: element with id ${elemId} may be misplaced.",end:"",filterEvaluateNotImplemented:"evaluate is not implemented for this filter type."};OpenLayers.Popup.Anchored=OpenLayers.Class(OpenLayers.Popup,{relativePosition:null,anchor:null,initialize:function(H,D,G,C,B,F,E){var A=[H,D,G,C,F,E];OpenLayers.Popup.prototype.initialize.apply(this,A);this.anchor=(B!=null)?B:{size:new OpenLayers.Size(0,0),offset:new OpenLayers.Pixel(0,0)}},destroy:function(){this.anchor=null;this.relativePosition=null;OpenLayers.Popup.prototype.destroy.apply(this,arguments)},show:function(){this.updatePosition();OpenLayers.Popup.prototype.show.apply(this,arguments)},moveTo:function(C){var B=this.relativePosition;this.relativePosition=this.calculateRelativePosition(C);var D=this.calculateNewPx(C);var A=new Array(D);OpenLayers.Popup.prototype.moveTo.apply(this,A);if(this.relativePosition!=B){this.updateRelativePosition()}},setSize:function(B){OpenLayers.Popup.prototype.setSize.apply(this,arguments);if((this.lonlat)&&(this.map)){var A=this.map.getLayerPxFromLonLat(this.lonlat);this.moveTo(A)}},calculateRelativePosition:function(B){var D=this.map.getLonLatFromLayerPx(B);var C=this.map.getExtent();var A=C.determineQuadrant(D);return OpenLayers.Bounds.oppositeQuadrant(A)},updateRelativePosition:function(){},calculateNewPx:function(B){var E=B.offset(this.anchor.offset);var A=this.size||this.contentSize;var D=(this.relativePosition.charAt(0)=="t");E.y+=(D)?-A.h:this.anchor.size.h;var C=(this.relativePosition.charAt(1)=="l");E.x+=(C)?-A.w:this.anchor.size.w;return E},CLASS_NAME:"OpenLayers.Popup.Anchored"});OpenLayers.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.Canvas=OpenLayers.Class(OpenLayers.Renderer,{root:null,canvas:null,features:null,geometryMap:null,initialize:function(A){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.root=document.createElement("canvas");this.container.appendChild(this.root);this.canvas=this.root.getContext("2d");this.features={};this.geometryMap={}},eraseGeometry:function(A){this.eraseFeatures(this.features[this.geometryMap[A.id]][0])},supported:function(){var A=document.createElement("canvas");return !!A.getContext},setExtent:function(A){this.extent=A.clone();this.resolution=null;this.redraw()},setSize:function(A){this.size=A.clone();this.root.style.width=A.w+"px";this.root.style.height=A.h+"px";this.root.width=A.w;this.root.height=A.h;this.resolution=null},drawFeature:function(A,B){if(B==null){B=A.style}B=OpenLayers.Util.extend({fillColor:"#000000",strokeColor:"#000000",strokeWidth:2,fillOpacity:1,strokeOpacity:1},B);this.features[A.id]=[A,B];this.geometryMap[A.geometry.id]=A.id;this.redraw()},drawGeometry:function(D,C){var B=D.CLASS_NAME;if((B=="OpenLayers.Geometry.Collection")||(B=="OpenLayers.Geometry.MultiPoint")||(B=="OpenLayers.Geometry.MultiLineString")||(B=="OpenLayers.Geometry.MultiPolygon")){for(var A=0;A<D.components.length;A++){this.drawGeometry(D.components[A],C)}return }switch(D.CLASS_NAME){case"OpenLayers.Geometry.Point":this.drawPoint(D,C);break;case"OpenLayers.Geometry.LineString":this.drawLineString(D,C);break;case"OpenLayers.Geometry.LinearRing":this.drawLinearRing(D,C);break;case"OpenLayers.Geometry.Polygon":this.drawPolygon(D,C);break;default:break}},drawExternalGraphic:function(I,A){var E=new Image();E.src=A.externalGraphic;var C=A.graphicWidth||A.graphicHeight;var H=A.graphicHeight||A.graphicWidth;C=C?C:A.pointRadius*2;H=H?H:A.pointRadius*2;var G=(A.graphicXOffset!=undefined)?A.graphicXOffset:-(0.5*C);var D=(A.graphicYOffset!=undefined)?A.graphicYOffset:-(0.5*H);var F=A.graphicOpacity||A.fillOpacity;var B={img:E,x:(I[0]+G),y:(I[1]+D),width:C,height:H,canvas:this.canvas};E.onload=OpenLayers.Function.bind(function(){this.canvas.drawImage(this.img,this.x,this.y,this.width,this.height)},B)},setCanvasStyle:function(B,A){if(B=="fill"){this.canvas.globalAlpha=A.fillOpacity;this.canvas.fillStyle=A.fillColor}else{if(B=="stroke"){this.canvas.globalAlpha=A.strokeOpacity;this.canvas.strokeStyle=A.strokeColor;this.canvas.lineWidth=A.strokeWidth}else{this.canvas.globalAlpha=0;this.canvas.lineWidth=1}}},drawPoint:function(C,A){var B=this.getLocalXY(C);if(A.externalGraphic){this.drawExternalGraphic(B,A)}else{this.setCanvasStyle("fill",A);this.canvas.beginPath();this.canvas.arc(B[0],B[1],6,0,Math.PI*2,true);this.canvas.fill();this.setCanvasStyle("stroke",A);this.canvas.beginPath();this.canvas.arc(B[0],B[1],6,0,Math.PI*2,true);this.canvas.stroke();this.setCanvasStyle("reset")}},drawLineString:function(D,B){this.setCanvasStyle("stroke",B);this.canvas.beginPath();var E=this.getLocalXY(D.components[0]);this.canvas.moveTo(E[0],E[1]);for(var A=1;A<D.components.length;A++){var C=this.getLocalXY(D.components[A]);this.canvas.lineTo(C[0],C[1])}this.canvas.stroke();this.setCanvasStyle("reset")},drawLinearRing:function(E,C){this.setCanvasStyle("fill",C);this.canvas.beginPath();var F=this.getLocalXY(E.components[0]);this.canvas.moveTo(F[0],F[1]);for(var B=1;B<E.components.length-1;B++){var D=this.getLocalXY(E.components[B]);this.canvas.lineTo(D[0],D[1])}this.canvas.fill();var A=this.canvas.lineWidth;this.setCanvasStyle("stroke",C);this.canvas.beginPath();var F=this.getLocalXY(E.components[0]);this.canvas.moveTo(F[0],F[1]);for(var B=1;B<E.components.length;B++){var D=this.getLocalXY(E.components[B]);this.canvas.lineTo(D[0],D[1])}this.canvas.stroke();this.setCanvasStyle("reset")},drawPolygon:function(C,B){this.drawLinearRing(C.components[0],B);for(var A=1;A<C.components.length;A++){this.drawLinearRing(C.components[A],{fillOpacity:0,strokeWidth:0,strokeOpacity:0,strokeColor:"#000000",fillColor:"#000000"})}},getLocalXY:function(B){var C=this.getResolution();var D=this.extent;var A=(B.x/C+(-D.left/C));var E=((D.top/C)-B.y/C);return[A,E]},clear:function(){this.canvas.clearRect(0,0,this.root.width,this.root.height)},getFeatureIdFromEvent:function(A){var F=this.map.getLonLatFromPixel(A.xy);var B=this.getResolution();var E=new OpenLayers.Bounds(F.lon-B*5,F.lat-B*5,F.lon+B*5,F.lat+B*5);var C=E.toGeometry();for(var D in this.features){if(!this.features.hasOwnProperty(D)){continue}if(this.features[D][0].geometry.intersects(C)){return D}}return null},eraseFeatures:function(B){if(!(B instanceof Array)){B=[B]}for(var A=0;A<B.length;++A){delete this.features[B[A].id]}this.redraw()},redraw:function(){if(!this.locked){this.clear();for(var A in this.features){if(!this.features.hasOwnProperty(A)){continue}if(!this.features[A][0].geometry){continue}this.drawGeometry(this.features[A][0].geometry,this.features[A][1])}}},CLASS_NAME:"OpenLayers.Renderer.Canvas"});OpenLayers.ElementsIndexer=OpenLayers.Class({maxZIndex:null,order:null,indices:null,compare:null,initialize:function(A){this.compare=A?OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_Y_ORDER:OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_DRAWING_ORDER;this.order=[];this.indices={};this.maxZIndex=0},insert:function(D){if(this.exists(D)){this.remove(D)}var G=D.id;this.determineZIndex(D);var E=-1;var F=this.order.length;var B;while(F-E>1){B=parseInt((E+F)/2);var C=this.compare(this,D,OpenLayers.Util.getElement(this.order[B]));if(C>0){E=B}else{F=B}}this.order.splice(F,0,G);this.indices[G]=this.getZIndex(D);var A=F+1;return A<this.order.length?OpenLayers.Util.getElement(this.order[A]):null},remove:function(B){var D=B.id;var A=OpenLayers.Util.indexOf(this.order,D);if(A>=0){this.order.splice(A,1);delete this.indices[D];if(this.order.length>0){var C=this.order[this.order.length-1];this.maxZIndex=this.indices[C]}else{this.maxZIndex=0}}},clear:function(){this.order=[];this.indices={};this.maxZIndex=0},exists:function(A){return(this.indices[A.id]!=null)},getZIndex:function(A){return A._style.graphicZIndex},determineZIndex:function(A){var B=A._style.graphicZIndex;if(B==null){B=this.maxZIndex;A._style.graphicZIndex=B}else{if(B>this.maxZIndex){this.maxZIndex=B}}},CLASS_NAME:"OpenLayers.ElementsIndexer"});OpenLayers.ElementsIndexer.IndexingMethods={Z_ORDER:function(E,D,B){var A=E.getZIndex(D);var F=0;if(B){var C=E.getZIndex(B);F=A-C}return F},Z_ORDER_DRAWING_ORDER:function(C,B,A){var D=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(C,B,A);if(A&&D==0){D=1}return D},Z_ORDER_Y_ORDER:function(F,E,B){var G=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(F,E,B);if(B&&G==0){var C=E._geometry.getBounds().bottom;var D=B._geometry.getBounds().bottom;var A=D-C;G=(A==0)?1:A}return G}};OpenLayers.Renderer.Elements=OpenLayers.Class(OpenLayers.Renderer,{rendererRoot:null,root:null,xmlns:null,indexer:null,BACKGROUND_ID_SUFFIX:"_background",minimumSymbolizer:{strokeLinecap:"round",strokeOpacity:1,strokeDashstyle:"solid",fillOpacity:1,pointRadius:0},initialize:function(A,B){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.rendererRoot=this.createRenderRoot();this.root=this.createRoot();this.rendererRoot.appendChild(this.root);this.container.appendChild(this.rendererRoot);if(B&&(B.zIndexing||B.yOrdering)){this.indexer=new OpenLayers.ElementsIndexer(B.yOrdering)}},destroy:function(){this.clear();this.rendererRoot=null;this.root=null;this.xmlns=null;OpenLayers.Renderer.prototype.destroy.apply(this,arguments)},clear:function(){if(this.root){while(this.root.childNodes.length>0){this.root.removeChild(this.root.firstChild)}}if(this.indexer){this.indexer.clear()}},getNodeType:function(B,A){},drawGeometry:function(G,D,F){var C=G.CLASS_NAME;var H=true;if((C=="OpenLayers.Geometry.Collection")||(C=="OpenLayers.Geometry.MultiPoint")||(C=="OpenLayers.Geometry.MultiLineString")||(C=="OpenLayers.Geometry.MultiPolygon")){for(var B=0,A=G.components.length;B<A;B++){H=H&&this.drawGeometry(G.components[B],D,F)}return H}H=false;if(D.display!="none"){if(D.backgroundGraphic){this.redrawBackgroundNode(G.id,G,D,F)}H=this.redrawNode(G.id,G,D,F)}if(H==false){var E=document.getElementById(G.id);if(E){if(E._style.backgroundGraphic){E.parentNode.removeChild(document.getElementById(G.id+this.BACKGROUND_ID_SUFFIX))}E.parentNode.removeChild(E)}}return H},redrawNode:function(G,F,B,E){var C=this.nodeFactory(G,this.getNodeType(F,B));C._featureId=E;C._geometry=F;C._geometryClass=F.CLASS_NAME;C._style=B;var A=this.drawGeometryNode(C,F,B);if(A===false){return false}C=A.node;var D=this.indexer?this.indexer.insert(C):null;if(D){this.root.insertBefore(C,D)}else{this.root.appendChild(C)}this.postDraw(C);return A.complete},redrawBackgroundNode:function(E,D,B,C){var A=OpenLayers.Util.extend({},B);A.externalGraphic=A.backgroundGraphic;A.graphicXOffset=A.backgroundXOffset;A.graphicYOffset=A.backgroundYOffset;A.graphicZIndex=A.backgroundGraphicZIndex;A.backgroundGraphic=null;A.backgroundXOffset=null;A.backgroundYOffset=null;A.backgroundGraphicZIndex=null;return this.redrawNode(E+this.BACKGROUND_ID_SUFFIX,D,A,null)},drawGeometryNode:function(C,E,B){B=B||C._style;OpenLayers.Util.applyDefaults(B,this.minimumSymbolizer);var A={isFilled:true,isStroked:!!B.strokeWidth};var D;switch(E.CLASS_NAME){case"OpenLayers.Geometry.Point":D=this.drawPoint(C,E);break;case"OpenLayers.Geometry.LineString":A.isFilled=false;D=this.drawLineString(C,E);break;case"OpenLayers.Geometry.LinearRing":D=this.drawLinearRing(C,E);break;case"OpenLayers.Geometry.Polygon":D=this.drawPolygon(C,E);break;case"OpenLayers.Geometry.Surface":D=this.drawSurface(C,E);break;case"OpenLayers.Geometry.Rectangle":D=this.drawRectangle(C,E);break;default:break}C._style=B;C._options=A;if(D!=false){return{node:this.setStyle(C,B,A,E),complete:D}}else{return false}},postDraw:function(A){},drawPoint:function(A,B){},drawLineString:function(A,B){},drawLinearRing:function(A,B){},drawPolygon:function(A,B){},drawRectangle:function(A,B){},drawCircle:function(A,B){},drawSurface:function(A,B){},getFeatureIdFromEvent:function(A){var D=A.target;var B=D&&D.correspondingUseElement;var C=B?B:(D||A.srcElement);var E=C._featureId;return E},eraseGeometry:function(F){if((F.CLASS_NAME=="OpenLayers.Geometry.MultiPoint")||(F.CLASS_NAME=="OpenLayers.Geometry.MultiLineString")||(F.CLASS_NAME=="OpenLayers.Geometry.MultiPolygon")||(F.CLASS_NAME=="OpenLayers.Geometry.Collection")){for(var D=0,A=F.components.length;D<A;D++){this.eraseGeometry(F.components[D])}}else{var C=OpenLayers.Util.getElement(F.id);if(C&&C.parentNode){if(C.geometry){C.geometry.destroy();C.geometry=null}C.parentNode.removeChild(C);if(this.indexer){this.indexer.remove(C)}if(C._style.backgroundGraphic){var B=F.id+this.BACKGROUND_ID_SUFFIX;var E=OpenLayers.Util.getElement(B);if(E&&E.parentNode){E.parentNode.removeChild(E)}}}}},nodeFactory:function(C,A){var B=OpenLayers.Util.getElement(C);if(B){if(!this.nodeTypeCompare(B,A)){B.parentNode.removeChild(B);B=this.nodeFactory(C,A)}}else{B=this.createNode(A,C)}return B},nodeTypeCompare:function(B,A){},createNode:function(A,B){},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.Tile=OpenLayers.Class({EVENT_TYPES:["loadstart","loadend","reload","unload"],events:null,id:null,layer:null,url:null,bounds:null,size:null,position:null,isLoading:false,initialize:function(D,A,E,B,C){this.layer=D;this.position=A.clone();this.bounds=E.clone();this.url=B;this.size=C.clone();this.id=OpenLayers.Util.createUniqueID("Tile_");this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES)},unload:function(){if(this.isLoading){this.isLoading=false;this.events.triggerEvent("unload")}},destroy:function(){this.layer=null;this.bounds=null;this.size=null;this.position=null;this.events.destroy();this.events=null},clone:function(A){if(A==null){A=new OpenLayers.Tile(this.layer,this.position,this.bounds,this.url,this.size)}OpenLayers.Util.applyDefaults(A,this);return A},draw:function(){var A=this.layer.maxExtent;var B=(A&&this.bounds.intersectsBounds(A,false));this.shouldDraw=(B||this.layer.displayOutsideMaxExtent);this.clear();return this.shouldDraw},moveTo:function(B,A,C){if(C==null){C=true}this.bounds=B.clone();this.position=A.clone();if(C){this.draw()}},clear:function(){},getBoundsFromBaseLayer:function(A){var F=OpenLayers.i18n("reprojectDeprecated",{layerName:this.layer.name});OpenLayers.Console.warn(F);var D=this.layer.map.getLonLatFromLayerPx(A);var C=A.clone();C.x+=this.size.w;C.y+=this.size.h;var B=this.layer.map.getLonLatFromLayerPx(C);if(D.lon>B.lon){if(D.lon<0){D.lon=-180-(D.lon+180)}else{B.lon=180+B.lon+180}}var E=new OpenLayers.Bounds(D.lon,B.lat,B.lon,D.lat);return E},showTile:function(){if(this.shouldDraw){this.show()}},show:function(){},hide:function(){},CLASS_NAME:"OpenLayers.Tile"});OpenLayers.Handler=OpenLayers.Class({id:null,control:null,map:null,keyMask:null,active:false,evt:null,initialize:function(C,B,A){OpenLayers.Util.extend(this,A);this.control=C;this.callbacks=B;if(C.map){this.setMap(C.map)}OpenLayers.Util.extend(this,A);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},setMap:function(A){this.map=A},checkModifiers:function(A){if(this.keyMask==null){return true}var B=(A.shiftKey?OpenLayers.Handler.MOD_SHIFT:0)|(A.ctrlKey?OpenLayers.Handler.MOD_CTRL:0)|(A.altKey?OpenLayers.Handler.MOD_ALT:0);return(B==this.keyMask)},activate:function(){if(this.active){return false}var C=OpenLayers.Events.prototype.BROWSER_EVENTS;for(var B=0,A=C.length;B<A;B++){if(this[C[B]]){this.register(C[B],this[C[B]])}}this.active=true;return true},deactivate:function(){if(!this.active){return false}var C=OpenLayers.Events.prototype.BROWSER_EVENTS;for(var B=0,A=C.length;B<A;B++){if(this[C[B]]){this.unregister(C[B],this[C[B]])}}this.active=false;return true},callback:function(B,A){if(B&&this.callbacks[B]){this.callbacks[B].apply(this.control,A)}},register:function(A,B){this.map.events.registerPriority(A,this,B);this.map.events.registerPriority(A,this,this.setEvent)},unregister:function(A,B){this.map.events.unregister(A,this,B);this.map.events.unregister(A,this,this.setEvent)},setEvent:function(A){this.evt=A;return true},destroy:function(){this.deactivate();this.control=this.map=null},CLASS_NAME:"OpenLayers.Handler"});OpenLayers.Handler.MOD_NONE=0;OpenLayers.Handler.MOD_SHIFT=1;OpenLayers.Handler.MOD_CTRL=2;OpenLayers.Handler.MOD_ALT=4;OpenLayers.Map=OpenLayers.Class({Z_INDEX_BASE:{BaseLayer:100,Overlay:325,Feature:725,Popup:750,Control:1000},EVENT_TYPES:["preaddlayer","addlayer","removelayer","changelayer","movestart","move","moveend","zoomend","popupopen","popupclose","addmarker","removemarker","clearmarkers","mouseover","mouseout","mousemove","dragstart","drag","dragend","changebaselayer"],id:null,fractionalZoom:false,events:null,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,paddingForPopups:null,initialize:function(H,D){this.tileSize=new OpenLayers.Size(OpenLayers.Map.TILE_WIDTH,OpenLayers.Map.TILE_HEIGHT);this.maxExtent=new OpenLayers.Bounds(-180,-90,180,90);this.paddingForPopups=new OpenLayers.Bounds(15,15,15,15);this.theme=OpenLayers._getScriptLocation()+"theme/default/style.css";OpenLayers.Util.extend(this,D);this.id=OpenLayers.Util.createUniqueID("OpenLayers.Map_");this.div=OpenLayers.Util.getElement(H);OpenLayers.Element.addClass(this.div,"olMap");var G=this.div.id+"_OpenLayers_ViewPort";this.viewPortDiv=OpenLayers.Util.createDiv(G,null,null,null,"relative",null,"hidden");this.viewPortDiv.style.width="100%";this.viewPortDiv.style.height="100%";this.viewPortDiv.className="olMapViewport";this.div.appendChild(this.viewPortDiv);G=this.div.id+"_OpenLayers_Container";this.layerContainerDiv=OpenLayers.Util.createDiv(G);this.layerContainerDiv.style.zIndex=this.Z_INDEX_BASE.Popup-1;this.viewPortDiv.appendChild(this.layerContainerDiv);this.events=new OpenLayers.Events(this,this.div,this.EVENT_TYPES,this.fallThrough,{includeXY:true});this.updateSize();if(this.eventListeners instanceof Object){this.events.on(this.eventListeners)}this.events.register("movestart",this,this.updateSize);if(OpenLayers.String.contains(navigator.appName,"Microsoft")){this.events.register("resize",this,this.updateSize)}else{this.updateSizeDestroy=OpenLayers.Function.bind(this.updateSize,this);OpenLayers.Event.observe(window,"resize",this.updateSizeDestroy)}if(this.theme){var F=true;var C=document.getElementsByTagName("link");for(var E=0,A=C.length;E<A;++E){if(OpenLayers.Util.isEquivalentUrl(C.item(E).href,this.theme)){F=false;break}}if(F){var B=document.createElement("link");B.setAttribute("rel","stylesheet");B.setAttribute("type","text/css");B.setAttribute("href",this.theme);document.getElementsByTagName("head")[0].appendChild(B)}}this.layers=[];if(this.controls==null){if(OpenLayers.Control!=null){this.controls=[new OpenLayers.Control.Navigation(),new OpenLayers.Control.PanZoom(),new OpenLayers.Control.ArgParser(),new OpenLayers.Control.Attribution()]}else{this.controls=[]}}for(var E=0,A=this.controls.length;E<A;E++){this.addControlToMap(this.controls[E])}this.popups=[];this.unloadDestroy=OpenLayers.Function.bind(this.destroy,this);OpenLayers.Event.observe(window,"unload",this.unloadDestroy)},unloadDestroy:null,updateSizeDestroy:null,destroy:function(){if(!this.unloadDestroy){return false}OpenLayers.Event.stopObserving(window,"unload",this.unloadDestroy);this.unloadDestroy=null;if(this.updateSizeDestroy){OpenLayers.Event.stopObserving(window,"resize",this.updateSizeDestroy)}else{this.events.unregister("resize",this,this.updateSize)}this.paddingForPopups=null;if(this.controls!=null){for(var A=this.controls.length-1;A>=0;--A){this.controls[A].destroy()}this.controls=null}if(this.layers!=null){for(var A=this.layers.length-1;A>=0;--A){this.layers[A].destroy(false)}this.layers=null}if(this.viewPortDiv){this.div.removeChild(this.viewPortDiv)}this.viewPortDiv=null;if(this.eventListeners){this.events.un(this.eventListeners);this.eventListeners=null}this.events.destroy();this.events=null},setOptions:function(A){OpenLayers.Util.extend(this,A)},getTileSize:function(){return this.tileSize},getBy:function(E,C,A){var D=(typeof A.test=="function");var B=OpenLayers.Array.filter(this[E],function(F){return F[C]==A||(D&&A.test(F[C]))});return B},getLayersBy:function(B,A){return this.getBy("layers",B,A)},getLayersByName:function(A){return this.getLayersBy("name",A)},getLayersByClass:function(A){return this.getLayersBy("CLASS_NAME",A)},getControlsBy:function(B,A){return this.getBy("controls",B,A)},getControlsByClass:function(A){return this.getControlsBy("CLASS_NAME",A)},getLayer:function(E){var B=null;for(var D=0,A=this.layers.length;D<A;D++){var C=this.layers[D];if(C.id==E){B=C;break}}return B},setLayerZIndex:function(B,A){B.setZIndex(this.Z_INDEX_BASE[B.isBaseLayer?"BaseLayer":"Overlay"]+A*5)},resetLayersZIndex:function(){for(var C=0,A=this.layers.length;C<A;C++){var B=this.layers[C];this.setLayerZIndex(B,C)}},addLayer:function(C){for(var B=0,A=this.layers.length;B<A;B++){if(this.layers[B]==C){var D=OpenLayers.i18n("layerAlreadyAdded",{layerName:C.name});OpenLayers.Console.warn(D);return false}}this.events.triggerEvent("preaddlayer",{layer:C});C.div.className="olLayerDiv";C.div.style.overflow="";this.setLayerZIndex(C,this.layers.length);if(C.isFixed){this.viewPortDiv.appendChild(C.div)}else{this.layerContainerDiv.appendChild(C.div)}this.layers.push(C);C.setMap(this);if(C.isBaseLayer){if(this.baseLayer==null){this.setBaseLayer(C)}else{C.setVisibility(false)}}else{C.redraw()}this.events.triggerEvent("addlayer",{layer:C})},addLayers:function(C){for(var B=0,A=C.length;B<A;B++){this.addLayer(C[B])}},removeLayer:function(C,E){if(E==null){E=true}if(C.isFixed){this.viewPortDiv.removeChild(C.div)}else{this.layerContainerDiv.removeChild(C.div)}OpenLayers.Util.removeItem(this.layers,C);C.removeMap(this);C.map=null;if(this.baseLayer==C){this.baseLayer=null;if(E){for(var B=0,A=this.layers.length;B<A;B++){var D=this.layers[B];if(D.isBaseLayer){this.setBaseLayer(D);break}}}}this.resetLayersZIndex();this.events.triggerEvent("removelayer",{layer:C})},getNumLayers:function(){return this.layers.length},getLayerIndex:function(A){return OpenLayers.Util.indexOf(this.layers,A)},setLayerIndex:function(D,B){var E=this.getLayerIndex(D);if(B<0){B=0}else{if(B>this.layers.length){B=this.layers.length}}if(E!=B){this.layers.splice(E,1);this.layers.splice(B,0,D);for(var C=0,A=this.layers.length;C<A;C++){this.setLayerZIndex(this.layers[C],C)}this.events.triggerEvent("changelayer",{layer:D,property:"order"})}},raiseLayer:function(B,C){var A=this.getLayerIndex(B)+C;this.setLayerIndex(B,A)},setBaseLayer:function(E){var D=null;if(this.baseLayer){D=this.baseLayer.getExtent()}if(E!=this.baseLayer){if(OpenLayers.Util.indexOf(this.layers,E)!=-1){if(this.baseLayer!=null){this.baseLayer.setVisibility(false)}this.baseLayer=E;this.viewRequestID++;this.baseLayer.visibility=true;var A=this.getCenter();if(A!=null){var B=(D)?D.getCenterLonLat():A;var C=(D)?this.getZoomForExtent(D,true):this.getZoomForResolution(this.resolution,true);this.setCenter(B,C,false,true)}this.events.triggerEvent("changebaselayer",{layer:this.baseLayer})}}},addControl:function(B,A){this.controls.push(B);this.addControlToMap(B,A)},addControlToMap:function(B,A){B.outsideViewport=(B.div!=null);if(this.displayProjection&&!B.displayProjection){B.displayProjection=this.displayProjection}B.setMap(this);var C=B.draw(A);if(C){if(!B.outsideViewport){C.style.zIndex=this.Z_INDEX_BASE.Control+this.controls.length;this.viewPortDiv.appendChild(C)}}},getControl:function(E){var B=null;for(var C=0,A=this.controls.length;C<A;C++){var D=this.controls[C];if(D.id==E){B=D;break}}return B},removeControl:function(A){if((A)&&(A==this.getControl(A.id))){if(A.div&&(A.div.parentNode==this.viewPortDiv)){this.viewPortDiv.removeChild(A.div)}OpenLayers.Util.removeItem(this.controls,A)}},addPopup:function(A,D){if(D){for(var B=this.popups.length-1;B>=0;--B){this.removePopup(this.popups[B])}}A.map=this;this.popups.push(A);var C=A.draw();if(C){C.style.zIndex=this.Z_INDEX_BASE.Popup+this.popups.length;this.layerContainerDiv.appendChild(C)}},removePopup:function(A){OpenLayers.Util.removeItem(this.popups,A);if(A.div){try{this.layerContainerDiv.removeChild(A.div)}catch(B){}}A.map=null},getSize:function(){var A=null;if(this.size!=null){A=this.size.clone()}return A},updateSize:function(){this.events.clearMouseCache();var C=this.getCurrentSize();var F=this.getSize();if(F==null){this.size=F=C}if(!C.equals(F)){this.size=C;for(var D=0,B=this.layers.length;D<B;D++){this.layers[D].onMapResize()}if(this.baseLayer!=null){var A=new OpenLayers.Pixel(C.w/2,C.h/2);var G=this.getLonLatFromViewPortPx(A);var E=this.getZoom();this.zoom=null;this.setCenter(this.getCenter(),E)}}},getCurrentSize:function(){var A=new OpenLayers.Size(this.div.clientWidth,this.div.clientHeight);if(A.w==0&&A.h==0||isNaN(A.w)&&isNaN(A.h)){var B=OpenLayers.Element.getDimensions(this.div);A.w=B.width;A.h=B.height}if(A.w==0&&A.h==0||isNaN(A.w)&&isNaN(A.h)){A.w=parseInt(this.div.style.width);A.h=parseInt(this.div.style.height)}return A},calculateBounds:function(A,B){var E=null;if(A==null){A=this.getCenter()}if(B==null){B=this.getResolution()}if((A!=null)&&(B!=null)){var D=this.getSize();var F=D.w*B;var C=D.h*B;E=new OpenLayers.Bounds(A.lon-F/2,A.lat-C/2,A.lon+F/2,A.lat+C/2)}return E},getCenter:function(){return this.center},getZoom:function(){return this.zoom},pan:function(D,C,E){E=OpenLayers.Util.applyDefaults(E,{animate:true,dragging:false});var F=this.getViewPortPxFromLonLat(this.getCenter());var B=F.add(D,C);if(!E.dragging||!B.equals(F)){var A=this.getLonLatFromViewPortPx(B);if(E.animate){this.panTo(A)}else{this.setCenter(A,null,E.dragging)}}},panTo:function(B){if(this.panMethod&&this.getExtent().scale(this.panRatio).containsLonLat(B)){if(!this.panTween){this.panTween=new OpenLayers.Tween(this.panMethod)}var A=this.getCenter();if(B.lon==A.lon&&B.lat==A.lat){return }var D={lon:A.lon,lat:A.lat};var C={lon:B.lon,lat:B.lat};this.panTween.start(D,C,50,{callbacks:{start:OpenLayers.Function.bind(function(E){this.events.triggerEvent("movestart")},this),eachStep:OpenLayers.Function.bind(function(E){E=new OpenLayers.LonLat(E.lon,E.lat);this.moveTo(E,this.zoom,{dragging:true,noEvent:true})},this),done:OpenLayers.Function.bind(function(E){E=new OpenLayers.LonLat(E.lon,E.lat);this.moveTo(E,this.zoom,{noEvent:true});this.events.triggerEvent("moveend")},this)}})}else{this.setCenter(B)}},setCenter:function(C,A,B,D){this.moveTo(C,A,{dragging:B,forceZoomChange:D,caller:"setCenter"})},moveTo:function(G,M,P){if(!P){P={}}var L=P.dragging;var C=P.forceZoomChange;var H=P.noEvent;if(this.panTween&&P.caller=="setCenter"){this.panTween.stop()}if(!this.center&&!this.isValidLonLat(G)){G=this.maxExtent.getCenterLonLat()}if(this.restrictedExtent!=null){if(G==null){G=this.getCenter()}if(M==null){M=this.getZoom()}var D=this.getResolutionForZoom(M);var N=this.calculateBounds(G,D);if(!this.restrictedExtent.containsBounds(N)){var O=this.restrictedExtent.getCenterLonLat();if(N.getWidth()>this.restrictedExtent.getWidth()){G=new OpenLayers.LonLat(O.lon,G.lat)}else{if(N.left<this.restrictedExtent.left){G=G.add(this.restrictedExtent.left-N.left,0)}else{if(N.right>this.restrictedExtent.right){G=G.add(this.restrictedExtent.right-N.right,0)}}}if(N.getHeight()>this.restrictedExtent.getHeight()){G=new OpenLayers.LonLat(G.lon,O.lat)}else{if(N.bottom<this.restrictedExtent.bottom){G=G.add(0,this.restrictedExtent.bottom-N.bottom)}else{if(N.top>this.restrictedExtent.top){G=G.add(0,this.restrictedExtent.top-N.top)}}}}}var B=C||((this.isValidZoomLevel(M))&&(M!=this.getZoom()));var E=(this.isValidLonLat(G))&&(!G.equals(this.center));if(B||E||!L){if(!this.dragging&&!H){this.events.triggerEvent("movestart")}if(E){if((!B)&&(this.center)){this.centerLayerContainer(G)}this.center=G.clone()}if((B)||(this.layerContainerOrigin==null)){this.layerContainerOrigin=this.center.clone();this.layerContainerDiv.style.left="0px";this.layerContainerDiv.style.top="0px"}if(B){this.zoom=M;this.resolution=this.getResolutionForZoom(M);this.viewRequestID++}var A=this.getExtent();this.baseLayer.moveTo(A,B,L);A=this.baseLayer.getExtent();for(var F=0,J=this.layers.length;F<J;F++){var I=this.layers[F];if(!I.isBaseLayer){var K=I.calculateInRange();if(I.inRange!=K){I.inRange=K;if(!K){I.display(false)}this.events.triggerEvent("changelayer",{layer:I,property:"visibility"})}if(K&&I.visibility){I.moveTo(A,B,L);I.events.triggerEvent("moveend",{zoomChanged:B})}}}if(B){for(var F=0,J=this.popups.length;F<J;F++){this.popups[F].updatePosition()}}this.events.triggerEvent("move");if(B){this.events.triggerEvent("zoomend")}}if(!L&&!H){this.events.triggerEvent("moveend")}this.dragging=!!L},centerLayerContainer:function(B){var A=this.getViewPortPxFromLonLat(this.layerContainerOrigin);var C=this.getViewPortPxFromLonLat(B);if((A!=null)&&(C!=null)){this.layerContainerDiv.style.left=Math.round(A.x-C.x)+"px";this.layerContainerDiv.style.top=Math.round(A.y-C.y)+"px"}},isValidZoomLevel:function(A){return((A!=null)&&(A>=0)&&(A<this.getNumZoomLevels()))},isValidLonLat:function(C){var B=false;if(C!=null){var A=this.getMaxExtent();B=A.containsLonLat(C)}return B},getProjection:function(){var A=this.getProjectionObject();return A?A.getCode():null},getProjectionObject:function(){var A=null;if(this.baseLayer!=null){A=this.baseLayer.projection}return A},getMaxResolution:function(){var A=null;if(this.baseLayer!=null){A=this.baseLayer.maxResolution}return A},getMaxExtent:function(B){var A=null;if(B&&B.restricted&&this.restrictedExtent){A=this.restrictedExtent}else{if(this.baseLayer!=null){A=this.baseLayer.maxExtent}}return A},getNumZoomLevels:function(){var A=null;if(this.baseLayer!=null){A=this.baseLayer.numZoomLevels}return A},getExtent:function(){var A=null;if(this.baseLayer!=null){A=this.baseLayer.getExtent()}return A},getResolution:function(){var A=null;if(this.baseLayer!=null){A=this.baseLayer.getResolution()}return A},getUnits:function(){var A=null;if(this.baseLayer!=null){A=this.baseLayer.units}return A},getScale:function(){var C=null;if(this.baseLayer!=null){var B=this.getResolution();var A=this.baseLayer.units;C=OpenLayers.Util.getScaleFromResolution(B,A)}return C},getZoomForExtent:function(C,B){var A=null;if(this.baseLayer!=null){A=this.baseLayer.getZoomForExtent(C,B)}return A},getResolutionForZoom:function(B){var A=null;if(this.baseLayer){A=this.baseLayer.getResolutionForZoom(B)}return A},getZoomForResolution:function(A,C){var B=null;if(this.baseLayer!=null){B=this.baseLayer.getZoomForResolution(A,C)}return B},zoomTo:function(A){if(this.isValidZoomLevel(A)){this.setCenter(null,A)}},zoomIn:function(){this.zoomTo(this.getZoom()+1)},zoomOut:function(){this.zoomTo(this.getZoom()-1)},zoomToExtent:function(D,C){var B=D.getCenterLonLat();if(this.baseLayer.wrapDateLine){var A=this.getMaxExtent();D=D.clone();while(D.right<D.left){D.right+=A.getWidth()}B=D.getCenterLonLat().wrapDateLine(A)}this.setCenter(B,this.getZoomForExtent(D,C))},zoomToMaxExtent:function(C){var B=(C)?C.restricted:true;var A=this.getMaxExtent({restricted:B});this.zoomToExtent(A)},zoomToScale:function(H,G){var D=OpenLayers.Util.getResolutionFromScale(H,this.baseLayer.units);var C=this.getSize();var F=C.w*D;var B=C.h*D;var A=this.getCenter();var E=new OpenLayers.Bounds(A.lon-F/2,A.lat-B/2,A.lon+F/2,A.lat+B/2);this.zoomToExtent(E,G)},getLonLatFromViewPortPx:function(A){var B=null;if(this.baseLayer!=null){B=this.baseLayer.getLonLatFromViewPortPx(A)}return B},getViewPortPxFromLonLat:function(B){var A=null;if(this.baseLayer!=null){A=this.baseLayer.getViewPortPxFromLonLat(B)}return A},getLonLatFromPixel:function(A){return this.getLonLatFromViewPortPx(A)},getPixelFromLonLat:function(B){var A=this.getViewPortPxFromLonLat(B);A.x=Math.round(A.x);A.y=Math.round(A.y);return A},getViewPortPxFromLayerPx:function(D){var C=null;if(D!=null){var B=parseInt(this.layerContainerDiv.style.left);var A=parseInt(this.layerContainerDiv.style.top);C=D.add(B,A)}return C},getLayerPxFromViewPortPx:function(C){var D=null;if(C!=null){var B=-parseInt(this.layerContainerDiv.style.left);var A=-parseInt(this.layerContainerDiv.style.top);D=C.add(B,A);if(isNaN(D.x)||isNaN(D.y)){D=null}}return D},getLonLatFromLayerPx:function(A){A=this.getViewPortPxFromLayerPx(A);return this.getLonLatFromViewPortPx(A)},getLayerPxFromLonLat:function(B){var A=this.getPixelFromLonLat(B);return this.getLayerPxFromViewPortPx(A)},CLASS_NAME:"OpenLayers.Map"});OpenLayers.Map.TILE_WIDTH=256;OpenLayers.Map.TILE_HEIGHT=256;OpenLayers.Marker=OpenLayers.Class({icon:null,lonlat:null,events:null,map:null,initialize:function(C,B){this.lonlat=C;var A=(B)?B:OpenLayers.Marker.defaultIcon();if(this.icon==null){this.icon=A}else{this.icon.url=A.url;this.icon.size=A.size;this.icon.offset=A.offset;this.icon.calculateOffset=A.calculateOffset}this.events=new OpenLayers.Events(this,this.icon.imageDiv,null)},destroy:function(){this.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)},moveTo:function(A){if((A!=null)&&(this.icon!=null)){this.icon.moveTo(A)}this.lonlat=this.map.getLonLatFromLayerPx(A)},onScreen:function(){var B=false;if(this.map){var A=this.map.getExtent();B=A.containsLonLat(this.lonlat)}return B},inflate:function(B){if(this.icon){var A=new OpenLayers.Size(this.icon.size.w*B,this.icon.size.h*B);this.icon.setSize(A)}},setOpacity:function(A){this.icon.setOpacity(A)},setUrl:function(A){this.icon.setUrl(A)},display:function(A){this.icon.display(A)},CLASS_NAME:"OpenLayers.Marker"});OpenLayers.Marker.defaultIcon=function(){var A=OpenLayers.Util.getImagesLocation()+"marker.png";var B=new OpenLayers.Size(21,25);var C=function(D){return new OpenLayers.Pixel(-(D.w/2),-D.h)};return new OpenLayers.Icon(A,B,null,C)};OpenLayers.Popup.AnchoredBubble=OpenLayers.Class(OpenLayers.Popup.Anchored,{rounded:false,initialize:function(G,C,F,B,A,E,D){this.padding=new OpenLayers.Bounds(0,OpenLayers.Popup.AnchoredBubble.CORNER_SIZE,0,OpenLayers.Popup.AnchoredBubble.CORNER_SIZE);OpenLayers.Popup.Anchored.prototype.initialize.apply(this,arguments)},draw:function(A){OpenLayers.Popup.Anchored.prototype.draw.apply(this,arguments);this.setContentHTML();this.setBackgroundColor();this.setOpacity();return this.div},updateRelativePosition:function(){this.setRicoCorners()},setSize:function(A){OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments);this.setRicoCorners()},setBackgroundColor:function(A){if(A!=undefined){this.backgroundColor=A}if(this.div!=null){if(this.contentDiv!=null){this.div.style.background="transparent";OpenLayers.Rico.Corner.changeColor(this.groupDiv,this.backgroundColor)}}},setOpacity:function(A){OpenLayers.Popup.Anchored.prototype.setOpacity.call(this,A);if(this.div!=null){if(this.groupDiv!=null){OpenLayers.Rico.Corner.changeOpacity(this.groupDiv,this.opacity)}}},setBorder:function(A){this.border=0},setRicoCorners:function(){var A=this.getCornersToRound(this.relativePosition);var B={corners:A,color:this.backgroundColor,bgColor:"transparent",blend:false};if(!this.rounded){OpenLayers.Rico.Corner.round(this.div,B);this.rounded=true}else{OpenLayers.Rico.Corner.reRound(this.groupDiv,B);this.setBackgroundColor();this.setOpacity()}},getCornersToRound:function(){var A=["tl","tr","bl","br"];var B=OpenLayers.Bounds.oppositeQuadrant(this.relativePosition);OpenLayers.Util.removeItem(A,B);return A.join(" ")},CLASS_NAME:"OpenLayers.Popup.AnchoredBubble"});OpenLayers.Popup.AnchoredBubble.CORNER_SIZE=5;OpenLayers.Popup.Framed=OpenLayers.Class(OpenLayers.Popup.Anchored,{imageSrc:null,imageSize:null,isAlphaImage:false,positionBlocks:null,blocks:null,fixedRelativePosition:false,initialize:function(G,C,F,B,A,E,D){OpenLayers.Popup.Anchored.prototype.initialize.apply(this,arguments);if(this.fixedRelativePosition){this.updateRelativePosition();this.calculateRelativePosition=function(H){return this.relativePosition}}this.contentDiv.style.position="absolute";this.contentDiv.style.zIndex=1;if(E){this.closeDiv.style.zIndex=1}this.groupDiv.style.position="absolute";this.groupDiv.style.top="0px";this.groupDiv.style.left="0px";this.groupDiv.style.height="100%";this.groupDiv.style.width="100%"},destroy:function(){this.imageSrc=null;this.imageSize=null;this.isAlphaImage=null;this.fixedRelativePosition=false;this.positionBlocks=null;for(var A=0;A<this.blocks.length;A++){var B=this.blocks[A];if(B.image){B.div.removeChild(B.image)}B.image=null;if(B.div){this.groupDiv.removeChild(B.div)}B.div=null}this.blocks=null;OpenLayers.Popup.Anchored.prototype.destroy.apply(this,arguments)},setBackgroundColor:function(A){},setBorder:function(){},setOpacity:function(A){},setSize:function(A){OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments);this.updateBlocks()},updateRelativePosition:function(){this.padding=this.positionBlocks[this.relativePosition].padding;if(this.closeDiv){var A=this.getContentDivPadding();this.closeDiv.style.right=A.right+this.padding.right+"px";this.closeDiv.style.top=A.top+this.padding.top+"px"}this.updateBlocks()},calculateNewPx:function(A){var B=OpenLayers.Popup.Anchored.prototype.calculateNewPx.apply(this,arguments);B=B.offset(this.positionBlocks[this.relativePosition].offset);return B},createBlocks:function(){this.blocks=[];var F=null;for(var E in this.positionBlocks){F=E;break}var A=this.positionBlocks[F];for(var D=0;D<A.blocks.length;D++){var H={};this.blocks.push(H);var B=this.id+"_FrameDecorationDiv_"+D;H.div=OpenLayers.Util.createDiv(B,null,null,null,"absolute",null,"hidden",null);var C=this.id+"_FrameDecorationImg_"+D;var G=(this.isAlphaImage)?OpenLayers.Util.createAlphaImageDiv:OpenLayers.Util.createImage;H.image=G(C,null,this.imageSize,this.imageSrc,"absolute",null,null,null);H.div.appendChild(H.image);this.groupDiv.appendChild(H.div)}},updateBlocks:function(){if(!this.blocks){this.createBlocks()}if(this.size&&this.relativePosition){var G=this.positionBlocks[this.relativePosition];for(var E=0;E<G.blocks.length;E++){var B=G.blocks[E];var D=this.blocks[E];var C=B.anchor.left;var H=B.anchor.bottom;var A=B.anchor.right;var J=B.anchor.top;var I=(isNaN(B.size.w))?this.size.w-(A+C):B.size.w;var F=(isNaN(B.size.h))?this.size.h-(H+J):B.size.h;D.div.style.width=I+"px";D.div.style.height=F+"px";D.div.style.left=(C!=null)?C+"px":"";D.div.style.bottom=(H!=null)?H+"px":"";D.div.style.right=(A!=null)?A+"px":"";D.div.style.top=(J!=null)?J+"px":"";D.image.style.left=B.position.x+"px";D.image.style.top=B.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.Renderer.SVG=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"http://www.w3.org/2000/svg",xlinkns:"http://www.w3.org/1999/xlink",MAX_PIXEL:15000,translationParameters:null,symbolSize:{},initialize:function(A){if(!this.supported()){return }OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments);this.translationParameters={x:0,y:0}},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments)},supported:function(){var A="http://www.w3.org/TR/SVG11/feature#";return(document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature(A+"SVG","1.1")||document.implementation.hasFeature(A+"BasicStructure","1.1")))},inValidRange:function(A,E,B){var D=A+(B?0:this.translationParameters.x);var C=E+(B?0:this.translationParameters.y);return(D>=-this.MAX_PIXEL&&D<=this.MAX_PIXEL&&C>=-this.MAX_PIXEL&&C<=this.MAX_PIXEL)},setExtent:function(B,D){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var A=this.getResolution();var F=-B.left/A;var E=B.top/A;if(D){this.left=F;this.top=E;var C="0 0 "+this.size.w+" "+this.size.h;this.rendererRoot.setAttributeNS(null,"viewBox",C);this.translate(0,0);return true}else{var G=this.translate(F-this.left,E-this.top);if(!G){this.setExtent(B,true)}return G}},translate:function(A,C){if(!this.inValidRange(A,C,true)){return false}else{var B="";if(A||C){B="translate("+A+","+C+")"}this.root.setAttributeNS(null,"transform",B);this.translationParameters={x:A,y:C};return true}},setSize:function(A){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);this.rendererRoot.setAttributeNS(null,"width",this.size.w);this.rendererRoot.setAttributeNS(null,"height",this.size.h)},getNodeType:function(C,B){var A=null;switch(C.CLASS_NAME){case"OpenLayers.Geometry.Point":if(B.externalGraphic){A="image"}else{if(this.isComplexSymbol(B.graphicName)){A="use"}else{A="circle"}}break;case"OpenLayers.Geometry.Rectangle":A="rect";break;case"OpenLayers.Geometry.LineString":A="polyline";break;case"OpenLayers.Geometry.LinearRing":A="polygon";break;case"OpenLayers.Geometry.Polygon":case"OpenLayers.Geometry.Curve":case"OpenLayers.Geometry.Surface":A="path";break;default:break}return A},setStyle:function(F,C,P){C=C||F._style;P=P||F._options;var A=parseFloat(F.getAttributeNS(null,"r"));var K=1;var L;if(F._geometryClass=="OpenLayers.Geometry.Point"&&A){if(C.externalGraphic){L=this.getPosition(F);if(C.graphicWidth&&C.graphicHeight){F.setAttributeNS(null,"preserveAspectRatio","none")}var E=C.graphicWidth||C.graphicHeight;var M=C.graphicHeight||C.graphicWidth;E=E?E:C.pointRadius*2;M=M?M:C.pointRadius*2;var J=(C.graphicXOffset!=undefined)?C.graphicXOffset:-(0.5*E);var G=(C.graphicYOffset!=undefined)?C.graphicYOffset:-(0.5*M);var I=C.graphicOpacity||C.fillOpacity;F.setAttributeNS(null,"x",(L.x+J).toFixed());F.setAttributeNS(null,"y",(L.y+G).toFixed());F.setAttributeNS(null,"width",E);F.setAttributeNS(null,"height",M);F.setAttributeNS(this.xlinkns,"href",C.externalGraphic);F.setAttributeNS(null,"style","opacity: "+I)}else{if(this.isComplexSymbol(C.graphicName)){var H=C.pointRadius*3;var O=H*2;var D=this.importSymbol(C.graphicName);var B="#"+D;L=this.getPosition(F);K=this.symbolSize[D]/O;if(F.getAttributeNS(this.xlinkns,"href")!=B){F.setAttributeNS(this.xlinkns,"href",B)}else{if(O!=parseFloat(F.getAttributeNS(null,"width"))){F.style.visibility="hidden";this.container.scrollLeft=this.container.scrollLeft}}F.setAttributeNS(null,"width",O);F.setAttributeNS(null,"height",O);F.setAttributeNS(null,"x",L.x-H);F.setAttributeNS(null,"y",L.y-H);F.style.visibility=""}else{F.setAttributeNS(null,"r",C.pointRadius)}}if(typeof C.rotation!="undefined"&&L){var N=OpenLayers.String.format("rotate(${0} ${1} ${2})",[C.rotation,L.x,L.y]);F.setAttributeNS(null,"transform",N)}}if(P.isFilled){F.setAttributeNS(null,"fill",C.fillColor);F.setAttributeNS(null,"fill-opacity",C.fillOpacity)}else{F.setAttributeNS(null,"fill","none")}if(P.isStroked){F.setAttributeNS(null,"stroke",C.strokeColor);F.setAttributeNS(null,"stroke-opacity",C.strokeOpacity);F.setAttributeNS(null,"stroke-width",C.strokeWidth*K);F.setAttributeNS(null,"stroke-linecap",C.strokeLinecap);F.setAttributeNS(null,"stroke-linejoin","round");F.setAttributeNS(null,"stroke-dasharray",this.dashStyle(C,K))}else{F.setAttributeNS(null,"stroke","none")}if(C.pointerEvents){F.setAttributeNS(null,"pointer-events",C.pointerEvents)}if(C.cursor!=null){F.setAttributeNS(null,"cursor",C.cursor)}return F},dashStyle:function(C,B){var A=C.strokeWidth*B;switch(C.strokeDashstyle){case"solid":return"none";case"dot":return[1,4*A].join();case"dash":return[4*A,4*A].join();case"dashdot":return[4*A,4*A,1,4*A].join();case"longdash":return[8*A,4*A].join();case"longdashdot":return[8*A,4*A,1,4*A].join();default:return C.strokeDashstyle.replace(/ /g,",")}},createNode:function(A,C){var B=document.createElementNS(this.xmlns,A);if(C){B.setAttributeNS(null,"id",C)}return B},nodeTypeCompare:function(B,A){return(A==B.nodeName)},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_svgRoot","svg")},createRoot:function(){return this.nodeFactory(this.container.id+"_root","g")},createDefs:function(){var A=this.nodeFactory("ol-renderer-defs","defs");this.rendererRoot.appendChild(A);return A},drawPoint:function(A,B){return this.drawCircle(A,B,1)},drawCircle:function(D,E,B){var C=this.getResolution();var A=(E.x/C+this.left);var F=(this.top-E.y/C);if(this.inValidRange(A,F)){D.setAttributeNS(null,"cx",A);D.setAttributeNS(null,"cy",F);D.setAttributeNS(null,"r",B);return D}else{return false}},drawLineString:function(B,C){var A=this.getComponentsString(C.components);if(A.path){B.setAttributeNS(null,"points",A.path);return(A.complete?B:null)}else{return false}},drawLinearRing:function(B,C){var A=this.getComponentsString(C.components);if(A.path){B.setAttributeNS(null,"points",A.path);return(A.complete?B:null)}else{return false}},drawPolygon:function(B,G){var F="";var H=true;var A=true;var C,I;for(var D=0,E=G.components.length;D<E;D++){F+=" M";C=this.getComponentsString(G.components[D].components," ");I=C.path;if(I){F+=" "+I;A=C.complete&&A}else{H=false}}F+=" z";if(H){B.setAttributeNS(null,"d",F);B.setAttributeNS(null,"fill-rule","evenodd");return A?B:null}else{return false}},drawRectangle:function(C,D){var B=this.getResolution();var A=(D.x/B+this.left);var E=(this.top-D.y/B);if(this.inValidRange(A,E)){C.setAttributeNS(null,"x",A);C.setAttributeNS(null,"y",E);C.setAttributeNS(null,"width",D.width/B);C.setAttributeNS(null,"height",D.height/B);return C}else{return false}},drawSurface:function(E,G){var F=null;var B=true;for(var D=0,A=G.components.length;D<A;D++){if((D%3)==0&&(D/3)==0){var C=this.getShortString(G.components[D]);if(!C){B=false}F="M "+C}else{if((D%3)==1){var C=this.getShortString(G.components[D]);if(!C){B=false}F+=" C "+C}else{var C=this.getShortString(G.components[D]);if(!C){B=false}F+=" "+C}}}F+=" Z";if(B){E.setAttributeNS(null,"d",F);return E}else{return false}},getComponentsString:function(E,D){var G=[];var A=true;var F=E.length;var J=[];var H,I,B;for(var C=0;C<F;C++){I=E[C];G.push(I);H=this.getShortString(I);if(H){J.push(H)}else{if(C>0){if(this.getShortString(E[C-1])){J.push(this.clipLine(E[C],E[C-1]))}}if(C<F-1){if(this.getShortString(E[C+1])){J.push(this.clipLine(E[C],E[C+1]))}}A=false}}return{path:J.join(D||","),complete:A}},clipLine:function(E,H){if(H.equals(E)){return""}var F=this.getResolution();var B=this.MAX_PIXEL-this.translationParameters.x;var A=this.MAX_PIXEL-this.translationParameters.y;var D=H.x/F+this.left;var J=this.top-H.y/F;var C=E.x/F+this.left;var I=this.top-E.y/F;var G;if(C<-B||C>B){G=(I-J)/(C-D);C=C<0?-B:B;I=J+(C-D)*G}if(I<-A||I>A){G=(C-D)/(I-J);I=I<0?-A:A;C=D+(I-J)*G}return C+","+I},getShortString:function(B){var C=this.getResolution();var A=(B.x/C+this.left);var D=(this.top-B.y/C);if(this.inValidRange(A,D)){return A+","+D}else{return false}},getPosition:function(A){return({x:parseFloat(A.getAttributeNS(null,"cx")),y:parseFloat(A.getAttributeNS(null,"cy"))})},importSymbol:function(E){if(!this.defs){this.defs=this.createDefs()}var B=this.container.id+"-"+E;if(document.getElementById(B)!=null){return B}var D=OpenLayers.Renderer.symbol[E];if(!D){throw new Error(E+" is not a valid symbol name");return }var G=this.nodeFactory(B,"symbol");var C=this.nodeFactory(null,"polygon");G.appendChild(C);var L=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0);var J="";var I,H;for(var F=0;F<D.length;F=F+2){I=D[F];H=D[F+1];L.left=Math.min(L.left,I);L.bottom=Math.min(L.bottom,H);L.right=Math.max(L.right,I);L.top=Math.max(L.top,H);J+=" "+I+","+H}C.setAttributeNS(null,"points",J);var A=L.getWidth();var K=L.getHeight();var M=[L.left-A,L.bottom-K,A*3,K*3];G.setAttributeNS(null,"viewBox",M.join(" "));this.symbolSize[B]=Math.max(A,K)*3;this.defs.appendChild(G);return G.id},CLASS_NAME:"OpenLayers.Renderer.SVG"});OpenLayers.Renderer.VML=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"urn:schemas-microsoft-com:vml",symbolCache:{},offset:null,initialize:function(A){if(!this.supported()){return }if(!document.namespaces.olv){document.namespaces.add("olv",this.xmlns);var B=document.createStyleSheet();B.addRule("olv\\:*","behavior: url(#default#VML); position: absolute; display: inline-block;")}OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments);this.offset={x:0,y:0}},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments)},supported:function(){return !!(document.namespaces)},setExtent:function(C,D){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var A=this.getResolution();var F=C.left/A;var E=C.top/A-this.size.h;if(D){this.offset={x:F,y:E};F=0;E=0}else{F=F-this.offset.x;E=E-this.offset.y}var G=F+" "+E;this.root.setAttribute("coordorigin",G);var B=this.size.w+" "+this.size.h;this.root.setAttribute("coordsize",B);this.root.style.flip="y";return true},setSize:function(A){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);this.rendererRoot.style.width=this.size.w+"px";this.rendererRoot.style.height=this.size.h+"px";this.root.style.width=this.size.w+"px";this.root.style.height=this.size.h+"px"},getNodeType:function(C,B){var A=null;switch(C.CLASS_NAME){case"OpenLayers.Geometry.Point":if(B.externalGraphic){A="olv:rect"}else{if(this.isComplexSymbol(B.graphicName)){A="olv:shape"}else{A="olv:oval"}}break;case"OpenLayers.Geometry.Rectangle":A="olv:rect";break;case"OpenLayers.Geometry.LineString":case"OpenLayers.Geometry.LinearRing":case"OpenLayers.Geometry.Polygon":case"OpenLayers.Geometry.Curve":case"OpenLayers.Geometry.Surface":A="olv:shape";break;default:break}return A},setStyle:function(D,B,P,K){B=B||D._style;P=P||D._options;var I=1;if(D._geometryClass=="OpenLayers.Geometry.Point"){if(B.externalGraphic){var C=B.graphicWidth||B.graphicHeight;var L=B.graphicHeight||B.graphicWidth;C=C?C:B.pointRadius*2;L=L?L:B.pointRadius*2;var F=this.getResolution();var H=(B.graphicXOffset!=undefined)?B.graphicXOffset:-(0.5*C);var E=(B.graphicYOffset!=undefined)?B.graphicYOffset:-(0.5*L);D.style.left=((K.x/F-this.offset.x)+H).toFixed();D.style.top=((K.y/F-this.offset.y)-(E+L)).toFixed();D.style.width=C+"px";D.style.height=L+"px";D.style.flip="y";B.fillColor="none";P.isStroked=false}else{if(this.isComplexSymbol(B.graphicName)){var A=this.importSymbol(B.graphicName);var O=A.extent;var C=O.getWidth();var L=O.getHeight();D.setAttribute("path",A.path);D.setAttribute("coordorigin",O.left+","+O.bottom);D.setAttribute("coordsize",C+","+L);D.style.left=O.left+"px";D.style.top=O.bottom+"px";D.style.width=C+"px";D.style.height=L+"px";this.drawCircle(D,K,B.pointRadius);D.style.flip="y"}else{this.drawCircle(D,K,B.pointRadius)}}}if(P.isFilled){D.setAttribute("fillcolor",B.fillColor)}else{D.setAttribute("filled","false")}var J=D.getElementsByTagName("fill");var N=(J.length==0)?null:J[0];if(!P.isFilled){if(N){D.removeChild(N)}}else{if(!N){N=this.createNode("olv:fill",D.id+"_fill")}N.setAttribute("opacity",B.fillOpacity);if(D._geometryClass=="OpenLayers.Geometry.Point"&&B.externalGraphic){if(B.graphicOpacity){N.setAttribute("opacity",B.graphicOpacity)}N.setAttribute("src",B.externalGraphic);N.setAttribute("type","frame");if(!(B.graphicWidth&&B.graphicHeight)){N.aspect="atmost"}}if(N.parentNode!=D){D.appendChild(N)}}if(typeof B.rotation!="undefined"){if(B.externalGraphic){this.graphicRotate(D,H,E);N.setAttribute("opacity",0)}else{D.style.rotation=B.rotation}}if(P.isStroked){D.setAttribute("strokecolor",B.strokeColor);D.setAttribute("strokeweight",B.strokeWidth+"px")}else{D.setAttribute("stroked","false")}var G=D.getElementsByTagName("stroke");var M=(G.length==0)?null:G[0];if(!P.isStroked){if(M){D.removeChild(M)}}else{if(!M){M=this.createNode("olv:stroke",D.id+"_stroke");D.appendChild(M)}M.setAttribute("opacity",B.strokeOpacity);M.setAttribute("endcap",!B.strokeLinecap||B.strokeLinecap=="butt"?"flat":B.strokeLinecap);M.setAttribute("dashstyle",this.dashStyle(B))}if(B.cursor!="inherit"&&B.cursor!=null){D.style.cursor=B.cursor}return D},graphicRotate:function(N,R,F){var Q=Q||N._style;var D=N._options;var A,J;if(!(Q.graphicWidth&&Q.graphicHeight)){var S=new Image();S.onreadystatechange=OpenLayers.Function.bind(function(){if(S.readyState=="complete"||S.readyState=="interactive"){A=S.width/S.height;J=Math.max(Q.pointRadius*2,Q.graphicWidth||0,Q.graphicHeight||0);R=R*A;Q.graphicWidth=J*A;Q.graphicHeight=J;this.graphicRotate(N,R,F)}},this);S.src=Q.externalGraphic;return }else{J=Math.max(Q.graphicWidth,Q.graphicHeight);A=Q.graphicWidth/Q.graphicHeight}var M=Math.round(Q.graphicWidth||J*A);var K=Math.round(Q.graphicHeight||J);N.style.width=M+"px";N.style.height=K+"px";var L=document.getElementById(N.id+"_image");if(!L){L=this.createNode("olv:imagedata",N.id+"_image");N.appendChild(L)}L.style.width=M+"px";L.style.height=K+"px";L.src=Q.externalGraphic;L.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='', sizingMethod='scale')";var O=Q.rotation*Math.PI/180;var H=Math.sin(O);var E=Math.cos(O);var G="progid:DXImageTransform.Microsoft.Matrix(M11="+E+",M12="+(-H)+",M21="+H+",M22="+E+",SizingMethod='auto expand')\n";var B=Q.graphicOpacity||Q.fillOpacity;if(B&&B!=1){G+="progid:DXImageTransform.Microsoft.BasicImage(opacity="+B+")\n"}N.style.filter=G;var P=new OpenLayers.Geometry.Point(-R,-F);var C=new OpenLayers.Bounds(0,0,M,K).toGeometry();C.rotate(Q.rotation,P);var I=C.getBounds();N.style.left=Math.round(parseInt(N.style.left)+I.left)+"px";N.style.top=Math.round(parseInt(N.style.top)-I.bottom)+"px"},postDraw:function(A){var C=A._style.fillColor;var B=A._style.strokeColor;if(C=="none"&&A.getAttribute("fillcolor")!=C){A.setAttribute("fillcolor",C)}if(B=="none"&&A.getAttribute("strokecolor")!=B){A.setAttribute("strokecolor",B)}},setNodeDimension:function(B,E){var D=E.getBounds();if(D){var A=this.getResolution();var C=new OpenLayers.Bounds((D.left/A-this.offset.x).toFixed(),(D.bottom/A-this.offset.y).toFixed(),(D.right/A-this.offset.x).toFixed(),(D.top/A-this.offset.y).toFixed());B.style.left=C.left+"px";B.style.top=C.top+"px";B.style.width=C.getWidth()+"px";B.style.height=C.getHeight()+"px";B.coordorigin=C.left+" "+C.top;B.coordsize=C.getWidth()+" "+C.getHeight()}},dashStyle:function(A){var C=A.strokeDashstyle;switch(C){case"solid":case"dot":case"dash":case"dashdot":case"longdash":case"longdashdot":return C;default:var B=C.split(/[ ,]/);if(B.length==2){if(1*B[0]>=2*B[1]){return"longdash"}return(B[0]==1||B[1]==1)?"dot":"dash"}else{if(B.length==4){return(1*B[0]>=2*B[1])?"longdashdot":"dashdot"}}return"solid"}},createNode:function(A,C){var B=document.createElement(A);if(C){B.setAttribute("id",C)}B.setAttribute("unselectable","on",0);B.onselectstart=function(){return(false)};return B},nodeTypeCompare:function(C,B){var D=B;var A=D.indexOf(":");if(A!=-1){D=D.substr(A+1)}var E=C.nodeName;A=E.indexOf(":");if(A!=-1){E=E.substr(A+1)}return(D==E)},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_vmlRoot","div")},createRoot:function(){return this.nodeFactory(this.container.id+"_root","olv:group")},drawPoint:function(A,B){return this.drawCircle(A,B,1)},drawCircle:function(D,E,A){if(!isNaN(E.x)&&!isNaN(E.y)){var B=this.getResolution();D.style.left=((E.x/B-this.offset.x).toFixed()-A)+"px";D.style.top=((E.y/B-this.offset.y).toFixed()-A)+"px";var C=A*2;D.style.width=C+"px";D.style.height=C+"px";return D}return false},drawLineString:function(A,B){return this.drawLine(A,B,false)},drawLinearRing:function(A,B){return this.drawLine(A,B,true)},drawLine:function(B,J,G){this.setNodeDimension(B,J);var C=this.getResolution();var A=J.components.length;var E=new Array(A);var H,K,I;for(var F=0;F<A;F++){H=J.components[F];K=(H.x/C-this.offset.x);I=(H.y/C-this.offset.y);E[F]=" "+K.toFixed()+","+I.toFixed()+" l "}var D=(G)?" x e":" e";B.path="m"+E.join("")+D;return B},drawPolygon:function(B,J){this.setNodeDimension(B,J);var C=this.getResolution();var L=[];var F,E,D,H,A,G,K,I;for(D=0,H=J.components.length;D<H;D++){F=J.components[D];L.push("m");for(E=0,A=F.components.length;E<A;E++){G=F.components[E];K=G.x/C-this.offset.x;I=G.y/C-this.offset.y;L.push(" "+K.toFixed()+","+I.toFixed());if(E==0){L.push(" l")}}L.push(" x ")}L.push("e");B.path=L.join("");return B},drawRectangle:function(B,C){var A=this.getResolution();B.style.left=(C.x/A-this.offset.x)+"px";B.style.top=(C.y/A-this.offset.y)+"px";B.style.width=C.width/A+"px";B.style.height=C.height/A+"px";return B},drawSurface:function(A,G){this.setNodeDimension(A,G);var B=this.getResolution();var I=[];var D,H,F;for(var C=0,E=G.components.length;C<E;C++){D=G.components[C];H=D.x/B-this.offset.x;F=D.y/B-this.offset.y;if((C%3)==0&&(C/3)==0){I.push("m")}else{if((C%3)==1){I.push(" c")}}I.push(" "+H+","+F)}I.push(" x e");A.path=I.join("");return A},importSymbol:function(B){var H=this.container.id+"-"+B;var A=this.symbolCache[H];if(A){return A}var E=OpenLayers.Renderer.symbol[B];if(!E){throw new Error(B+" is not a valid symbol name");return }var G=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0);var D=["m"];for(var C=0;C<E.length;C=C+2){x=E[C];y=E[C+1];G.left=Math.min(G.left,x);G.bottom=Math.min(G.bottom,y);G.right=Math.max(G.right,x);G.top=Math.max(G.top,y);D.push(x);D.push(y);if(C==0){D.push("l")}}D.push("x e");var F=D.join(" ");A={path:F,extent:G};this.symbolCache[H]=A;return A},CLASS_NAME:"OpenLayers.Renderer.VML"});OpenLayers.Tile.Image=OpenLayers.Class(OpenLayers.Tile,{url:null,imgDiv:null,frame:null,layerAlphaHack:null,isBackBuffer:false,lastRatio:1,isFirstDraw:true,backBufferTile:null,initialize:function(D,A,E,B,C){OpenLayers.Tile.prototype.initialize.apply(this,arguments);this.url=B;this.frame=document.createElement("div");this.frame.style.overflow="hidden";this.frame.style.position="absolute";this.layerAlphaHack=this.layer.alpha&&OpenLayers.Util.alphaHack()},destroy:function(){if(this.imgDiv!=null){if(this.layerAlphaHack){OpenLayers.Event.stopObservingElement(this.imgDiv.childNodes[0].id)}else{OpenLayers.Event.stopObservingElement(this.imgDiv.id)}if(this.imgDiv.parentNode==this.frame){this.frame.removeChild(this.imgDiv);this.imgDiv.map=null}this.imgDiv.urls=null}this.imgDiv=null;if((this.frame!=null)&&(this.frame.parentNode==this.layer.div)){this.layer.div.removeChild(this.frame)}this.frame=null;if(this.backBufferTile){this.backBufferTile.destroy();this.backBufferTile=null}this.layer.events.unregister("loadend",this,this.resetBackBuffer);OpenLayers.Tile.prototype.destroy.apply(this,arguments)},clone:function(A){if(A==null){A=new OpenLayers.Tile.Image(this.layer,this.position,this.bounds,this.url,this.size)}A=OpenLayers.Tile.prototype.clone.apply(this,[A]);A.imgDiv=null;return A},draw:function(){if(this.layer!=this.layer.map.baseLayer&&this.layer.reproject){this.bounds=this.getBoundsFromBaseLayer(this.position)}var A=OpenLayers.Tile.prototype.draw.apply(this,arguments);if(OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1){if(A){if(!this.backBufferTile){this.backBufferTile=this.clone();this.backBufferTile.hide();this.backBufferTile.isBackBuffer=true;this.events.register("loadend",this,this.resetBackBuffer);this.layer.events.register("loadend",this,this.resetBackBuffer)}this.startTransition()}else{if(this.backBufferTile){this.backBufferTile.clear()}}}else{if(A&&this.isFirstDraw){this.events.register("loadend",this,this.showTile);this.isFirstDraw=false}}if(!A){return false}if(this.isLoading){this.events.triggerEvent("reload")}else{this.isLoading=true;this.events.triggerEvent("loadstart")}return this.renderTile()},resetBackBuffer:function(){this.showTile();if(this.backBufferTile&&(this.isFirstDraw||!this.layer.numLoadingTiles)){this.isFirstDraw=false;var A=this.layer.maxExtent;var B=(A&&this.bounds.intersectsBounds(A,false));if(B){this.backBufferTile.position=this.position;this.backBufferTile.bounds=this.bounds;this.backBufferTile.size=this.size;this.backBufferTile.imageSize=this.layer.imageSize||this.size;this.backBufferTile.imageOffset=this.layer.imageOffset;this.backBufferTile.resolution=this.layer.getResolution();this.backBufferTile.renderTile()}}},renderTile:function(){if(this.imgDiv==null){this.initImgDiv()}this.imgDiv.viewRequestID=this.layer.map.viewRequestID;if(this.layer.url instanceof Array){this.imgDiv.urls=this.layer.url.slice()}this.url=this.layer.getURL(this.bounds);OpenLayers.Util.modifyDOMElement(this.frame,null,this.position,this.size);var A=this.layer.getImageSize();if(this.layerAlphaHack){OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv,null,null,A,this.url)}else{OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,A);this.imgDiv.src=this.url}return true},clear:function(){if(this.imgDiv){this.hide();if(OpenLayers.Tile.Image.useBlankTile){this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif"}}},initImgDiv:function(){var D=this.layer.imageOffset;var B=this.layer.getImageSize();if(this.layerAlphaHack){this.imgDiv=OpenLayers.Util.createAlphaImageDiv(null,D,B,null,"relative",null,null,null,true)}else{this.imgDiv=OpenLayers.Util.createImage(null,D,B,null,"relative",null,null,true)}this.imgDiv.className="olTileImage";this.frame.style.zIndex=this.isBackBuffer?0:1;this.frame.appendChild(this.imgDiv);this.layer.div.appendChild(this.frame);if(this.layer.opacity!=null){OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,null,null,null,null,this.layer.opacity)}this.imgDiv.map=this.layer.map;var C=function(){if(this.isLoading){this.isLoading=false;this.events.triggerEvent("loadend")}};if(this.layerAlphaHack){OpenLayers.Event.observe(this.imgDiv.childNodes[0],"load",OpenLayers.Function.bind(C,this))}else{OpenLayers.Event.observe(this.imgDiv,"load",OpenLayers.Function.bind(C,this))}var A=function(){if(this.imgDiv._attempts>OpenLayers.IMAGE_RELOAD_ATTEMPTS){C.call(this)}};OpenLayers.Event.observe(this.imgDiv,"error",OpenLayers.Function.bind(A,this))},checkImgURL:function(){if(this.layer){var A=this.layerAlphaHack?this.imgDiv.firstChild.src:this.imgDiv.src;if(!OpenLayers.Util.isEquivalentUrl(A,this.url)){this.hide()}}},startTransition:function(){if(!this.backBufferTile||!this.backBufferTile.imgDiv){return }var D=1;if(this.backBufferTile.resolution){D=this.backBufferTile.resolution/this.layer.getResolution()}if(D!=this.lastRatio){if(this.layer.transitionEffect=="resize"){var C=new OpenLayers.LonLat(this.backBufferTile.bounds.left,this.backBufferTile.bounds.top);var B=new OpenLayers.Size(this.backBufferTile.size.w*D,this.backBufferTile.size.h*D);var A=this.layer.map.getLayerPxFromLonLat(C);OpenLayers.Util.modifyDOMElement(this.backBufferTile.frame,null,A,B);var E=this.backBufferTile.imageSize;E=new OpenLayers.Size(E.w*D,E.h*D);var F=this.backBufferTile.imageOffset;if(F){F=new OpenLayers.Pixel(F.x*D,F.y*D)}OpenLayers.Util.modifyDOMElement(this.backBufferTile.imgDiv,null,F,E);this.backBufferTile.show()}}else{if(this.layer.singleTile){this.backBufferTile.show()}else{this.backBufferTile.hide()}}this.lastRatio=D},show:function(){this.frame.style.display="";if(OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1){if(navigator.userAgent.toLowerCase().indexOf("gecko")!=-1){this.frame.scrollLeft=this.frame.scrollLeft}}},hide:function(){this.frame.style.display="none"},CLASS_NAME:"OpenLayers.Tile.Image"});OpenLayers.Tile.Image.useBlankTile=(OpenLayers.Util.getBrowserName()=="safari"||OpenLayers.Util.getBrowserName()=="opera");OpenLayers.Feature=OpenLayers.Class({layer:null,id:null,lonlat:null,data:null,marker:null,popupClass:OpenLayers.Popup.AnchoredBubble,popup:null,initialize:function(A,C,B){this.layer=A;this.lonlat=C;this.data=(B!=null)?B:{};this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){if((this.layer!=null)&&(this.layer.map!=null)){if(this.popup!=null){this.layer.map.removePopup(this.popup)}}this.layer=null;this.id=null;this.lonlat=null;this.data=null;if(this.marker!=null){this.destroyMarker(this.marker);this.marker=null}if(this.popup!=null){this.destroyPopup(this.popup);this.popup=null}},onScreen:function(){var B=false;if((this.layer!=null)&&(this.layer.map!=null)){var A=this.layer.map.getExtent();B=A.containsLonLat(this.lonlat)}return B},createMarker:function(){if(this.lonlat!=null){this.marker=new OpenLayers.Marker(this.lonlat,this.data.icon)}return this.marker},destroyMarker:function(){this.marker.destroy()},createPopup:function(B){if(this.lonlat!=null){var C=this.id+"_popup";var A=(this.marker)?this.marker.icon:null;if(!this.popup){this.popup=new this.popupClass(C,this.lonlat,this.data.popupSize,this.data.popupContentHTML,A,B)}if(this.data.overflow!=null){this.popup.contentDiv.style.overflow=this.data.overflow}this.popup.feature=this}return this.popup},destroyPopup:function(){if(this.popup){this.popup.feature=null;this.popup.destroy();this.popup=null}},CLASS_NAME:"OpenLayers.Feature"});OpenLayers.Handler.Click=OpenLayers.Class(OpenLayers.Handler,{delay:300,single:true,"double":false,pixelTolerance:0,stopSingle:false,stopDouble:false,timerId:null,down:null,rightclickTimerId:null,initialize:function(C,B,A){OpenLayers.Handler.prototype.initialize.apply(this,arguments);if(this.pixelTolerance!=null){this.mousedown=function(D){this.down=D.xy;return true}}},mousedown:null,mouseup:function(B){var A=true;if(this.checkModifiers(B)&&this.control.handleRightClicks&&OpenLayers.Event.isRightClick(B)){propogate=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}},delayedCall:function(A){this.timerId=null;if(A){this.callback("click",[A])}},deactivate:function(){var A=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.clearTimer();this.down=null;A=true}return A},CLASS_NAME:"OpenLayers.Handler.Click"});OpenLayers.Handler.Drag=OpenLayers.Class(OpenLayers.Handler,{started:false,stopDown:true,dragging:false,last:null,start:null,oldOnselectstart:null,interval:0,timeoutId:null,initialize:function(C,B,A){OpenLayers.Handler.prototype.initialize.apply(this,arguments)},down:function(A){},move:function(A){},up:function(A){},out:function(A){},mousedown:function(B){var A=true;this.dragging=false;if(this.checkModifiers(B)&&OpenLayers.Event.isLeftClick(B)){this.started=true;this.start=B.xy;this.last=B.xy;this.map.div.style.cursor="move";this.down(B);this.callback("down",[B.xy]);OpenLayers.Event.stop(B);if(!this.oldOnselectstart){this.oldOnselectstart=(document.onselectstart)?document.onselectstart:function(){return true};document.onselectstart=function(){return false}}A=!this.stopDown}else{this.started=false;this.start=null;this.last=null}return A},mousemove:function(A){if(this.started&&!this.timeoutId&&(A.xy.x!=this.last.x||A.xy.y!=this.last.y)){if(this.interval>0){this.timeoutId=setTimeout(OpenLayers.Function.bind(this.removeTimeout,this),this.interval)}this.dragging=true;this.move(A);this.callback("move",[A.xy]);if(!this.oldOnselectstart){this.oldOnselectstart=document.onselectstart;document.onselectstart=function(){return false}}this.last=this.evt.xy}return true},removeTimeout:function(){this.timeoutId=null},mouseup:function(B){if(this.started){var A=(this.start!=this.last);this.started=false;this.dragging=false;this.map.div.style.cursor="";this.up(B);this.callback("up",[B.xy]);if(A){this.callback("done",[B.xy])}document.onselectstart=this.oldOnselectstart}return true},mouseout:function(B){if(this.started&&OpenLayers.Util.mouseLeft(B,this.map.div)){var A=(this.start!=this.last);this.started=false;this.dragging=false;this.map.div.style.cursor="";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}return A},CLASS_NAME:"OpenLayers.Handler.Drag"});OpenLayers.Handler.MouseWheel=OpenLayers.Class(OpenLayers.Handler,{wheelListener:null,mousePosition:null,initialize:function(C,B,A){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.wheelListener=OpenLayers.Function.bindAsEventListener(this.onWheelEvent,this)},destroy:function(){OpenLayers.Handler.prototype.destroy.apply(this,arguments);this.wheelListener=null},onWheelEvent:function(I){if(!this.map||!this.checkModifiers(I)){return }var F=false;var J=false;var E=false;var B=OpenLayers.Event.element(I);while((B!=null)&&!E&&!F){if(!F){try{if(B.currentStyle){C=B.currentStyle.overflow}else{var A=document.defaultView.getComputedStyle(B,null);var C=A.getPropertyValue("overflow")}F=(C&&(C=="auto")||(C=="scroll"))}catch(D){}}if(!J){for(var G=0,H=this.map.layers.length;G<H;G++){if(B==this.map.layers[G].div||B==this.map.layers[G].pane){J=true;break}}}E=(B==this.map.div);B=B.parentNode}if(!F&&E){if(J){this.wheelZoom(I)}OpenLayers.Event.stop(I)}},wheelZoom:function(A){var B=0;if(!A){A=window.event}if(A.wheelDelta){B=A.wheelDelta/120;if(window.opera&&window.opera.version()<9.2){B=-B}}else{if(A.detail){B=-A.detail/3}}if(B){if(this.mousePosition){A.xy=this.mousePosition}if(!A.xy){A.xy=this.map.getPixelFromLonLat(this.map.getCenter())}if(B<0){this.callback("down",[A,B])}else{this.callback("up",[A,B])}}},mousemove:function(A){this.mousePosition=A.xy},activate:function(A){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){var B=this.wheelListener;OpenLayers.Event.observe(window,"DOMMouseScroll",B);OpenLayers.Event.observe(window,"mousewheel",B);OpenLayers.Event.observe(document,"mousewheel",B);return true}else{return false}},deactivate:function(A){if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){var B=this.wheelListener;OpenLayers.Event.stopObserving(window,"DOMMouseScroll",B);OpenLayers.Event.stopObserving(window,"mousewheel",B);OpenLayers.Event.stopObserving(document,"mousewheel",B);return true}else{return false}},CLASS_NAME:"OpenLayers.Handler.MouseWheel"});OpenLayers.Layer=OpenLayers.Class({id:null,name:null,div:null,opacity:null,alwaysInRange:null,EVENT_TYPES:["loadstart","loadend","loadcancel","visibilitychanged","moveend"],events:null,map:null,isBaseLayer:false,alpha:false,displayInLayerSwitcher:true,visibility:true,attribution:null,inRange:false,imageSize:null,imageOffset:null,options:null,eventListeners:null,gutter:0,projection:null,units:null,scales:null,resolutions:null,maxExtent:null,minExtent:null,maxResolution:null,minResolution:null,numZoomLevels:null,minScale:null,maxScale:null,displayOutsideMaxExtent:false,wrapDateLine:false,transitionEffect:null,SUPPORTED_TRANSITIONS:["resize"],initialize:function(B,A){this.addOptions(A);this.name=B;if(this.id==null){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");this.div=OpenLayers.Util.createDiv(this.id);this.div.style.width="100%";this.div.style.height="100%";this.events=new OpenLayers.Events(this,this.div,this.EVENT_TYPES);if(this.eventListeners instanceof Object){this.events.on(this.eventListeners)}}if(this.wrapDateLine){this.displayOutsideMaxExtent=true}},destroy:function(A){if(A==null){A=true}if(this.map!=null){this.map.removeLayer(this,A)}this.projection=null;this.map=null;this.name=null;this.div=null;this.options=null;if(this.events){if(this.eventListeners){this.events.un(this.eventListeners)}this.events.destroy()}this.eventListeners=null;this.events=null},clone:function(A){if(A==null){A=new OpenLayers.Layer(this.name,this.options)}OpenLayers.Util.applyDefaults(A,this);A.map=null;return A},setName:function(A){if(A!=this.name){this.name=A;if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"name"})}}},addOptions:function(A){if(this.options==null){this.options={}}OpenLayers.Util.extend(this.options,A);OpenLayers.Util.extend(this,A)},onMapResize:function(){},redraw:function(){var A=false;if(this.map){this.inRange=this.calculateInRange();var B=this.getExtent();if(B&&this.inRange&&this.visibility){this.moveTo(B,true,false);A=true}}return A},moveTo:function(B,A,C){var D=this.visibility;if(!this.isBaseLayer){D=D&&this.inRange}this.display(D)},setMap:function(B){if(this.map==null){this.map=B;this.maxExtent=this.maxExtent||this.map.maxExtent;this.projection=this.projection||this.map.projection;if(this.projection&&typeof this.projection=="string"){this.projection=new OpenLayers.Projection(this.projection)}this.units=this.projection.getUnits()||this.units||this.map.units;this.initResolutions();if(!this.isBaseLayer){this.inRange=this.calculateInRange();var A=((this.visibility)&&(this.inRange));this.div.style.display=A?"":"none"}this.setTileSize()}},removeMap:function(A){},getImageSize:function(){return(this.imageSize||this.tileSize)},setTileSize:function(A){var B=(A)?A:((this.tileSize)?this.tileSize:this.map.getTileSize());this.tileSize=B;if(this.gutter){this.imageOffset=new OpenLayers.Pixel(-this.gutter,-this.gutter);this.imageSize=new OpenLayers.Size(B.w+(2*this.gutter),B.h+(2*this.gutter))}},getVisibility:function(){return this.visibility},setVisibility:function(A){if(A!=this.visibility){this.visibility=A;this.display(A);this.redraw();if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"visibility"})}this.events.triggerEvent("visibilitychanged")}},display:function(A){var B=this.calculateInRange();if(A!=(this.div.style.display!="none")){this.div.style.display=(A&&B)?"block":"none"}},calculateInRange:function(){var B=false;if(this.alwaysInRange){B=true}else{if(this.map){var A=this.map.getResolution();B=((A>=this.minResolution)&&(A<=this.maxResolution))}}return B},setIsBaseLayer:function(A){if(A!=this.isBaseLayer){this.isBaseLayer=A;if(this.map!=null){this.map.events.triggerEvent("changebaselayer",{layer:this})}}},initResolutions:function(){var M=new Array("projection","units","scales","resolutions","maxScale","minScale","maxResolution","minResolution","minExtent","maxExtent","numZoomLevels","maxZoomLevel");var B=["projection","units"];var E=false;var D={};for(var F=0,I=M.length;F<I;F++){var O=M[F];if(this.options[O]&&OpenLayers.Util.indexOf(B,O)==-1){E=true}D[O]=this.options[O]||this.map[O]}if(this.alwaysInRange==null){this.alwaysInRange=!E}if((this.options.minScale!=null||this.options.maxScale!=null)&&this.options.scales==null){D.scales=null}if((this.options.minResolution!=null||this.options.maxResolution!=null)&&this.options.resolutions==null){D.resolutions=null}if((!D.numZoomLevels)&&(D.maxZoomLevel)){D.numZoomLevels=D.maxZoomLevel+1}if((D.scales!=null)||(D.resolutions!=null)){if(D.scales!=null){D.resolutions=[];for(var F=0,I=D.scales.length;F<I;F++){var C=D.scales[F];D.resolutions[F]=OpenLayers.Util.getResolutionFromScale(C,D.units)}}D.numZoomLevels=D.resolutions.length}else{if(D.minScale){D.maxResolution=OpenLayers.Util.getResolutionFromScale(D.minScale,D.units)}else{if(D.maxResolution=="auto"){var N=this.map.getSize();var L=D.maxExtent.getWidth()/N.w;var H=D.maxExtent.getHeight()/N.h;D.maxResolution=Math.max(L,H)}}if(D.maxScale!=null){D.minResolution=OpenLayers.Util.getResolutionFromScale(D.maxScale,D.units)}else{if((D.minResolution=="auto")&&(D.minExtent!=null)){var N=this.map.getSize();var L=D.minExtent.getWidth()/N.w;var H=D.minExtent.getHeight()/N.h;D.minResolution=Math.max(L,H)}}if(D.minResolution!=null&&this.options.numZoomLevels==undefined){var K=D.maxResolution/D.minResolution;D.numZoomLevels=Math.floor(Math.log(K)/Math.log(2))+1}D.resolutions=new Array(D.numZoomLevels);var A=2;if(typeof D.minResolution=="number"&&D.numZoomLevels>1){A=Math.pow((D.maxResolution/D.minResolution),(1/(D.numZoomLevels-1)))}for(var F=0;F<D.numZoomLevels;F++){var J=D.maxResolution/Math.pow(A,F);D.resolutions[F]=J}}D.resolutions.sort(function(Q,P){return(P-Q)});this.resolutions=D.resolutions;this.maxResolution=D.resolutions[0];var G=D.resolutions.length-1;this.minResolution=D.resolutions[G];this.scales=[];for(var F=0,I=D.resolutions.length;F<I;F++){this.scales[F]=OpenLayers.Util.getScaleFromResolution(D.resolutions[F],D.units)}this.minScale=this.scales[0];this.maxScale=this.scales[this.scales.length-1];this.numZoomLevels=D.numZoomLevels},getResolution:function(){var A=this.map.getZoom();return this.getResolutionForZoom(A)},getExtent:function(){return this.map.calculateBounds()},getZoomForExtent:function(B,C){var D=this.map.getSize();var A=Math.max(B.getWidth()/D.w,B.getHeight()/D.h);return this.getZoomForResolution(A,C)},getDataExtent:function(){},getResolutionForZoom:function(C){C=Math.max(0,Math.min(C,this.resolutions.length-1));var B;if(this.map.fractionalZoom){var A=Math.floor(C);var D=Math.ceil(C);B=this.resolutions[D]+((C-A)*(this.resolutions[A]-this.resolutions[D]))}else{B=this.resolutions[Math.round(C)]}return B},getZoomForResolution:function(E,A){var M;if(this.map.fractionalZoom){var J=0;var C=this.resolutions.length-1;var D=this.resolutions[J];var B=this.resolutions[C];var I;for(var F=0,G=this.resolutions.length;F<G;++F){I=this.resolutions[F];if(I>=E){D=I;J=F}if(I<=E){B=I;C=F;break}}var H=D-B;if(H>0){M=J+((E-B)/H)}else{M=J}}else{var K;var L=Number.POSITIVE_INFINITY;for(var F=0,G=this.resolutions.length;F<G;F++){if(A){K=Math.abs(this.resolutions[F]-E);if(K>L){break}L=K}else{if(this.resolutions[F]<E){break}}}M=Math.max(0,F-1)}return M},getLonLatFromViewPortPx:function(B){var E=null;if(B!=null){var D=this.map.getSize();var A=this.map.getCenter();if(A){var C=this.map.getResolution();var G=B.x-(D.w/2);var F=B.y-(D.h/2);E=new OpenLayers.LonLat(A.lon+G*C,A.lat-F*C);if(this.wrapDateLine){E=E.wrapDateLine(this.maxExtent)}}}return E},getViewPortPxFromLonLat:function(D){var B=null;if(D!=null){var A=this.map.getResolution();var C=this.map.getExtent();B=new OpenLayers.Pixel((1/A*(D.lon-C.left)),(1/A*(C.top-D.lat)))}return B},setOpacity:function(B){if(B!=this.opacity){this.opacity=B;for(var D=0,A=this.div.childNodes.length;D<A;++D){var C=this.div.childNodes[D].firstChild;OpenLayers.Util.modifyDOMElement(C,null,null,null,null,null,null,B)}}},getZIndex:function(){return this.div.style.zIndex},setZIndex:function(A){this.div.style.zIndex=A},adjustBounds:function(B){if(this.gutter){var A=this.gutter*this.map.getResolution();B=new OpenLayers.Bounds(B.left-A,B.bottom-A,B.right+A,B.top+A)}if(this.wrapDateLine){var C={rightTolerance:this.getResolution()};B=B.wrapDateLine(this.maxExtent,C)}return B},CLASS_NAME:"OpenLayers.Layer"});OpenLayers.Popup.FramedCloud=OpenLayers.Class(OpenLayers.Popup.Framed,{contentDisplayClass:"olFramedCloudPopupContent",autoSize:true,panMapIfOutOfView:true,imageSize:new OpenLayers.Size(676,736),isAlphaImage:false,fixedRelativePosition:false,positionBlocks:{tl:{offset:new OpenLayers.Pixel(44,0),padding:new OpenLayers.Bounds(8,40,8,9),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,51,22,0),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,50,0,0),position:new OpenLayers.Pixel(-638,0)},{size:new OpenLayers.Size("auto",21),anchor:new OpenLayers.Bounds(0,32,80,null),position:new OpenLayers.Pixel(0,-629)},{size:new OpenLayers.Size(22,21),anchor:new OpenLayers.Bounds(null,32,0,null),position:new OpenLayers.Pixel(-638,-629)},{size:new OpenLayers.Size(81,54),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(0,-668)}]},tr:{offset:new OpenLayers.Pixel(-45,0),padding:new OpenLayers.Bounds(8,40,8,9),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,51,22,0),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,50,0,0),position:new OpenLayers.Pixel(-638,0)},{size:new OpenLayers.Size("auto",21),anchor:new OpenLayers.Bounds(0,32,22,null),position:new OpenLayers.Pixel(0,-629)},{size:new OpenLayers.Size(22,21),anchor:new OpenLayers.Bounds(null,32,0,null),position:new OpenLayers.Pixel(-638,-629)},{size:new OpenLayers.Size(81,54),anchor:new OpenLayers.Bounds(0,0,null,null),position:new OpenLayers.Pixel(-215,-668)}]},bl:{offset:new OpenLayers.Pixel(45,0),padding:new OpenLayers.Bounds(8,9,8,40),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,21,22,32),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,21,0,32),position:new OpenLayers.Pixel(-638,0)},{size:new OpenLayers.Size("auto",21),anchor:new OpenLayers.Bounds(0,0,22,null),position:new OpenLayers.Pixel(0,-629)},{size:new OpenLayers.Size(22,21),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(-638,-629)},{size:new OpenLayers.Size(81,54),anchor:new OpenLayers.Bounds(null,null,0,0),position:new OpenLayers.Pixel(-101,-674)}]},br:{offset:new OpenLayers.Pixel(-44,0),padding:new OpenLayers.Bounds(8,9,8,40),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,21,22,32),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,21,0,32),position:new OpenLayers.Pixel(-638,0)},{size:new OpenLayers.Size("auto",21),anchor:new OpenLayers.Bounds(0,0,22,null),position:new OpenLayers.Pixel(0,-629)},{size:new OpenLayers.Size(22,21),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(-638,-629)},{size:new OpenLayers.Size(81,54),anchor:new OpenLayers.Bounds(0,null,null,0),position:new OpenLayers.Pixel(-311,-674)}]}},minSize:new OpenLayers.Size(105,10),maxSize:new OpenLayers.Size(600,660),initialize:function(G,C,F,B,A,E,D){this.imageSrc=OpenLayers.Util.getImagesLocation()+"cloud-popup-relative.png";OpenLayers.Popup.Framed.prototype.initialize.apply(this,arguments);this.contentDiv.className=this.contentDisplayClass},destroy:function(){OpenLayers.Popup.Framed.prototype.destroy.apply(this,arguments)},CLASS_NAME:"OpenLayers.Popup.FramedCloud"});OpenLayers.Control.DragPan=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,panned:false,interval:25,draw:function(){this.handler=new OpenLayers.Handler.Drag(this,{move:this.panMap,done:this.panMapDone},{interval:this.interval})},panMap:function(A){this.panned=true;this.map.pan(this.handler.last.x-A.x,this.handler.last.y-A.y,{dragging:this.handler.dragging,animate:false})},panMapDone:function(A){if(this.panned){this.panMap(A);this.panned=false}},CLASS_NAME:"OpenLayers.Control.DragPan"});OpenLayers.State={UNKNOWN:"Unknown",INSERT:"Insert",UPDATE:"Update",DELETE:"Delete"};OpenLayers.Feature.Vector=OpenLayers.Class(OpenLayers.Feature,{fid:null,geometry:null,attributes:null,state:null,style:null,renderIntent:"default",initialize:function(C,A,B){OpenLayers.Feature.prototype.initialize.apply(this,[null,null,A]);this.lonlat=null;this.geometry=C?C:null;this.state=null;this.attributes={};if(A){this.attributes=OpenLayers.Util.extend(this.attributes,A)}this.style=B?B:null},destroy:function(){if(this.layer){this.layer.removeFeatures(this);this.layer=null}this.geometry=null;OpenLayers.Feature.prototype.destroy.apply(this,arguments)},clone:function(){return new OpenLayers.Feature.Vector(this.geometry?this.geometry.clone():null,this.attributes,this.style)},onScreen:function(D){var C=false;if(this.layer&&this.layer.map){var A=this.layer.map.getExtent();if(D){var B=this.geometry.getBounds();C=A.intersectsBounds(B)}else{var E=A.toGeometry();C=E.intersects(this.geometry)}}return C},createMarker:function(){return null},destroyMarker:function(){},createPopup:function(){return null},atPoint:function(B,D,C){var A=false;if(this.geometry){A=this.geometry.atPoint(B,D,C)}return A},destroyPopup:function(){},move:function(A){if(!this.layer||!this.geometry.move){return }var B;if(A.CLASS_NAME=="OpenLayers.LonLat"){B=this.layer.getViewPortPxFromLonLat(A)}else{B=A}var D=this.layer.getViewPortPxFromLonLat(this.geometry.getBounds().getCenterLonLat());var C=this.layer.map.getResolution();this.geometry.move(C*(B.x-D.x),C*(D.y-B.y));this.layer.drawFeature(this);return D},toState:function(A){if(A==OpenLayers.State.UPDATE){switch(this.state){case OpenLayers.State.UNKNOWN:case OpenLayers.State.DELETE:this.state=A;break;case OpenLayers.State.UPDATE:case OpenLayers.State.INSERT:break}}else{if(A==OpenLayers.State.INSERT){switch(this.state){case OpenLayers.State.UNKNOWN:break;default:this.state=A;break}}else{if(A==OpenLayers.State.DELETE){switch(this.state){case OpenLayers.State.INSERT:break;case OpenLayers.State.DELETE:break;case OpenLayers.State.UNKNOWN:case OpenLayers.State.UPDATE:this.state=A;break}}else{if(A==OpenLayers.State.UNKNOWN){this.state=A}}}}},CLASS_NAME:"OpenLayers.Feature.Vector"});OpenLayers.Feature.Vector.style={"default":{fillColor:"#ee9900",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#ee9900",strokeOpacity:1,strokeWidth:1,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},select:{fillColor:"blue",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"blue",strokeOpacity:1,strokeWidth:2,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"pointer"},temporary:{fillColor:"yellow",fillOpacity:0.2,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"yellow",strokeOpacity:1,strokeLinecap:"round",strokeWidth:4,strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"}};OpenLayers.Handler.Box=OpenLayers.Class(OpenLayers.Handler,{dragHandler:null,boxDivClassName:"olHandlerBoxZoomBox",boxCharacteristics:null,initialize:function(C,B,A){OpenLayers.Handler.prototype.initialize.apply(this,arguments);var B={down:this.startBox,move:this.moveBox,out:this.removeBox,up:this.endBox};this.dragHandler=new OpenLayers.Handler.Drag(this,B,{keyMask:this.keyMask})},setMap:function(A){OpenLayers.Handler.prototype.setMap.apply(this,arguments);if(this.dragHandler){this.dragHandler.setMap(A)}},startBox:function(A){this.zoomBox=OpenLayers.Util.createDiv("zoomBox",this.dragHandler.start);this.zoomBox.className=this.boxDivClassName;this.zoomBox.style.zIndex=this.map.Z_INDEX_BASE.Popup-1;this.map.viewPortDiv.appendChild(this.zoomBox);this.map.div.style.cursor="crosshair"},moveBox:function(F){var D=this.dragHandler.start.x;var B=this.dragHandler.start.y;var C=Math.abs(D-F.x);var A=Math.abs(B-F.y);this.zoomBox.style.width=Math.max(1,C)+"px";this.zoomBox.style.height=Math.max(1,A)+"px";this.zoomBox.style.left=F.x<D?F.x+"px":D+"px";this.zoomBox.style.top=F.y<B?F.y+"px":B+"px";var E=this.getBoxCharacteristics(C,A);if(E.newBoxModel){if(F.x>D){this.zoomBox.style.width=Math.max(1,C-E.xOffset)+"px"}if(F.y>B){this.zoomBox.style.height=Math.max(1,A-E.yOffset)+"px"}}},endBox:function(B){var A;if(Math.abs(this.dragHandler.start.x-B.x)>5||Math.abs(this.dragHandler.start.y-B.y)>5){var G=this.dragHandler.start;var F=Math.min(G.y,B.y);var C=Math.max(G.y,B.y);var E=Math.min(G.x,B.x);var D=Math.max(G.x,B.x);A=new OpenLayers.Bounds(E,C,D,F)}else{A=this.dragHandler.start.clone()}this.removeBox();this.map.div.style.cursor="";this.callback("done",[A])},removeBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox);this.zoomBox=null;this.boxCharacteristics=null},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(B,A){if(!this.boxCharacteristics){var C=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-left-width"))+parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-right-width"))+1;var E=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-top-width"))+parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-bottom-width"))+1;var D=OpenLayers.Util.getBrowserName()=="msie"?document.compatMode!="BackCompat":true;this.boxCharacteristics={xOffset:C,yOffset:E,newBoxModel:D}}return this.boxCharacteristics},CLASS_NAME:"OpenLayers.Handler.Box"});OpenLayers.Layer.EventPane=OpenLayers.Class(OpenLayers.Layer,{smoothDragPan:true,isBaseLayer:true,isFixed:true,pane:null,mapObject:null,initialize:function(B,A){OpenLayers.Layer.prototype.initialize.apply(this,arguments);if(this.pane==null){this.pane=OpenLayers.Util.createDiv(this.div.id+"_EventPane")}},destroy:function(){this.mapObject=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},setMap:function(A){OpenLayers.Layer.prototype.setMap.apply(this,arguments);this.pane.style.zIndex=parseInt(this.div.style.zIndex)+1;this.pane.style.display=this.div.style.display;this.pane.style.width="100%";this.pane.style.height="100%";if(OpenLayers.Util.getBrowserName()=="msie"){this.pane.style.background="url("+OpenLayers.Util.getImagesLocation()+"blank.gif)"}if(this.isFixed){this.map.viewPortDiv.appendChild(this.pane)}else{this.map.layerContainerDiv.appendChild(this.pane)}this.loadMapObject();if(this.mapObject==null){this.loadWarningMessage()}},removeMap:function(A){if(this.pane&&this.pane.parentNode){this.pane.parentNode.removeChild(this.pane);this.pane=null}OpenLayers.Layer.prototype.removeMap.apply(this,arguments)},loadWarningMessage:function(){this.div.style.backgroundColor="darkblue";var G=this.map.getSize();var A=Math.min(G.w,300);var E=Math.min(G.h,200);var B=new OpenLayers.Size(A,E);var D=new OpenLayers.Pixel(G.w/2,G.h/2);var C=D.add(-B.w/2,-B.h/2);var F=OpenLayers.Util.createDiv(this.name+"_warning",C,B,null,null,null,"auto");F.style.padding="7px";F.style.backgroundColor="yellow";F.innerHTML=this.getWarningHTML();this.div.appendChild(F)},getWarningHTML:function(){return""},display:function(A){OpenLayers.Layer.prototype.display.apply(this,arguments);this.pane.style.display=this.div.style.display},setZIndex:function(A){OpenLayers.Layer.prototype.setZIndex.apply(this,arguments);this.pane.style.zIndex=parseInt(this.div.style.zIndex)+1},moveTo:function(C,D,J){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);if(this.mapObject!=null){var E=this.map.getCenter();var G=this.map.getZoom();if(E!=null){var F=this.getMapObjectCenter();var B=this.getOLLonLatFromMapObjectLonLat(F);var H=this.getMapObjectZoom();var M=this.getOLZoomFromMapObjectZoom(H);if(!(E.equals(B))||!(G==M)){if(J&&this.dragPanMapObject&&this.smoothDragPan){var I=this.map.getViewPortPxFromLonLat(B);var K=this.map.getViewPortPxFromLonLat(E);this.dragPanMapObject(K.x-I.x,I.y-K.y)}else{var A=this.getMapObjectLonLatFromOLLonLat(E);var L=this.getMapObjectZoomFromOLZoom(G);this.setMapObjectCenter(A,L,J)}}}}},getLonLatFromViewPortPx:function(A){var B=null;if((this.mapObject!=null)&&(this.getMapObjectCenter()!=null)){var D=this.getMapObjectPixelFromOLPixel(A);var C=this.getMapObjectLonLatFromMapObjectPixel(D);B=this.getOLLonLatFromMapObjectLonLat(C)}return B},getViewPortPxFromLonLat:function(B){var A=null;if((this.mapObject!=null)&&(this.getMapObjectCenter()!=null)){var D=this.getMapObjectLonLatFromOLLonLat(B);var C=this.getMapObjectPixelFromMapObjectLonLat(D);A=this.getOLPixelFromMapObjectPixel(C)}return A},getOLLonLatFromMapObjectLonLat:function(D){var A=null;if(D!=null){var C=this.getLongitudeFromMapObjectLonLat(D);var B=this.getLatitudeFromMapObjectLonLat(D);A=new OpenLayers.LonLat(C,B)}return A},getMapObjectLonLatFromOLLonLat:function(A){var B=null;if(A!=null){B=this.getMapObjectLonLatFromLonLat(A.lon,A.lat)}return B},getOLPixelFromMapObjectPixel:function(D){var B=null;if(D!=null){var A=this.getXFromMapObjectPixel(D);var C=this.getYFromMapObjectPixel(D);B=new OpenLayers.Pixel(A,C)}return B},getMapObjectPixelFromOLPixel:function(A){var B=null;if(A!=null){B=this.getMapObjectPixelFromXY(A.x,A.y)}return B},CLASS_NAME:"OpenLayers.Layer.EventPane"});OpenLayers.Layer.FixedZoomLevels=OpenLayers.Class({initialize:function(){},initResolutions:function(){var C=new Array("minZoomLevel","maxZoomLevel","numZoomLevels");for(var B=0,A=C.length;B<A;B++){var F=C[B];this[F]=(this.options[F]!=null)?this.options[F]:this.map[F]}if((this.minZoomLevel==null)||(this.minZoomLevel<this.MIN_ZOOM_LEVEL)){this.minZoomLevel=this.MIN_ZOOM_LEVEL}var G;var E=this.MAX_ZOOM_LEVEL-this.minZoomLevel+1;if(((this.options.numZoomLevels==null)&&(this.options.maxZoomLevel!=null))||((this.numZoomLevels==null)&&(this.maxZoomLevel!=null))){G=this.maxZoomLevel-this.minZoomLevel+1}else{G=this.numZoomLevels}if(G!=null){this.numZoomLevels=Math.min(G,E)}else{this.numZoomLevels=E}this.maxZoomLevel=this.minZoomLevel+this.numZoomLevels-1;if(this.RESOLUTIONS!=null){var D=0;this.resolutions=[];for(var B=this.minZoomLevel;B<=this.maxZoomLevel;B++){this.resolutions[D++]=this.RESOLUTIONS[B]}this.maxResolution=this.resolutions[0];this.minResolution=this.resolutions[this.resolutions.length-1]}},getResolution:function(){if(this.resolutions!=null){return OpenLayers.Layer.prototype.getResolution.apply(this,arguments)}else{var A=null;var C=this.map.getSize();var B=this.getExtent();if((C!=null)&&(B!=null)){A=Math.max(B.getWidth()/C.w,B.getHeight()/C.h)}return A}},getExtent:function(){var C=null;var B=this.map.getSize();var E=new OpenLayers.Pixel(0,0);var F=this.getLonLatFromViewPortPx(E);var A=new OpenLayers.Pixel(B.w,B.h);var D=this.getLonLatFromViewPortPx(A);if((F!=null)&&(D!=null)){C=new OpenLayers.Bounds(F.lon,D.lat,D.lon,F.lat)}return C},getZoomForResolution:function(A){if(this.resolutions!=null){return OpenLayers.Layer.prototype.getZoomForResolution.apply(this,arguments)}else{var B=OpenLayers.Layer.prototype.getExtent.apply(this,[]);return this.getZoomForExtent(B)}},getOLZoomFromMapObjectZoom:function(A){var B=null;if(A!=null){B=A-this.minZoomLevel}return B},getMapObjectZoomFromOLZoom:function(A){var B=null;if(A!=null){B=A+this.minZoomLevel}return B},CLASS_NAME:"FixedZoomLevels.js"});OpenLayers.Layer.HTTPRequest=OpenLayers.Class(OpenLayers.Layer,{URL_HASH_FACTOR:(Math.sqrt(5)-1)/2,url:null,params:null,reproject:false,initialize:function(D,C,E,B){var A=arguments;A=[D,B];OpenLayers.Layer.prototype.initialize.apply(this,A);this.url=C;this.params=OpenLayers.Util.extend({},E)},destroy:function(){this.url=null;this.params=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(A){if(A==null){A=new OpenLayers.Layer.HTTPRequest(this.name,this.url,this.params,this.options)}A=OpenLayers.Layer.prototype.clone.apply(this,[A]);return A},setUrl:function(A){this.url=A},mergeNewParams:function(A){this.params=OpenLayers.Util.extend(this.params,A);return this.redraw()},redraw:function(A){if(A){return this.mergeNewParams({_olSalt:Math.random()})}else{return OpenLayers.Layer.prototype.redraw.apply(this,[])}},selectUrl:function(E,D){var C=1;for(var B=0,A=E.length;B<A;B++){C*=E.charCodeAt(B)*this.URL_HASH_FACTOR;C-=Math.floor(C)}return D[Math.floor(C*D.length)]},getFullRequestString:function(F,E){var B=E||this.url;var G=OpenLayers.Util.extend({},this.params);G=OpenLayers.Util.extend(G,F);var A=OpenLayers.Util.getParameterString(G);if(B instanceof Array){B=this.selectUrl(A,B)}var D=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(B));for(var H in G){if(H.toUpperCase() in D){delete G[H]}}A=OpenLayers.Util.getParameterString(G);var I=B;if(A!=""){var C=B.charAt(B.length-1);if((C=="&")||(C=="?")){I+=A}else{if(B.indexOf("?")==-1){I+="?"+A}else{I+="&"+A}}}return I},CLASS_NAME:"OpenLayers.Layer.HTTPRequest"});OpenLayers.Layer.Markers=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:false,markers:null,drawn:false,initialize:function(B,A){OpenLayers.Layer.prototype.initialize.apply(this,arguments);this.markers=[]},destroy:function(){this.clearMarkers();this.markers=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},setOpacity:function(B){if(B!=this.opacity){this.opacity=B;for(var C=0,A=this.markers.length;C<A;C++){this.markers[C].setOpacity(this.opacity)}}},moveTo:function(D,B,E){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);if(B||!this.drawn){for(var C=0,A=this.markers.length;C<A;C++){this.drawMarker(this.markers[C])}this.drawn=true}},addMarker:function(A){this.markers.push(A);if(this.opacity!=null){A.setOpacity(this.opacity)}if(this.map&&this.map.getExtent()){A.map=this.map;this.drawMarker(A)}},removeMarker:function(A){if(this.markers&&this.markers.length){OpenLayers.Util.removeItem(this.markers,A);if((A.icon!=null)&&(A.icon.imageDiv!=null)&&(A.icon.imageDiv.parentNode==this.div)){this.div.removeChild(A.icon.imageDiv);A.drawn=false}}},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{var C=A.draw(B);if(!A.drawn){this.div.appendChild(C);A.drawn=true}}},getDataExtent:function(){var B=null;if(this.markers&&(this.markers.length>0)){var B=new OpenLayers.Bounds();for(var D=0,A=this.markers.length;D<A;D++){var C=this.markers[D];B.extend(C.lonlat)}}return B},CLASS_NAME:"OpenLayers.Layer.Markers"});OpenLayers.Layer.SphericalMercator={getExtent:function(){var A=null;if(this.sphericalMercator){A=this.map.calculateBounds()}else{A=OpenLayers.Layer.FixedZoomLevels.prototype.getExtent.apply(this)}return A},initMercatorParameters:function(){this.RESOLUTIONS=[];var A=156543.0339;for(var B=0;B<=this.MAX_ZOOM_LEVEL;++B){this.RESOLUTIONS[B]=A/Math.pow(2,B)}this.units="m";this.projection="EPSG:900913"},forwardMercator:function(C,B){var A=C*20037508.34/180;var D=Math.log(Math.tan((90+B)*Math.PI/360))/(Math.PI/180);D=D*20037508.34/180;return new OpenLayers.LonLat(A,D)},inverseMercator:function(A,D){var C=(A/20037508.34)*180;var B=(D/20037508.34)*180;B=180/Math.PI*(2*Math.atan(Math.exp(B*Math.PI/180))-Math.PI/2);return new OpenLayers.LonLat(C,B)},projectForward:function(A){var B=OpenLayers.Layer.SphericalMercator.forwardMercator(A.x,A.y);A.x=B.lon;A.y=B.lat;return A},projectInverse:function(A){var B=OpenLayers.Layer.SphericalMercator.inverseMercator(A.x,A.y);A.x=B.lon;A.y=B.lat;return A}};OpenLayers.Projection.addTransform("EPSG:4326","EPSG:900913",OpenLayers.Layer.SphericalMercator.projectForward);OpenLayers.Projection.addTransform("EPSG:900913","EPSG:4326",OpenLayers.Layer.SphericalMercator.projectInverse);OpenLayers.Control.ZoomBox=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,out:false,draw:function(){this.handler=new OpenLayers.Handler.Box(this,{done:this.zoomBox},{keyMask:this.keyMask})},zoomBox:function(H){if(H instanceof OpenLayers.Bounds){if(!this.out){var I=this.map.getLonLatFromPixel(new OpenLayers.Pixel(H.left,H.bottom));var L=this.map.getLonLatFromPixel(new OpenLayers.Pixel(H.right,H.top));var B=new OpenLayers.Bounds(I.lon,I.lat,L.lon,L.lat)}else{var G=Math.abs(H.right-H.left);var J=Math.abs(H.top-H.bottom);var E=Math.min((this.map.size.h/J),(this.map.size.w/G));var M=this.map.getExtent();var A=this.map.getLonLatFromPixel(H.getCenterPixel());var C=A.lon-(M.getWidth()/2)*E;var F=A.lon+(M.getWidth()/2)*E;var K=A.lat-(M.getHeight()/2)*E;var D=A.lat+(M.getHeight()/2)*E;var B=new OpenLayers.Bounds(C,K,F,D)}this.map.zoomToExtent(B)}else{if(!this.out){this.map.setCenter(this.map.getLonLatFromPixel(H),this.map.getZoom()+1)}else{this.map.setCenter(this.map.getLonLatFromPixel(H),this.map.getZoom()-1)}}},CLASS_NAME:"OpenLayers.Control.ZoomBox"});OpenLayers.Format.WKT=OpenLayers.Class(OpenLayers.Format,{initialize:function(A){this.regExes={typeStr:/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,spaces:/\s+/,parenComma:/\)\s*,\s*\(/,doubleParenComma:/\)\s*\)\s*,\s*\(\s*\(/,trimParens:/^\s*\(?(.*?)\)?\s*$/};OpenLayers.Format.prototype.initialize.apply(this,[A])},read:function(F){var E,D,H;var G=this.regExes.typeStr.exec(F);if(G){D=G[1].toLowerCase();H=G[2];if(this.parse[D]){E=this.parse[D].apply(this,[H])}if(this.internalProjection&&this.externalProjection){if(E&&E.CLASS_NAME=="OpenLayers.Feature.Vector"){E.geometry.transform(this.externalProjection,this.internalProjection)}else{if(E&&D!="geometrycollection"&&typeof E=="object"){for(var C=0,A=E.length;C<A;C++){var B=E[C];B.geometry.transform(this.externalProjection,this.internalProjection)}}}}}return E},write:function(A){var F,I,H,D,B;if(A.constructor==Array){F=A;B=true}else{F=[A];B=false}var C=[];if(B){C.push("GEOMETRYCOLLECTION(")}for(var E=0,G=F.length;E<G;++E){if(B&&E>0){C.push(",")}I=F[E].geometry;H=I.CLASS_NAME.split(".")[2].toLowerCase();if(!this.extract[H]){return null}if(this.internalProjection&&this.externalProjection){I=I.clone();I.transform(this.internalProjection,this.externalProjection)}D=this.extract[H].apply(this,[I]);C.push(H.toUpperCase()+"("+D+")")}if(B){C.push(")")}return C.join("")},extract:{point:function(A){return A.x+" "+A.y},multipoint:function(C){var D=[];for(var B=0,A=C.components.length;B<A;++B){D.push(this.extract.point.apply(this,[C.components[B]]))}return D.join(",")},linestring:function(B){var D=[];for(var C=0,A=B.components.length;C<A;++C){D.push(this.extract.point.apply(this,[B.components[C]]))}return D.join(",")},multilinestring:function(C){var D=[];for(var B=0,A=C.components.length;B<A;++B){D.push("("+this.extract.linestring.apply(this,[C.components[B]])+")")}return D.join(",")},polygon:function(C){var D=[];for(var B=0,A=C.components.length;B<A;++B){D.push("("+this.extract.linestring.apply(this,[C.components[B]])+")")}return D.join(",")},multipolygon:function(D){var C=[];for(var B=0,A=D.components.length;B<A;++B){C.push("("+this.extract.polygon.apply(this,[D.components[B]])+")")}return C.join(",")}},parse:{point:function(B){var A=OpenLayers.String.trim(B).split(this.regExes.spaces);return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(A[0],A[1]))},multipoint:function(E){var C=OpenLayers.String.trim(E).split(",");var D=[];for(var B=0,A=C.length;B<A;++B){D.push(this.parse.point.apply(this,[C[B]]).geometry)}return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPoint(D))},linestring:function(E){var C=OpenLayers.String.trim(E).split(",");var D=[];for(var B=0,A=C.length;B<A;++B){D.push(this.parse.point.apply(this,[C[B]]).geometry)}return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(D))},multilinestring:function(F){var C;var B=OpenLayers.String.trim(F).split(this.regExes.parenComma);var E=[];for(var D=0,A=B.length;D<A;++D){C=B[D].replace(this.regExes.trimParens,"$1");E.push(this.parse.linestring.apply(this,[C]).geometry)}return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiLineString(E))},polygon:function(H){var C,B,F;var G=OpenLayers.String.trim(H).split(this.regExes.parenComma);var E=[];for(var D=0,A=G.length;D<A;++D){C=G[D].replace(this.regExes.trimParens,"$1");B=this.parse.linestring.apply(this,[C]).geometry;F=new OpenLayers.Geometry.LinearRing(B.components);E.push(F)}return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon(E))},multipolygon:function(F){var D;var B=OpenLayers.String.trim(F).split(this.regExes.doubleParenComma);var E=[];for(var C=0,A=B.length;C<A;++C){D=B[C].replace(this.regExes.trimParens,"$1");E.push(this.parse.polygon.apply(this,[D]).geometry)}return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPolygon(E))},geometrycollection:function(E){E=E.replace(/,\s*([A-Za-z])/g,"|$1");var D=OpenLayers.String.trim(E).split("|");var C=[];for(var B=0,A=D.length;B<A;++B){C.push(OpenLayers.Format.WKT.prototype.read.apply(this,[D[B]]))}return C}},CLASS_NAME:"OpenLayers.Format.WKT"});OpenLayers.Layer.Google=OpenLayers.Class(OpenLayers.Layer.EventPane,OpenLayers.Layer.FixedZoomLevels,{MIN_ZOOM_LEVEL:0,MAX_ZOOM_LEVEL:19,RESOLUTIONS:[1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125,0.00002145767211914062,0.00001072883605957031,0.00000536441802978515,0.00000268220901489257],type:null,sphericalMercator:false,dragObject:null,initialize:function(B,A){OpenLayers.Layer.EventPane.prototype.initialize.apply(this,arguments);OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,arguments);this.addContainerPxFunction();if(this.sphericalMercator){OpenLayers.Util.extend(this,OpenLayers.Layer.SphericalMercator);this.initMercatorParameters()}},loadMapObject:function(){try{this.mapObject=new GMap2(this.div);if(typeof this.mapObject.getDragObject=="function"){this.dragObject=this.mapObject.getDragObject()}else{this.dragPanMapObject=null}var A=this.div.lastChild;this.div.removeChild(A);this.pane.appendChild(A);A.className="olLayerGooglePoweredBy gmnoprint";A.style.left="";A.style.bottom="";var B=this.div.lastChild;this.div.removeChild(B);this.pane.appendChild(B);B.className="olLayerGoogleCopyright";B.style.right="";B.style.bottom=""}catch(C){OpenLayers.Console.error(C)}},setMap:function(A){OpenLayers.Layer.EventPane.prototype.setMap.apply(this,arguments);if(this.type!=null){this.map.events.register("moveend",this,this.setMapType)}},setMapType:function(){if(this.mapObject.getCenter()!=null){if(OpenLayers.Util.indexOf(this.mapObject.getMapTypes(),this.type)==-1){this.mapObject.addMapType(this.type)}this.mapObject.setMapType(this.type);this.map.events.unregister("moveend",this,this.setMapType)}},onMapResize:function(){if(this.visibility){this.mapObject.checkResize()}else{this.windowResized=true}},display:function(A){OpenLayers.Layer.EventPane.prototype.display.apply(this,arguments);if(this.div.style.display=="block"&&this.windowResized){this.mapObject.checkResize();this.windowResized=false}},getOLBoundsFromMapObjectBounds:function(B){var C=null;if(B!=null){var A=B.getSouthWest();var D=B.getNorthEast();if(this.sphericalMercator){A=this.forwardMercator(A.lng(),A.lat());D=this.forwardMercator(D.lng(),D.lat())}else{A=new OpenLayers.LonLat(A.lng(),A.lat());D=new OpenLayers.LonLat(D.lng(),D.lat())}C=new OpenLayers.Bounds(A.lon,A.lat,D.lon,D.lat)}return C},getMapObjectBoundsFromOLBounds:function(C){var B=null;if(C!=null){var A=this.sphericalMercator?this.inverseMercator(C.bottom,C.left):new OpenLayers.LonLat(C.bottom,C.left);var D=this.sphericalMercator?this.inverseMercator(C.top,C.right):new OpenLayers.LonLat(C.top,C.right);B=new GLatLngBounds(new GLatLng(A.lat,A.lon),new GLatLng(D.lat,D.lon))}return B},addContainerPxFunction:function(){if((typeof GMap2!="undefined")&&!GMap2.prototype.fromLatLngToContainerPixel){GMap2.prototype.fromLatLngToContainerPixel=function(B){var A=this.fromLatLngToDivPixel(B);var C=this.getContainer().firstChild.firstChild;A.x+=C.offsetLeft;A.y+=C.offsetTop;return A}}},getWarningHTML:function(){return OpenLayers.i18n("googleWarning")},setMapObjectCenter:function(A,B){this.mapObject.setCenter(A,B)},dragPanMapObject:function(B,A){this.dragObject.moveBy(new GSize(-B,A))},getMapObjectCenter:function(){return this.mapObject.getCenter()},getMapObjectZoom:function(){return this.mapObject.getZoom()},getMapObjectLonLatFromMapObjectPixel:function(A){return this.mapObject.fromContainerPixelToLatLng(A)},getMapObjectPixelFromMapObjectLonLat:function(A){return this.mapObject.fromLatLngToContainerPixel(A)},getMapObjectZoomFromMapObjectBounds:function(A){return this.mapObject.getBoundsZoomLevel(A)},getLongitudeFromMapObjectLonLat:function(A){return this.sphericalMercator?this.forwardMercator(A.lng(),A.lat()).lon:A.lng()},getLatitudeFromMapObjectLonLat:function(B){var A=this.sphericalMercator?this.forwardMercator(B.lng(),B.lat()).lat:B.lat();return A},getMapObjectLonLatFromLonLat:function(D,B){var C;if(this.sphericalMercator){var A=this.inverseMercator(D,B);C=new GLatLng(A.lat,A.lon)}else{C=new GLatLng(B,D)}return C},getXFromMapObjectPixel:function(A){return A.x},getYFromMapObjectPixel:function(A){return A.y},getMapObjectPixelFromXY:function(A,B){return new GPoint(A,B)},CLASS_NAME:"OpenLayers.Layer.Google"});OpenLayers.Layer.Grid=OpenLayers.Class(OpenLayers.Layer.HTTPRequest,{tileSize:null,grid:null,singleTile:false,ratio:1.5,buffer:2,numLoadingTiles:0,initialize:function(C,B,D,A){OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,arguments);this.events.addEventType("tileloaded");this.grid=[]},destroy:function(){this.clearGrid();this.grid=null;this.tileSize=null;OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this,arguments)},clearGrid:function(){if(this.grid){for(var F=0,B=this.grid.length;F<B;F++){var E=this.grid[F];for(var C=0,A=E.length;C<A;C++){var D=E[C];this.removeTileMonitoringHooks(D);D.destroy()}}this.grid=[]}},clone:function(A){if(A==null){A=new OpenLayers.Layer.Grid(this.name,this.url,this.params,this.options)}A=OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this,[A]);if(this.tileSize!=null){A.tileSize=this.tileSize.clone()}A.grid=[];return A},moveTo:function(D,A,E){OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this,arguments);D=D||this.map.getExtent();if(D!=null){var C=!this.grid.length||A;var B=this.getTilesBounds();if(this.singleTile){if(C||(!E&&!B.containsBounds(D))){this.initSingleTile(D)}}else{if(C||!B.containsBounds(D,true)){this.initGriddedTiles(D)}else{this.moveGriddedTiles(D)}}}},setTileSize:function(A){if(this.singleTile){A=this.map.getSize().clone();A.h=parseInt(A.h*this.ratio);A.w=parseInt(A.w*this.ratio)}OpenLayers.Layer.HTTPRequest.prototype.setTileSize.apply(this,[A])},getGridBounds:function(){var A="The getGridBounds() function is deprecated. It will be removed in 3.0. Please use getTilesBounds() instead.";OpenLayers.Console.warn(A);return this.getTilesBounds()},getTilesBounds:function(){var E=null;if(this.grid.length){var A=this.grid.length-1;var D=this.grid[A][0];var B=this.grid[0].length-1;var C=this.grid[0][B];E=new OpenLayers.Bounds(D.bounds.left,D.bounds.bottom,C.bounds.right,C.bounds.top)}return E},initSingleTile:function(F){var A=F.getCenterLonLat();var H=F.getWidth()*this.ratio;var B=F.getHeight()*this.ratio;var G=new OpenLayers.Bounds(A.lon-(H/2),A.lat-(B/2),A.lon+(H/2),A.lat+(B/2));var D=new OpenLayers.LonLat(G.left,G.top);var C=this.map.getLayerPxFromLonLat(D);if(!this.grid.length){this.grid[0]=[]}var E=this.grid[0][0];if(!E){E=this.addTile(G,C);this.addTileMonitoringHooks(E);E.draw();this.grid[0][0]=E}else{E.moveTo(G,C)}this.removeExcessTiles(1,1)},calculateGridLayout:function(A,O,E){var K=E*this.tileSize.w;var C=E*this.tileSize.h;var I=A.left-O.left;var L=Math.floor(I/K)-this.buffer;var J=I/K-L;var F=-J*this.tileSize.w;var M=O.left+L*K;var B=A.top-(O.bottom+C);var H=Math.ceil(B/C)+this.buffer;var N=H-B/C;var D=-N*this.tileSize.h;var G=O.bottom+H*C;return{tilelon:K,tilelat:C,tileoffsetlon:M,tileoffsetlat:G,tileoffsetx:F,tileoffsety:D}},initGriddedTiles:function(I){var G=this.map.getSize();var V=Math.ceil(G.h/this.tileSize.h)+Math.max(1,2*this.buffer);var X=Math.ceil(G.w/this.tileSize.w)+Math.max(1,2*this.buffer);var O=this.maxExtent;var R=this.map.getResolution();var Q=this.calculateGridLayout(I,O,R);var F=Math.round(Q.tileoffsetx);var C=Math.round(Q.tileoffsety);var K=Q.tileoffsetlon;var N=Q.tileoffsetlat;var E=Q.tilelon;var J=Q.tilelat;this.origin=new OpenLayers.Pixel(F,C);var U=F;var W=K;var T=0;var A=parseInt(this.map.layerContainerDiv.style.left);var S=parseInt(this.map.layerContainerDiv.style.top);do{var H=this.grid[T++];if(!H){H=[];this.grid.push(H)}K=W;F=U;var D=0;do{var B=new OpenLayers.Bounds(K,N,K+E,N+J);var M=F;M-=A;var L=C;L-=S;var P=new OpenLayers.Pixel(M,L);var Y=H[D++];if(!Y){Y=this.addTile(B,P);this.addTileMonitoringHooks(Y);H.push(Y)}else{Y.moveTo(B,P,false)}K+=E;F+=this.tileSize.w}while((K<=I.right+E*this.buffer)||D<X);N-=J;C+=this.tileSize.h}while((N>=I.bottom-J*this.buffer)||T<V);this.removeExcessTiles(T,D);this.spiralTileLoad()},spiralTileLoad:function(){var B=[];var H=["right","down","left","up"];var G=0;var A=-1;var J=OpenLayers.Util.indexOf(H,"right");var K=0;while(K<H.length){var I=G;var C=A;switch(H[J]){case"right":C++;break;case"down":I++;break;case"left":C--;break;case"up":I--;break}var F=null;if((I<this.grid.length)&&(I>=0)&&(C<this.grid[0].length)&&(C>=0)){F=this.grid[I][C]}if((F!=null)&&(!F.queued)){B.unshift(F);F.queued=true;K=0;G=I;A=C}else{J=(J+1)%4;K++}}for(var D=0,E=B.length;D<E;D++){var F=B[D];F.draw();F.queued=false}},addTile:function(B,A){},addTileMonitoringHooks:function(A){A.onLoadStart=function(){if(this.numLoadingTiles==0){this.events.triggerEvent("loadstart")}this.numLoadingTiles++};A.events.register("loadstart",this,A.onLoadStart);A.onLoadEnd=function(){this.numLoadingTiles--;this.events.triggerEvent("tileloaded");if(this.numLoadingTiles==0){this.events.triggerEvent("loadend")}};A.events.register("loadend",this,A.onLoadEnd);A.events.register("unload",this,A.onLoadEnd)},removeTileMonitoringHooks:function(A){A.unload();A.events.un({loadstart:A.onLoadStart,loadend:A.onLoadEnd,unload:A.onLoadEnd,scope:this})},moveGriddedTiles:function(C){var B=this.buffer||1;while(true){var A=this.grid[0][0].position;var D=this.map.getViewPortPxFromLayerPx(A);if(D.x>-this.tileSize.w*(B-1)){this.shiftColumn(true)}else{if(D.x<-this.tileSize.w*B){this.shiftColumn(false)}else{if(D.y>-this.tileSize.h*(B-1)){this.shiftRow(true)}else{if(D.y<-this.tileSize.h*B){this.shiftRow(false)}else{break}}}}}},shiftRow:function(M){var C=(M)?0:(this.grid.length-1);var B=this.grid;var F=B[C];var E=this.map.getResolution();var H=(M)?-this.tileSize.h:this.tileSize.h;var G=E*-H;var L=(M)?B.pop():B.shift();for(var I=0,K=F.length;I<K;I++){var D=F[I];var A=D.bounds.clone();var J=D.position.clone();A.bottom=A.bottom+G;A.top=A.top+G;J.y=J.y+H;L[I].moveTo(A,J)}if(M){B.unshift(L)}else{B.push(L)}},shiftColumn:function(L){var D=(L)?-this.tileSize.w:this.tileSize.w;var C=this.map.getResolution();var J=C*D;for(var E=0,G=this.grid.length;E<G;E++){var K=this.grid[E];var I=(L)?0:(K.length-1);var B=K[I];var A=B.bounds.clone();var F=B.position.clone();A.left=A.left+J;A.right=A.right+J;F.x=F.x+D;var H=L?this.grid[E].pop():this.grid[E].shift();H.moveTo(A,F);if(L){K.unshift(H)}else{K.push(H)}}},removeExcessTiles:function(E,C){while(this.grid.length>E){var F=this.grid.pop();for(var B=0,A=F.length;B<A;B++){var D=F[B];this.removeTileMonitoringHooks(D);D.destroy()}}while(this.grid[0].length>C){for(var B=0,A=this.grid.length;B<A;B++){var F=this.grid[B];var D=F.pop();this.removeTileMonitoringHooks(D);D.destroy()}}},onMapResize:function(){if(this.singleTile){this.clearGrid();this.setTileSize()}},getTileBounds:function(D){var C=this.maxExtent;var F=this.getResolution();var E=F*this.tileSize.w;var B=F*this.tileSize.h;var H=this.getLonLatFromViewPortPx(D);var A=C.left+(E*Math.floor((H.lon-C.left)/E));var G=C.bottom+(B*Math.floor((H.lat-C.bottom)/B));return new OpenLayers.Bounds(A,G,A+E,G+B)},CLASS_NAME:"OpenLayers.Layer.Grid"});OpenLayers.Style=OpenLayers.Class({name:null,title:null,description:null,layerName:null,isDefault:false,rules:null,context:null,defaultStyle:null,propertyStyles:null,initialize:function(B,A){this.rules=[];this.setDefaultStyle(B||OpenLayers.Feature.Vector.style["default"]);OpenLayers.Util.extend(this,A)},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(J){var A=this.createLiterals(OpenLayers.Util.extend({},this.defaultStyle),J);var I=this.rules;var H,B;var C=[];var F=false;for(var D=0,E=I.length;D<E;D++){H=I[D];var G=H.evaluate(J);if(G){if(H instanceof OpenLayers.Rule&&H.elseFilter){C.push(H)}else{F=true;this.applySymbolizer(H,A,J)}}}if(F==false&&C.length>0){F=true;for(var D=0,E=C.length;D<E;D++){this.applySymbolizer(C[D],A,J)}}if(I.length>0&&F==false){A.display="none"}else{A.display=""}return A},applySymbolizer:function(E,D,B){var A=B.geometry?this.getSymbolizerPrefix(B.geometry):OpenLayers.Style.SYMBOLIZER_PREFIXES[0];var C=E.symbolizer[A]||E.symbolizer;return this.createLiterals(OpenLayers.Util.extend(D,C),B)},createLiterals:function(D,C){var B=this.context||C.attributes||C.data;for(var A in this.propertyStyles){D[A]=OpenLayers.Style.createLiteral(D[A],B,C)}return D},findPropertyStyles:function(){var D={};var F=this.defaultStyle;this.addPropertyStyles(D,F);var H=this.rules;var E,G;for(var C=0,A=H.length;C<A;C++){var E=H[C].symbolizer;for(var B in E){G=E[B];if(typeof G=="object"){this.addPropertyStyles(D,G)}else{this.addPropertyStyles(D,E);break}}}return D},addPropertyStyles:function(B,C){var D;for(var A in C){D=C[A];if(typeof D=="string"&&D.match(/\$\{\w+\}/)){B[A]=true}}return B},addRules:function(A){this.rules=this.rules.concat(A);this.propertyStyles=this.findPropertyStyles()},setDefaultStyle:function(A){this.defaultStyle=A;this.propertyStyles=this.findPropertyStyles()},getSymbolizerPrefix:function(D){var C=OpenLayers.Style.SYMBOLIZER_PREFIXES;for(var B=0,A=C.length;B<A;B++){if(D.CLASS_NAME.indexOf(C[B])!=-1){return C[B]}}},CLASS_NAME:"OpenLayers.Style"});OpenLayers.Style.createLiteral=function(C,B,A){if(typeof C=="string"&&C.indexOf("${")!=-1){C=OpenLayers.String.format(C,B,[A]);C=(isNaN(C)||!C)?C:parseFloat(C)}return C};OpenLayers.Style.SYMBOLIZER_PREFIXES=["Point","Line","Polygon","Text"];OpenLayers.Control.Navigation=OpenLayers.Class(OpenLayers.Control,{dragPan:null,dragPanOptions:null,zoomBox:null,zoomWheelEnabled:true,handleRightClicks:false,initialize:function(A){this.handlers={};OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.deactivate();if(this.dragPan){this.dragPan.destroy()}this.dragPan=null;if(this.zoomBox){this.zoomBox.destroy()}this.zoomBox=null;OpenLayers.Control.prototype.destroy.apply(this,arguments)},activate:function(){this.dragPan.activate();if(this.zoomWheelEnabled){this.handlers.wheel.activate()}this.handlers.click.activate();this.zoomBox.activate();return OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){this.zoomBox.deactivate();this.dragPan.deactivate();this.handlers.click.deactivate();this.handlers.wheel.deactivate();return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},draw:function(){if(this.handleRightClicks){this.map.div.oncontextmenu=function(){return false}}var A={dblclick:this.defaultDblClick,dblrightclick:this.defaultDblRightClick};var B={"double":true,stopDouble:true};this.handlers.click=new OpenLayers.Handler.Click(this,A,B);this.dragPan=new OpenLayers.Control.DragPan(OpenLayers.Util.extend({map:this.map},this.dragPanOptions));this.zoomBox=new OpenLayers.Control.ZoomBox({map:this.map,keyMask:OpenLayers.Handler.MOD_SHIFT});this.dragPan.draw();this.zoomBox.draw();this.handlers.wheel=new OpenLayers.Handler.MouseWheel(this,{up:this.wheelUp,down:this.wheelDown});this.activate()},defaultDblClick:function(B){var A=this.map.getLonLatFromViewPortPx(B.xy);this.map.setCenter(A,this.map.zoom+1)},defaultDblRightClick:function(B){var A=this.map.getLonLatFromViewPortPx(B.xy);this.map.setCenter(A,this.map.zoom-1)},wheelChange:function(H,C){var F=this.map.getZoom()+C;if(!this.map.isValidZoomLevel(F)){return }var I=this.map.getSize();var E=I.w/2-H.xy.x;var D=H.xy.y-I.h/2;var G=this.map.baseLayer.getResolutionForZoom(F);var A=this.map.getLonLatFromPixel(H.xy);var B=new OpenLayers.LonLat(A.lon+E*G,A.lat+D*G);this.map.setCenter(B,F)},wheelUp:function(A){this.wheelChange(A,1)},wheelDown:function(A){this.wheelChange(A,-1)},disableZoomWheel:function(){this.zoomWheelEnabled=false;this.handlers.wheel.deactivate()},enableZoomWheel:function(){this.zoomWheelEnabled=true;if(this.active){this.handlers.wheel.activate()}},CLASS_NAME:"OpenLayers.Control.Navigation"});OpenLayers.Geometry=OpenLayers.Class({id:null,parent:null,bounds:null,initialize:function(){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){this.id=null;this.bounds=null},clone:function(){return new OpenLayers.Geometry()},setBounds:function(A){if(A){this.bounds=A.clone()}},clearBounds:function(){this.bounds=null;if(this.parent){this.parent.clearBounds()}},extendBounds:function(B){var A=this.getBounds();if(!A){this.setBounds(B)}else{this.bounds.extend(B)}},getBounds:function(){if(this.bounds==null){this.calculateBounds()}return this.bounds},calculateBounds:function(){},atPoint:function(E,H,F){var C=false;var D=this.getBounds();if((D!=null)&&(E!=null)){var B=(H!=null)?H:0;var A=(F!=null)?F:0;var G=new OpenLayers.Bounds(this.bounds.left-B,this.bounds.bottom-A,this.bounds.right+B,this.bounds.top+A);C=G.containsLonLat(E)}return C},getLength:function(){return 0},getArea:function(){return 0},toString:function(){return OpenLayers.Format.WKT.prototype.write(new OpenLayers.Feature.Vector(this))},CLASS_NAME:"OpenLayers.Geometry"});OpenLayers.Geometry.segmentsIntersect=function(Q,P,M){var A=false;var N=Q.x1-P.x1;var B=Q.y1-P.y1;var O=Q.x2-Q.x1;var C=Q.y2-Q.y1;var L=P.y2-P.y1;var F=P.x2-P.x1;var I=(L*O)-(F*C);var H=(F*B)-(L*N);var G=(O*B)-(C*N);if(I==0){if(H==0&&G==0){A=true}}else{var E=H/I;var D=G/I;if(E>=0&&E<=1&&D>=0&&D<=1){if(!M){A=true}else{var K=Q.x1+(E*O);var J=Q.y1+(E*C);A=new OpenLayers.Geometry.Point(K,J)}}}return A};OpenLayers.Layer.DeferredGoogle=OpenLayers.Class(OpenLayers.Layer,{name:null,options:null,arguments:null,isBaseLayer:true,waitingForSwap:false,initialize:function(B,A){OpenLayers.Layer.prototype.initialize.apply(this,arguments);this.name=B;this.options=A;this.arguments=arguments},display:function(B){var A=this;if(B&&!this.waitingForSwap){this.waitingForSwap=true;this.loadGoogleMapsCode(function(){A.swapLayer()})}},swapLayer:function(){if(this.options.type=="G_PHYSICAL_MAP"){this.options.type=G_PHYSICAL_MAP}else{if(this.options.type=="G_SATELLITE_MAP"){this.options.type=G_SATELLITE_MAP}else{if(this.options.type=="G_NORMAL_MAP"){this.options.type=G_NORMAL_MAP}}}var C=this.map;var B=new OpenLayers.Layer.Google(this.name,this.options,this.arguments);var A=C.getLayerIndex(this);C.addLayer(B);C.removeLayer(this);C.setLayerIndex(B,A);C.setBaseLayer(B)},loadGoogleMapsCode:function(D){var C=true;try{if(!G_NORMAL_MAP){C=false}}catch(A){C=false}if(C){D();return }var B=this;google.load("maps","2",{callback:function(){D()}})},CLASS_NAME:"OpenLayers.Layer.DeferredGoogle"});OpenLayers.Layer.WMS=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{service:"WMS",version:"1.1.1",request:"GetMap",styles:"",exceptions:"application/vnd.ogc.se_inimage",format:"image/jpeg"},reproject:false,isBaseLayer:true,encodeBBOX:false,initialize:function(D,C,E,B){var A=[];E=OpenLayers.Util.upperCaseObject(E);A.push(D,C,E,B);OpenLayers.Layer.Grid.prototype.initialize.apply(this,A);OpenLayers.Util.applyDefaults(this.params,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS));if(this.params.TRANSPARENT&&this.params.TRANSPARENT.toString().toLowerCase()=="true"){if((B==null)||(!B.isBaseLayer)){this.isBaseLayer=false}if(this.params.FORMAT=="image/jpeg"){this.params.FORMAT=OpenLayers.Util.alphaHack()?"image/gif":"image/png"}}},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments)},clone:function(A){if(A==null){A=new OpenLayers.Layer.WMS(this.name,this.url,this.params,this.options)}A=OpenLayers.Layer.Grid.prototype.clone.apply(this,[A]);return A},getURL:function(B){B=this.adjustBounds(B);var C=this.getImageSize();var D={BBOX:this.encodeBBOX?B.toBBOX():B.toArray(),WIDTH:C.w,HEIGHT:C.h};var A=this.getFullRequestString(D);return A},addTile:function(B,A){return new OpenLayers.Tile.Image(this,A,B,null,this.tileSize)},mergeNewParams:function(C){var B=OpenLayers.Util.upperCaseObject(C);var A=[B];return OpenLayers.Layer.Grid.prototype.mergeNewParams.apply(this,A)},getFullRequestString:function(C,B){var A=this.map.getProjection();this.params.SRS=(A=="none")?null:A;return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments)},CLASS_NAME:"OpenLayers.Layer.WMS"});OpenLayers.StyleMap=OpenLayers.Class({styles:null,extendDefault:true,initialize:function(C,A){this.styles={"default":new OpenLayers.Style(OpenLayers.Feature.Vector.style["default"]),select:new OpenLayers.Style(OpenLayers.Feature.Vector.style.select),temporary:new OpenLayers.Style(OpenLayers.Feature.Vector.style.temporary)};if(C instanceof OpenLayers.Style){this.styles["default"]=C;this.styles.select=C;this.styles.temporary=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);break}}}}}OpenLayers.Util.extend(this,A)},destroy:function(){for(var A in this.styles){this.styles[A].destroy()}this.styles=null},createSymbolizer:function(B,C){if(!B){B=new OpenLayers.Feature.Vector()}if(!this.styles[C]){C="default"}B.renderIntent=C;var A={};if(this.extendDefault&&C!="default"){A=this.styles["default"].createSymbolizer(B)}return OpenLayers.Util.extend(A,this.styles[C].createSymbolizer(B))},addUniqueValueRules:function(B,D,F,A){var E=[];for(var C in F){E.push(new OpenLayers.Rule({symbolizer:F[C],context:A,filter:new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.EQUAL_TO,property:D,value:C})}))}this.styles[B].addRules(E)},CLASS_NAME:"OpenLayers.StyleMap"});OpenLayers.Geometry.Collection=OpenLayers.Class(OpenLayers.Geometry,{components:null,componentTypes:null,initialize:function(A){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.components=[];if(A!=null){this.addComponents(A)}},destroy:function(){this.components.length=0;this.components=null},clone:function(){var geometry=eval("new "+this.CLASS_NAME+"()");for(var i=0,len=this.components.length;i<len;i++){geometry.addComponent(this.components[i].clone())}OpenLayers.Util.applyDefaults(geometry,this);return geometry},getComponentsString:function(){var B=[];for(var C=0,A=this.components.length;C<A;C++){B.push(this.components[C].toShortString())}return B.join(",")},calculateBounds:function(){this.bounds=null;if(this.components&&this.components.length>0){this.setBounds(this.components[0].getBounds());for(var B=1,A=this.components.length;B<A;B++){this.extendBounds(this.components[B].getBounds())}}},addComponents:function(C){if(!(C instanceof Array)){C=[C]}for(var B=0,A=C.length;B<A;B++){this.addComponent(C[B])}},addComponent:function(B,A){var D=false;if(B){if(this.componentTypes==null||(OpenLayers.Util.indexOf(this.componentTypes,B.CLASS_NAME)>-1)){if(A!=null&&(A<this.components.length)){var E=this.components.slice(0,A);var C=this.components.slice(A,this.components.length);E.push(B);this.components=E.concat(C)}else{this.components.push(B)}B.parent=this;this.clearBounds();D=true}}return D},removeComponents:function(B){if(!(B instanceof Array)){B=[B]}for(var A=B.length-1;A>=0;--A){this.removeComponent(B[A])}},removeComponent:function(A){OpenLayers.Util.removeItem(this.components,A);this.clearBounds()},getLength:function(){var C=0;for(var B=0,A=this.components.length;B<A;B++){C+=this.components[B].getLength()}return C},getArea:function(){var C=0;for(var B=0,A=this.components.length;B<A;B++){C+=this.components[B].getArea()}return C},move:function(B,D){for(var C=0,A=this.components.length;C<A;C++){this.components[C].move(B,D)}},rotate:function(D,B){for(var C=0,A=this.components.length;C<A;++C){this.components[C].rotate(D,B)}},resize:function(D,A,C){for(var B=0;B<this.components.length;++B){this.components[B].resize(D,A,C)}},equals:function(D){var B=true;if(!D||!D.CLASS_NAME||(this.CLASS_NAME!=D.CLASS_NAME)){B=false}else{if(!(D.components instanceof Array)||(D.components.length!=this.components.length)){B=false}else{for(var C=0,A=this.components.length;C<A;++C){if(!this.components[C].equals(D.components[C])){B=false;break}}}}return B},transform:function(E,C){if(E&&C){for(var D=0,A=this.components.length;D<A;D++){var B=this.components[D];B.transform(E,C)}this.bounds=null}return this},intersects:function(D){var B=false;for(var C=0,A=this.components.length;C<A;++C){B=D.intersects(this.components[C]);if(B){break}}return B},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(B){var D=0;if((this.x!=null)&&(this.y!=null)&&(B!=null)&&(B.x!=null)&&(B.y!=null)){var C=Math.pow(this.x-B.x,2);var A=Math.pow(this.y-B.y,2);D=Math.sqrt(C+A)}return D},equals:function(A){var B=false;if(A!=null){B=((this.x==A.x&&this.y==A.y)||(isNaN(this.x)&&isNaN(this.y)&&isNaN(A.x)&&isNaN(A.y)))}return B},toShortString:function(){return(this.x+", "+this.y)},move:function(A,B){this.x=this.x+A;this.y=this.y+B;this.clearBounds()},rotate:function(D,B){D*=Math.PI/180;var A=this.distanceTo(B);var C=D+Math.atan2(this.y-B.y,this.x-B.x);this.x=B.x+(A*Math.cos(C));this.y=B.y+(A*Math.sin(C));this.clearBounds()},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()},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},CLASS_NAME:"OpenLayers.Geometry.Point"});OpenLayers.Layer.Vector=OpenLayers.Class(OpenLayers.Layer,{EVENT_TYPES:["beforefeatureadded","beforefeaturesadded","featureadded","featuresadded","beforefeatureremoved","featureremoved","featuresremoved","beforefeatureselected","featureselected","featureunselected","beforefeaturemodified","featuremodified","afterfeaturemodified","refresh"],isBaseLayer:false,isFixed:false,isVector:true,features:null,selectedFeatures:null,unrenderedFeatures:null,reportError:true,style:null,styleMap:null,strategies:null,protocol:null,renderers:["SVG","VML","Canvas"],renderer:null,rendererOptions:null,geometryType:null,drawn:false,initialize:function(C,B){this.EVENT_TYPES=OpenLayers.Layer.Vector.prototype.EVENT_TYPES.concat(OpenLayers.Layer.prototype.EVENT_TYPES);OpenLayers.Layer.prototype.initialize.apply(this,arguments);if(!this.renderer||!this.renderer.supported()){this.assignRenderer()}if(!this.renderer||!this.renderer.supported()){this.renderer=null;this.displayError()}if(!this.styleMap){this.styleMap=new OpenLayers.StyleMap()}this.features=[];this.selectedFeatures=[];this.unrenderedFeatures={};if(this.strategies){for(var D=0,A=this.strategies.length;D<A;D++){this.strategies[D].setLayer(this)}}},destroy:function(){if(this.strategies){var C,B,A;for(B=0,A=this.strategies.length;B<A;B++){C=this.strategies[B];if(C.autoDestroy){C.destroy()}}this.strategies=null}if(this.protocol){if(this.protocol.autoDestroy){this.protocol.destroy()}this.protocol=null}this.destroyFeatures();this.features=null;this.selectedFeatures=null;this.unrenderedFeatures=null;if(this.renderer){this.renderer.destroy()}this.renderer=null;this.geometryType=null;this.drawn=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},refresh:function(A){if(this.inRange&&this.visibility){this.events.triggerEvent("refresh",A)}},assignRenderer:function(){for(var C=0,A=this.renderers.length;C<this.renderers.length;C++){var B=OpenLayers.Renderer[this.renderers[C]];if(B&&B.prototype.supported()){this.renderer=new B(this.div,this.rendererOptions);break}}},displayError:function(){if(this.reportError){OpenLayers.Console.userError(OpenLayers.i18n("browserNotSupported",{renderers:this.renderers.join("\n")}))}},setMap:function(C){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())}if(this.strategies){var D,B,A;for(B=0,A=this.strategies.length;B<A;B++){D=this.strategies[B];if(D.autoActivate){D.activate()}}}},removeMap:function(C){if(this.strategies){var D,B,A;for(B=0,A=this.strategies.length;B<A;B++){D=this.strategies[B];if(D.autoActivate){D.deactivate()}}}},onMapResize:function(){OpenLayers.Layer.prototype.onMapResize.apply(this,arguments);this.renderer.setSize(this.map.getSize())},moveTo:function(G,B,H){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);var E=true;if(!H){this.renderer.root.style.visibility="hidden";this.div.style.left=-parseInt(this.map.layerContainerDiv.style.left)+"px";this.div.style.top=-parseInt(this.map.layerContainerDiv.style.top)+"px";var F=this.map.getExtent();E=this.renderer.setExtent(F,B);this.renderer.root.style.visibility="visible";if(navigator.userAgent.toLowerCase().indexOf("gecko")!=-1){this.div.scrollLeft=this.div.scrollLeft}if(!B&&E){for(var D in this.unrenderedFeatures){var C=this.unrenderedFeatures[D];this.drawFeature(C)}}}if(!this.drawn||B||!E){this.drawn=true;var C;for(var D=0,A=this.features.length;D<A;D++){if(D!=(this.features.length-1)){this.renderer.locked=true}else{this.renderer.locked=false}C=this.features[D];this.drawFeature(C)}}},addFeatures:function(B,I){if(!(B instanceof Array)){B=[B]}var G=!I||!I.silent;if(G){var A={features:B};var F=this.events.triggerEvent("beforefeaturesadded",A);if(F===false){return }B=A.features}for(var C=0,E=B.length;C<E;C++){if(C!=(B.length-1)){this.renderer.locked=true}else{this.renderer.locked=false}var H=B[C];if(this.geometryType&&!(H.geometry instanceof this.geometryType)){var D=OpenLayers.i18n("componentShouldBe",{geomType:this.geometryType.prototype.CLASS_NAME});throw D}this.features.push(H);H.layer=this;if(!H.style&&this.style){H.style=OpenLayers.Util.extend({},this.style)}if(G){if(this.events.triggerEvent("beforefeatureadded",{feature:H})===false){continue}this.preFeatureInsert(H)}if(this.drawn){this.drawFeature(H)}if(G){this.events.triggerEvent("featureadded",{feature:H});this.onFeatureInsert(H)}}if(G){this.events.triggerEvent("featuresadded",{features:B})}},removeFeatures:function(E,A){if(!E||E.length===0){return }if(!(E instanceof Array)){E=[E]}var D=!A||!A.silent;for(var C=E.length-1;C>=0;C--){if(C!=0&&E[C-1].geometry){this.renderer.locked=true}else{this.renderer.locked=false}var B=E[C];delete this.unrenderedFeatures[B.id];if(D){this.events.triggerEvent("beforefeatureremoved",{feature:B})}this.features=OpenLayers.Util.removeItem(this.features,B);B.layer=null;if(B.geometry){this.renderer.eraseGeometry(B.geometry)}if(OpenLayers.Util.indexOf(this.selectedFeatures,B)!=-1){OpenLayers.Util.removeItem(this.selectedFeatures,B)}if(D){this.events.triggerEvent("featureremoved",{feature:B})}}if(D){this.events.triggerEvent("featuresremoved",{features:E})}},destroyFeatures:function(D,A){var C=(D==undefined);if(C){D=this.features}if(D){this.removeFeatures(D,A);for(var B=D.length-1;B>=0;B--){D[B].destroy()}}},drawFeature:function(A,B){if(typeof B!="object"){var C=typeof B=="string"?B:A.renderIntent;B=A.style||this.style;if(!B){B=this.styleMap.createSymbolizer(A,C)}}if(!this.renderer.drawFeature(A,B)){this.unrenderedFeatures[A.id]=A}else{delete this.unrenderedFeatures[A.id]}},eraseFeatures:function(A){this.renderer.eraseFeatures(A)},getFeatureFromEvent:function(A){if(!this.renderer){OpenLayers.Console.error(OpenLayers.i18n("getFeatureError"));return null}var B=this.renderer.getFeatureIdFromEvent(A);return this.getFeatureById(B)},getFeatureById:function(D){var C=null;for(var B=0,A=this.features.length;B<A;++B){if(this.features[B].id==D){C=this.features[B];break}}return C},onFeatureInsert:function(A){},preFeatureInsert:function(A){},getDataExtent:function(){var B=null;if(this.features&&(this.features.length>0)){var B=this.features[0].geometry.getBounds();for(var C=0,A=this.features.length;C<A;C++){B.extend(this.features[C].geometry.getBounds())}}return B},CLASS_NAME:"OpenLayers.Layer.Vector"});OpenLayers.Geometry.MultiPoint=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(A){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments)},addPoint:function(A,B){this.addComponent(A,B)},removePoint:function(A){this.removeComponent(A)},CLASS_NAME:"OpenLayers.Geometry.MultiPoint"});OpenLayers.Geometry.Curve=OpenLayers.Class(OpenLayers.Geometry.MultiPoint,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(A){OpenLayers.Geometry.MultiPoint.prototype.initialize.apply(this,arguments)},getLength:function(){var C=0;if(this.components&&(this.components.length>1)){for(var B=1,A=this.components.length;B<A;B++){C+=this.components[B-1].distanceTo(this.components[B])}}return C},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(K){var C=false;var J=K.CLASS_NAME;if(J=="OpenLayers.Geometry.LineString"||J=="OpenLayers.Geometry.LinearRing"||J=="OpenLayers.Geometry.Point"){var N=this.getSortedSegments();var L;if(J=="OpenLayers.Geometry.Point"){L=[{x1:K.x,y1:K.y,x2:K.x,y2:K.y}]}else{L=K.getSortedSegments()}var Q,G,E,A,P,O,D,B;outer:for(var H=0,I=N.length;H<I;++H){Q=N[H];G=Q.x1;E=Q.x2;A=Q.y1;P=Q.y2;inner:for(var F=0,M=L.length;F<M;++F){O=L[F];if(O.x1>E){break}if(O.x2<G){continue}D=O.y1;B=O.y2;if(Math.min(D,B)>Math.max(A,P)){continue}if(Math.max(D,B)<Math.min(A,P)){continue}if(OpenLayers.Geometry.segmentsIntersect(Q,O)){C=true;break outer}}}}else{C=K.intersects(this)}return C},getSortedSegments:function(){var A=this.components.length-1;var B=new Array(A);for(var C=0;C<A;++C){point1=this.components[C];point2=this.components[C+1];if(point1.x<point2.x){B[C]={x1:point1.x,y1:point1.y,x2:point2.x,y2:point2.y}}else{B[C]={x1:point2.x,y1:point2.y,x2:point1.x,y2:point1.y}}}function D(F,E){return F.x1-E.x1}return B.sort(D)},CLASS_NAME:"OpenLayers.Geometry.LineString"});var DatePickerUtils={oneDayInMs:24*3600*1000,_daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],getMonthDays:function(A,B){if(((0==(A%4))&&((0!=(A%100))||(0==(A%400))))&&(B==1)){return 29}return this._daysInMonth[B]},parseDate:function(C){var A=DatePickerUtils.ansiDateToObject(C);if(!A){var B=parseFloat(C);A=new Date();A.setTime(A.getTime()+C*this.oneDayInMs)}return A},dateObjectToAnsi:function(A){if(!A){return null}return A.getFullYear().toPaddedString(4)+"-"+(A.getMonth()+1).toPaddedString(2)+"-"+A.getDate().toPaddedString(2)},ansiDateToObject:function(C){var A=null;var B=String(C).match(/^(\d+)-0*(\d+)-0*(\d+)$/);if(B){A=new Date(B[1],B[2]-1,B[3])}return A},yearMonthToAnsiStub:function(A,B){return A.toPaddedString(4)+"-"+(B+1).toPaddedString(2)+"-"},noDatesBefore:function(A){return new DatePickerFilter(function(D,H){var B=DatePickerUtils.dateObjectToAnsi(A);var G=new Array();var F=DatePickerUtils.getMonthDays(D,H);var E=DatePickerUtils.yearMonthToAnsiStub(D,H);for(var C=1;C<=F;C++){G[C]=(B>(E+C.toPaddedString(2)))}return G},function(C,E){var B=DatePickerUtils.dateObjectToAnsi(A);var D=DatePickerUtils.yearMonthToAnsiStub(C,E)+DatePickerUtils.getMonthDays(C,E);return(B<=D)})},noDatesAfter:function(A){return new DatePickerFilter(function(D,H){var B=DatePickerUtils.dateObjectToAnsi(A);var G=new Array();var F=DatePickerUtils.getMonthDays(D,H);var E=DatePickerUtils.yearMonthToAnsiStub(D,H);for(var C=1;C<=F;C++){G[C]=(B<(E+C.toPaddedString(2)))}return G},function(C,E){var B=DatePickerUtils.dateObjectToAnsi(A);var D=DatePickerUtils.yearMonthToAnsiStub(C,E)+"01";return(B>=D)})}};var DatePickerFormatter=Class.create();DatePickerFormatter.prototype={initialize:function(B,A){if(Object.isUndefined(B)){B=["yyyy","mm","dd"]}if(Object.isUndefined(A)){A="-"}this._format=B;this.separator=A;this._formatYearIndex=B.indexOf("yyyy");this._formatMonthIndex=B.indexOf("mm");this._formatDayIndex=B.indexOf("dd");this._yearRegexp=/^\d{4}$/;this._monthRegexp=/^0\d|1[012]|\d$/;this._dayRegexp=/^0\d|[12]\d|3[01]|\d$/},match:function(E){var D=E.split(this.separator);if(D.length<3){return false}var B=D[this._formatYearIndex].match(this._yearRegexp);if(B){B=B[0]}else{return false}var C=D[this._formatMonthIndex].match(this._monthRegexp);if(C){C=C[0]}else{return false}var A=D[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(C,E,B,D){if(Object.isUndefined(D)){D=this.separator}var A=[0,0,0];A[this._formatYearIndex]=C;A[this._formatMonthIndex]=E.toPaddedString(2);A[this._formatDayIndex]=B.toPaddedString(2);return A.join(D)}};var DatePickerFilter=Class.create();DatePickerFilter.prototype={initialize:function(A,B){if(A){this.badDates=A}if(B){this.validMonthP=B}},badDates:null,validMonthP:null,append:function(C){if(!this.badDates){this.badDates=C.badDates}else{if(C.badDates){var B=this.badDates;this.badDates=function(G,H){var E=B(G,H);var D=C.badDates(G,H);for(var F=0;F<E.length;F++){E[F]=E[F]||D[F]}return E}}}if(!this.validMonthP){this.validMonthP=C.validMonthP}else{if(C.validMonthP){var A=this.validMonthP;this.validMonthP=function(D,E){return A(D,E)&&C.validMonthP(D,E)}}}return this}};var DatePicker=Class.create();DatePicker.prototype={Version:"1.0.0",_relative:null,_div:null,_dateFormat:null,_language:"en",_language_month:$H({en:["January","February","March","April","May","June","July","August","September","October","November","December"]}),_language_day:$H({en:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]}),_language_date_format:$H({en:[["yyyy","mm","dd"],"-"]}),_todayDate:new Date(),_currentDate:null,_dateFilter:new DatePickerFilter(),_id_datepicker:null,_element:null,_callback:null,getMonthLocale:function(A){return this._language_month.get(this._language)[A]},_initCurrentDate:function(){if(!this._dateFormat){this._dateFormat=this._language_date_format.get(this._language)}this._df=new DatePickerFormatter(this._dateFormat[0],this._dateFormat[1]);var A=this._df.match(this._currentDate);this._currentYear=Number(A[0]);this._currentMonth=Number(A[1])-1;this._currentDay=Number(A[2])},initialize:function(A){this._relative=A.relative;if(!Object.isUndefined(A.currentDate)){this._currentDate=A.currentDate}if(!Object.isUndefined(A.element)){this._element=A.element}if(!Object.isUndefined(A.callback)){this._callback=A.callback}if(!Object.isUndefined(A.dateFilter)&&A.dateFilter){this._dateFilter=A.dateFilter}this._id_datepicker="datepicker-"+this._relative;this._id_datepicker_prev=this._id_datepicker+"-prev";this._id_datepicker_next=this._id_datepicker+"-next";this._id_datepicker_hdr=this._id_datepicker+"-header";this._div=new Element("div",{id:this._id_datepicker,className:"datepicker"});this._div.innerHTML='<table><thead><tr><th width="10px" id="'+this._id_datepicker_prev+'" style="cursor: pointer;">&nbsp;&lt;&lt;&nbsp;</th><th id="'+this._id_datepicker_hdr+'" colspan="5"></th><th width="10px" id="'+this._id_datepicker_next+'" style="cursor: pointer;">&nbsp;&gt;&gt;&nbsp;</th></tr></thead><tbody id="'+this._id_datepicker+'-tbody"></tbody></table>';this._element.update(this._div);this.load()},load:function(){this._initCurrentDate();Event.observe($(this._id_datepicker_prev),"click",this.prevMonth.bindAsEventListener(this),false);Event.observe($(this._id_datepicker_next),"click",this.nextMonth.bindAsEventListener(this),false);this._initCurrentDate();this._redrawCalendar()},_wrap_in_iframe:function(A){return(Prototype.Browser.IE)?"<div style='height:167px;width:185px;background-color:white;align:left'><iframe width='100%' height='100%' marginwidth='0' marginheight='0' frameborder='0' src='about:blank' style='filter:alpha(Opacity=50);'></iframe><div style='position:absolute;background-color:white;top:2px;left:2px;width:180px'>"+A+"</div></div>":A},close:function(){},setDateFormat:function(B,A){if(Object.isUndefined(B)){B=this._dateFormat[0]}if(Object.isUndefined(A)){A=this._dateFormat[1]}this._dateFormat=[B,A]},_buildCalendar:function(){var D=this;var A=$(this._id_datepicker+"-tbody");try{while(A.hasChildNodes()){A.removeChild(A.childNodes[0])}}catch(Q){}var K=new Element("tr");this._language_day.get(this._language).each(function(V){var W=new Element("td");W.innerHTML=V;W.className="wday";K.appendChild(W)});A.appendChild(K);var R=[[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 M=this._currentMonth;var U=this._currentYear;var S=new Date(U,M,1,12);var E=(S.getDay()+6)%7;var C=DatePickerUtils.getMonthDays(U,M);var G=1;var T=(this._dateFilter.badDates)?this._dateFilter.badDates(U,M):[];for(var O=E;O<7;O++){R[0][O]={d:G,m:M,y:U,b:T[G]};G++}var I=this._prevMonthYear();var L=DatePickerUtils.getMonthDays(I[1],I[0]);for(var O=0;O<E;O++){R[0][O]={d:Number(L-E+O+1),m:Number(I[0]),y:I[1],c:"outbound",b:true}}var N=false;for(var P=1;P<6;P++){for(var O=0;O<7;O++){R[P][O]={d:G,m:M,y:U,c:(N)?"outbound":(((G==this._currentDay)&&(M==this._currentMonth)&&(U==this._currentYear))?"today":null),b:N||T[G]};G++;if(G>C){G=1;N=true;if(this._currentMonth+1>11){M=0;U+=1}else{M+=1}}}}for(var P=0;P<6;P++){var B=new Element("tr");for(var O=0;O<7;O++){var H=R[P][O];var F=new Element("td");var J=$A([this._relative,this._df.dateToString(H.y,H.m+1,H.d,"-")]).join("-");F.setAttribute("id",J);if(H.c){F.className=H.c}this._bindCellOnClick(F,H.b,H.c);F.innerHTML=H.d;B.appendChild(F)}A.appendChild(B)}return A},_bindCellOnClick:function(D,B,C){if(B){D.className=(C)?"nclick_"+C:"nclick"}else{var A=this;D.onclick=function(){if(A._callback){A._callback(String($(this).readAttribute("id")).replace(A._relative+"-","").replace(/-/g,A._df.separator))}A.close()}}},_nextMonthYear:function(){var B=this._currentMonth;var A=this._currentYear;if(B+1>11){B=0;A+=1}else{B+=1}return[B,A]},nextMonth:function(){this._maybeRedrawMonth(this._nextMonthYear())},_prevMonthYear:function(){var B=this._currentMonth;var A=this._currentYear;if(B-1<0){B=11;A-=1}else{B-=1}return[B,A]},prevMonth:function(){this._maybeRedrawMonth(this._prevMonthYear())},_maybeRedrawMonth:function(C){var B=C[0];var A=C[1];if(!this._dateFilter.validMonthP||this._dateFilter.validMonthP(A,B)){this._currentMonth=B;this._currentYear=A;this._redrawCalendar()}},_redrawCalendar:function(){this._setLocaleHdr();this._buildCalendar()},_setLocaleHdr:function(){var A=this._nextMonthYear();$(this._id_datepicker_next).setAttribute("title",this.getMonthLocale(A[0])+" "+A[1]);var B=this._prevMonthYear();$(this._id_datepicker_prev).setAttribute("title",this.getMonthLocale(B[0])+" "+B[1]);$(this._id_datepicker_hdr).update("&nbsp;&nbsp;&nbsp;"+this.getMonthLocale(this._currentMonth)+"&nbsp;"+this._currentYear+"&nbsp;&nbsp;&nbsp;")}};var at=Class.create();at.idiom=Class.create();at.idiom.js=Class.create();at.idiom.js.main=Class.create();at.idiom.js.main.Main=Class.create({initialize:function(){this.loadCounter=new at.idiom.js.util.Counter();this.observers={global:{},local:{}};this.history=new at.idiom.js.history.History(this)},loadStart:function(A){this.loadCounter.start(A)},loadEnd:function(A){this.loadCounter.end(A)},loadRegisterStart:function(A){this.loadCounter.registerStart(A)},loadRegisterEnd:function(A){this.loadCounter.registerEnd(A)},updateLocation:function(A){window.location.hash=A},notify:function(A,C,D){var B=null;if(A){B=this.observers.local[A]}else{B=this.observers.global}if(B==null){B={}}if(B[C]==null){B[C]={param:null,functions:[]}}B[C].param=D;$(B[C].functions).each(function(F){try{F(D)}catch(E){}});if(A){this.observers.local[A]=B}else{this.observers.global=B}},register:function(A,D,E){var C=null;if(A){if(this.observers.local[A]==null){this.observers.local[A]={}}C=this.observers.local[A]}else{C=this.observers.global}if(!C[D]){C[D]={param:null,functions:[]};if(A){this.observers.local[A]=C}else{this.observers.global=C}}C[D].functions.push(E);if(C[D].param){try{E(C[D].param)}catch(B){}}}});var IDIOM=null;var IDIOM_LOAD=[];Event.observe(window,"load",function(){IDIOM=new at.idiom.js.main.Main();IDIOM.loadRegisterStart(function(){$("Loading").show()});IDIOM.loadRegisterEnd(function(){$("Loading").hide()});$(IDIOM_LOAD).each(function(A){A(IDIOM)});dhtmlHistory.initialize();dhtmlHistory.addListener(IDIOM.history.listener.bind(IDIOM.history))});window.dhtmlHistory.create({toJSON:function(A){return Object.toJSON(A)},fromJSON:function(A){return A.evalJSON()}});at.idiom.js.history=Class.create();at.idiom.js.history.History=Class.create({initialize:function(A){this.currentCounter=0;this.contentId=0;this.snapshotId=0;this.searchTerm=null;this.searchCount=0;this.searchConcordance=null;this.idiom=A;var B=this;this.idiom.register("history","storeState",function(C){B.storeState(C)})},listener:function(A,B){if(B==null){return }this.restoreState(B);this.idiom.notify(null,"restoreState",B)},restoreState:function(A){this.contentId=A.contentid;this.snapshotId=A.snapshotid;this.searchTerm=A.searchterm;this.searchCount=A.searchcount;this.searchConcordance=A.searchconcordance;this.currentCounter=A.counter},storeState:function(B){var A=false;if(B.contentid!=this.contentId){A=true;this.contentId=B.contentid}if(B.snapshotid!=this.snapshotId){A=true;this.snapshotId=B.snapshotid}if(B.searchterm!=this.searchTerm){A=true;this.searchTerm=B.searchterm}if(B.searchcount!=this.searchCount){A=true;this.searchCount=B.searchcount}if(B.searchconcordance!=this.searchConcordance){A=true;this.searchConcordance=B.searchconcordance}if(A){this.store()}},store:function(){var B={contentid:this.contentId,snapshotid:this.snapshotId,searchterm:this.searchTerm,searchcount:this.searchCount,searchconcordance:this.searchConcordance,counter:++this.currentCounter};var A=this.currentCounter;this.currentFragment=A;dhtmlHistory.add(A,B)}});at.idiom.js.util=Class.create();at.idiom.js.util.Util={};at.idiom.js.util.Util.getPageSize=function(){var C,A;if(window.innerHeight&&window.scrollMaxY){C=window.innerWidth+window.scrollMaxX;A=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){C=document.body.scrollWidth;A=document.body.scrollHeight}else{C=document.body.offsetWidth;A=document.body.offsetHeight}}var B,D;if(self.innerHeight){if(document.documentElement.clientWidth){B=document.documentElement.clientWidth}else{B=self.innerWidth}D=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){B=document.documentElement.clientWidth;D=document.documentElement.clientHeight}else{if(document.body){B=document.body.clientWidth;D=document.body.clientHeight}}}if(A<D){pageHeight=D}else{pageHeight=A}if(C<B){pageWidth=C}else{pageWidth=B}arrayPageSize=new Array(pageWidth,pageHeight,B,D);return arrayPageSize};at.idiom.js.util.Observer=Class.create({initialize:function(){this.callbackFunctions=new Array();this.lastParam=null},register:function(B){var A=true;this.callbackFunctions.each(function(D){if(D==B){A=false;return }});var C=this.lastParam;if(A){this.callbackFunctions.push(B);if(C){setTimeout(function(){B(C)},1)}}},unregister:function(B){var A=this;this.callbackFunctions.each(function(C){if(C==B){A.callbackFunctions.remove(C)}})},notify:function(A){this.callbackFunctions.each(function(C){try{C(A)}catch(B){}});this.lastParam=A}});at.idiom.js.util.Notifier=Class.create({initialize:function(){this.callbackFunction=null;this.lastParam=null},register:function(A){this.callbackFunction=A;if(this.lastParam){this.notify(this.lastParam)}},unregister:function(A){if(this.callbackFunction==A){this.callbackFunction=null}},notify:function(B){try{this.callbackFunction(B)}catch(A){}this.lastParam=B}});at.idiom.js.util.Counter=Class.create({initialize:function(){this.counts=new Array();this.observerStart=new at.idiom.js.util.Observer();this.observerEnd=new at.idiom.js.util.Observer()},start:function(A){this.counts.push(A);if(this.counts.length==1){this.notifyStart()}},end:function(B){var A=this;this.counts.each(function(C){if(C==B){A.counts=A.counts.without(B)}});if(this.counts.length==0){this.notifyEnd()}},notifyStart:function(){this.observerStart.notify()},notifyEnd:function(){this.observerEnd.notify()},registerStart:function(A){this.observerStart.register(A)},unregisterStart:function(A){this.observerStart.unregister(A)},registerEnd:function(A){this.observerEnd.register(A)},unregisterEnd:function(A){this.observerEnd.unregister(A)}});at.idiom.js.util.ImageChanger=Class.create({initialize:function(A){this.delay=A.delay;this.duration=A.duration/1000;this.list=A.list;this.index=0;this.interval=null},start:function(){var A=this;setTimeout(function(){A.toggle()},this.delay)},end:function(){clearInterval(this.interval)},toggle:function(){this.hide(this.index);this.index=++this.index%this.list.length;var A=this;setTimeout(function(){A.show(A.index)},(this.duration/2));setTimeout(function(){A.toggle()},this.delay)},show:function(A){new Effect.Appear(this.list[A],{duration:this.duration})},hide:function(A){new Effect.Fade(this.list[A],{duration:this.duration})}});at.idiom.js.error=Class.create();at.idiom.js.error.Error=Class.create({initialize:function(B){this.element=$(B.id);this.timeout=2000;if(B.timeout){this.timeout=B.timeout}this.hideTimeout=null;var A=this;B.idiom.register("error","display",function(C){A.display(C)})},display:function(A){this.element.update(A);this.displayElement();if(console&&console.log){console.log(A)}},displayElement:function(){clearTimeout(this.hideTimeout);this.element.show();var A=this;setTimeout(function(){A.hideElement()},this.timeout)},hideElement:function(){this.element.hide()}});at.idiom.js.window=Class.create();at.idiom.js.window.Window=Class.create({initialize:function(B){this.window=$(B.window);this.windowId=B.window;this.header=B.windowHeader?$(B.windowHeader):$(B.window+"Title");this.content=B.windowContent?$(B.windowContent):$(B.window+"Content");this.maximizeButton=B.maximizeButton?$(B.maximizeButton):$(B.window+"MaximizeButton");this.parent=this.windowParent?$(B.windowParent):this.window.parentNode;this.canMaximize=B.canMaximize?B.canMaximize:false;this.isMaximized=B.isMaximized?B.isMaximized:false;this.canPopup=B.canPopup?B.canPopup:false;this.popupUrl=B.popupUrl;this.isPopup=false;this.popupWindow=null;this.isVisible=B.isVisible?B.isVisible:false;this.main=B.main?B.main:$("Content");this.placeholder=null;this.window.addClassName("window");var A="";if(this.isVisible){if(this.isMaximized){A="max"}else{A="min"}}else{A="close"}this.idiom=B.idiom},maximize:function(){if(!this.canMaximize||this.isMaximized){return }this.window.addClassName("maximized");this.isMaximized=true;this.maximizeButton.hide();this.placeholder=$(document.createElement("div"));this.window.parentNode.replaceChild(this.placeholder,this.window);this.main.appendChild(this.window);this.window.setStyle({zIndex:5000});this.adjustContentHeight();this.idiom.notify("main","hide",null)},minimize:function(){if(!this.canMaximize||!this.isMaximized){return }this.isMaximized=false;this.window.parentNode.removeChild(this.window);this.parent.replaceChild(this.window,this.placeholder);this.maximizeButton.show();this.window.setStyle({zIndex:0});this.window.removeClassName("maximized");this.adjustContentHeight();this.idiom.notify("main","show",null)},getPosition:function(){return{top:parseFloat(this.window.getStyle("top")),left:parseFloat(this.window.getStyle("left")),right:parseFloat(this.window.getStyle("right")),bottom:parseFloat(this.window.getStyle("bottom")),width:this.window.getWidth(),height:this.window.getHeight(),position:this.window.getStyle("position")}},show:function(E,D,C,B,A){this.window.setStyle({top:E+"px",left:D+"px",width:C+"px",height:B+"px",position:A});this.isVisible=true;this.adjustContentHeight()},close:function(){this.isVisible=false},adjustContentHeight:function(){var A=this.window.getHeight();var B=parseInt(this.content.getStyle("paddingTop"));var C=parseInt(this.content.getStyle("paddingBottom"));A=A-this.header.getHeight()-B-C-3;this.content.setStyle({height:A+"px"})},resetDirectPosition:function(){this.window.setStyle({top:null,left:null,right:null,bottom:null,width:null,height:null})},isWindowMaximized:function(){return this.isMaximized},isWindowMinimized:function(){return !this.isMaximized},isWindowClosed:function(){return !this.isVisible},isWindowShown:function(){return this.isVisible},setWindowTitle:function(A){this.header.down(".viewHeaderTitle").update(A)},popup:function(A,D){if(!this.canPopup){return }this.popupWindow=window.open(A,"Popup"+this.windowId,"dependent=yes,location=no,menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,height=300,width=300");var B=this;var C=function(){if(B.popupWindow.load){B.popupWindow.load(B.idiom,D)}else{setTimeout(C,10)}};setTimeout(C,10)},hideWindow:function(){this.window.hide();this.isVisible=false},showWindow:function(){this.window.show();this.isVisible=true}});at.idiom.js.about=Class.create();at.idiom.js.about.About=Class.create({initialize:function(C){this.idiom=C.idiom;this.main=$(C.box);this.date=$(C.footerdate);this.statusbar=$(C.statusbar);this.shownElement=null;var A=document.getElementsByTagName("body").item(0);this.overlay=$(document.createElement("div"));this.overlay.setAttribute("id",C.overlay);this.overlay.hide();A.appendChild(this.overlay);this.overlayShown=false;this.main.parentNode.removeChild(this.main);A.appendChild(this.main);var B=this;Event.observe(this.overlay,"click",function(){B.hide()});Event.observe(window,"resize",function(){B.resizeOverlay()});this.idiom.register("about","show",function(D){B.show($(D.dialog))});this.idiom.register("about","hide",function(){B.hide()})},show:function(A){var B=this;if(this.shownElement){this.hideBox(function(){B.showDialogHide(A)})}else{this.showDialogHide(A)}},showDialogHide:function(A){var B=this;this.showOverlay(function(){B.showDialog(A)})},showDialog:function(A){$(A).show();this.resizeBox();new Effect.Appear(this.main,{duration:0.1,from:0,to:1,queue:"end"});this.shownElement=A},hide:function(){var A=this;this.hideBox(function(){A.hideOverlay()})},hideBox:function(B){var A=this.shownElement;this.shownElement=null;new Effect.Fade(this.main,{duration:0.1,from:1,to:0,queue:"end",afterFinish:function(){if(A){$(A).hide()}if(B){B()}}})},hideOverlay:function(A){this.overlayShown=false;new Effect.Fade(this.overlay,{duration:0.1,from:0.5,to:0,queue:"end",afterFinish:function(){if(A){A()}}})},showOverlay:function(B){if(!this.overlayShown){this.overlayShown=true;var A=this.getPageSize();this.resizeOverlay();new Effect.Appear(this.overlay,{duration:0.1,from:0,to:0.5,afterFinish:B})}else{if(B){B()}}},resizeBox:function(){if(this.overlayShown){var F=0;var B=this.getPageSize();var E=this.main.getWidth();var G=this.main.getHeight()-F;var D=$("Content").getHeight();var A=(B[0]-E)/2;var C=(D-G)/2;this.main.setStyle({left:A+"px",top:C+"px"})}},resizeOverlay:function(){if(this.overlayShown){var B=0;var A=this.getPageSize();this.overlay.setStyle({top:B+"px",width:A[0]+"px",height:(A[1]-B)+"px",left:"0px"})}},getPageSize:function(){return at.idiom.js.util.Util.getPageSize()},showDate:function(){var C=new Date();var A=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");function D(F){return(F<1900)?F+1900:F}function E(F){return(F<10)?"0"+F:F}var B=A[C.getMonth()]+" "+E(C.getDate())+", "+C.getFullYear()+" "+E(C.getHours())+":"+E(C.getMinutes());this.date.update(B)}});at.idiom.js.maps=Class.create();at.idiom.js.maps.Map=Class.create(at.idiom.js.window.Window,{initialize:function($super,C){$super(C);this.windowClosed=C.windowClosed?$(C.windowClosed):$(C.window+"Closed");this.properties=C.properties?C.properties:{};this.layers=C.layers?C.layers:[];this.scaleX=C.scaleX?C.scaleX:1;this.scaleY=C.scaleY?C.scaleY:1;this.pointX=C.pointX?C.pointX:"lng";this.pointY=C.pointY?C.pointY:"lat";this.drawArcs=C.drawArcs?true:false;this.sourcePointX=C.sourcePointX?C.sourcePointX:"sourceLng";this.sourcePointY=C.sourcePointY?C.sourcePointY:"sourceLat";this.cssPrefix=C.cssPrefix;this.defaultZoom=C.defaultZoom?C.defaultZoom:0;this.searchColour=C.searchColour?C.searchColour:"#ff3333";this.arcStartColour="#fffb9c";this.arcEndColour="#ff3333";this.arcOpacity=0.5;this.searchFillOpacity=C.searchFillOpacity?C.searchFillOpacity:0.25;this.searchGraphicOpacity=C.searchGraphicOpacity?C.searchGraphicOpacity:0.75;this.searchRadius=C.searchRadius?C.searchRadius:3;this.searchRadiusIncrement=C.searchRadiusIncrement?C.searchRadiusIncrement:this.searchRadius;this.searchRadiusIncrementStep=C.searchRadiusIncrementStep?C.searchRadiusIncrementStep:5;this.properties.theme=null;this.map2DContainer=C.map2DContainer?$(C.map2DContainer):this.content;this.mainLayer=null;this.errorElement=null;this.errorElementTimeout=null;this.markerSizeX=C.markerSizeX?C.markerSizeX:16;this.markerSizeY=C.markerSizeY?C.markerSizeY:16;this.map3DContainer=C.map3DContainer?$(C.map3DContainer):this.content;this.map3DEnabled=C.map3DEnabled?true:false;this.map3DButton=C.map3DButton?$(C.map3DButton):null;this.map3DAboutButton=C.map3DAboutButton?$(C.map3DAboutButton):null;this.map3DDocumentButton=C.map3DDocumentButton?$(C.map3DDocumentButton):null;this.map3DProfileButton=C.map3DProfileButton?$(C.map3DProfileButton):null;this.isMap3DShown=C.map3DShown?true:false;this.isMap3DDocumentChooser=false;this.isMap3DTerrainProfile=true;this.isMap3DCreated=false;this.map3DClasspath=C.map3DClasspath;this.map3DImageHostname=C.map3DImageHostname;this.map3DImageDatasetname=C.map3DImageDatasetname;this.map3DImageDatasetLevels=C.map3DImageDatasetLevels;this.map3DImageCachedir=C.map3DImageCachedir;this.map3DBilHostname=C.map3DBilHostname;this.map3DBilDatasetname=C.map3DBilDatasetname;this.map3DBilDatasetLevels=C.map3DBilDatasetLevels;this.map3DBilCachedir=C.map3DBilCachedir;this.map3DJavascriptCallbackFunction=C.map3DJavascriptCallbackFunction?C.map3DJavascriptCallbackFunction:"callbackFromWorldWindApplet";this.windowTitle3d=C.windowTitle3d?C.windowTitle3d:"";this.windowTitleNormal=C.windowTitleNormal?C.windowTitleNormal:"";var A=false;if(!this.isVisible){this.show(0,0,100,100,"absolute");A=true}this.createMap();if(A){this.close()}var B=this;this.idiom.register(null,"changeMainLayer",function(D){B.switchMainLayer(D)})},createMap:function(){this.map=new OpenLayers.Map(this.map2DContainer,this.properties);var A=this;var B=0;this.layers.each(function(D){var C=null;B++;C=A.createLayer(D,B);if(C){A.map.addLayer(C)}});this.map.events.register("changebaselayer",this.map,function(C){A.transformProjection()});if(this.layers.size()>1){this.map.addControl(new OpenLayers.Control.LayerSwitcher())}this.markersLayer=new OpenLayers.Layer.Markers("Document Markers",{layerSwitcherOrder:++B});this.searchMarkersLayer=new OpenLayers.Layer.Vector("Search Results",{layerSwitcherOrder:++B});this.map.addLayer(this.searchMarkersLayer);if(this.drawArcs){this.searchArcsLayer=new OpenLayers.Layer.Vector("Trajectories",{layerSwitcherOrder:++B});this.map.addLayer(this.searchArcsLayer)}this.map.addLayer(this.markersLayer);this.markersNormal=new Array();this.markersHighlight=new Array();this.map.zoomTo(this.defaultZoom);this.transformProjection(true);this.centerPoint=null;this.idiom.notify("maps","register",{map:this})},createLayer:function(A,B){if(A.type=="WMS"){layer=new OpenLayers.Layer.WMS(A.description,A.url,{layers:A.layers,resolutions:A.resolutions,units:A.units},{layerSwitcherOrder:B})}else{if(A.type=="Google"){layer=new OpenLayers.Layer.DeferredGoogle(A.description,{type:A.layers,sphericalMercator:true,projection:new OpenLayers.Projection("EPSG:900913"),maxExtent:new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34)},{layerSwitcherOrder:B})}}if(layer&&A.mainLayer){this.mainLayer=layer}return layer},transformProjection:function(B){var A=this.markersLayer.projection;var C=this.map.getProjectionObject();var E=A.getCode()!=C.getCode();this.map.restrictedExtent=this.map.baseLayer.maxExtent;var D=this.map.getLayersBy("isVector",true);$(D).each(function(F){F.maxResolution=this.map.baseLayer.maxResolution;F.minResolution=this.map.baseLayer.minResolution;F.setVisibility(false);F.setVisibility(true);$(F.features).each(function(G){G.geometry.transform(F.projection,C)},this);F.projection=C;F.redraw()},this);this.markersLayer.maxResolution=this.map.baseLayer.maxResolution;this.markersLayer.minResolution=this.map.baseLayer.minResolution;$(this.markersLayer.markers).each(function(F){F.lonlat.transform(this.markersLayer.projection,C)},this);this.markersLayer.projection=C;this.markersLayer.redraw();if(E&&!B){this.map.zoomToMaxExtent()}},switchMainLayer:function(C){var A=null;if(this.mainLayer){A=this.mainLayer;this.mainLayer=null}C.mainLayer=true;var B=this.createLayer(C);if(B){this.map.addLayer(B);this.map.setBaseLayer(B);B.redraw()}if(B&&A){this.map.removeLayer(A)}},create3DMap:function(){if(!this.map3DEnabled){return }if(!this.isMap3DCreated){var B='<!--[if !IE]> Firefox and others will use outer object --><object id="SemanticMapWorldWindApplet" name="SemanticMapWorldWindApplet" type="application/x-java-applet" codetype="application/java-vm"classid="java:org.jdesktop.applet.util.JNLPAppletLauncher.class" archive="http://download.java.net/media/applet-launcher/applet-launcher.jar,http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jar,http://download.java.net/media/gluegen/webstart/gluegen-rt.jar,#{map3dclasspath}worldwind.jar,#{map3dclasspath}plugin.jar,#{map3dclasspath}kpsigned.jar" height="100%" width="100%"><!-- Konqueror browser needs the following param --><param name="archive" value="http://download.java.net/media/applet-launcher/applet-launcher.jar,http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jar,http://download.java.net/media/gluegen/webstart/gluegen-rt.jar,#{map3dclasspath}worldwind.jar,#{map3dclasspath}plugin.jar,#{map3dclasspath}kpsigned.jar"/><param name="code" value="org.jdesktop.applet.util.JNLPAppletLauncher"/><param name="mayscript" value="true"/><param name="codebase_lookup" value="false"/><param name="subapplet.classname" value="at.raven.KnowledgePlanet2.Applet.KnowledgePlanetAppletTwo"/><param name="subapplet.displayname" value="WWJ Applet"/><param name="noddraw.check" value="true"/><param name="progressbar" value="true"/><param name="jnlpNumExtensions" value="1"/><param name="jnlpExtension1" value="http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jnlp"/><param name="ImageHostURL" value="#{map3dimagehostname}" /><param name="ImageDataSetName" value="#{map3dimagedatasetname}" /><param name="ImageCacheDir" value="#{map3dimagecachedir}" /><param name="ImageDataSetLevels" value="#{map3dimagedatasetlevels}" /><param name="BILHostURL" value="#{map3dbilhostname}" /><param name="BILDataSetName" value="#{map3dbildatasetname}" /><param name="BILCacheDir" value="#{map3dbilcachedir}" /><param name="BILDataSetLevels" value="#{map3dbildatasetlevels}" /><param name="JavascriptCallbackFunction" value="#{map3djavascriptcallbackfunction}" /><param name="startLat" value="#{map3dstartlat}" /><param name="startLon" value="#{map3dstartlon}" /><!--<![endif]--><!-- MSIE (Microsoft Internet Explorer) will use inner object --><object id="SemanticMapWorldWindApplet" type="application/x-java-applet"  codetype="application/java-vm" classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" height="100%" width="100%" ><param name="code" value="org.jdesktop.applet.util.JNLPAppletLauncher"/><param name="archive" value="http://download.java.net/media/applet-launcher/applet-launcher.jar,http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jar,http://download.java.net/media/gluegen/webstart/gluegen-rt.jar,#{map3dclasspath}worldwind.jar,#{map3dclasspath}plugin.jar,#{map3dclasspath}kpsigned.jar"/><param name="code" value="org.jdesktop.applet.util.JNLPAppletLauncher"/><param name="mayscript" value="true"/><param name="codebase_lookup" value="false"/><param name="subapplet.classname" value="at.raven.KnowledgePlanet2.Applet.KnowledgePlanetAppletTwo"/><param name="subapplet.displayname" value="WWJ Applet"/><param name="noddraw.check" value="true"/><param name="progressbar" value="true"/><param name="jnlpNumExtensions" value="1"/><param name="jnlpExtension1" value="http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jnlp"/><param name="ImageHostURL" value="#{map3dimagehostname}" /><param name="ImageDataSetName" value="#{map3dimagedatasetname}" /><param name="ImageCacheDir" value="#{map3dimagecachedir}" /><param name="ImageDataSetLevels" value="#{map3dimagedatasetlevels}" /><param name="BILHostURL" value="#{map3dbilhostname}" /><param name="BILDataSetName" value="#{map3dbildatasetname}" /><param name="BILCacheDir" value="#{map3dbilcachedir}" /><param name="BILDataSetLevels" value="#{map3dbildatasetlevels}" /><param name="JavascriptCallbackFunction" value="#{map3djavascriptcallbackfunction}" /><param name="startLat" value="#{map3dstartlat}" /><param name="startLon" value="#{map3dstartlon}" /><strong>This browser does not have a Java Plug-in.<br /><a href="http://java.sun.com/products/plugin/downloads/index.html">Get the latest Java Plug-in here.</a></strong></object> <!--[if !IE]> close outer object --></object><!--<![endif]-->';var C=new Template(B);var D={map3dclasspath:this.map3DClasspath,map3dimagehostname:this.map3DImageHostname,map3dimagedatasetname:this.map3DImageDatasetname,map3dimagedatasetlevels:this.map3DImageDatasetLevels,map3dimagecachedir:this.map3DImageCachedir,map3dbilhostname:this.map3DBilHostname,map3dbildatasetname:this.map3DBilDatasetname,map3dbildatasetlevels:this.map3DBilDatasetLevels,map3dbilcachedir:this.map3DBilCachedir,map3djavascriptcallbackfunction:this.map3DJavascriptCallbackFunction,map3dstartlat:"5",map3dstartlon:"-10"};var A=C.evaluate(D);this.map3DContainer.insert(A)}this.maximize();this.map2DContainer.hide();this.map3DContainer.show();this.isMap3DShown=true;this.map3DButton.hide();this.map3DAboutButton.show();this.map3DProfileButton.show();this.isMap3DCreated=true;this.setWindowTitle(this.windowTitle3d)},destroy3DMap:function(){this.map3DContainer.hide();this.isMap3DShown=false;this.map3DButton.show();this.map3DAboutButton.hide();this.map3DProfileButton.hide();this.map3DContainer.hide();this.map2DContainer.show();this.setWindowTitle(this.windowTitleNormal)},workaroundSubapplet:function(){if(typeof this.workaroundSubappletCount=="undefined"){this.workaroundSubappletCount=0}if(this.workaroundSubappletCount>=10000){return }this.workaroundSubappletCount++;try{$("SemanticMapWorldWindApplet").getSubApplet()}catch(A){var B=this;setTimeout(function(){B.workaroundSubapplet()},1)}},enableDocumentChooser3DMap:function(B){try{$("SemanticMapWorldWindApplet").getSubApplet().setActivateOnSingleClick();this.isMap3DDocumentChooser=true;return true}catch(A){if(!B){return this.enableDocumentChooser3DMap(true)}this.errorHandler("Could not enable document chooser mode.",A)}return false},disableDocumentChooser3DMap:function(B){try{$("SemanticMapWorldWindApplet").getSubApplet().DeActivateClickEvents();this.isMap3DDocumentChooser=false;return true}catch(A){if(!B){return this.disableDocumentChooser3DMap(true)}this.errorHandler("Could not disable document chooser mode.",A)}return false},isDocumentChooser3DMap:function(){return this.isMap3DDocumentChooser},enableTerrainProfile3DMap:function(B){try{$("SemanticMapWorldWindApplet").getSubApplet().enableTerrainProfileLayer();this.isMap3DTerrainProfile=true;return true}catch(A){if(!B){return this.enableTerrainProfile3DMap(true)}this.errorHandler("Could not enable terrain profile mode.",A)}return false},disableTerrainProfile3DMap:function(B){try{$("SemanticMapWorldWindApplet").getSubApplet().disableTerrainProfileLayer();this.isMap3DTerrainProfile=false;return true}catch(A){if(!B){return this.disableTerrainProfile3DMap(true)}this.errorHandler("Could not disable terrain profile mode.",A)}return false},isTerrainProfile3DMap:function(){return this.isMap3DTerrainProfile},refresh3DMap:function(B){try{$("SemanticMapWorldWindApplet").getSubApplet().refresh();return true}catch(A){if(!B){return this.refresh3DMap(true)}}return false},drawMarkers:function(B){var E=B.contentobjects;this.markersLayer.clearMarkers();for(var C=5;C>=0;C--){if(E[C]==null){continue}var A=new OpenLayers.LonLat(parseFloat(E[C].attributes[this.pointX])*this.scaleX,parseFloat(E[C].attributes[this.pointY])*this.scaleY);A.transform(new OpenLayers.Projection("EPSG:4326"),this.map.getProjectionObject());var D=A.clone();this.markersNormal[C]=this.createMarker(C,A,E[C].attributes.location,E[C].attributes.title,E[C].attributes.published,E[C].attributes.mirrorDate,E[C].contentid,false);this.markersLayer.addMarker(this.markersNormal[C]);if(C!=0){this.markersHighlight[C]=this.createMarker(C,D,E[C].attributes.location,E[C].attributes.title,E[C].attributes.published,E[C].attributes.mirrorDate,E[C].contentid,true);this.markersLayer.addMarker(this.markersHighlight[C]);this.markersHighlight[C].display(false);this.markersHighlight[C].highlight=true}if(C==0){this.centerPoint=A;if(this.isVisible){this.map.setCenter(A)}}}},updateMainView:function(A){if(A!=0){this.idiom.notify("main","setNewContentId",{contentid:A})}},createMarker:function(I,O,N,M,K,E,B,F){var Q=new OpenLayers.Size(this.markerSizeX,this.markerSizeY);var G=new OpenLayers.Pixel(-(Q.w/2),-(Q.h/2));var P=this.cssPrefix+I;if(F){P+="h"}var L=new OpenLayers.Icon(P,Q,G);var H=new OpenLayers.Marker(O,L);var J="<b>"+M.substring(0,35)+"</b><br>Source: "+K+" &bull; Target: "+N+"<br />Mirror Date: "+E+"<br /><a href='#' onclick=\"IDIOM.notify('main', 'setNewContentId', {contentid: "+B+'}); return false;">read document</a>';var C=this.windowId+"_popup_"+I;var A=new OpenLayers.Popup.FramedCloud(C,O,new OpenLayers.Size(200,100),J,L,true);A.border="1px solid #cccccc";A.contentDiv.style.padding="5px";var D=this;H.events.register("click",H,function(){D.map.addPopup(A,true);A.show()});H.events.register("mouseover",H,function(){D.highlight(I);D.markInList(I)});H.events.register("mouseout",H,function(){D.normal(I);D.unmarkInList(I)});return H},errorHandler:function(B,A){if(!A){A=""}this.idiom.notify("error","display","Error in map: "+B+" "+A)},errorHandlerInternal:function(A){clearTimeout(this.errorElementTimeout);if(!this.errorElement){this.errorElement=new Element("div").addClassName("maperror");this.map2DContainer.insert(this.errorElement)}this.errorElement.update(A);this.errorElementTimeout=setTimeout(this.clearErrorHandlerInternal.bind(this),5000)},clearErrorHandlerInternal:function(){clearTimeout(this.errorElementTimeout);if(this.errorElement){this.errorElement.remove();this.errorElement=null}},highlight:function(A){try{this.markersHighlight[A].display(true);this.markersNormal[A].display(false)}catch(B){}},normal:function(A){try{this.markersNormal[A].display(true);this.markersHighlight[A].display(false)}catch(B){}},show:function($super,E,D,C,B,A){this.window.removeClassName("closed");this.windowClosed.removeClassName("closed");$super(E,D,C,B,A);if(!this.map){return }this.map.updateSize();if(this.centerPoint){this.map.setCenter(this.centerPoint)}this.map.updateSize();this.markersLayer.markers.each(function(F){if(!F.highlight){F.display(true)}});this.markersLayer.redraw()},close:function($super){$super();if(this.isMap3DShown){this.destroy3DMap()}if(this.isMaximized){this.minimize()}this.window.addClassName("closed");this.windowClosed.addClassName("closed");this.isVisible=false},maximize:function($super){$super();if(this.map.zoom<1){this.map.zoomTo(1)}this.map.updateSize();if(this.centerPoint){this.map.setCenter(this.centerPoint)}},minimize:function($super){if(this.isMap3DShown){this.destroy3DMap()}$super();this.isVisible=false;this.idiom.notify("maps","show",this)},markInList:function(A){},unmarkInList:function(A){},addSearchMarkers:function(B){this.clearSearchMarkers();var A=new Hash();B.each(function(D){var E=D.attributes[this.pointX]+"/"+D.attributes[this.pointY];var C=A.get(E);if(C){C.count++}else{D.count=1;A.set(E,D)}},this);this.searchMarkersLayer.maxResolution=this.map.baseLayer.maxResolution;this.searchMarkersLayer.minResolution=this.map.baseLayer.minResolution;A.each(function(F){var C=new OpenLayers.Geometry.Point(parseFloat(F.value.attributes[this.pointX])*this.scaleX,parseFloat(F.value.attributes[this.pointY])*this.scaleY);var E=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style["default"]);E.fillOpacity=this.searchFillOpacity;E.graphicOpacity=this.searchGraphicOpacity;E.strokeColor=this.searchColour;E.fillColor=this.searchColour;E.pointRadius=this.searchRadius+(this.searchRadiusIncrement*((F.value.count-1)/this.searchRadiusIncrementStep));C.transform(new OpenLayers.Projection("EPSG:4326"),this.map.getProjectionObject());var D=new OpenLayers.Feature.Vector(C,null,E);this.searchMarkersLayer.addFeatures([D])},this)},addSearchLines:function(B){if(!this.drawArcs){return }var A=new Hash();B.each(function(D){var E=D.attributes[this.pointX]+"/"+D.attributes[this.pointY]+"/"+D.attributes[this.sourcePointX]+"/"+D.attributes[this.sourcePointY];var C=A.get(E);if(C){C.count++}else{D.count=1;A.set(E,D)}},this);this.searchArcsLayer.maxResolution=this.map.baseLayer.maxResolution;this.searchArcsLayer.minResolution=this.map.baseLayer.minResolution;A.each(function(J){var M=parseFloat(J.value.attributes[this.pointX])*this.scaleX;var L=parseFloat(J.value.attributes[this.pointY])*this.scaleY;var G=parseFloat(J.value.attributes[this.sourcePointX])*this.scaleX;var F=parseFloat(J.value.attributes[this.sourcePointY])*this.scaleY;var N=this.calculateBezier(G,F,M,L);var E=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style["default"]);E.fillOpacity=this.arcOpacity;E.strokeOpacity=this.arcOpacity;E.graphicOpacity=this.searchGraphicOpacity;E.strokeWidth=J.value.count;var D={};D.r=parseInt(this.arcStartColour.substring(1,3),16);D.g=parseInt(this.arcStartColour.substring(3,5),16);D.b=parseInt(this.arcStartColour.substring(5,7),16);var H={};H.r=parseInt(this.arcEndColour.substring(1,3),16);H.g=parseInt(this.arcEndColour.substring(3,5),16);H.b=parseInt(this.arcEndColour.substring(5,7),16);for(var K=0;K<N.length;K=K+5){var C={};C.r=D.r+(H.r-D.r)*K/N.length;C.g=D.g+(H.g-D.g)*K/N.length;C.b=D.b+(H.b-D.b)*K/N.length;var I="#"+parseInt(C.r).toString(16)+parseInt(C.g).toString(16)+parseInt(C.b).toString(16);var P=Object.clone(E);P.strokeColor=I;P.fillColor=I;var O=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(N.slice(K,Math.min(K+5,N.length))),null,P);O.geometry.transform(new OpenLayers.Projection("EPSG:4326"),this.map.getProjectionObject());this.searchArcsLayer.addFeatures([O])}},this)},clearSearchMarkers:function(){this.searchMarkersLayer.destroyFeatures();if(this.drawArcs){this.searchArcsLayer.destroyFeatures()}},calculateBezier:function(B,H,A,G){var K=new OpenLayers.Geometry.Point(B,H);var J=new OpenLayers.Geometry.Point(A,G);var E=20;if(J.x<K.x){E=-E}var D=0.5/Math.cos(E/180*Math.PI);var F=J.clone();F.rotate(E,K);F.resize(D,K);var I=[];var C=new at.idiom.js.util.Bezier(K,J,F,F);C.plot(function(M){var L=new OpenLayers.Geometry.Point(M.x,M.y);I.push(L)});return I}});at.idiom.js.util.Bezier=Class.create({initialize:function(E,D,B,A){var C=this;C.x0=E.x;C.y0=E.y;C.x1=D.x;C.y1=D.y;C.cx0=B.x;C.cy0=B.y;C.cx1=A.x;C.cy1=A.y},getCoordinates:function(I){var B=1-I;var H=I*I;var E=B*B;var G=H*I;var F=3*H*B;var D=3*I*E;var C=E*B;var A=this;return{x:G*A.x0+F*A.cx0+D*A.cx1+C*A.x1,y:G*A.y0+F*A.cy0+D*A.cy1+C*A.y1}},plot:function(F){var D;var A=(A=this.x0-this.x1)*A;var E=(E=this.y0-this.y1)*E;var B=B=Math.ceil(Math.sqrt(A+E));var C=B+1;while(F(this.getCoordinates(D=--C/B),D),C){}}});at.idiom.js.maps.Maps=Class.create({initialize:function(B){this.container=$(B.container);this.closedContainer=$(B.closedContainer);this.maps=new Array();var A=this;B.idiom.register("maps","register",function(C){A.register(C.map)});B.idiom.register("maps","unregister",function(C){A.unregister(C.map)});B.idiom.register("maps","show",function(C){A.show(C)});B.idiom.register("maps","close",function(C){A.close(C)});B.idiom.register("maps","minimize",function(){A.minimize()});B.idiom.register(null,"hide",function(){A.hideWindow()});B.idiom.register(null,"show",function(){A.showWindow()})},register:function(A){this.maps.push(A)},unregister:function(A){this.maps=this.maps.without(A)},close:function(A){var D=0;this.maps.each(function(E){if(E.isVisible){D++}});if(D<=1){return }var C=this.container.getDimensions();A.close();D=0;this.maps.each(function(E){if(E.isVisible){D++}if(E.isMaximized){E.minimize()}});if(D==0){return }var B=(C.height-(10*(D-1)))/D;this.maps.each(function(E){if(E.isVisible){E.show(0,0,C.width,B,"relative")}})},show:function(A){var D=this.container.getDimensions();var C=0;this.maps.each(function(E){if(E.isVisible){C++}if(E.isMaximized){E.minimize()}});C++;var B=(D.height-(10*(C-1)))/C;this.maps.each(function(E){if(E.isVisible){E.show(0,0,D.width,B,"relative")}});A.show(0,0,D.width,B,"relative")},deactivate:function(){this.maps.each(function(A){A.map.controls.each(function(B){B.deactivate()})})},activate:function(){this.maps.each(function(A){A.map.controls.each(function(B){B.activate()})})},minimize:function(){this.maps.each(function(A){if(A.isMaximized){A.minimize()}})},hideWindow:function(){this.container.hide();this.closedContainer.select(".mapbutton").each(function(A){A.addClassName("disabled")})},showWindow:function(){this.container.show();this.closedContainer.select(".mapbutton").each(function(A){A.removeClassName("disabled")})}});at.idiom.js.maps.TagCloud=Class.create(at.idiom.js.window.Window,{initialize:function($super,E){$super(E);this.storedTerms=[];this.paneWidth=E.paneWidth;this.paneHeight=E.paneHeight;this.SVGNS="http://www.w3.org/2000/svg";this.svgContainer=$(E.svgContainer);this.clippingContainer=$(E.clippingContainer);this.sample=E.sample;this.site=E.site;this.maxExtentX=0;this.maxExtentY=0;this.minSentimentValue=-1;this.maxSentimentValue=1;this.minSentimentColour={r:255,g:0,b:0};this.maxSentimentColour={r:0,g:255,b:0};var A=document.createElementNS(this.SVGNS,"svg:svg");A.setAttribute("id","svg");A.setAttribute("width",this.paneWidth+"px");A.setAttribute("height",this.paneHeight+"px");A.setAttribute("viewBox","0 0 "+this.paneWidth+" "+this.paneHeight);this.svgContainer.appendChild(A);this.g=document.createElementNS(this.SVGNS,"svg:g");A.appendChild(this.g);var C=this;this.idiom.register("tagcloud","highlight",function(F){C.highlightTerms(F.terms)});var D=[0.25,0.5,1,1.5,2,3,4];var B=2;this.svgContainer.observe("DOMMouseScroll",function(F){var G=F.detail;if(G<0){B++;B=B>D.length-1?D.length-1:B}else{B--;B=B<0?0:B}var H=D[B];console.log(H);C.g.setAttribute("transform","scale("+H+")");A.setAttribute("width",(C.paneWidth*C.scale)+"px");A.setAttribute("height",(C.paneHeight*C.scale)+"px")});var C=this;new Draggable(this.svgContainer,{starteffect:Effect.Full,endeffect:Effect.Full,snap:function(F,G){return[(F>10)?10:(F<-C.maxClippingX-10)?F=-C.maxClippingX-10:F,(G>10)?10:(G<-C.maxClippingY-10)?G=-C.maxClippingY-10:G]}});this.loadTerms()},createMapSVG:function(C){var G=0;var F=0;var A=0;var B=this;this.maxClippingX=0;this.maxClippingY=0;var I=0;var H=0;var E=0;var D=[];$(C).each(function(J){A++;var L=document.createElementNS(this.SVGNS,"svg:text");L.setAttribute("x",G);L.setAttribute("y",F);L.setAttribute("font-size",J.size/8);L.setAttribute("fill",B.calculateColour(J.colour,J.sentiment));L.appendChild(document.createTextNode(J.term));L.addEventListener("click",function(){B.idiom.notify("search","newSearch",{term:J.term,count:50})},false);this.g.appendChild(L);var K=L.getBBox();if(G+K.width>B.paneWidth){$(D).each(function(M){M.setAttribute("y",F+E)});D=[];F+=E;E=0;G=0;L.setAttribute("x",G);L.setAttribute("y",F)}if(K.height>E){E=K.height}D.push(L);G+=K.width+3;this.storedTerms.push({term:J.term,colour:J.colour,element:L});if(G>I){I=G}if(F>H){H=F}},this);$(D).each(function(J){J.setAttribute("y",F+E)});D=[];this.g.setAttribute("transform","scale(1)");this.maxClippingX=Math.max(I-this.clippingContainer.getWidth(),0);this.maxClippingY=Math.max(H-this.clippingContainer.getHeight(),0)},loadTerms:function(){var A=this;this.idiom.loadStart("TAGMAP");Server.getTagCloudData(this.sample,this.site,{callback:function(B){A.idiom.loadEnd("TAGMAP");A.createMapSVG(B.elements)},errorHandler:function(C,B){A.errorHandler(C,B);A.idiom.loadEnd("TAGMAP")}})},errorHandler:function(B,A){this.idiom.notify("error","display","Error in tagcloud: "+B+" "+A.message)},highlightTerms:function(B){var A="";$(B).each(function(C){A+=" "+C});A+=" ";$(this.storedTerms).each(function(C){if(A.indexOf(C.term)!=-1){C.element.setAttribute("fill-opacity",1)}else{C.element.setAttribute("fill-opacity",0.3)}})},calculateColour:function(F,C){if(C==0){return F}var B=this.convertHEXToRGB(F.substring(1));if(C>0){var A=(C/this.maxSentimentValue);A=A>1?1:A;var D=B.g;D=D+(this.maxSentimentColour.g-D)*A;B.g=D}else{var A=(C/this.minSentimentValue);A=A>1?1:A;var E=B.r;E=E+(this.minSentimentColour.r-E)*A;B.r=E}return this.convertRGBToHEX(B)},convertRGBtoHSV:function(A,E,F){A=A/255;E=E/255;F=F/255;var C=0;var L=0;var I=0;var J=Math.min(A,E,F);var K=Math.max(A,E,F);var H=K-J;I=K;if(H==0){C=0;L=0}else{L=H/K;var G=(((K-A)/6)+(H/2))/H;var B=(((K-E)/6)+(H/2))/H;var D=(((K-F)/6)+(H/2))/H;if(A==K){C=D-B}else{if(E==K){C=(1/3)+G-D}else{if(F==K){C=(2/3)+B-G}}}if(C<0){C+=1}if(C>1){C-=1}}return{hue:C*360,saturation:L*100,value:I*100}},convertHSVtoRGB:function(I,D,L){var F=I/360;var N=D/100;var M=L/100;if(N==0){return{r:M*255,g:M*255,b:M*255}}else{var H=F*6;var E=Math.floor(H);var G=M*(1-N);var C=M*(1-N*(H-E));var B=M*(1-N*(1-(H-E)));var A=0;var J=0;var K=0;switch(E){case 0:A=M;J=B;K=G;break;case 1:A=C;J=M;K=G;break;case 2:A=G;J=M;K=B;break;case 3:A=G;J=C;K=M;break;case 4:A=B;J=G;K=M;break;default:A=M;J=G;K=C}return{r:A*255,g:J*255,b:K*255}}},convertHEXtoDEC:function(A){return parseInt(A,16)},convertDECtoHEX:function(D){var C=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];var B=Math.floor(D/16);var A=D-B*16;return C[B]+C[A]},convertHEXToRGB:function(A){return{r:this.convertHEXtoDEC(A.substring(0,2)),g:this.convertHEXtoDEC(A.substring(2,4)),b:this.convertHEXtoDEC(A.substring(4,6))}},convertRGBToHEX:function(A){return"#"+this.convertDECtoHEX(Math.floor(A.r))+this.convertDECtoHEX(Math.floor(A.g))+this.convertDECtoHEX(Math.floor(A.b))}});at.idiom.js.related=Class.create();at.idiom.js.related.Related=Class.create(at.idiom.js.window.Window,{initialize:function($super,B){$super(B);this.sample=B.sample;this.site=B.site;this.snapshot=B.snapshot;this.imageUrl=B.imageUrl;this.enabled=B.enabled?B.enabled:false;this.rssEnabled=B.rssEnabled?B.rssEnabled:false;this.rssId=B.rssId;this.rssUrl=B.rssUrl;this.tagUrl=B.tagUrl;this.contentId=B.contentId;this.content=$(B.contentId);this.loadName=B.loadName;this.type=B.type;this.currentContentId=0;this.offset=0;this.offsetLabel=this.header.down(".offset");var A=this;this.idiom.register(null,"onNewContentId",function(C){A.update(C)});if(this.type=="semantic"){this.idiom.register("semanticrelated","highlight",function(C){A.highlightSemantic(C)});this.idiom.register("semanticrelated","unhighlight",function(C){A.unhighlightSemantic(C)})}else{if(this.type=="geographic"){this.idiom.register("geographicrelated","highlight",function(C){A.highlightGeographic(C)});this.idiom.register("geographicrelated","unhighlight",function(C){A.unhighlightGeographic(C)})}}this.searchTerm="";this.idiom.register("search","newSearch",function(C){A.searchTerm=C.term});this.idiom.register(null,"changeSnapshot",function(C){A.snapshot=C.snapshotid});this.idiom.register(null,"hide",function(){A.hideWindow()});this.idiom.register(null,"show",function(){A.showWindow()});this.previousButton=$(B.previousButton);this.nextButton=$(B.nextButton);this.nextButton.observe("click",function(C){A.doOffset(5);C.stop()});this.previousButton.observe("click",function(C){A.doOffset(-5);C.stop()})},doOffset:function(A){if(this.offset==0&&A<0){return }this.offset+=A;if(this.offset<=0){this.offset=0;this.previousButton.down(".enabled").hide();this.previousButton.down(".disabled").show();this.offsetLabel.update()}else{this.previousButton.down(".disabled").hide();this.previousButton.down(".enabled").show();this.offsetLabel.update(" ("+(this.offset+1)+" - "+(this.offset+5)+")")}this.update({contentid:this.currentContentId,snapshotid:this.snapshot});if(this.type=="semantic"){this.idiom.notify(null,"newSemanticDocuments",{contentid:this.currentContentId,snapshotid:this.snapshot,offset:this.offset})}else{if(this.type=="geographic"){this.idiom.notify(null,"newGeographicDocuments",{contentid:this.currentContentId,snapshotid:this.snapshot,offset:this.offset})}}},toggleSnippet:function(B,A){$(A).getElementsBySelector(".snippet .short").each(function(C){C.toggle()});$(A).getElementsBySelector(".snippet .long").each(function(C){C.toggle()});Event.stop(B);return false},navigate:function(A,B){this.idiom.notify("main","setNewContentId",{contentid:B});Event.stop(A);return false},displayInformation:function(K){var M=function(){};var N=function(){};var D=this;if(this.type=="semantic"){M=function(R){D.idiom.notify("geographic","setHighlightMarker",R)};N=function(R){D.idiom.notify("geographic","setNormalMarker",R)}}if(this.type=="geographic"){M=function(R){D.idiom.notify("semantic","setHighlightMarker",R);D.idiom.notify("ontology","setHighlightMarker",R)};N=function(R){D.idiom.notify("semantic","setNormalMarker",R);D.idiom.notify("ontology","setNormalMarker",R)}}var H=new Template("<tr id='#{id}' class='entry hreview'><td class='rating microformats'>#{rating}</td><td class='dtreviewed microformats'>#{date}</td><td class='icon' title='Display Full Document'><span class='sprite_marker_#{imagetype}_#{imageindex} normal'></span><span class='sprite_marker_#{imagetype}_#{imageindex}h highlight'></span></td><td class='content' title='Display Longer Snippet (Click on Document Marker to Display Full Document)'><div class='title summary'>#{title}</div><div class='snippet'><div class='short'>#{shortsnippet}</div><div class='long' title='Display Shorter Snippet' style='display: none;'>#{longsnippet}</div></div><span class='item'><div class='url fn' title='Display Full Document'>#{url}</div></span></td></tr>");var E="<div class='viewBorder'><table class='entrytable' cellpadding='0' cellspacing='0'>";var A=K.contentobjects;for(var L=0;L<5;L++){var J=A[L];if(J==null){continue}var O=J.attributes.shortsnippet.prefix;if(!O){O=""}var Q=J.attributes.shortsnippet.match;if(!Q){Q=""}var G=J.attributes.shortsnippet.postfix;if(!G){G=""}var C=J.attributes.longsnippet.prefix;if(!C){C=""}var I=J.attributes.longsnippet.match;if(!I){I=""}var B=J.attributes.longsnippet.postfix;if(!B){B=""}var P={id:this.contentId+"_element_"+L,title:J.attributes.title!=null?J.attributes.title.substring(0,70):"",url:J.attributes.url!=null?J.attributes.url.escapeHTML():"",shortsnippet:O+"<span class='regExpMatch'>"+Q+"</span>"+G,longsnippet:C+"<a href='"+this.tagUrl+I+"' rel='tag' class='regExpMatch' onclick='return false;'>"+I+"</a>"+B,imagetype:this.type,imageindex:L+1,rating:5-L,date:J.attributes.date};E+=H.evaluate(P)}E+="</table></div>";this.content.update();this.content.update(E);this.idiom.loadEnd(this.loadName);for(var L=0;L<5;L++){var F=this.contentId+"_element_"+L;Event.observe($(F),"mouseover",M.bind(this,{position:L+1}));Event.observe($(F),"mouseout",N.bind(this,{position:L+1}));Event.observe($(F).down(".content"),"click",this.toggleSnippet.bindAsEventListener(this,$(F).down(".content")));Event.observe($(F).down(".icon"),"click",this.navigate.bindAsEventListener(this,K.contentobjects[L].contentid));Event.observe($(F).down(".url"),"click",this.navigate.bindAsEventListener(this,K.contentobjects[L].contentid))}},update:function(A){this.currentContentId=A.contentid;this.snapshot=A.snapshotid;this.updateInformationDWR(this.currentContentId,this.offset,this.searchTerm)},updateInformationDWR:function(F,E,B){var C=this;this.idiom.loadStart(this.loadName);var D=function(){};if(this.type=="semantic"){D=Server.getSemanticSimilarDocuments}if(this.type=="geographic"){D=Server.getGeographicSimilarDocuments}D(F,E,B,this.sample,this.site,this.snapshot,{callback:function(G){C.displayInformation(G)},errorHandler:function(G){C.errorHandler(G)}});if(this.rssEnabled){var A=this.rssUrl.gsub("\\[sample\\]",this.sample).gsub("\\[site\\]",this.site).gsub("\\[contentid\\]",F);$(this.rssId).href=A}},errorHandler:function(A){this.idiom.notify("error","display","Error in related: "+A)},clear:function(){if(this.similarTopicsEnabled){$("WhatsRelatedSemanticContent").update()}if(this.nearbyLocationsEnabled){$("WhatsRelatedGeographicContent").update()}},highlightSemantic:function(A){try{$("WhatsRelatedSemanticContent").down(".entry",A).addClassName("hover")}catch(B){}},unhighlightSemantic:function(A){try{$("WhatsRelatedSemanticContent").down(".entry",A).removeClassName("hover")}catch(B){}},highlightGeographic:function(A){try{$("WhatsRelatedGeographicContent").down(".entry",A).addClassName("hover")}catch(B){}},unhighlightGeographic:function(A){try{$("WhatsRelatedGeographicContent").down(".entry",A).removeClassName("hover")}catch(B){}}});at.idiom.js.search=Class.create();at.idiom.js.search.Search=Class.create(at.idiom.js.window.Window,{initialize:function($super,B){$super(B);this.loadName=B.searchMessage;this.searchMessage=$(B.searchMessageId);this.searchInput=$(B.searchInputId);this.mainContent=$(B.mainContentId);this.mainContentPermalink=$(B.mainContentPermalinkId);this.searchForm=$(B.searchFormId);this.sample=B.sample;this.site=B.site;this.snapshot=B.snapshot;this.displayConcordance=B.displayConcordance;this.displayVote=B.displayVote;this.voteElement=$(B.vote);this.displaySemanticOrientation=B.displaySemanticOrientation;this.count=50;this.searchTerm="";this.searchDisplayed=false;this.concordance=$(B.concordanceId);this.concordanceContent=$(B.concordanceContentId);this.smallConcordance=B.smallConcordance;this.bigConcordance=B.bigConcordance;this.toggleButton=$(B.toggleButtonId);this.toggleButtonMax=$(B.toggleButtonMaxId);this.toggleButtonMin=$(B.toggleButtonMinId);this.buttonNormal=B.buttonNormal;this.buttonHighlight=B.buttonHighlight;this.sortBy=null;this.sortOrder=null;this.result=[];var A=this;this.idiom.register("search","displayInformationMain",function(C){A.displayInformationMain(C)});this.idiom.register("search","displayInformationSingle",function(C){A.displayInformationSingle(C,true)});this.idiom.register("search","displayInformationDone",function(C){A.displayInformationDone(C)});this.idiom.register("search","newSearch",function(C){A.search(C.term,C.count)});this.idiom.register("search","newTagSearch",function(C){A.setValue(C);A.submit(null)});Event.observe($(B.resultButton50),"click",function(){A.searchMore(50)});Event.observe($(B.resultButton100),"click",function(){A.searchMore(100)});Event.observe($(B.resultButton200),"click",function(){A.searchMore(200)});if(B.semanticOrientationButton){Event.observe($(B.semanticOrientationButton),"click",function(){A.sortResultToggle("semorient")})}Event.observe($(B.sortButtonDate),"click",function(){A.sortResultToggle("date")});Event.observe(this.toggleButton,"click",this.toggleConcordance.bindAsEventListener(this));if(B.maximizeButton){Event.observe($(B.maximizeButton),"click",this.maximize.bindAsEventListener(this))}if(B.minimizeButton){Event.observe($(B.minimizeButton),"click",this.minimize.bindAsEventListener(this))}Event.observe($(B.closeButton),"click",function(){A.closeConcordance()});Event.observe(this.searchForm,"submit",this.submit.bindAsEventListener(this));Event.observe($(B.searchInputId),"click",this.hideHint.bindAsEventListener(this));Event.observe($(B.searchInputId),"blur",this.showHint.bindAsEventListener(this));this.idiom.register(null,"restoreState",function(C){if(C.snapshotid){A.snapshot=C.snapshotid}if(C.searchterm){A.search(C.searchterm,C.searchcount,true)}if(C.searchconcordance){A.showConcordance();if(C.searchconcordance=="big"){A.maximizeConcordance()}else{if(C.searchconcordance=="small"){A.minimizeConcordance()}else{if(C.searchconcordance=="minimize"){A.minimize()}else{if(C.searchconcordance=="maximize"){A.maximize()}else{A.closeConcordance(true)}}}}}else{A.closeConcordance(true)}});this.idiom.register(null,"hide",function(){A.hideWindow();A.toggleSearchForm(false)});this.idiom.register(null,"show",function(){if(A.searchDisplayed){A.showWindow()}A.toggleSearchForm(true)});this.idiom.register(null,"changeSnapshot",function(C){A.snapshot=C.snapshotid})},formatDate:function(C){var E=C.getMonth();var D=C.getFullYear();var B=C.getDate();var A=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");E=A[E];return B+" "+E+" "+D},displayInformationFrame:function(A){this.concordanceContent.update('<table id="ConcordanceTable" cellspacing="0" cellpadding="0" border="0"></table>');if(A){this.idiom.notify("main","switchBig",null);this.idiom.notify("charts","hide",null);this.showConcordance()}},displayInformationSingle:function(F,B){var J='<tr class="hover resultelement"><td class="result"><div class="overflow"><div class="clip"><div class="center"><span class="prefix">#{prefix}</span><span class="match">#{match}</span><span class="postfix">#{postfix}</span></div></div></div></td>';if(this.displaySemanticOrientation){J+='<td class="semorient #{semorientclass}">#{semorient}</td>'}J+='<td class="date">#{date}</td></tr>';var I='<tr class="splitelement"><td>&nbsp;</td>';if(this.displaySemanticOrientation){I+="<td>&nbsp;</td>"}I+="<td>&nbsp;</td></tr>";var E=new Template(J);var C="";var A=0;var M="";if(this.displayConcordance){var C="";if(F){var K="";if(this.displaySemanticOrientation){if(F.attributes.semorient>0){K="positive"}else{if(F.attributes.semorient<0){K="negative"}}}var L={prefix:F.attributes.prefix,match:F.attributes.match,postfix:F.attributes.postfix,semorient:F.attributes.semorient.toFixed(1),semorientclass:K,date:this.formatDate(F.attributes.date)};C+=E.evaluate(L)}}var H=0;if(B){var G=this.storeResult(F);H=G.index;var D=$("ConcordanceTable").down("tr.resultelement",H-1);if(D){if(G.splitterBefore){if(!D.next("tr")||!D.next("tr").hasClassName("splitelement")){D.insert({after:I})}D=D.next("tr")}D.insert({after:C});D=D.next("tr");if(G.splitterAfter){if(D.next("tr")&&!D.next("tr").hasClassName("splitelement")){D.insert({after:I})}}}else{$("ConcordanceTable").insert({top:C});D=$("ConcordanceTable").down("tr.resultelement");if(G.splitterAfter){D.insert({after:I})}}}else{$("ConcordanceTable").insert(C);H=$("ConcordanceTable").select("tr.resultelement").length-1}Event.observe($("ConcordanceTable").down("tr.resultelement",H),"click",this.selectSearchHit.bindAsEventListener(this,F.contentid))},selectSearchHit:function(A,B){this.minimize();this.idiom.notify("main","setNewContentId",{contentid:B})},displayInformationMain:function(C){var F=0;var E="";var A="";if(C){if(C.attributes.firstHit){var B=this.getValue();var D=C.attributes.content;if(B!=""){D=D.gsub(new RegExp('((</?\\w+(\\s*|\\w+\\s*=\\s*"[^"]*"|\\w+)*>|\\b))('+B+')(\\b|</?\\w+(\\s*|\\w+\\s*=\\s*"[^"]*"|\\w+)*>)',"i"),'#{2}<span class="regExpMatch">#{4}</span>#{5}')}A+=C.attributes.metadata+'<div class="textContent">'+D+"</div>";F=C.contentid;E=C.attributes.permalink}}this.mainContent.update(A);this.mainContentPermalink.href=E;this.mainContent.scrollTop=0;this.idiom.notify("main","setNewContentId",{contentid:F,nostorestate:true});this.idiom.notify("maps","minimize",null);this.hideHint()},displayInformation:function(E,D,F){if(E.length==0){return }if(E.length==1){var C=E[0];if(C.attributes.emptyresults){this.displayMessage("Term not found.");this.concordanceContent.update("No documents matching your search query have been found.");return }if(C.attributes.indexexception){this.displayMessage("Error retrieving search results.");this.concordanceContent.update("The search index is inaccessible at the moment. Please try again later.");return }if(C.attributes.queryexception){this.displayMessage("Incorrect query");this.concordanceContent.update('Your query <span class="incorrectquery">'+C.attributes.query.escapeHTML()+"</span> could not be understood.");return }if(C.attributes.stopwords){this.displayMessage("Term too general.");this.concordanceContent.update("The search term is too general, try a more specific search query.");return }if(C.attributes.ajaxresults){return }}this.displayInformationDone();if(E.length>=1&&D){var C=E[0];this.displayInformationMain(C)}if(this.displayConcordance){var A="";this.displayInformationFrame(D);for(var B=1;B<E.length;B++){var C=E[B];this.displayInformationSingle(C,F)}if(E.length==1){this.concordanceContent.update("No additional results found.")}this.idiom.notify("geographic","addSearchMarkers",E);this.idiom.notify("geographic","addSearchLines",E);this.idiom.notify("semantic","addSearchMarkers",E)}},displayInformationDone:function(){this.idiom.loadEnd(this.loadName);dwr.engine.setActiveReverseAjax(false);this.idiom.notify("geographic","addSearchMarkers",this.result);this.idiom.notify("geographic","addSearchLines",this.result);this.idiom.notify("semantic","addSearchMarkers",this.result)},storeResults:function(A){this.result=A},storeResult:function(D){this.result.push(D);var F=this;this.result.sort(function(I,H){return F.resultComparator(I,H)});var C=$(this.result).indexOf(D);var E=false;var B=this.result[C-1];if(B&&B.attributes.match.toLowerCase()!=D.attributes.match.toLowerCase()){E=true}var G=false;var A=this.result[C+1];if(A&&A.attributes.match.toLowerCase()!=D.attributes.match.toLowerCase()){G=true}return{index:C,splitterBefore:E,splitterAfter:G}},resultComparator:function(B,A){var D=B.attributes.match.toLowerCase().replace(/&nbsp;/g," ");var C=A.attributes.match.toLowerCase().replace(/&nbsp;/g," ");if(D==C){return A.attributes.date.getTime()-B.attributes.date.getTime()}var E=this.searchTerm.toLowerCase().replace(/\"/g,"");if(E==D){return -1}if(E==C){return 1}if(D<C){return -1}else{return 1}},sortResultToggle:function(A){if(this.sortBy==A){if(this.sortOrder=="asc"){this.sortOrder="desc"}else{this.sortOrder="asc"}}else{this.sortOrder="asc"}this.sortBy=A;this.sortResult(this.sortBy,this.sortOrder)},sortResult:function(C,A){if(!this.result){return }var B=this;this.storeResults(this.result.sort(function(E,D){return B.sort(E,D,C,A)}));this.displayInformation(this.result,false,false)},sort:function(C,B,E,A){if(C.attributes.firstHit){return -1}else{if(B.attributes.firstHit){return 1}}var D=0;if(E=="date"){D=C.attributes.date.getTime()-B.attributes.date.getTime()}else{if(E=="semorient"){D=C.attributes.semorient-B.attributes.semorient}else{if(E=="match"){D=(B.attributes.match<C.attributes.match)-(C.attributes.match<B.attributes.match)}}}if(A=="asc"){return D}else{return -D}},displayMessage:function(B){this.searchMessage.update(B);var C=Position.cumulativeOffset(this.searchInput)[1];C+=this.searchInput.getHeight();this.searchMessage.setStyle({top:C+"px"});this.searchMessage.show();clearTimeout(this.timeout);var A=this;this.timeout=setTimeout(function(){A.searchMessage.hide()},5000)},submit:function(B){var A=this.searchInput.value;if(A=="Search..."){return false}this.idiom.notify("search","newSearch",{term:A,count:50});Event.stop(B)},search:function(B,E,A){this.searchInput.value=B;if(E<0){E=0}if(E>200){E=200}this.result=[];this.toggleCountButtons(this.count,E);this.count=E;var C=true;if(this.searchTerm==B&&this.searchDisplayed){C=false}this.searchTerm=B;this.idiom.loadStart(this.loadName);this.searchMessage.hide();var D=this;this.hideHint();dwr.engine.setActiveReverseAjax(true);this.displayInformationFrame(C);Server.searchAdvanced(B,this.sample,this.site,this.snapshot,E,{callback:function(F){D.displayInformation(F.contentobjects,C,true)},errorHandler:function(G,F){D.errorHandler(G,F)}});if(!A){this.idiom.notify("history","storeState",{searchterm:B,searchcount:E,searchconcordance:this.concordanceMaximized?"big":"small"})}},searchMore:function(A){this.idiom.notify("search","newSearch",{term:this.searchTerm,count:A})},setValue:function(A){this.searchInput.value=A.gsub(new RegExp("<b>(.*)</b>","i"),function(B){return B[1]}).toLowerCase();this.hideHint()},getValue:function(){var A=this.searchInput.value;if(A=="Search ..."){A=""}return A},errorHandler:function(B,A){this.idiom.notify("error","display","Error in search: "+B+" "+A.message)},showHint:function(){if(this.searchInput.value==""){this.searchInput.value="Search ...";this.searchInput.addClassName("hint");this.searchInput.removeClassName("nohint")}},hideHint:function(){if(this.searchInput.value=="Search ..."){this.searchInput.value=""}this.searchInput.addClassName("nohint");this.searchInput.removeClassName("hint")},showConcordance:function(){if(this.searchDisplayed){return }this.searchDisplayed=true;this.resetDirectPosition();this.concordance.show();this.idiom.notify("main","switchBig",null);this.concordance.addClassName("small");this.adjustContentHeight();this.toggleButtonMin.hide();this.toggleButtonMax.show()},closeConcordance:function(A){if(!this.searchDisplayed){return }if(this.isMaximized){this.minimize();return }this.concordance.removeClassName("small");this.concordance.removeClassName("big");this.concordance.hide();this.idiom.notify("main","switchFull",null);this.searchDisplayed=false;this.minimize();this.idiom.notify("charts","show",null);this.idiom.notify("geographic","clearSearchMarkers",null);this.idiom.notify("semantic","clearSearchMarkers",null);if(!A){this.idiom.notify("history","storeState",{searchterm:null,searchcount:0,searchconcordance:null})}},maximizeConcordance:function(){this.concordance.removeClassName("small");this.concordance.addClassName("big");this.toggleButtonMax.hide();this.toggleButtonMin.show();this.adjustContentHeight();this.idiom.notify("main","switchSmall",null);this.concordanceMaximized=true},minimizeConcordance:function(){this.concordance.removeClassName("big");this.concordance.addClassName("small");this.toggleButtonMin.hide();this.toggleButtonMax.show();this.adjustContentHeight();this.idiom.notify("main","switchBig",null);this.concordanceMaximized=false},toggleConcordance:function(){if(this.concordanceMaximized){this.minimizeConcordance()}else{this.maximizeConcordance()}},minimize:function($super){$super();this.resetDirectPosition();this.showToggle()},maximize:function($super){$super();this.hideToggle()},hideToggle:function(){this.toggleButton.hide()},showToggle:function(){this.toggleButton.show()},toggleCountButtons:function(A,B){$(this.buttonHighlight+A).hide();$(this.buttonNormal+A).show();$(this.buttonNormal+B).hide();$(this.buttonHighlight+B).show()},vote:function(A){Server.voteSearchResult(A,{callback:function(B){},errorHandler:function(){}})},voteForm:function(D){var A=0;for(var B=0;B<D.length;B++){if(D[B].checked){A=D[B].value}}var C=this;Server.voteSearchResult(A,{callback:function(E){C.hideVote()},errorHandler:function(){}})},showVote:function(){if(this.displayVote){this.voteElement.show()}},hideVote:function(){if(this.displayVote){new Effect.Fade(this.voteElement,{duration:1,from:1,to:0})}},getSearchTerm:function(){return this.searchTerm},getSearchCount:function(){return this.count},toggleSearchForm:function(A){if(A){this.searchForm.enable()}else{this.searchForm.disable()}}});at.idiom.js.viewer=Class.create();at.idiom.js.viewer.Viewer=Class.create(at.idiom.js.window.Window,{initialize:function($super,B){$super(B);this.loadId=B.loadId;this.sample=B.sample;this.site=B.site;this.snapshot=B.snapshot;this.reloadAfterSnapshotChange=false;this.category=B.category;this.mainContent=$(B.mainContentId);this.mainContentContent=$(B.mainContentContentId);this.mainContentTitle=$(B.mainContentTitleId);this.mainContentTitleActiveDocument=$(B.mainContentTitleActiveDocumentId);this.mainContentTitleUploadDocument=$(B.mainContentTitleUploadDocumentId);this.mainContentTitleAnalyzingDocument=$(B.mainContentTitleAnalyzingDocumentId);this.mainContentTitleAnalyzingDocumentName=$(B.mainContentTitleAnalyzingDocumentNameId);this.mainContentTitleFillForm=$(B.mainContentTitleFillFormId);this.mainContentPermalink=$(B.mainContentPermalinkId);this.mainContentAddContent=$(B.mainContentAddContentId);var A=this;this.currentContentId=0;this.idiom.register("main","setNewContentId",function(C){A.update(C)});this.idiom.register("main","displayNewStartDocument",function(C){A.displayNewStartDocument(C)});this.idiom.register("main","switchSmall",function(){A.switchSmall()});this.idiom.register("main","switchBig",function(){A.switchBig()});this.idiom.register("main","switchFull",function(){A.switchFull()});this.searchTerm="";this.idiom.register("search","newSearch",function(C){A.searchTerm=C.term});this.idiom.register(null,"restoreState",function(C){if(C.contentid){this.snapshot=C.snapshotid;A.update({contentid:C.contentid,nostorestate:true})}});if(B.addContentEnabled){$(B.mainContentAddContentId).observe("click",function(){A.idiom.notify("addcontent","show",{})})}if(B.videoEnabled){$(B.mainContentDisplayVideo).observe("click",function(){A.idiom.notify("video","show",{videoid:A.currentContentId})});this.idiom.register("main","showAddVideo",function(){$(B.mainContentDisplayVideo).show()});this.idiom.register("main","hideAddVideo",function(){$(B.mainContentDisplayVideo).hide()})}this.idiom.register("main","showAddContent",function(){A.switchAddContent(true)});this.idiom.register("main","hideAddContent",function(){A.switchAddContent(false)});this.idiom.register("main","displayTitle",function(C){A.switchTitle(C)});this.idiom.register("categorychooser","select",function(C){A.category=C.key});this.idiom.register(null,"changeSnapshot",function(C){A.snapshot=C.snapshotid;A.reloadAfterSnapshotChange=true})},setContentId:function(A){this.currentContentId=A;this.idiom.notify(null,"onNewContentId",{contentid:A,snapshotid:this.snapshot});this.idiom.notify("history","storeState",{contentid:A,snapshotid:this.snapshot})},displayNewStartDocument:function(B){var A=this;Server.getStartContentId(this.sample,this.site,this.snapshot,B.date,B.chartcategory,B.charttype,0,5,{callback:function(C){if(C!=A.currentContentId){A.update({contentid:C,nostorestate:false})}},errorHandler:function(C){A.idiom.notify("error","display",C)}})},updateMainView:function(C){var B=C.metadata;var A="<div class='textContent'>"+C.document+"</div>";if(this.searchTerm!=""){A=A.gsub(new RegExp("\\b"+this.searchTerm+"\\b","i"),function(D){return"<span class='regExpMatch'>"+D[0]+"</span>"})}this.mainContentContent.update(B+A);this.mainContentPermalink.href=C.permalink;this.mainContentContent.scrollTop=0;this.idiom.notify("tagcloud","highlight",{terms:C.terms});this.idiom.loadEnd(this.loadId)},update:function(B){var C=B.contentid;if(C==this.currentContentId&&!this.reloadAfterSnapshotChange){return }this.currentContentId=C;this.reloadAfterSnapshotChange=false;var A=this;this.idiom.loadStart(this.loadId);Server.getContent(C,this.sample,this.site,this.snapshot,{callback:function(D){A.updateMainView(D)},errorHandler:function(D){A.idiom.notify("error","display",D)}});this.idiom.notify(null,"onNewContentId",{contentid:C,snapshotid:this.snapshot});if(!B.nostorestate){this.idiom.notify("history","storeState",{contentid:C,snapshotid:this.snapshot})}this.idiom.notify("maps","minimize",null)},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})}});at.idiom.js.charts=Class.create();at.idiom.js.charts.Chart=Class.create(at.idiom.js.window.Window,{initialize:function($super,B){$super(B);this.sample=B.sample;this.site=B.site;this.snapshot=B.snapshot;this.loadName=B.loadId;this.chartContainerClass=B.chartContainerClass;this.legendContainerClass=B.legendContainerClass;this.chartsId=B.chartsId;this.chartCategoriesEnabled=B.chartCategoriesEnabled;if(this.chartCategoriesEnabled){this.chartCategoryDisplay=$(B.chartCategory)}this.chartCategory=null;this.chartCategoryName=null;this.chartType="frequency";this.currentDate=null;this.charts=$H();var A=this;this.idiom.register("charts","hide",function(){A.hideWindow()});this.idiom.register("charts","show",function(){A.showWindow()});this.idiom.register(null,"hide",function(){A.hideWindow()});this.idiom.register(null,"show",function(){A.showWindow()});this.idiom.register("categorychooser","select",function(C){A.loadCharts(C.key,C.value,false)});this.idiom.register(null,"changeSnapshot",function(C){A.snapshot=C.snapshotid;A.loadCharts(A.chartCategory,A.chartCategoryName,false)});this.idiom.register(null,"changeDate",function(C){A.currentDate=C.date;if(A.isVisible){A.idiom.notify("main","displayNewStartDocument",{date:A.currentDate,chartcategory:A.chartCategory,charttype:A.chartType})}})},createCharts:function(A,B){this.idiom.loadEnd(this.loadName);this.charts=$H();$(A).each(function(C){this.createChart(C.name,C.data)},this);this.showChart(B)},createChart:function(B,F){var E=$H();var C=$H();F.series.each(function(J){var I={label:J.name,data:[],color:J.colour,enabled:true};var H=new Date(0,0,0);var G=Number.MIN_VALUE;$H(J.data).each(function(M){var L=M.key;var K=new Date(parseInt(L.substring(0,4),10),parseInt(L.substring(5,7),10)-1,parseInt(L.substring(8,10),10));I.data.push([K,M.value]);if(K.getTime()>H.getTime()){H=K;G=M.value}});E.set(J.name,I);C.set(J.name,{value:G,name:J.name,colour:J.colour})},this);var A=C.values();A.sort(function(H,G){return G.value-H.value});this.findLegend(B).update();$(A).each(function(G){this.createLegend(B,G.colour,G.name)},this);this.charts.set(B,{name:B,data:E,legend:C});this.createChartObject(B,E.values());var D=this;Event.observe($(this.chartsId).down(".button."+B),"click",function(){D.chartType=B;D.showChart(false)})},createChartObject:function(A,C){var B=this.findContainer(A);B.update();new Proto.Chart(B,C,{xaxis:{mode:"time",tickSize:[7,"day"]},lines:{show:true},points:{show:true},mouse:{track:true,fixedPosition:false,sensibility:10000000,trackFormatter:function(D){return D.y}}})},createLegend:function(A,G,C){var E=this.findLegend(A);var D=new Template('<li class="legendEntry"><div class="colour" title="Hide chart series" style="background-color:#{colour}"></div><div class="name">#{name}</div></li>');var F=D.evaluate({colour:G,name:C});E.insert(F);var B=$(E).select(".legendEntry").last();Event.observe($(B).down(".colour"),"click",this.toggleChartSeries.bind(this,B,A,C));Event.observe($(B).down(".name"),"click",this.idiom.notify.bind(this.idiom,"search","newSearch",{term:C.indexOf(" ")!=-1?'"'+C+'"':C,count:50}))},toggleChartSeries:function(D,B,C){var A=this.charts.get(B).data.get(C).enabled;this.charts.get(B).data.get(C).enabled=!A;if(A){$(D).addClassName("deselected")}else{$(D).removeClassName("deselected")}var E=[];this.charts.get(B).data.each(function(F){if(F.value.enabled){E.push(F.value)}});this.createChartObject(B,E)},loadCharts:function(C,A,D){this.chartCategory=C;this.chartCategoryName=A;var B=this;this.displayCategory(A);this.idiom.loadStart(this.loadName);Server.getTopCharts(5,0,this.sample,this.site,this.snapshot,C,{callback:function(E){B.createCharts(E,D)}})},displayCategory:function(A){if(this.chartCategoriesEnabled){this.chartCategoryDisplay.update(A)}},errorHandler:function(B,A){if(!A){A=""}this.idiom.notify("error","display","Error in chart: "+B+" "+A)},showChart:function(A){this.charts.each(function(C){var B=C.value;this.hideChart(B.name);if(B.name==this.chartType){if(!A){this.idiom.notify("main","displayNewStartDocument",{date:this.currentDate,charttype:this.chartType,chartcategory:this.chartCategory})}}},this);this.findContent(this.chartType).setStyle({visibility:"visible"});this.toggleButton(this.chartType)},hideChart:function(A){this.findContent(A).setStyle({visibility:"hidden"})},findContent:function(A){return $(this.chartsId).down(".chartContent."+A)},findContainer:function(A){return $(this.chartsId).down(".chartContent."+A).down(".chartContainer")},findLegend:function(A){return $(this.chartsId).down(".chartContent."+A).down(".chartLegend")},toggleButton:function(A){$(this.windowId).select(".button").each(function(B){if(B.hasClassName(A)){$(B).down(".normal").hide();$(B).down(".highlight").show()}else{$(B).down(".normal").show();$(B).down(".highlight").hide()}})}});at.idiom.js.addcontent=Class.create();at.idiom.js.addcontent.Form=Class.create(at.idiom.js.window.Window,{initialize:function($super,B){$super(B);this.formWrapper=$(B.formWrapperId);this.formData=$(B.formDataId);this.formFile=$(B.formFileId);this.formFileInput=$(B.formFileInputId);this.formTitleInput=$(B.formTitleInputId);this.formFileSubmit=$(B.formFileSubmitId);var A=this;this.idiom.register("addcontent","show",function(C){A.showForm();this.idiom.notify("main","displayTitle",{title:"uploadDocument",file:""})});this.idiom.register("addcontent","hide",function(){A.hideForm()});this.idiom.register("addcontent","startUpload",function(){A.idiom.notify("main","displayTitle",{title:"analyzingDocument",file:A.formFileInput.getValue()})});this.idiom.register("addcontent","uploadDone",function(C){A.idiom.notify("main","displayTitle",{title:"fillForm",file:""})})},showForm:function(){this.idiom.notify("main","showAddContent",{});this.idiom.notify(null,"hide",{});this.formData.reset();this.formFile.reset();$("AddContentFormFieldFile").enable();this.formWrapper.show()},hideForm:function(){this.formWrapper.hide();this.idiom.notify("main","hideAddContent",{});this.idiom.notify(null,"show",{})},checkUploadButton:function(){if(this.formTitleInput.getValue()!=""&&this.formFileInput.getValue()!=""){this.formFileSubmit.enable()}else{this.formFileSubmit.disable()}}});at.idiom.js.sample=Class.create();at.idiom.js.sample.SampleChooser=Class.create({initialize:function(B){this.idiom=B.idiom;this.form=$(B.formId);var A=this;this.idiom.register(null,"hide",function(){A.toggleForm(false)});this.idiom.register(null,"show",function(){A.toggleForm(true)})},toggleForm:function(A){if(A){this.form.enable()}else{this.form.disable()}}});at.idiom.js.video=Class.create();at.idiom.js.video.Video=Class.create(at.idiom.js.window.Window,{initialize:function($super,B){$super(B);this.idiom=B.idiom;this.content=$(B.content);this.playerObjectTemplate=new Template("<object width='260' height='240' classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95'><param name='FileName' value='#{videoUrl}' /><param name='AutoStart' value='true' /><param name='ShowControls' value='1' /><param name='ShowStatusBar' value='0' /><param name='EnableContextMenu' value='0' /><param name='ShowDisplay' value='0' /><param name='ShowTracker' value='1' /><param name='stretchToFit' value='true' /><param name='AutoSize' value='true' /><param name='scale' value='tofit' /><embed width='260' height='240' scale='tofit' stretchtofit='true' autosize='true' showstatusbar='0' showcontrols='1' showtracker='1' enabledcontextmenu='0' src='#{videoUrl}' pluginspage='http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/' type='application/x-mplayer2' /></object>");var A=this;this.idiom.register("video","show",function(D){var C="";if(D.videoid=="9940746928"){C="http://broadcastmedia.mediasource.com/streams/KMSP_226503765_1227099584_149kbps.wmv"}else{if(D.videoid=="9940746907"){C="http://broadcastmedia.mediasource.com/streams/KUSA_221492931_1227142783_149kbps.wmv"}else{if(D.videoid=="9940746764"){C="http://broadcastmedia.mediasource.com/streams/KGO_221060026_1227250800_149kbps.wmv"}else{if(D.videoid=="9940746835"){C="http://broadcastmedia.mediasource.com/streams/WTTG-NC8_225465492_1227236385_149kbps.wmv"}else{return }}}}A.createPlayerObject(C)});this.idiom.register(null,"onNewContentId",function(C){A.destroyPlayerObject();if(C.contentid=="9940746928"||C.contentid=="9940746907"||C.contentid=="9940746764"||C.contentid=="9940746835"){A.idiom.notify("main","showAddVideo",{})}else{A.idiom.notify("main","hideAddVideo",{})}});this.idiom.register("video","hide",function(){A.destroyPlayerObject()});$(B.closeButton).observe("click",function(){A.idiom.notify("video","hide",{})});this.leftLeft=0;this.rightLeft=0;this.toggleLeft=0;new Draggable(this.window,{handle:"viewHeader",constraint:"horizontal",onEnd:function(){var D=A.window.positionedOffset().left;var C=A.window.positionedOffset().top;if(D<A.toggleLeft){new Effect.Move(A.window,{x:A.leftLeft,y:C,mode:"absolute",duration:0.5})}else{new Effect.Move(A.window,{x:A.rightLeft,y:C,mode:"absolute",duration:0.5})}},starteffect:Effect.Full,endeffect:Effect.Full})},destroyPlayerObject:function(){this.content.update();this.hideWindow()},createPlayerObject:function(B){this.destroyPlayerObject();this.showWindow();this.leftLeft=parseInt(this.window.getStyle("left"));this.rightLeft=this.leftLeft+this.window.getWidth()+10;this.toggleLeft=(this.leftLeft+this.rightLeft)/2;var A=this.playerObjectTemplate.evaluate({videoUrl:B});this.content.update(A)}});at.idiom.js.menu=Class.create();at.idiom.js.menu.OverlayMenu=Class.create({initialize:function(B){this.idiom=B.idiom;this.notifyName=B.notifyName;this.entry=$(B.entry);this.mainContentElement=$(B.mainContentElement);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;var A=this;this.entry.observe("click",function(){A.showMenu()})},showMenu:function(){this.entry.addClassName("menuSelected");if(this.menuElement){this.destroyMenu()}this.createMenuElement();this.insertContent();var F=this.menuElement.getWidth();var D=this.entry.getWidth();if(F<D){F=D}var B=this.mainContentElement.cumulativeOffset().left;var I=this.entry.cumulativeOffset().left-B;var E=0;if(this.align=="right"){E=I+D-F}else{var A=I+D/2;E=A-F/2}if(E+F>this.mainContentElement.getWidth()){E=this.mainContentElement.getWidth()-F}else{if(E<5){E=5}}var G=this.entry.cumulativeOffset().top;var C=this.entry.getHeight();var H=G+C;this.menuElement.setStyle({left:E+"px",width:F+"px",top:H+"px"});this.menuElement.appear({duration:0.3});new Effect.BlindDown(this.menuElement,{duration:0.3});this.createBackgroundOverlay()},insertContent:function(){if(this.contentFunction){this.contentFunction(this.menuElement)}else{var D=new Template("<a>#{displayName}</a>");var C=new Template("<a><img src='#{imageUrl}topbar/b_right.gif' border='0' />#{displayName}</a>");var A="";var B=this;this.content.each(function(F){var E=D;if(F.selected){E=C}A+=E.evaluate({imageUrl:B.imageUrl,displayName:F.displayName})});this.menuElement.update(A);this.menuElement.select("a").each(function(F,E){F.observe("click",function(G){B.setSelected(E);B.idiom.notify(B.notifyName,"select",{key:B.content[E].name,value:B.content[E].displayName});G.stop();B.destroyMenu()})})}},setSelected:function(A){this.content.each(function(C,B){if(B==A){C.selected=true}else{C.selected=false}})},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}})}});at.idiom.js.snapshots=Class.create();at.idiom.js.snapshots.Snapshots=Class.create({months:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],initialize:function(C){this.idiom=C.idiom;this.sample=C.sample;this.site=C.site;this.snapshots=C.snapshots;this.imageUrl=C.imageUrl;this.enabled=C.enabled?C.enabled:false;this.nextDayElement=$(C.nextDay);this.nextWeekElement=$(C.nextWeek);this.previousDayElement=$(C.previousDay);this.previousWeekElement=$(C.previousWeek);this.currentDateElement=$(C.currentDate);this.snapshotSelectorElement=$(C.snapshotSelectorElement);this.currentSnapshotId=C.currentSnapshot;this.currentSnapshotIndex=-1;for(var A=0;A<this.snapshots.length;A++){if(this.snapshots[A].id==C.currentSnapshot){this.currentSnapshotIndex=A;break}}this.currentDate=new Date();this.updateDate(false);var B=this;this.previousWeekElement.observe("click",this.previousWeek.bind(this));this.previousDayElement.observe("click",this.previousDay.bind(this));this.nextDayElement.observe("click",this.nextDay.bind(this));this.nextWeekElement.observe("click",this.nextWeek.bind(this));this.updateButtons();this.popupMenu=new at.idiom.js.menu.OverlayMenu({notifyName:"",idiom:this.idiom,entry:this.snapshotSelectorElement,mainContentElement:$("Content"),content:null,contentFunction:function(D){B.createDateSelector(D)}})},nextDay:function(){if(this.nextDayElement.down(".enabled").visible()){this.changeDate(24*60*60*1000)}},previousDay:function(){if(this.previousDayElement.down(".enabled").visible()){this.changeDate(-24*60*60*1000)}},nextWeek:function(){if(this.nextWeekElement.down(".enabled").visible()){this.changeDate(7*24*60*60*1000)}},previousWeek:function(){if(this.previousWeekElement.down(".enabled").visible()){this.changeDate(-7*24*60*60*1000)}},changeDate:function(F){var C=new Date();var E=this.parseDate(this.snapshots[0].date);var A=new Date(this.currentDate.getTime()+F);if(A.getTime()<E.getTime()){A.setTime(E.getTime())}else{if(A.getTime()>C.getTime()){A.setTime(C.getTime())}}var D=DatePickerUtils.dateObjectToAnsi(this.currentDate);this.currentDate.setTime(A.getTime());var B=DatePickerUtils.dateObjectToAnsi(this.currentDate);var G=D!=B;if(G){this.changedDate(G)}},changedDate:function(){var A=this.getSnapshotForDate(this.currentDate);if(A!=this.currentSnapshotId){this.selectSnapshotById(A)}this.updateButtons();this.updateDate(true)},selectSnapshotById:function(A){this.currentSnapshotId=A;for(var B=0;B<this.snapshots.length;B++){if(this.snapshots[B].id==A){this.currentSnapshotIndex=B;break}}this.idiom.notify(null,"changeSnapshot",{snapshotid:A})},selectSnapshotByDate:function(A){this.currentDate=this.parseDate(A);this.changedDate()},updateButtons:function(){var C=this.parseDate(this.snapshots[0].date).getTime();var B=(new Date()).getTime();var A=this.currentDate.getTime();this.updateButton(this.previousWeekElement,A-7*24*60*60*1000>C);this.updateButton(this.previousDayElement,A-24*60*60*1000>C);this.updateButton(this.nextDayElement,A+24*60*60*1000<B);this.updateButton(this.nextWeekElement,A+7*24*60*60*1000<B)},updateButton:function(B,A){if(A){B.down(".disabled").hide();B.down(".enabled").show()}else{B.down(".enabled").hide();B.down(".disabled").show()}},updateDate:function(A){this.currentDateElement.update(this.formatDate(this.currentDate));if(A){this.idiom.notify(null,"changeDate",{date:this.currentDate})}},createDateSelector:function(A){var B=this;this.dateSelector=new DatePicker({element:A,relative:this.snapshotSelectorElement.id,keepFieldEmpty:true,dateFilter:this.dateSelectorFilter(),zindex:10000,relativePosition:false,relativeAppend:true,currentDate:DatePickerUtils.dateObjectToAnsi(this.currentDate),callback:function(C){B.popupMenu.destroyMenu();B.selectSnapshotByDate(C)}})},dateSelectorFilter:function(){var B=this.parseDate(this.snapshots[0].date);var A=new DatePickerUtils.noDatesBefore(B);var C=new DatePickerUtils.noDatesAfter(new Date());return A.append(C)},showDateSelector:function(){this.dateSelector.click()},parseDate:function(A){return new Date(A.substr(0,4),A.substr(5,2)-1,A.substr(8,2))},formatDate:function(A){return(A.getDate()<10?"0":"")+A.getDate()+" "+this.months[A.getMonth()]+" "+A.getFullYear()},getSnapshotForDate:function(B){var D=-1;var E=DatePickerUtils.dateObjectToAnsi(B);for(var C=0;C<this.snapshots.length;C++){var A=this.snapshots[C].id;var F=this.snapshots[C].date;if(F>=E){D=A;break}}if(D==-1){D=this.snapshots[this.snapshots.length-1].id}return D}});