var a,Prototype={Version:"1.6.1",Browser:function(){var b=navigator.userAgent,c=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!c,Opera:c,WebKit:b.indexOf("AppleWebKit/")>-1,Gecko:b.indexOf("Gecko")>-1&&b.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile.*Safari/.test(b)}}(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:function(){var b=window.Element||window.HTMLElement;return!!(b&&b.prototype)}(),
SpecificElementExtensions:function(){if(typeof window.HTMLDivElement!=="undefined")return true;var b=document.createElement("div"),c=document.createElement("form"),d=false;if(b.__proto__&&b.__proto__!==c.__proto__)d=true;return d}()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(b){return b}};if(Prototype.Browser.MobileSafari)Prototype.BrowserFeatures.SpecificElementExtensions=false;
var Abstract={},Try={these:function(){for(var b,c=0,d=arguments.length;c<d;c++){var e=arguments[c];try{b=e();break}catch(f){}}return b}},Class=function(){function b(){}function c(){function e(){this.initialize.apply(this,arguments)}var f=null,g=$A(arguments);if(Object.isFunction(g[0]))f=g.shift();Object.extend(e,Class.Methods);e.superclass=f;e.subclasses=[];if(f){b.prototype=f.prototype;e.prototype=new b;f.subclasses.push(e)}for(f=0;f<g.length;f++)e.addMethods(g[f]);if(!e.prototype.initialize)e.prototype.initialize=
Prototype.emptyFunction;return e.prototype.constructor=e}function d(e){var f=this.superclass&&this.superclass.prototype,g=Object.keys(e);if(!Object.keys({toString:true}).length){e.toString!=Object.prototype.toString&&g.push("toString");e.valueOf!=Object.prototype.valueOf&&g.push("valueOf")}for(var j=0,h=g.length;j<h;j++){var l=g[j],r=e[l];if(f&&Object.isFunction(r)&&r.argumentNames().first()=="$super"){var v=r;r=function(u){return function(){return f[u].apply(this,arguments)}}(l).wrap(v);r.valueOf=
v.valueOf.bind(v);r.toString=v.toString.bind(v)}this.prototype[l]=r}return this}return{create:c,Methods:{addMethods:d}}}();
(function(){function b(o,t){for(var p in t)o[p]=t[p];return o}function c(o){try{if(A(o))return"undefined";if(o===null)return"null";return o.inspect?o.inspect():String(o)}catch(t){if(t instanceof RangeError)return"...";throw t;}}function d(o){switch(typeof o){case "undefined":case "function":case "unknown":return;case "boolean":return o.toString()}if(o===null)return"null";if(o.toJSON)return o.toJSON();if(!l(o)){var t=[];for(var p in o){var w=d(o[p]);A(w)||t.push(p.toJSON()+": "+w)}return"{"+t.join(", ")+
"}"}}function e(o){return $H(o).toQueryString()}function f(o){return o&&o.toHTML?o.toHTML():String.interpret(o)}function g(o){var t=[];for(var p in o)t.push(p);return t}function j(o){var t=[];for(var p in o)t.push(o[p]);return t}function h(o){return b({},o)}function l(o){return!!(o&&o.nodeType==1)}function r(o){return G.call(o)=="[object Array]"}function v(o){return o instanceof Hash}function u(o){return typeof o==="function"}function y(o){return G.call(o)=="[object String]"}function C(o){return G.call(o)==
"[object Number]"}function A(o){return typeof o==="undefined"}var G=Object.prototype.toString;b(Object,{extend:b,inspect:c,toJSON:d,toQueryString:e,toHTML:f,keys:g,values:j,clone:h,isElement:l,isArray:r,isHash:v,isFunction:u,isString:y,isNumber:C,isUndefined:A})})();
Object.extend(Function.prototype,function(){function b(u,y){for(var C=u.length,A=y.length;A--;)u[C+A]=y[A];return u}function c(u,y){u=v.call(u,0);return b(u,y)}function d(){var u=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g,"").replace(/\s+/g,"").split(",");return u.length==1&&!u[0]?[]:u}function e(u){if(arguments.length<2&&Object.isUndefined(arguments[0]))return this;var y=this,C=v.call(arguments,1);return function(){var A=c(C,arguments);
return y.apply(u,A)}}function f(u){var y=this,C=v.call(arguments,1);return function(A){A=b([A||window.event],C);return y.apply(u,A)}}function g(){if(!arguments.length)return this;var u=this,y=v.call(arguments,0);return function(){var C=c(y,arguments);return u.apply(this,C)}}function j(u){var y=this,C=v.call(arguments,1);u*=1E3;return window.setTimeout(function(){return y.apply(y,C)},u)}function h(){return this.delay.apply(this,b([0.01],arguments))}function l(u){var y=this;return function(){var C=
b([y.bind(this)],arguments);return u.apply(this,C)}}function r(){if(this._methodized)return this._methodized;var u=this;return this._methodized=function(){var y=b([this],arguments);return u.apply(null,y)}}var v=Array.prototype.slice;return{argumentNames:d,bind:e,bindAsEventListener:f,curry:g,delay:j,defer:h,wrap:l,methodize:r}}());
Date.prototype.toJSON=function(){return'"'+this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+'Z"'};RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(b){return String(b).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};
var PeriodicalExecuter=Class.create({initialize:function(b,c){this.callback=b;this.frequency=c;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1E3)},execute:function(){this.callback(this)},stop:function(){if(this.timer){clearInterval(this.timer);this.timer=null}},onTimerEvent:function(){if(!this.currentlyExecuting)try{this.currentlyExecuting=true;this.execute();this.currentlyExecuting=false}catch(b){this.currentlyExecuting=
false;throw b;}}});Object.extend(String,{interpret:function(b){return b==null?"":String(b)},specialChar:{"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r","\\":"\\\\"}});
Object.extend(String.prototype,function(){function b(x){if(Object.isFunction(x))return x;var B=new Template(x);return function(E){return B.evaluate(E)}}function c(x,B){var E="",F=this,K;B=b(B);if(Object.isString(x))x=RegExp.escape(x);if(!(x.length||x.source)){B=B("");return B+F.split("").join(B)+B}for(;F.length>0;)if(K=F.match(x)){E+=F.slice(0,K.index);E+=String.interpret(B(K));F=F.slice(K.index+K[0].length)}else{E+=F;F=""}return E}function d(x,B,E){B=b(B);E=Object.isUndefined(E)?1:E;return this.gsub(x,
function(F){if(--E<0)return F[0];return B(F)})}function e(x,B){this.gsub(x,B);return String(this)}function f(x,B){x=x||30;B=Object.isUndefined(B)?"...":B;return this.length>x?this.slice(0,x-B.length)+B:String(this)}function g(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}function j(){return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,"")}function h(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")}function l(){var x=new RegExp(Prototype.ScriptFragment,"img"),
B=new RegExp(Prototype.ScriptFragment,"im");return(this.match(x)||[]).map(function(E){return(E.match(B)||["",""])[1]})}function r(){return this.extractScripts().map(function(x){return eval(x)})}function v(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function u(){return this.stripTags().replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}function y(x){var B=this.strip().match(/([^?#]*)(#.*)?$/);if(!B)return{};return B[1].split(x||"&").inject({},function(E,
F){if((F=F.split("="))[0]){var K=decodeURIComponent(F.shift());F=F.length>1?F.join("="):F[0];if(F!=undefined)F=decodeURIComponent(F);if(K in E){Object.isArray(E[K])||(E[K]=[E[K]]);E[K].push(F)}else E[K]=F}return E})}function C(){return this.split("")}function A(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)}function G(x){return x<1?"":(new Array(x+1)).join(this)}function o(){var x=this.split("-"),B=x.length;if(B==1)return x[0];for(var E=this.charAt(0)==
"-"?x[0].charAt(0).toUpperCase()+x[0].substring(1):x[0],F=1;F<B;F++)E+=x[F].charAt(0).toUpperCase()+x[F].substring(1);return E}function t(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()}function p(){return this.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/-/g,"_").toLowerCase()}function w(){return this.replace(/_/g,"-")}function q(x){var B=this.replace(/[\x00-\x1f\\]/g,function(E){if(E in String.specialChar)return String.specialChar[E];
return"\\u00"+E.charCodeAt().toPaddedString(2,16)});if(x)return'"'+B.replace(/"/g,'\\"')+'"';return"'"+B.replace(/'/g,"\\'")+"'"}function s(){return this.inspect(true)}function n(x){return this.replace(x||Prototype.JSONFilter,"$1")}function i(){var x=this;if(x.blank())return false;x=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/.test(x)}function k(x){var B=this.unfilterJSON();try{if(!x||B.isJSON())return eval("("+B+")")}catch(E){}throw new SyntaxError("Badly formed JSON string: "+
this.inspect());}function m(x){return this.indexOf(x)>-1}function z(x){return this.indexOf(x)===0}function D(x){var B=this.length-x.length;return B>=0&&this.lastIndexOf(x)===B}function H(){return this==""}function I(){return/^\s*$/.test(this)}function J(x,B){return(new Template(this,B)).evaluate(x)}return{gsub:c,sub:d,scan:e,truncate:f,strip:String.prototype.trim?String.prototype.trim:g,stripTags:j,stripScripts:h,extractScripts:l,evalScripts:r,escapeHTML:v,unescapeHTML:u,toQueryParams:y,parseQuery:y,
toArray:C,succ:A,times:G,camelize:o,capitalize:t,underscore:p,dasherize:w,inspect:q,toJSON:s,unfilterJSON:n,isJSON:i,evalJSON:k,include:m,startsWith:z,endsWith:D,empty:H,blank:I,interpolate:J}}());
var Template=Class.create({initialize:function(b,c){this.template=b.toString();this.pattern=c||Template.Pattern},evaluate:function(b){if(b&&Object.isFunction(b.toTemplateReplacements))b=b.toTemplateReplacements();return this.template.gsub(this.pattern,function(c){if(b==null)return c[1]+"";var d=c[1]||"";if(d=="\\")return c[2];var e=b,f=c[3],g=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;c=g.exec(f);if(c==null)return d;for(;c!=null;){var j=c[1].startsWith("[")?c[2].replace(/\\\\]/g,"]"):c[1];e=e[j];if(null==
e||""==c[3])break;f=f.substring("["==c[3]?c[1].length:c[0].length);c=g.exec(f)}return d+String.interpret(e)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;
var $break={},Enumerable=function(){function b(n,i){var k=0;try{this._each(function(z){n.call(i,z,k++)})}catch(m){if(m!=$break)throw m;}return this}function c(n,i,k){var m=-n,z=[],D=this.toArray();if(n<1)return D;for(;(m+=n)<D.length;)z.push(D.slice(m,m+n));return z.collect(i,k)}function d(n,i){n=n||Prototype.K;var k=true;this.each(function(m,z){k=k&&!!n.call(i,m,z);if(!k)throw $break;});return k}function e(n,i){n=n||Prototype.K;var k=false;this.each(function(m,z){if(k=!!n.call(i,m,z))throw $break;
});return k}function f(n,i){n=n||Prototype.K;var k=[];this.each(function(m,z){k.push(n.call(i,m,z))});return k}function g(n,i){var k;this.each(function(m,z){if(n.call(i,m,z)){k=m;throw $break;}});return k}function j(n,i){var k=[];this.each(function(m,z){n.call(i,m,z)&&k.push(m)});return k}function h(n,i,k){i=i||Prototype.K;var m=[];if(Object.isString(n))n=new RegExp(RegExp.escape(n));this.each(function(z,D){n.match(z)&&m.push(i.call(k,z,D))});return m}function l(n){if(Object.isFunction(this.indexOf))if(this.indexOf(n)!=
-1)return true;var i=false;this.each(function(k){if(k==n){i=true;throw $break;}});return i}function r(n,i){i=Object.isUndefined(i)?null:i;return this.eachSlice(n,function(k){for(;k.length<n;)k.push(i);return k})}function v(n,i,k){this.each(function(m,z){n=i.call(k,n,m,z)});return n}function u(n){var i=$A(arguments).slice(1);return this.map(function(k){return k[n].apply(k,i)})}function y(n,i){n=n||Prototype.K;var k;this.each(function(m,z){m=n.call(i,m,z);if(k==null||m>=k)k=m});return k}function C(n,
i){n=n||Prototype.K;var k;this.each(function(m,z){m=n.call(i,m,z);if(k==null||m<k)k=m});return k}function A(n,i){n=n||Prototype.K;var k=[],m=[];this.each(function(z,D){(n.call(i,z,D)?k:m).push(z)});return[k,m]}function G(n){var i=[];this.each(function(k){i.push(k[n])});return i}function o(n,i){var k=[];this.each(function(m,z){n.call(i,m,z)||k.push(m)});return k}function t(n,i){return this.map(function(k,m){return{value:k,criteria:n.call(i,k,m)}}).sort(function(k,m){k=k.criteria;m=m.criteria;return k<
m?-1:k>m?1:0}).pluck("value")}function p(){return this.map()}function w(){var n=Prototype.K,i=$A(arguments);if(Object.isFunction(i.last()))n=i.pop();var k=[this].concat(i).map($A);return this.map(function(m,z){return n(k.pluck(z))})}function q(){return this.toArray().length}function s(){return"#<Enumerable:"+this.toArray().inspect()+">"}return{each:b,eachSlice:c,all:d,every:d,any:e,some:e,collect:f,map:f,detect:g,findAll:j,select:j,filter:j,grep:h,include:l,member:l,inGroupsOf:r,inject:v,invoke:u,
max:y,min:C,partition:A,pluck:G,reject:o,sortBy:t,toArray:p,entries:p,zip:w,size:q,inspect:s,find:g}}();function $A(b){if(!b)return[];if("toArray"in Object(b))return b.toArray();for(var c=b.length||0,d=new Array(c);c--;)d[c]=b[c];return d}function $w(b){if(!Object.isString(b))return[];return(b=b.strip())?b.split(/\s+/):[]}Array.from=$A;
(function(){function b(q){for(var s=0,n=this.length;s<n;s++)q(this[s])}function c(){this.length=0;return this}function d(){return this[0]}function e(){return this[this.length-1]}function f(){return this.select(function(q){return q!=null})}function g(){return this.inject([],function(q,s){if(Object.isArray(s))return q.concat(s.flatten());q.push(s);return q})}function j(){var q=p.call(arguments,0);return this.select(function(s){return!q.include(s)})}function h(q){return(q!==false?this:this.toArray())._reverse()}
function l(q){return this.inject([],function(s,n,i){if(0==i||(q?s.last()!=n:!s.include(n)))s.push(n);return s})}function r(q){return this.uniq().findAll(function(s){return q.detect(function(n){return s===n})})}function v(){return p.call(this,0)}function u(){return this.length}function y(){return"["+this.map(Object.inspect).join(", ")+"]"}function C(){var q=[];this.each(function(s){s=Object.toJSON(s);Object.isUndefined(s)||q.push(s)});return"["+q.join(", ")+"]"}function A(q,s){s||(s=0);var n=this.length;
if(s<0)s=n+s;for(;s<n;s++)if(this[s]===q)return s;return-1}function G(q,s){s=isNaN(s)?this.length:(s<0?this.length+s:s)+1;q=this.slice(0,s).reverse().indexOf(q);return q<0?q:s-q-1}function o(){for(var q=p.call(this,0),s,n=0,i=arguments.length;n<i;n++){s=arguments[n];if(Object.isArray(s)&&!("callee"in s))for(var k=0,m=s.length;k<m;k++)q.push(s[k]);else q.push(s)}return q}var t=Array.prototype,p=t.slice,w=t.forEach;w||(w=b);Object.extend(t,Enumerable);if(!t._reverse)t._reverse=t.reverse;Object.extend(t,
{_each:w,clear:c,first:d,last:e,compact:f,flatten:g,without:j,reverse:h,uniq:l,intersect:r,clone:v,toArray:v,size:u,inspect:y,toJSON:C});if(function(){return[].concat(arguments)[0][0]!==1}(1,2))t.concat=o;if(!t.indexOf)t.indexOf=A;if(!t.lastIndexOf)t.lastIndexOf=G})();function $H(b){return new Hash(b)}
var Hash=Class.create(Enumerable,function(){function b(o){this._object=Object.isHash(o)?o.toObject():Object.clone(o)}function c(o){for(var t in this._object){var p=this._object[t],w=[t,p];w.key=t;w.value=p;o(w)}}function d(o,t){return this._object[o]=t}function e(o){if(this._object[o]!==Object.prototype[o])return this._object[o]}function f(o){var t=this._object[o];delete this._object[o];return t}function g(){return Object.clone(this._object)}function j(){return this.pluck("key")}function h(){return this.pluck("value")}
function l(o){var t=this.detect(function(p){return p.value===o});return t&&t.key}function r(o){return this.clone().update(o)}function v(o){return(new Hash(o)).inject(this,function(t,p){t.set(p.key,p.value);return t})}function u(o,t){if(Object.isUndefined(t))return o;return o+"="+encodeURIComponent(String.interpret(t))}function y(){return this.inject([],function(o,t){var p=encodeURIComponent(t.key);if((t=t.value)&&typeof t=="object"){if(Object.isArray(t))return o.concat(t.map(u.curry(p)))}else o.push(u(p,
t));return o}).join("&")}function C(){return"#<Hash:{"+this.map(function(o){return o.map(Object.inspect).join(": ")}).join(", ")+"}>"}function A(){return Object.toJSON(this.toObject())}function G(){return new Hash(this)}return{initialize:b,_each:c,set:d,get:e,unset:f,toObject:g,toTemplateReplacements:g,keys:j,values:h,index:l,merge:r,update:v,toQueryString:y,inspect:C,toJSON:A,clone:G}}());Hash.from=$H;
Object.extend(Number.prototype,function(){function b(){return this.toPaddedString(2,16)}function c(){return this+1}function d(r,v){$R(0,this,true).each(r,v);return this}function e(r,v){v=this.toString(v||10);return"0".times(r-v.length)+v}function f(){return isFinite(this)?this.toString():"null"}function g(){return Math.abs(this)}function j(){return Math.round(this)}function h(){return Math.ceil(this)}function l(){return Math.floor(this)}return{toColorPart:b,succ:c,times:d,toPaddedString:e,toJSON:f,
abs:g,round:j,ceil:h,floor:l}}());function $R(b,c,d){return new ObjectRange(b,c,d)}
var ObjectRange=Class.create(Enumerable,function(){function b(e,f,g){this.start=e;this.end=f;this.exclusive=g}function c(e){for(var f=this.start;this.include(f);){e(f);f=f.succ()}}function d(e){if(e<this.start)return false;if(this.exclusive)return e<this.end;return e<=this.end}return{initialize:b,_each:c,include:d}}()),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(b){this.responders._each(b)},register:function(b){this.include(b)||this.responders.push(b)},unregister:function(b){this.responders=this.responders.without(b)},dispatch:function(b,c,d,e){this.each(function(f){if(Object.isFunction(f[b]))try{f[b].apply(f,[c,d,e])}catch(g){}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});
Ajax.Base=Class.create({initialize:function(b){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};Object.extend(this.options,b||{});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,c,d){$super(d);this.transport=Ajax.getTransport();this.request(c)},request:function(b){this.url=b;this.method=this.options.method;b=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){b._method=this.method;this.method="post"}this.parameters=b;if(b=Object.toQueryString(b))if(this.method=="get")this.url+=(this.url.include("?")?"&":"?")+b;else if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))b+=
"&_=";try{var c=new Ajax.Response(this);this.options.onCreate&&this.options.onCreate(c);Ajax.Responders.dispatch("onCreate",this,c);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);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||b:null;this.transport.send(this.body);!this.options.asynchronous&&this.transport.overrideMimeType&&
this.onStateChange()}catch(d){this.dispatchException(d)}},onStateChange:function(){var b=this.transport.readyState;b>1&&!(b==4&&this._complete)&&this.respondToReadyState(this.transport.readyState)},setRequestHeaders:function(){var b={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){b["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)b.Connection="close"}if(typeof this.options.requestHeaders=="object"){var c=this.options.requestHeaders;if(Object.isFunction(c.push))for(var d=0,e=c.length;d<e;d+=2)b[c[d]]=c[d+1];else $H(c).each(function(g){b[g.key]=g.value})}for(var f in b)this.transport.setRequestHeader(f,b[f])},success:function(){var b=this.getStatus();return!b||b>=200&&b<300},getStatus:function(){try{return this.transport.status||
0}catch(b){return 0}},respondToReadyState:function(b){b=Ajax.Request.Events[b];var c=new Ajax.Response(this);if(b=="Complete"){try{this._complete=true;(this.options["on"+c.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(c,c.headerJSON)}catch(d){this.dispatchException(d)}var e=c.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"+
b]||Prototype.emptyFunction)(c,c.headerJSON);Ajax.Responders.dispatch("on"+b,this,c,c.headerJSON)}catch(f){this.dispatchException(f)}if(b=="Complete")this.transport.onreadystatechange=Prototype.emptyFunction},isSameOrigin:function(){var b=this.url.match(/^\s*https?:\/\/[^\/]*/);return!b||b[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""})},getHeader:function(b){try{return this.transport.getResponseHeader(b)||
null}catch(c){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(b){this.dispatchException(b)}},dispatchException:function(b){(this.options.onException||Prototype.emptyFunction)(this,b);Ajax.Responders.dispatch("onException",this,b)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];
Ajax.Response=Class.create({initialize:function(b){this.request=b;b=this.transport=b.transport;var c=this.readyState=b.readyState;if(c>2&&!Prototype.Browser.IE||c==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(b.responseText);this.headerJSON=this._getHeaderJSON()}if(c==4){b=b.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(b){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(b){return null}},getResponseHeader:function(b){return this.transport.getResponseHeader(b)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var b=this.getHeader("X-JSON");if(!b)return null;b=decodeURIComponent(escape(b));try{return b.evalJSON(this.request.options.sanitizeJSON||
!this.request.isSameOrigin())}catch(c){this.request.dispatchException(c)}},_getResponseJSON:function(){var b=this.request.options;if(!b.evalJSON||b.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json")||this.responseText.blank())return null;try{return this.responseText.evalJSON(b.sanitizeJSON||!this.request.isSameOrigin())}catch(c){this.request.dispatchException(c)}}});
Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,c,d,e){this.container={success:c.success||c,failure:c.failure||(c.success?null:c)};e=Object.clone(e);var f=e.onComplete;e.onComplete=function(g,j){this.updateContent(g.responseText);Object.isFunction(f)&&f(g,j)}.bind(this);$super(d,e)},updateContent:function(b){var c=this.container[this.success()?"success":"failure"],d=this.options;d.evalScripts||(b=b.stripScripts());if(c=$(c))if(d.insertion)if(Object.isString(d.insertion)){var e=
{};e[d.insertion]=b;c.insert(e)}else d.insertion(c,b);else c.update(b)}});
Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,c,d,e){$super(e);this.onComplete=this.options.onComplete;this.frequency=this.options.frequency||2;this.decay=this.options.decay||1;this.updater={};this.container=c;this.url=d;this.start()},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent()},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments)},
updateComplete:function(b){if(this.options.decay){this.decay=b.responseText==this.lastText?this.decay*this.options.decay:1;this.lastText=b.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 c=0,d=[],e=arguments.length;c<e;c++)d.push($(arguments[c]));return d}if(Object.isString(b))b=document.getElementById(b);return Element.extend(b)}if(Prototype.BrowserFeatures.XPath)document._getElementsByXPath=function(b,c){var d=[];b=document.evaluate(b,$(c)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);c=0;for(var e=b.snapshotLength;c<e;c++)d.push(Element.extend(b.snapshotItem(c)));return d};if(!window.Node)var Node={};
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(b){var c=function(){var e=document.createElement("form"),f=document.createElement("input"),g=document.documentElement;f.setAttribute("name","test");e.appendChild(f);g.appendChild(e);f=e.elements?typeof e.elements.test=="undefined":null;g.removeChild(e);return f}(),d=b.Element;b.Element=function(e,f){f=f||{};e=e.toLowerCase();var g=Element.cache;if(c&&f.name){e="<"+e+' name="'+f.name+'">';delete f.name;return Element.writeAttribute(document.createElement(e),f)}g[e]||(g[e]=Element.extend(document.createElement(e)));
return Element.writeAttribute(g[e].cloneNode(false),f)};Object.extend(b.Element,d||{});if(d)b.Element.prototype=d.prototype})(this);Element.cache={};Element.idCounter=1;
Element.Methods={visible:function(b){return $(b).style.display!="none"},toggle:function(b){b=$(b);Element[Element.visible(b)?"hide":"show"](b);return b},hide:function(b){b=$(b);b.style.display="none";return b},show:function(b){b=$(b);b.style.display="";return b},remove:function(b){b=$(b);b.parentNode.removeChild(b);return b},update:function(){function b(f,g){f=$(f);if(g&&g.toElement)g=g.toElement();if(Object.isElement(g))return f.update().insert(g);g=Object.toHTML(g);var j=f.tagName.toUpperCase();
if(j==="SCRIPT"&&e){f.text=g;return f}if(c||d)if(j in Element._insertionTranslations.tags){for(;f.firstChild;)f.removeChild(f.firstChild);Element._getContentFromAnonymousElement(j,g.stripScripts()).each(function(h){f.appendChild(h)})}else f.innerHTML=g.stripScripts();else f.innerHTML=g.stripScripts();g.evalScripts.bind(g).defer();return f}var c=function(){var f=document.createElement("select"),g=true;f.innerHTML='<option value="test">test</option>';if(f.options&&f.options[0])g=f.options[0].nodeName.toUpperCase()!==
"OPTION";return g}(),d=function(){try{var f=document.createElement("table");if(f&&f.tBodies){f.innerHTML="<tbody><tr><td>test</td></tr></tbody>";return typeof f.tBodies[0]=="undefined"}}catch(g){return true}}(),e=function(){var f=document.createElement("script"),g=false;try{f.appendChild(document.createTextNode(""));g=!f.firstChild||f.firstChild&&f.firstChild.nodeType!==3}catch(j){g=true}return g}();return b}(),replace:function(b,c){b=$(b);if(c&&c.toElement)c=c.toElement();else if(!Object.isElement(c)){c=
Object.toHTML(c);var d=b.ownerDocument.createRange();d.selectNode(b);c.evalScripts.bind(c).defer();c=d.createContextualFragment(c.stripScripts())}b.parentNode.replaceChild(c,b);return b},insert:function(b,c){b=$(b);if(Object.isString(c)||Object.isNumber(c)||Object.isElement(c)||c&&(c.toElement||c.toHTML))c={bottom:c};var d,e,f;for(var g in c){d=c[g];g=g.toLowerCase();e=Element._insertionTranslations[g];if(d&&d.toElement)d=d.toElement();if(Object.isElement(d))e(b,d);else{d=Object.toHTML(d);f=(g=="before"||
g=="after"?b.parentNode:b).tagName.toUpperCase();f=Element._getContentFromAnonymousElement(f,d.stripScripts());if(g=="top"||g=="after")f.reverse();f.each(e.curry(b));d.evalScripts.bind(d).defer()}}return b},wrap:function(b,c,d){b=$(b);if(Object.isElement(c))$(c).writeAttribute(d||{});else c=Object.isString(c)?new Element(c,d):new Element("div",c);b.parentNode&&b.parentNode.replaceChild(c,b);c.appendChild(b);return c},inspect:function(b){b=$(b);var c="<"+b.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(d){var e=
d.first();d=d.last();if(e=(b[e]||"").toString())c+=" "+d+"="+e.inspect(true)});return c+">"},recursivelyCollect:function(b,c){b=$(b);for(var d=[];b=b[c];)b.nodeType==1&&d.push(Element.extend(b));return d},ancestors:function(b){return Element.recursivelyCollect(b,"parentNode")},descendants:function(b){return Element.select(b,"*")},firstDescendant:function(b){for(b=$(b).firstChild;b&&b.nodeType!=1;)b=b.nextSibling;return $(b)},immediateDescendants:function(b){if(!(b=$(b).firstChild))return[];for(;b&&
b.nodeType!=1;)b=b.nextSibling;if(b)return[b].concat($(b).nextSiblings());return[]},previousSiblings:function(b){return Element.recursivelyCollect(b,"previousSibling")},nextSiblings:function(b){return Element.recursivelyCollect(b,"nextSibling")},siblings:function(b){b=$(b);return Element.previousSiblings(b).reverse().concat(Element.nextSiblings(b))},match:function(b,c){if(Object.isString(c))c=new Selector(c);return c.match($(b))},up:function(b,c,d){b=$(b);if(arguments.length==1)return $(b.parentNode);
var e=Element.ancestors(b);return Object.isNumber(c)?e[c]:Selector.findElement(e,c,d)},down:function(b,c,d){b=$(b);if(arguments.length==1)return Element.firstDescendant(b);return Object.isNumber(c)?Element.descendants(b)[c]:Element.select(b,c)[d||0]},previous:function(b,c,d){b=$(b);if(arguments.length==1)return $(Selector.handlers.previousElementSibling(b));var e=Element.previousSiblings(b);return Object.isNumber(c)?e[c]:Selector.findElement(e,c,d)},next:function(b,c,d){b=$(b);if(arguments.length==
1)return $(Selector.handlers.nextElementSibling(b));var e=Element.nextSiblings(b);return Object.isNumber(c)?e[c]:Selector.findElement(e,c,d)},select:function(b){var c=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(b,c)},adjacent:function(b){var c=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(b.parentNode,c).without(b)},identify:function(b){b=$(b);var c=Element.readAttribute(b,"id");if(c)return c;do c="anonymous_element_"+Element.idCounter++;while($(c));
Element.writeAttribute(b,"id",c);return c},readAttribute:function(b,c){b=$(b);if(Prototype.Browser.IE){var d=Element._attributeTranslations.read;if(d.values[c])return d.values[c](b,c);if(d.names[c])c=d.names[c];if(c.include(":"))return!b.attributes||!b.attributes[c]?null:b.attributes[c].value}return b.getAttribute(c)},writeAttribute:function(b,c,d){b=$(b);var e={},f=Element._attributeTranslations.write;if(typeof c=="object")e=c;else e[c]=Object.isUndefined(d)?true:d;for(var g in e){c=f.names[g]||
g;d=e[g];if(f.values[g])c=f.values[g](b,d);if(d===false||d===null)b.removeAttribute(c);else d===true?b.setAttribute(c,c):b.setAttribute(c,d)}return b},getHeight:function(b){return Element.getDimensions(b).height},getWidth:function(b){return Element.getDimensions(b).width},classNames:function(b){return new Element.ClassNames(b)},hasClassName:function(b,c){if(b=$(b)){b=b.className;return b.length>0&&(b==c||(new RegExp("(^|\\s)"+c+"(\\s|$)")).test(b))}},addClassName:function(b,c){if(b=$(b)){Element.hasClassName(b,
c)||(b.className+=(b.className?" ":"")+c);return b}},removeClassName:function(b,c){if(b=$(b)){b.className=b.className.replace(new RegExp("(^|\\s+)"+c+"(\\s+|$)")," ").strip();return b}},toggleClassName:function(b,c){if(b=$(b))return Element[Element.hasClassName(b,c)?"removeClassName":"addClassName"](b,c)},cleanWhitespace:function(b){b=$(b);for(var c=b.firstChild;c;){var d=c.nextSibling;c.nodeType==3&&!/\S/.test(c.nodeValue)&&b.removeChild(c);c=d}return b},empty:function(b){return $(b).innerHTML.blank()},
descendantOf:function(b,c){b=$(b);c=$(c);if(b.compareDocumentPosition)return(b.compareDocumentPosition(c)&8)===8;if(c.contains)return c.contains(b)&&c!==b;for(;b=b.parentNode;)if(b==c)return true;return false},scrollTo:function(b){b=$(b);var c=Element.cumulativeOffset(b);window.scrollTo(c[0],c[1]);return b},getStyle:function(b,c){b=$(b);c=c=="float"?"cssFloat":c.camelize();var d=b.style[c];if(!d||d=="auto")d=(b=document.defaultView.getComputedStyle(b,null))?b[c]:null;if(c=="opacity")return d?parseFloat(d):
1;return d=="auto"?null:d},getOpacity:function(b){return $(b).getStyle("opacity")},setStyle:function(b,c){b=$(b);var d=b.style;if(Object.isString(c)){b.style.cssText+=";"+c;return c.include("opacity")?b.setOpacity(c.match(/opacity:\s*(\d?\.?\d*)/)[1]):b}for(var e in c)if(e=="opacity")b.setOpacity(c[e]);else d[e=="float"||e=="cssFloat"?Object.isUndefined(d.styleFloat)?"cssFloat":"styleFloat":e]=c[e];return b},setOpacity:function(b,c){b=$(b);b.style.opacity=c==1||c===""?"":c<1.0E-5?0:c;return b},getDimensions:function(b){b=
$(b);var c=Element.getStyle(b,"display");if(c!="none"&&c!=null)return{width:b.offsetWidth,height:b.offsetHeight};c=b.style;var d=c.visibility,e=c.position,f=c.display;c.visibility="hidden";if(e!="fixed")c.position="absolute";c.display="block";var g=b.clientWidth;b=b.clientHeight;c.display=f;c.position=e;c.visibility=d;return{width:g,height:b}},makePositioned:function(b){b=$(b);var c=Element.getStyle(b,"position");if(c=="static"||!c){b._madePositioned=true;b.style.position="relative";if(Prototype.Browser.Opera){b.style.top=
0;b.style.left=0}}return b},undoPositioned:function(b){b=$(b);if(b._madePositioned){b._madePositioned=undefined;b.style.position=b.style.top=b.style.left=b.style.bottom=b.style.right=""}return b},makeClipping:function(b){b=$(b);if(b._overflow)return b;b._overflow=Element.getStyle(b,"overflow")||"auto";if(b._overflow!=="hidden")b.style.overflow="hidden";return b},undoClipping:function(b){b=$(b);if(!b._overflow)return b;b.style.overflow=b._overflow=="auto"?"":b._overflow;b._overflow=null;return b},
cumulativeOffset:function(b){var c=0,d=0;do{c+=b.offsetTop||0;d+=b.offsetLeft||0;b=b.offsetParent}while(b);return Element._returnOffset(d,c)},positionedOffset:function(b){var c=0,d=0;do{c+=b.offsetTop||0;d+=b.offsetLeft||0;if(b=b.offsetParent){if(b.tagName.toUpperCase()=="BODY")break;if(Element.getStyle(b,"position")!=="static")break}}while(b);return Element._returnOffset(d,c)},absolutize:function(b){b=$(b);if(Element.getStyle(b,"position")=="absolute")return b;var c=Element.positionedOffset(b),d=
c[1];c=c[0];var e=b.clientWidth,f=b.clientHeight;b._originalLeft=c-parseFloat(b.style.left||0);b._originalTop=d-parseFloat(b.style.top||0);b._originalWidth=b.style.width;b._originalHeight=b.style.height;b.style.position="absolute";b.style.top=d+"px";b.style.left=c+"px";b.style.width=e+"px";b.style.height=f+"px";return b},relativize:function(b){b=$(b);if(Element.getStyle(b,"position")=="relative")return b;b.style.position="relative";var c=parseFloat(b.style.top||0)-(b._originalTop||0),d=parseFloat(b.style.left||
0)-(b._originalLeft||0);b.style.top=c+"px";b.style.left=d+"px";b.style.height=b._originalHeight;b.style.width=b._originalWidth;return b},cumulativeScrollOffset:function(b){var c=0,d=0;do{c+=b.scrollTop||0;d+=b.scrollLeft||0;b=b.parentNode}while(b);return Element._returnOffset(d,c)},getOffsetParent:function(b){if(b.offsetParent)return $(b.offsetParent);if(b==document.body)return $(b);for(;(b=b.parentNode)&&b!=document.body;)if(Element.getStyle(b,"position")!="static")return $(b);return $(document.body)},
viewportOffset:function(b){var c=0,d=0,e=b;do{c+=e.offsetTop||0;d+=e.offsetLeft||0;if(e.offsetParent==document.body&&Element.getStyle(e,"position")=="absolute")break}while(e=e.offsetParent);e=b;do if(!Prototype.Browser.Opera||e.tagName&&e.tagName.toUpperCase()=="BODY"){c-=e.scrollTop||0;d-=e.scrollLeft||0}while(e=e.parentNode);return Element._returnOffset(d,c)},clonePosition:function(b,c,d){d=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},d||{});c=$(c);
var e=Element.viewportOffset(c);b=$(b);var f=[0,0],g=null;if(Element.getStyle(b,"position")=="absolute"){g=Element.getOffsetParent(b);f=Element.viewportOffset(g)}if(g==document.body){f[0]-=document.body.offsetLeft;f[1]-=document.body.offsetTop}if(d.setLeft)b.style.left=e[0]-f[0]+d.offsetLeft+"px";if(d.setTop)b.style.top=e[1]-f[1]+d.offsetTop+"px";if(d.setWidth)b.style.width=c.offsetWidth+"px";if(d.setHeight)b.style.height=c.offsetHeight+"px";return b}};
Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};
if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(b,c,d){switch(d){case "left":case "top":case "right":case "bottom":if(b(c,"position")==="static")return null;case "height":case "width":if(!Element.visible(c))return null;var e=parseInt(b(c,d),10);if(e!==c["offset"+d.capitalize()])return e+"px";return(d==="height"?["border-top-width","padding-top","padding-bottom","border-bottom-width"]:["border-left-width","padding-left","padding-right","border-right-width"]).inject(e,
function(f,g){g=b(c,g);return g===null?f:f-parseInt(g,10)})+"px";default:return b(c,d)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(b,c,d){if(d==="title")return c.title;return b(c,d)})}else if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(b,c){c=$(c);var d=c.getStyle("position");if(d!=="static")return b(c);c.setStyle({position:"relative"});b=b(c);c.setStyle({position:d});return b});$w("positionedOffset viewportOffset").each(function(b){Element.Methods[b]=
Element.Methods[b].wrap(function(c,d){d=$(d);var e=d.getStyle("position");if(e!=="static")return c(d);var f=d.getOffsetParent();f&&f.getStyle("position")==="fixed"&&f.setStyle({zoom:1});d.setStyle({position:"relative"});c=c(d);d.setStyle({position:e});return c})});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(b,c){return b(c)});Element.Methods.getStyle=function(b,c){b=$(b);c=c=="float"||c=="cssFloat"?"styleFloat":c.camelize();var d=b.style[c];if(!d&&b.currentStyle)d=
b.currentStyle[c];if(c=="opacity"){if(d=(b.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/))if(d[1])return parseFloat(d[1])/100;return 1}if(d=="auto"){if((c=="width"||c=="height")&&b.getStyle("display")!="none")return b["offset"+c.capitalize()]+"px";return null}return d};Element.Methods.setOpacity=function(b,c){function d(g){return g.replace(/alpha\([^\)]*\)/gi,"")}b=$(b);var e=b.currentStyle;if(e&&!e.hasLayout||!e&&b.style.zoom=="normal")b.style.zoom=1;e=b.getStyle("filter");var f=b.style;
if(c==1||c===""){(e=d(e))?(f.filter=e):f.removeAttribute("filter");return b}else if(c<1.0E-5)c=0;f.filter=d(e)+"alpha(opacity="+c*100+")";return b};Element._attributeTranslations=function(){var b="className",c="for",d=document.createElement("div");d.setAttribute(b,"x");if(d.className!=="x"){d.setAttribute("class","x");if(d.className==="x")b="class"}d=null;d=document.createElement("label");d.setAttribute(c,"x");if(d.htmlFor!=="x"){d.setAttribute("htmlFor","x");if(d.htmlFor==="x")c="htmlFor"}d=null;
return{read:{names:{"class":b,className:b,"for":c,htmlFor:c},values:{_getAttr:function(e,f){return e.getAttribute(f)},_getAttr2:function(e,f){return e.getAttribute(f,2)},_getAttrNode:function(e,f){return(e=e.getAttributeNode(f))?e.value:""},_getEv:function(){var e=document.createElement("div");e.onclick=Prototype.emptyFunction;e=e.getAttribute("onclick");var f;if(String(e).indexOf("{")>-1)f=function(g,j){j=g.getAttribute(j);if(!j)return null;j=j.toString();j=j.split("{")[1];j=j.split("}")[0];return j.strip()};
else if(e==="")f=function(g,j){j=g.getAttribute(j);if(!j)return null;return j.strip()};e=null;return f}(),_flag:function(e,f){return $(e).hasAttribute(f)?f:null},style:function(e){return e.style.cssText.toLowerCase()},title:function(e){return e.title}}}}}();Element._attributeTranslations.write={names:Object.extend({cellpadding:"cellPadding",cellspacing:"cellSpacing"},Element._attributeTranslations.read.names),values:{checked:function(b,c){b.checked=!!c},style:function(b,c){b.style.cssText=c?c:""}}};
Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder").each(function(b){Element._attributeTranslations.write.names[b.toLowerCase()]=b;Element._attributeTranslations.has[b.toLowerCase()]=b});(function(b){Object.extend(b,{href:b._getAttr2,src:b._getAttr2,type:b._getAttr,action:b._getAttrNode,disabled:b._flag,checked:b._flag,readonly:b._flag,multiple:b._flag,onload:b._getEv,onunload:b._getEv,onclick:b._getEv,ondblclick:b._getEv,
onmousedown:b._getEv,onmouseup:b._getEv,onmouseover:b._getEv,onmousemove:b._getEv,onmouseout:b._getEv,onfocus:b._getEv,onblur:b._getEv,onkeypress:b._getEv,onkeydown:b._getEv,onkeyup:b._getEv,onsubmit:b._getEv,onreset:b._getEv,onselect:b._getEv,onchange:b._getEv})})(Element._attributeTranslations.read.values);Prototype.BrowserFeatures.ElementExtensions&&function(){function b(c){c=c.getElementsByTagName("*");for(var d=[],e=0,f;f=c[e];e++)f.tagName!=="!"&&d.push(f);return d}Element.Methods.down=function(c,
d,e){c=$(c);if(arguments.length==1)return c.firstDescendant();return Object.isNumber(d)?b(c)[d]:Element.select(c,d)[e||0]}}()}else if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent))Element.Methods.setOpacity=function(b,c){b=$(b);b.style.opacity=c==1?0.999999:c===""?"":c<1.0E-5?0:c;return b};else if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(b,c){b=$(b);b.style.opacity=c==1||c===""?"":c<1.0E-5?0:c;if(c==1)if(b.tagName.toUpperCase()=="IMG"&&b.width){b.width++;b.width--}else try{var d=
document.createTextNode(" ");b.appendChild(d);b.removeChild(d)}catch(e){}return b};Element.Methods.cumulativeOffset=function(b){var c=0,d=0;do{c+=b.offsetTop||0;d+=b.offsetLeft||0;if(b.offsetParent==document.body)if(Element.getStyle(b,"position")=="absolute")break;b=b.offsetParent}while(b);return Element._returnOffset(d,c)}}
if("outerHTML"in document.documentElement)Element.Methods.replace=function(b,c){b=$(b);if(c&&c.toElement)c=c.toElement();if(Object.isElement(c)){b.parentNode.replaceChild(c,b);return b}c=Object.toHTML(c);var d=b.parentNode,e=d.tagName.toUpperCase();if(Element._insertionTranslations.tags[e]){var f=b.next();e=Element._getContentFromAnonymousElement(e,c.stripScripts());d.removeChild(b);f?e.each(function(g){d.insertBefore(g,f)}):e.each(function(g){d.appendChild(g)})}else b.outerHTML=c.stripScripts();
c.evalScripts.bind(c).defer();return b};Element._returnOffset=function(b,c){var d=[b,c];d.left=b;d.top=c;return d};Element._getContentFromAnonymousElement=function(b,c){var d=new Element("div");if(b=Element._insertionTranslations.tags[b]){d.innerHTML=b[0]+c+b[1];b[2].times(function(){d=d.firstChild})}else d.innerHTML=c;return $A(d.childNodes)};
Element._insertionTranslations={before:function(b,c){b.parentNode.insertBefore(c,b)},top:function(b,c){b.insertBefore(c,b.firstChild)},bottom:function(b,c){b.appendChild(c)},after:function(b,c){b.parentNode.insertBefore(c,b.nextSibling)},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};
(function(){var b=Element._insertionTranslations.tags;Object.extend(b,{THEAD:b.TBODY,TFOOT:b.TBODY,TH:b.TD})})();Element.Methods.Simulated={hasAttribute:function(b,c){c=Element._attributeTranslations.has[c]||c;b=$(b).getAttributeNode(c);return!!(b&&b.specified)}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);
(function(b){if(!Prototype.BrowserFeatures.ElementExtensions&&b.__proto__){window.HTMLElement={};window.HTMLElement.prototype=b.__proto__;Prototype.BrowserFeatures.ElementExtensions=true}})(document.createElement("div"));
Element.extend=function(){function b(g){if(typeof window.Element!="undefined"){var j=window.Element.prototype;if(j){var h="_"+(Math.random()+"").slice(2);g=document.createElement(g);j[h]="x";g=g[h]!=="x";delete j[h];return g}}return false}function c(g,j){for(var h in j){var l=j[h];if(Object.isFunction(l)&&!(h in g))g[h]=l.methodize()}}var d=b("object");if(Prototype.BrowserFeatures.SpecificElementExtensions){if(d)return function(g){if(g&&typeof g._extendedByPrototype=="undefined"){var j=g.tagName;
if(j&&/^(?:object|applet|embed)$/i.test(j)){c(g,Element.Methods);c(g,Element.Methods.Simulated);c(g,Element.Methods.ByTag[j.toUpperCase()])}}return g};return Prototype.K}var e={},f=Element.Methods.ByTag;d=Object.extend(function(g){if(!g||typeof g._extendedByPrototype!="undefined"||g.nodeType!=1||g==window)return g;var j=Object.clone(e),h=g.tagName.toUpperCase();f[h]&&Object.extend(j,f[h]);c(g,j);g._extendedByPrototype=Prototype.emptyFunction;return g},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(e,
Element.Methods);Object.extend(e,Element.Methods.Simulated)}}});d.refresh();return d}();Element.hasAttribute=function(b,c){if(b.hasAttribute)return b.hasAttribute(c);return Element.Methods.Simulated.hasAttribute(b,c)};
Element.addMethods=function(b){function c(l){l=l.toUpperCase();Element.Methods.ByTag[l]||(Element.Methods.ByTag[l]={});Object.extend(Element.Methods.ByTag[l],b)}function d(l,r,v){v=v||false;for(var u in l){var y=l[u];if(Object.isFunction(y))if(!v||!(u in r))r[u]=y.methodize()}}function e(l){var r,v={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(v[l])r="HTML"+v[l]+"Element";if(window[r])return window[r];r="HTML"+l+"Element";if(window[r])return window[r];r="HTML"+l.capitalize()+"Element";if(window[r])return window[r];l=document.createElement(l);return l.__proto__||l.constructor.prototype}
var f=Prototype.BrowserFeatures,g=Element.Methods.ByTag;if(!b){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 j=b;b=arguments[1]}if(j)Object.isArray(j)?j.each(c):c(j);else Object.extend(Element.Methods,b||{});j=window.HTMLElement?HTMLElement.prototype:
Element.prototype;if(f.ElementExtensions){d(Element.Methods,j);d(Element.Methods.Simulated,j,true)}if(f.SpecificElementExtensions)for(var h in Element.Methods.ByTag){f=e(h);Object.isUndefined(f)||d(g[h],f.prototype)}Object.extend(Element,Element.Methods);delete Element.ByTag;Element.extend.refresh&&Element.extend.refresh();Element.cache={}};
document.viewport={getDimensions:function(){return{width:this.getWidth(),height:this.getHeight()}},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};
(function(b){function c(){if(e.WebKit&&!f.evaluate)return document;if(e.Opera&&window.parseFloat(window.opera.version())<9.5)return document.body;return document.documentElement}function d(h){g||(g=c());j[h]="client"+h;b["get"+h]=function(){return g[j[h]]};return b["get"+h]()}var e=Prototype.Browser,f=document,g,j={};b.getWidth=d.curry("Width");b.getHeight=d.curry("Height")})(document.viewport);Element.Storage={UID:1};
Element.addMethods({getStorage:function(b){if(b=$(b)){if(b===window)b=0;else{if(typeof b._prototypeUID==="undefined")b._prototypeUID=[Element.Storage.UID++];b=b._prototypeUID[0]}Element.Storage[b]||(Element.Storage[b]=$H());return Element.Storage[b]}},store:function(b,c,d){if(b=$(b)){arguments.length===2?Element.getStorage(b).update(c):Element.getStorage(b).set(c,d);return b}},retrieve:function(b,c,d){if(b=$(b)){b=Element.getStorage(b);var e=b.get(c);if(Object.isUndefined(e)){b.set(c,d);e=d}return e}},
clone:function(b,c){if(b=$(b)){b=b.cloneNode(c);b._prototypeUID=void 0;if(c){c=Element.select(b,"*");for(var d=c.length;d--;)c[d]._prototypeUID=void 0}return Element.extend(b)}}});
var Selector=Class.create({initialize:function(b){this.expression=b.strip();if(this.shouldUseSelectorsAPI())this.mode="selectorsAPI";else if(this.shouldUseXPath()){this.mode="xpath";this.compileXPathMatcher()}else{this.mode="normal";this.compileMatcher()}},shouldUseXPath:function(){var b=function(){var c=false;if(document.evaluate&&window.XPathResult){c=document.createElement("div");c.innerHTML="<ul><li></li></ul><div><ul><li></li></ul></div>";c=document.evaluate(".//*[local-name()='ul' or local-name()='UL']//*[local-name()='li' or local-name()='LI']",
c,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null).snapshotLength!==2}return c}();return function(){if(!Prototype.BrowserFeatures.XPath)return false;var c=this.expression;if(Prototype.Browser.WebKit&&(c.include("-of-type")||c.include(":empty")))return false;if(/(\[[\w-]*?:|:checked)/.test(c))return false;if(b)return false;return true}}(),shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI)return false;if(Selector.CASE_INSENSITIVE_CLASS_NAMES)return false;if(!Selector._div)Selector._div=
new Element("div");try{Selector._div.querySelector(this.expression)}catch(b){return false}return true},compileMatcher:function(){var b=this.expression,c=Selector.patterns,d=Selector.criteria,e,f,g=c.length,j;if(Selector._cache[b])this.matcher=Selector._cache[b];else{for(this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];b&&e!=b&&/\S/.test(b);){e=b;for(var h=0;h<g;h++){f=c[h].re;j=c[h].name;if(f=b.match(f)){this.matcher.push(Object.isFunction(d[j])?
d[j](f):(new Template(d[j])).evaluate(f));b=b.replace(f[0],"");break}}}this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join("\n"));Selector._cache[this.expression]=this.matcher}},compileXPathMatcher:function(){var b=this.expression,c=Selector.patterns,d=Selector.xpath,e,f,g=c.length,j;if(Selector._cache[b])this.xpath=Selector._cache[b];else{for(this.matcher=[".//*"];b&&e!=b&&/\S/.test(b);){e=b;for(var h=0;h<g;h++){j=c[h].name;if(f=b.match(c[h].re)){this.matcher.push(Object.isFunction(d[j])?
d[j](f):(new Template(d[j])).evaluate(f));b=b.replace(f[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath}},findElements:function(b){b=b||document;var c=this.expression;switch(this.mode){case "selectorsAPI":if(b!==document){var d=b.id,e=$(b).identify();e=e.replace(/([\.:])/g,"\\$1");c="#"+e+" "+c}c=$A(b.querySelectorAll(c)).map(Element.extend);b.id=d;return c;case "xpath":return document._getElementsByXPath(this.xpath,b);default:return this.matcher(b)}},match:function(b){this.tokens=
[];for(var c=this.expression,d=Selector.patterns,e=Selector.assertions,f,g,j=d.length,h;c&&f!==c&&/\S/.test(c);){f=c;for(var l=0;l<j;l++){g=d[l].re;h=d[l].name;if(g=c.match(g))if(e[h]){this.tokens.push([h,Object.clone(g)]);c=c.replace(g[0],"")}else return this.findElements(document).include(b)}}c=true;for(l=0;d=this.tokens[l];l++){h=d[0];d=d[1];if(!Selector.assertions[h](b,d)){c=false;break}}return c},toString:function(){return this.expression},inspect:function(){return"#<Selector:"+this.expression.inspect()+
">"}});if(Prototype.BrowserFeatures.SelectorsAPI&&document.compatMode==="BackCompat")Selector.CASE_INSENSITIVE_CLASS_NAMES=function(){var b=document.createElement("div"),c=document.createElement("span");b.id="prototype_test_id";c.className="Test";b.appendChild(c);return b.querySelector("#prototype_test_id .test")!==null}();
Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(b){if(b[1]=="*")return"";return"[local-name()='"+b[1].toLowerCase()+"' or local-name()='"+b[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(b){b[1]=b[1].toLowerCase();return(new Template("[@#{1}]")).evaluate(b)},attr:function(b){b[1]=b[1].toLowerCase();b[3]=b[5]||b[6];
return(new Template(Selector.xpath.operators[b[2]])).evaluate(b)},pseudo:function(b){var c=Selector.xpath.pseudos[b[1]];if(!c)return"";if(Object.isFunction(c))return c(b);return(new Template(Selector.xpath.pseudos[b[1]])).evaluate(b)},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},
pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","only-child":"[not(preceding-sibling::* or following-sibling::*)]",empty:"[count(*) = 0 and (count(text()) = 0)]",checked:"[@checked]",disabled:"[(@disabled) and (@type!='hidden')]",enabled:"[not(@disabled) and (@type!='hidden')]",not:function(b){for(var c=b[6],d=Selector.patterns,e=Selector.xpath,f,g,j=d.length,h=[];c&&f!=c&&/\S/.test(c);){f=c;for(var l=0;l<j;l++){g=d[l].name;if(b=c.match(d[l].re)){g=
Object.isFunction(e[g])?e[g](b):(new Template(e[g])).evaluate(b);h.push("("+g.substring(1,g.length-1)+")");c=c.replace(b[0],"");break}}}return"[not("+h.join(" and ")+")]"},"nth-child":function(b){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",b)},"nth-last-child":function(b){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",b)},"nth-of-type":function(b){return Selector.xpath.pseudos.nth("position() ",b)},"nth-last-of-type":function(b){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",
b)},"first-of-type":function(b){b[6]="1";return Selector.xpath.pseudos["nth-of-type"](b)},"last-of-type":function(b){b[6]="1";return Selector.xpath.pseudos["nth-last-of-type"](b)},"only-of-type":function(b){var c=Selector.xpath.pseudos;return c["first-of-type"](b)+c["last-of-type"](b)},nth:function(b,c){var d=c[6];if(d=="even")d="2n+0";if(d=="odd")d="2n+1";if(c=d.match(/^(\d+)$/))return"["+b+"= "+c[1]+"]";if(c=d.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(c[1]=="-")c[1]=-1;d=c[1]?Number(c[1]):1;c=c[2]?
Number(c[2]):0;return(new Template("[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]")).evaluate({fragment:b,a:d,b:c})}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);      c = false;',className:'n = h.className(n, r, "#{1}", c);    c = false;',id:'n = h.id(n, r, "#{1}", c);           c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(b){b[3]=b[5]||b[6];return(new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;')).evaluate(b)},
pseudo:function(b){if(b[6])b[6]=b[6].replace(/"/g,'\\"');return(new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;')).evaluate(b)},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:[{name:"laterSibling",re:/^\s*~\s*/},{name:"child",re:/^\s*>\s*/},{name:"adjacent",re:/^\s*\+\s*/},{name:"descendant",re:/^\s/},{name:"tagName",re:/^\s*(\*|[\w\-]+)(\b|$)?/},{name:"id",re:/^#([\w\-\*]+)(\b|$)/},{name:"className",re:/^\.([\w\-\*]+)(\b|$)/},
{name:"pseudo",re:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/},{name:"attrPresence",re:/^\[((?:[\w-]+:)?[\w-]+)\]/},{name:"attr",re:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/}],assertions:{tagName:function(b,c){return c[1].toUpperCase()==b.tagName.toUpperCase()},className:function(b,c){return Element.hasClassName(b,c[1])},id:function(b,c){return b.id===c[1]},attrPresence:function(b,c){return Element.hasAttribute(b,
c[1])},attr:function(b,c){return(b=Element.readAttribute(b,c[1]))&&Selector.operators[c[2]](b,c[5]||c[6])}},handlers:{concat:function(b,c){for(var d=0,e;e=c[d];d++)b.push(e);return b},mark:function(b){for(var c=Prototype.emptyFunction,d=0,e;e=b[d];d++)e._countedByPrototype=c;return b},unmark:function(){return function(){var b=document.createElement("div"),c=false;b._countedByPrototype="x";return c=b.getAttribute("_countedByPrototype")==="x"}()?function(b){for(var c=0,d;d=b[c];c++)d.removeAttribute("_countedByPrototype");
return b}:function(b){for(var c=0,d;d=b[c];c++)d._countedByPrototype=void 0;return b}}(),index:function(b,c,d){b._countedByPrototype=Prototype.emptyFunction;if(c){b=b.childNodes;c=b.length-1;for(var e=1;c>=0;c--){var f=b[c];if(f.nodeType==1&&(!d||f._countedByPrototype))f.nodeIndex=e++}}else{c=0;e=1;for(b=b.childNodes;f=b[c];c++)if(f.nodeType==1&&(!d||f._countedByPrototype))f.nodeIndex=e++}},unique:function(b){if(b.length==0)return b;for(var c=[],d,e=0,f=b.length;e<f;e++)if(typeof(d=b[e])._countedByPrototype==
"undefined"){d._countedByPrototype=Prototype.emptyFunction;c.push(Element.extend(d))}return Selector.handlers.unmark(c)},descendant:function(b){for(var c=Selector.handlers,d=0,e=[],f;f=b[d];d++)c.concat(e,f.getElementsByTagName("*"));return e},child:function(b){for(var c=0,d=[],e;e=b[c];c++)for(var f=0,g;g=e.childNodes[f];f++)g.nodeType==1&&g.tagName!="!"&&d.push(g);return d},adjacent:function(b){for(var c=0,d=[],e;e=b[c];c++)(e=this.nextElementSibling(e))&&d.push(e);return d},laterSibling:function(b){for(var c=
Selector.handlers,d=0,e=[],f;f=b[d];d++)c.concat(e,Element.nextSiblings(f));return e},nextElementSibling:function(b){for(;b=b.nextSibling;)if(b.nodeType==1)return b;return null},previousElementSibling:function(b){for(;b=b.previousSibling;)if(b.nodeType==1)return b;return null},tagName:function(b,c,d,e){var f=d.toUpperCase(),g=[],j=Selector.handlers;if(b){if(e){if(e=="descendant"){for(c=0;e=b[c];c++)j.concat(g,e.getElementsByTagName(d));return g}else b=this[e](b);if(d=="*")return b}for(c=0;e=b[c];c++)e.tagName.toUpperCase()===
f&&g.push(e);return g}else return c.getElementsByTagName(d)},id:function(b,c,d,e){var f=$(d),g=Selector.handlers;if(c==document){if(!f)return[];if(!b)return[f]}else if(!c.sourceIndex||c.sourceIndex<1){b=c.getElementsByTagName("*");for(var j=0,h;h=b[j];j++)if(h.id===d)return[h]}if(b){if(e)if(e=="child")for(c=0;h=b[c];c++){if(f.parentNode==h)return[f]}else if(e=="descendant")for(c=0;h=b[c];c++){if(Element.descendantOf(f,h))return[f]}else if(e=="adjacent")for(c=0;h=b[c];c++){if(Selector.handlers.previousElementSibling(f)==
h)return[f]}else b=g[e](b);for(c=0;h=b[c];c++)if(h==f)return[f];return[]}return f&&Element.descendantOf(f,c)?[f]:[]},className:function(b,c,d,e){if(b&&e)b=this[e](b);return Selector.handlers.byClassName(b,c,d)},byClassName:function(b,c,d){b||(b=Selector.handlers.descendant([c]));c=" "+d+" ";for(var e=0,f=[],g,j;g=b[e];e++){j=g.className;if(j.length!=0)if(j==d||(" "+j+" ").include(c))f.push(g)}return f},attrPresence:function(b,c,d,e){b||(b=c.getElementsByTagName("*"));if(b&&e)b=this[e](b);c=[];e=0;
for(var f;f=b[e];e++)Element.hasAttribute(f,d)&&c.push(f);return c},attr:function(b,c,d,e,f,g){b||(b=c.getElementsByTagName("*"));if(b&&g)b=this[g](b);c=Selector.operators[f];f=[];g=0;for(var j;j=b[g];g++){var h=Element.readAttribute(j,d);h!==null&&c(h,e)&&f.push(j)}return f},pseudo:function(b,c,d,e,f){if(b&&f)b=this[f](b);b||(b=e.getElementsByTagName("*"));return Selector.pseudos[c](b,d,e)}},pseudos:{"first-child":function(b){for(var c=0,d=[],e;e=b[c];c++)Selector.handlers.previousElementSibling(e)||
d.push(e);return d},"last-child":function(b){for(var c=0,d=[],e;e=b[c];c++)Selector.handlers.nextElementSibling(e)||d.push(e);return d},"only-child":function(b){for(var c=Selector.handlers,d=0,e=[],f;f=b[d];d++)!c.previousElementSibling(f)&&!c.nextElementSibling(f)&&e.push(f);return e},"nth-child":function(b,c,d){return Selector.pseudos.nth(b,c,d)},"nth-last-child":function(b,c,d){return Selector.pseudos.nth(b,c,d,true)},"nth-of-type":function(b,c,d){return Selector.pseudos.nth(b,c,d,false,true)},
"nth-last-of-type":function(b,c,d){return Selector.pseudos.nth(b,c,d,true,true)},"first-of-type":function(b,c,d){return Selector.pseudos.nth(b,"1",d,false,true)},"last-of-type":function(b,c,d){return Selector.pseudos.nth(b,"1",d,true,true)},"only-of-type":function(b,c,d){var e=Selector.pseudos;return e["last-of-type"](e["first-of-type"](b,c,d),c,d)},getIndices:function(b,c,d){if(b==0)return c>0?[c]:[];return $R(1,d).inject([],function(e,f){0==(f-c)%b&&(f-c)/b>=0&&e.push(f);return e})},nth:function(b,
c,d,e,f){if(b.length==0)return[];if(c=="even")c="2n+0";if(c=="odd")c="2n+1";d=Selector.handlers;var g=[],j=[],h;d.mark(b);for(var l=0;h=b[l];l++)if(!h.parentNode._countedByPrototype){d.index(h.parentNode,e,f);j.push(h.parentNode)}if(c.match(/^\d+$/)){c=Number(c);for(l=0;h=b[l];l++)h.nodeIndex==c&&g.push(h)}else if(h=c.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(h[1]=="-")h[1]=-1;l=h[1]?Number(h[1]):1;h=h[2]?Number(h[2]):0;c=Selector.pseudos.getIndices(l,h,b.length);l=0;for(e=c.length;h=b[l];l++)for(f=0;f<
e;f++)h.nodeIndex==c[f]&&g.push(h)}d.unmark(b);d.unmark(j);return g},empty:function(b){for(var c=0,d=[],e;e=b[c];c++)e.tagName=="!"||e.firstChild||d.push(e);return d},not:function(b,c,d){var e=Selector.handlers;c=(new Selector(c)).findElements(d);e.mark(c);d=0;for(var f=[],g;g=b[d];d++)g._countedByPrototype||f.push(g);e.unmark(c);return f},enabled:function(b){for(var c=0,d=[],e;e=b[c];c++)if(!e.disabled&&(!e.type||e.type!=="hidden"))d.push(e);return d},disabled:function(b){for(var c=0,d=[],e;e=b[c];c++)e.disabled&&
d.push(e);return d},checked:function(b){for(var c=0,d=[],e;e=b[c];c++)e.checked&&d.push(e);return d}},operators:{"=":function(b,c){return b==c},"!=":function(b,c){return b!=c},"^=":function(b,c){return b==c||b&&b.startsWith(c)},"$=":function(b,c){return b==c||b&&b.endsWith(c)},"*=":function(b,c){return b==c||b&&b.include(c)},"~=":function(b,c){return(" "+b+" ").include(" "+c+" ")},"|=":function(b,c){return("-"+(b||"").toUpperCase()+"-").include("-"+(c||"").toUpperCase()+"-")}},split:function(b){var c=
[];b.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(d){c.push(d[1].strip())});return c},matchElements:function(b,c){c=$$(c);var d=Selector.handlers;d.mark(c);for(var e=0,f=[],g;g=b[e];e++)g._countedByPrototype&&f.push(g);d.unmark(c);return f},findElement:function(b,c,d){if(Object.isNumber(c)){d=c;c=false}return Selector.matchElements(b,c||"*")[d||0]},findChildElements:function(b,c){c=Selector.split(c.join(","));for(var d=[],e=Selector.handlers,f=0,g=c.length,j;f<g;f++){j=new Selector(c[f].strip());
e.concat(d,j.findElements(b))}return g>1?e.unique(d):d}});Prototype.Browser.IE&&Object.extend(Selector.handlers,{concat:function(b,c){for(var d=0,e;e=c[d];d++)e.tagName!=="!"&&b.push(e);return b}});function $$(){return Selector.findChildElements(document,$A(arguments))}
var Form={reset:function(b){b=$(b);b.reset();return b},serializeElements:function(b,c){if(typeof c!="object")c={hash:!!c};else if(Object.isUndefined(c.hash))c.hash=true;var d,e,f=false,g=c.submit;b=b.inject({},function(j,h){if(!h.disabled&&h.name){d=h.name;e=$(h).getValue();if(e!=null&&h.type!="file"&&(h.type!="submit"||!f&&g!==false&&(!g||d==g)&&(f=true)))if(d in j){Object.isArray(j[d])||(j[d]=[j[d]]);j[d].push(e)}else j[d]=e}return j});return c.hash?b:Object.toQueryString(b)}};
Form.Methods={serialize:function(b,c){return Form.serializeElements(Form.getElements(b),c)},getElements:function(b){b=$(b).getElementsByTagName("*");for(var c,d=[],e=Form.Element.Serializers,f=0;c=b[f];f++)d.push(c);return d.inject([],function(g,j){e[j.tagName.toLowerCase()]&&g.push(Element.extend(j));return g})},getInputs:function(b,c,d){b=$(b);b=b.getElementsByTagName("input");if(!c&&!d)return $A(b).map(Element.extend);for(var e=0,f=[],g=b.length;e<g;e++){var j=b[e];c&&j.type!=c||d&&j.name!=d||
f.push(Element.extend(j))}return f},disable:function(b){b=$(b);Form.getElements(b).invoke("disable");return b},enable:function(b){b=$(b);Form.getElements(b).invoke("enable");return b},findFirstElement:function(b){b=$(b).getElements().findAll(function(d){return"hidden"!=d.type&&!d.disabled});var c=b.findAll(function(d){return d.hasAttribute("tabIndex")&&d.tabIndex>=0}).sortBy(function(d){return d.tabIndex}).first();return c?c:b.find(function(d){return/^(?:input|select|textarea)$/i.test(d.tagName)})},
focusFirstElement:function(b){b=$(b);b.findFirstElement().activate();return b},request:function(b,c){b=$(b);c=Object.clone(c||{});var d=c.parameters,e=b.readAttribute("action")||"";if(e.blank())e=window.location.href;c.parameters=b.serialize(true);if(d){if(Object.isString(d))d=d.toQueryParams();Object.extend(c.parameters,d)}if(b.hasAttribute("method")&&!c.method)c.method=b.method;return new Ajax.Request(e,c)}};
Form.Element={focus:function(b){$(b).focus();return b},select:function(b){$(b).select();return b}};
Form.Element.Methods={serialize:function(b){b=$(b);if(!b.disabled&&b.name){var c=b.getValue();if(c!=undefined){var d={};d[b.name]=c;return Object.toQueryString(d)}}return""},getValue:function(b){b=$(b);var c=b.tagName.toLowerCase();return Form.Element.Serializers[c](b)},setValue:function(b,c){b=$(b);var d=b.tagName.toLowerCase();Form.Element.Serializers[d](b,c);return b},clear:function(b){$(b).value="";return b},present:function(b){return $(b).value!=""},activate:function(b){b=$(b);try{b.focus();
if(b.select&&(b.tagName.toLowerCase()!="input"||!/^(?:button|reset|submit)$/i.test(b.type)))b.select()}catch(c){}return b},disable:function(b){b=$(b);b.disabled=true;return b},enable:function(b){b=$(b);b.disabled=false;return b}};var Field=Form.Element,$F=Form.Element.Methods.getValue;
Form.Element.Serializers={input:function(b,c){switch(b.type.toLowerCase()){case "checkbox":case "radio":return Form.Element.Serializers.inputSelector(b,c);default:return Form.Element.Serializers.textarea(b,c)}},inputSelector:function(b,c){if(Object.isUndefined(c))return b.checked?b.value:null;else b.checked=!!c},textarea:function(b,c){if(Object.isUndefined(c))return b.value;else b.value=c},select:function(b,c){if(Object.isUndefined(c))return this[b.type=="select-one"?"selectOne":"selectMany"](b);
else for(var d,e,f=!Object.isArray(c),g=0,j=b.length;g<j;g++){d=b.options[g];e=this.optionValue(d);if(f){if(e==c){d.selected=true;return}}else d.selected=c.include(e)}},selectOne:function(b){var c=b.selectedIndex;return c>=0?this.optionValue(b.options[c]):null},selectMany:function(b){var c,d=b.length;if(!d)return null;var e=0;for(c=[];e<d;e++){var f=b.options[e];f.selected&&c.push(this.optionValue(f))}return c},optionValue:function(b){return Element.extend(b).hasAttribute("value")?b.value:b.text}};
Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,c,d,e){$super(e,d);this.element=$(c);this.lastValue=this.getValue()},execute:function(){var b=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(b)?this.lastValue!=b:String(this.lastValue)!=String(b)){this.callback(this.element,b);this.lastValue=b}}});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(b,c){this.element=$(b);this.callback=c;this.lastValue=this.getValue();this.element.tagName.toLowerCase()=="form"?this.registerFormCallbacks():this.registerCallback(this.element)},onElementEvent:function(){var b=this.getValue();if(this.lastValue!=b){this.callback(this.element,b);this.lastValue=b}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)},registerCallback:function(b){if(b.type)switch(b.type.toLowerCase()){case "checkbox":case "radio":Event.observe(b,
"click",this.onElementEvent.bind(this));break;default:Event.observe(b,"change",this.onElementEvent.bind(this));break}}});Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)}});
(function(){function b(i){return t(i,0)}function c(i){return t(i,1)}function d(i){return t(i,2)}function e(i){i=A.extend(i);var k=i.target,m=i.type;if((i=i.currentTarget)&&i.tagName)if(m==="load"||m==="error"||m==="click"&&i.tagName.toLowerCase()==="input"&&i.type==="radio")k=i;if(k.nodeType==Node.TEXT_NODE)k=k.parentNode;return Element.extend(k)}function f(i,k){i=A.element(i);if(!k)return i;i=[i].concat(i.ancestors());return Selector.findElement(i,k,0)}function g(i){return{x:j(i),y:h(i)}}function j(i){var k=
document.documentElement,m=document.body||{scrollLeft:0};return i.pageX||i.clientX+(k.scrollLeft||m.scrollLeft)-(k.clientLeft||0)}function h(i){var k=document.documentElement,m=document.body||{scrollTop:0};return i.pageY||i.clientY+(k.scrollTop||m.scrollTop)-(k.clientTop||0)}function l(i){A.extend(i);i.preventDefault();i.stopPropagation();i.stopped=true}function r(i,k,m){var z=Element.retrieve(i,"prototype_event_registry");if(Object.isUndefined(z)){s.push(i);z=Element.retrieve(i,"prototype_event_registry",
$H())}var D=z.get(k);if(Object.isUndefined(D)){D=[];z.set(k,D)}if(D.pluck("handler").include(m))return false;var H;if(k.include(":"))H=function(I){if(Object.isUndefined(I.eventName))return false;if(I.eventName!==k)return false;A.extend(I,i);m.call(i,I)};else if(!o&&(k==="mouseenter"||k==="mouseleave")){if(k==="mouseenter"||k==="mouseleave")H=function(I){A.extend(I,i);for(var J=I.relatedTarget;J&&J!==i;)try{J=J.parentNode}catch(x){J=i}J!==i&&m.call(i,I)}}else H=function(I){A.extend(I,i);m.call(i,I)};
H.handler=m;D.push(H);return H}function v(){for(var i=0,k=s.length;i<k;i++){A.stopObserving(s[i]);s[i]=null}}function u(i,k,m){i=$(i);m=r(i,k,m);if(!m)return i;if(k.include(":"))if(i.addEventListener)i.addEventListener("dataavailable",m,false);else{i.attachEvent("ondataavailable",m);i.attachEvent("onfilterchange",m)}else{k=n(k);i.addEventListener?i.addEventListener(k,m,false):i.attachEvent("on"+k,m)}return i}function y(i,k,m){i=$(i);var z=Element.retrieve(i,"prototype_event_registry");if(Object.isUndefined(z))return i;
if(k&&!m){var D=z.get(k);if(Object.isUndefined(D))return i;D.each(function(J){Element.stopObserving(i,k,J.handler)});return i}else if(!k){z.each(function(J){var x=J.key;J.value.each(function(B){Element.stopObserving(i,x,B.handler)})});return i}if(D=z.get(k)){var H=D.find(function(J){return J.handler===m});if(!H)return i;var I=n(k);if(k.include(":"))if(i.removeEventListener)i.removeEventListener("dataavailable",H,false);else{i.detachEvent("ondataavailable",H);i.detachEvent("onfilterchange",H)}else i.removeEventListener?
i.removeEventListener(I,H,false):i.detachEvent("on"+I,H);z.set(k,D.without(H));return i}}function C(i,k,m,z){i=$(i);if(Object.isUndefined(z))z=true;if(i==document&&document.createEvent&&!i.dispatchEvent)i=document.documentElement;var D;if(document.createEvent){D=document.createEvent("HTMLEvents");D.initEvent("dataavailable",true,true)}else{D=document.createEventObject();D.eventType=z?"ondataavailable":"onfilterchange"}D.eventName=k;D.memo=m||{};document.createEvent?i.dispatchEvent(D):i.fireEvent(D.eventType,
D);return A.extend(D)}var A={KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,cache:{}},G=document.documentElement,o="onmouseenter"in G&&"onmouseleave"in G,t;if(Prototype.Browser.IE){var p={0:1,1:4,2:2};t=function(i,k){return i.button===p[k]}}else t=Prototype.Browser.WebKit?function(i,k){switch(k){case 0:return i.which==1&&!i.metaKey;case 1:return i.which==1&&i.metaKey;
default:return false}}:function(i,k){return i.which?i.which===k+1:i.button===k};A.Methods={isLeftClick:b,isMiddleClick:c,isRightClick:d,element:e,findElement:f,pointer:g,pointerX:j,pointerY:h,stop:l};var w=Object.keys(A.Methods).inject({},function(i,k){i[k]=A.Methods[k].methodize();return i});if(Prototype.Browser.IE){function q(i){switch(i.type){case "mouseover":i=i.fromElement;break;case "mouseout":i=i.toElement;break;default:return null}return Element.extend(i)}Object.extend(w,{stopPropagation:function(){this.cancelBubble=
true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});A.extend=function(i,k){if(!i)return false;if(i._extendedByPrototype)return i;i._extendedByPrototype=Prototype.emptyFunction;var m=A.pointer(i);Object.extend(i,{target:i.srcElement||k,relatedTarget:q(i),pageX:m.x,pageY:m.y});return Object.extend(i,w)}}else{A.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(A.prototype,w);A.extend=Prototype.K}var s=[];Prototype.Browser.IE&&
window.attachEvent("onunload",v);Prototype.Browser.WebKit&&window.addEventListener("unload",Prototype.emptyFunction,false);var n=Prototype.K;o||(n=function(i){var k={mouseenter:"mouseover",mouseleave:"mouseout"};return i in k?k[i]:i});Object.extend(A,A.Methods);Object.extend(A,{fire:C,observe:u,stopObserving:y});Element.addMethods({fire:C,observe:u,stopObserving:y});Object.extend(document,{fire:C.methodize(),observe:u.methodize(),stopObserving:y.methodize(),loaded:false});if(window.Event)Object.extend(window.Event,
A);else window.Event=A})();
(function(){function b(){if(!document.loaded){e&&window.clearTimeout(e);document.loaded=true;document.fire("dom:loaded")}}function c(){if(document.readyState==="complete"){document.stopObserving("readystatechange",c);b()}}function d(){try{document.documentElement.doScroll("left")}catch(f){e=d.defer();return}b()}var e;if(document.addEventListener)document.addEventListener("DOMContentLoaded",b,false);else{document.observe("readystatechange",c);if(window==top)e=d.defer()}Event.observe(window,"load",
b)})();Element.addMethods();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;
var Insertion={Before:function(b,c){return Element.insert(b,{before:c})},Top:function(b,c){return Element.insert(b,{top:c})},Bottom:function(b,c){return Element.insert(b,{bottom:c})},After:function(b,c){return Element.insert(b,{after:c})}},$continue=new Error('"throw $continue" is deprecated, use "return" instead'),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,c,d){if(this.includeScrollOffsets)return this.withinIncludingScrolloffsets(b,c,d);this.xcomp=c;this.ycomp=d;this.offset=Element.cumulativeOffset(b);return d>=this.offset[1]&&d<this.offset[1]+b.offsetHeight&&c>=this.offset[0]&&c<this.offset[0]+b.offsetWidth},withinIncludingScrolloffsets:function(b,c,d){var e=Element.cumulativeScrollOffset(b);this.xcomp=c+e[0]-this.deltaX;this.ycomp=d+e[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,c){if(!b)return 0;if(b=="vertical")return(this.offset[1]+c.offsetHeight-this.ycomp)/c.offsetHeight;if(b=="horizontal")return(this.offset[0]+c.offsetWidth-this.xcomp)/c.offsetWidth},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(b){Position.prepare();return Element.absolutize(b)},
relativize:function(b){Position.prepare();return Element.relativize(b)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(b,c,d){d=d||{};return Element.clonePosition(c,b,d)}};
if(!document.getElementsByClassName)document.getElementsByClassName=function(b){function c(d){return d.blank()?null:"[contains(concat(' ', @class, ' '), ' "+d+" ')]"}b.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(d,e){e=e.toString().strip();return(e=/\s/.test(e)?$w(e).map(c).join(""):c(e))?document._getElementsByXPath(".//*"+e,d):[]}:function(d,e){e=e.toString().strip();var f=[],g=/\s/.test(e)?$w(e):null;if(!g&&!e)return f;d=$(d).getElementsByTagName("*");e=" "+e+" ";for(var j=
0,h,l;h=d[j];j++)if(h.className&&(l=" "+h.className+" ")&&(l.include(e)||g&&g.all(function(r){return!r.toString().blank()&&l.include(" "+r+" ")})))f.push(Element.extend(h));return f};return function(d,e){return $(e||document.body).getElementsByClassName(d)}}(Element.Methods);Element.ClassNames=Class.create();
Element.ClassNames.prototype={initialize:function(b){this.element=$(b)},_each:function(b){this.element.className.split(/\s+/).select(function(c){return c.length>0})._each(b)},set:function(b){this.element.className=b},add:function(b){this.include(b)||this.set($A(this).concat(b).join(" "))},remove:function(b){this.include(b)&&this.set($A(this).without(b).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);function toggleDisp(){for(var b=0;b<arguments.length;b++){var c=$(arguments[b]);c.style.display=c.style.display=="none"?"block":"none"}}function toggleTab(b,c,d){if($("tabContent"+b).style.display=="none"){for(var e=1;e<=c;e++)if(d==null||d!=e){var f="tabHeader"+e,g=$(f);if(!g){g=$("tabHeaderActive");g.id=f}f="tabContent"+e;g=$(f);g.style.display!="none"&&toggleDisp(f)}if(g=$("tabHeader"+b))g.id="tabHeaderActive";g.blur();g=$("tabContent"+b);g.style.marginTop="2px";toggleDisp("tabContent"+b)}};function LabeledMarker(b,c){this.opts_=c;this.labelText_=c.labelText||"";this.labelClass_=c.labelClass||"LabeledMarker_markerLabel";this.labelOffset_=c.labelOffset||new GSize(0,0);this.clickable_=c.clickable==false?false:true;this.title_=c.title||"";this.ownVisibility_=this.labelVisibility_=true;if(c.draggable)c.draggable=false;GMarker.apply(this,arguments)}LabeledMarker.prototype=new GMarker(new GLatLng(0,0));a=LabeledMarker.prototype;
a.initialize=function(b){GMarker.prototype.initialize.apply(this,arguments);this.map_=b;this.div_=document.createElement("div");this.div_.className=this.labelClass_;this.div_.innerHTML=this.labelText_;this.div_.style.position="absolute";if(this.clickable_)this.div_.style.cursor="pointer";this.div_.title=this.title_;this.ownVisibility_||this.hide();this.applyLabelVisibility_();b.getPane(G_MAP_MARKER_PANE).appendChild(this.div_);if(this.clickable_)for(var c=["click","dblclick","mousedown","mouseup",
"mouseover","mouseout"],d=0;d<c.length;d++){var e=c[d];GEvent.addDomListener(this.div_,e,GEvent.callback(GEvent,GEvent.trigger,this,e,this.getLatLng()))}};a.redraw=function(){GMarker.prototype.redraw.apply(this,arguments);this.redrawLabel_()};
a.redrawLabel_=function(){if(this.map_){var b=this.map_.fromLatLngToDivPixel(this.getLatLng()),c=GOverlay.getZIndex(this.getLatLng().lat());if(this.div_){this.div_.style.left=b.x+this.labelOffset_.width+"px";this.div_.style.top=b.y+this.labelOffset_.height+"px";this.div_.style.zIndex=c}}};
a.remove=function(){GEvent.clearInstanceListeners(this.div_);if(this.div_.outerHTML)this.div_.outerHTML="";this.div_.parentNode&&this.div_.parentNode.removeChild(this.div_);this.div_=null;GMarker.prototype.remove.apply(this,arguments)};a.copy=function(){var b=new LabeledMarker(this.getLatLng(),this.opts_);b.labelVisibility_=this.labelVisibility_;b.ownVisibility_=this.ownVisibility_;return b};a.show=function(){GMarker.prototype.show.apply(this,arguments);this.ownVisibility_=true;this.applyLabelVisibility_()};
a.hide=function(){GMarker.prototype.hide.apply(this,arguments);this.ownVisibility_=false;this.applyLabelVisibility_()};a.setLabelVisibility=function(b){this.labelVisibility_=b;this.applyLabelVisibility_()};a.getLabelVisibility=function(){return this.labelVisibility_};a.applyLabelVisibility_=function(){if(this.div_)this.div_.style.display=!this.isHidden()&&this.labelVisibility_?"block":"none"};a.setLabelText=function(b){this.labelText_=b;if(this.div_)this.div_.innerHTML=b;this.opts_.labelText=b};function MarkerClusterer(b,c,d){function e(){if(C.length!==0){var p=[];t=0;for(len=C.length;t<len;t++)f(C[t])?r.addMarker(C[t],true,null,null,true):p.push(C[t]);C=p}}function f(p){return h.getBounds().containsLatLng(p.getLatLng())}function g(p){for(var w=[],q=p.length-1;q>=0;--q)r.addMarker(p[q].marker,true,p[q].isAdded,w,true);e()}var j=[],h=b,l=null,r=this,v=60,u=[53,56,66,78,90],y=[],C=[];u=null;var A=true;if(ClusterMarker_.instanceOfGOverlay!==true){u=ClusterMarker_.prototype;ClusterMarker_.prototype=
new GOverlay;for(var G in u)ClusterMarker_.prototype[G]=u[G];ClusterMarker_.instanceOfGOverlay=true}var o=function(p){var w=0;for(var q=p=p.length;q!==0;){q=parseInt(q/10,10);w++}q=this.getStyles().length;if(q<w)w=q;return{text:p,index:w}},t=0;for(t=1;t<=5;t++)y.push({url:iconUrl+"icones/cluster/cluster.png",height:65,width:66});if(typeof d==="object"&&d!==null){if(typeof d.gridSize==="number"&&d.gridSize>0)v=d.gridSize;if(typeof d.maxZoom==="number")l=d.maxZoom;if(typeof d.styles==="object"&&d.styles!==
null&&d.styles.length!==0)y=d.styles;if(typeof d.calculator==="function")o=d.calculator;if(typeof d.zoomOnClick==="boolean")A=d.zoomOnClick}this.setCalculator=function(p){o=p};this.getCalculator=function(){return GEvent.callback(this,o)};this.isZoomOnClick=function(){return A};this.getStyles=function(){return y};this.clearMarkers=function(){for(var p=0,w=j.length;p<w;p++)typeof j[p]!=="undefined"&&j[p]!==null&&j[p].clearMarkers();j=[];C=[]};this.addMarker=function(p,w,q,s,n){if(n!==true)if(!f(p)){C.push(p);
return}q=q;s=s;n=h.fromLatLngToDivPixel(p.getLatLng());if(typeof q!=="boolean")q=false;if(typeof s!=="object"||s===null)s=j;for(var i=null,k=s.length-1;k>=0;k--){i=s[k];var m=i.getCenter();if(m!==null){m=h.fromLatLngToDivPixel(m);if(n.x>=m.x-v&&n.x<=m.x+v&&n.y>=m.y-v&&n.y<=m.y+v){i.addMarker({isAdded:q,marker:p});w||i.redraw_();return}}}i=new Cluster(this,b);i.addMarker({isAdded:q,marker:p});w||i.redraw_();s.push(i);s!==j&&j.push(i)};this.removeMarker=function(p){for(var w=0,q=C.length;w<q;w++)if(p===
C[w]){C.splice(w,1);return}w=0;for(q=j.length;w<q;w++)if(j[w]&&j[w].removeMarker(p)){if(j[w].getTotalMarkers()==0){j[w].clearMarkers();j.splice(w,1)}else j[w].redraw_();return}};this.redraw_=function(){for(var p=this.getClustersInViewport_(),w=0,q=p.length;w<q;w++)p[w].redraw_(true)};this.getClustersInViewport_=function(){for(var p=[],w=h.getBounds(),q=0,s=j.length;q<s;q++)j[q].isInBounds(w)&&p.push(j[q]);return p};this.getNumMarkersInViewport=function(){for(var p=this.getClustersInViewport_(),w=
0,q=0,s=p.length;q<s;q++)w+=p[q].getTotalMarkers();return w};this.isClustered=function(p){for(var w=this.getClustersInViewport_(),q=0,s=w.length;q<s;q++)if(w[q].isClustered(p))return true;return false};this.getMaxZoom_=function(){return l};this.getMap_=function(){return h};this.getGridSize_=function(){return v};this.getTotalMarkers=function(){for(var p=0,w=0,q=j.length;w<q;w++)p+=j[w].getTotalMarkers();return p};this.getTotalClusters=function(){return j.length};this.resetViewport=function(){for(var p=
this.getClustersInViewport_(),w=[],q=0,s=0,n=p.length;s<n;s++){var i=p[s],k=i.getCurrentZoom();if(k!==null)if(h.getZoom()!==k){k=i.getMarkers();for(var m=0,z=k.length;m<z;++m)w.push({isAdded:false,marker:k[m].marker});i.clearMarkers();q++;m=0;for(z=j.length;m<z;++m)i===j[m]&&j.splice(m,1)}}g(w);this.redraw_();GEvent.trigger(this,"regroup")};this.addMarkers=function(p){for(var w=0,q=p.length;w<q;w++)this.addMarker(p[w],true);this.redraw_()};this.getParentCluster=function(p){return p.parentCluster_};
typeof c==="object"&&c!==null&&this.addMarkers(c);u=GEvent.addListener(h,"moveend",function(){r.resetViewport()})}
function Cluster(b){var c=null,d=[],e=b.getMap_(),f=null,g=e.getZoom(),j=this;this.getMarkers=function(){return d};this.getMarkerClusterer=function(){return b};this.isInBounds=function(h){if(c===null)return false;h||(h=e.getBounds());var l=e.fromLatLngToDivPixel(h.getSouthWest());h=e.fromLatLngToDivPixel(h.getNorthEast());var r=e.fromLatLngToDivPixel(c),v=true,u=b.getGridSize_();if(g!==e.getZoom()){var y=e.getZoom()-g;u=Math.pow(2,y)*u}if(h.x!==l.x&&(r.x+u<l.x||r.x-u>h.x))v=false;if(v&&(r.y+u<h.y||
r.y-u>l.y))v=false;return v};this.getCenter=function(){return c};this.addMarker=function(h){if(c===null)c=h.marker.getLatLng();h.marker.parentCluster_=j;d.push(h)};this.removeMarker=function(h){for(var l=0,r=d.length;l<r;l++)if(h===d[l].marker){d[l].isAdded&&e.removeOverlay(d[l].marker);delete d[l].marker.parentCluster_;d.splice(l,1);return true}return false};this.isClustered=function(h){for(var l=0,r=d.length;l<r;l++)if(h===d[l].marker)return!d[l].isAdded;return false};this.getCurrentZoom=function(){return g};
this.redraw_=function(h){if(h||this.isInBounds()){g=e.getZoom();h=0;h=b.getMaxZoom_();if(h===null)h=e.getCurrentMapType().getMaximumResolution();if(g>h||this.getTotalMarkers()===1){h=0;for(var l=d.length;h<l;h++)if(d[h].isAdded)d[h].marker.isHidden()&&d[h].marker.show();else{e.addOverlay(d[h].marker);d[h].isAdded=true}f!==null&&f.hide()}else if(this.getTotalMarkers()>1){h=0;for(l=d.length;h<l;h++)d[h].isAdded&&!d[h].marker.isHidden()&&d[h].marker.hide();h=b.getCalculator()(this.getRealMarkers());
if(f===null){f=new ClusterMarker_(c,h,b.getStyles(),b.getGridSize_(),j);e.addOverlay(f)}else{f.isHidden()&&f.show();f.setSums(h);f.redraw(true)}}}};this.clearMarkers=function(){f!==null&&e.removeOverlay(f);for(var h=0,l=d.length;h<l;h++){d[h].isAdded&&e.removeOverlay(d[h].marker);delete d[h].marker.parentCluster_}d=[]};this.getTotalMarkers=function(){return d.length};this.getRealMarkers=function(){for(var h=[],l=0,r=d.length;l<r;l++)h.push(d[l].marker);return h}}
function ClusterMarker_(b,c,d,e,f){var g=c.index;this.useStyle(d[g-1]);this.styleDirty_=false;this.latlng_=b;this.index_=g;this.styles_=d;this.text_=c.text;this.padding_=e;this.sums_=c;this.cluster_=f}if(typeof window.GOverlay==="function"){ClusterMarker_.prototype=new GOverlay;ClusterMarker_.instanceOfGOverlay=true}a=ClusterMarker_.prototype;a.useStyle=function(b){this.url_=b.url;this.height_=b.height;this.width_=b.width;this.textColor_=b.opt_textColor;this.anchor_=b.opt_anchor;this.textSize_=b.opt_textSize};
a.initialize=function(b){this.map_=b;var c=document.createElement("div"),d=this.latlng_,e=this.getPosFromLatLng(d);c.style.cssText=this.createCss(e);c.innerHTML=this.text_;b.getPane(G_MAP_MAP_PANE).appendChild(c);var f=this.padding_,g=this.cluster_;GEvent.addDomListener(c,"click",function(){GEvent.trigger(g.getMarkerClusterer(),"clusterclick",g);if(g.getMarkerClusterer().isZoomOnClick()){var j=b.fromLatLngToDivPixel(d),h=new GPoint(j.x-f,j.y+f);h=b.fromDivPixelToLatLng(h);j=new GPoint(j.x+f,j.y-f);
j=b.fromDivPixelToLatLng(j);h=b.getBoundsZoomLevel(new GLatLngBounds(h,j),b.getSize());b.setCenter(d,h)}});this.div_=c};a.getPosFromLatLng=function(b){b=this.map_.fromLatLngToDivPixel(b);b.x-=parseInt(this.width_/2,10);b.y-=parseInt(this.height_/2,10);return b};
a.createCss=function(b){var c="";c=document.all?'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="'+this.url_+'");':"background:url("+this.url_+");";if(typeof this.anchor_==="object"){c+=typeof this.anchor_[0]==="number"&&this.anchor_[0]>0&&this.anchor_[0]<this.height_?"height:"+(this.height_-this.anchor_[0])+"px;padding-top:"+this.anchor_[0]+"px;":"height:"+this.height_+"px;line-height:"+this.height_+"px;";c+=typeof this.anchor_[1]==="number"&&this.anchor_[1]>0&&
this.anchor_[1]<this.width_?"width:"+(this.width_-this.anchor_[1])+"px;padding-left:"+this.anchor_[1]+"px;":"width:"+this.width_+"px;text-align:center;"}else{c+="height:"+this.height_+"px;line-height:"+this.height_+"px;";c+="width:"+this.width_+"px;text-align:center;"}return c+"cursor:pointer;top:"+b.y+"px;left:"+b.x+"px;color:"+(this.textColor_?this.textColor_:"black")+";position:absolute;font-size:"+(this.textSize_?this.textSize_:24)+"px;font-family:Arial,sans-serif;font-weight:bold"};
a.remove=function(){this.div_.parentNode.removeChild(this.div_)};a.copy=function(){return new ClusterMarker_(this.latlng_,this.sums_,this.text_,this.styles_,this.padding_,this.cluster_)};a.redraw=function(b){if(b){b=this.getPosFromLatLng(this.latlng_);if(this.styleDirty_){this.styleDirty_=false;this.useStyle(this.styles_[this.index_-1]);this.div_.style.cssText=this.createCss(b)}else{this.div_.style.top=b.y+"px";this.div_.style.left=b.x+"px"}}};a.hide=function(){this.div_.style.display="none"};
a.show=function(){this.div_.style.display=""};a.isHidden=function(){return this.div_.style.display==="none"};a.setSums=function(b){if(b.index!==this.index_)this.styleDirty_=true;this.sums_=b;this.text_=b.text;this.index_=b.index;this.div_.innerHTML=b.text};var month_names=[];month_names[month_names.length]="January";month_names[month_names.length]="February";month_names[month_names.length]="March";month_names[month_names.length]="April";month_names[month_names.length]="May";month_names[month_names.length]="June";month_names[month_names.length]="July";month_names[month_names.length]="August";month_names[month_names.length]="September";month_names[month_names.length]="October";month_names[month_names.length]="November";
month_names[month_names.length]="December";var day_names=[];day_names[day_names.length]="Sunday";day_names[day_names.length]="Monday";day_names[day_names.length]="Tuesday";day_names[day_names.length]="Wednesday";day_names[day_names.length]="Thursday";day_names[day_names.length]="Friday";day_names[day_names.length]="Saturday";function getIntegerAsString(b){return b<10?"0"+b:b}
function getFullDateAsString(b){return month_names[b.getMonth()]+" "+b.getDate()+", "+b.getFullYear()+" "+b.getHours()+":"+getIntegerAsString(b.getMinutes())+":"+getIntegerAsString(b.getSeconds())+" UTC"}function getShortDateAsString(b){var c=b.getMonth()+1;return getIntegerAsString(c)+"/"+getIntegerAsString(b.getDate())+"/"+b.getFullYear()+" "+b.getHours()+":"+getIntegerAsString(b.getMinutes())+":"+getIntegerAsString(b.getSeconds())+" UTC"}
function getTimeAsString(b){return b.getHours()+":"+getIntegerAsString(b.getMinutes())+":"+getIntegerAsString(b.getSeconds())+" UTC"}function isStrValid(b){return!(b=="undefined"||b==null||b=="")}function setCookie(b,c){document.cookie=b+"="+escape(c)}function readCookie(b){b=b+"=";for(var c=document.cookie.split(";"),d=0;d<c.length;d++){for(var e=c[d];e.charAt(0)==" ";)e=e.substring(1,e.length);if(e.indexOf(b)==0)return e.substring(b.length,e.length)}}
function getVar(b){var c=location.href.substring(location.href.indexOf("?")+1,location.href.length)+"&";if(c.indexOf("#")!=-1)c=c.substring(0,c.indexOf("#"))+"&";var d=undefined;b+="=";var e=b.length;if(c.indexOf(b)!=-1)d=c.substring(c.indexOf(b)+e,c.length).substring(0,c.substring(c.indexOf(b)+e,c.length).indexOf("&"));return d}function getEvent(b){if(b==undefined)return window.event;return b}function handleEventObj(b,c){return function(d){d=d||window.event;b[c](d,this)}}
function handleEvent(b){return function(c){c=c||window.event;b(c,this)}};var mainUrl="http://www.radarvirtuel.com/",iconUrl="http://radarbox.free.fr/",airportsUrl="http://www.radarvirtuel.com/airports/",jsonFile=mainUrl+"file.json",iconDir=iconUrl+"icones/",airplaneIconPrefixDict={airbus:"airbus/a320_",boeing:"boeing/boeing747_","default":"default/default_",unknown:"unknown/unknown",default_small:"default_small/default_"},selectedAirplaneIconPrefixDict={airbus:"airbus/selected/a320_",boeing:"boeing/selected/boeing747_","default":"default/selected/default_",unknown:"unknown/selected/unknown",
default_small:"default_small/selected/default_"},startPosition=new GLatLng(48.74894534343293,12.83203125),startZoomLevel=5,showProviders=true,showDisconnectedProviders=false,maxZoomClustered=4,defaultRefreshRate=10,retryRefreshRate=5,defaultRefreshRateWeather=600,retryRefreshRateWeather=5,timeoutJSON=10,limitSessionTime=false,sessionTimeDelta=2400,travelPlaces=[{name:"Europe",position:[48.74894534343293,12.83203125],zoomLevel:5,subLinks:[{name:"France",position:[46.8,4.7],zoomLevel:6,subLinks:[{name:"Paris",
position:[48.853873,2.3909],zoomLevel:10,subLinks:undefined}]},{name:"United Kingdom",position:[54.380557,-3.273926],zoomLevel:6,subLinks:[{name:"London",position:[51.5104518,-0.111236],zoomLevel:10,subLinks:undefined}]},{name:"Ireland",position:[53.442264,-7.855225],zoomLevel:7,subLinks:undefined},{name:"Spain",position:[39.740986,-3.933105],zoomLevel:6,subLinks:undefined},{name:"Portugal",position:[39.402244,-8.22876],zoomLevel:7,subLinks:undefined},{name:"Switzerland",position:[47.253136,8.596802],
zoomLevel:7,subLinks:undefined},{name:"Finland",position:undefined,zoomLevel:undefined,subLinks:[{name:"Helsinki",position:[59.784051,25.455322],zoomLevel:7,subLinks:undefined}]},{name:"Hungary",position:[46.573967,17.314453],zoomLevel:6,subLinks:undefined},{name:"Romania",position:[46.573967,17.314453],zoomLevel:7,subLinks:undefined},{name:"Cyprus",position:[35.871247,33.640137],zoomLevel:6,subLinks:undefined}]},{name:"America",position:undefined,zoomLevel:undefined,subLinks:[{name:"USA",position:[39.3682,
-97.6025],zoomLevel:5,subLinks:[{name:"Florida",position:[28.256006,-81.595459],zoomLevel:7,subLinks:undefined},{name:"California",position:[33.92513,-116.916504],zoomLevel:6,subLinks:undefined}]},{name:"Canada",position:undefined,zoomLevel:undefined,subLinks:[{name:"Kingston",position:[44.024422,-76.59668],zoomLevel:7,subLinks:undefined},{name:"Vancouver",position:[48.502048,-122.991943],zoomLevel:7,subLinks:undefined}]},{name:"Brazil",position:undefined,zoomLevel:undefined,subLinks:[{name:"Brasilia",
position:[-17.014768,-44.736328],zoomLevel:6,subLinks:undefined}]}]},{name:"Africa",position:undefined,zoomLevel:undefined,subLinks:[{name:"Reunion",position:[-21.204898,55.59082],zoomLevel:9,subLinks:undefined},{name:"South Africa",position:[-27.994401411046145,28.2568359375],zoomLevel:6,subLinks:undefined}]}];function AirPlane(b,c,d,e,f,g){this.id=b;this.point=new GLatLng(c[0],c[1]);this.angle=d;this.labelAttribute=g;this.setInfo(e,f);this.selected=false;this.polyline=this.marker=undefined;this.labelVisible=this.visible=true}a=AirPlane.prototype;a.setName=function(b){this.marker!=undefined&&this.marker.setLabelText(b)};a.getAttributeValue=function(b){if(b==undefined)return"";b=this.info[b];if(b==undefined)return"";return b};a.getNameFromLabelAttribute=function(){var b="";try{b=this.getAttributeValue(this.labelAttribute)}catch(c){}return b};
a.setLabelAttribute=function(b){this.labelAttribute=b;this.setName(this.getNameFromLabelAttribute())};a.setPoint=function(b){this.point=new GLatLng(b[0],b[1]);this.marker!=undefined&&this.marker.setLatLng(this.point)};a.getColor=function(){return"#ff0000"};a.setPolyline=function(b,c,d){if(this.marker!=undefined){this.numPolyPoint=b[0];this.polyEncodedStr=b[1];this.polyColor=this.getColor(c);this.polyWidth=d;this.polyline!=undefined&&this.makePolyline()}};
a.makePolyline=function(){if(this.marker!=undefined){levels="";for(var b=0;b<this.numPolyPoint;b++)levels+="P";this.polyline=new GPolyline.fromEncoded({color:this.polyColor,weight:this.polyWidth,opacity:1,points:this.polyEncodedStr,levels:levels,zoomFactor:1,numLevels:18})}};a.getPolyline=function(){this.polyline==undefined&&this.makePolyline();return this.polyline};a.setAngle=function(b){this.angle=b;if(this.marker!=undefined)this.marker.getIcon().image=this.getIconFileName()};
a.setInfo=function(b,c){this.info=b;b="?";if(this.info.ar!=undefined){b=this.info.ar;if(c[b]!=undefined){var d=c[b];this.arName=d[0];if(d[1]!=""&&d[2]!="")this.arPos=new GLatLng(d[1],d[2])}else this.arPos=this.arName=undefined}d="?";if(this.info.de!=undefined){d=this.info.de;if(c[d]!=undefined){c=c[d];this.deName=c[0];if(c[1]!=""&&c[2]!="")this.dePos=new GLatLng(c[1],c[2])}else this.dePos=this.deName=undefined}this.info.da=d+"->"+b};
a.setPolylineVisibility=function(b){if(this.polyline)(this.polylineVisible=b)?this.polyline.show():this.polyline.hide()};a.setLabelVisibility=function(b){if(this.marker!=undefined){this.labelVisible=b;this.marker.setLabelVisibility(this.labelVisible)}};a.showLabel=function(){this.setLabelVisibility(true)};a.hideLabel=function(){this.setLabelVisibility(false)};a.formatAttribute=function(b,c){if(!isStrValid(c))return"";return"<b>"+b+"</b> : "+c+"<br/>"};
a.formatInfoAsHTML=function(){html="";try{html+='<a href="#" class="simpleLink" onclick="javascript:map.zoomIn(new GLatLng('+this.point.lat()+","+this.point.lng()+'),true,true);">ZOOM</a>';html+=" - ";var b="setAirplaneFilter({'attribute':'ia','attributeType':'str','operator':'equal','str':'"+this.info.ia+"'})";html+='<a href="#" class="simpleLink" onclick="javascript:'+b+'">HIDE OTHERS</a>';html+=" - ";html+='<a href="#" class="simpleLink" onclick="javascript:cancelAirplaneFilter()">SHOW ALL</a>';
html+="<hr>";html+=this.formatAttribute("Flight Number",this.info.cs);html+=this.formatAttribute("Company",this.info.co);html+=this.formatAttribute("ICAO Hex Code",this.info.ia);html+=this.formatAttribute("Reg Code",this.info.rc);if(this.info.br!=undefined){fullModelName=this.info.br;if(this.info.mo!=undefined)fullModelName+=" - "+this.info.mo;html+=this.formatAttribute("Model",fullModelName)}if(this.info.de!=undefined){b="setAirplaneFilter({'attribute':'de','attributeType':'str','operator':'equal','str':'"+
this.info.de+"'})";var c='<a href="#" class="simpleLink" onclick="javascript:'+b+'">'+this.info.de+"</a>";if(this.deName!=undefined)c+=" - "+this.deName;if(this.dePos!=undefined){var d=this.dePos.distanceFrom(this.point)/1E3,e=d*0.621371192;c+="<br/>(Birds Eye Distance : "+d.toFixed(0)+" km - "+e.toFixed(0)+" miles)"}html+=this.formatAttribute("Departure",c)}if(this.info.ar!=undefined){b="setAirplaneFilter({'attribute':'ar','attributeType':'str','operator':'equal','str':'"+this.info.ar+"'})";var f=
'<a href="#" class="simpleLink" onclick="javascript:'+b+'">'+this.info.ar+"</a>";if(this.arName!=undefined)f+=" - "+this.arName;if(this.arPos!=undefined){d=this.arPos.distanceFrom(this.point)/1E3;e=d*0.621371192;f+="<br/>(Birds Eye Distance : "+d.toFixed(0)+" km - "+e.toFixed(0)+" miles)"}html+=this.formatAttribute("Arrival",f)}html+="<hr>";var g=new Date,j=this.info.dt,h=g.getTimezoneOffset();g.setTime(j+h*6E4);dateString=getTimeAsString(g);html+=this.formatAttribute("Last Message",dateString);html+=
this.formatAttribute("Latitude",this.point.lat());html+=this.formatAttribute("Longitude",this.point.lng());if(isStrValid(this.info.al)){var l=parseFloat(this.info.al);b=l*3.2808399;var r=l.toFixed(0)+" m - "+b.toFixed(0)+" ft";html+=this.formatAttribute("Altitude",r)}if(isStrValid(this.info.gs)){var v=parseFloat(this.info.gs);l=v*0.621371192;r=v/1.852;var u=v.toFixed(0)+" km/h  -  "+l.toFixed(0)+" mph  -  "+r.toFixed(0)+" knots";html+=this.formatAttribute("Ground Speed",u)}if(isStrValid(this.info.vs)){var y=
parseFloat(this.info.vs);v=y*3.2808399;verticalStatus="";if(y>0)verticalStatus=" (CLIMB)";else if(y<0)verticalStatus=" (DESCENT)";var C=y.toFixed(0)+" m/min  -  "+v.toFixed(0)+" ft/min "+verticalStatus;html+=this.formatAttribute("Vertical Speed",C)}html+=this.formatAttribute("Squawk",this.info.sq);if(isStrValid(this.info.tr))html+=this.formatAttribute("Heading",this.info.tr+"&ordm;");if(this.info.rc!=undefined){html+="<hr>";html+="More information at : <br/>";html+='<a href="#" class="simpleLink" onclick="'+
("window.open('http://www.airliners.net/search/photo.search?distinct_entry=true&regsearch="+this.info.rc+"')")+'">Airliners.net</a>';html+=" - ";html+='<a href="#" class="simpleLink" onclick="'+("window.open('http://www.libhomeradar.org/aircraft/"+this.info.rc+".html')")+'">LibHomeRadar.org</a>';if(this.info.rc[0]=="N"){var A="window.open('http://registry.faa.gov/aircraftinquiry/NNum_Results.aspx?NNumbertxt="+this.info.rc+"')";html+=" - ";html+='<a href="#" class="simpleLink" onclick="'+A+'">FAA</a>'}}html+=
"<br/>";html+=$("adDiv").innerHTML}catch(G){}return html};a.updateHTML=function(){html=this.formatInfoAsHTML();$("infowindow").innerHTML=html};a.showHTML=function(){this.updateHTML();toggleTab(1,2)};a.hideHTML=function(){$("infowindow").innerHTML=$("tipContent").innerHTML};
a.getIconFileName=function(){iconPrefixDict=airplaneIconPrefixDict;if(this.selected)iconPrefixDict=selectedAirplaneIconPrefixDict;var b=this.angle;if(!b&&this.info.tr)b=(450-this.info.tr)%360;if(b){roundedAngleStr=b=Math.round(b/10)*10%360;if(b<100)roundedAngleStr="0"+roundedAngleStr;if(b<10)roundedAngleStr="0"+roundedAngleStr;return iconDir+iconPrefixDict["default"]+roundedAngleStr+".png"}else return iconDir+iconPrefixDict.unknown+".png"};
a.createMarker=function(){var b=new GIcon;b.iconSize=new GSize(30,28);b.iconAnchor=new GPoint(15,14);b.image=this.getIconFileName();opts={icon:b,clickable:true,labelText:this.getNameFromLabelAttribute(),labelOffset:new GSize(10,0),zIndexProcess:function(){return 99}};this.marker=new LabeledMarker(this.point,opts);this.marker.setLabelVisibility(this.labelVisible);this.visible?this.marker.show():this.marker.hide()};
a.setVisibility=function(b){if(this.visible=b){this.marker.show();this.polyline&&this.polylineVisible&&this.polyline.show()}else{this.marker.hide();this.polyline&&this.polyline.hide()}};a.updateName=function(){this.setName(this.getNameFromLabelAttribute())};a.updateMarker=function(){this.marker.getIcon().image=this.getIconFileName();this.updateName()};a.select=function(){this.selected=true;this.updateMarker();this.showHTML()};a.deselect=function(){this.selected=false;this.updateMarker();this.hideHTML()};function WeatherInfo(b,c,d,e,f,g){this.point=new GLatLng(b[0],b[1]);this.tempDeg=c;this.humidity=d;this.windSpeedKmh=e;this.windDir=f;this.currentConditionCode=g;this.selected=false;this.marker=undefined;this.visible=true;this.labelVisible=false}a=WeatherInfo.prototype;a.setLabelVisibility=function(b){if(this.marker!=undefined){this.labelVisible=b;this.marker.setLabelVisibility(this.labelVisible)}};a.showLabel=function(){this.setLabelVisibility(true)};a.hideLabel=function(){this.setLabelVisibility(false)};
a.getFahrenheitTemp=function(){return(parseFloat(this.tempDeg)*1.8+32).toFixed(0)};a.getMphWindSpeed=function(){return(parseFloat(this.windSpeedKmh)*0.621371192).toFixed(0)};a.getLabel=function(){var b="TEMP: "+this.tempDeg+"&deg;C - "+this.getFahrenheitTemp()+"&deg;F<br>";b+="WIND: "+this.windSpeedKmh+" km/h - "+this.getMphWindSpeed()+" mph "+this.windDir+"<br>";b+="HUMIDITY: "+this.humidity+"%";return b};a.getIconFileName=function(){return iconDir+"/weather/"+this.currentConditionCode+".png"};
a.createMarker=function(){var b=new GIcon;b.iconSize=new GSize(32,32);b.iconAnchor=new GPoint(16,16);b.image=this.getIconFileName();opts={icon:b,clickable:true,labelText:this.getLabel(),labelOffset:new GSize(18,-16),labelClass:"LabeledMarker_markerLabel_weather"};this.marker=new LabeledMarker(this.point,opts);this.marker.setLabelVisibility(this.labelVisible);GEvent.addListener(this.marker,"mouseover",function(){this.setLabelVisibility(true)});GEvent.addListener(this.marker,"mouseout",function(){this.setLabelVisibility(false)});
this.visible?this.marker.show():this.marker.hide()};a.setVisibility=function(b){(this.visible=b)?this.marker.show():this.marker.hide()};a.updateName=function(){this.setName(this.getLabel())};a.updateMarker=function(){this.marker.getIcon().image=this.getIconFileName();this.updateName()};var map,airplaneMarkerClusterer,generalMarkerClusterer,sessionActive=true,sessionSecs,sessionTimerID=null,sessionTimerRunning=false,sessionDelay=1E3,airPlaneArray=[],idList=[],infoProviders=[],airportInfo,refreshRate=defaultRefreshRate,secs,timerID=null,timerRunning=false,delay=1E3,totalNumAircraftTracked=0,dateString=undefined,labelAttribute=undefined,selectedAirPlane=undefined,polylineWidth=1,airplaneFilter={attribute:undefined,attributeType:undefined,operator:undefined,str:undefined},weatherInfoList=
[],weatherInfoVisible=false,lastWeatherInfoRetrieve=undefined,refreshRateWeather=defaultRefreshRateWeather,secsWeather,timerIDWeather=null,timerRunningWeather=false,delayWeather=1E3,colorMode={altitude:0,"ground speed":1,"vertical speed":2},currentColorMode=colorMode.altitude,airportTileOverlay;
function initialize(){if(GBrowserIsCompatible()){limitSessionTime&&InitializeSessionTimer();if(Prototype.Browser.IE)$("iewarning").style.display="block";$("infowindow").innerHTML=$("tipContent").innerHTML;initLayerManager();initFilterManager();var b=$("maindiv").getWidth(),c=$("maindiv").getHeight()-$("upbarDiv").getHeight();b={size:new GSize(b,c)};map=new GMap2(document.getElementById("map_canvas"),b);b=getVar("lat");c=getVar("lng");var d=getVar("zoom");if(typeof b!="undefined"&&typeof c!="undefined"&&
typeof d!="undefined"){startPosition=new GLatLng(parseFloat(b),parseFloat(c));startZoomLevel=parseFloat(d)}savedPosition=getSavedPosition();savedPosition==undefined?map.setCenter(startPosition,startZoomLevel):map.setCenter(savedPosition[0],savedPosition[1]);fillMapLink();map.addMapType(G_PHYSICAL_MAP);map.setMapType(G_PHYSICAL_MAP);map.addControl(new GSmallMapControl);map.enableScrollWheelZoom();map.addControl(new GMapTypeControl);map.addControl(new GScaleControl);GEvent.addListener(map,"moveend",
handleViewChange);GEvent.addListener(map,"zoomend",handleViewChange);preloadImages();printInfo("Loading data...");openJson(jsonFile,parseJson);InitializeTimer()}}
function preloadImages(){if(document.images){var b=new Image;b.src=iconDir+"/state/state_0.png";var c=new Image;b.src=iconDir+"/state/state_1.png";for(var d=0;d<=36;d+=1){multipliedAngleStr=multipliedAngle=d*10;if(multipliedAngle<100)multipliedAngleStr="0"+multipliedAngleStr;if(multipliedAngle<10)multipliedAngleStr="0"+multipliedAngleStr;b=new Image;b.src=iconDir+airplaneIconPrefixDict["default"]+multipliedAngleStr+".png";c=new Image;c.src=iconDir+selectedAirplaneIconPrefixDict["default"]+multipliedAngleStr+
".png"}}}function fillMapLink(){var b=map.getCenter(),c=map.getZoom(),d=mainUrl+"?lat="+b.lat()+"&lng="+b.lng()+"&zoom="+c;b=$$(".mapLink");c=0;for(var e=b.length;c<e;c++)b[c].value=d;d='<iframe width="800" height="600" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+d+'"></iframe>';b=$$(".mapHTML");c=0;for(e=b.length;c<e;c++)b[c].value=d}function handleViewChange(){fillMapLink();updateStatusBar()}
function getMapLink(){var b=map.getCenter(),c=map.getZoom();return mainUrl+"?lat="+b.lat()+"&lng="+b.lng()+"&zoom="+c}
function refreshAirPlaneMarkerClusterer(b){airplaneMarkerClusterer&&airplaneMarkerClusterer.clearMarkers();var c=[],d=airPlaneArray;if(b)d=b;b=0;for(var e=d.length;b<e;b++)c.push(d[b].marker);airplaneMarkerClusterer=new MarkerClusterer(map,c,{maxZoom:maxZoomClustered,gridSize:60,styles:[{url:mainUrl+"/icones/cluster/cluster.png",height:65,width:66,opt_textColor:"#000000"}]});GEvent.addListener(airplaneMarkerClusterer,"regroup",handleClusterChange)}
function handleClusterChange(){if(selectedAirPlane!=undefined&&selectedAirPlane!=null)airplaneMarkerClusterer.isClustered(selectedAirPlane.marker)?selectedAirPlane.setPolylineVisibility(false):selectedAirPlane.setPolylineVisibility(true)}
function refreshGeneralMarkerClusterer(){typeof generalMarkerClusterer!="undefined"&&generalMarkerClusterer.clearMarkers();for(var b=[],c=0,d=infoProviders.length;c<d;c++)b.push(infoProviders[c]);c=0;for(d=weatherInfoList.length;c<d;c++)b.push(weatherInfoList[c].marker);generalMarkerClusterer=new MarkerClusterer(map,b,{maxZoom:1,gridSize:100})}
function createInfoProvider(b,c){var d=new GIcon;d.iconSize=new GSize(6,6);d.infoWindowAnchor=new GPoint(3,3);d.iconAnchor=new GPoint(3,3);d.image=iconDir+"/state/state_"+c+".png";opts={icon:d,clickable:false,zIndexProcess:function(){return 0}};return new GMarker(new GLatLng(b[0],b[1]),opts)}
function openJson(b,c){setLoaderVisibility(true);new Ajax.Request(b+"?tid="+Math.random(),{method:"get",timeout:timeoutJSON,requestHeaders:{Pragma:"no-cache","Cache-Control":"no-store, no-cache, must-revalidate, post-check=0, pre-check=0",Expires:new Date(0),"Last-Modified":new Date(0),"If-Modified-Since":new Date(0)},onComplete:c,onFailure:function(){}})}
function toggleWeatherLayer(){if(weatherInfoVisible){weatherInfoList=[];weatherInfoVisible=false;refreshGeneralMarkerClusterer()}else loadWeatherInfo()}function loadWeatherInfo(){sessionActive&&lastWeatherInfoRetrieve==undefined&&openJson("weather.json",parseWeatherJson)}
function parseWeatherJson(b){var c=undefined;try{c=eval("("+b.responseText+")")}catch(d){refreshRateWeather=retryRefreshRateWeather;InitializeWeatherTimer()}finally{if(c!=undefined){weatherInfoList=[];b=0;for(var e=c.length;b<e;++b){var f=new WeatherInfo(c[b].p,c[b].t,c[b].h,c[b].s,c[b].d,c[b].c);f.createMarker();weatherInfoList.push(f)}refreshGeneralMarkerClusterer();weatherInfoVisible=true}}}
function parseJson(b){var c=undefined;try{c=eval("("+b.responseText+")")}catch(d){StopTheClock();refreshRate=retryRefreshRate;InitializeTimer()}finally{if(c!=undefined){StopTheClock();setLoaderVisibility(false);if(showProviders){infoProviders=[];b=0;for(var e=c.prv.length;b<e;b++)if(!(!showDisconnectedProviders&&c.prv[b].st==0)){var f=createInfoProvider(c.prv[b].pt,c.prv[b].st);infoProviders.push(f)}refreshGeneralMarkerClusterer()}airportInfo=c.arpts;jsonIdList=[];b=0;for(e=c.mrkrs.length;b<e;b++)jsonIdList.push(c.mrkrs[b].id);
f=[];b=[];var g=[];b=0;for(e=idList.length;b<e;b++){for(var j=idList[b],h=airPlaneArray[b],l=0,r=0,v=jsonIdList.length;r<v;r++)if(jsonIdList[r]==j)l=1;if(l==0)h.selected&&selectAirplane(undefined)(undefined);else{g.push(j);f.push(h)}}idList=g;airPlaneArray=f;maxDate=undefined;b=0;for(e=c.mrkrs.length;b<e;b++){j=c.mrkrs[b].id;dt=c.mrkrs[b].inf.dt;if(dt!=undefined)if(maxDate==undefined||dt>maxDate)maxDate=dt;l=0;f=-1;r=0;for(v=idList.length;r<v;r++)if(idList[r]==j){l=1;f=r}if(l==0){h=new AirPlane(j,
c.mrkrs[b].pt,c.mrkrs[b].an,c.mrkrs[b].inf,airportInfo,labelAttribute);h.createMarker();c.mrkrs[b].ln&&h.setPolyline(c.mrkrs[b].ln,currentColorMode,polylineWidth);GEvent.addListener(h.marker,"click",selectAirplane(h));airPlaneArray.push(h);applyAirplaneFilterToSingleAirplane(h);idList.push(j)}else{h=airPlaneArray[f];h.setPoint(c.mrkrs[b].pt);h.setAngle(c.mrkrs[b].an);h.setInfo(c.mrkrs[b].inf,airportInfo);h.updateMarker();applyAirplaneFilterToSingleAirplane(h);if(h.selected){h.updateHTML();h.polyline&&
map.removeOverlay(h.polyline)}c.mrkrs[b].ln&&h.setPolyline(c.mrkrs[b].ln,currentColorMode,polylineWidth);h.selected&&h.polyline&&map.addOverlay(h.getPolyline());airPlaneArray[f]=h}}totalNumAircraftTracked=c.num;if(maxDate!=undefined){c=new Date;b=c.getTimezoneOffset();c.setTime(maxDate+b*6E4);dateString=getTimeAsString(c)}refreshRate=defaultRefreshRate;InitializeTimer();applyAirplaneFilterToAllAirplanes()}else{StopTheClock();refreshRate=retryRefreshRate;InitializeTimer()}}}
function updateStatusBar(){var b="",c=airPlaneArray.length;if(typeof airplaneMarkerClusterer!="undefined"){var d=airplaneMarkerClusterer.getNumMarkersInViewport();b+=dateString!=undefined?dateString+" - "+c+" aircraft tracked ("+d+" in viewport)":"Now tracking"+c+" aircraft ("+d+" in viewport)";printInfo(b)}}
function updateStats(){var b=airPlaneArray.length,c=totalNumAircraftTracked-b,d=b*100/totalNumAircraftTracked,e=c*100/totalNumAircraftTracked,f="<b>Total aircraft tracked:</b> "+totalNumAircraftTracked;f+="<br/>";f+="<b>ADS-B:</b> "+b+" ("+d.toFixed(1)+"%)";f+="<br/>";f+="<b>Mode-S:</b> "+c+" ("+e.toFixed(1)+"%)";$("statsManager").innerHTML=f}function printInfo(b){$("statusbarContent").innerHTML=b;$("statusbar").style.display="block"}
function setLoaderVisibility(b){if(b)$("loadingIcon").style.display="block";else $("loadingIcon").style.display="none"}function getSavedPosition(){var b=readCookie("lat"),c=readCookie("lon"),d=readCookie("zoom");if(!(b==undefined||c==undefined||d==undefined))return[new GLatLng(parseFloat(b),parseFloat(c)),parseFloat(d)]}function saveCurrentPosition(){var b=map.getCenter(),c=map.getZoom();setCookie("lat",b.lat());setCookie("lon",b.lng());setCookie("zoom",c)}
function showAllAirplanes(){for(var b=0,c=airPlaneArray.length;b<c;++b)airPlaneArray[b].setVisibility(true);refreshAirPlaneMarkerClusterer()}function hideAllAirplanes(){for(var b=0,c=airPlaneArray.length;b<c;++b)airPlaneArray[b].setVisibility(false);refreshAirPlaneMarkerClusterer()}
function selectAirplane(b){return function(c){c=c||window.event;if(selectedAirPlane!=undefined&&selectedAirPlane!=null){airplaneMarkerClusterer.removeMarker(selectedAirPlane.marker);selectedAirPlane.deselect();airplaneMarkerClusterer.addMarker(selectedAirPlane.marker);selectedAirPlane.setPolylineVisibility(false);selectedAirPlane.polyline&&map.removeOverlay(selectedAirPlane.polyline)}if(b!=undefined){airplaneMarkerClusterer.removeMarker(b.marker);b.select(c,this);airplaneMarkerClusterer.addMarker(b.marker);
map.addOverlay(b.getPolyline());b.setPolylineVisibility(true);typeof pageTracker!="undefined"&&pageTracker._trackEvent("Airplane","select")}selectedAirPlane=b}}function travelTo(b,c,d,e){selectAirplane(undefined)(undefined);map.setCenter(new GLatLng(c,d),e);typeof pageTracker!="undefined"&&pageTracker._trackEvent("DirectMapLink",b)}
function changeLabelAttribute(b){labelAttribute=b;b=0;for(var c=airPlaneArray.length;b<c;++b){airPlaneArray[b].setLabelAttribute(labelAttribute);labelAttribute==undefined?airPlaneArray[b].hideLabel():airPlaneArray[b].showLabel()}b=getLabelNameFromCode(labelAttribute);typeof pageTracker!="undefined"&&pageTracker._trackEvent("Airplane","ChangeDisplayLabel",b)}
function setAirplaneFilter(b){airplaneFilter.attribute!=undefined&&cancelAirplaneFilter();airplaneFilter=b;$("filterManager").applyFilter(airplaneFilter);applyAirplaneFilterToAllAirplanes();b=getLabelNameFromCode(airplaneFilter.attribute);typeof pageTracker!="undefined"&&pageTracker._trackEvent("Airplane","ApplyFilter",b)}
function cancelAirplaneFilter(){$("filterManager").cancelFilter();airplaneFilter={attribute:undefined,attributeType:undefined,operator:undefined,str:undefined};applyAirplaneFilterToAllAirplanes()}
function applyAirplaneFilterToSingleAirplane(b){if(airplaneFilter.attribute==undefined||airplaneFilter.str==""){b.setVisibility(true);return false}else{var c=b.getAttributeValue(airplaneFilter.attribute),d=true;if(airplaneFilter.attributeType=="str"){d=(new RegExp(airplaneFilter.str,"gi")).test(c);d=airplaneFilter.operator=="equal"&&d||airplaneFilter.operator=="diff"&&!d}else{c=parseFloat(c);var e=parseFloat(airplaneFilter.str);if(airplaneFilter.operator=="equal")d=c==e;else if(airplaneFilter.operator==
"diff")d=c!=e;else if(airplaneFilter.operator=="inf")d=c<e;else if(airplaneFilter.operator=="sup")d=c>e}b.setVisibility(d);return d}}
function applyAirplaneFilterToAllAirplanes(){if(airplaneFilter.attribute==undefined){showAllAirplanes();$("filterManager").printNumResults(-1);updateStatusBar()}else{for(var b=0,c=[],d=0,e=airPlaneArray.length;d<e;++d){var f=airPlaneArray[d];if(applyAirplaneFilterToSingleAirplane(f)){c.push(f);b++}}refreshAirPlaneMarkerClusterer(c);$("filterManager").printNumResults(b);updateStatusBar();typeof pageTracker!="undefined"&&pageTracker._trackEvent("filter",airplaneFilter.attribute,airplaneFilter.operator+
airplaneFilter.str)}}function InitializeTimer(){secs=refreshRate;StopTheClock();StartTheTimer()}function StopTheClock(){timerRunning&&clearTimeout(timerID);timerRunning=false}function StartTheTimer(){if(sessionActive)if(secs==0){StopTheClock();openJson(jsonFile,parseJson);InitializeTimer()}else{self.status=secs;secs-=1;timerRunning=true;timerID=self.setTimeout("StartTheTimer()",delay)}}
function InitializeWeatherTimer(){secsWeather=defaultRefreshRateWeather;StopTheWeatherClock();StartTheWeatherTimer()}function StopTheWeatherClock(){timerRunningWeather&&clearTimeout(timerIDWeather);timerRunningWeather=false}function StartTheWeatherTimer(){if(sessionActive)if(secsWeather==0){StopTheWeatherClock();loadWeatherInfo();InitializeWeatherTimer()}else{self.status=secsWeather;secsWeather-=1;timerRunningWeather=true;timerIDWeather=self.setTimeout("StartTheWeatherTimer()",delayWeather)}}
function InitializeSessionTimer(){sessionSecs=sessionTimeDelta;StopTheSessionClock();StartTheSessionTimer()}function StopTheSessionClock(){sessionTimerRunning&&clearTimeout(sessionTimerID);sessionTimerRunning=false}
function StartTheSessionTimer(){if(sessionSecs==0){StopTheSessionClock();sessionActive=false;alert("Your session is over. Please reload the page to keep viewing the website.")}else{self.status=sessionSecs;sessionSecs-=1;sessionTimerRunning=true;sessionTimerID=self.setTimeout("StartTheSessionTimer()",sessionDelay)}}
function CustomGetTileUrl(b,c){baseDir=airportsUrl;if(c==0&&b.x>=0&&b.x<=0&&b.y>=0&&b.y<=0)return baseDir+c+"/"+b.y+"/"+b.x+".png";else if(c==1&&b.x>=0&&b.x<=1&&b.y>=0&&b.y<=1)return baseDir+c+"/"+b.x+"/"+b.y+".png";else if(c==2&&b.x>=0&&b.x<=3&&b.y>=0&&b.y<=3)return baseDir+c+"/"+b.x+"/"+b.y+".png";else if(c==3&&b.x>=0&&b.x<=7&&b.y>=0&&b.y<=7)return baseDir+c+"/"+b.x+"/"+b.y+".png";else if(c==4&&b.x>=0&&b.x<=15&&b.y>=0&&b.y<=15)return baseDir+c+"/"+b.x+"/"+b.y+".png";else if(c==5&&b.x>=0&&b.x<=31&&
b.y>=0&&b.y<=31)return baseDir+c+"/"+b.x+"/"+b.y+".png";else if(c==6&&b.x>=0&&b.x<=63&&b.y>=0&&b.y<=63)return baseDir+c+"/"+b.x+"/"+b.y+".png";else if(c==7&&b.x>=0&&b.x<=127&&b.y>=0&&b.y<=127)return baseDir+c+"/"+b.x+"/"+b.y+".png";else if(c==8&&b.x>=0&&b.x<=255&&b.y>=0&&b.y<=255)return baseDir+c+"/"+b.x+"/"+b.y+".png";else if(c==9&&b.x>=0&&b.x<=511&&b.y>=0&&b.y<=511)return baseDir+c+"/"+b.x+"/"+b.y+".png";else if(c==10&&b.x>=0&&b.x<=1023&&b.y>=0&&b.y<=1023)return baseDir+c+"/"+b.x+"/"+b.y+".png";
return G_NORMAL_MAP.getTileLayers()[0].getTileUrl(b,c)}
function toggleAirportLayer(){if(airportTileOverlay==undefined){airportlayer=new GTileLayer(new GCopyrightCollection("Airports"),0,10);airportlayer.getTileUrl=CustomGetTileUrl;airportlayer.getOpacity=function(){return 1};airportlayer.isPng=function(){return true};airportTileOverlay=new GTileLayerOverlay(airportlayer);map.addOverlay(airportTileOverlay,{zPriority:1});airportTileOverlay.show()}else airportTileOverlay.isHidden()?airportTileOverlay.show():airportTileOverlay.hide()}volcanolayer=undefined;
function toggleVolcanoLayer(){if(volcanolayer==undefined){var b=new GLatLngBounds(new GLatLng(34.27,-64.33),new GLatLng(72.763,17.481));volcanolayer=new GGroundOverlay(mainUrl+"/ashes.png",b);map.addOverlay(volcanolayer)}else volcanolayer.isHidden()?volcanolayer.show():volcanolayer.hide()};var labelName2CodeDict=[{name:"None",type:"str",code:""},{name:"CallSign",type:"str",code:"cs"},{name:"ICAO Code",type:"str",code:"ia"},{name:"Reg Code",type:"str",code:"rc"},{name:"Departure Airport Code",type:"str",code:"de"},{name:"Arrival Airport Code",type:"str",code:"ar"},{name:"All Airport Codes",type:"str",code:"da"},{name:"Company",type:"str",code:"co"},{name:"Model",type:"str",code:"mo"},{name:"Model Brand",type:"str",code:"br"},{name:"Altitude (meters)",type:"num",code:"al"},{name:"Ground Speed (km/hour)",
type:"num",code:"gs"},{name:"Vertical Speed (meters/min)",type:"num",code:"vs"},{name:"Squawk",type:"str",code:"sq"},{name:"Heading",type:"num",code:"tr"}];function getLabelNameFromCode(b){if(b!=undefined)for(var c=0;c<labelName2CodeDict.length;c++)if(labelName2CodeDict[c].code==b)return labelName2CodeDict[c].name;return"noLabel"}
function getSelectElementWithAvailableAttributes(){for(var b=document.createElement("select"),c=0;c<labelName2CodeDict.length;c++){var d=document.createElement("option");d.text=labelName2CodeDict[c].name;d.value=labelName2CodeDict[c].code;d.valueType=labelName2CodeDict[c].type;try{b.add(d,null)}catch(e){b.add(d)}}return b}
function initLayerManager(){var b=$("layerManager");b.appendChild(document.createTextNode("Aircrafts label : "));var c=getSelectElementWithAvailableAttributes();c.style.fontSize="12px";c.onchange=function(){changeLabelAttribute(this.options[this.selectedIndex].value)};b.appendChild(c);b.appendChild(document.createElement("br"));b.appendChild(document.createElement("br"));c=document.createElement("input");c.type="checkbox";c.name="";c.defaultChecked=false;c.value="";c.onclick=toggleVolcanoLayer;b.appendChild(c);
b.appendChild(document.createTextNode("Volcano Ashes Layer"));b.appendChild(document.createElement("br"));b.appendChild(document.createElement("br"));c=document.createElement("input");c.type="checkbox";c.name="";c.defaultChecked=false;c.value="";c.onclick=toggleAirportLayer;b.appendChild(c);b.appendChild(document.createTextNode("Airports Layer (Zoom in to see more airports)"));b.appendChild(document.createElement("br"));b.appendChild(document.createElement("br"));c=document.createElement("input");
c.type="checkbox";c.name="";c.defaultChecked=false;c.value="";c.onclick=toggleWeatherLayer;b.appendChild(c);b.appendChild(document.createTextNode("Weather Layer (Courtesy "));c=document.createElement("a");c.className="simpleLink";c.href="#";c.onclick=function(){window.open("http://weather.weatherbug.com/")};c.appendChild(document.createTextNode("WeatherBug"));b.appendChild(c);b.appendChild(document.createTextNode(")"));b.appendChild(document.createElement("br"));b.appendChild(document.createTextNode("Move the mouse over each weather icon to have temperature and wind speed information."));
b.appendChild(document.createElement("br"));b.appendChild(document.createElement("br"))}
function initFilterManager(){var b=$("filterManager"),c=getSelectElementWithAvailableAttributes();c.remove(0);c.style.fontSize="12px";b.appendChild(c);for(var d=document.createElement("select"),e=[{name:"=",code:"equal"},{name:"!=",code:"diff"},{name:"<",code:"inf"},{name:">",code:"sup"}],f=0;f<e.length;f++){var g=document.createElement("option");g.text=e[f].name;g.value=e[f].code;try{d.add(g,null)}catch(j){d.add(g)}}d.style.width="45px";b.appendChild(d);var h=document.createElement("input");h.setAttribute("type",
"text");h.style.width="90px";b.appendChild(h);b.appendChild(document.createElement("br"));var l=document.createElement("input");l.setAttribute("type","button");l.value="Apply";var r=document.createElement("input");r.setAttribute("type","button");r.value="Cancel";r.disabled=true;var v=document.createElement("div");v.innerHTML="No filter set.";b.applyFilter=function(u){for(var y=0;y<c.length;y++)if(c.options[y].value==u.attribute)c.selectedIndex=y;for(y=0;y<d.length;y++)if(d.options[y].value==u.operator)d.selectedIndex=
y;h.value=u.str;c.disabled=true;d.disabled=true;h.disabled=true;l.disabled=true;r.disabled=false};b.printNumResults=function(u){v.innerHTML=u==-1?"No filter set.":u<2?u+" airplane found.":u+" airplanes found."};b.cancelFilter=function(){c.disabled=false;d.disabled=false;h.disabled=false;l.disabled=false;r.disabled=true};l.onclick=function(){setAirplaneFilter({attribute:c.options[c.selectedIndex].value,attributeType:c.options[c.selectedIndex].valueType,operator:d.options[d.selectedIndex].value,str:h.value})};
r.onclick=function(){cancelAirplaneFilter()};b.appendChild(l);b.appendChild(r);b.appendChild(document.createElement("br"));b.appendChild(v);b.appendChild(document.createElement("br"));e=$(document.createElement("b"));e.appendChild(document.createTextNode("Examples :"));b.appendChild(e);b.appendChild(document.createElement("br"));b.appendChild(document.createTextNode("Vertical Speed < 0 (DESCENT) : "));e=document.createElement("a");e.className="simpleLink";e.href="#";e.onclick=function(){setAirplaneFilter({attribute:"vs",
attributeType:"num",operator:"inf",str:"0"})};e.appendChild(document.createTextNode("Apply"));b.appendChild(e);b.appendChild(document.createElement("br"));b.appendChild(document.createTextNode("Altitude > 2000 : "));e=document.createElement("a");e.className="simpleLink";e.href="#";e.onclick=function(){setAirplaneFilter({attribute:"al",attributeType:"num",operator:"sup",str:"2000"})};e.appendChild(document.createTextNode("Apply"));b.appendChild(e);b.appendChild(document.createElement("br"));b.appendChild(document.createTextNode("Airplanes from RyanAir (RYR) : "));
e=document.createElement("a");e.className="simpleLink";e.href="#";e.onclick=function(){setAirplaneFilter({attribute:"cs",attributeType:"str",operator:"equal",str:"RYR"})};e.appendChild(document.createTextNode("Apply"));b.appendChild(e);b.appendChild(document.createElement("br"));b.appendChild(document.createTextNode("Airplanes from/to London Heathrow Airport (LHR) : "));e=document.createElement("a");e.className="simpleLink";e.href="#";e.onclick=function(){setAirplaneFilter({attribute:"da",attributeType:"str",
operator:"equal",str:"LHR"})};e.appendChild(document.createTextNode("Apply"));b.appendChild(e)};if(typeof dd_domreadycheck=="undefined")var dd_domreadycheck=false;
var anylinkmenu={menusmap:{},preloadimages:[],effects:{delayhide:200,shadow:{enabled:true,opacity:0.3,depth:[5,5]},fade:{enabled:false,duration:500}},dimensions:{},getoffset:function(b,c){return b.offsetParent?b[c]+this.getoffset(b.offsetParent,c):b[c]},getoffsetof:function(b){b._offsets={left:this.getoffset(b,"offsetLeft"),top:this.getoffset(b,"offsetTop"),h:b.offsetHeight}},getdimensions:function(b){this.dimensions={anchorw:b.anchorobj.offsetWidth,anchorh:b.anchorobj.offsetHeight,docwidth:(window.innerWidth||
this.standardbody.clientWidth)-20,docheight:(window.innerHeight||this.standardbody.clientHeight)-15,docscrollx:window.pageXOffset||this.standardbody.scrollLeft,docscrolly:window.pageYOffset||this.standardbody.scrollTop};if(!this.dimensions.dropmenuw){this.dimensions.dropmenuw=b.dropmenu.offsetWidth;this.dimensions.dropmenuh=b.dropmenu.offsetHeight}},isContained:function(b,c){c=window.event||c;for(c=c.relatedTarget||(c.type=="mouseover"?c.fromElement:c.toElement);c&&c!=b;)try{c=c.parentNode}catch(d){c=
b}return c==b?true:false},setopacity:function(b,c){b.style.opacity=c;if(typeof b.style.opacity!="string"){b.style.MozOpacity=c;if(b.filters)b.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity="+c*100+")"}},showmenu:function(b){var c=anylinkmenu.menusmap[b];clearTimeout(c.hidetimer);this.getoffsetof(c.anchorobj);this.getdimensions(c);var d=c.anchorobj._offsets.left+(c.orientation=="lr"?this.dimensions.anchorw:0),e=c.anchorobj._offsets.top+this.dimensions.anchorh-(c.orientation=="lr"?this.dimensions.anchorh:
0);if(d+this.dimensions.dropmenuw+this.effects.shadow.depth[0]>this.dimensions.docscrollx+this.dimensions.docwidth)d=d-this.dimensions.dropmenuw+(c.orientation=="lr"?-this.dimensions.anchorw:this.dimensions.anchorw);if(e+this.dimensions.dropmenuh>this.dimensions.docscrolly+this.dimensions.docheight)e=Math.max(e-this.dimensions.dropmenuh-(c.orientation=="lr"?-this.dimensions.anchorh:this.dimensions.anchorh),this.dimensions.docscrolly);if(this.effects.fade.enabled){this.setopacity(c.dropmenu,0);this.effects.shadow.enabled&&
this.setopacity(c.shadow,0)}c.dropmenu.setcss({left:d+"px",top:e+"px",visibility:"visible"});this.effects.shadow.enabled&&c.shadow.setcss({left:d+anylinkmenu.effects.shadow.depth[0]+"px",top:e+anylinkmenu.effects.shadow.depth[1]+"px",visibility:"visible"});if(this.effects.fade.enabled){clearInterval(c.animatetimer);c.curanimatedegree=0;c.starttime=(new Date).getTime();c.animatetimer=setInterval(function(){anylinkmenu.revealmenu(b)},20)}},revealmenu:function(b){b=anylinkmenu.menusmap[b];var c=(new Date).getTime()-
b.starttime;if(c<this.effects.fade.duration){this.setopacity(b.dropmenu,b.curanimatedegree);this.effects.shadow.enabled&&this.setopacity(b.shadow,b.curanimatedegree*this.effects.shadow.opacity)}else{clearInterval(b.animatetimer);this.setopacity(b.dropmenu,1);b.dropmenu.style.filter=""}b.curanimatedegree=(1-Math.cos(c/this.effects.fade.duration*Math.PI))/2},setcss:function(b){for(prop in b)this.style[prop]=b[prop]},setcssclass:function(b,c,d){var e=new RegExp("(^|\\s+)"+c+"($|\\s+)","ig");if(d=="check")return e.test(b.className);
else if(d=="remove")b.className=b.className.replace(e,"");else if(d=="add"&&!e.test(b.className))b.className+=" "+c},hidemenu:function(b){b=anylinkmenu.menusmap[b];clearInterval(b.animatetimer);b.dropmenu.setcss({visibility:"hidden",left:0,top:0});b.shadow.setcss({visibility:"hidden",left:0,top:0})},getElementsByClass:function(b){if(document.querySelectorAll)return document.querySelectorAll("."+b);else{b=new RegExp("(^|\\s+)"+b+"($|\\s+)","i");for(var c=[],d=document.all?document.all:document.getElementsByTagName("*"),
e=0;e<d.length;e++)if(typeof d[e].className=="string"&&d[e].className.search(b)!=-1)c[c.length]=d[e];return c}},addDiv:function(b,c,d){var e=document.createElement("div");if(b)e.id=b;e.className=c;if(d!=""&&typeof e.style.cssText=="string")e.style.cssText=d;else d!=""&&e.setAttribute("style",d);document.body.appendChild(e);return e},getmenuHTML:function(b){for(var c=[],d="",e=0;e<b.items.length;e++){d+=b.items[e][1]!=undefined?'<li><a style="padding-left:'+b.items[e][2]+'px;" href="'+b.items[e][1]+
'" target="'+b.linktarget+'">'+b.items[e][0]+"</a></li>\n":'<li style="padding-left:'+b.items[e][2]+'px;">'+b.items[e][0]+"</li>\n";if(b.items[e][2]=="efc"||e==b.items.length-1){c.push(d);d=""}}if(typeof b.cols=="undefined")return"<ul>\n"+c.join("")+"\n</ul>";else{d="";for(e=0;e<c.length;e++)d+='<div class="'+b.cols.divclass+'" style="'+b.cols.inlinestyle+'">\n<ul>\n'+c[e]+"</ul>\n</div>\n";return d}},addEvent:function(b,c,d){if(b.length>0){var e=b.shift();if(e.addEventListener)e.addEventListener(d,
c,false);else e.attachEvent&&e.attachEvent("on"+d,function(){return c.call(e,window.event)});this.addEvent(b,c,d)}},domready:function(b){if(dd_domreadycheck)b();else{if(document.addEventListener)document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);b();dd_domreadycheck=true},false);else document.attachEvent&&document.documentElement.doScroll&&window==window.top&&function(){if(!dd_domreadycheck){try{document.documentElement.doScroll("left")}catch(c){setTimeout(arguments.callee,
0);return}b();dd_domreadycheck=true}}();document.attachEvent&&parent.length>0&&this.addEvent(window,function(){b()},"load")}},addState:function(b,c){if(b.getAttribute("data-image")){var d=b.tagName=="IMG"?b:b.getElementsByTagName("img")[0];if(d)d.src=c=="add"?b.getAttribute("data-overimage"):b.getAttribute("data-image")}else anylinkmenu.setcssclass(b,"selectedanchor",c)},addState:function(b,c){if(b.getAttribute("data-image")){var d=b.tagName=="IMG"?b:b.getElementsByTagName("img")[0];if(d)d.src=c==
"add"?b.getAttribute("data-overimage"):b.getAttribute("data-image")}else anylinkmenu.setcssclass(b,"selectedanchor",c)},setupmenu:function(b,c,d){this.standardbody=document.compatMode=="CSS1Compat"?document.documentElement:document.body;var e=c.getAttribute("rel");dropmenuid=e.replace(/\[(\w+)\]/,"");var f=window[dropmenuid],g=this.addDiv(null,f.divclass,f.inlinestyle);g.innerHTML=this.getmenuHTML(f);c=this.menusmap[b+d]={id:b+d,anchorobj:c,dropmenu:g,revealtype:e.length!=dropmenuid.length&&RegExp.$1==
"click"?"click":"mouseover",orientation:c.getAttribute("rev")=="lr"?"lr":"ud",shadow:this.addDiv(null,"anylinkshadow",null)};c.anchorobj._internalID=b+d;c.anchorobj._isanchor=true;c.dropmenu._internalID=b+d;c.shadow._internalID=b+d;c.dropmenu.setcss=this.setcss;c.shadow.setcss=this.setcss;c.shadow.setcss({width:c.dropmenu.offsetWidth+"px",height:c.dropmenu.offsetHeight+"px"});this.setopacity(c.shadow,this.effects.shadow.opacity);this.addEvent([c.anchorobj,c.dropmenu,c.shadow],function(j){var h=anylinkmenu.menusmap[this._internalID];
if(this._isanchor&&h.revealtype=="mouseover"&&!anylinkmenu.isContained(this,j)){anylinkmenu.showmenu(h.id);anylinkmenu.addState(this,"add")}else typeof this._isanchor=="undefined"&&clearTimeout(h.hidetimer)},"mouseover");this.addEvent([c.anchorobj,c.dropmenu,c.shadow],function(j){if(!anylinkmenu.isContained(this,j)){var h=anylinkmenu.menusmap[this._internalID];h.hidetimer=setTimeout(function(){anylinkmenu.addState(h.anchorobj,"remove");anylinkmenu.hidemenu(h.id)},anylinkmenu.effects.delayhide)}},
"mouseout");this.addEvent([c.anchorobj],function(j){var h=anylinkmenu.menusmap[this._internalID];if(this._isanchor&&h.revealtype=="click"){if(h.dropmenu.style.visibility=="visible")anylinkmenu.hidemenu(h.id);else{anylinkmenu.addState(this,"add");anylinkmenu.showmenu(h.id)}j.preventDefault&&j.preventDefault();return false}else h.hidetimer=setTimeout(function(){anylinkmenu.hidemenu(h.id)},anylinkmenu.effects.delayhide)},"click")},init:function(b){this.domready(function(){anylinkmenu.trueinit(b)})},
trueinit:function(b){for(var c=this.getElementsByClass(b),d=this.preloadimages,e=0;e<c.length;e++){if(c[e].getAttribute("data-image")){d[d.length]=new Image;d[d.length-1].src=c[e].getAttribute("data-image")}if(c[e].getAttribute("data-overimage")){d[d.length]=new Image;d[d.length-1].src=c[e].getAttribute("data-overimage")}this.setupmenu(b,c[e],e)}}};function getItemArrayFromTravelPlaces(b,c,d){for(var e=[],f=c*d,g=0;g<b.length;g++){var j=b[g],h=j.name,l=j.position,r=j.zoomLevel,v=undefined;if(l!=undefined)v="javascript:travelTo('"+h+"',"+l[0]+","+l[1]+","+r+")";e.push([h,v,f]);if(j.subLinks!=undefined)e=e.concat(getItemArrayFromTravelPlaces(j.subLinks,c,d+1))}return e}var directLinkMenu={divclass:"anylinkmenu",inlinestyle:"width:150px; background:#F8F8F8; border: 0px solid black; font-size:12px; padding:5px 5px 5px 5px;",linktarget:""};
directLinkMenu.items=getItemArrayFromTravelPlaces(travelPlaces,10,0);linkMenu={divclass:"anylinkmenu",inlinestyle:"width:300px; background:#F8F8F8; border: 0px solid black; font-size:12px; padding:5px 5px 5px 5px;",linktarget:""};linkMenu.items=[[$("linkContent").innerHTML]];gettingStartedMenu={divclass:"anylinkmenu",inlinestyle:"width:350px; background:#F8F8F8; border: 0px solid black; font-size:12px; padding:5px 5px 5px 5px;",linktarget:""};gettingStartedMenu.items=[[$("startContent").innerHTML]];
newsMenu={divclass:"anylinkmenu",inlinestyle:"width:350px; background:#F8F8F8; border: 0px solid black; font-size:12px; padding:5px 5px 5px 5px;",linktarget:""};newsMenu.items=[[$("newsContent").innerHTML]];contributeMenu={divclass:"anylinkmenu",inlinestyle:"width:350px; background:#F8F8F8; border: 0px solid black; font-size:12px; padding:5px 5px 5px 5px;",linktarget:""};contributeMenu.items=[[$("contributeContent").innerHTML]];
shopMenu={divclass:"anylinkmenu",inlinestyle:"width:350px; background:#F8F8F8; border: 0px solid black; font-size:12px; padding:5px 5px 5px 5px;",linktarget:""};shopMenu.items=[[$("shopContent").innerHTML]];aboutMenu={divclass:"anylinkmenu",inlinestyle:"width:350px; background:#F8F8F8; border: 0px solid black; font-size:12px; padding:5px 5px 5px 5px;",linktarget:""};aboutMenu.items=[[$("aboutContent").innerHTML]];anylinkmenu.init("menuanchorclass");
