function $$(){return Selector.findChildElements(document,$A(arguments))}function $(a){if(arguments.length>1){for(var b=0,c=[],d=arguments.length;b<d;b++)c.push($(arguments[b]));return c}if(Object.isString(a))a=document.getElementById(a);return Element.extend(a)}function $R(a,b,c){return new ObjectRange(a,b,c)}function $H(a){return new Hash(a)}function $w(a){if(!Object.isString(a))return[];a=a.strip();return a?a.split(/\s+/):[]}function $A(a){if(!a)return[];if("toArray"in Object(a))return a.toArray();var b=a.length||0,c=new Array(b);while(b--)c[b]=a[b];return c}var Prototype,Abstract,Try,Class,PeriodicalExecuter,Template,$break,Enumerable,Hash,ObjectRange,Ajax,Node,Selector,Form,Field,$F,Toggle,Insertion,$continue,Position,Scriptaculous,Builder,Effect,Autocompleter,Droppables,Draggables,Draggable,SortableObserver,Sortable,Control;Prototype={Version:"1.6.1",Browser:function(){var a,b;a=navigator.userAgent;b=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!b,Opera:b,WebKit:a.indexOf("AppleWebKit/")>-1,Gecko:a.indexOf("Gecko")>-1&&a.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile.*Safari/.test(a)}}(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:function(){var a=window.Element||window.HTMLElement;return!!(a&&a.prototype)}(),SpecificElementExtensions:function(){if(typeof window.HTMLDivElement!=="undefined")return true;var a,b,c;a=document.createElement("div");b=document.createElement("form");c=false;if(a["__proto__"]&&a["__proto__"]!==b["__proto__"]){c=true}a=b=null;return c}()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)</script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(a){return a}};if(Prototype.Browser.MobileSafari)Prototype.BrowserFeatures.SpecificElementExtensions=false;Abstract={};Try={these:function(){var a,b,c,d;for(a=0,b=arguments.length;a<b;a++){c=arguments[a];try{d=c();break}catch(e){}}return d}};Class=function(){function c(a){var b,c,d,e,f,g;b=this.superclass&&this.superclass.prototype;c=Object.keys(a);if(!Object.keys({toString:true}).length){if(a.toString!=Object.prototype.toString)c.push("toString");if(a.valueOf!=Object.prototype.valueOf)c.push("valueOf")}for(d=0,e=c.length;d<e;d++){f=c[d],value=a[f];if(b&&Object.isFunction(value)&&value.argumentNames().first()=="$super"){g=value;value=function(a){return function(){return b[a].apply(this,arguments)}}(f).wrap(g);value.valueOf=g.valueOf.bind(g);value.toString=g.toString.bind(g)}this.prototype[f]=value}return this}function b(){function e(){this.initialize.apply(this,arguments)}var b,c,d;b=null;c=$A(arguments);if(Object.isFunction(c[0]))b=c.shift();Object.extend(e,Class.Methods);e.superclass=b;e.subclasses=[];if(b){a.prototype=b.prototype;e.prototype=new a;b.subclasses.push(e)}for(d=0;d<c.length;d++)e.addMethods(c[d]);if(!e.prototype.initialize)e.prototype.initialize=Prototype.emptyFunction;e.prototype.constructor=e;return e}function a(){}return{create:b,Methods:{addMethods:c}}}();(function(){function p(a){return typeof a==="undefined"}function o(b){return a.call(b)=="[object Number]"}function n(b){return a.call(b)=="[object String]"}function m(a){return typeof a==="function"}function l(a){return a instanceof Hash}function k(b){return a.call(b)=="[object Array]"}function j(a){return!!(a&&a.nodeType==1)}function i(a){return b({},a)}function h(a){var b,c;b=[];for(c in a)b.push(a[c]);return b}function g(a){var b,c;b=[];for(c in a)b.push(c);return b}function f(a){return a&&a.toHTML?a.toHTML():String.interpret(a)}function e(a){return $H(a).toQueryString()}function d(a){var b,c,e,f;b=typeof a;switch(b){case"undefined":case"function":case"unknown":return;case"boolean":return a.toString()}if(a===null)return"null";if(a.toJSON)return a.toJSON();if(j(a))return;c=[];for(e in a){f=d(a[e]);if(!p(f))c.push(e.toJSON()+": "+f)}return"{"+c.join(", ")+"}"}function c(a){try{if(p(a))return"undefined";if(a===null)return"null";return a.inspect?a.inspect():String(a)}catch(b){if(b instanceof RangeError)return"...";throw b}}function b(a,b){for(var c in b)a[c]=b[c];return a}var a=Object.prototype.toString;b(Object,{extend:b,inspect:c,toJSON:d,toQueryString:e,toHTML:f,keys:g,values:h,clone:i,isElement:j,isArray:k,isHash:l,isFunction:m,isString:n,isNumber:o,isUndefined:p})})();Object.extend(Function.prototype,function(){function k(){if(this._methodized)return this._methodized;var a=this;return this._methodized=function(){var c=b([this],arguments);return a.apply(null,c)}}function j(a){var c=this;return function(){var d=b([c.bind(this)],arguments);return a.apply(this,d)}}function i(){var a=b([.01],arguments);return this.delay.apply(this,a)}function h(b){var c=this,d=a.call(arguments,1);b=b*1e3;return window.setTimeout(function(){return c.apply(c,d)},b)}function g(){if(!arguments.length)return this;var b=this,d=a.call(arguments,0);return function(){var a=c(d,arguments);return b.apply(this,a)}}function f(c){var d=this,e=a.call(arguments,1);return function(a){var f=b([a||window.event],e);return d.apply(c,f)}}function e(b){if(arguments.length<2&&Object.isUndefined(arguments[0]))return this;var d=this,e=a.call(arguments,1);return function(){var a=c(e,arguments);return d.apply(b,a)}}function d(){var a=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g,"").replace(/\s+/g,"").split(",");return a.length==1&&!a[0]?[]:a}function c(c,d){c=a.call(c,0);return b(c,d)}function b(a,b){var c=a.length,d=b.length;while(d--)a[c+d]=b[d];return a}var a=Array.prototype.slice;return{argumentNames:d,bind:e,bindAsEventListener:f,curry:g,delay:h,defer:i,wrap:j,methodize:k}}());Date.prototype.toJSON=function(){return'"'+this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+'Z"'};RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};PeriodicalExecuter=Class.create({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*1e3)},execute:function(){this.callback(this)},stop:function(){if(!this.timer)return;clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute();this.currentlyExecuting=false}catch(a){this.currentlyExecuting=false;throw a}}}});Object.extend(String,{interpret:function(a){return a==null?"":String(a)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,function(){function interpolate(a,b){return(new Template(this,b)).evaluate(a)}function blank(){return/^\s*$/.test(this)}function empty(){return this==""}function endsWith(a){var b=this.length-a.length;return b>=0&&this.lastIndexOf(a)===b}function startsWith(a){return this.indexOf(a)===0}function include(a){return this.indexOf(a)>-1}function evalJSON(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON())return eval("("+json+")")}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())}function isJSON(){var a=this;if(a.blank())return false;a=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/.test(a)}function unfilterJSON(a){return this.replace(a||Prototype.JSONFilter,"$1")}function toJSON(){return this.inspect(true)}function inspect(a){var b=this.replace(/[\x00-\x1f\\]/g,function(a){if(a in String.specialChar){return String.specialChar[a]}return"\\u00"+a.charCodeAt().toPaddedString(2,16)});if(a)return'"'+b.replace(/"/g,'\\"')+'"';return"'"+b.replace(/'/g,"\\'")+"'"}function dasherize(){return this.replace(/_/g,"-")}function underscore(){return this.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/-/g,"_").toLowerCase()}function capitalize(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()}function camelize(){var a,b,c,d;a=this.split("-");b=a.length;if(b==1)return a[0];c=this.charAt(0)=="-"?a[0].charAt(0).toUpperCase()+a[0].substring(1):a[0];for(d=1;d<b;d++)c+=a[d].charAt(0).toUpperCase()+a[d].substring(1);return c}function times(a){return a<1?"":(new Array(a+1)).join(this)}function succ(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)}function toArray(){return this.split("")}function toQueryParams(a){var b=this.strip().match(/([^?#]*)(#.*)?$/);if(!b)return{};return b[1].split(a||"&").inject({},function(a,b){if((b=b.split("="))[0]){var c,d;c=decodeURIComponent(b.shift());d=b.length>1?b.join("="):b[0];if(d!=undefined)d=decodeURIComponent(d);if(c in a){if(!Object.isArray(a[c]))a[c]=[a[c]];a[c].push(d)}else a[c]=d}return a})}function unescapeHTML(){return this.stripTags().replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}function escapeHTML(){return this.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function evalScripts(){return this.extractScripts().map(function(script){return eval(script)})}function extractScripts(){var a,b;a=new RegExp(Prototype.ScriptFragment,"img");b=new RegExp(Prototype.ScriptFragment,"im");return(this.match(a)||[]).map(function(a){return(a.match(b)||["",""])[1]})}function stripScripts(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")}function stripTags(){return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,"")}function strip(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}function truncate(a,b){a=a||30;b=Object.isUndefined(b)?"...":b;return this.length>a?this.slice(0,a-b.length)+b:String(this)}function scan(a,b){this.gsub(a,b);return String(this)}function sub(a,b,c){b=prepareReplacement(b);c=Object.isUndefined(c)?1:c;return this.gsub(a,function(a){if(--c<0)return a[0];return b(a)})}function gsub(a,b){var c="",d=this,e;b=prepareReplacement(b);if(Object.isString(a))a=RegExp.escape(a);if(!(a.length||a.source)){b=b("");return b+d.split("").join(b)+b}while(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}function prepareReplacement(a){if(Object.isFunction(a))return a;var b=new Template(a);return function(a){return b.evaluate(a)}}return{gsub:gsub,sub:sub,scan:scan,truncate:truncate,strip:String.prototype.trim?String.prototype.trim:strip,stripTags:stripTags,stripScripts:stripScripts,extractScripts:extractScripts,evalScripts:evalScripts,escapeHTML:escapeHTML,unescapeHTML:unescapeHTML,toQueryParams:toQueryParams,parseQuery:toQueryParams,toArray:toArray,succ:succ,times:times,camelize:camelize,capitalize:capitalize,underscore:underscore,dasherize:dasherize,inspect:inspect,toJSON:toJSON,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:evalJSON,include:include,startsWith:startsWith,endsWith:endsWith,empty:empty,blank:blank,interpolate:interpolate}}());Template=Class.create({initialize:function(a,b){this.template=a.toString();this.pattern=b||Template.Pattern},evaluate:function(a){if(a&&Object.isFunction(a.toTemplateReplacements))a=a.toTemplateReplacements();return this.template.gsub(this.pattern,function(b){if(a==null)return b[1]+"";var c,d,e,f;c=b[1]||"";if(c=="\\")return b[2];d=a,expr=b[3];e=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;b=e.exec(expr);if(b==null)return c;while(b!=null){f=b[1].startsWith("[")?b[2].replace(/\\\\]/g,"]"):b[1];d=d[f];if(null==d||""==b[3])break;expr=expr.substring("["==b[3]?b[1].length:b[0].length);b=e.exec(expr)}return c+String.interpret(d)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;$break={};Enumerable=function(){function v(){return"#<Enumerable:"+this.toArray().inspect()+">"}function u(){return this.toArray().length}function t(){var a,b,c;a=Prototype.K;b=$A(arguments);if(Object.isFunction(b.last()))a=b.pop();c=[this].concat(b).map($A);return this.map(function(b,d){return a(c.pluck(d))})}function s(){return this.map()}function r(a,b){return this.map(function(c,d){return{value:c,criteria:a.call(b,c,d)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}).pluck("value")}function q(a,b){var c=[];this.each(function(d,e){if(!a.call(b,d,e))c.push(d)});return c}function p(a){var b=[];this.each(function(c){b.push(c[a])});return b}function o(a,b){a=a||Prototype.K;var c=[],d=[];this.each(function(e,f){(a.call(b,e,f)?c:d).push(e)});return[c,d]}function n(a,b){a=a||Prototype.K;var c;this.each(function(d,e){d=a.call(b,d,e);if(c==null||d<c)c=d});return c}function m(a,b){a=a||Prototype.K;var c;this.each(function(d,e){d=a.call(b,d,e);if(c==null||d>=c)c=d});return c}function l(a){var b=$A(arguments).slice(1);return this.map(function(c){return c[a].apply(c,b)})}function k(a,b,c){this.each(function(d,e){a=b.call(c,a,d,e)});return a}function j(a,b){b=Object.isUndefined(b)?null:b;return this.eachSlice(a,function(c){while(c.length<a)c.push(b);return c})}function i(a){if(Object.isFunction(this.indexOf))if(this.indexOf(a)!=-1)return true;var b=false;this.each(function(c){if(c==a){b=true;throw $break}});return b}function h(a,b,c){b=b||Prototype.K;var d=[];if(Object.isString(a))a=new RegExp(RegExp.escape(a));this.each(function(e,f){if(a.match(e))d.push(b.call(c,e,f))});return d}function g(a,b){var c=[];this.each(function(d,e){if(a.call(b,d,e))c.push(d)});return c}function f(a,b){var c;this.each(function(d,e){if(a.call(b,d,e)){c=d;throw $break}});return c}function e(a,b){a=a||Prototype.K;var c=[];this.each(function(d,e){c.push(a.call(b,d,e))});return c}function d(a,b){a=a||Prototype.K;var c=false;this.each(function(d,e){if(c=!!a.call(b,d,e))throw $break});return c}function c(a,b){a=a||Prototype.K;var c=true;this.each(function(d,e){c=c&&!!a.call(b,d,e);if(!c)throw $break});return c}function b(a,b,c){var d=-a,e=[],f=this.toArray();if(a<1)return f;while((d+=a)<f.length)e.push(f.slice(d,d+a));return e.collect(b,c)}function a(a,b){var c=0;try{this._each(function(d){a.call(b,d,c++)})}catch(d){if(d!=$break)throw d}return this}return{each:a,eachSlice:b,all:c,every:c,any:d,some:d,collect:e,map:e,detect:f,findAll:g,select:g,filter:g,grep:h,include:i,member:i,inGroupsOf:j,inject:k,invoke:l,max:m,min:n,partition:o,pluck:p,reject:q,sortBy:r,toArray:s,entries:s,zip:t,size:u,inspect:v,find:f}}();Array.from=$A;(function(){function t(){var a,c,d,e;a=b.call(this,0);for(c=0,length=arguments.length;c<length;c++){d=arguments[c];if(Object.isArray(d)&&!("callee"in d)){for(e=0,arrayLength=d.length;e<arrayLength;e++)a.push(d[e])}else{a.push(d)}}return a}function s(a,b){b=isNaN(b)?this.length:(b<0?this.length+b:b)+1;var c=this.slice(0,b).reverse().indexOf(a);return c<0?c:b-c-1}function r(a,b){b||(b=0);var c=this.length;if(b<0)b=c+b;for(;b<c;b++)if(this[b]===a)return b;return-1}function q(){var a,b;a=[];this.each(function(c){b=Object.toJSON(c);if(!Object.isUndefined(b))a.push(b)});return"["+a.join(", ")+"]"}function p(){return"["+this.map(Object.inspect).join(", ")+"]"}function o(){return this.length}function n(){return b.call(this,0)}function m(a){return this.uniq().findAll(function(b){return a.detect(function(a){return b===a})})}function l(a){return this.inject([],function(b,c,d){if(0==d||(a?b.last()!=c:!b.include(c)))b.push(c);return b})}function k(a){return(a!==false?this:this.toArray())._reverse()}function j(){var a=b.call(arguments,0);return this.select(function(b){return!a.include(b)})}function i(){return this.inject([],function(a,b){if(Object.isArray(b))return a.concat(b.flatten());a.push(b);return a})}function h(){return this.select(function(a){return a!=null})}function g(){return this[this.length-1]}function f(){return this[0]}function e(){this.length=0;return this}function d(a){for(var b=0,c=this.length;b<c;b++)a(this[b])}var a,b,c;a=Array.prototype;b=a.slice;c=a.forEach;if(!c)c=d;Object.extend(a,Enumerable);if(!a._reverse)a._reverse=a.reverse;Object.extend(a,{_each:c,clear:e,first:f,last:g,compact:h,flatten:i,without:j,reverse:k,uniq:l,intersect:m,clone:n,toArray:n,size:o,inspect:p,toJSON:q});CONCAT_ARGUMENTS_BUGGY=function(){return[].concat(arguments)[0][0]!==1}(1,2);if(CONCAT_ARGUMENTS_BUGGY)a.concat=t;if(!a.indexOf)a.indexOf=r;if(!a.lastIndexOf)a.lastIndexOf=s})();Hash=Class.create(Enumerable,function(){function p(){return new Hash(this)}function o(){return Object.toJSON(this.toObject())}function n(){return"#<Hash:{"+this.map(function(a){return a.map(Object.inspect).join(": ")}).join(", ")+"}>"}function m(){return this.inject([],function(a,b){var c=encodeURIComponent(b.key),d=b.value;if(d&&typeof d=="object"){if(Object.isArray(d))return a.concat(d.map(l.curry(c)))}else a.push(l(c,d));return a}).join("&")}function l(a,b){if(Object.isUndefined(b))return a;return a+"="+encodeURIComponent(String.interpret(b))}function k(a){return(new Hash(a)).inject(this,function(a,b){a.set(b.key,b.value);return a})}function j(a){return this.clone().update(a)}function i(a){var b=this.detect(function(b){return b.value===a});return b&&b.key}function h(){return this.pluck("value")}function g(){return this.pluck("key")}function f(){return Object.clone(this._object)}function e(a){var b=this._object[a];delete this._object[a];return b}function d(a){if(this._object[a]!==Object.prototype[a])return this._object[a]}function c(a,b){return this._object[a]=b}function b(a){var b,c,d;for(b in this._object){c=this._object[b];d=[b,c];d.key=b;d.value=c;a(d)}}function a(a){this._object=Object.isHash(a)?a.toObject():Object.clone(a)}return{initialize:a,_each:b,set:c,get:d,unset:e,toObject:f,toTemplateReplacements:f,keys:g,values:h,index:i,merge:j,update:k,toQueryString:m,inspect:n,toJSON:o,clone:p}}());Hash.from=$H;Object.extend(Number.prototype,function(){function i(){return Math.floor(this)}function h(){return Math.ceil(this)}function g(){return Math.round(this)}function f(){return Math.abs(this)}function e(){return isFinite(this)?this.toString():"null"}function d(a,b){var c=this.toString(b||10);return"0".times(a-c.length)+c}function c(a,b){$R(0,this,true).each(a,b);return this}function b(){return this+1}function a(){return this.toPaddedString(2,16)}return{toColorPart:a,succ:b,times:c,toPaddedString:d,toJSON:e,abs:f,round:g,ceil:h,floor:i}}());ObjectRange=Class.create(Enumerable,function(){function c(a){if(a<this.start)return false;if(this.exclusive)return a<this.end;return a<=this.end}function b(a){var b=this.start;while(this.include(b)){a(b);b=b.succ()}}function a(a,b,c){this.start=a;this.end=b;this.exclusive=c}return{initialize:a,_each:b,include:c}}());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(a,b,c,d){this.each(function(e){if(Object.isFunction(e[a])){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=Class.create({initialize:function(a){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};Object.extend(this.options,a||{});this.options.method=this.options.method.toLowerCase();if(Object.isString(this.options.parameters))this.options.parameters=this.options.parameters.toQueryParams();else if(Object.isHash(this.options.parameters))this.options.parameters=this.options.parameters.toObject()}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function(a,b,c){a(c);this.transport=Ajax.getTransport();this.request(b)},request:function(a){this.url=a;this.method=this.options.method;var b,c;b=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){b["_method"]=this.method;this.method="post"}this.parameters=b;if(b=Object.toQueryString(b)){if(this.method=="get")this.url+=(this.url.include("?")?"&":"?")+b;else if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))b+="&_="}try{c=new Ajax.Response(this);if(this.options.onCreate)this.options.onCreate(c);Ajax.Responders.dispatch("onCreate",this,c);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous)this.respondToReadyState.bind(this).defer(1);this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?this.options.postBody||b:null;this.transport.send(this.body);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,b,c,d;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"){b=this.options.requestHeaders;if(Object.isFunction(b.push))for(c=0,length=b.length;c<length;c+=2)a[b[c]]=b[c+1];else $H(b).each(function(b){a[b.key]=b.value})}for(d in a)this.transport.setRequestHeader(d,a[d])},success:function(){var a=this.getStatus();return!a||a>=200&&a<300},getStatus:function(){try{return this.transport.status||0}catch(a){return 0}},respondToReadyState:function(a){var b,c,d;b=Ajax.Request.Events[a];c=new Ajax.Response(this);if(b=="Complete"){try{this._complete=true;(this.options["on"+c.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(c,c.headerJSON)}catch(e){this.dispatchException(e)}d=c.getHeader("Content-type");if(this.options.evalJS=="force"||this.options.evalJS&&this.isSameOrigin()&&d&&d.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))this.evalResponse()}try{(this.options["on"+b]||Prototype.emptyFunction)(c,c.headerJSON);Ajax.Responders.dispatch("on"+b,this,c,c.headerJSON)}catch(e){this.dispatchException(e)}if(b=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},isSameOrigin:function(){var a=this.url.match(/^\s*https?:\/\/[^\/]*/);return!a||a[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""})},getHeader:function(a){try{return this.transport.getResponseHeader(a)||null}catch(b){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(a){(this.options.onException||Prototype.emptyFunction)(this,a);Ajax.Responders.dispatch("onException",this,a)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Response=Class.create({initialize:function(a){this.request=a;var b,c,d;b=this.transport=a.transport;c=this.readyState=b.readyState;if(c>2&&!Prototype.Browser.IE||c==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(b.responseText);this.headerJSON=this._getHeaderJSON()}if(c==4){d=b.responseXML;this.responseXML=Object.isUndefined(d)?null:d;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""}catch(a){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(a){return null}},getResponseHeader:function(a){return this.transport.getResponseHeader(a)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var a=this.getHeader("X-JSON");if(!a)return null;a=decodeURIComponent(escape(a));try{return a.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}},_getResponseJSON:function(){var a=this.request.options;if(!a.evalJSON||a.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json")||this.responseText.blank())return null;try{return this.responseText.evalJSON(a.sanitizeJSON||!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function(a,b,c,d){this.container={success:b.success||b,failure:b.failure||(b.success?null:b)};d=Object.clone(d);var e=d.onComplete;d.onComplete=function(a,b){this.updateContent(a.responseText);if(Object.isFunction(e))e(a,b)}.bind(this);a(c,d)},updateContent:function(a){var b,c,d;b=this.container[this.success()?"success":"failure"];c=this.options;if(!c.evalScripts)a=a.stripScripts();if(b=$(b)){if(c.insertion){if(Object.isString(c.insertion)){d={};d[c.insertion]=a;b.insert(d)}else c.insertion(b,a)}else b.update(a)}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function(a,b,c,d){a(d);this.onComplete=this.options.onComplete;this.frequency=this.options.frequency||2;this.decay=this.options.decay||1;this.updater={};this.container=b;this.url=c;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=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(a,b){var c,d,e;c=[];d=document.evaluate(a,$(b)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(e=0,length=d.snapshotLength;e<length;e++)c.push(Element.extend(d.snapshotItem(e)));return c}}if(!window.Node)Node={};if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12})}(function(a){var b,c;b=function(){var a,b,c,d;a=document.createElement("form");b=document.createElement("input");c=document.documentElement;b.setAttribute("name","test");a.appendChild(b);c.appendChild(a);d=a.elements?typeof a.elements.test=="undefined":null;c.removeChild(a);a=b=null;return d}();c=a.Element;a.Element=function(a,c){c=c||{};a=a.toLowerCase();var d=Element.cache;if(b&&c.name){a="<"+a+' name="'+c.name+'">';delete c.name;return Element.writeAttribute(document.createElement(a),c)}if(!d[a])d[a]=Element.extend(document.createElement(a));return Element.writeAttribute(d[a].cloneNode(false),c)};Object.extend(a.Element,c||{});if(c)a.Element.prototype=c.prototype})(this);Element.cache={};Element.idCounter=1;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=$(a);a.style.display="none";return a},show:function(a){a=$(a);a.style.display="";return a},remove:function(a){a=$(a);a.parentNode.removeChild(a);return a},update:function(){function d(d,e){d=$(d);if(e&&e.toElement)e=e.toElement();if(Object.isElement(e))return d.update().insert(e);e=Object.toHTML(e);var f=d.tagName.toUpperCase();if(f==="SCRIPT"&&c){d.text=e;return d}if(a||b){if(f in Element._insertionTranslations.tags){while(d.firstChild){d.removeChild(d.firstChild)}Element._getContentFromAnonymousElement(f,e.stripScripts()).each(function(a){d.appendChild(a)})}else{d.innerHTML=e.stripScripts()}}else{d.innerHTML=e.stripScripts()}e.evalScripts.bind(e).defer();return d}var a,b,c;a=function(){var a=document.createElement("select"),b=true;a.innerHTML='<option value="test">test</option>';if(a.options&&a.options[0]){b=a.options[0].nodeName.toUpperCase()!=="OPTION"}a=null;return b}();b=function(){try{var a,b;a=document.createElement("table");if(a&&a.tBodies){a.innerHTML="<tbody><tr><td>test</td></tr></tbody>";b=typeof a.tBodies[0]=="undefined";a=null;return b}}catch(c){return true}}();c=function(){var a=document.createElement("script"),b=false;try{a.appendChild(document.createTextNode(""));b=!a.firstChild||a.firstChild&&a.firstChild.nodeType!==3}catch(c){b=true}a=null;return b}();return d}(),replace:function(a,b){a=$(a);if(b&&b.toElement)b=b.toElement();else if(!Object.isElement(b)){b=Object.toHTML(b);var c=a.ownerDocument.createRange();c.selectNode(a);b.evalScripts.bind(b).defer();b=c.createContextualFragment(b.stripScripts())}a.parentNode.replaceChild(b,a);return a},insert:function(a,b){a=$(a);if(Object.isString(b)||Object.isNumber(b)||Object.isElement(b)||b&&(b.toElement||b.toHTML))b={bottom:b};var c,d,e,f,g;for(c in b){d=b[c];c=c.toLowerCase();e=Element._insertionTranslations[c];if(d&&d.toElement)d=d.toElement();if(Object.isElement(d)){e(a,d);continue}d=Object.toHTML(d);f=(c=="before"||c=="after"?a.parentNode:a).tagName.toUpperCase();g=Element._getContentFromAnonymousElement(f,d.stripScripts());if(c=="top"||c=="after")g.reverse();g.each(e.curry(a));d.evalScripts.bind(d).defer()}return a},wrap:function(a,b,c){a=$(a);if(Object.isElement(b))$(b).writeAttribute(c||{});else if(Object.isString(b))b=new Element(b,c);else b=new Element("div",b);if(a.parentNode)a.parentNode.replaceChild(b,a);b.appendChild(a);return b},inspect:function(a){a=$(a);var b="<"+a.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(c){var d,e;d=c.first(),attribute=c.last();e=(a[d]||"").toString();if(e)b+=" "+attribute+"="+e.inspect(true)});return b+">"},recursivelyCollect:function(a,b){a=$(a);var c=[];while(a=a[b])if(a.nodeType==1)c.push(Element.extend(a));return c},ancestors:function(a){return Element.recursivelyCollect(a,"parentNode")},descendants:function(a){return Element.select(a,"*")},firstDescendant:function(a){a=$(a).firstChild;while(a&&a.nodeType!=1)a=a.nextSibling;return $(a)},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 Element.recursivelyCollect(a,"previousSibling")},nextSiblings:function(a){return Element.recursivelyCollect(a,"nextSibling")},siblings:function(a){a=$(a);return Element.previousSiblings(a).reverse().concat(Element.nextSiblings(a))},match:function(a,b){if(Object.isString(b))b=new Selector(b);return b.match($(a))},up:function(a,b,c){a=$(a);if(arguments.length==1)return $(a.parentNode);var d=Element.ancestors(a);return Object.isNumber(b)?d[b]:Selector.findElement(d,b,c)},down:function(a,b,c){a=$(a);if(arguments.length==1)return Element.firstDescendant(a);return Object.isNumber(b)?Element.descendants(a)[b]:Element.select(a,b)[c||0]},previous:function(a,b,c){a=$(a);if(arguments.length==1)return $(Selector.handlers.previousElementSibling(a));var d=Element.previousSiblings(a);return Object.isNumber(b)?d[b]:Selector.findElement(d,b,c)},next:function(a,b,c){a=$(a);if(arguments.length==1)return $(Selector.handlers.nextElementSibling(a));var d=Element.nextSiblings(a);return Object.isNumber(b)?d[b]:Selector.findElement(d,b,c)},select:function(a){var b=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(a,b)},adjacent:function(a){var b=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(a.parentNode,b).without(a)},identify:function(a){a=$(a);var b=Element.readAttribute(a,"id");if(b)return b;do{b="anonymous_element_"+Element.idCounter++}while($(b));Element.writeAttribute(a,"id",b);return b},readAttribute:function(a,b){a=$(a);if(Prototype.Browser.IE){var c=Element._attributeTranslations.read;if(c.values[b])return c.values[b](a,b);if(c.names[b])b=c.names[b];if(b.include(":")){return!a.attributes||!a.attributes[b]?null:a.attributes[b].value}}return a.getAttribute(b)},writeAttribute:function(a,b,c){a=$(a);var d,e,f;d={};e=Element._attributeTranslations.write;if(typeof b=="object")d=b;else d[b]=Object.isUndefined(c)?true:c;for(f in d){b=e.names[f]||f;c=d[f];if(e.values[f])b=e.values[f](a,c);if(c===false||c===null)a.removeAttribute(b);else if(c===true)a.setAttribute(b,b);else a.setAttribute(b,c)}return a},getHeight:function(a){return Element.getDimensions(a).height},getWidth:function(a){return Element.getDimensions(a).width},classNames:function(a){return new Element.ClassNames(a)},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))},addClassName:function(a,b){if(!(a=$(a)))return;if(!Element.hasClassName(a,b))a.className+=(a.className?" ":"")+b;return a},removeClassName:function(a,b){if(!(a=$(a)))return;a.className=a.className.replace(new RegExp("(^|\\s+)"+b+"(\\s+|$)")," ").strip();return a},toggleClassName:function(a,b){if(!(a=$(a)))return;return Element[Element.hasClassName(a,b)?"removeClassName":"addClassName"](a,b)},cleanWhitespace:function(a){a=$(a);var b,c;b=a.firstChild;while(b){c=b.nextSibling;if(b.nodeType==3&&!/\S/.test(b.nodeValue))a.removeChild(b);b=c}return a},empty:function(a){return $(a).innerHTML.blank()},descendantOf:function(a,b){a=$(a),b=$(b);if(a.compareDocumentPosition)return(a.compareDocumentPosition(b)&8)===8;if(b.contains)return b.contains(a)&&b!==a;while(a=a.parentNode)if(a==b)return true;return false},scrollTo:function(a){a=$(a);var b=Element.cumulativeOffset(a);window.scrollTo(b[0],b[1]);return a},getStyle:function(a,b){a=$(a);b=b=="float"?"cssFloat":b.camelize();var c,d;c=a.style[b];if(!c||c=="auto"){d=document.defaultView.getComputedStyle(a,null);c=d?d[b]:null}if(b=="opacity")return c?parseFloat(c):1;return c=="auto"?null:c},getOpacity:function(a){return $(a).getStyle("opacity")},setStyle:function(a,b){a=$(a);var c,d;c=a.style;if(Object.isString(b)){a.style.cssText+=";"+b;return b.include("opacity")?a.setOpacity(b.match(/opacity:\s*(\d?\.?\d*)/)[1]):a}for(d in b)if(d=="opacity")a.setOpacity(b[d]);else c[d=="float"||d=="cssFloat"?Object.isUndefined(c.styleFloat)?"cssFloat":"styleFloat":d]=b[d];return a},setOpacity:function(a,b){a=$(a);a.style.opacity=b==1||b===""?"":b<1e-5?0:b;return a},getDimensions:function(a){a=$(a);var b,c,d,e,f,g,h;b=Element.getStyle(a,"display");if(b!="none"&&b!=null)return{width:a.offsetWidth,height:a.offsetHeight};c=a.style;d=c.visibility;e=c.position;f=c.display;c.visibility="hidden";if(e!="fixed")c.position="absolute";c.display="block";g=a.clientWidth;h=a.clientHeight;c.display=f;c.position=e;c.visibility=d;return{width:g,height:h}},makePositioned:function(a){a=$(a);var b=Element.getStyle(a,"position");if(b=="static"||!b){a._madePositioned=true;a.style.position="relative";if(Prototype.Browser.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=Element.getStyle(a,"overflow")||"auto";if(a._overflow!=="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},cumulativeOffset:function(a){var b=0,c=0;do{b+=a.offsetTop||0;c+=a.offsetLeft||0;a=a.offsetParent}while(a);return Element._returnOffset(c,b)},positionedOffset:function(a){var b,c,d;b=0;c=0;do{b+=a.offsetTop||0;c+=a.offsetLeft||0;a=a.offsetParent;if(a){if(a.tagName.toUpperCase()=="BODY")break;d=Element.getStyle(a,"position");if(d!=="static")break}}while(a);return Element._returnOffset(c,b)},absolutize:function(a){a=$(a);if(Element.getStyle(a,"position")=="absolute")return a;var b,c,d,e,f;b=Element.positionedOffset(a);c=b[1];d=b[0];e=a.clientWidth;f=a.clientHeight;a._originalLeft=d-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=d+"px";a.style.width=e+"px";a.style.height=f+"px";return a},relativize:function(a){a=$(a);if(Element.getStyle(a,"position")=="relative")return a;a.style.position="relative";var b,c;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;return a},cumulativeScrollOffset:function(a){var b=0,c=0;do{b+=a.scrollTop||0;c+=a.scrollLeft||0;a=a.parentNode}while(a);return Element._returnOffset(c,b)},getOffsetParent: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)},viewportOffset:function(a){var b,c,d;b=0;c=0;d=a;do{b+=d.offsetTop||0;c+=d.offsetLeft||0;if(d.offsetParent==document.body&&Element.getStyle(d,"position")=="absolute")break}while(d=d.offsetParent);d=a;do{if(!Prototype.Browser.Opera||d.tagName&&d.tagName.toUpperCase()=="BODY"){b-=d.scrollTop||0;c-=d.scrollLeft||0}}while(d=d.parentNode);return Element._returnOffset(c,b)},clonePosition:function(a,b){var c,d,e,f;c=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});b=$(b);d=Element.viewportOffset(b);a=$(a);e=[0,0];f=null;if(Element.getStyle(a,"position")=="absolute"){f=Element.getOffsetParent(a);e=Element.viewportOffset(f)}if(f==document.body){e[0]-=document.body.offsetLeft;e[1]-=document.body.offsetTop}if(c.setLeft)a.style.left=d[0]-e[0]+c.offsetLeft+"px";if(c.setTop)a.style.top=d[1]-e[1]+c.offsetTop+"px";if(c.setWidth)a.style.width=b.offsetWidth+"px";if(c.setHeight)a.style.height=b.offsetHeight+"px";return a}};Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(a,b,c){switch(c){case"left":case"top":case"right":case"bottom":if(a(b,"position")==="static")return null;case"height":case"width":if(!Element.visible(b))return null;var d,e;d=parseInt(a(b,c),10);if(d!==b["offset"+c.capitalize()])return d+"px";if(c==="height"){e=["border-top-width","padding-top","padding-bottom","border-bottom-width"]}else{e=["border-left-width","padding-left","padding-right","border-right-width"]}return e.inject(d,function(c,d){var e=a(b,d);return e===null?c:c-parseInt(e,10)})+"px";default:return a(b,c)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(a,b,c){if(c==="title")return b.title;return a(b,c)})}else if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(a,b){b=$(b);try{b.offsetParent}catch(c){return $(document.body)}var d,e;d=b.getStyle("position");if(d!=="static")return a(b);b.setStyle({position:"relative"});e=a(b);b.setStyle({position:d});return e});$w("positionedOffset viewportOffset").each(function(a){Element.Methods[a]=Element.Methods[a].wrap(function(a,b){b=$(b);try{b.offsetParent}catch(c){return Element._returnOffset(0,0)}var d,e,f;d=b.getStyle("position");if(d!=="static")return a(b);e=b.getOffsetParent();if(e&&e.getStyle("position")==="fixed")e.setStyle({zoom:1});b.setStyle({position:"relative"});f=a(b);b.setStyle({position:d});return f})});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(a,b){try{b.offsetParent}catch(c){return Element._returnOffset(0,0)}return a(b)});Element.Methods.getStyle=function(a,b){a=$(a);b=b=="float"||b=="cssFloat"?"styleFloat":b.camelize();var c=a.style[b];if(!c&&a.currentStyle)c=a.currentStyle[b];if(b=="opacity"){if(c=(a.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/))if(c[1])return parseFloat(c[1])/100;return 1}if(c=="auto"){if((b=="width"||b=="height")&&a.getStyle("display")!="none")return a["offset"+b.capitalize()]+"px";return null}return c};Element.Methods.setOpacity=function(a,b){function c(a){return a.replace(/alpha\([^\)]*\)/gi,"")}a=$(a);var d,e,f;d=a.currentStyle;if(d&&!d.hasLayout||!d&&a.style.zoom=="normal")a.style.zoom=1;e=a.getStyle("filter");f=a.style;if(b==1||b===""){(e=c(e))?f.filter=e:f.removeAttribute("filter");return a}else if(b<1e-5)b=0;f.filter=c(e)+"alpha(opacity="+b*100+")";return a};Element._attributeTranslations=function(){var a,b,c;a="className";b="for";c=document.createElement("div");c.setAttribute(a,"x");if(c.className!=="x"){c.setAttribute("class","x");if(c.className==="x"){a="class"}}c=null;c=document.createElement("label");c.setAttribute(b,"x");if(c.htmlFor!=="x"){c.setAttribute("htmlFor","x");if(c.htmlFor==="x"){b="htmlFor"}}c=null;return{read:{names:{"class":a,className:a,"for":b,htmlFor:b},values:{_getAttr:function(a,b){return a.getAttribute(b)},_getAttr2:function(a,b){return a.getAttribute(b,2)},_getAttrNode:function(a,b){var c=a.getAttributeNode(b);return c?c.value:""},_getEv:function(){var a,b,c;a=document.createElement("div");a.onclick=Prototype.emptyFunction;b=a.getAttribute("onclick");if(String(b).indexOf("{")>-1){c=function(a,b){b=a.getAttribute(b);if(!b)return null;b=b.toString();b=b.split("{")[1];b=b.split("}")[0];return b.strip()}}else if(b===""){c=function(a,b){b=a.getAttribute(b);if(!b)return null;return b.strip()}}a=null;return c}(),_flag:function(a,b){return $(a).hasAttribute(b)?b:null},style:function(a){return a.style.cssText.toLowerCase()},title:function(a){return a.title}}}}}();Element._attributeTranslations.write={names:Object.extend({cellpadding:"cellPadding",cellspacing:"cellSpacing"},Element._attributeTranslations.read.names),values:{checked:function(a,b){a.checked=!!b},style:function(a,b){a.style.cssText=b?b:""}}};Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex "+"encType maxLength readOnly longDesc frameBorder").each(function(a){Element._attributeTranslations.write.names[a.toLowerCase()]=a;Element._attributeTranslations.has[a.toLowerCase()]=a});(function(a){Object.extend(a,{href:a._getAttr2,src:a._getAttr2,type:a._getAttr,action:a._getAttrNode,disabled:a._flag,checked:a._flag,readonly:a._flag,multiple:a._flag,onload:a._getEv,onunload:a._getEv,onclick:a._getEv,ondblclick:a._getEv,onmousedown:a._getEv,onmouseup:a._getEv,onmouseover:a._getEv,onmousemove:a._getEv,onmouseout:a._getEv,onfocus:a._getEv,onblur:a._getEv,onkeypress:a._getEv,onkeydown:a._getEv,onkeyup:a._getEv,onsubmit:a._getEv,onreset:a._getEv,onselect:a._getEv,onchange:a._getEv})})(Element._attributeTranslations.read.values);if(Prototype.BrowserFeatures.ElementExtensions){(function(){function a(a){var b,c,d;b=a.getElementsByTagName("*");c=[];for(d=0,node;node=b[d];d++)if(node.tagName!=="!")c.push(node);return c}Element.Methods.down=function(b,c,d){b=$(b);if(arguments.length==1)return b.firstDescendant();return Object.isNumber(c)?a(b)[c]:Element.select(b,c)[d||0]}})()}}else if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=b==1?.999999:b===""?"":b<1e-5?0:b;return a}}else if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=b==1||b===""?"":b<1e-5?0:b;if(b==1)if(a.tagName.toUpperCase()=="IMG"&&a.width){a.width++;a.width--}else try{var c=document.createTextNode(" ");a.appendChild(c);a.removeChild(c)}catch(d){}return a};Element.Methods.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 Element._returnOffset(c,b)}}if("outerHTML"in document.documentElement){Element.Methods.replace=function(a,b){a=$(a);if(b&&b.toElement)b=b.toElement();if(Object.isElement(b)){a.parentNode.replaceChild(b,a);return a}b=Object.toHTML(b);var c,d,e,f;c=a.parentNode;d=c.tagName.toUpperCase();if(Element._insertionTranslations.tags[d]){e=a.next();f=Element._getContentFromAnonymousElement(d,b.stripScripts());c.removeChild(a);if(e)f.each(function(a){c.insertBefore(a,e)});else f.each(function(a){c.appendChild(a)})}else a.outerHTML=b.stripScripts();b.evalScripts.bind(b).defer();return a}}Element._returnOffset=function(a,b){var c=[a,b];c.left=a;c.top=b;return c};Element._getContentFromAnonymousElement=function(a,b){var c=new Element("div"),d=Element._insertionTranslations.tags[a];if(d){c.innerHTML=d[0]+b+d[1];d[2].times(function(){c=c.firstChild})}else c.innerHTML=b;return $A(c.childNodes)};Element._insertionTranslations={before:function(a,b){a.parentNode.insertBefore(b,a)},top:function(a,b){a.insertBefore(b,a.firstChild)},bottom:function(a,b){a.appendChild(b)},after:function(a,b){a.parentNode.insertBefore(b,a.nextSibling)},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};(function(){var a=Element._insertionTranslations.tags;Object.extend(a,{THEAD:a.TBODY,TFOOT:a.TBODY,TH:a.TD})})();Element.Methods.Simulated={hasAttribute:function(a,b){b=Element._attributeTranslations.has[b]||b;var c=$(a).getAttributeNode(b);return!!(c&&c.specified)}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);(function(a){if(!Prototype.BrowserFeatures.ElementExtensions&&a["__proto__"]){window.HTMLElement={};window.HTMLElement.prototype=a["__proto__"];Prototype.BrowserFeatures.ElementExtensions=true}a=null})(document.createElement("div"));Element.extend=function(){function b(a,b){var c,d;for(c in b){d=b[c];if(Object.isFunction(d)&&!(c in a))a[c]=d.methodize()}}function a(a){if(typeof window.Element!="undefined"){var b,c,d,e;b=window.Element.prototype;if(b){c="_"+(Math.random()+"").slice(2);d=document.createElement(a);b[c]="x";e=d[c]!=="x";delete b[c];d=null;return e}}return false}var c,d,e,f;c=a("object");if(Prototype.BrowserFeatures.SpecificElementExtensions){if(c){return function(a){if(a&&typeof a._extendedByPrototype=="undefined"){var c=a.tagName;if(c&&/^(?:object|applet|embed)$/i.test(c)){b(a,Element.Methods);b(a,Element.Methods.Simulated);b(a,Element.Methods.ByTag[c.toUpperCase()])}}return a}}return Prototype.K}d={};e=Element.Methods.ByTag;f=Object.extend(function(a){if(!a||typeof a._extendedByPrototype!="undefined"||a.nodeType!=1||a==window)return a;var c=Object.clone(d),f=a.tagName.toUpperCase();if(e[f])Object.extend(c,e[f]);b(a,c);a._extendedByPrototype=Prototype.emptyFunction;return a},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(d,Element.Methods);Object.extend(d,Element.Methods.Simulated)}}});f.refresh();return f}();Element.hasAttribute=function(a,b){if(a.hasAttribute)return a.hasAttribute(b);return Element.Methods.Simulated.hasAttribute(a,b)};Element.addMethods=function(a){function i(a){var b,c,d,e;c={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(c[a])b="HTML"+c[a]+"Element";if(window[b])return window[b];b="HTML"+a+"Element";if(window[b])return window[b];b="HTML"+a.capitalize()+"Element";if(window[b])return window[b];d=document.createElement(a);e=d["__proto__"]||d.constructor.prototype;d=null;return e}function h(a,b,c){c=c||false;var d,e;for(d in a){e=a[d];if(!Object.isFunction(e))continue;if(!c||!(d in b))b[d]=e.methodize()}}function g(b){b=b.toUpperCase();if(!Element.Methods.ByTag[b])Element.Methods.ByTag[b]={};Object.extend(Element.Methods.ByTag[b],a)}var b,c,d,e,f;b=Prototype.BrowserFeatures;c=Element.Methods.ByTag;if(!a){Object.extend(Form,Form.Methods);Object.extend(Form.Element,Form.Element.Methods);Object.extend(Element.Methods.ByTag,{FORM:Object.clone(Form.Methods),INPUT:Object.clone(Form.Element.Methods),SELECT:Object.clone(Form.Element.Methods),TEXTAREA:Object.clone(Form.Element.Methods)})}if(arguments.length==2){d=a;a=arguments[1]}if(!d)Object.extend(Element.Methods,a||{});else{if(Object.isArray(d))d.each(g);else g(d)}e=window.HTMLElement?HTMLElement.prototype:Element.prototype;if(b.ElementExtensions){h(Element.Methods,e);h(Element.Methods.Simulated,e,true)}if(b.SpecificElementExtensions){for(f in Element.Methods.ByTag){klass=i(f);if(Object.isUndefined(klass))continue;h(c[f],klass.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh)Element.extend.refresh();Element.cache={}};document.viewport={getDimensions:function(){return{width:this.getWidth(),height:this.getHeight()}},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};(function(a){function g(b){if(!d)d=f();e[b]="client"+b;a["get"+b]=function(){return d[e[b]]};return a["get"+b]()}function f(){if(b.WebKit&&!c.evaluate)return document;if(b.Opera&&window.parseFloat(window.opera.version())<9.5)return document.body;return document.documentElement}var b=Prototype.Browser,c=document,d,e={};a.getWidth=g.curry("Width");a.getHeight=g.curry("Height")})(document.viewport);Element.Storage={UID:1};Element.addMethods({getStorage:function(a){if(!(a=$(a)))return;var b;if(a===window){b=0}else{if(typeof a._prototypeUID==="undefined")a._prototypeUID=[Element.Storage.UID++];b=a._prototypeUID[0]}if(!Element.Storage[b])Element.Storage[b]=$H();return Element.Storage[b]},store:function(a,b,c){if(!(a=$(a)))return;if(arguments.length===2){Element.getStorage(a).update(b)}else{Element.getStorage(a).set(b,c)}return a},retrieve:function(a,b,c){if(!(a=$(a)))return;var d=Element.getStorage(a),e=d.get(b);if(Object.isUndefined(e)){d.set(b,c);e=c}return e},clone:function(a,b){if(!(a=$(a)))return;var c,d,e;c=a.cloneNode(b);c._prototypeUID=void 0;if(b){d=Element.select(c,"*");e=d.length;while(e--){d[e]._prototypeUID=void 0}}return Element.extend(c)}});Selector=Class.create({initialize:function(a){this.expression=a.strip();if(this.shouldUseSelectorsAPI()){this.mode="selectorsAPI"}else if(this.shouldUseXPath()){this.mode="xpath";this.compileXPathMatcher()}else{this.mode="normal";this.compileMatcher()}},shouldUseXPath:function(){var a=function(){var a,b,c,d;a=false;if(document.evaluate&&window.XPathResult){b=document.createElement("div");b.innerHTML="<ul><li></li></ul><div><ul><li></li></ul></div>";c=".//*[local-name()='ul' or local-name()='UL']"+"//*[local-name()='li' or local-name()='LI']";d=document.evaluate(c,b,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);a=d.snapshotLength!==2;b=null}return a}();return function(){if(!Prototype.BrowserFeatures.XPath)return false;var b=this.expression;if(Prototype.Browser.WebKit&&(b.include("-of-type")||b.include(":empty")))return false;if(/(\[[\w-]*?:|:checked)/.test(b))return false;if(a)return false;return true}}(),shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI)return false;if(Selector.CASE_INSENSITIVE_CLASS_NAMES)return false;if(!Selector._div)Selector._div=new Element("div");try{Selector._div.querySelector(this.expression)}catch(a){return false}return true},compileMatcher:function(){var e,ps,h,c,len,le,i,p,m,name;e=this.expression;ps=Selector.patterns;h=Selector.handlers;c=Selector.criteria;len=ps.length;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(i=0;i<len;i++){p=ps[i].re;name=ps[i].name;if(m=e.match(p)){this.matcher.push(Object.isFunction(c[name])?c[name](m):(new Template(c[name])).evaluate(m));e=e.replace(m[0],"");break}}}this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join("\n"));Selector._cache[this.expression]=this.matcher},compileXPathMatcher:function(){var a,b,c,d,e,f,g,h;a=this.expression;b=Selector.patterns;c=Selector.xpath;d=b.length;if(Selector._cache[a]){this.xpath=Selector._cache[a];return}this.matcher=[".//*"];while(a&&e!=a&&/\S/.test(a)){e=a;for(f=0;f<d;f++){g=b[f].name;if(h=a.match(b[f].re)){this.matcher.push(Object.isFunction(c[g])?c[g](h):(new Template(c[g])).evaluate(h));a=a.replace(h[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath},findElements:function(a){a=a||document;var b,c,d,e;b=this.expression;switch(this.mode){case"selectorsAPI":if(a!==document){c=a.id;d=$(a).identify();d=d.replace(/([\.:])/g,"\\$1");b="#"+d+" "+b}e=$A(a.querySelectorAll(b)).map(Element.extend);a.id=c;return e;case"xpath":return document._getElementsByXPath(this.xpath,a);default:return this.matcher(a)}},match:function(a){this.tokens=[];var b,c,d,e,f,g,h,i,j,k,l;b=this.expression;c=Selector.patterns;d=Selector.assertions;e=c.length;while(b&&f!==b&&/\S/.test(b)){f=b;for(g=0;g<e;g++){h=c[g].re;i=c[g].name;if(j=b.match(h)){if(d[i]){this.tokens.push([i,Object.clone(j)]);b=b.replace(j[0],"")}else{return this.findElements(document).include(a)}}}}l=true;for(g=0,token;token=this.tokens[g];g++){i=token[0];k=token[1];if(!Selector.assertions[i](a,k)){l=false;break}}return l},toString:function(){return this.expression},inspect:function(){return"#<Selector:"+this.expression.inspect()+">"}});if(Prototype.BrowserFeatures.SelectorsAPI&&document.compatMode==="BackCompat"){Selector.CASE_INSENSITIVE_CLASS_NAMES=function(){var a,b,c;a=document.createElement("div");b=document.createElement("span");a.id="prototype_test_id";b.className="Test";a.appendChild(b);c=a.querySelector("#prototype_test_id .test")!==null;a=b=null;return c}()}Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(a){if(a[1]=="*")return"";return"[local-name()='"+a[1].toLowerCase()+"' or local-name()='"+a[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(a){a[1]=a[1].toLowerCase();return(new Template("[@#{1}]")).evaluate(a)},attr:function(a){a[1]=a[1].toLowerCase();a[3]=a[5]||a[6];return(new Template(Selector.xpath.operators[a[2]])).evaluate(a)},pseudo:function(a){var b=Selector.xpath.pseudos[a[1]];if(!b)return"";if(Object.isFunction(b))return b(a);return(new Template(Selector.xpath.pseudos[a[1]])).evaluate(a)},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","only-child":"[not(preceding-sibling::* or following-sibling::*)]",empty:"[count(*) = 0 and (count(text()) = 0)]",checked:"[@checked]",disabled:"[(@disabled) and (@type!='hidden')]",enabled:"[not(@disabled) and (@type!='hidden')]",not:function(a){var b,c,d,e,f,g,h,i,j;b=a[6];c=Selector.patterns;d=Selector.xpath;e=c.length;f=[];while(b&&g!=b&&/\S/.test(b)){g=b;for(h=0;h<e;h++){j=c[h].name;if(a=b.match(c[h].re)){i=Object.isFunction(d[j])?d[j](a):(new Template(d[j])).evaluate(a);f.push("("+i.substring(1,i.length-1)+")");b=b.replace(a[0],"");break}}}return"[not("+f.join(" and ")+")]"},"nth-child":function(a){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",a)},"nth-last-child":function(a){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",a)},"nth-of-type":function(a){return Selector.xpath.pseudos.nth("position() ",a)},"nth-last-of-type":function(a){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",a)},"first-of-type":function(a){a[6]="1";return Selector.xpath.pseudos["nth-of-type"](a)},"last-of-type":function(a){a[6]="1";return Selector.xpath.pseudos["nth-last-of-type"](a)},"only-of-type":function(a){var b=Selector.xpath.pseudos;return b["first-of-type"](a)+b["last-of-type"](a)},nth:function(a,b){var c,d,e,f,g;c=b[6];if(c=="even")c="2n+0";if(c=="odd")c="2n+1";if(d=c.match(/^(\d+)$/))return"["+a+"= "+d[1]+"]";if(d=c.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(d[1]=="-")d[1]=-1;e=d[1]?Number(d[1]):1;f=d[2]?Number(d[2]):0;g="[((#{fragment} - #{b}) mod #{a} = 0) and "+"((#{fragment} - #{b}) div #{a} >= 0)]";return(new Template(g)).evaluate({fragment:a,a:e,b:f})}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);      c = false;',className:'n = h.className(n, r, "#{1}", c);    c = false;',id:'n = h.id(n, r, "#{1}", c);           c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(a){a[3]=a[5]||a[6];return(new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;')).evaluate(a)},pseudo:function(a){if(a[6])a[6]=a[6].replace(/"/g,'\\"');return(new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;')).evaluate(a)},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:[{name:"laterSibling",re:/^\s*~\s*/},{name:"child",re:/^\s*>\s*/},{name:"adjacent",re:/^\s*\+\s*/},{name:"descendant",re:/^\s/},{name:"tagName",re:/^\s*(\*|[\w\-]+)(\b|$)?/},{name:"id",re:/^#([\w\-\*]+)(\b|$)/},{name:"className",re:/^\.([\w\-\*]+)(\b|$)/},{name:"pseudo",re:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/},{name:"attrPresence",re:/^\[((?:[\w-]+:)?[\w-]+)\]/},{name:"attr",re:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/}],assertions:{tagName:function(a,b){return b[1].toUpperCase()==a.tagName.toUpperCase()},className:function(a,b){return Element.hasClassName(a,b[1])},id:function(a,b){return a.id===b[1]},attrPresence:function(a,b){return Element.hasAttribute(a,b[1])},attr:function(a,b){var c=Element.readAttribute(a,b[1]);return c&&Selector.operators[b[2]](c,b[5]||b[6])}},handlers:{concat:function(a,b){for(var c=0,d;d=b[c];c++)a.push(d);return a},mark:function(a){var b,c;b=Prototype.emptyFunction;for(c=0,node;node=a[c];c++)node._countedByPrototype=b;return a},unmark:function(){var a=function(){var a=document.createElement("div"),b=false,c="_countedByPrototype",d="x";a[c]=d;b=a.getAttribute(c)===d;a=null;return b}();return a?function(a){for(var b=0,c;c=a[b];b++)c.removeAttribute("_countedByPrototype");return a}:function(a){for(var b=0,c;c=a[b];b++)c._countedByPrototype=void 0;return a}}(),index:function(a,b,c){var d,e,f,g;a._countedByPrototype=Prototype.emptyFunction;if(b){for(d=a.childNodes,e=d.length-1,f=1;e>=0;e--){g=d[e];if(g.nodeType==1&&(!c||g._countedByPrototype))g.nodeIndex=f++}}else{for(e=0,f=1,d=a.childNodes;g=d[e];e++)if(g.nodeType==1&&(!c||g._countedByPrototype))g.nodeIndex=f++}},unique:function(a){if(a.length==0)return a;var b,c,d,e;b=[];for(d=0,e=a.length;d<e;d++)if(typeof (c=a[d])._countedByPrototype=="undefined"){c._countedByPrototype=Prototype.emptyFunction;b.push(Element.extend(c))}return Selector.handlers.unmark(b)},descendant:function(a){var b,c,d;b=Selector.handlers;for(c=0,d=[];node=a[c];c++)b.concat(d,node.getElementsByTagName("*"));return d},child:function(a){var b,c,d,e,f,g;b=Selector.handlers;for(c=0,d=[];e=a[c];c++){for(f=0;g=e.childNodes[f];f++)if(g.nodeType==1&&g.tagName!="!")d.push(g)}return d},adjacent:function(a){var b,c,d,e;for(b=0,c=[];d=a[b];b++){e=this.nextElementSibling(d);if(e)c.push(e)}return c},laterSibling:function(a){var b,c,d,e;b=Selector.handlers;for(c=0,d=[];e=a[c];c++)b.concat(d,Element.nextSiblings(e));return d},nextElementSibling:function(a){while(a=a.nextSibling)if(a.nodeType==1)return a;return null},previousElementSibling:function(a){while(a=a.previousSibling)if(a.nodeType==1)return a;return null},tagName:function(a,b,c,d){var e,f,g,h,i;e=c.toUpperCase();f=[];g=Selector.handlers;if(a){if(d){if(d=="descendant"){for(h=0;i=a[h];h++)g.concat(f,i.getElementsByTagName(c));return f}else a=this[d](a);if(c=="*")return a}for(h=0;i=a[h];h++)if(i.tagName.toUpperCase()===e)f.push(i);return f}else return b.getElementsByTagName(c)},id:function(a,b,c,d){var e,f,g,h,i;e=$(c);f=Selector.handlers;if(b==document){if(!e)return[];if(!a)return[e]}else{if(!b.sourceIndex||b.sourceIndex<1){a=b.getElementsByTagName("*");for(h=0;i=a[h];h++){if(i.id===c)return[i]}}}if(a){if(d){if(d=="child"){for(g=0;i=a[g];g++)if(e.parentNode==i)return[e]}else if(d=="descendant"){for(g=0;i=a[g];g++)if(Element.descendantOf(e,i))return[e]}else if(d=="adjacent"){for(g=0;i=a[g];g++)if(Selector.handlers.previousElementSibling(e)==i)return[e]}else a=f[d](a)}for(g=0;i=a[g];g++)if(i==e)return[e];return[]}return e&&Element.descendantOf(e,b)?[e]:[]},className:function(a,b,c,d){if(a&&d)a=this[d](a);return Selector.handlers.byClassName(a,b,c)},byClassName:function(a,b,c){if(!a)a=Selector.handlers.descendant([b]);var d,e,f,g,h;d=" "+c+" ";for(e=0,f=[];g=a[e];e++){h=g.className;if(h.length==0)continue;if(h==c||(" "+h+" ").include(d))f.push(g)}return f},attrPresence:function(a,b,c,d){if(!a)a=b.getElementsByTagName("*");if(a&&d)a=this[d](a);var e,f,g;e=[];for(f=0;g=a[f];f++)if(Element.hasAttribute(g,c))e.push(g);return e},attr:function(a,b,c,d,e,f){if(!a)a=b.getElementsByTagName("*");if(a&&f)a=this[f](a);var g,h,i,j,k;g=Selector.operators[e];h=[];for(i=0;j=a[i];i++){k=Element.readAttribute(j,c);if(k===null)continue;if(g(k,d))h.push(j)}return h},pseudo:function(a,b,c,d,e){if(a&&e)a=this[e](a);if(!a)a=d.getElementsByTagName("*");return Selector.pseudos[b](a,c,d)}},pseudos:{"first-child":function(a,b,c){for(var d=0,e=[],f;f=a[d];d++){if(Selector.handlers.previousElementSibling(f))continue;e.push(f)}return e},"last-child":function(a,b,c){for(var d=0,e=[],f;f=a[d];d++){if(Selector.handlers.nextElementSibling(f))continue;e.push(f)}return e},"only-child":function(a,b,c){var d,e,f,g;d=Selector.handlers;for(e=0,f=[];g=a[e];e++)if(!d.previousElementSibling(g)&&!d.nextElementSibling(g))f.push(g);return f},"nth-child":function(a,b,c){return Selector.pseudos.nth(a,b,c)},"nth-last-child":function(a,b,c){return Selector.pseudos.nth(a,b,c,true)},"nth-of-type":function(a,b,c){return Selector.pseudos.nth(a,b,c,false,true)},"nth-last-of-type":function(a,b,c){return Selector.pseudos.nth(a,b,c,true,true)},"first-of-type":function(a,b,c){return Selector.pseudos.nth(a,"1",c,false,true)},"last-of-type":function(a,b,c){return Selector.pseudos.nth(a,"1",c,true,true)},"only-of-type":function(a,b,c){var d=Selector.pseudos;return d["last-of-type"](d["first-of-type"](a,b,c),b,c)},getIndices:function(a,b,c){if(a==0)return b>0?[b]:[];return $R(1,c).inject([],function(c,d){if(0==(d-b)%a&&(d-b)/a>=0)c.push(d);return c})},nth:function(a,b,c,d,e){if(a.length==0)return[];if(b=="even")b="2n+0";if(b=="odd")b="2n+1";var f,g,h,i,j,k,l,m,n,o,p;f=Selector.handlers;g=[];h=[];f.mark(a);for(j=0;k=a[j];j++){if(!k.parentNode._countedByPrototype){f.index(k.parentNode,d,e);h.push(k.parentNode)}}if(b.match(/^\d+$/)){b=Number(b);for(j=0;k=a[j];j++)if(k.nodeIndex==b)g.push(k)}else if(i=b.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(i[1]=="-")i[1]=-1;l=i[1]?Number(i[1]):1;m=i[2]?Number(i[2]):0;n=Selector.pseudos.getIndices(l,m,a.length);for(j=0,o=n.length;k=a[j];j++){for(p=0;p<o;p++)if(k.nodeIndex==n[p])g.push(k)}}f.unmark(a);f.unmark(h);return g},empty:function(a,b,c){for(var d=0,e=[],f;f=a[d];d++){if(f.tagName=="!"||f.firstChild)continue;e.push(f)}return e},not:function(a,b,c){var d,e,f,g,h;d=Selector.handlers;e=(new Selector(b)).findElements(c);d.mark(e);for(f=0,g=[];h=a[f];f++)if(!h._countedByPrototype)g.push(h);d.unmark(e);return g},enabled:function(a,b,c){for(var d=0,e=[],f;f=a[d];d++)if(!f.disabled&&(!f.type||f.type!=="hidden"))e.push(f);return e},disabled:function(a,b,c){for(var d=0,e=[],f;f=a[d];d++)if(f.disabled)e.push(f);return e},checked:function(a,b,c){for(var d=0,e=[],f;f=a[d];d++)if(f.checked)e.push(f);return e}},operators:{"=":function(a,b){return a==b},"!=":function(a,b){return a!=b},"^=":function(a,b){return a==b||a&&a.startsWith(b)},"$=":function(a,b){return a==b||a&&a.endsWith(b)},"*=":function(a,b){return a==b||a&&a.include(b)},"~=":function(a,b){return(" "+a+" ").include(" "+b+" ")},"|=":function(a,b){return("-"+(a||"").toUpperCase()+"-").include("-"+(b||"").toUpperCase()+"-")}},split:function(a){var b=[];a.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(a){b.push(a[1].strip())});return b},matchElements:function(a,b){var c,d,e,f,g;c=$$(b);d=Selector.handlers;d.mark(c);for(e=0,f=[];g=a[e];e++)if(g._countedByPrototype)f.push(g);d.unmark(c);return f},findElement:function(a,b,c){if(Object.isNumber(b)){c=b;b=false}return Selector.matchElements(a,b||"*")[c||0]},findChildElements:function(a,b){b=Selector.split(b.join(","));var c,d,e,f,g;c=[];d=Selector.handlers;for(e=0,f=b.length;e<f;e++){g=new Selector(b[e].strip());d.concat(c,g.findElements(a))}return f>1?d.unique(c):c}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(a,b){for(var c=0,d;d=b[c];c++)if(d.tagName!=="!")a.push(d);return a}})}Form={reset:function(a){a=$(a);a.reset();return a},serializeElements:function(a,b){if(typeof b!="object")b={hash:!!b};else if(Object.isUndefined(b.hash))b.hash=true;var c,d,e,f,g;e=false;f=b.submit;g=a.inject({},function(a,b){if(!b.disabled&&b.name){c=b.name;d=$(b).getValue();if(d!=null&&b.type!="file"&&(b.type!="submit"||!e&&f!==false&&(!f||c==f)&&(e=true))){if(c in a){if(!Object.isArray(a[c]))a[c]=[a[c]];a[c].push(d)}else a[c]=d}}return a});return b.hash?g:Object.toQueryString(g)}};Form.Methods={serialize:function(a,b){return Form.serializeElements(Form.getElements(a),b)},getElements:function(a){var b,c,d,e,f;b=$(a).getElementsByTagName("*");c=[];d=Form.Element.Serializers;for(e=0;f=b[e];e++){c.push(f)}return c.inject([],function(a,b){if(d[b.tagName.toLowerCase()])a.push(Element.extend(b));return a})},getInputs:function(a,b,c){a=$(a);var d,e,f,g,h;d=a.getElementsByTagName("input");if(!b&&!c)return $A(d).map(Element.extend);for(e=0,f=[],g=d.length;e<g;e++){h=d[e];if(b&&h.type!=b||c&&h.name!=c)continue;f.push(Element.extend(h))}return f},disable:function(a){a=$(a);Form.getElements(a).invoke("disable");return a},enable:function(a){a=$(a);Form.getElements(a).invoke("enable");return a},findFirstElement:function(a){var b,c;b=$(a).getElements().findAll(function(a){return"hidden"!=a.type&&!a.disabled});c=b.findAll(function(a){return a.hasAttribute("tabIndex")&&a.tabIndex>=0}).sortBy(function(a){return a.tabIndex}).first();return c?c:b.find(function(a){return/^(?:input|select|textarea)$/i.test(a.tagName)})},focusFirstElement:function(a){a=$(a);a.findFirstElement().activate();return a},request:function(a,b){a=$(a),b=Object.clone(b||{});var c=b.parameters,d=a.readAttribute("action")||"";if(d.blank())d=window.location.href;b.parameters=a.serialize(true);if(c){if(Object.isString(c))c=c.toQueryParams();Object.extend(b.parameters,c)}if(a.hasAttribute("method")&&!b.method)b.method=a.method;return new Ajax.Request(d,b)}};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,c;b=a.getValue();if(b!=undefined){c={};c[a.name]=b;return Object.toQueryString(c)}}return""},getValue:function(a){a=$(a);var b=a.tagName.toLowerCase();return Form.Element.Serializers[b](a)},setValue:function(a,b){a=$(a);var c=a.tagName.toLowerCase();Form.Element.Serializers[c](a,b);return a},clear:function(a){$(a).value="";return a},present:function(a){return $(a).value!=""},activate:function(a){a=$(a);try{a.focus();if(a.select&&(a.tagName.toLowerCase()!="input"||!/^(?:button|reset|submit)$/i.test(a.type)))a.select()}catch(b){}return a},disable:function(a){a=$(a);a.disabled=true;return a},enable:function(a){a=$(a);a.disabled=false;return a}};Field=Form.Element;$F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(a,b){switch(a.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(a,b);default:return Form.Element.Serializers.textarea(a,b)}},inputSelector:function(a,b){if(Object.isUndefined(b))return a.checked?a.value:null;else a.checked=!!b},textarea:function(a,b){if(Object.isUndefined(b))return a.value;else a.value=b},select:function(a,b){if(Object.isUndefined(b))return this[a.type=="select-one"?"selectOne":"selectMany"](a);else{var c,d,e,f,g;c=!Object.isArray(b);for(d=0,e=a.length;d<e;d++){f=a.options[d];g=this.optionValue(f);if(c){if(g==b){f.selected=true;return}}else f.selected=b.include(g)}}},selectOne:function(a){var b=a.selectedIndex;return b>=0?this.optionValue(a.options[b]):null},selectMany:function(a){var b,c,d,e;b=a.length;if(!b)return null;for(c=0,d=[];c<b;c++){e=a.options[c];if(e.selected)d.push(this.optionValue(e))}return d},optionValue:function(a){return Element.extend(a).hasAttribute("value")?a.value:a.text}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function(a,b,c,d){a(d,c);this.element=$(b);this.lastValue=this.getValue()},execute:function(){var a=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(a)?this.lastValue!=a:String(this.lastValue)!=String(a)){this.callback(this.element,a);this.lastValue=a}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element)}});Abstract.EventObserver=Class.create({initialize:function(a,b){this.element=$(a);this.callback=b;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,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(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)}});(function(){function w(b,c,d,e){b=$(b);if(Object.isUndefined(e))e=true;if(b==document&&document.createEvent&&!b.dispatchEvent)b=document.documentElement;var f;if(document.createEvent){f=document.createEvent("HTMLEvents");f.initEvent("dataavailable",true,true)}else{f=document.createEventObject();f.eventType=e?"ondataavailable":"onfilterchange"}f.eventName=c;f.memo=d||{};if(document.createEvent)b.dispatchEvent(f);else b.fireEvent(f.eventType,f);return a.extend(f)}function v(a,b,c){a=$(a);var d,e,f,g;d=Element.retrieve(a,"prototype_event_registry");if(Object.isUndefined(d))return a;if(b&&!c){e=d.get(b);if(Object.isUndefined(e))return a;e.each(function(c){Element.stopObserving(a,b,c.handler)});return a}else if(!b){d.each(function(b){var c=b.key,d=b.value;d.each(function(b){Element.stopObserving(a,c,b.handler)})});return a}e=d.get(b);if(!e)return;f=e.find(function(a){return a.handler===c});if(!f)return a;g=h(b);if(b.include(":")){if(a.removeEventListener)a.removeEventListener("dataavailable",f,false);else{a.detachEvent("ondataavailable",f);a.detachEvent("onfilterchange",f)}}else{if(a.removeEventListener)a.removeEventListener(g,f,false);else a.detachEvent("on"+g,f)}d.set(b,e.without(f));return a}function u(a,b,c){a=$(a);var d,e;d=s(a,b,c);if(!d)return a;if(b.include(":")){if(a.addEventListener)a.addEventListener("dataavailable",d,false);else{a.attachEvent("ondataavailable",d);a.attachEvent("onfilterchange",d)}}else{e=h(b);if(a.addEventListener)a.addEventListener(e,d,false);else a.attachEvent("on"+e,d)}return a}function t(){for(var b=0,c=g.length;b<c;b++){a.stopObserving(g[b]);g[b]=null}}function s(b,d,e){var f,h,i;f=Element.retrieve(b,"prototype_event_registry");if(Object.isUndefined(f)){g.push(b);f=Element.retrieve(b,"prototype_event_registry",$H())}h=f.get(d);if(Object.isUndefined(h)){h=[];f.set(d,h)}if(h.pluck("handler").include(e))return false;if(d.include(":")){i=function(c){if(Object.isUndefined(c.eventName))return false;if(c.eventName!==d)return false;a.extend(c,b);e.call(b,c)}}else{if(!c&&(d==="mouseenter"||d==="mouseleave")){if(d==="mouseenter"||d==="mouseleave"){i=function(c){a.extend(c,b);var d=c.relatedTarget;while(d&&d!==b){try{d=d.parentNode}catch(f){d=b}}if(d===b)return;e.call(b,c)}}}else{i=function(c){a.extend(c,b);e.call(b,c)}}}i.handler=e;h.push(i);return i}function q(b){a.extend(b);b.preventDefault();b.stopPropagation();b.stopped=true}function p(a){var b=document.documentElement,c=document.body||{scrollTop:0};return a.pageY||a.clientY+(b.scrollTop||c.scrollTop)-(b.clientTop||0)}function o(a){var b=document.documentElement,c=document.body||{scrollLeft:0};return a.pageX||a.clientX+(b.scrollLeft||c.scrollLeft)-(b.clientLeft||0)}function n(a){return{x:o(a),y:p(a)}}function m(b,c){var d,e;d=a.element(b);if(!c)return d;e=[d].concat(d.ancestors());return Selector.findElement(e,c,0)}function l(b){b=a.extend(b);var c=b.target,d=b.type,e=b.currentTarget;if(e&&e.tagName){if(d==="load"||d==="error"||d==="click"&&e.tagName.toLowerCase()==="input"&&e.type==="radio")c=e}if(c.nodeType==Node.TEXT_NODE)c=c.parentNode;return Element.extend(c)}function k(a){return e(a,2)}function j(a){return e(a,1)}function i(a){return e(a,0)}var a,b,c,d,e,f,g,h;a={KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,cache:{}};b=document.documentElement;c="onmouseenter"in b&&"onmouseleave"in b;if(Prototype.Browser.IE){d={0:1,1:4,2:2};e=function(a,b){return a.button===d[b]}}else if(Prototype.Browser.WebKit){e=function(a,b){switch(b){case 0:return a.which==1&&!a.metaKey;case 1:return a.which==1&&a.metaKey;default:return false}}}else{e=function(a,b){return a.which?a.which===b+1:a.button===b}}a.Methods={isLeftClick:i,isMiddleClick:j,isRightClick:k,element:l,findElement:m,pointer:n,pointerX:o,pointerY:p,stop:q};f=Object.keys(a.Methods).inject({},function(b,c){b[c]=a.Methods[c].methodize();return b});if(Prototype.Browser.IE){function r(a){var b;switch(a.type){case"mouseover":b=a.fromElement;break;case"mouseout":b=a.toElement;break;default:return null}return Element.extend(b)}Object.extend(f,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});a.extend=function(b,c){if(!b)return false;if(b._extendedByPrototype)return b;b._extendedByPrototype=Prototype.emptyFunction;var d=a.pointer(b);Object.extend(b,{target:b.srcElement||c,relatedTarget:r(b),pageX:d.x,pageY:d.y});return Object.extend(b,f)}}else{a.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(a.prototype,f);a.extend=Prototype.K}g=[];if(Prototype.Browser.IE)window.attachEvent("onunload",t);if(Prototype.Browser.WebKit)window.addEventListener("unload",Prototype.emptyFunction,false);h=Prototype.K;if(!c){h=function(a){var b={mouseenter:"mouseover",mouseleave:"mouseout"};return a in b?b[a]:a}}Object.extend(a,a.Methods);Object.extend(a,{fire:w,observe:u,stopObserving:v});Element.addMethods({fire:w,observe:u,stopObserving:v});Object.extend(document,{fire:w.methodize(),observe:u.methodize(),stopObserving:v.methodize(),loaded:false});if(window.Event)Object.extend(window.Event,a);else window.Event=a})();(function(){function d(){try{document.documentElement.doScroll("left")}catch(c){a=d.defer();return}b()}function c(){if(document.readyState==="complete"){document.stopObserving("readystatechange",c);b()}}function b(){if(document.loaded)return;if(a)window.clearTimeout(a);document.loaded=true;document.fire("dom:loaded")}var a;if(document.addEventListener){document.addEventListener("DOMContentLoaded",b,false)}else{document.observe("readystatechange",c);if(window==top)a=d.defer()}Event.observe(window,"load",b)})();Element.addMethods();Hash.toQueryString=Object.toQueryString;Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;Insertion={Before:function(a,b){return Element.insert(a,{before:b})},Top:function(a,b){return Element.insert(a,{top:b})},Bottom:function(a,b){return Element.insert(a,{bottom:b})},After:function(a,b){return Element.insert(a,{after:b})}};$continue=new Error('"throw $continue" is deprecated, use "return" instead');Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},within:function(a,b,c){if(this.includeScrollOffsets)return this.withinIncludingScrolloffsets(a,b,c);this.xcomp=b;this.ycomp=c;this.offset=Element.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=Element.cumulativeScrollOffset(a);this.xcomp=b+d[0]-this.deltaX;this.ycomp=c+d[1]-this.deltaY;this.offset=Element.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},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(a){Position.prepare();return Element.absolutize(a)},relativize:function(a){Position.prepare();return Element.relativize(a)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(a,b,c){c=c||{};return Element.clonePosition(b,a,c)}};if(!document.getElementsByClassName)document.getElementsByClassName=function(a){function b(a){return a.blank()?null:"[contains(concat(' ', @class, ' '), ' "+a+" ')]"}a.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(a,c){c=c.toString().strip();var d=/\s/.test(c)?$w(c).map(b).join(""):b(c);return d?document._getElementsByXPath(".//*"+d,a):[]}:function(a,b){b=b.toString().strip();var c,d,e,f,g,h;c=[];d=/\s/.test(b)?$w(b):null;if(!d&&!b)return c;e=$(a).getElementsByTagName("*");b=" "+b+" ";for(f=0;g=e[f];f++){if(g.className&&(h=" "+g.className+" ")&&(h.include(b)||d&&d.all(function(a){return!a.toString().blank()&&h.include(" "+a+" ")})))c.push(Element.extend(g))}return c};return function(a,b){return $(b||document.body).getElementsByClassName(a)}}(Element.Methods);Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(a){this.element=$(a)},_each:function(a){this.element.className.split(/\s+/).select(function(a){return a.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);Scriptaculous={Version:"1.8.3",REQUIRED_PROTOTYPE:"1.6.0.3",load:function(){function a(a){var b=a.replace(/_.*|\./g,"");b=parseInt(b+"0".times(4-b.length));return a.indexOf("_")>-1?b-1:b}if(typeof Prototype=="undefined"||typeof Element=="undefined"||typeof Element.Methods=="undefined"||a(Prototype.Version)<a(Scriptaculous.REQUIRED_PROTOTYPE))throw"script.aculo.us requires the Prototype JavaScript framework >= "+Scriptaculous.REQUIRED_PROTOTYPE}};Scriptaculous.load();Builder={NODEMAP:{AREA:"map",CAPTION:"table",COL:"table",COLGROUP:"table",LEGEND:"fieldset",OPTGROUP:"select",OPTION:"select",PARAM:"object",TBODY:"table",TD:"table",TFOOT:"table",TH:"table",THEAD:"table",TR:"table"},node:function(a){a=a.toUpperCase();var b,c,d,e;b=this.NODEMAP[a]||"div";c=document.createElement(b);try{c.innerHTML="<"+a+"></"+a+">"}catch(f){}d=c.firstChild||null;if(d&&d.tagName.toUpperCase()!=a)d=d.getElementsByTagName(a)[0];if(!d)d=document.createElement(a);if(!d)return;if(arguments[1])if(this._isStringOrNumber(arguments[1])||arguments[1]instanceof Array||arguments[1].tagName){this._children(d,arguments[1])}else{e=this._attributes(arguments[1]);if(e.length){try{c.innerHTML="<"+a+" "+e+"></"+a+">"}catch(f){}d=c.firstChild||null;if(!d){d=document.createElement(a);for(attr in arguments[1])d[attr=="class"?"className":attr]=arguments[1][attr]}if(d.tagName.toUpperCase()!=a)d=c.getElementsByTagName(a)[0]}}if(arguments[2])this._children(d,arguments[2]);return $(d)},_text:function(a){return document.createTextNode(a)},ATTR_MAP:{className:"class",htmlFor:"for"},_attributes:function(a){var b=[];for(attribute in a)b.push((attribute in this.ATTR_MAP?this.ATTR_MAP[attribute]:attribute)+'="'+a[attribute].toString().escapeHTML().gsub(/"/,""")+'"');return b.join(" ")},_children:function(a,b){if(b.tagName){a.appendChild(b);return}if(typeof b=="object"){b.flatten().each(function(b){if(typeof b=="object")a.appendChild(b);else if(Builder._isStringOrNumber(b))a.appendChild(Builder._text(b))})}else if(Builder._isStringOrNumber(b))a.appendChild(Builder._text(b))},_isStringOrNumber:function(a){return typeof a=="string"||typeof a=="number"},build:function(a){var b=this.node("div");$(b).update(a.strip());return b.down()},dump:function(a){if(typeof a!="object"&&typeof a!="function")a=window;var b=("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY "+"BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET "+"FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+"KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+"PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+"TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);b.each(function(b){a[b]=function(){return Builder.node.apply(Builder,[b].concat($A(arguments)))}})}};String.prototype.parseColor=function(){var a,b,c;a="#";if(this.slice(0,4)=="rgb("){b=this.slice(4,this.length-1).split(",");c=0;do{a+=parseInt(b[c]).toColorPart()}while(++c<3)}else{if(this.slice(0,1)=="#"){if(this.length==4)for(c=1;c<4;c++)a+=(this.charAt(c)+this.charAt(c)).toLowerCase();if(this.length==7)a=this.toLowerCase()}}return a.length==7?a:arguments[0]||this};Element.collectTextNodes=function(a){return $A($(a).childNodes).collect(function(a){return a.nodeType==3?a.nodeValue:a.hasChildNodes()?Element.collectTextNodes(a):""}).flatten().join("")};Element.collectTextNodesIgnoreClass=function(a,b){return $A($(a).childNodes).collect(function(a){return a.nodeType==3?a.nodeValue:a.hasChildNodes()&&!Element.hasClassName(a,b)?Element.collectTextNodesIgnoreClass(a,b):""}).flatten().join("")};Element.setContentZoom=function(a,b){a=$(a);a.setStyle({fontSize:b/100+"em"});if(Prototype.Browser.WebKit)window.scrollBy(0,0);return a};Element.getInlineOpacity=function(a){return $(a).style.opacity||""};Element.forceRerendering=function(a){try{a=$(a);var b=document.createTextNode(" ");a.appendChild(b);a.removeChild(b)}catch(c){}};Effect={_elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},Transitions:{linear:Prototype.K,sinoidal:function(a){return-Math.cos(a*Math.PI)/2+.5},reverse:function(a){return 1-a},flicker:function(a){a=-Math.cos(a*Math.PI)/4+.75+Math.random()/4;return a>1?1:a},wobble:function(a){return-Math.cos(a*Math.PI*9*a)/2+.5},pulse:function(a,b){return-Math.cos(a*((b||5)-.5)*2*Math.PI)/2+.5},spring:function(a){return 1-Math.cos(a*4.5*Math.PI)*Math.exp(-a*6)},none:function(a){return 0},full:function(a){return 1}},DefaultOptions:{duration:1,fps:100,sync:false,from:0,to:1,delay:0,queue:"parallel"},tagifyText:function(a){var b="position:relative";if(Prototype.Browser.IE)b+=";zoom:1";a=$(a);$A(a.childNodes).each(function(c){if(c.nodeType==3){c.nodeValue.toArray().each(function(d){a.insertBefore((new Element("span",{style:b})).update(d==" "?String.fromCharCode(160):d),c)});Element.remove(c)}})},multiple:function(a,b){var c,d,e;if((typeof a=="object"||Object.isFunction(a))&&a.length)c=a;else c=$(a).childNodes;d=Object.extend({speed:.1,delay:0},arguments[2]||{});e=d.delay;$A(c).each(function(a,c){new b(a,Object.extend(d,{delay:c*d.speed+e}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(a,b,c){a=$(a);b=(b||"appear").toLowerCase();return Effect[Effect.PAIRS[b][a.visible()?1:0]](a,Object.extend({queue:{position:"end",scope:a.id||"global",limit:1}},c||{}))}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null},_each:function(a){this.effects._each(a)},add:function(a){var b,c;b=(new Date).getTime();c=Object.isString(a.options.queue)?a.options.queue:a.options.queue.position;switch(c){case"front":this.effects.findAll(function(a){return a.state=="idle"}).each(function(b){b.startOn+=a.finishOn;b.finishOn+=a.finishOn});break;case"with-last":b=this.effects.pluck("startOn").max()||b;break;case"end":b=this.effects.pluck("finishOn").max()||b;break}a.startOn+=b;a.finishOn+=b;if(!a.options.queue.limit||this.effects.length<a.options.queue.limit)this.effects.push(a);if(!this.interval)this.interval=setInterval(this.loop.bind(this),15)},remove:function(a){this.effects=this.effects.reject(function(b){return b==a});if(this.effects.length==0){clearInterval(this.interval);this.interval=null}},loop:function(){var a,b,c;a=(new Date).getTime();for(b=0,c=this.effects.length;b<c;b++)this.effects[b]&&this.effects[b].loop(a)}});Effect.Queues={instances:$H(),get:function(a){if(!Object.isString(a))return a;return this.instances.get(a)||this.instances.set(a,new Effect.ScopedQueue)}};Effect.Queue=Effect.Queues.get("global");Effect.Base=Class.create({position:null,start:function(a){if(a&&a.transition===false)a.transition=Effect.Transitions.linear;this.options=Object.extend(Object.extend({},Effect.DefaultOptions),a||{});this.currentFrame=0;this.state="idle";this.startOn=this.options.delay*1e3;this.finishOn=this.startOn+this.options.duration*1e3;this.fromToDelta=this.options.to-this.options.from;this.totalTime=this.finishOn-this.startOn;this.totalFrames=this.options.fps*this.options.duration;this.render=function(){function a(a,b){if(a.options[b+"Internal"])a.options[b+"Internal"](a);if(a.options[b])a.options[b](a)}return function(b){if(this.state==="idle"){this.state="running";a(this,"beforeSetup");if(this.setup)this.setup();a(this,"afterSetup")}if(this.state==="running"){b=this.options.transition(b)*this.fromToDelta+this.options.from;this.position=b;a(this,"beforeUpdate");if(this.update)this.update(b);a(this,"afterUpdate")}}}();this.event("beforeStart");if(!this.options.sync)Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).add(this)},loop:function(a){if(a>=this.startOn){if(a>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");if(this.finish)this.finish();this.event("afterFinish");return}var b=(a-this.startOn)/this.totalTime,c=(b*this.totalFrames).round();if(c>this.currentFrame){this.render(b);this.currentFrame=c}}},cancel:function(){if(!this.options.sync)Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).remove(this);this.state="finished"},event:function(a){if(this.options[a+"Internal"])this.options[a+"Internal"](this);if(this.options[a])this.options[a](this)},inspect:function(){var a=$H();for(property in this)if(!Object.isFunction(this[property]))a.set(property,this[property]);return"#<Effect:"+a.inspect()+",options:"+$H(this.options).inspect()+">"}});Effect.Parallel=Class.create(Effect.Base,{initialize:function(a){this.effects=a||[];this.start(arguments[1])},update:function(a){this.effects.invoke("render",a)},finish:function(a){this.effects.each(function(b){b.render(1);b.cancel();b.event("beforeFinish");if(b.finish)b.finish(a);b.event("afterFinish")})}});Effect.Tween=Class.create(Effect.Base,{initialize:function(a,b,c){a=Object.isString(a)?$(a):a;var d=$A(arguments),e=d.last(),f=d.length==5?d[3]:null;this.method=Object.isFunction(e)?e.bind(a):Object.isFunction(a[e])?a[e].bind(a):function(b){a[e]=b};this.start(Object.extend({from:b,to:c},f||{}))},update:function(a){this.method(a)}});Effect.Event=Class.create(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}))},update:Prototype.emptyFunction});Effect.Opacity=Class.create(Effect.Base,{initialize:function(a){this.element=$(a);if(!this.element)throw Effect._elementDoesNotExistError;if(Prototype.Browser.IE&&!this.element.currentStyle.hasLayout)this.element.setStyle({zoom:1});var b=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});this.start(b)},update:function(a){this.element.setOpacity(a)}});Effect.Move=Class.create(Effect.Base,{initialize:function(a){this.element=$(a);if(!this.element)throw Effect._elementDoesNotExistError;var b=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{});this.start(b)},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle("left")||"0");this.originalTop=parseFloat(this.element.getStyle("top")||"0");if(this.options.mode=="absolute"){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop}},update:function(a){this.element.setStyle({left:(this.options.x*a+this.originalLeft).round()+"px",top:(this.options.y*a+this.originalTop).round()+"px"})}});Effect.MoveBy=function(a,b,c){return new Effect.Move(a,Object.extend({x:c,y:b},arguments[3]||{}))};Effect.Scale=Class.create(Effect.Base,{initialize:function(a,b){this.element=$(a);if(!this.element)throw Effect._elementDoesNotExistError;var c=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:b},arguments[2]||{});this.start(c)},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle("position");this.originalStyle={};["top","left","width","height","fontSize"].each(function(a){this.originalStyle[a]=this.element.style[a]}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var a=this.element.getStyle("font-size")||"100%";["em","px","%","pt"].each(function(b){if(a.indexOf(b)>0){this.fontSize=parseFloat(a);this.fontSizeType=b}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=="box")this.dims=[this.element.offsetHeight,this.element.offsetWidth];if(/^content/.test(this.options.scaleMode))this.dims=[this.element.scrollHeight,this.element.scrollWidth];if(!this.dims)this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]},update:function(a){var b=this.options.scaleFrom/100+this.factor*a;if(this.options.scaleContent&&this.fontSize)this.element.setStyle({fontSize:this.fontSize*b+this.fontSizeType});this.setDimensions(this.dims[0]*b,this.dims[1]*b)},finish:function(a){if(this.restoreAfterFinish)this.element.setStyle(this.originalStyle)},setDimensions:function(a,b){var c,d,e;c={};if(this.options.scaleX)c.width=b.round()+"px";if(this.options.scaleY)c.height=a.round()+"px";if(this.options.scaleFromCenter){d=(a-this.dims[0])/2;e=(b-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY)c.top=this.originalTop-d+"px";if(this.options.scaleX)c.left=this.originalLeft-e+"px"}else{if(this.options.scaleY)c.top=-d+"px";if(this.options.scaleX)c.left=-e+"px"}}this.element.setStyle(c)}});Effect.Highlight=Class.create(Effect.Base,{initialize:function(a){this.element=$(a);if(!this.element)throw Effect._elementDoesNotExistError;var b=Object.extend({startcolor:"#ffff99"},arguments[1]||{});this.start(b)},setup:function(){if(this.element.getStyle("display")=="none"){this.cancel();return}this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle("background-image");this.element.setStyle({backgroundImage:"none"})}if(!this.options.endcolor)this.options.endcolor=this.element.getStyle("background-color").parseColor("#ffffff");if(!this.options.restorecolor)this.options.restorecolor=this.element.getStyle("background-color");this._base=$R(0,2).map(function(a){return parseInt(this.options.startcolor.slice(a*2+1,a*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(a){return parseInt(this.options.endcolor.slice(a*2+1,a*2+3),16)-this._base[a]}.bind(this))},update:function(a){this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(b,c,d){return b+(this._base[d]+this._delta[d]*a).round().toColorPart()}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=function(a){var b=arguments[1]||{},c=document.viewport.getScrollOffsets(),d=$(a).cumulativeOffset();if(b.offset)d[1]+=b.offset;return new Effect.Tween(null,c.top,d[1],b,function(a){scrollTo(c.left,a.round())})};Effect.Fade=function(a){a=$(a);var b,c;b=a.getInlineOpacity();c=Object.extend({from:a.getOpacity()||1,to:0,afterFinishInternal:function(a){if(a.options.to!=0)return;a.element.hide().setStyle({opacity:b})}},arguments[1]||{});return new Effect.Opacity(a,c)};Effect.Appear=function(a){a=$(a);var b=Object.extend({from:a.getStyle("display")=="none"?0:a.getOpacity()||0,to:1,afterFinishInternal:function(a){a.element.forceRerendering()},beforeSetup:function(a){a.element.setOpacity(a.options.from).show()}},arguments[1]||{});return new Effect.Opacity(a,b)};Effect.Puff=function(a){a=$(a);var b={opacity:a.getInlineOpacity(),position:a.getStyle("position"),top:a.style.top,left:a.style.left,width:a.style.width,height:a.style.height};return new Effect.Parallel([new Effect.Scale(a,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(a,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(a){Position.absolutize(a.effects[0].element)},afterFinishInternal:function(a){a.effects[0].element.hide().setStyle(b)}},arguments[1]||{}))};Effect.BlindUp=function(a){a=$(a);a.makeClipping();return new Effect.Scale(a,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(a){a.element.hide().undoClipping()}},arguments[1]||{}))};Effect.BlindDown=function(a){a=$(a);var b=a.getDimensions();return new Effect.Scale(a,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:b.height,originalWidth:b.width},restoreAfterFinish:true,afterSetup:function(a){a.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(a){a.element.undoClipping()}},arguments[1]||{}))};Effect.SwitchOff=function(a){a=$(a);var b=a.getInlineOpacity();return new Effect.Appear(a,Object.extend({duration:.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(a){new Effect.Scale(a.element,1,{duration:.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(a){a.element.makePositioned().makeClipping()},afterFinishInternal:function(a){a.element.hide().undoClipping().undoPositioned().setStyle({opacity:b})}})}},arguments[1]||{}))};Effect.DropOut=function(a){a=$(a);var b={top:a.getStyle("top"),left:a.getStyle("left"),opacity:a.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(a,{x:0,y:100,sync:true}),new Effect.Opacity(a,{sync:true,to:0})],Object.extend({duration:.5,beforeSetup:function(a){a.effects[0].element.makePositioned()},afterFinishInternal:function(a){a.effects[0].element.hide().undoPositioned().setStyle(b)}},arguments[1]||{}))};Effect.Shake=function(a){a=$(a);var b,c,d,e;b=Object.extend({distance:20,duration:.5},arguments[1]||{});c=parseFloat(b.distance);d=parseFloat(b.duration)/10;e={top:a.getStyle("top"),left:a.getStyle("left")};return new Effect.Move(a,{x:c,y:0,duration:d,afterFinishInternal:function(a){new Effect.Move(a.element,{x:-c*2,y:0,duration:d*2,afterFinishInternal:function(a){new Effect.Move(a.element,{x:c*2,y:0,duration:d*2,afterFinishInternal:function(a){new Effect.Move(a.element,{x:-c*2,y:0,duration:d*2,afterFinishInternal:function(a){new Effect.Move(a.element,{x:c*2,y:0,duration:d*2,afterFinishInternal:function(a){new Effect.Move(a.element,{x:-c,y:0,duration:d,afterFinishInternal:function(a){a.element.undoPositioned().setStyle(e)}})}})}})}})}})}})};Effect.SlideDown=function(a){a=$(a).cleanWhitespace();var b,c;b=a.down().getStyle("bottom");c=a.getDimensions();return new Effect.Scale(a,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:c.height,originalWidth:c.width},restoreAfterFinish:true,afterSetup:function(a){a.element.makePositioned();a.element.down().makePositioned();if(window.opera)a.element.setStyle({top:""});a.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(a){a.element.down().setStyle({bottom:a.dims[0]-a.element.clientHeight+"px"})},afterFinishInternal:function(a){a.element.undoClipping().undoPositioned();a.element.down().undoPositioned().setStyle({bottom:b})}},arguments[1]||{}))};Effect.SlideUp=function(a){a=$(a).cleanWhitespace();var b,c;b=a.down().getStyle("bottom");c=a.getDimensions();return new Effect.Scale(a,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,scaleMode:{originalHeight:c.height,originalWidth:c.width},restoreAfterFinish:true,afterSetup:function(a){a.element.makePositioned();a.element.down().makePositioned();if(window.opera)a.element.setStyle({top:""});a.element.makeClipping().show()},afterUpdateInternal:function(a){a.element.down().setStyle({bottom:a.dims[0]-a.element.clientHeight+"px"})},afterFinishInternal:function(a){a.element.hide().undoClipping().undoPositioned();a.element.down().undoPositioned().setStyle({bottom:b})}},arguments[1]||{}))};Effect.Squish=function(a){return new Effect.Scale(a,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(a){a.element.makeClipping()},afterFinishInternal:function(a){a.element.hide().undoClipping()}})};Effect.Grow=function(a){a=$(a);var b,c,d,e,f,g,h;b=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});c={top:a.style.top,left:a.style.left,height:a.style.height,width:a.style.width,opacity:a.getInlineOpacity()};d=a.getDimensions();switch(b.direction){case"top-left":e=f=g=h=0;break;case"top-right":e=d.width;f=h=0;g=-d.width;break;case"bottom-left":e=g=0;f=d.height;h=-d.height;break;case"bottom-right":e=d.width;f=d.height;g=-d.width;h=-d.height;break;case"center":e=d.width/2;f=d.height/2;g=-d.width/2;h=-d.height/2;break}return new Effect.Move(a,{x:e,y:f,duration:.01,beforeSetup:function(a){a.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(a){new Effect.Parallel([new Effect.Opacity(a.element,{sync:true,to:1,from:0,transition:b.opacityTransition}),new Effect.Move(a.element,{x:g,y:h,sync:true,transition:b.moveTransition}),new Effect.Scale(a.element,100,{scaleMode:{originalHeight:d.height,originalWidth:d.width},sync:true,scaleFrom:window.opera?1:0,transition:b.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(a){a.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(a){a.effects[0].element.undoClipping().undoPositioned().setStyle(c)}},b))}})};Effect.Shrink=function(a){a=$(a);var b,c,d,e,f;b=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});c={top:a.style.top,left:a.style.left,height:a.style.height,width:a.style.width,opacity:a.getInlineOpacity()};d=a.getDimensions();switch(b.direction){case"top-left":e=f=0;break;case"top-right":e=d.width;f=0;break;case"bottom-left":e=0;f=d.height;break;case"bottom-right":e=d.width;f=d.height;break;case"center":e=d.width/2;f=d.height/2;break}return new Effect.Parallel([new Effect.Opacity(a,{sync:true,to:0,from:1,transition:b.opacityTransition}),new Effect.Scale(a,window.opera?1:0,{sync:true,transition:b.scaleTransition,restoreAfterFinish:true}),new Effect.Move(a,{x:e,y:f,sync:true,transition:b.moveTransition})],Object.extend({beforeStartInternal:function(a){a.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(a){a.effects[0].element.hide().undoClipping().undoPositioned().setStyle(c)}},b))};Effect.Pulsate=function(a){a=$(a);var b=arguments[1]||{},c=a.getInlineOpacity(),d=b.transition||Effect.Transitions.linear,e=function(a){return 1-d(-Math.cos(a*(b.pulses||5)*2*Math.PI)/2+.5)};return new Effect.Opacity(a,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(a){a.element.setStyle({opacity:c})}},b),{transition:e}))};Effect.Fold=function(a){a=$(a);var b={top:a.style.top,left:a.style.left,width:a.style.width,height:a.style.height};a.makeClipping();return new Effect.Scale(a,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(c){new Effect.Scale(a,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(a){a.element.hide().undoClipping().setStyle(b)}})}},arguments[1]||{}))};Effect.Morph=Class.create(Effect.Base,{initialize:function(a){this.element=$(a);if(!this.element)throw Effect._elementDoesNotExistError;var b,c;b=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(b.style))this.style=$H(b.style);else{if(b.style.include(":"))this.style=b.style.parseStyle();else{this.element.addClassName(b.style);this.style=$H(this.element.getStyles());this.element.removeClassName(b.style);c=this.element.getStyles();this.style=this.style.reject(function(a){return a.value==c[a.key]});b.afterFinishInternal=function(a){a.element.addClassName(a.options.style);a.transforms.each(function(b){a.element.style[b.style]=""})}}}this.start(b)},setup:function(){function a(a){if(!a||["rgba(0, 0, 0, 0)","transparent"].include(a))a="#ffffff";a=a.parseColor();return $R(0,2).map(function(b){return parseInt(a.slice(b*2+1,b*2+3),16)})}this.transforms=this.style.map(function(b){var c,d,e,f,g;c=b[0];d=b[1];e=null;if(d.parseColor("#zzzzzz")!="#zzzzzz"){d=d.parseColor();e="color"}else if(c=="opacity"){d=parseFloat(d);if(Prototype.Browser.IE&&!this.element.currentStyle.hasLayout)this.element.setStyle({zoom:1})}else if(Element.CSS_LENGTH.test(d)){f=d.match(/^([\+\-]?[0-9\.]+)(.*)$/);d=parseFloat(f[1]);e=f.length==3?f[2]:null}g=this.element.getStyle(c);return{style:c.camelize(),originalValue:e=="color"?a(g):parseFloat(g||0),targetValue:e=="color"?a(d):d,unit:e}}.bind(this)).reject(function(a){return a.originalValue==a.targetValue||a.unit!="color"&&(isNaN(a.originalValue)||isNaN(a.targetValue))})},update:function(a){var b={},c,d=this.transforms.length;while(d--)b[(c=this.transforms[d]).style]=c.unit=="color"?"#"+Math.round(c.originalValue[0]+(c.targetValue[0]-c.originalValue[0])*a).toColorPart()+Math.round(c.originalValue[1]+(c.targetValue[1]-c.originalValue[1])*a).toColorPart()+Math.round(c.originalValue[2]+(c.targetValue[2]-c.originalValue[2])*a).toColorPart():(c.originalValue+(c.targetValue-c.originalValue)*a).toFixed(3)+(c.unit===null?"":c.unit);this.element.setStyle(b,true)}});Effect.Transform=Class.create({initialize:function(a){this.tracks=[];this.options=arguments[1]||{};this.addTracks(a)},addTracks:function(a){a.each(function(a){a=$H(a);var b=a.values().first();this.tracks.push($H({ids:a.keys().first(),effect:Effect.Morph,options:{style:b}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(a){var b,c,d,e;b=a.get("ids");c=a.get("effect");d=a.get("options");e=[$(b)||$$(b)].flatten();return e.map(function(a){return new c(a,Object.extend({sync:true},d))})}).flatten(),this.options)}});Element.CSS_PROPERTIES=$w("backgroundColor backgroundPosition borderBottomColor borderBottomStyle "+"borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth "+"borderRightColor borderRightStyle borderRightWidth borderSpacing "+"borderTopColor borderTopStyle borderTopWidth bottom clip color "+"fontSize fontWeight height left letterSpacing lineHeight "+"marginBottom marginLeft marginRight marginTop markerOffset maxHeight "+"maxWidth minHeight minWidth opacity outlineColor outlineOffset "+"outlineWidth paddingBottom paddingLeft paddingRight paddingTop "+"right textIndent top width wordSpacing zIndex");Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.__parseStyleElement=document.createElement("div");String.prototype.parseStyle=function(){var a,b=$H();if(Prototype.Browser.WebKit)a=(new Element("div",{style:this})).style;else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';a=String.__parseStyleElement.childNodes[0].style}Element.CSS_PROPERTIES.each(function(c){if(a[c])b.set(c,a[c])});if(Prototype.Browser.IE&&this.include("opacity"))b.set("opacity",this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);return b};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(a){var b=document.defaultView.getComputedStyle($(a),null);return Element.CSS_PROPERTIES.inject({},function(a,c){a[c]=b[c];return a})}}else{Element.getStyles=function(a){a=$(a);var b=a.currentStyle,c;c=Element.CSS_PROPERTIES.inject({},function(a,c){a[c]=b[c];return a});if(!c.opacity)c.opacity=a.getOpacity();return c}}Effect.Methods={morph:function(a,b){a=$(a);new Effect.Morph(a,Object.extend({style:b},arguments[2]||{}));return a},visualEffect:function(a,b,c){a=$(a);var d=b.dasherize().camelize(),e=d.charAt(0).toUpperCase()+d.substring(1);new Effect[e](a,c);return a},highlight:function(a,b){a=$(a);new Effect.Highlight(a,b);return a}};$w("fade appear grow shrink fold blindUp blindDown slideUp slideDown "+"pulsate shake puff squish switchOff dropOut").each(function(a){Effect.Methods[a]=function(b,c){b=$(b);Effect[a.charAt(0).toUpperCase()+a.substring(1)](b,c);return b}});$w("getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles").each(function(a){Effect.Methods[a]=Element[a]});Element.addMethods(Effect.Methods);if(typeof Effect=="undefined")throw"controls.js requires including script.aculo.us' effects.js library";Autocompleter={};Autocompleter.Base=Class.create({baseInitialize:function(a,b,c){a=$(a);this.element=a;this.update=$(b);this.hasFocus=false;this.changed=false;this.active=false;this.index=0;this.entryCount=0;this.oldElementValue=this.element.value;if(this.setOptions)this.setOptions(c);else this.options=c||{};this.options.paramName=this.options.paramName||this.element.name;this.options.tokens=this.options.tokens||[];this.options.frequency=this.options.frequency||.4;this.options.minChars=this.options.minChars||1;this.options.onShow=this.options.onShow||function(a,b){if(!b.style.position||b.style.position=="absolute"){b.style.position="absolute";Position.clone(a,b,{setHeight:false,offsetTop:a.offsetHeight})}Effect.Appear(b,{duration:.15})};this.options.onHide=this.options.onHide||function(a,b){new Effect.Fade(b,{duration:.15})};if(typeof this.options.tokens=="string")this.options.tokens=new Array(this.options.tokens);if(!this.options.tokens.include("\n"))this.options.tokens.push("\n");this.observer=null;this.element.setAttribute("autocomplete","off");Element.hide(this.update);Event.observe(this.element,"blur",this.onBlur.bindAsEventListener(this));Event.observe(this.element,"keydown",this.onKeyPress.bindAsEventListener(this))},show:function(){if(Element.getStyle(this.update,"display")=="none")this.options.onShow(this.element,this.update);if(!this.iefix&&Prototype.Browser.IE&&Element.getStyle(this.update,"position")=="absolute"){new Insertion.After(this.update,'<iframe id="'+this.update.id+'_iefix" '+'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" '+'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.update.id+"_iefix")}if(this.iefix)setTimeout(this.fixIEOverlapping.bind(this),50)},fixIEOverlapping:function(){Position.clone(this.update,this.iefix,{setTop:!this.update.style.height});this.iefix.style.zIndex=1;this.update.style.zIndex=2;Element.show(this.iefix)},hide:function(){this.stopIndicator();if(Element.getStyle(this.update,"display")!="none")this.options.onHide(this.element,this.update);if(this.iefix)Element.hide(this.iefix)},startIndicator:function(){if(this.options.indicator)Element.show(this.options.indicator)},stopIndicator:function(){if(this.options.indicator)Element.hide(this.options.indicator)},onKeyPress:function(a){if(this.active)switch(a.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(a);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(a);return;case Event.KEY_LEFT:case Event.KEY_RIGHT:return;case Event.KEY_UP:this.markPrevious();this.render();Event.stop(a);return;case Event.KEY_DOWN:this.markNext();this.render();Event.stop(a);return}else if(a.keyCode==Event.KEY_TAB||a.keyCode==Event.KEY_RETURN||Prototype.Browser.WebKit>0&&a.keyCode==0)return;this.changed=true;this.hasFocus=true;if(this.observer)clearTimeout(this.observer);this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1e3)},activate:function(){this.changed=false;this.hasFocus=true;this.getUpdatedChoices()},onHover:function(a){var b=Event.findElement(a,"LI");if(this.index!=b.autocompleteIndex){this.index=b.autocompleteIndex;this.render()}Event.stop(a)},onClick:function(a){var b=Event.findElement(a,"LI");this.index=b.autocompleteIndex;this.selectEntry();this.hide()},onBlur:function(a){setTimeout(this.hide.bind(this),250);this.hasFocus=false;this.active=false},render:function(){if(this.entryCount>0){for(var a=0;a<this.entryCount;a++)this.index==a?Element.addClassName(this.getEntry(a),"selected"):Element.removeClassName(this.getEntry(a),"selected");if(this.hasFocus){this.show();this.active=true}}else{this.active=false;this.hide()}},markPrevious:function(){if(this.index>0)this.index--;else this.index=this.entryCount-1;this.getEntry(this.index).scrollIntoView(true)},markNext:function(){if(this.index<this.entryCount-1)this.index++;else this.index=0;this.getEntry(this.index).scrollIntoView(false)},getEntry:function(a){return this.update.firstChild.childNodes[a]},getCurrentEntry:function(){return this.getEntry(this.index)},selectEntry:function(){this.active=false;this.updateElement(this.getCurrentEntry())},updateElement:function(a){if(this.options.updateElement){this.options.updateElement(a);return}var b,c,d,e,f;b="";if(this.options.select){c=$(a).select("."+this.options.select)||[];if(c.length>0)b=Element.collectTextNodes(c[0],this.options.select)}else b=Element.collectTextNodesIgnoreClass(a,"informal");d=this.getTokenBounds();if(d[0]!=-1){e=this.element.value.substr(0,d[0]);f=this.element.value.substr(d[0]).match(/^\s+/);if(f)e+=f[0];this.element.value=e+b+this.element.value.substr(d[1])}else{this.element.value=b}this.oldElementValue=this.element.value;this.element.focus();if(this.options.afterUpdateElement)this.options.afterUpdateElement(this.element,a)},updateChoices:function(a){if(!this.changed&&this.hasFocus){this.update.innerHTML=a;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.down());if(this.update.firstChild&&this.update.down().childNodes){this.entryCount=this.update.down().childNodes.length;var b,c;for(b=0;b<this.entryCount;b++){c=this.getEntry(b);c.autocompleteIndex=b;this.addObservers(c)}}else{this.entryCount=0}this.stopIndicator();this.index=0;if(this.entryCount==1&&this.options.autoSelect){this.selectEntry();this.hide()}else{this.render()}}},addObservers:function(a){Event.observe(a,"mouseover",this.onHover.bindAsEventListener(this));Event.observe(a,"click",this.onClick.bindAsEventListener(this))},onObserverEvent:function(){this.changed=false;this.tokenBounds=null;if(this.getToken().length>=this.options.minChars){this.getUpdatedChoices()}else{this.active=false;this.hide()}this.oldElementValue=this.element.value},getToken:function(){var a=this.getTokenBounds();return this.element.value.substring(a[0],a[1]).strip()},getTokenBounds:function(){if(null!=this.tokenBounds)return this.tokenBounds;var a,b,c,d,e,f,g,h;a=this.element.value;if(a.strip().empty())return[-1,0];b=arguments.callee.getFirstDifferencePos(a,this.oldElementValue);c=b==this.oldElementValue.length?1:0;d=-1;e=a.length;for(f=0,g=this.options.tokens.length;f<g;++f){h=a.lastIndexOf(this.options.tokens[f],b+c-1);if(h>d)d=h;h=a.indexOf(this.options.tokens[f],b+c);if(-1!=h&&h<e)e=h}return this.tokenBounds=[d+1,e]}});Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos=function(a,b){var c,d;c=Math.min(a.length,b.length);for(d=0;d<c;++d)if(a[d]!=b[d])return d;return c};Ajax.Autocompleter=Class.create(Autocompleter.Base,{initialize:function(a,b,c,d){this.baseInitialize(a,b,d);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=c},getUpdatedChoices:function(){this.startIndicator();var a=encodeURIComponent(this.options.paramName)+"="+encodeURIComponent(this.getToken());this.options.parameters=this.options.callback?this.options.callback(this.element,a):a;if(this.options.defaultParams)this.options.parameters+="&"+this.options.defaultParams;new Ajax.Request(this.url,this.options)},onComplete:function(a){this.updateChoices(a.responseText)}});Autocompleter.Local=Class.create(Autocompleter.Base,{initialize:function(a,b,c,d){this.baseInitialize(a,b,d);this.options.array=c},getUpdatedChoices:function(){this.updateChoices(this.options.selector(this))},setOptions:function(a){this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(a){var b,c,d,e,f,g,h;b=[];c=[];d=a.getToken();e=0;for(f=0;f<a.options.array.length&&b.length<a.options.choices;f++){g=a.options.array[f];h=a.options.ignoreCase?g.toLowerCase().indexOf(d.toLowerCase()):g.indexOf(d);while(h!=-1){if(h==0&&g.length!=d.length){b.push("<li><strong>"+g.substr(0,d.length)+"</strong>"+g.substr(d.length)+"</li>");break}else if(d.length>=a.options.partialChars&&a.options.partialSearch&&h!=-1){if(a.options.fullSearch||/\s/.test(g.substr(h-1,1))){c.push("<li>"+g.substr(0,h)+"<strong>"+g.substr(h,d.length)+"</strong>"+g.substr(h+d.length)+"</li>");break}}h=a.options.ignoreCase?g.toLowerCase().indexOf(d.toLowerCase(),h+1):g.indexOf(d,h+1)}}if(c.length)b=b.concat(c.slice(0,a.options.choices-b.length));return"<ul>"+b.join("")+"</ul>"}},a||{})}});Field.scrollFreeActivate=function(a){setTimeout(function(){Field.activate(a)},1)};Ajax.InPlaceEditor=Class.create({initialize:function(a,b,c){this.url=b;this.element=a=$(a);this.prepareOptions();this._controls={};arguments.callee.dealWithDeprecatedOptions(c);Object.extend(this.options,c||{});if(!this.options.formId&&this.element.id){this.options.formId=this.element.id+"-inplaceeditor";if($(this.options.formId))this.options.formId=""}if(this.options.externalControl)this.options.externalControl=$(this.options.externalControl);if(!this.options.externalControl)this.options.externalControlOnly=false;this._originalBackground=this.element.getStyle("background-color")||"transparent";this.element.title=this.options.clickToEditText;this._boundCancelHandler=this.handleFormCancellation.bind(this);this._boundComplete=(this.options.onComplete||Prototype.emptyFunction).bind(this);this._boundFailureHandler=this.handleAJAXFailure.bind(this);this._boundSubmitHandler=this.handleFormSubmission.bind(this);this._boundWrapperHandler=this.wrapUp.bind(this);this.registerListeners()},checkForEscapeOrReturn:function(a){if(!this._editing||a.ctrlKey||a.altKey||a.shiftKey)return;if(Event.KEY_ESC==a.keyCode)this.handleFormCancellation(a);else if(Event.KEY_RETURN==a.keyCode)this.handleFormSubmission(a)},createControl:function(a,b,c){var d,e,f,g;d=this.options[a+"Control"];e=this.options[a+"Text"];if("button"==d){f=document.createElement("input");f.type="submit";f.value=e;f.className="editor_"+a+"_button";if("cancel"==a)f.onclick=this._boundCancelHandler;this._form.appendChild(f);this._controls[a]=f}else if("link"==d){g=document.createElement("a");g.href="#";g.appendChild(document.createTextNode(e));g.onclick="cancel"==a?this._boundCancelHandler:this._boundSubmitHandler;g.className="editor_"+a+"_link";if(c)g.className+=" "+c;this._form.appendChild(g);this._controls[a]=g}},createEditField:function(){var a,b,c;a=this.options.loadTextURL?this.options.loadingText:this.getText();if(1>=this.options.rows&&!/\r|\n/.test(this.getText())){b=document.createElement("input");b.type="text";c=this.options.size||this.options.cols||0;if(0<c)b.size=c}else{b=document.createElement("textarea");b.rows=1>=this.options.rows?this.options.autoRows:this.options.rows;b.cols=this.options.cols||40}b.name=this.options.paramName;b.value=a;b.className="editor_field";if(this.options.submitOnBlur)b.onblur=this._boundSubmitHandler;this._controls.editor=b;if(this.options.loadTextURL)this.loadExternalText();this._form.appendChild(this._controls.editor)},createForm:function(){function b(b,c){var d=a.options["text"+b+"Controls"];if(!d||c===false)return;a._form.appendChild(document.createTextNode(d))}var a=this;this._form=$(document.createElement("form"));this._form.id=this.options.formId;this._form.addClassName(this.options.formClassName);this._form.onsubmit=this._boundSubmitHandler;this.createEditField();if("textarea"==this._controls.editor.tagName.toLowerCase())this._form.appendChild(document.createElement("br"));if(this.options.onFormCustomization)this.options.onFormCustomization(this,this._form);b("Before",this.options.okControl||this.options.cancelControl);this.createControl("ok",this._boundSubmitHandler);b("Between",this.options.okControl&&this.options.cancelControl);this.createControl("cancel",this._boundCancelHandler,"editor_cancel");b("After",this.options.okControl||this.options.cancelControl)},destroy:function(){if(this._oldInnerHTML)this.element.innerHTML=this._oldInnerHTML;this.leaveEditMode();this.unregisterListeners()},enterEditMode:function(a){if(this._saving||this._editing)return;this._editing=true;this.triggerCallback("onEnterEditMode");if(this.options.externalControl)this.options.externalControl.hide();this.element.hide();this.createForm();this.element.parentNode.insertBefore(this._form,this.element);if(!this.options.loadTextURL)this.postProcessEditField();if(a)Event.stop(a)},enterHover:function(a){if(this.options.hoverClassName)this.element.addClassName(this.options.hoverClassName);if(this._saving)return;this.triggerCallback("onEnterHover")},getText:function(){return this.element.innerHTML.unescapeHTML()},handleAJAXFailure:function(a){this.triggerCallback("onFailure",a);if(this._oldInnerHTML){this.element.innerHTML=this._oldInnerHTML;this._oldInnerHTML=null}},handleFormCancellation:function(a){this.wrapUp();if(a)Event.stop(a)},handleFormSubmission:function(a){var b,c,d,e;b=this._form;c=$F(this._controls.editor);this.prepareSubmission();d=this.options.callback(b,c)||"";if(Object.isString(d))d=d.toQueryParams();d.editorId=this.element.id;if(this.options.htmlResponse){e=Object.extend({evalScripts:true},this.options.ajaxOptions);Object.extend(e,{parameters:d,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Updater({success:this.element},this.url,e)}else{e=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(e,{parameters:d,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Request(this.url,e)}if(a)Event.stop(a)},leaveEditMode:function(){this.element.removeClassName(this.options.savingClassName);this.removeForm();this.leaveHover();this.element.style.backgroundColor=this._originalBackground;this.element.show();if(this.options.externalControl)this.options.externalControl.show();this._saving=false;this._editing=false;this._oldInnerHTML=null;this.triggerCallback("onLeaveEditMode")},leaveHover:function(a){if(this.options.hoverClassName)this.element.removeClassName(this.options.hoverClassName);if(this._saving)return;this.triggerCallback("onLeaveHover")},loadExternalText:function(){this._form.addClassName(this.options.loadingClassName);this._controls.editor.disabled=true;var a=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(a,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(a){this._form.removeClassName(this.options.loadingClassName);var b=a.responseText;if(this.options.stripLoadedTextTags)b=b.stripTags();this._controls.editor.value=b;this._controls.editor.disabled=false;this.postProcessEditField()}.bind(this),onFailure:this._boundFailureHandler});new Ajax.Request(this.options.loadTextURL,a)},postProcessEditField:function(){var a=this.options.fieldPostCreation;if(a)$(this._controls.editor)["focus"==a?"focus":"activate"]()},prepareOptions:function(){this.options=Object.clone(Ajax.InPlaceEditor.DefaultOptions);Object.extend(this.options,Ajax.InPlaceEditor.DefaultCallbacks);[this._extraDefaultOptions].flatten().compact().each(function(a){Object.extend(this.options,a)}.bind(this))},prepareSubmission:function(){this._saving=true;this.removeForm();this.leaveHover();this.showSaving()},registerListeners:function(){this._listeners={};var a;$H(Ajax.InPlaceEditor.Listeners).each(function(b){a=this[b.value].bind(this);this._listeners[b.key]=a;if(!this.options.externalControlOnly)this.element.observe(b.key,a);if(this.options.externalControl)this.options.externalControl.observe(b.key,a)}.bind(this))},removeForm:function(){if(!this._form)return;this._form.remove();this._form=null;this._controls={}},showSaving:function(){this._oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;this.element.addClassName(this.options.savingClassName);this.element.style.backgroundColor=this._originalBackground;this.element.show()},triggerCallback:function(a,b){if("function"==typeof this.options[a]){this.options[a](this,b)}},unregisterListeners:function(){$H(this._listeners).each(function(a){if(!this.options.externalControlOnly)this.element.stopObserving(a.key,a.value);if(this.options.externalControl)this.options.externalControl.stopObserving(a.key,a.value)}.bind(this))},wrapUp:function(a){this.leaveEditMode();this._boundComplete(a,this.element)}});Object.extend(Ajax.InPlaceEditor.prototype,{dispose:Ajax.InPlaceEditor.prototype.destroy});Ajax.InPlaceCollectionEditor=Class.create(Ajax.InPlaceEditor,{initialize:function(a,b,c,d){this._extraDefaultOptions=Ajax.InPlaceCollectionEditor.DefaultOptions;a(b,c,d)},createEditField:function(){var a=document.createElement("select");a.name=this.options.paramName;a.size=1;this._controls.editor=a;this._collection=this.options.collection||[];if(this.options.loadCollectionURL)this.loadCollection();else this.checkForExternalText();this._form.appendChild(this._controls.editor)},loadCollection:function(){this._form.addClassName(this.options.loadingClassName);this.showLoadingText(this.options.loadingCollectionText);var options=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(options,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){var js=transport.responseText.strip();if(!/^\[.*\]$/.test(js))throw"Server returned an invalid collection representation.";this._collection=eval(js);this.checkForExternalText()}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadCollectionURL,options)},showLoadingText:function(a){this._controls.editor.disabled=true;var b=this._controls.editor.firstChild;if(!b){b=document.createElement("option");b.value="";this._controls.editor.appendChild(b);b.selected=true}b.update((a||"").stripScripts().stripTags())},checkForExternalText:function(){this._text=this.getText();if(this.options.loadTextURL)this.loadExternalText();else this.buildOptionList()},loadExternalText:function(){this.showLoadingText(this.options.loadingText);var a=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(a,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(a){this._text=a.responseText.strip();this.buildOptionList()}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadTextURL,a)},buildOptionList:function(){this._form.removeClassName(this.options.loadingClassName);this._collection=this._collection.map(function(a){return 2===a.length?a:[a,a].flatten()});var a,b,c;a="value"in this.options?this.options.value:this._text;b=this._collection.any(function(b){return b[0]==a}.bind(this));this._controls.editor.update("");this._collection.each(function(d,e){c=document.createElement("option");c.value=d[0];c.selected=b?d[0]==a:0==e;c.appendChild(document.createTextNode(d[1]));this._controls.editor.appendChild(c)}.bind(this));this._controls.editor.disabled=false;Field.scrollFreeActivate(this._controls.editor)}});Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions=function(a){function b(b,c){if(b in a||c===undefined)return;a[b]=c}if(!a)return;b("cancelControl",a.cancelLink?"link":a.cancelButton?"button":a.cancelLink==a.cancelButton==false?false:undefined);b("okControl",a.okLink?"link":a.okButton?"button":a.okLink==a.okButton==false?false:undefined);b("highlightColor",a.highlightcolor);b("highlightEndColor",a.highlightendcolor)};Object.extend(Ajax.InPlaceEditor,{DefaultOptions:{ajaxOptions:{},autoRows:3,cancelControl:"link",cancelText:"cancel",clickToEditText:"Click to edit",externalControl:null,externalControlOnly:false,fieldPostCreation:"activate",formClassName:"inplaceeditor-form",formId:null,highlightColor:"#ffff99",highlightEndColor:"#ffffff",hoverClassName:"",htmlResponse:true,loadingClassName:"inplaceeditor-loading",loadingText:"Loading...",okControl:"button",okText:"ok",paramName:"value",rows:1,savingClassName:"inplaceeditor-saving",savingText:"Saving...",size:0,stripLoadedTextTags:false,submitOnBlur:false,textAfterControls:"",textBeforeControls:"",textBetweenControls:""},DefaultCallbacks:{callback:function(a){return Form.serialize(a)},onComplete:function(a,b){new Effect.Highlight(b,{startcolor:this.options.highlightColor,keepBackgroundImage:true})},onEnterEditMode:null,onEnterHover:function(a){a.element.style.backgroundColor=a.options.highlightColor;if(a._effect)a._effect.cancel()},onFailure:function(a,b){alert("Error communication with the server: "+a.responseText.stripTags())},onFormCustomization:null,onLeaveEditMode:null,onLeaveHover:function(a){a._effect=new Effect.Highlight(a.element,{startcolor:a.options.highlightColor,endcolor:a.options.highlightEndColor,restorecolor:a._originalBackground,keepBackgroundImage:true})}},Listeners:{click:"enterEditMode",keydown:"checkForEscapeOrReturn",mouseover:"enterHover",mouseout:"leaveHover"}});Ajax.InPlaceCollectionEditor.DefaultOptions={loadingCollectionText:"Loading options..."};Form.Element.DelayedObserver=Class.create({initialize:function(a,b,c){this.delay=b||.5;this.element=$(a);this.callback=c;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,"keyup",this.delayedListener.bindAsEventListener(this))},delayedListener:function(a){if(this.lastValue==$F(this.element))return;if(this.timer)clearTimeout(this.timer);this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1e3);this.lastValue=$F(this.element)},onTimerEvent:function(){this.timer=null;this.callback(this.element,$F(this.element))}});if(Object.isUndefined(Effect))throw"dragdrop.js requires including script.aculo.us' effects.js library";Droppables={drops:[],remove:function(a){this.drops=this.drops.reject(function(b){return b.element==$(a)})},add:function(a){a=$(a);var b,c;b=Object.extend({greedy:true,hoverclass:null,tree:false},arguments[1]||{});if(b.containment){b._containers=[];c=b.containment;if(Object.isArray(c)){c.each(function(a){b._containers.push($(a))})}else{b._containers.push($(c))}}if(b.accept)b.accept=[b.accept].flatten();Element.makePositioned(a);b.element=a;this.drops.push(b)},findDeepestChild:function(a){deepest=a[0];for(var b=1;b<a.length;++b)if(Element.isParent(a[b].element,deepest.element))deepest=a[b];return deepest},isContained:function(a,b){var c;if(b.tree){c=a.treeNode}else{c=a.parentNode}return b._containers.detect(function(a){return c==a})},isAffected:function(a,b,c){return c.element!=b&&(!c._containers||this.isContained(b,c))&&(!c.accept||Element.classNames(b).detect(function(a){return c.accept.include(a)}))&&Position.within(c.element,a[0],a[1])},deactivate:function(a){if(a.hoverclass)Element.removeClassName(a.element,a.hoverclass);this.last_active=null},activate:function(a){if(a.hoverclass)Element.addClassName(a.element,a.hoverclass);this.last_active=a},show:function(a,b){if(!this.drops.length)return;var c,d=[];this.drops.each(function(c){if(Droppables.isAffected(a,b,c))d.push(c)});if(d.length>0)c=Droppables.findDeepestChild(d);if(this.last_active&&this.last_active!=c)this.deactivate(this.last_active);if(c){Position.within(c.element,a[0],a[1]);if(c.onHover)c.onHover(b,c.element,Position.overlap(c.overlap,c.element));if(c!=this.last_active)Droppables.activate(c)}},fire:function(a,b){if(!this.last_active)return;Position.prepare();if(this.isAffected([Event.pointerX(a),Event.pointerY(a)],b,this.last_active))if(this.last_active.onDrop){this.last_active.onDrop(b,this.last_active.element,a);return true}},reset:function(){if(this.last_active)this.deactivate(this.last_active)}};Draggables={drags:[],observers:[],register:function(a){if(this.drags.length==0){this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.updateDrag.bindAsEventListener(this);this.eventKeypress=this.keyPress.bindAsEventListener(this);Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(document,"mousemove",this.eventMouseMove);Event.observe(document,"keypress",this.eventKeypress)}this.drags.push(a)},unregister:function(a){this.drags=this.drags.reject(function(b){return b==a});if(this.drags.length==0){Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);Event.stopObserving(document,"keypress",this.eventKeypress)}},activate:function(a){if(a.options.delay){this._timeout=setTimeout(function(){Draggables._timeout=null;window.focus();Draggables.activeDraggable=a}.bind(this),a.options.delay)}else{window.focus();this.activeDraggable=a}},deactivate:function(){this.activeDraggable=null},updateDrag:function(a){if(!this.activeDraggable)return;var b=[Event.pointerX(a),Event.pointerY(a)];if(this._lastPointer&&this._lastPointer.inspect()==b.inspect())return;this._lastPointer=b;this.activeDraggable.updateDrag(a,b)},endDrag:function(a){if(this._timeout){clearTimeout(this._timeout);this._timeout=null}if(!this.activeDraggable)return;this._lastPointer=null;this.activeDraggable.endDrag(a);this.activeDraggable=null},keyPress:function(a){if(this.activeDraggable)this.activeDraggable.keyPress(a)},addObserver:function(a){this.observers.push(a);this._cacheObserverCallbacks()},removeObserver:function(a){this.observers=this.observers.reject(function(b){return b.element==a});this._cacheObserverCallbacks()},notify:function(a,b,c){if(this[a+"Count"]>0)this.observers.each(function(d){if(d[a])d[a](a,b,c)});if(b.options[a])b.options[a](b,c)},_cacheObserverCallbacks:function(){["onStart","onEnd","onDrag"].each(function(a){Draggables[a+"Count"]=Draggables.observers.select(function(b){return b[a]}).length})}};Draggable=Class.create({initialize:function(a){var b,c;b={handle:false,reverteffect:function(a,b,c){var d=Math.sqrt(Math.abs(b^2)+Math.abs(c^2))*.02;new Effect.Move(a,{x:-c,y:-b,duration:d,queue:{scope:"_draggable",position:"end"}})},endeffect:function(a){var b=Object.isNumber(a._opacity)?a._opacity:1;new Effect.Opacity(a,{duration:.2,from:.7,to:b,queue:{scope:"_draggable",position:"end"},afterFinish:function(){Draggable._dragging[a]=false}})},zindex:1e3,revert:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,snap:false,delay:0};if(!arguments[1]||Object.isUndefined(arguments[1].endeffect))Object.extend(b,{starteffect:function(a){a._opacity=Element.getOpacity(a);Draggable._dragging[a]=true;new Effect.Opacity(a,{duration:.2,from:a._opacity,to:.7})}});c=Object.extend(b,arguments[1]||{});this.element=$(a);if(c.handle&&Object.isString(c.handle))this.handle=this.element.down("."+c.handle,0);if(!this.handle)this.handle=$(c.handle);if(!this.handle)this.handle=this.element;if(c.scroll&&!c.scroll.scrollTo&&!c.scroll.outerHTML){c.scroll=$(c.scroll);this._isScrollChild=Element.childOf(this.element,c.scroll)}Element.makePositioned(this.element);this.options=c;this.dragging=false;this.eventMouseDown=this.initDrag.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Draggables.register(this)},destroy:function(){Event.stopObserving(this.handle,"mousedown",this.eventMouseDown);Draggables.unregister(this)},currentDelta:function(){return[parseInt(Element.getStyle(this.element,"left")||"0"),parseInt(Element.getStyle(this.element,"top")||"0")]},initDrag:function(a){if(!Object.isUndefined(Draggable._dragging[this.element])&&Draggable._dragging[this.element])return;if(Event.isLeftClick(a)){var b,c,d;b=Event.element(a);if((tag_name=b.tagName.toUpperCase())&&(tag_name=="INPUT"||tag_name=="SELECT"||tag_name=="OPTION"||tag_name=="BUTTON"||tag_name=="TEXTAREA"))return;c=[Event.pointerX(a),Event.pointerY(a)];d=this.element.cumulativeOffset();this.offset=[0,1].map(function(a){return c[a]-d[a]});Draggables.activate(this);Event.stop(a)}},startDrag:function(a){this.dragging=true;if(!this.delta)this.delta=this.currentDelta();if(this.options.zindex){this.originalZ=parseInt(Element.getStyle(this.element,"z-index")||0);this.element.style.zIndex=this.options.zindex}if(this.options.ghosting){this._clone=this.element.cloneNode(true);this._originallyAbsolute=this.element.getStyle("position")=="absolute";if(!this._originallyAbsolute)Position.absolutize(this.element);this.element.parentNode.insertBefore(this._clone,this.element)}if(this.options.scroll){if(this.options.scroll==window){var b=this._getWindowScroll(this.options.scroll);this.originalScrollLeft=b.left;this.originalScrollTop=b.top}else{this.originalScrollLeft=this.options.scroll.scrollLeft;this.originalScrollTop=this.options.scroll.scrollTop}}Draggables.notify("onStart",this,a);if(this.options.starteffect)this.options.starteffect(this.element)},updateDrag:function(event,pointer){if(!this.dragging)this.startDrag(event);if(!this.options.quiet){Position.prepare();Droppables.show(pointer,this.element)}Draggables.notify("onDrag",this,event);this.draw(pointer);if(this.options.change)this.options.change(this);if(this.options.scroll){this.stopScrolling();var p,speed;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){p=[left,top,left+width,top+height]}}else{p=Position.page(this.options.scroll);p[0]+=this.options.scroll.scrollLeft+Position.deltaX;p[1]+=this.options.scroll.scrollTop+Position.deltaY;p.push(p[0]+this.options.scroll.offsetWidth);p.push(p[1]+this.options.scroll.offsetHeight)}speed=[0,0];if(pointer[0]<p[0]+this.options.scrollSensitivity)speed[0]=pointer[0]-(p[0]+this.options.scrollSensitivity);if(pointer[1]<p[1]+this.options.scrollSensitivity)speed[1]=pointer[1]-(p[1]+this.options.scrollSensitivity);if(pointer[0]>p[2]-this.options.scrollSensitivity)speed[0]=pointer[0]-(p[2]-this.options.scrollSensitivity);if(pointer[1]>p[3]-this.options.scrollSensitivity)speed[1]=pointer[1]-(p[3]-this.options.scrollSensitivity);this.startScrolling(speed)}if(Prototype.Browser.WebKit)window.scrollBy(0,0);Event.stop(event)},finishDrag:function(a,b){this.dragging=false;var c,d,e,f;if(this.options.quiet){Position.prepare();c=[Event.pointerX(a),Event.pointerY(a)];Droppables.show(c,this.element)}if(this.options.ghosting){if(!this._originallyAbsolute)Position.relativize(this.element);delete this._originallyAbsolute;Element.remove(this._clone);this._clone=null}d=false;if(b){d=Droppables.fire(a,this.element);if(!d)d=false}if(d&&this.options.onDropped)this.options.onDropped(this.element);Draggables.notify("onEnd",this,a);e=this.options.revert;if(e&&Object.isFunction(e))e=e(this.element);f=this.currentDelta();if(e&&this.options.reverteffect){if(d==0||e!="failure")this.options.reverteffect(this.element,f[1]-this.delta[1],f[0]-this.delta[0])}else{this.delta=f}if(this.options.zindex)this.element.style.zIndex=this.originalZ;if(this.options.endeffect)this.options.endeffect(this.element);Draggables.deactivate(this);Droppables.reset()},keyPress:function(a){if(a.keyCode!=Event.KEY_ESC)return;this.finishDrag(a,false);Event.stop(a)},endDrag:function(a){if(!this.dragging)return;this.stopScrolling();this.finishDrag(a,true);Event.stop(a)},draw:function(a){var b,c,d,e,f;b=this.element.cumulativeOffset();if(this.options.ghosting){c=Position.realOffset(this.element);b[0]+=c[0]-Position.deltaX;b[1]+=c[1]-Position.deltaY}d=this.currentDelta();b[0]-=d[0];b[1]-=d[1];if(this.options.scroll&&this.options.scroll!=window&&this._isScrollChild){b[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;b[1]-=this.options.scroll.scrollTop-this.originalScrollTop}e=[0,1].map(function(c){return a[c]-b[c]-this.offset[c]}.bind(this));if(this.options.snap){if(Object.isFunction(this.options.snap)){e=this.options.snap(e[0],e[1],this)}else{if(Object.isArray(this.options.snap)){e=e.map(function(a,b){return(a/this.options.snap[b]).round()*this.options.snap[b]}.bind(this))}else{e=e.map(function(a){return(a/this.options.snap).round()*this.options.snap}.bind(this))}}}f=this.element.style;if(!this.options.constraint||this.options.constraint=="horizontal")f.left=e[0]+"px";if(!this.options.constraint||this.options.constraint=="vertical")f.top=e[1]+"px";if(f.visibility=="hidden")f.visibility=""},stopScrolling:function(){if(this.scrollInterval){clearInterval(this.scrollInterval);this.scrollInterval=null;Draggables._lastScrollPointer=null}},startScrolling:function(a){if(!(a[0]||a[1]))return;this.scrollSpeed=[a[0]*this.options.scrollSpeed,a[1]*this.options.scrollSpeed];this.lastScrolled=new Date;this.scrollInterval=setInterval(this.scroll.bind(this),10)},scroll:function(){var current,delta,d;current=new Date;delta=current-this.lastScrolled;this.lastScrolled=current;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){if(this.scrollSpeed[0]||this.scrollSpeed[1]){d=delta/1e3;this.options.scroll.scrollTo(left+d*this.scrollSpeed[0],top+d*this.scrollSpeed[1])}}}else{this.options.scroll.scrollLeft+=this.scrollSpeed[0]*delta/1e3;this.options.scroll.scrollTop+=this.scrollSpeed[1]*delta/1e3}Position.prepare();Droppables.show(Draggables._lastPointer,this.element);Draggables.notify("onDrag",this);if(this._isScrollChild){Draggables._lastScrollPointer=Draggables._lastScrollPointer||$A(Draggables._lastPointer);Draggables._lastScrollPointer[0]+=this.scrollSpeed[0]*delta/1e3;Draggables._lastScrollPointer[1]+=this.scrollSpeed[1]*delta/1e3;if(Draggables._lastScrollPointer[0]<0)Draggables._lastScrollPointer[0]=0;if(Draggables._lastScrollPointer[1]<0)Draggables._lastScrollPointer[1]=0;this.draw(Draggables._lastScrollPointer)}if(this.options.change)this.options.change(this)},_getWindowScroll:function(w){var T,L,W,H;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft}else if(w.document.body){T=body.scrollTop;L=body.scrollLeft}if(w.innerWidth){W=w.innerWidth;H=w.innerHeight}else if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight}else{W=body.offsetWidth;H=body.offsetHeight}}return{top:T,left:L,width:W,height:H}}});Draggable._dragging={};SortableObserver=Class.create({initialize:function(a,b){this.element=$(a);this.observer=b;this.lastValue=Sortable.serialize(this.element)},onStart:function(){this.lastValue=Sortable.serialize(this.element)},onEnd:function(){Sortable.unmark();if(this.lastValue!=Sortable.serialize(this.element))this.observer(this.element)}});Sortable={SERIALIZE_RULE:/^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,sortables:{},_findRootElement:function(a){while(a.tagName.toUpperCase()!="BODY"){if(a.id&&Sortable.sortables[a.id])return a;a=a.parentNode}},options:function(a){a=Sortable._findRootElement($(a));if(!a)return;return Sortable.sortables[a.id]},destroy:function(a){a=$(a);var b=Sortable.sortables[a.id];if(b){Draggables.removeObserver(b.element);b.droppables.each(function(a){Droppables.remove(a)});b.draggables.invoke("destroy");delete Sortable.sortables[b.element.id]}},create:function(a){a=$(a);var b,c,d,e;b=Object.extend({element:a,tag:"li",dropOnEmpty:false,tree:false,treeTag:"ul",overlap:"vertical",constraint:"vertical",containment:a,handle:false,only:false,delay:0,hoverclass:null,ghosting:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,format:this.SERIALIZE_RULE,elements:false,handles:false,onChange:Prototype.emptyFunction,onUpdate:Prototype.emptyFunction},arguments[1]||{});this.destroy(a);c={revert:true,quiet:b.quiet,scroll:b.scroll,scrollSpeed:b.scrollSpeed,scrollSensitivity:b.scrollSensitivity,delay:b.delay,ghosting:b.ghosting,constraint:b.constraint,handle:b.handle};if(b.starteffect)c.starteffect=b.starteffect;if(b.reverteffect)c.reverteffect=b.reverteffect;else if(b.ghosting)c.reverteffect=function(a){a.style.top=0;a.style.left=0};if(b.endeffect)c.endeffect=b.endeffect;if(b.zindex)c.zindex=b.zindex;d={overlap:b.overlap,containment:b.containment,tree:b.tree,hoverclass:b.hoverclass,onHover:Sortable.onHover};e={onHover:Sortable.onEmptyHover,overlap:b.overlap,containment:b.containment,hoverclass:b.hoverclass};Element.cleanWhitespace(a);b.draggables=[];b.droppables=[];if(b.dropOnEmpty||b.tree){Droppables.add(a,e);b.droppables.push(a)}(b.elements||this.findElements(a,b)||[]).each(function(e,f){var g=b.handles?$(b.handles[f]):b.handle?$(e).select("."+b.handle)[0]:e;b.draggables.push(new Draggable(e,Object.extend(c,{handle:g})));Droppables.add(e,d);if(b.tree)e.treeNode=a;b.droppables.push(e)});if(b.tree){(Sortable.findTreeElements(a,b)||[]).each(function(c){Droppables.add(c,e);c.treeNode=a;b.droppables.push(c)})}this.sortables[a.identify()]=b;Draggables.addObserver(new SortableObserver(a,b.onUpdate))},findElements:function(a,b){return Element.findChildren(a,b.only,b.tree?true:false,b.tag)},findTreeElements:function(a,b){return Element.findChildren(a,b.only,b.tree?true:false,b.treeTag)},onHover:function(a,b,c){if(Element.isParent(b,a))return;var d,e;if(c>.33&&c<.66&&Sortable.options(b).tree){return}else if(c>.5){Sortable.mark(b,"before");if(b.previousSibling!=a){d=a.parentNode;a.style.visibility="hidden";b.parentNode.insertBefore(a,b);if(b.parentNode!=d)Sortable.options(d).onChange(a);Sortable.options(b.parentNode).onChange(a)}}else{Sortable.mark(b,"after");e=b.nextSibling||null;if(e!=a){d=a.parentNode;a.style.visibility="hidden";b.parentNode.insertBefore(a,e);if(b.parentNode!=d)Sortable.options(d).onChange(a);Sortable.options(b.parentNode).onChange(a)}}},onEmptyHover:function(a,b,c){var d,e,f,g,h,i;d=a.parentNode;e=Sortable.options(b);if(!Element.isParent(b,a)){g=Sortable.findElements(b,{tag:e.tag,only:e.only});h=null;if(g){i=Element.offsetSize(b,e.overlap)*(1-c);for(f=0;f<g.length;f+=1){if(i-Element.offsetSize(g[f],e.overlap)>=0){i-=Element.offsetSize(g[f],e.overlap)}else if(i-Element.offsetSize(g[f],e.overlap)/2>=0){h=f+1<g.length?g[f+1]:null;break}else{h=g[f];break}}}b.insertBefore(a,h);Sortable.options(d).onChange(a);e.onChange(a)}},unmark:function(){if(Sortable._marker)Sortable._marker.hide()},mark:function(a,b){var c,d;c=Sortable.options(a.parentNode);if(c&&!c.ghosting)return;if(!Sortable._marker){Sortable._marker=($("dropmarker")||Element.extend(document.createElement("DIV"))).hide().addClassName("dropmarker").setStyle({position:"absolute"});document.getElementsByTagName("body").item(0).appendChild(Sortable._marker)}d=a.cumulativeOffset();Sortable._marker.setStyle({left:d[0]+"px",top:d[1]+"px"});if(b=="after")if(c.overlap=="horizontal")Sortable._marker.setStyle({left:d[0]+a.clientWidth+"px"});else Sortable._marker.setStyle({top:d[1]+a.clientHeight+"px"});Sortable._marker.show()},_tree:function(a,b,c){var d,e,f,g;d=Sortable.findElements(a,b)||[];for(e=0;e<d.length;++e){f=d[e].id.match(b.format);if(!f)continue;g={id:encodeURIComponent(f?f[1]:null),element:a,parent:c,children:[],position:c.children.length,container:$(d[e]).down(b.treeTag)};if(g.container)this._tree(g.container,b,g);c.children.push(g)}return c},tree:function(a){a=$(a);var b,c,d;b=this.options(a);c=Object.extend({tag:b.tag,treeTag:b.treeTag,only:b.only,name:a.id,format:b.format},arguments[1]||{});d={id:null,parent:null,children:[],container:a,position:0};return Sortable._tree(a,c,d)},_constructIndex:function(a){var b="";do{if(a.id)b="["+a.position+"]"+b}while((a=a.parent)!=null);return b},sequence:function(a){a=$(a);var b=Object.extend(this.options(a),arguments[1]||{});return $(this.findElements(a,b)||[]).map(function(a){return a.id.match(b.format)?a.id.match(b.format)[1]:""})},setSequence:function(a,b){a=$(a);var c,d;c=Object.extend(this.options(a),arguments[2]||{});d={};this.findElements(a,c).each(function(a){if(a.id.match(c.format))d[a.id.match(c.format)[1]]=[a,a.parentNode];a.parentNode.removeChild(a)});b.each(function(a){var b=d[a];if(b){b[1].appendChild(b[0]);delete d[a]}})},serialize:function(a){a=$(a);var b,c;b=Object.extend(Sortable.options(a),arguments[1]||{});c=encodeURIComponent(arguments[1]&&arguments[1].name?arguments[1].name:a.id);if(b.tree){return Sortable.tree(a,arguments[1]).children.map(function(a){return[c+Sortable._constructIndex(a)+"[id]="+encodeURIComponent(a.id)].concat(a.children.map(arguments.callee))}).flatten().join("&")}else{return Sortable.sequence(a,arguments[1]).map(function(a){return c+"[]="+encodeURIComponent(a)}).join("&")}}};Element.isParent=function(a,b){if(!a.parentNode||a==b)return false;if(a.parentNode==b)return true;return Element.isParent(a.parentNode,b)};Element.findChildren=function(a,b,c,d){if(!a.hasChildNodes())return null;d=d.toUpperCase();if(b)b=[b].flatten();var e=[];$A(a.childNodes).each(function(a){if(a.tagName&&a.tagName.toUpperCase()==d&&(!b||Element.classNames(a).detect(function(a){return b.include(a)})))e.push(a);if(c){var f=Element.findChildren(a,b,c,d);if(f)e.push(f)}});return e.length>0?e.flatten():[]};Element.offsetSize=function(a,b){return a["offset"+(b=="vertical"||b=="height"?"Height":"Width")]};if(!Control)Control={};Control.Slider=Class.create({initialize:function(a,b,c){var d=this;if(Object.isArray(a)){this.handles=a.collect(function(a){return $(a)})}else{this.handles=[$(a)]}this.track=$(b);this.options=c||{};this.axis=this.options.axis||"horizontal";this.increment=this.options.increment||1;this.step=parseInt(this.options.step||"1");this.range=this.options.range||$R(0,1);this.value=0;this.values=this.handles.map(function(){return 0});this.spans=this.options.spans?this.options.spans.map(function(a){return $(a)}):false;this.options.startSpan=$(this.options.startSpan||null);this.options.endSpan=$(this.options.endSpan||null);this.restricted=this.options.restricted||false;this.maximum=this.options.maximum||this.range.end;this.minimum=this.options.minimum||this.range.start;this.alignX=parseInt(this.options.alignX||"0");this.alignY=parseInt(this.options.alignY||"0");this.trackLength=this.maximumOffset()-this.minimumOffset();this.handleLength=this.isVertical()?this.handles[0].offsetHeight!=0?this.handles[0].offsetHeight:this.handles[0].style.height.replace(/px$/,""):this.handles[0].offsetWidth!=0?this.handles[0].offsetWidth:this.handles[0].style.width.replace(/px$/,"");this.active=false;this.dragging=false;this.disabled=false;if(this.options.disabled)this.setDisabled();this.allowedValues=this.options.values?this.options.values.sortBy(Prototype.K):false;if(this.allowedValues){this.minimum=this.allowedValues.min();this.maximum=this.allowedValues.max()}this.eventMouseDown=this.startDrag.bindAsEventListener(this);this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.update.bindAsEventListener(this);this.handles.each(function(a,b){b=d.handles.length-1-b;d.setValue(parseFloat((Object.isArray(d.options.sliderValue)?d.options.sliderValue[b]:d.options.sliderValue)||d.range.start),b);a.makePositioned().observe("mousedown",d.eventMouseDown)});this.track.observe("mousedown",this.eventMouseDown);document.observe("mouseup",this.eventMouseUp);document.observe("mousemove",this.eventMouseMove);this.initialized=true},dispose:function(){var a=this;Event.stopObserving(this.track,"mousedown",this.eventMouseDown);Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);this.handles.each(function(b){Event.stopObserving(b,"mousedown",a.eventMouseDown)})},setDisabled:function(){this.disabled=true},setEnabled:function(){this.disabled=false},getNearestValue:function(a){if(this.allowedValues){if(a>=this.allowedValues.max())return this.allowedValues.max();if(a<=this.allowedValues.min())return this.allowedValues.min();var b,c,d;b=Math.abs(this.allowedValues[0]-a);c=this.allowedValues[0];this.allowedValues.each(function(e){d=Math.abs(e-a);if(d<=b){c=e;b=d}});return c}if(a>this.range.end)return this.range.end;if(a<this.range.start)return this.range.start;return a},setValue:function(a,b){if(!this.active){this.activeHandleIdx=b||0;this.activeHandle=this.handles[this.activeHandleIdx];this.updateStyles()}b=b||this.activeHandleIdx||0;if(this.initialized&&this.restricted){if(b>0&&a<this.values[b-1])a=this.values[b-1];if(b<this.handles.length-1&&a>this.values[b+1])a=this.values[b+1]}a=this.getNearestValue(a);this.values[b]=a;this.value=this.values[0];this.handles[b].style[this.isVertical()?"top":"left"]=this.translateToPx(a);this.drawSpans();if(!this.dragging||!this.event)this.updateFinished()},setValueBy:function(a,b){this.setValue(this.values[b||this.activeHandleIdx||0]+a,b||this.activeHandleIdx||0)},translateToPx:function(a){return Math.round((this.trackLength-this.handleLength)/(this.range.end-this.range.start)*(a-this.range.start))+"px"},translateToValue:function(a){return a/(this.trackLength-this.handleLength)*(this.range.end-this.range.start)+this.range.start},getRange:function(a){var b=this.values.sortBy(Prototype.K);a=a||0;return $R(b[a],b[a+1])},minimumOffset:function(){return this.isVertical()?this.alignY:this.alignX},maximumOffset:function(){return this.isVertical()?(this.track.offsetHeight!=0?this.track.offsetHeight:this.track.style.height.replace(/px$/,""))-this.alignY:(this.track.offsetWidth!=0?this.track.offsetWidth:this.track.style.width.replace(/px$/,""))-this.alignX},isVertical:function(){return this.axis=="vertical"},drawSpans:function(){var a=this;if(this.spans)$R(0,this.spans.length-1).each(function(b){a.setSpan(a.spans[b],a.getRange(b))});if(this.options.startSpan)this.setSpan(this.options.startSpan,$R(0,this.values.length>1?this.getRange(0).min():this.value));if(this.options.endSpan)this.setSpan(this.options.endSpan,$R(this.values.length>1?this.getRange(this.spans.length-1).max():this.value,this.maximum))},setSpan:function(a,b){if(this.isVertical()){a.style.top=this.translateToPx(b.start);a.style.height=this.translateToPx(b.end-b.start+this.range.start)}else{a.style.left=this.translateToPx(b.start);a.style.width=this.translateToPx(b.end-b.start+this.range.start)}},updateStyles:function(){this.handles.each(function(a){Element.removeClassName(a,"selected")});Element.addClassName(this.activeHandle,"selected")},startDrag:function(a){if(Event.isLeftClick(a)){if(!this.disabled){this.active=true;var b,c,d,e;b=Event.element(a);c=[Event.pointerX(a),Event.pointerY(a)];d=b;if(d==this.track){e=this.track.cumulativeOffset();this.event=a;this.setValue(this.translateToValue((this.isVertical()?c[1]-e[1]:c[0]-e[0])-this.handleLength/2));e=this.activeHandle.cumulativeOffset();this.offsetX=c[0]-e[0];this.offsetY=c[1]-e[1]}else{while(this.handles.indexOf(b)==-1&&b.parentNode)b=b.parentNode;if(this.handles.indexOf(b)!=-1){this.activeHandle=b;this.activeHandleIdx=this.handles.indexOf(this.activeHandle);this.updateStyles();e=this.activeHandle.cumulativeOffset();this.offsetX=c[0]-e[0];this.offsetY=c[1]-e[1]}}}Event.stop(a)}},update:function(a){if(this.active){if(!this.dragging)this.dragging=true;this.draw(a);if(Prototype.Browser.WebKit)window.scrollBy(0,0);Event.stop(a)}},draw:function(a){var b,c;b=[Event.pointerX(a),Event.pointerY(a)];c=this.track.cumulativeOffset();b[0]-=this.offsetX+c[0];b[1]-=this.offsetY+c[1];this.event=a;this.setValue(this.translateToValue(this.isVertical()?b[1]:b[0]));if(this.initialized&&this.options.onSlide)this.options.onSlide(this.values.length>1?this.values:this.value,this)},endDrag:function(a){if(this.active&&this.dragging){this.finishDrag(a,true);Event.stop(a)}this.active=false;this.dragging=false},finishDrag:function(a,b){this.active=false;this.dragging=false;this.updateFinished()},updateFinished:function(){if(this.initialized&&this.options.onChange)this.options.onChange(this.values.length>1?this.values:this.value,this);this.event=null}});Sound={tracks:{},_enabled:true,template:new Template('<embed style="height:0" id="sound_#{track}_#{id}" src="#{url}" loop="false" autostart="true" hidden="true"/>'),enable:function(){Sound._enabled=true},disable:function(){Sound._enabled=false},play:function(a){if(!Sound._enabled)return;var b=Object.extend({track:"global",url:a,replace:false},arguments[1]||{});if(b.replace&&this.tracks[b.track]){$R(0,this.tracks[b.track].id).each(function(a){var c=$("sound_"+b.track+"_"+a);c.Stop&&c.Stop();c.remove()});this.tracks[b.track]=null}if(!this.tracks[b.track])this.tracks[b.track]={id:0};else this.tracks[b.track].id++;b.id=this.tracks[b.track].id;$$("body")[0].insert(Prototype.Browser.IE?new Element("bgsound",{id:"sound_"+b.track+"_"+b.id,src:b.url,loop:1,autostart:true}):Sound.template.evaluate(b))}};if(Prototype.Browser.Gecko&&navigator.userAgent.indexOf("Win")>0){if(navigator.plugins&&$A(navigator.plugins).detect(function(a){return a.name.indexOf("QuickTime")!=-1}))Sound.template=new Template('<object id="sound_#{track}_#{id}" width="0" height="0" type="audio/mpeg" data="#{url}"/>');else if(navigator.plugins&&$A(navigator.plugins).detect(function(a){return a.name.indexOf("Windows Media")!=-1}))Sound.template=new Template('<object id="sound_#{track}_#{id}" type="application/x-mplayer2" data="#{url}"></object>');else if(navigator.plugins&&$A(navigator.plugins).detect(function(a){return a.name.indexOf("RealPlayer")!=-1}))Sound.template=new Template('<embed type="audio/x-pn-realaudio-plugin" style="height:0" id="sound_#{track}_#{id}" src="#{url}" loop="false" autostart="true" hidden="true"/>');else Sound.play=function(){}}
