impress/public/assets/prototype.js

10 lines
No EOL
77 KiB
JavaScript

/* Prototype JavaScript framework, version 1.6.1
* (c) 2005-2009 Sam Stephenson
*
* Prototype is freely distributable under the terms of an MIT-style license.
* For details, see the Prototype web site: http://www.prototypejs.org/
*
*--------------------------------------------------------------------------*/
function $A(e){if(!e)return[];if("toArray"in Object(e))return e.toArray();var t=e.length||0,n=new Array(t);while(t--)n[t]=e[t];return n}function $w(e){return Object.isString(e)?(e=e.strip(),e?e.split(/\s+/):[]):[]}function $H(e){return new Hash(e)}function $R(e,t,n){return new ObjectRange(e,t,n)}function $(e){if(arguments.length>1){for(var t=0,n=[],r=arguments.length;t<r;t++)n.push($(arguments[t]));return n}return Object.isString(e)&&(e=document.getElementById(e)),Element.extend(e)}function $$(){return Selector.findChildElements(document,$A(arguments))}var Prototype={Version:"1.6.1",Browser:function(){var e=navigator.userAgent,t=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!t,Opera:t,WebKit:e.indexOf("AppleWebKit/")>-1,Gecko:e.indexOf("Gecko")>-1&&e.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile.*Safari/.test(e)}}(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:function(){var e=window.Element||window.HTMLElement;return!!e&&!!e.prototype}(),SpecificElementExtensions:function(){if(typeof window.HTMLDivElement!="undefined")return!0;var e=document.createElement("div"),t=document.createElement("form"),n=!1;return e.__proto__&&e.__proto__!==t.__proto__&&(n=!0),e=t=null,n}()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)</script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(e){return e}};Prototype.Browser.MobileSafari&&(Prototype.BrowserFeatures.SpecificElementExtensions=!1);var Abstract={},Try={these:function(){var e;for(var t=0,n=arguments.length;t<n;t++){var r=arguments[t];try{e=r();break}catch(i){}}return e}},Class=function(){function e(){}function t(){function r(){this.initialize.apply(this,arguments)}var t=null,n=$A(arguments);Object.isFunction(n[0])&&(t=n.shift()),Object.extend(r,Class.Methods),r.superclass=t,r.subclasses=[],t&&(e.prototype=t.prototype,r.prototype=new e,t.subclasses.push(r));for(var i=0;i<n.length;i++)r.addMethods(n[i]);return r.prototype.initialize||(r.prototype.initialize=Prototype.emptyFunction),r.prototype.constructor=r,r}function n(e){var t=this.superclass&&this.superclass.prototype,n=Object.keys(e);Object.keys({toString:!0}).length||(e.toString!=Object.prototype.toString&&n.push("toString"),e.valueOf!=Object.prototype.valueOf&&n.push("valueOf"));for(var r=0,i=n.length;r<i;r++){var s=n[r],o=e[s];if(t&&Object.isFunction(o)&&o.argumentNames().first()=="$super"){var u=o;o=function(e){return function(){return t[e].apply(this,arguments)}}(s).wrap(u),o.valueOf=u.valueOf.bind(u),o.toString=u.toString.bind(u)}this.prototype[s]=o}return this}return{create:t,Methods:{addMethods:n}}}();(function(){function t(e,t){for(var n in t)e[n]=t[n];return e}function n(e){try{return v(e)?"undefined":e===null?"null":e.inspect?e.inspect():String(e)}catch(t){if(t instanceof RangeError)return"...";throw t}}function r(e){var t=typeof e;switch(t){case"undefined":case"function":case"unknown":return;case"boolean":return e.toString()}if(e===null)return"null";if(e.toJSON)return e.toJSON();if(f(e))return;var n=[];for(var i in e){var s=r(e[i]);v(s)||n.push(i.toJSON()+": "+s)}return"{"+n.join(", ")+"}"}function i(e){return $H(e).toQueryString()}function s(e){return e&&e.toHTML?e.toHTML():String.interpret(e)}function o(e){var t=[];for(var n in e)t.push(n);return t}function u(e){var t=[];for(var n in e)t.push(e[n]);return t}function a(e){return t({},e)}function f(e){return!!e&&e.nodeType==1}function l(t){return e.call(t)=="[object Array]"}function c(e){return e instanceof Hash}function h(e){return typeof e=="function"}function p(t){return e.call(t)=="[object String]"}function d(t){return e.call(t)=="[object Number]"}function v(e){return typeof e=="undefined"}var e=Object.prototype.toString;t(Object,{extend:t,inspect:n,toJSON:r,toQueryString:i,toHTML:s,keys:o,values:u,clone:a,isElement:f,isArray:l,isHash:c,isFunction:h,isString:p,isNumber:d,isUndefined:v})})(),Object.extend(Function.prototype,function(){function t(e,t){var n=e.length,r=t.length;while(r--)e[n+r]=t[r];return e}function n(n,r){return n=e.call(n,0),t(n,r)}function r(){var e=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g,"").replace(/\s+/g,"").split(",");return e.length==1&&!e[0]?[]:e}function i(t){if(arguments.length<2&&Object.isUndefined(arguments[0]))return this;var r=this,i=e.call(arguments,1);return function(){var e=n(i,arguments);return r.apply(t,e)}}function s(n){var r=this,i=e.call(arguments,1);return function(e){var s=t([e||window.event],i);return r.apply(n,s)}}function o(){if(!arguments.length)return this;var t=this,r=e.call(arguments,0);return function(){var e=n(r,arguments);return t.apply(this,e)}}function u(t){var n=this,r=e.call(arguments,1);return t*=1e3,window.setTimeout(function(){return n.apply(n,r)},t)}function a(){var e=t([.01],arguments);return this.delay.apply(this,e)}function f(e){var n=this;return function(){var r=t([n.bind(this)],arguments);return e.apply(this,r)}}function l(){if(this._methodized)return this._methodized;var e=this;return this._methodized=function(){var n=t([this],arguments);return e.apply(null,n)}}var e=Array.prototype.slice;return{argumentNames:r,bind:i,bindAsEventListener:s,curry:o,delay:u,defer:a,wrap:f,methodize:l}}()),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(e){return String(e).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};var PeriodicalExecuter=Class.create({initialize:function(e,t){this.callback=e,this.frequency=t,this.currentlyExecuting=!1,this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1e3)},execute:function(){this.callback(this)},stop:function(){if(!this.timer)return;clearInterval(this.timer),this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting)try{this.currentlyExecuting=!0,this.execute(),this.currentlyExecuting=!1}catch(e){throw this.currentlyExecuting=!1,e}}});Object.extend(String,{interpret:function(e){return e==null?"":String(e)},specialChar:{"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}}),Object.extend(String.prototype,function(){function prepareReplacement(e){if(Object.isFunction(e))return e;var t=new Template(e);return function(e){return t.evaluate(e)}}function gsub(e,t){var n="",r=this,i;t=prepareReplacement(t),Object.isString(e)&&(e=RegExp.escape(e));if(!e.length&&!e.source)return t=t(""),t+r.split("").join(t)+t;while(r.length>0)(i=r.match(e))?(n+=r.slice(0,i.index),n+=String.interpret(t(i)),r=r.slice(i.index+i[0].length)):(n+=r,r="");return n}function sub(e,t,n){return t=prepareReplacement(t),n=Object.isUndefined(n)?1:n,this.gsub(e,function(e){return--n<0?e[0]:t(e)})}function scan(e,t){return this.gsub(e,t),String(this)}function truncate(e,t){return e=e||30,t=Object.isUndefined(t)?"...":t,this.length>e?this.slice(0,e-t.length)+t:String(this)}function strip(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}function stripTags(){return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,"")}function stripScripts(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")}function extractScripts(){var e=new RegExp(Prototype.ScriptFragment,"img"),t=new RegExp(Prototype.ScriptFragment,"im");return(this.match(e)||[]).map(function(e){return(e.match(t)||["",""])[1]})}function evalScripts(){return this.extractScripts().map(function(script){return eval(script)})}function escapeHTML(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function unescapeHTML(){return this.stripTags().replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}function toQueryParams(e){var t=this.strip().match(/([^?#]*)(#.*)?$/);return t?t[1].split(e||"&").inject({},function(e,t){if((t=t.split("="))[0]){var n=decodeURIComponent(t.shift()),r=t.length>1?t.join("="):t[0];r!=undefined&&(r=decodeURIComponent(r)),n in e?(Object.isArray(e[n])||(e[n]=[e[n]]),e[n].push(r)):e[n]=r}return e}):{}}function toArray(){return this.split("")}function succ(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)}function times(e){return e<1?"":(new Array(e+1)).join(this)}function camelize(){var e=this.split("-"),t=e.length;if(t==1)return e[0];var n=this.charAt(0)=="-"?e[0].charAt(0).toUpperCase()+e[0].substring(1):e[0];for(var r=1;r<t;r++)n+=e[r].charAt(0).toUpperCase()+e[r].substring(1);return n}function capitalize(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()}function underscore(){return this.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/-/g,"_").toLowerCase()}function dasherize(){return this.replace(/_/g,"-")}function inspect(e){var t=this.replace(/[\x00-\x1f\\]/g,function(e){return e in String.specialChar?String.specialChar[e]:"\\u00"+e.charCodeAt().toPaddedString(2,16)});return e?'"'+t.replace(/"/g,'\\"')+'"':"'"+t.replace(/'/g,"\\'")+"'"}function toJSON(){return this.inspect(!0)}function unfilterJSON(e){return this.replace(e||Prototype.JSONFilter,"$1")}function isJSON(){var e=this;return e.blank()?!1:(e=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,""),/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/.test(e))}function evalJSON(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON())return eval("("+json+")")}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())}function include(e){return this.indexOf(e)>-1}function startsWith(e){return this.indexOf(e)===0}function endsWith(e){var t=this.length-e.length;return t>=0&&this.lastIndexOf(e)===t}function empty(){return this==""}function blank(){return/^\s*$/.test(this)}function interpolate(e,t){return(new Template(this,t)).evaluate(e)}return{gsub:gsub,sub:sub,scan:scan,truncate:truncate,strip:String.prototype.trim?String.prototype.trim:strip,stripTags:stripTags,stripScripts:stripScripts,extractScripts:extractScripts,evalScripts:evalScripts,escapeHTML:escapeHTML,unescapeHTML:unescapeHTML,toQueryParams:toQueryParams,parseQuery:toQueryParams,toArray:toArray,succ:succ,times:times,camelize:camelize,capitalize:capitalize,underscore:underscore,dasherize:dasherize,inspect:inspect,toJSON:toJSON,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:evalJSON,include:include,startsWith:startsWith,endsWith:endsWith,empty:empty,blank:blank,interpolate:interpolate}}());var Template=Class.create({initialize:function(e,t){this.template=e.toString(),this.pattern=t||Template.Pattern},evaluate:function(e){return e&&Object.isFunction(e.toTemplateReplacements)&&(e=e.toTemplateReplacements()),this.template.gsub(this.pattern,function(t){if(e==null)return t[1]+"";var n=t[1]||"";if(n=="\\")return t[2];var r=e,i=t[3],s=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;t=s.exec(i);if(t==null)return n;while(t!=null){var o=t[1].startsWith("[")?t[2].replace(/\\\\]/g,"]"):t[1];r=r[o];if(null==r||""==t[3])break;i=i.substring("["==t[3]?t[1].length:t[0].length),t=s.exec(i)}return n+String.interpret(r)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={},Enumerable=function(){function e(e,t){var n=0;try{this._each(function(r){e.call(t,r,n++)})}catch(r){if(r!=$break)throw r}return this}function t(e,t,n){var r=-e,i=[],s=this.toArray();if(e<1)return s;while((r+=e)<s.length)i.push(s.slice(r,r+e));return i.collect(t,n)}function n(e,t){e=e||Prototype.K;var n=!0;return this.each(function(r,i){n=n&&!!e.call(t,r,i);if(!n)throw $break}),n}function r(e,t){e=e||Prototype.K;var n=!1;return this.each(function(r,i){if(n=!!e.call(t,r,i))throw $break}),n}function i(e,t){e=e||Prototype.K;var n=[];return this.each(function(r,i){n.push(e.call(t,r,i))}),n}function s(e,t){var n;return this.each(function(r,i){if(e.call(t,r,i))throw n=r,$break}),n}function o(e,t){var n=[];return this.each(function(r,i){e.call(t,r,i)&&n.push(r)}),n}function u(e,t,n){t=t||Prototype.K;var r=[];return Object.isString(e)&&(e=new RegExp(RegExp.escape(e))),this.each(function(i,s){e.match(i)&&r.push(t.call(n,i,s))}),r}function a(e){if(Object.isFunction(this.indexOf)&&this.indexOf(e)!=-1)return!0;var t=!1;return this.each(function(n){if(n==e)throw t=!0,$break}),t}function f(e,t){return t=Object.isUndefined(t)?null:t,this.eachSlice(e,function(n){while(n.length<e)n.push(t);return n})}function l(e,t,n){return this.each(function(r,i){e=t.call(n,e,r,i)}),e}function c(e){var t=$A(arguments).slice(1);return this.map(function(n){return n[e].apply(n,t)})}function h(e,t){e=e||Prototype.K;var n;return this.each(function(r,i){r=e.call(t,r,i);if(n==null||r>=n)n=r}),n}function p(e,t){e=e||Prototype.K;var n;return this.each(function(r,i){r=e.call(t,r,i);if(n==null||r<n)n=r}),n}function d(e,t){e=e||Prototype.K;var n=[],r=[];return this.each(function(i,s){(e.call(t,i,s)?n:r).push(i)}),[n,r]}function v(e){var t=[];return this.each(function(n){t.push(n[e])}),t}function m(e,t){var n=[];return this.each(function(r,i){e.call(t,r,i)||n.push(r)}),n}function g(e,t){return this.map(function(n,r){return{value:n,criteria:e.call(t,n,r)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;return n<r?-1:n>r?1:0}).pluck("value")}function y(){return this.map()}function b(){var e=Prototype.K,t=$A(arguments);Object.isFunction(t.last())&&(e=t.pop());var n=[this].concat(t).map($A);return this.map(function(t,r){return e(n.pluck(r))})}function w(){return this.toArray().length}function E(){return"#<Enumerable:"+this.toArray().inspect()+">"}return{each:e,eachSlice:t,all:n,every:n,any:r,some:r,collect:i,map:i,detect:s,findAll:o,select:o,filter:o,grep:u,include:a,member:a,inGroupsOf:f,inject:l,invoke:c,max:h,min:p,partition:d,pluck:v,reject:m,sortBy:g,toArray:y,entries:y,zip:b,size:w,inspect:E,find:s}}();Array.from=$A,function(){function r(e){for(var t=0,n=this.length;t<n;t++)e(this[t])}function i(){return this.length=0,this}function s(){return this[0]}function o(){return this[this.length-1]}function u(){return this.select(function(e){return e!=null})}function a(){return this.inject([],function(e,t){return Object.isArray(t)?e.concat(t.flatten()):(e.push(t),e)})}function f(){var e=t.call(arguments,0);return this.select(function(t){return!e.include(t)})}function l(e){return(e!==!1?this:this.toArray())._reverse()}function c(e){return this.inject([],function(t,n,r){return(0==r||(e?t.last()!=n:!t.include(n)))&&t.push(n),t})}function h(e){return this.uniq().findAll(function(t){return e.detect(function(e){return t===e})})}function p(){return t.call(this,0)}function d(){return this.length}function v(){return"["+this.map(Object.inspect).join(", ")+"]"}function m(){var e=[];return this.each(function(t){var n=Object.toJSON(t);Object.isUndefined(n)||e.push(n)}),"["+e.join(", ")+"]"}function g(e,t){t||(t=0);var n=this.length;t<0&&(t=n+t);for(;t<n;t++)if(this[t]===e)return t;return-1}function y(e,t){t=isNaN(t)?this.length:(t<0?this.length+t:t)+1;var n=this.slice(0,t).reverse().indexOf(e);return n<0?n:t-n-1}function b(){var e=t.call(this,0),n;for(var r=0,i=arguments.length;r<i;r++){n=arguments[r];if(!Object.isArray(n)||"callee"in n)e.push(n);else for(var s=0,o=n.length;s<o;s++)e.push(n[s])}return e}var e=Array.prototype,t=e.slice,n=e.forEach;n||(n=r),Object.extend(e,Enumerable),e._reverse||(e._reverse=e.reverse),Object.extend(e,{_each:n,clear:i,first:s,last:o,compact:u,flatten:a,without:f,reverse:l,uniq:c,intersect:h,clone:p,toArray:p,size:d,inspect:v,toJSON:m});var w=function(){return[].concat(arguments)[0][0]!==1}(1,2);w&&(e.concat=b),e.indexOf||(e.indexOf=g),e.lastIndexOf||(e.lastIndexOf=y)}();var Hash=Class.create(Enumerable,function(){function e(e){this._object=Object.isHash(e)?e.toObject():Object.clone(e)}function t(e){for(var t in this._object){var n=this._object[t],r=[t,n];r.key=t,r.value=n,e(r)}}function n(e,t){return this._object[e]=t}function r(e){if(this._object[e]!==Object.prototype[e])return this._object[e]}function i(e){var t=this._object[e];return delete this._object[e],t}function s(){return Object.clone(this._object)}function o(){return this.pluck("key")}function u(){return this.pluck("value")}function a(e){var t=this.detect(function(t){return t.value===e});return t&&t.key}function f(e){return this.clone().update(e)}function l(e){return(new Hash(e)).inject(this,function(e,t){return e.set(t.key,t.value),e})}function c(e,t){return Object.isUndefined(t)?e:e+"="+encodeURIComponent(String.interpret(t))}function h(){return this.inject([],function(e,t){var n=encodeURIComponent(t.key),r=t.value;if(r&&typeof r=="object"){if(Object.isArray(r))return e.concat(r.map(c.curry(n)))}else e.push(c(n,r));return e}).join("&")}function p(){return"#<Hash:{"+this.map(function(e){return e.map(Object.inspect).join(": ")}).join(", ")+"}>"}function d(){return Object.toJSON(this.toObject())}function v(){return new Hash(this)}return{initialize:e,_each:t,set:n,get:r,unset:i,toObject:s,toTemplateReplacements:s,keys:o,values:u,index:a,merge:f,update:l,toQueryString:h,inspect:p,toJSON:d,clone:v}}());Hash.from=$H,Object.extend(Number.prototype,function(){function e(){return this.toPaddedString(2,16)}function t(){return this+1}function n(e,t){return $R(0,this,!0).each(e,t),this}function r(e,t){var n=this.toString(t||10);return"0".times(e-n.length)+n}function i(){return isFinite(this)?this.toString():"null"}function s(){return Math.abs(this)}function o(){return Math.round(this)}function u(){return Math.ceil(this)}function a(){return Math.floor(this)}return{toColorPart:e,succ:t,times:n,toPaddedString:r,toJSON:i,abs:s,round:o,ceil:u,floor:a}}());var ObjectRange=Class.create(Enumerable,function(){function e(e,t,n){this.start=e,this.end=t,this.exclusive=n}function t(e){var t=this.start;while(this.include(t))e(t),t=t.succ()}function n(e){return e<this.start?!1:this.exclusive?e<this.end:e<=this.end}return{initialize:e,_each:t,include:n}}()),Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||!1},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(e){this.responders._each(e)},register:function(e){this.include(e)||this.responders.push(e)},unregister:function(e){this.responders=this.responders.without(e)},dispatch:function(e,t,n,r){this.each(function(i){if(Object.isFunction(i[e]))try{i[e].apply(i,[t,n,r])}catch(s){}})}},Object.extend(Ajax.Responders,Enumerable),Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}}),Ajax.Base=Class.create({initialize:function(e){this.options={method:"post",asynchronous:!0,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:!0,evalJS:!0},Object.extend(this.options,e||{}),this.options.method=this.options.method.toLowerCase(),Object.isString(this.options.parameters)?this.options.parameters=this.options.parameters.toQueryParams():Object.isHash(this.options.parameters)&&(this.options.parameters=this.options.parameters.toObject())}}),Ajax.Request=Class.create(Ajax.Base,{_complete:!1,initialize:function($super,e,t){$super(t),this.transport=Ajax.getTransport(),this.request(e)},request:function(e){this.url=e,this.method=this.options.method;var t=Object.clone(this.options.parameters);["get","post"].include(this.method)||(t._method=this.method,this.method="post"),this.parameters=t;if(t=Object.toQueryString(t))this.method=="get"?this.url+=(this.url.include("?")?"&":"?")+t:/Konqueror|Safari|KHTML/.test(navigator.userAgent)&&(t+="&_=");try{var n=new Ajax.Response(this);this.options.onCreate&&this.options.onCreate(n),Ajax.Responders.dispatch("onCreate",this,n),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||t:null,this.transport.send(this.body),!this.options.asynchronous&&this.transport.overrideMimeType&&this.onStateChange()}catch(r){this.dispatchException(r)}},onStateChange:function(){var e=this.transport.readyState;e>1&&(e!=4||!this._complete)&&this.respondToReadyState(this.transport.readyState)},setRequestHeaders:function(){var e={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};this.method=="post"&&(e["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:""),this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005&&(e.Connection="close"));if(typeof this.options.requestHeaders=="object"){var t=this.options.requestHeaders;if(Object.isFunction(t.push))for(var n=0,r=t.length;n<r;n+=2)e[t[n]]=t[n+1];else $H(t).each(function(t){e[t.key]=t.value})}for(var i in e)this.transport.setRequestHeader(i,e[i])},success:function(){var e=this.getStatus();return!e||e>=200&&e<300},getStatus:function(){try{return this.transport.status||0}catch(e){return 0}},respondToReadyState:function(e){var t=Ajax.Request.Events[e],n=new Ajax.Response(this);if(t=="Complete"){try{this._complete=!0,(this.options["on"+n.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(n,n.headerJSON)}catch(r){this.dispatchException(r)}var i=n.getHeader("Content-type");(this.options.evalJS=="force"||this.options.evalJS&&this.isSameOrigin()&&i&&i.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))&&this.evalResponse()}try{(this.options["on"+t]||Prototype.emptyFunction)(n,n.headerJSON),Ajax.Responders.dispatch("on"+t,this,n,n.headerJSON)}catch(r){this.dispatchException(r)}t=="Complete"&&(this.transport.onreadystatechange=Prototype.emptyFunction)},isSameOrigin:function(){var e=this.url.match(/^\s*https?:\/\/[^\/]*/);return!e||e[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""})},getHeader:function(e){try{return this.transport.getResponseHeader(e)||null}catch(t){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(e){(this.options.onException||Prototype.emptyFunction)(this,e),Ajax.Responders.dispatch("onException",this,e)}}),Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"],Ajax.Response=Class.create({initialize:function(e){this.request=e;var t=this.transport=e.transport,n=this.readyState=t.readyState;if(n>2&&!Prototype.Browser.IE||n==4)this.status=this.getStatus(),this.statusText=this.getStatusText(),this.responseText=String.interpret(t.responseText),this.headerJSON=this._getHeaderJSON();if(n==4){var r=t.responseXML;this.responseXML=Object.isUndefined(r)?null:r,this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""}catch(e){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(e){return null}},getResponseHeader:function(e){return this.transport.getResponseHeader(e)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var e=this.getHeader("X-JSON");if(!e)return null;e=decodeURIComponent(escape(e));try{return e.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(t){this.request.dispatchException(t)}},_getResponseJSON:function(){var e=this.request.options;if(!e.evalJSON||e.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json")||this.responseText.blank())return null;try{return this.responseText.evalJSON(e.sanitizeJSON||!this.request.isSameOrigin())}catch(t){this.request.dispatchException(t)}}}),Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,e,t,n){this.container={success:e.success||e,failure:e.failure||(e.success?null:e)},n=Object.clone(n);var r=n.onComplete;n.onComplete=function(e,t){this.updateContent(e.responseText),Object.isFunction(r)&&r(e,t)}.bind(this),$super(t,n)},updateContent:function(e){var t=this.container[this.success()?"success":"failure"],n=this.options;n.evalScripts||(e=e.stripScripts());if(t=$(t))if(n.insertion)if(Object.isString(n.insertion)){var r={};r[n.insertion]=e,t.insert(r)}else n.insertion(t,e);else t.update(e)}}),Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,e,t,n){$super(n),this.onComplete=this.options.onComplete,this.frequency=this.options.frequency||2,this.decay=this.options.decay||1,this.updater={},this.container=e,this.url=t,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(e){this.options.decay&&(this.decay=e.responseText==this.lastText?this.decay*this.options.decay:1,this.lastText=e.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)}}),Prototype.BrowserFeatures.XPath&&(document._getElementsByXPath=function(e,t){var n=[],r=document.evaluate(e,$(t)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var i=0,s=r.snapshotLength;i<s;i++)n.push(Element.extend(r.snapshotItem(i)));return n});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(e){var t=function(){var e=document.createElement("form"),t=document.createElement("input"),n=document.documentElement;t.setAttribute("name","test"),e.appendChild(t),n.appendChild(e);var r=e.elements?typeof e.elements.test=="undefined":null;return n.removeChild(e),e=t=null,r}(),n=e.Element;e.Element=function(e,n){n=n||{},e=e.toLowerCase();var r=Element.cache;return t&&n.name?(e="<"+e+' name="'+n.name+'">',delete n.name,Element.writeAttribute(document.createElement(e),n)):(r[e]||(r[e]=Element.extend(document.createElement(e))),Element.writeAttribute(r[e].cloneNode(!1),n))},Object.extend(e.Element,n||{}),n&&(e.Element.prototype=n.prototype)}(this),Element.cache={},Element.idCounter=1,Element.Methods={visible:function(e){return $(e).style.display!="none"},toggle:function(e){return e=$(e),Element[Element.visible(e)?"hide":"show"](e),e},hide:function(e){return e=$(e),e.style.display="none",e},show:function(e){return e=$(e),e.style.display="",e},remove:function(e){return e=$(e),e.parentNode.removeChild(e),e},update:function(){function r(r,i){r=$(r),i&&i.toElement&&(i=i.toElement());if(Object.isElement(i))return r.update().insert(i);i=Object.toHTML(i);var s=r.tagName.toUpperCase();if(s==="SCRIPT"&&n)return r.text=i,r;if(e||t)if(s in Element._insertionTranslations.tags){while(r.firstChild)r.removeChild(r.firstChild);Element._getContentFromAnonymousElement(s,i.stripScripts()).each(function(e){r.appendChild(e)})}else r.innerHTML=i.stripScripts();else r.innerHTML=i.stripScripts();return i.evalScripts.bind(i).defer(),r}var e=function(){var e=document.createElement("select"),t=!0;return e.innerHTML='<option value="test">test</option>',e.options&&e.options[0]&&(t=e.options[0].nodeName.toUpperCase()!=="OPTION"),e=null,t}(),t=function(){try{var e=document.createElement("table");if(e&&e.tBodies){e.innerHTML="<tbody><tr><td>test</td></tr></tbody>";var t=typeof e.tBodies[0]=="undefined";return e=null,t}}catch(n){return!0}}(),n=function(){var e=document.createElement("script"),t=!1;try{e.appendChild(document.createTextNode("")),t=!e.firstChild||e.firstChild&&e.firstChild.nodeType!==3}catch(n){t=!0}return e=null,t}();return r}(),replace:function(e,t){e=$(e);if(t&&t.toElement)t=t.toElement();else if(!Object.isElement(t)){t=Object.toHTML(t);var n=e.ownerDocument.createRange();n.selectNode(e),t.evalScripts.bind(t).defer(),t=n.createContextualFragment(t.stripScripts())}return e.parentNode.replaceChild(t,e),e},insert:function(e,t){e=$(e);if(Object.isString(t)||Object.isNumber(t)||Object.isElement(t)||t&&(t.toElement||t.toHTML))t={bottom:t};var n,r,i,s;for(var o in t){n=t[o],o=o.toLowerCase(),r=Element._insertionTranslations[o],n&&n.toElement&&(n=n.toElement());if(Object.isElement(n)){r(e,n);continue}n=Object.toHTML(n),i=(o=="before"||o=="after"?e.parentNode:e).tagName.toUpperCase(),s=Element._getContentFromAnonymousElement(i,n.stripScripts()),(o=="top"||o=="after")&&s.reverse(),s.each(r.curry(e)),n.evalScripts.bind(n).defer()}return e},wrap:function(e,t,n){return e=$(e),Object.isElement(t)?$(t).writeAttribute(n||{}):Object.isString(t)?t=new Element(t,n):t=new Element("div",t),e.parentNode&&e.parentNode.replaceChild(t,e),t.appendChild(e),t},inspect:function(e){e=$(e);var t="<"+e.tagName.toLowerCase();return $H({id:"id",className:"class"}).each(function(n){var r=n.first(),i=n.last(),s=(e[r]||"").toString();s&&(t+=" "+i+"="+s.inspect(!0))}),t+">"},recursivelyCollect:function(e,t){e=$(e);var n=[];while(e=e[t])e.nodeType==1&&n.push(Element.extend(e));return n},ancestors:function(e){return Element.recursivelyCollect(e,"parentNode")},descendants:function(e){return Element.select(e,"*")},firstDescendant:function(e){e=$(e).firstChild;while(e&&e.nodeType!=1)e=e.nextSibling;return $(e)},immediateDescendants:function(e){if(!(e=$(e).firstChild))return[];while(e&&e.nodeType!=1)e=e.nextSibling;return e?[e].concat($(e).nextSiblings()):[]},previousSiblings:function(e){return Element.recursivelyCollect(e,"previousSibling")},nextSiblings:function(e){return Element.recursivelyCollect(e,"nextSibling")},siblings:function(e){return e=$(e),Element.previousSiblings(e).reverse().concat(Element.nextSiblings(e))},match:function(e,t){return Object.isString(t)&&(t=new Selector(t)),t.match($(e))},up:function(e,t,n){e=$(e);if(arguments.length==1)return $(e.parentNode);var r=Element.ancestors(e);return Object.isNumber(t)?r[t]:Selector.findElement(r,t,n)},down:function(e,t,n){return e=$(e),arguments.length==1?Element.firstDescendant(e):Object.isNumber(t)?Element.descendants(e)[t]:Element.select(e,t)[n||0]},previous:function(e,t,n){e=$(e);if(arguments.length==1)return $(Selector.handlers.previousElementSibling(e));var r=Element.previousSiblings(e);return Object.isNumber(t)?r[t]:Selector.findElement(r,t,n)},next:function(e,t,n){e=$(e);if(arguments.length==1)return $(Selector.handlers.nextElementSibling(e));var r=Element.nextSiblings(e);return Object.isNumber(t)?r[t]:Selector.findElement(r,t,n)},select:function(e){var t=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(e,t)},adjacent:function(e){var t=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(e.parentNode,t).without(e)},identify:function(e){e=$(e);var t=Element.readAttribute(e,"id");if(t)return t;do t="anonymous_element_"+Element.idCounter++;while($(t));return Element.writeAttribute(e,"id",t),t},readAttribute:function(e,t){e=$(e);if(Prototype.Browser.IE){var n=Element._attributeTranslations.read;if(n.values[t])return n.values[t](e,t);n.names[t]&&(t=n.names[t]);if(t.include(":"))return!e.attributes||!e.attributes[t]?null:e.attributes[t].value}return e.getAttribute(t)},writeAttribute:function(e,t,n){e=$(e);var r={},i=Element._attributeTranslations.write;typeof t=="object"?r=t:r[t]=Object.isUndefined(n)?!0:n;for(var s in r)t=i.names[s]||s,n=r[s],i.values[s]&&(t=i.values[s](e,n)),n===!1||n===null?e.removeAttribute(t):n===!0?e.setAttribute(t,t):e.setAttribute(t,n);return e},getHeight:function(e){return Element.getDimensions(e).height},getWidth:function(e){return Element.getDimensions(e).width},classNames:function(e){return new Element.ClassNames(e)},hasClassName:function(e,t){if(!(e=$(e)))return;var n=e.className;return n.length>0&&(n==t||(new RegExp("(^|\\s)"+t+"(\\s|$)")).test(n))},addClassName:function(e,t){if(!(e=$(e)))return;return Element.hasClassName(e,t)||(e.className+=(e.className?" "
:"")+t),e},removeClassName:function(e,t){if(!(e=$(e)))return;return e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").strip(),e},toggleClassName:function(e,t){if(!(e=$(e)))return;return Element[Element.hasClassName(e,t)?"removeClassName":"addClassName"](e,t)},cleanWhitespace:function(e){e=$(e);var t=e.firstChild;while(t){var n=t.nextSibling;t.nodeType==3&&!/\S/.test(t.nodeValue)&&e.removeChild(t),t=n}return e},empty:function(e){return $(e).innerHTML.blank()},descendantOf:function(e,t){e=$(e),t=$(t);if(e.compareDocumentPosition)return(e.compareDocumentPosition(t)&8)===8;if(t.contains)return t.contains(e)&&t!==e;while(e=e.parentNode)if(e==t)return!0;return!1},scrollTo:function(e){e=$(e);var t=Element.cumulativeOffset(e);return window.scrollTo(t[0],t[1]),e},getStyle:function(e,t){e=$(e),t=t=="float"?"cssFloat":t.camelize();var n=e.style[t];if(!n||n=="auto"){var r=document.defaultView.getComputedStyle(e,null);n=r?r[t]:null}return t=="opacity"?n?parseFloat(n):1:n=="auto"?null:n},getOpacity:function(e){return $(e).getStyle("opacity")},setStyle:function(e,t){e=$(e);var n=e.style,r;if(Object.isString(t))return e.style.cssText+=";"+t,t.include("opacity")?e.setOpacity(t.match(/opacity:\s*(\d?\.?\d*)/)[1]):e;for(var i in t)i=="opacity"?e.setOpacity(t[i]):n[i=="float"||i=="cssFloat"?Object.isUndefined(n.styleFloat)?"cssFloat":"styleFloat":i]=t[i];return e},setOpacity:function(e,t){return e=$(e),e.style.opacity=t==1||t===""?"":t<1e-5?0:t,e},getDimensions:function(e){e=$(e);var t=Element.getStyle(e,"display");if(t!="none"&&t!=null)return{width:e.offsetWidth,height:e.offsetHeight};var n=e.style,r=n.visibility,i=n.position,s=n.display;n.visibility="hidden",i!="fixed"&&(n.position="absolute"),n.display="block";var o=e.clientWidth,u=e.clientHeight;return n.display=s,n.position=i,n.visibility=r,{width:o,height:u}},makePositioned:function(e){e=$(e);var t=Element.getStyle(e,"position");if(t=="static"||!t)e._madePositioned=!0,e.style.position="relative",Prototype.Browser.Opera&&(e.style.top=0,e.style.left=0);return e},undoPositioned:function(e){return e=$(e),e._madePositioned&&(e._madePositioned=undefined,e.style.position=e.style.top=e.style.left=e.style.bottom=e.style.right=""),e},makeClipping:function(e){return e=$(e),e._overflow?e:(e._overflow=Element.getStyle(e,"overflow")||"auto",e._overflow!=="hidden"&&(e.style.overflow="hidden"),e)},undoClipping:function(e){return e=$(e),e._overflow?(e.style.overflow=e._overflow=="auto"?"":e._overflow,e._overflow=null,e):e},cumulativeOffset:function(e){var t=0,n=0;do t+=e.offsetTop||0,n+=e.offsetLeft||0,e=e.offsetParent;while(e);return Element._returnOffset(n,t)},positionedOffset:function(e){var t=0,n=0;do{t+=e.offsetTop||0,n+=e.offsetLeft||0,e=e.offsetParent;if(e){if(e.tagName.toUpperCase()=="BODY")break;var r=Element.getStyle(e,"position");if(r!=="static")break}}while(e);return Element._returnOffset(n,t)},absolutize:function(e){e=$(e);if(Element.getStyle(e,"position")=="absolute")return e;var t=Element.positionedOffset(e),n=t[1],r=t[0],i=e.clientWidth,s=e.clientHeight;return e._originalLeft=r-parseFloat(e.style.left||0),e._originalTop=n-parseFloat(e.style.top||0),e._originalWidth=e.style.width,e._originalHeight=e.style.height,e.style.position="absolute",e.style.top=n+"px",e.style.left=r+"px",e.style.width=i+"px",e.style.height=s+"px",e},relativize:function(e){e=$(e);if(Element.getStyle(e,"position")=="relative")return e;e.style.position="relative";var t=parseFloat(e.style.top||0)-(e._originalTop||0),n=parseFloat(e.style.left||0)-(e._originalLeft||0);return e.style.top=t+"px",e.style.left=n+"px",e.style.height=e._originalHeight,e.style.width=e._originalWidth,e},cumulativeScrollOffset:function(e){var t=0,n=0;do t+=e.scrollTop||0,n+=e.scrollLeft||0,e=e.parentNode;while(e);return Element._returnOffset(n,t)},getOffsetParent:function(e){if(e.offsetParent)return $(e.offsetParent);if(e==document.body)return $(e);while((e=e.parentNode)&&e!=document.body)if(Element.getStyle(e,"position")!="static")return $(e);return $(document.body)},viewportOffset:function(e){var t=0,n=0,r=e;do{t+=r.offsetTop||0,n+=r.offsetLeft||0;if(r.offsetParent==document.body&&Element.getStyle(r,"position")=="absolute")break}while(r=r.offsetParent);r=e;do if(!Prototype.Browser.Opera||r.tagName&&r.tagName.toUpperCase()=="BODY")t-=r.scrollTop||0,n-=r.scrollLeft||0;while(r=r.parentNode);return Element._returnOffset(n,t)},clonePosition:function(e,t){var n=Object.extend({setLeft:!0,setTop:!0,setWidth:!0,setHeight:!0,offsetTop:0,offsetLeft:0},arguments[2]||{});t=$(t);var r=Element.viewportOffset(t);e=$(e);var i=[0,0],s=null;return Element.getStyle(e,"position")=="absolute"&&(s=Element.getOffsetParent(e),i=Element.viewportOffset(s)),s==document.body&&(i[0]-=document.body.offsetLeft,i[1]-=document.body.offsetTop),n.setLeft&&(e.style.left=r[0]-i[0]+n.offsetLeft+"px"),n.setTop&&(e.style.top=r[1]-i[1]+n.offsetTop+"px"),n.setWidth&&(e.style.width=t.offsetWidth+"px"),n.setHeight&&(e.style.height=t.offsetHeight+"px"),e}},Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants}),Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}},Prototype.Browser.Opera?(Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(e,t,n){switch(n){case"left":case"top":case"right":case"bottom":if(e(t,"position")==="static")return null;case"height":case"width":if(!Element.visible(t))return null;var r=parseInt(e(t,n),10);if(r!==t["offset"+n.capitalize()])return r+"px";var i;return n==="height"?i=["border-top-width","padding-top","padding-bottom","border-bottom-width"]:i=["border-left-width","padding-left","padding-right","border-right-width"],i.inject(r,function(n,r){var i=e(t,r);return i===null?n:n-parseInt(i,10)})+"px";default:return e(t,n)}}),Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(e,t,n){return n==="title"?t.title:e(t,n)})):Prototype.Browser.IE?(Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(e,t){t=$(t);try{t.offsetParent}catch(n){return $(document.body)}var r=t.getStyle("position");if(r!=="static")return e(t);t.setStyle({position:"relative"});var i=e(t);return t.setStyle({position:r}),i}),$w("positionedOffset viewportOffset").each(function(e){Element.Methods[e]=Element.Methods[e].wrap(function(e,t){t=$(t);try{t.offsetParent}catch(n){return Element._returnOffset(0,0)}var r=t.getStyle("position");if(r!=="static")return e(t);var i=t.getOffsetParent();i&&i.getStyle("position")==="fixed"&&i.setStyle({zoom:1}),t.setStyle({position:"relative"});var s=e(t);return t.setStyle({position:r}),s})}),Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(e,t){try{t.offsetParent}catch(n){return Element._returnOffset(0,0)}return e(t)}),Element.Methods.getStyle=function(e,t){e=$(e),t=t=="float"||t=="cssFloat"?"styleFloat":t.camelize();var n=e.style[t];!n&&e.currentStyle&&(n=e.currentStyle[t]);if(t=="opacity"){if(n=(e.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/))if(n[1])return parseFloat(n[1])/100;return 1}return n=="auto"?t!="width"&&t!="height"||e.getStyle("display")=="none"?null:e["offset"+t.capitalize()]+"px":n},Element.Methods.setOpacity=function(e,t){function n(e){return e.replace(/alpha\([^\)]*\)/gi,"")}e=$(e);var r=e.currentStyle;if(r&&!r.hasLayout||!r&&e.style.zoom=="normal")e.style.zoom=1;var i=e.getStyle("filter"),s=e.style;return t==1||t===""?((i=n(i))?s.filter=i:s.removeAttribute("filter"),e):(t<1e-5&&(t=0),s.filter=n(i)+"alpha(opacity="+t*100+")",e)},Element._attributeTranslations=function(){var e="className",t="for",n=document.createElement("div");return n.setAttribute(e,"x"),n.className!=="x"&&(n.setAttribute("class","x"),n.className==="x"&&(e="class")),n=null,n=document.createElement("label"),n.setAttribute(t,"x"),n.htmlFor!=="x"&&(n.setAttribute("htmlFor","x"),n.htmlFor==="x"&&(t="htmlFor")),n=null,{read:{names:{"class":e,className:e,"for":t,htmlFor:t},values:{_getAttr:function(e,t){return e.getAttribute(t)},_getAttr2:function(e,t){return e.getAttribute(t,2)},_getAttrNode:function(e,t){var n=e.getAttributeNode(t);return n?n.value:""},_getEv:function(){var e=document.createElement("div");e.onclick=Prototype.emptyFunction;var t=e.getAttribute("onclick"),n;return String(t).indexOf("{")>-1?n=function(e,t){return t=e.getAttribute(t),t?(t=t.toString(),t=t.split("{")[1],t=t.split("}")[0],t.strip()):null}:t===""&&(n=function(e,t){return t=e.getAttribute(t),t?t.strip():null}),e=null,n}(),_flag:function(e,t){return $(e).hasAttribute(t)?t: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(e,t){e.checked=!!t},style:function(e,t){e.style.cssText=t?t:""}}},Element._attributeTranslations.has={},$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder").each(function(e){Element._attributeTranslations.write.names[e.toLowerCase()]=e,Element._attributeTranslations.has[e.toLowerCase()]=e}),function(e){Object.extend(e,{href:e._getAttr2,src:e._getAttr2,type:e._getAttr,action:e._getAttrNode,disabled:e._flag,checked:e._flag,readonly:e._flag,multiple:e._flag,onload:e._getEv,onunload:e._getEv,onclick:e._getEv,ondblclick:e._getEv,onmousedown:e._getEv,onmouseup:e._getEv,onmouseover:e._getEv,onmousemove:e._getEv,onmouseout:e._getEv,onfocus:e._getEv,onblur:e._getEv,onkeypress:e._getEv,onkeydown:e._getEv,onkeyup:e._getEv,onsubmit:e._getEv,onreset:e._getEv,onselect:e._getEv,onchange:e._getEv})}(Element._attributeTranslations.read.values),Prototype.BrowserFeatures.ElementExtensions&&function(){function e(e){var t=e.getElementsByTagName("*"),n=[];for(var r=0,i;i=t[r];r++)i.tagName!=="!"&&n.push(i);return n}Element.Methods.down=function(t,n,r){return t=$(t),arguments.length==1?t.firstDescendant():Object.isNumber(n)?e(t)[n]:Element.select(t,n)[r||0]}}()):Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)?Element.Methods.setOpacity=function(e,t){return e=$(e),e.style.opacity=t==1?.999999:t===""?"":t<1e-5?0:t,e}:Prototype.Browser.WebKit&&(Element.Methods.setOpacity=function(e,t){e=$(e),e.style.opacity=t==1||t===""?"":t<1e-5?0:t;if(t==1)if(e.tagName.toUpperCase()=="IMG"&&e.width)e.width++,e.width--;else try{var n=document.createTextNode(" ");e.appendChild(n),e.removeChild(n)}catch(r){}return e},Element.Methods.cumulativeOffset=function(e){var t=0,n=0;do{t+=e.offsetTop||0,n+=e.offsetLeft||0;if(e.offsetParent==document.body&&Element.getStyle(e,"position")=="absolute")break;e=e.offsetParent}while(e);return Element._returnOffset(n,t)}),"outerHTML"in document.documentElement&&(Element.Methods.replace=function(e,t){e=$(e),t&&t.toElement&&(t=t.toElement());if(Object.isElement(t))return e.parentNode.replaceChild(t,e),e;t=Object.toHTML(t);var n=e.parentNode,r=n.tagName.toUpperCase();if(Element._insertionTranslations.tags[r]){var i=e.next(),s=Element._getContentFromAnonymousElement(r,t.stripScripts());n.removeChild(e),i?s.each(function(e){n.insertBefore(e,i)}):s.each(function(e){n.appendChild(e)})}else e.outerHTML=t.stripScripts();return t.evalScripts.bind(t).defer(),e}),Element._returnOffset=function(e,t){var n=[e,t];return n.left=e,n.top=t,n},Element._getContentFromAnonymousElement=function(e,t){var n=new Element("div"),r=Element._insertionTranslations.tags[e];return r?(n.innerHTML=r[0]+t+r[1],r[2].times(function(){n=n.firstChild})):n.innerHTML=t,$A(n.childNodes)},Element._insertionTranslations={before:function(e,t){e.parentNode.insertBefore(t,e)},top:function(e,t){e.insertBefore(t,e.firstChild)},bottom:function(e,t){e.appendChild(t)},after:function(e,t){e.parentNode.insertBefore(t,e.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 e=Element._insertionTranslations.tags;Object.extend(e,{THEAD:e.TBODY,TFOOT:e.TBODY,TH:e.TD})}(),Element.Methods.Simulated={hasAttribute:function(e,t){t=Element._attributeTranslations.has[t]||t;var n=$(e).getAttributeNode(t);return!!n&&!!n.specified}},Element.Methods.ByTag={},Object.extend(Element,Element.Methods),function(e){!Prototype.BrowserFeatures.ElementExtensions&&e.__proto__&&(window.HTMLElement={},window.HTMLElement.prototype=e.__proto__,Prototype.BrowserFeatures.ElementExtensions=!0),e=null}(document.createElement("div")),Element.extend=function(){function e(e){if(typeof window.Element!="undefined"){var t=window.Element.prototype;if(t){var n="_"+(Math.random()+"").slice(2),r=document.createElement(e);t[n]="x";var i=r[n]!=="x";return delete t[n],r=null,i}}return!1}function t(e,t){for(var n in t){var r=t[n];Object.isFunction(r)&&!(n in e)&&(e[n]=r.methodize())}}var n=e("object");if(Prototype.BrowserFeatures.SpecificElementExtensions)return n?function(e){if(e&&typeof e._extendedByPrototype=="undefined"){var n=e.tagName;n&&/^(?:object|applet|embed)$/i.test(n)&&(t(e,Element.Methods),t(e,Element.Methods.Simulated),t(e,Element.Methods.ByTag[n.toUpperCase()]))}return e}:Prototype.K;var r={},i=Element.Methods.ByTag,s=Object.extend(function(e){if(!e||typeof e._extendedByPrototype!="undefined"||e.nodeType!=1||e==window)return e;var n=Object.clone(r),s=e.tagName.toUpperCase();return i[s]&&Object.extend(n,i[s]),t(e,n),e._extendedByPrototype=Prototype.emptyFunction,e},{refresh:function(){Prototype.BrowserFeatures.ElementExtensions||(Object.extend(r,Element.Methods),Object.extend(r,Element.Methods.Simulated))}});return s.refresh(),s}(),Element.hasAttribute=function(e,t){return e.hasAttribute?e.hasAttribute(t):Element.Methods.Simulated.hasAttribute(e,t)},Element.addMethods=function(e){function i(t){t=t.toUpperCase(),Element.Methods.ByTag[t]||(Element.Methods.ByTag[t]={}),Object.extend(Element.Methods.ByTag[t],e)}function s(e,t,n){n=n||!1;for(var r in e){var i=e[r];if(!Object.isFunction(i))continue;if(!n||!(r in t))t[r]=i.methodize()}}function o(e){var t,n={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"};n[e]&&(t="HTML"+n[e]+"Element");if(window[t])return window[t];t="HTML"+e+"Element";if(window[t])return window[t];t="HTML"+e.capitalize()+"Element";if(window[t])return window[t];var r=document.createElement(e),i=r.__proto__||r.constructor.prototype;return r=null,i}var t=Prototype.BrowserFeatures,n=Element.Methods.ByTag;e||(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 r=e;e=arguments[1]}r?Object.isArray(r)?r.each(i):i(r):Object.extend(Element.Methods,e||{});var u=window.HTMLElement?HTMLElement.prototype:Element.prototype;t.ElementExtensions&&(s(Element.Methods,u),s(Element.Methods.Simulated,u,!0));if(t.SpecificElementExtensions)for(var a in Element.Methods.ByTag){var f=o(a);if(Object.isUndefined(f))continue;s(n[a],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(e){function s(){return t.WebKit&&!n.evaluate?document:t.Opera&&window.parseFloat(window.opera.version())<9.5?document.body:document.documentElement}function o(t){return r||(r=s()),i[t]="client"+t,e["get"+t]=function(){return r[i[t]]},e["get"+t]()}var t=Prototype.Browser,n=document,r,i={};e.getWidth=o.curry("Width"),e.getHeight=o.curry("Height")}(document.viewport),Element.Storage={UID:1},Element.addMethods({getStorage:function(e){if(!(e=$(e)))return;var t;return e===window?t=0:(typeof e._prototypeUID=="undefined"&&(e._prototypeUID=[Element.Storage.UID++]),t=e._prototypeUID[0]),Element.Storage[t]||(Element.Storage[t]=$H()),Element.Storage[t]},store:function(e,t,n){if(!(e=$(e)))return;return arguments.length===2?Element.getStorage(e).update(t):Element.getStorage(e).set(t,n),e},retrieve:function(e,t,n){if(!(e=$(e)))return;var r=Element.getStorage(e),i=r.get(t);return Object.isUndefined(i)&&(r.set(t,n),i=n),i},clone:function(e,t){if(!(e=$(e)))return;var n=e.cloneNode(t);n._prototypeUID=void 0;if(t){var r=Element.select(n,"*"),i=r.length;while(i--)r[i]._prototypeUID=void 0}return Element.extend(n)}});var Selector=Class.create({initialize:function(e){this.expression=e.strip(),this.shouldUseSelectorsAPI()?this.mode="selectorsAPI":this.shouldUseXPath()?(this.mode="xpath",this.compileXPathMatcher()):(this.mode="normal",this.compileMatcher())},shouldUseXPath:function(){var e=function(){var e=!1;if(document.evaluate&&window.XPathResult){var t=document.createElement("div");t.innerHTML="<ul><li></li></ul><div><ul><li></li></ul></div>";var n=".//*[local-name()='ul' or local-name()='UL']//*[local-name()='li' or local-name()='LI']",r=document.evaluate(n,t,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);e=r.snapshotLength!==2,t=null}return e}();return function(){if(!Prototype.BrowserFeatures.XPath)return!1;var t=this.expression;return Prototype.Browser.WebKit&&(t.include("-of-type")||t.include(":empty"))?!1:/(\[[\w-]*?:|:checked)/.test(t)?!1:e?!1:!0}}(),shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI)return!1;if(Selector.CASE_INSENSITIVE_CLASS_NAMES)return!1;Selector._div||(Selector._div=new Element("div"));try{Selector._div.querySelector(this.expression)}catch(e){return!1}return!0},compileMatcher:function(){var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m,len=ps.length,name;if(Selector._cache[e]){this.matcher=Selector._cache[e];return}this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&/\S/.test(e)){le=e;for(var i=0;i<len;i++){p=ps[i].re,name=ps[i].name;if(m=e.match(p)){this.matcher.push(Object.isFunction(c[name])?c[name](m):(new Template(c[name])).evaluate(m)),e=e.replace(m[0],"");break}}}this.matcher.push("return h.unique(n);\n}"),eval(this.matcher.join("\n")),Selector._cache[this.expression]=this.matcher},compileXPathMatcher:function(){var e=this.expression,t=Selector.patterns,n=Selector.xpath,r,i,s=t.length,o;if(Selector._cache[e]){this.xpath=Selector._cache[e];return}this.matcher=[".//*"];while(e&&r!=e&&/\S/.test(e)){r=e;for(var u=0;u<s;u++){o=t[u].name;if(i=e.match(t[u].re)){this.matcher.push(Object.isFunction(n[o])?n[o](i):(new Template(n[o])).evaluate(i)),e=e.replace(i[0],"");break}}}this.xpath=this.matcher.join(""),Selector._cache[this.expression]=this.xpath},findElements:function(e){e=e||document;var t=this.expression,n;switch(this.mode){case"selectorsAPI":if(e!==document){var r=e.id,i=$(e).identify();i=i.replace(/([\.:])/g,"\\$1"),t="#"+i+" "+t}return n=$A(e.querySelectorAll(t)).map(Element.extend),e.id=r,n;case"xpath":return document._getElementsByXPath(this.xpath,e);default:return this.matcher(e)}},match:function(e){this.tokens=[];var t=this.expression,n=Selector.patterns,r=Selector.assertions,i,s,o,u=n.length,a;while(t&&i!==t&&/\S/.test(t)){i=t;for(var f=0;f<u;f++){s=n[f].re,a=n[f].name;if(o=t.match(s)){if(!r[a])return this.findElements(document).include(e);this.tokens.push([a,Object.clone(o)]),t=t.replace(o[0],"")}}}var l=!0,a,c;for(var f=0,h;h=this.tokens[f];f++){a=h[0],c=h[1];if(!Selector.assertions[a](e,c)){l=!1;break}}return l},toString:function(){return this.expression},inspect:function(){return"#<Selector:"+this.expression.inspect()+">"}});Prototype.BrowserFeatures.SelectorsAPI&&document.compatMode==="BackCompat"&&(Selector.CASE_INSENSITIVE_CLASS_NAMES=function(){var e=document.createElement("div"),t=document.createElement("span");e.id="prototype_test_id",t.className="Test",e.appendChild(t);var n=e.querySelector("#prototype_test_id .test")!==null;return e=t=null,n}()),Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(e){return e[1]=="*"?"":"[local-name()='"+e[1].toLowerCase()+"' or local-name()='"+e[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(e){return e[1]=e[1].toLowerCase(),(new Template("[@#{1}]")).evaluate(e)},attr:function(e){return e[1]=e[1].toLowerCase(),e[3]=e[5]||e[6],(new Template(Selector.xpath.operators[e[2]])).evaluate(e)},pseudo:function(e){var t=Selector.xpath.pseudos[e[1]];return t?Object.isFunction(t)?t(e):(new Template(Selector.xpath.pseudos[e[1]])).evaluate(e):""},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(e){var t=e[6],n=Selector.patterns,r=Selector.xpath,i,s,o=n.length,u,a=[];while(t&&i!=t&&/\S/.test(t)){i=t;for(var f=0;f<o;f++){u=n[f].name;if(e=t.match(n[f].re)){s=Object.isFunction(r[u])?r[u](e):(new Template(r[u])).evaluate(e),a.push("("+s.substring(1,s.length-1)+")"),t=t.replace(e[0],"");break}}}return"[not("+a.join(" and ")+")]"},"nth-child":function(e){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",e)},"nth-last-child":function(e){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",e)},"nth-of-type":function(e){return Selector.xpath.pseudos.nth("position() ",e)},"nth-last-of-type":function(e){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",e)},"first-of-type":function(e){return e[6]="1",Selector.xpath.pseudos["nth-of-type"](e)},"last-of-type":function(e){return e[6]="1",Selector.xpath.pseudos["nth-last-of-type"](e)},"only-of-type":function(e){var t=Selector.xpath.pseudos;return t["first-of-type"](e)+t["last-of-type"](e)},nth:function(e,t){var n,r=t[6],i;r=="even"&&(r="2n+0"),r=="odd"&&(r="2n+1");if(n=r.match(/^(\d+)$/))return"["+e+"= "+n[1]+"]";if(n=r.match(/^(-?\d*)?n(([+-])(\d+))?/)){n[1]=="-"&&(n[1]=-1);var s=n[1]?Number(n[1]):1,o=n[2]?Number(n[2]):0;return i="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]",(new Template(i)).evaluate({fragment:e,a:s,b:o})}}}},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(e){return e[3]=e[5]||e[6],(new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;')).evaluate(e)},pseudo:function(e){return e[6]&&(e[6]=e[6].replace(/"/g,'\\"')),(new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;')).evaluate(e)},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(e,t){return t[1].toUpperCase()==e.tagName.toUpperCase()},className:function(e,t){return Element.hasClassName(e,t[1])},id:function(e,t){return e.id===t[1]},attrPresence:function(e,t){return Element.hasAttribute(e,t[1])},attr:function(e,t){var n=Element.readAttribute(e,t[1]);return n&&Selector.operators[t[2]](n,t[5]||t[6])}},handlers:{concat:function(e,t){for(var n=0,r;r=t[n];n++)e.push(r);return e},mark:function(e){var t=Prototype.emptyFunction;for(var n=0,r;r=e[n];n++)r._countedByPrototype=t;return e},unmark:function(){var e=function(){var e=document.createElement("div"),t=!1,n="_countedByPrototype",r="x";return e[n]=r,t=e.getAttribute(n)===r,e=null,t}();return e?function(e){for(var t=0,n;n=e[t];t++)n.removeAttribute("_countedByPrototype");return e}:function(e){for(var t=0,n;n=e[t];t++)n._countedByPrototype=void 0;return e}}(),index:function(e,t,n){e._countedByPrototype=Prototype.emptyFunction;if(t)for(var r=e.childNodes,i=r.length-1,s=1;i>=0;i--){var o=r[i];o.nodeType==1&&(!n||o._countedByPrototype)&&(o.nodeIndex=s++)}else for(var i=0,s=1,r=e.childNodes;o=r[i];i++)o.nodeType==1&&(!n||o._countedByPrototype)&&(o.nodeIndex=s++)},unique:function(e){if(e.length==0)return e;var t=[],n;for(var r=0,i=e.length;r<i;r++)typeof (n=e[r])._countedByPrototype=="undefined"&&(n._countedByPrototype=Prototype.emptyFunction,t.push(Element.extend(n)));return Selector.handlers.unmark(t)},descendant:function(e){var t=Selector.handlers;for(var n=0,r=[],i;i=e[n];n++)t.concat(r,i.getElementsByTagName("*"));return r},child:function(e){var t=Selector.handlers;for(var n=0,r=[],i;i=e[n];n++)for(var s=0,o;o=i.childNodes[s];s++)o.nodeType==1&&o.tagName!="!"&&r.push(o);return r},adjacent:function(e){for(var t=0,n=[],r;r=e[t];t++){var i=this.nextElementSibling(r);i&&n.push(i)}return n},laterSibling:function(e){var t=Selector.handlers;for(var n=0,r=[],i;i=e[n];n++)t.concat(r,Element.nextSiblings(i));return r},nextElementSibling:function(e){while(e=e.nextSibling)if(e.nodeType==1)return e;return null},previousElementSibling:function(e){while(e=e.previousSibling)if(e.nodeType==1)return e;return null},tagName:function(e,t,n,r){var i=n.toUpperCase(),s=[],o=Selector.handlers;if(e){if(r){if(r=="descendant"){for(var u=0,a;a=e[u];u++)o.concat(s,a.getElementsByTagName(n));return s}e=this[r](e);if(n=="*")return e}for(var u=0,a;a=e[u];u++)a.tagName.toUpperCase()===i&&s.push(a);return s}return t.getElementsByTagName(n)},id:function(e,t,n,r){var i=$(n),s=Selector.handlers;if(t==document){if(!i)return[];if(!e)return[i]}else if(!t.sourceIndex||t.sourceIndex<1){var e=t.getElementsByTagName("*");for(var o=0,u;u=e[o];o++)if(u.id===n)return[u]}if(e){if(r)if(r=="child"){for(var a=0,u;u=e[a];a++)if(i.parentNode==u)return[i]}else if(r=="descendant"){for(var a=0,u;u=e[a];a++)if(Element.descendantOf(i,u))return[i]}else if(r=="adjacent"){for(var a=0,u;u=e[a];a++)if(Selector.handlers.previousElementSibling(i)==u)return[i]}else e=s[r](e);for(var a=0,u;u=e[a];a++)if(u==i)return[i];return[]}return i&&Element.descendantOf(i,t)?[i]:[]},className:function(e,t,n,r){return e&&r&&(e=this[r](e)),Selector.handlers.byClassName(e,t,n)},byClassName:function(e,t,n){e||(e=Selector.handlers.descendant([t]));var r=" "+n+" ";for(var i=0,s=[],o,u;o=e[i];i++){u=o.className;if(u.length==0)continue;(u==n||(" "+u+" ").include(r))&&s.push(o)}return s},attrPresence:function(e,t,n,r){e||(e=t.getElementsByTagName("*")),e&&r&&(e=this[r](e));var i=[];for(var s=0,o;o=e[s];s++)Element.hasAttribute(o,n)&&i.push(o);return i},attr:function(e,t,n,r,i,s){e||(e=t.getElementsByTagName("*")),e&&s&&(e=this[s](e));var o=Selector.operators[i],u=[];for(var a=0,f;f=e[a];a++){var l=Element.readAttribute(f,n);if(l===null)continue;o(l,r)&&u.push(f)}return u},pseudo:function(e,t,n,r,i){return e&&i&&(e=this[i](e)),e||(e=r.getElementsByTagName("*")),Selector.pseudos[t](e,n,r)}},pseudos:{"first-child":function(e,t,n){for(var r=0,i=[],s;s=e[r];r++){if(Selector.handlers.previousElementSibling(s))continue;i.push(s)}return i},"last-child":function(e,t,n){for(var r=0,i=[],s;s=e[r];r++){if(Selector.handlers.nextElementSibling(s))continue;i.push(s)}return i},"only-child":function(e,t,n){var r=Selector.handlers;for(var i=0,s=[],o;o=e[i];i++)!r.previousElementSibling(o)&&!r.nextElementSibling(o)&&s.push(o);return s},"nth-child":function(e,t,n){return Selector.pseudos.nth(e,t,n)},"nth-last-child":function(e,t,n){return Selector.pseudos.nth(e,t,n,!0)},"nth-of-type":function(e,t,n){return Selector.pseudos.nth(e,t,n,!1,!0)},"nth-last-of-type":function(e,t,n){return Selector.pseudos.nth(e,t,n,!0,!0)},"first-of-type":function(e,t,n){return Selector.pseudos.nth(e,"1",n,!1,!0)},"last-of-type":function(e,t,n){return Selector.pseudos.nth(e,"1",n,!0,!0)},"only-of-type":function(e,t,n){var r=Selector.pseudos;return r["last-of-type"](r["first-of-type"](e,t,n),t,n)},getIndices:function(e,t,n){return e==0?t>0?[t]:[]:$R(1,n).inject([],function(n,r){return 0==(r-t)%e&&(r-t)/e>=0&&n.push(r),n})},nth:function(e,t,n,r,i){if(e.length==0)return[];t=="even"&&(t="2n+0"),t=="odd"&&(t="2n+1");var s=Selector.handlers,o=[],u=[],a;s.mark(e);for(var f=0,l;l=e[f];f++)l.parentNode._countedByPrototype||(s.index(l.parentNode,r,i),u.push(l.parentNode));if(t.match(/^\d+$/)){t=Number(t);for(var f=0,l;l=e[f];f++)l.nodeIndex==t&&o.push(l)}else if(a=t.match(/^(-?\d*)?n(([+-])(\d+))?/)){a[1]=="-"&&(a[1]=-1);var c=a[1]?Number(a[1]):1,h=a[2]?Number(a[2]):0,p=Selector.pseudos.getIndices(c,h,e.length);for(var f=0,l,d=p.length;l=e[f];f++)for(var v=0;v<d;v++)l.nodeIndex==p[v]&&o.push(l)}return s.unmark(e),s.unmark(u),o},empty:function(e,t,n){for(var r=0,i=[],s;s=e[r];r++){if(s.tagName=="!"||s.firstChild)continue;i.push(s)}return i},not:function(e,t,n){var r=Selector.handlers,i,s,o=(new Selector(t)).findElements(n);r.mark(o);for(var u=0,a=[],f;f=e[u];u++)f._countedByPrototype||a.push(f);return r.unmark(o),a},enabled:function(e,t,n){for(var r=0,i=[],s;s=e[r];r++)!s.disabled&&(!s.type||s.type!=="hidden")&&i.push(s);return i},disabled:function(e,t,n){for(var r=0,i=[],s;s=e[r];r++)s.disabled&&i.push(s);return i},checked:function(e,t,n){for(var r=0,i=[],s;s=e[r];r++)s.checked&&i.push(s);return i}},operators:{"=":function(e,t){return e==t},"!=":function(e,t){return e!=t},"^=":function(e,t){return e==t||e&&e.startsWith(t)},"$=":function(e,t){return e==t||e&&e.endsWith(t)},"*=":function(e,t){return e==t||e&&e.include(t)},"~=":function(e,t){return(" "+e+" ").include(" "+t+" ")},"|=":function(e,t){return("-"+(e||"").toUpperCase()+"-").include("-"+(t||"").toUpperCase()+"-")}},split:function(e){var t=[];return e.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(e){t.push(e[1].strip())}),t},matchElements:function(e,t){var n=$$(t),r=Selector.handlers;r.mark(n);for(var i=0,s=[],o;o=e[i];i++)o._countedByPrototype&&s.push(o);return r.unmark(n),s},findElement:function(e,t,n){return Object.isNumber(t)&&(n=t,t=!1),Selector.matchElements(e,t||"*")[n||0]},findChildElements:function(e,t){t=Selector.split(t.join(","));var n=[],r=Selector.handlers;for(var i=0,s=t.length,o;i<s;i++)o=new Selector(t[i].strip()),r.concat(n,o.findElements(e));return s>1?r.unique(n):n}}),Prototype.Browser.IE&&Object.extend(Selector.handlers,{concat:function(e,t){for(var n=0,r;r=t[n];n++)r.tagName!=="!"&&e.push(r);return e}});var Form={reset:function(e){return e=$(e),e.reset(),e},serializeElements:function(e,t){typeof t!="object"?t={hash:!!t}:Object.isUndefined(t.hash)&&(t.hash=!0);var n,r,i=!1,s=t.submit,o=e.inject({},function(e,t){return!t.disabled&&t.name&&(n=t.name,r=$(t).getValue(),r!=null&&t.type!="file"&&(t.type!="submit"||!i&&s!==!1&&(!s||n==s)&&(i=!0))&&(n in e?(Object.isArray(e[n])||(e[n]=[e[n]]),e[n].push(r)):e[n]=r)),e});return t.hash?o:Object.toQueryString(o)}};Form.Methods={serialize:function(e,t){return Form.serializeElements(Form.getElements(e),t)},getElements:function(e){var t=$(e).getElementsByTagName("*"),n,r=[],i=Form.Element.Serializers;for(var s=0;n=t[s];s++)r.push(n);return r.inject([],function(e,t){return i[t.tagName.toLowerCase()]&&e.push(Element.extend(t)),e})},getInputs:function(e,t,n){e=$(e);var r=e.getElementsByTagName("input");if(!t&&!n)return $A
(r).map(Element.extend);for(var i=0,s=[],o=r.length;i<o;i++){var u=r[i];if(t&&u.type!=t||n&&u.name!=n)continue;s.push(Element.extend(u))}return s},disable:function(e){return e=$(e),Form.getElements(e).invoke("disable"),e},enable:function(e){return e=$(e),Form.getElements(e).invoke("enable"),e},findFirstElement:function(e){var t=$(e).getElements().findAll(function(e){return"hidden"!=e.type&&!e.disabled}),n=t.findAll(function(e){return e.hasAttribute("tabIndex")&&e.tabIndex>=0}).sortBy(function(e){return e.tabIndex}).first();return n?n:t.find(function(e){return/^(?:input|select|textarea)$/i.test(e.tagName)})},focusFirstElement:function(e){return e=$(e),e.findFirstElement().activate(),e},request:function(e,t){e=$(e),t=Object.clone(t||{});var n=t.parameters,r=e.readAttribute("action")||"";return r.blank()&&(r=window.location.href),t.parameters=e.serialize(!0),n&&(Object.isString(n)&&(n=n.toQueryParams()),Object.extend(t.parameters,n)),e.hasAttribute("method")&&!t.method&&(t.method=e.method),new Ajax.Request(r,t)}},Form.Element={focus:function(e){return $(e).focus(),e},select:function(e){return $(e).select(),e}},Form.Element.Methods={serialize:function(e){e=$(e);if(!e.disabled&&e.name){var t=e.getValue();if(t!=undefined){var n={};return n[e.name]=t,Object.toQueryString(n)}}return""},getValue:function(e){e=$(e);var t=e.tagName.toLowerCase();return Form.Element.Serializers[t](e)},setValue:function(e,t){e=$(e);var n=e.tagName.toLowerCase();return Form.Element.Serializers[n](e,t),e},clear:function(e){return $(e).value="",e},present:function(e){return $(e).value!=""},activate:function(e){e=$(e);try{e.focus(),e.select&&(e.tagName.toLowerCase()!="input"||!/^(?:button|reset|submit)$/i.test(e.type))&&e.select()}catch(t){}return e},disable:function(e){return e=$(e),e.disabled=!0,e},enable:function(e){return e=$(e),e.disabled=!1,e}};var Field=Form.Element,$F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(e,t){switch(e.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(e,t);default:return Form.Element.Serializers.textarea(e,t)}},inputSelector:function(e,t){if(Object.isUndefined(t))return e.checked?e.value:null;e.checked=!!t},textarea:function(e,t){if(Object.isUndefined(t))return e.value;e.value=t},select:function(e,t){if(Object.isUndefined(t))return this[e.type=="select-one"?"selectOne":"selectMany"](e);var n,r,i=!Object.isArray(t);for(var s=0,o=e.length;s<o;s++){n=e.options[s],r=this.optionValue(n);if(i){if(r==t){n.selected=!0;return}}else n.selected=t.include(r)}},selectOne:function(e){var t=e.selectedIndex;return t>=0?this.optionValue(e.options[t]):null},selectMany:function(e){var t,n=e.length;if(!n)return null;for(var r=0,t=[];r<n;r++){var i=e.options[r];i.selected&&t.push(this.optionValue(i))}return t},optionValue:function(e){return Element.extend(e).hasAttribute("value")?e.value:e.text}},Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,e,t,n){$super(n,t),this.element=$(e),this.lastValue=this.getValue()},execute:function(){var e=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(e)?this.lastValue!=e:String(this.lastValue)!=String(e))this.callback(this.element,e),this.lastValue=e}}),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(e,t){this.element=$(e),this.callback=t,this.lastValue=this.getValue(),this.element.tagName.toLowerCase()=="form"?this.registerFormCallbacks():this.registerCallback(this.element)},onElementEvent:function(){var e=this.getValue();this.lastValue!=e&&(this.callback(this.element,e),this.lastValue=e)},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)},registerCallback:function(e){if(e.type)switch(e.type.toLowerCase()){case"checkbox":case"radio":Event.observe(e,"click",this.onElementEvent.bind(this));break;default:Event.observe(e,"change",this.onElementEvent.bind(this))}}}),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 s(e){return r(e,0)}function o(e){return r(e,1)}function u(e){return r(e,2)}function a(t){t=e.extend(t);var n=t.target,r=t.type,i=t.currentTarget;return i&&i.tagName&&(r==="load"||r==="error"||r==="click"&&i.tagName.toLowerCase()==="input"&&i.type==="radio")&&(n=i),n.nodeType==Node.TEXT_NODE&&(n=n.parentNode),Element.extend(n)}function f(t,n){var r=e.element(t);if(!n)return r;var i=[r].concat(r.ancestors());return Selector.findElement(i,n,0)}function l(e){return{x:c(e),y:h(e)}}function c(e){var t=document.documentElement,n=document.body||{scrollLeft:0};return e.pageX||e.clientX+(t.scrollLeft||n.scrollLeft)-(t.clientLeft||0)}function h(e){var t=document.documentElement,n=document.body||{scrollTop:0};return e.pageY||e.clientY+(t.scrollTop||n.scrollTop)-(t.clientTop||0)}function p(t){e.extend(t),t.preventDefault(),t.stopPropagation(),t.stopped=!0}function m(t,r,i){var s=Element.retrieve(t,"prototype_event_registry");Object.isUndefined(s)&&(y.push(t),s=Element.retrieve(t,"prototype_event_registry",$H()));var o=s.get(r);Object.isUndefined(o)&&(o=[],s.set(r,o));if(o.pluck("handler").include(i))return!1;var u;if(r.include(":"))u=function(n){if(Object.isUndefined(n.eventName))return!1;if(n.eventName!==r)return!1;e.extend(n,t),i.call(t,n)};else if(!!n||r!=="mouseenter"&&r!=="mouseleave")u=function(n){e.extend(n,t),i.call(t,n)};else if(r==="mouseenter"||r==="mouseleave")u=function(n){e.extend(n,t);var r=n.relatedTarget;while(r&&r!==t)try{r=r.parentNode}catch(s){r=t}if(r===t)return;i.call(t,n)};return u.handler=i,o.push(u),u}function g(){for(var t=0,n=y.length;t<n;t++)e.stopObserving(y[t]),y[t]=null}function w(e,t,n){e=$(e);var r=m(e,t,n);if(!r)return e;if(t.include(":"))e.addEventListener?e.addEventListener("dataavailable",r,!1):(e.attachEvent("ondataavailable",r),e.attachEvent("onfilterchange",r));else{var i=b(t);e.addEventListener?e.addEventListener(i,r,!1):e.attachEvent("on"+i,r)}return e}function E(e,t,n){e=$(e);var r=Element.retrieve(e,"prototype_event_registry");if(Object.isUndefined(r))return e;if(t&&!n){var i=r.get(t);return Object.isUndefined(i)?e:(i.each(function(n){Element.stopObserving(e,t,n.handler)}),e)}if(!t)return r.each(function(t){var n=t.key,r=t.value;r.each(function(t){Element.stopObserving(e,n,t.handler)})}),e;var i=r.get(t);if(!i)return;var s=i.find(function(e){return e.handler===n});if(!s)return e;var o=b(t);return t.include(":")?e.removeEventListener?e.removeEventListener("dataavailable",s,!1):(e.detachEvent("ondataavailable",s),e.detachEvent("onfilterchange",s)):e.removeEventListener?e.removeEventListener(o,s,!1):e.detachEvent("on"+o,s),r.set(t,i.without(s)),e}function S(t,n,r,i){t=$(t),Object.isUndefined(i)&&(i=!0),t==document&&document.createEvent&&!t.dispatchEvent&&(t=document.documentElement);var s;return document.createEvent?(s=document.createEvent("HTMLEvents"),s.initEvent("dataavailable",!0,!0)):(s=document.createEventObject(),s.eventType=i?"ondataavailable":"onfilterchange"),s.eventName=n,s.memo=r||{},document.createEvent?t.dispatchEvent(s):t.fireEvent(s.eventType,s),e.extend(s)}var e={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:{}},t=document.documentElement,n="onmouseenter"in t&&"onmouseleave"in t,r;if(Prototype.Browser.IE){var i={0:1,1:4,2:2};r=function(e,t){return e.button===i[t]}}else Prototype.Browser.WebKit?r=function(e,t){switch(t){case 0:return e.which==1&&!e.metaKey;case 1:return e.which==1&&e.metaKey;default:return!1}}:r=function(e,t){return e.which?e.which===t+1:e.button===t};e.Methods={isLeftClick:s,isMiddleClick:o,isRightClick:u,element:a,findElement:f,pointer:l,pointerX:c,pointerY:h,stop:p};var d=Object.keys(e.Methods).inject({},function(t,n){return t[n]=e.Methods[n].methodize(),t});if(Prototype.Browser.IE){function v(e){var t;switch(e.type){case"mouseover":t=e.fromElement;break;case"mouseout":t=e.toElement;break;default:return null}return Element.extend(t)}Object.extend(d,{stopPropagation:function(){this.cancelBubble=!0},preventDefault:function(){this.returnValue=!1},inspect:function(){return"[object Event]"}}),e.extend=function(t,n){if(!t)return!1;if(t._extendedByPrototype)return t;t._extendedByPrototype=Prototype.emptyFunction;var r=e.pointer(t);return Object.extend(t,{target:t.srcElement||n,relatedTarget:v(t),pageX:r.x,pageY:r.y}),Object.extend(t,d)}}else e.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__,Object.extend(e.prototype,d),e.extend=Prototype.K;var y=[];Prototype.Browser.IE&&window.attachEvent("onunload",g),Prototype.Browser.WebKit&&window.addEventListener("unload",Prototype.emptyFunction,!1);var b=Prototype.K;n||(b=function(e){var t={mouseenter:"mouseover",mouseleave:"mouseout"};return e in t?t[e]:e}),Object.extend(e,e.Methods),Object.extend(e,{fire:S,observe:w,stopObserving:E}),Element.addMethods({fire:S,observe:w,stopObserving:E}),Object.extend(document,{fire:S.methodize(),observe:w.methodize(),stopObserving:E.methodize(),loaded:!1}),window.Event?Object.extend(window.Event,e):window.Event=e}(),function(){function t(){if(document.loaded)return;e&&window.clearTimeout(e),document.loaded=!0,document.fire("dom:loaded")}function n(){document.readyState==="complete"&&(document.stopObserving("readystatechange",n),t())}function r(){try{document.documentElement.doScroll("left")}catch(n){e=r.defer();return}t()}var e;document.addEventListener?document.addEventListener("DOMContentLoaded",t,!1):(document.observe("readystatechange",n),window==top&&(e=r.defer())),Event.observe(window,"load",t)}(),Element.addMethods(),Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(e,t){return Element.insert(e,{before:t})},Top:function(e,t){return Element.insert(e,{top:t})},Bottom:function(e,t){return Element.insert(e,{bottom:t})},After:function(e,t){return Element.insert(e,{after:t})}},$continue=new Error('"throw $continue" is deprecated, use "return" instead'),Position={includeScrollOffsets:!1,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(e,t,n){return this.includeScrollOffsets?this.withinIncludingScrolloffsets(e,t,n):(this.xcomp=t,this.ycomp=n,this.offset=Element.cumulativeOffset(e),n>=this.offset[1]&&n<this.offset[1]+e.offsetHeight&&t>=this.offset[0]&&t<this.offset[0]+e.offsetWidth)},withinIncludingScrolloffsets:function(e,t,n){var r=Element.cumulativeScrollOffset(e);return this.xcomp=t+r[0]-this.deltaX,this.ycomp=n+r[1]-this.deltaY,this.offset=Element.cumulativeOffset(e),this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+e.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+e.offsetWidth},overlap:function(e,t){if(!e)return 0;if(e=="vertical")return(this.offset[1]+t.offsetHeight-this.ycomp)/t.offsetHeight;if(e=="horizontal")return(this.offset[0]+t.offsetWidth-this.xcomp)/t.offsetWidth},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(e){return Position.prepare(),Element.absolutize(e)},relativize:function(e){return Position.prepare(),Element.relativize(e)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(e,t,n){return n=n||{},Element.clonePosition(t,e,n)}};document.getElementsByClassName||(document.getElementsByClassName=function(e){function t(e){return e.blank()?null:"[contains(concat(' ', @class, ' '), ' "+e+" ')]"}return e.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(e,n){n=n.toString().strip();var r=/\s/.test(n)?$w(n).map(t).join(""):t(n);return r?document._getElementsByXPath(".//*"+r,e):[]}:function(e,t){t=t.toString().strip();var n=[],r=/\s/.test(t)?$w(t):null;if(!r&&!t)return n;var i=$(e).getElementsByTagName("*");t=" "+t+" ";for(var s=0,o,u;o=i[s];s++)o.className&&(u=" "+o.className+" ")&&(u.include(t)||r&&r.all(function(e){return!e.toString().blank()&&u.include(" "+e+" ")}))&&n.push(Element.extend(o));return n},function(e,t){return $(t||document.body).getElementsByClassName(e)}}(Element.Methods)),Element.ClassNames=Class.create(),Element.ClassNames.prototype={initialize:function(e){this.element=$(e)},_each:function(e){this.element.className.split(/\s+/).select(function(e){return e.length>0})._each(e)},set:function(e){this.element.className=e},add:function(e){if(this.include(e))return;this.set($A(this).concat(e).join(" "))},remove:function(e){if(!this.include(e))return;this.set($A(this).without(e).join(" "))},toString:function(){return $A(this).join(" ")}},Object.extend(Element.ClassNames.prototype,Enumerable);