var Prototype={Version:"1.5.0",BrowserFeatures:{XPath:!!document.evaluate},ScriptFragment:"(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)",emptyFunction:function(){},K:function(a){return a}};var Class={create:function(){return function(){this.initialize.apply(this,arguments)}}};var Abstract=new Object();Object.extend=function(c,b){for(var a in b){c[a]=b[a]}return c};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(c){var b=[];for(var a in c){b.push(a)}return b},values:function(a){var c=[];for(var b in a){c.push(a[b])}return c},clone:function(a){return Object.extend({},a)}});Function.prototype.bind=function(){var a=this,c=$A(arguments),b=c.shift();return function(){return a.apply(b,c.concat($A(arguments)))}};Function.prototype.bindAsEventListener=function(a){var c=this,b=$A(arguments),a=b.shift();return function(d){return c.apply(a,[(d||window.event)].concat(b).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(){var d;for(var a=0,c=arguments.length;a<c;a++){var b=arguments[a];try{d=b();break}catch(f){}}return d}};var PeriodicalExecuter=Class.create();PeriodicalExecuter.prototype={initialize:function(b,a){this.callback=b;this.frequency=a;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},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}}}};String.interpret=function(a){return a==null?"":String(a)};Object.extend(String.prototype,{gsub:function(a,d){var c="",e=this,b;d=arguments.callee.prepareReplacement(d);while(e.length>0){if(b=e.match(a)){c+=e.slice(0,b.index);c+=String.interpret(d(b));e=e.slice(b.index+b[0].length)}else{c+=e,e=""}}return c},sub:function(c,b,a){b=this.gsub.prepareReplacement(b);a=a===undefined?1:a;return this.gsub(c,function(d){if(--a<0){return d[0]}return b(d)})},scan:function(b,a){this.gsub(b,a);return this},truncate:function(b,a){b=b||30;a=a===undefined?"...":a;return this.length>b?this.slice(0,b-a.length)+a:this},strip:function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,"")},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")},extractScripts:function(){var b=new RegExp(Prototype.ScriptFragment,"img");var a=new RegExp(Prototype.ScriptFragment,"im");return(this.match(b)||[]).map(function(c){return(c.match(a)||["",""])[1]})},evalScripts:function(){return this.extractScripts().map(function(_27){return eval(_27)})},escapeHTML:function(){var b=document.createElement("div");var a=document.createTextNode(this);b.appendChild(a);return b.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(c,b){return c+b.nodeValue}):a.childNodes[0].nodeValue):""},toQueryParams:function(b){var a=this.strip().match(/([^?#]*)(#.*)?$/);if(!a){return{}}return a[1].split(b||"&").inject({},function(e,f){if((f=f.split("="))[0]){var d=decodeURIComponent(f[0]);var c=f[1]?decodeURIComponent(f[1]):undefined;if(e[d]!==undefined){if(e[d].constructor!=Array){e[d]=[e[d]]}if(c){e[d].push(c)}}else{e[d]=c}}return e})},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 b=this.split("-"),a=b.length;if(a==1){return b[0]}var d=this.charAt(0)=="-"?b[0].charAt(0).toUpperCase()+b[0].substring(1):b[0];for(var c=1;c<a;c++){d+=b[c].charAt(0).toUpperCase()+b[c].substring(1)}return d},hasClassName:function(a,b){if(!(a=$(a))){return}var c=a.className;return(c.length>0&&(c==b||new RegExp("(^|\\s)"+b+"(\\s|$)").test(c)))},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()},underscore:function(){return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase()},dasherize:function(){return this.gsub(/_/,"-")},inspect:function(b){var a=this.replace(/\\/g,"\\\\");if(b){return'"'+a.replace(/"/g,'\\"')+'"'}else{return"'"+a.replace(/'/g,"\\'")+"'"}}});String.prototype.gsub.prepareReplacement=function(b){if(typeof b=="function"){return b}var a=new Template(b);return function(c){return a.evaluate(c)}};String.prototype.parseQuery=String.prototype.toQueryParams;var Template=Class.create();Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;Template.prototype={initialize:function(b,a){this.template=b.toString();this.pattern=a||Template.Pattern},evaluate:function(a){return this.template.gsub(this.pattern,function(c){var b=c[1];if(b=="\\"){return c[2]}return b+String.interpret(a[c[3]])})}};var $break=new Object();var $continue=new Object();var Enumerable={each:function(b){var a=0;try{this._each(function(d){try{b(d,a++)}catch(f){if(f!=$continue){throw f}}})}catch(c){if(c!=$break){throw c}}return this},eachSlice:function(c,b){var a=-c,d=[],e=this.toArray();while((a+=c)<e.length){d.push(e.slice(a,a+c))}return d.map(b)},all:function(b){var a=true;this.each(function(d,c){a=a&&!!(b||Prototype.K)(d,c);if(!a){throw $break}});return a},any:function(a){var b=false;this.each(function(d,c){if(b=!!(a||Prototype.K)(d,c)){throw $break}});return b},collect:function(b){var a=[];this.each(function(d,c){a.push((b||Prototype.K)(d,c))});return a},detect:function(b){var a;this.each(function(d,c){if(b(d,c)){a=d;throw $break}});return a},findAll:function(b){var a=[];this.each(function(d,c){if(b(d,c)){a.push(d)}});return a},grep:function(c,b){var a=[];this.each(function(f,e){var d=f.toString();if(d.match(c)){a.push((b||Prototype.K)(f,e))}});return a},include:function(b){var a=false;this.each(function(c){if(c==b){a=true;throw $break}});return a},inGroupsOf:function(b,a){a=a===undefined?null:a;return this.eachSlice(b,function(c){while(c.length<b){c.push(a)}return c})},inject:function(b,a){this.each(function(d,c){b=a(b,d,c)});return b},invoke:function(b){var a=$A(arguments).slice(1);return this.map(function(c){return c[b].apply(c,a)})},max:function(b){var a;this.each(function(d,c){d=(b||Prototype.K)(d,c);if(a==undefined||d>=a){a=d}});return a},min:function(b){var a;this.each(function(d,c){d=(b||Prototype.K)(d,c);if(a==undefined||d<a){a=d}});return a},partition:function(c){var b=[],a=[];this.each(function(e,d){((c||Prototype.K)(e,d)?b:a).push(e)});return[b,a]},pluck:function(a){var b=[];this.each(function(d,c){b.push(d[a])});return b},reject:function(b){var a=[];this.each(function(c,d){if(!b(c,d)){a.push(c)}});return a},sortBy:function(a){return this.map(function(b,c){return{value:b,criteria:a(b,c)}}).sort(function(f,e){var d=f.criteria,c=e.criteria;return d<c?-1:d>c?1:0}).pluck("value")},toArray:function(){return this.map()},zip:function(){var c=Prototype.K,a=$A(arguments);if(typeof a.last()=="function"){c=a.pop()}var b=[this].concat(a).map($A);return this.map(function(d,e){return c(b.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(d){if(!d){return[]}if(d.toArray){return d.toArray()}else{var c=[];for(var a=0,b=d.length;a<b;a++){c.push(d[a])}return c}};Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse){Array.prototype._reverse=Array.prototype.reverse}Object.extend(Array.prototype,{_each:function(b){for(var a=0,c=this.length;a<c;a++){b(this[a])}},clear:function(){this.length=0;return this},first:function(){return this[0]},last:function(){return this[this.length-1]},compact:function(){return this.select(function(a){return a!=null})},flatten:function(){return this.inject([],function(b,a){return b.concat(a&&a.constructor==Array?a.flatten():[a])})},without:function(){var a=$A(arguments);return this.select(function(b){return !a.include(b)})},indexOf:function(c){for(var a=0,b=this.length;a<b;a++){if(this[a]==c){return a}}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(b,a){return b.include(a)?b:b.concat([a])})},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){a=a.strip();return a?a.split(/\s+/):[]}if(window.opera){Array.prototype.concat=function(){var d=[];for(var b=0,c=this.length;b<c;b++){d.push(this[b])}for(var b=0,c=arguments.length;b<c;b++){if(arguments[b].constructor==Array){for(var a=0,e=arguments[b].length;a<e;a++){d.push(arguments[b][a])}}else{d.push(arguments[b])}}return d}}var Hash=function(a){Object.extend(this,a||{})};Object.extend(Hash,{toQueryString:function(b){var a=[];this.prototype._each.call(b,function(d){if(!d.key){return}if(d.value&&d.value.constructor==Array){var c=d.value.compact();if(c.length<2){d.value=c.reduce()}else{key=encodeURIComponent(d.key);c.each(function(e){e=e!=undefined?encodeURIComponent(e):"";a.push(key+"="+encodeURIComponent(e))});return}}if(d.value==undefined){d[1]=""}a.push(d.map(encodeURIComponent).join("="))});return a.join("&")}});Object.extend(Hash.prototype,Enumerable);Object.extend(Hash.prototype,{_each:function(b){for(var c in this){var a=this[c];if(a&&a==Hash.prototype[c]){continue}var d=[c,a];d.key=c;d.value=a;b(d)}},keys:function(){return this.pluck("key")},values:function(){return this.pluck("value")},merge:function(a){return $H(a).inject(this,function(c,b){c[b.key]=b.value;return c})},remove:function(){var a;for(var 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(c,a,b){this.start=c;this.end=a;this.exclusive=b},_each:function(b){var a=this.start;while(this.include(a)){b(a);a=a.succ()}},include:function(a){if(a<this.start){return false}if(this.exclusive){return a<this.end}return a<=this.end}});var $R=function(c,b,a){return new ObjectRange(c,b,a)};var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||false},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(a){this.responders._each(a)},register:function(a){if(!this.include(a)){this.responders.push(a)}},unregister:function(a){this.responders=this.responders.without(a)},dispatch:function(c,b,d,a){this.each(function(g){if(typeof g[c]=="function"){try{g[c].apply(g,[b,d,a])}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;var c=this.options.parameters;if(!["get","post"].include(this.method)){c._method=this.method;this.method="post"}c=Hash.toQueryString(c);if(c&&/Konqueror|Safari|KHTML/.test(navigator.userAgent)){c+="&_="}if(this.method=="get"&&c){this.url+=(this.url.indexOf("?")>-1?"&":"?")+c}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();var b=this.method=="post"?(this.options.postBody||c):null;this.transport.send(b);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(d){this.dispatchException(d)}},onStateChange:function(){var a=this.transport.readyState;if(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 e=this.options.requestHeaders;if(typeof e.push=="function"){for(var c=0,d=e.length;c<d;c+=2){a[e[c]]=e[c+1]}}else{$H(e).each(function(f){a[f.key]=f.value})}}for(var b in a){this.transport.setRequestHeader(b,a[b])}},success:function(){return !this.transport.status||(this.transport.status>=200&&this.transport.status<300)},respondToReadyState:function(c){var a=Ajax.Request.Events[c];var b=this.transport,d=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,d)}catch(f){this.dispatchException(f)}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,d);Ajax.Responders.dispatch("on"+a,this,b,d)}catch(f){this.dispatchException(f)}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 _d2=this.getHeader("X-JSON");return _d2?eval("("+_d2+")"):null}catch(e){return null}},evalResponse:function(){try{return eval(this.transport.responseText)}catch(e){this.dispatchException(e)}},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(d,a,c){this.container={success:(d.success||d),failure:(d.failure||(d.success?null:d))};this.transport=Ajax.getTransport();this.setOptions(c);var b=this.options.onComplete||Prototype.emptyFunction;this.options.onComplete=(function(f,e){this.updateContent();b(f,e)}).bind(this);this.request(a)},updateContent:function(){var b=this.container[this.success()?"success":"failure"];var a=this.transport.responseText;if(!this.options.evalScripts){a=a.stripScripts()}if(b=$(b)){if(this.options.insertion){new this.options.insertion(b,a)}else{b.update(a)}}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(c,a,b){this.setOptions(b);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=c;this.url=a;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 $(b){if(arguments.length>1){for(var a=0,d=[],c=arguments.length;a<c;a++){d.push($(arguments[a]))}return d}if(typeof b=="string"){b=document.getElementById(b)}return Element.extend(b)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(c,b){var a=[];var f=document.evaluate(c,$(b)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var d=0,e=f.snapshotLength;d<e;d++){a.push(f.snapshotItem(d))}return a}}document.getElementsByClassName=function(e,d){if(Prototype.BrowserFeatures.XPath){var c=".//*[contains(concat(' ', @class, ' '), ' "+e+" ')]";return document._getElementsByXPath(c,d)}else{var h=($(d)||document.body).getElementsByTagName("*");var f=[],g;for(var a=0,b=h.length;a<b;a++){g=h[a];if(Element.hasClassName(g,e)){f.push(Element.extend(g))}}return f}};if(!window.Element){var Element=new Object()}Element.extend=function(e){if(!e||_nativeExtensions||e.nodeType==3){return e}if(!e._extended&&e.tagName&&e!=window){var d=Object.clone(Element.Methods),a=Element.extend.cache;if(e.tagName=="FORM"){Object.extend(d,Form.Methods)}if(["INPUT","TEXTAREA","SELECT"].include(e.tagName)){Object.extend(d,Form.Element.Methods)}Object.extend(d,Element.Methods.Simulated);for(var b in d){var c=d[b];if(typeof c=="function"&&!(b in e)){e[b]=a.findOrStore(c)}}}e._extended=true;return e};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(b,a){a=typeof a=="undefined"?"":a.toString();$(b).innerHTML=a.stripScripts();setTimeout(function(){a.evalScripts()},10);return b},replace:function(c,b){c=$(c);b=typeof b=="undefined"?"":b.toString();if(c.outerHTML){c.outerHTML=b.stripScripts()}else{var a=c.ownerDocument.createRange();a.selectNodeContents(c);c.parentNode.replaceChild(a.createContextualFragment(b.stripScripts()),c)}setTimeout(function(){b.evalScripts()},10);return c},inspect:function(b){b=$(b);var a="<"+b.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(f){var e=f.first(),d=f.last();var c=(b[e]||"").toString();if(c){a+=" "+d+"="+c.inspect(true)}});return a+">"},recursivelyCollect:function(c,b){c=$(c);var a=[];while(c=c[b]){if(c.nodeType==1){a.push(Element.extend(c))}}return a},ancestors:function(a){return $(a).recursivelyCollect("parentNode")},descendants:function(a){return $A($(a).getElementsByTagName("*"))},immediateDescendants:function(a){if(!(a=$(a).firstChild)){return[]}while(a&&a.nodeType!=1){a=a.nextSibling}if(a){return[a].concat($(a).nextSiblings())}return[]},previousSiblings:function(a){return $(a).recursivelyCollect("previousSibling")},nextSiblings:function(a){return $(a).recursivelyCollect("nextSibling")},siblings:function(a){a=$(a);return a.previousSiblings().reverse().concat(a.nextSiblings())},match:function(b,a){if(typeof a=="string"){a=new Selector(a)}return a.match($(b))},up:function(c,b,a){return Selector.findElement($(c).ancestors(),b,a)},down:function(b,c,a){return Selector.findElement($(b).descendants(),c,a)},previous:function(c,b,a){return Selector.findElement($(c).previousSiblings(),b,a)},next:function(c,b,a){return Selector.findElement($(c).nextSiblings(),b,a)},getElementsBySelector:function(){var a=$A(arguments),b=$(a.shift());return Selector.findChildElements(b,a)},getElementsByClassName:function(b,a){return document.getElementsByClassName(a,b)},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]}var d=a.attributes[b];if(d){return d.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(c,b){if(!(c=$(c))){return}var a=c.className;if(a.length==0){return false}if(a==b||a.match(new RegExp("(^|\\s)"+b+"(\\s|$)"))){return true}return false},addClassName:function(b,a){if(!(b=$(b))){return}Element.classNames(b).add(a);return b},removeClassName:function(b,a){if(!(b=$(b))){return}Element.classNames(b).remove(a);return b},toggleClassName:function(a,b){if(!(a=$(a))){return}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(b){b=$(b);var c=b.firstChild;while(c){var a=c.nextSibling;if(c.nodeType==3&&!/\S/.test(c.nodeValue)){b.removeChild(c)}c=a}return b},empty:function(a){return $(a).innerHTML.match(/^\s*$/)},descendantOf:function(a,b){a=$(a),b=$(b);while(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(d,c){d=$(d);if(["float","cssFloat"].include(c)){c=(typeof d.style.styleFloat!="undefined"?"styleFloat":"cssFloat")}c=c.camelize();var b=d.style[c];if(!b){if(document.defaultView&&document.defaultView.getComputedStyle){var a=document.defaultView.getComputedStyle(d,null);b=a?a[c]:null}else{if(d.currentStyle){b=d.currentStyle[c]}}}if((b=="auto")&&["width","height"].include(c)&&(d.getStyle("display")!="none")){b=d["offset"+c.capitalize()]+"px"}if(window.opera&&["left","top","right","bottom"].include(c)){if(Element.getStyle(d,"position")=="static"){b="auto"}}if(c=="opacity"){if(b){return parseFloat(b)}if(b=(d.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(b[1]){return parseFloat(b[1])/100}}return 1}return b=="auto"?null:b},setStyle:function(c,b){c=$(c);for(var a in b){var d=b[a];if(a=="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){c.style.filter=c.getStyle("filter").replace(/alpha\([^\)]*\)/gi,"")}}else{if(d===""){if(/MSIE/.test(navigator.userAgent)&&!window.opera){c.style.filter=c.getStyle("filter").replace(/alpha\([^\)]*\)/gi,"")}}else{if(d<0.00001){d=0}if(/MSIE/.test(navigator.userAgent)&&!window.opera){c.style.filter=c.getStyle("filter").replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+d*100+")"}}}}else{if(["float","cssFloat"].include(a)){a=(typeof c.style.styleFloat!="undefined")?"styleFloat":"cssFloat"}}c.style[a.camelize()]=d}return c},getDimensions:function(h){h=$(h);var g=$(h).getStyle("display");if(g!="none"&&g!=null){return{width:h.offsetWidth,height:h.offsetHeight}}var f=h.style;var e=f.visibility;var c=f.position;var d=f.display;f.visibility="hidden";f.position="absolute";f.display="block";var b=h.clientWidth;var a=h.clientHeight;f.display=d;f.position=c;f.visibility=e;return{width:b,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(b,a){return b.getAttribute(a,2)},_flag:function(b,a){return $(b).hasAttribute(a)?a:null},style:function(a){return a.style.cssText.toLowerCase()},title:function(b){var a=b.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(b,c){var a=Element._attributeTranslations;c=a.names[c]||c;return $(b).getAttributeNode(c).specified}};if(document.all&&!window.opera){Element.Methods.update=function(b,c){b=$(b);c=typeof c=="undefined"?"":c.toString();var a=b.tagName.toUpperCase();if(["THEAD","TBODY","TR","TD"].include(a)){var d=document.createElement("div");switch(a){case"THEAD":case"TBODY":d.innerHTML="<table><tbody>"+c.stripScripts()+"</tbody></table>";depth=2;break;case"TR":d.innerHTML="<table><tbody><tr>"+c.stripScripts()+"</tr></tbody></table>";depth=3;break;case"TD":d.innerHTML="<table><tbody><tr><td>"+c.stripScripts()+"</td></tr></tbody></table>";depth=4}$A(b.childNodes).each(function(e){b.removeChild(e)});depth.times(function(){d=d.firstChild});$A(d.childNodes).each(function(e){b.appendChild(e)})}else{b.innerHTML=c.stripScripts()}setTimeout(function(){c.evalScripts()},10);return b}}Object.extend(Element,Element.Methods);var _nativeExtensions=false;if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){["","Form","Input","TextArea","Select"].each(function(b){var c="HTML"+b+"Element";if(window[c]){return}var a=window[c]={};a.prototype=document.createElement(b?b.toLowerCase():"div").__proto__})}Element.addMethods=function(b){Object.extend(Element.Methods,b||{});function a(h,g,f){f=f||false;var d=Element.extend.cache;for(var e in h){var c=h[e];if(!f||!(e in g)){g[e]=d.findOrStore(c)}}}if(typeof HTMLElement!="undefined"){a(Element.Methods,HTMLElement.prototype);a(Element.Methods.Simulated,HTMLElement.prototype,true);_nativeExtensions=true}};var Toggle=new Object();Toggle.display=Element.toggle;Abstract.Insertion=function(a){this.adjacency=a};Abstract.Insertion.prototype={initialize:function(c,b){this.element=$(c);this.content=b.stripScripts();if(this.adjacency&&this.element.insertAdjacentHTML){try{this.element.insertAdjacentHTML(this.adjacency,this.content)}catch(d){var a=this.element.tagName.toUpperCase();if(["TBODY","TR"].include(a)){this.insertContent(this.contentFromAnonymousTable())}else{throw d}}}else{this.range=this.element.ownerDocument.createRange();if(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=new Object();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){if(this.include(a)){return}this.set($A(this).concat(a).join(" "))},remove:function(a){if(!this.include(a)){return}this.set($A(this).without(a).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);var Selector=Class.create();Selector.prototype={initialize:function(a){this.params={classNames:[]};this.expression=a.toString().strip();this.parseExpression();this.compileMatcher()},parseExpression:function(){function g(h){throw"Parse error in selector: "+h}if(this.expression==""){g("empty expression")}var b=this.params,f=this.expression,c,a,e,d;while(c=f.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)){b.attributes=b.attributes||[];b.attributes.push({name:c[2],operator:c[3],value:c[4]||c[5]||""});f=c[1]}if(f=="*"){return this.params.wildcard=true}while(c=f.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)){a=c[1],e=c[2],d=c[3];switch(a){case"#":b.id=e;break;case".":b.classNames.push(e);break;case"":case undefined:b.tagName=e.toUpperCase();break;default:g(f.inspect())}f=d}if(f.length>0){g(f.inspect())}},buildMatchExpression:function(){var a=this.params,e=[],d;if(a.wildcard){e.push("true")}if(d=a.id){e.push('element.readAttribute("id") == '+d.inspect())}if(d=a.tagName){e.push("element.tagName.toUpperCase() == "+d.inspect())}if((d=a.classNames).length>0){for(var b=0,c=d.length;b<c;b++){e.push("element.hasClassName("+d[b].inspect()+")")}}if(d=a.attributes){d.each(function(h){var g="element.readAttribute("+h.name.inspect()+")";var f=function(i){return g+" && "+g+".split("+i.inspect()+")"};switch(h.operator){case"=":e.push(g+" == "+h.value.inspect());break;case"~=":e.push(f(" ")+".include("+h.value.inspect()+")");break;case"|=":e.push(f("-")+".first().toUpperCase() == "+h.value.toUpperCase().inspect());break;case"!=":e.push(g+" != "+h.value.inspect());break;case"":case undefined:e.push("element.hasAttribute("+h.name.inspect()+")");break;default:throw"Unknown operator "+h.operator+" in selector"}})}return e.join(" && ")},compileMatcher:function(){this.match=new Function("element","if (!element.tagName) return false;       element = $(element);       return "+this.buildMatchExpression())},findElements:function(e){var a;if(a=$(this.params.id)){if(this.match(a)){if(!e||Element.childOf(a,e)){return[a]}}}e=(e||document).getElementsByTagName(this.params.tagName||"*");var d=[];for(var b=0,c=e.length;b<c;b++){if(this.match(a=e[b])){d.push(Element.extend(a))}}return d},toString:function(){return this.expression}};Object.extend(Selector,{matchElements:function(c,b){var a=new Selector(b);return c.select(a.match.bind(a)).map(Element.extend)},findElement:function(c,b,a){if(typeof b=="number"){a=b,b=false}return Selector.matchElements(c,b||"*")[a||0]},findChildElements:function(a,b){return b.map(function(c){return c.match(/[^\s"]+(?:"[^"]*"[^\s"]+)*/g).inject([null],function(e,f){var d=new Selector(f);return e.inject([],function(g,h){return g.concat(d.findElements(h||a))})})}).flatten()}});function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(a){$(a).reset();return a},serializeElements:function(a,c){var b=a.inject({},function(g,f){if(!f.disabled&&f.name){var d=f.name,e=$(f).getValue();if(e!=undefined){if(g[d]){if(g[d].constructor!=Array){g[d]=[g[d]]}g[d].push(e)}else{g[d]=e}}}return g});return c?b:Hash.toQueryString(b)}};Form.Methods={serialize:function(b,a){return Form.serializeElements(Form.getElements(b),a)},getElements:function(a){return $A($(a).getElementsByTagName("*")).inject([],function(c,b){if(Form.Element.Serializers[b.tagName.toLowerCase()]){c.push(Element.extend(b))}return c})},getInputs:function(g,d,b){g=$(g);var e=g.getElementsByTagName("input");if(!d&&!b){return $A(e).map(Element.extend)}for(var c=0,h=[],f=e.length;c<f;c++){var a=e[c];if((d&&a.type!=d)||(b&&a.name!=b)){continue}h.push(Element.extend(a))}return h},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(c){c=$(c);if(!c.disabled&&c.name){var a=c.getValue();if(a!=undefined){var b={};b[c.name]=a;return Hash.toQueryString(b)}}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;var $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(b){var a=b.selectedIndex;return a>=0?this.optionValue(b.options[a]):null},selectMany:function(a){var e,d=a.length;if(!d){return null}for(var c=0,e=[];c<d;c++){var b=a.options[c];if(b.selected){e.push(this.optionValue(b))}}return e},optionValue:function(a){return Element.extend(a).hasAttribute("value")?a.value:a.text}};Abstract.TimedObserver=function(){};Abstract.TimedObserver.prototype={initialize:function(c,b,a){this.frequency=b;this.element=$(c);this.callback=a;this.lastValue=this.getValue();this.registerCallback()},registerCallback:function(){setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},onTimerEvent:function(){var b=this.getValue();var a=("string"==typeof this.lastValue&&"string"==typeof b?this.lastValue!=b:String(this.lastValue)!=String(b));if(a){this.callback(this.element,b);this.lastValue=b}}};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(b,a){this.element=$(b);this.callback=a;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()}else{this.registerCallback(this.element)}},onElementEvent:function(){var a=this.getValue();if(this.lastValue!=a){this.callback(this.element,a);this.lastValue=a}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback.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=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(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(c,a){var b=Event.element(c);while(b.parentNode&&(!b.tagName||(b.tagName.toUpperCase()!=a.toUpperCase()))){b=b.parentNode}return b},observers:false,_observeAndCache:function(d,a,c,b){if(!this.observers){this.observers=[]}if(d.addEventListener){this.observers.push([d,a,c,b]);d.addEventListener(a,c,b)}else{if(d.attachEvent){this.observers.push([d,a,c,b]);d.attachEvent("on"+a,c)}}},unloadCache:function(){if(!Event.observers){return}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(c,b,a,d){c=$(c);d=d||false;if(b=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||c.attachEvent)){b="keydown"}Event._observeAndCache(c,b,a,d)},stopObserving:function(d,c,b,a){d=$(d);a=a||false;if(c=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||d.detachEvent)){c="keydown"}if(d.removeEventListener){d.removeEventListener(c,b,a)}else{if(d.detachEvent){try{d.detachEvent("on"+c,b)}catch(f){}}}}});if(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(b){var a=0,c=0;do{a+=b.offsetTop||0;c+=b.offsetLeft||0;b=b.offsetParent}while(b);return[c,a]},positionedOffset:function(d){var c=0,b=0;do{c+=d.offsetTop||0;b+=d.offsetLeft||0;d=d.offsetParent;if(d){if(d.tagName=="BODY"){break}var a=Element.getStyle(d,"position");if(a=="relative"||a=="absolute"){break}}}while(d);return[b,c]},offsetParent:function(a){if(a.offsetParent){return a.offsetParent}if(a==document.body){return a}while((a=a.parentNode)&&a!=document.body){if(Element.getStyle(a,"position")!="static"){return a}}return document.body},within:function(b,a,c){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(b,a,c)}this.xcomp=a;this.ycomp=c;this.offset=this.cumulativeOffset(b);return(c>=this.offset[1]&&c<this.offset[1]+b.offsetHeight&&a>=this.offset[0]&&a<this.offset[0]+b.offsetWidth)},withinIncludingScrolloffsets:function(c,a,d){var b=this.realOffset(c);this.xcomp=a+b[0]-this.deltaX;this.ycomp=d+b[1]-this.deltaY;this.offset=this.cumulativeOffset(c);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+c.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+c.offsetWidth)},overlap:function(b,a){if(!b){return 0}if(b=="vertical"){return((this.offset[1]+a.offsetHeight)-this.ycomp)/a.offsetHeight}if(b=="horizontal"){return((this.offset[0]+a.offsetWidth)-this.xcomp)/a.offsetWidth}},page:function(c){var b=0,d=0;var a=c;do{b+=a.offsetTop||0;d+=a.offsetLeft||0;if(a.offsetParent==document.body){if(Element.getStyle(a,"position")=="absolute"){break}}}while(a=a.offsetParent);a=c;do{if(!window.opera||a.tagName=="BODY"){b-=a.scrollTop||0;d-=a.scrollLeft||0}}while(a=a.parentNode);return[d,b]},clone:function(b,a){var f=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});b=$(b);var e=Position.page(b);a=$(a);var d=[0,0];var c=null;if(Element.getStyle(a,"position")=="absolute"){c=Position.offsetParent(a);d=Position.page(c)}if(c==document.body){d[0]-=document.body.offsetLeft;d[1]-=document.body.offsetTop}if(f.setLeft){a.style.left=(e[0]-d[0]+f.offsetLeft)+"px"}if(f.setTop){a.style.top=(e[1]-d[1]+f.offsetTop)+"px"}if(f.setWidth){a.style.width=b.offsetWidth+"px"}if(f.setHeight){a.style.height=b.offsetHeight+"px"}},absolutize:function(b){b=$(b);if(b.style.position=="absolute"){return}Position.prepare();var f=Position.positionedOffset(b);var e=f[1];var d=f[0];var c=b.clientWidth;var a=b.clientHeight;b._originalLeft=d-parseFloat(b.style.left||0);b._originalTop=e-parseFloat(b.style.top||0);b._originalWidth=b.style.width;b._originalHeight=b.style.height;b.style.position="absolute";b.style.top=e+"px";b.style.left=d+"px";b.style.width=c+"px";b.style.height=a+"px"},relativize:function(a){a=$(a);if(a.style.position=="relative"){return}Position.prepare();a.style.position="relative";var c=parseFloat(a.style.top||0)-(a._originalTop||0);var b=parseFloat(a.style.left||0)-(a._originalLeft||0);a.style.top=c+"px";a.style.left=b+"px";a.style.height=a._originalHeight;a.style.width=a._originalWidth}};if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){Position.cumulativeOffset=function(a){var c=0,b=0;do{c+=a.offsetTop||0;b+=a.offsetLeft||0;if(a.offsetParent==document.body){if(Element.getStyle(a,"position")=="absolute"){break}}a=a.offsetParent}while(a);return[b,c]}}Element.addMethods();