var Prototype={Version:"1.5.0",BrowserFeatures:{XPath:!!document.evaluate},ScriptFragment:"(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)",emptyFunction:function(){},K:function(a){return a}},Class={create:function(){return function(){this.initialize.apply(this,arguments)}}},Abstract={};Object.extend=function(a,b){for(var c in b)a[c]=b[c];return a}; Object.extend(Object,{inspect:function(a){try{if(a===undefined)return"undefined";if(a===null)return"null";return a.inspect?a.inspect():a.toString()}catch(b){if(b instanceof RangeError)return"...";throw b;}},keys:function(a){var b=[];for(var c in a)b.push(c);return b},values:function(a){var b=[];for(var c in a)b.push(a[c]);return b},clone:function(a){return Object.extend({},a)}});Function.prototype.bind=function(){var a=this,b=$A(arguments),c=b.shift();return function(){return a.apply(c,b.concat($A(arguments)))}}; Function.prototype.bindAsEventListener=function(a){var b=this,c=$A(arguments);a=c.shift();return function(d){return b.apply(a,[d||window.event].concat(c).concat($A(arguments)))}};Object.extend(Number.prototype,{toColorPart:function(){var a=this.toString(16);if(this<16)return"0"+a;return a},succ:function(){return this+1},times:function(a){$R(0,this,true).each(a);return this}}); var Try={these:function(){for(var a,b=0,c=arguments.length;b<c;b++){var d=arguments[b];try{a=d();break}catch(e){}}return a}},PeriodicalExecuter=Class.create(); PeriodicalExecuter.prototype={initialize:function(a,b){this.callback=a;this.frequency=b;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},stop:function(){if(this.timer){clearInterval(this.timer);this.timer=null}},onTimerEvent:function(){if(!this.currentlyExecuting)try{this.currentlyExecuting=true;this.callback(this)}finally{this.currentlyExecuting=false}}}; String.interpret=function(a){return a==null?"":String(a)}; Object.extend(String.prototype,{gsub:function(a,b){var c="",d=this,e;for(b=arguments.callee.prepareReplacement(b);d.length>0;)if(e=d.match(a)){c+=d.slice(0,e.index);c+=String.interpret(b(e));d=d.slice(e.index+e[0].length)}else{c+=d;d=""}return c},sub:function(a,b,c){b=this.gsub.prepareReplacement(b);c=c===undefined?1:c;return this.gsub(a,function(d){if(--c<0)return d[0];return b(d)})},scan:function(a,b){this.gsub(a,b);return this},truncate:function(a,b){a=a||30;b=b===undefined?"...":b;return this.length> a?this.slice(0,a-b.length)+b: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 a=new RegExp(Prototype.ScriptFragment,"img"),b=new RegExp(Prototype.ScriptFragment,"im");return(this.match(a)||[]).map(function(c){return(c.match(b)||["",""])[1]})},evalScripts:function(){return this.extractScripts().map(function(a){return eval(a)})}, escapeHTML:function(){var a=document.createElement("div"),b=document.createTextNode(this);a.appendChild(b);return a.innerHTML},unescapeHTML:function(){var a=document.createElement("div");a.innerHTML=this.stripTags();return a.childNodes[0]?a.childNodes.length>1?$A(a.childNodes).inject("",function(b,c){return b+c.nodeValue}):a.childNodes[0].nodeValue:""},toQueryParams:function(a){var b=this.strip().match(/([^?#]*)(#.*)?$/);if(!b)return{};return b[1].split(a||"&").inject({},function(c,d){if((d=d.split("="))[0]){var e= decodeURIComponent(d[0]);d=d[1]?decodeURIComponent(d[1]):undefined;if(c[e]!==undefined){if(c[e].constructor!=Array)c[e]=[c[e]];d&&c[e].push(d)}else c[e]=d}return c})},toArray:function(){return this.split("")},succ:function(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)},camelize:function(){var a=this.split("-"),b=a.length;if(b==1)return a[0];for(var c=this.charAt(0)=="-"?a[0].charAt(0).toUpperCase()+a[0].substring(1):a[0],d=1;d<b;d++)c+=a[d].charAt(0).toUpperCase()+ a[d].substring(1);return c},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()},underscore:function(){return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase()},dasherize:function(){return this.gsub(/_/,"-")},inspect:function(a){var b=this.replace(/\\/g,"\\\\");return a?'"'+b.replace(/"/g,'\\"')+'"':"'"+b.replace(/'/g,"\\'")+"'"}}); String.prototype.gsub.prepareReplacement=function(a){if(typeof a=="function")return a;var b=new Template(a);return function(c){return b.evaluate(c)}};String.prototype.parseQuery=String.prototype.toQueryParams;var Template=Class.create();Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/; Template.prototype={initialize:function(a,b){this.template=a.toString();this.pattern=b||Template.Pattern},evaluate:function(a){return this.template.gsub(this.pattern,function(b){var c=b[1];if(c=="\\")return b[2];return c+String.interpret(a[b[3]])})}}; var $break={},$continue={},Enumerable={each:function(a){var b=0;try{this._each(function(d){try{a(d,b++)}catch(e){if(e!=$continue)throw e;}})}catch(c){if(c!=$break)throw c;}return this},eachSlice:function(a,b){for(var c=-a,d=[],e=this.toArray();(c+=a)<e.length;)d.push(e.slice(c,c+a));return d.map(b)},all:function(a){var b=true;this.each(function(c,d){b=b&&!!(a||Prototype.K)(c,d);if(!b)throw $break;});return b},any:function(a){var b=false;this.each(function(c,d){if(b=!!(a||Prototype.K)(c,d))throw $break; });return b},collect:function(a){var b=[];this.each(function(c,d){b.push((a||Prototype.K)(c,d))});return b},detect:function(a){var b;this.each(function(c,d){if(a(c,d)){b=c;throw $break;}});return b},findAll:function(a){var b=[];this.each(function(c,d){a(c,d)&&b.push(c)});return b},grep:function(a,b){var c=[];this.each(function(d,e){var f=d.toString();if(f.match(a))c.push((b||Prototype.K)(d,e))});return c},include:function(a){var b=false;this.each(function(c){if(c==a){b=true;throw $break;}});return b}, inGroupsOf:function(a,b){b=b===undefined?null:b;return this.eachSlice(a,function(c){for(;c.length<a;)c.push(b);return c})},inject:function(a,b){this.each(function(c,d){a=b(a,c,d)});return a},invoke:function(a){var b=$A(arguments).slice(1);return this.map(function(c){return c[a].apply(c,b)})},max:function(a){var b;this.each(function(c,d){c=(a||Prototype.K)(c,d);if(b==undefined||c>=b)b=c});return b},min:function(a){var b;this.each(function(c,d){c=(a||Prototype.K)(c,d);if(b==undefined||c<b)b=c});return b}, partition:function(a){var b=[],c=[];this.each(function(d,e){((a||Prototype.K)(d,e)?b:c).push(d)});return[b,c]},pluck:function(a){var b=[];this.each(function(c){b.push(c[a])});return b},reject:function(a){var b=[];this.each(function(c,d){a(c,d)||b.push(c)});return b},sortBy:function(a){return this.map(function(b,c){return{value:b,criteria:a(b,c)}}).sort(function(b,c){b=b.criteria;c=c.criteria;return b<c?-1:b>c?1:0}).pluck("value")},toArray:function(){return this.map()},zip:function(){var a=Prototype.K, b=$A(arguments);if(typeof b.last()=="function")a=b.pop();var c=[this].concat(b).map($A);return this.map(function(d,e){return a(c.pluck(e))})},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(a){if(!a)return[];if(a.toArray)return a.toArray();else{for(var b=[],c=0,d=a.length;c<d;c++)b.push(a[c]);return b}};Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse)Array.prototype._reverse=Array.prototype.reverse; Object.extend(Array.prototype,{_each:function(a){for(var b=0,c=this.length;b<c;b++)a(this[b])},clear:function(){this.length=0;return this},first:function(){return this[0]},last:function(){return this[this.length-1]},compact:function(){return this.select(function(a){return a!=null})},flatten:function(){return this.inject([],function(a,b){return a.concat(b&&b.constructor==Array?b.flatten():[b])})},without:function(){var a=$A(arguments);return this.select(function(b){return!a.include(b)})},indexOf:function(a){for(var b= 0,c=this.length;b<c;b++)if(this[b]==a)return b;return-1},reverse:function(a){return(a!==false?this:this.toArray())._reverse()},reduce:function(){return this.length>1?this:this[0]},uniq:function(){return this.inject([],function(a,b){return a.include(b)?a:a.concat([b])})},clone:function(){return[].concat(this)},size:function(){return this.length},inspect:function(){return"["+this.map(Object.inspect).join(", ")+"]"}});Array.prototype.toArray=Array.prototype.clone; function $w(a){return(a=a.strip())?a.split(/\s+/):[]}if(window.opera)Array.prototype.concat=function(){for(var a=[],b=0,c=this.length;b<c;b++)a.push(this[b]);b=0;for(c=arguments.length;b<c;b++)if(arguments[b].constructor==Array)for(var d=0,e=arguments[b].length;d<e;d++)a.push(arguments[b][d]);else a.push(arguments[b]);return a};function Hash(a){Object.extend(this,a||{})} Object.extend(Hash,{toQueryString:function(a){var b=[];this.prototype._each.call(a,function(c){if(c.key){if(c.value&&c.value.constructor==Array){var d=c.value.compact();if(d.length<2)c.value=d.reduce();else{key=encodeURIComponent(c.key);d.each(function(e){e=e!=undefined?encodeURIComponent(e):"";b.push(key+"="+encodeURIComponent(e))});return}}if(c.value==undefined)c[1]="";b.push(c.map(encodeURIComponent).join("="))}});return b.join("&")}});Object.extend(Hash.prototype,Enumerable); Object.extend(Hash.prototype,{_each:function(a){for(var b in this){var c=this[b];if(!(c&&c==Hash.prototype[b])){var d=[b,c];d.key=b;d.value=c;a(d)}}},keys:function(){return this.pluck("key")},values:function(){return this.pluck("value")},merge:function(a){return $H(a).inject(this,function(b,c){b[c.key]=c.value;return b})},remove:function(){for(var a,b=0,c=arguments.length;b<c;b++){var d=this[arguments[b]];if(d!==undefined)if(a===undefined)a=d;else{if(a.constructor!=Array)a=[a];a.push(d)}delete this[arguments[b]]}return a}, toQueryString:function(){return Hash.toQueryString(this)},inspect:function(){return"#<Hash:{"+this.map(function(a){return a.map(Object.inspect).join(": ")}).join(", ")+"}>"}});function $H(a){if(a&&a.constructor==Hash)return a;return new Hash(a)}ObjectRange=Class.create();Object.extend(ObjectRange.prototype,Enumerable); Object.extend(ObjectRange.prototype,{initialize:function(a,b,c){this.start=a;this.end=b;this.exclusive=c},_each:function(a){for(var b=this.start;this.include(b);){a(b);b=b.succ()}},include:function(a){if(a<this.start)return false;if(this.exclusive)return a<this.end;return a<=this.end}});function $R(a,b,c){return new ObjectRange(a,b,c)} var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||false},activeRequestCount:0}; Ajax.Responders={responders:[],_each:function(a){this.responders._each(a)},register:function(a){this.include(a)||this.responders.push(a)},unregister:function(a){this.responders=this.responders.without(a)},dispatch:function(a,b,c,d){this.each(function(e){if(typeof e[a]=="function")try{e[a].apply(e,[b,c,d])}catch(f){}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=function(){}; Ajax.Base.prototype={setOptions:function(a){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:""};Object.extend(this.options,a||{});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(a,b){this.transport=Ajax.getTransport();this.setOptions(b);this.request(a)},request:function(a){this.url=a;this.method=this.options.method;a=this.options.parameters;if(!["get","post"].include(this.method)){a._method=this.method;this.method="post"}if((a=Hash.toQueryString(a))&&/Konqueror|Safari|KHTML/.test(navigator.userAgent))a+="&_=";if(this.method=="get"&&a)this.url+=(this.url.indexOf("?")>-1?"&":"?")+a;try{Ajax.Responders.dispatch("onCreate", this,this.transport);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);this.options.asynchronous&&setTimeout(function(){this.respondToReadyState(1)}.bind(this),10);this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();var b=this.method=="post"?this.options.postBody||a:null;this.transport.send(b);!this.options.asynchronous&&this.transport.overrideMimeType&&this.onStateChange()}catch(c){this.dispatchException(c)}},onStateChange:function(){var a= this.transport.readyState;a>1&&!(a==4&&this._complete)&&this.respondToReadyState(this.transport.readyState)},setRequestHeaders:function(){var a={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){a["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)a.Connection="close"}if(typeof this.options.requestHeaders=="object"){var b=this.options.requestHeaders;if(typeof b.push=="function")for(var c=0,d=b.length;c<d;c+=2)a[b[c]]=b[c+1];else $H(b).each(function(f){a[f.key]=f.value})}for(var e in a)this.transport.setRequestHeader(e,a[e])},success:function(){return!this.transport.status||this.transport.status>=200&&this.transport.status<300},respondToReadyState:function(a){a=Ajax.Request.Events[a];var b=this.transport,c=this.evalJSON(); if(a=="Complete"){try{this._complete=true;(this.options["on"+this.transport.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(b,c)}catch(d){this.dispatchException(d)}if((this.getHeader("Content-type")||"text/javascript").strip().match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i))this.evalResponse()}try{(this.options["on"+a]||Prototype.emptyFunction)(b,c);Ajax.Responders.dispatch("on"+a,this,b,c)}catch(e){this.dispatchException(e)}if(a=="Complete")this.transport.onreadystatechange= Prototype.emptyFunction},getHeader:function(a){try{return this.transport.getResponseHeader(a)}catch(b){return null}},evalJSON:function(){try{var a=this.getHeader("X-JSON");return a?eval("("+a+")"):null}catch(b){return null}},evalResponse:function(){try{return eval(this.transport.responseText)}catch(a){this.dispatchException(a)}},dispatchException:function(a){(this.options.onException||Prototype.emptyFunction)(this,a);Ajax.Responders.dispatch("onException",this,a)}});Ajax.Updater=Class.create(); Object.extend(Object.extend(Ajax.Updater.prototype,Ajax.Request.prototype),{initialize:function(a,b,c){this.container={success:a.success||a,failure:a.failure||(a.success?null:a)};this.transport=Ajax.getTransport();this.setOptions(c);var d=this.options.onComplete||Prototype.emptyFunction;this.options.onComplete=function(e,f){this.updateContent();d(e,f)}.bind(this);this.request(b)},updateContent:function(){var a=this.container[this.success()?"success":"failure"],b=this.transport.responseText;this.options.evalScripts|| (b=b.stripScripts());if(a=$(a))if(this.options.insertion)new this.options.insertion(a,b);else a.update(b);this.success()&&this.onComplete&&setTimeout(this.onComplete.bind(this),10)}});Ajax.PeriodicalUpdater=Class.create(); Ajax.PeriodicalUpdater.prototype=Object.extend(new Ajax.Base,{initialize:function(a,b,c){this.setOptions(c);this.onComplete=this.options.onComplete;this.frequency=this.options.frequency||2;this.decay=this.options.decay||1;this.updater={};this.container=a;this.url=b;this.start()},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent()},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this, arguments)},updateComplete:function(a){if(this.options.decay){this.decay=a.responseText==this.lastText?this.decay*this.options.decay:1;this.lastText=a.responseText}this.timer=setTimeout(this.onTimerEvent.bind(this),this.decay*this.frequency*1000)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}}); function $(a){if(arguments.length>1){for(var b=0,c=[],d=arguments.length;b<d;b++)c.push($(arguments[b]));return c}if(typeof a=="string")a=document.getElementById(a);return Element.extend(a)}if(Prototype.BrowserFeatures.XPath)document._getElementsByXPath=function(a,b){var c=[];a=document.evaluate(a,$(b)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);b=0;for(var d=a.snapshotLength;b<d;b++)c.push(a.snapshotItem(b));return c}; document.getElementsByClassName=function(a,b){if(Prototype.BrowserFeatures.XPath){a=".//*[contains(concat(' ', @class, ' '), ' "+a+" ')]";return document._getElementsByXPath(a,b)}else{b=($(b)||document.body).getElementsByTagName("*");for(var c=[],d,e=0,f=b.length;e<f;e++){d=b[e];Element.hasClassName(d,a)&&c.push(Element.extend(d))}return c}};if(!window.Element)var Element={}; Element.extend=function(a){if(!a||_nativeExtensions||a.nodeType==3)return a;if(!a._extended&&a.tagName&&a!=window){var b=Object.clone(Element.Methods),c=Element.extend.cache;a.tagName=="FORM"&&Object.extend(b,Form.Methods);["INPUT","TEXTAREA","SELECT"].include(a.tagName)&&Object.extend(b,Form.Element.Methods);Object.extend(b,Element.Methods.Simulated);for(var d in b){var e=b[d];if(typeof e=="function"&&!(d in a))a[d]=c.findOrStore(e)}}a._extended=true;return a}; Element.extend.cache={findOrStore:function(a){return this[a]=this[a]||function(){return a.apply(null,[this].concat($A(arguments)))}}}; Element.Methods={visible:function(a){return $(a).style.display!="none"},toggle:function(a){a=$(a);Element[Element.visible(a)?"hide":"show"](a);return a},hide:function(a){$(a).style.display="none";return a},show:function(a){$(a).style.display="";return a},remove:function(a){a=$(a);a.parentNode.removeChild(a);return a},update:function(a,b){b=typeof b=="undefined"?"":b.toString();$(a).innerHTML=b.stripScripts();setTimeout(function(){b.evalScripts()},10);return a},replace:function(a,b){a=$(a);b=typeof b== "undefined"?"":b.toString();if(a.outerHTML)a.outerHTML=b.stripScripts();else{var c=a.ownerDocument.createRange();c.selectNodeContents(a);a.parentNode.replaceChild(c.createContextualFragment(b.stripScripts()),a)}setTimeout(function(){b.evalScripts()},10);return a},inspect:function(a){a=$(a);var b="<"+a.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(c){var d=c.first();c=c.last();if(d=(a[d]||"").toString())b+=" "+c+"="+d.inspect(true)});return b+">"},recursivelyCollect:function(a, b){a=$(a);for(var c=[];a=a[b];)a.nodeType==1&&c.push(Element.extend(a));return c},ancestors:function(a){return $(a).recursivelyCollect("parentNode")},descendants:function(a){return $A($(a).getElementsByTagName("*"))},immediateDescendants:function(a){if(!(a=$(a).firstChild))return[];for(;a&&a.nodeType!=1;)a=a.nextSibling;if(a)return[a].concat($(a).nextSiblings());return[]},previousSiblings:function(a){return $(a).recursivelyCollect("previousSibling")},nextSiblings:function(a){return $(a).recursivelyCollect("nextSibling")}, siblings:function(a){a=$(a);return a.previousSiblings().reverse().concat(a.nextSiblings())},match:function(a,b){if(typeof b=="string")b=new Selector(b);return b.match($(a))},up:function(a,b,c){return Selector.findElement($(a).ancestors(),b,c)},down:function(a,b,c){return Selector.findElement($(a).descendants(),b,c)},previous:function(a,b,c){return Selector.findElement($(a).previousSiblings(),b,c)},next:function(a,b,c){return Selector.findElement($(a).nextSiblings(),b,c)},getElementsBySelector:function(){var a= $A(arguments),b=$(a.shift());return Selector.findChildElements(b,a)},getElementsByClassName:function(a,b){return document.getElementsByClassName(b,a)},readAttribute:function(a,b){a=$(a);if(document.all&&!window.opera){var c=Element._attributeTranslations;if(c.values[b])return c.values[b](a,b);if(c.names[b])b=c.names[b];if(c=a.attributes[b])return c.nodeValue}return a.getAttribute(b)},getHeight:function(a){return $(a).getDimensions().height},getWidth:function(a){return $(a).getDimensions().width}, classNames:function(a){return new Element.ClassNames(a)},hasClassName:function(a,b){if(a=$(a)){a=a.className;if(a.length==0)return false;if(a==b||a.match(new RegExp("(^|\\s)"+b+"(\\s|$)")))return true;return false}},addClassName:function(a,b){if(a=$(a)){Element.classNames(a).add(b);return a}},removeClassName:function(a,b){if(a=$(a)){Element.classNames(a).remove(b);return a}},toggleClassName:function(a,b){if(a=$(a)){Element.classNames(a)[a.hasClassName(b)?"remove":"add"](b);return a}},observe:function(){Event.observe.apply(Event, arguments);return $A(arguments).first()},stopObserving:function(){Event.stopObserving.apply(Event,arguments);return $A(arguments).first()},cleanWhitespace:function(a){a=$(a);for(var b=a.firstChild;b;){var c=b.nextSibling;b.nodeType==3&&!/\S/.test(b.nodeValue)&&a.removeChild(b);b=c}return a},empty:function(a){return $(a).innerHTML.match(/^\s*$/)},descendantOf:function(a,b){a=$(a);for(b=$(b);a=a.parentNode;)if(a==b)return true;return false},scrollTo:function(a){a=$(a);var b=Position.cumulativeOffset(a); window.scrollTo(b[0],b[1]);return a},getStyle:function(a,b){a=$(a);if(["float","cssFloat"].include(b))b=typeof a.style.styleFloat!="undefined"?"styleFloat":"cssFloat";b=b.camelize();var c=a.style[b];if(!c)if(document.defaultView&&document.defaultView.getComputedStyle)c=(c=document.defaultView.getComputedStyle(a,null))?c[b]:null;else if(a.currentStyle)c=a.currentStyle[b];if(c=="auto"&&["width","height"].include(b)&&a.getStyle("display")!="none")c=a["offset"+b.capitalize()]+"px";if(window.opera&&["left", "top","right","bottom"].include(b))if(Element.getStyle(a,"position")=="static")c="auto";if(b=="opacity"){if(c)return parseFloat(c);if(c=(a.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/))if(c[1])return parseFloat(c[1])/100;return 1}return c=="auto"?null:c},setStyle:function(a,b){a=$(a);for(var c in b){var d=b[c];if(c=="opacity")if(d==1){d=/Gecko/.test(navigator.userAgent)&&!/Konqueror|Safari|KHTML/.test(navigator.userAgent)?0.999999:1;if(/MSIE/.test(navigator.userAgent)&&!window.opera)a.style.filter= a.getStyle("filter").replace(/alpha\([^\)]*\)/gi,"")}else if(d==""){if(/MSIE/.test(navigator.userAgent)&&!window.opera)a.style.filter=a.getStyle("filter").replace(/alpha\([^\)]*\)/gi,"")}else{if(d<1.0E-5)d=0;if(/MSIE/.test(navigator.userAgent)&&!window.opera)a.style.filter=a.getStyle("filter").replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+d*100+")"}else if(["float","cssFloat"].include(c))c=typeof a.style.styleFloat!="undefined"?"styleFloat":"cssFloat";a.style[c.camelize()]=d}return a},getDimensions:function(a){a= $(a);var b=$(a).getStyle("display");if(b!="none"&&b!=null)return{width:a.offsetWidth,height:a.offsetHeight};b=a.style;var c=b.visibility,d=b.position,e=b.display;b.visibility="hidden";b.position="absolute";b.display="block";var f=a.clientWidth;a=a.clientHeight;b.display=e;b.position=d;b.visibility=c;return{width:f,height:a}},makePositioned:function(a){a=$(a);var b=Element.getStyle(a,"position");if(b=="static"||!b){a._madePositioned=true;a.style.position="relative";if(window.opera){a.style.top=0;a.style.left= 0}}return a},undoPositioned:function(a){a=$(a);if(a._madePositioned){a._madePositioned=undefined;a.style.position=a.style.top=a.style.left=a.style.bottom=a.style.right=""}return a},makeClipping:function(a){a=$(a);if(a._overflow)return a;a._overflow=a.style.overflow||"auto";if((Element.getStyle(a,"overflow")||"visible")!="hidden")a.style.overflow="hidden";return a},undoClipping:function(a){a=$(a);if(!a._overflow)return a;a.style.overflow=a._overflow=="auto"?"":a._overflow;a._overflow=null;return a}}; Object.extend(Element.Methods,{childOf:Element.Methods.descendantOf});Element._attributeTranslations={};Element._attributeTranslations.names={colspan:"colSpan",rowspan:"rowSpan",valign:"vAlign",datetime:"dateTime",accesskey:"accessKey",tabindex:"tabIndex",enctype:"encType",maxlength:"maxLength",readonly:"readOnly",longdesc:"longDesc"}; Element._attributeTranslations.values={_getAttr:function(a,b){return a.getAttribute(b,2)},_flag:function(a,b){return $(a).hasAttribute(b)?b:null},style:function(a){return a.style.cssText.toLowerCase()},title:function(a){a=a.getAttributeNode("title");return a.specified?a.nodeValue:null}}; Object.extend(Element._attributeTranslations.values,{href:Element._attributeTranslations.values._getAttr,src:Element._attributeTranslations.values._getAttr,disabled:Element._attributeTranslations.values._flag,checked:Element._attributeTranslations.values._flag,readonly:Element._attributeTranslations.values._flag,multiple:Element._attributeTranslations.values._flag});Element.Methods.Simulated={hasAttribute:function(a,b){var c=Element._attributeTranslations;b=c.names[b]||b;return $(a).getAttributeNode(b).specified}}; if(document.all&&!window.opera)Element.Methods.update=function(a,b){a=$(a);b=typeof b=="undefined"?"":b.toString();var c=a.tagName.toUpperCase();if(["THEAD","TBODY","TR","TD"].include(c)){var d=document.createElement("div");switch(c){case "THEAD":case "TBODY":d.innerHTML="<table><tbody>"+b.stripScripts()+"</tbody></table>";depth=2;break;case "TR":d.innerHTML="<table><tbody><tr>"+b.stripScripts()+"</tr></tbody></table>";depth=3;break;case "TD":d.innerHTML="<table><tbody><tr><td>"+b.stripScripts()+ "</td></tr></tbody></table>";depth=4}$A(a.childNodes).each(function(e){a.removeChild(e)});depth.times(function(){d=d.firstChild});$A(d.childNodes).each(function(e){a.appendChild(e)})}else a.innerHTML=b.stripScripts();setTimeout(function(){b.evalScripts()},10);return a};Object.extend(Element,Element.Methods);var _nativeExtensions=false; /Konqueror|Safari|KHTML/.test(navigator.userAgent)&&["","Form","Input","TextArea","Select"].each(function(a){var b="HTML"+a+"Element";if(!window[b]){b=window[b]={};b.prototype=document.createElement(a?a.toLowerCase():"div").__proto__}}); Element.addMethods=function(a){Object.extend(Element.Methods,a||{});function b(c,d,e){e=e||false;var f=Element.extend.cache;for(var g in c){var h=c[g];if(!e||!(g in d))d[g]=f.findOrStore(h)}}if(typeof HTMLElement!="undefined"){b(Element.Methods,HTMLElement.prototype);b(Element.Methods.Simulated,HTMLElement.prototype,true);b(Form.Methods,HTMLFormElement.prototype);[HTMLInputElement,HTMLTextAreaElement,HTMLSelectElement].each(function(c){b(Form.Element.Methods,c.prototype)});_nativeExtensions=true}}; var Toggle={};Toggle.display=Element.toggle;Abstract.Insertion=function(a){this.adjacency=a}; Abstract.Insertion.prototype={initialize:function(a,b){this.element=$(a);this.content=b.stripScripts();if(this.adjacency&&this.element.insertAdjacentHTML)try{this.element.insertAdjacentHTML(this.adjacency,this.content)}catch(c){a=this.element.tagName.toUpperCase();if(["TBODY","TR"].include(a))this.insertContent(this.contentFromAnonymousTable());else throw c;}else{this.range=this.element.ownerDocument.createRange();this.initializeRange&&this.initializeRange();this.insertContent([this.range.createContextualFragment(this.content)])}setTimeout(function(){b.evalScripts()}, 10)},contentFromAnonymousTable:function(){var a=document.createElement("div");a.innerHTML="<table><tbody>"+this.content+"</tbody></table>";return $A(a.childNodes[0].childNodes[0].childNodes)}};var Insertion={};Insertion.Before=Class.create();Insertion.Before.prototype=Object.extend(new Abstract.Insertion("beforeBegin"),{initializeRange:function(){this.range.setStartBefore(this.element)},insertContent:function(a){a.each(function(b){this.element.parentNode.insertBefore(b,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(a){a.reverse(false).each(function(b){this.element.insertBefore(b,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(a){a.each(function(b){this.element.appendChild(b)}.bind(this))}});Insertion.After=Class.create(); Insertion.After.prototype=Object.extend(new Abstract.Insertion("afterEnd"),{initializeRange:function(){this.range.setStartAfter(this.element)},insertContent:function(a){a.each(function(b){this.element.parentNode.insertBefore(b,this.element.nextSibling)}.bind(this))}});Element.ClassNames=Class.create(); Element.ClassNames.prototype={initialize:function(a){this.element=$(a)},_each:function(a){this.element.className.split(/\s+/).select(function(b){return b.length>0})._each(a)},set:function(a){this.element.className=a},add:function(a){this.include(a)||this.set($A(this).concat(a).join(" "))},remove:function(a){this.include(a)&&this.set($A(this).without(a).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);var Selector=Class.create(); Selector.prototype={initialize:function(a){this.params={classNames:[]};this.expression=a.toString().strip();this.parseExpression();this.compileMatcher()},parseExpression:function(){function a(g){throw"Parse error in selector: "+g;}this.expression==""&&a("empty expression");for(var b=this.params,c=this.expression,d,e,f;d=c.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i);){b.attributes=b.attributes||[];b.attributes.push({name:d[2],operator:d[3],value:d[4]||d[5]||""});c=d[1]}if(c== "*")return this.params.wildcard=true;for(;d=c.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i);){e=d[1];f=d[2];d=d[3];switch(e){case "#":b.id=f;break;case ".":b.classNames.push(f);break;case "":case undefined:b.tagName=f.toUpperCase();break;default:a(c.inspect())}c=d}c.length>0&&a(c.inspect())},buildMatchExpression:function(){var a=this.params,b=[],c;a.wildcard&&b.push("true");if(c=a.id)b.push('element.readAttribute("id") == '+c.inspect());if(c=a.tagName)b.push("element.tagName.toUpperCase() == "+c.inspect()); if((c=a.classNames).length>0)for(var d=0,e=c.length;d<e;d++)b.push("element.hasClassName("+c[d].inspect()+")");if(c=a.attributes)c.each(function(f){var g="element.readAttribute("+f.name.inspect()+")";function h(i){return g+" && "+g+".split("+i.inspect()+")"}switch(f.operator){case "=":b.push(g+" == "+f.value.inspect());break;case "~=":b.push(h(" ")+".include("+f.value.inspect()+")");break;case "|=":b.push(h("-")+".first().toUpperCase() == "+f.value.toUpperCase().inspect());break;case "!=":b.push(g+ " != "+f.value.inspect());break;case "":case undefined:b.push("element.hasAttribute("+f.name.inspect()+")");break;default:throw"Unknown operator "+f.operator+" in selector";}});return b.join(" && ")},compileMatcher:function(){this.match=new Function("element","if (!element.tagName) return false; element = $(element); return "+this.buildMatchExpression())},findElements:function(a){var b;if(b=$(this.params.id))if(this.match(b))if(!a||Element.childOf(b,a))return[b];a=(a||document).getElementsByTagName(this.params.tagName|| "*");for(var c=[],d=0,e=a.length;d<e;d++)if(this.match(b=a[d]))c.push(Element.extend(b));return c},toString:function(){return this.expression}}; Object.extend(Selector,{matchElements:function(a,b){b=new Selector(b);return a.select(b.match.bind(b)).map(Element.extend)},findElement:function(a,b,c){if(typeof b=="number"){c=b;b=false}return Selector.matchElements(a,b||"*")[c||0]},findChildElements:function(a,b){return b.map(function(c){return c.match(/[^\s"]+(?:"[^"]*"[^\s"]+)*/g).inject([null],function(d,e){var f=new Selector(e);return d.inject([],function(g,h){return g.concat(f.findElements(h||a))})})}).flatten()}}); function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(a){$(a).reset();return a},serializeElements:function(a,b){a=a.inject({},function(c,d){if(!d.disabled&&d.name){var e=d.name;d=$(d).getValue();if(d!=undefined)if(c[e]){if(c[e].constructor!=Array)c[e]=[c[e]];c[e].push(d)}else c[e]=d}return c});return b?a:Hash.toQueryString(a)}}; Form.Methods={serialize:function(a,b){return Form.serializeElements(Form.getElements(a),b)},getElements:function(a){return $A($(a).getElementsByTagName("*")).inject([],function(b,c){Form.Element.Serializers[c.tagName.toLowerCase()]&&b.push(Element.extend(c));return b})},getInputs:function(a,b,c){a=$(a);a=a.getElementsByTagName("input");if(!b&&!c)return $A(a).map(Element.extend);for(var d=0,e=[],f=a.length;d<f;d++){var g=a[d];b&&g.type!=b||c&&g.name!=c||e.push(Element.extend(g))}return e},disable:function(a){a= $(a);a.getElements().each(function(b){b.blur();b.disabled="true"});return a},enable:function(a){a=$(a);a.getElements().each(function(b){b.disabled=""});return a},findFirstElement:function(a){return $(a).getElements().find(function(b){return b.type!="hidden"&&!b.disabled&&["input","select","textarea"].include(b.tagName.toLowerCase())})},focusFirstElement:function(a){a=$(a);a.findFirstElement().activate();return a}};Object.extend(Form,Form.Methods); Form.Element={focus:function(a){$(a).focus();return a},select:function(a){$(a).select();return a}}; Form.Element.Methods={serialize:function(a){a=$(a);if(!a.disabled&&a.name){var b=a.getValue();if(b!=undefined){var c={};c[a.name]=b;return Hash.toQueryString(c)}}return""},getValue:function(a){a=$(a);var b=a.tagName.toLowerCase();return Form.Element.Serializers[b](a)},clear:function(a){$(a).value="";return a},present:function(a){return $(a).value!=""},activate:function(a){a=$(a);a.focus();if(a.select&&(a.tagName.toLowerCase()!="input"||!["button","reset","submit"].include(a.type)))a.select();return a}, disable:function(a){a=$(a);a.disabled=true;return a},enable:function(a){a=$(a);a.blur();a.disabled=false;return a}};Object.extend(Form.Element,Form.Element.Methods);var Field=Form.Element,$F=Form.Element.getValue; Form.Element.Serializers={input:function(a){switch(a.type.toLowerCase()){case "checkbox":case "radio":return Form.Element.Serializers.inputSelector(a);default:return Form.Element.Serializers.textarea(a)}},inputSelector:function(a){return a.checked?a.value:null},textarea:function(a){return a.value},select:function(a){return this[a.type=="select-one"?"selectOne":"selectMany"](a)},selectOne:function(a){var b=a.selectedIndex;return b>=0?this.optionValue(a.options[b]):null},selectMany:function(a){var b, c=a.length;if(!c)return null;var d=0;for(b=[];d<c;d++){var e=a.options[d];e.selected&&b.push(this.optionValue(e))}return b},optionValue:function(a){return Element.extend(a).hasAttribute("value")?a.value:a.text}};Abstract.TimedObserver=function(){}; Abstract.TimedObserver.prototype={initialize:function(a,b,c){this.frequency=b;this.element=$(a);this.callback=c;this.lastValue=this.getValue();this.registerCallback()},registerCallback:function(){setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},onTimerEvent:function(){var a=this.getValue(),b="string"==typeof this.lastValue&&"string"==typeof a?this.lastValue!=a:String(this.lastValue)!=String(a);if(b){this.callback(this.element,a);this.lastValue=a}}};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(a,b){this.element=$(a);this.callback=b;this.lastValue=this.getValue();this.element.tagName.toLowerCase()=="form"?this.registerFormCallbacks():this.registerCallback(this.element)},onElementEvent:function(){var a=this.getValue();if(this.lastValue!=a){this.callback(this.element,a);this.lastValue=a}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback.bind(this))},registerCallback:function(a){if(a.type)switch(a.type.toLowerCase()){case "checkbox":case "radio":Event.observe(a, "click",this.onElementEvent.bind(this));break;default:Event.observe(a,"change",this.onElementEvent.bind(this));break}}};Form.Element.EventObserver=Class.create();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={}; 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(a){return a.target||a.srcElement},isLeftClick:function(a){return a.which&&a.which==1||a.button&&a.button==1},pointerX:function(a){return a.pageX||a.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)},pointerY:function(a){return a.pageY||a.clientY+(document.documentElement.scrollTop|| document.body.scrollTop)},stop:function(a){if(a.preventDefault){a.preventDefault();a.stopPropagation()}else{a.returnValue=false;a.cancelBubble=true}},findElement:function(a,b){for(a=Event.element(a);a.parentNode&&(!a.tagName||a.tagName.toUpperCase()!=b.toUpperCase());)a=a.parentNode;return a},observers:false,_observeAndCache:function(a,b,c,d){if(!this.observers)this.observers=[];if(a.addEventListener){this.observers.push([a,b,c,d]);a.addEventListener(b,c,d)}else if(a.attachEvent){this.observers.push([a, b,c,d]);a.attachEvent("on"+b,c)}},unloadCache:function(){if(Event.observers){for(var a=0,b=Event.observers.length;a<b;a++){Event.stopObserving.apply(this,Event.observers[a]);Event.observers[a][0]=null}Event.observers=false}},observe:function(a,b,c,d){a=$(a);d=d||false;if(b=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||a.attachEvent))b="keydown";Event._observeAndCache(a,b,c,d)},stopObserving:function(a,b,c,d){a=$(a);d=d||false;if(b=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)|| a.detachEvent))b="keydown";if(a.removeEventListener)a.removeEventListener(b,c,d);else if(a.detachEvent)try{a.detachEvent("on"+b,c)}catch(e){}}});navigator.appVersion.match(/\bMSIE\b/)&&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(a){var b=0,c=0;do{b+=a.scrollTop||0;c+=a.scrollLeft||0;a=a.parentNode}while(a);return[c,b]},cumulativeOffset:function(a){var b=0,c=0;do{b+=a.offsetTop||0;c+=a.offsetLeft||0;a=a.offsetParent}while(a);return[c,b]},positionedOffset:function(a){var b= 0,c=0;do{b+=a.offsetTop||0;c+=a.offsetLeft||0;if(a=a.offsetParent){if(a.tagName=="BODY")break;var d=Element.getStyle(a,"position");if(d=="relative"||d=="absolute")break}}while(a);return[c,b]},offsetParent:function(a){if(a.offsetParent)return a.offsetParent;if(a==document.body)return a;for(;(a=a.parentNode)&&a!=document.body;)if(Element.getStyle(a,"position")!="static")return a;return document.body},within:function(a,b,c){if(this.includeScrollOffsets)return this.withinIncludingScrolloffsets(a,b,c); this.xcomp=b;this.ycomp=c;this.offset=this.cumulativeOffset(a);return c>=this.offset[1]&&c<this.offset[1]+a.offsetHeight&&b>=this.offset[0]&&b<this.offset[0]+a.offsetWidth},withinIncludingScrolloffsets:function(a,b,c){var d=this.realOffset(a);this.xcomp=b+d[0]-this.deltaX;this.ycomp=c+d[1]-this.deltaY;this.offset=this.cumulativeOffset(a);return this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+a.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+a.offsetWidth},overlap:function(a, b){if(!a)return 0;if(a=="vertical")return(this.offset[1]+b.offsetHeight-this.ycomp)/b.offsetHeight;if(a=="horizontal")return(this.offset[0]+b.offsetWidth-this.xcomp)/b.offsetWidth},page:function(a){var b=0,c=0,d=a;do{b+=d.offsetTop||0;c+=d.offsetLeft||0;if(d.offsetParent==document.body)if(Element.getStyle(d,"position")=="absolute")break}while(d=d.offsetParent);d=a;do if(!window.opera||d.tagName=="BODY"){b-=d.scrollTop||0;c-=d.scrollLeft||0}while(d=d.parentNode);return[c,b]},clone:function(a,b,c){c= Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},c||{});a=$(a);var d=Position.page(a);b=$(b);var e=[0,0],f=null;if(Element.getStyle(b,"position")=="absolute"){f=Position.offsetParent(b);e=Position.page(f)}if(f==document.body){e[0]-=document.body.offsetLeft;e[1]-=document.body.offsetTop}if(c.setLeft)b.style.left=d[0]-e[0]+c.offsetLeft+"px";if(c.setTop)b.style.top=d[1]-e[1]+c.offsetTop+"px";if(c.setWidth)b.style.width=a.offsetWidth+"px";if(c.setHeight)b.style.height= a.offsetHeight+"px"},absolutize:function(a){a=$(a);if(a.style.position!="absolute"){Position.prepare();var b=Position.positionedOffset(a),c=b[1];b=b[0];var d=a.clientWidth,e=a.clientHeight;a._originalLeft=b-parseFloat(a.style.left||0);a._originalTop=c-parseFloat(a.style.top||0);a._originalWidth=a.style.width;a._originalHeight=a.style.height;a.style.position="absolute";a.style.top=c+"px";a.style.left=b+"px";a.style.width=d+"px";a.style.height=e+"px"}},relativize:function(a){a=$(a);if(a.style.position!= "relative"){Position.prepare();a.style.position="relative";var b=parseFloat(a.style.top||0)-(a._originalTop||0),c=parseFloat(a.style.left||0)-(a._originalLeft||0);a.style.top=b+"px";a.style.left=c+"px";a.style.height=a._originalHeight;a.style.width=a._originalWidth}}}; if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))Position.cumulativeOffset=function(a){var b=0,c=0;do{b+=a.offsetTop||0;c+=a.offsetLeft||0;if(a.offsetParent==document.body)if(Element.getStyle(a,"position")=="absolute")break;a=a.offsetParent}while(a);return[c,b]};Element.addMethods()
