var Prototype={Version:"1.5.1_rc2",Browser:{IE:!!(window.attachEvent&&!window.opera),Opera:!!window.opera,WebKit:navigator.userAgent.indexOf("AppleWebKit/")>-1,Gecko:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")==-1},BrowserFeatures:{XPath:!!document.evaluate,ElementExtensions:!!window.HTMLElement,SpecificElementExtensions:(document.createElement("div").__proto__!==document.createElement("form").__proto__)},ScriptFragment:"(?:<script.*?>)((\n|\r|.)*?)(?:</script>)",emptyFunction:function(){},K:function(M){return M;}};var Class={create:function(){return function(){this.initialize.apply(this,arguments);};}};var Abstract=new Object();Object.extend=function(M,p){for(var O in p){M[O]=p[O];}return M;};Object.extend(Object,{inspect:function(M){try{if(M===undefined){return "undefined";}if(M===null){return "null";}return M.inspect?M.inspect():M.toString();}catch(O){if(O instanceof RangeError){return "...";}throw O;}},toJSON:function(M){var p=typeof M;switch(p){case "undefined":case "function":case "unknown":return ;case "boolean":return M.toString();}if(M===null){return "null";}if(M.toJSON){return M.toJSON();}if(M.ownerDocument===document){return ;}var O=[];for(var K in M){var v=Object.toJSON(M[K]);if(v!==undefined){O.push(K.toJSON()+":"+v);}}return "{"+O.join(",")+"}";},keys:function(M){var O=[];for(var p in M){O.push(p);}return O;},values:function(O){var M=[];for(var p in O){M.push(O[p]);}return M;},clone:function(M){return Object.extend({},M);}});Function.prototype.bind=function(){var M=this,p=$A(arguments),O=p.shift();return function(){return M.apply(O,p.concat($A(arguments)));};};Function.prototype.bindAsEventListener=function(p){var M=this,O=$A(arguments),p=O.shift();return function(v){return M.apply(p,[(v||window.event)].concat(O).concat($A(arguments)));};};Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16);},succ:function(){return this+1;},times:function(M){$R(0,this,true).each(M);return this;},toPaddedString:function(p,O){var M=this.toString(O||10);return "0".times(p-M.length)+M;},toJSON:function(){return isFinite(this)?this.toString():"null";}});Date.prototype.toJSON=function(){return "\""+this.getFullYear()+"-"+(this.getMonth()+1).toPaddedString(2)+"-"+this.getDate().toPaddedString(2)+"T"+this.getHours().toPaddedString(2)+":"+this.getMinutes().toPaddedString(2)+":"+this.getSeconds().toPaddedString(2)+"\"";};var Try={these:function(){var p;for(var O=0,v=arguments.length;O<v;O++){var M=arguments[O];try{p=M();break;}catch(K){}}return p;}};var PeriodicalExecuter=Class.create();PeriodicalExecuter.prototype={initialize:function(O,M){this.callback=O;this.frequency=M;this.currentlyExecuting=false;this.registerCallback();},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000);},stop:function(){if(!this.timer){return ;}clearInterval(this.timer);this.timer=null;},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.callback(this);}finally{this.currentlyExecuting=false;}}}};Object.extend(String,{interpret:function(M){return M==null?"":String(M);},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,{gsub:function(K,p){var M="",v=this,O;p=arguments.callee.prepareReplacement(p);while(v.length>0){if(O=v.match(K)){M+=v.slice(0,O.index);M+=String.interpret(p(O));v=v.slice(O.index+O[0].length);}else{M+=v,v="";}}return M;},sub:function(p,M,O){M=this.gsub.prepareReplacement(M);O=O===undefined?1:O;return this.gsub(p,function(v){if(--O<0){return v[0];}return M(v);});},scan:function(O,M){this.gsub(O,M);return this;},truncate:function(O,M){O=O||30;M=M===undefined?"...":M;return this.length>O?this.slice(0,O-M.length)+M:this;},strip:function(){return this.replace(/^\s+/,"").replace(/\s+$/,"");},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,"");},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"");},extractScripts:function(){var O=new RegExp(Prototype.ScriptFragment,"img");var M=new RegExp(Prototype.ScriptFragment,"im");return (this.match(O)||[]).map(function(p){return (p.match(M)||["",""])[1];});},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script);});},escapeHTML:function(){var M=arguments.callee;M.text.data=this;return M.div.innerHTML;},unescapeHTML:function(){var M=document.createElement("div");M.innerHTML=this.stripTags();return M.childNodes[0]?(M.childNodes.length>1?$A(M.childNodes).inject("",function(O,p){return O+p.nodeValue;}):M.childNodes[0].nodeValue):"";},toQueryParams:function(O){var M=this.strip().match(/([^?#]*)(#.*)?$/);if(!M){return {};}return M[1].split(O||"&").inject({},function(K,o){if((o=o.split("="))[0]){var p=decodeURIComponent(o[0]);var v=o[1]?decodeURIComponent(o[1]):undefined;if(K[p]!==undefined){if(K[p].constructor!=Array){K[p]=[K[p]];}if(v){K[p].push(v);}}else{K[p]=v;}}return K;});},toArray:function(){return this.split("");},succ:function(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1);},times:function(p){var M="";for(var O=0;O<p;O++){M+=this;}return M;},camelize:function(){var v=this.split("-"),M=v.length;if(M==1){return v[0];}var p=this.charAt(0)=="-"?v[0].charAt(0).toUpperCase()+v[0].substring(1):v[0];for(var O=1;O<M;O++){p+=v[O].charAt(0).toUpperCase()+v[O].substring(1);}return p;},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase();},underscore:function(){return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase();},dasherize:function(){return this.gsub(/_/,"-");},inspect:function(O){var M=this.gsub(/[\x00-\x1f\\]/,function(p){var v=String.specialChar[p[0]];return v?v:"\\u00"+p[0].charCodeAt().toPaddedString(2,16);});if(O){return "\""+M.replace(/"/g,"\\\"")+"\"";}return "'"+M.replace(/'/g,"\\'")+"'";},toJSON:function(){return this.inspect(true);},evalJSON:function(sanitize){try{if(!sanitize||(/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(this))){return eval("("+this+")");}}catch(e){}throw new SyntaxError("Badly formated JSON string: "+this.inspect());},include:function(M){return this.indexOf(M)>-1;},startsWith:function(M){return this.indexOf(M)==0;},endsWith:function(M){return this.lastIndexOf(M)==(this.length-M.length);},empty:function(){return this=="";},blank:function(){return /^\s*$/.test(this);}});String.prototype.gsub.prepareReplacement=function(O){if(typeof O=="function"){return O;}var M=new Template(O);return function(p){return M.evaluate(p);};};String.prototype.parseQuery=String.prototype.toQueryParams;Object.extend(String.prototype.escapeHTML,{div:document.createElement("div"),text:document.createTextNode("")});with(String.prototype.escapeHTML){div.appendChild(text);}var Template=Class.create();Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;Template.prototype={initialize:function(M,O){this.template=M.toString();this.pattern=O||Template.Pattern;},evaluate:function(M){return this.template.gsub(this.pattern,function(O){var p=O[1];if(p=="\\"){return O[2];}return p+String.interpret(M[O[3]]);});}};var $break=new Object();var $continue=new Object();var Enumerable={each:function(O){var M=0;try{this._each(function(v){O(v,M++);});}catch(p){if(p!=$break){throw p;}}return this;},eachSlice:function(p,O){var M=-p,v=[],K=this.toArray();while((M+=p)<K.length){v.push(K.slice(M,M+p));}return v.map(O);},all:function(O){var M=true;this.each(function(v,p){M=M&&!!(O||Prototype.K)(v,p);if(!M){throw $break;}});return M;},any:function(O){var M=false;this.each(function(v,p){if(M=!!(O||Prototype.K)(v,p)){throw $break;}});return M;},collect:function(O){var M=[];this.each(function(v,p){M.push((O||Prototype.K)(v,p));});return M;},detect:function(O){var M;this.each(function(v,p){if(O(v,p)){M=v;throw $break;}});return M;},findAll:function(O){var M=[];this.each(function(v,p){if(O(v,p)){M.push(v);}});return M;},grep:function(p,O){var M=[];this.each(function(o,K){var v=o.toString();if(v.match(p)){M.push((O||Prototype.K)(o,K));}});return M;},include:function(M){var O=false;this.each(function(p){if(p==M){O=true;throw $break;}});return O;},inGroupsOf:function(O,M){M=M===undefined?null:M;return this.eachSlice(O,function(p){while(p.length<O){p.push(M);}return p;});},inject:function(M,O){this.each(function(v,p){M=O(M,v,p);});return M;},invoke:function(O){var M=$A(arguments).slice(1);return this.map(function(p){return p[O].apply(p,M);});},max:function(O){var M;this.each(function(v,p){v=(O||Prototype.K)(v,p);if(M==undefined||v>=M){M=v;}});return M;},min:function(O){var M;this.each(function(v,p){v=(O||Prototype.K)(v,p);if(M==undefined||v<M){M=v;}});return M;},partition:function(p){var O=[],M=[];this.each(function(K,v){((p||Prototype.K)(K,v)?O:M).push(K);});return [O,M];},pluck:function(O){var M=[];this.each(function(v,p){M.push(v[O]);});return M;},reject:function(O){var M=[];this.each(function(v,p){if(!O(v,p)){M.push(v);}});return M;},sortBy:function(M){return this.map(function(p,O){return {value:p,criteria:M(p,O)};}).sort(function(K,v){var p=K.criteria,O=v.criteria;return p<O?-1:p>O?1:0;}).pluck("value");},toArray:function(){return this.map();},zip:function(){var O=Prototype.K,M=$A(arguments);if(typeof M.last()=="function"){O=M.pop();}var p=[this].concat(M).map($A);return this.map(function(K,v){return O(p.pluck(v));});},size:function(){return this.toArray().length;},inspect:function(){return "#<Enumerable:"+this.toArray().inspect()+">";}};Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray});var $A=Array.from=function(v){if(!v){return [];}if(v.toArray){return v.toArray();}else{var O=[];for(var M=0,p=v.length;M<p;M++){O.push(v[M]);}return O;}};if(Prototype.Browser.WebKit){$A=Array.from=function(v){if(!v){return [];}if(!(typeof v=="function"&&v=="[object NodeList]")&&v.toArray){return v.toArray();}else{var O=[];for(var M=0,p=v.length;M<p;M++){O.push(v[M]);}return O;}};}Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse){Array.prototype._reverse=Array.prototype.reverse;}Object.extend(Array.prototype,{_each:function(O){for(var M=0,p=this.length;M<p;M++){O(this[M]);}},clear:function(){this.length=0;return this;},first:function(){return this[0];},last:function(){return this[this.length-1];},compact:function(){return this.select(function(M){return M!=null;});},flatten:function(){return this.inject([],function(O,M){return O.concat(M&&M.constructor==Array?M.flatten():[M]);});},without:function(){var M=$A(arguments);return this.select(function(O){return !M.include(O);});},indexOf:function(M){for(var O=0,p=this.length;O<p;O++){if(this[O]==M){return O;}}return -1;},reverse:function(M){return (M!==false?this:this.toArray())._reverse();},reduce:function(){return this.length>1?this:this[0];},uniq:function(M){return this.inject([],function(v,p,O){if(0==O||(M?v.last()!=p:!v.include(p))){v.push(p);}return v;});},clone:function(){return [].concat(this);},size:function(){return this.length;},inspect:function(){return "["+this.map(Object.inspect).join(", ")+"]";},toJSON:function(){var M=[];this.each(function(O){var p=Object.toJSON(O);if(p!==undefined){M.push(p);}});return "["+M.join(",")+"]";}});Array.prototype.toArray=Array.prototype.clone;function $w(M){M=M.strip();return M?M.split(/\s+/):[];}if(Prototype.Browser.Opera){Array.prototype.concat=function(){var K=[];for(var O=0,p=this.length;O<p;O++){K.push(this[O]);}for(var O=0,p=arguments.length;O<p;O++){if(arguments[O].constructor==Array){for(var M=0,v=arguments[O].length;M<v;M++){K.push(arguments[O][M]);}}else{K.push(arguments[O]);}}return K;};}var Hash=function(M){if(M instanceof Hash){this.merge(M);}else{Object.extend(this,M||{});}};Object.extend(Hash,{toQueryString:function(O){var M=[];M.add=arguments.callee.addPair;this.prototype._each.call(O,function(v){if(!v.key){return ;}var p=v.value;if(p&&typeof p=="object"){if(p.constructor==Array){p.each(function(K){M.add(v.key,K);});}return ;}M.add(v.key,p);});return M.join("&");},toJSON:function(M){var O=[];this.prototype._each.call(M,function(v){var p=Object.toJSON(v.value);if(p!==undefined){O.push(v.key.toJSON()+":"+p);}});return "{"+O.join(",")+"}";}});Hash.toQueryString.addPair=function(M,p,O){if(p==null){return ;}M=encodeURIComponent(M);this.push(M+"="+(p==null?"":encodeURIComponent(p)));};Object.extend(Hash.prototype,Enumerable);Object.extend(Hash.prototype,{_each:function(O){for(var M in this){var p=this[M];if(p&&p==Hash.prototype[M]){continue;}var v=[M,p];v.key=M;v.value=p;O(v);}},keys:function(){return this.pluck("key");},values:function(){return this.pluck("value");},merge:function(M){return $H(M).inject(this,function(O,p){O[p.key]=p.value;return O;});},remove:function(){var M;for(var O=0,p=arguments.length;O<p;O++){var v=this[arguments[O]];if(v!==undefined){if(M===undefined){M=v;}else{if(M.constructor!=Array){M=[M];}M.push(v);}}delete this[arguments[O]];}return M;},toQueryString:function(){return Hash.toQueryString(this);},inspect:function(){return "#<Hash:{"+this.map(function(M){return M.map(Object.inspect).join(": ");}).join(", ")+"}>";},toJSON:function(){return Hash.toJSON(this);}});function $H(M){if(M instanceof Hash){return M;}return new Hash(M);}if(function(){var M=0,p=function(v){this.key=v;};p.prototype.key="foo";for(var O in new p("bar")){M++;}return M>1;}()){Hash.prototype._each=function(p){var M=[];for(var O in this){var v=this[O];if((v&&v==Hash.prototype[O])||M.include(O)){continue;}M.push(O);var K=[O,v];K.key=O;K.value=v;p(K);}};}ObjectRange=Class.create();Object.extend(ObjectRange.prototype,Enumerable);Object.extend(ObjectRange.prototype,{initialize:function(p,M,O){this.start=p;this.end=M;this.exclusive=O;},_each:function(M){var O=this.start;while(this.include(O)){M(O);O=O.succ();}},include:function(M){if(M<this.start){return false;}if(this.exclusive){return M<this.end;}return M<=this.end;}});var $R=function(p,M,O){return new ObjectRange(p,M,O);};var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest();},function(){return new ActiveXObject("Msxml2.XMLHTTP");},function(){return new ActiveXObject("Microsoft.XMLHTTP");})||false;},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(M){this.responders._each(M);},register:function(M){if(!this.include(M)){this.responders.push(M);}},unregister:function(M){this.responders=this.responders.without(M);},dispatch:function(v,O,p,M){this.each(function(K){if(typeof K[v]=="function"){try{K[v].apply(K,[O,p,M]);}catch(o){}}});}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++;},onComplete:function(){Ajax.activeRequestCount--;}});Ajax.Base=function(){};Ajax.Base.prototype={setOptions:function(M){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:""};Object.extend(this.options,M||{});this.options.method=this.options.method.toLowerCase();if(typeof this.options.parameters=="string"){this.options.parameters=this.options.parameters.toQueryParams();}}};Ajax.Request=Class.create();Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Request.prototype=Object.extend(new Ajax.Base(),{_complete:false,initialize:function(O,M){this.transport=Ajax.getTransport();this.setOptions(M);this.request(O);},request:function(M){this.url=M;this.method=this.options.method;var p=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){p["_method"]=this.method;this.method="post";}this.parameters=p;if(p=Hash.toQueryString(p)){if(this.method=="get"){this.url+=(this.url.include("?")?"&":"?")+p;}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){p+="&_=";}}}try{Ajax.Responders.dispatch("onCreate",this,this.transport);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){setTimeout(function(){this.respondToReadyState(1);}.bind(this),10);}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?(this.options.postBody||p):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange();}}catch(O){this.dispatchException(O);}},onStateChange:function(){var M=this.transport.readyState;if(M>1&&!((M==4)&&this._complete)){this.respondToReadyState(this.transport.readyState);}},setRequestHeaders:function(){var K={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,"Accept":"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){K["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){K["Connection"]="close";}}if(typeof this.options.requestHeaders=="object"){var p=this.options.requestHeaders;if(typeof p.push=="function"){for(var O=0,v=p.length;O<v;O+=2){K[p[O]]=p[O+1];}}else{$H(p).each(function(o){K[o.key]=o.value;});}}for(var M in K){this.transport.setRequestHeader(M,K[M]);}},success:function(){return !this.transport.status||(this.transport.status>=200&&this.transport.status<300);},respondToReadyState:function(M){var p=Ajax.Request.Events[M];var K=this.transport,O=this.evalJSON();if(p=="Complete"){try{this._complete=true;(this.options["on"+this.transport.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(K,O);}catch(v){this.dispatchException(v);}if((this.getHeader("Content-type")||"text/javascript").strip().match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i)){this.evalResponse();}}try{(this.options["on"+p]||Prototype.emptyFunction)(K,O);Ajax.Responders.dispatch("on"+p,this,K,O);}catch(v){this.dispatchException(v);}if(p=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction;}},getHeader:function(M){try{return this.transport.getResponseHeader(M);}catch(O){return null;}},evalJSON:function(){try{var json=this.getHeader("X-JSON");return json?eval("("+json+")"):null;}catch(e){return null;}},evalResponse:function(){try{return eval(this.transport.responseText);}catch(e){this.dispatchException(e);}},dispatchException:function(M){(this.options.onException||Prototype.emptyFunction)(this,M);Ajax.Responders.dispatch("onException",this,M);}});Ajax.Updater=Class.create();Object.extend(Object.extend(Ajax.Updater.prototype,Ajax.Request.prototype),{initialize:function(M,p,O){this.container={success:(M.success||M),failure:(M.failure||(M.success?null:M))};this.transport=Ajax.getTransport();this.setOptions(O);var v=this.options.onComplete||Prototype.emptyFunction;this.options.onComplete=(function(o,K){this.updateContent();v(o,K);}).bind(this);this.request(p);},updateContent:function(){var O=this.container[this.success()?"success":"failure"];var M=this.transport.responseText;if(!this.options.evalScripts){M=M.stripScripts();}if(O=$(O)){if(this.options.insertion){new this.options.insertion(O,M);}else{O.update(M);}}if(this.success()){if(this.onComplete){setTimeout(this.onComplete.bind(this),10);}}}});Ajax.PeriodicalUpdater=Class.create();Ajax.PeriodicalUpdater.prototype=Object.extend(new Ajax.Base(),{initialize:function(M,p,O){this.setOptions(O);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=M;this.url=p;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(M){if(this.options.decay){this.decay=(M.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=M.responseText;}this.timer=setTimeout(this.onTimerEvent.bind(this),this.decay*this.frequency*1000);},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options);}});function $(O){if(arguments.length>1){for(var M=0,v=[],p=arguments.length;M<p;M++){v.push($(arguments[M]));}return v;}if(typeof O=="string"){O=document.getElementById(O);}return Element.extend(O);}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(o,M){var p=[];var K=document.evaluate(o,$(M)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var O=0,v=K.snapshotLength;O<v;O++){p.push(K.snapshotItem(O));}return p;};document.getElementsByClassName=function(O,M){var p=".//*[contains(concat(' ', @class, ' '), ' "+O+" ')]";return document._getElementsByXPath(p,M);};}else{document.getElementsByClassName=function(v,M){var p=($(M)||document.body).getElementsByTagName("*");var o=[],Q;for(var O=0,K=p.length;O<K;O++){Q=p[O];if(Element.hasClassName(Q,v)){o.push(Element.extend(Q));}}return o;};}if(!window.Element){var Element={};}Element.extend=function(K){var o=Prototype.BrowserFeatures;if(!K||!K.tagName||K.nodeType==3||K._extended||o.SpecificElementExtensions||K==window){return K;}var O={},v=K.tagName,M=Element.extend.cache,p=Element.Methods.ByTag;if(!o.ElementExtensions){Object.extend(O,Element.Methods),Object.extend(O,Element.Methods.Simulated);}if(p[v]){Object.extend(O,p[v]);}for(var w in O){var Q=O[w];if(typeof Q=="function"&&!(w in K)){K[w]=M.findOrStore(Q);}}K._extended=Prototype.emptyFunction;return K;};Element.extend.cache={findOrStore:function(M){return this[M]=this[M]||function(){return M.apply(null,[this].concat($A(arguments)));};}};Element.Methods={visible:function(M){return $(M).style.display!="none";},toggle:function(M){M=$(M);Element[Element.visible(M)?"hide":"show"](M);return M;},hide:function(M){$(M).style.display="none";return M;},show:function(M){$(M).style.display="";return M;},remove:function(M){M=$(M);M.parentNode.removeChild(M);return M;},update:function(O,M){M=typeof M=="undefined"?"":M.toString();$(O).innerHTML=M.stripScripts();setTimeout(function(){M.evalScripts();},10);return O;},replace:function(p,O){p=$(p);O=typeof O=="undefined"?"":O.toString();if(p.outerHTML){p.outerHTML=O.stripScripts();}else{var M=p.ownerDocument.createRange();M.selectNodeContents(p);p.parentNode.replaceChild(M.createContextualFragment(O.stripScripts()),p);}setTimeout(function(){O.evalScripts();},10);return p;},inspect:function(O){O=$(O);var M="<"+O.tagName.toLowerCase();$H({"id":"id","className":"class"}).each(function(o){var K=o.first(),p=o.last();var v=(O[K]||"").toString();if(v){M+=" "+p+"="+v.inspect(true);}});return M+">";},recursivelyCollect:function(M,p){M=$(M);var O=[];while(M=M[p]){if(M.nodeType==1){O.push(Element.extend(M));}}return O;},ancestors:function(M){return $(M).recursivelyCollect("parentNode");},descendants:function(M){return $A($(M).getElementsByTagName("*")).each(Element.extend);},immediateDescendants:function(M){if(!(M=$(M).firstChild)){return [];}while(M&&M.nodeType!=1){M=M.nextSibling;}if(M){return [M].concat($(M).nextSiblings());}return [];},previousSiblings:function(M){return $(M).recursivelyCollect("previousSibling");},nextSiblings:function(M){return $(M).recursivelyCollect("nextSibling");},siblings:function(M){M=$(M);return M.previousSiblings().reverse().concat(M.nextSiblings());},match:function(O,M){if(typeof M=="string"){M=new Selector(M);}return M.match($(O));},up:function(O,v,M){var p=$(O).ancestors();return v?Selector.findElement(p,v,M):p[M||0];},down:function(O,p,M){var v=$(O).descendants();return p?Selector.findElement(v,p,M):v[M||0];},previous:function(O,v,M){var p=$(O).previousSiblings();return v?Selector.findElement(p,v,M):p[M||0];},next:function(p,v,O){var M=$(p).nextSiblings();return v?Selector.findElement(M,v,O):M[O||0];},getElementsBySelector:function(){var M=$A(arguments),O=$(M.shift());return Selector.findChildElements(O,M);},getElementsByClassName:function(M,O){return document.getElementsByClassName(O,M);},readAttribute:function(p,M){p=$(p);if(Prototype.Browser.IE){if(!p.attributes){return null;}var O=Element._attributeTranslations;if(O.values[M]){return O.values[M](p,M);}if(O.names[M]){M=O.names[M];}var v=p.attributes[M];return v?v.nodeValue:null;}return p.getAttribute(M);},getHeight:function(M){return $(M).getDimensions().height;},getWidth:function(M){return $(M).getDimensions().width;},classNames:function(M){return new Element.ClassNames(M);},hasClassName:function(M,O){if(!(M=$(M))){return ;}var p=M.className;if(p.length==0){return false;}if(p==O||p.match(new RegExp("(^|\\s)"+O+"(\\s|$)"))){return true;}return false;},addClassName:function(M,O){if(!(M=$(M))){return ;}Element.classNames(M).add(O);return M;},removeClassName:function(M,O){if(!(M=$(M))){return ;}Element.classNames(M).remove(O);return M;},toggleClassName:function(M,O){if(!(M=$(M))){return ;}Element.classNames(M)[M.hasClassName(O)?"remove":"add"](O);return M;},observe:function(){Event.observe.apply(Event,arguments);return $A(arguments).first();},stopObserving:function(){Event.stopObserving.apply(Event,arguments);return $A(arguments).first();},cleanWhitespace:function(O){O=$(O);var p=O.firstChild;while(p){var M=p.nextSibling;if(p.nodeType==3&&!/\S/.test(p.nodeValue)){O.removeChild(p);}p=M;}return O;},empty:function(M){return $(M).innerHTML.blank();},descendantOf:function(O,M){O=$(O),M=$(M);while(O=O.parentNode){if(O==M){return true;}}return false;},scrollTo:function(M){M=$(M);var O=Position.cumulativeOffset(M);window.scrollTo(O[0],O[1]);return M;},getStyle:function(O,p){O=$(O);p=p=="float"?"cssFloat":p.camelize();var v=O.style[p];if(!v){var M=document.defaultView.getComputedStyle(O,null);v=M?M[p]:null;}if(p=="opacity"){return v?parseFloat(v):1;}return v=="auto"?null:v;},getOpacity:function(M){return $(M).getStyle("opacity");},setStyle:function(M,p,O){M=$(M);var K=M.style;for(var v in p){if(v=="opacity"){M.setOpacity(p[v]);}else{K[(v=="float"||v=="cssFloat")?(K.styleFloat===undefined?"cssFloat":"styleFloat"):(O?v:v.camelize())]=p[v];}}return M;},setOpacity:function(M,O){M=$(M);M.style.opacity=(O==1||O==="")?"":(O<0.00001)?0:O;return M;},getDimensions:function(p){p=$(p);var Q=$(p).getStyle("display");if(Q!="none"&&Q!=null){return {width:p.offsetWidth,height:p.offsetHeight};}var O=p.style;var o=O.visibility;var v=O.position;var M=O.display;O.visibility="hidden";O.position="absolute";O.display="block";var w=p.clientWidth;var K=p.clientHeight;O.display=M;O.position=v;O.visibility=o;return {width:w,height:K};},makePositioned:function(M){M=$(M);var O=Element.getStyle(M,"position");if(O=="static"||!O){M._madePositioned=true;M.style.position="relative";if(window.opera){M.style.top=0;M.style.left=0;}}return M;},undoPositioned:function(M){M=$(M);if(M._madePositioned){M._madePositioned=undefined;M.style.position=M.style.top=M.style.left=M.style.bottom=M.style.right="";}return M;},makeClipping:function(M){M=$(M);if(M._overflow){return M;}M._overflow=M.style.overflow||"auto";if((Element.getStyle(M,"overflow")||"visible")!="hidden"){M.style.overflow="hidden";}return M;},undoClipping:function(M){M=$(M);if(!M._overflow){return M;}M.style.overflow=M._overflow=="auto"?"":M._overflow;M._overflow=null;return M;}};Object.extend(Element.Methods,{childOf:Element.Methods.descendantOf});if(Prototype.Browser.Opera){Element.Methods._getStyle=Element.Methods.getStyle;Element.Methods.getStyle=function(M,O){switch(O){case "left":case "top":case "right":case "bottom":if(Element._getStyle(M,"position")=="static"){return null;}default:return Element._getStyle(M,O);}};}else{if(Prototype.Browser.IE){Element.Methods.getStyle=function(M,O){M=$(M);O=(O=="float"||O=="cssFloat")?"styleFloat":O.camelize();var p=M.style[O];if(!p&&M.currentStyle){p=M.currentStyle[O];}if(O=="opacity"){if(p=(M.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(p[1]){return parseFloat(p[1])/100;}}return 1;}if(p=="auto"){if((O=="width"||O=="height")&&(M.getStyle("display")!="none")){return M["offset"+O.capitalize()]+"px";}return null;}return p;};Element.Methods.setOpacity=function(M,v){M=$(M);var p=M.getStyle("filter"),O=M.style;if(v==1||v===""){O.filter=p.replace(/alpha\([^\)]*\)/gi,"");return M;}else{if(v<0.00001){v=0;}}O.filter=p.replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+(v*100)+")";return M;};Element.Methods.update=function(p,O){p=$(p);O=typeof O=="undefined"?"":O.toString();var M=p.tagName.toUpperCase();if(["THEAD","TBODY","TR","TD"].include(M)){var v=document.createElement("div");switch(M){case "THEAD":case "TBODY":v.innerHTML="<table><tbody>"+O.stripScripts()+"</tbody></table>";depth=2;break;case "TR":v.innerHTML="<table><tbody><tr>"+O.stripScripts()+"</tr></tbody></table>";depth=3;break;case "TD":v.innerHTML="<table><tbody><tr><td>"+O.stripScripts()+"</td></tr></tbody></table>";depth=4;}$A(p.childNodes).each(function(K){p.removeChild(K);});depth.times(function(){v=v.firstChild;});$A(v.childNodes).each(function(K){p.appendChild(K);});}else{p.innerHTML=O.stripScripts();}setTimeout(function(){O.evalScripts();},10);return p;};}else{if(Prototype.Browser.Gecko){Element.Methods.setOpacity=function(M,O){M=$(M);M.style.opacity=(O==1)?0.999999:(O==="")?"":(O<0.00001)?0:O;return M;};}}}Element._attributeTranslations={names:{colspan:"colSpan",rowspan:"rowSpan",valign:"vAlign",datetime:"dateTime",accesskey:"accessKey",tabindex:"tabIndex",enctype:"encType",maxlength:"maxLength",readonly:"readOnly",longdesc:"longDesc"},values:{_getAttr:function(M,O){return M.getAttribute(O,2);},_flag:function(M,O){return $(M).hasAttribute(O)?O:null;},style:function(M){return M.style.cssText.toLowerCase();},title:function(M){var O=M.getAttributeNode("title");return O.specified?O.nodeValue:null;}}};(function(){Object.extend(this,{href:this._getAttr,src:this._getAttr,disabled:this._flag,checked:this._flag,readonly:this._flag,multiple:this._flag});}).call(Element._attributeTranslations.values);Element.Methods.Simulated={hasAttribute:function(O,v){var M=Element._attributeTranslations,p;v=M.names[v]||v;p=$(O).getAttributeNode(v);return p&&p.specified;}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);if(!Prototype.BrowserFeatures.ElementExtensions&&document.createElement("div").__proto__){window.HTMLElement={};window.HTMLElement.prototype=document.createElement("div").__proto__;Prototype.BrowserFeatures.ElementExtensions=true;}Element.hasAttribute=function(M,O){if(M.hasAttribute){return M.hasAttribute(O);}return Element.Methods.Simulated.hasAttribute(M,O);};Element.addMethods=function(p){var w=Prototype.BrowserFeatures,v=Element.Methods.ByTag;if(arguments.length==2){var O=p;p=arguments[1];}if(!O){Object.extend(Element.Methods,p||{});}else{if(O.constructor==Array){O.each(Q);}else{Q(O);}}function Q(T){T=T.toUpperCase();if(!Element.Methods.ByTag[T]){Element.Methods.ByTag[T]={};}Object.extend(Element.Methods.ByTag[T],p);}function M(b,a,T){T=T||false;var t=Element.extend.cache;for(var f in b){var V=b[f];if(!T||!(f in a)){a[f]=t.findOrStore(V);}}}function K(t){var T;var a={"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(a[t]){T="HTML"+a[t]+"Element";}if(window[T]){return window[T];}T="HTML"+t+"Element";if(window[T]){return window[T];}T="HTML"+t.capitalize()+"Element";if(window[T]){return window[T];}window[T]={};window[T].prototype=document.createElement(t).__proto__;return window[T];}if(w.ElementExtensions){M(Element.Methods,HTMLElement.prototype);M(Element.Methods.Simulated,HTMLElement.prototype,true);}if(w.SpecificElementExtensions){for(var y in Element.Methods.ByTag){var o=K(y);if(typeof o=="undefined"){continue;}M(v[y],o.prototype);}}};var Toggle={display:Element.toggle};Abstract.Insertion=function(M){this.adjacency=M;};Abstract.Insertion.prototype={initialize:function(O,p){this.element=$(O);this.content=p.stripScripts();if(this.adjacency&&this.element.insertAdjacentHTML){try{this.element.insertAdjacentHTML(this.adjacency,this.content);}catch(v){var M=this.element.tagName.toUpperCase();if(["TBODY","TR"].include(M)){this.insertContent(this.contentFromAnonymousTable());}else{throw v;}}}else{this.range=this.element.ownerDocument.createRange();if(this.initializeRange){this.initializeRange();}this.insertContent([this.range.createContextualFragment(this.content)]);}setTimeout(function(){p.evalScripts();},10);},contentFromAnonymousTable:function(){var M=document.createElement("div");M.innerHTML="<table><tbody>"+this.content+"</tbody></table>";return $A(M.childNodes[0].childNodes[0].childNodes);}};var Insertion=new Object();Insertion.Before=Class.create();Insertion.Before.prototype=Object.extend(new Abstract.Insertion("beforeBegin"),{initializeRange:function(){this.range.setStartBefore(this.element);},insertContent:function(M){M.each((function(O){this.element.parentNode.insertBefore(O,this.element);}).bind(this));}});Insertion.Top=Class.create();Insertion.Top.prototype=Object.extend(new Abstract.Insertion("afterBegin"),{initializeRange:function(){this.range.selectNodeContents(this.element);this.range.collapse(true);},insertContent:function(M){M.reverse(false).each((function(O){this.element.insertBefore(O,this.element.firstChild);}).bind(this));}});Insertion.Bottom=Class.create();Insertion.Bottom.prototype=Object.extend(new Abstract.Insertion("beforeEnd"),{initializeRange:function(){this.range.selectNodeContents(this.element);this.range.collapse(this.element);},insertContent:function(M){M.each((function(O){this.element.appendChild(O);}).bind(this));}});Insertion.After=Class.create();Insertion.After.prototype=Object.extend(new Abstract.Insertion("afterEnd"),{initializeRange:function(){this.range.setStartAfter(this.element);},insertContent:function(M){M.each((function(O){this.element.parentNode.insertBefore(O,this.element.nextSibling);}).bind(this));}});Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(M){this.element=$(M);},_each:function(M){this.element.className.split(/\s+/).select(function(O){return O.length>0;})._each(M);},set:function(M){this.element.className=M;},add:function(M){if(this.include(M)){return ;}this.set($A(this).concat(M).join(" "));},remove:function(M){if(!this.include(M)){return ;}this.set($A(this).without(M).join(" "));},toString:function(){return $A(this).join(" ");}};Object.extend(Element.ClassNames.prototype,Enumerable);var Selector=Class.create();Selector.prototype={initialize:function(M){this.expression=M.strip();this.compileMatcher();},compileMatcher:function(){if(Prototype.BrowserFeatures.XPath&&!(/\[[\w-]*?:/).test(this.expression)){return this.compileXPathMatcher();}var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m;if(Selector._cache[e]){this.matcher=Selector._cache[e];return ;}this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in ps){p=ps[i];if(m=e.match(p)){this.matcher.push(typeof c[i]=="function"?c[i](m):new Template(c[i]).evaluate(m));e=e.replace(m[0],"");break;}}}this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join("\n"));Selector._cache[this.expression]=this.matcher;},compileXPathMatcher:function(){var Q=this.expression,w=Selector.patterns,O=Selector.xpath,K,o,M;if(Selector._cache[Q]){this.xpath=Selector._cache[Q];return ;}this.matcher=[".//*"];while(Q&&K!=Q&&(/\S/).test(Q)){K=Q;for(var v in w){if(M=Q.match(w[v])){this.matcher.push(typeof O[v]=="function"?O[v](M):new Template(O[v]).evaluate(M));Q=Q.replace(M[0],"");break;}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath;},findElements:function(M){M=M||document;if(this.xpath){return document._getElementsByXPath(this.xpath,M);}return this.matcher(M);},match:function(M){return this.findElements(document).include(M);},toString:function(){return this.expression;},inspect:function(){return "#<Selector:"+this.expression.inspect()+">";}};Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(M){if(M[1]=="*"){return "";}return "[local-name()='"+M[1].toLowerCase()+"' or local-name()='"+M[1].toUpperCase()+"']";},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:"[@#{1}]",attr:function(M){M[3]=M[5]||M[6];return new Template(Selector.xpath.operators[M[2]]).evaluate(M);},pseudo:function(M){var O=Selector.xpath.pseudos[M[1]];if(!O){return "";}if(typeof O==="function"){return O(M);}return new Template(Selector.xpath.pseudos[M[1]]).evaluate(M);},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","only-child":"[not(preceding-sibling::* or following-sibling::*)]","empty":"[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]","checked":"[@checked]","disabled":"[@disabled]","enabled":"[not(@disabled)]","not":function(O){if(!O[6]){return "";}var o=Selector.patterns,M=Selector.xpath;for(var K in o){if(mm=O[6].match(o[K])){var v=typeof M[K]=="function"?M[K](mm):new Template(M[K]).evaluate(mm);O[6]=v.substring(1,v.length-1);break;}}return "[not("+O[6]+")]";},"nth-child":function(M){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",M);},"nth-last-child":function(M){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",M);},"nth-of-type":function(M){return Selector.xpath.pseudos.nth("position() ",M);},"nth-last-of-type":function(M){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",M);},"first-of-type":function(M){M[6]="1";return Selector.xpath.pseudos["nth-of-type"](M);},"last-of-type":function(M){M[6]="1";return Selector.xpath.pseudos["nth-last-of-type"](M);},"only-of-type":function(M){var O=Selector.xpath.pseudos;return O["first-of-type"](M)+O["last-of-type"](M);},nth:function(p,O){var K,o=O[6];if(o=="even"){o="2n+0";}if(o=="odd"){o="2n+1";}if(K=o.match(/^(\d+)$/)){p+="= "+K[1];}if(K=o.match(/^(\d+)?n(\+(\d+))?/)){var v=K[1]?Number(K[1]):1;var M=K[3]?Number(K[3]):0;p+="mod "+v+" = "+M;}return "["+p+"]";}}},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 = false;",attr:function(M){M[3]=M[5]||M[6];return new Template("n = h.attr(n, r, \"#{1}\", \"#{3}\", \"#{2}\"); c = false;").evaluate(M);},pseudo:"n = h.pseudo(n, \"#{1}\", \"#{6}\", r, c); c = false;",descendant:"c = \"descendant\";",child:"c = \"child\";",adjacent:"c = \"adjacent\";",laterSibling:"c = \"laterSibling\";"},patterns:{laterSibling:/^\s*~\s*/,child:/^\s*>\s*/,adjacent:/^\s*\+\s*/,descendant:/^\s/,tagName:/^\s*(\*|[\w\-]+)(\b|$)?/,id:/^#([\w\-\*]+)(\b|$)/,className:/^\.([\w\-\*]+)(\b|$)/,pseudo:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$)/,attrPresence:/^\[([\w]+)\]/,attr:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\]]*?)\4|([^'"][^\]]*?)))?\]/},handlers:{concat:function(O,M){for(var p=0,v;v=M[p];p++){O.push(v);}return O;},mark:function(M){for(var O=0,p;p=M[O];O++){p._counted=true;}return M;},unmark:function(M){for(var O=0,p;p=M[O];O++){p._counted=undefined;}return M;},index:function(M,v,o){M._counted=true;if(v){for(var O=M.childNodes,K=O.length-1,p=1;K>=0;K--){node=O[K];if(node.nodeType==1&&(!o||node._counted)){node.nodeIndex=p++;}}}else{for(var K=0,p=1,O=M.childNodes;node=O[K];K++){if(node.nodeType==1&&(!o||node._counted)){node.nodeIndex=p++;}}}},unique:function(O){if(O.length==0){return O;}var v=[],K;for(var p=0,M=O.length;p<M;p++){if(!(K=O[p])._counted){K._counted=true;v.push(Element.extend(K));}}return Selector.handlers.unmark(v);},descendant:function(M){var v=Selector.handlers;for(var p=0,O=[],K;K=M[p];p++){v.concat(O,Element.descendants(K));}return O;},child:function(M){var v=Selector.handlers;for(var p=0,O=[],K;K=M[p];p++){v.concat(O,Element.immediateDescendants(K));}return O;},adjacent:function(M){for(var p=0,O=[],K;K=M[p];p++){var v=this.nextElementSibling(K);if(v){O.push(v);}}return O;},laterSibling:function(M){var v=Selector.handlers;for(var p=0,O=[],K;K=M[p];p++){v.concat(O,Element.nextSiblings(K));}return O;},nextElementSibling:function(M){while(M=M.nextSibling){if(M.nodeType==1){return M;}}return null;},previousElementSibling:function(M){while(M=M.previousSibling){if(M.nodeType==1){return M;}}return null;},tagName:function(O,M,K,w){K=K.toUpperCase();var v=[],o=Selector.handlers;if(O){if(w){if(w=="descendant"){for(var p=0,Q;Q=O[p];p++){o.concat(v,Q.getElementsByTagName(K));}return v;}else{O=this[w](O);}if(K=="*"){return O;}}for(var p=0,Q;Q=O[p];p++){if(Q.tagName.toUpperCase()==K){v.push(Q);}}return v;}else{return M.getElementsByTagName(K);}},id:function(O,M,w,o){var Q=$(w),v=Selector.handlers;if(!O&&M==document){return Q?[Q]:[];}if(O){if(o){if(o=="child"){for(var p=0,K;K=O[p];p++){if(Q.parentNode==K){return [Q];}}}else{if(o=="descendant"){for(var p=0,K;K=O[p];p++){if(Element.descendantOf(Q,K)){return [Q];}}}else{if(o=="adjacent"){for(var p=0,K;K=O[p];p++){if(Selector.handlers.previousElementSibling(Q)==K){return [Q];}}}else{O=v[o](O);}}}}for(var p=0,K;K=O[p];p++){if(K==Q){return [Q];}}return [];}return (Q&&Element.descendantOf(Q,M))?[Q]:[];},className:function(O,M,p,v){if(O&&v){O=this[v](O);}return Selector.handlers.byClassName(O,M,p);},byClassName:function(p,O,o){if(!p){p=Selector.handlers.descendant([O]);}var w=" "+o+" ";for(var K=0,v=[],Q,M;Q=p[K];K++){M=Q.className;if(M.length==0){continue;}if(M==o||(" "+M+" ").include(w)){v.push(Q);}}return v;},attrPresence:function(p,O,M){var K=[];for(var v=0,o;o=p[v];v++){if(Element.hasAttribute(o,M)){K.push(o);}}return K;},attr:function(M,w,Q,y,O){var T=Selector.operators[O],v=[];for(var K=0,p;p=M[K];K++){var o=Element.readAttribute(p,Q);if(o===null){continue;}if(T(o,y)){v.push(p);}}return v;},pseudo:function(O,p,K,M,v){if(v){O=this[v](O);}return Selector.pseudos[p](O,K,M);}},pseudos:{"first-child":function(O,o,M){for(var v=0,p=[],K;K=O[v];v++){if(Selector.handlers.previousElementSibling(K)){continue;}p.push(K);}return p;},"last-child":function(O,o,M){for(var v=0,p=[],K;K=O[v];v++){if(Selector.handlers.nextElementSibling(K)){continue;}p.push(K);}return p;},"only-child":function(O,Q,M){var K=Selector.handlers;for(var v=0,p=[],o;o=O[v];v++){if(!K.previousElementSibling(o)&&!K.nextElementSibling(o)){p.push(o);}}return p;},"nth-child":function(O,p,M){return Selector.pseudos.nth(O,p,M);},"nth-last-child":function(O,p,M){return Selector.pseudos.nth(O,p,M,true);},"nth-of-type":function(O,p,M){return Selector.pseudos.nth(O,p,M,false,true);},"nth-last-of-type":function(O,p,M){return Selector.pseudos.nth(O,p,M,true,true);},"first-of-type":function(O,p,M){return Selector.pseudos.nth(O,"1",M,false,true);},"last-of-type":function(O,p,M){return Selector.pseudos.nth(O,"1",M,true,true);},"only-of-type":function(O,K,M){var v=Selector.pseudos;return v["last-of-type"](v["first-of-type"](O,K,M),K,M);},nth:function(M,T,V,y,p){if(T=="even"){T="2n+0";}if(T=="odd"){T="2n+1";}var w=Selector.handlers,Q=[],O=[],K;w.mark(M);for(var o=0,v;v=M[o];o++){if(!v.parentNode._counted){w.index(v.parentNode,y,p);O.push(v.parentNode);}}if(T.match(/^\d+$/)){T=Number(T);for(var o=0,v;v=M[o];o++){if(v.nodeIndex==T){Q.push(v);}}}else{if(K=T.match(/^(\d+)?n(\+(\d+))?$/)){var f=K[1]?Number(K[1]):1;var t=K[3]?Number(K[3]):0;for(var o=0,v;v=M[o];o++){if(v.nodeIndex%f==t){Q.push(v);}}}}w.unmark(M);w.unmark(O);return Q;},"empty":function(O,o,M){for(var v=0,p=[],K;K=O[v];v++){if(K.tagName=="!"||(K.firstChild&&!K.innerHTML.match(/^\s*$/))){continue;}p.push(K);}return p;},"not":function(M,v,y){var Q=Selector.handlers,w=$A(M),T,p;for(var o in Selector.patterns){if(p=v.match(Selector.patterns[o])){T=o;break;}}switch(T){case "className":case "tagName":case "id":case "attrPresence":w=Q[T](w,y,p[1],false);break;case "attr":p[3]=p[5]||p[6];w=Q.attr(w,y,p[1],p[3],p[2]);break;case "pseudo":w=Q.pseudo(w,p[1],p[6],y,false);break;default:throw "Illegal selector in :not clause.";}Q.mark(w);for(var o=0,K=[],O;O=M[o];o++){if(!O._counted){K.push(O);}}Q.unmark(w);return K;},"enabled":function(O,o,M){for(var v=0,p=[],K;K=O[v];v++){if(!K.disabled){p.push(K);}}return p;},"disabled":function(O,o,M){for(var v=0,p=[],K;K=O[v];v++){if(K.disabled){p.push(K);}}return p;},"checked":function(O,o,M){for(var v=0,p=[],K;K=O[v];v++){if(K.checked){p.push(K);}}return p;}},operators:{"=":function(O,M){return O==M;},"!=":function(O,M){return O!=M;},"^=":function(O,M){return O.startsWith(M);},"$=":function(O,M){return O.endsWith(M);},"*=":function(O,M){return O.include(M);},"~=":function(O,M){return (" "+O+" ").include(" "+M+" ");},"|=":function(O,M){return ("-"+O.toUpperCase()+"-").include("-"+M.toUpperCase()+"-");}},matchElements:function(o,Q){var K=new Selector(Q).findElements(),v=Selector.handlers;v.mark(K);for(var p=0,O=[],M;M=o[p];p++){if(M._counted){O.push(M);}}v.unmark(K);return O;},findElement:function(O,p,M){if(typeof p=="number"){M=p;p=false;}return Selector.matchElements(O,p||"*")[M||0];},findChildElements:function(K,Q){var w=Q.join(","),Q=[];w.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(y){Q.push(y[1].strip());});var v=[],o=Selector.handlers;for(var p=0,O=Q.length,M;p<O;p++){M=new Selector(Q[p].strip());o.concat(v,M.findElements(K));}return (O>1)?o.unique(v):v;}});function $$(){return Selector.findChildElements(document,$A(arguments));}var Form={reset:function(M){$(M).reset();return M;},serializeElements:function(p,M){var O=p.inject({},function(v,o){if(!o.disabled&&o.name){var K=o.name,Q=$(o).getValue();if(Q!=null){if(K in v){if(v[K].constructor!=Array){v[K]=[v[K]];}v[K].push(Q);}else{v[K]=Q;}}}return v;});return M?O:Hash.toQueryString(O);}};Form.Methods={serialize:function(O,M){return Form.serializeElements(Form.getElements(O),M);},getElements:function(M){return $A($(M).getElementsByTagName("*")).inject([],function(O,p){if(Form.Element.Serializers[p.tagName.toLowerCase()]){O.push(Element.extend(p));}return O;});},getInputs:function(Q,p,v){Q=$(Q);var M=Q.getElementsByTagName("input");if(!p&&!v){return $A(M).map(Element.extend);}for(var K=0,w=[],o=M.length;K<o;K++){var O=M[K];if((p&&O.type!=p)||(v&&O.name!=v)){continue;}w.push(Element.extend(O));}return w;},disable:function(M){M=$(M);M.getElements().each(function(O){O.blur();O.disabled="true";});return M;},enable:function(M){M=$(M);M.getElements().each(function(O){O.disabled="";});return M;},findFirstElement:function(M){return $(M).getElements().find(function(O){return O.type!="hidden"&&!O.disabled&&["input","select","textarea"].include(O.tagName.toLowerCase());});},focusFirstElement:function(M){M=$(M);M.findFirstElement().activate();return M;},request:function(O,M){O=$(O),M=Object.clone(M||{});var p=M.parameters;M.parameters=O.serialize(true);if(p){if(typeof p=="string"){p=p.toQueryParams();}Object.extend(M.parameters,p);}if(O.hasAttribute("method")&&!M.method){M.method=O.method;}return new Ajax.Request(O.action,M);}};Object.extend(Form,Form.Methods);Form.Element={focus:function(M){$(M).focus();return M;},select:function(M){$(M).select();return M;}};Form.Element.Methods={serialize:function(M){M=$(M);if(!M.disabled&&M.name){var O=M.getValue();if(O!=undefined){var p={};p[M.name]=O;return Hash.toQueryString(p);}}return "";},getValue:function(M){M=$(M);var O=M.tagName.toLowerCase();return Form.Element.Serializers[O](M);},clear:function(M){$(M).value="";return M;},present:function(M){return $(M).value!="";},activate:function(M){M=$(M);try{M.focus();if(M.select&&(M.tagName.toLowerCase()!="input"||!["button","reset","submit"].include(M.type))){M.select();}}catch(O){}return M;},disable:function(M){M=$(M);M.blur();M.disabled=true;return M;},enable:function(M){M=$(M);M.disabled=false;return M;}};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)});var Field=Form.Element;var $F=Form.Element.getValue;Form.Element.Serializers={input:function(M){switch(M.type.toLowerCase()){case "checkbox":case "radio":return Form.Element.Serializers.inputSelector(M);default:return Form.Element.Serializers.textarea(M);}},inputSelector:function(M){return M.checked?M.value:null;},textarea:function(M){return M.value;},select:function(M){return this[M.type=="select-one"?"selectOne":"selectMany"](M);},selectOne:function(O){var M=O.selectedIndex;return M>=0?this.optionValue(O.options[M]):null;},selectMany:function(v){var M,K=v.length;if(!K){return null;}for(var p=0,M=[];p<K;p++){var O=v.options[p];if(O.selected){M.push(this.optionValue(O));}}return M;},optionValue:function(M){return Element.extend(M).hasAttribute("value")?M.value:M.text;}};Abstract.TimedObserver=function(){};Abstract.TimedObserver.prototype={initialize:function(M,O,p){this.frequency=O;this.element=$(M);this.callback=p;this.lastValue=this.getValue();this.registerCallback();},registerCallback:function(){setInterval(this.onTimerEvent.bind(this),this.frequency*1000);},onTimerEvent:function(){var M=this.getValue();var O=("string"==typeof this.lastValue&&"string"==typeof M?this.lastValue!=M:String(this.lastValue)!=String(M));if(O){this.callback(this.element,M);this.lastValue=M;}}};Form.Element.Observer=Class.create();Form.Element.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){return Form.Element.getValue(this.element);}});Form.Observer=Class.create();Form.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){return Form.serialize(this.element);}});Abstract.EventObserver=function(){};Abstract.EventObserver.prototype={initialize:function(M,O){this.element=$(M);this.callback=O;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks();}else{this.registerCallback(this.element);}},onElementEvent:function(){var M=this.getValue();if(this.lastValue!=M){this.callback(this.element,M);this.lastValue=M;}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback.bind(this));},registerCallback:function(M){if(M.type){switch(M.type.toLowerCase()){case "checkbox":case "radio":Event.observe(M,"click",this.onElementEvent.bind(this));break;default:Event.observe(M,"change",this.onElementEvent.bind(this));break;}}}};Form.Element.EventObserver=Class.create();Form.Element.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){return Form.Element.getValue(this.element);}});Form.EventObserver=Class.create();Form.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){return Form.serialize(this.element);}});if(!window.Event){var Event=new Object();}Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,element:function(M){return M.target||M.srcElement;},isLeftClick:function(M){return (((M.which)&&(M.which==1))||((M.button)&&(M.button==1)));},pointerX:function(M){return M.pageX||(M.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));},pointerY:function(M){return M.pageY||(M.clientY+(document.documentElement.scrollTop||document.body.scrollTop));},stop:function(M){if(M.preventDefault){M.preventDefault();M.stopPropagation();}else{M.returnValue=false;M.cancelBubble=true;}},findElement:function(p,O){var M=Event.element(p);while(M.parentNode&&(!M.tagName||(M.tagName.toUpperCase()!=O.toUpperCase()))){M=M.parentNode;}return M;},observers:false,_observeAndCache:function(v,p,O,M){if(!this.observers){this.observers=[];}if(v.addEventListener){this.observers.push([v,p,O,M]);v.addEventListener(p,O,M);}else{if(v.attachEvent){this.observers.push([v,p,O,M]);v.attachEvent("on"+p,O);}}},unloadCache:function(){if(!Event.observers){return ;}for(var M=0,O=Event.observers.length;M<O;M++){Event.stopObserving.apply(this,Event.observers[M]);Event.observers[M][0]=null;}Event.observers=false;},observe:function(v,p,O,M){v=$(v);M=M||false;if(p=="keypress"&&(Prototype.Browser.WebKit||v.attachEvent)){p="keydown";}Event._observeAndCache(v,p,O,M);},stopObserving:function(v,p,O,M){v=$(v);M=M||false;if(p=="keypress"&&(Prototype.Browser.WebKit||v.attachEvent)){p="keydown";}if(v.removeEventListener){v.removeEventListener(p,O,M);}else{if(v.detachEvent){try{v.detachEvent("on"+p,O);}catch(K){}}}}});if(Prototype.Browser.IE){Event.observe(window,"unload",Event.unloadCache,false);}var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;},realOffset:function(O){var M=0,p=0;do{M+=O.scrollTop||0;p+=O.scrollLeft||0;O=O.parentNode;}while(O);return [p,M];},cumulativeOffset:function(O){var M=0,p=0;do{M+=O.offsetTop||0;p+=O.offsetLeft||0;O=O.offsetParent;}while(O);return [p,M];},positionedOffset:function(O){var M=0,K=0;do{M+=O.offsetTop||0;K+=O.offsetLeft||0;O=O.offsetParent;if(O){if(O.tagName=="BODY"){break;}var v=Element.getStyle(O,"position");if(v=="relative"||v=="absolute"){break;}}}while(O);return [K,M];},offsetParent:function(M){if(M.offsetParent){return M.offsetParent;}if(M==document.body){return M;}while((M=M.parentNode)&&M!=document.body){if(Element.getStyle(M,"position")!="static"){return M;}}return document.body;},within:function(O,M,p){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(O,M,p);}this.xcomp=M;this.ycomp=p;this.offset=this.cumulativeOffset(O);return (p>=this.offset[1]&&p<this.offset[1]+O.offsetHeight&&M>=this.offset[0]&&M<this.offset[0]+O.offsetWidth);},withinIncludingScrolloffsets:function(O,M,v){var p=this.realOffset(O);this.xcomp=M+p[0]-this.deltaX;this.ycomp=v+p[1]-this.deltaY;this.offset=this.cumulativeOffset(O);return (this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+O.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+O.offsetWidth);},overlap:function(O,M){if(!O){return 0;}if(O=="vertical"){return ((this.offset[1]+M.offsetHeight)-this.ycomp)/M.offsetHeight;}if(O=="horizontal"){return ((this.offset[0]+M.offsetWidth)-this.xcomp)/M.offsetWidth;}},page:function(v){var M=0,p=0;var O=v;do{M+=O.offsetTop||0;p+=O.offsetLeft||0;if(O.offsetParent==document.body){if(Element.getStyle(O,"position")=="absolute"){break;}}}while(O=O.offsetParent);O=v;do{if(!window.opera||O.tagName=="BODY"){M-=O.scrollTop||0;p-=O.scrollLeft||0;}}while(O=O.parentNode);return [p,M];},clone:function(v,o){var M=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});v=$(v);var K=Position.page(v);o=$(o);var Q=[0,0];var O=null;if(Element.getStyle(o,"position")=="absolute"){O=Position.offsetParent(o);Q=Position.page(O);}if(O==document.body){Q[0]-=document.body.offsetLeft;Q[1]-=document.body.offsetTop;}if(M.setLeft){o.style.left=(K[0]-Q[0]+M.offsetLeft)+"px";}if(M.setTop){o.style.top=(K[1]-Q[1]+M.offsetTop)+"px";}if(M.setWidth){o.style.width=v.offsetWidth+"px";}if(M.setHeight){o.style.height=v.offsetHeight+"px";}},absolutize:function(O){O=$(O);if(O.style.position=="absolute"){return ;}Position.prepare();var v=Position.positionedOffset(O);var o=v[1];var K=v[0];var p=O.clientWidth;var M=O.clientHeight;O._originalLeft=K-parseFloat(O.style.left||0);O._originalTop=o-parseFloat(O.style.top||0);O._originalWidth=O.style.width;O._originalHeight=O.style.height;O.style.position="absolute";O.style.top=o+"px";O.style.left=K+"px";O.style.width=p+"px";O.style.height=M+"px";},relativize:function(M){M=$(M);if(M.style.position=="relative"){return ;}Position.prepare();M.style.position="relative";var p=parseFloat(M.style.top||0)-(M._originalTop||0);var O=parseFloat(M.style.left||0)-(M._originalLeft||0);M.style.top=p+"px";M.style.left=O+"px";M.style.height=M._originalHeight;M.style.width=M._originalWidth;}};if(Prototype.Browser.WebKit){Position.cumulativeOffset=function(O){var M=0,p=0;do{M+=O.offsetTop||0;p+=O.offsetLeft||0;if(O.offsetParent==document.body){if(Element.getStyle(O,"position")=="absolute"){break;}}O=O.offsetParent;}while(O);return [p,M];};}Element.addMethods();Object.extend(Event,{_domReady:function(){if(arguments.callee.done){return ;}arguments.callee.done=true;if(Event._timer){clearInterval(Event._timer);}Event._readyCallbacks.each(function(M){M();});Event._readyCallbacks=null;},onReady:function(O){if(!this._readyCallbacks){var M=this._domReady;if(M.done){return O();}if(document.addEventListener){document.addEventListener("DOMContentLoaded",M,false);}if(/WebKit/i.test(navigator.userAgent)){this._timer=setInterval(function(){if(/loaded|complete/.test(document.readyState)){M();}},10);}Event.observe(window,"load",M);Event._readyCallbacks=[];}Event._readyCallbacks.push(O);}});var Arithmetic={problem_answer:0,score:0,time_left:120,increment_score:function(){$$("#score span")[0].update(++this.score);},init:function(){$("indicator").hide();$("answer").focus();$("answer").onkeyup=function(){if(this.value==String(Arithmetic.problem_answer)){this.value="";Arithmetic.increment_score();new_problem();}};new_problem();Arithmetic.timer=new PeriodicalExecuter(function(){$("answer").onkeyup();Arithmetic.time_left--;$("left").innerHTML="Seconds left: "+Arithmetic.time_left;if(Arithmetic.time_left<=0){Arithmetic.timer.stop();["score","left"].each(function(M){$(M).remove();});Arithmetic.toggle_indicator();new Ajax.Updater("main","add_score",{onComplete:function(){Arithmetic.toggle_indicator();$$("#end_score span")[0].update(Arithmetic.score);},parameters:{score:Arithmetic.score,prefs:$H(Arithmetic.question_preferences).toJSON()}});}},1);window.onunload=function(){Arithmetic.timer.stop();};},toggle_indicator:function(){["main","indicator"].each(function(M){$(M).toggle();});}};function new_problem(){var ops=Arithmetic.question_preferences["operations"];var op=ops[Math.floor(Math.random()*ops.length)];eval("new_"+op+"_problem();");}function new_addition_problem(){var p=$("problem");var O=Arithmetic.question_preferences["addition_high_1"]-Arithmetic.question_preferences["addition_low_1"];var K=Arithmetic.question_preferences["addition_low_1"];var M=Arithmetic.question_preferences["addition_high_2"]-Arithmetic.question_preferences["addition_low_2"];var v=Arithmetic.question_preferences["addition_low_2"];var Q=Math.floor(Math.random()*(Math.abs(O)+1))+K;var o=Math.floor(Math.random()*(Math.abs(M)+1))+v;Arithmetic.problem_answer=Q+o;p.innerHTML=Q+" + "+o;}function new_subtraction_problem(){var p=$("problem");var O=Arithmetic.question_preferences["addition_high_1"]-Arithmetic.question_preferences["addition_low_1"];var K=Arithmetic.question_preferences["addition_low_1"];var M=Arithmetic.question_preferences["addition_high_2"]-Arithmetic.question_preferences["addition_low_2"];var v=Arithmetic.question_preferences["addition_low_2"];var Q=Math.floor(Math.random()*(Math.abs(O)+1))+K;var o=Math.floor(Math.random()*(Math.abs(M)+1))+v;Arithmetic.problem_answer=Q;p.innerHTML=(Q+o)+" &minus; "+o;}function new_multiplication_problem(){var p=$("problem");var O=Arithmetic.question_preferences["multiplication_high_1"]-Arithmetic.question_preferences["multiplication_low_1"];var K=Arithmetic.question_preferences["multiplication_low_1"];var M=Arithmetic.question_preferences["multiplication_high_2"]-Arithmetic.question_preferences["multiplication_low_2"];var v=Arithmetic.question_preferences["multiplication_low_2"];var Q=Math.floor(Math.random()*(Math.abs(O)+1))+K;var o=Math.floor(Math.random()*(Math.abs(M)+1))+v;Arithmetic.problem_answer=Q*o;p.innerHTML=Q+" &times; "+o;}function new_division_problem(){var p=$("problem");var O=Arithmetic.question_preferences["multiplication_high_1"]-Arithmetic.question_preferences["multiplication_low_1"];var K=Arithmetic.question_preferences["multiplication_low_1"];var M=Arithmetic.question_preferences["multiplication_high_2"]-Arithmetic.question_preferences["multiplication_low_2"];var v=Arithmetic.question_preferences["multiplication_low_2"];var Q=Math.floor(Math.random()*(Math.abs(O)+1))+K;var o=Math.floor(Math.random()*(Math.abs(M)+1))+v;if(Q==0){new_division_problem();return ;}Arithmetic.problem_answer=o;p.innerHTML=(Q*o)+" &divide; "+Q;}